Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ARM: io: convert ioremap*() to functions

Convert the ioremap*() preprocessor macros to real functions, moving
them out of line. This allows us to kill off __arm_ioremap(), and
__arm_iounmap() helpers, and remove __arm_ioremap_pfn_caller() from
global view.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

+67 -39
+13 -11
arch/arm/include/asm/io.h
··· 140 140 * The _caller variety takes a __builtin_return_address(0) value for 141 141 * /proc/vmalloc to use - and should only be used in non-inline functions. 142 142 */ 143 - extern void __iomem *__arm_ioremap_pfn_caller(unsigned long, unsigned long, 144 - size_t, unsigned int, void *); 145 143 extern void __iomem *__arm_ioremap_caller(phys_addr_t, size_t, unsigned int, 146 144 void *); 147 - 148 145 extern void __iomem *__arm_ioremap_pfn(unsigned long, unsigned long, size_t, unsigned int); 149 - extern void __iomem *__arm_ioremap(phys_addr_t, size_t, unsigned int); 150 146 extern void __iomem *__arm_ioremap_exec(phys_addr_t, size_t, bool cached); 151 147 extern void __iounmap(volatile void __iomem *addr); 152 - extern void __arm_iounmap(volatile void __iomem *addr); 153 148 154 149 extern void __iomem * (*arch_ioremap_caller)(phys_addr_t, size_t, 155 150 unsigned int, void *); ··· 385 390 * Eg, a CPU not implementing read allocate but implementing write allocate 386 391 * will provide a write allocate mapping instead. 387 392 */ 388 - #define ioremap(cookie,size) __arm_ioremap((cookie), (size), MT_DEVICE) 389 - #define ioremap_nocache(cookie,size) __arm_ioremap((cookie), (size), MT_DEVICE) 390 - #define ioremap_cache(cookie,size) __arm_ioremap((cookie), (size), MT_DEVICE_CACHED) 391 - #define ioremap_wc(cookie,size) __arm_ioremap((cookie), (size), MT_DEVICE_WC) 392 - #define ioremap_wt(cookie,size) __arm_ioremap((cookie), (size), MT_DEVICE_WC) 393 - #define iounmap __arm_iounmap 393 + void __iomem *ioremap(resource_size_t res_cookie, size_t size); 394 + #define ioremap ioremap 395 + #define ioremap_nocache ioremap 396 + 397 + void __iomem *ioremap_cache(resource_size_t res_cookie, size_t size); 398 + #define ioremap_cache ioremap_cache 399 + 400 + void __iomem *ioremap_wc(resource_size_t res_cookie, size_t size); 401 + #define ioremap_wc ioremap_wc 402 + #define ioremap_wt ioremap_wc 403 + 404 + void iounmap(volatile void __iomem *iomem_cookie); 405 + #define iounmap iounmap 394 406 395 407 /* 396 408 * io{read,write}{16,32}be() macros
+23 -10
arch/arm/mm/ioremap.c
··· 255 255 } 256 256 #endif 257 257 258 - void __iomem * __arm_ioremap_pfn_caller(unsigned long pfn, 258 + static void __iomem * __arm_ioremap_pfn_caller(unsigned long pfn, 259 259 unsigned long offset, size_t size, unsigned int mtype, void *caller) 260 260 { 261 261 const struct mem_type *type; ··· 363 363 unsigned int mtype) 364 364 { 365 365 return __arm_ioremap_pfn_caller(pfn, offset, size, mtype, 366 - __builtin_return_address(0)); 366 + __builtin_return_address(0)); 367 367 } 368 368 EXPORT_SYMBOL(__arm_ioremap_pfn); 369 369 ··· 371 371 unsigned int, void *) = 372 372 __arm_ioremap_caller; 373 373 374 - void __iomem * 375 - __arm_ioremap(phys_addr_t phys_addr, size_t size, unsigned int mtype) 374 + void __iomem *ioremap(resource_size_t res_cookie, size_t size) 376 375 { 377 - return arch_ioremap_caller(phys_addr, size, mtype, 378 - __builtin_return_address(0)); 376 + return arch_ioremap_caller(res_cookie, size, MT_DEVICE, 377 + __builtin_return_address(0)); 379 378 } 380 - EXPORT_SYMBOL(__arm_ioremap); 379 + EXPORT_SYMBOL(ioremap); 380 + 381 + void __iomem *ioremap_cache(resource_size_t res_cookie, size_t size) 382 + { 383 + return arch_ioremap_caller(res_cookie, size, MT_DEVICE_CACHED, 384 + __builtin_return_address(0)); 385 + } 386 + EXPORT_SYMBOL(ioremap_cache); 387 + 388 + void __iomem *ioremap_wc(resource_size_t res_cookie, size_t size) 389 + { 390 + return arch_ioremap_caller(res_cookie, size, MT_DEVICE_WC, 391 + __builtin_return_address(0)); 392 + } 393 + EXPORT_SYMBOL(ioremap_wc); 381 394 382 395 /* 383 396 * Remap an arbitrary physical address space into the kernel virtual ··· 444 431 445 432 void (*arch_iounmap)(volatile void __iomem *) = __iounmap; 446 433 447 - void __arm_iounmap(volatile void __iomem *io_addr) 434 + void iounmap(volatile void __iomem *cookie) 448 435 { 449 - arch_iounmap(io_addr); 436 + arch_iounmap(cookie); 450 437 } 451 - EXPORT_SYMBOL(__arm_iounmap); 438 + EXPORT_SYMBOL(iounmap); 452 439 453 440 #ifdef CONFIG_PCI 454 441 static int pci_ioremap_mem_type = MT_DEVICE;
+31 -18
arch/arm/mm/nommu.c
··· 351 351 } 352 352 EXPORT_SYMBOL(__arm_ioremap_pfn); 353 353 354 - void __iomem *__arm_ioremap_pfn_caller(unsigned long pfn, unsigned long offset, 355 - size_t size, unsigned int mtype, void *caller) 356 - { 357 - return __arm_ioremap_pfn(pfn, offset, size, mtype); 358 - } 359 - 360 - void __iomem *__arm_ioremap(phys_addr_t phys_addr, size_t size, 361 - unsigned int mtype) 362 - { 363 - return (void __iomem *)phys_addr; 364 - } 365 - EXPORT_SYMBOL(__arm_ioremap); 366 - 367 - void __iomem * (*arch_ioremap_caller)(phys_addr_t, size_t, unsigned int, void *); 368 - 369 354 void __iomem *__arm_ioremap_caller(phys_addr_t phys_addr, size_t size, 370 355 unsigned int mtype, void *caller) 371 356 { 372 - return __arm_ioremap(phys_addr, size, mtype); 357 + return (void __iomem *)phys_addr; 373 358 } 359 + 360 + void __iomem * (*arch_ioremap_caller)(phys_addr_t, size_t, unsigned int, void *); 361 + 362 + void __iomem *ioremap(resource_size_t res_cookie, size_t size) 363 + { 364 + return __arm_ioremap_caller(res_cookie, size, MT_DEVICE, 365 + __builtin_return_address(0)); 366 + } 367 + EXPORT_SYMBOL(ioremap); 368 + 369 + void __iomem *ioremap_cache(resource_size_t res_cookie, size_t size) 370 + { 371 + return __arm_ioremap_caller(res_cookie, size, MT_DEVICE_CACHED, 372 + __builtin_return_address(0)); 373 + } 374 + EXPORT_SYMBOL(ioremap_cache); 375 + 376 + void __iomem *ioremap_wc(resource_size_t res_cookie, size_t size) 377 + { 378 + return __arm_ioremap_caller(res_cookie, size, MT_DEVICE_WC, 379 + __builtin_return_address(0)); 380 + } 381 + EXPORT_SYMBOL(ioremap_wc); 382 + 383 + void __iounmap(volatile void __iomem *addr) 384 + { 385 + } 386 + EXPORT_SYMBOL(__iounmap); 374 387 375 388 void (*arch_iounmap)(volatile void __iomem *); 376 389 377 - void __arm_iounmap(volatile void __iomem *addr) 390 + void iounmap(volatile void __iomem *addr) 378 391 { 379 392 } 380 - EXPORT_SYMBOL(__arm_iounmap); 393 + EXPORT_SYMBOL(iounmap);