diff mbox series

[v3,2/7] bus: mhi: core: Allow channel to be disabled from stopped state

Message ID 1606952438-15321-3-git-send-email-bbhatt@codeaurora.org (mailing list archive)
State Superseded
Headers show
Series Updates to MHI channel handling | expand

Commit Message

Bhaumik Bhatt Dec. 2, 2020, 11:40 p.m. UTC
If a channel was explicitly stopped but not reset, allow it to
move to a disabled state so the channel context can be cleaned
up. As the channel remained in a stopped state, its context was
not reset and cleared, which needs to be done if a client driver
module is unloaded or a device crash occurs.

Signed-off-by: Bhaumik Bhatt <bbhatt@codeaurora.org>
---
 drivers/bus/mhi/core/init.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Hemant Kumar Dec. 3, 2020, 12:17 a.m. UTC | #1
On 12/2/20 3:40 PM, Bhaumik Bhatt wrote:
> If a channel was explicitly stopped but not reset, allow it to
> move to a disabled state so the channel context can be cleaned
> up. As the channel remained in a stopped state, its context was
> not reset and cleared, which needs to be done if a client driver
> module is unloaded or a device crash occurs.
> 
> Signed-off-by: Bhaumik Bhatt <bbhatt@codeaurora.org>
> ---

Reviewed-by: Hemant Kumar <hemantk@codeaurora.org>
diff mbox series

Patch

diff --git a/drivers/bus/mhi/core/init.c b/drivers/bus/mhi/core/init.c
index f0697f4..e7b9a90 100644
--- a/drivers/bus/mhi/core/init.c
+++ b/drivers/bus/mhi/core/init.c
@@ -1288,7 +1288,8 @@  static int mhi_driver_remove(struct device *dev)
 
 		mutex_lock(&mhi_chan->mutex);
 
-		if (ch_state[dir] == MHI_CH_STATE_ENABLED &&
+		if ((ch_state[dir] == MHI_CH_STATE_ENABLED ||
+		    ch_state[dir] == MHI_CH_STATE_STOP) &&
 		    !mhi_chan->offload_ch)
 			mhi_deinit_chan_ctxt(mhi_cntrl, mhi_chan);