Commit 86532d8b authored by Cornelia Huck's avatar Cornelia Huck Committed by Arjan van de Ven

async: Handle kthread_run() return codes.

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: default avatarCornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: default avatarArjan van de Ven <arjan@linux.intel.com>
parent 7a89bbc7
...@@ -54,6 +54,7 @@ asynchronous and synchronous parts of the kernel. ...@@ -54,6 +54,7 @@ asynchronous and synchronous parts of the kernel.
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/kthread.h> #include <linux/kthread.h>
#include <linux/delay.h>
#include <asm/atomic.h> #include <asm/atomic.h>
static async_cookie_t next_cookie = 1; static async_cookie_t next_cookie = 1;
...@@ -319,7 +320,11 @@ static int async_manager_thread(void *unused) ...@@ -319,7 +320,11 @@ static int async_manager_thread(void *unused)
ec = atomic_read(&entry_count); ec = atomic_read(&entry_count);
while (tc < ec && tc < MAX_THREADS) { 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); atomic_inc(&thread_count);
tc++; tc++;
} }
...@@ -334,7 +339,9 @@ static int async_manager_thread(void *unused) ...@@ -334,7 +339,9 @@ static int async_manager_thread(void *unused)
static int __init async_init(void) static int __init async_init(void)
{ {
if (async_enabled) 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; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment