Skip to content

Commit

Permalink
bus: mhi: core: Abort suspends due to outgoing pending packets
Browse files Browse the repository at this point in the history
[ Upstream commit 515847c ]

Add the missing check to abort suspends if a client driver has pending
outgoing packets to send to the device. This allows better utilization
of the MHI bus wherein clients on the host are not left waiting for
longer suspend or resume cycles to finish for data transfers.

Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Bhaumik Bhatt <bbhatt@codeaurora.org>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Link: https://lore.kernel.org/r/20200929175218.8178-4-manivannan.sadhasivam@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Bhaumik Bhatt authored and gregkh committed Nov 5, 2020
1 parent 5e2e8f3 commit 5a44940
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/bus/mhi/core/pm.c
Expand Up @@ -686,7 +686,8 @@ int mhi_pm_suspend(struct mhi_controller *mhi_cntrl)
return -EIO;

/* Return busy if there are any pending resources */
if (atomic_read(&mhi_cntrl->dev_wake))
if (atomic_read(&mhi_cntrl->dev_wake) ||
atomic_read(&mhi_cntrl->pending_pkts))
return -EBUSY;

/* Take MHI out of M2 state */
Expand All @@ -712,7 +713,8 @@ int mhi_pm_suspend(struct mhi_controller *mhi_cntrl)

write_lock_irq(&mhi_cntrl->pm_lock);

if (atomic_read(&mhi_cntrl->dev_wake)) {
if (atomic_read(&mhi_cntrl->dev_wake) ||
atomic_read(&mhi_cntrl->pending_pkts)) {
write_unlock_irq(&mhi_cntrl->pm_lock);
return -EBUSY;
}
Expand Down

0 comments on commit 5a44940

Please sign in to comment.