BUG: usb: phy: msm: problem with EPROBE defer and extcon cleanup

From: Tim Bird
Date: Mon Aug 17 2015 - 19:43:31 EST


Ivan,

I'm seeing a bug in the phy-msm-usb.c code, when I get an EPROBE defer during probing the driver.
The code is statically linked in the kernel, and the dts for my board is specifying an extcon phandle
for the ID pin.

Below is a fragment of the kernel output for a boot of this code. Messages prefixed with TRB
are my own debug printks. Note that the notifier block (at ee23513c) that gets registered
with extcon before the first probe failure, ultimately gets used during an ID pin event
(status change) by raw_notifier_call_chain(). This notifier block should be unregistered
if the probe fails, so that only the second one registered is on the call chain.

Let me know if you plan to work on this. I'm otherwise occupied the remainder of this week,
so won't have time to work on it, but I can probably get to it early next week if you don't.

Regards,
-- Tim


[ 1.435543] NET: Registered protocol family 17
[ 1.439773] Key type dns_resolver registered
[ 1.444041] Registering SWP/SWPB emulation handler
[ 1.451259] msm_otg f9a55000.usb-phy: failed to get phandle in /soc/usb-phy@f9a55000 node
[ 1.452915] TRB: registering notifier for ext_id
[ 1.464681] TRB: motg=ee235010, id=ee23513c, nb=ee23513c
[ 1.465957] msm_otg f9a55000.usb-phy: OTG regs = f011e000
[ 1.471532] msm_otg f9a55000.usb-phy: Failed to get supply 'v3p3': -517
[ 1.477416] msm_hsusb_host f9a55000.ehci: ehci_msm proble
[ 1.482889] msm_hsusb_host f9a55000.ehci: unable to find transceiver
[ 1.488762] msm_hsusb f9a55000.usb-controller: ci_hdrc_msm_probe
[ 1.501689] l20: supplied by vreg-boost-bypass
[ 1.503694] s3: operation not allowed
[ 1.505072] mmc0: Switching to 3.3V signalling voltage failed
[ 1.545275] mmc0: SDHCI controller on f9824900.sdhci [f9824900.sdhci] using ADMA
[ 1.545615] msm_otg f9a55000.usb-phy: failed to get phandle in /soc/usb-phy@f9a55000 node
[ 1.551749] TRB: registering notifier for ext_id
[ 1.559835] TRB: motg=ed893e10, id=ed893f3c, nb=ed893f3c
[ 1.564578] msm_otg f9a55000.usb-phy: OTG regs = f0132000
[ 1.569985] l24: supplied by vreg-boost-bypass
[ 1.575342] l6: supplied by s2
[ 1.579737] l6: operation not allowed
[ 1.582458] l24: operation not allowed
[ 1.586229] reg (HPM)
[ 1.608277] mmc0: MAN_BKOPS_EN bit is not set
[ 1.615708] mmc0: new HS200 MMC card at address 0001
[ 1.616252] mmcblk0: mmc0:0001 SEM16G 14.6 GiB
[ 1.619888] mmcblk0boot0: mmc0:0001 SEM16G partition 1 4.00 MiB
[ 1.624128] mmcblk0boot1: mmc0:0001 SEM16G partition 2 4.00 MiB
[ 1.630063] mmcblk0rpmb: mmc0:0001 SEM16G partition 3 4.00 MiB
[ 1.638255] mmcblk0: p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15 p16 p17 p18 p19 p20
[ 1.695676] msm_hsusb_host f9a55000.ehci: ehci_msm proble
[ 1.695749] msm_otg f9a55000.usb-phy: Host mode is not supported
[ 1.700054] msm_hsusb_host f9a55000.ehci: unable to register with transceiver
[ 1.706184] msm_otg f9a55000.usb-phy: OTG runtime idle
[ 1.713500] msm_hsusb f9a55000.usb-controller: ci_hdrc_msm_probe
[ 1.718267] f9a55000.usb-controller supply vbus not found, using dummy regulator
[ 1.724762] TRB: in ci_hdrc_probe
[ 1.731807] ci_hdrc ci_hdrc.0: ChipIdea HDRC found, revision: 10, lpm: 0; cap: f013a100 op: f013a140
[ 1.737561] ci_hdrc ci_hdrc.0: It is OTG capable controller
[ 1.744146] TRB: in ci_hdrc_probe 5
[ 1.749472] TRB: in ci_hdrc_probe 6
[ 1.752909] TRB: in ci_hdrc_probe 6.2
[ 1.756418] ci_hdrc ci_hdrc.0: doesn't support host
[ 1.761013] TRB: in ci_handle_vbus_change
[ 1.764891] TRB: leaving ci_handle_vbus_change
[ 1.770983] input: gpio-keys as /devices/platform/gpio-keys/input/input1
[ 1.773985] rtc-pm8xxx fc4cf000.spmi:pm8941@0:rtc@6000: setting system clock to 1970-01-08 05:42:48
UTC (625368)
[ 1.809216] l21: disabling
[ 1.809427] l13: disabling
[ 1.810968] l12: disabling
[ 1.813616] l7: disabling
[ 1.816948] ALSA device list:
[ 1.818881] No soundcards found.
[ 1.822421] Freeing unused kernel memory: 328K (c0aac000 - c0afe000)
[ 1.829723] busybox (79) used greatest stack depth: 6392 bytes left
[ 2.344367] mdev (94) used greatest stack depth: 6364 bytes left
[ 2.347097] mkdir (104) used greatest stack depth: 6296 bytes left
[ 13.965264] TRB: in usb_extcon_detect_cable, id=0
[ 13.965286] TRB: in extcon_update_state
[ 13.968945] msm_otg f9a55000.usb-phy: BSV set/clear
[ 13.972582] TRB: in extcon_update_state, check each cable
[ 13.977443] TRB: in extcon_update_state, calling raw_notifier_call_chain
[ 13.983000] TRB: edev->max_supported = 1
[ 13.989766] TRB: index = 0
[ 13.993672] TRB: edev->nh[index] = ee322650
[ 13.996191] TRB: attached = 1
[ 14.000270] TRB: edev = ee2e9400
[ 14.003397] TRB: in notifier_call_chain, nb=ee23513c
[ 14.006699] TRB: in notifier_call_chain, nb->notifier_call=0x2
[ 14.011646] ------------[ cut here ]------------
[ 14.017301] WARNING: CPU: 0 PID: 35 at /home/CORPUSERS/10102229/work/dragonboard/APQ8074_M8974AAAAAN
LYA31050138_JB_V11/bjorn-2015-08/kernel/notifier.c:91 notifier_call_chain+0xb4/0xc8()
[ 14.022076] Invalid notifier called!
[ 14.038465] Modules linked in:
[ 14.044976] CPU: 0 PID: 35 Comm: kworker/0:1 Not tainted 4.2.0-rc6-next-20150810-61331-g07237b3-dirt
y #46
[ 14.045071] Hardware name: Generic DT based system
[ 14.054623] Workqueue: events_power_efficient usb_extcon_detect_cable
[ 14.065474] [<c0216cdc>] (unwind_backtrace) from [<c02139d8>] (show_stack+0x10/0x14)
[ 14.065824] [<c02139d8>] (show_stack) from [<c07e719c>] (dump_stack+0x68/0xb8)
[ 14.073641] [<c07e719c>] (dump_stack) from [<c0223ce4>] (warn_slowpath_common+0x78/0xb0)
[ 14.080671] [<c0223ce4>] (warn_slowpath_common) from [<c0223de0>] (warn_slowpath_fmt+0x3c/0x64)
[ 14.088918] [<c0223de0>] (warn_slowpath_fmt) from [<c0241644>] (notifier_call_chain+0xb4/0xc8)
[ 14.097337] [<c0241644>] (notifier_call_chain) from [<c0241674>] (raw_notifier_call_chain+0x18/0x20)
[ 14.106017] [<c0241674>] (raw_notifier_call_chain) from [<c069945c>] (extcon_update_state+0x2d4/0x31
8)
[ 14.115305] [<c069945c>] (extcon_update_state) from [<c0699bf8>] (usb_extcon_detect_cable+0x58/0x90)
[ 14.124424] [<c0699bf8>] (usb_extcon_detect_cable) from [<c023acb8>] (process_one_work+0x12c/0x458)
[ 14.133707] [<c023acb8>] (process_one_work) from [<c023b114>] (worker_thread+0x130/0x52c)
[ 14.142471] [<c023b114>] (worker_thread) from [<c02406d8>] (kthread+0xf0/0x114)
[ 14.150809] [<c02406d8>] (kthread) from [<c0210308>] (ret_from_fork+0x14/0x2c)
[ 14.157917] ---[ end trace e82e20fd14b64345 ]---
[ 14.165285] msm_otg f9a55000.usb-phy: OTG_STATE_UNDEFINED state
[ 14.169990] msm_otg f9a55000.usb-phy: OTG_STATE_B_IDLE state
[ 14.175658] msm_otg f9a55000.usb-phy: OTG runtime idle
[ 14.184296] mdev (108) used greatest stack depth: 6064 bytes left
[ 15.175257] msm_otg f9a55000.usb-phy: OTG runtime suspend
[ 15.175313] msm_otg f9a55000.usb-phy: USB in low power mode
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/