Skip to content

Commit 6040b24

Browse files
outman119gregkh
authored andcommitted
spi: fsl-qspi: Use reinit_completion() for repeated operations
[ Upstream commit 981b080 ] The driver currently calls init_completion() during every spi_mem_op. Tchnically it may work, but it's not the recommended pattern. According to the kernel documentation: Calling init_completion() on the same completion object twice is most likely a bug as it re-initializes the queue to an empty queue and enqueued tasks could get "lost" - use reinit_completion() in that case, but be aware of other races. So moves the initial initialization to probe function and uses reinit_completion() for subsequent operations. Fixes: 84d0431 ("spi: Add a driver for the Freescale/NXP QuadSPI controller") Signed-off-by: Felix Gu <ustc.gu@gmail.com> Reviewed-by: Haibo Chen <haibo.chen@nxp.com> Link: https://patch.msgid.link/20260304-spi-nxp-v2-3-cd7d7726a27e@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent dc97ec8 commit 6040b24

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

drivers/spi/spi-fsl-qspi.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ static int fsl_qspi_do_op(struct fsl_qspi *q, const struct spi_mem_op *op)
606606
void __iomem *base = q->iobase;
607607
int err = 0;
608608

609-
init_completion(&q->c);
609+
reinit_completion(&q->c);
610610

611611
/*
612612
* Always start the sequence at the same index since we update
@@ -924,6 +924,7 @@ static int fsl_qspi_probe(struct platform_device *pdev)
924924
if (ret < 0)
925925
goto err_disable_clk;
926926

927+
init_completion(&q->c);
927928
ret = devm_request_irq(dev, ret,
928929
fsl_qspi_irq_handler, 0, pdev->name, q);
929930
if (ret) {

0 commit comments

Comments
 (0)