Skip to content

Commit

Permalink
remove ioremap_nocache and devm_ioremap_nocache
Browse files Browse the repository at this point in the history
ioremap has provided non-cached semantics by default since the Linux 2.6
days, so remove the additional ioremap_nocache interface.

Signed-off-by: Christoph Hellwig <[email protected]>
Acked-by: Arnd Bergmann <[email protected]>
  • Loading branch information
Christoph Hellwig committed Jan 6, 2020
1 parent d23cc63 commit 4bdc0d6
Show file tree
Hide file tree
Showing 368 changed files with 508 additions and 581 deletions.
1 change: 0 additions & 1 deletion Documentation/driver-api/driver-model/devres.rst
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,6 @@ IOMAP
devm_ioport_map()
devm_ioport_unmap()
devm_ioremap()
devm_ioremap_nocache()
devm_ioremap_uc()
devm_ioremap_wc()
devm_ioremap_resource() : checks resource, requests memory region, ioremaps
Expand Down
2 changes: 1 addition & 1 deletion Documentation/sound/kernel-api/writing-an-alsa-driver.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1058,7 +1058,7 @@ and the allocation would be like below:
return err;
}
chip->iobase_phys = pci_resource_start(pci, 0);
chip->iobase_virt = ioremap_nocache(chip->iobase_phys,
chip->iobase_virt = ioremap(chip->iobase_phys,
pci_resource_len(pci, 0));

and the corresponding destructor would be:
Expand Down
2 changes: 0 additions & 2 deletions Documentation/x86/pat.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ address range to avoid any aliasing.
+------------------------+----------+--------------+------------------+
| ioremap_uc | -- | UC | UC |
+------------------------+----------+--------------+------------------+
| ioremap_nocache | -- | UC- | UC- |
+------------------------+----------+--------------+------------------+
| ioremap_wc | -- | -- | WC |
+------------------------+----------+--------------+------------------+
| ioremap_wt | -- | -- | WT |
Expand Down
10 changes: 2 additions & 8 deletions arch/alpha/include/asm/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -283,14 +283,8 @@ static inline void __iomem *ioremap(unsigned long port, unsigned long size)
return IO_CONCAT(__IO_PREFIX,ioremap) (port, size);
}

static inline void __iomem * ioremap_nocache(unsigned long offset,
unsigned long size)
{
return ioremap(offset, size);
}

#define ioremap_wc ioremap_nocache
#define ioremap_uc ioremap_nocache
#define ioremap_wc ioremap
#define ioremap_uc ioremap

static inline void iounmap(volatile void __iomem *addr)
{
Expand Down
8 changes: 0 additions & 8 deletions arch/arm/include/asm/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,6 @@ static inline void memcpy_toio(volatile void __iomem *to, const void *from,
*
* Function Memory type Cacheability Cache hint
* ioremap() Device n/a n/a
* ioremap_nocache() Device n/a n/a
* ioremap_cache() Normal Writeback Read allocate
* ioremap_wc() Normal Non-cacheable n/a
* ioremap_wt() Normal Non-cacheable n/a
Expand All @@ -368,13 +367,6 @@ static inline void memcpy_toio(volatile void __iomem *to, const void *from,
* - unaligned accesses are "unpredictable"
* - writes may be delayed before they hit the endpoint device
*
* ioremap_nocache() is the same as ioremap() as there are too many device
* drivers using this for device registers, and documentation which tells
* people to use it for such for this to be any different. This is not a
* safe fallback for memory-like mappings, or memory regions where the
* compiler may generate unaligned accesses - eg, via inlining its own
* memcpy.
*
* All normal memory mappings have the following properties:
* - reads can be repeated with no side effects
* - repeated reads return the last value written
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/mach-bcm/platsmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ static int nsp_write_lut(unsigned int cpu)
if (!secondary_boot_addr)
return -EINVAL;

sku_rom_lut = ioremap_nocache((phys_addr_t)secondary_boot_addr,
sku_rom_lut = ioremap((phys_addr_t)secondary_boot_addr,
sizeof(phys_addr_t));
if (!sku_rom_lut) {
pr_warn("unable to ioremap SKU-ROM LUT register for cpu %u\n", cpu);
Expand Down Expand Up @@ -174,7 +174,7 @@ static int kona_boot_secondary(unsigned int cpu, struct task_struct *idle)
if (!secondary_boot_addr)
return -EINVAL;

boot_reg = ioremap_nocache((phys_addr_t)secondary_boot_addr,
boot_reg = ioremap((phys_addr_t)secondary_boot_addr,
sizeof(phys_addr_t));
if (!boot_reg) {
pr_err("unable to map boot register for cpu %u\n", cpu_id);
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-davinci/devices.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ void __iomem *davinci_sysmod_base;

void davinci_map_sysmod(void)
{
davinci_sysmod_base = ioremap_nocache(DAVINCI_SYSTEM_MODULE_BASE,
davinci_sysmod_base = ioremap(DAVINCI_SYSTEM_MODULE_BASE,
0x800);
/*
* Throw a bug since a lot of board initialization code depends
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-pxa/magician.c
Original file line number Diff line number Diff line change
Expand Up @@ -1008,7 +1008,7 @@ static void __init magician_init(void)
pxa_set_udc_info(&magician_udc_info);

/* Check LCD type we have */
cpld = ioremap_nocache(PXA_CS3_PHYS, 0x1000);
cpld = ioremap(PXA_CS3_PHYS, 0x1000);
if (cpld) {
u8 board_id = __raw_readb(cpld + 0x14);

Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-shmobile/platsmp-apmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ static void apmu_init_cpu(struct resource *res, int cpu, int bit)
if ((cpu >= ARRAY_SIZE(apmu_cpus)) || apmu_cpus[cpu].iomem)
return;

apmu_cpus[cpu].iomem = ioremap_nocache(res->start, resource_size(res));
apmu_cpus[cpu].iomem = ioremap(res->start, resource_size(res));
apmu_cpus[cpu].bit = bit;

pr_debug("apmu ioremap %d %d %pr\n", cpu, bit, res);
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-shmobile/pm-rcar-gen2.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ void __init rcar_gen2_pm_init(void)
iounmap(p);

/* setup reset vectors */
p = ioremap_nocache(RST, 0x63);
p = ioremap(RST, 0x63);
bar = phys_to_sbar(res.start);
if (has_a15) {
writel_relaxed(bar, p + CA15BAR);
Expand Down
8 changes: 4 additions & 4 deletions arch/arm/mach-shmobile/setup-r8a7740.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ static void __init r8a7740_meram_workaround(void)
{
void __iomem *reg;

reg = ioremap_nocache(MEBUFCNTR, 4);
reg = ioremap(MEBUFCNTR, 4);
if (reg) {
iowrite32(0x01600164, reg);
iounmap(reg);
Expand All @@ -37,9 +37,9 @@ static void __init r8a7740_meram_workaround(void)

static void __init r8a7740_init_irq_of(void)
{
void __iomem *intc_prio_base = ioremap_nocache(0xe6900010, 0x10);
void __iomem *intc_msk_base = ioremap_nocache(0xe6900040, 0x10);
void __iomem *pfc_inta_ctrl = ioremap_nocache(0xe605807c, 0x4);
void __iomem *intc_prio_base = ioremap(0xe6900010, 0x10);
void __iomem *intc_msk_base = ioremap(0xe6900040, 0x10);
void __iomem *pfc_inta_ctrl = ioremap(0xe605807c, 0x4);

irqchip_init();

Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-shmobile/setup-r8a7778.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

static void __init r8a7778_init_irq_dt(void)
{
void __iomem *base = ioremap_nocache(0xfe700000, 0x00100000);
void __iomem *base = ioremap(0xfe700000, 0x00100000);

BUG_ON(!base);

Expand Down
1 change: 0 additions & 1 deletion arch/hexagon/include/asm/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ static inline void writel(u32 data, volatile void __iomem *addr)
#define writel_relaxed __raw_writel

void __iomem *ioremap(unsigned long phys_addr, unsigned long size);
#define ioremap_nocache ioremap
#define ioremap_uc(X, Y) ioremap((X), (Y))


Expand Down
2 changes: 1 addition & 1 deletion arch/ia64/include/asm/vga.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
extern unsigned long vga_console_iobase;
extern unsigned long vga_console_membase;

#define VGA_MAP_MEM(x,s) ((unsigned long) ioremap_nocache(vga_console_membase + (x), s))
#define VGA_MAP_MEM(x,s) ((unsigned long) ioremap(vga_console_membase + (x), s))

#define vga_readb(x) (*(x))
#define vga_writeb(x,y) (*(y) = (x))
Expand Down
8 changes: 4 additions & 4 deletions arch/ia64/kernel/cyclone.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ int __init init_cyclone_clock(void)

/* find base address */
offset = (CYCLONE_CBAR_ADDR);
reg = ioremap_nocache(offset, sizeof(u64));
reg = ioremap(offset, sizeof(u64));
if(!reg){
printk(KERN_ERR "Summit chipset: Could not find valid CBAR"
" register.\n");
Expand All @@ -68,7 +68,7 @@ int __init init_cyclone_clock(void)

/* setup PMCC */
offset = (base + CYCLONE_PMCC_OFFSET);
reg = ioremap_nocache(offset, sizeof(u64));
reg = ioremap(offset, sizeof(u64));
if(!reg){
printk(KERN_ERR "Summit chipset: Could not find valid PMCC"
" register.\n");
Expand All @@ -80,7 +80,7 @@ int __init init_cyclone_clock(void)

/* setup MPCS */
offset = (base + CYCLONE_MPCS_OFFSET);
reg = ioremap_nocache(offset, sizeof(u64));
reg = ioremap(offset, sizeof(u64));
if(!reg){
printk(KERN_ERR "Summit chipset: Could not find valid MPCS"
" register.\n");
Expand All @@ -92,7 +92,7 @@ int __init init_cyclone_clock(void)

/* map in cyclone_timer */
offset = (base + CYCLONE_MPMC_OFFSET);
cyclone_timer = ioremap_nocache(offset, sizeof(u32));
cyclone_timer = ioremap(offset, sizeof(u32));
if(!cyclone_timer){
printk(KERN_ERR "Summit chipset: Could not find valid MPMC"
" register.\n");
Expand Down
1 change: 0 additions & 1 deletion arch/m68k/include/asm/kmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ static inline void __iomem *ioremap(unsigned long physaddr, unsigned long size)
return __ioremap(physaddr, size, IOMAP_NOCACHE_SER);
}

#define ioremap_nocache ioremap
#define ioremap_uc ioremap
#define ioremap_wt ioremap_wt
static inline void __iomem *ioremap_wt(unsigned long physaddr,
Expand Down
8 changes: 4 additions & 4 deletions arch/mips/ar7/clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,9 @@ static void tnetd7300_set_clock(u32 shift, struct tnetd7300_clock *clock,

static void __init tnetd7300_init_clocks(void)
{
u32 *bootcr = (u32 *)ioremap_nocache(AR7_REGS_DCL, 4);
u32 *bootcr = (u32 *)ioremap(AR7_REGS_DCL, 4);
struct tnetd7300_clocks *clocks =
ioremap_nocache(UR8_REGS_CLOCKS,
ioremap(UR8_REGS_CLOCKS,
sizeof(struct tnetd7300_clocks));

bus_clk.rate = tnetd7300_get_clock(BUS_PLL_SOURCE_SHIFT,
Expand Down Expand Up @@ -320,9 +320,9 @@ static int tnetd7200_get_clock_base(int clock_id, u32 *bootcr)

static void __init tnetd7200_init_clocks(void)
{
u32 *bootcr = (u32 *)ioremap_nocache(AR7_REGS_DCL, 4);
u32 *bootcr = (u32 *)ioremap(AR7_REGS_DCL, 4);
struct tnetd7200_clocks *clocks =
ioremap_nocache(AR7_REGS_CLOCKS,
ioremap(AR7_REGS_CLOCKS,
sizeof(struct tnetd7200_clocks));
int cpu_base, cpu_mul, cpu_prediv, cpu_postdiv;
int dsp_base, dsp_mul, dsp_prediv, dsp_postdiv;
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/ar7/gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ int __init ar7_gpio_init(void)
size = 0x1f;
}

gpch->regs = ioremap_nocache(AR7_REGS_GPIO, size);
gpch->regs = ioremap(AR7_REGS_GPIO, size);
if (!gpch->regs) {
printk(KERN_ERR "%s: failed to ioremap regs\n",
gpch->chip.label);
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/ar7/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ static int __init ar7_register_devices(void)
pr_warn("unable to register usb slave: %d\n", res);

/* Register watchdog only if enabled in hardware */
bootcr = ioremap_nocache(AR7_REGS_DCL, 4);
bootcr = ioremap(AR7_REGS_DCL, 4);
val = readl(bootcr);
iounmap(bootcr);
if (val & AR7_WDT_HW_ENA) {
Expand Down
4 changes: 2 additions & 2 deletions arch/mips/ath25/ar2315.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ void __init ar2315_plat_mem_setup(void)
u32 config;

/* Detect memory size */
sdram_base = ioremap_nocache(AR2315_SDRAMCTL_BASE,
sdram_base = ioremap(AR2315_SDRAMCTL_BASE,
AR2315_SDRAMCTL_SIZE);
memcfg = __raw_readl(sdram_base + AR2315_MEM_CFG);
memsize = 1 + ATH25_REG_MS(memcfg, AR2315_MEM_CFG_DATA_WIDTH);
Expand All @@ -272,7 +272,7 @@ void __init ar2315_plat_mem_setup(void)
add_memory_region(0, memsize, BOOT_MEM_RAM);
iounmap(sdram_base);

ar2315_rst_base = ioremap_nocache(AR2315_RST_BASE, AR2315_RST_SIZE);
ar2315_rst_base = ioremap(AR2315_RST_BASE, AR2315_RST_SIZE);

/* Detect the hardware based on the device ID */
devid = ar2315_rst_reg_read(AR2315_SREV) & AR2315_REV_CHIP;
Expand Down
6 changes: 3 additions & 3 deletions arch/mips/ath25/ar5312.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ static void __init ar5312_flash_init(void)
void __iomem *flashctl_base;
u32 ctl;

flashctl_base = ioremap_nocache(AR5312_FLASHCTL_BASE,
flashctl_base = ioremap(AR5312_FLASHCTL_BASE,
AR5312_FLASHCTL_SIZE);

ctl = __raw_readl(flashctl_base + AR5312_FLASHCTL0);
Expand Down Expand Up @@ -358,7 +358,7 @@ void __init ar5312_plat_mem_setup(void)
u32 devid;

/* Detect memory size */
sdram_base = ioremap_nocache(AR5312_SDRAMCTL_BASE,
sdram_base = ioremap(AR5312_SDRAMCTL_BASE,
AR5312_SDRAMCTL_SIZE);
memcfg = __raw_readl(sdram_base + AR5312_MEM_CFG1);
bank0_ac = ATH25_REG_MS(memcfg, AR5312_MEM_CFG1_AC0);
Expand All @@ -369,7 +369,7 @@ void __init ar5312_plat_mem_setup(void)
add_memory_region(0, memsize, BOOT_MEM_RAM);
iounmap(sdram_base);

ar5312_rst_base = ioremap_nocache(AR5312_RST_BASE, AR5312_RST_SIZE);
ar5312_rst_base = ioremap(AR5312_RST_BASE, AR5312_RST_SIZE);

devid = ar5312_rst_reg_read(AR5312_REV);
devid >>= AR5312_REV_WMAC_MIN_S;
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/ath25/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ int __init ath25_find_config(phys_addr_t base, unsigned long size)
u8 *mac_addr;
u32 offset;

flash_base = ioremap_nocache(base, size);
flash_base = ioremap(base, size);
flash_limit = flash_base + size;

ath25_board.config = NULL;
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/ath79/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ static void __iomem *ath79_ddr_pci_win_base;

void ath79_ddr_ctrl_init(void)
{
ath79_ddr_base = ioremap_nocache(AR71XX_DDR_CTRL_BASE,
ath79_ddr_base = ioremap(AR71XX_DDR_CTRL_BASE,
AR71XX_DDR_CTRL_SIZE);
if (soc_is_ar913x() || soc_is_ar724x() || soc_is_ar933x()) {
ath79_ddr_wb_flush_base = ath79_ddr_base + 0x7c;
Expand Down
4 changes: 2 additions & 2 deletions arch/mips/ath79/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,9 @@ void __init plat_mem_setup(void)
else if (fw_passed_dtb)
__dt_setup_arch((void *)KSEG0ADDR(fw_passed_dtb));

ath79_reset_base = ioremap_nocache(AR71XX_RESET_BASE,
ath79_reset_base = ioremap(AR71XX_RESET_BASE,
AR71XX_RESET_SIZE);
ath79_pll_base = ioremap_nocache(AR71XX_PLL_BASE,
ath79_pll_base = ioremap(AR71XX_PLL_BASE,
AR71XX_PLL_SIZE);
ath79_detect_sys_type();
ath79_ddr_ctrl_init();
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/cavium-octeon/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ static void octeon_write_lcd(const char *s)
{
if (octeon_bootinfo->led_display_base_addr) {
void __iomem *lcd_address =
ioremap_nocache(octeon_bootinfo->led_display_base_addr,
ioremap(octeon_bootinfo->led_display_base_addr,
8);
int i;
for (i = 0; i < 8; i++, s++) {
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/generic/board-ocelot.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ static void __init ocelot_earlyprintk_init(void)
{
void __iomem *uart_base;

uart_base = ioremap_nocache(UART_UART, 0x20);
uart_base = ioremap(UART_UART, 0x20);
setup_8250_early_printk_port((unsigned long)uart_base, 2, 50000);
}

Expand Down
1 change: 0 additions & 1 deletion arch/mips/include/asm/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,6 @@ static inline void __iomem *ioremap_prot(phys_addr_t offset,
*/
#define ioremap(offset, size) \
__ioremap_mode((offset), (size), _CACHE_UNCACHED)
#define ioremap_nocache ioremap
#define ioremap_uc ioremap

/*
Expand Down
4 changes: 2 additions & 2 deletions arch/mips/kernel/mips-cm.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ static void mips_cm_probe_l2sync(void)
write_gcr_l2_only_sync_base(addr | CM_GCR_L2_ONLY_SYNC_BASE_SYNCEN);

/* Map the region */
mips_cm_l2sync_base = ioremap_nocache(addr, MIPS_CM_L2SYNC_SIZE);
mips_cm_l2sync_base = ioremap(addr, MIPS_CM_L2SYNC_SIZE);
}

int mips_cm_probe(void)
Expand All @@ -215,7 +215,7 @@ int mips_cm_probe(void)
if (!addr)
return -ENODEV;

mips_gcr_base = ioremap_nocache(addr, MIPS_CM_GCR_SIZE);
mips_gcr_base = ioremap(addr, MIPS_CM_GCR_SIZE);
if (!mips_gcr_base)
return -ENXIO;

Expand Down
2 changes: 1 addition & 1 deletion arch/mips/kernel/mips-cpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ int mips_cpc_probe(void)
if (!addr)
return -ENODEV;

mips_cpc_base = ioremap_nocache(addr, 0x8000);
mips_cpc_base = ioremap(addr, 0x8000);
if (!mips_cpc_base)
return -ENXIO;

Expand Down
Loading

0 comments on commit 4bdc0d6

Please sign in to comment.