public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] spi: zynq_spi.c:Optmizations done in spi_xfer func
@ 2015-06-20 15:57 Chakra Divi
  0 siblings, 0 replies; only message in thread
From: Chakra Divi @ 2015-06-20 15:57 UTC (permalink / raw)
  To: u-boot

This Patch replaces the arithmatic operators with bitwise
operators for optimizations hoping it would save some cycles

Signed-off-by: Chakra Divi <cdivi@openedev.com>
---
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;
 	}
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-06-20 15:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-20 15:57 [U-Boot] [PATCH] spi: zynq_spi.c:Optmizations done in spi_xfer func Chakra Divi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox