[PATCH] gpio: orion: Do not overwrite device id

Sascha Hauer s.hauer at pengutronix.de
Thu Feb 4 05:49:48 EST 2021


The driver has no busyness manipulating the id field in the given device
struct. Leave it untouched.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 drivers/gpio/gpio-orion.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/gpio/gpio-orion.c b/drivers/gpio/gpio-orion.c
index 63ef966edf..ba2729d1f0 100644
--- a/drivers/gpio/gpio-orion.c
+++ b/drivers/gpio/gpio-orion.c
@@ -91,10 +91,7 @@ static int orion_gpio_probe(struct device_d *dev)
 {
 	struct resource *iores;
 	struct orion_gpio_chip *gpio;
-
-	dev->id = of_alias_get_id(dev->device_node, "gpio");
-	if (dev->id < 0)
-		return dev->id;
+	int id;
 
 	gpio = xzalloc(sizeof(*gpio));
 	iores = dev_request_mem_resource(dev, 0);
@@ -105,7 +102,12 @@ static int orion_gpio_probe(struct device_d *dev)
 	gpio->regs = IOMEM(iores->start);
 	gpio->chip.dev = dev;
 	gpio->chip.ops = &orion_gpio_ops;
-	gpio->chip.base = dev->id * 32;
+
+	id = of_alias_get_id(dev->device_node, "gpio");
+	if (id < 0)
+		return id;
+
+	gpio->chip.base = id * 32;
 	gpio->chip.ngpio = 32;
 	of_property_read_u32(dev->device_node, "ngpios", &gpio->chip.ngpio);
 
-- 
2.20.1




More information about the barebox mailing list