Commit f2c8dc40 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by James Bottomley

[SCSI] megaraid_mbox: remove scsi_assign_lock usage

also remove the adapter->host_lock alias for adapter->lock and remove
some superflous locking aswell as removing the tiny locking wrappers
for the EH routines.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent 3072c4ab
...@@ -97,7 +97,6 @@ typedef struct { ...@@ -97,7 +97,6 @@ typedef struct {
* @param dpc_h : tasklet handle * @param dpc_h : tasklet handle
* @param pdev : pci configuration pointer for kernel * @param pdev : pci configuration pointer for kernel
* @param host : pointer to host structure of mid-layer * @param host : pointer to host structure of mid-layer
* @param host_lock : pointer to appropriate lock
* @param lock : synchronization lock for mid-layer and driver * @param lock : synchronization lock for mid-layer and driver
* @param quiescent : driver is quiescent for now. * @param quiescent : driver is quiescent for now.
* @param outstanding_cmds : number of commands pending in the driver * @param outstanding_cmds : number of commands pending in the driver
...@@ -152,7 +151,6 @@ typedef struct { ...@@ -152,7 +151,6 @@ typedef struct {
struct tasklet_struct dpc_h; struct tasklet_struct dpc_h;
struct pci_dev *pdev; struct pci_dev *pdev;
struct Scsi_Host *host; struct Scsi_Host *host;
spinlock_t *host_lock;
spinlock_t lock; spinlock_t lock;
uint8_t quiescent; uint8_t quiescent;
int outstanding_cmds; int outstanding_cmds;
......
...@@ -533,8 +533,6 @@ megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -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 // Initialize the synchronization lock for kernel and LLD
spin_lock_init(&adapter->lock); spin_lock_init(&adapter->lock);
adapter->host_lock = &adapter->lock;
// Initialize the command queues: the list of free SCBs and the list // Initialize the command queues: the list of free SCBs and the list
// of pending SCBs. // of pending SCBs.
...@@ -715,9 +713,6 @@ megaraid_io_attach(adapter_t *adapter) ...@@ -715,9 +713,6 @@ megaraid_io_attach(adapter_t *adapter)
SCSIHOST2ADAP(host) = (caddr_t)adapter; SCSIHOST2ADAP(host) = (caddr_t)adapter;
adapter->host = host; adapter->host = host;
// export the parameters required by the mid-layer
scsi_assign_lock(host, adapter->host_lock);
host->irq = adapter->irq; host->irq = adapter->irq;
host->unique_id = adapter->unique_id; host->unique_id = adapter->unique_id;
host->can_queue = adapter->max_cmds; host->can_queue = adapter->max_cmds;
...@@ -1560,10 +1555,6 @@ megaraid_queue_command(struct scsi_cmnd *scp, void (* done)(struct scsi_cmnd *)) ...@@ -1560,10 +1555,6 @@ megaraid_queue_command(struct scsi_cmnd *scp, void (* done)(struct scsi_cmnd *))
scp->scsi_done = done; scp->scsi_done = done;
scp->result = 0; scp->result = 0;
assert_spin_locked(adapter->host_lock);
spin_unlock(adapter->host_lock);
/* /*
* Allocate and build a SCB request * Allocate and build a SCB request
* if_busy flag will be set if megaraid_mbox_build_cmd() command could * if_busy flag will be set if megaraid_mbox_build_cmd() command could
...@@ -1574,22 +1565,15 @@ megaraid_queue_command(struct scsi_cmnd *scp, void (* done)(struct scsi_cmnd *)) ...@@ -1574,22 +1565,15 @@ megaraid_queue_command(struct scsi_cmnd *scp, void (* done)(struct scsi_cmnd *))
*/ */
if_busy = 0; if_busy = 0;
scb = megaraid_mbox_build_cmd(adapter, scp, &if_busy); scb = megaraid_mbox_build_cmd(adapter, scp, &if_busy);
if (scb) {
megaraid_mbox_runpendq(adapter, scb);
}
spin_lock(adapter->host_lock);
if (!scb) { // command already completed if (!scb) { // command already completed
done(scp); done(scp);
return 0; return 0;
} }
megaraid_mbox_runpendq(adapter, scb);
return if_busy; return if_busy;
} }
/** /**
* megaraid_mbox_build_cmd - transform the mid-layer scsi command to megaraid * megaraid_mbox_build_cmd - transform the mid-layer scsi command to megaraid
* firmware lingua * firmware lingua
...@@ -2546,9 +2530,7 @@ megaraid_mbox_dpc(unsigned long devp) ...@@ -2546,9 +2530,7 @@ megaraid_mbox_dpc(unsigned long devp)
megaraid_dealloc_scb(adapter, scb); megaraid_dealloc_scb(adapter, scb);
// send the scsi packet back to kernel // send the scsi packet back to kernel
spin_lock(adapter->host_lock);
scp->scsi_done(scp); scp->scsi_done(scp);
spin_unlock(adapter->host_lock);
} }
return; return;
...@@ -2563,7 +2545,7 @@ megaraid_mbox_dpc(unsigned long devp) ...@@ -2563,7 +2545,7 @@ megaraid_mbox_dpc(unsigned long devp)
* aborted. All the commands issued to the F/W must complete. * aborted. All the commands issued to the F/W must complete.
**/ **/
static int static int
__megaraid_abort_handler(struct scsi_cmnd *scp) megaraid_abort_handler(struct scsi_cmnd *scp)
{ {
adapter_t *adapter; adapter_t *adapter;
mraid_device_t *raid_dev; mraid_device_t *raid_dev;
...@@ -2577,8 +2559,6 @@ __megaraid_abort_handler(struct scsi_cmnd *scp) ...@@ -2577,8 +2559,6 @@ __megaraid_abort_handler(struct scsi_cmnd *scp)
adapter = SCP2ADAPTER(scp); adapter = SCP2ADAPTER(scp);
raid_dev = ADAP2RAIDDEV(adapter); raid_dev = ADAP2RAIDDEV(adapter);
assert_spin_locked(adapter->host_lock);
con_log(CL_ANN, (KERN_WARNING con_log(CL_ANN, (KERN_WARNING
"megaraid: aborting-%ld cmd=%x <c=%d t=%d l=%d>\n", "megaraid: aborting-%ld cmd=%x <c=%d t=%d l=%d>\n",
scp->serial_number, scp->cmnd[0], SCP2CHANNEL(scp), scp->serial_number, scp->cmnd[0], SCP2CHANNEL(scp),
...@@ -2658,6 +2638,7 @@ __megaraid_abort_handler(struct scsi_cmnd *scp) ...@@ -2658,6 +2638,7 @@ __megaraid_abort_handler(struct scsi_cmnd *scp)
// traverse through the list of all SCB, since driver does not // traverse through the list of all SCB, since driver does not
// maintain these SCBs on any list // maintain these SCBs on any list
found = 0; found = 0;
spin_lock_irq(&adapter->lock);
for (i = 0; i < MBOX_MAX_SCSI_CMDS; i++) { for (i = 0; i < MBOX_MAX_SCSI_CMDS; i++) {
scb = adapter->kscb_list + i; scb = adapter->kscb_list + i;
...@@ -2680,6 +2661,7 @@ __megaraid_abort_handler(struct scsi_cmnd *scp) ...@@ -2680,6 +2661,7 @@ __megaraid_abort_handler(struct scsi_cmnd *scp)
} }
} }
} }
spin_unlock_irq(&adapter->lock);
if (!found) { if (!found) {
con_log(CL_ANN, (KERN_WARNING con_log(CL_ANN, (KERN_WARNING
...@@ -2696,22 +2678,6 @@ __megaraid_abort_handler(struct scsi_cmnd *scp) ...@@ -2696,22 +2678,6 @@ __megaraid_abort_handler(struct scsi_cmnd *scp)
return FAILED; 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 * megaraid_reset_handler - device reset hadler for mailbox based driver
* @scp : reference command * @scp : reference command
...@@ -2723,7 +2689,7 @@ megaraid_abort_handler(struct scsi_cmnd *scp) ...@@ -2723,7 +2689,7 @@ megaraid_abort_handler(struct scsi_cmnd *scp)
* host * host
**/ **/
static int static int
__megaraid_reset_handler(struct scsi_cmnd *scp) megaraid_reset_handler(struct scsi_cmnd *scp)
{ {
adapter_t *adapter; adapter_t *adapter;
scb_t *scb; scb_t *scb;
...@@ -2739,10 +2705,6 @@ __megaraid_reset_handler(struct scsi_cmnd *scp) ...@@ -2739,10 +2705,6 @@ __megaraid_reset_handler(struct scsi_cmnd *scp)
adapter = SCP2ADAPTER(scp); adapter = SCP2ADAPTER(scp);
raid_dev = ADAP2RAIDDEV(adapter); 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 // return failure if adapter is not responding
if (raid_dev->hw_error) { if (raid_dev->hw_error) {
con_log(CL_ANN, (KERN_NOTICE con_log(CL_ANN, (KERN_NOTICE
...@@ -2779,8 +2741,6 @@ __megaraid_reset_handler(struct scsi_cmnd *scp) ...@@ -2779,8 +2741,6 @@ __megaraid_reset_handler(struct scsi_cmnd *scp)
adapter->outstanding_cmds, MBOX_RESET_WAIT)); adapter->outstanding_cmds, MBOX_RESET_WAIT));
} }
spin_unlock(adapter->host_lock);
recovery_window = MBOX_RESET_WAIT + MBOX_RESET_EXT_WAIT; recovery_window = MBOX_RESET_WAIT + MBOX_RESET_EXT_WAIT;
recovering = adapter->outstanding_cmds; recovering = adapter->outstanding_cmds;
...@@ -2806,7 +2766,7 @@ __megaraid_reset_handler(struct scsi_cmnd *scp) ...@@ -2806,7 +2766,7 @@ __megaraid_reset_handler(struct scsi_cmnd *scp)
msleep(1000); msleep(1000);
} }
spin_lock(adapter->host_lock); spin_lock(&adapter->lock);
// If still outstanding commands, bail out // If still outstanding commands, bail out
if (adapter->outstanding_cmds) { if (adapter->outstanding_cmds) {
...@@ -2815,7 +2775,8 @@ __megaraid_reset_handler(struct scsi_cmnd *scp) ...@@ -2815,7 +2775,8 @@ __megaraid_reset_handler(struct scsi_cmnd *scp)
raid_dev->hw_error = 1; raid_dev->hw_error = 1;
return FAILED; rval = FAILED;
goto out;
} }
else { else {
con_log(CL_ANN, (KERN_NOTICE con_log(CL_ANN, (KERN_NOTICE
...@@ -2824,7 +2785,10 @@ __megaraid_reset_handler(struct scsi_cmnd *scp) ...@@ -2824,7 +2785,10 @@ __megaraid_reset_handler(struct scsi_cmnd *scp)
// If the controller supports clustering, reset reservations // If the controller supports clustering, reset reservations
if (!adapter->ha) return SUCCESS; if (!adapter->ha) {
rval = SUCCESS;
goto out;
}
// clear reservations if any // clear reservations if any
raw_mbox[0] = CLUSTER_CMD; raw_mbox[0] = CLUSTER_CMD;
...@@ -2841,22 +2805,11 @@ __megaraid_reset_handler(struct scsi_cmnd *scp) ...@@ -2841,22 +2805,11 @@ __megaraid_reset_handler(struct scsi_cmnd *scp)
"megaraid: reservation reset failed\n")); "megaraid: reservation reset failed\n"));
} }
out:
spin_unlock_irq(&adapter->lock);
return rval; 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 * START: internal commands library
* *
...@@ -3776,9 +3729,9 @@ wait_till_fw_empty(adapter_t *adapter) ...@@ -3776,9 +3729,9 @@ wait_till_fw_empty(adapter_t *adapter)
/* /*
* Set the quiescent flag to stop issuing cmds to FW. * 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++; 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 * Wait till there are no more cmds outstanding at FW. Try for at most
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment