[PATCH 12/18] serial: sc16is7xx: replace hardcoded divisor value with BIT() macro

Hugo Villeneuve posted 18 patches 1 year, 12 months ago
There is a newer version of this series
[PATCH 12/18] serial: sc16is7xx: replace hardcoded divisor value with BIT() macro
Posted by Hugo Villeneuve 1 year, 12 months ago
From: Hugo Villeneuve <hvilleneuve@dimonoff.com>

To better show why the limit is what it is, since we have only 16 bits for
the divisor.

Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
---
 drivers/tty/serial/sc16is7xx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c
index feb50d9271ac..133538f91390 100644
--- a/drivers/tty/serial/sc16is7xx.c
+++ b/drivers/tty/serial/sc16is7xx.c
@@ -486,7 +486,7 @@ static int sc16is7xx_set_baud(struct uart_port *port, int baud)
 	u8 prescaler = 0;
 	unsigned long clk = port->uartclk, div = clk / 16 / baud;
 
-	if (div > 0xffff) {
+	if (div >= BIT(16)) {
 		prescaler = SC16IS7XX_MCR_CLKSEL_BIT;
 		div /= 4;
 	}
-- 
2.39.2
Re: [PATCH 12/18] serial: sc16is7xx: replace hardcoded divisor value with BIT() macro
Posted by Andy Shevchenko 1 year, 12 months ago
On Tue, Dec 19, 2023 at 12:18:56PM -0500, Hugo Villeneuve wrote:
> From: Hugo Villeneuve <hvilleneuve@dimonoff.com>
> 
> To better show why the limit is what it is, since we have only 16 bits for
> the divisor.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

-- 
With Best Regards,
Andy Shevchenko