Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751402AbbBKEAE (ORCPT ); Tue, 10 Feb 2015 23:00:04 -0500 Received: from mail-qg0-f47.google.com ([209.85.192.47]:56964 "EHLO mail-qg0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751138AbbBKEAB (ORCPT ); Tue, 10 Feb 2015 23:00:01 -0500 MIME-Version: 1.0 In-Reply-To: <1422789346-16954-1-git-send-email-hofrat@osadl.org> References: <1422789346-16954-1-git-send-email-hofrat@osadl.org> Date: Tue, 10 Feb 2015 22:00:01 -0600 Message-ID: Subject: Re: [PATCH] spi: fsl-quadspi: cleanup wait_for_completion return handling From: Han Xu To: Nicholas Mc Guire Cc: David Woodhouse , Fabio Estevam , Marek Vasut , linux-kernel@vger.kernel.org, Huang Shijie , Allen Xu , "linux-mtd@lists.infradead.org" , Brian Norris , Ben Hutchings Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2055 Lines: 49 On Sun, Feb 1, 2015 at 5:15 AM, Nicholas Mc Guire 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 > --- > > 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 > > ______________________________________________________ > Linux MTD discussion mailing list > http://lists.infradead.org/mailman/listinfo/linux-mtd/ -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/