bus: mhi: core: Prevent sending multiple RDDM entry callbacks
authorBhaumik Bhatt <bbhatt@codeaurora.org>
Mon, 9 Nov 2020 20:47:24 +0000 (12:47 -0800)
committerManivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Wed, 18 Nov 2020 09:50:34 +0000 (15:20 +0530)
commit0c76b3fa580da8f65333b8774205f0a72ffe844c
tree6ea6141f1105b6f8f3be068c30f37df851b6a228
parent3fb81a4d5f2f55b1596cb5cffca98c97ca43f07a
bus: mhi: core: Prevent sending multiple RDDM entry callbacks

If an mhi_power_down() is initiated after the device has entered
RDDM and a status callback was provided for it, it is possible
that another BHI interrupt fires while waiting for the MHI
RESET to be cleared. If that happens, MHI host would have moved
a "disabled" execution environment and the check to allow sending
an RDDM status callback will pass when it is should not. Add a
check to see if MHI is in an active state before proceeding.

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/main.c