Re: Possible race condition in USB gadget probing?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Jan 4, 2015 at 1:44 AM, Felipe Balbi <balbi@xxxxxx> wrote:
> Hi,
>
> On Sat, Jan 03, 2015 at 10:53:20PM +1100, Daniel Tang wrote:
>> Hi,
>>
>> I’ve run into a problem which I suspect is to with how
>> usb_gadget_probe_driver is implemented in
>> drivers/usb/gadget/udc/udc-core.c
>>
>> I have an embedded system that uses the Chipidea OTG controller.
>> Unfortunately, when it boots up, the driver is loaded but there’s no
>> USB gadget that gets attached to it. I’m building the USB gadget
>> support into the kernel.
>
> statically linking gadget drivers has an old known problem which nobody
> has been able to provide a good solution. If you wanna tackle it, we'll
> review patches, for sure.
>

I have un-finished patch set for it, Daniel, if you have time, you can go on
it (g_mass_storage has some issues for it)

An easy way to workaround this issue is register your build-in gadget driver
with late_initcall.

>> Here’s a snippet of the boot log:
>>
>> Console: switching to colour frame buffer device 40x30
>> Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
>> Serial: AMBA driver
>> brd: module loaded
>> ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
>> zevio_usb b0000000.usb: ci_hdrc_zevio_probe
>> zevio_usb b0000000.usb: ci_hdrc_add_device failed!
>> platform b0000000.usb: Driver zevio_usb requests probe deferral
>> userial_init: registered 4 ttyGS* devices
>> couldn't find an available UDC
>> mousedev: PS/2 mouse device common for all mice
>> usbcore: registered new interface driver usbhid
>> usbhid: USB HID core driver
>> zevio_usb b0000000.usb: ci_hdrc_zevio_probe
>> ci_hdrc ci_hdrc.0: ChipIdea HDRC found, lpm: 0; cap: c4882100 op: c4882140
>> ci_hdrc ci_hdrc.0: It is OTG capable controller
>> USB VBUS output: disabling
>> RAMDISK: gzip image found at block 0
>>
>> It seems that because the Chipidea driver requests a probe deferral
>> (presumably to wait for some device it depends on to get probed), it
>> doesn’t get loaded before usb_gadget_probe_driver is called. Hence,
>> usb_gadget_probe_driver doesn’t find anything it can bind to and it
>> errors out. By the time the Chipidea driver actually finishes getting
>> probed, it’s too late to bind any gadgets to.
>>
>> Does this sound like a reasonable diagnosis? What can we do about it?
>
> yeah, that's correct.
>
> --
> balbi



-- 
BR,
Peter Chen
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux