* [PATCH] mtd: rawnand: tegra: drain the IRQ before disabling the clock
@ 2026-11-08 21:05 James Hilliard
2026-11-26 18:01 ` Miquel Raynal
0 siblings, 1 reply; 2+ messages in thread
From: James Hilliard @ 2026-11-08 21:05 UTC (permalink / raw)
To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
Stefan Agner, Lucas Stach, Thierry Reding, Jonathan Hunter,
Dmitry Osipenko, Boris Brezillon
Cc: linux-mtd, linux-kernel, linux-tegra, stable, James Hilliard
The managed IRQ handler remains installed until devres cleanup, after
removal or a late probe failure has suspended the controller and disabled
its clock. The handler can still be accessing registers at that point:
it signals the command and DMA completions before its final register
accesses, so waiting for a NAND operation does not drain the IRQ handler.
Mask controller interrupts and release the managed IRQ before dropping
the runtime PM reference. Apply the same ordering when chip initialization
fails after the IRQ has been requested.
Fixes: d7d9f8ec77fe ("mtd: rawnand: add NVIDIA Tegra NAND Flash controller driver")
Cc: stable@vger.kernel.org
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
---
drivers/mtd/nand/raw/tegra_nand.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/mtd/nand/raw/tegra_nand.c b/drivers/mtd/nand/raw/tegra_nand.c
index 7f9eb5f042a7..1104d75b6cbe 100644
--- a/drivers/mtd/nand/raw/tegra_nand.c
+++ b/drivers/mtd/nand/raw/tegra_nand.c
@@ -1212,10 +1212,13 @@ static int tegra_nand_probe(struct platform_device *pdev)
err = tegra_nand_chips_init(ctrl->dev, ctrl);
if (err)
- goto err_put_pm;
+ goto err_free_irq;
return 0;
+err_free_irq:
+ writel_relaxed(0, ctrl->regs + IER);
+ devm_free_irq(ctrl->dev, ctrl->irq, ctrl);
err_put_pm:
pm_runtime_put_sync_suspend(ctrl->dev);
pm_runtime_force_suspend(ctrl->dev);
@@ -1234,6 +1237,9 @@ static void tegra_nand_remove(struct platform_device *pdev)
nand_cleanup(chip);
+ writel_relaxed(0, ctrl->regs + IER);
+ devm_free_irq(ctrl->dev, ctrl->irq, ctrl);
+
pm_runtime_put_sync_suspend(ctrl->dev);
pm_runtime_force_suspend(ctrl->dev);
}
---
base-commit: 30daaf3e7897b4a8d9b72e5b0c86dd6e2a4d7d85
change-id: 20261107-submit-tegra-nand-irq-teardown-v1-60f649303b8c
Best regards,
--
James Hilliard <james.hilliard1@gmail.com>
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] mtd: rawnand: tegra: drain the IRQ before disabling the clock
2026-11-08 21:05 [PATCH] mtd: rawnand: tegra: drain the IRQ before disabling the clock James Hilliard
@ 2026-11-26 18:01 ` Miquel Raynal
0 siblings, 0 replies; 2+ messages in thread
From: Miquel Raynal @ 2026-11-26 18:01 UTC (permalink / raw)
To: James Hilliard
Cc: Richard Weinberger, Vignesh Raghavendra, Stefan Agner,
Lucas Stach, Thierry Reding, Jonathan Hunter, Dmitry Osipenko,
Boris Brezillon, linux-mtd, linux-kernel, linux-tegra, stable
On 08/11/2026 at 14:05:55 -07, James Hilliard <james.hilliard1@gmail.com> wrote:
> The managed IRQ handler remains installed until devres cleanup, after
> removal or a late probe failure has suspended the controller and disabled
> its clock. The handler can still be accessing registers at that point:
> it signals the command and DMA completions before its final register
> accesses, so waiting for a NAND operation does not drain the IRQ handler.
>
> Mask controller interrupts and release the managed IRQ before dropping
> the runtime PM reference. Apply the same ordering when chip initialization
> fails after the IRQ has been requested.
Can we instead include power mangement in the devres logic? In general
when one need to manually devm_remove/freee/unregister(), it means there
is problem and the solution is incorrect.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-26 18:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-08 21:05 [PATCH] mtd: rawnand: tegra: drain the IRQ before disabling the clock James Hilliard
2026-11-26 18:01 ` Miquel Raynal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®