From patchwork Sat May 30 17:41:38 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Dooks X-Patchwork-Id: 27888 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [18.85.46.34]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by bilbo.ozlabs.org (Postfix) with ESMTPS id 65D8DB7066 for ; Sun, 31 May 2009 18:58:21 +1000 (EST) Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1MAgnq-0004u5-Md; Sun, 31 May 2009 08:54:02 +0000 Received: from aeryn.fluff.org.uk ([87.194.8.8] helo=teyla.home.fluff.org) by bombadil.infradead.org with esmtps (Exim 4.69 #1 (Red Hat Linux)) id 1MASe2-0003bK-LI for linux-mtd@lists.infradead.org; Sat, 30 May 2009 17:47:36 +0000 Received: from ben by teyla.home.fluff.org with local (Exim 4.69) (envelope-from ) id 1MASYs-0005gc-NV; Sat, 30 May 2009 18:41:38 +0100 From: Ben Dooks To: linux-mtd@lists.infradead.org Subject: [MTD] [NAND] S3C2410: Use DIV_ROUND_UP Date: Sat, 30 May 2009 18:41:38 +0100 Message-Id: <1243705298-21814-12-git-send-email-ben-linux@fluff.org> X-Mailer: git-send-email 1.5.6.5 In-Reply-To: <1243705298-21814-11-git-send-email-ben-linux@fluff.org> References: <1243705298-21814-1-git-send-email-ben-linux@fluff.org> <1243705298-21814-2-git-send-email-ben-linux@fluff.org> <1243705298-21814-3-git-send-email-ben-linux@fluff.org> <1243705298-21814-4-git-send-email-ben-linux@fluff.org> <1243705298-21814-5-git-send-email-ben-linux@fluff.org> <1243705298-21814-6-git-send-email-ben-linux@fluff.org> <1243705298-21814-7-git-send-email-ben-linux@fluff.org> <1243705298-21814-8-git-send-email-ben-linux@fluff.org> <1243705298-21814-9-git-send-email-ben-linux@fluff.org> <1243705298-21814-10-git-send-email-ben-linux@fluff.org> <1243705298-21814-11-git-send-email-ben-linux@fluff.org> X-Bad-Reply: References and In-Reply-To but no 'Re:' in Subject. X-Spam-Score: 0.0 (/) X-Mailman-Approved-At: Sun, 31 May 2009 04:53:59 -0400 Cc: Ben Dooks X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Change to using DIV_ROUND_UP() in the timing calculation instead of blindly doing result++ Signed-off-by: Ben Dooks --- drivers/mtd/nand/s3c2410.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/nand/s3c2410.c b/drivers/mtd/nand/s3c2410.c index 8a7f960..89b7905 100644 --- a/drivers/mtd/nand/s3c2410.c +++ b/drivers/mtd/nand/s3c2410.c @@ -180,8 +180,7 @@ static int s3c_nand_calc_rate(int wanted, unsigned long clk, int max) { int result; - result = (wanted * clk) / NS_IN_KHZ; - result++; + result = DIV_ROUND_UP((wanted * clk), NS_IN_KHZ); pr_debug("result %d from %ld, %d\n", result, clk, wanted);