Commit 107111d4 authored by Sergei Shtylyov's avatar Sergei Shtylyov Committed by Bartlomiej Zolnierkiewicz

sgiioc4: kill duplicate ioremap()

By the time ide_dma_sgiioc4() gets called, sgiioc4_ide_setup_pci_device() will
have called ioremap() on the whole BAR0 region, so calling ioremap() on the DMA
registers means wasting a page. Replace this call by a mere address calculation,
based on the fact that IRQ registers (pointed to by 'hwif->io_ports.irq_addr')
are situated at offset 0 from BAR0.
Signed-off-by: default avatarSergei Shtylyov <sshtylyov@ru.mvista.com>
Cc: jeremy@sgi.com
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
parent 8108b882
...@@ -320,7 +320,6 @@ ide_dma_sgiioc4(ide_hwif_t *hwif, const struct ide_port_info *d) ...@@ -320,7 +320,6 @@ ide_dma_sgiioc4(ide_hwif_t *hwif, const struct ide_port_info *d)
{ {
struct pci_dev *dev = to_pci_dev(hwif->dev); struct pci_dev *dev = to_pci_dev(hwif->dev);
unsigned long dma_base = pci_resource_start(dev, 0) + IOC4_DMA_OFFSET; unsigned long dma_base = pci_resource_start(dev, 0) + IOC4_DMA_OFFSET;
void __iomem *virt_dma_base;
int num_ports = sizeof (ioc4_dma_regs_t); int num_ports = sizeof (ioc4_dma_regs_t);
void *pad; void *pad;
...@@ -333,14 +332,8 @@ ide_dma_sgiioc4(ide_hwif_t *hwif, const struct ide_port_info *d) ...@@ -333,14 +332,8 @@ ide_dma_sgiioc4(ide_hwif_t *hwif, const struct ide_port_info *d)
return -1; return -1;
} }
virt_dma_base = ioremap(dma_base, num_ports); hwif->dma_base = (unsigned long)hwif->io_ports.irq_addr +
if (virt_dma_base == NULL) { IOC4_DMA_OFFSET;
printk(KERN_ERR "%s(%s) -- ERROR: unable to map addresses "
"0x%lx to 0x%lx\n", __func__, hwif->name,
dma_base, dma_base + num_ports - 1);
goto dma_remap_failure;
}
hwif->dma_base = (unsigned long) virt_dma_base;
hwif->sg_max_nents = IOC4_PRD_ENTRIES; hwif->sg_max_nents = IOC4_PRD_ENTRIES;
...@@ -364,9 +357,6 @@ ide_dma_sgiioc4(ide_hwif_t *hwif, const struct ide_port_info *d) ...@@ -364,9 +357,6 @@ ide_dma_sgiioc4(ide_hwif_t *hwif, const struct ide_port_info *d)
printk(KERN_INFO "%s: changing from DMA to PIO mode", hwif->name); printk(KERN_INFO "%s: changing from DMA to PIO mode", hwif->name);
dma_pci_alloc_failure: dma_pci_alloc_failure:
iounmap(virt_dma_base);
dma_remap_failure:
release_mem_region(dma_base, num_ports); release_mem_region(dma_base, num_ports);
return -1; return -1;
......
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