[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1324378064-7208-1-git-send-email-u.kleine-koenig@pengutronix.de>
Date: Tue, 20 Dec 2011 11:47:44 +0100
From: Uwe Kleine-König
<u.kleine-koenig@...gutronix.de>
To: Greg Kroah-Hartman <gregkh@...e.de>
Cc: Alan Cox <alan@...ux.intel.com>, linux-serial@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] serial: use DIV_ROUND_CLOSEST instead of open coding it
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@...gutronix.de>
---
drivers/tty/serial/serial_core.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 0406d7f..a05afc3 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -423,7 +423,7 @@ uart_get_divisor(struct uart_port *port, unsigned int baud)
if (baud == 38400 && (port->flags & UPF_SPD_MASK) == UPF_SPD_CUST)
quot = port->custom_divisor;
else
- quot = (port->uartclk + (8 * baud)) / (16 * baud);
+ quot = DIV_ROUND_CLOSEST(port->uartclk, 16 * baud);
return quot;
}
--
1.7.7.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists