aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-02-02 19:56:45 +0100
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-02-02 19:56:45 +0100
commit57b552757314cf3f2253f07629f49016be6fa6c3 (patch)
tree61088b5a722d0ee321e97bd785eb91f008bb5bb5
parentb187dfeed3be2fc879e904ed0b01d490d8866760 (diff)
ide-probe: remove needless Status register reads
* Cache value read from the Status register in 'stat' variable in do_probe() and enable_nest(), then remove remove needless Status register reads. While at it: * Add proper KERN_* levels to printk() calls. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
-rw-r--r--drivers/ide/ide-probe.c35
1 files changed, 21 insertions, 14 deletions
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index c8d533a1015..9c07bdb68d1 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -423,8 +423,9 @@ static int ide_busy_sleep(ide_hwif_t *hwif)
static int do_probe (ide_drive_t *drive, u8 cmd)
{
- int rc;
ide_hwif_t *hwif = HWIF(drive);
+ int rc;
+ u8 stat;
if (drive->present) {
/* avoid waiting for inappropriate probes */
@@ -461,15 +462,17 @@ static int do_probe (ide_drive_t *drive, u8 cmd)
/* failed: try again */
rc = try_to_identify(drive,cmd);
}
- if (hwif->INB(IDE_STATUS_REG) == (BUSY_STAT|READY_STAT))
+
+ stat = hwif->INB(IDE_STATUS_REG);
+
+ if (stat == (BUSY_STAT | READY_STAT))
return 4;
if ((rc == 1 && cmd == WIN_PIDENTIFY) &&
((drive->autotune == IDE_TUNE_DEFAULT) ||
(drive->autotune == IDE_TUNE_AUTO))) {
- printk("%s: no response (status = 0x%02x), "
- "resetting drive\n", drive->name,
- hwif->INB(IDE_STATUS_REG));
+ printk(KERN_ERR "%s: no response (status = 0x%02x), "
+ "resetting drive\n", drive->name, stat);
msleep(50);
hwif->OUTB(drive->select.all, IDE_SELECT_REG);
msleep(50);
@@ -477,11 +480,13 @@ static int do_probe (ide_drive_t *drive, u8 cmd)
(void)ide_busy_sleep(hwif);
rc = try_to_identify(drive, cmd);
}
+
+ /* ensure drive IRQ is clear */
+ stat = hwif->INB(IDE_STATUS_REG);
+
if (rc == 1)
- printk("%s: no response (status = 0x%02x)\n",
- drive->name, hwif->INB(IDE_STATUS_REG));
- /* ensure drive irq is clear */
- (void) hwif->INB(IDE_STATUS_REG);
+ printk(KERN_ERR "%s: no response (status = 0x%02x)\n",
+ drive->name, stat);
} else {
/* not present or maybe ATAPI */
rc = 3;
@@ -502,6 +507,7 @@ static int do_probe (ide_drive_t *drive, u8 cmd)
static void enable_nest (ide_drive_t *drive)
{
ide_hwif_t *hwif = HWIF(drive);
+ u8 stat;
printk("%s: enabling %s -- ", hwif->name, drive->id->model);
SELECT_DRIVE(drive);
@@ -515,11 +521,12 @@ static void enable_nest (ide_drive_t *drive)
msleep(50);
- if (!OK_STAT((hwif->INB(IDE_STATUS_REG)), 0, BAD_STAT)) {
- printk("failed (status = 0x%02x)\n", hwif->INB(IDE_STATUS_REG));
- } else {
- printk("success\n");
- }
+ stat = hwif->INB(IDE_STATUS_REG);
+
+ if (!OK_STAT(stat, 0, BAD_STAT))
+ printk(KERN_CONT "failed (status = 0x%02x)\n", stat);
+ else
+ printk(KERN_CONT "success\n");
/* if !(success||timed-out) */
if (do_probe(drive, WIN_IDENTIFY) >= 2) {