[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200322174943.26332-3-zhengdejin5@gmail.com>
Date: Mon, 23 Mar 2020 01:49:35 +0800
From: Dejin Zheng <zhengdejin5@...il.com>
To: andrew@...n.ch, f.fainelli@...il.com, hkallweit1@...il.com,
linux@...linux.org.uk, davem@...emloft.net,
mchehab+samsung@...nel.org, corbet@....net,
gregkh@...uxfoundation.org, broonie@...nel.org, tglx@...utronix.de,
netdev@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, Dejin Zheng <zhengdejin5@...il.com>
Subject: [PATCH net-next v5 02/10] iopoll: redefined readx_poll_timeout macro to simplify the code
redefined readx_poll_timeout macro by read_poll_timeout to
simplify the code.
Signed-off-by: Dejin Zheng <zhengdejin5@...il.com>
---
v4 -> v5:
- no changed
v3 -> v4:
- no changed
v2 -> v3:
- no changed
v1 -> v2:
- no changed
include/linux/iopoll.h | 20 +-------------------
1 file changed, 1 insertion(+), 19 deletions(-)
diff --git a/include/linux/iopoll.h b/include/linux/iopoll.h
index 7d44a2e20267..29c016cd6249 100644
--- a/include/linux/iopoll.h
+++ b/include/linux/iopoll.h
@@ -72,25 +72,7 @@
* macros defined below rather than this macro directly.
*/
#define readx_poll_timeout(op, addr, val, cond, sleep_us, timeout_us) \
-({ \
- u64 __timeout_us = (timeout_us); \
- unsigned long __sleep_us = (sleep_us); \
- ktime_t __timeout = ktime_add_us(ktime_get(), __timeout_us); \
- might_sleep_if((__sleep_us) != 0); \
- for (;;) { \
- (val) = op(addr); \
- if (cond) \
- break; \
- if (__timeout_us && \
- ktime_compare(ktime_get(), __timeout) > 0) { \
- (val) = op(addr); \
- break; \
- } \
- if (__sleep_us) \
- usleep_range((__sleep_us >> 2) + 1, __sleep_us); \
- } \
- (cond) ? 0 : -ETIMEDOUT; \
-})
+ read_poll_timeout(op, val, cond, sleep_us, timeout_us, addr)
/**
* readx_poll_timeout_atomic - Periodically poll an address until a condition is met or a timeout occurs
--
2.25.0
Powered by blists - more mailing lists