[bootlin/training-materials updates] master: Kernel labs: update name for the "serial_dev" structure (acbcbaed)

Michael Opdenacker michael.opdenacker at bootlin.com
Tue Jun 8 21:43:16 CEST 2021

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


commit acbcbaedc0cd709ebd0e64b0b307fcdea2799adf
Author: Michael Opdenacker <michael.opdenacker at bootlin.com>
Date:   Tue Jun 8 21:43:16 2021 +0200

    Kernel labs: update name for the "serial_dev" structure
    From "dev" to "serial" (more explicit)
    Signed-off-by: Michael Opdenacker <michael.opdenacker at bootlin.com>


 labs/kernel-serial-interrupt/kernel-serial-interrupt.tex |  2 +-
 labs/kernel-serial-iomem/kernel-serial-iomem.tex         | 16 ++++++++--------
 labs/kernel-serial-output/kernel-serial-output.tex       |  2 +-
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/labs/kernel-serial-interrupt/kernel-serial-interrupt.tex b/labs/kernel-serial-interrupt/kernel-serial-interrupt.tex
index 3cf58ba8..8d27357a 100644
--- a/labs/kernel-serial-interrupt/kernel-serial-interrupt.tex
+++ b/labs/kernel-serial-interrupt/kernel-serial-interrupt.tex
@@ -44,7 +44,7 @@ struct serial_dev {
 Now, to retrieve the IRQ number to be used with \kfunc{devm_request_irq}:
-dev->irq = platform_get_irq(pdev, 0);
+serial->irq = platform_get_irq(pdev, 0);
 Then, pass the interrupt number to \kfunc{devm_request_irq} along
diff --git a/labs/kernel-serial-iomem/kernel-serial-iomem.tex b/labs/kernel-serial-iomem/kernel-serial-iomem.tex
index 291810bd..b7726fcb 100644
--- a/labs/kernel-serial-iomem/kernel-serial-iomem.tex
+++ b/labs/kernel-serial-iomem/kernel-serial-iomem.tex
@@ -114,10 +114,10 @@ automatically taken care of when we use the \code{devm_} functions.
 So, add the below line to your code:
-struct serial_dev *dev;
+struct serial_dev *serial;
-dev = devm_kzalloc(&pdev->dev, sizeof(struct serial_dev), GFP_KERNEL);
-if (!dev)
+serial = devm_kzalloc(&pdev->dev, sizeof(struct serial_dev), GFP_KERNEL);
+if (!serial)
         return -ENOMEM;
@@ -127,9 +127,9 @@ You can now get a virtual address for your device's base physical
 address, by calling:
-dev->regs = devm_platform_ioremap_resource(pdev, 0);
-if (IS_ERR(dev->regs))
-        return PTR_ERR(dev->regs);
+serial->regs = devm_platform_ioremap_resource(pdev, 0);
+if (IS_ERR(serial->regs))
+        return PTR_ERR(serial->regs);
 What's nice is that you won't ever have to release this resource,
@@ -147,8 +147,8 @@ devices. Of course, this will be done in the \code{probe()} routine.
 \subsection{Accessing device registers}
 As we will have multiple registers to read, create a \code{reg_read()}
-routine, returning an \code{unsigned int} value, and taking a \code{dev}
-pointer to a \code{serial_dev} structure and an \code{int} register
+routine, returning an \code{unsigned int} value, and taking a
+\code{serial} pointer to a \code{serial_dev} structure and an \code{int} register
 Your prototype should look like:
diff --git a/labs/kernel-serial-output/kernel-serial-output.tex b/labs/kernel-serial-output/kernel-serial-output.tex
index 354a10bb..0f1d152d 100644
--- a/labs/kernel-serial-output/kernel-serial-output.tex
+++ b/labs/kernel-serial-output/kernel-serial-output.tex
@@ -120,7 +120,7 @@ pointer to the \code{serial_dev} structure. However, as the
 the address of the parent structure:
-struct serial_dev *dev =
+struct serial_dev *serial =
 	container_of(file->private_data, struct serial_dev, miscdev);

More information about the training-materials-updates mailing list