[FE training-materials-updates] Kernel labs: serial lab updates

Michael Opdenacker michael.opdenacker at free-electrons.com
Thu Jul 16 12:31:25 CEST 2015

Repository : git://git.free-electrons.com/training-materials.git

On branch  : master
Link       : http://git.free-electrons.com/training-materials/commit/?id=3a9eccf1c9240c8bae9f5bb2597a0f2511b6b748


commit 3a9eccf1c9240c8bae9f5bb2597a0f2511b6b748
Author: Michael Opdenacker <michael.opdenacker at free-electrons.com>
Date:   Thu Jul 16 12:29:21 2015 +0200

    Kernel labs: serial lab updates
    - Simplify device tree work
    - No longer need to apply a patch for private_data in miscdevice,
      thanks to commit 0b509d8d336eef6d622d66b3ae2a1fc3a072bf92
    Signed-off-by: Michael Opdenacker <michael.opdenacker at free-electrons.com>


 ...isc-assign-file-private_data-in-all-cases.patch | 43 ----------------------
 labs/kernel-serial-iomem/kernel-serial-iomem.tex   |  9 +++--
 labs/kernel-serial-output/kernel-serial-output.tex | 25 -------------
 3 files changed, 5 insertions(+), 72 deletions(-)

diff --git a/lab-data/linux-kernel/src/patches/0001-char-misc-assign-file-private_data-in-all-cases.patch b/lab-data/linux-kernel/src/patches/0001-char-misc-assign-file-private_data-in-all-cases.patch
deleted file mode 100644
index 8b38f7e..0000000
--- a/lab-data/linux-kernel/src/patches/0001-char-misc-assign-file-private_data-in-all-cases.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-From f0cedb3593f34cf3be26d972666e6bffacc824be Mon Sep 17 00:00:00 2001
-From: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>
-Date: Fri, 21 Jun 2013 14:43:13 +0200
-Subject: [PATCH] char: misc: assign file->private_data in all cases
-In fa1f68db6ca ("drivers: misc: pass miscdevice pointer via file
-private data"), the misc driver infrastructure was changed to assigned
-file->private_data as a pointer to the 'struct miscdevice' that
-corresponds to the device being opened.
-However, this assignment was only done when the misc driver was
-declaring a driver-specific ->open() operation in its
-file_operations. This doesn't make sense, as the driver may not
-necessarily have a custom ->open() operation, and might still be
-interested in having file->private_data properly set for use in its
-->read() and write() operations.
-Therefore, we move the assignment of file->private_data outside of the
-condition that tests whether a driver-specific ->open() operation was
-Signed-off-by: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>
- drivers/char/misc.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-diff --git a/drivers/char/misc.c b/drivers/char/misc.c
-index ffa97d2..205ad4c 100644
---- a/drivers/char/misc.c
-+++ b/drivers/char/misc.c
-@@ -142,8 +142,8 @@ static int misc_open(struct inode * inode, struct file * file)
- 	err = 0;
- 	replace_fops(file, new_fops);
-+	file->private_data = c;
- 	if (file->f_op->open) {
--		file->private_data = c;
- 		err = file->f_op->open(inode,file);
- 	}
- fail:
diff --git a/labs/kernel-serial-iomem/kernel-serial-iomem.tex b/labs/kernel-serial-iomem/kernel-serial-iomem.tex
index 76305dc..2d5ce6d 100644
--- a/labs/kernel-serial-iomem/kernel-serial-iomem.tex
+++ b/labs/kernel-serial-iomem/kernel-serial-iomem.tex
@@ -47,9 +47,10 @@ as for the cable that you're using for the console:
 You can (or even should) show your connections to the instructor
 to make sure that you haven't swapped the \code{RX} and \code{TX} pins.
-Now, open the \code{arch/arm/boot/dts/am335x-bone-common.dtsi}
-file and create declarations for UART2 and UART4 in the pin muxing
+Now, create again a new
+file and create a pin muxing section with declarations for UART2 and
 {\small \sourcecode{labs/kernel-serial-iomem/uarts-pinctrl.dts}}
@@ -72,7 +73,7 @@ duplicate the valid ones:
       (none were defined so far).
-Rebuild and update your DTB.
+Compile and update your DTB.
 \section{Operate a platform device driver}
diff --git a/labs/kernel-serial-output/kernel-serial-output.tex b/labs/kernel-serial-output/kernel-serial-output.tex
index 2dcfc98..24a68ad 100644
--- a/labs/kernel-serial-output/kernel-serial-output.tex
+++ b/labs/kernel-serial-output/kernel-serial-output.tex
@@ -86,31 +86,6 @@ At this stage, make sure you can load and unload the driver multiple
 times. This should reveal registration and deregistration issues if
 there are any.
-\section{Apply a kernel patch}
-The next step is to implement the \code{write()} routine. However, we
-will need to access our \code{feserial_dev} structure from inside that
-At the moment, it is necessary to implement an \code{open} file
-operation to attach a private structure to an open device file. This is
-a bit ugly as we would have nothing special to do in such a function.
-Let's apply a patch that addresses this issue\footnote{This patch has been submitted but hasn't been accepted yet in
-the mainline kernel, because it breaks the \code{FUSE} code which makes
-weird assumptions about the {\em misc} framework.}:
-\item Go back to the Linux source directory. Make sure you are still in
-      the \code{uart} branch (type \code{git branch}).
-\item Run \code{git status} to check whether you have uncommitted
-      changes. Commit these if they correspond to useful changes (these
-      should be your Device Tree edits).
-\item Apply the new patch using the following command:
-      \code{git am ~/linux-kernel-labs/src/patches/0001-char-misc*.patch}
-\item Rebuild and update your kernel image and reboot.
 \section{Implement the write() routine}
 Now, add code to your write function, to copy user data to the serial

More information about the training-materials-updates mailing list