Skip to contentSkip to conversation

blackfin: bfin_reset_controller() busy flag appears cleared when it is not

PATCH In review Roel Kluin 2 participants 2 messages Apr 9, 2008 – Apr 10, 2008 libata

lore
Share & tools
lore

Roel Kluin

author
#0 lore raw

PATCH 1/1 blackfin: bfin_reset_controller() busy flag appears cleared when it is not

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.

---

drivers/ata/pata_bf54x.c +1 -1
index 7f87f10..4208c49 100644
@@ -1442,15 +1442,15 @@ static int bfin_reset_controller(struct ata_host *host)
 	ATAPI_SET_CONTROL(base, ATAPI_GET_CONTROL(base) & ~DEV_RST);
 	msleep(2);
 
 	/* Wait on Busy flag to clear */
 	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);
 	SSYNC();
 
 	return (!count);
 }
Acked-by on v1 1/1
#1 lore raw

-----Original Message-----
From: Roel Kluin [mailto:[email protected]]
Sent: Wednesday, April 09, 2008 5:43 PM
To: [email protected]
Cc: [email protected]; lkml
Subject: [PATCH] blackfin: bfin_reset_controller() busy flag appears cleared when it is not

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.

---

drivers/ata/pata_bf54x.c index renamed from drivers/ata/pata_bf54x.c +0 -0

7f87f10..4208c49 100644

drivers/ata/pata_bf54x.c +0 -0
@@ -1442,15 +1442,15 @@ static int bfin_reset_controller(struct ata_host

*host)
ATAPI_SET_CONTROL(base, ATAPI_GET_CONTROL(base) & ~DEV_RST); msleep(2);

/* Wait on Busy flag to clear */
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);
SSYNC();

return (!count);
}