pata_bf54x: decrease count first.
authorRoel Kluin <12o3l@tiscali.nl>
Fri, 25 Apr 2008 03:37:54 +0000 (11:37 +0800)
committerJeff Garzik <jgarzik@redhat.com>
Fri, 25 Apr 2008 05:26:28 +0000 (01:26 -0400)
When count reaches 0 the postfix decrement still subtracts (to -1),
so bfin_reset_controller() returns as if the busy flag was cleared
while it was not.

Signed-off-by: Roel Kluin <12o3l@tiscali.nl>
Acked-by: Sonic Zhang <sonic.zhang@analog.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
drivers/ata/pata_bf54x.c

index e4cf73c4b70baf51582a28d6f663640ae0d41822..a75de0684c15cff77f21728fd36af031e7867b2c 100644 (file)
@@ -1417,7 +1417,7 @@ static int bfin_reset_controller(struct ata_host *host)
        count = 10000000;
        do {
                status = read_atapi_register(base, ATA_REG_STATUS);
-       } while (count-- && (status & ATA_BUSY));
+       } while (--count && (status & ATA_BUSY));
 
        /* Enable only ATAPI Device interrupt */
        ATAPI_SET_INT_MASK(base, 1);