Commit a0e997c20a2fbe25b0f97fb7521cdbda341c7f0a

Authored by Geert Uytterhoeven
1 parent 217bbd8188

sparc: iounmap() and *_free_coherent() - Use lookup_resource()

Replace a custom implementation (which doesn't lock the resource tree) by a
call to lookup_resource()

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: David S. Miller <davem@davemloft.net>

Showing 1 changed file with 7 additions and 25 deletions Side-by-side Diff

arch/sparc/kernel/ioport.c
... ... @@ -65,9 +65,6 @@
65 65 }
66 66 #endif
67 67  
68   -static struct resource *_sparc_find_resource(struct resource *r,
69   - unsigned long);
70   -
71 68 static void __iomem *_sparc_ioremap(struct resource *res, u32 bus, u32 pa, int sz);
72 69 static void __iomem *_sparc_alloc_io(unsigned int busno, unsigned long phys,
73 70 unsigned long size, char *name);
... ... @@ -143,7 +140,11 @@
143 140 unsigned long vaddr = (unsigned long) virtual & PAGE_MASK;
144 141 struct resource *res;
145 142  
146   - if ((res = _sparc_find_resource(&sparc_iomap, vaddr)) == NULL) {
  143 + /*
  144 + * XXX Too slow. Can have 8192 DVMA pages on sun4m in the worst case.
  145 + * This probably warrants some sort of hashing.
  146 + */
  147 + if ((res = lookup_resource(&sparc_iomap, vaddr)) == NULL) {
147 148 printk("free_io/iounmap: cannot free %lx\n", vaddr);
148 149 return;
149 150 }
... ... @@ -319,7 +320,7 @@
319 320 struct resource *res;
320 321 struct page *pgv;
321 322  
322   - if ((res = _sparc_find_resource(&_sparc_dvma,
  323 + if ((res = lookup_resource(&_sparc_dvma,
323 324 (unsigned long)p)) == NULL) {
324 325 printk("sbus_free_consistent: cannot free %p\n", p);
325 326 return;
... ... @@ -492,7 +493,7 @@
492 493 {
493 494 struct resource *res;
494 495  
495   - if ((res = _sparc_find_resource(&_sparc_dvma,
  496 + if ((res = lookup_resource(&_sparc_dvma,
496 497 (unsigned long)p)) == NULL) {
497 498 printk("pci_free_consistent: cannot free %p\n", p);
498 499 return;
... ... @@ -714,25 +715,6 @@
714 715 .release = single_release,
715 716 };
716 717 #endif /* CONFIG_PROC_FS */
717   -
718   -/*
719   - * This is a version of find_resource and it belongs to kernel/resource.c.
720   - * Until we have agreement with Linus and Martin, it lingers here.
721   - *
722   - * XXX Too slow. Can have 8192 DVMA pages on sun4m in the worst case.
723   - * This probably warrants some sort of hashing.
724   - */
725   -static struct resource *_sparc_find_resource(struct resource *root,
726   - unsigned long start)
727   -{
728   - struct resource *tmp;
729   -
730   - for (tmp = root->child; tmp != 0; tmp = tmp->sibling) {
731   - if (tmp->start == start)
732   - return tmp;
733   - }
734   - return NULL;
735   -}
736 718  
737 719 static void register_proc_sparc_ioport(void)
738 720 {