diff options
author | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2015-08-24 13:47:54 +0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2016-01-11 15:18:57 +0100 |
commit | d9c21e3e4b459b45e11406b83ebde163181508a1 (patch) | |
tree | 4a146eaed62e9ea09d26ef1f5e98a3adec3a5611 /drivers/media/v4l2-core/v4l2-device.c | |
parent | [media] dvbdev: returns error if graph object creation fails (diff) | |
download | linux-d9c21e3e4b459b45e11406b83ebde163181508a1.tar.xz linux-d9c21e3e4b459b45e11406b83ebde163181508a1.zip |
[media] v4l2-core: create MC interfaces for devnodes
V4L2 device (and subdevice) nodes should create an interface, if the
Media Controller support is enabled.
Please notice that radio devices should not create an entity, as radio
input/output is either via wires or via ALSA.
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/v4l2-core/v4l2-device.c')
-rw-r--r-- | drivers/media/v4l2-core/v4l2-device.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/drivers/media/v4l2-core/v4l2-device.c b/drivers/media/v4l2-core/v4l2-device.c index 7129e438f29e..3c87307e56f0 100644 --- a/drivers/media/v4l2-core/v4l2-device.c +++ b/drivers/media/v4l2-core/v4l2-device.c @@ -258,6 +258,17 @@ int v4l2_device_register_subdev_nodes(struct v4l2_device *v4l2_dev) #if defined(CONFIG_MEDIA_CONTROLLER) sd->entity.info.dev.major = VIDEO_MAJOR; sd->entity.info.dev.minor = vdev->minor; + + /* Interface is created by __video_register_device() */ + if (vdev->v4l2_dev->mdev) { + struct media_link *link; + + link = media_create_intf_link(&sd->entity, + &vdev->intf_devnode->intf, + 0); + if (!link) + goto clean_up; + } #endif sd->devnode = vdev; } @@ -294,7 +305,10 @@ void v4l2_device_unregister_subdev(struct v4l2_subdev *sd) #if defined(CONFIG_MEDIA_CONTROLLER) if (v4l2_dev->mdev) { - media_entity_remove_links(&sd->entity); + /* + * No need to explicitly remove links, as both pads and + * links are removed by the function below, in the right order + */ media_device_unregister_entity(&sd->entity); } #endif |