Skip to contentSkip to conversation

mtx-1: request button GPIO before setting its direction

PATCH Applied Florian Fainelli 2 participants 2 messages Aug 1, 2009 – Aug 2, 2009 MIPS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mtx-1: request button GPIO before setting its direction

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.

---

arch/mips/alchemy/mtx-1/platform.c +12 -2
index 8b5914d..e30e42a 100644
@@ -1,7 +1,7 @@
 /*
  * MTX-1 platform devices registration
  *
- * Copyright (C) 2007, Florian Fainelli <[email protected]>
+ * Copyright (C) 2007-2009, Florian Fainelli <[email protected]>
  *
  * 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));
 }
 
Applied
#1 lore raw
Quoted 13 lines · Florian Fainelli

From: Florian Fainelli <[email protected]>
Date: Sat, 1 Aug 2009 23:51:20 +0200
To: Ralf Baechle <[email protected]>
Cc: [email protected], Manuel Lauss <[email protected]>
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
Quoted 8 lines

[<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