diff options
| author | Felix Gu <ustc.gu@gmail.com> | 2026-03-04 15:47:21 +0300 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2026-03-09 23:12:06 +0300 |
| commit | 981b080a79724738882b0af1c5bb7ade30d94f24 (patch) | |
| tree | 614284b9eefe17fa38f6b18396df42fb17cd61a3 | |
| parent | 68c8c93fdb0de7e528dc3dfb1d17eb0f652259b8 (diff) | |
| download | linux-981b080a79724738882b0af1c5bb7ade30d94f24.tar.xz | |
spi: fsl-qspi: Use reinit_completion() for repeated operations
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: 84d043185dbe ("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>
| -rw-r--r-- | drivers/spi/spi-fsl-qspi.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/spi/spi-fsl-qspi.c b/drivers/spi/spi-fsl-qspi.c index a223b4bc6e63..57358851029b 100644 --- a/drivers/spi/spi-fsl-qspi.c +++ b/drivers/spi/spi-fsl-qspi.c @@ -633,7 +633,7 @@ static int fsl_qspi_do_op(struct fsl_qspi *q, const struct spi_mem_op *op) void __iomem *base = q->iobase; int err = 0; - init_completion(&q->c); + reinit_completion(&q->c); /* * Always start the sequence at the same index since we update @@ -965,6 +965,7 @@ static int fsl_qspi_probe(struct platform_device *pdev) if (ret < 0) return ret; + init_completion(&q->c); ret = devm_request_irq(dev, ret, fsl_qspi_irq_handler, 0, pdev->name, q); if (ret) { |
