All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ARM: integrator: fix section mismatch problem
@ 2014-06-04 10:53 Linus Walleij
  2014-06-04 10:56 ` Russell King - ARM Linux
  2014-06-04 10:57 ` Arnd Bergmann
  0 siblings, 2 replies; 6+ messages in thread
From: Linus Walleij @ 2014-06-04 10:53 UTC (permalink / raw)
  To: linux-arm-kernel

This addresses a section mismatch problem in the IM-PD1
driver in the Integrator/AP.

The IM-PD1 contains a VIC interrupt controller and therefore
the driver calls vic_init_cascaded() which is marked __init as
irqchips are simply not hot-pluggable and specifically the VIC
is assumed to initiate only on boot.

However the module driver model of the Integrator LM bus
assumes that logic tile drivers can be probed at runtime. This
is not really the case for IM-PD1: these tiles are detected at
boot and they cannot be plugged into a running system. Before
this patch it is of course possible to modprobe them later.

By first forcing the IM-PD1 to bool we make sure this driver
gets compiled into the kernel, and we know it will be probed
only at boot time when the tiles are detected, so we can tag
its probe function __init_refok as we know it won't be called
after boot now, and the section mismatch problem goes away.

Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Russell King <linux@arm.linux.org.uk>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
ARM SoC folks: please apply this directly if the solution seems
acceptable.
---
 arch/arm/mach-integrator/Kconfig | 2 +-
 arch/arm/mach-integrator/impd1.c | 7 ++++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-integrator/Kconfig b/arch/arm/mach-integrator/Kconfig
index ba43321001d8..64f8e2564a37 100644
--- a/arch/arm/mach-integrator/Kconfig
+++ b/arch/arm/mach-integrator/Kconfig
@@ -28,7 +28,7 @@ config ARCH_CINTEGRATOR
 	bool
 
 config INTEGRATOR_IMPD1
-	tristate "Include support for Integrator/IM-PD1"
+	bool "Include support for Integrator/IM-PD1"
 	depends on ARCH_INTEGRATOR_AP
 	select ARCH_REQUIRE_GPIOLIB
 	select ARM_VIC
diff --git a/arch/arm/mach-integrator/impd1.c b/arch/arm/mach-integrator/impd1.c
index 0e870ea818c4..05d845cb8758 100644
--- a/arch/arm/mach-integrator/impd1.c
+++ b/arch/arm/mach-integrator/impd1.c
@@ -308,7 +308,12 @@ static struct impd1_device impd1_devs[] = {
  */
 #define IMPD1_VALID_IRQS 0x00000bffU
 
-static int __init impd1_probe(struct lm_device *dev)
+/*
+ * As this module is bool, it is OK to have this as __init_refok() - no
+ * probe calls will be done after the initial system bootup, as devices
+ * are discovered as part of the machine startup.
+ */
+static int __init_refok impd1_probe(struct lm_device *dev)
 {
 	struct impd1_module *impd1;
 	int irq_base;
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] ARM: integrator: fix section mismatch problem
  2014-06-04 10:53 [PATCH] ARM: integrator: fix section mismatch problem Linus Walleij
@ 2014-06-04 10:56 ` Russell King - ARM Linux
  2014-06-04 12:27   ` Linus Walleij
  2014-06-04 10:57 ` Arnd Bergmann
  1 sibling, 1 reply; 6+ messages in thread
From: Russell King - ARM Linux @ 2014-06-04 10:56 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Jun 04, 2014 at 12:53:22PM +0200, Linus Walleij wrote:
> However the module driver model of the Integrator LM bus
> assumes that logic tile drivers can be probed at runtime. This
> is not really the case for IM-PD1: these tiles are detected at
> boot and they cannot be plugged into a running system. Before
> this patch it is of course possible to modprobe them later.

Check whether you can bind/unbind the driver via sysfs.  Merely making
stuff non-modular is really just a hack around this problem where the
device model can be used to bind/unbind devices.

-- 
FTTC broadband for 0.8mile line: now at 9.7Mbps down 460kbps up... slowly
improving, and getting towards what was expected from it.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] ARM: integrator: fix section mismatch problem
  2014-06-04 10:53 [PATCH] ARM: integrator: fix section mismatch problem Linus Walleij
  2014-06-04 10:56 ` Russell King - ARM Linux
@ 2014-06-04 10:57 ` Arnd Bergmann
  2014-06-04 10:57   ` Russell King - ARM Linux
  1 sibling, 1 reply; 6+ messages in thread
From: Arnd Bergmann @ 2014-06-04 10:57 UTC (permalink / raw)
  To: linux-arm-kernel

On Wednesday 04 June 2014 12:53:22 Linus Walleij wrote:
> This addresses a section mismatch problem in the IM-PD1
> driver in the Integrator/AP.
> 
> The IM-PD1 contains a VIC interrupt controller and therefore
> the driver calls vic_init_cascaded() which is marked __init as
> irqchips are simply not hot-pluggable and specifically the VIC
> is assumed to initiate only on boot.
> 
> However the module driver model of the Integrator LM bus
> assumes that logic tile drivers can be probed at runtime. This
> is not really the case for IM-PD1: these tiles are detected at
> boot and they cannot be plugged into a running system. Before
> this patch it is of course possible to modprobe them later.
> 
> By first forcing the IM-PD1 to bool we make sure this driver
> gets compiled into the kernel, and we know it will be probed
> only at boot time when the tiles are detected, so we can tag
> its probe function __init_refok as we know it won't be called
> after boot now, and the section mismatch problem goes away.
> 
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Russell King <linux@arm.linux.org.uk>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> ARM SoC folks: please apply this directly if the solution seems
> acceptable.

Looks good to me, I'm applying this on top of another fix
I have just added to next/soc2.

	Arnd

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] ARM: integrator: fix section mismatch problem
  2014-06-04 10:57 ` Arnd Bergmann
@ 2014-06-04 10:57   ` Russell King - ARM Linux
  2014-06-04 11:09     ` Arnd Bergmann
  0 siblings, 1 reply; 6+ messages in thread
From: Russell King - ARM Linux @ 2014-06-04 10:57 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Jun 04, 2014 at 12:57:02PM +0200, Arnd Bergmann wrote:
> On Wednesday 04 June 2014 12:53:22 Linus Walleij wrote:
> > This addresses a section mismatch problem in the IM-PD1
> > driver in the Integrator/AP.
> > 
> > The IM-PD1 contains a VIC interrupt controller and therefore
> > the driver calls vic_init_cascaded() which is marked __init as
> > irqchips are simply not hot-pluggable and specifically the VIC
> > is assumed to initiate only on boot.
> > 
> > However the module driver model of the Integrator LM bus
> > assumes that logic tile drivers can be probed at runtime. This
> > is not really the case for IM-PD1: these tiles are detected at
> > boot and they cannot be plugged into a running system. Before
> > this patch it is of course possible to modprobe them later.
> > 
> > By first forcing the IM-PD1 to bool we make sure this driver
> > gets compiled into the kernel, and we know it will be probed
> > only at boot time when the tiles are detected, so we can tag
> > its probe function __init_refok as we know it won't be called
> > after boot now, and the section mismatch problem goes away.
> > 
> > Cc: Arnd Bergmann <arnd@arndb.de>
> > Cc: Russell King <linux@arm.linux.org.uk>
> > Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> > ---
> > ARM SoC folks: please apply this directly if the solution seems
> > acceptable.
> 
> Looks good to me, I'm applying this on top of another fix
> I have just added to next/soc2.

That's a NAK on that until the issue I've raised has been checked.

-- 
FTTC broadband for 0.8mile line: now at 9.7Mbps down 460kbps up... slowly
improving, and getting towards what was expected from it.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] ARM: integrator: fix section mismatch problem
  2014-06-04 10:57   ` Russell King - ARM Linux
@ 2014-06-04 11:09     ` Arnd Bergmann
  0 siblings, 0 replies; 6+ messages in thread
From: Arnd Bergmann @ 2014-06-04 11:09 UTC (permalink / raw)
  To: linux-arm-kernel

On Wednesday 04 June 2014 11:57:26 Russell King - ARM Linux wrote:
> On Wed, Jun 04, 2014 at 12:57:02PM +0200, Arnd Bergmann wrote:
> > On Wednesday 04 June 2014 12:53:22 Linus Walleij wrote:
> > > This addresses a section mismatch problem in the IM-PD1
> > > driver in the Integrator/AP.
> > > 
> > > The IM-PD1 contains a VIC interrupt controller and therefore
> > > the driver calls vic_init_cascaded() which is marked __init as
> > > irqchips are simply not hot-pluggable and specifically the VIC
> > > is assumed to initiate only on boot.
> > > 
> > > However the module driver model of the Integrator LM bus
> > > assumes that logic tile drivers can be probed at runtime. This
> > > is not really the case for IM-PD1: these tiles are detected at
> > > boot and they cannot be plugged into a running system. Before
> > > this patch it is of course possible to modprobe them later.
> > > 
> > > By first forcing the IM-PD1 to bool we make sure this driver
> > > gets compiled into the kernel, and we know it will be probed
> > > only at boot time when the tiles are detected, so we can tag
> > > its probe function __init_refok as we know it won't be called
> > > after boot now, and the section mismatch problem goes away.
> > > 
> > > Cc: Arnd Bergmann <arnd@arndb.de>
> > > Cc: Russell King <linux@arm.linux.org.uk>
> > > Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> > > ---
> > > ARM SoC folks: please apply this directly if the solution seems
> > > acceptable.
> > 
> > Looks good to me, I'm applying this on top of another fix
> > I have just added to next/soc2.
> 
> That's a NAK on that until the issue I've raised has been checked.
> 

Ok, I'll retract the patch, I haven't pushed the branch yet, so it's
easy to back out. Thanks for having a look at the issue so quickly.

	Arnd

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] ARM: integrator: fix section mismatch problem
  2014-06-04 10:56 ` Russell King - ARM Linux
@ 2014-06-04 12:27   ` Linus Walleij
  0 siblings, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2014-06-04 12:27 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Jun 4, 2014 at 12:56 PM, Russell King - ARM Linux
<linux@arm.linux.org.uk> wrote:
> On Wed, Jun 04, 2014 at 12:53:22PM +0200, Linus Walleij wrote:
>> However the module driver model of the Integrator LM bus
>> assumes that logic tile drivers can be probed at runtime. This
>> is not really the case for IM-PD1: these tiles are detected at
>> boot and they cannot be plugged into a running system. Before
>> this patch it is of course possible to modprobe them later.
>
> Check whether you can bind/unbind the driver via sysfs.  Merely making
> stuff non-modular is really just a hack around this problem where the
> device model can be used to bind/unbind devices.

I first attempted to approach the problem using the pattern from
platform_device_probe() which allows to have a discardable probe()
function in a platform_driver.

In that case the sysfs bind/unbind problem is handled like so:

       /* make sure driver won't have bind/unbind attributes */
        drv->driver.suppress_bind_attrs = true;

So the support of sysfs bind/unbind for a certain driver is somewhat
optional, really.

I will try the approach to set this for the IM-PD1 driver.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-06-04 12:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-04 10:53 [PATCH] ARM: integrator: fix section mismatch problem Linus Walleij
2014-06-04 10:56 ` Russell King - ARM Linux
2014-06-04 12:27   ` Linus Walleij
2014-06-04 10:57 ` Arnd Bergmann
2014-06-04 10:57   ` Russell King - ARM Linux
2014-06-04 11:09     ` Arnd Bergmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.