aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>2016-03-03 18:06:22 -0500
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2016-06-17 07:13:42 -0400
commit7cf0f123c7354aa9b11cad5e3fdd9a5435cde4f0 (patch)
treed7c6e636b0b372cc5dd7102f1e9aa174d694b1a9
parent44f4619857766289c99e5d61a87ba1621e8ddef6 (diff)
[media] v4l: vsp1: Replace container_of() with dedicated macro
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>
-rw-r--r--drivers/media/platform/vsp1/vsp1_entity.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/media/platform/vsp1/vsp1_entity.c b/drivers/media/platform/vsp1/vsp1_entity.c
index 6a96ea77de69..f60d7926d53f 100644
--- a/drivers/media/platform/vsp1/vsp1_entity.c
+++ b/drivers/media/platform/vsp1/vsp1_entity.c
@@ -22,6 +22,12 @@
22#include "vsp1_dl.h" 22#include "vsp1_dl.h"
23#include "vsp1_entity.h" 23#include "vsp1_entity.h"
24 24
25static inline struct vsp1_entity *
26media_entity_to_vsp1_entity(struct media_entity *entity)
27{
28 return container_of(entity, struct vsp1_entity, subdev.entity);
29}
30
25void vsp1_entity_route_setup(struct vsp1_entity *source, 31void vsp1_entity_route_setup(struct vsp1_entity *source,
26 struct vsp1_dl_list *dl) 32 struct vsp1_dl_list *dl)
27{ 33{
@@ -30,7 +36,7 @@ void vsp1_entity_route_setup(struct vsp1_entity *source,
30 if (source->route->reg == 0) 36 if (source->route->reg == 0)
31 return; 37 return;
32 38
33 sink = container_of(source->sink, struct vsp1_entity, subdev.entity); 39 sink = media_entity_to_vsp1_entity(source->sink);
34 vsp1_dl_list_write(dl, source->route->reg, 40 vsp1_dl_list_write(dl, source->route->reg,
35 sink->route->inputs[source->sink_pad]); 41 sink->route->inputs[source->sink_pad]);
36} 42}
@@ -252,7 +258,7 @@ int vsp1_entity_link_setup(struct media_entity *entity,
252 if (!(local->flags & MEDIA_PAD_FL_SOURCE)) 258 if (!(local->flags & MEDIA_PAD_FL_SOURCE))
253 return 0; 259 return 0;
254 260
255 source = container_of(local->entity, struct vsp1_entity, subdev.entity); 261 source = media_entity_to_vsp1_entity(local->entity);
256 262
257 if (!source->route) 263 if (!source->route)
258 return 0; 264 return 0;