aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/sd.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/sd.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/sd.c')
-rw-r--r--drivers/scsi/sd.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 38a41415004b..0a3a528212c2 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -86,6 +86,19 @@ MODULE_ALIAS_SCSI_DEVICE(TYPE_DISK);
86MODULE_ALIAS_SCSI_DEVICE(TYPE_MOD); 86MODULE_ALIAS_SCSI_DEVICE(TYPE_MOD);
87MODULE_ALIAS_SCSI_DEVICE(TYPE_RBC); 87MODULE_ALIAS_SCSI_DEVICE(TYPE_RBC);
88 88
89static int sd_revalidate_disk(struct gendisk *);
90static int sd_probe(struct device *);
91static int sd_remove(struct device *);
92static void sd_shutdown(struct device *);
93static int sd_suspend(struct device *, pm_message_t state);
94static int sd_resume(struct device *);
95static void sd_rescan(struct device *);
96static int sd_done(struct scsi_cmnd *);
97static void sd_read_capacity(struct scsi_disk *sdkp, unsigned char *buffer);
98static void scsi_disk_release(struct class_device *cdev);
99static void sd_print_sense_hdr(struct scsi_disk *, struct scsi_sense_hdr *);
100static void sd_print_result(struct scsi_disk *, int);
101
89static DEFINE_IDR(sd_index_idr); 102static DEFINE_IDR(sd_index_idr);
90static DEFINE_SPINLOCK(sd_index_lock); 103static DEFINE_SPINLOCK(sd_index_lock);
91 104
@@ -240,6 +253,7 @@ static struct scsi_driver sd_template = {
240 .shutdown = sd_shutdown, 253 .shutdown = sd_shutdown,
241 }, 254 },
242 .rescan = sd_rescan, 255 .rescan = sd_rescan,
256 .done = sd_done,
243}; 257};
244 258
245/* 259/*
@@ -509,12 +523,6 @@ static int sd_prep_fn(struct request_queue *q, struct request *rq)
509 SCpnt->timeout_per_command = timeout; 523 SCpnt->timeout_per_command = timeout;
510 524
511 /* 525 /*
512 * This is the completion routine we use. This is matched in terms
513 * of capability to this function.
514 */
515 SCpnt->done = sd_rw_intr;
516
517 /*
518 * This indicates that the command is ready from our end to be 526 * This indicates that the command is ready from our end to be
519 * queued. 527 * queued.
520 */ 528 */
@@ -908,13 +916,13 @@ static struct block_device_operations sd_fops = {
908}; 916};
909 917
910/** 918/**
911 * sd_rw_intr - bottom half handler: called when the lower level 919 * sd_done - bottom half handler: called when the lower level
912 * driver has completed (successfully or otherwise) a scsi command. 920 * driver has completed (successfully or otherwise) a scsi command.
913 * @SCpnt: mid-level's per command structure. 921 * @SCpnt: mid-level's per command structure.
914 * 922 *
915 * Note: potentially run from within an ISR. Must not block. 923 * Note: potentially run from within an ISR. Must not block.
916 **/ 924 **/
917static void sd_rw_intr(struct scsi_cmnd * SCpnt) 925static int sd_done(struct scsi_cmnd *SCpnt)
918{ 926{
919 int result = SCpnt->result; 927 int result = SCpnt->result;
920 unsigned int xfer_size = SCpnt->request_bufflen; 928 unsigned int xfer_size = SCpnt->request_bufflen;
@@ -935,7 +943,7 @@ static void sd_rw_intr(struct scsi_cmnd * SCpnt)
935 SCSI_LOG_HLCOMPLETE(1, scsi_print_result(SCpnt)); 943 SCSI_LOG_HLCOMPLETE(1, scsi_print_result(SCpnt));
936 if (sense_valid) { 944 if (sense_valid) {
937 SCSI_LOG_HLCOMPLETE(1, scmd_printk(KERN_INFO, SCpnt, 945 SCSI_LOG_HLCOMPLETE(1, scmd_printk(KERN_INFO, SCpnt,
938 "sd_rw_intr: sb[respc,sk,asc," 946 "sd_done: sb[respc,sk,asc,"
939 "ascq]=%x,%x,%x,%x\n", 947 "ascq]=%x,%x,%x,%x\n",
940 sshdr.response_code, 948 sshdr.response_code,
941 sshdr.sense_key, sshdr.asc, 949 sshdr.sense_key, sshdr.asc,
@@ -1007,7 +1015,7 @@ static void sd_rw_intr(struct scsi_cmnd * SCpnt)
1007 break; 1015 break;
1008 } 1016 }
1009 out: 1017 out:
1010 scsi_io_completion(SCpnt, good_bytes); 1018 return good_bytes;
1011} 1019}
1012 1020
1013static int media_not_present(struct scsi_disk *sdkp, 1021static int media_not_present(struct scsi_disk *sdkp,