RT: epca_lock to DEFINE_SPINLOCK
PATCH 1/1 RT: epca_lock to DEFINE_SPINLOCK
Convert epca_lock to the new syntax.
drivers/char/epca.c +1 -1
@@ -80,7 +80,7 @@ static int invalid_lilo_config;/* The ISA boards do window flipping into the same spaces so its only sane with a single lock. It's still pretty efficient */ -static spinlock_t epca_lock =SPIN_LOCK_UNLOCKED ; +static DEFINE_SPINLOCK (epca_lock);/* ----------------------------------------------------------------------- MAXBOARDS is typically 12, but ISA and EISA cards are restricted to
Quoted 9 lines · Daniel Walker
Convert
epca_lockto the new syntax.Signed-off-by Daniel Walker <[email protected]>Index:
linux-2.6.13/drivers/char/epca.c
===================================================================
drivers/char/epca.c static int invalid_lilo_config; · line 83
Quoted 5 lines
drivers/char/epca.c +1
-1@@ -80,7 +80,7 @@ static int invalid_lilo_config;/* The ISA boards do window flipping into the same spaces so its only sane with a single lock. It's still pretty efficient */ -static spinlock_t epca_lock =SPIN_LOCK_UNLOCKED ; +static DEFINE_SPINLOCK (epca_lock);
Please submit also to Andrew/subsystem maintainer. Thats not a -RT related issue.
tglx
Ingo Molnar
AppliedQuoted 1 line · Daniel Walker
Convert
epca_lockto the new syntax.
thanks, applied.
Ingo
Quoted 9 lines · Daniel Walker
Convert
epca_lockto the new syntax.Signed-off-by Daniel Walker <[email protected]>Index:
linux-2.6.13/drivers/char/epca.c
===================================================================
drivers/char/epca.c static int invalid_lilo_config; · line 85
Quoted 7 lines
drivers/char/epca.c +1
-1@@ -80,7 +80,7 @@ static int invalid_lilo_config;/* The ISA boards do window flipping into the same spaces so its only sane with a single lock. It's still pretty efficient */ -static spinlock_t epca_lock =SPIN_LOCK_UNLOCKED ; +static DEFINE_SPINLOCK (epca_lock);/* ------------------
this is really ugly though; at minimum a DEFINE_STATIC_SPINLOCK() would be needed to make this less ugly.
Quoted 2 lines · Arjan van de Ven
this is really ugly though; at minimum a
DEFINE_STATIC_SPINLOCK()would be needed to make this less ugly.
Doesn't exists as far as I know .. Shall we make one ?
Daniel
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.
- R.
Quoted 8 lines · Roland Dreier
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?
Quoted 2 lines
- R.
Nikita.
Quoted 10 lines · Nikita Danilov
The only reasonable case where
DEFINE_FOO(x)is really necessary is when initializer uses address of x, but even in that case something likespinlock_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