diff options
author | Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> | 2015-11-16 00:42:01 +0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2016-04-13 23:51:24 +0300 |
commit | 823329dfee7224712569cc4899720bc470a2fe56 (patch) | |
tree | 36fef23f5c8cf96f1f9db7c7dd913d5744fcfa12 /drivers/media/platform/vsp1/vsp1_uds.c | |
parent | 351bbf99f245f4bada0edec3b0863146d71f06a9 (diff) | |
download | linux-823329dfee7224712569cc4899720bc470a2fe56.tar.xz |
[media] v4l: vsp1: Move subdev initialization code to vsp1_entity_init()
Don't duplicate the code in every module driver, centralize it in a
single place.
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/platform/vsp1/vsp1_uds.c')
-rw-r--r-- | drivers/media/platform/vsp1/vsp1_uds.c | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/drivers/media/platform/vsp1/vsp1_uds.c b/drivers/media/platform/vsp1/vsp1_uds.c index 83ec8942f8e7..34689adda810 100644 --- a/drivers/media/platform/vsp1/vsp1_uds.c +++ b/drivers/media/platform/vsp1/vsp1_uds.c @@ -322,8 +322,8 @@ static struct v4l2_subdev_ops uds_ops = { struct vsp1_uds *vsp1_uds_create(struct vsp1_device *vsp1, unsigned int index) { - struct v4l2_subdev *subdev; struct vsp1_uds *uds; + char name[6]; int ret; uds = devm_kzalloc(vsp1->dev, sizeof(*uds), GFP_KERNEL); @@ -333,22 +333,10 @@ struct vsp1_uds *vsp1_uds_create(struct vsp1_device *vsp1, unsigned int index) uds->entity.type = VSP1_ENTITY_UDS; uds->entity.index = index; - ret = vsp1_entity_init(vsp1, &uds->entity, 2); + sprintf(name, "uds.%u", index); + ret = vsp1_entity_init(vsp1, &uds->entity, name, 2, &uds_ops); if (ret < 0) return ERR_PTR(ret); - /* Initialize the V4L2 subdev. */ - subdev = &uds->entity.subdev; - v4l2_subdev_init(subdev, &uds_ops); - - subdev->entity.ops = &vsp1->media_ops; - subdev->internal_ops = &vsp1_subdev_internal_ops; - snprintf(subdev->name, sizeof(subdev->name), "%s uds.%u", - dev_name(vsp1->dev), index); - v4l2_set_subdevdata(subdev, uds); - subdev->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; - - vsp1_entity_init_formats(subdev, NULL); - return uds; } |