[PATCH] MMC: Flush mmc workqueue late in the boot sequence



At some point before 2.6.20, the mmc subsystem moved the card
detection code to its own workqueue. One consequence of this change
is that when using an mmc card as a root device, the card may get
detected after the init task attempts to mount the root filesystem,
causing a kernel panic because the root device could not be opened.

This patch adds a call to mmc_flush_scheduled_work() late in the boot
sequence so that we can be sure the mmc card detection scans are
complete before attempting to use an mmc device as a root device.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@xxxxxxxxx>
---
drivers/mmc/core/sysfs.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/drivers/mmc/core/sysfs.c b/drivers/mmc/core/sysfs.c
index 843b1fb..168b20f 100644
--- a/drivers/mmc/core/sysfs.c
+++ b/drivers/mmc/core/sysfs.c
@@ -358,3 +358,16 @@ static void __exit mmc_exit(void)

module_init(mmc_init);
module_exit(mmc_exit);
+
+#ifndef MODULE
+/*
+ * Make sure scanning for new cards has completed before attempting
+ * to mount the root filesystem.
+ */
+static int __init mmc_finish_detect(void)
+{
+ mmc_flush_scheduled_work();
+ return 0;
+}
+late_initcall(mmc_finish_detect);
+#endif
--
1.4.4.4

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



Relevant Pages

  • [RFC] 1/4 MMC layer
    ... This patch adds core support to the Linux kernel for driving MMC ... * Ensure that no card is selected. ... +static struct mmc_card * ... +static int mmc_major; ...
    (Linux-Kernel)
  • Re: [patch 0/5] Add MMC password protection (lock/unlock) support
    ... These series of patches add support for MultiMediaCard (MMC) password ... a MMC card with no password assigned is always in "unlocked" state. ... Only after unlocking it with the correct password the ... a new sysfs attribute was added to the MMC driver. ...
    (Linux-Kernel)
  • [patch 0/5] [RFC] Add MMC password protection (lock/unlock) support
    ... These series of patches add support for MultiMediaCard (MMC) password ... a MMC card with no password assigned is always in "unlocked" state. ... Only after unlocking it with the correct password the ... a new sysfs attribute was added to the MMC driver. ...
    (Linux-Kernel)
  • RE: RFMON detection
    ... Ambicom Model WL1100C-CF 802.11 CF card ... the 2.4 gig antenna - I have no idea how many dB down in sensitivity ... as they all use analog RF detection methods. ...
    (Security-Basics)
  • Re: Block request processing for MMC/SD over SPI bus
    ... MMC/SD card slots hooked up to SPI controllers, ... This version gets part way through MMC and SD card enumeration, ... +static int mmc_spi_delayed ...
    (Linux-Kernel)