* [PATCH] RT: epca_lock to DEFINE_SPINLOCK
@ 2005-09-27 18:32 Daniel Walker
2005-09-27 22:34 ` Thomas Gleixner
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Daniel Walker @ 2005-09-27 18:32 UTC (permalink / raw)
To: mingo; +Cc: linux-kernel
Convert epca_lock to the new syntax.
Signed-Off-By: Daniel Walker <dwalker@mvista.com>
Index: linux-2.6.13/drivers/char/epca.c
===================================================================
--- linux-2.6.13.orig/drivers/char/epca.c
+++ linux-2.6.13/drivers/char/epca.c
@@ -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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] RT: epca_lock to DEFINE_SPINLOCK
2005-09-27 18:32 [PATCH] RT: epca_lock to DEFINE_SPINLOCK Daniel Walker
@ 2005-09-27 22:34 ` Thomas Gleixner
2005-09-28 9:33 ` Ingo Molnar
2005-09-28 9:39 ` Arjan van de Ven
2 siblings, 0 replies; 8+ messages in thread
From: Thomas Gleixner @ 2005-09-27 22:34 UTC (permalink / raw)
To: dwalker; +Cc: mingo, linux-kernel
On Tue, 2005-09-27 at 11:32 -0700, Daniel Walker wrote:
> Convert epca_lock to the new syntax.
>
> Signed-Off-By: Daniel Walker <dwalker@mvista.com>
>
> Index: linux-2.6.13/drivers/char/epca.c
> ===================================================================
> --- linux-2.6.13.orig/drivers/char/epca.c
> +++ linux-2.6.13/drivers/char/epca.c
> @@ -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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] RT: epca_lock to DEFINE_SPINLOCK
2005-09-27 18:32 [PATCH] RT: epca_lock to DEFINE_SPINLOCK Daniel Walker
2005-09-27 22:34 ` Thomas Gleixner
@ 2005-09-28 9:33 ` Ingo Molnar
2005-09-28 9:39 ` Arjan van de Ven
2 siblings, 0 replies; 8+ messages in thread
From: Ingo Molnar @ 2005-09-28 9:33 UTC (permalink / raw)
To: Daniel Walker; +Cc: linux-kernel
* Daniel Walker <dwalker@mvista.com> wrote:
> Convert epca_lock to the new syntax.
thanks, applied.
Ingo
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] RT: epca_lock to DEFINE_SPINLOCK
2005-09-27 18:32 [PATCH] RT: epca_lock to DEFINE_SPINLOCK Daniel Walker
2005-09-27 22:34 ` Thomas Gleixner
2005-09-28 9:33 ` Ingo Molnar
@ 2005-09-28 9:39 ` Arjan van de Ven
2005-09-28 15:54 ` Daniel Walker
2005-09-28 16:06 ` Roland Dreier
2 siblings, 2 replies; 8+ messages in thread
From: Arjan van de Ven @ 2005-09-28 9:39 UTC (permalink / raw)
To: dwalker; +Cc: mingo, linux-kernel
On Tue, 2005-09-27 at 11:32 -0700, Daniel Walker wrote:
> Convert epca_lock to the new syntax.
>
> Signed-Off-By: Daniel Walker <dwalker@mvista.com>
>
> Index: linux-2.6.13/drivers/char/epca.c
> ===================================================================
> --- linux-2.6.13.orig/drivers/char/epca.c
> +++ linux-2.6.13/drivers/char/epca.c
> @@ -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.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] RT: epca_lock to DEFINE_SPINLOCK
2005-09-28 9:39 ` Arjan van de Ven
@ 2005-09-28 15:54 ` Daniel Walker
2005-09-28 16:06 ` Roland Dreier
1 sibling, 0 replies; 8+ messages in thread
From: Daniel Walker @ 2005-09-28 15:54 UTC (permalink / raw)
To: Arjan van de Ven; +Cc: mingo, linux-kernel
On Wed, 2005-09-28 at 11:39 +0200, Arjan van de Ven wrote:
> 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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] RT: epca_lock to DEFINE_SPINLOCK
2005-09-28 9:39 ` Arjan van de Ven
2005-09-28 15:54 ` Daniel Walker
@ 2005-09-28 16:06 ` Roland Dreier
2005-09-28 20:43 ` Nikita Danilov
1 sibling, 1 reply; 8+ messages in thread
From: Roland Dreier @ 2005-09-28 16:06 UTC (permalink / raw)
To: Arjan van de Ven; +Cc: dwalker, mingo, linux-kernel
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.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] RT: epca_lock to DEFINE_SPINLOCK
2005-09-28 16:06 ` Roland Dreier
@ 2005-09-28 20:43 ` Nikita Danilov
2005-09-29 6:49 ` Steven Rostedt
0 siblings, 1 reply; 8+ messages in thread
From: Nikita Danilov @ 2005-09-28 20:43 UTC (permalink / raw)
To: Roland Dreier; +Cc: dwalker, mingo, linux-kernel
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.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] RT: epca_lock to DEFINE_SPINLOCK
2005-09-28 20:43 ` Nikita Danilov
@ 2005-09-29 6:49 ` Steven Rostedt
0 siblings, 0 replies; 8+ messages in thread
From: Steven Rostedt @ 2005-09-29 6:49 UTC (permalink / raw)
To: Nikita Danilov; +Cc: Roland Dreier, dwalker, mingo, linux-kernel
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
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2005-09-29 6:49 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-09-27 18:32 [PATCH] RT: epca_lock to DEFINE_SPINLOCK Daniel Walker
2005-09-27 22:34 ` Thomas Gleixner
2005-09-28 9:33 ` Ingo Molnar
2005-09-28 9:39 ` Arjan van de Ven
2005-09-28 15:54 ` Daniel Walker
2005-09-28 16:06 ` Roland Dreier
2005-09-28 20:43 ` Nikita Danilov
2005-09-29 6:49 ` Steven Rostedt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).