From: Boris Brezillon <boris.brezillon@bootlin.com>
To: Nicholas Mc Guire <hofrat@osadl.org>
Cc: Graham Moore <grmoore@opensource.altera.com>,
Vignesh R <vigneshr@ti.com>, Richard Weinberger <richard@nod.at>,
linux-kernel@vger.kernel.org, Marek Vasut <marek.vasut@gmail.com>,
linux-mtd@lists.infradead.org,
Brian Norris <computersforpeace@gmail.com>,
David Woodhouse <dwmw2@infradead.org>
Subject: Re: [PATCH] mtd: spi-nor: cadence-quadspi: make return type fit wait_for_completion_timeout
Date: Tue, 24 Jul 2018 22:46:26 +0200 [thread overview]
Message-ID: <20180724224626.777149ce@bbrezillon> (raw)
In-Reply-To: <1532189293-5975-1-git-send-email-hofrat@osadl.org>
On Sat, 21 Jul 2018 18:08:13 +0200
Nicholas Mc Guire <hofrat@osadl.org> wrote:
> wait_for_completion_timeout returns an unsigned long not int. declare a
> suitably type timeout and fix up assignment and check.
>
> Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
> Reported-by: Vignesh R <vigneshr@ti.com>
> Fixes: 140623410536 ("mtd: spi-nor: Add driver for Cadence Quad SPI Flash Controller")
If you don't mind, I'd like to squash all wait_for_completion_timeout()
fixes into a single commit.
Thanks,
Boris
> ---
>
> Given that CQSPI_TIMEOUT_MS is < INT_MAX the type conversion is actually safe
> here but it is cleaner to use proper types.
>
> Patch was compile tested with: socfpga_defconfig (implies
> CONFIG_SPI_CADENCE_QUADSPI=y)
>
> Patch is against 4.18-rc5 (localversion-next is next-20180720)
>
> drivers/mtd/spi-nor/cadence-quadspi.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mtd/spi-nor/cadence-quadspi.c b/drivers/mtd/spi-nor/cadence-quadspi.c
> index d7e10b3..ce5f840 100644
> --- a/drivers/mtd/spi-nor/cadence-quadspi.c
> +++ b/drivers/mtd/spi-nor/cadence-quadspi.c
> @@ -622,6 +622,7 @@ static int cqspi_indirect_write_execute(struct spi_nor *nor, loff_t to_addr,
> unsigned int remaining = n_tx;
> unsigned int write_bytes;
> int ret;
> + unsigned long timeout;
>
> writel(to_addr, reg_base + CQSPI_REG_INDIRECTWRSTARTADDR);
> writel(remaining, reg_base + CQSPI_REG_INDIRECTWRBYTES);
> @@ -649,10 +650,10 @@ static int cqspi_indirect_write_execute(struct spi_nor *nor, loff_t to_addr,
> iowrite32_rep(cqspi->ahb_base, txbuf,
> DIV_ROUND_UP(write_bytes, 4));
>
> - ret = wait_for_completion_timeout(&cqspi->transfer_complete,
> - msecs_to_jiffies
> - (CQSPI_TIMEOUT_MS));
> - if (!ret) {
> + timeout = wait_for_completion_timeout(&cqspi->transfer_complete,
> + msecs_to_jiffies
> + (CQSPI_TIMEOUT_MS));
> + if (!timeout) {
> dev_err(nor->dev, "Indirect write timeout\n");
> ret = -ETIMEDOUT;
> goto failwr;
next prev parent reply other threads:[~2018-07-24 20:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-21 16:08 [PATCH] mtd: spi-nor: cadence-quadspi: make return type fit wait_for_completion_timeout Nicholas Mc Guire
2018-07-24 20:46 ` Boris Brezillon [this message]
2018-07-25 6:31 ` Nicholas Mc Guire
2018-07-26 20:09 ` Boris Brezillon
2018-07-27 5:21 ` Nicholas Mc Guire
2018-07-27 7:47 ` Boris Brezillon
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=20180724224626.777149ce@bbrezillon \
--to=boris.brezillon@bootlin.com \
--cc=computersforpeace@gmail.com \
--cc=dwmw2@infradead.org \
--cc=grmoore@opensource.altera.com \
--cc=hofrat@osadl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=marek.vasut@gmail.com \
--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;
as well as URLs for NNTP newsgroup(s).