Commit 41c8a0e4 authored by James Bottomley's avatar James Bottomley

Merge

parents fce4e14a cbfec645
......@@ -514,6 +514,12 @@ void scsi_io_completion(Scsi_Cmnd * SCpnt, int good_sectors,
}
}
if (blk_pc_request(req)) {
req->errors = result & 0xff;
if (!result)
req->data_len -= SCpnt->bufflen;
}
/*
* Zero these out. They now point to freed memory, and it is
* dangerous to hang onto the pointers.
......@@ -527,7 +533,7 @@ void scsi_io_completion(Scsi_Cmnd * SCpnt, int good_sectors,
* Next deal with any sectors which we were able to correctly
* handle.
*/
if (good_sectors > 0) {
if (good_sectors >= 0) {
SCSI_LOG_HLCOMPLETE(1, printk("%ld sectors total, %d sectors done.\n",
req->nr_sectors, good_sectors));
SCSI_LOG_HLCOMPLETE(1, printk("use_sg is %d\n ", SCpnt->use_sg));
......
......@@ -299,6 +299,8 @@ static int sd_init_command(struct scsi_cmnd * SCpnt)
if (rq->timeout)
timeout = rq->timeout;
SCpnt->transfersize = rq->data_len;
SCpnt->underflow = rq->data_len;
goto queue;
}
......@@ -422,10 +424,10 @@ static int sd_init_command(struct scsi_cmnd * SCpnt)
* host adapter, it's safe to assume that we can at least transfer
* this many bytes between each connect / disconnect.
*/
queue:
SCpnt->transfersize = sdp->sector_size;
SCpnt->underflow = this_count << 9;
queue:
SCpnt->allowed = SD_MAX_RETRIES;
SCpnt->timeout_per_command = timeout;
......
......@@ -284,6 +284,8 @@ static int sr_init_command(struct scsi_cmnd * SCpnt)
if (rq->timeout)
timeout = rq->timeout;
SCpnt->transfersize = rq->data_len;
SCpnt->underflow = rq->data_len;
goto queue;
}
......@@ -359,10 +361,10 @@ static int sr_init_command(struct scsi_cmnd * SCpnt)
* host adapter, it's safe to assume that we can at least transfer
* this many bytes between each connect / disconnect.
*/
queue:
SCpnt->transfersize = cd->device->sector_size;
SCpnt->underflow = this_count << 9;
queue:
SCpnt->allowed = MAX_RETRIES;
SCpnt->timeout_per_command = timeout;
......
......@@ -159,13 +159,11 @@ int sr_do_ioctl(Scsi_CD *cd, struct cdrom_generic_command *cgc)
if (!cgc->quiet)
printk(KERN_ERR "%s: CDROM (ioctl) reports ILLEGAL "
"REQUEST.\n", cd->cdi.name);
err = -EIO;
if (SRpnt->sr_sense_buffer[12] == 0x20 &&
SRpnt->sr_sense_buffer[13] == 0x00) {
SRpnt->sr_sense_buffer[13] == 0x00)
/* sense: Invalid command operation code */
err = -EDRIVE_CANT_DO_THIS;
} else {
err = -EINVAL;
}
#ifdef DEBUG
print_command(cgc->cmd);
print_req_sense("sr", SRpnt);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment