linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: tony@atomide.com (Tony Lindgren)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 0/3] omap hsmmc init cleanup and section warning fixes for v3.4 merge window
Date: Fri, 17 Feb 2012 14:37:36 -0800	[thread overview]
Message-ID: <20120217223736.GH18185@atomide.com> (raw)
In-Reply-To: <20120217202125.GF18185@atomide.com>

* Tony Lindgren <tony@atomide.com> [120217 11:50]:
> * Rajendra Nayak <rnayak@ti.com> [120217 05:53]:
> > Tony,
> > 
> > On Wednesday 15 February 2012 11:58 PM, Tony Lindgren wrote:
> > >Hi all,
> > >
> > >This series fixes up the issues noted by Russell on omap2_hsmmc_init()
> > >where if TWL PMIC is compiled as a module we can't keep a bunch of
> > >functions marked as __init like they should be. This series fixes
> > >the issues by splitting omap2_hsmmc_init() into two functions.
> > 
> > I have a re-spin of this series ready with all the fixes I did
> > while testing the insmod/unbind/bind test suggested by Russell.
> > I could not figure out what branch your original patches were
> > based on. So let me know what branch of your tree you want me
> > to post this series on.
> 
> I have them on mainline commit a269c2f5a5ad2b24a19fdd723363daf18394ec85.
> 
> Note that we should fix what Russell noted separately for the -rc
> series for the issue where reloading gpio-twl4030.ko calls
> omap2_hsmmc_init() twice, maybe something like below for that.

Here's a better fix for -rc series that also fixes a panic that I was
getting on zoom3.

Tony


From: Tony Lindgren <tony@atomide.com>
Date: Fri, 17 Feb 2012 11:33:37 -0800
Subject: [PATCH] ARM: OMAP: Fix kernel panic with HSMMC when twl4030_gpio is a module

On some omaps twl4030_gpio has a callback to try to initialize
the MMC controller. If twl4030_gpio is compiled as a module,
bad things can happen because the callback function starts
calling functions that are supposed to be marked __init:

Kernel panic - not syncing: Attempted to kill the idle task!
twl4030_gpio twl4030_gpio: can't dispatch IRQs from modules
gpiochip_add: registered GPIOs 192 to 209 on device: twl4030
Unable to handle kernel paging request at virtual address b82a4c74
...

Additionally if this does not fail, warnings are produced
about trying to register the MMC multiple times.

Fix this by removing __init from omap_mux_get_by_name,
and add checks if omap2_hsmmc_init() is getting called more
than once.

Note that this will get fixed properly later on by splitting
omap2_hsmmc_init into two functions.

Reported-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Tony Lindgren <tony@atomide.com>

diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c
index b40c288..19dd165 100644
--- a/arch/arm/mach-omap2/hsmmc.c
+++ b/arch/arm/mach-omap2/hsmmc.c
@@ -428,6 +428,7 @@ static int omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c,
 	return 0;
 }
 
+static int omap_hsmmc_done;
 #define MAX_OMAP_MMC_HWMOD_NAME_LEN		16
 
 void omap_init_hsmmc(struct omap2_hsmmc_info *hsmmcinfo, int ctrl_nr)
@@ -491,6 +492,11 @@ void omap2_hsmmc_init(struct omap2_hsmmc_info *controllers)
 {
 	u32 reg;
 
+	if (omap_hsmmc_done)
+		return;
+
+	omap_hsmmc_done = 1;
+
 	if (!cpu_is_omap44xx()) {
 		if (cpu_is_omap2430()) {
 			control_pbias_offset = OMAP243X_CONTROL_PBIAS_LITE;
diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c
index fb8bc9f..611a0e3 100644
--- a/arch/arm/mach-omap2/mux.c
+++ b/arch/arm/mach-omap2/mux.c
@@ -218,7 +218,7 @@ static int _omap_mux_get_by_name(struct omap_mux_partition *partition,
 	return -ENODEV;
 }
 
-static int __init
+static int
 omap_mux_get_by_name(const char *muxname,
 			struct omap_mux_partition **found_partition,
 			struct omap_mux **found_mux)

  reply	other threads:[~2012-02-17 22:37 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-15 18:28 [PATCH 0/3] omap hsmmc init cleanup and section warning fixes for v3.4 merge window Tony Lindgren
2012-02-15 18:28 ` [PATCH 1/3] ARM: OMAP: omap_device: Expose omap_device_{alloc, delete, register} Tony Lindgren
2012-02-15 18:28 ` [PATCH 2/3] ARM: OMAP2+: Split omap2_hsmmc_init() to properly support I2C GPIO pins Tony Lindgren
2012-02-16 10:03   ` Rajendra Nayak
2012-02-16 10:13     ` Rajendra Nayak
2012-02-16 16:35       ` Tony Lindgren
2012-02-16 16:46         ` Cousson, Benoit
2012-02-16 16:51         ` Rajendra Nayak
2012-02-16 17:06           ` Tony Lindgren
2012-02-17 18:10             ` Tony Lindgren
2012-02-16 16:45   ` Tony Lindgren
2012-02-17 19:05     ` Tony Lindgren
2012-02-15 18:28 ` [PATCH 3/3] ARM: OMAP2+: Mark omap_hsmmc_init and omap_mux related functions as __init Tony Lindgren
2012-02-16 10:11   ` Russell King - ARM Linux
2012-02-16 16:41     ` Tony Lindgren
2012-02-17 19:17       ` Tony Lindgren
2012-02-16 12:00 ` [PATCH 0/3] omap hsmmc init cleanup and section warning fixes for v3.4 merge window Nayak, Rajendra
2012-02-16 12:12   ` Russell King - ARM Linux
2012-02-16 12:34     ` Rajendra Nayak
2012-02-16 13:15       ` Rajendra Nayak
2012-02-16 13:51         ` Russell King - ARM Linux
2012-02-17  9:14           ` Russell King - ARM Linux
2012-02-17  9:33             ` Rajendra Nayak
2012-02-17  9:37               ` Rajendra Nayak
2012-02-17  9:59               ` Rajendra Nayak
2012-02-17 10:06                 ` Russell King - ARM Linux
2012-02-17 10:18                   ` Rajendra Nayak
2012-02-17 10:26                     ` Rajendra Nayak
2012-02-17 21:23             ` Tony Lindgren
2012-02-17 14:24 ` Rajendra Nayak
2012-02-17 20:21   ` Tony Lindgren
2012-02-17 22:37     ` Tony Lindgren [this message]
2012-02-21  5:19     ` Rajendra Nayak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120217223736.GH18185@atomide.com \
    --to=tony@atomide.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).