[SCSI] Get rid of scsi_cmnd->done
The ULD ->done callback moves into the scsi_driver. By moving the call to scsi_io_completion() from scsi_blk_pc_done() to scsi_finish_command(), we can eliminate the latter entirely. By returning 'good_bytes' from the ->done callback (rather than invoking scsi_io_completion()), we can stop exporting scsi_io_completion(). Also move the prototypes from sd.h to sd.c as they're all internal anyway. Rename sd_rw_intr to sd_done and rw_intr to sr_done. Inspired-by: Christoph Hellwig <hch@infradead.org> Signed-off-by: Matthew Wilcox <willy@linux.intel.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
This commit is contained in:
committed by
James Bottomley
parent
687d2bc487
commit
6f5391c283
@ -78,6 +78,7 @@ MODULE_ALIAS_SCSI_DEVICE(TYPE_WORM);
|
||||
|
||||
static int sr_probe(struct device *);
|
||||
static int sr_remove(struct device *);
|
||||
static int sr_done(struct scsi_cmnd *);
|
||||
|
||||
static struct scsi_driver sr_template = {
|
||||
.owner = THIS_MODULE,
|
||||
@ -86,6 +87,7 @@ static struct scsi_driver sr_template = {
|
||||
.probe = sr_probe,
|
||||
.remove = sr_remove,
|
||||
},
|
||||
.done = sr_done,
|
||||
};
|
||||
|
||||
static unsigned long sr_index_bits[SR_DISKS / BITS_PER_LONG];
|
||||
@ -208,12 +210,12 @@ static int sr_media_change(struct cdrom_device_info *cdi, int slot)
|
||||
}
|
||||
|
||||
/*
|
||||
* rw_intr is the interrupt routine for the device driver.
|
||||
* sr_done is the interrupt routine for the device driver.
|
||||
*
|
||||
* It will be notified on the end of a SCSI read / write, and will take on
|
||||
* It will be notified on the end of a SCSI read / write, and will take one
|
||||
* of several actions based on success or failure.
|
||||
*/
|
||||
static void rw_intr(struct scsi_cmnd * SCpnt)
|
||||
static int sr_done(struct scsi_cmnd *SCpnt)
|
||||
{
|
||||
int result = SCpnt->result;
|
||||
int this_count = SCpnt->request_bufflen;
|
||||
@ -286,12 +288,7 @@ static void rw_intr(struct scsi_cmnd * SCpnt)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* This calls the generic completion function, now that we know
|
||||
* how many actual sectors finished, and how many sectors we need
|
||||
* to say have failed.
|
||||
*/
|
||||
scsi_io_completion(SCpnt, good_bytes);
|
||||
return good_bytes;
|
||||
}
|
||||
|
||||
static int sr_prep_fn(struct request_queue *q, struct request *rq)
|
||||
@ -427,12 +424,6 @@ static int sr_prep_fn(struct request_queue *q, struct request *rq)
|
||||
SCpnt->allowed = MAX_RETRIES;
|
||||
SCpnt->timeout_per_command = timeout;
|
||||
|
||||
/*
|
||||
* This is the completion routine we use. This is matched in terms
|
||||
* of capability to this function.
|
||||
*/
|
||||
SCpnt->done = rw_intr;
|
||||
|
||||
/*
|
||||
* This indicates that the command is ready from our end to be
|
||||
* queued.
|
||||
|
Reference in New Issue
Block a user