Skip to content

Commit 3504c31

Browse files
hvilleneuvedoogregkh
authored andcommitted
serial: sc16is7xx: use DECLARE_BITMAP for sc16is7xx_lines bitfield
Replace the explicit sc16is7xx_lines bitfield declaration with the generic macro DECLARE_BITMAP() to reserve just enough memory to contain all required bits. This also improves code self-documentation by showing the maximum number of bits required. This conversion now makes sc16is7xx_lines an array, so drop the "&" before sc16is7xx_lines in all bit access functions. Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Hugo Villeneuve <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent d507850 commit 3504c31

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

drivers/tty/serial/sc16is7xx.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ struct sc16is7xx_port {
347347
struct sc16is7xx_one p[];
348348
};
349349

350-
static unsigned long sc16is7xx_lines;
350+
static DECLARE_BITMAP(sc16is7xx_lines, SC16IS7XX_MAX_DEVS);
351351

352352
static struct uart_driver sc16is7xx_uart = {
353353
.owner = THIS_MODULE,
@@ -1536,7 +1536,7 @@ static int sc16is7xx_probe(struct device *dev,
15361536
SC16IS7XX_IOCONTROL_SRESET_BIT);
15371537

15381538
for (i = 0; i < devtype->nr_uart; ++i) {
1539-
s->p[i].port.line = find_first_zero_bit(&sc16is7xx_lines,
1539+
s->p[i].port.line = find_first_zero_bit(sc16is7xx_lines,
15401540
SC16IS7XX_MAX_DEVS);
15411541
if (s->p[i].port.line >= SC16IS7XX_MAX_DEVS) {
15421542
ret = -ERANGE;
@@ -1587,7 +1587,7 @@ static int sc16is7xx_probe(struct device *dev,
15871587
if (ret)
15881588
goto out_ports;
15891589

1590-
set_bit(s->p[i].port.line, &sc16is7xx_lines);
1590+
set_bit(s->p[i].port.line, sc16is7xx_lines);
15911591

15921592
/* Enable EFR */
15931593
sc16is7xx_port_write(&s->p[i].port, SC16IS7XX_LCR_REG,
@@ -1646,7 +1646,7 @@ static int sc16is7xx_probe(struct device *dev,
16461646

16471647
out_ports:
16481648
for (i = 0; i < devtype->nr_uart; i++)
1649-
if (test_and_clear_bit(s->p[i].port.line, &sc16is7xx_lines))
1649+
if (test_and_clear_bit(s->p[i].port.line, sc16is7xx_lines))
16501650
uart_remove_one_port(&sc16is7xx_uart, &s->p[i].port);
16511651

16521652
kthread_stop(s->kworker_task);
@@ -1669,7 +1669,7 @@ static void sc16is7xx_remove(struct device *dev)
16691669

16701670
for (i = 0; i < s->devtype->nr_uart; i++) {
16711671
kthread_cancel_delayed_work_sync(&s->p[i].ms_work);
1672-
if (test_and_clear_bit(s->p[i].port.line, &sc16is7xx_lines))
1672+
if (test_and_clear_bit(s->p[i].port.line, sc16is7xx_lines))
16731673
uart_remove_one_port(&sc16is7xx_uart, &s->p[i].port);
16741674
sc16is7xx_power(&s->p[i].port, 0);
16751675
}

0 commit comments

Comments
 (0)