From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pavankumar Kondeti Subject: [PATCH 4/7] USB: gadget: Fix bug in endpoint feature request processing in ci13xxx_udc Date: Fri, 29 Apr 2011 10:42:52 +0530 Message-ID: <1304053975-1960-4-git-send-email-pkondeti@codeaurora.org> References: <1303977501-17115-1-git-send-email-pkondeti@codeaurora.org> <1304053975-1960-1-git-send-email-pkondeti@codeaurora.org> Return-path: Received: from wolverine01.qualcomm.com ([199.106.114.254]:22807 "EHLO wolverine01.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751534Ab1D2FNN (ORCPT ); Fri, 29 Apr 2011 01:13:13 -0400 In-Reply-To: <1304053975-1960-1-git-send-email-pkondeti@codeaurora.org> Sender: linux-arm-msm-owner@vger.kernel.org List-Id: linux-arm-msm@vger.kernel.org To: greg@kroah.com, linux-usb@vger.kernel.org Cc: linux-arm-msm@vger.kernel.org, Pavankumar Kondeti 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 --- 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 92498ae..1b095cb 100644 --- a/drivers/usb/gadget/ci13xxx_udc.c +++ b/drivers/usb/gadget/ci13xxx_udc.c @@ -1894,7 +1894,7 @@ __acquires(udc->lock) for (i = 0; i < hw_ep_max; i++) { struct ci13xxx_ep *mEp = &udc->ci13xxx_ep[i]; - int type, num, err = -EINVAL; + int type, num, dir, err = -EINVAL; struct usb_ctrlrequest req; if (mEp->desc == NULL) @@ -1952,7 +1952,10 @@ __acquires(udc->lock) if (req.wLength != 0) break; num = le16_to_cpu(req.wIndex); + dir = num & USB_ENDPOINT_DIR_MASK; num &= USB_ENDPOINT_NUMBER_MASK; + if (dir) /* TX */ + num += hw_ep_max/2; if (!udc->ci13xxx_ep[num].wedge) { spin_unlock(udc->lock); err = usb_ep_clear_halt( @@ -2001,7 +2004,10 @@ __acquires(udc->lock) if (req.wLength != 0) break; num = le16_to_cpu(req.wIndex); + dir = num & USB_ENDPOINT_DIR_MASK; num &= USB_ENDPOINT_NUMBER_MASK; + if (dir) /* TX */ + num += hw_ep_max/2; spin_unlock(udc->lock); err = usb_ep_set_halt(&udc->ci13xxx_ep[num].ep); -- Sent by a consultant of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.