8
8
9
9
#include <linux/delay.h>
10
10
11
- static void
12
- qla2x00_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
13
* qla2x00_mailbox_command
@@ -47,7 +34,6 @@ qla2x00_mailbox_command(scsi_qla_host_t *pvha, mbx_cmd_t *mcp)
47
34
int rval ;
48
35
unsigned long flags = 0 ;
49
36
device_reg_t __iomem * reg ;
50
- struct timer_list tmp_intr_timer ;
51
37
uint8_t abort_active ;
52
38
uint8_t io_lock_on ;
53
39
uint16_t command ;
@@ -72,7 +58,8 @@ qla2x00_mailbox_command(scsi_qla_host_t *pvha, mbx_cmd_t *mcp)
72
58
* non ISP abort time.
73
59
*/
74
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
63
/* Timeout occurred. Return error. */
77
64
DEBUG2_3_11 (printk ("%s(%ld): cmd access timeout. "
78
65
"Exiting.\n" , __func__ , ha -> host_no ));
@@ -135,22 +122,6 @@ qla2x00_mailbox_command(scsi_qla_host_t *pvha, mbx_cmd_t *mcp)
135
122
/* Wait for mbx cmd completion until timeout */
136
123
137
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
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
131
WRT_REG_WORD (& reg -> isp .hccr , HCCR_SET_HOST_INT );
161
132
spin_unlock_irqrestore (& ha -> hardware_lock , flags );
162
133
163
- /* Wait for either the timer to expire
164
- * or the mbox completion interrupt
165
- */
166
- down (& ha -> mbx_intr_sem );
134
+ wait_for_completion_timeout (& ha -> mbx_intr_comp , mcp -> tov * HZ );
167
135
168
- DEBUG11 (printk ("%s(%ld): waking up. time=0x%lx\n" , __func__ ,
169
- ha -> host_no , jiffies ));
170
136
clear_bit (MBX_INTR_WAIT , & ha -> mbx_cmd_flags );
171
137
172
- /* delete the timer */
173
- del_timer (& tmp_intr_timer );
174
138
} else {
175
139
DEBUG3_11 (printk ("%s(%ld): cmd=%x POLLING MODE.\n" , __func__ ,
176
140
ha -> host_no , command ));
@@ -299,7 +263,7 @@ qla2x00_mailbox_command(scsi_qla_host_t *pvha, mbx_cmd_t *mcp)
299
263
300
264
/* Allow next mbx cmd to come in. */
301
265
if (!abort_active )
302
- up (& ha -> mbx_cmd_sem );
266
+ complete (& ha -> mbx_cmd_comp );
303
267
304
268
if (rval ) {
305
269
DEBUG2_3_11 (printk ("%s(%ld): **** FAILED. mbx0=%x, mbx1=%x, "
0 commit comments