summaryrefslogtreecommitdiff
path: root/drivers/media/platform/vimc/vimc-debayer.c
diff options
context:
space:
mode:
authorDafna Hirschfeld <dafna.hirschfeld@collabora.com>2019-10-03 09:59:42 -0300
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2019-10-24 19:03:28 -0300
commit23df45d038662da2b1e017cf38165a88dfd7f543 (patch)
tree2462c2b1ac4a8eb62e0056c7afa28ac72f07f3ab /drivers/media/platform/vimc/vimc-debayer.c
parentad1cec89db964cc3391fa67b1d1d93482727a439 (diff)
media: vimc: embed the pads of entities in the entities' structs
since the pads array is of known small size, there is no reason to allocate it separately. Instead, it is embedded in the entity struct. This also conforms to the media controller doc: 'Most drivers will embed the pads array in a driver-specific structure, avoiding dynamic allocation.' Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com> [hverkuil-cisco@xs4all.nl: remove unused vimc_pads_init()] Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'drivers/media/platform/vimc/vimc-debayer.c')
-rw-r--r--drivers/media/platform/vimc/vimc-debayer.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/media/platform/vimc/vimc-debayer.c b/drivers/media/platform/vimc/vimc-debayer.c
index 4e5316c671e0..a601ca3a0a54 100644
--- a/drivers/media/platform/vimc/vimc-debayer.c
+++ b/drivers/media/platform/vimc/vimc-debayer.c
@@ -44,6 +44,7 @@ struct vimc_deb_device {
u8 *src_frame;
const struct vimc_deb_pix_map *sink_pix_map;
unsigned int sink_bpp;
+ struct media_pad pads[2];
};
static const struct v4l2_mbus_framefmt sink_fmt_default = {
@@ -478,7 +479,6 @@ static void vimc_deb_release(struct v4l2_subdev *sd)
container_of(sd, struct vimc_deb_device, sd);
media_entity_cleanup(vdeb->ved.ent);
- vimc_pads_cleanup(vdeb->ved.pads);
kfree(vdeb);
}
@@ -507,11 +507,13 @@ struct vimc_ent_device *vimc_deb_add(struct vimc_device *vimc,
return NULL;
/* Initialize ved and sd */
+ vdeb->pads[0].flags = MEDIA_PAD_FL_SINK;
+ vdeb->pads[1].flags = MEDIA_PAD_FL_SOURCE;
+
ret = vimc_ent_sd_register(&vdeb->ved, &vdeb->sd, v4l2_dev,
vcfg_name,
MEDIA_ENT_F_PROC_VIDEO_PIXEL_ENC_CONV, 2,
- (const unsigned long[2]) {MEDIA_PAD_FL_SINK,
- MEDIA_PAD_FL_SOURCE},
+ vdeb->pads,
&vimc_deb_int_ops, &vimc_deb_ops);
if (ret) {
kfree(vdeb);