From: Michal Sojka <sojka@merica.cz>
To: Felipe Balbi <balbi@ti.com>
Cc: linux-usb@vger.kernel.org, Alan Stern <stern@rowland.harvard.edu>,
Bryan Wu <cooloney@gmail.com>, Felipe Balbi <balbi@ti.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Linux LED Subsystem <linux-leds@vger.kernel.org>,
linux-kernel@vger.kernel.org, michal.vokac@comap.cz
Subject: Re: [PATCH v5 1/3] usb: gadget: Refactor request completion
Date: Tue, 23 Sep 2014 10:09:22 +0200 [thread overview]
Message-ID: <874mvyahcd.fsf@steelpick.2x.cz> (raw)
In-Reply-To: <20140917152801.GD6903@saruman.home>
Dear Felipe,
On Wed, Sep 17 2014, Felipe Balbi wrote:
> On Wed, Sep 17, 2014 at 09:21:11AM +0200, Michal Sojka wrote:
>> All USB peripheral controller drivers called completion routines
>> directly. This patch moves the completion call from drivers to
>> usb_gadget_giveback_request(), in order to have a place where common
>> functionality can be added.
>>
>> All places in drivers/usb/ matching "[-.]complete(" were replaced with a
>> call to usb_gadget_giveback_request(). This was compile-tested with all
>> ARM drivers enabled and runtime-tested for musb.
>>
>> Signed-off-by: Michal Sojka <sojka@merica.cz>
>> ---
>> drivers/usb/chipidea/udc.c | 6 +++---
>> drivers/usb/dwc2/gadget.c | 6 +++---
>> drivers/usb/dwc3/gadget.c | 2 +-
>> drivers/usb/gadget/udc/amd5536udc.c | 2 +-
>> drivers/usb/gadget/udc/at91_udc.c | 2 +-
>> drivers/usb/gadget/udc/atmel_usba_udc.c | 4 ++--
>> drivers/usb/gadget/udc/bcm63xx_udc.c | 2 +-
>> drivers/usb/gadget/udc/dummy_hcd.c | 10 +++++-----
>> drivers/usb/gadget/udc/fotg210-udc.c | 2 +-
>> drivers/usb/gadget/udc/fsl_qe_udc.c | 6 +-----
>> drivers/usb/gadget/udc/fsl_udc_core.c | 6 ++----
>> drivers/usb/gadget/udc/fusb300_udc.c | 2 +-
>> drivers/usb/gadget/udc/goku_udc.c | 2 +-
>> drivers/usb/gadget/udc/gr_udc.c | 2 +-
>> drivers/usb/gadget/udc/lpc32xx_udc.c | 2 +-
>> drivers/usb/gadget/udc/m66592-udc.c | 2 +-
>> drivers/usb/gadget/udc/mv_u3d_core.c | 8 ++------
>> drivers/usb/gadget/udc/mv_udc_core.c | 8 ++------
>> drivers/usb/gadget/udc/net2272.c | 2 +-
>> drivers/usb/gadget/udc/net2280.c | 2 +-
>> drivers/usb/gadget/udc/omap_udc.c | 2 +-
>> drivers/usb/gadget/udc/pch_udc.c | 2 +-
>> drivers/usb/gadget/udc/pxa25x_udc.c | 2 +-
>> drivers/usb/gadget/udc/pxa27x_udc.c | 2 +-
>> drivers/usb/gadget/udc/r8a66597-udc.c | 2 +-
>> drivers/usb/gadget/udc/s3c-hsudc.c | 3 +--
>> drivers/usb/gadget/udc/s3c2410_udc.c | 2 +-
>> drivers/usb/gadget/udc/udc-core.c | 19 +++++++++++++++++++
>> drivers/usb/musb/musb_gadget.c | 2 +-
>> drivers/usb/renesas_usbhs/mod_gadget.c | 2 +-
>> include/linux/usb/gadget.h | 8 ++++++++
>
> I would rather split this into several patches, btw. With the
> introduction of usb_gadget_giveback_request() being the first one in the
> series. It's easier to review that way.
This would be no problem.
>> diff --git a/drivers/usb/gadget/udc/udc-core.c b/drivers/usb/gadget/udc/udc-core.c
>> index b0d9817..29789f1 100644
>> --- a/drivers/usb/gadget/udc/udc-core.c
>> +++ b/drivers/usb/gadget/udc/udc-core.c
>> @@ -106,6 +106,25 @@ EXPORT_SYMBOL_GPL(usb_gadget_unmap_request);
>>
>> /* ------------------------------------------------------------------------- */
>>
>> +/**
>> + * usb_gadget_giveback_request - give the request back to the gadget layer
>> + * Context: in_interrupt()
>> + *
>> + * This is called by device controller drivers in order to return the
>> + * completed request back to the gadget layer.
>> + */
>> +void usb_gadget_giveback_request(struct usb_ep *ep,
>> + struct usb_request *req)
>> +{
>> + if (likely(req->complete))
>> + req->complete(ep, req);
>> + else
>> + pr_err("%s : req->complete must not be NULL\n", __func__);
>
> let it Oops. We require ->complete to be valid, if there's any gadget
> driver not setting ->complete, it deserves to oops so we can the
> error.
The Oops was there before, but I removed it because greg k-h didn't want
it. See http://marc.info/?l=linux-usb&m=140917381611947&w=2. Do you
still want the oops here?
-Michal
next prev parent reply other threads:[~2014-09-24 5:11 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-17 7:21 [PATCH v5 0/3] LED triggers for USB host and device Michal Sojka
2014-09-17 7:21 ` [PATCH v5 1/3] usb: gadget: Refactor request completion Michal Sojka
2014-09-17 15:28 ` Felipe Balbi
2014-09-23 8:09 ` Michal Sojka [this message]
2014-09-24 14:48 ` Felipe Balbi
2014-09-24 15:08 ` Alan Stern
2014-09-24 20:43 ` [PATCH v6 0/4] LED triggers for USB host and device Michal Sojka
2014-09-24 20:43 ` [PATCH v6 1/4] usb: gadget: Introduce usb_gadget_giveback_request() Michal Sojka
2014-09-24 21:00 ` Felipe Balbi
2014-09-24 20:43 ` [PATCH v6 2/4] usb: gadget: Refactor request completion Michal Sojka
2014-09-24 23:14 ` Felipe Balbi
2014-09-29 8:50 ` Robert Baldyga
2014-09-29 9:13 ` Michal Sojka
2014-09-29 14:05 ` Felipe Balbi
2014-09-24 20:43 ` [PATCH v6 3/4] usb: Rename usb-common.c Michal Sojka
2014-09-24 23:15 ` Felipe Balbi
2014-09-25 15:03 ` Greg Kroah-Hartman
2014-09-25 15:48 ` project wide: git config entry for [diff] renames=true Joe Perches
2014-09-25 18:00 ` Jeff King
2014-09-25 18:06 ` Joe Perches
2014-09-25 18:43 ` Junio C Hamano
2014-09-25 18:53 ` Junio C Hamano
2014-09-24 20:43 ` [PATCH v6 4/4] usb: Add LED triggers for USB activity Michal Sojka
2014-09-24 20:56 ` Felipe Balbi
2014-09-24 20:59 ` [PATCH v6 0/4] LED triggers for USB host and device Felipe Balbi
2014-09-24 21:41 ` Greg Kroah-Hartman
2014-09-24 22:18 ` Felipe Balbi
2014-09-24 23:15 ` Felipe Balbi
2014-09-25 10:36 ` Greg Kroah-Hartman
2014-09-25 13:56 ` Felipe Balbi
2014-09-25 14:56 ` Greg Kroah-Hartman
2014-09-17 7:21 ` [PATCH v5 2/3] usb: Rename usb-common.c Michal Sojka
2014-09-17 7:21 ` [PATCH v5 3/3] usb: Add LED triggers for USB activity Michal Sojka
-- strict thread matches above, loose matches on Subject: below --
2014-08-29 12:57 [PATCH v4 " Michal Sojka
2014-08-29 13:07 ` [PATCH v5 0/3] LED triggers for USB host and device Michal Sojka
2014-08-29 13:07 ` [PATCH v5 1/3] usb: gadget: Refactor request completion Michal Sojka
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=874mvyahcd.fsf@steelpick.2x.cz \
--to=sojka@merica.cz \
--cc=balbi@ti.com \
--cc=cooloney@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=michal.vokac@comap.cz \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox