From patchwork Sat Jun 20 15:57:49 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chakra Divi X-Patchwork-Id: 486999 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 BA6021401CB for ; Sun, 21 Jun 2015 01:58:24 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 620604B6E2; Sat, 20 Jun 2015 17:58:22 +0200 (CEST) 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 g0WngJYX0icP; Sat, 20 Jun 2015 17:58:22 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B2BAA4B6D7; Sat, 20 Jun 2015 17:58:21 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 628604B6D7 for ; Sat, 20 Jun 2015 17:58:18 +0200 (CEST) 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 ebd9z8egMtJA for ; Sat, 20 Jun 2015 17:58:18 +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 s159.web-hosting.com (s159.web-hosting.com [68.65.121.203]) by theia.denx.de (Postfix) with ESMTPS id 08B1F4B6D4 for ; Sat, 20 Jun 2015 17:58:15 +0200 (CEST) Received: from [183.82.198.209] (port=50565 helo=localhost.localdomain) by server159.web-hosting.com with esmtpsa (UNKNOWN:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.82) (envelope-from ) id 1Z6L9n-000Z4Q-5P; Sat, 20 Jun 2015 11:58:11 -0400 From: Chakra Divi To: Jagan Teki Date: Sat, 20 Jun 2015 21:27:49 +0530 Message-Id: <1434815869-2094-1-git-send-email-cdivi@openedev.com> X-Mailer: git-send-email 1.7.9.5 X-OutGoing-Spam-Status: No, score=-1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - server159.web-hosting.com X-AntiAbuse: Original Domain - lists.denx.de X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - openedev.com X-Get-Message-Sender-Via: server159.web-hosting.com: authenticated_id: cdivi@openedev.com X-Source: X-Source-Args: X-Source-Dir: X-From-Rewrite: unmodified, already matched Cc: u-boot@lists.denx.de Subject: [U-Boot] [PATCH] spi: zynq_spi.c:Optmizations done in spi_xfer func X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" This Patch replaces the arithmatic operators with bitwise operators for optimizations hoping it would save some cycles Signed-off-by: Chakra Divi --- Note: Jagan or anyone please test this patch, I don't have hardware with me. --- drivers/spi/zynq_spi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/spi/zynq_spi.c b/drivers/spi/zynq_spi.c index e9129da..a8a160b 100644 --- a/drivers/spi/zynq_spi.c +++ b/drivers/spi/zynq_spi.c @@ -218,7 +218,7 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout, void *din, unsigned long flags) { struct zynq_spi_slave *zslave = to_zynq_spi_slave(slave); - u32 len = bitlen / 8; + u32 len = bitlen >> 3; u32 tx_len = len, rx_len = len, tx_tvl; const u8 *tx_buf = dout; u8 *rx_buf = din, buf; @@ -227,7 +227,7 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout, debug("spi_xfer: bus:%i cs:%i bitlen:%i len:%i flags:%lx\n", slave->bus, slave->cs, bitlen, len, flags); - if (bitlen % 8) { + if (bitlen & 0x7) { debug("spi_xfer: Non byte aligned SPI transfer\n"); return -1; }