From patchwork Fri Jul 12 09:42:15 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 258732 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 9627B2C029B for ; Fri, 12 Jul 2013 19:42:43 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5D52A4A020; Fri, 12 Jul 2013 11:42:42 +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 vfCH6RjYCVEG; Fri, 12 Jul 2013 11:42:42 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 9C8214A028; Fri, 12 Jul 2013 11:42:36 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 422D84A028 for ; Fri, 12 Jul 2013 11:42:34 +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 112tE52cKJtB for ; Fri, 12 Jul 2013 11:42:29 +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-pb0-f50.google.com (mail-pb0-f50.google.com [209.85.160.50]) by theia.denx.de (Postfix) with ESMTPS id 35C5D4A020 for ; Fri, 12 Jul 2013 11:42:22 +0200 (CEST) Received: by mail-pb0-f50.google.com with SMTP id wz7so8758066pbc.23 for ; Fri, 12 Jul 2013 02:42:20 -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=NSr5B3M2SGNMUVQJAOhkgLYLfwBYWvHYR8SQ04GMzK8=; b=YPS54sblgbS+tlUmyUqwtA491zP/8Y2FbwyFb6rhMMwP45Ou/ydDGhxt5HlToX8mZp vIXBDbdMWSGhsQGPST7ogcvUQMUi66T3XL9FCJkS9igY2OtgNW93qAqOxaXrIpZ7ONmp QKbIFQhnDyGP2JGKTb+MI2zJmYTgMhAKIvkMREie6PFA4nm58MWZdD3NJXwK+EQ7tkpu 3kKD+hIEefyYPptHltcO0zE7Hl/lF4RpVY+nwPZ+fS/Y1tIXF2WbjRGBtu/XucTAy+Dq MuJH9UEz+mkJmkSxNtIMfa3WvuO63GoNFMk7P2167RXHNdb81KjZ9nUm9DIe9wYu2Cj+ qorg== X-Received: by 10.68.28.1 with SMTP id x1mr40114463pbg.113.1373622140898; Fri, 12 Jul 2013 02:42:20 -0700 (PDT) Received: from [192.168.0.100] (114-40-23-160.dynamic.hinet.net. [114.40.23.160]) by mx.google.com with ESMTPSA id aj3sm47179567pad.8.2013.07.12.02.42.18 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 12 Jul 2013 02:42:20 -0700 (PDT) Message-ID: <1373622135.24016.5.camel@phoenix> From: Axel Lin To: Jagannadha Sutradharudu Teki Date: Fri, 12 Jul 2013 17:42:15 +0800 In-Reply-To: <1373621981.24016.2.camel@phoenix> References: <1373621981.24016.2.camel@phoenix> X-Mailer: Evolution 3.6.4-0ubuntu1 Mime-Version: 1.0 X-Gm-Message-State: ALoCoQkY7gRklwYWWnwPLZaGc+rz8PQZizcKEjS29DW4HG54Ra8kjLhkUmGb3vab7Xa1nEUpy/AI Cc: Stefan Roese , u-boot@lists.denx.de, Kim Phillips , Ben Warren , "Ira W. Snyder" Subject: [U-Boot] [PATCH 3/3] spi: mpc8xxx_spi: Use DIV_ROUND_UP instead of open-coded 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 Use DIV_ROUND_UP to simplify the code. Signed-off-by: Axel Lin Reviewed-by: Jagannadha Sutradharudu Teki --- drivers/spi/mpc8xxx_spi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/spi/mpc8xxx_spi.c b/drivers/spi/mpc8xxx_spi.c index 6b0e3b4..c90c0ce 100644 --- a/drivers/spi/mpc8xxx_spi.c +++ b/drivers/spi/mpc8xxx_spi.c @@ -93,7 +93,7 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout, { volatile spi8xxx_t *spi = &((immap_t *) (CONFIG_SYS_IMMR))->spi; unsigned int tmpdout, tmpdin, event; - int numBlks = bitlen / 32 + (bitlen % 32 ? 1 : 0); + int numBlks = DIV_ROUND_UP(bitlen, 32); int tm, isRead = 0; unsigned char charSize = 32;