Hi Felipe,
obex_bind() calls usb_gadget_disconnect() atomically, which sleeps in
pm_runtime_resume(), and that indeed causes problems.
This particular problem can be workarounded by reverting the commit
2121427836c9e - usb gadget: defer obex enumeration by David Brownell,
however it doesn't sound like a proper way for me. Also I can't verify
that CDC OBEX is still completely functional after commit reverting.
The question is should usb_function_deactivate() calls be removed from
obex_bind() or usb_gadget_disconnect() shall not be run in atomic
context or maybe something else is needed to be done here?
The problem is reproduced on 3.1.6 kernel.
----8<----
BUG: scheduling while atomic: modprobe/89/0x00000002
Modules linked in: g_nokia(+) phonet bq27x00_battery power_supply
[<c0014bc0>] (unwind_backtrace+0x0/0x144) from [<c0442558>]
(dump_stack+0x20/0x24)
[<c0442558>] (dump_stack+0x20/0x24) from [<c0037d34>]
(__schedule_bug+0x68/0x6c)
[<c0037d34>] (__schedule_bug+0x68/0x6c) from [<c0442d2c>]
(__schedule+0x5cc/0x6a4)
[<c0442d2c>] (__schedule+0x5cc/0x6a4) from [<c0443398>] (schedule+0x58/0x70)
[<c0443398>] (schedule+0x58/0x70) from [<c0443874>]
(schedule_timeout+0x1b4/0x320)
[<c0443874>] (schedule_timeout+0x1b4/0x320) from [<c044318c>]
(wait_for_common+0xd0/0x1a8)
[<c044318c>] (wait_for_common+0xd0/0x1a8) from [<c0443318>]
(wait_for_completion_timeout+0x1c/0x20)
[<c0443318>] (wait_for_completion_timeout+0x1c/0x20) from [<c0353660>]
(omap_i2c_xfer+0x2a4/0x3b8)
[<c0353660>] (omap_i2c_xfer+0x2a4/0x3b8) from [<c0350d8c>]
(i2c_transfer+0xbc/0x128)
[<c0350d8c>] (i2c_transfer+0xbc/0x128) from [<c02f7f6c>]
(twl_i2c_read+0xdc/0x15c)
[<c02f7f6c>] (twl_i2c_read+0xdc/0x15c) from [<c02f8008>]
(twl_i2c_read_u8+0x1c/0x20)
[<c02f8008>] (twl_i2c_read_u8+0x1c/0x20) from [<c02bac94>]
(twlreg_grp+0x2c/0x3c)
[<c02bac94>] (twlreg_grp+0x2c/0x3c) from [<c02bacf4>]
(twl4030reg_is_enabled+0x18/0x24)
[<c02bacf4>] (twl4030reg_is_enabled+0x18/0x24) from [<c02b89dc>]
(regulator_enable+0x7c/0x444)
[<c02b89dc>] (regulator_enable+0x7c/0x444) from [<c0340984>]
(twl4030_phy_power+0x2c/0x130)
[<c0340984>] (twl4030_phy_power+0x2c/0x130) from [<c0340b10>]
(__twl4030_phy_resume+0x20/0x58)
[<c0340b10>] (__twl4030_phy_resume+0x20/0x58) from [<c0340b70>]
(twl4030_phy_resume+0x28/0x68)
[<c0340b70>] (twl4030_phy_resume+0x28/0x68) from [<c0340c40>]
(twl4030_set_suspend+0x20/0x34)
[<c0340c40>] (twl4030_set_suspend+0x20/0x34) from [<c033f7c4>]
(omap2430_runtime_resume+0x4c/0x54)
[<c033f7c4>] (omap2430_runtime_resume+0x4c/0x54) from [<c02eede0>]
(pm_generic_runtime_resume+0x3c/0x50)
[<c02eede0>] (pm_generic_runtime_resume+0x3c/0x50) from [<c0030b30>]
(_od_runtime_resume+0x28/0x2c)
[<c0030b30>] (_od_runtime_resume+0x28/0x2c) from [<c02f2268>]
(rpm_callback+0x64/0xac)
[<c02f2268>] (rpm_callback+0x64/0xac) from [<c02f32f4>]
(rpm_resume+0x3bc/0x5f8)
[<c02f32f4>] (rpm_resume+0x3bc/0x5f8) from [<c02f3220>]
(rpm_resume+0x2e8/0x5f8)
[<c02f3220>] (rpm_resume+0x2e8/0x5f8) from [<c02f3830>]
(__pm_runtime_resume+0x5c/0x90)
[<c02f3830>] (__pm_runtime_resume+0x5c/0x90) from [<c033a880>]
(musb_gadget_pullup+0x30/0xb0)
[<c033a880>] (musb_gadget_pullup+0x30/0xb0) from [<bf01d720>]
(usb_function_deactivate+0x68/0xb8 [g_nokia])
[<bf01d720>] (usb_function_deactivate+0x68/0xb8 [g_nokia]) from
[<bf02a3f8>] (obex_bind+0xe0/0x1b8 [g_nokia])
[<bf02a3f8>] (obex_bind+0xe0/0x1b8 [g_nokia]) from [<bf01d5ac>]
(usb_add_function+0xa0/0x1ac [g_nokia])
[<bf01d5ac>] (usb_add_function+0xa0/0x1ac [g_nokia]) from [<bf02a8c8>]
(obex_bind_config+0x140/0x184 [g_nokia])
[<bf02a8c8>] (obex_bind_config+0x140/0x184 [g_nokia]) from [<bf02aad0>]
(nokia_bind_config+0x34/0xbc [g_nokia])
[<bf02aad0>] (nokia_bind_config+0x34/0xbc [g_nokia]) from [<bf01d9f8>]
(usb_add_config+0x98/0x2b0 [g_nokia])
[<bf01d9f8>] (usb_add_config+0x98/0x2b0 [g_nokia]) from [<bf02af14>]
(nokia_bind+0x31c/0x390 [g_nokia])
[<bf02af14>] (nokia_bind+0x31c/0x390 [g_nokia]) from [<bf01c41c>]
(composite_bind+0x134/0x2fc [g_nokia])
[<bf01c41c>] (composite_bind+0x134/0x2fc [g_nokia]) from [<c0340f30>]
(usb_gadget_probe_driver+0xc8/0x1ec)
[<c0340f30>] (usb_gadget_probe_driver+0xc8/0x1ec) from [<bf01ddb0>]
(usb_composite_probe+0xb4/0xb8 [g_nokia])
[<bf01ddb0>] (usb_composite_probe+0xb4/0xb8 [g_nokia]) from [<bf02afa4>]
(nokia_init+0x1c/0x24 [g_nokia])
[<bf02afa4>] (nokia_init+0x1c/0x24 [g_nokia]) from [<c0008728>]
(do_one_initcall+0x44/0x188)
[<c0008728>] (do_one_initcall+0x44/0x188) from [<c007cda8>]
(sys_init_module+0x100/0x1a78)
[<c007cda8>] (sys_init_module+0x100/0x1a78) from [<c000ef40>]
(ret_fast_syscall+0x0/0x30)
----8<----
With best wishes,
Vladimir
--
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