Re: [PATCH 2/7] kfifo: move out spinlock

From: Andrew Morton
Date: Sun Aug 16 2009 - 19:36:06 EST


On Sun, 16 Aug 2009 23:58:43 +0100 Alan Cox <alan@xxxxxxxxxxxxxxxxxxx> wrote:

> On Sun, 16 Aug 2009 22:46:30 +0200
> Stefani Seibold <stefani@xxxxxxxxxxx> wrote:
>
> > Move the pointer to the spinlock out of struct kfifo. Most
> > users in tree do not actually use a spinlock, so the few
> > exceptions now have to call kfifo_{get,put}_locked, which takes
> > an extra argument to a spinlock.
>
> NAK this one for the moment
>
> We are about to set fifo loose through all the USB and some other
> char/serial drivers all of which will use the spinlock facility.

That sounds like a good reason for applying this patch first.

kfifo has no business assuming that the caller wants to use
spin_lock() locking.

If we want to add wrapper helpers around kfifo to reduce code
duplication in callers, and if one of those wrapper helpers provides
spinlock-based locking then fine.

But the happens-to-use-spin_lock functions shouldn't be called
kfifo_get(), because that steals namespace from the unlocked functions,
and makes the naming for the happens-to-use-mutex_lock functions look
weird.

--
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/