mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 3/4] pinctrl: AT91: Only use of_alias_get_id when probed from devicetree
Date: Mon,  8 Sep 2014 15:23:41 +0200	[thread overview]
Message-ID: <1410182622-22876-4-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1410182622-22876-1-git-send-email-s.hauer@pengutronix.de>

If probed from platform data we have to use dev->id instead.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/pinctrl/pinctrl-at91.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c
index e212f7a..3c194df 100644
--- a/drivers/pinctrl/pinctrl-at91.c
+++ b/drivers/pinctrl/pinctrl-at91.c
@@ -618,10 +618,15 @@ static int at91_gpio_probe(struct device_d *dev)
 	struct at91_gpio_chip *at91_gpio;
 	struct clk *clk;
 	int ret;
-	int alias_idx = of_alias_get_id(dev->device_node, "gpio");
+	int alias_idx;
 
 	BUG_ON(dev->id > MAX_GPIO_BANKS);
 
+	if (dev->device_node)
+		alias_idx = of_alias_get_id(dev->device_node, "gpio");
+	else
+		alias_idx = dev->id;
+
 	at91_gpio = &gpio_chip[alias_idx];
 
 	clk = clk_get(dev, NULL);
-- 
2.1.0


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

  parent reply	other threads:[~2014-09-08 13:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-08 13:23 AT91 pinctrl/gpio fixes Sascha Hauer
2014-09-08 13:23 ` [PATCH 1/4] ARM: AT91: Add missing include Sascha Hauer
2014-09-08 13:23 ` [PATCH 2/4] ARM: AT91: Make gpio mux functions inline Sascha Hauer
2014-09-08 13:23 ` Sascha Hauer [this message]
2014-09-08 13:23 ` [PATCH 4/4] pinctrl: AT91: use alias_idx to calculate the base gpio number Sascha Hauer
2014-09-08 13:36 ` AT91 pinctrl/gpio fixes Raphaël Poggi
2014-09-09  8:19   ` Sascha Hauer
2014-09-09  8:47     ` Raphaël Poggi

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=1410182622-22876-4-git-send-email-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