diff options
author | Shaun Ruffell <sruffell@digium.com> | 2010-02-25 17:33:53 +0000 |
---|---|---|
committer | Shaun Ruffell <sruffell@digium.com> | 2010-02-25 17:33:53 +0000 |
commit | 9a449e1df5edc16fda2c47afe68e8e5cf54026ee (patch) | |
tree | 50c40da59255ec49950e240526b57ae18ed4ac27 /drivers/dahdi/voicebus | |
parent | 0df629312b8167561215d95773a2b7a7fdee0b40 (diff) |
wctdm24xxp: Provide option to initialize boards in parallel on kernels > 2.6.30
The 2.6.30 kernel provides support for asynchronous initialization. If running
on a kernel that supports this feature, let's add an option to use it in order
to speed up driver load times. Keep it off by default.
git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@8094 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'drivers/dahdi/voicebus')
-rw-r--r-- | drivers/dahdi/voicebus/voicebus.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/drivers/dahdi/voicebus/voicebus.c b/drivers/dahdi/voicebus/voicebus.c index 064e664..368060b 100644 --- a/drivers/dahdi/voicebus/voicebus.c +++ b/drivers/dahdi/voicebus/voicebus.c @@ -1656,6 +1656,7 @@ int vpmadtreg_loadfirmware(struct voicebus *vb) struct vpmadt_loader *loader; int ret = 0; int loader_present = 0; + unsigned long stop; might_sleep(); /* First check to see if a loader is already loaded into memory. */ @@ -1664,9 +1665,23 @@ int vpmadtreg_loadfirmware(struct voicebus *vb) spin_unlock(&loader_list_lock); if (!loader_present) { - ret = request_module("dahdi_vpmadt032_loader"); + /* If we use the blocking 'request_module' here and we are + * loading the client boards with async_schedule we will hang + * here. The module loader will wait for our asynchronous tasks + * to finish, but we can't because we're waiting for the load + * the finish. */ + ret = request_module_nowait("dahdi_vpmadt032_loader"); if (ret) return ret; + stop = jiffies + HZ; + while (time_after(stop, jiffies)) { + spin_lock(&loader_list_lock); + loader_present = !(list_empty(&binary_loader_list)); + spin_unlock(&loader_list_lock); + if (loader_present) + break; + msleep(10); + } } spin_lock(&loader_list_lock); |