Commit 6112ea08 authored by Geert Uytterhoeven's avatar Geert Uytterhoeven

zorro: ZTWO_VADDR() should return "void __iomem *"

ZTWO_VADDR() converts from physical to virtual I/O addresses, so it should
return "void __iomem *" instead of "unsigned long".

This allows to drop several casts, but requires adding a few casts to
accomodate legacy driver frameworks that store "unsigned long" I/O
addresses.
Signed-off-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
parent 83b7bce3
...@@ -87,7 +87,7 @@ void *amiga_chip_alloc_res(unsigned long size, struct resource *res) ...@@ -87,7 +87,7 @@ void *amiga_chip_alloc_res(unsigned long size, struct resource *res)
atomic_sub(size, &chipavail); atomic_sub(size, &chipavail);
pr_debug("amiga_chip_alloc_res: returning %pR\n", res); pr_debug("amiga_chip_alloc_res: returning %pR\n", res);
return (void *)ZTWO_VADDR(res->start); return ZTWO_VADDR(res->start);
} }
void amiga_chip_free(void *ptr) void amiga_chip_free(void *ptr)
......
...@@ -618,7 +618,7 @@ static int __init amiga_savekmsg_setup(char *arg) ...@@ -618,7 +618,7 @@ static int __init amiga_savekmsg_setup(char *arg)
/* Just steal the block, the chipram allocator isn't functional yet */ /* Just steal the block, the chipram allocator isn't functional yet */
amiga_chip_size -= SAVEKMSG_MAXMEM; amiga_chip_size -= SAVEKMSG_MAXMEM;
savekmsg = (void *)ZTWO_VADDR(CHIP_PHYSADDR + amiga_chip_size); savekmsg = ZTWO_VADDR(CHIP_PHYSADDR + amiga_chip_size);
savekmsg->magic1 = SAVEKMSG_MAGIC1; savekmsg->magic1 = SAVEKMSG_MAGIC1;
savekmsg->magic2 = SAVEKMSG_MAGIC2; savekmsg->magic2 = SAVEKMSG_MAGIC2;
savekmsg->magicptr = ZTWO_PADDR(savekmsg); savekmsg->magicptr = ZTWO_PADDR(savekmsg);
......
...@@ -266,7 +266,7 @@ struct CIA { ...@@ -266,7 +266,7 @@ struct CIA {
#define zTwoBase (0x80000000) #define zTwoBase (0x80000000)
#define ZTWO_PADDR(x) (((unsigned long)(x))-zTwoBase) #define ZTWO_PADDR(x) (((unsigned long)(x))-zTwoBase)
#define ZTWO_VADDR(x) (((unsigned long)(x))+zTwoBase) #define ZTWO_VADDR(x) ((void __iomem *)(((unsigned long)(x))+zTwoBase))
#define CUSTOM_PHYSADDR (0xdff000) #define CUSTOM_PHYSADDR (0xdff000)
#define amiga_custom ((*(volatile struct CUSTOM *)(zTwoBase+CUSTOM_PHYSADDR))) #define amiga_custom ((*(volatile struct CUSTOM *)(zTwoBase+CUSTOM_PHYSADDR)))
......
...@@ -116,8 +116,8 @@ get_z2ram( void ) ...@@ -116,8 +116,8 @@ get_z2ram( void )
if ( test_bit( i, zorro_unused_z2ram ) ) if ( test_bit( i, zorro_unused_z2ram ) )
{ {
z2_count++; z2_count++;
z2ram_map[ z2ram_size++ ] = z2ram_map[z2ram_size++] = (unsigned long)ZTWO_VADDR(Z2RAM_START) +
ZTWO_VADDR( Z2RAM_START ) + ( i << Z2RAM_CHUNKSHIFT ); (i << Z2RAM_CHUNKSHIFT);
clear_bit( i, zorro_unused_z2ram ); clear_bit( i, zorro_unused_z2ram );
} }
} }
......
...@@ -198,7 +198,7 @@ static int __init buddha_init(void) ...@@ -198,7 +198,7 @@ static int __init buddha_init(void)
continue; continue;
} }
} }
buddha_board = ZTWO_VADDR(board); buddha_board = (unsigned long)ZTWO_VADDR(board);
/* write to BUDDHA_IRQ_MR to enable the board IRQ */ /* write to BUDDHA_IRQ_MR to enable the board IRQ */
/* X-Surf doesn't have this. IRQs are always on */ /* X-Surf doesn't have this. IRQs are always on */
......
...@@ -113,7 +113,7 @@ static const struct net_device_ops hydra_netdev_ops = { ...@@ -113,7 +113,7 @@ static const struct net_device_ops hydra_netdev_ops = {
static int hydra_init(struct zorro_dev *z) static int hydra_init(struct zorro_dev *z)
{ {
struct net_device *dev; struct net_device *dev;
unsigned long board = ZTWO_VADDR(z->resource.start); unsigned long board = (unsigned long)ZTWO_VADDR(z->resource.start);
unsigned long ioaddr = board+HYDRA_NIC_BASE; unsigned long ioaddr = board+HYDRA_NIC_BASE;
const char name[] = "NE2000"; const char name[] = "NE2000";
int start_page, stop_page; int start_page, stop_page;
......
...@@ -287,7 +287,7 @@ static const struct net_device_ops zorro8390_netdev_ops = { ...@@ -287,7 +287,7 @@ static const struct net_device_ops zorro8390_netdev_ops = {
}; };
static int zorro8390_init(struct net_device *dev, unsigned long board, static int zorro8390_init(struct net_device *dev, unsigned long board,
const char *name, unsigned long ioaddr) const char *name, void __iomem *ioaddr)
{ {
int i; int i;
int err; int err;
...@@ -354,7 +354,7 @@ static int zorro8390_init(struct net_device *dev, unsigned long board, ...@@ -354,7 +354,7 @@ static int zorro8390_init(struct net_device *dev, unsigned long board,
start_page = NESM_START_PG; start_page = NESM_START_PG;
stop_page = NESM_STOP_PG; stop_page = NESM_STOP_PG;
dev->base_addr = ioaddr; dev->base_addr = (unsigned long)ioaddr;
dev->irq = IRQ_AMIGA_PORTS; dev->irq = IRQ_AMIGA_PORTS;
/* Install the Interrupt handler */ /* Install the Interrupt handler */
......
...@@ -713,8 +713,8 @@ static int a2065_init_one(struct zorro_dev *z, ...@@ -713,8 +713,8 @@ static int a2065_init_one(struct zorro_dev *z,
dev->dev_addr[3] = (z->rom.er_SerialNumber >> 16) & 0xff; dev->dev_addr[3] = (z->rom.er_SerialNumber >> 16) & 0xff;
dev->dev_addr[4] = (z->rom.er_SerialNumber >> 8) & 0xff; dev->dev_addr[4] = (z->rom.er_SerialNumber >> 8) & 0xff;
dev->dev_addr[5] = z->rom.er_SerialNumber & 0xff; dev->dev_addr[5] = z->rom.er_SerialNumber & 0xff;
dev->base_addr = ZTWO_VADDR(base_addr); dev->base_addr = (unsigned long)ZTWO_VADDR(base_addr);
dev->mem_start = ZTWO_VADDR(mem_start); dev->mem_start = (unsigned long)ZTWO_VADDR(mem_start);
dev->mem_end = dev->mem_start + A2065_RAM_SIZE; dev->mem_end = dev->mem_start + A2065_RAM_SIZE;
priv->ll = (volatile struct lance_regs *)dev->base_addr; priv->ll = (volatile struct lance_regs *)dev->base_addr;
......
...@@ -747,8 +747,8 @@ static int ariadne_init_one(struct zorro_dev *z, ...@@ -747,8 +747,8 @@ static int ariadne_init_one(struct zorro_dev *z,
dev->dev_addr[3] = (z->rom.er_SerialNumber >> 16) & 0xff; dev->dev_addr[3] = (z->rom.er_SerialNumber >> 16) & 0xff;
dev->dev_addr[4] = (z->rom.er_SerialNumber >> 8) & 0xff; dev->dev_addr[4] = (z->rom.er_SerialNumber >> 8) & 0xff;
dev->dev_addr[5] = z->rom.er_SerialNumber & 0xff; dev->dev_addr[5] = z->rom.er_SerialNumber & 0xff;
dev->base_addr = ZTWO_VADDR(base_addr); dev->base_addr = (unsigned long)ZTWO_VADDR(base_addr);
dev->mem_start = ZTWO_VADDR(mem_start); dev->mem_start = (unsigned long)ZTWO_VADDR(mem_start);
dev->mem_end = dev->mem_start + ARIADNE_RAM_SIZE; dev->mem_end = dev->mem_start + ARIADNE_RAM_SIZE;
dev->netdev_ops = &ariadne_netdev_ops; dev->netdev_ops = &ariadne_netdev_ops;
......
...@@ -300,7 +300,7 @@ static int __init parport_mfc3_init(void) ...@@ -300,7 +300,7 @@ static int __init parport_mfc3_init(void)
if (!request_mem_region(piabase, sizeof(struct pia), "PIA")) if (!request_mem_region(piabase, sizeof(struct pia), "PIA"))
continue; continue;
pp = (struct pia *)ZTWO_VADDR(piabase); pp = ZTWO_VADDR(piabase);
pp->crb = 0; pp->crb = 0;
pp->pddrb = 255; /* all data pins output */ pp->pddrb = 255; /* all data pins output */
pp->crb = PIA_DDR|32|8; pp->crb = PIA_DDR|32|8;
......
...@@ -201,7 +201,7 @@ static int a2091_probe(struct zorro_dev *z, const struct zorro_device_id *ent) ...@@ -201,7 +201,7 @@ static int a2091_probe(struct zorro_dev *z, const struct zorro_device_id *ent)
instance->irq = IRQ_AMIGA_PORTS; instance->irq = IRQ_AMIGA_PORTS;
instance->unique_id = z->slotaddr; instance->unique_id = z->slotaddr;
regs = (struct a2091_scsiregs *)ZTWO_VADDR(z->resource.start); regs = ZTWO_VADDR(z->resource.start);
regs->DAWR = DAWR_A2091; regs->DAWR = DAWR_A2091;
wdregs.SASR = &regs->SASR; wdregs.SASR = &regs->SASR;
......
...@@ -220,7 +220,7 @@ static int __init amiga_a3000_scsi_probe(struct platform_device *pdev) ...@@ -220,7 +220,7 @@ static int __init amiga_a3000_scsi_probe(struct platform_device *pdev)
instance->irq = IRQ_AMIGA_PORTS; instance->irq = IRQ_AMIGA_PORTS;
regs = (struct a3000_scsiregs *)ZTWO_VADDR(res->start); regs = ZTWO_VADDR(res->start);
regs->DAWR = DAWR_A3000; regs->DAWR = DAWR_A3000;
wdregs.SASR = &regs->SASR; wdregs.SASR = &regs->SASR;
......
...@@ -56,7 +56,7 @@ static int __init amiga_a4000t_scsi_probe(struct platform_device *pdev) ...@@ -56,7 +56,7 @@ static int __init amiga_a4000t_scsi_probe(struct platform_device *pdev)
scsi_addr = res->start + A4000T_SCSI_OFFSET; scsi_addr = res->start + A4000T_SCSI_OFFSET;
/* Fill in the required pieces of hostdata */ /* Fill in the required pieces of hostdata */
hostdata->base = (void __iomem *)ZTWO_VADDR(scsi_addr); hostdata->base = ZTWO_VADDR(scsi_addr);
hostdata->clock = 50; hostdata->clock = 50;
hostdata->chip710 = 1; hostdata->chip710 = 1;
hostdata->dmode_extra = DMODE_FC2; hostdata->dmode_extra = DMODE_FC2;
......
...@@ -310,7 +310,7 @@ static int gvp11_probe(struct zorro_dev *z, const struct zorro_device_id *ent) ...@@ -310,7 +310,7 @@ static int gvp11_probe(struct zorro_dev *z, const struct zorro_device_id *ent)
if (!request_mem_region(address, 256, "wd33c93")) if (!request_mem_region(address, 256, "wd33c93"))
return -EBUSY; return -EBUSY;
regs = (struct gvp11_scsiregs *)(ZTWO_VADDR(address)); regs = ZTWO_VADDR(address);
error = check_wd33c93(regs); error = check_wd33c93(regs);
if (error) if (error)
......
...@@ -104,7 +104,7 @@ static int zorro7xx_init_one(struct zorro_dev *z, ...@@ -104,7 +104,7 @@ static int zorro7xx_init_one(struct zorro_dev *z,
if (ioaddr > 0x01000000) if (ioaddr > 0x01000000)
hostdata->base = ioremap(ioaddr, zorro_resource_len(z)); hostdata->base = ioremap(ioaddr, zorro_resource_len(z));
else else
hostdata->base = (void __iomem *)ZTWO_VADDR(ioaddr); hostdata->base = ZTWO_VADDR(ioaddr);
hostdata->clock = 50; hostdata->clock = 50;
hostdata->chip710 = 1; hostdata->chip710 = 1;
......
...@@ -3710,7 +3710,7 @@ static int __init amifb_probe(struct platform_device *pdev) ...@@ -3710,7 +3710,7 @@ static int __init amifb_probe(struct platform_device *pdev)
if (!videomemory) { if (!videomemory) {
dev_warn(&pdev->dev, dev_warn(&pdev->dev,
"Unable to map videomem cached writethrough\n"); "Unable to map videomem cached writethrough\n");
info->screen_base = (char *)ZTWO_VADDR(info->fix.smem_start); info->screen_base = ZTWO_VADDR(info->fix.smem_start);
} else } else
info->screen_base = (char *)videomemory; info->screen_base = (char *)videomemory;
......
...@@ -2256,7 +2256,7 @@ static int cirrusfb_zorro_register(struct zorro_dev *z, ...@@ -2256,7 +2256,7 @@ static int cirrusfb_zorro_register(struct zorro_dev *z,
info->fix.mmio_start = regbase; info->fix.mmio_start = regbase;
cinfo->regbase = regbase > 16 * MB_ ? ioremap(regbase, 64 * 1024) cinfo->regbase = regbase > 16 * MB_ ? ioremap(regbase, 64 * 1024)
: (caddr_t)ZTWO_VADDR(regbase); : ZTWO_VADDR(regbase);
if (!cinfo->regbase) { if (!cinfo->regbase) {
dev_err(info->device, "Cannot map registers\n"); dev_err(info->device, "Cannot map registers\n");
error = -EIO; error = -EIO;
...@@ -2266,7 +2266,7 @@ static int cirrusfb_zorro_register(struct zorro_dev *z, ...@@ -2266,7 +2266,7 @@ static int cirrusfb_zorro_register(struct zorro_dev *z,
info->fix.smem_start = rambase; info->fix.smem_start = rambase;
info->screen_size = ramsize; info->screen_size = ramsize;
info->screen_base = rambase > 16 * MB_ ? ioremap(rambase, ramsize) info->screen_base = rambase > 16 * MB_ ? ioremap(rambase, ramsize)
: (caddr_t)ZTWO_VADDR(rambase); : ZTWO_VADDR(rambase);
if (!info->screen_base) { if (!info->screen_base) {
dev_err(info->device, "Cannot map video RAM\n"); dev_err(info->device, "Cannot map video RAM\n");
error = -EIO; error = -EIO;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment