[PATCH 1/2] include: linux/iopoll.h: add optional PBL support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



While we don't have generic clocksource support in PBL, there is no
reason to not enable read_poll_timeout for use on platforms that have
their own get_time_ns.

Allow these platforms to use read_poll_timeout by defining two macros:
read_pol_is_timeout and read_poll_get_time_ns().

Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
---
 include/linux/iopoll.h | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/include/linux/iopoll.h b/include/linux/iopoll.h
index 9350a3d05007..36a2541eb4ce 100644
--- a/include/linux/iopoll.h
+++ b/include/linux/iopoll.h
@@ -12,6 +12,18 @@
 #include <clock.h>
 #include <pbl.h>
 
+#if IN_PROPER
+# define read_poll_get_time_ns()	get_time_ns()
+# define read_poll_is_timeout(s, t)	is_timeout(s, t)
+#else
+# ifndef read_poll_get_time_ns
+#  define read_poll_get_time_ns()	0
+# endif
+# ifndef read_poll_is_timeout
+#  define read_poll_is_timeout(s, t)	((void)s, (void)t, 0)
+# endif
+#endif
+
 /**
  * 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)
@@ -31,15 +43,13 @@
  */
 #define read_poll_timeout(op, val, cond, timeout_us, args...)	\
 ({ \
-	uint64_t start = 0; \
-	if (IN_PROPER && (timeout_us) != 0) \
-		start = get_time_ns(); \
+	uint64_t start = timeout_us ? read_poll_get_time_ns() : 0; \
 	for (;;) { \
 		(val) = op(args); \
 		if (cond) \
 			break; \
-		if (IN_PROPER && (timeout_us) != 0 && \
-		    is_timeout(start, ((timeout_us) * USECOND))) { \
+		if ((timeout_us) != 0 && \
+		    read_poll_is_timeout(start, ((timeout_us) * USECOND))) { \
 			(val) = op(args); \
 			break; \
 		} \
-- 
2.39.5





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux