[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1233242110-5422-1-git-send-email-tom.leiming@gmail.com>
Date: Thu, 29 Jan 2009 23:15:10 +0800
From: tom.leiming@...il.com
To: kay.sievers@...y.org, greg@...ah.com
Cc: linux-kernel@...r.kernel.org, Ming Lei <tom.leiming@...il.com>
Subject: [PATCH] driver core: remove polling for driver_probe_done
From: Ming Lei <tom.leiming@...il.com>
This patch renames driver_probe_done to driver_probe_wait_done,
and make it wait on condition variable of probe done to remove
polling for it in fs initialization.
Removing polling in fs initialization may lead to a faster boot.
Signed-off-by: Ming Lei <tom.leiming@...il.com>
---
drivers/base/dd.c | 12 +++++-------
include/linux/device.h | 2 +-
init/do_mounts.c | 10 +++++-----
init/do_mounts_md.c | 5 +++--
4 files changed, 14 insertions(+), 15 deletions(-)
diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index 9b721d3..ee998ca 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -153,18 +153,16 @@ done:
}
/**
- * driver_probe_done
- * Determine if the probe sequence is finished or not.
+ * driver_probe_wait_done
+ * wait the probe sequence to be finished.
*
- * Should somehow figure out how to use a semaphore, not an atomic variable...
*/
-int driver_probe_done(void)
+void driver_probe_wait_done(void)
{
pr_debug("%s: probe_count = %d\n", __func__,
atomic_read(&probe_count));
- if (atomic_read(&probe_count))
- return -EBUSY;
- return 0;
+
+ wait_event(probe_waitqueue, atomic_read(&probe_count) == 0);
}
/**
diff --git a/include/linux/device.h b/include/linux/device.h
index 45e5b19..20b50c4 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -146,7 +146,7 @@ extern struct device_driver *get_driver(struct device_driver *drv);
extern void put_driver(struct device_driver *drv);
extern struct device_driver *driver_find(const char *name,
struct bus_type *bus);
-extern int driver_probe_done(void);
+extern void driver_probe_wait_done(void);
/* sysfs interface for exporting driver attributes */
diff --git a/init/do_mounts.c b/init/do_mounts.c
index 708105e..ce46c38 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -371,8 +371,8 @@ void __init prepare_namespace(void)
}
/* wait for the known devices to complete their probing */
- while (driver_probe_done() != 0)
- msleep(100);
+ driver_probe_wait_done();
+
async_synchronize_full();
md_run_setup();
@@ -396,9 +396,9 @@ void __init prepare_namespace(void)
if ((ROOT_DEV == 0) && root_wait) {
printk(KERN_INFO "Waiting for root device %s...\n",
saved_root_name);
- while (driver_probe_done() != 0 ||
- (ROOT_DEV = name_to_dev_t(saved_root_name)) == 0)
- msleep(100);
+ ROOT_DEV = name_to_dev_t(saved_root_name);
+ if (ROOT_DEV)
+ driver_probe_wait_done();
}
is_floppy = MAJOR(ROOT_DEV) == FLOPPY_MAJOR;
diff --git a/init/do_mounts_md.c b/init/do_mounts_md.c
index ff95e31..e9a4e54 100644
--- a/init/do_mounts_md.c
+++ b/init/do_mounts_md.c
@@ -281,8 +281,9 @@ static void __init autodetect_raid(void)
*/
printk(KERN_INFO "md: Waiting for all devices to be available before autodetect\n");
printk(KERN_INFO "md: If you don't use raid, use raid=noautodetect\n");
- while (driver_probe_done() < 0)
- msleep(100);
+
+ driver_probe_wait_done();
+
fd = sys_open("/dev/md0", 0, 0);
if (fd >= 0) {
sys_ioctl(fd, RAID_AUTORUN, raid_autopart);
--
1.6.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists