Message ID | 1600480955-16827-4-git-send-email-bbhatt@codeaurora.org (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | Bug fixes and improvements for MHI power operations | expand |
On Fri, Sep 18, 2020 at 07:02:28PM -0700, Bhaumik Bhatt wrote: > MHI clients can request a device wake even if the device may be in an > error state or undergoing 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. > Please use the term "client drivers" everywhere. With that, Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Thanks, Mani > Signed-off-by: Bhaumik Bhatt <bbhatt@codeaurora.org> > --- > drivers/bus/mhi/core/pm.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/drivers/bus/mhi/core/pm.c b/drivers/bus/mhi/core/pm.c > index 9d4789d..1862960 100644 > --- a/drivers/bus/mhi/core/pm.c > +++ b/drivers/bus/mhi/core/pm.c > @@ -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); > -- > The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, > a Linux Foundation Collaborative Project >
diff --git a/drivers/bus/mhi/core/pm.c b/drivers/bus/mhi/core/pm.c index 9d4789d..1862960 100644 --- a/drivers/bus/mhi/core/pm.c +++ b/drivers/bus/mhi/core/pm.c @@ -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);
MHI clients can request a device wake even if the device may be in an error state or undergoing 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> --- drivers/bus/mhi/core/pm.c | 4 ++++ 1 file changed, 4 insertions(+)