public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Khalid Masum <khalid.masum.92@gmail.com>
To: Alan Stern <stern@rowland.harvard.edu>,
	linux-kernel@vger.kernel.org,
	linux-kernel-mentees@lists.linuxfoundation.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Kishon Vijay Abraham I <kishon@ti.com>,
	Sergey Shtylyov <s.shtylyov@omp.ru>,
	Matthias Kaehlcke <mka@chromium.org>,
	Weitao Wang <WeitaoWang-oc@zhaoxin.com>,
	Arnd Bergmann <arnd@arndb.de>,
	Khalid Masum <khalid.masum.92@gmail.com>,
	linux-usb@vger.kernel.org
Subject: [PATCH v2] usb: host: Initiate urb ep with udev ep0
Date: Thu, 25 Aug 2022 02:31:07 +0600	[thread overview]
Message-ID: <20220824203107.14908-1-khalid.masum.92@gmail.com> (raw)

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@rowland.harvard.edu>
Signed-off-by: Khalid Masum <khalid.masum.92@gmail.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


             reply	other threads:[~2022-08-24 20:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-24 20:31 Khalid Masum [this message]
2022-08-25 14:19 ` [PATCH v2] usb: host: Initiate urb ep with udev ep0 Alan Stern

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220824203107.14908-1-khalid.masum.92@gmail.com \
    --to=khalid.masum.92@gmail.com \
    --cc=WeitaoWang-oc@zhaoxin.com \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=kishon@ti.com \
    --cc=linux-kernel-mentees@lists.linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mka@chromium.org \
    --cc=s.shtylyov@omp.ru \
    --cc=stern@rowland.harvard.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox