[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220824203107.14908-1-khalid.masum.92@gmail.com>
Date: Thu, 25 Aug 2022 02:31:07 +0600
From: Khalid Masum <khalid.masum.92@...il.com>
To: Alan Stern <stern@...land.harvard.edu>,
linux-kernel@...r.kernel.org,
linux-kernel-mentees@...ts.linuxfoundation.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Kishon Vijay Abraham I <kishon@...com>,
Sergey Shtylyov <s.shtylyov@....ru>,
Matthias Kaehlcke <mka@...omium.org>,
Weitao Wang <WeitaoWang-oc@...oxin.com>,
Arnd Bergmann <arnd@...db.de>,
Khalid Masum <khalid.masum.92@...il.com>,
linux-usb@...r.kernel.org
Subject: [PATCH v2] usb: host: Initiate urb ep with udev ep0
Currently we look up for endpoint in a table and initate urb endpoint
with it. This is unnecessary because the lookup will always result in
endpoint 0.
Suggested-by: Alan Stern <stern@...land.harvard.edu>
Signed-off-by: Khalid Masum <khalid.masum.92@...il.com>
---
Changes since v1:
- Remove endpoint lookup and NULL check
- Remove unnecessary variable *ep
- Initiate urb ep with udev ep0
- Update commit message
- v1 Link: https://lore.kernel.org/lkml/20220824130702.10912-1-khalid.masum.92@gmail.com/
drivers/usb/core/hcd.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 94b305bbd621..05f30ae5570b 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -2158,21 +2158,14 @@ static struct urb *request_single_step_set_feature_urb(
{
struct urb *urb;
struct usb_hcd *hcd = bus_to_hcd(udev->bus);
- struct usb_host_endpoint *ep;
urb = usb_alloc_urb(0, GFP_KERNEL);
if (!urb)
return NULL;
urb->pipe = usb_rcvctrlpipe(udev, 0);
- ep = (usb_pipein(urb->pipe) ? udev->ep_in : udev->ep_out)
- [usb_pipeendpoint(urb->pipe)];
- if (!ep) {
- usb_free_urb(urb);
- return NULL;
- }
- urb->ep = ep;
+ urb->ep = &udev->ep0;
urb->dev = udev;
urb->setup_packet = (void *)dr;
urb->transfer_buffer = buf;
--
2.37.1
Powered by blists - more mailing lists