Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0876b726 authored by Hugo Villeneuve's avatar Hugo Villeneuve Committed by Greg Kroah-Hartman
Browse files

serial: sc16is7xx: replace hardcoded divisor value with BIT() macro



[ Upstream commit 2e57cefc4477659527f7adab1f87cdbf60ef1ae6 ]

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

Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
Suggested-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: default avatarHugo Villeneuve <hvilleneuve@dimonoff.com>
Link: https://lore.kernel.org/r/20231221231823.2327894-13-hugo@hugovil.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Stable-dep-of: 8492bd91aa05 ("serial: sc16is7xx: fix bug in sc16is7xx_set_baud() when using prescaler")
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 63127374
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -496,7 +496,7 @@ static int sc16is7xx_set_baud(struct uart_port *port, int baud)
	u8 prescaler = 0;
	u8 prescaler = 0;
	unsigned long clk = port->uartclk, div = clk / 16 / baud;
	unsigned long clk = port->uartclk, div = clk / 16 / baud;


	if (div > 0xffff) {
	if (div >= BIT(16)) {
		prescaler = SC16IS7XX_MCR_CLKSEL_BIT;
		prescaler = SC16IS7XX_MCR_CLKSEL_BIT;
		div /= 4;
		div /= 4;
	}
	}