Linux-mtd Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Nicholas Mc Guire <hofrat@osadl.org>
To: David Woodhouse <dwmw2@infradead.org>
Cc: Fabio Estevam <fabio.estevam@freescale.com>,
	Marek Vasut <marex@denx.de>,
	linux-kernel@vger.kernel.org, Huang Shijie <b32955@freescale.com>,
	Allen Xu <b45815@freescale.com>,
	linux-mtd@lists.infradead.org,
	Nicholas Mc Guire <hofrat@osadl.org>,
	Brian Norris <computersforpeace@gmail.com>,
	Ben Hutchings <ben@decadent.org.uk>
Subject: [PATCH] spi: fsl-quadspi: cleanup wait_for_completion return handling
Date: Sun,  1 Feb 2015 06:15:46 -0500	[thread overview]
Message-ID: <1422789346-16954-1-git-send-email-hofrat@osadl.org> (raw)

return type of wait_for_completion_timeout is unsigned long not int, this
patch uses the return value of wait_for_completion_timeout in the condition
directly rather than adding a additional appropriately typed variable.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
---

As the returnvalue of wait_for_completion_timeout is logically treated here
as a boolean (timeout occured or not) it can be wrapped into the if condition
directly and no additional variable is needed.

This patch was only compile tested with imx_v6_v7_defconfig
(implies CONFIG_SPI_FSL_QUADSPI=y)

Patch is against 3.19.0-rc6 -next-20150130

 drivers/mtd/spi-nor/fsl-quadspi.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/mtd/spi-nor/fsl-quadspi.c b/drivers/mtd/spi-nor/fsl-quadspi.c
index a46bea3..2543b5c 100644
--- a/drivers/mtd/spi-nor/fsl-quadspi.c
+++ b/drivers/mtd/spi-nor/fsl-quadspi.c
@@ -455,8 +455,7 @@ fsl_qspi_runcmd(struct fsl_qspi *q, u8 cmd, unsigned int addr, int len)
 	writel((seqid << QUADSPI_IPCR_SEQID_SHIFT) | len, base + QUADSPI_IPCR);
 
 	/* Wait for the interrupt. */
-	err = wait_for_completion_timeout(&q->c, msecs_to_jiffies(1000));
-	if (!err) {
+	if (!wait_for_completion_timeout(&q->c, msecs_to_jiffies(1000))) {
 		dev_err(q->dev,
 			"cmd 0x%.2x timeout, addr@%.8x, FR:0x%.8x, SR:0x%.8x\n",
 			cmd, addr, readl(base + QUADSPI_FR),
-- 
1.7.10.4

             reply	other threads:[~2015-02-01 11:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-01 11:15 Nicholas Mc Guire [this message]
2015-02-11  4:00 ` [PATCH] spi: fsl-quadspi: cleanup wait_for_completion return handling Han Xu
2015-03-31  1:10   ` Brian Norris

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=1422789346-16954-1-git-send-email-hofrat@osadl.org \
    --to=hofrat@osadl.org \
    --cc=b32955@freescale.com \
    --cc=b45815@freescale.com \
    --cc=ben@decadent.org.uk \
    --cc=computersforpeace@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=fabio.estevam@freescale.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marex@denx.de \
    /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