lkml.org 
[lkml]   [2005]   [Sep]   [29]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateThu, 29 Sep 2005 02:49:31 -0400 (EDT)
FromSteven Rostedt <>
SubjectRe: [PATCH] RT: epca_lock to DEFINE_SPINLOCK
On Thu, 29 Sep 2005, Nikita Danilov wrote:

>
> The only reasonable case where DEFINE_FOO(x) is really necessary is when
> initializer uses address of x, but even in that case something like
>
>         spinlock_t guard = SPINLOCK_UNLOCKED(guard);
>
> is much more readable than
>
>         DEFINE_SPIN_LOCK(guard);
>

Except that the former is also error prone. I just found a bug in my code
(I customize Ingo's RT kernel) where I had a cut and paste error:

spinlock_t a = SPINLOCK_UNLOCKED(a);
spinlock_t b = SPINLOCK_UNLOCKED(a);

This took me two days to find since the problems occurred elsewhere.

-- Steve

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

\
 
 \ /
  Last update: 2005-09-29 06:52    [from the cache]
©2003-2008