Skip to content

Commit b3fe1ea

Browse files
outman119gregkh
authored andcommitted
spi: nxp-fspi: Use reinit_completion() for repeated operations
[ Upstream commit 68c8c93 ] 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: a5356ae ("spi: spi-mem: Add driver for NXP FlexSPI 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-2-cd7d7726a27e@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 76c35d0 commit b3fe1ea

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

drivers/spi/spi-nxp-fspi.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -907,7 +907,7 @@ static int nxp_fspi_do_op(struct nxp_fspi *f, const struct spi_mem_op *op)
907907
reg = reg | FSPI_IPRXFCR_CLR;
908908
fspi_writel(f, reg, base + FSPI_IPRXFCR);
909909

910-
init_completion(&f->c);
910+
reinit_completion(&f->c);
911911

912912
fspi_writel(f, op->addr.val, base + FSPI_IPCR0);
913913
/*
@@ -1267,6 +1267,7 @@ static int nxp_fspi_probe(struct platform_device *pdev)
12671267
if (ret < 0)
12681268
return dev_err_probe(dev, ret, "Failed to disable clock");
12691269

1270+
init_completion(&f->c);
12701271
ret = devm_request_irq(dev, irq,
12711272
nxp_fspi_irq_handler, 0, pdev->name, f);
12721273
if (ret)

0 commit comments

Comments
 (0)