...
This seems odd,
I don't understand why pm_runtime_set_suspended() would call pm_runtime_put_sync()?
I thought pm_runtime_set_suspended() is used to let pm core know the hardware is suspended,
and inform the parent of this, possibly allowing parent to runtime suspend.
Not sure if it's needed in the remove function.
It makes sense to allow the parent to suspend, but xhci isn't really suspended.
Yes is stopped, but we can't resume our way back to a active state.
Could it be that the runtime suspend call you are seeing is because we are removing all child devices,
disconnecting and freeing everything, including roothubs and hcd's.
Maybe runtime pm should be disabled a bit earlier.
Currently probe and remove looks like:
xhci_plat_probe()
pm_runtime_set_active()
pm_runtime_enable()
pm_runtime_get_noresume()
...
pm_runtime_put_noidle()
pm_runtime_forbid()
xhci_plat_remove()
<remove and put both hcd's>
pm_runtime_set_suspended()
pm_runtime_disable()
Would it make sense to change xhci_plat_remove() to
xhci_plat_remove()
pm_runtime_disable()
<remove and put both hcd's>
pm_runtime_set_suspended()
or possibly wrapping the remove in a runtime get/put:
xhci_plat_remove()
pm_runtime_get_noresume()
pm_runtime_disable()
> <remove and put both hcd's>
> pm_runtime_set_suspended()
> pm_runtime_put_noidle()
I think it's better to keep runtime active during driver removal, how about this:
pm_runtime_get_sync() <remove and put both hcd's> pm_runtime_disable() pm_runtime_put_noidle() pm_runtime_set_suspended()
thanks Li Jun
-Mathias