Re: [PATCH v4 08/10] usb: gadget: remove useless parameter in alloc_ep_req()

From: Felipe Balbi
Date: Thu Aug 18 2016 - 03:16:01 EST



Hi,

"Felipe F. Tonello" <eu@xxxxxxxxxxxxxxxxx> writes:
> The default_length parameter of alloc_ep_req was not really necessary
> and gadget drivers would almost always create an inline function to pass
> the same value to len and default_len.
>
> So this patch also removes duplicate code from few drivers.
>
> Signed-off-by: Felipe F. Tonello <eu@xxxxxxxxxxxxxxxxx>
> ---
> drivers/usb/gadget/function/f_hid.c | 10 ++--------
> drivers/usb/gadget/function/f_loopback.c | 9 +--------
> drivers/usb/gadget/function/f_midi.c | 10 ++--------
> drivers/usb/gadget/function/f_sourcesink.c | 11 ++---------
> drivers/usb/gadget/u_f.c | 7 +++----
> drivers/usb/gadget/u_f.h | 3 +--
> 6 files changed, 11 insertions(+), 39 deletions(-)
>
> diff --git a/drivers/usb/gadget/function/f_hid.c b/drivers/usb/gadget/function/f_hid.c
> index 51980c50546d..e82a7468252e 100644
> --- a/drivers/usb/gadget/function/f_hid.c
> +++ b/drivers/usb/gadget/function/f_hid.c
> @@ -362,12 +362,6 @@ static int f_hidg_open(struct inode *inode, struct file *fd)
> /*-------------------------------------------------------------------------*/
> /* usb_function */
>
> -static inline struct usb_request *hidg_alloc_ep_req(struct usb_ep *ep,
> - unsigned length)
> -{
> - return alloc_ep_req(ep, length, length);
> -}

actually, I prefer to keep these little helpers. I was recently playing
with adding SG list support to g_zero (I should have patches soon) and
it was actually very nice to have the sourcesink helper as I could just
ditch alloc_ep_req(). The change to the driver was local to
ss_alloc_ep_req() and nothing else changed :-)

--
balbi

Attachment: signature.asc
Description: PGP signature