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

[SCSI] megaraid (legacy): remove scsi_assign_lock usage

just take the adapter lock in megaraid_queue.  Additional benefit is
that we can get rid of the awkward conditional locking in
mega_internal_command.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent f2c8dc40
...@@ -362,6 +362,7 @@ megaraid_queue(Scsi_Cmnd *scmd, void (*done)(Scsi_Cmnd *)) ...@@ -362,6 +362,7 @@ megaraid_queue(Scsi_Cmnd *scmd, void (*done)(Scsi_Cmnd *))
adapter_t *adapter; adapter_t *adapter;
scb_t *scb; scb_t *scb;
int busy=0; int busy=0;
unsigned long flags;
adapter = (adapter_t *)scmd->device->host->hostdata; adapter = (adapter_t *)scmd->device->host->hostdata;
...@@ -377,6 +378,7 @@ megaraid_queue(Scsi_Cmnd *scmd, void (*done)(Scsi_Cmnd *)) ...@@ -377,6 +378,7 @@ megaraid_queue(Scsi_Cmnd *scmd, void (*done)(Scsi_Cmnd *))
* return 0 in that case. * return 0 in that case.
*/ */
spin_lock_irqsave(&adapter->lock, flags);
scb = mega_build_cmd(adapter, scmd, &busy); scb = mega_build_cmd(adapter, scmd, &busy);
if(scb) { if(scb) {
...@@ -393,6 +395,7 @@ megaraid_queue(Scsi_Cmnd *scmd, void (*done)(Scsi_Cmnd *)) ...@@ -393,6 +395,7 @@ megaraid_queue(Scsi_Cmnd *scmd, void (*done)(Scsi_Cmnd *))
} }
return 0; return 0;
} }
spin_unlock_irqrestore(&adapter->lock, flags);
return busy; return busy;
} }
...@@ -1981,7 +1984,7 @@ megaraid_reset(struct scsi_cmnd *cmd) ...@@ -1981,7 +1984,7 @@ megaraid_reset(struct scsi_cmnd *cmd)
mc.cmd = MEGA_CLUSTER_CMD; mc.cmd = MEGA_CLUSTER_CMD;
mc.opcode = MEGA_RESET_RESERVATIONS; mc.opcode = MEGA_RESET_RESERVATIONS;
if( mega_internal_command(adapter, LOCK_INT, &mc, NULL) != 0 ) { if( mega_internal_command(adapter, &mc, NULL) != 0 ) {
printk(KERN_WARNING printk(KERN_WARNING
"megaraid: reservation reset failed.\n"); "megaraid: reservation reset failed.\n");
} }
...@@ -3011,7 +3014,7 @@ proc_rdrv(adapter_t *adapter, char *page, int start, int end ) ...@@ -3011,7 +3014,7 @@ proc_rdrv(adapter_t *adapter, char *page, int start, int end )
mc.cmd = FC_NEW_CONFIG; mc.cmd = FC_NEW_CONFIG;
mc.opcode = OP_DCMD_READ_CONFIG; mc.opcode = OP_DCMD_READ_CONFIG;
if( mega_internal_command(adapter, LOCK_INT, &mc, NULL) ) { if( mega_internal_command(adapter, &mc, NULL) ) {
len = sprintf(page, "40LD read config failed.\n"); len = sprintf(page, "40LD read config failed.\n");
...@@ -3029,11 +3032,11 @@ proc_rdrv(adapter_t *adapter, char *page, int start, int end ) ...@@ -3029,11 +3032,11 @@ proc_rdrv(adapter_t *adapter, char *page, int start, int end )
else { else {
mc.cmd = NEW_READ_CONFIG_8LD; mc.cmd = NEW_READ_CONFIG_8LD;
if( mega_internal_command(adapter, LOCK_INT, &mc, NULL) ) { if( mega_internal_command(adapter, &mc, NULL) ) {
mc.cmd = READ_CONFIG_8LD; mc.cmd = READ_CONFIG_8LD;
if( mega_internal_command(adapter, LOCK_INT, &mc, if( mega_internal_command(adapter, &mc,
NULL) ){ NULL) ){
len = sprintf(page, len = sprintf(page,
...@@ -3632,7 +3635,7 @@ megadev_ioctl(struct inode *inode, struct file *filep, unsigned int cmd, ...@@ -3632,7 +3635,7 @@ megadev_ioctl(struct inode *inode, struct file *filep, unsigned int cmd,
/* /*
* Issue the command * Issue the command
*/ */
mega_internal_command(adapter, LOCK_INT, &mc, pthru); mega_internal_command(adapter, &mc, pthru);
rval = mega_n_to_m((void __user *)arg, &mc); rval = mega_n_to_m((void __user *)arg, &mc);
...@@ -3715,7 +3718,7 @@ megadev_ioctl(struct inode *inode, struct file *filep, unsigned int cmd, ...@@ -3715,7 +3718,7 @@ megadev_ioctl(struct inode *inode, struct file *filep, unsigned int cmd,
/* /*
* Issue the command * Issue the command
*/ */
mega_internal_command(adapter, LOCK_INT, &mc, NULL); mega_internal_command(adapter, &mc, NULL);
rval = mega_n_to_m((void __user *)arg, &mc); rval = mega_n_to_m((void __user *)arg, &mc);
...@@ -4234,7 +4237,7 @@ mega_do_del_logdrv(adapter_t *adapter, int logdrv) ...@@ -4234,7 +4237,7 @@ mega_do_del_logdrv(adapter_t *adapter, int logdrv)
mc.opcode = OP_DEL_LOGDRV; mc.opcode = OP_DEL_LOGDRV;
mc.subopcode = logdrv; mc.subopcode = logdrv;
rval = mega_internal_command(adapter, LOCK_INT, &mc, NULL); rval = mega_internal_command(adapter, &mc, NULL);
/* log this event */ /* log this event */
if(rval) { if(rval) {
...@@ -4367,7 +4370,7 @@ mega_adapinq(adapter_t *adapter, dma_addr_t dma_handle) ...@@ -4367,7 +4370,7 @@ mega_adapinq(adapter_t *adapter, dma_addr_t dma_handle)
mc.xferaddr = (u32)dma_handle; mc.xferaddr = (u32)dma_handle;
if ( mega_internal_command(adapter, LOCK_INT, &mc, NULL) != 0 ) { if ( mega_internal_command(adapter, &mc, NULL) != 0 ) {
return -1; return -1;
} }
...@@ -4435,7 +4438,7 @@ mega_internal_dev_inquiry(adapter_t *adapter, u8 ch, u8 tgt, ...@@ -4435,7 +4438,7 @@ mega_internal_dev_inquiry(adapter_t *adapter, u8 ch, u8 tgt,
mc.cmd = MEGA_MBOXCMD_PASSTHRU; mc.cmd = MEGA_MBOXCMD_PASSTHRU;
mc.xferaddr = (u32)pthru_dma_handle; mc.xferaddr = (u32)pthru_dma_handle;
rval = mega_internal_command(adapter, LOCK_INT, &mc, pthru); rval = mega_internal_command(adapter, &mc, pthru);
pci_free_consistent(pdev, sizeof(mega_passthru), pthru, pci_free_consistent(pdev, sizeof(mega_passthru), pthru,
pthru_dma_handle); pthru_dma_handle);
...@@ -4449,7 +4452,6 @@ mega_internal_dev_inquiry(adapter_t *adapter, u8 ch, u8 tgt, ...@@ -4449,7 +4452,6 @@ mega_internal_dev_inquiry(adapter_t *adapter, u8 ch, u8 tgt,
/** /**
* mega_internal_command() * mega_internal_command()
* @adapter - pointer to our soft state * @adapter - pointer to our soft state
* @ls - the scope of the exclusion lock.
* @mc - the mailbox command * @mc - the mailbox command
* @pthru - Passthru structure for DCDB commands * @pthru - Passthru structure for DCDB commands
* *
...@@ -4463,8 +4465,7 @@ mega_internal_dev_inquiry(adapter_t *adapter, u8 ch, u8 tgt, ...@@ -4463,8 +4465,7 @@ mega_internal_dev_inquiry(adapter_t *adapter, u8 ch, u8 tgt,
* Note: parameter 'pthru' is null for non-passthru commands. * Note: parameter 'pthru' is null for non-passthru commands.
*/ */
static int static int
mega_internal_command(adapter_t *adapter, lockscope_t ls, megacmd_t *mc, mega_internal_command(adapter_t *adapter, megacmd_t *mc, mega_passthru *pthru)
mega_passthru *pthru )
{ {
Scsi_Cmnd *scmd; Scsi_Cmnd *scmd;
struct scsi_device *sdev; struct scsi_device *sdev;
...@@ -4508,15 +4509,8 @@ mega_internal_command(adapter_t *adapter, lockscope_t ls, megacmd_t *mc, ...@@ -4508,15 +4509,8 @@ mega_internal_command(adapter_t *adapter, lockscope_t ls, megacmd_t *mc,
scb->idx = CMDID_INT_CMDS; scb->idx = CMDID_INT_CMDS;
/*
* Get the lock only if the caller has not acquired it already
*/
if( ls == LOCK_INT ) spin_lock_irqsave(&adapter->lock, flags);
megaraid_queue(scmd, mega_internal_done); megaraid_queue(scmd, mega_internal_done);
if( ls == LOCK_INT ) spin_unlock_irqrestore(&adapter->lock, flags);
wait_for_completion(&adapter->int_waitq); wait_for_completion(&adapter->int_waitq);
rval = scmd->result; rval = scmd->result;
......
...@@ -925,13 +925,6 @@ struct mega_hbas { ...@@ -925,13 +925,6 @@ struct mega_hbas {
#define MEGA_BULK_DATA 0x0001 #define MEGA_BULK_DATA 0x0001
#define MEGA_SGLIST 0x0002 #define MEGA_SGLIST 0x0002
/*
* lockscope definitions, callers can specify the lock scope with this data
* type. LOCK_INT would mean the caller has not acquired the lock before
* making the call and LOCK_EXT would mean otherwise.
*/
typedef enum { LOCK_INT, LOCK_EXT } lockscope_t;
/* /*
* Parameters for the io-mapped controllers * Parameters for the io-mapped controllers
*/ */
...@@ -1062,8 +1055,7 @@ static int mega_support_random_del(adapter_t *); ...@@ -1062,8 +1055,7 @@ static int mega_support_random_del(adapter_t *);
static int mega_del_logdrv(adapter_t *, int); static int mega_del_logdrv(adapter_t *, int);
static int mega_do_del_logdrv(adapter_t *, int); static int mega_do_del_logdrv(adapter_t *, int);
static void mega_get_max_sgl(adapter_t *); static void mega_get_max_sgl(adapter_t *);
static int mega_internal_command(adapter_t *, lockscope_t, megacmd_t *, static int mega_internal_command(adapter_t *, megacmd_t *, mega_passthru *);
mega_passthru *);
static void mega_internal_done(Scsi_Cmnd *); static void mega_internal_done(Scsi_Cmnd *);
static int mega_support_cluster(adapter_t *); static int mega_support_cluster(adapter_t *);
#endif #endif
......
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