mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH] gpio: orion: Do not overwrite device id
Date: Thu,  4 Feb 2021 11:49:48 +0100	[thread overview]
Message-ID: <20210204104948.30500-1-s.hauer@pengutronix.de> (raw)

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

Signed-off-by: Sascha Hauer <s.hauer@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


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

                 reply	other threads:[~2021-02-04 10:49 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210204104948.30500-1-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox