X-Git-Url: http://ftp.safe.ca/?a=blobdiff_plain;f=kernel%2Fasync.c;h=15319d6c18fe05a3b3bbb8c91e0c654e58356bb2;hb=46da27664887fb95cedba53eafcf876de812c8c1;hp=e23399d88bac44aef003fb12937ac3a407af2e32;hpb=766ccb9ed406c230d13c145def08ebea1b932982;p=safe%2Fjmp%2Flinux-2.6 diff --git a/kernel/async.c b/kernel/async.c index e23399d..15319d6 100644 --- a/kernel/async.c +++ b/kernel/async.c @@ -49,12 +49,14 @@ asynchronous and synchronous parts of the kernel. */ #include +#include #include #include #include #include #include #include +#include #include static async_cookie_t next_cookie = 1; @@ -91,19 +93,18 @@ extern int initcall_debug; static async_cookie_t __lowest_in_progress(struct list_head *running) { struct async_entry *entry; + if (!list_empty(running)) { entry = list_first_entry(running, struct async_entry, list); return entry->cookie; - } else if (!list_empty(&async_pending)) { - entry = list_first_entry(&async_pending, - struct async_entry, list); - return entry->cookie; - } else { - /* nothing in progress... next_cookie is "infinity" */ - return next_cookie; } + list_for_each_entry(entry, &async_pending, list) + if (entry->running == running) + return entry->cookie; + + return next_cookie; /* "infinity" value */ } static async_cookie_t lowest_in_progress(struct list_head *running) @@ -133,8 +134,7 @@ static void run_one_entry(void) entry = list_first_entry(&async_pending, struct async_entry, list); /* 2) move it to the running queue */ - list_del(&entry->list); - list_add_tail(&entry->list, entry->running); + list_move_tail(&entry->list, entry->running); spin_unlock_irqrestore(&async_lock, flags); /* 3) run it (and print duration)*/ @@ -388,20 +388,11 @@ static int async_manager_thread(void *unused) static int __init async_init(void) { - if (async_enabled) - if (IS_ERR(kthread_run(async_manager_thread, NULL, - "async/mgr"))) - async_enabled = 0; - return 0; -} + async_enabled = + !IS_ERR(kthread_run(async_manager_thread, NULL, "async/mgr")); -static int __init setup_async(char *str) -{ - async_enabled = 1; - return 1; + WARN_ON(!async_enabled); + return 0; } -__setup("fastboot", setup_async); - - core_initcall(async_init);