aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc/kernel
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-07-31 20:30:59 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-07-31 20:30:59 -0400
commit968e75fc13b6d582f42ce44172e13ba58157e11f (patch)
tree306eacdf2815f8a49b47228c3b50e7a6083ef7d4 /arch/sparc/kernel
parenta00ed25cce6fe856388f89c7cd40da0eee7666a6 (diff)
parentd3690f8b713f9710e68214ca38fb8b07b587a2a7 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k: m68k/math-emu: Remove unnecessary code m68k/math-emu: Remove commented out old code m68k: Kill warning in setup_arch() when compiling for Sun3 m68k/atari: Prefix GPIO_{IN,OUT} with CODEC_ sparc: iounmap() and *_free_coherent() - Use lookup_resource() m68k/atari: Reserve some ST-RAM early on for device buffer use m68k/amiga: Chip RAM - Use lookup_resource() resources: Add lookup_resource() sparc: _sparc_find_resource() should check for exact matches m68k/amiga: Chip RAM - Offset resource end by CHIP_PHYSADDR m68k/amiga: Chip RAM - Use resource_size() to fix off-by-one error m68k/amiga: Chip RAM - Change chipavail to an atomic_t m68k/amiga: Chip RAM - Always allocate from the start of memory m68k/amiga: Chip RAM - Convert from printk() to pr_*() m68k/amiga: Chip RAM - Use tabs for indentation
Diffstat (limited to 'arch/sparc/kernel')
-rw-r--r--arch/sparc/kernel/ioport.c32
1 files changed, 7 insertions, 25 deletions
diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c
index 6ffccd6e015..d0479e2163f 100644
--- a/arch/sparc/kernel/ioport.c
+++ b/arch/sparc/kernel/ioport.c
@@ -65,9 +65,6 @@ static inline void dma_make_coherent(unsigned long pa, unsigned long len)
65} 65}
66#endif 66#endif
67 67
68static struct resource *_sparc_find_resource(struct resource *r,
69 unsigned long);
70
71static void __iomem *_sparc_ioremap(struct resource *res, u32 bus, u32 pa, int sz); 68static void __iomem *_sparc_ioremap(struct resource *res, u32 bus, u32 pa, int sz);
72static void __iomem *_sparc_alloc_io(unsigned int busno, unsigned long phys, 69static void __iomem *_sparc_alloc_io(unsigned int busno, unsigned long phys,
73 unsigned long size, char *name); 70 unsigned long size, char *name);
@@ -143,7 +140,11 @@ void iounmap(volatile void __iomem *virtual)
143 unsigned long vaddr = (unsigned long) virtual & PAGE_MASK; 140 unsigned long vaddr = (unsigned long) virtual & PAGE_MASK;
144 struct resource *res; 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 printk("free_io/iounmap: cannot free %lx\n", vaddr); 148 printk("free_io/iounmap: cannot free %lx\n", vaddr);
148 return; 149 return;
149 } 150 }
@@ -319,7 +320,7 @@ static void sbus_free_coherent(struct device *dev, size_t n, void *p,
319 struct resource *res; 320 struct resource *res;
320 struct page *pgv; 321 struct page *pgv;
321 322
322 if ((res = _sparc_find_resource(&_sparc_dvma, 323 if ((res = lookup_resource(&_sparc_dvma,
323 (unsigned long)p)) == NULL) { 324 (unsigned long)p)) == NULL) {
324 printk("sbus_free_consistent: cannot free %p\n", p); 325 printk("sbus_free_consistent: cannot free %p\n", p);
325 return; 326 return;
@@ -492,7 +493,7 @@ static void pci32_free_coherent(struct device *dev, size_t n, void *p,
492{ 493{
493 struct resource *res; 494 struct resource *res;
494 495
495 if ((res = _sparc_find_resource(&_sparc_dvma, 496 if ((res = lookup_resource(&_sparc_dvma,
496 (unsigned long)p)) == NULL) { 497 (unsigned long)p)) == NULL) {
497 printk("pci_free_consistent: cannot free %p\n", p); 498 printk("pci_free_consistent: cannot free %p\n", p);
498 return; 499 return;
@@ -715,25 +716,6 @@ static const struct file_operations sparc_io_proc_fops = {
715}; 716};
716#endif /* CONFIG_PROC_FS */ 717#endif /* CONFIG_PROC_FS */
717 718
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 */
725static struct resource *_sparc_find_resource(struct resource *root,
726 unsigned long hit)
727{
728 struct resource *tmp;
729
730 for (tmp = root->child; tmp != 0; tmp = tmp->sibling) {
731 if (tmp->start <= hit && tmp->end >= hit)
732 return tmp;
733 }
734 return NULL;
735}
736
737static void register_proc_sparc_ioport(void) 719static void register_proc_sparc_ioport(void)
738{ 720{
739#ifdef CONFIG_PROC_FS 721#ifdef CONFIG_PROC_FS