linux-mips
[Top] [All Lists]

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

To: Wim Van Sebroeck <wim@iguana.be>, linux-mips@linux-mips.org, linux-watchdog@vger.kernel.org, Manuel Lauss <manuel.lauss@googlemail.com>
Subject: [PATCH 2/3] WATCHDOG: mtx1-wdt: request gpio before using it
From: Florian Fainelli <florian@openwrt.org>
Date: Thu, 2 Jun 2011 14:54:20 +0200
Cc: stable@kernel.org
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:sender:from:to:subject:date:user-agent :organization:cc:mime-version:content-type:content-transfer-encoding :message-id; bh=gAApRguzQVtjd2qJOo9OPNZMZm6AXgRxbhAC6T13dOQ=; b=iC3VU/dEvEnQE6jnxra9pWgQn+WCBHx+wjvE/+/RVAbOhTx+eX7sTqplmj5qP3G5IO ngcAyh0brisqGxdu4/bK5vE53o+/dZiKFCVl+WtqUDjh7v3ha10XSgiGwI6sNKlweOMC kvvdeJvufPWJbLbscTHmf9wXCkQB6VI/aFH5M=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:from:to:subject:date:user-agent:organization:cc:mime-version :content-type:content-transfer-encoding:message-id; b=SG884ZPSDgTfG+yxgAjJDa47DXzxIdprwmmLkvco5J9BOlYd8QobEDKBiuHeqg52SB +qssx9GoL/ICy7T0spm3S4YCG7aBAH8Z8blV4g+8ynwlSszmdcESm5gf/aZTTlUVIimt 3CNNZE34lJjxYl4wO4/moLZd47fpy5DydDhGA=
Organization: OpenWrt
Sender: linux-mips-bounce@linux-mips.org
User-agent: KMail/1.13.6 (Linux/2.6.38-9-generic; KDE/4.6.2; x86_64; ; )
Otherwise, the gpiolib autorequest feature will produce a WARN_ON():

WARNING: at drivers/gpio/gpiolib.c:101 0x8020ec6c()
autorequest GPIO-215
[...]

CC: stable@kernel.org
Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
diff --git a/drivers/watchdog/mtx-1_wdt.c b/drivers/watchdog/mtx-1_wdt.c
index 63df28c..16086f8 100644
--- a/drivers/watchdog/mtx-1_wdt.c
+++ b/drivers/watchdog/mtx-1_wdt.c
@@ -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);
-- 
1.7.4.1


<Prev in Thread] Current Thread [Next in Thread>