[au1000] prevent error messages on the requesting of the GPIO buttons
[openwrt-10.03/.git] / target / linux / au1000 / patches-2.6.30 / 007-gpio_request_button.patch
1 diff --git a/arch/mips/alchemy/mtx-1/platform.c b/arch/mips/alchemy/mtx-1/platform.c
2 index 8b5914d..e30e42a 100644
3 --- a/arch/mips/alchemy/mtx-1/platform.c
4 +++ b/arch/mips/alchemy/mtx-1/platform.c
5 @@ -1,7 +1,7 @@
6  /*
7   * MTX-1 platform devices registration
8   *
9 - * Copyright (C) 2007, Florian Fainelli <florian@openwrt.org>
10 + * Copyright (C) 2007-2009, Florian Fainelli <florian@openwrt.org>
11   *
12   * This program is free software; you can redistribute it and/or modify
13   * it under the terms of the GNU General Public License as published by
14 @@ -142,7 +142,17 @@ static struct __initdata platform_device * mtx1_devs[] = {
15  
16  static int __init mtx1_register_devices(void)
17  {
18 -       gpio_direction_input(207);
19 +       int rc;
20 +
21 +       rc = gpio_request(mtx1_gpio_button[0].gpio,
22 +                                       mtx1_gpio_button[0].desc);
23 +       if (rc < 0) {
24 +               printk(KERN_INFO "mtx1: failed to request %d\n",
25 +                                       mtx1_gpio_button[0].gpio);
26 +               goto out;
27 +       }
28 +       gpio_direction_input(mtx1_gpio_button[0].gpio);
29 +out:
30         return platform_add_devices(mtx1_devs, ARRAY_SIZE(mtx1_devs));
31  }
32