diff --git a/drivers/platform/msm/mhi_dev/mhi.c b/drivers/platform/msm/mhi_dev/mhi.c index eed0707ac886..99a7cca705ad 100644 --- a/drivers/platform/msm/mhi_dev/mhi.c +++ b/drivers/platform/msm/mhi_dev/mhi.c @@ -380,7 +380,7 @@ static void mhi_dev_event_msi_cb(void *req) if (ch->evt_buf_wp == ch->evt_buf_size) ch->evt_buf_wp = 0; /* Return the event req to the list */ - spin_lock_irqsave(&mhi->lock, flags); + mutex_lock(&ch->ch_lock); if (ch->curr_ereq == NULL) ch->curr_ereq = ereq; else { @@ -388,7 +388,7 @@ static void mhi_dev_event_msi_cb(void *req) ereq->is_stale = false; list_add_tail(&ereq->list, &ch->event_req_buffers); } - spin_unlock_irqrestore(&mhi->lock, flags); + mutex_unlock(&ch->ch_lock); } static void msi_trigger_completion_cb(void *data) @@ -646,15 +646,12 @@ static int mhi_dev_flush_transfer_completion_events(struct mhi_dev *mhi, break; } - spin_lock_irqsave(&mhi->lock, flags); if (list_empty(&ch->flush_event_req_buffers)) { - spin_unlock_irqrestore(&mhi->lock, flags); break; } flush_ereq = container_of(ch->flush_event_req_buffers.next, struct event_req, list); list_del_init(&flush_ereq->list); - spin_unlock_irqrestore(&mhi->lock, flags); if (ch->flush_req_cnt++ >= U32_MAX) ch->flush_req_cnt = 0; @@ -792,7 +789,6 @@ static int mhi_dev_queue_transfer_completion(struct mhi_req *mreq, bool *flush) ch->curr_ereq->context = ch; /* Move current event req to flush list*/ - spin_lock_irqsave(&mhi_ctx->lock, flags); list_add_tail(&ch->curr_ereq->list, &ch->flush_event_req_buffers); @@ -809,7 +805,6 @@ static int mhi_dev_queue_transfer_completion(struct mhi_req *mreq, bool *flush) "evt req buffers empty\n"); ch->curr_ereq = NULL; } - spin_unlock_irqrestore(&mhi_ctx->lock, flags); } return 0; } @@ -1872,14 +1867,12 @@ static void mhi_dev_process_reset_cmd(struct mhi_dev *mhi, int ch_id) * reset. Otherwise, those stale events may get flushed along with a * valid event in the next flush operation. */ - spin_lock_irqsave(&mhi_ctx->lock, flags); if (!list_empty(&ch->flush_event_req_buffers)) { list_for_each_entry_safe(itr, tmp, &ch->flush_event_req_buffers, list) { list_del(&itr->list); list_add_tail(&itr->list, &ch->event_req_buffers); } } - spin_unlock_irqrestore(&mhi_ctx->lock, flags); /* hard stop and set the channel to stop */ mhi->ch_ctx_cache[ch_id].ch_state =