From 26dac3c49d56642b06c07c80a2184abbf510920f Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Wed, 26 Jun 2013 11:52:12 +0200 Subject: uio: Remove uio_pdrv and use uio_pdrv_genirq instead The patch "UIO: fix uio_pdrv_genirq with device tree but no interrupt" (sha1: e3a3c3a205554e564751cd9c0276b2af813d7a92) add support to use this driver with no interrupts. uio_pdrv_genirq also supports device-tree binding which is not available in uio_pdrv. That's why this uio_pdrv driver can be just removed. Signed-off-by: Michal Simek Reviewed-by: Vitalii Demianets Reviewed-by: Pavel Machek Signed-off-by: Greg Kroah-Hartman --- drivers/uio/Kconfig | 7 --- drivers/uio/Makefile | 1 - drivers/uio/uio_pdrv.c | 113 ------------------------------------------------- 3 files changed, 121 deletions(-) delete mode 100644 drivers/uio/uio_pdrv.c (limited to 'drivers/uio') diff --git a/drivers/uio/Kconfig b/drivers/uio/Kconfig index 5295be0342c..a81d16389a5 100644 --- a/drivers/uio/Kconfig +++ b/drivers/uio/Kconfig @@ -23,13 +23,6 @@ config UIO_CIF To compile this driver as a module, choose M here: the module will be called uio_cif. -config UIO_PDRV - tristate "Userspace I/O platform driver" - help - Generic platform driver for Userspace I/O devices. - - If you don't know what to do here, say N. - config UIO_PDRV_GENIRQ tristate "Userspace I/O platform driver with generic IRQ handling" help diff --git a/drivers/uio/Makefile b/drivers/uio/Makefile index b354c539507..ea015a29012 100644 --- a/drivers/uio/Makefile +++ b/drivers/uio/Makefile @@ -1,6 +1,5 @@ obj-$(CONFIG_UIO) += uio.o obj-$(CONFIG_UIO_CIF) += uio_cif.o -obj-$(CONFIG_UIO_PDRV) += uio_pdrv.o obj-$(CONFIG_UIO_PDRV_GENIRQ) += uio_pdrv_genirq.o obj-$(CONFIG_UIO_DMEM_GENIRQ) += uio_dmem_genirq.o obj-$(CONFIG_UIO_AEC) += uio_aec.o diff --git a/drivers/uio/uio_pdrv.c b/drivers/uio/uio_pdrv.c deleted file mode 100644 index 39be9e06170..00000000000 --- a/drivers/uio/uio_pdrv.c +++ /dev/null @@ -1,113 +0,0 @@ -/* - * drivers/uio/uio_pdrv.c - * - * Copyright (C) 2008 by Digi International Inc. - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published by - * the Free Software Foundation. - */ -#include -#include -#include -#include -#include - -#define DRIVER_NAME "uio_pdrv" - -struct uio_platdata { - struct uio_info *uioinfo; -}; - -static int uio_pdrv_probe(struct platform_device *pdev) -{ - struct uio_info *uioinfo = pdev->dev.platform_data; - struct uio_platdata *pdata; - struct uio_mem *uiomem; - int ret = -ENODEV; - int i; - - if (!uioinfo || !uioinfo->name || !uioinfo->version) { - dev_dbg(&pdev->dev, "%s: err_uioinfo\n", __func__); - goto err_uioinfo; - } - - pdata = kzalloc(sizeof(*pdata), GFP_KERNEL); - if (!pdata) { - ret = -ENOMEM; - dev_dbg(&pdev->dev, "%s: err_alloc_pdata\n", __func__); - goto err_alloc_pdata; - } - - pdata->uioinfo = uioinfo; - - uiomem = &uioinfo->mem[0]; - - for (i = 0; i < pdev->num_resources; ++i) { - struct resource *r = &pdev->resource[i]; - - if (r->flags != IORESOURCE_MEM) - continue; - - if (uiomem >= &uioinfo->mem[MAX_UIO_MAPS]) { - dev_warn(&pdev->dev, "device has more than " - __stringify(MAX_UIO_MAPS) - " I/O memory resources.\n"); - break; - } - - uiomem->memtype = UIO_MEM_PHYS; - uiomem->addr = r->start; - uiomem->size = resource_size(r); - uiomem->name = r->name; - ++uiomem; - } - - while (uiomem < &uioinfo->mem[MAX_UIO_MAPS]) { - uiomem->size = 0; - ++uiomem; - } - - pdata->uioinfo->priv = pdata; - - ret = uio_register_device(&pdev->dev, pdata->uioinfo); - - if (ret) { - kfree(pdata); -err_alloc_pdata: -err_uioinfo: - return ret; - } - - platform_set_drvdata(pdev, pdata); - - return 0; -} - -static int uio_pdrv_remove(struct platform_device *pdev) -{ - struct uio_platdata *pdata = platform_get_drvdata(pdev); - - uio_unregister_device(pdata->uioinfo); - - kfree(pdata); - - return 0; -} - -static struct platform_driver uio_pdrv = { - .probe = uio_pdrv_probe, - .remove = uio_pdrv_remove, - .driver = { - .name = DRIVER_NAME, - .owner = THIS_MODULE, - }, -}; - -module_platform_driver(uio_pdrv); - -MODULE_AUTHOR("Uwe Kleine-Koenig"); -MODULE_DESCRIPTION("Userspace I/O platform driver"); -MODULE_LICENSE("GPL v2"); -MODULE_ALIAS("platform:" DRIVER_NAME); -- cgit v1.2.3-18-g5258 From 7294151d0592e0ff48c61fca9fd7c93d613134da Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Wed, 7 Aug 2013 13:02:53 +0200 Subject: uio: provide vm access to UIO_MEM_PHYS maps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This makes it possible to let gdb access mappings of the process that is being debugged. uio_mmap_logical was moved and uio_vm_ops renamed to group related code and differentiate to new stuff. Signed-off-by: Uwe Kleine-König Signed-off-by: Greg Kroah-Hartman --- drivers/uio/uio.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'drivers/uio') diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c index 3b96f18593b..c4279b2234a 100644 --- a/drivers/uio/uio.c +++ b/drivers/uio/uio.c @@ -630,12 +630,26 @@ static int uio_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf) return 0; } -static const struct vm_operations_struct uio_vm_ops = { +static const struct vm_operations_struct uio_logical_vm_ops = { .open = uio_vma_open, .close = uio_vma_close, .fault = uio_vma_fault, }; +static int uio_mmap_logical(struct vm_area_struct *vma) +{ + vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP; + vma->vm_ops = &uio_logical_vm_ops; + uio_vma_open(vma); + return 0; +} + +static const struct vm_operations_struct uio_physical_vm_ops = { +#ifdef CONFIG_HAVE_IOREMAP_PROT + .access = generic_access_phys, +#endif +}; + static int uio_mmap_physical(struct vm_area_struct *vma) { struct uio_device *idev = vma->vm_private_data; @@ -643,6 +657,8 @@ static int uio_mmap_physical(struct vm_area_struct *vma) if (mi < 0) return -EINVAL; + vma->vm_ops = &uio_physical_vm_ops; + vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); return remap_pfn_range(vma, @@ -652,14 +668,6 @@ static int uio_mmap_physical(struct vm_area_struct *vma) vma->vm_page_prot); } -static int uio_mmap_logical(struct vm_area_struct *vma) -{ - vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP; - vma->vm_ops = &uio_vm_ops; - uio_vma_open(vma); - return 0; -} - static int uio_mmap(struct file *filep, struct vm_area_struct *vma) { struct uio_listener *listener = filep->private_data; -- cgit v1.2.3-18-g5258 From b65c4014efbcfa37df91c00dfaea4b3f17ac4eb7 Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Wed, 7 Aug 2013 13:02:54 +0200 Subject: uio: drop unused vma_count member in uio_device struct MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit vma_count is used write-only and so fails to be useful. So remove it. Signed-off-by: Uwe Kleine-König Signed-off-by: Greg Kroah-Hartman --- drivers/uio/uio.c | 16 ---------------- 1 file changed, 16 deletions(-) (limited to 'drivers/uio') diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c index c4279b2234a..8abe78c0b16 100644 --- a/drivers/uio/uio.c +++ b/drivers/uio/uio.c @@ -35,7 +35,6 @@ struct uio_device { atomic_t event; struct fasync_struct *async_queue; wait_queue_head_t wait; - int vma_count; struct uio_info *info; struct kobject *map_dir; struct kobject *portio_dir; @@ -593,18 +592,6 @@ static int uio_find_mem_index(struct vm_area_struct *vma) return -1; } -static void uio_vma_open(struct vm_area_struct *vma) -{ - struct uio_device *idev = vma->vm_private_data; - idev->vma_count++; -} - -static void uio_vma_close(struct vm_area_struct *vma) -{ - struct uio_device *idev = vma->vm_private_data; - idev->vma_count--; -} - static int uio_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf) { struct uio_device *idev = vma->vm_private_data; @@ -631,8 +618,6 @@ static int uio_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf) } static const struct vm_operations_struct uio_logical_vm_ops = { - .open = uio_vma_open, - .close = uio_vma_close, .fault = uio_vma_fault, }; @@ -640,7 +625,6 @@ static int uio_mmap_logical(struct vm_area_struct *vma) { vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP; vma->vm_ops = &uio_logical_vm_ops; - uio_vma_open(vma); return 0; } -- cgit v1.2.3-18-g5258 From 440ab3b3039834508250975d07d52d41883cf520 Mon Sep 17 00:00:00 2001 From: Jingoo Han Date: Thu, 22 Aug 2013 11:09:12 +0900 Subject: uio: uio_pruss: remove unnecessary platform_set_drvdata() The driver core clears the driver data to NULL after device_release or on probe failure. Thus, it is not needed to manually clear the device driver data to NULL. Signed-off-by: Jingoo Han Signed-off-by: Greg Kroah-Hartman --- drivers/uio/uio_pruss.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/uio') diff --git a/drivers/uio/uio_pruss.c b/drivers/uio/uio_pruss.c index 21f7a72301e..df7534613e5 100644 --- a/drivers/uio/uio_pruss.c +++ b/drivers/uio/uio_pruss.c @@ -224,7 +224,6 @@ static int pruss_remove(struct platform_device *dev) struct uio_pruss_dev *gdev = platform_get_drvdata(dev); pruss_cleanup(dev, gdev); - platform_set_drvdata(dev, NULL); return 0; } -- cgit v1.2.3-18-g5258 From 31f5221327f2add1ea152ed9d12b7094ab59818f Mon Sep 17 00:00:00 2001 From: Jingoo Han Date: Fri, 30 Aug 2013 13:11:56 +0900 Subject: drivers: uio_dmem_genirq: use dev_get_platdata() Use the wrapper function for retrieving the platform data instead of accessing dev->platform_data directly. This is a cosmetic change to make the code simpler and enhance the readability. Signed-off-by: Jingoo Han Signed-off-by: Greg Kroah-Hartman --- drivers/uio/uio_dmem_genirq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/uio') diff --git a/drivers/uio/uio_dmem_genirq.c b/drivers/uio/uio_dmem_genirq.c index 125d0e5a688..1270f3b2613 100644 --- a/drivers/uio/uio_dmem_genirq.c +++ b/drivers/uio/uio_dmem_genirq.c @@ -146,7 +146,7 @@ static int uio_dmem_genirq_irqcontrol(struct uio_info *dev_info, s32 irq_on) static int uio_dmem_genirq_probe(struct platform_device *pdev) { - struct uio_dmem_genirq_pdata *pdata = pdev->dev.platform_data; + struct uio_dmem_genirq_pdata *pdata = dev_get_platdata(&pdev->dev); struct uio_info *uioinfo = &pdata->uioinfo; struct uio_dmem_genirq_platdata *priv; struct uio_mem *uiomem; -- cgit v1.2.3-18-g5258 From 958544475462560a26ba2a1ae01998019d303c58 Mon Sep 17 00:00:00 2001 From: Jingoo Han Date: Fri, 30 Aug 2013 13:13:50 +0900 Subject: drivers: uio_pruss: use dev_get_platdata() Use the wrapper function for retrieving the platform data instead of accessing dev->platform_data directly. This is a cosmetic change to make the code simpler and enhance the readability. Signed-off-by: Jingoo Han Signed-off-by: Greg Kroah-Hartman --- drivers/uio/uio_pruss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/uio') diff --git a/drivers/uio/uio_pruss.c b/drivers/uio/uio_pruss.c index df7534613e5..f519da9034b 100644 --- a/drivers/uio/uio_pruss.c +++ b/drivers/uio/uio_pruss.c @@ -121,7 +121,7 @@ static int pruss_probe(struct platform_device *dev) struct uio_pruss_dev *gdev; struct resource *regs_prussio; int ret = -ENODEV, cnt = 0, len; - struct uio_pruss_pdata *pdata = dev->dev.platform_data; + struct uio_pruss_pdata *pdata = dev_get_platdata(&dev->dev); gdev = kzalloc(sizeof(struct uio_pruss_dev), GFP_KERNEL); if (!gdev) -- cgit v1.2.3-18-g5258 From 08cb2e2148f7633e05ad211cff9234acca60a194 Mon Sep 17 00:00:00 2001 From: Jingoo Han Date: Fri, 30 Aug 2013 13:13:11 +0900 Subject: drivers: uio_pdrv_genirq: use dev_get_platdata() Use the wrapper function for retrieving the platform data instead of accessing dev->platform_data directly. This is a cosmetic change to make the code simpler and enhance the readability. Signed-off-by: Jingoo Han Signed-off-by: Greg Kroah-Hartman --- drivers/uio/uio_pdrv_genirq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/uio') diff --git a/drivers/uio/uio_pdrv_genirq.c b/drivers/uio/uio_pdrv_genirq.c index 4eb8eaf71be..90ff17a0202 100644 --- a/drivers/uio/uio_pdrv_genirq.c +++ b/drivers/uio/uio_pdrv_genirq.c @@ -104,7 +104,7 @@ static int uio_pdrv_genirq_irqcontrol(struct uio_info *dev_info, s32 irq_on) static int uio_pdrv_genirq_probe(struct platform_device *pdev) { - struct uio_info *uioinfo = pdev->dev.platform_data; + struct uio_info *uioinfo = dev_get_platdata(&pdev->dev); struct uio_pdrv_genirq_platdata *priv; struct uio_mem *uiomem; int ret = -EINVAL; -- cgit v1.2.3-18-g5258 From 06849faab58fc7ff9f4eae2532380c2a746a6f47 Mon Sep 17 00:00:00 2001 From: Rostislav Lisovy Date: Fri, 30 Aug 2013 14:58:02 +0200 Subject: drivers: uio: Add driver for Humusoft MF624 DAQ PCI card Signed-off-by: Rostislav Lisovy Signed-off-by: Greg Kroah-Hartman --- drivers/uio/Kconfig | 13 +++ drivers/uio/Makefile | 1 + drivers/uio/uio_mf624.c | 247 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 261 insertions(+) create mode 100644 drivers/uio/uio_mf624.c (limited to 'drivers/uio') diff --git a/drivers/uio/Kconfig b/drivers/uio/Kconfig index a81d16389a5..86d98c86e14 100644 --- a/drivers/uio/Kconfig +++ b/drivers/uio/Kconfig @@ -121,4 +121,17 @@ config UIO_PRUSS To compile this driver as a module, choose M here: the module will be called uio_pruss. +config UIO_MF624 + tristate "Humusoft MF624 DAQ PCI card driver" + depends on PCI + help + Userspace I/O interface for the Humusoft MF624 PCI card. + A sample userspace application using this driver is available + (among other MF624 related information and software components) + for download in a git repository: + + git clone git://rtime.felk.cvut.cz/mf6xx.git + + If you compile this as a module, it will be called uio_mf624. + endif diff --git a/drivers/uio/Makefile b/drivers/uio/Makefile index ea015a29012..d3218bde3ae 100644 --- a/drivers/uio/Makefile +++ b/drivers/uio/Makefile @@ -7,3 +7,4 @@ obj-$(CONFIG_UIO_SERCOS3) += uio_sercos3.o obj-$(CONFIG_UIO_PCI_GENERIC) += uio_pci_generic.o obj-$(CONFIG_UIO_NETX) += uio_netx.o obj-$(CONFIG_UIO_PRUSS) += uio_pruss.o +obj-$(CONFIG_UIO_MF624) += uio_mf624.o diff --git a/drivers/uio/uio_mf624.c b/drivers/uio/uio_mf624.c new file mode 100644 index 00000000000..a1768b2f449 --- /dev/null +++ b/drivers/uio/uio_mf624.c @@ -0,0 +1,247 @@ +/* + * UIO driver fo Humusoft MF624 DAQ card. + * Copyright (C) 2011 Rostislav Lisovy , + * Czech Technical University in Prague + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#define PCI_VENDOR_ID_HUMUSOFT 0x186c +#define PCI_DEVICE_ID_MF624 0x0624 +#define PCI_SUBVENDOR_ID_HUMUSOFT 0x186c +#define PCI_SUBDEVICE_DEVICE 0x0624 + +/* BAR0 Interrupt control/status register */ +#define INTCSR 0x4C +#define INTCSR_ADINT_ENABLE (1 << 0) +#define INTCSR_CTR4INT_ENABLE (1 << 3) +#define INTCSR_PCIINT_ENABLE (1 << 6) +#define INTCSR_ADINT_STATUS (1 << 2) +#define INTCSR_CTR4INT_STATUS (1 << 5) + +enum mf624_interrupt_source {ADC, CTR4, ALL}; + +void mf624_disable_interrupt(enum mf624_interrupt_source source, + struct uio_info *info) +{ + void __iomem *INTCSR_reg = info->mem[0].internal_addr + INTCSR; + + switch (source) { + case ADC: + iowrite32(ioread32(INTCSR_reg) + & ~(INTCSR_ADINT_ENABLE | INTCSR_PCIINT_ENABLE), + INTCSR_reg); + break; + + case CTR4: + iowrite32(ioread32(INTCSR_reg) + & ~(INTCSR_CTR4INT_ENABLE | INTCSR_PCIINT_ENABLE), + INTCSR_reg); + break; + + case ALL: + default: + iowrite32(ioread32(INTCSR_reg) + & ~(INTCSR_ADINT_ENABLE | INTCSR_CTR4INT_ENABLE + | INTCSR_PCIINT_ENABLE), + INTCSR_reg); + break; + } +} + +void mf624_enable_interrupt(enum mf624_interrupt_source source, + struct uio_info *info) +{ + void __iomem *INTCSR_reg = info->mem[0].internal_addr + INTCSR; + + switch (source) { + case ADC: + iowrite32(ioread32(INTCSR_reg) + | INTCSR_ADINT_ENABLE | INTCSR_PCIINT_ENABLE, + INTCSR_reg); + break; + + case CTR4: + iowrite32(ioread32(INTCSR_reg) + | INTCSR_CTR4INT_ENABLE | INTCSR_PCIINT_ENABLE, + INTCSR_reg); + break; + + case ALL: + default: + iowrite32(ioread32(INTCSR_reg) + | INTCSR_ADINT_ENABLE | INTCSR_CTR4INT_ENABLE + | INTCSR_PCIINT_ENABLE, + INTCSR_reg); + break; + } +} + +static irqreturn_t mf624_irq_handler(int irq, struct uio_info *info) +{ + void __iomem *INTCSR_reg = info->mem[0].internal_addr + INTCSR; + + if ((ioread32(INTCSR_reg) & INTCSR_ADINT_ENABLE) + && (ioread32(INTCSR_reg) & INTCSR_ADINT_STATUS)) { + mf624_disable_interrupt(ADC, info); + return IRQ_HANDLED; + } + + if ((ioread32(INTCSR_reg) & INTCSR_CTR4INT_ENABLE) + && (ioread32(INTCSR_reg) & INTCSR_CTR4INT_STATUS)) { + mf624_disable_interrupt(CTR4, info); + return IRQ_HANDLED; + } + + return IRQ_NONE; +} + +static int mf624_irqcontrol(struct uio_info *info, s32 irq_on) +{ + if (irq_on == 0) + mf624_disable_interrupt(ALL, info); + else if (irq_on == 1) + mf624_enable_interrupt(ALL, info); + + return 0; +} + +static int mf624_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) +{ + struct uio_info *info; + + info = kzalloc(sizeof(struct uio_info), GFP_KERNEL); + if (!info) + return -ENOMEM; + + if (pci_enable_device(dev)) + goto out_free; + + if (pci_request_regions(dev, "mf624")) + goto out_disable; + + info->name = "mf624"; + info->version = "0.0.1"; + + /* Note: Datasheet says device uses BAR0, BAR1, BAR2 -- do not trust it */ + + /* BAR0 */ + info->mem[0].name = "PCI chipset, interrupts, status " + "bits, special functions"; + info->mem[0].addr = pci_resource_start(dev, 0); + if (!info->mem[0].addr) + goto out_release; + info->mem[0].size = pci_resource_len(dev, 0); + info->mem[0].memtype = UIO_MEM_PHYS; + info->mem[0].internal_addr = pci_ioremap_bar(dev, 0); + if (!info->mem[0].internal_addr) + goto out_release; + + /* BAR2 */ + info->mem[1].name = "ADC, DAC, DIO"; + info->mem[1].addr = pci_resource_start(dev, 2); + if (!info->mem[1].addr) + goto out_unmap0; + info->mem[1].size = pci_resource_len(dev, 2); + info->mem[1].memtype = UIO_MEM_PHYS; + info->mem[1].internal_addr = pci_ioremap_bar(dev, 2); + if (!info->mem[1].internal_addr) + goto out_unmap0; + + /* BAR4 */ + info->mem[2].name = "Counter/timer chip"; + info->mem[2].addr = pci_resource_start(dev, 4); + if (!info->mem[2].addr) + goto out_unmap1; + info->mem[2].size = pci_resource_len(dev, 4); + info->mem[2].memtype = UIO_MEM_PHYS; + info->mem[2].internal_addr = pci_ioremap_bar(dev, 4); + if (!info->mem[2].internal_addr) + goto out_unmap1; + + info->irq = dev->irq; + info->irq_flags = IRQF_SHARED; + info->handler = mf624_irq_handler; + + info->irqcontrol = mf624_irqcontrol; + + if (uio_register_device(&dev->dev, info)) + goto out_unmap2; + + pci_set_drvdata(dev, info); + + return 0; + +out_unmap2: + iounmap(info->mem[2].internal_addr); +out_unmap1: + iounmap(info->mem[1].internal_addr); +out_unmap0: + iounmap(info->mem[0].internal_addr); + +out_release: + pci_release_regions(dev); + +out_disable: + pci_disable_device(dev); + +out_free: + kfree(info); + return -ENODEV; +} + +static void mf624_pci_remove(struct pci_dev *dev) +{ + struct uio_info *info = pci_get_drvdata(dev); + + mf624_disable_interrupt(ALL, info); + + uio_unregister_device(info); + pci_release_regions(dev); + pci_disable_device(dev); + pci_set_drvdata(dev, NULL); + + iounmap(info->mem[0].internal_addr); + iounmap(info->mem[1].internal_addr); + iounmap(info->mem[2].internal_addr); + + kfree(info); +} + +static DEFINE_PCI_DEVICE_TABLE(mf624_pci_id) = { + { PCI_DEVICE(PCI_VENDOR_ID_HUMUSOFT, PCI_DEVICE_ID_MF624) }, + { 0, } +}; + +static struct pci_driver mf624_pci_driver = { + .name = "mf624", + .id_table = mf624_pci_id, + .probe = mf624_pci_probe, + .remove = mf624_pci_remove, +}; +MODULE_DEVICE_TABLE(pci, mf624_pci_id); + +module_pci_driver(mf624_pci_driver); +MODULE_LICENSE("GPL v2"); +MODULE_AUTHOR("Rostislav Lisovy "); -- cgit v1.2.3-18-g5258 From 3cc1f95283a125cf54ccf1e25065321d4385133b Mon Sep 17 00:00:00 2001 From: Chen Gang Date: Fri, 30 Aug 2013 13:01:45 +0800 Subject: drivers: uio: Kconfig: add MMU dependancy for UIO The User space I/O drivers are useful, only when user space meaningful (MMU must be enabled). So need let it depend on MMU, or can not pass compiling, the related error (allmodconfig for H8300): CC [M] drivers/uio/uio.o drivers/uio/uio.c: In function 'uio_mmap_physical': drivers/uio/uio.c:650:2: error: implicit declaration of function 'pgprot_noncached' [-Werror=implicit-function-declaration] drivers/uio/uio.c:650:20: error: incompatible types when assigning to type 'pgprot_t' from type 'int' Signed-off-by: Chen Gang Signed-off-by: Greg Kroah-Hartman --- drivers/uio/Kconfig | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/uio') diff --git a/drivers/uio/Kconfig b/drivers/uio/Kconfig index 86d98c86e14..5a90914d856 100644 --- a/drivers/uio/Kconfig +++ b/drivers/uio/Kconfig @@ -1,5 +1,6 @@ menuconfig UIO tristate "Userspace I/O drivers" + depends on MMU help Enable this to allow the userspace driver core code to be built. This code allows userspace programs easy access to -- cgit v1.2.3-18-g5258