aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/sr.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-01-02 11:25:34 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-01-02 16:11:06 -0500
commitac40532ef0b8649e6f7f83859ea0de1c4ed08a19 (patch)
treeca86d577fe7fe68ae28b7f7d020f86bc9fff5535 /drivers/scsi/sr.c
parent158a962422e4a54dc256b6a9b9562f3d30d34d9c (diff)
scsi: revert "[SCSI] Get rid of scsi_cmnd->done"
This reverts commit 6f5391c283d7fdcf24bf40786ea79061919d1e1d ("[SCSI] Get rid of scsi_cmnd->done") that was supposed to be a cleanup commit, but apparently it causes regressions: Bug 9370 - v2.6.24-rc2-409-g9418d5d: attempt to access beyond end of device http://bugzilla.kernel.org/show_bug.cgi?id=9370 this patch should be reintroduced in a more split-up form to make testing of it easier. Signed-off-by: Ingo Molnar <mingo@elte.hu> Acked-by: Matthew Wilcox <matthew@wil.cx> Cc: James Bottomley <James.Bottomley@HansenPartnership.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/scsi/sr.c')
-rw-r--r--drivers/scsi/sr.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c
index c61999031141..a0c4e13d4dab 100644
--- a/drivers/scsi/sr.c
+++ b/drivers/scsi/sr.c
@@ -78,7 +78,6 @@ 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 *);
82 81
83static struct scsi_driver sr_template = { 82static struct scsi_driver sr_template = {
84 .owner = THIS_MODULE, 83 .owner = THIS_MODULE,
@@ -87,7 +86,6 @@ static struct scsi_driver sr_template = {
87 .probe = sr_probe, 86 .probe = sr_probe,
88 .remove = sr_remove, 87 .remove = sr_remove,
89 }, 88 },
90 .done = sr_done,
91}; 89};
92 90
93static unsigned long sr_index_bits[SR_DISKS / BITS_PER_LONG]; 91static unsigned long sr_index_bits[SR_DISKS / BITS_PER_LONG];
@@ -210,12 +208,12 @@ static int sr_media_change(struct cdrom_device_info *cdi, int slot)
210} 208}
211 209
212/* 210/*
213 * sr_done is the interrupt routine for the device driver. 211 * rw_intr is the interrupt routine for the device driver.
214 * 212 *
215 * It will be notified on the end of a SCSI read / write, and will take one 213 * It will be notified on the end of a SCSI read / write, and will take on
216 * of several actions based on success or failure. 214 * of several actions based on success or failure.
217 */ 215 */
218static int sr_done(struct scsi_cmnd *SCpnt) 216static void rw_intr(struct scsi_cmnd * SCpnt)
219{ 217{
220 int result = SCpnt->result; 218 int result = SCpnt->result;
221 int this_count = SCpnt->request_bufflen; 219 int this_count = SCpnt->request_bufflen;
@@ -288,7 +286,12 @@ static int sr_done(struct scsi_cmnd *SCpnt)
288 } 286 }
289 } 287 }
290 288
291 return good_bytes; 289 /*
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);
292} 295}
293 296
294static int sr_prep_fn(struct request_queue *q, struct request *rq) 297static int sr_prep_fn(struct request_queue *q, struct request *rq)
@@ -425,6 +428,12 @@ static int sr_prep_fn(struct request_queue *q, struct request *rq)
425 SCpnt->timeout_per_command = timeout; 428 SCpnt->timeout_per_command = timeout;
426 429
427 /* 430 /*
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 /*
428 * This indicates that the command is ready from our end to be 437 * This indicates that the command is ready from our end to be
429 * queued. 438 * queued.
430 */ 439 */