Re: [PATCH] spi: rockchip: Disable local irq when pio write out of interrupt service

From: Mark Brown
Date: Mon Jun 13 2022 - 13:22:55 EST


On Mon, Jun 13, 2022 at 05:27:44PM +0800, Jon Lin wrote:
> Avoid interrupt come and interrupt the pio_writer.
>
> + spin_lock_irqsave(&rs->lock, flags);
> + tx_free = rs->fifo_len - readl_relaxed(rs->regs + ROCKCHIP_SPI_TXFLR);
> + words = min(rs->tx_left, tx_free);
> rs->tx_left -= words;
> for (; words; words--) {
> u32 txw;
> @@ -308,6 +313,7 @@ static void rockchip_spi_pio_writer(struct rockchip_spi *rs)
> writel_relaxed(txw, rs->regs + ROCKCHIP_SPI_TXDR);
> rs->tx += rs->n_bytes;
> }
> + spin_unlock_irqrestore(&rs->lock, flags);

So this is effectively just disabling interrupts during PIO, there's no
other users of the lock which is rather heavyweight. What's the actual
issue here? We should also have something saying what's going on in the
code since right now the lock just looks redundant.

Attachment: signature.asc
Description: PGP signature