libata: fix sata_link_hardreset() @online out parameter handling
authorTejun Heo <htejun@gmail.com>
Sun, 18 May 2008 16:15:05 +0000 (01:15 +0900)
committerJeff Garzik <jgarzik@redhat.com>
Mon, 19 May 2008 21:51:47 +0000 (17:51 -0400)
The @online out parameter is supposed to set to true iff link is
online and reset succeeded as advertised in the function description
and callers are coded expecting that.  However, sata_link_reset()
didn't behave this way on device readiness test failure.  Fix it.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
drivers/ata/libata-core.c

index 927b692..c6c316f 100644 (file)
@@ -3653,9 +3653,13 @@ int sata_link_hardreset(struct ata_link *link, const unsigned long *timing,
        if (check_ready)
                rc = ata_wait_ready(link, deadline, check_ready);
  out:
-       if (rc && rc != -EAGAIN)
+       if (rc && rc != -EAGAIN) {
+               /* online is set iff link is online && reset succeeded */
+               if (online)
+                       *online = false;
                ata_link_printk(link, KERN_ERR,
                                "COMRESET failed (errno=%d)\n", rc);
+       }
        DPRINTK("EXIT, rc=%d\n", rc);
        return rc;
 }