gpio: pca953x: Switch to use device_get_match_data()
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Thu, 1 Aug 2019 17:39:35 +0000 (20:39 +0300)
committerBartosz Golaszewski <bgolaszewski@baylibre.com>
Fri, 2 Aug 2019 07:50:22 +0000 (09:50 +0200)
Instead of open coded variants, switch to direct use of
device_get_match_data().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
drivers/gpio/gpio-pca953x.c

index 378b206d2dc9495dc32c3ffc6fdf06e35262a31e..54cf019013209fad172a60c7857d4e399132b835 100644 (file)
@@ -949,19 +949,15 @@ static int pca953x_probe(struct i2c_client *client,
        if (i2c_id) {
                chip->driver_data = i2c_id->driver_data;
        } else {
-               const struct acpi_device_id *acpi_id;
-               struct device *dev = &client->dev;
-
-               chip->driver_data = (uintptr_t)of_device_get_match_data(dev);
-               if (!chip->driver_data) {
-                       acpi_id = acpi_match_device(pca953x_acpi_ids, dev);
-                       if (!acpi_id) {
-                               ret = -ENODEV;
-                               goto err_exit;
-                       }
-
-                       chip->driver_data = acpi_id->driver_data;
+               const void *match;
+
+               match = device_get_match_data(&client->dev);
+               if (!match) {
+                       ret = -ENODEV;
+                       goto err_exit;
                }
+
+               chip->driver_data = (uintptr_t)match;
        }
 
        i2c_set_clientdata(client, chip);