Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b606cc61 authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: ipa: Unlock mutex before voting PCIe clocks"

parents fb4213bf f03f71fc
Loading
Loading
Loading
Loading
+13 −3
Original line number Original line Diff line number Diff line
@@ -613,21 +613,31 @@ int imp_handle_vote_req(bool vote)
		mutex_unlock(&imp_ctx->mutex);
		mutex_unlock(&imp_ctx->mutex);
		return -EPERM;
		return -EPERM;
	}
	}
	mutex_unlock(&imp_ctx->mutex);


	/*
	 * Unlock the mutex before calling into mhi for clock vote
	 * to avoid deadlock on imp mutex.
	 * Calls into mhi are synchronous and imp callbacks are
	 * executed from mhi context.
	 */
	if (vote) {
	if (vote) {
		ret = mhi_device_get_sync(imp_ctx->md.mhi_dev);
		ret = mhi_device_get_sync(imp_ctx->md.mhi_dev);
		if (ret) {
		if (ret) {
			IMP_ERR("mhi_sync_get failed %d\n", ret);
			IMP_ERR("mhi_sync_get failed %d\n", ret);
			mutex_unlock(&imp_ctx->mutex);
			return ret;
			return ret;
		}
		}
		imp_ctx->lpm_disabled = true;
	} else {
	} else {
		mhi_device_put(imp_ctx->md.mhi_dev);
		mhi_device_put(imp_ctx->md.mhi_dev);
		imp_ctx->lpm_disabled = false;
	}
	}


	mutex_lock(&imp_ctx->mutex);
	if (vote)
		imp_ctx->lpm_disabled = true;
	else
		imp_ctx->lpm_disabled = false;
	mutex_unlock(&imp_ctx->mutex);
	mutex_unlock(&imp_ctx->mutex);

	return 0;
	return 0;
}
}