Skip to contentSkip to conversation

spi: *: Call the dedicated transfer completion function.

PATCH In review Vincent Pelletier 2 participants 6 messages Jan 7, 2021 – Jan 14, 2021

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

Hello,

I started this fix on bcm2835.c and, because of its simplicity, thought I should check other controllers as well.
This patch set should fix all occurrences, as of v5.11-rc2, of an SPI controller driver calling
complete(&...->xfer_completion);
when it could call
spi_finalize_current_transfer(...);
as requested in Documentation/spi/spi-summary.rst .

While I did build all modified files, and these should be trivial to check for correctness, I have not exercised all codepaths. I have exercised spi-bcm2835 IRQ and DMA tx, but I am still hunting for another issue which causes completion timeouts at spi/spi.c level which seem to affect spi-bcm2835 dma transfers (both before and after this patch set).

Regards,
Vincent Pelletier

_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip

#1 lore raw

PATCH 1/3 spi: bcm2835: Call the dedicated transfer completion function.

spi_finalize_current_transfer currently only calls "complete", so no functional change is expected.

---
 drivers/spi/spi-bcm2835.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/spi/spi-bcm2835.c +3 -3
index 197485f2c2b2..dbadbc4638e9 100644
@@ -386,7 +386,7 @@ static irqreturn_t bcm2835_spi_interrupt(int irq, void *dev_id)
 		/* Transfer complete - reset SPI HW */
 		bcm2835_spi_reset_hw(bs);
 		/* wake up the framework */
-		complete(&bs->ctlr->xfer_completion);
+		spi_finalize_current_transfer(bs->ctlr);
 	}
 
 	return IRQ_HANDLED;
@@ -608,7 +608,7 @@ static void bcm2835_spi_dma_rx_done(void *data)
 	bcm2835_spi_reset_hw(bs);
 
 	/* and mark as completed */;
-	complete(&ctlr->xfer_completion);
+	spi_finalize_current_transfer(ctlr);
 }
 
 /**
@@ -640,7 +640,7 @@ static void bcm2835_spi_dma_tx_done(void *data)
 
 	bcm2835_spi_undo_prologue(bs);
 	bcm2835_spi_reset_hw(bs);
-	complete(&ctlr->xfer_completion);
+	spi_finalize_current_transfer(ctlr);
 }
 
 /**
Signature · 7 lines
2.30.0


_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
#2 lore raw

PATCH 2/3 spi: bcm2835aux: Call the dedicated transfer completion function.

spi_finalize_current_transfer currently only calls "complete", so no functional change is expected.

---
 drivers/spi/spi-bcm2835aux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-bcm2835aux.c +1 -1
index 1a26865c42f8..75589ac6e95f 100644
@@ -254,7 +254,7 @@ static irqreturn_t bcm2835aux_spi_interrupt(int irq, void *dev_id)
 	/* and if rx_len is 0 then disable interrupts and wake up completion */
 	if (!bs->rx_len) {
 		bcm2835aux_wr(bs, BCM2835_AUX_SPI_CNTL1, bs->cntl[1]);
-		complete(&master->xfer_completion);
+		spi_finalize_current_transfer(master);
 	}
 
 	return IRQ_HANDLED;
Signature · 7 lines
2.30.0


_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
maintainer
#3 lore raw

Re: [2/3] spi: bcm2835aux: Call the dedicated transfer completion function.

Quoted 2 lines · Vincent Pelletier

spi_finalize_current_transfer currently only calls "complete", so no functional change is expected.

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next

Thanks!

[2/3] spi: bcm2835aux: Call the dedicated transfer completion function.

      commit: 7dfa69af2b5a57fcd48c96752818c1fa9925a8de

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark

_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip

#4 lore raw

PATCH 3/3 spi: rockchip: Call the dedicated transfer completion function.

In reply to Vincent Pelletier

spi_finalize_current_transfer currently only calls "complete", so no functional change is expected.

---
 drivers/spi/spi-rockchip.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-rockchip.c +1 -1
index 09d8e92400eb..936ef54e0903 100644
@@ -566,7 +566,7 @@ static int rockchip_spi_slave_abort(struct spi_controller *ctlr)
 	struct rockchip_spi *rs = spi_controller_get_devdata(ctlr);
 
 	rs->slave_abort = true;
-	complete(&ctlr->xfer_completion);
+	spi_finalize_current_transfer(ctlr);
 
 	return 0;
 }
Signature · 7 lines
2.30.0


_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
maintainer
#5 lore raw

Re: [1/3] spi: bcm2835: Call the dedicated transfer completion function.

In reply to Vincent Pelletier
Quoted 2 lines · Vincent Pelletier

spi_finalize_current_transfer currently only calls "complete", so no functional change is expected.

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next

Thanks!

[1/3] spi: bcm2835: Call the dedicated transfer completion function.

      commit: ccae0b408ba08203d5f50a301b105284374217a5
[3/3] spi: rockchip: Call the dedicated transfer completion function.
      commit: 6bd2c867cd6e03d88dfa21f9fc8c610159061152

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark

_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip