Browse Source

ide: add ->read_status method

* Remove ide_read_status() inline helper.

* Add ->read_status method for reading ATA Status register
  and use it instead of ->INB.

While at it:

* Don't use HWGROUP() macro.

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Bartlomiej Zolnierkiewicz 17 years ago
parent
commit
b73c7ee25d

+ 3 - 1
drivers/ide/arm/icside.c

@@ -375,12 +375,14 @@ static int icside_dma_test_irq(ide_drive_t *drive)
 
 
 static void icside_dma_timeout(ide_drive_t *drive)
 static void icside_dma_timeout(ide_drive_t *drive)
 {
 {
+	ide_hwif_t *hwif = drive->hwif;
+
 	printk(KERN_ERR "%s: DMA timeout occurred: ", drive->name);
 	printk(KERN_ERR "%s: DMA timeout occurred: ", drive->name);
 
 
 	if (icside_dma_test_irq(drive))
 	if (icside_dma_test_irq(drive))
 		return;
 		return;
 
 
-	ide_dump_status(drive, "DMA timeout", ide_read_status(drive));
+	ide_dump_status(drive, "DMA timeout", hwif->read_status(hwif));
 
 
 	icside_dma_end(drive);
 	icside_dma_end(drive);
 }
 }

+ 1 - 1
drivers/ide/ide-atapi.c

@@ -35,7 +35,7 @@ ide_startstop_t ide_pc_intr(ide_drive_t *drive, struct ide_atapi_pc *pc,
 	}
 	}
 
 
 	/* Clear the interrupt */
 	/* Clear the interrupt */
-	stat = ide_read_status(drive);
+	stat = hwif->read_status(hwif);
 
 
 	if (pc->flags & PC_FLAG_DMA_IN_PROGRESS) {
 	if (pc->flags & PC_FLAG_DMA_IN_PROGRESS) {
 		if (hwif->dma_ops->dma_end(drive) ||
 		if (hwif->dma_ops->dma_end(drive) ||

+ 8 - 4
drivers/ide/ide-cd.c

@@ -280,11 +280,12 @@ static void ide_dump_status_no_sense(ide_drive_t *drive, const char *msg, u8 st)
  */
  */
 static int cdrom_decode_status(ide_drive_t *drive, int good_stat, int *stat_ret)
 static int cdrom_decode_status(ide_drive_t *drive, int good_stat, int *stat_ret)
 {
 {
-	struct request *rq = HWGROUP(drive)->rq;
+	ide_hwif_t *hwif = drive->hwif;
+	struct request *rq = hwif->hwgroup->rq;
 	int stat, err, sense_key;
 	int stat, err, sense_key;
 
 
 	/* check for errors */
 	/* check for errors */
-	stat = ide_read_status(drive);
+	stat = hwif->read_status(hwif);
 
 
 	if (stat_ret)
 	if (stat_ret)
 		*stat_ret = stat;
 		*stat_ret = stat;
@@ -606,6 +607,8 @@ static ide_startstop_t cdrom_transfer_packet_command(ide_drive_t *drive,
 static int ide_cd_check_ireason(ide_drive_t *drive, struct request *rq,
 static int ide_cd_check_ireason(ide_drive_t *drive, struct request *rq,
 				int len, int ireason, int rw)
 				int len, int ireason, int rw)
 {
 {
+	ide_hwif_t *hwif = drive->hwif;
+
 	/*
 	/*
 	 * ireason == 0: the drive wants to receive data from us
 	 * ireason == 0: the drive wants to receive data from us
 	 * ireason == 2: the drive is expecting to transfer data to us
 	 * ireason == 2: the drive is expecting to transfer data to us
@@ -624,7 +627,7 @@ static int ide_cd_check_ireason(ide_drive_t *drive, struct request *rq,
 		 * Some drives (ASUS) seem to tell us that status info is
 		 * Some drives (ASUS) seem to tell us that status info is
 		 * available.  Just get it and ignore.
 		 * available.  Just get it and ignore.
 		 */
 		 */
-		(void)ide_read_status(drive);
+		(void)hwif->read_status(hwif);
 		return 0;
 		return 0;
 	} else {
 	} else {
 		/* drive wants a command packet, or invalid ireason... */
 		/* drive wants a command packet, or invalid ireason... */
@@ -1199,8 +1202,9 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq,
 
 
 	if (blk_fs_request(rq)) {
 	if (blk_fs_request(rq)) {
 		if (info->cd_flags & IDE_CD_FLAG_SEEKING) {
 		if (info->cd_flags & IDE_CD_FLAG_SEEKING) {
+			ide_hwif_t *hwif = drive->hwif;
 			unsigned long elapsed = jiffies - info->start_seek;
 			unsigned long elapsed = jiffies - info->start_seek;
-			int stat = ide_read_status(drive);
+			int stat = hwif->read_status(hwif);
 
 
 			if ((stat & SEEK_STAT) != SEEK_STAT) {
 			if ((stat & SEEK_STAT) != SEEK_STAT) {
 				if (elapsed < IDECD_SEEK_TIMEOUT) {
 				if (elapsed < IDECD_SEEK_TIMEOUT) {

+ 3 - 2
drivers/ide/ide-dma.c

@@ -100,10 +100,11 @@ static const struct drive_list_entry drive_blacklist [] = {
  
  
 ide_startstop_t ide_dma_intr (ide_drive_t *drive)
 ide_startstop_t ide_dma_intr (ide_drive_t *drive)
 {
 {
+	ide_hwif_t *hwif = drive->hwif;
 	u8 stat = 0, dma_stat = 0;
 	u8 stat = 0, dma_stat = 0;
 
 
-	dma_stat = drive->hwif->dma_ops->dma_end(drive);
-	stat = ide_read_status(drive);
+	dma_stat = hwif->dma_ops->dma_end(drive);
+	stat = hwif->read_status(hwif);
 
 
 	if (OK_STAT(stat,DRIVE_READY,drive->bad_wstat|DRQ_STAT)) {
 	if (OK_STAT(stat,DRIVE_READY,drive->bad_wstat|DRQ_STAT)) {
 		if (!dma_stat) {
 		if (!dma_stat) {

+ 2 - 1
drivers/ide/ide-floppy.c

@@ -949,11 +949,12 @@ static int idefloppy_get_format_progress(ide_drive_t *drive, int __user *arg)
 
 
 		/* Else assume format_unit has finished, and we're at 0x10000 */
 		/* Else assume format_unit has finished, and we're at 0x10000 */
 	} else {
 	} else {
+		ide_hwif_t *hwif = drive->hwif;
 		unsigned long flags;
 		unsigned long flags;
 		u8 stat;
 		u8 stat;
 
 
 		local_irq_save(flags);
 		local_irq_save(flags);
-		stat = ide_read_status(drive);
+		stat = hwif->read_status(hwif);
 		local_irq_restore(flags);
 		local_irq_restore(flags);
 
 
 		progress_indication = ((stat & SEEK_STAT) == 0) ? 0 : 0x10000;
 		progress_indication = ((stat & SEEK_STAT) == 0) ? 0 : 0x10000;

+ 10 - 9
drivers/ide/ide-io.c

@@ -381,8 +381,7 @@ static ide_startstop_t ide_ata_error(ide_drive_t *drive, struct request *rq, u8
 		if (err == ABRT_ERR) {
 		if (err == ABRT_ERR) {
 			if (drive->select.b.lba &&
 			if (drive->select.b.lba &&
 			    /* some newer drives don't support WIN_SPECIFY */
 			    /* some newer drives don't support WIN_SPECIFY */
-			    hwif->INB(hwif->io_ports.command_addr) ==
-				WIN_SPECIFY)
+			    hwif->read_status(hwif) == WIN_SPECIFY)
 				return ide_stopped;
 				return ide_stopped;
 		} else if ((err & BAD_CRC) == BAD_CRC) {
 		} else if ((err & BAD_CRC) == BAD_CRC) {
 			/* UDMA crc error, just retry the operation */
 			/* UDMA crc error, just retry the operation */
@@ -408,7 +407,7 @@ static ide_startstop_t ide_ata_error(ide_drive_t *drive, struct request *rq, u8
 		return ide_stopped;
 		return ide_stopped;
 	}
 	}
 
 
-	if (ide_read_status(drive) & (BUSY_STAT | DRQ_STAT))
+	if (hwif->read_status(hwif) & (BUSY_STAT | DRQ_STAT))
 		rq->errors |= ERROR_RESET;
 		rq->errors |= ERROR_RESET;
 
 
 	if ((rq->errors & ERROR_RESET) == ERROR_RESET) {
 	if ((rq->errors & ERROR_RESET) == ERROR_RESET) {
@@ -435,7 +434,7 @@ static ide_startstop_t ide_atapi_error(ide_drive_t *drive, struct request *rq, u
 		/* add decoding error stuff */
 		/* add decoding error stuff */
 	}
 	}
 
 
-	if (ide_read_status(drive) & (BUSY_STAT | DRQ_STAT))
+	if (hwif->read_status(hwif) & (BUSY_STAT | DRQ_STAT))
 		/* force an abort */
 		/* force an abort */
 		hwif->exec_command(hwif, WIN_IDLEIMMEDIATE);
 		hwif->exec_command(hwif, WIN_IDLEIMMEDIATE);
 
 
@@ -711,7 +710,8 @@ static ide_startstop_t execute_drive_cmd (ide_drive_t *drive,
 #ifdef DEBUG
 #ifdef DEBUG
  	printk("%s: DRIVE_CMD (null)\n", drive->name);
  	printk("%s: DRIVE_CMD (null)\n", drive->name);
 #endif
 #endif
-	ide_end_drive_cmd(drive, ide_read_status(drive), ide_read_error(drive));
+	ide_end_drive_cmd(drive, hwif->read_status(hwif),
+			  ide_read_error(drive));
 
 
  	return ide_stopped;
  	return ide_stopped;
 }
 }
@@ -1141,7 +1141,7 @@ static ide_startstop_t ide_dma_timeout_retry(ide_drive_t *drive, int error)
 		printk(KERN_WARNING "%s: DMA timeout error\n", drive->name);
 		printk(KERN_WARNING "%s: DMA timeout error\n", drive->name);
 		(void)hwif->dma_ops->dma_end(drive);
 		(void)hwif->dma_ops->dma_end(drive);
 		ret = ide_error(drive, "dma timeout error",
 		ret = ide_error(drive, "dma timeout error",
-				ide_read_status(drive));
+				hwif->read_status(hwif));
 	} else {
 	} else {
 		printk(KERN_WARNING "%s: DMA timeout retry\n", drive->name);
 		printk(KERN_WARNING "%s: DMA timeout retry\n", drive->name);
 		hwif->dma_ops->dma_timeout(drive);
 		hwif->dma_ops->dma_timeout(drive);
@@ -1266,7 +1266,7 @@ void ide_timer_expiry (unsigned long data)
 				} else
 				} else
 					startstop =
 					startstop =
 					ide_error(drive, "irq timeout",
 					ide_error(drive, "irq timeout",
-						  ide_read_status(drive));
+						  hwif->read_status(hwif));
 			}
 			}
 			drive->service_time = jiffies - drive->service_start;
 			drive->service_time = jiffies - drive->service_start;
 			spin_lock_irq(&ide_lock);
 			spin_lock_irq(&ide_lock);
@@ -1322,7 +1322,8 @@ static void unexpected_intr (int irq, ide_hwgroup_t *hwgroup)
 	 */
 	 */
 	do {
 	do {
 		if (hwif->irq == irq) {
 		if (hwif->irq == irq) {
-			stat = hwif->INB(hwif->io_ports.status_addr);
+			stat = hwif->read_status(hwif);
+
 			if (!OK_STAT(stat, READY_STAT, BAD_STAT)) {
 			if (!OK_STAT(stat, READY_STAT, BAD_STAT)) {
 				/* Try to not flood the console with msgs */
 				/* Try to not flood the console with msgs */
 				static unsigned long last_msgtime, count;
 				static unsigned long last_msgtime, count;
@@ -1412,7 +1413,7 @@ irqreturn_t ide_intr (int irq, void *dev_id)
 			 * Whack the status register, just in case
 			 * Whack the status register, just in case
 			 * we have a leftover pending IRQ.
 			 * we have a leftover pending IRQ.
 			 */
 			 */
-			(void) hwif->INB(hwif->io_ports.status_addr);
+			(void)hwif->read_status(hwif);
 #endif /* CONFIG_BLK_DEV_IDEPCI */
 #endif /* CONFIG_BLK_DEV_IDEPCI */
 		}
 		}
 		spin_unlock_irqrestore(&ide_lock, flags);
 		spin_unlock_irqrestore(&ide_lock, flags);

+ 22 - 11
drivers/ide/ide-iops.c

@@ -111,6 +111,14 @@ static void ide_exec_command(ide_hwif_t *hwif, u8 cmd)
 		outb(cmd, hwif->io_ports.command_addr);
 		outb(cmd, hwif->io_ports.command_addr);
 }
 }
 
 
+static u8 ide_read_status(ide_hwif_t *hwif)
+{
+	if (hwif->host_flags & IDE_HFLAG_MMIO)
+		return readb((void __iomem *)hwif->io_ports.status_addr);
+	else
+		return inb(hwif->io_ports.status_addr);
+}
+
 static u8 ide_read_sff_dma_status(ide_hwif_t *hwif)
 static u8 ide_read_sff_dma_status(ide_hwif_t *hwif)
 {
 {
 	if (hwif->host_flags & IDE_HFLAG_MMIO)
 	if (hwif->host_flags & IDE_HFLAG_MMIO)
@@ -340,6 +348,7 @@ static void ata_output_data(ide_drive_t *drive, struct request *rq,
 void default_hwif_transport(ide_hwif_t *hwif)
 void default_hwif_transport(ide_hwif_t *hwif)
 {
 {
 	hwif->exec_command	  = ide_exec_command;
 	hwif->exec_command	  = ide_exec_command;
+	hwif->read_status	  = ide_read_status;
 	hwif->read_sff_dma_status = ide_read_sff_dma_status;
 	hwif->read_sff_dma_status = ide_read_sff_dma_status;
 
 
 	hwif->tf_load	  = ide_tf_load;
 	hwif->tf_load	  = ide_tf_load;
@@ -505,7 +514,7 @@ int drive_is_ready (ide_drive_t *drive)
 		stat = ide_read_altstatus(drive);
 		stat = ide_read_altstatus(drive);
 	else
 	else
 		/* Note: this may clear a pending IRQ!! */
 		/* Note: this may clear a pending IRQ!! */
-		stat = ide_read_status(drive);
+		stat = hwif->read_status(hwif);
 
 
 	if (stat & BUSY_STAT)
 	if (stat & BUSY_STAT)
 		/* drive busy:  definitely not interrupting */
 		/* drive busy:  definitely not interrupting */
@@ -530,24 +539,25 @@ EXPORT_SYMBOL(drive_is_ready);
  */
  */
 static int __ide_wait_stat(ide_drive_t *drive, u8 good, u8 bad, unsigned long timeout, u8 *rstat)
 static int __ide_wait_stat(ide_drive_t *drive, u8 good, u8 bad, unsigned long timeout, u8 *rstat)
 {
 {
+	ide_hwif_t *hwif = drive->hwif;
 	unsigned long flags;
 	unsigned long flags;
 	int i;
 	int i;
 	u8 stat;
 	u8 stat;
 
 
 	udelay(1);	/* spec allows drive 400ns to assert "BUSY" */
 	udelay(1);	/* spec allows drive 400ns to assert "BUSY" */
-	stat = ide_read_status(drive);
+	stat = hwif->read_status(hwif);
 
 
 	if (stat & BUSY_STAT) {
 	if (stat & BUSY_STAT) {
 		local_irq_set(flags);
 		local_irq_set(flags);
 		timeout += jiffies;
 		timeout += jiffies;
-		while ((stat = ide_read_status(drive)) & BUSY_STAT) {
+		while ((stat = hwif->read_status(hwif)) & BUSY_STAT) {
 			if (time_after(jiffies, timeout)) {
 			if (time_after(jiffies, timeout)) {
 				/*
 				/*
 				 * One last read after the timeout in case
 				 * One last read after the timeout in case
 				 * heavy interrupt load made us not make any
 				 * heavy interrupt load made us not make any
 				 * progress during the timeout..
 				 * progress during the timeout..
 				 */
 				 */
-				stat = ide_read_status(drive);
+				stat = hwif->read_status(hwif);
 				if (!(stat & BUSY_STAT))
 				if (!(stat & BUSY_STAT))
 					break;
 					break;
 
 
@@ -567,7 +577,7 @@ static int __ide_wait_stat(ide_drive_t *drive, u8 good, u8 bad, unsigned long ti
 	 */
 	 */
 	for (i = 0; i < 10; i++) {
 	for (i = 0; i < 10; i++) {
 		udelay(1);
 		udelay(1);
-		stat = ide_read_status(drive);
+		stat = hwif->read_status(hwif);
 
 
 		if (OK_STAT(stat, good, bad)) {
 		if (OK_STAT(stat, good, bad)) {
 			*rstat = stat;
 			*rstat = stat;
@@ -718,7 +728,7 @@ int ide_driveid_update(ide_drive_t *drive)
 	} while (stat & BUSY_STAT);
 	} while (stat & BUSY_STAT);
 
 
 	msleep(50);	/* wait for IRQ and DRQ_STAT */
 	msleep(50);	/* wait for IRQ and DRQ_STAT */
-	stat = ide_read_status(drive);
+	stat = hwif->read_status(hwif);
 
 
 	if (!OK_STAT(stat, DRQ_STAT, BAD_R_STAT)) {
 	if (!OK_STAT(stat, DRQ_STAT, BAD_R_STAT)) {
 		SELECT_MASK(drive, 0);
 		SELECT_MASK(drive, 0);
@@ -733,7 +743,7 @@ int ide_driveid_update(ide_drive_t *drive)
 		return 0;
 		return 0;
 	}
 	}
 	hwif->input_data(drive, NULL, id, SECTOR_SIZE);
 	hwif->input_data(drive, NULL, id, SECTOR_SIZE);
-	(void)ide_read_status(drive);	/* clear drive IRQ */
+	(void)hwif->read_status(hwif);	/* clear drive IRQ */
 	local_irq_enable();
 	local_irq_enable();
 	local_irq_restore(flags);
 	local_irq_restore(flags);
 	ide_fix_driveid(id);
 	ide_fix_driveid(id);
@@ -943,12 +953,13 @@ static ide_startstop_t do_reset1 (ide_drive_t *, int);
  */
  */
 static ide_startstop_t atapi_reset_pollfunc (ide_drive_t *drive)
 static ide_startstop_t atapi_reset_pollfunc (ide_drive_t *drive)
 {
 {
-	ide_hwgroup_t *hwgroup	= HWGROUP(drive);
+	ide_hwif_t *hwif = drive->hwif;
+	ide_hwgroup_t *hwgroup = hwif->hwgroup;
 	u8 stat;
 	u8 stat;
 
 
 	SELECT_DRIVE(drive);
 	SELECT_DRIVE(drive);
 	udelay (10);
 	udelay (10);
-	stat = ide_read_status(drive);
+	stat = hwif->read_status(hwif);
 
 
 	if (OK_STAT(stat, 0, BUSY_STAT))
 	if (OK_STAT(stat, 0, BUSY_STAT))
 		printk("%s: ATAPI reset complete\n", drive->name);
 		printk("%s: ATAPI reset complete\n", drive->name);
@@ -994,7 +1005,7 @@ static ide_startstop_t reset_pollfunc (ide_drive_t *drive)
 		}
 		}
 	}
 	}
 
 
-	tmp = ide_read_status(drive);
+	tmp = hwif->read_status(hwif);
 
 
 	if (!OK_STAT(tmp, 0, BUSY_STAT)) {
 	if (!OK_STAT(tmp, 0, BUSY_STAT)) {
 		if (time_before(jiffies, hwgroup->poll_timeout)) {
 		if (time_before(jiffies, hwgroup->poll_timeout)) {
@@ -1208,7 +1219,7 @@ int ide_wait_not_busy(ide_hwif_t *hwif, unsigned long timeout)
 		 * about locking issues (2.5 work ?).
 		 * about locking issues (2.5 work ?).
 		 */
 		 */
 		mdelay(1);
 		mdelay(1);
-		stat = hwif->INB(hwif->io_ports.status_addr);
+		stat = hwif->read_status(hwif);
 		if ((stat & BUSY_STAT) == 0)
 		if ((stat & BUSY_STAT) == 0)
 			return 0;
 			return 0;
 		/*
 		/*

+ 11 - 11
drivers/ide/ide-probe.c

@@ -276,7 +276,7 @@ static int actual_try_to_identify (ide_drive_t *drive, u8 cmd)
 
 
 	if (io_ports->ctl_addr) {
 	if (io_ports->ctl_addr) {
 		a = ide_read_altstatus(drive);
 		a = ide_read_altstatus(drive);
-		s = ide_read_status(drive);
+		s = hwif->read_status(hwif);
 		if ((a ^ s) & ~INDEX_STAT)
 		if ((a ^ s) & ~INDEX_STAT)
 			/* ancient Seagate drives, broken interfaces */
 			/* ancient Seagate drives, broken interfaces */
 			printk(KERN_INFO "%s: probing with STATUS(0x%02x) "
 			printk(KERN_INFO "%s: probing with STATUS(0x%02x) "
@@ -307,12 +307,12 @@ static int actual_try_to_identify (ide_drive_t *drive, u8 cmd)
 		/* give drive a breather */
 		/* give drive a breather */
 		msleep(50);
 		msleep(50);
 		s = use_altstatus ? ide_read_altstatus(drive)
 		s = use_altstatus ? ide_read_altstatus(drive)
-				  : ide_read_status(drive);
+				  : hwif->read_status(hwif);
 	} while (s & BUSY_STAT);
 	} while (s & BUSY_STAT);
 
 
 	/* wait for IRQ and DRQ_STAT */
 	/* wait for IRQ and DRQ_STAT */
 	msleep(50);
 	msleep(50);
-	s = ide_read_status(drive);
+	s = hwif->read_status(hwif);
 
 
 	if (OK_STAT(s, DRQ_STAT, BAD_R_STAT)) {
 	if (OK_STAT(s, DRQ_STAT, BAD_R_STAT)) {
 		unsigned long flags;
 		unsigned long flags;
@@ -324,7 +324,7 @@ static int actual_try_to_identify (ide_drive_t *drive, u8 cmd)
 		/* drive responded with ID */
 		/* drive responded with ID */
 		rc = 0;
 		rc = 0;
 		/* clear drive IRQ */
 		/* clear drive IRQ */
-		(void)ide_read_status(drive);
+		(void)hwif->read_status(hwif);
 		local_irq_restore(flags);
 		local_irq_restore(flags);
 	} else {
 	} else {
 		/* drive refused ID */
 		/* drive refused ID */
@@ -371,7 +371,7 @@ static int try_to_identify (ide_drive_t *drive, u8 cmd)
 
 
 		ide_set_irq(drive, 0);
 		ide_set_irq(drive, 0);
 		/* clear drive IRQ */
 		/* clear drive IRQ */
-		(void)ide_read_status(drive);
+		(void)hwif->read_status(hwif);
 		udelay(5);
 		udelay(5);
 		irq = probe_irq_off(cookie);
 		irq = probe_irq_off(cookie);
 		if (!hwif->irq) {
 		if (!hwif->irq) {
@@ -396,7 +396,7 @@ static int ide_busy_sleep(ide_hwif_t *hwif)
 
 
 	do {
 	do {
 		msleep(50);
 		msleep(50);
-		stat = hwif->INB(hwif->io_ports.status_addr);
+		stat = hwif->read_status(hwif);
 		if ((stat & BUSY_STAT) == 0)
 		if ((stat & BUSY_STAT) == 0)
 			return 0;
 			return 0;
 	} while (time_before(jiffies, timeout));
 	} while (time_before(jiffies, timeout));
@@ -461,7 +461,7 @@ static int do_probe (ide_drive_t *drive, u8 cmd)
 		return 3;
 		return 3;
 	}
 	}
 
 
-	stat = ide_read_status(drive);
+	stat = hwif->read_status(hwif);
 
 
 	if (OK_STAT(stat, READY_STAT, BUSY_STAT) ||
 	if (OK_STAT(stat, READY_STAT, BUSY_STAT) ||
 	    drive->present || cmd == WIN_PIDENTIFY) {
 	    drive->present || cmd == WIN_PIDENTIFY) {
@@ -471,7 +471,7 @@ static int do_probe (ide_drive_t *drive, u8 cmd)
 			rc = try_to_identify(drive,cmd);
 			rc = try_to_identify(drive,cmd);
 		}
 		}
 
 
-		stat = ide_read_status(drive);
+		stat = hwif->read_status(hwif);
 
 
 		if (stat == (BUSY_STAT | READY_STAT))
 		if (stat == (BUSY_STAT | READY_STAT))
 			return 4;
 			return 4;
@@ -488,7 +488,7 @@ static int do_probe (ide_drive_t *drive, u8 cmd)
 		}
 		}
 
 
 		/* ensure drive IRQ is clear */
 		/* ensure drive IRQ is clear */
-		stat = ide_read_status(drive);
+		stat = hwif->read_status(hwif);
 
 
 		if (rc == 1)
 		if (rc == 1)
 			printk(KERN_ERR "%s: no response (status = 0x%02x)\n",
 			printk(KERN_ERR "%s: no response (status = 0x%02x)\n",
@@ -502,7 +502,7 @@ static int do_probe (ide_drive_t *drive, u8 cmd)
 		SELECT_DRIVE(&hwif->drives[0]);
 		SELECT_DRIVE(&hwif->drives[0]);
 		msleep(50);
 		msleep(50);
 		/* ensure drive irq is clear */
 		/* ensure drive irq is clear */
-		(void)ide_read_status(drive);
+		(void)hwif->read_status(hwif);
 	}
 	}
 	return rc;
 	return rc;
 }
 }
@@ -527,7 +527,7 @@ static void enable_nest (ide_drive_t *drive)
 
 
 	msleep(50);
 	msleep(50);
 
 
-	stat = ide_read_status(drive);
+	stat = hwif->read_status(hwif);
 
 
 	if (!OK_STAT(stat, 0, BAD_STAT))
 	if (!OK_STAT(stat, 0, BAD_STAT))
 		printk(KERN_CONT "failed (status = 0x%02x)\n", stat);
 		printk(KERN_CONT "failed (status = 0x%02x)\n", stat);

+ 4 - 2
drivers/ide/ide-tape.c

@@ -927,11 +927,12 @@ static void idetape_create_mode_sense_cmd(struct ide_atapi_pc *pc, u8 page_code)
 
 
 static ide_startstop_t idetape_media_access_finished(ide_drive_t *drive)
 static ide_startstop_t idetape_media_access_finished(ide_drive_t *drive)
 {
 {
+	ide_hwif_t *hwif = drive->hwif;
 	idetape_tape_t *tape = drive->driver_data;
 	idetape_tape_t *tape = drive->driver_data;
 	struct ide_atapi_pc *pc = tape->pc;
 	struct ide_atapi_pc *pc = tape->pc;
 	u8 stat;
 	u8 stat;
 
 
-	stat = ide_read_status(drive);
+	stat = hwif->read_status(hwif);
 
 
 	if (stat & SEEK_STAT) {
 	if (stat & SEEK_STAT) {
 		if (stat & ERR_STAT) {
 		if (stat & ERR_STAT) {
@@ -980,6 +981,7 @@ static void ide_tape_create_rw_cmd(idetape_tape_t *tape,
 static ide_startstop_t idetape_do_request(ide_drive_t *drive,
 static ide_startstop_t idetape_do_request(ide_drive_t *drive,
 					  struct request *rq, sector_t block)
 					  struct request *rq, sector_t block)
 {
 {
+	ide_hwif_t *hwif = drive->hwif;
 	idetape_tape_t *tape = drive->driver_data;
 	idetape_tape_t *tape = drive->driver_data;
 	struct ide_atapi_pc *pc = NULL;
 	struct ide_atapi_pc *pc = NULL;
 	struct request *postponed_rq = tape->postponed_rq;
 	struct request *postponed_rq = tape->postponed_rq;
@@ -1017,7 +1019,7 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive,
 	 * If the tape is still busy, postpone our request and service
 	 * If the tape is still busy, postpone our request and service
 	 * the other device meanwhile.
 	 * the other device meanwhile.
 	 */
 	 */
-	stat = ide_read_status(drive);
+	stat = hwif->read_status(hwif);
 
 
 	if (!drive->dsc_overlap && !(rq->cmd[0] & REQ_IDETAPE_PC2))
 	if (!drive->dsc_overlap && !(rq->cmd[0] & REQ_IDETAPE_PC2))
 		set_bit(IDETAPE_FLAG_IGNORE_DSC, &tape->flags);
 		set_bit(IDETAPE_FLAG_IGNORE_DSC, &tape->flags);

+ 14 - 9
drivers/ide/ide-taskfile.c

@@ -124,7 +124,8 @@ EXPORT_SYMBOL_GPL(do_rw_taskfile);
  */
  */
 static ide_startstop_t set_multmode_intr(ide_drive_t *drive)
 static ide_startstop_t set_multmode_intr(ide_drive_t *drive)
 {
 {
-	u8 stat = ide_read_status(drive);
+	ide_hwif_t *hwif = drive->hwif;
+	u8 stat = hwif->read_status(hwif);
 
 
 	if (OK_STAT(stat, READY_STAT, BAD_STAT))
 	if (OK_STAT(stat, READY_STAT, BAD_STAT))
 		drive->mult_count = drive->mult_req;
 		drive->mult_count = drive->mult_req;
@@ -141,10 +142,11 @@ static ide_startstop_t set_multmode_intr(ide_drive_t *drive)
  */
  */
 static ide_startstop_t set_geometry_intr(ide_drive_t *drive)
 static ide_startstop_t set_geometry_intr(ide_drive_t *drive)
 {
 {
+	ide_hwif_t *hwif = drive->hwif;
 	int retries = 5;
 	int retries = 5;
 	u8 stat;
 	u8 stat;
 
 
-	while (((stat = ide_read_status(drive)) & BUSY_STAT) && retries--)
+	while (((stat = hwif->read_status(hwif)) & BUSY_STAT) && retries--)
 		udelay(10);
 		udelay(10);
 
 
 	if (OK_STAT(stat, READY_STAT, BAD_STAT))
 	if (OK_STAT(stat, READY_STAT, BAD_STAT))
@@ -162,7 +164,8 @@ static ide_startstop_t set_geometry_intr(ide_drive_t *drive)
  */
  */
 static ide_startstop_t recal_intr(ide_drive_t *drive)
 static ide_startstop_t recal_intr(ide_drive_t *drive)
 {
 {
-	u8 stat = ide_read_status(drive);
+	ide_hwif_t *hwif = drive->hwif;
+	u8 stat = hwif->read_status(hwif);
 
 
 	if (!OK_STAT(stat, READY_STAT, BAD_STAT))
 	if (!OK_STAT(stat, READY_STAT, BAD_STAT))
 		return ide_error(drive, "recal_intr", stat);
 		return ide_error(drive, "recal_intr", stat);
@@ -174,11 +177,12 @@ static ide_startstop_t recal_intr(ide_drive_t *drive)
  */
  */
 static ide_startstop_t task_no_data_intr(ide_drive_t *drive)
 static ide_startstop_t task_no_data_intr(ide_drive_t *drive)
 {
 {
-	ide_task_t *args	= HWGROUP(drive)->rq->special;
+	ide_hwif_t *hwif = drive->hwif;
+	ide_task_t *args = hwif->hwgroup->rq->special;
 	u8 stat;
 	u8 stat;
 
 
 	local_irq_enable_in_hardirq();
 	local_irq_enable_in_hardirq();
-	stat = ide_read_status(drive);
+	stat = hwif->read_status(hwif);
 
 
 	if (!OK_STAT(stat, READY_STAT, BAD_STAT))
 	if (!OK_STAT(stat, READY_STAT, BAD_STAT))
 		return ide_error(drive, "task_no_data_intr", stat);
 		return ide_error(drive, "task_no_data_intr", stat);
@@ -192,6 +196,7 @@ static ide_startstop_t task_no_data_intr(ide_drive_t *drive)
 
 
 static u8 wait_drive_not_busy(ide_drive_t *drive)
 static u8 wait_drive_not_busy(ide_drive_t *drive)
 {
 {
+	ide_hwif_t *hwif = drive->hwif;
 	int retries;
 	int retries;
 	u8 stat;
 	u8 stat;
 
 
@@ -200,7 +205,7 @@ static u8 wait_drive_not_busy(ide_drive_t *drive)
 	 * take up to 6 ms on some ATAPI devices, so we will wait max 10 ms.
 	 * take up to 6 ms on some ATAPI devices, so we will wait max 10 ms.
 	 */
 	 */
 	for (retries = 0; retries < 1000; retries++) {
 	for (retries = 0; retries < 1000; retries++) {
-		stat = ide_read_status(drive);
+		stat = hwif->read_status(hwif);
 
 
 		if (stat & BUSY_STAT)
 		if (stat & BUSY_STAT)
 			udelay(10);
 			udelay(10);
@@ -383,8 +388,8 @@ static ide_startstop_t task_in_unexpected(ide_drive_t *drive, struct request *rq
 static ide_startstop_t task_in_intr(ide_drive_t *drive)
 static ide_startstop_t task_in_intr(ide_drive_t *drive)
 {
 {
 	ide_hwif_t *hwif = drive->hwif;
 	ide_hwif_t *hwif = drive->hwif;
-	struct request *rq = HWGROUP(drive)->rq;
-	u8 stat = ide_read_status(drive);
+	struct request *rq = hwif->hwgroup->rq;
+	u8 stat = hwif->read_status(hwif);
 
 
 	/* Error? */
 	/* Error? */
 	if (stat & ERR_STAT)
 	if (stat & ERR_STAT)
@@ -418,7 +423,7 @@ static ide_startstop_t task_out_intr (ide_drive_t *drive)
 {
 {
 	ide_hwif_t *hwif = drive->hwif;
 	ide_hwif_t *hwif = drive->hwif;
 	struct request *rq = HWGROUP(drive)->rq;
 	struct request *rq = HWGROUP(drive)->rq;
-	u8 stat = ide_read_status(drive);
+	u8 stat = hwif->read_status(hwif);
 
 
 	if (!OK_STAT(stat, DRIVE_READY, drive->bad_wstat))
 	if (!OK_STAT(stat, DRIVE_READY, drive->bad_wstat))
 		return task_error(drive, rq, __func__, stat);
 		return task_error(drive, rq, __func__, stat);

+ 7 - 1
drivers/ide/pci/ns87415.c

@@ -63,6 +63,11 @@ static u8 superio_ide_inb (unsigned long port)
 	return inb(port);
 	return inb(port);
 }
 }
 
 
+static u8 superio_read_status(ide_hwif_t *hwif)
+{
+	return superio_ide_inb(hwif->io_ports.status_addr);
+}
+
 static u8 superio_read_sff_dma_status(ide_hwif_t *hwif)
 static u8 superio_read_sff_dma_status(ide_hwif_t *hwif)
 {
 {
 	return superio_ide_inb(hwif->dma_base + ATA_DMA_STATUS);
 	return superio_ide_inb(hwif->dma_base + ATA_DMA_STATUS);
@@ -127,6 +132,7 @@ static void __devinit superio_ide_init_iops (struct hwif_s *hwif)
 	tmp = superio_ide_inb(superio_ide_dma_status[port]);
 	tmp = superio_ide_inb(superio_ide_dma_status[port]);
 	outb(tmp | 0x66, superio_ide_dma_status[port]);
 	outb(tmp | 0x66, superio_ide_dma_status[port]);
 
 
+	hwif->read_status	  = superio_read_status;
 	hwif->read_sff_dma_status = superio_read_sff_dma_status;
 	hwif->read_sff_dma_status = superio_read_sff_dma_status;
 
 
 	hwif->tf_read = superio_tf_read;
 	hwif->tf_read = superio_tf_read;
@@ -283,7 +289,7 @@ static void __devinit init_hwif_ns87415 (ide_hwif_t *hwif)
 		outb(8, hwif->io_ports.ctl_addr);
 		outb(8, hwif->io_ports.ctl_addr);
 		do {
 		do {
 			udelay(50);
 			udelay(50);
-			stat = hwif->INB(hwif->io_ports.status_addr);
+			stat = hwif->read_status(hwif);
                 	if (stat == 0xff)
                 	if (stat == 0xff)
                         	break;
                         	break;
         	} while ((stat & BUSY_STAT) && --timeout);
         	} while ((stat & BUSY_STAT) && --timeout);

+ 6 - 0
drivers/ide/pci/scc_pata.c

@@ -134,6 +134,11 @@ static void scc_exec_command(ide_hwif_t *hwif, u8 cmd)
 	eieio();
 	eieio();
 }
 }
 
 
+static u8 scc_read_status(ide_hwif_t *hwif)
+{
+	return (u8)in_be32((void *)hwif->io_ports.status_addr);
+}
+
 static u8 scc_read_sff_dma_status(ide_hwif_t *hwif)
 static u8 scc_read_sff_dma_status(ide_hwif_t *hwif)
 {
 {
 	return (u8)in_be32((void *)(hwif->dma_base + 4));
 	return (u8)in_be32((void *)(hwif->dma_base + 4));
@@ -788,6 +793,7 @@ static void __devinit init_mmio_iops_scc(ide_hwif_t *hwif)
 	ide_set_hwifdata(hwif, ports);
 	ide_set_hwifdata(hwif, ports);
 
 
 	hwif->exec_command	  = scc_exec_command;
 	hwif->exec_command	  = scc_exec_command;
+	hwif->read_status	  = scc_read_status;
 	hwif->read_sff_dma_status = scc_read_sff_dma_status;
 	hwif->read_sff_dma_status = scc_read_sff_dma_status;
 
 
 	hwif->tf_load = scc_tf_load;
 	hwif->tf_load = scc_tf_load;

+ 10 - 9
drivers/ide/pci/sgiioc4.c

@@ -127,7 +127,7 @@ sgiioc4_checkirq(ide_hwif_t * hwif)
 	return 0;
 	return 0;
 }
 }
 
 
-static u8 sgiioc4_INB(unsigned long);
+static u8 sgiioc4_read_status(ide_hwif_t *);
 
 
 static int
 static int
 sgiioc4_clearirq(ide_drive_t * drive)
 sgiioc4_clearirq(ide_drive_t * drive)
@@ -141,18 +141,19 @@ sgiioc4_clearirq(ide_drive_t * drive)
 	intr_reg = readl((void __iomem *)other_ir);
 	intr_reg = readl((void __iomem *)other_ir);
 	if (intr_reg & 0x03) { /* Valid IOC4-IDE interrupt */
 	if (intr_reg & 0x03) { /* Valid IOC4-IDE interrupt */
 		/*
 		/*
-		 * Using sgiioc4_INB to read the Status register has a side
-		 * effect of clearing the interrupt.  The first read should
+		 * Using sgiioc4_read_status to read the Status register has a
+		 * side effect of clearing the interrupt.  The first read should
 		 * clear it if it is set.  The second read should return
 		 * clear it if it is set.  The second read should return
 		 * a "clear" status if it got cleared.  If not, then spin
 		 * a "clear" status if it got cleared.  If not, then spin
 		 * for a bit trying to clear it.
 		 * for a bit trying to clear it.
 		 */
 		 */
-		u8 stat = sgiioc4_INB(io_ports->status_addr);
+		u8 stat = sgiioc4_read_status(hwif);
 		int count = 0;
 		int count = 0;
-		stat = sgiioc4_INB(io_ports->status_addr);
+
+		stat = sgiioc4_read_status(hwif);
 		while ((stat & 0x80) && (count++ < 100)) {
 		while ((stat & 0x80) && (count++ < 100)) {
 			udelay(1);
 			udelay(1);
-			stat = sgiioc4_INB(io_ports->status_addr);
+			stat = sgiioc4_read_status(hwif);
 		}
 		}
 
 
 		if (intr_reg & 0x02) {
 		if (intr_reg & 0x02) {
@@ -304,9 +305,9 @@ sgiioc4_dma_lost_irq(ide_drive_t * drive)
 	ide_dma_lost_irq(drive);
 	ide_dma_lost_irq(drive);
 }
 }
 
 
-static u8
-sgiioc4_INB(unsigned long port)
+static u8 sgiioc4_read_status(ide_hwif_t *hwif)
 {
 {
+	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 ((port & 0xFFF) == 0x11C) {	/* Status register of IOC4 */
@@ -628,7 +629,7 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev)
 	/* Initializing chipset IRQ Registers */
 	/* Initializing chipset IRQ Registers */
 	writel(0x03, (void __iomem *)(irqport + IOC4_INTR_SET * 4));
 	writel(0x03, (void __iomem *)(irqport + IOC4_INTR_SET * 4));
 
 
-	hwif->INB = &sgiioc4_INB;
+	hwif->read_status = sgiioc4_read_status;
 
 
 	idx[0] = hwif->index;
 	idx[0] = hwif->index;
 
 

+ 1 - 1
drivers/scsi/ide-scsi.c

@@ -246,7 +246,7 @@ idescsi_atapi_error(ide_drive_t *drive, struct request *rq, u8 stat, u8 err)
 {
 {
 	ide_hwif_t *hwif = drive->hwif;
 	ide_hwif_t *hwif = drive->hwif;
 
 
-	if (ide_read_status(drive) & (BUSY_STAT | DRQ_STAT))
+	if (hwif->read_status(hwif) & (BUSY_STAT | DRQ_STAT))
 		/* force an abort */
 		/* force an abort */
 		hwif->exec_command(hwif, WIN_IDLEIMMEDIATE);
 		hwif->exec_command(hwif, WIN_IDLEIMMEDIATE);
 
 

+ 1 - 7
include/linux/ide.h

@@ -490,6 +490,7 @@ typedef struct hwif_s {
 	const struct ide_dma_ops	*dma_ops;
 	const struct ide_dma_ops	*dma_ops;
 
 
 	void	(*exec_command)(struct hwif_s *, u8);
 	void	(*exec_command)(struct hwif_s *, u8);
+	u8	(*read_status)(struct hwif_s *);
 	u8	(*read_sff_dma_status)(struct hwif_s *);
 	u8	(*read_sff_dma_status)(struct hwif_s *);
 
 
 	void (*tf_load)(ide_drive_t *, struct ide_task_s *);
 	void (*tf_load)(ide_drive_t *, struct ide_task_s *);
@@ -1362,13 +1363,6 @@ static inline void ide_set_irq(ide_drive_t *drive, int on)
 		       hwif->io_ports.ctl_addr);
 		       hwif->io_ports.ctl_addr);
 }
 }
 
 
-static inline u8 ide_read_status(ide_drive_t *drive)
-{
-	ide_hwif_t *hwif = drive->hwif;
-
-	return hwif->INB(hwif->io_ports.status_addr);
-}
-
 static inline u8 ide_read_altstatus(ide_drive_t *drive)
 static inline u8 ide_read_altstatus(ide_drive_t *drive)
 {
 {
 	ide_hwif_t *hwif = drive->hwif;
 	ide_hwif_t *hwif = drive->hwif;