Skip to content

Commit e6b03ab

Browse files
KanjiMonsteramalon
authored andcommitted
MIPS: AR7: Defer registration of GPIO
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: 14e85c0 ("gpio: remove gpio_descs global array") Signed-off-by: Jonas Gorski <[email protected]> Reviewed-by: Florian Fainelli <[email protected]> Cc: Ralf Baechle <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: Yoshihiro YUNOMAE <[email protected]> Cc: Nicolas Schichan <[email protected]> Cc: [email protected] Cc: [email protected] Cc: <[email protected]> # 3.19+ Patchwork: https://patchwork.linux-mips.org/patch/17542/ Signed-off-by: James Hogan <[email protected]>
1 parent ea4b3af commit e6b03ab

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

arch/mips/ar7/platform.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,10 @@ static int __init ar7_register_devices(void)
653653
u32 val;
654654
int res;
655655

656+
res = ar7_gpio_init();
657+
if (res)
658+
pr_warn("unable to register gpios: %d\n", res);
659+
656660
res = ar7_register_uarts();
657661
if (res)
658662
pr_err("unable to setup uart(s): %d\n", res);

arch/mips/ar7/prom.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,6 @@ void __init prom_init(void)
246246
ar7_init_cmdline(fw_arg0, (char **)fw_arg1);
247247
ar7_init_env((struct env_var *)fw_arg2);
248248
console_config();
249-
250-
ar7_gpio_init();
251249
}
252250

253251
#define PORT(offset) (KSEG1ADDR(AR7_REGS_UART0 + (offset * 4)))

0 commit comments

Comments
 (0)