[bootlin/training-materials updates] master: kernel: sleeping: Add a slide about the readx_poll_timeout helpers (e0c57d3e)

Thomas Petazzoni thomas.petazzoni at bootlin.com
Fri Oct 29 10:46:39 CEST 2021

Repository : https://github.com/bootlin/training-materials
On branch  : master
Link       : https://github.com/bootlin/training-materials/commit/e0c57d3ec3bc076cd381b620e851992dbe768a46


commit e0c57d3ec3bc076cd381b620e851992dbe768a46
Author: Miquel Raynal <miquel.raynal at bootlin.com>
Date:   Tue Jun 22 20:44:45 2021 +0200

    kernel: sleeping: Add a slide about the readx_poll_timeout helpers
    These are quite common in the drivers, especially for short wait
    periods against hardware changes.
    Signed-off-by: Miquel Raynal <miquel.raynal at bootlin.com>


 .../kernel-driver-development-sleeping.tex         | 27 ++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/slides/kernel-driver-development-sleeping/kernel-driver-development-sleeping.tex b/slides/kernel-driver-development-sleeping/kernel-driver-development-sleeping.tex
index a97831f8..6eb26088 100644
--- a/slides/kernel-driver-development-sleeping/kernel-driver-development-sleeping.tex
+++ b/slides/kernel-driver-development-sleeping/kernel-driver-development-sleeping.tex
@@ -237,3 +237,30 @@ From \kfile{char/tpm/tpm_ibmvtpm.c}
+  \frametitle{Waiting when hardware is involved}
+  \begin{itemize}
+  \item When hardware is involved in the waiting process
+    \begin{itemize}
+    \item but no there is no interrupt available
+    \item or because a context switch would be too expensive
+    \end{itemize}
+  \item Specific polling I/O accessors may be used:
+    \begin{itemize}
+    \item Exhaustive list in \kfile{include/iopoll.h}
+      \begin{minted}{c}
+int read[bwlq]_poll_timeout[_atomic](addr, val, cond,
+                                     delay_us, timeout_us)
+      \end{minted}
+        \begin{itemize}
+        \item \code{addr}: I/O memory location
+        \item \code{val}: Content of the register pointed with
+        \item \code{cond}: Boolean condition based on \code{val}
+        \item \code{delay_us}: Polling delay between reads
+        \item \code{timeout_s}: Timeout delay after which the operation
+          fails and returns -ETIMEDOUT
+        \end{itemize}
+    \end{itemize}
+  \end{itemize}

More information about the training-materials-updates mailing list