]>
Commit | Line | Data |
---|---|---|
178a796d GKH |
1 | From 982555fc26f9d8bcdbd5f9db0378fe0682eb4188 Mon Sep 17 00:00:00 2001 |
2 | From: Peter Chen <peter.chen@nxp.com> | |
3 | Date: Tue, 8 Nov 2016 10:08:24 +0800 | |
4 | Subject: usb: gadget: fix request length error for isoc transfer | |
5 | ||
6 | From: Peter Chen <peter.chen@nxp.com> | |
7 | ||
8 | commit 982555fc26f9d8bcdbd5f9db0378fe0682eb4188 upstream. | |
9 | ||
10 | For isoc endpoint descriptor, the wMaxPacketSize is not real max packet | |
11 | size (see Table 9-13. Standard Endpoint Descriptor, USB 2.0 specifcation), | |
12 | it may contain the number of packet, so the real max packet should be | |
13 | ep->desc->wMaxPacketSize && 0x7ff. | |
14 | ||
15 | Cc: Felipe F. Tonello <eu@felipetonello.com> | |
16 | Cc: Felipe Balbi <felipe.balbi@linux.intel.com> | |
17 | Fixes: 16b114a6d797 ("usb: gadget: fix usb_ep_align_maybe | |
18 | endianness and new usb_ep_aligna") | |
19 | ||
20 | Signed-off-by: Peter Chen <peter.chen@nxp.com> | |
21 | Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com> | |
22 | Signed-off-by: Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp> | |
23 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
24 | ||
25 | --- | |
26 | include/linux/usb/gadget.h | 4 +++- | |
27 | 1 file changed, 3 insertions(+), 1 deletion(-) | |
28 | ||
29 | --- a/include/linux/usb/gadget.h | |
30 | +++ b/include/linux/usb/gadget.h | |
31 | @@ -671,7 +671,9 @@ static inline struct usb_gadget *dev_to_ | |
32 | */ | |
33 | static inline size_t usb_ep_align(struct usb_ep *ep, size_t len) | |
34 | { | |
35 | - return round_up(len, (size_t)le16_to_cpu(ep->desc->wMaxPacketSize)); | |
36 | + int max_packet_size = (size_t)usb_endpoint_maxp(ep->desc) & 0x7ff; | |
37 | + | |
38 | + return round_up(len, max_packet_size); | |
39 | } | |
40 | ||
41 | /** |