diff mbox series

[v1,1/2] iopoll: Introduce ioreadXX_poll_timeout() macros

Message ID 20230330141413.25569-1-andriy.shevchenko@linux.intel.com
State New
Headers show
Series [v1,1/2] iopoll: Introduce ioreadXX_poll_timeout() macros | expand

Commit Message

Andy Shevchenko March 30, 2023, 2:14 p.m. UTC
From: Olliver Schinagl <oliver@schinagl.nl>

There are users in the Linux kernel that would benefit from using
ioreadXX_poll_timeout() macros, such as ioread32_poll_timeout().
Introduce those macros.

Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
Co-developed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 include/linux/iopoll.h | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

Comments

Olliver Schinagl March 31, 2023, 8:12 a.m. UTC | #1
Hey Andy,

On 30-03-2023 16:14, Andy Shevchenko wrote:
> From: Olliver Schinagl <oliver@schinagl.nl>
>
> There are users in the Linux kernel that would benefit from using
> ioreadXX_poll_timeout() macros, such as ioread32_poll_timeout().
> Introduce those macros.
>
> Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
> Co-developed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>   include/linux/iopoll.h | 27 +++++++++++++++++++++++++++
>   1 file changed, 27 insertions(+)
>
> diff --git a/include/linux/iopoll.h b/include/linux/iopoll.h
> index 2c8860e406bd..30ba609175a7 100644
> --- a/include/linux/iopoll.h
> +++ b/include/linux/iopoll.h
> @@ -140,6 +140,7 @@
>   #define readx_poll_timeout_atomic(op, addr, val, cond, delay_us, timeout_us) \
>   	read_poll_timeout_atomic(op, val, cond, delay_us, timeout_us, false, addr)
>   
> +/* readX() */
>   #define readb_poll_timeout(addr, val, cond, delay_us, timeout_us) \
>   	readx_poll_timeout(readb, addr, val, cond, delay_us, timeout_us)
>   
> <snip>
>   #endif /* _LINUX_IOPOLL_H */
Thanks for re-posting this? (I don't recall If I actually posted the 
first time around).

But I actually have a small addendum for this series, as it will break 
`drivers/net/wwan/t7xx/t7xx_dpmaif.c` due to a redefinition (yeah I know).

So I have:
https://gitlab.com/olliver/linux/-/commit/c9e591f2dabb2dbaeceebee61fa70b70fdbffc2a
https://gitlab.com/olliver/linux/-/commit/41e0f8c08a1c55940813a240215910336ad7bec2
https://gitlab.com/olliver/linux/-/commit/f36562f09b0185d403415864ef7218b46a742cdc
https://gitlab.com/olliver/linux/-/commit/66237fd97bc42d272602b01dc0cca541c619b2be

Which actually replaces silly calls like readx_poll_timeout(ioread32, ... .

Do you want me to (re-?)post this as a series? I can put your 
thunderbolt (and your changes here) and post as one big series (or you 
can do the same obviously).

Olliver
diff mbox series

Patch

diff --git a/include/linux/iopoll.h b/include/linux/iopoll.h
index 2c8860e406bd..30ba609175a7 100644
--- a/include/linux/iopoll.h
+++ b/include/linux/iopoll.h
@@ -140,6 +140,7 @@ 
 #define readx_poll_timeout_atomic(op, addr, val, cond, delay_us, timeout_us) \
 	read_poll_timeout_atomic(op, val, cond, delay_us, timeout_us, false, addr)
 
+/* readX() */
 #define readb_poll_timeout(addr, val, cond, delay_us, timeout_us) \
 	readx_poll_timeout(readb, addr, val, cond, delay_us, timeout_us)
 
@@ -164,6 +165,7 @@ 
 #define readq_poll_timeout_atomic(addr, val, cond, delay_us, timeout_us) \
 	readx_poll_timeout_atomic(readq, addr, val, cond, delay_us, timeout_us)
 
+/* readX_relaxed() */
 #define readb_relaxed_poll_timeout(addr, val, cond, delay_us, timeout_us) \
 	readx_poll_timeout(readb_relaxed, addr, val, cond, delay_us, timeout_us)
 
@@ -188,4 +190,29 @@ 
 #define readq_relaxed_poll_timeout_atomic(addr, val, cond, delay_us, timeout_us) \
 	readx_poll_timeout_atomic(readq_relaxed, addr, val, cond, delay_us, timeout_us)
 
+/* ioreadXX() */
+#define ioread8_poll_timeout(addr, val, cond, delay_us, timeout_us) \
+	readx_poll_timeout(ioread8, addr, val, cond, delay_us, timeout_us)
+
+#define ioread8_poll_timeout_atomic(addr, val, cond, delay_us, timeout_us) \
+	readx_poll_timeout_atomic(ioread8, addr, val, cond, delay_us, timeout_us)
+
+#define ioread16_poll_timeout(addr, val, cond, delay_us, timeout_us) \
+	readx_poll_timeout(ioread16, addr, val, cond, delay_us, timeout_us)
+
+#define ioread16_poll_timeout_atomic(addr, val, cond, delay_us, timeout_us) \
+	readx_poll_timeout_atomic(ioread16, addr, val, cond, delay_us, timeout_us)
+
+#define ioread32_poll_timeout(addr, val, cond, delay_us, timeout_us) \
+	readx_poll_timeout(ioread32, addr, val, cond, delay_us, timeout_us)
+
+#define ioread32_poll_timeout_atomic(addr, val, cond, delay_us, timeout_us) \
+	readx_poll_timeout_atomic(ioread32, addr, val, cond, delay_us, timeout_us)
+
+#define ioread64_poll_timeout(addr, val, cond, delay_us, timeout_us) \
+	readx_poll_timeout(ioread64, addr, val, cond, delay_us, timeout_us)
+
+#define ioread64_poll_timeout_atomic(addr, val, cond, delay_us, timeout_us) \
+	readx_poll_timeout_atomic(ioread64, addr, val, cond, delay_us, timeout_us)
+
 #endif /* _LINUX_IOPOLL_H */