linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Felipe Ferreri Tonello <eu@felipetonello.com>
To: Felipe Balbi <balbi@kernel.org>, linux-usb@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Michal Nazarewicz <mina86@mina86.com>
Subject: Re: [PATCH v4 08/10] usb: gadget: remove useless parameter in alloc_ep_req()
Date: Tue, 30 Aug 2016 17:13:16 +0100	[thread overview]
Message-ID: <4159d487-5e3c-c53f-2676-780b54e66507@felipetonello.com> (raw)
In-Reply-To: <87d1ksdn5e.fsf@linux.intel.com>

[-- Attachment #1: Type: text/plain, Size: 3367 bytes --]



On 29/08/16 08:55, Felipe Balbi wrote:
> 
> Hi,
> 
> Felipe Ferreri Tonello <eu@felipetonello.com> writes:
>>> Felipe Ferreri Tonello <eu@felipetonello.com> writes:
>>>>> "Felipe F. Tonello" <eu@felipetonello.com> 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@felipetonello.com>
>>>>>> ---
>>>>>>  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 :-)
>>>>>
>>>>
>>>> Right, but then it is worth to have the helper function. In this
>>>> particular case, I am removing a useless helper functions, especially
>>>> that the previous patch removes the need for the optional parameter in
>>>> alloc_ep_req.
>>>
>>> it's a static inline :-) It won't do any bad to keep it. And, as I said,
>>> if we want to ditch aloc_ep_req() eventually, then we have just one
>>> place to patch ;-)
>>
>> Yes, sure. But why drop alloc_ep_req()?
> 
> because we can't find a generic way of allocating sglist with enough
> entries :-) Some drivers (like f_fs.c) could actually have zero-copy
> sglist by just pinning user pages with get_user_pages_fast() and
> following with sg_alloc_from_pages().
> 
> g_zero, however, would just "emulate" sglist by just allocating a
> statically sized sg table and initializing chunks of the linear req->buf
> to each sg entry.

I see. :)

> 
>> So should I keep all these helper functions? If so, I actually still
>> need to fix them to use the newer alloc_ep_req() API.
> 
> yeah, keeping the helper functions would be nice. IMHO, alloc_ep_req()
> doesn't have a long life, but it's pretty good for the time being.

Ok, I did it on my last patchset I sent, I think you already applied to
your tree.

-- 
Felipe

[-- Attachment #2: 0x92698E6A.asc --]
[-- Type: application/pgp-keys, Size: 7177 bytes --]

  reply	other threads:[~2016-08-30 16:13 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-08 20:30 [PATCH v4 00/10] Gadget endpoint request allocation and MIDI Felipe F. Tonello
2016-08-08 20:30 ` [PATCH v4 01/10] usb: gadget: fix usb_ep_align_maybe endianness and new usb_ep_align Felipe F. Tonello
2016-08-08 20:30 ` [PATCH v4 02/10] usb: gadget: change len to size_t on alloc_ep_req() Felipe F. Tonello
2016-08-08 20:30 ` [PATCH v4 03/10] usb: gadget: align buffer size when allocating for OUT endpoint Felipe F. Tonello
2016-08-08 20:30 ` [PATCH v4 04/10] usb: gadget: f_midi: remove alignment code " Felipe F. Tonello
2016-08-08 20:30 ` [PATCH v4 05/10] usb: gadget: f_midi: defaults buflen sizes to 512 Felipe F. Tonello
2016-08-08 20:30 ` [PATCH v4 06/10] usb: gadget: f_midi: refactor state machine Felipe F. Tonello
2016-08-08 20:30 ` [PATCH v4 07/10] usb: gadget: f_midi: drop substreams when disabling endpoint Felipe F. Tonello
2016-08-08 20:30 ` [PATCH v4 08/10] usb: gadget: remove useless parameter in alloc_ep_req() Felipe F. Tonello
2016-08-18  7:12   ` Felipe Balbi
2016-08-23 10:18     ` Felipe Ferreri Tonello
2016-08-23 11:01       ` Felipe Balbi
2016-08-23 11:33         ` Felipe Ferreri Tonello
2016-08-29  7:55           ` Felipe Balbi
2016-08-30 16:13             ` Felipe Ferreri Tonello [this message]
2016-08-08 20:30 ` [PATCH v4 09/10] usb: gadget: f_hid: use free_ep_req() Felipe F. Tonello
2016-08-08 20:30 ` [PATCH v4 10/10] usb: gadget: f_hid: use alloc_ep_req() Felipe F. Tonello
2016-08-19 19:07   ` John Youn
2016-08-22  7:45     ` Felipe Balbi
2016-08-23 10:20       ` Felipe Ferreri Tonello
2016-08-23 11:03         ` Felipe Balbi
2016-08-23 11:34           ` Felipe Ferreri Tonello

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=4159d487-5e3c-c53f-2676-780b54e66507@felipetonello.com \
    --to=eu@felipetonello.com \
    --cc=balbi@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mina86@mina86.com \
    /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).