Merge "mhi: core: block fast suspends on controller device bus vote"

This commit is contained in:
qctecmdr
2020-05-28 21:33:48 -07:00
committed by Gerrit - the friendly Code Review server
2 changed files with 6 additions and 7 deletions

View File

@@ -1478,13 +1478,10 @@ int mhi_process_bw_scale_ev_ring(struct mhi_controller *mhi_cntrl,
read_unlock_bh(&mhi_cntrl->pm_lock);
spin_unlock_bh(&mhi_event->lock);
atomic_inc(&mhi_cntrl->pending_pkts);
ret = mhi_device_get_sync(mhi_cntrl->mhi_dev,
MHI_VOTE_DEVICE | MHI_VOTE_BUS);
if (ret) {
atomic_dec(&mhi_cntrl->pending_pkts);
if (ret)
goto exit_bw_scale_process;
}
mutex_lock(&mhi_cntrl->pm_mutex);
@@ -1502,7 +1499,6 @@ int mhi_process_bw_scale_ev_ring(struct mhi_controller *mhi_cntrl,
read_unlock_bh(&mhi_cntrl->pm_lock);
mhi_device_put(mhi_cntrl->mhi_dev, MHI_VOTE_DEVICE | MHI_VOTE_BUS);
atomic_dec(&mhi_cntrl->pending_pkts);
mutex_unlock(&mhi_cntrl->pm_mutex);

View File

@@ -1241,6 +1241,7 @@ int mhi_pm_fast_suspend(struct mhi_controller *mhi_cntrl, bool notify_client)
int ret;
enum MHI_PM_STATE new_state;
struct mhi_chan *itr, *tmp;
struct mhi_device *mhi_dev = mhi_cntrl->mhi_dev;
if (mhi_cntrl->pm_state == MHI_PM_DISABLE)
return -EINVAL;
@@ -1249,7 +1250,8 @@ int mhi_pm_fast_suspend(struct mhi_controller *mhi_cntrl, bool notify_client)
return -EIO;
/* do a quick check to see if any pending votes to keep us busy */
if (atomic_read(&mhi_cntrl->pending_pkts)) {
if (atomic_read(&mhi_cntrl->pending_pkts) ||
atomic_read(&mhi_dev->bus_vote)) {
MHI_VERB("Busy, aborting M3\n");
return -EBUSY;
}
@@ -1268,7 +1270,8 @@ int mhi_pm_fast_suspend(struct mhi_controller *mhi_cntrl, bool notify_client)
* Check the votes once more to see if we should abort
* suspend.
*/
if (atomic_read(&mhi_cntrl->pending_pkts)) {
if (atomic_read(&mhi_cntrl->pending_pkts) ||
atomic_read(&mhi_dev->bus_vote)) {
MHI_VERB("Busy, aborting M3\n");
ret = -EBUSY;
goto error_suspend;