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

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

Merge "mhi: core: send critical channels early completion events"

parents daefa85d 67bdc37a
Loading
Loading
Loading
Loading
+16 −0
Original line number Original line Diff line number Diff line
@@ -722,6 +722,8 @@ int mhi_early_notify_device(struct device *dev, void *data)
{
{
	struct mhi_device *mhi_dev;
	struct mhi_device *mhi_dev;
	struct mhi_controller *mhi_cntrl;
	struct mhi_controller *mhi_cntrl;
	struct mhi_chan *mhi_chan;
	int dir;


	if (dev->bus != &mhi_bus_type)
	if (dev->bus != &mhi_bus_type)
		return 0;
		return 0;
@@ -737,6 +739,20 @@ int mhi_early_notify_device(struct device *dev, void *data)


	mhi_notify(mhi_dev, MHI_CB_FATAL_ERROR);
	mhi_notify(mhi_dev, MHI_CB_FATAL_ERROR);


	/* send completions to any critical channels waiting on them */
	for (dir = 0; dir < 2; dir++) {
		mhi_chan = dir ? mhi_dev->ul_chan : mhi_dev->dl_chan;

		if (!mhi_chan)
			continue;

		/* wake all threads waiting for completion */
		write_lock_irq(&mhi_chan->lock);
		mhi_chan->ccs = MHI_EV_CC_INVALID;
		complete_all(&mhi_chan->completion);
		write_unlock_irq(&mhi_chan->lock);
	}

	return 0;
	return 0;
}
}