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

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'asm-generic-io.h-cleanup' into asm-generic

MIPS is the last architecture that is yet to start using asm-generic/io.h,
so Baoquan He converts it, which allows the other changes to remove code
duplication, and it will allow further cleanups in the future.

* asm-generic-io.h-cleanup:
asm/io: remove unnecessary xlate_dev_mem_ptr() and unxlate_dev_mem_ptr()
mips: io: remove duplicated codes
arch/*/io.h: remove ioremap_uc in some architectures
mips: add <asm-generic/io.h> including

+81 -128
+5 -4
Documentation/driver-api/device-io.rst
··· 408 408 ioremap_uc() 409 409 ------------ 410 410 411 - ioremap_uc() behaves like ioremap() except that on the x86 architecture without 412 - 'PAT' mode, it marks memory as uncached even when the MTRR has designated 413 - it as cacheable, see Documentation/arch/x86/pat.rst. 411 + ioremap_uc() is only meaningful on old x86-32 systems with the PAT extension, 412 + and on ia64 with its slightly unconventional ioremap() behavior, everywhere 413 + elss ioremap_uc() defaults to return NULL. 414 414 415 - Portable drivers should avoid the use of ioremap_uc(). 415 + 416 + Portable drivers should avoid the use of ioremap_uc(), use ioremap() instead. 416 417 417 418 ioremap_cache() 418 419 ---------------
-7
arch/alpha/include/asm/io.h
··· 308 308 } 309 309 310 310 #define ioremap_wc ioremap 311 - #define ioremap_uc ioremap 312 311 313 312 static inline void iounmap(volatile void __iomem *addr) 314 313 { ··· 649 650 # endif 650 651 #endif 651 652 #define RTC_ALWAYS_BCD 0 652 - 653 - /* 654 - * Convert a physical pointer to a virtual kernel pointer for /dev/mem 655 - * access 656 - */ 657 - #define xlate_dev_mem_ptr(p) __va(p) 658 653 659 654 /* 660 655 * These get provided from <asm-generic/iomap.h> since alpha does not
-6
arch/arm/include/asm/io.h
··· 407 407 #define pci_iounmap pci_iounmap 408 408 extern void pci_iounmap(struct pci_dev *dev, void __iomem *addr); 409 409 410 - /* 411 - * Convert a physical pointer to a virtual kernel pointer for /dev/mem 412 - * access 413 - */ 414 - #define xlate_dev_mem_ptr(p) __va(p) 415 - 416 410 #include <asm-generic/io.h> 417 411 418 412 #ifdef CONFIG_MMU
-9
arch/hexagon/include/asm/io.h
··· 59 59 } 60 60 61 61 /* 62 - * convert a physical pointer to a virtual kernel pointer for 63 - * /dev/mem access. 64 - */ 65 - #define xlate_dev_mem_ptr(p) __va(p) 66 - 67 - /* 68 62 * IO port access primitives. Hexagon doesn't have special IO access 69 63 * instructions; all I/O is memory mapped. 70 64 * ··· 167 173 */ 168 174 #define _PAGE_IOREMAP (_PAGE_PRESENT | _PAGE_READ | _PAGE_WRITE | \ 169 175 (__HEXAGON_C_DEV << 6)) 170 - 171 - #define ioremap_uc(addr, size) ioremap((addr), (size)) 172 - 173 176 174 177 #define __raw_writel writel 175 178
-6
arch/m68k/include/asm/io_mm.h
··· 389 389 390 390 #define __ARCH_HAS_NO_PAGE_ZERO_MAPPED 1 391 391 392 - /* 393 - * Convert a physical pointer to a virtual kernel pointer for /dev/mem 394 - * access 395 - */ 396 - #define xlate_dev_mem_ptr(p) __va(p) 397 - 398 392 #define readb_relaxed(addr) readb(addr) 399 393 #define readw_relaxed(addr) readw(addr) 400 394 #define readl_relaxed(addr) readl(addr)
-1
arch/m68k/include/asm/kmap.h
··· 25 25 return __ioremap(physaddr, size, IOMAP_NOCACHE_SER); 26 26 } 27 27 28 - #define ioremap_uc ioremap 29 28 #define ioremap_wt ioremap_wt 30 29 static inline void __iomem *ioremap_wt(unsigned long physaddr, 31 30 unsigned long size)
+69 -57
arch/mips/include/asm/io.h
··· 13 13 #define _ASM_IO_H 14 14 15 15 #include <linux/compiler.h> 16 - #include <linux/kernel.h> 17 16 #include <linux/types.h> 18 17 #include <linux/irqflags.h> 19 18 ··· 24 25 #include <asm/cpu-features.h> 25 26 #include <asm/page.h> 26 27 #include <asm/pgtable-bits.h> 27 - #include <asm/processor.h> 28 28 #include <asm/string.h> 29 29 #include <mangle-port.h> 30 30 ··· 38 40 # define __raw_ioswabl(a, x) (x) 39 41 # define __raw_ioswabq(a, x) (x) 40 42 # define ____raw_ioswabq(a, x) (x) 43 + 44 + # define _ioswabb ioswabb 45 + # define _ioswabw ioswabw 46 + # define _ioswabl ioswabl 47 + # define _ioswabq ioswabq 41 48 42 49 # define __relaxed_ioswabb ioswabb 43 50 # define __relaxed_ioswabw ioswabw ··· 118 115 } 119 116 120 117 /* 121 - * phys_to_virt - map physical address to virtual 122 - * @address: address to remap 123 - * 124 - * The returned virtual address is a current CPU mapping for 125 - * the memory address given. It is only valid to use this function on 126 - * addresses that have a kernel mapping 127 - * 128 - * This function does not handle bus mappings for DMA transfers. In 129 - * almost all conceivable cases a device driver should not be using 130 - * this function 131 - */ 132 - static inline void * phys_to_virt(unsigned long address) 133 - { 134 - return __va(address); 135 - } 136 - 137 - /* 138 118 * ISA I/O bus memory addresses are 1:1 with the physical address. 139 119 */ 140 120 static inline unsigned long isa_virt_to_bus(volatile void *address) 141 121 { 142 122 return virt_to_phys(address); 143 - } 144 - 145 - static inline void *isa_bus_to_virt(unsigned long address) 146 - { 147 - return phys_to_virt(address); 148 123 } 149 124 150 125 /* ··· 147 166 */ 148 167 #define ioremap(offset, size) \ 149 168 ioremap_prot((offset), (size), _CACHE_UNCACHED) 150 - #define ioremap_uc ioremap 151 169 152 170 /* 153 171 * ioremap_cache - map bus memory into CPU space ··· 276 296 return pfx##ioswab##bwlq(__mem, __val); \ 277 297 } 278 298 279 - #define __BUILD_IOPORT_SINGLE(pfx, bwlq, type, barrier, relax, p) \ 299 + #define __BUILD_IOPORT_SINGLE(pfx, bwlq, type, barrier, relax) \ 280 300 \ 281 - static inline void pfx##out##bwlq##p(type val, unsigned long port) \ 301 + static inline void pfx##out##bwlq(type val, unsigned long port) \ 282 302 { \ 283 303 volatile type *__addr; \ 284 304 type __val; \ ··· 298 318 *__addr = __val; \ 299 319 } \ 300 320 \ 301 - static inline type pfx##in##bwlq##p(unsigned long port) \ 321 + static inline type pfx##in##bwlq(unsigned long port) \ 302 322 { \ 303 323 volatile type *__addr; \ 304 324 type __val; \ ··· 340 360 #endif 341 361 342 362 #define __BUILD_IOPORT_PFX(bus, bwlq, type) \ 343 - __BUILD_IOPORT_SINGLE(bus, bwlq, type, 1, 0,) \ 344 - __BUILD_IOPORT_SINGLE(bus, bwlq, type, 1, 0, _p) 363 + __BUILD_IOPORT_SINGLE(bus, bwlq, type, 1, 0) 345 364 346 365 #define BUILDIO_IOPORT(bwlq, type) \ 347 - __BUILD_IOPORT_PFX(, bwlq, type) \ 366 + __BUILD_IOPORT_PFX(_, bwlq, type) \ 348 367 __BUILD_IOPORT_PFX(__mem_, bwlq, type) 349 368 350 369 BUILDIO_IOPORT(b, u8) ··· 390 411 __raw_writel(cpu_to_be32((val)), (__force unsigned *)(addr)) 391 412 #define writeq_be(val, addr) \ 392 413 __raw_writeq(cpu_to_be64((val)), (__force unsigned *)(addr)) 393 - 394 - /* 395 - * Some code tests for these symbols 396 - */ 397 - #ifdef CONFIG_64BIT 398 - #define readq readq 399 - #define writeq writeq 400 - #endif 401 414 402 415 #define __BUILD_MEMORY_STRING(bwlq, type) \ 403 416 \ ··· 451 480 BUILDSTRING(q, u64) 452 481 #endif 453 482 454 - static inline void memset_io(volatile void __iomem *addr, unsigned char val, int count) 455 - { 456 - memset((void __force *) addr, val, count); 457 - } 458 - static inline void memcpy_fromio(void *dst, const volatile void __iomem *src, int count) 459 - { 460 - memcpy(dst, (void __force *) src, count); 461 - } 462 - static inline void memcpy_toio(volatile void __iomem *dst, const void *src, int count) 463 - { 464 - memcpy((void __force *) dst, src, count); 465 - } 466 483 467 484 /* 468 485 * The caches on some architectures aren't dma-coherent and have need to ··· 507 548 #define csr_out32(v, a) (*(volatile u32 *)((unsigned long)(a) + __CSR_32_ADJUST) = (v)) 508 549 #define csr_in32(a) (*(volatile u32 *)((unsigned long)(a) + __CSR_32_ADJUST)) 509 550 510 - /* 511 - * Convert a physical pointer to a virtual kernel pointer for /dev/mem 512 - * access 513 - */ 514 - #define xlate_dev_mem_ptr(p) __va(p) 515 - #define unxlate_dev_mem_ptr(p, v) do { } while (0) 551 + #define __raw_readb __raw_readb 552 + #define __raw_readw __raw_readw 553 + #define __raw_readl __raw_readl 554 + #ifdef CONFIG_64BIT 555 + #define __raw_readq __raw_readq 556 + #endif 557 + #define __raw_writeb __raw_writeb 558 + #define __raw_writew __raw_writew 559 + #define __raw_writel __raw_writel 560 + #ifdef CONFIG_64BIT 561 + #define __raw_writeq __raw_writeq 562 + #endif 563 + 564 + #define readb readb 565 + #define readw readw 566 + #define readl readl 567 + #ifdef CONFIG_64BIT 568 + #define readq readq 569 + #endif 570 + #define writeb writeb 571 + #define writew writew 572 + #define writel writel 573 + #ifdef CONFIG_64BIT 574 + #define writeq writeq 575 + #endif 576 + 577 + #define readsb readsb 578 + #define readsw readsw 579 + #define readsl readsl 580 + #ifdef CONFIG_64BIT 581 + #define readsq readsq 582 + #endif 583 + #define writesb writesb 584 + #define writesw writesw 585 + #define writesl writesl 586 + #ifdef CONFIG_64BIT 587 + #define writesq writesq 588 + #endif 589 + 590 + #define _inb _inb 591 + #define _inw _inw 592 + #define _inl _inl 593 + #define insb insb 594 + #define insw insw 595 + #define insl insl 596 + 597 + #define _outb _outb 598 + #define _outw _outw 599 + #define _outl _outl 600 + #define outsb outsb 601 + #define outsw outsw 602 + #define outsl outsl 516 603 517 604 void __ioread64_copy(void *to, const void __iomem *from, size_t count); 605 + 606 + #include <asm-generic/io.h> 607 + 608 + static inline void *isa_bus_to_virt(unsigned long address) 609 + { 610 + return phys_to_virt(address); 611 + } 518 612 519 613 #endif /* _ASM_IO_H */
+2 -2
arch/mips/include/asm/mmiowb.h
··· 2 2 #ifndef _ASM_MMIOWB_H 3 3 #define _ASM_MMIOWB_H 4 4 5 - #include <asm/io.h> 5 + #include <asm/barrier.h> 6 6 7 - #define mmiowb() iobarrier_w() 7 + #define mmiowb() wmb() 8 8 9 9 #include <asm-generic/mmiowb.h> 10 10
-2
arch/mips/include/asm/smp-ops.h
··· 13 13 14 14 #include <linux/errno.h> 15 15 16 - #include <asm/mips-cps.h> 17 - 18 16 #ifdef CONFIG_SMP 19 17 20 18 #include <linux/cpumask.h>
+1 -3
arch/mips/include/asm/smp.h
··· 11 11 #ifndef __ASM_SMP_H 12 12 #define __ASM_SMP_H 13 13 14 - #include <linux/bitops.h> 14 + #include <linux/compiler.h> 15 15 #include <linux/linkage.h> 16 - #include <linux/smp.h> 17 16 #include <linux/threads.h> 18 17 #include <linux/cpumask.h> 19 18 20 - #include <linux/atomic.h> 21 19 #include <asm/smp-ops.h> 22 20 23 21 extern int smp_num_siblings;
+1
arch/mips/kernel/setup.c
··· 42 42 #include <asm/sections.h> 43 43 #include <asm/setup.h> 44 44 #include <asm/smp-ops.h> 45 + #include <asm/mips-cps.h> 45 46 #include <asm/prom.h> 46 47 #include <asm/fw/fw.h> 47 48
+3
arch/mips/pci/pci-ip27.c
··· 7 7 * Copyright (C) 1999, 2000, 04 Ralf Baechle (ralf@linux-mips.org) 8 8 * Copyright (C) 1999, 2000 Silicon Graphics, Inc. 9 9 */ 10 + 11 + #include <linux/io.h> 12 + 10 13 #include <asm/sn/addrs.h> 11 14 #include <asm/sn/types.h> 12 15 #include <asm/sn/klconfig.h>
-8
arch/parisc/include/asm/io.h
··· 132 132 133 133 #define ioremap_wc(addr, size) \ 134 134 ioremap_prot((addr), (size), _PAGE_IOREMAP) 135 - #define ioremap_uc(addr, size) \ 136 - ioremap_prot((addr), (size), _PAGE_IOREMAP) 137 135 138 136 #define pci_iounmap pci_iounmap 139 137 ··· 264 266 #define iowrite8_rep iowrite8_rep 265 267 #define iowrite16_rep iowrite16_rep 266 268 #define iowrite32_rep iowrite32_rep 267 - 268 - /* 269 - * Convert a physical pointer to a virtual kernel pointer for /dev/mem 270 - * access 271 - */ 272 - #define xlate_dev_mem_ptr(p) __va(p) 273 269 274 270 extern int devmem_is_allowed(unsigned long pfn); 275 271
-7
arch/powerpc/include/asm/io.h
··· 710 710 #define memcpy_toio memcpy_toio 711 711 712 712 /* 713 - * Convert a physical pointer to a virtual kernel pointer for /dev/mem 714 - * access 715 - */ 716 - #define xlate_dev_mem_ptr(p) __va(p) 717 - 718 - /* 719 713 * We don't do relaxed operations yet, at least not with this semantic 720 714 */ 721 715 #define readb_relaxed(addr) readb(addr) ··· 894 900 #endif 895 901 896 902 void __iomem *ioremap_coherent(phys_addr_t address, unsigned long size); 897 - #define ioremap_uc(addr, size) ioremap((addr), (size)) 898 903 #define ioremap_cache(addr, size) \ 899 904 ioremap_prot((addr), (size), pgprot_val(PAGE_KERNEL)) 900 905
-9
arch/sh/include/asm/io.h
··· 302 302 ioremap_prot((addr), (size), pgprot_val(PAGE_KERNEL)) 303 303 #endif /* CONFIG_MMU */ 304 304 305 - #define ioremap_uc ioremap 306 - 307 - /* 308 - * Convert a physical pointer to a virtual kernel pointer for /dev/mem 309 - * access 310 - */ 311 - #define xlate_dev_mem_ptr(p) __va(p) 312 - #define unxlate_dev_mem_ptr(p, v) do { } while (0) 313 - 314 305 #include <asm-generic/io.h> 315 306 316 307 #define ARCH_HAS_VALID_PHYS_ADDR_RANGE
-7
arch/sparc/include/asm/io_64.h
··· 423 423 return (void __iomem *)offset; 424 424 } 425 425 426 - #define ioremap_uc(X,Y) ioremap((X),(Y)) 427 426 #define ioremap_wc(X,Y) ioremap((X),(Y)) 428 427 #define ioremap_wt(X,Y) ioremap((X),(Y)) 429 428 static inline void __iomem *ioremap_np(unsigned long offset, unsigned long size) ··· 468 469 } 469 470 struct device; 470 471 void sbus_set_sbus64(struct device *, int); 471 - 472 - /* 473 - * Convert a physical pointer to a virtual kernel pointer for /dev/mem 474 - * access 475 - */ 476 - #define xlate_dev_mem_ptr(p) __va(p) 477 472 478 473 #endif 479 474