]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
serial: sc16is7xx: Switch to use device_get_match_data()
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Mon, 18 Mar 2019 10:29:16 +0000 (12:29 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 27 Mar 2019 15:30:51 +0000 (00:30 +0900)
Instead of open coded variants, switch to direct use of
device_get_match_data().

Tested-By: Georgii Staroselskii <georgii.staroselskii@emlid.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/sc16is7xx.c

index 7240c86082561cc4eeac911eb29fd8a8baeba07d..fe4d2da77301155212a5e07d9dfea233ab9bce29 100644 (file)
@@ -14,9 +14,9 @@
 #include <linux/device.h>
 #include <linux/gpio/driver.h>
 #include <linux/i2c.h>
+#include <linux/mod_devicetable.h>
 #include <linux/module.h>
 #include <linux/of.h>
-#include <linux/of_device.h>
 #include <linux/property.h>
 #include <linux/regmap.h>
 #include <linux/serial_core.h>
@@ -1393,13 +1393,9 @@ static int sc16is7xx_spi_probe(struct spi_device *spi)
                return ret;
 
        if (spi->dev.of_node) {
-               const struct of_device_id *of_id =
-                       of_match_device(sc16is7xx_dt_ids, &spi->dev);
-
-               if (!of_id)
+               devtype = device_get_match_data(&spi->dev);
+               if (!devtype)
                        return -ENODEV;
-
-               devtype = (struct sc16is7xx_devtype *)of_id->data;
        } else {
                const struct spi_device_id *id_entry = spi_get_device_id(spi);
 
@@ -1454,13 +1450,9 @@ static int sc16is7xx_i2c_probe(struct i2c_client *i2c,
        struct regmap *regmap;
 
        if (i2c->dev.of_node) {
-               const struct of_device_id *of_id =
-                               of_match_device(sc16is7xx_dt_ids, &i2c->dev);
-
-               if (!of_id)
+               devtype = device_get_match_data(&i2c->dev);
+               if (!devtype)
                        return -ENODEV;
-
-               devtype = (struct sc16is7xx_devtype *)of_id->data;
        } else {
                devtype = (struct sc16is7xx_devtype *)id->driver_data;
                flags = IRQF_TRIGGER_FALLING;