Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=57b552757314cf3f2253f07629f49016be6fa6c3
Commit:     57b552757314cf3f2253f07629f49016be6fa6c3
Parent:     b187dfeed3be2fc879e904ed0b01d490d8866760
Author:     Bartlomiej Zolnierkiewicz <[EMAIL PROTECTED]>
AuthorDate: Sat Feb 2 19:56:45 2008 +0100
Committer:  Bartlomiej Zolnierkiewicz <[EMAIL PROTECTED]>
CommitDate: Sat Feb 2 19:56:45 2008 +0100

    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 <[EMAIL PROTECTED]>
---
 drivers/ide/ide-probe.c |   35 +++++++++++++++++++++--------------
 1 files changed, 21 insertions(+), 14 deletions(-)

diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index c8d533a..9c07bdb 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) {
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to