Skip to contentSkip to conversation

WATCHDOG: mtx1-wdt: request gpio before using it

PATCH Superseded Florian Fainelli 2 participants 3 messages Jun 2, 2011 – Jun 10, 2011

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 2/3 WATCHDOG: mtx1-wdt: request gpio before using it

Otherwise, the gpiolib autorequest feature will produce a WARN_ON():

WARNING: at drivers/gpio/gpiolib.c:101 0x8020ec6c()

autorequest GPIO-215
[...]

---

drivers/watchdog/mtx-1_wdt.c +5 -0
index 63df28c..16086f8 100644
@@ -214,6 +214,11 @@ static int __devinit mtx1_wdt_probe(struct platform_device *pdev)
 	int ret;
 
 	mtx1_wdt_device.gpio = pdev->resource[0].start;
+	ret = gpio_request(mtx1_wdt_device.gpio, "mtx1-wdt");
+	if (ret < 0) {
+		dev_err(&pdev->dev, "failed to request gpio");
+		return ret;
+	}
 
 	spin_lock_init(&mtx1_wdt_device.lock);
 	init_completion(&mtx1_wdt_device.stop);
Signature · 1 line
1.7.4.1
#1 lore raw
Quoted 14 lines · Florian Fainelli

Otherwise, the gpiolib autorequest feature will produce a WARN_ON():

WARNING: at drivers/gpio/gpiolib.c:101 0x8020ec6c()

autorequest GPIO-215
[...]

---

drivers/watchdog/mtx-1_wdt.c +0 -0
index 63df28c..16086f8 100644

drivers/watchdog/mtx-1_wdt.c static int __devinit mtx1_wdt_probe(struct platform_device *pdev) · line 221

Quoted 8 lines
drivers/watchdog/mtx-1_wdt.c +5 -0
@@ -214,6 +214,11 @@ static int __devinit mtx1_wdt_probe(struct platform_device *pdev)
 	int ret;
 
 	mtx1_wdt_device.gpio = pdev->resource[0].start;
+	ret = gpio_request(mtx1_wdt_device.gpio, "mtx1-wdt");
+	if (ret < 0) {
+		dev_err(&pdev->dev, "failed to request gpio");
+		return ret;
+	}

Could you use gpio_request_one() here to make sure the GPIO is in the correct direction first?

Jamie

#2 lore raw

Hello Jamie,

Quoted 21 lines · On Tuesday 07 June 2011 11:58:47 Jamie Iles wrote:
Quoted 20 lines · Florian Fainelli

Otherwise, the gpiolib autorequest feature will produce a WARN_ON():

WARNING: at drivers/gpio/gpiolib.c:101 0x8020ec6c()

autorequest GPIO-215
[...]

---

drivers/watchdog/mtx-1_wdt.c +0 -0
index 63df28c..16086f8 100644
@@ -214,6 +214,11 @@ static int __devinit mtx1_wdt_probe(struct
 platform_device *pdev)
 
 	int ret;
 
 	mtx1_wdt_device.gpio = pdev->resource[0].start;
 
Quoted 8 lines

drivers/watchdog/mtx-1_wdt.c static int __devinit mtx1_wdt_probe(struct platform_device *pdev) · line 221

Quoted 5 lines
drivers/watchdog/mtx-1_wdt.c +5 -0
+	ret = gpio_request(mtx1_wdt_device.gpio, "mtx1-wdt");
+	if (ret < 0) {
+		dev_err(&pdev->dev, "failed to request gpio");
+		return ret;
+	}

Could you use gpio_request_one() here to make sure the GPIO is in the correct direction first?

Makes sense, I will respin a v2 of these.
--
Florian