diff options
author | Pavankumar Kondeti <pkondeti@codeaurora.org> | 2011-05-02 02:26:30 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-05-03 13:25:25 -0400 |
commit | 4c5212b7688955075b166def5ce08b34beb87a9c (patch) | |
tree | c4d6cee63a5bfc65ca5cb7a07df10efcf955d983 /drivers/usb/gadget | |
parent | 986b11b8c7ac3d8752790654637bd944ea18ee79 (diff) |
USB: gadget: Fix bug in endpoint feature request processing in ci13xxx_udc
The OUT endpoints are stored in 0 - hw_ep_max/2 and IN endpoints are
stored from hw_ep_max/2 - hw_ep_max in ci13xxx_ep array. Retrieve
the IN endpoint correctly while processing endpoint feature requests.
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/gadget')
-rw-r--r-- | drivers/usb/gadget/ci13xxx_udc.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/usb/gadget/ci13xxx_udc.c b/drivers/usb/gadget/ci13xxx_udc.c index 92498ae58784..1b095cb59c9d 100644 --- a/drivers/usb/gadget/ci13xxx_udc.c +++ b/drivers/usb/gadget/ci13xxx_udc.c | |||
@@ -1894,7 +1894,7 @@ __acquires(udc->lock) | |||
1894 | 1894 | ||
1895 | for (i = 0; i < hw_ep_max; i++) { | 1895 | for (i = 0; i < hw_ep_max; i++) { |
1896 | struct ci13xxx_ep *mEp = &udc->ci13xxx_ep[i]; | 1896 | struct ci13xxx_ep *mEp = &udc->ci13xxx_ep[i]; |
1897 | int type, num, err = -EINVAL; | 1897 | int type, num, dir, err = -EINVAL; |
1898 | struct usb_ctrlrequest req; | 1898 | struct usb_ctrlrequest req; |
1899 | 1899 | ||
1900 | if (mEp->desc == NULL) | 1900 | if (mEp->desc == NULL) |
@@ -1952,7 +1952,10 @@ __acquires(udc->lock) | |||
1952 | if (req.wLength != 0) | 1952 | if (req.wLength != 0) |
1953 | break; | 1953 | break; |
1954 | num = le16_to_cpu(req.wIndex); | 1954 | num = le16_to_cpu(req.wIndex); |
1955 | dir = num & USB_ENDPOINT_DIR_MASK; | ||
1955 | num &= USB_ENDPOINT_NUMBER_MASK; | 1956 | num &= USB_ENDPOINT_NUMBER_MASK; |
1957 | if (dir) /* TX */ | ||
1958 | num += hw_ep_max/2; | ||
1956 | if (!udc->ci13xxx_ep[num].wedge) { | 1959 | if (!udc->ci13xxx_ep[num].wedge) { |
1957 | spin_unlock(udc->lock); | 1960 | spin_unlock(udc->lock); |
1958 | err = usb_ep_clear_halt( | 1961 | err = usb_ep_clear_halt( |
@@ -2001,7 +2004,10 @@ __acquires(udc->lock) | |||
2001 | if (req.wLength != 0) | 2004 | if (req.wLength != 0) |
2002 | break; | 2005 | break; |
2003 | num = le16_to_cpu(req.wIndex); | 2006 | num = le16_to_cpu(req.wIndex); |
2007 | dir = num & USB_ENDPOINT_DIR_MASK; | ||
2004 | num &= USB_ENDPOINT_NUMBER_MASK; | 2008 | num &= USB_ENDPOINT_NUMBER_MASK; |
2009 | if (dir) /* TX */ | ||
2010 | num += hw_ep_max/2; | ||
2005 | 2011 | ||
2006 | spin_unlock(udc->lock); | 2012 | spin_unlock(udc->lock); |
2007 | err = usb_ep_set_halt(&udc->ci13xxx_ep[num].ep); | 2013 | err = usb_ep_set_halt(&udc->ci13xxx_ep[num].ep); |