diff options
Diffstat (limited to 'drivers/net/wireless/libertas/cmdresp.c')
-rw-r--r-- | drivers/net/wireless/libertas/cmdresp.c | 336 |
1 files changed, 158 insertions, 178 deletions
diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c index 44865bf12ba4..ab6e729efacf 100644 --- a/drivers/net/wireless/libertas/cmdresp.c +++ b/drivers/net/wireless/libertas/cmdresp.c | |||
@@ -25,10 +25,9 @@ | |||
25 | */ | 25 | */ |
26 | void lbs_mac_event_disconnected(struct lbs_private *priv) | 26 | void lbs_mac_event_disconnected(struct lbs_private *priv) |
27 | { | 27 | { |
28 | struct lbs_adapter *adapter = priv->adapter; | ||
29 | union iwreq_data wrqu; | 28 | union iwreq_data wrqu; |
30 | 29 | ||
31 | if (adapter->connect_status != LBS_CONNECTED) | 30 | if (priv->connect_status != LBS_CONNECTED) |
32 | return; | 31 | return; |
33 | 32 | ||
34 | lbs_deb_enter(LBS_DEB_ASSOC); | 33 | lbs_deb_enter(LBS_DEB_ASSOC); |
@@ -45,31 +44,31 @@ void lbs_mac_event_disconnected(struct lbs_private *priv) | |||
45 | wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL); | 44 | wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL); |
46 | 45 | ||
47 | /* Free Tx and Rx packets */ | 46 | /* Free Tx and Rx packets */ |
48 | kfree_skb(priv->adapter->currenttxskb); | 47 | kfree_skb(priv->currenttxskb); |
49 | priv->adapter->currenttxskb = NULL; | 48 | priv->currenttxskb = NULL; |
50 | 49 | ||
51 | /* report disconnect to upper layer */ | 50 | /* report disconnect to upper layer */ |
52 | netif_stop_queue(priv->dev); | 51 | netif_stop_queue(priv->dev); |
53 | netif_carrier_off(priv->dev); | 52 | netif_carrier_off(priv->dev); |
54 | 53 | ||
55 | /* reset SNR/NF/RSSI values */ | 54 | /* reset SNR/NF/RSSI values */ |
56 | memset(adapter->SNR, 0x00, sizeof(adapter->SNR)); | 55 | memset(priv->SNR, 0x00, sizeof(priv->SNR)); |
57 | memset(adapter->NF, 0x00, sizeof(adapter->NF)); | 56 | memset(priv->NF, 0x00, sizeof(priv->NF)); |
58 | memset(adapter->RSSI, 0x00, sizeof(adapter->RSSI)); | 57 | memset(priv->RSSI, 0x00, sizeof(priv->RSSI)); |
59 | memset(adapter->rawSNR, 0x00, sizeof(adapter->rawSNR)); | 58 | memset(priv->rawSNR, 0x00, sizeof(priv->rawSNR)); |
60 | memset(adapter->rawNF, 0x00, sizeof(adapter->rawNF)); | 59 | memset(priv->rawNF, 0x00, sizeof(priv->rawNF)); |
61 | adapter->nextSNRNF = 0; | 60 | priv->nextSNRNF = 0; |
62 | adapter->numSNRNF = 0; | 61 | priv->numSNRNF = 0; |
63 | adapter->connect_status = LBS_DISCONNECTED; | 62 | priv->connect_status = LBS_DISCONNECTED; |
64 | 63 | ||
65 | /* Clear out associated SSID and BSSID since connection is | 64 | /* Clear out associated SSID and BSSID since connection is |
66 | * no longer valid. | 65 | * no longer valid. |
67 | */ | 66 | */ |
68 | memset(&adapter->curbssparams.bssid, 0, ETH_ALEN); | 67 | memset(&priv->curbssparams.bssid, 0, ETH_ALEN); |
69 | memset(&adapter->curbssparams.ssid, 0, IW_ESSID_MAX_SIZE); | 68 | memset(&priv->curbssparams.ssid, 0, IW_ESSID_MAX_SIZE); |
70 | adapter->curbssparams.ssid_len = 0; | 69 | priv->curbssparams.ssid_len = 0; |
71 | 70 | ||
72 | if (adapter->psstate != PS_STATE_FULL_POWER) { | 71 | if (priv->psstate != PS_STATE_FULL_POWER) { |
73 | /* make firmware to exit PS mode */ | 72 | /* make firmware to exit PS mode */ |
74 | lbs_deb_cmd("disconnected, so exit PS mode\n"); | 73 | lbs_deb_cmd("disconnected, so exit PS mode\n"); |
75 | lbs_ps_wakeup(priv, 0); | 74 | lbs_ps_wakeup(priv, 0); |
@@ -107,7 +106,6 @@ static int lbs_ret_reg_access(struct lbs_private *priv, | |||
107 | u16 type, struct cmd_ds_command *resp) | 106 | u16 type, struct cmd_ds_command *resp) |
108 | { | 107 | { |
109 | int ret = 0; | 108 | int ret = 0; |
110 | struct lbs_adapter *adapter = priv->adapter; | ||
111 | 109 | ||
112 | lbs_deb_enter(LBS_DEB_CMD); | 110 | lbs_deb_enter(LBS_DEB_CMD); |
113 | 111 | ||
@@ -116,8 +114,8 @@ static int lbs_ret_reg_access(struct lbs_private *priv, | |||
116 | { | 114 | { |
117 | struct cmd_ds_mac_reg_access *reg = &resp->params.macreg; | 115 | struct cmd_ds_mac_reg_access *reg = &resp->params.macreg; |
118 | 116 | ||
119 | adapter->offsetvalue.offset = (u32)le16_to_cpu(reg->offset); | 117 | priv->offsetvalue.offset = (u32)le16_to_cpu(reg->offset); |
120 | adapter->offsetvalue.value = le32_to_cpu(reg->value); | 118 | priv->offsetvalue.value = le32_to_cpu(reg->value); |
121 | break; | 119 | break; |
122 | } | 120 | } |
123 | 121 | ||
@@ -125,8 +123,8 @@ static int lbs_ret_reg_access(struct lbs_private *priv, | |||
125 | { | 123 | { |
126 | struct cmd_ds_bbp_reg_access *reg = &resp->params.bbpreg; | 124 | struct cmd_ds_bbp_reg_access *reg = &resp->params.bbpreg; |
127 | 125 | ||
128 | adapter->offsetvalue.offset = (u32)le16_to_cpu(reg->offset); | 126 | priv->offsetvalue.offset = (u32)le16_to_cpu(reg->offset); |
129 | adapter->offsetvalue.value = reg->value; | 127 | priv->offsetvalue.value = reg->value; |
130 | break; | 128 | break; |
131 | } | 129 | } |
132 | 130 | ||
@@ -134,8 +132,8 @@ static int lbs_ret_reg_access(struct lbs_private *priv, | |||
134 | { | 132 | { |
135 | struct cmd_ds_rf_reg_access *reg = &resp->params.rfreg; | 133 | struct cmd_ds_rf_reg_access *reg = &resp->params.rfreg; |
136 | 134 | ||
137 | adapter->offsetvalue.offset = (u32)le16_to_cpu(reg->offset); | 135 | priv->offsetvalue.offset = (u32)le16_to_cpu(reg->offset); |
138 | adapter->offsetvalue.value = reg->value; | 136 | priv->offsetvalue.value = reg->value; |
139 | break; | 137 | break; |
140 | } | 138 | } |
141 | 139 | ||
@@ -152,19 +150,18 @@ static int lbs_ret_get_hw_spec(struct lbs_private *priv, | |||
152 | { | 150 | { |
153 | u32 i; | 151 | u32 i; |
154 | struct cmd_ds_get_hw_spec *hwspec = &resp->params.hwspec; | 152 | struct cmd_ds_get_hw_spec *hwspec = &resp->params.hwspec; |
155 | struct lbs_adapter *adapter = priv->adapter; | ||
156 | int ret = 0; | 153 | int ret = 0; |
157 | DECLARE_MAC_BUF(mac); | 154 | DECLARE_MAC_BUF(mac); |
158 | 155 | ||
159 | lbs_deb_enter(LBS_DEB_CMD); | 156 | lbs_deb_enter(LBS_DEB_CMD); |
160 | 157 | ||
161 | adapter->fwcapinfo = le32_to_cpu(hwspec->fwcapinfo); | 158 | priv->fwcapinfo = le32_to_cpu(hwspec->fwcapinfo); |
162 | 159 | ||
163 | memcpy(adapter->fwreleasenumber, hwspec->fwreleasenumber, 4); | 160 | memcpy(priv->fwreleasenumber, hwspec->fwreleasenumber, 4); |
164 | 161 | ||
165 | lbs_deb_cmd("GET_HW_SPEC: firmware release %u.%u.%up%u\n", | 162 | lbs_deb_cmd("GET_HW_SPEC: firmware release %u.%u.%up%u\n", |
166 | adapter->fwreleasenumber[2], adapter->fwreleasenumber[1], | 163 | priv->fwreleasenumber[2], priv->fwreleasenumber[1], |
167 | adapter->fwreleasenumber[0], adapter->fwreleasenumber[3]); | 164 | priv->fwreleasenumber[0], priv->fwreleasenumber[3]); |
168 | lbs_deb_cmd("GET_HW_SPEC: MAC addr %s\n", | 165 | lbs_deb_cmd("GET_HW_SPEC: MAC addr %s\n", |
169 | print_mac(mac, hwspec->permanentaddr)); | 166 | print_mac(mac, hwspec->permanentaddr)); |
170 | lbs_deb_cmd("GET_HW_SPEC: hardware interface 0x%x, hardware spec 0x%04x\n", | 167 | lbs_deb_cmd("GET_HW_SPEC: hardware interface 0x%x, hardware spec 0x%04x\n", |
@@ -174,29 +171,29 @@ static int lbs_ret_get_hw_spec(struct lbs_private *priv, | |||
174 | * only ever be 8-bit, even though the field size is 16-bit. Some firmware | 171 | * only ever be 8-bit, even though the field size is 16-bit. Some firmware |
175 | * returns non-zero high 8 bits here. | 172 | * returns non-zero high 8 bits here. |
176 | */ | 173 | */ |
177 | adapter->regioncode = le16_to_cpu(hwspec->regioncode) & 0xFF; | 174 | priv->regioncode = le16_to_cpu(hwspec->regioncode) & 0xFF; |
178 | 175 | ||
179 | for (i = 0; i < MRVDRV_MAX_REGION_CODE; i++) { | 176 | for (i = 0; i < MRVDRV_MAX_REGION_CODE; i++) { |
180 | /* use the region code to search for the index */ | 177 | /* use the region code to search for the index */ |
181 | if (adapter->regioncode == lbs_region_code_to_index[i]) { | 178 | if (priv->regioncode == lbs_region_code_to_index[i]) { |
182 | break; | 179 | break; |
183 | } | 180 | } |
184 | } | 181 | } |
185 | 182 | ||
186 | /* if it's unidentified region code, use the default (USA) */ | 183 | /* if it's unidentified region code, use the default (USA) */ |
187 | if (i >= MRVDRV_MAX_REGION_CODE) { | 184 | if (i >= MRVDRV_MAX_REGION_CODE) { |
188 | adapter->regioncode = 0x10; | 185 | priv->regioncode = 0x10; |
189 | lbs_pr_info("unidentified region code; using the default (USA)\n"); | 186 | lbs_pr_info("unidentified region code; using the default (USA)\n"); |
190 | } | 187 | } |
191 | 188 | ||
192 | if (adapter->current_addr[0] == 0xff) | 189 | if (priv->current_addr[0] == 0xff) |
193 | memmove(adapter->current_addr, hwspec->permanentaddr, ETH_ALEN); | 190 | memmove(priv->current_addr, hwspec->permanentaddr, ETH_ALEN); |
194 | 191 | ||
195 | memcpy(priv->dev->dev_addr, adapter->current_addr, ETH_ALEN); | 192 | memcpy(priv->dev->dev_addr, priv->current_addr, ETH_ALEN); |
196 | if (priv->mesh_dev) | 193 | if (priv->mesh_dev) |
197 | memcpy(priv->mesh_dev->dev_addr, adapter->current_addr, ETH_ALEN); | 194 | memcpy(priv->mesh_dev->dev_addr, priv->current_addr, ETH_ALEN); |
198 | 195 | ||
199 | if (lbs_set_regiontable(priv, adapter->regioncode, 0)) { | 196 | if (lbs_set_regiontable(priv, priv->regioncode, 0)) { |
200 | ret = -1; | 197 | ret = -1; |
201 | goto done; | 198 | goto done; |
202 | } | 199 | } |
@@ -215,7 +212,6 @@ static int lbs_ret_802_11_sleep_params(struct lbs_private *priv, | |||
215 | struct cmd_ds_command *resp) | 212 | struct cmd_ds_command *resp) |
216 | { | 213 | { |
217 | struct cmd_ds_802_11_sleep_params *sp = &resp->params.sleep_params; | 214 | struct cmd_ds_802_11_sleep_params *sp = &resp->params.sleep_params; |
218 | struct lbs_adapter *adapter = priv->adapter; | ||
219 | 215 | ||
220 | lbs_deb_enter(LBS_DEB_CMD); | 216 | lbs_deb_enter(LBS_DEB_CMD); |
221 | 217 | ||
@@ -224,12 +220,12 @@ static int lbs_ret_802_11_sleep_params(struct lbs_private *priv, | |||
224 | le16_to_cpu(sp->offset), le16_to_cpu(sp->stabletime), | 220 | le16_to_cpu(sp->offset), le16_to_cpu(sp->stabletime), |
225 | sp->calcontrol, sp->externalsleepclk); | 221 | sp->calcontrol, sp->externalsleepclk); |
226 | 222 | ||
227 | adapter->sp.sp_error = le16_to_cpu(sp->error); | 223 | priv->sp.sp_error = le16_to_cpu(sp->error); |
228 | adapter->sp.sp_offset = le16_to_cpu(sp->offset); | 224 | priv->sp.sp_offset = le16_to_cpu(sp->offset); |
229 | adapter->sp.sp_stabletime = le16_to_cpu(sp->stabletime); | 225 | priv->sp.sp_stabletime = le16_to_cpu(sp->stabletime); |
230 | adapter->sp.sp_calcontrol = sp->calcontrol; | 226 | priv->sp.sp_calcontrol = sp->calcontrol; |
231 | adapter->sp.sp_extsleepclk = sp->externalsleepclk; | 227 | priv->sp.sp_extsleepclk = sp->externalsleepclk; |
232 | adapter->sp.sp_reserved = le16_to_cpu(sp->reserved); | 228 | priv->sp.sp_reserved = le16_to_cpu(sp->reserved); |
233 | 229 | ||
234 | lbs_deb_enter(LBS_DEB_CMD); | 230 | lbs_deb_enter(LBS_DEB_CMD); |
235 | return 0; | 231 | return 0; |
@@ -239,13 +235,12 @@ static int lbs_ret_802_11_stat(struct lbs_private *priv, | |||
239 | struct cmd_ds_command *resp) | 235 | struct cmd_ds_command *resp) |
240 | { | 236 | { |
241 | lbs_deb_enter(LBS_DEB_CMD); | 237 | lbs_deb_enter(LBS_DEB_CMD); |
242 | /* currently adapter->wlan802_11Stat is unused | 238 | /* currently priv->wlan802_11Stat is unused |
243 | 239 | ||
244 | struct cmd_ds_802_11_get_stat *p11Stat = &resp->params.gstat; | 240 | struct cmd_ds_802_11_get_stat *p11Stat = &resp->params.gstat; |
245 | struct lbs_adapter *adapter = priv->adapter; | ||
246 | 241 | ||
247 | // TODO Convert it to Big endian befor copy | 242 | // TODO Convert it to Big endian befor copy |
248 | memcpy(&adapter->wlan802_11Stat, | 243 | memcpy(&priv->wlan802_11Stat, |
249 | p11Stat, sizeof(struct cmd_ds_802_11_get_stat)); | 244 | p11Stat, sizeof(struct cmd_ds_802_11_get_stat)); |
250 | */ | 245 | */ |
251 | lbs_deb_leave(LBS_DEB_CMD); | 246 | lbs_deb_leave(LBS_DEB_CMD); |
@@ -268,22 +263,22 @@ static int lbs_ret_802_11_snmp_mib(struct lbs_private *priv, | |||
268 | if (querytype == CMD_ACT_GET) { | 263 | if (querytype == CMD_ACT_GET) { |
269 | switch (oid) { | 264 | switch (oid) { |
270 | case FRAGTHRESH_I: | 265 | case FRAGTHRESH_I: |
271 | priv->adapter->fragthsd = | 266 | priv->fragthsd = |
272 | le16_to_cpu(*((__le16 *)(smib->value))); | 267 | le16_to_cpu(*((__le16 *)(smib->value))); |
273 | lbs_deb_cmd("SNMP_RESP: frag threshold %u\n", | 268 | lbs_deb_cmd("SNMP_RESP: frag threshold %u\n", |
274 | priv->adapter->fragthsd); | 269 | priv->fragthsd); |
275 | break; | 270 | break; |
276 | case RTSTHRESH_I: | 271 | case RTSTHRESH_I: |
277 | priv->adapter->rtsthsd = | 272 | priv->rtsthsd = |
278 | le16_to_cpu(*((__le16 *)(smib->value))); | 273 | le16_to_cpu(*((__le16 *)(smib->value))); |
279 | lbs_deb_cmd("SNMP_RESP: rts threshold %u\n", | 274 | lbs_deb_cmd("SNMP_RESP: rts threshold %u\n", |
280 | priv->adapter->rtsthsd); | 275 | priv->rtsthsd); |
281 | break; | 276 | break; |
282 | case SHORT_RETRYLIM_I: | 277 | case SHORT_RETRYLIM_I: |
283 | priv->adapter->txretrycount = | 278 | priv->txretrycount = |
284 | le16_to_cpu(*((__le16 *)(smib->value))); | 279 | le16_to_cpu(*((__le16 *)(smib->value))); |
285 | lbs_deb_cmd("SNMP_RESP: tx retry count %u\n", | 280 | lbs_deb_cmd("SNMP_RESP: tx retry count %u\n", |
286 | priv->adapter->rtsthsd); | 281 | priv->rtsthsd); |
287 | break; | 282 | break; |
288 | default: | 283 | default: |
289 | break; | 284 | break; |
@@ -299,7 +294,6 @@ static int lbs_ret_802_11_key_material(struct lbs_private *priv, | |||
299 | { | 294 | { |
300 | struct cmd_ds_802_11_key_material *pkeymaterial = | 295 | struct cmd_ds_802_11_key_material *pkeymaterial = |
301 | &resp->params.keymaterial; | 296 | &resp->params.keymaterial; |
302 | struct lbs_adapter *adapter = priv->adapter; | ||
303 | u16 action = le16_to_cpu(pkeymaterial->action); | 297 | u16 action = le16_to_cpu(pkeymaterial->action); |
304 | 298 | ||
305 | lbs_deb_enter(LBS_DEB_CMD); | 299 | lbs_deb_enter(LBS_DEB_CMD); |
@@ -327,9 +321,9 @@ static int lbs_ret_802_11_key_material(struct lbs_private *priv, | |||
327 | break; | 321 | break; |
328 | 322 | ||
329 | if (key_flags & KEY_INFO_WPA_UNICAST) | 323 | if (key_flags & KEY_INFO_WPA_UNICAST) |
330 | pkey = &adapter->wpa_unicast_key; | 324 | pkey = &priv->wpa_unicast_key; |
331 | else if (key_flags & KEY_INFO_WPA_MCAST) | 325 | else if (key_flags & KEY_INFO_WPA_MCAST) |
332 | pkey = &adapter->wpa_mcast_key; | 326 | pkey = &priv->wpa_mcast_key; |
333 | else | 327 | else |
334 | break; | 328 | break; |
335 | 329 | ||
@@ -354,11 +348,10 @@ static int lbs_ret_802_11_mac_address(struct lbs_private *priv, | |||
354 | struct cmd_ds_command *resp) | 348 | struct cmd_ds_command *resp) |
355 | { | 349 | { |
356 | struct cmd_ds_802_11_mac_address *macadd = &resp->params.macadd; | 350 | struct cmd_ds_802_11_mac_address *macadd = &resp->params.macadd; |
357 | struct lbs_adapter *adapter = priv->adapter; | ||
358 | 351 | ||
359 | lbs_deb_enter(LBS_DEB_CMD); | 352 | lbs_deb_enter(LBS_DEB_CMD); |
360 | 353 | ||
361 | memcpy(adapter->current_addr, macadd->macadd, ETH_ALEN); | 354 | memcpy(priv->current_addr, macadd->macadd, ETH_ALEN); |
362 | 355 | ||
363 | lbs_deb_enter(LBS_DEB_CMD); | 356 | lbs_deb_enter(LBS_DEB_CMD); |
364 | return 0; | 357 | return 0; |
@@ -368,13 +361,12 @@ static int lbs_ret_802_11_rf_tx_power(struct lbs_private *priv, | |||
368 | struct cmd_ds_command *resp) | 361 | struct cmd_ds_command *resp) |
369 | { | 362 | { |
370 | struct cmd_ds_802_11_rf_tx_power *rtp = &resp->params.txp; | 363 | struct cmd_ds_802_11_rf_tx_power *rtp = &resp->params.txp; |
371 | struct lbs_adapter *adapter = priv->adapter; | ||
372 | 364 | ||
373 | lbs_deb_enter(LBS_DEB_CMD); | 365 | lbs_deb_enter(LBS_DEB_CMD); |
374 | 366 | ||
375 | adapter->txpowerlevel = le16_to_cpu(rtp->currentlevel); | 367 | priv->txpowerlevel = le16_to_cpu(rtp->currentlevel); |
376 | 368 | ||
377 | lbs_deb_cmd("TX power currently %d\n", adapter->txpowerlevel); | 369 | lbs_deb_cmd("TX power currently %d\n", priv->txpowerlevel); |
378 | 370 | ||
379 | lbs_deb_leave(LBS_DEB_CMD); | 371 | lbs_deb_leave(LBS_DEB_CMD); |
380 | return 0; | 372 | return 0; |
@@ -384,13 +376,12 @@ static int lbs_ret_802_11_rate_adapt_rateset(struct lbs_private *priv, | |||
384 | struct cmd_ds_command *resp) | 376 | struct cmd_ds_command *resp) |
385 | { | 377 | { |
386 | struct cmd_ds_802_11_rate_adapt_rateset *rates = &resp->params.rateset; | 378 | struct cmd_ds_802_11_rate_adapt_rateset *rates = &resp->params.rateset; |
387 | struct lbs_adapter *adapter = priv->adapter; | ||
388 | 379 | ||
389 | lbs_deb_enter(LBS_DEB_CMD); | 380 | lbs_deb_enter(LBS_DEB_CMD); |
390 | 381 | ||
391 | if (rates->action == CMD_ACT_GET) { | 382 | if (rates->action == CMD_ACT_GET) { |
392 | adapter->enablehwauto = le16_to_cpu(rates->enablehwauto); | 383 | priv->enablehwauto = le16_to_cpu(rates->enablehwauto); |
393 | adapter->ratebitmap = le16_to_cpu(rates->bitmap); | 384 | priv->ratebitmap = le16_to_cpu(rates->bitmap); |
394 | } | 385 | } |
395 | 386 | ||
396 | lbs_deb_leave(LBS_DEB_CMD); | 387 | lbs_deb_leave(LBS_DEB_CMD); |
@@ -401,7 +392,6 @@ static int lbs_ret_802_11_data_rate(struct lbs_private *priv, | |||
401 | struct cmd_ds_command *resp) | 392 | struct cmd_ds_command *resp) |
402 | { | 393 | { |
403 | struct cmd_ds_802_11_data_rate *pdatarate = &resp->params.drate; | 394 | struct cmd_ds_802_11_data_rate *pdatarate = &resp->params.drate; |
404 | struct lbs_adapter *adapter = priv->adapter; | ||
405 | 395 | ||
406 | lbs_deb_enter(LBS_DEB_CMD); | 396 | lbs_deb_enter(LBS_DEB_CMD); |
407 | 397 | ||
@@ -411,8 +401,8 @@ static int lbs_ret_802_11_data_rate(struct lbs_private *priv, | |||
411 | /* FIXME: get actual rates FW can do if this command actually returns | 401 | /* FIXME: get actual rates FW can do if this command actually returns |
412 | * all data rates supported. | 402 | * all data rates supported. |
413 | */ | 403 | */ |
414 | adapter->cur_rate = lbs_fw_index_to_data_rate(pdatarate->rates[0]); | 404 | priv->cur_rate = lbs_fw_index_to_data_rate(pdatarate->rates[0]); |
415 | lbs_deb_cmd("DATA_RATE: current rate 0x%02x\n", adapter->cur_rate); | 405 | lbs_deb_cmd("DATA_RATE: current rate 0x%02x\n", priv->cur_rate); |
416 | 406 | ||
417 | lbs_deb_leave(LBS_DEB_CMD); | 407 | lbs_deb_leave(LBS_DEB_CMD); |
418 | return 0; | 408 | return 0; |
@@ -422,19 +412,18 @@ static int lbs_ret_802_11_rf_channel(struct lbs_private *priv, | |||
422 | struct cmd_ds_command *resp) | 412 | struct cmd_ds_command *resp) |
423 | { | 413 | { |
424 | struct cmd_ds_802_11_rf_channel *rfchannel = &resp->params.rfchannel; | 414 | struct cmd_ds_802_11_rf_channel *rfchannel = &resp->params.rfchannel; |
425 | struct lbs_adapter *adapter = priv->adapter; | ||
426 | u16 action = le16_to_cpu(rfchannel->action); | 415 | u16 action = le16_to_cpu(rfchannel->action); |
427 | u16 newchannel = le16_to_cpu(rfchannel->currentchannel); | 416 | u16 newchannel = le16_to_cpu(rfchannel->currentchannel); |
428 | 417 | ||
429 | lbs_deb_enter(LBS_DEB_CMD); | 418 | lbs_deb_enter(LBS_DEB_CMD); |
430 | 419 | ||
431 | if (action == CMD_OPT_802_11_RF_CHANNEL_GET | 420 | if (action == CMD_OPT_802_11_RF_CHANNEL_GET |
432 | && adapter->curbssparams.channel != newchannel) { | 421 | && priv->curbssparams.channel != newchannel) { |
433 | lbs_deb_cmd("channel switch from %d to %d\n", | 422 | lbs_deb_cmd("channel switch from %d to %d\n", |
434 | adapter->curbssparams.channel, newchannel); | 423 | priv->curbssparams.channel, newchannel); |
435 | 424 | ||
436 | /* Update the channel again */ | 425 | /* Update the channel again */ |
437 | adapter->curbssparams.channel = newchannel; | 426 | priv->curbssparams.channel = newchannel; |
438 | } | 427 | } |
439 | 428 | ||
440 | lbs_deb_enter(LBS_DEB_CMD); | 429 | lbs_deb_enter(LBS_DEB_CMD); |
@@ -445,28 +434,27 @@ static int lbs_ret_802_11_rssi(struct lbs_private *priv, | |||
445 | struct cmd_ds_command *resp) | 434 | struct cmd_ds_command *resp) |
446 | { | 435 | { |
447 | struct cmd_ds_802_11_rssi_rsp *rssirsp = &resp->params.rssirsp; | 436 | struct cmd_ds_802_11_rssi_rsp *rssirsp = &resp->params.rssirsp; |
448 | struct lbs_adapter *adapter = priv->adapter; | ||
449 | 437 | ||
450 | lbs_deb_enter(LBS_DEB_CMD); | 438 | lbs_deb_enter(LBS_DEB_CMD); |
451 | 439 | ||
452 | /* store the non average value */ | 440 | /* store the non average value */ |
453 | adapter->SNR[TYPE_BEACON][TYPE_NOAVG] = le16_to_cpu(rssirsp->SNR); | 441 | priv->SNR[TYPE_BEACON][TYPE_NOAVG] = le16_to_cpu(rssirsp->SNR); |
454 | adapter->NF[TYPE_BEACON][TYPE_NOAVG] = le16_to_cpu(rssirsp->noisefloor); | 442 | priv->NF[TYPE_BEACON][TYPE_NOAVG] = le16_to_cpu(rssirsp->noisefloor); |
455 | 443 | ||
456 | adapter->SNR[TYPE_BEACON][TYPE_AVG] = le16_to_cpu(rssirsp->avgSNR); | 444 | priv->SNR[TYPE_BEACON][TYPE_AVG] = le16_to_cpu(rssirsp->avgSNR); |
457 | adapter->NF[TYPE_BEACON][TYPE_AVG] = le16_to_cpu(rssirsp->avgnoisefloor); | 445 | priv->NF[TYPE_BEACON][TYPE_AVG] = le16_to_cpu(rssirsp->avgnoisefloor); |
458 | 446 | ||
459 | adapter->RSSI[TYPE_BEACON][TYPE_NOAVG] = | 447 | priv->RSSI[TYPE_BEACON][TYPE_NOAVG] = |
460 | CAL_RSSI(adapter->SNR[TYPE_BEACON][TYPE_NOAVG], | 448 | CAL_RSSI(priv->SNR[TYPE_BEACON][TYPE_NOAVG], |
461 | adapter->NF[TYPE_BEACON][TYPE_NOAVG]); | 449 | priv->NF[TYPE_BEACON][TYPE_NOAVG]); |
462 | 450 | ||
463 | adapter->RSSI[TYPE_BEACON][TYPE_AVG] = | 451 | priv->RSSI[TYPE_BEACON][TYPE_AVG] = |
464 | CAL_RSSI(adapter->SNR[TYPE_BEACON][TYPE_AVG] / AVG_SCALE, | 452 | CAL_RSSI(priv->SNR[TYPE_BEACON][TYPE_AVG] / AVG_SCALE, |
465 | adapter->NF[TYPE_BEACON][TYPE_AVG] / AVG_SCALE); | 453 | priv->NF[TYPE_BEACON][TYPE_AVG] / AVG_SCALE); |
466 | 454 | ||
467 | lbs_deb_cmd("RSSI: beacon %d, avg %d\n", | 455 | lbs_deb_cmd("RSSI: beacon %d, avg %d\n", |
468 | adapter->RSSI[TYPE_BEACON][TYPE_NOAVG], | 456 | priv->RSSI[TYPE_BEACON][TYPE_NOAVG], |
469 | adapter->RSSI[TYPE_BEACON][TYPE_AVG]); | 457 | priv->RSSI[TYPE_BEACON][TYPE_AVG]); |
470 | 458 | ||
471 | lbs_deb_leave(LBS_DEB_CMD); | 459 | lbs_deb_leave(LBS_DEB_CMD); |
472 | return 0; | 460 | return 0; |
@@ -475,9 +463,8 @@ static int lbs_ret_802_11_rssi(struct lbs_private *priv, | |||
475 | static int lbs_ret_802_11_eeprom_access(struct lbs_private *priv, | 463 | static int lbs_ret_802_11_eeprom_access(struct lbs_private *priv, |
476 | struct cmd_ds_command *resp) | 464 | struct cmd_ds_command *resp) |
477 | { | 465 | { |
478 | struct lbs_adapter *adapter = priv->adapter; | ||
479 | struct lbs_ioctl_regrdwr *pbuf; | 466 | struct lbs_ioctl_regrdwr *pbuf; |
480 | pbuf = (struct lbs_ioctl_regrdwr *) adapter->prdeeprom; | 467 | pbuf = (struct lbs_ioctl_regrdwr *) priv->prdeeprom; |
481 | 468 | ||
482 | lbs_deb_enter_args(LBS_DEB_CMD, "len %d", | 469 | lbs_deb_enter_args(LBS_DEB_CMD, "len %d", |
483 | le16_to_cpu(resp->params.rdeeprom.bytecount)); | 470 | le16_to_cpu(resp->params.rdeeprom.bytecount)); |
@@ -502,12 +489,11 @@ static int lbs_ret_get_log(struct lbs_private *priv, | |||
502 | struct cmd_ds_command *resp) | 489 | struct cmd_ds_command *resp) |
503 | { | 490 | { |
504 | struct cmd_ds_802_11_get_log *logmessage = &resp->params.glog; | 491 | struct cmd_ds_802_11_get_log *logmessage = &resp->params.glog; |
505 | struct lbs_adapter *adapter = priv->adapter; | ||
506 | 492 | ||
507 | lbs_deb_enter(LBS_DEB_CMD); | 493 | lbs_deb_enter(LBS_DEB_CMD); |
508 | 494 | ||
509 | /* Stored little-endian */ | 495 | /* Stored little-endian */ |
510 | memcpy(&adapter->logmsg, logmessage, sizeof(struct cmd_ds_802_11_get_log)); | 496 | memcpy(&priv->logmsg, logmessage, sizeof(struct cmd_ds_802_11_get_log)); |
511 | 497 | ||
512 | lbs_deb_leave(LBS_DEB_CMD); | 498 | lbs_deb_leave(LBS_DEB_CMD); |
513 | return 0; | 499 | return 0; |
@@ -517,8 +503,7 @@ static int lbs_ret_802_11_enable_rsn(struct lbs_private *priv, | |||
517 | struct cmd_ds_command *resp) | 503 | struct cmd_ds_command *resp) |
518 | { | 504 | { |
519 | struct cmd_ds_802_11_enable_rsn *enable_rsn = &resp->params.enbrsn; | 505 | struct cmd_ds_802_11_enable_rsn *enable_rsn = &resp->params.enbrsn; |
520 | struct lbs_adapter *adapter = priv->adapter; | 506 | u32 * pdata_buf = priv->cur_cmd->pdata_buf; |
521 | u32 * pdata_buf = adapter->cur_cmd->pdata_buf; | ||
522 | 507 | ||
523 | lbs_deb_enter(LBS_DEB_CMD); | 508 | lbs_deb_enter(LBS_DEB_CMD); |
524 | 509 | ||
@@ -536,13 +521,12 @@ static int lbs_ret_802_11_bcn_ctrl(struct lbs_private * priv, | |||
536 | { | 521 | { |
537 | struct cmd_ds_802_11_beacon_control *bcn_ctrl = | 522 | struct cmd_ds_802_11_beacon_control *bcn_ctrl = |
538 | &resp->params.bcn_ctrl; | 523 | &resp->params.bcn_ctrl; |
539 | struct lbs_adapter *adapter = priv->adapter; | ||
540 | 524 | ||
541 | lbs_deb_enter(LBS_DEB_CMD); | 525 | lbs_deb_enter(LBS_DEB_CMD); |
542 | 526 | ||
543 | if (bcn_ctrl->action == CMD_ACT_GET) { | 527 | if (bcn_ctrl->action == CMD_ACT_GET) { |
544 | adapter->beacon_enable = (u8) le16_to_cpu(bcn_ctrl->beacon_enable); | 528 | priv->beacon_enable = (u8) le16_to_cpu(bcn_ctrl->beacon_enable); |
545 | adapter->beacon_period = le16_to_cpu(bcn_ctrl->beacon_period); | 529 | priv->beacon_period = le16_to_cpu(bcn_ctrl->beacon_period); |
546 | } | 530 | } |
547 | 531 | ||
548 | lbs_deb_enter(LBS_DEB_CMD); | 532 | lbs_deb_enter(LBS_DEB_CMD); |
@@ -552,11 +536,10 @@ static int lbs_ret_802_11_bcn_ctrl(struct lbs_private * priv, | |||
552 | static int lbs_ret_802_11_subscribe_event(struct lbs_private *priv, | 536 | static int lbs_ret_802_11_subscribe_event(struct lbs_private *priv, |
553 | struct cmd_ds_command *resp) | 537 | struct cmd_ds_command *resp) |
554 | { | 538 | { |
555 | struct lbs_adapter *adapter = priv->adapter; | ||
556 | struct cmd_ds_802_11_subscribe_event *cmd_event = | 539 | struct cmd_ds_802_11_subscribe_event *cmd_event = |
557 | &resp->params.subscribe_event; | 540 | &resp->params.subscribe_event; |
558 | struct cmd_ds_802_11_subscribe_event *dst_event = | 541 | struct cmd_ds_802_11_subscribe_event *dst_event = |
559 | adapter->cur_cmd->pdata_buf; | 542 | priv->cur_cmd->pdata_buf; |
560 | 543 | ||
561 | lbs_deb_enter(LBS_DEB_CMD); | 544 | lbs_deb_enter(LBS_DEB_CMD); |
562 | 545 | ||
@@ -575,7 +558,6 @@ static inline int handle_cmd_response(u16 respcmd, | |||
575 | { | 558 | { |
576 | int ret = 0; | 559 | int ret = 0; |
577 | unsigned long flags; | 560 | unsigned long flags; |
578 | struct lbs_adapter *adapter = priv->adapter; | ||
579 | 561 | ||
580 | lbs_deb_enter(LBS_DEB_HOST); | 562 | lbs_deb_enter(LBS_DEB_HOST); |
581 | 563 | ||
@@ -628,10 +610,10 @@ static inline int handle_cmd_response(u16 respcmd, | |||
628 | 610 | ||
629 | case CMD_RET(CMD_802_11_SET_AFC): | 611 | case CMD_RET(CMD_802_11_SET_AFC): |
630 | case CMD_RET(CMD_802_11_GET_AFC): | 612 | case CMD_RET(CMD_802_11_GET_AFC): |
631 | spin_lock_irqsave(&adapter->driver_lock, flags); | 613 | spin_lock_irqsave(&priv->driver_lock, flags); |
632 | memmove(adapter->cur_cmd->pdata_buf, &resp->params.afc, | 614 | memmove(priv->cur_cmd->pdata_buf, &resp->params.afc, |
633 | sizeof(struct cmd_ds_802_11_afc)); | 615 | sizeof(struct cmd_ds_802_11_afc)); |
634 | spin_unlock_irqrestore(&adapter->driver_lock, flags); | 616 | spin_unlock_irqrestore(&priv->driver_lock, flags); |
635 | 617 | ||
636 | break; | 618 | break; |
637 | 619 | ||
@@ -686,59 +668,59 @@ static inline int handle_cmd_response(u16 respcmd, | |||
686 | ret = lbs_ret_802_11_sleep_params(priv, resp); | 668 | ret = lbs_ret_802_11_sleep_params(priv, resp); |
687 | break; | 669 | break; |
688 | case CMD_RET(CMD_802_11_INACTIVITY_TIMEOUT): | 670 | case CMD_RET(CMD_802_11_INACTIVITY_TIMEOUT): |
689 | spin_lock_irqsave(&adapter->driver_lock, flags); | 671 | spin_lock_irqsave(&priv->driver_lock, flags); |
690 | *((u16 *) adapter->cur_cmd->pdata_buf) = | 672 | *((u16 *) priv->cur_cmd->pdata_buf) = |
691 | le16_to_cpu(resp->params.inactivity_timeout.timeout); | 673 | le16_to_cpu(resp->params.inactivity_timeout.timeout); |
692 | spin_unlock_irqrestore(&adapter->driver_lock, flags); | 674 | spin_unlock_irqrestore(&priv->driver_lock, flags); |
693 | break; | 675 | break; |
694 | 676 | ||
695 | case CMD_RET(CMD_802_11_TPC_CFG): | 677 | case CMD_RET(CMD_802_11_TPC_CFG): |
696 | spin_lock_irqsave(&adapter->driver_lock, flags); | 678 | spin_lock_irqsave(&priv->driver_lock, flags); |
697 | memmove(adapter->cur_cmd->pdata_buf, &resp->params.tpccfg, | 679 | memmove(priv->cur_cmd->pdata_buf, &resp->params.tpccfg, |
698 | sizeof(struct cmd_ds_802_11_tpc_cfg)); | 680 | sizeof(struct cmd_ds_802_11_tpc_cfg)); |
699 | spin_unlock_irqrestore(&adapter->driver_lock, flags); | 681 | spin_unlock_irqrestore(&priv->driver_lock, flags); |
700 | break; | 682 | break; |
701 | case CMD_RET(CMD_802_11_LED_GPIO_CTRL): | 683 | case CMD_RET(CMD_802_11_LED_GPIO_CTRL): |
702 | spin_lock_irqsave(&adapter->driver_lock, flags); | 684 | spin_lock_irqsave(&priv->driver_lock, flags); |
703 | memmove(adapter->cur_cmd->pdata_buf, &resp->params.ledgpio, | 685 | memmove(priv->cur_cmd->pdata_buf, &resp->params.ledgpio, |
704 | sizeof(struct cmd_ds_802_11_led_ctrl)); | 686 | sizeof(struct cmd_ds_802_11_led_ctrl)); |
705 | spin_unlock_irqrestore(&adapter->driver_lock, flags); | 687 | spin_unlock_irqrestore(&priv->driver_lock, flags); |
706 | break; | 688 | break; |
707 | case CMD_RET(CMD_802_11_SUBSCRIBE_EVENT): | 689 | case CMD_RET(CMD_802_11_SUBSCRIBE_EVENT): |
708 | ret = lbs_ret_802_11_subscribe_event(priv, resp); | 690 | ret = lbs_ret_802_11_subscribe_event(priv, resp); |
709 | break; | 691 | break; |
710 | 692 | ||
711 | case CMD_RET(CMD_802_11_PWR_CFG): | 693 | case CMD_RET(CMD_802_11_PWR_CFG): |
712 | spin_lock_irqsave(&adapter->driver_lock, flags); | 694 | spin_lock_irqsave(&priv->driver_lock, flags); |
713 | memmove(adapter->cur_cmd->pdata_buf, &resp->params.pwrcfg, | 695 | memmove(priv->cur_cmd->pdata_buf, &resp->params.pwrcfg, |
714 | sizeof(struct cmd_ds_802_11_pwr_cfg)); | 696 | sizeof(struct cmd_ds_802_11_pwr_cfg)); |
715 | spin_unlock_irqrestore(&adapter->driver_lock, flags); | 697 | spin_unlock_irqrestore(&priv->driver_lock, flags); |
716 | 698 | ||
717 | break; | 699 | break; |
718 | 700 | ||
719 | case CMD_RET(CMD_GET_TSF): | 701 | case CMD_RET(CMD_GET_TSF): |
720 | spin_lock_irqsave(&adapter->driver_lock, flags); | 702 | spin_lock_irqsave(&priv->driver_lock, flags); |
721 | memcpy(priv->adapter->cur_cmd->pdata_buf, | 703 | memcpy(priv->cur_cmd->pdata_buf, |
722 | &resp->params.gettsf.tsfvalue, sizeof(u64)); | 704 | &resp->params.gettsf.tsfvalue, sizeof(u64)); |
723 | spin_unlock_irqrestore(&adapter->driver_lock, flags); | 705 | spin_unlock_irqrestore(&priv->driver_lock, flags); |
724 | break; | 706 | break; |
725 | case CMD_RET(CMD_BT_ACCESS): | 707 | case CMD_RET(CMD_BT_ACCESS): |
726 | spin_lock_irqsave(&adapter->driver_lock, flags); | 708 | spin_lock_irqsave(&priv->driver_lock, flags); |
727 | if (adapter->cur_cmd->pdata_buf) | 709 | if (priv->cur_cmd->pdata_buf) |
728 | memcpy(adapter->cur_cmd->pdata_buf, | 710 | memcpy(priv->cur_cmd->pdata_buf, |
729 | &resp->params.bt.addr1, 2 * ETH_ALEN); | 711 | &resp->params.bt.addr1, 2 * ETH_ALEN); |
730 | spin_unlock_irqrestore(&adapter->driver_lock, flags); | 712 | spin_unlock_irqrestore(&priv->driver_lock, flags); |
731 | break; | 713 | break; |
732 | case CMD_RET(CMD_FWT_ACCESS): | 714 | case CMD_RET(CMD_FWT_ACCESS): |
733 | spin_lock_irqsave(&adapter->driver_lock, flags); | 715 | spin_lock_irqsave(&priv->driver_lock, flags); |
734 | if (adapter->cur_cmd->pdata_buf) | 716 | if (priv->cur_cmd->pdata_buf) |
735 | memcpy(adapter->cur_cmd->pdata_buf, &resp->params.fwt, | 717 | memcpy(priv->cur_cmd->pdata_buf, &resp->params.fwt, |
736 | sizeof(resp->params.fwt)); | 718 | sizeof(resp->params.fwt)); |
737 | spin_unlock_irqrestore(&adapter->driver_lock, flags); | 719 | spin_unlock_irqrestore(&priv->driver_lock, flags); |
738 | break; | 720 | break; |
739 | case CMD_RET(CMD_MESH_ACCESS): | 721 | case CMD_RET(CMD_MESH_ACCESS): |
740 | if (adapter->cur_cmd->pdata_buf) | 722 | if (priv->cur_cmd->pdata_buf) |
741 | memcpy(adapter->cur_cmd->pdata_buf, &resp->params.mesh, | 723 | memcpy(priv->cur_cmd->pdata_buf, &resp->params.mesh, |
742 | sizeof(resp->params.mesh)); | 724 | sizeof(resp->params.mesh)); |
743 | break; | 725 | break; |
744 | case CMD_RET(CMD_802_11_BEACON_CTRL): | 726 | case CMD_RET(CMD_802_11_BEACON_CTRL): |
@@ -758,7 +740,6 @@ int lbs_process_rx_command(struct lbs_private *priv) | |||
758 | { | 740 | { |
759 | u16 respcmd; | 741 | u16 respcmd; |
760 | struct cmd_ds_command *resp; | 742 | struct cmd_ds_command *resp; |
761 | struct lbs_adapter *adapter = priv->adapter; | ||
762 | int ret = 0; | 743 | int ret = 0; |
763 | ulong flags; | 744 | ulong flags; |
764 | u16 result; | 745 | u16 result; |
@@ -766,39 +747,39 @@ int lbs_process_rx_command(struct lbs_private *priv) | |||
766 | lbs_deb_enter(LBS_DEB_HOST); | 747 | lbs_deb_enter(LBS_DEB_HOST); |
767 | 748 | ||
768 | /* Now we got response from FW, cancel the command timer */ | 749 | /* Now we got response from FW, cancel the command timer */ |
769 | del_timer(&adapter->command_timer); | 750 | del_timer(&priv->command_timer); |
770 | 751 | ||
771 | mutex_lock(&adapter->lock); | 752 | mutex_lock(&priv->lock); |
772 | spin_lock_irqsave(&adapter->driver_lock, flags); | 753 | spin_lock_irqsave(&priv->driver_lock, flags); |
773 | 754 | ||
774 | if (!adapter->cur_cmd) { | 755 | if (!priv->cur_cmd) { |
775 | lbs_deb_host("CMD_RESP: cur_cmd is NULL\n"); | 756 | lbs_deb_host("CMD_RESP: cur_cmd is NULL\n"); |
776 | ret = -1; | 757 | ret = -1; |
777 | spin_unlock_irqrestore(&adapter->driver_lock, flags); | 758 | spin_unlock_irqrestore(&priv->driver_lock, flags); |
778 | goto done; | 759 | goto done; |
779 | } | 760 | } |
780 | resp = (struct cmd_ds_command *)(adapter->cur_cmd->bufvirtualaddr); | 761 | resp = (struct cmd_ds_command *)(priv->cur_cmd->bufvirtualaddr); |
781 | 762 | ||
782 | respcmd = le16_to_cpu(resp->command); | 763 | respcmd = le16_to_cpu(resp->command); |
783 | result = le16_to_cpu(resp->result); | 764 | result = le16_to_cpu(resp->result); |
784 | 765 | ||
785 | lbs_deb_host("CMD_RESP: response 0x%04x, size %d, jiffies %lu\n", | 766 | lbs_deb_host("CMD_RESP: response 0x%04x, size %d, jiffies %lu\n", |
786 | respcmd, priv->upld_len, jiffies); | 767 | respcmd, priv->upld_len, jiffies); |
787 | lbs_deb_hex(LBS_DEB_HOST, "CMD_RESP", adapter->cur_cmd->bufvirtualaddr, | 768 | lbs_deb_hex(LBS_DEB_HOST, "CMD_RESP", priv->cur_cmd->bufvirtualaddr, |
788 | priv->upld_len); | 769 | priv->upld_len); |
789 | 770 | ||
790 | if (!(respcmd & 0x8000)) { | 771 | if (!(respcmd & 0x8000)) { |
791 | lbs_deb_host("invalid response!\n"); | 772 | lbs_deb_host("invalid response!\n"); |
792 | adapter->cur_cmd_retcode = -1; | 773 | priv->cur_cmd_retcode = -1; |
793 | __lbs_cleanup_and_insert_cmd(priv, adapter->cur_cmd); | 774 | __lbs_cleanup_and_insert_cmd(priv, priv->cur_cmd); |
794 | adapter->cur_cmd = NULL; | 775 | priv->cur_cmd = NULL; |
795 | spin_unlock_irqrestore(&adapter->driver_lock, flags); | 776 | spin_unlock_irqrestore(&priv->driver_lock, flags); |
796 | ret = -1; | 777 | ret = -1; |
797 | goto done; | 778 | goto done; |
798 | } | 779 | } |
799 | 780 | ||
800 | /* Store the response code to cur_cmd_retcode. */ | 781 | /* Store the response code to cur_cmd_retcode. */ |
801 | adapter->cur_cmd_retcode = result; | 782 | priv->cur_cmd_retcode = result; |
802 | 783 | ||
803 | if (respcmd == CMD_RET(CMD_802_11_PS_MODE)) { | 784 | if (respcmd == CMD_RET(CMD_802_11_PS_MODE)) { |
804 | struct cmd_ds_802_11_ps_mode *psmode = &resp->params.psmode; | 785 | struct cmd_ds_802_11_ps_mode *psmode = &resp->params.psmode; |
@@ -816,15 +797,15 @@ int lbs_process_rx_command(struct lbs_private *priv) | |||
816 | * ad-hoc mode. It takes place in | 797 | * ad-hoc mode. It takes place in |
817 | * lbs_execute_next_command(). | 798 | * lbs_execute_next_command(). |
818 | */ | 799 | */ |
819 | if (adapter->mode == IW_MODE_ADHOC && | 800 | if (priv->mode == IW_MODE_ADHOC && |
820 | action == CMD_SUBCMD_ENTER_PS) | 801 | action == CMD_SUBCMD_ENTER_PS) |
821 | adapter->psmode = LBS802_11POWERMODECAM; | 802 | priv->psmode = LBS802_11POWERMODECAM; |
822 | } else if (action == CMD_SUBCMD_ENTER_PS) { | 803 | } else if (action == CMD_SUBCMD_ENTER_PS) { |
823 | adapter->needtowakeup = 0; | 804 | priv->needtowakeup = 0; |
824 | adapter->psstate = PS_STATE_AWAKE; | 805 | priv->psstate = PS_STATE_AWAKE; |
825 | 806 | ||
826 | lbs_deb_host("CMD_RESP: ENTER_PS command response\n"); | 807 | lbs_deb_host("CMD_RESP: ENTER_PS command response\n"); |
827 | if (adapter->connect_status != LBS_CONNECTED) { | 808 | if (priv->connect_status != LBS_CONNECTED) { |
828 | /* | 809 | /* |
829 | * When Deauth Event received before Enter_PS command | 810 | * When Deauth Event received before Enter_PS command |
830 | * response, We need to wake up the firmware. | 811 | * response, We need to wake up the firmware. |
@@ -832,23 +813,23 @@ int lbs_process_rx_command(struct lbs_private *priv) | |||
832 | lbs_deb_host( | 813 | lbs_deb_host( |
833 | "disconnected, invoking lbs_ps_wakeup\n"); | 814 | "disconnected, invoking lbs_ps_wakeup\n"); |
834 | 815 | ||
835 | spin_unlock_irqrestore(&adapter->driver_lock, flags); | 816 | spin_unlock_irqrestore(&priv->driver_lock, flags); |
836 | mutex_unlock(&adapter->lock); | 817 | mutex_unlock(&priv->lock); |
837 | lbs_ps_wakeup(priv, 0); | 818 | lbs_ps_wakeup(priv, 0); |
838 | mutex_lock(&adapter->lock); | 819 | mutex_lock(&priv->lock); |
839 | spin_lock_irqsave(&adapter->driver_lock, flags); | 820 | spin_lock_irqsave(&priv->driver_lock, flags); |
840 | } | 821 | } |
841 | } else if (action == CMD_SUBCMD_EXIT_PS) { | 822 | } else if (action == CMD_SUBCMD_EXIT_PS) { |
842 | adapter->needtowakeup = 0; | 823 | priv->needtowakeup = 0; |
843 | adapter->psstate = PS_STATE_FULL_POWER; | 824 | priv->psstate = PS_STATE_FULL_POWER; |
844 | lbs_deb_host("CMD_RESP: EXIT_PS command response\n"); | 825 | lbs_deb_host("CMD_RESP: EXIT_PS command response\n"); |
845 | } else { | 826 | } else { |
846 | lbs_deb_host("CMD_RESP: PS action 0x%X\n", action); | 827 | lbs_deb_host("CMD_RESP: PS action 0x%X\n", action); |
847 | } | 828 | } |
848 | 829 | ||
849 | __lbs_cleanup_and_insert_cmd(priv, adapter->cur_cmd); | 830 | __lbs_cleanup_and_insert_cmd(priv, priv->cur_cmd); |
850 | adapter->cur_cmd = NULL; | 831 | priv->cur_cmd = NULL; |
851 | spin_unlock_irqrestore(&adapter->driver_lock, flags); | 832 | spin_unlock_irqrestore(&priv->driver_lock, flags); |
852 | 833 | ||
853 | ret = 0; | 834 | ret = 0; |
854 | goto done; | 835 | goto done; |
@@ -869,32 +850,32 @@ int lbs_process_rx_command(struct lbs_private *priv) | |||
869 | 850 | ||
870 | } | 851 | } |
871 | 852 | ||
872 | __lbs_cleanup_and_insert_cmd(priv, adapter->cur_cmd); | 853 | __lbs_cleanup_and_insert_cmd(priv, priv->cur_cmd); |
873 | adapter->cur_cmd = NULL; | 854 | priv->cur_cmd = NULL; |
874 | spin_unlock_irqrestore(&adapter->driver_lock, flags); | 855 | spin_unlock_irqrestore(&priv->driver_lock, flags); |
875 | 856 | ||
876 | ret = -1; | 857 | ret = -1; |
877 | goto done; | 858 | goto done; |
878 | } | 859 | } |
879 | 860 | ||
880 | spin_unlock_irqrestore(&adapter->driver_lock, flags); | 861 | spin_unlock_irqrestore(&priv->driver_lock, flags); |
881 | 862 | ||
882 | if (adapter->cur_cmd && adapter->cur_cmd->callback) | 863 | if (priv->cur_cmd && priv->cur_cmd->callback) |
883 | ret = adapter->cur_cmd->callback(respcmd, resp, priv); | 864 | ret = priv->cur_cmd->callback(respcmd, resp, priv); |
884 | else | 865 | else |
885 | ret = handle_cmd_response(respcmd, resp, priv); | 866 | ret = handle_cmd_response(respcmd, resp, priv); |
886 | 867 | ||
887 | spin_lock_irqsave(&adapter->driver_lock, flags); | 868 | spin_lock_irqsave(&priv->driver_lock, flags); |
888 | 869 | ||
889 | if (adapter->cur_cmd) { | 870 | if (priv->cur_cmd) { |
890 | /* Clean up and Put current command back to cmdfreeq */ | 871 | /* Clean up and Put current command back to cmdfreeq */ |
891 | __lbs_cleanup_and_insert_cmd(priv, adapter->cur_cmd); | 872 | __lbs_cleanup_and_insert_cmd(priv, priv->cur_cmd); |
892 | adapter->cur_cmd = NULL; | 873 | priv->cur_cmd = NULL; |
893 | } | 874 | } |
894 | spin_unlock_irqrestore(&adapter->driver_lock, flags); | 875 | spin_unlock_irqrestore(&priv->driver_lock, flags); |
895 | 876 | ||
896 | done: | 877 | done: |
897 | mutex_unlock(&adapter->lock); | 878 | mutex_unlock(&priv->lock); |
898 | lbs_deb_leave_args(LBS_DEB_HOST, "ret %d", ret); | 879 | lbs_deb_leave_args(LBS_DEB_HOST, "ret %d", ret); |
899 | return ret; | 880 | return ret; |
900 | } | 881 | } |
@@ -902,14 +883,13 @@ done: | |||
902 | int lbs_process_event(struct lbs_private *priv) | 883 | int lbs_process_event(struct lbs_private *priv) |
903 | { | 884 | { |
904 | int ret = 0; | 885 | int ret = 0; |
905 | struct lbs_adapter *adapter = priv->adapter; | ||
906 | u32 eventcause; | 886 | u32 eventcause; |
907 | 887 | ||
908 | lbs_deb_enter(LBS_DEB_CMD); | 888 | lbs_deb_enter(LBS_DEB_CMD); |
909 | 889 | ||
910 | spin_lock_irq(&adapter->driver_lock); | 890 | spin_lock_irq(&priv->driver_lock); |
911 | eventcause = adapter->eventcause >> SBI_EVENT_CAUSE_SHIFT; | 891 | eventcause = priv->eventcause >> SBI_EVENT_CAUSE_SHIFT; |
912 | spin_unlock_irq(&adapter->driver_lock); | 892 | spin_unlock_irq(&priv->driver_lock); |
913 | 893 | ||
914 | lbs_deb_cmd("event cause %d\n", eventcause); | 894 | lbs_deb_cmd("event cause %d\n", eventcause); |
915 | 895 | ||
@@ -937,14 +917,14 @@ int lbs_process_event(struct lbs_private *priv) | |||
937 | lbs_deb_cmd("EVENT: sleep\n"); | 917 | lbs_deb_cmd("EVENT: sleep\n"); |
938 | 918 | ||
939 | /* handle unexpected PS SLEEP event */ | 919 | /* handle unexpected PS SLEEP event */ |
940 | if (adapter->psstate == PS_STATE_FULL_POWER) { | 920 | if (priv->psstate == PS_STATE_FULL_POWER) { |
941 | lbs_deb_cmd( | 921 | lbs_deb_cmd( |
942 | "EVENT: in FULL POWER mode, ignoreing PS_SLEEP\n"); | 922 | "EVENT: in FULL POWER mode, ignoreing PS_SLEEP\n"); |
943 | break; | 923 | break; |
944 | } | 924 | } |
945 | adapter->psstate = PS_STATE_PRE_SLEEP; | 925 | priv->psstate = PS_STATE_PRE_SLEEP; |
946 | 926 | ||
947 | lbs_ps_confirm_sleep(priv, (u16) adapter->psmode); | 927 | lbs_ps_confirm_sleep(priv, (u16) priv->psmode); |
948 | 928 | ||
949 | break; | 929 | break; |
950 | 930 | ||
@@ -952,19 +932,19 @@ int lbs_process_event(struct lbs_private *priv) | |||
952 | lbs_deb_cmd("EVENT: awake\n"); | 932 | lbs_deb_cmd("EVENT: awake\n"); |
953 | 933 | ||
954 | /* handle unexpected PS AWAKE event */ | 934 | /* handle unexpected PS AWAKE event */ |
955 | if (adapter->psstate == PS_STATE_FULL_POWER) { | 935 | if (priv->psstate == PS_STATE_FULL_POWER) { |
956 | lbs_deb_cmd( | 936 | lbs_deb_cmd( |
957 | "EVENT: In FULL POWER mode - ignore PS AWAKE\n"); | 937 | "EVENT: In FULL POWER mode - ignore PS AWAKE\n"); |
958 | break; | 938 | break; |
959 | } | 939 | } |
960 | 940 | ||
961 | adapter->psstate = PS_STATE_AWAKE; | 941 | priv->psstate = PS_STATE_AWAKE; |
962 | 942 | ||
963 | if (adapter->needtowakeup) { | 943 | if (priv->needtowakeup) { |
964 | /* | 944 | /* |
965 | * wait for the command processing to finish | 945 | * wait for the command processing to finish |
966 | * before resuming sending | 946 | * before resuming sending |
967 | * adapter->needtowakeup will be set to FALSE | 947 | * priv->needtowakeup will be set to FALSE |
968 | * in lbs_ps_wakeup() | 948 | * in lbs_ps_wakeup() |
969 | */ | 949 | */ |
970 | lbs_deb_cmd("waking up ...\n"); | 950 | lbs_deb_cmd("waking up ...\n"); |
@@ -1012,12 +992,12 @@ int lbs_process_event(struct lbs_private *priv) | |||
1012 | break; | 992 | break; |
1013 | } | 993 | } |
1014 | lbs_pr_info("EVENT: MESH_AUTO_STARTED\n"); | 994 | lbs_pr_info("EVENT: MESH_AUTO_STARTED\n"); |
1015 | adapter->mesh_connect_status = LBS_CONNECTED; | 995 | priv->mesh_connect_status = LBS_CONNECTED; |
1016 | if (priv->mesh_open == 1) { | 996 | if (priv->mesh_open == 1) { |
1017 | netif_wake_queue(priv->mesh_dev); | 997 | netif_wake_queue(priv->mesh_dev); |
1018 | netif_carrier_on(priv->mesh_dev); | 998 | netif_carrier_on(priv->mesh_dev); |
1019 | } | 999 | } |
1020 | adapter->mode = IW_MODE_ADHOC; | 1000 | priv->mode = IW_MODE_ADHOC; |
1021 | schedule_work(&priv->sync_channel); | 1001 | schedule_work(&priv->sync_channel); |
1022 | break; | 1002 | break; |
1023 | 1003 | ||
@@ -1026,9 +1006,9 @@ int lbs_process_event(struct lbs_private *priv) | |||
1026 | break; | 1006 | break; |
1027 | } | 1007 | } |
1028 | 1008 | ||
1029 | spin_lock_irq(&adapter->driver_lock); | 1009 | spin_lock_irq(&priv->driver_lock); |
1030 | adapter->eventcause = 0; | 1010 | priv->eventcause = 0; |
1031 | spin_unlock_irq(&adapter->driver_lock); | 1011 | spin_unlock_irq(&priv->driver_lock); |
1032 | 1012 | ||
1033 | lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); | 1013 | lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); |
1034 | return ret; | 1014 | return ret; |