gpio: add a userspace chardev ABI for GPIOs
Hi Linus,
Commit 3c702e99 ("gpio: add a userspace chardev ABI for GPIOs") breaks booting on all my m68k/ColdFire platforms (with MMU and without). They all hang during the boot up, the last console trace is:
...
NR_IRQS:256
clocksource: pit: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1467848399018 ns Calibrating delay loop... 1042.02 BogoMIPS (lpj=5210112) pid_max: default: 32768 minimum: 301 Mount-cache hash table entries: 2048 (order: 0, 8192 bytes) Mountpoint-cache hash table entries: 2048 (order: 0, 8192 bytes)
I traced this back to gpiochip_add_data() when it does the device_add() call. On my platforms this is being called before gpiolib_dev_init(), and this seems to be the issue. So gpio_bus_type has not been registered as a bus yet.
The lowest level ColdFire gpio code (arch/m68k/coldfire/gpio.c) calls its setup from core_initcall() - and this will call gpiochip_add_data(). This is being called first, before the core_initcall() for gpiolib_dev_init().
I can fix by changing the core_initcall() in coldfire/gpio.c to something like postcore_initcall() and that fixes the boot problem.
What do you think?
Would you expect that all callers of gpiochip_add_data() should be after core_initcall()?
Regards
Greg
Quoted 20 lines · Greg Ungerer
Hi Linus,
Commit
3c702e99("gpio: add a userspace chardev ABI for GPIOs") breaks booting on all my m68k/ColdFire platforms (with MMU and without). They all hang during the boot up, the last console trace is:...
NR_IRQS:256
clocksource: pit: mask:0xffffffffmax_cycles:0xffffffff,max_idle_ns: 1467848399018 ns Calibrating delay loop... 1042.02 BogoMIPS (lpj=5210112)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 2048 (order: 0, 8192 bytes) Mountpoint-cache hash table entries: 2048 (order: 0, 8192 bytes)I traced this back to
gpiochip_add_data()when it does thedevice_add()call. On my platforms this is being called beforegpiolib_dev_init(), and this seems to be the issue. Sogpio_bus_typehas not been registered as a bus yet.
Quoted 4 lines
The lowest level ColdFire gpio code (
arch/m68k/coldfire/gpio.c) calls its setup fromcore_initcall()- and this will callgpiochip_add_data(). This is being called first, before thecore_initcall()forgpiolib_dev_init().
We got a similar report with an alternative workaround:
https://lkml.org/lkml/2016/3/29/714
Quoted 7 lines
I can fix by changing the
core_initcall()incoldfire/gpio.cto something likepostcore_initcall()and that fixes the boot problem.What do you think?
Would you expect that all callers ofgpiochip_add_data()should be aftercore_initcall()?
As you can see on the discussion thread above, there are several candidate fixes - I have been away from GPIO for too long to make a good decision, but I'm sure Linus can make the call.
Quoted 20 lines · Greg Ungerer
Hi Linus,
Commit
3c702e99("gpio: add a userspace chardev ABI for GPIOs") breaks booting on all my m68k/ColdFire platforms (with MMU and without). They all hang during the boot up, the last console trace is:...
NR_IRQS:256
clocksource: pit: mask:0xffffffffmax_cycles:0xffffffff,max_idle_ns: 1467848399018 ns Calibrating delay loop... 1042.02 BogoMIPS (lpj=5210112)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 2048 (order: 0, 8192 bytes) Mountpoint-cache hash table entries: 2048 (order: 0, 8192 bytes)I traced this back to
gpiochip_add_data()when it does thedevice_add()call. On my platforms this is being called beforegpiolib_dev_init(), and this seems to be the issue. Sogpio_bus_typehas not been registered as a bus yet.
Quoted 4 lines
The lowest level ColdFire gpio code (
arch/m68k/coldfire/gpio.c) calls its setup fromcore_initcall()- and this will callgpiochip_add_data(). This is being called first, before thecore_initcall()forgpiolib_dev_init().
We got a similar report with an alternative workaround:
https://lkml.org/lkml/2016/3/29/714
Quoted 7 lines
I can fix by changing the
core_initcall()incoldfire/gpio.cto something likepostcore_initcall()and that fixes the boot problem.What do you think?
Would you expect that all callers ofgpiochip_add_data()should be aftercore_initcall()?
As you can see on the discussion thread above, there are several candidate fixes - I have been away from GPIO for too long to make a good decision, but I'm sure Linus can make the call.
Hi Alexandre,
Quoted 34 lines · Alexandre Courbot
Quoted 20 lines · Greg Ungerer
Hi Linus,
Commit
3c702e99("gpio: add a userspace chardev ABI for GPIOs") breaks booting on all my m68k/ColdFire platforms (with MMU and without). They all hang during the boot up, the last console trace is:...
NR_IRQS:256
clocksource: pit: mask:0xffffffffmax_cycles:0xffffffff,max_idle_ns: 1467848399018 ns Calibrating delay loop... 1042.02 BogoMIPS (lpj=5210112)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 2048 (order: 0, 8192 bytes) Mountpoint-cache hash table entries: 2048 (order: 0, 8192 bytes)I traced this back to
gpiochip_add_data()when it does thedevice_add()call. On my platforms this is being called beforegpiolib_dev_init(), and this seems to be the issue. Sogpio_bus_typehas not been registered as a bus yet.Quoted 4 lines
The lowest level ColdFire gpio code (
arch/m68k/coldfire/gpio.c) calls its setup fromcore_initcall()- and this will callgpiochip_add_data(). This is being called first, before thecore_initcall()forgpiolib_dev_init().We got a similar report with an alternative workaround:
https://lkml.org/lkml/2016/3/29/714
Quoted 4 lines
I can fix by changing the
core_initcall()incoldfire/gpio.cto something likepostcore_initcall()and that fixes the boot problem.
Quoted 7 lines
Quoted 3 lines
What do you think?
Would you expect that all callers ofgpiochip_add_data()should be aftercore_initcall()?As you can see on the discussion thread above, there are several candidate fixes - I have been away from GPIO for too long to make a good decision, but I'm sure Linus can make the call.
Thanks for letting me know. I wasn't going to rush any fixes, happy to let Linus decide how to handle it.
Regards
Greg
Quoted 34 lines · Alexandre Courbot
Quoted 20 lines · Greg Ungerer
Hi Linus,
Commit
3c702e99("gpio: add a userspace chardev ABI for GPIOs") breaks booting on all my m68k/ColdFire platforms (with MMU and without). They all hang during the boot up, the last console trace is:... NR_IRQS:256 clocksource: pit: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1467848399018 ns Calibrating delay loop... 1042.02 BogoMIPS (lpj=5210112) pid_max: default: 32768 minimum: 301 Mount-cache hash table entries: 2048 (order: 0, 8192 bytes) Mountpoint-cache hash table entries: 2048 (order: 0, 8192 bytes)I traced this back to
gpiochip_add_data()when it does thedevice_add()call. On my platforms this is being called beforegpiolib_dev_init(), and this seems to be the issue. Sogpio_bus_typehas not been registered as a bus yet.Quoted 4 lines
The lowest level ColdFire gpio code (
arch/m68k/coldfire/gpio.c) calls its setup fromcore_initcall()- and this will callgpiochip_add_data(). This is being called first, before thecore_initcall()forgpiolib_dev_init().We got a similar report with an alternative workaround:
https://lkml.org/lkml/2016/3/29/714
Quoted 4 lines
I can fix by changing the
core_initcall()incoldfire/gpio.cto something likepostcore_initcall()and that fixes the boot problem.
Quoted 8 lines
Quoted 3 lines
What do you think?
Would you expect that all callers ofgpiochip_add_data()should be aftercore_initcall()?As you can see on the discussion thread above, there are several candidate fixes - I have been away from GPIO for too long to make a good decision, but I'm sure Linus can make the call.
I've started looking into a clean solution, as you had suggested in the other thread. It will take a while, though. For the time being, and/or unless someone else steps in who knows gpio much better than I do, I think some workarund like my proposed hack should get committed into the branch.
Guenter
Quoted 34 lines · Alexandre Courbot
Quoted 20 lines · Greg Ungerer
Hi Linus,
Commit
3c702e99("gpio: add a userspace chardev ABI for GPIOs") breaks booting on all my m68k/ColdFire platforms (with MMU and without). They all hang during the boot up, the last console trace is:... NR_IRQS:256 clocksource: pit: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1467848399018 ns Calibrating delay loop... 1042.02 BogoMIPS (lpj=5210112) pid_max: default: 32768 minimum: 301 Mount-cache hash table entries: 2048 (order: 0, 8192 bytes) Mountpoint-cache hash table entries: 2048 (order: 0, 8192 bytes)I traced this back to
gpiochip_add_data()when it does thedevice_add()call. On my platforms this is being called beforegpiolib_dev_init(), and this seems to be the issue. Sogpio_bus_typehas not been registered as a bus yet.Quoted 4 lines
The lowest level ColdFire gpio code (
arch/m68k/coldfire/gpio.c) calls its setup fromcore_initcall()- and this will callgpiochip_add_data(). This is being called first, before thecore_initcall()forgpiolib_dev_init().We got a similar report with an alternative workaround:
https://lkml.org/lkml/2016/3/29/714
Quoted 4 lines
I can fix by changing the
core_initcall()incoldfire/gpio.cto something likepostcore_initcall()and that fixes the boot problem.
Quoted 8 lines
Quoted 3 lines
What do you think?
Would you expect that all callers ofgpiochip_add_data()should be aftercore_initcall()?As you can see on the discussion thread above, there are several candidate fixes - I have been away from GPIO for too long to make a good decision, but I'm sure Linus can make the call.
I've started looking into a clean solution, as you had suggested in the other thread. It will take a while, though. For the time being, and/or unless someone else steps in who knows gpio much better than I do, I think some workarund like my proposed hack should get committed into the branch.
Guenter