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

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

Merge "mhi: core: Avoid race condition mhi channel prepare and M0 event"

parents 0008d16b 020b270b
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -1051,7 +1051,16 @@ void mhi_deinit_chan_ctxt(struct mhi_controller *mhi_cntrl,
	vfree(buf_ring->base);

	buf_ring->base = tre_ring->base = NULL;
	tre_ring->ctxt_wp = NULL;
	chan_ctxt->rbase = 0;
	chan_ctxt->rlen = 0;
	chan_ctxt->rp = chan_ctxt->wp = chan_ctxt->rbase;
	tre_ring->rp = tre_ring->wp = tre_ring->base;
	buf_ring->rp = buf_ring->wp = buf_ring->base;

	/* Update to all cores */
	smp_wmb();

}

int mhi_init_chan_ctxt(struct mhi_controller *mhi_cntrl,
+2 −1
Original line number Diff line number Diff line
@@ -395,7 +395,8 @@ int mhi_pm_m0_transition(struct mhi_controller *mhi_cntrl)

		read_lock_irq(&mhi_chan->lock);
		/* only ring DB if ring is not empty */
		if (tre_ring->base && tre_ring->wp  != tre_ring->rp)
		if (tre_ring->base && tre_ring->wp  != tre_ring->rp &&
		    mhi_chan->ch_state == MHI_CH_STATE_ENABLED)
			mhi_ring_chan_db(mhi_cntrl, mhi_chan);
		read_unlock_irq(&mhi_chan->lock);
	}