media: uvcvideo: Allow extra entities
authorRicardo Ribalda <ribalda@chromium.org>
Wed, 23 Dec 2020 13:35:18 +0000 (14:35 +0100)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Wed, 27 Jan 2021 14:01:41 +0000 (15:01 +0100)
Increase the size of the id, to avoid collisions with entities
implemented by the driver that are not part of the UVC device.

Entities exposed by the UVC device use IDs 0-255, extra entities
implemented by the driver (such as the GPIO entity) use IDs 256 and
up.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/usb/uvc/uvc_driver.c
drivers/media/usb/uvc/uvcvideo.h

index be9700b422f6ec420dce45f6359ce357a620ae8e..dd2e4998e564b9869ada5123da28aa975ab40e2c 100644 (file)
@@ -1024,7 +1024,7 @@ static const u8 uvc_media_transport_input_guid[16] =
        UVC_GUID_UVC_MEDIA_TRANSPORT_INPUT;
 static const u8 uvc_processing_guid[16] = UVC_GUID_UVC_PROCESSING;
 
-static struct uvc_entity *uvc_alloc_entity(u16 type, u8 id,
+static struct uvc_entity *uvc_alloc_entity(u16 type, u16 id,
                unsigned int num_pads, unsigned int extra_size)
 {
        struct uvc_entity *entity;
index 459b2450accffd7b520c840f8d5313f5b745105d..2643d9adfd4a942f25c03353092f5ea3f73bca6b 100644 (file)
@@ -301,7 +301,12 @@ struct uvc_entity {
                                         * chain. */
        unsigned int flags;
 
-       u8 id;
+       /*
+        * Entities exposed by the UVC device use IDs 0-255, extra entities
+        * implemented by the driver (such as the GPIO entity) use IDs 256 and
+        * up.
+        */
+       u16 id;
        u16 type;
        char name[64];
        u8 guid[16];