Skip to content

Commit 7e2ead9

Browse files
hvilleneuvedoogregkh
authored andcommitted
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 <[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 195f01d commit 7e2ead9

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

drivers/tty/serial/sc16is7xx.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1796,18 +1796,13 @@ MODULE_ALIAS("spi:sc16is7xx");
17961796
#ifdef CONFIG_SERIAL_SC16IS7XX_I2C
17971797
static int sc16is7xx_i2c_probe(struct i2c_client *i2c)
17981798
{
1799-
const struct i2c_device_id *id = i2c_client_get_device_id(i2c);
18001799
const struct sc16is7xx_devtype *devtype;
18011800
struct regmap *regmaps[2];
18021801
unsigned int i;
18031802

1804-
if (i2c->dev.of_node) {
1805-
devtype = device_get_match_data(&i2c->dev);
1806-
if (!devtype)
1807-
return -ENODEV;
1808-
} else {
1809-
devtype = (struct sc16is7xx_devtype *)id->driver_data;
1810-
}
1803+
devtype = i2c_get_match_data(i2c);
1804+
if (!devtype)
1805+
return dev_err_probe(&i2c->dev, -ENODEV, "Failed to match device\n");
18111806

18121807
for (i = 0; i < devtype->nr_uart; i++) {
18131808
regcfg.name = sc16is7xx_regmap_name(i);

0 commit comments

Comments
 (0)