aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/scsi.c')
-rw-r--r--drivers/scsi/scsi.c20
1 files changed, 5 insertions, 15 deletions
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index 5578ae9a9e45..d14523d7e449 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -68,6 +68,8 @@
68#include "scsi_priv.h" 68#include "scsi_priv.h"
69#include "scsi_logging.h" 69#include "scsi_logging.h"
70 70
71static void scsi_done(struct scsi_cmnd *cmd);
72static int scsi_retry_command(struct scsi_cmnd *cmd);
71 73
72/* 74/*
73 * Definitions and constants. 75 * Definitions and constants.
@@ -111,6 +113,7 @@ const char *const scsi_device_types[MAX_SCSI_DEVICE_CODE] = {
111 "Unknown ", 113 "Unknown ",
112 "RAID ", 114 "RAID ",
113 "Enclosure ", 115 "Enclosure ",
116 "Direct-Access-RBC",
114}; 117};
115EXPORT_SYMBOL(scsi_device_types); 118EXPORT_SYMBOL(scsi_device_types);
116 119
@@ -257,8 +260,6 @@ struct scsi_cmnd *scsi_get_command(struct scsi_device *dev, int gfp_mask)
257 260
258 memset(cmd, 0, sizeof(*cmd)); 261 memset(cmd, 0, sizeof(*cmd));
259 cmd->device = dev; 262 cmd->device = dev;
260 cmd->state = SCSI_STATE_UNUSED;
261 cmd->owner = SCSI_OWNER_NOBODY;
262 init_timer(&cmd->eh_timeout); 263 init_timer(&cmd->eh_timeout);
263 INIT_LIST_HEAD(&cmd->list); 264 INIT_LIST_HEAD(&cmd->list);
264 spin_lock_irqsave(&dev->list_lock, flags); 265 spin_lock_irqsave(&dev->list_lock, flags);
@@ -608,10 +609,6 @@ int scsi_dispatch_cmd(struct scsi_cmnd *cmd)
608 * We will use a queued command if possible, otherwise we will 609 * We will use a queued command if possible, otherwise we will
609 * emulate the queuing and calling of completion function ourselves. 610 * emulate the queuing and calling of completion function ourselves.
610 */ 611 */
611
612 cmd->state = SCSI_STATE_QUEUED;
613 cmd->owner = SCSI_OWNER_LOWLEVEL;
614
615 atomic_inc(&cmd->device->iorequest_cnt); 612 atomic_inc(&cmd->device->iorequest_cnt);
616 613
617 /* 614 /*
@@ -681,7 +678,6 @@ void scsi_init_cmd_from_req(struct scsi_cmnd *cmd, struct scsi_request *sreq)
681{ 678{
682 sreq->sr_command = cmd; 679 sreq->sr_command = cmd;
683 680
684 cmd->owner = SCSI_OWNER_MIDLEVEL;
685 cmd->cmd_len = sreq->sr_cmd_len; 681 cmd->cmd_len = sreq->sr_cmd_len;
686 cmd->use_sg = sreq->sr_use_sg; 682 cmd->use_sg = sreq->sr_use_sg;
687 683
@@ -717,7 +713,6 @@ void scsi_init_cmd_from_req(struct scsi_cmnd *cmd, struct scsi_request *sreq)
717 /* 713 /*
718 * Start the timer ticking. 714 * Start the timer ticking.
719 */ 715 */
720 cmd->abort_reason = 0;
721 cmd->result = 0; 716 cmd->result = 0;
722 717
723 SCSI_LOG_MLQUEUE(3, printk("Leaving scsi_init_cmd_from_req()\n")); 718 SCSI_LOG_MLQUEUE(3, printk("Leaving scsi_init_cmd_from_req()\n"));
@@ -741,7 +736,7 @@ static DEFINE_PER_CPU(struct list_head, scsi_done_q);
741 * 736 *
742 * This function is interrupt context safe. 737 * This function is interrupt context safe.
743 */ 738 */
744void scsi_done(struct scsi_cmnd *cmd) 739static void scsi_done(struct scsi_cmnd *cmd)
745{ 740{
746 /* 741 /*
747 * We don't have to worry about this one timing out any more. 742 * We don't have to worry about this one timing out any more.
@@ -766,8 +761,6 @@ void __scsi_done(struct scsi_cmnd *cmd)
766 * Set the serial numbers back to zero 761 * Set the serial numbers back to zero
767 */ 762 */
768 cmd->serial_number = 0; 763 cmd->serial_number = 0;
769 cmd->state = SCSI_STATE_BHQUEUE;
770 cmd->owner = SCSI_OWNER_BH_HANDLER;
771 764
772 atomic_inc(&cmd->device->iodone_cnt); 765 atomic_inc(&cmd->device->iodone_cnt);
773 if (cmd->result) 766 if (cmd->result)
@@ -836,7 +829,7 @@ static void scsi_softirq(struct softirq_action *h)
836 * level drivers should not become re-entrant as a result of 829 * level drivers should not become re-entrant as a result of
837 * this. 830 * this.
838 */ 831 */
839int scsi_retry_command(struct scsi_cmnd *cmd) 832static int scsi_retry_command(struct scsi_cmnd *cmd)
840{ 833{
841 /* 834 /*
842 * Restore the SCSI command state. 835 * Restore the SCSI command state.
@@ -888,9 +881,6 @@ void scsi_finish_command(struct scsi_cmnd *cmd)
888 SCSI_LOG_MLCOMPLETE(4, printk("Notifying upper driver of completion " 881 SCSI_LOG_MLCOMPLETE(4, printk("Notifying upper driver of completion "
889 "for device %d %x\n", sdev->id, cmd->result)); 882 "for device %d %x\n", sdev->id, cmd->result));
890 883
891 cmd->owner = SCSI_OWNER_HIGHLEVEL;
892 cmd->state = SCSI_STATE_FINISHED;
893
894 /* 884 /*
895 * We can get here with use_sg=0, causing a panic in the upper level 885 * We can get here with use_sg=0, causing a panic in the upper level
896 */ 886 */