[bootlin/training-materials updates] master: kernel: i2c: introduce probe_new (4eaa63b5)

Alexandre Belloni alexandre.belloni at bootlin.com
Sat Nov 21 01:50:24 CET 2020


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

>---------------------------------------------------------------

commit 4eaa63b56abe56ab5caa0042c7378d832d20cf99
Author: Alexandre Belloni <alexandre.belloni at bootlin.com>
Date:   Sat Nov 21 01:50:24 2020 +0100

    kernel: i2c: introduce probe_new
    
    Signed-off-by: Alexandre Belloni <alexandre.belloni at bootlin.com>


>---------------------------------------------------------------

4eaa63b56abe56ab5caa0042c7378d832d20cf99
 slides/kernel-i2c/kernel-i2c.tex | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/slides/kernel-i2c/kernel-i2c.tex b/slides/kernel-i2c/kernel-i2c.tex
index 00384955..1e794999 100644
--- a/slides/kernel-i2c/kernel-i2c.tex
+++ b/slides/kernel-i2c/kernel-i2c.tex
@@ -51,10 +51,10 @@
     \begin{itemize}
     \item As usual, this structure points to the \code{->probe()} and
       \code{->remove()} functions.
-    \item It also contains an \code{id_table} field that must point to a
-      list of {\em device IDs} (which is a list of tuples containing a
-      string and some private driver data). It is used for non-DT based
+    \item It also contains an \code{id_table}, used for non-DT based
       probing of I2C devices.
+    \item A \code{->probe_new()} function can replace \code{->probe()}
+      when no \code{id_table} is provided.
     \end{itemize}
   \item The \kfunc{i2c_add_driver} and \kfunc{i2c_del_driver} functions
     are used to register/unregister the driver.
@@ -206,15 +206,19 @@ i2c0: i2c at 01c2ac00 {
   From \kfile{arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts}
 \end{frame}
 
-\begin{frame}{\code{probe()} and \code{remove()}}
+\begin{frame}{\code{probe_new()} and \code{remove()}}
 
   \begin{itemize}
-  \item The \code{->probe()} function is responsible for initializing
+  \item The \code{->probe_new()} function is responsible for initializing
     the device and registering it in the appropriate kernel
     framework. It receives as argument:
     \begin{itemize}
     \item A \kstruct{i2c_client} pointer, which represents the I2C
       device itself. This structure inherits from \kstruct{device}.
+    \end{itemize}
+  \item Alternatively, the \code{->probe()} function receives as arguments:
+    \begin{itemize}
+    \item A similar \kstruct{i2c_client} pointer.
     \item A \kstruct{i2c_device_id} pointer, which points to the
       I2C device ID entry that matched the device that is being
       probed.
@@ -224,7 +228,7 @@ i2c0: i2c at 01c2ac00 {
     down. It receives as argument:
     \begin{itemize}
     \item The same \kstruct{i2c_client} pointer that was passed as
-      argument to \code{->probe()}
+      argument to \code{->probe_new()} or \code{->probe()}
     \end{itemize}
   \end{itemize}
 \end{frame}




More information about the training-materials-updates mailing list