summaryrefslogtreecommitdiff
path: root/drivers/tty/serial/sc16is7xx_spi.c
diff options
context:
space:
mode:
authorHugo Villeneuve <hvilleneuve@dimonoff.com>2024-04-09 11:42:53 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-04-11 14:08:08 +0200
commit48d4a801be0ff64740832fcc71ac4632c12fd73b (patch)
tree8c75642f8da8b97ba4a3f69d7779f988a6acd718 /drivers/tty/serial/sc16is7xx_spi.c
parentcf9c37530fdabc0c25a896ff56f4c9208dcb9c86 (diff)
serial: sc16is7xx: split into core and I2C/SPI parts (sc16is7xx_regcfg)
Since each I2C/SPI probe function can modify sc16is7xx_regcfg at the same time, change structure to be constant and do the required modifications on a local copy. Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com> Reviewed-by: Andy Shevchenko <andy@kernel.org> Link: https://lore.kernel.org/r/20240409154253.3043822-6-hugo@hugovil.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial/sc16is7xx_spi.c')
-rw-r--r--drivers/tty/serial/sc16is7xx_spi.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/tty/serial/sc16is7xx_spi.c b/drivers/tty/serial/sc16is7xx_spi.c
index f110c4e6dce6..73df36f8a7fd 100644
--- a/drivers/tty/serial/sc16is7xx_spi.c
+++ b/drivers/tty/serial/sc16is7xx_spi.c
@@ -18,6 +18,7 @@ static int sc16is7xx_spi_probe(struct spi_device *spi)
{
const struct sc16is7xx_devtype *devtype;
struct regmap *regmaps[SC16IS7XX_MAX_PORTS];
+ struct regmap_config regcfg;
unsigned int i;
int ret;
@@ -37,17 +38,19 @@ static int sc16is7xx_spi_probe(struct spi_device *spi)
if (!devtype)
return dev_err_probe(&spi->dev, -ENODEV, "Failed to match device\n");
+ memcpy(&regcfg, &sc16is7xx_regcfg, sizeof(struct regmap_config));
+
for (i = 0; i < devtype->nr_uart; i++) {
- sc16is7xx_regcfg.name = sc16is7xx_regmap_name(i);
+ regcfg.name = sc16is7xx_regmap_name(i);
/*
* If read_flag_mask is 0, the regmap code sets it to a default
* of 0x80. Since we specify our own mask, we must add the READ
* bit ourselves:
*/
- sc16is7xx_regcfg.read_flag_mask = sc16is7xx_regmap_port_mask(i) |
+ regcfg.read_flag_mask = sc16is7xx_regmap_port_mask(i) |
SC16IS7XX_SPI_READ_BIT;
- sc16is7xx_regcfg.write_flag_mask = sc16is7xx_regmap_port_mask(i);
- regmaps[i] = devm_regmap_init_spi(spi, &sc16is7xx_regcfg);
+ regcfg.write_flag_mask = sc16is7xx_regmap_port_mask(i);
+ regmaps[i] = devm_regmap_init_spi(spi, &regcfg);
}
return sc16is7xx_probe(&spi->dev, devtype, regmaps, spi->irq);