[media] v4l: vsp1: Replace container_of() with dedicated macro
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Thu, 3 Mar 2016 23:06:22 +0000 (20:06 -0300)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Fri, 17 Jun 2016 11:13:42 +0000 (08:13 -0300)
Add a macro to cast from a struct media_entity to a struct vsp1_entity
to replace the manual implementations.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/platform/vsp1/vsp1_entity.c

index 6a96ea77de6906b717f77f988c58fefae1a94ea6..f60d7926d53fdd02dced62bd713b6b6d2a38e7d4 100644 (file)
 #include "vsp1_dl.h"
 #include "vsp1_entity.h"
 
+static inline struct vsp1_entity *
+media_entity_to_vsp1_entity(struct media_entity *entity)
+{
+       return container_of(entity, struct vsp1_entity, subdev.entity);
+}
+
 void vsp1_entity_route_setup(struct vsp1_entity *source,
                             struct vsp1_dl_list *dl)
 {
@@ -30,7 +36,7 @@ void vsp1_entity_route_setup(struct vsp1_entity *source,
        if (source->route->reg == 0)
                return;
 
-       sink = container_of(source->sink, struct vsp1_entity, subdev.entity);
+       sink = media_entity_to_vsp1_entity(source->sink);
        vsp1_dl_list_write(dl, source->route->reg,
                           sink->route->inputs[source->sink_pad]);
 }
@@ -252,7 +258,7 @@ int vsp1_entity_link_setup(struct media_entity *entity,
        if (!(local->flags & MEDIA_PAD_FL_SOURCE))
                return 0;
 
-       source = container_of(local->entity, struct vsp1_entity, subdev.entity);
+       source = media_entity_to_vsp1_entity(local->entity);
 
        if (!source->route)
                return 0;
This page took 0.027115 seconds and 5 git commands to generate.