Re: [PATCH] MIPS: bcm63xx: move bcm63xx_gpio_init() to bcm63xx_register_devices().

From: Maxime Bizon
Date: Mon Mar 16 2015 - 10:53:48 EST



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


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/