summaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2020-05-14 07:11:20 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2020-05-14 07:11:20 +0200
commit9b01acf90f04aaf3f6f41875e91272cbeac51171 (patch)
treee0a8f1d096d3b8967961386a98cf08f28f494998 /include/linux
parent6e68393fb17254850b9bfc8e268569a05111c29c (diff)
parentb1dd1585deb21db5b595549267219ff9364dd4c8 (diff)
downloadbarebox-9b01acf90f04aaf3f6f41875e91272cbeac51171.tar.gz
barebox-9b01acf90f04aaf3f6f41875e91272cbeac51171.tar.xz
Merge branch 'for-next/powerpc'
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/iopoll.h29
1 files changed, 24 insertions, 5 deletions
diff --git a/include/linux/iopoll.h b/include/linux/iopoll.h
index 66c8f652ca..8bf912e173 100644
--- a/include/linux/iopoll.h
+++ b/include/linux/iopoll.h
@@ -13,12 +13,12 @@
#include <pbl.h>
/**
- * readx_poll_timeout - Periodically poll an address until a condition is met or a timeout occurs
+ * read_poll_timeout - Periodically poll an address until a condition is met or a timeout occurs
* @op: accessor function (takes @addr as its only argument)
- * @addr: Address to poll
* @val: Variable to read the value into
* @cond: Break condition (usually involving @val)
* @timeout_us: Timeout in us, 0 means never timeout
+ * @args: arguments for @op poll
*
* Returns 0 on success and -ETIMEDOUT upon a timeout. In either
* case, the last read value at @addr is stored in @val.
@@ -29,24 +29,43 @@
* We do not have timing functions in the PBL, so ignore the timeout value and
* loop infinitely here.
*/
-#define readx_poll_timeout(op, addr, val, cond, timeout_us) \
+#define read_poll_timeout(op, val, cond, timeout_us, args...) \
({ \
uint64_t start; \
if (!IN_PBL && timeout_us) \
start = get_time_ns(); \
for (;;) { \
- (val) = op(addr); \
+ (val) = op(args); \
if (cond) \
break; \
if (!IN_PBL && timeout_us && \
is_timeout(start, ((timeout_us) * USECOND))) { \
- (val) = op(addr); \
+ (val) = op(args); \
break; \
} \
} \
(cond) ? 0 : -ETIMEDOUT; \
})
+/**
+ * readx_poll_timeout - Periodically poll an address until a condition is met or a timeout occurs
+ * @op: accessor function (takes @addr as its only argument)
+ * @addr: Address to poll
+ * @val: Variable to read the value into
+ * @cond: Break condition (usually involving @val)
+ * @timeout_us: Timeout in us, 0 means never timeout
+ *
+ * Returns 0 on success and -ETIMEDOUT upon a timeout. In either
+ * case, the last read value at @addr is stored in @val.
+ *
+ * When available, you'll probably want to use one of the specialized
+ * macros defined below rather than this macro directly.
+ *
+ * We do not have timing functions in the PBL, so ignore the timeout value and
+ * loop infinitely here.
+ */
+#define readx_poll_timeout(op, addr, val, cond, timeout_us) \
+ read_poll_timeout(op, val, cond, timeout_us, addr)
#define readb_poll_timeout(addr, val, cond, timeout_us) \
readx_poll_timeout(readb, addr, val, cond, timeout_us)