public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Jürg Billeter" <j@bitron.ch>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Gigi Joseph" <gigi.joseph@gmail.com>,
	"Colin Ian King" <colin.king@canonical.com>,
	linux-kernel@vger.kernel.org, "Jürg Billeter" <j@bitron.ch>
Subject: [PATCH 2/3] ti-st: st_kim: fix nshutdown_gpio in get_platform_data
Date: Wed, 24 Jun 2015 12:24:05 +0200	[thread overview]
Message-ID: <1435141446-27236-2-git-send-email-j@bitron.ch> (raw)
In-Reply-To: <1435141446-27236-1-git-send-email-j@bitron.ch>

Use of_get_named_gpio instead of of_property_read_u32.

Signed-off-by: Jürg Billeter <j@bitron.ch>
---
 drivers/misc/ti-st/st_kim.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/misc/ti-st/st_kim.c b/drivers/misc/ti-st/st_kim.c
index af71584..8df8faa 100644
--- a/drivers/misc/ti-st/st_kim.c
+++ b/drivers/misc/ti-st/st_kim.c
@@ -38,6 +38,7 @@
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
+#include <linux/of_gpio.h>
 
 #define MAX_ST_DEVICES	3	/* Imagine 1 on each UART for now */
 static struct platform_device *st_kim_devices[MAX_ST_DEVICES];
@@ -749,7 +750,7 @@ static struct ti_st_plat_data *get_platform_data(struct device *dev)
 {
 	struct device_node *np = dev->of_node;
 	const u32 *dt_property;
-	int len;
+	int len, gpio;
 
 	dt_pdata = kzalloc(sizeof(*dt_pdata), GFP_KERNEL);
 
@@ -761,8 +762,14 @@ static struct ti_st_plat_data *get_platform_data(struct device *dev)
 	dt_property = of_get_property(np, "dev_name", &len);
 	if (dt_property)
 		memcpy(&dt_pdata->dev_name, dt_property, len);
-	of_property_read_u32(np, "nshutdown_gpio",
-			     &dt_pdata->nshutdown_gpio);
+
+	gpio = of_get_named_gpio(np, "nshutdown_gpio", 0);
+	if (gpio < 0) {
+		kfree(dt_pdata);
+		return ERR_PTR(gpio);
+	}
+	dt_pdata->nshutdown_gpio = gpio;
+
 	of_property_read_u32(np, "flow_cntrl", &dt_pdata->flow_cntrl);
 	of_property_read_u32(np, "baud_rate", &dt_pdata->baud_rate);
 
-- 
2.4.3


  reply	other threads:[~2015-06-24 11:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-24 10:24 [PATCH 1/3] ti-st: st_kim: use ERR_PTR(-ENOMEM) instead of NULL Jürg Billeter
2015-06-24 10:24 ` Jürg Billeter [this message]
2015-06-24 15:31   ` [PATCH 2/3] ti-st: st_kim: fix nshutdown_gpio in get_platform_data Peter Hurley
2015-06-24 15:39     ` Jürg Billeter
2015-06-24 15:49       ` Peter Hurley
2015-06-24 10:24 ` [PATCH 3/3] ti-st: st_kim: use gpio_set_value_cansleep to fix warning Jürg Billeter

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=1435141446-27236-2-git-send-email-j@bitron.ch \
    --to=j@bitron.ch \
    --cc=colin.king@canonical.com \
    --cc=gigi.joseph@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.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