[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <84144f020810130015j2905e568mb5819c4d4bf27279@mail.gmail.com>
Date: Mon, 13 Oct 2008 10:15:03 +0300
From: "Pekka Enberg" <penberg@...helsinki.fi>
To: "Arjan van de Ven" <arjan@...radead.org>
Cc: torvalds@...ux-foundation.org, linux-kernel@...r.kernel.org,
mingo@...e.hu
Subject: Re: [PATCH] fastboot: Introduce an asynchronous function call mechanism
Hi Arjan,
On Mon, Oct 13, 2008 at 2:44 AM, Arjan van de Ven <arjan@...radead.org> wrote:
> +void call_async(int pool_number, int argc, ...)
> +{
> + struct async_item *item;
> + va_list ap;
> +
> + if (argc > 4 || argc < 0) {
> + WARN(1, KERN_ERR "Too many arguments to async function! Skipping...\n");
> + return;
> + }
> +
> + item = kmalloc(sizeof(struct async_item), GFP_ATOMIC);
Why is there no check for NULL here?
> + item->argument_count = argc;
> + va_start(ap, argc);
> + item->func = va_arg(ap, async_func_t_0);
> + if (argc > 0)
> + item->arg1 = va_arg(ap, void *);
> + if (argc > 1)
> + item->arg2 = va_arg(ap, void *);
> + if (argc > 2)
> + item->arg3 = va_arg(ap, void *);
> + if (argc > 4)
> + item->arg3 = va_arg(ap, void *);
> + va_end(ap);
> +
> + /* If we're not yet or no longer active, just process the work item in place */
> + if (!async_active) {
> + do_async_item(item);
> + kfree(item);
> + return;
> + }
> + spin_lock(&pool_lock);
> + pool_count[pool_number]++;
> + list_add_tail(&item->list, &list_pool[pool_number]);
> + wake_up(&waitqueue_pool[pool_number]);
> + spin_unlock(&pool_lock);
> +}
> +EXPORT_SYMBOL_GPL(call_async);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists