diff options
author | Arjan van de Ven <arjan@linux.intel.com> | 2009-02-13 19:59:06 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-02-21 17:17:17 -0500 |
commit | 216773a787c3c46ef26bf1742c1fdba37d26be45 (patch) | |
tree | aac387553fd53cb0c06b5cc2ee86329ce793bed6 /drivers/base | |
parent | d2f8d7ee1a9b4650b4e43325b321801264f7c37a (diff) |
Consolidate driver_probe_done() loops into one place
there's a few places that currently loop over driver_probe_done(), and
I'm about to add another one. This patch abstracts it into a helper
to reduce duplication.
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Cc: Len Brown <lenb@kernel.org>
Acked-by: Greg KH <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/dd.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/base/dd.c b/drivers/base/dd.c index 315bed8d5e7f..135231239103 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c | |||
@@ -18,9 +18,11 @@ | |||
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <linux/device.h> | 20 | #include <linux/device.h> |
21 | #include <linux/delay.h> | ||
21 | #include <linux/module.h> | 22 | #include <linux/module.h> |
22 | #include <linux/kthread.h> | 23 | #include <linux/kthread.h> |
23 | #include <linux/wait.h> | 24 | #include <linux/wait.h> |
25 | #include <linux/async.h> | ||
24 | 26 | ||
25 | #include "base.h" | 27 | #include "base.h" |
26 | #include "power/power.h" | 28 | #include "power/power.h" |
@@ -168,6 +170,21 @@ int driver_probe_done(void) | |||
168 | } | 170 | } |
169 | 171 | ||
170 | /** | 172 | /** |
173 | * wait_for_device_probe | ||
174 | * Wait for device probing to be completed. | ||
175 | * | ||
176 | * Note: this function polls at 100 msec intervals. | ||
177 | */ | ||
178 | int wait_for_device_probe(void) | ||
179 | { | ||
180 | /* wait for the known devices to complete their probing */ | ||
181 | while (driver_probe_done() != 0) | ||
182 | msleep(100); | ||
183 | async_synchronize_full(); | ||
184 | return 0; | ||
185 | } | ||
186 | |||
187 | /** | ||
171 | * driver_probe_device - attempt to bind device & driver together | 188 | * driver_probe_device - attempt to bind device & driver together |
172 | * @drv: driver to bind a device to | 189 | * @drv: driver to bind a device to |
173 | * @dev: device to try to bind to the driver | 190 | * @dev: device to try to bind to the driver |