Re: [PATCH] usb: descriptor field name fix

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 01/03/2012 09:44 AM, Sarah Sharp wrote:
> Hi Andiry,
> 
> On Thu, Dec 22, 2011 at 02:23:06PM +0800, Andiry Xu wrote:
>> Rename the fields in USB SS device capability descriptor to comply
>> with USB3.0 specification.
> 
> This is more than a simple rename, right?  Most of it is a rename, but
> there's also a bug fix in the composite driver to make sure it converts
> the default U2 latency to le16.  Maybe that should be a separate bug fix
> marked for stable before the rename patch?
> 

Actually, this patch is a rename patch. Composite driver already uses
cpu_to_le16() and I did not touch it. But after double-check I do find
some endian issues in storage gadget driver. I will re-submit the
patchset, a bug fix patch followed by the rename patch.

Thanks,
Andiry

> 
>> Signed-off-by: Andiry Xu <andiry.xu@xxxxxxx>
>> Cc: Felipe Balbi <balbi@xxxxxx>
>> Cc: Sarah Sharp <sarah.a.sharp@xxxxxxxxxxxxxxx>
>> ---
>>  drivers/usb/gadget/composite.c      |    8 ++++----
>>  drivers/usb/gadget/storage_common.c |    4 ++--
>>  drivers/usb/host/xhci-hub.c         |    2 +-
>>  include/linux/usb/ch9.h             |    4 ++--
>>  include/linux/usb/gadget.h          |    4 ++--
>>  5 files changed, 11 insertions(+), 11 deletions(-)
>>
>> diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
>> index f71b078..66bf18d 100644
>> --- a/drivers/usb/gadget/composite.c
>> +++ b/drivers/usb/gadget/composite.c
>> @@ -543,12 +543,12 @@ static int bos_desc(struct usb_composite_dev *cdev)
>>  	if (cdev->gadget->ops->get_config_params)
>>  		cdev->gadget->ops->get_config_params(&dcd_config_params);
>>  	else {
>> -		dcd_config_params.bU1devExitLat = USB_DEFAULT_U1_DEV_EXIT_LAT;
>> -		dcd_config_params.bU2DevExitLat =
>> +		dcd_config_params.bU1DevExitLat = USB_DEFAULT_U1_DEV_EXIT_LAT;
>> +		dcd_config_params.wU2DevExitLat =
>>  			cpu_to_le16(USB_DEFAULT_U2_DEV_EXIT_LAT);
>>  	}
>> -	ss_cap->bU1devExitLat = dcd_config_params.bU1devExitLat;
>> -	ss_cap->bU2DevExitLat = dcd_config_params.bU2DevExitLat;
>> +	ss_cap->bU1DevExitLat = dcd_config_params.bU1DevExitLat;
>> +	ss_cap->wU2DevExitLat = dcd_config_params.wU2DevExitLat;
>>  
>>  	return le16_to_cpu(bos->wTotalLength);
>>  }
>> diff --git a/drivers/usb/gadget/storage_common.c b/drivers/usb/gadget/storage_common.c
>> index c7f291a..735beb4 100644
>> --- a/drivers/usb/gadget/storage_common.c
>> +++ b/drivers/usb/gadget/storage_common.c
>> @@ -597,8 +597,8 @@ static __maybe_unused struct usb_ss_cap_descriptor fsg_ss_cap_desc = {
>>  		| USB_HIGH_SPEED_OPERATION
>>  		| USB_5GBPS_OPERATION),
>>  	.bFunctionalitySupport = USB_LOW_SPEED_OPERATION,
>> -	.bU1devExitLat =	USB_DEFAULT_U1_DEV_EXIT_LAT,
>> -	.bU2DevExitLat =	USB_DEFAULT_U2_DEV_EXIT_LAT,
>> +	.bU1DevExitLat =	USB_DEFAULT_U1_DEV_EXIT_LAT,
>> +	.wU2DevExitLat =	USB_DEFAULT_U2_DEV_EXIT_LAT,
>>  };
>>  
>>  static __maybe_unused struct usb_bos_descriptor fsg_bos_desc = {
>> diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
>> index 35e257f..0500543 100644
>> --- a/drivers/usb/host/xhci-hub.c
>> +++ b/drivers/usb/host/xhci-hub.c
>> @@ -44,7 +44,7 @@ static u8 usb_bos_descriptor [] = {
>>  	0x03,				/* bFunctionalitySupport,
>>  					   USB 3.0 speed only */
>>  	0x00,				/* bU1DevExitLat, set later. */
>> -	0x00, 0x00			/* __le16 bU2DevExitLat, set later. */
>> +	0x00, 0x00			/* __le16 wU2DevExitLat, set later. */
>>  };
>>  
>>  
>> diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h
>> index b94f5ba..5738207 100644
>> --- a/include/linux/usb/ch9.h
>> +++ b/include/linux/usb/ch9.h
>> @@ -797,8 +797,8 @@ struct usb_ss_cap_descriptor {		/* Link Power Management */
>>  #define USB_HIGH_SPEED_OPERATION	(1 << 2) /* High speed operation */
>>  #define USB_5GBPS_OPERATION		(1 << 3) /* Operation at 5Gbps */
>>  	__u8  bFunctionalitySupport;
>> -	__u8  bU1devExitLat;
>> -	__le16 bU2DevExitLat;
>> +	__u8  bU1DevExitLat;
>> +	__le16 wU2DevExitLat;
>>  } __attribute__((packed));
>>  
>>  #define USB_DT_USB_SS_CAP_SIZE	10
>> diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
>> index 1d3a675..52a5035 100644
>> --- a/include/linux/usb/gadget.h
>> +++ b/include/linux/usb/gadget.h
>> @@ -436,9 +436,9 @@ static inline void usb_ep_fifo_flush(struct usb_ep *ep)
>>  /*-------------------------------------------------------------------------*/
>>  
>>  struct usb_dcd_config_params {
>> -	__u8  bU1devExitLat;	/* U1 Device exit Latency */
>> +	__u8  bU1DevExitLat;	/* U1 Device exit Latency */
>>  #define USB_DEFAULT_U1_DEV_EXIT_LAT	0x01	/* Less then 1 microsec */
>> -	__le16 bU2DevExitLat;	/* U2 Device exit Latency */
>> +	__le16 wU2DevExitLat;	/* U2 Device exit Latency */
>>  #define USB_DEFAULT_U2_DEV_EXIT_LAT	0x1F4	/* Less then 500 microsec */
>>  };
>>  
>> -- 
>> 1.7.4.1
>>
>>
> 


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux