]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
MIPS: AR7: Defer registration of GPIO
authorJonas Gorski <jonas.gorski@gmail.com>
Sun, 29 Oct 2017 15:27:19 +0000 (16:27 +0100)
committerJames Hogan <jhogan@kernel.org>
Wed, 8 Nov 2017 12:44:26 +0000 (12:44 +0000)
When called from prom init code, ar7_gpio_init() will fail as it will
call gpiochip_add() which relies on a working kmalloc() to alloc
the gpio_desc array and kmalloc is not useable yet at prom init time.

Move ar7_gpio_init() to ar7_register_devices() (a device_initcall)
where kmalloc works.

Fixes: 14e85c0e69d5 ("gpio: remove gpio_descs global array")
Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Yoshihiro YUNOMAE <yoshihiro.yunomae.ez@hitachi.com>
Cc: Nicolas Schichan <nschichan@freebox.fr>
Cc: linux-mips@linux-mips.org
Cc: linux-serial@vger.kernel.org
Cc: <stable@vger.kernel.org> # 3.19+
Patchwork: https://patchwork.linux-mips.org/patch/17542/
Signed-off-by: James Hogan <jhogan@kernel.org>
arch/mips/ar7/platform.c
arch/mips/ar7/prom.c

index df7acea3747ad0b4547f3c67846215063d16d296..f2c9f90c5f13e071052da17d1c3b49e19a6e0344 100644 (file)
@@ -653,6 +653,10 @@ static int __init ar7_register_devices(void)
        u32 val;
        int res;
 
+       res = ar7_gpio_init();
+       if (res)
+               pr_warn("unable to register gpios: %d\n", res);
+
        res = ar7_register_uarts();
        if (res)
                pr_err("unable to setup uart(s): %d\n", res);
index 4fd83336131acf21bb09fba4070fe4b7ba471b63..dd53987a690ffdc12c5f87fd8ebade8d156faab5 100644 (file)
@@ -246,8 +246,6 @@ void __init prom_init(void)
        ar7_init_cmdline(fw_arg0, (char **)fw_arg1);
        ar7_init_env((struct env_var *)fw_arg2);
        console_config();
-
-       ar7_gpio_init();
 }
 
 #define PORT(offset) (KSEG1ADDR(AR7_REGS_UART0 + (offset * 4)))