[PATCH 1/2] wait: add parentheses to "state" argument in macro

From: Winston Wen
Date: Wed Mar 06 2024 - 21:59:59 EST


Now if we use macro wait_event_state() like this:

wait_event_state(waitq, condition,
TASK_KILLABLE|TASK_FREEZABLE);

we'll get a build warning in __wait_is_interruptible because of:

((state) & (TASK_INTERRUPTIBLE | TASK_WAKEKILL)))

Parenthesise the use of "state" argument to avoid this warning as
it's very common to use "TASK_*|TASK_*" as function parameter in kernel.

Signed-off-by: Winston Wen <wentao@xxxxxxxxxxxxx>
---
include/linux/wait.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/wait.h b/include/linux/wait.h
index 8aa3372f21a0..a4e57865aded 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -280,7 +280,7 @@ static inline void wake_up_pollfree(struct wait_queue_head *wq_head)

#define ___wait_is_interruptible(state) \
(!__builtin_constant_p(state) || \
- (state & (TASK_INTERRUPTIBLE | TASK_WAKEKILL)))
+ ((state) & (TASK_INTERRUPTIBLE | TASK_WAKEKILL)))

extern void init_wait_entry(struct wait_queue_entry *wq_entry, int flags);

--
2.43.0


--MP_/EEmQMRzKmMSEPIz7proBNED--