aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla2xxx/qla_mbx.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_mbx.c')
-rw-r--r--drivers/scsi/qla2xxx/qla_mbx.c44
1 files changed, 4 insertions, 40 deletions
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
index 0fc165288f8..d23d6fcfb22 100644
--- a/drivers/scsi/qla2xxx/qla_mbx.c
+++ b/drivers/scsi/qla2xxx/qla_mbx.c
@@ -8,19 +8,6 @@
8 8
9#include <linux/delay.h> 9#include <linux/delay.h>
10 10
11static void
12qla2x00_mbx_sem_timeout(unsigned long data)
13{
14 struct semaphore *sem_ptr = (struct semaphore *)data;
15
16 DEBUG11(printk("qla2x00_sem_timeout: entered.\n"));
17
18 if (sem_ptr != NULL) {
19 up(sem_ptr);
20 }
21
22 DEBUG11(printk("qla2x00_mbx_sem_timeout: exiting.\n"));
23}
24 11
25/* 12/*
26 * qla2x00_mailbox_command 13 * qla2x00_mailbox_command
@@ -47,7 +34,6 @@ qla2x00_mailbox_command(scsi_qla_host_t *pvha, mbx_cmd_t *mcp)
47 int rval; 34 int rval;
48 unsigned long flags = 0; 35 unsigned long flags = 0;
49 device_reg_t __iomem *reg; 36 device_reg_t __iomem *reg;
50 struct timer_list tmp_intr_timer;
51 uint8_t abort_active; 37 uint8_t abort_active;
52 uint8_t io_lock_on; 38 uint8_t io_lock_on;
53 uint16_t command; 39 uint16_t command;
@@ -72,7 +58,8 @@ qla2x00_mailbox_command(scsi_qla_host_t *pvha, mbx_cmd_t *mcp)
72 * non ISP abort time. 58 * non ISP abort time.
73 */ 59 */
74 if (!abort_active) { 60 if (!abort_active) {
75 if (qla2x00_down_timeout(&ha->mbx_cmd_sem, mcp->tov * HZ)) { 61 if (!wait_for_completion_timeout(&ha->mbx_cmd_comp,
62 mcp->tov * HZ)) {
76 /* Timeout occurred. Return error. */ 63 /* Timeout occurred. Return error. */
77 DEBUG2_3_11(printk("%s(%ld): cmd access timeout. " 64 DEBUG2_3_11(printk("%s(%ld): cmd access timeout. "
78 "Exiting.\n", __func__, ha->host_no)); 65 "Exiting.\n", __func__, ha->host_no));
@@ -135,22 +122,6 @@ qla2x00_mailbox_command(scsi_qla_host_t *pvha, mbx_cmd_t *mcp)
135 /* Wait for mbx cmd completion until timeout */ 122 /* Wait for mbx cmd completion until timeout */
136 123
137 if (!abort_active && io_lock_on) { 124 if (!abort_active && io_lock_on) {
138 /* sleep on completion semaphore */
139 DEBUG11(printk("%s(%ld): INTERRUPT MODE. Initializing timer.\n",
140 __func__, ha->host_no));
141
142 init_timer(&tmp_intr_timer);
143 tmp_intr_timer.data = (unsigned long)&ha->mbx_intr_sem;
144 tmp_intr_timer.expires = jiffies + mcp->tov * HZ;
145 tmp_intr_timer.function =
146 (void (*)(unsigned long))qla2x00_mbx_sem_timeout;
147
148 DEBUG11(printk("%s(%ld): Adding timer.\n", __func__,
149 ha->host_no));
150 add_timer(&tmp_intr_timer);
151
152 DEBUG11(printk("%s(%ld): going to unlock & sleep. "
153 "time=0x%lx.\n", __func__, ha->host_no, jiffies));
154 125
155 set_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags); 126 set_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags);
156 127
@@ -160,17 +131,10 @@ qla2x00_mailbox_command(scsi_qla_host_t *pvha, mbx_cmd_t *mcp)
160 WRT_REG_WORD(&reg->isp.hccr, HCCR_SET_HOST_INT); 131 WRT_REG_WORD(&reg->isp.hccr, HCCR_SET_HOST_INT);
161 spin_unlock_irqrestore(&ha->hardware_lock, flags); 132 spin_unlock_irqrestore(&ha->hardware_lock, flags);
162 133
163 /* Wait for either the timer to expire 134 wait_for_completion_timeout(&ha->mbx_intr_comp, mcp->tov * HZ);
164 * or the mbox completion interrupt
165 */
166 down(&ha->mbx_intr_sem);
167 135
168 DEBUG11(printk("%s(%ld): waking up. time=0x%lx\n", __func__,
169 ha->host_no, jiffies));
170 clear_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags); 136 clear_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags);
171 137
172 /* delete the timer */
173 del_timer(&tmp_intr_timer);
174 } else { 138 } else {
175 DEBUG3_11(printk("%s(%ld): cmd=%x POLLING MODE.\n", __func__, 139 DEBUG3_11(printk("%s(%ld): cmd=%x POLLING MODE.\n", __func__,
176 ha->host_no, command)); 140 ha->host_no, command));
@@ -299,7 +263,7 @@ qla2x00_mailbox_command(scsi_qla_host_t *pvha, mbx_cmd_t *mcp)
299 263
300 /* Allow next mbx cmd to come in. */ 264 /* Allow next mbx cmd to come in. */
301 if (!abort_active) 265 if (!abort_active)
302 up(&ha->mbx_cmd_sem); 266 complete(&ha->mbx_cmd_comp);
303 267
304 if (rval) { 268 if (rval) {
305 DEBUG2_3_11(printk("%s(%ld): **** FAILED. mbx0=%x, mbx1=%x, " 269 DEBUG2_3_11(printk("%s(%ld): **** FAILED. mbx0=%x, mbx1=%x, "