libata: fix timing computation in ata_eh_reset()
authorTejun Heo <htejun@gmail.com>
Wed, 31 Oct 2007 01:17:02 +0000 (10:17 +0900)
committerJeff Garzik <jeff@garzik.org>
Sat, 3 Nov 2007 12:46:54 +0000 (08:46 -0400)
As jiffies changes asynchronously, it needs to be cached if unchanging
timestamp is needed.  The code in ata_eh_reset() intended to do that
with @now but never actually did it.  Fix it.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
drivers/ata/libata-eh.c

index 8d64f8fd8f1d55a9a322f22112bff1392482302e..53b2348a364da742296a5be647a78c9d47f680fd 100644 (file)
@@ -2204,7 +2204,7 @@ int ata_eh_reset(struct ata_link *link, int classify,
                unsigned long now = jiffies;
 
                if (time_before(now, deadline)) {
-                       unsigned long delta = deadline - jiffies;
+                       unsigned long delta = deadline - now;
 
                        ata_link_printk(link, KERN_WARNING, "reset failed "
                                "(errno=%d), retrying in %u secs\n",