include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit...
[safe/jmp/linux-2.6] / arch / sh / mm / ioremap_fixed.c
index 425f6c6..efbe84a 100644 (file)
@@ -15,7 +15,6 @@
 #include <linux/io.h>
 #include <linux/bootmem.h>
 #include <linux/proc_fs.h>
-#include <linux/slab.h>
 #include <asm/fixmap.h>
 #include <asm/page.h>
 #include <asm/pgalloc.h>
@@ -45,15 +44,21 @@ void __init ioremap_fixed_init(void)
 }
 
 void __init __iomem *
-ioremap_fixed(resource_size_t phys_addr, unsigned long size, pgprot_t prot)
+ioremap_fixed(phys_addr_t phys_addr, unsigned long size, pgprot_t prot)
 {
        enum fixed_addresses idx0, idx;
-       resource_size_t last_addr;
        struct ioremap_map *map;
-       unsigned long offset;
        unsigned int nrpages;
+       unsigned long offset;
        int i, slot;
 
+       /*
+        * Mappings have to be page-aligned
+        */
+       offset = phys_addr & ~PAGE_MASK;
+       phys_addr &= PAGE_MASK;
+       size = PAGE_ALIGN(phys_addr + size) - phys_addr;
+
        slot = -1;
        for (i = 0; i < FIX_N_IOREMAPS; i++) {
                map = &ioremap_maps[i];
@@ -67,18 +72,6 @@ ioremap_fixed(resource_size_t phys_addr, unsigned long size, pgprot_t prot)
        if (slot < 0)
                return NULL;
 
-       /* Don't allow wraparound or zero size */
-       last_addr = phys_addr + size - 1;
-       if (!size || last_addr < phys_addr)
-               return NULL;
-
-       /*
-        * Fixmap mappings have to be page-aligned
-        */
-       offset = phys_addr & ~PAGE_MASK;
-       phys_addr &= PAGE_MASK;
-       size = PAGE_ALIGN(last_addr + 1) - phys_addr;
-
        /*
         * Mappings have to fit in the FIX_IOREMAP area.
         */
@@ -106,12 +99,9 @@ ioremap_fixed(resource_size_t phys_addr, unsigned long size, pgprot_t prot)
 int iounmap_fixed(void __iomem *addr)
 {
        enum fixed_addresses idx;
-       unsigned long virt_addr;
        struct ioremap_map *map;
-       unsigned long offset;
        unsigned int nrpages;
        int i, slot;
-       pgprot_t prot;
 
        slot = -1;
        for (i = 0; i < FIX_N_IOREMAPS; i++) {
@@ -128,16 +118,11 @@ int iounmap_fixed(void __iomem *addr)
        if (slot < 0)
                return -EINVAL;
 
-       virt_addr = (unsigned long)addr;
-
-       offset = virt_addr & ~PAGE_MASK;
-       nrpages = PAGE_ALIGN(offset + map->size - 1) >> PAGE_SHIFT;
-
-       pgprot_val(prot) = _PAGE_WIRED;
+       nrpages = map->size >> PAGE_SHIFT;
 
-       idx = FIX_IOREMAP_BEGIN + slot + nrpages;
+       idx = FIX_IOREMAP_BEGIN + slot + nrpages - 1;
        while (nrpages > 0) {
-               __clear_fixmap(idx, prot);
+               __clear_fixmap(idx, __pgprot(_PAGE_WIRED));
                --idx;
                --nrpages;
        }