diff mbox

[1/3] uvcvideo: initialise the entity function field

Message ID Pine.LNX.4.64.1606241326030.23461@axis700.grange (mailing list archive)
State New, archived
Headers show

Commit Message

Guennadi Liakhovetski June 24, 2016, 11:28 a.m. UTC
Since a recent commit:

[media] media-device: move media entity register/unregister functions

drivers have to set entity function before registering an entity. Fix
the uvcvideo driver to comply with this.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
---
 drivers/media/usb/uvc/uvc_entity.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Laurent Pinchart June 24, 2016, 1:26 p.m. UTC | #1
Hi Guennadi,

Thank you for the patch.

On Friday 24 Jun 2016 13:28:55 Guennadi Liakhovetski wrote:
> Since a recent commit:
> 
> [media] media-device: move media entity register/unregister functions
> 
> drivers have to set entity function before registering an entity. Fix
> the uvcvideo driver to comply with this.
> 
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> ---
>  drivers/media/usb/uvc/uvc_entity.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/media/usb/uvc/uvc_entity.c
> b/drivers/media/usb/uvc/uvc_entity.c index ac386bb..d93f413 100644
> --- a/drivers/media/usb/uvc/uvc_entity.c
> +++ b/drivers/media/usb/uvc/uvc_entity.c
> @@ -88,6 +88,11 @@ static int uvc_mc_init_entity(struct uvc_video_chain
> *chain, if (ret < 0)
>  			return ret;
> 
> +		if (UVC_ENTITY_TYPE(entity) == UVC_ITT_CAMERA)
> +			entity->subdev.entity.function = 
MEDIA_ENT_F_CAM_SENSOR;
> +		else
> +			entity->subdev.entity.function = MEDIA_ENT_F_IO_V4L;
> +

I've discussed this some time ago with Hans (over IRC if I recall correctly). 
We need to define new functions, as not all UVC entities map to the existing 
ones. MEDIA_ENT_F_CAM_SENSOR should be fine for UVC_ITT_CAMERA, but 
MEDIA_ENT_F_IO_V4L isn't right as a default.

>  		ret = v4l2_device_register_subdev(&chain->dev->vdev,
>  						  &entity->subdev);
>  	} else if (entity->vdev != NULL) {
diff mbox

Patch

diff --git a/drivers/media/usb/uvc/uvc_entity.c b/drivers/media/usb/uvc/uvc_entity.c
index ac386bb..d93f413 100644
--- a/drivers/media/usb/uvc/uvc_entity.c
+++ b/drivers/media/usb/uvc/uvc_entity.c
@@ -88,6 +88,11 @@  static int uvc_mc_init_entity(struct uvc_video_chain *chain,
 		if (ret < 0)
 			return ret;
 
+		if (UVC_ENTITY_TYPE(entity) == UVC_ITT_CAMERA)
+			entity->subdev.entity.function = MEDIA_ENT_F_CAM_SENSOR;
+		else
+			entity->subdev.entity.function = MEDIA_ENT_F_IO_V4L;
+
 		ret = v4l2_device_register_subdev(&chain->dev->vdev,
 						  &entity->subdev);
 	} else if (entity->vdev != NULL) {