From: Axel Lin Date: Fri, 12 Jul 2013 09:39:41 +0000 (+0800) Subject: spi: bfin_spi: Use DIV_ROUND_UP instead of open-coded X-Git-Tag: v2013.10-rc1~54 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=327b5c9f7cde4e621c2f49fbd2e9890d32f2bef8;p=u-boot spi: bfin_spi: Use DIV_ROUND_UP instead of open-coded Use DIV_ROUND_UP to simplify the code. Signed-off-by: Axel Lin Signed-off-by: Scott Jiang Signed-off-by: Sonic Zhang --- diff --git a/drivers/spi/bfin_spi.c b/drivers/spi/bfin_spi.c index a9a4d92c3e..f7192c2340 100644 --- 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)