[PATCH 3/4] rtl8192u: remove bad whitespaces

Mauro Carvalho Chehab mchehab at infradead.org
Tue Nov 3 09:42:46 UTC 2009


Signed-off-by: Mauro Carvalho Chehab <mchehab at redhat.com>
---
 drivers/staging/rtl8192u/ieee80211.h               |  960 +++++-----
 drivers/staging/rtl8192u/ieee80211/Makefile        |    6 +-
 drivers/staging/rtl8192u/ieee80211/aes.c           |   42 +-
 drivers/staging/rtl8192u/ieee80211/api.c           |   60 +-
 drivers/staging/rtl8192u/ieee80211/arc4.c          |    8 +-
 drivers/staging/rtl8192u/ieee80211/autoload.c      |    2 +-
 drivers/staging/rtl8192u/ieee80211/cipher.c        |  130 +-
 drivers/staging/rtl8192u/ieee80211/compress.c      |   22 +-
 drivers/staging/rtl8192u/ieee80211/crypto_compat.h |   16 +-
 drivers/staging/rtl8192u/ieee80211/digest.c        |   16 +-
 drivers/staging/rtl8192u/ieee80211/ieee80211.h     |  960 +++++-----
 .../rtl8192u/ieee80211/ieee80211_crypt_ccmp.c      |   20 +-
 .../rtl8192u/ieee80211/ieee80211_crypt_tkip.c      |   58 +-
 .../rtl8192u/ieee80211/ieee80211_crypt_wep.c       |   58 +-
 .../staging/rtl8192u/ieee80211/ieee80211_module.c  |   20 +-
 drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c  |  662 ++++----
 .../staging/rtl8192u/ieee80211/ieee80211_softmac.c | 1208 ++++++------
 .../rtl8192u/ieee80211/ieee80211_softmac_wx.c      |  266 ++--
 drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c  |  128 +-
 drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c  |  480 +++---
 drivers/staging/rtl8192u/ieee80211/internal.h      |    2 +-
 drivers/staging/rtl8192u/ieee80211/proc.c          |   16 +-
 .../staging/rtl8192u/ieee80211/rtl819x_BAProc.c    |    4 +-
 drivers/staging/rtl8192u/ieee80211/rtl819x_HT.h    |    2 +-
 .../staging/rtl8192u/ieee80211/rtl819x_HTProc.c    |   22 +-
 drivers/staging/rtl8192u/ieee80211/rtl819x_Qos.h   |   12 +-
 .../staging/rtl8192u/ieee80211/rtl819x_TSProc.c    |   38 +-
 drivers/staging/rtl8192u/ieee80211/rtl_crypto.h    |  104 +-
 drivers/staging/rtl8192u/r8180_93cx6.c             |   46 +-
 drivers/staging/rtl8192u/r8180_93cx6.h             |   18 +-
 drivers/staging/rtl8192u/r8180_pm.c                |   20 +-
 drivers/staging/rtl8192u/r8180_pm.h                |   10 +-
 drivers/staging/rtl8192u/r8190_rtl8256.c           |   62 +-
 drivers/staging/rtl8192u/r8190_rtl8256.h           |    8 +-
 drivers/staging/rtl8192u/r8192U.h                  |  396 ++--
 drivers/staging/rtl8192u/r8192U_core.c             | 2068 ++++++++++----------
 drivers/staging/rtl8192u/r8192U_dm.c               |   28 +-
 drivers/staging/rtl8192u/r8192U_dm.h               |    2 +-
 drivers/staging/rtl8192u/r8192U_hw.h               |  100 +-
 drivers/staging/rtl8192u/r8192U_wx.c               |  694 ++++----
 drivers/staging/rtl8192u/r8192U_wx.h               |    8 +-
 drivers/staging/rtl8192u/r819xU_cmdpkt.c           |   36 +-
 drivers/staging/rtl8192u/r819xU_cmdpkt.h           |    8 +-
 drivers/staging/rtl8192u/r819xU_firmware.c         |  160 +-
 drivers/staging/rtl8192u/r819xU_firmware.h         |    6 +-
 drivers/staging/rtl8192u/r819xU_phy.c              |   22 +-
 drivers/staging/rtl8192u/r819xU_phyreg.h           |   50 +-
 47 files changed, 4532 insertions(+), 4532 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211.h b/drivers/staging/rtl8192u/ieee80211.h
index e80dbef..f579585 100644
--- a/drivers/staging/rtl8192u/ieee80211.h
+++ b/drivers/staging/rtl8192u/ieee80211.h
@@ -72,7 +72,7 @@ struct iw_spy_data{
 	struct iw_quality	spy_thr_low; /* Low threshold */
 	struct iw_quality	spy_thr_high; /* High threshold */
 	u_char			spy_thr_under[IW_MAX_SPY];
-}; 
+};
 #endif
 #endif
 
@@ -86,8 +86,8 @@ struct iw_spy_data{
  *
  */
 #define container_of(ptr, type, member) ({                      \
-        const typeof( ((type *)0)->member ) *__mptr = (ptr);    \
-        (type *)( (char *)__mptr - offsetof(type,member) );})
+	const typeof( ((type *)0)->member ) *__mptr = (ptr);    \
+	(type *)( (char *)__mptr - offsetof(type,member) );})
 #endif
 
 #define KEY_TYPE_NA		0x0
@@ -125,63 +125,63 @@ struct iw_spy_data{
 /* defined for skb cb field */
 /* At most 28 byte */
 typedef struct cb_desc {
-        /* Tx Desc Related flags (8-9) */
+	/* Tx Desc Related flags (8-9) */
 	u8 bLastIniPkt:1;
 	u8 bCmdOrInit:1;
-        u8 bFirstSeg:1;
-        u8 bLastSeg:1;
-        u8 bEncrypt:1;
-        u8 bTxDisableRateFallBack:1;
-        u8 bTxUseDriverAssingedRate:1;
-        u8 bHwSec:1; //indicate whether use Hw security. WB
-
-        u8 reserved1;
-
-        /* Tx Firmware Relaged flags (10-11)*/
-        u8 bCTSEnable:1;
-        u8 bRTSEnable:1;
-        u8 bUseShortGI:1;
-        u8 bUseShortPreamble:1;
-        u8 bTxEnableFwCalcDur:1;
-        u8 bAMPDUEnable:1;
-        u8 bRTSSTBC:1;
-        u8 RTSSC:1;
-
-        u8 bRTSBW:1;
-        u8 bPacketBW:1;
+	u8 bFirstSeg:1;
+	u8 bLastSeg:1;
+	u8 bEncrypt:1;
+	u8 bTxDisableRateFallBack:1;
+	u8 bTxUseDriverAssingedRate:1;
+	u8 bHwSec:1; //indicate whether use Hw security. WB
+
+	u8 reserved1;
+
+	/* Tx Firmware Relaged flags (10-11)*/
+	u8 bCTSEnable:1;
+	u8 bRTSEnable:1;
+	u8 bUseShortGI:1;
+	u8 bUseShortPreamble:1;
+	u8 bTxEnableFwCalcDur:1;
+	u8 bAMPDUEnable:1;
+	u8 bRTSSTBC:1;
+	u8 RTSSC:1;
+
+	u8 bRTSBW:1;
+	u8 bPacketBW:1;
 	u8 bRTSUseShortPreamble:1;
 	u8 bRTSUseShortGI:1;
 	u8 bMulticast:1;
 	u8 bBroadcast:1;
-        //u8 reserved2:2;
-        u8 drv_agg_enable:1;
-        u8 reserved2:1;
-
-        /* Tx Desc related element(12-19) */
-        u8 rata_index;
-        u8 queue_index;
-        //u8 reserved3;
-        //u8 reserved4;
-        u16 txbuf_size;
-        //u8 reserved5;
+	//u8 reserved2:2;
+	u8 drv_agg_enable:1;
+	u8 reserved2:1;
+
+	/* Tx Desc related element(12-19) */
+	u8 rata_index;
+	u8 queue_index;
+	//u8 reserved3;
+	//u8 reserved4;
+	u16 txbuf_size;
+	//u8 reserved5;
 	u8 RATRIndex;
-        u8 reserved6;
-        u8 reserved7;
-        u8 reserved8;
-
-        /* Tx firmware related element(20-27) */
-        u8 data_rate;
-        u8 rts_rate;
-        u8 ampdu_factor;
-        u8 ampdu_density;
-        //u8 reserved9;
-        //u8 reserved10;
-        //u8 reserved11;
-        u8 DrvAggrNum;
+	u8 reserved6;
+	u8 reserved7;
+	u8 reserved8;
+
+	/* Tx firmware related element(20-27) */
+	u8 data_rate;
+	u8 rts_rate;
+	u8 ampdu_factor;
+	u8 ampdu_density;
+	//u8 reserved9;
+	//u8 reserved10;
+	//u8 reserved11;
+	u8 DrvAggrNum;
 	u16 pkt_size;
-        u8 reserved12;
+	u8 reserved12;
 }cb_desc, *pcb_desc;
-                        
+
 /*--------------------------Define -------------------------------------------*/
 #define MGN_1M                  0x02
 #define MGN_2M                  0x04
@@ -220,11 +220,11 @@ typedef struct cb_desc {
 enum	_ReasonCode{
 	unspec_reason	= 0x1,
 	auth_not_valid	= 0x2,
-	deauth_lv_ss	= 0x3, 
+	deauth_lv_ss	= 0x3,
 	inactivity		= 0x4,
-	ap_overload 	= 0x5, 
+	ap_overload 	= 0x5,
 	class2_err		= 0x6,
-	class3_err		= 0x7, 
+	class3_err		= 0x7,
 	disas_lv_ss 	= 0x8,
 	asoc_not_auth	= 0x9,
 
@@ -282,7 +282,7 @@ enum	_ReasonCode{
 #define IEEE_PARAM_WPAX_SELECT			7
 //Added for notify the encryption type selection
 //   David, 2006.9.26
-#define IEEE_PROTO_WPA				1	
+#define IEEE_PROTO_WPA				1
 #define IEEE_PROTO_RSN				2
 //Added for notify the encryption type selection
 //   David, 2006.9.26
@@ -312,7 +312,7 @@ enum	_ReasonCode{
 
 #define MAX_IE_LEN  0xff
 
-// added for kernel conflict 
+// added for kernel conflict
 #define ieee80211_crypt_deinit_entries 	ieee80211_crypt_deinit_entries_rsl
 #define ieee80211_crypt_deinit_handler 	ieee80211_crypt_deinit_handler_rsl
 #define ieee80211_crypt_delayed_deinit 	ieee80211_crypt_delayed_deinit_rsl
@@ -359,7 +359,7 @@ enum	_ReasonCode{
 #define ieee80211_wx_get_rate		ieee80211_wx_get_rate_rsl
 #define ieee80211_wx_set_wap		ieee80211_wx_set_wap_rsl
 #define ieee80211_wx_get_wap		ieee80211_wx_get_wap_rsl
-#define ieee80211_wx_set_mode		ieee80211_wx_set_mode_rsl 
+#define ieee80211_wx_set_mode		ieee80211_wx_set_mode_rsl
 #define ieee80211_wx_get_mode		ieee80211_wx_get_mode_rsl
 #define ieee80211_wx_set_scan		ieee80211_wx_set_scan_rsl
 #define ieee80211_wx_get_freq		ieee80211_wx_get_freq_rsl
@@ -389,7 +389,7 @@ enum	_ReasonCode{
 typedef struct ieee_param {
 	u32 cmd;
 	u8 sta_addr[ETH_ALEN];
-        union {
+	union {
 		struct {
 			u8 name;
 			u32 value;
@@ -399,9 +399,9 @@ typedef struct ieee_param {
 			u8 reserved[32];
 			u8 data[0];
 		} wpa_ie;
-	        struct{
+		struct{
 			int command;
-    			int reason_code;
+			int reason_code;
 		} mlme;
 		struct {
 			u8 alg[IEEE_CRYPT_ALG_NAME_LEN];
@@ -442,23 +442,23 @@ static inline void tq_init(struct tq_struct * task, void(*func)(void *), void *d
 #define MSECS(t)	(HZ * ((t) / 1000) + (HZ * ((t) % 1000)) / 1000)
 static inline unsigned long msleep_interruptible_rsl(unsigned int msecs)
 {
-         unsigned long timeout = MSECS(msecs) + 1;
- 
-         while (timeout) {
-                 set_current_state(TASK_INTERRUPTIBLE);
-                 timeout = schedule_timeout(timeout);
-         }
-         return timeout;
+	 unsigned long timeout = MSECS(msecs) + 1;
+
+	 while (timeout) {
+		 set_current_state(TASK_INTERRUPTIBLE);
+		 timeout = schedule_timeout(timeout);
+	 }
+	 return timeout;
 }
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,31))
 static inline void msleep(unsigned int msecs)
 {
-         unsigned long timeout = MSECS(msecs) + 1;
- 
-         while (timeout) {
-                 set_current_state(TASK_UNINTERRUPTIBLE);
-                 timeout = schedule_timeout(timeout);
-         }
+	 unsigned long timeout = MSECS(msecs) + 1;
+
+	 while (timeout) {
+		 set_current_state(TASK_UNINTERRUPTIBLE);
+		 timeout = schedule_timeout(timeout);
+	 }
 }
 #endif
 #else
@@ -551,7 +551,7 @@ static inline void msleep(unsigned int msecs)
 
 #define	FC_QOS_BIT					BIT7
 #define IsDataFrame(pdu)			( ((pdu[0] & 0x0C)==0x08) ? true : false )
-#define	IsLegacyDataFrame(pdu)	(IsDataFrame(pdu) && (!(pdu[0]&FC_QOS_BIT)) )	
+#define	IsLegacyDataFrame(pdu)	(IsDataFrame(pdu) && (!(pdu[0]&FC_QOS_BIT)) )
 //added by wb. Is this right?
 #define IsQoSDataFrame(pframe)  ((*(u16*)pframe&(IEEE80211_STYPE_QOS_DATA|IEEE80211_FTYPE_DATA)) == (IEEE80211_STYPE_QOS_DATA|IEEE80211_FTYPE_DATA))
 #define Frame_Order(pframe)     (*(u16*)pframe&IEEE80211_FCTL_ORDER)
@@ -559,24 +559,24 @@ static inline void msleep(unsigned int msecs)
 #define SN_EQUAL(a, b)	(a == b)
 #define MAX_DEV_ADDR_SIZE 8
 typedef enum _ACT_CATEGORY{
-        ACT_CAT_QOS = 1,
-        ACT_CAT_DLS = 2,
-        ACT_CAT_BA  = 3,
-        ACT_CAT_HT  = 7,
-        ACT_CAT_WMM = 17,
+	ACT_CAT_QOS = 1,
+	ACT_CAT_DLS = 2,
+	ACT_CAT_BA  = 3,
+	ACT_CAT_HT  = 7,
+	ACT_CAT_WMM = 17,
 } ACT_CATEGORY, *PACT_CATEGORY;
 
 typedef enum _TS_ACTION{
-        ACT_ADDTSREQ = 0,
-        ACT_ADDTSRSP = 1,
-        ACT_DELTS    = 2,
-        ACT_SCHEDULE = 3,
+	ACT_ADDTSREQ = 0,
+	ACT_ADDTSRSP = 1,
+	ACT_DELTS    = 2,
+	ACT_SCHEDULE = 3,
 } TS_ACTION, *PTS_ACTION;
 
 typedef enum _BA_ACTION{
-        ACT_ADDBAREQ = 0,
-        ACT_ADDBARSP = 1,
-        ACT_DELBA    = 2,
+	ACT_ADDBAREQ = 0,
+	ACT_ADDBARSP = 1,
+	ACT_DELBA    = 2,
 } BA_ACTION, *PBA_ACTION;
 
 typedef enum _InitialGainOpType{
@@ -607,7 +607,7 @@ do { if (ieee80211_debug_level & (level)) \
 			}				\
 			printk("\n");			\
 		}					\
-	} while (0)		
+	} while (0)
 #else
 #define IEEE80211_DEBUG(level, fmt, args...) do {} while (0)
 #define IEEE80211_DEBUG_DATA(level, data, datalen) do {} while(0)
@@ -685,24 +685,24 @@ do { if (ieee80211_debug_level & (level)) \
 /* Added by Annie, 2005-11-22. */
 #define MAX_STR_LEN     64
 /* I want to see ASCII 33 to 126 only. Otherwise, I print '?'. Annie, 2005-11-22.*/
-#define PRINTABLE(_ch)  (_ch>'!' && _ch<'~')    
+#define PRINTABLE(_ch)  (_ch>'!' && _ch<'~')
 #define IEEE80211_PRINT_STR(_Comp, _TitleString, _Ptr, _Len)                            	\
-                        if((_Comp) & level)   							\
-                        {                                                                       \
-                                int             __i;                                            \
-                                u8  buffer[MAX_STR_LEN];                                    	\
-                                int length = (_Len<MAX_STR_LEN)? _Len : (MAX_STR_LEN-1) ;  	\
-                                memset(buffer, 0, MAX_STR_LEN);                      		\
-                                memcpy(buffer, (u8 *)_Ptr, length );            		\
-                                for( __i=0; __i<MAX_STR_LEN; __i++ )                            \
-                                {                                                               \
-                                     if( !PRINTABLE(buffer[__i]) )   buffer[__i] = '?';     	\
-                                }                                                               \
-                                buffer[length] = '\0';                                          \
-                                printk("Rtl819x: ");                                         	\
-                                printk(_TitleString);                                         \
-                                printk(": %d, <%s>\n", _Len, buffer);                         \
-                        }
+			if((_Comp) & level)   							\
+			{                                                                       \
+				int             __i;                                            \
+				u8  buffer[MAX_STR_LEN];                                    	\
+				int length = (_Len<MAX_STR_LEN)? _Len : (MAX_STR_LEN-1) ;  	\
+				memset(buffer, 0, MAX_STR_LEN);                      		\
+				memcpy(buffer, (u8 *)_Ptr, length );            		\
+				for( __i=0; __i<MAX_STR_LEN; __i++ )                            \
+				{                                                               \
+				     if( !PRINTABLE(buffer[__i]) )   buffer[__i] = '?';     	\
+				}                                                               \
+				buffer[length] = '\0';                                          \
+				printk("Rtl819x: ");                                         	\
+				printk(_TitleString);                                         \
+				printk(": %d, <%s>\n", _Len, buffer);                         \
+			}
 #else
 #define IEEE80211_PRINT_STR(_Comp, _TitleString, _Ptr, _Len)  do {} while (0)
 #endif
@@ -731,10 +731,10 @@ do { if (ieee80211_debug_level & (level)) \
 
 struct ieee80211_snap_hdr {
 
-        u8    dsap;   /* always 0xAA */
-        u8    ssap;   /* always 0xAA */
-        u8    ctrl;   /* always 0x03 */
-        u8    oui[P80211_OUI_LEN];    /* organizational universal id */
+	u8    dsap;   /* always 0xAA */
+	u8    ssap;   /* always 0xAA */
+	u8    ctrl;   /* always 0x03 */
+	u8    oui[P80211_OUI_LEN];    /* organizational universal id */
 
 } __attribute__ ((packed));
 
@@ -775,65 +775,65 @@ struct ieee80211_snap_hdr {
 
 /* Status codes */
 enum ieee80211_statuscode {
-        WLAN_STATUS_SUCCESS = 0,
-        WLAN_STATUS_UNSPECIFIED_FAILURE = 1,
-        WLAN_STATUS_CAPS_UNSUPPORTED = 10,
-        WLAN_STATUS_REASSOC_NO_ASSOC = 11,
-        WLAN_STATUS_ASSOC_DENIED_UNSPEC = 12,
-        WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG = 13,
-        WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION = 14,
-        WLAN_STATUS_CHALLENGE_FAIL = 15,
-        WLAN_STATUS_AUTH_TIMEOUT = 16,
-        WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA = 17,
-        WLAN_STATUS_ASSOC_DENIED_RATES = 18,
-        /* 802.11b */
-        WLAN_STATUS_ASSOC_DENIED_NOSHORTPREAMBLE = 19,
-        WLAN_STATUS_ASSOC_DENIED_NOPBCC = 20,
-        WLAN_STATUS_ASSOC_DENIED_NOAGILITY = 21,
-        /* 802.11h */
-        WLAN_STATUS_ASSOC_DENIED_NOSPECTRUM = 22,
-        WLAN_STATUS_ASSOC_REJECTED_BAD_POWER = 23,
-        WLAN_STATUS_ASSOC_REJECTED_BAD_SUPP_CHAN = 24,
-        /* 802.11g */
-        WLAN_STATUS_ASSOC_DENIED_NOSHORTTIME = 25,
-        WLAN_STATUS_ASSOC_DENIED_NODSSSOFDM = 26,
-        /* 802.11i */
-        WLAN_STATUS_INVALID_IE = 40,
-        WLAN_STATUS_INVALID_GROUP_CIPHER = 41,
-        WLAN_STATUS_INVALID_PAIRWISE_CIPHER = 42,
-        WLAN_STATUS_INVALID_AKMP = 43,
-        WLAN_STATUS_UNSUPP_RSN_VERSION = 44,
-        WLAN_STATUS_INVALID_RSN_IE_CAP = 45,
-        WLAN_STATUS_CIPHER_SUITE_REJECTED = 46,
+	WLAN_STATUS_SUCCESS = 0,
+	WLAN_STATUS_UNSPECIFIED_FAILURE = 1,
+	WLAN_STATUS_CAPS_UNSUPPORTED = 10,
+	WLAN_STATUS_REASSOC_NO_ASSOC = 11,
+	WLAN_STATUS_ASSOC_DENIED_UNSPEC = 12,
+	WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG = 13,
+	WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION = 14,
+	WLAN_STATUS_CHALLENGE_FAIL = 15,
+	WLAN_STATUS_AUTH_TIMEOUT = 16,
+	WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA = 17,
+	WLAN_STATUS_ASSOC_DENIED_RATES = 18,
+	/* 802.11b */
+	WLAN_STATUS_ASSOC_DENIED_NOSHORTPREAMBLE = 19,
+	WLAN_STATUS_ASSOC_DENIED_NOPBCC = 20,
+	WLAN_STATUS_ASSOC_DENIED_NOAGILITY = 21,
+	/* 802.11h */
+	WLAN_STATUS_ASSOC_DENIED_NOSPECTRUM = 22,
+	WLAN_STATUS_ASSOC_REJECTED_BAD_POWER = 23,
+	WLAN_STATUS_ASSOC_REJECTED_BAD_SUPP_CHAN = 24,
+	/* 802.11g */
+	WLAN_STATUS_ASSOC_DENIED_NOSHORTTIME = 25,
+	WLAN_STATUS_ASSOC_DENIED_NODSSSOFDM = 26,
+	/* 802.11i */
+	WLAN_STATUS_INVALID_IE = 40,
+	WLAN_STATUS_INVALID_GROUP_CIPHER = 41,
+	WLAN_STATUS_INVALID_PAIRWISE_CIPHER = 42,
+	WLAN_STATUS_INVALID_AKMP = 43,
+	WLAN_STATUS_UNSUPP_RSN_VERSION = 44,
+	WLAN_STATUS_INVALID_RSN_IE_CAP = 45,
+	WLAN_STATUS_CIPHER_SUITE_REJECTED = 46,
 };
 
 /* Reason codes */
 enum ieee80211_reasoncode {
-        WLAN_REASON_UNSPECIFIED = 1,
-        WLAN_REASON_PREV_AUTH_NOT_VALID = 2,
-        WLAN_REASON_DEAUTH_LEAVING = 3,
-        WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY = 4,
-        WLAN_REASON_DISASSOC_AP_BUSY = 5,
-        WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA = 6,
-        WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA = 7,
-        WLAN_REASON_DISASSOC_STA_HAS_LEFT = 8,
-        WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH = 9,
-        /* 802.11h */
-        WLAN_REASON_DISASSOC_BAD_POWER = 10,
-        WLAN_REASON_DISASSOC_BAD_SUPP_CHAN = 11,
-        /* 802.11i */
-        WLAN_REASON_INVALID_IE = 13,
-        WLAN_REASON_MIC_FAILURE = 14,
-        WLAN_REASON_4WAY_HANDSHAKE_TIMEOUT = 15,
-        WLAN_REASON_GROUP_KEY_HANDSHAKE_TIMEOUT = 16,
-        WLAN_REASON_IE_DIFFERENT = 17,
-        WLAN_REASON_INVALID_GROUP_CIPHER = 18,
-        WLAN_REASON_INVALID_PAIRWISE_CIPHER = 19,
-        WLAN_REASON_INVALID_AKMP = 20,
-        WLAN_REASON_UNSUPP_RSN_VERSION = 21,
-        WLAN_REASON_INVALID_RSN_IE_CAP = 22,
-        WLAN_REASON_IEEE8021X_FAILED = 23,
-        WLAN_REASON_CIPHER_SUITE_REJECTED = 24,
+	WLAN_REASON_UNSPECIFIED = 1,
+	WLAN_REASON_PREV_AUTH_NOT_VALID = 2,
+	WLAN_REASON_DEAUTH_LEAVING = 3,
+	WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY = 4,
+	WLAN_REASON_DISASSOC_AP_BUSY = 5,
+	WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA = 6,
+	WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA = 7,
+	WLAN_REASON_DISASSOC_STA_HAS_LEFT = 8,
+	WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH = 9,
+	/* 802.11h */
+	WLAN_REASON_DISASSOC_BAD_POWER = 10,
+	WLAN_REASON_DISASSOC_BAD_SUPP_CHAN = 11,
+	/* 802.11i */
+	WLAN_REASON_INVALID_IE = 13,
+	WLAN_REASON_MIC_FAILURE = 14,
+	WLAN_REASON_4WAY_HANDSHAKE_TIMEOUT = 15,
+	WLAN_REASON_GROUP_KEY_HANDSHAKE_TIMEOUT = 16,
+	WLAN_REASON_IE_DIFFERENT = 17,
+	WLAN_REASON_INVALID_GROUP_CIPHER = 18,
+	WLAN_REASON_INVALID_PAIRWISE_CIPHER = 19,
+	WLAN_REASON_INVALID_AKMP = 20,
+	WLAN_REASON_UNSUPP_RSN_VERSION = 21,
+	WLAN_REASON_INVALID_RSN_IE_CAP = 22,
+	WLAN_REASON_IEEE8021X_FAILED = 23,
+	WLAN_REASON_CIPHER_SUITE_REJECTED = 24,
 };
 
 #define IEEE80211_STATMASK_SIGNAL (1<<0)
@@ -849,13 +849,13 @@ enum ieee80211_reasoncode {
 #define IEEE80211_52GHZ_BAND     (1<<1)
 
 #define IEEE80211_CCK_RATE_LEN  		4
-#define IEEE80211_CCK_RATE_1MB		        0x02
-#define IEEE80211_CCK_RATE_2MB		        0x04
-#define IEEE80211_CCK_RATE_5MB		        0x0B
-#define IEEE80211_CCK_RATE_11MB		        0x16
+#define IEEE80211_CCK_RATE_1MB			0x02
+#define IEEE80211_CCK_RATE_2MB			0x04
+#define IEEE80211_CCK_RATE_5MB			0x0B
+#define IEEE80211_CCK_RATE_11MB			0x16
 #define IEEE80211_OFDM_RATE_LEN 		8
-#define IEEE80211_OFDM_RATE_6MB		        0x0C
-#define IEEE80211_OFDM_RATE_9MB		        0x12
+#define IEEE80211_OFDM_RATE_6MB			0x0C
+#define IEEE80211_OFDM_RATE_9MB			0x12
 #define IEEE80211_OFDM_RATE_12MB		0x18
 #define IEEE80211_OFDM_RATE_18MB		0x24
 #define IEEE80211_OFDM_RATE_24MB		0x30
@@ -877,12 +877,12 @@ enum ieee80211_reasoncode {
 #define IEEE80211_OFDM_RATE_48MB_MASK		(1<<10)
 #define IEEE80211_OFDM_RATE_54MB_MASK		(1<<11)
 
-#define IEEE80211_CCK_RATES_MASK	        0x0000000F
+#define IEEE80211_CCK_RATES_MASK		0x0000000F
 #define IEEE80211_CCK_BASIC_RATES_MASK	(IEEE80211_CCK_RATE_1MB_MASK | \
 	IEEE80211_CCK_RATE_2MB_MASK)
 #define IEEE80211_CCK_DEFAULT_RATES_MASK	(IEEE80211_CCK_BASIC_RATES_MASK | \
-        IEEE80211_CCK_RATE_5MB_MASK | \
-        IEEE80211_CCK_RATE_11MB_MASK)
+	IEEE80211_CCK_RATE_5MB_MASK | \
+	IEEE80211_CCK_RATE_11MB_MASK)
 
 #define IEEE80211_OFDM_RATES_MASK		0x00000FF0
 #define IEEE80211_OFDM_BASIC_RATES_MASK	(IEEE80211_OFDM_RATE_6MB_MASK | \
@@ -895,10 +895,10 @@ enum ieee80211_reasoncode {
 	IEEE80211_OFDM_RATE_48MB_MASK | \
 	IEEE80211_OFDM_RATE_54MB_MASK)
 #define IEEE80211_DEFAULT_RATES_MASK (IEEE80211_OFDM_DEFAULT_RATES_MASK | \
-                                IEEE80211_CCK_DEFAULT_RATES_MASK)
+				IEEE80211_CCK_DEFAULT_RATES_MASK)
 
 #define IEEE80211_NUM_OFDM_RATES	    8
-#define IEEE80211_NUM_CCK_RATES	            4
+#define IEEE80211_NUM_CCK_RATES		    4
 #define IEEE80211_OFDM_SHIFT_MASK_A         4
 
 
@@ -911,7 +911,7 @@ enum ieee80211_reasoncode {
 #define IEEE80211_QOS_HAS_SEQ(fc) \
 	(((fc) & (IEEE80211_FC0_TYPE_MASK | IEEE80211_FC0_SUBTYPE_MASK)) == \
 	 (IEEE80211_FC0_TYPE_DATA | IEEE80211_FC0_SUBTYPE_QOS))
-	
+
 /* this is stolen from ipw2200 driver */
 #define IEEE_IBSS_MAC_HASH_SIZE 31
 struct ieee_ibss_seq {
@@ -942,7 +942,7 @@ struct ieee80211_rx_stats {
 	u8 nic_type;
 	u16       Length;
 	//      u8        DataRate;      // In 0.5 Mbps
-	u8        SignalQuality; // in 0-100 index. 
+	u8        SignalQuality; // in 0-100 index.
 	s32       RecvSignalPower; // Real power in dBm for this packet, no beautification and aggregation.
 	s8        RxPower; // in dBm Translate from PWdB
 	u8        SignalStrength; // in 0-100 index.
@@ -1064,10 +1064,10 @@ struct ieee80211_device;
 
 struct ieee80211_security {
 	u16 active_key:2,
-            enabled:1,
+	    enabled:1,
 	    auth_mode:2,
-            auth_algo:4,
-            unicast_uses_group:1,
+	    auth_algo:4,
+	    unicast_uses_group:1,
 	    encrypt:1;
 	u8 key_sizes[WEP_KEYS];
 	u8 keys[WEP_KEYS][SCM_KEY_LEN];
@@ -1089,60 +1089,60 @@ Total: 28-2340 bytes
 
 /* Management Frame Information Element Types */
 enum ieee80211_mfie {
-        MFIE_TYPE_SSID = 0,
-        MFIE_TYPE_RATES = 1,
-        MFIE_TYPE_FH_SET = 2,
-        MFIE_TYPE_DS_SET = 3,
-        MFIE_TYPE_CF_SET = 4,
-        MFIE_TYPE_TIM = 5,
-        MFIE_TYPE_IBSS_SET = 6,
-        MFIE_TYPE_COUNTRY = 7,
-        MFIE_TYPE_HOP_PARAMS = 8,
-        MFIE_TYPE_HOP_TABLE = 9,
-        MFIE_TYPE_REQUEST = 10,
-        MFIE_TYPE_CHALLENGE = 16,
-        MFIE_TYPE_POWER_CONSTRAINT = 32,
-        MFIE_TYPE_POWER_CAPABILITY = 33,
-        MFIE_TYPE_TPC_REQUEST = 34,
-        MFIE_TYPE_TPC_REPORT = 35,
-        MFIE_TYPE_SUPP_CHANNELS = 36,
-        MFIE_TYPE_CSA = 37,
-        MFIE_TYPE_MEASURE_REQUEST = 38,
-        MFIE_TYPE_MEASURE_REPORT = 39,
-        MFIE_TYPE_QUIET = 40,
-        MFIE_TYPE_IBSS_DFS = 41,
-        MFIE_TYPE_ERP = 42,
-        MFIE_TYPE_RSN = 48,
-        MFIE_TYPE_RATES_EX = 50,
-        MFIE_TYPE_HT_CAP= 45,
+	MFIE_TYPE_SSID = 0,
+	MFIE_TYPE_RATES = 1,
+	MFIE_TYPE_FH_SET = 2,
+	MFIE_TYPE_DS_SET = 3,
+	MFIE_TYPE_CF_SET = 4,
+	MFIE_TYPE_TIM = 5,
+	MFIE_TYPE_IBSS_SET = 6,
+	MFIE_TYPE_COUNTRY = 7,
+	MFIE_TYPE_HOP_PARAMS = 8,
+	MFIE_TYPE_HOP_TABLE = 9,
+	MFIE_TYPE_REQUEST = 10,
+	MFIE_TYPE_CHALLENGE = 16,
+	MFIE_TYPE_POWER_CONSTRAINT = 32,
+	MFIE_TYPE_POWER_CAPABILITY = 33,
+	MFIE_TYPE_TPC_REQUEST = 34,
+	MFIE_TYPE_TPC_REPORT = 35,
+	MFIE_TYPE_SUPP_CHANNELS = 36,
+	MFIE_TYPE_CSA = 37,
+	MFIE_TYPE_MEASURE_REQUEST = 38,
+	MFIE_TYPE_MEASURE_REPORT = 39,
+	MFIE_TYPE_QUIET = 40,
+	MFIE_TYPE_IBSS_DFS = 41,
+	MFIE_TYPE_ERP = 42,
+	MFIE_TYPE_RSN = 48,
+	MFIE_TYPE_RATES_EX = 50,
+	MFIE_TYPE_HT_CAP= 45,
 	 MFIE_TYPE_HT_INFO= 61,
 	 MFIE_TYPE_AIRONET=133,
-        MFIE_TYPE_GENERIC = 221,
-        MFIE_TYPE_QOS_PARAMETER = 222,
+	MFIE_TYPE_GENERIC = 221,
+	MFIE_TYPE_QOS_PARAMETER = 222,
 };
 
 /* Minimal header; can be used for passing 802.11 frames with sufficient
  * information to determine what type of underlying data type is actually
  * stored in the data. */
 struct ieee80211_hdr {
-        __le16 frame_ctl;
-        __le16 duration_id;
-        u8 payload[0];
+	__le16 frame_ctl;
+	__le16 duration_id;
+	u8 payload[0];
 } __attribute__ ((packed));
 
 struct ieee80211_hdr_1addr {
-        __le16 frame_ctl;
-        __le16 duration_id;
-        u8 addr1[ETH_ALEN];
-        u8 payload[0];
+	__le16 frame_ctl;
+	__le16 duration_id;
+	u8 addr1[ETH_ALEN];
+	u8 payload[0];
 } __attribute__ ((packed));
 
 struct ieee80211_hdr_2addr {
-        __le16 frame_ctl;
-        __le16 duration_id;
-        u8 addr1[ETH_ALEN];
-        u8 addr2[ETH_ALEN];
-        u8 payload[0];
+	__le16 frame_ctl;
+	__le16 duration_id;
+	u8 addr1[ETH_ALEN];
+	u8 addr2[ETH_ALEN];
+	u8 payload[0];
 } __attribute__ ((packed));
 
 struct ieee80211_hdr_3addr {
@@ -1152,7 +1152,7 @@ struct ieee80211_hdr_3addr {
 	u8 addr2[ETH_ALEN];
 	u8 addr3[ETH_ALEN];
 	__le16 seq_ctl;
-        u8 payload[0];
+	u8 payload[0];
 } __attribute__ ((packed));
 
 struct ieee80211_hdr_4addr {
@@ -1163,7 +1163,7 @@ struct ieee80211_hdr_4addr {
 	u8 addr3[ETH_ALEN];
 	__le16 seq_ctl;
 	u8 addr4[ETH_ALEN];
-        u8 payload[0];
+	u8 payload[0];
 } __attribute__ ((packed));
 
 struct ieee80211_hdr_3addrqos {
@@ -1173,7 +1173,7 @@ struct ieee80211_hdr_3addrqos {
 	u8 addr2[ETH_ALEN];
 	u8 addr3[ETH_ALEN];
 	__le16 seq_ctl;
-        u8 payload[0];
+	u8 payload[0];
 	__le16 qos_ctl;
 } __attribute__ ((packed));
 
@@ -1185,7 +1185,7 @@ struct ieee80211_hdr_4addrqos {
 	u8 addr3[ETH_ALEN];
 	__le16 seq_ctl;
 	u8 addr4[ETH_ALEN];
-        u8 payload[0];
+	u8 payload[0];
 	__le16 qos_ctl;
 } __attribute__ ((packed));
 
@@ -1205,14 +1205,14 @@ struct ieee80211_authentication {
 } __attribute__ ((packed));
 
 struct ieee80211_disassoc {
-        struct ieee80211_hdr_3addr header;
-        __le16 reason;
+	struct ieee80211_hdr_3addr header;
+	__le16 reason;
 } __attribute__ ((packed));
 
 struct ieee80211_probe_request {
 	struct ieee80211_hdr_3addr header;
 	/* SSID, supported rates */
-        struct ieee80211_info_element info_element[0];
+	struct ieee80211_info_element info_element[0];
 } __attribute__ ((packed));
 
 struct ieee80211_probe_response {
@@ -1220,9 +1220,9 @@ struct ieee80211_probe_response {
 	u32 time_stamp[2];
 	__le16 beacon_interval;
 	__le16 capability;
-        /* SSID, supported rates, FH params, DS params,
-         * CF params, IBSS params, TIM (if beacon), RSN */
-        struct ieee80211_info_element info_element[0];
+	/* SSID, supported rates, FH params, DS params,
+	 * CF params, IBSS params, TIM (if beacon), RSN */
+	struct ieee80211_info_element info_element[0];
 } __attribute__ ((packed));
 
 /* Alias beacon for probe_response */
@@ -1233,7 +1233,7 @@ struct ieee80211_assoc_request_frame {
 	__le16 capability;
 	__le16 listen_interval;
 	/* SSID, supported rates, RSN */
-        struct ieee80211_info_element info_element[0];
+	struct ieee80211_info_element info_element[0];
 } __attribute__ ((packed));
 
 struct ieee80211_reassoc_request_frame {
@@ -1242,7 +1242,7 @@ struct ieee80211_reassoc_request_frame {
 	__le16 listen_interval;
 	u8 current_ap[ETH_ALEN];
 	/* SSID, supported rates, RSN */
-        struct ieee80211_info_element info_element[0];
+	struct ieee80211_info_element info_element[0];
 } __attribute__ ((packed));
 
 struct ieee80211_assoc_response_frame {
@@ -1318,7 +1318,7 @@ typedef union _frameqos {
 #define NETWORK_HAS_QOS_PARAMETERS      (1<<3)
 #define NETWORK_HAS_QOS_INFORMATION     (1<<4)
 #define NETWORK_HAS_QOS_MASK            (NETWORK_HAS_QOS_PARAMETERS | \
-                                         NETWORK_HAS_QOS_INFORMATION)
+					 NETWORK_HAS_QOS_INFORMATION)
 /* 802.11h */
 #define NETWORK_HAS_POWER_CONSTRAINT    (1<<5)
 #define NETWORK_HAS_CSA                 (1<<6)
@@ -1338,46 +1338,46 @@ typedef union _frameqos {
 #define QOS_AIFSN_MIN_VALUE             2
 #if 1
 struct ieee80211_qos_information_element {
-        u8 elementID;
-        u8 length;
-        u8 qui[QOS_OUI_LEN];
-        u8 qui_type;
-        u8 qui_subtype;
-        u8 version;
-        u8 ac_info;
+	u8 elementID;
+	u8 length;
+	u8 qui[QOS_OUI_LEN];
+	u8 qui_type;
+	u8 qui_subtype;
+	u8 version;
+	u8 ac_info;
 } __attribute__ ((packed));
 
 struct ieee80211_qos_ac_parameter {
-        u8 aci_aifsn;
-        u8 ecw_min_max;
-        __le16 tx_op_limit;
+	u8 aci_aifsn;
+	u8 ecw_min_max;
+	__le16 tx_op_limit;
 } __attribute__ ((packed));
 
 struct ieee80211_qos_parameter_info {
-        struct ieee80211_qos_information_element info_element;
-        u8 reserved;
-        struct ieee80211_qos_ac_parameter ac_params_record[QOS_QUEUE_NUM];
+	struct ieee80211_qos_information_element info_element;
+	u8 reserved;
+	struct ieee80211_qos_ac_parameter ac_params_record[QOS_QUEUE_NUM];
 } __attribute__ ((packed));
 
 struct ieee80211_qos_parameters {
-        __le16 cw_min[QOS_QUEUE_NUM];
-        __le16 cw_max[QOS_QUEUE_NUM];
-        u8 aifs[QOS_QUEUE_NUM];
-        u8 flag[QOS_QUEUE_NUM];
-        __le16 tx_op_limit[QOS_QUEUE_NUM];
+	__le16 cw_min[QOS_QUEUE_NUM];
+	__le16 cw_max[QOS_QUEUE_NUM];
+	u8 aifs[QOS_QUEUE_NUM];
+	u8 flag[QOS_QUEUE_NUM];
+	__le16 tx_op_limit[QOS_QUEUE_NUM];
 } __attribute__ ((packed));
 
 struct ieee80211_qos_data {
-        struct ieee80211_qos_parameters parameters;
-        int active;
-        int supported;
-        u8 param_count;
-        u8 old_param_count;
+	struct ieee80211_qos_parameters parameters;
+	int active;
+	int supported;
+	u8 param_count;
+	u8 old_param_count;
 };
 
 struct ieee80211_tim_parameters {
-        u8 tim_count;
-        u8 tim_period;
+	u8 tim_count;
+	u8 tim_period;
 } __attribute__ ((packed));
 
 //#else
@@ -1533,14 +1533,14 @@ enum {WMM_all_frame, WMM_two_frame, WMM_four_frame, WMM_six_frame};
 #define MAX_RECEIVE_BUFFER_SIZE 9100
 
 //UP Mapping to AC, using in MgntQuery_SequenceNumber() and maybe for DSCP
-//#define UP2AC(up)	((up<3) ? ((up==0)?1:0) : (up>>1)) 
+//#define UP2AC(up)	((up<3) ? ((up==0)?1:0) : (up>>1))
 #if 1
 #define UP2AC(up) (		   \
 	((up) < 1) ? WME_AC_BE : \
 	((up) < 3) ? WME_AC_BK : \
 	((up) < 4) ? WME_AC_BE : \
 	((up) < 6) ? WME_AC_VI : \
-	WME_AC_VO)	
+	WME_AC_VO)
 #endif
 //AC Mapping to UP, using in Tx part for selecting the corresponding TX queue
 #define AC2UP(_ac)	(       \
@@ -1556,7 +1556,7 @@ struct	ether_header {
 	u8 ether_dhost[ETHER_ADDR_LEN];
 	u8 ether_shost[ETHER_ADDR_LEN];
 	u16 ether_type;
-} __attribute__((packed)); 
+} __attribute__((packed));
 
 #ifndef ETHERTYPE_PAE
 #define	ETHERTYPE_PAE	0x888e		/* EAPOL PAE/802.1x */
@@ -1598,10 +1598,10 @@ struct ieee80211_network {
 	u8 ssid[IW_ESSID_MAX_SIZE + 1];
 	u8 ssid_len;
 #if 1
-        struct ieee80211_qos_data qos_data;
+	struct ieee80211_qos_data qos_data;
 #else
        // Qos related. Added by Annie, 2005-11-01.
-        BSS_QOS   BssQos;
+	BSS_QOS   BssQos;
 #endif
 	//added by amy for LEAP
 	bool	bWithAironetIE;
@@ -1636,15 +1636,15 @@ struct ieee80211_network {
 	u8  rsn_ie[MAX_WPA_IE_LEN];
 	size_t rsn_ie_len;
 
-        struct ieee80211_tim_parameters tim;
+	struct ieee80211_tim_parameters tim;
 	u8  dtim_period;
 	u8  dtim_data;
 	u32 last_dtim_sta_time[2];
 
-        //appeded for QoS
-        u8 wmm_info;
-        struct ieee80211_wmm_ac_param wmm_param[4];
-        u8 QoS_Enable;
+	//appeded for QoS
+	u8 wmm_info;
+	struct ieee80211_wmm_ac_param wmm_param[4];
+	u8 QoS_Enable;
 #ifdef THOMAS_TURBO
 	u8 Turbo_Enable;//enable turbo mode, added by thomas
 #endif
@@ -1652,7 +1652,7 @@ struct ieee80211_network {
 	u16 CountryIeLen;
 	u8 CountryIeBuf[MAX_IE_LEN];
 #endif
-        // HT Related, by amy, 2008.04.29
+	// HT Related, by amy, 2008.04.29
 	BSS_HT	bssht;
 	// Add to handle broadcom AP management frame CCK rate.
 	bool broadcom_cap_exist;
@@ -1672,7 +1672,7 @@ enum ieee80211_state {
 
 	/* the card is not linked at all */
 	IEEE80211_NOLINK = 0,
-	
+
 	/* IEEE80211_ASSOCIATING* are for BSS client mode
 	 * the driver shall not perform RX filtering unless
 	 * the state is LINKED.
@@ -1680,41 +1680,41 @@ enum ieee80211_state {
 	 * defaults to NOLINK for ALL the other states (including
 	 * LINKED_SCANNING)
 	 */
-	
+
 	/* the association procedure will start (wq scheduling)*/
 	IEEE80211_ASSOCIATING,
 	IEEE80211_ASSOCIATING_RETRY,
-	
+
 	/* the association procedure is sending AUTH request*/
 	IEEE80211_ASSOCIATING_AUTHENTICATING,
-	
+
 	/* the association procedure has successfully authentcated
 	 * and is sending association request
 	 */
 	IEEE80211_ASSOCIATING_AUTHENTICATED,
-	
+
 	/* the link is ok. the card associated to a BSS or linked
 	 * to a ibss cell or acting as an AP and creating the bss
 	 */
 	IEEE80211_LINKED,
-	
+
 	/* same as LINKED, but the driver shall apply RX filter
 	 * rules as we are in NO_LINK mode. As the card is still
 	 * logically linked, but it is doing a syncro site survey
 	 * then it will be back to LINKED state.
 	 */
 	IEEE80211_LINKED_SCANNING,
-	
+
 };
 #else
 enum ieee80211_state {
-        IEEE80211_UNINITIALIZED = 0,
-        IEEE80211_INITIALIZED,
-        IEEE80211_ASSOCIATING,
-        IEEE80211_ASSOCIATED,
-        IEEE80211_AUTHENTICATING,
-        IEEE80211_AUTHENTICATED,
-        IEEE80211_SHUTDOWN
+	IEEE80211_UNINITIALIZED = 0,
+	IEEE80211_INITIALIZED,
+	IEEE80211_ASSOCIATING,
+	IEEE80211_ASSOCIATED,
+	IEEE80211_AUTHENTICATING,
+	IEEE80211_AUTHENTICATED,
+	IEEE80211_SHUTDOWN
 };
 #endif
 
@@ -1728,17 +1728,17 @@ enum ieee80211_state {
 #define IEEE80211_24GHZ_MIN_CHANNEL 1
 #define IEEE80211_24GHZ_MAX_CHANNEL 14
 #define IEEE80211_24GHZ_CHANNELS (IEEE80211_24GHZ_MAX_CHANNEL - \
-                                  IEEE80211_24GHZ_MIN_CHANNEL + 1)
+				  IEEE80211_24GHZ_MIN_CHANNEL + 1)
 
 #define IEEE80211_52GHZ_MIN_CHANNEL 34
 #define IEEE80211_52GHZ_MAX_CHANNEL 165
 #define IEEE80211_52GHZ_CHANNELS (IEEE80211_52GHZ_MAX_CHANNEL - \
-                                  IEEE80211_52GHZ_MIN_CHANNEL + 1)
+				  IEEE80211_52GHZ_MIN_CHANNEL + 1)
 
 #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,11))
 extern inline int is_multicast_ether_addr(const u8 *addr)
 {
-        return ((addr[0] != 0xff) && (0x01 & addr[0]));
+	return ((addr[0] != 0xff) && (0x01 & addr[0]));
 }
 #endif
 
@@ -1758,9 +1758,9 @@ typedef struct tx_pending_t{
 typedef struct _bandwidth_autoswitch
 {
 	long threshold_20Mhzto40Mhz;
-	long	threshold_40Mhzto20Mhz;	
+	long	threshold_40Mhzto20Mhz;
 	bool bforced_tx20Mhz;
-	bool bautoswitch_enable;	
+	bool bautoswitch_enable;
 }bandwidth_autoswitch,*pbandwidth_autoswitch;
 
 
@@ -1779,10 +1779,10 @@ typedef enum _Fsync_State{
 	Default_Fsync,
 	HW_Fsync,
 	SW_Fsync
-}Fsync_State;	
+}Fsync_State;
 
-// Power save mode configured. 
-typedef	enum _RT_PS_MODE	
+// Power save mode configured.
+typedef	enum _RT_PS_MODE
 {
 	eActive,	// Active/Continuous access.
 	eMaxPs,		// Max power save mode.
@@ -1835,7 +1835,7 @@ typedef struct _RT_POWER_SAVE_CONTROL
 
 	// Return point for join action
 	IPS_CALLBACK_FUNCION	ReturnPoint;
-	
+
 	// Recored Parameters for rescheduled JoinRequest
 	bool				bTmpBssDesc;
 	RT_JOIN_ACTION		tmpJoinAction;
@@ -1862,9 +1862,9 @@ typedef struct _RT_POWER_SAVE_CONTROL
 
 	//
 	// Leisre Poswer Save : Disable RF if connected but traffic is not busy
-	//		
+	//
 	bool				bLeisurePs;
-	
+
 }RT_POWER_SAVE_CONTROL,*PRT_POWER_SAVE_CONTROL;
 
 typedef u32 RT_RF_CHANGE_SOURCE;
@@ -1875,7 +1875,7 @@ typedef u32 RT_RF_CHANGE_SOURCE;
 #define RF_CHANGE_BY_INIT	0	// Do not change the RFOff reason. Defined by Bruce, 2008-01-17.
 
 #ifdef ENABLE_DOT11D
-typedef enum 
+typedef enum
 {
 	COUNTRY_CODE_FCC = 0,
 	COUNTRY_CODE_IC = 1,
@@ -1888,7 +1888,7 @@ typedef enum
 	COUNTRY_CODE_TELEC,
 	COUNTRY_CODE_MIC,
 	COUNTRY_CODE_GLOBAL_DOMAIN
-}country_code_type_t;	
+}country_code_type_t;
 #endif
 
 #define RT_MAX_LD_SLOT_NUM	10
@@ -1910,13 +1910,13 @@ typedef struct _RT_LINK_DETECT_T{
 
 struct ieee80211_device {
 	struct net_device *dev;
-        struct ieee80211_security sec;
+	struct ieee80211_security sec;
 
 	//hw security related
 //	u8 hwsec_support; //support?
 	u8 hwsec_active;  //hw security active.
 	bool is_silent_reset;
-	bool ieee_up;	
+	bool ieee_up;
 	//added by amy
 	bool bSupportRemoteWakeUp;
 	RT_PS_MODE	dot11PowerSaveMode; // Power save mode configured.
@@ -1926,7 +1926,7 @@ struct ieee80211_device {
 	RT_RF_CHANGE_SOURCE	RfOffReason;
 	bool is_set_key;
 	//11n spec related I wonder if These info structure need to be moved out of ieee80211_device
-	
+
 	//11n HT below
 	PRT_HIGH_THROUGHPUT	pHTInfo;
 	//struct timer_list		SwBwTimer;
@@ -1966,13 +1966,13 @@ struct ieee80211_device {
 	// Qos related. Added by Annie, 2005-11-01.
 //	PSTA_QOS			pStaQos;
 	u8				ForcedPriority;		// Force per-packet priority 1~7. (default: 0, not to force it.)
-	
+
 
 	/* Bookkeeping structures */
 	struct net_device_stats stats;
 	struct ieee80211_stats ieee_stats;
 	struct ieee80211_softmac_stats softmac_stats;
-	
+
 	/* Probe / Beacon management */
 	struct list_head network_free_list;
 	struct list_head network_list;
@@ -1981,11 +1981,11 @@ struct ieee80211_device {
 	int scan_age;
 
 	int iw_mode; /* operating mode (IW_MODE_*) */
-	struct iw_spy_data spy_data; 
+	struct iw_spy_data spy_data;
 
 	spinlock_t lock;
 	spinlock_t wpax_suitlist_lock;
-	
+
 	int tx_headroom; /* Set to size of any additional room needed at front
 			  * of allocated Tx SKBs */
 	u32 config;
@@ -2000,15 +2000,15 @@ struct ieee80211_device {
 	int host_encrypt;
 	int host_encrypt_msdu;
 	int host_decrypt;
-        /* host performs multicast decryption */
-        int host_mc_decrypt;
+	/* host performs multicast decryption */
+	int host_mc_decrypt;
 
-        /* host should strip IV and ICV from protected frames */
-        /* meaningful only when hardware decryption is being used */
-        int host_strip_iv_icv;
+	/* host should strip IV and ICV from protected frames */
+	/* meaningful only when hardware decryption is being used */
+	int host_strip_iv_icv;
 
-        int host_open_frag;
-        int host_build_iv;
+	int host_open_frag;
+	int host_build_iv;
 	int ieee802_1x; /* is IEEE 802.1X used */
 
 	/* WPA data */
@@ -2026,7 +2026,7 @@ struct ieee80211_device {
 	struct ieee80211_crypt_data *crypt[WEP_KEYS];
 	int tx_keyidx; /* default TX key index (crypt[tx_keyidx]) */
 	struct timer_list crypt_deinit_timer;
-        int crypt_quiesced;
+	int crypt_quiesced;
 
 	int bcrx_sta_key; /* use individual keys to override default keys even
 			   * with RX of broad/multicast frames */
@@ -2039,10 +2039,10 @@ struct ieee80211_device {
 #define DEFAULT_RTS_THRESHOLD 2346U
 #define MIN_RTS_THRESHOLD 1
 #define MAX_RTS_THRESHOLD 2346U
-        u16 rts; /* RTS threshold */
+	u16 rts; /* RTS threshold */
 
-        /* Association info */
-        u8 bssid[ETH_ALEN];
+	/* Association info */
+	u8 bssid[ETH_ALEN];
 
 	/* This stores infos for the current network.
 	 * Either the network we are associated in INFRASTRUCTURE
@@ -2050,7 +2050,7 @@ struct ieee80211_device {
 	 * ad-hoc is a mixture ;-).
 	 * Note that in infrastructure mode, even when not associated,
 	 * fields bssid and essid may be valid (if wpa_set and essid_set
-	 * are true) as thy carry the value set by the user via iwconfig  
+	 * are true) as thy carry the value set by the user via iwconfig
 	 */
 	struct ieee80211_network current_network;
 
@@ -2062,16 +2062,16 @@ struct ieee80211_device {
 	int modulation; /* CCK, OFDM */
 	int freq_band;  /* 2.4Ghz, 5.2Ghz, Mixed */
 	int abg_true;   /* ABG flag              */
-	
-	/* used for forcing the ibss workqueue to terminate 
+
+	/* used for forcing the ibss workqueue to terminate
 	 * without wait for the syncro scan to terminate
 	 */
-	short sync_scan_hurryup; 
-	
-        int perfect_rssi;
-        int worst_rssi;
+	short sync_scan_hurryup;
+
+	int perfect_rssi;
+	int worst_rssi;
 
-        u16 prev_seq_ctl;       /* used to drop duplicate frames */
+	u16 prev_seq_ctl;       /* used to drop duplicate frames */
 
 	/* map of allowed channels. 0 is dummy */
 	// FIXME: remeber to default to a basic channel plan depending of the PHY type
@@ -2080,24 +2080,24 @@ struct ieee80211_device {
 	bool bGlobalDomain;
 #else
 	int channel_map[MAX_CHANNEL_NUMBER+1];
-#endif	
+#endif
 	int rate;       /* current rate */
 	int basic_rate;
 	//FIXME: pleace callback, see if redundant with softmac_features
 	short active_scan;
-	
+
 	/* this contains flags for selectively enable softmac support */
 	u16 softmac_features;
-	
+
 	/* if the sequence control field is not filled by HW */
 	u16 seq_ctrl[5];
-	
+
 	/* association procedure transaction sequence number */
 	u16 associate_seq;
-	
+
 	/* AID for RTXed association responses */
 	u16 assoc_id;
-	
+
 	/* power save mode related*/
 	short ps;
 	short sta_sleep;
@@ -2106,24 +2106,24 @@ struct ieee80211_device {
 	struct tasklet_struct ps_task;
 	u32 ps_th;
 	u32 ps_tl;
-	
+
 	short raw_tx;
 	/* used if IEEE_SOFTMAC_TX_QUEUE is set */
 	short queue_stop;
 	short scanning;
 	short proto_started;
-	
+
 	struct semaphore wx_sem;
 	struct semaphore scan_sem;
-	
-	spinlock_t mgmt_tx_lock;	
+
+	spinlock_t mgmt_tx_lock;
 	spinlock_t beacon_lock;
 
 	short beacon_txing;
 
 	short wap_set;
 	short ssid_set;
-	
+
 	u8  wpax_type_set;    //{added by David, 2006.9.28}
 	u32 wpax_type_notify; //{added by David, 2006.9.26}
 
@@ -2131,18 +2131,18 @@ struct ieee80211_device {
 	char init_wmmparam_flag;
 	/* set on initialization */
 	u8  qos_support;
-	
+
 	/* for discarding duplicated packets in IBSS */
 	struct list_head ibss_mac_hash[IEEE_IBSS_MAC_HASH_SIZE];
-	
+
 	/* for discarding duplicated packets in BSS */
 	u16 last_rxseq_num[17]; /* rx seq previous per-tid */
 	u16 last_rxfrag_num[17];/* tx frag previous per-tid */
 	unsigned long last_packet_time[17];
-	
+
 	/* for PS mode */
 	unsigned long last_rx_ps_time;
-	
+
 	/* used if IEEE_SOFTMAC_SINGLE_QUEUE is set */
 	struct sk_buff *mgmt_queue_ring[MGMT_QUEUE_NUM];
 	int mgmt_queue_head;
@@ -2152,8 +2152,8 @@ struct ieee80211_device {
 	u8 AsocRetryCount;
 	unsigned int hw_header;
 	struct sk_buff_head skb_waitQ[MAX_QUEUE_SIZE];
-	struct sk_buff_head  skb_aggQ[MAX_QUEUE_SIZE]; 
-	struct sk_buff_head  skb_drv_aggQ[MAX_QUEUE_SIZE]; 
+	struct sk_buff_head  skb_aggQ[MAX_QUEUE_SIZE];
+	struct sk_buff_head  skb_drv_aggQ[MAX_QUEUE_SIZE];
 	u32	sta_edca_param[4];
 	bool aggregation;
 	// Enable/Disable Rx immediate BA capability.
@@ -2162,17 +2162,17 @@ struct ieee80211_device {
 
 	//+by amy for DM ,080515
 	//Dynamic Tx power for near/far range enable/Disable  , by amy , 2008-05-15
-	bool	bdynamic_txpower_enable; 
+	bool	bdynamic_txpower_enable;
 
 	bool bCTSToSelfEnable;
 	u8 	CTSToSelfTH;
-	
+
 	u32 	fsync_time_interval;
 	u32	fsync_rate_bitmap;
 	u8	fsync_rssi_threshold;
 	bool	bfsync_enable;
 
-	u8	fsync_multiple_timeinterval;		// FsyncMultipleTimeInterval * FsyncTimeInterval	 
+	u8	fsync_multiple_timeinterval;		// FsyncMultipleTimeInterval * FsyncTimeInterval
 	u32	fsync_firstdiff_ratethreshold;		// low threshold
 	u32	fsync_seconddiff_ratethreshold;	 // decrease threshold
 	Fsync_State			fsync_state;
@@ -2184,31 +2184,31 @@ struct ieee80211_device {
 
 	//added by amy for AP roaming
 	RT_LINK_DETECT_T	LinkDetectInfo;
-        //added by amy for ps
+	//added by amy for ps
 	RT_POWER_SAVE_CONTROL	PowerSaveControl;
-//}	
+//}
 	/* used if IEEE_SOFTMAC_TX_QUEUE is set */
 	struct  tx_pending_t tx_pending;
-	
+
 	/* used if IEEE_SOFTMAC_ASSOCIATE is set */
 	struct timer_list associate_timer;
 
 	/* used if IEEE_SOFTMAC_BEACONS is set */
 	struct timer_list beacon_timer;
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)  
-        struct work_struct associate_complete_wq;
-        struct work_struct associate_procedure_wq;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)        
-        struct delayed_work softmac_scan_wq;
-        struct delayed_work associate_retry_wq;
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
+	struct work_struct associate_complete_wq;
+	struct work_struct associate_procedure_wq;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
+	struct delayed_work softmac_scan_wq;
+	struct delayed_work associate_retry_wq;
 	 struct delayed_work start_ibss_wq;
 #else
-        struct work_struct softmac_scan_wq;
-        struct work_struct associate_retry_wq;
+	struct work_struct softmac_scan_wq;
+	struct work_struct associate_retry_wq;
 	struct work_struct start_ibss_wq;
 #endif
-        struct work_struct wx_sync_scan_wq;
-        struct workqueue_struct *wq;
+	struct work_struct wx_sync_scan_wq;
+	struct workqueue_struct *wq;
 #else
 	/* used for periodly scan */
 	struct timer_list scan_timer;
@@ -2221,100 +2221,100 @@ struct ieee80211_device {
 	struct tq_struct wx_sync_scan_wq;
 
 #endif
-        // Qos related. Added by Annie, 2005-11-01.
-        //STA_QOS  StaQos;
+	// Qos related. Added by Annie, 2005-11-01.
+	//STA_QOS  StaQos;
 
-        //u32 STA_EDCA_PARAM[4];
+	//u32 STA_EDCA_PARAM[4];
 	//CHANNEL_ACCESS_SETTING ChannelAccessSetting;
 
 
 	/* Callback functions */
 	void (*set_security)(struct net_device *dev,
 			     struct ieee80211_security *sec);
-	
+
 	/* Used to TX data frame by using txb structs.
 	 * this is not used if in the softmac_features
 	 * is set the flag IEEE_SOFTMAC_TX_QUEUE
 	 */
 	int (*hard_start_xmit)(struct ieee80211_txb *txb,
 			       struct net_device *dev);
-	
+
 	int (*reset_port)(struct net_device *dev);
-        int (*is_queue_full) (struct net_device * dev, int pri);
+	int (*is_queue_full) (struct net_device * dev, int pri);
 
-        int (*handle_management) (struct net_device * dev,
-                                  struct ieee80211_network * network, u16 type);
-        int (*is_qos_active) (struct net_device *dev, struct sk_buff *skb);
+	int (*handle_management) (struct net_device * dev,
+				  struct ieee80211_network * network, u16 type);
+	int (*is_qos_active) (struct net_device *dev, struct sk_buff *skb);
 
-	/* Softmac-generated frames (mamagement) are TXed via this 
-	 * callback if the flag IEEE_SOFTMAC_SINGLE_QUEUE is 
-	 * not set. As some cards may have different HW queues that 
+	/* Softmac-generated frames (mamagement) are TXed via this
+	 * callback if the flag IEEE_SOFTMAC_SINGLE_QUEUE is
+	 * not set. As some cards may have different HW queues that
 	 * one might want to use for data and management frames
 	 * the option to have two callbacks might be useful.
 	 * This fucntion can't sleep.
 	 */
 	int (*softmac_hard_start_xmit)(struct sk_buff *skb,
 			       struct net_device *dev);
-	
+
 	/* used instead of hard_start_xmit (not softmac_hard_start_xmit)
 	 * if the IEEE_SOFTMAC_TX_QUEUE feature is used to TX data
 	 * frames. I the option IEEE_SOFTMAC_SINGLE_QUEUE is also set
 	 * then also management frames are sent via this callback.
 	 * This function can't sleep.
-	 */    
+	 */
 	void (*softmac_data_hard_start_xmit)(struct sk_buff *skb,
 			       struct net_device *dev,int rate);
 
 	/* stops the HW queue for DATA frames. Useful to avoid
 	 * waste time to TX data frame when we are reassociating
 	 * This function can sleep.
-	 */	 
+	 */
 	void (*data_hard_stop)(struct net_device *dev);
-	
+
 	/* OK this is complementar to data_poll_hard_stop */
 	void (*data_hard_resume)(struct net_device *dev);
-	
+
 	/* ask to the driver to retune the radio .
 	 * This function can sleep. the driver should ensure
 	 * the radio has been swithced before return.
 	 */
 	void (*set_chan)(struct net_device *dev,short ch);
-	
+
 	/* These are not used if the ieee stack takes care of
-	 * scanning (IEEE_SOFTMAC_SCAN feature set). 
+	 * scanning (IEEE_SOFTMAC_SCAN feature set).
 	 * In this case only the set_chan is used.
 	 *
 	 * The syncro version is similar to the start_scan but
 	 * does not return until all channels has been scanned.
-	 * this is called in user context and should sleep, 
+	 * this is called in user context and should sleep,
 	 * it is called in a work_queue when swithcing to ad-hoc mode
-	 * or in behalf of iwlist scan when the card is associated 
-	 * and root user ask for a scan. 
+	 * or in behalf of iwlist scan when the card is associated
+	 * and root user ask for a scan.
 	 * the fucntion stop_scan should stop both the syncro and
 	 * background scanning and can sleep.
-	 * The fucntion start_scan should initiate the background 
+	 * The fucntion start_scan should initiate the background
 	 * scanning and can't sleep.
-	 */ 
+	 */
 	void (*scan_syncro)(struct net_device *dev);
 	void (*start_scan)(struct net_device *dev);
 	void (*stop_scan)(struct net_device *dev);
-	
+
 	/* indicate the driver that the link state is changed
 	 * for example it may indicate the card is associated now.
-	 * Driver might be interested in this to apply RX filter 
-	 * rules or simply light the LINK led 
+	 * Driver might be interested in this to apply RX filter
+	 * rules or simply light the LINK led
 	 */
 	void (*link_change)(struct net_device *dev);
-	
+
 	/* these two function indicates to the HW when to start
-	 * and stop to send beacons. This is used when the 
+	 * and stop to send beacons. This is used when the
 	 * IEEE_SOFTMAC_BEACONS is not set. For now the
 	 * stop_send_bacons is NOT guaranteed to be called only
 	 * after start_send_beacons.
 	 */
 	void (*start_send_beacons) (struct net_device *dev,u16 tx_rate);
 	void (*stop_send_beacons) (struct net_device *dev);
-	
+
 	/* power save mode related */
 	void (*sta_wake_up) (struct net_device *dev);
 	void (*ps_request_tx_ack) (struct net_device *dev);
@@ -2322,32 +2322,32 @@ struct ieee80211_device {
 	short (*ps_is_queue_empty) (struct net_device *dev);
 #if 0
 	/* Typical STA methods */
-        int (*handle_auth) (struct net_device * dev,
-                            struct ieee80211_auth * auth);
-        int (*handle_deauth) (struct net_device * dev,
-                              struct ieee80211_deauth * auth);
-        int (*handle_action) (struct net_device * dev,
-                              struct ieee80211_action * action,
-                              struct ieee80211_rx_stats * stats);
-        int (*handle_disassoc) (struct net_device * dev,
-                                struct ieee80211_disassoc * assoc);
+	int (*handle_auth) (struct net_device * dev,
+			    struct ieee80211_auth * auth);
+	int (*handle_deauth) (struct net_device * dev,
+			      struct ieee80211_deauth * auth);
+	int (*handle_action) (struct net_device * dev,
+			      struct ieee80211_action * action,
+			      struct ieee80211_rx_stats * stats);
+	int (*handle_disassoc) (struct net_device * dev,
+				struct ieee80211_disassoc * assoc);
 #endif
-        int (*handle_beacon) (struct net_device * dev, struct ieee80211_beacon * beacon, struct ieee80211_network * network);
+	int (*handle_beacon) (struct net_device * dev, struct ieee80211_beacon * beacon, struct ieee80211_network * network);
 #if 0
-        int (*handle_probe_response) (struct net_device * dev,
-                                      struct ieee80211_probe_response * resp,
-                                      struct ieee80211_network * network);
-        int (*handle_probe_request) (struct net_device * dev,
-                                     struct ieee80211_probe_request * req,
-                                     struct ieee80211_rx_stats * stats);
+	int (*handle_probe_response) (struct net_device * dev,
+				      struct ieee80211_probe_response * resp,
+				      struct ieee80211_network * network);
+	int (*handle_probe_request) (struct net_device * dev,
+				     struct ieee80211_probe_request * req,
+				     struct ieee80211_rx_stats * stats);
 #endif
-        int (*handle_assoc_response) (struct net_device * dev, struct ieee80211_assoc_response_frame * resp, struct ieee80211_network * network);
+	int (*handle_assoc_response) (struct net_device * dev, struct ieee80211_assoc_response_frame * resp, struct ieee80211_network * network);
 
 #if 0
-        /* Typical AP methods */
-        int (*handle_assoc_request) (struct net_device * dev);
-        int (*handle_reassoc_request) (struct net_device * dev,
-                                       struct ieee80211_reassoc_request * req);
+	/* Typical AP methods */
+	int (*handle_assoc_request) (struct net_device * dev);
+	int (*handle_reassoc_request) (struct net_device * dev,
+				       struct ieee80211_reassoc_request * req);
 #endif
 
 	/* check whether Tx hw resouce available */
@@ -2358,7 +2358,7 @@ struct ieee80211_device {
 //	void (*UpdateHalRATRTableHandler)(struct net_device* dev, u8* pMcsRate);
 	bool (*GetNmodeSupportBySecCfg)(struct net_device* dev);
 	void (*SetWirelessMode)(struct net_device* dev, u8 wireless_mode);
-	bool (*GetHalfNmodeSupportByAPsHandler)(struct net_device* dev); 
+	bool (*GetHalfNmodeSupportByAPsHandler)(struct net_device* dev);
 	void (*InitialGainHandler)(struct net_device *dev, u8 Operation);
 
 	/* This must be the last item so that it points to the data
@@ -2400,13 +2400,13 @@ struct ieee80211_device {
 #define IEEE_SOFTMAC_SINGLE_QUEUE (1<<8)
 
 /* Generate beacons.  The stack will enqueue beacons
- * to the card 
- */ 
+ * to the card
+ */
 #define IEEE_SOFTMAC_BEACONS (1<<6)
 
 static inline void *ieee80211_priv(struct net_device *dev)
 {
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) 
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
 	return ((struct ieee80211_device *)netdev_priv(dev))->priv;
 #else
 	return ((struct ieee80211_device *)dev->priv)->priv;
@@ -2484,45 +2484,45 @@ extern inline int ieee80211_get_hdrlen(u16 fc)
 
 static inline u8 *ieee80211_get_payload(struct ieee80211_hdr *hdr)
 {
-        switch (ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl))) {
-        case IEEE80211_1ADDR_LEN:
-                return ((struct ieee80211_hdr_1addr *)hdr)->payload;
-        case IEEE80211_2ADDR_LEN:
-                return ((struct ieee80211_hdr_2addr *)hdr)->payload;
-        case IEEE80211_3ADDR_LEN:
-                return ((struct ieee80211_hdr_3addr *)hdr)->payload;
-        case IEEE80211_4ADDR_LEN:
-                return ((struct ieee80211_hdr_4addr *)hdr)->payload;
-        }
-        return NULL;
+	switch (ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl))) {
+	case IEEE80211_1ADDR_LEN:
+		return ((struct ieee80211_hdr_1addr *)hdr)->payload;
+	case IEEE80211_2ADDR_LEN:
+		return ((struct ieee80211_hdr_2addr *)hdr)->payload;
+	case IEEE80211_3ADDR_LEN:
+		return ((struct ieee80211_hdr_3addr *)hdr)->payload;
+	case IEEE80211_4ADDR_LEN:
+		return ((struct ieee80211_hdr_4addr *)hdr)->payload;
+	}
+	return NULL;
 }
 
 static inline int ieee80211_is_ofdm_rate(u8 rate)
 {
-        switch (rate & ~IEEE80211_BASIC_RATE_MASK) {
-        case IEEE80211_OFDM_RATE_6MB:
-        case IEEE80211_OFDM_RATE_9MB:
-        case IEEE80211_OFDM_RATE_12MB:
-        case IEEE80211_OFDM_RATE_18MB:
-        case IEEE80211_OFDM_RATE_24MB:
-        case IEEE80211_OFDM_RATE_36MB:
-        case IEEE80211_OFDM_RATE_48MB:
-        case IEEE80211_OFDM_RATE_54MB:
-                return 1;
-        }
-        return 0;
+	switch (rate & ~IEEE80211_BASIC_RATE_MASK) {
+	case IEEE80211_OFDM_RATE_6MB:
+	case IEEE80211_OFDM_RATE_9MB:
+	case IEEE80211_OFDM_RATE_12MB:
+	case IEEE80211_OFDM_RATE_18MB:
+	case IEEE80211_OFDM_RATE_24MB:
+	case IEEE80211_OFDM_RATE_36MB:
+	case IEEE80211_OFDM_RATE_48MB:
+	case IEEE80211_OFDM_RATE_54MB:
+		return 1;
+	}
+	return 0;
 }
 
 static inline int ieee80211_is_cck_rate(u8 rate)
 {
-        switch (rate & ~IEEE80211_BASIC_RATE_MASK) {
-        case IEEE80211_CCK_RATE_1MB:
-        case IEEE80211_CCK_RATE_2MB:
-        case IEEE80211_CCK_RATE_5MB:
-        case IEEE80211_CCK_RATE_11MB:
-                return 1;
-        }
-        return 0;
+	switch (rate & ~IEEE80211_BASIC_RATE_MASK) {
+	case IEEE80211_CCK_RATE_1MB:
+	case IEEE80211_CCK_RATE_2MB:
+	case IEEE80211_CCK_RATE_5MB:
+	case IEEE80211_CCK_RATE_11MB:
+		return 1;
+	}
+	return 0;
 }
 
 
@@ -2538,7 +2538,7 @@ extern int ieee80211_encrypt_fragment(
 	struct ieee80211_device *ieee,
 	struct sk_buff *frag,
 	int hdr_len);
-	
+
 extern int ieee80211_xmit(struct sk_buff *skb,
 			  struct net_device *dev);
 extern void ieee80211_txb_free(struct ieee80211_txb *);
@@ -2563,17 +2563,17 @@ extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
 				   union iwreq_data *wrqu, char *key);
 #if WIRELESS_EXT >= 18
 extern int ieee80211_wx_get_encode_ext(struct ieee80211_device *ieee,
-                            struct iw_request_info *info,
-                            union iwreq_data* wrqu, char *extra);
+			    struct iw_request_info *info,
+			    union iwreq_data* wrqu, char *extra);
 extern int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee,
-                            struct iw_request_info *info,
-                            union iwreq_data* wrqu, char *extra);
+			    struct iw_request_info *info,
+			    union iwreq_data* wrqu, char *extra);
 extern int ieee80211_wx_set_auth(struct ieee80211_device *ieee,
-                               struct iw_request_info *info,
-                               struct iw_param *data, char *extra);
+			       struct iw_request_info *info,
+			       struct iw_param *data, char *extra);
 extern int ieee80211_wx_set_mlme(struct ieee80211_device *ieee,
-                               struct iw_request_info *info,
-                               union iwreq_data *wrqu, char *extra);
+			       struct iw_request_info *info,
+			       union iwreq_data *wrqu, char *extra);
 #endif
 extern int ieee80211_wx_set_gen_ie(struct ieee80211_device *ieee, u8 *ie, size_t len);
 
@@ -2624,35 +2624,35 @@ extern void ieee80211_ccmp_null(void);
 
 /* ieee80211_softmac_wx.c */
 
-extern int ieee80211_wx_get_wap(struct ieee80211_device *ieee, 
-			    struct iw_request_info *info, 
+extern int ieee80211_wx_get_wap(struct ieee80211_device *ieee,
+			    struct iw_request_info *info,
 			    union iwreq_data *wrqu, char *ext);
-			    
+
 extern int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
 			 struct iw_request_info *info,
 			 union iwreq_data *awrq,
 			 char *extra);
-			 
+
 extern int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
 
-extern int ieee80211_wx_set_rate(struct ieee80211_device *ieee, 
+extern int ieee80211_wx_set_rate(struct ieee80211_device *ieee,
 			     struct iw_request_info *info,
 			     union iwreq_data *wrqu, char *extra);
-			     
-extern int ieee80211_wx_get_rate(struct ieee80211_device *ieee, 
-			     struct iw_request_info *info, 
+
+extern int ieee80211_wx_get_rate(struct ieee80211_device *ieee,
+			     struct iw_request_info *info,
 			     union iwreq_data *wrqu, char *extra);
-			     
+
 extern int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
 			     union iwreq_data *wrqu, char *b);
-			     
+
 extern int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a,
 			     union iwreq_data *wrqu, char *b);
-			     
-extern int ieee80211_wx_set_essid(struct ieee80211_device *ieee, 
+
+extern int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
 			      struct iw_request_info *a,
 			      union iwreq_data *wrqu, char *extra);
-			      
+
 extern int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
 			     union iwreq_data *wrqu, char *b);
 
@@ -2670,12 +2670,12 @@ extern void ieee80211_wx_sync_scan_wq(struct work_struct *work);
 #endif
 
 
-extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee, 
-			       struct iw_request_info *info, 
+extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
+			       struct iw_request_info *info,
 			       union iwreq_data *wrqu, char *extra);
-			       
-extern int ieee80211_wx_get_name(struct ieee80211_device *ieee, 
-			     struct iw_request_info *info, 
+
+extern int ieee80211_wx_get_name(struct ieee80211_device *ieee,
+			     struct iw_request_info *info,
 			     union iwreq_data *wrqu, char *extra);
 
 extern int ieee80211_wx_set_power(struct ieee80211_device *ieee,
@@ -2686,14 +2686,14 @@ extern int ieee80211_wx_get_power(struct ieee80211_device *ieee,
 				 struct iw_request_info *info,
 				 union iwreq_data *wrqu, char *extra);
 
-extern int ieee80211_wx_set_rts(struct ieee80211_device *ieee, 
+extern int ieee80211_wx_set_rts(struct ieee80211_device *ieee,
 			     struct iw_request_info *info,
 			     union iwreq_data *wrqu, char *extra);
 
-extern int ieee80211_wx_get_rts(struct ieee80211_device *ieee, 
+extern int ieee80211_wx_get_rts(struct ieee80211_device *ieee,
 			     struct iw_request_info *info,
 			     union iwreq_data *wrqu, char *extra);
-//HT				 			     
+//HT
 #define MAX_RECEIVE_BUFFER_SIZE 9100  //
 extern void HTDebugHTCapability(u8* CapIE, u8* TitleString );
 extern void HTDebugHTInfo(u8*  InfoIE, u8* TitleString);
@@ -2730,15 +2730,15 @@ extern void RxBaInactTimeout(unsigned long data);
 extern void ResetBaEntry( PBA_RECORD pBA);
 //function in TS.c
 extern bool GetTs(
-        struct ieee80211_device*        ieee,
-        PTS_COMMON_INFO                 *ppTS,
-        u8*                             Addr,
-        u8                              TID,
-        TR_SELECT                       TxRxSelect,  //Rx:1, Tx:0
-        bool                            bAddNewTs
-        );
+	struct ieee80211_device*        ieee,
+	PTS_COMMON_INFO                 *ppTS,
+	u8*                             Addr,
+	u8                              TID,
+	TR_SELECT                       TxRxSelect,  //Rx:1, Tx:0
+	bool                            bAddNewTs
+	);
 extern void TSInitialize(struct ieee80211_device *ieee);
-extern  void TsStartAddBaProcess(struct ieee80211_device* ieee, PTX_TS_RECORD   pTxTS);			 			     
+extern  void TsStartAddBaProcess(struct ieee80211_device* ieee, PTX_TS_RECORD   pTxTS);
 extern void RemovePeerTS(struct ieee80211_device* ieee, u8* Addr);
 extern void RemoveAllTS(struct ieee80211_device* ieee);
 void ieee80211_softmac_scan_syncro(struct ieee80211_device *ieee);
@@ -2779,13 +2779,13 @@ static inline const char *escape_essid(const char *essid, u8 essid_len) {
 	return escaped;
 }
 
-/* For the function is more related to hardware setting, it's better to use the  
+/* For the function is more related to hardware setting, it's better to use the
  * ieee handler to refer to it.
  */
 extern short check_nic_enough_desc(struct net_device *dev, int queue_index);
 extern int ieee80211_data_xmit(struct sk_buff *skb, struct net_device *dev);
 extern int ieee80211_parse_info_param(struct ieee80211_device *ieee,
-		struct ieee80211_info_element *info_element, 
+		struct ieee80211_info_element *info_element,
 		u16 length,
 		struct ieee80211_network *network,
 		struct ieee80211_rx_stats *stats);
diff --git a/drivers/staging/rtl8192u/ieee80211/Makefile b/drivers/staging/rtl8192u/ieee80211/Makefile
index 0e72128..71ca5d9 100644
--- a/drivers/staging/rtl8192u/ieee80211/Makefile
+++ b/drivers/staging/rtl8192u/ieee80211/Makefile
@@ -62,7 +62,7 @@ install: modules
 	depmod -a
 uninstall:
 	rm -fr $(MODDESTDIR)
-	depmod -a 
+	depmod -a
 
 else
 LD := ld
@@ -74,7 +74,7 @@ CFLAGS += -I$(KSRC)/include -I.
 #Kernel 2.4.31
 CFLAGS += -DMODVERSIONS -DEXPORT_SYMTAB -include $(KSRC)/include/linux/modversions.h
 #Kernel 2.4.20
-#CFLAGS += -D__NO_VERSION__ -DEXPORT_SYMTAB 
+#CFLAGS += -D__NO_VERSION__ -DEXPORT_SYMTAB
 #CFLAGS += -DENABLE_DOT11D
 SMP := $(shell $(CC) $(MODCFLAGS) -E -dM $(CONFIG_FILE) | \
    grep CONFIG_SMP | awk '{print $$3}')
@@ -91,7 +91,7 @@ OBJS := ${patsubst %.c, %.o, ${wildcard *.c}}
 all:${OBJS} ieee80211_crypt-rsl.o michael_mic-rsl.o aes-rsl.o ieee80211_crypt_wep-rsl.o ieee80211_crypt_tkip-rsl.o ieee80211_crypt_ccmp-rsl.o crypto-rsl.o ieee80211-rsl.o
 
 ieee80211_crypt-rsl.o: ieee80211_crypt.o
-	mv $^ $@	
+	mv $^ $@
 
 michael_mic-rsl.o: michael_mic.o
 	mv $^ $@
diff --git a/drivers/staging/rtl8192u/ieee80211/aes.c b/drivers/staging/rtl8192u/ieee80211/aes.c
index 21ed66d..a6bb6c9 100644
--- a/drivers/staging/rtl8192u/ieee80211/aes.c
+++ b/drivers/staging/rtl8192u/ieee80211/aes.c
@@ -1,4 +1,4 @@
-/* 
+/*
  * Cryptographic API.
  *
  * AES Cipher Algorithm.
@@ -65,14 +65,14 @@
 
 #define AES_BLOCK_SIZE		16
 
-static inline 
+static inline
 u32 generic_rotr32 (const u32 x, const unsigned bits)
 {
 	const unsigned n = bits % 32;
 	return (x >> n) | (x << (32 - n));
 }
 
-static inline 
+static inline
 u32 generic_rotl32 (const u32 x, const unsigned bits)
 {
 	const unsigned n = bits % 32;
@@ -83,7 +83,7 @@ u32 generic_rotl32 (const u32 x, const unsigned bits)
 #define rotr generic_rotr32
 
 /*
- * #define byte(x, nr) ((unsigned char)((x) >> (nr*8))) 
+ * #define byte(x, nr) ((unsigned char)((x) >> (nr*8)))
  */
 inline static u8
 byte(const u32 x, const unsigned n)
@@ -126,15 +126,15 @@ f_mult (u8 a, u8 b)
 
 #define f_rn(bo, bi, n, k)					\
     bo[n] =  ft_tab[0][byte(bi[n],0)] ^				\
-             ft_tab[1][byte(bi[(n + 1) & 3],1)] ^		\
-             ft_tab[2][byte(bi[(n + 2) & 3],2)] ^		\
-             ft_tab[3][byte(bi[(n + 3) & 3],3)] ^ *(k + n)
+	     ft_tab[1][byte(bi[(n + 1) & 3],1)] ^		\
+	     ft_tab[2][byte(bi[(n + 2) & 3],2)] ^		\
+	     ft_tab[3][byte(bi[(n + 3) & 3],3)] ^ *(k + n)
 
 #define i_rn(bo, bi, n, k)					\
     bo[n] =  it_tab[0][byte(bi[n],0)] ^				\
-             it_tab[1][byte(bi[(n + 3) & 3],1)] ^		\
-             it_tab[2][byte(bi[(n + 2) & 3],2)] ^		\
-             it_tab[3][byte(bi[(n + 1) & 3],3)] ^ *(k + n)
+	     it_tab[1][byte(bi[(n + 3) & 3],1)] ^		\
+	     it_tab[2][byte(bi[(n + 2) & 3],2)] ^		\
+	     it_tab[3][byte(bi[(n + 1) & 3],3)] ^ *(k + n)
 
 #define ls_box(x)				\
     ( fl_tab[0][byte(x, 0)] ^			\
@@ -144,15 +144,15 @@ f_mult (u8 a, u8 b)
 
 #define f_rl(bo, bi, n, k)					\
     bo[n] =  fl_tab[0][byte(bi[n],0)] ^				\
-             fl_tab[1][byte(bi[(n + 1) & 3],1)] ^		\
-             fl_tab[2][byte(bi[(n + 2) & 3],2)] ^		\
-             fl_tab[3][byte(bi[(n + 3) & 3],3)] ^ *(k + n)
+	     fl_tab[1][byte(bi[(n + 1) & 3],1)] ^		\
+	     fl_tab[2][byte(bi[(n + 2) & 3],2)] ^		\
+	     fl_tab[3][byte(bi[(n + 3) & 3],3)] ^ *(k + n)
 
 #define i_rl(bo, bi, n, k)					\
     bo[n] =  il_tab[0][byte(bi[n],0)] ^				\
-             il_tab[1][byte(bi[(n + 3) & 3],1)] ^		\
-             il_tab[2][byte(bi[(n + 2) & 3],2)] ^		\
-             il_tab[3][byte(bi[(n + 1) & 3],3)] ^ *(k + n)
+	     il_tab[1][byte(bi[(n + 3) & 3],1)] ^		\
+	     il_tab[2][byte(bi[(n + 2) & 3],2)] ^		\
+	     il_tab[3][byte(bi[(n + 1) & 3],3)] ^ *(k + n)
 
 static void __init
 gen_tabs (void)
@@ -234,8 +234,8 @@ gen_tabs (void)
     t   = w ^ (x);          \
    (y)  = u ^ v ^ w;        \
    (y) ^= rotr(u ^ t,  8) ^ \
-          rotr(v ^ t, 16) ^ \
-          rotr(t,24)
+	  rotr(v ^ t, 16) ^ \
+	  rotr(t,24)
 
 /* initialise the key schedule from the user supplied key */
 
@@ -443,9 +443,9 @@ static struct crypto_alg aes_alg = {
 		.cipher = {
 			.cia_min_keysize	=	AES_MIN_KEY_SIZE,
 			.cia_max_keysize	=	AES_MAX_KEY_SIZE,
-			.cia_setkey	   	= 	aes_set_key,
-			.cia_encrypt	 	=	aes_encrypt,
-			.cia_decrypt	  	=	aes_decrypt
+			.cia_setkey		= 	aes_set_key,
+			.cia_encrypt		=	aes_encrypt,
+			.cia_decrypt		=	aes_decrypt
 		}
 	}
 };
diff --git a/drivers/staging/rtl8192u/ieee80211/api.c b/drivers/staging/rtl8192u/ieee80211/api.c
index a3bd63b..c627d02 100644
--- a/drivers/staging/rtl8192u/ieee80211/api.c
+++ b/drivers/staging/rtl8192u/ieee80211/api.c
@@ -9,7 +9,7 @@
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option) 
+ * Software Foundation; either version 2 of the License, or (at your option)
  * any later version.
  *
  */
@@ -44,9 +44,9 @@ struct crypto_alg *crypto_alg_lookup(const char *name)
 
 	if (!name)
 		return NULL;
-	
+
 	down_read(&crypto_alg_sem);
-	
+
 	list_for_each_entry(q, &crypto_alg_list, cra_list) {
 		if (!(strcmp(q->cra_name, name))) {
 			if (crypto_alg_get(q))
@@ -54,7 +54,7 @@ struct crypto_alg *crypto_alg_lookup(const char *name)
 			break;
 		}
 	}
-	
+
 	up_read(&crypto_alg_sem);
 	return alg;
 }
@@ -62,21 +62,21 @@ struct crypto_alg *crypto_alg_lookup(const char *name)
 static int crypto_init_flags(struct crypto_tfm *tfm, u32 flags)
 {
 	tfm->crt_flags = 0;
-	
+
 	switch (crypto_tfm_alg_type(tfm)) {
 	case CRYPTO_ALG_TYPE_CIPHER:
 		return crypto_init_cipher_flags(tfm, flags);
-		
+
 	case CRYPTO_ALG_TYPE_DIGEST:
 		return crypto_init_digest_flags(tfm, flags);
-		
+
 	case CRYPTO_ALG_TYPE_COMPRESS:
 		return crypto_init_compress_flags(tfm, flags);
-	
+
 	default:
 		break;
 	}
-	
+
 	BUG();
 	return -EINVAL;
 }
@@ -86,17 +86,17 @@ static int crypto_init_ops(struct crypto_tfm *tfm)
 	switch (crypto_tfm_alg_type(tfm)) {
 	case CRYPTO_ALG_TYPE_CIPHER:
 		return crypto_init_cipher_ops(tfm);
-		
+
 	case CRYPTO_ALG_TYPE_DIGEST:
 		return crypto_init_digest_ops(tfm);
-		
+
 	case CRYPTO_ALG_TYPE_COMPRESS:
 		return crypto_init_compress_ops(tfm);
-	
+
 	default:
 		break;
 	}
-	
+
 	BUG();
 	return -EINVAL;
 }
@@ -107,18 +107,18 @@ static void crypto_exit_ops(struct crypto_tfm *tfm)
 	case CRYPTO_ALG_TYPE_CIPHER:
 		crypto_exit_cipher_ops(tfm);
 		break;
-		
+
 	case CRYPTO_ALG_TYPE_DIGEST:
 		crypto_exit_digest_ops(tfm);
 		break;
-		
+
 	case CRYPTO_ALG_TYPE_COMPRESS:
 		crypto_exit_compress_ops(tfm);
 		break;
-	
+
 	default:
 		BUG();
-		
+
 	}
 }
 
@@ -130,18 +130,18 @@ struct crypto_tfm *crypto_alloc_tfm(const char *name, u32 flags)
 	alg = crypto_alg_mod_lookup(name);
 	if (alg == NULL)
 		goto out;
-	
+
 	tfm = kmalloc(sizeof(*tfm) + alg->cra_ctxsize, GFP_KERNEL);
 	if (tfm == NULL)
 		goto out_put;
 
 	memset(tfm, 0, sizeof(*tfm) + alg->cra_ctxsize);
-	
+
 	tfm->__crt_alg = alg;
-	
+
 	if (crypto_init_flags(tfm, flags))
 		goto out_free_tfm;
-		
+
 	if (crypto_init_ops(tfm)) {
 		crypto_exit_ops(tfm);
 		goto out_free_tfm;
@@ -173,18 +173,18 @@ int crypto_register_alg(struct crypto_alg *alg)
 {
 	int ret = 0;
 	struct crypto_alg *q;
-	
+
 	down_write(&crypto_alg_sem);
-	
+
 	list_for_each_entry(q, &crypto_alg_list, cra_list) {
 		if (!(strcmp(q->cra_name, alg->cra_name))) {
 			ret = -EEXIST;
 			goto out;
 		}
 	}
-	
+
 	list_add_tail(&alg->cra_list, &crypto_alg_list);
-out:	
+out:
 	up_write(&crypto_alg_sem);
 	return ret;
 }
@@ -193,9 +193,9 @@ int crypto_unregister_alg(struct crypto_alg *alg)
 {
 	int ret = -ENOENT;
 	struct crypto_alg *q;
-	
+
 	BUG_ON(!alg->cra_module);
-	
+
 	down_write(&crypto_alg_sem);
 	list_for_each_entry(q, &crypto_alg_list, cra_list) {
 		if (alg == q) {
@@ -204,7 +204,7 @@ int crypto_unregister_alg(struct crypto_alg *alg)
 			goto out;
 		}
 	}
-out:	
+out:
 	up_write(&crypto_alg_sem);
 	return ret;
 }
@@ -213,12 +213,12 @@ int crypto_alg_available(const char *name, u32 flags)
 {
 	int ret = 0;
 	struct crypto_alg *alg = crypto_alg_mod_lookup(name);
-	
+
 	if (alg) {
 		crypto_alg_put(alg);
 		ret = 1;
 	}
-	
+
 	return ret;
 }
 
diff --git a/drivers/staging/rtl8192u/ieee80211/arc4.c b/drivers/staging/rtl8192u/ieee80211/arc4.c
index 95e24f9..e3ad8d2 100644
--- a/drivers/staging/rtl8192u/ieee80211/arc4.c
+++ b/drivers/staging/rtl8192u/ieee80211/arc4.c
@@ -1,4 +1,4 @@
-/* 
+/*
  * Cryptographic API
  *
  * ARC4 Cipher Algorithm
@@ -79,9 +79,9 @@ static struct crypto_alg arc4_alg = {
 	.cra_u			=	{ .cipher = {
 	.cia_min_keysize	=	ARC4_MIN_KEY_SIZE,
 	.cia_max_keysize	=	ARC4_MAX_KEY_SIZE,
-	.cia_setkey	   	= 	arc4_set_key,
-	.cia_encrypt	 	=	arc4_crypt,
-	.cia_decrypt	  	=	arc4_crypt } }
+	.cia_setkey		= 	arc4_set_key,
+	.cia_encrypt		=	arc4_crypt,
+	.cia_decrypt		=	arc4_crypt } }
 };
 
 static int __init arc4_init(void)
diff --git a/drivers/staging/rtl8192u/ieee80211/autoload.c b/drivers/staging/rtl8192u/ieee80211/autoload.c
index 148132e..c97756f 100644
--- a/drivers/staging/rtl8192u/ieee80211/autoload.c
+++ b/drivers/staging/rtl8192u/ieee80211/autoload.c
@@ -7,7 +7,7 @@
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option) 
+ * Software Foundation; either version 2 of the License, or (at your option)
  * any later version.
  *
  */
diff --git a/drivers/staging/rtl8192u/ieee80211/cipher.c b/drivers/staging/rtl8192u/ieee80211/cipher.c
index ca1bc79..0b9e8a4 100644
--- a/drivers/staging/rtl8192u/ieee80211/cipher.c
+++ b/drivers/staging/rtl8192u/ieee80211/cipher.c
@@ -7,7 +7,7 @@
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option) 
+ * Software Foundation; either version 2 of the License, or (at your option)
  * any later version.
  *
  */
@@ -23,7 +23,7 @@
 
 typedef void (cryptfn_t)(void *, u8 *, const u8 *);
 typedef void (procfn_t)(struct crypto_tfm *, u8 *,
-                        u8*, cryptfn_t, int enc, void *, int);
+			u8*, cryptfn_t, int enc, void *, int);
 
 static inline void xor_64(u8 *a, const u8 *b)
 {
@@ -40,7 +40,7 @@ static inline void xor_128(u8 *a, const u8 *b)
 }
 
 
-/* 
+/*
  * Generic encrypt/decrypt wrapper for ciphers, handles operations across
  * multiple page boundaries by using temporary blocks.  In user context,
  * the kernel is given a chance to schedule us once per block.
@@ -48,8 +48,8 @@ static inline void xor_128(u8 *a, const u8 *b)
 static int crypt(struct crypto_tfm *tfm,
 		 struct scatterlist *dst,
 		 struct scatterlist *src,
-                 unsigned int nbytes, cryptfn_t crfn,
-                 procfn_t prfn, int enc, void *info)
+		 unsigned int nbytes, cryptfn_t crfn,
+		 procfn_t prfn, int enc, void *info)
 {
 	struct scatter_walk walk_in, walk_out;
 	const unsigned int bsize = crypto_tfm_alg_blocksize(tfm);
@@ -100,11 +100,11 @@ static void cbc_process(struct crypto_tfm *tfm, u8 *dst, u8 *src,
 			cryptfn_t fn, int enc, void *info, int in_place)
 {
 	u8 *iv = info;
-	
+
 	/* Null encryption */
 	if (!iv)
 		return;
-		
+
 	if (enc) {
 		tfm->crt_u.cipher.cit_xor_block(iv, src);
 		fn(crypto_tfm_ctx(tfm), dst, iv);
@@ -130,86 +130,86 @@ static void ecb_process(struct crypto_tfm *tfm, u8 *dst, u8 *src,
 static int setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int keylen)
 {
 	struct cipher_alg *cia = &tfm->__crt_alg->cra_cipher;
-	
+
 	if (keylen < cia->cia_min_keysize || keylen > cia->cia_max_keysize) {
 		tfm->crt_flags |= CRYPTO_TFM_RES_BAD_KEY_LEN;
 		return -EINVAL;
 	} else
 		return cia->cia_setkey(crypto_tfm_ctx(tfm), key, keylen,
-		                       &tfm->crt_flags);
+				       &tfm->crt_flags);
 }
 
 static int ecb_encrypt(struct crypto_tfm *tfm,
 		       struct scatterlist *dst,
-                       struct scatterlist *src, unsigned int nbytes)
+		       struct scatterlist *src, unsigned int nbytes)
 {
 	return crypt(tfm, dst, src, nbytes,
-	             tfm->__crt_alg->cra_cipher.cia_encrypt,
-	             ecb_process, 1, NULL);
+		     tfm->__crt_alg->cra_cipher.cia_encrypt,
+		     ecb_process, 1, NULL);
 }
 
 static int ecb_decrypt(struct crypto_tfm *tfm,
-                       struct scatterlist *dst,
-                       struct scatterlist *src,
+		       struct scatterlist *dst,
+		       struct scatterlist *src,
 		       unsigned int nbytes)
 {
 	return crypt(tfm, dst, src, nbytes,
-	             tfm->__crt_alg->cra_cipher.cia_decrypt,
-	             ecb_process, 1, NULL);
+		     tfm->__crt_alg->cra_cipher.cia_decrypt,
+		     ecb_process, 1, NULL);
 }
 
 static int cbc_encrypt(struct crypto_tfm *tfm,
-                       struct scatterlist *dst,
-                       struct scatterlist *src,
+		       struct scatterlist *dst,
+		       struct scatterlist *src,
 		       unsigned int nbytes)
 {
 	return crypt(tfm, dst, src, nbytes,
-	             tfm->__crt_alg->cra_cipher.cia_encrypt,
-	             cbc_process, 1, tfm->crt_cipher.cit_iv);
+		     tfm->__crt_alg->cra_cipher.cia_encrypt,
+		     cbc_process, 1, tfm->crt_cipher.cit_iv);
 }
 
 static int cbc_encrypt_iv(struct crypto_tfm *tfm,
-                          struct scatterlist *dst,
-                          struct scatterlist *src,
-                          unsigned int nbytes, u8 *iv)
+			  struct scatterlist *dst,
+			  struct scatterlist *src,
+			  unsigned int nbytes, u8 *iv)
 {
 	return crypt(tfm, dst, src, nbytes,
-	             tfm->__crt_alg->cra_cipher.cia_encrypt,
-	             cbc_process, 1, iv);
+		     tfm->__crt_alg->cra_cipher.cia_encrypt,
+		     cbc_process, 1, iv);
 }
 
 static int cbc_decrypt(struct crypto_tfm *tfm,
-                       struct scatterlist *dst,
-                       struct scatterlist *src,
+		       struct scatterlist *dst,
+		       struct scatterlist *src,
 		       unsigned int nbytes)
 {
 	return crypt(tfm, dst, src, nbytes,
-	             tfm->__crt_alg->cra_cipher.cia_decrypt,
-	             cbc_process, 0, tfm->crt_cipher.cit_iv);
+		     tfm->__crt_alg->cra_cipher.cia_decrypt,
+		     cbc_process, 0, tfm->crt_cipher.cit_iv);
 }
 
 static int cbc_decrypt_iv(struct crypto_tfm *tfm,
-                          struct scatterlist *dst,
-                          struct scatterlist *src,
-                          unsigned int nbytes, u8 *iv)
+			  struct scatterlist *dst,
+			  struct scatterlist *src,
+			  unsigned int nbytes, u8 *iv)
 {
 	return crypt(tfm, dst, src, nbytes,
-	             tfm->__crt_alg->cra_cipher.cia_decrypt,
-	             cbc_process, 0, iv);
+		     tfm->__crt_alg->cra_cipher.cia_decrypt,
+		     cbc_process, 0, iv);
 }
 
 static int nocrypt(struct crypto_tfm *tfm,
-                   struct scatterlist *dst,
-                   struct scatterlist *src,
+		   struct scatterlist *dst,
+		   struct scatterlist *src,
 		   unsigned int nbytes)
 {
 	return -ENOSYS;
 }
 
 static int nocrypt_iv(struct crypto_tfm *tfm,
-                      struct scatterlist *dst,
-                      struct scatterlist *src,
-                      unsigned int nbytes, u8 *iv)
+		      struct scatterlist *dst,
+		      struct scatterlist *src,
+		      unsigned int nbytes, u8 *iv)
 {
 	return -ENOSYS;
 }
@@ -217,11 +217,11 @@ static int nocrypt_iv(struct crypto_tfm *tfm,
 int crypto_init_cipher_flags(struct crypto_tfm *tfm, u32 flags)
 {
 	u32 mode = flags & CRYPTO_TFM_MODE_MASK;
-	
+
 	tfm->crt_cipher.cit_mode = mode ? mode : CRYPTO_TFM_MODE_ECB;
 	if (flags & CRYPTO_TFM_REQ_WEAK_KEY)
 		tfm->crt_flags = CRYPTO_TFM_REQ_WEAK_KEY;
-	
+
 	return 0;
 }
 
@@ -237,21 +237,21 @@ int crypto_init_cipher_ops(struct crypto_tfm *tfm)
 		ops->cit_encrypt = ecb_encrypt;
 		ops->cit_decrypt = ecb_decrypt;
 		break;
-		
+
 	case CRYPTO_TFM_MODE_CBC:
 		ops->cit_encrypt = cbc_encrypt;
 		ops->cit_decrypt = cbc_decrypt;
 		ops->cit_encrypt_iv = cbc_encrypt_iv;
 		ops->cit_decrypt_iv = cbc_decrypt_iv;
 		break;
-		
+
 	case CRYPTO_TFM_MODE_CFB:
 		ops->cit_encrypt = nocrypt;
 		ops->cit_decrypt = nocrypt;
 		ops->cit_encrypt_iv = nocrypt_iv;
 		ops->cit_decrypt_iv = nocrypt_iv;
 		break;
-	
+
 	case CRYPTO_TFM_MODE_CTR:
 		ops->cit_encrypt = nocrypt;
 		ops->cit_decrypt = nocrypt;
@@ -262,33 +262,33 @@ int crypto_init_cipher_ops(struct crypto_tfm *tfm)
 	default:
 		BUG();
 	}
-	
+
 	if (ops->cit_mode == CRYPTO_TFM_MODE_CBC) {
-	    	
-	    	switch (crypto_tfm_alg_blocksize(tfm)) {
-	    	case 8:
-	    		ops->cit_xor_block = xor_64;
-	    		break;
-	    		
-	    	case 16:
-	    		ops->cit_xor_block = xor_128;
-	    		break;
-	    		
-	    	default:
-	    		printk(KERN_WARNING "%s: block size %u not supported\n",
-	    		       crypto_tfm_alg_name(tfm),
-	    		       crypto_tfm_alg_blocksize(tfm));
-	    		ret = -EINVAL;
-	    		goto out;
-	    	}
-	    	
+
+		switch (crypto_tfm_alg_blocksize(tfm)) {
+		case 8:
+			ops->cit_xor_block = xor_64;
+			break;
+
+		case 16:
+			ops->cit_xor_block = xor_128;
+			break;
+
+		default:
+			printk(KERN_WARNING "%s: block size %u not supported\n",
+			       crypto_tfm_alg_name(tfm),
+			       crypto_tfm_alg_blocksize(tfm));
+			ret = -EINVAL;
+			goto out;
+		}
+
 		ops->cit_ivsize = crypto_tfm_alg_blocksize(tfm);
-	    	ops->cit_iv = kmalloc(ops->cit_ivsize, GFP_KERNEL);
+		ops->cit_iv = kmalloc(ops->cit_ivsize, GFP_KERNEL);
 		if (ops->cit_iv == NULL)
 			ret = -ENOMEM;
 	}
 
-out:	
+out:
 	return ret;
 }
 
diff --git a/drivers/staging/rtl8192u/ieee80211/compress.c b/drivers/staging/rtl8192u/ieee80211/compress.c
index a62c442..86c23c9 100644
--- a/drivers/staging/rtl8192u/ieee80211/compress.c
+++ b/drivers/staging/rtl8192u/ieee80211/compress.c
@@ -7,7 +7,7 @@
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option) 
+ * Software Foundation; either version 2 of the License, or (at your option)
  * any later version.
  *
  */
@@ -20,21 +20,21 @@
 #include "internal.h"
 
 static int crypto_compress(struct crypto_tfm *tfm,
-                            const u8 *src, unsigned int slen,
-                            u8 *dst, unsigned int *dlen)
+			    const u8 *src, unsigned int slen,
+			    u8 *dst, unsigned int *dlen)
 {
 	return tfm->__crt_alg->cra_compress.coa_compress(crypto_tfm_ctx(tfm),
-	                                                 src, slen, dst,
-	                                                 dlen);
+							 src, slen, dst,
+							 dlen);
 }
 
 static int crypto_decompress(struct crypto_tfm *tfm,
-                             const u8 *src, unsigned int slen,
-                             u8 *dst, unsigned int *dlen)
+			     const u8 *src, unsigned int slen,
+			     u8 *dst, unsigned int *dlen)
 {
 	return tfm->__crt_alg->cra_compress.coa_decompress(crypto_tfm_ctx(tfm),
-	                                                   src, slen, dst,
-	                                                   dlen);
+							   src, slen, dst,
+							   dlen);
 }
 
 int crypto_init_compress_flags(struct crypto_tfm *tfm, u32 flags)
@@ -46,14 +46,14 @@ int crypto_init_compress_ops(struct crypto_tfm *tfm)
 {
 	int ret = 0;
 	struct compress_tfm *ops = &tfm->crt_compress;
-	
+
 	ret = tfm->__crt_alg->cra_compress.coa_init(crypto_tfm_ctx(tfm));
 	if (ret)
 		goto out;
 
 	ops->cot_compress = crypto_compress;
 	ops->cot_decompress = crypto_decompress;
-	
+
 out:
 	return ret;
 }
diff --git a/drivers/staging/rtl8192u/ieee80211/crypto_compat.h b/drivers/staging/rtl8192u/ieee80211/crypto_compat.h
index 7abc7f7..c7f26ff 100644
--- a/drivers/staging/rtl8192u/ieee80211/crypto_compat.h
+++ b/drivers/staging/rtl8192u/ieee80211/crypto_compat.h
@@ -12,25 +12,25 @@
 #include <linux/crypto.h>
 
 static inline int crypto_cipher_encrypt(struct crypto_tfm *tfm,
-                                        struct scatterlist *dst,
-                                        struct scatterlist *src,
-                                        unsigned int nbytes)
+					struct scatterlist *dst,
+					struct scatterlist *src,
+					unsigned int nbytes)
 {
 	BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER);
 	return tfm->crt_cipher.cit_encrypt(tfm, dst, src, nbytes);
-}         
+}
 
 
 static inline int crypto_cipher_decrypt(struct crypto_tfm *tfm,
-                                        struct scatterlist *dst,
-                                        struct scatterlist *src,
-                                        unsigned int nbytes)
+					struct scatterlist *dst,
+					struct scatterlist *src,
+					unsigned int nbytes)
 {
 	BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER);
 	return tfm->crt_cipher.cit_decrypt(tfm, dst, src, nbytes);
 }
 
-#if 0 
+#if 0
 /*
  *	crypto_free_tfm - Free crypto transform
  *	@tfm: Transform to free
diff --git a/drivers/staging/rtl8192u/ieee80211/digest.c b/drivers/staging/rtl8192u/ieee80211/digest.c
index 1dfb443..301ed51 100644
--- a/drivers/staging/rtl8192u/ieee80211/digest.c
+++ b/drivers/staging/rtl8192u/ieee80211/digest.c
@@ -7,7 +7,7 @@
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option) 
+ * Software Foundation; either version 2 of the License, or (at your option)
  * any later version.
  *
  */
@@ -25,7 +25,7 @@ static void init(struct crypto_tfm *tfm)
 }
 
 static void update(struct crypto_tfm *tfm,
-                   struct scatterlist *sg, unsigned int nsg)
+		   struct scatterlist *sg, unsigned int nsg)
 {
 	unsigned int i;
 
@@ -37,7 +37,7 @@ static void update(struct crypto_tfm *tfm,
 
 		do {
 			unsigned int bytes_from_page = min(l, ((unsigned int)
-							   (PAGE_SIZE)) - 
+							   (PAGE_SIZE)) -
 							   offset);
 			char *p = crypto_kmap(pg, 0) + offset;
 
@@ -68,16 +68,16 @@ static int setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int keylen)
 }
 
 static void digest(struct crypto_tfm *tfm,
-                   struct scatterlist *sg, unsigned int nsg, u8 *out)
+		   struct scatterlist *sg, unsigned int nsg, u8 *out)
 {
 	unsigned int i;
 
 	tfm->crt_digest.dit_init(tfm);
-		
+
 	for (i = 0; i < nsg; i++) {
 		char *p = crypto_kmap(sg[i].page, 0) + sg[i].offset;
 		tfm->__crt_alg->cra_digest.dia_update(crypto_tfm_ctx(tfm),
-		                                      p, sg[i].length);
+						      p, sg[i].length);
 		crypto_kunmap(p, 0);
 		crypto_yield(tfm);
 	}
@@ -92,13 +92,13 @@ int crypto_init_digest_flags(struct crypto_tfm *tfm, u32 flags)
 int crypto_init_digest_ops(struct crypto_tfm *tfm)
 {
 	struct digest_tfm *ops = &tfm->crt_digest;
-	
+
 	ops->dit_init	= init;
 	ops->dit_update	= update;
 	ops->dit_final	= final;
 	ops->dit_digest	= digest;
 	ops->dit_setkey	= setkey;
-	
+
 	return crypto_alloc_hmac_block(tfm);
 }
 
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211.h b/drivers/staging/rtl8192u/ieee80211/ieee80211.h
index dc49831..03048f0 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211.h
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211.h
@@ -72,7 +72,7 @@ struct iw_spy_data{
 	struct iw_quality	spy_thr_low; /* Low threshold */
 	struct iw_quality	spy_thr_high; /* High threshold */
 	u_char			spy_thr_under[IW_MAX_SPY];
-}; 
+};
 #endif
 #endif
 
@@ -86,8 +86,8 @@ struct iw_spy_data{
  *
  */
 #define container_of(ptr, type, member) ({                      \
-        const typeof( ((type *)0)->member ) *__mptr = (ptr);    \
-        (type *)( (char *)__mptr - offsetof(type,member) );})
+	const typeof( ((type *)0)->member ) *__mptr = (ptr);    \
+	(type *)( (char *)__mptr - offsetof(type,member) );})
 #endif
 
 #define KEY_TYPE_NA		0x0
@@ -125,63 +125,63 @@ struct iw_spy_data{
 /* defined for skb cb field */
 /* At most 28 byte */
 typedef struct cb_desc {
-        /* Tx Desc Related flags (8-9) */
+	/* Tx Desc Related flags (8-9) */
 	u8 bLastIniPkt:1;
 	u8 bCmdOrInit:1;
-        u8 bFirstSeg:1;
-        u8 bLastSeg:1;
-        u8 bEncrypt:1;
-        u8 bTxDisableRateFallBack:1;
-        u8 bTxUseDriverAssingedRate:1;
-        u8 bHwSec:1; //indicate whether use Hw security. WB
-
-        u8 reserved1;
-
-        /* Tx Firmware Relaged flags (10-11)*/
-        u8 bCTSEnable:1;
-        u8 bRTSEnable:1;
-        u8 bUseShortGI:1;
-        u8 bUseShortPreamble:1;
-        u8 bTxEnableFwCalcDur:1;
-        u8 bAMPDUEnable:1;
-        u8 bRTSSTBC:1;
-        u8 RTSSC:1;
-
-        u8 bRTSBW:1;
-        u8 bPacketBW:1;
+	u8 bFirstSeg:1;
+	u8 bLastSeg:1;
+	u8 bEncrypt:1;
+	u8 bTxDisableRateFallBack:1;
+	u8 bTxUseDriverAssingedRate:1;
+	u8 bHwSec:1; //indicate whether use Hw security. WB
+
+	u8 reserved1;
+
+	/* Tx Firmware Relaged flags (10-11)*/
+	u8 bCTSEnable:1;
+	u8 bRTSEnable:1;
+	u8 bUseShortGI:1;
+	u8 bUseShortPreamble:1;
+	u8 bTxEnableFwCalcDur:1;
+	u8 bAMPDUEnable:1;
+	u8 bRTSSTBC:1;
+	u8 RTSSC:1;
+
+	u8 bRTSBW:1;
+	u8 bPacketBW:1;
 	u8 bRTSUseShortPreamble:1;
 	u8 bRTSUseShortGI:1;
 	u8 bMulticast:1;
 	u8 bBroadcast:1;
-        //u8 reserved2:2;
-        u8 drv_agg_enable:1;
-        u8 reserved2:1;
-
-        /* Tx Desc related element(12-19) */
-        u8 rata_index;
-        u8 queue_index;
-        //u8 reserved3;
-        //u8 reserved4;
-        u16 txbuf_size;
-        //u8 reserved5;
+	//u8 reserved2:2;
+	u8 drv_agg_enable:1;
+	u8 reserved2:1;
+
+	/* Tx Desc related element(12-19) */
+	u8 rata_index;
+	u8 queue_index;
+	//u8 reserved3;
+	//u8 reserved4;
+	u16 txbuf_size;
+	//u8 reserved5;
 	u8 RATRIndex;
-        u8 reserved6;
-        u8 reserved7;
-        u8 reserved8;
-
-        /* Tx firmware related element(20-27) */
-        u8 data_rate;
-        u8 rts_rate;
-        u8 ampdu_factor;
-        u8 ampdu_density;
-        //u8 reserved9;
-        //u8 reserved10;
-        //u8 reserved11;
-        u8 DrvAggrNum;
+	u8 reserved6;
+	u8 reserved7;
+	u8 reserved8;
+
+	/* Tx firmware related element(20-27) */
+	u8 data_rate;
+	u8 rts_rate;
+	u8 ampdu_factor;
+	u8 ampdu_density;
+	//u8 reserved9;
+	//u8 reserved10;
+	//u8 reserved11;
+	u8 DrvAggrNum;
 	u16 pkt_size;
-        u8 reserved12;
+	u8 reserved12;
 }cb_desc, *pcb_desc;
-                        
+
 /*--------------------------Define -------------------------------------------*/
 #define MGN_1M                  0x02
 #define MGN_2M                  0x04
@@ -220,11 +220,11 @@ typedef struct cb_desc {
 enum	_ReasonCode{
 	unspec_reason	= 0x1,
 	auth_not_valid	= 0x2,
-	deauth_lv_ss	= 0x3, 
+	deauth_lv_ss	= 0x3,
 	inactivity		= 0x4,
-	ap_overload 	= 0x5, 
+	ap_overload 	= 0x5,
 	class2_err		= 0x6,
-	class3_err		= 0x7, 
+	class3_err		= 0x7,
 	disas_lv_ss 	= 0x8,
 	asoc_not_auth	= 0x9,
 
@@ -282,7 +282,7 @@ enum	_ReasonCode{
 #define IEEE_PARAM_WPAX_SELECT			7
 //Added for notify the encryption type selection
 //   David, 2006.9.26
-#define IEEE_PROTO_WPA				1	
+#define IEEE_PROTO_WPA				1
 #define IEEE_PROTO_RSN				2
 //Added for notify the encryption type selection
 //   David, 2006.9.26
@@ -312,7 +312,7 @@ enum	_ReasonCode{
 
 #define MAX_IE_LEN  0xff
 
-// added for kernel conflict 
+// added for kernel conflict
 #define ieee80211_crypt_deinit_entries 	ieee80211_crypt_deinit_entries_rsl
 #define ieee80211_crypt_deinit_handler 	ieee80211_crypt_deinit_handler_rsl
 #define ieee80211_crypt_delayed_deinit 	ieee80211_crypt_delayed_deinit_rsl
@@ -359,7 +359,7 @@ enum	_ReasonCode{
 #define ieee80211_wx_get_rate		ieee80211_wx_get_rate_rsl
 #define ieee80211_wx_set_wap		ieee80211_wx_set_wap_rsl
 #define ieee80211_wx_get_wap		ieee80211_wx_get_wap_rsl
-#define ieee80211_wx_set_mode		ieee80211_wx_set_mode_rsl 
+#define ieee80211_wx_set_mode		ieee80211_wx_set_mode_rsl
 #define ieee80211_wx_get_mode		ieee80211_wx_get_mode_rsl
 #define ieee80211_wx_set_scan		ieee80211_wx_set_scan_rsl
 #define ieee80211_wx_get_freq		ieee80211_wx_get_freq_rsl
@@ -389,7 +389,7 @@ enum	_ReasonCode{
 typedef struct ieee_param {
 	u32 cmd;
 	u8 sta_addr[ETH_ALEN];
-        union {
+	union {
 		struct {
 			u8 name;
 			u32 value;
@@ -399,9 +399,9 @@ typedef struct ieee_param {
 			u8 reserved[32];
 			u8 data[0];
 		} wpa_ie;
-	        struct{
+		struct{
 			int command;
-    			int reason_code;
+			int reason_code;
 		} mlme;
 		struct {
 			u8 alg[IEEE_CRYPT_ALG_NAME_LEN];
@@ -442,23 +442,23 @@ static inline void tq_init(struct tq_struct * task, void(*func)(void *), void *d
 #define MSECS(t)	(HZ * ((t) / 1000) + (HZ * ((t) % 1000)) / 1000)
 static inline unsigned long msleep_interruptible_rsl(unsigned int msecs)
 {
-         unsigned long timeout = MSECS(msecs) + 1;
- 
-         while (timeout) {
-                 set_current_state(TASK_INTERRUPTIBLE);
-                 timeout = schedule_timeout(timeout);
-         }
-         return timeout;
+	 unsigned long timeout = MSECS(msecs) + 1;
+
+	 while (timeout) {
+		 set_current_state(TASK_INTERRUPTIBLE);
+		 timeout = schedule_timeout(timeout);
+	 }
+	 return timeout;
 }
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,31))
 static inline void msleep(unsigned int msecs)
 {
-         unsigned long timeout = MSECS(msecs) + 1;
- 
-         while (timeout) {
-                 set_current_state(TASK_UNINTERRUPTIBLE);
-                 timeout = schedule_timeout(timeout);
-         }
+	 unsigned long timeout = MSECS(msecs) + 1;
+
+	 while (timeout) {
+		 set_current_state(TASK_UNINTERRUPTIBLE);
+		 timeout = schedule_timeout(timeout);
+	 }
 }
 #endif
 #else
@@ -551,7 +551,7 @@ static inline void msleep(unsigned int msecs)
 
 #define	FC_QOS_BIT					BIT7
 #define IsDataFrame(pdu)			( ((pdu[0] & 0x0C)==0x08) ? true : false )
-#define	IsLegacyDataFrame(pdu)	(IsDataFrame(pdu) && (!(pdu[0]&FC_QOS_BIT)) )	
+#define	IsLegacyDataFrame(pdu)	(IsDataFrame(pdu) && (!(pdu[0]&FC_QOS_BIT)) )
 //added by wb. Is this right?
 #define IsQoSDataFrame(pframe)  ((*(u16*)pframe&(IEEE80211_STYPE_QOS_DATA|IEEE80211_FTYPE_DATA)) == (IEEE80211_STYPE_QOS_DATA|IEEE80211_FTYPE_DATA))
 #define Frame_Order(pframe)     (*(u16*)pframe&IEEE80211_FCTL_ORDER)
@@ -559,24 +559,24 @@ static inline void msleep(unsigned int msecs)
 #define SN_EQUAL(a, b)	(a == b)
 #define MAX_DEV_ADDR_SIZE 8
 typedef enum _ACT_CATEGORY{
-        ACT_CAT_QOS = 1,
-        ACT_CAT_DLS = 2,
-        ACT_CAT_BA  = 3,
-        ACT_CAT_HT  = 7,
-        ACT_CAT_WMM = 17,
+	ACT_CAT_QOS = 1,
+	ACT_CAT_DLS = 2,
+	ACT_CAT_BA  = 3,
+	ACT_CAT_HT  = 7,
+	ACT_CAT_WMM = 17,
 } ACT_CATEGORY, *PACT_CATEGORY;
 
 typedef enum _TS_ACTION{
-        ACT_ADDTSREQ = 0,
-        ACT_ADDTSRSP = 1,
-        ACT_DELTS    = 2,
-        ACT_SCHEDULE = 3,
+	ACT_ADDTSREQ = 0,
+	ACT_ADDTSRSP = 1,
+	ACT_DELTS    = 2,
+	ACT_SCHEDULE = 3,
 } TS_ACTION, *PTS_ACTION;
 
 typedef enum _BA_ACTION{
-        ACT_ADDBAREQ = 0,
-        ACT_ADDBARSP = 1,
-        ACT_DELBA    = 2,
+	ACT_ADDBAREQ = 0,
+	ACT_ADDBARSP = 1,
+	ACT_DELBA    = 2,
 } BA_ACTION, *PBA_ACTION;
 
 typedef enum _InitialGainOpType{
@@ -607,7 +607,7 @@ do { if (ieee80211_debug_level & (level)) \
 			}				\
 			printk("\n");			\
 		}					\
-	} while (0)		
+	} while (0)
 #else
 #define IEEE80211_DEBUG(level, fmt, args...) do {} while (0)
 #define IEEE80211_DEBUG_DATA(level, data, datalen) do {} while(0)
@@ -685,24 +685,24 @@ do { if (ieee80211_debug_level & (level)) \
 /* Added by Annie, 2005-11-22. */
 #define MAX_STR_LEN     64
 /* I want to see ASCII 33 to 126 only. Otherwise, I print '?'. Annie, 2005-11-22.*/
-#define PRINTABLE(_ch)  (_ch>'!' && _ch<'~')    
+#define PRINTABLE(_ch)  (_ch>'!' && _ch<'~')
 #define IEEE80211_PRINT_STR(_Comp, _TitleString, _Ptr, _Len)                            	\
-                        if((_Comp) & level)   							\
-                        {                                                                       \
-                                int             __i;                                            \
-                                u8  buffer[MAX_STR_LEN];                                    	\
-                                int length = (_Len<MAX_STR_LEN)? _Len : (MAX_STR_LEN-1) ;  	\
-                                memset(buffer, 0, MAX_STR_LEN);                      		\
-                                memcpy(buffer, (u8 *)_Ptr, length );            		\
-                                for( __i=0; __i<MAX_STR_LEN; __i++ )                            \
-                                {                                                               \
-                                     if( !PRINTABLE(buffer[__i]) )   buffer[__i] = '?';     	\
-                                }                                                               \
-                                buffer[length] = '\0';                                          \
-                                printk("Rtl819x: ");                                         	\
-                                printk(_TitleString);                                         \
-                                printk(": %d, <%s>\n", _Len, buffer);                         \
-                        }
+			if((_Comp) & level)   							\
+			{                                                                       \
+				int             __i;                                            \
+				u8  buffer[MAX_STR_LEN];                                    	\
+				int length = (_Len<MAX_STR_LEN)? _Len : (MAX_STR_LEN-1) ;  	\
+				memset(buffer, 0, MAX_STR_LEN);                      		\
+				memcpy(buffer, (u8 *)_Ptr, length );            		\
+				for( __i=0; __i<MAX_STR_LEN; __i++ )                            \
+				{                                                               \
+				     if( !PRINTABLE(buffer[__i]) )   buffer[__i] = '?';     	\
+				}                                                               \
+				buffer[length] = '\0';                                          \
+				printk("Rtl819x: ");                                         	\
+				printk(_TitleString);                                         \
+				printk(": %d, <%s>\n", _Len, buffer);                         \
+			}
 #else
 #define IEEE80211_PRINT_STR(_Comp, _TitleString, _Ptr, _Len)  do {} while (0)
 #endif
@@ -731,10 +731,10 @@ do { if (ieee80211_debug_level & (level)) \
 
 struct ieee80211_snap_hdr {
 
-        u8    dsap;   /* always 0xAA */
-        u8    ssap;   /* always 0xAA */
-        u8    ctrl;   /* always 0x03 */
-        u8    oui[P80211_OUI_LEN];    /* organizational universal id */
+	u8    dsap;   /* always 0xAA */
+	u8    ssap;   /* always 0xAA */
+	u8    ctrl;   /* always 0x03 */
+	u8    oui[P80211_OUI_LEN];    /* organizational universal id */
 
 } __attribute__ ((packed));
 
@@ -775,65 +775,65 @@ struct ieee80211_snap_hdr {
 
 /* Status codes */
 enum ieee80211_statuscode {
-        WLAN_STATUS_SUCCESS = 0,
-        WLAN_STATUS_UNSPECIFIED_FAILURE = 1,
-        WLAN_STATUS_CAPS_UNSUPPORTED = 10,
-        WLAN_STATUS_REASSOC_NO_ASSOC = 11,
-        WLAN_STATUS_ASSOC_DENIED_UNSPEC = 12,
-        WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG = 13,
-        WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION = 14,
-        WLAN_STATUS_CHALLENGE_FAIL = 15,
-        WLAN_STATUS_AUTH_TIMEOUT = 16,
-        WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA = 17,
-        WLAN_STATUS_ASSOC_DENIED_RATES = 18,
-        /* 802.11b */
-        WLAN_STATUS_ASSOC_DENIED_NOSHORTPREAMBLE = 19,
-        WLAN_STATUS_ASSOC_DENIED_NOPBCC = 20,
-        WLAN_STATUS_ASSOC_DENIED_NOAGILITY = 21,
-        /* 802.11h */
-        WLAN_STATUS_ASSOC_DENIED_NOSPECTRUM = 22,
-        WLAN_STATUS_ASSOC_REJECTED_BAD_POWER = 23,
-        WLAN_STATUS_ASSOC_REJECTED_BAD_SUPP_CHAN = 24,
-        /* 802.11g */
-        WLAN_STATUS_ASSOC_DENIED_NOSHORTTIME = 25,
-        WLAN_STATUS_ASSOC_DENIED_NODSSSOFDM = 26,
-        /* 802.11i */
-        WLAN_STATUS_INVALID_IE = 40,
-        WLAN_STATUS_INVALID_GROUP_CIPHER = 41,
-        WLAN_STATUS_INVALID_PAIRWISE_CIPHER = 42,
-        WLAN_STATUS_INVALID_AKMP = 43,
-        WLAN_STATUS_UNSUPP_RSN_VERSION = 44,
-        WLAN_STATUS_INVALID_RSN_IE_CAP = 45,
-        WLAN_STATUS_CIPHER_SUITE_REJECTED = 46,
+	WLAN_STATUS_SUCCESS = 0,
+	WLAN_STATUS_UNSPECIFIED_FAILURE = 1,
+	WLAN_STATUS_CAPS_UNSUPPORTED = 10,
+	WLAN_STATUS_REASSOC_NO_ASSOC = 11,
+	WLAN_STATUS_ASSOC_DENIED_UNSPEC = 12,
+	WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG = 13,
+	WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION = 14,
+	WLAN_STATUS_CHALLENGE_FAIL = 15,
+	WLAN_STATUS_AUTH_TIMEOUT = 16,
+	WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA = 17,
+	WLAN_STATUS_ASSOC_DENIED_RATES = 18,
+	/* 802.11b */
+	WLAN_STATUS_ASSOC_DENIED_NOSHORTPREAMBLE = 19,
+	WLAN_STATUS_ASSOC_DENIED_NOPBCC = 20,
+	WLAN_STATUS_ASSOC_DENIED_NOAGILITY = 21,
+	/* 802.11h */
+	WLAN_STATUS_ASSOC_DENIED_NOSPECTRUM = 22,
+	WLAN_STATUS_ASSOC_REJECTED_BAD_POWER = 23,
+	WLAN_STATUS_ASSOC_REJECTED_BAD_SUPP_CHAN = 24,
+	/* 802.11g */
+	WLAN_STATUS_ASSOC_DENIED_NOSHORTTIME = 25,
+	WLAN_STATUS_ASSOC_DENIED_NODSSSOFDM = 26,
+	/* 802.11i */
+	WLAN_STATUS_INVALID_IE = 40,
+	WLAN_STATUS_INVALID_GROUP_CIPHER = 41,
+	WLAN_STATUS_INVALID_PAIRWISE_CIPHER = 42,
+	WLAN_STATUS_INVALID_AKMP = 43,
+	WLAN_STATUS_UNSUPP_RSN_VERSION = 44,
+	WLAN_STATUS_INVALID_RSN_IE_CAP = 45,
+	WLAN_STATUS_CIPHER_SUITE_REJECTED = 46,
 };
 
 /* Reason codes */
 enum ieee80211_reasoncode {
-        WLAN_REASON_UNSPECIFIED = 1,
-        WLAN_REASON_PREV_AUTH_NOT_VALID = 2,
-        WLAN_REASON_DEAUTH_LEAVING = 3,
-        WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY = 4,
-        WLAN_REASON_DISASSOC_AP_BUSY = 5,
-        WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA = 6,
-        WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA = 7,
-        WLAN_REASON_DISASSOC_STA_HAS_LEFT = 8,
-        WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH = 9,
-        /* 802.11h */
-        WLAN_REASON_DISASSOC_BAD_POWER = 10,
-        WLAN_REASON_DISASSOC_BAD_SUPP_CHAN = 11,
-        /* 802.11i */
-        WLAN_REASON_INVALID_IE = 13,
-        WLAN_REASON_MIC_FAILURE = 14,
-        WLAN_REASON_4WAY_HANDSHAKE_TIMEOUT = 15,
-        WLAN_REASON_GROUP_KEY_HANDSHAKE_TIMEOUT = 16,
-        WLAN_REASON_IE_DIFFERENT = 17,
-        WLAN_REASON_INVALID_GROUP_CIPHER = 18,
-        WLAN_REASON_INVALID_PAIRWISE_CIPHER = 19,
-        WLAN_REASON_INVALID_AKMP = 20,
-        WLAN_REASON_UNSUPP_RSN_VERSION = 21,
-        WLAN_REASON_INVALID_RSN_IE_CAP = 22,
-        WLAN_REASON_IEEE8021X_FAILED = 23,
-        WLAN_REASON_CIPHER_SUITE_REJECTED = 24,
+	WLAN_REASON_UNSPECIFIED = 1,
+	WLAN_REASON_PREV_AUTH_NOT_VALID = 2,
+	WLAN_REASON_DEAUTH_LEAVING = 3,
+	WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY = 4,
+	WLAN_REASON_DISASSOC_AP_BUSY = 5,
+	WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA = 6,
+	WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA = 7,
+	WLAN_REASON_DISASSOC_STA_HAS_LEFT = 8,
+	WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH = 9,
+	/* 802.11h */
+	WLAN_REASON_DISASSOC_BAD_POWER = 10,
+	WLAN_REASON_DISASSOC_BAD_SUPP_CHAN = 11,
+	/* 802.11i */
+	WLAN_REASON_INVALID_IE = 13,
+	WLAN_REASON_MIC_FAILURE = 14,
+	WLAN_REASON_4WAY_HANDSHAKE_TIMEOUT = 15,
+	WLAN_REASON_GROUP_KEY_HANDSHAKE_TIMEOUT = 16,
+	WLAN_REASON_IE_DIFFERENT = 17,
+	WLAN_REASON_INVALID_GROUP_CIPHER = 18,
+	WLAN_REASON_INVALID_PAIRWISE_CIPHER = 19,
+	WLAN_REASON_INVALID_AKMP = 20,
+	WLAN_REASON_UNSUPP_RSN_VERSION = 21,
+	WLAN_REASON_INVALID_RSN_IE_CAP = 22,
+	WLAN_REASON_IEEE8021X_FAILED = 23,
+	WLAN_REASON_CIPHER_SUITE_REJECTED = 24,
 };
 
 #define IEEE80211_STATMASK_SIGNAL (1<<0)
@@ -849,13 +849,13 @@ enum ieee80211_reasoncode {
 #define IEEE80211_52GHZ_BAND     (1<<1)
 
 #define IEEE80211_CCK_RATE_LEN  		4
-#define IEEE80211_CCK_RATE_1MB		        0x02
-#define IEEE80211_CCK_RATE_2MB		        0x04
-#define IEEE80211_CCK_RATE_5MB		        0x0B
-#define IEEE80211_CCK_RATE_11MB		        0x16
+#define IEEE80211_CCK_RATE_1MB			0x02
+#define IEEE80211_CCK_RATE_2MB			0x04
+#define IEEE80211_CCK_RATE_5MB			0x0B
+#define IEEE80211_CCK_RATE_11MB			0x16
 #define IEEE80211_OFDM_RATE_LEN 		8
-#define IEEE80211_OFDM_RATE_6MB		        0x0C
-#define IEEE80211_OFDM_RATE_9MB		        0x12
+#define IEEE80211_OFDM_RATE_6MB			0x0C
+#define IEEE80211_OFDM_RATE_9MB			0x12
 #define IEEE80211_OFDM_RATE_12MB		0x18
 #define IEEE80211_OFDM_RATE_18MB		0x24
 #define IEEE80211_OFDM_RATE_24MB		0x30
@@ -877,12 +877,12 @@ enum ieee80211_reasoncode {
 #define IEEE80211_OFDM_RATE_48MB_MASK		(1<<10)
 #define IEEE80211_OFDM_RATE_54MB_MASK		(1<<11)
 
-#define IEEE80211_CCK_RATES_MASK	        0x0000000F
+#define IEEE80211_CCK_RATES_MASK		0x0000000F
 #define IEEE80211_CCK_BASIC_RATES_MASK	(IEEE80211_CCK_RATE_1MB_MASK | \
 	IEEE80211_CCK_RATE_2MB_MASK)
 #define IEEE80211_CCK_DEFAULT_RATES_MASK	(IEEE80211_CCK_BASIC_RATES_MASK | \
-        IEEE80211_CCK_RATE_5MB_MASK | \
-        IEEE80211_CCK_RATE_11MB_MASK)
+	IEEE80211_CCK_RATE_5MB_MASK | \
+	IEEE80211_CCK_RATE_11MB_MASK)
 
 #define IEEE80211_OFDM_RATES_MASK		0x00000FF0
 #define IEEE80211_OFDM_BASIC_RATES_MASK	(IEEE80211_OFDM_RATE_6MB_MASK | \
@@ -895,10 +895,10 @@ enum ieee80211_reasoncode {
 	IEEE80211_OFDM_RATE_48MB_MASK | \
 	IEEE80211_OFDM_RATE_54MB_MASK)
 #define IEEE80211_DEFAULT_RATES_MASK (IEEE80211_OFDM_DEFAULT_RATES_MASK | \
-                                IEEE80211_CCK_DEFAULT_RATES_MASK)
+				IEEE80211_CCK_DEFAULT_RATES_MASK)
 
 #define IEEE80211_NUM_OFDM_RATES	    8
-#define IEEE80211_NUM_CCK_RATES	            4
+#define IEEE80211_NUM_CCK_RATES		    4
 #define IEEE80211_OFDM_SHIFT_MASK_A         4
 
 
@@ -911,7 +911,7 @@ enum ieee80211_reasoncode {
 #define IEEE80211_QOS_HAS_SEQ(fc) \
 	(((fc) & (IEEE80211_FC0_TYPE_MASK | IEEE80211_FC0_SUBTYPE_MASK)) == \
 	 (IEEE80211_FC0_TYPE_DATA | IEEE80211_FC0_SUBTYPE_QOS))
-	
+
 /* this is stolen from ipw2200 driver */
 #define IEEE_IBSS_MAC_HASH_SIZE 31
 struct ieee_ibss_seq {
@@ -942,7 +942,7 @@ struct ieee80211_rx_stats {
 	u8 nic_type;
 	u16       Length;
 	//      u8        DataRate;      // In 0.5 Mbps
-	u8        SignalQuality; // in 0-100 index. 
+	u8        SignalQuality; // in 0-100 index.
 	s32       RecvSignalPower; // Real power in dBm for this packet, no beautification and aggregation.
 	s8        RxPower; // in dBm Translate from PWdB
 	u8        SignalStrength; // in 0-100 index.
@@ -1064,10 +1064,10 @@ struct ieee80211_device;
 
 struct ieee80211_security {
 	u16 active_key:2,
-            enabled:1,
+	    enabled:1,
 	    auth_mode:2,
-            auth_algo:4,
-            unicast_uses_group:1,
+	    auth_algo:4,
+	    unicast_uses_group:1,
 	    encrypt:1;
 	u8 key_sizes[WEP_KEYS];
 	u8 keys[WEP_KEYS][SCM_KEY_LEN];
@@ -1089,60 +1089,60 @@ Total: 28-2340 bytes
 
 /* Management Frame Information Element Types */
 enum ieee80211_mfie {
-        MFIE_TYPE_SSID = 0,
-        MFIE_TYPE_RATES = 1,
-        MFIE_TYPE_FH_SET = 2,
-        MFIE_TYPE_DS_SET = 3,
-        MFIE_TYPE_CF_SET = 4,
-        MFIE_TYPE_TIM = 5,
-        MFIE_TYPE_IBSS_SET = 6,
-        MFIE_TYPE_COUNTRY = 7,
-        MFIE_TYPE_HOP_PARAMS = 8,
-        MFIE_TYPE_HOP_TABLE = 9,
-        MFIE_TYPE_REQUEST = 10,
-        MFIE_TYPE_CHALLENGE = 16,
-        MFIE_TYPE_POWER_CONSTRAINT = 32,
-        MFIE_TYPE_POWER_CAPABILITY = 33,
-        MFIE_TYPE_TPC_REQUEST = 34,
-        MFIE_TYPE_TPC_REPORT = 35,
-        MFIE_TYPE_SUPP_CHANNELS = 36,
-        MFIE_TYPE_CSA = 37,
-        MFIE_TYPE_MEASURE_REQUEST = 38,
-        MFIE_TYPE_MEASURE_REPORT = 39,
-        MFIE_TYPE_QUIET = 40,
-        MFIE_TYPE_IBSS_DFS = 41,
-        MFIE_TYPE_ERP = 42,
-        MFIE_TYPE_RSN = 48,
-        MFIE_TYPE_RATES_EX = 50,
-        MFIE_TYPE_HT_CAP= 45,
+	MFIE_TYPE_SSID = 0,
+	MFIE_TYPE_RATES = 1,
+	MFIE_TYPE_FH_SET = 2,
+	MFIE_TYPE_DS_SET = 3,
+	MFIE_TYPE_CF_SET = 4,
+	MFIE_TYPE_TIM = 5,
+	MFIE_TYPE_IBSS_SET = 6,
+	MFIE_TYPE_COUNTRY = 7,
+	MFIE_TYPE_HOP_PARAMS = 8,
+	MFIE_TYPE_HOP_TABLE = 9,
+	MFIE_TYPE_REQUEST = 10,
+	MFIE_TYPE_CHALLENGE = 16,
+	MFIE_TYPE_POWER_CONSTRAINT = 32,
+	MFIE_TYPE_POWER_CAPABILITY = 33,
+	MFIE_TYPE_TPC_REQUEST = 34,
+	MFIE_TYPE_TPC_REPORT = 35,
+	MFIE_TYPE_SUPP_CHANNELS = 36,
+	MFIE_TYPE_CSA = 37,
+	MFIE_TYPE_MEASURE_REQUEST = 38,
+	MFIE_TYPE_MEASURE_REPORT = 39,
+	MFIE_TYPE_QUIET = 40,
+	MFIE_TYPE_IBSS_DFS = 41,
+	MFIE_TYPE_ERP = 42,
+	MFIE_TYPE_RSN = 48,
+	MFIE_TYPE_RATES_EX = 50,
+	MFIE_TYPE_HT_CAP= 45,
 	 MFIE_TYPE_HT_INFO= 61,
 	 MFIE_TYPE_AIRONET=133,
-        MFIE_TYPE_GENERIC = 221,
-        MFIE_TYPE_QOS_PARAMETER = 222,
+	MFIE_TYPE_GENERIC = 221,
+	MFIE_TYPE_QOS_PARAMETER = 222,
 };
 
 /* Minimal header; can be used for passing 802.11 frames with sufficient
  * information to determine what type of underlying data type is actually
  * stored in the data. */
 struct ieee80211_hdr {
-        __le16 frame_ctl;
-        __le16 duration_id;
-        u8 payload[0];
+	__le16 frame_ctl;
+	__le16 duration_id;
+	u8 payload[0];
 } __attribute__ ((packed));
 
 struct ieee80211_hdr_1addr {
-        __le16 frame_ctl;
-        __le16 duration_id;
-        u8 addr1[ETH_ALEN];
-        u8 payload[0];
+	__le16 frame_ctl;
+	__le16 duration_id;
+	u8 addr1[ETH_ALEN];
+	u8 payload[0];
 } __attribute__ ((packed));
 
 struct ieee80211_hdr_2addr {
-        __le16 frame_ctl;
-        __le16 duration_id;
-        u8 addr1[ETH_ALEN];
-        u8 addr2[ETH_ALEN];
-        u8 payload[0];
+	__le16 frame_ctl;
+	__le16 duration_id;
+	u8 addr1[ETH_ALEN];
+	u8 addr2[ETH_ALEN];
+	u8 payload[0];
 } __attribute__ ((packed));
 
 struct ieee80211_hdr_3addr {
@@ -1152,7 +1152,7 @@ struct ieee80211_hdr_3addr {
 	u8 addr2[ETH_ALEN];
 	u8 addr3[ETH_ALEN];
 	__le16 seq_ctl;
-        u8 payload[0];
+	u8 payload[0];
 } __attribute__ ((packed));
 
 struct ieee80211_hdr_4addr {
@@ -1163,7 +1163,7 @@ struct ieee80211_hdr_4addr {
 	u8 addr3[ETH_ALEN];
 	__le16 seq_ctl;
 	u8 addr4[ETH_ALEN];
-        u8 payload[0];
+	u8 payload[0];
 } __attribute__ ((packed));
 
 struct ieee80211_hdr_3addrqos {
@@ -1173,7 +1173,7 @@ struct ieee80211_hdr_3addrqos {
 	u8 addr2[ETH_ALEN];
 	u8 addr3[ETH_ALEN];
 	__le16 seq_ctl;
-        u8 payload[0];
+	u8 payload[0];
 	__le16 qos_ctl;
 } __attribute__ ((packed));
 
@@ -1185,7 +1185,7 @@ struct ieee80211_hdr_4addrqos {
 	u8 addr3[ETH_ALEN];
 	__le16 seq_ctl;
 	u8 addr4[ETH_ALEN];
-        u8 payload[0];
+	u8 payload[0];
 	__le16 qos_ctl;
 } __attribute__ ((packed));
 
@@ -1205,14 +1205,14 @@ struct ieee80211_authentication {
 } __attribute__ ((packed));
 
 struct ieee80211_disassoc {
-        struct ieee80211_hdr_3addr header;
-        __le16 reason;
+	struct ieee80211_hdr_3addr header;
+	__le16 reason;
 } __attribute__ ((packed));
 
 struct ieee80211_probe_request {
 	struct ieee80211_hdr_3addr header;
 	/* SSID, supported rates */
-        struct ieee80211_info_element info_element[0];
+	struct ieee80211_info_element info_element[0];
 } __attribute__ ((packed));
 
 struct ieee80211_probe_response {
@@ -1220,9 +1220,9 @@ struct ieee80211_probe_response {
 	u32 time_stamp[2];
 	__le16 beacon_interval;
 	__le16 capability;
-        /* SSID, supported rates, FH params, DS params,
-         * CF params, IBSS params, TIM (if beacon), RSN */
-        struct ieee80211_info_element info_element[0];
+	/* SSID, supported rates, FH params, DS params,
+	 * CF params, IBSS params, TIM (if beacon), RSN */
+	struct ieee80211_info_element info_element[0];
 } __attribute__ ((packed));
 
 /* Alias beacon for probe_response */
@@ -1233,7 +1233,7 @@ struct ieee80211_assoc_request_frame {
 	__le16 capability;
 	__le16 listen_interval;
 	/* SSID, supported rates, RSN */
-        struct ieee80211_info_element info_element[0];
+	struct ieee80211_info_element info_element[0];
 } __attribute__ ((packed));
 
 struct ieee80211_reassoc_request_frame {
@@ -1242,7 +1242,7 @@ struct ieee80211_reassoc_request_frame {
 	__le16 listen_interval;
 	u8 current_ap[ETH_ALEN];
 	/* SSID, supported rates, RSN */
-        struct ieee80211_info_element info_element[0];
+	struct ieee80211_info_element info_element[0];
 } __attribute__ ((packed));
 
 struct ieee80211_assoc_response_frame {
@@ -1318,7 +1318,7 @@ typedef union _frameqos {
 #define NETWORK_HAS_QOS_PARAMETERS      (1<<3)
 #define NETWORK_HAS_QOS_INFORMATION     (1<<4)
 #define NETWORK_HAS_QOS_MASK            (NETWORK_HAS_QOS_PARAMETERS | \
-                                         NETWORK_HAS_QOS_INFORMATION)
+					 NETWORK_HAS_QOS_INFORMATION)
 /* 802.11h */
 #define NETWORK_HAS_POWER_CONSTRAINT    (1<<5)
 #define NETWORK_HAS_CSA                 (1<<6)
@@ -1338,46 +1338,46 @@ typedef union _frameqos {
 #define QOS_AIFSN_MIN_VALUE             2
 #if 1
 struct ieee80211_qos_information_element {
-        u8 elementID;
-        u8 length;
-        u8 qui[QOS_OUI_LEN];
-        u8 qui_type;
-        u8 qui_subtype;
-        u8 version;
-        u8 ac_info;
+	u8 elementID;
+	u8 length;
+	u8 qui[QOS_OUI_LEN];
+	u8 qui_type;
+	u8 qui_subtype;
+	u8 version;
+	u8 ac_info;
 } __attribute__ ((packed));
 
 struct ieee80211_qos_ac_parameter {
-        u8 aci_aifsn;
-        u8 ecw_min_max;
-        __le16 tx_op_limit;
+	u8 aci_aifsn;
+	u8 ecw_min_max;
+	__le16 tx_op_limit;
 } __attribute__ ((packed));
 
 struct ieee80211_qos_parameter_info {
-        struct ieee80211_qos_information_element info_element;
-        u8 reserved;
-        struct ieee80211_qos_ac_parameter ac_params_record[QOS_QUEUE_NUM];
+	struct ieee80211_qos_information_element info_element;
+	u8 reserved;
+	struct ieee80211_qos_ac_parameter ac_params_record[QOS_QUEUE_NUM];
 } __attribute__ ((packed));
 
 struct ieee80211_qos_parameters {
-        __le16 cw_min[QOS_QUEUE_NUM];
-        __le16 cw_max[QOS_QUEUE_NUM];
-        u8 aifs[QOS_QUEUE_NUM];
-        u8 flag[QOS_QUEUE_NUM];
-        __le16 tx_op_limit[QOS_QUEUE_NUM];
+	__le16 cw_min[QOS_QUEUE_NUM];
+	__le16 cw_max[QOS_QUEUE_NUM];
+	u8 aifs[QOS_QUEUE_NUM];
+	u8 flag[QOS_QUEUE_NUM];
+	__le16 tx_op_limit[QOS_QUEUE_NUM];
 } __attribute__ ((packed));
 
 struct ieee80211_qos_data {
-        struct ieee80211_qos_parameters parameters;
-        int active;
-        int supported;
-        u8 param_count;
-        u8 old_param_count;
+	struct ieee80211_qos_parameters parameters;
+	int active;
+	int supported;
+	u8 param_count;
+	u8 old_param_count;
 };
 
 struct ieee80211_tim_parameters {
-        u8 tim_count;
-        u8 tim_period;
+	u8 tim_count;
+	u8 tim_period;
 } __attribute__ ((packed));
 
 //#else
@@ -1533,14 +1533,14 @@ enum {WMM_all_frame, WMM_two_frame, WMM_four_frame, WMM_six_frame};
 #define MAX_RECEIVE_BUFFER_SIZE 9100
 
 //UP Mapping to AC, using in MgntQuery_SequenceNumber() and maybe for DSCP
-//#define UP2AC(up)	((up<3) ? ((up==0)?1:0) : (up>>1)) 
+//#define UP2AC(up)	((up<3) ? ((up==0)?1:0) : (up>>1))
 #if 1
 #define UP2AC(up) (		   \
 	((up) < 1) ? WME_AC_BE : \
 	((up) < 3) ? WME_AC_BK : \
 	((up) < 4) ? WME_AC_BE : \
 	((up) < 6) ? WME_AC_VI : \
-	WME_AC_VO)	
+	WME_AC_VO)
 #endif
 //AC Mapping to UP, using in Tx part for selecting the corresponding TX queue
 #define AC2UP(_ac)	(       \
@@ -1556,7 +1556,7 @@ struct	ether_header {
 	u8 ether_dhost[ETHER_ADDR_LEN];
 	u8 ether_shost[ETHER_ADDR_LEN];
 	u16 ether_type;
-} __attribute__((packed)); 
+} __attribute__((packed));
 
 #ifndef ETHERTYPE_PAE
 #define	ETHERTYPE_PAE	0x888e		/* EAPOL PAE/802.1x */
@@ -1598,10 +1598,10 @@ struct ieee80211_network {
 	u8 ssid[IW_ESSID_MAX_SIZE + 1];
 	u8 ssid_len;
 #if 1
-        struct ieee80211_qos_data qos_data;
+	struct ieee80211_qos_data qos_data;
 #else
        // Qos related. Added by Annie, 2005-11-01.
-        BSS_QOS   BssQos;
+	BSS_QOS   BssQos;
 #endif
 
 	//added by amy for LEAP
@@ -1637,15 +1637,15 @@ struct ieee80211_network {
 	u8  rsn_ie[MAX_WPA_IE_LEN];
 	size_t rsn_ie_len;
 
-        struct ieee80211_tim_parameters tim;
+	struct ieee80211_tim_parameters tim;
 	u8  dtim_period;
 	u8  dtim_data;
 	u32 last_dtim_sta_time[2];
 
-        //appeded for QoS
-        u8 wmm_info;
-        struct ieee80211_wmm_ac_param wmm_param[4];
-        u8 QoS_Enable;
+	//appeded for QoS
+	u8 wmm_info;
+	struct ieee80211_wmm_ac_param wmm_param[4];
+	u8 QoS_Enable;
 #ifdef THOMAS_TURBO
 	u8 Turbo_Enable;//enable turbo mode, added by thomas
 #endif
@@ -1653,7 +1653,7 @@ struct ieee80211_network {
 	u16 CountryIeLen;
 	u8 CountryIeBuf[MAX_IE_LEN];
 #endif
-        // HT Related, by amy, 2008.04.29
+	// HT Related, by amy, 2008.04.29
 	BSS_HT	bssht;
 	// Add to handle broadcom AP management frame CCK rate.
 	bool broadcom_cap_exist;
@@ -1673,7 +1673,7 @@ enum ieee80211_state {
 
 	/* the card is not linked at all */
 	IEEE80211_NOLINK = 0,
-	
+
 	/* IEEE80211_ASSOCIATING* are for BSS client mode
 	 * the driver shall not perform RX filtering unless
 	 * the state is LINKED.
@@ -1681,41 +1681,41 @@ enum ieee80211_state {
 	 * defaults to NOLINK for ALL the other states (including
 	 * LINKED_SCANNING)
 	 */
-	
+
 	/* the association procedure will start (wq scheduling)*/
 	IEEE80211_ASSOCIATING,
 	IEEE80211_ASSOCIATING_RETRY,
-	
+
 	/* the association procedure is sending AUTH request*/
 	IEEE80211_ASSOCIATING_AUTHENTICATING,
-	
+
 	/* the association procedure has successfully authentcated
 	 * and is sending association request
 	 */
 	IEEE80211_ASSOCIATING_AUTHENTICATED,
-	
+
 	/* the link is ok. the card associated to a BSS or linked
 	 * to a ibss cell or acting as an AP and creating the bss
 	 */
 	IEEE80211_LINKED,
-	
+
 	/* same as LINKED, but the driver shall apply RX filter
 	 * rules as we are in NO_LINK mode. As the card is still
 	 * logically linked, but it is doing a syncro site survey
 	 * then it will be back to LINKED state.
 	 */
 	IEEE80211_LINKED_SCANNING,
-	
+
 };
 #else
 enum ieee80211_state {
-        IEEE80211_UNINITIALIZED = 0,
-        IEEE80211_INITIALIZED,
-        IEEE80211_ASSOCIATING,
-        IEEE80211_ASSOCIATED,
-        IEEE80211_AUTHENTICATING,
-        IEEE80211_AUTHENTICATED,
-        IEEE80211_SHUTDOWN
+	IEEE80211_UNINITIALIZED = 0,
+	IEEE80211_INITIALIZED,
+	IEEE80211_ASSOCIATING,
+	IEEE80211_ASSOCIATED,
+	IEEE80211_AUTHENTICATING,
+	IEEE80211_AUTHENTICATED,
+	IEEE80211_SHUTDOWN
 };
 #endif
 
@@ -1729,17 +1729,17 @@ enum ieee80211_state {
 #define IEEE80211_24GHZ_MIN_CHANNEL 1
 #define IEEE80211_24GHZ_MAX_CHANNEL 14
 #define IEEE80211_24GHZ_CHANNELS (IEEE80211_24GHZ_MAX_CHANNEL - \
-                                  IEEE80211_24GHZ_MIN_CHANNEL + 1)
+				  IEEE80211_24GHZ_MIN_CHANNEL + 1)
 
 #define IEEE80211_52GHZ_MIN_CHANNEL 34
 #define IEEE80211_52GHZ_MAX_CHANNEL 165
 #define IEEE80211_52GHZ_CHANNELS (IEEE80211_52GHZ_MAX_CHANNEL - \
-                                  IEEE80211_52GHZ_MIN_CHANNEL + 1)
+				  IEEE80211_52GHZ_MIN_CHANNEL + 1)
 
 #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,11))
 extern inline int is_multicast_ether_addr(const u8 *addr)
 {
-        return ((addr[0] != 0xff) && (0x01 & addr[0]));
+	return ((addr[0] != 0xff) && (0x01 & addr[0]));
 }
 #endif
 
@@ -1759,9 +1759,9 @@ typedef struct tx_pending_t{
 typedef struct _bandwidth_autoswitch
 {
 	long threshold_20Mhzto40Mhz;
-	long	threshold_40Mhzto20Mhz;	
+	long	threshold_40Mhzto20Mhz;
 	bool bforced_tx20Mhz;
-	bool bautoswitch_enable;	
+	bool bautoswitch_enable;
 }bandwidth_autoswitch,*pbandwidth_autoswitch;
 
 
@@ -1780,10 +1780,10 @@ typedef enum _Fsync_State{
 	Default_Fsync,
 	HW_Fsync,
 	SW_Fsync
-}Fsync_State;	
+}Fsync_State;
 
-// Power save mode configured. 
-typedef	enum _RT_PS_MODE	
+// Power save mode configured.
+typedef	enum _RT_PS_MODE
 {
 	eActive,	// Active/Continuous access.
 	eMaxPs,		// Max power save mode.
@@ -1836,7 +1836,7 @@ typedef struct _RT_POWER_SAVE_CONTROL
 
 	// Return point for join action
 	IPS_CALLBACK_FUNCION	ReturnPoint;
-	
+
 	// Recored Parameters for rescheduled JoinRequest
 	bool				bTmpBssDesc;
 	RT_JOIN_ACTION		tmpJoinAction;
@@ -1863,9 +1863,9 @@ typedef struct _RT_POWER_SAVE_CONTROL
 
 	//
 	// Leisre Poswer Save : Disable RF if connected but traffic is not busy
-	//		
+	//
 	bool				bLeisurePs;
-	
+
 }RT_POWER_SAVE_CONTROL,*PRT_POWER_SAVE_CONTROL;
 
 typedef u32 RT_RF_CHANGE_SOURCE;
@@ -1876,7 +1876,7 @@ typedef u32 RT_RF_CHANGE_SOURCE;
 #define RF_CHANGE_BY_INIT	0	// Do not change the RFOff reason. Defined by Bruce, 2008-01-17.
 
 #ifdef ENABLE_DOT11D
-typedef enum 
+typedef enum
 {
 	COUNTRY_CODE_FCC = 0,
 	COUNTRY_CODE_IC = 1,
@@ -1889,7 +1889,7 @@ typedef enum
 	COUNTRY_CODE_TELEC,
 	COUNTRY_CODE_MIC,
 	COUNTRY_CODE_GLOBAL_DOMAIN
-}country_code_type_t;	
+}country_code_type_t;
 #endif
 
 #define RT_MAX_LD_SLOT_NUM	10
@@ -1911,13 +1911,13 @@ typedef struct _RT_LINK_DETECT_T{
 
 struct ieee80211_device {
 	struct net_device *dev;
-        struct ieee80211_security sec;
+	struct ieee80211_security sec;
 
 	//hw security related
 //	u8 hwsec_support; //support?
 	u8 hwsec_active;  //hw security active.
 	bool is_silent_reset;
-	bool ieee_up;	
+	bool ieee_up;
 	//added by amy
 	bool bSupportRemoteWakeUp;
 	RT_PS_MODE	dot11PowerSaveMode; // Power save mode configured.
@@ -1927,7 +1927,7 @@ struct ieee80211_device {
 	RT_RF_CHANGE_SOURCE	RfOffReason;
 	bool is_set_key;
 	//11n spec related I wonder if These info structure need to be moved out of ieee80211_device
-	
+
 	//11n HT below
 	PRT_HIGH_THROUGHPUT	pHTInfo;
 	//struct timer_list		SwBwTimer;
@@ -1967,13 +1967,13 @@ struct ieee80211_device {
 	// Qos related. Added by Annie, 2005-11-01.
 //	PSTA_QOS			pStaQos;
 	u8				ForcedPriority;		// Force per-packet priority 1~7. (default: 0, not to force it.)
-	
+
 
 	/* Bookkeeping structures */
 	struct net_device_stats stats;
 	struct ieee80211_stats ieee_stats;
 	struct ieee80211_softmac_stats softmac_stats;
-	
+
 	/* Probe / Beacon management */
 	struct list_head network_free_list;
 	struct list_head network_list;
@@ -1982,11 +1982,11 @@ struct ieee80211_device {
 	int scan_age;
 
 	int iw_mode; /* operating mode (IW_MODE_*) */
-	struct iw_spy_data spy_data; 
+	struct iw_spy_data spy_data;
 
 	spinlock_t lock;
 	spinlock_t wpax_suitlist_lock;
-	
+
 	int tx_headroom; /* Set to size of any additional room needed at front
 			  * of allocated Tx SKBs */
 	u32 config;
@@ -2001,15 +2001,15 @@ struct ieee80211_device {
 	int host_encrypt;
 	int host_encrypt_msdu;
 	int host_decrypt;
-        /* host performs multicast decryption */
-        int host_mc_decrypt;
+	/* host performs multicast decryption */
+	int host_mc_decrypt;
 
-        /* host should strip IV and ICV from protected frames */
-        /* meaningful only when hardware decryption is being used */
-        int host_strip_iv_icv;
+	/* host should strip IV and ICV from protected frames */
+	/* meaningful only when hardware decryption is being used */
+	int host_strip_iv_icv;
 
-        int host_open_frag;
-        int host_build_iv;
+	int host_open_frag;
+	int host_build_iv;
 	int ieee802_1x; /* is IEEE 802.1X used */
 
 	/* WPA data */
@@ -2027,7 +2027,7 @@ struct ieee80211_device {
 	struct ieee80211_crypt_data *crypt[WEP_KEYS];
 	int tx_keyidx; /* default TX key index (crypt[tx_keyidx]) */
 	struct timer_list crypt_deinit_timer;
-        int crypt_quiesced;
+	int crypt_quiesced;
 
 	int bcrx_sta_key; /* use individual keys to override default keys even
 			   * with RX of broad/multicast frames */
@@ -2040,10 +2040,10 @@ struct ieee80211_device {
 #define DEFAULT_RTS_THRESHOLD 2346U
 #define MIN_RTS_THRESHOLD 1
 #define MAX_RTS_THRESHOLD 2346U
-        u16 rts; /* RTS threshold */
+	u16 rts; /* RTS threshold */
 
-        /* Association info */
-        u8 bssid[ETH_ALEN];
+	/* Association info */
+	u8 bssid[ETH_ALEN];
 
 	/* This stores infos for the current network.
 	 * Either the network we are associated in INFRASTRUCTURE
@@ -2051,7 +2051,7 @@ struct ieee80211_device {
 	 * ad-hoc is a mixture ;-).
 	 * Note that in infrastructure mode, even when not associated,
 	 * fields bssid and essid may be valid (if wpa_set and essid_set
-	 * are true) as thy carry the value set by the user via iwconfig  
+	 * are true) as thy carry the value set by the user via iwconfig
 	 */
 	struct ieee80211_network current_network;
 
@@ -2063,16 +2063,16 @@ struct ieee80211_device {
 	int modulation; /* CCK, OFDM */
 	int freq_band;  /* 2.4Ghz, 5.2Ghz, Mixed */
 	int abg_true;   /* ABG flag              */
-	
-	/* used for forcing the ibss workqueue to terminate 
+
+	/* used for forcing the ibss workqueue to terminate
 	 * without wait for the syncro scan to terminate
 	 */
-	short sync_scan_hurryup; 
-	
-        int perfect_rssi;
-        int worst_rssi;
+	short sync_scan_hurryup;
+
+	int perfect_rssi;
+	int worst_rssi;
 
-        u16 prev_seq_ctl;       /* used to drop duplicate frames */
+	u16 prev_seq_ctl;       /* used to drop duplicate frames */
 
 	/* map of allowed channels. 0 is dummy */
 	// FIXME: remeber to default to a basic channel plan depending of the PHY type
@@ -2081,24 +2081,24 @@ struct ieee80211_device {
 	bool bGlobalDomain;
 #else
 	int channel_map[MAX_CHANNEL_NUMBER+1];
-#endif	
+#endif
 	int rate;       /* current rate */
 	int basic_rate;
 	//FIXME: pleace callback, see if redundant with softmac_features
 	short active_scan;
-	
+
 	/* this contains flags for selectively enable softmac support */
 	u16 softmac_features;
-	
+
 	/* if the sequence control field is not filled by HW */
 	u16 seq_ctrl[5];
-	
+
 	/* association procedure transaction sequence number */
 	u16 associate_seq;
-	
+
 	/* AID for RTXed association responses */
 	u16 assoc_id;
-	
+
 	/* power save mode related*/
 	short ps;
 	short sta_sleep;
@@ -2107,24 +2107,24 @@ struct ieee80211_device {
 	struct tasklet_struct ps_task;
 	u32 ps_th;
 	u32 ps_tl;
-	
+
 	short raw_tx;
 	/* used if IEEE_SOFTMAC_TX_QUEUE is set */
 	short queue_stop;
 	short scanning;
 	short proto_started;
-	
+
 	struct semaphore wx_sem;
 	struct semaphore scan_sem;
-	
-	spinlock_t mgmt_tx_lock;	
+
+	spinlock_t mgmt_tx_lock;
 	spinlock_t beacon_lock;
 
 	short beacon_txing;
 
 	short wap_set;
 	short ssid_set;
-	
+
 	u8  wpax_type_set;    //{added by David, 2006.9.28}
 	u32 wpax_type_notify; //{added by David, 2006.9.26}
 
@@ -2132,18 +2132,18 @@ struct ieee80211_device {
 	char init_wmmparam_flag;
 	/* set on initialization */
 	u8  qos_support;
-	
+
 	/* for discarding duplicated packets in IBSS */
 	struct list_head ibss_mac_hash[IEEE_IBSS_MAC_HASH_SIZE];
-	
+
 	/* for discarding duplicated packets in BSS */
 	u16 last_rxseq_num[17]; /* rx seq previous per-tid */
 	u16 last_rxfrag_num[17];/* tx frag previous per-tid */
 	unsigned long last_packet_time[17];
-	
+
 	/* for PS mode */
 	unsigned long last_rx_ps_time;
-	
+
 	/* used if IEEE_SOFTMAC_SINGLE_QUEUE is set */
 	struct sk_buff *mgmt_queue_ring[MGMT_QUEUE_NUM];
 	int mgmt_queue_head;
@@ -2153,8 +2153,8 @@ struct ieee80211_device {
 	u8 AsocRetryCount;
 	unsigned int hw_header;
 	struct sk_buff_head skb_waitQ[MAX_QUEUE_SIZE];
-	struct sk_buff_head  skb_aggQ[MAX_QUEUE_SIZE]; 
-	struct sk_buff_head  skb_drv_aggQ[MAX_QUEUE_SIZE]; 
+	struct sk_buff_head  skb_aggQ[MAX_QUEUE_SIZE];
+	struct sk_buff_head  skb_drv_aggQ[MAX_QUEUE_SIZE];
 	u32	sta_edca_param[4];
 	bool aggregation;
 	// Enable/Disable Rx immediate BA capability.
@@ -2163,17 +2163,17 @@ struct ieee80211_device {
 
 	//+by amy for DM ,080515
 	//Dynamic Tx power for near/far range enable/Disable  , by amy , 2008-05-15
-	bool	bdynamic_txpower_enable; 
+	bool	bdynamic_txpower_enable;
 
 	bool bCTSToSelfEnable;
 	u8 	CTSToSelfTH;
-	
+
 	u32 	fsync_time_interval;
 	u32	fsync_rate_bitmap;
 	u8	fsync_rssi_threshold;
 	bool	bfsync_enable;
 
-	u8	fsync_multiple_timeinterval;		// FsyncMultipleTimeInterval * FsyncTimeInterval	 
+	u8	fsync_multiple_timeinterval;		// FsyncMultipleTimeInterval * FsyncTimeInterval
 	u32	fsync_firstdiff_ratethreshold;		// low threshold
 	u32	fsync_seconddiff_ratethreshold;	 // decrease threshold
 	Fsync_State			fsync_state;
@@ -2185,31 +2185,31 @@ struct ieee80211_device {
 
 	//added by amy for AP roaming
 	RT_LINK_DETECT_T	LinkDetectInfo;
-        //added by amy for ps
+	//added by amy for ps
 	RT_POWER_SAVE_CONTROL	PowerSaveControl;
-//}	
+//}
 	/* used if IEEE_SOFTMAC_TX_QUEUE is set */
 	struct  tx_pending_t tx_pending;
-	
+
 	/* used if IEEE_SOFTMAC_ASSOCIATE is set */
 	struct timer_list associate_timer;
 
 	/* used if IEEE_SOFTMAC_BEACONS is set */
 	struct timer_list beacon_timer;
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)  
-        struct work_struct associate_complete_wq;
-        struct work_struct associate_procedure_wq;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)        
-        struct delayed_work softmac_scan_wq;
-        struct delayed_work associate_retry_wq;
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
+	struct work_struct associate_complete_wq;
+	struct work_struct associate_procedure_wq;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
+	struct delayed_work softmac_scan_wq;
+	struct delayed_work associate_retry_wq;
 	 struct delayed_work start_ibss_wq;
 #else
-        struct work_struct softmac_scan_wq;
-        struct work_struct associate_retry_wq;
+	struct work_struct softmac_scan_wq;
+	struct work_struct associate_retry_wq;
 	struct work_struct start_ibss_wq;
 #endif
-        struct work_struct wx_sync_scan_wq;
-        struct workqueue_struct *wq;
+	struct work_struct wx_sync_scan_wq;
+	struct workqueue_struct *wq;
 #else
 	/* used for periodly scan */
 	struct timer_list scan_timer;
@@ -2222,100 +2222,100 @@ struct ieee80211_device {
 	struct tq_struct wx_sync_scan_wq;
 
 #endif
-        // Qos related. Added by Annie, 2005-11-01.
-        //STA_QOS  StaQos;
+	// Qos related. Added by Annie, 2005-11-01.
+	//STA_QOS  StaQos;
 
-        //u32 STA_EDCA_PARAM[4];
+	//u32 STA_EDCA_PARAM[4];
 	//CHANNEL_ACCESS_SETTING ChannelAccessSetting;
 
 
 	/* Callback functions */
 	void (*set_security)(struct net_device *dev,
 			     struct ieee80211_security *sec);
-	
+
 	/* Used to TX data frame by using txb structs.
 	 * this is not used if in the softmac_features
 	 * is set the flag IEEE_SOFTMAC_TX_QUEUE
 	 */
 	int (*hard_start_xmit)(struct ieee80211_txb *txb,
 			       struct net_device *dev);
-	
+
 	int (*reset_port)(struct net_device *dev);
-        int (*is_queue_full) (struct net_device * dev, int pri);
+	int (*is_queue_full) (struct net_device * dev, int pri);
 
-        int (*handle_management) (struct net_device * dev,
-                                  struct ieee80211_network * network, u16 type);
-        int (*is_qos_active) (struct net_device *dev, struct sk_buff *skb);
+	int (*handle_management) (struct net_device * dev,
+				  struct ieee80211_network * network, u16 type);
+	int (*is_qos_active) (struct net_device *dev, struct sk_buff *skb);
 
-	/* Softmac-generated frames (mamagement) are TXed via this 
-	 * callback if the flag IEEE_SOFTMAC_SINGLE_QUEUE is 
-	 * not set. As some cards may have different HW queues that 
+	/* Softmac-generated frames (mamagement) are TXed via this
+	 * callback if the flag IEEE_SOFTMAC_SINGLE_QUEUE is
+	 * not set. As some cards may have different HW queues that
 	 * one might want to use for data and management frames
 	 * the option to have two callbacks might be useful.
 	 * This fucntion can't sleep.
 	 */
 	int (*softmac_hard_start_xmit)(struct sk_buff *skb,
 			       struct net_device *dev);
-	
+
 	/* used instead of hard_start_xmit (not softmac_hard_start_xmit)
 	 * if the IEEE_SOFTMAC_TX_QUEUE feature is used to TX data
 	 * frames. I the option IEEE_SOFTMAC_SINGLE_QUEUE is also set
 	 * then also management frames are sent via this callback.
 	 * This function can't sleep.
-	 */    
+	 */
 	void (*softmac_data_hard_start_xmit)(struct sk_buff *skb,
 			       struct net_device *dev,int rate);
 
 	/* stops the HW queue for DATA frames. Useful to avoid
 	 * waste time to TX data frame when we are reassociating
 	 * This function can sleep.
-	 */	 
+	 */
 	void (*data_hard_stop)(struct net_device *dev);
-	
+
 	/* OK this is complementar to data_poll_hard_stop */
 	void (*data_hard_resume)(struct net_device *dev);
-	
+
 	/* ask to the driver to retune the radio .
 	 * This function can sleep. the driver should ensure
 	 * the radio has been swithced before return.
 	 */
 	void (*set_chan)(struct net_device *dev,short ch);
-	
+
 	/* These are not used if the ieee stack takes care of
-	 * scanning (IEEE_SOFTMAC_SCAN feature set). 
+	 * scanning (IEEE_SOFTMAC_SCAN feature set).
 	 * In this case only the set_chan is used.
 	 *
 	 * The syncro version is similar to the start_scan but
 	 * does not return until all channels has been scanned.
-	 * this is called in user context and should sleep, 
+	 * this is called in user context and should sleep,
 	 * it is called in a work_queue when swithcing to ad-hoc mode
-	 * or in behalf of iwlist scan when the card is associated 
-	 * and root user ask for a scan. 
+	 * or in behalf of iwlist scan when the card is associated
+	 * and root user ask for a scan.
 	 * the fucntion stop_scan should stop both the syncro and
 	 * background scanning and can sleep.
-	 * The fucntion start_scan should initiate the background 
+	 * The fucntion start_scan should initiate the background
 	 * scanning and can't sleep.
-	 */ 
+	 */
 	void (*scan_syncro)(struct net_device *dev);
 	void (*start_scan)(struct net_device *dev);
 	void (*stop_scan)(struct net_device *dev);
-	
+
 	/* indicate the driver that the link state is changed
 	 * for example it may indicate the card is associated now.
-	 * Driver might be interested in this to apply RX filter 
-	 * rules or simply light the LINK led 
+	 * Driver might be interested in this to apply RX filter
+	 * rules or simply light the LINK led
 	 */
 	void (*link_change)(struct net_device *dev);
-	
+
 	/* these two function indicates to the HW when to start
-	 * and stop to send beacons. This is used when the 
+	 * and stop to send beacons. This is used when the
 	 * IEEE_SOFTMAC_BEACONS is not set. For now the
 	 * stop_send_bacons is NOT guaranteed to be called only
 	 * after start_send_beacons.
 	 */
 	void (*start_send_beacons) (struct net_device *dev,u16 tx_rate);
 	void (*stop_send_beacons) (struct net_device *dev);
-	
+
 	/* power save mode related */
 	void (*sta_wake_up) (struct net_device *dev);
 	void (*ps_request_tx_ack) (struct net_device *dev);
@@ -2323,32 +2323,32 @@ struct ieee80211_device {
 	short (*ps_is_queue_empty) (struct net_device *dev);
 #if 0
 	/* Typical STA methods */
-        int (*handle_auth) (struct net_device * dev,
-                            struct ieee80211_auth * auth);
-        int (*handle_deauth) (struct net_device * dev,
-                              struct ieee80211_deauth * auth);
-        int (*handle_action) (struct net_device * dev,
-                              struct ieee80211_action * action,
-                              struct ieee80211_rx_stats * stats);
-        int (*handle_disassoc) (struct net_device * dev,
-                                struct ieee80211_disassoc * assoc);
+	int (*handle_auth) (struct net_device * dev,
+			    struct ieee80211_auth * auth);
+	int (*handle_deauth) (struct net_device * dev,
+			      struct ieee80211_deauth * auth);
+	int (*handle_action) (struct net_device * dev,
+			      struct ieee80211_action * action,
+			      struct ieee80211_rx_stats * stats);
+	int (*handle_disassoc) (struct net_device * dev,
+				struct ieee80211_disassoc * assoc);
 #endif
-        int (*handle_beacon) (struct net_device * dev, struct ieee80211_beacon * beacon, struct ieee80211_network * network);
+	int (*handle_beacon) (struct net_device * dev, struct ieee80211_beacon * beacon, struct ieee80211_network * network);
 #if 0
-        int (*handle_probe_response) (struct net_device * dev,
-                                      struct ieee80211_probe_response * resp,
-                                      struct ieee80211_network * network);
-        int (*handle_probe_request) (struct net_device * dev,
-                                     struct ieee80211_probe_request * req,
-                                     struct ieee80211_rx_stats * stats);
+	int (*handle_probe_response) (struct net_device * dev,
+				      struct ieee80211_probe_response * resp,
+				      struct ieee80211_network * network);
+	int (*handle_probe_request) (struct net_device * dev,
+				     struct ieee80211_probe_request * req,
+				     struct ieee80211_rx_stats * stats);
 #endif
-        int (*handle_assoc_response) (struct net_device * dev, struct ieee80211_assoc_response_frame * resp, struct ieee80211_network * network);
+	int (*handle_assoc_response) (struct net_device * dev, struct ieee80211_assoc_response_frame * resp, struct ieee80211_network * network);
 
 #if 0
-        /* Typical AP methods */
-        int (*handle_assoc_request) (struct net_device * dev);
-        int (*handle_reassoc_request) (struct net_device * dev,
-                                       struct ieee80211_reassoc_request * req);
+	/* Typical AP methods */
+	int (*handle_assoc_request) (struct net_device * dev);
+	int (*handle_reassoc_request) (struct net_device * dev,
+				       struct ieee80211_reassoc_request * req);
 #endif
 
 	/* check whether Tx hw resouce available */
@@ -2359,7 +2359,7 @@ struct ieee80211_device {
 //	void (*UpdateHalRATRTableHandler)(struct net_device* dev, u8* pMcsRate);
 	bool (*GetNmodeSupportBySecCfg)(struct net_device* dev);
 	void (*SetWirelessMode)(struct net_device* dev, u8 wireless_mode);
-	bool (*GetHalfNmodeSupportByAPsHandler)(struct net_device* dev); 
+	bool (*GetHalfNmodeSupportByAPsHandler)(struct net_device* dev);
 	void (*InitialGainHandler)(struct net_device *dev, u8 Operation);
 
 	/* This must be the last item so that it points to the data
@@ -2401,13 +2401,13 @@ struct ieee80211_device {
 #define IEEE_SOFTMAC_SINGLE_QUEUE (1<<8)
 
 /* Generate beacons.  The stack will enqueue beacons
- * to the card 
- */ 
+ * to the card
+ */
 #define IEEE_SOFTMAC_BEACONS (1<<6)
 
 static inline void *ieee80211_priv(struct net_device *dev)
 {
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) 
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
 	return ((struct ieee80211_device *)netdev_priv(dev))->priv;
 #else
 	return ((struct ieee80211_device *)dev->priv)->priv;
@@ -2485,45 +2485,45 @@ extern inline int ieee80211_get_hdrlen(u16 fc)
 
 static inline u8 *ieee80211_get_payload(struct ieee80211_hdr *hdr)
 {
-        switch (ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl))) {
-        case IEEE80211_1ADDR_LEN:
-                return ((struct ieee80211_hdr_1addr *)hdr)->payload;
-        case IEEE80211_2ADDR_LEN:
-                return ((struct ieee80211_hdr_2addr *)hdr)->payload;
-        case IEEE80211_3ADDR_LEN:
-                return ((struct ieee80211_hdr_3addr *)hdr)->payload;
-        case IEEE80211_4ADDR_LEN:
-                return ((struct ieee80211_hdr_4addr *)hdr)->payload;
-        }
-        return NULL;
+	switch (ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl))) {
+	case IEEE80211_1ADDR_LEN:
+		return ((struct ieee80211_hdr_1addr *)hdr)->payload;
+	case IEEE80211_2ADDR_LEN:
+		return ((struct ieee80211_hdr_2addr *)hdr)->payload;
+	case IEEE80211_3ADDR_LEN:
+		return ((struct ieee80211_hdr_3addr *)hdr)->payload;
+	case IEEE80211_4ADDR_LEN:
+		return ((struct ieee80211_hdr_4addr *)hdr)->payload;
+	}
+	return NULL;
 }
 
 static inline int ieee80211_is_ofdm_rate(u8 rate)
 {
-        switch (rate & ~IEEE80211_BASIC_RATE_MASK) {
-        case IEEE80211_OFDM_RATE_6MB:
-        case IEEE80211_OFDM_RATE_9MB:
-        case IEEE80211_OFDM_RATE_12MB:
-        case IEEE80211_OFDM_RATE_18MB:
-        case IEEE80211_OFDM_RATE_24MB:
-        case IEEE80211_OFDM_RATE_36MB:
-        case IEEE80211_OFDM_RATE_48MB:
-        case IEEE80211_OFDM_RATE_54MB:
-                return 1;
-        }
-        return 0;
+	switch (rate & ~IEEE80211_BASIC_RATE_MASK) {
+	case IEEE80211_OFDM_RATE_6MB:
+	case IEEE80211_OFDM_RATE_9MB:
+	case IEEE80211_OFDM_RATE_12MB:
+	case IEEE80211_OFDM_RATE_18MB:
+	case IEEE80211_OFDM_RATE_24MB:
+	case IEEE80211_OFDM_RATE_36MB:
+	case IEEE80211_OFDM_RATE_48MB:
+	case IEEE80211_OFDM_RATE_54MB:
+		return 1;
+	}
+	return 0;
 }
 
 static inline int ieee80211_is_cck_rate(u8 rate)
 {
-        switch (rate & ~IEEE80211_BASIC_RATE_MASK) {
-        case IEEE80211_CCK_RATE_1MB:
-        case IEEE80211_CCK_RATE_2MB:
-        case IEEE80211_CCK_RATE_5MB:
-        case IEEE80211_CCK_RATE_11MB:
-                return 1;
-        }
-        return 0;
+	switch (rate & ~IEEE80211_BASIC_RATE_MASK) {
+	case IEEE80211_CCK_RATE_1MB:
+	case IEEE80211_CCK_RATE_2MB:
+	case IEEE80211_CCK_RATE_5MB:
+	case IEEE80211_CCK_RATE_11MB:
+		return 1;
+	}
+	return 0;
 }
 
 
@@ -2539,7 +2539,7 @@ extern int ieee80211_encrypt_fragment(
 	struct ieee80211_device *ieee,
 	struct sk_buff *frag,
 	int hdr_len);
-	
+
 extern int ieee80211_xmit(struct sk_buff *skb,
 			  struct net_device *dev);
 extern void ieee80211_txb_free(struct ieee80211_txb *);
@@ -2564,17 +2564,17 @@ extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
 				   union iwreq_data *wrqu, char *key);
 #if WIRELESS_EXT >= 18
 extern int ieee80211_wx_get_encode_ext(struct ieee80211_device *ieee,
-                            struct iw_request_info *info,
-                            union iwreq_data* wrqu, char *extra);
+			    struct iw_request_info *info,
+			    union iwreq_data* wrqu, char *extra);
 extern int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee,
-                            struct iw_request_info *info,
-                            union iwreq_data* wrqu, char *extra);
+			    struct iw_request_info *info,
+			    union iwreq_data* wrqu, char *extra);
 extern int ieee80211_wx_set_auth(struct ieee80211_device *ieee,
-                               struct iw_request_info *info,
-                               struct iw_param *data, char *extra);
+			       struct iw_request_info *info,
+			       struct iw_param *data, char *extra);
 extern int ieee80211_wx_set_mlme(struct ieee80211_device *ieee,
-                               struct iw_request_info *info,
-                               union iwreq_data *wrqu, char *extra);
+			       struct iw_request_info *info,
+			       union iwreq_data *wrqu, char *extra);
 #endif
 extern int ieee80211_wx_set_gen_ie(struct ieee80211_device *ieee, u8 *ie, size_t len);
 
@@ -2625,35 +2625,35 @@ extern void ieee80211_ccmp_null(void);
 
 /* ieee80211_softmac_wx.c */
 
-extern int ieee80211_wx_get_wap(struct ieee80211_device *ieee, 
-			    struct iw_request_info *info, 
+extern int ieee80211_wx_get_wap(struct ieee80211_device *ieee,
+			    struct iw_request_info *info,
 			    union iwreq_data *wrqu, char *ext);
-			    
+
 extern int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
 			 struct iw_request_info *info,
 			 union iwreq_data *awrq,
 			 char *extra);
-			 
+
 extern int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
 
-extern int ieee80211_wx_set_rate(struct ieee80211_device *ieee, 
+extern int ieee80211_wx_set_rate(struct ieee80211_device *ieee,
 			     struct iw_request_info *info,
 			     union iwreq_data *wrqu, char *extra);
-			     
-extern int ieee80211_wx_get_rate(struct ieee80211_device *ieee, 
-			     struct iw_request_info *info, 
+
+extern int ieee80211_wx_get_rate(struct ieee80211_device *ieee,
+			     struct iw_request_info *info,
 			     union iwreq_data *wrqu, char *extra);
-			     
+
 extern int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
 			     union iwreq_data *wrqu, char *b);
-			     
+
 extern int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a,
 			     union iwreq_data *wrqu, char *b);
-			     
-extern int ieee80211_wx_set_essid(struct ieee80211_device *ieee, 
+
+extern int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
 			      struct iw_request_info *a,
 			      union iwreq_data *wrqu, char *extra);
-			      
+
 extern int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
 			     union iwreq_data *wrqu, char *b);
 
@@ -2671,12 +2671,12 @@ extern void ieee80211_wx_sync_scan_wq(struct work_struct *work);
 #endif
 
 
-extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee, 
-			       struct iw_request_info *info, 
+extern int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
+			       struct iw_request_info *info,
 			       union iwreq_data *wrqu, char *extra);
-			       
-extern int ieee80211_wx_get_name(struct ieee80211_device *ieee, 
-			     struct iw_request_info *info, 
+
+extern int ieee80211_wx_get_name(struct ieee80211_device *ieee,
+			     struct iw_request_info *info,
 			     union iwreq_data *wrqu, char *extra);
 
 extern int ieee80211_wx_set_power(struct ieee80211_device *ieee,
@@ -2687,14 +2687,14 @@ extern int ieee80211_wx_get_power(struct ieee80211_device *ieee,
 				 struct iw_request_info *info,
 				 union iwreq_data *wrqu, char *extra);
 
-extern int ieee80211_wx_set_rts(struct ieee80211_device *ieee, 
+extern int ieee80211_wx_set_rts(struct ieee80211_device *ieee,
 			     struct iw_request_info *info,
 			     union iwreq_data *wrqu, char *extra);
 
-extern int ieee80211_wx_get_rts(struct ieee80211_device *ieee, 
+extern int ieee80211_wx_get_rts(struct ieee80211_device *ieee,
 			     struct iw_request_info *info,
 			     union iwreq_data *wrqu, char *extra);
-//HT				 			     
+//HT
 #define MAX_RECEIVE_BUFFER_SIZE 9100  //
 extern void HTDebugHTCapability(u8* CapIE, u8* TitleString );
 extern void HTDebugHTInfo(u8*  InfoIE, u8* TitleString);
@@ -2731,15 +2731,15 @@ extern void RxBaInactTimeout(unsigned long data);
 extern void ResetBaEntry( PBA_RECORD pBA);
 //function in TS.c
 extern bool GetTs(
-        struct ieee80211_device*        ieee,
-        PTS_COMMON_INFO                 *ppTS,
-        u8*                             Addr,
-        u8                              TID,
-        TR_SELECT                       TxRxSelect,  //Rx:1, Tx:0
-        bool                            bAddNewTs
-        );
+	struct ieee80211_device*        ieee,
+	PTS_COMMON_INFO                 *ppTS,
+	u8*                             Addr,
+	u8                              TID,
+	TR_SELECT                       TxRxSelect,  //Rx:1, Tx:0
+	bool                            bAddNewTs
+	);
 extern void TSInitialize(struct ieee80211_device *ieee);
-extern  void TsStartAddBaProcess(struct ieee80211_device* ieee, PTX_TS_RECORD   pTxTS);			 			     
+extern  void TsStartAddBaProcess(struct ieee80211_device* ieee, PTX_TS_RECORD   pTxTS);
 extern void RemovePeerTS(struct ieee80211_device* ieee, u8* Addr);
 extern void RemoveAllTS(struct ieee80211_device* ieee);
 void ieee80211_softmac_scan_syncro(struct ieee80211_device *ieee);
@@ -2780,13 +2780,13 @@ static inline const char *escape_essid(const char *essid, u8 essid_len) {
 	return escaped;
 }
 
-/* For the function is more related to hardware setting, it's better to use the  
+/* For the function is more related to hardware setting, it's better to use the
  * ieee handler to refer to it.
  */
 extern short check_nic_enough_desc(struct net_device *dev, int queue_index);
 extern int ieee80211_data_xmit(struct sk_buff *skb, struct net_device *dev);
 extern int ieee80211_parse_info_param(struct ieee80211_device *ieee,
-		struct ieee80211_info_element *info_element, 
+		struct ieee80211_info_element *info_element,
 		u16 length,
 		struct ieee80211_network *network,
 		struct ieee80211_rx_stats *stats);
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c
index 0d14a66..0b33bf4 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c
@@ -131,7 +131,7 @@ static void ccmp_init_blocks(struct crypto_tfm *tfm,
 	/*
 	qc_included = ((WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA) &&
 		       (WLAN_FC_GET_STYPE(fc) & 0x08));
-        */		       
+	*/
 	// fixed by David :2006.9.6
 	qc_included = ((WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA) &&
 		       (WLAN_FC_GET_STYPE(fc) & 0x80));
@@ -243,12 +243,12 @@ static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
 
 		//mic is moved to here by john
 		mic = skb_put(skb, CCMP_MIC_LEN);
-		
+
 		ccmp_init_blocks(key->tfm, hdr, key->tx_pn, data_len, b0, b, s0);
-	
+
 		blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN;
 		last = data_len % AES_BLOCK_LEN;
-	
+
 		for (i = 1; i <= blocks; i++) {
 			len = (i == blocks && last) ? last : AES_BLOCK_LEN;
 			/* Authentication */
@@ -261,7 +261,7 @@ static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
 			xor_block(pos, e, len);
 			pos += len;
 		}
-	
+
 		for (i = 0; i < CCMP_MIC_LEN; i++)
 			mic[i] = b[i] ^ s0[i];
 	}
@@ -335,14 +335,14 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
 		u8 *b = key->rx_b;
 		u8 *a = key->rx_a;
 		int i, blocks, last, len;
-		
+
 
 		ccmp_init_blocks(key->tfm, hdr, pn, data_len, b0, a, b);
 		xor_block(mic, b, CCMP_MIC_LEN);
-	
+
 		blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN;
 		last = data_len % AES_BLOCK_LEN;
-	
+
 		for (i = 1; i <= blocks; i++) {
 			len = (i == blocks && last) ? last : AES_BLOCK_LEN;
 			/* Decrypt, with counter */
@@ -355,7 +355,7 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
 			ieee80211_ccmp_aes_encrypt(key->tfm, a, a);
 			pos += len;
 		}
-	
+
 		if (memcmp(mic, a, CCMP_MIC_LEN) != 0) {
 			if (net_ratelimit()) {
 				printk(KERN_DEBUG "CCMP: decrypt failed: STA="
@@ -364,7 +364,7 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
 			key->dot11RSNAStatsCCMPDecryptErrors++;
 			return -5;
 		}
-	
+
 		memcpy(key->rx_pn, pn, CCMP_PN_LEN);
 	}
 	/* Remove hdr and MIC */
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c
index 4a61841..841b999 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c
@@ -24,7 +24,7 @@
 #include "ieee80211.h"
 
 #include <linux/crypto.h>
-        #include <linux/scatterlist.h>
+	#include <linux/scatterlist.h>
 #include <linux/crc32.h>
 
 MODULE_AUTHOR("Jouni Malinen");
@@ -334,8 +334,8 @@ static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
 	}
 	else
 	tkey->tx_phase1_done = 1;
-	
-	
+
+
 	len = skb->len - hdr_len;
 	pos = skb_push(skb, 8);
 	memmove(pos, pos + 8, hdr_len);
@@ -382,7 +382,7 @@ static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
 	if (!tcb_desc->bHwSec)
 		return ret;
 	else
-        	return 0;
+		return 0;
 
 
 }
@@ -445,15 +445,15 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
 			tkey->dot11RSNAStatsTKIPReplays++;
 			return -4;
 		}
-	
+
 		if (iv32 != tkey->rx_iv32 || !tkey->rx_phase1_done) {
 			tkip_mixing_phase1(tkey->rx_ttak, tkey->key, hdr->addr2, iv32);
 			tkey->rx_phase1_done = 1;
 		}
 		tkip_mixing_phase2(rc4key, tkey->key, tkey->rx_ttak, iv16);
-	
+
 		plen = skb->len - hdr_len - 12;
-	
+
 		crypto_blkcipher_setkey(tkey->rx_tfm_arc4, rc4key, 16);
 		sg_init_one(&sg, pos, plen+4);
 
@@ -465,13 +465,13 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
 			}
 			return -7;
 		}
-	
+
 		crc = ~crc32_le(~0, pos, plen);
 		icv[0] = crc;
 		icv[1] = crc >> 8;
 		icv[2] = crc >> 16;
 		icv[3] = crc >> 24;
-	
+
 		if (memcmp(icv, pos + plen, 4) != 0) {
 			if (iv32 != tkey->rx_iv32) {
 				/* Previously cached Phase1 result was already lost, so
@@ -502,26 +502,26 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
 }
 
 static int michael_mic(struct crypto_hash *tfm_michael, u8 * key, u8 * hdr,
-                       u8 * data, size_t data_len, u8 * mic)
+		       u8 * data, size_t data_len, u8 * mic)
 {
-        struct hash_desc desc;
-        struct scatterlist sg[2];
+	struct hash_desc desc;
+	struct scatterlist sg[2];
 
-        if (tfm_michael == NULL) {
-                printk(KERN_WARNING "michael_mic: tfm_michael == NULL\n");
-                return -1;
-        }
+	if (tfm_michael == NULL) {
+		printk(KERN_WARNING "michael_mic: tfm_michael == NULL\n");
+		return -1;
+	}
 
-        sg_init_table(sg, 2);
-        sg_set_buf(&sg[0], hdr, 16);
-        sg_set_buf(&sg[1], data, data_len);
+	sg_init_table(sg, 2);
+	sg_set_buf(&sg[0], hdr, 16);
+	sg_set_buf(&sg[1], data, data_len);
 
-        if (crypto_hash_setkey(tfm_michael, key, 8))
-                return -1;
+	if (crypto_hash_setkey(tfm_michael, key, 8))
+		return -1;
 
-        desc.tfm = tfm_michael;
-        desc.flags = 0;
-        return crypto_hash_digest(&desc, sg, data_len + 16, mic);
+	desc.tfm = tfm_michael;
+	desc.flags = 0;
+	return crypto_hash_digest(&desc, sg, data_len + 16, mic);
 }
 
 static void michael_mic_hdr(struct sk_buff *skb, u8 *hdr)
@@ -548,9 +548,9 @@ static void michael_mic_hdr(struct sk_buff *skb, u8 *hdr)
 		memcpy(hdr + ETH_ALEN, hdr11->addr2, ETH_ALEN); /* SA */
 		break;
 	}
-		
+
 	hdr[12] = 0; /* priority */
-	
+
 	hdr[13] = hdr[14] = hdr[15] = 0; /* reserved */
 }
 
@@ -630,7 +630,7 @@ static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx,
 
 	if (michael_mic(tkey->rx_tfm_michael, &tkey->key[24], tkey->rx_hdr,
 				skb->data + hdr_len, skb->len - 8 - hdr_len, mic))
-            	return -1;
+		return -1;
 	if (memcmp(mic, skb->data + skb->len - 8, 8) != 0) {
 		struct ieee80211_hdr_4addr *hdr;
 		hdr = (struct ieee80211_hdr_4addr *) skb->data;
@@ -760,7 +760,7 @@ static struct ieee80211_crypto_ops ieee80211_crypt_tkip = {
 	.print_stats		= ieee80211_tkip_print_stats,
 	.extra_prefix_len	= 4 + 4, /* IV + ExtIV */
 	.extra_postfix_len	= 8 + 4, /* MIC + ICV */
-	.owner		        = THIS_MODULE,
+	.owner			= THIS_MODULE,
 };
 
 int __init ieee80211_crypto_tkip_init(void)
@@ -776,5 +776,5 @@ void __exit ieee80211_crypto_tkip_exit(void)
 void ieee80211_tkip_null(void)
 {
 //    printk("============>%s()\n", __FUNCTION__);
-        return;
+	return;
 }
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c
index 203326e..61ad11c 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c
@@ -34,8 +34,8 @@ struct prism2_wep_data {
 	u8 key[WEP_KEY_LEN + 1];
 	u8 key_len;
 	u8 key_idx;
-        struct crypto_blkcipher *tx_tfm;
-        struct crypto_blkcipher *rx_tfm;
+	struct crypto_blkcipher *tx_tfm;
+	struct crypto_blkcipher *rx_tfm;
 };
 
 
@@ -50,19 +50,19 @@ static void * prism2_wep_init(int keyidx)
 	priv->key_idx = keyidx;
 
 	priv->tx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC);
-        if (IS_ERR(priv->tx_tfm)) {
-                printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
-                       "crypto API arc4\n");
-                priv->tx_tfm = NULL;
-                goto fail;
-        }
-        priv->rx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC);
-        if (IS_ERR(priv->rx_tfm)) {
-                printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
-                       "crypto API arc4\n");
-                priv->rx_tfm = NULL;
-                goto fail;
-        }
+	if (IS_ERR(priv->tx_tfm)) {
+		printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
+		       "crypto API arc4\n");
+		priv->tx_tfm = NULL;
+		goto fail;
+	}
+	priv->rx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC);
+	if (IS_ERR(priv->rx_tfm)) {
+		printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
+		       "crypto API arc4\n");
+		priv->rx_tfm = NULL;
+		goto fail;
+	}
 
 	/* start WEP IV from a random value */
 	get_random_bytes(&priv->iv, 4);
@@ -71,12 +71,12 @@ static void * prism2_wep_init(int keyidx)
 
 fail:
 	if (priv) {
-                if (priv->tx_tfm)
-                        crypto_free_blkcipher(priv->tx_tfm);
-                if (priv->rx_tfm)
-                        crypto_free_blkcipher(priv->rx_tfm);
-                kfree(priv);
-        }
+		if (priv->tx_tfm)
+			crypto_free_blkcipher(priv->tx_tfm);
+		if (priv->rx_tfm)
+			crypto_free_blkcipher(priv->rx_tfm);
+		kfree(priv);
+	}
 
 	return NULL;
 }
@@ -87,11 +87,11 @@ static void prism2_wep_deinit(void *priv)
 	struct prism2_wep_data *_priv = priv;
 
 	if (_priv) {
-                if (_priv->tx_tfm)
-                        crypto_free_blkcipher(_priv->tx_tfm);
-                if (_priv->rx_tfm)
-                        crypto_free_blkcipher(_priv->rx_tfm);
-        }
+		if (_priv->tx_tfm)
+			crypto_free_blkcipher(_priv->tx_tfm);
+		if (_priv->rx_tfm)
+			crypto_free_blkcipher(_priv->rx_tfm);
+	}
 	kfree(priv);
 }
 
@@ -145,7 +145,7 @@ static int prism2_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
 
 	if (!tcb_desc->bHwSec)
 	{
-	
+
 		/* Append little-endian CRC32 and encrypt it to produce ICV */
 		crc = ~crc32_le(~0, pos, len);
 		icv = skb_put(skb, 4);
@@ -153,7 +153,7 @@ static int prism2_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
 		icv[1] = crc >> 8;
 		icv[2] = crc >> 16;
 		icv[3] = crc >> 24;
-		
+
 		crypto_blkcipher_setkey(wep->tx_tfm, key, klen);
 		sg_init_one(&sg, pos, len+4);
 
@@ -293,5 +293,5 @@ void __exit ieee80211_crypto_wep_exit(void)
 void ieee80211_wep_null(void)
 {
 //	printk("============>%s()\n", __FUNCTION__);
-        return;
+	return;
 }
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c
index d17d636..bbaec94 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c
@@ -150,30 +150,30 @@ struct net_device *alloc_ieee80211(int sizeof_priv)
 	atomic_set(&(ieee->atm_swbw), 0);
 
 	ieee->wpax_type_set = 0;
- 	ieee->wpa_enabled = 0;
- 	ieee->tkip_countermeasures = 0;
- 	ieee->drop_unencrypted = 0;
- 	ieee->privacy_invoked = 0;
- 	ieee->ieee802_1x = 1;
+	ieee->wpa_enabled = 0;
+	ieee->tkip_countermeasures = 0;
+	ieee->drop_unencrypted = 0;
+	ieee->privacy_invoked = 0;
+	ieee->ieee802_1x = 1;
 	ieee->raw_tx = 0;
 	//ieee->hwsec_support = 1; //defalt support hw security. //use module_param instead.
 	ieee->hwsec_active = 0; //disable hwsec, switch it on when necessary.
 
 	ieee80211_softmac_init(ieee);
-	
+
 	ieee->pHTInfo = (RT_HIGH_THROUGHPUT*)kzalloc(sizeof(RT_HIGH_THROUGHPUT), GFP_KERNEL);
 	if (ieee->pHTInfo == NULL)
 	{
 		IEEE80211_DEBUG(IEEE80211_DL_ERR, "can't alloc memory for HTInfo\n");
 		return NULL;
-	}	
+	}
 	HTUpdateDefaultSetting(ieee);
 	HTInitializeHTInfo(ieee); //may move to other place.
 	TSInitialize(ieee);
 
 	for (i = 0; i < IEEE_IBSS_MAC_HASH_SIZE; i++)
 		INIT_LIST_HEAD(&ieee->ibss_mac_hash[i]);
-	
+
 	for (i = 0; i < 17; i++) {
 	  ieee->last_rxseq_num[i] = -1;
 	  ieee->last_rxfrag_num[i] = -1;
@@ -201,13 +201,13 @@ void free_ieee80211(struct net_device *dev)
 	int i;
 	//struct list_head *p, *q;
 //	del_timer_sync(&ieee->SwBwTimer);
-#if 1	
+#if 1
 	if (ieee->pHTInfo != NULL)
 	{
 		kfree(ieee->pHTInfo);
 		ieee->pHTInfo = NULL;
 	}
-#endif	
+#endif
 	RemoveAllTS(ieee);
 	ieee80211_softmac_free(ieee);
 	del_timer_sync(&ieee->crypt_deinit_timer);
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
index 156ca35..6722314 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
@@ -13,13 +13,13 @@
  * more details.
  ******************************************************************************
 
-  Few modifications for Realtek's Wi-Fi drivers by 
+  Few modifications for Realtek's Wi-Fi drivers by
   Andrea Merello <andreamrl at tiscali.it>
-  
-  A special thanks goes to Realtek for their support ! 
+
+  A special thanks goes to Realtek for their support !
 
 ******************************************************************************/
- 
+
 
 #include <linux/compiler.h>
 //#include <linux/config.h>
@@ -56,9 +56,9 @@ static inline void ieee80211_monitor_rx(struct ieee80211_device *ieee,
 
 	skb->dev = ieee->dev;
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
-        skb_reset_mac_header(skb);
+	skb_reset_mac_header(skb);
 #else
-        skb->mac.raw = skb->data;
+	skb->mac.raw = skb->data;
 #endif
 
 	skb_pull(skb, ieee80211_get_hdrlen(fc));
@@ -113,7 +113,7 @@ ieee80211_frag_cache_get(struct ieee80211_device *ieee,
 	struct ieee80211_hdr_3addrqos *hdr_3addrqos;
 	struct ieee80211_hdr_4addrqos *hdr_4addrqos;
 	u8 tid;
-	
+
 	if (((fc & IEEE80211_FCTL_DSTODS) == IEEE80211_FCTL_DSTODS)&&IEEE80211_QOS_HAS_SEQ(fc)) {
 	  hdr_4addrqos = (struct ieee80211_hdr_4addrqos *)hdr;
 	  tid = le16_to_cpu(hdr_4addrqos->qos_ctl) & IEEE80211_QCTL_TID;
@@ -134,7 +134,7 @@ ieee80211_frag_cache_get(struct ieee80211_device *ieee,
 				    sizeof(struct ieee80211_hdr_4addr) +
 				    8 /* LLC */ +
 				    2 /* alignment */ +
-				    8 /* WEP */ + 
+				    8 /* WEP */ +
 				    ETH_ALEN /* WDS */ +
 				    (IEEE80211_QOS_HAS_SEQ(fc)?2:0) /* QOS Control */);
 		if (skb == NULL)
@@ -180,7 +180,7 @@ static int ieee80211_frag_cache_invalidate(struct ieee80211_device *ieee,
 	struct ieee80211_hdr_3addrqos *hdr_3addrqos;
 	struct ieee80211_hdr_4addrqos *hdr_4addrqos;
 	u8 tid;
-	
+
 	if(((fc & IEEE80211_FCTL_DSTODS) == IEEE80211_FCTL_DSTODS)&&IEEE80211_QOS_HAS_SEQ(fc)) {
 	  hdr_4addrqos = (struct ieee80211_hdr_4addrqos *)hdr;
 	  tid = le16_to_cpu(hdr_4addrqos->qos_ctl) & IEEE80211_QCTL_TID;
@@ -225,23 +225,23 @@ ieee80211_rx_frame_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb,
 	 * this is not mandatory.... but seems that the probe
 	 * response parser uses it
 	 */
-        struct ieee80211_hdr_3addr * hdr = (struct ieee80211_hdr_3addr *)skb->data;
+	struct ieee80211_hdr_3addr * hdr = (struct ieee80211_hdr_3addr *)skb->data;
 
 	rx_stats->len = skb->len;
-	ieee80211_rx_mgt(ieee,(struct ieee80211_hdr_4addr *)skb->data,rx_stats);	
-        //if ((ieee->state == IEEE80211_LINKED) && (memcmp(hdr->addr3, ieee->current_network.bssid, ETH_ALEN)))
-        if ((memcmp(hdr->addr1, ieee->dev->dev_addr, ETH_ALEN)))//use ADDR1 to perform address matching for Management frames
-        {
-                dev_kfree_skb_any(skb);
-                return 0;
-        }
+	ieee80211_rx_mgt(ieee,(struct ieee80211_hdr_4addr *)skb->data,rx_stats);
+	//if ((ieee->state == IEEE80211_LINKED) && (memcmp(hdr->addr3, ieee->current_network.bssid, ETH_ALEN)))
+	if ((memcmp(hdr->addr1, ieee->dev->dev_addr, ETH_ALEN)))//use ADDR1 to perform address matching for Management frames
+	{
+		dev_kfree_skb_any(skb);
+		return 0;
+	}
 
 	ieee80211_rx_frame_softmac(ieee, skb, rx_stats, type, stype);
 
 	dev_kfree_skb_any(skb);
-	
+
 	return 0;
-	
+
 	#ifdef NOT_YET
 	if (ieee->iw_mode == IW_MODE_MASTER) {
 		printk(KERN_DEBUG "%s: Master mode not yet suppported.\n",
@@ -357,7 +357,7 @@ ieee80211_rx_frame_decrypt(struct ieee80211_device* ieee, struct sk_buff *skb,
 		cb_desc *tcb_desc = (cb_desc *)(skb->cb+ MAX_DEV_ADDR_SIZE);
 		tcb_desc->bHwSec = 1;
 	}
-#endif	
+#endif
 	hdr = (struct ieee80211_hdr_4addr *) skb->data;
 	hdrlen = ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl));
 
@@ -439,8 +439,8 @@ static int is_duplicate_packet(struct ieee80211_device *ieee,
 	struct ieee80211_hdr_3addrqos *hdr_3addrqos;
 	struct ieee80211_hdr_4addrqos *hdr_4addrqos;
 	u8 tid;
-	
-	
+
+
 	//TO2DS and QoS
 	if(((fc & IEEE80211_FCTL_DSTODS) == IEEE80211_FCTL_DSTODS)&&IEEE80211_QOS_HAS_SEQ(fc)) {
 	  hdr_4addrqos = (struct ieee80211_hdr_4addrqos *)header;
@@ -489,12 +489,12 @@ static int is_duplicate_packet(struct ieee80211_device *ieee,
 		last_time = &entry->packet_time[tid];
 		break;
 	}
-	
+
 	case IW_MODE_INFRA:
 		last_seq = &ieee->last_rxseq_num[tid];
 		last_frag = &ieee->last_rxfrag_num[tid];
 		last_time = &ieee->last_packet_time[tid];
-		
+
 		break;
 	default:
 		return 0;
@@ -524,7 +524,7 @@ static int is_duplicate_packet(struct ieee80211_device *ieee,
 drop:
 //	BUG_ON(!(fc & IEEE80211_FCTL_RETRY));
 //	printk("DUP\n");
-	
+
 	return 1;
 }
 bool
@@ -534,7 +534,7 @@ AddReorderEntry(
 	)
 {
 	struct list_head *pList = &pTS->RxPendingPktList;
-#if  1 
+#if  1
 	while(pList->next != &pTS->RxPendingPktList)
 	{
 		if( SN_LESS(pReorderEntry->SeqNum, ((PRX_REORDER_ENTRY)list_entry(pList->next,RX_REORDER_ENTRY,List))->SeqNum) )
@@ -563,7 +563,7 @@ void ieee80211_indicate_packets(struct ieee80211_device *ieee, struct ieee80211_
 {
 	u8 i = 0 , j=0;
 	u16 ethertype;
-//	if(index > 1)	
+//	if(index > 1)
 //		IEEE80211_DEBUG(IEEE80211_DL_REORDER,"%s(): hahahahhhh, We indicate packet from reorder list, index is %u\n",__FUNCTION__,index);
 	for(j = 0; j<index; j++)
 	{
@@ -571,7 +571,7 @@ void ieee80211_indicate_packets(struct ieee80211_device *ieee, struct ieee80211_
 		struct ieee80211_rxb* prxb = prxbIndicateArray[j];
 		for(i = 0; i<prxb->nr_subframes; i++) {
 			struct sk_buff *sub_skb = prxb->subframes[i];
-				
+
 		/* convert hdr + possible LLC headers into Ethernet header */
 			ethertype = (sub_skb->data[6] << 8) | sub_skb->data[7];
 			if (sub_skb->len >= 8 &&
@@ -608,7 +608,7 @@ void ieee80211_indicate_packets(struct ieee80211_device *ieee, struct ieee80211_
 			}
 		}
 		kfree(prxb);
-		prxb = NULL;	
+		prxb = NULL;
 	}
 }
 
@@ -690,15 +690,15 @@ void RxReorderIndicatePacket( struct ieee80211_device *ieee,
 		if(!list_empty(&ieee->RxReorder_Unused_List)) {
 			pReorderEntry = (PRX_REORDER_ENTRY)list_entry(ieee->RxReorder_Unused_List.next,RX_REORDER_ENTRY,List);
 			list_del_init(&pReorderEntry->List);
-			
+
 			/* Make a reorder entry and insert into a the packet list.*/
 			pReorderEntry->SeqNum = SeqNum;
 			pReorderEntry->prxb = prxb;
 	//		IEEE80211_DEBUG(IEEE80211_DL_REORDER,"%s(): pREorderEntry->SeqNum is %d\n",__FUNCTION__,pReorderEntry->SeqNum);
 
-#if 1 
+#if 1
 			if(!AddReorderEntry(pTS, pReorderEntry)) {
-				IEEE80211_DEBUG(IEEE80211_DL_REORDER, "%s(): Duplicate packet is dropped!! IndicateSeq: %d, NewSeq: %d\n", 
+				IEEE80211_DEBUG(IEEE80211_DL_REORDER, "%s(): Duplicate packet is dropped!! IndicateSeq: %d, NewSeq: %d\n",
 					__FUNCTION__, pTS->RxIndicateSeq, SeqNum);
 				list_add_tail(&pReorderEntry->List,&ieee->RxReorder_Unused_List);
 				{
@@ -714,11 +714,11 @@ void RxReorderIndicatePacket( struct ieee80211_device *ieee,
 					 "Pkt insert into buffer!! IndicateSeq: %d, NewSeq: %d\n",pTS->RxIndicateSeq, SeqNum);
 			}
 #endif
-		} 
+		}
 		else {
 			/*
 			 * Packets are dropped if there is not enough reorder entries.
-			 * This part shall be modified!! We can just indicate all the 
+			 * This part shall be modified!! We can just indicate all the
 			 * packets in buffer and get reorder entries.
 			 */
 			IEEE80211_DEBUG(IEEE80211_DL_ERR, "RxReorderIndicatePacket(): There is no reorder entry!! Packet is dropped!!\n");
@@ -736,9 +736,9 @@ void RxReorderIndicatePacket( struct ieee80211_device *ieee,
 	/* Check if there is any packet need indicate.*/
 	while(!list_empty(&pTS->RxPendingPktList)) {
 		IEEE80211_DEBUG(IEEE80211_DL_REORDER,"%s(): start RREORDER indicate\n",__FUNCTION__);
-#if 1 
+#if 1
 		pReorderEntry = (PRX_REORDER_ENTRY)list_entry(pTS->RxPendingPktList.prev,RX_REORDER_ENTRY,List);
-		if( SN_LESS(pReorderEntry->SeqNum, pTS->RxIndicateSeq) || 
+		if( SN_LESS(pReorderEntry->SeqNum, pTS->RxIndicateSeq) ||
 				SN_EQUAL(pReorderEntry->SeqNum, pTS->RxIndicateSeq))
 		{
 			/* This protect buffer from overflow. */
@@ -780,7 +780,7 @@ void RxReorderIndicatePacket( struct ieee80211_device *ieee,
 		ieee80211_indicate_packets(ieee, prxbIndicateArray, index);
 	}
 
-#if 1 
+#if 1
 	if(bPktInBuf && pTS->RxTimeoutIndicateSeq==0xffff) {
 		// Set new pending timer.
 		IEEE80211_DEBUG(IEEE80211_DL_REORDER,"%s(): SET rx timeout timer\n", __FUNCTION__);
@@ -793,8 +793,8 @@ void RxReorderIndicatePacket( struct ieee80211_device *ieee,
 #endif
 }
 
-u8 parse_subframe(struct sk_buff *skb, 
-                  struct ieee80211_rx_stats *rx_stats,
+u8 parse_subframe(struct sk_buff *skb,
+		  struct ieee80211_rx_stats *rx_stats,
 		  struct ieee80211_rxb *rxb,u8* src,u8* dst)
 {
 	struct ieee80211_hdr_3addr  *hdr = (struct ieee80211_hdr_3addr* )skb->data;
@@ -808,7 +808,7 @@ u8 parse_subframe(struct sk_buff *skb,
 	u16		SeqNum=0;
 
 	struct sk_buff *sub_skb;
-	u8             *data_ptr;	
+	u8             *data_ptr;
 	/* just for debug purpose */
 	SeqNum = WLAN_GET_SEQ_SEQ(le16_to_cpu(hdr->seq_ctl));
 
@@ -859,7 +859,7 @@ u8 parse_subframe(struct sk_buff *skb,
 			if(skb->len<(ETHERNET_HEADER_SIZE + nSubframe_Length)) {
 #if 0//cosa
 				RT_ASSERT(
-						(nRemain_Length>=(ETHERNET_HEADER_SIZE + nSubframe_Length)), 
+						(nRemain_Length>=(ETHERNET_HEADER_SIZE + nSubframe_Length)),
 						("ParseSubframe(): A-MSDU subframe parse error!! Subframe Length: %d\n", nSubframe_Length) );
 #endif
 				printk("%s: A-MSDU parse error!! pRfd->nTotalSubframe : %d\n",\
@@ -901,8 +901,8 @@ u8 parse_subframe(struct sk_buff *skb,
 					return 0;
 				}
 
-				skb_pull(skb,nPadding_Length);	
-			}			
+				skb_pull(skb,nPadding_Length);
+			}
 		}
 #ifdef JOHN_NOCPY
 		dev_kfree_skb(skb);
@@ -923,7 +923,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
 	struct net_device *dev = ieee->dev;
 	struct ieee80211_hdr_4addr *hdr;
 	//struct ieee80211_hdr_3addrqos *hdr;
-	
+
 	size_t hdrlen;
 	u16 fc, type, stype, sc;
 	struct net_device_stats *stats;
@@ -967,19 +967,19 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
 	type = WLAN_FC_GET_TYPE(fc);
 	stype = WLAN_FC_GET_STYPE(fc);
 	sc = le16_to_cpu(hdr->seq_ctl);
-	
+
 	frag = WLAN_GET_SEQ_FRAG(sc);
 	hdrlen = ieee80211_get_hdrlen(fc);
-	
+
 	if(HTCCheck(ieee, skb->data))
 	{
 		if(net_ratelimit())
 		printk("find HTCControl\n");
 		hdrlen += 4;
 		rx_stats->bContainHTC = 1;
-	} 
-  
-	//IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA, skb->data, skb->len);	
+	}
+
+	//IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA, skb->data, skb->len);
 #ifdef NOT_YET
 #if WIRELESS_EXT > 15
 	/* Put this code here so that we avoid duplicating it in all
@@ -1064,25 +1064,25 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
 		hdr = (struct ieee80211_hdr_3addr *)skb->data;
 		fc = le16_to_cpu(hdr->frame_ctl);
 		u8 tmp = (fc & IEEE80211_FCTL_FROMDS) && (fc & IEEE80211_FCTL_TODS);
-		
-		u8 tid = (*((u8*)skb->data + (((fc& IEEE80211_FCTL_FROMDS) && (fc & IEEE80211_FCTL_TODS))?30:24)))&0xf;	
+
+		u8 tid = (*((u8*)skb->data + (((fc& IEEE80211_FCTL_FROMDS) && (fc & IEEE80211_FCTL_TODS))?30:24)))&0xf;
 		printk("====================>fc:%x, tid:%d, tmp:%d\n", fc, tid, tmp);
 		//u8 tid =  (u8)((frameqos*)(buf + ((fc & IEEE80211_FCTL_TODS)&&(fc & IEEE80211_FCTL_FROMDS))? 30 : 24))->field.tid;
 	#endif
 			//IEEE80211_DEBUG(IEEE80211_DL_REORDER,"%s(): QOS ENABLE AND RECEIVE QOS DATA , we will get Ts, tid:%d\n",__FUNCTION__, tid);
-#if 1 
+#if 1
 		if(GetTs(
-				ieee, 
-				(PTS_COMMON_INFO*) &pRxTS, 
-				hdr->addr2, 
-				(u8)Frame_QoSTID((u8*)(skb->data)), 
-				RX_DIR, 
+				ieee,
+				(PTS_COMMON_INFO*) &pRxTS,
+				hdr->addr2,
+				(u8)Frame_QoSTID((u8*)(skb->data)),
+				RX_DIR,
 				true))
 		{
-			
+
 		//	IEEE80211_DEBUG(IEEE80211_DL_REORDER,"%s(): pRxTS->RxLastFragNum is %d,frag is %d,pRxTS->RxLastSeqNum is %d,seq is %d\n",__FUNCTION__,pRxTS->RxLastFragNum,frag,pRxTS->RxLastSeqNum,WLAN_GET_SEQ_SEQ(sc));
-			if( 	(fc & (1<<11))  && 
-					(frag == pRxTS->RxLastFragNum) && 
+			if( 	(fc & (1<<11))  &&
+					(frag == pRxTS->RxLastFragNum) &&
 					(WLAN_GET_SEQ_SEQ(sc) == pRxTS->RxLastSeqNum)	)
 			{
 				goto rx_dropped;
@@ -1101,7 +1101,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
 	}
 #endif
 	if (type == IEEE80211_FTYPE_MGMT) {
-		
+
 	#if 0
 		if ( stype == IEEE80211_STYPE_AUTH &&
 		    fc & IEEE80211_FCTL_WEP && ieee->host_decrypt &&
@@ -1115,8 +1115,8 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
 			goto rx_dropped;
 		}
 	#endif
-		
-	//IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA, skb->data, skb->len);	
+
+	//IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA, skb->data, skb->len);
 		if (ieee80211_rx_frame_mgmt(ieee, skb, rx_stats, type, stype))
 			goto rx_dropped;
 		else
@@ -1206,8 +1206,8 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
 				type, stype, skb->len);
 		goto rx_dropped;
 	}
-        if (memcmp(bssid, ieee->current_network.bssid, ETH_ALEN))
-                goto rx_dropped;
+	if (memcmp(bssid, ieee->current_network.bssid, ETH_ALEN))
+		goto rx_dropped;
 
 	/* skb: hdr + (possibly fragmented, possibly encrypted) payload */
 
@@ -1288,7 +1288,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
 	//added by amy for AP roaming
 	ieee->LinkDetectInfo.NumRecvDataInPeriod++;
 	ieee->LinkDetectInfo.NumRxOkInPeriod++;
-	
+
 	hdr = (struct ieee80211_hdr_4addr *) skb->data;
 	if (crypt && !(fc & IEEE80211_FCTL_WEP) && !ieee->open_wep) {
 		if (/*ieee->ieee802_1x &&*/
@@ -1309,7 +1309,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
 				MAC_ARG(hdr->addr2));
 			goto rx_dropped;
 		}
-	} 
+	}
 
 #ifdef CONFIG_IEEE80211_DEBUG
 	if (crypt && !(fc & IEEE80211_FCTL_WEP) &&
@@ -1334,10 +1334,10 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
 	if(ieee80211_is_eapol_frame(ieee, skb, hdrlen)) {
 		printk(KERN_WARNING "RX: IEEE802.1X EPAOL frame!\n");
 	}
-*/	
+*/
 //added by amy for reorder
-#if 1 
-	if(ieee->current_network.qos_data.active && IsQoSDataFrame(skb->data) 
+#if 1
+	if(ieee->current_network.qos_data.active && IsQoSDataFrame(skb->data)
 		&& !is_multicast_ether_addr(hdr->addr1) && !is_broadcast_ether_addr(hdr->addr1))
 	{
 		TID = Frame_QoSTID(skb->data);
@@ -1422,7 +1422,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
 	}
 	else
 	{
-		IEEE80211_DEBUG(IEEE80211_DL_REORDER,"%s(): REORDER ENABLE AND PTS not NULL, and we will enter RxReorderIndicatePacket()\n",__FUNCTION__);		
+		IEEE80211_DEBUG(IEEE80211_DL_REORDER,"%s(): REORDER ENABLE AND PTS not NULL, and we will enter RxReorderIndicatePacket()\n",__FUNCTION__);
 		RxReorderIndicatePacket(ieee, rxb, pTS, SeqNum);
 	}
 #ifndef JOHN_NOCPY
@@ -1441,7 +1441,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
 	{
 		kfree(rxb);
 		rxb = NULL;
-	}		
+	}
 	stats->rx_dropped++;
 
 	/* Returning 0 indicates to caller that we have not handled the SKB--
@@ -1459,19 +1459,19 @@ static u8 qos_oui[QOS_OUI_LEN] = { 0x00, 0x50, 0xF2 };
 * the right values
 */
 static int ieee80211_verify_qos_info(struct ieee80211_qos_information_element
-                                     *info_element, int sub_type)
+				     *info_element, int sub_type)
 {
 
-        if (info_element->qui_subtype != sub_type)
-                return -1;
-        if (memcmp(info_element->qui, qos_oui, QOS_OUI_LEN))
-                return -1;
-        if (info_element->qui_type != QOS_OUI_TYPE)
-                return -1;
-        if (info_element->version != QOS_VERSION_1)
-                return -1;
+	if (info_element->qui_subtype != sub_type)
+		return -1;
+	if (memcmp(info_element->qui, qos_oui, QOS_OUI_LEN))
+		return -1;
+	if (info_element->qui_type != QOS_OUI_TYPE)
+		return -1;
+	if (info_element->version != QOS_VERSION_1)
+		return -1;
 
-        return 0;
+	return 0;
 }
 
 
@@ -1479,56 +1479,56 @@ static int ieee80211_verify_qos_info(struct ieee80211_qos_information_element
  * Parse a QoS parameter element
  */
 static int ieee80211_read_qos_param_element(struct ieee80211_qos_parameter_info
-                                            *element_param, struct ieee80211_info_element
-                                            *info_element)
+					    *element_param, struct ieee80211_info_element
+					    *info_element)
 {
-        int ret = 0;
-        u16 size = sizeof(struct ieee80211_qos_parameter_info) - 2;
-
-        if ((info_element == NULL) || (element_param == NULL))
-                return -1;
-
-        if (info_element->id == QOS_ELEMENT_ID && info_element->len == size) {
-                memcpy(element_param->info_element.qui, info_element->data,
-                       info_element->len);
-                element_param->info_element.elementID = info_element->id;
-                element_param->info_element.length = info_element->len;
-        } else
-                ret = -1;
-        if (ret == 0)
-                ret = ieee80211_verify_qos_info(&element_param->info_element,
-                                                QOS_OUI_PARAM_SUB_TYPE);
-        return ret;
+	int ret = 0;
+	u16 size = sizeof(struct ieee80211_qos_parameter_info) - 2;
+
+	if ((info_element == NULL) || (element_param == NULL))
+		return -1;
+
+	if (info_element->id == QOS_ELEMENT_ID && info_element->len == size) {
+		memcpy(element_param->info_element.qui, info_element->data,
+		       info_element->len);
+		element_param->info_element.elementID = info_element->id;
+		element_param->info_element.length = info_element->len;
+	} else
+		ret = -1;
+	if (ret == 0)
+		ret = ieee80211_verify_qos_info(&element_param->info_element,
+						QOS_OUI_PARAM_SUB_TYPE);
+	return ret;
 }
 
 /*
  * Parse a QoS information element
  */
 static int ieee80211_read_qos_info_element(struct
-                                           ieee80211_qos_information_element
-                                           *element_info, struct ieee80211_info_element
-                                           *info_element)
+					   ieee80211_qos_information_element
+					   *element_info, struct ieee80211_info_element
+					   *info_element)
 {
-        int ret = 0;
-        u16 size = sizeof(struct ieee80211_qos_information_element) - 2;
-
-        if (element_info == NULL)
-                return -1;
-        if (info_element == NULL)
-                return -1;
-
-        if ((info_element->id == QOS_ELEMENT_ID) && (info_element->len == size)) {
-                memcpy(element_info->qui, info_element->data,
-                       info_element->len);
-                element_info->elementID = info_element->id;
-                element_info->length = info_element->len;
-        } else
-                ret = -1;
-
-        if (ret == 0)
-                ret = ieee80211_verify_qos_info(element_info,
-                                                QOS_OUI_INFO_SUB_TYPE);
-        return ret;
+	int ret = 0;
+	u16 size = sizeof(struct ieee80211_qos_information_element) - 2;
+
+	if (element_info == NULL)
+		return -1;
+	if (info_element == NULL)
+		return -1;
+
+	if ((info_element->id == QOS_ELEMENT_ID) && (info_element->len == size)) {
+		memcpy(element_info->qui, info_element->data,
+		       info_element->len);
+		element_info->elementID = info_element->id;
+		element_info->length = info_element->len;
+	} else
+		ret = -1;
+
+	if (ret == 0)
+		ret = ieee80211_verify_qos_info(element_info,
+						QOS_OUI_INFO_SUB_TYPE);
+	return ret;
 }
 
 
@@ -1536,39 +1536,39 @@ static int ieee80211_read_qos_info_element(struct
  * Write QoS parameters from the ac parameters.
  */
 static int ieee80211_qos_convert_ac_to_parameters(struct
-                                                  ieee80211_qos_parameter_info
-                                                  *param_elm, struct
-                                                  ieee80211_qos_parameters
-                                                  *qos_param)
+						  ieee80211_qos_parameter_info
+						  *param_elm, struct
+						  ieee80211_qos_parameters
+						  *qos_param)
 {
-        int rc = 0;
-        int i;
-        struct ieee80211_qos_ac_parameter *ac_params;
+	int rc = 0;
+	int i;
+	struct ieee80211_qos_ac_parameter *ac_params;
 	u8 aci;
-        //u8 cw_min;
-        //u8 cw_max;
+	//u8 cw_min;
+	//u8 cw_max;
 
-        for (i = 0; i < QOS_QUEUE_NUM; i++) {
-                ac_params = &(param_elm->ac_params_record[i]);
+	for (i = 0; i < QOS_QUEUE_NUM; i++) {
+		ac_params = &(param_elm->ac_params_record[i]);
 
 		aci = (ac_params->aci_aifsn & 0x60) >> 5;
 
 		if(aci >= QOS_QUEUE_NUM)
 			continue;
-                qos_param->aifs[aci] = (ac_params->aci_aifsn) & 0x0f;
+		qos_param->aifs[aci] = (ac_params->aci_aifsn) & 0x0f;
 
 		/* WMM spec P.11: The minimum value for AIFSN shall be 2 */
-                qos_param->aifs[aci] = (qos_param->aifs[aci] < 2) ? 2:qos_param->aifs[aci]; 
+		qos_param->aifs[aci] = (qos_param->aifs[aci] < 2) ? 2:qos_param->aifs[aci];
 
-                qos_param->cw_min[aci] = ac_params->ecw_min_max & 0x0F;
+		qos_param->cw_min[aci] = ac_params->ecw_min_max & 0x0F;
 
-                qos_param->cw_max[aci] = (ac_params->ecw_min_max & 0xF0) >> 4;
+		qos_param->cw_max[aci] = (ac_params->ecw_min_max & 0xF0) >> 4;
 
-                qos_param->flag[aci] =
-                    (ac_params->aci_aifsn & 0x10) ? 0x01 : 0x00;
-                qos_param->tx_op_limit[aci] = le16_to_cpu(ac_params->tx_op_limit);
-        }
-        return rc;
+		qos_param->flag[aci] =
+		    (ac_params->aci_aifsn & 0x10) ? 0x01 : 0x00;
+		qos_param->tx_op_limit[aci] = le16_to_cpu(ac_params->tx_op_limit);
+	}
+	return rc;
 }
 
 /*
@@ -1577,38 +1577,38 @@ static int ieee80211_qos_convert_ac_to_parameters(struct
  * which type to read
  */
 static int ieee80211_parse_qos_info_param_IE(struct ieee80211_info_element
-                                             *info_element,
-                                             struct ieee80211_network *network)
+					     *info_element,
+					     struct ieee80211_network *network)
 {
-        int rc = 0;
-        struct ieee80211_qos_parameters *qos_param = NULL;
-        struct ieee80211_qos_information_element qos_info_element;
-
-        rc = ieee80211_read_qos_info_element(&qos_info_element, info_element);
-
-        if (rc == 0) {
-                network->qos_data.param_count = qos_info_element.ac_info & 0x0F;
-                network->flags |= NETWORK_HAS_QOS_INFORMATION;
-        } else {
-                struct ieee80211_qos_parameter_info param_element;
-
-                rc = ieee80211_read_qos_param_element(&param_element,
-                                                      info_element);
-                if (rc == 0) {
-                        qos_param = &(network->qos_data.parameters);
-                        ieee80211_qos_convert_ac_to_parameters(&param_element,
-                                                               qos_param);
-                        network->flags |= NETWORK_HAS_QOS_PARAMETERS;
-                        network->qos_data.param_count =
-                            param_element.info_element.ac_info & 0x0F;
-                }
-        }
-
-        if (rc == 0) {
-                IEEE80211_DEBUG_QOS("QoS is supported\n");
-                network->qos_data.supported = 1;
-        }
-        return rc;
+	int rc = 0;
+	struct ieee80211_qos_parameters *qos_param = NULL;
+	struct ieee80211_qos_information_element qos_info_element;
+
+	rc = ieee80211_read_qos_info_element(&qos_info_element, info_element);
+
+	if (rc == 0) {
+		network->qos_data.param_count = qos_info_element.ac_info & 0x0F;
+		network->flags |= NETWORK_HAS_QOS_INFORMATION;
+	} else {
+		struct ieee80211_qos_parameter_info param_element;
+
+		rc = ieee80211_read_qos_param_element(&param_element,
+						      info_element);
+		if (rc == 0) {
+			qos_param = &(network->qos_data.parameters);
+			ieee80211_qos_convert_ac_to_parameters(&param_element,
+							       qos_param);
+			network->flags |= NETWORK_HAS_QOS_PARAMETERS;
+			network->qos_data.param_count =
+			    param_element.info_element.ac_info & 0x0F;
+		}
+	}
+
+	if (rc == 0) {
+		IEEE80211_DEBUG_QOS("QoS is supported\n");
+		network->qos_data.supported = 1;
+	}
+	return rc;
 }
 
 #ifdef CONFIG_IEEE80211_DEBUG
@@ -1616,37 +1616,37 @@ static int ieee80211_parse_qos_info_param_IE(struct ieee80211_info_element
 
 static const char *get_info_element_string(u16 id)
 {
-        switch (id) {
-                MFIE_STRING(SSID);
-                MFIE_STRING(RATES);
-                MFIE_STRING(FH_SET);
-                MFIE_STRING(DS_SET);
-                MFIE_STRING(CF_SET);
-                MFIE_STRING(TIM);
-                MFIE_STRING(IBSS_SET);
-                MFIE_STRING(COUNTRY);
-                MFIE_STRING(HOP_PARAMS);
-                MFIE_STRING(HOP_TABLE);
-                MFIE_STRING(REQUEST);
-                MFIE_STRING(CHALLENGE);
-                MFIE_STRING(POWER_CONSTRAINT);
-                MFIE_STRING(POWER_CAPABILITY);
-                MFIE_STRING(TPC_REQUEST);
-                MFIE_STRING(TPC_REPORT);
-                MFIE_STRING(SUPP_CHANNELS);
-                MFIE_STRING(CSA);
-                MFIE_STRING(MEASURE_REQUEST);
-                MFIE_STRING(MEASURE_REPORT);
-                MFIE_STRING(QUIET);
-                MFIE_STRING(IBSS_DFS);
-               // MFIE_STRING(ERP_INFO);
-                MFIE_STRING(RSN);
-                MFIE_STRING(RATES_EX);
-                MFIE_STRING(GENERIC);
-                MFIE_STRING(QOS_PARAMETER);
-        default:
-                return "UNKNOWN";
-        }
+	switch (id) {
+		MFIE_STRING(SSID);
+		MFIE_STRING(RATES);
+		MFIE_STRING(FH_SET);
+		MFIE_STRING(DS_SET);
+		MFIE_STRING(CF_SET);
+		MFIE_STRING(TIM);
+		MFIE_STRING(IBSS_SET);
+		MFIE_STRING(COUNTRY);
+		MFIE_STRING(HOP_PARAMS);
+		MFIE_STRING(HOP_TABLE);
+		MFIE_STRING(REQUEST);
+		MFIE_STRING(CHALLENGE);
+		MFIE_STRING(POWER_CONSTRAINT);
+		MFIE_STRING(POWER_CAPABILITY);
+		MFIE_STRING(TPC_REQUEST);
+		MFIE_STRING(TPC_REPORT);
+		MFIE_STRING(SUPP_CHANNELS);
+		MFIE_STRING(CSA);
+		MFIE_STRING(MEASURE_REQUEST);
+		MFIE_STRING(MEASURE_REPORT);
+		MFIE_STRING(QUIET);
+		MFIE_STRING(IBSS_DFS);
+	       // MFIE_STRING(ERP_INFO);
+		MFIE_STRING(RSN);
+		MFIE_STRING(RATES_EX);
+		MFIE_STRING(GENERIC);
+		MFIE_STRING(QOS_PARAMETER);
+	default:
+		return "UNKNOWN";
+	}
 }
 #endif
 
@@ -1672,8 +1672,8 @@ static inline void ieee80211_extract_country_ie(
 		}
 
 		//
-		// 070305, rcnjko: I update country IE watch dog here because 
-		// some AP (e.g. Cisco 1242) don't include country IE in their 
+		// 070305, rcnjko: I update country IE watch dog here because
+		// some AP (e.g. Cisco 1242) don't include country IE in their
 		// probe response frame.
 		//
 		if(IS_EQUAL_CIE_SRC(ieee, addr2) )
@@ -1686,14 +1686,14 @@ static inline void ieee80211_extract_country_ie(
 #endif
 
 int ieee80211_parse_info_param(struct ieee80211_device *ieee,
-		struct ieee80211_info_element *info_element, 
+		struct ieee80211_info_element *info_element,
 		u16 length,
 		struct ieee80211_network *network,
 		struct ieee80211_rx_stats *stats)
 {
 	u8 i;
 	short offset;
-        u16	tmp_htcap_len=0;
+	u16	tmp_htcap_len=0;
 	u16	tmp_htinfo_len=0;
 	u16 ht_realtek_agg_len=0;
 	u8  ht_realtek_agg_buf[MAX_IE_LEN];
@@ -1805,40 +1805,40 @@ int ieee80211_parse_info_param(struct ieee80211_device *ieee,
 			break;
 
 		case MFIE_TYPE_TIM:
-			if(info_element->len < 4) 
+			if(info_element->len < 4)
 				break;
 
 			network->tim.tim_count = info_element->data[0];
 			network->tim.tim_period = info_element->data[1];
 
-                        network->dtim_period = info_element->data[1];
-                        if(ieee->state != IEEE80211_LINKED)
-                                break;
-
-                        network->last_dtim_sta_time[0] = stats->mac_time[0];
-                        network->last_dtim_sta_time[1] = stats->mac_time[1];
-
-                        network->dtim_data = IEEE80211_DTIM_VALID;
-                        
-                        if(info_element->data[0] != 0)  
-                                break;
-                        
-                        if(info_element->data[2] & 1)
-                                network->dtim_data |= IEEE80211_DTIM_MBCAST;
-                                
-                        offset = (info_element->data[2] >> 1)*2;
-                        
-                        //printk("offset1:%x aid:%x\n",offset, ieee->assoc_id); 
-                
-                        if(ieee->assoc_id < 8*offset || 
-                                ieee->assoc_id > 8*(offset + info_element->len -3))
-                                
-                                break;
-
-                        offset = (ieee->assoc_id / 8) - offset;// + ((aid % 8)? 0 : 1) ;
-
-                        if(info_element->data[3+offset] & (1<<(ieee->assoc_id%8)))
-                                network->dtim_data |= IEEE80211_DTIM_UCAST;
+			network->dtim_period = info_element->data[1];
+			if(ieee->state != IEEE80211_LINKED)
+				break;
+
+			network->last_dtim_sta_time[0] = stats->mac_time[0];
+			network->last_dtim_sta_time[1] = stats->mac_time[1];
+
+			network->dtim_data = IEEE80211_DTIM_VALID;
+
+			if(info_element->data[0] != 0)
+				break;
+
+			if(info_element->data[2] & 1)
+				network->dtim_data |= IEEE80211_DTIM_MBCAST;
+
+			offset = (info_element->data[2] >> 1)*2;
+
+			//printk("offset1:%x aid:%x\n",offset, ieee->assoc_id);
+
+			if(ieee->assoc_id < 8*offset ||
+				ieee->assoc_id > 8*(offset + info_element->len -3))
+
+				break;
+
+			offset = (ieee->assoc_id / 8) - offset;// + ((aid % 8)? 0 : 1) ;
+
+			if(info_element->data[3+offset] & (1<<(ieee->assoc_id%8)))
+				network->dtim_data |= IEEE80211_DTIM_UCAST;
 
 			//IEEE80211_DEBUG_MGMT("MFIE_TYPE_TIM: partially ignored\n");
 			break;
@@ -1879,45 +1879,45 @@ int ieee80211_parse_info_param(struct ieee80211_device *ieee,
 			}
 
 #ifdef THOMAS_TURBO
-                        if (info_element->len == 7 &&
-                            info_element->data[0] == 0x00 &&
-                            info_element->data[1] == 0xe0 &&
-                            info_element->data[2] == 0x4c &&
-                            info_element->data[3] == 0x01 &&
-                            info_element->data[4] == 0x02) {
-                                network->Turbo_Enable = 1;
-                        }
+			if (info_element->len == 7 &&
+			    info_element->data[0] == 0x00 &&
+			    info_element->data[1] == 0xe0 &&
+			    info_element->data[2] == 0x4c &&
+			    info_element->data[3] == 0x01 &&
+			    info_element->data[4] == 0x02) {
+				network->Turbo_Enable = 1;
+			}
 #endif
 
-                        //for HTcap and HTinfo parameters
+			//for HTcap and HTinfo parameters
 			if(tmp_htcap_len == 0){
 				if(info_element->len >= 4 &&
 				   info_element->data[0] == 0x00 &&
 				   info_element->data[1] == 0x90 &&
 				   info_element->data[2] == 0x4c &&
 				   info_element->data[3] == 0x033){
-				   
+
 						tmp_htcap_len = min(info_element->len,(u8)MAX_IE_LEN);
-				   		if(tmp_htcap_len != 0){
-				   			network->bssht.bdHTSpecVer = HT_SPEC_VER_EWC;
+						if(tmp_htcap_len != 0){
+							network->bssht.bdHTSpecVer = HT_SPEC_VER_EWC;
 							network->bssht.bdHTCapLen = tmp_htcap_len > sizeof(network->bssht.bdHTCapBuf)?\
 								sizeof(network->bssht.bdHTCapBuf):tmp_htcap_len;
-							memcpy(network->bssht.bdHTCapBuf,info_element->data,network->bssht.bdHTCapLen);							
-				   		}
+							memcpy(network->bssht.bdHTCapBuf,info_element->data,network->bssht.bdHTCapLen);
+						}
 				}
 				if(tmp_htcap_len != 0)
 					network->bssht.bdSupportHT = true;
 				else
 					network->bssht.bdSupportHT = false;
 			}
-			
-			
+
+
 			if(tmp_htinfo_len == 0){
 				if(info_element->len >= 4 &&
 					info_element->data[0] == 0x00 &&
-				   	info_element->data[1] == 0x90 &&
-				   	info_element->data[2] == 0x4c &&
-				   	info_element->data[3] == 0x034){
+					info_element->data[1] == 0x90 &&
+					info_element->data[2] == 0x4c &&
+					info_element->data[3] == 0x034){
 
 						tmp_htinfo_len = min(info_element->len,(u8)MAX_IE_LEN);
 						if(tmp_htinfo_len != 0){
@@ -1927,9 +1927,9 @@ int ieee80211_parse_info_param(struct ieee80211_device *ieee,
 									sizeof(network->bssht.bdHTInfoBuf):tmp_htinfo_len;
 								memcpy(network->bssht.bdHTInfoBuf,info_element->data,network->bssht.bdHTInfoLen);
 							}
-							
+
 						}
-						
+
 				}
 			}
 
@@ -1943,7 +1943,7 @@ int ieee80211_parse_info_param(struct ieee80211_device *ieee,
 
 						ht_realtek_agg_len = min(info_element->len,(u8)MAX_IE_LEN);
 						memcpy(ht_realtek_agg_buf,info_element->data,info_element->len);
-						
+
 					}
 					if(ht_realtek_agg_len >= 5){
 						network->bssht.bdRT2RTAggregation = true;
@@ -1960,7 +1960,7 @@ int ieee80211_parse_info_param(struct ieee80211_device *ieee,
 				if((info_element->len >= 3 &&
 					 info_element->data[0] == 0x00 &&
 					 info_element->data[1] == 0x05 &&
-					 info_element->data[2] == 0xb5) || 
+					 info_element->data[2] == 0xb5) ||
 					 (info_element->len >= 3 &&
 					 info_element->data[0] == 0x00 &&
 					 info_element->data[1] == 0x0a &&
@@ -1974,7 +1974,7 @@ int ieee80211_parse_info_param(struct ieee80211_device *ieee,
 
 				}
 			}
-#if 0	
+#if 0
 			if (tmp_htcap_len !=0)
 				{
 					u16 cap_ext = ((PHT_CAPABILITY_ELE)&info_element->data[0])->ExtHTCapInfo;
@@ -1994,7 +1994,7 @@ int ieee80211_parse_info_param(struct ieee80211_device *ieee,
 			else
 				network->ralink_cap_exist = false;
 			//added by amy for atheros AP
-			if((info_element->len >= 3 && 
+			if((info_element->len >= 3 &&
 				info_element->data[0] == 0x00 &&
 				info_element->data[1] == 0x03 &&
 				info_element->data[2] == 0x7f) ||
@@ -2019,7 +2019,7 @@ int ieee80211_parse_info_param(struct ieee80211_device *ieee,
 			else
 				network->cisco_cap_exist = false;
 			//added by amy for LEAP of cisco
-			if(info_element->len > 4 && 
+			if(info_element->len > 4 &&
 				info_element->data[0] == 0x00 &&
 				info_element->data[1] == 0x40 &&
 				info_element->data[2] == 0x96 &&
@@ -2035,7 +2035,7 @@ int ieee80211_parse_info_param(struct ieee80211_device *ieee,
 					else
 						network->bCcxRmEnable = false;
 					//
-					// CCXv4 Table 59-1 MBSSID Masks. 
+					// CCXv4 Table 59-1 MBSSID Masks.
 					//
 					network->MBssidMask = network->CcxRmState[1] & 0x07;
 					if(network->MBssidMask != 0)
@@ -2055,7 +2055,7 @@ int ieee80211_parse_info_param(struct ieee80211_device *ieee,
 					network->bCcxRmEnable = false;
 				}
 			}
-			if(info_element->len > 4  && 
+			if(info_element->len > 4  &&
 				info_element->data[0] == 0x00 &&
 				info_element->data[1] == 0x40 &&
 				info_element->data[2] == 0x96 &&
@@ -2083,7 +2083,7 @@ int ieee80211_parse_info_param(struct ieee80211_device *ieee,
 			       network->rsn_ie_len);
 			break;
 
-                        //HT related element.	
+			//HT related element.
 		case MFIE_TYPE_HT_CAP:
 			IEEE80211_DEBUG_SCAN("MFIE_TYPE_HT_CAP: %d bytes\n",
 					     info_element->len);
@@ -2093,10 +2093,10 @@ int ieee80211_parse_info_param(struct ieee80211_device *ieee,
 				network->bssht.bdHTCapLen = tmp_htcap_len > sizeof(network->bssht.bdHTCapBuf)?\
 					sizeof(network->bssht.bdHTCapBuf):tmp_htcap_len;
 				memcpy(network->bssht.bdHTCapBuf,info_element->data,network->bssht.bdHTCapLen);
-				
+
 				//If peer is HT, but not WMM, call QosSetLegacyWMMParamWithHT()
 				// windows driver will update WMM parameters each beacon received once connected
-                                // Linux driver is a bit different.
+				// Linux driver is a bit different.
 				network->bssht.bdSupportHT = true;
 			}
 			else
@@ -2129,7 +2129,7 @@ int ieee80211_parse_info_param(struct ieee80211_device *ieee,
 				if(	(info_element->data[IE_CISCO_FLAG_POSITION]&SUPPORT_CKIP_MIC)	||
 					(info_element->data[IE_CISCO_FLAG_POSITION]&SUPPORT_CKIP_PK)	)
 				{
-		 			network->bCkipSupported = true;
+					network->bCkipSupported = true;
 				}
 				else
 				{
@@ -2139,7 +2139,7 @@ int ieee80211_parse_info_param(struct ieee80211_device *ieee,
 			else
 			{
 				network->bWithAironetIE = false;
-		 		network->bCkipSupported = false;
+				network->bCkipSupported = false;
 			}
 			break;
 		case MFIE_TYPE_QOS_PARAMETER:
@@ -2208,7 +2208,7 @@ int ieee80211_parse_info_param(struct ieee80211_device *ieee,
 		    data[info_element->len];
 	}
 
-	if(!network->atheros_cap_exist && !network->broadcom_cap_exist && 
+	if(!network->atheros_cap_exist && !network->broadcom_cap_exist &&
 		!network->cisco_cap_exist && !network->ralink_cap_exist && !network->bssht.bdRT2RTAggregation)
 	{
 		network->unknown_cap_exist = true;
@@ -2226,51 +2226,51 @@ static inline u8 ieee80211_SignalStrengthTranslate(
 {
 	u8 RetSS;
 
-	// Step 1. Scale mapping. 
+	// Step 1. Scale mapping.
 	if(CurrSS >= 71 && CurrSS <= 100)
 	{
 		RetSS = 90 + ((CurrSS - 70) / 3);
-	}	
+	}
 	else if(CurrSS >= 41 && CurrSS <= 70)
 	{
 		RetSS = 78 + ((CurrSS - 40) / 3);
-	}	
+	}
 	else if(CurrSS >= 31 && CurrSS <= 40)
 	{
 		RetSS = 66 + (CurrSS - 30);
-	}	
+	}
 	else if(CurrSS >= 21 && CurrSS <= 30)
 	{
 		RetSS = 54 + (CurrSS - 20);
-	}	
+	}
 	else if(CurrSS >= 5 && CurrSS <= 20)
 	{
 		RetSS = 42 + (((CurrSS - 5) * 2) / 3);
-	}	
+	}
 	else if(CurrSS == 4)
 	{
-		RetSS = 36; 
+		RetSS = 36;
 	}
 	else if(CurrSS == 3)
 	{
-		RetSS = 27; 
+		RetSS = 27;
 	}
 	else if(CurrSS == 2)
 	{
-		RetSS = 18; 
+		RetSS = 18;
 	}
 	else if(CurrSS == 1)
 	{
-		RetSS = 9; 
+		RetSS = 9;
 	}
 	else
 	{
-		RetSS = CurrSS; 
+		RetSS = CurrSS;
 	}
 	//RT_TRACE(COMP_DBG, DBG_LOUD, ("##### After Mapping:  LastSS: %d, CurrSS: %d, RetSS: %d\n", LastSS, CurrSS, RetSS));
 
 	// Step 2. Smoothing.
-	
+
 	//RT_TRACE(COMP_DBG, DBG_LOUD, ("$$$$$ After Smoothing:  LastSS: %d, CurrSS: %d, RetSS: %d\n", LastSS, CurrSS, RetSS));
 
 	return RetSS;
@@ -2281,8 +2281,8 @@ long ieee80211_translate_todbm(u8 signal_strength_index	)// 0-100 index.
 	long	signal_power; // in dBm.
 
 	// Translate to dBm (x=0.5y-95).
-	signal_power = (long)((signal_strength_index + 1) >> 1); 
-	signal_power -= 95; 
+	signal_power = (long)((signal_strength_index + 1) >> 1);
+	signal_power -= 95;
 
 	return signal_power;
 }
@@ -2298,10 +2298,10 @@ static inline int ieee80211_network_init(
 	//char *p;
 #endif
 
-        network->qos_data.active = 0;
-        network->qos_data.supported = 0;
-        network->qos_data.param_count = 0;
-        network->qos_data.old_param_count = 0;
+	network->qos_data.active = 0;
+	network->qos_data.supported = 0;
+	network->qos_data.param_count = 0;
+	network->qos_data.old_param_count = 0;
 
 	/* Pull out fixed field data */
 	memcpy(network->bssid, beacon->header.addr3, ETH_ALEN);
@@ -2318,9 +2318,9 @@ static inline int ieee80211_network_init(
 	network->flags = 0;
 	network->atim_window = 0;
 	network->erp_value = (network->capability & WLAN_CAPABILITY_IBSS) ?
-            0x3 : 0x0;
+	    0x3 : 0x0;
 	network->berp_info_valid = false;
-        network->broadcom_cap_exist = false;
+	network->broadcom_cap_exist = false;
 	network->ralink_cap_exist = false;
 	network->atheros_cap_exist = false;
 	network->cisco_cap_exist = false;
@@ -2333,20 +2333,20 @@ static inline int ieee80211_network_init(
 	memset(network->CountryIeBuf, 0, MAX_IE_LEN);
 #endif
 //Initialize HT parameters
-	//ieee80211_ht_initialize(&network->bssht);	
-	HTInitializeBssDesc(&network->bssht);	
+	//ieee80211_ht_initialize(&network->bssht);
+	HTInitializeBssDesc(&network->bssht);
 	if (stats->freq == IEEE80211_52GHZ_BAND) {
 		/* for A band (No DS info) */
 		network->channel = stats->received_channel;
 	} else
 		network->flags |= NETWORK_HAS_CCK;
 
- 	network->wpa_ie_len = 0;
- 	network->rsn_ie_len = 0;
+	network->wpa_ie_len = 0;
+	network->rsn_ie_len = 0;
 
-        if (ieee80211_parse_info_param
-            (ieee,beacon->info_element, stats->len - sizeof(*beacon), network, stats))
-                return 1;
+	if (ieee80211_parse_info_param
+	    (ieee,beacon->info_element, stats->len - sizeof(*beacon), network, stats))
+		return 1;
 
 	network->mode = 0;
 	if (stats->freq == IEEE80211_52GHZ_BAND)
@@ -2376,7 +2376,7 @@ static inline int ieee80211_network_init(
 	if (ieee80211_is_empty_essid(network->ssid, network->ssid_len))
 		network->flags |= NETWORK_EMPTY_ESSID;
 
-#if 1	
+#if 1
 	stats->signal = 30 + (stats->SignalStrength * 70) / 100;
 	//stats->signal = ieee80211_SignalStrengthTranslate(stats->signal);
 	stats->noise = ieee80211_translate_todbm((u8)(100-stats->signal)) -25;
@@ -2391,7 +2391,7 @@ static inline int is_same_network(struct ieee80211_network *src,
 				  struct ieee80211_network *dst, struct ieee80211_device* ieee)
 {
 	/* A network is only a duplicate if the channel, BSSID, ESSID
-	 * and the capability field (in particular IBSS and BSS) all match.  
+	 * and the capability field (in particular IBSS and BSS) all match.
 	 * We treat all <hidden> with the same BSSID and channel
 	 * as one network */
 	return //((src->ssid_len == dst->ssid_len) &&
@@ -2400,9 +2400,9 @@ static inline int is_same_network(struct ieee80211_network *src,
 		!memcmp(src->bssid, dst->bssid, ETH_ALEN) &&
 		//!memcmp(src->ssid, dst->ssid, src->ssid_len) &&
 		(!memcmp(src->ssid, dst->ssid, src->ssid_len) || (ieee->iw_mode == IW_MODE_INFRA)) &&
-		((src->capability & WLAN_CAPABILITY_IBSS) == 
+		((src->capability & WLAN_CAPABILITY_IBSS) ==
 		(dst->capability & WLAN_CAPABILITY_IBSS)) &&
-		((src->capability & WLAN_CAPABILITY_BSS) == 
+		((src->capability & WLAN_CAPABILITY_BSS) ==
 		(dst->capability & WLAN_CAPABILITY_BSS)));
 }
 
@@ -2441,8 +2441,8 @@ static inline void update_network(struct ieee80211_network *dst,
 	dst->last_dtim_sta_time[0] = src->last_dtim_sta_time[0];
 	dst->last_dtim_sta_time[1] = src->last_dtim_sta_time[1];
 	memcpy(&dst->tim, &src->tim, sizeof(struct ieee80211_tim_parameters));
-	
-        dst->bssht.bdSupportHT = src->bssht.bdSupportHT;
+
+	dst->bssht.bdSupportHT = src->bssht.bdSupportHT;
 	dst->bssht.bdRT2RTAggregation = src->bssht.bdRT2RTAggregation;
 	dst->bssht.bdHTCapLen= src->bssht.bdHTCapLen;
 	memcpy(dst->bssht.bdHTCapBuf,src->bssht.bdHTCapBuf,src->bssht.bdHTCapLen);
@@ -2473,14 +2473,14 @@ static inline void update_network(struct ieee80211_network *dst,
 		dst->qos_data.supported = src->qos_data.supported;
 		dst->qos_data.param_count = src->qos_data.param_count;
 	}
-	
+
 	if(dst->qos_data.supported == 1) {
 		dst->QoS_Enable = 1;
 		if(dst->ssid_len)
 			IEEE80211_DEBUG_QOS
 				("QoS the network %s is QoS supported\n",
 				dst->ssid);
-		else 
+		else
 			IEEE80211_DEBUG_QOS
 				("QoS the network is QoS supported\n");
 	}
@@ -2488,7 +2488,7 @@ static inline void update_network(struct ieee80211_network *dst,
 	dst->qos_data.old_param_count = old_param;
 
 	/* dst->last_associate is not overwritten */
-#if 1	
+#if 1
 	dst->wmm_info = src->wmm_info; //sure to exist in beacon or probe response frame.
 	if(src->wmm_param[0].ac_aci_acm_aifsn|| \
 	   src->wmm_param[1].ac_aci_acm_aifsn|| \
@@ -2497,9 +2497,9 @@ static inline void update_network(struct ieee80211_network *dst,
 	  memcpy(dst->wmm_param, src->wmm_param, WME_AC_PRAM_LEN);
 	}
 	//dst->QoS_Enable = src->QoS_Enable;
-#else	
+#else
 	dst->QoS_Enable = 1;//for Rtl8187 simulation
-#endif	
+#endif
 #ifdef THOMAS_TURBO
 	dst->Turbo_Enable = src->Turbo_Enable;
 #endif
@@ -2522,7 +2522,7 @@ static inline void update_network(struct ieee80211_network *dst,
 
 }
 
-static inline int is_beacon(__le16 fc) 
+static inline int is_beacon(__le16 fc)
 {
 	return (WLAN_FC_GET_STYPE(le16_to_cpu(fc)) == IEEE80211_STYPE_BEACON);
 }
@@ -2541,7 +2541,7 @@ static inline void ieee80211_process_probe_response(
 	unsigned long flags;
 	short renew;
 	//u8 wmm_info;
-	
+
 	memset(&network, 0, sizeof(struct ieee80211_network));
 	IEEE80211_DEBUG_SCAN(
 		"'%s' (" MAC_FMT "): %c%c%c%c %c%c%c%c-%c%c%c%c %c%c%c%c\n",
@@ -2576,11 +2576,11 @@ static inline void ieee80211_process_probe_response(
 	}
 
 #ifdef ENABLE_DOT11D
-	// For Asus EeePc request, 
-	// (1) if wireless adapter receive get any 802.11d country code in AP beacon, 
-	//	   wireless adapter should follow the country code. 
-	// (2)  If there is no any country code in beacon, 
-	//       then wireless adapter should do active scan from ch1~11 and 
+	// For Asus EeePc request,
+	// (1) if wireless adapter receive get any 802.11d country code in AP beacon,
+	//	   wireless adapter should follow the country code.
+	// (2)  If there is no any country code in beacon,
+	//       then wireless adapter should do active scan from ch1~11 and
 	//       passive scan from ch12~14
 
 	if( !IsLegalChannel(ieee, network.channel) )
@@ -2599,7 +2599,7 @@ static inline void ieee80211_process_probe_response(
 				}
 			}
 			// Case 2: No any country code.
-			else  
+			else
 			{
 				// Filter over channel ch12~14
 				if(network.channel > 11)
@@ -2621,7 +2621,7 @@ static inline void ieee80211_process_probe_response(
 				}
 			}
 			// Case 2: No any country code.
-			else  
+			else
 			{
 				// Filter over channel ch12~14
 				if(network.channel > 14)
@@ -2631,7 +2631,7 @@ static inline void ieee80211_process_probe_response(
 				}
 			}
 		}
-	}		
+	}
 #endif
 
 	/* The network parsed correctly -- so now we scan our known networks
@@ -2645,7 +2645,7 @@ static inline void ieee80211_process_probe_response(
 	 * already there. */
 
 	spin_lock_irqsave(&ieee->lock, flags);
-	
+
 	if(is_same_network(&ieee->current_network, &network, ieee)) {
 		update_network(&ieee->current_network, &network);
 		if((ieee->current_network.mode == IEEE_N_24G || ieee->current_network.mode == IEEE_G)
@@ -2663,7 +2663,7 @@ static inline void ieee80211_process_probe_response(
 		else //hidden AP
 			network.flags = (~NETWORK_EMPTY_ESSID & network.flags)|(NETWORK_EMPTY_ESSID & ieee->current_network.flags);
 	}
-		
+
 	list_for_each_entry(target, &ieee->network_list, list) {
 		if (is_same_network(target, &network, ieee))
 			break;
@@ -2704,7 +2704,7 @@ static inline void ieee80211_process_probe_response(
 		memcpy(target, &network, sizeof(*target));
 		list_add_tail(&target->list, &ieee->network_list);
 		if(ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE)
-			ieee80211_softmac_new_net(ieee,&network); 
+			ieee80211_softmac_new_net(ieee,&network);
 	} else {
 		IEEE80211_DEBUG_SCAN("Updating '%s' (" MAC_FMT ") via %s.\n",
 				     escape_essid(target->ssid,
@@ -2713,9 +2713,9 @@ static inline void ieee80211_process_probe_response(
 				     WLAN_FC_GET_STYPE(beacon->header.frame_ctl) ==
 				     IEEE80211_STYPE_PROBE_RESP ?
 				     "PROBE RESPONSE" : "BEACON");
-		
+
 		/* we have an entry and we are going to update it. But this entry may
-		 * be already expired. In this case we do the same as we found a new 
+		 * be already expired. In this case we do the same as we found a new
 		 * net and call the new_net handler
 		 */
 		renew = !time_after(target->last_scanned + ieee->scan_age, jiffies);
@@ -2729,10 +2729,10 @@ static inline void ieee80211_process_probe_response(
 		    ||((ieee->current_network.ssid_len == network.ssid_len)&&(strncmp(ieee->current_network.ssid, network.ssid, network.ssid_len) == 0)&&(ieee->state == IEEE80211_NOLINK))))
 			renew = 1;
 		//YJ,add,080819,for hidden ap,end
-		
+
 		update_network(target, &network);
 		if(renew && (ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE))
-			ieee80211_softmac_new_net(ieee,&network); 
+			ieee80211_softmac_new_net(ieee,&network);
 	}
 
 	spin_unlock_irqrestore(&ieee->lock, flags);
@@ -2740,7 +2740,7 @@ static inline void ieee80211_process_probe_response(
 		(ieee->state == IEEE80211_LINKED)) {
 		if(ieee->handle_beacon != NULL) {
 			ieee->handle_beacon(ieee->dev,beacon,&ieee->current_network);
-		}	
+		}
 	}
 }
 
@@ -2749,7 +2749,7 @@ void ieee80211_rx_mgt(struct ieee80211_device *ieee,
 		      struct ieee80211_rx_stats *stats)
 {
 	switch (WLAN_FC_GET_STYPE(header->frame_ctl)) {
-	
+
 	case IEEE80211_STYPE_BEACON:
 		IEEE80211_DEBUG_MGMT("received BEACON (%d)\n",
 				     WLAN_FC_GET_STYPE(header->frame_ctl));
@@ -2757,7 +2757,7 @@ void ieee80211_rx_mgt(struct ieee80211_device *ieee,
 		ieee80211_process_probe_response(
 			ieee, (struct ieee80211_probe_response *)header, stats);
 		break;
-		
+
 	case IEEE80211_STYPE_PROBE_RESP:
 		IEEE80211_DEBUG_MGMT("received PROBE RESPONSE (%d)\n",
 				     WLAN_FC_GET_STYPE(header->frame_ctl));
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
index 4f063c7..42d0f9a 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
@@ -1,14 +1,14 @@
 /* IEEE 802.11 SoftMAC layer
  * Copyright (c) 2005 Andrea Merello <andreamrl at tiscali.it>
  *
- * Mostly extracted from the rtl8180-sa2400 driver for the 
+ * Mostly extracted from the rtl8180-sa2400 driver for the
  * in-kernel generic ieee802.11 stack.
  *
  * Few lines might be stolen from other part of the ieee80211
  * stack. Copyright who own it's copyright
  *
  * WPA code stolen from the ipw2200 driver.
- * Copyright who own it's copyright. 
+ * Copyright who own it's copyright.
  *
  * released under the GPL
  */
@@ -26,10 +26,10 @@
 
 u8 rsn_authen_cipher_suite[16][4] = {
 	{0x00,0x0F,0xAC,0x00}, //Use group key, //Reserved
-	{0x00,0x0F,0xAC,0x01}, //WEP-40         //RSNA default      
-	{0x00,0x0F,0xAC,0x02}, //TKIP           //NONE		//{used just as default} 	
-	{0x00,0x0F,0xAC,0x03}, //WRAP-historical 
-	{0x00,0x0F,0xAC,0x04}, //CCMP 
+	{0x00,0x0F,0xAC,0x01}, //WEP-40         //RSNA default
+	{0x00,0x0F,0xAC,0x02}, //TKIP           //NONE		//{used just as default}
+	{0x00,0x0F,0xAC,0x03}, //WRAP-historical
+	{0x00,0x0F,0xAC,0x04}, //CCMP
 	{0x00,0x0F,0xAC,0x05}, //WEP-104
 };
 
@@ -50,25 +50,25 @@ short ieee80211_is_shortslot(struct ieee80211_network net)
 unsigned int ieee80211_MFIE_rate_len(struct ieee80211_device *ieee)
 {
 	unsigned int rate_len = 0;
-	
+
 	if (ieee->modulation & IEEE80211_CCK_MODULATION)
 		rate_len = IEEE80211_CCK_RATE_LEN + 2;
-		
+
 	if (ieee->modulation & IEEE80211_OFDM_MODULATION)
-		
+
 		rate_len += IEEE80211_OFDM_RATE_LEN + 2;
-	
+
 	return rate_len;
 }
 
-/* pleace the MFIE rate, tag to the memory (double) poined. 
+/* pleace the MFIE rate, tag to the memory (double) poined.
  * Then it updates the pointer so that
  * it points after the new MFIE tag added.
- */  
+ */
 void ieee80211_MFIE_Brate(struct ieee80211_device *ieee, u8 **tag_p)
 {
-	u8 *tag = *tag_p; 
-	
+	u8 *tag = *tag_p;
+
 	if (ieee->modulation & IEEE80211_CCK_MODULATION){
 		*tag++ = MFIE_TYPE_RATES;
 		*tag++ = 4;
@@ -77,17 +77,17 @@ void ieee80211_MFIE_Brate(struct ieee80211_device *ieee, u8 **tag_p)
 		*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_5MB;
 		*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_11MB;
 	}
-	
+
 	/* We may add an option for custom rates that specific HW might support */
 	*tag_p = tag;
 }
 
 void ieee80211_MFIE_Grate(struct ieee80211_device *ieee, u8 **tag_p)
-{	
-	u8 *tag = *tag_p; 
-	
+{
+	u8 *tag = *tag_p;
+
 		if (ieee->modulation & IEEE80211_OFDM_MODULATION){
-		
+
 		*tag++ = MFIE_TYPE_RATES_EX;
 		*tag++ = 8;
 		*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_6MB;
@@ -98,9 +98,9 @@ void ieee80211_MFIE_Grate(struct ieee80211_device *ieee, u8 **tag_p)
 		*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_36MB;
 		*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_48MB;
 		*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_54MB;
-		
+
 	}
-	
+
 	/* We may add an option for custom rates that specific HW might support */
 	*tag_p = tag;
 }
@@ -117,13 +117,13 @@ void ieee80211_WMM_Info(struct ieee80211_device *ieee, u8 **tag_p) {
 	*tag++ = 0x02;//5
 	*tag++ = 0x00;
 	*tag++ = 0x01;
-#ifdef SUPPORT_USPD	
+#ifdef SUPPORT_USPD
 	if(ieee->current_network.wmm_info & 0x80) {
 		*tag++ = 0x0f|MAX_SP_Len;
 	} else {
 		*tag++ = MAX_SP_Len;
 	}
-#else 
+#else
 	*tag++ = MAX_SP_Len;
 #endif
 	*tag_p = tag;
@@ -133,14 +133,14 @@ void ieee80211_WMM_Info(struct ieee80211_device *ieee, u8 **tag_p) {
 void ieee80211_TURBO_Info(struct ieee80211_device *ieee, u8 **tag_p) {
 	u8 *tag = *tag_p;
 
-        *tag++ = MFIE_TYPE_GENERIC; //0
-        *tag++ = 7;
-        *tag++ = 0x00;
-        *tag++ = 0xe0;
-        *tag++ = 0x4c;
-        *tag++ = 0x01;//5
-        *tag++ = 0x02;
-        *tag++ = 0x11;
+	*tag++ = MFIE_TYPE_GENERIC; //0
+	*tag++ = 7;
+	*tag++ = 0x00;
+	*tag++ = 0xe0;
+	*tag++ = 0x4c;
+	*tag++ = 0x01;//5
+	*tag++ = 0x02;
+	*tag++ = 0x11;
 	*tag++ = 0x00;
 
 	*tag_p = tag;
@@ -152,32 +152,32 @@ void enqueue_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb)
 {
 	int nh;
 	nh = (ieee->mgmt_queue_head +1) % MGMT_QUEUE_NUM;
-			
+
 /*
  * if the queue is full but we have newer frames then
  * just overwrites the oldest.
- *	
+ *
  * if (nh == ieee->mgmt_queue_tail)
  *		return -1;
- */		
+ */
 	ieee->mgmt_queue_head = nh;
 	ieee->mgmt_queue_ring[nh] = skb;
-	
+
 	//return 0;
 }
 
 struct sk_buff *dequeue_mgmt(struct ieee80211_device *ieee)
 {
 	struct sk_buff *ret;
-	
+
 	if(ieee->mgmt_queue_tail == ieee->mgmt_queue_head)
 		return NULL;
-		
+
 	ret = ieee->mgmt_queue_ring[ieee->mgmt_queue_tail];
-	
-	ieee->mgmt_queue_tail = 
+
+	ieee->mgmt_queue_tail =
 		(ieee->mgmt_queue_tail+1) % MGMT_QUEUE_NUM;
-	
+
 	return ret;
 }
 
@@ -193,7 +193,7 @@ u8 MgntQuery_MgntFrameTxRate(struct ieee80211_device *ieee)
 
 	// 2008/01/25 MH For broadcom, MGNT frame set as OFDM 6M.
 	if(pHTInfo->IOTAction & HT_IOT_ACT_MGNT_USE_CCK_6M)
-		rate = 0x0c;    
+		rate = 0x0c;
 	else
 		rate = ieee->basic_rate & 0x7f;
 
@@ -232,16 +232,16 @@ inline void softmac_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee
 
 	cb_desc *tcb_desc = (cb_desc *)(skb->cb + 8);
 	spin_lock_irqsave(&ieee->lock, flags);
-	
+
 	/* called with 2nd param 0, no mgmt lock required */
 	ieee80211_sta_wakeup(ieee,0);
-	
+
 	tcb_desc->queue_index = MGNT_QUEUE;
-	tcb_desc->data_rate = MgntQuery_MgntFrameTxRate(ieee);	
-        tcb_desc->RATRIndex = 7;
-        tcb_desc->bTxDisableRateFallBack = 1;
-        tcb_desc->bTxUseDriverAssingedRate = 1;
-	
+	tcb_desc->data_rate = MgntQuery_MgntFrameTxRate(ieee);
+	tcb_desc->RATRIndex = 7;
+	tcb_desc->bTxDisableRateFallBack = 1;
+	tcb_desc->bTxUseDriverAssingedRate = 1;
+
 	if(single){
 		if(ieee->queue_stop){
 			enqueue_mgmt(ieee,skb);
@@ -252,13 +252,13 @@ inline void softmac_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee
 				ieee->seq_ctrl[0] = 0;
 			else
 				ieee->seq_ctrl[0]++;
-			
+
 			/* avoid watchdog triggers */
 			ieee->dev->trans_start = jiffies;
 			ieee->softmac_data_hard_start_xmit(skb,ieee->dev,ieee->basic_rate);
 			//dev_kfree_skb_any(skb);//edit by thomas
 		}
-		
+
 		spin_unlock_irqrestore(&ieee->lock, flags);
 	}else{
 		spin_unlock_irqrestore(&ieee->lock, flags);
@@ -276,7 +276,7 @@ inline void softmac_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee
 				(skb_queue_len(&ieee->skb_waitQ[tcb_desc->queue_index]) != 0)||\
 				(ieee->queue_stop) ) {
 			/* insert the skb packet to the management queue */
-			/* as for the completion function, it does not need 
+			/* as for the completion function, it does not need
 			 * to check it any more.
 			 * */
 			printk("%s():insert to waitqueue!\n",__FUNCTION__);
@@ -292,36 +292,36 @@ inline void softmac_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee
 
 inline void softmac_ps_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee)
 {
-	
+
 	short single = ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE;
 	struct ieee80211_hdr_3addr  *header =
 		(struct ieee80211_hdr_3addr  *) skb->data;
-	
-	
+
+
 	if(single){
-		
+
 		header->seq_ctl = cpu_to_le16(ieee->seq_ctrl[0] << 4);
 
 		if (ieee->seq_ctrl[0] == 0xFFF)
 			ieee->seq_ctrl[0] = 0;
 		else
 			ieee->seq_ctrl[0]++;
-			
+
 		/* avoid watchdog triggers */
 		ieee->dev->trans_start = jiffies;
 		ieee->softmac_data_hard_start_xmit(skb,ieee->dev,ieee->basic_rate);
-	
+
 	}else{
-		
+
 		header->seq_ctl = cpu_to_le16(ieee->seq_ctrl[0] << 4);
-	
+
 		if (ieee->seq_ctrl[0] == 0xFFF)
 			ieee->seq_ctrl[0] = 0;
 		else
 			ieee->seq_ctrl[0]++;
 
 		ieee->softmac_hard_start_xmit(skb,ieee->dev);
-		
+
 	}
 	//dev_kfree_skb_any(skb);//edit by thomas
 }
@@ -332,33 +332,33 @@ inline struct sk_buff *ieee80211_probe_req(struct ieee80211_device *ieee)
 	u8 *tag;
 	struct sk_buff *skb;
 	struct ieee80211_probe_request *req;
-	
+
 	len = ieee->current_network.ssid_len;
-	
+
 	rate_len = ieee80211_MFIE_rate_len(ieee);
-	
+
 	skb = dev_alloc_skb(sizeof(struct ieee80211_probe_request) +
 			    2 + len + rate_len + ieee->tx_headroom);
-	if (!skb) 
+	if (!skb)
 		return NULL;
 
 	skb_reserve(skb, ieee->tx_headroom);
-	
+
 	req = (struct ieee80211_probe_request *) skb_put(skb,sizeof(struct ieee80211_probe_request));
 	req->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_PROBE_REQ);
-	req->header.duration_id = 0; //FIXME: is this OK ? 
-	
+	req->header.duration_id = 0; //FIXME: is this OK ?
+
 	memset(req->header.addr1, 0xff, ETH_ALEN);
 	memcpy(req->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
 	memset(req->header.addr3, 0xff, ETH_ALEN);
-	
+
 	tag = (u8 *) skb_put(skb,len+2+rate_len);
-	
+
 	*tag++ = MFIE_TYPE_SSID;
 	*tag++ = len;
 	memcpy(tag, ieee->current_network.ssid, len);
 	tag += len;
-	
+
 	ieee80211_MFIE_Brate(ieee,&tag);
 	ieee80211_MFIE_Grate(ieee,&tag);
 	return skb;
@@ -369,18 +369,18 @@ void ieee80211_send_beacon(struct ieee80211_device *ieee)
 {
 	struct sk_buff *skb;
 	if(!ieee->ieee_up)
-		return;		
-	//unsigned long flags;	
+		return;
+	//unsigned long flags;
 	skb = ieee80211_get_beacon_(ieee);
-	
+
 	if (skb){
 		softmac_mgmt_xmit(skb, ieee);
 		ieee->softmac_stats.tx_beacons++;
 		//dev_kfree_skb_any(skb);//edit by thomas
 	}
-//	ieee->beacon_timer.expires = jiffies + 
+//	ieee->beacon_timer.expires = jiffies +
 //		(MSECS( ieee->current_network.beacon_interval -5));
-	
+
 	//spin_lock_irqsave(&ieee->beacon_lock,flags);
 	if(ieee->beacon_txing && ieee->ieee_up){
 //		if(!timer_pending(&ieee->beacon_timer))
@@ -424,7 +424,7 @@ void ieee80211_send_probe_requests(struct ieee80211_device *ieee)
 }
 
 /* this performs syncro scan blocking the caller until all channels
- * in the allowed channel map has been checked. 
+ * in the allowed channel map has been checked.
  */
 void ieee80211_softmac_scan_syncro(struct ieee80211_device *ieee)
 {
@@ -434,25 +434,25 @@ void ieee80211_softmac_scan_syncro(struct ieee80211_device *ieee)
 	memcpy(channel_map, GET_DOT11D_INFO(ieee)->channel_map, MAX_CHANNEL_NUMBER+1);
 #endif
 	down(&ieee->scan_sem);
-	
+
 	while(1)
 	{
-		
+
 		do{
 			ch++;
-			if (ch > MAX_CHANNEL_NUMBER) 
+			if (ch > MAX_CHANNEL_NUMBER)
 				goto out; /* scan completed */
 #ifdef ENABLE_DOT11D
 		}while(!channel_map[ch]);
 #else
 		}while(!ieee->channel_map[ch]);
 #endif
-	
+
 		/* this fuction can be called in two situations
 		 * 1- We have switched to ad-hoc mode and we are
 		 *    performing a complete syncro scan before conclude
-		 *    there are no interesting cell and to create a 
-		 *    new one. In this case the link state is 
+		 *    there are no interesting cell and to create a
+		 *    new one. In this case the link state is
 		 *    IEEE80211_NOLINK until we found an interesting cell.
 		 *    If so the ieee8021_new_net, called by the RX path
 		 *    will set the state to IEEE80211_LINKED, so we stop
@@ -465,19 +465,19 @@ void ieee80211_softmac_scan_syncro(struct ieee80211_device *ieee)
 		 *    not filter RX frames and the channel is changing.
 		 * So the only situation in witch are interested is to check
 		 * if the state become LINKED because of the #1 situation
-		 */    
-		    
+		 */
+
 		if (ieee->state == IEEE80211_LINKED)
 			goto out;
 		ieee->set_chan(ieee->dev, ch);
 #ifdef ENABLE_DOT11D
 		if(channel_map[ch] == 1)
-#endif		
+#endif
 		ieee80211_send_probe_requests(ieee);
-		
+
 		/* this prevent excessive time wait when we
 		 * need to wait for a syncro scan to end..
-		 */  		
+		 */
 		if(ieee->state < IEEE80211_LINKED)
 			;
 		else
@@ -486,7 +486,7 @@ void ieee80211_softmac_scan_syncro(struct ieee80211_device *ieee)
 
 
 		msleep_interruptible_rsl(IEEE80211_SOFTMAC_SCAN_TIME);
-		
+
 	}
 out:
 	if(ieee->state < IEEE80211_LINKED){
@@ -498,25 +498,25 @@ out:
 #ifdef ENABLE_DOT11D
 	if(IS_DOT11D_ENABLE(ieee))
 		DOT11D_ScanComplete(ieee);
-#endif	
+#endif
 	up(&ieee->scan_sem);
 }
 }
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)	
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
 /* called both by wq with ieee->lock held */
 void ieee80211_softmac_scan(struct ieee80211_device *ieee)
 {
-#if 0	
+#if 0
 	short watchdog = 0;
 	do{
-		ieee->current_network.channel = 
+		ieee->current_network.channel =
 			(ieee->current_network.channel + 1) % MAX_CHANNEL_NUMBER;
-		if (watchdog++ > MAX_CHANNEL_NUMBER) 
+		if (watchdog++ > MAX_CHANNEL_NUMBER)
 				return; /* no good chans */
-				
+
 	}while(!ieee->channel_map[ieee->current_network.channel]);
-#endif		
+#endif
 
 	schedule_task(&ieee->softmac_scan_wq);
 }
@@ -525,8 +525,8 @@ void ieee80211_softmac_scan(struct ieee80211_device *ieee)
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
 void ieee80211_softmac_scan_wq(struct work_struct *work)
 {
-        struct delayed_work *dwork = container_of(work, struct delayed_work, work);
-        struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, softmac_scan_wq);
+	struct delayed_work *dwork = container_of(work, struct delayed_work, work);
+	struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, softmac_scan_wq);
 #else
 void ieee80211_softmac_scan_wq(struct ieee80211_device *ieee)
 {
@@ -537,16 +537,16 @@ void ieee80211_softmac_scan_wq(struct ieee80211_device *ieee)
 	memcpy(channel_map, GET_DOT11D_INFO(ieee)->channel_map, MAX_CHANNEL_NUMBER+1);
 #endif
 	if(!ieee->ieee_up)
-		return;	
+		return;
 	down(&ieee->scan_sem);
 	do{
-		ieee->current_network.channel = 
+		ieee->current_network.channel =
 			(ieee->current_network.channel + 1) % MAX_CHANNEL_NUMBER;
-		if (watchdog++ > MAX_CHANNEL_NUMBER) 
+		if (watchdog++ > MAX_CHANNEL_NUMBER)
 		{
 		//if current channel is not in channel map, set to default channel.
 		#ifdef ENABLE_DOT11D
-      			if (!channel_map[ieee->current_network.channel]);
+			if (!channel_map[ieee->current_network.channel]);
 		#else
 			if (!ieee->channel_map[ieee->current_network.channel]);
 		#endif
@@ -554,10 +554,10 @@ void ieee80211_softmac_scan_wq(struct ieee80211_device *ieee)
 				goto out; /* no good chans */
 		}
 #ifdef ENABLE_DOT11D
-        }while(!channel_map[ieee->current_network.channel]);
+	}while(!channel_map[ieee->current_network.channel]);
 #else
 	}while(!ieee->channel_map[ieee->current_network.channel]);
-#endif				
+#endif
 	if (ieee->scanning == 0 )
 		goto out;
 	ieee->set_chan(ieee->dev, ieee->current_network.channel);
@@ -567,11 +567,11 @@ void ieee80211_softmac_scan_wq(struct ieee80211_device *ieee)
 	ieee80211_send_probe_requests(ieee);
 
 
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)	
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
 	queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, IEEE80211_SOFTMAC_SCAN_TIME);
 #else
 	//ieee->scan_timer.expires = jiffies + MSECS(IEEE80211_SOFTMAC_SCAN_TIME);
-	if (ieee->scanning == 1) 
+	if (ieee->scanning == 1)
 		mod_timer(&ieee->scan_timer,(jiffies + MSECS(IEEE80211_SOFTMAC_SCAN_TIME)));
 #endif
 
@@ -581,19 +581,19 @@ out:
 #ifdef ENABLE_DOT11D
 	if(IS_DOT11D_ENABLE(ieee))
 		DOT11D_ScanComplete(ieee);
-#endif	
-        ieee->actscanning = false;
+#endif
+	ieee->actscanning = false;
 	watchdog = 0;
 	ieee->scanning = 0;
 	up(&ieee->scan_sem);
 }
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)	
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
 void ieee80211_softmac_scan_cb(unsigned long _dev)
 {
 	unsigned long flags;
 	struct ieee80211_device *ieee = (struct ieee80211_device *)_dev;
-	
+
 	spin_lock_irqsave(&ieee->lock, flags);
 	ieee80211_softmac_scan(ieee);
 	spin_unlock_irqrestore(&ieee->lock, flags);
@@ -603,12 +603,12 @@ void ieee80211_softmac_scan_cb(unsigned long _dev)
 
 void ieee80211_beacons_start(struct ieee80211_device *ieee)
 {
-	unsigned long flags;	
+	unsigned long flags;
 	spin_lock_irqsave(&ieee->beacon_lock,flags);
 
 	ieee->beacon_txing = 1;
 	ieee80211_send_beacon(ieee);
-	
+
 	spin_unlock_irqrestore(&ieee->beacon_lock,flags);
 }
 
@@ -619,7 +619,7 @@ void ieee80211_beacons_stop(struct ieee80211_device *ieee)
 	spin_lock_irqsave(&ieee->beacon_lock,flags);
 
 	ieee->beacon_txing = 0;
- 	del_timer_sync(&ieee->beacon_timer);
+	del_timer_sync(&ieee->beacon_timer);
 
 	spin_unlock_irqrestore(&ieee->beacon_lock,flags);
 
@@ -640,29 +640,29 @@ void ieee80211_start_send_beacons(struct ieee80211_device *ieee)
 	if(ieee->start_send_beacons)
 		ieee->start_send_beacons(ieee->dev,ieee->basic_rate);
 	if(ieee->softmac_features & IEEE_SOFTMAC_BEACONS)
-		ieee80211_beacons_start(ieee); 
+		ieee80211_beacons_start(ieee);
 }
 
 
 void ieee80211_softmac_stop_scan(struct ieee80211_device *ieee)
 {
-//	unsigned long flags;	
-	
+//	unsigned long flags;
+
 	//ieee->sync_scan_hurryup = 1;
-	
+
 	down(&ieee->scan_sem);
 //	spin_lock_irqsave(&ieee->lock, flags);
-	
+
 	if (ieee->scanning == 1){
 		ieee->scanning = 0;
 
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)	
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
 		cancel_delayed_work(&ieee->softmac_scan_wq);
 #else
 		del_timer_sync(&ieee->scan_timer);
 #endif
 	}
-	
+
 //	spin_unlock_irqrestore(&ieee->lock, flags);
 	up(&ieee->scan_sem);
 }
@@ -680,17 +680,17 @@ void ieee80211_start_scan(struct ieee80211_device *ieee)
 {
 #ifdef ENABLE_DOT11D
 	if(IS_DOT11D_ENABLE(ieee) )
-	{			
+	{
 		if(IS_COUNTRY_IE_VALID(ieee))
 		{
-			RESET_CIE_WATCHDOG(ieee); 
+			RESET_CIE_WATCHDOG(ieee);
 		}
 	}
 #endif
-	if (ieee->softmac_features & IEEE_SOFTMAC_SCAN){	
+	if (ieee->softmac_features & IEEE_SOFTMAC_SCAN){
 		if (ieee->scanning == 0){
 			ieee->scanning = 1;
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)	
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
 			queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, 0);
 #else
@@ -703,7 +703,7 @@ void ieee80211_start_scan(struct ieee80211_device *ieee)
 		}
 	}else
 		ieee->start_scan(ieee->dev);
-	
+
 }
 
 /* called with wx_sem held */
@@ -711,10 +711,10 @@ void ieee80211_start_scan_syncro(struct ieee80211_device *ieee)
 {
 #ifdef ENABLE_DOT11D
 	if(IS_DOT11D_ENABLE(ieee) )
-	{			
+	{
 		if(IS_COUNTRY_IE_VALID(ieee))
 		{
-			RESET_CIE_WATCHDOG(ieee); 
+			RESET_CIE_WATCHDOG(ieee);
 		}
 	}
 #endif
@@ -723,33 +723,33 @@ void ieee80211_start_scan_syncro(struct ieee80211_device *ieee)
 		ieee80211_softmac_scan_syncro(ieee);
 	else
 		ieee->scan_syncro(ieee->dev);
-		
+
 }
 
-inline struct sk_buff *ieee80211_authentication_req(struct ieee80211_network *beacon, 
+inline struct sk_buff *ieee80211_authentication_req(struct ieee80211_network *beacon,
 	struct ieee80211_device *ieee, int challengelen)
 {
-	struct sk_buff *skb;	
+	struct sk_buff *skb;
 	struct ieee80211_authentication *auth;
 	int len = sizeof(struct ieee80211_authentication) + challengelen + ieee->tx_headroom;
 
 
-	skb = dev_alloc_skb(len); 
+	skb = dev_alloc_skb(len);
 	if (!skb) return NULL;
-	
+
 	skb_reserve(skb, ieee->tx_headroom);
 	auth = (struct ieee80211_authentication *)
 		skb_put(skb, sizeof(struct ieee80211_authentication));
-	
+
 	auth->header.frame_ctl = IEEE80211_STYPE_AUTH;
 	if (challengelen) auth->header.frame_ctl |= IEEE80211_FCTL_WEP;
-	
+
 	auth->header.duration_id = 0x013a; //FIXME
-	
+
 	memcpy(auth->header.addr1, beacon->bssid, ETH_ALEN);
 	memcpy(auth->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
 	memcpy(auth->header.addr3, beacon->bssid, ETH_ALEN);
-	
+
 	//auth->algorithm = ieee->open_wep ? WLAN_AUTH_OPEN : WLAN_AUTH_SHARED_KEY;
 	if(ieee->auth_mode == 0)
 		auth->algorithm = WLAN_AUTH_OPEN;
@@ -760,11 +760,11 @@ inline struct sk_buff *ieee80211_authentication_req(struct ieee80211_network *be
 	printk("=================>%s():auth->algorithm is %d\n",__FUNCTION__,auth->algorithm);
 	auth->transaction = cpu_to_le16(ieee->associate_seq);
 	ieee->associate_seq++;
-	
+
 	auth->status = cpu_to_le16(WLAN_STATUS_SUCCESS);
-	
+
 	return skb;
-	
+
 }
 
 
@@ -777,7 +777,7 @@ static struct sk_buff* ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *d
 	int encrypt;
 	int atim_len,erp_len;
 	struct ieee80211_crypt_data* crypt;
-	
+
 	char *ssid = ieee->current_network.ssid;
 	int ssid_len = ieee->current_network.ssid_len;
 	int rate_len = ieee->current_network.rates_len+2;
@@ -794,25 +794,25 @@ static struct sk_buff* ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *d
 	u8 tmp_generic_ie_len=0;
 
 	if(rate_ex_len > 0) rate_ex_len+=2;
-	
+
 	if(ieee->current_network.capability & WLAN_CAPABILITY_IBSS)
 		atim_len = 4;
 	else
 		atim_len = 0;
-	
+
 #if 1
-	if(ieee80211_is_54g(ieee->current_network)) 
+	if(ieee80211_is_54g(ieee->current_network))
 		erp_len = 3;
 	else
 		erp_len = 0;
 #else
-      if((ieee->current_network.mode == IEEE_G) 
-	  	||( ieee->current_network.mode == IEEE_N_24G && ieee->pHTInfo->bCurSuppCCK)) {
-	  	erp_len = 3;
+      if((ieee->current_network.mode == IEEE_G)
+		||( ieee->current_network.mode == IEEE_N_24G && ieee->pHTInfo->bCurSuppCCK)) {
+		erp_len = 3;
 		erpinfo_content = 0;
 		if(ieee->current_network.buseprotection)
 			erpinfo_content |= ERP_UseProtection;
-      	}
+	}
 	else
 		erp_len = 0;
 #endif
@@ -820,26 +820,26 @@ static struct sk_buff* ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *d
 
 	crypt = ieee->crypt[ieee->tx_keyidx];
 
-	
-	encrypt = ieee->host_encrypt && crypt && crypt->ops && 
+
+	encrypt = ieee->host_encrypt && crypt && crypt->ops &&
 		((0 == strcmp(crypt->ops->name, "WEP") || wpa_ie_len));
-	//HT ralated element	
-#if 1	
+	//HT ralated element
+#if 1
 	tmp_ht_cap_buf =(u8*) &(ieee->pHTInfo->SelfHTCap);
 	tmp_ht_cap_len = sizeof(ieee->pHTInfo->SelfHTCap);
 	tmp_ht_info_buf =(u8*) &(ieee->pHTInfo->SelfHTInfo);
 	tmp_ht_info_len = sizeof(ieee->pHTInfo->SelfHTInfo);
 	HTConstructCapabilityElement(ieee, tmp_ht_cap_buf, &tmp_ht_cap_len,encrypt);
 	HTConstructInfoElement(ieee,tmp_ht_info_buf,&tmp_ht_info_len, encrypt);
-	
 
-        if(pHTInfo->bRegRT2RTAggregation)
-        {
-        	tmp_generic_ie_buf = ieee->pHTInfo->szRT2RTAggBuffer;
+
+	if(pHTInfo->bRegRT2RTAggregation)
+	{
+		tmp_generic_ie_buf = ieee->pHTInfo->szRT2RTAggBuffer;
 		tmp_generic_ie_len = sizeof(ieee->pHTInfo->szRT2RTAggBuffer);
 		HTConstructRT2RTAggElement(ieee, tmp_generic_ie_buf, &tmp_generic_ie_len);
-        }
-//	printk("===============>tmp_ht_cap_len is %d,tmp_ht_info_len is %d, tmp_generic_ie_len is %d\n",tmp_ht_cap_len,tmp_ht_info_len,tmp_generic_ie_len);	
+	}
+//	printk("===============>tmp_ht_cap_len is %d,tmp_ht_info_len is %d, tmp_generic_ie_len is %d\n",tmp_ht_cap_len,tmp_ht_info_len,tmp_generic_ie_len);
 #endif
 	beacon_size = sizeof(struct ieee80211_probe_response)+2+
 		ssid_len
@@ -848,14 +848,14 @@ static struct sk_buff* ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *d
 		+rate_ex_len
 		+atim_len
 		+erp_len
-                +wpa_ie_len
+		+wpa_ie_len
 	//	+tmp_ht_cap_len
 	//	+tmp_ht_info_len
 	//	+tmp_generic_ie_len
 //		+wmm_len+2
 		+ieee->tx_headroom;
 	skb = dev_alloc_skb(beacon_size);
-	if (!skb) 
+	if (!skb)
 		return NULL;
 	skb_reserve(skb, ieee->tx_headroom);
 	beacon_buf = (struct ieee80211_probe_response*) skb_put(skb, (beacon_size - ieee->tx_headroom));
@@ -864,44 +864,44 @@ static struct sk_buff* ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *d
 	memcpy (beacon_buf->header.addr3, ieee->current_network.bssid, ETH_ALEN);
 
 	beacon_buf->header.duration_id = 0; //FIXME
-	beacon_buf->beacon_interval = 
+	beacon_buf->beacon_interval =
 		cpu_to_le16(ieee->current_network.beacon_interval);
-	beacon_buf->capability = 
+	beacon_buf->capability =
 		cpu_to_le16(ieee->current_network.capability & WLAN_CAPABILITY_IBSS);
-	beacon_buf->capability |= 
+	beacon_buf->capability |=
 		cpu_to_le16(ieee->current_network.capability & WLAN_CAPABILITY_SHORT_PREAMBLE); //add short preamble here
 
 	if(ieee->short_slot && (ieee->current_network.capability & WLAN_CAPABILITY_SHORT_SLOT))
-		cpu_to_le16((beacon_buf->capability |= WLAN_CAPABILITY_SHORT_SLOT));		
-	
+		cpu_to_le16((beacon_buf->capability |= WLAN_CAPABILITY_SHORT_SLOT));
+
 	crypt = ieee->crypt[ieee->tx_keyidx];
 #if 0
-	encrypt = ieee->host_encrypt && crypt && crypt->ops && 
+	encrypt = ieee->host_encrypt && crypt && crypt->ops &&
 		(0 == strcmp(crypt->ops->name, "WEP"));
 #endif
-	if (encrypt)	
+	if (encrypt)
 		beacon_buf->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY);
-	
-		
+
+
 	beacon_buf->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_PROBE_RESP);
-	beacon_buf->info_element[0].id = MFIE_TYPE_SSID;	
+	beacon_buf->info_element[0].id = MFIE_TYPE_SSID;
 	beacon_buf->info_element[0].len = ssid_len;
-	
+
 	tag = (u8*) beacon_buf->info_element[0].data;
-	
+
 	memcpy(tag, ssid, ssid_len);
-	
+
 	tag += ssid_len;
-	
+
 	*(tag++) = MFIE_TYPE_RATES;
-	*(tag++) = rate_len-2; 
+	*(tag++) = rate_len-2;
 	memcpy(tag,ieee->current_network.rates,rate_len-2);
 	tag+=rate_len-2;
-	
+
 	*(tag++) = MFIE_TYPE_DS_SET;
 	*(tag++) = 1;
 	*(tag++) = ieee->current_network.channel;
-	
+
 	if(atim_len){
 	u16 val16;
 		*(tag++) = MFIE_TYPE_IBSS_SET;
@@ -911,28 +911,28 @@ static struct sk_buff* ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *d
 		memcpy((u8 *)tag, (u8 *)&val16, 2);
 		tag+=2;
 	}
-	
+
 	if(erp_len){
 		*(tag++) = MFIE_TYPE_ERP;
 		*(tag++) = 1;
-		*(tag++) = erpinfo_content; 
+		*(tag++) = erpinfo_content;
 	}
-#if 0	
-	//Include High Throuput capability 
-	
+#if 0
+	//Include High Throuput capability
+
 	*(tag++) = MFIE_TYPE_HT_CAP;
 	*(tag++) = tmp_ht_cap_len - 2;
-	memcpy(tag, tmp_ht_cap_buf, tmp_ht_cap_len - 2);	
+	memcpy(tag, tmp_ht_cap_buf, tmp_ht_cap_len - 2);
 	tag += tmp_ht_cap_len - 2;
 #endif
 	if(rate_ex_len){
 		*(tag++) = MFIE_TYPE_RATES_EX;
-		*(tag++) = rate_ex_len-2; 
+		*(tag++) = rate_ex_len-2;
 		memcpy(tag,ieee->current_network.rates_ex,rate_ex_len-2);
 		tag+=rate_ex_len-2;
 	}
 
-#if 0 
+#if 0
 	//Include High Throuput info
 
 	*(tag++) = MFIE_TYPE_HT_INFO;
@@ -941,7 +941,7 @@ static struct sk_buff* ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *d
 	tag += tmp_ht_info_len - 2;
 #endif
 	if (wpa_ie_len)
-	{	
+	{
 		if (ieee->iw_mode == IW_MODE_ADHOC)
 		{//as Windows will set pairwise key same as the group key which is not allowed in Linux, so set this for IOT issue. WB 2008.07.07
 			memcpy(&ieee->wpa_ie[14], &ieee->wpa_ie[8], 4);
@@ -950,7 +950,7 @@ static struct sk_buff* ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *d
 		tag += wpa_ie_len;
 	}
 
-#if 0 
+#if 0
 	//
 	// Construct Realtek Proprietary Aggregation mode (Set AMPDU Factor to 2, 32k)
 	//
@@ -960,10 +960,10 @@ static struct sk_buff* ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *d
 		(*tag++) = tmp_generic_ie_len - 2;
 		memcpy(tag,tmp_generic_ie_buf,tmp_generic_ie_len -2);
 		tag += tmp_generic_ie_len -2;
-		
+
 	}
 #endif
-#if 0 
+#if 0
 	if(ieee->qos_support)
 	{
 		(*tag++) = 0xdd;
@@ -981,54 +981,54 @@ struct sk_buff* ieee80211_assoc_resp(struct ieee80211_device *ieee, u8 *dest)
 {
 	struct sk_buff *skb;
 	u8* tag;
-	
+
 	struct ieee80211_crypt_data* crypt;
 	struct ieee80211_assoc_response_frame *assoc;
 	short encrypt;
-	
+
 	unsigned int rate_len = ieee80211_MFIE_rate_len(ieee);
 	int len = sizeof(struct ieee80211_assoc_response_frame) + rate_len + ieee->tx_headroom;
-	
-	skb = dev_alloc_skb(len); 
-	
-	if (!skb) 
+
+	skb = dev_alloc_skb(len);
+
+	if (!skb)
 		return NULL;
-	
+
 	skb_reserve(skb, ieee->tx_headroom);
 
 	assoc = (struct ieee80211_assoc_response_frame *)
 		skb_put(skb,sizeof(struct ieee80211_assoc_response_frame));
-	
+
 	assoc->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_ASSOC_RESP);
 	memcpy(assoc->header.addr1, dest,ETH_ALEN);
 	memcpy(assoc->header.addr3, ieee->dev->dev_addr, ETH_ALEN);
 	memcpy(assoc->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
-	assoc->capability = cpu_to_le16(ieee->iw_mode == IW_MODE_MASTER ? 
+	assoc->capability = cpu_to_le16(ieee->iw_mode == IW_MODE_MASTER ?
 		WLAN_CAPABILITY_BSS : WLAN_CAPABILITY_IBSS);
-	
-		
+
+
 	if(ieee->short_slot)
 		assoc->capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT);
-		
+
 	if (ieee->host_encrypt)
 		crypt = ieee->crypt[ieee->tx_keyidx];
 	else crypt = NULL;
-	
+
 	encrypt = ( crypt && crypt->ops);
-	   
+
 	if (encrypt)
 		assoc->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY);
-	
+
 	assoc->status = 0;
 	assoc->aid = cpu_to_le16(ieee->assoc_id);
 	if (ieee->assoc_id == 0x2007) ieee->assoc_id=0;
 	else ieee->assoc_id++;
-	
+
 	tag = (u8*) skb_put(skb, rate_len);
-	
+
 	ieee80211_MFIE_Brate(ieee, &tag);
 	ieee80211_MFIE_Grate(ieee, &tag);
-	
+
 	return skb;
 }
 
@@ -1037,59 +1037,59 @@ struct sk_buff* ieee80211_auth_resp(struct ieee80211_device *ieee,int status, u8
 	struct sk_buff *skb;
 	struct ieee80211_authentication *auth;
 	int len = ieee->tx_headroom + sizeof(struct ieee80211_authentication)+1;
-	
-	skb = dev_alloc_skb(len); 
-	
-	if (!skb) 
+
+	skb = dev_alloc_skb(len);
+
+	if (!skb)
 		return NULL;
-	
+
 	skb->len = sizeof(struct ieee80211_authentication);
-	
+
 	auth = (struct ieee80211_authentication *)skb->data;
-	
+
 	auth->status = cpu_to_le16(status);
 	auth->transaction = cpu_to_le16(2);
 	auth->algorithm = cpu_to_le16(WLAN_AUTH_OPEN);
-	
+
 	memcpy(auth->header.addr3, ieee->dev->dev_addr, ETH_ALEN);
 	memcpy(auth->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
 	memcpy(auth->header.addr1, dest, ETH_ALEN);
-	auth->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_AUTH); 
+	auth->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_AUTH);
 	return skb;
-	
-	
+
+
 }
 
 struct sk_buff* ieee80211_null_func(struct ieee80211_device *ieee,short pwr)
 {
 	struct sk_buff *skb;
 	struct ieee80211_hdr_3addr* hdr;
-	
-	skb = dev_alloc_skb(sizeof(struct ieee80211_hdr_3addr)); 
-	
-	if (!skb) 
+
+	skb = dev_alloc_skb(sizeof(struct ieee80211_hdr_3addr));
+
+	if (!skb)
 		return NULL;
-	
+
 	hdr = (struct ieee80211_hdr_3addr*)skb_put(skb,sizeof(struct ieee80211_hdr_3addr));
-	
+
 	memcpy(hdr->addr1, ieee->current_network.bssid, ETH_ALEN);
 	memcpy(hdr->addr2, ieee->dev->dev_addr, ETH_ALEN);
 	memcpy(hdr->addr3, ieee->current_network.bssid, ETH_ALEN);
-	
-	hdr->frame_ctl = cpu_to_le16(IEEE80211_FTYPE_DATA | 
-		IEEE80211_STYPE_NULLFUNC | IEEE80211_FCTL_TODS | 
-		(pwr ? IEEE80211_FCTL_PM:0)); 
-	
+
+	hdr->frame_ctl = cpu_to_le16(IEEE80211_FTYPE_DATA |
+		IEEE80211_STYPE_NULLFUNC | IEEE80211_FCTL_TODS |
+		(pwr ? IEEE80211_FCTL_PM:0));
+
 	return skb;
-	
-	
+
+
 }
 
 
 void ieee80211_resp_to_assoc_rq(struct ieee80211_device *ieee, u8* dest)
 {
 	struct sk_buff *buf = ieee80211_assoc_resp(ieee, dest);
-	
+
 	if (buf)
 		softmac_mgmt_xmit(buf, ieee);
 }
@@ -1098,7 +1098,7 @@ void ieee80211_resp_to_assoc_rq(struct ieee80211_device *ieee, u8* dest)
 void ieee80211_resp_to_auth(struct ieee80211_device *ieee, int s, u8* dest)
 {
 	struct sk_buff *buf = ieee80211_auth_resp(ieee, s, dest);
-	
+
 	if (buf)
 		softmac_mgmt_xmit(buf, ieee);
 }
@@ -1106,10 +1106,10 @@ void ieee80211_resp_to_auth(struct ieee80211_device *ieee, int s, u8* dest)
 
 void ieee80211_resp_to_probe(struct ieee80211_device *ieee, u8 *dest)
 {
-	
+
 
 	struct sk_buff *buf = ieee80211_probe_resp(ieee, dest);
-	if (buf) 
+	if (buf)
 		softmac_mgmt_xmit(buf, ieee);
 }
 
@@ -1118,7 +1118,7 @@ inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beaco
 {
 	struct sk_buff *skb;
 	//unsigned long flags;
-	
+
 	struct ieee80211_assoc_request_frame *hdr;
 	u8 *tag;//,*rsn_ie;
 	//short info_addr = 0;
@@ -1137,19 +1137,19 @@ inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beaco
 	unsigned int cxvernum_ie_len=0;
 	struct ieee80211_crypt_data* crypt;
 	int encrypt;
-	
+
 	unsigned int rate_len = ieee80211_MFIE_rate_len(ieee);
 	unsigned int wmm_info_len = beacon->qos_data.supported?9:0;
-#ifdef THOMAS_TURBO	
+#ifdef THOMAS_TURBO
 	unsigned int turbo_info_len = beacon->Turbo_Enable?9:0;
 #endif
 
-	int len = 0; 
-                             
+	int len = 0;
+
 	crypt = ieee->crypt[ieee->tx_keyidx];
 	encrypt = ieee->host_encrypt && crypt && crypt->ops && ((0 == strcmp(crypt->ops->name,"WEP") || wpa_ie_len));
 
-	//Include High Throuput capability && Realtek proprietary  
+	//Include High Throuput capability && Realtek proprietary
 	if(ieee->pHTInfo->bCurrentHTSupport&&ieee->pHTInfo->bEnableHT)
 	{
 		ht_cap_buf = (u8*)&(ieee->pHTInfo->SelfHTCap);
@@ -1160,34 +1160,34 @@ inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beaco
 			realtek_ie_buf = ieee->pHTInfo->szRT2RTAggBuffer;
 			realtek_ie_len = sizeof( ieee->pHTInfo->szRT2RTAggBuffer);
 			HTConstructRT2RTAggElement(ieee, realtek_ie_buf, &realtek_ie_len);
-       	 			
+
 		}
 	}
 	if(ieee->qos_support){
 		wmm_info_len = beacon->qos_data.supported?9:0;
 	}
-	
+
 
 	if(beacon->bCkipSupported)
 	{
 		ckip_ie_len = 30+2;
 	}
 	if(beacon->bCcxRmEnable)
-	{	
+	{
 		ccxrm_ie_len = 6+2;
 	}
 	if( beacon->BssCcxVerNumber >= 2 )
-	{	
+	{
 		cxvernum_ie_len = 5+2;
 	}
-#ifdef THOMAS_TURBO		
+#ifdef THOMAS_TURBO
 	len = sizeof(struct ieee80211_assoc_request_frame)+ 2
 		+ beacon->ssid_len//essid tagged val
 		+ rate_len//rates tagged val
 		+ wpa_ie_len
 		+ wmm_info_len
 		+ turbo_info_len
-                + ht_cap_len
+		+ ht_cap_len
 		+ realtek_ie_len
 		+ ckip_ie_len
 		+ ccxrm_ie_len
@@ -1199,25 +1199,25 @@ inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beaco
 		+ rate_len//rates tagged val
 		+ wpa_ie_len
 		+ wmm_info_len
-                + ht_cap_len
+		+ ht_cap_len
 		+ realtek_ie_len
 		+ ckip_ie_len
 		+ ccxrm_ie_len
 		+ cxvernum_ie_len
 		+ ieee->tx_headroom;
 #endif
-	
+
 	skb = dev_alloc_skb(len);
-	
-	if (!skb) 
+
+	if (!skb)
 		return NULL;
 
 	skb_reserve(skb, ieee->tx_headroom);
-	
+
 	hdr = (struct ieee80211_assoc_request_frame *)
 		skb_put(skb, sizeof(struct ieee80211_assoc_request_frame)+2);
-	
-	
+
+
 	hdr->header.frame_ctl = IEEE80211_STYPE_ASSOC_REQ;
 	hdr->header.duration_id= 37; //FIXME
 	memcpy(hdr->header.addr1, beacon->bssid, ETH_ALEN);
@@ -1225,9 +1225,9 @@ inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beaco
 	memcpy(hdr->header.addr3, beacon->bssid, ETH_ALEN);
 
 	memcpy(ieee->ap_mac_addr, beacon->bssid, ETH_ALEN);//for HW security, John
-	
+
 	hdr->capability = cpu_to_le16(WLAN_CAPABILITY_BSS);
-	if (beacon->capability & WLAN_CAPABILITY_PRIVACY ) 
+	if (beacon->capability & WLAN_CAPABILITY_PRIVACY )
 		hdr->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY);
 
 	if (beacon->capability & WLAN_CAPABILITY_SHORT_PREAMBLE)
@@ -1235,19 +1235,19 @@ inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beaco
 
 	if(ieee->short_slot)
 		hdr->capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT);
- 	if (wmm_info_len) //QOS
+	if (wmm_info_len) //QOS
 	hdr->capability |= cpu_to_le16(WLAN_CAPABILITY_QOS);
 
 	hdr->listen_interval = 0xa; //FIXME
-	
+
 	hdr->info_element[0].id = MFIE_TYPE_SSID;
 
 	hdr->info_element[0].len = beacon->ssid_len;
 	tag = skb_put(skb, beacon->ssid_len);
 	memcpy(tag, beacon->ssid, beacon->ssid_len);
-	
-	tag = skb_put(skb, rate_len); 
-	
+
+	tag = skb_put(skb, rate_len);
+
 	ieee80211_MFIE_Brate(ieee, &tag);
 	ieee80211_MFIE_Grate(ieee, &tag);
 	// For CCX 1 S13, CKIP. Added by Annie, 2006-08-14.
@@ -1261,7 +1261,7 @@ inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beaco
 		osCcxAironetIE.Octet = CcxAironetBuf;
 		osCcxAironetIE.Length = sizeof(CcxAironetBuf);
 		//
-		// Ref. CCX test plan v3.61, 3.2.3.1 step 13. 
+		// Ref. CCX test plan v3.61, 3.2.3.1 step 13.
 		// We want to make the device type as "4500-client". 060926, by CCW.
 		//
 		memcpy(osCcxAironetIE.Octet, AironetIeOui, sizeof(AironetIeOui));
@@ -1304,7 +1304,7 @@ inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beaco
 		memcpy(tag,osCcxVerNum.Octet,osCcxVerNum.Length);
 		tag += osCcxVerNum.Length;
 	}
-        //HT cap element
+	//HT cap element
 	if(ieee->pHTInfo->bCurrentHTSupport&&ieee->pHTInfo->bEnableHT){
 		if(ieee->pHTInfo->ePeerHTSpecVer != HT_SPEC_VER_EWC)
 		{
@@ -1314,11 +1314,11 @@ inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beaco
 			memcpy(tag, ht_cap_buf,ht_cap_len -2);
 			tag += ht_cap_len -2;
 		}
-	}	         
+	}
+
 
-	
 	//choose what wpa_supplicant gives to associate.
-	tag = skb_put(skb, wpa_ie_len);	
+	tag = skb_put(skb, wpa_ie_len);
 	if (wpa_ie_len){
 		memcpy(tag, ieee->wpa_ie, ieee->wpa_ie_len);
 	}
@@ -1329,9 +1329,9 @@ inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beaco
 	}
 #ifdef THOMAS_TURBO
 	tag = skb_put(skb,turbo_info_len);
-        if(turbo_info_len) {
-                ieee80211_TURBO_Info(ieee, &tag);
-        }
+	if(turbo_info_len) {
+		ieee80211_TURBO_Info(ieee, &tag);
+	}
 #endif
 
 	if(ieee->pHTInfo->bCurrentHTSupport&&ieee->pHTInfo->bEnableHT){
@@ -1352,18 +1352,18 @@ inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beaco
 		}
 	}
 //	printk("<=====%s(), %p, %p\n", __FUNCTION__, ieee->dev, ieee->dev->dev_addr);
-//	IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA, skb->data, skb->len);	
+//	IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA, skb->data, skb->len);
 	return skb;
 }
 
 void ieee80211_associate_abort(struct ieee80211_device *ieee)
 {
-	
+
 	unsigned long flags;
 	spin_lock_irqsave(&ieee->lock, flags);
-	
+
 	ieee->associate_seq++;
-	
+
 	/* don't scan, and avoid to have the RX path possibily
 	 * try again to associate. Even do not react to AUTH or
 	 * ASSOC response. Just wait for the retry wq to be scheduled.
@@ -1371,22 +1371,22 @@ void ieee80211_associate_abort(struct ieee80211_device *ieee)
 	 * with, so we retry or just get back to NO_LINK and scanning
 	 */
 	if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING){
-		IEEE80211_DEBUG_MGMT("Authentication failed\n"); 
+		IEEE80211_DEBUG_MGMT("Authentication failed\n");
 		ieee->softmac_stats.no_auth_rs++;
 	}else{
-		IEEE80211_DEBUG_MGMT("Association failed\n"); 
+		IEEE80211_DEBUG_MGMT("Association failed\n");
 		ieee->softmac_stats.no_ass_rs++;
 	}
-		
+
 	ieee->state = IEEE80211_ASSOCIATING_RETRY;
-		
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)	
+
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
 	queue_delayed_work(ieee->wq, &ieee->associate_retry_wq, \
-                           IEEE80211_SOFTMAC_ASSOC_RETRY_TIME);
+			   IEEE80211_SOFTMAC_ASSOC_RETRY_TIME);
 #else
 	schedule_task(&ieee->associate_retry_wq);
 #endif
-	
+
 	spin_unlock_irqrestore(&ieee->lock, flags);
 }
 
@@ -1400,15 +1400,15 @@ void ieee80211_associate_step1(struct ieee80211_device *ieee)
 {
 	struct ieee80211_network *beacon = &ieee->current_network;
 	struct sk_buff *skb;
-	
+
 	IEEE80211_DEBUG_MGMT("Stopping scan\n");
-	
+
 	ieee->softmac_stats.tx_auth_rq++;
 	skb=ieee80211_authentication_req(beacon, ieee, 0);
-	
-	if (!skb) 
+
+	if (!skb)
 		ieee80211_associate_abort(ieee);
-	else{ 
+	else{
 		ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATING ;
 		IEEE80211_DEBUG_MGMT("Sending authentication request\n");
 		//printk(KERN_WARNING "Sending authentication request\n");
@@ -1424,27 +1424,27 @@ void ieee80211_associate_step1(struct ieee80211_device *ieee)
 
 void ieee80211_auth_challenge(struct ieee80211_device *ieee, u8 *challenge, int chlen)
 {
-	u8 *c;	
+	u8 *c;
 	struct sk_buff *skb;
 	struct ieee80211_network *beacon = &ieee->current_network;
 //	int hlen = sizeof(struct ieee80211_authentication);
-	
+
 	ieee->associate_seq++;
 	ieee->softmac_stats.tx_auth_rq++;
-	
+
 	skb = ieee80211_authentication_req(beacon, ieee, chlen+2);
-	if (!skb) 
+	if (!skb)
 		ieee80211_associate_abort(ieee);
 	else{
 		c = skb_put(skb, chlen+2);
 		*(c++) = MFIE_TYPE_CHALLENGE;
 		*(c++) = chlen;
 		memcpy(c, challenge, chlen);
-		
+
 		IEEE80211_DEBUG_MGMT("Sending authentication challenge response\n");
-		
+
 		ieee80211_encrypt_fragment(ieee, skb, sizeof(struct ieee80211_hdr_3addr  ));
-			
+
 		softmac_mgmt_xmit(skb, ieee);
 		mod_timer(&ieee->associate_timer, jiffies + (HZ/2));
 #if 0
@@ -1452,7 +1452,7 @@ void ieee80211_auth_challenge(struct ieee80211_device *ieee, u8 *challenge, int
 		add_timer(&ieee->associate_timer);
 #endif
 		//dev_kfree_skb_any(skb);//edit by thomas
-	}	
+	}
 	kfree(challenge);
 }
 
@@ -1460,14 +1460,14 @@ void ieee80211_associate_step2(struct ieee80211_device *ieee)
 {
 	struct sk_buff* skb;
 	struct ieee80211_network *beacon = &ieee->current_network;
-	
+
 	del_timer_sync(&ieee->associate_timer);
-	
+
 	IEEE80211_DEBUG_MGMT("Sending association request\n");
-	
+
 	ieee->softmac_stats.tx_ass_rq++;
 	skb=ieee80211_association_req(beacon, ieee);
-	if (!skb) 
+	if (!skb)
 		ieee80211_associate_abort(ieee);
 	else{
 		softmac_mgmt_xmit(skb, ieee);
@@ -1477,20 +1477,20 @@ void ieee80211_associate_step2(struct ieee80211_device *ieee)
 		add_timer(&ieee->associate_timer);
 #endif
 		//dev_kfree_skb_any(skb);//edit by thomas
-	}	
+	}
 }
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
 void ieee80211_associate_complete_wq(struct work_struct *work)
 {
-        struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_complete_wq);
+	struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_complete_wq);
 #else
 void ieee80211_associate_complete_wq(struct ieee80211_device *ieee)
 {
 #endif
 	printk(KERN_INFO "Associated successfully\n");
-	if(ieee80211_is_54g(ieee->current_network) && 
+	if(ieee80211_is_54g(ieee->current_network) &&
 		(ieee->modulation & IEEE80211_OFDM_MODULATION)){
-		
+
 		ieee->rate = 108;
 		printk(KERN_INFO"Using G rates:%d\n", ieee->rate);
 	}else{
@@ -1513,19 +1513,19 @@ void ieee80211_associate_complete_wq(struct ieee80211_device *ieee)
 	if(ieee->LinkDetectInfo.NumRecvBcnInPeriod==0||ieee->LinkDetectInfo.NumRecvDataInPeriod==0 )
 	{
 		ieee->LinkDetectInfo.NumRecvBcnInPeriod = 1;
-		ieee->LinkDetectInfo.NumRecvDataInPeriod= 1;	
+		ieee->LinkDetectInfo.NumRecvDataInPeriod= 1;
 	}
 	ieee->link_change(ieee->dev);
 	if(ieee->is_silent_reset == 0){
 		printk("============>normal associate\n");
-	notify_wx_assoc_event(ieee); 
-	} 
+	notify_wx_assoc_event(ieee);
+	}
 	else if(ieee->is_silent_reset == 1)
 	{
 		printk("==================>silent reset associate\n");
 		ieee->is_silent_reset = 0;
 	}
-	
+
 	if (ieee->data_hard_resume)
 		ieee->data_hard_resume(ieee->dev);
 	netif_carrier_on(ieee->dev);
@@ -1534,14 +1534,14 @@ void ieee80211_associate_complete_wq(struct ieee80211_device *ieee)
 void ieee80211_associate_complete(struct ieee80211_device *ieee)
 {
 //	int i;
-//	struct net_device* dev = ieee->dev; 
+//	struct net_device* dev = ieee->dev;
 	del_timer_sync(&ieee->associate_timer);
 
 #if 0
 	for(i = 0; i < 6; i++) {
 	  ieee->seq_ctrl[i] = 0;
 	}
-#endif	
+#endif
 	ieee->state = IEEE80211_LINKED;
 #if 0
 	if (ieee->pHTInfo->bCurrentHTSupport)
@@ -1556,8 +1556,8 @@ void ieee80211_associate_complete(struct ieee80211_device *ieee)
 		HTSetConnectBwMode(ieee, HT_CHANNEL_WIDTH_20, HT_EXTCHNL_OFFSET_NO_EXT);
 	}
 #endif
-	//ieee->UpdateHalRATRTableHandler(dev, ieee->dot11HTOperationalRateSet); 
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)		
+	//ieee->UpdateHalRATRTableHandler(dev, ieee->dot11HTOperationalRateSet);
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
 	queue_work(ieee->wq, &ieee->associate_complete_wq);
 #else
 	schedule_task(&ieee->associate_complete_wq);
@@ -1567,25 +1567,25 @@ void ieee80211_associate_complete(struct ieee80211_device *ieee)
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
 void ieee80211_associate_procedure_wq(struct work_struct *work)
 {
-        struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_procedure_wq);
+	struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, associate_procedure_wq);
 #else
 void ieee80211_associate_procedure_wq(struct ieee80211_device *ieee)
 {
 #endif
 	ieee->sync_scan_hurryup = 1;
 	down(&ieee->wx_sem);
-	
+
 	if (ieee->data_hard_stop)
 		ieee->data_hard_stop(ieee->dev);
-	
+
 	ieee80211_stop_scan(ieee);
-	printk("===>%s(), chan:%d\n", __FUNCTION__, ieee->current_network.channel);	
+	printk("===>%s(), chan:%d\n", __FUNCTION__, ieee->current_network.channel);
 	//ieee->set_chan(ieee->dev, ieee->current_network.channel);
 	HTSetConnectBwMode(ieee, HT_CHANNEL_WIDTH_20, HT_EXTCHNL_OFFSET_NO_EXT);
-	
+
 	ieee->associate_seq = 1;
 	ieee80211_associate_step1(ieee);
-	
+
 	up(&ieee->wx_sem);
 }
 
@@ -1593,22 +1593,22 @@ inline void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee
 {
 	u8 tmp_ssid[IW_ESSID_MAX_SIZE+1];
 	int tmp_ssid_len = 0;
-	
+
 	short apset,ssidset,ssidbroad,apmatch,ssidmatch;
-	
-	/* we are interested in new new only if we are not associated 
+
+	/* we are interested in new new only if we are not associated
 	 * and we are not associating / authenticating
 	 */
 	if (ieee->state != IEEE80211_NOLINK)
-		return; 
+		return;
 
 	if ((ieee->iw_mode == IW_MODE_INFRA) && !(net->capability & WLAN_CAPABILITY_BSS))
 		return;
-	
+
 	if ((ieee->iw_mode == IW_MODE_ADHOC) && !(net->capability & WLAN_CAPABILITY_IBSS))
 		return;
 
-	
+
 	if (ieee->iw_mode == IW_MODE_INFRA || ieee->iw_mode == IW_MODE_ADHOC){
 		/* if the user specified the AP MAC, we need also the essid
 		 * This could be obtained by beacons or, if the network does not
@@ -1620,19 +1620,19 @@ inline void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee
 		apmatch = (memcmp(ieee->current_network.bssid, net->bssid, ETH_ALEN)==0);
 		ssidmatch = (ieee->current_network.ssid_len == net->ssid_len)&&\
 				(!strncmp(ieee->current_network.ssid, net->ssid, net->ssid_len));
-						
-			
+
+
 		if (	/* if the user set the AP check if match.
-		         * if the network does not broadcast essid we check the user supplyed ANY essid
+			 * if the network does not broadcast essid we check the user supplyed ANY essid
 			 * if the network does broadcast and the user does not set essid it is OK
 			 * if the network does broadcast and the user did set essid chech if essid match
 			 */
-			( apset && apmatch && 
-				((ssidset && ssidbroad && ssidmatch) || (ssidbroad && !ssidset) || (!ssidbroad && ssidset)) ) ||  
+			( apset && apmatch &&
+				((ssidset && ssidbroad && ssidmatch) || (ssidbroad && !ssidset) || (!ssidbroad && ssidset)) ) ||
 			/* if the ap is not set, check that the user set the bssid
 			 * and the network does bradcast and that those two bssid matches
-			 */ 
-			(!apset && ssidset && ssidbroad && ssidmatch) 
+			 */
+			(!apset && ssidset && ssidbroad && ssidmatch)
 			){
 				/* if the essid is hidden replace it with the
 				* essid provided by the user.
@@ -1642,7 +1642,7 @@ inline void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee
 					tmp_ssid_len = ieee->current_network.ssid_len;
 				}
 				memcpy(&ieee->current_network, net, sizeof(struct ieee80211_network));
-				
+
 				if (!ssidbroad){
 					strncpy(ieee->current_network.ssid, tmp_ssid, IW_ESSID_MAX_SIZE);
 					ieee->current_network.ssid_len = tmp_ssid_len;
@@ -1653,8 +1653,8 @@ inline void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee
 				HTResetIOTSetting(ieee->pHTInfo);
 				if (ieee->iw_mode == IW_MODE_INFRA){
 					/* Join the network for the first time */
-					ieee->AsocRetryCount = 0;	
-					//for HT by amy 080514 
+					ieee->AsocRetryCount = 0;
+					//for HT by amy 080514
 					if((ieee->current_network.qos_data.supported == 1) &&
 					  // (ieee->pHTInfo->bEnableHT && ieee->current_network.bssht.bdSupportHT))
 					   ieee->current_network.bssht.bdSupportHT)
@@ -1669,13 +1669,13 @@ inline void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee
 					}
 
 					ieee->state = IEEE80211_ASSOCIATING;
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)	
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
 					queue_work(ieee->wq, &ieee->associate_procedure_wq);
 #else
 					schedule_task(&ieee->associate_procedure_wq);
 #endif
 				}else{
-					if(ieee80211_is_54g(ieee->current_network) && 
+					if(ieee80211_is_54g(ieee->current_network) &&
 						(ieee->modulation & IEEE80211_OFDM_MODULATION)){
 						ieee->rate = 108;
 						ieee->SetWirelessMode(ieee->dev, IEEE_G);
@@ -1689,7 +1689,7 @@ inline void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee
 					//HTSetConnectBwMode(ieee, HT_CHANNEL_WIDTH_20, HT_EXTCHNL_OFFSET_NO_EXT);
 					ieee->state = IEEE80211_LINKED;
 				}
-			
+
 		}
 	}
 
@@ -1701,22 +1701,22 @@ void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee)
 	struct ieee80211_network *target;
 
 	spin_lock_irqsave(&ieee->lock, flags);
-			
+
 	list_for_each_entry(target, &ieee->network_list, list) {
-		
+
 		/* if the state become different that NOLINK means
 		 * we had found what we are searching for
 		 */
 
-		if (ieee->state != IEEE80211_NOLINK) 
+		if (ieee->state != IEEE80211_NOLINK)
 			break;
-	
+
 		if (ieee->scan_age == 0 || time_after(target->last_scanned + ieee->scan_age, jiffies))
 		ieee80211_softmac_new_net(ieee, target);
 	}
-	
+
 	spin_unlock_irqrestore(&ieee->lock, flags);
-	
+
 }
 
 
@@ -1724,7 +1724,7 @@ static inline u16 auth_parse(struct sk_buff *skb, u8** challenge, int *chlen)
 {
 	struct ieee80211_authentication *a;
 	u8 *t;
-	if (skb->len <  (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){ 
+	if (skb->len <  (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){
 		IEEE80211_DEBUG_MGMT("invalid len in auth resp: %d\n",skb->len);
 		return 0xcafe;
 	}
@@ -1732,34 +1732,34 @@ static inline u16 auth_parse(struct sk_buff *skb, u8** challenge, int *chlen)
 	a = (struct ieee80211_authentication*) skb->data;
 	if(skb->len > (sizeof(struct ieee80211_authentication) +3)){
 		t = skb->data + sizeof(struct ieee80211_authentication);
-		
+
 		if(*(t++) == MFIE_TYPE_CHALLENGE){
 			*chlen = *(t++);
 			*challenge = (u8*)kmalloc(*chlen, GFP_ATOMIC);
 			memcpy(*challenge, t, *chlen);
 		}
 	}
-	
+
 	return cpu_to_le16(a->status);
-	
+
 }
 
 
 int auth_rq_parse(struct sk_buff *skb,u8* dest)
 {
 	struct ieee80211_authentication *a;
-	
-	if (skb->len <  (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){ 
-		IEEE80211_DEBUG_MGMT("invalid len in auth request: %d\n",skb->len);	
+
+	if (skb->len <  (sizeof(struct ieee80211_authentication)-sizeof(struct ieee80211_info_element))){
+		IEEE80211_DEBUG_MGMT("invalid len in auth request: %d\n",skb->len);
 		return -1;
 	}
 	a = (struct ieee80211_authentication*) skb->data;
-	
+
 	memcpy(dest,a->header.addr2, ETH_ALEN);
-	
-	if (le16_to_cpu(a->algorithm) != WLAN_AUTH_OPEN) 
+
+	if (le16_to_cpu(a->algorithm) != WLAN_AUTH_OPEN)
 		return  WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG;
-	
+
 	return WLAN_STATUS_SUCCESS;
 }
 
@@ -1769,21 +1769,21 @@ static short probe_rq_parse(struct ieee80211_device *ieee, struct sk_buff *skb,
 	u8 *skbend;
 	u8 *ssid=NULL;
 	u8 ssidlen = 0;
-	
+
 	struct ieee80211_hdr_3addr   *header =
 		(struct ieee80211_hdr_3addr   *) skb->data;
-	
-	if (skb->len < sizeof (struct ieee80211_hdr_3addr  )) 
+
+	if (skb->len < sizeof (struct ieee80211_hdr_3addr  ))
 		return -1; /* corrupted */
-	
+
 	memcpy(src,header->addr2, ETH_ALEN);
-	
+
 	skbend = (u8*)skb->data + skb->len;
-	
+
 	tag = skb->data + sizeof (struct ieee80211_hdr_3addr  );
-	
+
 	while (tag+1 < skbend){
-		if (*tag == 0){ 
+		if (*tag == 0){
 			ssid = tag+2;
 			ssidlen = *(tag+1);
 			break;
@@ -1792,30 +1792,30 @@ static short probe_rq_parse(struct ieee80211_device *ieee, struct sk_buff *skb,
 		tag = tag + *(tag); /* point to the last data byte of the tag */
 		tag++; /* point to the next tag */
 	}
-	
+
 	//IEEE80211DMESG("Card MAC address is "MACSTR, MAC2STR(src));
 	if (ssidlen == 0) return 1;
-	
+
 	if (!ssid) return 1; /* ssid not found in tagged param */
 	return (!strncmp(ssid, ieee->current_network.ssid, ssidlen));
-		
+
 }
 
 int assoc_rq_parse(struct sk_buff *skb,u8* dest)
 {
 	struct ieee80211_assoc_request_frame *a;
-	
-	if (skb->len < (sizeof(struct ieee80211_assoc_request_frame) - 
-		sizeof(struct ieee80211_info_element))) { 
-		
+
+	if (skb->len < (sizeof(struct ieee80211_assoc_request_frame) -
+		sizeof(struct ieee80211_info_element))) {
+
 		IEEE80211_DEBUG_MGMT("invalid len in auth request:%d \n", skb->len);
 		return -1;
 	}
-	
+
 	a = (struct ieee80211_assoc_request_frame*) skb->data;
-		
+
 	memcpy(dest,a->header.addr2,ETH_ALEN);
-	
+
 	return 0;
 }
 
@@ -1824,21 +1824,21 @@ static inline u16 assoc_parse(struct ieee80211_device *ieee, struct sk_buff *skb
 	struct ieee80211_assoc_response_frame *response_head;
 	u16 status_code;
 
-	if (skb->len <  sizeof(struct ieee80211_assoc_response_frame)){ 
+	if (skb->len <  sizeof(struct ieee80211_assoc_response_frame)){
 		IEEE80211_DEBUG_MGMT("invalid len in auth resp: %d\n", skb->len);
 		return 0xcafe;
 	}
-	
+
 	response_head = (struct ieee80211_assoc_response_frame*) skb->data;
 	*aid = le16_to_cpu(response_head->aid) & 0x3fff;
 
 	status_code = le16_to_cpu(response_head->status);
 	if((status_code==WLAN_STATUS_ASSOC_DENIED_RATES || \
 	   status_code==WLAN_STATUS_CAPS_UNSUPPORTED)&&
-	   ((ieee->mode == IEEE_G) && 
+	   ((ieee->mode == IEEE_G) &&
 	    (ieee->current_network.mode == IEEE_N_24G) &&
-            (ieee->AsocRetryCount++ < (RT_ASOC_RETRY_LIMIT-1)))) {
-                 ieee->pHTInfo->IOTAction |= HT_IOT_ACT_PURE_N_MODE;
+	    (ieee->AsocRetryCount++ < (RT_ASOC_RETRY_LIMIT-1)))) {
+		 ieee->pHTInfo->IOTAction |= HT_IOT_ACT_PURE_N_MODE;
 	}else {
 		 ieee->AsocRetryCount = 0;
 	}
@@ -1850,7 +1850,7 @@ static inline void
 ieee80211_rx_probe_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
 {
 	u8 dest[ETH_ALEN];
-	
+
 	//IEEE80211DMESG("Rx probe");
 	ieee->softmac_stats.rx_probe_rq++;
 	//DMESG("Dest is "MACSTR, MAC2STR(dest));
@@ -1868,26 +1868,26 @@ ieee80211_rx_auth_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
 	int status;
 	//IEEE80211DMESG("Rx probe");
 	ieee->softmac_stats.rx_auth_rq++;
-	
+
 	if ((status = auth_rq_parse(skb, dest))!= -1){
 		ieee80211_resp_to_auth(ieee, status, dest);
 	}
 	//DMESG("Dest is "MACSTR, MAC2STR(dest));
-	
+
 }
 
 static inline void
 ieee80211_rx_assoc_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
 {
-	
+
 	u8 dest[ETH_ALEN];
 	//unsigned long flags;
-	
+
 	ieee->softmac_stats.rx_ass_rq++;
 	if (assoc_rq_parse(skb,dest) != -1){
 		ieee80211_resp_to_assoc_rq(ieee, dest);
 	}
-	
+
 	printk(KERN_INFO"New client associated: "MAC_FMT"\n", MAC_ARG(dest));
 	//FIXME
 	#if 0
@@ -1901,23 +1901,23 @@ ieee80211_rx_assoc_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
 
 void ieee80211_sta_ps_send_null_frame(struct ieee80211_device *ieee, short pwr)
 {
-	
+
 	struct sk_buff *buf = ieee80211_null_func(ieee, pwr);
-	
+
 	if (buf)
 		softmac_ps_mgmt_xmit(buf, ieee);
 
-} 
+}
 
 
 short ieee80211_sta_ps_sleep(struct ieee80211_device *ieee, u32 *time_h, u32 *time_l)
-{	
+{
 	int timeout = ieee->ps_timeout;
 	u8 dtim;
 	/*if(ieee->ps == IEEE80211_PS_DISABLED ||
-		ieee->iw_mode != IW_MODE_INFRA || 
+		ieee->iw_mode != IW_MODE_INFRA ||
 		ieee->state != IEEE80211_LINKED)
-		
+
 		return 0;
 	*/
 	dtim = ieee->current_network.dtim_data;
@@ -1927,35 +1927,35 @@ short ieee80211_sta_ps_sleep(struct ieee80211_device *ieee, u32 *time_h, u32 *ti
 	timeout = ieee->current_network.beacon_interval; //should we use ps_timeout value or beacon_interval
 	//printk("VALID\n");
 	ieee->current_network.dtim_data = IEEE80211_DTIM_INVALID;
-		
+
 	if(dtim & ((IEEE80211_DTIM_UCAST | IEEE80211_DTIM_MBCAST)& ieee->ps))
 		return 2;
-	
+
 	if(!time_after(jiffies, ieee->dev->trans_start + MSECS(timeout)))
 		return 0;
-	
+
 	if(!time_after(jiffies, ieee->last_rx_ps_time + MSECS(timeout)))
 		return 0;
-	
+
 	if((ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE ) &&
 		(ieee->mgmt_queue_tail != ieee->mgmt_queue_head))
 		return 0;
-	
+
 	if(time_l){
-		*time_l = ieee->current_network.last_dtim_sta_time[0] 
-			+ (ieee->current_network.beacon_interval 
+		*time_l = ieee->current_network.last_dtim_sta_time[0]
+			+ (ieee->current_network.beacon_interval
 			* ieee->current_network.dtim_period) * 1000;
 	}
-	
+
 	if(time_h){
 		*time_h = ieee->current_network.last_dtim_sta_time[1];
 		if(time_l && *time_l < ieee->current_network.last_dtim_sta_time[0])
 			*time_h += 1;
 	}
-	
+
 	return 1;
-	
-	
+
+
 }
 
 inline void ieee80211_sta_ps(struct ieee80211_device *ieee)
@@ -1963,66 +1963,66 @@ inline void ieee80211_sta_ps(struct ieee80211_device *ieee)
 
 	u32 th,tl;
 	short sleep;
-	
+
 	unsigned long flags,flags2;
-	
+
 	spin_lock_irqsave(&ieee->lock, flags);
-	
+
 	if((ieee->ps == IEEE80211_PS_DISABLED ||
-		ieee->iw_mode != IW_MODE_INFRA || 
+		ieee->iw_mode != IW_MODE_INFRA ||
 		ieee->state != IEEE80211_LINKED)){
-		
+
 	//	#warning CHECK_LOCK_HERE
 		spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
-		
-		ieee80211_sta_wakeup(ieee, 1);	
-		
+
+		ieee80211_sta_wakeup(ieee, 1);
+
 		spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
 	}
-	
+
 	sleep = ieee80211_sta_ps_sleep(ieee,&th, &tl);
 	/* 2 wake, 1 sleep, 0 do nothing */
 	if(sleep == 0)
 		goto out;
-	
+
 	if(sleep == 1){
-	
+
 		if(ieee->sta_sleep == 1)
 			ieee->enter_sleep_state(ieee->dev,th,tl);
-		
+
 		else if(ieee->sta_sleep == 0){
 		//	printk("send null 1\n");
 			spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
-			
+
 			if(ieee->ps_is_queue_empty(ieee->dev)){
-				
-			
+
+
 				ieee->sta_sleep = 2;
-				
+
 				ieee->ps_request_tx_ack(ieee->dev);
-				
+
 				ieee80211_sta_ps_send_null_frame(ieee,1);
-				
+
 				ieee->ps_th = th;
 				ieee->ps_tl = tl;
-			}		
+			}
 			spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
-			
+
 		}
-		
-		
+
+
 	}else if(sleep == 2){
 //#warning CHECK_LOCK_HERE
 		spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
-			
+
 		ieee80211_sta_wakeup(ieee,1);
-		
+
 		spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2);
 	}
 
-out:	
+out:
 	spin_unlock_irqrestore(&ieee->lock, flags);
-	
+
 }
 
 void ieee80211_sta_wakeup(struct ieee80211_device *ieee, short nl)
@@ -2034,14 +2034,14 @@ void ieee80211_sta_wakeup(struct ieee80211_device *ieee, short nl)
 			ieee80211_sta_ps_send_null_frame(ieee, 0);
 		}
 		return;
-		
+
 	}
-	
-	if(ieee->sta_sleep == 1) 
+
+	if(ieee->sta_sleep == 1)
 		ieee->sta_wake_up(ieee->dev);
-		
+
 	ieee->sta_sleep = 0;
-	
+
 	if(nl){
 		ieee->ps_request_tx_ack(ieee->dev);
 		ieee80211_sta_ps_send_null_frame(ieee, 0);
@@ -2051,9 +2051,9 @@ void ieee80211_sta_wakeup(struct ieee80211_device *ieee, short nl)
 void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success)
 {
 	unsigned long flags,flags2;
-	
+
 	spin_lock_irqsave(&ieee->lock, flags);
-	
+
 	if(ieee->sta_sleep == 2){
 		/* Null frame with PS bit set */
 		if(success){
@@ -2066,7 +2066,7 @@ void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success)
 	}
 	/* 21112005 - tx again null without PS bit if lost */
 	else {
-	
+
 		if((ieee->sta_sleep == 0) && !success){
 			spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2);
 			ieee80211_sta_ps_send_null_frame(ieee, 0);
@@ -2088,7 +2088,7 @@ void ieee80211_process_action(struct ieee80211_device* ieee, struct sk_buff* skb
 	}
 	tmp = *act;
 	act ++;
-	switch (tmp) 
+	switch (tmp)
 	{
 		case ACT_CAT_BA:
 			if (*act == ACT_ADDBAREQ)
@@ -2104,7 +2104,7 @@ void ieee80211_process_action(struct ieee80211_device* ieee, struct sk_buff* skb
 			break;
 	}
 	return;
-	
+
 }
 inline int
 ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
@@ -2119,33 +2119,33 @@ ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
 	struct ieee80211_assoc_response_frame *assoc_resp;
 //	struct ieee80211_info_element *info_element;
 	bool bSupportNmode = true, bHalfSupportNmode = false; //default support N mode, disable halfNmode
-	
+
 	if(!ieee->proto_started)
 		return 0;
-	
+
 	if(ieee->sta_sleep || (ieee->ps != IEEE80211_PS_DISABLED &&
-		ieee->iw_mode == IW_MODE_INFRA && 
+		ieee->iw_mode == IW_MODE_INFRA &&
 		ieee->state == IEEE80211_LINKED))
-	
+
 		tasklet_schedule(&ieee->ps_task);
-				
+
 	if(WLAN_FC_GET_STYPE(header->frame_ctl) != IEEE80211_STYPE_PROBE_RESP &&
 		WLAN_FC_GET_STYPE(header->frame_ctl) != IEEE80211_STYPE_BEACON)
 		ieee->last_rx_ps_time = jiffies;
-		
+
 	switch (WLAN_FC_GET_STYPE(header->frame_ctl)) {
-	
+
 		case IEEE80211_STYPE_ASSOC_RESP:
 		case IEEE80211_STYPE_REASSOC_RESP:
-		
+
 			IEEE80211_DEBUG_MGMT("received [RE]ASSOCIATION RESPONSE (%d)\n",
 					WLAN_FC_GET_STYPE(header->frame_ctl));
 			if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
-				ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATED && 
+				ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATED &&
 				ieee->iw_mode == IW_MODE_INFRA){
-				struct ieee80211_network network_resp;	
+				struct ieee80211_network network_resp;
 				struct ieee80211_network *network = &network_resp;
-				
+
 				if (0 == (errcode=assoc_parse(ieee,skb, &aid))){
 					ieee->state=IEEE80211_LINKED;
 					ieee->assoc_id = aid;
@@ -2179,35 +2179,35 @@ ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
 						"Association response status code 0x%x\n",
 						errcode);
 					if(ieee->AsocRetryCount < RT_ASOC_RETRY_LIMIT) {
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)					
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
 						queue_work(ieee->wq, &ieee->associate_procedure_wq);
 #else
 						schedule_task(&ieee->associate_procedure_wq);
 #endif
 					} else {
-						ieee80211_associate_abort(ieee); 
+						ieee80211_associate_abort(ieee);
 					}
 				}
 			}
 			break;
-		
+
 		case IEEE80211_STYPE_ASSOC_REQ:
 		case IEEE80211_STYPE_REASSOC_REQ:
-		
+
 			if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
 				ieee->iw_mode == IW_MODE_MASTER)
-					
+
 				ieee80211_rx_assoc_rq(ieee, skb);
 			break;
-			
+
 		case IEEE80211_STYPE_AUTH:
-		
+
 			if (ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE){
-				if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING && 
+				if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING &&
 				ieee->iw_mode == IW_MODE_INFRA){
-			
+
 						IEEE80211_DEBUG_MGMT("Received authentication response");
-						
+
 						if (0 == (errcode=auth_parse(skb, &challenge, &chlen))){
 							if(ieee->open_wep || !challenge){
 								ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATED;
@@ -2218,7 +2218,7 @@ ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
 									{
 												// WEP or TKIP encryption
 										if(IsHTHalfNmodeAPs(ieee))
-										{	
+										{
 											bSupportNmode = true;
 											bHalfSupportNmode = true;
 										}
@@ -2229,7 +2229,7 @@ ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
 										}
 									printk("==========>to link with AP using SEC(%d, %d)", bSupportNmode, bHalfSupportNmode);
 									}
-								}								
+								}
 								/* Dummy wirless mode setting to avoid encryption issue */
 								if(bSupportNmode) {
 									//N mode setting
@@ -2248,7 +2248,7 @@ ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
 								}
 								else
 									ieee->bHalfWirelessN24GMode = false;
-								
+
 								ieee80211_associate_step2(ieee);
 							}else{
 								ieee80211_auth_challenge(ieee, challenge, chlen);
@@ -2258,39 +2258,39 @@ ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
 							IEEE80211_DEBUG_MGMT("Authentication respose status code 0x%x",errcode);
 							ieee80211_associate_abort(ieee);
 						}
-						
+
 					}else if (ieee->iw_mode == IW_MODE_MASTER){
 						ieee80211_rx_auth_rq(ieee, skb);
 					}
 				}
 			break;
-				
+
 		case IEEE80211_STYPE_PROBE_REQ:
 
-			if ((ieee->softmac_features & IEEE_SOFTMAC_PROBERS) && 
-				((ieee->iw_mode == IW_MODE_ADHOC || 
+			if ((ieee->softmac_features & IEEE_SOFTMAC_PROBERS) &&
+				((ieee->iw_mode == IW_MODE_ADHOC ||
 				ieee->iw_mode == IW_MODE_MASTER) &&
 				ieee->state == IEEE80211_LINKED)){
 				ieee80211_rx_probe_rq(ieee, skb);
 			}
 			break;
-			
+
 		case IEEE80211_STYPE_DISASSOC:
 		case IEEE80211_STYPE_DEAUTH:
-			/* FIXME for now repeat all the association procedure 
+			/* FIXME for now repeat all the association procedure
 			* both for disassociation and deauthentication
 			*/
 			if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
-				ieee->state == IEEE80211_LINKED && 
+				ieee->state == IEEE80211_LINKED &&
 				ieee->iw_mode == IW_MODE_INFRA){
-				
+
 				ieee->state = IEEE80211_ASSOCIATING;
 				ieee->softmac_stats.reassoc++;
-				
+
 				notify_wx_assoc_event(ieee);
 				//HTSetConnectBwMode(ieee, HT_CHANNEL_WIDTH_20, HT_EXTCHNL_OFFSET_NO_EXT);
-				RemovePeerTS(ieee, header->addr2); 	
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)					
+				RemovePeerTS(ieee, header->addr2);
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
 				queue_work(ieee->wq, &ieee->associate_procedure_wq);
 #else
 				schedule_task(&ieee->associate_procedure_wq);
@@ -2300,11 +2300,11 @@ ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
 		case IEEE80211_STYPE_MANAGE_ACT:
 			ieee80211_process_action(ieee,skb);
 			break;
-		default: 
+		default:
 			return -1;
 			break;
 	}
-	
+
 	//dev_kfree_skb_any(skb);
 	return 0;
 }
@@ -2320,13 +2320,13 @@ ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb,
  * This might be useful if each fragment need it's own
  * descriptor, thus just keep a total free memory > than
  * the max fragmentation treshold is not enought.. If the
- * ieee802.11 stack passed a TXB struct then you needed  
- * to keep N free descriptors where 
+ * ieee802.11 stack passed a TXB struct then you needed
+ * to keep N free descriptors where
  * N = MAX_PACKET_SIZE / MIN_FRAG_TRESHOLD
  * In this way you need just one and the 802.11 stack
- * will take care of buffering fragments and pass them to 
+ * will take care of buffering fragments and pass them to
  * to the driver later, when it wakes the queue.
- */ 
+ */
 void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *ieee)
 {
 
@@ -2358,7 +2358,7 @@ void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *
 		(!ieee->check_nic_enough_desc(ieee->dev,queue_index))||\
 		     (ieee->queue_stop)) {
 			/* insert the skb packet to the wait queue */
-			/* as for the completion function, it does not need 
+			/* as for the completion function, it does not need
 			 * to check it any more.
 			 * */
 			//printk("error:no descriptor left at queue_index %d\n", queue_index);
@@ -2374,9 +2374,9 @@ void ieee80211_softmac_xmit(struct ieee80211_txb *txb, struct ieee80211_device *
 					ieee->dev,ieee->rate);
 			//ieee->stats.tx_packets++;
 			//ieee->stats.tx_bytes += txb->fragments[i]->len;
-			//ieee->dev->trans_start = jiffies; 
+			//ieee->dev->trans_start = jiffies;
 		}
-	}	
+	}
 #endif
 	ieee80211_txb_free(txb);
 
@@ -2390,13 +2390,13 @@ void ieee80211_resume_tx(struct ieee80211_device *ieee)
 {
 	int i;
 	for(i = ieee->tx_pending.frag; i < ieee->tx_pending.txb->nr_frags; i++) {
-		
+
 		if (ieee->queue_stop){
 			ieee->tx_pending.frag = i;
 			return;
 		}else{
-		
-			ieee->softmac_data_hard_start_xmit( 
+
+			ieee->softmac_data_hard_start_xmit(
 				ieee->tx_pending.txb->fragments[i],
 				ieee->dev,ieee->rate);
 				//(i+1)<ieee->tx_pending.txb->nr_frags);
@@ -2404,8 +2404,8 @@ void ieee80211_resume_tx(struct ieee80211_device *ieee)
 			ieee->dev->trans_start = jiffies;
 		}
 	}
-	
-	
+
+
 	ieee80211_txb_free(ieee->tx_pending.txb);
 	ieee->tx_pending.txb = NULL;
 }
@@ -2414,7 +2414,7 @@ void ieee80211_resume_tx(struct ieee80211_device *ieee)
 void ieee80211_reset_queue(struct ieee80211_device *ieee)
 {
 	unsigned long flags;
-	
+
 	spin_lock_irqsave(&ieee->lock,flags);
 	init_mgmt_queue(ieee);
 	if (ieee->tx_pending.txb){
@@ -2432,17 +2432,17 @@ void ieee80211_wake_queue(struct ieee80211_device *ieee)
 	unsigned long flags;
 	struct sk_buff *skb;
 	struct ieee80211_hdr_3addr  *header;
-	
+
 	spin_lock_irqsave(&ieee->lock,flags);
 	if (! ieee->queue_stop) goto exit;
-	
+
 	ieee->queue_stop = 0;
-	
+
 	if(ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE){
 		while (!ieee->queue_stop && (skb = dequeue_mgmt(ieee))){
-			
+
 			header = (struct ieee80211_hdr_3addr  *) skb->data;
-			
+
 			header->seq_ctl = cpu_to_le16(ieee->seq_ctrl[0] << 4);
 
 			if (ieee->seq_ctrl[0] == 0xFFF)
@@ -2456,12 +2456,12 @@ void ieee80211_wake_queue(struct ieee80211_device *ieee)
 	}
 	if (!ieee->queue_stop && ieee->tx_pending.txb)
 		ieee80211_resume_tx(ieee);
-	
+
 	if (!ieee->queue_stop && netif_queue_stopped(ieee->dev)){
 		ieee->softmac_stats.swtxawake++;
 		netif_wake_queue(ieee->dev);
 	}
-	
+
 exit :
 	spin_unlock_irqrestore(&ieee->lock,flags);
 }
@@ -2478,17 +2478,17 @@ void ieee80211_stop_queue(struct ieee80211_device *ieee)
 	}
 	ieee->queue_stop = 1;
 	//spin_unlock_irqrestore(&ieee->lock,flags);
-	
+
 }
 
 
 inline void ieee80211_randomize_cell(struct ieee80211_device *ieee)
 {
-	
+
 	get_random_bytes(ieee->current_network.bssid, ETH_ALEN);
-	
+
 	/* an IBSS cell address must have the two less significant
-	 * bits of the first byte = 2 
+	 * bits of the first byte = 2
 	 */
 	ieee->current_network.bssid[0] &= ~0x01;
 	ieee->current_network.bssid[0] |= 0x02;
@@ -2498,36 +2498,36 @@ inline void ieee80211_randomize_cell(struct ieee80211_device *ieee)
 void ieee80211_start_master_bss(struct ieee80211_device *ieee)
 {
 	ieee->assoc_id = 1;
-	
+
 	if (ieee->current_network.ssid_len == 0){
-		strncpy(ieee->current_network.ssid, 
+		strncpy(ieee->current_network.ssid,
 			IEEE80211_DEFAULT_TX_ESSID,
 			IW_ESSID_MAX_SIZE);
-			
+
 		ieee->current_network.ssid_len = strlen(IEEE80211_DEFAULT_TX_ESSID);
 		ieee->ssid_set = 1;
 	}
-	
+
 	memcpy(ieee->current_network.bssid, ieee->dev->dev_addr, ETH_ALEN);
-	 
+
 	ieee->set_chan(ieee->dev, ieee->current_network.channel);
 	ieee->state = IEEE80211_LINKED;
 	ieee->link_change(ieee->dev);
 	notify_wx_assoc_event(ieee);
-	
+
 	if (ieee->data_hard_resume)
 		ieee->data_hard_resume(ieee->dev);
-	
+
 	netif_carrier_on(ieee->dev);
 }
 
 void ieee80211_start_monitor_mode(struct ieee80211_device *ieee)
 {
 	if(ieee->raw_tx){
-		
+
 		if (ieee->data_hard_resume)
 			ieee->data_hard_resume(ieee->dev);
-	
+
 		netif_carrier_on(ieee->dev);
 	}
 }
@@ -2535,8 +2535,8 @@ void ieee80211_start_monitor_mode(struct ieee80211_device *ieee)
 void ieee80211_start_ibss_wq(struct work_struct *work)
 {
 
-        struct delayed_work *dwork = container_of(work, struct delayed_work, work);
-        struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, start_ibss_wq);
+	struct delayed_work *dwork = container_of(work, struct delayed_work, work);
+	struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, start_ibss_wq);
 #else
 void ieee80211_start_ibss_wq(struct ieee80211_device *ieee)
 {
@@ -2545,7 +2545,7 @@ void ieee80211_start_ibss_wq(struct ieee80211_device *ieee)
 	 * on the other hand this will block further iwconfig SET
 	 * operations because of the wx_sem hold.
 	 * Anyway some most set operations set a flag to speed-up
-	 * (abort) this wq (when syncro scanning) before sleeping 
+	 * (abort) this wq (when syncro scanning) before sleeping
 	 * on the semaphore
 	 */
 	if(!ieee->proto_started){
@@ -2553,22 +2553,22 @@ void ieee80211_start_ibss_wq(struct ieee80211_device *ieee)
 		return;
 	}
 	down(&ieee->wx_sem);
-	
+
 	if (ieee->current_network.ssid_len == 0){
 		strcpy(ieee->current_network.ssid,IEEE80211_DEFAULT_TX_ESSID);
 		ieee->current_network.ssid_len = strlen(IEEE80211_DEFAULT_TX_ESSID);
 		ieee->ssid_set = 1;
-	} 
-	
+	}
+
 	/* check if we have this cell in our network list */
 	ieee80211_softmac_check_all_nets(ieee);
-	
+
 
 #ifdef ENABLE_DOT11D //if creating an ad-hoc, set its channel to 10 temporarily--this is the requirement for ASUS, not 11D, so disable 11d.
 //	if((IS_DOT11D_ENABLE(ieee)) && (ieee->state == IEEE80211_NOLINK))
 	if (ieee->state == IEEE80211_NOLINK)
 		ieee->current_network.channel = 6;
-#endif		
+#endif
 	/* if not then the state is not linked. Maybe the user swithced to
 	 * ad-hoc mode just after being in monitor mode, or just after
 	 * being very few time in managed mode (so the card have had no
@@ -2588,25 +2588,25 @@ void ieee80211_start_ibss_wq(struct ieee80211_device *ieee)
 
 	/* the network definitively is not here.. create a new cell */
 	if (ieee->state == IEEE80211_NOLINK){
-		printk("creating new IBSS cell\n"); 
+		printk("creating new IBSS cell\n");
 		if(!ieee->wap_set)
 			ieee80211_randomize_cell(ieee);
-		
+
 		if(ieee->modulation & IEEE80211_CCK_MODULATION){
-		
+
 			ieee->current_network.rates_len = 4;
-			
+
 			ieee->current_network.rates[0] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_1MB;
 			ieee->current_network.rates[1] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_2MB;
 			ieee->current_network.rates[2] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_5MB;
 			ieee->current_network.rates[3] = IEEE80211_BASIC_RATE_MASK | IEEE80211_CCK_RATE_11MB;
-				
+
 		}else
 			ieee->current_network.rates_len = 0;
-		
+
 		if(ieee->modulation & IEEE80211_OFDM_MODULATION){
 			ieee->current_network.rates_ex_len = 8;
-			
+
 			ieee->current_network.rates_ex[0] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_6MB;
 			ieee->current_network.rates_ex[1] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_9MB;
 			ieee->current_network.rates_ex[2] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_12MB;
@@ -2615,7 +2615,7 @@ void ieee80211_start_ibss_wq(struct ieee80211_device *ieee)
 			ieee->current_network.rates_ex[5] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_36MB;
 			ieee->current_network.rates_ex[6] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_48MB;
 			ieee->current_network.rates_ex[7] = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_54MB;
-			
+
 			ieee->rate = 108;
 		}else{
 			ieee->current_network.rates_ex_len = 0;
@@ -2624,33 +2624,33 @@ void ieee80211_start_ibss_wq(struct ieee80211_device *ieee)
 
 		// By default, WMM function will be disabled in IBSS mode
 		ieee->current_network.QoS_Enable = 0;
-		ieee->SetWirelessMode(ieee->dev, IEEE_G);	
+		ieee->SetWirelessMode(ieee->dev, IEEE_G);
 		ieee->current_network.atim_window = 0;
 		ieee->current_network.capability = WLAN_CAPABILITY_IBSS;
 		if(ieee->short_slot)
 			ieee->current_network.capability |= WLAN_CAPABILITY_SHORT_SLOT;
-				 
+
 	}
-	
+
 	ieee->state = IEEE80211_LINKED;
-		
+
 	ieee->set_chan(ieee->dev, ieee->current_network.channel);
 	ieee->link_change(ieee->dev);
-	
+
 	notify_wx_assoc_event(ieee);
-	
+
 	ieee80211_start_send_beacons(ieee);
-	
+
 	if (ieee->data_hard_resume)
 		ieee->data_hard_resume(ieee->dev);
 	netif_carrier_on(ieee->dev);
-	
+
 	up(&ieee->wx_sem);
 }
 
 inline void ieee80211_start_ibss(struct ieee80211_device *ieee)
 {
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)	
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
 	queue_delayed_work(ieee->wq, &ieee->start_ibss_wq, 150);
 #else
 	schedule_task(&ieee->start_ibss_wq);
@@ -2673,14 +2673,14 @@ void ieee80211_start_bss(struct ieee80211_device *ieee)
 			return;
 		}
 	}
-#endif	
+#endif
 	/* check if we have already found the net we
 	 * are interested in (if any).
 	 * if not (we are disassociated and we are not
 	 * in associating / authenticating phase) start the background scanning.
 	 */
 	ieee80211_softmac_check_all_nets(ieee);
-	
+
 	/* ensure no-one start an associating process (thus setting
 	 * the ieee->state to ieee80211_ASSOCIATING) while we
 	 * have just cheked it and we are going to enable scan.
@@ -2689,7 +2689,7 @@ void ieee80211_start_bss(struct ieee80211_device *ieee)
 	 * the rx path), so we cannot be in the middle of such function
 	 */
 	spin_lock_irqsave(&ieee->lock, flags);
-	
+
 	if (ieee->state == IEEE80211_NOLINK){
 		ieee->actscanning = true;
 		ieee80211_start_scan(ieee);
@@ -2701,11 +2701,11 @@ void ieee80211_start_bss(struct ieee80211_device *ieee)
 void ieee80211_disassociate(struct ieee80211_device *ieee)
 {
 
-	
+
 	netif_carrier_off(ieee->dev);
 	if (ieee->softmac_features & IEEE_SOFTMAC_TX_QUEUE)
 			ieee80211_reset_queue(ieee);
-	
+
 	if (ieee->data_hard_stop)
 			ieee->data_hard_stop(ieee->dev);
 #ifdef ENABLE_DOT11D
@@ -2717,27 +2717,27 @@ void ieee80211_disassociate(struct ieee80211_device *ieee)
 	ieee->link_change(ieee->dev);
 	//HTSetConnectBwMode(ieee, HT_CHANNEL_WIDTH_20, HT_EXTCHNL_OFFSET_NO_EXT);
 	notify_wx_assoc_event(ieee);
-	
+
 }
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
 void ieee80211_associate_retry_wq(struct work_struct *work)
 {
-        struct delayed_work *dwork = container_of(work, struct delayed_work, work);
-        struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, associate_retry_wq);
+	struct delayed_work *dwork = container_of(work, struct delayed_work, work);
+	struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, associate_retry_wq);
 #else
 void ieee80211_associate_retry_wq(struct ieee80211_device *ieee)
 {
 #endif
 	unsigned long flags;
-	
+
 	down(&ieee->wx_sem);
 	if(!ieee->proto_started)
 		goto exit;
-		
+
 	if(ieee->state != IEEE80211_ASSOCIATING_RETRY)
 		goto exit;
-		
-	/* until we do not set the state to IEEE80211_NOLINK 
+
+	/* until we do not set the state to IEEE80211_NOLINK
 	* there are no possibility to have someone else trying
 	* to start an association procdure (we get here with
 	* ieee->state = IEEE80211_ASSOCIATING).
@@ -2747,18 +2747,18 @@ void ieee80211_associate_retry_wq(struct ieee80211_device *ieee)
 	* RX path works with ieee->lock held so there are no
 	* problems. If we are still disassociated then start a scan.
 	* the lock here is necessary to ensure no one try to start
-	* an association procedure when we have just checked the 
+	* an association procedure when we have just checked the
 	* state and we are going to start the scan.
 	*/
 	ieee->state = IEEE80211_NOLINK;
 
 	ieee80211_softmac_check_all_nets(ieee);
-	
+
 	spin_lock_irqsave(&ieee->lock, flags);
-	
+
 	if(ieee->state == IEEE80211_NOLINK)
 		ieee80211_start_scan(ieee);
-	
+
 	spin_unlock_irqrestore(&ieee->lock, flags);
 
 exit:
@@ -2768,39 +2768,39 @@ exit:
 struct sk_buff *ieee80211_get_beacon_(struct ieee80211_device *ieee)
 {
 	u8 broadcast_addr[] = {0xff,0xff,0xff,0xff,0xff,0xff};
-	
+
 	struct sk_buff *skb;
 	struct ieee80211_probe_response *b;
-	
+
 	skb = ieee80211_probe_resp(ieee, broadcast_addr);
-	
-	if (!skb) 
+
+	if (!skb)
 		return NULL;
-	
+
 	b = (struct ieee80211_probe_response *) skb->data;
 	b->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_BEACON);
-		
+
 	return skb;
-	
+
 }
 
 struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee)
 {
 	struct sk_buff *skb;
 	struct ieee80211_probe_response *b;
-	
+
 	skb = ieee80211_get_beacon_(ieee);
-	if(!skb) 
+	if(!skb)
 		return NULL;
-		
-	b = (struct ieee80211_probe_response *) skb->data;	
+
+	b = (struct ieee80211_probe_response *) skb->data;
 	b->header.seq_ctl = cpu_to_le16(ieee->seq_ctrl[0] << 4);
-	
+
 	if (ieee->seq_ctrl[0] == 0xFFF)
 		ieee->seq_ctrl[0] = 0;
 	else
 		ieee->seq_ctrl[0]++;
-	
+
 	return skb;
 }
 
@@ -2817,15 +2817,15 @@ void ieee80211_stop_protocol(struct ieee80211_device *ieee)
 {
 	if (!ieee->proto_started)
 		return;
-	
+
 	ieee->proto_started = 0;
-	
+
 	ieee80211_stop_send_beacons(ieee);
 	del_timer_sync(&ieee->associate_timer);
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)	
-	cancel_delayed_work(&ieee->associate_retry_wq);	
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
+	cancel_delayed_work(&ieee->associate_retry_wq);
 	cancel_delayed_work(&ieee->start_ibss_wq);
-#endif	
+#endif
 	ieee80211_stop_scan(ieee);
 
 	ieee80211_disassociate(ieee);
@@ -2843,31 +2843,31 @@ void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee)
 void ieee80211_start_protocol(struct ieee80211_device *ieee)
 {
 	short ch = 0;
- 	int i = 0;	
+	int i = 0;
 	if (ieee->proto_started)
 		return;
-		
+
 	ieee->proto_started = 1;
-	
+
 	if (ieee->current_network.channel == 0){
 		do{
 			ch++;
-			if (ch > MAX_CHANNEL_NUMBER) 
+			if (ch > MAX_CHANNEL_NUMBER)
 				return; /* no channel found */
 #ifdef ENABLE_DOT11D
 		}while(!GET_DOT11D_INFO(ieee)->channel_map[ch]);
 #else
 		}while(!ieee->channel_map[ch]);
-#endif	
+#endif
 		ieee->current_network.channel = ch;
 	}
-	
+
 	if (ieee->current_network.beacon_interval == 0)
 		ieee->current_network.beacon_interval = 100;
-//	printk("===>%s(), chan:%d\n", __FUNCTION__, ieee->current_network.channel);	
+//	printk("===>%s(), chan:%d\n", __FUNCTION__, ieee->current_network.channel);
 //	ieee->set_chan(ieee->dev,ieee->current_network.channel);
-	
-       	for(i = 0; i < 17; i++) {
+
+	for(i = 0; i < 17; i++) {
 	  ieee->last_rxseq_num[i] = -1;
 	  ieee->last_rxfrag_num[i] = -1;
 	  ieee->last_packet_time[i] = 0;
@@ -2883,15 +2883,15 @@ void ieee80211_start_protocol(struct ieee80211_device *ieee)
 	 */
 	if (ieee->iw_mode == IW_MODE_INFRA)
 		ieee80211_start_bss(ieee);
-		
+
 	else if (ieee->iw_mode == IW_MODE_ADHOC)
 		ieee80211_start_ibss(ieee);
-		
+
 	else if (ieee->iw_mode == IW_MODE_MASTER)
 		ieee80211_start_master_bss(ieee);
-		
+
 	else if(ieee->iw_mode == IW_MODE_MONITOR)
-		ieee80211_start_monitor_mode(ieee);	
+		ieee80211_start_monitor_mode(ieee);
 }
 
 
@@ -2900,7 +2900,7 @@ void ieee80211_softmac_init(struct ieee80211_device *ieee)
 {
 	int i;
 	memset(&ieee->current_network, 0, sizeof(struct ieee80211_network));
-	
+
 	ieee->state = IEEE80211_NOLINK;
 	ieee->sync_scan_hurryup = 0;
 	for(i = 0; i < 5; i++) {
@@ -2915,7 +2915,7 @@ void ieee80211_softmac_init(struct ieee80211_device *ieee)
 	//added for  AP roaming
 	ieee->LinkDetectInfo.SlotNum = 2;
 	ieee->LinkDetectInfo.NumRecvBcnInPeriod=0;
-        ieee->LinkDetectInfo.NumRecvDataInPeriod=0;
+	ieee->LinkDetectInfo.NumRecvDataInPeriod=0;
 
 	ieee->assoc_id = 0;
 	ieee->queue_stop = 0;
@@ -2943,13 +2943,13 @@ void ieee80211_softmac_init(struct ieee80211_device *ieee)
 	ieee->sta_edca_param[3] = 0x002F3262;
 	ieee->aggregation = true;
 	ieee->enable_rx_imm_BA = 1;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)	
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
 	init_timer(&ieee->scan_timer);
 	ieee->scan_timer.data = (unsigned long)ieee;
 	ieee->scan_timer.function = ieee80211_softmac_scan_cb;
 #endif
 	ieee->tx_pending.txb = NULL;
-	
+
 	init_timer(&ieee->associate_timer);
 	ieee->associate_timer.data = (unsigned long)ieee;
 	ieee->associate_timer.function = ieee80211_associate_abort_cb;
@@ -2958,22 +2958,22 @@ void ieee80211_softmac_init(struct ieee80211_device *ieee)
 	ieee->beacon_timer.data = (unsigned long) ieee;
 	ieee->beacon_timer.function = ieee80211_send_beacon_cb;
 
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)	
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
 #ifdef PF_SYNCTHREAD
 	ieee->wq = create_workqueue(DRV_NAME,0);
-#else	
+#else
 	ieee->wq = create_workqueue(DRV_NAME);
 #endif
 #endif
 
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)	
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
-        INIT_DELAYED_WORK(&ieee->start_ibss_wq,ieee80211_start_ibss_wq);
-        INIT_WORK(&ieee->associate_complete_wq, ieee80211_associate_complete_wq);
-        INIT_WORK(&ieee->associate_procedure_wq, ieee80211_associate_procedure_wq);
-        INIT_DELAYED_WORK(&ieee->softmac_scan_wq,ieee80211_softmac_scan_wq);
-        INIT_DELAYED_WORK(&ieee->associate_retry_wq, ieee80211_associate_retry_wq);
-        INIT_WORK(&ieee->wx_sync_scan_wq,ieee80211_wx_sync_scan_wq);
+	INIT_DELAYED_WORK(&ieee->start_ibss_wq,ieee80211_start_ibss_wq);
+	INIT_WORK(&ieee->associate_complete_wq, ieee80211_associate_complete_wq);
+	INIT_WORK(&ieee->associate_procedure_wq, ieee80211_associate_procedure_wq);
+	INIT_DELAYED_WORK(&ieee->softmac_scan_wq,ieee80211_softmac_scan_wq);
+	INIT_DELAYED_WORK(&ieee->associate_retry_wq, ieee80211_associate_retry_wq);
+	INIT_WORK(&ieee->wx_sync_scan_wq,ieee80211_wx_sync_scan_wq);
 
 #else
 	INIT_WORK(&ieee->start_ibss_wq,(void(*)(void*)) ieee80211_start_ibss_wq,ieee);
@@ -2994,10 +2994,10 @@ void ieee80211_softmac_init(struct ieee80211_device *ieee)
 #endif
 	sema_init(&ieee->wx_sem, 1);
 	sema_init(&ieee->scan_sem, 1);
-	
+
 	spin_lock_init(&ieee->mgmt_tx_lock);
 	spin_lock_init(&ieee->beacon_lock);
-	
+
 	tasklet_init(&ieee->ps_task,
 	     (void(*)(unsigned long)) ieee80211_sta_ps,
 	     (unsigned long)ieee);
@@ -3016,20 +3016,20 @@ void ieee80211_softmac_free(struct ieee80211_device *ieee)
 #endif
 	del_timer_sync(&ieee->associate_timer);
 
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)	
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
 	cancel_delayed_work(&ieee->associate_retry_wq);
 	destroy_workqueue(ieee->wq);
 #endif
-	
+
 	up(&ieee->wx_sem);
 }
 
-/******************************************************** 
+/********************************************************
  * Start of WPA code.                                   *
  * this is stolen from the ipw2200 driver               *
  ********************************************************/
 
- 
+
 static int ieee80211_wpa_enable(struct ieee80211_device *ieee, int value)
 {
 	/* This is called when wpa_supplicant loads and closes the driver
@@ -3039,7 +3039,7 @@ static int ieee80211_wpa_enable(struct ieee80211_device *ieee, int value)
 	return 0;
 }
 
- 
+
 void ieee80211_wpa_assoc_frame(struct ieee80211_device *ieee, char *wpa_ie, int wpa_ie_len)
 {
 	/* make sure WPA is enabled */
@@ -3051,7 +3051,7 @@ void ieee80211_wpa_assoc_frame(struct ieee80211_device *ieee, char *wpa_ie, int
 
 static int ieee80211_wpa_mlme(struct ieee80211_device *ieee, int command, int reason)
 {
-	
+
 	int ret = 0;
 
 	switch (command) {
@@ -3105,7 +3105,7 @@ static int ieee80211_wpa_set_wpa_ie(struct ieee80211_device *ieee,
 
 static int ieee80211_wpa_set_auth_algs(struct ieee80211_device *ieee, int value)
 {
-	
+
 	struct ieee80211_security sec = {
 		.flags = SEC_AUTH_MODE,
 	};
@@ -3165,7 +3165,7 @@ static int ieee80211_wpa_set_param(struct ieee80211_device *ieee, u8 name, u32 v
 			.flags = SEC_ENABLED,
 			.enabled = value,
 		};
- 		ieee->drop_unencrypted = value;
+		ieee->drop_unencrypted = value;
 		/* We only change SEC_LEVEL for open mode. Others
 		 * are set by ipw_wpa_set_encryption.
 		 */
@@ -3215,7 +3215,7 @@ static int ieee80211_wpa_set_encryption(struct ieee80211_device *ieee,
 				  struct ieee_param *param, int param_len)
 {
 	int ret = 0;
-	
+
 	struct ieee80211_crypto_ops *ops;
 	struct ieee80211_crypt_data **crypt;
 
@@ -3300,7 +3300,7 @@ static int ieee80211_wpa_set_encryption(struct ieee80211_device *ieee,
 		if (new_crypt->ops && try_module_get(new_crypt->ops->owner))
 #else
 		if (new_crypt->ops && try_inc_mod_count(new_crypt->ops->owner))
-#endif			
+#endif
 			new_crypt->priv =
 				new_crypt->ops->init(param->u.crypt.idx);
 
@@ -3380,17 +3380,17 @@ inline struct sk_buff *ieee80211_disassociate_skb(
 	struct ieee80211_disassoc *disass;
 
 	skb = dev_alloc_skb(sizeof(struct ieee80211_disassoc));
-	if (!skb) 
+	if (!skb)
 		return NULL;
-	
+
 	disass = (struct ieee80211_disassoc *) skb_put(skb,sizeof(struct ieee80211_disassoc));
 	disass->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_DISASSOC);
 	disass->header.duration_id = 0;
-	
+
 	memcpy(disass->header.addr1, beacon->bssid, ETH_ALEN);
 	memcpy(disass->header.addr2, ieee->dev->dev_addr, ETH_ALEN);
 	memcpy(disass->header.addr3, beacon->bssid, ETH_ALEN);
-	
+
 	disass->reason = asRsn;
 	return skb;
 }
@@ -3424,7 +3424,7 @@ int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_poin
 		ret = -EINVAL;
 		goto out;
 	}
-	
+
 	param = (struct ieee_param *)kmalloc(p->length, GFP_KERNEL);
 	if (param == NULL){
 		ret = -ENOMEM;
@@ -3468,7 +3468,7 @@ int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_poin
 	kfree(param);
 out:
 	up(&ieee->wx_sem);
-	
+
 	return ret;
 }
 
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c
index c3a06e0..d395fc6 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c
@@ -1,7 +1,7 @@
 /* IEEE 802.11 SoftMAC layer
  * Copyright (c) 2005 Andrea Merello <andreamrl at tiscali.it>
  *
- * Mostly extracted from the rtl8180-sa2400 driver for the 
+ * Mostly extracted from the rtl8180-sa2400 driver for the
  * in-kernel generic ieee802.11 stack.
  *
  * Some pieces of code might be stolen from ipw2100 driver
@@ -20,11 +20,11 @@
 #endif
 /* FIXME: add A freqs */
 
-const long ieee80211_wlan_frequencies[] = {  
-	2412, 2417, 2422, 2427, 
-	2432, 2437, 2442, 2447, 
-	2452, 2457, 2462, 2467, 
-	2472, 2484  
+const long ieee80211_wlan_frequencies[] = {
+	2412, 2417, 2422, 2427,
+	2432, 2437, 2442, 2447,
+	2452, 2457, 2462, 2467,
+	2472, 2484
 };
 
 
@@ -35,8 +35,8 @@ int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info
 	struct iw_freq *fwrq = & wrqu->freq;
 
 	down(&ieee->wx_sem);
-	
-	if(ieee->iw_mode == IW_MODE_INFRA){ 
+
+	if(ieee->iw_mode == IW_MODE_INFRA){
 		ret = -EOPNOTSUPP;
 		goto out;
 	}
@@ -47,22 +47,22 @@ int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info
 		     fwrq->m <= (int) 2.487e8)) {
 			int f = fwrq->m / 100000;
 			int c = 0;
-			
+
 			while ((c < 14) && (f != ieee80211_wlan_frequencies[c]))
 				c++;
-			
+
 			/* hack to fall through */
 			fwrq->e = 0;
 			fwrq->m = c + 1;
 		}
 	}
-	
-	if (fwrq->e > 0 || fwrq->m > 14 || fwrq->m < 1 ){ 
+
+	if (fwrq->e > 0 || fwrq->m > 14 || fwrq->m < 1 ){
 		ret = -EOPNOTSUPP;
 		goto out;
-	
+
 	}else { /* Set the channel */
-		
+
 #ifdef ENABLE_DOT11D
 		if (!(GET_DOT11D_INFO(ieee)->channel_map)[fwrq->m]) {
 			ret = -EINVAL;
@@ -71,10 +71,10 @@ int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info
 #endif
 		ieee->current_network.channel = fwrq->m;
 		ieee->set_chan(ieee->dev, ieee->current_network.channel);
-		
+
 		if(ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER)
 			if(ieee->state == IEEE80211_LINKED){
-			
+
 			ieee80211_stop_send_beacons(ieee);
 			ieee80211_start_send_beacons(ieee);
 			}
@@ -97,38 +97,38 @@ int ieee80211_wx_get_freq(struct ieee80211_device *ieee,
 		return -1;
 	//NM 0.7.0 will not accept channel any more.
 	fwrq->m = ieee80211_wlan_frequencies[ieee->current_network.channel-1] * 100000;
-	fwrq->e = 1;	
+	fwrq->e = 1;
 //	fwrq->m = ieee->current_network.channel;
 //	fwrq->e = 0;
-	
+
 	return 0;
 }
 
-int ieee80211_wx_get_wap(struct ieee80211_device *ieee, 
-			    struct iw_request_info *info, 
+int ieee80211_wx_get_wap(struct ieee80211_device *ieee,
+			    struct iw_request_info *info,
 			    union iwreq_data *wrqu, char *extra)
 {
-	unsigned long flags;	
-	
+	unsigned long flags;
+
 	wrqu->ap_addr.sa_family = ARPHRD_ETHER;
-	
+
 	if (ieee->iw_mode == IW_MODE_MONITOR)
 		return -1;
-	
+
 	/* We want avoid to give to the user inconsistent infos*/
 	spin_lock_irqsave(&ieee->lock, flags);
-	
-	if (ieee->state != IEEE80211_LINKED && 
+
+	if (ieee->state != IEEE80211_LINKED &&
 		ieee->state != IEEE80211_LINKED_SCANNING &&
 		ieee->wap_set == 0)
-		
+
 		memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN);
 	else
-		memcpy(wrqu->ap_addr.sa_data, 
+		memcpy(wrqu->ap_addr.sa_data,
 		       ieee->current_network.bssid, ETH_ALEN);
-	
+
 	spin_unlock_irqrestore(&ieee->lock, flags);
-	
+
 	return 0;
 }
 
@@ -138,11 +138,11 @@ int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
 			 union iwreq_data *awrq,
 			 char *extra)
 {
-	
+
 	int ret = 0;
 	u8 zero[] = {0,0,0,0,0,0};
 	unsigned long flags;
-	
+
 	short ifup = ieee->proto_started;//dev->flags & IFF_UP;
 	struct sockaddr *temp = (struct sockaddr *)awrq;
 
@@ -154,50 +154,50 @@ int ieee80211_wx_set_wap(struct ieee80211_device *ieee,
 		ret = -1;
 		goto out;
 	}
-	
+
 	if (temp->sa_family != ARPHRD_ETHER){
 		ret = -EINVAL;
 		goto out;
 	}
-	
+
 	if (ifup)
 		ieee80211_stop_protocol(ieee);
-	
+
 	/* just to avoid to give inconsistent infos in the
-	 * get wx method. not really needed otherwise 
+	 * get wx method. not really needed otherwise
 	 */
 	spin_lock_irqsave(&ieee->lock, flags);
-	
-	memcpy(ieee->current_network.bssid, temp->sa_data, ETH_ALEN); 
+
+	memcpy(ieee->current_network.bssid, temp->sa_data, ETH_ALEN);
 	ieee->wap_set = memcmp(temp->sa_data, zero,ETH_ALEN)!=0;
-	
+
 	spin_unlock_irqrestore(&ieee->lock, flags);
-	
+
 	if (ifup)
 		ieee80211_start_protocol(ieee);
 out:
 	up(&ieee->wx_sem);
 	return ret;
 }
-	
+
  int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b)
 {
 	int len,ret = 0;
 	unsigned long flags;
-	
+
 	if (ieee->iw_mode == IW_MODE_MONITOR)
 		return -1;
-	
-	/* We want avoid to give to the user inconsistent infos*/	
+
+	/* We want avoid to give to the user inconsistent infos*/
 	spin_lock_irqsave(&ieee->lock, flags);
-	
+
 	if (ieee->current_network.ssid[0] == '\0' ||
-		ieee->current_network.ssid_len == 0){ 
+		ieee->current_network.ssid_len == 0){
 		ret = -1;
 		goto out;
 	}
-	
-	if (ieee->state != IEEE80211_LINKED && 
+
+	if (ieee->state != IEEE80211_LINKED &&
 		ieee->state != IEEE80211_LINKED_SCANNING &&
 		ieee->ssid_set == 0){
 		ret = -1;
@@ -210,27 +210,27 @@ out:
 
 out:
 	spin_unlock_irqrestore(&ieee->lock, flags);
-	
+
 	return ret;
-	
+
 }
 
-int ieee80211_wx_set_rate(struct ieee80211_device *ieee, 
+int ieee80211_wx_set_rate(struct ieee80211_device *ieee,
 			     struct iw_request_info *info,
 			     union iwreq_data *wrqu, char *extra)
 {
 
 	u32 target_rate = wrqu->bitrate.value;
-	
+
 	ieee->rate = target_rate/100000;
 	//FIXME: we might want to limit rate also in management protocols.
-	return 0; 
+	return 0;
 }
 
 
 
-int ieee80211_wx_get_rate(struct ieee80211_device *ieee, 
-			     struct iw_request_info *info, 
+int ieee80211_wx_get_rate(struct ieee80211_device *ieee,
+			     struct iw_request_info *info,
 			     union iwreq_data *wrqu, char *extra)
 {
 	u32 tmp_rate;
@@ -249,15 +249,15 @@ int ieee80211_wx_get_rate(struct ieee80211_device *ieee,
 	}
 #else
 	tmp_rate = TxCountToDataRate(ieee, ieee->softmac_stats.CurrentShowTxate);
-	
+
 #endif
 	wrqu->bitrate.value = tmp_rate * 500000;
-	
+
 	return 0;
 }
 
 
-int ieee80211_wx_set_rts(struct ieee80211_device *ieee, 
+int ieee80211_wx_set_rts(struct ieee80211_device *ieee,
 			     struct iw_request_info *info,
 			     union iwreq_data *wrqu, char *extra)
 {
@@ -266,15 +266,15 @@ int ieee80211_wx_set_rts(struct ieee80211_device *ieee,
 	else
 	{
 		if (wrqu->rts.value < MIN_RTS_THRESHOLD ||
-				wrqu->rts.value > MAX_RTS_THRESHOLD) 
+				wrqu->rts.value > MAX_RTS_THRESHOLD)
 			return -EINVAL;
 		ieee->rts = wrqu->rts.value;
 	}
 	return 0;
 }
 
-int ieee80211_wx_get_rts(struct ieee80211_device *ieee, 
-			     struct iw_request_info *info, 
+int ieee80211_wx_get_rts(struct ieee80211_device *ieee,
+			     struct iw_request_info *info,
 			     union iwreq_data *wrqu, char *extra)
 {
 	wrqu->rts.value = ieee->rts;
@@ -285,21 +285,21 @@ int ieee80211_wx_get_rts(struct ieee80211_device *ieee,
 int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info *a,
 			     union iwreq_data *wrqu, char *b)
 {
-	
+
 	ieee->sync_scan_hurryup = 1;
-	
+
 	down(&ieee->wx_sem);
-	
+
 	if (wrqu->mode == ieee->iw_mode)
 		goto out;
-	
+
 	if (wrqu->mode == IW_MODE_MONITOR){
-	
+
 		ieee->dev->type = ARPHRD_IEEE80211;
 	}else{
 		ieee->dev->type = ARPHRD_ETHER;
 	}
-	
+
 	if (!ieee->proto_started){
 		ieee->iw_mode = wrqu->mode;
 	}else{
@@ -316,7 +316,7 @@ out:
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
 void ieee80211_wx_sync_scan_wq(struct work_struct *work)
 {
-        struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, wx_sync_scan_wq);
+	struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, wx_sync_scan_wq);
 #else
 void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee)
 {
@@ -328,12 +328,12 @@ void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee)
 	static int count = 0;
 	chan = ieee->current_network.channel;
 	netif_carrier_off(ieee->dev);
-	
+
 	if (ieee->data_hard_stop)
 		ieee->data_hard_stop(ieee->dev);
-	
+
 	ieee80211_stop_send_beacons(ieee);
-		
+
 	ieee->state = IEEE80211_LINKED_SCANNING;
 	ieee->link_change(ieee->dev);
 	ieee->InitialGainHandler(ieee->dev,IG_Backup);
@@ -357,7 +357,7 @@ void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee)
 	} else {
 		ieee->set_chan(ieee->dev, chan);
 	}
-	
+
 	ieee->InitialGainHandler(ieee->dev,IG_Restore);
 	ieee->state = IEEE80211_LINKED;
 	ieee->link_change(ieee->dev);
@@ -365,34 +365,34 @@ void ieee80211_wx_sync_scan_wq(struct ieee80211_device *ieee)
 	if(ieee->LinkDetectInfo.NumRecvBcnInPeriod==0||ieee->LinkDetectInfo.NumRecvDataInPeriod==0 )
 	{
 		ieee->LinkDetectInfo.NumRecvBcnInPeriod = 1;
-		ieee->LinkDetectInfo.NumRecvDataInPeriod= 1;	
+		ieee->LinkDetectInfo.NumRecvDataInPeriod= 1;
 	}
 	if (ieee->data_hard_resume)
 		ieee->data_hard_resume(ieee->dev);
-	
+
 	if(ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER)
 		ieee80211_start_send_beacons(ieee);
-	
+
 	netif_carrier_on(ieee->dev);
-	count = 0;	
+	count = 0;
 	up(&ieee->wx_sem);
-	
+
 }
 
 int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info *a,
 			     union iwreq_data *wrqu, char *b)
 {
 	int ret = 0;
-	
+
 	down(&ieee->wx_sem);
-	
-	if (ieee->iw_mode == IW_MODE_MONITOR || !(ieee->proto_started)){ 
+
+	if (ieee->iw_mode == IW_MODE_MONITOR || !(ieee->proto_started)){
 		ret = -1;
 		goto out;
 	}
-	
+
 	if ( ieee->state == IEEE80211_LINKED){
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)	
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
 		queue_work(ieee->wq, &ieee->wx_sync_scan_wq);
 #else
 		schedule_task(&ieee->wx_sync_scan_wq);
@@ -400,49 +400,49 @@ int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info
 		/* intentionally forget to up sem */
 		return 0;
 	}
-		
+
 out:
 	up(&ieee->wx_sem);
 	return ret;
 }
 
-int ieee80211_wx_set_essid(struct ieee80211_device *ieee, 
+int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
 			      struct iw_request_info *a,
 			      union iwreq_data *wrqu, char *extra)
 {
-	
+
 	int ret=0,len;
 	short proto_started;
 	unsigned long flags;
-	
+
 	ieee->sync_scan_hurryup = 1;
 	down(&ieee->wx_sem);
-	
+
 	proto_started = ieee->proto_started;
-	
+
 	if (wrqu->essid.length > IW_ESSID_MAX_SIZE){
 		ret= -E2BIG;
 		goto out;
 	}
-	
+
 	if (ieee->iw_mode == IW_MODE_MONITOR){
 		ret= -1;
 		goto out;
 	}
-	
+
 	if(proto_started)
 		ieee80211_stop_protocol(ieee);
-	
-	
+
+
 	/* this is just to be sure that the GET wx callback
 	 * has consisten infos. not needed otherwise
 	 */
 	spin_lock_irqsave(&ieee->lock, flags);
-	
+
 	if (wrqu->essid.flags && wrqu->essid.length) {
 		//first flush current network.ssid
 		len = ((wrqu->essid.length-1) < IW_ESSID_MAX_SIZE) ? (wrqu->essid.length-1) : IW_ESSID_MAX_SIZE;
-#if LINUX_VERSION_CODE <  KERNEL_VERSION(2,6,20)		
+#if LINUX_VERSION_CODE <  KERNEL_VERSION(2,6,20)
 		strncpy(ieee->current_network.ssid, extra, len);
 		ieee->current_network.ssid_len = len;
 #if 0
@@ -467,13 +467,13 @@ int ieee80211_wx_set_essid(struct ieee80211_device *ieee,
 #endif
 		ieee->ssid_set = 1;
 	}
-	else{ 
+	else{
 		ieee->ssid_set = 0;
 		ieee->current_network.ssid[0] = '\0';
 		ieee->current_network.ssid_len = 0;
 	}
 	spin_unlock_irqrestore(&ieee->lock, flags);
-	
+
 	if (proto_started)
 		ieee80211_start_protocol(ieee);
 out:
@@ -489,23 +489,23 @@ out:
 	return 0;
 }
 
- int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee, 
-			       struct iw_request_info *info, 
+ int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee,
+			       struct iw_request_info *info,
 			       union iwreq_data *wrqu, char *extra)
 {
-	
+
 	int *parms = (int *)extra;
 	int enable = (parms[0] > 0);
 	short prev = ieee->raw_tx;
 
 	down(&ieee->wx_sem);
-	
-	if(enable) 
+
+	if(enable)
 		ieee->raw_tx = 1;
-	else 
+	else
 		ieee->raw_tx = 0;
 
-	printk(KERN_INFO"raw TX is %s\n", 
+	printk(KERN_INFO"raw TX is %s\n",
 	      ieee->raw_tx ? "enabled" : "disabled");
 
 	if(ieee->iw_mode == IW_MODE_MONITOR)
@@ -513,21 +513,21 @@ out:
 		if(prev == 0 && ieee->raw_tx){
 			if (ieee->data_hard_resume)
 				ieee->data_hard_resume(ieee->dev);
-	
-			netif_carrier_on(ieee->dev);	
+
+			netif_carrier_on(ieee->dev);
 		}
-		
+
 		if(prev && ieee->raw_tx == 1)
-			netif_carrier_off(ieee->dev); 
+			netif_carrier_off(ieee->dev);
 	}
-	
+
 	up(&ieee->wx_sem);
-	
+
 	return 0;
 }
- 
-int ieee80211_wx_get_name(struct ieee80211_device *ieee, 
-			     struct iw_request_info *info, 
+
+int ieee80211_wx_get_name(struct ieee80211_device *ieee,
+			     struct iw_request_info *info,
 			     union iwreq_data *wrqu, char *extra)
 {
 	strcpy(wrqu->name, "802.11");
@@ -539,14 +539,14 @@ int ieee80211_wx_get_name(struct ieee80211_device *ieee,
 		strcat(wrqu->name, "g");
 	if (ieee->mode & (IEEE_N_24G | IEEE_N_5G))
 		strcat(wrqu->name, "/n");
-	
-	if((ieee->state == IEEE80211_LINKED) || 
+
+	if((ieee->state == IEEE80211_LINKED) ||
 		(ieee->state == IEEE80211_LINKED_SCANNING))
 		strcat(wrqu->name," linked");
 	else if(ieee->state != IEEE80211_NOLINK)
 		strcat(wrqu->name," link..");
-	
-	
+
+
 	return 0;
 }
 
@@ -563,14 +563,14 @@ int ieee80211_wx_set_power(struct ieee80211_device *ieee,
 		(!ieee->ps_request_tx_ack) ||
 		(!ieee->enter_sleep_state) ||
 		(!ieee->ps_is_queue_empty)){
-		
-	//	printk("ERROR. PS mode is tryied to be use but driver missed a callback\n\n");	
-	
+
+	//	printk("ERROR. PS mode is tryied to be use but driver missed a callback\n\n");
+
 		return -1;
 	}
-#endif	
+#endif
 	down(&ieee->wx_sem);
-	
+
 	if (wrqu->power.disabled){
 		ieee->ps = IEEE80211_PS_DISABLED;
 		goto exit;
@@ -579,13 +579,13 @@ int ieee80211_wx_set_power(struct ieee80211_device *ieee,
 		//ieee->ps_period = wrqu->power.value / 1000;
 		ieee->ps_timeout = wrqu->power.value / 1000;
 	}
-	
+
 	if (wrqu->power.flags & IW_POWER_PERIOD) {
-		
+
 		//ieee->ps_timeout = wrqu->power.value / 1000;
 		ieee->ps_period = wrqu->power.value / 1000;
 		//wrq->value / 1024;
-		
+
 	}
 	switch (wrqu->power.flags & IW_POWER_MODE) {
 	case IW_POWER_UNICAST_R:
@@ -595,17 +595,17 @@ int ieee80211_wx_set_power(struct ieee80211_device *ieee,
 		ieee->ps = IEEE80211_PS_MBCAST;
 		break;
 	case IW_POWER_ALL_R:
-		ieee->ps = IEEE80211_PS_UNICAST | IEEE80211_PS_MBCAST;	
+		ieee->ps = IEEE80211_PS_UNICAST | IEEE80211_PS_MBCAST;
 		break;
-		
+
 	case IW_POWER_ON:
 	//	ieee->ps = IEEE80211_PS_DISABLED;
 		break;
-		
+
 	default:
 		ret = -EINVAL;
 		goto exit;
-		
+
 	}
 exit:
 	up(&ieee->wx_sem);
@@ -619,10 +619,10 @@ int ieee80211_wx_get_power(struct ieee80211_device *ieee,
 				 union iwreq_data *wrqu, char *extra)
 {
 	int ret =0;
-	
+
 	down(&ieee->wx_sem);
-	
-	if(ieee->ps == IEEE80211_PS_DISABLED){	
+
+	if(ieee->ps == IEEE80211_PS_DISABLED){
 		wrqu->power.disabled = 1;
 		goto exit;
 	}
@@ -636,12 +636,12 @@ int ieee80211_wx_get_power(struct ieee80211_device *ieee,
 //		ret = -EOPNOTSUPP;
 //		goto exit;
 		wrqu->power.flags = IW_POWER_PERIOD;
-		wrqu->power.value = ieee->ps_period * 1000; 
+		wrqu->power.value = ieee->ps_period * 1000;
 //ieee->current_network.dtim_period * ieee->current_network.beacon_interval * 1024;
 	}
 
        if ((ieee->ps & (IEEE80211_PS_MBCAST | IEEE80211_PS_UNICAST)) == (IEEE80211_PS_MBCAST | IEEE80211_PS_UNICAST))
-	   	wrqu->power.flags |= IW_POWER_ALL_R;
+		wrqu->power.flags |= IW_POWER_ALL_R;
 	else if (ieee->ps & IEEE80211_PS_MBCAST)
 		wrqu->power.flags |= IW_POWER_MULTICAST_R;
 	else
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c
index f3c0603..5724d35 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c
@@ -24,10 +24,10 @@
 
 ******************************************************************************
 
-  Few modifications for Realtek's Wi-Fi drivers by 
+  Few modifications for Realtek's Wi-Fi drivers by
   Andrea Merello <andreamrl at tiscali.it>
-  
-  A special thanks goes to Realtek for their support ! 
+
+  A special thanks goes to Realtek for their support !
 
 ******************************************************************************/
 
@@ -71,11 +71,11 @@ val  | 0  |  0  |  0  |  1  |  x  |  0  |  0  |  0  |  1  |  0  |  x  |  x  |  x
 desc | ^-ver-^  |  ^type-^  |  ^-----subtype-----^  | to  |from |more |retry| pwr |more |wep   |
      |          |           | x=0 data,x=1 data+ack | DS  | DS  |frag |     | mgm |data |      |
      '-----------------------------------------------------------------------------------------'
-		                                    /\
-                                                    |
+						    /\
+						    |
 802.11 Data Frame                                   |
-           ,--------- 'ctrl' expands to >-----------'
-          |
+	   ,--------- 'ctrl' expands to >-----------'
+	  |
       ,--'---,-------------------------------------------------------------.
 Bytes |  2   |  2   |    6    |    6    |    6    |  2   | 0..2312 |   4  |
       |------|------|---------|---------|---------|------|---------|------|
@@ -83,7 +83,7 @@ Desc. | ctrl | dura |  DA/RA  |   TA    |    SA   | Sequ |  Frame  |  fcs |
       |      | tion | (BSSID) |         |         | ence |  data   |      |
       `--------------------------------------------------|         |------'
 Total: 28 non-data bytes                                 `----.----'
-                                                              |
+							      |
        .- 'Frame data' expands to <---------------------------'
        |
        V
@@ -95,7 +95,7 @@ Desc. | SNAP | SNAP | Control |Eth Tunnel| Type | IP      |
       | 0xAA | 0xAA |0x03 (UI)|0x00-00-F8|      |         |
       `-----------------------------------------|         |
 Total: 8 non-data bytes                         `----.----'
-                                                     |
+						     |
        .- 'IP Packet' expands, if WEP enabled, to <--'
        |
        V
@@ -186,7 +186,7 @@ int ieee80211_encrypt_fragment(
 {
 	struct ieee80211_crypt_data* crypt = ieee->crypt[ieee->tx_keyidx];
 	int res;
-	
+
 	if (!(crypt && crypt->ops))
 	{
 		printk("=========>%s(), crypt is null\n", __FUNCTION__);
@@ -277,7 +277,7 @@ struct ieee80211_txb *ieee80211_alloc_txb(int nr_frags, int txb_size,
 
 // Classify the to-be send data packet
 // Need to acquire the sent queue index.
-static int 
+static int
 ieee80211_classify(struct sk_buff *skb, struct ieee80211_network *network)
 {
 	struct ethhdr *eth;
@@ -332,12 +332,12 @@ void ieee80211_tx_query_agg_cap(struct ieee80211_device* ieee, struct sk_buff* s
 		return;
 	// For RTL819X, if pairwisekey = wep/tkip, we don't aggrregation.
 	if(!Adapter->HalFunc.GetNmodeSupportBySecCfgHandler(Adapter))
-		return; 
+		return;
 #endif
 #if 1
 	if(!ieee->GetNmodeSupportBySecCfg(ieee->dev))
 	{
-		return; 
+		return;
 	}
 #endif
 	if(pHTInfo->bCurrentAMPDUEnable)
@@ -385,7 +385,7 @@ FORCED_AGG_SETTING:
 			tcb_desc->ampdu_factor = 0;
 			break;
 
-	}	
+	}
 		return;
 }
 
@@ -400,9 +400,9 @@ extern void ieee80211_qurey_ShortPreambleMode(struct ieee80211_device* ieee, cb_
 	{
 		tcb_desc->bUseShortPreamble = true;
 	}
-	return;	
+	return;
 }
-extern	void	
+extern	void
 ieee80211_query_HTCapShortGI(struct ieee80211_device *ieee, cb_desc *tcb_desc)
 {
 	PRT_HIGH_THROUGHPUT		pHTInfo = ieee->pHTInfo;
@@ -452,10 +452,10 @@ void ieee80211_query_protectionmode(struct ieee80211_device* ieee, cb_desc* tcb_
 	tcb_desc->bCTSEnable			= false; // Most of protection using RTS/CTS
 	tcb_desc->RTSSC				= 0;		// 20MHz: Don't care;  40MHz: Duplicate.
 	tcb_desc->bRTSBW			= false; // RTS frame bandwidth is always 20MHz
-	
+
 	if(tcb_desc->bBroadcast || tcb_desc->bMulticast)//only unicast frame will use rts/cts
 		return;
-	
+
 	if (is_broadcast_ether_addr(skb->data+16))  //check addr3 as infrastructure add3 is DA.
 		return;
 
@@ -487,7 +487,7 @@ void ieee80211_query_protectionmode(struct ieee80211_device* ieee, cb_desc* tcb_
 		{
 			//check ERP protection
 			if (ieee->current_network.buseprotection)
-			{// CTS-to-SELF 
+			{// CTS-to-SELF
 				tcb_desc->bRTSEnable = true;
 				tcb_desc->bCTSEnable = true;
 				tcb_desc->rts_rate = MGN_24M;
@@ -534,7 +534,7 @@ void ieee80211_query_protectionmode(struct ieee80211_device* ieee, cb_desc* tcb_
 			goto NO_PROTECTION;
 		}
 		}
-	// For test , CTS replace with RTS 
+	// For test , CTS replace with RTS
 	if( 0 )
 	{
 		tcb_desc->bCTSEnable	= true;
@@ -557,7 +557,7 @@ NO_PROTECTION:
 
 void ieee80211_txrate_selectmode(struct ieee80211_device* ieee, cb_desc* tcb_desc)
 {
-#ifdef TO_DO_LIST	
+#ifdef TO_DO_LIST
 	if(!IsDataFrame(pFrame))
 	{
 		pTcb->bTxDisableRateFallBack = TRUE;
@@ -624,7 +624,7 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev)
 	int qos_actived = ieee->current_network.qos_data.active;
 
 	struct ieee80211_crypt_data* crypt;
-	
+
 	cb_desc *tcb_desc;
 
 	spin_lock_irqsave(&ieee->lock, flags);
@@ -637,7 +637,7 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev)
 		       ieee->dev->name);
 		goto success;
 	}
-	
+
 
 	if(likely(ieee->raw_tx == 0)){
 		if (unlikely(skb->len < SNAP_SIZE + sizeof(u16))) {
@@ -645,15 +645,15 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev)
 			ieee->dev->name, skb->len);
 			goto success;
 		}
-	
+
 		memset(skb->cb, 0, sizeof(skb->cb));
 		ether_type = ntohs(((struct ethhdr *)skb->data)->h_proto);
-	
+
 		crypt = ieee->crypt[ieee->tx_keyidx];
-	
+
 		encrypt = !(ether_type == ETH_P_PAE && ieee->ieee802_1x) &&
 			ieee->host_encrypt && crypt && crypt->ops;
-	
+
 		if (!encrypt && ieee->ieee802_1x &&
 		ieee->drop_unencrypted && ether_type != ETH_P_PAE) {
 			stats->tx_dropped++;
@@ -667,29 +667,29 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev)
 				eap_get_type(eap->type));
 		}
 	#endif
-	
+
 		/* Save source and destination addresses */
 		memcpy(&dest, skb->data, ETH_ALEN);
 		memcpy(&src, skb->data+ETH_ALEN, ETH_ALEN);
-	
-                /* Advance the SKB to the start of the payload */
-                skb_pull(skb, sizeof(struct ethhdr));
 
-                /* Determine total amount of storage required for TXB packets */
-                bytes = skb->len + SNAP_SIZE + sizeof(u16);
+		/* Advance the SKB to the start of the payload */
+		skb_pull(skb, sizeof(struct ethhdr));
+
+		/* Determine total amount of storage required for TXB packets */
+		bytes = skb->len + SNAP_SIZE + sizeof(u16);
 
 		if (encrypt)
 			fc = IEEE80211_FTYPE_DATA | IEEE80211_FCTL_WEP;
-		else 
-			
-                        fc = IEEE80211_FTYPE_DATA; 
-		
-		//if(ieee->current_network.QoS_Enable) 
+		else
+
+			fc = IEEE80211_FTYPE_DATA;
+
+		//if(ieee->current_network.QoS_Enable)
 		if(qos_actived)
-			fc |= IEEE80211_STYPE_QOS_DATA; 
+			fc |= IEEE80211_STYPE_QOS_DATA;
 		else
 			fc |= IEEE80211_STYPE_DATA;
-	
+
 		if (ieee->iw_mode == IW_MODE_INFRA) {
 			fc |= IEEE80211_FCTL_TODS;
 			/* To DS: Addr1 = BSSID, Addr2 = SA,
@@ -705,7 +705,7 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev)
 			memcpy(&header.addr3, ieee->current_network.bssid, ETH_ALEN);
 		}
 
-                header.frame_ctl = cpu_to_le16(fc);
+		header.frame_ctl = cpu_to_le16(fc);
 
 		/* Determine fragmentation size based on destination (multicast
 		* and broadcast are not fragmented) */
@@ -718,17 +718,17 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev)
 			frag_size = ieee->fts;//default:392
 			qos_ctl = 0;
 		}
-	
-		//if (ieee->current_network.QoS_Enable)	
+
+		//if (ieee->current_network.QoS_Enable)
 		if(qos_actived)
 		{
 			hdr_len = IEEE80211_3ADDR_LEN + 2;
 
 			skb->priority = ieee80211_classify(skb, &ieee->current_network);
-			qos_ctl |= skb->priority; //set in the ieee80211_classify 	
+			qos_ctl |= skb->priority; //set in the ieee80211_classify
 			header.qos_ctl = cpu_to_le16(qos_ctl & IEEE80211_QOS_TID);
 		} else {
-			hdr_len = IEEE80211_3ADDR_LEN;		
+			hdr_len = IEEE80211_3ADDR_LEN;
 		}
 		/* Determine amount of payload per fragment.  Regardless of if
 		* this stack is providing the full 802.11 header, one will
@@ -738,12 +738,12 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev)
 		if (ieee->config &
 		(CFG_IEEE80211_COMPUTE_FCS | CFG_IEEE80211_RESERVE_FCS))
 			bytes_per_frag -= IEEE80211_FCS_LEN;
-	
+
 		/* Each fragment may need to have room for encryptiong pre/postfix */
 		if (encrypt)
 			bytes_per_frag -= crypt->ops->extra_prefix_len +
 				crypt->ops->extra_postfix_len;
-	
+
 		/* Number of fragments is the total bytes_per_frag /
 		* payload_per_fragment */
 		nr_frags = bytes / bytes_per_frag;
@@ -752,7 +752,7 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev)
 			nr_frags++;
 		else
 			bytes_last_frag = bytes_per_frag;
-	
+
 		/* When we allocate the TXB we allocate enough space for the reserve
 		* and full fragment bytes (bytes_per_frag doesn't include prefix,
 		* postfix, header, FCS, etc.) */
@@ -765,7 +765,7 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev)
 		txb->encrypted = encrypt;
 		txb->payload_size = bytes;
 
-		//if (ieee->current_network.QoS_Enable) 
+		//if (ieee->current_network.QoS_Enable)
 		if(qos_actived)
 		{
 			txb->queue_index = UP2AC(skb->priority);
@@ -779,7 +779,7 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev)
 			skb_frag = txb->fragments[i];
 			tcb_desc = (cb_desc *)(skb_frag->cb + MAX_DEV_ADDR_SIZE);
 			if(qos_actived){
-				skb_frag->priority = skb->priority;//UP2AC(skb->priority);	
+				skb_frag->priority = skb->priority;//UP2AC(skb->priority);
 				tcb_desc->queue_index =  UP2AC(skb->priority);
 			} else {
 				skb_frag->priority = WME_AC_BK;
@@ -800,27 +800,27 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev)
 			}
 			frag_hdr = (struct ieee80211_hdr_3addrqos *)skb_put(skb_frag, hdr_len);
 			memcpy(frag_hdr, &header, hdr_len);
-	
+
 			/* If this is not the last fragment, then add the MOREFRAGS
 			* bit to the frame control */
 			if (i != nr_frags - 1) {
 				frag_hdr->frame_ctl = cpu_to_le16(
 					fc | IEEE80211_FCTL_MOREFRAGS);
 				bytes = bytes_per_frag;
-		
+
 			} else {
 				/* The last fragment takes the remaining length */
 				bytes = bytes_last_frag;
 			}
-			//if(ieee->current_network.QoS_Enable) 
+			//if(ieee->current_network.QoS_Enable)
 			if(qos_actived)
-			{	
+			{
 				// add 1 only indicate to corresponding seq number control 2006/7/12
 				frag_hdr->seq_ctl = cpu_to_le16(ieee->seq_ctrl[UP2AC(skb->priority)+1]<<4 | i);
 			} else {
 				frag_hdr->seq_ctl = cpu_to_le16(ieee->seq_ctrl[0]<<4 | i);
 			}
-			
+
 			/* Put a SNAP header on the first fragment */
 			if (i == 0) {
 				ieee80211_put_snap(
@@ -828,12 +828,12 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev)
 					ether_type);
 				bytes -= SNAP_SIZE + sizeof(u16);
 			}
-	
+
 			memcpy(skb_put(skb_frag, bytes), skb->data, bytes);
-	
+
 			/* Advance the SKB... */
 			skb_pull(skb, bytes);
-	
+
 			/* Encryption routine will move the header forward in order
 			* to insert the IV between the header and the payload */
 			if (encrypt)
@@ -850,7 +850,7 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev)
 		  else
 			ieee->seq_ctrl[UP2AC(skb->priority) + 1]++;
 		} else {
-  		  if (ieee->seq_ctrl[0] == 0xFFF)
+		  if (ieee->seq_ctrl[0] == 0xFFF)
 			ieee->seq_ctrl[0] = 0;
 		  else
 			ieee->seq_ctrl[0]++;
@@ -861,24 +861,24 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev)
 			ieee->dev->name, skb->len);
 			goto success;
 		}
-	
+
 		txb = ieee80211_alloc_txb(1, skb->len, GFP_ATOMIC);
 		if(!txb){
 			printk(KERN_WARNING "%s: Could not allocate TXB\n",
 			ieee->dev->name);
 			goto failed;
 		}
-		
+
 		txb->encrypted = 0;
 		txb->payload_size = skb->len;
 		memcpy(skb_put(txb->fragments[0],skb->len), skb->data, skb->len);
-	}	
+	}
 
  success:
 //WB add to fill data tcb_desc here. only first fragment is considered, need to change, and you may remove to other place.
 	if (txb)
 	{
-#if 1	
+#if 1
 		cb_desc *tcb_desc = (cb_desc *)(txb->fragments[0]->cb + MAX_DEV_ADDR_SIZE);
 		tcb_desc->bTxEnableFwCalcDur = 1;
 		if (is_multicast_ether_addr(header.addr1))
@@ -893,7 +893,7 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev)
 			tcb_desc->data_rate = CURRENT_RATE(ieee->mode, ieee->rate, ieee->HTCurrentOperaRate);
 		ieee80211_qurey_ShortPreambleMode(ieee, tcb_desc);
 		ieee80211_tx_query_agg_cap(ieee, txb->fragments[0], tcb_desc);
-		ieee80211_query_HTCapShortGI(ieee, tcb_desc); 
+		ieee80211_query_HTCapShortGI(ieee, tcb_desc);
 		ieee80211_query_BandwidthMode(ieee, tcb_desc);
 		ieee80211_query_protectionmode(ieee, tcb_desc, txb->fragments[0]);
 		ieee80211_query_seqnum(ieee, txb->fragments[0], header.addr1);
diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c
index f7bcf5a..3b248cd 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c
@@ -45,9 +45,9 @@ struct modes_unit {
 	int mode_size;
 };
 struct modes_unit ieee80211_modes[] = {
-	{"a",1}, 
-	{"b",1}, 
-	{"g",1}, 
+	{"a",1},
+	{"b",1},
+	{"g",1},
 	{"?",1},
 	{"N-24G",5},
 	{"N-5G",4},
@@ -56,18 +56,18 @@ struct modes_unit ieee80211_modes[] = {
 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,4,20)) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
 static inline char *
 iwe_stream_add_event_rsl(char *     stream,         /* Stream of events */
-                     char *     ends,           /* End of stream */
-                     struct iw_event *iwe,      /* Payload */
-                     int        event_len)      /* Real size of payload */
+		     char *     ends,           /* End of stream */
+		     struct iw_event *iwe,      /* Payload */
+		     int        event_len)      /* Real size of payload */
 {
-        /* Check if it's possible */
-        if((stream + event_len) < ends) {
-                iwe->len = event_len;
+	/* Check if it's possible */
+	if((stream + event_len) < ends) {
+		iwe->len = event_len;
 		ndelay(1);   //new
-                memcpy(stream, (char *) iwe, event_len);
-                stream += event_len;
-        }
-        return stream;
+		memcpy(stream, (char *) iwe, event_len);
+		stream += event_len;
+	}
+	return stream;
 }
 #else
 #define iwe_stream_add_event_rsl iwe_stream_add_event
@@ -75,9 +75,9 @@ iwe_stream_add_event_rsl(char *     stream,         /* Stream of events */
 
 #define MAX_CUSTOM_LEN 64
 static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee,
- 					   char *start, char *stop,
+					   char *start, char *stop,
 					   struct ieee80211_network *network,
-                                           struct iw_request_info *info)
+					   struct iw_request_info *info)
 {
 	char custom[MAX_CUSTOM_LEN];
 	char proto_name[IFNAMSIZ];
@@ -106,49 +106,49 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee,
 	if (network->ssid_len == 0) {
 		iwe.u.data.length = sizeof("<hidden>");
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
-                start = iwe_stream_add_point(info, start, stop, &iwe, "<hidden>");
+		start = iwe_stream_add_point(info, start, stop, &iwe, "<hidden>");
 #else
-                start = iwe_stream_add_point(start, stop, &iwe, "<hidden>");
+		start = iwe_stream_add_point(start, stop, &iwe, "<hidden>");
 #endif
-        } else {
+	} else {
 		iwe.u.data.length = min(network->ssid_len, (u8)32);
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
-                start = iwe_stream_add_point(info, start, stop, &iwe, network->ssid);
+		start = iwe_stream_add_point(info, start, stop, &iwe, network->ssid);
 #else
-                start = iwe_stream_add_point(start, stop, &iwe, network->ssid);
+		start = iwe_stream_add_point(start, stop, &iwe, network->ssid);
 #endif
-        }
+	}
 	/* Add the protocol name */
 	iwe.cmd = SIOCGIWNAME;
 	for(i=0; i<(sizeof(ieee80211_modes)/sizeof(ieee80211_modes[0])); i++) {
 		if(network->mode&(1<<i)) {
 			sprintf(pname,ieee80211_modes[i].mode_string,ieee80211_modes[i].mode_size);
 			pname +=ieee80211_modes[i].mode_size;
-		}	
+		}
 	}
 	*pname = '\0';
 	snprintf(iwe.u.name, IFNAMSIZ, "IEEE802.11%s", proto_name);
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
-        start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_CHAR_LEN);
+	start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_CHAR_LEN);
 #else
-        start = iwe_stream_add_event_rsl(start, stop, &iwe, IW_EV_CHAR_LEN);
+	start = iwe_stream_add_event_rsl(start, stop, &iwe, IW_EV_CHAR_LEN);
 #endif
-        /* Add mode */
-        iwe.cmd = SIOCGIWMODE;
-        if (network->capability &
+	/* Add mode */
+	iwe.cmd = SIOCGIWMODE;
+	if (network->capability &
 	    (WLAN_CAPABILITY_BSS | WLAN_CAPABILITY_IBSS)) {
 		if (network->capability & WLAN_CAPABILITY_BSS)
 			iwe.u.mode = IW_MODE_MASTER;
 		else
 			iwe.u.mode = IW_MODE_ADHOC;
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
-                start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_UINT_LEN);
+		start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_UINT_LEN);
 #else
-                start = iwe_stream_add_event_rsl(start, stop, &iwe, IW_EV_UINT_LEN);
+		start = iwe_stream_add_event_rsl(start, stop, &iwe, IW_EV_UINT_LEN);
 #endif
-        }
+	}
 
-        /* Add frequency/channel */
+	/* Add frequency/channel */
 	iwe.cmd = SIOCGIWFREQ;
 /*	iwe.u.freq.m = ieee80211_frequency(network->channel, network->mode);
 	iwe.u.freq.e = 3; */
@@ -156,9 +156,9 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee,
 	iwe.u.freq.e = 0;
 	iwe.u.freq.i = 0;
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
-        start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_FREQ_LEN);
+	start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_FREQ_LEN);
 #else
-        start = iwe_stream_add_event_rsl(start, stop, &iwe, IW_EV_FREQ_LEN);
+	start = iwe_stream_add_event_rsl(start, stop, &iwe, IW_EV_FREQ_LEN);
 #endif
 	/* Add encryption capability */
 	iwe.cmd = SIOCGIWENCODE;
@@ -168,9 +168,9 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee,
 		iwe.u.data.flags = IW_ENCODE_DISABLED;
 	iwe.u.data.length = 0;
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
-        start = iwe_stream_add_point(info, start, stop, &iwe, network->ssid);
+	start = iwe_stream_add_point(info, start, stop, &iwe, network->ssid);
 #else
-        start = iwe_stream_add_point(start, stop, &iwe, network->ssid);
+	start = iwe_stream_add_point(start, stop, &iwe, network->ssid);
 #endif
 	/* Add basic and extended rates */
 	max_rate = 0;
@@ -195,7 +195,7 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee,
 		if (rate > max_rate)
 			max_rate = rate;
 	}
-	
+
 	if (network->mode >= IEEE_N_24G)//add N rate here;
 	{
 		PHT_CAPABILITY_ELE ht_cap = NULL;
@@ -209,13 +209,13 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee,
 		isShortGI = (ht_cap->ChlWidth)?
 						((ht_cap->ShortGI40Mhz)?1:0):
 						((ht_cap->ShortGI20Mhz)?1:0);
-		
+
 		max_mcs = HTGetHighestMCSRate(ieee, ht_cap->MCS, MCS_FILTER_ALL);
 		rate = MCS_DATA_RATE[is40M][isShortGI][max_mcs&0x7f];
 		if (rate > max_rate)
-			max_rate = rate;	
+			max_rate = rate;
 	}
-#if 0	
+#if 0
 	printk("max rate:%d ===basic rate:\n", max_rate);
 	for (i=0;i<network->rates_len;i++)
 		printk(" %x", network->rates[i]);
@@ -228,19 +228,19 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee,
 	iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0;
 	iwe.u.bitrate.value = max_rate * 500000;
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
-        start = iwe_stream_add_event_rsl(info, start, stop, &iwe,
+	start = iwe_stream_add_event_rsl(info, start, stop, &iwe,
 				     IW_EV_PARAM_LEN);
 #else
-        start = iwe_stream_add_event_rsl(start, stop, &iwe,
+	start = iwe_stream_add_event_rsl(start, stop, &iwe,
 				     IW_EV_PARAM_LEN);
 #endif
 	iwe.cmd = IWEVCUSTOM;
 	iwe.u.data.length = p - custom;
 	if (iwe.u.data.length)
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
-        start = iwe_stream_add_point(info, start, stop, &iwe, custom);
+	start = iwe_stream_add_point(info, start, stop, &iwe, custom);
 #else
-        start = iwe_stream_add_point(start, stop, &iwe, custom);
+	start = iwe_stream_add_point(start, stop, &iwe, custom);
 #endif
 	/* Add quality statistics */
 	/* TODO: Fix these values... */
@@ -257,9 +257,9 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee,
 		iwe.u.qual.updated |= IW_QUAL_QUAL_INVALID;
 	iwe.u.qual.updated = 7;
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
-        start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_QUAL_LEN);
+	start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_QUAL_LEN);
 #else
-        start = iwe_stream_add_event_rsl(start, stop, &iwe, IW_EV_QUAL_LEN);
+	start = iwe_stream_add_event_rsl(start, stop, &iwe, IW_EV_QUAL_LEN);
 #endif
 	iwe.cmd = IWEVCUSTOM;
 	p = custom;
@@ -267,11 +267,11 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee,
 	iwe.u.data.length = p - custom;
 	if (iwe.u.data.length)
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
-            start = iwe_stream_add_point(info, start, stop, &iwe, custom);
+	    start = iwe_stream_add_point(info, start, stop, &iwe, custom);
 #else
-            start = iwe_stream_add_point(start, stop, &iwe, custom);
+	    start = iwe_stream_add_point(start, stop, &iwe, custom);
 #endif
-#if (WIRELESS_EXT < 18) 
+#if (WIRELESS_EXT < 18)
 	if (ieee->wpa_enabled && network->wpa_ie_len){
 		char buf[MAX_WPA_IE_LEN * 2 + 30];
 	//	printk("WPA IE\n");
@@ -285,11 +285,11 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee,
 		iwe.cmd = IWEVCUSTOM;
 		iwe.u.data.length = strlen(buf);
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
-                start = iwe_stream_add_point(info, start, stop, &iwe, buf);
+		start = iwe_stream_add_point(info, start, stop, &iwe, buf);
 #else
-                start = iwe_stream_add_point(start, stop, &iwe, buf);
+		start = iwe_stream_add_point(start, stop, &iwe, buf);
 #endif
-        }
+	}
 
 	if (ieee->wpa_enabled && network->rsn_ie_len){
 		char buf[MAX_WPA_IE_LEN * 2 + 30];
@@ -304,11 +304,11 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee,
 		iwe.cmd = IWEVCUSTOM;
 		iwe.u.data.length = strlen(buf);
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
-                start = iwe_stream_add_point(info, start, stop, &iwe, buf);
+		start = iwe_stream_add_point(info, start, stop, &iwe, buf);
 #else
-                start = iwe_stream_add_point(start, stop, &iwe, buf);
+		start = iwe_stream_add_point(start, stop, &iwe, buf);
 #endif
-        }
+	}
 #else
 	memset(&iwe, 0, sizeof(iwe));
 	if (network->wpa_ie_len)
@@ -318,11 +318,11 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee,
 		iwe.cmd = IWEVGENIE;
 		iwe.u.data.length = network->wpa_ie_len;
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
-                start = iwe_stream_add_point(info, start, stop, &iwe, buf);
+		start = iwe_stream_add_point(info, start, stop, &iwe, buf);
 #else
-                start = iwe_stream_add_point(start, stop, &iwe, buf);
+		start = iwe_stream_add_point(start, stop, &iwe, buf);
 #endif
-        }
+	}
 	memset(&iwe, 0, sizeof(iwe));
 	if (network->rsn_ie_len)
 	{
@@ -331,11 +331,11 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee,
 		iwe.cmd = IWEVGENIE;
 		iwe.u.data.length = network->rsn_ie_len;
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
-                start = iwe_stream_add_point(info, start, stop, &iwe, buf);
+		start = iwe_stream_add_point(info, start, stop, &iwe, buf);
 #else
-                start = iwe_stream_add_point(start, stop, &iwe, buf);
+		start = iwe_stream_add_point(start, stop, &iwe, buf);
 #endif
-        }
+	}
 #endif
 
 
@@ -348,9 +348,9 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee,
 	iwe.u.data.length = p - custom;
 	if (iwe.u.data.length)
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
-            start = iwe_stream_add_point(info, start, stop, &iwe, custom);
+	    start = iwe_stream_add_point(info, start, stop, &iwe, custom);
 #else
-            start = iwe_stream_add_point(start, stop, &iwe, custom);
+	    start = iwe_stream_add_point(start, stop, &iwe, custom);
 #endif
 
 	return start;
@@ -377,8 +377,8 @@ int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
 		i++;
 		if((stop-ev)<200)
 		{
-			err = -E2BIG;		
-			break;	
+			err = -E2BIG;
+			break;
 												}
 		if (ieee->scan_age == 0 ||
 		    time_after(network->last_scanned + ieee->scan_age, jiffies))
@@ -488,9 +488,9 @@ int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
 		}
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
 		if (new_crypt->ops && try_module_get(new_crypt->ops->owner))
-#else			
+#else
 		if (new_crypt->ops && try_inc_mod_count(new_crypt->ops->owner))
-#endif			
+#endif
 			new_crypt->priv = new_crypt->ops->init(key);
 
 		if (!new_crypt->ops || !new_crypt->priv) {
@@ -516,7 +516,7 @@ int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
 				   key, escape_essid(sec.keys[key], len),
 				   erq->length, len);
 		sec.key_sizes[key] = len;
- 		(*crypt)->ops->set_key(sec.keys[key], len, NULL,
+		(*crypt)->ops->set_key(sec.keys[key], len, NULL,
 				       (*crypt)->priv);
 		sec.flags |= (1 << key);
 		/* This ensures a key will be activated if no key is
@@ -594,7 +594,7 @@ int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
 
 	if(ieee->iw_mode == IW_MODE_MONITOR)
 		return -1;
-	
+
 	key = erq->flags & IW_ENCODE_INDEX;
 	if (key) {
 		if (key > WEP_KEYS)
@@ -634,192 +634,192 @@ int ieee80211_wx_get_encode(struct ieee80211_device *ieee,
 }
 #if (WIRELESS_EXT >= 18)
 int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee,
-                               struct iw_request_info *info,
-                               union iwreq_data *wrqu, char *extra)
+			       struct iw_request_info *info,
+			       union iwreq_data *wrqu, char *extra)
 {
 	int ret = 0;
 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
 	struct net_device *dev = ieee->dev;
-        struct iw_point *encoding = &wrqu->encoding;
-        struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
-        int i, idx;
-        int group_key = 0;
-        const char *alg, *module;
-        struct ieee80211_crypto_ops *ops;
-        struct ieee80211_crypt_data **crypt;
-
-        struct ieee80211_security sec = {
-                .flags = 0,
-        };
+	struct iw_point *encoding = &wrqu->encoding;
+	struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
+	int i, idx;
+	int group_key = 0;
+	const char *alg, *module;
+	struct ieee80211_crypto_ops *ops;
+	struct ieee80211_crypt_data **crypt;
+
+	struct ieee80211_security sec = {
+		.flags = 0,
+	};
 	//printk("======>encoding flag:%x,ext flag:%x, ext alg:%d\n", encoding->flags,ext->ext_flags, ext->alg);
-        idx = encoding->flags & IW_ENCODE_INDEX;
-        if (idx) {
-                if (idx < 1 || idx > WEP_KEYS)
-                        return -EINVAL;
-                idx--;
-        } else
-                idx = ieee->tx_keyidx;
+	idx = encoding->flags & IW_ENCODE_INDEX;
+	if (idx) {
+		if (idx < 1 || idx > WEP_KEYS)
+			return -EINVAL;
+		idx--;
+	} else
+		idx = ieee->tx_keyidx;
 
-        if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) {
+	if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) {
 
-                crypt = &ieee->crypt[idx];
+		crypt = &ieee->crypt[idx];
 
-                group_key = 1;
-        } else {
-                /* some Cisco APs use idx>0 for unicast in dynamic WEP */
+		group_key = 1;
+	} else {
+		/* some Cisco APs use idx>0 for unicast in dynamic WEP */
 		//printk("not group key, flags:%x, ext->alg:%d\n", ext->ext_flags, ext->alg);
-                if (idx != 0 && ext->alg != IW_ENCODE_ALG_WEP)
-                        return -EINVAL;
-                if (ieee->iw_mode == IW_MODE_INFRA)
+		if (idx != 0 && ext->alg != IW_ENCODE_ALG_WEP)
+			return -EINVAL;
+		if (ieee->iw_mode == IW_MODE_INFRA)
 
-                        crypt = &ieee->crypt[idx];
+			crypt = &ieee->crypt[idx];
 
-                else
-                        return -EINVAL;
-        }
+		else
+			return -EINVAL;
+	}
 
-        sec.flags |= SEC_ENABLED;// | SEC_ENCRYPT;
-        if ((encoding->flags & IW_ENCODE_DISABLED) ||
-            ext->alg == IW_ENCODE_ALG_NONE) {
-                if (*crypt)
-                        ieee80211_crypt_delayed_deinit(ieee, crypt);
+	sec.flags |= SEC_ENABLED;// | SEC_ENCRYPT;
+	if ((encoding->flags & IW_ENCODE_DISABLED) ||
+	    ext->alg == IW_ENCODE_ALG_NONE) {
+		if (*crypt)
+			ieee80211_crypt_delayed_deinit(ieee, crypt);
 
-                for (i = 0; i < WEP_KEYS; i++)
+		for (i = 0; i < WEP_KEYS; i++)
 
 			if (ieee->crypt[i] != NULL)
-	
-                                break;
-
-                if (i == WEP_KEYS) {
-                        sec.enabled = 0;
-                      //  sec.encrypt = 0;
-                        sec.level = SEC_LEVEL_0;
-                        sec.flags |= SEC_LEVEL;
-                }
+
+				break;
+
+		if (i == WEP_KEYS) {
+			sec.enabled = 0;
+		      //  sec.encrypt = 0;
+			sec.level = SEC_LEVEL_0;
+			sec.flags |= SEC_LEVEL;
+		}
 		//printk("disabled: flag:%x\n", encoding->flags);
-                goto done;
-        }
-	
+		goto done;
+	}
+
 	sec.enabled = 1;
     //    sec.encrypt = 1;
 #if 0
-        if (group_key ? !ieee->host_mc_decrypt :
-            !(ieee->host_encrypt || ieee->host_decrypt ||
-              ieee->host_encrypt_msdu))
-                goto skip_host_crypt;
+	if (group_key ? !ieee->host_mc_decrypt :
+	    !(ieee->host_encrypt || ieee->host_decrypt ||
+	      ieee->host_encrypt_msdu))
+		goto skip_host_crypt;
 #endif
-        switch (ext->alg) {
-        case IW_ENCODE_ALG_WEP:
-                alg = "WEP";
-                module = "ieee80211_crypt_wep";
-                break;
-        case IW_ENCODE_ALG_TKIP:
-                alg = "TKIP";
-                module = "ieee80211_crypt_tkip";
-                break;
-        case IW_ENCODE_ALG_CCMP:
-                alg = "CCMP";
-                module = "ieee80211_crypt_ccmp";
-                break;
-        default:
-                IEEE80211_DEBUG_WX("%s: unknown crypto alg %d\n",
-                                   dev->name, ext->alg);
-                ret = -EINVAL;
-                goto done;
-        }
+	switch (ext->alg) {
+	case IW_ENCODE_ALG_WEP:
+		alg = "WEP";
+		module = "ieee80211_crypt_wep";
+		break;
+	case IW_ENCODE_ALG_TKIP:
+		alg = "TKIP";
+		module = "ieee80211_crypt_tkip";
+		break;
+	case IW_ENCODE_ALG_CCMP:
+		alg = "CCMP";
+		module = "ieee80211_crypt_ccmp";
+		break;
+	default:
+		IEEE80211_DEBUG_WX("%s: unknown crypto alg %d\n",
+				   dev->name, ext->alg);
+		ret = -EINVAL;
+		goto done;
+	}
 	printk("alg name:%s\n",alg);
 
 	 ops = ieee80211_get_crypto_ops(alg);
-        if (ops == NULL) {
-                request_module(module);
-                ops = ieee80211_get_crypto_ops(alg);
-        }
-        if (ops == NULL) {
-                IEEE80211_DEBUG_WX("%s: unknown crypto alg %d\n",
-                                   dev->name, ext->alg);
+	if (ops == NULL) {
+		request_module(module);
+		ops = ieee80211_get_crypto_ops(alg);
+	}
+	if (ops == NULL) {
+		IEEE80211_DEBUG_WX("%s: unknown crypto alg %d\n",
+				   dev->name, ext->alg);
 		printk("========>unknown crypto alg %d\n", ext->alg);
-                ret = -EINVAL;
-                goto done;
-        }
+		ret = -EINVAL;
+		goto done;
+	}
 
-        if (*crypt == NULL || (*crypt)->ops != ops) {
-                struct ieee80211_crypt_data *new_crypt;
+	if (*crypt == NULL || (*crypt)->ops != ops) {
+		struct ieee80211_crypt_data *new_crypt;
 
-                ieee80211_crypt_delayed_deinit(ieee, crypt);
+		ieee80211_crypt_delayed_deinit(ieee, crypt);
 
 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,13))
-                new_crypt = kzalloc(sizeof(*new_crypt), GFP_KERNEL);
+		new_crypt = kzalloc(sizeof(*new_crypt), GFP_KERNEL);
 #else
-                new_crypt = kmalloc(sizeof(*new_crypt), GFP_KERNEL);
+		new_crypt = kmalloc(sizeof(*new_crypt), GFP_KERNEL);
 		memset(new_crypt,0,sizeof(*new_crypt));
 #endif
-                if (new_crypt == NULL) {
-                        ret = -ENOMEM;
-                        goto done;
-                }
-                new_crypt->ops = ops;
-                if (new_crypt->ops && try_module_get(new_crypt->ops->owner))
-                        new_crypt->priv = new_crypt->ops->init(idx);
-                if (new_crypt->priv == NULL) {
-                        kfree(new_crypt);
-                        ret = -EINVAL;
-                        goto done;
-                }
-                *crypt = new_crypt;
-
- 	}
-
-        if (ext->key_len > 0 && (*crypt)->ops->set_key &&
-            (*crypt)->ops->set_key(ext->key, ext->key_len, ext->rx_seq,
-                                   (*crypt)->priv) < 0) {
-                IEEE80211_DEBUG_WX("%s: key setting failed\n", dev->name);
+		if (new_crypt == NULL) {
+			ret = -ENOMEM;
+			goto done;
+		}
+		new_crypt->ops = ops;
+		if (new_crypt->ops && try_module_get(new_crypt->ops->owner))
+			new_crypt->priv = new_crypt->ops->init(idx);
+		if (new_crypt->priv == NULL) {
+			kfree(new_crypt);
+			ret = -EINVAL;
+			goto done;
+		}
+		*crypt = new_crypt;
+
+	}
+
+	if (ext->key_len > 0 && (*crypt)->ops->set_key &&
+	    (*crypt)->ops->set_key(ext->key, ext->key_len, ext->rx_seq,
+				   (*crypt)->priv) < 0) {
+		IEEE80211_DEBUG_WX("%s: key setting failed\n", dev->name);
 		printk("key setting failed\n");
-                ret = -EINVAL;
-                goto done;
-        }
-#if 1	
+		ret = -EINVAL;
+		goto done;
+	}
+#if 1
  //skip_host_crypt:
 	//printk("skip_host_crypt:ext_flags:%x\n", ext->ext_flags);
-        if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) {
-                ieee->tx_keyidx = idx;
-                sec.active_key = idx;
-                sec.flags |= SEC_ACTIVE_KEY;
-        }
-
-        if (ext->alg != IW_ENCODE_ALG_NONE) {
-                //memcpy(sec.keys[idx], ext->key, ext->key_len);
-                sec.key_sizes[idx] = ext->key_len;
-                sec.flags |= (1 << idx);
-                if (ext->alg == IW_ENCODE_ALG_WEP) {
-                      //  sec.encode_alg[idx] = SEC_ALG_WEP;
-                        sec.flags |= SEC_LEVEL;
-                        sec.level = SEC_LEVEL_1;
-                } else if (ext->alg == IW_ENCODE_ALG_TKIP) {
-                      //  sec.encode_alg[idx] = SEC_ALG_TKIP;
-                        sec.flags |= SEC_LEVEL;
-                        sec.level = SEC_LEVEL_2;
-                } else if (ext->alg == IW_ENCODE_ALG_CCMP) {
-                       // sec.encode_alg[idx] = SEC_ALG_CCMP;
-                        sec.flags |= SEC_LEVEL;
-                        sec.level = SEC_LEVEL_3;
-                }
-                /* Don't set sec level for group keys. */
-                if (group_key)
-                        sec.flags &= ~SEC_LEVEL;
-        }
+	if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) {
+		ieee->tx_keyidx = idx;
+		sec.active_key = idx;
+		sec.flags |= SEC_ACTIVE_KEY;
+	}
+
+	if (ext->alg != IW_ENCODE_ALG_NONE) {
+		//memcpy(sec.keys[idx], ext->key, ext->key_len);
+		sec.key_sizes[idx] = ext->key_len;
+		sec.flags |= (1 << idx);
+		if (ext->alg == IW_ENCODE_ALG_WEP) {
+		      //  sec.encode_alg[idx] = SEC_ALG_WEP;
+			sec.flags |= SEC_LEVEL;
+			sec.level = SEC_LEVEL_1;
+		} else if (ext->alg == IW_ENCODE_ALG_TKIP) {
+		      //  sec.encode_alg[idx] = SEC_ALG_TKIP;
+			sec.flags |= SEC_LEVEL;
+			sec.level = SEC_LEVEL_2;
+		} else if (ext->alg == IW_ENCODE_ALG_CCMP) {
+		       // sec.encode_alg[idx] = SEC_ALG_CCMP;
+			sec.flags |= SEC_LEVEL;
+			sec.level = SEC_LEVEL_3;
+		}
+		/* Don't set sec level for group keys. */
+		if (group_key)
+			sec.flags &= ~SEC_LEVEL;
+	}
 #endif
 done:
-        if (ieee->set_security)
-                ieee->set_security(ieee->dev, &sec);
+	if (ieee->set_security)
+		ieee->set_security(ieee->dev, &sec);
 
 	 if (ieee->reset_on_keychange &&
-            ieee->iw_mode != IW_MODE_INFRA &&
-            ieee->reset_port && ieee->reset_port(dev)) {
-                IEEE80211_DEBUG_WX("%s: reset_port failed\n", dev->name);
-                return -EINVAL;
-        }
+	    ieee->iw_mode != IW_MODE_INFRA &&
+	    ieee->reset_port && ieee->reset_port(dev)) {
+		IEEE80211_DEBUG_WX("%s: reset_port failed\n", dev->name);
+		return -EINVAL;
+	}
 #endif
-        return ret;
+	return ret;
 }
 
 int ieee80211_wx_get_encode_ext(struct ieee80211_device *ieee,
@@ -847,7 +847,7 @@ int ieee80211_wx_get_encode_ext(struct ieee80211_device *ieee,
 	    ext->alg != IW_ENCODE_ALG_WEP)
 		if (idx != 0 || ieee->iw_mode != IW_MODE_INFRA)
 			return -EINVAL;
-		
+
 	crypt = ieee->crypt[idx];
 	encoding->flags = idx + 1;
 	memset(ext, 0, sizeof(*ext));
@@ -878,46 +878,46 @@ int ieee80211_wx_get_encode_ext(struct ieee80211_device *ieee,
 }
 
 int ieee80211_wx_set_mlme(struct ieee80211_device *ieee,
-                               struct iw_request_info *info,
-                               union iwreq_data *wrqu, char *extra)
+			       struct iw_request_info *info,
+			       union iwreq_data *wrqu, char *extra)
 {
 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
 	struct iw_mlme *mlme = (struct iw_mlme *) extra;
 	switch (mlme->cmd) {
-        case IW_MLME_DEAUTH:
+	case IW_MLME_DEAUTH:
 	case IW_MLME_DISASSOC:
 		ieee80211_disassociate(ieee);
 		break;
 	 default:
-                return -EOPNOTSUPP;
-        }
-#endif		
+		return -EOPNOTSUPP;
+	}
+#endif
 	return 0;
 }
 
 int ieee80211_wx_set_auth(struct ieee80211_device *ieee,
-                               struct iw_request_info *info,
-                               struct iw_param *data, char *extra)
+			       struct iw_request_info *info,
+			       struct iw_param *data, char *extra)
 {
 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
 	switch (data->flags & IW_AUTH_INDEX) {
-        case IW_AUTH_WPA_VERSION:
+	case IW_AUTH_WPA_VERSION:
 	     /*need to support wpa2 here*/
 		//printk("wpa version:%x\n", data->value);
 		break;
-        case IW_AUTH_CIPHER_PAIRWISE:
-        case IW_AUTH_CIPHER_GROUP:
-        case IW_AUTH_KEY_MGMT:
-                /*
+	case IW_AUTH_CIPHER_PAIRWISE:
+	case IW_AUTH_CIPHER_GROUP:
+	case IW_AUTH_KEY_MGMT:
+		/*
  *                  * Host AP driver does not use these parameters and allows
  *                                   * wpa_supplicant to control them internally.
  *                                                    */
-                break;
-        case IW_AUTH_TKIP_COUNTERMEASURES:
-                ieee->tkip_countermeasures = data->value;
-                break;
-        case IW_AUTH_DROP_UNENCRYPTED:
-                ieee->drop_unencrypted = data->value;
+		break;
+	case IW_AUTH_TKIP_COUNTERMEASURES:
+		ieee->tkip_countermeasures = data->value;
+		break;
+	case IW_AUTH_DROP_UNENCRYPTED:
+		ieee->drop_unencrypted = data->value;
 		break;
 
 	case IW_AUTH_80211_AUTH_ALG:
@@ -949,14 +949,14 @@ int ieee80211_wx_set_auth(struct ieee80211_device *ieee,
 
 #endif
 	case IW_AUTH_RX_UNENCRYPTED_EAPOL:
-                ieee->ieee802_1x = data->value;
+		ieee->ieee802_1x = data->value;
 		break;
 	case IW_AUTH_PRIVACY_INVOKED:
 		ieee->privacy_invoked = data->value;
 		break;
 	default:
-                return -EOPNOTSUPP;
-	}	
+		return -EOPNOTSUPP;
+	}
 #endif
 	return 0;
 }
@@ -975,7 +975,7 @@ int ieee80211_wx_set_gen_ie(struct ieee80211_device *ieee, u8 *ie, size_t len)
 	}
 #endif
 	u8 *buf;
-	
+
 	if (len>MAX_WPA_IE_LEN || (len && ie == NULL))
 	{
 	//	printk("return error out, len:%d\n", len);
@@ -996,7 +996,7 @@ int ieee80211_wx_set_gen_ie(struct ieee80211_device *ieee, u8 *ie, size_t len)
 		memcpy(buf, ie, len);
 		kfree(ieee->wpa_ie);
 		ieee->wpa_ie = buf;
-		ieee->wpa_ie_len = len;	
+		ieee->wpa_ie_len = len;
 	}
 	else{
 		if (ieee->wpa_ie)
diff --git a/drivers/staging/rtl8192u/ieee80211/internal.h b/drivers/staging/rtl8192u/ieee80211/internal.h
index 189f285..ddc2235 100644
--- a/drivers/staging/rtl8192u/ieee80211/internal.h
+++ b/drivers/staging/rtl8192u/ieee80211/internal.h
@@ -5,7 +5,7 @@
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option) 
+ * Software Foundation; either version 2 of the License, or (at your option)
  * any later version.
  *
  */
diff --git a/drivers/staging/rtl8192u/ieee80211/proc.c b/drivers/staging/rtl8192u/ieee80211/proc.c
index 6920fb5..6eda928 100644
--- a/drivers/staging/rtl8192u/ieee80211/proc.c
+++ b/drivers/staging/rtl8192u/ieee80211/proc.c
@@ -7,7 +7,7 @@
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option) 
+ * Software Foundation; either version 2 of the License, or (at your option)
  * any later version.
  *
  */
@@ -37,7 +37,7 @@ static void *c_start(struct seq_file *m, loff_t *pos)
 static void *c_next(struct seq_file *m, void *p, loff_t *pos)
 {
 	struct list_head *v = p;
-	
+
 	(*pos)++;
 	v = v->next;
 	return (v == &crypto_alg_list) ?
@@ -52,13 +52,13 @@ static void c_stop(struct seq_file *m, void *p)
 static int c_show(struct seq_file *m, void *p)
 {
 	struct crypto_alg *alg = (struct crypto_alg *)p;
-	
+
 	seq_printf(m, "name         : %s\n", alg->cra_name);
 	seq_printf(m, "module       : %s\n",
 		   (alg->cra_module ?
 		    alg->cra_module->name :
 		    "kernel"));
-	
+
 	switch (alg->cra_flags & CRYPTO_ALG_TYPE_MASK) {
 	case CRYPTO_ALG_TYPE_CIPHER:
 		seq_printf(m, "type         : cipher\n");
@@ -68,12 +68,12 @@ static int c_show(struct seq_file *m, void *p)
 		seq_printf(m, "max keysize  : %u\n",
 					alg->cra_cipher.cia_max_keysize);
 		break;
-		
+
 	case CRYPTO_ALG_TYPE_DIGEST:
 		seq_printf(m, "type         : digest\n");
 		seq_printf(m, "blocksize    : %u\n", alg->cra_blocksize);
 		seq_printf(m, "digestsize   : %u\n",
-		           alg->cra_digest.dia_digestsize);
+			   alg->cra_digest.dia_digestsize);
 		break;
 	case CRYPTO_ALG_TYPE_COMPRESS:
 		seq_printf(m, "type         : compression\n");
@@ -98,7 +98,7 @@ static int crypto_info_open(struct inode *inode, struct file *file)
 {
 	return seq_open(file, &crypto_seq_ops);
 }
-        
+
 static struct file_operations proc_crypto_ops = {
 	.open		= crypto_info_open,
 	.read		= seq_read,
@@ -109,7 +109,7 @@ static struct file_operations proc_crypto_ops = {
 void __init crypto_init_proc(void)
 {
 	struct proc_dir_entry *proc;
-	
+
 	proc = create_proc_entry("crypto", 0, NULL);
 	if (proc)
 		proc->proc_fops = &proc_crypto_ops;
diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c
index cbaff58..d5648b8 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c
@@ -221,14 +221,14 @@ static struct sk_buff* ieee80211_ADDBA_Rsp( IN	struct ieee80211_device* ieee, u8
  *function:  construct DELBA frame
  *   input:  u8* 		dst 	//DELBA frame's destination 
  *   	     PBA_RECORD 	pBA	//BA_RECORD entry which stores the necessary information for BA
- *   	     TR_SELECT	        TxRxSelect  //TX RX direction
+ *   	     TR_SELECT		TxRxSelect  //TX RX direction
  *   	     u16 		ReasonCode  //status code.
  *  output:  none
  *  return:  sk_buff* 		skb     //return constructed skb to xmit 
 ********************************************************************************************************************/
 static struct sk_buff* ieee80211_DELBA(
 	struct ieee80211_device* ieee,
-	u8*		         dst,
+	u8*			 dst,
 	PBA_RECORD		 pBA,
 	TR_SELECT		 TxRxSelect,
 	u16			 ReasonCode
diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HT.h b/drivers/staging/rtl8192u/ieee80211/rtl819x_HT.h
index 9a5a6f7..d510000 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HT.h
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HT.h
@@ -437,7 +437,7 @@ extern u8 MCS_FILTER_1SS[16];
 
 // MCS Bw 40 {1~7, 12~15,32}
 #define	RATE_ADPT_1SS_MASK 		0xFF
-#define	RATE_ADPT_2SS_MASK	   	0xF0 //Skip MCS8~11 because mcs7 > mcs6, 9, 10, 11. 2007.01.16 by Emily
+#define	RATE_ADPT_2SS_MASK		0xF0 //Skip MCS8~11 because mcs7 > mcs6, 9, 10, 11. 2007.01.16 by Emily
 #define	RATE_ADPT_MCS32_MASK		0x01
 
 #define 	IS_11N_MCS_RATE(rate)		(rate&0x80)
diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
index f00524d..720e6f1 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
@@ -361,11 +361,11 @@ bool IsHTHalfNmodeAPs(struct ieee80211_device* ieee)
 		     (net->ralink_cap_exist))
 		retValue = true;
 	else if((memcmp(net->bssid, UNKNOWN_BORADCOM, 3)==0) ||
-    		    (memcmp(net->bssid, LINKSYSWRT330_LINKSYSWRT300_BROADCOM, 3)==0)||
-    		    (memcmp(net->bssid, LINKSYSWRT350_LINKSYSWRT150_BROADCOM, 3)==0)||
-    		    (memcmp(net->bssid, NETGEAR834Bv2_BROADCOM, 3)==0) ||
-    		    (net->broadcom_cap_exist))
-    		  retValue = true;
+		    (memcmp(net->bssid, LINKSYSWRT330_LINKSYSWRT300_BROADCOM, 3)==0)||
+		    (memcmp(net->bssid, LINKSYSWRT350_LINKSYSWRT150_BROADCOM, 3)==0)||
+		    (memcmp(net->bssid, NETGEAR834Bv2_BROADCOM, 3)==0) ||
+		    (net->broadcom_cap_exist))
+		  retValue = true;
 	else if(net->bssht.bdRT2RTAggregation)
 		retValue = true;
 	else
@@ -425,7 +425,7 @@ u8 HTIOTActIsDisableMCS14(struct ieee80211_device* ieee, u8* PeerMacAddr)
 	// Apply for 819u only
 #if (HAL_CODE_BASE==RTL8192 && DEV_BUS_TYPE==USB_INTERFACE)
 	if((memcmp(PeerMacAddr, UNKNOWN_BORADCOM, 3)==0) ||
-    		(memcmp(PeerMacAddr, LINKSYSWRT330_LINKSYSWRT300_BROADCOM, 3)==0)	
+		(memcmp(PeerMacAddr, LINKSYSWRT330_LINKSYSWRT300_BROADCOM, 3)==0)	
 	    )
 	{
 		ret = 1;
@@ -569,8 +569,8 @@ u8 HTIOTActIsCCDFsync(u8* PeerMacAddr)
 {
 	u8	retValue = 0;
 	if(	(memcmp(PeerMacAddr, UNKNOWN_BORADCOM, 3)==0) ||
-	    	(memcmp(PeerMacAddr, LINKSYSWRT330_LINKSYSWRT300_BROADCOM, 3)==0) ||
-	    	(memcmp(PeerMacAddr, LINKSYSWRT350_LINKSYSWRT150_BROADCOM, 3) ==0))
+		(memcmp(PeerMacAddr, LINKSYSWRT330_LINKSYSWRT300_BROADCOM, 3)==0) ||
+		(memcmp(PeerMacAddr, LINKSYSWRT350_LINKSYSWRT150_BROADCOM, 3) ==0))
 	{
 		retValue = 1;
 	}
@@ -648,7 +648,7 @@ void HTConstructCapabilityElement(struct ieee80211_device* ieee, u8* posHTCap, u
 
 
 	//MAC HT parameters info
-        // TODO: Nedd to take care of this part
+	// TODO: Nedd to take care of this part
 	IEEE80211_DEBUG(IEEE80211_DL_HT, "TX HT cap/info ele BW=%d MaxAMSDUSize:%d DssCCk:%d\n", pCapELE->ChlWidth, pCapELE->MaxAMSDUSize, pCapELE->DssCCk);
 
 	if( IsEncrypt) 
@@ -1508,7 +1508,7 @@ void HTResetSelfAndSavePeerSetting(struct ieee80211_device* ieee, 	struct ieee80
 	
 		// Determine the IOT Peer Vendor.
 		HTIOTPeerDetermine(ieee);
-				 			
+							
 		// Decide IOT Action
 		// Must be called after the parameter of pHTInfo->bCurrentRT2RTAggregation is decided
 		pHTInfo->IOTAction = 0;
@@ -1662,7 +1662,7 @@ void HTSetConnectBwMode(struct ieee80211_device* ieee, HT_CHANNEL_WIDTH	Bandwidt
 	//if in half N mode, set to 20M bandwidth please 09.08.2008 WB.
 	if(Bandwidth==HT_CHANNEL_WIDTH_20_40 && (!ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev)))
 	 {
-	 		// Handle Illegal extention channel offset!!
+			// Handle Illegal extention channel offset!!
 		if(ieee->current_network.channel<2 && Offset==HT_EXTCHNL_OFFSET_LOWER)
 			Offset = HT_EXTCHNL_OFFSET_NO_EXT;
 		if(Offset==HT_EXTCHNL_OFFSET_UPPER || Offset==HT_EXTCHNL_OFFSET_LOWER) {
diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_Qos.h b/drivers/staging/rtl8192u/ieee80211/rtl819x_Qos.h
index 7635ad5..f8689b2 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_Qos.h
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_Qos.h
@@ -647,18 +647,18 @@ typedef struct _QOS_TSTREAM{
 //      802.11 Management frame Status Code field
 //----------------------------------------------------------------------------
 typedef struct _OCTET_STRING{
-        u8        	*Octet;
-        u16             Length;
+	u8        	*Octet;
+	u16             Length;
 }OCTET_STRING, *POCTET_STRING;
 #if 0
 #define FillOctetString(_os,_octet,_len)             \
-        (_os).Octet=(u8 *)(_octet);                  \
-        (_os).Length=(_len);
+	(_os).Octet=(u8 *)(_octet);                  \
+	(_os).Length=(_len);
 
 #define WMM_ELEM_HDR_LEN        		     6
 #define WMMElemSkipHdr(_osWMMElem)                   \
-        (_osWMMElem).Octet += WMM_ELEM_HDR_LEN;      \
-        (_osWMMElem).Length -= WMM_ELEM_HDR_LEN;
+	(_osWMMElem).Octet += WMM_ELEM_HDR_LEN;      \
+	(_osWMMElem).Length -= WMM_ELEM_HDR_LEN;
 #endif
 //
 // STA QoS data.
diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c
index ebfe284..db72f41 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c
@@ -509,31 +509,31 @@ void RemoveTsEntry(
 		if(timer_pending(&pRxTS->RxPktPendingTimer))	
 			del_timer_sync(&pRxTS->RxPktPendingTimer);
 
-                while(!list_empty(&pRxTS->RxPendingPktList))
-                {
-                //      PlatformAcquireSpinLock(Adapter, RT_RX_SPINLOCK);
-                        spin_lock_irqsave(&(ieee->reorder_spinlock), flags);
-                        //pRxReorderEntry = list_entry(&pRxTS->RxPendingPktList.prev,RX_REORDER_ENTRY,List);
+		while(!list_empty(&pRxTS->RxPendingPktList))
+		{
+		//      PlatformAcquireSpinLock(Adapter, RT_RX_SPINLOCK);
+			spin_lock_irqsave(&(ieee->reorder_spinlock), flags);
+			//pRxReorderEntry = list_entry(&pRxTS->RxPendingPktList.prev,RX_REORDER_ENTRY,List);
 			pRxReorderEntry = (PRX_REORDER_ENTRY)list_entry(pRxTS->RxPendingPktList.prev,RX_REORDER_ENTRY,List);
-                        list_del_init(&pRxReorderEntry->List);
-                        {
-                                int i = 0;
-                                struct ieee80211_rxb * prxb = pRxReorderEntry->prxb;
+			list_del_init(&pRxReorderEntry->List);
+			{
+				int i = 0;
+				struct ieee80211_rxb * prxb = pRxReorderEntry->prxb;
 				if (unlikely(!prxb))
 				{
 					spin_unlock_irqrestore(&(ieee->reorder_spinlock), flags);
 					return;
 				}
-                                for(i =0; i < prxb->nr_subframes; i++) {
-                                        dev_kfree_skb(prxb->subframes[i]);
-                                }
-                                kfree(prxb);
-                                prxb = NULL;
-                        }
-                        list_add_tail(&pRxReorderEntry->List,&ieee->RxReorder_Unused_List);
-                        //PlatformReleaseSpinLock(Adapter, RT_RX_SPINLOCK);
-                        spin_unlock_irqrestore(&(ieee->reorder_spinlock), flags);
-                }
+				for(i =0; i < prxb->nr_subframes; i++) {
+					dev_kfree_skb(prxb->subframes[i]);
+				}
+				kfree(prxb);
+				prxb = NULL;
+			}
+			list_add_tail(&pRxReorderEntry->List,&ieee->RxReorder_Unused_List);
+			//PlatformReleaseSpinLock(Adapter, RT_RX_SPINLOCK);
+			spin_unlock_irqrestore(&(ieee->reorder_spinlock), flags);
+		}
 
 //#endif
 	}
diff --git a/drivers/staging/rtl8192u/ieee80211/rtl_crypto.h b/drivers/staging/rtl8192u/ieee80211/rtl_crypto.h
index 491c505..af94bae 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl_crypto.h
+++ b/drivers/staging/rtl8192u/ieee80211/rtl_crypto.h
@@ -6,10 +6,10 @@
  *
  * Portions derived from Cryptoapi, by Alexander Kjeldaas <astor at fast.no>
  * and Nettle, by Niels M鰈ler.
- * 
+ *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option) 
+ * Software Foundation; either version 2 of the License, or (at your option)
  * any later version.
  *
  */
@@ -73,7 +73,7 @@ struct cipher_alg {
 	unsigned int cia_min_keysize;
 	unsigned int cia_max_keysize;
 	int (*cia_setkey)(void *ctx, const u8 *key,
-	                  unsigned int keylen, u32 *flags);
+			  unsigned int keylen, u32 *flags);
 	void (*cia_encrypt)(void *ctx, u8 *dst, const u8 *src);
 	void (*cia_decrypt)(void *ctx, u8 *dst, const u8 *src);
 };
@@ -84,16 +84,16 @@ struct digest_alg {
 	void (*dia_update)(void *ctx, const u8 *data, unsigned int len);
 	void (*dia_final)(void *ctx, u8 *out);
 	int (*dia_setkey)(void *ctx, const u8 *key,
-	                  unsigned int keylen, u32 *flags);
+			  unsigned int keylen, u32 *flags);
 };
 
 struct compress_alg {
 	int (*coa_init)(void *ctx);
 	void (*coa_exit)(void *ctx);
 	int (*coa_compress)(void *ctx, const u8 *src, unsigned int slen,
-	                    u8 *dst, unsigned int *dlen);
+			    u8 *dst, unsigned int *dlen);
 	int (*coa_decompress)(void *ctx, const u8 *src, unsigned int slen,
-	                      u8 *dst, unsigned int *dlen);
+			      u8 *dst, unsigned int *dlen);
 };
 
 #define cra_cipher	cra_u.cipher
@@ -112,7 +112,7 @@ struct crypto_alg {
 		struct digest_alg digest;
 		struct compress_alg compress;
 	} cra_u;
-	
+
 	struct module *cra_module;
 };
 
@@ -139,15 +139,15 @@ struct cipher_tfm {
 	unsigned int cit_ivsize;
 	u32 cit_mode;
 	int (*cit_setkey)(struct crypto_tfm *tfm,
-	                  const u8 *key, unsigned int keylen);
+			  const u8 *key, unsigned int keylen);
 	int (*cit_encrypt)(struct crypto_tfm *tfm,
 			   struct scatterlist *dst,
 			   struct scatterlist *src,
 			   unsigned int nbytes);
 	int (*cit_encrypt_iv)(struct crypto_tfm *tfm,
-	                      struct scatterlist *dst,
-	                      struct scatterlist *src,
-	                      unsigned int nbytes, u8 *iv);
+			      struct scatterlist *dst,
+			      struct scatterlist *src,
+			      unsigned int nbytes, u8 *iv);
 	int (*cit_decrypt)(struct crypto_tfm *tfm,
 			   struct scatterlist *dst,
 			   struct scatterlist *src,
@@ -162,12 +162,12 @@ struct cipher_tfm {
 struct digest_tfm {
 	void (*dit_init)(struct crypto_tfm *tfm);
 	void (*dit_update)(struct crypto_tfm *tfm,
-	                   struct scatterlist *sg, unsigned int nsg);
+			   struct scatterlist *sg, unsigned int nsg);
 	void (*dit_final)(struct crypto_tfm *tfm, u8 *out);
 	void (*dit_digest)(struct crypto_tfm *tfm, struct scatterlist *sg,
-	                   unsigned int nsg, u8 *out);
+			   unsigned int nsg, u8 *out);
 	int (*dit_setkey)(struct crypto_tfm *tfm,
-	                  const u8 *key, unsigned int keylen);
+			  const u8 *key, unsigned int keylen);
 #ifdef CONFIG_CRYPTO_HMAC
 	void *dit_hmac_block;
 #endif
@@ -175,11 +175,11 @@ struct digest_tfm {
 
 struct compress_tfm {
 	int (*cot_compress)(struct crypto_tfm *tfm,
-	                    const u8 *src, unsigned int slen,
-	                    u8 *dst, unsigned int *dlen);
+			    const u8 *src, unsigned int slen,
+			    u8 *dst, unsigned int *dlen);
 	int (*cot_decompress)(struct crypto_tfm *tfm,
-	                      const u8 *src, unsigned int slen,
-	                      u8 *dst, unsigned int *dlen);
+			      const u8 *src, unsigned int slen,
+			      u8 *dst, unsigned int *dlen);
 };
 
 #define crt_cipher	crt_u.cipher
@@ -189,20 +189,20 @@ struct compress_tfm {
 struct crypto_tfm {
 
 	u32 crt_flags;
-	
+
 	union {
 		struct cipher_tfm cipher;
 		struct digest_tfm digest;
 		struct compress_tfm compress;
 	} crt_u;
-	
+
 	struct crypto_alg *__crt_alg;
 };
 
-/* 
+/*
  * Transform user interface.
  */
- 
+
 /*
  * crypto_alloc_tfm() will first attempt to locate an already loaded algorithm.
  * If that fails and the kernel supports dynamically loadable modules, it
@@ -226,7 +226,7 @@ static inline const char *crypto_tfm_alg_name(struct crypto_tfm *tfm)
 static inline const char *crypto_tfm_alg_modname(struct crypto_tfm *tfm)
 {
 	struct crypto_alg *alg = tfm->__crt_alg;
-	
+
 	if (alg->cra_module)
 		return alg->cra_module->name;
 	else
@@ -277,8 +277,8 @@ static inline void crypto_digest_init(struct crypto_tfm *tfm)
 }
 
 static inline void crypto_digest_update(struct crypto_tfm *tfm,
-                                        struct scatterlist *sg,
-                                        unsigned int nsg)
+					struct scatterlist *sg,
+					unsigned int nsg)
 {
 	BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_DIGEST);
 	tfm->crt_digest.dit_update(tfm, sg, nsg);
@@ -291,15 +291,15 @@ static inline void crypto_digest_final(struct crypto_tfm *tfm, u8 *out)
 }
 
 static inline void crypto_digest_digest(struct crypto_tfm *tfm,
-                                        struct scatterlist *sg,
-                                        unsigned int nsg, u8 *out)
+					struct scatterlist *sg,
+					unsigned int nsg, u8 *out)
 {
 	BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_DIGEST);
 	tfm->crt_digest.dit_digest(tfm, sg, nsg, out);
 }
 
 static inline int crypto_digest_setkey(struct crypto_tfm *tfm,
-                                       const u8 *key, unsigned int keylen)
+				       const u8 *key, unsigned int keylen)
 {
 	BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_DIGEST);
 	if (tfm->crt_digest.dit_setkey == NULL)
@@ -308,44 +308,44 @@ static inline int crypto_digest_setkey(struct crypto_tfm *tfm,
 }
 
 static inline int crypto_cipher_setkey(struct crypto_tfm *tfm,
-                                       const u8 *key, unsigned int keylen)
+				       const u8 *key, unsigned int keylen)
 {
 	BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER);
 	return tfm->crt_cipher.cit_setkey(tfm, key, keylen);
 }
 
 static inline int crypto_cipher_encrypt(struct crypto_tfm *tfm,
-                                        struct scatterlist *dst,
-                                        struct scatterlist *src,
-                                        unsigned int nbytes)
+					struct scatterlist *dst,
+					struct scatterlist *src,
+					unsigned int nbytes)
 {
 	BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER);
 	return tfm->crt_cipher.cit_encrypt(tfm, dst, src, nbytes);
-}                                        
+}
 
 static inline int crypto_cipher_encrypt_iv(struct crypto_tfm *tfm,
-                                           struct scatterlist *dst,
-                                           struct scatterlist *src,
-                                           unsigned int nbytes, u8 *iv)
+					   struct scatterlist *dst,
+					   struct scatterlist *src,
+					   unsigned int nbytes, u8 *iv)
 {
 	BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER);
 	BUG_ON(tfm->crt_cipher.cit_mode == CRYPTO_TFM_MODE_ECB);
 	return tfm->crt_cipher.cit_encrypt_iv(tfm, dst, src, nbytes, iv);
-}                                        
+}
 
 static inline int crypto_cipher_decrypt(struct crypto_tfm *tfm,
-                                        struct scatterlist *dst,
-                                        struct scatterlist *src,
-                                        unsigned int nbytes)
+					struct scatterlist *dst,
+					struct scatterlist *src,
+					unsigned int nbytes)
 {
 	BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER);
 	return tfm->crt_cipher.cit_decrypt(tfm, dst, src, nbytes);
 }
 
 static inline int crypto_cipher_decrypt_iv(struct crypto_tfm *tfm,
-                                           struct scatterlist *dst,
-                                           struct scatterlist *src,
-                                           unsigned int nbytes, u8 *iv)
+					   struct scatterlist *dst,
+					   struct scatterlist *src,
+					   unsigned int nbytes, u8 *iv)
 {
 	BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER);
 	BUG_ON(tfm->crt_cipher.cit_mode == CRYPTO_TFM_MODE_ECB);
@@ -353,30 +353,30 @@ static inline int crypto_cipher_decrypt_iv(struct crypto_tfm *tfm,
 }
 
 static inline void crypto_cipher_set_iv(struct crypto_tfm *tfm,
-                                        const u8 *src, unsigned int len)
+					const u8 *src, unsigned int len)
 {
 	BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER);
 	memcpy(tfm->crt_cipher.cit_iv, src, len);
 }
 
 static inline void crypto_cipher_get_iv(struct crypto_tfm *tfm,
-                                        u8 *dst, unsigned int len)
+					u8 *dst, unsigned int len)
 {
 	BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER);
 	memcpy(dst, tfm->crt_cipher.cit_iv, len);
 }
 
 static inline int crypto_comp_compress(struct crypto_tfm *tfm,
-                                       const u8 *src, unsigned int slen,
-                                       u8 *dst, unsigned int *dlen)
+				       const u8 *src, unsigned int slen,
+				       u8 *dst, unsigned int *dlen)
 {
 	BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_COMPRESS);
 	return tfm->crt_compress.cot_compress(tfm, src, slen, dst, dlen);
 }
 
 static inline int crypto_comp_decompress(struct crypto_tfm *tfm,
-                                         const u8 *src, unsigned int slen,
-                                         u8 *dst, unsigned int *dlen)
+					 const u8 *src, unsigned int slen,
+					 u8 *dst, unsigned int *dlen)
 {
 	BUG_ON(crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_COMPRESS);
 	return tfm->crt_compress.cot_decompress(tfm, src, slen, dst, dlen);
@@ -388,11 +388,11 @@ static inline int crypto_comp_decompress(struct crypto_tfm *tfm,
 #ifdef CONFIG_CRYPTO_HMAC
 void crypto_hmac_init(struct crypto_tfm *tfm, u8 *key, unsigned int *keylen);
 void crypto_hmac_update(struct crypto_tfm *tfm,
-                        struct scatterlist *sg, unsigned int nsg);
+			struct scatterlist *sg, unsigned int nsg);
 void crypto_hmac_final(struct crypto_tfm *tfm, u8 *key,
-                       unsigned int *keylen, u8 *out);
+		       unsigned int *keylen, u8 *out);
 void crypto_hmac(struct crypto_tfm *tfm, u8 *key, unsigned int *keylen,
-                 struct scatterlist *sg, unsigned int nsg, u8 *out);
+		 struct scatterlist *sg, unsigned int nsg, u8 *out);
 #endif	/* CONFIG_CRYPTO_HMAC */
 
 #endif	/* _LINUX_CRYPTO_H */
diff --git a/drivers/staging/rtl8192u/r8180_93cx6.c b/drivers/staging/rtl8192u/r8180_93cx6.c
index 1842d7b..e9b217a 100644
--- a/drivers/staging/rtl8192u/r8180_93cx6.c
+++ b/drivers/staging/rtl8192u/r8180_93cx6.c
@@ -1,20 +1,20 @@
-/* 
+/*
    This files contains card eeprom (93c46 or 93c56) programming routines,
    memory is addressed by 16 bits words.
 
    This is part of rtl8180 OpenSource driver.
-   Copyright (C) Andrea Merello 2004  <andreamrl at tiscali.it> 
+   Copyright (C) Andrea Merello 2004  <andreamrl at tiscali.it>
    Released under the terms of GPL (General Public Licence)
-   
-   Parts of this driver are based on the GPL part of the 
+
+   Parts of this driver are based on the GPL part of the
    official realtek driver.
-   
-   Parts of this driver are based on the rtl8180 driver skeleton 
+
+   Parts of this driver are based on the rtl8180 driver skeleton
    from Patric Schenke & Andres Salomon.
 
    Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver.
-   
-   We want to tanks the Authors of those projects and the Ndiswrapper 
+
+   We want to tanks the Authors of those projects and the Ndiswrapper
    project Authors.
 */
 
@@ -38,11 +38,11 @@ void eprom_cs(struct net_device *dev, short bit)
 void eprom_ck_cycle(struct net_device *dev)
 {
 	write_nic_byte_E(dev, EPROM_CMD,
-		       (1<<EPROM_CK_SHIFT) | read_nic_byte_E(dev,EPROM_CMD)); 
+		       (1<<EPROM_CK_SHIFT) | read_nic_byte_E(dev,EPROM_CMD));
 	force_pci_posting(dev);
 	udelay(EPROM_DELAY);
-	write_nic_byte_E(dev, EPROM_CMD, 
-		       read_nic_byte_E(dev, EPROM_CMD) &~ (1<<EPROM_CK_SHIFT)); 
+	write_nic_byte_E(dev, EPROM_CMD,
+		       read_nic_byte_E(dev, EPROM_CMD) &~ (1<<EPROM_CK_SHIFT));
 	force_pci_posting(dev);
 	udelay(EPROM_DELAY);
 }
@@ -52,10 +52,10 @@ void eprom_w(struct net_device *dev,short bit)
 {
 	if(bit)
 		write_nic_byte_E(dev, EPROM_CMD, (1<<EPROM_W_SHIFT) | \
-			       read_nic_byte_E(dev,EPROM_CMD)); 
+			       read_nic_byte_E(dev,EPROM_CMD));
 	else
 		write_nic_byte_E(dev, EPROM_CMD, read_nic_byte_E(dev,EPROM_CMD)\
-			       &~(1<<EPROM_W_SHIFT)); 
+			       &~(1<<EPROM_W_SHIFT));
 
 	force_pci_posting(dev);
 	udelay(EPROM_DELAY);
@@ -77,7 +77,7 @@ short eprom_r(struct net_device *dev)
 void eprom_send_bits_string(struct net_device *dev, short b[], int len)
 {
 	int i;
-	
+
 	for(i=0; i<len; i++){
 		eprom_w(dev, b[i]);
 		eprom_ck_cycle(dev);
@@ -95,12 +95,12 @@ u32 eprom_read(struct net_device *dev, u32 addr)
 	u32 ret;
 
 	ret=0;
-        //enable EPROM programming
+	//enable EPROM programming
 	write_nic_byte_E(dev, EPROM_CMD,
-		       (EPROM_CMD_PROGRAM<<EPROM_CMD_OPERATING_MODE_SHIFT)); 
+		       (EPROM_CMD_PROGRAM<<EPROM_CMD_OPERATING_MODE_SHIFT));
 	force_pci_posting(dev);
 	udelay(EPROM_DELAY);
-	
+
 	if (priv->epromtype==EPROM_93c56){
 		addr_str[7]=addr & 1;
 		addr_str[6]=addr & (1<<1);
@@ -127,20 +127,20 @@ u32 eprom_read(struct net_device *dev, u32 addr)
 
 	//keep chip pin D to low state while reading.
 	//I'm unsure if it is necessary, but anyway shouldn't hurt
-	eprom_w(dev, 0); 
-	
-	for(i=0;i<16;i++){	
-		//eeprom needs a clk cycle between writing opcode&adr 
+	eprom_w(dev, 0);
+
+	for(i=0;i<16;i++){
+		//eeprom needs a clk cycle between writing opcode&adr
 		//and reading data. (eeprom outs a dummy 0)
 		eprom_ck_cycle(dev);
 		ret |= (eprom_r(dev)<<(15-i));
 	}
-	
+
 	eprom_cs(dev, 0);
 	eprom_ck_cycle(dev);
 
 	//disable EPROM programming
 	write_nic_byte_E(dev, EPROM_CMD,
-		       (EPROM_CMD_NORMAL<<EPROM_CMD_OPERATING_MODE_SHIFT)); 
+		       (EPROM_CMD_NORMAL<<EPROM_CMD_OPERATING_MODE_SHIFT));
 	return ret;
 }
diff --git a/drivers/staging/rtl8192u/r8180_93cx6.h b/drivers/staging/rtl8192u/r8180_93cx6.h
index 936be05..fb3ac97 100644
--- a/drivers/staging/rtl8192u/r8180_93cx6.h
+++ b/drivers/staging/rtl8192u/r8180_93cx6.h
@@ -1,12 +1,12 @@
-/* 
+/*
 	This is part of rtl8187 OpenSource driver
-	Copyright (C) Andrea Merello 2004-2005  <andreamrl at tiscali.it> 
+	Copyright (C) Andrea Merello 2004-2005  <andreamrl at tiscali.it>
 	Released under the terms of GPL (General Public Licence)
-	
+
 	Parts of this driver are based on the GPL part of the official realtek driver
 	Parts of this driver are based on the rtl8180 driver skeleton from Patric Schenke & Andres Salomon
 	Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver
-	
+
 	We want to tanks the Authors of such projects and the Ndiswrapper project Authors.
 */
 
@@ -18,21 +18,21 @@
 
 #define EPROM_DELAY 10
 
-#define EPROM_ANAPARAM_ADDRLWORD 0xd 
-#define EPROM_ANAPARAM_ADDRHWORD 0xe 
+#define EPROM_ANAPARAM_ADDRLWORD 0xd
+#define EPROM_ANAPARAM_ADDRHWORD 0xe
 
 #define EPROM_RFCHIPID 0x6
 #define EPROM_TXPW_BASE 0x05
-#define EPROM_RFCHIPID_RTL8225U 5 
+#define EPROM_RFCHIPID_RTL8225U 5
 #define EPROM_RF_PARAM 0x4
 #define EPROM_CONFIG2 0xc
 
 #define EPROM_VERSION 0x1E
 #define MAC_ADR 0x7
 
-#define CIS 0x18 
+#define CIS 0x18
 
-#define EPROM_TXPW0 0x16 
+#define EPROM_TXPW0 0x16
 #define EPROM_TXPW2 0x1b
 #define EPROM_TXPW1 0x3d
 
diff --git a/drivers/staging/rtl8192u/r8180_pm.c b/drivers/staging/rtl8192u/r8180_pm.c
index 74992ef..0c58d0e 100644
--- a/drivers/staging/rtl8192u/r8180_pm.c
+++ b/drivers/staging/rtl8192u/r8180_pm.c
@@ -1,12 +1,12 @@
-/* 
-   Power management interface routines. 
+/*
+   Power management interface routines.
    Written by Mariusz Matuszek.
-   This code is currently just a placeholder for later work and 
+   This code is currently just a placeholder for later work and
    does not do anything useful.
-   
+
    This is part of rtl8180 OpenSource driver.
-   Copyright (C) Andrea Merello 2004  <andreamrl at tiscali.it> 
-   Released under the terms of GPL (General Public Licence)	
+   Copyright (C) Andrea Merello 2004  <andreamrl at tiscali.it>
+   Released under the terms of GPL (General Public Licence)
 */
 
 #ifdef CONFIG_RTL8180_PM
@@ -17,28 +17,28 @@
 
 int rtl8180_save_state (struct pci_dev *dev, u32 state)
 {
-        printk(KERN_NOTICE "r8180 save state call (state %u).\n", state);
+	printk(KERN_NOTICE "r8180 save state call (state %u).\n", state);
 	return(-EAGAIN);
 }
 
 
 int rtl8180_suspend (struct pci_dev *dev, u32 state)
 {
-        printk(KERN_NOTICE "r8180 suspend call (state %u).\n", state);
+	printk(KERN_NOTICE "r8180 suspend call (state %u).\n", state);
 	return(-EAGAIN);
 }
 
 
 int rtl8180_resume (struct pci_dev *dev)
 {
-        printk(KERN_NOTICE "r8180 resume call.\n");
+	printk(KERN_NOTICE "r8180 resume call.\n");
 	return(-EAGAIN);
 }
 
 
 int rtl8180_enable_wake (struct pci_dev *dev, u32 state, int enable)
 {
-        printk(KERN_NOTICE "r8180 enable wake call (state %u, enable %d).\n", 
+	printk(KERN_NOTICE "r8180 enable wake call (state %u, enable %d).\n",
 	       state, enable);
 	return(-EAGAIN);
 }
diff --git a/drivers/staging/rtl8192u/r8180_pm.h b/drivers/staging/rtl8192u/r8180_pm.h
index 4173164..52d6fba 100644
--- a/drivers/staging/rtl8192u/r8180_pm.h
+++ b/drivers/staging/rtl8192u/r8180_pm.h
@@ -1,13 +1,13 @@
-/* 
-        Power management interface routines. 
+/*
+	Power management interface routines.
 	Written by Mariusz Matuszek.
-	This code is currently just a placeholder for later work and 
+	This code is currently just a placeholder for later work and
 	does not do anything useful.
 
 	This is part of rtl8180 OpenSource driver.
-	Copyright (C) Andrea Merello 2004  <andreamrl at tiscali.it> 
+	Copyright (C) Andrea Merello 2004  <andreamrl at tiscali.it>
 	Released under the terms of GPL (General Public Licence)
-	
+
 */
 
 #ifdef CONFIG_RTL8180_PM
diff --git a/drivers/staging/rtl8192u/r8190_rtl8256.c b/drivers/staging/rtl8192u/r8190_rtl8256.c
index 12f250b..74ff337 100644
--- a/drivers/staging/rtl8192u/r8190_rtl8256.c
+++ b/drivers/staging/rtl8192u/r8190_rtl8256.c
@@ -1,12 +1,12 @@
 /*
   This is part of the rtl8192 driver
   released under the GPL (See file COPYING for details).
-  
-  This files contains programming code for the rtl8256 
+
+  This files contains programming code for the rtl8256
   radio frontend.
-  
+
   *Many* thanks to Realtek Corp. for their great support!
-  
+
 */
 
 #include "r8192U.h"
@@ -16,8 +16,8 @@
 #include "r8190_rtl8256.h"
 
 /*--------------------------------------------------------------------------
- * Overview:   	set RF band width (20M or 40M) 
- * Input:       struct net_device*	dev 				
+ * Overview:   	set RF band width (20M or 40M)
+ * Input:       struct net_device*	dev
  * 		WIRELESS_BANDWIDTH_E	Bandwidth	//20M or 40M
  * Output:      NONE
  * Return:      NONE
@@ -31,14 +31,14 @@ void PHY_SetRF8256Bandwidth(struct net_device* dev , HT_CHANNEL_WIDTH Bandwidth)
 	//for(eRFPath = RF90_PATH_A; eRFPath <pHalData->NumTotalRFPath; eRFPath++)
 	for(eRFPath = 0; eRFPath <RF90_PATH_MAX; eRFPath++)
 	{
-		if (!rtl8192_phy_CheckIsLegalRFPath(dev, eRFPath))		
+		if (!rtl8192_phy_CheckIsLegalRFPath(dev, eRFPath))
 				continue;
-		
+
 		switch(Bandwidth)
 		{
 			case HT_CHANNEL_WIDTH_20:
 				if(priv->card_8192_version == VERSION_819xU_A || priv->card_8192_version == VERSION_819xU_B)// 8256 D-cut, E-cut, xiong: consider it later!
-				{	
+				{
 					rtl8192_phy_SetRFReg(dev, (RF90_RADIO_PATH_E)eRFPath, 0x0b, bMask12Bits, 0x100); //phy para:1ba
 					rtl8192_phy_SetRFReg(dev, (RF90_RADIO_PATH_E)eRFPath, 0x2c, bMask12Bits, 0x3d7);
 					rtl8192_phy_SetRFReg(dev, (RF90_RADIO_PATH_E)eRFPath, 0x0e, bMask12Bits, 0x021);
@@ -54,14 +54,14 @@ void PHY_SetRF8256Bandwidth(struct net_device* dev , HT_CHANNEL_WIDTH Bandwidth)
 				break;
 			case HT_CHANNEL_WIDTH_20_40:
 				if(priv->card_8192_version == VERSION_819xU_A ||priv->card_8192_version == VERSION_819xU_B)// 8256 D-cut, E-cut, xiong: consider it later!
-				{	
+				{
 					rtl8192_phy_SetRFReg(dev, (RF90_RADIO_PATH_E)eRFPath, 0x0b, bMask12Bits, 0x300); //phy para:3ba
 					rtl8192_phy_SetRFReg(dev, (RF90_RADIO_PATH_E)eRFPath, 0x2c, bMask12Bits, 0x3df);
 					rtl8192_phy_SetRFReg(dev, (RF90_RADIO_PATH_E)eRFPath, 0x0e, bMask12Bits, 0x0a1);
 
 					//cosa add for sd3's request 01/23/2008
 					if(priv->chan == 3 || priv->chan == 9) //I need to set priv->chan whenever current channel changes
-						rtl8192_phy_SetRFReg(dev, (RF90_RADIO_PATH_E)eRFPath, 0x14, bMask12Bits, 0x59b); 
+						rtl8192_phy_SetRFReg(dev, (RF90_RADIO_PATH_E)eRFPath, 0x14, bMask12Bits, 0x59b);
 					else
 						rtl8192_phy_SetRFReg(dev, (RF90_RADIO_PATH_E)eRFPath, 0x14, bMask12Bits, 0x5ab);
 				}
@@ -75,32 +75,32 @@ void PHY_SetRF8256Bandwidth(struct net_device* dev , HT_CHANNEL_WIDTH Bandwidth)
 			default:
 				RT_TRACE(COMP_ERR, "PHY_SetRF8256Bandwidth(): unknown Bandwidth: %#X\n",Bandwidth );
 				break;
-				
+
 		}
 	}
 	return;
 }
 /*--------------------------------------------------------------------------
  * Overview:    Interface to config 8256
- * Input:       struct net_device*	dev 				
+ * Input:       struct net_device*	dev
  * Output:      NONE
  * Return:      NONE
  *---------------------------------------------------------------------------*/
 void PHY_RF8256_Config(struct net_device* dev)
 {
-	struct r8192_priv *priv = ieee80211_priv(dev);	
+	struct r8192_priv *priv = ieee80211_priv(dev);
 	// Initialize general global value
 	//
 	// TODO: Extend RF_PATH_C and RF_PATH_D in the future
 	priv->NumTotalRFPath = RTL819X_TOTAL_RF_PATH;
 	// Config BB and RF
 	phy_RF8256_Config_ParaFile(dev);
-	
+
 	return;
 }
 /*--------------------------------------------------------------------------
  * Overview:    Interface to config 8256
- * Input:       struct net_device*	dev 				
+ * Input:       struct net_device*	dev
  * Output:      NONE
  * Return:      NONE
  *---------------------------------------------------------------------------*/
@@ -124,14 +124,14 @@ void phy_RF8256_Config_ParaFile(struct net_device* dev)
 	//3//-----------------------------------------------------------------
 	for(eRFPath = (RF90_RADIO_PATH_E)RF90_PATH_A; eRFPath <priv->NumTotalRFPath; eRFPath++)
 	{
-		if (!rtl8192_phy_CheckIsLegalRFPath(dev, eRFPath))		
+		if (!rtl8192_phy_CheckIsLegalRFPath(dev, eRFPath))
 				continue;
-		
+
 		pPhyReg = &priv->PHYRegDef[eRFPath];
 
 		// Joseph test for shorten RF config
 	//	pHalData->RfReg0Value[eRFPath] =  rtl8192_phy_QueryRFReg(dev, (RF90_RADIO_PATH_E)eRFPath, rGlobalCtrl, bMaskDWord);
-		
+
 		/*----Store original RFENV control type----*/
 		switch(eRFPath)
 		{
@@ -145,9 +145,9 @@ void phy_RF8256_Config_ParaFile(struct net_device* dev)
 			break;
 		}
 
-		/*----Set RF_ENV enable----*/		
+		/*----Set RF_ENV enable----*/
 		rtl8192_setBBreg(dev, pPhyReg->rfintfe, bRFSI_RFENV<<16, 0x1);
-		
+
 		/*----Set RF_ENV output high----*/
 		rtl8192_setBBreg(dev, pPhyReg->rfintfo, bRFSI_RFENV, 0x1);
 
@@ -177,7 +177,7 @@ void phy_RF8256_Config_ParaFile(struct net_device* dev)
 				RF3_Final_Value = rtl8192_phy_QueryRFReg(dev, (RF90_RADIO_PATH_E)eRFPath, RegOffSetToBeCheck, bMask12Bits);
 				RT_TRACE(COMP_RF, "RF %d %d register final value: %x\n", eRFPath, RegOffSetToBeCheck, RF3_Final_Value);
 				RetryTimes--;
-			}	
+			}
 			break;
 		case RF90_PATH_B:
 			while(RF3_Final_Value!=RegValueToBeCheck && RetryTimes!=0)
@@ -195,7 +195,7 @@ void phy_RF8256_Config_ParaFile(struct net_device* dev)
 				RF3_Final_Value = rtl8192_phy_QueryRFReg(dev, (RF90_RADIO_PATH_E)eRFPath, RegOffSetToBeCheck, bMask12Bits);
 				RT_TRACE(COMP_RF, "RF %d %d register final value: %x\n", eRFPath, RegOffSetToBeCheck, RF3_Final_Value);
 				RetryTimes--;
-			}				
+			}
 			break;
 		case RF90_PATH_D:
 			while(RF3_Final_Value!=RegValueToBeCheck && RetryTimes!=0)
@@ -204,7 +204,7 @@ void phy_RF8256_Config_ParaFile(struct net_device* dev)
 				RF3_Final_Value = rtl8192_phy_QueryRFReg(dev, (RF90_RADIO_PATH_E)eRFPath, RegOffSetToBeCheck, bMask12Bits);
 				RT_TRACE(COMP_RF, "RF %d %d register final value: %x\n", eRFPath, RegOffSetToBeCheck, RF3_Final_Value);
 				RetryTimes--;
-			}				
+			}
 			break;
 		}
 
@@ -220,18 +220,18 @@ void phy_RF8256_Config_ParaFile(struct net_device* dev)
 			rtl8192_setBBreg(dev, pPhyReg->rfintfs, bRFSI_RFENV<<16, u4RegValue);
 			break;
 		}
-	
+
 		if(ret){
 			RT_TRACE(COMP_ERR, "phy_RF8256_Config_ParaFile():Radio[%d] Fail!!", eRFPath);
 			goto phy_RF8256_Config_ParaFile_Fail;
 		}
-			
+
 	}
 
-	RT_TRACE(COMP_PHY, "PHY Initialization Success\n") ;	
+	RT_TRACE(COMP_PHY, "PHY Initialization Success\n") ;
 	return ;
-	
-phy_RF8256_Config_ParaFile_Fail:	
+
+phy_RF8256_Config_ParaFile_Fail:
 	RT_TRACE(COMP_ERR, "PHY Initialization failed\n") ;
 	return ;
 }
@@ -251,7 +251,7 @@ void PHY_SetRF8256CCKTxPower(struct net_device*	dev, u8	powerlevel)
 		else
 		TxAGC += priv->CckPwEnl;
 	}
-	
+
 	if(TxAGC > 0x24)
 		TxAGC = 0x24;
 	rtl8192_setBBreg(dev, rTxAGC_CCK_Mcs32, bTxAGCRateCCK, TxAGC);
@@ -260,7 +260,7 @@ void PHY_SetRF8256CCKTxPower(struct net_device*	dev, u8	powerlevel)
 
 void PHY_SetRF8256OFDMTxPower(struct net_device* dev, u8 powerlevel)
 {
-	struct r8192_priv *priv = ieee80211_priv(dev);	
+	struct r8192_priv *priv = ieee80211_priv(dev);
 	//Joseph TxPower for 8192 testing
 	u32 writeVal, powerBase0, powerBase1, writeVal_tmp;
 	u8 index = 0;
diff --git a/drivers/staging/rtl8192u/r8190_rtl8256.h b/drivers/staging/rtl8192u/r8190_rtl8256.h
index 37bf96d..5c1f650 100644
--- a/drivers/staging/rtl8192u/r8190_rtl8256.h
+++ b/drivers/staging/rtl8192u/r8190_rtl8256.h
@@ -2,12 +2,12 @@
   This is part of the rtl8180-sa2400 driver
   released under the GPL (See file COPYING for details).
   Copyright (c) 2005 Andrea Merello <andreamrl at tiscali.it>
-  
-  This files contains programming code for the rtl8256 
+
+  This files contains programming code for the rtl8256
   radio frontend.
-  
+
   *Many* thanks to Realtek Corp. for their great support!
-  
+
 */
 
 #ifndef RTL8225H
diff --git a/drivers/staging/rtl8192u/r8192U.h b/drivers/staging/rtl8192u/r8192U.h
index 6761305..51dca87 100644
--- a/drivers/staging/rtl8192u/r8192U.h
+++ b/drivers/staging/rtl8192u/r8192U.h
@@ -1,17 +1,17 @@
-/* 
+/*
    This is part of rtl8187 OpenSource driver.
-   Copyright (C) Andrea Merello 2004-2005  <andreamrl at tiscali.it> 
+   Copyright (C) Andrea Merello 2004-2005  <andreamrl at tiscali.it>
    Released under the terms of GPL (General Public Licence)
-   
-   Parts of this driver are based on the GPL part of the 
+
+   Parts of this driver are based on the GPL part of the
    official realtek driver
-   
-   Parts of this driver are based on the rtl8192 driver skeleton 
+
+   Parts of this driver are based on the rtl8192 driver skeleton
    from Patric Schenke & Andres Salomon
-   
+
    Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver
-   
-   We want to tanks the Authors of those projects and the Ndiswrapper 
+
+   We want to tanks the Authors of those projects and the Ndiswrapper
    project Authors.
 */
 
@@ -52,38 +52,38 @@
 #define MAX_KEY_LEN     61
 #define KEY_BUF_SIZE    5
 
-#define BIT0            0x00000001 
-#define BIT1            0x00000002 
-#define BIT2            0x00000004 
-#define BIT3            0x00000008 
-#define BIT4            0x00000010 
-#define BIT5            0x00000020 
-#define BIT6            0x00000040 
-#define BIT7            0x00000080 
-#define BIT8            0x00000100 
-#define BIT9            0x00000200 
-#define BIT10           0x00000400 
-#define BIT11           0x00000800 
-#define BIT12           0x00001000 
-#define BIT13           0x00002000 
-#define BIT14           0x00004000 
-#define BIT15           0x00008000 
-#define BIT16           0x00010000 
-#define BIT17           0x00020000 
-#define BIT18           0x00040000 
-#define BIT19           0x00080000 
-#define BIT20           0x00100000 
-#define BIT21           0x00200000 
-#define BIT22           0x00400000 
-#define BIT23           0x00800000 
-#define BIT24           0x01000000 
-#define BIT25           0x02000000 
-#define BIT26           0x04000000 
-#define BIT27           0x08000000 
-#define BIT28           0x10000000 
-#define BIT29           0x20000000 
-#define BIT30           0x40000000 
-#define BIT31           0x80000000 
+#define BIT0            0x00000001
+#define BIT1            0x00000002
+#define BIT2            0x00000004
+#define BIT3            0x00000008
+#define BIT4            0x00000010
+#define BIT5            0x00000020
+#define BIT6            0x00000040
+#define BIT7            0x00000080
+#define BIT8            0x00000100
+#define BIT9            0x00000200
+#define BIT10           0x00000400
+#define BIT11           0x00000800
+#define BIT12           0x00001000
+#define BIT13           0x00002000
+#define BIT14           0x00004000
+#define BIT15           0x00008000
+#define BIT16           0x00010000
+#define BIT17           0x00020000
+#define BIT18           0x00040000
+#define BIT19           0x00080000
+#define BIT20           0x00100000
+#define BIT21           0x00200000
+#define BIT22           0x00400000
+#define BIT23           0x00800000
+#define BIT24           0x01000000
+#define BIT25           0x02000000
+#define BIT26           0x04000000
+#define BIT27           0x08000000
+#define BIT28           0x10000000
+#define BIT29           0x20000000
+#define BIT30           0x40000000
+#define BIT31           0x80000000
 
 // Rx smooth factor
 #define	Rx_Smooth_Factor		20
@@ -117,14 +117,14 @@ do { if(rt_global_debug_component & component) \
 #define COMP_TURBO				BIT10	// For Turbo Mode related. By Annie, 2005-10-21.
 #define COMP_QOS				BIT11	// For QoS.
 #define COMP_RATE				BIT12	// For Rate Adaptive mechanism, 2006.07.02, by rcnjko.
-#define COMP_RM					BIT13	// For Radio Measurement. 
+#define COMP_RM					BIT13	// For Radio Measurement.
 #define COMP_DIG				BIT14	// For DIG, 2006.09.25, by rcnjko.
-#define COMP_PHY	 			BIT15	
+#define COMP_PHY				BIT15
 #define COMP_CH					BIT16	//channel setting debug
-#define COMP_TXAGC				BIT17	// For Tx power, 060928, by rcnjko. 
-#define COMP_HIPWR				BIT18	// For High Power Mechanism, 060928, by rcnjko. 
-#define COMP_HALDM				BIT19	// For HW Dynamic Mechanism, 061010, by rcnjko. 
-#define COMP_SEC			        BIT20	// Event handling
+#define COMP_TXAGC				BIT17	// For Tx power, 060928, by rcnjko.
+#define COMP_HIPWR				BIT18	// For High Power Mechanism, 060928, by rcnjko.
+#define COMP_HALDM				BIT19	// For HW Dynamic Mechanism, 061010, by rcnjko.
+#define COMP_SEC				BIT20	// Event handling
 #define COMP_LED				BIT21	// For LED.
 #define COMP_RF					BIT22	// For RF.
 //1!!!!!!!!!!!!!!!!!!!!!!!!!!!
@@ -136,7 +136,7 @@ do { if(rt_global_debug_component & component) \
 #define COMP_HT					BIT25	// For 802.11n HT related information. by Emily 2006-8-11
 #define COMP_AMSDU				BIT26	// For A-MSDU Debugging
 
-#define COMP_SCAN				BIT27	
+#define COMP_SCAN				BIT27
 //#define COMP_RESET				BIT28
 #define COMP_DOWN				BIT29  //for rm driver module
 #define COMP_RESET				BIT30  //for silent reset
@@ -146,26 +146,26 @@ do { if(rt_global_debug_component & component) \
 #define RTL819x_DEBUG
 #ifdef RTL819x_DEBUG
 #define assert(expr) \
-        if (!(expr)) {                                  \
-                printk( "Assertion failed! %s,%s,%s,line=%d\n", \
-                #expr,__FILE__,__FUNCTION__,__LINE__);          \
-        }
+	if (!(expr)) {                                  \
+		printk( "Assertion failed! %s,%s,%s,line=%d\n", \
+		#expr,__FILE__,__FUNCTION__,__LINE__);          \
+	}
 //wb added to debug out data buf
 //if you want print DATA buffer related BA, please set ieee80211_debug_level to DATA|BA
 #define RT_DEBUG_DATA(level, data, datalen)      \
-        do{ if ((rt_global_debug_component & (level)) == (level))   \
-                {       \
-                        int i;                                  \
-                        u8* pdata = (u8*) data;                 \
-                        printk(KERN_DEBUG RTL819xU_MODULE_NAME ": %s()\n", __FUNCTION__);   \
-                        for(i=0; i<(int)(datalen); i++)                 \
-                        {                                               \
-                                printk("%2x ", pdata[i]);               \
-                                if ((i+1)%16 == 0) printk("\n");        \
-                        }                               \
-                        printk("\n");                   \
-                }                                       \
-        } while (0)  
+	do{ if ((rt_global_debug_component & (level)) == (level))   \
+		{       \
+			int i;                                  \
+			u8* pdata = (u8*) data;                 \
+			printk(KERN_DEBUG RTL819xU_MODULE_NAME ": %s()\n", __FUNCTION__);   \
+			for(i=0; i<(int)(datalen); i++)                 \
+			{                                               \
+				printk("%2x ", pdata[i]);               \
+				if ((i+1)%16 == 0) printk("\n");        \
+			}                               \
+			printk("\n");                   \
+		}                                       \
+	} while (0)
 #else
 #define assert(expr) do {} while (0)
 #define RT_DEBUG_DATA(level, data, datalen) do {} while(0)
@@ -224,42 +224,42 @@ do { if(rt_global_debug_component & component) \
 
 /* for rtl819x */
 typedef struct _tx_desc_819x_usb {
-        //DWORD 0
-        u16	PktSize;
-        u8	Offset;
-        u8	Reserved0:3;
-        u8	CmdInit:1;
-        u8	LastSeg:1;
-        u8	FirstSeg:1;
-        u8	LINIP:1;
-        u8	OWN:1;
-
-        //DWORD 1
-        u8	TxFWInfoSize;
-        u8	RATid:3;
-        u8	DISFB:1;
-        u8	USERATE:1;
-        u8	MOREFRAG:1;
-        u8	NoEnc:1;
-        u8	PIFS:1;
-        u8	QueueSelect:5;
-        u8	NoACM:1;
-        u8	Reserved1:2;
-        u8	SecCAMID:5;
-        u8	SecDescAssign:1;
-        u8	SecType:2;
-
-        //DWORD 2
-        u16	TxBufferSize;
-        //u16 Reserved2;
-        u8	ResvForPaddingLen:7;
-        u8	Reserved3:1;
-        u8	Reserved4;
-
-        //DWORD 3, 4, 5
-        u32	Reserved5;
-        u32	Reserved6;
-        u32	Reserved7;
+	//DWORD 0
+	u16	PktSize;
+	u8	Offset;
+	u8	Reserved0:3;
+	u8	CmdInit:1;
+	u8	LastSeg:1;
+	u8	FirstSeg:1;
+	u8	LINIP:1;
+	u8	OWN:1;
+
+	//DWORD 1
+	u8	TxFWInfoSize;
+	u8	RATid:3;
+	u8	DISFB:1;
+	u8	USERATE:1;
+	u8	MOREFRAG:1;
+	u8	NoEnc:1;
+	u8	PIFS:1;
+	u8	QueueSelect:5;
+	u8	NoACM:1;
+	u8	Reserved1:2;
+	u8	SecCAMID:5;
+	u8	SecDescAssign:1;
+	u8	SecType:2;
+
+	//DWORD 2
+	u16	TxBufferSize;
+	//u16 Reserved2;
+	u8	ResvForPaddingLen:7;
+	u8	Reserved3:1;
+	u8	Reserved4;
+
+	//DWORD 3, 4, 5
+	u32	Reserved5;
+	u32	Reserved6;
+	u32	Reserved7;
 }tx_desc_819x_usb, *ptx_desc_819x_usb;
 
 #ifdef USB_TX_DRIVER_AGGREGATION_ENABLE
@@ -290,7 +290,7 @@ typedef struct _tx_desc_819x_usb_aggr_subframe {
 
 
 typedef struct _tx_desc_cmd_819x_usb {
-        //DWORD 0
+	//DWORD 0
 	u16	Reserved0;
 	u8	Reserved1;
 	u8	Reserved2:3;
@@ -300,17 +300,17 @@ typedef struct _tx_desc_cmd_819x_usb {
 	u8	LINIP:1;
 	u8	OWN:1;
 
-        //DOWRD 1
+	//DOWRD 1
 	//u32	Reserved3;
 	u8	TxFWInfoSize;
 	u8	Reserved3;
 	u8	QueueSelect;
 	u8	Reserved4;
 
-        //DOWRD 2
+	//DOWRD 2
 	u16 	TxBufferSize;
 	u16	Reserved5;
-	
+
        //DWORD 3,4,5
 	//u32	TxBufferAddr;
 	//u32	NextDescAddress;
@@ -321,34 +321,34 @@ typedef struct _tx_desc_cmd_819x_usb {
 
 
 typedef struct _tx_fwinfo_819x_usb {
-        //DOWRD 0
-        u8		TxRate:7;
-        u8		CtsEnable:1;
-        u8		RtsRate:7;
-        u8		RtsEnable:1;
-        u8		TxHT:1;
-        u8		Short:1;                //Short PLCP for CCK, or short GI for 11n MCS
-        u8		TxBandwidth:1;          // This is used for HT MCS rate only.
-        u8		TxSubCarrier:2;         // This is used for legacy OFDM rate only.
-        u8		STBC:2;
-        u8		AllowAggregation:1;
-        u8		RtsHT:1;                //Interpre RtsRate field as high throughput data rate
-        u8		RtsShort:1;             //Short PLCP for CCK, or short GI for 11n MCS
-        u8		RtsBandwidth:1;         // This is used for HT MCS rate only.
-        u8		RtsSubcarrier:2;        // This is used for legacy OFDM rate only.
-        u8		RtsSTBC:2;
-        u8		EnableCPUDur:1;         //Enable firmware to recalculate and assign packet duration
-
-        //DWORD 1
-        u32		RxMF:2;
-        u32		RxAMD:3;
-        u32		TxPerPktInfoFeedback:1;//1 indicate Tx info gathtered by firmware and returned by Rx Cmd
-        u32		Reserved1:2;
-        u32		TxAGCOffSet:4;
-        u32		TxAGCSign:1;
-        u32		Tx_INFO_RSVD:6;
+	//DOWRD 0
+	u8		TxRate:7;
+	u8		CtsEnable:1;
+	u8		RtsRate:7;
+	u8		RtsEnable:1;
+	u8		TxHT:1;
+	u8		Short:1;                //Short PLCP for CCK, or short GI for 11n MCS
+	u8		TxBandwidth:1;          // This is used for HT MCS rate only.
+	u8		TxSubCarrier:2;         // This is used for legacy OFDM rate only.
+	u8		STBC:2;
+	u8		AllowAggregation:1;
+	u8		RtsHT:1;                //Interpre RtsRate field as high throughput data rate
+	u8		RtsShort:1;             //Short PLCP for CCK, or short GI for 11n MCS
+	u8		RtsBandwidth:1;         // This is used for HT MCS rate only.
+	u8		RtsSubcarrier:2;        // This is used for legacy OFDM rate only.
+	u8		RtsSTBC:2;
+	u8		EnableCPUDur:1;         //Enable firmware to recalculate and assign packet duration
+
+	//DWORD 1
+	u32		RxMF:2;
+	u32		RxAMD:3;
+	u32		TxPerPktInfoFeedback:1;//1 indicate Tx info gathtered by firmware and returned by Rx Cmd
+	u32		Reserved1:2;
+	u32		TxAGCOffSet:4;
+	u32		TxAGCSign:1;
+	u32		Tx_INFO_RSVD:6;
 	u32		PacketID:13;
-        //u32                Reserved;
+	//u32                Reserved;
 }tx_fwinfo_819x_usb, *ptx_fwinfo_819x_usb;
 
 typedef struct rtl8192_rx_info {
@@ -434,16 +434,16 @@ typedef struct rx_drvinfo_819x_usb{
 #define MAX_802_11_HEADER_LENGTH        (40 + MAX_FIRMWARE_INFORMATION_SIZE)
 #define ENCRYPTION_MAX_OVERHEAD		128
 #define	USB_HWDESC_HEADER_LEN		sizeof(tx_desc_819x_usb)
-#define TX_PACKET_SHIFT_BYTES 	  	(USB_HWDESC_HEADER_LEN + sizeof(tx_fwinfo_819x_usb)) 
+#define TX_PACKET_SHIFT_BYTES 		(USB_HWDESC_HEADER_LEN + sizeof(tx_fwinfo_819x_usb))
 #define MAX_FRAGMENT_COUNT		8
 #ifdef RTL8192U
 #ifdef USB_TX_DRIVER_AGGREGATION_ENABLE
 #define MAX_TRANSMIT_BUFFER_SIZE			32000
 #else
 #define MAX_TRANSMIT_BUFFER_SIZE			8000
-#endif	
+#endif
 #else
-#define MAX_TRANSMIT_BUFFER_SIZE  	(1600+(MAX_802_11_HEADER_LENGTH+ENCRYPTION_MAX_OVERHEAD)*MAX_FRAGMENT_COUNT) 
+#define MAX_TRANSMIT_BUFFER_SIZE  	(1600+(MAX_802_11_HEADER_LENGTH+ENCRYPTION_MAX_OVERHEAD)*MAX_FRAGMENT_COUNT)
 #endif
 #ifdef USB_TX_DRIVER_AGGREGATION_ENABLE
 #define TX_PACKET_DRVAGGR_SUBFRAME_SHIFT_BYTES (sizeof(tx_desc_819x_usb_aggr_subframe) + sizeof(tx_fwinfo_819x_usb))
@@ -467,7 +467,7 @@ typedef enum _rtl819xUsb_loopback{
 /* due to rtl8192 firmware */
 typedef enum _desc_packet_type_e{
 	DESC_PACKET_TYPE_INIT = 0,
-	DESC_PACKET_TYPE_NORMAL = 1,	
+	DESC_PACKET_TYPE_NORMAL = 1,
 }desc_packet_type_e;
 
 typedef enum _firmware_source{
@@ -578,18 +578,18 @@ typedef struct buffer
 {
 	struct buffer *next;
 	u32 *buf;
-	
+
 } buffer;
 
 typedef struct rtl_reg_debug{
-        unsigned int  cmd;
-        struct {
-                unsigned char type;
-                unsigned char addr;
-                unsigned char page;
-                unsigned char length;
-        } head;
-        unsigned char buf[0xff];
+	unsigned int  cmd;
+	struct {
+		unsigned char type;
+		unsigned char addr;
+		unsigned char page;
+		unsigned char length;
+	} head;
+	unsigned char buf[0xff];
 }rtl_reg_debug;
 
 
@@ -730,7 +730,7 @@ typedef struct Stats
 } Stats;
 
 
-// Bandwidth Offset                     	
+// Bandwidth Offset
 #define HAL_PRIME_CHNL_OFFSET_DONT_CARE		0
 #define HAL_PRIME_CHNL_OFFSET_LOWER			1
 #define HAL_PRIME_CHNL_OFFSET_UPPER			2
@@ -739,7 +739,7 @@ typedef struct Stats
 
 typedef struct 	ChnlAccessSetting {
 	u16 SIFS_Timer;
-	u16 DIFS_Timer; 
+	u16 DIFS_Timer;
 	u16 SlotTimeTimer;
 	u16 EIFS_Timer;
 	u16 CWminIndex;
@@ -757,8 +757,8 @@ typedef struct _BB_REGISTER_DEFINITION{
 	u32 rfHSSIPara1; 		// wire parameter control1 : //		0x820~0x823,0x828~0x82b, 0x830~0x833, 0x838~0x83b [16 bytes]
 	u32 rfHSSIPara2; 		// wire parameter control2 : //		0x824~0x827,0x82c~0x82f, 0x834~0x837, 0x83c~0x83f [16 bytes]
 	u32 rfSwitchControl; 	//Tx Rx antenna control : //		0x858~0x85f [16 bytes]
-	u32 rfAGCControl1; 	//AGC parameter control1 : //		0xc50~0xc53,0xc58~0xc5b, 0xc60~0xc63, 0xc68~0xc6b [16 bytes] 
-	u32 rfAGCControl2; 	//AGC parameter control2 : //		0xc54~0xc57,0xc5c~0xc5f, 0xc64~0xc67, 0xc6c~0xc6f [16 bytes] 
+	u32 rfAGCControl1; 	//AGC parameter control1 : //		0xc50~0xc53,0xc58~0xc5b, 0xc60~0xc63, 0xc68~0xc6b [16 bytes]
+	u32 rfAGCControl2; 	//AGC parameter control2 : //		0xc54~0xc57,0xc5c~0xc5f, 0xc64~0xc67, 0xc6c~0xc6f [16 bytes]
 	u32 rfRxIQImbalance; 	//OFDM Rx IQ imbalance matrix : //		0xc14~0xc17,0xc1c~0xc1f, 0xc24~0xc27, 0xc2c~0xc2f [16 bytes]
 	u32 rfRxAFE;  			//Rx IQ DC ofset and Rx digital filter, Rx DC notch filter : //		0xc10~0xc13,0xc18~0xc1b, 0xc20~0xc23, 0xc28~0xc2b [16 bytes]
 	u32 rfTxIQImbalance; 	//OFDM Tx IQ imbalance matrix //		0xc80~0xc83,0xc88~0xc8b, 0xc90~0xc93, 0xc98~0xc9b [16 bytes]
@@ -767,19 +767,19 @@ typedef struct _BB_REGISTER_DEFINITION{
 }BB_REGISTER_DEFINITION_T, *PBB_REGISTER_DEFINITION_T;
 
 typedef enum _RT_RF_TYPE_819xU{
-        RF_TYPE_MIN = 0,
-        RF_8225,
-        RF_8256,
-        RF_8258,
-        RF_PSEUDO_11N = 4,
+	RF_TYPE_MIN = 0,
+	RF_8225,
+	RF_8256,
+	RF_8258,
+	RF_PSEUDO_11N = 4,
 }RT_RF_TYPE_819xU, *PRT_RF_TYPE_819xU;
 
 typedef struct _rate_adaptive
 {
 	u8				rate_adaptive_disabled;
 	u8				ratr_state;
-	u16				reserve;	
-	
+	u16				reserve;
+
 	u32				high_rssi_thresh_for_ra;
 	u32				high2low_rssi_thresh_for_ra;
 	u8				low2high_rssi_thresh_for_ra40M;
@@ -795,7 +795,7 @@ typedef struct _rate_adaptive
 	u32				ping_rssi_ratr;	//cosa add for test
 	u32				ping_rssi_thresh_for_ra;//cosa add for test
 	u32				last_ratr;
-	
+
 } rate_adaptive, *prate_adaptive;
 
 #define TxBBGainTableLength 37
@@ -809,7 +809,7 @@ typedef struct _txbbgain_struct
 
 typedef struct _ccktxbbgain_struct
 {
-	//The Value is from a22 to a29 one Byte one time is much Safer 
+	//The Value is from a22 to a29 one Byte one time is much Safer
 	u8	ccktxbb_valuearray[8];
 } ccktxbbgain_struct,*pccktxbbgain_struct;
 
@@ -826,8 +826,8 @@ typedef struct _init_gain
 //by amy 0606
 
 typedef struct _phy_ofdm_rx_status_report_819xusb
-{	
-	u8	trsw_gain_X[4];	
+{
+	u8	trsw_gain_X[4];
 	u8	pwdb_all;
 	u8	cfosho_X[4];
 	u8	cfotail_X[4];
@@ -847,16 +847,16 @@ typedef struct _phy_cck_rx_status_report_819xusb
 	/* For CCK rate descriptor. This is a unsigned 8:1 variable. LSB bit presend
 	   0.5. And MSB 7 bts presend a signed value. Range from -64~+63.5. */
 	u8	adc_pwdb_X[4];
-	u8	sq_rpt;	
+	u8	sq_rpt;
 	u8	cck_agc_rpt;
 }phy_sts_cck_819xusb_t;
 
 
 typedef struct _phy_ofdm_rx_status_rxsc_sgien_exintfflag{
 	u8			reserved:4;
-	u8			rxsc:2;	
-	u8			sgi_en:1;	
-	u8			ex_intf_flag:1;	
+	u8			rxsc:2;
+	u8			sgi_en:1;
+	u8			ex_intf_flag:1;
 }phy_ofdm_rx_status_rxsc_sgien_exintfflag;
 
 typedef enum _RT_CUSTOMER_ID
@@ -867,7 +867,7 @@ typedef enum _RT_CUSTOMER_ID
 	RT_CID_8187_HW_LED = 3,
 	RT_CID_8187_NETGEAR = 4,
 	RT_CID_WHQL = 5,
-	RT_CID_819x_CAMEO  = 6, 
+	RT_CID_819x_CAMEO  = 6,
 	RT_CID_819x_RUNTOP = 7,
 	RT_CID_819x_Senao = 8,
 	RT_CID_TOSHIBA = 9,	// Merge by Jacken, 2008/01/31.
@@ -917,11 +917,11 @@ typedef struct r8192_priv
 	u8  eeprom_CustomerID;
 	u8  eeprom_ChannelPlan;
 	RT_CUSTOMER_ID CustomerID;
-	LED_STRATEGY_8190	LedStrategy;  
-	u8  txqueue_to_outpipemap[9];	
+	LED_STRATEGY_8190	LedStrategy;
+	u8  txqueue_to_outpipemap[9];
 	int irq;
 	struct ieee80211_device *ieee80211;
-	
+
 	short card_8192; /* O: rtl8192, 1:rtl8185 V B/C, 2:rtl8185 V D */
 	u8 card_8192_version; /* if TCR reports card V B/C this discriminates */
 //	short phy_ver; /* meaningful for rtl8225 1:A 2:B 3:C */
@@ -929,14 +929,14 @@ typedef struct r8192_priv
 	enum card_type {PCI,MINIPCI,CARDBUS,USB}card_type;
 	short hw_plcp_len;
 	short plcp_preamble_mode;
-		
+
 	spinlock_t irq_lock;
 //	spinlock_t irq_th_lock;
 	spinlock_t tx_lock;
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16))
 	struct semaphore mutex;
 #else
-        struct mutex mutex;
+	struct mutex mutex;
 #endif
 	//spinlock_t rf_lock; //used to lock rf write operation added by wb
 
@@ -947,7 +947,7 @@ typedef struct r8192_priv
 	short sens;
 	short max_sens;
 
-	
+
 	//	u8 chtxpwr[15]; //channels from 1 to 14, 0 not used
 //	u8 chtxpwr_ofdm[15]; //channels from 1 to 14, 0 not used
 //	u8 cck_txpwr_base;
@@ -956,7 +956,7 @@ typedef struct r8192_priv
 	short up;
 	short crcmon; //if 1 allow bad crc frame reception in monitor mode
 //	short prism_hdr;
-	
+
 //	struct timer_list scan_timer;
 	/*short scanpending;
 	short stopscan;*/
@@ -966,7 +966,7 @@ typedef struct r8192_priv
 	struct semaphore wx_sem;
 	struct semaphore rf_sem; //used to lock rf write operation added by wb, modified by david
 //	short hw_wep;
-		
+
 //	short digphy;
 //	short antb;
 //	short diversity;
@@ -974,19 +974,19 @@ typedef struct r8192_priv
 //	short rcr_csense;
 	u8 rf_type; //0 means 1T2R, 1 means 2T4R
 	RT_RF_TYPE_819xU rf_chip;
-	
+
 //	u32 key0[4];
 	short (*rf_set_sens)(struct net_device *dev,short sens);
 	u8 (*rf_set_chan)(struct net_device *dev,u8 ch);
 	void (*rf_close)(struct net_device *dev);
 	void (*rf_init)(struct net_device *dev);
 	//short rate;
-	short promisc;	
+	short promisc;
 	/*stats*/
 	struct Stats stats;
 	struct iw_statistics wstats;
 	struct proc_dir_entry *dir_dev;
-	
+
 	/*RX stuff*/
 //	u32 *rxring;
 //	u32 *rxringtail;
@@ -1000,8 +1000,8 @@ typedef struct r8192_priv
 	atomic_t irt_counter;//count for irq_rx_tasklet
 #endif
 #ifdef JACKSON_NEW_RX
-        struct sk_buff **pp_rxskb;
-        int     rx_inx;
+	struct sk_buff **pp_rxskb;
+	int     rx_inx;
 #endif
 
 /* modified by davad for Rx process */
@@ -1035,13 +1035,13 @@ typedef struct r8192_priv
 	u8	AcmControl;
 
 	u8	RFProgType;
-	
+
 	u8 retry_data;
 	u8 retry_rts;
 	u16 rts;
 
 	struct 	ChnlAccessSetting  ChannelAccessSetting;
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)	
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
 	struct work_struct reset_wq;
 #else
 	struct tq_struct reset_wq;
@@ -1067,7 +1067,7 @@ typedef struct r8192_priv
 	u8 EEPROMTxPowerLevelCCK_V1[3];
 	u8 EEPROMTxPowerLevelOFDM24G[3]; // OFDM 2.4G channel 1~14
 	u8 EEPROMTxPowerLevelOFDM5G[24];	// OFDM 5G
-	
+
 /*PHY related*/
 	BB_REGISTER_DEFINITION_T	PHYRegDef[4];	//Radio A/B/C/D
 	// Read/write are allow for following hardware information variables
@@ -1087,7 +1087,7 @@ typedef struct r8192_priv
 	u8	bCckHighPower;
 	long	undecorated_smoothed_pwdb;
 
-	//for set channel 
+	//for set channel
 	u8	SwChnlInProgress;
 	u8 	SwChnlStage;
 	u8	SwChnlStep;
@@ -1101,12 +1101,12 @@ typedef struct r8192_priv
 	// We save RF reg0 in this variable to reduce RF reading.
 	//
 	u32					RfReg0Value[4];
-	u8 					NumTotalRFPath;	
+	u8 					NumTotalRFPath;
 	bool 				brfpath_rxenable[4];
 	//RF set related
 	bool				SetRFPowerStateInProgress;
 //+by amy 080507
-	struct timer_list watch_dog_timer;	
+	struct timer_list watch_dog_timer;
 
 //+by amy 080515 for dynamic mechenism
 	//Add by amy Tx Power Control for Near/Far Range 2008/05/15
@@ -1115,9 +1115,9 @@ typedef struct r8192_priv
 	bool	bDynamicTxLowPower;  // Tx low power state
 	bool	bLastDTPFlag_High;
 	bool	bLastDTPFlag_Low;
-	
+
 	bool	bstore_last_dtpflag;
-	bool	bstart_txctrl_bydtp;   //Define to discriminate on High power State or on sitesuvey to change Tx gain index	
+	bool	bstart_txctrl_bydtp;   //Define to discriminate on High power State or on sitesuvey to change Tx gain index
 	//Add by amy for Rate Adaptive
 	rate_adaptive rate_adaptive;
 	//Add by amy for TX power tracking
@@ -1161,7 +1161,7 @@ typedef struct r8192_priv
 	u8	framesync;
 	u32 	framesyncC34;
 	u8   	framesyncMonitor;
-        	//Added by amy 080516  for RX related
+		//Added by amy 080516  for RX related
 	u16 	nrxAMPDU_size;
 	u8 	nrxAMPDU_aggr_num;
 
@@ -1190,15 +1190,15 @@ typedef struct r8192_priv
 	bool		bResetInProgress;
 	bool		force_reset;
 	u8		InitialGainOperateType;
-	
+
 	u16		SifsTime;
-	
+
 	//define work item by amy 080526
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)  
-        
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)    
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
 	struct delayed_work update_beacon_wq;
-	struct delayed_work watch_dog_wq;    
+	struct delayed_work watch_dog_wq;
 	struct delayed_work txpower_tracking_wq;
 	struct delayed_work rfpath_check_wq;
 	struct delayed_work gpio_change_rf_wq;
@@ -1226,9 +1226,9 @@ typedef struct r8192_priv
 // for rtl8187
 // now mirging to rtl8187B
 /*
-typedef enum{ 
+typedef enum{
 	LOW_PRIORITY = 0x02,
-	NORM_PRIORITY 
+	NORM_PRIORITY
 	} priority_t;
 */
 //for rtl8187B
@@ -1237,7 +1237,7 @@ typedef enum{
 	//RSVD0,
 	//RSVD1,
 	LOW_PRIORITY,
-	NORM_PRIORITY, 
+	NORM_PRIORITY,
 	VO_PRIORITY,
 	VI_PRIORITY, //0x05
 	BE_PRIORITY,
@@ -1286,7 +1286,7 @@ typedef	union _ECW{
 //
 typedef	union _ACI_AIFSN{
 	u8	charData;
-	
+
 	struct
 	{
 		u8	AIFSN:4;
@@ -1316,7 +1316,7 @@ typedef	union _AC_PARAM{
 #ifdef JOHN_HWSEC
 struct ssid_thread {
 	struct net_device *dev;
-       	u8 name[IW_ESSID_MAX_SIZE + 1];
+	u8 name[IW_ESSID_MAX_SIZE + 1];
 };
 #endif
 
diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c
index b173182..2864c88 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -1,6 +1,6 @@
 /******************************************************************************
  * Copyright(c) 2008 - 2010 Realtek Corporation. All rights reserved.
- * Linux device driver for RTL8192U 
+ * Linux device driver for RTL8192U
  *
  * Based on the r8187 driver, which is:
  * Copyright 2004-2005 Andrea Merello <andreamrl at tiscali.it>, et al.
@@ -97,7 +97,7 @@ u32 rt_global_debug_component = \
 		//		COMP_TRACE	|
 				COMP_DOWN	|
 		//		COMP_RECV	|
-                //              COMP_SWBW	|
+		//              COMP_SWBW	|
 				COMP_SEC	|
 	//			COMP_RESET	|
 		//		COMP_SEND	|
@@ -169,23 +169,23 @@ static void *__devinit rtl8192_usb_probe(struct usb_device *udev,unsigned int if
 			 const struct usb_device_id *id);
 static void __devexit rtl8192_usb_disconnect(struct usb_device *udev, void *ptr);
 #endif
-		 
+
 
 static struct usb_driver rtl8192_usb_driver = {
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 15)
 	.owner		= THIS_MODULE,
 #endif
-	.name		= RTL819xU_MODULE_NAME,	          /* Driver name   */
-	.id_table	= rtl8192_usb_id_tbl,	          /* PCI_ID table  */
-	.probe		= rtl8192_usb_probe,	          /* probe fn      */
+	.name		= RTL819xU_MODULE_NAME,		  /* Driver name   */
+	.id_table	= rtl8192_usb_id_tbl,		  /* PCI_ID table  */
+	.probe		= rtl8192_usb_probe,		  /* probe fn      */
 	.disconnect	= rtl8192_usb_disconnect,	  /* remove fn     */
 #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)
 #ifdef CONFIG_RTL8192_PM
-	.suspend	= rtl8192_suspend,	          /* PM suspend fn */
+	.suspend	= rtl8192_suspend,		  /* PM suspend fn */
 	.resume		= rtl8192_resume,                 /* PM resume fn  */
 #else
-	.suspend	= NULL,			          /* PM suspend fn */
-	.resume      	= NULL,			          /* PM resume fn  */
+	.suspend	= NULL,				  /* PM suspend fn */
+	.resume      	= NULL,				  /* PM resume fn  */
 #endif
 #endif
 };
@@ -202,7 +202,7 @@ static CHANNEL_LIST ChannelPlan[] = {
 	{{1,2,3,4,5,6,7,8,9,10,11,36,40,44,48,52,56,60,64,149,153,157,161,165},24},  		//FCC
 	{{1,2,3,4,5,6,7,8,9,10,11},11},                    				//IC
 	{{1,2,3,4,5,6,7,8,9,10,11,12,13,36,40,44,48,52,56,60,64},21},  	//ETSI
-	{{1,2,3,4,5,6,7,8,9,10,11,12,13},13},    //Spain. Change to ETSI. 
+	{{1,2,3,4,5,6,7,8,9,10,11,12,13},13},    //Spain. Change to ETSI.
 	{{1,2,3,4,5,6,7,8,9,10,11,12,13},13},  	//France. Change to ETSI.
 	{{1,2,3,4,5,6,7,8,9,10,11,12,13,14,36,40,44,48,52,56,60,64},22},	//MKK					//MKK
 	{{1,2,3,4,5,6,7,8,9,10,11,12,13,14,36,40,44,48,52,56,60,64},22},//MKK1
@@ -245,10 +245,10 @@ static void rtl819x_set_channel_map(u8 channel_plan, struct r8192_priv* priv)
 				// Clear old channel map
 				memset(GET_DOT11D_INFO(ieee)->channel_map, 0, sizeof(GET_DOT11D_INFO(ieee)->channel_map));
 				// Set new channel map
-				for (i=0;i<ChannelPlan[channel_plan].Len;i++) 
+				for (i=0;i<ChannelPlan[channel_plan].Len;i++)
 				{
 					if (ChannelPlan[channel_plan].Channel[i] < min_chan || ChannelPlan[channel_plan].Channel[i] > max_chan)
-					break; 	
+					break;
 					GET_DOT11D_INFO(ieee)->channel_map[ChannelPlan[channel_plan].Channel[i]] = 1;
 				}
 			}
@@ -276,28 +276,28 @@ static void rtl819x_set_channel_map(u8 channel_plan, struct r8192_priv* priv)
 			_pdrvinfo->RxRate == DESC90_RATE5_5M ||\
 			_pdrvinfo->RxRate == DESC90_RATE11M) &&\
 			!_pdrvinfo->RxHT\
- 
+
 
 void CamResetAllEntry(struct net_device *dev)
 {
 #if 1
 	u32 ulcommand = 0;
-        //2004/02/11  In static WEP, OID_ADD_KEY or OID_ADD_WEP are set before STA associate to AP.
-        // However, ResetKey is called on OID_802_11_INFRASTRUCTURE_MODE and MlmeAssociateRequest
-        // In this condition, Cam can not be reset because upper layer will not set this static key again.
-        //if(Adapter->EncAlgorithm == WEP_Encryption)
-        //      return;
+	//2004/02/11  In static WEP, OID_ADD_KEY or OID_ADD_WEP are set before STA associate to AP.
+	// However, ResetKey is called on OID_802_11_INFRASTRUCTURE_MODE and MlmeAssociateRequest
+	// In this condition, Cam can not be reset because upper layer will not set this static key again.
+	//if(Adapter->EncAlgorithm == WEP_Encryption)
+	//      return;
 //debug
-        //DbgPrint("========================================\n");
-        //DbgPrint("                            Call ResetAllEntry                                              \n");
-        //DbgPrint("========================================\n\n");
+	//DbgPrint("========================================\n");
+	//DbgPrint("                            Call ResetAllEntry                                              \n");
+	//DbgPrint("========================================\n\n");
 	ulcommand |= BIT31|BIT30;
-	write_nic_dword(dev, RWCAM, ulcommand); 
+	write_nic_dword(dev, RWCAM, ulcommand);
 #else
-        for(ucIndex=0;ucIndex<TOTAL_CAM_ENTRY;ucIndex++)
-                CAM_mark_invalid(dev, ucIndex);
-        for(ucIndex=0;ucIndex<TOTAL_CAM_ENTRY;ucIndex++)
-                CAM_empty_entry(dev, ucIndex);
+	for(ucIndex=0;ucIndex<TOTAL_CAM_ENTRY;ucIndex++)
+		CAM_mark_invalid(dev, ucIndex);
+	for(ucIndex=0;ucIndex<TOTAL_CAM_ENTRY;ucIndex++)
+		CAM_empty_entry(dev, ucIndex);
 #endif
 
 }
@@ -305,22 +305,22 @@ void CamResetAllEntry(struct net_device *dev)
 
 void write_cam(struct net_device *dev, u8 addr, u32 data)
 {
-        write_nic_dword(dev, WCAMI, data);
-        write_nic_dword(dev, RWCAM, BIT31|BIT16|(addr&0xff) );
+	write_nic_dword(dev, WCAMI, data);
+	write_nic_dword(dev, RWCAM, BIT31|BIT16|(addr&0xff) );
 }
 
 u32 read_cam(struct net_device *dev, u8 addr)
 {
-        write_nic_dword(dev, RWCAM, 0x80000000|(addr&0xff) );
-        return read_nic_dword(dev, 0xa8);
+	write_nic_dword(dev, RWCAM, 0x80000000|(addr&0xff) );
+	return read_nic_dword(dev, 0xa8);
 }
 
 void write_nic_byte_E(struct net_device *dev, int indx, u8 data)
 {
-	int status;	
+	int status;
 	struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
 	struct usb_device *udev = priv->udev;
-	
+
 	status = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
 			       RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
 			       indx|0xfe00, 0, &data, 1, HZ / 2);
@@ -328,7 +328,7 @@ void write_nic_byte_E(struct net_device *dev, int indx, u8 data)
 	if (status < 0)
 	{
 		printk("write_nic_byte_E TimeOut! status:%d\n", status);
-	}	
+	}
 }
 
 u8 read_nic_byte_E(struct net_device *dev, int indx)
@@ -337,15 +337,15 @@ u8 read_nic_byte_E(struct net_device *dev, int indx)
 	u8 data;
 	struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
 	struct usb_device *udev = priv->udev;
-	
+
 	status = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
 			       RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
 			       indx|0xfe00, 0, &data, 1, HZ / 2);
 
-        if (status < 0)
-        {
-                printk("read_nic_byte_E TimeOut! status:%d\n", status);
-        }
+	if (status < 0)
+	{
+		printk("read_nic_byte_E TimeOut! status:%d\n", status);
+	}
 
 	return data;
 }
@@ -353,18 +353,18 @@ u8 read_nic_byte_E(struct net_device *dev, int indx)
 void write_nic_byte(struct net_device *dev, int indx, u8 data)
 {
 	int status;
-	
+
 	struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
 	struct usb_device *udev = priv->udev;
-	
+
 	status = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
 			       RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
 			       (indx&0xff)|0xff00, (indx>>8)&0x0f, &data, 1, HZ / 2);
 
-        if (status < 0)
-        {
-                printk("write_nic_byte TimeOut! status:%d\n", status);
-        }
+	if (status < 0)
+	{
+		printk("write_nic_byte TimeOut! status:%d\n", status);
+	}
 
 
 }
@@ -372,20 +372,20 @@ void write_nic_byte(struct net_device *dev, int indx, u8 data)
 
 void write_nic_word(struct net_device *dev, int indx, u16 data)
 {
-	
+
 	int status;
-	
+
 	struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
 	struct usb_device *udev = priv->udev;
-	
+
 	status = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
 			       RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
 			       (indx&0xff)|0xff00, (indx>>8)&0x0f, &data, 2, HZ / 2);
 
-        if (status < 0)
-        {
-                printk("write_nic_word TimeOut! status:%d\n", status);
-        }
+	if (status < 0)
+	{
+		printk("write_nic_word TimeOut! status:%d\n", status);
+	}
 
 }
 
@@ -394,60 +394,60 @@ void write_nic_dword(struct net_device *dev, int indx, u32 data)
 {
 
 	int status;
-	
+
 	struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
 	struct usb_device *udev = priv->udev;
-	
+
 	status = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
 			       RTL8187_REQ_SET_REGS, RTL8187_REQT_WRITE,
 			       (indx&0xff)|0xff00, (indx>>8)&0x0f, &data, 4, HZ / 2);
 
 
-        if (status < 0)
-        {
-                printk("write_nic_dword TimeOut! status:%d\n", status);
-        }
+	if (status < 0)
+	{
+		printk("write_nic_dword TimeOut! status:%d\n", status);
+	}
 
 }
- 
- 
- 
+
+
+
 u8 read_nic_byte(struct net_device *dev, int indx)
 {
 	u8 data;
 	int status;
 	struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
 	struct usb_device *udev = priv->udev;
-	
+
 	status = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
 			       RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
 			       (indx&0xff)|0xff00, (indx>>8)&0x0f, &data, 1, HZ / 2);
-	
-        if (status < 0)
-        {
-                printk("read_nic_byte TimeOut! status:%d\n", status);
-        }
+
+	if (status < 0)
+	{
+		printk("read_nic_byte TimeOut! status:%d\n", status);
+	}
 
 	return data;
 }
 
 
- 
+
 u16 read_nic_word(struct net_device *dev, int indx)
 {
 	u16 data;
 	int status;
 	struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
 	struct usb_device *udev = priv->udev;
-	
+
 	status = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
 			       RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
 			       (indx&0xff)|0xff00, (indx>>8)&0x0f, &data, 2, HZ / 2);
-	
-        if (status < 0)
-        {
-                printk("read_nic_word TimeOut! status:%d\n", status);
-        }
+
+	if (status < 0)
+	{
+		printk("read_nic_word TimeOut! status:%d\n", status);
+	}
 
 
 	return data;
@@ -459,15 +459,15 @@ u16 read_nic_word_E(struct net_device *dev, int indx)
 	int status;
 	struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
 	struct usb_device *udev = priv->udev;
-	
+
 	status = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
 			       RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
 			       indx|0xfe00, 0, &data, 2, HZ / 2);
-	
-        if (status < 0)
-        {
-                printk("read_nic_word TimeOut! status:%d\n", status);
-        }
+
+	if (status < 0)
+	{
+		printk("read_nic_word TimeOut! status:%d\n", status);
+	}
 
 
 	return data;
@@ -478,21 +478,21 @@ u32 read_nic_dword(struct net_device *dev, int indx)
 	u32 data;
 	int status;
 //	int result;
-	
+
 	struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
 	struct usb_device *udev = priv->udev;
-	
+
 	status = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
 			       RTL8187_REQ_GET_REGS, RTL8187_REQT_READ,
 			       (indx&0xff)|0xff00, (indx>>8)&0x0f, &data, 4, HZ / 2);
 //	if(0 != result) {
 //	  printk(KERN_WARNING "read size of data = %d\, date = %d\n", result, data);
 //	}
-	
-        if (status < 0)
-        {
-                printk("read_nic_dword TimeOut! status:%d\n", status);
-        }
+
+	if (status < 0)
+	{
+		printk("read_nic_dword TimeOut! status:%d\n", status);
+	}
 
 
 
@@ -502,7 +502,7 @@ u32 read_nic_dword(struct net_device *dev, int indx)
 
 //u8 read_phy_cck(struct net_device *dev, u8 adr);
 //u8 read_phy_ofdm(struct net_device *dev, u8 adr);
-/* this might still called in what was the PHY rtl8185/rtl8192 common code 
+/* this might still called in what was the PHY rtl8185/rtl8192 common code
  * plans are to possibilty turn it again in one common code...
  */
 inline void force_pci_posting(struct net_device *dev)
@@ -516,7 +516,7 @@ void rtl8192_commit(struct net_device *dev);
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
 void rtl8192_restart(struct work_struct *work);
 //void rtl8192_rq_tx_ack(struct work_struct *work);
-#else 
+#else
  void rtl8192_restart(struct net_device *dev);
 // //void rtl8192_rq_tx_ack(struct net_device *dev);
  #endif
@@ -539,25 +539,25 @@ static int proc_get_stats_ap(char *page, char **start,
 	struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
 	struct ieee80211_device *ieee = priv->ieee80211;
 	struct ieee80211_network *target;
-	
+
 	int len = 0;
 
-        list_for_each_entry(target, &ieee->network_list, list) {
+	list_for_each_entry(target, &ieee->network_list, list) {
 
 		len += snprintf(page + len, count - len,
-                "%s ", target->ssid);
+		"%s ", target->ssid);
 
 		if(target->wpa_ie_len>0 || target->rsn_ie_len>0){
-	                len += snprintf(page + len, count - len,
-        	        "WPA\n");
+			len += snprintf(page + len, count - len,
+			"WPA\n");
 		}
 		else{
-                        len += snprintf(page + len, count - len,
-                        "non_WPA\n");
-                }
-		 
-        }
-	
+			len += snprintf(page + len, count - len,
+			"non_WPA\n");
+		}
+
+	}
+
 	*eof = 1;
 	return len;
 }
@@ -568,15 +568,15 @@ static int proc_get_registers(char *page, char **start,
 {
 	struct net_device *dev = data;
 //	struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
-	
+
 	int len = 0;
 	int i,n;
-			
+
 	int max=0xff;
-	
+
 	/* This dump the current register page */
 len += snprintf(page + len, count - len,
-                        "\n####################page 0##################\n ");
+			"\n####################page 0##################\n ");
 
 	for(n=0;n<=max;)
 	{
@@ -592,36 +592,36 @@ len += snprintf(page + len, count - len,
 	}
 #if 1
 len += snprintf(page + len, count - len,
-                        "\n####################page 1##################\n ");
-        for(n=0;n<=max;)
-        {
-                //printk( "\nD: %2x> ", n);
-                len += snprintf(page + len, count - len,
-                        "\nD:  %2x > ",n);
-
-                for(i=0;i<16 && n<=max;i++,n++)
-                len += snprintf(page + len, count - len,
-                        "%2x ",read_nic_byte(dev,0x100|n));
-
-                //      printk("%2x ",read_nic_byte(dev,n));
-        }
+			"\n####################page 1##################\n ");
+	for(n=0;n<=max;)
+	{
+		//printk( "\nD: %2x> ", n);
+		len += snprintf(page + len, count - len,
+			"\nD:  %2x > ",n);
+
+		for(i=0;i<16 && n<=max;i++,n++)
+		len += snprintf(page + len, count - len,
+			"%2x ",read_nic_byte(dev,0x100|n));
+
+		//      printk("%2x ",read_nic_byte(dev,n));
+	}
 len += snprintf(page + len, count - len,
-                        "\n####################page 3##################\n ");
-        for(n=0;n<=max;)
-        {
-                //printk( "\nD: %2x> ", n);
-                len += snprintf(page + len, count - len,
-                        "\nD:  %2x > ",n);
+			"\n####################page 3##################\n ");
+	for(n=0;n<=max;)
+	{
+		//printk( "\nD: %2x> ", n);
+		len += snprintf(page + len, count - len,
+			"\nD:  %2x > ",n);
 
-                for(i=0;i<16 && n<=max;i++,n++)
-                len += snprintf(page + len, count - len,
-                        "%2x ",read_nic_byte(dev,0x300|n));
+		for(i=0;i<16 && n<=max;i++,n++)
+		len += snprintf(page + len, count - len,
+			"%2x ",read_nic_byte(dev,0x300|n));
 
-                //      printk("%2x ",read_nic_byte(dev,n));
-        }
+		//      printk("%2x ",read_nic_byte(dev,n));
+	}
 
 #endif
-		
+
 	len += snprintf(page + len, count - len,"\n");
 	*eof = 1;
 	return len;
@@ -636,12 +636,12 @@ static int proc_get_cck_reg(char *page, char **start,
 {
 	struct net_device *dev = data;
 //	struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
-	
+
 	int len = 0;
 	int i,n;
-			
+
 	int max = 0x5F;
-	
+
 	/* This dump the current register page */
 	for(n=0;n<=max;)
 	{
@@ -657,7 +657,7 @@ static int proc_get_cck_reg(char *page, char **start,
 	}
 	len += snprintf(page + len, count - len,"\n");
 
-		
+
 	*eof = 1;
 	return len;
 }
@@ -671,13 +671,13 @@ static int proc_get_ofdm_reg(char *page, char **start,
 {
 	struct net_device *dev = data;
 //	struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
-	
+
 	int len = 0;
 	int i,n;
-			
+
 	//int max=0xff;
 	int max = 0x40;
-	
+
 	/* This dump the current register page */
 	for(n=0;n<=max;)
 	{
@@ -694,7 +694,7 @@ static int proc_get_ofdm_reg(char *page, char **start,
 	len += snprintf(page + len, count - len,"\n");
 
 
-		
+
 	*eof = 1;
 	return len;
 }
@@ -708,15 +708,15 @@ static int proc_get_stats_hw(char *page, char **start,
 {
 	struct net_device *dev = data;
 	struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
-	
+
 	int len = 0;
-	
+
 	len += snprintf(page + len, count - len,
 		"NIC int: %lu\n"
 		"Total int: %lu\n",
 		priv->stats.ints,
 		priv->stats.shints);
-			
+
 	*eof = 1;
 	return len;
 }
@@ -728,9 +728,9 @@ static int proc_get_stats_tx(char *page, char **start,
 {
 	struct net_device *dev = data;
 	struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
-	
+
 	int len = 0;
-	
+
 	len += snprintf(page + len, count - len,
 		"TX VI priority ok int: %lu\n"
 		"TX VI priority error int: %lu\n"
@@ -759,7 +759,7 @@ static int proc_get_stats_tx(char *page, char **start,
 		"TX VO dropped: %lu\n"
 		"TX BE dropped: %lu\n"
 		"TX BK dropped: %lu\n"
-		"TX total data packets %lu\n",		
+		"TX total data packets %lu\n",
 //		"TX beacon aborted: %lu\n",
 		priv->stats.txviokint,
 		priv->stats.txvierr,
@@ -791,10 +791,10 @@ static int proc_get_stats_tx(char *page, char **start,
 		priv->stats.txdatapkt
 //		priv->stats.txbeaconerr
 		);
-			
+
 	*eof = 1;
 	return len;
-}		
+}
 
 
 
@@ -804,9 +804,9 @@ static int proc_get_stats_rx(char *page, char **start,
 {
 	struct net_device *dev = data;
 	struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
-	
+
 	int len = 0;
-	
+
 	len += snprintf(page + len, count - len,
 		"RX packets: %lu\n"
 		"RX urb status error: %lu\n"
@@ -814,10 +814,10 @@ static int proc_get_stats_rx(char *page, char **start,
 		priv->stats.rxoktotal,
 		priv->stats.rxstaterr,
 		priv->stats.rxurberr);
-			
+
 	*eof = 1;
 	return len;
-}		
+}
 #if 0
 #if WIRELESS_EXT >= 12 && WIRELESS_EXT < 17
 
@@ -830,7 +830,7 @@ static struct iw_statistics *r8192_get_wireless_stats(struct net_device *dev)
 #endif
 #endif
 void rtl8192_proc_module_init(void)
-{	
+{
 	RT_TRACE(COMP_INIT, "Initializing proc filesystem");
 #if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
 	rtl8192_proc=create_proc_entry(RTL819xU_MODULE_NAME, S_IFDIR, proc_net);
@@ -875,8 +875,8 @@ void rtl8192_proc_init_one(struct net_device *dev)
 {
 	struct proc_dir_entry *e;
 	struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
-	priv->dir_dev = create_proc_entry(dev->name, 
-					  S_IFDIR | S_IRUGO | S_IXUGO, 
+	priv->dir_dev = create_proc_entry(dev->name,
+					  S_IFDIR | S_IRUGO | S_IXUGO,
 					  rtl8192_proc);
 	if (!priv->dir_dev) {
 		RT_TRACE(COMP_ERR, "Unable to initialize /proc/net/rtl8192/%s\n",
@@ -886,7 +886,7 @@ void rtl8192_proc_init_one(struct net_device *dev)
 	#if 0
 	e = create_proc_read_entry("stats-hw", S_IFREG | S_IRUGO,
 				   priv->dir_dev, proc_get_stats_hw, dev);
-				   
+
 	if (!e) {
 		DMESGE("Unable to initialize "
 		      "/proc/net/rtl8192/%s/stats-hw\n",
@@ -895,17 +895,17 @@ void rtl8192_proc_init_one(struct net_device *dev)
 	#endif
 	e = create_proc_read_entry("stats-rx", S_IFREG | S_IRUGO,
 				   priv->dir_dev, proc_get_stats_rx, dev);
-				   
+
 	if (!e) {
 		RT_TRACE(COMP_ERR,"Unable to initialize "
 		      "/proc/net/rtl8192/%s/stats-rx\n",
 		      dev->name);
 	}
-	
-	
+
+
 	e = create_proc_read_entry("stats-tx", S_IFREG | S_IRUGO,
 				   priv->dir_dev, proc_get_stats_tx, dev);
-				   
+
 	if (!e) {
 		RT_TRACE(COMP_ERR, "Unable to initialize "
 		      "/proc/net/rtl8192/%s/stats-tx\n",
@@ -914,24 +914,24 @@ void rtl8192_proc_init_one(struct net_device *dev)
 	#if 0
 	e = create_proc_read_entry("stats-ieee", S_IFREG | S_IRUGO,
 				   priv->dir_dev, proc_get_stats_ieee, dev);
-				   
+
 	if (!e) {
 		DMESGE("Unable to initialize "
 		      "/proc/net/rtl8192/%s/stats-ieee\n",
 		      dev->name);
 	}
-	
+
 	#endif
-	
+
 	e = create_proc_read_entry("stats-ap", S_IFREG | S_IRUGO,
 				   priv->dir_dev, proc_get_stats_ap, dev);
-				   
+
 	if (!e) {
 		RT_TRACE(COMP_ERR, "Unable to initialize "
 		      "/proc/net/rtl8192/%s/stats-ap\n",
 		      dev->name);
 	}
-	
+
 	e = create_proc_read_entry("registers", S_IFREG | S_IRUGO,
 				   priv->dir_dev, proc_get_registers, dev);
 	if (!e) {
@@ -947,7 +947,7 @@ void rtl8192_proc_init_one(struct net_device *dev)
 		      "/proc/net/rtl8192/%s/cck-registers\n",
 		      dev->name);
 	}
-	
+
 	e = create_proc_read_entry("ofdm-registers", S_IFREG | S_IRUGO,
 				   priv->dir_dev, proc_get_ofdm_reg, dev);
 	if (!e) {
@@ -966,14 +966,14 @@ void print_buffer(u32 *buffer, int len)
 {
 	int i;
 	u8 *buf =(u8*)buffer;
-	
+
 	printk("ASCII BUFFER DUMP (len: %x):\n",len);
-	
+
 	for(i=0;i<len;i++)
 		printk("%c",buf[i]);
-		
+
 	printk("\nBINARY BUFFER DUMP (len: %x):\n",len);
-	
+
 	for(i=0;i<len;i++)
 		printk("%x",buf[i]);
 
@@ -984,8 +984,8 @@ void print_buffer(u32 *buffer, int len)
 short check_nic_enough_desc(struct net_device *dev,int queue_index)
 {
 	struct r8192_priv *priv = ieee80211_priv(dev);
-	int used = atomic_read(&priv->tx_pending[queue_index]); 
-	
+	int used = atomic_read(&priv->tx_pending[queue_index]);
+
 	return (used < MAX_TX_URB);
 }
 
@@ -1017,9 +1017,9 @@ void rtl8192_dump_reg(struct net_device *dev)
 	int i;
 	int n;
 	int max=0x1ff;
-	
-	RT_TRACE(COMP_PHY, "Dumping NIC register map");	
-	
+
+	RT_TRACE(COMP_PHY, "Dumping NIC register map");
+
 	for(n=0;n<=max;)
 	{
 		printk( "\nD: %2x> ", n);
@@ -1036,11 +1036,11 @@ void rtl8192_dump_reg(struct net_device *dev)
 #if 0
 void rtl8192_irq_enable(struct net_device *dev)
 {
-	struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);	
+	struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
 	//priv->irq_enabled = 1;
 /*
-	write_nic_word(dev,INTA_MASK,INTA_RXOK | INTA_RXDESCERR | INTA_RXOVERFLOW |\ 
-	INTA_TXOVERFLOW | INTA_HIPRIORITYDESCERR | INTA_HIPRIORITYDESCOK |\ 
+	write_nic_word(dev,INTA_MASK,INTA_RXOK | INTA_RXDESCERR | INTA_RXOVERFLOW |\
+	INTA_TXOVERFLOW | INTA_HIPRIORITYDESCERR | INTA_HIPRIORITYDESCOK |\
 	INTA_NORMPRIORITYDESCERR | INTA_NORMPRIORITYDESCOK |\
 	INTA_LOWPRIORITYDESCERR | INTA_LOWPRIORITYDESCOK | INTA_TIMEOUT);
 */
@@ -1050,7 +1050,7 @@ void rtl8192_irq_enable(struct net_device *dev)
 
 void rtl8192_irq_disable(struct net_device *dev)
 {
-//	struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);	
+//	struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
 
 	write_nic_word(dev,INTA_MASK,0);
 	force_pci_posting(dev);
@@ -1074,27 +1074,27 @@ void rtl8192_update_msr(struct net_device *dev)
 {
 	struct r8192_priv *priv = ieee80211_priv(dev);
 	u8 msr;
-	
+
 	msr  = read_nic_byte(dev, MSR);
 	msr &= ~ MSR_LINK_MASK;
-	
+
 	/* do not change in link_state != WLAN_LINK_ASSOCIATED.
-	 * msr must be updated if the state is ASSOCIATING. 
+	 * msr must be updated if the state is ASSOCIATING.
 	 * this is intentional and make sense for ad-hoc and
 	 * master (see the create BSS/IBSS func)
 	 */
-	if (priv->ieee80211->state == IEEE80211_LINKED){ 
-			
+	if (priv->ieee80211->state == IEEE80211_LINKED){
+
 		if (priv->ieee80211->iw_mode == IW_MODE_INFRA)
 			msr |= (MSR_LINK_MANAGED<<MSR_LINK_SHIFT);
 		else if (priv->ieee80211->iw_mode == IW_MODE_ADHOC)
 			msr |= (MSR_LINK_ADHOC<<MSR_LINK_SHIFT);
 		else if (priv->ieee80211->iw_mode == IW_MODE_MASTER)
 			msr |= (MSR_LINK_MASTER<<MSR_LINK_SHIFT);
-		
+
 	}else
 		msr |= (MSR_LINK_NONE<<MSR_LINK_SHIFT);
-		
+
 	write_nic_byte(dev, MSR, msr);
 }
 
@@ -1102,25 +1102,25 @@ void rtl8192_set_chan(struct net_device *dev,short ch)
 {
 	struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
 //	u32 tx;
-	RT_TRACE(COMP_CH, "=====>%s()====ch:%d\n", __FUNCTION__, ch);	
+	RT_TRACE(COMP_CH, "=====>%s()====ch:%d\n", __FUNCTION__, ch);
 	priv->chan=ch;
 	#if 0
-	if(priv->ieee80211->iw_mode == IW_MODE_ADHOC || 
+	if(priv->ieee80211->iw_mode == IW_MODE_ADHOC ||
 		priv->ieee80211->iw_mode == IW_MODE_MASTER){
-	
-			priv->ieee80211->link_state = WLAN_LINK_ASSOCIATED;	
+
+			priv->ieee80211->link_state = WLAN_LINK_ASSOCIATED;
 			priv->ieee80211->master_chan = ch;
-			rtl8192_update_beacon_ch(dev); 
+			rtl8192_update_beacon_ch(dev);
 		}
 	#endif
-	
+
 	/* this hack should avoid frame TX during channel setting*/
 
 
 //	tx = read_nic_dword(dev,TX_CONF);
 //	tx &= ~TX_LOOPBACK_MASK;
 
-#ifndef LOOP_TEST	
+#ifndef LOOP_TEST
 //	write_nic_dword(dev,TX_CONF, tx |( TX_LOOPBACK_MAC<<TX_LOOPBACK_SHIFT));
 
 	//need to implement rf set channel here WB
@@ -1147,88 +1147,88 @@ u32 get_rxpacket_shiftbytes_819xusb(struct ieee80211_rx_stats *pstats)
 		return (sizeof(rx_desc_819x_usb) + pstats->RxDrvInfoSize
 			+ pstats->RxBufShift + 8);
 	else
-#endif	
-		return (sizeof(rx_desc_819x_usb) + pstats->RxDrvInfoSize 
+#endif
+		return (sizeof(rx_desc_819x_usb) + pstats->RxDrvInfoSize
 				+ pstats->RxBufShift);
 
 }
 static int rtl8192_rx_initiate(struct net_device*dev)
 {
-        struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
-        struct urb *entry;
-        struct sk_buff *skb;
-        struct rtl8192_rx_info *info;
+	struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
+	struct urb *entry;
+	struct sk_buff *skb;
+	struct rtl8192_rx_info *info;
 
 	/* nomal packet rx procedure */
-        while (skb_queue_len(&priv->rx_queue) < MAX_RX_URB) {
-                skb = __dev_alloc_skb(RX_URB_SIZE, GFP_KERNEL);
-                if (!skb)
-                        break;
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) 
-	        entry = usb_alloc_urb(0, GFP_KERNEL);
+	while (skb_queue_len(&priv->rx_queue) < MAX_RX_URB) {
+		skb = __dev_alloc_skb(RX_URB_SIZE, GFP_KERNEL);
+		if (!skb)
+			break;
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
+		entry = usb_alloc_urb(0, GFP_KERNEL);
 #else
-	        entry = usb_alloc_urb(0);
+		entry = usb_alloc_urb(0);
 #endif
-                if (!entry) {
-                        kfree_skb(skb);
-                        break;
-                }
+		if (!entry) {
+			kfree_skb(skb);
+			break;
+		}
 //		printk("nomal packet IN request!\n");
-                usb_fill_bulk_urb(entry, priv->udev,
-                                  usb_rcvbulkpipe(priv->udev, 3), skb_tail_pointer(skb),
-                                  RX_URB_SIZE, rtl8192_rx_isr, skb);
-                info = (struct rtl8192_rx_info *) skb->cb;
-                info->urb = entry;
-                info->dev = dev;
+		usb_fill_bulk_urb(entry, priv->udev,
+				  usb_rcvbulkpipe(priv->udev, 3), skb_tail_pointer(skb),
+				  RX_URB_SIZE, rtl8192_rx_isr, skb);
+		info = (struct rtl8192_rx_info *) skb->cb;
+		info->urb = entry;
+		info->dev = dev;
 		info->out_pipe = 3; //denote rx normal packet queue
-                skb_queue_tail(&priv->rx_queue, skb);
-                usb_submit_urb(entry, GFP_KERNEL);
-        }
+		skb_queue_tail(&priv->rx_queue, skb);
+		usb_submit_urb(entry, GFP_KERNEL);
+	}
 
 	/* command packet rx procedure */
-        while (skb_queue_len(&priv->rx_queue) < MAX_RX_URB + 3) {
+	while (skb_queue_len(&priv->rx_queue) < MAX_RX_URB + 3) {
 //		printk("command packet IN request!\n");
-                skb = __dev_alloc_skb(RX_URB_SIZE ,GFP_KERNEL);
-                if (!skb)
-                        break;
+		skb = __dev_alloc_skb(RX_URB_SIZE ,GFP_KERNEL);
+		if (!skb)
+			break;
 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
-                entry = usb_alloc_urb(0, GFP_KERNEL);
+		entry = usb_alloc_urb(0, GFP_KERNEL);
 #else
-                entry = usb_alloc_urb(0);
-#endif
-                if (!entry) {
-                        kfree_skb(skb);
-                        break;
-                }
-                usb_fill_bulk_urb(entry, priv->udev,
-                                  usb_rcvbulkpipe(priv->udev, 9), skb_tail_pointer(skb),
-                                  RX_URB_SIZE, rtl8192_rx_isr, skb);
-                info = (struct rtl8192_rx_info *) skb->cb;
-                info->urb = entry;
-                info->dev = dev;
+		entry = usb_alloc_urb(0);
+#endif
+		if (!entry) {
+			kfree_skb(skb);
+			break;
+		}
+		usb_fill_bulk_urb(entry, priv->udev,
+				  usb_rcvbulkpipe(priv->udev, 9), skb_tail_pointer(skb),
+				  RX_URB_SIZE, rtl8192_rx_isr, skb);
+		info = (struct rtl8192_rx_info *) skb->cb;
+		info->urb = entry;
+		info->dev = dev;
 		   info->out_pipe = 9; //denote rx cmd packet queue
-                skb_queue_tail(&priv->rx_queue, skb);
+		skb_queue_tail(&priv->rx_queue, skb);
 		usb_submit_urb(entry, GFP_KERNEL);
-        }
+	}
 
-        return 0;
+	return 0;
 }
 
 void rtl8192_set_rxconf(struct net_device *dev)
 {
 	struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
 	u32 rxconf;
-	
+
 	rxconf=read_nic_dword(dev,RCR);
 	rxconf = rxconf &~ MAC_FILTER_MASK;
 	rxconf = rxconf | RCR_AMF;
 	rxconf = rxconf | RCR_ADF;
 	rxconf = rxconf | RCR_AB;
 	rxconf = rxconf | RCR_AM;
-	//rxconf = rxconf | RCR_ACF;	
+	//rxconf = rxconf | RCR_ACF;
 
 	if (dev->flags & IFF_PROMISC) {DMESG ("NIC in promisc mode");}
-	
+
 	if(priv->ieee80211->iw_mode == IW_MODE_MONITOR || \
 	   dev->flags & IFF_PROMISC){
 		rxconf = rxconf | RCR_AAP;
@@ -1239,17 +1239,17 @@ void rtl8192_set_rxconf(struct net_device *dev)
 		rxconf = rxconf | RCR_APM;
 		rxconf = rxconf | RCR_CBSSID;
 	}
-	
-	
+
+
 	if(priv->ieee80211->iw_mode == IW_MODE_MONITOR){
 		rxconf = rxconf | RCR_AICV;
 		rxconf = rxconf | RCR_APWRMGT;
 	}
-	
+
 	if( priv->crcmon == 1 && priv->ieee80211->iw_mode == IW_MODE_MONITOR)
 		rxconf = rxconf | RCR_ACRC32;
-	
-	
+
+
 	rxconf = rxconf &~ RX_FIFO_THRESHOLD_MASK;
 	rxconf = rxconf | (RX_FIFO_THRESHOLD_NONE<<RX_FIFO_THRESHOLD_SHIFT);
 	rxconf = rxconf &~ MAX_RX_DMA_MASK;
@@ -1257,12 +1257,12 @@ void rtl8192_set_rxconf(struct net_device *dev)
 
 //	rxconf = rxconf | (1<<RX_AUTORESETPHY_SHIFT);
 	rxconf = rxconf | RCR_ONLYERLPKT;
-	
+
 //	rxconf = rxconf &~ RCR_CS_MASK;
 //	rxconf = rxconf | (1<<RCR_CS_SHIFT);
 
-	write_nic_dword(dev, RCR, rxconf);	
-	
+	write_nic_dword(dev, RCR, rxconf);
+
 	#ifdef DEBUG_RX
 	DMESG("rxconf: %x %x",rxconf ,read_nic_dword(dev,RCR));
 	#endif
@@ -1274,9 +1274,9 @@ void rtl8192_rx_enable(struct net_device *dev)
 
 	//struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
 
-	rtl8192_rx_initiate(dev);	
-	
-//	rtl8192_set_rxconf(dev);	
+	rtl8192_rx_initiate(dev);
+
+//	rtl8192_set_rxconf(dev);
 #if 0
 	if(NIC_8187 == priv->card_8187) {
 		cmd=read_nic_byte(dev,CMD);
@@ -1299,7 +1299,7 @@ void rtl8192_tx_enable(struct net_device *dev)
 	//test loopback
 	//	priv->TransmitConfig |= (TX_LOOPBACK_BASEBAND<<TX_LOOPBACK_SHIFT);
 	if(NIC_8187B == priv->card_8187){
-		write_nic_dword(dev, TX_CONF, priv->TransmitConfig);	
+		write_nic_dword(dev, TX_CONF, priv->TransmitConfig);
 		byte = read_nic_byte(dev, MSR);
 		byte |= MSR_LINK_ENEDCA;
 		write_nic_byte(dev, MSR, byte);
@@ -1349,7 +1349,7 @@ void rtl8192_tx_enable(struct net_device *dev)
 #endif
 
 		cmd=read_nic_byte(dev,CMD);
-		write_nic_byte(dev,CMD,cmd | (1<<CMD_TX_ENABLE_SHIFT));		
+		write_nic_byte(dev,CMD,cmd | (1<<CMD_TX_ENABLE_SHIFT));
 	}
 #endif
 }
@@ -1360,13 +1360,13 @@ void rtl8192_beacon_tx_enable(struct net_device *dev)
 	struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
 	priv->dma_poll_mask &=~(1<<TX_DMA_STOP_BEACON_SHIFT);
 	rtl8192_set_mode(dev,EPROM_CMD_CONFIG);
-	write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);	
+	write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
 	rtl8192_set_mode(dev,EPROM_CMD_NORMAL);
 }
 
 
 void rtl8192_
-_disable(struct net_device *dev) 
+_disable(struct net_device *dev)
 {
 	struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
 	priv->dma_poll_mask |= (1<<TX_DMA_STOP_BEACON_SHIFT);
@@ -1387,7 +1387,7 @@ void rtl8192_rtx_disable(struct net_device *dev)
 
 	cmd=read_nic_byte(dev,CMDR);
 	write_nic_byte(dev, CMDR, cmd &~ \
-		(CR_TE|CR_RE));	
+		(CR_TE|CR_RE));
 	force_pci_posting(dev);
 	mdelay(10);
 
@@ -1415,13 +1415,13 @@ int alloc_tx_beacon_desc_ring(struct net_device *dev, int count)
 	int i;
 	u32 *tmp;
 	struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
-	
+
 	priv->txbeaconring = (u32*)pci_alloc_consistent(priv->pdev,
-					  sizeof(u32)*8*count, 
+					  sizeof(u32)*8*count,
 					  &priv->txbeaconringdma);
 	if (!priv->txbeaconring) return -1;
 	for (tmp=priv->txbeaconring,i=0;i<count;i++){
-		*tmp = *tmp &~ (1<<31); // descriptor empty, owned by the drv 
+		*tmp = *tmp &~ (1<<31); // descriptor empty, owned by the drv
 		/*
 		*(tmp+2) = (u32)dma_tmp;
 		*(tmp+3) = bufsize;
@@ -1430,7 +1430,7 @@ int alloc_tx_beacon_desc_ring(struct net_device *dev, int count)
 			*(tmp+4) = (u32)priv->txbeaconringdma+((i+1)*8*4);
 		else
 			*(tmp+4) = (u32)priv->txbeaconringdma;
-		
+
 		tmp=tmp+8;
 	}
 	#endif
@@ -1440,7 +1440,7 @@ int alloc_tx_beacon_desc_ring(struct net_device *dev, int count)
 #if 0
 void rtl8192_reset(struct net_device *dev)
 {
-	
+
 	//struct r8192_priv *priv = ieee80211_priv(dev);
 	//u8 cr;
 
@@ -1466,17 +1466,17 @@ void rtl8192_reset(struct net_device *dev)
 	cr = cr & 2;
 	cr = cr | (1<<CMD_RST_SHIFT);
 	write_nic_byte(dev,CMD,cr);
-	
+
 	force_pci_posting(dev);
-	
+
 	mdelay(200);
-	
-	if(read_nic_byte(dev,CMD) & (1<<CMD_RST_SHIFT)) 
+
+	if(read_nic_byte(dev,CMD) & (1<<CMD_RST_SHIFT))
 		RT_TRACE(COMP_ERR, "Card reset timeout!\n");
-	else 
+	else
 		RT_TRACE(COMP_DOWN, "Card successfully reset\n");
 #endif
-#if 0	
+#if 0
 	if(NIC_8187 == priv->card_8187) {
 
 		printk("This is RTL8187 Reset procedure\n");
@@ -1499,7 +1499,7 @@ void rtl8192_reset(struct net_device *dev)
 inline u16 ieeerate2rtlrate(int rate)
 {
 	switch(rate){
-	case 10:	
+	case 10:
 	return 0;
 	case 20:
 	return 1;
@@ -1525,16 +1525,16 @@ inline u16 ieeerate2rtlrate(int rate)
 	return 11;
 	default:
 	return 3;
-	
+
 	}
 }
 static u16 rtl_rate[] = {10,20,55,110,60,90,120,180,240,360,480,540};
 inline u16 rtl8192_rate2rate(short rate)
 {
 	if (rate >11) return 0;
-	return rtl_rate[rate]; 
+	return rtl_rate[rate];
 }
-		
+
 
 /* The protype of rx_isr has changed since one verion of Linux Kernel */
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
@@ -1543,69 +1543,69 @@ static void rtl8192_rx_isr(struct urb *urb, struct pt_regs *regs)
 static void rtl8192_rx_isr(struct urb *urb)
 #endif
 {
-        struct sk_buff *skb = (struct sk_buff *) urb->context;
-        struct rtl8192_rx_info *info = (struct rtl8192_rx_info *)skb->cb;
-        struct net_device *dev = info->dev;
+	struct sk_buff *skb = (struct sk_buff *) urb->context;
+	struct rtl8192_rx_info *info = (struct rtl8192_rx_info *)skb->cb;
+	struct net_device *dev = info->dev;
 	struct r8192_priv *priv = ieee80211_priv(dev);
 	int out_pipe = info->out_pipe;
-	int err;	
+	int err;
 	if(!priv->up)
-		return;	
-        if (unlikely(urb->status)) {
-                info->urb = NULL;
-                priv->stats.rxstaterr++;
-                priv->ieee80211->stats.rx_errors++;
-                usb_free_urb(urb);
+		return;
+	if (unlikely(urb->status)) {
+		info->urb = NULL;
+		priv->stats.rxstaterr++;
+		priv->ieee80211->stats.rx_errors++;
+		usb_free_urb(urb);
 	//	printk("%s():rx status err\n",__FUNCTION__);
-                return;
-        }
+		return;
+	}
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14)
-        skb_unlink(skb, &priv->rx_queue);
+	skb_unlink(skb, &priv->rx_queue);
 #else
-        __skb_unlink(skb,&priv->rx_queue);
+	__skb_unlink(skb,&priv->rx_queue);
 #endif
-        skb_put(skb, urb->actual_length);
+	skb_put(skb, urb->actual_length);
 
 	skb_queue_tail(&priv->skb_queue, skb);
 	tasklet_schedule(&priv->irq_rx_tasklet);
 
-        skb = dev_alloc_skb(RX_URB_SIZE);
-        if (unlikely(!skb)) {
-                usb_free_urb(urb);
+	skb = dev_alloc_skb(RX_URB_SIZE);
+	if (unlikely(!skb)) {
+		usb_free_urb(urb);
 		printk("%s():can,t alloc skb\n",__FUNCTION__);
-                /* TODO check rx queue length and refill *somewhere* */
-                return;
-        }
-	
+		/* TODO check rx queue length and refill *somewhere* */
+		return;
+	}
+
 	usb_fill_bulk_urb(urb, priv->udev,
 			usb_rcvbulkpipe(priv->udev, out_pipe), skb_tail_pointer(skb),
 			RX_URB_SIZE, rtl8192_rx_isr, skb);
 
-        info = (struct rtl8192_rx_info *) skb->cb;
-        info->urb = urb;
-        info->dev = dev;
+	info = (struct rtl8192_rx_info *) skb->cb;
+	info->urb = urb;
+	info->dev = dev;
 	info->out_pipe = out_pipe;
 
-        urb->transfer_buffer = skb_tail_pointer(skb);
-        urb->context = skb;
-        skb_queue_tail(&priv->rx_queue, skb);
-        err = usb_submit_urb(urb, GFP_ATOMIC);
+	urb->transfer_buffer = skb_tail_pointer(skb);
+	urb->context = skb;
+	skb_queue_tail(&priv->rx_queue, skb);
+	err = usb_submit_urb(urb, GFP_ATOMIC);
 	if(err && err != EPERM)
-		printk("can not submit rxurb, err is %x,URB status is %x\n",err,urb->status);	
+		printk("can not submit rxurb, err is %x,URB status is %x\n",err,urb->status);
 }
 
-u32	
+u32
 rtl819xusb_rx_command_packet(
 	struct net_device *dev,
 	struct ieee80211_rx_stats *pstats
 	)
-{	
+{
 	u32	status;
 
 	//RT_TRACE(COMP_RECV, DBG_TRACE, ("---> RxCommandPacketHandle819xUsb()\n"));
 
 	status = cmpk_message_handle_rx(dev, pstats);
-	if (status) 
+	if (status)
 	{
 		DMESG("rxcommandpackethandle819xusb: It is a command packet\n");
 	}
@@ -1613,7 +1613,7 @@ rtl819xusb_rx_command_packet(
 	{
 		//RT_TRACE(COMP_RECV, DBG_TRACE, ("RxCommandPacketHandle819xUsb: It is not a command packet\n"));
 	}
-	
+
 	//RT_TRACE(COMP_RECV, DBG_TRACE, ("<--- RxCommandPacketHandle819xUsb()\n"));
 	return status;
 }
@@ -1668,13 +1668,13 @@ void rtl8192_hard_data_xmit(struct sk_buff *skb, struct net_device *dev, int rat
 	unsigned long flags;
 	cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE);
 	u8 queue_index = tcb_desc->queue_index;
-	
+
 	/* shall not be referred by command packet */
 	assert(queue_index != TXCMD_QUEUE);
 
 	spin_lock_irqsave(&priv->tx_lock,flags);
 
-        memcpy((unsigned char *)(skb->cb),&dev,sizeof(dev));
+	memcpy((unsigned char *)(skb->cb),&dev,sizeof(dev));
 //	tcb_desc->RATRIndex = 7;
 //	tcb_desc->bTxDisableRateFallBack = 1;
 //	tcb_desc->bTxUseDriverAssingedRate = 1;
@@ -1701,26 +1701,26 @@ int rtl8192_hard_start_xmit(struct sk_buff *skb,struct net_device *dev)
 	struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
 	int ret;
 	unsigned long flags;
-        cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE);
-        u8 queue_index = tcb_desc->queue_index;
+	cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE);
+	u8 queue_index = tcb_desc->queue_index;
 
 
 	spin_lock_irqsave(&priv->tx_lock,flags);
-	
-        memcpy((unsigned char *)(skb->cb),&dev,sizeof(dev));
+
+	memcpy((unsigned char *)(skb->cb),&dev,sizeof(dev));
 	if(queue_index == TXCMD_QUEUE) {
 		skb_push(skb, USB_HWDESC_HEADER_LEN);
 		rtl819xU_tx_cmd(dev, skb);
 		ret = 1;
-	        spin_unlock_irqrestore(&priv->tx_lock,flags);	
+		spin_unlock_irqrestore(&priv->tx_lock,flags);
 		return ret;
 	} else {
 		skb_push(skb, priv->ieee80211->tx_headroom);
 		ret = rtl8192_tx(dev, skb);
 	}
-	
-	spin_unlock_irqrestore(&priv->tx_lock,flags);	
-	
+
+	spin_unlock_irqrestore(&priv->tx_lock,flags);
+
 	return ret;
 }
 
@@ -1743,34 +1743,34 @@ struct sk_buff *DrvAggr_Aggregation(struct net_device *dev, struct ieee80211_drv
 	struct ieee80211_device *ieee = netdev_priv(dev);
 #else
 	struct ieee80211_device *ieee = (struct ieee80211_device *)dev->priv;
-#endif	
+#endif
 	struct r8192_priv *priv = ieee80211_priv(dev);
 	cb_desc 	*tcb_desc = NULL;
 	u8 		i;
 	u32		TotalLength;
 	struct sk_buff	*skb;
 	struct sk_buff  *agg_skb;
-	tx_desc_819x_usb_aggr_subframe *tx_agg_desc = NULL;	
+	tx_desc_819x_usb_aggr_subframe *tx_agg_desc = NULL;
 	tx_fwinfo_819x_usb	       *tx_fwinfo = NULL;
 
-	// 
+	//
 	// Local variable initialization.
 	//
 	/* first skb initialization */
 	skb = pSendList->tx_agg_frames[0];
 	TotalLength = skb->len;
 
-	/* Get the total aggregation length including the padding space and 
+	/* Get the total aggregation length including the padding space and
 	 * sub frame header.
 	 */
 	for(i = 1; i < pSendList->nr_drv_agg_frames; i++) {
 		TotalLength += DrvAggr_PaddingAdd(dev, skb);
 		skb = pSendList->tx_agg_frames[i];
-		TotalLength += (skb->len + TX_PACKET_DRVAGGR_SUBFRAME_SHIFT_BYTES); 
+		TotalLength += (skb->len + TX_PACKET_DRVAGGR_SUBFRAME_SHIFT_BYTES);
 	}
 
 	/* allocate skb to contain the aggregated packets */
-	agg_skb = dev_alloc_skb(TotalLength + ieee->tx_headroom); 
+	agg_skb = dev_alloc_skb(TotalLength + ieee->tx_headroom);
 	memset(agg_skb->data, 0, agg_skb->len);
 	skb_reserve(agg_skb, ieee->tx_headroom);
 
@@ -1780,7 +1780,7 @@ struct sk_buff *DrvAggr_Aggregation(struct net_device *dev, struct ieee80211_drv
 	tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE);
 	tcb_desc->drv_agg_enable = 1;
 	tcb_desc->pkt_size = skb->len;
- 	tcb_desc->DrvAggrNum = pSendList->nr_drv_agg_frames;
+	tcb_desc->DrvAggrNum = pSendList->nr_drv_agg_frames;
 	printk("DrvAggNum = %d\n", tcb_desc->DrvAggrNum);
 //	RT_DEBUG_DATA(COMP_SEND, skb->cb, sizeof(skb->cb));
 //	printk("========>skb->data ======> \n");
@@ -1794,7 +1794,7 @@ struct sk_buff *DrvAggr_Aggregation(struct net_device *dev, struct ieee80211_drv
 
 		/* Subframe drv Tx descriptor and firmware info setting */
 		skb = pSendList->tx_agg_frames[i];
-		tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE);	
+		tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE);
 		tx_agg_desc = (tx_desc_819x_usb_aggr_subframe *)agg_skb->tail;
 		tx_fwinfo = (tx_fwinfo_819x_usb *)(agg_skb->tail + sizeof(tx_desc_819x_usb_aggr_subframe));
 
@@ -1802,13 +1802,13 @@ struct sk_buff *DrvAggr_Aggregation(struct net_device *dev, struct ieee80211_drv
 		/* DWORD 0 */
 		tx_fwinfo->TxHT = (tcb_desc->data_rate&0x80)?1:0;
 		tx_fwinfo->TxRate = MRateToHwRate8190Pci(tcb_desc->data_rate);
-		tx_fwinfo->EnableCPUDur = tcb_desc->bTxEnableFwCalcDur;     
+		tx_fwinfo->EnableCPUDur = tcb_desc->bTxEnableFwCalcDur;
 		tx_fwinfo->Short = QueryIsShort(tx_fwinfo->TxHT, tx_fwinfo->TxRate, tcb_desc);
 		if(tcb_desc->bAMPDUEnable) {//AMPDU enabled
 			tx_fwinfo->AllowAggregation = 1;
 			/* DWORD 1 */
 			tx_fwinfo->RxMF = tcb_desc->ampdu_factor;
-			tx_fwinfo->RxAMD = tcb_desc->ampdu_density&0x07;//ampdudensity 
+			tx_fwinfo->RxAMD = tcb_desc->ampdu_density&0x07;//ampdudensity
 		} else {
 			tx_fwinfo->AllowAggregation = 0;
 			/* DWORD 1 */
@@ -1846,7 +1846,7 @@ struct sk_buff *DrvAggr_Aggregation(struct net_device *dev, struct ieee80211_drv
 		memset(tx_agg_desc, 0, sizeof(tx_desc_819x_usb_aggr_subframe));
 		/* DWORD 0 */
 		//tx_agg_desc->LINIP = 0;
-		//tx_agg_desc->CmdInit = 1; 
+		//tx_agg_desc->CmdInit = 1;
 		tx_agg_desc->Offset =  sizeof(tx_fwinfo_819x_usb) + 8;
 		/* already raw data, need not to substract header length */
 		tx_agg_desc->PktSize = skb->len & 0xffff;
@@ -1950,17 +1950,17 @@ struct sk_buff *DrvAggr_Aggregation(struct net_device *dev, struct ieee80211_drv
 }
 
 /* NOTE:
-	This function return a list of PTCB which is proper to be aggregate with the input TCB. 
+	This function return a list of PTCB which is proper to be aggregate with the input TCB.
 	If no proper TCB is found to do aggregation, SendList will only contain the input TCB.
 */
-u8 DrvAggr_GetAggregatibleList(struct net_device *dev, struct sk_buff *skb, 
+u8 DrvAggr_GetAggregatibleList(struct net_device *dev, struct sk_buff *skb,
 		struct ieee80211_drv_agg_txb *pSendList)
 {
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
 	struct ieee80211_device *ieee = netdev_priv(dev);
 #else
 	struct ieee80211_device *ieee = (struct ieee80211_device *)dev->priv;
-#endif	
+#endif
 	PRT_HIGH_THROUGHPUT	pHTInfo = ieee->pHTInfo;
 	u16		nMaxAggrNum = pHTInfo->UsbTxAggrNum;
 	cb_desc 	*tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE);
@@ -2026,14 +2026,14 @@ static void rtl8192_tx_isr(struct urb *tx_urb)
 
 	bToSend0Byte = false;
 	//
-	// Note that, we at most handle 1 MPDU to send here, either 
+	// Note that, we at most handle 1 MPDU to send here, either
 	// fragment or MPDU in wait queue.
 	//
 	if(!bToSend0Byte)
 #endif
 	{
 		//
-		// Handle HW Beacon: 
+		// Handle HW Beacon:
 		// We had transfer our beacon frame to host controler at this moment.
 		//
 #if 0
@@ -2057,19 +2057,19 @@ static void rtl8192_tx_isr(struct urb *tx_urb)
 				if(NULL != (skb = skb_dequeue(&(priv->ieee80211->skb_waitQ[queue_index]))))
 					priv->ieee80211->softmac_hard_start_xmit(skb, dev);
 
-				return; //modified by david to avoid further processing AMSDU 
+				return; //modified by david to avoid further processing AMSDU
 			}
 #ifdef USB_TX_DRIVER_AGGREGATION_ENABLE
 			else if ((skb_queue_len(&priv->ieee80211->skb_drv_aggQ[queue_index])!= 0)&&\
- 				(!(priv->ieee80211->queue_stop))) {
-				// Tx Driver Aggregation process 
-				/* The driver will aggregation the packets according to the following stets  
-				 * 1. check whether there's tx irq available, for it's a completion return 
+				(!(priv->ieee80211->queue_stop))) {
+				// Tx Driver Aggregation process
+				/* The driver will aggregation the packets according to the following stets
+				 * 1. check whether there's tx irq available, for it's a completion return
 				 *    function, it should contain enough tx irq;
 				 * 2. check pakcet type;
-				 * 3. intialize sendlist, check whether the to-be send packet no greater than 1 
+				 * 3. intialize sendlist, check whether the to-be send packet no greater than 1
 				 * 4. aggregation the packets, and fill firmware info and tx desc to it, etc.
-				 * 5. check whehter the packet could be sent, otherwise just insert to wait head 
+				 * 5. check whehter the packet could be sent, otherwise just insert to wait head
 				 * */
 				skb = skb_dequeue(&priv->ieee80211->skb_drv_aggQ[queue_index]);
 				if(!check_nic_enough_desc(dev, queue_index)) {
@@ -2081,12 +2081,12 @@ static void rtl8192_tx_isr(struct urb *tx_urb)
 					/*TODO*/
 					/*
 					u8* pHeader = skb->data;
-					
-					if(IsMgntQosData(pHeader) || 
-				            IsMgntQData_Ack(pHeader) || 
-					    IsMgntQData_Poll(pHeader) || 
-					    IsMgntQData_Poll_Ack(pHeader) 
-					  ) 
+
+					if(IsMgntQosData(pHeader) ||
+					    IsMgntQData_Ack(pHeader) ||
+					    IsMgntQData_Poll(pHeader) ||
+					    IsMgntQData_Poll_Ack(pHeader)
+					  )
 					*/
 					{
 						struct ieee80211_drv_agg_txb SendList;
@@ -2098,7 +2098,7 @@ static void rtl8192_tx_isr(struct urb *tx_urb)
 #if 0
 						printk("=============>to send aggregated packet!\n");
 						RT_DEBUG_DATA(COMP_SEND, skb->cb, sizeof(skb->cb));
-						printk("\n=================skb->len = %d\n", skb->len);	
+						printk("\n=================skb->len = %d\n", skb->len);
 						RT_DEBUG_DATA(COMP_SEND, skb->data, skb->len);
 #endif
 						}
@@ -2116,7 +2116,7 @@ static void rtl8192_tx_isr(struct urb *tx_urb)
 		RT_TRACE( COMP_SEND,"HalUsbOutComplete(%d): bToSend0Byte.\n", PipeIndex);
 
 		//
-		// In this case, we don't return skb now. 
+		// In this case, we don't return skb now.
 		// It will be returned when the 0-byte request completed.
 		//
 
@@ -2144,7 +2144,7 @@ void rtl8192_beacon_stop(struct net_device *dev)
 	if ((msrm == (MSR_LINK_ADHOC<<MSR_LINK_SHIFT) ||
 		(msrm == (MSR_LINK_MASTER<<MSR_LINK_SHIFT)))){
 		write_nic_byte(dev, MSR, msr2 | MSR_LINK_NONE);
-		write_nic_byte(dev, MSR, msr);	
+		write_nic_byte(dev, MSR, msr);
 	}
 }
 
@@ -2154,7 +2154,7 @@ void rtl8192_config_rate(struct net_device* dev, u16* rate_config)
 	 struct ieee80211_network *net;
 	 u8 i=0, basic_rate = 0;
 	 net = & priv->ieee80211->current_network;
-	 
+
 	 for (i=0; i<net->rates_len; i++)
 	 {
 		 basic_rate = net->rates[i]&0x7f;
@@ -2194,8 +2194,8 @@ void rtl8192_config_rate(struct net_device* dev, u16* rate_config)
 		 }
 	 }
 }
-			 
-	 
+
+
 #define SHORT_SLOT_TIME 9
 #define NON_SHORT_SLOT_TIME 20
 
@@ -2232,8 +2232,8 @@ void rtl8192_net_update(struct net_device *dev)
 	u16 BcnTimeCfg = 0, BcnCW = 6, BcnIFS = 0xf;
 	u16 rate_config = 0;
 	net = & priv->ieee80211->current_network;
-	
-	rtl8192_config_rate(dev, &rate_config);	
+
+	rtl8192_config_rate(dev, &rate_config);
 	priv->basic_rate = rate_config &= 0x15f;
 
 	write_nic_dword(dev,BSSIDR,((u32*)net->bssid)[0]);
@@ -2246,19 +2246,19 @@ void rtl8192_net_update(struct net_device *dev)
 	if (priv->ieee80211->iw_mode == IW_MODE_ADHOC)
 	{
 	write_nic_word(dev, ATIMWND, 2);
-	write_nic_word(dev, BCN_DMATIME, 1023);	
+	write_nic_word(dev, BCN_DMATIME, 1023);
 	write_nic_word(dev, BCN_INTERVAL, net->beacon_interval);
 //	write_nic_word(dev, BcnIntTime, 100);
 	write_nic_word(dev, BCN_DRV_EARLY_INT, 1);
 	write_nic_byte(dev, BCN_ERR_THRESH, 100);
 		BcnTimeCfg |= (BcnCW<<BCN_TCFG_CW_SHIFT);
 	// TODO: BcnIFS may required to be changed on ASIC
-	 	BcnTimeCfg |= BcnIFS<<BCN_TCFG_IFS;
+		BcnTimeCfg |= BcnIFS<<BCN_TCFG_IFS;
 
 	write_nic_word(dev, BCN_TCFG, BcnTimeCfg);
 	}
 
-	
+
 
 }
 
@@ -2277,7 +2277,7 @@ void rtl819xusb_beacon_tx(struct net_device *dev,u16  tx_rate)
 	rtl8192_net_update(dev);
 
 	skb = ieee80211_get_beacon(priv->ieee80211);
-		if(!skb){ 
+		if(!skb){
 			DMESG("not enought memory for allocating beacon");
 			return;
 		}
@@ -2313,7 +2313,7 @@ inline u8 rtl8192_IsWirelessBMode(u16 rate)
 
 u16 N_DBPSOfRate(u16 DataRate);
 
-u16 ComputeTxTime( 
+u16 ComputeTxTime(
 	u16		FrameLength,
 	u16		DataRate,
 	u8		bManagementFrame,
@@ -2328,7 +2328,7 @@ u16 ComputeTxTime(
 	{
 		if( bManagementFrame || !bShortPreamble || DataRate == 10 )
 		{	// long preamble
-			FrameTime = (u16)(144+48+(FrameLength*8/(DataRate/10)));		
+			FrameTime = (u16)(144+48+(FrameLength*8/(DataRate/10)));
 		}
 		else
 		{	// Short preamble
@@ -2338,7 +2338,7 @@ u16 ComputeTxTime(
 				FrameTime ++;
 	} else {	//802.11g DSSS-OFDM PLCP length field calculation.
 		N_DBPS = N_DBPSOfRate(DataRate);
-		Ceiling = (16 + 8*FrameLength + 6) / N_DBPS 
+		Ceiling = (16 + 8*FrameLength + 6) / N_DBPS
 				+ (((16 + 8*FrameLength + 6) % N_DBPS) ? 1 : 0);
 		FrameTime = (u16)(16 + 4 + 4*Ceiling + 6);
 	}
@@ -2348,45 +2348,45 @@ u16 ComputeTxTime(
 u16 N_DBPSOfRate(u16 DataRate)
 {
 	 u16 N_DBPS = 24;
-	 
+
 	 switch(DataRate)
 	 {
 	 case 60:
 	  N_DBPS = 24;
 	  break;
-	 
+
 	 case 90:
 	  N_DBPS = 36;
 	  break;
-	 
+
 	 case 120:
 	  N_DBPS = 48;
 	  break;
-	 
+
 	 case 180:
 	  N_DBPS = 72;
 	  break;
-	 
+
 	 case 240:
 	  N_DBPS = 96;
 	  break;
-	 
+
 	 case 360:
 	  N_DBPS = 144;
 	  break;
-	 
+
 	 case 480:
 	  N_DBPS = 192;
 	  break;
-	 
+
 	 case 540:
 	  N_DBPS = 216;
 	  break;
-	 
+
 	 default:
 	  break;
 	 }
-	 
+
 	 return N_DBPS;
 }
 
@@ -2402,7 +2402,7 @@ void rtl819xU_cmd_isr(struct urb *tx_cmd_urb, struct pt_regs *regs)
 	if(tx_cmd_urb->status != 0) {
 		priv->pFirmware.firmware_seg_index = 0; //only begin transter, should it can be set to 1
 	}
-	
+
 	/* Free the urb and the corresponding buf for common Tx cmd packet, or
 	 * last segment of each firmware img.
 	 */
@@ -2416,7 +2416,7 @@ void rtl819xU_cmd_isr(struct urb *tx_cmd_urb, struct pt_regs *regs)
 		if(priv->pFirmware.firmware_seg_index == priv->pFirmware.firmware_seg_maxnum) {
 			last_init_packet = 1;
 		}
-		
+
 		cmd_buf_len = priv->pFirmware.firmware_seg_container[priv->pFirmware.firmware_seg_index-1].seg_size;
 		ptr_cmd_buf = priv->pFfirmware.firmware_seg_container[priv->pFfirmware.firmware_seg_index-1].seg_ptr;
 		rtl819xU_tx_cmd(dev, ptr_cmd_buf, cmd_buf_len, last_init_packet, DESC_PACKET_TYPE_INIT);
@@ -2445,10 +2445,10 @@ short rtl819xU_tx_cmd(struct net_device *dev, struct sk_buff *skb)
 	struct urb		*tx_urb;
 	//int			urb_buf_len;
 	unsigned int 		idx_pipe;
-	tx_desc_cmd_819x_usb *pdesc = (tx_desc_cmd_819x_usb *)skb->data; 
+	tx_desc_cmd_819x_usb *pdesc = (tx_desc_cmd_819x_usb *)skb->data;
 	cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE);
 	u8 queue_index = tcb_desc->queue_index;
-	
+
 	//printk("\n %s::queue_index = %d\n",__FUNCTION__, queue_index);
 	atomic_inc(&priv->tx_pending[queue_index]);
 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
@@ -2460,7 +2460,7 @@ short rtl819xU_tx_cmd(struct net_device *dev, struct sk_buff *skb)
 		dev_kfree_skb(skb);
 		return -ENOMEM;
 	}
-	
+
 	memset(pdesc, 0, USB_HWDESC_HEADER_LEN);
 	/* Tx descriptor ought to be set according to the skb->cb */
 	pdesc->FirstSeg = 1;//bFirstSeg;
@@ -2509,11 +2509,11 @@ short rtl819xU_tx_cmd(struct net_device *dev, struct sk_buff *skb)
  * in TxFwInfo data structure
  * 2006.10.30 by Emily
  *
- * \param QUEUEID       Software Queue       
+ * \param QUEUEID       Software Queue
 */
 u8 MapHwQueueToFirmwareQueue(u8 QueueID)
 {
-	u8 QueueSelect = 0x0;       //defualt set to 
+	u8 QueueSelect = 0x0;       //defualt set to
 
 	switch(QueueID) {
 		case BE_QUEUE:
@@ -2529,7 +2529,7 @@ u8 MapHwQueueToFirmwareQueue(u8 QueueID)
 			break;
 
 		case VI_QUEUE:
-			QueueSelect = QSLT_VI;  //or QSelect = pTcb->priority;  
+			QueueSelect = QSLT_VI;  //or QSelect = pTcb->priority;
 			break;
 		case MGNT_QUEUE:
 			QueueSelect = QSLT_MGNT;
@@ -2540,7 +2540,7 @@ u8 MapHwQueueToFirmwareQueue(u8 QueueID)
 			break;
 
 			// TODO: 2006.10.30 mark other queue selection until we verify it is OK
-			// TODO: Remove Assertions 
+			// TODO: Remove Assertions
 //#if (RTL819X_FPGA_VER & RTL819X_FPGA_GUANGAN_070502)
 		case TXCMD_QUEUE:
 			QueueSelect = QSLT_CMD;
@@ -2621,8 +2621,8 @@ static void tx_zero_isr(struct urb *tx_urb)
 	return;
 }
 
-/* 
- * The tx procedure is just as following, 
+/*
+ * The tx procedure is just as following,
  * skb->cb will contain all the following information,
  * priority, morefrag, rate, &dev.
  * */
@@ -2636,18 +2636,18 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff* skb)
 	int pend;
 	int status;
 	struct urb *tx_urb = NULL, *tx_urb_zero = NULL;
-	//int urb_len;		
+	//int urb_len;
 	unsigned int idx_pipe;
 //	RT_DEBUG_DATA(COMP_SEND, tcb_desc, sizeof(cb_desc));
 #if 0
 	/* Added by Annie for filling Len_Adjust field. 2005-12-14. */
-        RT_ENC_ALG  EncAlg = NO_Encryption; 
+	RT_ENC_ALG  EncAlg = NO_Encryption;
 #endif
 //	printk("=============> %s\n", __FUNCTION__);
 	pend = atomic_read(&priv->tx_pending[tcb_desc->queue_index]);
-	/* we are locked here so the two atomic_read and inc are executed 
-	 * without interleaves 
-	 * !!! For debug purpose 	 
+	/* we are locked here so the two atomic_read and inc are executed
+	 * without interleaves
+	 * !!! For debug purpose
 	 */
 	if( pend > MAX_TX_URB){
 #if 0
@@ -2663,9 +2663,9 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff* skb)
 				break;
 			default://BK_PRIORITY
 				priv->stats.txbkdrop++;
-				break;	
+				break;
 		}
-#endif	
+#endif
 		printk("To discard skb packet!\n");
 		dev_kfree_skb_any(skb);
 		return -1;
@@ -2686,13 +2686,13 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff* skb)
 	/* DWORD 0 */
 	tx_fwinfo->TxHT = (tcb_desc->data_rate&0x80)?1:0;
 	tx_fwinfo->TxRate = MRateToHwRate8190Pci(tcb_desc->data_rate);
-	tx_fwinfo->EnableCPUDur = tcb_desc->bTxEnableFwCalcDur;     
+	tx_fwinfo->EnableCPUDur = tcb_desc->bTxEnableFwCalcDur;
 	tx_fwinfo->Short = QueryIsShort(tx_fwinfo->TxHT, tx_fwinfo->TxRate, tcb_desc);
 	if(tcb_desc->bAMPDUEnable) {//AMPDU enabled
 		tx_fwinfo->AllowAggregation = 1;
 		/* DWORD 1 */
 		tx_fwinfo->RxMF = tcb_desc->ampdu_factor;
-		tx_fwinfo->RxAMD = tcb_desc->ampdu_density&0x07;//ampdudensity 
+		tx_fwinfo->RxAMD = tcb_desc->ampdu_density&0x07;//ampdudensity
 	} else {
 		tx_fwinfo->AllowAggregation = 0;
 		/* DWORD 1 */
@@ -2735,9 +2735,9 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff* skb)
 	/* Fill Tx descriptor */
 	memset(tx_desc, 0, sizeof(tx_desc_819x_usb));
 	/* DWORD 0 */
-        tx_desc->LINIP = 0;
-        tx_desc->CmdInit = 1; 
-        tx_desc->Offset =  sizeof(tx_fwinfo_819x_usb) + 8;
+	tx_desc->LINIP = 0;
+	tx_desc->CmdInit = 1;
+	tx_desc->Offset =  sizeof(tx_fwinfo_819x_usb) + 8;
 
 #ifdef USB_TX_DRIVER_AGGREGATION_ENABLE
 	if (tcb_desc->drv_agg_enable) {
@@ -2828,18 +2828,18 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff* skb)
 	tx_desc->DISFB = tcb_desc->bTxDisableRateFallBack;
 	tx_desc->USERATE = tcb_desc->bTxUseDriverAssingedRate;
 
-        /* Fill fields that are required to be initialized in all of the descriptors */
-        //DWORD 0
-#if 0	
-        tx_desc->FirstSeg = (tcb_desc->bFirstSeg)? 1:0;
-        tx_desc->LastSeg = (tcb_desc->bLastSeg)?1:0;
-#else 
-        tx_desc->FirstSeg = 1;
-        tx_desc->LastSeg = 1;
+	/* Fill fields that are required to be initialized in all of the descriptors */
+	//DWORD 0
+#if 0
+	tx_desc->FirstSeg = (tcb_desc->bFirstSeg)? 1:0;
+	tx_desc->LastSeg = (tcb_desc->bLastSeg)?1:0;
+#else
+	tx_desc->FirstSeg = 1;
+	tx_desc->LastSeg = 1;
 #endif
-        tx_desc->OWN = 1;
+	tx_desc->OWN = 1;
 
-#ifdef USB_TX_DRIVER_AGGREGATION_ENABLE	
+#ifdef USB_TX_DRIVER_AGGREGATION_ENABLE
 	if (tcb_desc->drv_agg_enable) {
 		tx_desc->TxBufferSize = tcb_desc->pkt_size + sizeof(tx_fwinfo_819x_usb);
 	} else
@@ -2881,7 +2881,7 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff* skb)
 		{
 			if (skb->len > 0 && skb->len % 64 == 0)
 				bSend0Byte = true;
-		} 
+		}
 		if (bSend0Byte)
 		{
 #if 1
@@ -2921,7 +2921,7 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff* skb)
 short rtl8192_usb_initendpoints(struct net_device *dev)
 {
 	struct r8192_priv *priv = ieee80211_priv(dev);
-	
+
 	priv->rx_urb = (struct urb**) kmalloc (sizeof(struct urb*) * (MAX_RX_URB+1), GFP_KERNEL);
 
 #ifndef JACKSON_NEW_RX
@@ -2934,17 +2934,17 @@ short rtl8192_usb_initendpoints(struct net_device *dev)
 #endif
 
 		priv->rx_urb[i]->transfer_buffer = kmalloc(RX_URB_SIZE, GFP_KERNEL);
-			
+
 		priv->rx_urb[i]->transfer_buffer_length = RX_URB_SIZE;
 	}
 #endif
 
 #ifdef THOMAS_BEACON
-{	
+{
 	long align = 0;
 	void *oldaddr, *newaddr;
 
-	priv->rx_urb[16] = usb_alloc_urb(0, GFP_KERNEL);		
+	priv->rx_urb[16] = usb_alloc_urb(0, GFP_KERNEL);
 	priv->oldaddr = kmalloc(16, GFP_KERNEL);
 	oldaddr = priv->oldaddr;
 	align = ((long)oldaddr) & 3;
@@ -2958,59 +2958,59 @@ short rtl8192_usb_initendpoints(struct net_device *dev)
 	priv->rx_urb[16]->transfer_buffer = newaddr;
 }
 #endif
-       
-        memset(priv->rx_urb, 0, sizeof(struct urb*) * MAX_RX_URB);
-        priv->pp_rxskb = (struct sk_buff **)kmalloc(sizeof(struct sk_buff *) * MAX_RX_URB, GFP_KERNEL);
-        if (priv->pp_rxskb == NULL)
-                goto destroy;
 
-        memset(priv->pp_rxskb, 0, sizeof(struct sk_buff*) * MAX_RX_URB);
+	memset(priv->rx_urb, 0, sizeof(struct urb*) * MAX_RX_URB);
+	priv->pp_rxskb = (struct sk_buff **)kmalloc(sizeof(struct sk_buff *) * MAX_RX_URB, GFP_KERNEL);
+	if (priv->pp_rxskb == NULL)
+		goto destroy;
+
+	memset(priv->pp_rxskb, 0, sizeof(struct sk_buff*) * MAX_RX_URB);
 
-        goto _middle;
+	goto _middle;
 
 
 destroy:
-        if (priv->pp_rxskb) {
-                kfree(priv->pp_rxskb);
-        }
-        if (priv->rx_urb) {
-                kfree(priv->rx_urb);
-        }
-
-        priv->pp_rxskb = NULL;
+	if (priv->pp_rxskb) {
+		kfree(priv->pp_rxskb);
+	}
+	if (priv->rx_urb) {
+		kfree(priv->rx_urb);
+	}
+
+	priv->pp_rxskb = NULL;
 	priv->rx_urb = NULL;
 
-        DMESGE("Endpoint Alloc Failure");
-        return -ENOMEM;
-	
+	DMESGE("Endpoint Alloc Failure");
+	return -ENOMEM;
+
 
 _middle:
 
 	printk("End of initendpoints\n");
 	return 0;
-	
+
 }
 #ifdef THOMAS_BEACON
 void rtl8192_usb_deleteendpoints(struct net_device *dev)
-{	
+{
 	int i;
 	struct r8192_priv *priv = ieee80211_priv(dev);
-	
+
 	if(priv->rx_urb){
 		for(i=0;i<(MAX_RX_URB+1);i++){
 			usb_kill_urb(priv->rx_urb[i]);
 			usb_free_urb(priv->rx_urb[i]);
 		}
 		kfree(priv->rx_urb);
-		priv->rx_urb = NULL;	
-	}	
+		priv->rx_urb = NULL;
+	}
 	if(priv->oldaddr){
 		kfree(priv->oldaddr);
 		priv->oldaddr = NULL;
-	}	
-        if (priv->pp_rxskb) {
-                kfree(priv->pp_rxskb);
-                priv->pp_rxskb = 0;
+	}
+	if (priv->pp_rxskb) {
+		kfree(priv->pp_rxskb);
+		priv->pp_rxskb = 0;
 	}
 }
 #else
@@ -3020,7 +3020,7 @@ void rtl8192_usb_deleteendpoints(struct net_device *dev)
 	struct r8192_priv *priv = ieee80211_priv(dev);
 
 #ifndef JACKSON_NEW_RX
-	
+
 	if(priv->rx_urb){
 		for(i=0;i<(MAX_RX_URB+1);i++){
 			usb_kill_urb(priv->rx_urb[i]);
@@ -3029,24 +3029,24 @@ void rtl8192_usb_deleteendpoints(struct net_device *dev)
 		}
 		kfree(priv->rx_urb);
 		priv->rx_urb = NULL;
-		
+
 	}
 #else
 	if(priv->rx_urb){
-                kfree(priv->rx_urb);
-                priv->rx_urb = NULL;
-        }
+		kfree(priv->rx_urb);
+		priv->rx_urb = NULL;
+	}
 	if(priv->oldaddr){
 		kfree(priv->oldaddr);
 		priv->oldaddr = NULL;
-	}	
-        if (priv->pp_rxskb) {
-                kfree(priv->pp_rxskb);
-                priv->pp_rxskb = 0;
+	}
+	if (priv->pp_rxskb) {
+		kfree(priv->pp_rxskb);
+		priv->pp_rxskb = 0;
 
-        }
+	}
 
-#endif	
+#endif
 }
 #endif
 
@@ -3058,14 +3058,14 @@ void rtl8192_set_rate(struct net_device *dev)
 	int basic_rate,min_rr_rate,max_rr_rate;
 
 //	struct r8192_priv *priv = ieee80211_priv(dev);
-	
-	//if (ieee80211_is_54g(priv->ieee80211->current_network) && 
+
+	//if (ieee80211_is_54g(priv->ieee80211->current_network) &&
 //		priv->ieee80211->state == IEEE80211_LINKED){
 	basic_rate = ieeerate2rtlrate(240);
 	min_rr_rate = ieeerate2rtlrate(60);
 	max_rr_rate = ieeerate2rtlrate(240);
-	
-//	
+
+//
 //	}else{
 //		basic_rate = ieeerate2rtlrate(20);
 //		min_rr_rate = ieeerate2rtlrate(10);
@@ -3078,7 +3078,7 @@ void rtl8192_set_rate(struct net_device *dev)
 	//word  = read_nic_word(dev, BRSR);
 	word  = read_nic_word(dev, BRSR_8187);
 	word &= ~BRSR_MBR_8185;
-		
+
 
 	for(i=0;i<=basic_rate;i++)
 		word |= (1<<i);
@@ -3092,7 +3092,7 @@ extern void rtl8192_update_ratr_table(struct net_device* dev);
 void rtl8192_link_change(struct net_device *dev)
 {
 //	int i;
-	
+
 	struct r8192_priv *priv = ieee80211_priv(dev);
 	struct ieee80211_device* ieee = priv->ieee80211;
 	//write_nic_word(dev, BCN_INTR_ITV, net->beacon_interval);
@@ -3110,39 +3110,39 @@ void rtl8192_link_change(struct net_device *dev)
 //	RT_TRACE(COMP_CH, "========>%s(), chan:%d\n", __FUNCTION__, priv->chan);
 //	rtl8192_set_chan(dev, priv->chan);
 	 if (ieee->iw_mode == IW_MODE_INFRA || ieee->iw_mode == IW_MODE_ADHOC)
-        {
-                u32 reg = 0;
-                reg = read_nic_dword(dev, RCR);
-                if (priv->ieee80211->state == IEEE80211_LINKED)
-                        priv->ReceiveConfig = reg |= RCR_CBSSID;
-                else
-                        priv->ReceiveConfig = reg &= ~RCR_CBSSID;
-                write_nic_dword(dev, RCR, reg);
-        }
+	{
+		u32 reg = 0;
+		reg = read_nic_dword(dev, RCR);
+		if (priv->ieee80211->state == IEEE80211_LINKED)
+			priv->ReceiveConfig = reg |= RCR_CBSSID;
+		else
+			priv->ReceiveConfig = reg &= ~RCR_CBSSID;
+		write_nic_dword(dev, RCR, reg);
+	}
 
 //	rtl8192_set_rxconf(dev);
 }
 
 static struct ieee80211_qos_parameters def_qos_parameters = {
-        {3,3,3,3},/* cw_min */
-        {7,7,7,7},/* cw_max */
-        {2,2,2,2},/* aifs */ 
-        {0,0,0,0},/* flags */ 
-        {0,0,0,0} /* tx_op_limit */
+	{3,3,3,3},/* cw_min */
+	{7,7,7,7},/* cw_max */
+	{2,2,2,2},/* aifs */
+	{0,0,0,0},/* flags */
+	{0,0,0,0} /* tx_op_limit */
 };
 
 
 #if LINUX_VERSION_CODE >=KERNEL_VERSION(2,6,20)
 void rtl8192_update_beacon(struct work_struct * work)
 {
-        struct r8192_priv *priv = container_of(work, struct r8192_priv, update_beacon_wq.work);
-        struct net_device *dev = priv->ieee80211->dev;
+	struct r8192_priv *priv = container_of(work, struct r8192_priv, update_beacon_wq.work);
+	struct net_device *dev = priv->ieee80211->dev;
 #else
 void rtl8192_update_beacon(struct net_device *dev)
 {
-        struct r8192_priv *priv = ieee80211_priv(dev);
+	struct r8192_priv *priv = ieee80211_priv(dev);
 #endif
- 	struct ieee80211_device* ieee = priv->ieee80211;
+	struct ieee80211_device* ieee = priv->ieee80211;
 	struct ieee80211_network* net = &ieee->current_network;
 
 	if (ieee->pHTInfo->bCurrentHTSupport)
@@ -3157,37 +3157,37 @@ int WDCAPARA_ADD[] = {EDCAPARA_BE,EDCAPARA_BK,EDCAPARA_VI,EDCAPARA_VO};
 #if LINUX_VERSION_CODE >=KERNEL_VERSION(2,6,20)
 void rtl8192_qos_activate(struct work_struct * work)
 {
-        struct r8192_priv *priv = container_of(work, struct r8192_priv, qos_activate);
-        struct net_device *dev = priv->ieee80211->dev;
+	struct r8192_priv *priv = container_of(work, struct r8192_priv, qos_activate);
+	struct net_device *dev = priv->ieee80211->dev;
 #else
 void rtl8192_qos_activate(struct net_device *dev)
 {
-        struct r8192_priv *priv = ieee80211_priv(dev);
+	struct r8192_priv *priv = ieee80211_priv(dev);
 #endif
-        struct ieee80211_qos_parameters *qos_parameters = &priv->ieee80211->current_network.qos_data.parameters;
-        u8 mode = priv->ieee80211->current_network.mode;
-        //u32 size = sizeof(struct ieee80211_qos_parameters);
+	struct ieee80211_qos_parameters *qos_parameters = &priv->ieee80211->current_network.qos_data.parameters;
+	u8 mode = priv->ieee80211->current_network.mode;
+	//u32 size = sizeof(struct ieee80211_qos_parameters);
 	u8  u1bAIFS;
 	u32 u4bAcParam;
-        int i;
+	int i;
 
-        if (priv == NULL)
-                return;
+	if (priv == NULL)
+		return;
 
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16))
 	down(&priv->mutex);
 #else
        mutex_lock(&priv->mutex);
 #endif
-        if(priv->ieee80211->state != IEEE80211_LINKED)
+	if(priv->ieee80211->state != IEEE80211_LINKED)
 		goto success;
 	RT_TRACE(COMP_QOS,"qos active process with associate response received\n");
 	/* It better set slot time at first */
-	/* For we just support b/g mode at present, let the slot time at 9/20 selection */	
+	/* For we just support b/g mode at present, let the slot time at 9/20 selection */
 	/* update the ac parameter to related registers */
 	for(i = 0; i <  QOS_QUEUE_NUM; i++) {
 		//Mode G/A: slotTimeTimer = 9; Mode B: 20
-		u1bAIFS = qos_parameters->aifs[i] * ((mode&(IEEE_G|IEEE_N_24G)) ?9:20) + aSifsTime; 
+		u1bAIFS = qos_parameters->aifs[i] * ((mode&(IEEE_G|IEEE_N_24G)) ?9:20) + aSifsTime;
 		u4bAcParam = ((((u32)(qos_parameters->tx_op_limit[i]))<< AC_PARAM_TXOP_LIMIT_OFFSET)|
 				(((u32)(qos_parameters->cw_max[i]))<< AC_PARAM_ECW_MAX_OFFSET)|
 				(((u32)(qos_parameters->cw_min[i]))<< AC_PARAM_ECW_MIN_OFFSET)|
@@ -3213,10 +3213,10 @@ static int rtl8192_qos_handle_probe_response(struct r8192_priv *priv,
 	u32 size = sizeof(struct ieee80211_qos_parameters);
 
 	if(priv->ieee80211->state !=IEEE80211_LINKED)
-                return ret;
+		return ret;
 
-        if ((priv->ieee80211->iw_mode != IW_MODE_INFRA))
-                return ret;
+	if ((priv->ieee80211->iw_mode != IW_MODE_INFRA))
+		return ret;
 
 	if (network->flags & NETWORK_HAS_QOS_MASK) {
 		if (active_network &&
@@ -3229,7 +3229,7 @@ static int rtl8192_qos_handle_probe_response(struct r8192_priv *priv,
 				 network->qos_data.param_count)) {
 			network->qos_data.old_param_count =
 				network->qos_data.param_count;
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)  
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
 			queue_work(priv->priv_wq, &priv->qos_activate);
 #else
 			schedule_task(&priv->qos_activate);
@@ -3242,7 +3242,7 @@ static int rtl8192_qos_handle_probe_response(struct r8192_priv *priv,
 		       &def_qos_parameters, size);
 
 		if ((network->qos_data.active == 1) && (active_network == 1)) {
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)  
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
 			queue_work(priv->priv_wq, &priv->qos_activate);
 #else
 			schedule_task(&priv->qos_activate);
@@ -3258,8 +3258,8 @@ static int rtl8192_qos_handle_probe_response(struct r8192_priv *priv,
 
 /* handle manage frame frame beacon and probe response */
 static int rtl8192_handle_beacon(struct net_device * dev,
-                              struct ieee80211_beacon * beacon,
-                              struct ieee80211_network * network)
+			      struct ieee80211_beacon * beacon,
+			      struct ieee80211_network * network)
 {
 	struct r8192_priv *priv = ieee80211_priv(dev);
 
@@ -3284,23 +3284,23 @@ static int rtl8192_handle_beacon(struct net_device * dev,
 * setting
 */
 static int rtl8192_qos_association_resp(struct r8192_priv *priv,
-                                    struct ieee80211_network *network)
+				    struct ieee80211_network *network)
 {
-        int ret = 0;
-        unsigned long flags;
-        u32 size = sizeof(struct ieee80211_qos_parameters);
-        int set_qos_param = 0;
+	int ret = 0;
+	unsigned long flags;
+	u32 size = sizeof(struct ieee80211_qos_parameters);
+	int set_qos_param = 0;
 
-        if ((priv == NULL) || (network == NULL))
-                return ret;
+	if ((priv == NULL) || (network == NULL))
+		return ret;
 
 	if(priv->ieee80211->state !=IEEE80211_LINKED)
-                return ret;
+		return ret;
 
-        if ((priv->ieee80211->iw_mode != IW_MODE_INFRA))
-                return ret;
+	if ((priv->ieee80211->iw_mode != IW_MODE_INFRA))
+		return ret;
 
-        spin_lock_irqsave(&priv->ieee80211->lock, flags);
+	spin_lock_irqsave(&priv->ieee80211->lock, flags);
 	if(network->flags & NETWORK_HAS_QOS_PARAMETERS) {
 		memcpy(&priv->ieee80211->current_network.qos_data.parameters,\
 			 &network->qos_data.parameters,\
@@ -3311,43 +3311,43 @@ static int rtl8192_qos_association_resp(struct r8192_priv *priv,
 					network->qos_data.param_count))
 #endif
 		 {
-                        set_qos_param = 1;
+			set_qos_param = 1;
 			/* update qos parameter for current network */
 			priv->ieee80211->current_network.qos_data.old_param_count = \
 				 priv->ieee80211->current_network.qos_data.param_count;
 			priv->ieee80211->current_network.qos_data.param_count = \
-			     	 network->qos_data.param_count;
+				 network->qos_data.param_count;
 		}
-        } else {
+	} else {
 		memcpy(&priv->ieee80211->current_network.qos_data.parameters,\
 		       &def_qos_parameters, size);
 		priv->ieee80211->current_network.qos_data.active = 0;
 		priv->ieee80211->current_network.qos_data.supported = 0;
-                set_qos_param = 1;
-        }
+		set_qos_param = 1;
+	}
 
-        spin_unlock_irqrestore(&priv->ieee80211->lock, flags);
+	spin_unlock_irqrestore(&priv->ieee80211->lock, flags);
 
 	RT_TRACE(COMP_QOS, "%s: network->flags = %d,%d\n",__FUNCTION__,network->flags ,priv->ieee80211->current_network.qos_data.active);
 	if (set_qos_param == 1)
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)  
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
 		queue_work(priv->priv_wq, &priv->qos_activate);
 #else
 		schedule_task(&priv->qos_activate);
 #endif
 
 
-        return ret;
+	return ret;
 }
 
 
 static int rtl8192_handle_assoc_response(struct net_device *dev,
-                                     struct ieee80211_assoc_response_frame *resp,
-                                     struct ieee80211_network *network)
+				     struct ieee80211_assoc_response_frame *resp,
+				     struct ieee80211_network *network)
 {
-        struct r8192_priv *priv = ieee80211_priv(dev);
-        rtl8192_qos_association_resp(priv, network);
-        return 0;
+	struct r8192_priv *priv = ieee80211_priv(dev);
+	rtl8192_qos_association_resp(priv, network);
+	return 0;
 }
 
 
@@ -3388,14 +3388,14 @@ void rtl8192_update_ratr_table(struct net_device* dev)
 			}
 			break;
 		default:
-			break; 
+			break;
 	}
 	ratr_value &= 0x0FFFFFFF;
 	if(ieee->pHTInfo->bCurTxBW40MHz && ieee->pHTInfo->bCurShortGI40MHz){
 		ratr_value |= 0x80000000;
 	}else if(!ieee->pHTInfo->bCurTxBW40MHz && ieee->pHTInfo->bCurShortGI20MHz){
 		ratr_value |= 0x80000000;
-	}	
+	}
 	write_nic_dword(dev, RATR0+rate_index*4, ratr_value);
 	write_nic_byte(dev, UFWP, 1);
 }
@@ -3408,13 +3408,13 @@ bool GetNmodeSupportBySecCfg8192(struct net_device*dev)
 	struct r8192_priv* priv = ieee80211_priv(dev);
 	struct ieee80211_device* ieee = priv->ieee80211;
 	struct ieee80211_network * network = &ieee->current_network;
-        int wpa_ie_len= ieee->wpa_ie_len;
-        struct ieee80211_crypt_data* crypt;
-        int encrypt;
-                             
-        crypt = ieee->crypt[ieee->tx_keyidx];
+	int wpa_ie_len= ieee->wpa_ie_len;
+	struct ieee80211_crypt_data* crypt;
+	int encrypt;
+
+	crypt = ieee->crypt[ieee->tx_keyidx];
 	//we use connecting AP's capability instead of only security config on our driver to distinguish whether it should use N mode or G mode
-        encrypt = (network->capability & WLAN_CAPABILITY_PRIVACY) || (ieee->host_encrypt && crypt && crypt->ops && (0 == strcmp(crypt->ops->name,"WEP")));
+	encrypt = (network->capability & WLAN_CAPABILITY_PRIVACY) || (ieee->host_encrypt && crypt && crypt->ops && (0 == strcmp(crypt->ops->name,"WEP")));
 
 	/* simply judge  */
 	if(encrypt && (wpa_ie_len == 0)) {
@@ -3423,7 +3423,7 @@ bool GetNmodeSupportBySecCfg8192(struct net_device*dev)
 //	} else if((wpa_ie_len != 0)&&(memcmp(&(ieee->wpa_ie[14]),ccmp_ie,4))) {
 	} else if((wpa_ie_len != 0)) {
 		/* parse pairwise key type */
-		//if((pairwisekey = WEP40)||(pairwisekey = WEP104)||(pairwisekey = TKIP)) 
+		//if((pairwisekey = WEP40)||(pairwisekey = WEP104)||(pairwisekey = TKIP))
 		if (((ieee->wpa_ie[0] == 0xdd) && (!memcmp(&(ieee->wpa_ie[14]),ccmp_ie,4))) || ((ieee->wpa_ie[0] == 0x30) && (!memcmp(&ieee->wpa_ie[10],ccmp_rsn_ie, 4))))
 			return true;
 		else
@@ -3431,18 +3431,18 @@ bool GetNmodeSupportBySecCfg8192(struct net_device*dev)
 	} else {
 		return true;
 	}
-	
+
 #if 0
-        //In here we discuss with SD4 David. He think we still can send TKIP in broadcast group key in MCS rate.
-        //We can't force in G mode if Pairwie key is AES and group key is TKIP
-        if((pSecInfo->GroupEncAlgorithm == WEP104_Encryption) || (pSecInfo->GroupEncAlgorithm == WEP40_Encryption)  ||
-           (pSecInfo->PairwiseEncAlgorithm == WEP104_Encryption) ||
-           (pSecInfo->PairwiseEncAlgorithm == WEP40_Encryption) || (pSecInfo->PairwiseEncAlgorithm == TKIP_Encryption))
-        {
-                return  false;
-        }
-        else
-                return true;
+	//In here we discuss with SD4 David. He think we still can send TKIP in broadcast group key in MCS rate.
+	//We can't force in G mode if Pairwie key is AES and group key is TKIP
+	if((pSecInfo->GroupEncAlgorithm == WEP104_Encryption) || (pSecInfo->GroupEncAlgorithm == WEP40_Encryption)  ||
+	   (pSecInfo->PairwiseEncAlgorithm == WEP104_Encryption) ||
+	   (pSecInfo->PairwiseEncAlgorithm == WEP40_Encryption) || (pSecInfo->PairwiseEncAlgorithm == TKIP_Encryption))
+	{
+		return  false;
+	}
+	else
+		return true;
 #endif
 	return true;
 #endif
@@ -3453,7 +3453,7 @@ bool GetHalfNmodeSupportByAPs819xUsb(struct net_device* dev)
 	bool			Reval;
 	struct r8192_priv* priv = ieee80211_priv(dev);
 	struct ieee80211_device* ieee = priv->ieee80211;
-	
+
 	if(ieee->bHalfWirelessN24GMode == true)
 		Reval = true;
 	else
@@ -3502,7 +3502,7 @@ void rtl8192_SetWirelessMode(struct net_device* dev, u8 wireless_mode)
 	struct r8192_priv *priv = ieee80211_priv(dev);
 	u8 bSupportMode = rtl8192_getSupportedWireleeMode(dev);
 
-#if 1  
+#if 1
 	if ((wireless_mode == WIRELESS_MODE_AUTO) || ((wireless_mode&bSupportMode)==0))
 	{
 		if(bSupportMode & WIRELESS_MODE_N_24G)
@@ -3534,14 +3534,14 @@ void rtl8192_SetWirelessMode(struct net_device* dev, u8 wireless_mode)
 	ActUpdateChannelAccessSetting( pAdapter, pHalData->CurrentWirelessMode, &pAdapter->MgntInfo.Info8185.ChannelAccessSetting );
 #endif
 	priv->ieee80211->mode = wireless_mode;
-	
+
 	if ((wireless_mode == WIRELESS_MODE_N_24G) ||  (wireless_mode == WIRELESS_MODE_N_5G))
-		priv->ieee80211->pHTInfo->bEnableHT = 1;	
+		priv->ieee80211->pHTInfo->bEnableHT = 1;
 	else
 		priv->ieee80211->pHTInfo->bEnableHT = 0;
 	RT_TRACE(COMP_INIT, "Current Wireless Mode is %x\n", wireless_mode);
 	rtl8192_refresh_supportrate(priv);
-#endif	
+#endif
 
 }
 //init priv variables here. only non_zero value should be initialized here.
@@ -3551,7 +3551,7 @@ static void rtl8192_init_priv_variable(struct net_device* dev)
 	u8 i;
 	priv->card_8192 = NIC_8192U;
 	priv->chan = 1; //set to channel 1
-	priv->ieee80211->mode = WIRELESS_MODE_AUTO; //SET AUTO 
+	priv->ieee80211->mode = WIRELESS_MODE_AUTO; //SET AUTO
 	priv->ieee80211->iw_mode = IW_MODE_INFRA;
 	priv->ieee80211->ieee_up=0;
 	priv->retry_rts = DEFAULT_RETRY_RTS;
@@ -3569,13 +3569,13 @@ static void rtl8192_init_priv_variable(struct net_device* dev)
 	priv->force_reset = false;
 
 	priv->ieee80211->FwRWRF = 0; 	//we don't use FW read/write RF until stable firmware is available.
-	priv->ieee80211->current_network.beacon_interval = DEFAULT_BEACONINTERVAL;	
+	priv->ieee80211->current_network.beacon_interval = DEFAULT_BEACONINTERVAL;
 	priv->ieee80211->iw_mode = IW_MODE_INFRA;
-	priv->ieee80211->softmac_features  = IEEE_SOFTMAC_SCAN | 
-		IEEE_SOFTMAC_ASSOCIATE | IEEE_SOFTMAC_PROBERQ | 
+	priv->ieee80211->softmac_features  = IEEE_SOFTMAC_SCAN |
+		IEEE_SOFTMAC_ASSOCIATE | IEEE_SOFTMAC_PROBERQ |
 		IEEE_SOFTMAC_PROBERS | IEEE_SOFTMAC_TX_QUEUE |
 		IEEE_SOFTMAC_BEACONS;//added by amy 080604 //|  //IEEE_SOFTMAC_SINGLE_QUEUE;
-	
+
 	priv->ieee80211->active_scan = 1;
 	priv->ieee80211->modulation = IEEE80211_CCK_MODULATION | IEEE80211_OFDM_MODULATION;
 	priv->ieee80211->host_encrypt = 1;
@@ -3590,7 +3590,7 @@ static void rtl8192_init_priv_variable(struct net_device* dev)
 	priv->ieee80211->data_hard_resume = rtl8192_data_hard_resume;
 	priv->ieee80211->init_wmmparam_flag = 0;
 	priv->ieee80211->fts = DEFAULT_FRAG_THRESHOLD;
-	priv->ieee80211->check_nic_enough_desc = check_nic_enough_desc;	
+	priv->ieee80211->check_nic_enough_desc = check_nic_enough_desc;
 	priv->ieee80211->tx_headroom = TX_PACKET_SHIFT_BYTES;
 	priv->ieee80211->qos_support = 1;
 
@@ -3608,10 +3608,10 @@ static void rtl8192_init_priv_variable(struct net_device* dev)
 	priv->card_type = USB;
 #ifdef TO_DO_LIST
 	if(Adapter->bInHctTest)
-  	{
+	{
 		pHalData->ShortRetryLimit = 7;
 		pHalData->LongRetryLimit = 7;
-  	}
+	}
 #endif
 	{
 		priv->ShortRetryLimit = 0x30;
@@ -3619,10 +3619,10 @@ static void rtl8192_init_priv_variable(struct net_device* dev)
 	}
 	priv->EarlyRxThreshold = 7;
 	priv->enable_gpio0 = 0;
-	priv->TransmitConfig = 
+	priv->TransmitConfig =
 	//	TCR_DurProcMode |	//for RTL8185B, duration setting by HW
 	//?	TCR_DISReqQsize |
-                (TCR_MXDMA_2048<<TCR_MXDMA_OFFSET)|  // Max DMA Burst Size per Tx DMA Burst, 7: reservied.
+		(TCR_MXDMA_2048<<TCR_MXDMA_OFFSET)|  // Max DMA Burst Size per Tx DMA Burst, 7: reservied.
 		(priv->ShortRetryLimit<<TCR_SRL_OFFSET)|	// Short retry limit
 		(priv->LongRetryLimit<<TCR_LRL_OFFSET) |	// Long retry limit
 		(false ? TCR_SAT: 0);	// FALSE: HW provies PLCP length and LENGEXT, TURE: SW proiveds them
@@ -3638,7 +3638,7 @@ static void rtl8192_init_priv_variable(struct net_device* dev)
 						(pHalData->EarlyRxThreshold<<RCR_FIFO_OFFSET) | // Rx FIFO Threshold, 7: No Rx threshold.
 						(pHalData->EarlyRxThreshold == 7 ? RCR_OnlyErlPkt:0);
 	else
-			
+
 #endif
 	priv->ReceiveConfig	=
 		RCR_AMF | RCR_ADF |		//accept management/data
@@ -3649,13 +3649,13 @@ static void rtl8192_init_priv_variable(struct net_device* dev)
 		(priv->EarlyRxThreshold<<RX_FIFO_THRESHOLD_SHIFT) | // Rx FIFO Threshold, 7: No Rx threshold.
 		(priv->EarlyRxThreshold == 7 ? RCR_ONLYERLPKT:0);
 
-	priv->AcmControl = 0;	
+	priv->AcmControl = 0;
 	priv->pFirmware = (rt_firmware*)kmalloc(sizeof(rt_firmware), GFP_KERNEL);
 	if (priv->pFirmware)
 	memset(priv->pFirmware, 0, sizeof(rt_firmware));
 
 	/* rx related queue */
-        skb_queue_head_init(&priv->rx_queue);
+	skb_queue_head_init(&priv->rx_queue);
 	skb_queue_head_init(&priv->skb_queue);
 
 	/* Tx related queue */
@@ -3668,8 +3668,8 @@ static void rtl8192_init_priv_variable(struct net_device* dev)
 	for(i = 0; i < MAX_QUEUE_SIZE; i++) {
 		skb_queue_head_init(&priv->ieee80211->skb_drv_aggQ [i]);
 	}
-	priv->rf_set_chan = rtl8192_phy_SwChnl;	
-}	
+	priv->rf_set_chan = rtl8192_phy_SwChnl;
+}
 
 //init lock here
 static void rtl8192_init_priv_lock(struct r8192_priv* priv)
@@ -3697,12 +3697,12 @@ void rtl8192_irq_rx_tasklet(struct r8192_priv *priv);
 #define DRV_NAME "wlan0"
 static void rtl8192_init_priv_task(struct net_device* dev)
 {
-	struct r8192_priv *priv = ieee80211_priv(dev);	
+	struct r8192_priv *priv = ieee80211_priv(dev);
 
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)	
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
 #ifdef PF_SYNCTHREAD
 	priv->priv_wq = create_workqueue(DRV_NAME,0);
-#else	
+#else
 	priv->priv_wq = create_workqueue(DRV_NAME);
 #endif
 #endif
@@ -3754,12 +3754,12 @@ static void rtl8192_get_eeprom_size(struct net_device* dev)
 {
 	u16 curCR = 0;
 	struct r8192_priv *priv = ieee80211_priv(dev);
-	RT_TRACE(COMP_EPROM, "===========>%s()\n", __FUNCTION__);	
+	RT_TRACE(COMP_EPROM, "===========>%s()\n", __FUNCTION__);
 	curCR = read_nic_word_E(dev,EPROM_CMD);
 	RT_TRACE(COMP_EPROM, "read from Reg EPROM_CMD(%x):%x\n", EPROM_CMD, curCR);
-	//whether need I consider BIT5?	
+	//whether need I consider BIT5?
 	priv->epromtype = (curCR & Cmd9346CR_9356SEL) ? EPROM_93c56 : EPROM_93c46;
-	RT_TRACE(COMP_EPROM, "<===========%s(), epromtype:%d\n", __FUNCTION__, priv->epromtype);	
+	RT_TRACE(COMP_EPROM, "<===========%s(), epromtype:%d\n", __FUNCTION__, priv->epromtype);
 }
 
 //used to swap endian. as ntohl & htonl are not neccessary to swap endian, so use this instead.
@@ -3767,7 +3767,7 @@ static inline u16 endian_swap(u16* data)
 {
 	u16 tmp = *data;
 	*data = (tmp >> 8) | (tmp << 8);
-	return *data;	
+	return *data;
 }
 static void rtl8192_read_eeprom_info(struct net_device* dev)
 {
@@ -3776,10 +3776,10 @@ static void rtl8192_read_eeprom_info(struct net_device* dev)
 	u8 bLoad_From_EEPOM = false;
 	struct r8192_priv *priv = ieee80211_priv(dev);
 	u16 tmpValue = 0;
-	RT_TRACE(COMP_EPROM, "===========>%s()\n", __FUNCTION__);	
+	RT_TRACE(COMP_EPROM, "===========>%s()\n", __FUNCTION__);
 	wEPROM_ID = eprom_read(dev, 0); //first read EEPROM ID out;
 	RT_TRACE(COMP_EPROM, "EEPROM ID is 0x%x\n", wEPROM_ID);
-	
+
 	if (wEPROM_ID != RTL8190_EEPROM_ID)
 	{
 		RT_TRACE(COMP_ERR, "EEPROM ID is invalid(is 0x%x(should be 0x%x)\n", wEPROM_ID, RTL8190_EEPROM_ID);
@@ -3817,7 +3817,7 @@ static void rtl8192_read_eeprom_info(struct net_device* dev)
 			tmp = eprom_read(dev, (u16)((EEPROM_NODE_ADDRESS_BYTE_0 + i)>>1));
 			*(u16*)(&dev->dev_addr[i]) = tmp;
 		}
-	}	
+	}
 	else
 	{
 		memcpy(dev->dev_addr, bMac_Tmp_Addr, 6);
@@ -3826,7 +3826,7 @@ static void rtl8192_read_eeprom_info(struct net_device* dev)
 	RT_TRACE(COMP_EPROM, "MAC addr:"MAC_FMT"\n", MAC_ARG(dev->dev_addr));
 	priv->rf_type = RTL819X_DEFAULT_RF_TYPE; //default 1T2R
 	priv->rf_chip = RF_8256;
-	
+
 	if (priv->card_8192_version == (u8)VERSION_819xU_A)
 	{
 		//read Tx power gain offset of legacy OFDM to HT rate
@@ -3865,7 +3865,7 @@ static void rtl8192_read_eeprom_info(struct net_device* dev)
 		{
 			int i;
 			if (bLoad_From_EEPOM)
-				priv->EEPROMTxPowerLevelCCK = (eprom_read(dev, (EEPROM_TxPwIndex_CCK>>1))&0xff) >> 8; 
+				priv->EEPROMTxPowerLevelCCK = (eprom_read(dev, (EEPROM_TxPwIndex_CCK>>1))&0xff) >> 8;
 			else
 				priv->EEPROMTxPowerLevelCCK = 0x10;
 			RT_TRACE(COMP_EPROM, "CCK Tx Power Levl: 0x%02x\n", priv->EEPROMTxPowerLevelCCK);
@@ -3923,10 +3923,10 @@ static void rtl8192_read_eeprom_info(struct net_device* dev)
 					priv->TxPowerLevelOFDM24G[i] = priv->EEPROMTxPowerLevelOFDM24G[0];
 				else if (i>=4 && i<=9)
 					priv->TxPowerLevelOFDM24G[i] = priv->EEPROMTxPowerLevelOFDM24G[1];
-				else 
+				else
 					priv->TxPowerLevelOFDM24G[i] = priv->EEPROMTxPowerLevelOFDM24G[2];
 			}
-			
+
 			for (i=0; i<14; i++)
 			{
 				if (priv->EEPROM_Def_Ver == 0)
@@ -3944,7 +3944,7 @@ static void rtl8192_read_eeprom_info(struct net_device* dev)
 						priv->TxPowerLevelCCK[i] = priv->EEPROMTxPowerLevelCCK_V1[0];
 					else if (i>=4 && i<=9)
 						priv->TxPowerLevelCCK[i] = priv->EEPROMTxPowerLevelCCK_V1[1];
-					else 
+					else
 						priv->TxPowerLevelCCK[i] = priv->EEPROMTxPowerLevelCCK_V1[2];
 				}
 			}
@@ -3967,15 +3967,15 @@ static void rtl8192_read_eeprom_info(struct net_device* dev)
 		case EEPROM_CID_RUNTOP:
 			priv->CustomerID = RT_CID_819x_RUNTOP;
 			break;
-			
+
 		case EEPROM_CID_DLINK:
 			priv->CustomerID = RT_CID_DLINK;
 			break;
-			
+
 		default:
 			priv->CustomerID = RT_CID_DEFAULT;
 			break;
-			
+
 	}
 
 	switch(priv->CustomerID)
@@ -3983,34 +3983,34 @@ static void rtl8192_read_eeprom_info(struct net_device* dev)
 		case RT_CID_819x_RUNTOP:
 			priv->LedStrategy = SW_LED_MODE2;
 			break;
-			
- 		case RT_CID_DLINK:
+
+		case RT_CID_DLINK:
 			priv->LedStrategy = SW_LED_MODE4;
 			break;
 
 		default:
 			priv->LedStrategy = SW_LED_MODE0;
 			break;
-			
+
 	}
 
 
 	if(priv->rf_type == RF_1T2R)
-	{		
+	{
 		RT_TRACE(COMP_EPROM, "\n1T2R config\n");
 	}
 	else
 	{
 		RT_TRACE(COMP_EPROM, "\n2T4R config\n");
 	}
-	
+
 	// 2008/01/16 MH We can only know RF type in the function. So we have to init
 	// DIG RATR table again.
 	init_rate_adaptive(dev);
 	//we need init DIG RATR table here again.
 
 	RT_TRACE(COMP_EPROM, "<===========%s()\n", __FUNCTION__);
-	return;	
+	return;
 }
 
 short rtl8192_get_channel_map(struct net_device * dev)
@@ -4022,7 +4022,7 @@ short rtl8192_get_channel_map(struct net_device * dev)
 		priv->ChannelPlan= 0;
 	}
 	RT_TRACE(COMP_INIT, "Channel plan is %d\n",priv->ChannelPlan);
-		
+
 	rtl819x_set_channel_map(priv->ChannelPlan, priv);
 #else
 	int ch,i;
@@ -4044,7 +4044,7 @@ short rtl8192_get_channel_map(struct net_device * dev)
 
 short rtl8192_init(struct net_device *dev)
 {
-		
+
 	struct r8192_priv *priv = ieee80211_priv(dev);
 
 	memset(&(priv->stats),0,sizeof(struct Stats));
@@ -4052,14 +4052,14 @@ short rtl8192_init(struct net_device *dev)
 #ifdef PIPE12
 	{
 		int i=0;
-		u8 queuetopipe[]={3,2,1,0,4,8,7,6,5}; 
+		u8 queuetopipe[]={3,2,1,0,4,8,7,6,5};
 		memcpy(priv->txqueue_to_outpipemap,queuetopipe,9);
 /*		for(i=0;i<9;i++)
 			printk("%d ",priv->txqueue_to_outpipemap[i]);
 		printk("\n");*/
 	}
 #else
-	{	
+	{
 		u8 queuetopipe[]={3,2,1,0,4,4,0,4,4};
 		memcpy(priv->txqueue_to_outpipemap,queuetopipe,9);
 /*		for(i=0;i<9;i++)
@@ -4077,20 +4077,20 @@ short rtl8192_init(struct net_device *dev)
 	init_timer(&priv->watch_dog_timer);
 	priv->watch_dog_timer.data = (unsigned long)dev;
 	priv->watch_dog_timer.function = watch_dog_timer_callback;
-	if(rtl8192_usb_initendpoints(dev)!=0){ 
+	if(rtl8192_usb_initendpoints(dev)!=0){
 		DMESG("Endopoints initialization failed");
 		return -ENOMEM;
 	}
-	
+
 	//rtl8192_adapter_start(dev);
 #ifdef DEBUG_EPROM
 	dump_eprom(dev);
-#endif 
+#endif
 	return 0;
 }
 
 /******************************************************************************
- *function:  This function actually only set RRSR, RATR and BW_OPMODE registers 
+ *function:  This function actually only set RRSR, RATR and BW_OPMODE registers
  *	     not to do all the hw config as its name says
  *   input:  net_device dev
  *  output:  none
@@ -4162,7 +4162,7 @@ void rtl8192_hwconfig(struct net_device* dev)
 		}
 		write_nic_dword(dev, RATR0, ratr_value);
 		write_nic_byte(dev, UFWP, 1);
-	}	
+	}
 	regTmp = read_nic_byte(dev, 0x313);
 	regRRSR = ((regTmp) << 24) | (regRRSR & 0x00ffffff);
 	write_nic_dword(dev, RRSR, regRRSR);
@@ -4170,18 +4170,18 @@ void rtl8192_hwconfig(struct net_device* dev)
 	//
 	// Set Retry Limit here
 	//
-	write_nic_word(dev, RETRY_LIMIT, 
+	write_nic_word(dev, RETRY_LIMIT,
 			priv->ShortRetryLimit << RETRY_LIMIT_SHORT_SHIFT | \
 			priv->LongRetryLimit << RETRY_LIMIT_LONG_SHIFT);
-	// Set Contention Window here		
+	// Set Contention Window here
 
 	// Set Tx AGC
 
 	// Set Tx Antenna including Feedback control
-		
+
 	// Set Auto Rate fallback control
-	
-	
+
+
 }
 
 
@@ -4230,7 +4230,7 @@ bool rtl8192_adapter_start(struct net_device *dev)
 		dwRegRead |= CPU_CCK_LOOPBACK;
 	else
 		RT_TRACE(COMP_ERR, "Serious error in %s(): wrong loopback mode setting(%d)\n", __FUNCTION__,  priv->LoopbackMode);
-	
+
 	write_nic_dword(dev, CPU_GEN, dwRegRead);
 
 	//after reset cpu, we need wait for a seconds to write in register.
@@ -4244,7 +4244,7 @@ bool rtl8192_adapter_start(struct net_device *dev)
 
 	//turn on Tx/Rx
 	write_nic_byte(dev, CMDR, CR_RE|CR_TE);
-	
+
 	//set IDR0 here
 	write_nic_dword(dev, MAC0, ((u32*)dev->dev_addr)[0]);
 	write_nic_word(dev, MAC4, ((u16*)(dev->dev_addr + 4))[0]);
@@ -4256,15 +4256,15 @@ bool rtl8192_adapter_start(struct net_device *dev)
 	write_nic_dword(dev, RQPN1,  NUM_OF_PAGE_IN_FW_QUEUE_BK << RSVD_FW_QUEUE_PAGE_BK_SHIFT |\
 						NUM_OF_PAGE_IN_FW_QUEUE_BE << RSVD_FW_QUEUE_PAGE_BE_SHIFT | \
 						NUM_OF_PAGE_IN_FW_QUEUE_VI << RSVD_FW_QUEUE_PAGE_VI_SHIFT | \
-						NUM_OF_PAGE_IN_FW_QUEUE_VO <<RSVD_FW_QUEUE_PAGE_VO_SHIFT);												
+						NUM_OF_PAGE_IN_FW_QUEUE_VO <<RSVD_FW_QUEUE_PAGE_VO_SHIFT);
 	write_nic_dword(dev, RQPN2, NUM_OF_PAGE_IN_FW_QUEUE_MGNT << RSVD_FW_QUEUE_PAGE_MGNT_SHIFT |\
 						NUM_OF_PAGE_IN_FW_QUEUE_CMD << RSVD_FW_QUEUE_PAGE_CMD_SHIFT);
 	write_nic_dword(dev, RQPN3, APPLIED_RESERVED_QUEUE_IN_FW| \
 						NUM_OF_PAGE_IN_FW_QUEUE_BCN<<RSVD_FW_QUEUE_PAGE_BCN_SHIFT
 //						| NUM_OF_PAGE_IN_FW_QUEUE_PUB<<RSVD_FW_QUEUE_PAGE_PUB_SHIFT
 						);
-	write_nic_dword(dev, RATR0+4*7, (RATE_ALL_OFDM_AG | RATE_ALL_CCK));	
-			
+	write_nic_dword(dev, RATR0+4*7, (RATE_ALL_OFDM_AG | RATE_ALL_CCK));
+
 	//Set AckTimeout
 	// TODO: (it value is only for FPGA version). need to be changed!!2006.12.18, by Emily
 	write_nic_byte(dev, ACK_TIMEOUT, 0x30);
@@ -4282,7 +4282,7 @@ bool rtl8192_adapter_start(struct net_device *dev)
 		write_nic_byte(dev, SECR, SECR_value);
 	}
 	}
-	
+
 	//Beacon related
 	write_nic_word(dev, ATIMWND, 2);
 	write_nic_word(dev, BCN_INTERVAL, 100);
@@ -4299,11 +4299,11 @@ bool rtl8192_adapter_start(struct net_device *dev)
 	{
 		u32 ulValue;
 		PRT_HIGH_THROUGHPUT	pHTInfo = priv->ieee80211->pHTInfo;
-		ulValue = (pHTInfo->UsbRxFwAggrEn<<24) | (pHTInfo->UsbRxFwAggrPageNum<<16) | 
+		ulValue = (pHTInfo->UsbRxFwAggrEn<<24) | (pHTInfo->UsbRxFwAggrPageNum<<16) |
 					(pHTInfo->UsbRxFwAggrPacketNum<<8) | (pHTInfo->UsbRxFwAggrTimeout);
 		/*
-		 * If usb rx firmware aggregation is enabled, 
-		 * when anyone of three threshold conditions above is reached, 
+		 * If usb rx firmware aggregation is enabled,
+		 * when anyone of three threshold conditions above is reached,
 		 * firmware will send aggregated packet to driver.
 		 */
 		write_nic_dword(dev, 0x1a8, ulValue);
@@ -4312,14 +4312,14 @@ bool rtl8192_adapter_start(struct net_device *dev)
 #endif
 
 	rtl8192_phy_configmac(dev);
-	
+
 	if (priv->card_8192_version == (u8) VERSION_819xU_A)
 	{
 		rtl8192_phy_getTxPower(dev);
 		rtl8192_phy_setTxPower(dev, priv->chan);
 	}
 
-	//Firmware download 
+	//Firmware download
 	init_status = init_firmware(dev);
 	if(!init_status)
 	{
@@ -4347,7 +4347,7 @@ if(Adapter->ResetProgress == RESET_TYPE_NORESET)
 		else
 		{
 			pHalData->eRFPowerState = eRfOn;
-			pMgntInfo->RfOffReason = 0; 
+			pMgntInfo->RfOffReason = 0;
 			RT_TRACE((COMP_INIT|COMP_RF), DBG_LOUD, ("InitializeAdapter819xUsb(): RF is on ----------\n"));
 		}
 	}
@@ -4359,15 +4359,15 @@ if(Adapter->ResetProgress == RESET_TYPE_NORESET)
 			// Those action will be discard in MgntActSet_RF_State because off the same state
 			for(eRFPath = 0; eRFPath <pHalData->NumTotalRFPath; eRFPath++)
 				PHY_SetRFReg(Adapter, (RF90_RADIO_PATH_E)eRFPath, 0x4, 0xC00, 0x0);
-		}	
+		}
 	}
-#endif	
+#endif
 	//config RF.
 	if(priv->ResetProgress == RESET_TYPE_NORESET){
 	rtl8192_phy_RFConfig(dev);
 	RT_TRACE(COMP_INIT, "%s():after phy RF config\n", __FUNCTION__);
 	}
-	
+
 
 	if(priv->ieee80211->FwRWRF)
 		// We can force firmware to do RF-R/W
@@ -4391,7 +4391,7 @@ if(Adapter->ResetProgress == RESET_TYPE_NORESET)
 			RT_TRACE(COMP_POWER_TRACKING, "D-cut\n");
 		}
 		else
-		{	
+		{
 			priv->bDcut = FALSE;
 			RT_TRACE(COMP_POWER_TRACKING, "C-cut\n");
 		}
@@ -4413,11 +4413,11 @@ if(Adapter->ResetProgress == RESET_TYPE_NORESET)
 				}
 			}
 
-			TempCCk = rtl8192_QueryBBReg(dev, rCCK0_TxFilter1, bMaskByte2);				
+			TempCCk = rtl8192_QueryBBReg(dev, rCCK0_TxFilter1, bMaskByte2);
 
 			for(i=0 ; i<CCKTxBBGainTableLength ; i++)
 			{
-				
+
 				if(TempCCk == priv->cck_txbbgain_table[i].ccktxbb_valuearray[0])
 				{
 					priv->cck_present_attentuation_20Mdefault=(u8) i;
@@ -4427,14 +4427,14 @@ if(Adapter->ResetProgress == RESET_TYPE_NORESET)
 			priv->cck_present_attentuation_40Mdefault= 0;
 			priv->cck_present_attentuation_difference= 0;
 			priv->cck_present_attentuation = priv->cck_present_attentuation_20Mdefault;
-		
+
 	//		pMgntInfo->bTXPowerTracking = FALSE;//TEMPLY DISABLE
 		}
 	}
 	write_nic_byte(dev, 0x87, 0x0);
-			
-	
-#endif	
+
+
+#endif
 	return init_status;
 }
 
@@ -4447,7 +4447,7 @@ void rtl8192_start_tx_beacon(struct net_device *dev)
 {
 	int i;
 	struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
-	u16 word;	
+	u16 word;
 	DMESG("Enabling beacon TX");
 	//write_nic_byte(dev, TX_CONF,0xe6);// TX_CONF
 	//rtl8192_init_beacon(dev);
@@ -4460,41 +4460,41 @@ void rtl8192_start_tx_beacon(struct net_device *dev)
 	//write_nic_word(dev,0x7a,0);
 	//write_nic_word(dev,0x7a,0x8000);
 
-	
+
 	word  = read_nic_word(dev, BcnItv);
 	word &= ~BcnItv_BcnItv; // clear Bcn_Itv
 	write_nic_word(dev, BcnItv, word);
 
-	write_nic_word(dev, AtimWnd, 
+	write_nic_word(dev, AtimWnd,
 		       read_nic_word(dev, AtimWnd) &~ AtimWnd_AtimWnd);
-	
+
 	word  = read_nic_word(dev, BCN_INTR_ITV);
 	word &= ~BCN_INTR_ITV_MASK;
-	
-	//word |= priv->ieee80211->beacon_interval * 
+
+	//word |= priv->ieee80211->beacon_interval *
 	//	((priv->txbeaconcount > 1)?(priv->txbeaconcount-1):1);
 	// FIXME:FIXME check if correct ^^ worked with 0x3e8;
-	
+
 	write_nic_word(dev, BCN_INTR_ITV, word);
-	
+
 	//write_nic_word(dev,0x2e,0xe002);
 	//write_nic_dword(dev,0x30,0xb8c7832e);
 	for(i=0; i<ETH_ALEN; i++)
 		write_nic_byte(dev, BSSID+i, priv->ieee80211->beacon_cell_ssid[i]);
-	
+
 //	rtl8192_update_msr(dev);
 
-	
+
 	//write_nic_byte(dev,CONFIG4,3); /* !!!!!!!!!! */
-	
+
 	rtl8192_set_mode(dev, EPROM_CMD_NORMAL);
-	
+
 	rtl8192_irq_enable(dev);
-	
+
 	/* VV !!!!!!!!!! VV*/
 	/*
 	rtl8192_set_mode(dev,EPROM_CMD_CONFIG);
-	write_nic_byte(dev,0x9d,0x00); 	
+	write_nic_byte(dev,0x9d,0x00);
 	rtl8192_set_mode(dev,EPROM_CMD_NORMAL);
 */
 }
@@ -4506,7 +4506,7 @@ void rtl8192_start_tx_beacon(struct net_device *dev)
 static struct net_device_stats *rtl8192_stats(struct net_device *dev)
 {
 	struct r8192_priv *priv = ieee80211_priv(dev);
-	
+
 	return &priv->ieee80211->stats;
 }
 
@@ -4540,7 +4540,7 @@ TxCheckStuck(struct net_device *dev)
 //	u8			ResetThreshold;
 	bool			bCheckFwTxCnt = false;
 	//unsigned long flags;
-	
+
 	//
 	// Decide Stuch threshold according to current power save mode
 	//
@@ -4550,23 +4550,23 @@ TxCheckStuck(struct net_device *dev)
 //	     spin_lock_irqsave(&priv->ieee80211->lock,flags);
 	     for (QueueID = 0; QueueID<=BEACON_QUEUE;QueueID ++)
 	     {
-	     		if(QueueID == TXCMD_QUEUE)
-		         continue;
+			if(QueueID == TXCMD_QUEUE)
+			 continue;
 #if 1
 #ifdef USB_TX_DRIVER_AGGREGATION_ENABLE
 			if((skb_queue_len(&priv->ieee80211->skb_waitQ[QueueID]) == 0) && (skb_queue_len(&priv->ieee80211->skb_aggQ[QueueID]) == 0) && (skb_queue_len(&priv->ieee80211->skb_drv_aggQ[QueueID]) == 0))
 #else
-		     	if((skb_queue_len(&priv->ieee80211->skb_waitQ[QueueID]) == 0)  && (skb_queue_len(&priv->ieee80211->skb_aggQ[QueueID]) == 0))
-#endif			 	
-			 	continue;
+			if((skb_queue_len(&priv->ieee80211->skb_waitQ[QueueID]) == 0)  && (skb_queue_len(&priv->ieee80211->skb_aggQ[QueueID]) == 0))
+#endif
+				continue;
 #endif
 
-	             bCheckFwTxCnt = true;
+		     bCheckFwTxCnt = true;
 	     }
 //	     PlatformReleaseSpinLock(Adapter, RT_TX_SPINLOCK);
 //	spin_unlock_irqrestore(&priv->ieee80211->lock,flags);
-//	RT_TRACE(COMP_RESET,"bCheckFwTxCnt is %d\n",bCheckFwTxCnt); 
-#if 1 
+//	RT_TRACE(COMP_RESET,"bCheckFwTxCnt is %d\n",bCheckFwTxCnt);
+#if 1
 	if(bCheckFwTxCnt)
 	{
 		if(HalTxCheckStuck819xUsb(dev))
@@ -4647,15 +4647,15 @@ HalRxCheckStuck819xUsb(struct net_device *dev)
 RESET_TYPE
 RxCheckStuck(struct net_device *dev)
 {
-	struct r8192_priv *priv = ieee80211_priv(dev); 
+	struct r8192_priv *priv = ieee80211_priv(dev);
 	//int                     i;
 	bool        bRxCheck = FALSE;
 
 //       RT_TRACE(COMP_RESET," ==> RxCheckStuck()\n");
 	//PlatformAcquireSpinLock(Adapter, RT_RX_SPINLOCK);
-	
+
 	 if(priv->IrpPendingCount > 1)
-	 	bRxCheck = TRUE;
+		bRxCheck = TRUE;
        //PlatformReleaseSpinLock(Adapter, RT_RX_SPINLOCK);
 
 //       RT_TRACE(COMP_RESET,"bRxCheck is %d \n",bRxCheck);
@@ -4673,14 +4673,14 @@ RxCheckStuck(struct net_device *dev)
 
 /**
 *	This function is called by Checkforhang to check whether we should ask OS to reset driver
-*	
+*
 *	\param pAdapter	The adapter context for this miniport
 *
 *	Note:NIC with USB interface sholud not call this function because we cannot scan descriptor
 *	to judge whether there is tx stuck.
 *	Note: This function may be required to be rewrite for Vista OS.
 *	<<<Assumption: Tx spinlock has been acquired >>>
-*	
+*
 *	8185 and 8185b does not implement this function. This is added by Emily at 2006.11.24
 */
 RESET_TYPE
@@ -4690,22 +4690,22 @@ rtl819x_ifcheck_resetornot(struct net_device *dev)
 	RESET_TYPE	TxResetType = RESET_TYPE_NORESET;
 	RESET_TYPE	RxResetType = RESET_TYPE_NORESET;
 	RT_RF_POWER_STATE 	rfState;
-	
+
 	rfState = priv->ieee80211->eRFPowerState;
-	
+
 	TxResetType = TxCheckStuck(dev);
-#if 1 
-	if( rfState != eRfOff || 
+#if 1
+	if( rfState != eRfOff ||
 		/*ADAPTER_TEST_STATUS_FLAG(Adapter, ADAPTER_STATUS_FW_DOWNLOAD_FAILURE)) &&*/
 		(priv->ieee80211->iw_mode != IW_MODE_ADHOC))
 	{
-		// If driver is in the status of firmware download failure , driver skips RF initialization and RF is 
+		// If driver is in the status of firmware download failure , driver skips RF initialization and RF is
 		// in turned off state. Driver should check whether Rx stuck and do silent reset. And
-		// if driver is in firmware download failure status, driver should initialize RF in the following 
+		// if driver is in firmware download failure status, driver should initialize RF in the following
 		// silent reset procedure Emily, 2008.01.21
 
 		// Driver should not check RX stuck in IBSS mode because it is required to
-		// set Check BSSID in order to send beacon, however, if check BSSID is 
+		// set Check BSSID in order to send beacon, however, if check BSSID is
 		// set, STA cannot hear any packet a all. Emily, 2008.04.12
 		RxResetType = RxCheckStuck(dev);
 	}
@@ -4727,63 +4727,63 @@ int rtl8192_close(struct net_device *dev);
 
 
 
-void 
+void
 CamRestoreAllEntry(	struct net_device *dev)
 {
 	u8 EntryId = 0;
 	struct r8192_priv *priv = ieee80211_priv(dev);
 	u8*	MacAddr = priv->ieee80211->current_network.bssid;
-	
+
 	static u8	CAM_CONST_ADDR[4][6] = {
 		{0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
 		{0x00, 0x00, 0x00, 0x00, 0x00, 0x01},
 		{0x00, 0x00, 0x00, 0x00, 0x00, 0x02},
 		{0x00, 0x00, 0x00, 0x00, 0x00, 0x03}};
-	static u8	CAM_CONST_BROAD[] = 
+	static u8	CAM_CONST_BROAD[] =
 		{0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
-	
+
 	RT_TRACE(COMP_SEC, "CamRestoreAllEntry: \n");
 
-		
+
 	if ((priv->ieee80211->pairwise_key_type == KEY_TYPE_WEP40)||
 	    (priv->ieee80211->pairwise_key_type == KEY_TYPE_WEP104))
 	{
-		
+
 		for(EntryId=0; EntryId<4; EntryId++)
 		{
 			{
 				MacAddr = CAM_CONST_ADDR[EntryId];
-				setKey(dev, 
+				setKey(dev,
 						EntryId ,
 						EntryId,
 						priv->ieee80211->pairwise_key_type,
-						MacAddr, 
+						MacAddr,
 						0,
-						NULL);			
-			}	
-		}	
-		
+						NULL);
+			}
+		}
+
 	}
 	else if(priv->ieee80211->pairwise_key_type == KEY_TYPE_TKIP)
 	{
-		
+
 		{
 			if(priv->ieee80211->iw_mode == IW_MODE_ADHOC)
-				setKey(dev, 
+				setKey(dev,
 						4,
 						0,
-						priv->ieee80211->pairwise_key_type, 
-						(u8*)dev->dev_addr, 
+						priv->ieee80211->pairwise_key_type,
+						(u8*)dev->dev_addr,
 						0,
-						NULL);		
+						NULL);
 			else
-				setKey(dev, 
+				setKey(dev,
 						4,
 						0,
-						priv->ieee80211->pairwise_key_type, 
-						MacAddr, 
+						priv->ieee80211->pairwise_key_type,
+						MacAddr,
 						0,
-						NULL);			
+						NULL);
 		}
 	}
 	else if(priv->ieee80211->pairwise_key_type == KEY_TYPE_CCMP)
@@ -4791,21 +4791,21 @@ CamRestoreAllEntry(	struct net_device *dev)
 
 		{
 			if(priv->ieee80211->iw_mode == IW_MODE_ADHOC)
-				setKey(dev, 
+				setKey(dev,
 						4,
 						0,
 						priv->ieee80211->pairwise_key_type,
-						(u8*)dev->dev_addr, 
+						(u8*)dev->dev_addr,
 						0,
-						NULL);		
+						NULL);
 			else
-				setKey(dev, 
+				setKey(dev,
 						4,
 						0,
 						priv->ieee80211->pairwise_key_type,
-						MacAddr, 
+						MacAddr,
 						0,
-						NULL);				
+						NULL);
 		}
 	}
 
@@ -4817,46 +4817,46 @@ CamRestoreAllEntry(	struct net_device *dev)
 		for(EntryId=1 ; EntryId<4 ; EntryId++)
 		{
 			{
-				setKey(dev, 
-						EntryId, 
+				setKey(dev,
+						EntryId,
 						EntryId,
 						priv->ieee80211->group_key_type,
-						MacAddr, 
+						MacAddr,
 						0,
-						NULL);			
-			}	
+						NULL);
+			}
 		}
 		if(priv->ieee80211->iw_mode == IW_MODE_ADHOC)
-				setKey(dev, 
+				setKey(dev,
 						0,
 						0,
 						priv->ieee80211->group_key_type,
-						CAM_CONST_ADDR[0], 
+						CAM_CONST_ADDR[0],
 						0,
-						NULL);		
+						NULL);
 	}
 	else if(priv->ieee80211->group_key_type == KEY_TYPE_CCMP)
 	{
 		MacAddr = CAM_CONST_BROAD;
 		for(EntryId=1; EntryId<4 ; EntryId++)
 		{
-			{	
-				setKey(dev, 
-						EntryId , 
+			{
+				setKey(dev,
+						EntryId ,
 						EntryId,
 						priv->ieee80211->group_key_type,
-						MacAddr, 
+						MacAddr,
 						0,
-						NULL);			
-			}	
+						NULL);
+			}
 		}
 
 		if(priv->ieee80211->iw_mode == IW_MODE_ADHOC)
-				setKey(dev, 
-						0 , 
+				setKey(dev,
+						0 ,
 						0,
 						priv->ieee80211->group_key_type,
-						CAM_CONST_ADDR[0], 
+						CAM_CONST_ADDR[0],
 						0,
 						NULL);
 	}
@@ -4875,22 +4875,22 @@ rtl819x_ifsilentreset(struct net_device *dev)
 	u8	reset_times = 0;
 	int reset_status = 0;
 	struct ieee80211_device *ieee = priv->ieee80211;
-	
+
 
 	// 2007.07.20. If we need to check CCK stop, please uncomment this line.
 	//bStuck = Adapter->HalFunc.CheckHWStopHandler(Adapter);
-		
+
 	if(priv->ResetProgress==RESET_TYPE_NORESET)
 	{
-RESET_START:		
+RESET_START:
 
 		RT_TRACE(COMP_RESET,"=========>Reset progress!! \n");
-		
+
 		// Set the variable for reset.
 		priv->ResetProgress = RESET_TYPE_SILENT;
 //		rtl8192_close(dev);
-#if 1	
-		down(&priv->wx_sem);	
+#if 1
+		down(&priv->wx_sem);
 		if(priv->up == 0)
 		{
 			RT_TRACE(COMP_ERR,"%s():the driver is not up! return\n",__FUNCTION__);
@@ -4901,12 +4901,12 @@ RESET_START:
 		RT_TRACE(COMP_RESET,"%s():======>start to down the driver\n",__FUNCTION__);
 //		if(!netif_queue_stopped(dev))
 //			netif_stop_queue(dev);
-		
+
 		rtl8192_rtx_disable(dev);
 		rtl8192_cancel_deferred_work(priv);
 		deinit_hal_dm(dev);
-		del_timer_sync(&priv->watch_dog_timer);	
-	
+		del_timer_sync(&priv->watch_dog_timer);
+
 		ieee->sync_scan_hurryup = 1;
 		if(ieee->state == IEEE80211_LINKED)
 		{
@@ -4914,9 +4914,9 @@ RESET_START:
 			printk("ieee->state is IEEE80211_LINKED\n");
 			ieee80211_stop_send_beacons(priv->ieee80211);
 			del_timer_sync(&ieee->associate_timer);
-			#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)	
-			cancel_delayed_work(&ieee->associate_retry_wq);	
-			#endif	
+			#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
+			cancel_delayed_work(&ieee->associate_retry_wq);
+			#endif
 			ieee80211_stop_scan(ieee);
 			netif_carrier_off(dev);
 			up(&ieee->wx_sem);
@@ -4925,11 +4925,11 @@ RESET_START:
 			printk("ieee->state is NOT LINKED\n");
 			ieee80211_softmac_stop_protocol(priv->ieee80211);			}
 		up(&priv->wx_sem);
-		RT_TRACE(COMP_RESET,"%s():<==========down process is finished\n",__FUNCTION__);	
+		RT_TRACE(COMP_RESET,"%s():<==========down process is finished\n",__FUNCTION__);
 	//rtl8192_irq_disable(dev);
 		RT_TRACE(COMP_RESET,"%s():===========>start to up the driver\n",__FUNCTION__);
 		reset_status = _rtl8192_up(dev);
-		
+
 		RT_TRACE(COMP_RESET,"%s():<===========up process is finished\n",__FUNCTION__);
 		if(reset_status == -EAGAIN)
 		{
@@ -4945,37 +4945,37 @@ RESET_START:
 		}
 #endif
 		ieee->is_silent_reset = 1;
-#if 1 
+#if 1
 		EnableHWSecurityConfig8192(dev);
-#if 1 
+#if 1
 		if(ieee->state == IEEE80211_LINKED && ieee->iw_mode == IW_MODE_INFRA)
 		{
 			ieee->set_chan(ieee->dev, ieee->current_network.channel);
-		
-#if 1 
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)		
+
+#if 1
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
 			queue_work(ieee->wq, &ieee->associate_complete_wq);
 #else
 			schedule_task(&ieee->associate_complete_wq);
 #endif
 #endif
-	
+
 		}
 		else if(ieee->state == IEEE80211_LINKED && ieee->iw_mode == IW_MODE_ADHOC)
 		{
 			ieee->set_chan(ieee->dev, ieee->current_network.channel);
 			ieee->link_change(ieee->dev);
-	
+
 		//	notify_wx_assoc_event(ieee);
-	
+
 			ieee80211_start_send_beacons(ieee);
-	
+
 			if (ieee->data_hard_resume)
 				ieee->data_hard_resume(ieee->dev);
 			netif_carrier_on(ieee->dev);
 		}
 #endif
-		
+
 		CamRestoreAllEntry(dev);
 
 		priv->ResetProgress = RESET_TYPE_NORESET;
@@ -4985,7 +4985,7 @@ RESET_START:
 		priv->bResetInProgress = false;
 
 		// For test --> force write UFWP.
-		write_nic_byte(dev, UFWP, 1);	
+		write_nic_byte(dev, UFWP, 1);
 		RT_TRACE(COMP_RESET, "Reset finished!! ====>[%d]\n", priv->reset_count);
 #endif
 	}
@@ -4993,18 +4993,18 @@ RESET_START:
 
 void CAM_read_entry(
 	struct net_device *dev,
-	u32	 		iIndex 
+	u32			iIndex
 )
 {
- 	u32 target_command=0;
+	u32 target_command=0;
 	 u32 target_content=0;
 	 u8 entry_i=0;
 	 u32 ulStatus;
 	s32 i=100;
-//	printk("=======>start read CAM\n"); 
- 	for(entry_i=0;entry_i<CAM_CONTENT_COUNT;entry_i++)
- 	{
-   	// polling bit, and No Write enable, and address
+//	printk("=======>start read CAM\n");
+	for(entry_i=0;entry_i<CAM_CONTENT_COUNT;entry_i++)
+	{
+	// polling bit, and No Write enable, and address
 		target_command= entry_i+CAM_CONTENT_COUNT*iIndex;
 		target_command= target_command | BIT31;
 
@@ -5022,13 +5022,13 @@ void CAM_read_entry(
 			}
 		}
 #endif
-  		write_nic_dword(dev, RWCAM, target_command);
-   	 	RT_TRACE(COMP_SEC,"CAM_read_entry(): WRITE A0: %x \n",target_command);
-   	 //	printk("CAM_read_entry(): WRITE A0: %lx \n",target_command);
-  	 	target_content = read_nic_dword(dev, RCAMO);
-  	 	RT_TRACE(COMP_SEC, "CAM_read_entry(): WRITE A8: %x \n",target_content);
-  	 //	printk("CAM_read_entry(): WRITE A8: %lx \n",target_content);
- 	}
+		write_nic_dword(dev, RWCAM, target_command);
+		RT_TRACE(COMP_SEC,"CAM_read_entry(): WRITE A0: %x \n",target_command);
+	 //	printk("CAM_read_entry(): WRITE A0: %lx \n",target_command);
+		target_content = read_nic_dword(dev, RCAMO);
+		RT_TRACE(COMP_SEC, "CAM_read_entry(): WRITE A8: %x \n",target_content);
+	 //	printk("CAM_read_entry(): WRITE A8: %lx \n",target_content);
+	}
 	printk("\n");
 }
 
@@ -5036,18 +5036,18 @@ void rtl819x_update_rxcounts(
 	struct r8192_priv *priv,
 	u32* TotalRxBcnNum,
 	u32* TotalRxDataNum
-)	
+)
 {
 	u16 			SlotIndex;
 	u8			i;
 
 	*TotalRxBcnNum = 0;
 	*TotalRxDataNum = 0;
-	
+
 	SlotIndex = (priv->ieee80211->LinkDetectInfo.SlotIndex++)%(priv->ieee80211->LinkDetectInfo.SlotNum);
 	priv->ieee80211->LinkDetectInfo.RxBcnNum[SlotIndex] = priv->ieee80211->LinkDetectInfo.NumRecvBcnInPeriod;
 	priv->ieee80211->LinkDetectInfo.RxDataNum[SlotIndex] = priv->ieee80211->LinkDetectInfo.NumRecvDataInPeriod;
-	for( i=0; i<priv->ieee80211->LinkDetectInfo.SlotNum; i++ ){	
+	for( i=0; i<priv->ieee80211->LinkDetectInfo.SlotNum; i++ ){
 		*TotalRxBcnNum += priv->ieee80211->LinkDetectInfo.RxBcnNum[i];
 		*TotalRxDataNum += priv->ieee80211->LinkDetectInfo.RxDataNum[i];
 	}
@@ -5067,13 +5067,13 @@ extern	void	rtl819x_watchdog_wqcallback(struct net_device *dev)
 #endif
 	struct ieee80211_device* ieee = priv->ieee80211;
 	RESET_TYPE	ResetType = RESET_TYPE_NORESET;
-      	static u8	check_reset_cnt=0;
+	static u8	check_reset_cnt=0;
 	bool bBusyTraffic = false;
-	
+
 	if(!priv->up)
 		return;
 	hal_dm_watchdog(dev);
-	
+
 	{//to get busy traffic condition
 		if(ieee->state == IEEE80211_LINKED)
 		{
@@ -5091,7 +5091,7 @@ extern	void	rtl819x_watchdog_wqcallback(struct net_device *dev)
 		if(priv->ieee80211->state == IEEE80211_LINKED && priv->ieee80211->iw_mode == IW_MODE_INFRA)
 		{
 			u32	TotalRxBcnNum = 0;
-			u32	TotalRxDataNum = 0;	
+			u32	TotalRxDataNum = 0;
 
 			rtl819x_update_rxcounts(priv, &TotalRxBcnNum, &TotalRxDataNum);
 			if((TotalRxBcnNum+TotalRxDataNum) == 0)
@@ -5107,26 +5107,26 @@ extern	void	rtl819x_watchdog_wqcallback(struct net_device *dev)
 				RemovePeerTS(priv->ieee80211,priv->ieee80211->current_network.bssid);
 				priv->ieee80211->link_change(dev);
 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
-                                queue_work(priv->ieee80211->wq, &priv->ieee80211->associate_procedure_wq);
+				queue_work(priv->ieee80211->wq, &priv->ieee80211->associate_procedure_wq);
 #else
-                                schedule_task(&priv->ieee80211->associate_procedure_wq);
+				schedule_task(&priv->ieee80211->associate_procedure_wq);
 #endif
 
 			}
 		}
 		priv->ieee80211->LinkDetectInfo.NumRecvBcnInPeriod=0;
-		priv->ieee80211->LinkDetectInfo.NumRecvDataInPeriod=0;	
+		priv->ieee80211->LinkDetectInfo.NumRecvDataInPeriod=0;
 	}
 //	CAM_read_entry(dev,4);
 	//check if reset the driver
 	if(check_reset_cnt++ >= 3)
 	{
-    		ResetType = rtl819x_ifcheck_resetornot(dev);
+		ResetType = rtl819x_ifcheck_resetornot(dev);
 		check_reset_cnt = 3;
 		//DbgPrint("Start to check silent reset\n");
 	}
 	//	RT_TRACE(COMP_RESET,"%s():priv->force_reset is %d,priv->ResetProgress is %d, priv->bForcedSilentReset is %d,priv->bDisableNormalResetCheck is %d,ResetType is %d\n",__FUNCTION__,priv->force_reset,priv->ResetProgress,priv->bForcedSilentReset,priv->bDisableNormalResetCheck,ResetType);
-#if 1 
+#if 1
 	if( (priv->force_reset) || (priv->ResetProgress==RESET_TYPE_NORESET &&
 		(priv->bForcedSilentReset ||
 		(!priv->bDisableNormalResetCheck && ResetType==RESET_TYPE_SILENT)))) // This is control by OID set in Pomelo
@@ -5139,7 +5139,7 @@ extern	void	rtl819x_watchdog_wqcallback(struct net_device *dev)
 	priv->bForcedSilentReset = false;
 	priv->bResetInProgress = false;
 	RT_TRACE(COMP_TRACE, " <==RtUsbCheckForHangWorkItemCallback()\n");
-	
+
 }
 
 void watch_dog_timer_callback(unsigned long data)
@@ -5200,7 +5200,7 @@ int rtl8192_open(struct net_device *dev)
 	ret = rtl8192_up(dev);
 	up(&priv->wx_sem);
 	return ret;
-	
+
 }
 
 
@@ -5209,7 +5209,7 @@ int rtl8192_up(struct net_device *dev)
 	struct r8192_priv *priv = ieee80211_priv(dev);
 
 	if (priv->up == 1) return -1;
-	
+
 	return _rtl8192_up(dev);
 }
 
@@ -5218,13 +5218,13 @@ int rtl8192_close(struct net_device *dev)
 {
 	struct r8192_priv *priv = ieee80211_priv(dev);
 	int ret;
-	
+
 	down(&priv->wx_sem);
 
 	ret = rtl8192_down(dev);
-	
+
 	up(&priv->wx_sem);
-	
+
 	return ret;
 
 }
@@ -5235,36 +5235,36 @@ int rtl8192_down(struct net_device *dev)
 	int i;
 
 	if (priv->up == 0) return -1;
-	
+
 	priv->up=0;
 	priv->ieee80211->ieee_up = 0;
 	RT_TRACE(COMP_DOWN, "==========>%s()\n", __FUNCTION__);
 /* FIXME */
 	if (!netif_queue_stopped(dev))
 		netif_stop_queue(dev);
-	
+
 	rtl8192_rtx_disable(dev);
 	//rtl8192_irq_disable(dev);
 
  /* Tx related queue release */
-        for(i = 0; i < MAX_QUEUE_SIZE; i++) {
-                skb_queue_purge(&priv->ieee80211->skb_waitQ [i]);
-        }
-        for(i = 0; i < MAX_QUEUE_SIZE; i++) {
-                skb_queue_purge(&priv->ieee80211->skb_aggQ [i]);
-        }
-
-        for(i = 0; i < MAX_QUEUE_SIZE; i++) {
-                skb_queue_purge(&priv->ieee80211->skb_drv_aggQ [i]);
-        }
-
-        //as cancel_delayed_work will del work->timer, so if work is not definedas struct delayed_work, it will corrupt
+	for(i = 0; i < MAX_QUEUE_SIZE; i++) {
+		skb_queue_purge(&priv->ieee80211->skb_waitQ [i]);
+	}
+	for(i = 0; i < MAX_QUEUE_SIZE; i++) {
+		skb_queue_purge(&priv->ieee80211->skb_aggQ [i]);
+	}
+
+	for(i = 0; i < MAX_QUEUE_SIZE; i++) {
+		skb_queue_purge(&priv->ieee80211->skb_drv_aggQ [i]);
+	}
+
+	//as cancel_delayed_work will del work->timer, so if work is not definedas struct delayed_work, it will corrupt
 //	flush_scheduled_work();
 	rtl8192_cancel_deferred_work(priv);
 	deinit_hal_dm(dev);
-	del_timer_sync(&priv->watch_dog_timer);	
+	del_timer_sync(&priv->watch_dog_timer);
+
 
-	
 	ieee80211_softmac_stop_protocol(priv->ieee80211);
 	memset(&priv->ieee80211->current_network, 0 , offsetof(struct ieee80211_network, list));
 	RT_TRACE(COMP_DOWN, "<==========%s()\n", __FUNCTION__);
@@ -5282,15 +5282,15 @@ void rtl8192_commit(struct net_device *dev)
 	priv->up = 0;
 
 	rtl8192_cancel_deferred_work(priv);
-	del_timer_sync(&priv->watch_dog_timer);	
+	del_timer_sync(&priv->watch_dog_timer);
 	//cancel_delayed_work(&priv->SwChnlWorkItem);
 
 	ieee80211_softmac_stop_protocol(priv->ieee80211);
-	
+
 	//rtl8192_irq_disable(dev);
 	rtl8192_rtx_disable(dev);
 	reset_status = _rtl8192_up(dev);
-	
+
 }
 
 /*
@@ -5301,19 +5301,19 @@ void rtl8192_restart(struct net_device *dev)
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
 void rtl8192_restart(struct work_struct *work)
 {
-        struct r8192_priv *priv = container_of(work, struct r8192_priv, reset_wq);
-        struct net_device *dev = priv->ieee80211->dev;
+	struct r8192_priv *priv = container_of(work, struct r8192_priv, reset_wq);
+	struct net_device *dev = priv->ieee80211->dev;
 #else
 void rtl8192_restart(struct net_device *dev)
 {
 
-        struct r8192_priv *priv = ieee80211_priv(dev);
+	struct r8192_priv *priv = ieee80211_priv(dev);
 #endif
 
 	down(&priv->wx_sem);
-	
+
 	rtl8192_commit(dev);
-	
+
 	up(&priv->wx_sem);
 }
 
@@ -5323,16 +5323,16 @@ static void r8192_set_multicast(struct net_device *dev)
 	short promisc;
 
 	//down(&priv->wx_sem);
-	
+
 	/* FIXME FIXME */
-	
+
 	promisc = (dev->flags & IFF_PROMISC) ? 1:0;
-	
+
 	if (promisc != priv->promisc)
 	//	rtl8192_commit(dev);
-	
+
 	priv->promisc = promisc;
-	
+
 	//schedule_work(&priv->reset_wq);
 	//up(&priv->wx_sem);
 }
@@ -5342,18 +5342,18 @@ int r8192_set_mac_adr(struct net_device *dev, void *mac)
 {
 	struct r8192_priv *priv = ieee80211_priv(dev);
 	struct sockaddr *addr = mac;
-	
+
 	down(&priv->wx_sem);
-	
+
 	memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
-		
+
 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
 	schedule_work(&priv->reset_wq);
 #else
 	schedule_task(&priv->reset_wq);
-#endif	
+#endif
 	up(&priv->wx_sem);
-	
+
 	return 0;
 }
 
@@ -5373,24 +5373,24 @@ int rtl8192_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 
 
      if (p->length < sizeof(struct ieee_param) || !p->pointer){
-             ret = -EINVAL;
-             goto out;
+	     ret = -EINVAL;
+	     goto out;
 	}
 
      ipw = (struct ieee_param *)kmalloc(p->length, GFP_KERNEL);
      if (ipw == NULL){
-             ret = -ENOMEM;
-             goto out;
+	     ret = -ENOMEM;
+	     goto out;
      }
      if (copy_from_user(ipw, p->pointer, p->length)) {
 		kfree(ipw);
-            ret = -EFAULT;
-            goto out;
-	}		
+	    ret = -EFAULT;
+	    goto out;
+	}
 
 	switch (cmd) {
 	    case RTL_IOCTL_WPA_SUPPLICANT:
-	//parse here for HW security	
+	//parse here for HW security
 			if (ipw->cmd == IEEE_CMD_SET_ENCRYPTION)
 			{
 				if (ipw->u.crypt.set_tx)
@@ -5439,13 +5439,13 @@ int rtl8192_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 
 					if (ieee->group_key_type)
 					{
-							setKey(	dev, 
+							setKey(	dev,
 								ipw->u.crypt.idx,
-								ipw->u.crypt.idx,		//KeyIndex 
-						     		ieee->group_key_type,	//KeyType
-						            	broadcast_addr,	//MacAddr
+								ipw->u.crypt.idx,		//KeyIndex
+								ieee->group_key_type,	//KeyType
+								broadcast_addr,	//MacAddr
 								0,		//DefaultKey
-							      	key);		//KeyContent
+								key);		//KeyContent
 					}
 				}
 			}
@@ -5459,14 +5459,14 @@ int rtl8192_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 		printk("\n");
 #endif /*JOHN_HWSEC_DEBUG*/
 		ret = ieee80211_wpa_supplicant_ioctl(priv->ieee80211, &wrq->u.data);
-		break; 
+		break;
 
 	    default:
 		ret = -EOPNOTSUPP;
 		break;
 	}
 	kfree(ipw);
-        ipw = NULL;
+	ipw = NULL;
 out:
 	up(&priv->wx_sem);
 	return ret;
@@ -5530,16 +5530,16 @@ u8 HwRateToMRate90(bool bIsHT, u8 rate)
 /**
  * Function:     UpdateRxPktTimeStamp
  * Overview:     Recored down the TSF time stamp when receiving a packet
- * 
- * Input:                
+ *
+ * Input:
  *       PADAPTER        Adapter
  *       PRT_RFD         pRfd,
- *                       
- * Output:               
+ *
+ * Output:
  *       PRT_RFD         pRfd
  *                               (pRfd->Status.TimeStampHigh is updated)
  *                               (pRfd->Status.TimeStampLow is updated)
- * Return:       
+ * Return:
  *               None
  */
 void UpdateRxPktTimeStamp8190 (struct net_device *dev, struct ieee80211_rx_stats *stats)
@@ -5562,8 +5562,8 @@ long rtl819x_translate_todbm(u8 signal_strength_index	)// 0-100 index.
 	long	signal_power; // in dBm.
 
 	// Translate to dBm (x=0.5y-95).
-	signal_power = (long)((signal_strength_index + 1) >> 1); 
-	signal_power -= 95; 
+	signal_power = (long)((signal_strength_index + 1) >> 1);
+	signal_power -= 95;
 
 	return signal_power;
 }
@@ -5579,7 +5579,7 @@ void rtl8192_process_phyinfo(struct r8192_priv * priv,u8* buffer, struct ieee802
 	u8	rfpath;
 	u32	nspatial_stream, tmp_val;
 	//u8	i;
-	static u32 slide_rssi_index=0, slide_rssi_statistics=0;	
+	static u32 slide_rssi_index=0, slide_rssi_statistics=0;
 	static u32 slide_evm_index=0, slide_evm_statistics=0;
 	static u32 last_rssi=0, last_evm=0;
 
@@ -5602,7 +5602,7 @@ void rtl8192_process_phyinfo(struct r8192_priv * priv,u8* buffer, struct ieee802
 	{
 		// if previous packet is not aggregated packet
 		bcheck = true;
-	}else 
+	}else
 	{
 	#if 0
 		// if previous packet is aggregated packet, and current packet
@@ -5622,11 +5622,11 @@ void rtl8192_process_phyinfo(struct r8192_priv * priv,u8* buffer, struct ieee802
 		priv->stats.slide_rssi_total -= last_rssi;
 	}
 	priv->stats.slide_rssi_total += pprevious_stats->SignalStrength;
-	
+
 	priv->stats.slide_signal_strength[slide_rssi_index++] = pprevious_stats->SignalStrength;
 	if(slide_rssi_index >= PHY_RSSI_SLID_WIN_MAX)
 		slide_rssi_index = 0;
-	
+
 	// <1> Showed on UI for user, in dbm
 	tmp_val = priv->stats.slide_rssi_total/slide_rssi_statistics;
 	priv->stats.signal_strength = rtl819x_translate_todbm((u8)tmp_val);
@@ -5645,14 +5645,14 @@ void rtl8192_process_phyinfo(struct r8192_priv * priv,u8* buffer, struct ieee802
 
 
 	//rtl8190_process_cck_rxpathsel(priv,pprevious_stats);//only rtl8190 supported
-	
+
 	//
 	// Check RSSI
 	//
 	priv->stats.num_process_phyinfo++;
-	
+
 	/* record the general signal strength to the sliding window. */
-	
+
 
 	// <2> Showed on UI for engineering
 	// hardware does not provide rssi information for each rf path in CCK
@@ -5660,37 +5660,37 @@ void rtl8192_process_phyinfo(struct r8192_priv * priv,u8* buffer, struct ieee802
 	{
 		for (rfpath = RF90_PATH_A; rfpath < priv->NumTotalRFPath; rfpath++)
 		{
-                     if (!rtl8192_phy_CheckIsLegalRFPath(priv->ieee80211->dev, rfpath))		
-			         continue;
-	
+		     if (!rtl8192_phy_CheckIsLegalRFPath(priv->ieee80211->dev, rfpath))
+				 continue;
+
 			//Fixed by Jacken 2008-03-20
 			if(priv->stats.rx_rssi_percentage[rfpath] == 0)
 			{
 				priv->stats.rx_rssi_percentage[rfpath] = pprevious_stats->RxMIMOSignalStrength[rfpath];
 				//DbgPrint("MIMO RSSI initialize \n");
-			}	
+			}
 			if(pprevious_stats->RxMIMOSignalStrength[rfpath]  > priv->stats.rx_rssi_percentage[rfpath])
 			{
-				priv->stats.rx_rssi_percentage[rfpath] = 
-					( (priv->stats.rx_rssi_percentage[rfpath]*(Rx_Smooth_Factor-1)) + 
+				priv->stats.rx_rssi_percentage[rfpath] =
+					( (priv->stats.rx_rssi_percentage[rfpath]*(Rx_Smooth_Factor-1)) +
 					(pprevious_stats->RxMIMOSignalStrength[rfpath])) /(Rx_Smooth_Factor);
 				priv->stats.rx_rssi_percentage[rfpath] = priv->stats.rx_rssi_percentage[rfpath]  + 1;
 			}
 			else
 			{
-				priv->stats.rx_rssi_percentage[rfpath] = 
-					( (priv->stats.rx_rssi_percentage[rfpath]*(Rx_Smooth_Factor-1)) + 
+				priv->stats.rx_rssi_percentage[rfpath] =
+					( (priv->stats.rx_rssi_percentage[rfpath]*(Rx_Smooth_Factor-1)) +
 					(pprevious_stats->RxMIMOSignalStrength[rfpath])) /(Rx_Smooth_Factor);
-			}	
+			}
 			RT_TRACE(COMP_DBG,"priv->stats.rx_rssi_percentage[rfPath]  = %d \n" ,priv->stats.rx_rssi_percentage[rfpath] );
-		}		
+		}
 	}
-	
-	
+
+
 	//
 	// Check PWDB.
 	//
-	RT_TRACE(COMP_RXDESC, "Smooth %s PWDB = %d\n", 
+	RT_TRACE(COMP_RXDESC, "Smooth %s PWDB = %d\n",
 				pprevious_stats->bIsCCK? "CCK": "OFDM",
 				pprevious_stats->RxPWDBAll);
 
@@ -5699,10 +5699,10 @@ void rtl8192_process_phyinfo(struct r8192_priv * priv,u8* buffer, struct ieee802
 /* record the beacon pwdb to the sliding window. */
 		if(slide_beacon_adc_pwdb_statistics++ >= PHY_Beacon_RSSI_SLID_WIN_MAX)
 		{
-			slide_beacon_adc_pwdb_statistics = PHY_Beacon_RSSI_SLID_WIN_MAX;	
+			slide_beacon_adc_pwdb_statistics = PHY_Beacon_RSSI_SLID_WIN_MAX;
 			last_beacon_adc_pwdb = priv->stats.Slide_Beacon_pwdb[slide_beacon_adc_pwdb_index];
 			priv->stats.Slide_Beacon_Total -= last_beacon_adc_pwdb;
-			//DbgPrint("slide_beacon_adc_pwdb_index = %d, last_beacon_adc_pwdb = %d, Adapter->RxStats.Slide_Beacon_Total = %d\n", 
+			//DbgPrint("slide_beacon_adc_pwdb_index = %d, last_beacon_adc_pwdb = %d, Adapter->RxStats.Slide_Beacon_Total = %d\n",
 			//	slide_beacon_adc_pwdb_index, last_beacon_adc_pwdb, Adapter->RxStats.Slide_Beacon_Total);
 		}
 		priv->stats.Slide_Beacon_Total += pprevious_stats->RxPWDBAll;
@@ -5713,14 +5713,14 @@ void rtl8192_process_phyinfo(struct r8192_priv * priv,u8* buffer, struct ieee802
 			slide_beacon_adc_pwdb_index = 0;
 		pprevious_stats->RxPWDBAll = priv->stats.Slide_Beacon_Total/slide_beacon_adc_pwdb_statistics;
 		if(pprevious_stats->RxPWDBAll >= 3)
-			pprevious_stats->RxPWDBAll -= 3;	
+			pprevious_stats->RxPWDBAll -= 3;
 	}
 
-	RT_TRACE(COMP_RXDESC, "Smooth %s PWDB = %d\n", 
+	RT_TRACE(COMP_RXDESC, "Smooth %s PWDB = %d\n",
 				pprevious_stats->bIsCCK? "CCK": "OFDM",
 				pprevious_stats->RxPWDBAll);
-	
-	
+
+
 	if(pprevious_stats->bPacketToSelf || pprevious_stats->bPacketBeacon || pprevious_stats->bToSelfBA)
 	{
 		if(priv->undecorated_smoothed_pwdb < 0)	// initialize
@@ -5731,37 +5731,37 @@ void rtl8192_process_phyinfo(struct r8192_priv * priv,u8* buffer, struct ieee802
 #if 1
 		if(pprevious_stats->RxPWDBAll > (u32)priv->undecorated_smoothed_pwdb)
 		{
-			priv->undecorated_smoothed_pwdb =	
-					( ((priv->undecorated_smoothed_pwdb)*(Rx_Smooth_Factor-1)) + 
+			priv->undecorated_smoothed_pwdb =
+					( ((priv->undecorated_smoothed_pwdb)*(Rx_Smooth_Factor-1)) +
 					(pprevious_stats->RxPWDBAll)) /(Rx_Smooth_Factor);
 			priv->undecorated_smoothed_pwdb = priv->undecorated_smoothed_pwdb + 1;
 		}
 		else
 		{
-			priv->undecorated_smoothed_pwdb =	
-					( ((priv->undecorated_smoothed_pwdb)*(Rx_Smooth_Factor-1)) + 
+			priv->undecorated_smoothed_pwdb =
+					( ((priv->undecorated_smoothed_pwdb)*(Rx_Smooth_Factor-1)) +
 					(pprevious_stats->RxPWDBAll)) /(Rx_Smooth_Factor);
 		}
 #else
 		//Fixed by Jacken 2008-03-20
 		if(pPreviousRfd->Status.RxPWDBAll > (u32)pHalData->UndecoratedSmoothedPWDB)
 		{
-			pHalData->UndecoratedSmoothedPWDB = 	
+			pHalData->UndecoratedSmoothedPWDB =
 					( ((pHalData->UndecoratedSmoothedPWDB)* 5) + (pPreviousRfd->Status.RxPWDBAll)) / 6;
 			pHalData->UndecoratedSmoothedPWDB = pHalData->UndecoratedSmoothedPWDB + 1;
 		}
 		else
 		{
-			pHalData->UndecoratedSmoothedPWDB = 	
+			pHalData->UndecoratedSmoothedPWDB =
 					( ((pHalData->UndecoratedSmoothedPWDB)* 5) + (pPreviousRfd->Status.RxPWDBAll)) / 6;
-		}		
+		}
 #endif
 
 	}
 
 	//
 	// Check EVM
-	//	
+	//
 	/* record the general EVM to the sliding window. */
 	if(pprevious_stats->SignalQuality == 0)
 	{
@@ -5774,13 +5774,13 @@ void rtl8192_process_phyinfo(struct r8192_priv * priv,u8* buffer, struct ieee802
 				last_evm = priv->stats.slide_evm[slide_evm_index];
 				priv->stats.slide_evm_total -= last_evm;
 			}
-	
+
 			priv->stats.slide_evm_total += pprevious_stats->SignalQuality;
-	
+
 			priv->stats.slide_evm[slide_evm_index++] = pprevious_stats->SignalQuality;
 			if(slide_evm_index >= PHY_RSSI_SLID_WIN_MAX)
 				slide_evm_index = 0;
-	
+
 			// <1> Showed on UI for user, in percentage.
 			tmp_val = priv->stats.slide_evm_total/slide_evm_statistics;
 			priv->stats.signal_quality = tmp_val;
@@ -5799,21 +5799,21 @@ void rtl8192_process_phyinfo(struct r8192_priv * priv,u8* buffer, struct ieee802
 					{
 						priv->stats.rx_evm_percentage[nspatial_stream] = pprevious_stats->RxMIMOSignalQuality[nspatial_stream];
 					}
-					priv->stats.rx_evm_percentage[nspatial_stream] = 
-						( (priv->stats.rx_evm_percentage[nspatial_stream]* (Rx_Smooth_Factor-1)) + 
+					priv->stats.rx_evm_percentage[nspatial_stream] =
+						( (priv->stats.rx_evm_percentage[nspatial_stream]* (Rx_Smooth_Factor-1)) +
 						(pprevious_stats->RxMIMOSignalQuality[nspatial_stream]* 1)) / (Rx_Smooth_Factor);
 				}
 			}
 		}
 	}
-	
-	
+
+
 }
 
 /*-----------------------------------------------------------------------------
  * Function:	rtl819x_query_rxpwrpercentage()
  *
- * Overview:	
+ * Overview:
  *
  * Input:		char		antpower
  *
@@ -5823,7 +5823,7 @@ void rtl8192_process_phyinfo(struct r8192_priv * priv,u8* buffer, struct ieee802
  *
  * Revised History:
  *	When		Who		Remark
- *	05/26/2008	amy		Create Version 0 porting from windows code.  
+ *	05/26/2008	amy		Create Version 0 porting from windows code.
  *
  *---------------------------------------------------------------------------*/
 static u8 rtl819x_query_rxpwrpercentage(
@@ -5842,22 +5842,22 @@ static u8 rtl819x_query_rxpwrpercentage(
 	{
 		return	(100+antpower);
 	}
-	
+
 }	/* QueryRxPwrPercentage */
 
-static u8 
+static u8
 rtl819x_evm_dbtopercentage(
     char value
     )
 {
     char ret_val;
-    
+
     ret_val = value;
-    
+
     if(ret_val >= 0)
-        ret_val = 0;
+	ret_val = 0;
     if(ret_val <= -33)
-        ret_val = -33;
+	ret_val = -33;
     ret_val = 0 - ret_val;
     ret_val*=3;
 	if(ret_val == 99)
@@ -5917,7 +5917,7 @@ rtl819x_signal_scale_mapping(
 	{
 		retsig = currsig;
 	}
-	
+
 	return retsig;
 }
 
@@ -5931,8 +5931,8 @@ static void rtl8192_query_rxphystatus(
 	bool bPacketBeacon,
 	bool bToSelfBA
 	)
-{	
-	//PRT_RFD_STATUS		pRtRfdStatus = &(pRfd->Status);	
+{
+	//PRT_RFD_STATUS		pRtRfdStatus = &(pRfd->Status);
 	phy_sts_ofdm_819xusb_t*	pofdm_buf;
 	phy_sts_cck_819xusb_t	*	pcck_buf;
 	phy_ofdm_rx_status_rxsc_sgien_exintfflag* prxsc;
@@ -5946,10 +5946,10 @@ static void rtl8192_query_rxphystatus(
 //	long				signal_strength_index = 0;
 	u8				is_cck_rate=0;
 	u8				rf_rx_num = 0;
-	
+
 
 	priv->stats.numqry_phystatus++;
-	
+
 	is_cck_rate = rx_hal_is_cck_rate(pdrvinfo);
 
 	// Record it for next packet processing
@@ -5959,31 +5959,31 @@ static void rtl8192_query_rxphystatus(
 	pstats->bIsCCK = precord_stats->bIsCCK = is_cck_rate;//RX_HAL_IS_CCK_RATE(pDrvInfo);
 	pstats->bPacketBeacon = precord_stats->bPacketBeacon = bPacketBeacon;
 	pstats->bToSelfBA = precord_stats->bToSelfBA = bToSelfBA;
-	
-	prxpkt = (u8*)pdrvinfo;	
-	
-	/* Move pointer to the 16th bytes. Phy status start address. */	
-	prxpkt += sizeof(rx_drvinfo_819x_usb);	
-	
+
+	prxpkt = (u8*)pdrvinfo;
+
+	/* Move pointer to the 16th bytes. Phy status start address. */
+	prxpkt += sizeof(rx_drvinfo_819x_usb);
+
 	/* Initial the cck and ofdm buffer pointer */
 	pcck_buf = (phy_sts_cck_819xusb_t *)prxpkt;
-	pofdm_buf = (phy_sts_ofdm_819xusb_t *)prxpkt;			
-			
+	pofdm_buf = (phy_sts_ofdm_819xusb_t *)prxpkt;
+
 	pstats->RxMIMOSignalQuality[0] = -1;
 	pstats->RxMIMOSignalQuality[1] = -1;
 	precord_stats->RxMIMOSignalQuality[0] = -1;
 	precord_stats->RxMIMOSignalQuality[1] = -1;
-			
+
 	if(is_cck_rate)
 	{
-		// 
+		//
 		// (1)Hardware does not provide RSSI for CCK
 		//
 
 		//
 		// (2)PWDB, Average PWDB cacluated by hardware (for rate adaptive)
 		//
-		u8 report;//, cck_agc_rpt; 
+		u8 report;//, cck_agc_rpt;
 
 		priv->stats.numqry_phystatusCCK++;
 
@@ -6048,7 +6048,7 @@ static void rtl8192_query_rxphystatus(
 			}else
 			{
 				sq = pcck_buf->sq_rpt;
-				
+
 				if(pcck_buf->sq_rpt > 64)
 					sq = 0;
 				else if (pcck_buf->sq_rpt < 20)
@@ -6064,7 +6064,7 @@ static void rtl8192_query_rxphystatus(
 	else
 	{
 		priv->stats.numqry_phystatusHT++;
-		// 
+		//
 		// (1)Get RSSI for HT rate
 		//
 		for(i=RF90_PATH_A; i<priv->NumTotalRFPath; i++)
@@ -6075,7 +6075,7 @@ static void rtl8192_query_rxphystatus(
 			else
 				continue;
 
-		if (!rtl8192_phy_CheckIsLegalRFPath(priv->ieee80211->dev, i))		
+		if (!rtl8192_phy_CheckIsLegalRFPath(priv->ieee80211->dev, i))
 				continue;
 
 			//Fixed by Jacken from Bryant 2008-03-20
@@ -6088,9 +6088,9 @@ static void rtl8192_query_rxphystatus(
 			//rx_snrX >>= 1;;
 			rx_snrX /= 2;
 			priv->stats.rxSNRdB[i] = (long)rx_snrX;
-			
+
 			/* Translate DBM to percentage. */
-			RSSI = rtl819x_query_rxpwrpercentage(rx_pwr[i]);	
+			RSSI = rtl819x_query_rxpwrpercentage(rx_pwr[i]);
 			total_rssi += RSSI;
 
 			/* Record Signal Strength for next packet */
@@ -6100,24 +6100,24 @@ static void rtl8192_query_rxphystatus(
 				precord_stats->RxMIMOSignalStrength[i] =(u8) RSSI;
 			}
 		}
-		
-		
+
+
 		//
 		// (2)PWDB, Average PWDB cacluated by hardware (for rate adaptive)
 		//
 		//Fixed by Jacken from Bryant 2008-03-20
 		//Original value is 106
 		rx_pwr_all = (((pofdm_buf->pwdb_all ) >> 1 )& 0x7f) -106;
-		pwdb_all = rtl819x_query_rxpwrpercentage(rx_pwr_all);	
+		pwdb_all = rtl819x_query_rxpwrpercentage(rx_pwr_all);
 
 		pstats->RxPWDBAll = precord_stats->RxPWDBAll = pwdb_all;
 		pstats->RxPower = precord_stats->RxPower =  rx_pwr_all;
-		
+
 		//
 		// (3)EVM of HT rate
 		//
 		if(pdrvinfo->RxHT && pdrvinfo->RxRate>=DESC90_RATEMCS8 &&
-		 	pdrvinfo->RxRate<=DESC90_RATEMCS15)
+			pdrvinfo->RxRate<=DESC90_RATEMCS15)
 			max_spatial_stream = 2; //both spatial stream make sense
 		else
 			max_spatial_stream = 1; //only spatial stream 1 makes sense
@@ -6126,14 +6126,14 @@ static void rtl8192_query_rxphystatus(
 		{
 			tmp_rxevm =	pofdm_buf->rxevm_X[i];
 			rx_evmX = (char)(tmp_rxevm);
-			
+
 			// Do not use shift operation like "rx_evmX >>= 1" because the compilor of free build environment
-			// fill most significant bit to "zero" when doing shifting operation which may change a negative 
+			// fill most significant bit to "zero" when doing shifting operation which may change a negative
 			// value to positive one, then the dbm value (which is supposed to be negative)  is not correct anymore.
 			rx_evmX /= 2;	//dbm
 
 			evm = rtl819x_evm_dbtopercentage(rx_evmX);
-#if 0			
+#if 0
 			EVM = SignalScaleMapping(EVM);//make it good looking, from 0~100
 #endif
 			//if(bpacket_match_bssid)
@@ -6144,7 +6144,7 @@ static void rtl8192_query_rxphystatus(
 			}
 		}
 
-		
+
 		/* record rx statistics for debug */
 		rxsc_sgien_exflg = pofdm_buf->rxsc_sgien_exflg;
 		prxsc =	(phy_ofdm_rx_status_rxsc_sgien_exintfflag *)&rxsc_sgien_exflg;
@@ -6159,14 +6159,14 @@ static void rtl8192_query_rxphystatus(
 	if(is_cck_rate)
 	{
 		pstats->SignalStrength = precord_stats->SignalStrength = (u8)(rtl819x_signal_scale_mapping((long)pwdb_all));//PWDB_ALL;
-		
+
 	}
 	else
 	{
 		//pRfd->Status.SignalStrength = pRecordRfd->Status.SignalStrength = (u8)(SignalScaleMapping(total_rssi/=RF90_PATH_MAX));//(u8)(total_rssi/=RF90_PATH_MAX);
 		// We can judge RX path number now.
 		if (rf_rx_num != 0)
-			pstats->SignalStrength = precord_stats->SignalStrength = (u8)(rtl819x_signal_scale_mapping((long)(total_rssi/=rf_rx_num)));		
+			pstats->SignalStrength = precord_stats->SignalStrength = (u8)(rtl819x_signal_scale_mapping((long)(total_rssi/=rf_rx_num)));
 	}
 }	/* QueryRxPhyStatus8190Pci */
 
@@ -6182,9 +6182,9 @@ rtl8192_record_rxdesc_forlateruse(
 }
 
 
-void TranslateRxSignalStuff819xUsb(struct sk_buff *skb, 
+void TranslateRxSignalStuff819xUsb(struct sk_buff *skb,
 				   struct ieee80211_rx_stats * pstats,
-                                   rx_drvinfo_819x_usb  *pdrvinfo)
+				   rx_drvinfo_819x_usb  *pdrvinfo)
 {
 	// TODO: We must only check packet for current MAC address. Not finish
 	rtl8192_rx_info *info = (struct rtl8192_rx_info *)skb->cb;
@@ -6195,25 +6195,25 @@ void TranslateRxSignalStuff819xUsb(struct sk_buff *skb,
 	static struct ieee80211_rx_stats  previous_stats;
 	struct ieee80211_hdr_3addr *hdr;//by amy
        u16 fc,type;
-		
+
 	// Get Signal Quality for only RX data queue (but not command queue)
-		
+
 	u8* tmp_buf;
 	//u16 tmp_buf_len = 0;
 	u8  *praddr;
-	
-	/* Get MAC frame start address. */		
+
+	/* Get MAC frame start address. */
 	tmp_buf = (u8*)skb->data;// + get_rxpacket_shiftbytes_819xusb(pstats);
 
 	hdr = (struct ieee80211_hdr_3addr *)tmp_buf;
 	fc = le16_to_cpu(hdr->frame_ctl);
-	type = WLAN_FC_GET_TYPE(fc);	
+	type = WLAN_FC_GET_TYPE(fc);
 	praddr = hdr->addr1;
 
 	/* Check if the received packet is acceptabe. */
 	bpacket_match_bssid = ((IEEE80211_FTYPE_CTL != type) &&
-                                			(eqMacAddr(priv->ieee80211->current_network.bssid,  (fc & IEEE80211_FCTL_TODS)? hdr->addr1 : (fc & IEEE80211_FCTL_FROMDS )? hdr->addr2 : hdr->addr3))
-                                				 && (!pstats->bHwError) && (!pstats->bCRC)&& (!pstats->bICV));
+							(eqMacAddr(priv->ieee80211->current_network.bssid,  (fc & IEEE80211_FCTL_TODS)? hdr->addr1 : (fc & IEEE80211_FCTL_FROMDS )? hdr->addr2 : hdr->addr3))
+								 && (!pstats->bHwError) && (!pstats->bCRC)&& (!pstats->bICV));
 	bpacket_toself =  bpacket_match_bssid & (eqMacAddr(praddr, priv->ieee80211->dev->dev_addr));
 
 #if 1//cosa
@@ -6229,9 +6229,9 @@ void TranslateRxSignalStuff819xUsb(struct sk_buff *skb,
 				//DbgPrint("BlockAck, MatchBSSID = %d, ToSelf = %d \n", bPacketMatchBSSID, bPacketToSelf);
 		}
 
-#endif	
+#endif
+
 
-				 
 	if(bpacket_match_bssid)
 	{
 		priv->stats.numpacket_matchbssid++;
@@ -6242,26 +6242,26 @@ void TranslateRxSignalStuff819xUsb(struct sk_buff *skb,
 	//
 	// Process PHY information for previous packet (RSSI/PWDB/EVM)
 	//
-	// Because phy information is contained in the last packet of AMPDU only, so driver 
-	// should process phy information of previous packet	
+	// Because phy information is contained in the last packet of AMPDU only, so driver
+	// should process phy information of previous packet
 	rtl8192_process_phyinfo(priv, tmp_buf, &previous_stats, pstats);
 	rtl8192_query_rxphystatus(priv, pstats, pdrvinfo, &previous_stats, bpacket_match_bssid,bpacket_toself,bPacketBeacon,bToSelfBA);
 	rtl8192_record_rxdesc_forlateruse(pstats, &previous_stats);
-		
+
 }
 
 /**
 * Function:	UpdateReceivedRateHistogramStatistics
 * Overview:	Recored down the received data rate
-* 
-* Input:		
+*
+* Input:
 * 	struct net_device *dev
 *	struct ieee80211_rx_stats *stats
-* 			
-* Output:		
-*	
+*
+* Output:
+*
 *			(priv->stats.ReceivedRateHistogram[] is updated)
-* Return:     	
+* Return:
 *		None
 */
 void
@@ -6271,20 +6271,20 @@ UpdateReceivedRateHistogramStatistics8190(
 	)
 {
 	struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
-    	u32 rcvType=1;   //0: Total, 1:OK, 2:CRC, 3:ICV
-    	u32 rateIndex;
-    	u32 preamble_guardinterval;  //1: short preamble/GI, 0: long preamble/GI
-    
-				
-    	if(stats->bCRC)
-       	rcvType = 2;
-   	else if(stats->bICV)
-       	rcvType = 3;
-    
-   	if(stats->bShortPreamble)
-       	preamble_guardinterval = 1;// short
-    	else
-       	preamble_guardinterval = 0;// long
+	u32 rcvType=1;   //0: Total, 1:OK, 2:CRC, 3:ICV
+	u32 rateIndex;
+	u32 preamble_guardinterval;  //1: short preamble/GI, 0: long preamble/GI
+
+
+	if(stats->bCRC)
+	rcvType = 2;
+	else if(stats->bICV)
+	rcvType = 3;
+
+	if(stats->bShortPreamble)
+	preamble_guardinterval = 1;// short
+	else
+	preamble_guardinterval = 0;// long
 
 	switch(stats->rate)
 	{
@@ -6343,7 +6343,7 @@ void query_rxdesc_status(struct sk_buff *skb, struct ieee80211_rx_stats *stats,
 
 	//
 	//Get Rx Descriptor Information
-	//      
+	//
 #ifdef USB_RX_AGGREGATION_SUPPORT
 	if (bIsRxAggrSubframe)
 	{
@@ -6398,7 +6398,7 @@ void query_rxdesc_status(struct sk_buff *skb, struct ieee80211_rx_stats *stats,
 			{
 				// Abnormal Case: Receive CRC OK packet with Rx descriptor indicating non supported rate.
 				// Special Error Handling here, 2008.05.16, by Emily
-				
+
 				stats->bHwError = 1;
 				stats->rate = MGN_1M;	//Set 1M rate by default
 			}else
@@ -6411,9 +6411,9 @@ void query_rxdesc_status(struct sk_buff *skb, struct ieee80211_rx_stats *stats,
 
 		stats->bShortPreamble = driver_info->SPLCP;
 
-		
+
 		UpdateReceivedRateHistogramStatistics8190(dev, stats);
-		 
+
 		stats->bIsAMPDU = (driver_info->PartAggr==1);
 		stats->bFirstMPDU = (driver_info->PartAggr==1) && (driver_info->FirstAGGR==1);
 #if 0
@@ -6438,7 +6438,7 @@ void query_rxdesc_status(struct sk_buff *skb, struct ieee80211_rx_stats *stats,
 
 	skb_pull(skb,sizeof(rx_desc_819x_usb));
 	//
-	// Get Total offset of MPDU Frame Body 
+	// Get Total offset of MPDU Frame Body
 	//
 	if((stats->RxBufShift + stats->RxDrvInfoSize) > 0) {
 		stats->bShift = 1;
@@ -6459,7 +6459,7 @@ void query_rxdesc_status(struct sk_buff *skb, struct ieee80211_rx_stats *stats,
 		for(i = 0; i < skb->len; i++) {
 			if(i % 10 == 0) printk("\n");
 			printk("%02x ", skb->data[i]);
-		} 
+		}
 		printk("\n<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n");
 	}
 #endif
@@ -6475,11 +6475,11 @@ u32 GetRxPacketShiftBytes819xUsb(struct ieee80211_rx_stats  *Status, bool bIsRxA
 {
 #ifdef USB_RX_AGGREGATION_SUPPORT
 	if (bIsRxAggrSubframe)
-		return (sizeof(rx_desc_819x_usb) + Status->RxDrvInfoSize 
+		return (sizeof(rx_desc_819x_usb) + Status->RxDrvInfoSize
 			+ Status->RxBufShift + 8);
 	else
-#endif	
-		return (sizeof(rx_desc_819x_usb) + Status->RxDrvInfoSize 
+#endif
+		return (sizeof(rx_desc_819x_usb) + Status->RxDrvInfoSize
 				+ Status->RxBufShift);
 }
 
@@ -6498,7 +6498,7 @@ void rtl8192_rx_nomal(struct sk_buff* skb)
 	u32 rx_pkt_len = 0;
 	struct ieee80211_hdr_1addr *ieee80211_hdr = NULL;
 	bool unicast_packet = false;
-#ifdef USB_RX_AGGREGATION_SUPPORT	
+#ifdef USB_RX_AGGREGATION_SUPPORT
 	struct sk_buff *agg_skb = NULL;
 	u32  TotalLength = 0;
 	u32  TempDWord = 0;
@@ -6510,8 +6510,8 @@ void rtl8192_rx_nomal(struct sk_buff* skb)
 	u8  PaddingBytes = 0;
 	//add just for testing
 	u8   testing;
-	
-#endif		
+
+#endif
 
 	/* 20 is for ps-poll */
 	if((skb->len >=(20 + sizeof(rx_desc_819x_usb))) && (skb->len < RX_URB_SIZE)) {
@@ -6533,12 +6533,12 @@ void rtl8192_rx_nomal(struct sk_buff* skb)
 			PacketLength = (u16)(TempDWord & 0x3FFF); /*sCrcLng*/
 			skb = dev_alloc_skb(PacketLength);
 			memcpy(skb_put(skb,PacketLength),agg_skb->data,PacketLength);
-			PacketShiftBytes = GetRxPacketShiftBytes819xUsb(&stats, false);	
-		} 
-#endif	
+			PacketShiftBytes = GetRxPacketShiftBytes819xUsb(&stats, false);
+		}
+#endif
 		/* Process the MPDU recevied */
 		skb_trim(skb, skb->len - 4/*sCrcLng*/);
-		
+
 		rx_pkt_len = skb->len;
 		ieee80211_hdr = (struct ieee80211_hdr_1addr *)skb->data;
 		unicast_packet = false;
@@ -6570,7 +6570,7 @@ void rtl8192_rx_nomal(struct sk_buff* skb)
 			TempDWord = PacketOccupiedLendth - PacketShiftBytes; /*- PacketLength */
 			if (agg_skb->len > TempDWord)
 				skb_pull(agg_skb, TempDWord);
-			else 
+			else
 				agg_skb->len = 0;
 
 			while (agg_skb->len>=GetRxPacketShiftBytes819xUsb(&stats, true)) {
@@ -6627,7 +6627,7 @@ void rtl8192_rx_nomal(struct sk_buff* skb)
 					if (agg_skb->len > PaddingBytes)
 						skb_pull(agg_skb, PaddingBytes);
 					else
-						agg_skb->len = 0;	
+						agg_skb->len = 0;
 				}
 			}
 			dev_kfree_skb(agg_skb);
@@ -6644,7 +6644,7 @@ void rtl8192_rx_nomal(struct sk_buff* skb)
 void
 rtl819xusb_process_received_packet(
 	struct net_device *dev,
-	struct ieee80211_rx_stats *pstats	
+	struct ieee80211_rx_stats *pstats
 	)
 {
 //	bool bfreerfd=false, bqueued=false;
@@ -6694,7 +6694,7 @@ rtl819xusb_process_received_packet(
 	SwCrcCheck();
 #endif
 
-	
+
 }
 
 void query_rx_cmdpkt_desc_status(struct sk_buff *skb, struct ieee80211_rx_stats *stats)
@@ -6707,7 +6707,7 @@ void query_rx_cmdpkt_desc_status(struct sk_buff *skb, struct ieee80211_rx_stats
 
 	//
 	//Get Rx Descriptor Information
-	// 
+	//
 	stats->virtual_address = (u8*)skb->data;
 	stats->Length = desc->Length;
 	stats->RxDrvInfoSize = 0;
@@ -6742,7 +6742,7 @@ void rtl8192_rx_cmd(struct sk_buff *skb)
 
 
 		//
-		//  Process the command packet received. 
+		//  Process the command packet received.
 		//
 
 		rtl819xusb_process_received_packet(dev,&stats);
@@ -6752,7 +6752,7 @@ void rtl8192_rx_cmd(struct sk_buff *skb)
 	else
 		;
 
-	
+
 #if 0
 	desc = (u32*)(skb->data);
 	cmd = (desc[0] >> 30) & 0x03;
@@ -6761,7 +6761,7 @@ void rtl8192_rx_cmd(struct sk_buff *skb)
 		//send beacon packet
 		skb = ieee80211_get_beacon(priv->ieee80211);
 
-		if(!skb){ 
+		if(!skb){
 			DMESG("not enought memory for allocating beacon");
 			return;
 		}
@@ -6772,7 +6772,7 @@ void rtl8192_rx_cmd(struct sk_buff *skb)
 
 		if( ret != 0 ){
 			printk(KERN_ALERT "tx beacon packet error : %d !\n", ret);
-		}	
+		}
 		dev_kfree_skb_any(skb);
 	} else {//0x00
 		//{ log the device information
@@ -6784,12 +6784,12 @@ void rtl8192_rx_cmd(struct sk_buff *skb)
 
 void rtl8192_irq_rx_tasklet(struct r8192_priv *priv)
 {
-        struct sk_buff *skb;
-	struct rtl8192_rx_info *info; 
-	
-        while (NULL != (skb = skb_dequeue(&priv->skb_queue))) {
+	struct sk_buff *skb;
+	struct rtl8192_rx_info *info;
+
+	while (NULL != (skb = skb_dequeue(&priv->skb_queue))) {
 		info = (struct rtl8192_rx_info *)skb->cb;
-                switch (info->out_pipe) {
+		switch (info->out_pipe) {
 		/* Nomal packet pipe */
 			case 3:
 				//RT_TRACE(COMP_RECV, "normal in-pipe index(%d)\n",info->out_pipe);
@@ -6801,7 +6801,7 @@ void rtl8192_irq_rx_tasklet(struct r8192_priv *priv)
 			case 9:
 				RT_TRACE(COMP_RECV, "command in-pipe index(%d)\n",\
 						info->out_pipe);
-				
+
 				rtl8192_rx_cmd(skb);
 				break;
 
@@ -6812,7 +6812,7 @@ void rtl8192_irq_rx_tasklet(struct r8192_priv *priv)
 				break;
 
 		}
-        }
+	}
 }
 
 static const struct net_device_ops rtl8192_netdev_ops = {
@@ -6838,8 +6838,8 @@ static int __devinit rtl8192_usb_probe(struct usb_interface *intf,
 			 const struct usb_device_id *id)
 #else
 static void * __devinit rtl8192_usb_probe(struct usb_device *udev,
-			                unsigned int ifnum,
-			          const struct usb_device_id *id)
+					unsigned int ifnum,
+				  const struct usb_device_id *id)
 #endif
 {
 //	unsigned long ioaddr = 0;
@@ -6848,16 +6848,16 @@ static void * __devinit rtl8192_usb_probe(struct usb_device *udev,
 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
 	struct usb_device *udev = interface_to_usbdev(intf);
 #endif
-        RT_TRACE(COMP_INIT, "Oops: i'm coming\n");
+	RT_TRACE(COMP_INIT, "Oops: i'm coming\n");
 
 	dev = alloc_ieee80211(sizeof(struct r8192_priv));
-	
+
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
 	SET_MODULE_OWNER(dev);
 #endif
 
 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
-	usb_set_intfdata(intf, dev);	
+	usb_set_intfdata(intf, dev);
 	SET_NETDEV_DEV(dev, &intf->dev);
 #endif
 	priv = ieee80211_priv(dev);
@@ -6868,58 +6868,58 @@ static void * __devinit rtl8192_usb_probe(struct usb_device *udev,
 #endif
 	priv->udev=udev;
 
-        dev->netdev_ops = &rtl8192_netdev_ops;
+	dev->netdev_ops = &rtl8192_netdev_ops;
 
-         //DMESG("Oops: i'm coming\n");
+	 //DMESG("Oops: i'm coming\n");
 #if WIRELESS_EXT >= 12
 #if WIRELESS_EXT < 17
-        dev->get_wireless_stats = r8192_get_wireless_stats;
+	dev->get_wireless_stats = r8192_get_wireless_stats;
 #endif
-        dev->wireless_handlers = (struct iw_handler_def *) &r8192_wx_handlers_def;
+	dev->wireless_handlers = (struct iw_handler_def *) &r8192_wx_handlers_def;
 #endif
 	dev->type=ARPHRD_ETHER;
 
 	dev->watchdog_timeo = HZ*3;	//modified by john, 0805
 
 	if (dev_alloc_name(dev, ifname) < 0){
-                RT_TRACE(COMP_INIT, "Oops: devname already taken! Trying wlan%%d...\n");
+		RT_TRACE(COMP_INIT, "Oops: devname already taken! Trying wlan%%d...\n");
 		ifname = "wlan%d";
 		dev_alloc_name(dev, ifname);
-        }
-	
+	}
+
 	RT_TRACE(COMP_INIT, "Driver probe completed1\n");
 #if 1
-	if(rtl8192_init(dev)!=0){ 
+	if(rtl8192_init(dev)!=0){
 		RT_TRACE(COMP_ERR, "Initialization failed");
 		goto fail;
 	}
-#endif	
+#endif
 	netif_carrier_off(dev);
 	netif_stop_queue(dev);
-	
+
 	register_netdev(dev);
 	RT_TRACE(COMP_INIT, "dev name=======> %s\n",dev->name);
 	rtl8192_proc_init_one(dev);
-	
-	
+
+
 	RT_TRACE(COMP_INIT, "Driver probe completed\n");
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
 	return dev;
 #else
-	return 0;	
+	return 0;
 #endif
 
-	
+
 fail:
 	free_ieee80211(dev);
-		
+
 	RT_TRACE(COMP_ERR, "wlan driver load failed\n");
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)	
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
 	return NULL;
 #else
 	return -ENODEV;
 #endif
-	
+
 }
 
 //detach all the work and timer structure declared or inititialize in r8192U_init function.
@@ -6940,16 +6940,16 @@ void rtl8192_cancel_deferred_work(struct r8192_priv* priv)
 	cancel_delayed_work(&priv->update_beacon_wq);
 //	cancel_delayed_work(&priv->qos_activate);
 	//cancel_delayed_work(&priv->SetBWModeWorkItem);
-	//cancel_delayed_work(&priv->SwChnlWorkItem);	
+	//cancel_delayed_work(&priv->SwChnlWorkItem);
 #endif
 #endif
 
 }
 
 
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) 
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
 static void __devexit rtl8192_usb_disconnect(struct usb_interface *intf)
-#else 
+#else
 static void __devexit rtl8192_usb_disconnect(struct usb_device *udev, void *ptr)
 #endif
 {
@@ -6958,15 +6958,15 @@ static void __devexit rtl8192_usb_disconnect(struct usb_device *udev, void *ptr)
 #else
 	struct net_device *dev = (struct net_device *)ptr;
 #endif
-	
+
 	struct r8192_priv *priv = ieee80211_priv(dev);
- 	if(dev){
-		
+	if(dev){
+
 		unregister_netdev(dev);
-		
+
 		RT_TRACE(COMP_DOWN, "=============>wlan driver to be removed\n");
 		rtl8192_proc_remove_one(dev);
-		
+
 			rtl8192_down(dev);
 		if (priv->pFirmware)
 		{
@@ -7002,40 +7002,40 @@ extern void ieee80211_crypto_wep_exit(void);
 
 static int __init rtl8192_usb_module_init(void)
 {
-        int ret;
+	int ret;
 
 #ifdef CONFIG_IEEE80211_DEBUG
-        ret = ieee80211_debug_init();
-        if (ret) {
-                printk(KERN_ERR "ieee80211_debug_init() failed %d\n", ret);
-                return ret;
-        }
-#endif
-        ret = ieee80211_crypto_init();
-        if (ret) {
-                printk(KERN_ERR "ieee80211_crypto_init() failed %d\n", ret);
-                return ret;
-        }
-
-        ret = ieee80211_crypto_tkip_init();
-        if (ret) {
-                printk(KERN_ERR "ieee80211_crypto_tkip_init() failed %d\n",
-                        ret);
-                return ret;
-        }
-
-        ret = ieee80211_crypto_ccmp_init();
-        if (ret) {
-                printk(KERN_ERR "ieee80211_crypto_ccmp_init() failed %d\n",
-                        ret);
-                return ret;
-        }
-
-        ret = ieee80211_crypto_wep_init();
-        if (ret) {
-                printk(KERN_ERR "ieee80211_crypto_wep_init() failed %d\n", ret);
-                return ret;
-        }
+	ret = ieee80211_debug_init();
+	if (ret) {
+		printk(KERN_ERR "ieee80211_debug_init() failed %d\n", ret);
+		return ret;
+	}
+#endif
+	ret = ieee80211_crypto_init();
+	if (ret) {
+		printk(KERN_ERR "ieee80211_crypto_init() failed %d\n", ret);
+		return ret;
+	}
+
+	ret = ieee80211_crypto_tkip_init();
+	if (ret) {
+		printk(KERN_ERR "ieee80211_crypto_tkip_init() failed %d\n",
+			ret);
+		return ret;
+	}
+
+	ret = ieee80211_crypto_ccmp_init();
+	if (ret) {
+		printk(KERN_ERR "ieee80211_crypto_ccmp_init() failed %d\n",
+			ret);
+		return ret;
+	}
+
+	ret = ieee80211_crypto_wep_init();
+	if (ret) {
+		printk(KERN_ERR "ieee80211_crypto_wep_init() failed %d\n", ret);
+		return ret;
+	}
 
 	printk(KERN_INFO "\nLinux kernel driver for RTL8192 based WLAN cards\n");
 	printk(KERN_INFO "Copyright (c) 2007-2008, Realsil Wlan\n");
@@ -7060,20 +7060,20 @@ void rtl8192_try_wake_queue(struct net_device *dev, int pri)
 	unsigned long flags;
 	short enough_desc;
 	struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
-	
+
 	spin_lock_irqsave(&priv->tx_lock,flags);
 	enough_desc = check_nic_enough_desc(dev,pri);
-        spin_unlock_irqrestore(&priv->tx_lock,flags);	
-	
+	spin_unlock_irqrestore(&priv->tx_lock,flags);
+
 	if(enough_desc)
 		ieee80211_wake_queue(priv->ieee80211);
 }
 
 void EnableHWSecurityConfig8192(struct net_device *dev)
 {
-        u8 SECR_value = 0x0;
+	u8 SECR_value = 0x0;
 	struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
-	 struct ieee80211_device* ieee = priv->ieee80211; 
+	 struct ieee80211_device* ieee = priv->ieee80211;
 	SECR_value = SCR_TxEncEnable | SCR_RxDecEnable;
 #if 1
 	if (((KEY_TYPE_WEP40 == ieee->pairwise_key_type) || (KEY_TYPE_WEP104 == ieee->pairwise_key_type)) && (priv->ieee80211->auth_mode != 2))
@@ -7087,30 +7087,30 @@ void EnableHWSecurityConfig8192(struct net_device *dev)
 		SECR_value |= SCR_TxUseDK;
 	}
 #endif
-        //add HWSec active enable here.
+	//add HWSec active enable here.
 //default using hwsec. when peer AP is in N mode only and pairwise_key_type is none_aes(which HT_IOT_ACT_PURE_N_MODE indicates it), use software security. when peer AP is in b,g,n mode mixed and pairwise_key_type is none_aes, use g mode hw security. WB on 2008.7.4
 
 	ieee->hwsec_active = 1;
-	
+
 	if ((ieee->pHTInfo->IOTAction&HT_IOT_ACT_PURE_N_MODE) || !hwwep)//!ieee->hwsec_support) //add hwsec_support flag to totol control hw_sec on/off
 	{
 		ieee->hwsec_active = 0;
 		SECR_value &= ~SCR_RxDecEnable;
 	}
 	RT_TRACE(COMP_SEC,"%s:, hwsec:%d, pairwise_key:%d, SECR_value:%x\n", __FUNCTION__, \
-			ieee->hwsec_active, ieee->pairwise_key_type, SECR_value);	
+			ieee->hwsec_active, ieee->pairwise_key_type, SECR_value);
 	{
-                write_nic_byte(dev, SECR,  SECR_value);//SECR_value |  SCR_UseDK ); 
-        }
+		write_nic_byte(dev, SECR,  SECR_value);//SECR_value |  SCR_UseDK );
+	}
 }
 
 
-void setKey(	struct net_device *dev, 
+void setKey(	struct net_device *dev,
 		u8 EntryNo,
-		u8 KeyIndex, 
-		u16 KeyType, 
-		u8 *MacAddr, 
-		u8 DefaultKey, 
+		u8 KeyIndex,
+		u16 KeyType,
+		u8 *MacAddr,
+		u8 DefaultKey,
 		u32 *KeyContent )
 {
 	u32 TargetCommand = 0;
@@ -7121,7 +7121,7 @@ void setKey(	struct net_device *dev,
 		RT_TRACE(COMP_ERR, "cam entry exceeds in setKey()\n");
 
 	RT_TRACE(COMP_SEC, "====>to setKey(), dev:%p, EntryNo:%d, KeyIndex:%d, KeyType:%d, MacAddr"MAC_FMT"\n", dev,EntryNo, KeyIndex, KeyType, MAC_ARG(MacAddr));
-	
+
 	if (DefaultKey)
 		usConfig |= BIT15 | (KeyType<<2);
 	else
@@ -7138,22 +7138,22 @@ void setKey(	struct net_device *dev,
 					(u32)(*(MacAddr+1)) << 24|
 					(u32)usConfig;
 
-			write_nic_dword(dev, WCAMI, TargetContent); 
+			write_nic_dword(dev, WCAMI, TargetContent);
 			write_nic_dword(dev, RWCAM, TargetCommand);
 	//		printk("setkey cam =%8x\n", read_cam(dev, i+6*EntryNo));
 		}
 		else if(i==1){//MAC
-                        TargetContent = (u32)(*(MacAddr+2)) 	 |
-                                        (u32)(*(MacAddr+3)) <<  8|
-                                        (u32)(*(MacAddr+4)) << 16|
-                                        (u32)(*(MacAddr+5)) << 24;
-			write_nic_dword(dev, WCAMI, TargetContent); 
+			TargetContent = (u32)(*(MacAddr+2)) 	 |
+					(u32)(*(MacAddr+3)) <<  8|
+					(u32)(*(MacAddr+4)) << 16|
+					(u32)(*(MacAddr+5)) << 24;
+			write_nic_dword(dev, WCAMI, TargetContent);
 			write_nic_dword(dev, RWCAM, TargetCommand);
 		}
 		else {
 			//Key Material
 			if(KeyContent !=NULL){
-			write_nic_dword(dev, WCAMI, (u32)(*(KeyContent+i-2)) ); 
+			write_nic_dword(dev, WCAMI, (u32)(*(KeyContent+i-2)) );
 			write_nic_dword(dev, RWCAM, TargetCommand);
 		}
 	}
diff --git a/drivers/staging/rtl8192u/r8192U_dm.c b/drivers/staging/rtl8192u/r8192U_dm.c
index e6d9f48..0995ae1 100644
--- a/drivers/staging/rtl8192u/r8192U_dm.c
+++ b/drivers/staging/rtl8192u/r8192U_dm.c
@@ -282,7 +282,7 @@ void dm_CheckRxAggregation(struct net_device *dev) {
 
 extern  void    hal_dm_watchdog(struct net_device *dev)
 {
-        //struct r8192_priv *priv = ieee80211_priv(dev);
+	//struct r8192_priv *priv = ieee80211_priv(dev);
 
 	//static u8 	previous_bssid[6] ={0};
 		
@@ -621,7 +621,7 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device * dev)
 	bool						bHighpowerstate, viviflag = FALSE;
 	DCMD_TXCMD_T			tx_cmd;
 	u8						powerlevelOFDM24G;
-	int	    					i =0, j = 0, k = 0;
+	int						i =0, j = 0, k = 0;
 	u8						RF_Type, tmp_report[5]={0, 0, 0, 0, 0};
 	u32						Value;
 	u8						Pwr_Flag;
@@ -1010,13 +1010,13 @@ static void dm_InitializeTXPowerTracking_TSSI(struct net_device *dev)
 	struct r8192_priv *priv = ieee80211_priv(dev);
 	
 	//Initial the Tx BB index and mapping value
-	priv->txbbgain_table[0].txbb_iq_amplifygain = 	 		12;
+	priv->txbbgain_table[0].txbb_iq_amplifygain = 			12;
 	priv->txbbgain_table[0].txbbgain_value=0x7f8001fe;
-	priv->txbbgain_table[1].txbb_iq_amplifygain = 	 		11;
+	priv->txbbgain_table[1].txbb_iq_amplifygain = 			11;
 	priv->txbbgain_table[1].txbbgain_value=0x788001e2;
-	priv->txbbgain_table[2].txbb_iq_amplifygain = 	 		10;
+	priv->txbbgain_table[2].txbb_iq_amplifygain = 			10;
 	priv->txbbgain_table[2].txbbgain_value=0x71c001c7;
-	priv->txbbgain_table[3].txbb_iq_amplifygain = 	 		9;
+	priv->txbbgain_table[3].txbb_iq_amplifygain = 			9;
 	priv->txbbgain_table[3].txbbgain_value=0x6b8001ae;
 	priv->txbbgain_table[4].txbb_iq_amplifygain = 		       8;
 	priv->txbbgain_table[4].txbbgain_value=0x65400195;
@@ -1046,7 +1046,7 @@ static void dm_InitializeTXPowerTracking_TSSI(struct net_device *dev)
 	priv->txbbgain_table[16].txbbgain_value=0x32c000cb;
 	priv->txbbgain_table[17].txbb_iq_amplifygain = 		     -5;
 	priv->txbbgain_table[17].txbbgain_value=0x300000c0;
-	priv->txbbgain_table[18].txbb_iq_amplifygain = 		 	    -6;
+	priv->txbbgain_table[18].txbb_iq_amplifygain = 			    -6;
 	priv->txbbgain_table[18].txbbgain_value=0x2d4000b5;
 	priv->txbbgain_table[19].txbb_iq_amplifygain = 		     -7;
 	priv->txbbgain_table[19].txbbgain_value=0x2ac000ab;
@@ -1548,9 +1548,9 @@ static void dm_CheckTXPowerTracking_TSSI(struct net_device *dev)
 		return;
 	else
 	{
-	 	if((tx_power_track_counter % 30 == 0)&&(tx_power_track_counter != 0))
-	 	{
-	 		#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
+		if((tx_power_track_counter % 30 == 0)&&(tx_power_track_counter != 0))
+		{
+			#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
 				queue_delayed_work(priv->priv_wq,&priv->txpower_tracking_wq,0);
 			#else
 				#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
@@ -1559,7 +1559,7 @@ static void dm_CheckTXPowerTracking_TSSI(struct net_device *dev)
 				queue_work(priv->priv_wq,&priv->txpower_tracking_wq);
 				#endif
 			#endif
-	 	}
+		}
 		tx_power_track_counter++;
 	}
 	
@@ -3065,7 +3065,7 @@ static void dm_check_rfctrl_gpio(struct net_device * dev)
 	#else
 		#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
 		schedule_task(&priv->gpio_change_rf_wq);
-             #else
+	     #else
 		queue_work(priv->priv_wq,&priv->gpio_change_rf_wq);	
 		#endif
 	#endif	
@@ -3602,7 +3602,7 @@ extern void dm_fsync_timer_callback(unsigned long data)
 		{
 			rate_bitmap  = 1 << rate_index;
 			if(priv->ieee80211->fsync_rate_bitmap &  rate_bitmap)
-		 		rate_count+= priv->stats.received_rate_histogram[1][rate_index];
+				rate_count+= priv->stats.received_rate_histogram[1][rate_index];
 		}	
 
 		if(rate_count < priv->rate_record)
@@ -4036,7 +4036,7 @@ extern void dm_shadow_init(struct net_device *dev)
  * Function:	DM_DynamicTxPower()
  *
  * Overview:	Detect Signal strength to control TX Registry
- 			Tx Power Control For Near/Far Range
+			Tx Power Control For Near/Far Range
  *
  * Input:		NONE
  *
diff --git a/drivers/staging/rtl8192u/r8192U_dm.h b/drivers/staging/rtl8192u/r8192U_dm.h
index b20102e..d31cdc5 100644
--- a/drivers/staging/rtl8192u/r8192U_dm.h
+++ b/drivers/staging/rtl8192u/r8192U_dm.h
@@ -283,7 +283,7 @@ extern  void    dm_txpower_trackingcallback(struct net_device *dev);
 extern  void    dm_restore_dynamic_mechanism_state(struct net_device *dev);
 extern  void    dm_backup_dynamic_mechanism_state(struct net_device *dev);
 extern  void    dm_change_dynamic_initgain_thresh(struct net_device *dev,
-                                                                u32 dm_type, u32 dm_value);
+								u32 dm_type, u32 dm_value);
 extern  void    dm_force_tx_fw_info(struct net_device *dev,u32 force_type, u32 force_value);
 extern  void    dm_init_edca_turbo(struct net_device *dev);
 extern  void    dm_rf_operation_test_callback(unsigned long data);
diff --git a/drivers/staging/rtl8192u/r8192U_hw.h b/drivers/staging/rtl8192u/r8192U_hw.h
index d93f4af..0f959ed 100644
--- a/drivers/staging/rtl8192u/r8192U_hw.h
+++ b/drivers/staging/rtl8192u/r8192U_hw.h
@@ -1,16 +1,16 @@
-/* 
+/*
 	This is part of rtl8187 OpenSource driver.
-	Copyright (C) Andrea Merello 2004-2005  <andreamrl at tiscali.it> 
+	Copyright (C) Andrea Merello 2004-2005  <andreamrl at tiscali.it>
 	Released under the terms of GPL (General Public Licence)
-	
-	Parts of this driver are based on the GPL part of the 
+
+	Parts of this driver are based on the GPL part of the
 	official Realtek driver.
-	Parts of this driver are based on the rtl8180 driver skeleton 
+	Parts of this driver are based on the rtl8180 driver skeleton
 	from Patric Schenke & Andres Salomon.
-	Parts of this driver are based on the Intel Pro Wireless 
+	Parts of this driver are based on the Intel Pro Wireless
 	2100 GPL driver.
-	
-	We want to tanks the Authors of those projects 
+
+	We want to tanks the Authors of those projects
 	and the Ndiswrapper project Authors.
 */
 
@@ -54,12 +54,12 @@ typedef enum _RT_RF_TYPE_819xU{
 #define	RTL8187_REQ_SET_REGS	0x05
 
 #define MAX_TX_URB 5
-#define MAX_RX_URB 16 
+#define MAX_RX_URB 16
 
 #define R8180_MAX_RETRY 255
-//#define MAX_RX_NORMAL_URB 3 
-//#define MAX_RX_COMMAND_URB 2 
-#define RX_URB_SIZE 9100 
+//#define MAX_RX_NORMAL_URB 3
+//#define MAX_RX_COMMAND_URB 2
+#define RX_URB_SIZE 9100
 
 #define BB_ANTATTEN_CHAN14	0x0c
 #define BB_ANTENNA_B 0x40
@@ -118,9 +118,9 @@ typedef enum _RT_RF_TYPE_819xU{
 
 //#endif
 enum _RTL8192Usb_HW {
-	
+
 	PCIF			= 0x009, // PCI Function Register 0x0009h~0x000bh
-#define	BB_GLOBAL_RESET_BIT	0x1	
+#define	BB_GLOBAL_RESET_BIT	0x1
 	BB_GLOBAL_RESET		= 0x020, // BasebandGlobal Reset Register
 	BSSIDR			= 0x02E, // BSSID Register
 	CMDR			= 0x037, // Command register
@@ -162,11 +162,11 @@ enum _RTL8192Usb_HW {
 #define RCR_ADF			BIT18			// Accept data type frame
 #define RCR_RXFTH		BIT13			// Rx FIFO Threshold
 #define RCR_AICV		BIT12			// Accept ICV error packet
-#define	RCR_ACRC32		BIT5			// Accept CRC32 error packet 
-#define	RCR_AB			BIT3			// Accept broadcast packet 
-#define	RCR_AM			BIT2			// Accept multicast packet 
+#define	RCR_ACRC32		BIT5			// Accept CRC32 error packet
+#define	RCR_AB			BIT3			// Accept broadcast packet
+#define	RCR_AM			BIT2			// Accept multicast packet
 #define	RCR_APM			BIT1			// Accept physical match packet
-#define	RCR_AAP			BIT0			// Accept all unicast packet 
+#define	RCR_AAP			BIT0			// Accept all unicast packet
 	SLOT_TIME		= 0x049, // Slot Time Register
 	ACK_TIMEOUT		= 0x04c, // Ack Timeout Register
 	PIFS_TIME		= 0x04d, // PIFS time
@@ -226,8 +226,8 @@ enum _RTL8192Usb_HW {
 #define CPU_GEN_NO_LOOPBACK_SET	0x00080000 // Set BIT19 to 1
 	CPU_GEN			= 0x100, // CPU Reset Register
 	LED1Cfg			=		0x154,// LED1 Configuration Register
- 	LED0Cfg			=		0x155,// LED0 Configuration Register
-	
+	LED0Cfg			=		0x155,// LED0 Configuration Register
+
 	AcmAvg			= 0x170, // ACM Average Period Register
 	AcmHwCtrl		= 0x171, // ACM Hardware Control Register
 //----------------------------------------------------------------------------
@@ -250,7 +250,7 @@ enum _RTL8192Usb_HW {
 	BEAdmTime		= 0x17C, // BE Queue Admitted Time Register
 	RQPN1			= 0x180, // Reserved Queue Page Number , Vo Vi, Be, Bk
 	RQPN2			= 0x184, // Reserved Queue Page Number, HCCA, Cmd, Mgnt, High
-	RQPN3			= 0x188, // Reserved Queue Page Number, Bcn, Public, 
+	RQPN3			= 0x188, // Reserved Queue Page Number, Bcn, Public,
 //	QPRR			= 0x1E0, // Queue Page Report per TID
 	QPNR			= 0x1D0, //0x1F0, // Queue Packet Number report per TID
 	BQDA			= 0x200, // Beacon Queue Descriptor Address
@@ -263,12 +263,12 @@ enum _RTL8192Usb_HW {
 	BEQDA			= 0x21C, // BE Queue Descriptor Address
 	BKQDA			= 0x220, // BK Queue Descriptor Address
 	RCQDA			= 0x224, // Receive command Queue Descriptor Address
-	RDQDA			= 0x228, // Receive Queue Descriptor Start Address 
+	RDQDA			= 0x228, // Receive Queue Descriptor Start Address
 
-	MAR0			= 0x240, // Multicast filter. 
+	MAR0			= 0x240, // Multicast filter.
 	MAR4			= 0x244,
 
-	CCX_PERIOD		= 0x250, // CCX Measurement Period Register, in unit of TU. 
+	CCX_PERIOD		= 0x250, // CCX Measurement Period Register, in unit of TU.
 	CLM_RESULT		= 0x251, // CCA Busy fraction register.
 	NHM_PERIOD		= 0x252, // NHM Measurement Period register, in unit of TU.
 
@@ -282,13 +282,13 @@ enum _RTL8192Usb_HW {
 
 	MCTRL			= 0x25A, // Measurement Control
 
-	NHM_RPI_COUNTER0	= 0x264, // Noise Histogram RPI counter0, the fraction of signal strength < NHM_THRESHOLD0. 
-	NHM_RPI_COUNTER1	= 0x265, // Noise Histogram RPI counter1, the fraction of signal strength in (NHM_THRESHOLD0, NHM_THRESHOLD1]. 
+	NHM_RPI_COUNTER0	= 0x264, // Noise Histogram RPI counter0, the fraction of signal strength < NHM_THRESHOLD0.
+	NHM_RPI_COUNTER1	= 0x265, // Noise Histogram RPI counter1, the fraction of signal strength in (NHM_THRESHOLD0, NHM_THRESHOLD1].
 	NHM_RPI_COUNTER2	= 0x266, // Noise Histogram RPI counter2, the fraction of signal strength in (NHM_THRESHOLD1, NHM_THRESHOLD2].
 	NHM_RPI_COUNTER3	= 0x267, // Noise Histogram RPI counter3, the fraction of signal strength in (NHM_THRESHOLD2, NHM_THRESHOLD3].
 	NHM_RPI_COUNTER4	= 0x268, // Noise Histogram RPI counter4, the fraction of signal strength in (NHM_THRESHOLD3, NHM_THRESHOLD4].
 	NHM_RPI_COUNTER5	= 0x269, // Noise Histogram RPI counter5, the fraction of signal strength in (NHM_THRESHOLD4, NHM_THRESHOLD5].
-	NHM_RPI_COUNTER6	= 0x26A, // Noise Histogram RPI counter6, the fraction of signal strength in (NHM_THRESHOLD5, NHM_THRESHOLD6]. 
+	NHM_RPI_COUNTER6	= 0x26A, // Noise Histogram RPI counter6, the fraction of signal strength in (NHM_THRESHOLD5, NHM_THRESHOLD6].
 	NHM_RPI_COUNTER7	= 0x26B, // Noise Histogram RPI counter7, the fraction of signal strength in (NHM_THRESHOLD6, NHM_THRESHOLD7].
 #define	BW_OPMODE_11J			BIT0
 #define	BW_OPMODE_5G			BIT1
@@ -301,11 +301,11 @@ enum _RTL8192Usb_HW {
 #define MSR_LINK_SHIFT     0
 #define MSR_LINK_ADHOC     1
 #define MSR_LINK_MASTER    3
-#define MSR_LINK_ENEDCA	   (1<<4)	
+#define MSR_LINK_ENEDCA	   (1<<4)
 	RETRY_LIMIT		= 0x304, // Retry Limit [15:8]-short, [7:0]-long
 #define RETRY_LIMIT_SHORT_SHIFT 8
 #define RETRY_LIMIT_LONG_SHIFT 0
-	TSFR			= 0x308,	
+	TSFR			= 0x308,
 	RRSR			= 0x310, // Response Rate Set
 #define RRSR_RSC_OFFSET			21
 #define RRSR_SHORT_OFFSET			23
@@ -314,16 +314,16 @@ enum _RTL8192Usb_HW {
 #define RRSR_RSC_UPSUBCHANL		0x200000
 #define RRSR_SHORT					0x800000
 #define RRSR_1M						BIT0
-#define RRSR_2M						BIT1 
-#define RRSR_5_5M					BIT2 
-#define RRSR_11M					BIT3 
-#define RRSR_6M						BIT4 
-#define RRSR_9M						BIT5 
-#define RRSR_12M					BIT6 
-#define RRSR_18M					BIT7 
-#define RRSR_24M					BIT8 
-#define RRSR_36M					BIT9 
-#define RRSR_48M					BIT10 
+#define RRSR_2M						BIT1
+#define RRSR_5_5M					BIT2
+#define RRSR_11M					BIT3
+#define RRSR_6M						BIT4
+#define RRSR_9M						BIT5
+#define RRSR_12M					BIT6
+#define RRSR_18M					BIT7
+#define RRSR_24M					BIT8
+#define RRSR_36M					BIT9
+#define RRSR_48M					BIT10
 #define RRSR_54M					BIT11
 #define RRSR_MCS0					BIT12
 #define RRSR_MCS1					BIT13
@@ -354,7 +354,7 @@ enum _RTL8192Usb_HW {
 #define	RATR_36M		0x00000200
 #define	RATR_48M		0x00000400
 #define	RATR_54M		0x00000800
-//MCS 1 Spatial Stream	
+//MCS 1 Spatial Stream
 #define	RATR_MCS0		0x00001000
 #define	RATR_MCS1		0x00002000
 #define	RATR_MCS2		0x00004000
@@ -373,11 +373,11 @@ enum _RTL8192Usb_HW {
 #define	RATR_MCS14		0x04000000
 #define	RATR_MCS15		0x08000000
 // ALL CCK Rate
-#define RATE_ALL_CCK		RATR_1M|RATR_2M|RATR_55M|RATR_11M 
+#define RATE_ALL_CCK		RATR_1M|RATR_2M|RATR_55M|RATR_11M
 #define RATE_ALL_OFDM_AG	RATR_6M|RATR_9M|RATR_12M|RATR_18M|RATR_24M\
-							|RATR_36M|RATR_48M|RATR_54M	
+							|RATR_36M|RATR_48M|RATR_54M
 #define RATE_ALL_OFDM_1SS	RATR_MCS0|RATR_MCS1|RATR_MCS2|RATR_MCS3 | \
-							RATR_MCS4|RATR_MCS5|RATR_MCS6|RATR_MCS7	
+							RATR_MCS4|RATR_MCS5|RATR_MCS6|RATR_MCS7
 #define RATE_ALL_OFDM_2SS	RATR_MCS8|RATR_MCS9	|RATR_MCS10|RATR_MCS11| \
 							RATR_MCS12|RATR_MCS13|RATR_MCS14|RATR_MCS15
 
@@ -387,14 +387,14 @@ enum _RTL8192Usb_HW {
 //	IMR			= 0x354, // Interrupt Mask Register
 //	IMR_POLL		= 0x360,
 	MacBlkCtrl		= 0x403, // Mac block on/off control register
-	
-	EPROM_CMD 		= 0xfe58, 
+
+	EPROM_CMD 		= 0xfe58,
 #define Cmd9346CR_9356SEL	(1<<4)
 #define EPROM_CMD_RESERVED_MASK (1<<5)
 #define EPROM_CMD_OPERATING_MODE_SHIFT 6
 #define EPROM_CMD_OPERATING_MODE_MASK ((1<<7)|(1<<6))
 #define EPROM_CMD_CONFIG 0x3
-#define EPROM_CMD_NORMAL 0 
+#define EPROM_CMD_NORMAL 0
 #define EPROM_CMD_LOAD 1
 #define EPROM_CMD_PROGRAM 2
 #define EPROM_CS_SHIFT 3
@@ -466,7 +466,7 @@ enum _RTL8192Usb_HW {
 #define TCR_HWVERID_SHIFT 25
 #define TCR_SWPLCPLEN     ((1<<24))
 #define TCR_PLCP_LEN TCR_SAT // rtl8180
-#define TCR_MXDMA_MASK   ((1<<23)|(1<<22)|(1<<21)) 
+#define TCR_MXDMA_MASK   ((1<<23)|(1<<22)|(1<<21))
 #define TCR_MXDMA_1024 6
 #define TCR_MXDMA_2048 7
 #define TCR_MXDMA_SHIFT  21
@@ -537,7 +537,7 @@ enum _RTL8192Usb_HW {
 #define EPROM_CMD_OPERATING_MODE_SHIFT 6
 #define EPROM_CMD_OPERATING_MODE_MASK ((1<<7)|(1<<6))
 #define EPROM_CMD_CONFIG 0x3
-#define EPROM_CMD_NORMAL 0 
+#define EPROM_CMD_NORMAL 0
 #define EPROM_CMD_LOAD 1
 #define EPROM_CMD_PROGRAM 2
 #define EPROM_CS_SHIFT 3
@@ -723,10 +723,10 @@ enum _RTL8192Usb_HW {
 	AC_VO_PARAM             = 0x0F0,      // AC_VO Parameters Record
 	AC_VI_PARAM             = 0x0F4,      // AC_VI Parameters Record
 	AC_BE_PARAM             = 0x0F8,      // AC_BE Parameters Record
-	AC_BK_PARAM             = 0x0FC,      // AC_BK Parameters Record  
+	AC_BK_PARAM             = 0x0FC,      // AC_BK Parameters Record
 	TALLY_SEL 		= 0x0fc,
 //----------------------------------------------------------------------------
-//       8187B AC_XX_PARAM bits 
+//       8187B AC_XX_PARAM bits
 //----------------------------------------------------------------------------
 #define AC_PARAM_TXOP_LIMIT_OFFSET		16
 #define AC_PARAM_ECW_MAX_OFFSET			12
diff --git a/drivers/staging/rtl8192u/r8192U_wx.c b/drivers/staging/rtl8192u/r8192U_wx.c
index 8de02d4..1c953c7 100644
--- a/drivers/staging/rtl8192u/r8192U_wx.c
+++ b/drivers/staging/rtl8192u/r8192U_wx.c
@@ -1,19 +1,19 @@
-/* 
+/*
    This file contains wireless extension handlers.
 
    This is part of rtl8180 OpenSource driver.
-   Copyright (C) Andrea Merello 2004-2005  <andreamrl at tiscali.it> 
+   Copyright (C) Andrea Merello 2004-2005  <andreamrl at tiscali.it>
    Released under the terms of GPL (General Public Licence)
-   
-   Parts of this driver are based on the GPL part 
+
+   Parts of this driver are based on the GPL part
    of the official realtek driver.
-   
-   Parts of this driver are based on the rtl8180 driver skeleton 
+
+   Parts of this driver are based on the rtl8180 driver skeleton
    from Patric Schenke & Andres Salomon.
 
    Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver.
-   
-   We want to tanks the Authors of those projects and the Ndiswrapper 
+
+   We want to tanks the Authors of those projects and the Ndiswrapper
    project Authors.
 */
 
@@ -28,7 +28,7 @@
 #define RATE_COUNT 12
 u32 rtl8180_rates[] = {1000000,2000000,5500000,11000000,
 	6000000,9000000,12000000,18000000,24000000,36000000,48000000,54000000};
-	
+
 
 #ifndef ENETDOWN
 #define ENETDOWN 1
@@ -39,7 +39,7 @@ static int r8192_wx_get_freq(struct net_device *dev,
 			     union iwreq_data *wrqu, char *b)
 {
 	struct r8192_priv *priv = ieee80211_priv(dev);
-	
+
 	return ieee80211_wx_get_freq(priv->ieee80211,a,wrqu,b);
 }
 
@@ -51,28 +51,28 @@ static int r8192_wx_set_beaconinterval(struct net_device *dev, struct iw_request
 {
 	int *parms = (int *)b;
 	int bi = parms[0];
-	
+
 	struct r8192_priv *priv = ieee80211_priv(dev);
-	
+
 	down(&priv->wx_sem);
 	DMESG("setting beacon interval to %x",bi);
-	
+
 	priv->ieee80211->beacon_interval=bi;
 	rtl8180_commit(dev);
 	up(&priv->wx_sem);
-		
-	return 0;	
+
+	return 0;
 }
 
 
 static int r8192_wx_set_forceassociate(struct net_device *dev, struct iw_request_info *aa,
 			  union iwreq_data *wrqu, char *extra)
 {
-	struct r8192_priv *priv=ieee80211_priv(dev);	
+	struct r8192_priv *priv=ieee80211_priv(dev);
 	int *parms = (int *)extra;
-	
+
 	priv->ieee80211->force_associate = (parms[0] > 0);
-	
+
 
 	return 0;
 }
@@ -81,15 +81,15 @@ static int r8192_wx_set_forceassociate(struct net_device *dev, struct iw_request
 static int r8192_wx_get_mode(struct net_device *dev, struct iw_request_info *a,
 			     union iwreq_data *wrqu, char *b)
 {
-	struct r8192_priv *priv=ieee80211_priv(dev);	
+	struct r8192_priv *priv=ieee80211_priv(dev);
 
 	return ieee80211_wx_get_mode(priv->ieee80211,a,wrqu,b);
 }
 
 
 
-static int r8192_wx_get_rate(struct net_device *dev, 
-			     struct iw_request_info *info, 
+static int r8192_wx_get_rate(struct net_device *dev,
+			     struct iw_request_info *info,
 			     union iwreq_data *wrqu, char *extra)
 {
 	struct r8192_priv *priv = ieee80211_priv(dev);
@@ -98,65 +98,65 @@ static int r8192_wx_get_rate(struct net_device *dev,
 
 
 
-static int r8192_wx_set_rate(struct net_device *dev, 
-			     struct iw_request_info *info, 
+static int r8192_wx_set_rate(struct net_device *dev,
+			     struct iw_request_info *info,
 			     union iwreq_data *wrqu, char *extra)
 {
 	int ret;
-	struct r8192_priv *priv = ieee80211_priv(dev);	
-	
+	struct r8192_priv *priv = ieee80211_priv(dev);
+
 	down(&priv->wx_sem);
 
 	ret = ieee80211_wx_set_rate(priv->ieee80211,info,wrqu,extra);
-	
+
 	up(&priv->wx_sem);
-	
+
 	return ret;
 }
 
 
-static int r8192_wx_set_rts(struct net_device *dev, 
-			     struct iw_request_info *info, 
+static int r8192_wx_set_rts(struct net_device *dev,
+			     struct iw_request_info *info,
 			     union iwreq_data *wrqu, char *extra)
 {
 	int ret;
-	struct r8192_priv *priv = ieee80211_priv(dev);	
-	
+	struct r8192_priv *priv = ieee80211_priv(dev);
+
 	down(&priv->wx_sem);
 
 	ret = ieee80211_wx_set_rts(priv->ieee80211,info,wrqu,extra);
-	
+
 	up(&priv->wx_sem);
-	
+
 	return ret;
 }
 
-static int r8192_wx_get_rts(struct net_device *dev, 
-			     struct iw_request_info *info, 
+static int r8192_wx_get_rts(struct net_device *dev,
+			     struct iw_request_info *info,
 			     union iwreq_data *wrqu, char *extra)
 {
 	struct r8192_priv *priv = ieee80211_priv(dev);
 	return ieee80211_wx_get_rts(priv->ieee80211,info,wrqu,extra);
 }
 
-static int r8192_wx_set_power(struct net_device *dev, 
-			     struct iw_request_info *info, 
+static int r8192_wx_set_power(struct net_device *dev,
+			     struct iw_request_info *info,
 			     union iwreq_data *wrqu, char *extra)
 {
 	int ret;
-	struct r8192_priv *priv = ieee80211_priv(dev);	
-	
+	struct r8192_priv *priv = ieee80211_priv(dev);
+
 	down(&priv->wx_sem);
 
 	ret = ieee80211_wx_set_power(priv->ieee80211,info,wrqu,extra);
-	
+
 	up(&priv->wx_sem);
-	
+
 	return ret;
 }
 
-static int r8192_wx_get_power(struct net_device *dev, 
-			     struct iw_request_info *info, 
+static int r8192_wx_get_power(struct net_device *dev,
+			     struct iw_request_info *info,
 			     union iwreq_data *wrqu, char *extra)
 {
 	struct r8192_priv *priv = ieee80211_priv(dev);
@@ -169,8 +169,8 @@ void write_rtl8225(struct net_device *dev, u8 adr, u16 data);
 u32 john_read_rtl8225(struct net_device *dev, u8 adr);
 void _write_rtl8225(struct net_device *dev, u8 adr, u16 data);
 
-static int r8192_wx_read_regs(struct net_device *dev, 
-			       struct iw_request_info *info, 
+static int r8192_wx_read_regs(struct net_device *dev,
+			       struct iw_request_info *info,
 			       union iwreq_data *wrqu, char *extra)
 {
 	struct r8192_priv *priv = ieee80211_priv(dev);
@@ -179,29 +179,29 @@ static int r8192_wx_read_regs(struct net_device *dev,
 
 	down(&priv->wx_sem);
 
-	
+
 	get_user(addr,(u8*)wrqu->data.pointer);
 	data1 = read_rtl8225(dev, addr);
-	wrqu->data.length = data1;	
+	wrqu->data.length = data1;
 
 	up(&priv->wx_sem);
 	return 0;
-	 
+
 }
 
-static int r8192_wx_write_regs(struct net_device *dev, 
-			       struct iw_request_info *info, 
+static int r8192_wx_write_regs(struct net_device *dev,
+			       struct iw_request_info *info,
 			       union iwreq_data *wrqu, char *extra)
 {
-        struct r8192_priv *priv = ieee80211_priv(dev);
-        u8 addr;
+	struct r8192_priv *priv = ieee80211_priv(dev);
+	u8 addr;
+
+	down(&priv->wx_sem);
 
-        down(&priv->wx_sem);
-             
-        get_user(addr, (u8*)wrqu->data.pointer);
+	get_user(addr, (u8*)wrqu->data.pointer);
 	write_rtl8225(dev, addr, wrqu->data.length);
 
-        up(&priv->wx_sem);
+	up(&priv->wx_sem);
 	return 0;
 
 }
@@ -209,18 +209,18 @@ static int r8192_wx_write_regs(struct net_device *dev,
 void rtl8187_write_phy(struct net_device *dev, u8 adr, u32 data);
 u8 rtl8187_read_phy(struct net_device *dev,u8 adr, u32 data);
 
-static int r8192_wx_read_bb(struct net_device *dev, 
-			       struct iw_request_info *info, 
+static int r8192_wx_read_bb(struct net_device *dev,
+			       struct iw_request_info *info,
 			       union iwreq_data *wrqu, char *extra)
 {
-        struct r8192_priv *priv = ieee80211_priv(dev);
+	struct r8192_priv *priv = ieee80211_priv(dev);
 	u8 databb;
-#if 0 
+#if 0
 	int i;
 	for(i=0;i<12;i++) printk("%8x\n", read_cam(dev, i) );
 #endif
 
-        down(&priv->wx_sem);
+	down(&priv->wx_sem);
 
 	databb = rtl8187_read_phy(dev, (u8)wrqu->data.length, 0x00000000);
 	wrqu->data.length = databb;
@@ -231,87 +231,87 @@ static int r8192_wx_read_bb(struct net_device *dev,
 
 void rtl8187_write_phy(struct net_device *dev, u8 adr, u32 data);
 static int r8192_wx_write_bb(struct net_device *dev,
-                               struct iw_request_info *info,
-                               union iwreq_data *wrqu, char *extra)
+			       struct iw_request_info *info,
+			       union iwreq_data *wrqu, char *extra)
 {
-        struct r8192_priv *priv = ieee80211_priv(dev);
-        u8 databb;
+	struct r8192_priv *priv = ieee80211_priv(dev);
+	u8 databb;
 
-        down(&priv->wx_sem);
+	down(&priv->wx_sem);
 
-        get_user(databb, (u8*)wrqu->data.pointer);
-        rtl8187_write_phy(dev, wrqu->data.length, databb);
+	get_user(databb, (u8*)wrqu->data.pointer);
+	rtl8187_write_phy(dev, wrqu->data.length, databb);
 
-        up(&priv->wx_sem);
-        return 0;
+	up(&priv->wx_sem);
+	return 0;
 
 }
 
 
 static int r8192_wx_write_nicb(struct net_device *dev,
-                               struct iw_request_info *info,
-                               union iwreq_data *wrqu, char *extra)
+			       struct iw_request_info *info,
+			       union iwreq_data *wrqu, char *extra)
 {
-        struct r8192_priv *priv = ieee80211_priv(dev);
-        u32 addr;
+	struct r8192_priv *priv = ieee80211_priv(dev);
+	u32 addr;
+
+	down(&priv->wx_sem);
 
-        down(&priv->wx_sem);
-	
-        get_user(addr, (u32*)wrqu->data.pointer);
-        write_nic_byte(dev, addr, wrqu->data.length);
+	get_user(addr, (u32*)wrqu->data.pointer);
+	write_nic_byte(dev, addr, wrqu->data.length);
 
-        up(&priv->wx_sem);
-        return 0;
+	up(&priv->wx_sem);
+	return 0;
 
 }
 static int r8192_wx_read_nicb(struct net_device *dev,
-                               struct iw_request_info *info,
-                               union iwreq_data *wrqu, char *extra)
+			       struct iw_request_info *info,
+			       union iwreq_data *wrqu, char *extra)
 {
-        struct r8192_priv *priv = ieee80211_priv(dev);
-        u32 addr;
-        u16 data1;
+	struct r8192_priv *priv = ieee80211_priv(dev);
+	u32 addr;
+	u16 data1;
 
-        down(&priv->wx_sem);
+	down(&priv->wx_sem);
 
-        get_user(addr,(u32*)wrqu->data.pointer);
-        data1 = read_nic_byte(dev, addr);
-        wrqu->data.length = data1;
+	get_user(addr,(u32*)wrqu->data.pointer);
+	data1 = read_nic_byte(dev, addr);
+	wrqu->data.length = data1;
 
-        up(&priv->wx_sem);
-        return 0;
+	up(&priv->wx_sem);
+	return 0;
 }
 
 static int r8192_wx_get_ap_status(struct net_device *dev,
-                               struct iw_request_info *info,
-                               union iwreq_data *wrqu, char *extra)
+			       struct iw_request_info *info,
+			       union iwreq_data *wrqu, char *extra)
 {
-        struct r8192_priv *priv = ieee80211_priv(dev);
-        struct ieee80211_device *ieee = priv->ieee80211;
-        struct ieee80211_network *target;
+	struct r8192_priv *priv = ieee80211_priv(dev);
+	struct ieee80211_device *ieee = priv->ieee80211;
+	struct ieee80211_network *target;
 	int name_len;
 
-        down(&priv->wx_sem);
+	down(&priv->wx_sem);
 
 	//count the length of input ssid
 	for(name_len=0 ; ((char*)wrqu->data.pointer)[name_len]!='\0' ; name_len++);
 
 	//search for the correspoding info which is received
-        list_for_each_entry(target, &ieee->network_list, list) {
-                if ( (target->ssid_len == name_len) &&
+	list_for_each_entry(target, &ieee->network_list, list) {
+		if ( (target->ssid_len == name_len) &&
 		     (strncmp(target->ssid, (char*)wrqu->data.pointer, name_len)==0)){
 			if(target->wpa_ie_len>0 || target->rsn_ie_len>0 )
 				//set flags=1 to indicate this ap is WPA
 				wrqu->data.flags = 1;
 			else wrqu->data.flags = 0;
-		
+
 
 		break;
-                }
-        }
+		}
+	}
 
-        up(&priv->wx_sem);
-        return 0;
+	up(&priv->wx_sem);
+	return 0;
 }
 
 
@@ -330,7 +330,7 @@ static int r8192_wx_force_reset(struct net_device *dev,
 		union iwreq_data *wrqu, char *extra)
 {
 	struct r8192_priv *priv = ieee80211_priv(dev);
-	
+
 	down(&priv->wx_sem);
 
 	printk("%s(): force reset ! extra is %d\n",__FUNCTION__, *extra);
@@ -341,25 +341,25 @@ static int r8192_wx_force_reset(struct net_device *dev,
 }
 
 
-static int r8192_wx_set_rawtx(struct net_device *dev, 
-			       struct iw_request_info *info, 
+static int r8192_wx_set_rawtx(struct net_device *dev,
+			       struct iw_request_info *info,
 			       union iwreq_data *wrqu, char *extra)
 {
 	struct r8192_priv *priv = ieee80211_priv(dev);
 	int ret;
-	
+
 	down(&priv->wx_sem);
-	
+
 	ret = ieee80211_wx_set_rawtx(priv->ieee80211, info, wrqu, extra);
-	
+
 	up(&priv->wx_sem);
-	
+
 	return ret;
-	 
+
 }
 
-static int r8192_wx_set_crcmon(struct net_device *dev, 
-			       struct iw_request_info *info, 
+static int r8192_wx_set_crcmon(struct net_device *dev,
+			       struct iw_request_info *info,
 			       union iwreq_data *wrqu, char *extra)
 {
 	struct r8192_priv *priv = ieee80211_priv(dev);
@@ -368,22 +368,22 @@ static int r8192_wx_set_crcmon(struct net_device *dev,
 	short prev = priv->crcmon;
 
 	down(&priv->wx_sem);
-	
-	if(enable) 
+
+	if(enable)
 		priv->crcmon=1;
-	else 
+	else
 		priv->crcmon=0;
 
-	DMESG("bad CRC in monitor mode are %s", 
+	DMESG("bad CRC in monitor mode are %s",
 	      priv->crcmon ? "accepted" : "rejected");
 
 	if(prev != priv->crcmon && priv->up){
 		//rtl8180_down(dev);
 		//rtl8180_up(dev);
 	}
-	
+
 	up(&priv->wx_sem);
-	
+
 	return 0;
 }
 
@@ -393,39 +393,39 @@ static int r8192_wx_set_mode(struct net_device *dev, struct iw_request_info *a,
 	struct r8192_priv *priv = ieee80211_priv(dev);
 	int ret;
 	down(&priv->wx_sem);
-	
+
 	ret = ieee80211_wx_set_mode(priv->ieee80211,a,wrqu,b);
-	
+
 	rtl8192_set_rxconf(dev);
-	
+
 	up(&priv->wx_sem);
 	return ret;
 }
 
 struct  iw_range_with_scan_capa
 {
-        /* Informative stuff (to choose between different interface) */
-        __u32           throughput;     /* To give an idea... */
-        /* In theory this value should be the maximum benchmarked
-         * TCP/IP throughput, because with most of these devices the
-         * bit rate is meaningless (overhead an co) to estimate how
-         * fast the connection will go and pick the fastest one.
-         * I suggest people to play with Netperf or any benchmark...
-         */
-
-        /* NWID (or domain id) */
-        __u32           min_nwid;       /* Minimal NWID we are able to set */
-        __u32           max_nwid;       /* Maximal NWID we are able to set */
-
-        /* Old Frequency (backward compat - moved lower ) */
-        __u16           old_num_channels;
-        __u8            old_num_frequency;
-
-        /* Scan capabilities */
-        __u8            scan_capa;       
+	/* Informative stuff (to choose between different interface) */
+	__u32           throughput;     /* To give an idea... */
+	/* In theory this value should be the maximum benchmarked
+	 * TCP/IP throughput, because with most of these devices the
+	 * bit rate is meaningless (overhead an co) to estimate how
+	 * fast the connection will go and pick the fastest one.
+	 * I suggest people to play with Netperf or any benchmark...
+	 */
+
+	/* NWID (or domain id) */
+	__u32           min_nwid;       /* Minimal NWID we are able to set */
+	__u32           max_nwid;       /* Maximal NWID we are able to set */
+
+	/* Old Frequency (backward compat - moved lower ) */
+	__u16           old_num_channels;
+	__u8            old_num_frequency;
+
+	/* Scan capabilities */
+	__u8            scan_capa;
 };
-static int rtl8180_wx_get_range(struct net_device *dev, 
-				struct iw_request_info *info, 
+static int rtl8180_wx_get_range(struct net_device *dev,
+				struct iw_request_info *info,
 				union iwreq_data *wrqu, char *extra)
 {
 	struct iw_range *range = (struct iw_range *)extra;
@@ -440,26 +440,26 @@ static int rtl8180_wx_get_range(struct net_device *dev,
 	/* Let's try to keep this struct in the same order as in
 	 * linux/include/wireless.h
 	 */
-	
+
 	/* TODO: See what values we can set, and remove the ones we can't
 	 * set, or fill them with some default data.
 	 */
 
 	/* ~5 Mb/s real (802.11b) */
-	range->throughput = 5 * 1000 * 1000;     
+	range->throughput = 5 * 1000 * 1000;
 
 	// TODO: Not used in 802.11b?
 //	range->min_nwid;	/* Minimal NWID we are able to set */
 	// TODO: Not used in 802.11b?
 //	range->max_nwid;	/* Maximal NWID we are able to set */
-	
-        /* Old Frequency (backward compat - moved lower ) */
-//	range->old_num_channels; 
+
+	/* Old Frequency (backward compat - moved lower ) */
+//	range->old_num_channels;
 //	range->old_num_frequency;
 //	range->old_freq[6]; /* Filler to keep "version" at the same offset */
 	if(priv->rf_set_sens != NULL)
 		range->sensitivity = priv->max_sens;	/* signal level threshold range */
-	
+
 	range->max_qual.qual = 100;
 	/* TODO: Find real max RSSI and stick here */
 	range->max_qual.level = 0;
@@ -473,18 +473,18 @@ static int rtl8180_wx_get_range(struct net_device *dev,
 	range->avg_qual.updated = 7; /* Updated all three */
 
 	range->num_bitrates = RATE_COUNT;
-	
+
 	for (i = 0; i < RATE_COUNT && i < IW_MAX_BITRATES; i++) {
 		range->bitrate[i] = rtl8180_rates[i];
 	}
-	
+
 	range->min_frag = MIN_FRAG_THRESHOLD;
 	range->max_frag = MAX_FRAG_THRESHOLD;
-	
+
 	range->min_pmp=0;
 	range->max_pmp = 5000000;
 	range->min_pmt = 0;
-	range->max_pmt = 65535*1000;	
+	range->max_pmt = 65535*1000;
 	range->pmp_flags = IW_POWER_PERIOD;
 	range->pmt_flags = IW_POWER_TIMEOUT;
 	range->pm_capa = IW_POWER_PERIOD | IW_POWER_TIMEOUT | IW_POWER_ALL_R;
@@ -502,14 +502,14 @@ static int rtl8180_wx_get_range(struct net_device *dev,
 
 
 	for (i = 0, val = 0; i < 14; i++) {
-		
+
 		// Include only legal frequencies for some countries
 #ifdef ENABLE_DOT11D
 		if ((GET_DOT11D_INFO(priv->ieee80211)->channel_map)[i+1]) {
 #else
 		if ((priv->ieee80211->channel_map)[i+1]) {
 #endif
-		        range->freq[val].i = i + 1;
+			range->freq[val].i = i + 1;
 			range->freq[val].m = ieee80211_wlan_frequencies[i] * 100000;
 			range->freq[val].e = 1;
 			val++;
@@ -517,12 +517,12 @@ static int rtl8180_wx_get_range(struct net_device *dev,
 			// FIXME: do we need to set anything for channels
 			// we don't use ?
 		}
-		
+
 		if (val == IW_MAX_FREQUENCIES)
 		break;
 	}
 	range->num_frequency = val;
-        range->num_channels = val;
+	range->num_channels = val;
 #if WIRELESS_EXT > 17
 	range->enc_capa = IW_ENC_CAPA_WPA|IW_ENC_CAPA_WPA2|
 			  IW_ENC_CAPA_CIPHER_TKIP|IW_ENC_CAPA_CIPHER_CCMP;
@@ -538,9 +538,9 @@ static int r8192_wx_set_scan(struct net_device *dev, struct iw_request_info *a,
 	struct r8192_priv *priv = ieee80211_priv(dev);
 	struct ieee80211_device* ieee = priv->ieee80211;
 	int ret = 0;
-	
+
 	if(!priv->up) return -ENETDOWN;
-	
+
 	if (priv->ieee80211->LinkDetectInfo.bBusyTraffic == true)
 		return -EAGAIN;
 	if (wrqu->data.flags & IW_SCAN_THIS_ESSID)
@@ -550,17 +550,17 @@ static int r8192_wx_set_scan(struct net_device *dev, struct iw_request_info *a,
 		{
 			//printk("==**&*&*&**===>scan set ssid:%s\n", req->essid);
 			ieee->current_network.ssid_len = req->essid_len;
-			memcpy(ieee->current_network.ssid, req->essid, req->essid_len); 
+			memcpy(ieee->current_network.ssid, req->essid, req->essid_len);
 			//printk("=====>network ssid:%s\n", ieee->current_network.ssid);
 		}
 	}
-	
+
 	down(&priv->wx_sem);
 	if(priv->ieee80211->state != IEEE80211_LINKED){
-                priv->ieee80211->scanning = 0;
-                ieee80211_softmac_scan_syncro(priv->ieee80211);
-                ret = 0;
-        }
+		priv->ieee80211->scanning = 0;
+		ieee80211_softmac_scan_syncro(priv->ieee80211);
+		ret = 0;
+	}
 	else
 	ret = ieee80211_wx_set_scan(priv->ieee80211,a,wrqu,b);
 	up(&priv->wx_sem);
@@ -574,26 +574,26 @@ static int r8192_wx_get_scan(struct net_device *dev, struct iw_request_info *a,
 
 	int ret;
 	struct r8192_priv *priv = ieee80211_priv(dev);
-	
+
 	if(!priv->up) return -ENETDOWN;
-			
+
 	down(&priv->wx_sem);
 
 	ret = ieee80211_wx_get_scan(priv->ieee80211,a,wrqu,b);
-		
+
 	up(&priv->wx_sem);
-	
+
 	return ret;
 }
 
-static int r8192_wx_set_essid(struct net_device *dev, 
+static int r8192_wx_set_essid(struct net_device *dev,
 			      struct iw_request_info *a,
 			      union iwreq_data *wrqu, char *b)
 {
 	struct r8192_priv *priv = ieee80211_priv(dev);
 	int ret;
 	down(&priv->wx_sem);
-	
+
 	ret = ieee80211_wx_set_essid(priv->ieee80211,a,wrqu,b);
 
 	up(&priv->wx_sem);
@@ -604,19 +604,19 @@ static int r8192_wx_set_essid(struct net_device *dev,
 
 
 
-static int r8192_wx_get_essid(struct net_device *dev, 
+static int r8192_wx_get_essid(struct net_device *dev,
 			      struct iw_request_info *a,
 			      union iwreq_data *wrqu, char *b)
 {
 	int ret;
 	struct r8192_priv *priv = ieee80211_priv(dev);
-	
+
 	down(&priv->wx_sem);
-	
+
 	ret = ieee80211_wx_get_essid(priv->ieee80211, a, wrqu, b);
 
 	up(&priv->wx_sem);
-	
+
 	return ret;
 }
 
@@ -626,17 +626,17 @@ static int r8192_wx_set_freq(struct net_device *dev, struct iw_request_info *a,
 {
 	int ret;
 	struct r8192_priv *priv = ieee80211_priv(dev);
-	
+
 	down(&priv->wx_sem);
-	
+
 	ret = ieee80211_wx_set_freq(priv->ieee80211, a, wrqu, b);
-	
+
 	up(&priv->wx_sem);
 	return ret;
 }
 
-static int r8192_wx_get_name(struct net_device *dev, 
-			     struct iw_request_info *info, 
+static int r8192_wx_get_name(struct net_device *dev,
+			     struct iw_request_info *info,
 			     union iwreq_data *wrqu, char *extra)
 {
 	struct r8192_priv *priv = ieee80211_priv(dev);
@@ -644,8 +644,8 @@ static int r8192_wx_get_name(struct net_device *dev,
 }
 
 
-static int r8192_wx_set_frag(struct net_device *dev, 
-			     struct iw_request_info *info, 
+static int r8192_wx_set_frag(struct net_device *dev,
+			     struct iw_request_info *info,
 			     union iwreq_data *wrqu, char *extra)
 {
 	struct r8192_priv *priv = ieee80211_priv(dev);
@@ -656,7 +656,7 @@ static int r8192_wx_set_frag(struct net_device *dev,
 		if (wrqu->frag.value < MIN_FRAG_THRESHOLD ||
 		    wrqu->frag.value > MAX_FRAG_THRESHOLD)
 			return -EINVAL;
-		
+
 		priv->ieee80211->fts = wrqu->frag.value & ~0x1;
 	}
 
@@ -664,8 +664,8 @@ static int r8192_wx_set_frag(struct net_device *dev,
 }
 
 
-static int r8192_wx_get_frag(struct net_device *dev, 
-			     struct iw_request_info *info, 
+static int r8192_wx_get_frag(struct net_device *dev,
+			     struct iw_request_info *info,
 			     union iwreq_data *wrqu, char *extra)
 {
 	struct r8192_priv *priv = ieee80211_priv(dev);
@@ -688,37 +688,37 @@ static int r8192_wx_set_wap(struct net_device *dev,
 	struct r8192_priv *priv = ieee80211_priv(dev);
 //        struct sockaddr *temp = (struct sockaddr *)awrq;
 	down(&priv->wx_sem);
-	
+
 	ret = ieee80211_wx_set_wap(priv->ieee80211,info,awrq,extra);
 
 	up(&priv->wx_sem);
 
 	return ret;
-	
+
 }
-	
 
-static int r8192_wx_get_wap(struct net_device *dev, 
-			    struct iw_request_info *info, 
+
+static int r8192_wx_get_wap(struct net_device *dev,
+			    struct iw_request_info *info,
 			    union iwreq_data *wrqu, char *extra)
 {
 	struct r8192_priv *priv = ieee80211_priv(dev);
-	
+
 	return ieee80211_wx_get_wap(priv->ieee80211,info,wrqu,extra);
 }
 
 
-static int r8192_wx_get_enc(struct net_device *dev, 
-			    struct iw_request_info *info, 
+static int r8192_wx_get_enc(struct net_device *dev,
+			    struct iw_request_info *info,
 			    union iwreq_data *wrqu, char *key)
 {
 	struct r8192_priv *priv = ieee80211_priv(dev);
-	
+
 	return ieee80211_wx_get_encode(priv->ieee80211, info, wrqu, key);
 }
 
-static int r8192_wx_set_enc(struct net_device *dev, 
-			    struct iw_request_info *info, 
+static int r8192_wx_set_enc(struct net_device *dev,
+			    struct iw_request_info *info,
 			    union iwreq_data *wrqu, char *key)
 {
 	struct r8192_priv *priv = ieee80211_priv(dev);
@@ -729,17 +729,17 @@ static int r8192_wx_set_enc(struct net_device *dev,
 	u32 hwkey[4]={0,0,0,0};
 	u8 mask=0xff;
 	u32 key_idx=0;
-	//u8 broadcast_addr[6] ={	0xff,0xff,0xff,0xff,0xff,0xff}; 
+	//u8 broadcast_addr[6] ={	0xff,0xff,0xff,0xff,0xff,0xff};
 	u8 zero_addr[4][6] ={	{0x00,0x00,0x00,0x00,0x00,0x00},
-				{0x00,0x00,0x00,0x00,0x00,0x01}, 
-				{0x00,0x00,0x00,0x00,0x00,0x02}, 
+				{0x00,0x00,0x00,0x00,0x00,0x01},
+				{0x00,0x00,0x00,0x00,0x00,0x02},
 				{0x00,0x00,0x00,0x00,0x00,0x03} };
 	int i;
 
        if(!priv->up) return -ENETDOWN;
 
 	down(&priv->wx_sem);
-	
+
 	RT_TRACE(COMP_SEC, "Setting SW wep key");
 	ret = ieee80211_wx_set_encode(priv->ieee80211,info,wrqu,key);
 
@@ -777,7 +777,7 @@ static int r8192_wx_set_enc(struct net_device *dev,
 
 			setKey( dev,
 				key_idx,                //EntryNo
-				key_idx,                //KeyIndex 
+				key_idx,                //KeyIndex
 				KEY_TYPE_WEP40,         //KeyType
 				zero_addr[key_idx],
 				0,                      //DefaultKey
@@ -791,12 +791,12 @@ static int r8192_wx_set_enc(struct net_device *dev,
 
 			setKey( dev,
 				key_idx,                //EntryNo
-				key_idx,                //KeyIndex 
+				key_idx,                //KeyIndex
 				KEY_TYPE_WEP104,        //KeyType
 				zero_addr[key_idx],
 				0,                      //DefaultKey
 				hwkey);                 //KeyContent
- 
+
 		}
 		else printk("wrong type in WEP, not WEP40 and WEP104\n");
 
@@ -808,28 +808,28 @@ static int r8192_wx_set_enc(struct net_device *dev,
 
 static int r8192_wx_set_scan_type(struct net_device *dev, struct iw_request_info *aa, union
  iwreq_data *wrqu, char *p){
-  
- 	struct r8192_priv *priv = ieee80211_priv(dev);
+
+	struct r8192_priv *priv = ieee80211_priv(dev);
 	int *parms=(int*)p;
 	int mode=parms[0];
-	
+
 	priv->ieee80211->active_scan = mode;
-	
+
 	return 1;
 }
 
 
 
-static int r8192_wx_set_retry(struct net_device *dev, 
-				struct iw_request_info *info, 
+static int r8192_wx_set_retry(struct net_device *dev,
+				struct iw_request_info *info,
 				union iwreq_data *wrqu, char *extra)
 {
 	struct r8192_priv *priv = ieee80211_priv(dev);
 	int err = 0;
-	
+
 	down(&priv->wx_sem);
-	
-	if (wrqu->retry.flags & IW_RETRY_LIFETIME || 
+
+	if (wrqu->retry.flags & IW_RETRY_LIFETIME ||
 	    wrqu->retry.disabled){
 		err = -EINVAL;
 		goto exit;
@@ -846,46 +846,46 @@ static int r8192_wx_set_retry(struct net_device *dev,
 	if (wrqu->retry.flags & IW_RETRY_MAX) {
 		priv->retry_rts = wrqu->retry.value;
 		DMESG("Setting retry for RTS/CTS data to %d", wrqu->retry.value);
-	
+
 	}else {
 		priv->retry_data = wrqu->retry.value;
 		DMESG("Setting retry for non RTS/CTS data to %d", wrqu->retry.value);
 	}
-	
-	/* FIXME ! 
+
+	/* FIXME !
 	 * We might try to write directly the TX config register
 	 * or to restart just the (R)TX process.
 	 * I'm unsure if whole reset is really needed
 	 */
 
- 	rtl8192_commit(dev);
+	rtl8192_commit(dev);
 	/*
 	if(priv->up){
 		rtl8180_rtx_disable(dev);
 		rtl8180_rx_enable(dev);
 		rtl8180_tx_enable(dev);
-			
+
 	}
 	*/
 exit:
 	up(&priv->wx_sem);
-	
+
 	return err;
 }
 
-static int r8192_wx_get_retry(struct net_device *dev, 
-				struct iw_request_info *info, 
+static int r8192_wx_get_retry(struct net_device *dev,
+				struct iw_request_info *info,
 				union iwreq_data *wrqu, char *extra)
 {
 	struct r8192_priv *priv = ieee80211_priv(dev);
-	
+
 
 	wrqu->retry.disabled = 0; /* can't be disabled */
 
-	if ((wrqu->retry.flags & IW_RETRY_TYPE) == 
-	    IW_RETRY_LIFETIME) 
+	if ((wrqu->retry.flags & IW_RETRY_TYPE) ==
+	    IW_RETRY_LIFETIME)
 		return -EINVAL;
-	
+
 	if (wrqu->retry.flags & IW_RETRY_MAX) {
 		wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_MAX;
 		wrqu->retry.value = priv->retry_rts;
@@ -894,30 +894,30 @@ static int r8192_wx_get_retry(struct net_device *dev,
 		wrqu->retry.value = priv->retry_data;
 	}
 	//printk("returning %d",wrqu->retry.value);
-	
+
 
 	return 0;
 }
 
-static int r8192_wx_get_sens(struct net_device *dev, 
-				struct iw_request_info *info, 
+static int r8192_wx_get_sens(struct net_device *dev,
+				struct iw_request_info *info,
 				union iwreq_data *wrqu, char *extra)
 {
 	struct r8192_priv *priv = ieee80211_priv(dev);
-	if(priv->rf_set_sens == NULL) 
+	if(priv->rf_set_sens == NULL)
 		return -1; /* we have not this support for this radio */
 	wrqu->sens.value = priv->sens;
 	return 0;
 }
 
 
-static int r8192_wx_set_sens(struct net_device *dev, 
-				struct iw_request_info *info, 
+static int r8192_wx_set_sens(struct net_device *dev,
+				struct iw_request_info *info,
 				union iwreq_data *wrqu, char *extra)
 {
-	
+
 	struct r8192_priv *priv = ieee80211_priv(dev);
-	
+
 	short err = 0;
 	down(&priv->wx_sem);
 	//DMESG("attempt to set sensivity to %ddb",wrqu->sens.value);
@@ -932,15 +932,15 @@ static int r8192_wx_set_sens(struct net_device *dev,
 
 exit:
 	up(&priv->wx_sem);
-	
+
 	return err;
 }
 
 #if (WIRELESS_EXT >= 18)
 #if 0
 static int r8192_wx_get_enc_ext(struct net_device *dev,
-                                        struct iw_request_info *info,
-                                        union iwreq_data *wrqu, char *extra)
+					struct iw_request_info *info,
+					union iwreq_data *wrqu, char *extra)
 {
 	struct r8192_priv *priv = ieee80211_priv(dev);
 	int ret = 0;
@@ -950,8 +950,8 @@ static int r8192_wx_get_enc_ext(struct net_device *dev,
 #endif
 //hw security need to reorganized.
 static int r8192_wx_set_enc_ext(struct net_device *dev,
-                                        struct iw_request_info *info,
-                                        union iwreq_data *wrqu, char *extra)
+					struct iw_request_info *info,
+					union iwreq_data *wrqu, char *extra)
 {
 	int ret=0;
 	#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
@@ -959,10 +959,10 @@ static int r8192_wx_set_enc_ext(struct net_device *dev,
 	struct ieee80211_device* ieee = priv->ieee80211;
 	//printk("===>%s()\n", __FUNCTION__);
 
-	
+
 	down(&priv->wx_sem);
 	ret = ieee80211_wx_set_encode_ext(priv->ieee80211, info, wrqu, extra);
-	
+
 	{
 		u8 broadcast_addr[6] = {0xff,0xff,0xff,0xff,0xff,0xff};
 		u8 zero[6] = {0};
@@ -978,9 +978,9 @@ static int r8192_wx_set_enc_ext(struct net_device *dev,
 #endif
 		u8 idx = 0, alg = 0, group = 0;
 		if ((encoding->flags & IW_ENCODE_DISABLED) ||
-		ext->alg == IW_ENCODE_ALG_NONE) //none is not allowed to use hwsec WB 2008.07.01 
+		ext->alg == IW_ENCODE_ALG_NONE) //none is not allowed to use hwsec WB 2008.07.01
 			goto end_hw_sec;
-		
+
 		alg =  (ext->alg == IW_ENCODE_ALG_CCMP)?KEY_TYPE_CCMP:ext->alg; // as IW_ENCODE_ALG_CCMP is defined to be 3 and KEY_TYPE_CCMP is defined to 4;
 		idx = encoding->flags & IW_ENCODE_INDEX;
 		if (idx)
@@ -995,13 +995,13 @@ static int r8192_wx_set_enc_ext(struct net_device *dev,
 			EnableHWSecurityConfig8192(dev);
 		}
 		memcpy((u8*)key, ext->key, 16); //we only get 16 bytes key.why? WB 2008.7.1
-		
+
 		if ((alg & KEY_TYPE_WEP40) && (ieee->auth_mode !=2) )
 		{
 
 			setKey( dev,
 					idx,//EntryNo
-					idx, //KeyIndex 
+					idx, //KeyIndex
 					alg,  //KeyType
 					zero, //MacAddr
 					0,              //DefaultKey
@@ -1012,7 +1012,7 @@ static int r8192_wx_set_enc_ext(struct net_device *dev,
 			ieee->group_key_type = alg;
 			setKey( dev,
 					idx,//EntryNo
-					idx, //KeyIndex 
+					idx, //KeyIndex
 					alg,  //KeyType
 					broadcast_addr, //MacAddr
 					0,              //DefaultKey
@@ -1022,7 +1022,7 @@ static int r8192_wx_set_enc_ext(struct net_device *dev,
 		{
 			setKey( dev,
 					4,//EntryNo
-					idx, //KeyIndex 
+					idx, //KeyIndex
 					alg,  //KeyType
 					(u8*)ieee->ap_mac_addr, //MacAddr
 					0,              //DefaultKey
@@ -1036,12 +1036,12 @@ end_hw_sec:
 
 	up(&priv->wx_sem);
 #endif
-	return ret;	
+	return ret;
 
 }
 static int r8192_wx_set_auth(struct net_device *dev,
-                                        struct iw_request_info *info,
-                                        union iwreq_data *data, char *extra)
+					struct iw_request_info *info,
+					union iwreq_data *data, char *extra)
 {
 	int ret=0;
 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
@@ -1055,8 +1055,8 @@ static int r8192_wx_set_auth(struct net_device *dev,
 }
 
 static int r8192_wx_set_mlme(struct net_device *dev,
-                                        struct iw_request_info *info,
-                                        union iwreq_data *wrqu, char *extra)
+					struct iw_request_info *info,
+					union iwreq_data *wrqu, char *extra)
 {
 	//printk("====>%s()\n", __FUNCTION__);
 
@@ -1072,21 +1072,21 @@ static int r8192_wx_set_mlme(struct net_device *dev,
 }
 #endif
 static int r8192_wx_set_gen_ie(struct net_device *dev,
-                                        struct iw_request_info *info,
-                                        union iwreq_data *data, char *extra)
+					struct iw_request_info *info,
+					union iwreq_data *data, char *extra)
 {
 	   //printk("====>%s(), len:%d\n", __FUNCTION__, data->length);
 	int ret=0;
 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
-        struct r8192_priv *priv = ieee80211_priv(dev);
-        down(&priv->wx_sem);
+	struct r8192_priv *priv = ieee80211_priv(dev);
+	down(&priv->wx_sem);
 #if 1
-        ret = ieee80211_wx_set_gen_ie(priv->ieee80211, extra, data->data.length);
+	ret = ieee80211_wx_set_gen_ie(priv->ieee80211, extra, data->data.length);
 #endif
-        up(&priv->wx_sem);
+	up(&priv->wx_sem);
 	//printk("<======%s(), ret:%d\n", __FUNCTION__, ret);
 #endif
-        return ret;
+	return ret;
 
 
 }
@@ -1100,61 +1100,61 @@ static int dummy(struct net_device *dev, struct iw_request_info *a,
 
 static iw_handler r8192_wx_handlers[] =
 {
-        NULL,                     /* SIOCSIWCOMMIT */
-        r8192_wx_get_name,   	  /* SIOCGIWNAME */
-        dummy,                    /* SIOCSIWNWID */
-        dummy,                    /* SIOCGIWNWID */
-        r8192_wx_set_freq,        /* SIOCSIWFREQ */
-        r8192_wx_get_freq,        /* SIOCGIWFREQ */
-        r8192_wx_set_mode,        /* SIOCSIWMODE */
-        r8192_wx_get_mode,        /* SIOCGIWMODE */
-        r8192_wx_set_sens,        /* SIOCSIWSENS */
-        r8192_wx_get_sens,        /* SIOCGIWSENS */
-        NULL,                     /* SIOCSIWRANGE */
-        rtl8180_wx_get_range,	  /* SIOCGIWRANGE */
-        NULL,                     /* SIOCSIWPRIV */
-        NULL,                     /* SIOCGIWPRIV */
-        NULL,                     /* SIOCSIWSTATS */
-        NULL,                     /* SIOCGIWSTATS */
-        dummy,                    /* SIOCSIWSPY */
-        dummy,                    /* SIOCGIWSPY */
-        NULL,                     /* SIOCGIWTHRSPY */
-        NULL,                     /* SIOCWIWTHRSPY */
-        r8192_wx_set_wap,      	  /* SIOCSIWAP */
-        r8192_wx_get_wap,         /* SIOCGIWAP */
+	NULL,                     /* SIOCSIWCOMMIT */
+	r8192_wx_get_name,   	  /* SIOCGIWNAME */
+	dummy,                    /* SIOCSIWNWID */
+	dummy,                    /* SIOCGIWNWID */
+	r8192_wx_set_freq,        /* SIOCSIWFREQ */
+	r8192_wx_get_freq,        /* SIOCGIWFREQ */
+	r8192_wx_set_mode,        /* SIOCSIWMODE */
+	r8192_wx_get_mode,        /* SIOCGIWMODE */
+	r8192_wx_set_sens,        /* SIOCSIWSENS */
+	r8192_wx_get_sens,        /* SIOCGIWSENS */
+	NULL,                     /* SIOCSIWRANGE */
+	rtl8180_wx_get_range,	  /* SIOCGIWRANGE */
+	NULL,                     /* SIOCSIWPRIV */
+	NULL,                     /* SIOCGIWPRIV */
+	NULL,                     /* SIOCSIWSTATS */
+	NULL,                     /* SIOCGIWSTATS */
+	dummy,                    /* SIOCSIWSPY */
+	dummy,                    /* SIOCGIWSPY */
+	NULL,                     /* SIOCGIWTHRSPY */
+	NULL,                     /* SIOCWIWTHRSPY */
+	r8192_wx_set_wap,      	  /* SIOCSIWAP */
+	r8192_wx_get_wap,         /* SIOCGIWAP */
 #if (WIRELESS_EXT >= 18)
-        r8192_wx_set_mlme,                     /* MLME-- */
+	r8192_wx_set_mlme,                     /* MLME-- */
 #else
 	 NULL,
 #endif
-        dummy,                     /* SIOCGIWAPLIST -- depricated */
-        r8192_wx_set_scan,        /* SIOCSIWSCAN */
-        r8192_wx_get_scan,        /* SIOCGIWSCAN */
-        r8192_wx_set_essid,       /* SIOCSIWESSID */
-        r8192_wx_get_essid,       /* SIOCGIWESSID */
-        dummy,                    /* SIOCSIWNICKN */
-        dummy,                    /* SIOCGIWNICKN */
-        NULL,                     /* -- hole -- */
-        NULL,                     /* -- hole -- */
-        r8192_wx_set_rate,        /* SIOCSIWRATE */
-        r8192_wx_get_rate,        /* SIOCGIWRATE */
-        r8192_wx_set_rts,                    /* SIOCSIWRTS */
-        r8192_wx_get_rts,                    /* SIOCGIWRTS */
-        r8192_wx_set_frag,        /* SIOCSIWFRAG */
-        r8192_wx_get_frag,        /* SIOCGIWFRAG */
-        dummy,                    /* SIOCSIWTXPOW */
-        dummy,                    /* SIOCGIWTXPOW */
-        r8192_wx_set_retry,       /* SIOCSIWRETRY */
-        r8192_wx_get_retry,       /* SIOCGIWRETRY */
-        r8192_wx_set_enc,         /* SIOCSIWENCODE */
-        r8192_wx_get_enc,         /* SIOCGIWENCODE */
-        r8192_wx_set_power,                    /* SIOCSIWPOWER */
-        r8192_wx_get_power,                    /* SIOCGIWPOWER */
+	dummy,                     /* SIOCGIWAPLIST -- depricated */
+	r8192_wx_set_scan,        /* SIOCSIWSCAN */
+	r8192_wx_get_scan,        /* SIOCGIWSCAN */
+	r8192_wx_set_essid,       /* SIOCSIWESSID */
+	r8192_wx_get_essid,       /* SIOCGIWESSID */
+	dummy,                    /* SIOCSIWNICKN */
+	dummy,                    /* SIOCGIWNICKN */
+	NULL,                     /* -- hole -- */
+	NULL,                     /* -- hole -- */
+	r8192_wx_set_rate,        /* SIOCSIWRATE */
+	r8192_wx_get_rate,        /* SIOCGIWRATE */
+	r8192_wx_set_rts,                    /* SIOCSIWRTS */
+	r8192_wx_get_rts,                    /* SIOCGIWRTS */
+	r8192_wx_set_frag,        /* SIOCSIWFRAG */
+	r8192_wx_get_frag,        /* SIOCGIWFRAG */
+	dummy,                    /* SIOCSIWTXPOW */
+	dummy,                    /* SIOCGIWTXPOW */
+	r8192_wx_set_retry,       /* SIOCSIWRETRY */
+	r8192_wx_get_retry,       /* SIOCGIWRETRY */
+	r8192_wx_set_enc,         /* SIOCSIWENCODE */
+	r8192_wx_get_enc,         /* SIOCGIWENCODE */
+	r8192_wx_set_power,                    /* SIOCSIWPOWER */
+	r8192_wx_get_power,                    /* SIOCGIWPOWER */
 	NULL,			/*---hole---*/
 	NULL, 			/*---hole---*/
 	r8192_wx_set_gen_ie,//NULL, 			/* SIOCSIWGENIE */
 	NULL, 			/* SIOCSIWGENIE */
-	
+
 #if (WIRELESS_EXT >= 18)
 	r8192_wx_set_auth,//NULL, 			/* SIOCSIWAUTH */
 	NULL,//r8192_wx_get_auth,//NULL, 			/* SIOCSIWAUTH */
@@ -1168,62 +1168,62 @@ static iw_handler r8192_wx_handlers[] =
 #endif
 	NULL, 			/* SIOCSIWPMKSA */
 	NULL, 			 /*---hole---*/
-	
-}; 
+
+};
 
 
-static const struct iw_priv_args r8192_private_args[] = { 
-	
+static const struct iw_priv_args r8192_private_args[] = {
+
 	{
-		SIOCIWFIRSTPRIV + 0x0, 
-		IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "badcrc" 
-	}, 
-	
+		SIOCIWFIRSTPRIV + 0x0,
+		IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "badcrc"
+	},
+
 	{
 		SIOCIWFIRSTPRIV + 0x1,
 		IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "activescan"
-	
+
 	},
 	{
-		SIOCIWFIRSTPRIV + 0x2, 
-		IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "rawtx" 
+		SIOCIWFIRSTPRIV + 0x2,
+		IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "rawtx"
 	}
-#ifdef JOHN_IOCTL	
+#ifdef JOHN_IOCTL
 	,
 	{
 		SIOCIWFIRSTPRIV + 0x3,
-                IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "readRF"
+		IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "readRF"
 	}
 	,
 	{
 		SIOCIWFIRSTPRIV + 0x4,
-                IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "writeRF"
+		IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "writeRF"
 	}
 	,
 	{
 		SIOCIWFIRSTPRIV + 0x5,
-                IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "readBB"
+		IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "readBB"
 	}
 	,
 	{
 		SIOCIWFIRSTPRIV + 0x6,
-                IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "writeBB"
+		IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "writeBB"
+	}
+	,
+	{
+		SIOCIWFIRSTPRIV + 0x7,
+		IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "readnicb"
+	}
+	,
+	{
+		SIOCIWFIRSTPRIV + 0x8,
+		IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "writenicb"
+	}
+	,
+	{
+		SIOCIWFIRSTPRIV + 0x9,
+		IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "apinfo"
 	}
-        ,
-        {
-                SIOCIWFIRSTPRIV + 0x7,
-                IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "readnicb"
-        }
-        ,
-        {
-                SIOCIWFIRSTPRIV + 0x8,
-                IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "writenicb"
-        }
-        ,
-        {
-                SIOCIWFIRSTPRIV + 0x9,
-                IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "apinfo"
-        }
 
 #endif
 	,
@@ -1249,15 +1249,15 @@ static iw_handler r8192_private_handler[] = {
 	r8192_wx_write_regs,
 	r8192_wx_read_bb,
 	r8192_wx_write_bb,
-        r8192_wx_read_nicb,
-        r8192_wx_write_nicb,
-	r8192_wx_get_ap_status,	
+	r8192_wx_read_nicb,
+	r8192_wx_write_nicb,
+	r8192_wx_get_ap_status,
 #endif
 	//r8192_wx_null,
 	r8192_wx_force_reset,
 };
 
-//#if WIRELESS_EXT >= 17	
+//#if WIRELESS_EXT >= 17
 struct iw_statistics *r8192_get_wireless_stats(struct net_device *dev)
 {
        struct r8192_priv *priv = ieee80211_priv(dev);
@@ -1271,17 +1271,17 @@ struct iw_statistics *r8192_get_wireless_stats(struct net_device *dev)
 		wstats->qual.qual = 0;
 		wstats->qual.level = 0;
 		wstats->qual.noise = 0;
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14)) 
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14))
 		wstats->qual.updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM;
 #else
 		wstats->qual.updated = 0x0f;
 #endif
 		return wstats;
 	}
-	
+
        tmp_level = (&ieee->current_network)->stats.rssi;
 	tmp_qual = (&ieee->current_network)->stats.signal;
-	tmp_noise = (&ieee->current_network)->stats.noise;			
+	tmp_noise = (&ieee->current_network)->stats.noise;
 	//printk("level:%d, qual:%d, noise:%d\n", tmp_level, tmp_qual, tmp_noise);
 
 	wstats->qual.level = tmp_level;
@@ -1290,7 +1290,7 @@ struct iw_statistics *r8192_get_wireless_stats(struct net_device *dev)
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14))
 	wstats->qual.updated = IW_QUAL_ALL_UPDATED| IW_QUAL_DBM;
 #else
-        wstats->qual.updated = 0x0f;
+	wstats->qual.updated = 0x0f;
 #endif
 	return wstats;
 }
@@ -1302,9 +1302,9 @@ struct iw_handler_def  r8192_wx_handlers_def={
 	.num_standard = sizeof(r8192_wx_handlers) / sizeof(iw_handler),
 	.private = r8192_private_handler,
 	.num_private = sizeof(r8192_private_handler) / sizeof(iw_handler),
- 	.num_private_args = sizeof(r8192_private_args) / sizeof(struct iw_priv_args),
-#if WIRELESS_EXT >= 17	
+	.num_private_args = sizeof(r8192_private_args) / sizeof(struct iw_priv_args),
+#if WIRELESS_EXT >= 17
 	.get_wireless_stats = r8192_get_wireless_stats,
 #endif
-	.private_args = (struct iw_priv_args *)r8192_private_args,	
+	.private_args = (struct iw_priv_args *)r8192_private_args,
 };
diff --git a/drivers/staging/rtl8192u/r8192U_wx.h b/drivers/staging/rtl8192u/r8192U_wx.h
index 90f6229..b2f7a57 100644
--- a/drivers/staging/rtl8192u/r8192U_wx.h
+++ b/drivers/staging/rtl8192u/r8192U_wx.h
@@ -1,12 +1,12 @@
-/* 
+/*
 	This is part of rtl8180 OpenSource driver - v 0.3
-	Copyright (C) Andrea Merello 2004  <andreamrl at tiscali.it> 
+	Copyright (C) Andrea Merello 2004  <andreamrl at tiscali.it>
 	Released under the terms of GPL (General Public Licence)
-	
+
 	Parts of this driver are based on the GPL part of the official realtek driver
 	Parts of this driver are based on the rtl8180 driver skeleton from Patric Schenke & Andres Salomon
 	Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver
-	
+
 	We want to tanks the Authors of such projects and the Ndiswrapper project Authors.
 */
 
diff --git a/drivers/staging/rtl8192u/r819xU_cmdpkt.c b/drivers/staging/rtl8192u/r819xU_cmdpkt.c
index 2fcbf82..bbf359f 100644
--- a/drivers/staging/rtl8192u/r819xU_cmdpkt.c
+++ b/drivers/staging/rtl8192u/r819xU_cmdpkt.c
@@ -5,12 +5,12 @@
  Module:	r819xusb_cmdpkt.c	(RTL8190 TX/RX command packet handler Source C File)
 
  Note:      The module is responsible for handling TX and RX command packet.
- 			1. TX : Send set and query configuration command packet.
- 			2. RX : Receive tx feedback, beacon state, query configuration
- 			        command packet.
- 			
+			1. TX : Send set and query configuration command packet.
+			2. RX : Receive tx feedback, beacon state, query configuration
+				command packet.
+			
  Function:
- 		 
+		 
  Export:
 
  Abbrev:
@@ -48,10 +48,10 @@ SendTxCommandPacket(
 	rt_status	rtStatus = RT_STATUS_SUCCESS;
 	struct r8192_priv   *priv = ieee80211_priv(dev);
 	struct sk_buff	    *skb;
-	cb_desc		    *tcb_desc;	
+	cb_desc		    *tcb_desc;
 	unsigned char	    *ptr_buf;
 	//bool	bLastInitPacket = false;
-	
+
 	//PlatformAcquireSpinLock(Adapter, RT_TX_SPINLOCK);
 
 	//Get TCB and local buffer from common pool. (It is shared by CmdQ, MgntQ, and USB coalesce DataQ)
@@ -75,8 +75,8 @@ SendTxCommandPacket(
 		} else {
 			priv->ieee80211->softmac_hard_start_xmit(skb,dev);
 		}
-	
-	//PlatformReleaseSpinLock(Adapter, RT_TX_SPINLOCK);	
+
+	//PlatformReleaseSpinLock(Adapter, RT_TX_SPINLOCK);
 	return rtStatus;
 }
 
@@ -116,11 +116,11 @@ SendTxCommandPacket(
 	u16		    frag_length, frag_offset = 0;
 	//u16		    total_size;
 	//int		    i;
-	
+
 	rt_firmware	    *pfirmware = priv->pFirmware;
 	struct sk_buff	    *skb;
 	unsigned char	    *seg_ptr;
-	cb_desc		    *tcb_desc;	
+	cb_desc		    *tcb_desc;
 	u8                  bLastIniPkt;
 
 	firmware_init_param(dev);
@@ -137,7 +137,7 @@ SendTxCommandPacket(
 
 		}
 
-		/* Allocate skb buffer to contain firmware info and tx descriptor info 
+		/* Allocate skb buffer to contain firmware info and tx descriptor info
 		 * add 4 to avoid packet appending overflow.
 		 * */
 		#ifdef RTL8192U
@@ -157,8 +157,8 @@ SendTxCommandPacket(
 		
 		seg_ptr = skb_put(skb, buffer_len);
 		/* 
-		 * Transform from little endian to big endian 
-                 * and pending  zero
+		 * Transform from little endian to big endian
+		 * and pending  zero
 		 */
 		memcpy(seg_ptr,codevirtualaddress,buffer_len);
 		tcb_desc->txbuf_size= (u16)buffer_len;
@@ -172,12 +172,12 @@ SendTxCommandPacket(
 		} else {
 			priv->ieee80211->softmac_hard_start_xmit(skb,dev);
 		}
-		
+
 		codevirtualaddress += frag_length;
 		frag_offset += frag_length;
 
 	}while(frag_offset < buffer_len);
-	
+
 	return rt_status;
 
 
@@ -349,7 +349,7 @@ cmpk_handle_tx_feedback(
 		pMgntInfo->CurrentOperaRate = (rx_tx_fb.F_Rate & 0x7F);
 	}
 	else if (pAdapter->RegWirelessMode == WIRELESS_MODE_N_24G ||
-		 	 pAdapter->RegWirelessMode == WIRELESS_MODE_N_5G)
+			 pAdapter->RegWirelessMode == WIRELESS_MODE_N_5G)
 	{
 		pMgntInfo->HTCurrentOperaRate = (rx_tx_fb.F_Rate & 0x8F);
 	}
@@ -802,7 +802,7 @@ cmpk_message_handle_rx(
 				
 			default:
 				
-			        RT_TRACE(COMP_ERR, "---->cmpk_message_handle_rx():unknow CMD Element\n");
+				RT_TRACE(COMP_ERR, "---->cmpk_message_handle_rx():unknow CMD Element\n");
 				return 1;	/* This is a command packet. */
 		}
 		// 2007/01/22 MH Display received rx command packet info. 
diff --git a/drivers/staging/rtl8192u/r819xU_cmdpkt.h b/drivers/staging/rtl8192u/r819xU_cmdpkt.h
index 9a2f3ed..32b3289 100644
--- a/drivers/staging/rtl8192u/r819xU_cmdpkt.h
+++ b/drivers/staging/rtl8192u/r819xU_cmdpkt.h
@@ -202,10 +202,10 @@ typedef enum tag_command_packet_directories
 }cmpk_element_e;
 
 typedef enum _rt_status{
-        RT_STATUS_SUCCESS,
-        RT_STATUS_FAILURE,
-        RT_STATUS_PENDING,
-        RT_STATUS_RESOURCE
+	RT_STATUS_SUCCESS,
+	RT_STATUS_FAILURE,
+	RT_STATUS_PENDING,
+	RT_STATUS_RESOURCE
 }rt_status,*prt_status;
 
 extern rt_status cmpk_message_handle_tx(struct net_device *dev, u8* codevirtualaddress, u32 packettype, u32 buffer_len); 
diff --git a/drivers/staging/rtl8192u/r819xU_firmware.c b/drivers/staging/rtl8192u/r819xU_firmware.c
index d8dc02b..20d78f4 100644
--- a/drivers/staging/rtl8192u/r819xU_firmware.c
+++ b/drivers/staging/rtl8192u/r819xU_firmware.c
@@ -1,9 +1,9 @@
 /**************************************************************************************************
  * Procedure:    Init boot code/firmware code/data session
  *
- * Description: This routine will intialize firmware. If any error occurs during the initialization 
+ * Description: This routine will intialize firmware. If any error occurs during the initialization
  * 		process, the routine shall terminate immediately and return fail.
- *		NIC driver should call NdisOpenFile only from MiniportInitialize.	
+ *		NIC driver should call NdisOpenFile only from MiniportInitialize.
  *
  * Arguments:   The pointer of the adapter
 
@@ -39,11 +39,11 @@ bool fw_download_code(struct net_device *dev, u8 *code_virtual_address, u32 buff
 	u16		    frag_length, frag_offset = 0;
 	//u16		    total_size;
 	int		    i;
-	
+
 	rt_firmware	    *pfirmware = priv->pFirmware;
 	struct sk_buff	    *skb;
 	unsigned char	    *seg_ptr;
-	cb_desc		    *tcb_desc;	
+	cb_desc		    *tcb_desc;
 	u8                  bLastIniPkt;
 
 	firmware_init_param(dev);
@@ -60,13 +60,13 @@ bool fw_download_code(struct net_device *dev, u8 *code_virtual_address, u32 buff
 
 		}
 
-		/* Allocate skb buffer to contain firmware info and tx descriptor info 
+		/* Allocate skb buffer to contain firmware info and tx descriptor info
 		 * add 4 to avoid packet appending overflow.
 		 * */
 		#ifdef RTL8192U
-		skb  = dev_alloc_skb(USB_HWDESC_HEADER_LEN + frag_length + 4); 
+		skb  = dev_alloc_skb(USB_HWDESC_HEADER_LEN + frag_length + 4);
 		#else
-		skb  = dev_alloc_skb(frag_length + 4); 
+		skb  = dev_alloc_skb(frag_length + 4);
 		#endif
 		memcpy((unsigned char *)(skb->cb),&dev,sizeof(dev));
 		tcb_desc = (cb_desc*)(skb->cb + MAX_DEV_ADDR_SIZE);
@@ -78,9 +78,9 @@ bool fw_download_code(struct net_device *dev, u8 *code_virtual_address, u32 buff
 		skb_reserve(skb, USB_HWDESC_HEADER_LEN);
 		#endif
 		seg_ptr = skb->data;
-		/* 
-		 * Transform from little endian to big endian 
-                 * and pending  zero
+		/*
+		 * Transform from little endian to big endian
+		 * and pending  zero
 		 */
 		for(i=0 ; i < frag_length; i+=4) {
 			*seg_ptr++ = ((i+0)<frag_length)?code_virtual_address[i+3]:0;
@@ -99,16 +99,16 @@ bool fw_download_code(struct net_device *dev, u8 *code_virtual_address, u32 buff
 		} else {
 			priv->ieee80211->softmac_hard_start_xmit(skb,dev);
 		}
-		
+
 		code_virtual_address += frag_length;
 		frag_offset += frag_length;
 
 	}while(frag_offset < buffer_len);
-	
+
 	return rt_status;
 
 #if 0
-cmdsend_downloadcode_fail:	
+cmdsend_downloadcode_fail:
 	rt_status = false;
 	RT_TRACE(COMP_ERR, "CmdSendDownloadCode fail !!\n");
 	return rt_status;
@@ -124,10 +124,10 @@ fwSendNullPacket(
 	bool	rtStatus = true;
 	struct r8192_priv   *priv = ieee80211_priv(dev);
 	struct sk_buff	    *skb;
-	cb_desc		    *tcb_desc;	
+	cb_desc		    *tcb_desc;
 	unsigned char	    *ptr_buf;
 	bool	bLastInitPacket = false;
-	
+
 	//PlatformAcquireSpinLock(Adapter, RT_TX_SPINLOCK);
 
 	//Get TCB and local buffer from common pool. (It is shared by CmdQ, MgntQ, and USB coalesce DataQ)
@@ -149,21 +149,21 @@ fwSendNullPacket(
 		} else {
 			priv->ieee80211->softmac_hard_start_xmit(skb,dev);
 		}
-	
-	//PlatformReleaseSpinLock(Adapter, RT_TX_SPINLOCK);	
+
+	//PlatformReleaseSpinLock(Adapter, RT_TX_SPINLOCK);
 	return rtStatus;
 }
 
 #if 0
 /*
  * Procedure  :   Download code into IMEM or DMEM
- * Description:   This routine will intialize firmware. If any error occurs during the initialization 
+ * Description:   This routine will intialize firmware. If any error occurs during the initialization
  *				process, the routine shall terminate immediately and return fail.
  *				The routine copy virtual address get from opening of file into shared memory
- *				allocated during initialization. If code size larger than a conitneous shared 
+ *				allocated during initialization. If code size larger than a conitneous shared
  *				memory may contain, the code should be divided into several section.
  *				!!!NOTES This finction should only be called during MPInitialization because
- *				A NIC driver should call NdisOpenFile only from MiniportInitialize.	
+ *				A NIC driver should call NdisOpenFile only from MiniportInitialize.
  * Arguments :    The pointer of the adapter
  *			   Code address (Virtual address, should fill descriptor with physical address)
  *			   Code size
@@ -204,12 +204,12 @@ bool fwsend_download_code(struct net_device *dev)
 //-----------------------------------------------------------------------------
 // Procedure:    Check whether main code is download OK. If OK, turn on CPU
 //
-// Description:   CPU register locates in different page against general register. 
-//			    Switch to CPU register in the begin and switch back before return				
-//				
-//				
+// Description:   CPU register locates in different page against general register.
+//			    Switch to CPU register in the begin and switch back before return
+//
+//
 // Arguments:   The pointer of the adapter
-//        
+//
 // Returns:
 //        NDIS_STATUS_FAILURE - the following initialization process should be terminated
 //        NDIS_STATUS_SUCCESS - if firmware initialization process success
@@ -218,7 +218,7 @@ bool CPUcheck_maincodeok_turnonCPU(struct net_device *dev)
 {
 	bool		rt_status = true;
 	int		check_putcodeOK_time = 200000, check_bootOk_time = 200000;
-	u32	 	CPU_status = 0;
+	u32		CPU_status = 0;
 
 	/* Check whether put code OK */
 	do {
@@ -257,7 +257,7 @@ bool CPUcheck_maincodeok_turnonCPU(struct net_device *dev)
 
 	return rt_status;
 
-CPUCheckMainCodeOKAndTurnOnCPU_Fail:	
+CPUCheckMainCodeOKAndTurnOnCPU_Fail:
 	RT_TRACE(COMP_ERR, "ERR in %s()\n", __FUNCTION__);
 	rt_status = FALSE;
 	return rt_status;
@@ -276,7 +276,7 @@ bool CPUcheck_firmware_ready(struct net_device *dev)
 
 		if(CPU_status&CPU_GEN_FIRM_RDY)
 			break;
-		
+
 	}while(check_time--);
 
 	if(!(CPU_status&CPU_GEN_FIRM_RDY))
@@ -285,7 +285,7 @@ bool CPUcheck_firmware_ready(struct net_device *dev)
 		RT_TRACE(COMP_FIRMWARE, "Download Firmware: Firmware ready!\n");
 
 	return rt_status;
-	
+
 CPUCheckFirmwareReady_Fail:
 	RT_TRACE(COMP_ERR, "ERR in %s()\n", __FUNCTION__);
 	rt_status = false;
@@ -298,13 +298,13 @@ bool init_firmware(struct net_device *dev)
 	struct r8192_priv 	*priv = ieee80211_priv(dev);
 	bool			rt_status = TRUE;
 
-	u8			*firmware_img_buf[3] = { &rtl8190_fwboot_array[0], 
-						   	 &rtl8190_fwmain_array[0],
-						   	 &rtl8190_fwdata_array[0]};
+	u8			*firmware_img_buf[3] = { &rtl8190_fwboot_array[0],
+							 &rtl8190_fwmain_array[0],
+							 &rtl8190_fwdata_array[0]};
 
-	u32			firmware_img_len[3] = { sizeof(rtl8190_fwboot_array), 
-						   	sizeof(rtl8190_fwmain_array),
-						   	sizeof(rtl8190_fwdata_array)};
+	u32			firmware_img_len[3] = { sizeof(rtl8190_fwboot_array),
+							sizeof(rtl8190_fwmain_array),
+							sizeof(rtl8190_fwdata_array)};
 	u32			file_length = 0;
 	u8			*mapped_file = NULL;
 	u32			init_step = 0;
@@ -314,13 +314,13 @@ bool init_firmware(struct net_device *dev)
 	rt_firmware		*pfirmware = priv->pFirmware;
 	const struct firmware 	*fw_entry;
 	const char *fw_name[3] = { "RTL8192U/boot.img",
-                           "RTL8192U/main.img",
+			   "RTL8192U/main.img",
 			   "RTL8192U/data.img"};
 	int rc;
 
 	RT_TRACE(COMP_FIRMWARE, " PlatformInitFirmware()==>\n");
 
-	if (pfirmware->firmware_status == FW_STATUS_0_INIT ) { 
+	if (pfirmware->firmware_status == FW_STATUS_0_INIT ) {
 		/* it is called by reset */
 		rst_opt = OPT_SYSTEM_RESET;
 		starting_state = FW_INIT_STEP0_BOOT;
@@ -333,9 +333,9 @@ bool init_firmware(struct net_device *dev)
 	}else {
 		 RT_TRACE(COMP_FIRMWARE, "PlatformInitFirmware: undefined firmware state\n");
 	}
-	
+
 	/*
-	 * Download boot, main, and data image for System reset. 
+	 * Download boot, main, and data image for System reset.
 	 * Download data image for firmware reseta
 	 */
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
@@ -356,8 +356,8 @@ bool init_firmware(struct net_device *dev)
 					if(rc < 0 ) {
 						RT_TRACE(COMP_ERR, "request firmware fail!\n");
 						goto download_firmware_fail;
-					} 
-					
+					}
+
 					if(fw_entry->size > sizeof(pfirmware->firmware_buf)) {
 						RT_TRACE(COMP_ERR, "img file size exceed the container buffer fail!\n");
 						goto download_firmware_fail;
@@ -381,7 +381,7 @@ bool init_firmware(struct net_device *dev)
 					}
 					pfirmware->firmware_buf_size = file_length;
 					#endif
-					break;	
+					break;
 
 				case FW_SOURCE_HEADER_FILE:
 					mapped_file =  firmware_img_buf[init_step];
@@ -407,7 +407,7 @@ bool init_firmware(struct net_device *dev)
 		/* The firmware download process is just as following,
 		 * 1. that is each packet will be segmented and inserted to the wait queue.
 		 * 2. each packet segment will be put in the skb_buff packet.
-		 * 3. each skb_buff packet data content will already include the firmware info 
+		 * 3. each skb_buff packet data content will already include the firmware info
 		 *   and Tx descriptor info
 		 * */
 		rt_status = fw_download_code(dev,mapped_file,file_length);
@@ -424,7 +424,7 @@ bool init_firmware(struct net_device *dev)
 		switch(init_step) {
 			case FW_INIT_STEP0_BOOT:
 				/* Download boot
-				 * initialize command descriptor.  
+				 * initialize command descriptor.
 				 * will set polling bit when firmware code is also configured
 				 */
 				pfirmware->firmware_status = FW_STATUS_1_MOVE_BOOT_CODE;
@@ -434,13 +434,13 @@ bool init_firmware(struct net_device *dev)
 				if(rt_status != true)
 				{
 					RT_TRACE(COMP_INIT, "fwSendNullPacket() fail ! \n");
-					goto  download_firmware_fail;						
+					goto  download_firmware_fail;
 				}
 #endif
 				//mdelay(1000);
-				/* 
-				 * To initialize IMEM, CPU move code  from 0x80000080, 
-				 * hence, we send 0x80 byte packet 
+				/*
+				 * To initialize IMEM, CPU move code  from 0x80000080,
+				 * hence, we send 0x80 byte packet
 				 */
 				break;
 
@@ -450,7 +450,7 @@ bool init_firmware(struct net_device *dev)
 
 				/* Check Put Code OK and Turn On CPU */
 				rt_status = CPUcheck_maincodeok_turnonCPU(dev);
-				if(rt_status != TRUE) {	
+				if(rt_status != TRUE) {
 					RT_TRACE(COMP_ERR, "CPUcheck_maincodeok_turnonCPU fail!\n");
 					goto download_firmware_fail;
 				}
@@ -464,7 +464,7 @@ bool init_firmware(struct net_device *dev)
 				mdelay(1);
 
 				rt_status = CPUcheck_firmware_ready(dev);
-				if(rt_status != TRUE) {				
+				if(rt_status != TRUE) {
 					RT_TRACE(COMP_ERR, "CPUcheck_firmware_ready fail(%d)!\n",rt_status);
 					goto download_firmware_fail;
 				}
@@ -478,9 +478,9 @@ bool init_firmware(struct net_device *dev)
 	RT_TRACE(COMP_FIRMWARE, "Firmware Download Success\n");
 	//assert(pfirmware->firmware_status == FW_STATUS_5_READY, ("Firmware Download Fail\n"));
 
-	return rt_status;	
+	return rt_status;
 
-download_firmware_fail:	
+download_firmware_fail:
 	RT_TRACE(COMP_ERR, "ERR in %s()\n", __FUNCTION__);
 	rt_status = FALSE;
 	return rt_status;
@@ -490,10 +490,10 @@ download_firmware_fail:
 #if 0
 /*
  * Procedure:   (1)  Transform firmware code from little endian to big endian if required.
- *	        (2)  Number of bytes in Firmware downloading should be multiple
- *	   	     of 4 bytes. If length is not multiple of 4 bytes, appending of zeros is required
- *			  
- */	
+ *		(2)  Number of bytes in Firmware downloading should be multiple
+ *		     of 4 bytes. If length is not multiple of 4 bytes, appending of zeros is required
+ *
+ */
 void CmdAppendZeroAndEndianTransform(
 	u1Byte	*pDst,
 	u1Byte	*pSrc,
@@ -528,8 +528,8 @@ void CmdAppendZeroAndEndianTransform(
 		if((i+0) < ulLength)	pDst[i+3] = pSrc[i+0];
 
 	}
-#endif	
-	
+#endif
+
 	//1(2) Append Zero
 	if(  ((*pLength) % 4)  >0)
 	{
@@ -538,12 +538,12 @@ void CmdAppendZeroAndEndianTransform(
 		for(i=0 ; i<ulAppendBytes; i++)
 			pDst[  4*((*pLength)/4)  + i ] = 0x0;
 
-		*pLength += ulAppendBytes;	
+		*pLength += ulAppendBytes;
 	}
 }
 #endif
 
-#if 0	
+#if 0
 RT_STATUS
 CmdSendPacket(
 	PADAPTER				Adapter,
@@ -560,20 +560,20 @@ CmdSendPacket(
 	u2Byte		FragIndex=0, FragBufferIndex=0;
 
 	RT_STATUS	rtStatus = RT_STATUS_SUCCESS;
-	
+
 	CmdInitTCB(Adapter, pTcb, pBuf, BufferLen);
 
-	
+
 	if(CmdCheckFragment(Adapter, pTcb, pBuf))
 		CmdFragmentTCB(Adapter, pTcb);
 	else
 		pTcb->FragLength[0] = (u2Byte)pTcb->BufferList[0].Length;
 
 	QueueID=pTcb->SpecifiedQueueID;
-#if DEV_BUS_TYPE!=USB_INTERFACE	
+#if DEV_BUS_TYPE!=USB_INTERFACE
 	firstDesc=curDesc=Adapter->NextTxDescToFill[QueueID];
 #endif
-	
+
 #if DEV_BUS_TYPE!=USB_INTERFACE
 	if(VacancyTxDescNum(Adapter, QueueID) > pTcb->BufferCount)
 #else
@@ -586,9 +586,9 @@ CmdSendPacket(
 		for(i=0 ; i<pTcb->BufferCount ; i++)
 		{
 			Adapter->HalFunc.TxFillCmdDescHandler(
-				Adapter,	
+				Adapter,
 				pTcb,
-				QueueID,							//QueueIndex 
+				QueueID,							//QueueIndex
 				curDesc,							//index
 				FragBufferIndex==0,						//bFirstSeg
 				FragBufferIndex==(pTcb->FragBufCount[FragIndex]-1),		//bLastSeg
@@ -612,8 +612,8 @@ CmdSendPacket(
 				FragIndex++;
 				FragBufferIndex=0;
 			}
-			
-#if DEV_BUS_TYPE!=USB_INTERFACE	
+
+#if DEV_BUS_TYPE!=USB_INTERFACE
 			curDesc=(curDesc+1)%Adapter->NumTxDesc[QueueID];
 #endif
 			pTcb->nDescUsed++;
@@ -625,10 +625,10 @@ CmdSendPacket(
 		Adapter->HalFunc.SetTxDescOWNHandler(Adapter, QueueID, firstDesc);
 		// TODO: should call poll use QueueID
 		Adapter->HalFunc.TxPollingHandler(Adapter, TXCMD_QUEUE);
-#endif		
+#endif
 	}
 	else
-#if DEV_BUS_TYPE!=USB_INTERFACE	
+#if DEV_BUS_TYPE!=USB_INTERFACE
 		goto CmdSendPacket_Fail;
 #else
 	{
@@ -639,12 +639,12 @@ CmdSendPacket(
 
 	return rtStatus;
 
-#if DEV_BUS_TYPE!=USB_INTERFACE	
-CmdSendPacket_Fail:	
+#if DEV_BUS_TYPE!=USB_INTERFACE
+CmdSendPacket_Fail:
 	rtStatus = RT_STATUS_FAILURE;
 	return rtStatus;
-#endif	
-	
+#endif
+
 }
 #endif
 
@@ -664,9 +664,9 @@ FWSendNullPacket(
 	PRT_TCB					pTcb;
 	PRT_TX_LOCAL_BUFFER 	pBuf;
 	BOOLEAN					bLastInitPacket = FALSE;
-	
+
 	PlatformAcquireSpinLock(Adapter, RT_TX_SPINLOCK);
-	
+
 #if DEV_BUS_TYPE==USB_INTERFACE
 	Length += USB_HWDESC_HEADER_LEN;
 #endif
@@ -685,12 +685,12 @@ FWSendNullPacket(
 	}else
 		goto CmdSendNullPacket_Fail;
 
-	PlatformReleaseSpinLock(Adapter, RT_TX_SPINLOCK);	
+	PlatformReleaseSpinLock(Adapter, RT_TX_SPINLOCK);
 	return rtStatus;
 
-	
-CmdSendNullPacket_Fail:	
-	PlatformReleaseSpinLock(Adapter, RT_TX_SPINLOCK);	
+
+CmdSendNullPacket_Fail:
+	PlatformReleaseSpinLock(Adapter, RT_TX_SPINLOCK);
 	rtStatus = RT_STATUS_FAILURE;
 	RT_ASSERT(rtStatus == RT_STATUS_SUCCESS, ("CmdSendDownloadCode fail !!\n"));
 	return rtStatus;
diff --git a/drivers/staging/rtl8192u/r819xU_firmware.h b/drivers/staging/rtl8192u/r819xU_firmware.h
index 4c3e686..5e56108 100644
--- a/drivers/staging/rtl8192u/r819xU_firmware.h
+++ b/drivers/staging/rtl8192u/r819xU_firmware.h
@@ -1,14 +1,14 @@
 #ifndef __INC_FIRMWARE_H
 #define __INC_FIRMWARE_H
 
-#define RTL8190_CPU_START_OFFSET	0x80		
+#define RTL8190_CPU_START_OFFSET	0x80
 /* TODO: this definition is TBD */
 //#define USB_HWDESC_HEADER_LEN	0
 
 /* It should be double word alignment */
 //#if DEV_BUS_TYPE==PCI_INTERFACE
 //#define GET_COMMAND_PACKET_FRAG_THRESHOLD(v)	4*(v/4) - 8
-//#else 
+//#else
 #define GET_COMMAND_PACKET_FRAG_THRESHOLD(v)	(4*(v/4) - 8 - USB_HWDESC_HEADER_LEN)
 //#endif
 
@@ -47,7 +47,7 @@ FWSendDownloadCode(
 	IN	pu1Byte			CodeVirtualAddrress,
 	IN	u4Byte			BufferLen
 	);
-	
+
 RT_STATUS
 FWSendNullPacket(
 	IN	PADAPTER		Adapter,
diff --git a/drivers/staging/rtl8192u/r819xU_phy.c b/drivers/staging/rtl8192u/r819xU_phy.c
index a6a1aa6..d3fe8a6 100644
--- a/drivers/staging/rtl8192u/r819xU_phy.c
+++ b/drivers/staging/rtl8192u/r819xU_phy.c
@@ -94,7 +94,7 @@ void rtl8192_setBBreg(struct net_device* dev, u32 dwRegAddr, u32 dwBitMask, u32
 	{//if not "double word" write
 		OriginalValue = read_nic_dword(dev, dwRegAddr);
 		BitShift = rtl8192_CalculateBitShift(dwBitMask);
-            	NewValue = (((OriginalValue) & (~dwBitMask)) | (dwData << BitShift));
+		NewValue = (((OriginalValue) & (~dwBitMask)) | (dwData << BitShift));
 		write_nic_dword(dev, dwRegAddr, NewValue);	
 	}else
 		write_nic_dword(dev, dwRegAddr, dwData);	
@@ -265,7 +265,7 @@ void rtl8192_phy_RFSerialWrite(struct net_device* dev, RF90_RADIO_PATH_E eRFPath
 		priv->RfReg0Value[eRFPath] = Data;
 
 	// Switch back to Reg_Mode0;
- 	if(priv->rf_chip == RF_8256)
+	if(priv->rf_chip == RF_8256)
 	{
 		if(Offset != 0)
 		{
@@ -320,13 +320,13 @@ void rtl8192_phy_SetRFReg(struct net_device* dev, RF90_RADIO_PATH_E eRFPath, u32
 	else
 	{
 		if (BitMask != bMask12Bits) // RF data is 12 bits only
-   	        {
+		{
 			Original_Value = rtl8192_phy_RFSerialRead(dev, eRFPath, RegAddr);
-      			BitShift =  rtl8192_CalculateBitShift(BitMask);
-      			New_Value = (((Original_Value) & (~BitMask)) | (Data<< BitShift));
+			BitShift =  rtl8192_CalculateBitShift(BitMask);
+			New_Value = (((Original_Value) & (~BitMask)) | (Data<< BitShift));
 
 			rtl8192_phy_RFSerialWrite(dev, eRFPath, RegAddr, New_Value);
-	        }else
+		}else
 			rtl8192_phy_RFSerialWrite(dev, eRFPath, RegAddr, Data);
 	}
 	return;
@@ -360,8 +360,8 @@ u32 rtl8192_phy_QueryRFReg(struct net_device* dev, RF90_RADIO_PATH_E eRFPath, u3
 	else
 	{
 		Original_Value = rtl8192_phy_RFSerialRead(dev, eRFPath, RegAddr);
-   		BitShift =  rtl8192_CalculateBitShift(BitMask);
-   		Readback_Value = (Original_Value & BitMask) >> BitShift;
+		BitShift =  rtl8192_CalculateBitShift(BitMask);
+		Readback_Value = (Original_Value & BitMask) >> BitShift;
 		return (Readback_Value);
 	}
 }	
@@ -800,7 +800,7 @@ void rtl8192_BB_Config_ParaFile(struct net_device* dev)
 	dwRegValue = read_nic_dword(dev, CPU_GEN);
 	write_nic_dword(dev, CPU_GEN, (dwRegValue|CPU_GEN_BB_RST));
 
- 	/*----BB AGC table Initialization----*/
+	/*----BB AGC table Initialization----*/
 	//==m==>Set PHY REG From Header<==m==
 	rtl8192_phyConfigBB(dev, BaseBand_Config_AGC_TAB);
 
@@ -1563,7 +1563,7 @@ void rtl8192_SetBWModeWorkItem(struct net_device *dev)
 			   
 		case HT_CHANNEL_WIDTH_20_40:
 			regBwOpMode &= ~BW_OPMODE_20MHZ;
-        		// 2007/02/07 Mark by Emily becasue we have not verify whether this register works
+			// 2007/02/07 Mark by Emily becasue we have not verify whether this register works
 			write_nic_byte(dev, BW_OPMODE, regBwOpMode);
 			break;
 
@@ -1615,7 +1615,7 @@ void rtl8192_SetBWModeWorkItem(struct net_device *dev)
 			rtl8192_setBBreg(dev, rFPGA0_RFMOD, bRFMOD, 0x1);
 			rtl8192_setBBreg(dev, rFPGA1_RFMOD, bRFMOD, 0x1);
 			rtl8192_setBBreg(dev, rCCK0_System, bCCKSideBand, (priv->nCur40MhzPrimeSC>>1));
-                   	rtl8192_setBBreg(dev, rFPGA0_AnalogParameter1, 0x00100000, 0);
+			rtl8192_setBBreg(dev, rFPGA0_AnalogParameter1, 0x00100000, 0);
 			rtl8192_setBBreg(dev, rOFDM1_LSTF, 0xC00, priv->nCur40MhzPrimeSC);
 #if 0
 			// Correct the tx power for CCK rate in 40M. Suggest by YN, 20071207
diff --git a/drivers/staging/rtl8192u/r819xU_phyreg.h b/drivers/staging/rtl8192u/r819xU_phyreg.h
index c5b63a7..b5961bf 100644
--- a/drivers/staging/rtl8192u/r819xU_phyreg.h
+++ b/drivers/staging/rtl8192u/r819xU_phyreg.h
@@ -204,7 +204,7 @@
 #define rZebra1_AGC                   		0x4
 #define rZebra1_ChargePump            	0x5
 #define rZebra1_Channel               		0x7
-#define rZebra1_TxGain               	 	0x8
+#define rZebra1_TxGain               		0x8
 #define rZebra1_TxLPF                 		0x9
 #define rZebra1_RxLPF                 		0xb
 #define rZebra1_RxHPFCorner           	0xc
@@ -360,7 +360,7 @@
 #define bAFEWatchDogEnable        		0x20000000
 #define bXtalCap                			0x0f000000
 #define bIntDifClkEnable          		0x400
-#define bExtSigClkEnable         	 	0x800
+#define bExtSigClkEnable         		0x800
 #define bBandgapMbiasPowerUp      	0x10000
 #define bAD11SHGain               		0xc0000
 #define bAD11InputRange           		0x700000
@@ -401,8 +401,8 @@
 #define bOFDMTxOn                 		0x2
 #define bDebugPage                		0xfff  //reset debug page and also HWord, LWord
 #define bDebugItem                		0xff   //reset debug page and LWord
-#define bAntL              	       		0x10
-#define bAntNonHT           	      			0x100
+#define bAntL              			0x10
+#define bAntNonHT           				0x100
 #define bAntHT1               			0x1000
 #define bAntHT2                   			0x10000
 #define bAntHT1S1                 			0x100000
@@ -414,26 +414,26 @@
 #define bCCKRxPowerSaving         		0x40
 #define bCCKSideBand              		0x10
 #define bCCKScramble              		0x8
-#define bCCKAntDiversity    		      	0x8000
-#define bCCKCarrierRecovery   	    	0x4000
-#define bCCKTxRate           		     	0x3000
-#define bCCKDCCancel             	 	0x0800
+#define bCCKAntDiversity    			0x8000
+#define bCCKCarrierRecovery   		0x4000
+#define bCCKTxRate           			0x3000
+#define bCCKDCCancel             		0x0800
 #define bCCKISICancel             		0x0400
 #define bCCKMatchFilter           		0x0200
 #define bCCKEqualizer             		0x0100
-#define bCCKPreambleDetect       	 	0x800000
+#define bCCKPreambleDetect       		0x800000
 #define bCCKFastFalseCCA          		0x400000
 #define bCCKChEstStart            		0x300000
 #define bCCKCCACount              		0x080000
 #define bCCKcs_lim                			0x070000
 #define bCCKBistMode              		0x80000000
-#define bCCKCCAMask             	  	0x40000000
-#define bCCKTxDACPhase         	   	0x4
-#define bCCKRxADCPhase         	   	0x20000000   //r_rx_clk
-#define bCCKr_cp_mode0         	   	0x0100
-#define bCCKTxDCOffset           	 	0xf0
-#define bCCKRxDCOffset           	 	0xf
-#define bCCKCCAMode              	 	0xc000
+#define bCCKCCAMask             		0x40000000
+#define bCCKTxDACPhase         		0x4
+#define bCCKRxADCPhase         		0x20000000   //r_rx_clk
+#define bCCKr_cp_mode0         		0x0100
+#define bCCKTxDCOffset           		0xf0
+#define bCCKRxDCOffset           		0xf
+#define bCCKCCAMode              		0xc000
 #define bCCKFalseCS_lim           		0x3f00
 #define bCCKCS_ratio              		0xc00000
 #define bCCKCorgBit_sel           		0x300000
@@ -444,18 +444,18 @@
 #define bCCKLNAPolarity           		0x800000
 #define bCCKRx1stGain             		0x7f0000
 #define bCCKRFExtend              		0x20000000 //CCK Rx Iinital gain polarity
-#define bCCKRxAGCSatLevel        	 	0x1f000000
-#define bCCKRxAGCSatCount       	  	0xe0
+#define bCCKRxAGCSatLevel        		0x1f000000
+#define bCCKRxAGCSatCount       		0xe0
 #define bCCKRxRFSettle            		0x1f       //AGCsamp_dly
-#define bCCKFixedRxAGC           	 	0x8000
-//#define bCCKRxAGCFormat         	 	0x4000   //remove to HSSI register 0x824
-#define bCCKAntennaPolarity      	 	0x2000
+#define bCCKFixedRxAGC           		0x8000
+//#define bCCKRxAGCFormat         		0x4000   //remove to HSSI register 0x824
+#define bCCKAntennaPolarity      		0x2000
 #define bCCKTxFilterType          		0x0c00
-#define bCCKRxAGCReportType   	   	0x0300
+#define bCCKRxAGCReportType   		0x0300
 #define bCCKRxDAGCEn              		0x80000000
-#define bCCKRxDAGCPeriod        	  	0x20000000
-#define bCCKRxDAGCSatLevel     	   	0x1f000000
-#define bCCKTimingRecovery       	 	0x800000
+#define bCCKRxDAGCPeriod        		0x20000000
+#define bCCKRxDAGCSatLevel     		0x1f000000
+#define bCCKTimingRecovery       		0x800000
 #define bCCKTxC0                  			0x3f0000
 #define bCCKTxC1                  			0x3f000000
 #define bCCKTxC2                  			0x3



Cheers,
Mauro



More information about the devel mailing list