From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: Richard Weinberger <richard@nod.at>,
Vignesh Raghavendra <vigneshr@ti.com>,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
linux-mtd@lists.infradead.org
Subject: Re: [PATCH] mtd: nand: mxic-ecc: Fix mxic_ecc_data_xfer_wait_for_completion() when irq is used
Date: Wed, 15 Feb 2023 14:09:50 +0100 [thread overview]
Message-ID: <20230215140950.2e7428b8@xps-13> (raw)
In-Reply-To: <beddbc374557e44ceec897e68c4a5d12764ddbb9.1676459308.git.christophe.jaillet@wanadoo.fr>
Hi Christophe,
christophe.jaillet@wanadoo.fr wrote on Wed, 15 Feb 2023 12:08:45 +0100:
> wait_for_completion_timeout() and readl_poll_timeout() don't handle their
> return value the same way.
>
> wait_for_completion_timeout() returns 0 on time out (and >0 in all other
> cases)
> readl_poll_timeout() returns 0 on success and -ETIMEDOUT upon a timeout.
That's a shame, but yeah, excellent catch!
> In order for the error handling path to work in both cases, the logic
> against wait_for_completion_timeout() needs to be inverted.
>
> Fixes: 48e6633a9fa2 ("mtd: nand: mxic-ecc: Add Macronix external ECC engine support")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> Compile tested only.
>
> This is really spurious.
> If I'm right, this means that it never worked!
>
> Can any one with the hardware test?
The design I used for development and testing had no interrupt line
available for that IIRC, so I only tested the polling case ('else'
side) and completely overlooked that difference. I might have mentioned
it in the cover letter, if I didn't, it's an oversight.
> ---
> drivers/mtd/nand/ecc-mxic.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/mtd/nand/ecc-mxic.c b/drivers/mtd/nand/ecc-mxic.c
> index 8afdca731b87..6b487ffe2f2d 100644
> --- a/drivers/mtd/nand/ecc-mxic.c
> +++ b/drivers/mtd/nand/ecc-mxic.c
> @@ -429,6 +429,7 @@ static int mxic_ecc_data_xfer_wait_for_completion(struct mxic_ecc_engine *mxic)
> mxic_ecc_enable_int(mxic);
> ret = wait_for_completion_timeout(&mxic->complete,
> msecs_to_jiffies(1000));
> + ret = ret ? 0 : -ETIMEDOUT;
> mxic_ecc_disable_int(mxic);
> } else {
> ret = readl_poll_timeout(mxic->regs + INTRPT_STS, val,
Thanks,
Miquèl
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
next prev parent reply other threads:[~2023-02-15 13:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-15 11:08 [PATCH] mtd: nand: mxic-ecc: Fix mxic_ecc_data_xfer_wait_for_completion() when irq is used Christophe JAILLET
2023-02-15 13:09 ` Miquel Raynal [this message]
2023-03-07 19:21 ` Miquel Raynal
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=20230215140950.2e7428b8@xps-13 \
--to=miquel.raynal@bootlin.com \
--cc=christophe.jaillet@wanadoo.fr \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=richard@nod.at \
--cc=vigneshr@ti.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