From: "Pekka Enberg" <penberg@cs.helsinki.fi>
To: "Arjan van de Ven" <arjan@infradead.org>
Cc: torvalds@linux-foundation.org, linux-kernel@vger.kernel.org,
mingo@elte.hu
Subject: Re: [PATCH] fastboot: Introduce an asynchronous function call mechanism
Date: Mon, 13 Oct 2008 10:15:03 +0300 [thread overview]
Message-ID: <84144f020810130015j2905e568mb5819c4d4bf27279@mail.gmail.com> (raw)
In-Reply-To: <20081012194427.2e21c22e@infradead.org>
Hi Arjan,
On Mon, Oct 13, 2008 at 2:44 AM, Arjan van de Ven <arjan@infradead.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);
next prev parent reply other threads:[~2008-10-13 7:15 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-12 23:44 Arjan van de Ven
2008-10-12 23:45 ` async function call test users Arjan van de Ven
2008-10-13 7:22 ` Ingo Molnar
2008-10-13 3:44 ` [PATCH] fastboot: Introduce an asynchronous function call mechanism Willy Tarreau
2008-10-13 7:15 ` Pekka Enberg [this message]
2008-10-13 14:45 ` Arjan van de Ven
2008-10-15 8:41 ` Andrew Morton
2008-10-15 10:37 ` Evgeniy Polyakov
2008-10-15 11:52 ` Arjan van de Ven
2008-10-15 12:30 ` Alan Cox
2008-10-15 16:59 ` Andrew Morton
2008-10-15 17:52 ` Alexey Dobriyan
2008-10-15 17:55 ` Roland Dreier
2008-10-15 18:09 ` Alexey Dobriyan
2008-10-15 18:09 ` Andrew Morton
2008-10-15 20:23 ` Arjan van de Ven
2008-10-15 21:18 ` Evgeniy Polyakov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=84144f020810130015j2905e568mb5819c4d4bf27279@mail.gmail.com \
--to=penberg@cs.helsinki.fi \
--cc=arjan@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®