diff options
Diffstat (limited to 'drivers/gpio/gpio-clps711x.c')
-rw-r--r-- | drivers/gpio/gpio-clps711x.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/drivers/gpio/gpio-clps711x.c b/drivers/gpio/gpio-clps711x.c index 44f40c36e4..a59bdd212a 100644 --- a/drivers/gpio/gpio-clps711x.c +++ b/drivers/gpio/gpio-clps711x.c @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: GPL-2.0+ +// SPDX-License-Identifier: GPL-2.0-or-later /* Author: Alexander Shiyan <shc_work@mail.ru> */ #include <init.h> @@ -7,16 +7,13 @@ #include <linux/err.h> #include <linux/basic_mmio_gpio.h> -static int clps711x_gpio_probe(struct device_d *dev) +static int clps711x_gpio_probe(struct device *dev) { struct resource *iores; - int err, id = dev->id; + int err, id = of_alias_get_id(dev->of_node, "gpio"); void __iomem *dat, *dir = NULL, *dir_inv = NULL; struct bgpio_chip *bgc; - if (dev->device_node) - id = of_alias_get_id(dev->device_node, "gpio"); - if (id < 0 || id > 4) return -ENODEV; @@ -25,17 +22,15 @@ static int clps711x_gpio_probe(struct device_d *dev) return PTR_ERR(iores); dat = IOMEM(iores->start); + iores = dev_request_mem_resource(dev, 1); + if (IS_ERR(iores)) + return PTR_ERR(iores); + switch (id) { case 3: - iores = dev_request_mem_resource(dev, 1); - if (IS_ERR(iores)) - return PTR_ERR(iores); dir_inv = IOMEM(iores->start); break; default: - iores = dev_request_mem_resource(dev, 1); - if (IS_ERR(iores)) - return PTR_ERR(iores); dir = IOMEM(iores->start); break; } @@ -64,12 +59,13 @@ out_err: return err; } -static struct of_device_id __maybe_unused clps711x_gpio_dt_ids[] = { +static const struct of_device_id __maybe_unused clps711x_gpio_dt_ids[] = { { .compatible = "cirrus,ep7209-gpio", }, { /* sentinel */ } }; +MODULE_DEVICE_TABLE(of, clps711x_gpio_dt_ids); -static struct driver_d clps711x_gpio_driver = { +static struct driver clps711x_gpio_driver = { .name = "clps711x-gpio", .probe = clps711x_gpio_probe, .of_compatible = DRV_OF_COMPAT(clps711x_gpio_dt_ids), |