diff options
Diffstat (limited to 'schulung_tools/drivers/hellodriver/patches-leds/0002-hello-add-pci-memory-mapping.patch')
| -rw-r--r-- | schulung_tools/drivers/hellodriver/patches-leds/0002-hello-add-pci-memory-mapping.patch | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/schulung_tools/drivers/hellodriver/patches-leds/0002-hello-add-pci-memory-mapping.patch b/schulung_tools/drivers/hellodriver/patches-leds/0002-hello-add-pci-memory-mapping.patch new file mode 100644 index 0000000..0a11a57 --- /dev/null +++ b/schulung_tools/drivers/hellodriver/patches-leds/0002-hello-add-pci-memory-mapping.patch @@ -0,0 +1,64 @@ +From 3afec946845a02a8fce94d00abda9b4c8abcbce0 Mon Sep 17 00:00:00 2001 +From: John Ogness <john.ogness@linutronix.de> +Date: Fri, 15 Feb 2019 11:03:59 +0106 +Subject: [PATCH 3/7] hello: add pci memory mapping + +Signed-off-by: John Ogness <john.ogness@linutronix.de> +--- + hello.c | 12 +++++++++++- + 1 file changed, 11 insertions(+), 1 deletion(-) + +diff --git a/hello.c b/hello.c +index db50302..58a64e5 100644 +--- a/hello.c ++++ b/hello.c +@@ -12,6 +12,7 @@ struct hello_dev { + struct device *dev; + struct cdev cdev; + unsigned int minor; ++ void __iomem *mem; + }; + + #define HELLO_MAX_DEVICES 10 +@@ -120,6 +121,12 @@ static int hello_probe(struct pci_dev *pdev, const struct pci_device_id *ent) + + pci_set_master(pdev); + ++ hello->mem = pci_iomap(pdev, 2, 0); ++ if (!hello->mem) { ++ ret = -ENOMEM; ++ goto err_regions; ++ } ++ + devt = MKDEV(MAJOR(hello_devt), hello->minor); + + cdev_init(&hello->cdev, &hello_fops); +@@ -127,7 +134,7 @@ static int hello_probe(struct pci_dev *pdev, const struct pci_device_id *ent) + ret = cdev_add(&hello->cdev, devt, 1); + if (ret != 0) { + dev_err(&pdev->dev, "cdev_add failed\n"); +- goto err_regions; ++ goto err_iomap; + } + + dev = device_create(hello_class, &pdev->dev, devt, hello, +@@ -144,6 +151,8 @@ static int hello_probe(struct pci_dev *pdev, const struct pci_device_id *ent) + + err_cdev: + cdev_del(&hello->cdev); ++err_iomap: ++ pci_iounmap(pdev, hello->mem); + err_regions: + pci_release_regions(pdev); + err_enable: +@@ -159,6 +168,7 @@ static void hello_remove(struct pci_dev *pdev) + + device_destroy(hello_class, MKDEV(MAJOR(hello_devt), hello->minor)); + cdev_del(&hello->cdev); ++ pci_iounmap(pdev, hello->mem); + pci_release_regions(pdev); + pci_disable_device(pdev); + pci_set_drvdata(pdev, NULL); +-- +2.11.0 + |
