summaryrefslogtreecommitdiff
path: root/drivers/scsi/megaraid/megaraid_mbox.c
diff options
context:
space:
mode:
authorJames Bottomley <jejb@mulgrave.(none)>2005-11-08 12:50:26 -0500
committerJames Bottomley <jejb@mulgrave.(none)>2005-11-08 12:50:26 -0500
commit383f9749505cef0a30dbd7109db7fe469aa64753 (patch)
tree9e88d648396ac99a90d12ccf5471d001e87c65ae /drivers/scsi/megaraid/megaraid_mbox.c
parentf093182d313edde9b1f86dbdaf40ba4da2dbd0e7 (diff)
parent3da8b713da723e78a03f0404beedf3cc6f4f860b (diff)
Merge by hand (conflicts between pending drivers and kfree cleanups)
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/megaraid/megaraid_mbox.c')
-rw-r--r--drivers/scsi/megaraid/megaraid_mbox.c81
1 files changed, 17 insertions, 64 deletions
diff --git a/drivers/scsi/megaraid/megaraid_mbox.c b/drivers/scsi/megaraid/megaraid_mbox.c
index 1a3d195a2d36..4b5d420d2f4d 100644
--- a/drivers/scsi/megaraid/megaraid_mbox.c
+++ b/drivers/scsi/megaraid/megaraid_mbox.c
@@ -533,8 +533,6 @@ megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
// Initialize the synchronization lock for kernel and LLD
spin_lock_init(&adapter->lock);
- adapter->host_lock = &adapter->lock;
-
// Initialize the command queues: the list of free SCBs and the list
// of pending SCBs.
@@ -715,9 +713,6 @@ megaraid_io_attach(adapter_t *adapter)
SCSIHOST2ADAP(host) = (caddr_t)adapter;
adapter->host = host;
- // export the parameters required by the mid-layer
- scsi_assign_lock(host, adapter->host_lock);
-
host->irq = adapter->irq;
host->unique_id = adapter->unique_id;
host->can_queue = adapter->max_cmds;
@@ -1560,10 +1555,6 @@ megaraid_queue_command(struct scsi_cmnd *scp, void (* done)(struct scsi_cmnd *))
scp->scsi_done = done;
scp->result = 0;
- assert_spin_locked(adapter->host_lock);
-
- spin_unlock(adapter->host_lock);
-
/*
* Allocate and build a SCB request
* if_busy flag will be set if megaraid_mbox_build_cmd() command could
@@ -1573,23 +1564,16 @@ megaraid_queue_command(struct scsi_cmnd *scp, void (* done)(struct scsi_cmnd *))
* return 0 in that case, and we would do the callback right away.
*/
if_busy = 0;
- scb = megaraid_mbox_build_cmd(adapter, scp, &if_busy);
-
- if (scb) {
- megaraid_mbox_runpendq(adapter, scb);
- }
-
- spin_lock(adapter->host_lock);
-
+ scb = megaraid_mbox_build_cmd(adapter, scp, &if_busy);
if (!scb) { // command already completed
done(scp);
return 0;
}
+ megaraid_mbox_runpendq(adapter, scb);
return if_busy;
}
-
/**
* megaraid_mbox_build_cmd - transform the mid-layer scsi command to megaraid
* firmware lingua
@@ -2546,9 +2530,7 @@ megaraid_mbox_dpc(unsigned long devp)
megaraid_dealloc_scb(adapter, scb);
// send the scsi packet back to kernel
- spin_lock(adapter->host_lock);
scp->scsi_done(scp);
- spin_unlock(adapter->host_lock);
}
return;
@@ -2563,7 +2545,7 @@ megaraid_mbox_dpc(unsigned long devp)
* aborted. All the commands issued to the F/W must complete.
**/
static int
-__megaraid_abort_handler(struct scsi_cmnd *scp)
+megaraid_abort_handler(struct scsi_cmnd *scp)
{
adapter_t *adapter;
mraid_device_t *raid_dev;
@@ -2577,8 +2559,6 @@ __megaraid_abort_handler(struct scsi_cmnd *scp)
adapter = SCP2ADAPTER(scp);
raid_dev = ADAP2RAIDDEV(adapter);
- assert_spin_locked(adapter->host_lock);
-
con_log(CL_ANN, (KERN_WARNING
"megaraid: aborting-%ld cmd=%x <c=%d t=%d l=%d>\n",
scp->serial_number, scp->cmnd[0], SCP2CHANNEL(scp),
@@ -2658,6 +2638,7 @@ __megaraid_abort_handler(struct scsi_cmnd *scp)
// traverse through the list of all SCB, since driver does not
// maintain these SCBs on any list
found = 0;
+ spin_lock_irq(&adapter->lock);
for (i = 0; i < MBOX_MAX_SCSI_CMDS; i++) {
scb = adapter->kscb_list + i;
@@ -2680,6 +2661,7 @@ __megaraid_abort_handler(struct scsi_cmnd *scp)
}
}
}
+ spin_unlock_irq(&adapter->lock);
if (!found) {
con_log(CL_ANN, (KERN_WARNING
@@ -2696,22 +2678,6 @@ __megaraid_abort_handler(struct scsi_cmnd *scp)
return FAILED;
}
-static int
-megaraid_abort_handler(struct scsi_cmnd *scp)
-{
- adapter_t *adapter;
- int rc;
-
- adapter = SCP2ADAPTER(scp);
-
- spin_lock_irq(adapter->host_lock);
- rc = __megaraid_abort_handler(scp);
- spin_unlock_irq(adapter->host_lock);
-
- return rc;
-}
-
-
/**
* megaraid_reset_handler - device reset hadler for mailbox based driver
* @scp : reference command
@@ -2723,7 +2689,7 @@ megaraid_abort_handler(struct scsi_cmnd *scp)
* host
**/
static int
-__megaraid_reset_handler(struct scsi_cmnd *scp)
+megaraid_reset_handler(struct scsi_cmnd *scp)
{
adapter_t *adapter;
scb_t *scb;
@@ -2739,10 +2705,6 @@ __megaraid_reset_handler(struct scsi_cmnd *scp)
adapter = SCP2ADAPTER(scp);
raid_dev = ADAP2RAIDDEV(adapter);
- assert_spin_locked(adapter->host_lock);
-
- con_log(CL_ANN, (KERN_WARNING "megaraid: reseting the host...\n"));
-
// return failure if adapter is not responding
if (raid_dev->hw_error) {
con_log(CL_ANN, (KERN_NOTICE
@@ -2779,8 +2741,6 @@ __megaraid_reset_handler(struct scsi_cmnd *scp)
adapter->outstanding_cmds, MBOX_RESET_WAIT));
}
- spin_unlock(adapter->host_lock);
-
recovery_window = MBOX_RESET_WAIT + MBOX_RESET_EXT_WAIT;
recovering = adapter->outstanding_cmds;
@@ -2806,7 +2766,7 @@ __megaraid_reset_handler(struct scsi_cmnd *scp)
msleep(1000);
}
- spin_lock(adapter->host_lock);
+ spin_lock(&adapter->lock);
// If still outstanding commands, bail out
if (adapter->outstanding_cmds) {
@@ -2815,7 +2775,8 @@ __megaraid_reset_handler(struct scsi_cmnd *scp)
raid_dev->hw_error = 1;
- return FAILED;
+ rval = FAILED;
+ goto out;
}
else {
con_log(CL_ANN, (KERN_NOTICE
@@ -2824,7 +2785,10 @@ __megaraid_reset_handler(struct scsi_cmnd *scp)
// If the controller supports clustering, reset reservations
- if (!adapter->ha) return SUCCESS;
+ if (!adapter->ha) {
+ rval = SUCCESS;
+ goto out;
+ }
// clear reservations if any
raw_mbox[0] = CLUSTER_CMD;
@@ -2841,22 +2805,11 @@ __megaraid_reset_handler(struct scsi_cmnd *scp)
"megaraid: reservation reset failed\n"));
}
+ out:
+ spin_unlock_irq(&adapter->lock);
return rval;
}
-static int
-megaraid_reset_handler(struct scsi_cmnd *cmd)
-{
- int rc;
-
- spin_lock_irq(cmd->device->host->host_lock);
- rc = __megaraid_reset_handler(cmd);
- spin_unlock_irq(cmd->device->host->host_lock);
-
- return rc;
-}
-
-
/*
* START: internal commands library
*
@@ -3776,9 +3729,9 @@ wait_till_fw_empty(adapter_t *adapter)
/*
* Set the quiescent flag to stop issuing cmds to FW.
*/
- spin_lock_irqsave(adapter->host_lock, flags);
+ spin_lock_irqsave(&adapter->lock, flags);
adapter->quiescent++;
- spin_unlock_irqrestore(adapter->host_lock, flags);
+ spin_unlock_irqrestore(&adapter->lock, flags);
/*
* Wait till there are no more cmds outstanding at FW. Try for at most