Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c5a98cac authored by Javier Martinez Canillas's avatar Javier Martinez Canillas Committed by Mauro Carvalho Chehab
Browse files

[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: default avatarJavier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent c7621b30
Loading
Loading
Loading
Loading
+19 −4
Original line number Diff line number Diff line
@@ -25,6 +25,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;
@@ -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);
}

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;
}