Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

serial: sc16is7xx: remove global regmap from struct sc16is7xx_port

Remove global struct regmap so that it is more obvious that this
regmap is to be used only in the probe function.

Also add a comment to that effect in probe function.

Fixes: 3837a0379533 ("serial: sc16is7xx: improve regmap debugfs by using one regmap per port")
Cc: <stable@vger.kernel.org>
Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
Link: https://lore.kernel.org/r/20231211171353.2901416-3-hugo@hugovil.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Hugo Villeneuve and committed by
Greg Kroah-Hartman
f6959c52 6bcab3c8

+9 -6
+9 -6
drivers/tty/serial/sc16is7xx.c
··· 334 334 335 335 struct sc16is7xx_port { 336 336 const struct sc16is7xx_devtype *devtype; 337 - struct regmap *regmap; 338 337 struct clk *clk; 339 338 #ifdef CONFIG_GPIOLIB 340 339 struct gpio_chip gpio; ··· 1433 1434 /* 1434 1435 * Configure ports designated to operate as modem control lines. 1435 1436 */ 1436 - static int sc16is7xx_setup_mctrl_ports(struct sc16is7xx_port *s) 1437 + static int sc16is7xx_setup_mctrl_ports(struct sc16is7xx_port *s, 1438 + struct regmap *regmap) 1437 1439 { 1438 1440 int i; 1439 1441 int ret; ··· 1463 1463 1464 1464 if (s->mctrl_mask) 1465 1465 regmap_update_bits( 1466 - s->regmap, 1466 + regmap, 1467 1467 SC16IS7XX_IOCONTROL_REG, 1468 1468 SC16IS7XX_IOCONTROL_MODEM_A_BIT | 1469 1469 SC16IS7XX_IOCONTROL_MODEM_B_BIT, s->mctrl_mask); ··· 1495 1495 * This device does not have an identification register that would 1496 1496 * tell us if we are really connected to the correct device. 1497 1497 * The best we can do is to check if communication is at all possible. 1498 + * 1499 + * Note: regmap[0] is used in the probe function to access registers 1500 + * common to all channels/ports, as it is guaranteed to be present on 1501 + * all variants. 1498 1502 */ 1499 1503 ret = regmap_read(regmaps[0], SC16IS7XX_LSR_REG, &val); 1500 1504 if (ret < 0) ··· 1534 1530 return -EINVAL; 1535 1531 } 1536 1532 1537 - s->regmap = regmaps[0]; 1538 1533 s->devtype = devtype; 1539 1534 dev_set_drvdata(dev, s); 1540 1535 mutex_init(&s->efr_lock); ··· 1548 1545 sched_set_fifo(s->kworker_task); 1549 1546 1550 1547 /* reset device, purging any pending irq / data */ 1551 - regmap_write(s->regmap, SC16IS7XX_IOCONTROL_REG, 1548 + regmap_write(regmaps[0], SC16IS7XX_IOCONTROL_REG, 1552 1549 SC16IS7XX_IOCONTROL_SRESET_BIT); 1553 1550 1554 1551 for (i = 0; i < devtype->nr_uart; ++i) { ··· 1619 1616 1620 1617 sc16is7xx_setup_irda_ports(s); 1621 1618 1622 - ret = sc16is7xx_setup_mctrl_ports(s); 1619 + ret = sc16is7xx_setup_mctrl_ports(s, regmaps[0]); 1623 1620 if (ret) 1624 1621 goto out_ports; 1625 1622