From patchwork Fri Jun 14 13:13:32 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 251426 X-Patchwork-Delegate: jagannadh.teki@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 319D02C0098 for ; Fri, 14 Jun 2013 23:14:04 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A0F994A02F; Fri, 14 Jun 2013 15:14:02 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xoN8WlY7cN5m; Fri, 14 Jun 2013 15:14:02 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 446814A01C; Fri, 14 Jun 2013 15:13:57 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7FBBD4A01C for ; Fri, 14 Jun 2013 15:13:51 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id oDTfQBO-jBMO for ; Fri, 14 Jun 2013 15:13:46 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-pa0-f49.google.com (mail-pa0-f49.google.com [209.85.220.49]) by theia.denx.de (Postfix) with ESMTPS id 5E6124A019 for ; Fri, 14 Jun 2013 15:13:39 +0200 (CEST) Received: by mail-pa0-f49.google.com with SMTP id ld11so634573pab.8 for ; Fri, 14 Jun 2013 06:13:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:subject:from:to:cc:date:in-reply-to:references :content-type:x-mailer:mime-version:content-transfer-encoding :x-gm-message-state; bh=1FazUP5BVqcfMA1DwKxvhs0yOWCnoCY23xoYo4buow8=; b=pr0hFxus6H1w4t7hr5GLUAtMzbBVsgXNbTTjia0t+bvtk3sVZop5wtsimqlTyKV3Yp dXTBFwf8uVdqwfVo2QgXe+iAyQ3WyRxKeMrGNY8NkdHZZd9zhfEflpvXFuz2w1SW7oqq ahXRxsxsU034hDl5BTvhjLEXmu8/IszLWLKQkW1AFsiK4jFb2z1ia+e0+j7lTo/JmlJ9 Zq19G/mYbGSTIsXF8L0gItp2kflm2CQWNQw3PZfpUPuuv+927Bi7LzJHZt2foITGxcTh E4SVYfaNS4hMBFidCZRBhM88IkTiAX2BnGh4UAeC+29WR6/VCYTutfkOW0K7/hysz89m BVHA== X-Received: by 10.66.136.17 with SMTP id pw17mr2530120pab.202.1371215618101; Fri, 14 Jun 2013 06:13:38 -0700 (PDT) Received: from [114.40.9.253] (114-40-9-253.dynamic.hinet.net. [114.40.9.253]) by mx.google.com with ESMTPSA id i16sm2403282pag.18.2013.06.14.06.13.35 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 14 Jun 2013 06:13:37 -0700 (PDT) Message-ID: <1371215612.3888.2.camel@phoenix> From: Axel Lin To: Jagannadha Sutradharudu Teki Date: Fri, 14 Jun 2013 21:13:32 +0800 In-Reply-To: <1371215539.3888.1.camel@phoenix> References: <1371215539.3888.1.camel@phoenix> X-Mailer: Evolution 3.6.4-0ubuntu1 Mime-Version: 1.0 X-Gm-Message-State: ALoCoQk9+njX/a2RDJeq8n0YLYHY3H2ZBLzeHMudxsYNqsgPJZNUubt1LuoD1o2gEVsYR8kUOWeh Cc: Fabio Estevam , Dirk Behme , u-boot@lists.denx.de Subject: [U-Boot] [PATCH 2/2] spi: mxc_spi: Use DIV_ROUND_UP at appropriate places X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de This change slightly improves readability. Signed-off-by: Axel Lin Reviewed-by: Jagannadha Sutradharudu Teki --- drivers/spi/mxc_spi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/spi/mxc_spi.c b/drivers/spi/mxc_spi.c index 5bed858..2ea3228 100644 --- a/drivers/spi/mxc_spi.c +++ b/drivers/spi/mxc_spi.c @@ -224,7 +224,7 @@ int spi_xchg_single(struct spi_slave *slave, unsigned int bitlen, const u8 *dout, u8 *din, unsigned long flags) { struct mxc_spi_slave *mxcs = to_mxc_spi_slave(slave); - int nbytes = (bitlen + 7) / 8; + int nbytes = DIV_ROUND_UP(bitlen, 8); u32 data, cnt, i; struct cspi_regs *regs = (struct cspi_regs *)mxcs->base; @@ -294,7 +294,7 @@ int spi_xchg_single(struct spi_slave *slave, unsigned int bitlen, /* Transfer completed, clear any pending request */ reg_write(®s->stat, MXC_CSPICTRL_TC | MXC_CSPICTRL_RXOVF); - nbytes = (bitlen + 7) / 8; + nbytes = DIV_ROUND_UP(bitlen, 8); cnt = nbytes % 32; @@ -330,7 +330,7 @@ int spi_xchg_single(struct spi_slave *slave, unsigned int bitlen, int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout, void *din, unsigned long flags) { - int n_bytes = (bitlen + 7) / 8; + int n_bytes = DIV_ROUND_UP(bitlen, 8); int n_bits; int ret; u32 blk_size;