From: Chakra Divi <cdivi@openedev.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] spi: zynq_spi.c:Optmizations done in spi_xfer func
Date: Sat, 20 Jun 2015 21:27:49 +0530 [thread overview]
Message-ID: <1434815869-2094-1-git-send-email-cdivi@openedev.com> (raw)
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
reply other threads:[~2015-06-20 15:57 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1434815869-2094-1-git-send-email-cdivi@openedev.com \
--to=cdivi@openedev.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox