Skip to contentSkip to conversation

+ wait-explain-the-shadowing-and-type-inconsistencies.patch added to -mm tree

PATCH [email protected] 1 participant 1 message Apr 9, 2014 Scheduler

lore
Share & tools
lore
#0 lore raw

Subject: + wait-explain-the-shadowing-and-type-inconsistencies.patch added to -mm tree
To: [email protected],[email protected]
From: [email protected]
Date: Wed, 09 Apr 2014 12:04:44 -0700

The patch titled
Subject: wait: explain the shadowing and type inconsistencies
has been added to the -mm tree. Its filename is
wait-explain-the-shadowing-and-type-inconsistencies.patch

This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/wait-explain-the-shadowing-and-type-inconsistencies.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/wait-explain-the-shadowing-and-type-inconsistencies.patch

Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

The -mm tree is included into linux-next and is updated there every 3-4 working days

------------------------------------------------------
From: Peter Zijlstra <[email protected]>
Subject: wait: explain the shadowing and type inconsistencies

Stick in a comment before someone else tries to fix the sparse warning this generates.

---

 include/linux/wait.h |   14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
include/linux/wait.h renamed from include/linux/wait.h~wait-explain-the-shadowing-and-type-inconsistencies +13 -1
diff -puN include/linux/wait.h~wait-explain-the-shadowing-and-type-inconsistencies include/linux/wait.h
@@ -191,11 +191,23 @@ wait_queue_head_t *bit_waitqueue(void *,
 	(!__builtin_constant_p(state) ||				\
 		state == TASK_INTERRUPTIBLE || state == TASK_KILLABLE)	\
 
+/*
+ * The below macro ___wait_event() has an explicit shadow of the __ret
+ * variable when used from the wait_event_*() macros.
+ *
+ * This is so that both can use the ___wait_cond_timeout() construct
+ * to wrap the condition.
+ *
+ * The type inconsistency of the wait_event_*() __ret variable is also
+ * on purpose; we use long where we can return timeout values and int
+ * otherwise.
+ */
+
 #define ___wait_event(wq, condition, state, exclusive, ret, cmd)	\
 ({									\
 	__label__ __out;						\
 	wait_queue_t __wait;						\
-	long __ret = ret;						\
+	long __ret = ret;	/* explicit shadow */			\
 									\
 	INIT_LIST_HEAD(&__wait.task_list);				\
 	if (exclusive)							\

_

Patches currently in -mm which might be from [email protected] are

origin.patch wait-explain-the-shadowing-and-type-inconsistencies.patch