diff options
author | Sebastian Andrzej Siewior <bigeasy@linutronix.de> | 2011-07-29 05:05:45 -0400 |
---|---|---|
committer | Sarah Sharp <sarah.a.sharp@linux.intel.com> | 2011-08-01 12:45:29 -0400 |
commit | 7de7c7d2cb49900e0b967be871bf695c7d6135c9 (patch) | |
tree | 1f3cda80b3ac70e450fe7a25ec3713d755b71b98 | |
parent | 6768458b17f9bf48a4c3a34e49b20344091b5f7e (diff) |
usb/config: use proper endian access for wMaxPacketSize
wMaxPacketSize is __le16 and should be accessed as such. Also fix the
wBytesPerInterval assignment while here.
v2: also fix the wBytesPerInterval assigment, noticed by Matt Evans
This patch should be backported to the 3.0 kernel.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Acked-by: Matt Evans <matt@ozlabs.org>
Cc: stable@kernel.org
-rw-r--r-- | drivers/usb/core/config.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c index c962608b4b9a..26678cadfb21 100644 --- a/drivers/usb/core/config.c +++ b/drivers/usb/core/config.c | |||
@@ -123,10 +123,11 @@ static void usb_parse_ss_endpoint_companion(struct device *ddev, int cfgno, | |||
123 | } | 123 | } |
124 | 124 | ||
125 | if (usb_endpoint_xfer_isoc(&ep->desc)) | 125 | if (usb_endpoint_xfer_isoc(&ep->desc)) |
126 | max_tx = ep->desc.wMaxPacketSize * (desc->bMaxBurst + 1) * | 126 | max_tx = (desc->bMaxBurst + 1) * (desc->bmAttributes + 1) * |
127 | (desc->bmAttributes + 1); | 127 | le16_to_cpu(ep->desc.wMaxPacketSize); |
128 | else if (usb_endpoint_xfer_int(&ep->desc)) | 128 | else if (usb_endpoint_xfer_int(&ep->desc)) |
129 | max_tx = ep->desc.wMaxPacketSize * (desc->bMaxBurst + 1); | 129 | max_tx = le16_to_cpu(ep->desc.wMaxPacketSize) * |
130 | (desc->bMaxBurst + 1); | ||
130 | else | 131 | else |
131 | max_tx = 999999; | 132 | max_tx = 999999; |
132 | if (le16_to_cpu(desc->wBytesPerInterval) > max_tx) { | 133 | if (le16_to_cpu(desc->wBytesPerInterval) > max_tx) { |
@@ -134,10 +135,10 @@ static void usb_parse_ss_endpoint_companion(struct device *ddev, int cfgno, | |||
134 | "config %d interface %d altsetting %d ep %d: " | 135 | "config %d interface %d altsetting %d ep %d: " |
135 | "setting to %d\n", | 136 | "setting to %d\n", |
136 | usb_endpoint_xfer_isoc(&ep->desc) ? "Isoc" : "Int", | 137 | usb_endpoint_xfer_isoc(&ep->desc) ? "Isoc" : "Int", |
137 | desc->wBytesPerInterval, | 138 | le16_to_cpu(desc->wBytesPerInterval), |
138 | cfgno, inum, asnum, ep->desc.bEndpointAddress, | 139 | cfgno, inum, asnum, ep->desc.bEndpointAddress, |
139 | max_tx); | 140 | max_tx); |
140 | ep->ss_ep_comp.wBytesPerInterval = max_tx; | 141 | ep->ss_ep_comp.wBytesPerInterval = cpu_to_le16(max_tx); |
141 | } | 142 | } |
142 | } | 143 | } |
143 | 144 | ||