Re: schedule inside spin_lock_irqsave?

From: Jiri Slaby
Date: Sun May 30 2010 - 11:32:29 EST


On 05/30/2010 05:24 PM, Jiri Slaby wrote:
> struct smscore_buffer_t *get_entry(void)
> {
> struct smscore_buffer_t *cb = NULL;
> spin_lock_irqsave(&coredev->bufferslock, flags);
> if (!list_empty(&coredev->buffers)) {
> cb = (struct smscore_buffer_t *) coredev->buffers.next;

Looking at the smscore_buffer_t definition, this is really ugly since it
relies on entry being the first in the structure. It should be
list_first_entry(&coredev->buffers, ...) instead, cast-less.

> list_del(&cb->entry);
> }
> spin_unlock_irqrestore(&coredev->bufferslock, flags);
> return cb;
> }


--
js
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/