All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vincent MAILHOL <mailhol.vincent@wanadoo.fr>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-usb@vger.kernel.org
Subject: Re: [PATCH v3 9/9] usb: rework usb_maxpacket() using usb_pipe_endpoint()
Date: Thu, 17 Mar 2022 08:26:13 +0900	[thread overview]
Message-ID: <CAMZ6RqLtC9HOnxK=E18o4FqJT9ixJQj7vJOctKExhNACAHoZGg@mail.gmail.com> (raw)
In-Reply-To: <YjIbkR7njaFX7NKi@rowland.harvard.edu>

On Thu. 17 Mar 2022 at 02:17, Alan Stern <stern@rowland.harvard.edu> wrote:
> On Thu, Mar 17, 2022 at 01:19:35AM +0900, Vincent Mailhol wrote:
> > Rework the body of usb_maxpacket() in order not to reinvent the wheel
> > and just rely on the usb_pipe_endpoint() helper function instead.
> >
> > Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
> > ---
> >  include/linux/usb.h | 14 +-------------
> >  1 file changed, 1 insertion(+), 13 deletions(-)
> >
> > diff --git a/include/linux/usb.h b/include/linux/usb.h
> > index 8127782aa7a1..653d34ff0999 100644
> > --- a/include/linux/usb.h
> > +++ b/include/linux/usb.h
> > @@ -1971,19 +1971,7 @@ usb_pipe_endpoint(struct usb_device *dev, unsigned int pipe)
> >
> >  static inline u16 usb_maxpacket(struct usb_device *udev, int pipe)
> >  {
> > -     struct usb_host_endpoint        *ep;
> > -     unsigned                        epnum = usb_pipeendpoint(pipe);
> > -
> > -     if (usb_pipeout(pipe))
> > -             ep = udev->ep_out[epnum];
> > -     else
> > -             ep = udev->ep_in[epnum];
> > -
> > -     if (!ep)
> > -             return 0;
> > -
> > -     /* NOTE:  only 0x07ff bits are for packet size... */
> > -     return usb_endpoint_maxp(&ep->desc);
> > +     return usb_endpoint_maxp(&usb_pipe_endpoint(udev, pipe)->desc);
>
> The original code was careful to handle the case where ep was a NULL
> pointer.  What will your routine do if usb_pipe_endpoint(udev, pipe)
> returns NULL?

Sorry, you are absolutely right. Will send a v4.

Thank you!


Yours sincerely,
Vincent Maihol

  reply	other threads:[~2022-03-16 23:26 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-04 10:53 [PATCH] usb: rework usb_maxpacket() and remove its third argument Vincent Mailhol
2022-03-04 14:20 ` Greg Kroah-Hartman
2022-03-04 17:23   ` Vincent MAILHOL
2022-03-04 17:32     ` Greg Kroah-Hartman
2022-03-06  7:55 ` [PATCH v2 00/10] " Vincent Mailhol
2022-03-06  7:55   ` [PATCH v2 01/10] usb: oxu210hp-hcd: remove redundant call to max_packet() macro Vincent Mailhol
2022-03-06  7:55   ` [PATCH v2 02/10] usb: isp1760: remove redundant " Vincent Mailhol
2022-03-06 19:49     ` Rui Miguel Silva
2022-03-06  7:55   ` [PATCH v2 03/10] usb: rework usb_maxpacket() and deprecate its third argument Vincent Mailhol
2022-03-15 17:25     ` Greg Kroah-Hartman
2022-03-16  1:41       ` Vincent MAILHOL
2022-03-06  7:55   ` [PATCH v2 04/10] HID: usbhid: remove third argument of usb_maxpacket() Vincent Mailhol
2022-03-06  7:55   ` [PATCH v2 05/10] Input: " Vincent Mailhol
2022-03-06  7:55   ` [PATCH v2 06/10] media: " Vincent Mailhol
2022-03-06  7:55   ` [PATCH v2 07/10] net: " Vincent Mailhol
2022-03-06  7:55   ` [PATCH v2 08/10] usb: " Vincent Mailhol
2022-03-06  7:55   ` [PATCH v2 09/10] sound: " Vincent Mailhol
2022-03-06  7:55   ` [PATCH v2 10/10] " Vincent Mailhol
2022-03-16 16:19 ` [PATCH v3 0/9] usb: rework usb_maxpacket() and remove its third argument Vincent Mailhol
2022-03-16 16:19   ` [PATCH v3 1/9] usb: deprecate the third argument of usb_maxpacket() Vincent Mailhol
2022-03-16 16:19   ` [PATCH v3 2/9] HID: usbhid: remove " Vincent Mailhol
2022-03-16 16:19   ` [PATCH v3 3/9] Input: " Vincent Mailhol
2022-03-16 16:19   ` [PATCH v3 4/9] media: " Vincent Mailhol
2022-03-16 16:19   ` [PATCH v3 5/9] net: " Vincent Mailhol
2022-03-16 16:19   ` [PATCH v3 6/9] usb: " Vincent Mailhol
2022-03-16 16:19   ` [PATCH v3 7/9] sound: " Vincent Mailhol
2022-03-16 16:19   ` [PATCH v3 8/9] " Vincent Mailhol
2022-03-16 16:19   ` [PATCH v3 9/9] usb: rework usb_maxpacket() using usb_pipe_endpoint() Vincent Mailhol
2022-03-16 17:17     ` Alan Stern
2022-03-16 23:26       ` Vincent MAILHOL [this message]
2022-03-17  3:55 ` [PATCH v4 0/9] usb: rework usb_maxpacket() and remove its third argument Vincent Mailhol
2022-03-17  3:55   ` [PATCH v4 1/9] usb: deprecate the third argument of usb_maxpacket() Vincent Mailhol
2022-03-17  3:55   ` [PATCH v4 2/9] HID: usbhid: remove " Vincent Mailhol
2022-03-17  3:55   ` [PATCH v4 3/9] Input: " Vincent Mailhol
2022-03-17  3:55   ` [PATCH v4 4/9] media: " Vincent Mailhol
2022-03-17  3:55   ` [PATCH v4 5/9] net: " Vincent Mailhol
2022-03-17  3:55   ` [PATCH v4 6/9] usb: " Vincent Mailhol
2022-03-17  3:55   ` [PATCH v4 7/9] sound: " Vincent Mailhol
2022-03-22 13:22     ` Takashi Iwai
2022-03-17  3:55   ` [PATCH v4 8/9] " Vincent Mailhol
2022-03-17  3:55   ` [PATCH v4 9/9] usb: rework usb_maxpacket() using usb_pipe_endpoint() Vincent Mailhol
2022-04-22 13:38   ` [PATCH v4 0/9] usb: rework usb_maxpacket() and remove its third argument Greg Kroah-Hartman
2022-04-22 14:00     ` Vincent MAILHOL
2022-04-22 14:07       ` Vincent MAILHOL
2022-04-22 14:19         ` Greg Kroah-Hartman

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='CAMZ6RqLtC9HOnxK=E18o4FqJT9ixJQj7vJOctKExhNACAHoZGg@mail.gmail.com' \
    --to=mailhol.vincent@wanadoo.fr \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-usb@vger.kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.