From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757421AbcC2SPx (ORCPT ); Tue, 29 Mar 2016 14:15:53 -0400 Received: from bh-25.webhostbox.net ([208.91.199.152]:40182 "EHLO bh-25.webhostbox.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751595AbcC2SPv (ORCPT ); Tue, 29 Mar 2016 14:15:51 -0400 From: Guenter Roeck To: Russell King Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Guenter Roeck , Linus Walleij Subject: [PATCH] ARM: sa1100: Initialize gpio after gpio subsystem has been initialized Date: Tue, 29 Mar 2016 11:15:49 -0700 Message-Id: <1459275349-11356-1-git-send-email-linux@roeck-us.net> X-Mailer: git-send-email 2.5.0 X-Authenticated_sender: guenter@roeck-us.net X-OutGoing-Spam-Status: No, score=1.5 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - bh-25.webhostbox.net X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - roeck-us.net X-Get-Message-Sender-Via: bh-25.webhostbox.net: authenticated_id: guenter@roeck-us.net X-Authenticated-Sender: bh-25.webhostbox.net: guenter@roeck-us.net X-Source: X-Source-Args: X-Source-Dir: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Signed-off-by: Guenter Roeck --- 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