Skip to content

Commit 195f01d

Browse files
hvilleneuvedoogregkh
authored andcommitted
serial: sc16is7xx: use spi_get_device_match_data()
Use preferred spi_get_device_match_data() instead of device_get_match_data() and spi_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 3504c31 commit 195f01d

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

drivers/tty/serial/sc16is7xx.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1742,15 +1742,9 @@ static int sc16is7xx_spi_probe(struct spi_device *spi)
17421742
if (ret)
17431743
return ret;
17441744

1745-
if (spi->dev.of_node) {
1746-
devtype = device_get_match_data(&spi->dev);
1747-
if (!devtype)
1748-
return -ENODEV;
1749-
} else {
1750-
const struct spi_device_id *id_entry = spi_get_device_id(spi);
1751-
1752-
devtype = (struct sc16is7xx_devtype *)id_entry->driver_data;
1753-
}
1745+
devtype = spi_get_device_match_data(spi);
1746+
if (!devtype)
1747+
return dev_err_probe(&spi->dev, -ENODEV, "Failed to match device\n");
17541748

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

0 commit comments

Comments
 (0)