nexmon – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 diff -Naur rt73-k2wrlz-2.0.1/Module/rtmp_def.h rt73-k2wrlz-2.0.1-24/Module/rtmp_def.h
2 --- rt73-k2wrlz-2.0.1/Module/rtmp_def.h 2007-07-10 10:01:32.000000000 +0200
3 +++ rt73-k2wrlz-2.0.1-24/Module/rtmp_def.h 2008-02-13 23:12:13.000000000 +0100
4 @@ -1,26 +1,26 @@
5 -/***************************************************************************
6 - * RT2x00 SourceForge Project - http://rt2x00.serialmonkey.com *
7 - * *
8 - * This program is free software; you can redistribute it and/or modify *
9 - * it under the terms of the GNU General Public License as published by *
10 - * the Free Software Foundation; either version 2 of the License, or *
11 - * (at your option) any later version. *
12 - * *
13 - * This program is distributed in the hope that it will be useful, *
14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 - * GNU General Public License for more details. *
17 - * *
18 - * You should have received a copy of the GNU General Public License *
19 - * along with this program; if not, write to the *
20 - * Free Software Foundation, Inc., *
21 - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
22 - * *
23 - * Licensed under the GNU GPL *
24 - * Original code supplied under license from RaLink Inc, 2004. *
25 +/***************************************************************************
26 + * RT2x00 SourceForge Project - http://rt2x00.serialmonkey.com *
27 + * *
28 + * This program is free software; you can redistribute it and/or modify *
29 + * it under the terms of the GNU General Public License as published by *
30 + * the Free Software Foundation; either version 2 of the License, or *
31 + * (at your option) any later version. *
32 + * *
33 + * This program is distributed in the hope that it will be useful, *
34 + * but WITHOUT ANY WARRANTY; without even the implied warranty of *
35 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
36 + * GNU General Public License for more details. *
37 + * *
38 + * You should have received a copy of the GNU General Public License *
39 + * along with this program; if not, write to the *
40 + * Free Software Foundation, Inc., *
41 + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
42 + * *
43 + * Licensed under the GNU GPL *
44 + * Original code supplied under license from RaLink Inc, 2004. *
45 ***************************************************************************/
46  
47 -/***************************************************************************
48 +/***************************************************************************
49 * Module Name: rtmp_def.h
50 *
51 * Abstract: Miniport related definition header
52 @@ -31,7 +31,7 @@
53 * Paul Lin 08-01-2002 created
54 * John Chang 08-05-2003 add definition for 11g & other drafts
55 * idamlaj 04-10-2006 Add extra devices
56 - *
57 + *
58 ***************************************************************************/
59  
60 #ifndef __RTMP_DEF_H__
61 @@ -61,7 +61,7 @@
62 #define TYPE_RXD 1
63 #endif
64  
65 -//WEP
66 +//WEP
67 #define WEP_SMALL_KEY_LEN (40/8)
68 #define WEP_LARGE_KEY_LEN (104/8)
69  
70 @@ -237,7 +237,7 @@
71 #define MAX_LEN_OF_SUPPORTED_RATES 12 // 1, 2, 5.5, 11, 6, 9, 12, 18, 24, 36, 48, 54
72 #define MAX_LEN_OF_KEY 32 // 32 octets == 256 bits, Redefine for WPA
73  
74 -#define MAX_NUM_OF_CHANNELS 43 //1-14, 36/40/44/48/52/56/60/64/100/104/108/112/116/120/124/
75 +#define MAX_NUM_OF_CHANNELS 43 //1-14, 36/40/44/48/52/56/60/64/100/104/108/112/116/120/124/
76 //128/132/136/140/149/153/157/161/165/34/38/42/46 + 1 as NULL termination
77 #define MAX_NUM_OF_A_CHANNELS 24 //36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165
78 #define J52_CHANNEL_START_OFFSET 38 //1-14, 36/40/44/48/52/56/60/64/100/104/108/112/116/120/124/
79 @@ -245,7 +245,7 @@
80 #define MAX_LEN_OF_SSID 32
81 #define CIPHER_TEXT_LEN 128
82 #define MAX_LEN_OF_MLME_BUFFER 2048
83 -#define MAX_MLME_HANDLER_MEMORY 20 //each them cantains MAX_LEN_OF_MLME_BUFFER size
84 +#define MAX_MLME_HANDLER_MEMORY 20 //each them cantains MAX_LEN_OF_MLME_BUFFER size
85 #define MAX_FRAME_LEN 2338
86 #define MAX_VIE_LEN 160 // New for WPA cipher suite variable IE sizes.
87  
88 @@ -304,7 +304,7 @@
89 #define MLME_SUCCESS 0
90 #define MLME_UNSPECIFY_FAIL 1
91 #define MLME_CANNOT_SUPPORT_CAP 10
92 -#define MLME_REASSOC_DENY_ASSOC_EXIST 11
93 +#define MLME_REASSOC_DENY_ASSOC_EXIST 11
94 #define MLME_ASSOC_DENY_OUT_SCOPE 12
95 #define MLME_ALG_NOT_SUPPORT 13
96 #define MLME_SEQ_NR_OUT_OF_SEQUENCE 14
97 @@ -334,7 +334,7 @@
98 #define IE_802_11D_REQUEST 10 // 802.11d
99 #define IE_QBSS_LOAD 11 // 802.11e d9
100 #define IE_EDCA_PARAMETER 12 // 802.11e d9
101 -#define IE_TSPEC 13 // 802.11e d9
102 +#define IE_TSPEC 13 // 802.11e d9
103 #define IE_TCLAS 14 // 802.11e d9
104 #define IE_SCHEDULE 15 // 802.11e d9
105 #define IE_CHALLENGE_TEXT 16
106 @@ -422,7 +422,7 @@
107 #define ASSOC_MACHINE_BASE 0
108 #define MT2_MLME_ASSOC_REQ 0
109 #define MT2_MLME_REASSOC_REQ 1
110 -#define MT2_MLME_DISASSOC_REQ 2
111 +#define MT2_MLME_DISASSOC_REQ 2
112 #define MT2_PEER_DISASSOC_REQ 3
113 #define MT2_PEER_ASSOC_REQ 4
114 #define MT2_PEER_ASSOC_RSP 5
115 @@ -491,7 +491,7 @@
116  
117 //
118 // STA's WPA-PSK State machine: states, events, total function #
119 -//
120 +//
121 #define WPA_PSK_IDLE 0
122 #define MAX_WPA_PSK_STATE 1
123  
124 @@ -650,8 +650,8 @@
125 #define CIPHER_AES 4
126 #define CIPHER_CKIP64 5
127 #define CIPHER_CKIP128 6
128 -#define CIPHER_TKIP_NO_MIC 7 // MIC has been appended by driver, not a valid value in hardware key table
129 -
130 +#define CIPHER_TKIP_NO_MIC 7 // MIC has been appended by driver, not a valid value in hardware key table
131 +
132  
133 // value domain for pAd->RfIcType
134 #define RFIC_5226 1 //A/B/G
135 @@ -813,6 +813,7 @@
136 // VID/PID
137 //-------------------
138  
139 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
140 #define RT73_USB_DEVICES { \
141 {USB_DEVICE(0x0b05,0x1723)}, /* ASUS */ \
142 {USB_DEVICE(0x148f,0x2573)}, /* Ralink */ \
143 @@ -843,7 +844,38 @@
144 {USB_DEVICE(0x0df6,0x90ac)}, /* Sitecom */ \
145 {USB_DEVICE(0x13b1,0x0023)}, /* LinkSys */ \
146 {USB_DEVICE(0,0)}} /* end marker */
147 -
148 +#else
149 +#define RT73_USB_DEVICES { \
150 + {USB_DEVICE(0x0b05,0x1723)}, /* ASUS */ \
151 + {USB_DEVICE(0x148f,0x2573)}, /* Ralink */ \
152 + {USB_DEVICE(0x148f,0x2671)}, /* Ralink */ \
153 + {USB_DEVICE(0x18e8,0x6196)}, /* Qcom */ \
154 + {USB_DEVICE(0x18e8,0x6229)}, /* Qcom */ \
155 + {USB_DEVICE(0x1044,0x8008)}, /* Gigabyte */ \
156 + {USB_DEVICE(0x14b2,0x3c22)}, /* Conceptronic */ \
157 + {USB_DEVICE(0x0db0,0x6877)}, /* MSI */ \
158 + {USB_DEVICE(0x0db0,0xa874)}, /* MSI */ \
159 + {USB_DEVICE(0x0db0,0xa861)}, /* MSI */ \
160 + {USB_DEVICE(0x07b8,0xb21d)}, /* AboCom */ \
161 + {USB_DEVICE(0x0769,0x31f3)}, /* Surecom */ \
162 + {USB_DEVICE(0x1472,0x0009)}, /* Huawei-3Com */ \
163 + {USB_DEVICE(0x1371,0x9022)}, /* CNet */ \
164 + {USB_DEVICE(0x1371,0x9032)}, /* CNet */ \
165 + {USB_DEVICE(0x1631,0xc019)}, /* Billionton */ \
166 + {USB_DEVICE(0x1044,0x800a)}, /* Gigabyte */ \
167 + {USB_DEVICE(0x07d1,0x3c03)}, /* D-Link */ \
168 + {USB_DEVICE(0x07d1,0x3c04)}, /* D-Link */ \
169 + {USB_DEVICE(0x050d,0x7050)}, /* Belkin */ \
170 + {USB_DEVICE(0x050d,0x705a)}, /* Belkin */ \
171 + {USB_DEVICE(0x13b1,0x0020)}, /* Linksys */ \
172 + {USB_DEVICE(0x18e8,0x6196)}, /* Qcom*/ \
173 + {USB_DEVICE(0x0df6,0x9712)}, /* Sitecom */ \
174 + {USB_DEVICE(0x06f8,0xe010)}, /* Hercules */ \
175 + {USB_DEVICE(0x1690,0x0722)}, /* Askey */ \
176 + {USB_DEVICE(0x0df6,0x90ac)}, /* Sitecom */ \
177 + {USB_DEVICE(0x13b1,0x0023)}, /* LinkSys */ \
178 + {}} /* end marker */
179 +#endif
180  
181 #endif // __RTMP_DEF_H__
182  
183 diff -Naur rt73-k2wrlz-2.0.1/Module/rtmp_main.c rt73-k2wrlz-2.0.1-24/Module/rtmp_main.c
184 --- rt73-k2wrlz-2.0.1/Module/rtmp_main.c 2007-10-26 21:35:39.000000000 +0200
185 +++ rt73-k2wrlz-2.0.1-24/Module/rtmp_main.c 2008-02-13 23:03:14.000000000 +0100
186 @@ -1,26 +1,26 @@
187 -/***************************************************************************
188 - * RT2x00 SourceForge Project - http://rt2x00.serialmonkey.com *
189 - * *
190 - * This program is free software; you can redistribute it and/or modify *
191 - * it under the terms of the GNU General Public License as published by *
192 - * the Free Software Foundation; either version 2 of the License, or *
193 - * (at your option) any later version. *
194 - * *
195 - * This program is distributed in the hope that it will be useful, *
196 - * but WITHOUT ANY WARRANTY; without even the implied warranty of *
197 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
198 - * GNU General Public License for more details. *
199 - * *
200 - * You should have received a copy of the GNU General Public License *
201 - * along with this program; if not, write to the *
202 - * Free Software Foundation, Inc., *
203 - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
204 - * *
205 - * Licensed under the GNU GPL *
206 - * Original code supplied under license from RaLink Inc, 2004. *
207 +/***************************************************************************
208 + * RT2x00 SourceForge Project - http://rt2x00.serialmonkey.com *
209 + * *
210 + * This program is free software; you can redistribute it and/or modify *
211 + * it under the terms of the GNU General Public License as published by *
212 + * the Free Software Foundation; either version 2 of the License, or *
213 + * (at your option) any later version. *
214 + * *
215 + * This program is distributed in the hope that it will be useful, *
216 + * but WITHOUT ANY WARRANTY; without even the implied warranty of *
217 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
218 + * GNU General Public License for more details. *
219 + * *
220 + * You should have received a copy of the GNU General Public License *
221 + * along with this program; if not, write to the *
222 + * Free Software Foundation, Inc., *
223 + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
224 + * *
225 + * Licensed under the GNU GPL *
226 + * Original code supplied under license from RaLink Inc, 2004. *
227 ***************************************************************************/
228  
229 -/***************************************************************************
230 +/***************************************************************************
231 * Module Name: rtmp_main.c
232 *
233 * Abstract: Main initialization routines
234 @@ -29,8 +29,8 @@
235 * Who When What
236 * -------- ---------- -----------------------------
237 * Jan Lee 01-10-2005 modified
238 - * idamlaj 04-10-2006 Apply patch by Ace17 (from forum)
239 - *
240 + * idamlaj 04-10-2006 Apply patch by Ace17 (from forum)
241 + *
242 ***************************************************************************/
243  
244 #include "rt_config.h"
245 @@ -67,7 +67,7 @@
246  
247 /* module table */
248 struct usb_device_id rtusb_usb_id[] = RT73_USB_DEVICES;
249 -INT const rtusb_usb_id_len = sizeof(rtusb_usb_id) / sizeof(struct usb_device_id);
250 +INT const rtusb_usb_id_len = sizeof(rtusb_usb_id) / sizeof(struct usb_device_id);
251 MODULE_DEVICE_TABLE(usb, rtusb_usb_id);
252  
253  
254 @@ -158,7 +158,7 @@
255 // for cslip etc
256 pAd->stats.rx_compressed = 0;
257 pAd->stats.tx_compressed = 0;
258 -
259 +
260 return &pAd->stats;
261 }
262  
263 @@ -214,22 +214,22 @@
264 #endif
265  
266 VOID RTUSBHalt(
267 - IN PRTMP_ADAPTER pAd,
268 + IN PRTMP_ADAPTER pAd,
269 IN BOOLEAN IsFree)
270 {
271 MLME_DISASSOC_REQ_STRUCT DisReq;
272 MLME_QUEUE_ELEM MsgElem;
273 INT i;
274 -
275 +
276 DBGPRINT(RT_DEBUG_TRACE, "====> RTUSBHalt\n");
277  
278 //
279 - // before set flag fRTMP_ADAPTER_HALT_IN_PROGRESS,
280 + // before set flag fRTMP_ADAPTER_HALT_IN_PROGRESS,
281 // we should send a disassoc frame to our AP.
282 //
283 if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST))
284 {
285 - if (INFRA_ON(pAd))
286 + if (INFRA_ON(pAd))
287 {
288 COPY_MAC_ADDR(DisReq.Addr, pAd->PortCfg.Bssid);
289 DisReq.Reason = REASON_DISASSOC_STA_LEAVING;
290 @@ -252,7 +252,7 @@
291 RTMPSendNullFrame(pAd, RATE_6);
292 RTMPusecDelay(1000);
293 }
294 -
295 +
296 // disable BEACON generation and other BEACON related hardware timers
297 AsicDisableSync(pAd);
298 RTMPSetLED(pAd, LED_HALT);
299 @@ -281,23 +281,23 @@
300  
301 // Free the entire adapter object
302 ReleaseAdapter(pAd, IsFree, FALSE);
303 -
304 +
305 // reset mlme & command thread
306 pAd->MLMEThr_pid = -1;
307 pAd->RTUSBCmdThr_pid = -1;
308 -
309 +
310 RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS);
311 }
312  
313 VOID CMDHandler(
314 - IN PRTMP_ADAPTER pAd)
315 + IN PRTMP_ADAPTER pAd)
316 {
317 PCmdQElmt cmdqelmt;
318 PUCHAR pData;
319 NDIS_STATUS NdisStatus = NDIS_STATUS_SUCCESS;
320 ULONG IrqFlags;
321 ULONG Now;
322 -
323 +
324 while (pAd->CmdQ.size > 0)
325 {
326 NdisStatus = NDIS_STATUS_SUCCESS;
327 @@ -339,7 +339,7 @@
328 // Update extra information
329 pAd->ExtraInfo = HW_RADIO_OFF;
330 }
331 - }
332 + }
333 }
334 break;
335  
336 @@ -351,11 +351,11 @@
337 {
338 if (pAd->Mlme.CntlMachine.CurrState != CNTL_IDLE)
339 {
340 - MlmeEnqueue(pAd,
341 + MlmeEnqueue(pAd,
342 MLME_CNTL_STATE_MACHINE,
343 RT_CMD_RESET_MLME,
344 0,
345 - NULL);
346 + NULL);
347  
348 }
349  
350 @@ -372,17 +372,17 @@
351 RTUSBMlmeUp(pAd);
352 }
353 break;
354 -
355 +
356 case RT_OID_802_11_BSSID:
357 {
358  
359 if (pAd->Mlme.CntlMachine.CurrState != CNTL_IDLE)
360 {
361 - MlmeEnqueue(pAd,
362 + MlmeEnqueue(pAd,
363 MLME_CNTL_STATE_MACHINE,
364 RT_CMD_RESET_MLME,
365 0,
366 - NULL);
367 + NULL);
368  
369 }
370  
371 @@ -399,16 +399,16 @@
372 RTUSBMlmeUp(pAd);
373 }
374 break;
375 -
376 +
377 case OID_802_11_SSID:
378 {
379 if (pAd->Mlme.CntlMachine.CurrState != CNTL_IDLE)
380 - {
381 - MlmeEnqueue(pAd,
382 + {
383 + MlmeEnqueue(pAd,
384 MLME_CNTL_STATE_MACHINE,
385 RT_CMD_RESET_MLME,
386 0,
387 - NULL);
388 + NULL);
389  
390 }
391  
392 @@ -421,7 +421,7 @@
393 MlmeEnqueue(pAd,
394 MLME_CNTL_STATE_MACHINE,
395 OID_802_11_SSID,
396 - cmdqelmt->bufferlength,
397 + cmdqelmt->bufferlength,
398 pData);
399 RTUSBMlmeUp(pAd);
400 }
401 @@ -431,11 +431,11 @@
402 {
403 if (pAd->Mlme.CntlMachine.CurrState != CNTL_IDLE)
404 {
405 - MlmeEnqueue(pAd,
406 + MlmeEnqueue(pAd,
407 MLME_CNTL_STATE_MACHINE,
408 RT_CMD_RESET_MLME,
409 0,
410 - NULL);
411 + NULL);
412  
413 }
414  
415 @@ -456,7 +456,7 @@
416  
417 NDIS_802_11_ANTENNA Antenna = *(NDIS_802_11_ANTENNA *)pData;
418  
419 - if (Antenna == 0)
420 + if (Antenna == 0)
421 pAd->Antenna.field.RxDefaultAntenna = 1; // ant-A
422 else if(Antenna == 1)
423 pAd->Antenna.field.RxDefaultAntenna = 2; // ant-B
424 @@ -473,7 +473,7 @@
425 {
426 NDIS_802_11_ANTENNA Antenna = *(NDIS_802_11_ANTENNA *)pData;
427  
428 - if (Antenna == 0)
429 + if (Antenna == 0)
430 pAd->Antenna.field.TxDefaultAntenna = 1; // ant-A
431 else if(Antenna == 1)
432 pAd->Antenna.field.TxDefaultAntenna = 2; // ant-B
433 @@ -517,7 +517,7 @@
434 RTUSBReadEEPROM(pAd, Offset, pData + 4, Length);
435 }
436 break;
437 -
438 +
439 case RT_OID_USB_VENDOR_EEPROM_WRITE:
440 {
441 USHORT Offset = *((PUSHORT)pData);
442 @@ -563,26 +563,26 @@
443 case RT_OID_USB_RESET_BULK_OUT:
444 {
445 INT Index;
446 -
447 +
448 DBGPRINT_RAW(RT_DEBUG_ERROR, "RT_OID_USB_RESET_BULK_OUT\n");
449 -
450 +
451 RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_RESET_PIPE_IN_PROGRESS);
452  
453 - RTUSBRejectPendingPackets(pAd); //reject all NDIS packets waiting in TX queue
454 + RTUSBRejectPendingPackets(pAd); //reject all NDIS packets waiting in TX queue
455 RTUSBCancelPendingBulkOutIRP(pAd);
456 RTUSBCleanUpDataBulkOutQueue(pAd);
457  
458 NICInitializeAsic(pAd);
459 ReleaseAdapter(pAd, FALSE, TRUE); // unlink urb releated tx context
460 NICInitTransmit(pAd);
461 -
462 - RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_RESET_PIPE_IN_PROGRESS);
463 -
464 +
465 + RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_RESET_PIPE_IN_PROGRESS);
466 +
467 if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET))
468 {
469 RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_BULKOUT_RESET);
470 }
471 -
472 +
473 if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF))
474 {
475 for (Index = 0; Index < 4; Index++)
476 @@ -594,8 +594,8 @@
477 }
478  
479 RTUSBKickBulkOut(pAd);
480 - }
481 - }
482 + }
483 + }
484  
485 break;
486  
487 @@ -618,7 +618,7 @@
488 }
489 if (pRxContext->TransferBuffer != NULL)
490 {
491 - kfree(pRxContext->TransferBuffer);
492 + kfree(pRxContext->TransferBuffer);
493 pRxContext->TransferBuffer = NULL;
494 }
495 }
496 @@ -722,9 +722,9 @@
497 //disable Rx
498 RTUSBWriteMACRegister(pAd, TXRX_CSR2, 1);
499 //Ask our device to complete any pending bulk in IRP.
500 - while ((atomic_read(&pAd->PendingRx) > 0) ||
501 + while ((atomic_read(&pAd->PendingRx) > 0) ||
502 (pAd->BulkOutPending[0] == TRUE) ||
503 - (pAd->BulkOutPending[1] == TRUE) ||
504 + (pAd->BulkOutPending[1] == TRUE) ||
505 (pAd->BulkOutPending[2] == TRUE) ||
506 (pAd->BulkOutPending[3] == TRUE))
507  
508 @@ -743,7 +743,7 @@
509 }
510  
511 if ((pAd->BulkOutPending[0] == TRUE) ||
512 - (pAd->BulkOutPending[1] == TRUE) ||
513 + (pAd->BulkOutPending[1] == TRUE) ||
514 (pAd->BulkOutPending[2] == TRUE) ||
515 (pAd->BulkOutPending[3] == TRUE))
516 {
517 @@ -758,7 +758,7 @@
518 RTMPusecDelay(500000);
519 }
520  
521 - NICResetFromError(pAd);
522 + NICResetFromError(pAd);
523 if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HARDWARE_ERROR))
524 {
525 RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_HARDWARE_ERROR);
526 @@ -814,12 +814,12 @@
527 case RT_OID_VENDOR_WRITE_RF:
528 {
529 ULONG Value = *((PULONG)pData);
530 -
531 +
532 DBGPRINT_RAW(RT_DEBUG_INFO, "value = 0x%08x\n", Value);
533 RTUSBWriteRFRegister(pAd, Value);
534 }
535 break;
536 -
537 +
538 case RT_OID_802_11_RESET_COUNTERS:
539 {
540 UCHAR Value[22];
541 @@ -865,7 +865,7 @@
542 NULL,
543 0);
544 break;
545 -#endif
546 +#endif
547 case RT_OID_VENDOR_FLIP_IQ:
548 {
549 ULONG Value1, Value2;
550 @@ -926,7 +926,7 @@
551 else
552 NdisStatus = NDIS_STATUS_FAILURE;
553 DBGPRINT(RT_DEBUG_ERROR, "CMDHandler::OID_802_11_NETWORK_TYPE_IN_USE (=%d)\n",NetType);
554 -
555 +
556 }
557 break;
558 case RT_OID_802_11_PHY_MODE:
559 @@ -958,7 +958,7 @@
560 pAd->PortCfg.GroupCipher = WepStatus;
561  
562 #if 1
563 - if ((WepStatus == Ndis802_11Encryption1Enabled) &&
564 + if ((WepStatus == Ndis802_11Encryption1Enabled) &&
565 (pAd->SharedKey[pAd->PortCfg.DefaultKeyId].KeyLen != 0))
566 {
567 if (pAd->SharedKey[pAd->PortCfg.DefaultKeyId].KeyLen <= 5)
568 @@ -973,7 +973,7 @@
569  
570 pAd->SharedKey[pAd->PortCfg.DefaultKeyId].CipherAlg = CIPHER_WEP128;
571 }
572 -#if 0
573 +#if 0
574 RTUSBReadMACRegister_old(pAd, TXRX_CSR0, &Value);
575 Value &= 0xfe00;
576 Value |= ((LENGTH_802_11 << 3) | (pAd->PortCfg.CipherAlg));
577 @@ -1013,7 +1013,7 @@
578 Value &= 0xfe00;
579 RTUSBWriteMACRegister_old(pAd, TXRX_CSR0, Value);
580 #endif
581 - }else
582 + }else
583 {
584 DBGPRINT(RT_DEBUG_ERROR, " ERROR Cipher !!! \n");
585 }
586 @@ -1027,7 +1027,7 @@
587 PNDIS_802_11_WEP pWepKey;
588  
589 DBGPRINT(RT_DEBUG_TRACE, "CMDHandler::OID_802_11_ADD_WEP \n");
590 -
591 +
592 pWepKey = (PNDIS_802_11_WEP)pData;
593 KeyIdx = pWepKey->KeyIndex & 0x0fffffff;
594  
595 @@ -1037,7 +1037,7 @@
596 NdisStatus = NDIS_STATUS_FAILURE;
597 DBGPRINT(RT_DEBUG_ERROR, "CMDHandler::OID_802_11_ADD_WEP, INVALID_DATA!!\n");
598 }
599 - else
600 + else
601 {
602 UCHAR CipherAlg;
603 pAd->SharedKey[KeyIdx].KeyLen = (UCHAR) pWepKey->KeyLength;
604 @@ -1048,18 +1048,18 @@
605 {
606 // Default key for tx (shared key)
607 pAd->PortCfg.DefaultKeyId = (UCHAR) KeyIdx;
608 - }
609 + }
610 AsicAddSharedKeyEntry(pAd, 0, (UCHAR)KeyIdx, CipherAlg, pWepKey->KeyMaterial, NULL, NULL);
611 DBGPRINT(RT_DEBUG_TRACE, "CMDHandler::OID_802_11_ADD_WEP (KeyIdx=%d, Len=%d-byte)\n", KeyIdx, pWepKey->KeyLength);
612 }
613 }
614 break;
615 -
616 +
617 case OID_802_11_REMOVE_WEP:
618 {
619 ULONG KeyIdx;
620  
621 -
622 +
623 KeyIdx = *(NDIS_802_11_KEY_INDEX *) pData;
624 if (KeyIdx & 0x80000000)
625 {
626 @@ -1081,14 +1081,14 @@
627 AsicRemoveSharedKeyEntry(pAd, 0, (UCHAR)KeyIdx);
628 DBGPRINT(RT_DEBUG_TRACE, "CMDHandler::OID_802_11_REMOVE_WEP (KeyIdx=%d)\n", KeyIdx);
629 }
630 - }
631 + }
632 }
633 break;
634  
635 case OID_802_11_ADD_KEY_WEP:
636 {
637 PNDIS_802_11_KEY pKey;
638 - ULONG i, KeyIdx;
639 + ULONG i, KeyIdx;
640  
641 pKey = (PNDIS_802_11_KEY) pData;
642 KeyIdx = pKey->KeyIndex & 0x0fffffff;
643 @@ -1099,10 +1099,10 @@
644 NdisStatus = NDIS_STATUS_FAILURE;
645 DBGPRINT(RT_DEBUG_ERROR, "CMDHandler::OID_802_11_ADD_KEY_WEP, Invalid KeyIdx[=%d]!!\n", KeyIdx);
646 }
647 - else
648 + else
649 {
650 UCHAR CipherAlg;
651 -
652 +
653 pAd->SharedKey[KeyIdx].KeyLen = (UCHAR) pKey->KeyLength;
654 memcpy(pAd->SharedKey[KeyIdx].Key, &pKey->KeyMaterial, pKey->KeyLength);
655  
656 @@ -1118,12 +1118,12 @@
657 {
658 for(i = 1; i < (16 / pKey->KeyLength); i++)
659 {
660 - memcpy(&pAd->SharedKey[KeyIdx].Key[i * pKey->KeyLength],
661 - &pKey->KeyMaterial[0],
662 + memcpy(&pAd->SharedKey[KeyIdx].Key[i * pKey->KeyLength],
663 + &pKey->KeyMaterial[0],
664 pKey->KeyLength);
665 }
666 - memcpy(&pAd->SharedKey[KeyIdx].Key[i * pKey->KeyLength],
667 - &pKey->KeyMaterial[0],
668 + memcpy(&pAd->SharedKey[KeyIdx].Key[i * pKey->KeyLength],
669 + &pKey->KeyMaterial[0],
670 16 - (i * pKey->KeyLength));
671 }
672  
673 @@ -1135,16 +1135,16 @@
674 }
675  
676 AsicAddSharedKeyEntry(pAd, 0, (UCHAR)KeyIdx, CipherAlg, pAd->SharedKey[KeyIdx].Key, NULL, NULL);
677 - DBGPRINT(RT_DEBUG_TRACE, "CMDHandler::OID_802_11_ADD_KEY_WEP (KeyIdx=%d, KeyLen=%d, CipherAlg=%d)\n",
678 + DBGPRINT(RT_DEBUG_TRACE, "CMDHandler::OID_802_11_ADD_KEY_WEP (KeyIdx=%d, KeyLen=%d, CipherAlg=%d)\n",
679 pAd->PortCfg.DefaultKeyId, pAd->SharedKey[KeyIdx].KeyLen, pAd->SharedKey[KeyIdx].CipherAlg);
680 }
681 }
682 break;
683  
684 case OID_802_11_ADD_KEY:
685 - {
686 + {
687 PNDIS_802_11_KEY pkey = (PNDIS_802_11_KEY)pData;
688 -
689 +
690 NdisStatus = RTMPWPAAddKeyProc(pAd, pkey);
691 RTUSBBulkReceive(pAd);
692 DBGPRINT(RT_DEBUG_TRACE, "CMDHandler::OID_802_11_ADD_KEY\n");
693 @@ -1157,7 +1157,7 @@
694 {
695 ULONG KeyIdx;
696  
697 -
698 +
699 KeyIdx = *(NDIS_802_11_KEY_INDEX *) pData;
700 if (KeyIdx & 0x80000000)
701 {
702 @@ -1179,7 +1179,7 @@
703 }
704 }
705 break;
706 -#if 0
707 +#if 0
708 {
709 //PNDIS_802_11_REMOVE_KEY pRemoveKey;
710 ULONG KeyIdx;
711 @@ -1190,7 +1190,7 @@
712 DBGPRINT(RT_DEBUG_ERROR, "CMDHandler::OID_802_11_REMOVE_WEP\n");
713 //if (InformationBufferLength != sizeof(NDIS_802_11_KEY_INDEX))
714 // Status = NDIS_STATUS_INVALID_LENGTH;
715 - //else
716 + //else
717 {
718 KeyIdx = *(NDIS_802_11_KEY_INDEX *) pData;
719  
720 @@ -1223,17 +1223,17 @@
721 {
722 PNDIS_802_11_REMOVE_KEY pRemoveKey;
723 ULONG KeyIdx;
724 -
725 +
726 pRemoveKey = (PNDIS_802_11_REMOVE_KEY) pData;
727 if (pAd->PortCfg.AuthMode >= Ndis802_11AuthModeWPA)
728 {
729 NdisStatus = RTMPWPARemoveKeyProc(pAd, pData);
730 DBGPRINT(RT_DEBUG_TRACE, "CMDHandler::RTMPWPARemoveKeyProc\n");
731 }
732 - else
733 + else
734 {
735 KeyIdx = pRemoveKey->KeyIndex;
736 -
737 +
738 if (KeyIdx & 0x80000000)
739 {
740 // Should never set default bit when remove key
741 @@ -1246,7 +1246,7 @@
742 if (KeyIdx >= 4)
743 {
744 NdisStatus = NDIS_STATUS_FAILURE;
745 - DBGPRINT(RT_DEBUG_ERROR, "CMDHandler::OID_802_11_REMOVE_KEY, Invalid KeyIdx[=%d]!!\n", KeyIdx);
746 + DBGPRINT(RT_DEBUG_ERROR, "CMDHandler::OID_802_11_REMOVE_KEY, Invalid KeyIdx[=%d]!!\n", KeyIdx);
747 }
748 else
749 {
750 @@ -1260,24 +1260,24 @@
751  
752 }
753 break;
754 -
755 +
756 case OID_802_11_POWER_MODE:
757 {
758 NDIS_802_11_POWER_MODE PowerMode = *(PNDIS_802_11_POWER_MODE) pData;
759 DBGPRINT(RT_DEBUG_TRACE, "CMDHandler::OID_802_11_POWER_MODE (=%d)\n",PowerMode);
760 -
761 +
762 // save user's policy here, but not change PortCfg.Psm immediately
763 - if (PowerMode == Ndis802_11PowerModeCAM)
764 + if (PowerMode == Ndis802_11PowerModeCAM)
765 {
766 // clear PSM bit immediately
767 MlmeSetPsmBit(pAd, PWR_ACTIVE);
768 -
769 - OPSTATUS_SET_FLAG(pAd, fOP_STATUS_RECEIVE_DTIM);
770 +
771 + OPSTATUS_SET_FLAG(pAd, fOP_STATUS_RECEIVE_DTIM);
772 if (pAd->PortCfg.bWindowsACCAMEnable == FALSE)
773 pAd->PortCfg.WindowsPowerMode = PowerMode;
774 pAd->PortCfg.WindowsBatteryPowerMode = PowerMode;
775 - }
776 - else if (PowerMode == Ndis802_11PowerModeMAX_PSP)
777 + }
778 + else if (PowerMode == Ndis802_11PowerModeMAX_PSP)
779 {
780 // do NOT turn on PSM bit here, wait until MlmeCheckPsmChange()
781 // to exclude certain situations.
782 @@ -1285,10 +1285,10 @@
783 if (pAd->PortCfg.bWindowsACCAMEnable == FALSE)
784 pAd->PortCfg.WindowsPowerMode = PowerMode;
785 pAd->PortCfg.WindowsBatteryPowerMode = PowerMode;
786 - OPSTATUS_SET_FLAG(pAd, fOP_STATUS_RECEIVE_DTIM);
787 + OPSTATUS_SET_FLAG(pAd, fOP_STATUS_RECEIVE_DTIM);
788 pAd->PortCfg.DefaultListenCount = 5;
789 - }
790 - else if (PowerMode == Ndis802_11PowerModeFast_PSP)
791 + }
792 + else if (PowerMode == Ndis802_11PowerModeFast_PSP)
793 {
794 // do NOT turn on PSM bit here, wait until MlmeCheckPsmChange()
795 // to exclude certain situations.
796 @@ -1298,8 +1298,8 @@
797 pAd->PortCfg.WindowsPowerMode = PowerMode;
798 pAd->PortCfg.WindowsBatteryPowerMode = PowerMode;
799 pAd->PortCfg.DefaultListenCount = 3;
800 - }
801 - }
802 + }
803 + }
804 break;
805  
806 case RT_PERFORM_SOFT_DIVERSITY:
807 @@ -1318,7 +1318,7 @@
808 break;
809 }
810  
811 -
812 +
813 if (cmdqelmt->CmdFromNdis == TRUE)
814 {
815 if ((cmdqelmt->command != OID_802_11_BSSID_LIST_SCAN) &&
816 @@ -1330,20 +1330,20 @@
817  
818 if ((cmdqelmt->command != RT_OID_MULTI_READ_MAC) &&
819 (cmdqelmt->command != RT_OID_VENDOR_READ_BBP) &&
820 -#ifdef DBG
821 +#ifdef DBG
822 (cmdqelmt->command != RT_OID_802_11_QUERY_HARDWARE_REGISTER) &&
823 -#endif
824 +#endif
825 (cmdqelmt->command != RT_OID_USB_VENDOR_EEPROM_READ))
826 {
827 if (cmdqelmt->buffer != NULL)
828 kfree(cmdqelmt->buffer);
829 }
830 -
831 +
832 kfree((PCmdQElmt)cmdqelmt);
833 }
834 else
835 cmdqelmt->InUse = FALSE;
836 -
837 +
838 }
839  
840  
841 @@ -1443,16 +1443,16 @@
842 PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) net_dev->priv;
843 NDIS_STATUS Status = NDIS_STATUS_SUCCESS;
844 UCHAR TmpPhy;
845 -
846 +
847 printk("rt73 driver version - %s\n", DRIVER_VERSION);
848  
849 init_MUTEX(&(pAd->usbdev_semaphore));
850 -
851 +
852 // init mediastate to disconnected
853 OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED);
854 -
855 +
856 pAd->rx_bh.func = RTUSBRxPacket;
857 -
858 +
859 // Initialize pAd->PortCfg to manufacture default
860 PortCfgInit(pAd);
861  
862 @@ -1481,19 +1481,19 @@
863 {
864 goto out;
865 }
866 -
867 +
868  
869 // Wait for hardware stable
870 {
871 ULONG MacCsr0 = 0, Index = 0;
872 -
873 +
874 do
875 {
876 Status = RTUSBReadMACRegister(pAd, MAC_CSR0, &MacCsr0);
877  
878 if (MacCsr0 != 0)
879 break;
880 -
881 +
882 RTMPusecDelay(1000);
883 } while (Index++ < 1000);
884 DBGPRINT(RT_DEBUG_TRACE, "Init: MAC_CSR0=0x%08x, Status=0x%08x\n", MacCsr0, Status);
885 @@ -1509,8 +1509,8 @@
886 // Initialize Asics
887 NICInitializeAsic(pAd);
888  
889 - // Read RaConfig profile parameters
890 -#ifdef READ_PROFILE_FROM_FILE
891 + // Read RaConfig profile parameters
892 +#ifdef READ_PROFILE_FROM_FILE
893 RTMPReadParametersFromFile(pAd);
894 #endif
895  
896 @@ -1560,7 +1560,7 @@
897 memcpy(pAd->net_dev->dev_addr, pAd->CurrentAddress, pAd->net_dev->addr_len);
898 else
899 memcpy(pAd->CurrentAddress, pAd->net_dev->dev_addr, pAd->net_dev->addr_len);
900 -
901 +
902 // Clear Reset Flag before starting receiving/transmitting
903 RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS);
904  
905 @@ -1577,10 +1577,10 @@
906  
907 // USB_ID info for UI
908 pAd->VendorDesc = 0x148F2573;
909 -
910 +
911 // Start net_dev interface tx /rx
912 netif_start_queue(net_dev);
913 -
914 +
915 netif_carrier_on(net_dev);
916 netif_wake_queue(net_dev);
917 return 0;
918 @@ -1598,17 +1598,17 @@
919 PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) net_dev->priv;
920 int ret;
921 int i = 0;
922 -
923 - DECLARE_WAIT_QUEUE_HEAD (unlink_wakeup);
924 +
925 + DECLARE_WAIT_QUEUE_HEAD (unlink_wakeup);
926 DECLARE_WAITQUEUE (wait, current);
927 -
928 +
929 DBGPRINT(RT_DEBUG_TRACE,"-->rt73_close\n");
930 -
931 +
932 netif_carrier_off(pAd->net_dev);
933 netif_stop_queue(pAd->net_dev);
934  
935 DBGPRINT(RT_DEBUG_INFO,"Ensure there are no more active urbs \n");
936 - // ensure there are no more active urbs.
937 + // ensure there are no more active urbs.
938 add_wait_queue (&unlink_wakeup, &wait);
939 pAd->wait = &unlink_wakeup;
940 // maybe wait for deletions to finish.
941 @@ -1618,35 +1618,35 @@
942 DBGPRINT (RT_DEBUG_INFO,"waited for %d urb to complete\n", atomic_read(&pAd->PendingRx));
943 }
944 pAd->wait = NULL;
945 - remove_wait_queue (&unlink_wakeup, &wait);
946 + remove_wait_queue (&unlink_wakeup, &wait);
947  
948 - if (pAd->MLMEThr_pid >= 0)
949 + if (pAd->MLMEThr_pid >= 0)
950 {
951 mlme_kill = 1;
952 RTUSBMlmeUp(pAd);
953 wmb(); // need to check
954 ret = kill_proc (pAd->MLMEThr_pid, SIGTERM, 1);
955 - if (ret)
956 + if (ret)
957 {
958 printk (KERN_ERR "%s: unable to signal thread\n", pAd->net_dev->name);
959 //return ret; Fix process killing
960 }
961 wait_for_completion (&pAd->notify);
962 }
963 - if (pAd->RTUSBCmdThr_pid>= 0)
964 + if (pAd->RTUSBCmdThr_pid>= 0)
965 {
966 RTUSBCmd_kill = 1;
967 RTUSBCMDUp(pAd);
968 wmb(); // need to check
969 ret = kill_proc (pAd->RTUSBCmdThr_pid, SIGTERM, 1);
970 - if (ret)
971 + if (ret)
972 {
973 printk (KERN_ERR "%s: unable to signal thread\n", pAd->net_dev->name);
974 //return ret; Fix process killing
975 }
976 wait_for_completion (&pAd->notify);
977 }
978 -
979 +
980 RTUSBHalt(pAd, TRUE);
981 DBGPRINT(RT_DEBUG_TRACE,"<--rt73_close\n");
982  
983 @@ -1676,7 +1676,7 @@
984  
985 /* lock the device pointers , need to check if required*/
986 down(&(pAd->usbdev_semaphore));
987 - MlmeHandler(pAd);
988 + MlmeHandler(pAd);
989  
990 /* unlock the device pointers */
991 up(&(pAd->usbdev_semaphore));
992 @@ -1703,7 +1703,7 @@
993 }
994 #endif
995  
996 - /* notify the exit routine that we're actually exiting now
997 + /* notify the exit routine that we're actually exiting now
998 *
999 * complete()/wait_for_completion() is similar to up()/down(),
1000 * except that complete() is safe in the case where the structure
1001 @@ -1744,13 +1744,13 @@
1002  
1003 /* lock the device pointers , need to check if required*/
1004 down(&(pAd->usbdev_semaphore));
1005 - CMDHandler(pAd);
1006 + CMDHandler(pAd);
1007  
1008 /* unlock the device pointers */
1009 up(&(pAd->usbdev_semaphore));
1010 }
1011  
1012 - /* notify the exit routine that we're actually exiting now
1013 + /* notify the exit routine that we're actually exiting now
1014 *
1015 * complete()/wait_for_completion() is similar to up()/down(),
1016 * except that complete() is safe in the case where the structure
1017 @@ -1771,12 +1771,12 @@
1018  
1019 static void *usb_rtusb_probe(struct usb_device *dev, UINT interface,
1020 const struct usb_device_id *id_table)
1021 -{
1022 +{
1023 PRTMP_ADAPTER pAd = (PRTMP_ADAPTER)NULL;
1024 int i;
1025 struct net_device *netdev;
1026 int res = -ENOMEM;
1027 -
1028 +
1029 for (i = 0; i < rtusb_usb_id_len; i++)
1030 {
1031 if (le32_to_cpu(dev->descriptor.idVendor) == rtusb_usb_id[i].idVendor &&
1032 @@ -1797,20 +1797,22 @@
1033 if(!netdev)
1034 {
1035 printk("alloc_etherdev failed\n");
1036 -
1037 +
1038 MOD_DEC_USE_COUNT;
1039 usb_dec_dev_use(dev);
1040 return NULL;
1041 }
1042 -
1043 +
1044 pAd = netdev->priv;
1045 pAd->net_dev = netdev;
1046 netif_stop_queue(netdev);
1047 pAd->config = dev->config;
1048 pAd->pUsb_Dev= dev;
1049 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
1050 SET_MODULE_OWNER(pAd->net_dev);
1051 +#endif
1052 ether_setup(pAd->net_dev);
1053 -
1054 +
1055 netdev->open = usb_rtusb_open;
1056 netdev->hard_start_xmit = RTMPSendPackets;
1057 netdev->stop = usb_rtusb_close;
1058 @@ -1826,22 +1828,24 @@
1059 pAd->net_dev->hard_header_len = 14;
1060 pAd->net_dev->mtu = 1500;
1061 pAd->net_dev->addr_len = 6;
1062 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
1063 pAd->net_dev->weight = 64;
1064 +#endif
1065  
1066 OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED);
1067  
1068 - {// find available
1069 + {// find available
1070 int i=0;
1071 char slot_name[IFNAMSIZ];
1072 struct net_device *device;
1073 - struct usb_interface *ifp= &dev->actconfig->interface[interface]; // get interface from system
1074 + struct usb_interface *ifp= &dev->actconfig->interface[interface]; // get interface from system
1075 struct usb_interface_descriptor *as;
1076 - struct usb_endpoint_descriptor *ep;
1077 + struct usb_endpoint_descriptor *ep;
1078  
1079 for (i = 0; i < 8; i++)
1080 {
1081 sprintf(slot_name, "rausb%d", i);
1082 -
1083 +
1084 read_lock_bh(&dev_base_lock); // avoid multiple init
1085 for (device = dev_base; device != NULL; device = device->next)
1086 {
1087 @@ -1876,13 +1880,13 @@
1088  
1089 //pAd->rx_bh.data = (unsigned long)pAd;
1090 pAd->rx_bh.func = RTUSBRxPacket;
1091 -
1092 +
1093 res = register_netdev(pAd->net_dev);
1094 if (res)
1095 goto out;
1096  
1097 return pAd;
1098 -
1099 +
1100 out:
1101 printk("register_netdev failed err=%d\n",res);
1102 return NULL;
1103 @@ -1892,16 +1896,16 @@
1104 static void usb_rtusb_disconnect(struct usb_device *dev, void *ptr)
1105 {
1106 PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) ptr;
1107 -
1108 +
1109  
1110 if (!pAd)
1111 return;
1112 -
1113 +
1114 tasklet_kill(&pAd->rx_bh);
1115 RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST);
1116 // for debug, wait to show some messages to /proc system
1117 udelay(1);
1118 - //After Add Thread implementation, Upon exec there, pAd->net_dev seems becomes NULL,
1119 + //After Add Thread implementation, Upon exec there, pAd->net_dev seems becomes NULL,
1120 //need to check why???
1121 //assert(pAd->net_dev != NULL)
1122 if(pAd->net_dev != NULL)
1123 @@ -1926,19 +1930,19 @@
1124 PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) net_dev->priv;
1125 int ret;
1126 int i = 0;
1127 -
1128 - DECLARE_WAIT_QUEUE_HEAD (unlink_wakeup);
1129 +
1130 + DECLARE_WAIT_QUEUE_HEAD (unlink_wakeup);
1131 DECLARE_WAITQUEUE (wait, current);
1132 -
1133 +
1134 DBGPRINT(RT_DEBUG_TRACE,"-->rt73_close \n");
1135 -
1136 +
1137 netif_carrier_off(pAd->net_dev);
1138 netif_stop_queue(pAd->net_dev);
1139  
1140 - // ensure there are no more active urbs.
1141 + // ensure there are no more active urbs.
1142 add_wait_queue (&unlink_wakeup, &wait);
1143 pAd->wait = &unlink_wakeup;
1144 -
1145 +
1146 // maybe wait for deletions to finish.
1147 while ((i < 25) && atomic_read(&pAd->PendingRx) > 0) {
1148 #if LINUX_VERSION_CODE >KERNEL_VERSION(2,6,9)
1149 @@ -1948,28 +1952,28 @@
1150 i++;
1151 }
1152 pAd->wait = NULL;
1153 - remove_wait_queue (&unlink_wakeup, &wait);
1154 + remove_wait_queue (&unlink_wakeup, &wait);
1155  
1156 - if (pAd->MLMEThr_pid >= 0)
1157 + if (pAd->MLMEThr_pid >= 0)
1158 {
1159 mlme_kill = 1;
1160 RTUSBMlmeUp(pAd);
1161 wmb(); // need to check
1162 ret = kill_proc (pAd->MLMEThr_pid, SIGTERM, 1);
1163 - if (ret)
1164 + if (ret)
1165 {
1166 printk (KERN_ERR "%s: unable to signal thread\n", pAd->net_dev->name);
1167 //return ret;
1168 }
1169 wait_for_completion (&pAd->notify);
1170 }
1171 - if (pAd->RTUSBCmdThr_pid>= 0)
1172 + if (pAd->RTUSBCmdThr_pid>= 0)
1173 {
1174 RTUSBCmd_kill = 1;
1175 RTUSBCMDUp(pAd);
1176 wmb(); // need to check
1177 ret = kill_proc (pAd->RTUSBCmdThr_pid, SIGTERM, 1);
1178 - if (ret)
1179 + if (ret)
1180 {
1181 printk (KERN_ERR "%s: unable to signal thread\n", pAd->net_dev->name);
1182 //return ret;
1183 @@ -1977,7 +1981,7 @@
1184 wait_for_completion (&pAd->notify);
1185 }
1186 RTUSBHalt(pAd, TRUE);
1187 -
1188 +
1189 DBGPRINT(RT_DEBUG_TRACE,"<--rt73_close \n");
1190  
1191 return 0;
1192 @@ -2008,13 +2012,13 @@
1193 /* lock the device pointers , need to check if required*/
1194 down(&(pAd->usbdev_semaphore));
1195  
1196 - MlmeHandler(pAd);
1197 + MlmeHandler(pAd);
1198  
1199 /* unlock the device pointers */
1200 up(&(pAd->usbdev_semaphore));
1201 }
1202  
1203 - /* notify the exit routine that we're actually exiting now
1204 + /* notify the exit routine that we're actually exiting now
1205 *
1206 * complete()/wait_for_completion() is similar to up()/down(),
1207 * except that complete() is safe in the case where the structure
1208 @@ -2057,13 +2061,13 @@
1209 /* lock the device pointers , need to check if required*/
1210 down(&(pAd->usbdev_semaphore));
1211  
1212 - CMDHandler(pAd);
1213 + CMDHandler(pAd);
1214  
1215 /* unlock the device pointers */
1216 up(&(pAd->usbdev_semaphore));
1217 }
1218  
1219 - /* notify the exit routine that we're actually exiting now
1220 + /* notify the exit routine that we're actually exiting now
1221 *
1222 * complete()/wait_for_completion() is similar to up()/down(),
1223 * except that complete() is safe in the case where the structure
1224 @@ -2082,7 +2086,7 @@
1225  
1226 static int usb_rtusb_probe (struct usb_interface *intf,
1227 const struct usb_device_id *id)
1228 -{
1229 +{
1230 struct usb_device *dev = interface_to_usbdev(intf);
1231 PRTMP_ADAPTER pAd = (PRTMP_ADAPTER)NULL;
1232 int i;
1233 @@ -2111,19 +2115,21 @@
1234 if(!netdev)
1235 {
1236 printk("alloc_etherdev failed\n");
1237 -
1238 +
1239 module_put(THIS_MODULE);
1240 return res;
1241 }
1242 -
1243 +
1244 pAd = netdev->priv;
1245 pAd->net_dev = netdev;
1246 netif_stop_queue(netdev);
1247 pAd->config = &dev->config->desc;
1248 pAd->pUsb_Dev = dev;
1249 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
1250 SET_MODULE_OWNER(pAd->net_dev);
1251 +#endif
1252 ether_setup(pAd->net_dev);
1253 -
1254 +
1255 netdev->open = usb_rtusb_open;
1256 netdev->stop = usb_rtusb_close;
1257 netdev->priv = pAd;
1258 @@ -2141,7 +2147,9 @@
1259 pAd->net_dev->hard_header_len = 14;
1260 pAd->net_dev->mtu = 1500;
1261 pAd->net_dev->addr_len = 6;
1262 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
1263 pAd->net_dev->weight = 64;
1264 +#endif
1265  
1266 OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED);
1267  
1268 @@ -2149,23 +2157,23 @@
1269 pAd->RTUSBCmdThr_pid= -1;
1270  
1271 SET_NETDEV_DEV(pAd->net_dev, &intf->dev);
1272 -
1273 - {// find available
1274 +
1275 + {// find available
1276 int i=0;
1277 char slot_name[IFNAMSIZ];
1278 //struct net_device *device;
1279 struct usb_host_interface *iface_desc;
1280 struct usb_endpoint_descriptor *endpoint;
1281  
1282 -
1283 +
1284 for (i = 0; i < 8; i++)
1285 {
1286 sprintf(slot_name, "rausb%d", i);
1287  
1288 -#if 1
1289 - if(dev_get_by_name(slot_name)==NULL)
1290 +#if 1
1291 + if(dev_get_by_name(&init_net, slot_name)==NULL)
1292 break;
1293 -#else
1294 +#else
1295 read_lock_bh(&dev_base_lock); // avoid multiple init
1296 for (device = dev_base; device != NULL; device = device->next)
1297 {
1298 @@ -2175,9 +2183,9 @@
1299 }
1300 }
1301 read_unlock_bh(&dev_base_lock);
1302 -
1303 +
1304 if(device == NULL) break;
1305 -#endif
1306 +#endif
1307 }
1308 if(i == 8)
1309 {
1310 @@ -2194,18 +2202,18 @@
1311  
1312 /* check out the endpoint: it has to be Interrupt & IN */
1313 endpoint = &iface_desc->endpoint[i].desc;
1314 -
1315 +
1316 /* get Max Packet Size from endpoint */
1317 pAd->BulkOutMaxPacketSize = (USHORT)endpoint->wMaxPacketSize;
1318 DBGPRINT(RT_DEBUG_TRACE, "BulkOutMaxPacketSize %d\n", pAd->BulkOutMaxPacketSize);
1319  
1320 }
1321 -
1322 +
1323 //bottom half data is assign at each task_scheduler
1324 //pAd->rx_bh.data = (unsigned long)pAd;
1325 pAd->rx_bh.func = RTUSBRxPacket;
1326  
1327 -
1328 +
1329 res = register_netdev(pAd->net_dev);
1330 if (res)
1331 goto out;
1332 @@ -2217,7 +2225,7 @@
1333 usb_set_intfdata(intf, pAd);
1334  
1335 return 0;
1336 -
1337 +
1338 out:
1339 printk("register_netdev failed err=%d\n",res);
1340 free_netdev(netdev);
1341 @@ -2229,7 +2237,7 @@
1342 {
1343 struct usb_device *dev = interface_to_usbdev(intf);
1344 PRTMP_ADAPTER pAd = (PRTMP_ADAPTER)NULL;
1345 -
1346 +
1347 pAd = usb_get_intfdata(intf);
1348  
1349 usb_set_intfdata(intf, NULL);
1350 @@ -2238,11 +2246,11 @@
1351 dev->bus->bus_name, dev->devpath);
1352 if (!pAd)
1353 return;
1354 -
1355 +
1356 tasklet_kill(&pAd->rx_bh);
1357 // for debug, wait to show some messages to /proc system
1358 udelay(1);
1359 - //After Add Thread implementation, Upon exec there, pAd->net_dev seems becomes NULL,
1360 + //After Add Thread implementation, Upon exec there, pAd->net_dev seems becomes NULL,
1361 //need to check why???
1362 //assert(pAd->net_dev != NULL)
1363 if(pAd->net_dev!= NULL)
1364 @@ -2295,7 +2303,7 @@
1365 udelay(1);
1366 udelay(1);
1367 usb_deregister(&rtusb_driver);
1368 -
1369 +
1370 printk("<=== rtusb exit\n");
1371 }
1372 /**************************************/