All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] spi: fsl-quadspi: cleanup wait_for_completion return handling
@ 2015-02-01 11:15 ` Nicholas Mc Guire
  0 siblings, 0 replies; 6+ messages in thread
From: Nicholas Mc Guire @ 2015-02-01 11:15 UTC (permalink / raw)
  To: David Woodhouse
  Cc: Brian Norris, Huang Shijie, Fabio Estevam, Marek Vasut, Allen Xu,
	Ben Hutchings, linux-mtd, linux-kernel, Nicholas Mc Guire

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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] spi: fsl-quadspi: cleanup wait_for_completion return handling
@ 2015-02-01 11:15 ` Nicholas Mc Guire
  0 siblings, 0 replies; 6+ messages in thread
From: Nicholas Mc Guire @ 2015-02-01 11:15 UTC (permalink / raw)
  To: David Woodhouse
  Cc: Fabio Estevam, Marek Vasut, linux-kernel, Huang Shijie, Allen Xu,
	linux-mtd, Nicholas Mc Guire, Brian Norris, Ben Hutchings

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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] spi: fsl-quadspi: cleanup wait_for_completion return handling
  2015-02-01 11:15 ` Nicholas Mc Guire
@ 2015-02-11  4:00   ` Han Xu
  -1 siblings, 0 replies; 6+ messages in thread
From: Han Xu @ 2015-02-11  4:00 UTC (permalink / raw)
  To: Nicholas Mc Guire
  Cc: David Woodhouse, Fabio Estevam, Marek Vasut, linux-kernel,
	Huang Shijie, Allen Xu, linux-mtd, Brian Norris, Ben Hutchings

On Sun, Feb 1, 2015 at 5:15 AM, Nicholas Mc Guire <hofrat@osadl.org> wrote:
> 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
>

Acked-by: Han Xu <han.xu@freescale.com>

>
> ______________________________________________________
> Linux MTD discussion mailing list
> http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] spi: fsl-quadspi: cleanup wait_for_completion return handling
@ 2015-02-11  4:00   ` Han Xu
  0 siblings, 0 replies; 6+ messages in thread
From: Han Xu @ 2015-02-11  4:00 UTC (permalink / raw)
  To: Nicholas Mc Guire
  Cc: Fabio Estevam, Marek Vasut, Ben Hutchings, linux-kernel,
	Huang Shijie, Allen Xu, linux-mtd, Brian Norris, David Woodhouse

On Sun, Feb 1, 2015 at 5:15 AM, Nicholas Mc Guire <hofrat@osadl.org> wrote:
> 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
>

Acked-by: Han Xu <han.xu@freescale.com>

>
> ______________________________________________________
> Linux MTD discussion mailing list
> http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] spi: fsl-quadspi: cleanup wait_for_completion return handling
  2015-02-11  4:00   ` Han Xu
@ 2015-03-31  1:10     ` Brian Norris
  -1 siblings, 0 replies; 6+ messages in thread
From: Brian Norris @ 2015-03-31  1:10 UTC (permalink / raw)
  To: Han Xu
  Cc: Nicholas Mc Guire, David Woodhouse, Fabio Estevam, Marek Vasut,
	linux-kernel, Huang Shijie, Allen Xu, linux-mtd, Ben Hutchings

On Tue, Feb 10, 2015 at 10:00:01PM -0600, Han Xu wrote:
> On Sun, Feb 1, 2015 at 5:15 AM, Nicholas Mc Guire <hofrat@osadl.org> wrote:
> > 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

In practice, I don't think this should matter, since we're not even
close to 2^32 jiffies, but the patch looks fine anyway.

Pushed to l2-mtd.git. Thanks!

Brian

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] spi: fsl-quadspi: cleanup wait_for_completion return handling
@ 2015-03-31  1:10     ` Brian Norris
  0 siblings, 0 replies; 6+ messages in thread
From: Brian Norris @ 2015-03-31  1:10 UTC (permalink / raw)
  To: Han Xu
  Cc: Fabio Estevam, Marek Vasut, Ben Hutchings, linux-kernel,
	Huang Shijie, Allen Xu, linux-mtd, Nicholas Mc Guire,
	David Woodhouse

On Tue, Feb 10, 2015 at 10:00:01PM -0600, Han Xu wrote:
> On Sun, Feb 1, 2015 at 5:15 AM, Nicholas Mc Guire <hofrat@osadl.org> wrote:
> > 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

In practice, I don't think this should matter, since we're not even
close to 2^32 jiffies, but the patch looks fine anyway.

Pushed to l2-mtd.git. Thanks!

Brian

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-03-31  1:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-01 11:15 [PATCH] spi: fsl-quadspi: cleanup wait_for_completion return handling Nicholas Mc Guire
2015-02-01 11:15 ` Nicholas Mc Guire
2015-02-11  4:00 ` Han Xu
2015-02-11  4:00   ` Han Xu
2015-03-31  1:10   ` Brian Norris
2015-03-31  1:10     ` Brian Norris

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.