All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] semaphore.h: add missing "sleepers = 0" initialization
@ 2006-10-30 10:43 Robert P. J. Day
  2006-10-30 10:54 ` Al Viro
  0 siblings, 1 reply; 3+ messages in thread
From: Robert P. J. Day @ 2006-10-30 10:43 UTC (permalink / raw)
  To: Linux Kernel Mailing List; +Cc: trivial


  Add the missing initialization of "sleepers" to 0 in two semaphore
initialization macros.

Signed-off-by: Robert P. J. Day <rpjday@mindspring.com>
---
diff --git a/include/asm-arm/semaphore.h b/include/asm-arm/semaphore.h
index d5dc624..08657e6 100644
--- a/include/asm-arm/semaphore.h
+++ b/include/asm-arm/semaphore.h
@@ -18,10 +18,11 @@ struct semaphore {
 	wait_queue_head_t wait;
 };

-#define __SEMAPHORE_INIT(name, cnt)				\
-{								\
-	.count	= ATOMIC_INIT(cnt),				\
-	.wait	= __WAIT_QUEUE_HEAD_INITIALIZER((name).wait),	\
+#define __SEMAPHORE_INIT(name, cnt)					\
+{									\
+	.count		= ATOMIC_INIT(cnt),				\
+	.sleepers	= 0,						\
+	.wait		= __WAIT_QUEUE_HEAD_INITIALIZER((name).wait),	\
 }

 #define __DECLARE_SEMAPHORE_GENERIC(name,count)	\
diff --git a/include/asm-avr32/semaphore.h b/include/asm-avr32/semaphore.h
index ef99ddc..c15ecde 100644
--- a/include/asm-avr32/semaphore.h
+++ b/include/asm-avr32/semaphore.h
@@ -29,6 +29,7 @@ struct semaphore {
 #define __SEMAPHORE_INITIALIZER(name, n)				\
 {									\
 	.count		= ATOMIC_INIT(n),				\
+	.sleepers	= 0,						\
 	.wait		= __WAIT_QUEUE_HEAD_INITIALIZER((name).wait)	\
 }


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] semaphore.h: add missing "sleepers = 0" initialization
  2006-10-30 10:43 [PATCH] semaphore.h: add missing "sleepers = 0" initialization Robert P. J. Day
@ 2006-10-30 10:54 ` Al Viro
  2006-10-30 12:03   ` Robert P. J. Day
  0 siblings, 1 reply; 3+ messages in thread
From: Al Viro @ 2006-10-30 10:54 UTC (permalink / raw)
  To: Robert P. J. Day; +Cc: Linux Kernel Mailing List, trivial

On Mon, Oct 30, 2006 at 05:43:14AM -0500, Robert P. J. Day wrote:
> 
>   Add the missing initialization of "sleepers" to 0 in two semaphore
> initialization macros.

Umm...  What the hell for?  Both for struct initializer and for
compound literals all named fields that had not been mentioned
get initialized as they would for static objects.  So that's
simply adding more work to parser for no reason whatsoever.

There are only two cases when something is left uninitialized:
	* auto variable with no initializer whatsoever
	* padding and unnamed members

That's it.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] semaphore.h: add missing "sleepers = 0" initialization
  2006-10-30 10:54 ` Al Viro
@ 2006-10-30 12:03   ` Robert P. J. Day
  0 siblings, 0 replies; 3+ messages in thread
From: Robert P. J. Day @ 2006-10-30 12:03 UTC (permalink / raw)
  To: Al Viro; +Cc: Linux Kernel Mailing List, trivial

On Mon, 30 Oct 2006, Al Viro wrote:

> On Mon, Oct 30, 2006 at 05:43:14AM -0500, Robert P. J. Day wrote:
> >
> >   Add the missing initialization of "sleepers" to 0 in two semaphore
> > initialization macros.
>
> Umm...  What the hell for?  Both for struct initializer and for
> compound literals all named fields that had not been mentioned get
> initialized as they would for static objects.  So that's simply
> adding more work to parser for no reason whatsoever.

i did that simply to make those initializations *consistent* across
all of the other dozen or so semaphore.h files that *do* explicitly
initialize that structure member (as you point out, for no good
reason).  i'm just as happy to whack out all of those useless
initializations, though, and submit another patch.  either way works
for me.

rday

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-10-30 12:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-30 10:43 [PATCH] semaphore.h: add missing "sleepers = 0" initialization Robert P. J. Day
2006-10-30 10:54 ` Al Viro
2006-10-30 12:03   ` Robert P. J. Day

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.