summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/sd.c
diff options
context:
space:
mode:
authorJames Bottomley <jejb@titanic.(none)>2005-09-06 17:52:54 -0500
committerJames Bottomley <jejb@titanic.(none)>2005-09-06 17:52:54 -0500
commit17fa53da1239b8712c5cebbd72a74c713b6c2db9 (patch)
tree8cf55e47ce681a6c899ccf8e06abeccecb20d38b /drivers/scsi/sd.c
parent3173d8c342971a03857d8af749a3f57da7d06b57 (diff)
parentfe1b2d544d71300f8e2d151c3c77a130d13a58be (diff)
downloadblackbird-op-linux-17fa53da1239b8712c5cebbd72a74c713b6c2db9.tar.gz
blackbird-op-linux-17fa53da1239b8712c5cebbd72a74c713b6c2db9.zip
Merge by hand (conflicts in sd.c)
Diffstat (limited to 'drivers/scsi/sd.c')
-rw-r--r--drivers/scsi/sd.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 611ccde84778..de564b386052 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -972,7 +972,7 @@ static void
sd_spinup_disk(struct scsi_disk *sdkp, char *diskname)
{
unsigned char cmd[10];
- unsigned long spintime_value = 0;
+ unsigned long spintime_expire = 0;
int retries, spintime;
unsigned int the_result;
struct scsi_sense_hdr sshdr;
@@ -1049,12 +1049,27 @@ sd_spinup_disk(struct scsi_disk *sdkp, char *diskname)
scsi_execute_req(sdkp->device, cmd, DMA_NONE,
NULL, 0, &sshdr,
SD_TIMEOUT, SD_MAX_RETRIES);
- spintime_value = jiffies;
+ spintime_expire = jiffies + 100 * HZ;
+ spintime = 1;
}
- spintime = 1;
/* Wait 1 second for next try */
msleep(1000);
printk(".");
+
+ /*
+ * Wait for USB flash devices with slow firmware.
+ * Yes, this sense key/ASC combination shouldn't
+ * occur here. It's characteristic of these devices.
+ */
+ } else if (sense_valid &&
+ sshdr.sense_key == UNIT_ATTENTION &&
+ sshdr.asc == 0x28) {
+ if (!spintime) {
+ spintime_expire = jiffies + 5 * HZ;
+ spintime = 1;
+ }
+ /* Wait 1 second for next try */
+ msleep(1000);
} else {
/* we don't understand the sense code, so it's
* probably pointless to loop */
@@ -1066,8 +1081,7 @@ sd_spinup_disk(struct scsi_disk *sdkp, char *diskname)
break;
}
- } while (spintime &&
- time_after(spintime_value + 100 * HZ, jiffies));
+ } while (spintime && time_before_eq(jiffies, spintime_expire));
if (spintime) {
if (scsi_status_is_good(the_result))
OpenPOWER on IntegriCloud