summaryrefslogtreecommitdiffstats
path: root/drivers/serial
diff options
context:
space:
mode:
authorAlexander Shiyan <shc_work@mail.ru>2018-12-19 11:03:56 +0300
committerSascha Hauer <s.hauer@pengutronix.de>2018-12-20 08:57:31 +0100
commitb146df65c7d6d4774a42f5f55d9dd28ed44c0b0c (patch)
treec27229ad9620a62a2611c24c19c10d3f3ad94206 /drivers/serial
parent15235af87c8661d8bfa5436dd794cd2f16f461bd (diff)
downloadbarebox-b146df65c7d6d4774a42f5f55d9dd28ed44c0b0c.tar.gz
serial: clps711x: Use DIV_ROUND_CLOSEST() for baudrate calculation
Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/serial')
-rw-r--r--drivers/serial/serial_clps711x.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/serial/serial_clps711x.c b/drivers/serial/serial_clps711x.c
index cd64f0c..85a96ed 100644
--- a/drivers/serial/serial_clps711x.c
+++ b/drivers/serial/serial_clps711x.c
@@ -46,7 +46,7 @@ static int clps711x_setbaudrate(struct console_device *cdev, int baudrate)
int divisor;
u32 tmp;
- divisor = (clk_get_rate(s->uart_clk) / 16) / baudrate;
+ divisor = DIV_ROUND_CLOSEST(clk_get_rate(s->uart_clk), baudrate * 16);
tmp = readl(s->base + UBRLCR) & ~UBRLCR_BAUD_MASK;
tmp |= divisor - 1;