]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm/ioremap: pass pgprot_t to ioremap_prot() instead of unsigned long
authorRyan Roberts <ryan.roberts@arm.com>
Tue, 18 Feb 2025 10:19:54 +0000 (15:49 +0530)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 28 Feb 2025 01:00:16 +0000 (17:00 -0800)
ioremap_prot() currently accepts pgprot_val parameter as an unsigned long,
thus implicitly assuming that pgprot_val and pgprot_t could never be
bigger than unsigned long.  But this assumption soon will not be true on
arm64 when using D128 pgtables.  In 128 bit page table configuration,
unsigned long is 64 bit, but pgprot_t is 128 bit.

Passing platform abstracted pgprot_t argument is better as compared to
size based data types.  Let's change the parameter to directly pass
pgprot_t like another similar helper generic_ioremap_prot().

Without this change in place, D128 configuration does not work on arm64 as
the top 64 bits gets silently stripped when passing the protection value
to this function.

Link: https://lkml.kernel.org/r/20250218101954.415331-1-anshuman.khandual@arm.com
Signed-off-by: Ryan Roberts <ryan.roberts@arm.com>
Co-developed-by: Anshuman Khandual <anshuman.khandual@arm.com>
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
Acked-by: Catalin Marinas <catalin.marinas@arm.com> [arm64]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
30 files changed:
arch/arc/mm/ioremap.c
arch/arm64/include/asm/io.h
arch/arm64/kernel/acpi.c
arch/arm64/mm/ioremap.c
arch/csky/include/asm/io.h
arch/loongarch/include/asm/io.h
arch/mips/include/asm/io.h
arch/mips/mm/ioremap.c
arch/mips/mm/ioremap64.c
arch/parisc/include/asm/io.h
arch/parisc/mm/ioremap.c
arch/powerpc/include/asm/io.h
arch/powerpc/mm/ioremap.c
arch/powerpc/platforms/ps3/spu.c
arch/riscv/include/asm/io.h
arch/riscv/kernel/acpi.c
arch/s390/include/asm/io.h
arch/s390/pci/pci.c
arch/sh/boards/mach-landisk/setup.c
arch/sh/boards/mach-lboxre2/setup.c
arch/sh/boards/mach-sh03/setup.c
arch/sh/include/asm/io.h
arch/sh/mm/ioremap.c
arch/x86/include/asm/io.h
arch/x86/mm/ioremap.c
arch/xtensa/include/asm/io.h
arch/xtensa/mm/ioremap.c
include/asm-generic/io.h
mm/ioremap.c
mm/memory.c

index b07004d532678206ee8b4245dc4e7470bd134992..fd8897a0e52cad071c414631c584c60e75c4dd5d 100644 (file)
@@ -32,7 +32,7 @@ void __iomem *ioremap(phys_addr_t paddr, unsigned long size)
                return (void __iomem *)(u32)paddr;
 
        return ioremap_prot(paddr, size,
-                           pgprot_val(pgprot_noncached(PAGE_KERNEL)));
+                           pgprot_noncached(PAGE_KERNEL));
 }
 EXPORT_SYMBOL(ioremap);
 
@@ -44,10 +44,8 @@ EXPORT_SYMBOL(ioremap);
  * might need finer access control (R/W/X)
  */
 void __iomem *ioremap_prot(phys_addr_t paddr, size_t size,
-                          unsigned long flags)
+                          pgprot_t prot)
 {
-       pgprot_t prot = __pgprot(flags);
-
        /* force uncached */
        return generic_ioremap_prot(paddr, size, pgprot_noncached(prot));
 }
index 76ebbdc6ffddd81ad2dc343c993bf278d908995b..9b96840fb979bf791cb9b2306ba7fb47464bb8af 100644 (file)
@@ -270,9 +270,9 @@ int arm64_ioremap_prot_hook_register(const ioremap_prot_hook_t hook);
 #define _PAGE_IOREMAP PROT_DEVICE_nGnRE
 
 #define ioremap_wc(addr, size) \
-       ioremap_prot((addr), (size), PROT_NORMAL_NC)
+       ioremap_prot((addr), (size), __pgprot(PROT_NORMAL_NC))
 #define ioremap_np(addr, size) \
-       ioremap_prot((addr), (size), PROT_DEVICE_nGnRnE)
+       ioremap_prot((addr), (size), __pgprot(PROT_DEVICE_nGnRnE))
 
 /*
  * io{read,write}{16,32,64}be() macros
@@ -293,7 +293,7 @@ static inline void __iomem *ioremap_cache(phys_addr_t addr, size_t size)
        if (pfn_is_map_memory(__phys_to_pfn(addr)))
                return (void __iomem *)__phys_to_virt(addr);
 
-       return ioremap_prot(addr, size, PROT_NORMAL);
+       return ioremap_prot(addr, size, __pgprot(PROT_NORMAL));
 }
 
 /*
index e6f66491fbe932757c5da58391d0db472e5d2c9e..b9a66fc146c9fa66a85ebc4247fcdf0d15dba761 100644 (file)
@@ -379,7 +379,7 @@ void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size)
                                prot = __acpi_get_writethrough_mem_attribute();
                }
        }
-       return ioremap_prot(phys, size, pgprot_val(prot));
+       return ioremap_prot(phys, size, prot);
 }
 
 /*
index 6cc0b7e7eb0384b991dd59ce18ea2a476cb20958..10e246f112710485bb380f68049574808f110abe 100644 (file)
@@ -15,10 +15,9 @@ int arm64_ioremap_prot_hook_register(ioremap_prot_hook_t hook)
 }
 
 void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
-                          unsigned long prot)
+                          pgprot_t pgprot)
 {
        unsigned long last_addr = phys_addr + size - 1;
-       pgprot_t pgprot = __pgprot(prot);
 
        /* Don't allow outside PHYS_MASK */
        if (last_addr & ~PHYS_MASK)
index ed53f0b47388088d84eb55253039164e698b9dc4..536d3bf32ff172f5f731f03634d41cf1580d5524 100644 (file)
@@ -36,7 +36,7 @@
  */
 #define ioremap_wc(addr, size) \
        ioremap_prot((addr), (size), \
-               (_PAGE_IOREMAP & ~_CACHE_MASK) | _CACHE_UNCACHED)
+               __pgprot((_PAGE_IOREMAP & ~_CACHE_MASK) | _CACHE_UNCACHED))
 
 #include <asm-generic/io.h>
 
index e77a56eaf90604e14c51b16430ba8f4f44ea360a..eaff72b38dc822c89d97095f79e6040d77285a41 100644 (file)
@@ -23,9 +23,9 @@ extern void __init early_iounmap(void __iomem *addr, unsigned long size);
 #ifdef CONFIG_ARCH_IOREMAP
 
 static inline void __iomem *ioremap_prot(phys_addr_t offset, unsigned long size,
-                                        unsigned long prot_val)
+                                        pgprot_t prot)
 {
-       switch (prot_val & _CACHE_MASK) {
+       switch (pgprot_val(prot) & _CACHE_MASK) {
        case _CACHE_CC:
                return (void __iomem *)(unsigned long)(CACHE_BASE + offset);
        case _CACHE_SUC:
@@ -38,7 +38,7 @@ static inline void __iomem *ioremap_prot(phys_addr_t offset, unsigned long size,
 }
 
 #define ioremap(offset, size)          \
-       ioremap_prot((offset), (size), pgprot_val(PAGE_KERNEL_SUC))
+       ioremap_prot((offset), (size), PAGE_KERNEL_SUC)
 
 #define iounmap(addr)                  ((void)(addr))
 
@@ -55,10 +55,10 @@ static inline void __iomem *ioremap_prot(phys_addr_t offset, unsigned long size,
  */
 #define ioremap_wc(offset, size)       \
        ioremap_prot((offset), (size),  \
-               pgprot_val(wc_enabled ? PAGE_KERNEL_WUC : PAGE_KERNEL_SUC))
+                    wc_enabled ? PAGE_KERNEL_WUC : PAGE_KERNEL_SUC)
 
 #define ioremap_cache(offset, size)    \
-       ioremap_prot((offset), (size), pgprot_val(PAGE_KERNEL))
+       ioremap_prot((offset), (size), PAGE_KERNEL)
 
 #define mmiowb() wmb()
 
index 0bddb568af7c1cce9761bcb0face5de993cebc57..4dacf40ebefd1d98640541dfb34177be26e1e545 100644 (file)
@@ -126,7 +126,7 @@ static inline unsigned long isa_virt_to_bus(volatile void *address)
 }
 
 void __iomem *ioremap_prot(phys_addr_t offset, unsigned long size,
-               unsigned long prot_val);
+                          pgprot_t prot);
 void iounmap(const volatile void __iomem *addr);
 
 /*
@@ -141,7 +141,7 @@ void iounmap(const volatile void __iomem *addr);
  * address.
  */
 #define ioremap(offset, size)                                          \
-       ioremap_prot((offset), (size), _CACHE_UNCACHED)
+       ioremap_prot((offset), (size), __pgprot(_CACHE_UNCACHED))
 
 /*
  * ioremap_cache -     map bus memory into CPU space
@@ -159,7 +159,7 @@ void iounmap(const volatile void __iomem *addr);
  * memory-like regions on I/O busses.
  */
 #define ioremap_cache(offset, size)                                    \
-       ioremap_prot((offset), (size), _page_cachable_default)
+       ioremap_prot((offset), (size), __pgprot(_page_cachable_default))
 
 /*
  * ioremap_wc     -   map bus memory into CPU space
@@ -180,7 +180,7 @@ void iounmap(const volatile void __iomem *addr);
  * _CACHE_UNCACHED option (see cpu_probe() method).
  */
 #define ioremap_wc(offset, size)                                       \
-       ioremap_prot((offset), (size), boot_cpu_data.writecombine)
+       ioremap_prot((offset), (size), __pgprot(boot_cpu_data.writecombine))
 
 #if defined(CONFIG_CPU_CAVIUM_OCTEON)
 #define war_io_reorder_wmb()           wmb()
index d8243d61ef32529da9276cd887900bfb5bd130e6..c6c4576cd4a8762305d8fa9a8d4600778c20d09b 100644 (file)
@@ -44,9 +44,9 @@ static int __ioremap_check_ram(unsigned long start_pfn, unsigned long nr_pages,
  * ioremap_prot gives the caller control over cache coherency attributes (CCA)
  */
 void __iomem *ioremap_prot(phys_addr_t phys_addr, unsigned long size,
-               unsigned long prot_val)
+                          pgprot_t prot)
 {
-       unsigned long flags = prot_val & _CACHE_MASK;
+       unsigned long flags = pgprot_val(prot) & _CACHE_MASK;
        unsigned long offset, pfn, last_pfn;
        struct vm_struct *area;
        phys_addr_t last_addr;
index 15e7820d6a5f4221bcf5e9a0d38c8354985ac6f0..acc03ba2009849c7ea4b544577662027ef73c08d 100644 (file)
@@ -3,9 +3,9 @@
 #include <ioremap.h>
 
 void __iomem *ioremap_prot(phys_addr_t offset, unsigned long size,
-               unsigned long prot_val)
+                          pgprot_t prot)
 {
-       unsigned long flags = prot_val & _CACHE_MASK;
+       unsigned long flags = pgprot_val(prot) & _CACHE_MASK;
        u64 base = (flags == _CACHE_UNCACHED ? IO_BASE : UNCAC_BASE);
        void __iomem *addr;
 
index 3143cf29ce27b47894af0ef79e305a203ee160c9..04b783e2a6d19a8e1bc7c59b5576dfffeaad4d59 100644 (file)
@@ -131,7 +131,7 @@ static inline void gsc_writeq(unsigned long long val, unsigned long addr)
                       _PAGE_ACCESSED | _PAGE_NO_CACHE)
 
 #define ioremap_wc(addr, size)  \
-       ioremap_prot((addr), (size), _PAGE_IOREMAP)
+       ioremap_prot((addr), (size), __pgprot(_PAGE_IOREMAP))
 
 #define pci_iounmap                    pci_iounmap
 
index fd996472dfe72b6d355f7ba0175a97de302f9d9b..0b65c4b3baee5be229494cc925a1457c700369ed 100644 (file)
@@ -14,7 +14,7 @@
 #include <linux/mm.h>
 
 void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
-                          unsigned long prot)
+                          pgprot_t prot)
 {
 #ifdef CONFIG_EISA
        unsigned long end = phys_addr + size - 1;
@@ -41,6 +41,6 @@ void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
                }
        }
 
-       return generic_ioremap_prot(phys_addr, size, __pgprot(prot));
+       return generic_ioremap_prot(phys_addr, size, prot);
 }
 EXPORT_SYMBOL(ioremap_prot);
index fd92ac4501693cdfc6aaa3de0caed95c009e82fa..0436cdc7cfcc543c66d3cb8e09e9d4ae01462037 100644 (file)
@@ -895,7 +895,7 @@ void __iomem *ioremap_wt(phys_addr_t address, unsigned long size);
 
 void __iomem *ioremap_coherent(phys_addr_t address, unsigned long size);
 #define ioremap_cache(addr, size) \
-       ioremap_prot((addr), (size), pgprot_val(PAGE_KERNEL))
+       ioremap_prot((addr), (size), PAGE_KERNEL)
 
 #define iounmap iounmap
 
index 7b0afcabd89f0574a918de4b66ca27ff6fbeb12a..0d6615620ada5abd74fd621fbae64c914d9fbccb 100644 (file)
@@ -41,9 +41,9 @@ void __iomem *ioremap_coherent(phys_addr_t addr, unsigned long size)
        return __ioremap_caller(addr, size, prot, caller);
 }
 
-void __iomem *ioremap_prot(phys_addr_t addr, size_t size, unsigned long flags)
+void __iomem *ioremap_prot(phys_addr_t addr, size_t size, pgprot_t prot)
 {
-       pte_t pte = __pte(flags);
+       pte_t pte = __pte(pgprot_val(prot));
        void *caller = __builtin_return_address(0);
 
        /* writeable implies dirty for kernel addresses */
index 4a2520ec6d7f4a05f5a3b83476a10472db17d7be..61b37c9400b20a46a7cddb7f8613d93134b46a74 100644 (file)
@@ -190,10 +190,10 @@ static void spu_unmap(struct spu *spu)
 static int __init setup_areas(struct spu *spu)
 {
        struct table {char* name; unsigned long addr; unsigned long size;};
-       unsigned long shadow_flags = pgprot_val(pgprot_noncached_wc(PAGE_KERNEL_RO));
 
        spu_pdata(spu)->shadow = ioremap_prot(spu_pdata(spu)->shadow_addr,
-                                             sizeof(struct spe_shadow), shadow_flags);
+                                             sizeof(struct spe_shadow),
+                                             pgprot_noncached_wc(PAGE_KERNEL_RO));
        if (!spu_pdata(spu)->shadow) {
                pr_debug("%s:%d: ioremap shadow failed\n", __func__, __LINE__);
                goto fail_ioremap;
index 1c5c641075d2fd48d2f20fa8993875261ada4eb4..0536846db9b63ef08ea82fe76fb98ee40db0b8ea 100644 (file)
@@ -137,7 +137,7 @@ __io_writes_outs(outs, u64, q, __io_pbr(), __io_paw())
 
 #ifdef CONFIG_MMU
 #define arch_memremap_wb(addr, size)   \
-       ((__force void *)ioremap_prot((addr), (size), _PAGE_KERNEL))
+       ((__force void *)ioremap_prot((addr), (size), __pgprot(_PAGE_KERNEL)))
 #endif
 
 #endif /* _ASM_RISCV_IO_H */
index 2fd29695a788f25fe7392be5b4e844c223a0ba68..3f6d5a6789e8784a25b2fd7a63a9ea338374f38b 100644 (file)
@@ -305,7 +305,7 @@ void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size)
                }
        }
 
-       return ioremap_prot(phys, size, pgprot_val(prot));
+       return ioremap_prot(phys, size, prot);
 }
 
 #ifdef CONFIG_PCI
index fc9933a743d692196c322f77538d35b9a826a8ee..82f1043a4fc32a57f08203fa511e94eda26caa2e 100644 (file)
@@ -33,9 +33,9 @@ void unxlate_dev_mem_ptr(phys_addr_t phys, void *addr);
 #define _PAGE_IOREMAP pgprot_val(PAGE_KERNEL)
 
 #define ioremap_wc(addr, size)  \
-       ioremap_prot((addr), (size), pgprot_val(pgprot_writecombine(PAGE_KERNEL)))
+       ioremap_prot((addr), (size), pgprot_writecombine(PAGE_KERNEL))
 #define ioremap_wt(addr, size)  \
-       ioremap_prot((addr), (size), pgprot_val(pgprot_writethrough(PAGE_KERNEL)))
+       ioremap_prot((addr), (size), pgprot_writethrough(PAGE_KERNEL))
 
 static inline void __iomem *ioport_map(unsigned long port, unsigned int nr)
 {
index 88f72745fa59e16df26b1563de27594aac954a78..9fdcd733d40e8a371faa7c36671f64a98d587da7 100644 (file)
@@ -255,7 +255,7 @@ resource_size_t pcibios_align_resource(void *data, const struct resource *res,
 }
 
 void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
-                          unsigned long prot)
+                          pgprot_t prot)
 {
        /*
         * When PCI MIO instructions are unavailable the "physical" address
@@ -265,7 +265,7 @@ void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
        if (!static_branch_unlikely(&have_mio))
                return (void __iomem *)phys_addr;
 
-       return generic_ioremap_prot(phys_addr, size, __pgprot(prot));
+       return generic_ioremap_prot(phys_addr, size, prot);
 }
 EXPORT_SYMBOL(ioremap_prot);
 
index 2c44b94f82fb27407f0b18ac461074c7038539b9..1b3f43c3ac46b9297a09061eb80b0ed3a0dd6c02 100644 (file)
@@ -58,7 +58,7 @@ static int __init landisk_devices_setup(void)
        /* open I/O area window */
        paddrbase = virt_to_phys((void *)PA_AREA5_IO);
        prot = PAGE_KERNEL_PCC(1, _PAGE_PCC_IO16);
-       cf_ide_base = ioremap_prot(paddrbase, PAGE_SIZE, pgprot_val(prot));
+       cf_ide_base = ioremap_prot(paddrbase, PAGE_SIZE, prot);
        if (!cf_ide_base) {
                printk("allocate_cf_area : can't open CF I/O window!\n");
                return -ENOMEM;
index 20d01b430f2a811ce1f7ea7c9c94fbbfefa98f9b..e95bde207adb2d766632668c75cd4339b6c7b8c3 100644 (file)
@@ -53,7 +53,7 @@ static int __init lboxre2_devices_setup(void)
        paddrbase = virt_to_phys((void*)PA_AREA5_IO);
        psize = PAGE_SIZE;
        prot = PAGE_KERNEL_PCC(1, _PAGE_PCC_IO16);
-       cf0_io_base = (u32)ioremap_prot(paddrbase, psize, pgprot_val(prot));
+       cf0_io_base = (u32)ioremap_prot(paddrbase, psize, prot);
        if (!cf0_io_base) {
                printk(KERN_ERR "%s : can't open CF I/O window!\n" , __func__ );
                return -ENOMEM;
index 3901b6031ad565fc999967e1b53029b6e9eb01ab..5c9312f334d3dff9fbd6cab587fe9e97defa06f8 100644 (file)
@@ -75,7 +75,7 @@ static int __init sh03_devices_setup(void)
        /* open I/O area window */
        paddrbase = virt_to_phys((void *)PA_AREA5_IO);
        prot = PAGE_KERNEL_PCC(1, _PAGE_PCC_IO16);
-       cf_ide_base = ioremap_prot(paddrbase, PAGE_SIZE, pgprot_val(prot));
+       cf_ide_base = ioremap_prot(paddrbase, PAGE_SIZE, prot);
        if (!cf_ide_base) {
                printk("allocate_cf_area : can't open CF I/O window!\n");
                return -ENOMEM;
index cf5eab840d57965db6210bd4b0f8c3e9ef99d4d2..531ec49b878df9a569689740e35fc3d5656d76af 100644 (file)
@@ -299,7 +299,7 @@ unsigned long long poke_real_address_q(unsigned long long addr,
 #define _PAGE_IOREMAP pgprot_val(PAGE_KERNEL_NOCACHE)
 
 #define ioremap_cache(addr, size)  \
-       ioremap_prot((addr), (size), pgprot_val(PAGE_KERNEL))
+       ioremap_prot((addr), (size), PAGE_KERNEL)
 #endif /* CONFIG_MMU */
 
 #include <asm-generic/io.h>
index 33d20f34560fd5cb5d69dfe09ba08a16c9e0b496..5bbde53fb32d785607f8281f9e9cee16d16fc551 100644 (file)
@@ -73,10 +73,9 @@ __ioremap_29bit(phys_addr_t offset, unsigned long size, pgprot_t prot)
 #endif /* CONFIG_29BIT */
 
 void __iomem __ref *ioremap_prot(phys_addr_t phys_addr, size_t size,
-                                unsigned long prot)
+                                pgprot_t pgprot)
 {
        void __iomem *mapped;
-       pgprot_t pgprot = __pgprot(prot);
 
        mapped = __ioremap_trapped(phys_addr, size);
        if (mapped)
index ed580c7f9d0aaf7a3e3df81ddb92f0950b5e8d28..0794936ec1876bb431a1e2412df7bfd24f83f20f 100644 (file)
@@ -170,7 +170,7 @@ extern void __iomem *ioremap_uc(resource_size_t offset, unsigned long size);
 #define ioremap_uc ioremap_uc
 extern void __iomem *ioremap_cache(resource_size_t offset, unsigned long size);
 #define ioremap_cache ioremap_cache
-extern void __iomem *ioremap_prot(resource_size_t offset, unsigned long size, unsigned long prot_val);
+extern void __iomem *ioremap_prot(resource_size_t offset, unsigned long size,  pgprot_t prot);
 #define ioremap_prot ioremap_prot
 extern void __iomem *ioremap_encrypted(resource_size_t phys_addr, unsigned long size);
 #define ioremap_encrypted ioremap_encrypted
index 38ff7791a9c72bb1308a27c33b0152c71a5dd8ae..d501f0871aa50e619b6935e3fd41af16af973d5d 100644 (file)
@@ -440,10 +440,10 @@ void __iomem *ioremap_cache(resource_size_t phys_addr, unsigned long size)
 EXPORT_SYMBOL(ioremap_cache);
 
 void __iomem *ioremap_prot(resource_size_t phys_addr, unsigned long size,
-                               unsigned long prot_val)
+                          pgprot_t prot)
 {
        return __ioremap_caller(phys_addr, size,
-                               pgprot2cachemode(__pgprot(prot_val)),
+                               pgprot2cachemode(prot),
                                __builtin_return_address(0), false);
 }
 EXPORT_SYMBOL(ioremap_prot);
index 934e58399c8c0de9f0cd24c89e1d4053913b8f5f..7cdcc2deab3e701ba5880cb7de275c1d455c6418 100644 (file)
@@ -29,7 +29,7 @@
  * I/O memory mapping functions.
  */
 void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
-                          unsigned long prot);
+                          pgprot_t prot);
 #define ioremap_prot ioremap_prot
 #define iounmap iounmap
 
@@ -40,7 +40,7 @@ static inline void __iomem *ioremap(unsigned long offset, unsigned long size)
                return (void*)(offset-XCHAL_KIO_PADDR+XCHAL_KIO_BYPASS_VADDR);
        else
                return ioremap_prot(offset, size,
-                       pgprot_val(pgprot_noncached(PAGE_KERNEL)));
+                                   pgprot_noncached(PAGE_KERNEL));
 }
 #define ioremap ioremap
 
@@ -51,7 +51,7 @@ static inline void __iomem *ioremap_cache(unsigned long offset,
            && offset - XCHAL_KIO_PADDR < XCHAL_KIO_SIZE)
                return (void*)(offset-XCHAL_KIO_PADDR+XCHAL_KIO_CACHED_VADDR);
        else
-               return ioremap_prot(offset, size, pgprot_val(PAGE_KERNEL));
+               return ioremap_prot(offset, size, PAGE_KERNEL);
 
 }
 #define ioremap_cache ioremap_cache
index 8ca660b7ab49a27ff25a26e6dcf91caf674df312..26f238fa9d0df498f0da0163804de72b91746b66 100644 (file)
 #include <asm/io.h>
 
 void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
-                          unsigned long prot)
+                          pgprot_t prot)
 {
        unsigned long pfn = __phys_to_pfn((phys_addr));
        WARN_ON(pfn_valid(pfn));
 
-       return generic_ioremap_prot(phys_addr, size, __pgprot(prot));
+       return generic_ioremap_prot(phys_addr, size, prot);
 }
 EXPORT_SYMBOL(ioremap_prot);
 
index a5cbbf3e26ec7d06f7e67ee9731021031b39aa13..402020b2342343d4fa2e17a7ac784397e1cfd73c 100644 (file)
@@ -1111,7 +1111,7 @@ void __iomem *generic_ioremap_prot(phys_addr_t phys_addr, size_t size,
                                   pgprot_t prot);
 
 void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
-                          unsigned long prot);
+                          pgprot_t prot);
 void iounmap(volatile void __iomem *addr);
 void generic_iounmap(volatile void __iomem *addr);
 
@@ -1120,7 +1120,7 @@ void generic_iounmap(volatile void __iomem *addr);
 static inline void __iomem *ioremap(phys_addr_t addr, size_t size)
 {
        /* _PAGE_IOREMAP needs to be supplied by the architecture */
-       return ioremap_prot(addr, size, _PAGE_IOREMAP);
+       return ioremap_prot(addr, size, __pgprot(_PAGE_IOREMAP));
 }
 #endif
 #endif /* !CONFIG_MMU || CONFIG_GENERIC_IOREMAP */
index 3e049dfb28bd0dff3dae96e5479148b2129a2071..c36dd9f62fd5a64744e320d48efc0e25f3877e0f 100644 (file)
@@ -50,9 +50,9 @@ void __iomem *generic_ioremap_prot(phys_addr_t phys_addr, size_t size,
 
 #ifndef ioremap_prot
 void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
-                          unsigned long prot)
+                          pgprot_t prot)
 {
-       return generic_ioremap_prot(phys_addr, size, __pgprot(prot));
+       return generic_ioremap_prot(phys_addr, size, prot);
 }
 EXPORT_SYMBOL(ioremap_prot);
 #endif
index b26cdca2628c155ef700a5fc6dc82fd18ad4f01e..26ba5a238d4502ce0a51da2847ccc99dae4c5fce 100644 (file)
@@ -6774,7 +6774,7 @@ int generic_access_phys(struct vm_area_struct *vma, unsigned long addr,
                        void *buf, int len, int write)
 {
        resource_size_t phys_addr;
-       unsigned long prot = 0;
+       pgprot_t prot = __pgprot(0);
        void __iomem *maddr;
        int offset = offset_in_page(addr);
        int ret = -EINVAL;
@@ -6784,7 +6784,7 @@ int generic_access_phys(struct vm_area_struct *vma, unsigned long addr,
 retry:
        if (follow_pfnmap_start(&args))
                return -EINVAL;
-       prot = pgprot_val(args.pgprot);
+       prot = args.pgprot;
        phys_addr = (resource_size_t)args.pfn << PAGE_SHIFT;
        writable = args.writable;
        follow_pfnmap_end(&args);
@@ -6799,7 +6799,7 @@ retry:
        if (follow_pfnmap_start(&args))
                goto out_unmap;
 
-       if ((prot != pgprot_val(args.pgprot)) ||
+       if ((pgprot_val(prot) != pgprot_val(args.pgprot)) ||
            (phys_addr != (args.pfn << PAGE_SHIFT)) ||
            (writable != args.writable)) {
                follow_pfnmap_end(&args);