gpio: pca953x: Use of_device_get_match_data()
authorThierry Reding <treding@nvidia.com>
Mon, 30 Apr 2018 07:38:14 +0000 (09:38 +0200)
committerLinus Walleij <linus.walleij@linaro.org>
Wed, 16 May 2018 12:35:24 +0000 (14:35 +0200)
Use of_device_get_match_data() instead of open-coding it.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpio-pca953x.c

index d2ead4b..9a06b8a 100644 (file)
@@ -810,13 +810,11 @@ static int pca953x_probe(struct i2c_client *client,
                chip->driver_data = i2c_id->driver_data;
        } else {
                const struct acpi_device_id *acpi_id;
-               const struct of_device_id *match;
+               struct device *dev = &client->dev;
 
-               match = of_match_device(pca953x_dt_ids, &client->dev);
-               if (match) {
-                       chip->driver_data = (int)(uintptr_t)match->data;
-               } else {
-                       acpi_id = acpi_match_device(pca953x_acpi_ids, &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;