aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
authorSergei Shtylyov <sshtylyov@ru.mvista.com>2008-10-17 12:09:16 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-10-17 12:09:16 -0400
commit8108b882329db7fbf9fbca6559aa36e6174dc91f (patch)
tree3e340b1f8fc6c517188df9286443281bc14ac694 /drivers/ide
parent8c061a40c293660793dab83b75223e6eaaa04f8b (diff)
sgiioc4: kill useless address checks
The driver performs a number of checks on the virtual/physical addresses which would always evaluate as true (except ide_dma_sgiioc4() -- always false): - for sgiioc4_init_hwif_ports(), its caller, sgiioc4_ide_setup_pci_device(), guarantees that 'ctrl_port' and 'irq_port' parameters are never 0; - in sgiioc4_read_status(), we always read the IDE status register, so there's no need to check the register's address (must be a leftover from the times when this function implemented the INB() method); - in ide_dma_sgiioc4(), 'dma_base' can never be 0 as IOC4_DMA_OFFSET is not 0. Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Cc: jeremy@sgi.com Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide')
-rw-r--r--drivers/ide/pci/sgiioc4.c26
1 files changed, 9 insertions, 17 deletions
diff --git a/drivers/ide/pci/sgiioc4.c b/drivers/ide/pci/sgiioc4.c
index 8581789352aa..f6c5ba07be71 100644
--- a/drivers/ide/pci/sgiioc4.c
+++ b/drivers/ide/pci/sgiioc4.c
@@ -101,11 +101,8 @@ sgiioc4_init_hwif_ports(hw_regs_t * hw, unsigned long data_port,
101 for (i = 0; i <= 7; i++) 101 for (i = 0; i <= 7; i++)
102 hw->io_ports_array[i] = reg + i * 4; 102 hw->io_ports_array[i] = reg + i * 4;
103 103
104 if (ctrl_port) 104 hw->io_ports.ctl_addr = ctrl_port;
105 hw->io_ports.ctl_addr = ctrl_port; 105 hw->io_ports.irq_addr = irq_port;
106
107 if (irq_port)
108 hw->io_ports.irq_addr = irq_port;
109} 106}
110 107
111static int 108static int
@@ -303,16 +300,14 @@ static u8 sgiioc4_read_status(ide_hwif_t *hwif)
303 unsigned long port = hwif->io_ports.status_addr; 300 unsigned long port = hwif->io_ports.status_addr;
304 u8 reg = (u8) readb((void __iomem *) port); 301 u8 reg = (u8) readb((void __iomem *) port);
305 302
306 if ((port & 0xFFF) == 0x11C) { /* Status register of IOC4 */ 303 if (!(reg & ATA_BUSY)) { /* Not busy... check for interrupt */
307 if (!(reg & ATA_BUSY)) { /* Not busy... check for interrupt */ 304 unsigned long other_ir = port - 0x110;
308 unsigned long other_ir = port - 0x110; 305 unsigned int intr_reg = (u32) readl((void __iomem *) other_ir);
309 unsigned int intr_reg = (u32) readl((void __iomem *) other_ir);
310 306
311 /* Clear the Interrupt, Error bits on the IOC4 */ 307 /* Clear the Interrupt, Error bits on the IOC4 */
312 if (intr_reg & 0x03) { 308 if (intr_reg & 0x03) {
313 writel(0x03, (void __iomem *) other_ir); 309 writel(0x03, (void __iomem *) other_ir);
314 intr_reg = (u32) readl((void __iomem *) other_ir); 310 intr_reg = (u32) readl((void __iomem *) other_ir);
315 }
316 } 311 }
317 } 312 }
318 313
@@ -329,9 +324,6 @@ ide_dma_sgiioc4(ide_hwif_t *hwif, const struct ide_port_info *d)
329 int num_ports = sizeof (ioc4_dma_regs_t); 324 int num_ports = sizeof (ioc4_dma_regs_t);
330 void *pad; 325 void *pad;
331 326
332 if (dma_base == 0)
333 return -1;
334
335 printk(KERN_INFO " %s: MMIO-DMA\n", hwif->name); 327 printk(KERN_INFO " %s: MMIO-DMA\n", hwif->name);
336 328
337 if (request_mem_region(dma_base, num_ports, hwif->name) == NULL) { 329 if (request_mem_region(dma_base, num_ports, hwif->name) == NULL) {