* [PATCH] ARM: sa1100: Initialize gpio after gpio subsystem has been initialized
@ 2016-03-29 18:15 Guenter Roeck
2016-03-31 16:21 ` Guenter Roeck
0 siblings, 1 reply; 5+ messages in thread
From: Guenter Roeck @ 2016-03-29 18:15 UTC (permalink / raw)
To: linux-arm-kernel
The sa1100 gpio driver was initialized from interrupt initialization code,
which is earlier than the gpio subsystem is initialized. Since commit
ff2b13592299 ("gpio: make the gpiochip a real device"), this is fatal
and causes the system to crash.
The sa1100 gpio driver must be initialized prior to arch_initcall, since
its gpio pins are used in arch_initcall code, but after the gpio subsystem
is initialized (core_initcall). Initialize it with postcore_initcall.
Fixes: ff2b13592299 ("gpio: make the gpiochip a real device")
Cc: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
Tested by building collie_defconfig and:
qemu-system-arm -M collie -kernel arch/arm/boot/zImage \
-no-reboot -initrd busybox-armv4.cpio \
--append "rdinit=/sbin/init console=ttySA1" -monitor null -nographic
arch/arm/mach-sa1100/generic.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-sa1100/generic.c b/arch/arm/mach-sa1100/generic.c
index 345e63f4eb71..850aa7f8f649 100644
--- a/arch/arm/mach-sa1100/generic.c
+++ b/arch/arm/mach-sa1100/generic.c
@@ -321,6 +321,15 @@ static int __init sa1100_init(void)
arch_initcall(sa1100_init);
+static int __init sa1100_gpio_init(void)
+{
+ sa1100_init_gpio();
+
+ return 0;
+}
+
+postcore_initcall(sa1100_gpio_init);
+
void __init sa11x0_init_late(void)
{
sa11x0_pm_init();
@@ -386,8 +395,6 @@ void __init sa1100_init_irq(void)
request_resource(&iomem_resource, &irq_resource);
sa11x0_init_irq_nodt(IRQ_GPIO0_SC, irq_resource.start);
-
- sa1100_init_gpio();
}
/*
--
2.5.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH] ARM: sa1100: Initialize gpio after gpio subsystem has been initialized
2016-03-29 18:15 [PATCH] ARM: sa1100: Initialize gpio after gpio subsystem has been initialized Guenter Roeck
@ 2016-03-31 16:21 ` Guenter Roeck
2016-04-01 8:04 ` Linus Walleij
0 siblings, 1 reply; 5+ messages in thread
From: Guenter Roeck @ 2016-03-31 16:21 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Mar 29, 2016 at 11:15:49AM -0700, Guenter Roeck wrote:
> The sa1100 gpio driver was initialized from interrupt initialization code,
> which is earlier than the gpio subsystem is initialized. Since commit
> ff2b13592299 ("gpio: make the gpiochip a real device"), this is fatal
> and causes the system to crash.
>
> The sa1100 gpio driver must be initialized prior to arch_initcall, since
> its gpio pins are used in arch_initcall code, but after the gpio subsystem
> is initialized (core_initcall). Initialize it with postcore_initcall.
>
> Fixes: ff2b13592299 ("gpio: make the gpiochip a real device")
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Please ignore/drop this patch - a better (cleaner) fix is in the works
for gpiolib.
Thanks,
Guenter
> ---
>
> Tested by building collie_defconfig and:
>
> qemu-system-arm -M collie -kernel arch/arm/boot/zImage \
> -no-reboot -initrd busybox-armv4.cpio \
> --append "rdinit=/sbin/init console=ttySA1" -monitor null -nographic
>
> arch/arm/mach-sa1100/generic.c | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/mach-sa1100/generic.c b/arch/arm/mach-sa1100/generic.c
> index 345e63f4eb71..850aa7f8f649 100644
> --- a/arch/arm/mach-sa1100/generic.c
> +++ b/arch/arm/mach-sa1100/generic.c
> @@ -321,6 +321,15 @@ static int __init sa1100_init(void)
>
> arch_initcall(sa1100_init);
>
> +static int __init sa1100_gpio_init(void)
> +{
> + sa1100_init_gpio();
> +
> + return 0;
> +}
> +
> +postcore_initcall(sa1100_gpio_init);
> +
> void __init sa11x0_init_late(void)
> {
> sa11x0_pm_init();
> @@ -386,8 +395,6 @@ void __init sa1100_init_irq(void)
> request_resource(&iomem_resource, &irq_resource);
>
> sa11x0_init_irq_nodt(IRQ_GPIO0_SC, irq_resource.start);
> -
> - sa1100_init_gpio();
> }
>
> /*
> --
> 2.5.0
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] ARM: sa1100: Initialize gpio after gpio subsystem has been initialized
2016-03-31 16:21 ` Guenter Roeck
@ 2016-04-01 8:04 ` Linus Walleij
2016-04-01 14:02 ` Guenter Roeck
0 siblings, 1 reply; 5+ messages in thread
From: Linus Walleij @ 2016-04-01 8:04 UTC (permalink / raw)
To: linux-arm-kernel
On Thu, Mar 31, 2016 at 6:21 PM, Guenter Roeck <linux@roeck-us.net> wrote:
> On Tue, Mar 29, 2016 at 11:15:49AM -0700, Guenter Roeck wrote:
>> The sa1100 gpio driver was initialized from interrupt initialization code,
>> which is earlier than the gpio subsystem is initialized. Since commit
>> ff2b13592299 ("gpio: make the gpiochip a real device"), this is fatal
>> and causes the system to crash.
>>
>> The sa1100 gpio driver must be initialized prior to arch_initcall, since
>> its gpio pins are used in arch_initcall code, but after the gpio subsystem
>> is initialized (core_initcall). Initialize it with postcore_initcall.
>>
>> Fixes: ff2b13592299 ("gpio: make the gpiochip a real device")
>> Cc: Linus Walleij <linus.walleij@linaro.org>
>> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
>
> Please ignore/drop this patch - a better (cleaner) fix is in the works
> for gpiolib.
This delivers though. I tested it on my also regressing iPAQ.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] ARM: sa1100: Initialize gpio after gpio subsystem has been initialized
2016-04-01 8:04 ` Linus Walleij
@ 2016-04-01 14:02 ` Guenter Roeck
2016-04-03 16:35 ` Linus Walleij
0 siblings, 1 reply; 5+ messages in thread
From: Guenter Roeck @ 2016-04-01 14:02 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Apr 01, 2016 at 10:04:57AM +0200, Linus Walleij wrote:
> On Thu, Mar 31, 2016 at 6:21 PM, Guenter Roeck <linux@roeck-us.net> wrote:
> > On Tue, Mar 29, 2016 at 11:15:49AM -0700, Guenter Roeck wrote:
> >> The sa1100 gpio driver was initialized from interrupt initialization code,
> >> which is earlier than the gpio subsystem is initialized. Since commit
> >> ff2b13592299 ("gpio: make the gpiochip a real device"), this is fatal
> >> and causes the system to crash.
> >>
> >> The sa1100 gpio driver must be initialized prior to arch_initcall, since
> >> its gpio pins are used in arch_initcall code, but after the gpio subsystem
> >> is initialized (core_initcall). Initialize it with postcore_initcall.
> >>
> >> Fixes: ff2b13592299 ("gpio: make the gpiochip a real device")
> >> Cc: Linus Walleij <linus.walleij@linaro.org>
> >> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> >
> > Please ignore/drop this patch - a better (cleaner) fix is in the works
> > for gpiolib.
>
> This delivers though. I tested it on my also regressing iPAQ.
>
I am a bit concerned that the gpio initialization was that early on purpose,
and that by moving it we might miss some use cases. I did not find any, but that
doesn't mean that there are none. Without knowing _why_ the initialization was
that early, I would prefer not to touch the code if it can be avoided.
Thanks,
Guenter
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] ARM: sa1100: Initialize gpio after gpio subsystem has been initialized
2016-04-01 14:02 ` Guenter Roeck
@ 2016-04-03 16:35 ` Linus Walleij
0 siblings, 0 replies; 5+ messages in thread
From: Linus Walleij @ 2016-04-03 16:35 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Apr 1, 2016 at 4:02 PM, Guenter Roeck <linux@roeck-us.net> wrote:
> On Fri, Apr 01, 2016 at 10:04:57AM +0200, Linus Walleij wrote:
>> > Please ignore/drop this patch - a better (cleaner) fix is in the works
>> > for gpiolib.
>>
>> This delivers though. I tested it on my also regressing iPAQ.
>>
> I am a bit concerned that the gpio initialization was that early on purpose,
> and that by moving it we might miss some use cases. I did not find any, but that
> doesn't mean that there are none. Without knowing _why_ the initialization was
> that early, I would prefer not to touch the code if it can be avoided.
I think we'll go for the other patch to gpiolib. It seems much more clean
and generic to support this kind of cases.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-04-03 16:35 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-29 18:15 [PATCH] ARM: sa1100: Initialize gpio after gpio subsystem has been initialized Guenter Roeck
2016-03-31 16:21 ` Guenter Roeck
2016-04-01 8:04 ` Linus Walleij
2016-04-01 14:02 ` Guenter Roeck
2016-04-03 16:35 ` Linus Walleij
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).