]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
bus: mhi: core: Skip device wake in error or shutdown states
authorBhaumik Bhatt <bbhatt@codeaurora.org>
Mon, 9 Nov 2020 20:47:22 +0000 (12:47 -0800)
committerManivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Wed, 18 Nov 2020 09:50:34 +0000 (15:20 +0530)
MHI client drivers can request a device wake even if the device
may be in an error state or undergoing a shutdown. To prevent
unnecessary device wake processing, check for the device state
and bail out early so that the clients are made aware of the
device state sooner.

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

index 805b6fa748f01d96e0bce090415df1ed193528f6..029919647002051182867e4c960958d7f05805fb 100644 (file)
@@ -827,6 +827,10 @@ int __mhi_device_get_sync(struct mhi_controller *mhi_cntrl)
 
        /* Wake up the device */
        read_lock_bh(&mhi_cntrl->pm_lock);
+       if (MHI_PM_IN_ERROR_STATE(mhi_cntrl->pm_state)) {
+               read_unlock_bh(&mhi_cntrl->pm_lock);
+               return -EIO;
+       }
        mhi_cntrl->wake_get(mhi_cntrl, true);
        if (MHI_PM_IN_SUSPEND_STATE(mhi_cntrl->pm_state))
                mhi_trigger_resume(mhi_cntrl);