lkml.org 
[lkml]   [2008]   [Feb]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC] mmiotrace full patch, preview 1
On Mon, Feb 25, 2008 at 09:42:00PM -0500, Pavel Roskin wrote:
> Quoting Christoph Hellwig <hch@infradead.org>:
>
> >On Mon, Feb 25, 2008 at 02:49:22PM -0800, Andrew Morton wrote:
> >>the things which it finds.
> >>
> >>> +static DECLARE_MUTEX(kmmio_init_mutex);
> >>
> >>That's not a mutex.
> >>
> >>> + down(&kmmio_init_mutex);
> >>
> >>It's a semaphore. Please do convert it to a mutex.
> >>
> >>Andy, I'd say that addition of new semaphores is worth a warning - they're
> >>rarely legitimate.
> >
> >I'm not sure that any semaphore should be a warning, but the initializer
> >for semaphore used as binary mutex (DECLARE_MUTEX and init_MUTEX) are
> >worth it.
>
> It looks like a mutex, it acts like a mutex, but it isn't a mutex,
> it's a trap for the unwary. Weird. I was annoyed by it before; now I
> see a fellow developer actually getting into that trap.
>
> I'd say, rename DECLARE_MUTEX to DECLARE_SEMAPHORE and let external
> code be fixed one way or another (i.e. stick with the "mutex" name or
> stick with the semaphore functionality if it's really needed).

I like the fact that in evey architecture its defined as:

#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1)

-apw


\
 
 \ /
  Last update: 2008-02-26 09:59    [W:0.057 / U:0.576 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site