summaryrefslogtreecommitdiff
path: root/drivers/media/usb/uvc
diff options
context:
space:
mode:
authorJavier Martinez Canillas <javier@osg.samsung.com>2015-09-03 11:46:06 (GMT)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2016-01-11 14:18:46 (GMT)
commitc5a98cac6ecd78ca647c41cb25e3ea1835579d70 (patch)
treed320097f9a8ba2ca65606f15ea41279471e8c42c /drivers/media/usb/uvc
parentc7621b3044f705dd20019e82a8418491b8080327 (diff)
downloadlinux-c5a98cac6ecd78ca647c41cb25e3ea1835579d70.tar.xz
[media] uvcvideo: create pad links after subdev registration
The uvc driver creates the pads links before the media entity is registered with the media device. This doesn't work now that obj IDs are used to create links so the media_device has to be set. Move entities registration logic before pads links creation. Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/usb/uvc')
-rw-r--r--drivers/media/usb/uvc/uvc_entity.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/drivers/media/usb/uvc/uvc_entity.c b/drivers/media/usb/uvc/uvc_entity.c
index 429e428..7f82b65 100644
--- a/drivers/media/usb/uvc/uvc_entity.c
+++ b/drivers/media/usb/uvc/uvc_entity.c
@@ -26,6 +26,15 @@
static int uvc_mc_register_entity(struct uvc_video_chain *chain,
struct uvc_entity *entity)
{
+ if (UVC_ENTITY_TYPE(entity) == UVC_TT_STREAMING)
+ return 0;
+
+ return v4l2_device_register_subdev(&chain->dev->vdev, &entity->subdev);
+}
+
+static int uvc_mc_create_pads_links(struct uvc_video_chain *chain,
+ struct uvc_entity *entity)
+{
const u32 flags = MEDIA_LNK_FL_ENABLED | MEDIA_LNK_FL_IMMUTABLE;
struct media_entity *sink;
unsigned int i;
@@ -62,10 +71,7 @@ static int uvc_mc_register_entity(struct uvc_video_chain *chain,
return ret;
}
- if (UVC_ENTITY_TYPE(entity) == UVC_TT_STREAMING)
- return 0;
-
- return v4l2_device_register_subdev(&chain->dev->vdev, &entity->subdev);
+ return 0;
}
static struct v4l2_subdev_ops uvc_subdev_ops = {
@@ -124,5 +130,14 @@ int uvc_mc_register_entities(struct uvc_video_chain *chain)
}
}
+ list_for_each_entry(entity, &chain->entities, chain) {
+ ret = uvc_mc_create_pads_links(chain, entity);
+ if (ret < 0) {
+ uvc_printk(KERN_INFO, "Failed to create pads links for "
+ "entity %u\n", entity->id);
+ return ret;
+ }
+ }
+
return 0;
}