Re: [PATCH] usb/ch9: use proper endianess for wBytesPerInterval

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

 



Hi Sebastian,

On Mon, Apr 11, 2011 at 08:19:12PM +0200, Sebastian Andrzej Siewior wrote:
> while going through Tatyana's changes for the gadget framework I noticed
> that this type is not defined as __le16.
> 
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
> ---
> I have just the spec and a compiler :)

Matt Evans posted a patchset to make the xHCI driver big endian safe,
although I haven't queued it to Greg for 2.6.40 yet.  Does the patchset
cover this issue?  See the patchset starting here:

http://marc.info/?l=linux-usb&m=130136646603507&w=2

Matt has run this patchset with an xHCI host controller on a PPC system.
However, I think the xHCI driver never really uses the wBytesPerInterval
field.  It just passes the field down to the hardware, which may or may
not actually use it.

Matt, can you see if this patch is needed on top of your patchset?

Sarah Sharp

> 
>  drivers/usb/core/config.c   |    2 +-
>  drivers/usb/host/xhci-mem.c |    2 +-
>  include/linux/usb/ch9.h     |    2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c
> index 83126b0..c962608 100644
> --- a/drivers/usb/core/config.c
> +++ b/drivers/usb/core/config.c
> @@ -129,7 +129,7 @@ static void usb_parse_ss_endpoint_companion(struct device *ddev, int cfgno,
>  		max_tx = ep->desc.wMaxPacketSize * (desc->bMaxBurst + 1);
>  	else
>  		max_tx = 999999;
> -	if (desc->wBytesPerInterval > max_tx) {
> +	if (le16_to_cpu(desc->wBytesPerInterval) > max_tx) {
>  		dev_warn(ddev, "%s endpoint with wBytesPerInterval of %d in "
>  				"config %d interface %d altsetting %d ep %d: "
>  				"setting to %d\n",
> diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
> index a003e79..ac45d7b 100644
> --- a/drivers/usb/host/xhci-mem.c
> +++ b/drivers/usb/host/xhci-mem.c
> @@ -1097,7 +1097,7 @@ static inline u32 xhci_get_max_esit_payload(struct xhci_hcd *xhci,
>  		return 0;
>  
>  	if (udev->speed == USB_SPEED_SUPER)
> -		return ep->ss_ep_comp.wBytesPerInterval;
> +		return le16_to_cpu(ep->ss_ep_comp.wBytesPerInterval);
>  
>  	max_packet = GET_MAX_PACKET(ep->desc.wMaxPacketSize);
>  	max_burst = (ep->desc.wMaxPacketSize & 0x1800) >> 11;
> diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h
> index b72f305..0fd3fbd 100644
> --- a/include/linux/usb/ch9.h
> +++ b/include/linux/usb/ch9.h
> @@ -579,7 +579,7 @@ struct usb_ss_ep_comp_descriptor {
>  
>  	__u8  bMaxBurst;
>  	__u8  bmAttributes;
> -	__u16 wBytesPerInterval;
> +	__le16 wBytesPerInterval;
>  } __attribute__ ((packed));
>  
>  #define USB_DT_SS_EP_COMP_SIZE		6
> -- 
> 1.7.4
> 
--
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