WARNING: mutexes are preferred for single holder semaphores
Sean MacLennan
seanm at seanm.ca
Mon May 5 11:31:26 EST 2008
On Mon, 05 May 2008 11:06:55 +1000
"Michael Ellerman" <michael at ellerman.id.au> wrote:
> On Sun, 2008-05-04 at 20:41 -0400, Sean MacLennan wrote:
> > This is a bit OT, but I got the warning in the subject from
> > checkpatch.pl for a piece of code. The code *is* using a mutex.
> > Does it actually mean I shouldn't use a mutex?
> >
> > The code declares a global mutex:
> >
> > static DECLARE_MUTEX(list_lock);
>
> .. which is a semaphore :( [see include/linux/semaphore.h]
>
> I think you want DEFINE_MUTEX().
>
> Yes, this is completely ridiculous.
>
> cheers
>
Ok, that fixed it, once I changed all the up and down calls :p
Thanks.
Cheers,
Sean
More information about the Linuxppc-dev
mailing list