#include <linux/blkdev.h>
#include <linux/blkpg.h>
#include <linux/kref.h>
+#include <linux/delay.h>
#include <asm/uaccess.h>
#include <scsi/scsi.h>
* Issue command to spin up drive when not ready
*/
} else if (SRpnt->sr_sense_buffer[2] == NOT_READY) {
- unsigned long time1;
if (!spintime) {
printk(KERN_NOTICE "%s: Spinning up disk...",
diskname);
spintime_value = jiffies;
}
spintime = 1;
- time1 = HZ;
/* Wait 1 second for next try */
- do {
- current->state = TASK_UNINTERRUPTIBLE;
- time1 = schedule_timeout(time1);
- } while(time1);
+ msleep(1000);
printk(".");
} else {
/* we don't understand the sense code, so it's
(buffer[9] << 16) | (buffer[10] << 8) | buffer[11];
}
+ /* Some devices return the total number of sectors, not the
+ * highest sector number. Make the necessary adjustment. */
+ if (sdp->fix_capacity)
+ --sdkp->capacity;
+
got_data:
if (sector_size == 0) {
sector_size = 512;