]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
sh: Kill off duplicate address alignment in ioremap_fixed().
authorPaul Mundt <lethal@linux-sh.org>
Tue, 19 Jan 2010 04:49:19 +0000 (13:49 +0900)
committerPaul Mundt <lethal@linux-sh.org>
Tue, 19 Jan 2010 04:49:19 +0000 (13:49 +0900)
This is already taken care of in the top-level ioremap, and now that
no one should be calling ioremap_fixed() directly we can simply throw the
mapping displacement in as an additional argument.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
arch/sh/include/asm/io.h
arch/sh/mm/ioremap.c
arch/sh/mm/ioremap_fixed.c

index 13696dfccc1699784770c633ebc3730eea44f6f6..70269813cef1732a5070b94c75137138498c6d36 100644 (file)
@@ -239,12 +239,14 @@ void __iomem *__ioremap_caller(unsigned long offset, unsigned long size,
 void __iounmap(void __iomem *addr);
 
 #ifdef CONFIG_IOREMAP_FIXED
-extern void __iomem *ioremap_fixed(resource_size_t, unsigned long, pgprot_t);
+extern void __iomem *ioremap_fixed(resource_size_t, unsigned long,
+                                  unsigned long, pgprot_t);
 extern int iounmap_fixed(void __iomem *);
 extern void ioremap_fixed_init(void);
 #else
 static inline void __iomem *
-ioremap_fixed(resource_size t phys_addr, unsigned long size, pgprot_t prot)
+ioremap_fixed(resource_size t phys_addr, unsigned long offset,
+             unsigned long size, pgprot_t prot)
 {
        BUG();
 }
index 85b420d006221a8e4e56d61667d8cd90cd7b0134..bb03308e84089316ba75080dbc7a893c51967b03 100644 (file)
@@ -68,7 +68,7 @@ __ioremap_caller(unsigned long phys_addr, unsigned long size,
         * If we can't yet use the regular approach, go the fixmap route.
         */
        if (!mem_init_done)
-               return ioremap_fixed(phys_addr, size, pgprot);
+               return ioremap_fixed(phys_addr, offset, size, pgprot);
 
        /*
         * Ok, go for it..
index 425f6c6bf2509e521486d310b0ae811d49e45208..551b513e8fce71cc562aab1408fac23e72b7df55 100644 (file)
@@ -45,12 +45,11 @@ void __init ioremap_fixed_init(void)
 }
 
 void __init __iomem *
-ioremap_fixed(resource_size_t phys_addr, unsigned long size, pgprot_t prot)
+ioremap_fixed(resource_size_t phys_addr, unsigned long offset,
+             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;
        int i, slot;
 
@@ -67,18 +66,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.
         */
@@ -111,7 +98,6 @@ int iounmap_fixed(void __iomem *addr)
        unsigned long offset;
        unsigned int nrpages;
        int i, slot;
-       pgprot_t prot;
 
        slot = -1;
        for (i = 0; i < FIX_N_IOREMAPS; i++) {
@@ -133,11 +119,9 @@ int iounmap_fixed(void __iomem *addr)
        offset = virt_addr & ~PAGE_MASK;
        nrpages = PAGE_ALIGN(offset + map->size - 1) >> PAGE_SHIFT;
 
-       pgprot_val(prot) = _PAGE_WIRED;
-
        idx = FIX_IOREMAP_BEGIN + slot + nrpages;
        while (nrpages > 0) {
-               __clear_fixmap(idx, prot);
+               __clear_fixmap(idx, __pgprot(_PAGE_WIRED));
                --idx;
                --nrpages;
        }