From a9477375a86970e61b9d13317fdb7d0c862e7de9 Mon Sep 17 00:00:00 2001
From: John Ogness <john.ogness@linutronix.de>
Date: Fri, 2 Feb 2018 04:14:14 -0600
Subject: module-basics: cleanup vain examples

Cleanup the examples so that they show (and hide) the same things
for both examples.

Signed-off-by: John Ogness <john.ogness@linutronix.de>
---
 .../module-basics/pres_module-basics_en.tex        | 32 +++++++++-------------
 1 file changed, 13 insertions(+), 19 deletions(-)

(limited to 'kernel-devel/module-basics/pres_module-basics_en.tex')

diff --git a/kernel-devel/module-basics/pres_module-basics_en.tex b/kernel-devel/module-basics/pres_module-basics_en.tex
index 71c20eb..b4c8cea 100644
--- a/kernel-devel/module-basics/pres_module-basics_en.tex
+++ b/kernel-devel/module-basics/pres_module-basics_en.tex
@@ -225,23 +225,22 @@ module_exit(vain_pci_exit);
 \begin{tiny}
 \begin{lstlisting}[frame=trBL]
 |static int vain_pci_probe(struct pci_dev *pdev,
-                                    const struct pci_device_id *ent)
+                           const struct pci_device_id *ent)
 {
+        struct vain_pci_info *info;
         int ret;
 
+        info = kzalloc(sizeof(struct vain_pci_info), GFP_KERNEL);
+
+        info->pdev = pdev;
+
         ret = pci_enable_device(pdev);
-        if (ret)
-        	goto err_free;
 
         ret = pci_request_regions(pdev, "vain_pci");
-        if (ret)
-                goto err_disable_device;
 
         info->base = pci_ioremap_bar(pdev, 0);
-        if (!info->base) {
-                ret = -ENODEV;
-                goto err_rel_regs;
-        }
+
+        pci_set_drvdata(pdev, info);
 
         return 0;|
 \end{lstlisting}
@@ -328,9 +327,7 @@ module_exit(vain_pci_exit);
 \begin{lstlisting}[frame=trBL]
 #include <linux/init.h>
 #include <linux/module.h>
-|#include <linux/platform_device.h>
-
-#include <asm/io.h>|
+|#include <linux/platform_device.h>|
 \end{lstlisting}
 \end{tiny}
 \pause
@@ -411,20 +408,17 @@ static void vain_plat_exit(void)
 \begin{lstlisting}[frame=trBL]
 |static int vain_plat_probe(struct platform_device *pdev)
 {
-        struct resource *res;
+        struct vain_plat_info *info;
+        struct resource *res, *mem;
         int err;
 
+        info = kzalloc(sizeof(struct vain_plat_info), GFP_KERNEL);
+
         res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-        if (unlikely(!res))
-                goto err_free;
 
         mem = request_mem_region(res->start, resource_size(res), pdev->name);
-        if (!mem)
-                goto err_free;
 
         info->base = ioremap(res->start, resource_size(res));
-        if (!info->base)
-                goto err_ioremap;
 
         platform_set_drvdata(pdev, info);
 
-- 
cgit v1.2.3

