Explorar o código

serial: use DIV_ROUND_CLOSEST instead of open coding it

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Uwe Kleine-König %!s(int64=13) %!d(string=hai) anos
pai
achega
97d24634da
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      drivers/tty/serial/serial_core.c

+ 1 - 1
drivers/tty/serial/serial_core.c

@@ -421,7 +421,7 @@ uart_get_divisor(struct uart_port *port, unsigned int baud)
 	if (baud == 38400 && (port->flags & UPF_SPD_MASK) == UPF_SPD_CUST)
 	if (baud == 38400 && (port->flags & UPF_SPD_MASK) == UPF_SPD_CUST)
 		quot = port->custom_divisor;
 		quot = port->custom_divisor;
 	else
 	else
-		quot = (port->uartclk + (8 * baud)) / (16 * baud);
+		quot = DIV_ROUND_CLOSEST(port->uartclk, 16 * baud);
 
 
 	return quot;
 	return quot;
 }
 }