From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: James Hilliard <james.hilliard1@gmail.com>
Cc: Miquel Raynal <miquel.raynal@bootlin.com>,
Richard Weinberger <richard@nod.at>,
Vignesh Raghavendra <vigneshr@ti.com>,
Clark Williams <clrkwllms@kernel.org>,
Steven Rostedt <rostedt@goodmis.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Chen-Yu Tsai <wens@kernel.org>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
Samuel Holland <samuel@sholland.org>,
Maxime Ripard <mripard@kernel.org>,
Richard Genoud <richard.genoud@bootlin.com>,
Boris Brezillon <bbrezillon@kernel.org>,
Masahiro Yamada <yamada.masahiro@socionext.com>,
Brian Norris <computersforpeace@gmail.com>,
linux-mtd@lists.infradead.org,
linux-arm-kernel@lists.infradead.org,
linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org,
linux-rt-devel@lists.linux.dev, devicetree@vger.kernel.org
Subject: Re: [PATCH v7 04/16] mtd: rawnand: sunxi: drain interrupts before reusing the completion
Date: Thu, 15 Oct 2026 09:19:43 +0200 [thread overview]
Message-ID: <20261015071943.7OihPadq@linutronix.de> (raw)
In-Reply-To: <20261014-submit-sunxi-nand-vendor-oob-layout-v1-v7-4-5d3fc6ad2da1@gmail.com>
On 2026-10-14 19:33:51 [-0600], James Hilliard wrote:
> --- a/drivers/mtd/nand/raw/sunxi_nand.c
> +++ b/drivers/mtd/nand/raw/sunxi_nand.c
> @@ -454,16 +457,19 @@ static int sunxi_nfc_wait_events(struct sunxi_nfc *nfc, u32 events,
> timeout_ms = NFC_DEFAULT_TIMEOUT_MS;
>
> if (!use_polling) {
> - init_completion(&nfc->complete);
> + reinit_completion(&nfc->complete);
>
> writel(events, nfc->regs + NFC_REG_INT);
>
> ret = wait_for_completion_timeout(&nfc->complete,
> msecs_to_jiffies(timeout_ms));
> - if (!ret)
> + if (!ret) {
> + /* Drain the handler before it can restore an old IRQ mask. */
> + disable_irq(nfc->irq);
> ret = -ETIMEDOUT;
> - else
> + } else {
> ret = 0;
> + }
>
> writel(0, nfc->regs + NFC_REG_INT);
> } else {
> @@ -476,6 +482,12 @@ static int sunxi_nfc_wait_events(struct sunxi_nfc *nfc, u32 events,
>
> writel(events & NFC_INT_MASK, nfc->regs + NFC_REG_ST);
>
> + if (!use_polling && ret) {
> + /* Flush the mask and acknowledgment before re-enabling the IRQ. */
> + readl(nfc->regs + NFC_REG_INT);
> + enable_irq(nfc->irq);
Shouldn't you re-read NFC_REG_ST, checking if the event became true even
in the case of a timeout?
Say the interrupt wake the thread but the thread never had a chance
to run. The timer (on another CPU) had a chance to run and did wake this
thread. Checking the event in the timeout case would help to prevent
that.
> + }
> +
> if (ret)
> dev_err(nfc->dev, "wait interrupt timedout\n");
>
Sebastian
next prev parent reply other threads:[~2026-10-15 7:19 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-15 1:33 [PATCH v7 00/16] mtd: rawnand: sunxi: fix transfers and support randomized OOB James Hilliard
2026-10-15 1:33 ` [PATCH v7 01/16] mtd: rawnand: sunxi: centralize OOB handling James Hilliard
2026-10-15 1:33 ` [PATCH v7 02/16] mtd: rawnand: sunxi: use the logical step's OOB length in PIO James Hilliard
2026-10-15 1:33 ` [PATCH v7 03/16] mtd: rawnand: sunxi: propagate page-setup and erased-check errors James Hilliard
2026-10-15 1:33 ` [PATCH v7 04/16] mtd: rawnand: sunxi: drain interrupts before reusing the completion James Hilliard
2026-10-15 7:19 ` Sebastian Andrzej Siewior [this message]
2026-10-15 1:33 ` [PATCH v7 05/16] mtd: rawnand: sunxi: stop failed program operations and disable ECC James Hilliard
2026-10-15 1:33 ` [PATCH v7 06/16] mtd: rawnand: sunxi: select the pattern ID for the current ECC step James Hilliard
2026-10-15 1:50 ` sashiko-bot
2026-10-15 1:33 ` [PATCH v7 07/16] mtd: rawnand: sunxi: propagate buffer and column transfer errors James Hilliard
2026-10-15 1:33 ` [PATCH v7 08/16] mtd: rawnand: sunxi: avoid a second program confirm for OOB writes James Hilliard
2026-10-15 1:33 ` [PATCH v7 09/16] mtd: rawnand: sunxi: use page reads to reposition small-page NAND James Hilliard
2026-10-15 1:33 ` [PATCH v7 10/16] mtd: rawnand: sunxi: bound DMA batches by the user-data register bank James Hilliard
2026-10-15 1:33 ` [PATCH v7 11/16] mtd: rawnand: sunxi: reuse ECC status within each transfer James Hilliard
2026-10-15 1:33 ` [PATCH v7 12/16] mtd: rawnand: sunxi: avoid redundant column changes for extra OOB James Hilliard
2026-10-15 1:34 ` [PATCH v7 13/16] mtd: rawnand: sunxi: avoid duplicate chip setup before page commands James Hilliard
2026-10-15 1:34 ` [PATCH v7 14/16] mtd: rawnand: sunxi: reduce user-data length register accesses James Hilliard
2026-10-15 1:34 ` [PATCH v7 15/16] dt-bindings: mtd: sunxi: Add randomized OOB flag James Hilliard
2026-10-15 1:34 ` [PATCH v7 16/16] mtd: rawnand: sunxi: support the Allwinner randomized OOB format James Hilliard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261015071943.7OihPadq@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=bbrezillon@kernel.org \
--cc=clrkwllms@kernel.org \
--cc=computersforpeace@gmail.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=james.hilliard1@gmail.com \
--cc=jernej.skrabec@gmail.com \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=linux-rt-devel@lists.linux.dev \
--cc=linux-sunxi@lists.linux.dev \
--cc=miquel.raynal@bootlin.com \
--cc=mripard@kernel.org \
--cc=richard.genoud@bootlin.com \
--cc=richard@nod.at \
--cc=robh@kernel.org \
--cc=rostedt@goodmis.org \
--cc=samuel@sholland.org \
--cc=vigneshr@ti.com \
--cc=wens@kernel.org \
--cc=yamada.masahiro@socionext.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox