From: Pavol Kurina <pavol.kurina@emsys.de>
To: balbi@ti.com
Cc: linux-omap@vger.kernel.org
Subject: Re: [patch-v2.6.39 03/12] usb: musb: gadget: do not poke with gadget's list_head
Date: Tue, 01 Mar 2011 16:36:53 +0100 [thread overview]
Message-ID: <4D6D1295.1020809@emsys.de> (raw)
In-Reply-To: <20110228084311.GJ2459@legolas.emea.dhcp.ti.com>
Am 28.02.2011 09:43, schrieb Felipe Balbi:
> On Fri, Feb 25, 2011 at 07:41:47PM +0000, Pavol Kurina wrote:
>> Felipe Balbi<balbi<at> ti.com> writes:
>>> struct usb_request's list_head is supposed to be
>>> used only by gadget drivers, but musb is abusing
>>> that. Give struct musb_request its own list_head
>>> and prevent musb from poking into other driver's
>>> business.
>> Hi,
>>
>> I think, the patch misses to fix the usage of
>> "request->list" in musb_gadget_dequeue in
>> musb_gadget.c.
>>
>> I found out by having troubles with f_mass_storage.
>> It needs musb_gadget_dequeue to work properly...
>>
>> I backported the patch to android-2.6.35 kernel on a
>> omap4 system and also fixed the musb_gadget_dequeue
>> there so f_mass_storage seem to work at least there
>> now...
>>
>> Can you check this patch regarding some missing bits
>> please?
> Looks like we need some extra tests to be added to g_zero, I tested with
> g_zero and it didn't find that problem. Anyway, here's a patch which
> probably fixes what you need to be fixed. Would you test it for me ?
>
> diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
> index da8c93b..bf88a61 100644
> --- a/drivers/usb/musb/musb_gadget.c
> +++ b/drivers/usb/musb/musb_gadget.c
> @@ -1274,7 +1274,8 @@ cleanup:
> static int musb_gadget_dequeue(struct usb_ep *ep, struct usb_request *request)
> {
> struct musb_ep *musb_ep = to_musb_ep(ep);
> - struct usb_request *r;
> + struct musb_request req = to_musb_request(request);
> + struct musb_request *r;
> unsigned long flags;
> int status = 0;
> struct musb *musb = musb_ep->musb;
> @@ -1285,10 +1286,10 @@ static int musb_gadget_dequeue(struct usb_ep *ep, struct usb_request *request)
> spin_lock_irqsave(&musb->lock, flags);
>
> list_for_each_entry(r,&musb_ep->req_list, list) {
> - if (r == request)
> + if (r == req)
> break;
> }
> - if (r != request) {
> + if (r != req) {
> DBG(3, "request %p not queued to %s\n", request, ep->name);
> status = -EINVAL;
> goto done;
>
I've tested this on my omap4 system with the android-2.6.35 kernel. It
seems like f_mass_storage and the f_adb
work fine.
I've added one more change to your patch.
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index a1e1d24..7877ccc 100755
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -1250,7 +1250,8 @@ cleanup:
static int musb_gadget_dequeue(struct usb_ep *ep, struct usb_request
*request)
{
struct musb_ep *musb_ep = to_musb_ep(ep);
- struct usb_request *r;
+ struct musb_request *req = to_musb_request(request);
+ struct musb_request *r;
unsigned long flags;
int status = 0;
struct musb *musb = musb_ep->musb;
@@ -1261,17 +1262,17 @@ static int musb_gadget_dequeue(struct usb_ep
*ep, struct usb_request *request)
spin_lock_irqsave(&musb->lock, flags);
list_for_each_entry(r, &musb_ep->req_list, list) {
- if (r == request)
+ if (r == req)
break;
}
- if (r != request) {
+ if (r != req) {
DBG(3, "request %p not queued to %s\n", request, ep->name);
status = -EINVAL;
goto done;
}
/* if the hardware doesn't have the request, easy ... */
- if (musb_ep->req_list.next != &request->list || musb_ep->busy)
+ if (musb_ep->req_list.next != &req->list || musb_ep->busy)
musb_g_giveback(musb_ep, request, -ECONNRESET);
Best regards,
Pavol.
next prev parent reply other threads:[~2011-03-01 15:47 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-17 12:38 [patch-v2.6.39 00/12] OMAP USB and MUSB patches for Next Felipe Balbi
[not found] ` <1297946329-9353-1-git-send-email-balbi-l0cyMroinI0@public.gmane.org>
2011-02-17 12:38 ` [patch-v2.6.39 01/12] usb: musb: do not error out if Kconfig doesn't match board mode Felipe Balbi
2011-02-17 12:38 ` [patch-v2.6.39 05/12] usb: otg: enable regulator only on cable/device connect Felipe Balbi
2011-02-17 12:38 ` [patch-v2.6.39 08/12] usb: otg: OMAP4430: Introducing suspend function for power management Felipe Balbi
[not found] ` <1297946329-9353-9-git-send-email-balbi-l0cyMroinI0@public.gmane.org>
2011-02-17 19:13 ` Felipe Balbi
2011-02-18 7:48 ` Felipe Balbi
[not found] ` <20110218074857.GY14574-UiBtZHVXSwEVvW8u9ZQWYwjfymiNCTlR@public.gmane.org>
2011-02-24 21:32 ` Tony Lindgren
2011-02-24 21:31 ` Tony Lindgren
2011-02-17 12:38 ` [patch-v2.6.39 09/12] usb: otg: TWL6030: Introduce the twl6030_phy_suspend function Felipe Balbi
2011-02-17 12:38 ` [patch-v2.6.39 10/12] usb: otg: TWL6030 Save the last event in otg_transceiver Felipe Balbi
2011-02-17 12:38 ` [patch-v2.6.39 12/12] usb: otg: notifier: switch to atomic notifier Felipe Balbi
2011-02-25 10:46 ` Heikki Krogerus
2011-02-25 10:50 ` Heikki Krogerus
2011-02-25 10:53 ` Felipe Balbi
[not found] ` <20110225105317.GE4190-UiBtZHVXSwEVvW8u9ZQWYwjfymiNCTlR@public.gmane.org>
2011-02-25 11:07 ` Heikki Krogerus
2011-02-25 11:24 ` Felipe Balbi
2011-02-25 11:32 ` Heikki Krogerus
2011-02-17 12:38 ` [patch-v2.6.39 02/12] usb: musb: gadget: beautify usb_gadget_probe_driver()/usb_gadget_unregister_driver Felipe Balbi
2011-02-17 12:38 ` [patch-v2.6.39 03/12] usb: musb: gadget: do not poke with gadget's list_head Felipe Balbi
2011-02-25 19:41 ` Pavol Kurina
2011-02-28 8:43 ` Felipe Balbi
2011-03-01 15:36 ` Pavol Kurina [this message]
2011-03-01 15:39 ` Felipe Balbi
2011-03-01 15:40 ` Felipe Balbi
2011-03-01 15:44 ` Felipe Balbi
2011-02-17 12:38 ` [patch-v2.6.39 04/12] usb: musb: Using runtime pm APIs for musb Felipe Balbi
2011-02-17 12:38 ` [patch-v2.6.39 06/12] usb: otg: Remove one unnecessary I2C read request Felipe Balbi
2011-02-17 12:38 ` [patch-v2.6.39 07/12] usb: otg: OMAP4430: Add phy_suspend function pointer to twl4030_usb_data Felipe Balbi
2011-02-17 12:38 ` [patch-v2.6.39 11/12] usb: musb: OMAP4430: Fix usb device detection if connected during boot Felipe Balbi
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=4D6D1295.1020809@emsys.de \
--to=pavol.kurina@emsys.de \
--cc=balbi@ti.com \
--cc=linux-omap@vger.kernel.org \
/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