aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/megaraid.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/megaraid.c')
-rw-r--r--drivers/scsi/megaraid.c47
1 files changed, 8 insertions, 39 deletions
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
index a70cdf31311c..6f308ebe3e79 100644
--- a/drivers/scsi/megaraid.c
+++ b/drivers/scsi/megaraid.c
@@ -35,6 +35,7 @@
35#include <linux/blkdev.h> 35#include <linux/blkdev.h>
36#include <asm/uaccess.h> 36#include <asm/uaccess.h>
37#include <asm/io.h> 37#include <asm/io.h>
38#include <linux/completion.h>
38#include <linux/delay.h> 39#include <linux/delay.h>
39#include <linux/proc_fs.h> 40#include <linux/proc_fs.h>
40#include <linux/reboot.h> 41#include <linux/reboot.h>
@@ -1938,7 +1939,7 @@ megaraid_abort(Scsi_Cmnd *cmd)
1938 1939
1939 1940
1940static int 1941static int
1941__megaraid_reset(Scsi_Cmnd *cmd) 1942megaraid_reset(struct scsi_cmnd *cmd)
1942{ 1943{
1943 adapter_t *adapter; 1944 adapter_t *adapter;
1944 megacmd_t mc; 1945 megacmd_t mc;
@@ -1950,7 +1951,6 @@ __megaraid_reset(Scsi_Cmnd *cmd)
1950 mc.cmd = MEGA_CLUSTER_CMD; 1951 mc.cmd = MEGA_CLUSTER_CMD;
1951 mc.opcode = MEGA_RESET_RESERVATIONS; 1952 mc.opcode = MEGA_RESET_RESERVATIONS;
1952 1953
1953 spin_unlock_irq(&adapter->lock);
1954 if( mega_internal_command(adapter, LOCK_INT, &mc, NULL) != 0 ) { 1954 if( mega_internal_command(adapter, LOCK_INT, &mc, NULL) != 0 ) {
1955 printk(KERN_WARNING 1955 printk(KERN_WARNING
1956 "megaraid: reservation reset failed.\n"); 1956 "megaraid: reservation reset failed.\n");
@@ -1958,9 +1958,10 @@ __megaraid_reset(Scsi_Cmnd *cmd)
1958 else { 1958 else {
1959 printk(KERN_INFO "megaraid: reservation reset.\n"); 1959 printk(KERN_INFO "megaraid: reservation reset.\n");
1960 } 1960 }
1961 spin_lock_irq(&adapter->lock);
1962#endif 1961#endif
1963 1962
1963 spin_lock_irq(&adapter->lock);
1964
1964 rval = megaraid_abort_and_reset(adapter, cmd, SCB_RESET); 1965 rval = megaraid_abort_and_reset(adapter, cmd, SCB_RESET);
1965 1966
1966 /* 1967 /*
@@ -1968,24 +1969,11 @@ __megaraid_reset(Scsi_Cmnd *cmd)
1968 * to be communicated over to the mid layer. 1969 * to be communicated over to the mid layer.
1969 */ 1970 */
1970 mega_rundoneq(adapter); 1971 mega_rundoneq(adapter);
1971
1972 return rval;
1973}
1974
1975static int
1976megaraid_reset(Scsi_Cmnd *cmd)
1977{
1978 adapter_t *adapter = (adapter_t *)cmd->device->host->hostdata;
1979 int rc;
1980
1981 spin_lock_irq(&adapter->lock);
1982 rc = __megaraid_reset(cmd);
1983 spin_unlock_irq(&adapter->lock); 1972 spin_unlock_irq(&adapter->lock);
1984 1973
1985 return rc; 1974 return rval;
1986} 1975}
1987 1976
1988
1989/** 1977/**
1990 * megaraid_abort_and_reset() 1978 * megaraid_abort_and_reset()
1991 * @adapter - megaraid soft state 1979 * @adapter - megaraid soft state
@@ -4490,8 +4478,6 @@ mega_internal_command(adapter_t *adapter, lockscope_t ls, megacmd_t *mc,
4490 4478
4491 scb->idx = CMDID_INT_CMDS; 4479 scb->idx = CMDID_INT_CMDS;
4492 4480
4493 scmd->state = 0;
4494
4495 /* 4481 /*
4496 * Get the lock only if the caller has not acquired it already 4482 * Get the lock only if the caller has not acquired it already
4497 */ 4483 */
@@ -4501,15 +4487,7 @@ mega_internal_command(adapter_t *adapter, lockscope_t ls, megacmd_t *mc,
4501 4487
4502 if( ls == LOCK_INT ) spin_unlock_irqrestore(&adapter->lock, flags); 4488 if( ls == LOCK_INT ) spin_unlock_irqrestore(&adapter->lock, flags);
4503 4489
4504 /* 4490 wait_for_completion(&adapter->int_waitq);
4505 * Wait till this command finishes. Do not use
4506 * wait_event_interruptible(). It causes panic if CTRL-C is hit when
4507 * dumping e.g., physical disk information through /proc interface.
4508 */
4509#if 0
4510 wait_event_interruptible(adapter->int_waitq, scmd->state);
4511#endif
4512 wait_event(adapter->int_waitq, scmd->state);
4513 4491
4514 rval = scmd->result; 4492 rval = scmd->result;
4515 mc->status = scmd->result; 4493 mc->status = scmd->result;
@@ -4543,16 +4521,7 @@ mega_internal_done(Scsi_Cmnd *scmd)
4543 4521
4544 adapter = (adapter_t *)scmd->device->host->hostdata; 4522 adapter = (adapter_t *)scmd->device->host->hostdata;
4545 4523
4546 scmd->state = 1; /* thread waiting for its command to complete */ 4524 complete(&adapter->int_waitq);
4547
4548 /*
4549 * See comment in mega_internal_command() routine for
4550 * wait_event_interruptible()
4551 */
4552#if 0
4553 wake_up_interruptible(&adapter->int_waitq);
4554#endif
4555 wake_up(&adapter->int_waitq);
4556 4525
4557} 4526}
4558 4527
@@ -4874,7 +4843,7 @@ megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
4874 } 4843 }
4875 4844
4876 init_MUTEX(&adapter->int_mtx); 4845 init_MUTEX(&adapter->int_mtx);
4877 init_waitqueue_head(&adapter->int_waitq); 4846 init_completion(&adapter->int_waitq);
4878 4847
4879 adapter->this_id = DEFAULT_INITIATOR_ID; 4848 adapter->this_id = DEFAULT_INITIATOR_ID;
4880 adapter->host->this_id = DEFAULT_INITIATOR_ID; 4849 adapter->host->this_id = DEFAULT_INITIATOR_ID;