All of lore.kernel.org
 help / color / mirror / Atom feed
* omap2430 regression due to "usb: musb: fix incorrect usage of resource pointer"
@ 2013-07-26  9:14 NeilBrown
  2013-07-26 10:20 ` Felipe Balbi
  0 siblings, 1 reply; 5+ messages in thread
From: NeilBrown @ 2013-07-26  9:14 UTC (permalink / raw)
  To: Felipe Balbi, Dmitry Lifshitz; +Cc: linux-omap

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


Hi,
 the commit:

commit 09fc7d22b024692b2fe8a943b246de1af307132b
Author: Felipe Balbi <balbi@ti.com>
Date:   Wed Apr 24 17:21:42 2013 +0300

    usb: musb: fix incorrect usage of resource pointer
    
    We can't simply pass the resource pointer from our
    device down to our children, otherwise module
    reinsertion will not work as the resource will
    continue to be marked as busy.
    
    Fix it by building a proper struct resource for
    our child musb device.
 

(even with the subsequent compile fix applied) breaks my USB-OTG port on my
GTA04.

I must admit that I don't see the point of the patch at all.
Instead of passing one array to platform_device_add_resources()
which will copy it into malloced space, it copies bits of the array onto
the stack on passes that for platform_device_add_resources to copy.
What is the value of the second copy??

But that isn't the real problem.  The real problem is that in omap2430_probe,
on my board at least, pdev->num_resources == 3.  But only the first 2 entries
in the array are copied.

If I make the array one entry larger and copy the extra entry it works.  Of
course that might break for someone else who only has 2 resources to copy....

Can we go back to just leaving it to platform_device_add_resources to do the
copying it have I missed something?  (I can't see where the new old code
would mark something as 'busy' that the new code won't mark as busy...)

Thanks,
NeilBrown

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: omap2430 regression due to "usb: musb: fix incorrect usage of resource pointer"
  2013-07-26  9:14 omap2430 regression due to "usb: musb: fix incorrect usage of resource pointer" NeilBrown
@ 2013-07-26 10:20 ` Felipe Balbi
  2013-07-26 12:24   ` NeilBrown
  0 siblings, 1 reply; 5+ messages in thread
From: Felipe Balbi @ 2013-07-26 10:20 UTC (permalink / raw)
  To: NeilBrown; +Cc: Felipe Balbi, Dmitry Lifshitz, linux-omap

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

On Fri, Jul 26, 2013 at 07:14:45PM +1000, NeilBrown wrote:
> 
> Hi,
>  the commit:
> 
> commit 09fc7d22b024692b2fe8a943b246de1af307132b
> Author: Felipe Balbi <balbi@ti.com>
> Date:   Wed Apr 24 17:21:42 2013 +0300
> 
>     usb: musb: fix incorrect usage of resource pointer
>     
>     We can't simply pass the resource pointer from our
>     device down to our children, otherwise module
>     reinsertion will not work as the resource will
>     continue to be marked as busy.
>     
>     Fix it by building a proper struct resource for
>     our child musb device.
>  
> 
> (even with the subsequent compile fix applied) breaks my USB-OTG port on my
> GTA04.
> 
> I must admit that I don't see the point of the patch at all.
> Instead of passing one array to platform_device_add_resources()
> which will copy it into malloced space, it copies bits of the array onto
> the stack on passes that for platform_device_add_resources to copy.
> What is the value of the second copy??

if you don't do that, the resource will already be busy and ioremap will
fail on second modprobe.

> But that isn't the real problem.  The real problem is that in omap2430_probe,
> on my board at least, pdev->num_resources == 3.  But only the first 2 entries
> in the array are copied.
> 
> If I make the array one entry larger and copy the extra entry it works.  Of
> course that might break for someone else who only has 2 resources to copy....
> 
> Can we go back to just leaving it to platform_device_add_resources to do the
> copying it have I missed something?  (I can't see where the new old code
> would mark something as 'busy' that the new code won't mark as busy...)

patches already in Greg's queue

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: omap2430 regression due to "usb: musb: fix incorrect usage of resource pointer"
  2013-07-26 10:20 ` Felipe Balbi
@ 2013-07-26 12:24   ` NeilBrown
  2013-07-26 13:51     ` Felipe Balbi
  0 siblings, 1 reply; 5+ messages in thread
From: NeilBrown @ 2013-07-26 12:24 UTC (permalink / raw)
  To: balbi; +Cc: Dmitry Lifshitz, linux-omap

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

On Fri, 26 Jul 2013 13:20:08 +0300 Felipe Balbi <balbi@ti.com> wrote:

> On Fri, Jul 26, 2013 at 07:14:45PM +1000, NeilBrown wrote:
> > 
> > Hi,
> >  the commit:
> > 
> > commit 09fc7d22b024692b2fe8a943b246de1af307132b
> > Author: Felipe Balbi <balbi@ti.com>
> > Date:   Wed Apr 24 17:21:42 2013 +0300
> > 
> >     usb: musb: fix incorrect usage of resource pointer
> >     
> >     We can't simply pass the resource pointer from our
> >     device down to our children, otherwise module
> >     reinsertion will not work as the resource will
> >     continue to be marked as busy.
> >     
> >     Fix it by building a proper struct resource for
> >     our child musb device.
> >  
> > 
> > (even with the subsequent compile fix applied) breaks my USB-OTG port on my
> > GTA04.
> > 
> > I must admit that I don't see the point of the patch at all.
> > Instead of passing one array to platform_device_add_resources()
> > which will copy it into malloced space, it copies bits of the array onto
> > the stack on passes that for platform_device_add_resources to copy.
> > What is the value of the second copy??
> 
> if you don't do that, the resource will already be busy and ioremap will
> fail on second modprobe.

Ahhh... the parent/sibling/child linkage - got it.

> 
> > But that isn't the real problem.  The real problem is that in omap2430_probe,
> > on my board at least, pdev->num_resources == 3.  But only the first 2 entries
> > in the array are copied.
> > 
> > If I make the array one entry larger and copy the extra entry it works.  Of
> > course that might break for someone else who only has 2 resources to copy....
> > 
> > Can we go back to just leaving it to platform_device_add_resources to do the
> > copying it have I missed something?  (I can't see where the new old code
> > would mark something as 'busy' that the new code won't mark as busy...)
> 
> patches already in Greg's queue
> 

Thanks. 
Doesn't seem to be in the usb-next or usb-linus branches of 
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
Can you give me a pointer?

Thanks,
NeilBrown


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: omap2430 regression due to "usb: musb: fix incorrect usage of resource pointer"
  2013-07-26 12:24   ` NeilBrown
@ 2013-07-26 13:51     ` Felipe Balbi
  2013-07-26 22:15       ` NeilBrown
  0 siblings, 1 reply; 5+ messages in thread
From: Felipe Balbi @ 2013-07-26 13:51 UTC (permalink / raw)
  To: NeilBrown; +Cc: balbi, Dmitry Lifshitz, linux-omap

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

On Fri, Jul 26, 2013 at 10:24:58PM +1000, NeilBrown wrote:
> On Fri, 26 Jul 2013 13:20:08 +0300 Felipe Balbi <balbi@ti.com> wrote:
> 
> > On Fri, Jul 26, 2013 at 07:14:45PM +1000, NeilBrown wrote:
> > > 
> > > Hi,
> > >  the commit:
> > > 
> > > commit 09fc7d22b024692b2fe8a943b246de1af307132b
> > > Author: Felipe Balbi <balbi@ti.com>
> > > Date:   Wed Apr 24 17:21:42 2013 +0300
> > > 
> > >     usb: musb: fix incorrect usage of resource pointer
> > >     
> > >     We can't simply pass the resource pointer from our
> > >     device down to our children, otherwise module
> > >     reinsertion will not work as the resource will
> > >     continue to be marked as busy.
> > >     
> > >     Fix it by building a proper struct resource for
> > >     our child musb device.
> > >  
> > > 
> > > (even with the subsequent compile fix applied) breaks my USB-OTG port on my
> > > GTA04.
> > > 
> > > I must admit that I don't see the point of the patch at all.
> > > Instead of passing one array to platform_device_add_resources()
> > > which will copy it into malloced space, it copies bits of the array onto
> > > the stack on passes that for platform_device_add_resources to copy.
> > > What is the value of the second copy??
> > 
> > if you don't do that, the resource will already be busy and ioremap will
> > fail on second modprobe.
> 
> Ahhh... the parent/sibling/child linkage - got it.
> 
> > 
> > > But that isn't the real problem.  The real problem is that in omap2430_probe,
> > > on my board at least, pdev->num_resources == 3.  But only the first 2 entries
> > > in the array are copied.
> > > 
> > > If I make the array one entry larger and copy the extra entry it works.  Of
> > > course that might break for someone else who only has 2 resources to copy....
> > > 
> > > Can we go back to just leaving it to platform_device_add_resources to do the
> > > copying it have I missed something?  (I can't see where the new old code
> > > would mark something as 'busy' that the new code won't mark as busy...)
> > 
> > patches already in Greg's queue
> > 
> 
> Thanks. 
> Doesn't seem to be in the usb-next or usb-linus branches of 
> git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
> Can you give me a pointer?

hmmm, looks like this is not in greg/usb-linus indeed. I'll send him
another pull request on monday. If you wanna try, use my 'fixes' branch
on kernel.org.

cheers

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: omap2430 regression due to "usb: musb: fix incorrect usage of resource pointer"
  2013-07-26 13:51     ` Felipe Balbi
@ 2013-07-26 22:15       ` NeilBrown
  0 siblings, 0 replies; 5+ messages in thread
From: NeilBrown @ 2013-07-26 22:15 UTC (permalink / raw)
  To: balbi; +Cc: Dmitry Lifshitz, linux-omap

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

On Fri, 26 Jul 2013 16:51:08 +0300 Felipe Balbi <balbi@ti.com> wrote:

> On Fri, Jul 26, 2013 at 10:24:58PM +1000, NeilBrown wrote:
> > On Fri, 26 Jul 2013 13:20:08 +0300 Felipe Balbi <balbi@ti.com> wrote:
> > 
> > > On Fri, Jul 26, 2013 at 07:14:45PM +1000, NeilBrown wrote:
> > > > 
> > > > Hi,
> > > >  the commit:
> > > > 
> > > > commit 09fc7d22b024692b2fe8a943b246de1af307132b
> > > > Author: Felipe Balbi <balbi@ti.com>
> > > > Date:   Wed Apr 24 17:21:42 2013 +0300
> > > > 
> > > >     usb: musb: fix incorrect usage of resource pointer
> > > >     
> > > >     We can't simply pass the resource pointer from our
> > > >     device down to our children, otherwise module
> > > >     reinsertion will not work as the resource will
> > > >     continue to be marked as busy.
> > > >     
> > > >     Fix it by building a proper struct resource for
> > > >     our child musb device.
> > > >  
> > > > 
> > > > (even with the subsequent compile fix applied) breaks my USB-OTG port on my
> > > > GTA04.
> > > > 
> > > > I must admit that I don't see the point of the patch at all.
> > > > Instead of passing one array to platform_device_add_resources()
> > > > which will copy it into malloced space, it copies bits of the array onto
> > > > the stack on passes that for platform_device_add_resources to copy.
> > > > What is the value of the second copy??
> > > 
> > > if you don't do that, the resource will already be busy and ioremap will
> > > fail on second modprobe.
> > 
> > Ahhh... the parent/sibling/child linkage - got it.
> > 
> > > 
> > > > But that isn't the real problem.  The real problem is that in omap2430_probe,
> > > > on my board at least, pdev->num_resources == 3.  But only the first 2 entries
> > > > in the array are copied.
> > > > 
> > > > If I make the array one entry larger and copy the extra entry it works.  Of
> > > > course that might break for someone else who only has 2 resources to copy....
> > > > 
> > > > Can we go back to just leaving it to platform_device_add_resources to do the
> > > > copying it have I missed something?  (I can't see where the new old code
> > > > would mark something as 'busy' that the new code won't mark as busy...)
> > > 
> > > patches already in Greg's queue
> > > 
> > 
> > Thanks. 
> > Doesn't seem to be in the usb-next or usb-linus branches of 
> > git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
> > Can you give me a pointer?
> 
> hmmm, looks like this is not in greg/usb-linus indeed. I'll send him
> another pull request on monday. If you wanna try, use my 'fixes' branch
> on kernel.org.

Thanks.  I found that one, pulled it in, and can confirm that it fixed my USB
problem.

Thanks,
NeilBrown

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-07-26 22:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-26  9:14 omap2430 regression due to "usb: musb: fix incorrect usage of resource pointer" NeilBrown
2013-07-26 10:20 ` Felipe Balbi
2013-07-26 12:24   ` NeilBrown
2013-07-26 13:51     ` Felipe Balbi
2013-07-26 22:15       ` NeilBrown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.