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

Commit dcf44293 authored by Chris Lew's avatar Chris Lew
Browse files

rpmsg: glink: spi: Use irq safe spinlocks



The glink spi command handler is done from the wcd spi component
context which is not necessarily a true interrupt. Use the irqsave and
irqrestore APIs to avoid any spinlock issues.

Change-Id: Id1857d44f8bf2da4550ece30284dd6890851e686
Signed-off-by: default avatarChris Lew <clew@codeaurora.org>
parent 83e8c3e9
Loading
Loading
Loading
Loading
+4 −4
Original line number Original line Diff line number Diff line
@@ -1955,7 +1955,7 @@ static int glink_spi_rx_data(struct glink_spi *glink,


	/* Handle message when no fragments remain to be received */
	/* Handle message when no fragments remain to be received */
	if (!left_size) {
	if (!left_size) {
		spin_lock(&channel->recv_lock);
		spin_lock_irqsave(&channel->recv_lock, flags);
		if (channel->ept.cb) {
		if (channel->ept.cb) {
			channel->ept.cb(channel->ept.rpdev,
			channel->ept.cb(channel->ept.rpdev,
					intent->data,
					intent->data,
@@ -1963,7 +1963,7 @@ static int glink_spi_rx_data(struct glink_spi *glink,
					channel->ept.priv,
					channel->ept.priv,
					RPMSG_ADDR_ANY);
					RPMSG_ADDR_ANY);
		}
		}
		spin_unlock(&channel->recv_lock);
		spin_unlock_irqrestore(&channel->recv_lock, flags);


		intent->offset = 0;
		intent->offset = 0;
		channel->buf = NULL;
		channel->buf = NULL;
@@ -2021,7 +2021,7 @@ static int glink_spi_rx_short_data(struct glink_spi *glink,


	/* Handle message when no fragments remain to be received */
	/* Handle message when no fragments remain to be received */
	if (!left_size) {
	if (!left_size) {
		spin_lock(&channel->recv_lock);
		spin_lock_irqsave(&channel->recv_lock, flags);
		if (channel->ept.cb) {
		if (channel->ept.cb) {
			channel->ept.cb(channel->ept.rpdev,
			channel->ept.cb(channel->ept.rpdev,
					intent->data,
					intent->data,
@@ -2029,7 +2029,7 @@ static int glink_spi_rx_short_data(struct glink_spi *glink,
					channel->ept.priv,
					channel->ept.priv,
					RPMSG_ADDR_ANY);
					RPMSG_ADDR_ANY);
		}
		}
		spin_unlock(&channel->recv_lock);
		spin_unlock_irqrestore(&channel->recv_lock, flags);


		intent->offset = 0;
		intent->offset = 0;
		channel->buf = NULL;
		channel->buf = NULL;