Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 7744
b: refs/heads/master
c: 4451e47
h: refs/heads/master
v: v3
  • Loading branch information
Alan Stern authored and James Bottomley committed Sep 6, 2005
1 parent e5c3c27 commit 3c4a920
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e47373ec1c9aab9ee134f4e2b8249957e9f4c7ef
refs/heads/master: 4451e472627881e3e2240b224f127c99be500f91
24 changes: 19 additions & 5 deletions trunk/drivers/scsi/sd.c
Original file line number Diff line number Diff line change
Expand Up @@ -984,7 +984,7 @@ static void
sd_spinup_disk(struct scsi_disk *sdkp, char *diskname,
struct scsi_request *SRpnt, unsigned char *buffer) {
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;
Expand Down Expand Up @@ -1071,12 +1071,27 @@ sd_spinup_disk(struct scsi_disk *sdkp, char *diskname,
scsi_wait_req(SRpnt, (void *)cmd,
(void *) buffer, 0/*512*/,
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 */
Expand All @@ -1088,8 +1103,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))
Expand Down

0 comments on commit 3c4a920

Please sign in to comment.