bcm63xx: early registering of gpiochip
PATCH 3/3 bcm63xx: early registering of gpiochip
This patch makes the gpiochip be registered earlier in the prom code. This allows GPIO-based board detection to be made earlier.
Tested-by Maxime Bizon <[email protected]>
Signed-off-by Florian Fainelli <[email protected]>
---
arch/mips/bcm63xx/gpio.c +1 -2
@@ -120,9 +120,8 @@ static struct gpio_chip bcm63xx_gpio_chip = { .ngpio = BCM63XX_GPIO_COUNT, }; -static int __init bcm63xx_gpio_init (void ) +int __init bcm63xx_gpio_init (void ) {printk (KERN_INFO "registering %d GPIOs\n" ,BCM63XX_GPIO_COUNT );return gpiochip_add (&bcm63xx_gpio_chip); } -arch_initcall (bcm63xx_gpio_init);
arch/mips/bcm63xx/prom.c +4 -0
@@ -13,6 +13,7 @@#include <bcm63xx_cpu.h> #include <bcm63xx_io.h> #include <bcm63xx_regs.h> +#include <bcm63xx_gpio.h> void __init prom_init (void ) {
@@ -40,6 +41,9 @@ void __init prom_init(void)/* do low level board init */ board_prom_init (); + +/* early register gpio */ +bcm63xx_gpio_init (); }void __init prom_free_prom_memory (void )
arch/mips/include/asm/mach-bcm63xx/bcm63xx_gpio.h +2 -0
@@ -1,6 +1,8 @@#ifndef BCM63XX_GPIO_H #define BCM63XX_GPIO_H +int __init bcm63xx_gpio_init (void ); +/* all helpers will BUG() if gpio count is >= 37. */ #define BCM63XX_GPIO_COUNT 37
Quoted 35 lines · Florian Fainelli
This patch makes the gpiochip be registered earlier in the prom code. This allows GPIO-based board detection to be made earlier.
Tested-by Maxime Bizon <[email protected]>Signed-off-by Florian Fainelli <[email protected]>---
arch/mips/bcm63xx/gpio.c +1
-2@@ -120,9 +120,8 @@ static struct gpio_chip bcm63xx_gpio_chip = { .ngpio = BCM63XX_GPIO_COUNT, }; -static int __init bcm63xx_gpio_init (void ) +int __init bcm63xx_gpio_init (void ) {printk (KERN_INFO "registering %d GPIOs\n" ,BCM63XX_GPIO_COUNT );return gpiochip_add (&bcm63xx_gpio_chip); } -arch_initcall (bcm63xx_gpio_init);arch/mips/bcm63xx/prom.c +1
-0@@ -13,6 +13,7 @@#include <bcm63xx_cpu.h> #include <bcm63xx_io.h> #include <bcm63xx_regs.h> +#include <bcm63xx_gpio.h> void __init prom_init (void ) {
arch/mips/bcm63xx/prom.c void __init prom_init(void) · line 45
Quoted 5 lines
arch/mips/bcm63xx/prom.c +2
-0@@ -40,6 +41,9 @@ void __init prom_init(void)/* do low level board init */ board_prom_init (); + +/* early register gpio */
That word order sounds odd ...
arch/mips/include/asm/mach-bcm63xx/bcm63xx_gpio.h line 4
Quoted 13 lines
arch/mips/bcm63xx/prom.c +1
-0+bcm63xx_gpio_init (); }void __init prom_free_prom_memory (void )arch/mips/include/asm/mach-bcm63xx/bcm63xx_gpio.h +1
-0@@ -1,6 +1,8 @@#ifndef BCM63XX_GPIO_H #define BCM63XX_GPIO_H +int __init bcm63xx_gpio_init (void );
It is not necessary to declare a function as __init. But if you do you better include <linux/init.h> first. With this patch you'd rely on init.h having previously included which eventually when the context changes will blow up.
And not last, the patch seems to reject ...
Ralf