MIPS: 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.

Signed-off-by: Florian Fainelli <florian@openwrt.org>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

authored by Florian Fainelli and committed by Ralf Baechle a1b021d3 619e2263

+12 -2
+12 -2
arch/mips/alchemy/mtx-1/platform.c
··· 1 1 /* 2 2 * MTX-1 platform devices registration 3 3 * 4 - * Copyright (C) 2007, Florian Fainelli <florian@openwrt.org> 4 + * Copyright (C) 2007-2009, Florian Fainelli <florian@openwrt.org> 5 5 * 6 6 * This program is free software; you can redistribute it and/or modify 7 7 * it under the terms of the GNU General Public License as published by ··· 142 142 143 143 static int __init mtx1_register_devices(void) 144 144 { 145 - gpio_direction_input(207); 145 + int rc; 146 + 147 + rc = gpio_request(mtx1_gpio_button[0].gpio, 148 + mtx1_gpio_button[0].desc); 149 + if (rc < 0) { 150 + printk(KERN_INFO "mtx1: failed to request %d\n", 151 + mtx1_gpio_button[0].gpio); 152 + goto out; 153 + } 154 + gpio_direction_input(mtx1_gpio_button[0].gpio); 155 + out: 146 156 return platform_add_devices(mtx1_devs, ARRAY_SIZE(mtx1_devs)); 147 157 } 148 158