Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8108b882 authored by Sergei Shtylyov's avatar Sergei Shtylyov Committed by Bartlomiej Zolnierkiewicz
Browse files

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: default avatarSergei Shtylyov <sshtylyov@ru.mvista.com>
Cc: jeremy@sgi.com
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
parent 8c061a40
Loading
Loading
Loading
Loading
+9 −17
Original line number Original line Diff line number Diff line
@@ -101,10 +101,7 @@ sgiioc4_init_hwif_ports(hw_regs_t * hw, unsigned long data_port,
	for (i = 0; i <= 7; i++)
	for (i = 0; i <= 7; i++)
		hw->io_ports_array[i] = reg + i * 4;
		hw->io_ports_array[i] = reg + i * 4;


	if (ctrl_port)
	hw->io_ports.ctl_addr = ctrl_port;
	hw->io_ports.ctl_addr = ctrl_port;

	if (irq_port)
	hw->io_ports.irq_addr = irq_port;
	hw->io_ports.irq_addr = irq_port;
}
}


@@ -303,7 +300,6 @@ static u8 sgiioc4_read_status(ide_hwif_t *hwif)
	unsigned long port = hwif->io_ports.status_addr;
	unsigned long port = hwif->io_ports.status_addr;
	u8 reg = (u8) readb((void __iomem *) port);
	u8 reg = (u8) readb((void __iomem *) port);


	if ((port & 0xFFF) == 0x11C) {	/* Status register of IOC4 */
	if (!(reg & ATA_BUSY)) {	/* Not busy... check for interrupt */
	if (!(reg & ATA_BUSY)) {	/* Not busy... check for interrupt */
		unsigned long other_ir = port - 0x110;
		unsigned long other_ir = port - 0x110;
		unsigned int intr_reg = (u32) readl((void __iomem *) other_ir);
		unsigned int intr_reg = (u32) readl((void __iomem *) other_ir);
@@ -314,7 +310,6 @@ static u8 sgiioc4_read_status(ide_hwif_t *hwif)
			intr_reg = (u32) readl((void __iomem *) other_ir);
			intr_reg = (u32) readl((void __iomem *) other_ir);
		}
		}
	}
	}
	}


	return reg;
	return reg;
}
}
@@ -329,9 +324,6 @@ ide_dma_sgiioc4(ide_hwif_t *hwif, const struct ide_port_info *d)
	int num_ports = sizeof (ioc4_dma_regs_t);
	int num_ports = sizeof (ioc4_dma_regs_t);
	void *pad;
	void *pad;


	if (dma_base == 0)
		return -1;

	printk(KERN_INFO "    %s: MMIO-DMA\n", hwif->name);
	printk(KERN_INFO "    %s: MMIO-DMA\n", hwif->name);


	if (request_mem_region(dma_base, num_ports, hwif->name) == NULL) {
	if (request_mem_region(dma_base, num_ports, hwif->name) == NULL) {