Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753910AbbDAOlP (ORCPT ); Wed, 1 Apr 2015 10:41:15 -0400 Received: from xes-mad.com ([216.165.139.218]:44638 "EHLO xes-mad.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753240AbbDAOlN (ORCPT ); Wed, 1 Apr 2015 10:41:13 -0400 X-Greylist: delayed 2425 seconds by postgrey-1.27 at vger.kernel.org; Wed, 01 Apr 2015 10:41:13 EDT Date: Wed, 1 Apr 2015 08:58:05 -0500 (CDT) From: Aaron Sierra To: Nicholas Mc Guire Cc: David Woodhouse , Brian Norris , Joe Schultz , Wolfram Sang , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Message-ID: <1162655988.11370.1427896685060.JavaMail.zimbra@xes-inc.com> In-Reply-To: <1426245828-15640-1-git-send-email-hofrat@osadl.org> References: <1426245828-15640-1-git-send-email-hofrat@osadl.org> Subject: Re: [PATCH] mtd: fsl_ifc_nand: use msecs_to_jiffies for time conversion MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Originating-IP: [10.52.16.65] X-Mailer: Zimbra 8.0.6_GA_5922 (ZimbraWebClient - FF35 (Linux)/8.0.6_GA_5922) Thread-Topic: fsl_ifc_nand: use msecs_to_jiffies for time conversion Thread-Index: xrZkWrxCEgpUJj/z4VYfLQI6ScWUJQ== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2119 Lines: 60 ----- Original Message ----- > From: "Nicholas Mc Guire" > Sent: Friday, March 13, 2015 6:23:47 AM > > This is only an API consolidation and should make things more readable > it replaces var * HZ / 1000 by msecs_to_jiffies(var) which helps readability > and also handles all corner-cases properly. > > Signed-off-by: Nicholas Mc Guire > --- > > Patch was compile tested with corenet64_smp_defconfig > (implies CONFIG_MTD_NAND_FSL_IFC=y) > > Patch is against 4.0-rc3 (localversion-next is -next-20150313 > > drivers/mtd/nand/fsl_ifc_nand.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/mtd/nand/fsl_ifc_nand.c > b/drivers/mtd/nand/fsl_ifc_nand.c > index 4c05f4f..51394e5 100644 > --- a/drivers/mtd/nand/fsl_ifc_nand.c > +++ b/drivers/mtd/nand/fsl_ifc_nand.c > @@ -317,7 +317,7 @@ static void fsl_ifc_run_command(struct mtd_info *mtd) > > /* wait for command complete flag or timeout */ > wait_event_timeout(ctrl->nand_wait, ctrl->nand_stat, > - IFC_TIMEOUT_MSECS * HZ/1000); > + msecs_to_jiffies(IFC_TIMEOUT_MSECS)); Nicholas, Your patch makes me think that this timeout value should be calculated once during initialization and stored in a new member of struct fsl_ifc_mtd. That would improve readability AND have some positive impact on performance. -Aaron S. > > /* ctrl->nand_stat will be updated from IRQ context */ > if (!ctrl->nand_stat) > @@ -860,7 +860,7 @@ static void fsl_ifc_sram_init(struct fsl_ifc_mtd *priv) > > /* wait for command complete flag or timeout */ > wait_event_timeout(ctrl->nand_wait, ctrl->nand_stat, > - IFC_TIMEOUT_MSECS * HZ/1000); > + msecs_to_jiffies(IFC_TIMEOUT_MSECS)); > > if (ctrl->nand_stat != IFC_NAND_EVTER_STAT_OPC) > printk(KERN_ERR "fsl-ifc: Failed to Initialise SRAM\n"); > -- > 1.7.10.4 > > -- 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/