* [PATCH] mtx-1: request button GPIO before setting its direction
@ 2009-08-01 21:51 Florian Fainelli
2009-08-02 18:37 ` Ralf Baechle
0 siblings, 1 reply; 2+ messages in thread
From: Florian Fainelli @ 2009-08-01 21:51 UTC (permalink / raw)
To: Ralf Baechle; +Cc: linux-mips, Manuel Lauss
This patch fixes the following warning at boot time:
WARNING: at drivers/gpio/gpiolib.c:83 0x8021d5e0()
autorequest GPIO-207
Modules linked in:
Call Trace:[<8011e0ec>] 0x8011e0ec
[<80110a28>] 0x80110a28
[<80110a28>] 0x80110a28
[..snip..]
The current code does not request the GPIO and attempts
to set its direction, which is a violation of the GPIO API.
This patch also unhardcode the GPIO we request and use
the one we defined in the button driver.
Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
diff --git a/arch/mips/alchemy/mtx-1/platform.c b/arch/mips/alchemy/mtx-1/platform.c
index 8b5914d..e30e42a 100644
--- a/arch/mips/alchemy/mtx-1/platform.c
+++ b/arch/mips/alchemy/mtx-1/platform.c
@@ -1,7 +1,7 @@
/*
* MTX-1 platform devices registration
*
- * Copyright (C) 2007, Florian Fainelli <florian@openwrt.org>
+ * Copyright (C) 2007-2009, Florian Fainelli <florian@openwrt.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -142,7 +142,17 @@ static struct __initdata platform_device * mtx1_devs[] = {
static int __init mtx1_register_devices(void)
{
- gpio_direction_input(207);
+ int rc;
+
+ rc = gpio_request(mtx1_gpio_button[0].gpio,
+ mtx1_gpio_button[0].desc);
+ if (rc < 0) {
+ printk(KERN_INFO "mtx1: failed to request %d\n",
+ mtx1_gpio_button[0].gpio);
+ goto out;
+ }
+ gpio_direction_input(mtx1_gpio_button[0].gpio);
+out:
return platform_add_devices(mtx1_devs, ARRAY_SIZE(mtx1_devs));
}
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] mtx-1: request button GPIO before setting its direction
2009-08-01 21:51 [PATCH] mtx-1: request button GPIO before setting its direction Florian Fainelli
@ 2009-08-02 18:37 ` Ralf Baechle
0 siblings, 0 replies; 2+ messages in thread
From: Ralf Baechle @ 2009-08-02 18:37 UTC (permalink / raw)
To: Florian Fainelli; +Cc: linux-mips, Manuel Lauss
On Sat, Aug 01, 2009 at 11:51:20PM +0200, Florian Fainelli wrote:
> From: Florian Fainelli <florian@openwrt.org>
> Date: Sat, 1 Aug 2009 23:51:20 +0200
> To: Ralf Baechle <ralf@linux-mips.org>
> Cc: linux-mips@linux-mips.org, Manuel Lauss <manuel.lauss@googlemail.com>
> Subject: [PATCH] mtx-1: request button GPIO before setting its direction
> Content-Type: text/plain;
> charset="utf-8"
>
> This patch fixes the following warning at boot time:
> WARNING: at drivers/gpio/gpiolib.c:83 0x8021d5e0()
> autorequest GPIO-207
> Modules linked in:
> Call Trace:[<8011e0ec>] 0x8011e0ec
> [<80110a28>] 0x80110a28
> [<80110a28>] 0x80110a28
> [..snip..]
>
> The current code does not request the GPIO and attempts
> to set its direction, which is a violation of the GPIO API.
> This patch also unhardcode the GPIO we request and use
> the one we defined in the button driver.
Thanks, applied.
Ralf
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-08-02 18:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-01 21:51 [PATCH] mtx-1: request button GPIO before setting its direction Florian Fainelli
2009-08-02 18:37 ` Ralf Baechle
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).