From: Axel Lin <axel.lin@ingics.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/2] spi: mxc_spi: Use DIV_ROUND_UP at appropriate places
Date: Fri, 14 Jun 2013 21:13:32 +0800 [thread overview]
Message-ID: <1371215612.3888.2.camel@phoenix> (raw)
In-Reply-To: <1371215539.3888.1.camel@phoenix>
This change slightly improves readability.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
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;
--
1.8.1.2
next prev parent reply other threads:[~2013-06-14 13:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-14 13:12 [U-Boot] [PATCH 1/2] spi: cf_qspi: Use DIV_ROUND_UP at appropriate place Axel Lin
2013-06-14 13:13 ` Axel Lin [this message]
2013-06-14 15:11 ` [U-Boot] [PATCH 2/2] spi: mxc_spi: Use DIV_ROUND_UP at appropriate places Jagan Teki
2013-06-14 17:05 ` Jagan Teki
2013-06-14 13:15 ` [U-Boot] [PATCH 1/2] spi: cf_qspi: Use DIV_ROUND_UP at appropriate place Richard Retanubun
2013-06-14 15:10 ` Jagan Teki
2013-06-14 17:05 ` Jagan Teki
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=1371215612.3888.2.camel@phoenix \
--to=axel.lin@ingics.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