aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/sr.c
diff options
context:
space:
mode:
authorMatthew Wilcox <matthew@wil.cx>2007-09-25 12:42:04 -0400
committerJames Bottomley <jejb@mulgrave.localdomain>2007-10-12 14:52:46 -0400
commit6f5391c283d7fdcf24bf40786ea79061919d1e1d (patch)
tree32ee9abddf9879445792019e1c03bcd28ce6bd4f /drivers/scsi/sr.c
parent687d2bc4877081a44c41b5b312e012cc69edda53 (diff)
[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>
Diffstat (limited to 'drivers/scsi/sr.c')
-rw-r--r--drivers/scsi/sr.c21
1 files changed, 6 insertions, 15 deletions
diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c
index a0c4e13d4dab..c61999031141 100644
--- a/drivers/scsi/sr.c
+++ b/drivers/scsi/sr.c
@@ -78,6 +78,7 @@ MODULE_ALIAS_SCSI_DEVICE(TYPE_WORM);
78 78
79static int sr_probe(struct device *); 79static int sr_probe(struct device *);
80static int sr_remove(struct device *); 80static int sr_remove(struct device *);
81static int sr_done(struct scsi_cmnd *);
81 82
82static struct scsi_driver sr_template = { 83static struct scsi_driver sr_template = {
83 .owner = THIS_MODULE, 84 .owner = THIS_MODULE,
@@ -86,6 +87,7 @@ static struct scsi_driver sr_template = {
86 .probe = sr_probe, 87 .probe = sr_probe,
87 .remove = sr_remove, 88 .remove = sr_remove,
88 }, 89 },
90 .done = sr_done,
89}; 91};
90 92
91static unsigned long sr_index_bits[SR_DISKS / BITS_PER_LONG]; 93static 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)
208} 210}
209 211
210/* 212/*
211 * rw_intr is the interrupt routine for the device driver. 213 * sr_done is the interrupt routine for the device driver.
212 * 214 *
213 * It will be notified on the end of a SCSI read / write, and will take on 215 * It will be notified on the end of a SCSI read / write, and will take one
214 * of several actions based on success or failure. 216 * of several actions based on success or failure.
215 */ 217 */
216static void rw_intr(struct scsi_cmnd * SCpnt) 218static int sr_done(struct scsi_cmnd *SCpnt)
217{ 219{
218 int result = SCpnt->result; 220 int result = SCpnt->result;
219 int this_count = SCpnt->request_bufflen; 221 int this_count = SCpnt->request_bufflen;
@@ -286,12 +288,7 @@ static void rw_intr(struct scsi_cmnd * SCpnt)
286 } 288 }
287 } 289 }
288 290
289 /* 291 return good_bytes;
290 * This calls the generic completion function, now that we know
291 * how many actual sectors finished, and how many sectors we need
292 * to say have failed.
293 */
294 scsi_io_completion(SCpnt, good_bytes);
295} 292}
296 293
297static int sr_prep_fn(struct request_queue *q, struct request *rq) 294static int sr_prep_fn(struct request_queue *q, struct request *rq)
@@ -428,12 +425,6 @@ static int sr_prep_fn(struct request_queue *q, struct request *rq)
428 SCpnt->timeout_per_command = timeout; 425 SCpnt->timeout_per_command = timeout;
429 426
430 /* 427 /*
431 * This is the completion routine we use. This is matched in terms
432 * of capability to this function.
433 */
434 SCpnt->done = rw_intr;
435
436 /*
437 * This indicates that the command is ready from our end to be 428 * This indicates that the command is ready from our end to be
438 * queued. 429 * queued.
439 */ 430 */