diff options
author | Hugo Villeneuve <hvilleneuve@dimonoff.com> | 2023-12-21 18:18:15 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-01-04 16:30:04 +0100 |
commit | 7e2ead98b7478629b10e616ad997c24c390fbc84 (patch) | |
tree | 7b6e1402764f9aa5f6e027154c4300c9f1acb8ee /drivers/tty | |
parent | 195f01ddcc8146465dff1cbdfd592aa3c4f3ce5d (diff) | |
download | linux-7e2ead98b7478629b10e616ad997c24c390fbc84.tar.gz linux-7e2ead98b7478629b10e616ad997c24c390fbc84.tar.bz2 linux-7e2ead98b7478629b10e616ad997c24c390fbc84.zip |
serial: sc16is7xx: use i2c_get_match_data()
Use preferred i2c_get_match_data() instead of device_get_match_data()
and i2c_client_get_device_id() to get the driver match data.
Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
Link: https://lore.kernel.org/r/20231221231823.2327894-9-hugo@hugovil.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r-- | drivers/tty/serial/sc16is7xx.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index 4161d692df40..e7f3184a70a1 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -1796,18 +1796,13 @@ MODULE_ALIAS("spi:sc16is7xx"); #ifdef CONFIG_SERIAL_SC16IS7XX_I2C static int sc16is7xx_i2c_probe(struct i2c_client *i2c) { - const struct i2c_device_id *id = i2c_client_get_device_id(i2c); const struct sc16is7xx_devtype *devtype; struct regmap *regmaps[2]; unsigned int i; - if (i2c->dev.of_node) { - devtype = device_get_match_data(&i2c->dev); - if (!devtype) - return -ENODEV; - } else { - devtype = (struct sc16is7xx_devtype *)id->driver_data; - } + devtype = i2c_get_match_data(i2c); + if (!devtype) + return dev_err_probe(&i2c->dev, -ENODEV, "Failed to match device\n"); for (i = 0; i < devtype->nr_uart; i++) { regcfg.name = sc16is7xx_regmap_name(i); |