Commit eaa6b010 authored by Dejin Zheng's avatar Dejin Zheng Committed by David S. Miller

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: default avatarDejin Zheng <zhengdejin5@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5f5323a1
...@@ -76,25 +76,7 @@ ...@@ -76,25 +76,7 @@
* macros defined below rather than this macro directly. * macros defined below rather than this macro directly.
*/ */
#define readx_poll_timeout(op, addr, val, cond, sleep_us, timeout_us) \ #define readx_poll_timeout(op, addr, val, cond, sleep_us, timeout_us) \
({ \ read_poll_timeout(op, val, cond, sleep_us, timeout_us, false, addr)
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; \
})
/** /**
* readx_poll_timeout_atomic - Periodically poll an address until a condition is met or a timeout occurs * readx_poll_timeout_atomic - Periodically poll an address until a condition is met or a timeout occurs
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment