Skip to content

Commit

Permalink
async: Handle kthread_run() return codes.
Browse files Browse the repository at this point in the history
If we fail to create the manager thread, fall back to non-fastboot.
If we fail to create an async thread, try again after waiting for
a bit.

Signed-off-by: Cornelia Huck <[email protected]>
Signed-off-by: Arjan van de Ven <[email protected]>
  • Loading branch information
cohuck authored and fenrus75 committed Feb 8, 2009
1 parent 7a89bbc commit 86532d8
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions kernel/async.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ asynchronous and synchronous parts of the kernel.
#include <linux/sched.h>
#include <linux/init.h>
#include <linux/kthread.h>
#include <linux/delay.h>
#include <asm/atomic.h>

static async_cookie_t next_cookie = 1;
Expand Down Expand Up @@ -319,7 +320,11 @@ static int async_manager_thread(void *unused)
ec = atomic_read(&entry_count);

while (tc < ec && tc < MAX_THREADS) {
kthread_run(async_thread, NULL, "async/%i", tc);
if (IS_ERR(kthread_run(async_thread, NULL, "async/%i",
tc))) {
msleep(100);
continue;
}
atomic_inc(&thread_count);
tc++;
}
Expand All @@ -334,7 +339,9 @@ static int async_manager_thread(void *unused)
static int __init async_init(void)
{
if (async_enabled)
kthread_run(async_manager_thread, NULL, "async/mgr");
if (IS_ERR(kthread_run(async_manager_thread, NULL,
"async/mgr")))
async_enabled = 0;
return 0;
}

Expand Down

0 comments on commit 86532d8

Please sign in to comment.