From 583fe6c3d82b502acad5f7698a62253ba9d9304b Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Fri, 12 Jul 2013 17:42:15 +0800 Subject: [PATCH] spi: mpc8xxx_spi: Use DIV_ROUND_UP instead of open-coded Use DIV_ROUND_UP to simplify the code. Signed-off-by: Axel Lin --- drivers/spi/mpc8xxx_spi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/spi/mpc8xxx_spi.c b/drivers/spi/mpc8xxx_spi.c index bbfc259e47..348361a7fd 100644 --- a/drivers/spi/mpc8xxx_spi.c +++ b/drivers/spi/mpc8xxx_spi.c @@ -77,7 +77,7 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout, { volatile spi8xxx_t *spi = &((immap_t *) (CONFIG_SYS_IMMR))->spi; unsigned int tmpdout, tmpdin, event; - int numBlks = bitlen / 32 + (bitlen % 32 ? 1 : 0); + int numBlks = DIV_ROUND_UP(bitlen, 32); int tm, isRead = 0; unsigned char charSize = 32; -- 2.39.5