diff mbox series

[4/6] usb: gadget: uvc: Remove the hardcoded default color matching

Message ID 20221213083736.2284536-5-dan.scally@ideasonboard.com
State Superseded
Headers show
Series UVC Gadget: Extend color matching support | expand

Commit Message

Daniel Scally Dec. 13, 2022, 8:37 a.m. UTC
A hardcoded default color matching descriptor is embedded in struct
f_uvc_opts but no longer has any use - remove it.

Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>
---
 drivers/usb/gadget/function/f_uvc.c | 9 ---------
 drivers/usb/gadget/function/u_uvc.h | 1 -
 2 files changed, 10 deletions(-)

Comments

Daniel Scally Dec. 16, 2022, 3:32 p.m. UTC | #1
Hi Kieran

On 15/12/2022 11:48, Kieran Bingham wrote:
> Quoting Daniel Scally (2022-12-13 08:37:34)
>> A hardcoded default color matching descriptor is embedded in struct
>> f_uvc_opts but no longer has any use - remove it.
> Does this affect the legacy g_webcam, or is this part independent ?


It's not independent, but the legacy gadget doesn't use the 
uvc_color_matching member of f_uvc_opts. Instead that file has a static 
definition of the same thing [1], so this is safe to remove here.


The legacy version does actually have the same issue with just a single 
color matching descriptor trailing all the format/frame descriptors 
rather than once-per-format...I'll patch that too.

>
>> Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>
>> ---
>>   drivers/usb/gadget/function/f_uvc.c | 9 ---------
>>   drivers/usb/gadget/function/u_uvc.h | 1 -
>>   2 files changed, 10 deletions(-)
>>
>> diff --git a/drivers/usb/gadget/function/f_uvc.c b/drivers/usb/gadget/function/f_uvc.c
>> index 6e196e06181e..46bdea73cdeb 100644
>> --- a/drivers/usb/gadget/function/f_uvc.c
>> +++ b/drivers/usb/gadget/function/f_uvc.c
>> @@ -793,7 +793,6 @@ static struct usb_function_instance *uvc_alloc_inst(void)
>>          struct uvc_camera_terminal_descriptor *cd;
>>          struct uvc_processing_unit_descriptor *pd;
>>          struct uvc_output_terminal_descriptor *od;
>> -       struct uvc_color_matching_descriptor *md;
>>          struct uvc_descriptor_header **ctl_cls;
>>          int ret;
>>   
>> @@ -842,14 +841,6 @@ static struct usb_function_instance *uvc_alloc_inst(void)
>>          od->bSourceID                   = 2;
>>          od->iTerminal                   = 0;
>>   
>> -       md = &opts->uvc_color_matching;
>> -       md->bLength                     = UVC_DT_COLOR_MATCHING_SIZE;
>> -       md->bDescriptorType             = USB_DT_CS_INTERFACE;
>> -       md->bDescriptorSubType          = UVC_VS_COLORFORMAT;
>> -       md->bColorPrimaries             = 1;
>> -       md->bTransferCharacteristics    = 1;
>> -       md->bMatrixCoefficients         = 4;
>> -
>>          /* Prepare fs control class descriptors for configfs-based gadgets */
>>          ctl_cls = opts->uvc_fs_control_cls;
>>          ctl_cls[0] = NULL;      /* assigned elsewhere by configfs */
>> diff --git a/drivers/usb/gadget/function/u_uvc.h b/drivers/usb/gadget/function/u_uvc.h
>> index 24b8681b0d6f..577c1c48ca4a 100644
>> --- a/drivers/usb/gadget/function/u_uvc.h
>> +++ b/drivers/usb/gadget/function/u_uvc.h
>> @@ -52,7 +52,6 @@ struct f_uvc_opts {
>>          struct uvc_camera_terminal_descriptor           uvc_camera_terminal;
>>          struct uvc_processing_unit_descriptor           uvc_processing;
>>          struct uvc_output_terminal_descriptor           uvc_output_terminal;
>> -       struct uvc_color_matching_descriptor            uvc_color_matching;
>>   
>>          /*
>>           * Control descriptors pointers arrays for full-/high-speed and
>> -- 
>> 2.34.1
>>
diff mbox series

Patch

diff --git a/drivers/usb/gadget/function/f_uvc.c b/drivers/usb/gadget/function/f_uvc.c
index 6e196e06181e..46bdea73cdeb 100644
--- a/drivers/usb/gadget/function/f_uvc.c
+++ b/drivers/usb/gadget/function/f_uvc.c
@@ -793,7 +793,6 @@  static struct usb_function_instance *uvc_alloc_inst(void)
 	struct uvc_camera_terminal_descriptor *cd;
 	struct uvc_processing_unit_descriptor *pd;
 	struct uvc_output_terminal_descriptor *od;
-	struct uvc_color_matching_descriptor *md;
 	struct uvc_descriptor_header **ctl_cls;
 	int ret;
 
@@ -842,14 +841,6 @@  static struct usb_function_instance *uvc_alloc_inst(void)
 	od->bSourceID			= 2;
 	od->iTerminal			= 0;
 
-	md = &opts->uvc_color_matching;
-	md->bLength			= UVC_DT_COLOR_MATCHING_SIZE;
-	md->bDescriptorType		= USB_DT_CS_INTERFACE;
-	md->bDescriptorSubType		= UVC_VS_COLORFORMAT;
-	md->bColorPrimaries		= 1;
-	md->bTransferCharacteristics	= 1;
-	md->bMatrixCoefficients		= 4;
-
 	/* Prepare fs control class descriptors for configfs-based gadgets */
 	ctl_cls = opts->uvc_fs_control_cls;
 	ctl_cls[0] = NULL;	/* assigned elsewhere by configfs */
diff --git a/drivers/usb/gadget/function/u_uvc.h b/drivers/usb/gadget/function/u_uvc.h
index 24b8681b0d6f..577c1c48ca4a 100644
--- a/drivers/usb/gadget/function/u_uvc.h
+++ b/drivers/usb/gadget/function/u_uvc.h
@@ -52,7 +52,6 @@  struct f_uvc_opts {
 	struct uvc_camera_terminal_descriptor		uvc_camera_terminal;
 	struct uvc_processing_unit_descriptor		uvc_processing;
 	struct uvc_output_terminal_descriptor		uvc_output_terminal;
-	struct uvc_color_matching_descriptor		uvc_color_matching;
 
 	/*
 	 * Control descriptors pointers arrays for full-/high-speed and