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

Commit 0f798a65 authored by Chris Lew's avatar Chris Lew
Browse files

rpmsg: glink: spi: Cancel intent work in remove



The remote may not get a chance to send a close command during reset.
Cancel any intent work in transport remove to fully cleanup the channel
resources before freeing the channel structure.

Change-Id: I895f5bcc26bd1727e8a2277d2965597dae5a425b
Signed-off-by: default avatarChris Lew <clew@codeaurora.org>
parent 8cf25cc1
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -2466,6 +2466,15 @@ static void glink_spi_remove(struct glink_spi *glink)
	if (ret)
		dev_warn(&glink->dev, "Can't remove GLINK devices: %d\n", ret);

	spin_lock_irqsave(&glink->idr_lock, flags);
	idr_for_each_entry(&glink->lcids, channel, cid) {
		spin_unlock_irqrestore(&glink->idr_lock, flags);
		/* cancel_work_sync may sleep */
		cancel_work_sync(&channel->intent_work);
		spin_lock_irqsave(&glink->idr_lock, flags);
	}
	spin_unlock_irqrestore(&glink->idr_lock, flags);

	spin_lock_irqsave(&glink->idr_lock, flags);
	/* Release any defunct local channels, waiting for close-ack */
	idr_for_each_entry(&glink->lcids, channel, cid) {