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

On Thu, Aug 25, 2022 at 02:31:07AM +0600, Khalid Masum wrote:
> 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;

Acked-by: Alan Stern <stern@rowland.harvard.edu>
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

      reply	other threads:[~2022-08-25 14:19 UTC|newest]

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

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=YweE7jCfGDhLB16G@rowland.harvard.edu \
    --to=stern@rowland.harvard.edu \
    --cc=WeitaoWang-oc@zhaoxin.com \
    --cc=arnd@arndb.de \
    --cc=khalid.masum.92@gmail.com \
    --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 \
    /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;
as well as URLs for NNTP newsgroup(s).