Thread (1 message) 1 message, 1 author, 2014-10-09
DORMANTno replies

[PATCH v4 1/2] iopoll: Introduce memory-mapped IO polling macros

From: Mitchel Humpherys <hidden>
Date: 2014-10-09 22:45:05
Also in: linux-iommu

On Tue, Oct 07 2014 at 06:47:59 PM, Mitchel Humpherys [off-list ref] wrote:
quoted
quoted
+#define readl_poll_timeout_atomic(addr, val, cond, max_reads, time_between_us) \
+({ \
+       int count; \
+       for (count = (max_reads); count > 0; count--) { \
+               (val) = readl(addr); \
+               if (cond) \
+                       break; \
+               udelay(time_between_us); \
+       } \
+       (cond) ? 0 : -ETIMEDOUT; \
+})
udelay has a large variability, I think it would be better to also use
ktime_compare here and make the interface the same as the other one.
You might want to add a warning if someone tries to pass more than a few
microseconds as the timeout.
Sounds good, will update in v5.
Except I'll probably hold off on adding a warning about udelay since
udelay already includes a "warning" (a compile error, actually) when
exceedingly large delays are requested.


-Mitch

-- 
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help