aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-02-02 13:56:45 -0500
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-02-02 13:56:45 -0500
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 c8d533a1015e..9c07bdb68d1a 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)
423 423
424static int do_probe (ide_drive_t *drive, u8 cmd) 424static int do_probe (ide_drive_t *drive, u8 cmd)
425{ 425{
426 int rc;
427 ide_hwif_t *hwif = HWIF(drive); 426 ide_hwif_t *hwif = HWIF(drive);
427 int rc;
428 u8 stat;
428 429
429 if (drive->present) { 430 if (drive->present) {
430 /* avoid waiting for inappropriate probes */ 431 /* avoid waiting for inappropriate probes */
@@ -461,15 +462,17 @@ static int do_probe (ide_drive_t *drive, u8 cmd)
461 /* failed: try again */ 462 /* failed: try again */
462 rc = try_to_identify(drive,cmd); 463 rc = try_to_identify(drive,cmd);
463 } 464 }
464 if (hwif->INB(IDE_STATUS_REG) == (BUSY_STAT|READY_STAT)) 465
466 stat = hwif->INB(IDE_STATUS_REG);
467
468 if (stat == (BUSY_STAT | READY_STAT))
465 return 4; 469 return 4;
466 470
467 if ((rc == 1 && cmd == WIN_PIDENTIFY) && 471 if ((rc == 1 && cmd == WIN_PIDENTIFY) &&
468 ((drive->autotune == IDE_TUNE_DEFAULT) || 472 ((drive->autotune == IDE_TUNE_DEFAULT) ||
469 (drive->autotune == IDE_TUNE_AUTO))) { 473 (drive->autotune == IDE_TUNE_AUTO))) {
470 printk("%s: no response (status = 0x%02x), " 474 printk(KERN_ERR "%s: no response (status = 0x%02x), "
471 "resetting drive\n", drive->name, 475 "resetting drive\n", drive->name, stat);
472 hwif->INB(IDE_STATUS_REG));
473 msleep(50); 476 msleep(50);
474 hwif->OUTB(drive->select.all, IDE_SELECT_REG); 477 hwif->OUTB(drive->select.all, IDE_SELECT_REG);
475 msleep(50); 478 msleep(50);
@@ -477,11 +480,13 @@ static int do_probe (ide_drive_t *drive, u8 cmd)
477 (void)ide_busy_sleep(hwif); 480 (void)ide_busy_sleep(hwif);
478 rc = try_to_identify(drive, cmd); 481 rc = try_to_identify(drive, cmd);
479 } 482 }
483
484 /* ensure drive IRQ is clear */
485 stat = hwif->INB(IDE_STATUS_REG);
486
480 if (rc == 1) 487 if (rc == 1)
481 printk("%s: no response (status = 0x%02x)\n", 488 printk(KERN_ERR "%s: no response (status = 0x%02x)\n",
482 drive->name, hwif->INB(IDE_STATUS_REG)); 489 drive->name, stat);
483 /* ensure drive irq is clear */
484 (void) hwif->INB(IDE_STATUS_REG);
485 } else { 490 } else {
486 /* not present or maybe ATAPI */ 491 /* not present or maybe ATAPI */
487 rc = 3; 492 rc = 3;
@@ -502,6 +507,7 @@ static int do_probe (ide_drive_t *drive, u8 cmd)
502static void enable_nest (ide_drive_t *drive) 507static void enable_nest (ide_drive_t *drive)
503{ 508{
504 ide_hwif_t *hwif = HWIF(drive); 509 ide_hwif_t *hwif = HWIF(drive);
510 u8 stat;
505 511
506 printk("%s: enabling %s -- ", hwif->name, drive->id->model); 512 printk("%s: enabling %s -- ", hwif->name, drive->id->model);
507 SELECT_DRIVE(drive); 513 SELECT_DRIVE(drive);
@@ -515,11 +521,12 @@ static void enable_nest (ide_drive_t *drive)
515 521
516 msleep(50); 522 msleep(50);
517 523
518 if (!OK_STAT((hwif->INB(IDE_STATUS_REG)), 0, BAD_STAT)) { 524 stat = hwif->INB(IDE_STATUS_REG);
519 printk("failed (status = 0x%02x)\n", hwif->INB(IDE_STATUS_REG)); 525
520 } else { 526 if (!OK_STAT(stat, 0, BAD_STAT))
521 printk("success\n"); 527 printk(KERN_CONT "failed (status = 0x%02x)\n", stat);
522 } 528 else
529 printk(KERN_CONT "success\n");
523 530
524 /* if !(success||timed-out) */ 531 /* if !(success||timed-out) */
525 if (do_probe(drive, WIN_IDENTIFY) >= 2) { 532 if (do_probe(drive, WIN_IDENTIFY) >= 2) {