diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-11-06 19:41:06 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-11-06 19:41:06 -0500 |
commit | 1071ec7bc2dabd0a9d12a1ae5570f4fd3ba944ca (patch) | |
tree | 3f889877ae180066a8e682d915680f240fbfd6ec /drivers/uio | |
parent | c287322c3aadf45ee15339bffdbc2e9117b9cc7a (diff) | |
parent | 425792266a40189e0b3fec02cb59a69935d8c58c (diff) |
Merge tag 'char-misc-3.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
Pull char/misc patches from Greg KH:
"Here's the big char/misc driver patchset for 3.13-rc1.
Lots of stuff in here, including some new drivers for Intel's "MIC"
co-processor devices, and a new eeprom driver. Other things include
the driver attribute cleanups, extcon driver updates, hyperv updates,
and a raft of other miscellaneous driver fixes.
All of these have been in linux-next for a while"
* tag 'char-misc-3.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (121 commits)
misc: mic: Fixes for randconfig build errors and warnings.
tifm: fix error return code in tifm_7xx1_probe()
w1-gpio: Use devm_* functions
w1-gpio: Detect of_gpio_error for first gpio
uio: Pass pointers to virt_to_page(), not integers
uio: fix memory leak
misc/at24: avoid infinite loop on write()
misc/93xx46: avoid infinite loop on write()
misc: atmel_pwm: add deferred-probing support
mei: wd: host_init propagate error codes from called functions
mei: replace stray pr_debug with dev_dbg
mei: bus: propagate error code returned by mei_me_cl_by_id
mei: mei_cl_link remove duplicated check for open_handle_count
mei: print correct device state during unexpected reset
mei: nfc: fix memory leak in error path
lkdtm: add tests for additional page permissions
lkdtm: adjust recursion size to avoid warnings
lkdtm: isolate stack corruption test
mei: move host_clients_map cleanup to device init
mei: me: downgrade two errors to debug level
...
Diffstat (limited to 'drivers/uio')
-rw-r--r-- | drivers/uio/uio.c | 38 | ||||
-rw-r--r-- | drivers/uio/uio_aec.c | 1 | ||||
-rw-r--r-- | drivers/uio/uio_cif.c | 1 | ||||
-rw-r--r-- | drivers/uio/uio_mf624.c | 5 | ||||
-rw-r--r-- | drivers/uio/uio_netx.c | 1 | ||||
-rw-r--r-- | drivers/uio/uio_pdrv_genirq.c | 34 | ||||
-rw-r--r-- | drivers/uio/uio_sercos3.c | 1 |
7 files changed, 30 insertions, 51 deletions
diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c index 0e808cf91d97..67beb8444930 100644 --- a/drivers/uio/uio.c +++ b/drivers/uio/uio.c | |||
@@ -288,13 +288,13 @@ static int uio_dev_add_attributes(struct uio_device *idev) | |||
288 | } | 288 | } |
289 | map = kzalloc(sizeof(*map), GFP_KERNEL); | 289 | map = kzalloc(sizeof(*map), GFP_KERNEL); |
290 | if (!map) | 290 | if (!map) |
291 | goto err_map; | 291 | goto err_map_kobj; |
292 | kobject_init(&map->kobj, &map_attr_type); | 292 | kobject_init(&map->kobj, &map_attr_type); |
293 | map->mem = mem; | 293 | map->mem = mem; |
294 | mem->map = map; | 294 | mem->map = map; |
295 | ret = kobject_add(&map->kobj, idev->map_dir, "map%d", mi); | 295 | ret = kobject_add(&map->kobj, idev->map_dir, "map%d", mi); |
296 | if (ret) | 296 | if (ret) |
297 | goto err_map; | 297 | goto err_map_kobj; |
298 | ret = kobject_uevent(&map->kobj, KOBJ_ADD); | 298 | ret = kobject_uevent(&map->kobj, KOBJ_ADD); |
299 | if (ret) | 299 | if (ret) |
300 | goto err_map; | 300 | goto err_map; |
@@ -313,14 +313,14 @@ static int uio_dev_add_attributes(struct uio_device *idev) | |||
313 | } | 313 | } |
314 | portio = kzalloc(sizeof(*portio), GFP_KERNEL); | 314 | portio = kzalloc(sizeof(*portio), GFP_KERNEL); |
315 | if (!portio) | 315 | if (!portio) |
316 | goto err_portio; | 316 | goto err_portio_kobj; |
317 | kobject_init(&portio->kobj, &portio_attr_type); | 317 | kobject_init(&portio->kobj, &portio_attr_type); |
318 | portio->port = port; | 318 | portio->port = port; |
319 | port->portio = portio; | 319 | port->portio = portio; |
320 | ret = kobject_add(&portio->kobj, idev->portio_dir, | 320 | ret = kobject_add(&portio->kobj, idev->portio_dir, |
321 | "port%d", pi); | 321 | "port%d", pi); |
322 | if (ret) | 322 | if (ret) |
323 | goto err_portio; | 323 | goto err_portio_kobj; |
324 | ret = kobject_uevent(&portio->kobj, KOBJ_ADD); | 324 | ret = kobject_uevent(&portio->kobj, KOBJ_ADD); |
325 | if (ret) | 325 | if (ret) |
326 | goto err_portio; | 326 | goto err_portio; |
@@ -329,14 +329,18 @@ static int uio_dev_add_attributes(struct uio_device *idev) | |||
329 | return 0; | 329 | return 0; |
330 | 330 | ||
331 | err_portio: | 331 | err_portio: |
332 | for (pi--; pi >= 0; pi--) { | 332 | pi--; |
333 | err_portio_kobj: | ||
334 | for (; pi >= 0; pi--) { | ||
333 | port = &idev->info->port[pi]; | 335 | port = &idev->info->port[pi]; |
334 | portio = port->portio; | 336 | portio = port->portio; |
335 | kobject_put(&portio->kobj); | 337 | kobject_put(&portio->kobj); |
336 | } | 338 | } |
337 | kobject_put(idev->portio_dir); | 339 | kobject_put(idev->portio_dir); |
338 | err_map: | 340 | err_map: |
339 | for (mi--; mi>=0; mi--) { | 341 | mi--; |
342 | err_map_kobj: | ||
343 | for (; mi >= 0; mi--) { | ||
340 | mem = &idev->info->mem[mi]; | 344 | mem = &idev->info->mem[mi]; |
341 | map = mem->map; | 345 | map = mem->map; |
342 | kobject_put(&map->kobj); | 346 | kobject_put(&map->kobj); |
@@ -601,6 +605,7 @@ static int uio_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf) | |||
601 | struct uio_device *idev = vma->vm_private_data; | 605 | struct uio_device *idev = vma->vm_private_data; |
602 | struct page *page; | 606 | struct page *page; |
603 | unsigned long offset; | 607 | unsigned long offset; |
608 | void *addr; | ||
604 | 609 | ||
605 | int mi = uio_find_mem_index(vma); | 610 | int mi = uio_find_mem_index(vma); |
606 | if (mi < 0) | 611 | if (mi < 0) |
@@ -612,10 +617,11 @@ static int uio_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf) | |||
612 | */ | 617 | */ |
613 | offset = (vmf->pgoff - mi) << PAGE_SHIFT; | 618 | offset = (vmf->pgoff - mi) << PAGE_SHIFT; |
614 | 619 | ||
620 | addr = (void *)(unsigned long)idev->info->mem[mi].addr + offset; | ||
615 | if (idev->info->mem[mi].memtype == UIO_MEM_LOGICAL) | 621 | if (idev->info->mem[mi].memtype == UIO_MEM_LOGICAL) |
616 | page = virt_to_page(idev->info->mem[mi].addr + offset); | 622 | page = virt_to_page(addr); |
617 | else | 623 | else |
618 | page = vmalloc_to_page((void *)(unsigned long)idev->info->mem[mi].addr + offset); | 624 | page = vmalloc_to_page(addr); |
619 | get_page(page); | 625 | get_page(page); |
620 | vmf->page = page; | 626 | vmf->page = page; |
621 | return 0; | 627 | return 0; |
@@ -809,10 +815,9 @@ int __uio_register_device(struct module *owner, | |||
809 | 815 | ||
810 | info->uio_dev = NULL; | 816 | info->uio_dev = NULL; |
811 | 817 | ||
812 | idev = kzalloc(sizeof(*idev), GFP_KERNEL); | 818 | idev = devm_kzalloc(parent, sizeof(*idev), GFP_KERNEL); |
813 | if (!idev) { | 819 | if (!idev) { |
814 | ret = -ENOMEM; | 820 | return -ENOMEM; |
815 | goto err_kzalloc; | ||
816 | } | 821 | } |
817 | 822 | ||
818 | idev->owner = owner; | 823 | idev->owner = owner; |
@@ -822,7 +827,7 @@ int __uio_register_device(struct module *owner, | |||
822 | 827 | ||
823 | ret = uio_get_minor(idev); | 828 | ret = uio_get_minor(idev); |
824 | if (ret) | 829 | if (ret) |
825 | goto err_get_minor; | 830 | return ret; |
826 | 831 | ||
827 | idev->dev = device_create(&uio_class, parent, | 832 | idev->dev = device_create(&uio_class, parent, |
828 | MKDEV(uio_major, idev->minor), idev, | 833 | MKDEV(uio_major, idev->minor), idev, |
@@ -840,7 +845,7 @@ int __uio_register_device(struct module *owner, | |||
840 | info->uio_dev = idev; | 845 | info->uio_dev = idev; |
841 | 846 | ||
842 | if (info->irq && (info->irq != UIO_IRQ_CUSTOM)) { | 847 | if (info->irq && (info->irq != UIO_IRQ_CUSTOM)) { |
843 | ret = request_irq(info->irq, uio_interrupt, | 848 | ret = devm_request_irq(parent, info->irq, uio_interrupt, |
844 | info->irq_flags, info->name, idev); | 849 | info->irq_flags, info->name, idev); |
845 | if (ret) | 850 | if (ret) |
846 | goto err_request_irq; | 851 | goto err_request_irq; |
@@ -854,9 +859,6 @@ err_uio_dev_add_attributes: | |||
854 | device_destroy(&uio_class, MKDEV(uio_major, idev->minor)); | 859 | device_destroy(&uio_class, MKDEV(uio_major, idev->minor)); |
855 | err_device_create: | 860 | err_device_create: |
856 | uio_free_minor(idev); | 861 | uio_free_minor(idev); |
857 | err_get_minor: | ||
858 | kfree(idev); | ||
859 | err_kzalloc: | ||
860 | return ret; | 862 | return ret; |
861 | } | 863 | } |
862 | EXPORT_SYMBOL_GPL(__uio_register_device); | 864 | EXPORT_SYMBOL_GPL(__uio_register_device); |
@@ -877,13 +879,9 @@ void uio_unregister_device(struct uio_info *info) | |||
877 | 879 | ||
878 | uio_free_minor(idev); | 880 | uio_free_minor(idev); |
879 | 881 | ||
880 | if (info->irq && (info->irq != UIO_IRQ_CUSTOM)) | ||
881 | free_irq(info->irq, idev); | ||
882 | |||
883 | uio_dev_del_attributes(idev); | 882 | uio_dev_del_attributes(idev); |
884 | 883 | ||
885 | device_destroy(&uio_class, MKDEV(uio_major, idev->minor)); | 884 | device_destroy(&uio_class, MKDEV(uio_major, idev->minor)); |
886 | kfree(idev); | ||
887 | 885 | ||
888 | return; | 886 | return; |
889 | } | 887 | } |
diff --git a/drivers/uio/uio_aec.c b/drivers/uio/uio_aec.c index f3611c2d83b6..1549fab633c6 100644 --- a/drivers/uio/uio_aec.c +++ b/drivers/uio/uio_aec.c | |||
@@ -147,7 +147,6 @@ static void remove(struct pci_dev *pdev) | |||
147 | uio_unregister_device(info); | 147 | uio_unregister_device(info); |
148 | pci_release_regions(pdev); | 148 | pci_release_regions(pdev); |
149 | pci_disable_device(pdev); | 149 | pci_disable_device(pdev); |
150 | pci_set_drvdata(pdev, NULL); | ||
151 | iounmap(info->priv); | 150 | iounmap(info->priv); |
152 | 151 | ||
153 | kfree(info); | 152 | kfree(info); |
diff --git a/drivers/uio/uio_cif.c b/drivers/uio/uio_cif.c index 22cdf385ab33..30f533ce3758 100644 --- a/drivers/uio/uio_cif.c +++ b/drivers/uio/uio_cif.c | |||
@@ -106,7 +106,6 @@ static void hilscher_pci_remove(struct pci_dev *dev) | |||
106 | uio_unregister_device(info); | 106 | uio_unregister_device(info); |
107 | pci_release_regions(dev); | 107 | pci_release_regions(dev); |
108 | pci_disable_device(dev); | 108 | pci_disable_device(dev); |
109 | pci_set_drvdata(dev, NULL); | ||
110 | iounmap(info->mem[0].internal_addr); | 109 | iounmap(info->mem[0].internal_addr); |
111 | 110 | ||
112 | kfree (info); | 111 | kfree (info); |
diff --git a/drivers/uio/uio_mf624.c b/drivers/uio/uio_mf624.c index a1768b2f4493..f764adbfe036 100644 --- a/drivers/uio/uio_mf624.c +++ b/drivers/uio/uio_mf624.c | |||
@@ -42,7 +42,7 @@ | |||
42 | 42 | ||
43 | enum mf624_interrupt_source {ADC, CTR4, ALL}; | 43 | enum mf624_interrupt_source {ADC, CTR4, ALL}; |
44 | 44 | ||
45 | void mf624_disable_interrupt(enum mf624_interrupt_source source, | 45 | static void mf624_disable_interrupt(enum mf624_interrupt_source source, |
46 | struct uio_info *info) | 46 | struct uio_info *info) |
47 | { | 47 | { |
48 | void __iomem *INTCSR_reg = info->mem[0].internal_addr + INTCSR; | 48 | void __iomem *INTCSR_reg = info->mem[0].internal_addr + INTCSR; |
@@ -70,7 +70,7 @@ void mf624_disable_interrupt(enum mf624_interrupt_source source, | |||
70 | } | 70 | } |
71 | } | 71 | } |
72 | 72 | ||
73 | void mf624_enable_interrupt(enum mf624_interrupt_source source, | 73 | static void mf624_enable_interrupt(enum mf624_interrupt_source source, |
74 | struct uio_info *info) | 74 | struct uio_info *info) |
75 | { | 75 | { |
76 | void __iomem *INTCSR_reg = info->mem[0].internal_addr + INTCSR; | 76 | void __iomem *INTCSR_reg = info->mem[0].internal_addr + INTCSR; |
@@ -220,7 +220,6 @@ static void mf624_pci_remove(struct pci_dev *dev) | |||
220 | uio_unregister_device(info); | 220 | uio_unregister_device(info); |
221 | pci_release_regions(dev); | 221 | pci_release_regions(dev); |
222 | pci_disable_device(dev); | 222 | pci_disable_device(dev); |
223 | pci_set_drvdata(dev, NULL); | ||
224 | 223 | ||
225 | iounmap(info->mem[0].internal_addr); | 224 | iounmap(info->mem[0].internal_addr); |
226 | iounmap(info->mem[1].internal_addr); | 225 | iounmap(info->mem[1].internal_addr); |
diff --git a/drivers/uio/uio_netx.c b/drivers/uio/uio_netx.c index 28a766b9e198..4c345db8b016 100644 --- a/drivers/uio/uio_netx.c +++ b/drivers/uio/uio_netx.c | |||
@@ -127,7 +127,6 @@ static void netx_pci_remove(struct pci_dev *dev) | |||
127 | uio_unregister_device(info); | 127 | uio_unregister_device(info); |
128 | pci_release_regions(dev); | 128 | pci_release_regions(dev); |
129 | pci_disable_device(dev); | 129 | pci_disable_device(dev); |
130 | pci_set_drvdata(dev, NULL); | ||
131 | iounmap(info->mem[0].internal_addr); | 130 | iounmap(info->mem[0].internal_addr); |
132 | 131 | ||
133 | kfree(info); | 132 | kfree(info); |
diff --git a/drivers/uio/uio_pdrv_genirq.c b/drivers/uio/uio_pdrv_genirq.c index 90ff17a0202f..76669313e9a7 100644 --- a/drivers/uio/uio_pdrv_genirq.c +++ b/drivers/uio/uio_pdrv_genirq.c | |||
@@ -112,11 +112,11 @@ static int uio_pdrv_genirq_probe(struct platform_device *pdev) | |||
112 | 112 | ||
113 | if (pdev->dev.of_node) { | 113 | if (pdev->dev.of_node) { |
114 | /* alloc uioinfo for one device */ | 114 | /* alloc uioinfo for one device */ |
115 | uioinfo = kzalloc(sizeof(*uioinfo), GFP_KERNEL); | 115 | uioinfo = devm_kzalloc(&pdev->dev, sizeof(*uioinfo), |
116 | GFP_KERNEL); | ||
116 | if (!uioinfo) { | 117 | if (!uioinfo) { |
117 | ret = -ENOMEM; | ||
118 | dev_err(&pdev->dev, "unable to kmalloc\n"); | 118 | dev_err(&pdev->dev, "unable to kmalloc\n"); |
119 | return ret; | 119 | return -ENOMEM; |
120 | } | 120 | } |
121 | uioinfo->name = pdev->dev.of_node->name; | 121 | uioinfo->name = pdev->dev.of_node->name; |
122 | uioinfo->version = "devicetree"; | 122 | uioinfo->version = "devicetree"; |
@@ -125,20 +125,19 @@ static int uio_pdrv_genirq_probe(struct platform_device *pdev) | |||
125 | 125 | ||
126 | if (!uioinfo || !uioinfo->name || !uioinfo->version) { | 126 | if (!uioinfo || !uioinfo->name || !uioinfo->version) { |
127 | dev_err(&pdev->dev, "missing platform_data\n"); | 127 | dev_err(&pdev->dev, "missing platform_data\n"); |
128 | goto bad0; | 128 | return ret; |
129 | } | 129 | } |
130 | 130 | ||
131 | if (uioinfo->handler || uioinfo->irqcontrol || | 131 | if (uioinfo->handler || uioinfo->irqcontrol || |
132 | uioinfo->irq_flags & IRQF_SHARED) { | 132 | uioinfo->irq_flags & IRQF_SHARED) { |
133 | dev_err(&pdev->dev, "interrupt configuration error\n"); | 133 | dev_err(&pdev->dev, "interrupt configuration error\n"); |
134 | goto bad0; | 134 | return ret; |
135 | } | 135 | } |
136 | 136 | ||
137 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); | 137 | priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); |
138 | if (!priv) { | 138 | if (!priv) { |
139 | ret = -ENOMEM; | ||
140 | dev_err(&pdev->dev, "unable to kmalloc\n"); | 139 | dev_err(&pdev->dev, "unable to kmalloc\n"); |
141 | goto bad0; | 140 | return -ENOMEM; |
142 | } | 141 | } |
143 | 142 | ||
144 | priv->uioinfo = uioinfo; | 143 | priv->uioinfo = uioinfo; |
@@ -153,7 +152,7 @@ static int uio_pdrv_genirq_probe(struct platform_device *pdev) | |||
153 | uioinfo->irq = UIO_IRQ_NONE; | 152 | uioinfo->irq = UIO_IRQ_NONE; |
154 | else if (ret < 0) { | 153 | else if (ret < 0) { |
155 | dev_err(&pdev->dev, "failed to get IRQ\n"); | 154 | dev_err(&pdev->dev, "failed to get IRQ\n"); |
156 | goto bad1; | 155 | return ret; |
157 | } | 156 | } |
158 | } | 157 | } |
159 | 158 | ||
@@ -209,20 +208,12 @@ static int uio_pdrv_genirq_probe(struct platform_device *pdev) | |||
209 | ret = uio_register_device(&pdev->dev, priv->uioinfo); | 208 | ret = uio_register_device(&pdev->dev, priv->uioinfo); |
210 | if (ret) { | 209 | if (ret) { |
211 | dev_err(&pdev->dev, "unable to register uio device\n"); | 210 | dev_err(&pdev->dev, "unable to register uio device\n"); |
212 | goto bad2; | 211 | pm_runtime_disable(&pdev->dev); |
212 | return ret; | ||
213 | } | 213 | } |
214 | 214 | ||
215 | platform_set_drvdata(pdev, priv); | 215 | platform_set_drvdata(pdev, priv); |
216 | return 0; | 216 | return 0; |
217 | bad2: | ||
218 | pm_runtime_disable(&pdev->dev); | ||
219 | bad1: | ||
220 | kfree(priv); | ||
221 | bad0: | ||
222 | /* kfree uioinfo for OF */ | ||
223 | if (pdev->dev.of_node) | ||
224 | kfree(uioinfo); | ||
225 | return ret; | ||
226 | } | 217 | } |
227 | 218 | ||
228 | static int uio_pdrv_genirq_remove(struct platform_device *pdev) | 219 | static int uio_pdrv_genirq_remove(struct platform_device *pdev) |
@@ -235,11 +226,6 @@ static int uio_pdrv_genirq_remove(struct platform_device *pdev) | |||
235 | priv->uioinfo->handler = NULL; | 226 | priv->uioinfo->handler = NULL; |
236 | priv->uioinfo->irqcontrol = NULL; | 227 | priv->uioinfo->irqcontrol = NULL; |
237 | 228 | ||
238 | /* kfree uioinfo for OF */ | ||
239 | if (pdev->dev.of_node) | ||
240 | kfree(priv->uioinfo); | ||
241 | |||
242 | kfree(priv); | ||
243 | return 0; | 229 | return 0; |
244 | } | 230 | } |
245 | 231 | ||
diff --git a/drivers/uio/uio_sercos3.c b/drivers/uio/uio_sercos3.c index 541983217085..9cfdfcafa262 100644 --- a/drivers/uio/uio_sercos3.c +++ b/drivers/uio/uio_sercos3.c | |||
@@ -188,7 +188,6 @@ static void sercos3_pci_remove(struct pci_dev *dev) | |||
188 | uio_unregister_device(info); | 188 | uio_unregister_device(info); |
189 | pci_release_regions(dev); | 189 | pci_release_regions(dev); |
190 | pci_disable_device(dev); | 190 | pci_disable_device(dev); |
191 | pci_set_drvdata(dev, NULL); | ||
192 | for (i = 0; i < 5; i++) { | 191 | for (i = 0; i < 5; i++) { |
193 | if (info->mem[i].internal_addr) | 192 | if (info->mem[i].internal_addr) |
194 | iounmap(info->mem[i].internal_addr); | 193 | iounmap(info->mem[i].internal_addr); |