Message ID | 20220317035514.6378-1-mailhol.vincent@wanadoo.fr (mailing list archive) |
---|---|
Headers | show |
Series | usb: rework usb_maxpacket() and remove its third argument | expand |
On Thu, Mar 17, 2022 at 12:55:05PM +0900, Vincent Mailhol wrote: > This series rework usb_maxpacket() to change its prototype from: > | static inline __u16 > | usb_maxpacket(struct usb_device *udev, int pipe, int is_out) > > into: > | static inline u16 usb_maxpacket(struct usb_device *udev, int pipe) > > and rewrite the function using usb_pipe_endpoint(). > > Rationale: > > * The third argument of usb_maxpacket(): is_out can be derived from > its second one: pipe using usb_pipeout(pipe). Furthermore, > usb_pipeout(pipe) is being called within usb_maxpacket() > regardless to confirm the input. > > * This function is not exposed to the UAPI so return type should be > u16, not __u16. > > * usb_pipe_endpoint() (defined a couple of lines before) does most > of the work. Use it instead of reimplementing the same thing > again. > > In order to do so, usb_maxpacket() is temporarily changed into a variadic > function to ignore its third argument. > > The series goes as follow: > > * Patch 1: make usb_maxpacket() variadic to accommodate during the > migration > > * Patch 2 to 7: migrate all the users of usb_maxpacket() (one > patch per tree) > > * Patch 8: remove the third argument of usb_maxpacket() now that > everyone is migrated > > * Patch 9: rework usb_maxpacket()'s body using usb_pipe_endpoint() Now queued up, thanks for sticking with this! Can you send the follow-up patch that removes the vararg? I'll keep that in my tree to try to catch any remaining things that come in and get it merged when it's ok to. thanks, greg k-h
On Fri. 22 Apr. 2022 at 22:38, Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote: > On Thu, Mar 17, 2022 at 12:55:05PM +0900, Vincent Mailhol wrote: > > This series rework usb_maxpacket() to change its prototype from: > > | static inline __u16 > > | usb_maxpacket(struct usb_device *udev, int pipe, int is_out) > > > > into: > > | static inline u16 usb_maxpacket(struct usb_device *udev, int pipe) > > > > and rewrite the function using usb_pipe_endpoint(). > > > > Rationale: > > > > * The third argument of usb_maxpacket(): is_out can be derived from > > its second one: pipe using usb_pipeout(pipe). Furthermore, > > usb_pipeout(pipe) is being called within usb_maxpacket() > > regardless to confirm the input. > > > > * This function is not exposed to the UAPI so return type should be > > u16, not __u16. > > > > * usb_pipe_endpoint() (defined a couple of lines before) does most > > of the work. Use it instead of reimplementing the same thing > > again. > > > > In order to do so, usb_maxpacket() is temporarily changed into a variadic > > function to ignore its third argument. > > > > The series goes as follow: > > > > * Patch 1: make usb_maxpacket() variadic to accommodate during the > > migration > > > > * Patch 2 to 7: migrate all the users of usb_maxpacket() (one > > patch per tree) > > > > * Patch 8: remove the third argument of usb_maxpacket() now that > > everyone is migrated > > > > * Patch 9: rework usb_maxpacket()'s body using usb_pipe_endpoint() > > Now queued up, thanks for sticking with this! Thanks to you for your patience and explanations! > Can you send the follow-up patch that removes the vararg? I'll keep > that in my tree to try to catch any remaining things that come in and > get it merged when it's ok to. It is this patch: https://lore.kernel.org/linux-usb/20220317035514.6378-9-mailhol.vincent@wanadoo.fr/ Or do you prefer me to resend it on the mailing list? Yours sincerely, Vincent Mailhol
On Fri. 22 Apr. 2022 at 23:00, Vincent MAILHOL <mailhol.vincent@wanadoo.fr> wrote: > On Fri. 22 Apr. 2022 at 22:38, Greg Kroah-Hartman > <gregkh@linuxfoundation.org> wrote: > > On Thu, Mar 17, 2022 at 12:55:05PM +0900, Vincent Mailhol wrote: > > > This series rework usb_maxpacket() to change its prototype from: > > > | static inline __u16 > > > | usb_maxpacket(struct usb_device *udev, int pipe, int is_out) > > > > > > into: > > > | static inline u16 usb_maxpacket(struct usb_device *udev, int pipe) > > > > > > and rewrite the function using usb_pipe_endpoint(). > > > > > > Rationale: > > > > > > * The third argument of usb_maxpacket(): is_out can be derived from > > > its second one: pipe using usb_pipeout(pipe). Furthermore, > > > usb_pipeout(pipe) is being called within usb_maxpacket() > > > regardless to confirm the input. > > > > > > * This function is not exposed to the UAPI so return type should be > > > u16, not __u16. > > > > > > * usb_pipe_endpoint() (defined a couple of lines before) does most > > > of the work. Use it instead of reimplementing the same thing > > > again. > > > > > > In order to do so, usb_maxpacket() is temporarily changed into a variadic > > > function to ignore its third argument. > > > > > > The series goes as follow: > > > > > > * Patch 1: make usb_maxpacket() variadic to accommodate during the > > > migration > > > > > > * Patch 2 to 7: migrate all the users of usb_maxpacket() (one > > > patch per tree) > > > > > > * Patch 8: remove the third argument of usb_maxpacket() now that > > > everyone is migrated > > > > > > * Patch 9: rework usb_maxpacket()'s body using usb_pipe_endpoint() > > > > Now queued up, thanks for sticking with this! > > Thanks to you for your patience and explanations! > > > Can you send the follow-up patch that removes the vararg? I'll keep > > that in my tree to try to catch any remaining things that come in and > > get it merged when it's ok to. > > It is this patch: > https://lore.kernel.org/linux-usb/20220317035514.6378-9-mailhol.vincent@wanadoo.fr/ > > Or do you prefer me to resend it on the mailing list? Actually, you already added it to your tree: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git/commit/?h=usb-testing&id=386311fd6ef976eb1e3febd836b4ce2425f0ef37 I am not sure I understand what you want me to do here. Sorry.
On Fri, Apr 22, 2022 at 11:07:17PM +0900, Vincent MAILHOL wrote: > On Fri. 22 Apr. 2022 at 23:00, Vincent MAILHOL > <mailhol.vincent@wanadoo.fr> wrote: > > On Fri. 22 Apr. 2022 at 22:38, Greg Kroah-Hartman > > <gregkh@linuxfoundation.org> wrote: > > > On Thu, Mar 17, 2022 at 12:55:05PM +0900, Vincent Mailhol wrote: > > > > This series rework usb_maxpacket() to change its prototype from: > > > > | static inline __u16 > > > > | usb_maxpacket(struct usb_device *udev, int pipe, int is_out) > > > > > > > > into: > > > > | static inline u16 usb_maxpacket(struct usb_device *udev, int pipe) > > > > > > > > and rewrite the function using usb_pipe_endpoint(). > > > > > > > > Rationale: > > > > > > > > * The third argument of usb_maxpacket(): is_out can be derived from > > > > its second one: pipe using usb_pipeout(pipe). Furthermore, > > > > usb_pipeout(pipe) is being called within usb_maxpacket() > > > > regardless to confirm the input. > > > > > > > > * This function is not exposed to the UAPI so return type should be > > > > u16, not __u16. > > > > > > > > * usb_pipe_endpoint() (defined a couple of lines before) does most > > > > of the work. Use it instead of reimplementing the same thing > > > > again. > > > > > > > > In order to do so, usb_maxpacket() is temporarily changed into a variadic > > > > function to ignore its third argument. > > > > > > > > The series goes as follow: > > > > > > > > * Patch 1: make usb_maxpacket() variadic to accommodate during the > > > > migration > > > > > > > > * Patch 2 to 7: migrate all the users of usb_maxpacket() (one > > > > patch per tree) > > > > > > > > * Patch 8: remove the third argument of usb_maxpacket() now that > > > > everyone is migrated > > > > > > > > * Patch 9: rework usb_maxpacket()'s body using usb_pipe_endpoint() > > > > > > Now queued up, thanks for sticking with this! > > > > Thanks to you for your patience and explanations! > > > > > Can you send the follow-up patch that removes the vararg? I'll keep > > > that in my tree to try to catch any remaining things that come in and > > > get it merged when it's ok to. > > > > It is this patch: > > https://lore.kernel.org/linux-usb/20220317035514.6378-9-mailhol.vincent@wanadoo.fr/ > > > > Or do you prefer me to resend it on the mailing list? > > Actually, you already added it to your tree: > https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git/commit/?h=usb-testing&id=386311fd6ef976eb1e3febd836b4ce2425f0ef37 > > I am not sure I understand what you want me to do here. Sorry. Ah, sorry, you are right, I was expecting it to be the last patch in the series, not second-to-last. All is good!