[PATCH v4 2/4] iopoll: Improve handling of timeout_us param in read_poll_timeout macro

Ronan Dalton ronan.dalton at alliedtelesis.co.nz
Tue Mar 3 07:25:03 CET 2026


The read_poll_timeout macro definition is missing parenthesis around the
usages of timeout_us. Also, the local timeout variable should be named
__timeout to distinguish it from any variable named timeout in the
surrounding scope.

Wrap the timeout_us parameter in brackets and rename timeout to
__timeout to follow macro definition best-practices.

This change brings the macro definition more in line with what Linux
does.

Signed-off-by: Ronan Dalton <ronan.dalton at alliedtelesis.co.nz>
Cc: Ariel D'Alessandro <ariel.dalessandro at collabora.com>
Cc: Marek Vasut <marex at denx.de>
---
Changes for v2:
- This is a new patch in the patch set
Changes for v3:
- Use __timeout instead of timeout variable declaration to avoid clashes
- Rename patch headline to reflect extra change mentioned above
Changes for v4:
- Update commit message to have more detail

 include/linux/iopoll.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/iopoll.h b/include/linux/iopoll.h
index d6573fafab0..e851eb2cc41 100644
--- a/include/linux/iopoll.h
+++ b/include/linux/iopoll.h
@@ -29,12 +29,12 @@
  */
 #define read_poll_timeout(op, val, cond, sleep_us, timeout_us, args...)	\
 ({ \
-	unsigned long timeout = timer_get_us() + timeout_us; \
+	unsigned long __timeout = timer_get_us() + (timeout_us); \
 	for (;;) { \
 		(val) = op(args); \
 		if (cond) \
 			break; \
-		if (timeout_us && time_after(timer_get_us(), timeout)) { \
+		if ((timeout_us) && time_after(timer_get_us(), __timeout)) { \
 			(val) = op(args); \
 			break; \
 		} \
-- 
2.53.0



More information about the U-Boot mailing list