bus: mhi: core: Mark and maintain device states early on after power down
authorBhaumik Bhatt <bbhatt@codeaurora.org>
Mon, 9 Nov 2020 20:47:30 +0000 (12:47 -0800)
committerManivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Wed, 18 Nov 2020 09:50:34 +0000 (15:20 +0530)
commita03c7a86e12721da9f6bb509dddda19fd9ae8c6c
treea35d6003804a3dd33606259d719173cff6affd89
parent556bbb442bbb44f429dbaa9f8b48e0b4cda6e088
bus: mhi: core: Mark and maintain device states early on after power down

mhi_power_down() does not ensure that the PM state is moved to an
inaccessible state soon enough as the system can encounter
scheduling delays till mhi_pm_disable_transition() gets called.
Additionally, if an MHI controller decides that the device is now
inaccessible and issues a power down, the register inaccessible
state is not maintained by moving from MHI_PM_LD_ERR_FATAL_DETECT
to MHI_PM_SHUTDOWN_PROCESS. This can result in bus errors if a
client driver attempted to read registers when powering down.
Close these gaps and avoid any race conditions to prevent such
activity.

Signed-off-by: Bhaumik Bhatt <bbhatt@codeaurora.org>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
drivers/bus/mhi/core/pm.c