projects
/
project
/
bcm63xx
/
u-boot.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
53086be
)
spi: bfin_spi: Use DIV_ROUND_UP instead of open-coded
author
Axel Lin
<axel.lin@ingics.com>
Fri, 12 Jul 2013 09:39:41 +0000
(17:39 +0800)
committer
Sonic Zhang
<sonic.zhang@analog.com>
Wed, 31 Jul 2013 08:56:04 +0000
(16:56 +0800)
Use DIV_ROUND_UP to simplify the code.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Scott Jiang <scott.jiang.linux@gmail.com>
Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
drivers/spi/bfin_spi.c
patch
|
blob
|
history
diff --git
a/drivers/spi/bfin_spi.c
b/drivers/spi/bfin_spi.c
index a9a4d92c3e719b0a1f215393ac7fc22de6cae8cf..f7192c23401a11b0ffa9605300cda5ed6e508914 100644
(file)
--- a/
drivers/spi/bfin_spi.c
+++ b/
drivers/spi/bfin_spi.c
@@
-144,10
+144,8
@@
void spi_set_speed(struct spi_slave *slave, uint hz)
u32 baud;
sclk = get_sclk();
- baud = sclk / (2 * hz);
/* baud should be rounded up */
- if (sclk % (2 * hz))
- baud += 1;
+ baud = DIV_ROUND_UP(sclk, 2 * hz);
if (baud < 2)
baud = 2;
else if (baud > (u16)-1)