lkml.org 
[lkml]   [2005]   [Sep]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] RT: epca_lock to DEFINE_SPINLOCK
Roland Dreier writes:
> Arjan> this is really ugly though; at minimum a DEFINE_STATIC_SPINLOCK()
> Arjan> would be needed to make this less ugly.
>
> huh? This is a totally standard kernel idiom -- just do
>
> grep -Er 'static (DECLARE|DEFINE)' .
>
> in a kernel tree to see how prevalent it is.

It may be widely used and still ugly. The general problem with
DEFINE_FOO() macros is that they obfuscate things: they do not _look_
like C variable declarations, and, in particular, type of variable is
not immediately obvious.

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);

The question is: does RT really have to force DEFINE_* as the only way
to define things?

>
> - R.

Nikita.
-
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-28 22:46    [W:0.064 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site