aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/megaraid.c32
-rw-r--r--drivers/scsi/megaraid.h10
2 files changed, 14 insertions, 28 deletions
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
index 61a6fd810bb4..93c95bc82c1f 100644
--- a/drivers/scsi/megaraid.c
+++ b/drivers/scsi/megaraid.c
@@ -362,6 +362,7 @@ megaraid_queue(Scsi_Cmnd *scmd, void (*done)(Scsi_Cmnd *))
362 adapter_t *adapter; 362 adapter_t *adapter;
363 scb_t *scb; 363 scb_t *scb;
364 int busy=0; 364 int busy=0;
365 unsigned long flags;
365 366
366 adapter = (adapter_t *)scmd->device->host->hostdata; 367 adapter = (adapter_t *)scmd->device->host->hostdata;
367 368
@@ -377,6 +378,7 @@ megaraid_queue(Scsi_Cmnd *scmd, void (*done)(Scsi_Cmnd *))
377 * return 0 in that case. 378 * return 0 in that case.
378 */ 379 */
379 380
381 spin_lock_irqsave(&adapter->lock, flags);
380 scb = mega_build_cmd(adapter, scmd, &busy); 382 scb = mega_build_cmd(adapter, scmd, &busy);
381 383
382 if(scb) { 384 if(scb) {
@@ -393,6 +395,7 @@ megaraid_queue(Scsi_Cmnd *scmd, void (*done)(Scsi_Cmnd *))
393 } 395 }
394 return 0; 396 return 0;
395 } 397 }
398 spin_unlock_irqrestore(&adapter->lock, flags);
396 399
397 return busy; 400 return busy;
398} 401}
@@ -1981,7 +1984,7 @@ megaraid_reset(struct scsi_cmnd *cmd)
1981 mc.cmd = MEGA_CLUSTER_CMD; 1984 mc.cmd = MEGA_CLUSTER_CMD;
1982 mc.opcode = MEGA_RESET_RESERVATIONS; 1985 mc.opcode = MEGA_RESET_RESERVATIONS;
1983 1986
1984 if( mega_internal_command(adapter, LOCK_INT, &mc, NULL) != 0 ) { 1987 if( mega_internal_command(adapter, &mc, NULL) != 0 ) {
1985 printk(KERN_WARNING 1988 printk(KERN_WARNING
1986 "megaraid: reservation reset failed.\n"); 1989 "megaraid: reservation reset failed.\n");
1987 } 1990 }
@@ -3011,7 +3014,7 @@ proc_rdrv(adapter_t *adapter, char *page, int start, int end )
3011 mc.cmd = FC_NEW_CONFIG; 3014 mc.cmd = FC_NEW_CONFIG;
3012 mc.opcode = OP_DCMD_READ_CONFIG; 3015 mc.opcode = OP_DCMD_READ_CONFIG;
3013 3016
3014 if( mega_internal_command(adapter, LOCK_INT, &mc, NULL) ) { 3017 if( mega_internal_command(adapter, &mc, NULL) ) {
3015 3018
3016 len = sprintf(page, "40LD read config failed.\n"); 3019 len = sprintf(page, "40LD read config failed.\n");
3017 3020
@@ -3029,11 +3032,11 @@ proc_rdrv(adapter_t *adapter, char *page, int start, int end )
3029 else { 3032 else {
3030 mc.cmd = NEW_READ_CONFIG_8LD; 3033 mc.cmd = NEW_READ_CONFIG_8LD;
3031 3034
3032 if( mega_internal_command(adapter, LOCK_INT, &mc, NULL) ) { 3035 if( mega_internal_command(adapter, &mc, NULL) ) {
3033 3036
3034 mc.cmd = READ_CONFIG_8LD; 3037 mc.cmd = READ_CONFIG_8LD;
3035 3038
3036 if( mega_internal_command(adapter, LOCK_INT, &mc, 3039 if( mega_internal_command(adapter, &mc,
3037 NULL) ){ 3040 NULL) ){
3038 3041
3039 len = sprintf(page, 3042 len = sprintf(page,
@@ -3632,7 +3635,7 @@ megadev_ioctl(struct inode *inode, struct file *filep, unsigned int cmd,
3632 /* 3635 /*
3633 * Issue the command 3636 * Issue the command
3634 */ 3637 */
3635 mega_internal_command(adapter, LOCK_INT, &mc, pthru); 3638 mega_internal_command(adapter, &mc, pthru);
3636 3639
3637 rval = mega_n_to_m((void __user *)arg, &mc); 3640 rval = mega_n_to_m((void __user *)arg, &mc);
3638 3641
@@ -3715,7 +3718,7 @@ freemem_and_return:
3715 /* 3718 /*
3716 * Issue the command 3719 * Issue the command
3717 */ 3720 */
3718 mega_internal_command(adapter, LOCK_INT, &mc, NULL); 3721 mega_internal_command(adapter, &mc, NULL);
3719 3722
3720 rval = mega_n_to_m((void __user *)arg, &mc); 3723 rval = mega_n_to_m((void __user *)arg, &mc);
3721 3724
@@ -4234,7 +4237,7 @@ mega_do_del_logdrv(adapter_t *adapter, int logdrv)
4234 mc.opcode = OP_DEL_LOGDRV; 4237 mc.opcode = OP_DEL_LOGDRV;
4235 mc.subopcode = logdrv; 4238 mc.subopcode = logdrv;
4236 4239
4237 rval = mega_internal_command(adapter, LOCK_INT, &mc, NULL); 4240 rval = mega_internal_command(adapter, &mc, NULL);
4238 4241
4239 /* log this event */ 4242 /* log this event */
4240 if(rval) { 4243 if(rval) {
@@ -4367,7 +4370,7 @@ mega_adapinq(adapter_t *adapter, dma_addr_t dma_handle)
4367 4370
4368 mc.xferaddr = (u32)dma_handle; 4371 mc.xferaddr = (u32)dma_handle;
4369 4372
4370 if ( mega_internal_command(adapter, LOCK_INT, &mc, NULL) != 0 ) { 4373 if ( mega_internal_command(adapter, &mc, NULL) != 0 ) {
4371 return -1; 4374 return -1;
4372 } 4375 }
4373 4376
@@ -4435,7 +4438,7 @@ mega_internal_dev_inquiry(adapter_t *adapter, u8 ch, u8 tgt,
4435 mc.cmd = MEGA_MBOXCMD_PASSTHRU; 4438 mc.cmd = MEGA_MBOXCMD_PASSTHRU;
4436 mc.xferaddr = (u32)pthru_dma_handle; 4439 mc.xferaddr = (u32)pthru_dma_handle;
4437 4440
4438 rval = mega_internal_command(adapter, LOCK_INT, &mc, pthru); 4441 rval = mega_internal_command(adapter, &mc, pthru);
4439 4442
4440 pci_free_consistent(pdev, sizeof(mega_passthru), pthru, 4443 pci_free_consistent(pdev, sizeof(mega_passthru), pthru,
4441 pthru_dma_handle); 4444 pthru_dma_handle);
@@ -4449,7 +4452,6 @@ mega_internal_dev_inquiry(adapter_t *adapter, u8 ch, u8 tgt,
4449/** 4452/**
4450 * mega_internal_command() 4453 * mega_internal_command()
4451 * @adapter - pointer to our soft state 4454 * @adapter - pointer to our soft state
4452 * @ls - the scope of the exclusion lock.
4453 * @mc - the mailbox command 4455 * @mc - the mailbox command
4454 * @pthru - Passthru structure for DCDB commands 4456 * @pthru - Passthru structure for DCDB commands
4455 * 4457 *
@@ -4463,8 +4465,7 @@ mega_internal_dev_inquiry(adapter_t *adapter, u8 ch, u8 tgt,
4463 * Note: parameter 'pthru' is null for non-passthru commands. 4465 * Note: parameter 'pthru' is null for non-passthru commands.
4464 */ 4466 */
4465static int 4467static int
4466mega_internal_command(adapter_t *adapter, lockscope_t ls, megacmd_t *mc, 4468mega_internal_command(adapter_t *adapter, megacmd_t *mc, mega_passthru *pthru)
4467 mega_passthru *pthru )
4468{ 4469{
4469 Scsi_Cmnd *scmd; 4470 Scsi_Cmnd *scmd;
4470 struct scsi_device *sdev; 4471 struct scsi_device *sdev;
@@ -4508,15 +4509,8 @@ mega_internal_command(adapter_t *adapter, lockscope_t ls, megacmd_t *mc,
4508 4509
4509 scb->idx = CMDID_INT_CMDS; 4510 scb->idx = CMDID_INT_CMDS;
4510 4511
4511 /*
4512 * Get the lock only if the caller has not acquired it already
4513 */
4514 if( ls == LOCK_INT ) spin_lock_irqsave(&adapter->lock, flags);
4515
4516 megaraid_queue(scmd, mega_internal_done); 4512 megaraid_queue(scmd, mega_internal_done);
4517 4513
4518 if( ls == LOCK_INT ) spin_unlock_irqrestore(&adapter->lock, flags);
4519
4520 wait_for_completion(&adapter->int_waitq); 4514 wait_for_completion(&adapter->int_waitq);
4521 4515
4522 rval = scmd->result; 4516 rval = scmd->result;
diff --git a/drivers/scsi/megaraid.h b/drivers/scsi/megaraid.h
index 4facf557cd19..6f9078025748 100644
--- a/drivers/scsi/megaraid.h
+++ b/drivers/scsi/megaraid.h
@@ -926,13 +926,6 @@ struct mega_hbas {
926#define MEGA_SGLIST 0x0002 926#define MEGA_SGLIST 0x0002
927 927
928/* 928/*
929 * lockscope definitions, callers can specify the lock scope with this data
930 * type. LOCK_INT would mean the caller has not acquired the lock before
931 * making the call and LOCK_EXT would mean otherwise.
932 */
933typedef enum { LOCK_INT, LOCK_EXT } lockscope_t;
934
935/*
936 * Parameters for the io-mapped controllers 929 * Parameters for the io-mapped controllers
937 */ 930 */
938 931
@@ -1062,8 +1055,7 @@ static int mega_support_random_del(adapter_t *);
1062static int mega_del_logdrv(adapter_t *, int); 1055static int mega_del_logdrv(adapter_t *, int);
1063static int mega_do_del_logdrv(adapter_t *, int); 1056static int mega_do_del_logdrv(adapter_t *, int);
1064static void mega_get_max_sgl(adapter_t *); 1057static void mega_get_max_sgl(adapter_t *);
1065static int mega_internal_command(adapter_t *, lockscope_t, megacmd_t *, 1058static int mega_internal_command(adapter_t *, megacmd_t *, mega_passthru *);
1066 mega_passthru *);
1067static void mega_internal_done(Scsi_Cmnd *); 1059static void mega_internal_done(Scsi_Cmnd *);
1068static int mega_support_cluster(adapter_t *); 1060static int mega_support_cluster(adapter_t *);
1069#endif 1061#endif