On Thu, 2015-03-12 at 17:00 +0100, Nicolas Schichan wrote: > When called from prom init code, bcm63xx_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 bcm63xx_gpio_init() to bcm63xx_register_devices() (an > arch_initcall) where kmalloc works. no that patch is completely bogus: 1) bcm63xx_gpio_init() does more than registering the gpio_chip: look at bcm63xx_gpio_out_low_reg_init(). We want at least the low lever helpers bcm_gpio_readl()/writel() to work early. 2) look at board_register_devices() in board_bcm963xx.c, it uses the gpio API, but is called during arch_initcall() (there was an attempt to move it later, but it has been reverted) so you cannot move that gpiochip registration later as-is, more refactoring and *testing* is required. -- Maxime