public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 01/18] Staging: rtl8187se: remove ENABLE_DOT11D ifdefs
@ 2009-06-28 14:18 Bartlomiej Zolnierkiewicz
  2009-06-28 14:18 ` [PATCH 02/18] Staging: rtl8187se: remove CONFIG_RTL8180_PM ifdefs Bartlomiej Zolnierkiewicz
                   ` (16 more replies)
  0 siblings, 17 replies; 18+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-06-28 14:18 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Bartlomiej Zolnierkiewicz, linux-kernel

From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] Staging: rtl8187se: remove ENABLE_DOT11D ifdefs

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
on top of http://patchwork.kernel.org/patch/30083/

 drivers/staging/rtl8187se/Makefile                      |    3 
 drivers/staging/rtl8187se/ieee80211/dot11d.c            |    2 
 drivers/staging/rtl8187se/ieee80211/ieee80211.h         |   10 --
 drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c      |   12 ---
 drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c |   62 ----------------
 drivers/staging/rtl8187se/r8180_core.c                  |   20 -----
 drivers/staging/rtl8187se/r8180_rtl8225z2.c             |    6 -
 drivers/staging/rtl8187se/r8180_wx.c                    |   14 ---
 drivers/staging/rtl8187se/r8185b_init.c                 |    4 -
 9 files changed, 133 deletions(-)

Index: b/drivers/staging/rtl8187se/Makefile
===================================================================
--- a/drivers/staging/rtl8187se/Makefile
+++ b/drivers/staging/rtl8187se/Makefile
@@ -17,9 +17,6 @@ EXTRA_CFLAGS += -DSW_DIG
 EXTRA_CFLAGS += -DRATE_ADAPT
 EXTRA_CFLAGS += -DCONFIG_RTL8180_PM
 
-#+YJ,080626
-EXTRA_CFLAGS += -DENABLE_DOT11D
-
 #enable it for legacy power save, disable it for leisure  power save
 EXTRA_CFLAGS += -DENABLE_LPS
 
Index: b/drivers/staging/rtl8187se/ieee80211/dot11d.c
===================================================================
--- a/drivers/staging/rtl8187se/ieee80211/dot11d.c
+++ b/drivers/staging/rtl8187se/ieee80211/dot11d.c
@@ -1,4 +1,3 @@
-#ifdef ENABLE_DOT11D
 //-----------------------------------------------------------------------------
 //	File:
 //		Dot11d.c
@@ -233,4 +232,3 @@ EXPORT_SYMBOL(DOT11D_ScanComplete);
 EXPORT_SYMBOL(IsLegalChannel);
 EXPORT_SYMBOL(ToLegalChannel);
 #endif
-#endif
Index: b/drivers/staging/rtl8187se/ieee80211/ieee80211.h
===================================================================
--- a/drivers/staging/rtl8187se/ieee80211/ieee80211.h
+++ b/drivers/staging/rtl8187se/ieee80211/ieee80211.h
@@ -694,7 +694,6 @@ struct ieee80211_header_data {
 #define MFIE_TYPE_RATES_EX   50
 #define MFIE_TYPE_GENERIC    221
 
-#ifdef ENABLE_DOT11D
 typedef enum
 {
 	COUNTRY_CODE_FCC = 0,
@@ -709,7 +708,6 @@ typedef enum
 	COUNTRY_CODE_GLOBAL_DOMAIN = 9,
 	COUNTRY_CODE_WORLD_WIDE_13_INDEX = 10
 }country_code_type_t;
-#endif
 
 struct ieee80211_info_element_hdr {
 	u8 id;
@@ -961,10 +959,8 @@ struct ieee80211_network {
 #ifdef THOMAS_TURBO
 	u8 Turbo_Enable;//enable turbo mode, added by thomas
 #endif
-#ifdef ENABLE_DOT11D
 	u16 CountryIeLen;
 	u8 CountryIeBuf[MAX_IE_LEN];
-#endif
 };
 
 enum ieee80211_state {
@@ -1105,18 +1101,12 @@ struct ieee80211_device {
 	 */
 	short sync_scan_hurryup;
 
-#ifdef ENABLE_DOT11D
 	void * pDot11dInfo;
 	bool bGlobalDomain;
 
 	// For Liteon Ch12~13 passive scan
 	u8	MinPassiveChnlNum;
 	u8	IbssStartChnl;
-#else
-	/* map of allowed channels. 0 is dummy */
-	// FIXME: remeber to default to a basic channel plan depending of the PHY type
-	int channel_map[MAX_CHANNEL_NUMBER+1];
-#endif
 
 	int rate;       /* current rate */
 	int basic_rate;
Index: b/drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c
===================================================================
--- a/drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c
+++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c
@@ -44,9 +44,7 @@
 #include <linux/ctype.h>
 
 #include "ieee80211.h"
-#ifdef ENABLE_DOT11D
 #include "dot11d.h"
-#endif
 static inline void ieee80211_monitor_rx(struct ieee80211_device *ieee,
 					struct sk_buff *skb,
 					struct ieee80211_rx_stats *rx_stats)
@@ -1072,7 +1070,6 @@ static inline int ieee80211_SignalStreng
 	return RetSS;
 }
 
-#ifdef ENABLE_DOT11D
 static inline void ieee80211_extract_country_ie(
 	struct ieee80211_device *ieee,
 	struct ieee80211_info_element *info_element,
@@ -1114,7 +1111,6 @@ static inline void ieee80211_extract_cou
 	}
 
 }
-#endif
 
 int
 ieee80211_TranslateToDbm(
@@ -1166,10 +1162,8 @@ inline int ieee80211_network_init(
 #ifdef THOMAS_TURBO
 	network->Turbo_Enable = 0;
 #endif
-#ifdef ENABLE_DOT11D
 	network->CountryIeLen = 0;
 	memset(network->CountryIeBuf, 0, MAX_IE_LEN);
-#endif
 
 	if (stats->freq == IEEE80211_52GHZ_BAND) {
 		/* for A band (No DS info) */
@@ -1394,14 +1388,12 @@ inline int ieee80211_network_init(
 			memcpy(network->rsn_ie, info_element,
 			       network->rsn_ie_len);
 			break;
-#ifdef ENABLE_DOT11D
 		case MFIE_TYPE_COUNTRY:
 			IEEE80211_DEBUG_SCAN("MFIE_TYPE_COUNTRY: %d bytes\n",
 					     info_element->len);
 //			printk("=====>Receive <%s> Country IE\n",network->ssid);
 			ieee80211_extract_country_ie(ieee, info_element, network, beacon->header.addr2);
 			break;
-#endif
 		default:
 			IEEE80211_DEBUG_SCAN("unsupported IE %d\n",
 					     info_element->id);
@@ -1552,10 +1544,8 @@ inline void update_network(struct ieee80
 #ifdef THOMAS_TURBO
 	dst->Turbo_Enable = src->Turbo_Enable;
 #endif
-#ifdef ENABLE_DOT11D
 	dst->CountryIeLen = src->CountryIeLen;
 	memcpy(dst->CountryIeBuf, src->CountryIeBuf, src->CountryIeLen);
-#endif
 }
 
 
@@ -1623,7 +1613,6 @@ inline void ieee80211_process_probe_resp
 		return;
 	}
 
-#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.
@@ -1677,7 +1666,6 @@ inline void ieee80211_process_probe_resp
 			}
 		}
 	}
-#endif
 	/* The network parsed correctly -- so now we scan our known networks
 	 * to see if we can find it in our list.
 	 *
Index: b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c
===================================================================
--- a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c
+++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c
@@ -21,9 +21,7 @@
 #include <linux/version.h>
 #include <asm/uaccess.h>
 
-#ifdef ENABLE_DOT11D
 #include "dot11d.h"
-#endif
 u8 rsn_authen_cipher_suite[16][4] = {
 	{0x00,0x0F,0xAC,0x00}, //Use group key, //Reserved
 	{0x00,0x0F,0xAC,0x01}, //WEP-40         //RSNA default
@@ -443,10 +441,8 @@ void ieee80211_send_probe_requests(struc
 void ieee80211_softmac_scan_syncro(struct ieee80211_device *ieee)
 {
 	short ch = 0;
-#ifdef ENABLE_DOT11D
 	u8 channel_map[MAX_CHANNEL_NUMBER+1];
 	memcpy(channel_map, GET_DOT11D_INFO(ieee)->channel_map, MAX_CHANNEL_NUMBER+1);
-#endif
 	down(&ieee->scan_sem);
 //	printk("==================> Sync scan\n");
 
@@ -458,11 +454,7 @@ void ieee80211_softmac_scan_syncro(struc
 			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
@@ -487,9 +479,7 @@ void ieee80211_softmac_scan_syncro(struc
 
 		ieee->set_chan(ieee->dev, ch);
 //		printk("=====>channel=%d   ",ch);
-#ifdef ENABLE_DOT11D
 		if(channel_map[ch] == 1)
-#endif
 		{
 //			printk("====send probe request\n");
 			ieee80211_send_probe_requests(ieee);
@@ -507,20 +497,16 @@ void ieee80211_softmac_scan_syncro(struc
 out:
 	ieee->sync_scan_hurryup = 0;
 	up(&ieee->scan_sem);
-#ifdef ENABLE_DOT11D
 	if(IS_DOT11D_ENABLE(ieee))
 		DOT11D_ScanComplete(ieee);
-#endif
 }
 
 void ieee80211_softmac_ips_scan_syncro(struct ieee80211_device *ieee)
 {
 	int ch;
         unsigned int watch_dog = 0;
-#ifdef ENABLE_DOT11D
 	u8 channel_map[MAX_CHANNEL_NUMBER+1];
 	memcpy(channel_map, GET_DOT11D_INFO(ieee)->channel_map, MAX_CHANNEL_NUMBER+1);
-#endif
         down(&ieee->scan_sem);
 	ch = ieee->current_network.channel;
 //      	if(ieee->sync_scan_hurryup)
@@ -554,16 +540,12 @@ void ieee80211_softmac_ips_scan_syncro(s
 		{
 			goto out;
 		}
-#ifdef ENABLE_DOT11D
 		if(channel_map[ieee->current_network.channel] > 0)
-#endif
 		{
 			ieee->set_chan(ieee->dev, ieee->current_network.channel);
 //			printk("======>channel=%d  ",ieee->current_network.channel);
 		}
-#ifdef ENABLE_DOT11D
 		if(channel_map[ieee->current_network.channel] == 1)
-#endif
 		{
 //			printk("====send probe request\n");
 			ieee80211_send_probe_requests(ieee);
@@ -582,11 +564,7 @@ void ieee80211_softmac_ips_scan_syncro(s
 				goto out; /* scan completed */
 
 			ieee->current_network.channel = (ieee->current_network.channel + 1)%MAX_CHANNEL_NUMBER;
-#ifdef ENABLE_DOT11D
 		}while(!channel_map[ieee->current_network.channel]);
-#else
-		}while(!ieee->channel_map[ieee->current_network.channel]);
-#endif
         }
 out:
 	//ieee->sync_scan_hurryup = 0;
@@ -594,10 +572,8 @@ out:
    	//ieee->current_network.channel = ch;
 	ieee->actscanning = false;
 	up(&ieee->scan_sem);
-#ifdef ENABLE_DOT11D
 	if(IS_DOT11D_ENABLE(ieee))
 		DOT11D_ScanComplete(ieee);
-#endif
 }
 
 
@@ -625,10 +601,8 @@ void ieee80211_softmac_scan_wq(struct wo
 	struct delayed_work *dwork = to_delayed_work(work);
 	struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, softmac_scan_wq);
 	static short watchdog = 0;
-#ifdef ENABLE_DOT11D
 	u8 channel_map[MAX_CHANNEL_NUMBER+1];
 	memcpy(channel_map, GET_DOT11D_INFO(ieee)->channel_map, MAX_CHANNEL_NUMBER+1);
-#endif
 //	printk("ieee80211_softmac_scan_wq ENABLE_IPS\n");
 //	printk("in %s\n",__func__);
 	down(&ieee->scan_sem);
@@ -639,11 +613,7 @@ void ieee80211_softmac_scan_wq(struct wo
 		if (watchdog++ > MAX_CHANNEL_NUMBER)
 				goto out; /* no good chans */
 
-#ifdef ENABLE_DOT11D
  	}while(!channel_map[ieee->current_network.channel]);
-#else
- 	}while(!ieee->channel_map[ieee->current_network.channel]);
-#endif
 
 	//printk("current_network.channel:%d\n", ieee->current_network.channel);
 	if (ieee->scanning == 0 )
@@ -652,9 +622,7 @@ void ieee80211_softmac_scan_wq(struct wo
 		goto out;
 	}
 	ieee->set_chan(ieee->dev, ieee->current_network.channel);
-#ifdef ENABLE_DOT11D
 	if(channel_map[ieee->current_network.channel] == 1)
-#endif
 		ieee80211_send_probe_requests(ieee);
 
 	queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, IEEE80211_SOFTMAC_SCAN_TIME);
@@ -666,10 +634,8 @@ out:
 	ieee->scanning = 0;
 	up(&ieee->scan_sem);
 
-#ifdef ENABLE_DOT11D
 	if(IS_DOT11D_ENABLE(ieee))
 		DOT11D_ScanComplete(ieee);
-#endif
 	return;
 }
 #else
@@ -678,10 +644,8 @@ void ieee80211_softmac_scan_wq(struct wo
 	struct delayed_work *dwork = to_delayed_work(work);
         struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, softmac_scan_wq);
         short watchdog = 0;
-#ifdef ENABLE_DOT11D
 	u8 channel_map[MAX_CHANNEL_NUMBER+1];
 	memcpy(channel_map, GET_DOT11D_INFO(ieee)->channel_map, MAX_CHANNEL_NUMBER+1);
-#endif
 //      printk("enter scan wq,watchdog is %d\n",watchdog);
         down(&ieee->scan_sem);
 
@@ -691,11 +655,7 @@ void ieee80211_softmac_scan_wq(struct wo
                 if (watchdog++ > MAX_CHANNEL_NUMBER)
                                 goto out; /* no good chans */
 
-#ifdef ENABLE_DOT11D
         }while(!channel_map[ieee->current_network.channel]);
-#else
-        }while(!ieee->channel_map[ieee->current_network.channel]);
-#endif
 
 //      printk("current_network.channel:%d\n", ieee->current_network.channel);
         if (ieee->scanning == 0 )
@@ -704,18 +664,14 @@ void ieee80211_softmac_scan_wq(struct wo
                 goto out;
         }
         ieee->set_chan(ieee->dev, ieee->current_network.channel);
-#ifdef ENABLE_DOT11D
 	if(channel_map[ieee->current_network.channel] == 1)
-#endif
 		ieee80211_send_probe_requests(ieee);
 
 	queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, IEEE80211_SOFTMAC_SCAN_TIME);
 out:
 	up(&ieee->scan_sem);
-#ifdef ENABLE_DOT11D
 	if(IS_DOT11D_ENABLE(ieee))
 		DOT11D_ScanComplete(ieee);
-#endif
 }
 
 #endif
@@ -794,7 +750,6 @@ void ieee80211_stop_scan(struct ieee8021
 /* called with ieee->lock held */
 void ieee80211_start_scan(struct ieee80211_device *ieee)
 {
-#ifdef ENABLE_DOT11D
 	if(IS_DOT11D_ENABLE(ieee) )
 	{
 		if(IS_COUNTRY_IE_VALID(ieee))
@@ -802,7 +757,6 @@ void ieee80211_start_scan(struct ieee802
 			RESET_CIE_WATCHDOG(ieee);
 		}
 	}
-#endif
 	if (ieee->softmac_features & IEEE_SOFTMAC_SCAN){
 		if (ieee->scanning == 0)
 		{
@@ -822,7 +776,6 @@ void ieee80211_start_scan(struct ieee802
 /* called with wx_sem held */
 void ieee80211_start_scan_syncro(struct ieee80211_device *ieee)
 {
-#ifdef ENABLE_DOT11D
 	if(IS_DOT11D_ENABLE(ieee) )
 	{
 		if(IS_COUNTRY_IE_VALID(ieee))
@@ -830,7 +783,6 @@ void ieee80211_start_scan_syncro(struct 
 			RESET_CIE_WATCHDOG(ieee);
 		}
 	}
-#endif
 	ieee->sync_scan_hurryup = 0;
 
 	if (ieee->softmac_features & IEEE_SOFTMAC_SCAN)
@@ -2534,10 +2486,8 @@ void ieee80211_start_ibss_wq(struct work
 	/* check if we have this cell in our network list */
 	ieee80211_softmac_check_all_nets(ieee);
 
-#ifdef ENABLE_DOT11D
 	if(ieee->state == IEEE80211_NOLINK)
 		ieee->current_network.channel = 10;
-#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
@@ -2626,7 +2576,6 @@ inline void ieee80211_start_ibss(struct 
 void ieee80211_start_bss(struct ieee80211_device *ieee)
 {
 	unsigned long flags;
-#ifdef ENABLE_DOT11D
 	//
 	// Ref: 802.11d 11.1.3.3
 	// STA shall not start a BSS unless properly formed Beacon frame including a Country IE.
@@ -2638,7 +2587,6 @@ void ieee80211_start_bss(struct ieee8021
 			return;
 		}
 	}
-#endif
 	/* check if we have already found the net we
 	 * are interested in (if any).
 	 * if not (we are disassociated and we are not
@@ -2677,10 +2625,8 @@ void ieee80211_disassociate(struct ieee8
 	if (ieee->data_hard_stop)
 			ieee->data_hard_stop(ieee->dev);
 
-#ifdef ENABLE_DOT11D
 	if(IS_DOT11D_ENABLE(ieee))
 		Dot11d_Reset(ieee);
-#endif
 	ieee->state = IEEE80211_NOLINK;
 	ieee->link_change(ieee->dev);
 	notify_wx_assoc_event(ieee);
@@ -2822,11 +2768,7 @@ void ieee80211_start_protocol(struct iee
 			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
 
 		ieee->current_network.channel = ch;
 	}
@@ -2954,9 +2896,7 @@ void ieee80211_softmac_init(struct ieee8
 	tasklet_init(&ieee->ps_task,
 	     (void(*)(unsigned long)) ieee80211_sta_ps,
 	     (unsigned long)ieee);
-#ifdef ENABLE_DOT11D
 	ieee->pDot11dInfo = kmalloc(sizeof(RT_DOT11D_INFO), GFP_ATOMIC);
-#endif
 }
 
 void ieee80211_softmac_free(struct ieee80211_device *ieee)
@@ -2971,10 +2911,8 @@ void ieee80211_softmac_free(struct ieee8
 	cancel_delayed_work(&ieee->GPIOChangeRFWorkItem);
 
 	destroy_workqueue(ieee->wq);
-#ifdef ENABLE_DOT11D
 	if(NULL != ieee->pDot11dInfo)
 		kfree(ieee->pDot11dInfo);
-#endif
 	up(&ieee->wx_sem);
 }
 
Index: b/drivers/staging/rtl8187se/r8180_core.c
===================================================================
--- a/drivers/staging/rtl8187se/r8180_core.c
+++ b/drivers/staging/rtl8187se/r8180_core.c
@@ -78,9 +78,7 @@ double __extendsfdf2(float a) {return a;
 #include "r8180_pm.h"
 #endif
 
-#ifdef ENABLE_DOT11D
 #include "ieee80211/dot11d.h"
-#endif
 
 #ifdef CONFIG_RTL8185B
 //#define CONFIG_RTL8180_IO_MAP
@@ -3899,7 +3897,6 @@ void watch_dog_adaptive(unsigned long da
 //        DMESG("<----watch_dog_adaptive()\n");
 }
 
-#ifdef ENABLE_DOT11D
 
 static CHANNEL_LIST ChannelPlan[] = {
 	{{1,2,3,4,5,6,7,8,9,10,11,36,40,44,48,52,56,60,64},19},  		//FCC
@@ -3975,7 +3972,6 @@ static void rtl8180_set_channel_map(u8 c
 		}
 	}
 }
-#endif
 
 //Add for RF power on power off by lizhaoming 080512
 void GPIOChangeRFWorkItemCallBack(struct work_struct *work);
@@ -4003,7 +3999,6 @@ short rtl8180_init(struct net_device *de
 	u16 tmpu16;
 	int i, j;
 
-#ifdef ENABLE_DOT11D
 #if 0
 	for(i=0;i<0xFF;i++) {
 		if(i%16 == 0)
@@ -4020,21 +4015,6 @@ short rtl8180_init(struct net_device *de
 
 	DMESG("Channel plan is %d\n",priv->channel_plan);
 	rtl8180_set_channel_map(priv->channel_plan, priv->ieee80211);
-#else
-	int ch;
-	//Set Default Channel Plan
-	if(!channels){
-		DMESG("No channels, aborting");
-		return -1;
-	}
-	ch=channels;
-	priv->channel_plan = 0;//hikaru
-	 // set channels 1..14 allowed in given locale
-	for (i=1; i<=14; i++) {
-		(priv->ieee80211->channel_map)[i] = (u8)(ch & 0x01);
-		ch >>= 1;
-	}
-#endif
 
 	//memcpy(priv->stats,0,sizeof(struct Stats));
 
Index: b/drivers/staging/rtl8187se/r8180_rtl8225z2.c
===================================================================
--- a/drivers/staging/rtl8187se/r8180_rtl8225z2.c
+++ b/drivers/staging/rtl8187se/r8180_rtl8225z2.c
@@ -14,9 +14,7 @@
 #include "r8180_rtl8225.h"
 #include "r8180_93cx6.h"
 
-#ifdef ENABLE_DOT11D
 #include "ieee80211/dot11d.h"
-#endif
 
 #ifdef CONFIG_RTL8185B
 
@@ -431,7 +429,6 @@ void rtl8225z2_rf_close(struct net_devic
 	rtl8185_set_anaparam2(dev, RTL8225z2_ANAPARAM2_OFF);
 }
 
-#ifdef ENABLE_DOT11D
 //
 //	Description:
 //		Map dBm into Tx power index according to
@@ -502,7 +499,6 @@ DbmToTxPwrIdx(
 
 	return TxPwrIdx;
 }
-#endif
 
 void rtl8225z2_SetTXPowerLevel(struct net_device *dev, short ch)
 {
@@ -554,7 +550,6 @@ void rtl8225z2_SetTXPowerLevel(struct ne
 			CckTxPwrIdx, OfdmTxPwrIdx);
 	}
 #endif
-#ifdef ENABLE_DOT11D
 	if(IS_DOT11D_ENABLE(priv->ieee80211) &&
 		IS_DOT11D_STATE_DONE(priv->ieee80211) )
 	{
@@ -576,7 +571,6 @@ void rtl8225z2_SetTXPowerLevel(struct ne
 
 	//priv->CurrentCckTxPwrIdx = cck_power_level;
 	//priv->CurrentOfdmTxPwrIdx = ofdm_power_level;
-#endif
 
 	max_cck_power_level = 15;
 	max_ofdm_power_level = 25; //  12 -> 25
Index: b/drivers/staging/rtl8187se/r8180_wx.c
===================================================================
--- a/drivers/staging/rtl8187se/r8180_wx.c
+++ b/drivers/staging/rtl8187se/r8180_wx.c
@@ -22,9 +22,7 @@
 #include "r8180_hw.h"
 #include "r8180_sa2400.h"
 
-#ifdef ENABLE_DOT11D
 #include "ieee80211/dot11d.h"
-#endif
 
 //#define RATE_COUNT 4
 u32 rtl8180_rates[] = {1000000,2000000,5500000,11000000,
@@ -313,11 +311,7 @@ static int rtl8180_wx_get_range(struct n
 	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].m = ieee80211_wlan_frequencies[i] * 100000;
 			range->freq[val].e = 1;
@@ -1189,20 +1183,12 @@ static int r8180_wx_set_channelplan(stru
 		// Clear old channel map
 		for (i=1;i<=MAX_CHANNEL_NUMBER;i++)
 		{
-#ifdef ENABLE_DOT11D
 			GET_DOT11D_INFO(priv->ieee80211)->channel_map[i] = 0;
-#else
-			priv->ieee80211->channel_map[i] = 0;
-#endif
 		}
 		// Set new channel map
 		for (i=1;i<=DefaultChannelPlan[*val].Len;i++)
 		{
-#ifdef ENABLE_DOT11D
 			GET_DOT11D_INFO(priv->ieee80211)->channel_map[DefaultChannelPlan[*val].Channel[i-1]] = 1;
-#else
-			priv->ieee80211->channel_map[DefaultChannelPlan[*val].Channel[i-1]] = 1;
-#endif
 		}
 	}
 	up(&priv->wx_sem);
Index: b/drivers/staging/rtl8187se/r8185b_init.c
===================================================================
--- a/drivers/staging/rtl8187se/r8185b_init.c
+++ b/drivers/staging/rtl8187se/r8185b_init.c
@@ -34,9 +34,7 @@ Notes:
 #include "r8180_pm.h"
 #endif
 
-#ifdef ENABLE_DOT11D
 #include "ieee80211/dot11d.h"
-#endif
 
 #ifdef CONFIG_RTL8185B
 
@@ -2576,10 +2574,8 @@ MgntDisconnect(
 
 	// Indication of disassociation event.
 	//DrvIFIndicateDisassociation(Adapter, asRsn);
-#ifdef ENABLE_DOT11D
 	if(IS_DOT11D_ENABLE(priv->ieee80211))
 		Dot11d_Reset(priv->ieee80211);
-#endif
 	// In adhoc mode, update beacon frame.
 	if( priv->ieee80211->state == IEEE80211_LINKED )
 	{

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 02/18] Staging: rtl8187se: remove CONFIG_RTL8180_PM ifdefs
  2009-06-28 14:18 [PATCH 01/18] Staging: rtl8187se: remove ENABLE_DOT11D ifdefs Bartlomiej Zolnierkiewicz
@ 2009-06-28 14:18 ` Bartlomiej Zolnierkiewicz
  2009-06-28 14:18 ` [PATCH 03/18] Staging: rtl8187se: remove THOMAS_TURBO ifdefs Bartlomiej Zolnierkiewicz
                   ` (15 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-06-28 14:18 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Bartlomiej Zolnierkiewicz, linux-kernel

From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] Staging: rtl8187se: remove CONFIG_RTL8180_PM ifdefs

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/staging/rtl8187se/Makefile      |    1 -
 drivers/staging/rtl8187se/r8180_core.c  |    7 -------
 drivers/staging/rtl8187se/r8180_pm.c    |    2 --
 drivers/staging/rtl8187se/r8180_pm.h    |    2 --
 drivers/staging/rtl8187se/r8185b_init.c |    2 --
 5 files changed, 14 deletions(-)

Index: b/drivers/staging/rtl8187se/Makefile
===================================================================
--- a/drivers/staging/rtl8187se/Makefile
+++ b/drivers/staging/rtl8187se/Makefile
@@ -15,7 +15,6 @@ EXTRA_CFLAGS += -DTX_TRACK
 EXTRA_CFLAGS += -DHIGH_POWER
 EXTRA_CFLAGS += -DSW_DIG
 EXTRA_CFLAGS += -DRATE_ADAPT
-EXTRA_CFLAGS += -DCONFIG_RTL8180_PM
 
 #enable it for legacy power save, disable it for leisure  power save
 EXTRA_CFLAGS += -DENABLE_LPS
Index: b/drivers/staging/rtl8187se/r8180_core.c
===================================================================
--- a/drivers/staging/rtl8187se/r8180_core.c
+++ b/drivers/staging/rtl8187se/r8180_core.c
@@ -74,9 +74,7 @@ double __extendsfdf2(float a) {return a;
 #include "r8180_wx.h"
 #include "r8180_dm.h"
 
-#ifdef CONFIG_RTL8180_PM
 #include "r8180_pm.h"
-#endif
 
 #include "ieee80211/dot11d.h"
 
@@ -199,13 +197,8 @@ static struct pci_driver rtl8180_pci_dri
 	.id_table	= rtl8180_pci_id_tbl,	          /* PCI_ID table  */
 	.probe		= rtl8180_pci_probe,	          /* probe fn      */
 	.remove		= __devexit_p(rtl8180_pci_remove),/* remove fn     */
-#ifdef CONFIG_RTL8180_PM
 	.suspend	= rtl8180_suspend,	          /* PM suspend fn */
 	.resume		= rtl8180_resume,                 /* PM resume fn  */
-#else
-	.suspend	= NULL,			          /* PM suspend fn */
-	.resume      	= NULL,			          /* PM resume fn  */
-#endif
 	.shutdown	= rtl8180_shutdown,
 };
 
Index: b/drivers/staging/rtl8187se/r8180_pm.c
===================================================================
--- a/drivers/staging/rtl8187se/r8180_pm.c
+++ b/drivers/staging/rtl8187se/r8180_pm.c
@@ -9,7 +9,6 @@
    Released under the terms of GPL (General Public Licence)
 */
 
-#ifdef CONFIG_RTL8180_PM
 
 
 #include "r8180_hw.h"
@@ -89,4 +88,3 @@ int rtl8180_enable_wake (struct pci_dev 
 
 
 
-#endif //CONFIG_RTL8180_PM
Index: b/drivers/staging/rtl8187se/r8180_pm.h
===================================================================
--- a/drivers/staging/rtl8187se/r8180_pm.h
+++ b/drivers/staging/rtl8187se/r8180_pm.h
@@ -10,7 +10,6 @@
 
 */
 
-#ifdef CONFIG_RTL8180_PM
 
 #ifndef R8180_PM_H
 #define R8180_PM_H
@@ -25,4 +24,3 @@ int rtl8180_enable_wake (struct pci_dev 
 
 #endif //R8180_PM_H
 
-#endif // CONFIG_RTL8180_PM
Index: b/drivers/staging/rtl8187se/r8185b_init.c
===================================================================
--- a/drivers/staging/rtl8187se/r8185b_init.c
+++ b/drivers/staging/rtl8187se/r8185b_init.c
@@ -30,9 +30,7 @@ Notes:
 #include "r8180_93cx6.h"   /* Card EEPROM */
 #include "r8180_wx.h"
 
-#ifdef CONFIG_RTL8180_PM
 #include "r8180_pm.h"
-#endif
 
 #include "ieee80211/dot11d.h"
 

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 03/18] Staging: rtl8187se: remove THOMAS_TURBO ifdefs
  2009-06-28 14:18 [PATCH 01/18] Staging: rtl8187se: remove ENABLE_DOT11D ifdefs Bartlomiej Zolnierkiewicz
  2009-06-28 14:18 ` [PATCH 02/18] Staging: rtl8187se: remove CONFIG_RTL8180_PM ifdefs Bartlomiej Zolnierkiewicz
@ 2009-06-28 14:18 ` Bartlomiej Zolnierkiewicz
  2009-06-28 14:19 ` [PATCH 04/18] Staging: rtl8187se: remove CONFIG_RTL818x_S ifdefs Bartlomiej Zolnierkiewicz
                   ` (14 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-06-28 14:18 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Bartlomiej Zolnierkiewicz, linux-kernel

From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] Staging: rtl8187se: remove THOMAS_TURBO ifdefs

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/staging/rtl8187se/Makefile                      |    1 -
 drivers/staging/rtl8187se/ieee80211/ieee80211.h         |    2 --
 drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c      |    6 ------
 drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c |   15 ---------------
 drivers/staging/rtl8187se/r8185b_init.c                 |    2 --
 5 files changed, 26 deletions(-)

Index: b/drivers/staging/rtl8187se/Makefile
===================================================================
--- a/drivers/staging/rtl8187se/Makefile
+++ b/drivers/staging/rtl8187se/Makefile
@@ -4,7 +4,6 @@
 #EXTRA_CFLAGS += -std=gnu89
 #EXTRA_CFLAGS += -O2
 #CC            = gcc
-EXTRA_CFLAGS += -DTHOMAS_TURBO
 #CFLAGS += -DCONFIG_RTL8185B
 #CFLAGS += -DCONFIG_RTL818x_S
 
Index: b/drivers/staging/rtl8187se/ieee80211/ieee80211.h
===================================================================
--- a/drivers/staging/rtl8187se/ieee80211/ieee80211.h
+++ b/drivers/staging/rtl8187se/ieee80211/ieee80211.h
@@ -956,9 +956,7 @@ struct ieee80211_network {
 //by amy 080312
 	u8 HighestOperaRate;
 //by amy 080312
-#ifdef THOMAS_TURBO
 	u8 Turbo_Enable;//enable turbo mode, added by thomas
-#endif
 	u16 CountryIeLen;
 	u8 CountryIeBuf[MAX_IE_LEN];
 };
Index: b/drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c
===================================================================
--- a/drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c
+++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c
@@ -1159,9 +1159,7 @@ inline int ieee80211_network_init(
 //by amy 080312
 	network->HighestOperaRate = 0;
 //by amy 080312
-#ifdef THOMAS_TURBO
 	network->Turbo_Enable = 0;
-#endif
 	network->CountryIeLen = 0;
 	memset(network->CountryIeBuf, 0, MAX_IE_LEN);
 
@@ -1338,7 +1336,6 @@ inline int ieee80211_network_init(
 				       network->wpa_ie_len);
 			}
 
-#ifdef THOMAS_TURBO
 			if (info_element->len == 7 &&
 			    info_element->data[0] == 0x00 &&
 			    info_element->data[1] == 0xe0 &&
@@ -1347,7 +1344,6 @@ inline int ieee80211_network_init(
 			    info_element->data[4] == 0x02) {
 				network->Turbo_Enable = 1;
 			}
-#endif
 			if (1 == stats->nic_type) {//nic 87
 				break;
 			}
@@ -1541,9 +1537,7 @@ inline void update_network(struct ieee80
 	dst->QoS_Enable = 1;//for Rtl8187 simulation
 #endif
 	dst->SignalStrength = src->SignalStrength;
-#ifdef THOMAS_TURBO
 	dst->Turbo_Enable = src->Turbo_Enable;
-#endif
 	dst->CountryIeLen = src->CountryIeLen;
 	memcpy(dst->CountryIeBuf, src->CountryIeBuf, src->CountryIeLen);
 }
Index: b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c
===================================================================
--- a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c
+++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c
@@ -127,7 +127,6 @@ void ieee80211_WMM_Info(struct ieee80211
 	*tag_p = tag;
 }
 
-#ifdef THOMAS_TURBO
 void ieee80211_TURBO_Info(struct ieee80211_device *ieee, u8 **tag_p) {
 	u8 *tag = *tag_p;
 
@@ -144,7 +143,6 @@ void ieee80211_TURBO_Info(struct ieee802
 	*tag_p = tag;
 	printk(KERN_ALERT "This is enable turbo mode IE process\n");
 }
-#endif
 
 void enqueue_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb)
 {
@@ -1108,9 +1106,7 @@ inline struct sk_buff *ieee80211_associa
 #endif
 	unsigned int rate_len = ieee80211_MFIE_rate_len(ieee);
 	unsigned int wmm_info_len = beacon->QoS_Enable?9:0;
-#ifdef THOMAS_TURBO
 	unsigned int turbo_info_len = beacon->Turbo_Enable?9:0;
-#endif
 
 	u8  encry_proto = ieee->wpax_type_notify & 0xff;
 	//u8  pairwise_type = (ieee->wpax_type_notify >> 8) & 0xff;
@@ -1128,7 +1124,6 @@ inline struct sk_buff *ieee80211_associa
 			wpa_len = 0;
 		}
 	}
-#ifdef THOMAS_TURBO
 	len = sizeof(struct ieee80211_assoc_request_frame)+
 		+ beacon->ssid_len//essid tagged val
 		+ rate_len//rates tagged val
@@ -1136,14 +1131,6 @@ inline struct sk_buff *ieee80211_associa
 		+ rsn_len
 		+ wmm_info_len
 		+ turbo_info_len;
-#else
-	len = sizeof(struct ieee80211_assoc_request_frame)+
-		+ beacon->ssid_len//essid tagged val
-		+ rate_len//rates tagged val
-		+ wpa_len
-		+ rsn_len
-		+ wmm_info_len;
-#endif
 
 	skb = dev_alloc_skb(len);
 
@@ -1389,12 +1376,10 @@ inline struct sk_buff *ieee80211_associa
 	if(wmm_info_len) {
 	  ieee80211_WMM_Info(ieee, &tag);
 	}
-#ifdef THOMAS_TURBO
 	tag = skb_put(skb,turbo_info_len);
         if(turbo_info_len) {
                 ieee80211_TURBO_Info(ieee, &tag);
         }
-#endif
 
 	return skb;
 }
Index: b/drivers/staging/rtl8187se/r8185b_init.c
===================================================================
--- a/drivers/staging/rtl8187se/r8185b_init.c
+++ b/drivers/staging/rtl8187se/r8185b_init.c
@@ -2227,11 +2227,9 @@ ActUpdateChannelAccessSetting(
 
 		//lzm reserved 080826
 #if 1
-#ifdef THOMAS_TURBO
 		// For turbo mode setting. port from 87B by Isaiah 2008-08-01
 		if( ieee->current_network.Turbo_Enable == 1 )
 			AcParam.f.TXOPLimit = 0x01FF;
-#endif
 		// For 87SE with Intel 4965  Ad-Hoc mode have poor throughput (19MB)
 		if (ieee->iw_mode == IW_MODE_ADHOC)
 			AcParam.f.TXOPLimit = 0x0020;

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 04/18] Staging: rtl8187se: remove CONFIG_RTL818x_S ifdefs
  2009-06-28 14:18 [PATCH 01/18] Staging: rtl8187se: remove ENABLE_DOT11D ifdefs Bartlomiej Zolnierkiewicz
  2009-06-28 14:18 ` [PATCH 02/18] Staging: rtl8187se: remove CONFIG_RTL8180_PM ifdefs Bartlomiej Zolnierkiewicz
  2009-06-28 14:18 ` [PATCH 03/18] Staging: rtl8187se: remove THOMAS_TURBO ifdefs Bartlomiej Zolnierkiewicz
@ 2009-06-28 14:19 ` Bartlomiej Zolnierkiewicz
  2009-06-28 14:19 ` [PATCH 05/18] Staging: rtl8187se: remove CONFIG_RTL8185B ifdefs Bartlomiej Zolnierkiewicz
                   ` (13 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-06-28 14:19 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Bartlomiej Zolnierkiewicz, linux-kernel

From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] Staging: rtl8187se: remove CONFIG_RTL818x_S ifdefs

CONFIG_RTL818x_S is defined in drivers/staging/rtl8187se/r8180_hw.h.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/staging/rtl8187se/Makefile          |    1 
 drivers/staging/rtl8187se/r8180_core.c      |   40 -----
 drivers/staging/rtl8187se/r8180_dm.c        |   24 ---
 drivers/staging/rtl8187se/r8180_hw.h        |   18 --
 drivers/staging/rtl8187se/r8180_rtl8225.c   |   21 ---
 drivers/staging/rtl8187se/r8180_rtl8225z2.c |   41 -----
 drivers/staging/rtl8187se/r8185b_init.c     |  192 ----------------------------
 7 files changed, 337 deletions(-)

Index: b/drivers/staging/rtl8187se/Makefile
===================================================================
--- a/drivers/staging/rtl8187se/Makefile
+++ b/drivers/staging/rtl8187se/Makefile
@@ -5,7 +5,6 @@
 #EXTRA_CFLAGS += -O2
 #CC            = gcc
 #CFLAGS += -DCONFIG_RTL8185B
-#CFLAGS += -DCONFIG_RTL818x_S
 
 #added for EeePC testing
 EXTRA_CFLAGS += -DENABLE_IPS
Index: b/drivers/staging/rtl8187se/r8180_core.c
===================================================================
--- a/drivers/staging/rtl8187se/r8180_core.c
+++ b/drivers/staging/rtl8187se/r8180_core.c
@@ -2479,10 +2479,8 @@ void rtl8180_rx(struct net_device *dev)
 		}else {
 			padding = 0;
 		}
-#ifdef CONFIG_RTL818X_S
                padding = 0;
 #endif
-#endif
 		priv->rx_prevlen+=len;
 
 		if(priv->rx_prevlen > MAX_FRAG_THRESHOLD + 100){
@@ -3862,14 +3860,12 @@ void watch_dog_adaptive(unsigned long da
 	}
 #endif
 
-#ifdef CONFIG_RTL818X_S
 	// Tx Power Tracking on 87SE.
 #ifdef TX_TRACK
 	//if( priv->bTxPowerTrack )	//lzm mod 080826
 	if( CheckTxPwrTracking((struct net_device *)data));
 		TxPwrTracking87SE((struct net_device *)data);
 #endif
-#endif
 
 	// Perform DIG immediately.
 #ifdef SW_DIG
@@ -4024,11 +4020,7 @@ short rtl8180_init(struct net_device *de
 	 */
 
 #ifdef CONFIG_RTL8185B
-#ifdef CONFIG_RTL818X_S
 	priv->RegThreeWireMode = HW_THREE_WIRE_SI;
-#else
-        priv->RegThreeWireMode = SW_THREE_WIRE;
-#endif
 #endif
 
 //Add for RF power on power off by lizhaoming 080512
@@ -4269,10 +4261,6 @@ short rtl8180_init(struct net_device *de
 									(0 ? TCR_SAT : 0);	// FALSE: HW provies PLCP length and LENGEXT, TURE: SW proiveds them
 
 	priv->ReceiveConfig	=
-#ifdef CONFIG_RTL818X_S
-#else
-                                                        priv->CSMethod |
-#endif
 //								RCR_ENMARP |
 								RCR_AMF | RCR_ADF |				//accept management/data
 								RCR_ACF |						//accept control frame for SW AP needs PS-poll, 2005.07.07, by rcnjko.
@@ -4300,17 +4288,10 @@ short rtl8180_init(struct net_device *de
 	switch (hw_version){
 #ifdef CONFIG_RTL8185B
 		case HW_VERID_R8185B_B:
-#ifdef CONFIG_RTL818X_S
                         priv->card_8185 = VERSION_8187S_C;
 		        DMESG("MAC controller is a RTL8187SE b/g");
 			priv->phy_ver = 2;
 			break;
-#else
-			DMESG("MAC controller is a RTL8185B b/g");
-			priv->card_8185 = 3;
-			priv->phy_ver = 2;
-			break;
-#endif
 #endif
 		case HW_VERID_R8185_ABC:
 			DMESG("MAC controller is a RTL8185 b/g");
@@ -4350,24 +4331,9 @@ short rtl8180_init(struct net_device *de
 	priv->card_8185_Bversion = 0;
 
 #ifdef CONFIG_RTL8185B
-#ifdef CONFIG_RTL818X_S
 	// just for sync 85
 	priv->card_type = PCI;
         DMESG("This is a PCI NIC");
-#else
-	config3 = read_nic_byte(dev, CONFIG3);
-	if(config3 & 0x8){
-		priv->card_type = CARDBUS;
-		DMESG("This is a CARDBUS NIC");
-	}
-	else if( config3 & 0x4){
-		priv->card_type = MINIPCI;
-		DMESG("This is a MINI-PCI NIC");
-	}else{
-		priv->card_type = PCI;
-		DMESG("This is a PCI NIC");
-	}
-#endif
 #endif
 	priv->enable_gpio0 = 0;
 
@@ -4375,7 +4341,6 @@ short rtl8180_init(struct net_device *de
 #ifdef CONFIG_RTL8185B
 	usValue = eprom_read(dev, EEPROM_SW_REVD_OFFSET);
 	DMESG("usValue is 0x%x\n",usValue);
-#ifdef CONFIG_RTL818X_S
 	//3Read AntennaDiversity
 	// SW Antenna Diversity.
 	if(	(usValue & EEPROM_SW_AD_MASK) != EEPROM_SW_AD_ENABLE )
@@ -4427,7 +4392,6 @@ short rtl8180_init(struct net_device *de
 	}
 	//printk("bDefaultAntenna1 = %d\n", priv->bDefaultAntenna1);
 #endif
-#endif
 //by amy for antenna
 	/* rtl8185 can calc plcp len in HW.*/
 	priv->hw_plcp_len = 1;
@@ -4537,13 +4501,9 @@ DMESG output to andreamrl@tiscali.it THA
 	}
 
 #ifdef CONFIG_RTL8185B
-#ifdef CONFIG_RTL818X_S
 	priv->rf_chip = RF_ZEBRA4;
 	priv->rf_sleep = rtl8225z4_rf_sleep;
 	priv->rf_wakeup = rtl8225z4_rf_wakeup;
-#else
-        priv->rf_chip = RF_ZEBRA2;
-#endif
 	//DMESG("Card reports RF frontend Realtek 8225z2");
 	//DMESGW("This driver has EXPERIMENTAL support for this chipset.");
 	//DMESGW("use it with care and at your own risk and");
Index: b/drivers/staging/rtl8187se/r8180_dm.c
===================================================================
--- a/drivers/staging/rtl8187se/r8180_dm.c
+++ b/drivers/staging/rtl8187se/r8180_dm.c
@@ -517,7 +517,6 @@ MgntIsCckRate(
 
         return bReturn;
 }
-#ifdef CONFIG_RTL818X_S
 //
 //	Description:
 //		Tx Power tracking mechanism routine on 87SE.
@@ -1233,7 +1232,6 @@ SetInitialGain:
 	priv->LastTxThroughput = TxThroughput;
 	priv->ieee80211->rate = priv->CurrentOperaRate * 5;
 }
-#endif
 
 void rtl8180_rate_adapter(struct work_struct * work)
 {
@@ -1259,10 +1257,8 @@ void timer_rate_adaptive(unsigned long d
 			(priv->ForcedDataRate == 0) )
 	{
 //	DMESG("timer_rate_adaptive():schedule rate_adapter_wq\n");
-#ifdef CONFIG_RTL818X_S
 		queue_work(priv->ieee80211->wq, (void *)&priv->ieee80211->rate_adapter_wq);
 //		StaRateAdaptive87SE((struct net_device *)data);
-#endif
 	}
 	priv->rateadapter_timer.expires = jiffies + MSECS(priv->RateAdaptivePeriod);
 	add_timer(&priv->rateadapter_timer);
@@ -1320,20 +1316,12 @@ SetAntenna8185(
 		case RF_ZEBRA2:
 		case RF_ZEBRA4:
 #ifdef CONFIG_RTL8185B
-#ifdef CONFIG_RTL818X_S
 			// Mac register, main antenna
 			write_nic_byte(dev, ANTSEL, 0x03);
 			//base band
 			write_phy_cck(dev,0x11, 0x9b); // Config CCK RX antenna.
 			write_phy_ofdm(dev, 0x0d, 0x5c); // Config OFDM RX antenna.
 
-#else
-			// Mac register, main antenna
-			write_nic_byte(dev, ANTSEL, 0x03);
-			//base band
-			write_phy_cck(dev, 0x10, 0x9b); // Config CCK RX antenna.
-			write_phy_ofdm(dev, 0x0d, 0x5c); // Config OFDM RX antenna.
-#endif
 #endif
 
 			bAntennaSwitched = true;
@@ -1351,19 +1339,11 @@ SetAntenna8185(
 		case RF_ZEBRA2:
 		case RF_ZEBRA4:
 #ifdef CONFIG_RTL8185B
-#ifdef CONFIG_RTL818X_S
 			// Mac register, aux antenna
 			write_nic_byte(dev, ANTSEL, 0x00);
 			//base band
 			write_phy_cck(dev, 0x11, 0xbb); // Config CCK RX antenna.
 			write_phy_ofdm(dev, 0x0d, 0x54); // Config OFDM RX antenna.
-#else
-			// Mac register, aux antenna
-			write_nic_byte(dev, ANTSEL, 0x00);
-			//base band
-			write_phy_cck(dev, 0x10, 0xbb); // Config CCK RX antenna.
-			write_phy_ofdm(dev, 0x0d, 0x54); // Config OFDM RX antenna.
-#endif
 #endif
 
 			bAntennaSwitched = true;
@@ -1406,12 +1386,10 @@ SwitchAntenna(
 	{
 #if 0//lzm del 080826
 //by amy 080312
-#ifdef CONFIG_RTL818X_S
 		if(priv->bSwAntennaDiverity)
 			bResult = SetAntennaConfig87SE(dev, 1, true);
 		else
 #endif
-#endif
 			bResult = SetAntenna8185(dev, 1);
 //by amy 080312
 //		printk("SwitchAntenna(): switching to antenna 1 ......\n");
@@ -1421,12 +1399,10 @@ SwitchAntenna(
 	{
 #if 0//lzm del 080826
 //by amy 080312
-#ifdef CONFIG_RTL818X_S
 		if(priv->bSwAntennaDiverity)
 			bResult = SetAntennaConfig87SE(dev, 0, true);
 		else
 #endif
-#endif
 			bResult = SetAntenna8185(dev, 0);
 //by amy 080312
 //		printk("SwitchAntenna(): switching to antenna 0 ......\n");
Index: b/drivers/staging/rtl8187se/r8180_hw.h
===================================================================
--- a/drivers/staging/rtl8187se/r8180_hw.h
+++ b/drivers/staging/rtl8187se/r8180_hw.h
@@ -21,7 +21,6 @@
 #define R8180_HW
 
 #define CONFIG_RTL8185B  //support for rtl8185B, xiong-2006-11-15
-#define CONFIG_RTL818X_S
 
 #define BIT0	0x00000001
 #define BIT1	0x00000002
@@ -300,7 +299,6 @@
 #define CONFIG3 0x0059
 #define CONFIG4 0x005A
 #ifdef CONFIG_RTL8185B
-#ifdef CONFIG_RTL818X_S
 	// SD3 szuyitasi: Mac0x57= CC -> B0 Mac0x60= D1 -> C6
 	// Mac0x60 = 0x000004C6 power save parameters
 	#define ANAPARM_ASIC_ON    0xB0054D00
@@ -308,14 +306,6 @@
 
 	#define ANAPARM_ON ANAPARM_ASIC_ON
 	#define ANAPARM2_ON ANAPARM2_ASIC_ON
-#else
-	// SD3 CMLin:
-	#define ANAPARM_ASIC_ON    0x45090658
-	#define ANAPARM2_ASIC_ON  0x727f3f52
-
-	#define ANAPARM_ON ANAPARM_ASIC_ON
-	#define ANAPARM2_ON ANAPARM2_ASIC_ON
-#endif
 #endif
 
 #define TESTR 0x005B
@@ -453,9 +443,7 @@
 
 /* 0x00DA - 0x00DB - reserved */
 
-#ifdef CONFIG_RTL818X_S
 #define PHYPR			0xDA			//0xDA - 0x0B PHY Parameter Register.
-#endif
 
 #define CWR 0x00DC
 #define CWR_END 0x00DD
@@ -468,9 +456,7 @@
 #define RDSAR_END 0x00E7
 
 /* 0x00E8 - 0x00EF - reserved */
-#ifdef CONFIG_RTL818X_S
 #define LED_CONTROL		0xED
-#endif
 
 #define FER 0x00F0
 #define FER_END 0x00F3
@@ -827,11 +813,9 @@
 #define AC_BE_PARAM		0xF8			// AC_BE Parameters Record
 #define AC_BK_PARAM		0xFC			// AC_BK Parameters Record
 
-#ifdef CONFIG_RTL818X_S
 #define BcnTimingAdjust	0x16A			// Beacon Timing Adjust Register.
 #define GPIOCtrl			0x16B			// GPIO Control Register.
 #define PSByGC			0x180			// 0x180 - 0x183 Power Saving by Gated Clock.
-#endif
 #define ARFR			0x1E0	// Auto Rate Fallback Register (0x1e0 ~ 0x1e2)
 
 #define RFSW_CTRL			0x272	// 0x272-0x273.
@@ -840,10 +824,8 @@
 #define SW_3W_CMD0			0x27C	// Software 3-wire Control/Status Register.
 #define SW_3W_CMD1			0x27D	// Software 3-wire Control/Status Register.
 
-#ifdef CONFIG_RTL818X_S
 #define PI_DATA_READ		0X360	// 0x360 - 0x361  Parallel Interface Data Register.
 #define SI_DATA_READ		0x362	// 0x362 - 0x363  Serial Interface Data Register.
-#endif
 
 //----------------------------------------------------------------------------
 //       8185B TPPoll bits 				(offset 0xd9, 1 byte)
Index: b/drivers/staging/rtl8187se/r8180_rtl8225.c
===================================================================
--- a/drivers/staging/rtl8187se/r8180_rtl8225.c
+++ b/drivers/staging/rtl8187se/r8180_rtl8225.c
@@ -38,7 +38,6 @@ u8 rtl8225_init_gain[]={
 	0x93,0x38,0x5a,0xc5,//0x00,0x31,0x06,0x99,//Gain = 6 ~ -54dbm
 };
 #endif
-#ifdef CONFIG_RTL818X_S
 u32 rtl8225_chan[] ={
               0,
 		0x0080, //ch1
@@ -56,26 +55,6 @@ u32 rtl8225_chan[] ={
 		0x0680,
 		0x074A, //ch14
 };
-#else
-u32 rtl8225_chan[] = {
-	0,	//dummy channel 0
-	0x085c, //1
-	0x08dc, //2
-	0x095c, //3
-	0x09dc, //4
-	0x0a5c, //5
-	0x0adc, //6
-	0x0b5c, //7
-	0x0bdc, //8
-	0x0c5c, //9
-	0x0cdc, //10
-	0x0d5c, //11
-	0x0ddc, //12
-	0x0e5c, //13
-	//0x0f5c, //14
-	0x0f72, // 14
-};
-#endif
 
 u16 rtl8225bcd_rxgain[]={
 	0x0400, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0408, 0x0409,
Index: b/drivers/staging/rtl8187se/r8180_rtl8225z2.c
===================================================================
--- a/drivers/staging/rtl8187se/r8180_rtl8225z2.c
+++ b/drivers/staging/rtl8187se/r8180_rtl8225z2.c
@@ -445,7 +445,6 @@ DbmToTxPwrIdx(
  	bool bUseDefault = true;
 	s8 TxPwrIdx = 0;
 
-#ifdef CONFIG_RTL818X_S
 	//
 	// 071011, SD3 SY:
 	// OFDM Power in dBm = Index * 0.5 + 0
@@ -480,7 +479,6 @@ DbmToTxPwrIdx(
 				TxPwrIdx = (s8)tmp;
 		}
 	}
-#endif
 
 	//
 	// TRUE if we want to use a default implementation.
@@ -577,7 +575,6 @@ void rtl8225z2_SetTXPowerLevel(struct ne
 	min_ofdm_power_level = 10;
 
 #ifdef CONFIG_RTL8185B
-#ifdef CONFIG_RTL818X_S
 
 	if(cck_power_level > 35)
 	{
@@ -590,36 +587,6 @@ void rtl8225z2_SetTXPowerLevel(struct ne
        //printk("CCK TX power is %x\n", (ZEBRA2_CCK_OFDM_GAIN_SETTING[cck_power_level]));
        force_pci_posting(dev);
 	mdelay(1);
-#else
-
-	/* CCK power setting */
-	if(cck_power_level > max_cck_power_level)
-		cck_power_level = max_cck_power_level;
-
-	cck_power_level += priv->cck_txpwr_base;
-
-	if(cck_power_level > 35)
-		cck_power_level = 35;
-
-	if(ch == 14)
-		cck_power_table = rtl8225z2_tx_power_cck_ch14;
-	else
-		cck_power_table = rtl8225z2_tx_power_cck;
-
-
-	for(i=0;i<8;i++){
-
-		power = cck_power_table[i];
-		write_phy_cck(dev, 0x44 + i, power);
-	}
-
-	//write_nic_byte(dev, TX_GAIN_CCK, power);
-	//2005.11.17,
-	write_nic_byte(dev, CCK_TXAGC, ZEBRA2_CCK_OFDM_GAIN_SETTING[(u8)cck_power_level]);
-
-	force_pci_posting(dev);
-	mdelay(1);
-#endif
 #endif
 	/* OFDM power setting */
 //  Old:
@@ -652,11 +619,7 @@ void rtl8225z2_SetTXPowerLevel(struct ne
 
 	//write_nic_byte(dev, TX_GAIN_OFDM, ofdm_power_level);
 	//2005.11.17,
-#ifdef CONFIG_RTL818X_S
         write_nic_byte(dev, OFDM_TXAGC, ZEBRA2_CCK_OFDM_GAIN_SETTING[(u8)ofdm_power_level]);
-#else
-        write_nic_byte(dev, OFDM_TXAGC, ZEBRA2_CCK_OFDM_GAIN_SETTING[(u8)ofdm_power_level]*2);
-#endif
         if(ofdm_power_level<=11)
         {
 //            write_nic_dword(dev,PHY_ADR,0x00005c87);
@@ -1137,11 +1100,7 @@ void rtl8225z2_rf_init(struct net_device
 //	//}
 
 	rtl8225z2_SetTXPowerLevel(dev, channel);
-#ifdef CONFIG_RTL818X_S
         write_phy_cck(dev, 0x11, 0x9b); mdelay(1); /* Rx ant A, 0xdb for B */
-#else
-	write_phy_cck(dev, 0x10, 0x9b); mdelay(1); /* Rx ant A, 0xdb for B */
-#endif
 	write_phy_ofdm(dev, 0x26, 0x90); mdelay(1); /* Rx ant A, 0x10 for B */
 
 	rtl8185_tx_antenna(dev, 0x3); /* TX ant A, 0x0 for B */
Index: b/drivers/staging/rtl8187se/r8185b_init.c
===================================================================
--- a/drivers/staging/rtl8187se/r8185b_init.c
+++ b/drivers/staging/rtl8187se/r8185b_init.c
@@ -39,7 +39,6 @@ Notes:
 //#define CONFIG_RTL8180_IO_MAP
 
 #define TC_3W_POLL_MAX_TRY_CNT 5
-#ifdef CONFIG_RTL818X_S
 static u8 MAC_REG_TABLE[][2]={
                         //PAGA 0:
                         // 0x34(BRSR), 0xBE(RATE_FALLBACK_CTL), 0x1E0(ARFR) would set in HwConfigureRTL8185()
@@ -120,97 +119,6 @@ static u8 OFDM_CONFIG[]={
 			0xC0, 0xC1, 0x58, 0xF1, 0x00, 0xC4, 0x90, 0x3e,
 			0xD8, 0x3C, 0x7B, 0x10, 0x10
 		};
-#else
- static u8 MAC_REG_TABLE[][2]={
-			//PAGA 0:
-			{0xf0, 0x32}, {0xf1, 0x32}, {0xf2, 0x00}, {0xf3, 0x00}, {0xf4, 0x32},
-			{0xf5, 0x43}, {0xf6, 0x00}, {0xf7, 0x00}, {0xf8, 0x46}, {0xf9, 0xa4},
-			{0xfa, 0x00}, {0xfb, 0x00}, {0xfc, 0x96}, {0xfd, 0xa4}, {0xfe, 0x00},
-			{0xff, 0x00},
-
-			//PAGE 1:
-			{0x5e, 0x01},
-			{0x58, 0x4b}, {0x59, 0x00}, {0x5a, 0x4b}, {0x5b, 0x00}, {0x60, 0x4b},
-			{0x61, 0x09}, {0x62, 0x4b}, {0x63, 0x09}, {0xce, 0x0f}, {0xcf, 0x00},
-			{0xe0, 0xff}, {0xe1, 0x0f}, {0xe2, 0x00}, {0xf0, 0x4e}, {0xf1, 0x01},
-			{0xf2, 0x02}, {0xf3, 0x03}, {0xf4, 0x04}, {0xf5, 0x05}, {0xf6, 0x06},
-			{0xf7, 0x07}, {0xf8, 0x08},
-
-
-			//PAGE 2:
-			{0x5e, 0x02},
-			{0x0c, 0x04}, {0x21, 0x61}, {0x22, 0x68}, {0x23, 0x6f}, {0x24, 0x76},
-			{0x25, 0x7d}, {0x26, 0x84}, {0x27, 0x8d}, {0x4d, 0x08}, {0x4e, 0x00},
-			{0x50, 0x05}, {0x51, 0xf5}, {0x52, 0x04}, {0x53, 0xa0}, {0x54, 0x1f},
-			{0x55, 0x23}, {0x56, 0x45}, {0x57, 0x67}, {0x58, 0x08}, {0x59, 0x08},
-			{0x5a, 0x08}, {0x5b, 0x08}, {0x60, 0x08}, {0x61, 0x08}, {0x62, 0x08},
-			{0x63, 0x08}, {0x64, 0xcf}, {0x72, 0x56}, {0x73, 0x9a},
-
-			//PAGA 0:
-			{0x5e, 0x00},
-			{0x34, 0xff}, {0x35, 0x0f}, {0x5b, 0x40}, {0x84, 0x88}, {0x85, 0x24},
-			{0x88, 0x54}, {0x8b, 0xb8}, {0x8c, 0x07}, {0x8d, 0x00}, {0x94, 0x1b},
-			{0x95, 0x12}, {0x96, 0x00}, {0x97, 0x06}, {0x9d, 0x1a}, {0x9f, 0x10},
-			{0xb4, 0x22}, {0xbe, 0x80}, {0xdb, 0x00}, {0xee, 0x00}, {0x5b, 0x42},
-			{0x91, 0x03},
-
-			//PAGE 2:
-			{0x5e, 0x02},
-			{0x4c, 0x03},
-
-			//PAGE 0:
-			{0x5e, 0x00},
-
-			//PAGE 3:
-			{0x5e, 0x03},
-			{0x9f, 0x00},
-
-			//PAGE 0:
-			{0x5e, 0x00},
-			{0x8c, 0x01}, {0x8d, 0x10},{0x8e, 0x08}, {0x8f, 0x00}
-		};
-
-
-static u8  ZEBRA_AGC[]={
-	0,
-	0x5e,0x5e,0x5e,0x5e,0x5d,0x5b,0x59,0x57,0x55,0x53,0x51,0x4f,0x4d,0x4b,0x49,0x47,
-	0x45,0x43,0x41,0x3f,0x3d,0x3b,0x39,0x37,0x35,0x33,0x31,0x2f,0x2d,0x2b,0x29,0x27,
-	0x25,0x23,0x21,0x1f,0x1d,0x1b,0x19,0x17,0x15,0x13,0x11,0x0f,0x0d,0x0b,0x09,0x07,
-	0x05,0x03,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
-	0x19,0x19,0x19,0x019,0x19,0x19,0x19,0x19,0x19,0x19,0x1e,0x1f,0x20,0x21,0x21,0x22,
-	0x23,0x24,0x24,0x25,0x25,0x26,0x26,0x27,0x27,0x28,0x28,0x28,0x29,0x2a,0x2a,0x2b,
-	0x2b,0x2b,0x2c,0x2c,0x2c,0x2d,0x2d,0x2d,0x2e,0x2e,0x2f,0x30,0x31,0x31,0x31,0x31,
-	0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31,0x31
-	};
-
-static u32 ZEBRA_RF_RX_GAIN_TABLE[]={
-	0,
-	0x0400,0x0401,0x0402,0x0403,0x0404,0x0405,0x0408,0x0409,
-	0x040a,0x040b,0x0502,0x0503,0x0504,0x0505,0x0540,0x0541,
-	0x0542,0x0543,0x0544,0x0545,0x0580,0x0581,0x0582,0x0583,
-	0x0584,0x0585,0x0588,0x0589,0x058a,0x058b,0x0643,0x0644,
-	0x0645,0x0680,0x0681,0x0682,0x0683,0x0684,0x0685,0x0688,
-	0x0689,0x068a,0x068b,0x068c,0x0742,0x0743,0x0744,0x0745,
-	0x0780,0x0781,0x0782,0x0783,0x0784,0x0785,0x0788,0x0789,
-	0x078a,0x078b,0x078c,0x078d,0x0790,0x0791,0x0792,0x0793,
-	0x0794,0x0795,0x0798,0x0799,0x079a,0x079b,0x079c,0x079d,
-	0x07a0,0x07a1,0x07a2,0x07a3,0x07a4,0x07a5,0x07a8,0x07a9,
-	0x03aa,0x03ab,0x03ac,0x03ad,0x03b0,0x03b1,0x03b2,0x03b3,
-	0x03b4,0x03b5,0x03b8,0x03b9,0x03ba,0x03bb,0x03bb
-};
-
-// 2006.07.13, SD3 szuyitasi:
-//	OFDM.0x03=0x0C (original is 0x0F)
-// Use the new SD3 given param, by shien chang, 2006.07.14
-static u8 OFDM_CONFIG[]={
-	0x10, 0x0d, 0x01, 0x0C, 0x14, 0xfb, 0x0f, 0x60, 0x00, 0x60,
-	0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x40, 0x00, 0x40, 0x00,
-	0x00, 0x00, 0xa8, 0x46, 0xb2, 0x33, 0x07, 0xa5, 0x6f, 0x55,
-	0xc8, 0xb3, 0x0a, 0xe1, 0x1c, 0x8a, 0xb6, 0x83, 0x34, 0x0f,
-	0x4f, 0x23, 0x6f, 0xc2, 0x6b, 0x40, 0x80, 0x00, 0xc0, 0xc1,
-	0x58, 0xf1, 0x00, 0xe4, 0x90, 0x3e, 0x6d, 0x3c, 0xff, 0x07
-};
-#endif
 
 /*---------------------------------------------------------------
   * Hardware IO
@@ -538,12 +446,10 @@ ZEBRA_RFSerialWrite(
 	u16				UshortBuffer;
 
 	u8			u1bTmp;
-#ifdef CONFIG_RTL818X_S
 	// RTL8187S HSSI Read/Write Function
 	u1bTmp = read_nic_byte(dev, RF_SW_CONFIG);
 	u1bTmp |=   RF_SW_CFG_SI;   //reg08[1]=1 Serial Interface(SI)
 	write_nic_byte(dev, RF_SW_CONFIG, u1bTmp);
-#endif
 	UshortBuffer = read_nic_word(dev, RFPinsOutput);
 	oval = UshortBuffer & 0xfff8; // We shall clear bit0, 1, 2 first, 2005.10.28, by rcnjko.
 
@@ -914,7 +820,6 @@ RF_WriteReg(
 					1);					// bWrite
          		}
 			break;
-  #ifdef CONFIG_RTL818X_S
 			case HW_THREE_WIRE_PI: //Parallel Interface
 			{ // Pure HW 3-wire.
 				data2Write = (data << 4) | (u32)(offset & 0x0f);
@@ -948,7 +853,6 @@ RF_WriteReg(
 //                                 printk(" exit ZEBRA_RFSerialWrite\n ");
 			}
 			break;
-  #endif
 
 
 		default:
@@ -981,13 +885,11 @@ ZEBRA_RFSerialRead(
 	u8			u1bTmp;
 	ThreeWireReg	tdata;
 	//PHAL_DATA_8187	pHalData = GetHalData8187(pAdapter);
-#ifdef CONFIG_RTL818X_S
 	{ // RTL8187S HSSI Read/Write Function
 		u1bTmp = read_nic_byte(dev, RF_SW_CONFIG);
 		u1bTmp |=   RF_SW_CFG_SI;   //reg08[1]=1 Serial Interface(SI)
 		write_nic_byte(dev, RF_SW_CONFIG, u1bTmp);
 	}
-#endif
 
 	wReg80 = oval = read_nic_word(dev, RFPinsOutput);
 	oval2 = read_nic_word(dev, RFPinsEnable);
@@ -1111,7 +1013,6 @@ RF_ReadReg(
 	case RF_ZEBRA4:
 		switch(priv->RegThreeWireMode)
 		{
-#ifdef CONFIG_RTL818X_S
 			case HW_THREE_WIRE_PI: // For 87S  Parallel Interface.
 			{
 				data2Write = ((u32)(offset&0x0f));
@@ -1141,7 +1042,6 @@ RF_ReadReg(
 			}
 			break;
 
-#endif
 			// Perform SW 3-wire programming by driver.
 			default:
 			{
@@ -1200,7 +1100,6 @@ ReadBBPortUchar(
 	return RegisterContent;
 }
 //{by amy 080312
-#ifdef CONFIG_RTL818X_S
 //
 //	Description:
 //		Perform Antenna settings with antenna diversity on 87SE.
@@ -1282,7 +1181,6 @@ SetAntennaConfig87SE(
 	priv->CurrAntennaIndex = DefaultAnt; // Update default settings.
 	return	bAntennaSwitched;
 }
-#endif
 //by amy 080312
 /*---------------------------------------------------------------
   * Hardware Initialization.
@@ -1301,7 +1199,6 @@ ZEBRA_Config_85BASIC_HardCode(
 	u32	u4bRegOffset, u4bRegValue, u4bRF23, u4bRF24;
        u8			u1b24E;
 
-#ifdef CONFIG_RTL818X_S
 
 	//=============================================================================
 	// 87S_PCIE :: RADIOCFG.TXT
@@ -1509,72 +1406,6 @@ ZEBRA_Config_85BASIC_HardCode(
 	write_nic_byte(dev, CCK_TXAGC, 0x10);
 	write_nic_byte(dev, OFDM_TXAGC, 0x1B);
 	write_nic_byte(dev, ANTSEL, 0x03);
-#else
-	//=============================================================================
-	// RADIOCFG.TXT
-	//=============================================================================
-
-	RF_WriteReg(dev, 0x00, 0x00b7);			mdelay(1);
-	RF_WriteReg(dev, 0x01, 0x0ee0);			mdelay(1);
-	RF_WriteReg(dev, 0x02, 0x044d);			mdelay(1);
-	RF_WriteReg(dev, 0x03, 0x0441);			mdelay(1);
-	RF_WriteReg(dev, 0x04, 0x08c3);			mdelay(1);
-	RF_WriteReg(dev, 0x05, 0x0c72);			mdelay(1);
-	RF_WriteReg(dev, 0x06, 0x00e6);			mdelay(1);
-	RF_WriteReg(dev, 0x07, 0x082a);			mdelay(1);
-	RF_WriteReg(dev, 0x08, 0x003f);			mdelay(1);
-	RF_WriteReg(dev, 0x09, 0x0335);			mdelay(1);
-	RF_WriteReg(dev, 0x0a, 0x09d4);			mdelay(1);
-	RF_WriteReg(dev, 0x0b, 0x07bb);			mdelay(1);
-	RF_WriteReg(dev, 0x0c, 0x0850);			mdelay(1);
-	RF_WriteReg(dev, 0x0d, 0x0cdf);			mdelay(1);
-	RF_WriteReg(dev, 0x0e, 0x002b);			mdelay(1);
-	RF_WriteReg(dev, 0x0f, 0x0114);			mdelay(1);
-
-	RF_WriteReg(dev, 0x00, 0x01b7);			mdelay(1);
-
-
-	for(i=1;i<=95;i++)
-	{
-		RF_WriteReg(dev, 0x01, i);	mdelay(1);
-		RF_WriteReg(dev, 0x02, ZEBRA_RF_RX_GAIN_TABLE[i]); mdelay(1);
-		//DbgPrint("RF - 0x%x = 0x%x", i, ZEBRA_RF_RX_GAIN_TABLE[i]);
-	}
-
-	RF_WriteReg(dev, 0x03, 0x0080);			mdelay(1); 	// write reg 18
-	RF_WriteReg(dev, 0x05, 0x0004);			mdelay(1);	// write reg 20
-	RF_WriteReg(dev, 0x00, 0x00b7);			mdelay(1);	// switch to reg0-reg15
-	//0xfd
-	//0xfd
-	//0xfd
-	RF_WriteReg(dev, 0x02, 0x0c4d);			mdelay(1);
-	mdelay(100);	// Deay 100 ms. //0xfe
-	mdelay(100);	// Deay 100 ms. //0xfe
-	RF_WriteReg(dev, 0x02, 0x044d);			mdelay(1);
-	RF_WriteReg(dev, 0x00, 0x02bf);			mdelay(1);	//0x002f disable 6us corner change,  06f--> enable
-
-	//=============================================================================
-
-	//=============================================================================
-	// CCKCONF.TXT
-	//=============================================================================
-
-	//=============================================================================
-
-	//=============================================================================
-	// Follow WMAC RTL8225_Config()
-	//=============================================================================
-
-	// power control
-	write_nic_byte(dev, CCK_TXAGC, 0x03);
-	write_nic_byte(dev, OFDM_TXAGC, 0x07);
-	write_nic_byte(dev, ANTSEL, 0x03);
-
-	//=============================================================================
-
-	// OFDM BBP setup
-//	SetOutputEnableOfRfPins(dev);//by amy
-#endif
 
 
 
@@ -1629,10 +1460,8 @@ ZEBRA_Config_85BASIC_HardCode(
 //by amy for antenna
 	//=============================================================================
 //{by amy 080312
-#ifdef CONFIG_RTL818X_S
 	// Config Sw/Hw  Combinational Antenna Diversity. Added by Roger, 2008.02.26.
 	SetAntennaConfig87SE(dev, priv->bDefaultAntenna1, priv->bSwAntennaDiverity);
-#endif
 //by amy 080312}
 #if 0
 	// Config Sw/Hw  Antenna Diversity
@@ -1857,7 +1686,6 @@ UpdateInitialGain(
 		break;
 	}
 }
-#ifdef CONFIG_RTL818X_S
 //
 //	Description:
 //		Tx Power tracking mechanism routine on 87SE.
@@ -1878,7 +1706,6 @@ InitTxPwrTracking87SE(
 	RF_WriteReg(dev, 0x02, u4bRfReg|PWR_METER_EN);			mdelay(1);
 }
 
-#endif
 void
 PhyConfig8185(
 	struct net_device *dev
@@ -1896,7 +1723,6 @@ PhyConfig8185(
 		break;
 	}
 //{by amy 080312
-#ifdef CONFIG_RTL818X_S
 	// Set default initial gain state to 4, approved by SD3 DZ, by Bruce, 2007-06-06.
 	if(priv->bDigMechanism)
 	{
@@ -1913,7 +1739,6 @@ PhyConfig8185(
 	if(priv->bTxPowerTrack)
 		InitTxPwrTracking87SE(dev);
 
-#endif
 //by amy 080312}
 	priv->InitialGainBackUp= priv->InitialGain;
 	UpdateInitialGain(dev);
@@ -2004,13 +1829,8 @@ HwConfigureRTL8185(
 #if 0
 		PlatformIOWrite2Byte(dev, ARFR, 0x0fff); 	// set 1M ~ 54M
 #endif
-#ifdef CONFIG_RTL818X_S
 	        // Aadded by Roger, 2007.11.15.
 	        PlatformIOWrite2Byte(dev, ARFR, 0x0fff); //set 1M ~ 54Mbps.
-#else
-		PlatformIOWrite2Byte(dev, ARFR, 0x0c00); //set 48Mbps, 54Mbps.
-                // By SD3 szuyi's request. by Roger, 2007.03.26.
-#endif
 //by amy
 	}
 	else
@@ -2083,7 +1903,6 @@ MacConfig_85BASIC(
 #if 0
 	write_nic_dword(dev, RFTiming, 0x00004001);
 #endif
-#ifdef CONFIG_RTL818X_S
 	// power save parameter based on "87SE power save parameters 20071127.doc", as follow.
 
 	//Enable DA10 TX power saving
@@ -2104,9 +1923,6 @@ MacConfig_85BASIC(
 	write_nic_word(dev, 0x37C, 0x00EC);
 //	write_nic_word(dev, 0x37E, 0x00FE);//-edward
 	write_nic_word(dev, 0x37E, 0x00EC);//+edward
-#else
-       write_nic_dword(dev, RFTiming, 0x00004003);
-#endif
        write_nic_byte(dev, 0x24E,0x01);
 //by amy
 
@@ -2973,22 +2789,14 @@ void rtl8185b_adapter_start(struct net_d
 	write_nic_byte(dev, CR9346, 0xc0);	// enable config register write
 //by amy
 	tmpu8 = read_nic_byte(dev, CONFIG3);
-#ifdef CONFIG_RTL818X_S
 	write_nic_byte(dev, CONFIG3, (tmpu8 |CONFIG3_PARM_En) );
-#else
-	write_nic_byte(dev, CONFIG3, (tmpu8 |CONFIG3_PARM_En | CONFIG3_CLKRUN_En) );
-#endif
 //by amy
 	// Turn on Analog power.
 	// Asked for by William, otherwise, MAC 3-wire can't work, 2006.06.27, by rcnjko.
 	write_nic_dword(dev, ANAPARAM2, ANAPARM2_ASIC_ON);
 	write_nic_dword(dev, ANAPARAM, ANAPARM_ASIC_ON);
 //by amy
-#ifdef CONFIG_RTL818X_S
 	write_nic_word(dev, ANAPARAM3, 0x0010);
-#else
-      write_nic_byte(dev, ANAPARAM3, 0x00);
-#endif
 //by amy
 
 	write_nic_byte(dev, CONFIG3, tmpu8);

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 05/18] Staging: rtl8187se: remove CONFIG_RTL8185B ifdefs
  2009-06-28 14:18 [PATCH 01/18] Staging: rtl8187se: remove ENABLE_DOT11D ifdefs Bartlomiej Zolnierkiewicz
                   ` (2 preceding siblings ...)
  2009-06-28 14:19 ` [PATCH 04/18] Staging: rtl8187se: remove CONFIG_RTL818x_S ifdefs Bartlomiej Zolnierkiewicz
@ 2009-06-28 14:19 ` Bartlomiej Zolnierkiewicz
  2009-06-28 14:19 ` [PATCH 06/18] Staging: rtl8187se: remove CONFIG_RTL8180_IO_MAP ifdefs Bartlomiej Zolnierkiewicz
                   ` (12 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-06-28 14:19 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Bartlomiej Zolnierkiewicz, linux-kernel

From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] Staging: rtl8187se: remove CONFIG_RTL8185B ifdefs

CONFIG_RTL8185B is defined in drivers/staging/rtl8187se/r8180_hw.h.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/staging/rtl8187se/Makefile          |    1 
 drivers/staging/rtl8187se/r8180.h           |    4 
 drivers/staging/rtl8187se/r8180_93cx6.h     |    2 
 drivers/staging/rtl8187se/r8180_core.c      |  289 ----------------------------
 drivers/staging/rtl8187se/r8180_dm.c        |    4 
 drivers/staging/rtl8187se/r8180_hw.h        |   61 -----
 drivers/staging/rtl8187se/r8180_rtl8225.h   |    2 
 drivers/staging/rtl8187se/r8180_rtl8225z2.c |    4 
 drivers/staging/rtl8187se/r8185b_init.c     |    2 
 9 files changed, 369 deletions(-)

Index: b/drivers/staging/rtl8187se/Makefile
===================================================================
--- a/drivers/staging/rtl8187se/Makefile
+++ b/drivers/staging/rtl8187se/Makefile
@@ -4,7 +4,6 @@
 #EXTRA_CFLAGS += -std=gnu89
 #EXTRA_CFLAGS += -O2
 #CC            = gcc
-#CFLAGS += -DCONFIG_RTL8185B
 
 #added for EeePC testing
 EXTRA_CFLAGS += -DENABLE_IPS
Index: b/drivers/staging/rtl8187se/r8180.h
===================================================================
--- a/drivers/staging/rtl8187se/r8180.h
+++ b/drivers/staging/rtl8187se/r8180.h
@@ -64,7 +64,6 @@
 #define DEFAULT_RETRY_DATA 7
 #define PRISM_HDR_SIZE 64
 
-#ifdef CONFIG_RTL8185B
 
 #define MGNT_QUEUE						0
 #define BK_QUEUE						1
@@ -199,7 +198,6 @@ typedef	union _ThreeWire{
 	u16			longData;
 }ThreeWireReg;
 
-#endif
 
 typedef struct buffer
 {
@@ -659,7 +657,6 @@ typedef struct r8180_priv
 	short ack_tx_to_ieee;
 
 	u8 PowerProfile;
-#ifdef CONFIG_RTL8185B
 	u32 CSMethod;
 	u8 cck_txpwr_base;
 	u8 ofdm_txpwr_base;
@@ -675,7 +672,6 @@ typedef struct r8180_priv
 	u32 IntrMask;
 
 	struct 	ChnlAccessSetting  ChannelAccessSetting;
-#endif
 }r8180_priv;
 
 #define MANAGE_PRIORITY 0
Index: b/drivers/staging/rtl8187se/r8180_93cx6.h
===================================================================
--- a/drivers/staging/rtl8187se/r8180_93cx6.h
+++ b/drivers/staging/rtl8187se/r8180_93cx6.h
@@ -28,11 +28,9 @@
 #define	RFCHIPID_MAXIM 4
 #define	RFCHIPID_GCT 5
 #define RFCHIPID_RTL8225 9
-#ifdef CONFIG_RTL8185B
 #define RF_ZEBRA2 11
 #define EPROM_TXPW_BASE 0x05
 #define RF_ZEBRA4 12
-#endif
 #define RFCHIPID_RTL8255 0xa
 #define RF_PARAM 0x19
 #define RF_PARAM_DIGPHY_SHIFT 0
Index: b/drivers/staging/rtl8187se/r8180_core.c
===================================================================
--- a/drivers/staging/rtl8187se/r8180_core.c
+++ b/drivers/staging/rtl8187se/r8180_core.c
@@ -78,9 +78,7 @@ double __extendsfdf2(float a) {return a;
 
 #include "ieee80211/dot11d.h"
 
-#ifdef CONFIG_RTL8185B
 //#define CONFIG_RTL8180_IO_MAP
-#endif
 
 #ifndef PCI_VENDOR_ID_BELKIN
 	#define PCI_VENDOR_ID_BELKIN 0x1799
@@ -343,47 +341,7 @@ static int proc_get_stats_hw(char *page,
 	//struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
 
 	int len = 0;
-#ifdef 	CONFIG_RTL8185B
 
-#else
-	len += snprintf(page + len, count - len,
-		"NIC int: %lu\n"
-		"Total int: %lu\n"
-		"--------------------\n"
-		"LP avail desc %d\n"
-		"NP avail desc %d\n"
-		"--------------------\n"
-		"LP phys dma addr %x\n"
-		"LP NIC ptr %x\n"
-		"LP virt 32base %x\n"
-		"LP virt 32tail %x\n"
-		"--------------------\n"
-		"NP phys dma addr %x\n"
-		"NP NIC ptr %x\n"
-		"NP virt 32base %x\n"
-		"NP virt 32tail %x\n"
-		"--------------------\n"
-		"BP phys dma addr %x\n"
-		"BP NIC ptr %x\n"
-		"BP virt 32base %x\n"
-		"BP virt 32tail %x\n",
-		priv->stats.ints,
-		priv->stats.shints,
-		get_curr_tx_free_desc(dev,LOW_PRIORITY),
-		get_curr_tx_free_desc(dev,NORM_PRIORITY),
-		(u32)priv->txvipringdma,
-		read_nic_dword(dev,TLPDA),
-		(u32)priv->txvipring,
-		(u32)priv->txvipringtail,
-		(u32)priv->txvopringdma,
-		read_nic_dword(dev,TNPDA),
-		(u32)priv->txvopring,
-		(u32)priv->txvopringtail,
-		(u32)priv->txbeaconringdma,
-		read_nic_dword(dev,TBDA),
-		(u32)priv->txbeaconring,
-		(u32)priv->txbeaconringtail);
-#endif
 	*eof = 1;
 	return len;
 }
@@ -956,11 +914,7 @@ void check_rxbuf(struct net_device *dev)
 	struct buffer *buf;
 	u8 rx_desc_size;
 
-#ifdef CONFIG_RTL8185B
 	rx_desc_size = 8;
-#else
-	rx_desc_size = 4;
-#endif
 
 	if(!priv->rxbuffer)
 		DMESGE ("NIC RX ack, but RX queue corrupted!");
@@ -1097,11 +1051,7 @@ void fix_rx_fifo(struct net_device *dev)
 	struct buffer *rxbuf;
 	u8 rx_desc_size;
 
-#ifdef CONFIG_RTL8185B
 	rx_desc_size = 8; // 4*8 = 32 bytes
-#else
-	rx_desc_size = 4;
-#endif
 
 #ifdef DEBUG_RXALLOC
 	DMESG("FIXING RX FIFO");
@@ -1301,11 +1251,7 @@ void rtl8180_irq_disable(struct net_devi
 {
 	struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
 
-#ifdef CONFIG_RTL8185B
 	write_nic_dword(dev,IMR,0);
-#else
-	write_nic_word(dev,INTA_MASK,0);
-#endif
 	force_pci_posting(dev);
 	priv->irq_enabled = 0;
 }
@@ -1597,13 +1543,8 @@ void rtl8180_beacon_tx_enable(struct net
 	struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
 
 	rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
-#ifdef CONFIG_RTL8185B
 	priv->dma_poll_stop_mask &= ~(TPPOLLSTOP_BQ);
 	write_nic_byte(dev,TPPollStop, priv->dma_poll_mask);
-#else
-	priv->dma_poll_mask &=~(1<<TX_DMA_STOP_BEACON_SHIFT);
-	write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
-#endif
 	rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
 }
 
@@ -1613,13 +1554,8 @@ void rtl8180_beacon_tx_disable(struct ne
 	struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
 
 	rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
-#ifdef CONFIG_RTL8185B
 	priv->dma_poll_stop_mask |= TPPOLLSTOP_BQ;
 	write_nic_byte(dev,TPPollStop, priv->dma_poll_stop_mask);
-#else
-	priv->dma_poll_mask |= (1<<TX_DMA_STOP_BEACON_SHIFT);
-	write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
-#endif
 	rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
 
 }
@@ -1890,13 +1826,8 @@ void free_rx_desc_ring(struct net_device
 
 	int count = priv->rxringcount;
 
-#ifdef CONFIG_RTL8185B
 	pci_free_consistent(pdev, sizeof(u32)*8*count+256,
 			    priv->rxring, priv->rxringdma);
-#else
-	pci_free_consistent(pdev, sizeof(u32)*4*count+256,
-			    priv->rxring, priv->rxringdma);
-#endif
 
 	buffer_free(dev,&(priv->rxbuffer),priv->rxbuffersize,0);
 }
@@ -1913,11 +1844,7 @@ short alloc_rx_desc_ring(struct net_devi
 	void *buf;
 	u8 rx_desc_size;
 
-#ifdef CONFIG_RTL8185B
 	rx_desc_size = 8; // 4*8 = 32 bytes
-#else
-	rx_desc_size = 4;
-#endif
 
 	if((bufsize & 0xfff) != bufsize){
 		DMESGE ("RX buffer allocation too large");
@@ -2336,14 +2263,9 @@ void rtl8180_rx(struct net_device *dev)
 		.freq = IEEE80211_24GHZ_BAND,
 	};
 
-#ifdef CONFIG_RTL8185B
 	stats.nic_type = NIC_8185B;
 	rx_desc_size = 8;
 
-#else
-	stats.nic_type = NIC_8185;
-	rx_desc_size = 4;
-#endif
 	//printk("receive frame!%d\n",count++);
 	//if (!priv->rxbuffer) DMESG ("EE: NIC RX ack, but RX queue corrupted!");
 	//else {
@@ -2468,7 +2390,6 @@ void rtl8180_rx(struct net_device *dev)
 			len = priv->rxbuffersize;
 		}
 
-#ifdef CONFIG_RTL8185B
 		if(first && last) {
 			padding = ((*(priv->rxringtail+3))&(0x04000000))>>26;
 		}else if(first) {
@@ -2480,7 +2401,6 @@ void rtl8180_rx(struct net_device *dev)
 			padding = 0;
 		}
                padding = 0;
-#endif
 		priv->rx_prevlen+=len;
 
 		if(priv->rx_prevlen > MAX_FRAG_THRESHOLD + 100){
@@ -2504,7 +2424,6 @@ void rtl8180_rx(struct net_device *dev)
 		print_buffer( priv->rxbuffer->buf, len);
 #endif
 
-#ifdef CONFIG_RTL8185B
 		signal=(unsigned char)(((*(priv->rxringtail+3))& (0x00ff0000))>>16);
 		signal=(signal&0xfe)>>1;	// Modify by hikaru 6.6
 
@@ -2515,15 +2434,6 @@ void rtl8180_rx(struct net_device *dev)
 		rxpower =((char)(((*(priv->rxringtail+4))& (0x00ff0000))>>16))/2 - 42;
 		RSSI = ((u8)(((*(priv->rxringtail+3)) & (0x0000ff00))>> 8)) & (0x7f);
 
-#else
-		signal=((*(priv->rxringtail+1))& (0xff0000))>>16;
-		signal=(signal&0xfe)>>1;	// Modify by hikaru 6.6
-
-		quality=((*(priv->rxringtail+1)) & (0xff));
-
-		stats.mac_time[0] = *(priv->rxringtail+2);
-		stats.mac_time[1] = *(priv->rxringtail+3);
-#endif
 		rate=((*(priv->rxringtail)) &
 			((1<<23)|(1<<22)|(1<<21)|(1<<20)))>>20;
 
@@ -2732,17 +2642,13 @@ void rtl8180_rx(struct net_device *dev)
 		DMESG("going to copy current payload %x",len);
 #endif
 		if(!priv->rx_skb_complete) {
-#ifdef CONFIG_RTL8185B
 			if(padding) {
 				memcpy(skb_put(priv->rx_skb,len),
 					(((unsigned char *)priv->rxbuffer->buf) + 2),len);
 			} else {
-#endif
 				memcpy(skb_put(priv->rx_skb,len),
 					priv->rxbuffer->buf,len);
-#ifdef CONFIG_RTL8185B
 			}
-#endif
 		}
 #ifdef DEBUG_RX_SKB
 		DMESG("current fragment skb copy complete");
@@ -2890,13 +2796,8 @@ void rtl8180_data_hard_stop(struct net_d
 	struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
 
 	rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
-#ifdef CONFIG_RTL8185B
 	priv->dma_poll_stop_mask |= TPPOLLSTOP_AC_VIQ;
 	write_nic_byte(dev,TPPollStop, priv->dma_poll_stop_mask);
-#else
-	priv->dma_poll_mask |= (1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
-	write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
-#endif
 	rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
 }
 
@@ -2906,13 +2807,8 @@ void rtl8180_data_hard_resume(struct net
 	struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
 
 	rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
-#ifdef  CONFIG_RTL8185B
 	priv->dma_poll_stop_mask &= ~(TPPOLLSTOP_AC_VIQ);
 	write_nic_byte(dev,TPPollStop, priv->dma_poll_stop_mask);
-#else
-	priv->dma_poll_mask &= ~(1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
-	write_nic_byte(dev,TX_DMA_POLLING,priv->dma_poll_mask);
-#endif
 	rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
 }
 
@@ -2941,11 +2837,7 @@ rate)
 	* the ieee stack, or from the try_wake_queue (again trought
 	* the ieee stack.
 	*/
-#ifdef CONFIG_RTL8185B
 	priority = AC2Q(skb->priority);
-#else
-	priority = LOW_PRIORITY;
-#endif
 	spin_lock_irqsave(&priv->tx_lock,flags);
 
 	if(priv->ieee80211->bHwRadioOff)
@@ -2992,11 +2884,7 @@ int rtl8180_hard_start_xmit(struct sk_bu
 
 	int priority;
 
-#ifdef CONFIG_RTL8185B
 	priority = MANAGE_PRIORITY;
-#else
-	priority = NORM_PRIORITY;
-#endif
 
 	spin_lock_irqsave(&priv->tx_lock,flags);
 
@@ -3145,7 +3033,6 @@ short rtl8180_tx(struct net_device *dev,
 	short ext;
 	struct buffer* buflist;
 	//unsigned long flags;
-#ifdef CONFIG_RTL8185B
 	struct ieee80211_hdr_3addr *frag_hdr = (struct ieee80211_hdr_3addr *)txbuf;
 	u8 dest[ETH_ALEN];
 	u8			bUseShortPreamble = 0;
@@ -3158,7 +3045,6 @@ short rtl8180_tx(struct net_device *dev,
 	u16			ThisFrameTime = 0;
 	u16			TxDescDuration = 0;
 	u8 			ownbit_flag = false; //added by david woo for sync Tx, 2007.12.14
-#endif
 
 	switch(priority) {
 	case MANAGE_PRIORITY:
@@ -3368,7 +3254,6 @@ short rtl8180_tx(struct net_device *dev,
 			if (priv->plcp_preamble_mode==1 && rate!=0)	//  short mode now, not long!
 			//	*tail |= (1<<16);				// enable short preamble mode.
 
-#ifdef CONFIG_RTL8185B
 		if(bCTSEnable) {
 			*tail |= (1<<18);
 		}
@@ -3382,24 +3267,6 @@ short rtl8180_tx(struct net_device *dev,
 		*(tail+3) |= ((TxDescDuration&0xffff)<<16); //DURATION
 //	        *(tail+3) |= (0xe6<<16);
         	*(tail+5) |= (11<<8);//(priv->retry_data<<8); //retry lim ;
-#else
-		//Use RTS or not
-#ifdef CONFIG_RTL8187B
-		if ( (len>priv->rts) && priv->rts && priority!=MANAGE_PRIORITY){
-#else
-		if ( (len>priv->rts) && priv->rts && priority==LOW_PRIORITY){
-#endif
-			*tail |= (1<<23);	//enalbe RTS function
-			*tail |= (0<<19);	//use 1M bps send RTS packet
-			AckCtsTime = ComputeTxTime(14, 10,0, 0);	// AckCTSLng = 14 use 1M bps send
-			FrameTime = ComputeTxTime(len + 4, rtl8180_rate2rate(rate), 0, *tail&(1<<16));
-			// RTS/CTS time is calculate as follow
-			duration = FrameTime + 3*10 + 2*AckCtsTime;	//10us is the SifsTime;
-			*(tail+1) |= duration; 	//Need to edit here!  ----hikaru
-		}else{
-			*(tail+1)= 0; // zeroes the second 32-bits dword of the descriptor
-		}
-#endif
 
 		*tail = *tail | ((rate&0xf) << 24);
 		//DMESG("rate %d",rate);
@@ -3736,10 +3603,6 @@ void rtl8180_wmm_param_update(struct wor
 	PAC_PARAM	pAcParam;
 	u8 i;
 
-#ifndef CONFIG_RTL8185B
-        //for legacy 8185 keep the PARAM unchange.
-	return;
-#else
 	if(!ieee->current_network.QoS_Enable){
 		//legacy ac_xx_param update
 		AcParam.longData = 0;
@@ -3827,7 +3690,6 @@ void rtl8180_wmm_param_update(struct wor
 		}
 		ac_param += (sizeof(AC_PARAM));
 	}
-#endif
 }
 
 void rtl8180_tx_irq_wq(struct work_struct *work);
@@ -4019,9 +3881,7 @@ short rtl8180_init(struct net_device *de
 	 * packet (is empty)
 	 */
 
-#ifdef CONFIG_RTL8185B
 	priv->RegThreeWireMode = HW_THREE_WIRE_SI;
-#endif
 
 //Add for RF power on power off by lizhaoming 080512
 	priv->RFChangeInProgress = false;
@@ -4244,7 +4104,6 @@ short rtl8180_init(struct net_device *de
 	priv->ieee80211->stop_send_beacons = rtl8180_beacon_tx_disable;
 	priv->ieee80211->fts = DEFAULT_FRAG_THRESHOLD;
 
-#ifdef CONFIG_RTL8185B
 	priv->MWIEnable = 0;
 
 	priv->ShortRetryLimit = 7;
@@ -4281,18 +4140,15 @@ short rtl8180_init(struct net_device *de
 								IMR_RQoSOK; // <NOTE> ROK and RQoSOK are mutually exclusive, so, we must handle RQoSOK interrupt to receive QoS frames, 2005.12.09, by rcnjko.
 
 	priv->InitialGain = 6;
-#endif
 
 	hw_version =( read_nic_dword(dev, TCR) & TCR_HWVERID_MASK)>>TCR_HWVERID_SHIFT;
 
 	switch (hw_version){
-#ifdef CONFIG_RTL8185B
 		case HW_VERID_R8185B_B:
                         priv->card_8185 = VERSION_8187S_C;
 		        DMESG("MAC controller is a RTL8187SE b/g");
 			priv->phy_ver = 2;
 			break;
-#endif
 		case HW_VERID_R8185_ABC:
 			DMESG("MAC controller is a RTL8185 b/g");
 			priv->card_8185 = 1;
@@ -4330,15 +4186,12 @@ short rtl8180_init(struct net_device *de
 	/* you should not found any 8185 Ver B Card */
 	priv->card_8185_Bversion = 0;
 
-#ifdef CONFIG_RTL8185B
 	// just for sync 85
 	priv->card_type = PCI;
         DMESG("This is a PCI NIC");
-#endif
 	priv->enable_gpio0 = 0;
 
 //by amy for antenna
-#ifdef CONFIG_RTL8185B
 	usValue = eprom_read(dev, EEPROM_SW_REVD_OFFSET);
 	DMESG("usValue is 0x%x\n",usValue);
 	//3Read AntennaDiversity
@@ -4391,7 +4244,6 @@ short rtl8180_init(struct net_device *de
 		priv->bDefaultAntenna1 = ((priv->RegDefaultAntenna== 2) ? true : false);
 	}
 	//printk("bDefaultAntenna1 = %d\n", priv->bDefaultAntenna1);
-#endif
 //by amy for antenna
 	/* rtl8185 can calc plcp len in HW.*/
 	priv->hw_plcp_len = 1;
@@ -4460,11 +4312,9 @@ short rtl8180_init(struct net_device *de
 			priv->bTxPowerTrack = true;
 
 //by amy 080312}
-#ifdef CONFIG_RTL8185B
 	word = eprom_read(dev,EPROM_TXPW_BASE);
 	priv->cck_txpwr_base = word & 0xf;
 	priv->ofdm_txpwr_base = (word>>4) & 0xf;
-#endif
 
 	version = eprom_read(dev,EPROM_VERSION);
 	DMESG("EEPROM version %x",version);
@@ -4500,7 +4350,6 @@ DMESG output to andreamrl@tiscali.it THA
 		priv->rf_chip = 0xff & eprom_read(dev,RFCHIPID);
 	}
 
-#ifdef CONFIG_RTL8185B
 	priv->rf_chip = RF_ZEBRA4;
 	priv->rf_sleep = rtl8225z4_rf_sleep;
 	priv->rf_wakeup = rtl8225z4_rf_wakeup;
@@ -4516,121 +4365,6 @@ DMESG output to andreamrl@tiscali.it THA
 	//priv->rf_sleep = rtl8225_rf_sleep;
 	//priv->rf_wakeup = rtl8225_rf_wakeup;
 
-#else
-	/* check RF frontend chipset */
-	switch (priv->rf_chip) {
-
-		case RFCHIPID_RTL8225:
-
-		if(priv->card_8185){
-			DMESG("Card reports RF frontend Realtek 8225");
-			DMESGW("This driver has EXPERIMENTAL support for this chipset.");
-			DMESGW("use it with care and at your own risk and");
-			DMESGW("**PLEASE** REPORT SUCCESS/INSUCCESS TO andreamrl@tiscali.it");
-
-			priv->rf_close = rtl8225_rf_close;
-			priv->rf_init = rtl8225_rf_init;
-			priv->rf_set_chan = rtl8225_rf_set_chan;
-			priv->rf_set_sens = NULL;
-			priv->rf_sleep = rtl8225_rf_sleep;
-			priv->rf_wakeup = rtl8225_rf_wakeup;
-
-		}else{
-			DMESGW("Detected RTL8225 radio on a card recognized as RTL8180");
-			DMESGW("This could not be... something went wrong....");
-			return -ENODEV;
-		}
-			break;
-
-		case RFCHIPID_RTL8255:
-		if(priv->card_8185){
-			DMESG("Card reports RF frontend Realtek 8255");
-			DMESGW("This driver has EXPERIMENTAL support for this chipset.");
-			DMESGW("use it with care and at your own risk and");
-			DMESGW("**PLEASE** REPORT SUCCESS/INSUCCESS TO andreamrl@tiscali.it");
-
-			priv->rf_close = rtl8255_rf_close;
-			priv->rf_init = rtl8255_rf_init;
-			priv->rf_set_chan = rtl8255_rf_set_chan;
-			priv->rf_set_sens = NULL;
-			priv->rf_sleep = NULL;
-			priv->rf_wakeup = NULL;
-
-		}else{
-			DMESGW("Detected RTL8255 radio on a card recognized as RTL8180");
-			DMESGW("This could not be... something went wrong....");
-			return -ENODEV;
-		}
-			break;
-
-
-		case RFCHIPID_INTERSIL:
-			DMESGW("Card reports RF frontend by Intersil.");
-			DMESGW("This driver has NO support for this chipset.");
-			return -ENODEV;
-			break;
-
-		case RFCHIPID_RFMD:
-			DMESGW("Card reports RF frontend by RFMD.");
-			DMESGW("This driver has NO support for this chipset.");
-			return -ENODEV;
-			break;
-
-		case RFCHIPID_GCT:
-			DMESGW("Card reports RF frontend by GCT.");
-			DMESGW("This driver has EXPERIMENTAL support for this chipset.");
-			DMESGW("use it with care and at your own risk and");
-			DMESGW("**PLEASE** REPORT SUCCESS/INSUCCESS TO andreamrl@tiscali.it");
-			priv->rf_close = gct_rf_close;
-			priv->rf_init = gct_rf_init;
-			priv->rf_set_chan = gct_rf_set_chan;
-			priv->rf_set_sens = NULL;
-			priv->rf_sleep = NULL;
-			priv->rf_wakeup = NULL;
-			break;
-
-		case RFCHIPID_MAXIM:
-			DMESGW("Card reports RF frontend by MAXIM.");
-			DMESGW("This driver has EXPERIMENTAL support for this chipset.");
-			DMESGW("use it with care and at your own risk and");
-			DMESGW("**PLEASE** REPORT SUCCESS/INSUCCESS TO andreamrl@tiscali.it");
-			priv->rf_close = maxim_rf_close;
-			priv->rf_init = maxim_rf_init;
-			priv->rf_set_chan = maxim_rf_set_chan;
-			priv->rf_set_sens = NULL;
-			priv->rf_sleep = NULL;
-			priv->rf_wakeup = NULL;
-			break;
-
-		case RFCHIPID_PHILIPS:
-			DMESG("Card reports RF frontend by Philips.");
-			DMESG("OK! Philips SA2400 radio chipset is supported.");
-			priv->rf_close = sa2400_rf_close;
-			priv->rf_init = sa2400_rf_init;
-			priv->rf_set_chan = sa2400_rf_set_chan;
-			priv->rf_set_sens = sa2400_rf_set_sens;
-			priv->sens = SA2400_RF_DEF_SENS; /* default sensitivity */
-			priv->max_sens = SA2400_RF_MAX_SENS; /* maximum sensitivity */
-			priv->rf_sleep = NULL;
-			priv->rf_wakeup = NULL;
-
-			if(priv->digphy){
-				DMESGW("Digital PHY found");
-				DMESGW("Philips DIGITAL PHY is untested! *Please*\
-	report success/failure to <andreamrl@tiscali.it>");
-			}else{
-				DMESG ("Analog PHY found");
-			}
-
-			break;
-
-		default:
-			DMESGW("Unknown RF module %x",priv->rf_chip);
-			DMESGW("Exiting...");
-			return -1;
-
-	}
-#endif
 
 
 	if(!priv->card_8185){
@@ -5140,11 +4874,7 @@ void rtl8180_start_tx_beacon(struct net_
 	rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
 
 //	rtl8180_beacon_tx_enable(dev);
-#ifdef CONFIG_RTL8185B
         rtl8185b_irq_enable(dev);
-#else
-	rtl8180_irq_enable(dev);
-#endif
 	/* VV !!!!!!!!!! VV*/
 	/*
 	rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
@@ -5434,15 +5164,9 @@ int _rtl8180_up(struct net_device *dev)
 	priv->up=1;
 
 	DMESG("Bringing up iface");
-#ifdef CONFIG_RTL8185B
 	rtl8185b_adapter_start(dev);
 	rtl8185b_rx_enable(dev);
 	rtl8185b_tx_enable(dev);
-#else
-	rtl8180_adapter_start(dev);
-	rtl8180_rx_enable(dev);
-	rtl8180_tx_enable(dev);
-#endif
 #ifdef ENABLE_IPS
 	if(priv->bInactivePs){
 		if(priv->ieee80211->iw_mode == IW_MODE_ADHOC)
@@ -5768,12 +5492,10 @@ static int __devinit rtl8180_pci_probe(s
 
 #endif //end #ifdef RTL_IO_MAP
 
-#ifdef CONFIG_RTL8185B
 	//pci_read_config_byte(pdev, 0x05, ptr);
 	//pci_write_config_byte(pdev, 0x05, (*ptr) & (~0x04));
 	pci_read_config_byte(pdev, 0x05, &unit);
 	pci_write_config_byte(pdev, 0x05, unit & (~0x04));
-#endif
 
 	dev->irq = pdev->irq;
 	priv->irq = 0;
@@ -6220,14 +5942,9 @@ irqreturn_t rtl8180_interrupt(int irq, v
 
 	spin_lock_irqsave(&priv->irq_th_lock,flags);
 
-#ifdef CONFIG_RTL8185B
 	//ISR: 4bytes
 	inta = read_nic_dword(dev, ISR);// & priv->IntrMask;
 	write_nic_dword(dev,ISR,inta); // reset int situation
-#else
-	inta = read_nic_word(dev,INTA) & priv->irq_mask;
-	write_nic_word(dev,INTA,inta); // reset int situation
-#endif
 
 	priv->stats.shints++;
 
@@ -6307,7 +6024,6 @@ irqreturn_t rtl8180_interrupt(int irq, v
 		DMESGW("RX error int");
 #endif
 	}
-#ifdef CONFIG_RTL8185B
 	if(inta & ISR_TBKDER){ //corresponding to BK_PRIORITY
 		priv->stats.txbkperr++;
 		priv->ieee80211->stats.tx_errors++;
@@ -6329,7 +6045,6 @@ irqreturn_t rtl8180_interrupt(int irq, v
 		//tasklet_schedule(&priv->irq_tx_tasklet);
 		rtl8180_try_wake_queue(dev, BE_PRIORITY);
 	}
-#endif
 	if(inta & ISR_TNPDER){ //corresponding to VO_PRIORITY
 		priv->stats.txnperr++;
 		priv->ieee80211->stats.tx_errors++;
@@ -6338,9 +6053,7 @@ irqreturn_t rtl8180_interrupt(int irq, v
 #endif
 		//tasklet_schedule(&priv->irq_tx_tasklet);
 		rtl8180_tx_isr(dev,NORM_PRIORITY,1);
-#ifdef CONFIG_RTL8185B
 		rtl8180_try_wake_queue(dev, NORM_PRIORITY);
-#endif
 	}
 
 	if(inta & ISR_TLPDER){ //corresponding to VI_PRIORITY
@@ -6421,7 +6134,6 @@ irqreturn_t rtl8180_interrupt(int irq, v
 		rtl8180_try_wake_queue(dev, LOW_PRIORITY);
 	}
 
-#ifdef CONFIG_RTL8185B
 	if(inta & ISR_TBKDOK){ //corresponding to BK_PRIORITY
 		priv->stats.txbkpokint++;
 #ifdef DEBUG_TX
@@ -6445,7 +6157,6 @@ irqreturn_t rtl8180_interrupt(int irq, v
 		rtl8180_tx_isr(dev,BE_PRIORITY,0);
 		rtl8180_try_wake_queue(dev, BE_PRIORITY);
 	}
-#endif
 	force_pci_posting(dev);
 	spin_unlock_irqrestore(&priv->irq_th_lock,flags);
 
Index: b/drivers/staging/rtl8187se/r8180_dm.c
===================================================================
--- a/drivers/staging/rtl8187se/r8180_dm.c
+++ b/drivers/staging/rtl8187se/r8180_dm.c
@@ -1315,14 +1315,12 @@ SetAntenna8185(
 		{
 		case RF_ZEBRA2:
 		case RF_ZEBRA4:
-#ifdef CONFIG_RTL8185B
 			// Mac register, main antenna
 			write_nic_byte(dev, ANTSEL, 0x03);
 			//base band
 			write_phy_cck(dev,0x11, 0x9b); // Config CCK RX antenna.
 			write_phy_ofdm(dev, 0x0d, 0x5c); // Config OFDM RX antenna.
 
-#endif
 
 			bAntennaSwitched = true;
 			break;
@@ -1338,13 +1336,11 @@ SetAntenna8185(
 		{
 		case RF_ZEBRA2:
 		case RF_ZEBRA4:
-#ifdef CONFIG_RTL8185B
 			// Mac register, aux antenna
 			write_nic_byte(dev, ANTSEL, 0x00);
 			//base band
 			write_phy_cck(dev, 0x11, 0xbb); // Config CCK RX antenna.
 			write_phy_ofdm(dev, 0x0d, 0x54); // Config OFDM RX antenna.
-#endif
 
 			bAntennaSwitched = true;
 			break;
Index: b/drivers/staging/rtl8187se/r8180_hw.h
===================================================================
--- a/drivers/staging/rtl8187se/r8180_hw.h
+++ b/drivers/staging/rtl8187se/r8180_hw.h
@@ -20,7 +20,6 @@
 #ifndef R8180_HW
 #define R8180_HW
 
-#define CONFIG_RTL8185B  //support for rtl8185B, xiong-2006-11-15
 
 #define BIT0	0x00000001
 #define BIT1	0x00000002
@@ -250,7 +249,6 @@
 
 #define CR 0x0037
 
-#ifdef CONFIG_RTL8185B
 #define RF_SW_CONFIG	        0x8			// store data which is transmitted to RF for driver
 #define RF_SW_CFG_SI		BIT1
 #define PIFS			0x2C			// PCF InterFrame Spacing Timer Setting.
@@ -260,18 +258,6 @@
 
 #define IMR 0x006C
 #define ISR 0x003C
-#else
-#define BRSR 0x002C
-#define BRSR_END 0x002D
-
-/* 0x0034 - 0x0034 - reserved */
-#define EIFS 0x0035
-
-#define IMR 0x003C
-#define IMR_END 0x003D
-#define ISR 0x003E
-#define ISR_END 0x003F
-#endif
 
 #define TCR 0x0040
 #define TCR_END 0x0043
@@ -298,7 +284,6 @@
 
 #define CONFIG3 0x0059
 #define CONFIG4 0x005A
-#ifdef CONFIG_RTL8185B
 	// SD3 szuyitasi: Mac0x57= CC -> B0 Mac0x60= D1 -> C6
 	// Mac0x60 = 0x000004C6 power save parameters
 	#define ANAPARM_ASIC_ON    0xB0054D00
@@ -306,7 +291,6 @@
 
 	#define ANAPARM_ON ANAPARM_ASIC_ON
 	#define ANAPARM2_ON ANAPARM2_ASIC_ON
-#endif
 
 #define TESTR 0x005B
 
@@ -461,12 +445,7 @@
 #define FER 0x00F0
 #define FER_END 0x00F3
 
-#ifdef CONFIG_RTL8185B
 #define FEMR			0x1D4	// Function Event Mask register
-#else
-#define FEMR 0x00F4
-#define FEMR_END 0x00F7
-#endif
 
 #define FPSR 0x00F8
 #define FPSR_END 0x00FB
@@ -496,7 +475,6 @@
 #define CR_TE       ((1<< 2))
 #define CR_MulRW    ((1<< 0))
 
-#ifdef CONFIG_RTL8185B
 #define IMR_Dot11hInt	((1<< 25))			// 802.11h Measurement Interrupt
 #define IMR_BcnDmaInt	((1<< 24))			// Beacon DMA Interrupt // What differenct between BcnDmaInt and BcnInt???
 #define IMR_WakeInt		((1<< 23))			// Wake Up Interrupt
@@ -559,49 +537,12 @@
 #define ISR_TimeOut ISR_TimeOut1
 #define ISR_RXFOVW ISR_FOVW
 
-#else
-#define IMR_TXFOVW  ((1<<15))
-#define IMR_TimeOut ((1<<14))
-#define IMR_BcnInt  ((1<<13))
-#define IMR_ATIMInt ((1<<12))
-#define IMR_TBDER   ((1<<11))
-#define IMR_TBDOK   ((1<<10))
-#define IMR_THPDER  ((1<< 9))
-#define IMR_THPDOK  ((1<< 8))
-#define IMR_TNPDER  ((1<< 7))
-#define IMR_TNPDOK  ((1<< 6))
-#define IMR_RXFOVW  ((1<< 5))
-#define IMR_RDU     ((1<< 4))
-#define IMR_TLPDER  ((1<< 3))
-#define IMR_TLPDOK  ((1<< 2))
-#define IMR_RER     ((1<< 1))
-#define IMR_ROK     ((1<< 0))
-
-#define ISR_TXFOVW  ((1<<15))
-#define ISR_TimeOut ((1<<14))
-#define ISR_BcnInt  ((1<<13))
-#define ISR_ATIMInt ((1<<12))
-#define ISR_TBDER   ((1<<11))
-#define ISR_TBDOK   ((1<<10))
-#define ISR_THPDER  ((1<< 9))
-#define ISR_THPDOK  ((1<< 8))
-#define ISR_TNPDER  ((1<< 7))
-#define ISR_TNPDOK  ((1<< 6))
-#define ISR_RXFOVW  ((1<< 5))
-#define ISR_RDU     ((1<< 4))
-#define ISR_TLPDER  ((1<< 3))
-#define ISR_TLPDOK  ((1<< 2))
-#define ISR_RER     ((1<< 1))
-#define ISR_ROK     ((1<< 0))
-#endif
 
 #define HW_VERID_R8180_F 3
 #define HW_VERID_R8180_ABCD 2
 #define HW_VERID_R8185_ABC 4
 #define HW_VERID_R8185_D 5
-#ifdef CONFIG_RTL8185B
 #define HW_VERID_R8185B_B 6
-#endif
 
 #define TCR_CWMIN   ((1<<31))
 #define TCR_SWSEQ   ((1<<30))
@@ -759,7 +700,6 @@
 #define FFER_INTR    ((1<<15))
 #define FFER_GWAKE   ((1<< 4))
 
-#ifdef CONFIG_RTL8185B
 // Three wire mode.
 #define SW_THREE_WIRE			0
 #define HW_THREE_WIRE			2
@@ -933,6 +873,5 @@
 //YJ,add for Country IE, 080630
 #define EEPROM_COUNTRY_CODE  0x2E
 //YJ,add,080630,end
-#endif
 
 #endif
Index: b/drivers/staging/rtl8187se/r8180_rtl8225.h
===================================================================
--- a/drivers/staging/rtl8187se/r8180_rtl8225.h
+++ b/drivers/staging/rtl8187se/r8180_rtl8225.h
@@ -19,7 +19,6 @@
 #define RTL8225_ANAPARAM_SLEEP 0xa00bab59
 #define RTL8225_ANAPARAM2_SLEEP 0x840dec11
 
-#ifdef CONFIG_RTL8185B
 void rtl8225z2_rf_init(struct net_device *dev);
 void rtl8225z2_rf_set_chan(struct net_device *dev,short ch);
 void rtl8225z2_rf_close(struct net_device *dev);
@@ -30,7 +29,6 @@ void rtl8225_host_usb_init(struct net_de
 void write_rtl8225(struct net_device *dev, u8 adr, u16 data);
 void RF_WriteReg(struct net_device *dev, u8 offset, u32	data);
 u32 RF_ReadReg(struct net_device *dev, u8 offset);
-#endif
 void rtl8225_rf_init(struct net_device *dev);
 void rtl8225_rf_set_chan(struct net_device *dev,short ch);
 void rtl8225_rf_close(struct net_device *dev);
Index: b/drivers/staging/rtl8187se/r8180_rtl8225z2.c
===================================================================
--- a/drivers/staging/rtl8187se/r8180_rtl8225z2.c
+++ b/drivers/staging/rtl8187se/r8180_rtl8225z2.c
@@ -16,7 +16,6 @@
 
 #include "ieee80211/dot11d.h"
 
-#ifdef CONFIG_RTL8185B
 
 extern u8 rtl8225_agc[];
 
@@ -574,7 +573,6 @@ void rtl8225z2_SetTXPowerLevel(struct ne
 	max_ofdm_power_level = 25; //  12 -> 25
 	min_ofdm_power_level = 10;
 
-#ifdef CONFIG_RTL8185B
 
 	if(cck_power_level > 35)
 	{
@@ -587,7 +585,6 @@ void rtl8225z2_SetTXPowerLevel(struct ne
        //printk("CCK TX power is %x\n", (ZEBRA2_CCK_OFDM_GAIN_SETTING[cck_power_level]));
        force_pci_posting(dev);
 	mdelay(1);
-#endif
 	/* OFDM power setting */
 //  Old:
 //	if(ofdm_power_level > max_ofdm_power_level)
@@ -1536,5 +1533,4 @@ void rtl8225z4_rf_wakeup(struct net_devi
 	//printk("=========>%s()\n", __func__);
 	MgntActSet_RF_State(dev, eRfOn, RF_CHANGE_BY_PS);
 }
-#endif
 
Index: b/drivers/staging/rtl8187se/r8185b_init.c
===================================================================
--- a/drivers/staging/rtl8187se/r8185b_init.c
+++ b/drivers/staging/rtl8187se/r8185b_init.c
@@ -34,7 +34,6 @@ Notes:
 
 #include "ieee80211/dot11d.h"
 
-#ifdef CONFIG_RTL8185B
 
 //#define CONFIG_RTL8180_IO_MAP
 
@@ -3139,4 +3138,3 @@ void rtl8185b_tx_enable(struct net_devic
 }
 
 
-#endif

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 06/18] Staging: rtl8187se: remove CONFIG_RTL8180_IO_MAP ifdefs
  2009-06-28 14:18 [PATCH 01/18] Staging: rtl8187se: remove ENABLE_DOT11D ifdefs Bartlomiej Zolnierkiewicz
                   ` (3 preceding siblings ...)
  2009-06-28 14:19 ` [PATCH 05/18] Staging: rtl8187se: remove CONFIG_RTL8185B ifdefs Bartlomiej Zolnierkiewicz
@ 2009-06-28 14:19 ` Bartlomiej Zolnierkiewicz
  2009-06-28 14:19 ` [PATCH 07/18] Staging: rtl8187se: remove dead code Bartlomiej Zolnierkiewicz
                   ` (11 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-06-28 14:19 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Bartlomiej Zolnierkiewicz, linux-kernel

From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] Staging: rtl8187se: remove CONFIG_RTL8180_IO_MAP ifdefs

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/staging/rtl8187se/Makefile      |    1 
 drivers/staging/rtl8187se/r8180_core.c  |   83 ---------------
 drivers/staging/rtl8187se/r8185b_init.c |  168 --------------------------------
 3 files changed, 252 deletions(-)

Index: b/drivers/staging/rtl8187se/Makefile
===================================================================
--- a/drivers/staging/rtl8187se/Makefile
+++ b/drivers/staging/rtl8187se/Makefile
@@ -1,6 +1,5 @@
 
 #EXTRA_CFLAGS += -DCONFIG_IEEE80211_NOWEP=y
-#EXTRA_CFLAGS += -DCONFIG_RTL8180_IOMAP
 #EXTRA_CFLAGS += -std=gnu89
 #EXTRA_CFLAGS += -O2
 #CC            = gcc
Index: b/drivers/staging/rtl8187se/r8180_core.c
===================================================================
--- a/drivers/staging/rtl8187se/r8180_core.c
+++ b/drivers/staging/rtl8187se/r8180_core.c
@@ -59,7 +59,6 @@ double __extendsfdf2(float a) {return a;
 //#define DEBUG_RX
 //#define DEBUG_RX_SKB
 
-//#define CONFIG_RTL8180_IO_MAP
 #include <linux/syscalls.h>
 //#include <linux/fcntl.h>
 //#include <asm/uaccess.h>
@@ -78,8 +77,6 @@ double __extendsfdf2(float a) {return a;
 
 #include "ieee80211/dot11d.h"
 
-//#define CONFIG_RTL8180_IO_MAP
-
 #ifndef PCI_VENDOR_ID_BELKIN
 	#define PCI_VENDOR_ID_BELKIN 0x1799
 #endif
@@ -202,39 +199,6 @@ static struct pci_driver rtl8180_pci_dri
 
 
 
-#ifdef CONFIG_RTL8180_IO_MAP
-
-u8 read_nic_byte(struct net_device *dev, int x)
-{
-        return 0xff&inb(dev->base_addr +x);
-}
-
-u32 read_nic_dword(struct net_device *dev, int x)
-{
-        return inl(dev->base_addr +x);
-}
-
-u16 read_nic_word(struct net_device *dev, int x)
-{
-        return inw(dev->base_addr +x);
-}
-
-void write_nic_byte(struct net_device *dev, int x,u8 y)
-{
-        outb(y&0xff,dev->base_addr +x);
-}
-
-void write_nic_word(struct net_device *dev, int x,u16 y)
-{
-        outw(y,dev->base_addr +x);
-}
-
-void write_nic_dword(struct net_device *dev, int x,u32 y)
-{
-        outl(y,dev->base_addr +x);
-}
-
-#else /* RTL_IO_MAP */
 
 u8 read_nic_byte(struct net_device *dev, int x)
 {
@@ -269,7 +233,6 @@ void write_nic_word(struct net_device *d
 	udelay(20);
 }
 
-#endif /* RTL_IO_MAP */
 
 
 
@@ -278,9 +241,7 @@ void write_nic_word(struct net_device *d
 inline void force_pci_posting(struct net_device *dev)
 {
 	read_nic_byte(dev,EPROM_CMD);
-#ifndef CONFIG_RTL8180_IO_MAP
 	mb();
-#endif
 }
 
 
@@ -5411,11 +5372,7 @@ static int __devinit rtl8180_pci_probe(s
 	//u8 *ptr;
 	u8 unit = 0;
 
-#ifdef CONFIG_RTL8180_IO_MAP
-	unsigned long pio_start, pio_len, pio_flags;
-#else
 	unsigned long pmem_start, pmem_len, pmem_flags;
-#endif //end #ifdef RTL_IO_MAP
 
 	DMESG("Configuring chip resources");
 
@@ -5442,27 +5399,6 @@ static int __devinit rtl8180_pci_probe(s
 	priv->pdev=pdev;
 
 
-#ifdef CONFIG_RTL8180_IO_MAP
-
-	pio_start = (unsigned long)pci_resource_start (pdev, 0);
-	pio_len = (unsigned long)pci_resource_len (pdev, 0);
-	pio_flags = (unsigned long)pci_resource_flags (pdev, 0);
-
-      	if (!(pio_flags & IORESOURCE_IO)) {
-		DMESG("region #0 not a PIO resource, aborting");
-		goto fail;
-	}
-
-	//DMESG("IO space @ 0x%08lx", pio_start );
-	if( ! request_region( pio_start, pio_len, RTL8180_MODULE_NAME ) ){
-		DMESG("request_region failed!");
-		goto fail;
-	}
-
-	ioaddr = pio_start;
-	dev->base_addr = ioaddr; // device I/O address
-
-#else
 
 	pmem_start = pci_resource_start(pdev, 1);
 	pmem_len = pci_resource_len(pdev, 1);
@@ -5490,7 +5426,6 @@ static int __devinit rtl8180_pci_probe(s
 	dev->mem_start = ioaddr; // shared mem start
 	dev->mem_end = ioaddr + pci_resource_len(pdev, 0); // shared mem end
 
-#endif //end #ifdef RTL_IO_MAP
 
 	//pci_read_config_byte(pdev, 0x05, ptr);
 	//pci_write_config_byte(pdev, 0x05, (*ptr) & (~0x04));
@@ -5530,20 +5465,11 @@ static int __devinit rtl8180_pci_probe(s
 
 fail1:
 
-#ifdef CONFIG_RTL8180_IO_MAP
-
-	if( dev->base_addr != 0 ){
-
-		release_region(dev->base_addr,
-	       pci_resource_len(pdev, 0) );
-	}
-#else
 	if( dev->mem_start != (unsigned long)NULL ){
 		iounmap( (void *)dev->mem_start );
 		release_mem_region( pci_resource_start(pdev, 1),
 				    pci_resource_len(pdev, 1) );
 	}
-#endif //end #ifdef RTL_IO_MAP
 
 
 fail:
@@ -5598,20 +5524,11 @@ static void __devexit rtl8180_pci_remove
 		free_tx_desc_rings(dev);
 	//	free_beacon_desc_ring(dev,priv->txbeaconcount);
 
-#ifdef CONFIG_RTL8180_IO_MAP
-
-		if( dev->base_addr != 0 ){
-
-			release_region(dev->base_addr,
-				       pci_resource_len(pdev, 0) );
-		}
-#else
 		if( dev->mem_start != (unsigned long)NULL ){
 			iounmap( (void *)dev->mem_start );
 			release_mem_region( pci_resource_start(pdev, 1),
 					    pci_resource_len(pdev, 1) );
 		}
-#endif /*end #ifdef RTL_IO_MAP*/
 
 		free_ieee80211(dev);
 	}
Index: b/drivers/staging/rtl8187se/r8185b_init.c
===================================================================
--- a/drivers/staging/rtl8187se/r8185b_init.c
+++ b/drivers/staging/rtl8187se/r8185b_init.c
@@ -131,37 +131,9 @@ PlatformIOWrite1Byte(
 	u8		data
 	)
 {
-#ifndef CONFIG_RTL8180_IO_MAP
 	write_nic_byte(dev, offset, data);
 	read_nic_byte(dev, offset); // To make sure write operation is completed, 2005.11.09, by rcnjko.
 
-#else // Port IO
-	u32 Page = (offset >> 8);
-
-	switch(Page)
-	{
-	case 0: // Page 0
-		write_nic_byte(dev, offset, data);
-		break;
-
-	case 1: // Page 1
-	case 2: // Page 2
-	case 3: // Page 3
-		{
-			u8 psr = read_nic_byte(dev, PSR);
-
-			write_nic_byte(dev, PSR, ((psr & 0xfc) | (u8)Page)); // Switch to page N.
-			write_nic_byte(dev, (offset & 0xff), data);
-			write_nic_byte(dev, PSR, (psr & 0xfc)); // Switch to page 0.
-		}
-		break;
-
-	default:
-		// Illegal page number.
-		DMESGE("PlatformIOWrite1Byte(): illegal page number: %d, offset: %#X", Page, offset);
-		break;
-	}
-#endif
 }
 
 void
@@ -171,38 +143,10 @@ PlatformIOWrite2Byte(
 	u16		data
 	)
 {
-#ifndef CONFIG_RTL8180_IO_MAP
 	write_nic_word(dev, offset, data);
 	read_nic_word(dev, offset); // To make sure write operation is completed, 2005.11.09, by rcnjko.
 
 
-#else // Port IO
-	u32 Page = (offset >> 8);
-
-	switch(Page)
-	{
-	case 0: // Page 0
-		write_nic_word(dev, offset, data);
-		break;
-
-	case 1: // Page 1
-	case 2: // Page 2
-	case 3: // Page 3
-		{
-			u8 psr = read_nic_byte(dev, PSR);
-
-			write_nic_byte(dev, PSR, ((psr & 0xfc) | (u8)Page)); // Switch to page N.
-			write_nic_word(dev, (offset & 0xff), data);
-			write_nic_byte(dev, PSR, (psr & 0xfc)); // Switch to page 0.
-		}
-		break;
-
-	default:
-		// Illegal page number.
-		DMESGE("PlatformIOWrite2Byte(): illegal page number: %d, offset: %#X", Page, offset);
-		break;
-	}
-#endif
 }
 u8 PlatformIORead1Byte(struct net_device *dev, u32 offset);
 
@@ -213,7 +157,6 @@ PlatformIOWrite4Byte(
 	u32		data
 	)
 {
-#ifndef CONFIG_RTL8180_IO_MAP
 //{by amy 080312
 if (offset == PhyAddr)
 	{//For Base Band configuration.
@@ -257,33 +200,6 @@ if (offset == PhyAddr)
 		write_nic_dword(dev, offset, data);
 		read_nic_dword(dev, offset); // To make sure write operation is completed, 2005.11.09, by rcnjko.
 	}
-#else // Port IO
-	u32 Page = (offset >> 8);
-
-	switch(Page)
-	{
-	case 0: // Page 0
-		write_nic_word(dev, offset, data);
-		break;
-
-	case 1: // Page 1
-	case 2: // Page 2
-	case 3: // Page 3
-		{
-			u8 psr = read_nic_byte(dev, PSR);
-
-			write_nic_byte(dev, PSR, ((psr & 0xfc) | (u8)Page)); // Switch to page N.
-			write_nic_dword(dev, (offset & 0xff), data);
-			write_nic_byte(dev, PSR, (psr & 0xfc)); // Switch to page 0.
-		}
-		break;
-
-	default:
-		// Illegal page number.
-		DMESGE("PlatformIOWrite4Byte(): illegal page number: %d, offset: %#X", Page, offset);
-		break;
-	}
-#endif
 }
 
 u8
@@ -294,36 +210,8 @@ PlatformIORead1Byte(
 {
 	u8	data = 0;
 
-#ifndef CONFIG_RTL8180_IO_MAP
 	data = read_nic_byte(dev, offset);
 
-#else // Port IO
-	u32 Page = (offset >> 8);
-
-	switch(Page)
-	{
-	case 0: // Page 0
-		data = read_nic_byte(dev, offset);
-		break;
-
-	case 1: // Page 1
-	case 2: // Page 2
-	case 3: // Page 3
-		{
-			u8 psr = read_nic_byte(dev, PSR);
-
-			write_nic_byte(dev, PSR, ((psr & 0xfc) | (u8)Page)); // Switch to page N.
-			data = read_nic_byte(dev, (offset & 0xff));
-			write_nic_byte(dev, PSR, (psr & 0xfc)); // Switch to page 0.
-		}
-		break;
-
-	default:
-		// Illegal page number.
-		DMESGE("PlatformIORead1Byte(): illegal page number: %d, offset: %#X", Page, offset);
-		break;
-	}
-#endif
 
 	return data;
 }
@@ -336,36 +224,8 @@ PlatformIORead2Byte(
 {
 	u16	data = 0;
 
-#ifndef CONFIG_RTL8180_IO_MAP
 	data = read_nic_word(dev, offset);
 
-#else // Port IO
-	u32 Page = (offset >> 8);
-
-	switch(Page)
-	{
-	case 0: // Page 0
-		data = read_nic_word(dev, offset);
-		break;
-
-	case 1: // Page 1
-	case 2: // Page 2
-	case 3: // Page 3
-		{
-			u8 psr = read_nic_byte(dev, PSR);
-
-			write_nic_byte(dev, PSR, ((psr & 0xfc) | (u8)Page)); // Switch to page N.
-			data = read_nic_word(dev, (offset & 0xff));
-			write_nic_byte(dev, PSR, (psr & 0xfc)); // Switch to page 0.
-		}
-		break;
-
-	default:
-		// Illegal page number.
-		DMESGE("PlatformIORead2Byte(): illegal page number: %d, offset: %#X", Page, offset);
-		break;
-	}
-#endif
 
 	return data;
 }
@@ -378,36 +238,8 @@ PlatformIORead4Byte(
 {
 	u32	data = 0;
 
-#ifndef CONFIG_RTL8180_IO_MAP
 	data = read_nic_dword(dev, offset);
 
-#else // Port IO
-	u32 Page = (offset >> 8);
-
-	switch(Page)
-	{
-	case 0: // Page 0
-		data = read_nic_dword(dev, offset);
-		break;
-
-	case 1: // Page 1
-	case 2: // Page 2
-	case 3: // Page 3
-		{
-			u8 psr = read_nic_byte(dev, PSR);
-
-			write_nic_byte(dev, PSR, ((psr & 0xfc) | (u8)Page)); // Switch to page N.
-			data = read_nic_dword(dev, (offset & 0xff));
-			write_nic_byte(dev, PSR, (psr & 0xfc)); // Switch to page 0.
-		}
-		break;
-
-	default:
-		// Illegal page number.
-		DMESGE("PlatformIORead4Byte(): illegal page number: %d, offset: %#X\n", Page, offset);
-		break;
-	}
-#endif
 
 	return data;
 }

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 07/18] Staging: rtl8187se: remove dead code
  2009-06-28 14:18 [PATCH 01/18] Staging: rtl8187se: remove ENABLE_DOT11D ifdefs Bartlomiej Zolnierkiewicz
                   ` (4 preceding siblings ...)
  2009-06-28 14:19 ` [PATCH 06/18] Staging: rtl8187se: remove CONFIG_RTL8180_IO_MAP ifdefs Bartlomiej Zolnierkiewicz
@ 2009-06-28 14:19 ` Bartlomiej Zolnierkiewicz
  2009-06-28 14:19 ` [PATCH 08/18] Staging: rtl8187se: remove unused radio frontends Bartlomiej Zolnierkiewicz
                   ` (10 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-06-28 14:19 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Bartlomiej Zolnierkiewicz, linux-kernel

From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] Staging: rtl8187se: remove dead code

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/staging/rtl8187se/ieee80211/dot11d.c               |   10 
 drivers/staging/rtl8187se/ieee80211/ieee80211_crypt.c      |   13 
 drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_ccmp.c |    7 
 drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_tkip.c |   19 
 drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_wep.c  |    5 
 drivers/staging/rtl8187se/ieee80211/ieee80211_module.c     |   88 --
 drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c         |   56 -
 drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c    |  289 -------
 drivers/staging/rtl8187se/ieee80211/ieee80211_softmac_wx.c |   19 
 drivers/staging/rtl8187se/ieee80211/ieee80211_tx.c         |    4 
 drivers/staging/rtl8187se/ieee80211/ieee80211_wx.c         |   63 -
 drivers/staging/rtl8187se/r8180_core.c                     |  522 -------------
 drivers/staging/rtl8187se/r8180_dm.c                       |   12 
 drivers/staging/rtl8187se/r8180_max2820.c                  |   69 -
 drivers/staging/rtl8187se/r8180_rtl8225.c                  |  200 ----
 drivers/staging/rtl8187se/r8180_rtl8225z2.c                |  375 ---------
 drivers/staging/rtl8187se/r8180_rtl8255.c                  |   33 
 drivers/staging/rtl8187se/r8180_wx.c                       |   29 
 drivers/staging/rtl8187se/r8185b_init.c                    |  285 -------
 19 files changed, 13 insertions(+), 2085 deletions(-)

Index: b/drivers/staging/rtl8187se/ieee80211/dot11d.c
===================================================================
--- a/drivers/staging/rtl8187se/ieee80211/dot11d.c
+++ b/drivers/staging/rtl8187se/ieee80211/dot11d.c
@@ -222,13 +222,3 @@ int ToLegalChannel(
 
 	return default_chn;
 }
-
-#if 0
-EXPORT_SYMBOL(Dot11d_Init);
-EXPORT_SYMBOL(Dot11d_Reset);
-EXPORT_SYMBOL(Dot11d_UpdateCountryIe);
-EXPORT_SYMBOL(DOT11D_GetMaxTxPwrInDbm);
-EXPORT_SYMBOL(DOT11D_ScanComplete);
-EXPORT_SYMBOL(IsLegalChannel);
-EXPORT_SYMBOL(ToLegalChannel);
-#endif
Index: b/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt.c
===================================================================
--- a/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt.c
+++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt.c
@@ -247,16 +247,3 @@ void ieee80211_crypto_deinit(void)
 	}
 	kfree(hcrypt);
 }
-
-#if 0
-EXPORT_SYMBOL(ieee80211_crypt_deinit_entries);
-EXPORT_SYMBOL(ieee80211_crypt_deinit_handler);
-EXPORT_SYMBOL(ieee80211_crypt_delayed_deinit);
-
-EXPORT_SYMBOL(ieee80211_register_crypto_ops);
-EXPORT_SYMBOL(ieee80211_unregister_crypto_ops);
-EXPORT_SYMBOL(ieee80211_get_crypto_ops);
-#endif
-
-//module_init(ieee80211_crypto_init);
-//module_exit(ieee80211_crypto_deinit);
Index: b/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_ccmp.c
===================================================================
--- a/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_ccmp.c
+++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_ccmp.c
@@ -472,10 +472,3 @@ void ieee80211_crypto_ccmp_exit(void)
 {
 	ieee80211_unregister_crypto_ops(&ieee80211_crypt_ccmp);
 }
-
-#if 0
-EXPORT_SYMBOL(ieee80211_ccmp_null);
-#endif
-
-//module_init(ieee80211_crypto_ccmp_init);
-//module_exit(ieee80211_crypto_ccmp_exit);
Index: b/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_tkip.c
===================================================================
--- a/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_tkip.c
+++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_tkip.c
@@ -327,17 +327,6 @@ static int ieee80211_tkip_encrypt(struct
 		return -1;
 
 	hdr = (struct ieee80211_hdr *) skb->data;
-#if 0
-printk("@@ tkey\n");
-printk("%x|", ((u32*)tkey->key)[0]);
-printk("%x|", ((u32*)tkey->key)[1]);
-printk("%x|", ((u32*)tkey->key)[2]);
-printk("%x|", ((u32*)tkey->key)[3]);
-printk("%x|", ((u32*)tkey->key)[4]);
-printk("%x|", ((u32*)tkey->key)[5]);
-printk("%x|", ((u32*)tkey->key)[6]);
-printk("%x\n", ((u32*)tkey->key)[7]);
-#endif
 
 	if (!tkey->tx_phase1_done) {
 		tkip_mixing_phase1(tkey->tx_ttak, tkey->key, hdr->addr2,
@@ -767,11 +756,3 @@ void ieee80211_tkip_null(void)
 //    printk("============>%s()\n", __func__);
         return;
 }
-
-#if 0
-EXPORT_SYMBOL(ieee80211_tkip_null);
-#endif
-
-
-//module_init(ieee80211_crypto_tkip_init);
-//module_exit(ieee80211_crypto_tkip_exit);
Index: b/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_wep.c
===================================================================
--- a/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_wep.c
+++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_wep.c
@@ -298,8 +298,3 @@ void ieee80211_wep_null(void)
 //	printk("============>%s()\n", __func__);
         return;
 }
-#if 0
-EXPORT_SYMBOL(ieee80211_wep_null);
-#endif
-//module_init(ieee80211_crypto_wep_init);
-//module_exit(ieee80211_crypto_wep_exit);
Index: b/drivers/staging/rtl8187se/ieee80211/ieee80211_module.c
===================================================================
--- a/drivers/staging/rtl8187se/ieee80211/ieee80211_module.c
+++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_module.c
@@ -210,91 +210,3 @@ void free_ieee80211(struct net_device *d
 
 	free_netdev(dev);
 }
-
-//#ifdef CONFIG_IEEE80211_DEBUG
-#if 0
-
-static int debug = 0;
-u32 ieee80211_debug_level = 0;
-struct proc_dir_entry *ieee80211_proc = NULL;
-
-static int show_debug_level(char *page, char **start, off_t offset,
-			    int count, int *eof, void *data)
-{
-	return snprintf(page, count, "0x%08X\n", ieee80211_debug_level);
-}
-
-static int store_debug_level(struct file *file, const char *buffer,
-			     unsigned long count, void *data)
-{
-	char buf[] = "0x00000000";
-	unsigned long len = min(sizeof(buf) - 1, (u32)count);
-	char *p = (char *)buf;
-	unsigned long val;
-
-	if (copy_from_user(buf, buffer, len))
-		return count;
-	buf[len] = 0;
-	if (p[1] == 'x' || p[1] == 'X' || p[0] == 'x' || p[0] == 'X') {
-		p++;
-		if (p[0] == 'x' || p[0] == 'X')
-			p++;
-		val = simple_strtoul(p, &p, 16);
-	} else
-		val = simple_strtoul(p, &p, 10);
-	if (p == buf)
-		printk(KERN_INFO DRV_NAME
-		       ": %s is not in hex or decimal form.\n", buf);
-	else
-		ieee80211_debug_level = val;
-
-	return strnlen(buf, count);
-}
-
-static int __init ieee80211_init(void)
-{
-	struct proc_dir_entry *e;
-
-	ieee80211_debug_level = debug;
-	ieee80211_proc = create_proc_entry(DRV_NAME, S_IFDIR, proc_net);
-	if (ieee80211_proc == NULL) {
-		IEEE80211_ERROR("Unable to create " DRV_NAME
-				" proc directory\n");
-		return -EIO;
-	}
-	e = create_proc_entry("debug_level", S_IFREG | S_IRUGO | S_IWUSR,
-			      ieee80211_proc);
-	if (!e) {
-		remove_proc_entry(DRV_NAME, proc_net);
-		ieee80211_proc = NULL;
-		return -EIO;
-	}
-	e->read_proc = show_debug_level;
-	e->write_proc = store_debug_level;
-	e->data = NULL;
-
-	return 0;
-}
-
-static void __exit ieee80211_exit(void)
-{
-	if (ieee80211_proc) {
-		remove_proc_entry("debug_level", ieee80211_proc);
-		remove_proc_entry(DRV_NAME, proc_net);
-		ieee80211_proc = NULL;
-	}
-}
-
-#include <linux/moduleparam.h>
-module_param(debug, int, 0444);
-MODULE_PARM_DESC(debug, "debug output mask");
-
-
-module_exit(ieee80211_exit);
-module_init(ieee80211_init);
-#endif
-
-#if 0
-EXPORT_SYMBOL(alloc_ieee80211);
-EXPORT_SYMBOL(free_ieee80211);
-#endif
Index: b/drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c
===================================================================
--- a/drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c
+++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c
@@ -650,22 +650,6 @@ int ieee80211_rx(struct ieee80211_device
 
 
 	if (type == IEEE80211_FTYPE_MGMT) {
-
-	#if 0
-		if ( stype == IEEE80211_STYPE_AUTH &&
-		    fc & IEEE80211_FCTL_WEP && ieee->host_decrypt &&
-		    (keyidx = hostap_rx_frame_decrypt(ieee, skb, crypt)) < 0)
-		{
-			printk(KERN_DEBUG "%s: failed to decrypt mgmt::auth "
-			       "from " MAC_FMT "\n", dev->name,
-			       MAC_ARG(hdr->addr2));
-			/* TODO: could inform hostapd about this so that it
-			 * could send auth failure report */
-			goto rx_dropped;
-		}
-	#endif
-
-
 		if (ieee80211_rx_frame_mgmt(ieee, skb, rx_stats, type, stype))
 			goto rx_dropped;
 		else
@@ -1077,15 +1061,6 @@ static inline void ieee80211_extract_cou
 	u8 * addr2
 )
 {
-#if 0
-	u32 i = 0;
-	u8 * p = (u8*)info_element->data;
-	printk("-----------------------\n");
-	printk("%s Country IE:", network->ssid);
-	for(i=0; i<info_element->len; i++)
-		printk("\t%2.2x", *(p+i));
-	printk("\n-----------------------\n");
-#endif
 	if(IS_DOT11D_ENABLE(ieee))
 	{
 		if(info_element->len!= 0)
@@ -1277,11 +1252,8 @@ inline int ieee80211_network_init(
 
 			if(ieee->state != IEEE80211_LINKED)
 				break;
-#if 0
-			network->last_dtim_sta_time[0] = stats->mac_time[0];
-#else
+
 			network->last_dtim_sta_time[0] = jiffies;
-#endif
 			network->last_dtim_sta_time[1] = stats->mac_time[1];
 
 			network->dtim_data = IEEE80211_DTIM_VALID;
@@ -1425,9 +1397,7 @@ inline int ieee80211_network_init(
 
 	if (ieee80211_is_empty_essid(network->ssid, network->ssid_len))
 		network->flags |= NETWORK_EMPTY_ESSID;
-#if 0
-	stats->signal = ieee80211_SignalStrengthTranslate(stats->signal);
-#endif
+
 	stats->signal = ieee80211_TranslateToDbm(stats->signalstrength);
 	//stats->noise = stats->signal - stats->noise;
 	stats->noise = ieee80211_TranslateToDbm(100 - stats->signalstrength) - 25;
@@ -1581,21 +1551,7 @@ inline void ieee80211_process_probe_resp
 		(beacon->capability & (1<<0x2)) ? '1' : '0',
 		(beacon->capability & (1<<0x1)) ? '1' : '0',
 		(beacon->capability & (1<<0x0)) ? '1' : '0');
-#if 0
-	if(strcmp(escape_essid(beacon->info_element.data, beacon->info_element.len), "rtl_softap") == 0)
-	{
-		if(WLAN_FC_GET_STYPE(beacon->header.frame_ctl) == IEEE80211_STYPE_BEACON)
-		{
-			u32 i = 0, len = stats->len;
-			u8 * p = (u8*)beacon;
-			printk("-----------------------\n");
-			printk("rtl_softap Beacon:");
-			for(i=0; i<len; i++)
-				printk("\t%2.2x", *(p+i));
-			printk("\n-----------------------\n");
-		}
-	}
-#endif
+
 	if (ieee80211_network_init(ieee, beacon, &network, stats)) {
 		IEEE80211_DEBUG_SCAN("Dropped '%s' (" MAC_FMT ") via %s.\n",
 				     escape_essid(info_element->data,
@@ -1781,9 +1737,3 @@ void ieee80211_rx_mgt(struct ieee80211_d
 		break;
 	}
 }
-
-#if 0
-EXPORT_SYMBOL(ieee80211_rx_mgt);
-EXPORT_SYMBOL(ieee80211_rx);
-EXPORT_SYMBOL(ieee80211_network_init);
-#endif
Index: b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c
===================================================================
--- a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c
+++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c
@@ -574,25 +574,6 @@ out:
 		DOT11D_ScanComplete(ieee);
 }
 
-
-#if 0
-/* called both by wq with ieee->lock held */
-void ieee80211_softmac_scan(struct ieee80211_device *ieee)
-{
-	short watchdog = 0;
-
-	do{
-		ieee->current_network.channel =
-			(ieee->current_network.channel + 1) % MAX_CHANNEL_NUMBER;
-		if (watchdog++ > MAX_CHANNEL_NUMBER)
-				return; /* no good chans */
-
-	}while(!ieee->channel_map[ieee->current_network.channel]);
-
-
-	schedule_work(&ieee->softmac_scan_wq);
-}
-#endif
 #ifdef ENABLE_IPS
 void ieee80211_softmac_scan_wq(struct work_struct *work)
 {
@@ -1172,206 +1153,10 @@ inline struct sk_buff *ieee80211_associa
 
 	//add rsn==0 condition for ap's mix security mode(wpa+wpa2), john2007.8.9
 	//choose AES encryption as default algorithm while using mixed mode
-#if 0
-	if(rsn_len == 0){
-
-		tag = skb_put(skb,wpa_len);
-
-		if(wpa_len) {
-
-
-		  //{add by david. 2006.8.31
-		  //fix linksys compatibility bug
-		  //}
-		  if(wpa_len > 24) {//22+2, mean include the capability
-			beacon->wpa_ie[wpa_len - 2] = 0;
-		  }
-		//multicast cipher OUI
-                  if(  beacon->wpa_ie[11]==0x2      ){ //0x0050f202 is the oui of tkip
-                  ieee->broadcast_key_type = KEY_TYPE_TKIP;
-                }
-                  else if(  beacon->wpa_ie[11]==0x4      ){//0x0050f204 is the oui of ccmp
-                  ieee->broadcast_key_type = KEY_TYPE_CCMP;
-                }
- 		//unicast cipher OUI
-		  if(	beacon->wpa_ie[14]==0
-			&& beacon->wpa_ie[15]==0x50
-                        && beacon->wpa_ie[16]==0xf2
-                        && beacon->wpa_ie[17]==0x2  	){ //0x0050f202 is the oui of tkip
-                  ieee->pairwise_key_type = KEY_TYPE_TKIP;
-		}
-
-                  else if(   beacon->wpa_ie[14]==0
-                        && beacon->wpa_ie[15]==0x50
-                        && beacon->wpa_ie[16]==0xf2
-                        && beacon->wpa_ie[17]==0x4      ){//0x0050f204 is the oui of ccmp
-                  ieee->pairwise_key_type = KEY_TYPE_CCMP;
-		}
-		//indicate the wpa_ie content to WPA_SUPPLICANT
-		buff = kmalloc(IW_CUSTOM_MAX, GFP_ATOMIC);
-		memset(buff, 0, IW_CUSTOM_MAX);
-		p=buff;
-		p += sprintf(p, "ASSOCINFO(ReqIEs=");
-		for(i=0;i<wpa_len;i++){
-			p += sprintf(p, "%02x", beacon->wpa_ie[i]);
-		}
-		p += sprintf(p, ")");
-		memset(&wrqu, 0, sizeof(wrqu) );
-		wrqu.data.length = p - buff;
-
-		wireless_send_event(dev, IWEVCUSTOM, &wrqu, buff);
-		  memcpy(tag,beacon->wpa_ie,wpa_len);
-		}
-
-	}
-
-	if(rsn_len > 22) {
-
-	  					if(     beacon->rsn_ie[4]==0x0 &&
-                                beacon->rsn_ie[5]==0xf &&
-                                beacon->rsn_ie[6]==0xac){
-
-                                switch(beacon->rsn_ie[7]){
-                                        case 0x1:
-                                                ieee->broadcast_key_type = KEY_TYPE_WEP40;
-                                                break;
-                                        case 0x2:
-                                                ieee->broadcast_key_type = KEY_TYPE_TKIP;
-                                                break;
-                                        case 0x4:
-                                                ieee->broadcast_key_type = KEY_TYPE_CCMP;
-                                                break;
-                                        case 0x5:
-                                                ieee->broadcast_key_type = KEY_TYPE_WEP104;
-                                                break;
-                                        default:
-                                                printk("fault suite type in RSN broadcast key\n");
-                                                break;
-                                }
-                        }
-
-                        if(     beacon->rsn_ie[10]==0x0 &&
-                                beacon->rsn_ie[11]==0xf &&
-                                beacon->rsn_ie[12]==0xac){
-				if(beacon->rsn_ie[8]==1){//not mixed mode
-	                                switch(beacon->rsn_ie[13]){
-        	                                case 0x2:
-                	                                ieee->pairwise_key_type = KEY_TYPE_TKIP;
-                        	                        break;
-                                	        case 0x4:
-                                        	        ieee->pairwise_key_type = KEY_TYPE_CCMP;
-                                                	break;
-        	                                default:
-	                                                printk("fault suite type in RSN pairwise key\n");
-                	                                break;
-                                	}
-				}
-				else if(beacon->rsn_ie[8]==2){//mixed mode
-					ieee->pairwise_key_type = KEY_TYPE_CCMP;
-				}
-                        }
 
-
-
-		tag = skb_put(skb,22);
-		memcpy(tag,(beacon->rsn_ie + info_addr),8);
-		tag[1] =  20;
-		tag += 8;
-		info_addr += 8;
-
-		spin_lock_irqsave(&ieee->wpax_suitlist_lock,flags);
-		for (i = 0; i < 2; i++) {
-			tag[0] = 1;
-			tag[1] = 0;
-			tag += 2;
-			suite_count = beacon->rsn_ie[info_addr] + \
-				      (beacon->rsn_ie[info_addr + 1] << 8);
-			info_addr += 2;
-			if(1 == suite_count) {
-				memcpy(tag,(beacon->rsn_ie + info_addr),4);
-				info_addr += 4;
-			} else {
-				// if the wpax_type_notify has been set by the application,
-				// just use it, otherwise just use the default one.
-				if(ieee->wpax_type_set) {
-					suit_select = ((0 == i) ? pairwise_type:authen_type)&0x0f ;
-					memcpy(tag,rsn_authen_cipher_suite[suit_select],4);
-				} else {
-					//default set as ccmp, or none authentication
-					if(i == 0) {
-						memcpy(tag,rsn_authen_cipher_suite[4],4);
-					} else {
-						memcpy(tag,rsn_authen_cipher_suite[2],4);
-					}
-
-				}
-
-				info_addr += (suite_count * 4);
-			}
-			tag += 4;
-		}
-		spin_unlock_irqrestore(&ieee->wpax_suitlist_lock,flags);
-
-		tag[0] = 0;
-		tag[1] = beacon->rsn_ie[info_addr+1];
-
-	} else {
-		tag = skb_put(skb,rsn_len);
-		if(rsn_len) {
-
-
-			if( 	beacon->rsn_ie[4]==0x0 &&
-				beacon->rsn_ie[5]==0xf &&
-				beacon->rsn_ie[6]==0xac){
-				switch(beacon->rsn_ie[7]){
-					case 0x1:
-						ieee->broadcast_key_type = KEY_TYPE_WEP40;
-                                                break;
-					case 0x2:
-						ieee->broadcast_key_type = KEY_TYPE_TKIP;
-						break;
-					case 0x4:
-   	                                        ieee->broadcast_key_type = KEY_TYPE_CCMP;
-                                                break;
-                                        case 0x5:
-                                                ieee->broadcast_key_type = KEY_TYPE_WEP104;
-                                                break;
-					default:
-						printk("fault suite type in RSN broadcast key\n");
-						break;
-				}
-			}
-                        if(     beacon->rsn_ie[10]==0x0 &&
-                                beacon->rsn_ie[11]==0xf &&
-                                beacon->rsn_ie[12]==0xac){
-                                if(beacon->rsn_ie[8]==1){//not mixed mode
-                                        switch(beacon->rsn_ie[13]){
-                                                case 0x2:
-                                                        ieee->pairwise_key_type = KEY_TYPE_TKIP;
-                                                        break;
-                                                case 0x4:
-                                                        ieee->pairwise_key_type = KEY_TYPE_CCMP;
-                                                        break;
-                                                default:
-                                                        printk("fault suite type in RSN pairwise key\n");
-                                                        break;
-                                	}
-
-				}
-                                else if(beacon->rsn_ie[8]==2){//mixed mode
-                                        ieee->pairwise_key_type = KEY_TYPE_CCMP;
-                                }
-                        }
-
-
-			beacon->rsn_ie[rsn_len - 2] = 0;
-			memcpy(tag,beacon->rsn_ie,rsn_len);
-		}
-	}
-#else
 	tag = skb_put(skb,ieee->wpa_ie_len);
 	memcpy(tag,ieee->wpa_ie,ieee->wpa_ie_len);
-#endif
+
 	tag = skb_put(skb,wmm_info_len);
 	if(wmm_info_len) {
 	  ieee80211_WMM_Info(ieee, &tag);
@@ -1827,12 +1612,6 @@ ieee80211_rx_assoc_rq(struct ieee80211_d
 	}
 
 	printk(KERN_INFO"New client associated: "MAC_FMT"\n", MAC_ARG(dest));
-	//FIXME
-	#if 0
-	spin_lock_irqsave(&ieee->lock,flags);
-	add_associate(ieee,dest);
-	spin_unlock_irqrestore(&ieee->lock,flags);
-	#endif
 }
 
 
@@ -1850,11 +1629,8 @@ void ieee80211_sta_ps_send_null_frame(st
 
 short ieee80211_sta_ps_sleep(struct ieee80211_device *ieee, u32 *time_h, u32 *time_l)
 {
-#if 0
-        int timeout = ieee->ps_timeout;
-#else
         int timeout = 0;
-#endif
+
 	u8 dtim;
 	/*if(ieee->ps == IEEE80211_PS_DISABLED ||
 		ieee->iw_mode != IW_MODE_INFRA ||
@@ -1885,13 +1661,7 @@ short ieee80211_sta_ps_sleep(struct ieee
 	if((ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE ) &&
 		(ieee->mgmt_queue_tail != ieee->mgmt_queue_head))
 		return 0;
-#if 0
-	if(time_l){
-		*time_l = ieee->current_network.last_dtim_sta_time[0]
-			+ (ieee->current_network.beacon_interval
-			* ieee->current_network.dtim_period) * 1000;
-	}
-#else
+
 	if(time_l){
 		*time_l = ieee->current_network.last_dtim_sta_time[0]
 			+ MSECS((ieee->current_network.beacon_interval));
@@ -1899,7 +1669,6 @@ short ieee80211_sta_ps_sleep(struct ieee
 			//printk("beacon_interval:%x, dtim_period:%x, totol to Msecs:%x, HZ:%x\n", ieee->current_network.beacon_interval, ieee->current_network.dtim_period, MSECS(((ieee->current_network.beacon_interval * ieee->current_network.dtim_period))), HZ);
 	}
 
-#endif
 	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])
@@ -2247,29 +2016,6 @@ void ieee80211_softmac_xmit(struct ieee8
 	int  i;
 
 	spin_lock_irqsave(&ieee->lock,flags);
-	#if 0
-	if(ieee->queue_stop){
-		IEEE80211DMESG("EE: IEEE hard_start_xmit invoked when kernel queue should be stopped");
-		netif_stop_queue(ieee->dev);
-		ieee->ieee_stats.swtxstop++;
-		//dev_kfree_skb_any(skb);
-		err = 1;
-		goto exit;
-	}
-
-	ieee->stats.tx_bytes+=skb->len;
-
-
-	txb=ieee80211_skb_to_txb(ieee,skb);
-
-
-	if(txb==NULL){
-		IEEE80211DMESG("WW: IEEE stack failed to provide txb");
-		//dev_kfree_skb_any(skb);
-		err = 1;
-		goto exit;
-	}
-	#endif
 
 	/* called with 2nd parm 0, no tx mgmt lock required */
 	ieee80211_sta_wakeup(ieee,0);
@@ -2844,11 +2590,7 @@ void ieee80211_softmac_init(struct ieee8
 //by amy
 
 	init_mgmt_queue(ieee);
-#if 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);
@@ -3306,26 +3048,3 @@ void notify_wx_assoc_event(struct ieee80
 		memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN);
 	wireless_send_event(ieee->dev, SIOCGIWAP, &wrqu, NULL);
 }
-
-
-#if 0
-EXPORT_SYMBOL(ieee80211_get_beacon);
-EXPORT_SYMBOL(ieee80211_wake_queue);
-EXPORT_SYMBOL(ieee80211_stop_queue);
-EXPORT_SYMBOL(ieee80211_reset_queue);
-EXPORT_SYMBOL(ieee80211_softmac_stop_protocol);
-EXPORT_SYMBOL(ieee80211_softmac_start_protocol);
-EXPORT_SYMBOL(ieee80211_is_shortslot);
-EXPORT_SYMBOL(ieee80211_is_54g);
-EXPORT_SYMBOL(ieee80211_wpa_supplicant_ioctl);
-EXPORT_SYMBOL(ieee80211_ps_tx_ack);
-EXPORT_SYMBOL(ieee80211_start_protocol);
-EXPORT_SYMBOL(ieee80211_stop_protocol);
-EXPORT_SYMBOL(notify_wx_assoc_event);
-EXPORT_SYMBOL(ieee80211_stop_send_beacons);
-EXPORT_SYMBOL(SendDisassociation);
-EXPORT_SYMBOL(ieee80211_disassociate);
-EXPORT_SYMBOL(ieee80211_start_scan);
-EXPORT_SYMBOL(ieee80211_softmac_ips_scan_syncro);
-EXPORT_SYMBOL(ieee80211_sta_ps_send_null_frame);
-#endif
Index: b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac_wx.c
===================================================================
--- a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac_wx.c
+++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac_wx.c
@@ -570,22 +570,3 @@ exit:
 	return ret;
 
 }
-
-#if 0
-EXPORT_SYMBOL(ieee80211_wx_get_essid);
-EXPORT_SYMBOL(ieee80211_wx_set_essid);
-EXPORT_SYMBOL(ieee80211_wx_set_rate);
-EXPORT_SYMBOL(ieee80211_wx_get_rate);
-EXPORT_SYMBOL(ieee80211_wx_set_wap);
-EXPORT_SYMBOL(ieee80211_wx_get_wap);
-EXPORT_SYMBOL(ieee80211_wx_set_mode);
-EXPORT_SYMBOL(ieee80211_wx_get_mode);
-EXPORT_SYMBOL(ieee80211_wx_set_scan);
-EXPORT_SYMBOL(ieee80211_wx_get_freq);
-EXPORT_SYMBOL(ieee80211_wx_set_freq);
-EXPORT_SYMBOL(ieee80211_wx_set_rawtx);
-EXPORT_SYMBOL(ieee80211_wx_get_name);
-EXPORT_SYMBOL(ieee80211_wx_set_power);
-EXPORT_SYMBOL(ieee80211_wx_get_power);
-EXPORT_SYMBOL(ieee80211_wlan_frequencies);
-#endif
Index: b/drivers/staging/rtl8187se/ieee80211/ieee80211_tx.c
===================================================================
--- a/drivers/staging/rtl8187se/ieee80211/ieee80211_tx.c
+++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_tx.c
@@ -585,7 +585,3 @@ int ieee80211_xmit(struct sk_buff *skb,
 	return NETDEV_TX_BUSY;
 
 }
-
-#if 0
-EXPORT_SYMBOL(ieee80211_txb_free);
-#endif
Index: b/drivers/staging/rtl8187se/ieee80211/ieee80211_wx.c
===================================================================
--- a/drivers/staging/rtl8187se/ieee80211/ieee80211_wx.c
+++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_wx.c
@@ -174,33 +174,6 @@ static inline char *rtl818x_translate_sc
 	if (iwe.u.data.length)
 		start = iwe_stream_add_point(info, start, stop, &iwe, custom);
 
-#if 0
-	if (ieee->wpa_enabled && network->wpa_ie_len){
-		char buf[MAX_WPA_IE_LEN * 2 + 30];
-	//	printk("WPA IE\n");
-		u8 *p = buf;
-		p += sprintf(p, "wpa_ie=");
-		for (i = 0; i < network->wpa_ie_len; i++) {
-			p += sprintf(p, "%02x", network->wpa_ie[i]);
-		}
-
-		memset(&iwe, 0, sizeof(iwe));
-		iwe.cmd = IWEVCUSTOM;
-		iwe.u.data.length = strlen(buf);
-		start = iwe_stream_add_point(info, start, stop, &iwe, buf);
-	}
-
-	if (ieee->wpa_enabled && network->rsn_ie_len){
-		char buf[MAX_WPA_IE_LEN * 2 + 30];
-
-		u8 *p = buf;
-		p += sprintf(p, "rsn_ie=");
-		for (i = 0; i < network->rsn_ie_len; i++) {
-			p += sprintf(p, "%02x", network->rsn_ie[i]);
-		}
-
-
-#else
 		memset(&iwe, 0, sizeof(iwe));
         if (network->wpa_ie_len) {
 	//	printk("wpa_ie_len:%d\n", network->wpa_ie_len);
@@ -214,14 +187,6 @@ static inline char *rtl818x_translate_sc
         memset(&iwe, 0, sizeof(iwe));
         if (network->rsn_ie_len) {
 	//	printk("=====>rsn_ie_len:\n", network->rsn_ie_len);
-		#if 0
-		{
-			int i;
-			for (i=0; i<network->rsn_ie_len; i++);
-			printk("%2x ", network->rsn_ie[i]);
-			printk("\n");
-		}
-		#endif
                 char buf[MAX_WPA_IE_LEN];
                 memcpy(buf, network->rsn_ie, network->rsn_ie_len);
                 iwe.cmd = IWEVGENIE;
@@ -229,8 +194,6 @@ static inline char *rtl818x_translate_sc
 		start = iwe_stream_add_point(info, start, stop, &iwe, buf);
 	}
 
-#endif
-
 	/* Add EXTRA: Age to display seconds since last beacon/probe response
 	 * for given network. */
 	iwe.cmd = IWEVCUSTOM;
@@ -578,12 +541,7 @@ int ieee80211_wx_set_encode_ext(struct i
 
 	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;
-#endif
+
         switch (ext->alg) {
         case IW_ENCODE_ALG_WEP:
                 alg = "WEP";
@@ -769,15 +727,6 @@ int ieee80211_wx_set_auth(struct ieee802
 #if 1
 int ieee80211_wx_set_gen_ie(struct ieee80211_device *ieee, u8 *ie, size_t len)
 {
-#if 0
-	printk("====>%s()\n", __func__);
-	{
-		int i;
-		for (i=0; i<len; i++)
-		printk("%2x ", ie[i]&0xff);
-		printk("\n");
-	}
-#endif
 	u8 *buf = NULL;
 
 	if (len>MAX_WPA_IE_LEN || (len && ie == NULL))
@@ -812,13 +761,3 @@ int ieee80211_wx_set_gen_ie(struct ieee8
 
 }
 #endif
-
-#if 0
-EXPORT_SYMBOL(ieee80211_wx_set_gen_ie);
-EXPORT_SYMBOL(ieee80211_wx_set_mlme);
-EXPORT_SYMBOL(ieee80211_wx_set_auth);
-EXPORT_SYMBOL(ieee80211_wx_set_encode_ext);
-EXPORT_SYMBOL(ieee80211_wx_get_scan);
-EXPORT_SYMBOL(ieee80211_wx_set_encode);
-EXPORT_SYMBOL(ieee80211_wx_get_encode);
-#endif
Index: b/drivers/staging/rtl8187se/r8180_core.c
===================================================================
--- a/drivers/staging/rtl8187se/r8180_core.c
+++ b/drivers/staging/rtl8187se/r8180_core.c
@@ -24,16 +24,6 @@
    add RTL8185 and RTL8225 support, and to David Young also.
 */
 
-#if 0
-double __floatsidf (int i) { return i; }
-unsigned int __fixunsdfsi (double d) { return d; }
-double __adddf3(double a, double b) { return a+b; }
-double __addsf3(float a, float b) { return a+b; }
-double __subdf3(double a, double b) { return a-b; }
-double __extendsfdf2(float a) {return a;}
-#endif
-
-
 #undef DEBUG_TX_DESC2
 #undef RX_DONT_PASS_UL
 #undef DEBUG_EPROM
@@ -93,36 +83,6 @@ static struct pci_device_id rtl8180_pci_
                 .subdevice = PCI_ANY_ID,
                 .driver_data = 0,
         },
-#if 0
-        {
-                .vendor = PCI_VENDOR_ID_BELKIN,
-                .device = 0x6001,
-                .subvendor = PCI_ANY_ID,
-                .subdevice = PCI_ANY_ID,
-                .driver_data = 1,
-        },
-        {       /* Belkin F5D6020 v3 */
-	        .vendor = PCI_VENDOR_ID_BELKIN,
-                .device = 0x6020,
-                .subvendor = PCI_ANY_ID,
-                .subdevice = PCI_ANY_ID,
-                .driver_data = 2,
-        },
-        {       /* D-Link DWL-610 */
-                .vendor = PCI_VENDOR_ID_DLINK,
-                .device = 0x3300,
-                .subvendor = PCI_ANY_ID,
-                .subdevice = PCI_ANY_ID,
-                .driver_data = 3,
-        },
-	{
-		.vendor = PCI_VENDOR_ID_REALTEK,
-		.device = 0x8185,
-		.subvendor = PCI_ANY_ID,
-		.subdevice = PCI_ANY_ID,
-		.driver_data = 4,
-	},
-#endif
         {
                 .vendor = 0,
                 .device = 0,
@@ -360,82 +320,6 @@ static int proc_get_stats_rx(char *page,
 	return len;
 }
 
-#if 0
-static int proc_get_stats_ieee(char *page, char **start,
-			  off_t offset, int count,
-			  int *eof, void *data)
-{
-	struct net_device *dev = data;
-	struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
-	int len = 0;
-
-	len += snprintf(page + len, count - len,
-		"TXed association requests: %u\n"
-		"TXed authentication requests: %u\n"
-		"RXed successful association response: %u\n"
-		"RXed failed association response: %u\n"
-		"RXed successful authentication response: %u\n"
-		"RXed failed authentication response: %u\n"
-		"Association requests without response: %u\n"
-		"Authentication requests without response: %u\n"
-		"TX probe response: %u\n"
-		"RX probe request: %u\n"
-		"TX probe request: %lu\n"
-		"RX authentication requests: %lu\n"
-		"RX association requests: %lu\n"
-		"Reassociations: %lu\n",
-		priv->ieee80211->ieee_stats.tx_ass,
-		priv->ieee80211->ieee_stats.tx_aut,
-		priv->ieee80211->ieee_stats.rx_ass_ok,
-		priv->ieee80211->ieee_stats.rx_ass_err,
-		priv->ieee80211->ieee_stats.rx_aut_ok,
-		priv->ieee80211->ieee_stats.rx_aut_err,
-		priv->ieee80211->ieee_stats.ass_noresp,
-		priv->ieee80211->ieee_stats.aut_noresp,
-		priv->ieee80211->ieee_stats.tx_probe,
-		priv->ieee80211->ieee_stats.rx_probe,
-		priv->ieee80211->ieee_stats.tx_probe_rq,
-		priv->ieee80211->ieee_stats.rx_auth_rq,
-		priv->ieee80211->ieee_stats.rx_assoc_rq,
-		priv->ieee80211->ieee_stats.reassoc);
-
-	*eof = 1;
-	return len;
-}
-#endif
-#if 0
-static int proc_get_stats_ap(char *page, char **start,
-			  off_t offset, int count,
-			  int *eof, void *data)
-{
-	struct net_device *dev = data;
-	struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-	struct mac_htable_t *list;
-	int i;
-	int len = 0;
-
-	if(priv->ieee80211->iw_mode != IW_MODE_MASTER){
-		len += snprintf(page + len, count - len,
-		"Card is not acting as AP...\n"
-		);
-	}else{
-		len += snprintf(page + len, count - len,
-		"List of associated STA:\n"
-		);
-
-		for(i=0;i<MAC_HTABLE_ENTRY;i++)
-			for (list = priv->ieee80211->assoc_htable[i]; list!=NULL; list = list->next){
-				len += snprintf(page + len, count - len,
-					MACSTR"\n",MAC2STR(list->adr));
-			}
-
-	}
-	*eof = 1;
-	return len;
-}
-#endif
-
 static int proc_get_stats_tx(char *page, char **start,
 			  off_t offset, int count,
 			  int *eof, void *data)
@@ -561,26 +445,6 @@ void rtl8180_proc_init_one(struct net_de
 		      "/proc/net/r8180/%s/stats-tx\n",
 		      dev->name);
 	}
-	#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/rtl8180/%s/stats-ieee\n",
-		      dev->name);
-	}
-	#endif
-	#if 0
-	e = create_proc_read_entry("stats-ap", S_IFREG | S_IRUGO,
-				   priv->dir_dev, proc_get_stats_ap, dev);
-
-	if (!e) {
-		DMESGE("Unable to initialize "
-		      "/proc/net/rtl8180/%s/stats-ap\n",
-		      dev->name);
-	}
-	#endif
 
 	e = create_proc_read_entry("registers", S_IFREG | S_IRUGO,
 				   priv->dir_dev, proc_get_registers, dev);
@@ -731,10 +595,6 @@ int get_curr_tx_free_desc(struct net_dev
 
 	/* FIXME FIXME FIXME FIXME */
 
-#if 0
-	if( head <= tail ) return priv->txringcount-1 - (tail - head)/8;
-	return (head - tail)/8/4;
-#else
 	if( head <= tail )
 		ret = priv->txringcount - (tail - head)/8;
 	else
@@ -742,7 +602,6 @@ int get_curr_tx_free_desc(struct net_dev
 
 	if(ret > priv->txringcount ) DMESG("BUG");
 	return ret;
-#endif
 }
 
 
@@ -1540,34 +1399,6 @@ void rtl8180_rtx_disable(struct net_devi
 		dev_kfree_skb_any(priv->rx_skb);
 }
 
-#if 0
-int alloc_tx_beacon_desc_ring(struct net_device *dev, int count)
-{
-	int i;
-	u32 *tmp;
-	struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
-	priv->txbeaconring = (u32*)pci_alloc_consistent(priv->pdev,
-					  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+2) = (u32)dma_tmp;
-		*(tmp+3) = bufsize;
-		*/
-		if(i+1<count)
-			*(tmp+4) = (u32)priv->txbeaconringdma+((i+1)*8*4);
-		else
-			*(tmp+4) = (u32)priv->txbeaconringdma;
-
-		tmp=tmp+8;
-	}
-	return 0;
-}
-#endif
-
 short alloc_tx_desc_ring(struct net_device *dev, int bufsize, int count,
 			 int addr)
 {
@@ -1601,28 +1432,6 @@ short alloc_tx_desc_ring(struct net_devi
 		if (buf == NULL) return -ENOMEM;
 
 		switch(addr) {
-#if 0
-		case TX_NORMPRIORITY_RING_ADDR:
-			if(-1 == buffer_add(&(priv->txnpbufs),buf,dma_tmp,NULL)){
-				DMESGE("Unable to allocate mem for buffer NP");
-				return -ENOMEM;
-			}
-			break;
-
-		case TX_LOWPRIORITY_RING_ADDR:
-			if(-1 == buffer_add(&(priv->txlpbufs),buf,dma_tmp,NULL)){
-				DMESGE("Unable to allocate mem for buffer LP");
-				return -ENOMEM;
-			}
-			break;
-
-		case TX_HIGHPRIORITY_RING_ADDR:
-			if(-1 == buffer_add(&(priv->txhpbufs),buf,dma_tmp,NULL)){
-				DMESGE("Unable to allocate mem for buffer HP");
-				return -ENOMEM;
-			}
-			break;
-#else
 		case TX_MANAGEPRIORITY_RING_ADDR:
 			if(-1 == buffer_add(&(priv->txmapbufs),buf,dma_tmp,NULL)){
 				DMESGE("Unable to allocate mem for buffer NP");
@@ -1655,7 +1464,6 @@ short alloc_tx_desc_ring(struct net_devi
 				return -ENOMEM;
 			}
 			break;
-#endif
 		case TX_HIGHPRIORITY_RING_ADDR:
 			if(-1 == buffer_add(&(priv->txhpbufs),buf,dma_tmp,NULL)){
 				DMESGE("Unable to allocate mem for buffer HP");
@@ -1764,22 +1572,6 @@ void free_tx_desc_rings(struct net_devic
 	buffer_free(dev,&(priv->txbeaconbufs),priv->txbuffsize,1);
 }
 
-#if 0
-void free_beacon_desc_ring(struct net_device *dev,int count)
-{
-
-	struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-	struct pci_dev *pdev=priv->pdev;
-
-	pci_free_consistent(pdev, sizeof(u32)*8*count+256,
-			    priv->txbeaconring, priv->txbeaconringdma);
-
-	if (priv->beacon_buf)
-		pci_free_consistent(priv->pdev,
-			priv->master_beaconsize,priv->beacon_buf,priv->beacondmabuf);
-
-}
-#endif
 void free_rx_desc_ring(struct net_device *dev)
 {
 	struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
@@ -2247,39 +2039,6 @@ void rtl8180_rx(struct net_device *dev)
 
 		}else{*/
 
-		#if 0
-		/* Maybe it is possible that the NIC has skipped some descriptors or
-		 * it has reset its internal pointer to the beginning of the ring
-		 * we search for the first filled descriptor in the ring, or we break
-		 * putting again the pointer in the old location if we do not found any.
-		 * This is quite dangerous, what does happen if the nic writes
-		 * two descriptor (say A and B) when we have just checked the descriptor
-		 * A and we are going to check the descriptor B..This might happen if the
-		 * interrupt was dummy, there was not really filled descriptors and
-		 * the NIC didn't lose pointer
-		 */
-
-		//priv->stats.rxwrkaround++;
-
-		tmp = priv->rxringtail;
-		while (*(priv->rxringtail) & (1<<31)){
-
-			priv->rxringtail+=4;
-
-			if(priv->rxringtail >=
-				(priv->rxring)+(priv->rxringcount )*4)
-				priv->rxringtail=priv->rxring;
-
-			priv->rxbuffer=(priv->rxbuffer->next);
-
-			if(priv->rxringtail == tmp ){
-				//DMESG("EE: Could not find RX pointer");
-				priv->stats.rxnopointer++;
-				break;
-			}
-		}
-		#else
-
 		tmp2 = NULL;
 		tmp = priv->rxringtail;
 		do{
@@ -2294,7 +2053,6 @@ void rtl8180_rx(struct net_device *dev)
 		}while(tmp != priv->rxring);
 
 		if(tmp2) priv->rxringtail = tmp2;
-		#endif
 		//}
 	}
 
@@ -2529,30 +2287,6 @@ void rtl8180_rx(struct net_device *dev)
 			/* support for prism header has been originally added by Christian */
 			if(priv->prism_hdr && priv->ieee80211->iw_mode == IW_MODE_MONITOR){
 
-#if 0
-				priv->rx_skb = dev_alloc_skb(len+2+PRISM_HDR_SIZE);
-				if(! priv->rx_skb) goto drop;
-
-				prism_hdr = (u32*) skb_put(priv->rx_skb,PRISM_HDR_SIZE);
-				prism_hdr[0]=htonl(0x80211001);        //version
-				prism_hdr[1]=htonl(0x40);              //length
-				prism_hdr[2]=htonl(stats.mac_time[1]);    //mactime (HIGH)
-				prism_hdr[3]=htonl(stats.mac_time[0]);    //mactime (LOW)
-				rdtsc(prism_hdr[5], prism_hdr[4]);         //hostime (LOW+HIGH)
-				prism_hdr[4]=htonl(prism_hdr[4]);          //Byte-Order aendern
-				prism_hdr[5]=htonl(prism_hdr[5]);          //Byte-Order aendern
-				prism_hdr[6]=0x00;                     //phytype
-				prism_hdr[7]=htonl(priv->chan);        //channel
-				prism_hdr[8]=htonl(stats.rate);        //datarate
-				prism_hdr[9]=0x00;                     //antenna
-				prism_hdr[10]=0x00;                    //priority
-				prism_hdr[11]=0x00;                    //ssi_type
-				prism_hdr[12]=htonl(stats.signal);     //ssi_signal
-				prism_hdr[13]=htonl(stats.noise);      //ssi_noise
-				prism_hdr[14]=0x00;                    //preamble
-				prism_hdr[15]=0x00;                    //encoding
-
-#endif
 			}else{
 				priv->rx_skb = dev_alloc_skb(len+2);
 				if( !priv->rx_skb) goto drop;
@@ -2737,21 +2471,6 @@ void rtl8180_dma_kick(struct net_device 
 	force_pci_posting(dev);
 }
 
-#if 0
-void rtl8180_tx_queues_stop(struct net_device *dev)
-{
-	//struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-	u8 dma_poll_mask = (1<<TX_DMA_STOP_LOWPRIORITY_SHIFT);
-	dma_poll_mask |= (1<<TX_DMA_STOP_HIPRIORITY_SHIFT);
-	dma_poll_mask |= (1<<TX_DMA_STOP_NORMPRIORITY_SHIFT);
-	dma_poll_mask |= (1<<TX_DMA_STOP_BEACON_SHIFT);
-
-	rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
-	write_nic_byte(dev,TX_DMA_POLLING,dma_poll_mask);
-	rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
-}
-#endif
-
 void rtl8180_data_hard_stop(struct net_device *dev)
 {
 	struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
@@ -2938,39 +2657,6 @@ void rtl8180_prepare_beacon(struct net_d
 			0,0,ieeerate2rtlrate(priv->ieee80211->basic_rate));
 		dev_kfree_skb_any(skb);
 	}
-	#if 0
-	//DMESG("size %x",len);
-	if(*tail & (1<<31)){
-
-		//DMESG("No more beacon TX desc");
-		return ;
-
-	}
-	//while(! (*tail & (1<<31))){
-		*tail= 0; // zeroes header
-
-		*tail = *tail| (1<<29) ; //fist segment of the packet
-		*tail = (*tail) | (1<<28); // last segment
-	//	*tail = *tail | (1<<18); // this is  a beacon frame
-		*(tail+3)=*(tail+3) &~ 0xfff;
-		*(tail+3)=*(tail+3) | len; // buffer lenght
-		*tail = *tail |len;
-		// zeroes the second 32-bits dword of the descriptor
-		*(tail+1)= 0;
-		*tail = *tail | (rate << 24);
-
-			duration = rtl8180_len2duration(len,rate,&ext);
-
-		*(tail+1) = *(tail+1) | ((duration & 0x7fff)<<16);
-
-		*tail = *tail | (1<<31);
-		//^ descriptor ready to be txed
-		if((tail - begin)/8 == priv->txbeaconcount-1)
-			tail=begin;
-		else
-			tail=tail+8;
-	//}
-#endif
 }
 
 /* This function do the real dirty work: it enqueues a TX command
@@ -3233,21 +2919,6 @@ short rtl8180_tx(struct net_device *dev,
 		//DMESG("rate %d",rate);
 
 		if(priv->card_8185){
-
-			#if 0
-			*(tail+5)&= ~(1<<24); /* tx ant 0 */
-
-			*(tail+5) &= ~(1<<23); /* random tx agc 23-16 */
-			*(tail+5) |= (1<<22)|(1<<21)|(1<<20)|(1<<19)|(1<<18)|(1<<17)|(1<<16);
-
-			*(tail+5) &=
-~((1<<15)|(1<<14)|(1<<13)|(1<<12)|(1<<11)|(1<<10)|(1<<9)|(1<<8));
-			*(tail+5) |= (7<<8); // Max retry limit
-
-			*(tail+5) &= ~((1<<7)|(1<<6)|(1<<5)|(1<<4)|(1<<3)|(1<<2)|(1<<1)|(1<<0));
-			*(tail+5) |= (8<<4); // Max contention window
-			*(tail+6) |= 4; // Min contention window
-			#endif
            //    	*(tail+5) = 0;
 		}
 
@@ -3387,29 +3058,6 @@ void rtl8180_link_change(struct net_devi
 	u16 = u16 &~ ATIM_MASK;
 	u16 = u16 | beacon->atim;
 	*/
-#if 0
-	if (net->capability & WLAN_CAPABILITY_PRIVACY) {
-		if (priv->hw_wep) {
-			DMESG("Enabling hardware WEP support");
-			rtl8180_set_hw_wep(dev);
-			priv->ieee80211->host_encrypt=0;
-			priv->ieee80211->host_decrypt=0;
-		}
-#ifndef CONFIG_IEEE80211_NOWEP
-		else {
-			priv->ieee80211->host_encrypt=1;
-			priv->ieee80211->host_decrypt=1;
-		}
-#endif
-	}
-#ifndef CONFIG_IEEE80211_NOWEP
-	else{
-		priv->ieee80211->host_encrypt=0;
-		priv->ieee80211->host_decrypt=0;
-	}
-#endif
-#endif
-
 
 	if(priv->card_8185)
 		rtl8180_set_chan(dev, priv->chan);
@@ -3811,13 +3459,6 @@ short rtl8180_init(struct net_device *de
 	u16 tmpu16;
 	int i, j;
 
-#if 0
-	for(i=0;i<0xFF;i++) {
-		if(i%16 == 0)
-			printk("\n[%x]: ", i/16);
-		printk("\t%4.4x", eprom_read(dev,i));
-	}
-#endif
 	priv->channel_plan = eprom_read(dev, EEPROM_COUNTRY_CODE>>1) & 0xFF;
 	if(priv->channel_plan > COUNTRY_CODE_GLOBAL_DOMAIN){
 		printk("rtl8180_init:Error channel plan! Set to default.\n");
@@ -3853,39 +3494,8 @@ short rtl8180_init(struct net_device *de
 	priv->irq_enabled=0;
 
 //YJ,modified,080828
-#if 0
-	priv->stats.rxdmafail=0;
-	priv->stats.txrdu=0;
-	priv->stats.rxrdu=0;
-	priv->stats.rxnolast=0;
-	priv->stats.rxnodata=0;
-	//priv->stats.rxreset=0;
-	//priv->stats.rxwrkaround=0;
-	priv->stats.rxnopointer=0;
-	priv->stats.txnperr=0;
-	priv->stats.txresumed=0;
-	priv->stats.rxerr=0;
-	priv->stats.rxoverflow=0;
-	priv->stats.rxint=0;
-	priv->stats.txnpokint=0;
-	priv->stats.txhpokint=0;
-	priv->stats.txhperr=0;
-	priv->stats.ints=0;
-	priv->stats.shints=0;
-	priv->stats.txoverflow=0;
-	priv->stats.txbeacon=0;
-	priv->stats.txbeaconerr=0;
-	priv->stats.txlperr=0;
-	priv->stats.txlpokint=0;
-	priv->stats.txretry=0;//tony 20060601
-	priv->stats.rxcrcerrmin=0;
-	priv->stats.rxcrcerrmid=0;
-	priv->stats.rxcrcerrmax=0;
-	priv->stats.rxicverr=0;
-#else
 	rtl8180_statistics_init(&priv->stats);
 	rtl8180_link_detect_init(&priv->link_detect);
-#endif
 //YJ,modified,080828,end
 
 
@@ -4532,24 +4142,13 @@ void rtl8185_write_phy(struct net_device
 	adr |= 0x80;
 
 	phyw= ((data<<8) | adr);
-#if 0
-
-	write_nic_dword(dev, PHY_ADR, phyw);
-
-	//read_nic_dword(dev, PHY_ADR);
-	for(i=0;i<10;i++){
-		write_nic_dword(dev, PHY_ADR, 0xffffff7f & phyw);
-		phyr = read_nic_byte(dev, PHY_READ);
-		if(phyr == (data&0xff)) break;
 
-	}
-#else
 	// Note that, we must write 0xff7c after 0x7d-0x7f to write BB register.
 	write_nic_byte(dev, 0x7f, ((phyw & 0xff000000) >> 24));
 	write_nic_byte(dev, 0x7e, ((phyw & 0x00ff0000) >> 16));
 	write_nic_byte(dev, 0x7d, ((phyw & 0x0000ff00) >> 8));
 	write_nic_byte(dev, 0x7c, ((phyw & 0x000000ff) ));
-#endif
+
 	/* this is ok to fail when we write AGC table. check for AGC table might be
 	 * done by masking with 0x7f instead of 0xff
 	 */
@@ -4806,19 +4405,7 @@ void rtl8180_start_tx_beacon(struct net_
 	rtl8180_prepare_beacon(dev);
 	rtl8180_irq_disable(dev);
 	rtl8180_beacon_tx_enable(dev);
-#if 0
-	rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
-	//write_nic_byte(dev,0x9d,0x20); //DMA Poll
-	//write_nic_word(dev,0x7a,0);
-	//write_nic_word(dev,0x7a,0x8000);
 
-#if 0
-	word  = read_nic_word(dev, BcnItv);
-	word &= ~BcnItv_BcnItv; // clear Bcn_Itv
-	word |= priv->ieee80211->current_network.beacon_interval;//0x64;
-	write_nic_word(dev, BcnItv, word);
-#endif
-#endif
 	word = read_nic_word(dev, AtimWnd) &~ AtimWnd_AtimWnd;
 	write_nic_word(dev, AtimWnd,word);// word |=
 //priv->ieee80211->current_network.atim_window);
@@ -4887,16 +4474,7 @@ MgntActSet_802_11_PowerSaveMode(
 //	priv->dot11PowerSaveMode = rtPsMode;
 	priv->ieee80211->ps = rtPsMode;
 	// Determine ListenInterval.
-#if 0
-	if(priv->dot11PowerSaveMode == eMaxPs)
-	{
-		priv->ieee80211->ListenInterval = 10;
-	}
-	else
-	{
-		priv->ieee80211->ListenInterval = 2;
-	}
-#endif
+
 	return true;
 }
 
@@ -5058,31 +4636,6 @@ void rtl8180_watch_dog(struct net_device
 	}
 #endif
 
-#if 0
-#ifndef ENABLE_LPS
-	if(priv->ieee80211->state == IEEE80211_LINKED){
-		if(	priv->NumRxOkInPeriod> 666 ||
-			priv->NumTxOkInPeriod > 666 ) {
-			bBusyTraffic = true;
-		}
-		if((priv->ieee80211->NumRxData + priv->NumTxOkInPeriod)<8) {
-			bEnterPS= true;
-		}
-		if(bEnterPS) {
-			LeisurePSEnter(priv);
-		}
-		else {
-			LeisurePSLeave(priv);
-		}
-	}
-	else	{
-		LeisurePSLeave(priv);
-	}
-#endif
-	priv->NumRxOkInPeriod = 0;
-	priv->NumTxOkInPeriod = 0;
-	priv->ieee80211->NumRxData = 0;
-#else
 #ifdef ENABLE_LPS
 	if(priv->ieee80211->state == IEEE80211_LINKED){
 		priv->link_detect.NumRxOkInPeriod = priv->ieee80211->NumRxDataInPeriod;
@@ -5115,7 +4668,6 @@ void rtl8180_watch_dog(struct net_device
 	priv->link_detect.NumTxOkInPeriod = 0;
 	priv->ieee80211->NumRxDataInPeriod = 0;
 	priv->ieee80211->NumRxBcnInPeriod = 0;
-#endif
 }
 int _rtl8180_up(struct net_device *dev)
 {
@@ -5288,21 +4840,6 @@ static void r8180_set_multicast(struct n
 	//up(&priv->wx_sem);
 }
 
-#if 0
-/* this is called by the kernel when it needs to TX a 802.3 encapsulated frame*/
-int rtl8180_8023_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
-{
-	struct r8180_priv *priv = ieee80211_priv(dev);
-	int ret;
-	unsigned long flags;
-
-	spin_lock_irqsave(&priv->tx_lock,flags);
-	ret = ieee80211_r8180_8023_hardstartxmit(skb,priv->ieee80211);
-	spin_unlock_irqrestore(&priv->tx_lock,flags);
-	return ret;
-}
-#endif
-
 int r8180_set_mac_adr(struct net_device *dev, void *mac)
 {
 	struct r8180_priv *priv = ieee80211_priv(dev);
@@ -5766,20 +5303,7 @@ priv->txnpring)/8);
 		else
 			head+=8;
 	}
-#if 0
-	if(nicv == begin)
-		txdv = begin + (priv->txringcount -1)*8;
-	else
-		txdv = nicv - 8;
 
-	txed = !(txdv[0] &(1<<31));
-
-	if(txed){
-		if(!(txdv[0] & (1<<15))) error = 1;
-		//if(!(txdv[0] & (1<<30))) error = 1;
-		if(error)DMESG("%x",txdv[0]);
- 	}
-#endif
 	//DMESG("%x",txdv[0]);
 	/* the head has been moved to the last certainly TXed
 	 * (or at least processed by the nic) packet.
@@ -6131,14 +5655,6 @@ void GPIOChangeRFWorkItemCallBack(struct
 
 	readf_count = (readf_count+1)%0xffff;
 #endif
-#if 0
-	if(priv->up == 0)//driver stopped
-		{
-			printk("\nDo nothing...");
-			goto out;
-		}
-	else
-#endif
 		{
 			// We should turn off LED before polling FF51[4].
 
@@ -6193,40 +5709,6 @@ void GPIOChangeRFWorkItemCallBack(struct
 
 static u8 read_acadapter_file(char *filename)
 {
-#if 0
-	int fd;
-	char buf[1];
-	char ret[50];
-	int i = 0;
-	int n = 0;
-	mm_segment_t old_fs = get_fs();
-	set_fs(KERNEL_DS);
-
-	fd = sys_open(filename, O_RDONLY, 0);
-	if (fd >= 0) {
-		while (sys_read(fd, buf, 1) == 1)
-		{
-			i++;
-			if(i>10)
-			{
-				if(buf[0]!=' ')
-				{
-					ret[n]=buf[0];
-					n++;
-				}
-			}
-		}
-		sys_close(fd);
-	}
-	ret[n]='\0';
-//	printk("%s \n", ret);
-	set_fs(old_fs);
-
-	if(strncmp(ret, "off-line",8) == 0)
-	{
-		return 1;
-	}
-#endif
 	return 0;
 }
 
Index: b/drivers/staging/rtl8187se/r8180_dm.c
===================================================================
--- a/drivers/staging/rtl8187se/r8180_dm.c
+++ b/drivers/staging/rtl8187se/r8180_dm.c
@@ -1380,12 +1380,6 @@ SwitchAntenna(
 
 	if(priv->CurrAntennaIndex == 0)
 	{
-#if 0//lzm del 080826
-//by amy 080312
-		if(priv->bSwAntennaDiverity)
-			bResult = SetAntennaConfig87SE(dev, 1, true);
-		else
-#endif
 			bResult = SetAntenna8185(dev, 1);
 //by amy 080312
 //		printk("SwitchAntenna(): switching to antenna 1 ......\n");
@@ -1393,12 +1387,6 @@ SwitchAntenna(
 	}
 	else
 	{
-#if 0//lzm del 080826
-//by amy 080312
-		if(priv->bSwAntennaDiverity)
-			bResult = SetAntennaConfig87SE(dev, 0, true);
-		else
-#endif
 			bResult = SetAntenna8185(dev, 0);
 //by amy 080312
 //		printk("SwitchAntenna(): switching to antenna 0 ......\n");
Index: b/drivers/staging/rtl8187se/r8180_max2820.c
===================================================================
--- a/drivers/staging/rtl8187se/r8180_max2820.c
+++ b/drivers/staging/rtl8187se/r8180_max2820.c
@@ -50,75 +50,6 @@ u32 maxim_chan[] = {
 	84, //14
 };
 
-#if 0
-/* maxim expects 4 bit address MSF, then 12 bit data MSF*/
-void write_maxim(struct net_device *dev,u8 adr, u32 data)
-{
-
-	int shift;
-	short bit;
-	u16 word;
-
-	adr = adr &0xf;
-	word = (u16)data & 0xfff;
-	word |= (adr<<12);
-	/*write_nic_dword(dev,PHY_CONFIG,BB_HOST_BANG | BB_HOST_BANG_EN);
-	read_nic_dword(dev,PHY_CONFIG);
-	mdelay(1);
-
-	write_nic_dword(dev,PHY_CONFIG,BB_HOST_BANG | BB_HOST_BANG_EN | BB_HOST_BANG_CLK);
-	read_nic_dword(dev,PHY_CONFIG);
-	mdelay(1);
-	*/
-
-	/* MAX2820 will sample data on rising edge of clock */
-	for(shift = 15;shift >=0; shift--){
-		bit = word>>shift & 1;
-
-		write_nic_dword(dev,PHY_CONFIG,BB_HOST_BANG | (bit<<BB_HOST_BANG_DATA));
-
-		read_nic_dword(dev,PHY_CONFIG);
-		mdelay(2);
-
-		write_nic_dword(dev,PHY_CONFIG,BB_HOST_BANG |
-		(bit<<BB_HOST_BANG_DATA) | BB_HOST_BANG_CLK); /* sample data */
-
-		read_nic_dword(dev,PHY_CONFIG);
-		mdelay(1);
-
-		write_nic_dword(dev,PHY_CONFIG,BB_HOST_BANG |
-		(bit<<BB_HOST_BANG_DATA));
-
-		read_nic_dword(dev,PHY_CONFIG);
-		mdelay(2);
-
-	}
-	write_nic_dword(dev,PHY_CONFIG,BB_HOST_BANG | (bit<<BB_HOST_BANG_DATA)|
-					BB_HOST_BANG_EN);
-	read_nic_dword(dev,PHY_CONFIG);
-	mdelay(2);
-
-	/* The shift register fill flush to the requested register the
-	 * last 12 bits data shifted in
-	 */
-	write_nic_dword(dev,PHY_CONFIG,BB_HOST_BANG | (bit<<BB_HOST_BANG_DATA)|
-					BB_HOST_BANG_EN | BB_HOST_BANG_CLK);
-	read_nic_dword(dev,PHY_CONFIG);
-	mdelay(2);
-
-	write_nic_dword(dev,PHY_CONFIG,BB_HOST_BANG | (bit<<BB_HOST_BANG_DATA)|
-					BB_HOST_BANG_EN);
-	read_nic_dword(dev,PHY_CONFIG);
-	mdelay(2);
-
-
-#ifdef DEBUG_MAXIM
-	DMESG("Writing maxim: %x (adr %x)",phy_config,adr);
-#endif
-
-}
-#endif
-
 void write_maxim(struct net_device *dev,u8 adr, u32 data) {
 	u32 temp;
 	temp =  0x90 + (data & 0xf);
Index: b/drivers/staging/rtl8187se/r8180_rtl8225.c
===================================================================
--- a/drivers/staging/rtl8187se/r8180_rtl8225.c
+++ b/drivers/staging/rtl8187se/r8180_rtl8225.c
@@ -26,18 +26,6 @@ u8 rtl8225_gain[]={
 	0x63,0x58,0x70,0xc5,// -66dbm
 };
 
-#if 0
-u8 rtl8225_init_gain[]={
-	//0x00,0x00,0x00,0x00,//0x00,0x00,0x00,0x00,
-	0x33,0x80,0x6c,0xc5,//0x00,0x49,0x06,0xb5,//Gain = 0 ~ -78dbm
-	0x43,0x78,0x69,0xc5,//0x00,0x45,0x06,0xb1,//Gain = 1 ~ -74dbm
-	0x53,0x60,0x66,0xc5,//0x00,0x41,0x06,0xab,//Gain = 2 ~ -70dbm
-	0x63,0x58,0x63,0xc5,//0x00,0x3d,0x06,0xa5,//Gain = 3 ~ -66dbm
-	0x73,0x50,0x62,0xc5,//0x00,0x39,0x06,0xa1,//Gain = 4 ~ -62dbm
-	0x83,0x43,0x61,0xc5,//0x00,0x35,0x06,0x9b,//Gain = 5 ~ -58dbm
-	0x93,0x38,0x5a,0xc5,//0x00,0x31,0x06,0x99,//Gain = 6 ~ -54dbm
-};
-#endif
 u32 rtl8225_chan[] ={
               0,
 		0x0080, //ch1
@@ -72,41 +60,6 @@ u16 rtl8225bcd_rxgain[]={
 
 };
 
-
-#if 0
-u16 rtl8225bc_rxgain[]={
-	0x0400, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0408, 0x0409,
-	0x040a, 0x040b, 0x0502, 0x0503, 0x0504, 0x0505, 0x0540, 0x0541,
-	0x0542, 0x0543, 0x0544, 0x0545, 0x0580, 0x0581, 0x0582, 0x0583,
-	0x0584, 0x0585, 0x0588, 0x0589, 0x058a, 0x058b, 0x0643, 0x0644,
-	0x0645, 0x0680, 0x0681, 0x0682, 0x0683, 0x0684, 0x0685, 0x0688,
-	0x0689, 0x068a, 0x068b, 0x068c, 0x0742, 0x0743, 0x0744, 0x0745,
-	0x0780, 0x0781, 0x0782, 0x0783, 0x0784, 0x0785, 0x0788, 0x0789,
-	0x078a, 0x078b, 0x078c, 0x078d, 0x0790, 0x0791, 0x0792, 0x0793,
-	0x0794, 0x0795, 0x0798, 0x0799, 0x039a, 0x039b, 0x039c, 0x039d,
-	0x03a0, 0x03a1, 0x03a2, 0x03a3, 0x03a4, 0x03a5, 0x03a8, 0x03a9,
-	0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03b0, 0x03b1, 0x03b2, 0x03b3,
-	0x03b4, 0x03b5, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bb
-
-};
-
-
-u16 rtl8225a_rxgain[]={
-	0x0400, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0408, 0x0409,
-	0x040a, 0x040b, 0x0502, 0x0503, 0x0504, 0x0505, 0x0540, 0x0541,
-	0x0542, 0x0543, 0x0544, 0x0545, 0x0580, 0x0581, 0x0582, 0x0583,
-	0x0584, 0x0585, 0x0588, 0x0589, 0x058a, 0x058b, 0x0643, 0x0644,
-	0x0645, 0x0680, 0x0681, 0x0682, 0x0683, 0x0684, 0x0685, 0x0688,
-	0x0689, 0x068a, 0x068b, 0x068c, 0x0742, 0x0743, 0x0744, 0x0745,
-	0x0780, 0x0781, 0x0782, 0x0783, 0x0784, 0x0785, 0x0788, 0x0789,
-	0x078a, 0x078b, 0x078c, 0x078d, 0x0790, 0x0791, 0x0792, 0x0793,
-	0x0794, 0x0795, 0x0798, 0x0799, 0x079a, 0x079b, 0x079c, 0x079d,
-	0x07a0, 0x07a1, 0x07a2, 0x07a3, 0x07a4, 0x07a5, 0x07a8, 0x07a9,
-	0x07aa, 0x07ab, 0x07ac, 0x07ad, 0x07ad, 0x07ad, 0x07ad, 0x07ad,
-	0x07ad, 0x07ad, 0x07ad, 0x07ad, 0x07ad, 0x07ad, 0x07ad
-};
-#endif
-
 u8 rtl8225_agc[]={
 	0x9e,0x9e,0x9e,0x9e,0x9e,0x9e,0x9e,0x9e,0x9d,0x9c,0x9b,0x9a,0x99,0x98,0x97,0x96,
 	0x95,0x94,0x93,0x92,0x91,0x90,0x8f,0x8e,0x8d,0x8c,0x8b,0x8a,0x89,0x88,0x87,0x86,
@@ -156,40 +109,6 @@ void rtl8225_set_gain(struct net_device 
 	write_phy_ofdm(dev, 0x1b, rtl8225_gain[gain * 4 + 2]);
 	write_phy_ofdm(dev, 0x1d, rtl8225_gain[gain * 4 + 3]);
 }
-#if 0
-
-void rtl8225_set_gain(struct net_device *dev, short gain)
-{
-	struct r8180_priv *priv = ieee80211_priv(dev);
-
-	rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
-
-	if(priv->card_8185 == 2)
-		write_phy_ofdm(dev, 0x21, 0x27);
-	else
-		write_phy_ofdm(dev, 0x21, 0x37);
-
-	write_phy_ofdm(dev, 0x25, 0x20);
-	write_phy_ofdm(dev, 0x11, 0x6);
-
-	if(priv->card_8185 == 1 && priv->card_8185_Bversion)
-		write_phy_ofdm(dev, 0x27, 0x8);
-	else
-		write_phy_ofdm(dev, 0x27, 0x88);
-
-	write_phy_ofdm(dev, 0x14, 0);
-	write_phy_ofdm(dev, 0x16, 0);
-	write_phy_ofdm(dev, 0x15, 0x40);
-	write_phy_ofdm(dev, 0x17, 0x40);
-
-	write_phy_ofdm(dev, 0x0d, rtl8225_gain[gain * 4]);
-	write_phy_ofdm(dev, 0x23, rtl8225_gain[gain * 4 + 1]);
-	write_phy_ofdm(dev, 0x1b, rtl8225_gain[gain * 4 + 2]);
-	write_phy_ofdm(dev, 0x1d, rtl8225_gain[gain * 4 + 3]);
-	//rtl8225_set_gain_usb(dev, gain);
-}
-#endif
-
 
 void write_rtl8225(struct net_device *dev, u8 adr, u16 data)
 {
@@ -366,14 +285,7 @@ void rtl8225_SetTXPowerLevel(struct net_
 	mdelay(1);
 	//write_nic_byte(dev, TX_AGC_CONTROL,4);
 }
-#if 0
-/* switch between mode B and G */
-void rtl8225_set_mode(struct net_device *dev, short modeb)
-{
-	write_phy_ofdm(dev, 0x15, (modeb ? 0x0 : 0x40));
-	write_phy_ofdm(dev, 0x17, (modeb ? 0x0 : 0x40));
-}
-#endif
+
 void rtl8225_rf_set_chan(struct net_device *dev, short ch)
 {
 	struct r8180_priv *priv = ieee80211_priv(dev);
@@ -441,33 +353,6 @@ void rtl8225_host_pci_init(struct net_de
 
 void rtl8225_host_usb_init(struct net_device *dev)
 {
-	#if 0
-	write_nic_byte(dev,RFPinsSelect+1,0);
-
-	write_nic_byte(dev,GPIO,0);
-
-	write_nic_byte_E(dev,0x53,read_nic_byte_E(dev,0x53) | (1<<7));
-
-	write_nic_byte(dev,RFPinsSelect+1,4);
-
-	write_nic_byte(dev,GPIO,0x20);
-
-	write_nic_byte(dev,GP_ENABLE,0);
-
-
-	/* Config BB & RF */
-	write_nic_word(dev, RFPinsOutput, 0x80);
-
-	write_nic_word(dev, RFPinsSelect, 0x80);
-
-	write_nic_word(dev, RFPinsEnable, 0x80);
-
-
-	mdelay(100);
-
-	mdelay(1000);
-#endif
-
 }
 
 void rtl8225_rf_sleep(struct net_device *dev)
@@ -511,20 +396,6 @@ void rtl8225_rf_init(struct net_device *
 
 	write_nic_word(dev, BRSR, 0xffff);
 
-	#if 0
-	if(priv->card_8185 == 1){/* version C or B */
-		if(priv->card_8185_Bversion)  /* version B*/
-			write_nic_dword(dev, RF_PARA, 0x44);
-		else    /* version C */
-			write_nic_dword(dev, RF_PARA, 0x100044);
-	}else{ /* version D */
-		if(priv->enable_gpio0)
-			write_nic_dword(dev, RF_PARA, 0x20100044);
-		else /* also USB */
-			write_nic_dword(dev, RF_PARA, 0x100044);
-	}
-	#endif
-
 	write_nic_dword(dev, RF_PARA, 0x100044);
 
 	#if 1  //0->1
@@ -555,13 +426,6 @@ void rtl8225_rf_init(struct net_device *
 
 	mdelay(1);
 
-
-	#if 0
-	}else if(priv->phy_ver == 1){
-		/* version A */
-		write_rtl8225(dev, 0x5, 0xbc0 + 2);
-	}else{
-	#endif
 	/* version B & C */
 
 	if(priv->card_type == USB)
@@ -628,12 +492,6 @@ void rtl8225_rf_init(struct net_device *
 	for(i=0;i<95;i++){
 		write_rtl8225(dev, 0x1, (u8)(i+1));
 
-		#if 0
-		if(priv->phy_ver == 1)
-			/* version A */
-			write_rtl8225(dev, 0x2, rtl8225a_rxgain[i]);
-		else
-		#endif
 		/* version B & C & D*/
 
 		write_rtl8225(dev, 0x2, rtl8225bcd_rxgain[i]);
@@ -681,18 +539,6 @@ void rtl8225_rf_init(struct net_device *
 	write_phy_ofdm(dev, 0x8, 0x40); mdelay(1);
 	write_phy_ofdm(dev, 0x9, 0xfe); mdelay(1);
 
-	#if 0
-	if(priv->card_type == USB){
-		write_phy_ofdm(dev, 0xa, 0x9);
-	}else{
-		if(priv->card_8185 == 1 && priv->card_8185_Bversion){
-			/* Ver B
-			* maybe later version can accept this also?
-			*/
-			write_phy_ofdm(dev, 0xa, 0x6);
-			write_phy_ofdm(dev, 0x18, 0x6f);
-		}else{
-	#endif
 			/* ver C & D */
 	write_phy_ofdm(dev, 0xa, 0x9); mdelay(1);
 
@@ -710,14 +556,6 @@ void rtl8225_rf_init(struct net_device *
 	write_phy_ofdm(dev, 0xe, 0xd3);mdelay(1);
 
 
-	#if 0
-	if(priv->card_8185 == 1){
-		if(priv->card_8185_Bversion)
-			write_phy_ofdm(dev, 0xf, 0x20);/*ver B*/
-		else
-			write_phy_ofdm(dev, 0xf, 0x28);/*ver C*/
-	}else{
-	#endif
 	write_phy_ofdm(dev, 0xf, 0x38);mdelay(1);
 /*ver D & 8187*/
 //	}
@@ -738,13 +576,6 @@ void rtl8225_rf_init(struct net_device *
 
 	write_phy_ofdm(dev, 0x13, 0x20);mdelay(1);
 
-#if 0
-	}else{
-		/* Ver B & C*/
-		write_phy_ofdm(dev, 0x12, 0x0);
-		write_phy_ofdm(dev, 0x13, 0x0);
-	}
-#endif
 	write_phy_ofdm(dev, 0x14, 0x0); mdelay(1);
 	write_phy_ofdm(dev, 0x15, 0x40); mdelay(1);
 	write_phy_ofdm(dev, 0x16, 0x0); mdelay(1);
@@ -769,20 +600,6 @@ void rtl8225_rf_init(struct net_device *
 
 	write_phy_ofdm(dev, 0x1c, 0x4);mdelay(1);
 
-#if 0
-	if(priv->card_8185 == 1){
-		if(priv->card_8185_Bversion){
-			/*ver B*/
-			write_phy_ofdm(dev, 0x1e, 0x95);
-			write_phy_ofdm(dev, 0x1f, 0x55);
-		}else{
-			/*ver C*/
-			write_phy_ofdm(dev, 0x1e, 0x90);
-			write_phy_ofdm(dev, 0x1f, 0x34);
-
-		}
-	}else{
-#endif
 		/*ver D & 8187*/
 	write_phy_ofdm(dev, 0x1e, 0x95);mdelay(1);
 
@@ -802,11 +619,6 @@ void rtl8225_rf_init(struct net_device *
 	write_phy_ofdm(dev, 0x24, 0x46); mdelay(1);
 	write_phy_ofdm(dev, 0x25, 0x20); mdelay(1);
 	write_phy_ofdm(dev, 0x26, 0x90); mdelay(1);
-#if 0
-	if(priv->card_8185 == 1 && priv->card_8185_Bversion)
-		write_phy_ofdm(dev, 0x27, 0x08); /* Ver B. might work also fo ver C&D ?*/
-	else
-#endif
 	write_phy_ofdm(dev, 0x27, 0x88); mdelay(1);
 /* Ver C & D & 8187*/
 
@@ -824,11 +636,6 @@ void rtl8225_rf_init(struct net_device *
 	write_phy_cck(dev, 0x4, 0x7e); mdelay(1);
 	write_phy_cck(dev, 0x5, 0x12); mdelay(1);
 	write_phy_cck(dev, 0x6, 0xfc); mdelay(1);
-#if 0
-	if(priv->card_8185 == 1 && priv->card_8185_Bversion)
-		write_phy_cck(dev, 0x7, 0xd8); /* Ver B */
-	else
-#endif
 	write_phy_cck(dev, 0x7, 0x78);mdelay(1);
  /* Ver C & D & 8187*/
 
@@ -837,11 +644,6 @@ void rtl8225_rf_init(struct net_device *
 	write_phy_cck(dev, 0x10, ((priv->card_type == USB) ? 0x9b: 0x93)); mdelay(1);
 	write_phy_cck(dev, 0x11, 0x88); mdelay(1);
 	write_phy_cck(dev, 0x12, 0x47); mdelay(1);
-#if 0
-	if(priv->card_8185 == 1 && priv->card_8185_Bversion)
-		write_phy_cck(dev, 0x13, 0x98); /* Ver B */
-	else
-#endif
 	write_phy_cck(dev, 0x13, 0xd0); /* Ver C & D & 8187*/
 
 	write_phy_cck(dev, 0x19, 0x0);
Index: b/drivers/staging/rtl8187se/r8180_rtl8225z2.c
===================================================================
--- a/drivers/staging/rtl8187se/r8180_rtl8225z2.c
+++ b/drivers/staging/rtl8187se/r8180_rtl8225z2.c
@@ -46,26 +46,6 @@ u8 rtl8225z2_gain_a[]={
 	0x63,0x24,0x4f,//,0x37,// -70dbm
 	0x73,0x0f,0x4c,//,0x37,// -66dbm
 };
-#if 0
-u32 rtl8225_chan[] = {
-	0,	//dummy channel 0
-	0x085c, //1
-	0x08dc, //2
-	0x095c, //3
-	0x09dc, //4
-	0x0a5c, //5
-	0x0adc, //6
-	0x0b5c, //7
-	0x0bdc, //8
-	0x0c5c, //9
-	0x0cdc, //10
-	0x0d5c, //11
-	0x0ddc, //12
-	0x0e5c, //13
-	//0x0f5c, //14
-	0x0f72, // 14
-};
-#endif
 
 //-
 u16 rtl8225z2_rxgain[]={
@@ -94,19 +74,6 @@ u8 ZEBRA2_CCK_OFDM_GAIN_SETTING[]={
         0x1e,0x1f,0x20,0x21,0x22,0x23,
 };
 
-#if 0
-//-
-u8 rtl8225_agc[]={
-	0x9e,0x9e,0x9e,0x9e,0x9e,0x9e,0x9e,0x9e,0x9d,0x9c,0x9b,0x9a,0x99,0x98,0x97,0x96,
-	0x95,0x94,0x93,0x92,0x91,0x90,0x8f,0x8e,0x8d,0x8c,0x8b,0x8a,0x89,0x88,0x87,0x86,
-	0x85,0x84,0x83,0x82,0x81,0x80,0x3f,0x3e,0x3d,0x3c,0x3b,0x3a,0x39,0x38,0x37,0x36,
-	0x35,0x34,0x33,0x32,0x31,0x30,0x2f,0x2e,0x2d,0x2c,0x2b,0x2a,0x29,0x28,0x27,0x26,
-	0x25,0x24,0x23,0x22,0x21,0x20,0x1f,0x1e,0x1d,0x1c,0x1b,0x1a,0x19,0x18,0x17,0x16,
-	0x15,0x14,0x13,0x12,0x11,0x10,0x0f,0x0e,0x0d,0x0c,0x0b,0x0a,0x09,0x08,0x07,0x06,
-	0x05,0x04,0x03,0x02,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
-	0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
-};
-#endif
 /*
  from 0 to 0x23
 u8 rtl8225_tx_gain_cck_ofdm[]={
@@ -155,40 +122,6 @@ void rtl8225z2_set_gain(struct net_devic
 
 }
 
-#if 0
-
-void rtl8225_set_gain(struct net_device *dev, short gain)
-{
-	struct r8180_priv *priv = ieee80211_priv(dev);
-
-	rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
-
-	if(priv->card_8185 == 2)
-		write_phy_ofdm(dev, 0x21, 0x27);
-	else
-		write_phy_ofdm(dev, 0x21, 0x37);
-
-	write_phy_ofdm(dev, 0x25, 0x20);
-	write_phy_ofdm(dev, 0x11, 0x6);
-
-	if(priv->card_8185 == 1 && priv->card_8185_Bversion)
-		write_phy_ofdm(dev, 0x27, 0x8);
-	else
-		write_phy_ofdm(dev, 0x27, 0x88);
-
-	write_phy_ofdm(dev, 0x14, 0);
-	write_phy_ofdm(dev, 0x16, 0);
-	write_phy_ofdm(dev, 0x15, 0x40);
-	write_phy_ofdm(dev, 0x17, 0x40);
-
-	write_phy_ofdm(dev, 0x0d, rtl8225_gain[gain * 4]);
-	write_phy_ofdm(dev, 0x23, rtl8225_gain[gain * 4 + 1]);
-	write_phy_ofdm(dev, 0x1b, rtl8225_gain[gain * 4 + 2]);
-	write_phy_ofdm(dev, 0x1d, rtl8225_gain[gain * 4 + 3]);
-	//rtl8225_set_gain_usb(dev, gain);
-}
-#endif
-
 u32 read_rtl8225(struct net_device *dev, u8 adr)
 {
 	u32 data2Write = ((u32)(adr & 0x1f)) << 27;
@@ -284,76 +217,7 @@ u32 read_rtl8225(struct net_device *dev,
 	return dataRead;
 
 }
-#if 0
-void write_rtl8225(struct net_device *dev, u8 adr, u16 data)
-{
-	int i;
-	u16 out,select;
-	u8 bit;
-	u32 bangdata = (data << 4) | (adr & 0xf);
-	struct r8180_priv *priv = ieee80211_priv(dev);
-
-	out = read_nic_word(dev, RFPinsOutput) & 0xfff3;
-
-	write_nic_word(dev,RFPinsEnable,
-		(read_nic_word(dev,RFPinsEnable) | 0x7));
-
-	select = read_nic_word(dev, RFPinsSelect);
-
-	write_nic_word(dev, RFPinsSelect, select | 0x7 |
-		((priv->card_type == USB) ? 0 : SW_CONTROL_GPIO));
-
-	force_pci_posting(dev);
-	udelay(10);
-
-	write_nic_word(dev, RFPinsOutput, out | BB_HOST_BANG_EN );//| 0x1fff);
-
-	force_pci_posting(dev);
-	udelay(2);
-
-	write_nic_word(dev, RFPinsOutput, out);
-
-	force_pci_posting(dev);
-	udelay(10);
-
-
-	for(i=15; i>=0;i--){
-
-		bit = (bangdata & (1<<i)) >> i;
-
-		write_nic_word(dev, RFPinsOutput, bit | out);
-
-		write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
-		write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
-
-		i--;
-		bit = (bangdata & (1<<i)) >> i;
-
-		write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
-		write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
-
-		write_nic_word(dev, RFPinsOutput, bit | out);
 
-	}
-
-	write_nic_word(dev, RFPinsOutput, out | BB_HOST_BANG_EN);
-
-	force_pci_posting(dev);
-	udelay(10);
-
-	write_nic_word(dev, RFPinsOutput, out |
-		((priv->card_type == USB) ? 4 : BB_HOST_BANG_EN));
-
-	write_nic_word(dev, RFPinsSelect, select |
-		((priv->card_type == USB) ? 0 : SW_CONTROL_GPIO));
-
-	if(priv->card_type == USB)
-		mdelay(2);
-	else
-		rtl8185_rf_pins_enable(dev);
-}
-
-#endif
 short rtl8225_is_V_z2(struct net_device *dev)
 {
 	short vz2 = 1;
@@ -364,13 +228,7 @@ short rtl8225_is_V_z2(struct net_device 
 
 	/* reg 8 pg 1 = 23*/
 	//printk(KERN_WARNING "RF Rigisters:\n");
-#if 0
-	for(i = 0; i <= 0xf; i++)
-		printk(KERN_WARNING "%08x,", read_rtl8225(dev, i));
-	//printk(KERN_WARNING "reg[9]@pg1 = 0x%x\n", read_rtl8225(dev, 0x0F));
 
-//	printk(KERN_WARNING "RF:\n");
-#endif
 	if( read_rtl8225(dev, 8) != 0x588)
 		vz2 = 0;
 
@@ -385,38 +243,6 @@ short rtl8225_is_V_z2(struct net_device 
 
 }
 
-#if 0
-void rtl8225_rf_close(struct net_device *dev)
-{
-	write_rtl8225(dev, 0x4, 0x1f);
-
-	force_pci_posting(dev);
-	mdelay(1);
-
-	rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_OFF);
-	rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_OFF);
-}
-#endif
-#if 0
-short rtl8225_rf_set_sens(struct net_device *dev, short sens)
-{
-	if (sens <0 || sens > 6) return -1;
-
-	if(sens > 4)
-		write_rtl8225(dev, 0x0c, 0x850);
-	else
-		write_rtl8225(dev, 0x0c, 0x50);
-
-	sens= 6-sens;
-	rtl8225_set_gain(dev, sens);
-
-	write_phy_cck(dev, 0x41, rtl8225_threshold[sens]);
-	return 0;
-
-}
-#endif
-
-
 void rtl8225z2_rf_close(struct net_device *dev)
 {
 	RF_WriteReg(dev, 0x4, 0x1f);
@@ -514,39 +340,7 @@ void rtl8225z2_SetTXPowerLevel(struct ne
 //	u8 ofdm_power_level = 0xff & priv->chtxpwr_ofdm[ch];//-by amy 080312
 	char cck_power_level = (char)(0xff & priv->chtxpwr[ch]);//+by amy 080312
 	char ofdm_power_level = (char)(0xff & priv->chtxpwr_ofdm[ch]);//+by amy 080312
-#if 0
-	//
-	// CCX 2 S31, AP control of client transmit power:
-	// 1. We shall not exceed Cell Power Limit as possible as we can.
-	// 2. Tolerance is +/- 5dB.
-	// 3. 802.11h Power Contraint takes higher precedence over CCX Cell Power Limit.
-	//
-	// TODO:
-	// 1. 802.11h power contraint
-	//
-	// 071011, by rcnjko.
-	//
-	if(	priv->OpMode == RT_OP_MODE_INFRASTRUCTURE &&
-		priv->bWithCcxCellPwr &&
-		ch == priv->dot11CurrentChannelNumber)
-	{
-		u8 CckCellPwrIdx = DbmToTxPwrIdx(dev, WIRELESS_MODE_B, pMgntInfo->CcxCellPwr);
-		u8 OfdmCellPwrIdx = DbmToTxPwrIdx(dev, WIRELESS_MODE_G, pMgntInfo->CcxCellPwr);
-
-		printk("CCX Cell Limit: %d dBm => CCK Tx power index : %d, OFDM Tx power index: %d\n",
-			priv->CcxCellPwr, CckCellPwrIdx, OfdmCellPwrIdx);
-		printk("EEPROM channel(%d) => CCK Tx power index: %d, OFDM Tx power index: %d\n",
-			channel, CckTxPwrIdx, OfdmTxPwrIdx);
-
-		if(cck_power_level > CckCellPwrIdx)
-			cck_power_level = CckCellPwrIdx;
-		if(ofdm_power_level > OfdmCellPwrIdx)
-			ofdm_power_level = OfdmCellPwrIdx;
 
-		printk("Altered CCK Tx power index : %d, OFDM Tx power index: %d\n",
-			CckTxPwrIdx, OfdmTxPwrIdx);
-	}
-#endif
 	if(IS_DOT11D_ENABLE(priv->ieee80211) &&
 		IS_DOT11D_STATE_DONE(priv->ieee80211) )
 	{
@@ -642,14 +436,6 @@ void rtl8225z2_SetTXPowerLevel(struct ne
 	mdelay(1);
 
 }
-#if 0
-/* switch between mode B and G */
-void rtl8225_set_mode(struct net_device *dev, short modeb)
-{
-	write_phy_ofdm(dev, 0x15, (modeb ? 0x0 : 0x40));
-	write_phy_ofdm(dev, 0x17, (modeb ? 0x0 : 0x40));
-}
-#endif
 
 void rtl8225z2_rf_set_chan(struct net_device *dev, short ch)
 {
@@ -672,86 +458,8 @@ void rtl8225z2_rf_set_chan(struct net_de
 
 	force_pci_posting(dev);
 	mdelay(10);
-//deleted by David : 2006/8/9
-#if 0
-	write_nic_byte(dev,SIFS,0x22);// SIFS: 0x22
-
-	if(gset)
-		write_nic_byte(dev,DIFS,20); //DIFS: 20
-	else
-		write_nic_byte(dev,DIFS,0x24); //DIFS: 36
-
-	if(priv->ieee80211->state == IEEE80211_LINKED &&
-		ieee80211_is_shortslot(priv->ieee80211->current_network))
-		write_nic_byte(dev,SLOT,0x9); //SLOT: 9
-
-	else
-		write_nic_byte(dev,SLOT,0x14); //SLOT: 20 (0x14)
-
-
-	if(gset){
-		write_nic_byte(dev,EIFS,91 - 20); // EIFS: 91 (0x5B)
-		write_nic_byte(dev,CW_VAL,0x73); //CW VALUE: 0x37
-		//DMESG("using G net params");
-	}else{
-		write_nic_byte(dev,EIFS,91 - 0x24); // EIFS: 91 (0x5B)
-		write_nic_byte(dev,CW_VAL,0xa5); //CW VALUE: 0x37
-		//DMESG("using B net params");
-	}
-#endif
-
 }
-#if 0
-void rtl8225_host_pci_init(struct net_device *dev)
-{
-	write_nic_word(dev, RFPinsOutput, 0x480);
-
-	rtl8185_rf_pins_enable(dev);
-
-	//if(priv->card_8185 == 2 && priv->enable_gpio0 ) /* version D */
-	//write_nic_word(dev, RFPinsSelect, 0x88);
-	//else
-	write_nic_word(dev, RFPinsSelect, 0x88 | SW_CONTROL_GPIO); /* 0x488 | SW_CONTROL_GPIO */
-
-	write_nic_byte(dev, GP_ENABLE, 0);
-
-	force_pci_posting(dev);
-	mdelay(200);
-
-	write_nic_word(dev, GP_ENABLE, 0xff & (~(1<<6))); /* bit 6 is for RF on/off detection */
 
-
-}
-
-void rtl8225_host_usb_init(struct net_device *dev)
-{
-	write_nic_byte(dev,RFPinsSelect+1,0);
-
-	write_nic_byte(dev,GPIO,0);
-
-	write_nic_byte_E(dev,0x53,read_nic_byte_E(dev,0x53) | (1<<7));
-
-	write_nic_byte(dev,RFPinsSelect+1,4);
-
-	write_nic_byte(dev,GPIO,0x20);
-
-	write_nic_byte(dev,GP_ENABLE,0);
-
-
-	/* Config BB & RF */
-	write_nic_word(dev, RFPinsOutput, 0x80);
-
-	write_nic_word(dev, RFPinsSelect, 0x80);
-
-	write_nic_word(dev, RFPinsEnable, 0x80);
-
-
-	mdelay(100);
-
-	mdelay(1000);
-
-}
-#endif
 void rtl8225z2_rf_init(struct net_device *dev)
 {
 	struct r8180_priv *priv = ieee80211_priv(dev);
@@ -840,12 +548,6 @@ void rtl8225z2_rf_init(struct net_device
 	for(i=0;i<95;i++){
 		write_rtl8225(dev, 0x1, (u8)(i+1));
 
-		#if 0
-		if(priv->phy_ver == 1)
-			/* version A */
-			write_rtl8225(dev, 0x2, rtl8225a_rxgain[i]);
-		else
-		#endif
 		/* version B & C & D*/
 
 		write_rtl8225(dev, 0x2, rtl8225z2_rxgain[i]);
@@ -917,16 +619,6 @@ void rtl8225z2_rf_init(struct net_device
 
                 mdelay(1);
         }
-#if 0
-	for(i=0;i<128;i++){
-		write_phy_ofdm(dev, 0xb, rtl8225_agc[i]);
-
-		mdelay(1);
-		write_phy_ofdm(dev, 0xa, (u8)i+ 0x80);
-
-		mdelay(1);
-	}
-#endif
 
 	force_pci_posting(dev);
 	mdelay(1);
@@ -958,14 +650,6 @@ void rtl8225z2_rf_init(struct net_device
 	write_phy_ofdm(dev, 0xe, 0xd3);mdelay(1);
 
 
-	#if 0
-	if(priv->card_8185 == 1){
-		if(priv->card_8185_Bversion)
-			write_phy_ofdm(dev, 0xf, 0x20);/*ver B*/
-		else
-			write_phy_ofdm(dev, 0xf, 0x28);/*ver C*/
-	}else{
-	#endif
 	write_phy_ofdm(dev, 0xf, 0x38);mdelay(1);
 /*ver D & 8187*/
 //	}
@@ -986,13 +670,6 @@ void rtl8225z2_rf_init(struct net_device
 
 	write_phy_ofdm(dev, 0x13, 0x20);mdelay(1);
 
-#if 0
-	}else{
-		/* Ver B & C*/
-		write_phy_ofdm(dev, 0x12, 0x0);
-		write_phy_ofdm(dev, 0x13, 0x0);
-	}
-#endif
 	write_phy_ofdm(dev, 0x14, 0x0); mdelay(1);
 	write_phy_ofdm(dev, 0x15, 0x40); mdelay(1);
 	write_phy_ofdm(dev, 0x16, 0x0); mdelay(1);
@@ -1052,11 +729,6 @@ void rtl8225z2_rf_init(struct net_device
 	write_phy_cck(dev, 0x10, ((priv->card_type == USB) ? 0x9b: 0x93)); mdelay(1);
 	write_phy_cck(dev, 0x11, 0x88); mdelay(1);
 	write_phy_cck(dev, 0x12, 0x47); mdelay(1);
-#if 0
-	if(priv->card_8185 == 1 && priv->card_8185_Bversion)
-		write_phy_cck(dev, 0x13, 0x98); /* Ver B */
-	else
-#endif
 	write_phy_cck(dev, 0x13, 0xd0); /* Ver C & D & 8187*/
 
 	write_phy_cck(dev, 0x19, 0x0);
@@ -1279,13 +951,6 @@ SetZebraRFPowerState8185(
 					QueueID++;
 					continue;
 				}
-#if 0		//reserved amy
-				else if(priv->NdisAdapter.CurrentPowerState != NdisDeviceStateD0)
-				{
-					RT_TRACE(COMP_POWER, DBG_LOUD, ("eRfSleep: %d times TcbBusyQueue[%d] !=0 but lower power state!\n", (pMgntInfo->TxPollingTimes+1), QueueID));
-					break;
-				}
-#endif
 				else//lzm mod 080826
 				{
 					priv->TxPollingTimes ++;
@@ -1388,13 +1053,6 @@ SetZebraRFPowerState8185(
 					QueueID++;
 					continue;
 				}
-#if 0
-				else if(Adapter->NdisAdapter.CurrentPowerState != NdisDeviceStateD0)
-				{
-					RT_TRACE(COMP_POWER, DBG_LOUD, ("%d times TcbBusyQueue[%d] !=0 but lower power state!\n", (i+1), QueueID));
-					break;
-				}
-#endif
 				else
 				{
 					udelay(10);
@@ -1477,39 +1135,6 @@ SetZebraRFPowerState8185(
 	{
 		// Update current RF state variable.
 		priv->eRFPowerState = eRFPowerState;
-#if 0
-		switch(priv->eRFPowerState)
-		{
-		case eRfOff:
-			//
-			//If Rf off reason is from IPS, Led should blink with no link, by Maddest 071015
-			//
-			if(priv->RfOffReason==RF_CHANGE_BY_IPS )
-			{
-				Adapter->HalFunc.LedControlHandler(Adapter,LED_CTL_NO_LINK);
-			}
-			else
-			{
-				// Turn off LED if RF is not ON.
-				Adapter->HalFunc.LedControlHandler(Adapter, LED_CTL_POWER_OFF);
-			}
-			break;
-
-		case eRfOn:
-			// Turn on RF we are still linked, which might happen when
-			// we quickly turn off and on HW RF. 2006.05.12, by rcnjko.
-			if( pMgntInfo->bMediaConnect == TRUE )
-			{
-				Adapter->HalFunc.LedControlHandler(Adapter, LED_CTL_LINK);
-			}
-			break;
-
-		default:
-			// do nothing.
-			break;
-		}
-#endif
-
 	}
 
 	priv->SetRFPowerStateInProgress = false;
Index: b/drivers/staging/rtl8187se/r8180_rtl8255.c
===================================================================
--- a/drivers/staging/rtl8187se/r8180_rtl8255.c
+++ b/drivers/staging/rtl8187se/r8180_rtl8255.c
@@ -256,14 +256,6 @@ void rtl8255_SetTXPowerLevel(struct net_
 	mdelay(1);
 	//write_nic_byte(dev, TX_AGC_CONTROL,4);
 }
-#if 0
-/* switch between mode B and G */
-void rtl8255_set_mode(struct net_device *dev, short modeb)
-{
-	write_phy_ofdm(dev, 0x15, (modeb ? 0x0 : 0x40));
-	write_phy_ofdm(dev, 0x17, (modeb ? 0x0 : 0x40));
-}
-#endif
 
 void rtl8255_rf_set_chan(struct net_device *dev, short ch)
 {
@@ -281,25 +273,6 @@ void rtl8255_rf_set_chan(struct net_devi
 
 	rtl8255_SetTXPowerLevel(dev, ch);
 	/* FIXME FIXME FIXME */
-
-	#if 0
-	write_nic_byte(dev,DIFS,0xe); //DIFS
-	write_nic_byte(dev,SLOT,0x14); //SLOT
-	write_nic_byte(dev,EIFS,0x5b); // EIFS
-	//write_nic_byte(dev,0xbc,0); //CW CONFIG
-	write_nic_byte(dev,0xbd,0xa4); //CW VALUE
-	//write_nic_byte(dev,TX_AGC_CONTROL,4);
-	//write_nic_byte(dev, 0x9d,7);
-//Apr 20 13:25:03 localhost kernel: w8. 409d<-7  // CCK AGC
-	/*write_nic_word(dev,0x84,0x488);
-	write_nic_byte(dev,0x91,0x3e);
-	write_nic_byte(dev,0x90,0x30);
-	write_nic_word(dev,0x84,0x488);
-	write_nic_byte(dev,0x91,0x3e);
-	write_nic_byte(dev,0x90,0x20);
-	*/
-	//mdelay(100);
-	#endif
 }
 
 void rtl8255_init_BGband(struct net_device *dev)
@@ -1807,11 +1780,7 @@ void rtl8255_rf_init(struct net_device *
 	write_phy_cck(dev, 0x4a, 0x0);
 	write_phy_cck(dev, 0x4b, 0x0);
 //	write_phy_cck(dev, 0x4c, 0x5);
-#if 0
-	write_phy_cck(dev, 0x41, 0x9d); /* Energy Threshold */
-	// TESTR 0xb 8187
-	write_phy_cck(dev, 0x10, 0x93);// & 0xfb);
-#endif
+
 	//rtl8255_set_gain(dev, 1); /* FIXME this '1' is random */
 
 	rtl8255_SetTXPowerLevel(dev, priv->chan);
Index: b/drivers/staging/rtl8187se/r8180_wx.c
===================================================================
--- a/drivers/staging/rtl8187se/r8180_wx.c
+++ b/drivers/staging/rtl8187se/r8180_wx.c
@@ -1569,36 +1569,7 @@ static struct iw_statistics *r8180_get_w
 		wstats->qual.updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM;
 		return wstats;
 	}
-#if 0
-	spin_lock_irqsave(&ieee->lock, flag);
-	list_for_each_entry(target, &ieee->network_list, list)
-	{
-		if (is_same_network(target, &ieee->current_network, ieee))
-		{
-			printk("it's same network:%s\n", target->ssid);
-#if 0
-			if (!tmp_level)
-			{
-				tmp_level = target->stats.signalstrength;
-				tmp_qual = target->stats.signal;
-			}
-			else
-			{
 
-				tmp_level = (15*tmp_level + target->stats.signalstrength)/16;
-				tmp_qual = (15*tmp_qual + target->stats.signal)/16;
-			}
-#else
-			tmp_level = target->stats.signal;
-			tmp_qual = target->stats.signalstrength;
-			tmp_noise = target->stats.noise;
-			printk("level:%d, qual:%d, noise:%d\n", tmp_level, tmp_qual, tmp_noise);
-#endif
-			break;
-		}
-	}
-	spin_unlock_irqrestore(&ieee->lock, flag);
-#endif
 	tmp_level = (&ieee->current_network)->stats.signal;
 	tmp_qual = (&ieee->current_network)->stats.signalstrength;
 	tmp_noise = (&ieee->current_network)->stats.noise;
Index: b/drivers/staging/rtl8187se/r8185b_init.c
===================================================================
--- a/drivers/staging/rtl8187se/r8185b_init.c
+++ b/drivers/staging/rtl8187se/r8185b_init.c
@@ -1194,11 +1194,6 @@ ZEBRA_Config_85BASIC_HardCode(
 	RF_WriteReg(dev, 0x05, 0x05ab);			mdelay(1); // Rx mode//+edward
 	RF_WriteReg(dev, 0x00, 0x009f);			mdelay(1); // Rx mode//+edward
 
-#if 0//-edward
-	RF_WriteReg(dev, 0x00, 0x0197);			mdelay(1);
-	RF_WriteReg(dev, 0x05, 0x05ab);			mdelay(1);
-	RF_WriteReg(dev, 0x00, 0x009F);			mdelay(1);
-#endif
 	RF_WriteReg(dev, 0x01, 0x0000);			mdelay(1); // Rx mode//+edward
 	RF_WriteReg(dev, 0x02, 0x0000);			mdelay(1); // Rx mode//+edward
 	//power save parameters.
@@ -1218,14 +1213,7 @@ ZEBRA_Config_85BASIC_HardCode(
 		CCK reg0x06[3]=1'b1: turn off unused circuits before cca = 1
 		CCK reg0x06[2]=1'b1: turn off cck's circuit if macrst =0
 	*/
-#if 0
-	write_nic_dword(dev, PHY_ADR, 0x0100c880);
-	write_nic_dword(dev, PHY_ADR, 0x01001c86);
-	write_nic_dword(dev, PHY_ADR, 0x01007890);
-	write_nic_dword(dev, PHY_ADR, 0x0100d0ae);
-	write_nic_dword(dev, PHY_ADR, 0x010006af);
-	write_nic_dword(dev, PHY_ADR, 0x01004681);
-#endif
+
 	write_phy_cck(dev,0x00,0xc8);
 	write_phy_cck(dev,0x06,0x1c);
 	write_phy_cck(dev,0x10,0x78);
@@ -1294,64 +1282,6 @@ ZEBRA_Config_85BASIC_HardCode(
 	// Config Sw/Hw  Combinational Antenna Diversity. Added by Roger, 2008.02.26.
 	SetAntennaConfig87SE(dev, priv->bDefaultAntenna1, priv->bSwAntennaDiverity);
 //by amy 080312}
-#if 0
-	// Config Sw/Hw  Antenna Diversity
-	if( priv->bSwAntennaDiverity )  //  Use SW+Hw Antenna Diversity
-	{
-		if( priv->bDefaultAntenna1 == true )  // aux antenna
-		{
-			// Mac register, aux antenna
-			write_nic_byte(dev, ANTSEL, 0x00);
-			// Config CCK RX antenna.
-			write_phy_cck(dev, 0x11, 0xbb); // Reg11 : bb
-			write_phy_cck(dev, 0x0c, 0x09); // Reg0c : 09
-			write_phy_cck(dev, 0x01, 0xc7); // Reg01 : c7
-			// Config OFDM RX antenna.
-			write_phy_ofdm(dev, 0x0d, 0x54);   // Reg0d : 54
-			write_phy_ofdm(dev, 0x18, 0xb2);  // Reg18 : b2
-		}
-		else //  main antenna
-		{
-			// Mac register, main antenna
-			write_nic_byte(dev, ANTSEL, 0x03);
-			//base band
-			// Config CCK RX antenna.
-			write_phy_cck(dev, 0x11, 0x9b); // Reg11 : 9b
-			write_phy_cck(dev, 0x0c, 0x09); // Reg0c : 09
-			write_phy_cck(dev, 0x01, 0xc7); // Reg01 : c7
-			// Config OFDM RX antenna.
-			write_phy_ofdm(dev, 0x0d, 0x5c);   // Reg0d : 5c
-			write_phy_ofdm(dev, 0x18, 0xb2);  // Reg18 : b2
-		}
-	}
-	else   // Disable Antenna Diversity
-	{
-		if( priv->bDefaultAntenna1 == true ) // aux Antenna
-		{
-			// Mac register, aux antenna
-			write_nic_byte(dev, ANTSEL, 0x00);
-			// Config CCK RX antenna.
-			write_phy_cck(dev, 0x11, 0xbb); // Reg11 : bb
-			write_phy_cck(dev, 0x0c, 0x09); // Reg0c : 09
-			write_phy_cck(dev, 0x01, 0x47); // Reg01 : 47
-			// Config OFDM RX antenna.
-			write_phy_ofdm(dev, 0x0d, 0x54);   // Reg0d : 54
-			write_phy_ofdm(dev, 0x18, 0x32);  // Reg18 : 32
-		}
-		else // main Antenna
-		{
-			// Mac register, main antenna
-			write_nic_byte(dev, ANTSEL, 0x03);
-			// Config CCK RX antenna.
-			write_phy_cck(dev, 0x11, 0x9b); // Reg11 : 9b
-			write_phy_cck(dev, 0x0c, 0x09); // Reg0c : 09
-			write_phy_cck(dev, 0x01, 0x47); // Reg01 : 47
-			// Config OFDM RX antenna.
-			write_phy_ofdm(dev, 0x0d, 0x5c);   // Reg0d : 5c
-			write_phy_ofdm(dev, 0x18, 0x32);  // Reg18 : 32
-		}
-	}
-#endif
 //by amy for antenna
 }
 
@@ -1378,69 +1308,6 @@ UpdateInitialGain(
 
 	switch(priv->rf_chip)
 	{
-#if 0
-	case RF_ZEBRA2:
-		// Dynamic set initial gain, by shien chang, 2006.07.14
-		switch(priv->InitialGain)
-		{
-			case 1: //m861dBm
-				DMESG("RTL8185B + 8225 Initial Gain State 1: -82 dBm \n");
-				write_nic_dword(dev, PhyAddr, 0x2697);	mdelay(1);
-				write_nic_dword(dev, PhyAddr, 0x86a4);	mdelay(1);
-				write_nic_dword(dev, PhyAddr, 0xfa85);	mdelay(1);
-				break;
-
-			case 2: //m862dBm
-				DMESG("RTL8185B + 8225 Initial Gain State 2: -82 dBm \n");
-				write_nic_dword(dev, PhyAddr, 0x2697);	mdelay(1);
-				write_nic_dword(dev, PhyAddr, 0x86a4);	mdelay(1);
-				write_nic_dword(dev, PhyAddr, 0xfb85);	mdelay(1);
-				break;
-
-			case 3: //m863dBm
-				DMESG("RTL8185B + 8225 Initial Gain State 3: -82 dBm \n");
-				write_nic_dword(dev, PhyAddr, 0x2697);	mdelay(1);
-				write_nic_dword(dev, PhyAddr, 0x96a4);	mdelay(1);
-				write_nic_dword(dev, PhyAddr, 0xfb85);	mdelay(1);
-				break;
-
-			case 4: //m864dBm
-				DMESG("RTL8185B + 8225 Initial Gain State 4: -78 dBm \n");
-				write_nic_dword(dev, PhyAddr, 0x2697);	mdelay(1);
-				write_nic_dword(dev, PhyAddr, 0xa6a4);	mdelay(1);
-				write_nic_dword(dev, PhyAddr, 0xfb85);	mdelay(1);
-				break;
-
-			case 5: //m82dBm
-				DMESG("RTL8185B + 8225 Initial Gain State 5: -74 dBm \n");
-				write_nic_dword(dev, PhyAddr, 0x3697);	mdelay(1);
-				write_nic_dword(dev, PhyAddr, 0xa6a4);	mdelay(1);
-				write_nic_dword(dev, PhyAddr, 0xfb85);	mdelay(1);
-				break;
-
-			case 6: //m78dBm
-				DMESG("RTL8185B + 8225 Initial Gain State 6: -70 dBm \n");
-				write_nic_dword(dev, PhyAddr, 0x4697);	mdelay(1);
-				write_nic_dword(dev, PhyAddr, 0xa6a4);	mdelay(1);
-				write_nic_dword(dev, PhyAddr, 0xfb85);	mdelay(1);
-				break;
-
-			case 7: //m74dBm
-				DMESG("RTL8185B + 8225 Initial Gain State 7: -66 dBm \n");
-				write_nic_dword(dev, PhyAddr, 0x5697);	mdelay(1);
-				write_nic_dword(dev, PhyAddr, 0xa6a4);	mdelay(1);
-				write_nic_dword(dev, PhyAddr, 0xfb85);	mdelay(1);
-				break;
-
-			default:	//MP
-				DMESG("RTL8185B + 8225 Initial Gain State 1: -82 dBm (default)\n");
-				write_nic_dword(dev, PhyAddr, 0x2697);	mdelay(1);
-				write_nic_dword(dev, PhyAddr, 0x86a4);	mdelay(1);
-				write_nic_dword(dev, PhyAddr, 0xfa85);	mdelay(1);
-				break;
-		}
-		break;
-#endif
 	case RF_ZEBRA4:
 		// Dynamic set initial gain, follow 87B
 		switch(priv->InitialGain)
@@ -1657,9 +1524,6 @@ HwConfigureRTL8185(
 		// <RJ_TODO_8185B> We shall set up the ARFR according to user's setting.
 		//write_nic_word(dev, ARFR, 0x0fff); // set 1M ~ 54M
 //by amy
-#if 0
-		PlatformIOWrite2Byte(dev, ARFR, 0x0fff); 	// set 1M ~ 54M
-#endif
 	        // Aadded by Roger, 2007.11.15.
 	        PlatformIOWrite2Byte(dev, ARFR, 0x0fff); //set 1M ~ 54Mbps.
 //by amy
@@ -1731,9 +1595,6 @@ MacConfig_85BASIC(
 	// Asked for by SD3 CM Lin, 2006.06.27, by rcnjko.
 	//PlatformIOWrite4Byte(dev, RFTiming, 0x00004001);
 //by amy
-#if 0
-	write_nic_dword(dev, RFTiming, 0x00004001);
-#endif
 	// power save parameter based on "87SE power save parameters 20071127.doc", as follow.
 
 	//Enable DA10 TX power saving
@@ -2118,16 +1979,6 @@ MgntDisconnectIBSS(
 	notify_wx_assoc_event(priv->ieee80211);
 
 	// Stop SW Beacon.Use hw beacon so do not need to do so.by amy
-#if 0
-	if(pMgntInfo->bEnableSwBeaconTimer)
-	{
-		// SwBeaconTimer will stop if pMgntInfo->mIbss==FALSE, see SwBeaconCallback() for details.
-// comment out by haich, 2007.10.01
-//#if DEV_BUS_TYPE==USB_INTERFACE
-		PlatformCancelTimer( Adapter, &pMgntInfo->SwBeaconTimer);
-//#endif
-	}
-#endif
 
 //		MgntIndicateMediaStatus( Adapter, RT_MEDIA_DISCONNECT, GENERAL_INDICATE );
 
@@ -2483,19 +2334,7 @@ InactivePowerSave(
 	//
 	// To solve CAM values miss in RF OFF, rewrite CAM values after RF ON. By Bruce, 2007-09-20.
 	//
-#if 0
-	while( index < 4 )
-	{
-		if( ( pMgntInfo->SecurityInfo.PairwiseEncAlgorithm == WEP104_Encryption ) ||
-			(pMgntInfo->SecurityInfo.PairwiseEncAlgorithm == WEP40_Encryption) )
-		{
-			if( pMgntInfo->SecurityInfo.KeyLen[index] != 0)
-			pAdapter->HalFunc.SetKeyHandler(pAdapter, index, 0, FALSE, pMgntInfo->SecurityInfo.PairwiseEncAlgorithm, TRUE, FALSE);
 
-		}
-		index++;
-	}
-#endif
 	priv->bSwRfProcessing = false;
 }
 
@@ -2782,58 +2621,6 @@ void rtl8185b_rx_enable(struct net_devic
 	//u32 rxconf;
 	/* for now we accept data, management & ctl frame*/
 	struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-#if 0
-	rxconf=read_nic_dword(dev,RX_CONF);
-	rxconf = rxconf &~ MAC_FILTER_MASK;
-	rxconf = rxconf | (1<<ACCEPT_MNG_FRAME_SHIFT);
-	rxconf = rxconf | (1<<ACCEPT_DATA_FRAME_SHIFT);
-	rxconf = rxconf | (1<<ACCEPT_BCAST_FRAME_SHIFT);
-	rxconf = rxconf | (1<<ACCEPT_MCAST_FRAME_SHIFT);
-//	rxconf = rxconf | (1<<ACCEPT_CRCERR_FRAME_SHIFT);
-	if (dev->flags & IFF_PROMISC) DMESG ("NIC in promisc mode");
-
-	if(priv->ieee80211->iw_mode == IW_MODE_MONITOR || \
-	   dev->flags & IFF_PROMISC){
-		rxconf = rxconf | (1<<ACCEPT_ALLMAC_FRAME_SHIFT);
-	}else{
-		rxconf = rxconf | (1<<ACCEPT_NICMAC_FRAME_SHIFT);
-		if(priv->card_8185 == 0)
-			rxconf = rxconf | (1<<RX_CHECK_BSSID_SHIFT);
-	}
-
-	/*if(priv->ieee80211->iw_mode == IW_MODE_MASTER){
-		rxconf = rxconf | (1<<ACCEPT_ALLMAC_FRAME_SHIFT);
-		rxconf = rxconf | (1<<RX_CHECK_BSSID_SHIFT);
-	}*/
-
-	if(priv->ieee80211->iw_mode == IW_MODE_MONITOR){
-		rxconf = rxconf | (1<<ACCEPT_CTL_FRAME_SHIFT);
-		rxconf = rxconf | (1<<ACCEPT_ICVERR_FRAME_SHIFT);
-		rxconf = rxconf | (1<<ACCEPT_PWR_FRAME_SHIFT);
-	}
-
-	if( priv->crcmon == 1 && priv->ieee80211->iw_mode == IW_MODE_MONITOR)
-		rxconf = rxconf | (1<<ACCEPT_CRCERR_FRAME_SHIFT);
-
-	//if(!priv->card_8185){
-		rxconf = rxconf &~ RX_FIFO_THRESHOLD_MASK;
-		rxconf = rxconf | (RX_FIFO_THRESHOLD_NONE<<RX_FIFO_THRESHOLD_SHIFT);
-	//}
-
-	rxconf = rxconf | (1<<RX_AUTORESETPHY_SHIFT);
-	rxconf = rxconf &~ MAX_RX_DMA_MASK;
-	rxconf = rxconf | (MAX_RX_DMA_2048<<MAX_RX_DMA_SHIFT);
-
-	//if(!priv->card_8185)
-		rxconf = rxconf | RCR_ONLYERLPKT;
-
-	rxconf = rxconf &~ RCR_CS_MASK;
-	if(!priv->card_8185)
-		rxconf |= (priv->rcr_csense<<RCR_CS_SHIFT);
-//	rxconf &=~ 0xfff00000;
-//	rxconf |= 0x90100000;//9014f76f;
-	write_nic_dword(dev, RX_CONF, rxconf);
-#endif
 
 	if (dev->flags & IFF_PROMISC) DMESG ("NIC in promisc mode");
 
@@ -2875,76 +2662,6 @@ void rtl8185b_tx_enable(struct net_devic
 	//u32 txconf;
 	struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
 
-#if 0
-	txconf= read_nic_dword(dev,TX_CONF);
-	if(priv->card_8185){
-
-
-		byte = read_nic_byte(dev,CW_CONF);
-		byte &= ~(1<<CW_CONF_PERPACKET_CW_SHIFT);
-		byte &= ~(1<<CW_CONF_PERPACKET_RETRY_SHIFT);
-		write_nic_byte(dev, CW_CONF, byte);
-
-		tx_agc_ctl = read_nic_byte(dev, TX_AGC_CTL);
-		tx_agc_ctl &= ~(1<<TX_AGC_CTL_PERPACKET_GAIN_SHIFT);
-		tx_agc_ctl &= ~(1<<TX_AGC_CTL_PERPACKET_ANTSEL_SHIFT);
-		tx_agc_ctl |=(1<<TX_AGC_CTL_FEEDBACK_ANT);
-		write_nic_byte(dev, TX_AGC_CTL, tx_agc_ctl);
-		/*
-		write_nic_word(dev, 0x5e, 0x01);
-		force_pci_posting(dev);
-		mdelay(1);
-		write_nic_word(dev, 0xfe, 0x10);
-		force_pci_posting(dev);
-		mdelay(1);
-		write_nic_word(dev, 0x5e, 0x00);
-		force_pci_posting(dev);
-		mdelay(1);
-		*/
-		write_nic_byte(dev, 0xec, 0x3f); /* Disable early TX */
-	}
-
-	if(priv->card_8185){
-
-		txconf = txconf &~ (1<<TCR_PROBE_NOTIMESTAMP_SHIFT);
-
-	}else{
-
-		if(hwseqnum)
-			txconf= txconf &~ (1<<TX_CONF_HEADER_AUTOICREMENT_SHIFT);
-		else
-			txconf= txconf | (1<<TX_CONF_HEADER_AUTOICREMENT_SHIFT);
-	}
-
-	txconf = txconf &~ TX_LOOPBACK_MASK;
-	txconf = txconf | (TX_LOOPBACK_NONE <<TX_LOOPBACK_SHIFT);
-	txconf = txconf &~ TCR_DPRETRY_MASK;
-	txconf = txconf &~ TCR_RTSRETRY_MASK;
-	txconf = txconf | (priv->retry_data<<TX_DPRETRY_SHIFT);
-	txconf = txconf | (priv->retry_rts<<TX_RTSRETRY_SHIFT);
-	txconf = txconf &~ (1<<TX_NOCRC_SHIFT);
-
-	if(priv->card_8185){
-		if(priv->hw_plcp_len)
-			txconf = txconf &~ TCR_PLCP_LEN;
-		else
-			txconf = txconf | TCR_PLCP_LEN;
-	}else{
-		txconf = txconf &~ TCR_SAT;
-	}
-	txconf = txconf &~ TCR_MXDMA_MASK;
-	txconf = txconf | (TCR_MXDMA_2048<<TCR_MXDMA_SHIFT);
-	txconf = txconf | TCR_CWMIN;
-	txconf = txconf | TCR_DISCW;
-
-//	if(priv->ieee80211->hw_wep)
-//		txconf=txconf &~ (1<<TX_NOICV_SHIFT);
-//	else
-		txconf=txconf | (1<<TX_NOICV_SHIFT);
-
-	write_nic_dword(dev,TX_CONF,txconf);
-#endif
-
 	write_nic_dword(dev, TCR, priv->TransmitConfig);
 	byte = read_nic_byte(dev, MSR);
 	byte |= MSR_LINK_ENEDCA;

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 08/18] Staging: rtl8187se: remove unused radio frontends
  2009-06-28 14:18 [PATCH 01/18] Staging: rtl8187se: remove ENABLE_DOT11D ifdefs Bartlomiej Zolnierkiewicz
                   ` (5 preceding siblings ...)
  2009-06-28 14:19 ` [PATCH 07/18] Staging: rtl8187se: remove dead code Bartlomiej Zolnierkiewicz
@ 2009-06-28 14:19 ` Bartlomiej Zolnierkiewicz
  2009-06-28 14:19 ` [PATCH 09/18] Staging: rtl8187se: remove debugging code from r8180_core.c Bartlomiej Zolnierkiewicz
                   ` (9 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-06-28 14:19 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Bartlomiej Zolnierkiewicz, linux-kernel

From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] Staging: rtl8187se: remove unused radio frontends

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/staging/rtl8187se/Makefile        |    4 
 drivers/staging/rtl8187se/r8180_core.c    |    4 
 drivers/staging/rtl8187se/r8180_gct.c     |  296 ----
 drivers/staging/rtl8187se/r8180_gct.h     |   25 
 drivers/staging/rtl8187se/r8180_max2820.c |  171 --
 drivers/staging/rtl8187se/r8180_max2820.h |   21 
 drivers/staging/rtl8187se/r8180_rtl8255.c | 1807 ------------------------------
 drivers/staging/rtl8187se/r8180_rtl8255.h |   19 
 drivers/staging/rtl8187se/r8180_sa2400.c  |  233 ---
 drivers/staging/rtl8187se/r8180_sa2400.h  |   26 
 drivers/staging/rtl8187se/r8180_wx.c      |    1 
 drivers/staging/rtl8187se/r8185b_init.c   |    4 
 12 files changed, 2611 deletions(-)

Index: b/drivers/staging/rtl8187se/Makefile
===================================================================
--- a/drivers/staging/rtl8187se/Makefile
+++ b/drivers/staging/rtl8187se/Makefile
@@ -20,13 +20,9 @@ EXTRA_CFLAGS += -DENABLE_LPS
 
 rtl8187se-objs :=			\
 		r8180_core.o		\
-		r8180_sa2400.o		\
 		r8180_93cx6.o		\
 		r8180_wx.o		\
-		r8180_max2820.o		\
-		r8180_gct.o		\
 		r8180_rtl8225.o		\
-		r8180_rtl8255.o		\
 		r8180_rtl8225z2.o	\
 		r8185b_init.o		\
 		r8180_dm.o		\
Index: b/drivers/staging/rtl8187se/r8180_core.c
===================================================================
--- a/drivers/staging/rtl8187se/r8180_core.c
+++ b/drivers/staging/rtl8187se/r8180_core.c
@@ -54,11 +54,7 @@
 //#include <asm/uaccess.h>
 #include "r8180_hw.h"
 #include "r8180.h"
-#include "r8180_sa2400.h"  /* PHILIPS Radio frontend */
-#include "r8180_max2820.h" /* MAXIM Radio frontend */
-#include "r8180_gct.h"     /* GCT Radio frontend */
 #include "r8180_rtl8225.h" /* RTL8225 Radio frontend */
-#include "r8180_rtl8255.h" /* RTL8255 Radio frontend */
 #include "r8180_93cx6.h"   /* Card EEPROM */
 #include "r8180_wx.h"
 #include "r8180_dm.h"
Index: b/drivers/staging/rtl8187se/r8180_gct.c
===================================================================
--- a/drivers/staging/rtl8187se/r8180_gct.c
+++ /dev/null
@@ -1,296 +0,0 @@
-/*
-   This files contains GCT radio frontend programming routines.
-
-   This is part of rtl8180 OpenSource driver
-   Copyright (C) Andrea Merello 2004-2005  <andreamrl@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.
-
-   Code from Rtw8180 NetBSD driver by David Young has been really useful to
-   understand some things and gets some ideas
-
-   Code from rtl8181 project has been useful to me to understand some things.
-
-   Some code from 'Deuce' work
-
-   We want to tanks the Authors of such projects and the Ndiswrapper
-   project Authors.
-*/
-
-
-#include "r8180.h"
-#include "r8180_hw.h"
-#include "r8180_gct.h"
-
-
-//#define DEBUG_GCT
-
-/* the following experiment are just experiments.
- * this means if you enable them you can have every kind
- * of result, included damage the RF chip, so don't
- * touch them if you don't know what you are doing.
- * In any case, if you do it, do at your own risk
- */
-
-//#define GCT_EXPERIMENT1  //improve RX sensivity
-
-//#define GCT_EXPERIMENT2
-
-//#define GCT_EXPERIMENT3  //iprove a bit RX signal quality ?
-
-//#define GCT_EXPERIMENT4 //maybe solve some brokeness with experiment1 ?
-
-//#define GCT_EXPERIMENT5
-
-//#define GCT_EXPERIMENT6  //not good
-
-
-u32 gct_chan[] = {
-	0x0,	//dummy channel 0
-	0x0, //1
-	0x1, //2
-	0x2, //3
-	0x3, //4
-	0x4, //5
-	0x5, //6
-	0x6, //7
-	0x7, //8
-	0x8, //9
-	0x9, //10
-	0xa, //11
-	0xb, //12
-	0xc, //13
-	0xd, //14
-};
-
-int gct_encode[16] = {
-	0, 8, 4, 0xC,
-	2, 0xA, 6, 0xE,
-	1, 9, 5, 0xD,
-	3, 0xB, 7, 0xF
-};
-
-void gct_rf_stabilize(struct net_device *dev)
-{
-	force_pci_posting(dev);
-	mdelay(3); //for now use a great value.. we may optimize in future
-}
-
-
-void write_gct(struct net_device *dev, u8 adr, u32 data)
-{
-//	struct r8180_priv *priv = ieee80211_priv(dev);
-	u32 phy_config;
-
-	phy_config =  gct_encode[(data & 0xf00) >> 8];
-	phy_config |= gct_encode[(data & 0xf0) >> 4 ] << 4;
-	phy_config |= gct_encode[(data & 0xf)       ] << 8;
-	phy_config |= gct_encode[(adr >> 1) & 0xf   ] << 12;
-	phy_config |=            (adr & 1 )           << 16;
-	phy_config |= gct_encode[(data & 0xf000)>>12] << 24;
-
-	phy_config |= 0x90000000; // MAC will bang bits to the chip
-
-
-	write_nic_dword(dev,PHY_CONFIG,phy_config);
-#ifdef DEBUG_GCT
-	DMESG("Writing GCT: %x (adr %x)",phy_config,adr);
-#endif
-	gct_rf_stabilize(dev);
-}
-
-
-
-void gct_write_phy_antenna(struct net_device *dev,short ch)
-{
-	struct r8180_priv *priv = ieee80211_priv(dev);
-	u8 ant;
-
-	ant = GCT_ANTENNA;
-	if(priv->antb) /*default antenna is antenna B */
-		ant |= BB_ANTENNA_B;
-	if(ch == 14)
-		ant |= BB_ANTATTEN_CHAN14;
-	write_phy(dev,0x10,ant);
-	//DMESG("BB antenna %x ",ant);
-}
-
-
-void gct_rf_set_chan(struct net_device *dev, short ch)
-{
-	struct r8180_priv *priv = ieee80211_priv(dev);
-	u32 txpw = 0xff & priv->chtxpwr[ch];
-	u32 chan = gct_chan[ch];
-
-	//write_phy(dev,3,txpw);
-#ifdef DEBUG_GCT
-	DMESG("Gct set channel");
-#endif
-	/* set TX power */
-	write_gct(dev,0x15,0);
- 	write_gct(dev,6, txpw);
-	write_gct(dev,0x15, 0x10);
-	write_gct(dev,0x15,0);
-
-	/*set frequency*/
-	write_gct(dev,7, 0);
-      	write_gct(dev,0xB, chan);
-      	write_gct(dev,7, 0x1000);
-
-#ifdef DEBUG_GCT
-	DMESG("Gct set channel > write phy antenna");
-#endif
-
-
-	gct_write_phy_antenna(dev,ch);
-
-}
-
-
-void gct_rf_close(struct net_device *dev)
-{
-	u32 anaparam;
-
-	anaparam = read_nic_dword(dev,ANAPARAM);
-	anaparam &= 0x000fffff;
-	anaparam |= 0x3f900000;
-	rtl8180_set_anaparam(dev, anaparam);
-
-	write_gct(dev, 0x7, 0);
-	write_gct(dev, 0x1f, 0x45);
-	write_gct(dev, 0x1f, 0x5);
-	write_gct(dev, 0x0, 0x8e4);
-}
-
-
-void gct_rf_init(struct net_device *dev)
-{
-	struct r8180_priv *priv = ieee80211_priv(dev);
-	//u32 anaparam;
-
-
-	write_nic_byte(dev,PHY_DELAY,0x6);	//this is general
-	write_nic_byte(dev,CARRIER_SENSE_COUNTER,0x4c); //this is general
-
-	//DMESG("%x", read_nic_dword(dev,ANAPARAM));
-	/* we should set anaparm here*/
-	//rtl8180_set_anaparam(dev,anaparam);
-
-	write_gct(dev,0x1f,0);
-	write_gct(dev,0x1f,0);
-	write_gct(dev,0x1f,0x40);
-	write_gct(dev,0x1f,0x60);
-	write_gct(dev,0x1f,0x61);
-	write_gct(dev,0x1f,0x61);
-	write_gct(dev,0x0,0xae4);
-	write_gct(dev,0x1f,0x1);
-	write_gct(dev,0x1f,0x41);
-	write_gct(dev,0x1f,0x61);
-	write_gct(dev,0x1,0x1a23);
-	write_gct(dev,0x2,0x4971);
-	write_gct(dev,0x3,0x41de);
-	write_gct(dev,0x4,0x2d80);
-#ifdef GCT_EXPERIMENT1
-	//write_gct(dev,0x5,0x6810);  // from zydas driver. sens+ but quite slow
-	//write_gct(dev,0x5,0x681f);  //good+ (somewhat stable, better sens, performance decent)
-	write_gct(dev,0x5,0x685f);  //good performances, not sure sens is really so beeter
-	//write_gct(dev,0x5,0x687f);  //good performances, maybe sens is not improved
-	//write_gct(dev,0x5,0x689f);  //like above
-	//write_gct(dev,0x5,0x685e);  //bad
-	//write_gct(dev,0x5,0x68ff);  //good+ (somewhat stable, better sens(?), performance decent)
-	//write_gct(dev,0x5,0x68f0);  //bad
-	//write_gct(dev,0x5,0x6cff);  //sens+ but not so good
-	//write_gct(dev,0x5,0x6dff);  //sens+,apparentely very good but broken
-	//write_gct(dev,0x5,0x65ff);  //sens+,good
-	//write_gct(dev,0x5,0x78ff);  //sens + but almost broken
-	//write_gct(dev,0x5,0x7810);  //- //snes + but broken
-	//write_gct(dev,0x5,0x781f);  //-- //sens +
-	//write_gct(dev,0x5,0x78f0);  //low sens
-#else
-	write_gct(dev,0x5,0x61ff);   //best performance but weak sensitivity
-#endif
-#ifdef GCT_EXPERIMENT2
-	write_gct(dev,0x6,0xe);
-#else
-	write_gct(dev,0x6,0x0);
-#endif
-	write_gct(dev,0x7,0x0);
-	write_gct(dev,0x8,0x7533);
-	write_gct(dev,0x9,0xc401);
-	write_gct(dev,0xa,0x0);
-	write_gct(dev,0xc,0x1c7);
-	write_gct(dev,0xd,0x29d3);
-	write_gct(dev,0xe,0x2e8);
-	write_gct(dev,0x10,0x192);
-#ifdef GCT_EXPERIMENT3
-	write_gct(dev,0x11,0x246);
-#else
-	write_gct(dev,0x11,0x248);
-#endif
-	write_gct(dev,0x12,0x0);
-	write_gct(dev,0x13,0x20c4);
-#ifdef GCT_EXPERIMENT4
-	write_gct(dev,0x14,0xf488);
-#else
-	write_gct(dev,0x14,0xf4fc);
-#endif
-#ifdef GCT_EXPERIMENT5
-	write_gct(dev,0x15,0xb152);
-#else
-	write_gct(dev,0x15,0x0);
-#endif
-#ifdef GCT_EXPERIMENT6
-	write_gct(dev,0x1e,0x1);
-#endif
-	write_gct(dev,0x16,0x1500);
-
-	write_gct(dev,0x7,0x1000);
-	/*write_gct(dev,0x15,0x0);
-	write_gct(dev,0x6,0x15);
-	write_gct(dev,0x15,0x8);
-	write_gct(dev,0x15,0x0);
-*/
-	write_phy(dev,0,0xa8);
-
-/*	write_gct(dev,0x15,0x0);
-	write_gct(dev,0x6,0x12);
-	write_gct(dev,0x15,0x8);
-	write_gct(dev,0x15,0x0);
-*/
-	write_phy(dev,3,0x0);
-	write_phy(dev,4,0xc0); /* lna det*/
-	write_phy(dev,5,0x90);
-	write_phy(dev,6,0x1e);
-	write_phy(dev,7,0x64);
-
-#ifdef DEBUG_GCT
-	DMESG("Gct init> write phy antenna");
-#endif
-
-	gct_write_phy_antenna(dev,priv->chan);
-
-	write_phy(dev,0x11,0x88);
-	if(!priv->diversity)
-		write_phy(dev,0x12,0xc0);
-	else
-		write_phy(dev,0x12,0x40);
-
-	write_phy(dev,0x13,0x90 | priv->cs_treshold );
-
-	write_phy(dev,0x19,0x0);
-	write_phy(dev,0x1a,0xa0);
-	write_phy(dev,0x1b,0x44);
-
-#ifdef DEBUG_GCT
-	DMESG("Gct init > set channel2");
-#endif
-
-	gct_rf_set_chan(dev,priv->chan);
-}
Index: b/drivers/staging/rtl8187se/r8180_gct.h
===================================================================
--- a/drivers/staging/rtl8187se/r8180_gct.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
-	This is part of rtl8180 OpenSource driver - v 0.20
-	Copyright (C) Andrea Merello 2004  <andreamrl@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.
-*/
-
-#define GCT_ANTENNA 0xA3
-
-
-// we use the untouched eeprom value- cross your finger ;-)
-#define GCT_ANAPARAM_PWR1_ON ??
-#define GCT_ANAPARAM_PWR0_ON ??
-
-
-
-void gct_rf_init(struct net_device *dev);
-void gct_rf_set_chan(struct net_device *dev,short ch);
-
-void gct_rf_close(struct net_device *dev);
Index: b/drivers/staging/rtl8187se/r8180_max2820.c
===================================================================
--- a/drivers/staging/rtl8187se/r8180_max2820.c
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
-   This files contains MAXIM MAX2820 radio frontend programming routines.
-
-   This is part of rtl8180 OpenSource driver
-   Copyright (C) Andrea Merello 2004-2005  <andreamrl@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.
-
-   NetBSD rtl8180 driver from Dave Young has been really useful to
-   understand how to program the MAXIM radio. Thanks a lot!!!
-
-   'The Deuce' tested this and fixed some bugs.
-
-   Code from rtl8181 project has been useful to me to understand some things.
-
-   We want to tanks the Authors of such projects and the Ndiswrapper
-   project Authors.
-*/
-
-
-#include "r8180.h"
-#include "r8180_hw.h"
-#include "r8180_max2820.h"
-
-
-//#define DEBUG_MAXIM
-
-u32 maxim_chan[] = {
-	0,	//dummy channel 0
-	12, //1
-	17, //2
-	22, //3
-	27, //4
-	32, //5
-	37, //6
-	42, //7
-	47, //8
-	52, //9
-	57, //10
-	62, //11
-	67, //12
-	72, //13
-	84, //14
-};
-
-void write_maxim(struct net_device *dev,u8 adr, u32 data) {
-	u32 temp;
-	temp =  0x90 + (data & 0xf);
-	temp <<= 16;
-	temp += adr;
-	temp <<= 8;
-	temp += (data >> 4) & 0xff;
-#ifdef DEBUG_MAXIM
-	DMESG("write_maxim: %08x", temp);
-#endif
-	write_nic_dword(dev, PHY_CONFIG, temp);
-	force_pci_posting(dev);
-	mdelay(1);
-}
-
-
-void maxim_write_phy_antenna(struct net_device *dev,short ch)
-{
-	struct r8180_priv *priv = ieee80211_priv(dev);
-	u8 ant;
-
-	ant = MAXIM_ANTENNA;
-	if(priv->antb) /*default antenna is antenna B */
-		ant |= BB_ANTENNA_B;
-	if(ch == 14)
-		ant |= BB_ANTATTEN_CHAN14;
-	write_phy(dev,0x10,ant);
-	//DMESG("BB antenna %x ",ant);
-}
-
-
-void maxim_rf_set_chan(struct net_device *dev, short ch)
-{
-	struct r8180_priv *priv = ieee80211_priv(dev);
-	u32 txpw = 0xff & priv->chtxpwr[ch];
-	u32 chan = maxim_chan[ch];
-
-	/*While philips SA2400 drive the PA bias
-	 *seems that for MAXIM we delegate this
-	 *to the BB
-	 */
-
-	//write_maxim(dev,5,txpw);
-	write_phy(dev,3,txpw);
-
-	maxim_write_phy_antenna(dev,ch);
-	write_maxim(dev,3,chan);
-}
-
-
-void maxim_rf_close(struct net_device *dev)
-{
-	write_phy(dev, 3, 0x8);
-	write_maxim(dev, 1, 0);
-}
-
-
-void maxim_rf_init(struct net_device *dev)
-{
-	struct r8180_priv *priv = ieee80211_priv(dev);
-	u32 anaparam;
-
-	write_nic_byte(dev,PHY_DELAY,0x6);	//this is general
-	write_nic_byte(dev,CARRIER_SENSE_COUNTER,0x4c); //this is general
-
-	/*these are maxim specific*/
-	anaparam = read_nic_dword(dev,ANAPARAM);
-	anaparam = anaparam &~ (ANAPARAM_TXDACOFF_SHIFT);
-	anaparam = anaparam &~ANAPARAM_PWR1_MASK;
-	anaparam = anaparam &~ANAPARAM_PWR0_MASK;
-	anaparam |= (MAXIM_ANAPARAM_PWR1_ON<<ANAPARAM_PWR1_SHIFT);
-	anaparam |= (MAXIM_ANAPARAM_PWR0_ON<<ANAPARAM_PWR0_SHIFT);
-
-	//rtl8180_set_anaparam(dev,anaparam);
-
-	/* MAXIM from netbsd driver */
-
-	write_maxim(dev,0, 7); /* test mode as indicated in datasheet*/
-	write_maxim(dev,1, 0x1e); /* enable register*/
-	write_maxim(dev,2, 1); /* synt register */
-
-
-	maxim_rf_set_chan(dev,priv->chan);
-
-	write_maxim(dev,4, 0x313); /* rx register*/
-
-	/* PA is driven directly by the BB, we keep the MAXIM bias
-	 * at the highest value in the boubt tha pleacing it to lower
-	 * values may introduce some further attenuation somewhere..
-	 */
-
-	write_maxim(dev,5, 0xf);
-
-
-	/*baseband configuration*/
-	write_phy(dev,0,0x88); //sys1
-	write_phy(dev,3,0x8); //txagc
-	write_phy(dev,4,0xf8); // lnadet
-	write_phy(dev,5,0x90); // ifagcinit
-	write_phy(dev,6,0x1a); // ifagclimit
-	write_phy(dev,7,0x64); // ifagcdet
-
-	/*Should be done something more here??*/
-
-	maxim_write_phy_antenna(dev,priv->chan);
-
-	write_phy(dev,0x11,0x88); //trl
-	if(priv->diversity)
-		write_phy(dev,0x12,0xc7);
-	else
-		write_phy(dev,0x12,0x47);
-
-	write_phy(dev,0x13,0x9b);
-
-	write_phy(dev,0x19,0x0); //CHESTLIM
-	write_phy(dev,0x1a,0x9f); //CHSQLIM
-
-	maxim_rf_set_chan(dev,priv->chan);
-}
Index: b/drivers/staging/rtl8187se/r8180_max2820.h
===================================================================
--- a/drivers/staging/rtl8187se/r8180_max2820.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
-	This is part of rtl8180 OpenSource driver
-	Copyright (C) Andrea Merello 2004-2005  <andreamrl@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.
-*/
-
-#define MAXIM_ANTENNA 0xb3
-#define MAXIM_ANAPARAM_PWR1_ON 0x8
-#define MAXIM_ANAPARAM_PWR0_ON 0x0
-
-
-void maxim_rf_init(struct net_device *dev);
-void maxim_rf_set_chan(struct net_device *dev,short ch);
-
-void maxim_rf_close(struct net_device *dev);
Index: b/drivers/staging/rtl8187se/r8180_rtl8255.c
===================================================================
--- a/drivers/staging/rtl8187se/r8180_rtl8255.c
+++ /dev/null
@@ -1,1807 +0,0 @@
-/*
-  This is part of the rtl8180-sa2400 driver
-  released under the GPL (See file COPYING for details).
-  Copyright (c) 2005 Andrea Merello <andreamrl@tiscali.it>
-
-  This files contains programming code for the rtl8255
-  radio frontend.
-
-  *Many* thanks to Realtek Corp. for their great support!
-
-*/
-
-#define BAND_A 1
-#define BAND_BG 2
-
-#include "r8180.h"
-#include "r8180_hw.h"
-#include "r8180_rtl8255.h"
-
-u32 rtl8255_chan[] = {
-	0,	//dummy channel 0
-	0x13, //1
-	0x115, //2
-	0x217, //3
-	0x219, //4
-	0x31b, //5
-	0x41d, //6
-	0x41f, //7
-	0x621, //8
-	0x623, //9
-	0x625, //10
-	0x627, //11
-	0x829, //12
-	0x82b, //13
-	0x92f, // 14
-};
-
-static short rtl8255_gain_2G[]={
-	0x33, 0x17, 0x7c, 0xc5,//-78
-	0x43, 0x17, 0x7a, 0xc5,//-74
-	0x53, 0x17, 0x78, 0xc5,//-70
-	0x63, 0x17, 0x76, 0xc5,//-66
-};
-
-
-static short rtl8255_agc[]={
-	0x1, 0x1, 0x1, 0x1, 0x1,         0x1, 0x1, 0x1, 0x1, 0x1,
-
-	0x1, 0x1, 0x2, 0x2, 0x3,         0x3, 0x4, 0x4, 0x5, 0x5,
-	0x6, 0x6, 0x7, 0x7, 0x8,         0x8, 0x9, 0x9, 0xa, 0xa,
-	0xb, 0xb, 0xc, 0xc, 0xd,         0xd, 0xe, 0xe, 0xf, 0xf,
-
-	0x10, 0x10, 0x11, 0x11, 0x12,    0x12, 0x13, 0x13, 0x14, 0x14,
-	0x15, 0x15, 0x16, 0x16, 0x17,    0x17, 0x18, 0x18, 0x19, 0x19,
-	0x1a, 0x1a, 0x1b, 0x1b, 0x1c,    0x1c, 0x1d, 0x1d, 0x1e, 0x1e,
-	0x1f, 0x1f,
-
-	0x20, 0x20, 0x21, 0x21, 0x22,    0x22, 0x23, 0x23, 0x24, 0x24,
-	0x25, 0x25, 0x26, 0x26, 0x27,    0x27, 0x28, 0x28, 0x29, 0x29,
-	0x2a, 0x2a,
-
-	0x2a, 0x2a, 0x2a, 0x2a, 0x2a,    0x2a, 0x2a, 0x2a, 0x2a, 0x2a,
-	0x2a, 0x2a, 0x2a, 0x2a, 0x2a,    0x2a, 0x2a, 0x2a, 0x2a, 0x2a,
-	0x2a, 0x2a, 0x2a, 0x2a, 0x2a,    0x2a, 0x2a, 0x2a, 0x2a, 0x2a,
-	0x2a, 0x2a, 0x2a, 0x2a
-
-};
-
-void rtl8255_set_gain(struct net_device *dev, short gain)
-{
-
-//	struct r8180_priv *priv = ieee80211_priv(dev);
-
-	write_phy_ofdm(dev, 0x0d, rtl8255_gain_2G[gain * 4]);
-	write_phy_ofdm(dev, 0x23, rtl8255_gain_2G[gain * 4 + 1]);
-	write_phy_ofdm(dev, 0x1b, rtl8255_gain_2G[gain * 4 + 2]);
-	write_phy_ofdm(dev, 0x1d, rtl8255_gain_2G[gain * 4 + 3]);
-	//rtl8225_set_gain_usb(dev, gain);
-}
-
-void write_rtl8255_reg0c(struct net_device *dev, u32 d1, u32 d2, u32 d3, u32 d4,
-u32 d5, u32 d6, u32 d7, u32 d8, u32 d9, u32 d10)
-{
-	int i,j;
-	u16 out,select;
-	u8 bit;
-	u32 bangdata;
-//	struct r8180_priv *priv = ieee80211_priv(dev);
-
-	write_nic_word(dev,RFPinsEnable,
-		(read_nic_word(dev,RFPinsEnable) | 0x7));
-
-	select = read_nic_word(dev, RFPinsSelect);
-
-	write_nic_word(dev, RFPinsSelect, select | 0x7 | SW_CONTROL_GPIO);
-
-	out = read_nic_word(dev, RFPinsOutput) & 0xfff3;
-
-	write_nic_word(dev, RFPinsOutput, out | BB_HOST_BANG_EN );//| 0x1fff);
-
-	force_pci_posting(dev);
-	udelay(2);
-
-	write_nic_word(dev, RFPinsOutput, out);
-
-	force_pci_posting(dev);
-	udelay(2);
-
-	for(j=0;j<10;j++)
-	{
-		switch(j)
-		{
-			case 9:
-			bangdata = d10 | 0x0c;
-			break;
-			case 8:
-			bangdata = d9;
-			break;
-			case 7:
-			bangdata = d8;
-			break;
-			case 6:
-			bangdata = d7;
-			break;
-			case 5:
-			bangdata = d6;
-			break;
-			case 4:
-			bangdata = d5;
-			break;
-			case 3:
-			bangdata = d4;
-			break;
-			case 2:
-			bangdata = d3;
-			break;
-			case 1:
-			bangdata = d2;
-			break;
-			case 0:
-			bangdata = d1;
-			break;
-			default:
-			bangdata=0xbadc0de; /* avoid gcc complaints */
-			break;
-		}
-
-		for(i=31; i>=0;i--){
-
-			bit = (bangdata & (1<<i)) >> i;
-
-			write_nic_word(dev, RFPinsOutput, bit | out);
-			force_pci_posting(dev);
-			udelay(1);
-			write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
-			force_pci_posting(dev);
-			udelay(1);
-		//	write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
-			i--;
-			bit = (bangdata & (1<<i)) >> i;
-
-			write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
-			force_pci_posting(dev);
-			udelay(1);
-		//	write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
-			write_nic_word(dev, RFPinsOutput, bit | out);
-			force_pci_posting(dev);
-			udelay(1);
-		}
-	}
-
-	write_nic_word(dev, RFPinsOutput, out | BB_HOST_BANG_EN);
-	force_pci_posting(dev);
-	udelay(10);
-
-//	write_nic_word(dev, RFPinsOutput, out | BB_HOST_BANG_EN);
-	write_nic_word(dev, RFPinsSelect, select | SW_CONTROL_GPIO);
-//	rtl8185_rf_pins_enable(dev);
-
-}
-
-void write_rtl8255(struct net_device *dev, u8 adr, u16 data)
-{
-	int i;
-	u16 out,select;
-	u8 bit;
-	u32 bangdata = (data << 4) | (adr & 0xf);
-//	struct r8180_priv *priv = ieee80211_priv(dev);
-
-	out = read_nic_word(dev, RFPinsOutput) & 0xfff3;
-
-	write_nic_word(dev,RFPinsEnable,
-		(read_nic_word(dev,RFPinsEnable) | 0x7));
-
-	select = read_nic_word(dev, RFPinsSelect);
-
-	write_nic_word(dev, RFPinsSelect, select | 0x7 | SW_CONTROL_GPIO);
-
-	force_pci_posting(dev);
-	udelay(10);
-
-	write_nic_word(dev, RFPinsOutput, out | BB_HOST_BANG_EN );//| 0x1fff);
-
-	force_pci_posting(dev);
-	udelay(2);
-
-	write_nic_word(dev, RFPinsOutput, out);
-
-	force_pci_posting(dev);
-	udelay(10);
-
-
-	for(i=15; i>=0;i--){
-
-		bit = (bangdata & (1<<i)) >> i;
-
-		write_nic_word(dev, RFPinsOutput, bit | out);
-		write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
-		write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
-		i--;
-		bit = (bangdata & (1<<i)) >> i;
-
-		write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
-		write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
-		write_nic_word(dev, RFPinsOutput, bit | out);
-	}
-
-
-	write_nic_word(dev, RFPinsOutput, out | BB_HOST_BANG_EN);
-
-	force_pci_posting(dev);
-	udelay(10);
-
-	write_nic_word(dev, RFPinsOutput, out | BB_HOST_BANG_EN);
-	write_nic_word(dev, RFPinsSelect, select | SW_CONTROL_GPIO);
-
-	rtl8185_rf_pins_enable(dev);
-}
-
-void rtl8255_rf_close(struct net_device *dev)
-{
-
-//	rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_OFF);
-//	rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_OFF);
-}
-
-void rtl8255_SetTXPowerLevel(struct net_device *dev, short ch)
-{
-	struct r8180_priv *priv = ieee80211_priv(dev);
-
-	u8 cck_power_level = 0xff & priv->chtxpwr[ch];
-	u8 ofdm_power_level = 0xff & priv->chtxpwr_ofdm[ch];
-	write_nic_byte(dev, TX_GAIN_OFDM, ofdm_power_level);
-	write_nic_byte(dev, TX_GAIN_CCK, cck_power_level);
-	force_pci_posting(dev);
-	mdelay(1);
-	//write_nic_byte(dev, TX_AGC_CONTROL,4);
-}
-
-void rtl8255_rf_set_chan(struct net_device *dev, short ch)
-{
-	//write_rtl8225(dev, 0x7, rtl8225_chan[1]);
-	write_rtl8255(dev, 0x5, 0x65);
-	write_rtl8255(dev, 0x6, rtl8255_chan[ch]);
-	write_rtl8255(dev, 0x7, 0x7c);
-	write_rtl8255(dev, 0x8, 0x6);
-
-
-	force_pci_posting(dev);
-	set_current_state(TASK_INTERRUPTIBLE);
-	schedule_timeout(HZ);
-//	rtl8225_set_mode_B(dev);
-
-	rtl8255_SetTXPowerLevel(dev, ch);
-	/* FIXME FIXME FIXME */
-}
-
-void rtl8255_init_BGband(struct net_device *dev)
-{
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x1, 0x807);
-	write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x804187cf, 0x40000027,
-		0x92402ac0, 0xf0009, 0x28000, 0xc00, 0x0);
-	write_rtl8255(dev, 0x1, 0x807);
-	write_rtl8255(dev, 0x4, 0xc00);
-	write_rtl8255(dev, 0x4, 0xe00);
-	write_rtl8255(dev, 0x4, 0xc00);
-	write_rtl8255(dev, 0x1, 0x0);
-	write_rtl8255(dev, 0x4, 0x800);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0xa00);
-	write_rtl8255(dev, 0x4, 0x800);
-	write_rtl8255(dev, 0x4, 0x400);
-	write_rtl8255(dev, 0x3, 0x26);
-	write_rtl8255(dev, 0x2, 0x27);
-	write_rtl8255(dev, 0x4, 0x600);
-	write_rtl8255(dev, 0x4, 0x400);
-	write_rtl8255(dev, 0x4, 0x400);
-	write_rtl8255(dev, 0x3, 0x100);
-	write_rtl8255(dev, 0x4, 0x600);
-	write_rtl8255(dev, 0x4, 0x400);
-	write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x804187ce, 0x80000027,
-		0x92402ac0, 0xf0009, 0x28000, 0xc00, 0x0);
-	write_rtl8255(dev, 0x1, 0x807);
-	write_rtl8255(dev, 0x4, 0xc01);
-	write_rtl8255(dev, 0x4, 0xe01);
-	write_rtl8255(dev, 0x4, 0xc01);
-	write_rtl8255(dev, 0x1, 0x0);
-	write_rtl8255(dev, 0x4, 0x801);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0xa01);
-	write_rtl8255(dev, 0x4, 0x801);
-	write_rtl8255(dev, 0x4, 0x401);
-	write_rtl8255(dev, 0x3, 0x26);
-	write_rtl8255(dev, 0x2, 0x27);
-	write_rtl8255(dev, 0x4, 0x601);
-	write_rtl8255(dev, 0x4, 0x401);
-	write_rtl8255(dev, 0x4, 0x401);
-	write_rtl8255(dev, 0x3, 0x100);
-	write_rtl8255(dev, 0x4, 0x601);
-	write_rtl8255(dev, 0x4, 0x401);
-	write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80418bdf, 0x40000027,
-		0x92402ac4, 0xf0009, 0x28000, 0xc00, 0x0);
-	write_rtl8255(dev, 0x1, 0x807);
-	write_rtl8255(dev, 0x4, 0xc02);
-	write_rtl8255(dev, 0x4, 0xe02);
-	write_rtl8255(dev, 0x4, 0xc02);
-	write_rtl8255(dev, 0x1, 0x0);
-	write_rtl8255(dev, 0x4, 0x802);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0xa02);
-	write_rtl8255(dev, 0x4, 0x802);
-	write_rtl8255(dev, 0x4, 0x402);
-	write_rtl8255(dev, 0x3, 0x26);
-	write_rtl8255(dev, 0x2, 0x26);
-	write_rtl8255(dev, 0x4, 0x602);
-	write_rtl8255(dev, 0x4, 0x402);
-	write_rtl8255(dev, 0x4, 0x402);
-	write_rtl8255(dev, 0x3, 0x100);
-	write_rtl8255(dev, 0x4, 0x602);
-	write_rtl8255(dev, 0x4, 0x402);
-	write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80418bbf, 0x40000027,
-		0x92402ac4, 0xf0009, 0x28000, 0xc00, 0x0);
-	write_rtl8255(dev, 0x1, 0x807);
-	write_rtl8255(dev, 0x4, 0xc03);
-	write_rtl8255(dev, 0x4, 0xe03);
-	write_rtl8255(dev, 0x4, 0xc03);
-	write_rtl8255(dev, 0x1, 0x0);
-	write_rtl8255(dev, 0x4, 0x803);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0xa03);
-	write_rtl8255(dev, 0x4, 0x803);
-	write_rtl8255(dev, 0x4, 0x403);
-	write_rtl8255(dev, 0x3, 0x26);
-	write_rtl8255(dev, 0x2, 0x26);
-	write_rtl8255(dev, 0x4, 0x603);
-	write_rtl8255(dev, 0x4, 0x403);
-	write_rtl8255(dev, 0x4, 0x403);
-	write_rtl8255(dev, 0x3, 0x100);
-	write_rtl8255(dev, 0x4, 0x603);
-	write_rtl8255(dev, 0x4, 0x403);
-	write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80418b9f, 0x40000027,
-		0x92402ac8, 0xf0009, 0x28000, 0xc00, 0x0);
-	write_rtl8255(dev, 0x1, 0x807);
-	write_rtl8255(dev, 0x4, 0xc04);
-	write_rtl8255(dev, 0x4, 0xe04);
-	write_rtl8255(dev, 0x4, 0xc04);
-	write_rtl8255(dev, 0x1, 0x0);
-	write_rtl8255(dev, 0x4, 0x804);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0xa04);
-	write_rtl8255(dev, 0x4, 0x804);
-	write_rtl8255(dev, 0x4, 0x404);
-	write_rtl8255(dev, 0x3, 0x26);
-	write_rtl8255(dev, 0x2, 0x26);
-	write_rtl8255(dev, 0x4, 0x604);
-	write_rtl8255(dev, 0x4, 0x404);
-	write_rtl8255(dev, 0x4, 0x404);
-	write_rtl8255(dev, 0x3, 0x100);
-	write_rtl8255(dev, 0x4, 0x604);
-	write_rtl8255(dev, 0x4, 0x404);
-	write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x804183df, 0x40000027,
-		0x92402ac8, 0xf0009, 0x28000, 0xc00, 0x0);
-	write_rtl8255(dev, 0x1, 0x807);
-	write_rtl8255(dev, 0x4, 0xc05);
-	write_rtl8255(dev, 0x4, 0xe05);
-	write_rtl8255(dev, 0x4, 0xc05);
-	write_rtl8255(dev, 0x1, 0x0);
-	write_rtl8255(dev, 0x4, 0x805);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0xa05);
-	write_rtl8255(dev, 0x4, 0x805);
-	write_rtl8255(dev, 0x4, 0x405);
-	write_rtl8255(dev, 0x3, 0x26);
-	write_rtl8255(dev, 0x2, 0x26);
-	write_rtl8255(dev, 0x4, 0x605);
-	write_rtl8255(dev, 0x4, 0x405);
-	write_rtl8255(dev, 0x4, 0x405);
-	write_rtl8255(dev, 0x3, 0x100);
-	write_rtl8255(dev, 0x4, 0x605);
-	write_rtl8255(dev, 0x4, 0x405);
-	write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x804183cf, 0x27,
-		0x92402acc, 0xf0009, 0x28000, 0xc00, 0x0);
-	write_rtl8255(dev, 0x1, 0x807);
-	write_rtl8255(dev, 0x4, 0xc06);
-	write_rtl8255(dev, 0x4, 0xe06);
-	write_rtl8255(dev, 0x4, 0xc06);
-	write_rtl8255(dev, 0x1, 0x0);
-	write_rtl8255(dev, 0x4, 0x806);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0xa06);
-	write_rtl8255(dev, 0x4, 0x806);
-	write_rtl8255(dev, 0x4, 0x406);
-	write_rtl8255(dev, 0x3, 0x25);
-	write_rtl8255(dev, 0x2, 0x26);
-	write_rtl8255(dev, 0x4, 0x606);
-	write_rtl8255(dev, 0x4, 0x406);
-	write_rtl8255(dev, 0x4, 0x406);
-	write_rtl8255(dev, 0x3, 0x100);
-	write_rtl8255(dev, 0x4, 0x606);
-	write_rtl8255(dev, 0x4, 0x406);
-	write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x804183af, 0x27,
-		0x92402acc, 0xf0009, 0x28000, 0xc00, 0x0);
-	write_rtl8255(dev, 0x1, 0x807);
-	write_rtl8255(dev, 0x4, 0xc07);
-	write_rtl8255(dev, 0x4, 0xe07);
-	write_rtl8255(dev, 0x4, 0xc07);
-	write_rtl8255(dev, 0x1, 0x0);
-	write_rtl8255(dev, 0x4, 0x807);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0xa07);
-	write_rtl8255(dev, 0x4, 0x807);
-	write_rtl8255(dev, 0x4, 0x407);
-	write_rtl8255(dev, 0x3, 0x25);
-	write_rtl8255(dev, 0x2, 0x26);
-	write_rtl8255(dev, 0x4, 0x607);
-	write_rtl8255(dev, 0x4, 0x407);
-	write_rtl8255(dev, 0x4, 0x407);
-	write_rtl8255(dev, 0x3, 0x100);
-	write_rtl8255(dev, 0x4, 0x607);
-	write_rtl8255(dev, 0x4, 0x407);
-	write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x804083d7, 0x40000027,
-		0x92402ad0, 0xf0009, 0x28000, 0xc00, 0x0);
-	write_rtl8255(dev, 0x1, 0x807);
-	write_rtl8255(dev, 0x4, 0xc08);
-	write_rtl8255(dev, 0x4, 0xe08);
-	write_rtl8255(dev, 0x4, 0xc08);
-	write_rtl8255(dev, 0x1, 0x0);
-	write_rtl8255(dev, 0x4, 0x808);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0xa08);
-	write_rtl8255(dev, 0x4, 0x808);
-	write_rtl8255(dev, 0x4, 0x408);
-	write_rtl8255(dev, 0x3, 0x25);
-	write_rtl8255(dev, 0x2, 0x26);
-	write_rtl8255(dev, 0x4, 0x608);
-	write_rtl8255(dev, 0x4, 0x408);
-	write_rtl8255(dev, 0x4, 0x408);
-	write_rtl8255(dev, 0x3, 0x100);
-	write_rtl8255(dev, 0x4, 0x608);
-	write_rtl8255(dev, 0x4, 0x408);
-	write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x804083c7, 0x27,
-		0x92402ad0, 0xf0009, 0x28000, 0xc00, 0x0);
-	write_rtl8255(dev, 0x1, 0x807);
-	write_rtl8255(dev, 0x4, 0xc09);
-	write_rtl8255(dev, 0x4, 0xe09);
-	write_rtl8255(dev, 0x4, 0xc09);
-	write_rtl8255(dev, 0x1, 0x0);
-	write_rtl8255(dev, 0x4, 0x809);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0xa09);
-	write_rtl8255(dev, 0x4, 0x809);
-	write_rtl8255(dev, 0x4, 0x409);
-	write_rtl8255(dev, 0x3, 0x25);
-	write_rtl8255(dev, 0x2, 0x26);
-	write_rtl8255(dev, 0x4, 0x609);
-	write_rtl8255(dev, 0x4, 0x409);
-	write_rtl8255(dev, 0x4, 0x409);
-	write_rtl8255(dev, 0x3, 0x100);
-	write_rtl8255(dev, 0x4, 0x609);
-	write_rtl8255(dev, 0x4, 0x409);
-	write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x804043d7, 0x40000027,
-		0x92402ad4, 0xf0009, 0x28000, 0xc00, 0x0);
-	write_rtl8255(dev, 0x1, 0x807);
-	write_rtl8255(dev, 0x4, 0xc0a);
-	write_rtl8255(dev, 0x4, 0xe0a);
-	write_rtl8255(dev, 0x4, 0xc0a);
-	write_rtl8255(dev, 0x1, 0x0);
-	write_rtl8255(dev, 0x4, 0x80a);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0xa0a);
-	write_rtl8255(dev, 0x4, 0x80a);
-	write_rtl8255(dev, 0x4, 0x40a);
-	write_rtl8255(dev, 0x3, 0x25);
-	write_rtl8255(dev, 0x2, 0x26);
-	write_rtl8255(dev, 0x4, 0x60a);
-	write_rtl8255(dev, 0x4, 0x40a);
-	write_rtl8255(dev, 0x4, 0x40a);
-	write_rtl8255(dev, 0x3, 0x100);
-	write_rtl8255(dev, 0x4, 0x60a);
-	write_rtl8255(dev, 0x4, 0x40a);
-	write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x804043d7, 0x40000027,
-		0x92402ad4, 0xf0009, 0x28000, 0xc00, 0x0);
-	write_rtl8255(dev, 0x1, 0x807);
-	write_rtl8255(dev, 0x4, 0xc0b);
-	write_rtl8255(dev, 0x4, 0xe0b);
-	write_rtl8255(dev, 0x4, 0xc0b);
-	write_rtl8255(dev, 0x1, 0x0);
-	write_rtl8255(dev, 0x4, 0x80b);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0xa0b);
-	write_rtl8255(dev, 0x4, 0x80b);
-	write_rtl8255(dev, 0x4, 0x40b);
-	write_rtl8255(dev, 0x3, 0x25);
-	write_rtl8255(dev, 0x2, 0x26);
-	write_rtl8255(dev, 0x4, 0x60b);
-	write_rtl8255(dev, 0x4, 0x40b);
-	write_rtl8255(dev, 0x4, 0x40b);
-	write_rtl8255(dev, 0x3, 0x100);
-	write_rtl8255(dev, 0x4, 0x60b);
-	write_rtl8255(dev, 0x4, 0x40b);
-	write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x804043c7, 0x27,
-		0x92402ad8, 0xf0009, 0x28000, 0xc00, 0x0);
-	write_rtl8255(dev, 0x1, 0x807);
-	write_rtl8255(dev, 0x4, 0xc0c);
-	write_rtl8255(dev, 0x4, 0xe0c);
-	write_rtl8255(dev, 0x4, 0xc0c);
-	write_rtl8255(dev, 0x1, 0x0);
-	write_rtl8255(dev, 0x4, 0x80c);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0xa0c);
-	write_rtl8255(dev, 0x4, 0x80c);
-	write_rtl8255(dev, 0x4, 0x40c);
-	write_rtl8255(dev, 0x3, 0x25);
-	write_rtl8255(dev, 0x2, 0x26);
-	write_rtl8255(dev, 0x4, 0x60c);
-	write_rtl8255(dev, 0x4, 0x40c);
-	write_rtl8255(dev, 0x4, 0x40c);
-	write_rtl8255(dev, 0x3, 0x100);
-	write_rtl8255(dev, 0x4, 0x60c);
-	write_rtl8255(dev, 0x4, 0x40c);
-	write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x804043a7, 0x27,
-		0x92402ad8, 0xf0009, 0x28000, 0xc00, 0x0);
-	write_rtl8255(dev, 0x1, 0x807);
-	write_rtl8255(dev, 0x4, 0xc0d);
-	write_rtl8255(dev, 0x4, 0xe0d);
-	write_rtl8255(dev, 0x4, 0xc0d);
-	write_rtl8255(dev, 0x1, 0x0);
-	write_rtl8255(dev, 0x4, 0x80d);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0xa0d);
-	write_rtl8255(dev, 0x4, 0x80d);
-	write_rtl8255(dev, 0x4, 0x40d);
-	write_rtl8255(dev, 0x3, 0x25);
-	write_rtl8255(dev, 0x2, 0x26);
-	write_rtl8255(dev, 0x4, 0x60d);
-	write_rtl8255(dev, 0x4, 0x40d);
-	write_rtl8255(dev, 0x4, 0x40d);
-	write_rtl8255(dev, 0x3, 0x100);
-	write_rtl8255(dev, 0x4, 0x60d);
-	write_rtl8255(dev, 0x4, 0x40d);
-	write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404387, 0x27,
-		0x92402aa8, 0xf0009, 0x28000, 0xc00, 0x0);
-	write_rtl8255(dev, 0x1, 0x807);
-	write_rtl8255(dev, 0x4, 0xc0e);
-	write_rtl8255(dev, 0x4, 0xe0e);
-	write_rtl8255(dev, 0x4, 0xc0e);
-	write_rtl8255(dev, 0x1, 0x0);
-	write_rtl8255(dev, 0x4, 0x80e);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0xa0e);
-	write_rtl8255(dev, 0x4, 0x80e);
-	write_rtl8255(dev, 0x4, 0x40e);
-	write_rtl8255(dev, 0x3, 0x25);
-	write_rtl8255(dev, 0x2, 0x26);
-	write_rtl8255(dev, 0x4, 0x60e);
-	write_rtl8255(dev, 0x4, 0x40e);
-	write_rtl8255(dev, 0x4, 0x40e);
-	write_rtl8255(dev, 0x3, 0x100);
-	write_rtl8255(dev, 0x4, 0x60e);
-	write_rtl8255(dev, 0x4, 0x40e);
-	write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x804041c7, 0x27,
-		0x92402aa8, 0xf0009, 0x28000, 0xc00, 0x0);
-	write_rtl8255(dev, 0x1, 0x807);
-	write_rtl8255(dev, 0x4, 0xc0f);
-	write_rtl8255(dev, 0x4, 0xe0f);
-	write_rtl8255(dev, 0x4, 0xc0f);
-	write_rtl8255(dev, 0x1, 0x0);
-	write_rtl8255(dev, 0x4, 0x80f);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0xa0f);
-	write_rtl8255(dev, 0x4, 0x80f);
-	write_rtl8255(dev, 0x4, 0x40f);
-	write_rtl8255(dev, 0x3, 0x25);
-	write_rtl8255(dev, 0x2, 0x26);
-	write_rtl8255(dev, 0x4, 0x60f);
-	write_rtl8255(dev, 0x4, 0x40f);
-	write_rtl8255(dev, 0x4, 0x40f);
-	write_rtl8255(dev, 0x3, 0x100);
-	write_rtl8255(dev, 0x4, 0x60f);
-	write_rtl8255(dev, 0x4, 0x40f);
-	write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x804041a7, 0x27,
-		0x92402aac, 0xf0009, 0x28000, 0xc00, 0x0);
-	write_rtl8255(dev, 0x1, 0x807);
-	write_rtl8255(dev, 0x4, 0xc10);
-	write_rtl8255(dev, 0x4, 0xe10);
-	write_rtl8255(dev, 0x4, 0xc10);
-	write_rtl8255(dev, 0x1, 0x0);
-	write_rtl8255(dev, 0x4, 0x810);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0xa10);
-	write_rtl8255(dev, 0x4, 0x810);
-	write_rtl8255(dev, 0x4, 0x410);
-	write_rtl8255(dev, 0x3, 0x25);
-	write_rtl8255(dev, 0x2, 0x26);
-	write_rtl8255(dev, 0x4, 0x610);
-	write_rtl8255(dev, 0x4, 0x410);
-	write_rtl8255(dev, 0x4, 0x410);
-	write_rtl8255(dev, 0x3, 0x100);
-	write_rtl8255(dev, 0x4, 0x610);
-	write_rtl8255(dev, 0x4, 0x410);
-	write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404187, 0x27,
-		0x92402aac, 0xf0009, 0x28000, 0xc00, 0x0);
-	write_rtl8255(dev, 0x1, 0x807);
-	write_rtl8255(dev, 0x4, 0xc11);
-	write_rtl8255(dev, 0x4, 0xe11);
-	write_rtl8255(dev, 0x4, 0xc11);
-	write_rtl8255(dev, 0x1, 0x0);
-	write_rtl8255(dev, 0x4, 0x811);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0xa11);
-	write_rtl8255(dev, 0x4, 0x811);
-	write_rtl8255(dev, 0x4, 0x411);
-	write_rtl8255(dev, 0x3, 0x25);
-	write_rtl8255(dev, 0x2, 0x26);
-	write_rtl8255(dev, 0x4, 0x611);
-	write_rtl8255(dev, 0x4, 0x411);
-	write_rtl8255(dev, 0x4, 0x411);
-	write_rtl8255(dev, 0x3, 0x100);
-	write_rtl8255(dev, 0x4, 0x611);
-	write_rtl8255(dev, 0x4, 0x411);
-	write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404186, 0x80000027,
-		0x92402ab0, 0xf0009, 0x28000, 0xc00, 0x0);
-	write_rtl8255(dev, 0x1, 0x807);
-	write_rtl8255(dev, 0x4, 0xc12);
-	write_rtl8255(dev, 0x4, 0xe12);
-	write_rtl8255(dev, 0x4, 0xc12);
-	write_rtl8255(dev, 0x1, 0x0);
-	write_rtl8255(dev, 0x4, 0x812);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0xa12);
-	write_rtl8255(dev, 0x4, 0x812);
-	write_rtl8255(dev, 0x4, 0x412);
-	write_rtl8255(dev, 0x3, 0x25);
-	write_rtl8255(dev, 0x2, 0x26);
-	write_rtl8255(dev, 0x4, 0x612);
-	write_rtl8255(dev, 0x4, 0x412);
-	write_rtl8255(dev, 0x4, 0x412);
-	write_rtl8255(dev, 0x3, 0x100);
-	write_rtl8255(dev, 0x4, 0x612);
-	write_rtl8255(dev, 0x4, 0x412);
-	write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404186, 0x27,
-		0x92402ab0, 0xf0009, 0x28000, 0xc00, 0x0);
-	write_rtl8255(dev, 0x1, 0x807);
-	write_rtl8255(dev, 0x4, 0xc13);
-	write_rtl8255(dev, 0x4, 0xe13);
-	write_rtl8255(dev, 0x4, 0xc13);
-	write_rtl8255(dev, 0x1, 0x0);
-	write_rtl8255(dev, 0x4, 0x813);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0xa13);
-	write_rtl8255(dev, 0x4, 0x813);
-	write_rtl8255(dev, 0x4, 0x413);
-	write_rtl8255(dev, 0x3, 0x25);
-	write_rtl8255(dev, 0x2, 0x26);
-	write_rtl8255(dev, 0x4, 0x613);
-	write_rtl8255(dev, 0x4, 0x413);
-	write_rtl8255(dev, 0x4, 0x413);
-	write_rtl8255(dev, 0x3, 0x100);
-	write_rtl8255(dev, 0x4, 0x613);
-	write_rtl8255(dev, 0x4, 0x413);
-	write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404146, 0x27,
-		0x92402ab4, 0xf0009, 0x28000, 0xc00, 0x0);
-	write_rtl8255(dev, 0x1, 0x807);
-	write_rtl8255(dev, 0x4, 0xc14);
-	write_rtl8255(dev, 0x4, 0xe14);
-	write_rtl8255(dev, 0x4, 0xc14);
-	write_rtl8255(dev, 0x1, 0x0);
-	write_rtl8255(dev, 0x4, 0x814);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0xa14);
-	write_rtl8255(dev, 0x4, 0x814);
-	write_rtl8255(dev, 0x4, 0x414);
-	write_rtl8255(dev, 0x3, 0x25);
-	write_rtl8255(dev, 0x2, 0x26);
-	write_rtl8255(dev, 0x4, 0x614);
-	write_rtl8255(dev, 0x4, 0x414);
-	write_rtl8255(dev, 0x4, 0x414);
-	write_rtl8255(dev, 0x3, 0x100);
-	write_rtl8255(dev, 0x4, 0x614);
-	write_rtl8255(dev, 0x4, 0x414);
-	write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404126, 0x27,
-		0x92402ab4, 0xf0009, 0x28000, 0xc00, 0x0);
-	write_rtl8255(dev, 0x1, 0x807);
-	write_rtl8255(dev, 0x4, 0xc15);
-	write_rtl8255(dev, 0x4, 0xe15);
-	write_rtl8255(dev, 0x4, 0xc15);
-	write_rtl8255(dev, 0x1, 0x0);
-	write_rtl8255(dev, 0x4, 0x815);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0xa15);
-	write_rtl8255(dev, 0x4, 0x815);
-	write_rtl8255(dev, 0x4, 0x415);
-	write_rtl8255(dev, 0x3, 0x25);
-	write_rtl8255(dev, 0x2, 0x26);
-	write_rtl8255(dev, 0x4, 0x615);
-	write_rtl8255(dev, 0x4, 0x415);
-	write_rtl8255(dev, 0x4, 0x415);
-	write_rtl8255(dev, 0x3, 0x100);
-	write_rtl8255(dev, 0x4, 0x615);
-	write_rtl8255(dev, 0x4, 0x415);
-	write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404106, 0x27,
-		0x92402ab8, 0xf0009, 0x28000, 0xc00, 0x0);
-	write_rtl8255(dev, 0x1, 0x807);
-	write_rtl8255(dev, 0x4, 0xc16);
-	write_rtl8255(dev, 0x4, 0xe16);
-	write_rtl8255(dev, 0x4, 0xc16);
-	write_rtl8255(dev, 0x1, 0x0);
-	write_rtl8255(dev, 0x4, 0x816);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0xa16);
-	write_rtl8255(dev, 0x4, 0x816);
-	write_rtl8255(dev, 0x4, 0x416);
-	write_rtl8255(dev, 0x3, 0x25);
-	write_rtl8255(dev, 0x2, 0x26);
-	write_rtl8255(dev, 0x4, 0x616);
-	write_rtl8255(dev, 0x4, 0x416);
-	write_rtl8255(dev, 0x4, 0x416);
-	write_rtl8255(dev, 0x3, 0x100);
-	write_rtl8255(dev, 0x4, 0x616);
-	write_rtl8255(dev, 0x4, 0x416);
-	write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404105, 0x27,
-		0x92402ab8, 0xf0009, 0x28000, 0xc00, 0x0);
-	write_rtl8255(dev, 0x1, 0x807);
-	write_rtl8255(dev, 0x4, 0xc17);
-	write_rtl8255(dev, 0x4, 0xe17);
-	write_rtl8255(dev, 0x4, 0xc17);
-	write_rtl8255(dev, 0x1, 0x0);
-	write_rtl8255(dev, 0x4, 0x817);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0xa17);
-	write_rtl8255(dev, 0x4, 0x817);
-	write_rtl8255(dev, 0x4, 0x417);
-	write_rtl8255(dev, 0x3, 0x25);
-	write_rtl8255(dev, 0x2, 0x26);
-	write_rtl8255(dev, 0x4, 0x617);
-	write_rtl8255(dev, 0x4, 0x417);
-	write_rtl8255(dev, 0x4, 0x417);
-	write_rtl8255(dev, 0x3, 0x100);
-	write_rtl8255(dev, 0x4, 0x617);
-	write_rtl8255(dev, 0x4, 0x417);
-	write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404104, 0x80000027,
-		0x92402a88, 0xf0009, 0x28000, 0xc00, 0x0);
-	write_rtl8255(dev, 0x1, 0x807);
-	write_rtl8255(dev, 0x4, 0xc18);
-	write_rtl8255(dev, 0x4, 0xe18);
-	write_rtl8255(dev, 0x4, 0xc18);
-	write_rtl8255(dev, 0x1, 0x0);
-	write_rtl8255(dev, 0x4, 0x818);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0xa18);
-	write_rtl8255(dev, 0x4, 0x818);
-	write_rtl8255(dev, 0x4, 0x418);
-	write_rtl8255(dev, 0x3, 0x25);
-	write_rtl8255(dev, 0x2, 0x26);
-	write_rtl8255(dev, 0x4, 0x618);
-	write_rtl8255(dev, 0x4, 0x418);
-	write_rtl8255(dev, 0x4, 0x418);
-	write_rtl8255(dev, 0x3, 0x100);
-	write_rtl8255(dev, 0x4, 0x618);
-	write_rtl8255(dev, 0x4, 0x418);
-	write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404104, 0x27,
-		0x92402a88, 0xf0009, 0x28000, 0xc00, 0x0);
-	write_rtl8255(dev, 0x1, 0x807);
-	write_rtl8255(dev, 0x4, 0xc19);
-	write_rtl8255(dev, 0x4, 0xe19);
-	write_rtl8255(dev, 0x4, 0xc19);
-	write_rtl8255(dev, 0x1, 0x0);
-	write_rtl8255(dev, 0x4, 0x819);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0xa19);
-	write_rtl8255(dev, 0x4, 0x819);
-	write_rtl8255(dev, 0x4, 0x419);
-	write_rtl8255(dev, 0x3, 0x25);
-	write_rtl8255(dev, 0x2, 0x26);
-	write_rtl8255(dev, 0x4, 0x619);
-	write_rtl8255(dev, 0x4, 0x419);
-	write_rtl8255(dev, 0x4, 0x419);
-	write_rtl8255(dev, 0x3, 0x100);
-	write_rtl8255(dev, 0x4, 0x619);
-	write_rtl8255(dev, 0x4, 0x419);
-	write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404044, 0x27,
-		0x92402a8c, 0xf0009, 0x28000, 0xc00, 0x0);
-	write_rtl8255(dev, 0x1, 0x807);
-	write_rtl8255(dev, 0x4, 0xc1a);
-	write_rtl8255(dev, 0x4, 0xe1a);
-	write_rtl8255(dev, 0x4, 0xc1a);
-	write_rtl8255(dev, 0x1, 0x0);
-	write_rtl8255(dev, 0x4, 0x81a);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0xa1a);
-	write_rtl8255(dev, 0x4, 0x81a);
-	write_rtl8255(dev, 0x4, 0x41a);
-	write_rtl8255(dev, 0x3, 0x25);
-	write_rtl8255(dev, 0x2, 0x26);
-	write_rtl8255(dev, 0x4, 0x61a);
-	write_rtl8255(dev, 0x4, 0x41a);
-	write_rtl8255(dev, 0x4, 0x41a);
-	write_rtl8255(dev, 0x3, 0x100);
-	write_rtl8255(dev, 0x4, 0x61a);
-	write_rtl8255(dev, 0x4, 0x41a);
-	write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404024, 0x27,
-		0x92402a8c, 0xf0009, 0x28000, 0xc00, 0x0);
-	write_rtl8255(dev, 0x1, 0x807);
-	write_rtl8255(dev, 0x4, 0xc1b);
-	write_rtl8255(dev, 0x4, 0xe1b);
-	write_rtl8255(dev, 0x4, 0xc1b);
-	write_rtl8255(dev, 0x1, 0x0);
-	write_rtl8255(dev, 0x4, 0x81b);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0xa1b);
-	write_rtl8255(dev, 0x4, 0x81b);
-	write_rtl8255(dev, 0x4, 0x41b);
-	write_rtl8255(dev, 0x3, 0x25);
-	write_rtl8255(dev, 0x2, 0x26);
-	write_rtl8255(dev, 0x4, 0x61b);
-	write_rtl8255(dev, 0x4, 0x41b);
-	write_rtl8255(dev, 0x4, 0x41b);
-	write_rtl8255(dev, 0x3, 0x100);
-	write_rtl8255(dev, 0x4, 0x61b);
-	write_rtl8255(dev, 0x4, 0x41b);
-	write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404004, 0x27,
-		0x92402a90, 0xf0009, 0x28000, 0xc00, 0x0);
-	write_rtl8255(dev, 0x1, 0x807);
-	write_rtl8255(dev, 0x4, 0xc1c);
-	write_rtl8255(dev, 0x4, 0xe1c);
-	write_rtl8255(dev, 0x4, 0xc1c);
-	write_rtl8255(dev, 0x1, 0x0);
-	write_rtl8255(dev, 0x4, 0x81c);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0xa1c);
-	write_rtl8255(dev, 0x4, 0x81c);
-	write_rtl8255(dev, 0x4, 0x41c);
-	write_rtl8255(dev, 0x3, 0x25);
-	write_rtl8255(dev, 0x2, 0x26);
-	write_rtl8255(dev, 0x4, 0x61c);
-	write_rtl8255(dev, 0x4, 0x41c);
-	write_rtl8255(dev, 0x4, 0x41c);
-	write_rtl8255(dev, 0x3, 0x100);
-	write_rtl8255(dev, 0x4, 0x61c);
-	write_rtl8255(dev, 0x4, 0x41c);
-	write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404001, 0x27,
-		0x92402a90, 0xf0009, 0x28000, 0xc00, 0x0);
-	write_rtl8255(dev, 0x1, 0x807);
-	write_rtl8255(dev, 0x4, 0xc1d);
-	write_rtl8255(dev, 0x4, 0xe1d);
-	write_rtl8255(dev, 0x4, 0xc1d);
-	write_rtl8255(dev, 0x1, 0x0);
-	write_rtl8255(dev, 0x4, 0x81d);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0xa1d);
-	write_rtl8255(dev, 0x4, 0x81d);
-	write_rtl8255(dev, 0x4, 0x41d);
-	write_rtl8255(dev, 0x3, 0x25);
-	write_rtl8255(dev, 0x2, 0x26);
-	write_rtl8255(dev, 0x4, 0x61d);
-	write_rtl8255(dev, 0x4, 0x41d);
-	write_rtl8255(dev, 0x4, 0x41d);
-	write_rtl8255(dev, 0x3, 0x100);
-	write_rtl8255(dev, 0x4, 0x61d);
-	write_rtl8255(dev, 0x4, 0x41d);
-	write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404000, 0x80000027,
-		0x92402a94, 0xf0009, 0x28000, 0xc00, 0x0);
-	write_rtl8255(dev, 0x1, 0x807);
-	write_rtl8255(dev, 0x4, 0xc1e);
-	write_rtl8255(dev, 0x4, 0xe1e);
-	write_rtl8255(dev, 0x4, 0xc1e);
-	write_rtl8255(dev, 0x1, 0x0);
-	write_rtl8255(dev, 0x4, 0x81e);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0xa1e);
-	write_rtl8255(dev, 0x4, 0x81e);
-	write_rtl8255(dev, 0x4, 0x41e);
-	write_rtl8255(dev, 0x3, 0x25);
-	write_rtl8255(dev, 0x2, 0x26);
-	write_rtl8255(dev, 0x4, 0x61e);
-	write_rtl8255(dev, 0x4, 0x41e);
-	write_rtl8255(dev, 0x4, 0x41e);
-	write_rtl8255(dev, 0x3, 0x100);
-	write_rtl8255(dev, 0x4, 0x61e);
-	write_rtl8255(dev, 0x4, 0x41e);
-	write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404000, 0x27,
-		0x92402a94, 0xf0009, 0x28000, 0xc00, 0x0);
-	write_rtl8255(dev, 0x1, 0x807);
-	write_rtl8255(dev, 0x4, 0xc1f);
-	write_rtl8255(dev, 0x4, 0xe1f);
-	write_rtl8255(dev, 0x4, 0xc1f);
-	write_rtl8255(dev, 0x1, 0x0);
-	write_rtl8255(dev, 0x4, 0x81f);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0xa1f);
-	write_rtl8255(dev, 0x4, 0x81f);
-	write_rtl8255(dev, 0x4, 0x41f);
-	write_rtl8255(dev, 0x3, 0x25);
-	write_rtl8255(dev, 0x2, 0x26);
-	write_rtl8255(dev, 0x4, 0x61f);
-	write_rtl8255(dev, 0x4, 0x41f);
-	write_rtl8255(dev, 0x4, 0x41f);
-	write_rtl8255(dev, 0x3, 0x100);
-	write_rtl8255(dev, 0x4, 0x61f);
-	write_rtl8255(dev, 0x4, 0x41f);
-	write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404020, 0x80000027,
-		0x92402a98, 0xf8009, 0x28000, 0xc00, 0x0);
-	write_rtl8255(dev, 0x1, 0x807);
-	write_rtl8255(dev, 0x4, 0xc20);
-	write_rtl8255(dev, 0x4, 0xe20);
-	write_rtl8255(dev, 0x4, 0xc20);
-	write_rtl8255(dev, 0x1, 0x0);
-	write_rtl8255(dev, 0x4, 0x820);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0xa20);
-	write_rtl8255(dev, 0x4, 0x820);
-	write_rtl8255(dev, 0x4, 0x420);
-	write_rtl8255(dev, 0x3, 0x25);
-	write_rtl8255(dev, 0x2, 0x26);
-	write_rtl8255(dev, 0x4, 0x620);
-	write_rtl8255(dev, 0x4, 0x420);
-	write_rtl8255(dev, 0x4, 0x420);
-	write_rtl8255(dev, 0x3, 0x100);
-	write_rtl8255(dev, 0x4, 0x620);
-	write_rtl8255(dev, 0x4, 0x420);
-	write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404020, 0x27,
-		0x92402a98, 0xf8009, 0x28000, 0xc00, 0x0);
-	write_rtl8255(dev, 0x1, 0x807);
-	write_rtl8255(dev, 0x4, 0xc21);
-	write_rtl8255(dev, 0x4, 0xe21);
-	write_rtl8255(dev, 0x4, 0xc21);
-	write_rtl8255(dev, 0x1, 0x0);
-	write_rtl8255(dev, 0x4, 0x821);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0xa21);
-	write_rtl8255(dev, 0x4, 0x821);
-	write_rtl8255(dev, 0x4, 0x421);
-	write_rtl8255(dev, 0x3, 0x25);
-	write_rtl8255(dev, 0x2, 0x26);
-	write_rtl8255(dev, 0x4, 0x621);
-	write_rtl8255(dev, 0x4, 0x421);
-	write_rtl8255(dev, 0x4, 0x421);
-	write_rtl8255(dev, 0x3, 0x100);
-	write_rtl8255(dev, 0x4, 0x621);
-	write_rtl8255(dev, 0x4, 0x421);
-	write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404000, 0x80000027,
-		0x92402a68, 0xf0009, 0x10028000, 0xc00, 0x0);
-	write_rtl8255(dev, 0x1, 0x807);
-	write_rtl8255(dev, 0x4, 0xc22);
-	write_rtl8255(dev, 0x4, 0xe22);
-	write_rtl8255(dev, 0x4, 0xc22);
-	write_rtl8255(dev, 0x1, 0x0);
-	write_rtl8255(dev, 0x4, 0x822);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0xa22);
-	write_rtl8255(dev, 0x4, 0x822);
-	write_rtl8255(dev, 0x4, 0x422);
-	write_rtl8255(dev, 0x3, 0x25);
-	write_rtl8255(dev, 0x2, 0x26);
-	write_rtl8255(dev, 0x4, 0x622);
-	write_rtl8255(dev, 0x4, 0x422);
-	write_rtl8255(dev, 0x4, 0x422);
-	write_rtl8255(dev, 0x3, 0x100);
-	write_rtl8255(dev, 0x4, 0x622);
-	write_rtl8255(dev, 0x4, 0x422);
-	write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404010, 0x80000027,
-		0x92402a68, 0xf0009, 0x20028000, 0xc00, 0x0);
-	write_rtl8255(dev, 0x1, 0x807);
-	write_rtl8255(dev, 0x4, 0xc23);
-	write_rtl8255(dev, 0x4, 0xe23);
-	write_rtl8255(dev, 0x4, 0xc23);
-	write_rtl8255(dev, 0x1, 0x0);
-	write_rtl8255(dev, 0x4, 0x823);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0xa23);
-	write_rtl8255(dev, 0x4, 0x823);
-	write_rtl8255(dev, 0x4, 0x423);
-	write_rtl8255(dev, 0x3, 0x25);
-	write_rtl8255(dev, 0x2, 0x26);
-	write_rtl8255(dev, 0x4, 0x623);
-	write_rtl8255(dev, 0x4, 0x423);
-	write_rtl8255(dev, 0x4, 0x423);
-	write_rtl8255(dev, 0x3, 0x100);
-	write_rtl8255(dev, 0x4, 0x623);
-	write_rtl8255(dev, 0x4, 0x423);
-	write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404010, 0x80000027,
-		0x92402a6c, 0xf0009, 0x30028000, 0xc00, 0x0);
-	write_rtl8255(dev, 0x1, 0x807);
-	write_rtl8255(dev, 0x4, 0xc24);
-	write_rtl8255(dev, 0x4, 0xe24);
-	write_rtl8255(dev, 0x4, 0xc24);
-	write_rtl8255(dev, 0x1, 0x0);
-	write_rtl8255(dev, 0x4, 0x824);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0xa24);
-	write_rtl8255(dev, 0x4, 0x824);
-	write_rtl8255(dev, 0x4, 0x424);
-	write_rtl8255(dev, 0x3, 0x25);
-	write_rtl8255(dev, 0x2, 0x26);
-	write_rtl8255(dev, 0x4, 0x624);
-	write_rtl8255(dev, 0x4, 0x424);
-	write_rtl8255(dev, 0x4, 0x424);
-	write_rtl8255(dev, 0x3, 0x100);
-	write_rtl8255(dev, 0x4, 0x624);
-	write_rtl8255(dev, 0x4, 0x424);
-	write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404010, 0x80000027,
-		0x92402a6c, 0xf0009, 0x40028000, 0xc00, 0x0);
-	write_rtl8255(dev, 0x1, 0x807);
-	write_rtl8255(dev, 0x4, 0xc25);
-	write_rtl8255(dev, 0x4, 0xe25);
-	write_rtl8255(dev, 0x4, 0xc25);
-	write_rtl8255(dev, 0x1, 0x0);
-	write_rtl8255(dev, 0x4, 0x825);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0xa25);
-	write_rtl8255(dev, 0x4, 0x825);
-	write_rtl8255(dev, 0x4, 0x425);
-	write_rtl8255(dev, 0x3, 0x25);
-	write_rtl8255(dev, 0x2, 0x26);
-	write_rtl8255(dev, 0x4, 0x625);
-	write_rtl8255(dev, 0x4, 0x425);
-	write_rtl8255(dev, 0x4, 0x425);
-	write_rtl8255(dev, 0x3, 0x100);
-	write_rtl8255(dev, 0x4, 0x625);
-	write_rtl8255(dev, 0x4, 0x425);
-	write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404000, 0x80000027,
-		0x92402a70, 0xf0009, 0x60028000, 0xc00, 0x0);
-	write_rtl8255(dev, 0x1, 0x807);
-	write_rtl8255(dev, 0x4, 0xc26);
-	write_rtl8255(dev, 0x4, 0xe26);
-	write_rtl8255(dev, 0x4, 0xc26);
-	write_rtl8255(dev, 0x1, 0x0);
-	write_rtl8255(dev, 0x4, 0x826);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0xa26);
-	write_rtl8255(dev, 0x4, 0x826);
-	write_rtl8255(dev, 0x4, 0x426);
-	write_rtl8255(dev, 0x3, 0x25);
-	write_rtl8255(dev, 0x2, 0x26);
-	write_rtl8255(dev, 0x4, 0x626);
-	write_rtl8255(dev, 0x4, 0x426);
-	write_rtl8255(dev, 0x4, 0x426);
-	write_rtl8255(dev, 0x3, 0x100);
-	write_rtl8255(dev, 0x4, 0x626);
-	write_rtl8255(dev, 0x4, 0x426);
-	write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404031, 0x40000027,
-		0x92402a70, 0xf0011, 0x60028000, 0xc00, 0x0);
-	write_rtl8255(dev, 0x1, 0x807);
-	write_rtl8255(dev, 0x4, 0xc27);
-	write_rtl8255(dev, 0x4, 0xe27);
-	write_rtl8255(dev, 0x4, 0xc27);
-	write_rtl8255(dev, 0x1, 0x0);
-	write_rtl8255(dev, 0x4, 0x827);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0xa27);
-	write_rtl8255(dev, 0x4, 0x827);
-	write_rtl8255(dev, 0x4, 0x427);
-	write_rtl8255(dev, 0x3, 0x25);
-	write_rtl8255(dev, 0x2, 0x26);
-	write_rtl8255(dev, 0x4, 0x627);
-	write_rtl8255(dev, 0x4, 0x427);
-	write_rtl8255(dev, 0x4, 0x427);
-	write_rtl8255(dev, 0x3, 0x100);
-	write_rtl8255(dev, 0x4, 0x627);
-	write_rtl8255(dev, 0x4, 0x427);
-	write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404011, 0x40000027,
-		0x92402a74, 0xf0011, 0x60028000, 0xc00, 0x0);
-	write_rtl8255(dev, 0x1, 0x807);
-	write_rtl8255(dev, 0x4, 0xc28);
-	write_rtl8255(dev, 0x4, 0xe28);
-	write_rtl8255(dev, 0x4, 0xc28);
-	write_rtl8255(dev, 0x1, 0x0);
-	write_rtl8255(dev, 0x4, 0x828);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0xa28);
-	write_rtl8255(dev, 0x4, 0x828);
-	write_rtl8255(dev, 0x4, 0x428);
-	write_rtl8255(dev, 0x3, 0x25);
-	write_rtl8255(dev, 0x2, 0x26);
-	write_rtl8255(dev, 0x4, 0x628);
-	write_rtl8255(dev, 0x4, 0x428);
-	write_rtl8255(dev, 0x4, 0x428);
-	write_rtl8255(dev, 0x3, 0x100);
-	write_rtl8255(dev, 0x4, 0x628);
-	write_rtl8255(dev, 0x4, 0x428);
-	write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404010, 0xc0000027,
-		0x92402a74, 0xf0011, 0x60028000, 0xc00, 0x0);
-	write_rtl8255(dev, 0x1, 0x807);
-	write_rtl8255(dev, 0x4, 0xc29);
-	write_rtl8255(dev, 0x4, 0xe29);
-	write_rtl8255(dev, 0x4, 0xc29);
-	write_rtl8255(dev, 0x1, 0x0);
-	write_rtl8255(dev, 0x4, 0x829);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0xa29);
-	write_rtl8255(dev, 0x4, 0x829);
-	write_rtl8255(dev, 0x4, 0x429);
-	write_rtl8255(dev, 0x3, 0x25);
-	write_rtl8255(dev, 0x2, 0x26);
-	write_rtl8255(dev, 0x4, 0x629);
-	write_rtl8255(dev, 0x4, 0x429);
-	write_rtl8255(dev, 0x4, 0x429);
-	write_rtl8255(dev, 0x3, 0x100);
-	write_rtl8255(dev, 0x4, 0x629);
-	write_rtl8255(dev, 0x4, 0x429);
-	write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404000, 0x80000027,
-		0x92402a78, 0xf0011, 0x60028000, 0xc00, 0x0);
-	write_rtl8255(dev, 0x1, 0x807);
-	write_rtl8255(dev, 0x4, 0xc2a);
-	write_rtl8255(dev, 0x4, 0xe2a);
-	write_rtl8255(dev, 0x4, 0xc2a);
-	write_rtl8255(dev, 0x1, 0x0);
-	write_rtl8255(dev, 0x4, 0x82a);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0xa2a);
-	write_rtl8255(dev, 0x4, 0x82a);
-	write_rtl8255(dev, 0x4, 0x42a);
-	write_rtl8255(dev, 0x3, 0x24);
-	write_rtl8255(dev, 0x2, 0x26);
-	write_rtl8255(dev, 0x4, 0x62a);
-	write_rtl8255(dev, 0x4, 0x42a);
-	write_rtl8255(dev, 0x4, 0x42a);
-	write_rtl8255(dev, 0x3, 0x100);
-	write_rtl8255(dev, 0x4, 0x62a);
-	write_rtl8255(dev, 0x4, 0x42a);
-	write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404000, 0x80000027,
-		0x92402a78, 0xf0011, 0x70028000, 0xc00, 0x0);
-	write_rtl8255(dev, 0x1, 0x807);
-	write_rtl8255(dev, 0x4, 0xc2b);
-	write_rtl8255(dev, 0x4, 0xe2b);
-	write_rtl8255(dev, 0x4, 0xc2b);
-	write_rtl8255(dev, 0x1, 0x0);
-	write_rtl8255(dev, 0x4, 0x82b);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0xa2b);
-	write_rtl8255(dev, 0x4, 0x82b);
-	write_rtl8255(dev, 0x4, 0x42b);
-	write_rtl8255(dev, 0x3, 0x24);
-	write_rtl8255(dev, 0x2, 0x26);
-	write_rtl8255(dev, 0x4, 0x62b);
-	write_rtl8255(dev, 0x4, 0x42b);
-	write_rtl8255(dev, 0x4, 0x42b);
-	write_rtl8255(dev, 0x3, 0x100);
-	write_rtl8255(dev, 0x4, 0x62b);
-	write_rtl8255(dev, 0x4, 0x42b);
-	write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404000, 0x80000027,
-		0x92402a48, 0xf0019, 0x70028000, 0xc00, 0x0);
-	write_rtl8255(dev, 0x1, 0x807);
-	write_rtl8255(dev, 0x4, 0xc2c);
-	write_rtl8255(dev, 0x4, 0xe2c);
-	write_rtl8255(dev, 0x4, 0xc2c);
-	write_rtl8255(dev, 0x1, 0x0);
-	write_rtl8255(dev, 0x4, 0x82c);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0xa2c);
-	write_rtl8255(dev, 0x4, 0x82c);
-	write_rtl8255(dev, 0x4, 0x42c);
-	write_rtl8255(dev, 0x3, 0x24);
-	write_rtl8255(dev, 0x2, 0x26);
-	write_rtl8255(dev, 0x4, 0x62c);
-	write_rtl8255(dev, 0x4, 0x42c);
-	write_rtl8255(dev, 0x4, 0x42c);
-	write_rtl8255(dev, 0x3, 0x100);
-	write_rtl8255(dev, 0x4, 0x62c);
-	write_rtl8255(dev, 0x4, 0x42c);
-	write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404000, 0x80000027,
-		0x92402a48, 0xf8019, 0x70028000, 0xc00, 0x0);
-	write_rtl8255(dev, 0x1, 0x807);
-	write_rtl8255(dev, 0x4, 0xc2d);
-	write_rtl8255(dev, 0x4, 0xe2d);
-	write_rtl8255(dev, 0x4, 0xc2d);
-	write_rtl8255(dev, 0x1, 0x0);
-	write_rtl8255(dev, 0x4, 0x82d);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0xa2d);
-	write_rtl8255(dev, 0x4, 0x82d);
-	write_rtl8255(dev, 0x4, 0x42d);
-	write_rtl8255(dev, 0x3, 0x24);
-	write_rtl8255(dev, 0x2, 0x26);
-	write_rtl8255(dev, 0x4, 0x62d);
-	write_rtl8255(dev, 0x4, 0x42d);
-	write_rtl8255(dev, 0x4, 0x42d);
-	write_rtl8255(dev, 0x3, 0x100);
-	write_rtl8255(dev, 0x4, 0x62d);
-	write_rtl8255(dev, 0x4, 0x42d);
-	write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404000, 0x80000027,
-		0x92402a4c, 0xf8019, 0x70028000, 0xc00, 0x0);
-	write_rtl8255(dev, 0x1, 0x807);
-	write_rtl8255(dev, 0x4, 0xc2e);
-	write_rtl8255(dev, 0x4, 0xe2e);
-	write_rtl8255(dev, 0x4, 0xc2e);
-	write_rtl8255(dev, 0x1, 0x0);
-	write_rtl8255(dev, 0x4, 0x82e);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0xa2e);
-	write_rtl8255(dev, 0x4, 0x82e);
-	write_rtl8255(dev, 0x4, 0x42e);
-	write_rtl8255(dev, 0x3, 0x24);
-	write_rtl8255(dev, 0x2, 0x26);
-	write_rtl8255(dev, 0x4, 0x62e);
-	write_rtl8255(dev, 0x4, 0x42e);
-	write_rtl8255(dev, 0x4, 0x42e);
-	write_rtl8255(dev, 0x3, 0x100);
-	write_rtl8255(dev, 0x4, 0x62e);
-	write_rtl8255(dev, 0x4, 0x42e);
-	write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404000, 0x80000027,
-		0x92402a4c, 0xf8019, 0x70028000, 0xc00, 0x0);
-	write_rtl8255(dev, 0x1, 0x807);
-	write_rtl8255(dev, 0x4, 0xc2f);
-	write_rtl8255(dev, 0x4, 0xe2f);
-	write_rtl8255(dev, 0x4, 0xc2f);
-	write_rtl8255(dev, 0x1, 0x0);
-	write_rtl8255(dev, 0x4, 0x82f);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0xa2f);
-	write_rtl8255(dev, 0x4, 0x82f);
-	write_rtl8255(dev, 0x4, 0x42f);
-	write_rtl8255(dev, 0x3, 0x24);
-	write_rtl8255(dev, 0x2, 0x26);
-	write_rtl8255(dev, 0x4, 0x62f);
-	write_rtl8255(dev, 0x4, 0x42f);
-	write_rtl8255(dev, 0x4, 0x42f);
-	write_rtl8255(dev, 0x3, 0x100);
-	write_rtl8255(dev, 0x4, 0x62f);
-	write_rtl8255(dev, 0x4, 0x42f);
-	write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404000, 0x80000027,
-		0x92402a50, 0xf8019, 0x70028000, 0xc00, 0x0);
-	write_rtl8255(dev, 0x1, 0x807);
-	write_rtl8255(dev, 0x4, 0xc30);
-	write_rtl8255(dev, 0x4, 0xe30);
-	write_rtl8255(dev, 0x4, 0xc30);
-	write_rtl8255(dev, 0x1, 0x0);
-	write_rtl8255(dev, 0x4, 0x830);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0xa30);
-	write_rtl8255(dev, 0x4, 0x830);
-	write_rtl8255(dev, 0x4, 0x430);
-	write_rtl8255(dev, 0x3, 0x24);
-	write_rtl8255(dev, 0x2, 0x26);
-	write_rtl8255(dev, 0x4, 0x630);
-	write_rtl8255(dev, 0x4, 0x430);
-	write_rtl8255(dev, 0x4, 0x430);
-	write_rtl8255(dev, 0x3, 0x100);
-	write_rtl8255(dev, 0x4, 0x630);
-	write_rtl8255(dev, 0x4, 0x430);
-	write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404000, 0x80000027,
-		0x92402a50, 0xf8019, 0x70028000, 0xc00, 0x0);
-	write_rtl8255(dev, 0x1, 0x807);
-	write_rtl8255(dev, 0x4, 0xc31);
-	write_rtl8255(dev, 0x4, 0xe31);
-	write_rtl8255(dev, 0x4, 0xc31);
-	write_rtl8255(dev, 0x1, 0x0);
-	write_rtl8255(dev, 0x4, 0x831);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0xa31);
-	write_rtl8255(dev, 0x4, 0x831);
-	write_rtl8255(dev, 0x4, 0x431);
-	write_rtl8255(dev, 0x3, 0x24);
-	write_rtl8255(dev, 0x2, 0x26);
-	write_rtl8255(dev, 0x4, 0x631);
-	write_rtl8255(dev, 0x4, 0x431);
-	write_rtl8255(dev, 0x4, 0x431);
-	write_rtl8255(dev, 0x3, 0x100);
-	write_rtl8255(dev, 0x4, 0x631);
-	write_rtl8255(dev, 0x4, 0x431);
-	write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404000, 0x80000027,
-		0x92402a54, 0xf8019, 0x70028000, 0xc00, 0x0);
-	write_rtl8255(dev, 0x1, 0x807);
-	write_rtl8255(dev, 0x4, 0xc32);
-	write_rtl8255(dev, 0x4, 0xe32);
-	write_rtl8255(dev, 0x4, 0xc32);
-	write_rtl8255(dev, 0x1, 0x0);
-	write_rtl8255(dev, 0x4, 0x832);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0xa32);
-	write_rtl8255(dev, 0x4, 0x832);
-	write_rtl8255(dev, 0x4, 0x432);
-	write_rtl8255(dev, 0x3, 0x24);
-	write_rtl8255(dev, 0x2, 0x26);
-	write_rtl8255(dev, 0x4, 0x632);
-	write_rtl8255(dev, 0x4, 0x432);
-	write_rtl8255(dev, 0x4, 0x432);
-	write_rtl8255(dev, 0x3, 0x100);
-	write_rtl8255(dev, 0x4, 0x632);
-	write_rtl8255(dev, 0x4, 0x432);
-	write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404000, 0x80000027,
-		0x92402a54, 0xf8019, 0x70028000, 0xc00, 0x0);
-	write_rtl8255(dev, 0x1, 0x807);
-	write_rtl8255(dev, 0x4, 0xc33);
-	write_rtl8255(dev, 0x4, 0xe33);
-	write_rtl8255(dev, 0x4, 0xc33);
-	write_rtl8255(dev, 0x1, 0x0);
-	write_rtl8255(dev, 0x4, 0x833);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0xa33);
-	write_rtl8255(dev, 0x4, 0x833);
-	write_rtl8255(dev, 0x4, 0x433);
-	write_rtl8255(dev, 0x3, 0x24);
-	write_rtl8255(dev, 0x2, 0x26);
-	write_rtl8255(dev, 0x4, 0x633);
-	write_rtl8255(dev, 0x4, 0x433);
-	write_rtl8255(dev, 0x4, 0x433);
-	write_rtl8255(dev, 0x3, 0x100);
-	write_rtl8255(dev, 0x4, 0x633);
-	write_rtl8255(dev, 0x4, 0x433);
-	write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404000, 0x80000027,
-		0x92402a58, 0xf8019, 0x70028000, 0xc00, 0x0);
-	write_rtl8255(dev, 0x1, 0x807);
-	write_rtl8255(dev, 0x4, 0xc34);
-	write_rtl8255(dev, 0x4, 0xe34);
-	write_rtl8255(dev, 0x4, 0xc34);
-	write_rtl8255(dev, 0x1, 0x0);
-	write_rtl8255(dev, 0x4, 0x834);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0xa34);
-	write_rtl8255(dev, 0x4, 0x834);
-	write_rtl8255(dev, 0x4, 0x434);
-	write_rtl8255(dev, 0x3, 0x24);
-	write_rtl8255(dev, 0x2, 0x26);
-	write_rtl8255(dev, 0x4, 0x634);
-	write_rtl8255(dev, 0x4, 0x434);
-	write_rtl8255(dev, 0x4, 0x434);
-	write_rtl8255(dev, 0x3, 0x100);
-	write_rtl8255(dev, 0x4, 0x634);
-	write_rtl8255(dev, 0x4, 0x434);
-	write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404000, 0x80000027,
-		0x92402a58, 0xf8019, 0x70028000, 0xc00, 0x0);
-	write_rtl8255(dev, 0x1, 0x807);
-	write_rtl8255(dev, 0x4, 0xc35);
-	write_rtl8255(dev, 0x4, 0xe35);
-	write_rtl8255(dev, 0x4, 0xc35);
-	write_rtl8255(dev, 0x1, 0x0);
-	write_rtl8255(dev, 0x4, 0x835);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0xa35);
-	write_rtl8255(dev, 0x4, 0x835);
-	write_rtl8255(dev, 0x4, 0x435);
-	write_rtl8255(dev, 0x3, 0x24);
-	write_rtl8255(dev, 0x2, 0x26);
-	write_rtl8255(dev, 0x4, 0x635);
-	write_rtl8255(dev, 0x4, 0x435);
-	write_rtl8255(dev, 0x4, 0x435);
-	write_rtl8255(dev, 0x3, 0x100);
-	write_rtl8255(dev, 0x4, 0x635);
-	write_rtl8255(dev, 0x4, 0x435);
-	write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404000, 0x80000027,
-		0x92402a24, 0xf8019, 0x70028000, 0xc00, 0x0);
-	write_rtl8255(dev, 0x1, 0x807);
-	write_rtl8255(dev, 0x4, 0xc36);
-	write_rtl8255(dev, 0x4, 0xe36);
-	write_rtl8255(dev, 0x4, 0xc36);
-	write_rtl8255(dev, 0x1, 0x0);
-	write_rtl8255(dev, 0x4, 0x836);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0xa36);
-	write_rtl8255(dev, 0x4, 0x836);
-	write_rtl8255(dev, 0x4, 0x436);
-	write_rtl8255(dev, 0x3, 0x24);
-	write_rtl8255(dev, 0x2, 0x25);
-	write_rtl8255(dev, 0x4, 0x636);
-	write_rtl8255(dev, 0x4, 0x436);
-	write_rtl8255(dev, 0x4, 0x436);
-	write_rtl8255(dev, 0x3, 0x100);
-	write_rtl8255(dev, 0x4, 0x636);
-	write_rtl8255(dev, 0x4, 0x436);
-	write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404000, 0x80000027,
-		0x92402a24, 0xf8019, 0x70028000, 0xc00, 0x0);
-	write_rtl8255(dev, 0x1, 0x807);
-	write_rtl8255(dev, 0x4, 0xc37);
-	write_rtl8255(dev, 0x4, 0xe37);
-	write_rtl8255(dev, 0x4, 0xc37);
-	write_rtl8255(dev, 0x1, 0x0);
-	write_rtl8255(dev, 0x4, 0x837);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0xa37);
-	write_rtl8255(dev, 0x4, 0x837);
-	write_rtl8255(dev, 0x4, 0x437);
-	write_rtl8255(dev, 0x3, 0x24);
-	write_rtl8255(dev, 0x2, 0x25);
-	write_rtl8255(dev, 0x4, 0x637);
-	write_rtl8255(dev, 0x4, 0x437);
-	write_rtl8255(dev, 0x4, 0x437);
-	write_rtl8255(dev, 0x3, 0x100);
-	write_rtl8255(dev, 0x4, 0x637);
-	write_rtl8255(dev, 0x4, 0x437);
-	write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404000, 0x80000027,
-		0x92402a28, 0xf8019, 0x70028000, 0xc00, 0x0);
-	write_rtl8255(dev, 0x1, 0x807);
-	write_rtl8255(dev, 0x4, 0xc38);
-	write_rtl8255(dev, 0x4, 0xe38);
-	write_rtl8255(dev, 0x4, 0xc38);
-	write_rtl8255(dev, 0x1, 0x0);
-	write_rtl8255(dev, 0x4, 0x838);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0xa38);
-	write_rtl8255(dev, 0x4, 0x838);
-	write_rtl8255(dev, 0x4, 0x438);
-	write_rtl8255(dev, 0x3, 0x24);
-	write_rtl8255(dev, 0x2, 0x25);
-	write_rtl8255(dev, 0x4, 0x638);
-	write_rtl8255(dev, 0x4, 0x438);
-	write_rtl8255(dev, 0x4, 0x438);
-	write_rtl8255(dev, 0x3, 0x100);
-	write_rtl8255(dev, 0x4, 0x638);
-	write_rtl8255(dev, 0x4, 0x438);
-	write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404000, 0x80000027,
-		0x92402a28, 0xf8019, 0x70028000, 0xc00, 0x0);
-	write_rtl8255(dev, 0x1, 0x807);
-	write_rtl8255(dev, 0x4, 0xc39);
-	write_rtl8255(dev, 0x4, 0xe39);
-	write_rtl8255(dev, 0x4, 0xc39);
-	write_rtl8255(dev, 0x1, 0x0);
-	write_rtl8255(dev, 0x4, 0x839);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0xa39);
-	write_rtl8255(dev, 0x4, 0x839);
-	write_rtl8255(dev, 0x4, 0x439);
-	write_rtl8255(dev, 0x3, 0x24);
-	write_rtl8255(dev, 0x2, 0x25);
-	write_rtl8255(dev, 0x4, 0x639);
-	write_rtl8255(dev, 0x4, 0x439);
-	write_rtl8255(dev, 0x4, 0x439);
-	write_rtl8255(dev, 0x3, 0x100);
-	write_rtl8255(dev, 0x4, 0x639);
-	write_rtl8255(dev, 0x4, 0x439);
-	write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404000, 0x80000027,
-		0x92402a00, 0xf8019, 0x70028000, 0xc00, 0x0);
-	write_rtl8255(dev, 0x1, 0x807);
-	write_rtl8255(dev, 0x4, 0xc3a);
-	write_rtl8255(dev, 0x4, 0xe3a);
-	write_rtl8255(dev, 0x4, 0xc3a);
-	write_rtl8255(dev, 0x1, 0x0);
-	write_rtl8255(dev, 0x4, 0x83a);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0xa3a);
-	write_rtl8255(dev, 0x4, 0x83a);
-	write_rtl8255(dev, 0x4, 0x43a);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0x63a);
-	write_rtl8255(dev, 0x4, 0x43a);
-	write_rtl8255(dev, 0x4, 0x43a);
-	write_rtl8255(dev, 0x3, 0x100);
-	write_rtl8255(dev, 0x4, 0x63a);
-	write_rtl8255(dev, 0x4, 0x43a);
-	write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404000, 0x80000027,
-		0x92402a00, 0xf8019, 0x70028000, 0xc00, 0x0);
-	write_rtl8255(dev, 0x1, 0x807);
-	write_rtl8255(dev, 0x4, 0xc3b);
-	write_rtl8255(dev, 0x4, 0xe3b);
-	write_rtl8255(dev, 0x4, 0xc3b);
-	write_rtl8255(dev, 0x1, 0x0);
-	write_rtl8255(dev, 0x4, 0x83b);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0xa3b);
-	write_rtl8255(dev, 0x4, 0x83b);
-	write_rtl8255(dev, 0x4, 0x43b);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0x63b);
-	write_rtl8255(dev, 0x4, 0x43b);
-	write_rtl8255(dev, 0x4, 0x43b);
-	write_rtl8255(dev, 0x3, 0x100);
-	write_rtl8255(dev, 0x4, 0x63b);
-	write_rtl8255(dev, 0x4, 0x43b);
-	write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404000, 0x80000027,
-		0x92402a00, 0xf8019, 0x70028000, 0xc00, 0x0);
-	write_rtl8255(dev, 0x1, 0x807);
-	write_rtl8255(dev, 0x4, 0xc3c);
-	write_rtl8255(dev, 0x4, 0xe3c);
-	write_rtl8255(dev, 0x4, 0xc3c);
-	write_rtl8255(dev, 0x1, 0x0);
-	write_rtl8255(dev, 0x4, 0x83c);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0xa3c);
-	write_rtl8255(dev, 0x4, 0x83c);
-	write_rtl8255(dev, 0x4, 0x43c);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0x63c);
-	write_rtl8255(dev, 0x4, 0x43c);
-	write_rtl8255(dev, 0x4, 0x43c);
-	write_rtl8255(dev, 0x3, 0x100);
-	write_rtl8255(dev, 0x4, 0x63c);
-	write_rtl8255(dev, 0x4, 0x43c);
-	write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404000, 0x80000027,
-		0x92402a00, 0xf8019, 0x70028000, 0xc00, 0x0);
-	write_rtl8255(dev, 0x1, 0x807);
-	write_rtl8255(dev, 0x4, 0xc3d);
-	write_rtl8255(dev, 0x4, 0xe3d);
-	write_rtl8255(dev, 0x4, 0xc3d);
-	write_rtl8255(dev, 0x1, 0x0);
-	write_rtl8255(dev, 0x4, 0x83d);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0xa3d);
-	write_rtl8255(dev, 0x4, 0x83d);
-	write_rtl8255(dev, 0x4, 0x43d);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0x63d);
-	write_rtl8255(dev, 0x4, 0x43d);
-	write_rtl8255(dev, 0x4, 0x43d);
-	write_rtl8255(dev, 0x3, 0x100);
-	write_rtl8255(dev, 0x4, 0x63d);
-	write_rtl8255(dev, 0x4, 0x43d);
-	write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404000, 0x80000027,
-		0x92402a00, 0xf8019, 0x70028000, 0xc00, 0x0);
-	write_rtl8255(dev, 0x1, 0x807);
-	write_rtl8255(dev, 0x4, 0xc3e);
-	write_rtl8255(dev, 0x4, 0xe3e);
-	write_rtl8255(dev, 0x4, 0xc3e);
-	write_rtl8255(dev, 0x1, 0x0);
-	write_rtl8255(dev, 0x4, 0x83e);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0xa3e);
-	write_rtl8255(dev, 0x4, 0x83e);
-	write_rtl8255(dev, 0x4, 0x43e);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0x63e);
-	write_rtl8255(dev, 0x4, 0x43e);
-	write_rtl8255(dev, 0x4, 0x43e);
-	write_rtl8255(dev, 0x3, 0x100);
-	write_rtl8255(dev, 0x4, 0x63e);
-	write_rtl8255(dev, 0x4, 0x43e);
-	write_rtl8255_reg0c(dev, 0x1554, 0xa800403b, 0xf6d44278, 0x80404000, 0x80000027,
-		0x92402a00, 0xf8011, 0x70028000, 0xc00, 0x0);
-	write_rtl8255(dev, 0x1, 0x807);
-	write_rtl8255(dev, 0x4, 0xc3f);
-	write_rtl8255(dev, 0x4, 0xe3f);
-	write_rtl8255(dev, 0x4, 0xc3f);
-	write_rtl8255(dev, 0x1, 0x0);
-	write_rtl8255(dev, 0x4, 0x83f);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0xa3f);
-	write_rtl8255(dev, 0x4, 0x83f);
-	write_rtl8255(dev, 0x4, 0x43f);
-	write_rtl8255(dev, 0x3, 0x0);
-	write_rtl8255(dev, 0x2, 0x0);
-	write_rtl8255(dev, 0x4, 0x63f);
-	write_rtl8255(dev, 0x4, 0x43f);
-	write_rtl8255(dev, 0x4, 0x43f);
-	write_rtl8255(dev, 0x3, 0x100);
-	write_rtl8255(dev, 0x4, 0x63f);
-	write_rtl8255(dev, 0x4, 0x43f);
-	write_rtl8255(dev, 0x4, 0x0);
-	write_rtl8255(dev, 0x1, 0x0);
-	write_rtl8255_reg0c(dev, 0x3539, 0x70000c03, 0xfef46178, 0x408000, 0x403307,
-		0x924f80c0, 0xf955c, 0x8400, 0x429200, 0x1ce20);
-	write_rtl8255(dev, 0x1, 0x1c7);
-	write_rtl8255(dev, 0x2, 0x26);
-	write_rtl8255(dev, 0x3, 0x27);
-	write_rtl8255(dev, 0x1, 0x47);
-	write_rtl8255(dev, 0x4, 0x98c);
-	write_rtl8255(dev, 0x5, 0x65);
-	write_rtl8255(dev, 0x6, 0x13);
-	write_rtl8255(dev, 0x7, 0x7c);
-	write_rtl8255(dev, 0x8, 0x6);
-	write_rtl8255(dev, 0x8, 0x7);
-	write_rtl8255(dev, 0x8, 0x6);
-	write_rtl8255(dev, 0x9, 0xce2);
-	write_rtl8255(dev, 0xb, 0x1c5);
-	write_rtl8255(dev, 0xd, 0xd7f);
-	write_rtl8255(dev, 0xe, 0x369);
-	write_rtl8255(dev, 0xa, 0xd56);
-	write_rtl8255(dev, 0xa, 0xd57);
-	mdelay(20);
-	write_rtl8255(dev, 0xd, 0xd7e);
-
-}
-
-
-void rtl8255_set_band_param(struct net_device *dev, short band)
-{
-	if(band != BAND_A){
-		write_nic_dword(dev, 0x94, 0x3dc00002);
-		write_nic_dword(dev, 0x88, 0x00100040);
-
-		write_phy_cck(dev, 0x13, 0xd0);
-
-		write_phy_cck(dev, 0x41, 0x9d);
-		write_nic_dword(dev, 0x8c, 0x00082205);
-		write_nic_byte(dev, 0xb4, 0x66);
-	}
-}
-
-void rtl8255_rf_init(struct net_device *dev)
-{
-	struct r8180_priv *priv = ieee80211_priv(dev);
-	int i;
-	u16 brsr;
-//	short channel /*= priv->chan*/ = 1;
-	priv->chan = 1;
-
-	write_nic_word(dev, RFPinsOutput, 0x80);
-	write_nic_word(dev, RFPinsSelect, 0x80 | SW_CONTROL_GPIO);
-	write_nic_word(dev, RFPinsEnable, 0x80);
-	write_nic_word(dev, RFPinsSelect, SW_CONTROL_GPIO);
-
-	write_nic_dword(dev, RF_TIMING, 0x000f800f);
-
-	brsr = read_nic_word(dev, BRSR);
-
-	write_nic_word(dev, 0x2c, 0xffff);
-
-
-	rtl8180_set_anaparam(dev, RTL8255_ANAPARAM_ON);
-	rtl8185_set_anaparam2(dev, RTL8255_ANAPARAM2_ON);
-
-	write_nic_dword(dev, 0x94, 0x11c00002);
-
-	write_nic_dword(dev, RF_PARA, 0x100040);
-
-	rtl8185_rf_pins_enable(dev);
-
-	rtl8255_init_BGband(dev);
-	rtl8255_set_band_param(dev,BAND_BG);
-
-	write_phy_cck(dev, 0x0, 0x98);
-	write_phy_cck(dev, 0x3, 0x20);
-	write_phy_cck(dev, 0x4, 0x2e);
-	write_phy_cck(dev, 0x5, 0x12);
-	write_phy_cck(dev, 0x6, 0xfc);
-	write_phy_cck(dev, 0x7, 0xd8);
-	write_phy_cck(dev, 0x8, 0x2e);
-	write_phy_cck(dev, 0x10, 0xd3);
-	write_phy_cck(dev, 0x11, 0x88);
-	write_phy_cck(dev, 0x12, 0x47);
-	write_phy_cck(dev, 0x13, 0xd0); /* Ver C & D & 8187*/
-
-	write_phy_cck(dev, 0x19, 0x0);
-	write_phy_cck(dev, 0x1a, 0xa0);
-	write_phy_cck(dev, 0x1b, 0x8);
-	write_phy_cck(dev, 0x40, 0x86); /* CCK Carrier Sense Threshold */
-	write_phy_cck(dev, 0x41, 0x9d); /* Energy Threshold */
-	//write_phy_cck(dev, 0x42, 0x0);
-	write_phy_cck(dev, 0x43, 0x8);
-
-	write_nic_byte(dev, TESTR,0x8);
-
-	for(i=0;i<128;i++){
-		write_phy_ofdm(dev, 0x4b, rtl8255_agc[i]);
-		write_phy_ofdm(dev, 0x4a, (u8)i+ 0x80);
-	}
-
-
-	write_phy_ofdm(dev, 0x0, 0x1);
-	write_phy_ofdm(dev, 0x1, 0x2);
-	write_phy_ofdm(dev, 0x2, 0x43);
-	write_phy_ofdm(dev, 0x3, 0x0);
-	write_phy_ofdm(dev, 0x4, 0x0);
-	write_phy_ofdm(dev, 0x5, 0x0);
-	write_phy_ofdm(dev, 0x6, 0x40);
-	write_phy_ofdm(dev, 0x7, 0x0);
-	write_phy_ofdm(dev, 0x8, 0x40);
-	write_phy_ofdm(dev, 0x9, 0xfe);
-	write_phy_ofdm(dev, 0xa, 0x9);
-	write_phy_ofdm(dev, 0xb, 0x80);
-	write_phy_ofdm(dev, 0xc, 0x1);
-	write_phy_ofdm(dev, 0xd, 0x43);
-	write_phy_ofdm(dev, 0xe, 0xd3);
-	write_phy_ofdm(dev, 0xf, 0x38);
-	write_phy_ofdm(dev, 0x10, 0x4);
-	write_phy_ofdm(dev, 0x11, 0x06);/*agc resp time 700*/
-	write_phy_ofdm(dev, 0x12, 0x20);
-	write_phy_ofdm(dev, 0x13, 0x20);
-	write_phy_ofdm(dev, 0x14, 0x0);
-	write_phy_ofdm(dev, 0x15, 0x40);
-	write_phy_ofdm(dev, 0x16, 0x0);
-	write_phy_ofdm(dev, 0x17, 0x40);
-	write_phy_ofdm(dev, 0x18, 0xef);
-	write_phy_ofdm(dev, 0x19, 0x25);
-	write_phy_ofdm(dev, 0x1a, 0x20);
-	write_phy_ofdm(dev, 0x1b, 0x7a);
-	write_phy_ofdm(dev, 0x1c, 0x84);
-	write_phy_ofdm(dev, 0x1e, 0x95);
-	write_phy_ofdm(dev, 0x1f, 0x75);
-	write_phy_ofdm(dev, 0x20, 0x1f);
-	write_phy_ofdm(dev, 0x21, 0x17);
-	write_phy_ofdm(dev, 0x22, 0x16);
-	write_phy_ofdm(dev, 0x23, 0x70); //FIXME maybe not needed
-	write_phy_ofdm(dev, 0x24, 0x70);
-	write_phy_ofdm(dev, 0x25, 0x0);
-	write_phy_ofdm(dev, 0x26, 0x10);
-	write_phy_ofdm(dev, 0x27, 0x88);
-
-
-	write_nic_dword(dev, 0x94, 0x3dc00002); //BAND DEPEND.
-//	write_nic_dword(dev, 0x94, 0x15c00002); //BAND DEPEND.
-
-	write_phy_cck(dev, 0x4, 0x18);
-	write_phy_cck(dev, 0x43, 0x18);
-	write_phy_cck(dev, 0x6, 0xdc);
-	write_phy_cck(dev, 0x44, 0x2b);
-	write_phy_cck(dev, 0x45, 0x2b);
-	write_phy_cck(dev, 0x46, 0x25);
-	write_phy_cck(dev, 0x47, 0x15);
-	write_phy_cck(dev, 0x48, 0x0);
-	write_phy_cck(dev, 0x49, 0x0);
-	write_phy_cck(dev, 0x4a, 0x0);
-	write_phy_cck(dev, 0x4b, 0x0);
-//	write_phy_cck(dev, 0x4c, 0x5);
-
-	//rtl8255_set_gain(dev, 1); /* FIXME this '1' is random */
-
-	rtl8255_SetTXPowerLevel(dev, priv->chan);
-
-	write_phy_cck(dev, 0x10, 0x93 |0x4); /* Rx ant B, 0xd3 for A */
-	write_phy_ofdm(dev, 0x26, 0x90); /* Rx ant B, 0x10 for A */
-
-	rtl8185_tx_antenna(dev, 0x3); /* TX ant B, 0x0 for A*/
-	/* make sure is waken up! */
-	rtl8180_set_anaparam(dev, RTL8255_ANAPARAM_ON);
-	rtl8185_set_anaparam2(dev, RTL8255_ANAPARAM2_ON);
-
-	rtl8255_set_band_param(dev,BAND_BG);
-
-	write_phy_cck(dev, 0x41, 0x9d);
-
-	rtl8255_set_gain(dev, 4);
-	//rtl8255_set_energy_threshold(dev);
-	write_phy_cck(dev, 0x41, 0x9d);
-	rtl8255_rf_set_chan(dev, priv->chan);
-
-	write_nic_word(dev, BRSR, brsr);
-}
-
Index: b/drivers/staging/rtl8187se/r8180_rtl8255.h
===================================================================
--- a/drivers/staging/rtl8187se/r8180_rtl8255.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
-  This is part of the rtl8180-sa2400 driver
-  released under the GPL (See file COPYING for details).
-  Copyright (c) 2005 Andrea Merello <andreamrl@tiscali.it>
-
-  This files contains programming code for the rtl8255
-  radio frontend.
-
-  *Many* thanks to Realtek Corp. for their great support!
-
-*/
-
-#define RTL8255_ANAPARAM_ON 0xa0000b59
-#define RTL8255_ANAPARAM2_ON 0x840cf311
-
-
-void rtl8255_rf_init(struct net_device *dev);
-void rtl8255_rf_set_chan(struct net_device *dev,short ch);
-void rtl8255_rf_close(struct net_device *dev);
Index: b/drivers/staging/rtl8187se/r8180_sa2400.c
===================================================================
--- a/drivers/staging/rtl8187se/r8180_sa2400.c
+++ /dev/null
@@ -1,233 +0,0 @@
-/*
-   This files contains PHILIPS SA2400 radio frontend programming routines.
-
-   This is part of rtl8180 OpenSource driver
-   Copyright (C) Andrea Merello 2004-2005  <andreamrl@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.
-
-   Code at http://che.ojctech.com/~dyoung/rtw/ has been useful to me to
-   understand some things.
-
-   Code from rtl8181 project has been useful to me to understand some things.
-
-   We want to tanks the Authors of such projects and the Ndiswrapper
-   project Authors.
-*/
-
-
-#include "r8180.h"
-#include "r8180_hw.h"
-#include "r8180_sa2400.h"
-
-
-//#define DEBUG_SA2400
-
-u32 sa2400_chan[] = {
-	0x0,	//dummy channel 0
-	0x00096c, //1
-	0x080970, //2
-	0x100974, //3
-	0x180978, //4
-	0x000980, //5
-	0x080984, //6
-	0x100988, //7
-	0x18098c, //8
-	0x000994, //9
-	0x080998, //10
-	0x10099c, //11
-	0x1809a0, //12
-	0x0009a8, //13
-	0x0009b4, //14
-};
-
-
-void rf_stabilize(struct net_device *dev)
-{
-	force_pci_posting(dev);
-	mdelay(3); //for now use a great value.. we may optimize in future
-}
-
-
-void write_sa2400(struct net_device *dev,u8 adr, u32 data)
-{
-//	struct r8180_priv *priv = ieee80211_priv(dev);
-	u32 phy_config;
-
-        // philips sa2400 expects 24 bits data
-
-	/*if(adr == 4 && priv->digphy){
-		phy_config=0x60000000;
-	}else{
-		phy_config=0xb0000000;
-	}*/
-
-	phy_config = 0xb0000000; // MAC will bang bits to the sa2400
-
-	phy_config |= (((u32)(adr&0xf))<< 24);
-	phy_config |= (data & 0xffffff);
-	write_nic_dword(dev,PHY_CONFIG,phy_config);
-#ifdef DEBUG_SA2400
-	DMESG("Writing sa2400: %x (adr %x)",phy_config,adr);
-#endif
-	rf_stabilize(dev);
-}
-
-
-
-void sa2400_write_phy_antenna(struct net_device *dev,short ch)
-{
-	struct r8180_priv *priv = ieee80211_priv(dev);
-	u8 ant;
-
-	ant = SA2400_ANTENNA;
-	if(priv->antb) /*default antenna is antenna B */
-		ant |= BB_ANTENNA_B;
-	if(ch == 14)
-		ant |= BB_ANTATTEN_CHAN14;
-	write_phy(dev,0x10,ant);
-	//DMESG("BB antenna %x ",ant);
-}
-
-
-/* from the rtl8181 embedded driver */
-short sa2400_rf_set_sens(struct net_device *dev, short sens)
-{
-	u8 finetune = 0;
-	if ((sens > 85) || (sens < 54)) return -1;
-
-	write_sa2400(dev,5,0x1dfb | (sens-54) << 15 |(finetune<<20));  // AGC	0xc9dfb
-
-	return 0;
-}
-
-
-void sa2400_rf_set_chan(struct net_device *dev, short ch)
-{
-	struct r8180_priv *priv = ieee80211_priv(dev);
-	u32 txpw = 0xff & priv->chtxpwr[ch];
-	u32 chan = sa2400_chan[ch];
-
-	write_sa2400(dev,7,txpw);
-	//write_phy(dev,0x10,0xd1);
-	sa2400_write_phy_antenna(dev,ch);
-	write_sa2400(dev,0,chan);
-	write_sa2400(dev,1,0xbb50);
-	write_sa2400(dev,2,0x80);
-	write_sa2400(dev,3,0);
-}
-
-
-void sa2400_rf_close(struct net_device *dev)
-{
-	write_sa2400(dev, 4, 0);
-}
-
-
-void sa2400_rf_init(struct net_device *dev)
-{
-	struct r8180_priv *priv = ieee80211_priv(dev);
-	u32 anaparam;
-	u8 firdac;
-
-	write_nic_byte(dev,PHY_DELAY,0x6);	//this is general
-	write_nic_byte(dev,CARRIER_SENSE_COUNTER,0x4c); //this is general
-
-	/*these are philips sa2400 specific*/
-	anaparam = read_nic_dword(dev,ANAPARAM);
-	anaparam = anaparam &~ (1<<ANAPARAM_TXDACOFF_SHIFT);
-
-	anaparam = anaparam &~ANAPARAM_PWR1_MASK;
-	anaparam = anaparam &~ANAPARAM_PWR0_MASK;
-	if(priv->digphy){
-		anaparam |= (SA2400_DIG_ANAPARAM_PWR1_ON<<ANAPARAM_PWR1_SHIFT);
-		anaparam |= (SA2400_ANAPARAM_PWR0_ON<<ANAPARAM_PWR0_SHIFT);
-	}else{
-		anaparam |= (SA2400_ANA_ANAPARAM_PWR1_ON<<ANAPARAM_PWR1_SHIFT);
-	}
-
-	rtl8180_set_anaparam(dev,anaparam);
-
-	firdac = (priv->digphy) ? (1<<SA2400_REG4_FIRDAC_SHIFT) : 0;
-	write_sa2400(dev,0,sa2400_chan[priv->chan]);
-	write_sa2400(dev,1,0xbb50);
-	write_sa2400(dev,2,0x80);
-	write_sa2400(dev,3,0);
-	write_sa2400(dev,4,0x19340 | firdac);
-	write_sa2400(dev,5,0xc9dfb);  // AGC
-	write_sa2400(dev,4,0x19348 | firdac);  //calibrates VCO
-
-	if(priv->digphy)
-		write_sa2400(dev,4,0x1938c); /*???*/
-
-	write_sa2400(dev,4,0x19340 | firdac);
-
-	write_sa2400(dev,0,sa2400_chan[priv->chan]);
-	write_sa2400(dev,1,0xbb50);
-	write_sa2400(dev,2,0x80);
-	write_sa2400(dev,3,0);
-	write_sa2400(dev,4,0x19344 | firdac); //calibrates filter
-
-	/* new from rtl8180 embedded driver (rtl8181 project) */
-	write_sa2400(dev,6,0x13ff | (1<<23)); // MANRX
-	write_sa2400(dev,8,0); //VCO
-
-	if(!priv->digphy)
-	{
-		rtl8180_set_anaparam(dev, anaparam | \
-				     (1<<ANAPARAM_TXDACOFF_SHIFT));
-
-		rtl8180_conttx_enable(dev);
-
-		write_sa2400(dev, 4, 0x19341); // calibrates DC
-
-		/* a 5us sleep is required here,
-		   we rely on the 3ms delay introduced in write_sa2400
-		*/
-		write_sa2400(dev, 4, 0x19345);
-		/* a 20us sleep is required here,
-		   we rely on the 3ms delay introduced in write_sa2400
-		*/
-		rtl8180_conttx_disable(dev);
-
-		rtl8180_set_anaparam(dev, anaparam);
-	}
-	/* end new */
-
-	write_sa2400(dev,4,0x19341 | firdac ); //RTX MODE
-
-	// Set tx power level !?
-
-
-	/*baseband configuration*/
-	write_phy(dev,0,0x98);
-	write_phy(dev,3,0x38);
-	write_phy(dev,4,0xe0);
-	write_phy(dev,5,0x90);
-	write_phy(dev,6,0x1a);
-	write_phy(dev,7,0x64);
-
-	/*Should be done something more here??*/
-
-	sa2400_write_phy_antenna(dev,priv->chan);
-
-	write_phy(dev,0x11,0x80);
-	if(priv->diversity)
-		write_phy(dev,0x12,0xc7);
-	else
-		write_phy(dev,0x12,0x47);
-
-	write_phy(dev,0x13,0x90 | priv->cs_treshold );
-
-	write_phy(dev,0x19,0x0);
-	write_phy(dev,0x1a,0xa0);
-
-	sa2400_rf_set_chan(dev,priv->chan);
-}
Index: b/drivers/staging/rtl8187se/r8180_sa2400.h
===================================================================
--- a/drivers/staging/rtl8187se/r8180_sa2400.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
-	This is part of rtl8180 OpenSource driver - v 0.7
-	Copyright (C) Andrea Merello 2004  <andreamrl@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.
-*/
-
-#define SA2400_ANTENNA 0x91
-#define SA2400_DIG_ANAPARAM_PWR1_ON 0x8
-#define SA2400_ANA_ANAPARAM_PWR1_ON 0x28
-#define SA2400_ANAPARAM_PWR0_ON 0x3
-
-#define SA2400_RF_MAX_SENS 85
-#define SA2400_RF_DEF_SENS 80
-
-#define SA2400_REG4_FIRDAC_SHIFT 7
-
-void sa2400_rf_init(struct net_device *dev);
-void sa2400_rf_set_chan(struct net_device *dev,short ch);
-short sa2400_rf_set_sens(struct net_device *dev,short sens);
-void sa2400_rf_close(struct net_device *dev);
Index: b/drivers/staging/rtl8187se/r8180_wx.c
===================================================================
--- a/drivers/staging/rtl8187se/r8180_wx.c
+++ b/drivers/staging/rtl8187se/r8180_wx.c
@@ -20,7 +20,6 @@
 
 #include "r8180.h"
 #include "r8180_hw.h"
-#include "r8180_sa2400.h"
 
 #include "ieee80211/dot11d.h"
 
Index: b/drivers/staging/rtl8187se/r8185b_init.c
===================================================================
--- a/drivers/staging/rtl8187se/r8185b_init.c
+++ b/drivers/staging/rtl8187se/r8185b_init.c
@@ -22,11 +22,7 @@ Notes:
 #include <linux/spinlock.h>
 #include "r8180_hw.h"
 #include "r8180.h"
-#include "r8180_sa2400.h"  /* PHILIPS Radio frontend */
-#include "r8180_max2820.h" /* MAXIM Radio frontend */
-#include "r8180_gct.h"     /* GCT Radio frontend */
 #include "r8180_rtl8225.h" /* RTL8225 Radio frontend */
-#include "r8180_rtl8255.h" /* RTL8255 Radio frontend */
 #include "r8180_93cx6.h"   /* Card EEPROM */
 #include "r8180_wx.h"
 

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 09/18] Staging: rtl8187se: remove debugging code from r8180_core.c
  2009-06-28 14:18 [PATCH 01/18] Staging: rtl8187se: remove ENABLE_DOT11D ifdefs Bartlomiej Zolnierkiewicz
                   ` (6 preceding siblings ...)
  2009-06-28 14:19 ` [PATCH 08/18] Staging: rtl8187se: remove unused radio frontends Bartlomiej Zolnierkiewicz
@ 2009-06-28 14:19 ` Bartlomiej Zolnierkiewicz
  2009-06-28 14:19 ` [PATCH 10/18] Staging: rtl8187se: remove unused rtl8225_rf_* functions Bartlomiej Zolnierkiewicz
                   ` (8 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-06-28 14:19 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Bartlomiej Zolnierkiewicz, linux-kernel

From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] Staging: rtl8187se: remove debugging code from r8180_core.c

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/staging/rtl8187se/r8180_core.c |  384 ---------------------------------
 1 file changed, 3 insertions(+), 381 deletions(-)

Index: b/drivers/staging/rtl8187se/r8180_core.c
===================================================================
--- a/drivers/staging/rtl8187se/r8180_core.c
+++ b/drivers/staging/rtl8187se/r8180_core.c
@@ -24,30 +24,8 @@
    add RTL8185 and RTL8225 support, and to David Young also.
 */
 
-#undef DEBUG_TX_DESC2
 #undef RX_DONT_PASS_UL
-#undef DEBUG_EPROM
-#undef DEBUG_RX_VERBOSE
 #undef DUMMY_RX
-#undef DEBUG_ZERO_RX
-#undef DEBUG_RX_SKB
-#undef DEBUG_TX_FRAG
-#undef DEBUG_RX_FRAG
-#undef DEBUG_TX_FILLDESC
-#undef DEBUG_TX
-#undef DEBUG_IRQ
-#undef DEBUG_RX
-#undef DEBUG_RXALLOC
-#undef DEBUG_REGISTERS
-#undef DEBUG_RING
-#undef DEBUG_IRQ_TASKLET
-#undef DEBUG_TX_ALLOC
-#undef DEBUG_TX_DESC
-
-//#define DEBUG_TX
-//#define DEBUG_TX_DESC2
-//#define DEBUG_RX
-//#define DEBUG_RX_SKB
 
 #include <linux/syscalls.h>
 //#include <linux/fcntl.h>
@@ -462,10 +440,6 @@ void rtl8180_proc_init_one(struct net_de
 short buffer_add(struct buffer **buffer, u32 *buf, dma_addr_t dma,
 		struct buffer **bufferhead)
 {
-#ifdef DEBUG_RING
-	DMESG("adding buffer to TX/RX struct");
-#endif
-
         struct buffer *tmp;
 
 	if(! *buffer){
@@ -622,168 +596,12 @@ short check_nic_enought_desc(struct net_
 	return (required+2 < get_curr_tx_free_desc(dev,priority));
 }
 
-
-/* This function is only for debuging purpose */
-void check_tx_ring(struct net_device *dev, int pri)
-{
-	static int maxlog =3;
-	struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-	u32* tmp;
-	struct buffer *buf;
-	int i;
-	int nic;
-	u32* tail;
-	u32* head;
-	u32* begin;
-	u32 nicbegin;
-	struct buffer* buffer;
-
-	maxlog --;
-	if (maxlog <0 ) return;
-
-	switch(pri) {
-	case MANAGE_PRIORITY:
-		tail = priv->txmapringtail;
-		begin = priv->txmapring;
-		head = priv->txmapringhead;
-		nic = read_nic_dword(dev,TX_MANAGEPRIORITY_RING_ADDR);
-		buffer = priv->txmapbufs;
-		nicbegin = priv->txmapringdma;
-		break;
-
-
-	case BK_PRIORITY:
-		tail = priv->txbkpringtail;
-		begin = priv->txbkpring;
-		head = priv->txbkpringhead;
-		nic = read_nic_dword(dev,TX_BKPRIORITY_RING_ADDR);
-		buffer = priv->txbkpbufs;
-		nicbegin = priv->txbkpringdma;
-		break;
-
-	case BE_PRIORITY:
-		tail = priv->txbepringtail;
-		begin = priv->txbepring;
-		head = priv->txbepringhead;
-		nic = read_nic_dword(dev,TX_BEPRIORITY_RING_ADDR);
-		buffer = priv->txbepbufs;
-		nicbegin = priv->txbepringdma;
-		break;
-
-	case VI_PRIORITY:
-		tail = priv->txvipringtail;
-		begin = priv->txvipring;
-		head = priv->txvipringhead;
-		nic = read_nic_dword(dev,TX_VIPRIORITY_RING_ADDR);
-		buffer = priv->txvipbufs;
-		nicbegin = priv->txvipringdma;
-		break;
-
-
-	case VO_PRIORITY:
-		tail = priv->txvopringtail;
-		begin = priv->txvopring;
-		head = priv->txvopringhead;
-		nic = read_nic_dword(dev,TX_VOPRIORITY_RING_ADDR);
-		buffer = priv->txvopbufs;
-		nicbegin = priv->txvopringdma;
-		break;
-
-	case HI_PRIORITY:
-		tail = priv->txhpringtail;
-		begin = priv->txhpring;
-		head = priv->txhpringhead;
-		nic = read_nic_dword(dev,TX_HIGHPRIORITY_RING_ADDR);
-		buffer = priv->txhpbufs;
-		nicbegin = priv->txhpringdma;
-		break;
-
-	default:
-		return ;
-		break;
-	}
-
-	if(!priv->txvopbufs)
-		DMESGE ("NIC TX ack, but TX queue corrupted!");
-	else{
-
-		for(i=0,buf=buffer, tmp=begin;
-			tmp<begin+(priv->txringcount)*8;
-			tmp+=8,buf=buf->next,i++)
-
-			DMESG("BUF%d %s %x %s. Next : %x",i,
-			      *tmp & (1<<31) ? "filled" : "empty",
-			      *(buf->buf),
-			      *tmp & (1<<15)? "ok": "err", *(tmp+4));
-	}
-
-	return;
-}
-
-
-
-/* this function is only for debugging purpose */
-void check_rxbuf(struct net_device *dev)
-{
-	struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-	u32* tmp;
-	struct buffer *buf;
-	u8 rx_desc_size;
-
-	rx_desc_size = 8;
-
-	if(!priv->rxbuffer)
-		DMESGE ("NIC RX ack, but RX queue corrupted!");
-
-	else{
-
-		for(buf=priv->rxbuffer, tmp=priv->rxring;
-		    tmp < priv->rxring+(priv->rxringcount)*rx_desc_size;
-		    tmp+=rx_desc_size, buf=buf->next)
-
-			DMESG("BUF %s %x",
-			      *tmp & (1<<31) ? "empty" : "filled",
-			      *(buf->buf));
-	}
-
-	return;
-}
-
-
-void dump_eprom(struct net_device *dev)
-{
-	int i;
-	for(i=0; i<63; i++)
-		DMESG("EEPROM addr %x : %x", i, eprom_read(dev,i));
-}
-
-
-void rtl8180_dump_reg(struct net_device *dev)
-{
-	int i;
-	int n;
-	int max=0xff;
-
-	DMESG("Dumping NIC register map");
-
-	for(n=0;n<=max;)
-	{
-		printk( "\nD: %2x> ", n);
-		for(i=0;i<16 && n<=max;i++,n++)
-			printk("%2x ",read_nic_byte(dev,n));
-	}
-	printk("\n");
-}
-
-
 void fix_tx_fifo(struct net_device *dev)
 {
 	struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
 	u32 *tmp;
 	int i;
-#ifdef DEBUG_TX_ALLOC
-	DMESG("FIXING TX FIFOs");
-#endif
+
 	for (tmp=priv->txmapring, i=0;
 	     i < priv->txringcount;
 	     tmp+=8, i++){
@@ -824,9 +642,7 @@ void fix_tx_fifo(struct net_device *dev)
 	     tmp+=8, i++){
 		*tmp = *tmp &~ (1<<31);
 	}
-#ifdef DEBUG_TX_ALLOC
-	DMESG("TX FIFOs FIXED");
-#endif
+
 	priv->txmapringtail = priv->txmapring;
 	priv->txmapringhead = priv->txmapring;
 	priv->txmapbufstail = priv->txmapbufs;
@@ -869,11 +685,6 @@ void fix_rx_fifo(struct net_device *dev)
 
 	rx_desc_size = 8; // 4*8 = 32 bytes
 
-#ifdef DEBUG_RXALLOC
-	DMESG("FIXING RX FIFO");
-	check_rxbuf(dev);
-#endif
-
 	for (tmp=priv->rxring, rxbuf=priv->rxbufferhead;
 	     (tmp < (priv->rxring)+(priv->rxringcount)*rx_desc_size);
 	     tmp+=rx_desc_size,rxbuf=rxbuf->next){
@@ -883,11 +694,6 @@ void fix_rx_fifo(struct net_device *dev)
 		*tmp |= (1<<31);
 	}
 
-#ifdef DEBUG_RXALLOC
-	DMESG("RX FIFO FIXED");
-	check_rxbuf(dev);
-#endif
-
 	priv->rxringtail=priv->rxring;
 	priv->rxbuffer=priv->rxbufferhead;
 	priv->rx_skb_complete=1;
@@ -1199,9 +1005,6 @@ void rtl8180_rx_enable(struct net_device
 
 	fix_rx_fifo(dev);
 
-#ifdef DEBUG_RX
-	DMESG("rxconf: %x %x",rxconf ,read_nic_dword(dev,RX_CONF));
-#endif
 	cmd=read_nic_byte(dev,CMD);
 	write_nic_byte(dev,CMD,cmd | (1<<CMD_RX_ENABLE_SHIFT));
 
@@ -1336,10 +1139,6 @@ void rtl8180_tx_enable(struct net_device
 
 	fix_tx_fifo(dev);
 
-#ifdef DEBUG_TX
-	DMESG("txconf: %x %x",txconf,read_nic_dword(dev,TX_CONF));
-#endif
-
 	cmd=read_nic_byte(dev,CMD);
 	write_nic_byte(dev,CMD,cmd | (1<<CMD_TX_ENABLE_SHIFT));
 
@@ -1523,10 +1322,6 @@ short alloc_tx_desc_ring(struct net_devi
 
 	}
 
-#ifdef DEBUG_TX
-	DMESG("Tx dma physical address: %x",dma_desc);
-#endif
-
 	return 0;
 }
 
@@ -1626,11 +1421,6 @@ short alloc_rx_desc_ring(struct net_devi
 		dma_tmp = pci_map_single(pdev,buf,bufsize * sizeof(u8),
 					 PCI_DMA_FROMDEVICE);
 
-#ifdef DEBUG_ZERO_RX
-		int j;
-		for(j=0;j<bufsize;j++) ((u8*)buf)[i] = 0;
-#endif
-
 		//buf = (void*)pci_alloc_consistent(pdev,bufsize,&dma_tmp);
 		if(-1 == buffer_add(&(priv->rxbuffer), buf,dma_tmp,
 			   &(priv->rxbufferhead))){
@@ -1642,21 +1432,11 @@ short alloc_rx_desc_ring(struct net_devi
 		*(tmp+2) = (u32)dma_tmp;
 		*tmp = *tmp |(1<<31); // descriptor void, owned by the NIC
 
-#ifdef DEBUG_RXALLOC
-		DMESG("Alloc %x size buffer, DMA mem @ %x, virtual mem @ %x",
-		      (u32)(bufsize&0xfff), (u32)dma_tmp, (u32)buf);
-#endif
-
 		tmp=tmp+rx_desc_size;
 	}
 
 	*(tmp-rx_desc_size) = *(tmp-rx_desc_size) | (1<<30); // this is the last descriptor
 
-
-#ifdef DEBUG_RXALLOC
-	DMESG("RX DMA physical address: %x",dma_desc);
-#endif
-
 	return 0;
 }
 
@@ -2129,16 +1909,6 @@ void rtl8180_rx(struct net_device *dev)
 			priv->rx_skb_complete = 1;
 		}
 
-#ifdef DEBUG_RX_FRAG
-		DMESG("Iteration.. len %x",len);
-		if(first) DMESG ("First descriptor");
-		if(last) DMESG("Last descriptor");
-
-#endif
-#ifdef DEBUG_RX_VERBOSE
-		print_buffer( priv->rxbuffer->buf, len);
-#endif
-
 		signal=(unsigned char)(((*(priv->rxringtail+3))& (0x00ff0000))>>16);
 		signal=(signal&0xfe)>>1;	// Modify by hikaru 6.6
 
@@ -2271,14 +2041,8 @@ void rtl8180_rx(struct net_device *dev)
 			if(!priv->rx_skb_complete){
 				/* seems that HW sometimes fails to reiceve and
 				   doesn't provide the last descriptor */
-#ifdef DEBUG_RX_SKB
-				DMESG("going to free incomplete skb");
-#endif
 				dev_kfree_skb_any(priv->rx_skb);
 				priv->stats.rxnolast++;
-#ifdef DEBUG_RX_SKB
-				DMESG("free incomplete skb OK");
-#endif
 			}
 			/* support for prism header has been originally added by Christian */
 			if(priv->prism_hdr && priv->ieee80211->iw_mode == IW_MODE_MONITOR){
@@ -2286,9 +2050,6 @@ void rtl8180_rx(struct net_device *dev)
 			}else{
 				priv->rx_skb = dev_alloc_skb(len+2);
 				if( !priv->rx_skb) goto drop;
-#ifdef DEBUG_RX_SKB
-				DMESG("Alloc initial skb %x",len+2);
-#endif
 			}
 
 			priv->rx_skb_complete=0;
@@ -2307,31 +2068,17 @@ void rtl8180_rx(struct net_device *dev)
 				if(!tmp_skb) goto drop;
 
 				tmp_skb->dev=dev;
-#ifdef DEBUG_RX_SKB
-				DMESG("Realloc skb %x",len+2);
-#endif
 
-#ifdef DEBUG_RX_SKB
-				DMESG("going copy prev frag %x",priv->rx_skb->len);
-#endif
 				memcpy(skb_put(tmp_skb,priv->rx_skb->len),
 					priv->rx_skb->data,
 					priv->rx_skb->len);
-#ifdef DEBUG_RX_SKB
-				DMESG("skb copy prev frag complete");
-#endif
 
 				dev_kfree_skb_any(priv->rx_skb);
-#ifdef DEBUG_RX_SKB
-				DMESG("prev skb free ok");
-#endif
 
 				priv->rx_skb=tmp_skb;
 			}
 		}
-#ifdef DEBUG_RX_SKB
-		DMESG("going to copy current payload %x",len);
-#endif
+
 		if(!priv->rx_skb_complete) {
 			if(padding) {
 				memcpy(skb_put(priv->rx_skb,len),
@@ -2341,39 +2088,19 @@ void rtl8180_rx(struct net_device *dev)
 					priv->rxbuffer->buf,len);
 			}
 		}
-#ifdef DEBUG_RX_SKB
-		DMESG("current fragment skb copy complete");
-#endif
 
 		if(last && !priv->rx_skb_complete){
-
-#ifdef DEBUG_RX_SKB
-			DMESG("Got last fragment");
-#endif
-
 			if(priv->rx_skb->len > 4)
 				skb_trim(priv->rx_skb,priv->rx_skb->len-4);
-#ifdef DEBUG_RX_SKB
-			DMESG("yanked out crc, passing to the upper layer");
-#endif
-
 #ifndef RX_DONT_PASS_UL
 			if(!ieee80211_rx(priv->ieee80211,
 					 priv->rx_skb, &stats)){
-#ifdef DEBUG_RX
-				DMESGW("Packet not consumed");
-#endif
 #endif // RX_DONT_PASS_UL
 
 				dev_kfree_skb_any(priv->rx_skb);
 #ifndef RX_DONT_PASS_UL
 			}
 #endif
-#ifdef DEBUG_RX
-			else{
-					DMESG("Rcv frag");
-			}
-#endif
 			priv->rx_skb_complete=1;
 		}
 
@@ -2400,9 +2127,6 @@ drop: // this is used when we have not e
 
 			//wmb();
 
-#ifdef DEBUG_RX
-		DMESG("Current descriptor: %x",(u32)priv->rxringtail);
-#endif
 		//unsigned long flags;
 		//spin_lock_irqsave(&priv->irq_lock,flags);
 
@@ -2829,12 +2553,6 @@ short rtl8180_tx(struct net_device *dev,
 	temp_tail = tail;
 //printk("================================>buflen = %d, remain = %d!\n", buflen,remain);
 	while(remain!=0){
-#ifdef DEBUG_TX_FRAG
-		DMESG("TX iteration");
-#endif
-#ifdef DEBUG_TX
-		DMESG("TX: filling descriptor %x",(u32)tail);
-#endif
 		mb();
 		if(!buflist){
 			DMESGE("TX buffer error, cannot TX frames. pri %d.", priority);
@@ -2848,11 +2566,6 @@ short rtl8180_tx(struct net_device *dev,
 				DMESGW("No more TX desc, returning %x of %x",
 				remain,len);
 				priv->stats.txrdu++;
-#ifdef DEBUG_TX_DESC
-				check_tx_ring(dev,priority);
-			//	netif_stop_queue(dev);
-			//	netif_carrier_off(dev);
-#endif
 			//	spin_unlock_irqrestore(&priv->tx_lock,flags);
 
 			return remain;
@@ -2874,9 +2587,6 @@ short rtl8180_tx(struct net_device *dev,
 	//	*tail = *tail | (1<<16);
 		if(remain==len && !descfrag) {
 			ownbit_flag = false;	//added by david woo,2007.12.14
-#ifdef DEBUG_TX_FRAG
-			DMESG("First descriptor");
-#endif
 			*tail = *tail| (1<<29) ; //fist segment of the packet
 			*tail = *tail |(len);
 		} else {
@@ -2925,12 +2635,6 @@ short rtl8180_tx(struct net_device *dev,
 			duration = rtl8180_len2duration(len,
 				rate,&ext);
 
-
-#ifdef DEBUG_TX
-			DMESG("PLCP duration %d",duration );
-			//DMESG("drift %d",drift);
-			DMESG("extension %s", (ext==1) ? "on":"off");
-#endif
 			*(tail+1) = *(tail+1) | ((duration & 0x7fff)<<16);
 			if(ext) *(tail+1) = *(tail+1) |(1<<31); //plcp length extension
 		}
@@ -2938,10 +2642,6 @@ short rtl8180_tx(struct net_device *dev,
 		if(morefrag) *tail = (*tail) | (1<<17); // more fragment
 		if(!remain) *tail = (*tail) | (1<<28); // last segment of frame
 
-#ifdef DEBUG_TX_FRAG
-		if(!remain)DMESG("Last descriptor");
-		if(morefrag)DMESG("More frag");
-#endif
                *(tail+5) = *(tail+5)|(2<<27);
                 *(tail+7) = *(tail+7)|(1<<4);
 
@@ -2951,12 +2651,6 @@ short rtl8180_tx(struct net_device *dev,
 			*tail = *tail | (1<<31); // descriptor ready to be txed
 		}
 
-#ifdef DEBUG_TX_DESC2
-                printk("tx desc is:\n");
-		DMESG("%8x %8x %8x %8x %8x %8x %8x %8x", tail[0], tail[1], tail[2], tail[3],
-			tail[4], tail[5], tail[6], tail[7]);
-#endif
-
 		if((tail - begin)/8 == count-1)
 			tail=begin;
 
@@ -3839,11 +3533,6 @@ short rtl8180_init(struct net_device *de
 		word = eprom_read(dev,EPROM_TXPW_CH1_2 + j);
 		priv->chtxpwr[i]=word & 0xff;
 		priv->chtxpwr[i+1]=(word & 0xff00)>>8;
-#ifdef DEBUG_EPROM
-		DMESG("tx word %x:%x",j,word);
-		DMESG("ch %d pwr %x",i,priv->chtxpwr[i]);
-		DMESG("ch %d pwr %x",i+1,priv->chtxpwr[i+1]);
-#endif
 	}
 	if(priv->card_8185){
 		for(i=1,j=0; i<14; i+=2,j++){
@@ -3851,11 +3540,6 @@ short rtl8180_init(struct net_device *de
 			word = eprom_read(dev,EPROM_TXPW_OFDM_CH1_2 + j);
 			priv->chtxpwr_ofdm[i]=word & 0xff;
 			priv->chtxpwr_ofdm[i+1]=(word & 0xff00)>>8;
-#ifdef DEBUG_EPROM
-			DMESG("ofdm tx word %x:%x",j,word);
-			DMESG("ofdm ch %d pwr %x",i,priv->chtxpwr_ofdm[i]);
-			DMESG("ofdm ch %d pwr %x",i+1,priv->chtxpwr_ofdm[i+1]);
-#endif
 		}
 	}
 //{by amy 080312
@@ -4006,10 +3690,6 @@ DMESG output to andreamrl@tiscali.it THA
 		DMESG("IRQ %d",dev->irq);
 	}
 
-#ifdef DEBUG_EPROM
-	dump_eprom(dev);
-#endif
-
 	return 0;
 
 }
@@ -4194,9 +3874,6 @@ void write_phy(struct net_device *dev, u
 		if(phy == data){ //SUCCESS!
 			force_pci_posting(dev);
 			mdelay(3); //random value
-#ifdef DEBUG_BB
-			DMESG("Phy wr %x,%x",adr,data);
-#endif
 			return;
 		}else{
 			force_pci_posting(dev);
@@ -4314,9 +3991,6 @@ void rtl8180_adapter_start(struct net_de
 	rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
 
 	write_nic_dword(dev,INT_TIMEOUT,0);
-#ifdef DEBUG_REGISTERS
-	rtl8180_dump_reg(dev);
-#endif
 
 	if(!priv->card_8185)
 	{
@@ -5236,12 +4910,7 @@ priv->txnpring)/8);
 	nicv = (u32*) ((nic - nicbegin) + (u8*)begin);
 	if((head <= tail && (nicv > tail || nicv < head)) ||
 		(head > tail && (nicv > tail && nicv < head))){
-
 			DMESGW("nic has lost pointer");
-#ifdef DEBUG_TX_DESC
-			//check_tx_ring(dev,NORM_PRIORITY);
-			check_tx_ring(dev,pri);
-#endif
 			spin_unlock_irqrestore(&priv->tx_lock,flag);
 			rtl8180_restart(dev);
 			return;
@@ -5403,9 +5072,6 @@ irqreturn_t rtl8180_interrupt(int irq, v
 	}
 
 	priv->stats.ints++;
-#ifdef DEBUG_IRQ
-	DMESG("NIC irq %x",inta);
-#endif
 	//priv->irqpending = inta;
 
 
@@ -5436,18 +5102,12 @@ irqreturn_t rtl8180_interrupt(int irq, v
 	}
 
 	if(inta & ISR_THPDER){
-#ifdef DEBUG_TX
-		DMESG ("TX high priority ERR");
-#endif
 		priv->stats.txhperr++;
 		rtl8180_tx_isr(dev,HI_PRIORITY,1);
 		priv->ieee80211->stats.tx_errors++;
 	}
 
 	if(inta & ISR_THPDOK){ //High priority tx ok
-#ifdef DEBUG_TX
-		DMESG ("TX high priority OK");
-#endif
 //		priv->NumTxOkTotal++;
 		//priv->NumTxOkInPeriod++;  //YJ,del,080828
 		priv->link_detect.NumTxOkInPeriod++; //YJ,add,080828
@@ -5457,16 +5117,10 @@ irqreturn_t rtl8180_interrupt(int irq, v
 
 	if(inta & ISR_RER) {
 		priv->stats.rxerr++;
-#ifdef DEBUG_RX
-		DMESGW("RX error int");
-#endif
 	}
 	if(inta & ISR_TBKDER){ //corresponding to BK_PRIORITY
 		priv->stats.txbkperr++;
 		priv->ieee80211->stats.tx_errors++;
-#ifdef DEBUG_TX
-		DMESGW("TX bkp error int");
-#endif
 		//tasklet_schedule(&priv->irq_tx_tasklet);
 		rtl8180_tx_isr(dev,BK_PRIORITY,1);
 		rtl8180_try_wake_queue(dev, BE_PRIORITY);
@@ -5475,9 +5129,6 @@ irqreturn_t rtl8180_interrupt(int irq, v
 	if(inta & ISR_TBEDER){ //corresponding to BE_PRIORITY
 		priv->stats.txbeperr++;
 		priv->ieee80211->stats.tx_errors++;
-#ifdef DEBUG_TX
-		DMESGW("TX bep error int");
-#endif
 		rtl8180_tx_isr(dev,BE_PRIORITY,1);
 		//tasklet_schedule(&priv->irq_tx_tasklet);
 		rtl8180_try_wake_queue(dev, BE_PRIORITY);
@@ -5485,9 +5136,6 @@ irqreturn_t rtl8180_interrupt(int irq, v
 	if(inta & ISR_TNPDER){ //corresponding to VO_PRIORITY
 		priv->stats.txnperr++;
 		priv->ieee80211->stats.tx_errors++;
-#ifdef DEBUG_TX
-		DMESGW("TX np error int");
-#endif
 		//tasklet_schedule(&priv->irq_tx_tasklet);
 		rtl8180_tx_isr(dev,NORM_PRIORITY,1);
 		rtl8180_try_wake_queue(dev, NORM_PRIORITY);
@@ -5496,27 +5144,18 @@ irqreturn_t rtl8180_interrupt(int irq, v
 	if(inta & ISR_TLPDER){ //corresponding to VI_PRIORITY
 		priv->stats.txlperr++;
 		priv->ieee80211->stats.tx_errors++;
-#ifdef DEBUG_TX
-		DMESGW("TX lp error int");
-#endif
 		rtl8180_tx_isr(dev,LOW_PRIORITY,1);
 		//tasklet_schedule(&priv->irq_tx_tasklet);
 		rtl8180_try_wake_queue(dev, LOW_PRIORITY);
 	}
 
 	if(inta & ISR_ROK){
-#ifdef DEBUG_RX
-		DMESG("Frame arrived !");
-#endif
 		//priv->NumRxOkInPeriod++;  //YJ,del,080828
 		priv->stats.rxint++;
 		tasklet_schedule(&priv->irq_rx_tasklet);
 	}
 
 	if(inta & ISR_RQoSOK ){
-#ifdef DEBUG_RX
-		DMESG("QoS Frame arrived !");
-#endif
 		//priv->NumRxOkInPeriod++;  //YJ,del,080828
 		priv->stats.rxint++;
 		tasklet_schedule(&priv->irq_rx_tasklet);
@@ -5527,18 +5166,13 @@ irqreturn_t rtl8180_interrupt(int irq, v
 	}
 
 	if(inta & ISR_RDU){
-//#ifdef DEBUG_RX
 		DMESGW("No RX descriptor available");
 		priv->stats.rxrdu++;
-//#endif
 		tasklet_schedule(&priv->irq_rx_tasklet);
 		/*queue_work(priv->workqueue ,&priv->restart_work);*/
 
 	}
 	if(inta & ISR_RXFOVW){
-#ifdef DEBUG_RX
-		DMESGW("RX fifo overflow");
-#endif
 		priv->stats.rxoverflow++;
 		tasklet_schedule(&priv->irq_rx_tasklet);
 		//queue_work(priv->workqueue ,&priv->restart_work);
@@ -5547,9 +5181,6 @@ irqreturn_t rtl8180_interrupt(int irq, v
 	if(inta & ISR_TXFOVW) priv->stats.txoverflow++;
 
 	if(inta & ISR_TNPDOK){ //Normal priority tx ok
-#ifdef DEBUG_TX
-		DMESG ("TX normal priority OK");
-#endif
 //		priv->NumTxOkTotal++;
 		//priv->NumTxOkInPeriod++;  //YJ,del,080828
 		priv->link_detect.NumTxOkInPeriod++; //YJ,add,080828
@@ -5559,9 +5190,6 @@ irqreturn_t rtl8180_interrupt(int irq, v
 	}
 
 	if(inta & ISR_TLPDOK){ //Low priority tx ok
-#ifdef DEBUG_TX
-		DMESG ("TX low priority OK");
-#endif
 //		priv->NumTxOkTotal++;
 		//priv->NumTxOkInPeriod++;  //YJ,del,080828
 		priv->link_detect.NumTxOkInPeriod++; //YJ,add,080828
@@ -5573,9 +5201,6 @@ irqreturn_t rtl8180_interrupt(int irq, v
 
 	if(inta & ISR_TBKDOK){ //corresponding to BK_PRIORITY
 		priv->stats.txbkpokint++;
-#ifdef DEBUG_TX
-		DMESGW("TX bk priority ok");
-#endif
 //		priv->NumTxOkTotal++;
 		//priv->NumTxOkInPeriod++;  //YJ,del,080828
 		priv->link_detect.NumTxOkInPeriod++; //YJ,add,080828
@@ -5585,9 +5210,6 @@ irqreturn_t rtl8180_interrupt(int irq, v
 
 	if(inta & ISR_TBEDOK){ //corresponding to BE_PRIORITY
 		priv->stats.txbeperr++;
-#ifdef DEBUG_TX
-		DMESGW("TX be priority ok");
-#endif
 //		priv->NumTxOkTotal++;
 		//priv->NumTxOkInPeriod++;  //YJ,del,080828
 		priv->link_detect.NumTxOkInPeriod++; //YJ,add,080828

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 10/18] Staging: rtl8187se: remove unused rtl8225_rf_* functions
  2009-06-28 14:18 [PATCH 01/18] Staging: rtl8187se: remove ENABLE_DOT11D ifdefs Bartlomiej Zolnierkiewicz
                   ` (7 preceding siblings ...)
  2009-06-28 14:19 ` [PATCH 09/18] Staging: rtl8187se: remove debugging code from r8180_core.c Bartlomiej Zolnierkiewicz
@ 2009-06-28 14:19 ` Bartlomiej Zolnierkiewicz
  2009-06-28 14:19 ` [PATCH 11/18] Staging: rtl8187se: cleanup r8180_rtl8225.c Bartlomiej Zolnierkiewicz
                   ` (7 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-06-28 14:19 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Bartlomiej Zolnierkiewicz, linux-kernel

From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] Staging: rtl8187se: remove unused rtl8225_rf_* functions

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/staging/rtl8187se/r8180_core.c    |    4 
 drivers/staging/rtl8187se/r8180_rtl8225.c |  369 ------------------------------
 drivers/staging/rtl8187se/r8180_rtl8225.h |    4 
 3 files changed, 377 deletions(-)

Index: b/drivers/staging/rtl8187se/r8180_core.c
===================================================================
--- a/drivers/staging/rtl8187se/r8180_core.c
+++ b/drivers/staging/rtl8187se/r8180_core.c
@@ -3613,10 +3613,6 @@ DMESG output to andreamrl@tiscali.it THA
 	priv->rf_init = rtl8225z2_rf_init;
 	priv->rf_set_chan = rtl8225z2_rf_set_chan;
 	priv->rf_set_sens = NULL;
-	//priv->rf_sleep = rtl8225_rf_sleep;
-	//priv->rf_wakeup = rtl8225_rf_wakeup;
-
-
 
 	if(!priv->card_8185){
 		if(priv->antb)
Index: b/drivers/staging/rtl8187se/r8180_rtl8225.c
===================================================================
--- a/drivers/staging/rtl8187se/r8180_rtl8225.c
+++ b/drivers/staging/rtl8187se/r8180_rtl8225.c
@@ -178,17 +178,6 @@ void write_rtl8225(struct net_device *de
 		rtl8185_rf_pins_enable(dev);
 }
 
-void rtl8225_rf_close(struct net_device *dev)
-{
-	write_rtl8225(dev, 0x4, 0x1f);
-
-	force_pci_posting(dev);
-	mdelay(1);
-
-	rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_OFF);
-	rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_OFF);
-}
-
 void rtl8225_SetTXPowerLevel(struct net_device *dev, short ch)
 {
 	struct r8180_priv *priv = ieee80211_priv(dev);
@@ -354,361 +343,3 @@ void rtl8225_host_pci_init(struct net_de
 void rtl8225_host_usb_init(struct net_device *dev)
 {
 }
-
-void rtl8225_rf_sleep(struct net_device *dev)
-{
-	write_rtl8225(dev,0x4,0xdff);
-	force_pci_posting(dev);
-	mdelay(1);
-	rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_SLEEP);
-	rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_SLEEP);
-	force_pci_posting(dev);
-}
-
-void rtl8225_rf_wakeup(struct net_device *dev)
-{
-	write_rtl8225(dev,0x4,0x9ff);
-	rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
-	rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
-	force_pci_posting(dev);
-}
-
-void rtl8225_rf_init(struct net_device *dev)
-{
-	struct r8180_priv *priv = ieee80211_priv(dev);
-	int i;
-	short channel = 1;
-	u16 brsr;
-
-	priv->chan = channel;
-
-	rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
-
-
-	if(priv->card_type == USB)
-		rtl8225_host_usb_init(dev);
-	else
-		rtl8225_host_pci_init(dev);
-
-	write_nic_dword(dev, RF_TIMING, 0x000a8008);
-
-	brsr = read_nic_word(dev, BRSR);
-
-	write_nic_word(dev, BRSR, 0xffff);
-
-	write_nic_dword(dev, RF_PARA, 0x100044);
-
-	#if 1  //0->1
-	rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
-	write_nic_byte(dev, CONFIG3, 0x44);
-	rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
-	#endif
-
-	if(priv->card_type == USB){
-		rtl8185_rf_pins_enable(dev);
-
-		mdelay(1000);
-	}
-
-	write_rtl8225(dev, 0x0, 0x67); mdelay(1);
-
-
-	write_rtl8225(dev, 0x1, 0xfe0); mdelay(1);
-
-	write_rtl8225(dev, 0x2, 0x44d); mdelay(1);
-
-	write_rtl8225(dev, 0x3, 0x441); mdelay(1);
-
-	if(priv->card_type == USB)
-		write_rtl8225(dev, 0x4, 0x486);
-	else
-		write_rtl8225(dev, 0x4, 0x8be);
-
-	mdelay(1);
-
-	/* version B & C */
-
-	if(priv->card_type == USB)
-		write_rtl8225(dev, 0x5, 0xbc0);
-	else if(priv->card_type == MINIPCI)
-		write_rtl8225(dev, 0x5, 0xbc0 + 3 +(6<<3));
-	else
-		write_rtl8225(dev, 0x5, 0xbc0 + (6<<3));
-
-	 mdelay(1);
-//	}
-
-	write_rtl8225(dev, 0x6, 0xae6);  mdelay(1);
-
-	write_rtl8225(dev, 0x7, ((priv->card_type == USB)? 0x82a : rtl8225_chan[channel]));  mdelay(1);
-
-	write_rtl8225(dev, 0x8, 0x1f);  mdelay(1);
-
-	write_rtl8225(dev, 0x9, 0x334);  mdelay(1);
-
-	write_rtl8225(dev, 0xa, 0xfd4);  mdelay(1);
-
-	write_rtl8225(dev, 0xb, 0x391);  mdelay(1);
-
-	write_rtl8225(dev, 0xc, 0x50);  mdelay(1);
-
-
-	write_rtl8225(dev, 0xd, 0x6db);   mdelay(1);
-
-	write_rtl8225(dev, 0xe, 0x29);  mdelay(1);
-
-	write_rtl8225(dev, 0xf, 0x914);
-
-	if(priv->card_type == USB){
-		//force_pci_posting(dev);
-		mdelay(100);
-	}
-
-	write_rtl8225(dev, 0x2, 0xc4d);
-
-	if(priv->card_type == USB){
-	//	force_pci_posting(dev);
-		mdelay(200);
-
-		write_rtl8225(dev, 0x2, 0x44d);
-
-	//	force_pci_posting(dev);
-		mdelay(100);
-
-	}//End of if(priv->card_type == USB)
-	/* FIXME!! rtl8187 we have to check if calibrarion
-	 * is successful and eventually cal. again (repeat
-	 * the two write on reg 2)
-	*/
-	force_pci_posting(dev);
-
-	mdelay(100); //200 for 8187
-
-	//if(priv->card_type != USB) /* maybe not needed even for 8185 */
-//	write_rtl8225(dev, 0x7, rtl8225_chan[channel]);
-
-	write_rtl8225(dev, 0x0, 0x127);
-
-	for(i=0;i<95;i++){
-		write_rtl8225(dev, 0x1, (u8)(i+1));
-
-		/* version B & C & D*/
-
-		write_rtl8225(dev, 0x2, rtl8225bcd_rxgain[i]);
-	}
-
-	write_rtl8225(dev, 0x0, 0x27);
-
-
-//	//if(priv->card_type != USB){
-//		write_rtl8225(dev, 0x2, 0x44d);
-//		write_rtl8225(dev, 0x7, rtl8225_chan[channel]);
-//		write_rtl8225(dev, 0x2, 0x47d);
-//
-//		force_pci_posting(dev);
-//		mdelay(100);
-//
-//		write_rtl8225(dev, 0x2, 0x44d);
-//	//}
-
-	write_rtl8225(dev, 0x0, 0x22f);
-
-	if(priv->card_type != USB)
-		rtl8185_rf_pins_enable(dev);
-
-	for(i=0;i<128;i++){
-		write_phy_ofdm(dev, 0xb, rtl8225_agc[i]);
-
-		mdelay(1);
-		write_phy_ofdm(dev, 0xa, (u8)i+ 0x80);
-
-		mdelay(1);
-	}
-
-	force_pci_posting(dev);
-	mdelay(1);
-
-	write_phy_ofdm(dev, 0x0, 0x1); mdelay(1);
-	write_phy_ofdm(dev, 0x1, 0x2); mdelay(1);
-	write_phy_ofdm(dev, 0x2, ((priv->card_type == USB)? 0x42 : 0x62)); mdelay(1);
-	write_phy_ofdm(dev, 0x3, 0x0); mdelay(1);
-	write_phy_ofdm(dev, 0x4, 0x0); mdelay(1);
-	write_phy_ofdm(dev, 0x5, 0x0); mdelay(1);
-	write_phy_ofdm(dev, 0x6, 0x40); mdelay(1);
-	write_phy_ofdm(dev, 0x7, 0x0); mdelay(1);
-	write_phy_ofdm(dev, 0x8, 0x40); mdelay(1);
-	write_phy_ofdm(dev, 0x9, 0xfe); mdelay(1);
-
-			/* ver C & D */
-	write_phy_ofdm(dev, 0xa, 0x9); mdelay(1);
-
-	//write_phy_ofdm(dev, 0x18, 0xef);
-	//	}
-	//}
-	write_phy_ofdm(dev, 0xb, 0x80); mdelay(1);
-
-	write_phy_ofdm(dev, 0xc, 0x1);mdelay(1);
-
-
-	//if(priv->card_type != USB)
-	//write_phy_ofdm(dev, 0xd, 0x33); // <>
-
-	write_phy_ofdm(dev, 0xe, 0xd3);mdelay(1);
-
-
-	write_phy_ofdm(dev, 0xf, 0x38);mdelay(1);
-/*ver D & 8187*/
-//	}
-
-//	if(priv->card_8185 == 1 && priv->card_8185_Bversion)
-//		write_phy_ofdm(dev, 0x10, 0x04);/*ver B*/
-//	else
-	write_phy_ofdm(dev, 0x10, 0x84);mdelay(1);
-/*ver C & D & 8187*/
-
-	write_phy_ofdm(dev, 0x11, 0x06);mdelay(1);
-/*agc resp time 700*/
-
-
-//	if(priv->card_8185 == 2){
-	/* Ver D & 8187*/
-	write_phy_ofdm(dev, 0x12, 0x20);mdelay(1);
-
-	write_phy_ofdm(dev, 0x13, 0x20);mdelay(1);
-
-	write_phy_ofdm(dev, 0x14, 0x0); mdelay(1);
-	write_phy_ofdm(dev, 0x15, 0x40); mdelay(1);
-	write_phy_ofdm(dev, 0x16, 0x0); mdelay(1);
-	write_phy_ofdm(dev, 0x17, 0x40); mdelay(1);
-
-//	if (priv->card_type == USB)
-//		write_phy_ofdm(dev, 0x18, 0xef);
-
-	write_phy_ofdm(dev, 0x18, 0xef);mdelay(1);
-
-
-	write_phy_ofdm(dev, 0x19, 0x19); mdelay(1);
-	write_phy_ofdm(dev, 0x1a, 0x20); mdelay(1);
-
-//	if (priv->card_type != USB){
-//		if(priv->card_8185 == 1 && priv->card_8185_Bversion)
-//			write_phy_ofdm(dev, 0x1b, 0x66); /* Ver B */
-//		else
-	write_phy_ofdm(dev, 0x1b, 0x76);mdelay(1);
- /* Ver C & D */ //FIXME:MAYBE not needed
-//	}
-
-	write_phy_ofdm(dev, 0x1c, 0x4);mdelay(1);
-
-		/*ver D & 8187*/
-	write_phy_ofdm(dev, 0x1e, 0x95);mdelay(1);
-
-	write_phy_ofdm(dev, 0x1f, 0x75);	mdelay(1);
-
-//	}
-
-	write_phy_ofdm(dev, 0x20, 0x1f);mdelay(1);
-
-	write_phy_ofdm(dev, 0x21, 0x27);mdelay(1);
-
-	write_phy_ofdm(dev, 0x22, 0x16);mdelay(1);
-
-//	if(priv->card_type != USB)
-	//write_phy_ofdm(dev, 0x23, 0x43); //FIXME maybe not needed // <>
-
-	write_phy_ofdm(dev, 0x24, 0x46); mdelay(1);
-	write_phy_ofdm(dev, 0x25, 0x20); mdelay(1);
-	write_phy_ofdm(dev, 0x26, 0x90); mdelay(1);
-	write_phy_ofdm(dev, 0x27, 0x88); mdelay(1);
-/* Ver C & D & 8187*/
-
-	// <> Set init. gain to m74dBm.
-	write_phy_ofdm(dev, 0x0d, 0x43);	 mdelay(1);
-	write_phy_ofdm(dev, 0x1b, 0x76);	 mdelay(1);
-	write_phy_ofdm(dev, 0x1d, 0xc5);	 mdelay(1);
-	write_phy_ofdm(dev, 0x23, 0x78);	 mdelay(1);
-
-	//if(priv->card_type == USB);
-	//	rtl8225_set_gain_usb(dev, 1); /* FIXME this '2' is random */
-
-	write_phy_cck(dev, 0x0, 0x98); mdelay(1);
-	write_phy_cck(dev, 0x3, 0x20); mdelay(1);
-	write_phy_cck(dev, 0x4, 0x7e); mdelay(1);
-	write_phy_cck(dev, 0x5, 0x12); mdelay(1);
-	write_phy_cck(dev, 0x6, 0xfc); mdelay(1);
-	write_phy_cck(dev, 0x7, 0x78);mdelay(1);
- /* Ver C & D & 8187*/
-
-	write_phy_cck(dev, 0x8, 0x2e);mdelay(1);
-
-	write_phy_cck(dev, 0x10, ((priv->card_type == USB) ? 0x9b: 0x93)); mdelay(1);
-	write_phy_cck(dev, 0x11, 0x88); mdelay(1);
-	write_phy_cck(dev, 0x12, 0x47); mdelay(1);
-	write_phy_cck(dev, 0x13, 0xd0); /* Ver C & D & 8187*/
-
-	write_phy_cck(dev, 0x19, 0x0);
-	write_phy_cck(dev, 0x1a, 0xa0);
-	write_phy_cck(dev, 0x1b, 0x8);
-	write_phy_cck(dev, 0x40, 0x86); /* CCK Carrier Sense Threshold */
-
-	write_phy_cck(dev, 0x41, 0x8d);mdelay(1);
-
-
-	write_phy_cck(dev, 0x42, 0x15); mdelay(1);
-	write_phy_cck(dev, 0x43, 0x18); mdelay(1);
-	write_phy_cck(dev, 0x44, 0x1f); mdelay(1);
-	write_phy_cck(dev, 0x45, 0x1e); mdelay(1);
-	write_phy_cck(dev, 0x46, 0x1a); mdelay(1);
-	write_phy_cck(dev, 0x47, 0x15); mdelay(1);
-	write_phy_cck(dev, 0x48, 0x10); mdelay(1);
-	write_phy_cck(dev, 0x49, 0xa); mdelay(1);
-	write_phy_cck(dev, 0x4a, 0x5); mdelay(1);
-	write_phy_cck(dev, 0x4b, 0x2); mdelay(1);
-	write_phy_cck(dev, 0x4c, 0x5);mdelay(1);
-
-
-	write_nic_byte(dev, 0x5b, 0x0d); mdelay(1);
-
-
-
-// <>
-//	// TESTR 0xb 8187
-//	write_phy_cck(dev, 0x10, 0x93);// & 0xfb);
-//
-//	//if(priv->card_type != USB){
-//		write_phy_ofdm(dev, 0x2, 0x62);
-//		write_phy_ofdm(dev, 0x6, 0x0);
-//		write_phy_ofdm(dev, 0x8, 0x0);
-//	//}
-
-	rtl8225_SetTXPowerLevel(dev, channel);
-
-	write_phy_cck(dev, 0x10, 0x9b); mdelay(1); /* Rx ant A, 0xdb for B */
-	write_phy_ofdm(dev, 0x26, 0x90); mdelay(1); /* Rx ant A, 0x10 for B */
-
-	rtl8185_tx_antenna(dev, 0x3); /* TX ant A, 0x0 for B */
-
-	/* switch to high-speed 3-wire
-	 * last digit. 2 for both cck and ofdm
-	 */
-	if(priv->card_type == USB)
-		write_nic_dword(dev, 0x94, 0x3dc00002);
-	else{
-		write_nic_dword(dev, 0x94, 0x15c00002);
-		rtl8185_rf_pins_enable(dev);
-	}
-
-//	if(priv->card_type != USB)
-//	rtl8225_set_gain(dev, 4); /* FIXME this '1' is random */ // <>
-//	 rtl8225_set_mode(dev, 1); /* FIXME start in B mode */ // <>
-//
-//	/* make sure is waken up! */
-//	write_rtl8225(dev,0x4, 0x9ff);
-//	rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
-//	rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
-
-	rtl8225_rf_set_chan(dev, priv->chan);
-
-	write_nic_word(dev,BRSR,brsr);
-
-}
Index: b/drivers/staging/rtl8187se/r8180_rtl8225.h
===================================================================
--- a/drivers/staging/rtl8187se/r8180_rtl8225.h
+++ b/drivers/staging/rtl8187se/r8180_rtl8225.h
@@ -29,11 +29,7 @@ void rtl8225_host_usb_init(struct net_de
 void write_rtl8225(struct net_device *dev, u8 adr, u16 data);
 void RF_WriteReg(struct net_device *dev, u8 offset, u32	data);
 u32 RF_ReadReg(struct net_device *dev, u8 offset);
-void rtl8225_rf_init(struct net_device *dev);
 void rtl8225_rf_set_chan(struct net_device *dev,short ch);
-void rtl8225_rf_close(struct net_device *dev);
-void rtl8225_rf_sleep(struct net_device *dev);
-void rtl8225_rf_wakeup(struct net_device *dev);
 void rtl8180_set_mode(struct net_device *dev,int mode);
 void rtl8180_set_mode(struct net_device *dev,int mode);
 bool SetZebraRFPowerState8185(struct net_device *dev,RT_RF_POWER_STATE  eRFPowerState);

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 11/18] Staging: rtl8187se: cleanup r8180_rtl8225.c
  2009-06-28 14:18 [PATCH 01/18] Staging: rtl8187se: remove ENABLE_DOT11D ifdefs Bartlomiej Zolnierkiewicz
                   ` (8 preceding siblings ...)
  2009-06-28 14:19 ` [PATCH 10/18] Staging: rtl8187se: remove unused rtl8225_rf_* functions Bartlomiej Zolnierkiewicz
@ 2009-06-28 14:19 ` Bartlomiej Zolnierkiewicz
  2009-06-28 14:19 ` [PATCH 12/18] Staging: rtl8187se: merge r8180_rtl8225.c with r8180_rtl8225z2.c Bartlomiej Zolnierkiewicz
                   ` (6 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-06-28 14:19 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Bartlomiej Zolnierkiewicz, linux-kernel

From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] Staging: rtl8187se: cleanup r8180_rtl8225.c

* remove empty rtl8225_host_usb_init()
* remove commented out code
* remove useless comments
* beautify code

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/staging/rtl8187se/r8180_rtl8225.c   |  251 +++++++++++-----------------
 drivers/staging/rtl8187se/r8180_rtl8225.h   |    1 
 drivers/staging/rtl8187se/r8180_rtl8225z2.c |    5 
 3 files changed, 103 insertions(+), 154 deletions(-)

Index: b/drivers/staging/rtl8187se/r8180_rtl8225.c
===================================================================
--- a/drivers/staging/rtl8187se/r8180_rtl8225.c
+++ b/drivers/staging/rtl8187se/r8180_rtl8225.c
@@ -16,35 +16,23 @@
 #include "r8180_rtl8225.h"
 
 
-u8 rtl8225_gain[]={
-	0x23,0x88,0x7c,0xa5,// -82dbm
-	0x23,0x88,0x7c,0xb5,// -82dbm
-	0x23,0x88,0x7c,0xc5,// -82dbm
-	0x33,0x80,0x79,0xc5,// -78dbm
-	0x43,0x78,0x76,0xc5,// -74dbm
-	0x53,0x60,0x73,0xc5,// -70dbm
-	0x63,0x58,0x70,0xc5,// -66dbm
+u8 rtl8225_gain[] = {
+	0x23, 0x88, 0x7c, 0xa5,	/* -82dBm */
+	0x23, 0x88, 0x7c, 0xb5,	/* -82dBm */
+	0x23, 0x88, 0x7c, 0xc5,	/* -82dBm */
+	0x33, 0x80, 0x79, 0xc5,	/* -78dBm */
+	0x43, 0x78, 0x76, 0xc5,	/* -74dBm */
+	0x53, 0x60, 0x73, 0xc5,	/* -70dBm */
+	0x63, 0x58, 0x70, 0xc5,	/* -66dBm */
 };
 
-u32 rtl8225_chan[] ={
-              0,
-		0x0080, //ch1
-		0x0100, //ch2
-		0x0180, //ch3
-		0x0200, //ch4
-		0x0280,
-		0x0300,
-		0x0380,
-		0x0400,
-		0x0480,
-		0x0500,
-		0x0580,
-		0x0600,
-		0x0680,
-		0x074A, //ch14
+u32 rtl8225_chan[] = {
+	0,
+	0x0080, 0x0100, 0x0180, 0x0200, 0x0280, 0x0300, 0x0380,
+	0x0400, 0x0480, 0x0500, 0x0580, 0x0600, 0x0680, 0x074A,
 };
 
-u16 rtl8225bcd_rxgain[]={
+u16 rtl8225bcd_rxgain[] = {
 	0x0400, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0408, 0x0409,
 	0x040a, 0x040b, 0x0502, 0x0503, 0x0504, 0x0505, 0x0540, 0x0541,
 	0x0542, 0x0543, 0x0544, 0x0545, 0x0580, 0x0581, 0x0582, 0x0583,
@@ -60,48 +48,51 @@ u16 rtl8225bcd_rxgain[]={
 
 };
 
-u8 rtl8225_agc[]={
-	0x9e,0x9e,0x9e,0x9e,0x9e,0x9e,0x9e,0x9e,0x9d,0x9c,0x9b,0x9a,0x99,0x98,0x97,0x96,
-	0x95,0x94,0x93,0x92,0x91,0x90,0x8f,0x8e,0x8d,0x8c,0x8b,0x8a,0x89,0x88,0x87,0x86,
-	0x85,0x84,0x83,0x82,0x81,0x80,0x3f,0x3e,0x3d,0x3c,0x3b,0x3a,0x39,0x38,0x37,0x36,
-	0x35,0x34,0x33,0x32,0x31,0x30,0x2f,0x2e,0x2d,0x2c,0x2b,0x2a,0x29,0x28,0x27,0x26,
-	0x25,0x24,0x23,0x22,0x21,0x20,0x1f,0x1e,0x1d,0x1c,0x1b,0x1a,0x19,0x18,0x17,0x16,
-	0x15,0x14,0x13,0x12,0x11,0x10,0x0f,0x0e,0x0d,0x0c,0x0b,0x0a,0x09,0x08,0x07,0x06,
-	0x05,0x04,0x03,0x02,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
-	0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
+u8 rtl8225_agc[] = {
+	0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e,
+	0x9d, 0x9c, 0x9b, 0x9a, 0x99, 0x98, 0x97, 0x96,
+	0x95, 0x94, 0x93, 0x92, 0x91, 0x90, 0x8f, 0x8e,
+	0x8d, 0x8c, 0x8b, 0x8a, 0x89, 0x88, 0x87, 0x86,
+	0x85, 0x84, 0x83, 0x82, 0x81, 0x80, 0x3f, 0x3e,
+	0x3d, 0x3c, 0x3b, 0x3a, 0x39, 0x38, 0x37, 0x36,
+	0x35, 0x34, 0x33, 0x32, 0x31, 0x30, 0x2f, 0x2e,
+	0x2d, 0x2c, 0x2b, 0x2a, 0x29, 0x28, 0x27, 0x26,
+	0x25, 0x24, 0x23, 0x22, 0x21, 0x20, 0x1f, 0x1e,
+	0x1d, 0x1c, 0x1b, 0x1a, 0x19, 0x18, 0x17, 0x16,
+	0x15, 0x14, 0x13, 0x12, 0x11, 0x10, 0x0f, 0x0e,
+	0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08, 0x07, 0x06,
+	0x05, 0x04, 0x03, 0x02, 0x01, 0x01, 0x01, 0x01,
+	0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+	0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+	0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
 };
 
-
-u8 rtl8225_tx_gain_cck_ofdm[]={
-	0x02,0x06,0x0e,0x1e,0x3e,0x7e
+u8 rtl8225_tx_gain_cck_ofdm[] = {
+	0x02, 0x06, 0x0e, 0x1e, 0x3e, 0x7e
 };
 
-
-u8 rtl8225_tx_power_ofdm[]={
-	0x80,0x90,0xa2,0xb5,0xcb,0xe4
+u8 rtl8225_tx_power_ofdm[] = {
+	0x80, 0x90, 0xa2, 0xb5, 0xcb, 0xe4
 };
 
-
-u8 rtl8225_tx_power_cck_ch14[]={
-	0x18,0x17,0x15,0x0c,0x00,0x00,0x00,0x00,
-	0x1b,0x1a,0x17,0x0e,0x00,0x00,0x00,0x00,
-	0x1f,0x1e,0x1a,0x0f,0x00,0x00,0x00,0x00,
-	0x22,0x21,0x1d,0x11,0x00,0x00,0x00,0x00,
-	0x26,0x25,0x21,0x13,0x00,0x00,0x00,0x00,
-	0x2b,0x2a,0x25,0x15,0x00,0x00,0x00,0x00
+u8 rtl8225_tx_power_cck_ch14[] = {
+	0x18, 0x17, 0x15, 0x0c, 0x00, 0x00, 0x00, 0x00,
+	0x1b, 0x1a, 0x17, 0x0e, 0x00, 0x00, 0x00, 0x00,
+	0x1f, 0x1e, 0x1a, 0x0f, 0x00, 0x00, 0x00, 0x00,
+	0x22, 0x21, 0x1d, 0x11, 0x00, 0x00, 0x00, 0x00,
+	0x26, 0x25, 0x21, 0x13, 0x00, 0x00, 0x00, 0x00,
+	0x2b, 0x2a, 0x25, 0x15, 0x00, 0x00, 0x00, 0x00
 };
 
-
-u8 rtl8225_tx_power_cck[]={
-	0x18,0x17,0x15,0x11,0x0c,0x08,0x04,0x02,
-	0x1b,0x1a,0x17,0x13,0x0e,0x09,0x04,0x02,
-	0x1f,0x1e,0x1a,0x15,0x10,0x0a,0x05,0x02,
-	0x22,0x21,0x1d,0x18,0x11,0x0b,0x06,0x02,
-	0x26,0x25,0x21,0x1b,0x14,0x0d,0x06,0x03,
-	0x2b,0x2a,0x25,0x1e,0x16,0x0e,0x07,0x03
+u8 rtl8225_tx_power_cck[] = {
+	0x18, 0x17, 0x15, 0x11, 0x0c, 0x08, 0x04, 0x02,
+	0x1b, 0x1a, 0x17, 0x13, 0x0e, 0x09, 0x04, 0x02,
+	0x1f, 0x1e, 0x1a, 0x15, 0x10, 0x0a, 0x05, 0x02,
+	0x22, 0x21, 0x1d, 0x18, 0x11, 0x0b, 0x06, 0x02,
+	0x26, 0x25, 0x21, 0x1b, 0x14, 0x0d, 0x06, 0x03,
+	0x2b, 0x2a, 0x25, 0x1e, 0x16, 0x0e, 0x07, 0x03
 };
 
-
 void rtl8225_set_gain(struct net_device *dev, short gain)
 {
 	write_phy_ofdm(dev, 0x0d, rtl8225_gain[gain * 4]);
@@ -113,15 +104,15 @@ void rtl8225_set_gain(struct net_device 
 void write_rtl8225(struct net_device *dev, u8 adr, u16 data)
 {
 	int i;
-	u16 out,select;
+	u16 out, select;
 	u8 bit;
 	u32 bangdata = (data << 4) | (adr & 0xf);
 	struct r8180_priv *priv = ieee80211_priv(dev);
 
 	out = read_nic_word(dev, RFPinsOutput) & 0xfff3;
 
-	write_nic_word(dev,RFPinsEnable,
-		(read_nic_word(dev,RFPinsEnable) | 0x7));
+	write_nic_word(dev, RFPinsEnable,
+		(read_nic_word(dev, RFPinsEnable) | 0x7));
 
 	select = read_nic_word(dev, RFPinsSelect);
 
@@ -131,7 +122,7 @@ void write_rtl8225(struct net_device *de
 	force_pci_posting(dev);
 	udelay(10);
 
-	write_nic_word(dev, RFPinsOutput, out | BB_HOST_BANG_EN );//| 0x1fff);
+	write_nic_word(dev, RFPinsOutput, out | BB_HOST_BANG_EN);
 
 	force_pci_posting(dev);
 	udelay(2);
@@ -141,10 +132,8 @@ void write_rtl8225(struct net_device *de
 	force_pci_posting(dev);
 	udelay(10);
 
-
-	for(i=15; i>=0;i--){
-
-		bit = (bangdata & (1<<i)) >> i;
+	for (i = 15; i >= 0; i--) {
+		bit = (bangdata & (1 << i)) >> i;
 
 		write_nic_word(dev, RFPinsOutput, bit | out);
 
@@ -152,7 +141,7 @@ void write_rtl8225(struct net_device *de
 		write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
 
 		i--;
-		bit = (bangdata & (1<<i)) >> i;
+		bit = (bangdata & (1 << i)) >> i;
 
 		write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
 		write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
@@ -172,7 +161,7 @@ void write_rtl8225(struct net_device *de
 	write_nic_word(dev, RFPinsSelect, select |
 		((priv->card_type == USB) ? 0 : SW_CONTROL_GPIO));
 
-	if(priv->card_type == USB)
+	if (priv->card_type == USB)
 		mdelay(2);
 	else
 		rtl8185_rf_pins_enable(dev);
@@ -181,7 +170,6 @@ void write_rtl8225(struct net_device *de
 void rtl8225_SetTXPowerLevel(struct net_device *dev, short ch)
 {
 	struct r8180_priv *priv = ieee80211_priv(dev);
-
 	int GainIdx;
 	int GainSetting;
 	int i;
@@ -193,36 +181,31 @@ void rtl8225_SetTXPowerLevel(struct net_
 	u8 cck_power_level = 0xff & priv->chtxpwr[ch];
 	u8 ofdm_power_level = 0xff & priv->chtxpwr_ofdm[ch];
 
-	if(priv->card_type == USB){
+	if (priv->card_type == USB) {
 		max_cck_power_level = 11;
-		max_ofdm_power_level = 25; //  12 -> 25
+		max_ofdm_power_level = 25;
 		min_ofdm_power_level = 10;
-	}else{
+	} else {
 		max_cck_power_level = 35;
 		max_ofdm_power_level = 35;
 		min_ofdm_power_level = 0;
 	}
-	/* CCK power setting */
-	if(cck_power_level > max_cck_power_level)
+
+	if (cck_power_level > max_cck_power_level)
 		cck_power_level = max_cck_power_level;
-	GainIdx=cck_power_level % 6;
-	GainSetting=cck_power_level / 6;
 
-	if(ch == 14)
+	GainIdx = cck_power_level % 6;
+	GainSetting = cck_power_level / 6;
+
+	if (ch == 14)
 		cck_power_table = rtl8225_tx_power_cck_ch14;
 	else
 		cck_power_table = rtl8225_tx_power_cck;
 
-//	if(priv->card_8185 == 1 && priv->card_8185_Bversion ){
-		/*Ver B*/
-//		write_nic_byte(dev, TX_GAIN_CCK, rtl8225_tx_gain_cck_ofdm[GainSetting]);
-//	}else{
-		/*Ver C - D */
-	write_nic_byte(dev, TX_GAIN_CCK, rtl8225_tx_gain_cck_ofdm[GainSetting]>>1);
-//	}
-
-	for(i=0;i<8;i++){
+	write_nic_byte(dev, TX_GAIN_CCK,
+		       rtl8225_tx_gain_cck_ofdm[GainSetting] >> 1);
 
+	for (i = 0; i < 8; i++) {
 		power = cck_power_table[GainIdx * 8 + i];
 		write_phy_cck(dev, 0x44 + i, power);
 	}
@@ -231,48 +214,33 @@ void rtl8225_SetTXPowerLevel(struct net_
 	force_pci_posting(dev);
 	mdelay(1);
 
-	/* OFDM power setting */
-//  Old:
-//	if(ofdm_power_level > max_ofdm_power_level)
-//		ofdm_power_level = 35;
-//	ofdm_power_level += min_ofdm_power_level;
-//  Latest:
-	if(ofdm_power_level > (max_ofdm_power_level - min_ofdm_power_level))
+	if (ofdm_power_level > (max_ofdm_power_level - min_ofdm_power_level))
 		ofdm_power_level = max_ofdm_power_level;
 	else
 		ofdm_power_level += min_ofdm_power_level;
-	if(ofdm_power_level > 35)
+
+	if (ofdm_power_level > 35)
 		ofdm_power_level = 35;
-//
 
-	GainIdx=ofdm_power_level % 6;
-	GainSetting=ofdm_power_level / 6;
-#if 1
-//	if(priv->card_type == USB){
-		rtl8185_set_anaparam2(dev,RTL8225_ANAPARAM2_ON);
-
-		write_phy_ofdm(dev,2,0x42);
-		write_phy_ofdm(dev,6,0);
-		write_phy_ofdm(dev,8,0);
-//	}
-#endif
-//	if(priv->card_8185 == 1 && priv->card_8185_Bversion){
-//		/*Ver B*/
-//		write_nic_byte(dev, TX_GAIN_OFDM, rtl8225_tx_gain_cck_ofdm[GainSetting]);
-//	}else{
-		/*Ver C - D */
-	write_nic_byte(dev, TX_GAIN_OFDM, rtl8225_tx_gain_cck_ofdm[GainSetting]>>1);
-//	}
+	GainIdx = ofdm_power_level % 6;
+	GainSetting = ofdm_power_level / 6;
+
+	rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
+
+	write_phy_ofdm(dev, 2, 0x42);
+	write_phy_ofdm(dev, 6, 0x00);
+	write_phy_ofdm(dev, 8, 0x00);
 
+	write_nic_byte(dev, TX_GAIN_OFDM,
+		       rtl8225_tx_gain_cck_ofdm[GainSetting] >> 1);
 
 	power = rtl8225_tx_power_ofdm[GainIdx];
 
-	write_phy_ofdm(dev, 0x5, power);
-	write_phy_ofdm(dev, 0x7, power);
+	write_phy_ofdm(dev, 5, power);
+	write_phy_ofdm(dev, 7, power);
 
 	force_pci_posting(dev);
 	mdelay(1);
-	//write_nic_byte(dev, TX_AGC_CONTROL,4);
 }
 
 void rtl8225_rf_set_chan(struct net_device *dev, short ch)
@@ -289,34 +257,27 @@ void rtl8225_rf_set_chan(struct net_devi
 	force_pci_posting(dev);
 	mdelay(10);
 
-	// A mode sifs 0x44, difs 34-14, slot 9, eifs 23, cwm 3, cwM 7, ctstoself 0x10
-	if(gset){
-		write_nic_byte(dev,SIFS,0x22);// SIFS: 0x22
-		write_nic_byte(dev,DIFS,0x14); //DIFS: 20
-		//write_nic_byte(dev,DIFS,20); //DIFS: 20
-	}else{
-		write_nic_byte(dev,SIFS,0x44);// SIFS: 0x22
-		write_nic_byte(dev,DIFS,50 - 14); //DIFS: 36
+	if (gset) {
+		write_nic_byte(dev, SIFS, 0x22);
+		write_nic_byte(dev, DIFS, 0x14);
+	} else {
+		write_nic_byte(dev, SIFS, 0x44);
+		write_nic_byte(dev, DIFS, 0x24);
 	}
-	if(priv->ieee80211->state == IEEE80211_LINKED &&
-		ieee80211_is_shortslot(priv->ieee80211->current_network))
-		write_nic_byte(dev,SLOT,0x9); //SLOT: 9
 
+	if (priv->ieee80211->state == IEEE80211_LINKED &&
+	    ieee80211_is_shortslot(priv->ieee80211->current_network))
+		write_nic_byte(dev, SLOT, 0x9);
 	else
-		write_nic_byte(dev,SLOT,0x14); //SLOT: 20 (0x14)
+		write_nic_byte(dev, SLOT, 0x14);
 
-
-	if(gset){
-		write_nic_byte(dev,EIFS,81);//91 - 20); // EIFS: 91 (0x5B)
-		write_nic_byte(dev,CW_VAL,0x73); //CW VALUE: 0x37
-		//DMESG("using G net params");
-	}else{
-		write_nic_byte(dev,EIFS,81); // EIFS: 91 (0x5B)
-		write_nic_byte(dev,CW_VAL,0xa5); //CW VALUE: 0x37
-		//DMESG("using B net params");
+	if (gset) {
+		write_nic_byte(dev, EIFS, 81);
+		write_nic_byte(dev, CW_VAL, 0x73);
+	} else {
+		write_nic_byte(dev, EIFS, 81);
+		write_nic_byte(dev, CW_VAL, 0xa5);
 	}
-
-
 }
 
 void rtl8225_host_pci_init(struct net_device *dev)
@@ -325,21 +286,13 @@ void rtl8225_host_pci_init(struct net_de
 
 	rtl8185_rf_pins_enable(dev);
 
-	//if(priv->card_8185 == 2 && priv->enable_gpio0 ) /* version D */
-	//write_nic_word(dev, RFPinsSelect, 0x88);
-	//else
-	write_nic_word(dev, RFPinsSelect, 0x88 | SW_CONTROL_GPIO); /* 0x488 | SW_CONTROL_GPIO */
+	write_nic_word(dev, RFPinsSelect, 0x88 | SW_CONTROL_GPIO);
 
 	write_nic_byte(dev, GP_ENABLE, 0);
 
 	force_pci_posting(dev);
 	mdelay(200);
 
-	write_nic_word(dev, GP_ENABLE, 0xff & (~(1<<6))); /* bit 6 is for RF on/off detection */
-
-
-}
-
-void rtl8225_host_usb_init(struct net_device *dev)
-{
+	/* bit 6 is for RF on/off detection */
+	write_nic_word(dev, GP_ENABLE, 0xff & (~(1 << 6)));
 }
Index: b/drivers/staging/rtl8187se/r8180_rtl8225.h
===================================================================
--- a/drivers/staging/rtl8187se/r8180_rtl8225.h
+++ b/drivers/staging/rtl8187se/r8180_rtl8225.h
@@ -24,7 +24,6 @@ void rtl8225z2_rf_set_chan(struct net_de
 void rtl8225z2_rf_close(struct net_device *dev);
 
 void rtl8225_host_pci_init(struct net_device *dev);
-void rtl8225_host_usb_init(struct net_device *dev);
 
 void write_rtl8225(struct net_device *dev, u8 adr, u16 data);
 void RF_WriteReg(struct net_device *dev, u8 offset, u32	data);
Index: b/drivers/staging/rtl8187se/r8180_rtl8225z2.c
===================================================================
--- a/drivers/staging/rtl8187se/r8180_rtl8225z2.c
+++ b/drivers/staging/rtl8187se/r8180_rtl8225z2.c
@@ -472,10 +472,7 @@ void rtl8225z2_rf_init(struct net_device
 
 //	rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
 
-
-	if(priv->card_type == USB)
-		rtl8225_host_usb_init(dev);
-	else
+	if (priv->card_type != USB)
 		rtl8225_host_pci_init(dev);
 
 	write_nic_dword(dev, RF_TIMING, 0x000a8008);

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 12/18] Staging: rtl8187se: merge r8180_rtl8225.c with r8180_rtl8225z2.c
  2009-06-28 14:18 [PATCH 01/18] Staging: rtl8187se: remove ENABLE_DOT11D ifdefs Bartlomiej Zolnierkiewicz
                   ` (9 preceding siblings ...)
  2009-06-28 14:19 ` [PATCH 11/18] Staging: rtl8187se: cleanup r8180_rtl8225.c Bartlomiej Zolnierkiewicz
@ 2009-06-28 14:19 ` Bartlomiej Zolnierkiewicz
  2009-06-28 14:20 ` [PATCH 13/18] Staging: rtl8187se: cleanup r8180_pm.c Bartlomiej Zolnierkiewicz
                   ` (5 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-06-28 14:19 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Bartlomiej Zolnierkiewicz, linux-kernel

From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] Staging: rtl8187se: merge r8180_rtl8225.c with r8180_rtl8225z2.c

* merge r8180_rtl8225.c with r8180_rtl8225z2.c
* make functions static
* make tables static const
* remove unused rtl8225_set_gain()

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/staging/rtl8187se/Makefile          |    1 
 drivers/staging/rtl8187se/r8180_rtl8225.c   |  298 ----------------------------
 drivers/staging/rtl8187se/r8180_rtl8225.h   |    5 
 drivers/staging/rtl8187se/r8180_rtl8225z2.c |  275 +++++++++++++++++++++++++
 4 files changed, 272 insertions(+), 307 deletions(-)

Index: b/drivers/staging/rtl8187se/Makefile
===================================================================
--- a/drivers/staging/rtl8187se/Makefile
+++ b/drivers/staging/rtl8187se/Makefile
@@ -22,7 +22,6 @@ rtl8187se-objs :=			\
 		r8180_core.o		\
 		r8180_93cx6.o		\
 		r8180_wx.o		\
-		r8180_rtl8225.o		\
 		r8180_rtl8225z2.o	\
 		r8185b_init.o		\
 		r8180_dm.o		\
Index: b/drivers/staging/rtl8187se/r8180_rtl8225.c
===================================================================
--- a/drivers/staging/rtl8187se/r8180_rtl8225.c
+++ /dev/null
@@ -1,298 +0,0 @@
-/*
-  This is part of the rtl8180-sa2400 driver
-  released under the GPL (See file COPYING for details).
-  Copyright (c) 2005 Andrea Merello <andreamrl@tiscali.it>
-
-  This files contains programming code for the rtl8225
-  radio frontend.
-
-  *Many* thanks to Realtek Corp. for their great support!
-
-*/
-
-
-
-#include "r8180_hw.h"
-#include "r8180_rtl8225.h"
-
-
-u8 rtl8225_gain[] = {
-	0x23, 0x88, 0x7c, 0xa5,	/* -82dBm */
-	0x23, 0x88, 0x7c, 0xb5,	/* -82dBm */
-	0x23, 0x88, 0x7c, 0xc5,	/* -82dBm */
-	0x33, 0x80, 0x79, 0xc5,	/* -78dBm */
-	0x43, 0x78, 0x76, 0xc5,	/* -74dBm */
-	0x53, 0x60, 0x73, 0xc5,	/* -70dBm */
-	0x63, 0x58, 0x70, 0xc5,	/* -66dBm */
-};
-
-u32 rtl8225_chan[] = {
-	0,
-	0x0080, 0x0100, 0x0180, 0x0200, 0x0280, 0x0300, 0x0380,
-	0x0400, 0x0480, 0x0500, 0x0580, 0x0600, 0x0680, 0x074A,
-};
-
-u16 rtl8225bcd_rxgain[] = {
-	0x0400, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0408, 0x0409,
-	0x040a, 0x040b, 0x0502, 0x0503, 0x0504, 0x0505, 0x0540, 0x0541,
-	0x0542, 0x0543, 0x0544, 0x0545, 0x0580, 0x0581, 0x0582, 0x0583,
-	0x0584, 0x0585, 0x0588, 0x0589, 0x058a, 0x058b, 0x0643, 0x0644,
-	0x0645, 0x0680, 0x0681, 0x0682, 0x0683, 0x0684, 0x0685, 0x0688,
-	0x0689, 0x068a, 0x068b, 0x068c, 0x0742, 0x0743, 0x0744, 0x0745,
-	0x0780, 0x0781, 0x0782, 0x0783, 0x0784, 0x0785, 0x0788, 0x0789,
-	0x078a, 0x078b, 0x078c, 0x078d, 0x0790, 0x0791, 0x0792, 0x0793,
-	0x0794, 0x0795, 0x0798, 0x0799, 0x079a, 0x079b, 0x079c, 0x079d,
-	0x07a0, 0x07a1, 0x07a2, 0x07a3, 0x07a4, 0x07a5, 0x07a8, 0x07a9,
-	0x07aa, 0x07ab, 0x07ac, 0x07ad, 0x07b0, 0x07b1, 0x07b2, 0x07b3,
-	0x07b4, 0x07b5, 0x07b8, 0x07b9, 0x07ba, 0x07bb, 0x07bb
-
-};
-
-u8 rtl8225_agc[] = {
-	0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e,
-	0x9d, 0x9c, 0x9b, 0x9a, 0x99, 0x98, 0x97, 0x96,
-	0x95, 0x94, 0x93, 0x92, 0x91, 0x90, 0x8f, 0x8e,
-	0x8d, 0x8c, 0x8b, 0x8a, 0x89, 0x88, 0x87, 0x86,
-	0x85, 0x84, 0x83, 0x82, 0x81, 0x80, 0x3f, 0x3e,
-	0x3d, 0x3c, 0x3b, 0x3a, 0x39, 0x38, 0x37, 0x36,
-	0x35, 0x34, 0x33, 0x32, 0x31, 0x30, 0x2f, 0x2e,
-	0x2d, 0x2c, 0x2b, 0x2a, 0x29, 0x28, 0x27, 0x26,
-	0x25, 0x24, 0x23, 0x22, 0x21, 0x20, 0x1f, 0x1e,
-	0x1d, 0x1c, 0x1b, 0x1a, 0x19, 0x18, 0x17, 0x16,
-	0x15, 0x14, 0x13, 0x12, 0x11, 0x10, 0x0f, 0x0e,
-	0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08, 0x07, 0x06,
-	0x05, 0x04, 0x03, 0x02, 0x01, 0x01, 0x01, 0x01,
-	0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-	0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-	0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-};
-
-u8 rtl8225_tx_gain_cck_ofdm[] = {
-	0x02, 0x06, 0x0e, 0x1e, 0x3e, 0x7e
-};
-
-u8 rtl8225_tx_power_ofdm[] = {
-	0x80, 0x90, 0xa2, 0xb5, 0xcb, 0xe4
-};
-
-u8 rtl8225_tx_power_cck_ch14[] = {
-	0x18, 0x17, 0x15, 0x0c, 0x00, 0x00, 0x00, 0x00,
-	0x1b, 0x1a, 0x17, 0x0e, 0x00, 0x00, 0x00, 0x00,
-	0x1f, 0x1e, 0x1a, 0x0f, 0x00, 0x00, 0x00, 0x00,
-	0x22, 0x21, 0x1d, 0x11, 0x00, 0x00, 0x00, 0x00,
-	0x26, 0x25, 0x21, 0x13, 0x00, 0x00, 0x00, 0x00,
-	0x2b, 0x2a, 0x25, 0x15, 0x00, 0x00, 0x00, 0x00
-};
-
-u8 rtl8225_tx_power_cck[] = {
-	0x18, 0x17, 0x15, 0x11, 0x0c, 0x08, 0x04, 0x02,
-	0x1b, 0x1a, 0x17, 0x13, 0x0e, 0x09, 0x04, 0x02,
-	0x1f, 0x1e, 0x1a, 0x15, 0x10, 0x0a, 0x05, 0x02,
-	0x22, 0x21, 0x1d, 0x18, 0x11, 0x0b, 0x06, 0x02,
-	0x26, 0x25, 0x21, 0x1b, 0x14, 0x0d, 0x06, 0x03,
-	0x2b, 0x2a, 0x25, 0x1e, 0x16, 0x0e, 0x07, 0x03
-};
-
-void rtl8225_set_gain(struct net_device *dev, short gain)
-{
-	write_phy_ofdm(dev, 0x0d, rtl8225_gain[gain * 4]);
-	write_phy_ofdm(dev, 0x23, rtl8225_gain[gain * 4 + 1]);
-	write_phy_ofdm(dev, 0x1b, rtl8225_gain[gain * 4 + 2]);
-	write_phy_ofdm(dev, 0x1d, rtl8225_gain[gain * 4 + 3]);
-}
-
-void write_rtl8225(struct net_device *dev, u8 adr, u16 data)
-{
-	int i;
-	u16 out, select;
-	u8 bit;
-	u32 bangdata = (data << 4) | (adr & 0xf);
-	struct r8180_priv *priv = ieee80211_priv(dev);
-
-	out = read_nic_word(dev, RFPinsOutput) & 0xfff3;
-
-	write_nic_word(dev, RFPinsEnable,
-		(read_nic_word(dev, RFPinsEnable) | 0x7));
-
-	select = read_nic_word(dev, RFPinsSelect);
-
-	write_nic_word(dev, RFPinsSelect, select | 0x7 |
-		((priv->card_type == USB) ? 0 : SW_CONTROL_GPIO));
-
-	force_pci_posting(dev);
-	udelay(10);
-
-	write_nic_word(dev, RFPinsOutput, out | BB_HOST_BANG_EN);
-
-	force_pci_posting(dev);
-	udelay(2);
-
-	write_nic_word(dev, RFPinsOutput, out);
-
-	force_pci_posting(dev);
-	udelay(10);
-
-	for (i = 15; i >= 0; i--) {
-		bit = (bangdata & (1 << i)) >> i;
-
-		write_nic_word(dev, RFPinsOutput, bit | out);
-
-		write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
-		write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
-
-		i--;
-		bit = (bangdata & (1 << i)) >> i;
-
-		write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
-		write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
-
-		write_nic_word(dev, RFPinsOutput, bit | out);
-
-	}
-
-	write_nic_word(dev, RFPinsOutput, out | BB_HOST_BANG_EN);
-
-	force_pci_posting(dev);
-	udelay(10);
-
-	write_nic_word(dev, RFPinsOutput, out |
-		((priv->card_type == USB) ? 4 : BB_HOST_BANG_EN));
-
-	write_nic_word(dev, RFPinsSelect, select |
-		((priv->card_type == USB) ? 0 : SW_CONTROL_GPIO));
-
-	if (priv->card_type == USB)
-		mdelay(2);
-	else
-		rtl8185_rf_pins_enable(dev);
-}
-
-void rtl8225_SetTXPowerLevel(struct net_device *dev, short ch)
-{
-	struct r8180_priv *priv = ieee80211_priv(dev);
-	int GainIdx;
-	int GainSetting;
-	int i;
-	u8 power;
-	u8 *cck_power_table;
-	u8 max_cck_power_level;
-	u8 max_ofdm_power_level;
-	u8 min_ofdm_power_level;
-	u8 cck_power_level = 0xff & priv->chtxpwr[ch];
-	u8 ofdm_power_level = 0xff & priv->chtxpwr_ofdm[ch];
-
-	if (priv->card_type == USB) {
-		max_cck_power_level = 11;
-		max_ofdm_power_level = 25;
-		min_ofdm_power_level = 10;
-	} else {
-		max_cck_power_level = 35;
-		max_ofdm_power_level = 35;
-		min_ofdm_power_level = 0;
-	}
-
-	if (cck_power_level > max_cck_power_level)
-		cck_power_level = max_cck_power_level;
-
-	GainIdx = cck_power_level % 6;
-	GainSetting = cck_power_level / 6;
-
-	if (ch == 14)
-		cck_power_table = rtl8225_tx_power_cck_ch14;
-	else
-		cck_power_table = rtl8225_tx_power_cck;
-
-	write_nic_byte(dev, TX_GAIN_CCK,
-		       rtl8225_tx_gain_cck_ofdm[GainSetting] >> 1);
-
-	for (i = 0; i < 8; i++) {
-		power = cck_power_table[GainIdx * 8 + i];
-		write_phy_cck(dev, 0x44 + i, power);
-	}
-
-	/* FIXME Is this delay really needeed ? */
-	force_pci_posting(dev);
-	mdelay(1);
-
-	if (ofdm_power_level > (max_ofdm_power_level - min_ofdm_power_level))
-		ofdm_power_level = max_ofdm_power_level;
-	else
-		ofdm_power_level += min_ofdm_power_level;
-
-	if (ofdm_power_level > 35)
-		ofdm_power_level = 35;
-
-	GainIdx = ofdm_power_level % 6;
-	GainSetting = ofdm_power_level / 6;
-
-	rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
-
-	write_phy_ofdm(dev, 2, 0x42);
-	write_phy_ofdm(dev, 6, 0x00);
-	write_phy_ofdm(dev, 8, 0x00);
-
-	write_nic_byte(dev, TX_GAIN_OFDM,
-		       rtl8225_tx_gain_cck_ofdm[GainSetting] >> 1);
-
-	power = rtl8225_tx_power_ofdm[GainIdx];
-
-	write_phy_ofdm(dev, 5, power);
-	write_phy_ofdm(dev, 7, power);
-
-	force_pci_posting(dev);
-	mdelay(1);
-}
-
-void rtl8225_rf_set_chan(struct net_device *dev, short ch)
-{
-	struct r8180_priv *priv = ieee80211_priv(dev);
-	short gset = (priv->ieee80211->state == IEEE80211_LINKED &&
-		ieee80211_is_54g(priv->ieee80211->current_network)) ||
-		priv->ieee80211->iw_mode == IW_MODE_MONITOR;
-
-	rtl8225_SetTXPowerLevel(dev, ch);
-
-	write_rtl8225(dev, 0x7, rtl8225_chan[ch]);
-
-	force_pci_posting(dev);
-	mdelay(10);
-
-	if (gset) {
-		write_nic_byte(dev, SIFS, 0x22);
-		write_nic_byte(dev, DIFS, 0x14);
-	} else {
-		write_nic_byte(dev, SIFS, 0x44);
-		write_nic_byte(dev, DIFS, 0x24);
-	}
-
-	if (priv->ieee80211->state == IEEE80211_LINKED &&
-	    ieee80211_is_shortslot(priv->ieee80211->current_network))
-		write_nic_byte(dev, SLOT, 0x9);
-	else
-		write_nic_byte(dev, SLOT, 0x14);
-
-	if (gset) {
-		write_nic_byte(dev, EIFS, 81);
-		write_nic_byte(dev, CW_VAL, 0x73);
-	} else {
-		write_nic_byte(dev, EIFS, 81);
-		write_nic_byte(dev, CW_VAL, 0xa5);
-	}
-}
-
-void rtl8225_host_pci_init(struct net_device *dev)
-{
-	write_nic_word(dev, RFPinsOutput, 0x480);
-
-	rtl8185_rf_pins_enable(dev);
-
-	write_nic_word(dev, RFPinsSelect, 0x88 | SW_CONTROL_GPIO);
-
-	write_nic_byte(dev, GP_ENABLE, 0);
-
-	force_pci_posting(dev);
-	mdelay(200);
-
-	/* bit 6 is for RF on/off detection */
-	write_nic_word(dev, GP_ENABLE, 0xff & (~(1 << 6)));
-}
Index: b/drivers/staging/rtl8187se/r8180_rtl8225.h
===================================================================
--- a/drivers/staging/rtl8187se/r8180_rtl8225.h
+++ b/drivers/staging/rtl8187se/r8180_rtl8225.h
@@ -23,12 +23,9 @@ void rtl8225z2_rf_init(struct net_device
 void rtl8225z2_rf_set_chan(struct net_device *dev,short ch);
 void rtl8225z2_rf_close(struct net_device *dev);
 
-void rtl8225_host_pci_init(struct net_device *dev);
-
-void write_rtl8225(struct net_device *dev, u8 adr, u16 data);
 void RF_WriteReg(struct net_device *dev, u8 offset, u32	data);
 u32 RF_ReadReg(struct net_device *dev, u8 offset);
-void rtl8225_rf_set_chan(struct net_device *dev,short ch);
+
 void rtl8180_set_mode(struct net_device *dev,int mode);
 void rtl8180_set_mode(struct net_device *dev,int mode);
 bool SetZebraRFPowerState8185(struct net_device *dev,RT_RF_POWER_STATE  eRFPowerState);
Index: b/drivers/staging/rtl8187se/r8180_rtl8225z2.c
===================================================================
--- a/drivers/staging/rtl8187se/r8180_rtl8225z2.c
+++ b/drivers/staging/rtl8187se/r8180_rtl8225z2.c
@@ -17,9 +17,224 @@
 #include "ieee80211/dot11d.h"
 
 
-extern u8 rtl8225_agc[];
+static void write_rtl8225(struct net_device *dev, u8 adr, u16 data)
+{
+	int i;
+	u16 out, select;
+	u8 bit;
+	u32 bangdata = (data << 4) | (adr & 0xf);
+	struct r8180_priv *priv = ieee80211_priv(dev);
+
+	out = read_nic_word(dev, RFPinsOutput) & 0xfff3;
+
+	write_nic_word(dev, RFPinsEnable,
+		(read_nic_word(dev, RFPinsEnable) | 0x7));
+
+	select = read_nic_word(dev, RFPinsSelect);
+
+	write_nic_word(dev, RFPinsSelect, select | 0x7 |
+		((priv->card_type == USB) ? 0 : SW_CONTROL_GPIO));
+
+	force_pci_posting(dev);
+	udelay(10);
+
+	write_nic_word(dev, RFPinsOutput, out | BB_HOST_BANG_EN);
+
+	force_pci_posting(dev);
+	udelay(2);
+
+	write_nic_word(dev, RFPinsOutput, out);
+
+	force_pci_posting(dev);
+	udelay(10);
+
+	for (i = 15; i >= 0; i--) {
+		bit = (bangdata & (1 << i)) >> i;
+
+		write_nic_word(dev, RFPinsOutput, bit | out);
+
+		write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
+		write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
+
+		i--;
+		bit = (bangdata & (1 << i)) >> i;
+
+		write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
+		write_nic_word(dev, RFPinsOutput, bit | out | BB_HOST_BANG_CLK);
+
+		write_nic_word(dev, RFPinsOutput, bit | out);
+
+	}
+
+	write_nic_word(dev, RFPinsOutput, out | BB_HOST_BANG_EN);
+
+	force_pci_posting(dev);
+	udelay(10);
+
+	write_nic_word(dev, RFPinsOutput, out |
+		((priv->card_type == USB) ? 4 : BB_HOST_BANG_EN));
+
+	write_nic_word(dev, RFPinsSelect, select |
+		((priv->card_type == USB) ? 0 : SW_CONTROL_GPIO));
+
+	if (priv->card_type == USB)
+		mdelay(2);
+	else
+		rtl8185_rf_pins_enable(dev);
+}
+
+static const u16 rtl8225bcd_rxgain[] = {
+	0x0400, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0408, 0x0409,
+	0x040a, 0x040b, 0x0502, 0x0503, 0x0504, 0x0505, 0x0540, 0x0541,
+	0x0542, 0x0543, 0x0544, 0x0545, 0x0580, 0x0581, 0x0582, 0x0583,
+	0x0584, 0x0585, 0x0588, 0x0589, 0x058a, 0x058b, 0x0643, 0x0644,
+	0x0645, 0x0680, 0x0681, 0x0682, 0x0683, 0x0684, 0x0685, 0x0688,
+	0x0689, 0x068a, 0x068b, 0x068c, 0x0742, 0x0743, 0x0744, 0x0745,
+	0x0780, 0x0781, 0x0782, 0x0783, 0x0784, 0x0785, 0x0788, 0x0789,
+	0x078a, 0x078b, 0x078c, 0x078d, 0x0790, 0x0791, 0x0792, 0x0793,
+	0x0794, 0x0795, 0x0798, 0x0799, 0x079a, 0x079b, 0x079c, 0x079d,
+	0x07a0, 0x07a1, 0x07a2, 0x07a3, 0x07a4, 0x07a5, 0x07a8, 0x07a9,
+	0x07aa, 0x07ab, 0x07ac, 0x07ad, 0x07b0, 0x07b1, 0x07b2, 0x07b3,
+	0x07b4, 0x07b5, 0x07b8, 0x07b9, 0x07ba, 0x07bb, 0x07bb
+
+};
+
+static const u8 rtl8225_agc[] = {
+	0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e,
+	0x9d, 0x9c, 0x9b, 0x9a, 0x99, 0x98, 0x97, 0x96,
+	0x95, 0x94, 0x93, 0x92, 0x91, 0x90, 0x8f, 0x8e,
+	0x8d, 0x8c, 0x8b, 0x8a, 0x89, 0x88, 0x87, 0x86,
+	0x85, 0x84, 0x83, 0x82, 0x81, 0x80, 0x3f, 0x3e,
+	0x3d, 0x3c, 0x3b, 0x3a, 0x39, 0x38, 0x37, 0x36,
+	0x35, 0x34, 0x33, 0x32, 0x31, 0x30, 0x2f, 0x2e,
+	0x2d, 0x2c, 0x2b, 0x2a, 0x29, 0x28, 0x27, 0x26,
+	0x25, 0x24, 0x23, 0x22, 0x21, 0x20, 0x1f, 0x1e,
+	0x1d, 0x1c, 0x1b, 0x1a, 0x19, 0x18, 0x17, 0x16,
+	0x15, 0x14, 0x13, 0x12, 0x11, 0x10, 0x0f, 0x0e,
+	0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08, 0x07, 0x06,
+	0x05, 0x04, 0x03, 0x02, 0x01, 0x01, 0x01, 0x01,
+	0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+	0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+	0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+};
+
+static const u8 rtl8225_gain[] = {
+	0x23, 0x88, 0x7c, 0xa5,	/* -82dBm */
+	0x23, 0x88, 0x7c, 0xb5,	/* -82dBm */
+	0x23, 0x88, 0x7c, 0xc5,	/* -82dBm */
+	0x33, 0x80, 0x79, 0xc5,	/* -78dBm */
+	0x43, 0x78, 0x76, 0xc5,	/* -74dBm */
+	0x53, 0x60, 0x73, 0xc5,	/* -70dBm */
+	0x63, 0x58, 0x70, 0xc5,	/* -66dBm */
+};
+
+static const u8 rtl8225_tx_gain_cck_ofdm[] = {
+	0x02, 0x06, 0x0e, 0x1e, 0x3e, 0x7e
+};
+
+static const u8 rtl8225_tx_power_cck[] = {
+	0x18, 0x17, 0x15, 0x11, 0x0c, 0x08, 0x04, 0x02,
+	0x1b, 0x1a, 0x17, 0x13, 0x0e, 0x09, 0x04, 0x02,
+	0x1f, 0x1e, 0x1a, 0x15, 0x10, 0x0a, 0x05, 0x02,
+	0x22, 0x21, 0x1d, 0x18, 0x11, 0x0b, 0x06, 0x02,
+	0x26, 0x25, 0x21, 0x1b, 0x14, 0x0d, 0x06, 0x03,
+	0x2b, 0x2a, 0x25, 0x1e, 0x16, 0x0e, 0x07, 0x03
+};
+
+static const u8 rtl8225_tx_power_cck_ch14[] = {
+	0x18, 0x17, 0x15, 0x0c, 0x00, 0x00, 0x00, 0x00,
+	0x1b, 0x1a, 0x17, 0x0e, 0x00, 0x00, 0x00, 0x00,
+	0x1f, 0x1e, 0x1a, 0x0f, 0x00, 0x00, 0x00, 0x00,
+	0x22, 0x21, 0x1d, 0x11, 0x00, 0x00, 0x00, 0x00,
+	0x26, 0x25, 0x21, 0x13, 0x00, 0x00, 0x00, 0x00,
+	0x2b, 0x2a, 0x25, 0x15, 0x00, 0x00, 0x00, 0x00
+};
+
+static const u8 rtl8225_tx_power_ofdm[] = {
+	0x80, 0x90, 0xa2, 0xb5, 0xcb, 0xe4
+};
+
+static const u32 rtl8225_chan[] = {
+	0,
+	0x0080, 0x0100, 0x0180, 0x0200, 0x0280, 0x0300, 0x0380,
+	0x0400, 0x0480, 0x0500, 0x0580, 0x0600, 0x0680, 0x074A,
+};
+
+static void rtl8225_SetTXPowerLevel(struct net_device *dev, short ch)
+{
+	struct r8180_priv *priv = ieee80211_priv(dev);
+	int GainIdx;
+	int GainSetting;
+	int i;
+	u8 power;
+	const u8 *cck_power_table;
+	u8 max_cck_power_level;
+	u8 max_ofdm_power_level;
+	u8 min_ofdm_power_level;
+	u8 cck_power_level = 0xff & priv->chtxpwr[ch];
+	u8 ofdm_power_level = 0xff & priv->chtxpwr_ofdm[ch];
+
+	if (priv->card_type == USB) {
+		max_cck_power_level = 11;
+		max_ofdm_power_level = 25;
+		min_ofdm_power_level = 10;
+	} else {
+		max_cck_power_level = 35;
+		max_ofdm_power_level = 35;
+		min_ofdm_power_level = 0;
+	}
+
+	if (cck_power_level > max_cck_power_level)
+		cck_power_level = max_cck_power_level;
 
-extern u32 rtl8225_chan[];
+	GainIdx = cck_power_level % 6;
+	GainSetting = cck_power_level / 6;
+
+	if (ch == 14)
+		cck_power_table = rtl8225_tx_power_cck_ch14;
+	else
+		cck_power_table = rtl8225_tx_power_cck;
+
+	write_nic_byte(dev, TX_GAIN_CCK,
+		       rtl8225_tx_gain_cck_ofdm[GainSetting] >> 1);
+
+	for (i = 0; i < 8; i++) {
+		power = cck_power_table[GainIdx * 8 + i];
+		write_phy_cck(dev, 0x44 + i, power);
+	}
+
+	/* FIXME Is this delay really needeed ? */
+	force_pci_posting(dev);
+	mdelay(1);
+
+	if (ofdm_power_level > (max_ofdm_power_level - min_ofdm_power_level))
+		ofdm_power_level = max_ofdm_power_level;
+	else
+		ofdm_power_level += min_ofdm_power_level;
+
+	if (ofdm_power_level > 35)
+		ofdm_power_level = 35;
+
+	GainIdx = ofdm_power_level % 6;
+	GainSetting = ofdm_power_level / 6;
+
+	rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
+
+	write_phy_ofdm(dev, 2, 0x42);
+	write_phy_ofdm(dev, 6, 0x00);
+	write_phy_ofdm(dev, 8, 0x00);
+
+	write_nic_byte(dev, TX_GAIN_OFDM,
+		       rtl8225_tx_gain_cck_ofdm[GainSetting] >> 1);
+
+	power = rtl8225_tx_power_ofdm[GainIdx];
+
+	write_phy_ofdm(dev, 5, power);
+	write_phy_ofdm(dev, 7, power);
+
+	force_pci_posting(dev);
+	mdelay(1);
+}
 
 //2005.11.16
 u8 rtl8225z2_threshold[]={
@@ -460,6 +675,60 @@ void rtl8225z2_rf_set_chan(struct net_de
 	mdelay(10);
 }
 
+static void rtl8225_host_pci_init(struct net_device *dev)
+{
+	write_nic_word(dev, RFPinsOutput, 0x480);
+
+	rtl8185_rf_pins_enable(dev);
+
+	write_nic_word(dev, RFPinsSelect, 0x88 | SW_CONTROL_GPIO);
+
+	write_nic_byte(dev, GP_ENABLE, 0);
+
+	force_pci_posting(dev);
+	mdelay(200);
+
+	/* bit 6 is for RF on/off detection */
+	write_nic_word(dev, GP_ENABLE, 0xff & (~(1 << 6)));
+}
+
+static void rtl8225_rf_set_chan(struct net_device *dev, short ch)
+{
+	struct r8180_priv *priv = ieee80211_priv(dev);
+	short gset = (priv->ieee80211->state == IEEE80211_LINKED &&
+		ieee80211_is_54g(priv->ieee80211->current_network)) ||
+		priv->ieee80211->iw_mode == IW_MODE_MONITOR;
+
+	rtl8225_SetTXPowerLevel(dev, ch);
+
+	write_rtl8225(dev, 0x7, rtl8225_chan[ch]);
+
+	force_pci_posting(dev);
+	mdelay(10);
+
+	if (gset) {
+		write_nic_byte(dev, SIFS, 0x22);
+		write_nic_byte(dev, DIFS, 0x14);
+	} else {
+		write_nic_byte(dev, SIFS, 0x44);
+		write_nic_byte(dev, DIFS, 0x24);
+	}
+
+	if (priv->ieee80211->state == IEEE80211_LINKED &&
+	    ieee80211_is_shortslot(priv->ieee80211->current_network))
+		write_nic_byte(dev, SLOT, 0x9);
+	else
+		write_nic_byte(dev, SLOT, 0x14);
+
+	if (gset) {
+		write_nic_byte(dev, EIFS, 81);
+		write_nic_byte(dev, CW_VAL, 0x73);
+	} else {
+		write_nic_byte(dev, EIFS, 81);
+		write_nic_byte(dev, CW_VAL, 0xa5);
+	}
+}
+
 void rtl8225z2_rf_init(struct net_device *dev)
 {
 	struct r8180_priv *priv = ieee80211_priv(dev);
@@ -781,8 +1050,6 @@ void rtl8225z2_rf_init(struct net_device
 		rtl8185_rf_pins_enable(dev);
 	}
 
-//	if(priv->card_type != USB)
-//	rtl8225_set_gain(dev, 4); /* FIXME this '1' is random */ // <>
 //	 rtl8225_set_mode(dev, 1); /* FIXME start in B mode */ // <>
 //
 //	/* make sure is waken up! */

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 13/18] Staging: rtl8187se: cleanup r8180_pm.c
  2009-06-28 14:18 [PATCH 01/18] Staging: rtl8187se: remove ENABLE_DOT11D ifdefs Bartlomiej Zolnierkiewicz
                   ` (10 preceding siblings ...)
  2009-06-28 14:19 ` [PATCH 12/18] Staging: rtl8187se: merge r8180_rtl8225.c with r8180_rtl8225z2.c Bartlomiej Zolnierkiewicz
@ 2009-06-28 14:20 ` Bartlomiej Zolnierkiewicz
  2009-06-28 14:20 ` [PATCH 14/18] Staging: rtl8187se: merge r8180_pm.c with r8180_core.c Bartlomiej Zolnierkiewicz
                   ` (4 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-06-28 14:20 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Bartlomiej Zolnierkiewicz, linux-kernel

From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] Staging: rtl8187se: cleanup r8180_pm.c

* remove unused rtl8180_{save_state,enable_wake}()
* remove commented out code
* beautify code

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/staging/rtl8187se/r8180_pm.c |   32 ++++++++------------------------
 drivers/staging/rtl8187se/r8180_pm.h |    2 --
 2 files changed, 8 insertions(+), 26 deletions(-)

Index: b/drivers/staging/rtl8187se/r8180_pm.c
===================================================================
--- a/drivers/staging/rtl8187se/r8180_pm.c
+++ b/drivers/staging/rtl8187se/r8180_pm.c
@@ -15,16 +15,9 @@
 #include "r8180_pm.h"
 #include "r8180.h"
 
-int rtl8180_save_state (struct pci_dev *dev, u32 state)
-{
-        printk(KERN_NOTICE "r8180 save state call (state %u).\n", state);
-	return(-EAGAIN);
-}
-
-int rtl8180_suspend (struct pci_dev *pdev, pm_message_t state)
+int rtl8180_suspend(struct pci_dev *pdev, pm_message_t state)
 {
 	struct net_device *dev = pci_get_drvdata(pdev);
-//	struct r8180_priv *priv = ieee80211_priv(dev);
 
 	if (!netif_running(dev))
 		goto out_pci_suspend;
@@ -37,27 +30,28 @@ int rtl8180_suspend (struct pci_dev *pde
 out_pci_suspend:
 	pci_save_state(pdev);
 	pci_disable_device(pdev);
-	pci_set_power_state(pdev,pci_choose_state(pdev,state));
+	pci_set_power_state(pdev, pci_choose_state(pdev, state));
 	return 0;
 }
 
-int rtl8180_resume (struct pci_dev *pdev)
+int rtl8180_resume(struct pci_dev *pdev)
 {
 	struct net_device *dev = pci_get_drvdata(pdev);
-//	struct r8180_priv *priv = ieee80211_priv(dev);
 	int err;
 	u32 val;
 
 	pci_set_power_state(pdev, PCI_D0);
 
 	err = pci_enable_device(pdev);
-	if(err) {
+	if (err) {
 		printk(KERN_ERR "%s: pci_enable_device failed on resume\n",
 				dev->name);
 
 		return err;
 	}
+
 	pci_restore_state(pdev);
+
 	/*
 	 * Suspend/Resume resets the PCI configuration space, so we have to
 	 * re-disable the RETRY_TIMEOUT register (0x41) to keep PCI Tx retries
@@ -68,23 +62,13 @@ int rtl8180_resume (struct pci_dev *pdev
 	if ((val & 0x0000ff00) != 0)
 		pci_write_config_dword(pdev, 0x40, val & 0xffff00ff);
 
-	if(!netif_running(dev))
+	if (!netif_running(dev))
 		goto out;
 
 	if (dev->netdev_ops->ndo_open)
 		dev->netdev_ops->ndo_open(dev);
+
 	netif_device_attach(dev);
 out:
 	return 0;
 }
-
-
-int rtl8180_enable_wake (struct pci_dev *dev, u32 state, int enable)
-{
-        printk(KERN_NOTICE "r8180 enable wake call (state %u, enable %d).\n",
-	       state, enable);
-	return(-EAGAIN);
-}
-
-
-
Index: b/drivers/staging/rtl8187se/r8180_pm.h
===================================================================
--- a/drivers/staging/rtl8187se/r8180_pm.h
+++ b/drivers/staging/rtl8187se/r8180_pm.h
@@ -17,10 +17,8 @@
 #include <linux/types.h>
 #include <linux/pci.h>
 
-int rtl8180_save_state (struct pci_dev *dev, u32 state);
 int rtl8180_suspend (struct pci_dev *pdev, pm_message_t state);
 int rtl8180_resume (struct pci_dev *pdev);
-int rtl8180_enable_wake (struct pci_dev *dev, u32 state, int enable);
 
 #endif //R8180_PM_H
 

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 14/18] Staging: rtl8187se: merge r8180_pm.c with r8180_core.c
  2009-06-28 14:18 [PATCH 01/18] Staging: rtl8187se: remove ENABLE_DOT11D ifdefs Bartlomiej Zolnierkiewicz
                   ` (11 preceding siblings ...)
  2009-06-28 14:20 ` [PATCH 13/18] Staging: rtl8187se: cleanup r8180_pm.c Bartlomiej Zolnierkiewicz
@ 2009-06-28 14:20 ` Bartlomiej Zolnierkiewicz
  2009-06-28 14:20 ` [PATCH 15/18] Staging: rtl8187se: remove unused definitions from r8180_hw.h Bartlomiej Zolnierkiewicz
                   ` (3 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-06-28 14:20 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Bartlomiej Zolnierkiewicz, linux-kernel

From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] Staging: rtl8187se: merge r8180_pm.c with r8180_core.c

* merge r8180_pm.c with r8180_core.c
* make functions static

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/staging/rtl8187se/Makefile      |    1 
 drivers/staging/rtl8187se/r8180_core.c  |   63 ++++++++++++++++++++++++++-
 drivers/staging/rtl8187se/r8180_pm.c    |   74 --------------------------------
 drivers/staging/rtl8187se/r8180_pm.h    |   24 ----------
 drivers/staging/rtl8187se/r8185b_init.c |    2 
 5 files changed, 61 insertions(+), 103 deletions(-)

Index: b/drivers/staging/rtl8187se/Makefile
===================================================================
--- a/drivers/staging/rtl8187se/Makefile
+++ b/drivers/staging/rtl8187se/Makefile
@@ -25,7 +25,6 @@ rtl8187se-objs :=			\
 		r8180_rtl8225z2.o	\
 		r8185b_init.o		\
 		r8180_dm.o		\
-		r8180_pm.o		\
 		ieee80211/dot11d.o			\
 		ieee80211/ieee80211_softmac.o		\
 		ieee80211/ieee80211_rx.o		\
Index: b/drivers/staging/rtl8187se/r8180_core.c
===================================================================
--- a/drivers/staging/rtl8187se/r8180_core.c
+++ b/drivers/staging/rtl8187se/r8180_core.c
@@ -22,6 +22,9 @@
 
    A big big thanks goes also to Realtek corp. for their help in my attempt to
    add RTL8185 and RTL8225 support, and to David Young also.
+
+   Power management interface routines.
+   Written by Mariusz Matuszek.
 */
 
 #undef RX_DONT_PASS_UL
@@ -37,8 +40,6 @@
 #include "r8180_wx.h"
 #include "r8180_dm.h"
 
-#include "r8180_pm.h"
-
 #include "ieee80211/dot11d.h"
 
 #ifndef PCI_VENDOR_ID_BELKIN
@@ -121,6 +122,64 @@ static void rtl8180_shutdown (struct pci
 	pci_disable_device(pdev);
 }
 
+static int rtl8180_suspend(struct pci_dev *pdev, pm_message_t state)
+{
+	struct net_device *dev = pci_get_drvdata(pdev);
+
+	if (!netif_running(dev))
+		goto out_pci_suspend;
+
+	if (dev->netdev_ops->ndo_stop)
+		dev->netdev_ops->ndo_stop(dev);
+
+	netif_device_detach(dev);
+
+out_pci_suspend:
+	pci_save_state(pdev);
+	pci_disable_device(pdev);
+	pci_set_power_state(pdev, pci_choose_state(pdev, state));
+	return 0;
+}
+
+static int rtl8180_resume(struct pci_dev *pdev)
+{
+	struct net_device *dev = pci_get_drvdata(pdev);
+	int err;
+	u32 val;
+
+	pci_set_power_state(pdev, PCI_D0);
+
+	err = pci_enable_device(pdev);
+	if (err) {
+		printk(KERN_ERR "%s: pci_enable_device failed on resume\n",
+				dev->name);
+
+		return err;
+	}
+
+	pci_restore_state(pdev);
+
+	/*
+	 * Suspend/Resume resets the PCI configuration space, so we have to
+	 * re-disable the RETRY_TIMEOUT register (0x41) to keep PCI Tx retries
+	 * from interfering with C3 CPU state. pci_restore_state won't help
+	 * here since it only restores the first 64 bytes pci config header.
+	 */
+	pci_read_config_dword(pdev, 0x40, &val);
+	if ((val & 0x0000ff00) != 0)
+		pci_write_config_dword(pdev, 0x40, val & 0xffff00ff);
+
+	if (!netif_running(dev))
+		goto out;
+
+	if (dev->netdev_ops->ndo_open)
+		dev->netdev_ops->ndo_open(dev);
+
+	netif_device_attach(dev);
+out:
+	return 0;
+}
+
 static struct pci_driver rtl8180_pci_driver = {
 	.name		= RTL8180_MODULE_NAME,	          /* Driver name   */
 	.id_table	= rtl8180_pci_id_tbl,	          /* PCI_ID table  */
Index: b/drivers/staging/rtl8187se/r8180_pm.c
===================================================================
--- a/drivers/staging/rtl8187se/r8180_pm.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
-   Power management interface routines.
-   Written by Mariusz Matuszek.
-   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@tiscali.it>
-   Released under the terms of GPL (General Public Licence)
-*/
-
-
-
-#include "r8180_hw.h"
-#include "r8180_pm.h"
-#include "r8180.h"
-
-int rtl8180_suspend(struct pci_dev *pdev, pm_message_t state)
-{
-	struct net_device *dev = pci_get_drvdata(pdev);
-
-	if (!netif_running(dev))
-		goto out_pci_suspend;
-
-	if (dev->netdev_ops->ndo_stop)
-		dev->netdev_ops->ndo_stop(dev);
-
-	netif_device_detach(dev);
-
-out_pci_suspend:
-	pci_save_state(pdev);
-	pci_disable_device(pdev);
-	pci_set_power_state(pdev, pci_choose_state(pdev, state));
-	return 0;
-}
-
-int rtl8180_resume(struct pci_dev *pdev)
-{
-	struct net_device *dev = pci_get_drvdata(pdev);
-	int err;
-	u32 val;
-
-	pci_set_power_state(pdev, PCI_D0);
-
-	err = pci_enable_device(pdev);
-	if (err) {
-		printk(KERN_ERR "%s: pci_enable_device failed on resume\n",
-				dev->name);
-
-		return err;
-	}
-
-	pci_restore_state(pdev);
-
-	/*
-	 * Suspend/Resume resets the PCI configuration space, so we have to
-	 * re-disable the RETRY_TIMEOUT register (0x41) to keep PCI Tx retries
-	 * from interfering with C3 CPU state. pci_restore_state won't help
-	 * here since it only restores the first 64 bytes pci config header.
-	 */
-	pci_read_config_dword(pdev, 0x40, &val);
-	if ((val & 0x0000ff00) != 0)
-		pci_write_config_dword(pdev, 0x40, val & 0xffff00ff);
-
-	if (!netif_running(dev))
-		goto out;
-
-	if (dev->netdev_ops->ndo_open)
-		dev->netdev_ops->ndo_open(dev);
-
-	netif_device_attach(dev);
-out:
-	return 0;
-}
Index: b/drivers/staging/rtl8187se/r8180_pm.h
===================================================================
--- a/drivers/staging/rtl8187se/r8180_pm.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
-        Power management interface routines.
-	Written by Mariusz Matuszek.
-	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@tiscali.it>
-	Released under the terms of GPL (General Public Licence)
-
-*/
-
-
-#ifndef R8180_PM_H
-#define R8180_PM_H
-
-#include <linux/types.h>
-#include <linux/pci.h>
-
-int rtl8180_suspend (struct pci_dev *pdev, pm_message_t state);
-int rtl8180_resume (struct pci_dev *pdev);
-
-#endif //R8180_PM_H
-
Index: b/drivers/staging/rtl8187se/r8185b_init.c
===================================================================
--- a/drivers/staging/rtl8187se/r8185b_init.c
+++ b/drivers/staging/rtl8187se/r8185b_init.c
@@ -26,8 +26,6 @@ Notes:
 #include "r8180_93cx6.h"   /* Card EEPROM */
 #include "r8180_wx.h"
 
-#include "r8180_pm.h"
-
 #include "ieee80211/dot11d.h"
 
 

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 15/18] Staging: rtl8187se: remove unused definitions from r8180_hw.h
  2009-06-28 14:18 [PATCH 01/18] Staging: rtl8187se: remove ENABLE_DOT11D ifdefs Bartlomiej Zolnierkiewicz
                   ` (12 preceding siblings ...)
  2009-06-28 14:20 ` [PATCH 14/18] Staging: rtl8187se: merge r8180_pm.c with r8180_core.c Bartlomiej Zolnierkiewicz
@ 2009-06-28 14:20 ` Bartlomiej Zolnierkiewicz
  2009-06-28 14:20 ` [PATCH 16/18] Staging: rtl8187se: remove unused definitions from r8180.h Bartlomiej Zolnierkiewicz
                   ` (2 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-06-28 14:20 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Bartlomiej Zolnierkiewicz, linux-kernel

From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] Staging: rtl8187se: remove unused definitions from r8180_hw.h

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/staging/rtl8187se/r8180_hw.h |  314 -----------------------------------
 1 file changed, 5 insertions(+), 309 deletions(-)

Index: b/drivers/staging/rtl8187se/r8180_hw.h
===================================================================
--- a/drivers/staging/rtl8187se/r8180_hw.h
+++ b/drivers/staging/rtl8187se/r8180_hw.h
@@ -29,18 +29,10 @@
 #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
@@ -57,29 +49,14 @@
 #define MAX_SLEEP_TIME (10000)
 #define MIN_SLEEP_TIME (50)
 
-#define BB_ANTATTEN_CHAN14	0x0c
-#define BB_ANTENNA_B 0x40
-
-#define BB_HOST_BANG (1<<30)
 #define BB_HOST_BANG_EN (1<<2)
 #define BB_HOST_BANG_CLK (1<<1)
-#define BB_HOST_BANG_DATA	 1
-
-#define ANAPARAM_TXDACOFF_SHIFT 27
-#define ANAPARAM_PWR0_MASK ((1<<30)|(1<<29)|(1<<28))
-#define ANAPARAM_PWR0_SHIFT 28
-#define ANAPARAM_PWR1_MASK ((1<<26)|(1<<25)|(1<<24)|(1<<23)|(1<<22)|(1<<21)|(1<<20))
-#define ANAPARAM_PWR1_SHIFT 20
 
 #define MAC0 0
-#define MAC1 1
-#define MAC2 2
-#define MAC3 3
 #define MAC4 4
-#define MAC5 5
+
 #define CMD 0x37
 #define CMD_RST_SHIFT 4
-#define CMD_RESERVED_MASK ((1<<1) | (1<<5) | (1<<6) | (1<<7))
 #define CMD_RX_ENABLE_SHIFT 3
 #define CMD_TX_ENABLE_SHIFT 2
 
@@ -96,13 +73,9 @@
 #define EPROM_W_SHIFT 1
 #define EPROM_R_SHIFT 0
 #define CONFIG2_DMA_POLLING_MODE_SHIFT 3
-#define INTA 0x3e
+
 #define INTA_TXOVERFLOW (1<<15)
 #define INTA_TIMEOUT (1<<14)
-#define INTA_BEACONTIMEOUT (1<<13)
-#define INTA_ATIM (1<<12)
-#define INTA_BEACONDESCERR (1<<11)
-#define INTA_BEACONDESCOK (1<<10)
 #define INTA_HIPRIORITYDESCERR (1<<9)
 #define INTA_HIPRIORITYDESCOK (1<<8)
 #define INTA_NORMPRIORITYDESCERR (1<<7)
@@ -111,9 +84,9 @@
 #define INTA_RXDESCERR (1<<4)
 #define INTA_LOWPRIORITYDESCERR (1<<3)
 #define INTA_LOWPRIORITYDESCOK (1<<2)
-#define INTA_RXCRCERR (1<<1)
 #define INTA_RXOK (1)
 #define INTA_MASK 0x3c
+
 #define RXRING_ADDR 0xe4 // page 0
 #define PGSELECT 0x5e
 #define PGSELECT_PG_SHIFT 0
@@ -131,20 +104,15 @@
 #define ACCEPT_MCAST_FRAME_SHIFT 2
 #define ACCEPT_ALLMAC_FRAME_SHIFT 0
 #define ACCEPT_NICMAC_FRAME_SHIFT 1
+
 #define RX_FIFO_THRESHOLD_MASK ((1<<13) | (1<<14) | (1<<15))
 #define RX_FIFO_THRESHOLD_SHIFT 13
-#define RX_FIFO_THRESHOLD_128 3
-#define RX_FIFO_THRESHOLD_256 4
-#define RX_FIFO_THRESHOLD_512 5
-#define RX_FIFO_THRESHOLD_1024 6
 #define RX_FIFO_THRESHOLD_NONE 7
 #define RX_AUTORESETPHY_SHIFT 28
-#define EPROM_TYPE_SHIFT 6
+
 #define TX_CONF 0x40
 #define TX_CONF_HEADER_AUTOICREMENT_SHIFT 30
 #define TX_LOOPBACK_SHIFT 17
-#define TX_LOOPBACK_MAC 1
-#define TX_LOOPBACK_BASEBAND 2
 #define TX_LOOPBACK_NONE 0
 #define TX_LOOPBACK_CONTINUE 3
 #define TX_LOOPBACK_MASK ((1<<17)|(1<<18))
@@ -158,21 +126,12 @@
 #define TX_DMA_POLLING_HIPRIORITY_SHIFT 6
 #define TX_DMA_POLLING_NORMPRIORITY_SHIFT 5
 #define TX_DMA_POLLING_LOWPRIORITY_SHIFT 4
-#define TX_DMA_STOP_BEACON_SHIFT 3
-#define TX_DMA_STOP_HIPRIORITY_SHIFT 2
-#define TX_DMA_STOP_NORMPRIORITY_SHIFT 1
-#define TX_DMA_STOP_LOWPRIORITY_SHIFT 0
 #define TX_MANAGEPRIORITY_RING_ADDR 0x0C
 #define TX_BKPRIORITY_RING_ADDR 0x10
 #define TX_BEPRIORITY_RING_ADDR 0x14
 #define TX_VIPRIORITY_RING_ADDR 0x20
 #define TX_VOPRIORITY_RING_ADDR 0x24
 #define TX_HIGHPRIORITY_RING_ADDR 0x28
-//AC_VI and Low priority share the sane queue
-#define TX_LOWPRIORITY_RING_ADDR TX_VIPRIORITY_RING_ADDR
-//AC_VO and Norm priority share the same queue
-#define TX_NORMPRIORITY_RING_ADDR TX_VOPRIORITY_RING_ADDR
-
 #define MAX_RX_DMA_MASK ((1<<8) | (1<<9) | (1<<10))
 #define MAX_RX_DMA_2048 7
 #define MAX_RX_DMA_1024	6
@@ -189,11 +148,7 @@
 #define ATIM 0x72
 #define EPROM_CS_SHIFT 3
 #define EPROM_CK_SHIFT 2
-#define PHY_DELAY 0x78
-#define PHY_CONFIG 0x80
 #define PHY_ADR 0x7c
-#define PHY_READ 0x7e
-#define CARRIER_SENSE_COUNTER 0x79 //byte
 #define SECURITY 0x5f //1209 this is sth wrong
 #define SECURITY_WEP_TX_ENABLE_SHIFT 1
 #define SECURITY_WEP_RX_ENABLE_SHIFT 0
@@ -214,44 +169,16 @@
  * RealTek names are used.
  */
 
-#define IDR0 0x0000
-#define IDR1 0x0001
-#define IDR2 0x0002
-#define IDR3 0x0003
-#define IDR4 0x0004
-#define IDR5 0x0005
-
-/* 0x0006 - 0x0007 - reserved */
-
-#define MAR0 0x0008
-#define MAR1 0x0009
-#define MAR2 0x000A
-#define MAR3 0x000B
-#define MAR4 0x000C
-#define MAR5 0x000D
-#define MAR6 0x000E
-#define MAR7 0x000F
-
-/* 0x0010 - 0x0017 - reserved */
-
 #define TSFTR 0x0018
-#define TSFTR_END 0x001F
 
 #define TLPDA 0x0020
-#define TLPDA_END 0x0023
-#define TNPDA 0x0024
-#define TNPDA_END 0x0027
-#define THPDA 0x0028
-#define THPDA_END 0x002B
 
 #define BSSID 0x002E
-#define BSSID_END 0x0033
 
 #define CR 0x0037
 
 #define RF_SW_CONFIG	        0x8			// store data which is transmitted to RF for driver
 #define RF_SW_CFG_SI		BIT1
-#define PIFS			0x2C			// PCF InterFrame Spacing Timer Setting.
 #define EIFS			0x2D			// Extended InterFrame Space Timer, in unit of 4 us.
 
 #define BRSR			0x34			// Basic rate set
@@ -260,26 +187,16 @@
 #define ISR 0x003C
 
 #define TCR 0x0040
-#define TCR_END 0x0043
 
 #define RCR 0x0044
-#define RCR_END 0x0047
 
 #define TimerInt 0x0048
-#define TimerInt_END 0x004B
-
-#define TBDA 0x004C
-#define TBDA_END 0x004F
 
 #define CR9346 0x0050
 
 #define CONFIG0 0x0051
-#define CONFIG1 0x0052
 #define CONFIG2 0x0053
 
-#define ANA_PARM 0x0054
-#define ANA_PARM_END 0x0x0057
-
 #define MSR 0x0058
 
 #define CONFIG3 0x0059
@@ -294,37 +211,17 @@
 
 #define TESTR 0x005B
 
-/* 0x005C - 0x005D - reserved */
-
 #define PSR 0x005E
 
-/* 0x0060 - 0x006F - reserved */
-
 #define BcnItv 0x0070
-#define BcnItv_END 0x0071
 
 #define AtimWnd 0x0072
-#define AtimWnd_END 0x0073
 
 #define BintrItv 0x0074
-#define BintrItv_END 0x0075
-
-#define AtimtrItv 0x0076
-#define AtimtrItv_END 0x0077
-
-#define PhyDelay 0x0078
-
-#define CRCount 0x0079
-
-/* 0x007A - 0x007B - reserved */
 
 #define PhyAddr 0x007C
-#define PhyDataW 0x007D
 #define PhyDataR 0x007E
 
-#define PhyCFG 0x0080
-#define PhyCFG_END 0x0083
-
 /* following are for rtl8185 */
 #define RFPinsOutput 0x80
 #define RFPinsEnable 0x82
@@ -356,100 +253,13 @@
 #define MAX_RESP_RATE_SHIFT 4
 #define MIN_RESP_RATE_SHIFT 0
 #define RATE_FALLBACK 0xbe
-/*
- *  0x0084 - 0x00D3 is selected to page 1 when PSEn bit (bit0, PSR)
- *  is set to 1
- */
-
-#define Wakeup0 0x0084
-#define Wakeup0_END 0x008B
-
-#define Wakeup1 0x008C
-#define Wakeup1_END 0x0093
-
-#define Wakeup2LD 0x0094
-#define Wakeup2LD_END 0x009B
-#define Wakeup2HD 0x009C
-#define Wakeup2HD_END 0x00A3
-
-#define Wakeup3LD 0x00A4
-#define Wakeup3LD_END 0x00AB
-#define Wakeup3HD 0x00AC
-#define Wakeup3HD_END 0x00B3
-
-#define Wakeup4LD 0x00B4
-#define Wakeup4LD_END 0x00BB
-#define Wakeup4HD 0x00BC
-#define Wakeup4HD_END 0x00C3
-
-#define CRC0 0x00C4
-#define CRC0_END 0x00C5
-#define CRC1 0x00C6
-#define CRC1_END 0x00C7
-#define CRC2 0x00C8
-#define CRC2_END 0x00C9
-#define CRC3 0x00CA
-#define CRC3_END 0x00CB
-#define CRC4 0x00CC
-#define CRC4_END 0x00CD
-
-/* 0x00CE - 0x00D3 - reserved */
-
-
-
-/*
- *  0x0084 - 0x00D3 is selected to page 0 when PSEn bit (bit0, PSR)
- *  is set to 0
- */
-
-/* 0x0084 - 0x008F - reserved */
-
-#define DK0 0x0090
-#define DK0_END 0x009F
-#define DK1 0x00A0
-#define DK1_END 0x00AF
-#define DK2 0x00B0
-#define DK2_END 0x00BF
-#define DK3 0x00C0
-#define DK3_END 0x00CF
-
-/* 0x00D0 - 0x00D3 - reserved */
-
-
-
-
-
-/* 0x00D4 - 0x00D7 - reserved */
 
 #define CONFIG5 0x00D8
 
-#define TPPoll 0x00D9
-
-/* 0x00DA - 0x00DB - reserved */
-
 #define PHYPR			0xDA			//0xDA - 0x0B PHY Parameter Register.
 
-#define CWR 0x00DC
-#define CWR_END 0x00DD
-
-#define RetryCTR 0x00DE
-
-/* 0x00DF - 0x00E3 - reserved */
-
-#define RDSAR 0x00E4
-#define RDSAR_END 0x00E7
-
-/* 0x00E8 - 0x00EF - reserved */
-#define LED_CONTROL		0xED
-
-#define FER 0x00F0
-#define FER_END 0x00F3
-
 #define FEMR			0x1D4	// Function Event Mask register
 
-#define FPSR 0x00F8
-#define FPSR_END 0x00FB
-
 #define FFER 0x00FC
 #define FFER_END 0x00FF
 
@@ -598,53 +408,10 @@
 #define CR9346_EED1    ((1<<1))
 #define CR9346_EED0    ((1<<0))
 
-#define CONFIG0_WEP104     ((1<<6))
-#define CONFIG0_LEDGPO_En  ((1<<4))
-#define CONFIG0_Aux_Status ((1<<3))
-#define CONFIG0_GL         ((1<<1)|(1<<0))
-#define CONFIG0_GL1        ((1<<1))
-#define CONFIG0_GL0        ((1<<0))
-
-#define CONFIG1_LEDS       ((1<<7)|(1<<6))
-#define CONFIG1_LEDS1      ((1<<7))
-#define CONFIG1_LEDS0      ((1<<6))
-#define CONFIG1_LWACT      ((1<<4))
-#define CONFIG1_MEMMAP     ((1<<3))
-#define CONFIG1_IOMAP      ((1<<2))
-#define CONFIG1_VPD        ((1<<1))
-#define CONFIG1_PMEn       ((1<<0))
-
-#define CONFIG2_LCK        ((1<<7))
-#define CONFIG2_ANT        ((1<<6))
-#define CONFIG2_DPS        ((1<<3))
-#define CONFIG2_PAPE_sign  ((1<<2))
-#define CONFIG2_PAPE_time  ((1<<1)|(1<<0))
-#define CONFIG2_PAPE_time1 ((1<<1))
-#define CONFIG2_PAPE_time0 ((1<<0))
-
-#define CONFIG3_GNTSel     ((1<<7))
 #define CONFIG3_PARM_En    ((1<<6))
-#define CONFIG3_Magic      ((1<<5))
-#define CONFIG3_CardB_En   ((1<<3))
-#define CONFIG3_CLKRUN_En  ((1<<2))
 #define CONFIG3_FuncRegEn  ((1<<1))
-#define CONFIG3_FBtbEn     ((1<<0))
 
-#define CONFIG4_VCOPDN     ((1<<7))
-#define CONFIG4_PWROFF     ((1<<6))
 #define CONFIG4_PWRMGT     ((1<<5))
-#define CONFIG4_LWPME      ((1<<4))
-#define CONFIG4_LWPTN      ((1<<2))
-#define CONFIG4_RFTYPE     ((1<<1)|(1<<0))
-#define CONFIG4_RFTYPE1    ((1<<1))
-#define CONFIG4_RFTYPE0    ((1<<0))
-
-#define CONFIG5_TX_FIFO_OK ((1<<7))
-#define CONFIG5_RX_FIFO_OK ((1<<6))
-#define CONFIG5_CALON      ((1<<5))
-#define CONFIG5_EACPI      ((1<<2))
-#define CONFIG5_LANWake    ((1<<1))
-#define CONFIG5_PME_STS    ((1<<0))
 
 #define MSR_LINK_MASK      ((1<<2)|(1<<3))
 #define MSR_LINK_MANAGED   2
@@ -653,50 +420,16 @@
 #define MSR_LINK_ADHOC     1
 #define MSR_LINK_MASTER    3
 
-#define PSR_GPO            ((1<<7))
-#define PSR_GPI            ((1<<6))
-#define PSR_LEDGPO1        ((1<<5))
-#define PSR_LEDGPO0        ((1<<4))
-#define PSR_UWF            ((1<<1))
-#define PSR_PSEn           ((1<<0))
-
-#define SCR_KM             ((1<<5)|(1<<4))
-#define SCR_KM1            ((1<<5))
-#define SCR_KM0            ((1<<4))
-#define SCR_TXSECON        ((1<<1))
-#define SCR_RXSECON        ((1<<0))
-
 #define BcnItv_BcnItv      (0x01FF)
 
 #define AtimWnd_AtimWnd    (0x01FF)
 
 #define BintrItv_BintrItv  (0x01FF)
 
-#define AtimtrItv_AtimtrItv (0x01FF)
-
-#define PhyDelay_PhyDelay  ((1<<2)|(1<<1)|(1<<0))
-
-#define TPPoll_BQ    ((1<<7))
-#define TPPoll_HPQ   ((1<<6))
-#define TPPoll_NPQ   ((1<<5))
-#define TPPoll_LPQ   ((1<<4))
-#define TPPoll_SBQ   ((1<<3))
-#define TPPoll_SHPQ  ((1<<2))
-#define TPPoll_SNPQ  ((1<<1))
-#define TPPoll_SLPQ  ((1<<0))
-
-#define CWR_CW       (0x01FF)
-
-#define FER_INTR     ((1<<15))
-#define FER_GWAKE    ((1<< 4))
-
 #define FEMR_INTR    ((1<<15))
 #define FEMR_WKUP    ((1<<14))
 #define FEMR_GWAKE   ((1<< 4))
 
-#define FPSR_INTR    ((1<<15))
-#define FPSR_GWAKE   ((1<< 4))
-
 #define FFER_INTR    ((1<<15))
 #define FFER_GWAKE   ((1<< 4))
 
@@ -716,17 +449,6 @@
 #define RCR_MXDMA_OFFSET				8
 #define RCR_FIFO_OFFSET					13
 
-#define TMGDS			0x0C			// Tx Management Descriptor Address
-#define TBKDS			0x10			// Tx AC_BK Descriptor Address
-#define TBEDS			0x14			// Tx AC_BE Descriptor Address
-#define TLPDS			0x20			// Tx AC_VI Descriptor Address
-#define TNPDS			0x24			// Tx AC_VO Descriptor Address
-#define THPDS			0x28			// Tx Hign Priority Descriptor Address
-
-#define TBDS			0x4c			// Beacon descriptor queue start address
-
-#define RDSA			0xE4			// Receive descriptor queue start address
-
 #define AckTimeOutReg	0x79		// ACK timeout register, in unit of 4 us.
 
 #define RFTiming			0x8C
@@ -740,8 +462,6 @@
 
 #define ACM_CONTROL             0x00BF      // ACM Control Registe
 
-#define RTL8185B_VER_REG    0xE1
-
 #define	IntMig			0xE2			// Interrupt Migration (0xE2 ~ 0xE3)
 
 #define TID_AC_MAP		0xE8			// TID to AC Mapping Register
@@ -753,9 +473,7 @@
 #define AC_BE_PARAM		0xF8			// AC_BE Parameters Record
 #define AC_BK_PARAM		0xFC			// AC_BK Parameters Record
 
-#define BcnTimingAdjust	0x16A			// Beacon Timing Adjust Register.
 #define GPIOCtrl			0x16B			// GPIO Control Register.
-#define PSByGC			0x180			// 0x180 - 0x183 Power Saving by Gated Clock.
 #define ARFR			0x1E0	// Auto Rate Fallback Register (0x1e0 ~ 0x1e2)
 
 #define RFSW_CTRL			0x272	// 0x272-0x273.
@@ -768,27 +486,10 @@
 #define SI_DATA_READ		0x362	// 0x362 - 0x363  Serial Interface Data Register.
 
 //----------------------------------------------------------------------------
-//       8185B TPPoll bits 				(offset 0xd9, 1 byte)
-//----------------------------------------------------------------------------
-#define TPPOLL_BQ			(0x01 << 7)
-#define TPPOLL_HPQ			(0x01 << 6)
-#define TPPOLL_AC_VOQ		(0x01 << 5)
-#define TPPOLL_AC_VIQ		(0x01 << 4)
-#define TPPOLL_AC_BEQ		(0x01 << 3)
-#define TPPOLL_AC_BKQ		(0x01 << 2)
-#define TPPOLL_AC_MGQ		(0x01 << 1)
-
-//----------------------------------------------------------------------------
 //       8185B TPPollStop bits 				(offset 0x93, 1 byte)
 //----------------------------------------------------------------------------
 #define TPPOLLSTOP_BQ			(0x01 << 7)
-#define TPPOLLSTOP_HPQ			(0x01 << 6)
-#define TPPOLLSTOP_AC_VOQ		(0x01 << 5)
 #define TPPOLLSTOP_AC_VIQ		(0x01 << 4)
-#define TPPOLLSTOP_AC_BEQ		(0x01 << 3)
-#define TPPOLLSTOP_AC_BKQ		(0x01 << 2)
-#define TPPOLLSTOP_AC_MGQ		(0x01 << 1)
-
 
 #define MSR_LINK_ENEDCA	   (1<<4)
 
@@ -807,7 +508,6 @@
 #define VIQ_ACM_EN				(0x01 << 6) //BIT6
 #define BEQ_ACM_EN				(0x01 << 5) //BIT5
 #define ACM_HW_EN				(0x01 << 4) //BIT4
-#define TXOPSEL					(0x01 << 3) //BIT3
 #define VOQ_ACM_CTL				(0x01 << 2) //BIT2 // Set to 1 when AC_VO used time reaches or exceeds the admitted time
 #define VIQ_ACM_CTL				(0x01 << 1) //BIT1 // Set to 1 when AC_VI used time reaches or exceeds the admitted time
 #define BEQ_ACM_CTL				(0x01 << 0) //BIT0 // Set to 1 when AC_BE used time reaches or exceeds the admitted time
@@ -838,7 +538,6 @@
 #define RTL8225z2_ANAPARAM_OFF	0x55480658
 #define RTL8225z2_ANAPARAM2_OFF	0x72003f70
 //by amy for power save
-#define RF_CHANGE_BY_SW BIT31
 #define RF_CHANGE_BY_HW BIT30
 #define RF_CHANGE_BY_PS BIT29
 #define RF_CHANGE_BY_IPS BIT28
@@ -856,18 +555,15 @@
 //{by amy 080312
 //0x7C, 0x7D Crystal calibration and Tx Power tracking mechanism. Added by Roger. 2007.12.10.
 #define EEPROM_RSV						0x7C
-#define EEPROM_XTAL_CAL_MASK			0x00FF	// 0x7C[7:0], Crystal calibration mask.
 #define EEPROM_XTAL_CAL_XOUT_MASK	0x0F	// 0x7C[3:0], Crystal calibration for Xout.
 #define EEPROM_XTAL_CAL_XIN_MASK		0xF0	// 0x7C[7:4], Crystal calibration for Xin.
 #define EEPROM_THERMAL_METER_MASK	0x0F00	// 0x7D[3:0], Thermal meter reference level.
 #define EEPROM_XTAL_CAL_ENABLE		0x1000	// 0x7D[4], Crystal calibration enabled/disabled BIT.
 #define EEPROM_THERMAL_METER_ENABLE	0x2000	// 0x7D[5], Thermal meter enabled/disabled BIT.
-#define EEPROM_CID_RSVD1				0x3F
 #define EN_LPF_CAL			0x238	// Enable LPF Calibration.
 #define PWR_METER_EN		BIT1
 // <RJ_TODO_8185B> where are false alarm counters in 8185B?
 #define CCK_FALSE_ALARM		0xD0
-#define OFDM_FALSE_ALARM	0xD2
 //by amy 080312}
 
 //YJ,add for Country IE, 080630

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 16/18] Staging: rtl8187se: remove unused definitions from r8180.h
  2009-06-28 14:18 [PATCH 01/18] Staging: rtl8187se: remove ENABLE_DOT11D ifdefs Bartlomiej Zolnierkiewicz
                   ` (13 preceding siblings ...)
  2009-06-28 14:20 ` [PATCH 15/18] Staging: rtl8187se: remove unused definitions from r8180_hw.h Bartlomiej Zolnierkiewicz
@ 2009-06-28 14:20 ` Bartlomiej Zolnierkiewicz
  2009-06-28 14:20 ` [PATCH 17/18] Staging: rtl8187se: cleanup r8180_rtl8225z2.c Bartlomiej Zolnierkiewicz
  2009-06-28 14:20 ` [PATCH 18/18] Staging: rtl8187se: cleanup r8180_core.c Bartlomiej Zolnierkiewicz
  16 siblings, 0 replies; 18+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-06-28 14:20 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Bartlomiej Zolnierkiewicz, linux-kernel

From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] Staging: rtl8187se: remove unused definitions from r8180.h

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/staging/rtl8187se/r8180.h |   14 --------------
 1 file changed, 14 deletions(-)

Index: b/drivers/staging/rtl8187se/r8180.h
===================================================================
--- a/drivers/staging/rtl8187se/r8180.h
+++ b/drivers/staging/rtl8187se/r8180.h
@@ -52,30 +52,16 @@
 
 #define DEFAULT_FRAG_THRESHOLD 2342U
 #define MIN_FRAG_THRESHOLD     256U
-//#define	MAX_FRAG_THRESHOLD     2342U
 #define DEFAULT_RTS_THRESHOLD 2342U
 #define MIN_RTS_THRESHOLD 0U
 #define MAX_RTS_THRESHOLD 2342U
 #define DEFAULT_BEACONINTERVAL 0x64U
-#define DEFAULT_BEACON_ESSID "Rtl8180"
 
-#define DEFAULT_SSID ""
 #define DEFAULT_RETRY_RTS 7
 #define DEFAULT_RETRY_DATA 7
-#define PRISM_HDR_SIZE 64
 
-
-#define MGNT_QUEUE						0
-#define BK_QUEUE						1
-#define BE_QUEUE						2
-#define VI_QUEUE						3
-#define VO_QUEUE						4
-#define HIGH_QUEUE						5
 #define BEACON_QUEUE					6
 
-#define LOW_QUEUE						BE_QUEUE
-#define NORMAL_QUEUE					MGNT_QUEUE
-
 #define aSifsTime 	10
 
 #define sCrcLng         4

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 17/18] Staging: rtl8187se: cleanup r8180_rtl8225z2.c
  2009-06-28 14:18 [PATCH 01/18] Staging: rtl8187se: remove ENABLE_DOT11D ifdefs Bartlomiej Zolnierkiewicz
                   ` (14 preceding siblings ...)
  2009-06-28 14:20 ` [PATCH 16/18] Staging: rtl8187se: remove unused definitions from r8180.h Bartlomiej Zolnierkiewicz
@ 2009-06-28 14:20 ` Bartlomiej Zolnierkiewicz
  2009-06-28 14:20 ` [PATCH 18/18] Staging: rtl8187se: cleanup r8180_core.c Bartlomiej Zolnierkiewicz
  16 siblings, 0 replies; 18+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-06-28 14:20 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Bartlomiej Zolnierkiewicz, linux-kernel

From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] Staging: rtl8187se: cleanup r8180_rtl8225z2.c

* make read_rtl8225() static
* make tables static const
* remove commented out code
* remove useless comments
* beautify code

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/staging/rtl8187se/r8180_rtl8225z2.c |  894 ++++++++--------------------
 1 file changed, 279 insertions(+), 615 deletions(-)

Index: b/drivers/staging/rtl8187se/r8180_rtl8225z2.c
===================================================================
--- a/drivers/staging/rtl8187se/r8180_rtl8225z2.c
+++ b/drivers/staging/rtl8187se/r8180_rtl8225z2.c
@@ -236,34 +236,31 @@ static void rtl8225_SetTXPowerLevel(stru
 	mdelay(1);
 }
 
-//2005.11.16
-u8 rtl8225z2_threshold[]={
+static const u8 rtl8225z2_threshold[] = {
         0x8d, 0x8d, 0x8d, 0x8d, 0x9d, 0xad, 0xbd,
 };
 
-//      0xd 0x19 0x1b 0x21
-u8 rtl8225z2_gain_bg[]={
-	0x23, 0x15, 0xa5, // -82-1dbm
-        0x23, 0x15, 0xb5, // -82-2dbm
-        0x23, 0x15, 0xc5, // -82-3dbm
-        0x33, 0x15, 0xc5, // -78dbm
-        0x43, 0x15, 0xc5, // -74dbm
-        0x53, 0x15, 0xc5, // -70dbm
-        0x63, 0x15, 0xc5, // -66dbm
+static const u8 rtl8225z2_gain_bg[] = {
+	0x23, 0x15, 0xa5, /* -82-1dBm */
+	0x23, 0x15, 0xb5, /* -82-2dBm */
+	0x23, 0x15, 0xc5, /* -82-3dBm */
+	0x33, 0x15, 0xc5, /* -78dBm */
+	0x43, 0x15, 0xc5, /* -74dBm */
+	0x53, 0x15, 0xc5, /* -70dBm */
+	0x63, 0x15, 0xc5, /* -66dBm */
 };
 
-u8 rtl8225z2_gain_a[]={
-	0x13,0x27,0x5a,//,0x37,// -82dbm
-	0x23,0x23,0x58,//,0x37,// -82dbm
-	0x33,0x1f,0x56,//,0x37,// -82dbm
-	0x43,0x1b,0x54,//,0x37,// -78dbm
-	0x53,0x17,0x51,//,0x37,// -74dbm
-	0x63,0x24,0x4f,//,0x37,// -70dbm
-	0x73,0x0f,0x4c,//,0x37,// -66dbm
+static const u8 rtl8225z2_gain_a[] = {
+	0x13, 0x27, 0x5a, /* -82dBm */
+	0x23, 0x23, 0x58, /* -82dBm */
+	0x33, 0x1f, 0x56, /* -82dBm */
+	0x43, 0x1b, 0x54, /* -78dBm */
+	0x53, 0x17, 0x51, /* -74dBm */
+	0x63, 0x24, 0x4f, /* -70dBm */
+	0x73, 0x0f, 0x4c, /* -66dBm */
 };
 
-//-
-u16 rtl8225z2_rxgain[]={
+static const u16 rtl8225z2_rxgain[] = {
 	0x0400, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0408, 0x0409,
 	0x040a, 0x040b, 0x0502, 0x0503, 0x0504, 0x0505, 0x0540, 0x0541,
 	0x0542, 0x0543, 0x0544, 0x0545, 0x0580, 0x0581, 0x0582, 0x0583,
@@ -279,75 +276,52 @@ u16 rtl8225z2_rxgain[]={
 
 };
 
-//2005.11.16,
-u8 ZEBRA2_CCK_OFDM_GAIN_SETTING[]={
-        0x00,0x01,0x02,0x03,0x04,0x05,
-        0x06,0x07,0x08,0x09,0x0a,0x0b,
-        0x0c,0x0d,0x0e,0x0f,0x10,0x11,
-        0x12,0x13,0x14,0x15,0x16,0x17,
-        0x18,0x19,0x1a,0x1b,0x1c,0x1d,
-        0x1e,0x1f,0x20,0x21,0x22,0x23,
+static const u8 ZEBRA2_CCK_OFDM_GAIN_SETTING[] = {
+	0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
+	0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b,
+	0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11,
+	0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+	0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d,
+	0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23,
 };
 
-/*
- from 0 to 0x23
-u8 rtl8225_tx_gain_cck_ofdm[]={
-	0x02,0x06,0x0e,0x1e,0x3e,0x7e
-};
-*/
-
-//-
-u8 rtl8225z2_tx_power_ofdm[]={
-	0x42,0x00,0x40,0x00,0x40
+static const u8 rtl8225z2_tx_power_ofdm[] = {
+	0x42, 0x00, 0x40, 0x00, 0x40
 };
 
-
-//-
-u8 rtl8225z2_tx_power_cck_ch14[]={
-	0x36,0x35,0x2e,0x1b,0x00,0x00,0x00,0x00
+static const u8 rtl8225z2_tx_power_cck_ch14[] = {
+	0x36, 0x35, 0x2e, 0x1b, 0x00, 0x00, 0x00, 0x00
 };
 
-
-//-
-u8 rtl8225z2_tx_power_cck[]={
-	0x36,0x35,0x2e,0x25,0x1c,0x12,0x09,0x04
+static const u8 rtl8225z2_tx_power_cck[] = {
+	0x36, 0x35, 0x2e, 0x25, 0x1c, 0x12, 0x09, 0x04
 };
 
-
 void rtl8225z2_set_gain(struct net_device *dev, short gain)
 {
-	u8* rtl8225_gain;
+	const u8 *rtl8225_gain;
 	struct r8180_priv *priv = ieee80211_priv(dev);
-
 	u8 mode = priv->ieee80211->mode;
 
-	if(mode == IEEE_B || mode == IEEE_G)
+	if (mode == IEEE_B || mode == IEEE_G)
 		rtl8225_gain = rtl8225z2_gain_bg;
 	else
 		rtl8225_gain = rtl8225z2_gain_a;
 
-	//write_phy_ofdm(dev, 0x0d, rtl8225_gain[gain * 3]);
-	//write_phy_ofdm(dev, 0x19, rtl8225_gain[gain * 3 + 1]);
-	//write_phy_ofdm(dev, 0x1b, rtl8225_gain[gain * 3 + 2]);
-        //2005.11.17, by ch-hsu
-        write_phy_ofdm(dev, 0x0b, rtl8225_gain[gain * 3]);
-        write_phy_ofdm(dev, 0x1b, rtl8225_gain[gain * 3 + 1]);
-        write_phy_ofdm(dev, 0x1d, rtl8225_gain[gain * 3 + 2]);
+	write_phy_ofdm(dev, 0x0b, rtl8225_gain[gain * 3]);
+	write_phy_ofdm(dev, 0x1b, rtl8225_gain[gain * 3 + 1]);
+	write_phy_ofdm(dev, 0x1d, rtl8225_gain[gain * 3 + 2]);
 	write_phy_ofdm(dev, 0x21, 0x37);
-
 }
 
-u32 read_rtl8225(struct net_device *dev, u8 adr)
+static u32 read_rtl8225(struct net_device *dev, u8 adr)
 {
 	u32 data2Write = ((u32)(adr & 0x1f)) << 27;
 	u32 dataRead;
 	u32 mask;
 	u16 oval,oval2,oval3,tmp;
-//	ThreeWireReg twreg;
-//	ThreeWireReg tdata;
 	int i;
 	short bit, rw;
-
 	u8 wLength = 6;
 	u8 rLength = 12;
 	u8 low2high = 0;
@@ -370,8 +344,8 @@ u32 read_rtl8225(struct net_device *dev,
 	rw = 0;
 
 	mask = (low2high) ? 0x01 : (((u32)0x01)<<(32-1));
-	for(i = 0; i < wLength/2; i++)
-	{
+
+	for (i = 0; i < wLength/2; i++) {
 		bit = ((data2Write&mask) != 0) ? 1 : 0;
 		write_nic_word(dev, RFPinsOutput, bit|oval | rw); udelay(1);
 
@@ -380,8 +354,7 @@ u32 read_rtl8225(struct net_device *dev,
 
 		mask = (low2high) ? (mask<<1): (mask>>1);
 
-		if(i == 2)
-		{
+		if (i == 2) {
 			rw = BB_HOST_BANG_RW;
 			write_nic_word(dev, RFPinsOutput, bit|oval | BB_HOST_BANG_CLK | rw); udelay(2);
 			write_nic_word(dev, RFPinsOutput, bit|oval | rw); udelay(2);
@@ -398,17 +371,16 @@ u32 read_rtl8225(struct net_device *dev,
 		mask = (low2high) ? (mask<<1) : (mask>>1);
 	}
 
-	//twreg.struc.clk = 0;
-	//twreg.struc.data = 0;
 	write_nic_word(dev, RFPinsOutput, rw|oval); udelay(2);
 	mask = (low2high) ? 0x01 : (((u32)0x01) << (12-1));
 
-	// We must set data pin to HW controled, otherwise RF can't driver it and
-	// value RF register won't be able to read back properly. 2006.06.13, by rcnjko.
+	/*
+	 * We must set data pin to HW controled, otherwise RF can't driver it
+	 * and value RF register won't be able to read back properly.
+	 */
 	write_nic_word(dev, RFPinsEnable, (oval2 & (~0x01)));
 
-	for(i = 0; i < rLength; i++)
-	{
+	for (i = 0; i < rLength; i++) {
 		write_nic_word(dev, RFPinsOutput, rw|oval); udelay(1);
 
 		write_nic_word(dev, RFPinsOutput, rw|oval|BB_HOST_BANG_CLK); udelay(2);
@@ -426,36 +398,26 @@ u32 read_rtl8225(struct net_device *dev,
 	write_nic_word(dev, RFPinsOutput, BB_HOST_BANG_EN|BB_HOST_BANG_RW|oval); udelay(2);
 
 	write_nic_word(dev, RFPinsEnable, oval2);
-	write_nic_word(dev, RFPinsSelect, oval3);   // Set To SW Switch
+	write_nic_word(dev, RFPinsSelect, oval3); /* Set To SW Switch */
 	write_nic_word(dev, RFPinsOutput, 0x3a0);
 
 	return dataRead;
-
 }
 
 short rtl8225_is_V_z2(struct net_device *dev)
 {
 	short vz2 = 1;
-	//int i;
-	/* sw to reg pg 1 */
-	//write_rtl8225(dev, 0, 0x1b7);
-	//write_rtl8225(dev, 0, 0x0b7);
 
-	/* reg 8 pg 1 = 23*/
-	//printk(KERN_WARNING "RF Rigisters:\n");
-
-	if( read_rtl8225(dev, 8) != 0x588)
+	if (read_rtl8225(dev, 8) != 0x588)
 		vz2 = 0;
-
 	else	/* reg 9 pg 1 = 24 */
-		if( read_rtl8225(dev, 9) != 0x700)
+		if (read_rtl8225(dev, 9) != 0x700)
 			vz2 = 0;
 
 	/* sw back to pg 0 */
 	write_rtl8225(dev, 0, 0xb7);
 
 	return vz2;
-
 }
 
 void rtl8225z2_rf_close(struct net_device *dev)
@@ -469,67 +431,55 @@ void rtl8225z2_rf_close(struct net_devic
 	rtl8185_set_anaparam2(dev, RTL8225z2_ANAPARAM2_OFF);
 }
 
-//
-//	Description:
-//		Map dBm into Tx power index according to
-//		current HW model, for example, RF and PA, and
-//		current wireless mode.
-//
-s8
-DbmToTxPwrIdx(
-	struct r8180_priv *priv,
-	WIRELESS_MODE	WirelessMode,
-	s32			PowerInDbm
-	)
+/*
+ * Map dBm into Tx power index according to current HW model, for example,
+ * RF and PA, and current wireless mode.
+ */
+s8 DbmToTxPwrIdx(struct r8180_priv *priv, WIRELESS_MODE WirelessMode,
+		 s32 PowerInDbm)
 {
  	bool bUseDefault = true;
 	s8 TxPwrIdx = 0;
 
-	//
-	// 071011, SD3 SY:
-	// OFDM Power in dBm = Index * 0.5 + 0
-	// CCK Power in dBm = Index * 0.25 + 13
-	//
-	if(priv->card_8185 >= VERSION_8187S_B)
-	{
+	/*
+	 * OFDM Power in dBm = Index * 0.5 + 0
+	 * CCK Power in dBm = Index * 0.25 + 13
+	 */
+	if (priv->card_8185 >= VERSION_8187S_B) {
 		s32 tmp = 0;
 
-		if(WirelessMode == WIRELESS_MODE_G)
-		{
+		if (WirelessMode == WIRELESS_MODE_G) {
 			bUseDefault = false;
 			tmp = (2 * PowerInDbm);
 
-			if(tmp < 0)
+			if (tmp < 0)
 				TxPwrIdx = 0;
-			else if(tmp > 40) // 40 means 20 dBm.
+			else if (tmp > 40) /* 40 means 20 dBm. */
 				TxPwrIdx = 40;
 			else
 				TxPwrIdx = (s8)tmp;
-		}
-		else if(WirelessMode == WIRELESS_MODE_B)
-		{
+		} else if (WirelessMode == WIRELESS_MODE_B) {
 			bUseDefault = false;
 			tmp = (4 * PowerInDbm) - 52;
 
 			if(tmp < 0)
 				TxPwrIdx = 0;
-			else if(tmp > 28) // 28 means 20 dBm.
+			else if (tmp > 28) /* 28 means 20 dBm. */
 				TxPwrIdx = 28;
 			else
 				TxPwrIdx = (s8)tmp;
 		}
 	}
 
-	//
-	// TRUE if we want to use a default implementation.
-	// We shall set it to FALSE when we have exact translation formular
-	// for target IC. 070622, by rcnjko.
-	//
-	if(bUseDefault)
-	{
-		if(PowerInDbm < 0)
+	/*
+	 * TRUE if we want to use a default implementation.
+	 * We shall set it to FALSE when we have exact translation formular
+	 * for target IC. 070622, by rcnjko.
+	 */
+	if (bUseDefault) {
+		if (PowerInDbm < 0)
 			TxPwrIdx = 0;
-		else if(PowerInDbm > 35)
+		else if (PowerInDbm > 35)
 			TxPwrIdx = 35;
 		else
 			TxPwrIdx = (u8)PowerInDbm;
@@ -541,133 +491,75 @@ DbmToTxPwrIdx(
 void rtl8225z2_SetTXPowerLevel(struct net_device *dev, short ch)
 {
 	struct r8180_priv *priv = ieee80211_priv(dev);
-
-//	int GainIdx;
-//	int GainSetting;
-	//int i;
-	//u8 power;
-	//u8 *cck_power_table;
 	u8 max_cck_power_level;
-	//u8 min_cck_power_level;
 	u8 max_ofdm_power_level;
 	u8 min_ofdm_power_level;
-//	u8 cck_power_level = 0xff & priv->chtxpwr[ch];//-by amy 080312
-//	u8 ofdm_power_level = 0xff & priv->chtxpwr_ofdm[ch];//-by amy 080312
-	char cck_power_level = (char)(0xff & priv->chtxpwr[ch]);//+by amy 080312
-	char ofdm_power_level = (char)(0xff & priv->chtxpwr_ofdm[ch]);//+by amy 080312
-
-	if(IS_DOT11D_ENABLE(priv->ieee80211) &&
-		IS_DOT11D_STATE_DONE(priv->ieee80211) )
-	{
-		//PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(priv->ieee80211);
+	char cck_power_level = (char)(0xff & priv->chtxpwr[ch]);
+	char ofdm_power_level = (char)(0xff & priv->chtxpwr_ofdm[ch]);
+
+	if (IS_DOT11D_ENABLE(priv->ieee80211) &&
+	    IS_DOT11D_STATE_DONE(priv->ieee80211)) {
 		u8 MaxTxPwrInDbm = DOT11D_GetMaxTxPwrInDbm(priv->ieee80211, ch);
 		u8 CckMaxPwrIdx = DbmToTxPwrIdx(priv, WIRELESS_MODE_B, MaxTxPwrInDbm);
 		u8 OfdmMaxPwrIdx = DbmToTxPwrIdx(priv, WIRELESS_MODE_G, MaxTxPwrInDbm);
 
-		//printk("Max Tx Power dBm (%d) => CCK Tx power index : %d, OFDM Tx power index: %d\n", MaxTxPwrInDbm, CckMaxPwrIdx, OfdmMaxPwrIdx);
-
-		//printk("EEPROM channel(%d) => CCK Tx power index: %d, OFDM Tx power index: %d\n",
-		//	ch, cck_power_level, ofdm_power_level);
-
-		if(cck_power_level > CckMaxPwrIdx)
+		if (cck_power_level > CckMaxPwrIdx)
 			cck_power_level = CckMaxPwrIdx;
-		if(ofdm_power_level > OfdmMaxPwrIdx)
+		if (ofdm_power_level > OfdmMaxPwrIdx)
 			ofdm_power_level = OfdmMaxPwrIdx;
 	}
 
-	//priv->CurrentCckTxPwrIdx = cck_power_level;
-	//priv->CurrentOfdmTxPwrIdx = ofdm_power_level;
-
 	max_cck_power_level = 15;
-	max_ofdm_power_level = 25; //  12 -> 25
+	max_ofdm_power_level = 25;
 	min_ofdm_power_level = 10;
 
-
-	if(cck_power_level > 35)
-	{
+	if (cck_power_level > 35)
 		cck_power_level = 35;
-	}
-	//
-	// Set up CCK TXAGC. suggested by SD3 SY.
-	//
-       write_nic_byte(dev, CCK_TXAGC, (ZEBRA2_CCK_OFDM_GAIN_SETTING[(u8)cck_power_level]) );
-       //printk("CCK TX power is %x\n", (ZEBRA2_CCK_OFDM_GAIN_SETTING[cck_power_level]));
-       force_pci_posting(dev);
+
+	write_nic_byte(dev, CCK_TXAGC,
+		       (ZEBRA2_CCK_OFDM_GAIN_SETTING[(u8)cck_power_level]));
+	force_pci_posting(dev);
 	mdelay(1);
-	/* OFDM power setting */
-//  Old:
-//	if(ofdm_power_level > max_ofdm_power_level)
-//		ofdm_power_level = 35;
-//	ofdm_power_level += min_ofdm_power_level;
-//  Latest:
-/*	if(ofdm_power_level > (max_ofdm_power_level - min_ofdm_power_level))
-		ofdm_power_level = max_ofdm_power_level;
-	else
-		ofdm_power_level += min_ofdm_power_level;
 
-	ofdm_power_level += priv->ofdm_txpwr_base;
-*/
-	if(ofdm_power_level > 35)
+	if (ofdm_power_level > 35)
 		ofdm_power_level = 35;
 
-//	rtl8185_set_anaparam2(dev,RTL8225_ANAPARAM2_ON);
-
-	//rtl8185_set_anaparam2(dev, ANAPARM2_ASIC_ON);
-
 	if (priv->up == 0) {
-		//must add these for rtl8185B down, xiong-2006-11-21
-		write_phy_ofdm(dev,2,0x42);
-		write_phy_ofdm(dev,5,0);
-		write_phy_ofdm(dev,6,0x40);
-		write_phy_ofdm(dev,7,0);
-		write_phy_ofdm(dev,8,0x40);
+		write_phy_ofdm(dev, 2, 0x42);
+		write_phy_ofdm(dev, 5, 0x00);
+		write_phy_ofdm(dev, 6, 0x40);
+		write_phy_ofdm(dev, 7, 0x00);
+		write_phy_ofdm(dev, 8, 0x40);
 	}
 
-	//write_nic_byte(dev, TX_GAIN_OFDM, ofdm_power_level);
-	//2005.11.17,
-        write_nic_byte(dev, OFDM_TXAGC, ZEBRA2_CCK_OFDM_GAIN_SETTING[(u8)ofdm_power_level]);
-        if(ofdm_power_level<=11)
-        {
-//            write_nic_dword(dev,PHY_ADR,0x00005c87);
-//            write_nic_dword(dev,PHY_ADR,0x00005c89);
-		write_phy_ofdm(dev,0x07,0x5c);
-		write_phy_ofdm(dev,0x09,0x5c);
-        }
-	if(ofdm_power_level<=17)
-        {
-//             write_nic_dword(dev,PHY_ADR,0x00005487);
-//             write_nic_dword(dev,PHY_ADR,0x00005489);
-		write_phy_ofdm(dev,0x07,0x54);
-		write_phy_ofdm(dev,0x09,0x54);
-        }
-        else
-        {
-//             write_nic_dword(dev,PHY_ADR,0x00005087);
-//             write_nic_dword(dev,PHY_ADR,0x00005089);
-		write_phy_ofdm(dev,0x07,0x50);
-		write_phy_ofdm(dev,0x09,0x50);
+	write_nic_byte(dev, OFDM_TXAGC,
+		       ZEBRA2_CCK_OFDM_GAIN_SETTING[(u8)ofdm_power_level]);
+
+	if (ofdm_power_level <= 11) {
+		write_phy_ofdm(dev, 0x07, 0x5c);
+		write_phy_ofdm(dev, 0x09, 0x5c);
         }
+
+	if (ofdm_power_level <= 17) {
+		write_phy_ofdm(dev, 0x07, 0x54);
+		write_phy_ofdm(dev, 0x09, 0x54);
+	} else {
+		write_phy_ofdm(dev, 0x07, 0x50);
+		write_phy_ofdm(dev, 0x09, 0x50);
+	}
+
 	force_pci_posting(dev);
 	mdelay(1);
-
 }
 
 void rtl8225z2_rf_set_chan(struct net_device *dev, short ch)
 {
-/*
-	short gset = (priv->ieee80211->state == IEEE80211_LINKED &&
-		ieee80211_is_54g(priv->ieee80211->current_network)) ||
-		priv->ieee80211->iw_mode == IW_MODE_MONITOR;
-*/
 	rtl8225z2_SetTXPowerLevel(dev, ch);
 
 	RF_WriteReg(dev, 0x7, rtl8225_chan[ch]);
 
-	//YJ,add,080828, if set channel failed, write again
-	if((RF_ReadReg(dev, 0x7) & 0x0F80) != rtl8225_chan[ch])
-	{
+	if ((RF_ReadReg(dev, 0x7) & 0x0F80) != rtl8225_chan[ch])
 		RF_WriteReg(dev, 0x7, rtl8225_chan[ch]);
-	}
 
 	mdelay(1);
 
@@ -739,8 +631,6 @@ void rtl8225z2_rf_init(struct net_device
 
 	priv->chan = channel;
 
-//	rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
-
 	if (priv->card_type != USB)
 		rtl8225_host_pci_init(dev);
 
@@ -750,74 +640,40 @@ void rtl8225z2_rf_init(struct net_device
 
 	write_nic_word(dev, BRSR, 0xffff);
 
-
 	write_nic_dword(dev, RF_PARA, 0x100044);
 
-	#if 1  //0->1
 	rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
 	write_nic_byte(dev, CONFIG3, 0x44);
 	rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
-	#endif
-
 
 	rtl8185_rf_pins_enable(dev);
 
-//		mdelay(1000);
-
 	write_rtl8225(dev, 0x0, 0x2bf); mdelay(1);
-
-
 	write_rtl8225(dev, 0x1, 0xee0); mdelay(1);
-
 	write_rtl8225(dev, 0x2, 0x44d); mdelay(1);
-
 	write_rtl8225(dev, 0x3, 0x441); mdelay(1);
-
-
-	write_rtl8225(dev, 0x4, 0x8c3);mdelay(1);
-
-
-
-	write_rtl8225(dev, 0x5, 0xc72);mdelay(1);
-//	}
-
+	write_rtl8225(dev, 0x4, 0x8c3); mdelay(1);
+	write_rtl8225(dev, 0x5, 0xc72); mdelay(1);
 	write_rtl8225(dev, 0x6, 0xe6);  mdelay(1);
-
 	write_rtl8225(dev, 0x7, ((priv->card_type == USB)? 0x82a : rtl8225_chan[channel]));  mdelay(1);
-
 	write_rtl8225(dev, 0x8, 0x3f);  mdelay(1);
-
-	write_rtl8225(dev, 0x9, 0x335);  mdelay(1);
-
-	write_rtl8225(dev, 0xa, 0x9d4);  mdelay(1);
-
-	write_rtl8225(dev, 0xb, 0x7bb);  mdelay(1);
-
-	write_rtl8225(dev, 0xc, 0x850);  mdelay(1);
-
-
-	write_rtl8225(dev, 0xd, 0xcdf);   mdelay(1);
-
+	write_rtl8225(dev, 0x9, 0x335); mdelay(1);
+	write_rtl8225(dev, 0xa, 0x9d4); mdelay(1);
+	write_rtl8225(dev, 0xb, 0x7bb); mdelay(1);
+	write_rtl8225(dev, 0xc, 0x850); mdelay(1);
+	write_rtl8225(dev, 0xd, 0xcdf); mdelay(1);
 	write_rtl8225(dev, 0xe, 0x2b);  mdelay(1);
-
 	write_rtl8225(dev, 0xf, 0x114);
 
-
 	mdelay(100);
 
-
-	//if(priv->card_type != USB) /* maybe not needed even for 8185 */
-//	write_rtl8225(dev, 0x7, rtl8225_chan[channel]);
-
 	write_rtl8225(dev, 0x0, 0x1b7);
 
-	for(i=0;i<95;i++){
-		write_rtl8225(dev, 0x1, (u8)(i+1));
-
-		/* version B & C & D*/
-
+	for (i = 0; i < 95; i++) {
+		write_rtl8225(dev, 0x1, (u8)(i + 1));
 		write_rtl8225(dev, 0x2, rtl8225z2_rxgain[i]);
 	}
+
 	write_rtl8225(dev, 0x3, 0x80);
 	write_rtl8225(dev, 0x5, 0x4);
 
@@ -825,160 +681,90 @@ void rtl8225z2_rf_init(struct net_device
 
 	write_rtl8225(dev, 0x2, 0xc4d);
 
-	if(priv->card_type == USB){
-	//	force_pci_posting(dev);
+	if (priv->card_type == USB) {
 		mdelay(200);
 
 		write_rtl8225(dev, 0x2, 0x44d);
-
-	//	force_pci_posting(dev);
 		mdelay(100);
+	}
 
-	}//End of if(priv->card_type == USB)
 	/* FIXME!! rtl8187 we have to check if calibrarion
 	 * is successful and eventually cal. again (repeat
 	 * the two write on reg 2)
-	*/
-	// Check for calibration status, 2005.11.17,
-        data = read_rtl8225(dev, 6);
-        if (!(data&0x00000080))
-        {
-                write_rtl8225(dev, 0x02, 0x0c4d);
-                force_pci_posting(dev); mdelay(200);
-                write_rtl8225(dev, 0x02, 0x044d);
-                force_pci_posting(dev); mdelay(100);
-                data = read_rtl8225(dev, 6);
-                if (!(data&0x00000080))
-                        {
-                                DMESGW("RF Calibration Failed!!!!\n");
-                        }
-        }
-	//force_pci_posting(dev);
-
-	mdelay(200); //200 for 8187
-
+	 */
+	data = read_rtl8225(dev, 6);
+	if (!(data & 0x00000080)) {
+		write_rtl8225(dev, 0x02, 0x0c4d);
+		force_pci_posting(dev); mdelay(200);
+		write_rtl8225(dev, 0x02, 0x044d);
+		force_pci_posting(dev); mdelay(100);
+		data = read_rtl8225(dev, 6);
+		if (!(data & 0x00000080))
+			DMESGW("RF Calibration Failed!!!!\n");
+	}
 
-//	//if(priv->card_type != USB){
-//		write_rtl8225(dev, 0x2, 0x44d);
-//		write_rtl8225(dev, 0x7, rtl8225_chan[channel]);
-//		write_rtl8225(dev, 0x2, 0x47d);
-//
-//		force_pci_posting(dev);
-//		mdelay(100);
-//
-//		write_rtl8225(dev, 0x2, 0x44d);
-//	//}
+	mdelay(200);
 
 	write_rtl8225(dev, 0x0, 0x2bf);
 
-	if(priv->card_type != USB)
+	if (priv->card_type != USB)
 		rtl8185_rf_pins_enable(dev);
-	//set up ZEBRA AGC table, 2005.11.17,
-        for(i=0;i<128;i++){
-                data = rtl8225_agc[i];
 
-                addr = i + 0x80; //enable writing AGC table
-                write_phy_ofdm(dev, 0xb, data);
+	for (i = 0; i < 128; i++) {
+		data = rtl8225_agc[i];
 
-                mdelay(1);
-                write_phy_ofdm(dev, 0xa, addr);
+		addr = i + 0x80; /* enable writing AGC table */
+		write_phy_ofdm(dev, 0xb, data);
+		mdelay(1);
 
-                mdelay(1);
-        }
+		write_phy_ofdm(dev, 0xa, addr);
+		mdelay(1);
+	}
 
 	force_pci_posting(dev);
 	mdelay(1);
 
-	write_phy_ofdm(dev, 0x0, 0x1); mdelay(1);
-	write_phy_ofdm(dev, 0x1, 0x2); mdelay(1);
-	write_phy_ofdm(dev, 0x2, ((priv->card_type == USB)? 0x42 : 0x62)); mdelay(1);
-	write_phy_ofdm(dev, 0x3, 0x0); mdelay(1);
-	write_phy_ofdm(dev, 0x4, 0x0); mdelay(1);
-	write_phy_ofdm(dev, 0x5, 0x0); mdelay(1);
-	write_phy_ofdm(dev, 0x6, 0x40); mdelay(1);
-	write_phy_ofdm(dev, 0x7, 0x0); mdelay(1);
-	write_phy_ofdm(dev, 0x8, 0x40); mdelay(1);
-	write_phy_ofdm(dev, 0x9, 0xfe); mdelay(1);
-
-	write_phy_ofdm(dev, 0xa, 0x8); mdelay(1);
-
-	//write_phy_ofdm(dev, 0x18, 0xef);
-	//	}
-	//}
-	write_phy_ofdm(dev, 0xb, 0x80); mdelay(1);
-
-	write_phy_ofdm(dev, 0xc, 0x1);mdelay(1);
-
-
-	//if(priv->card_type != USB)
-	write_phy_ofdm(dev, 0xd, 0x43);
-
-	write_phy_ofdm(dev, 0xe, 0xd3);mdelay(1);
-
-
-	write_phy_ofdm(dev, 0xf, 0x38);mdelay(1);
-/*ver D & 8187*/
-//	}
-
-//	if(priv->card_8185 == 1 && priv->card_8185_Bversion)
-//		write_phy_ofdm(dev, 0x10, 0x04);/*ver B*/
-//	else
-	write_phy_ofdm(dev, 0x10, 0x84);mdelay(1);
-/*ver C & D & 8187*/
-
-	write_phy_ofdm(dev, 0x11, 0x07);mdelay(1);
-/*agc resp time 700*/
-
-
-//	if(priv->card_8185 == 2){
-	/* Ver D & 8187*/
-	write_phy_ofdm(dev, 0x12, 0x20);mdelay(1);
-
-	write_phy_ofdm(dev, 0x13, 0x20);mdelay(1);
-
-	write_phy_ofdm(dev, 0x14, 0x0); mdelay(1);
+	write_phy_ofdm(dev, 0x00, 0x01); mdelay(1);
+	write_phy_ofdm(dev, 0x01, 0x02); mdelay(1);
+	write_phy_ofdm(dev, 0x02, ((priv->card_type == USB) ? 0x42 : 0x62)); mdelay(1);
+	write_phy_ofdm(dev, 0x03, 0x00); mdelay(1);
+	write_phy_ofdm(dev, 0x04, 0x00); mdelay(1);
+	write_phy_ofdm(dev, 0x05, 0x00); mdelay(1);
+	write_phy_ofdm(dev, 0x06, 0x40); mdelay(1);
+	write_phy_ofdm(dev, 0x07, 0x00); mdelay(1);
+	write_phy_ofdm(dev, 0x08, 0x40); mdelay(1);
+	write_phy_ofdm(dev, 0x09, 0xfe); mdelay(1);
+	write_phy_ofdm(dev, 0x0a, 0x08); mdelay(1);
+	write_phy_ofdm(dev, 0x0b, 0x80); mdelay(1);
+	write_phy_ofdm(dev, 0x0c, 0x01); mdelay(1);
+	write_phy_ofdm(dev, 0x0d, 0x43);
+	write_phy_ofdm(dev, 0x0e, 0xd3); mdelay(1);
+	write_phy_ofdm(dev, 0x0f, 0x38); mdelay(1);
+	write_phy_ofdm(dev, 0x10, 0x84); mdelay(1);
+	write_phy_ofdm(dev, 0x11, 0x07); mdelay(1);
+	write_phy_ofdm(dev, 0x12, 0x20); mdelay(1);
+	write_phy_ofdm(dev, 0x13, 0x20); mdelay(1);
+	write_phy_ofdm(dev, 0x14, 0x00); mdelay(1);
 	write_phy_ofdm(dev, 0x15, 0x40); mdelay(1);
-	write_phy_ofdm(dev, 0x16, 0x0); mdelay(1);
+	write_phy_ofdm(dev, 0x16, 0x00); mdelay(1);
 	write_phy_ofdm(dev, 0x17, 0x40); mdelay(1);
-
-//	if (priv->card_type == USB)
-//		write_phy_ofdm(dev, 0x18, 0xef);
-
-	write_phy_ofdm(dev, 0x18, 0xef);mdelay(1);
-
-
+	write_phy_ofdm(dev, 0x18, 0xef); mdelay(1);
 	write_phy_ofdm(dev, 0x19, 0x19); mdelay(1);
 	write_phy_ofdm(dev, 0x1a, 0x20); mdelay(1);
-	write_phy_ofdm(dev, 0x1b, 0x15);mdelay(1);
-
-	write_phy_ofdm(dev, 0x1c, 0x4);mdelay(1);
-
-	write_phy_ofdm(dev, 0x1d, 0xc5);mdelay(1); //2005.11.17,
-
-	write_phy_ofdm(dev, 0x1e, 0x95);mdelay(1);
-
-	write_phy_ofdm(dev, 0x1f, 0x75);	mdelay(1);
-
-//	}
-
-	write_phy_ofdm(dev, 0x20, 0x1f);mdelay(1);
-
-	write_phy_ofdm(dev, 0x21, 0x17);mdelay(1);
-
-	write_phy_ofdm(dev, 0x22, 0x16);mdelay(1);
-
-//	if(priv->card_type != USB)
-	write_phy_ofdm(dev, 0x23, 0x80);mdelay(1); //FIXME maybe not needed // <>
-
+	write_phy_ofdm(dev, 0x1b, 0x15); mdelay(1);
+	write_phy_ofdm(dev, 0x1c, 0x04); mdelay(1);
+	write_phy_ofdm(dev, 0x1d, 0xc5); mdelay(1);
+	write_phy_ofdm(dev, 0x1e, 0x95); mdelay(1);
+	write_phy_ofdm(dev, 0x1f, 0x75); mdelay(1);
+	write_phy_ofdm(dev, 0x20, 0x1f); mdelay(1);
+	write_phy_ofdm(dev, 0x21, 0x17); mdelay(1);
+	write_phy_ofdm(dev, 0x22, 0x16); mdelay(1);
+	write_phy_ofdm(dev, 0x23, 0x80); mdelay(1); /* FIXME maybe not needed */
 	write_phy_ofdm(dev, 0x24, 0x46); mdelay(1);
 	write_phy_ofdm(dev, 0x25, 0x00); mdelay(1);
 	write_phy_ofdm(dev, 0x26, 0x90); mdelay(1);
-
 	write_phy_ofdm(dev, 0x27, 0x88); mdelay(1);
 
-
-	// <> Set init. gain to m74dBm.
-
 	rtl8225z2_set_gain(dev,4);
 
 	write_phy_cck(dev, 0x0, 0x98); mdelay(1);
@@ -986,90 +772,57 @@ void rtl8225z2_rf_init(struct net_device
 	write_phy_cck(dev, 0x4, 0x7e); mdelay(1);
 	write_phy_cck(dev, 0x5, 0x12); mdelay(1);
 	write_phy_cck(dev, 0x6, 0xfc); mdelay(1);
-
-	write_phy_cck(dev, 0x7, 0x78);mdelay(1);
- /* Ver C & D & 8187*/
-
-	write_phy_cck(dev, 0x8, 0x2e);mdelay(1);
-
+	write_phy_cck(dev, 0x7, 0x78); mdelay(1);
+	write_phy_cck(dev, 0x8, 0x2e); mdelay(1);
 	write_phy_cck(dev, 0x10, ((priv->card_type == USB) ? 0x9b: 0x93)); mdelay(1);
 	write_phy_cck(dev, 0x11, 0x88); mdelay(1);
 	write_phy_cck(dev, 0x12, 0x47); mdelay(1);
-	write_phy_cck(dev, 0x13, 0xd0); /* Ver C & D & 8187*/
-
-	write_phy_cck(dev, 0x19, 0x0);
+	write_phy_cck(dev, 0x13, 0xd0);
+	write_phy_cck(dev, 0x19, 0x00);
 	write_phy_cck(dev, 0x1a, 0xa0);
-	write_phy_cck(dev, 0x1b, 0x8);
+	write_phy_cck(dev, 0x1b, 0x08);
 	write_phy_cck(dev, 0x40, 0x86); /* CCK Carrier Sense Threshold */
-
-	write_phy_cck(dev, 0x41, 0x8d);mdelay(1);
-
-
+	write_phy_cck(dev, 0x41, 0x8d); mdelay(1);
 	write_phy_cck(dev, 0x42, 0x15); mdelay(1);
 	write_phy_cck(dev, 0x43, 0x18); mdelay(1);
-
-
 	write_phy_cck(dev, 0x44, 0x36); mdelay(1);
 	write_phy_cck(dev, 0x45, 0x35); mdelay(1);
 	write_phy_cck(dev, 0x46, 0x2e); mdelay(1);
 	write_phy_cck(dev, 0x47, 0x25); mdelay(1);
 	write_phy_cck(dev, 0x48, 0x1c); mdelay(1);
 	write_phy_cck(dev, 0x49, 0x12); mdelay(1);
-	write_phy_cck(dev, 0x4a, 0x9); mdelay(1);
-	write_phy_cck(dev, 0x4b, 0x4); mdelay(1);
-	write_phy_cck(dev, 0x4c, 0x5);mdelay(1);
-
+	write_phy_cck(dev, 0x4a, 0x09); mdelay(1);
+	write_phy_cck(dev, 0x4b, 0x04); mdelay(1);
+	write_phy_cck(dev, 0x4c, 0x05); mdelay(1);
 
 	write_nic_byte(dev, 0x5b, 0x0d); mdelay(1);
 
-
-
-// <>
-//	// TESTR 0xb 8187
-//	write_phy_cck(dev, 0x10, 0x93);// & 0xfb);
-//
-//	//if(priv->card_type != USB){
-//		write_phy_ofdm(dev, 0x2, 0x62);
-//		write_phy_ofdm(dev, 0x6, 0x0);
-//		write_phy_ofdm(dev, 0x8, 0x0);
-//	//}
-
 	rtl8225z2_SetTXPowerLevel(dev, channel);
-        write_phy_cck(dev, 0x11, 0x9b); mdelay(1); /* Rx ant A, 0xdb for B */
-	write_phy_ofdm(dev, 0x26, 0x90); mdelay(1); /* Rx ant A, 0x10 for B */
 
-	rtl8185_tx_antenna(dev, 0x3); /* TX ant A, 0x0 for B */
+	/* RX antenna default to A */
+	write_phy_cck(dev, 0x11, 0x9b); mdelay(1);		/* B: 0xDB */
+	write_phy_ofdm(dev, 0x26, 0x90); mdelay(1);		/* B: 0x10 */
+
+	rtl8185_tx_antenna(dev, 0x03);				/* B: 0x00 */
 
 	/* switch to high-speed 3-wire
 	 * last digit. 2 for both cck and ofdm
 	 */
-	if(priv->card_type == USB)
+	if (priv->card_type == USB)
 		write_nic_dword(dev, 0x94, 0x3dc00002);
-	else{
+	else {
 		write_nic_dword(dev, 0x94, 0x15c00002);
 		rtl8185_rf_pins_enable(dev);
 	}
 
-//	 rtl8225_set_mode(dev, 1); /* FIXME start in B mode */ // <>
-//
-//	/* make sure is waken up! */
-//	write_rtl8225(dev,0x4, 0x9ff);
-//	rtl8180_set_anaparam(dev, RTL8225_ANAPARAM_ON);
-//	rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
-
 	rtl8225_rf_set_chan(dev, priv->chan);
-
-	//write_nic_word(dev,BRSR,brsr);
-
-	//rtl8225z2_rf_set_mode(dev);
 }
 
 void rtl8225z2_rf_set_mode(struct net_device *dev)
 {
 	struct r8180_priv *priv = ieee80211_priv(dev);
 
-	if(priv->ieee80211->mode == IEEE_A)
-	{
+	if (priv->ieee80211->mode == IEEE_A) {
 		write_rtl8225(dev, 0x5, 0x1865);
 		write_nic_dword(dev, RF_PARA, 0x10084);
 		write_nic_dword(dev, RF_TIMING, 0xa8008);
@@ -1085,8 +838,7 @@ void rtl8225z2_rf_set_mode(struct net_de
 		write_phy_ofdm(dev,0x17, 0x40);
 
 		write_nic_dword(dev, 0x94,0x10000000);
-	}else{
-
+	} else {
 		write_rtl8225(dev, 0x5, 0x1864);
 		write_nic_dword(dev, RF_PARA, 0x10044);
 		write_nic_dword(dev, RF_TIMING, 0xa8008);
@@ -1105,46 +857,35 @@ void rtl8225z2_rf_set_mode(struct net_de
 	}
 }
 
-//lzm mod 080826
-//#define MAX_DOZE_WAITING_TIMES_85B 64
-//#define MAX_POLLING_24F_TIMES_87SE 	5
 #define MAX_DOZE_WAITING_TIMES_85B 		20
-#define MAX_POLLING_24F_TIMES_87SE 			10
+#define MAX_POLLING_24F_TIMES_87SE 		10
 #define LPS_MAX_SLEEP_WAITING_TIMES_87SE 	5
 
-bool
-SetZebraRFPowerState8185(
-	struct net_device *dev,
-	RT_RF_POWER_STATE	eRFPowerState
-	)
+bool SetZebraRFPowerState8185(struct net_device *dev,
+			      RT_RF_POWER_STATE eRFPowerState)
 {
 	struct r8180_priv *priv = ieee80211_priv(dev);
 	u8			btCR9346, btConfig3;
-	bool bActionAllowed= true, bTurnOffBB = true;//lzm mod 080826
-	//u32			DWordContent;
+	bool bActionAllowed = true, bTurnOffBB = true;
 	u8			u1bTmp;
 	int			i;
-	//u16			u2bTFPC = 0;
 	bool		bResult = true;
 	u8			QueueID;
 
-	if(priv->SetRFPowerStateInProgress == true)
+	if (priv->SetRFPowerStateInProgress == true)
 		return false;
 
 	priv->SetRFPowerStateInProgress = true;
 
-	// enable EEM0 and EEM1 in 9346CR
 	btCR9346 = read_nic_byte(dev, CR9346);
-	write_nic_byte(dev, CR9346, (btCR9346|0xC0) );
-	// enable PARM_En in Config3
+	write_nic_byte(dev, CR9346, (btCR9346 | 0xC0));
+
 	btConfig3 = read_nic_byte(dev, CONFIG3);
-	write_nic_byte(dev, CONFIG3, (btConfig3|CONFIG3_PARM_En) );
+	write_nic_byte(dev, CONFIG3, (btConfig3 | CONFIG3_PARM_En));
 
-	switch( priv->rf_chip )
-	{
+	switch (priv->rf_chip) {
 	case RF_ZEBRA2:
-		switch( eRFPowerState )
-		{
+		switch (eRFPowerState) {
 		case eRfOn:
 			RF_WriteReg(dev,0x4,0x9FF);
 
@@ -1153,233 +894,168 @@ SetZebraRFPowerState8185(
 
 			write_nic_byte(dev, CONFIG4, priv->RFProgType);
 
-			//Follow 87B, Isaiah 2007-04-27
+			/* turn on CCK and OFDM */
 			u1bTmp = read_nic_byte(dev, 0x24E);
-			write_nic_byte(dev, 0x24E, (u1bTmp & (~(BIT5|BIT6))) );// 070124 SD1 Alex: turn on CCK and OFDM.
+			write_nic_byte(dev, 0x24E, (u1bTmp & (~(BIT5 | BIT6))));
 			break;
-
 		case eRfSleep:
 			break;
-
 		case eRfOff:
 			break;
-
 		default:
 			bResult = false;
 			break;
 		}
 		break;
-
 	case RF_ZEBRA4:
-		switch( eRFPowerState )
-		{
+		switch (eRFPowerState) {
 		case eRfOn:
-			//printk("===================================power on@jiffies:%d\n",jiffies);
 			write_nic_word(dev, 0x37C, 0x00EC);
 
-			//turn on AFE
+			/* turn on AFE */
 			write_nic_byte(dev, 0x54, 0x00);
 			write_nic_byte(dev, 0x62, 0x00);
 
-			//lzm mod 080826
-			//turn on RF
-			//RF_WriteReg(dev, 0x0, 0x009f); //mdelay(1);
-			//RF_WriteReg(dev, 0x4, 0x0972); //mdelay(1);
+			/* turn on RF */
 			RF_WriteReg(dev, 0x0, 0x009f); udelay(500);
 			RF_WriteReg(dev, 0x4, 0x0972); udelay(500);
-			//turn on RF again, suggested by SD3 stevenl.
+
+			/* turn on RF again */
 			RF_WriteReg(dev, 0x0, 0x009f); udelay(500);
 			RF_WriteReg(dev, 0x4, 0x0972); udelay(500);
 
-			//turn on BB
-//			write_nic_dword(dev, PhyAddr, 0x4090); //ofdm 10=00
-//			write_nic_dword(dev, PhyAddr, 0x4092); //ofdm 12=00
+			/* turn on BB */
 			write_phy_ofdm(dev,0x10,0x40);
 			write_phy_ofdm(dev,0x12,0x40);
-			//Avoid power down at init time.
+
+			/* Avoid power down at init time. */
 			write_nic_byte(dev, CONFIG4, priv->RFProgType);
 
 			u1bTmp = read_nic_byte(dev, 0x24E);
-			write_nic_byte(dev, 0x24E, (u1bTmp & (~(BIT5|BIT6))) );
-
+			write_nic_byte(dev, 0x24E, (u1bTmp & (~(BIT5 | BIT6))));
 			break;
-
 		case eRfSleep:
-			// Make sure BusyQueue is empty befor turn off RFE pwoer.
-			//printk("===================================power sleep@jiffies:%d\n",jiffies);
-
-			for(QueueID = 0, i = 0; QueueID < 6; )
-			{
-				if(get_curr_tx_free_desc(dev,QueueID) == priv->txringcount)
-				{
+			for (QueueID = 0, i = 0; QueueID < 6;) {
+				if (get_curr_tx_free_desc(dev, QueueID) == priv->txringcount) {
 					QueueID++;
 					continue;
-				}
-				else//lzm mod 080826
-				{
+				} else {
 					priv->TxPollingTimes ++;
-					if(priv->TxPollingTimes >= LPS_MAX_SLEEP_WAITING_TIMES_87SE)
-						{
-							//RT_TRACE(COMP_POWER, DBG_WARNING, ("\n\n\n SetZebraRFPowerState8185B():eRfSleep:  %d times TcbBusyQueue[%d] != 0 !!!\n\n\n", LPS_MAX_SLEEP_WAITING_TIMES_87SE, QueueID));
-							bActionAllowed=false;
-							break;
-						}
-						else
-						{
-							udelay(10);  // Windows may delay 3~16ms actually.
-							//RT_TRACE(COMP_POWER, DBG_LOUD, ("eRfSleep: %d times TcbBusyQueue[%d] !=0 before doze!\n", (pMgntInfo->TxPollingTimes), QueueID));
-						}
+					if (priv->TxPollingTimes >= LPS_MAX_SLEEP_WAITING_TIMES_87SE) {
+						bActionAllowed = false;
+						break;
+					} else
+						udelay(10);
 				}
-
-				//lzm del 080826
-				//if(i >= MAX_DOZE_WAITING_TIMES_85B)
-				//{
-					//printk("\n\n\n SetZebraRFPowerState8185B(): %d times BusyQueue[%d] != 0 !!!\n\n\n", MAX_DOZE_WAITING_TIMES_85B, QueueID);
-					//break;
-				//}
 			}
 
-			if(bActionAllowed)//lzm add 080826
-			{
-				//turn off BB RXIQ matrix to cut off rx signal
-//				write_nic_dword(dev, PhyAddr, 0x0090); //ofdm 10=00
-//				write_nic_dword(dev, PhyAddr, 0x0092); //ofdm 12=00
-				write_phy_ofdm(dev,0x10,0x00);
-				write_phy_ofdm(dev,0x12,0x00);
-				//turn off RF
-				RF_WriteReg(dev, 0x4, 0x0000); //mdelay(1);
-				RF_WriteReg(dev, 0x0, 0x0000); //mdelay(1);
-				//turn off AFE except PLL
+			if (bActionAllowed) {
+				/* turn off BB RXIQ matrix to cut off rx signal */
+				write_phy_ofdm(dev, 0x10, 0x00);
+				write_phy_ofdm(dev, 0x12, 0x00);
+
+				/* turn off RF */
+				RF_WriteReg(dev, 0x4, 0x0000);
+				RF_WriteReg(dev, 0x0, 0x0000);
+
+				/* turn off AFE except PLL */
 				write_nic_byte(dev, 0x62, 0xff);
 				write_nic_byte(dev, 0x54, 0xec);
-//				mdelay(10);
 
-#if 1
 				mdelay(1);
+
 				{
 					int i = 0;
-					while (true)
-					{
+					while (true) {
 						u8 tmp24F = read_nic_byte(dev, 0x24f);
-						if ((tmp24F == 0x01) || (tmp24F == 0x09))
-						{
+
+						if ((tmp24F == 0x01) || (tmp24F == 0x09)) {
 							bTurnOffBB = true;
 							break;
-						}
-						else//lzm mod 080826
-						{
+						} else {
 							udelay(10);
 							i++;
 							priv->TxPollingTimes++;
 
-							if(priv->TxPollingTimes >= LPS_MAX_SLEEP_WAITING_TIMES_87SE)
-							{
-								//RT_TRACE(COMP_POWER, DBG_WARNING, ("\n\n\n SetZebraRFPowerState8185B(): eRfOff: %d times Rx Mac0x24F=0x%x !!!\n\n\n", i, u1bTmp24F));
-								bTurnOffBB=false;
+							if (priv->TxPollingTimes >= LPS_MAX_SLEEP_WAITING_TIMES_87SE) {
+								bTurnOffBB = false;
 								break;
-							}
-							else
-							{
-								udelay(10);// Windows may delay 3~16ms actually.
-								//RT_TRACE(COMP_POWER, DBG_LOUD,("(%d)eRfSleep- u1bTmp24F= 0x%X\n", i, u1bTmp24F));
-
-							}
+							} else
+								udelay(10);
 						}
-
-						//lzm del 080826
-						//if (i > MAX_POLLING_24F_TIMES_87SE)
-						//	break;
 					}
 				}
-#endif
-				if (bTurnOffBB)//lzm mod 080826
-				{
-				//turn off BB
-				u1bTmp = read_nic_byte(dev, 0x24E);
-				write_nic_byte(dev, 0x24E, (u1bTmp|BIT5|BIT6));
 
-				//turn off AFE PLL
-				//write_nic_byte(dev, 0x54, 0xec);
-				//write_nic_word(dev, 0x37C, 0x00ec);
-				write_nic_byte(dev, 0x54, 0xFC);  //[ECS] FC-> EC->FC, asked by SD3 Stevenl
-				write_nic_word(dev, 0x37C, 0x00FC);//[ECS] FC-> EC->FC, asked by SD3 Stevenl
+				if (bTurnOffBB) {
+					/* turn off BB */
+					u1bTmp = read_nic_byte(dev, 0x24E);
+					write_nic_byte(dev, 0x24E, (u1bTmp | BIT5 | BIT6));
+
+					/* turn off AFE PLL */
+					write_nic_byte(dev, 0x54, 0xFC);
+					write_nic_word(dev, 0x37C, 0x00FC);
 				}
 			}
 			break;
-
 		case eRfOff:
-			// Make sure BusyQueue is empty befor turn off RFE pwoer.
-			//printk("===================================power off@jiffies:%d\n",jiffies);
-			for(QueueID = 0, i = 0; QueueID < 6; )
-			{
-				if(get_curr_tx_free_desc(dev,QueueID) == priv->txringcount)
-				{
+			for (QueueID = 0, i = 0; QueueID < 6;) {
+				if (get_curr_tx_free_desc(dev, QueueID) == priv->txringcount) {
 					QueueID++;
 					continue;
-				}
-				else
-				{
+				} else {
 					udelay(10);
 					i++;
 				}
 
-				if(i >= MAX_DOZE_WAITING_TIMES_85B)
-				{
-					//printk("\n\n\n SetZebraRFPowerState8185B(): %d times BusyQueue[%d] != 0 !!!\n\n\n", MAX_DOZE_WAITING_TIMES_85B, QueueID);
+				if (i >= MAX_DOZE_WAITING_TIMES_85B)
 					break;
-				}
 			}
 
-			//turn off BB RXIQ matrix to cut off rx signal
-//			write_nic_dword(dev, PhyAddr, 0x0090); //ofdm 10=00
-//			write_nic_dword(dev, PhyAddr, 0x0092); //ofdm 12=00
-			write_phy_ofdm(dev,0x10,0x00);
-			write_phy_ofdm(dev,0x12,0x00);
-			//turn off RF
-			RF_WriteReg(dev, 0x4, 0x0000); //mdelay(1);
-			RF_WriteReg(dev, 0x0, 0x0000); //mdelay(1);
-			//turn off AFE except PLL
+			/* turn off BB RXIQ matrix to cut off rx signal */
+			write_phy_ofdm(dev, 0x10, 0x00);
+			write_phy_ofdm(dev, 0x12, 0x00);
+
+			/* turn off RF */
+			RF_WriteReg(dev, 0x4, 0x0000);
+			RF_WriteReg(dev, 0x0, 0x0000);
+
+			/* turn off AFE except PLL */
 			write_nic_byte(dev, 0x62, 0xff);
 			write_nic_byte(dev, 0x54, 0xec);
-//			mdelay(10);
-#if 1
+
 			mdelay(1);
+
 			{
 				int i = 0;
+
 				while (true)
 				{
 					u8 tmp24F = read_nic_byte(dev, 0x24f);
-					if ((tmp24F == 0x01) || (tmp24F == 0x09))
-					{
+
+					if ((tmp24F == 0x01) || (tmp24F == 0x09)) {
 						bTurnOffBB = true;
 						break;
-					}
-					else
-					{
+					} else {
 						bTurnOffBB = false;
 						udelay(10);
 						i++;
 					}
+
 					if (i > MAX_POLLING_24F_TIMES_87SE)
 						break;
 				}
 			}
-#endif
-			if (bTurnOffBB)//lzm mod 080826
-			{
 
-			//turn off BB
-			u1bTmp = read_nic_byte(dev, 0x24E);
-			write_nic_byte(dev, 0x24E, (u1bTmp|BIT5|BIT6));
-			//turn off AFE PLL (80M)
-			//write_nic_byte(dev, 0x54, 0xec);
-			//write_nic_word(dev, 0x37C, 0x00ec);
-			write_nic_byte(dev, 0x54, 0xFC); //[ECS] FC-> EC->FC, asked by SD3 Stevenl
-			write_nic_word(dev, 0x37C, 0x00FC); //[ECS] FC-> EC->FC, asked by SD3 Stevenl
-			}
+			if (bTurnOffBB) {
+				/* turn off BB */
+				u1bTmp = read_nic_byte(dev, 0x24E);
+				write_nic_byte(dev, 0x24E, (u1bTmp | BIT5 | BIT6));
 
+				/* turn off AFE PLL (80M) */
+				write_nic_byte(dev, 0x54, 0xFC);
+				write_nic_word(dev, 0x37C, 0x00FC);
+			}
 			break;
-
 		default:
 			bResult = false;
 			printk("SetZebraRFPowerState8185(): unknow state to set: 0x%X!!!\n", eRFPowerState);
@@ -1388,38 +1064,26 @@ SetZebraRFPowerState8185(
 		break;
 	}
 
-	// disable PARM_En in Config3
 	btConfig3 &= ~(CONFIG3_PARM_En);
 	write_nic_byte(dev, CONFIG3, btConfig3);
-	// disable EEM0 and EEM1 in 9346CR
+
 	btCR9346 &= ~(0xC0);
 	write_nic_byte(dev, CR9346, btCR9346);
 
-	if(bResult && bActionAllowed)//lzm mod 080826
-	{
-		// Update current RF state variable.
+	if (bResult && bActionAllowed)
 		priv->eRFPowerState = eRFPowerState;
-	}
 
 	priv->SetRFPowerStateInProgress = false;
 
-	return (bResult && bActionAllowed) ;
+	return bResult && bActionAllowed;
 }
+
 void rtl8225z4_rf_sleep(struct net_device *dev)
 {
-	//
-	// Turn off RF power.
-	//
-	//printk("=========>%s()\n", __func__);
 	MgntActSet_RF_State(dev, eRfSleep, RF_CHANGE_BY_PS);
-	//mdelay(2);	//FIXME
 }
+
 void rtl8225z4_rf_wakeup(struct net_device *dev)
 {
-	//
-	// Turn on RF power.
-	//
-	//printk("=========>%s()\n", __func__);
 	MgntActSet_RF_State(dev, eRfOn, RF_CHANGE_BY_PS);
 }
-

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 18/18] Staging: rtl8187se: cleanup r8180_core.c
  2009-06-28 14:18 [PATCH 01/18] Staging: rtl8187se: remove ENABLE_DOT11D ifdefs Bartlomiej Zolnierkiewicz
                   ` (15 preceding siblings ...)
  2009-06-28 14:20 ` [PATCH 17/18] Staging: rtl8187se: cleanup r8180_rtl8225z2.c Bartlomiej Zolnierkiewicz
@ 2009-06-28 14:20 ` Bartlomiej Zolnierkiewicz
  16 siblings, 0 replies; 18+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2009-06-28 14:20 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Bartlomiej Zolnierkiewicz, linux-kernel

From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] Staging: rtl8187se: cleanup r8180_core.c

* remove commented out code
* remove useless comments
* beautify code

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/staging/rtl8187se/r8180_core.c | 1412 +++++----------------------------
 1 file changed, 245 insertions(+), 1167 deletions(-)

Index: b/drivers/staging/rtl8187se/r8180_core.c
===================================================================
--- a/drivers/staging/rtl8187se/r8180_core.c
+++ b/drivers/staging/rtl8187se/r8180_core.c
@@ -31,8 +31,7 @@
 #undef DUMMY_RX
 
 #include <linux/syscalls.h>
-//#include <linux/fcntl.h>
-//#include <asm/uaccess.h>
+
 #include "r8180_hw.h"
 #include "r8180.h"
 #include "r8180_rtl8225.h" /* RTL8225 Radio frontend */
@@ -52,7 +51,6 @@
 static struct pci_device_id rtl8180_pci_id_tbl[] __devinitdata = {
         {
                 .vendor = PCI_VENDOR_ID_REALTEK,
-//                .device = 0x8180,
                 .device = 0x8199,
                 .subvendor = PCI_ANY_ID,
                 .subdevice = PCI_ANY_ID,
@@ -70,7 +68,6 @@ static struct pci_device_id rtl8180_pci_
 
 static char* ifname = "wlan%d";
 static int hwseqnum = 0;
-//static char* ifname = "ath%d";
 static int hwwep = 0;
 static int channels = 0x3fff;
 
@@ -82,28 +79,12 @@ MODULE_AUTHOR("Andrea Merello <andreamrl
 MODULE_DESCRIPTION("Linux driver for Realtek RTL8180 / RTL8185 WiFi cards");
 
 
-
-/*
-MODULE_PARM(ifname, "s");
-MODULE_PARM_DESC(devname," Net interface name, wlan%d=default");
-
-MODULE_PARM(hwseqnum,"i");
-MODULE_PARM_DESC(hwseqnum," Try to use hardware 802.11 header sequence numbers. Zero=default");
-
-MODULE_PARM(hwwep,"i");
-MODULE_PARM_DESC(hwwep," Try to use hardware WEP support. Still broken and not available on all cards");
-
-MODULE_PARM(channels,"i");
-MODULE_PARM_DESC(channels," Channel bitmask for specific locales. NYI");
-*/
-
 module_param(ifname, charp, S_IRUGO|S_IWUSR );
 module_param(hwseqnum,int, S_IRUGO|S_IWUSR);
 module_param(hwwep,int, S_IRUGO|S_IWUSR);
 module_param(channels,int, S_IRUGO|S_IWUSR);
 
 MODULE_PARM_DESC(devname," Net interface name, wlan%d=default");
-//MODULE_PARM_DESC(devname," Net interface name, ath%d=default");
 MODULE_PARM_DESC(hwseqnum," Try to use hardware 802.11 header sequence numbers. Zero=default");
 MODULE_PARM_DESC(hwwep," Try to use hardware WEP support. Still broken and not available on all cards");
 MODULE_PARM_DESC(channels," Channel bitmask for specific locales. NYI");
@@ -181,18 +162,15 @@ out:
 }
 
 static struct pci_driver rtl8180_pci_driver = {
-	.name		= RTL8180_MODULE_NAME,	          /* Driver name   */
-	.id_table	= rtl8180_pci_id_tbl,	          /* PCI_ID table  */
-	.probe		= rtl8180_pci_probe,	          /* probe fn      */
-	.remove		= __devexit_p(rtl8180_pci_remove),/* remove fn     */
-	.suspend	= rtl8180_suspend,	          /* PM suspend fn */
-	.resume		= rtl8180_resume,                 /* PM resume fn  */
+	.name		= RTL8180_MODULE_NAME,
+	.id_table	= rtl8180_pci_id_tbl,
+	.probe		= rtl8180_pci_probe,
+	.remove		= __devexit_p(rtl8180_pci_remove),
+	.suspend	= rtl8180_suspend,
+	.resume		= rtl8180_resume,
 	.shutdown	= rtl8180_shutdown,
 };
 
-
-
-
 u8 read_nic_byte(struct net_device *dev, int x)
 {
         return 0xff&readb((u8*)dev->mem_start +x);
@@ -226,18 +204,12 @@ void write_nic_word(struct net_device *d
 	udelay(20);
 }
 
-
-
-
-
-
 inline void force_pci_posting(struct net_device *dev)
 {
 	read_nic_byte(dev,EPROM_CMD);
 	mb();
 }
 
-
 irqreturn_t rtl8180_interrupt(int irq, void *netdev, struct pt_regs *regs);
 void set_nic_rxring(struct net_device *dev);
 void set_nic_txring(struct net_device *dev);
@@ -245,10 +217,6 @@ static struct net_device_stats *rtl8180_
 void rtl8180_commit(struct net_device *dev);
 void rtl8180_start_tx_beacon(struct net_device *dev);
 
-/****************************************************************************
-   -----------------------------PROCFS STUFF-------------------------
-*****************************************************************************/
-
 static struct proc_dir_entry *rtl8180_proc = NULL;
 
 static int proc_get_registers(char *page, char **start,
@@ -256,33 +224,22 @@ static int proc_get_registers(char *page
 			  int *eof, void *data)
 {
 	struct net_device *dev = data;
-//	struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
 	int len = 0;
 	int i,n;
-
-	int max=0xff;
+	int max = 0xff;
 
 	/* This dump the current register page */
-	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,n));
+	for (n = 0; n <= max;) {
+		len += snprintf(page + len, count - len, "\nD:  %2x > ", n);
 
-		//	printk("%2x ",read_nic_byte(dev,n));
+		for (i = 0; i < 16 && n <= max; i++, n++)
+			len += snprintf(page + len, count - len, "%2x ",
+					read_nic_byte(dev, n));
 	}
 	len += snprintf(page + len, count - len,"\n");
 
-
-
 	*eof = 1;
 	return len;
-
 }
 
 int get_curr_tx_free_desc(struct net_device *dev, int priority);
@@ -291,16 +248,12 @@ static int proc_get_stats_hw(char *page,
 			  off_t offset, int count,
 			  int *eof, void *data)
 {
-	//struct net_device *dev = data;
-	//struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
 	int len = 0;
 
 	*eof = 1;
 	return len;
 }
 
-
 static int proc_get_stats_rx(char *page, char **start,
 			  off_t offset, int count,
 			  int *eof, void *data)
@@ -311,30 +264,6 @@ static int proc_get_stats_rx(char *page,
 	int len = 0;
 
 	len += snprintf(page + len, count - len,
-	/*	"RX descriptor not available: %lu\n"
-		"RX incomplete (missing last descriptor): %lu\n"
-		"RX not data: %lu\n"
-		//"RX descriptor pointer reset: %lu\n"
-		"RX descriptor pointer lost: %lu\n"
-		//"RX pointer workaround: %lu\n"
-		"RX error int: %lu\n"
-		"RX fifo overflow: %lu\n"
-		"RX int: %lu\n"
-		"RX packet: %lu\n"
-		"RX bytes: %lu\n"
-		"RX DMA fail: %lu\n",
-		priv->stats.rxrdu,
-		priv->stats.rxnolast,
-		priv->stats.rxnodata,
-		//priv->stats.rxreset,
-		priv->stats.rxnopointer,
-		//priv->stats.rxwrkaround,
-		priv->stats.rxerr,
-		priv->stats.rxoverflow,
-		priv->stats.rxint,
-		priv->ieee80211->stats.rx_packets,
-		priv->ieee80211->stats.rx_bytes,
-		priv->stats.rxdmafail  */
 		"RX OK: %lu\n"
 		"RX Retry: %lu\n"
 		"RX CRC Error(0-500): %lu\n"
@@ -365,36 +294,6 @@ static int proc_get_stats_tx(char *page,
 
 	totalOK=priv->stats.txnpokint+priv->stats.txhpokint+priv->stats.txlpokint;
 	len += snprintf(page + len, count - len,
-	/*	"TX normal priority ok int: %lu\n"
-		"TX normal priority error int: %lu\n"
-		"TX high priority ok int: %lu\n"
-		"TX high priority failed error int: %lu\n"
-		"TX low priority ok int: %lu\n"
-		"TX low priority failed error int: %lu\n"
-		"TX bytes: %lu\n"
-		"TX packets: %lu\n"
-		"TX queue resume: %lu\n"
-		"TX queue stopped?: %d\n"
-		"TX fifo overflow: %lu\n"
-		//"SW TX stop: %lu\n"
-		//"SW TX wake: %lu\n"
-		"TX beacon: %lu\n"
-		"TX beacon aborted: %lu\n",
-		priv->stats.txnpokint,
-		priv->stats.txnperr,
-		priv->stats.txhpokint,
-		priv->stats.txhperr,
-		priv->stats.txlpokint,
-		priv->stats.txlperr,
-		priv->ieee80211->stats.tx_bytes,
-		priv->ieee80211->stats.tx_packets,
-		priv->stats.txresumed,
-		netif_queue_stopped(dev),
-		priv->stats.txoverflow,
-		//priv->ieee80211->ieee_stats.swtxstop,
-		//priv->ieee80211->ieee_stats.swtxawake,
-		priv->stats.txbeacon,
-		priv->stats.txbeaconerr  */
 		"TX OK: %lu\n"
 		"TX Error: %lu\n"
 		"TX Retry: %lu\n"
@@ -417,13 +316,11 @@ void rtl8180_proc_module_init(void)
         rtl8180_proc=create_proc_entry(RTL8180_MODULE_NAME, S_IFDIR, init_net.proc_net);
 }
 
-
 void rtl8180_proc_module_remove(void)
 {
         remove_proc_entry(RTL8180_MODULE_NAME, init_net.proc_net);
 }
 
-
 void rtl8180_proc_remove_one(struct net_device *dev)
 {
 	struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
@@ -431,19 +328,17 @@ void rtl8180_proc_remove_one(struct net_
 		remove_proc_entry("stats-hw", priv->dir_dev);
 		remove_proc_entry("stats-tx", priv->dir_dev);
 		remove_proc_entry("stats-rx", priv->dir_dev);
-//		remove_proc_entry("stats-ieee", priv->dir_dev);
-//		remove_proc_entry("stats-ap", priv->dir_dev);
 		remove_proc_entry("registers", priv->dir_dev);
 		remove_proc_entry(dev->name, rtl8180_proc);
 		priv->dir_dev = NULL;
 	}
 }
 
-
 void rtl8180_proc_init_one(struct net_device *dev)
 {
 	struct proc_dir_entry *e;
 	struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+
 	priv->dir_dev = rtl8180_proc;
 	if (!priv->dir_dev) {
 		DMESGE("Unable to initialize /proc/net/r8180/%s\n",
@@ -453,7 +348,6 @@ void rtl8180_proc_init_one(struct net_de
 
 	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/r8180/%s/stats-hw\n",
@@ -462,7 +356,6 @@ void rtl8180_proc_init_one(struct net_de
 
 	e = create_proc_read_entry("stats-rx", S_IFREG | S_IRUGO,
 				   priv->dir_dev, proc_get_stats_rx, dev);
-
 	if (!e) {
 		DMESGE("Unable to initialize "
 		      "/proc/net/r8180/%s/stats-rx\n",
@@ -472,7 +365,6 @@ void rtl8180_proc_init_one(struct net_de
 
 	e = create_proc_read_entry("stats-tx", S_IFREG | S_IRUGO,
 				   priv->dir_dev, proc_get_stats_tx, dev);
-
 	if (!e) {
 		DMESGE("Unable to initialize "
 		      "/proc/net/r8180/%s/stats-tx\n",
@@ -481,16 +373,13 @@ void rtl8180_proc_init_one(struct net_de
 
 	e = create_proc_read_entry("registers", S_IFREG | S_IRUGO,
 				   priv->dir_dev, proc_get_registers, dev);
-
 	if (!e) {
 		DMESGE("Unable to initialize "
 		      "/proc/net/r8180/%s/registers\n",
 		      dev->name);
 	}
 }
-/****************************************************************************
-   -----------------------------MISC STUFF-------------------------
-*****************************************************************************/
+
 /*
   FIXME: check if we can use some standard already-existent
   data type+functions in kernel
@@ -530,7 +419,6 @@ short buffer_add(struct buffer **buffer,
 	return 0;
 }
 
-
 void buffer_free(struct net_device *dev,struct buffer **buffer,int len,short
 consistent)
 {
@@ -538,14 +426,12 @@ consistent)
 	struct buffer *tmp,*next;
 	struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
 	struct pci_dev *pdev=priv->pdev;
-	//int i;
 
-	if(! *buffer) return;
+	if (!*buffer)
+		return;
 
-	/*for(tmp=*buffer; tmp->next != *buffer; tmp=tmp->next)
+	tmp = *buffer;
 
-	*/
-	tmp=*buffer;
 	do{
 		next=tmp->next;
 		if(consistent){
@@ -564,7 +450,6 @@ consistent)
 	*buffer=NULL;
 }
 
-
 void print_buffer(u32 *buffer, int len)
 {
 	int i;
@@ -583,7 +468,6 @@ void print_buffer(u32 *buffer, int len)
 	printk("\n");
 }
 
-
 int get_curr_tx_free_desc(struct net_device *dev, int priority)
 {
 	struct r8180_priv *priv = ieee80211_priv(dev);
@@ -620,34 +504,33 @@ int get_curr_tx_free_desc(struct net_dev
 			return -1;
 	}
 
-	//DMESG("%x %x", head, tail);
-
-	/* FIXME FIXME FIXME FIXME */
-
-	if( head <= tail )
+	if (head <= tail)
 		ret = priv->txringcount - (tail - head)/8;
 	else
 		ret = (head - tail)/8;
 
-	if(ret > priv->txringcount ) DMESG("BUG");
+	if (ret > priv->txringcount)
+		DMESG("BUG");
+
 	return ret;
 }
 
-
 short check_nic_enought_desc(struct net_device *dev, int priority)
 {
 	struct r8180_priv *priv = ieee80211_priv(dev);
 	struct ieee80211_device *ieee = netdev_priv(dev);
-
 	int requiredbyte, required;
+
 	requiredbyte = priv->ieee80211->fts + sizeof(struct ieee80211_header_data);
 
-	if(ieee->current_network.QoS_Enable) {
+	if (ieee->current_network.QoS_Enable)
 		requiredbyte += 2;
-	};
 
 	required = requiredbyte / (priv->txbuffsize-4);
-	if (requiredbyte % priv->txbuffsize) required++;
+
+	if (requiredbyte % priv->txbuffsize)
+		required++;
+
 	/* for now we keep two free descriptor as a safety boundary
 	 * between the tail and the head
 	 */
@@ -734,7 +617,6 @@ void fix_tx_fifo(struct net_device *dev)
 	priv->ack_tx_to_ieee = 0;
 }
 
-
 void fix_rx_fifo(struct net_device *dev)
 {
 	struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
@@ -759,39 +641,34 @@ void fix_rx_fifo(struct net_device *dev)
 	set_nic_rxring(dev);
 }
 
-
-/****************************************************************************
-      ------------------------------HW STUFF---------------------------
-*****************************************************************************/
-
 unsigned char QUALITY_MAP[] = {
-  0x64, 0x64, 0x64, 0x63, 0x63, 0x62, 0x62, 0x61,
-  0x61, 0x60, 0x60, 0x5f, 0x5f, 0x5e, 0x5d, 0x5c,
-  0x5b, 0x5a, 0x59, 0x57, 0x56, 0x54, 0x52, 0x4f,
-  0x4c, 0x49, 0x45, 0x41, 0x3c, 0x37, 0x31, 0x29,
-  0x24, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
-  0x22, 0x22, 0x21, 0x21, 0x21, 0x21, 0x21, 0x20,
-  0x20, 0x20, 0x20, 0x1f, 0x1f, 0x1e, 0x1e, 0x1e,
-  0x1d, 0x1d, 0x1c, 0x1c, 0x1b, 0x1a, 0x19, 0x19,
-  0x18, 0x17, 0x16, 0x15, 0x14, 0x12, 0x11, 0x0f,
-  0x0e, 0x0c, 0x0a, 0x08, 0x06, 0x04, 0x01, 0x00
+	0x64, 0x64, 0x64, 0x63, 0x63, 0x62, 0x62, 0x61,
+	0x61, 0x60, 0x60, 0x5f, 0x5f, 0x5e, 0x5d, 0x5c,
+	0x5b, 0x5a, 0x59, 0x57, 0x56, 0x54, 0x52, 0x4f,
+	0x4c, 0x49, 0x45, 0x41, 0x3c, 0x37, 0x31, 0x29,
+	0x24, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
+	0x22, 0x22, 0x21, 0x21, 0x21, 0x21, 0x21, 0x20,
+	0x20, 0x20, 0x20, 0x1f, 0x1f, 0x1e, 0x1e, 0x1e,
+	0x1d, 0x1d, 0x1c, 0x1c, 0x1b, 0x1a, 0x19, 0x19,
+	0x18, 0x17, 0x16, 0x15, 0x14, 0x12, 0x11, 0x0f,
+	0x0e, 0x0c, 0x0a, 0x08, 0x06, 0x04, 0x01, 0x00
 };
 
 unsigned char STRENGTH_MAP[] = {
-  0x64, 0x64, 0x63, 0x62, 0x61, 0x60, 0x5f, 0x5e,
-  0x5d, 0x5c, 0x5b, 0x5a, 0x57, 0x54, 0x52, 0x50,
-  0x4e, 0x4c, 0x4a, 0x48, 0x46, 0x44, 0x41, 0x3f,
-  0x3c, 0x3a, 0x37, 0x36, 0x36, 0x1c, 0x1c, 0x1b,
-  0x1b, 0x1a, 0x1a, 0x19, 0x19, 0x18, 0x18, 0x17,
-  0x17, 0x16, 0x16, 0x15, 0x15, 0x14, 0x14, 0x13,
-  0x13, 0x12, 0x12, 0x11, 0x11, 0x10, 0x10, 0x0f,
-  0x0f, 0x0e, 0x0e, 0x0d, 0x0d, 0x0c, 0x0c, 0x0b,
-  0x0b, 0x0a, 0x0a, 0x09, 0x09, 0x08, 0x08, 0x07,
-  0x07, 0x06, 0x06, 0x05, 0x04, 0x03, 0x02, 0x00
+	0x64, 0x64, 0x63, 0x62, 0x61, 0x60, 0x5f, 0x5e,
+	0x5d, 0x5c, 0x5b, 0x5a, 0x57, 0x54, 0x52, 0x50,
+	0x4e, 0x4c, 0x4a, 0x48, 0x46, 0x44, 0x41, 0x3f,
+	0x3c, 0x3a, 0x37, 0x36, 0x36, 0x1c, 0x1c, 0x1b,
+	0x1b, 0x1a, 0x1a, 0x19, 0x19, 0x18, 0x18, 0x17,
+	0x17, 0x16, 0x16, 0x15, 0x15, 0x14, 0x14, 0x13,
+	0x13, 0x12, 0x12, 0x11, 0x11, 0x10, 0x10, 0x0f,
+	0x0f, 0x0e, 0x0e, 0x0d, 0x0d, 0x0c, 0x0c, 0x0b,
+	0x0b, 0x0a, 0x0a, 0x09, 0x09, 0x08, 0x08, 0x07,
+	0x07, 0x06, 0x06, 0x05, 0x04, 0x03, 0x02, 0x00
 };
 
-void rtl8180_RSSI_calc(struct net_device *dev, u8 *rssi, u8 *qual){
-	//void Mlme_UpdateRssiSQ(struct net_device *dev, u8 *rssi, u8 *qual){
+void rtl8180_RSSI_calc(struct net_device *dev, u8 *rssi, u8 *qual)
+{
 	struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
 	u32 temp;
 	u32 temp2;
@@ -887,8 +764,6 @@ void rtl8180_RSSI_calc(struct net_device
 			}
 		}
 		break;
-
-	/* case 4 */
 	case RFCHIPID_MAXIM:
 		lsb = temp2 & 1;
 		temp2 &= 0x7e;
@@ -913,21 +788,14 @@ void rtl8180_RSSI_calc(struct net_device
 	return;
 }
 
-
 void rtl8180_irq_enable(struct net_device *dev)
 {
 	struct r8180_priv *priv = (struct r8180_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 |\
-	INTA_NORMPRIORITYDESCERR | INTA_NORMPRIORITYDESCOK |\
-	INTA_LOWPRIORITYDESCERR | INTA_LOWPRIORITYDESCOK | INTA_TIMEOUT);
-*/
 	write_nic_word(dev,INTA_MASK, priv->irq_mask);
 }
 
-
 void rtl8180_irq_disable(struct net_device *dev)
 {
 	struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
@@ -937,10 +805,10 @@ void rtl8180_irq_disable(struct net_devi
 	priv->irq_enabled = 0;
 }
 
-
 void rtl8180_set_mode(struct net_device *dev,int mode)
 {
 	u8 ecmd;
+
 	ecmd=read_nic_byte(dev, EPROM_CMD);
 	ecmd=ecmd &~ EPROM_CMD_OPERATING_MODE_MASK;
 	ecmd=ecmd | (mode<<EPROM_CMD_OPERATING_MODE_SHIFT);
@@ -982,28 +850,21 @@ void rtl8180_update_msr(struct net_devic
 
 	write_nic_byte(dev, MSR, msr);
 	write_nic_dword(dev, RX_CONF, rxconf);
-
 }
 
-
-
 void rtl8180_set_chan(struct net_device *dev,short ch)
 {
 	struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
 
-	if((ch > 14) || (ch < 1))
-	{
+	if ((ch > 14) || (ch < 1)) {
 		printk("In %s: Invalid chnanel %d\n", __func__, ch);
 		return;
 	}
 
 	priv->chan=ch;
-	//printk("in %s:channel is %d\n",__func__,ch);
 	priv->rf_set_chan(dev,priv->chan);
-
 }
 
-
 void rtl8180_rx_enable(struct net_device *dev)
 {
 	u8 cmd;
@@ -1017,8 +878,8 @@ void rtl8180_rx_enable(struct net_device
 	rxconf = rxconf | (1<<ACCEPT_DATA_FRAME_SHIFT);
 	rxconf = rxconf | (1<<ACCEPT_BCAST_FRAME_SHIFT);
 	rxconf = rxconf | (1<<ACCEPT_MCAST_FRAME_SHIFT);
-//	rxconf = rxconf | (1<<ACCEPT_CRCERR_FRAME_SHIFT);
-	if (dev->flags & IFF_PROMISC) DMESG ("NIC in promisc mode");
+	if (dev->flags & IFF_PROMISC)
+		DMESG("NIC in promisc mode");
 
 	if(priv->ieee80211->iw_mode == IW_MODE_MONITOR || \
 	   dev->flags & IFF_PROMISC){
@@ -1029,11 +890,6 @@ void rtl8180_rx_enable(struct net_device
 			rxconf = rxconf | (1<<RX_CHECK_BSSID_SHIFT);
 	}
 
-	/*if(priv->ieee80211->iw_mode == IW_MODE_MASTER){
-		rxconf = rxconf | (1<<ACCEPT_ALLMAC_FRAME_SHIFT);
-		rxconf = rxconf | (1<<RX_CHECK_BSSID_SHIFT);
-	}*/
-
 	if(priv->ieee80211->iw_mode == IW_MODE_MONITOR){
 		rxconf = rxconf | (1<<ACCEPT_CTL_FRAME_SHIFT);
 		rxconf = rxconf | (1<<ACCEPT_ICVERR_FRAME_SHIFT);
@@ -1043,81 +899,61 @@ void rtl8180_rx_enable(struct net_device
 	if( priv->crcmon == 1 && priv->ieee80211->iw_mode == IW_MODE_MONITOR)
 		rxconf = rxconf | (1<<ACCEPT_CRCERR_FRAME_SHIFT);
 
-	//if(!priv->card_8185){
-		rxconf = rxconf &~ RX_FIFO_THRESHOLD_MASK;
-		rxconf = rxconf | (RX_FIFO_THRESHOLD_NONE<<RX_FIFO_THRESHOLD_SHIFT);
-	//}
+	rxconf = rxconf & ~RX_FIFO_THRESHOLD_MASK;
+	rxconf = rxconf | (RX_FIFO_THRESHOLD_NONE << RX_FIFO_THRESHOLD_SHIFT);
 
 	rxconf = rxconf | (1<<RX_AUTORESETPHY_SHIFT);
 	rxconf = rxconf &~ MAX_RX_DMA_MASK;
 	rxconf = rxconf | (MAX_RX_DMA_2048<<MAX_RX_DMA_SHIFT);
 
-	//if(!priv->card_8185)
-		rxconf = rxconf | RCR_ONLYERLPKT;
+	rxconf = rxconf | RCR_ONLYERLPKT;
 
 	rxconf = rxconf &~ RCR_CS_MASK;
-	if(!priv->card_8185)
+
+	if (!priv->card_8185)
 		rxconf |= (priv->rcr_csense<<RCR_CS_SHIFT);
-//	rxconf &=~ 0xfff00000;
-//	rxconf |= 0x90100000;//9014f76f;
+
 	write_nic_dword(dev, RX_CONF, rxconf);
 
 	fix_rx_fifo(dev);
 
 	cmd=read_nic_byte(dev,CMD);
 	write_nic_byte(dev,CMD,cmd | (1<<CMD_RX_ENABLE_SHIFT));
-
-	/* In rtl8139 driver seems that DMA threshold has to be written
-	 *  after enabling RX, so we rewrite RX_CONFIG register
-	 */
-	//mdelay(100);
-//	write_nic_dword(dev, RX_CONF, rxconf);
-
 }
 
-
 void set_nic_txring(struct net_device *dev)
 {
 	struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-//		DMESG("ring %x %x", priv->txlpringdma,read_nic_dword(dev,TLPDA));
 
 	write_nic_dword(dev, TX_MANAGEPRIORITY_RING_ADDR, priv->txmapringdma);
-//		DMESG("ring %x %x", priv->txlpringdma,read_nic_dword(dev,TLPDA));
 	write_nic_dword(dev, TX_BKPRIORITY_RING_ADDR, priv->txbkpringdma);
-//		DMESG("ring %x %x", priv->txlpringdma,read_nic_dword(dev,TLPDA));
 	write_nic_dword(dev, TX_BEPRIORITY_RING_ADDR, priv->txbepringdma);
-//		DMESG("ring %x %x", priv->txlpringdma,read_nic_dword(dev,TLPDA));
 	write_nic_dword(dev, TX_VIPRIORITY_RING_ADDR, priv->txvipringdma);
-//		DMESG("ring %x %x", priv->txlpringdma,read_nic_dword(dev,TLPDA));
 	write_nic_dword(dev, TX_VOPRIORITY_RING_ADDR, priv->txvopringdma);
-//		DMESG("ring %x %x", priv->txlpringdma,read_nic_dword(dev,TLPDA));
 	write_nic_dword(dev, TX_HIGHPRIORITY_RING_ADDR, priv->txhpringdma);
-//		DMESG("ring %x %x", priv->txlpringdma,read_nic_dword(dev,TLPDA));
-
 	write_nic_dword(dev, TX_BEACON_RING_ADDR, priv->txbeaconringdma);
 }
 
-
 void rtl8180_conttx_enable(struct net_device *dev)
 {
 	u32 txconf;
+
 	txconf = read_nic_dword(dev,TX_CONF);
 	txconf = txconf &~ TX_LOOPBACK_MASK;
 	txconf = txconf | (TX_LOOPBACK_CONTINUE <<TX_LOOPBACK_SHIFT);
 	write_nic_dword(dev,TX_CONF,txconf);
 }
 
-
 void rtl8180_conttx_disable(struct net_device *dev)
 {
 	u32 txconf;
+
 	txconf = read_nic_dword(dev,TX_CONF);
 	txconf = txconf &~ TX_LOOPBACK_MASK;
 	txconf = txconf | (TX_LOOPBACK_NONE <<TX_LOOPBACK_SHIFT);
 	write_nic_dword(dev,TX_CONF,txconf);
 }
 
-
 void rtl8180_tx_enable(struct net_device *dev)
 {
 	u8 cmd;
@@ -1125,12 +961,10 @@ void rtl8180_tx_enable(struct net_device
 	u8 byte;
 	u32 txconf;
 	struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-	txconf= read_nic_dword(dev,TX_CONF);
-
-
-	if(priv->card_8185){
 
+	txconf = read_nic_dword(dev, TX_CONF);
 
+	if (priv->card_8185) {
 		byte = read_nic_byte(dev,CW_CONF);
 		byte &= ~(1<<CW_CONF_PERPACKET_CW_SHIFT);
 		byte &= ~(1<<CW_CONF_PERPACKET_RETRY_SHIFT);
@@ -1141,26 +975,12 @@ void rtl8180_tx_enable(struct net_device
 		tx_agc_ctl &= ~(1<<TX_AGC_CTL_PERPACKET_ANTSEL_SHIFT);
 		tx_agc_ctl |=(1<<TX_AGC_CTL_FEEDBACK_ANT);
 		write_nic_byte(dev, TX_AGC_CTL, tx_agc_ctl);
-		/*
-		write_nic_word(dev, 0x5e, 0x01);
-		force_pci_posting(dev);
-		mdelay(1);
-		write_nic_word(dev, 0xfe, 0x10);
-		force_pci_posting(dev);
-		mdelay(1);
-		write_nic_word(dev, 0x5e, 0x00);
-		force_pci_posting(dev);
-		mdelay(1);
-		*/
 		write_nic_byte(dev, 0xec, 0x3f); /* Disable early TX */
 	}
 
-	if(priv->card_8185){
-
+	if (priv->card_8185)
 		txconf = txconf &~ (1<<TCR_PROBE_NOTIMESTAMP_SHIFT);
-
-	}else{
-
+	else {
 		if(hwseqnum)
 			txconf= txconf &~ (1<<TX_CONF_HEADER_AUTOICREMENT_SHIFT);
 		else
@@ -1175,43 +995,31 @@ void rtl8180_tx_enable(struct net_device
 	txconf = txconf | (priv->retry_rts<<TX_RTSRETRY_SHIFT);
 	txconf = txconf &~ (1<<TX_NOCRC_SHIFT);
 
-	if(priv->card_8185){
-		if(priv->hw_plcp_len)
+	if (priv->card_8185) {
+		if (priv->hw_plcp_len)
 			txconf = txconf &~ TCR_PLCP_LEN;
 		else
 			txconf = txconf | TCR_PLCP_LEN;
-	}else{
+	} else
 		txconf = txconf &~ TCR_SAT;
-	}
+
 	txconf = txconf &~ TCR_MXDMA_MASK;
 	txconf = txconf | (TCR_MXDMA_2048<<TCR_MXDMA_SHIFT);
 	txconf = txconf | TCR_CWMIN;
 	txconf = txconf | TCR_DISCW;
 
-//	if(priv->ieee80211->hw_wep)
-//		txconf=txconf &~ (1<<TX_NOICV_SHIFT);
-//	else
-		txconf=txconf | (1<<TX_NOICV_SHIFT);
+	txconf = txconf | (1 << TX_NOICV_SHIFT);
 
 	write_nic_dword(dev,TX_CONF,txconf);
 
-
 	fix_tx_fifo(dev);
 
 	cmd=read_nic_byte(dev,CMD);
 	write_nic_byte(dev,CMD,cmd | (1<<CMD_TX_ENABLE_SHIFT));
 
-//	mdelay(100);
 	write_nic_dword(dev,TX_CONF,txconf);
-//	#endif
-/*
-	rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
-	write_nic_byte(dev, TX_DMA_POLLING, priv->dma_poll_mask);
-	rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
-	*/
 }
 
-
 void rtl8180_beacon_tx_enable(struct net_device *dev)
 {
 	struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
@@ -1222,7 +1030,6 @@ void rtl8180_beacon_tx_enable(struct net
 	rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
 }
 
-
 void rtl8180_beacon_tx_disable(struct net_device *dev)
 {
 	struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
@@ -1234,7 +1041,6 @@ void rtl8180_beacon_tx_disable(struct ne
 
 }
 
-
 void rtl8180_rtx_disable(struct net_device *dev)
 {
 	u8 cmd;
@@ -1245,9 +1051,6 @@ void rtl8180_rtx_disable(struct net_devi
 		       ((1<<CMD_RX_ENABLE_SHIFT)|(1<<CMD_TX_ENABLE_SHIFT)));
 	force_pci_posting(dev);
 	mdelay(10);
-	/*while (read_nic_byte(dev,CMD) & (1<<CMD_RX_ENABLE_SHIFT))
-	  udelay(10);
-	*/
 
 	if(!priv->rx_skb_complete)
 		dev_kfree_skb_any(priv->rx_skb);
@@ -1270,20 +1073,22 @@ short alloc_tx_desc_ring(struct net_devi
 	}
 	desc = (u32*)pci_alloc_consistent(pdev,
 					  sizeof(u32)*8*count+256, &dma_desc);
-	if(desc==NULL) return -1;
-	if(dma_desc & 0xff){
+	if (desc == NULL)
+		return -1;
 
+	if (dma_desc & 0xff)
 		/*
 		 * descriptor's buffer must be 256 byte aligned
 		 * we shouldn't be here, since we set DMA mask !
 		 */
 		WARN(1, "DMA buffer is not aligned\n");
-	}
-	tmp=desc;
-	for (i=0;i<count;i++)
-	{
-		buf = (void*)pci_alloc_consistent(pdev,bufsize,&dma_tmp);
-		if (buf == NULL) return -ENOMEM;
+
+	tmp = desc;
+
+	for (i = 0; i < count; i++) {
+		buf = (void *)pci_alloc_consistent(pdev, bufsize, &dma_tmp);
+		if (buf == NULL)
+			return -ENOMEM;
 
 		switch(addr) {
 		case TX_MANAGEPRIORITY_RING_ADDR:
@@ -1292,7 +1097,6 @@ short alloc_tx_desc_ring(struct net_devi
 				return -ENOMEM;
 			}
 			break;
-
 		case TX_BKPRIORITY_RING_ADDR:
 			if(-1 == buffer_add(&(priv->txbkpbufs),buf,dma_tmp,NULL)){
 				DMESGE("Unable to allocate mem for buffer LP");
@@ -1305,7 +1109,6 @@ short alloc_tx_desc_ring(struct net_devi
 				return -ENOMEM;
 			}
 			break;
-
 		case TX_VIPRIORITY_RING_ADDR:
 			if(-1 == buffer_add(&(priv->txvipbufs),buf,dma_tmp,NULL)){
 				DMESGE("Unable to allocate mem for buffer LP");
@@ -1348,32 +1151,26 @@ short alloc_tx_desc_ring(struct net_devi
 		priv->txmapringdma=dma_desc;
 		priv->txmapring=desc;
 		break;
-
 	case TX_BKPRIORITY_RING_ADDR:
 		priv->txbkpringdma=dma_desc;
 		priv->txbkpring=desc;
 		break;
-
 	case TX_BEPRIORITY_RING_ADDR:
 		priv->txbepringdma=dma_desc;
 		priv->txbepring=desc;
 		break;
-
 	case TX_VIPRIORITY_RING_ADDR:
 		priv->txvipringdma=dma_desc;
 		priv->txvipring=desc;
 		break;
-
 	case TX_VOPRIORITY_RING_ADDR:
 		priv->txvopringdma=dma_desc;
 		priv->txvopring=desc;
 		break;
-
 	case TX_HIGHPRIORITY_RING_ADDR:
 		priv->txhpringdma=dma_desc;
 		priv->txhpring=desc;
 		break;
-
 	case TX_BEACON_RING_ADDR:
 		priv->txbeaconringdma=dma_desc;
 		priv->txbeaconring=desc;
@@ -1384,10 +1181,8 @@ short alloc_tx_desc_ring(struct net_devi
 	return 0;
 }
 
-
 void free_tx_desc_rings(struct net_device *dev)
 {
-
 	struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
 	struct pci_dev *pdev=priv->pdev;
 	int count = priv->txringcount;
@@ -1426,7 +1221,6 @@ void free_rx_desc_ring(struct net_device
 {
 	struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
 	struct pci_dev *pdev = priv->pdev;
-
 	int count = priv->rxringcount;
 
 	pci_free_consistent(pdev, sizeof(u32)*8*count+256,
@@ -1435,7 +1229,6 @@ void free_rx_desc_ring(struct net_device
 	buffer_free(dev,&(priv->rxbuffer),priv->rxbuffersize,0);
 }
 
-
 short alloc_rx_desc_ring(struct net_device *dev, u16 bufsize, int count)
 {
 	int i;
@@ -1457,21 +1250,18 @@ short alloc_rx_desc_ring(struct net_devi
 	desc = (u32*)pci_alloc_consistent(pdev,sizeof(u32)*rx_desc_size*count+256,
 					  &dma_desc);
 
-	if(dma_desc & 0xff){
-
+	if (dma_desc & 0xff)
 		/*
 		 * descriptor's buffer must be 256 byte aligned
 		 * should never happen since we specify the DMA mask
 		 */
 		WARN(1, "DMA buffer is not aligned\n");
-	}
 
 	priv->rxring=desc;
 	priv->rxringdma=dma_desc;
 	tmp=desc;
 
-	for (i=0;i<count;i++){
-
+	for (i = 0; i < count; i++) {
 		if ((buf= kmalloc(bufsize * sizeof(u8),GFP_ATOMIC)) == NULL){
 			DMESGE("Failed to kmalloc RX buffer");
 			return -1;
@@ -1480,7 +1270,6 @@ short alloc_rx_desc_ring(struct net_devi
 		dma_tmp = pci_map_single(pdev,buf,bufsize * sizeof(u8),
 					 PCI_DMA_FROMDEVICE);
 
-		//buf = (void*)pci_alloc_consistent(pdev,bufsize,&dma_tmp);
 		if(-1 == buffer_add(&(priv->rxbuffer), buf,dma_tmp,
 			   &(priv->rxbufferhead))){
 			   DMESGE("Unable to allocate mem RX buf");
@@ -1505,24 +1294,16 @@ void set_nic_rxring(struct net_device *d
 	u8 pgreg;
 	struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
 
-	//rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
-
 	pgreg=read_nic_byte(dev, PGSELECT);
 	write_nic_byte(dev, PGSELECT, pgreg &~ (1<<PGSELECT_PG_SHIFT));
 
-	//rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
-
 	write_nic_dword(dev, RXRING_ADDR,priv->rxringdma);
 }
 
-
 void rtl8180_reset(struct net_device *dev)
 {
-	//u32 txconf = 0x80e00707; //FIXME: Make me understandable
 	u8 cr;
 
-	//write_nic_dword(dev,TX_CONF,txconf);
-
 	rtl8180_irq_disable(dev);
 
 	cr=read_nic_byte(dev,CMD);
@@ -1539,83 +1320,80 @@ void rtl8180_reset(struct net_device *de
 	else
 		DMESG("Card successfully reset");
 
-//#ifndef CONFIG_RTL8185B
 	rtl8180_set_mode(dev,EPROM_CMD_LOAD);
 	force_pci_posting(dev);
 	mdelay(200);
-//#endif
 }
 
 inline u16 ieeerate2rtlrate(int rate)
 {
 	switch(rate){
 	case 10:
-	return 0;
+		return 0;
 	case 20:
-	return 1;
+		return 1;
 	case 55:
-	return 2;
+		return 2;
 	case 110:
-	return 3;
+		return 3;
 	case 60:
-	return 4;
+		return 4;
 	case 90:
-	return 5;
+		return 5;
 	case 120:
-	return 6;
+		return 6;
 	case 180:
-	return 7;
+		return 7;
 	case 240:
-	return 8;
+		return 8;
 	case 360:
-	return 9;
+		return 9;
 	case 480:
-	return 10;
+		return 10;
 	case 540:
-	return 11;
+		return 11;
 	default:
-	return 3;
-
+		return 3;
 	}
 }
 
 static u16 rtl_rate[] = {10,20,55,110,60,90,120,180,240,360,480,540,720};
+
 inline u16 rtl8180_rate2rate(short rate)
 {
-	if (rate >12) return 10;
+	if (rate > 12)
+		return 10;
 	return rtl_rate[rate];
 }
+
 inline u8 rtl8180_IsWirelessBMode(u16 rate)
 {
 	if( ((rate <= 110) && (rate != 60) && (rate != 90)) || (rate == 220) )
 		return 1;
-	else return 0;
+	else
+		return 0;
 }
+
 u16 N_DBPSOfRate(u16 DataRate);
-u16 ComputeTxTime(
-	u16		FrameLength,
-	u16		DataRate,
-	u8		bManagementFrame,
-	u8		bShortPreamble
-)
+
+u16 ComputeTxTime(u16 FrameLength, u16 DataRate, u8 bManagementFrame,
+		  u8 bShortPreamble)
 {
 	u16	FrameTime;
 	u16	N_DBPS;
 	u16	Ceiling;
 
-	if( rtl8180_IsWirelessBMode(DataRate) )
-	{
-		if( bManagementFrame || !bShortPreamble || DataRate == 10 )
-		{	// long preamble
+	if (rtl8180_IsWirelessBMode(DataRate)) {
+		if (bManagementFrame || !bShortPreamble || DataRate == 10)
+			/* long preamble */
 			FrameTime = (u16)(144+48+(FrameLength*8/(DataRate/10)));
-		}
 		else
-		{	// Short preamble
+			/* short preamble */
 			FrameTime = (u16)(72+24+(FrameLength*8/(DataRate/10)));
-		}
-		if( ( FrameLength*8 % (DataRate/10) ) != 0 ) //Get the Ceilling
-				FrameTime ++;
-	} else {	//802.11g DSSS-OFDM PLCP length field calculation.
+
+		if ((FrameLength*8 % (DataRate/10)) != 0) /* get the ceilling */
+			FrameTime++;
+	} else {	/* 802.11g DSSS-OFDM PLCP length field calculation. */
 		N_DBPS = N_DBPSOfRate(DataRate);
 		Ceiling = (16 + 8*FrameLength + 6) / N_DBPS
 				+ (((16 + 8*FrameLength + 6) % N_DBPS) ? 1 : 0);
@@ -1623,49 +1401,41 @@ u16 ComputeTxTime(
 	}
 	return FrameTime;
 }
+
 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;
-	 }
+	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;
+	return N_DBPS;
 }
 
 //{by amy 080312
@@ -1674,76 +1444,46 @@ u16 N_DBPSOfRate(u16 DataRate)
 // 	For Netgear case, they want good-looking singal strength.
 //		2004.12.05, by rcnjko.
 //
-long
-NetgearSignalStrengthTranslate(
-	long LastSS,
-	long CurrSS
-	)
+long NetgearSignalStrengthTranslate(long LastSS, long CurrSS)
 {
 	long RetSS;
 
 	// Step 1. Scale mapping.
-	if(CurrSS >= 71 && CurrSS <= 100)
-	{
+	if (CurrSS >= 71 && CurrSS <= 100)
 		RetSS = 90 + ((CurrSS - 70) / 3);
-	}
-	else if(CurrSS >= 41 && CurrSS <= 70)
-	{
+	else if (CurrSS >= 41 && CurrSS <= 70)
 		RetSS = 78 + ((CurrSS - 40) / 3);
-	}
-	else if(CurrSS >= 31 && CurrSS <= 40)
-	{
+	else if (CurrSS >= 31 && CurrSS <= 40)
 		RetSS = 66 + (CurrSS - 30);
-	}
-	else if(CurrSS >= 21 && CurrSS <= 30)
-	{
+	else if (CurrSS >= 21 && CurrSS <= 30)
 		RetSS = 54 + (CurrSS - 20);
-	}
-	else if(CurrSS >= 5 && CurrSS <= 20)
-	{
+	else if (CurrSS >= 5 && CurrSS <= 20)
 		RetSS = 42 + (((CurrSS - 5) * 2) / 3);
-	}
-	else if(CurrSS == 4)
-	{
+	else if (CurrSS == 4)
 		RetSS = 36;
-	}
-	else if(CurrSS == 3)
-	{
+	else if (CurrSS == 3)
 		RetSS = 27;
-	}
-	else if(CurrSS == 2)
-	{
+	else if (CurrSS == 2)
 		RetSS = 18;
-	}
-	else if(CurrSS == 1)
-	{
+	else if (CurrSS == 1)
 		RetSS = 9;
-	}
 	else
-	{
 		RetSS = CurrSS;
-	}
-	//RT_TRACE(COMP_DBG, DBG_LOUD, ("##### After Mapping:  LastSS: %d, CurrSS: %d, RetSS: %d\n", LastSS, CurrSS, RetSS));
 
 	// Step 2. Smoothing.
 	if(LastSS > 0)
-	{
 		RetSS = ((LastSS * 5) + (RetSS)+ 5) / 6;
-	}
-	//RT_TRACE(COMP_DBG, DBG_LOUD, ("$$$$$ After Smoothing:  LastSS: %d, CurrSS: %d, RetSS: %d\n", LastSS, CurrSS, RetSS));
 
 	return RetSS;
 }
+
 //
 //	Description:
 //		Translate 0-100 signal strength index into dBm.
 //
-long
-TranslateToDbm8185(
-	u8 SignalStrengthIndex	// 0-100 index.
-	)
+long TranslateToDbm8185(u8 SignalStrengthIndex)
 {
-	long	SignalPower; // in dBm.
+	long SignalPower;
 
 	// Translate to dBm (x=0.5y-95).
 	SignalPower = (long)((SignalStrengthIndex + 1) >> 1);
@@ -1751,6 +1491,7 @@ TranslateToDbm8185(
 
 	return SignalPower;
 }
+
 //
 //	Description:
 //		Perform signal smoothing for dynamic mechanism.
@@ -1759,53 +1500,23 @@ TranslateToDbm8185(
 //		of correctness. Ported from 8187B.
 //	2007-02-26, by Bruce.
 //
-void
-PerformUndecoratedSignalSmoothing8185(
-	struct r8180_priv *priv,
-	bool    bCckRate
-	)
+void PerformUndecoratedSignalSmoothing8185(struct r8180_priv *priv,
+					   bool bCckRate)
 {
-
-
 	// Determin the current packet is CCK rate.
 	priv->bCurCCKPkt = bCckRate;
 
-	if(priv->UndecoratedSmoothedSS >= 0)
-	{
+	if (priv->UndecoratedSmoothedSS >= 0)
 		priv->UndecoratedSmoothedSS = ( (priv->UndecoratedSmoothedSS * 5) + (priv->SignalStrength * 10) ) / 6;
-	}
 	else
-	{
 		priv->UndecoratedSmoothedSS = priv->SignalStrength * 10;
-	}
 
 	priv->UndercorateSmoothedRxPower = ( (priv->UndercorateSmoothedRxPower * 50) + (priv->RxPower* 11)) / 60;
 
-//	printk("Sommthing SignalSterngth (%d) => UndecoratedSmoothedSS (%d)\n", priv->SignalStrength, priv->UndecoratedSmoothedSS);
-//	printk("Sommthing RxPower (%d) => UndecoratedRxPower (%d)\n", priv->RxPower, priv->UndercorateSmoothedRxPower);
-
-	//if(priv->CurCCKRSSI >= 0 && bCckRate)
-	if(bCckRate)
-	{
+	if (bCckRate)
 		priv->CurCCKRSSI = priv->RSSI;
-	}
 	else
-	{
 		priv->CurCCKRSSI = 0;
-	}
-
-	// Boundary checking.
-	// TODO: The overflow condition does happen, if we want to fix,
-	// we shall recalculate thresholds first.
-	if(priv->UndecoratedSmoothedSS > 100)
-	{
-//		printk("UndecoratedSmoothedSS(%d) overflow, SignalStrength(%d)\n", priv->UndecoratedSmoothedSS, priv->SignalStrength);
-	}
-	if(priv->UndecoratedSmoothedSS < 0)
-	{
-//		printk("UndecoratedSmoothedSS(%d) underflow, SignalStrength(%d)\n", priv->UndecoratedSmoothedSS, priv->SignalStrength);
-	}
-
 }
 
 //by amy 080312}
@@ -1815,70 +1526,47 @@ void rtl8180_rx(struct net_device *dev)
 {
 	struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
 	struct sk_buff *tmp_skb;
-
-	//struct sk_buff *skb;
 	short first,last;
 	u32 len;
 	int lastlen;
 	unsigned char quality, signal;
 	u8 rate;
-	//u32 *prism_hdr;
 	u32 *tmp,*tmp2;
 	u8 rx_desc_size;
 	u8 padding;
-	//u32 count=0;
 	char rxpower = 0;
 	u32 RXAGC = 0;
 	long RxAGC_dBm = 0;
 	u8	LNA=0, BB=0;
 	u8 	LNA_gain[4]={02, 17, 29, 39};
 	u8  Antenna = 0;
-	struct ieee80211_hdr *hdr;//by amy
+	struct ieee80211_hdr *hdr;
 	u16 fc,type;
 	u8 bHwError = 0,bCRC = 0,bICV = 0;
-	//bHwError = 0;
-	//bCRC = 0;
-	//bICV = 0;
 	bool	bCckRate = false;
 	u8     RSSI = 0;
-	long	SignalStrengthIndex = 0;//+by amy 080312
-//	u8 SignalStrength = 0;
+	long	SignalStrengthIndex = 0;
 	struct ieee80211_rx_stats stats = {
 		.signal = 0,
 		.noise = -98,
 		.rate = 0,
-	//	.mac_time = jiffies,
 		.freq = IEEE80211_24GHZ_BAND,
 	};
 
 	stats.nic_type = NIC_8185B;
 	rx_desc_size = 8;
 
-	//printk("receive frame!%d\n",count++);
-	//if (!priv->rxbuffer) DMESG ("EE: NIC RX ack, but RX queue corrupted!");
-	//else {
-
 	if ((*(priv->rxringtail)) & (1<<31)) {
-
 		/* we have got an RX int, but the descriptor
 		 * we are pointing is empty*/
 
 		priv->stats.rxnodata++;
 		priv->ieee80211->stats.rx_errors++;
 
-	/*	if (! *(priv->rxring) & (1<<31)) {
-
-			priv->stats.rxreset++;
-			priv->rxringtail=priv->rxring;
-			priv->rxbuffer=priv->rxbufferhead;
-
-		}else{*/
-
 		tmp2 = NULL;
 		tmp = priv->rxringtail;
 		do{
 			if(tmp == priv->rxring)
-				//tmp  = priv->rxring + (priv->rxringcount )*rx_desc_size; xiong-2006-11-15
 				tmp  = priv->rxring + (priv->rxringcount - 1)*rx_desc_size;
 			else
 				tmp -= rx_desc_size;
@@ -1888,7 +1576,6 @@ void rtl8180_rx(struct net_device *dev)
 		}while(tmp != priv->rxring);
 
 		if(tmp2) priv->rxringtail = tmp2;
-		//}
 	}
 
 	/* while there are filled descriptors */
@@ -1930,7 +1617,6 @@ void rtl8180_rx(struct net_device *dev)
 				len=lastlen-priv->rx_prevlen;
 
 			if(*(priv->rxringtail) & (1<<13)) {
-//lastlen=((*priv->rxringtail) &0xfff);
 				if ((*(priv->rxringtail) & 0xfff) <500)
 					priv->stats.rxcrcerrmin++;
 				else if ((*(priv->rxringtail) & 0x0fff) >1000)
@@ -1982,9 +1668,7 @@ void rtl8180_rx(struct net_device *dev)
 			((1<<23)|(1<<22)|(1<<21)|(1<<20)))>>20;
 
 		stats.rate = rtl8180_rate2rate(rate);
-		//DMESG("%d",rate);
 		Antenna = (((*(priv->rxringtail +3))& (0x00008000)) == 0 )? 0:1 ;
-//		printk("in rtl8180_rx():Antenna is %d\n",Antenna);
 //by amy for antenna
 		if(!rtl8180_IsWirelessBMode(stats.rate))
 		{ // OFDM rate.
@@ -2089,12 +1773,6 @@ void rtl8180_rx(struct net_device *dev)
 			}
 
 //by amy for antenna
-
-
-
-
-
-
 #ifndef DUMMY_RX
 		if(first){
 			if(!priv->rx_skb_complete){
@@ -2164,16 +1842,13 @@ void rtl8180_rx(struct net_device *dev)
 		}
 
 #endif //DUMMY_RX
-
 		pci_dma_sync_single_for_device(priv->pdev,
 				    priv->rxbuffer->dma,
 				    priv->rxbuffersize * \
 				    sizeof(u8),
 				    PCI_DMA_FROMDEVICE);
 
-
 drop: // this is used when we have not enought mem
-
 		/* restore the descriptor */
 		*(priv->rxringtail+2)=priv->rxbuffer->dma;
 		*(priv->rxringtail)=*(priv->rxringtail) &~ 0xfff;
@@ -2182,32 +1857,14 @@ drop: // this is used when we have not e
 
 		*(priv->rxringtail)=
 			*(priv->rxringtail) | (1<<31);
-			//^empty descriptor
-
-			//wmb();
-
-		//unsigned long flags;
-		//spin_lock_irqsave(&priv->irq_lock,flags);
 
 		priv->rxringtail+=rx_desc_size;
 		if(priv->rxringtail >=
 		   (priv->rxring)+(priv->rxringcount )*rx_desc_size)
 			priv->rxringtail=priv->rxring;
 
-		//spin_unlock_irqrestore(&priv->irq_lock,flags);
-
-
 		priv->rxbuffer=(priv->rxbuffer->next);
-
 	}
-
-
-
-//	if(get_curr_tx_free_desc(dev,priority))
-//	ieee80211_sta_ps_sleep(priv->ieee80211, &tmp, &tmp2);
-
-
-
 }
 
 
@@ -2216,33 +1873,6 @@ void rtl8180_dma_kick(struct net_device 
 	struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
 
 	rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
-/*
-
-	switch(priority){
-
-		case LOW_PRIORITY:
-
-		write_nic_byte(dev,TX_DMA_POLLING,
-		       (1<< TX_DMA_POLLING_LOWPRIORITY_SHIFT) |
-			        priv->dma_poll_mask);
-		break;
-
-		case NORM_PRIORITY:
-
-		write_nic_byte(dev,TX_DMA_POLLING,
-		       (1<< TX_DMA_POLLING_NORMPRIORITY_SHIFT) |
-			        priv->dma_poll_mask);
-		break;
-
-		case HI_PRIORITY:
-
-		write_nic_byte(dev,TX_DMA_POLLING,
-		       (1<< TX_DMA_POLLING_HIPRIORITY_SHIFT) |
-			        priv->dma_poll_mask);
-		break;
-
-	}
-*/
 	write_nic_byte(dev, TX_DMA_POLLING,
 			(1 << (priority + 1)) | priv->dma_poll_mask);
 	rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
@@ -2260,7 +1890,6 @@ void rtl8180_data_hard_stop(struct net_d
 	rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
 }
 
-
 void rtl8180_data_hard_resume(struct net_device *dev)
 {
 	struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
@@ -2271,7 +1900,6 @@ void rtl8180_data_hard_resume(struct net
 	rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
 }
 
-
 /* this function TX data frames when the ieee80211 stack requires this.
  * It checks also if we need to stop the ieee tx queue, eventually do it
  */
@@ -2284,7 +1912,6 @@ rate)
 	short morefrag = (h->frame_ctl) & IEEE80211_FCTL_MOREFRAGS;
 	unsigned long flags;
 	int priority;
-	//static int count = 0;
 
 	mode = priv->ieee80211->iw_mode;
 
@@ -2306,22 +1933,16 @@ rate)
 		return;
 	}
 
-	//printk(KERN_WARNING "priority = %d@%d\n", priority, count++);
 	if (!check_nic_enought_desc(dev, priority)){
-		//DMESG("Error: no descriptor left by previous TX (avail %d) ",
-		//	get_curr_tx_free_desc(dev, priority));
 		DMESGW("Error: no descriptor left by previous TX (avail %d) ",
 			get_curr_tx_free_desc(dev, priority));
-	//printk(KERN_WARNING "==============================================================> \n");
 		ieee80211_stop_queue(priv->ieee80211);
 	}
 	rtl8180_tx(dev, skb->data, skb->len, priority, morefrag,0,rate);
 	if (!check_nic_enought_desc(dev, priority))
 		ieee80211_stop_queue(priv->ieee80211);
 
-	//dev_kfree_skb_any(skb);
 	spin_unlock_irqrestore(&priv->tx_lock,flags);
-
 }
 
 /* This is a rough attempt to TX a frame
@@ -2338,19 +1959,15 @@ rate)
 int rtl8180_hard_start_xmit(struct sk_buff *skb,struct net_device *dev)
 {
 	struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
 	unsigned long flags;
-
 	int priority;
 
 	priority = MANAGE_PRIORITY;
 
 	spin_lock_irqsave(&priv->tx_lock,flags);
 
-	if(priv->ieee80211->bHwRadioOff)
-	{
+	if (priv->ieee80211->bHwRadioOff) {
 		spin_unlock_irqrestore(&priv->tx_lock,flags);
-
 		dev_kfree_skb_any(skb);
 		return 0;
 	}
@@ -2381,7 +1998,6 @@ u16 rtl8180_len2duration(u32 len, short 
 		if(drift ==0 ) break;
 		duration++;
 		break;
-
 	case 1://2mbps
 		*ext=0;
 		duration = ((len+4)<<4) /0x4;
@@ -2389,7 +2005,6 @@ u16 rtl8180_len2duration(u32 len, short 
 		if(drift ==0 ) break;
 		duration++;
 		break;
-
 	case 2: //5.5mbps
 		*ext=0;
 		duration = ((len+4)<<4) /0xb;
@@ -2398,7 +2013,6 @@ u16 rtl8180_len2duration(u32 len, short 
 			break;
 		duration++;
 		break;
-
 	default:
 	case 3://11mbps
 		*ext=0;
@@ -2416,12 +2030,9 @@ u16 rtl8180_len2duration(u32 len, short 
 	return duration;
 }
 
-
 void rtl8180_prepare_beacon(struct net_device *dev)
 {
-
 	struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
 	struct sk_buff *skb;
 
 	u16 word  = read_nic_word(dev, BcnItv);
@@ -2429,7 +2040,6 @@ void rtl8180_prepare_beacon(struct net_d
 	word |= cpu_to_le16(priv->ieee80211->current_network.beacon_interval);//0x64;
 	write_nic_word(dev, BcnItv, word);
 
-
 	skb = ieee80211_get_beacon(priv->ieee80211);
 	if(skb){
 		rtl8180_tx(dev,skb->data,skb->len,BEACON_PRIORITY,
@@ -2453,19 +2063,14 @@ short rtl8180_tx(struct net_device *dev,
 	int remain;
 	int buflen;
 	int count;
-	//u16	AckCtsTime;
-	//u16	FrameTime;
 	u16 duration;
 	short ext;
 	struct buffer* buflist;
-	//unsigned long flags;
 	struct ieee80211_hdr_3addr *frag_hdr = (struct ieee80211_hdr_3addr *)txbuf;
 	u8 dest[ETH_ALEN];
 	u8			bUseShortPreamble = 0;
 	u8			bCTSEnable = 0;
 	u8			bRTSEnable = 0;
-	//u16			RTSRate = 22;
-	//u8			RetryLimit = 0;
 	u16 			Duration = 0;
 	u16			RtsDur = 0;
 	u16			ThisFrameTime = 0;
@@ -2479,56 +2084,47 @@ short rtl8180_tx(struct net_device *dev,
 		buflist = priv->txmapbufstail;
 		count = priv->txringcount;
 		break;
-
 	case BK_PRIORITY:
 		tail=priv->txbkpringtail;
 		begin=priv->txbkpring;
 		buflist = priv->txbkpbufstail;
 		count = priv->txringcount;
 		break;
-
 	case BE_PRIORITY:
 		tail=priv->txbepringtail;
 		begin=priv->txbepring;
 		buflist = priv->txbepbufstail;
 		count = priv->txringcount;
 		break;
-
 	case VI_PRIORITY:
 		tail=priv->txvipringtail;
 		begin=priv->txvipring;
 		buflist = priv->txvipbufstail;
 		count = priv->txringcount;
 		break;
-
 	case VO_PRIORITY:
 		tail=priv->txvopringtail;
 		begin=priv->txvopring;
 		buflist = priv->txvopbufstail;
 		count = priv->txringcount;
 		break;
-
 	case HI_PRIORITY:
 		tail=priv->txhpringtail;
 		begin=priv->txhpring;
 		buflist = priv->txhpbufstail;
 		count = priv->txringcount;
 		break;
-
 	case BEACON_PRIORITY:
 		tail=priv->txbeaconringtail;
 		begin=priv->txbeaconring;
 		buflist = priv->txbeaconbufstail;
 		count = priv->txbeaconcount;
 		break;
-
 	default:
 		return -1;
 		break;
  	}
 
-	//printk("in rtl8180_tx(): rate is %d\n",priv->ieee80211->rate);
-#if 1
 		memcpy(&dest, frag_hdr->addr1, ETH_ALEN);
 		if (is_multicast_ether_addr(dest) ||
 				is_broadcast_ether_addr(dest))
@@ -2541,20 +2137,13 @@ short rtl8180_tx(struct net_device *dev,
 			ThisFrameTime = ComputeTxTime(len + sCrcLng, rtl8180_rate2rate(rate), 0, bUseShortPreamble);
 			TxDescDuration = ThisFrameTime;
 		} else {// Unicast packet
-			//u8 AckRate;
 			u16 AckTime;
 
 			//YJ,add,080828,for Keep alive
 			priv->NumTxUnicast++;
 
 			// Figure out ACK rate according to BSS basic rate and Tx rate, 2006.03.08 by rcnjko.
-			//AckRate = ComputeAckRate( pMgntInfo->mBrates, (u1Byte)(pTcb->DataRate) );
-			// Figure out ACK time according to the AckRate and assume long preamble is used on receiver, 2006.03.08, by rcnjko.
-			//AckTime = ComputeTxTime( sAckCtsLng/8, AckRate, FALSE, FALSE);
-			//For simplicity, just use the 1M basic rate
-			//AckTime = ComputeTxTime(14, 540,0, 0);	// AckCTSLng = 14 use 1M bps send
 			AckTime = ComputeTxTime(14, 10,0, 0);	// AckCTSLng = 14 use 1M bps send
-			//AckTime = ComputeTxTime(14, 2,false, false);	// AckCTSLng = 14 use 1M bps send
 
 			if ( ((len + sCrcLng) > priv->rts) && priv->rts )
 			{ // RTS/CTS.
@@ -2605,30 +2194,24 @@ short rtl8180_tx(struct net_device *dev,
 		} // End of Unicast packet
 
 		frag_hdr->duration_id = Duration;
-#endif
 
 	buflen=priv->txbuffsize;
 	remain=len;
 	temp_tail = tail;
-//printk("================================>buflen = %d, remain = %d!\n", buflen,remain);
+
 	while(remain!=0){
 		mb();
 		if(!buflist){
 			DMESGE("TX buffer error, cannot TX frames. pri %d.", priority);
-			//spin_unlock_irqrestore(&priv->tx_lock,flags);
 			return -1;
 		}
 		buf=buflist->buf;
 
-		if( (*tail & (1<<31)) && (priority != BEACON_PRIORITY)){
-
-				DMESGW("No more TX desc, returning %x of %x",
-				remain,len);
-				priv->stats.txrdu++;
-			//	spin_unlock_irqrestore(&priv->tx_lock,flags);
-
+		if ((*tail & (1 << 31)) && (priority != BEACON_PRIORITY)) {
+			DMESGW("No more TX desc, returning %x of %x",
+			       remain, len);
+			priv->stats.txrdu++;
 			return remain;
-
 		}
 
 		*tail= 0; // zeroes header
@@ -2641,9 +2224,8 @@ short rtl8180_tx(struct net_device *dev,
 		if(priv->card_8185){
 			//FIXME: this should be triggered by HW encryption parameters.
 			*tail |= (1<<15); //no encrypt
-//			*tail |= (1<<30); //raise int when completed
 		}
-	//	*tail = *tail | (1<<16);
+
 		if(remain==len && !descfrag) {
 			ownbit_flag = false;	//added by david woo,2007.12.14
 			*tail = *tail| (1<<29) ; //fist segment of the packet
@@ -2681,19 +2263,11 @@ short rtl8180_tx(struct net_device *dev,
         	*(tail+5) |= (11<<8);//(priv->retry_data<<8); //retry lim ;
 
 		*tail = *tail | ((rate&0xf) << 24);
-		//DMESG("rate %d",rate);
-
-		if(priv->card_8185){
-           //    	*(tail+5) = 0;
-		}
 
 		/* hw_plcp_len is not used for rtl8180 chip */
 		/* FIXME */
 		if(priv->card_8185 == 0 || !priv->hw_plcp_len){
-
-			duration = rtl8180_len2duration(len,
-				rate,&ext);
-
+			duration = rtl8180_len2duration(len, rate, &ext);
 			*(tail+1) = *(tail+1) | ((duration & 0x7fff)<<16);
 			if(ext) *(tail+1) = *(tail+1) |(1<<31); //plcp length extension
 		}
@@ -2712,7 +2286,6 @@ short rtl8180_tx(struct net_device *dev,
 
 		if((tail - begin)/8 == count-1)
 			tail=begin;
-
 		else
 			tail=tail+8;
 
@@ -2725,75 +2298,56 @@ short rtl8180_tx(struct net_device *dev,
 				priv->txmapringtail=tail;
 				priv->txmapbufstail=buflist;
 				break;
-
 			case BK_PRIORITY:
 				priv->txbkpringtail=tail;
 				priv->txbkpbufstail=buflist;
 				break;
-
 			case BE_PRIORITY:
 				priv->txbepringtail=tail;
 				priv->txbepbufstail=buflist;
 				break;
-
 			case VI_PRIORITY:
 				priv->txvipringtail=tail;
 				priv->txvipbufstail=buflist;
 				break;
-
 			case VO_PRIORITY:
 				priv->txvopringtail=tail;
 				priv->txvopbufstail=buflist;
 				break;
-
 			case HI_PRIORITY:
 				priv->txhpringtail=tail;
 				priv->txhpbufstail = buflist;
 				break;
-
 			case BEACON_PRIORITY:
 				/* the HW seems to be happy with the 1st
 				 * descriptor filled and the 2nd empty...
 				 * So always update descriptor 1 and never
 				 * touch 2nd
 				 */
-			//	priv->txbeaconringtail=tail;
-			//	priv->txbeaconbufstail=buflist;
-
 				break;
-
 		}
-
-		//rtl8180_dma_kick(dev,priority);
 	}
 	*temp_tail = *temp_tail | (1<<31); // descriptor ready to be txed
 	rtl8180_dma_kick(dev,priority);
-	//spin_unlock_irqrestore(&priv->tx_lock,flags);
 
 	return 0;
-
 }
 
-
 void rtl8180_irq_rx_tasklet(struct r8180_priv * priv);
 
-
 void rtl8180_link_change(struct net_device *dev)
 {
 	struct r8180_priv *priv = ieee80211_priv(dev);
 	u16 beacon_interval;
-
 	struct ieee80211_network *net = &priv->ieee80211->current_network;
-//	rtl8180_adapter_start(dev);
-	rtl8180_update_msr(dev);
 
+	rtl8180_update_msr(dev);
 
 	rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
 
 	write_nic_dword(dev,BSSID,((u32*)net->bssid)[0]);
 	write_nic_word(dev,BSSID+4,((u16*)net->bssid)[2]);
 
-
 	beacon_interval  = read_nic_dword(dev,BEACON_INTERVAL);
 	beacon_interval &= ~ BEACON_INTERVAL_MASK;
 	beacon_interval |= net->beacon_interval;
@@ -2801,23 +2355,14 @@ void rtl8180_link_change(struct net_devi
 
 	rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
 
-
-	/*
-	u16 atim = read_nic_dword(dev,ATIM);
-	u16 = u16 &~ ATIM_MASK;
-	u16 = u16 | beacon->atim;
-	*/
-
 	if(priv->card_8185)
 		rtl8180_set_chan(dev, priv->chan);
-
-
 }
 
 void rtl8180_rq_tx_ack(struct net_device *dev){
 
 	struct r8180_priv *priv = ieee80211_priv(dev);
-//	printk("====================>%s\n",__func__);
+
 	write_nic_byte(dev,CONFIG4,read_nic_byte(dev,CONFIG4)|CONFIG4_PWRMGT);
 	priv->ack_tx_to_ieee = 1;
 }
@@ -2858,39 +2403,29 @@ short rtl8180_is_tx_queue_empty(struct n
 void rtl8180_hw_wakeup(struct net_device *dev)
 {
 	unsigned long flags;
-
 	struct r8180_priv *priv = ieee80211_priv(dev);
 
 	spin_lock_irqsave(&priv->ps_lock,flags);
-	//DMESG("Waken up!");
 	write_nic_byte(dev,CONFIG4,read_nic_byte(dev,CONFIG4)&~CONFIG4_PWRMGT);
-
-	if(priv->rf_wakeup)
+	if (priv->rf_wakeup)
 		priv->rf_wakeup(dev);
-//	mdelay(HW_WAKE_DELAY);
 	spin_unlock_irqrestore(&priv->ps_lock,flags);
 }
 
 void rtl8180_hw_sleep_down(struct net_device *dev)
 {
         unsigned long flags;
-
         struct r8180_priv *priv = ieee80211_priv(dev);
 
         spin_lock_irqsave(&priv->ps_lock,flags);
-       //DMESG("Sleep!");
-
         if(priv->rf_sleep)
                 priv->rf_sleep(dev);
         spin_unlock_irqrestore(&priv->ps_lock,flags);
 }
 
-
 void rtl8180_hw_sleep(struct net_device *dev, u32 th, u32 tl)
 {
-
 	struct r8180_priv *priv = ieee80211_priv(dev);
-
 	u32 rb = jiffies;
 	unsigned long flags;
 
@@ -2901,14 +2436,6 @@ void rtl8180_hw_sleep(struct net_device 
 	 */
 	tl -= MSECS(4+16+7);
 
-	//if(tl == 0) tl = 1;
-
-	/* FIXME HACK FIXME HACK */
-//	force_pci_posting(dev);
-	//mdelay(1);
-
-//	rb = read_nic_dword(dev, TSFTR);
-
 	/* If the interval in witch we are requested to sleep is too
 	 * short then give up and remain awake
 	 */
@@ -2919,13 +2446,9 @@ void rtl8180_hw_sleep(struct net_device 
 		return;
 	}
 
-//	write_nic_dword(dev, TimerInt, tl);
-//	rb = read_nic_dword(dev, TSFTR);
 	{
 		u32 tmp = (tl>rb)?(tl-rb):(rb-tl);
-	//	if (tl<rb)
 
-		//lzm,add,080828
 		priv->DozePeriodInPast2Sec += jiffies_to_msecs(tmp);
 
 		queue_delayed_work(priv->ieee80211->wq, &priv->ieee80211->hw_wakeup_wq, tmp); //as tl may be less than rb
@@ -2933,26 +2456,20 @@ void rtl8180_hw_sleep(struct net_device 
 	/* if we suspect the TimerInt is gone beyond tl
 	 * while setting it, then give up
 	 */
-#if 1
+
 	if(((tl > rb) && ((tl-rb) > MSECS(MAX_SLEEP_TIME)))||
 		((tl < rb) && ((rb-tl) > MSECS(MAX_SLEEP_TIME)))) {
 		spin_unlock_irqrestore(&priv->ps_lock,flags);
 		return;
 	}
-#endif
-//	if(priv->rf_sleep)
-//		priv->rf_sleep(dev);
 
 	queue_work(priv->ieee80211->wq, (void *)&priv->ieee80211->hw_sleep_wq);
 	spin_unlock_irqrestore(&priv->ps_lock,flags);
 }
 
-
-//void rtl8180_wmm_param_update(struct net_device *dev,u8 *ac_param)
 void rtl8180_wmm_param_update(struct work_struct * work)
 {
 	struct ieee80211_device * ieee = container_of(work, struct ieee80211_device,wmm_param_update_wq);
-	//struct r8180_priv *priv = (struct r8180_priv*)(ieee->priv);
 	struct net_device *dev = ieee->dev;
 	u8 *ac_param = (u8 *)(ieee->current_network.wmm_param);
 	u8 mode = ieee->current_network.mode;
@@ -2985,19 +2502,15 @@ void rtl8180_wmm_param_update(struct wor
 					case AC1_BK:
 						write_nic_dword(dev, AC_BK_PARAM, u4bAcParam);
 						break;
-
 					case AC0_BE:
 						write_nic_dword(dev, AC_BE_PARAM, u4bAcParam);
 						break;
-
 					case AC2_VI:
 						write_nic_dword(dev, AC_VI_PARAM, u4bAcParam);
 						break;
-
 					case AC3_VO:
 						write_nic_dword(dev, AC_VO_PARAM, u4bAcParam);
 						break;
-
 					default:
 						printk(KERN_WARNING "SetHwReg8185():invalid ACI: %d!\n", eACI);
 						break;
@@ -3028,19 +2541,15 @@ void rtl8180_wmm_param_update(struct wor
 				case AC1_BK:
 					write_nic_dword(dev, AC_BK_PARAM, u4bAcParam);
 					break;
-
 				case AC0_BE:
 					write_nic_dword(dev, AC_BE_PARAM, u4bAcParam);
 					break;
-
 				case AC2_VI:
 					write_nic_dword(dev, AC_VI_PARAM, u4bAcParam);
 					break;
-
 				case AC3_VO:
 					write_nic_dword(dev, AC_VO_PARAM, u4bAcParam);
 					break;
-
 				default:
 					printk(KERN_WARNING "SetHwReg8185(): invalid ACI: %d !\n", eACI);
 					break;
@@ -3061,17 +2570,13 @@ void rtl8180_watch_dog(struct net_device
 
 void watch_dog_adaptive(unsigned long data)
 {
-    struct r8180_priv* priv = ieee80211_priv((struct net_device *)data);
-//	DMESG("---->watch_dog_adaptive()\n");
-	if(!priv->up)
-	{
+	struct r8180_priv* priv = ieee80211_priv((struct net_device *)data);
+
+	if (!priv->up) {
 		DMESG("<----watch_dog_adaptive():driver is not up!\n");
 		return;
 	}
 
-  //      queue_work(priv->ieee80211->wq,&priv->ieee80211->watch_dog_wq);
-//{by amy 080312
-#if 1
 	// Tx High Power Mechanism.
 #ifdef HIGH_POWER
 	if(CheckHighPower((struct net_device *)data))
@@ -3094,19 +2599,14 @@ void watch_dog_adaptive(unsigned long da
 		queue_work(priv->ieee80211->wq, (void *)&priv->ieee80211->hw_dig_wq);
 	}
 #endif
-#endif
-//by amy 080312}
    	rtl8180_watch_dog((struct net_device *)data);
 
-
 	queue_work(priv->ieee80211->wq, (void *)&priv->ieee80211->GPIOChangeRFWorkItem);
 
    	priv->watch_dog_timer.expires = jiffies + MSECS(IEEE80211_WATCH_DOG_TIME);
 	add_timer(&priv->watch_dog_timer);
-//        DMESG("<----watch_dog_adaptive()\n");
 }
 
-
 static CHANNEL_LIST ChannelPlan[] = {
 	{{1,2,3,4,5,6,7,8,9,10,11,36,40,44,48,52,56,60,64},19},  		//FCC
 	{{1,2,3,4,5,6,7,8,9,10,11},11},                    				//IC
@@ -3182,7 +2682,6 @@ static void rtl8180_set_channel_map(u8 c
 	}
 }
 
-//Add for RF power on power off by lizhaoming 080512
 void GPIOChangeRFWorkItemCallBack(struct work_struct *work);
 
 //YJ,add,080828
@@ -3190,6 +2689,7 @@ static void rtl8180_statistics_init(stru
 {
 	memset(pstats, 0, sizeof(struct Stats));
 }
+
 static void rtl8180_link_detect_init(plink_detect_t plink_detect)
 {
 	memset(plink_detect, 0, sizeof(link_detect_t));
@@ -3213,13 +2713,10 @@ short rtl8180_init(struct net_device *de
 		printk("rtl8180_init:Error channel plan! Set to default.\n");
 		priv->channel_plan = 0;
 	}
-	//priv->channel_plan = 9;  //Global Domain
 
 	DMESG("Channel plan is %d\n",priv->channel_plan);
 	rtl8180_set_channel_map(priv->channel_plan, priv->ieee80211);
 
-	//memcpy(priv->stats,0,sizeof(struct Stats));
-
 	//FIXME: these constants are placed in a bad pleace.
 	priv->txbuffsize = 2048;//1024;
 	priv->txringcount = 32;//32;
@@ -3227,14 +2724,9 @@ short rtl8180_init(struct net_device *de
 	priv->rxringcount = 64;//32;
 	priv->txbeaconcount = 2;
 	priv->rx_skb_complete = 1;
-	//priv->txnp_pending.ispending=0;
-	/* ^^ the SKB does not containt a partial RXed
-	 * packet (is empty)
-	 */
 
 	priv->RegThreeWireMode = HW_THREE_WIRE_SI;
 
-//Add for RF power on power off by lizhaoming 080512
 	priv->RFChangeInProgress = false;
 	priv->SetRFPowerStateInProgress = false;
 	priv->RFProgType = 0;
@@ -3242,11 +2734,8 @@ short rtl8180_init(struct net_device *de
 
 	priv->irq_enabled=0;
 
-//YJ,modified,080828
 	rtl8180_statistics_init(&priv->stats);
 	rtl8180_link_detect_init(&priv->link_detect);
-//YJ,modified,080828,end
-
 
 	priv->ack_tx_to_ieee = 0;
 	priv->ieee80211->current_network.beacon_interval = DEFAULT_BEACONINTERVAL;
@@ -3279,8 +2768,6 @@ short rtl8180_init(struct net_device *de
 	priv->eRFPowerState = eRfOff;
 	priv->RfOffReason = 0;
 	priv->LedStrategy = SW_LED_MODE0;
-	//priv->NumRxOkInPeriod = 0;  //YJ,del,080828
-	//priv->NumTxOkInPeriod = 0;  //YJ,del,080828
 	priv->TxPollingTimes = 0;//lzm add 080826
 	priv->bLeisurePs = true;
 	priv->dot11PowerSaveMode = eActive;
@@ -3336,13 +2823,10 @@ short rtl8180_init(struct net_device *de
 	priv->CurCCKRSSI = 0;
 	priv->RxPower = 0;
 	priv->RSSI = 0;
-	//YJ,add,080828
 	priv->NumTxOkTotal = 0;
 	priv->NumTxUnicast = 0;
 	priv->keepAliveLevel = DEFAULT_KEEP_ALIVE_LEVEL;
 	priv->PowerProfile = POWER_PROFILE_AC;
-	//YJ,add,080828,end
-//by amy for rate adaptive
     priv->CurrRetryCnt=0;
     priv->LastRetryCnt=0;
     priv->LastTxokCnt=0;
@@ -3363,8 +2847,6 @@ short rtl8180_init(struct net_device *de
 	priv->ForcedDataRate = 0;
 	priv->RegBModeGainStage = 1;
 
-//by amy for rate adaptive
-//by amy 080312}
 	priv->promisc = (dev->flags & IFF_PROMISC) ? 1:0;
 	spin_lock_init(&priv->irq_lock);
 	spin_lock_init(&priv->irq_th_lock);
@@ -3377,39 +2859,26 @@ short rtl8180_init(struct net_device *de
 	INIT_WORK(&priv->tx_irq_wq,(void*) rtl8180_tx_irq_wq);
 	INIT_DELAYED_WORK(&priv->ieee80211->hw_wakeup_wq,(void*) rtl8180_hw_wakeup_wq);
 	INIT_DELAYED_WORK(&priv->ieee80211->hw_sleep_wq,(void*) rtl8180_hw_sleep_wq);
-	//INIT_DELAYED_WORK(&priv->ieee80211->watch_dog_wq,(void*) rtl8180_watch_dog_wq);
-	//INIT_DELAYED_WORK(&priv->ieee80211->sw_antenna_wq,(void*) rtl8180_sw_antenna_wq);
 	INIT_WORK(&priv->ieee80211->wmm_param_update_wq,(void*) rtl8180_wmm_param_update);
 	INIT_DELAYED_WORK(&priv->ieee80211->rate_adapter_wq,(void*)rtl8180_rate_adapter);//+by amy 080312
 	INIT_DELAYED_WORK(&priv->ieee80211->hw_dig_wq,(void*)rtl8180_hw_dig_wq);//+by amy 080312
 	INIT_DELAYED_WORK(&priv->ieee80211->tx_pw_wq,(void*)rtl8180_tx_pw_wq);//+by amy 080312
 
-	//add for RF power on power off by lizhaoming 080512
 	INIT_DELAYED_WORK(&priv->ieee80211->GPIOChangeRFWorkItem,(void*) GPIOChangeRFWorkItemCallBack);
-	//INIT_WORK(&priv->reset_wq,(void*) rtl8180_restart_wq,dev);
 
 	tasklet_init(&priv->irq_rx_tasklet,
 		     (void(*)(unsigned long)) rtl8180_irq_rx_tasklet,
 		     (unsigned long)priv);
-//by amy
+
     init_timer(&priv->watch_dog_timer);
 	priv->watch_dog_timer.data = (unsigned long)dev;
 	priv->watch_dog_timer.function = watch_dog_adaptive;
-//by amy
 
-//{by amy 080312
-//by amy for rate adaptive
     init_timer(&priv->rateadapter_timer);
         priv->rateadapter_timer.data = (unsigned long)dev;
         priv->rateadapter_timer.function = timer_rate_adaptive;
 		priv->RateAdaptivePeriod= RATE_ADAPTIVE_TIMER_PERIOD;
 		priv->bEnhanceTxPwr=false;
-//by amy for rate adaptive
-//by amy 080312}
-	//priv->ieee80211->func =
-	//	kmalloc(sizeof(struct ieee80211_helper_functions),GFP_KERNEL);
-	//memset(priv->ieee80211->func, 0,
-	  //     sizeof(struct ieee80211_helper_functions));
 
 	priv->ieee80211->softmac_hard_start_xmit = rtl8180_hard_start_xmit;
 	priv->ieee80211->set_chan = rtl8180_set_chan;
@@ -3440,11 +2909,9 @@ short rtl8180_init(struct net_device *de
 									(0 ? TCR_SAT : 0);	// FALSE: HW provies PLCP length and LENGEXT, TURE: SW proiveds them
 
 	priv->ReceiveConfig	=
-//								RCR_ENMARP |
 								RCR_AMF | RCR_ADF |				//accept management/data
 								RCR_ACF |						//accept control frame for SW AP needs PS-poll, 2005.07.07, by rcnjko.
 								RCR_AB | RCR_AM | RCR_APM |		//accept BC/MC/UC
-								//RCR_AICV | RCR_ACRC32 | 		//accept ICV/CRC error packet
 								(7<<RCR_MXDMA_OFFSET) | // Max DMA Burst Size per Rx DMA Burst, 7: unlimited.
 								(priv->EarlyRxThreshold<<RCR_FIFO_OFFSET) | // Rx FIFO Threshold, 7: No Rx threshold.
 								(priv->EarlyRxThreshold == 7 ? RCR_ONLYERLPKT:0);
@@ -3475,24 +2942,20 @@ short rtl8180_init(struct net_device *de
 			/* you should not find a card with 8225 PHY ver < C*/
 			priv->phy_ver = 2;
 			break;
-
 		case HW_VERID_R8185_D:
 			DMESG("MAC controller is a RTL8185 b/g (V. D)");
 			priv->card_8185 = 2;
 			/* you should not find a card with 8225 PHY ver < C*/
 			priv->phy_ver = 2;
 			break;
-
 		case HW_VERID_R8180_ABCD:
 			DMESG("MAC controller is a RTL8180");
 			priv->card_8185 = 0;
 			break;
-
 		case HW_VERID_R8180_F:
 			DMESG("MAC controller is a RTL8180 (v. F)");
 			priv->card_8185 = 0;
 			break;
-
 		default:
 			DMESGW("MAC chip not recognized: version %x. Assuming RTL8180",hw_version);
 			priv->card_8185 = 0;
@@ -3511,72 +2974,45 @@ short rtl8180_init(struct net_device *de
         DMESG("This is a PCI NIC");
 	priv->enable_gpio0 = 0;
 
-//by amy for antenna
 	usValue = eprom_read(dev, EEPROM_SW_REVD_OFFSET);
 	DMESG("usValue is 0x%x\n",usValue);
 	//3Read AntennaDiversity
+
 	// SW Antenna Diversity.
-	if(	(usValue & EEPROM_SW_AD_MASK) != EEPROM_SW_AD_ENABLE )
-	{
+	if ((usValue & EEPROM_SW_AD_MASK) != EEPROM_SW_AD_ENABLE)
 		priv->EEPROMSwAntennaDiversity = false;
-		//printk("EEPROM Disable SW Antenna Diversity\n");
-	}
 	else
-	{
 		priv->EEPROMSwAntennaDiversity = true;
-		//printk("EEPROM Enable SW Antenna Diversity\n");
-	}
+
 	// Default Antenna to use.
-	if( (usValue & EEPROM_DEF_ANT_MASK) != EEPROM_DEF_ANT_1 )
-	{
+	if ((usValue & EEPROM_DEF_ANT_MASK) != EEPROM_DEF_ANT_1)
 		priv->EEPROMDefaultAntenna1 = false;
-		//printk("EEPROM Default Antenna 0\n");
-	}
 	else
-	{
 		priv->EEPROMDefaultAntenna1 = true;
-		//printk("EEPROM Default Antenna 1\n");
-	}
 
-	//
-	// Antenna diversity mechanism. Added by Roger, 2007.11.05.
-	//
 	if( priv->RegSwAntennaDiversityMechanism == 0 ) // Auto
-	{// 0: default from EEPROM.
+		/* 0: default from EEPROM. */
 		priv->bSwAntennaDiverity = priv->EEPROMSwAntennaDiversity;
-	}
 	else
-	{// 1:disable antenna diversity, 2: enable antenna diversity.
+		/* 1:disable antenna diversity, 2: enable antenna diversity. */
 		priv->bSwAntennaDiverity = ((priv->RegSwAntennaDiversityMechanism == 1)? false : true);
-	}
-	//printk("bSwAntennaDiverity = %d\n", priv->bSwAntennaDiverity);
 
-
-	//
-	// Default antenna settings. Added by Roger, 2007.11.05.
-	//
-	if( priv->RegDefaultAntenna == 0)
-	{// 0: default from EEPROM.
+	if (priv->RegDefaultAntenna == 0)
+		/* 0: default from EEPROM. */
 		priv->bDefaultAntenna1 = priv->EEPROMDefaultAntenna1;
-	}
 	else
-	{// 1: main, 2: aux.
+		/* 1: main, 2: aux. */
 		priv->bDefaultAntenna1 = ((priv->RegDefaultAntenna== 2) ? true : false);
-	}
-	//printk("bDefaultAntenna1 = %d\n", priv->bDefaultAntenna1);
-//by amy for antenna
+
 	/* rtl8185 can calc plcp len in HW.*/
 	priv->hw_plcp_len = 1;
 
 	priv->plcp_preamble_mode = 2;
 	/*the eeprom type is stored in RCR register bit #6 */
-	if (RCR_9356SEL & read_nic_dword(dev, RCR)){
+	if (RCR_9356SEL & read_nic_dword(dev, RCR))
 		priv->epromtype=EPROM_93c56;
-		//DMESG("Reported EEPROM chip is a 93c56 (2Kbit)");
-	}else{
+	else
 		priv->epromtype=EPROM_93c46;
-		//DMESG("Reported EEPROM chip is a 93c46 (1Kbit)");
-	}
 
 	dev->dev_addr[0]=eprom_read(dev,MAC_ADR) & 0xff;
 	dev->dev_addr[1]=(eprom_read(dev,MAC_ADR) & 0xff00)>>8;
@@ -3584,32 +3020,26 @@ short rtl8180_init(struct net_device *de
 	dev->dev_addr[3]=(eprom_read(dev,MAC_ADR+1) & 0xff00)>>8;
 	dev->dev_addr[4]=eprom_read(dev,MAC_ADR+2) & 0xff;
 	dev->dev_addr[5]=(eprom_read(dev,MAC_ADR+2) & 0xff00)>>8;
-	//DMESG("Card MAC address is "MAC_FMT, MAC_ARG(dev->dev_addr));
-
 
 	for(i=1,j=0; i<14; i+=2,j++){
-
 		word = eprom_read(dev,EPROM_TXPW_CH1_2 + j);
 		priv->chtxpwr[i]=word & 0xff;
 		priv->chtxpwr[i+1]=(word & 0xff00)>>8;
 	}
 	if(priv->card_8185){
 		for(i=1,j=0; i<14; i+=2,j++){
-
 			word = eprom_read(dev,EPROM_TXPW_OFDM_CH1_2 + j);
 			priv->chtxpwr_ofdm[i]=word & 0xff;
 			priv->chtxpwr_ofdm[i+1]=(word & 0xff00)>>8;
 		}
 	}
-//{by amy 080312
+
 	//3Read crystal calibtration and thermal meter indication on 87SE.
 
 	// By SD3 SY's request. Added by Roger, 2007.12.11.
 
 	tmpu16 = eprom_read(dev, EEPROM_RSV>>1);
 
-	//printk("ReadAdapterInfo8185(): EEPROM_RSV(%04x)\n", tmpu16);
-
 		// Crystal calibration for Xin and Xout resp.
 		priv->XtalCal_Xout = tmpu16 & EEPROM_XTAL_CAL_XOUT_MASK; // 0~7.5pF
 		priv->XtalCal_Xin = (tmpu16 & EEPROM_XTAL_CAL_XIN_MASK)>>4; // 0~7.5pF
@@ -3621,7 +3051,6 @@ short rtl8180_init(struct net_device *de
 		if((tmpu16 & EEPROM_THERMAL_METER_ENABLE)>>13)
 			priv->bTxPowerTrack = true;
 
-//by amy 080312}
 	word = eprom_read(dev,EPROM_TXPW_BASE);
 	priv->cck_txpwr_base = word & 0xf;
 	priv->ofdm_txpwr_base = (word>>4) & 0xf;
@@ -3663,9 +3092,6 @@ DMESG output to andreamrl@tiscali.it THA
 	priv->rf_chip = RF_ZEBRA4;
 	priv->rf_sleep = rtl8225z4_rf_sleep;
 	priv->rf_wakeup = rtl8225z4_rf_wakeup;
-	//DMESG("Card reports RF frontend Realtek 8225z2");
-	//DMESGW("This driver has EXPERIMENTAL support for this chipset.");
-	//DMESGW("use it with care and at your own risk and");
 	DMESGW("**PLEASE** REPORT SUCCESSFUL/UNSUCCESSFUL TO Realtek!");
 
 	priv->rf_close = rtl8225z2_rf_close;
@@ -3718,11 +3144,7 @@ DMESG output to andreamrl@tiscali.it THA
 				  TX_BEACON_RING_ADDR))
 		return -ENOMEM;
 
-
-	//priv->beacon_buf=NULL;
-
 	if(!priv->card_8185){
-
 		if(read_nic_byte(dev, CONFIG0) & (1<<CONFIG0_WEP40_SHIFT))
 			DMESG ("40-bit WEP is supported in hardware");
 		else
@@ -3746,16 +3168,13 @@ DMESG output to andreamrl@tiscali.it THA
 	}
 
 	return 0;
-
 }
 
-
 void rtl8180_no_hw_wep(struct net_device *dev)
 {
 	struct r8180_priv *priv = ieee80211_priv(dev);
 
-	if(!priv->card_8185)
-	{
+	if (!priv->card_8185) {
 		u8 security;
 
 		security  = read_nic_byte(dev, SECURITY);
@@ -3763,19 +3182,9 @@ void rtl8180_no_hw_wep(struct net_device
 		security &=~(1<<SECURITY_WEP_RX_ENABLE_SHIFT);
 
 		write_nic_byte(dev, SECURITY, security);
-
-	}else{
-
-		//FIXME!!!
 	}
-	/*
-	  write_nic_dword(dev,TX_CONF,read_nic_dword(dev,TX_CONF) |
-	  (1<<TX_NOICV_SHIFT) );
-	*/
-//	priv->ieee80211->hw_wep=0;
 }
 
-
 void rtl8180_set_hw_wep(struct net_device *dev)
 {
 	struct r8180_priv *priv = ieee80211_priv(dev);
@@ -3794,10 +3203,6 @@ void rtl8180_set_hw_wep(struct net_devic
 	write_nic_dword(dev,KEY0+4+4,(priv->key0[2]));
 	write_nic_dword(dev,KEY0+4+4+4,(key0_word4));
 
-	/*
-	  TX_CONF,read_nic_dword(dev,TX_CONF) &~(1<<TX_NOICV_SHIFT));
-	*/
-
 	security  = read_nic_byte(dev,SECURITY);
 	security |= (1<<SECURITY_WEP_TX_ENABLE_SHIFT);
 	security |= (1<<SECURITY_WEP_RX_ENABLE_SHIFT);
@@ -3809,8 +3214,6 @@ void rtl8180_set_hw_wep(struct net_devic
 	DMESG("key %x %x %x %x",read_nic_dword(dev,KEY0+4+4+4),
 	      read_nic_dword(dev,KEY0+4+4),read_nic_dword(dev,KEY0+4),
 	      read_nic_dword(dev,KEY0));
-
-	//priv->ieee80211->hw_wep=1;
 }
 
 
@@ -3819,10 +3222,8 @@ void rtl8185_rf_pins_enable(struct net_d
 //	u16 tmp;
 //	tmp = read_nic_word(dev, RFPinsEnable);
 	write_nic_word(dev, RFPinsEnable, 0x1fff);// | tmp);
-//	write_nic_word(dev, RFPinsEnable,7 | tmp);
 }
 
-
 void rtl8185_set_anaparam2(struct net_device *dev, u32 a)
 {
 	u8 conf3;
@@ -3836,10 +3237,8 @@ void rtl8185_set_anaparam2(struct net_de
 	conf3 = read_nic_byte(dev, CONFIG3);
 	write_nic_byte(dev, CONFIG3, conf3 &~(1<<CONFIG3_ANAPARAM_W_SHIFT));
 	rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
-
 }
 
-
 void rtl8180_set_anaparam(struct net_device *dev, u32 a)
 {
 	u8 conf3;
@@ -3855,7 +3254,6 @@ void rtl8180_set_anaparam(struct net_dev
 	rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
 }
 
-
 void rtl8185_tx_antenna(struct net_device *dev, u8 ant)
 {
 	write_nic_byte(dev, TX_ANTENNA, ant);
@@ -3863,12 +3261,9 @@ void rtl8185_tx_antenna(struct net_devic
 	mdelay(1);
 }
 
-
 void rtl8185_write_phy(struct net_device *dev, u8 adr, u32 data)
 {
-	//u8 phyr;
 	u32 phyw;
-	//int i;
 
 	adr |= 0x80;
 
@@ -3886,21 +3281,18 @@ void rtl8185_write_phy(struct net_device
 	//if(phyr != (data&0xff)) DMESGW("Phy write timeout %x %x %x", phyr, data,adr);
 }
 
-
 inline void write_phy_ofdm (struct net_device *dev, u8 adr, u32 data)
 {
 	data = data & 0xff;
 	rtl8185_write_phy(dev, adr, data);
 }
 
-
 void write_phy_cck (struct net_device *dev, u8 adr, u32 data)
 {
 	data = data & 0xff;
 	rtl8185_write_phy(dev, adr, data | 0x10000);
 }
 
-
 /* 70*3 = 210 ms
  * I hope this is enougth
  */
@@ -3944,55 +3336,32 @@ void rtl8185_set_rate(struct net_device 
 	u16 word;
 	int basic_rate,min_rr_rate,max_rr_rate;
 
-//	struct r8180_priv *priv = ieee80211_priv(dev);
-
-	//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);
-//		max_rr_rate = ieeerate2rtlrate(110);
-//	}
-
 	write_nic_byte(dev, RESP_RATE,
 			max_rr_rate<<MAX_RESP_RATE_SHIFT| min_rr_rate<<MIN_RESP_RATE_SHIFT);
 
 	word  = read_nic_word(dev, BRSR);
 	word &= ~BRSR_MBR_8185;
 
-
 	for(i=0;i<=basic_rate;i++)
 		word |= (1<<i);
 
 	write_nic_word(dev, BRSR, word);
-	//DMESG("RR:%x BRSR: %x", read_nic_byte(dev,RESP_RATE),read_nic_word(dev,BRSR));
 }
 
-
-
 void rtl8180_adapter_start(struct net_device *dev)
 {
         struct r8180_priv *priv = ieee80211_priv(dev);
 	u32 anaparam;
 	u16 word;
 	u8 config3;
-//	int i;
 
 	rtl8180_rtx_disable(dev);
 	rtl8180_reset(dev);
 
-	/* seems that 0xffff or 0xafff will cause
-	 * HW interrupt line crash
-	 */
-
-	//priv->irq_mask = 0xafff;
-//	priv->irq_mask = 0x4fcf;
-
 	/* enable beacon timeout, beacon TX ok and err
 	 * LP tx ok and err, HP TX ok and err, NP TX ok and err,
 	 * RX ok and ERR, and GP timer */
@@ -4024,8 +3393,6 @@ void rtl8180_adapter_start(struct net_de
 	/* These might be unnecessary since we do in rx_enable / tx_enable */
 	fix_rx_fifo(dev);
 	fix_tx_fifo(dev);
-	/*set_nic_rxring(dev);
-	  set_nic_txring(dev);*/
 
 	rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
 
@@ -4060,7 +3427,6 @@ void rtl8180_adapter_start(struct net_de
 		write_nic_byte(dev, CONFIG5,
 			read_nic_byte(dev, CONFIG5) &~ (1<<AGCRESET_SHIFT));
 	}else{
-
 		write_nic_byte(dev, WPA_CONFIG, 0);
 		//write_nic_byte(dev, TESTR, 0xd);
 	}
@@ -4070,28 +3436,23 @@ void rtl8180_adapter_start(struct net_de
 	if(priv->card_8185){
 		rtl8185_set_rate(dev);
 		write_nic_byte(dev, RATE_FALLBACK, 0x81);
-	//	write_nic_byte(dev, 0xdf, 0x15);
 	}else{
 		word  = read_nic_word(dev, BRSR);
 		word &= ~BRSR_MBR;
 		word &= ~BRSR_BPLCP;
 		word |= ieeerate2rtlrate(priv->ieee80211->basic_rate);
-//by amy
-              word |= 0x0f;
-//by amy
+		word |= 0x0f;
 		write_nic_word(dev, BRSR, word);
 	}
 
-
 	if(priv->card_8185){
 		write_nic_byte(dev, GP_ENABLE,read_nic_byte(dev, GP_ENABLE) & ~(1<<6));
 
 		//FIXME cfg 3 ClkRun enable - isn't it ReadOnly ?
 		rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
 		write_nic_byte(dev,CONFIG3, read_nic_byte(dev, CONFIG3)
-|(1<<CONFIG3_CLKRUN_SHIFT));
+			       | (1 << CONFIG3_CLKRUN_SHIFT));
 		rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
-
 	}
 
 	priv->rf_init(dev);
@@ -4101,39 +3462,23 @@ void rtl8180_adapter_start(struct net_de
 	rtl8180_irq_enable(dev);
 
 	netif_start_queue(dev);
-	/*DMESG ("lfree %d",get_curr_tx_free_desc(dev,LOW_PRIORITY));
-
-	DMESG ("nfree %d",get_curr_tx_free_desc(dev,NORM_PRIORITY));
-
-	DMESG ("hfree %d",get_curr_tx_free_desc(dev,HI_PRIORITY));
-	if(check_nic_enought_desc(dev,NORM_PRIORITY)) DMESG("NORM OK");
-	if(check_nic_enought_desc(dev,HI_PRIORITY)) DMESG("HI OK");
-	if(check_nic_enought_desc(dev,LOW_PRIORITY)) DMESG("LOW OK");*/
 }
 
-
-
 /* this configures registers for beacon tx and enables it via
  * rtl8180_beacon_tx_enable(). rtl8180_beacon_tx_disable() might
  * be used to stop beacon transmission
  */
 void rtl8180_start_tx_beacon(struct net_device *dev)
 {
-//	struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
 	u16 word;
-//	DMESG("ring %x %x", priv->txlpringdma,read_nic_dword(dev,TLPDA));
 
 	DMESG("Enabling beacon TX");
-	//write_nic_byte(dev, 0x42,0xe6);// TCR
-//	set_nic_txring(dev);
-//	fix_tx_fifo(dev);
 	rtl8180_prepare_beacon(dev);
 	rtl8180_irq_disable(dev);
 	rtl8180_beacon_tx_enable(dev);
 
 	word = read_nic_word(dev, AtimWnd) &~ AtimWnd_AtimWnd;
 	write_nic_word(dev, AtimWnd,word);// word |=
-//priv->ieee80211->current_network.atim_window);
 
 	word  = read_nic_word(dev, BintrItv);
 	word &= ~BintrItv_BintrItv;
@@ -4143,26 +3488,11 @@ void rtl8180_start_tx_beacon(struct net_
 	*/
 	write_nic_word(dev, BintrItv, word);
 
-
 	rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
 
-//	rtl8180_beacon_tx_enable(dev);
         rtl8185b_irq_enable(dev);
-	/* VV !!!!!!!!!! VV*/
-	/*
-	rtl8180_set_mode(dev,EPROM_CMD_CONFIG);
-	write_nic_byte(dev,0x9d,0x00);
-	rtl8180_set_mode(dev,EPROM_CMD_NORMAL);
-*/
-//	DMESG("ring %x %x", priv->txlpringdma,read_nic_dword(dev,TLPDA));
-
 }
 
-
-
-/***************************************************************************
-    -------------------------------NET STUFF---------------------------
-***************************************************************************/
 static struct net_device_stats *rtl8180_stats(struct net_device *dev)
 {
 	struct r8180_priv *priv = ieee80211_priv(dev);
@@ -4179,93 +3509,42 @@ MgntActSet_802_11_PowerSaveMode(
 	RT_PS_MODE		rtPsMode
 )
 {
-
 	// Currently, we do not change power save mode on IBSS mode.
 	if(priv->ieee80211->iw_mode == IW_MODE_ADHOC)
-	{
 		return false;
-	}
-
-	//
-	// <RJ_NOTE> If we make HW to fill up the PwrMgt bit for us,
-	// some AP will not response to our mgnt frames with PwrMgt bit set,
-	// e.g. cannot associate the AP.
-	// So I commented out it. 2005.02.16, by rcnjko.
-	//
-//	// Change device's power save mode.
-//	Adapter->HalFunc.SetPSModeHandler( Adapter, rtPsMode );
 
-	// Update power save mode configured.
-//	priv->dot11PowerSaveMode = rtPsMode;
 	priv->ieee80211->ps = rtPsMode;
-	// Determine ListenInterval.
 
 	return true;
 }
 
-//================================================================================
-// Leisure Power Save in linked state.
-//================================================================================
-
-//
-//	Description:
-//		Enter the leisure power save mode.
-//
-void
-LeisurePSEnter(
-	struct r8180_priv *priv
-	)
+void LeisurePSEnter(struct r8180_priv *priv)
 {
-	if (priv->bLeisurePs)
-	{
+	if (priv->bLeisurePs) {
 		if (priv->ieee80211->ps == IEEE80211_PS_DISABLED)
-		{
-			//printk("----Enter PS\n");
 			MgntActSet_802_11_PowerSaveMode(priv, IEEE80211_PS_MBCAST|IEEE80211_PS_UNICAST);//IEEE80211_PS_ENABLE
-		}
 	}
 }
 
-
-//
-//	Description:
-//		Leave the leisure power save mode.
-//
-void
-LeisurePSLeave(
-	struct r8180_priv *priv
-	)
+void LeisurePSLeave(struct r8180_priv *priv)
 {
-	if (priv->bLeisurePs)
-	{
+	if (priv->bLeisurePs) {
 		if (priv->ieee80211->ps != IEEE80211_PS_DISABLED)
-		{
-			//printk("----Leave PS\n");
 			MgntActSet_802_11_PowerSaveMode(priv, IEEE80211_PS_DISABLED);
-		}
 	}
 }
 
 void rtl8180_hw_wakeup_wq (struct work_struct *work)
 {
-//	struct r8180_priv *priv = container_of(work, struct r8180_priv, watch_dog_wq);
-//	struct ieee80211_device * ieee = (struct ieee80211_device*)
-//	                                       container_of(work, struct ieee80211_device, watch_dog_wq);
 	struct delayed_work *dwork = to_delayed_work(work);
 	struct ieee80211_device *ieee = container_of(dwork,struct ieee80211_device,hw_wakeup_wq);
 	struct net_device *dev = ieee->dev;
 
-//	printk("dev is %d\n",dev);
-//	printk("&*&(^*(&(&=========>%s()\n", __func__);
 	rtl8180_hw_wakeup(dev);
-
 }
 
 void rtl8180_hw_sleep_wq (struct work_struct *work)
 {
-//      struct r8180_priv *priv = container_of(work, struct r8180_priv, watch_dog_wq);
-//      struct ieee80211_device * ieee = (struct ieee80211_device*)
-//                                             container_of(work, struct ieee80211_device, watch_dog_wq);
 	struct delayed_work *dwork = to_delayed_work(work);
         struct ieee80211_device *ieee = container_of(dwork,struct ieee80211_device,hw_sleep_wq);
         struct net_device *dev = ieee->dev;
@@ -4273,7 +3552,6 @@ void rtl8180_hw_sleep_wq (struct work_st
         rtl8180_hw_sleep_down(dev);
 }
 
-//YJ,add,080828,for KeepAlive
 static void MgntLinkKeepAlive(struct r8180_priv *priv )
 {
 	if (priv->keepAliveLevel == 0)
@@ -4284,7 +3562,6 @@ static void MgntLinkKeepAlive(struct r81
 		//
 		// Keep-Alive.
 		//
-		//printk("LastTx:%d Tx:%d LastRx:%d Rx:%ld Idle:%d\n",priv->link_detect.LastNumTxUnicast,priv->NumTxUnicast, priv->link_detect.LastNumRxUnicast, priv->ieee80211->NumRxUnicast, priv->link_detect.IdleCount);
 
 		if ( (priv->keepAliveLevel== 2) ||
 			(priv->link_detect.LastNumTxUnicast == priv->NumTxUnicast &&
@@ -4310,9 +3587,9 @@ static void MgntLinkKeepAlive(struct r81
 		priv->link_detect.LastNumRxUnicast = priv->ieee80211->NumRxUnicast;
 	}
 }
-//YJ,add,080828,for KeepAlive,end
 
 static u8 read_acadapter_file(char *filename);
+
 void rtl8180_watch_dog(struct net_device *dev)
 {
 	struct r8180_priv *priv = ieee80211_priv(dev);
@@ -4334,7 +3611,7 @@ void rtl8180_watch_dog(struct net_device
 		priv->link_detect.RxFrameNum[SlotIndex] = priv->ieee80211->NumRxDataInPeriod + priv->ieee80211->NumRxBcnInPeriod;
 		for( i=0; i<priv->link_detect.SlotNum; i++ )
 			TotalRxNum+= priv->link_detect.RxFrameNum[i];
-		//printk("&&&&&=== TotalRxNum = %d\n", TotalRxNum);
+
 		if(TotalRxNum == 0){
 			priv->ieee80211->state = IEEE80211_ASSOCIATING;
 			queue_work(priv->ieee80211->wq, &priv->ieee80211->associate_procedure_wq);
@@ -4346,22 +3623,13 @@ void rtl8180_watch_dog(struct net_device
 
 	//YJ,add,080828,for LPS
 #ifdef ENABLE_LPS
-	if(priv->PowerProfile == POWER_PROFILE_BATTERY )
-	{
-		//Turn on LeisurePS on battery power
-		//printk("!!!!!On battery power\n");
+	if (priv->PowerProfile == POWER_PROFILE_BATTERY)
 		priv->bLeisurePs = true;
-	}
-	else if(priv->PowerProfile == POWER_PROFILE_AC )
-	{
-		// Turn off LeisurePS on AC power
-		//printk("----On AC power\n");
+	else if (priv->PowerProfile == POWER_PROFILE_AC) {
 		LeisurePSLeave(priv);
 		priv->bLeisurePs= false;
 	}
-#endif
 
-#ifdef ENABLE_LPS
 	if(priv->ieee80211->state == IEEE80211_LINKED){
 		priv->link_detect.NumRxOkInPeriod = priv->ieee80211->NumRxDataInPeriod;
 		//printk("TxOk=%d RxOk=%d\n", priv->link_detect.NumTxOkInPeriod, priv->link_detect.NumRxOkInPeriod);
@@ -4372,21 +3640,15 @@ void rtl8180_watch_dog(struct net_device
 		if(((priv->link_detect.NumRxOkInPeriod + priv->link_detect.NumTxOkInPeriod) > 8)
 			|| (priv->link_detect.NumRxOkInPeriod > 2)) {
 			bEnterPS= false;
-		}
-		else {
+		} else
 			bEnterPS= true;
-		}
 
-		if(bEnterPS) {
+		if (bEnterPS)
 			LeisurePSEnter(priv);
-		}
-		else {
+		else
 			LeisurePSLeave(priv);
-		}
-	}
-	else{
+	} else
 		LeisurePSLeave(priv);
-	}
 #endif
 	priv->link_detect.bBusyTraffic = bBusyTraffic;
 	priv->link_detect.NumRxOkInPeriod = 0;
@@ -4394,10 +3656,10 @@ void rtl8180_watch_dog(struct net_device
 	priv->ieee80211->NumRxDataInPeriod = 0;
 	priv->ieee80211->NumRxBcnInPeriod = 0;
 }
+
 int _rtl8180_up(struct net_device *dev)
 {
 	struct r8180_priv *priv = ieee80211_priv(dev);
-	//int i;
 
 	priv->up=1;
 
@@ -4411,28 +3673,19 @@ int _rtl8180_up(struct net_device *dev)
 			IPSLeave(dev);
 	}
 #endif
-//by amy 080312
 #ifdef RATE_ADAPT
        timer_rate_adaptive((unsigned long)dev);
 #endif
-//by amy 080312
 	watch_dog_adaptive((unsigned long)dev);
 #ifdef SW_ANTE
         if(priv->bSwAntennaDiverity)
 			SwAntennaDiversityTimerCallback(dev);
 #endif
-//	IPSEnter(dev);
 	ieee80211_softmac_start_protocol(priv->ieee80211);
 
-//Add for RF power on power off by lizhaoming 080512
-//	priv->eRFPowerState = eRfOn;
-//	printk("\n--------Start queue_work:GPIOChangeRFWorkItem");
-//	queue_delayed_work(priv->ieee80211->wq,&priv->ieee80211->GPIOChangeRFWorkItem,1000);
-
 	return 0;
 }
 
-
 int rtl8180_open(struct net_device *dev)
 {
 	struct r8180_priv *priv = ieee80211_priv(dev);
@@ -4442,10 +3695,8 @@ int rtl8180_open(struct net_device *dev)
 	ret = rtl8180_up(dev);
 	up(&priv->wx_sem);
 	return ret;
-
 }
 
-
 int rtl8180_up(struct net_device *dev)
 {
 	struct r8180_priv *priv = ieee80211_priv(dev);
@@ -4455,7 +3706,6 @@ int rtl8180_up(struct net_device *dev)
 	return _rtl8180_up(dev);
 }
 
-
 int rtl8180_close(struct net_device *dev)
 {
 	struct r8180_priv *priv = ieee80211_priv(dev);
@@ -4466,14 +3716,14 @@ int rtl8180_close(struct net_device *dev
 	up(&priv->wx_sem);
 
 	return ret;
-
 }
 
 int rtl8180_down(struct net_device *dev)
 {
 	struct r8180_priv *priv = ieee80211_priv(dev);
 
-	if (priv->up == 0) return -1;
+	if (priv->up == 0)
+		return -1;
 
 	priv->up=0;
 
@@ -4484,18 +3734,14 @@ int rtl8180_down(struct net_device *dev)
 	rtl8180_rtx_disable(dev);
 	rtl8180_irq_disable(dev);
 	del_timer_sync(&priv->watch_dog_timer);
-	//cancel_delayed_work(&priv->ieee80211->watch_dog_wq);
-//{by amy 080312
-    del_timer_sync(&priv->rateadapter_timer);
-    cancel_delayed_work(&priv->ieee80211->rate_adapter_wq);
-//by amy 080312}
+	del_timer_sync(&priv->rateadapter_timer);
+	cancel_delayed_work(&priv->ieee80211->rate_adapter_wq);
 	cancel_delayed_work(&priv->ieee80211->hw_wakeup_wq);
 	cancel_delayed_work(&priv->ieee80211->hw_sleep_wq);
 	cancel_delayed_work(&priv->ieee80211->hw_dig_wq);
 	cancel_delayed_work(&priv->ieee80211->tx_pw_wq);
 	del_timer_sync(&priv->SwAntennaDiversityTimer);
 	SetZebraRFPowerState8185(dev,eRfOff);
-	//ieee80211_softmac_stop_protocol(priv->ieee80211);
 	memset(&(priv->ieee80211->current_network),0,sizeof(struct ieee80211_network));
 	priv->ieee80211->state = IEEE80211_NOLINK;
 	return 0;
@@ -4516,26 +3762,20 @@ void rtl8180_restart_wq(struct work_stru
 void rtl8180_restart(struct net_device *dev)
 {
 	struct r8180_priv *priv = ieee80211_priv(dev);
-	//rtl8180_commit(dev);
+
 	schedule_work(&priv->reset_wq);
-	//DMESG("TXTIMEOUT");
 }
 
-
 void rtl8180_commit(struct net_device *dev)
 {
 	struct r8180_priv *priv = ieee80211_priv(dev);
 
-	if (priv->up == 0) return ;
-//+by amy 080312
+	if (priv->up == 0)
+		return ;
+
 	del_timer_sync(&priv->watch_dog_timer);
-	//cancel_delayed_work(&priv->ieee80211->watch_dog_wq);
-//{by amy 080312
-//by amy for rate adaptive
-    del_timer_sync(&priv->rateadapter_timer);
-    cancel_delayed_work(&priv->ieee80211->rate_adapter_wq);
-//by amy for rate adaptive
-//by amy 080312}
+	del_timer_sync(&priv->rateadapter_timer);
+	cancel_delayed_work(&priv->ieee80211->rate_adapter_wq);
 	cancel_delayed_work(&priv->ieee80211->hw_wakeup_wq);
 	cancel_delayed_work(&priv->ieee80211->hw_sleep_wq);
 	cancel_delayed_work(&priv->ieee80211->hw_dig_wq);
@@ -4547,22 +3787,17 @@ void rtl8180_commit(struct net_device *d
 	_rtl8180_up(dev);
 }
 
-
 static void r8180_set_multicast(struct net_device *dev)
 {
 	struct r8180_priv *priv = ieee80211_priv(dev);
 	short promisc;
 
-	//down(&priv->wx_sem);
-
 	promisc = (dev->flags & IFF_PROMISC) ? 1:0;
 
 	if (promisc != priv->promisc)
 		rtl8180_restart(dev);
 
 	priv->promisc = promisc;
-
-	//up(&priv->wx_sem);
 }
 
 int r8180_set_mac_adr(struct net_device *dev, void *mac)
@@ -4591,27 +3826,20 @@ int r8180_set_mac_adr(struct net_device 
 int rtl8180_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 {
 	struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
 	struct iwreq *wrq = (struct iwreq *) rq;
 	int ret=-1;
+
 	switch (cmd) {
-	    case RTL_IOCTL_WPA_SUPPLICANT:
+	case RTL_IOCTL_WPA_SUPPLICANT:
 		ret = ieee80211_wpa_supplicant_ioctl(priv->ieee80211, &wrq->u.data);
 		return ret;
-
-	    default:
+	default:
 		return -EOPNOTSUPP;
 	}
 
 	return -EOPNOTSUPP;
 }
 
-
-
-/****************************************************************************
-     -----------------------------PCI STUFF---------------------------
-*****************************************************************************/
-
 static const struct net_device_ops rtl8180_netdev_ops = {
 	.ndo_open		= rtl8180_open,
 	.ndo_stop		= rtl8180_close,
@@ -4631,7 +3859,6 @@ static int __devinit rtl8180_pci_probe(s
 	unsigned long ioaddr = 0;
 	struct net_device *dev = NULL;
 	struct r8180_priv *priv= NULL;
-	//u8 *ptr;
 	u8 unit = 0;
 
 	unsigned long pmem_start, pmem_len, pmem_flags;
@@ -4644,7 +3871,6 @@ static int __devinit rtl8180_pci_probe(s
 	}
 
 	pci_set_master(pdev);
-	//pci_set_wmi(pdev);
 	pci_set_dma_mask(pdev, 0xffffff00ULL);
 	pci_set_consistent_dma_mask(pdev,0xffffff00ULL);
 	dev = alloc_ieee80211(sizeof(struct r8180_priv));
@@ -4657,10 +3883,7 @@ static int __devinit rtl8180_pci_probe(s
 	SET_NETDEV_DEV(dev, &pdev->dev);
 
 	priv = ieee80211_priv(dev);
-//	memset(priv,0,sizeof(struct r8180_priv));
-	priv->pdev=pdev;
-
-
+	priv->pdev = pdev;
 
 	pmem_start = pci_resource_start(pdev, 1);
 	pmem_len = pci_resource_len(pdev, 1);
@@ -4671,26 +3894,20 @@ static int __devinit rtl8180_pci_probe(s
 		goto fail;
 	}
 
-	//DMESG("Memory mapped space @ 0x%08lx ", pmem_start);
 	if( ! request_mem_region(pmem_start, pmem_len, RTL8180_MODULE_NAME)) {
 		DMESG("request_mem_region failed!");
 		goto fail;
 	}
 
-
 	ioaddr = (unsigned long)ioremap_nocache( pmem_start, pmem_len);
 	if( ioaddr == (unsigned long)NULL ){
 		DMESG("ioremap failed!");
-	       // release_mem_region( pmem_start, pmem_len );
 		goto fail1;
 	}
 
 	dev->mem_start = ioaddr; // shared mem start
 	dev->mem_end = ioaddr + pci_resource_len(pdev, 0); // shared mem end
 
-
-	//pci_read_config_byte(pdev, 0x05, ptr);
-	//pci_write_config_byte(pdev, 0x05, (*ptr) & (~0x04));
 	pci_read_config_byte(pdev, 0x05, &unit);
 	pci_write_config_byte(pdev, 0x05, unit & (~0x04));
 
@@ -4706,11 +3923,9 @@ static int __devinit rtl8180_pci_probe(s
 	if (dev_alloc_name(dev, ifname) < 0){
                 DMESG("Oops: devname already taken! Trying wlan%%d...\n");
 		ifname = "wlan%d";
-	//	ifname = "ath%d";
 		dev_alloc_name(dev, ifname);
         }
 
-
 	if(rtl8180_init(dev)!=0){
 		DMESG("Initialization failed");
 		goto fail1;
@@ -4724,19 +3939,14 @@ static int __devinit rtl8180_pci_probe(s
 
 	DMESG("Driver probe completed\n");
 	return 0;
-
 fail1:
-
 	if( dev->mem_start != (unsigned long)NULL ){
 		iounmap( (void *)dev->mem_start );
 		release_mem_region( pci_resource_start(pdev, 1),
 				    pci_resource_len(pdev, 1) );
 	}
-
-
 fail:
 	if(dev){
-
 		if (priv->irq) {
 			free_irq(dev->irq, dev);
 			dev->irq=0;
@@ -4749,42 +3959,32 @@ fail:
 	DMESG("wlan driver load failed\n");
 	pci_set_drvdata(pdev, NULL);
 	return -ENODEV;
-
 }
 
-
 static void __devexit rtl8180_pci_remove(struct pci_dev *pdev)
 {
 	struct r8180_priv *priv;
 	struct net_device *dev = pci_get_drvdata(pdev);
- 	if(dev){
 
+	if (dev) {
 		unregister_netdev(dev);
 
-		priv=ieee80211_priv(dev);
+		priv = ieee80211_priv(dev);
 
 		rtl8180_proc_remove_one(dev);
 		rtl8180_down(dev);
 		priv->rf_close(dev);
 		rtl8180_reset(dev);
-		//rtl8180_rtx_disable(dev);
-		//rtl8180_irq_disable(dev);
 		mdelay(10);
-		//write_nic_word(dev,INTA,read_nic_word(dev,INTA));
-		//force_pci_posting(dev);
-		//mdelay(10);
 
 		if(priv->irq){
-
 			DMESG("Freeing irq %d",dev->irq);
 			free_irq(dev->irq, dev);
 			priv->irq=0;
-
 		}
 
 		free_rx_desc_ring(dev);
 		free_tx_desc_rings(dev);
-	//	free_beacon_desc_ring(dev,priv->txbeaconcount);
 
 		if( dev->mem_start != (unsigned long)NULL ){
 			iounmap( (void *)dev->mem_start );
@@ -4799,7 +3999,6 @@ static void __devexit rtl8180_pci_remove
 	DMESG("wlan driver removed\n");
 }
 
-
 /* fun with the built-in ieee80211 stack... */
 extern int ieee80211_crypto_init(void);
 extern void ieee80211_crypto_deinit(void);
@@ -4842,17 +4041,13 @@ static int __init rtl8180_pci_module_ini
 	DMESG("Wireless extensions version %d", WIRELESS_EXT);
 	rtl8180_proc_module_init();
 
-      if(0!=pci_register_driver(&rtl8180_pci_driver))
-	//if(0!=pci_module_init(&rtl8180_pci_driver))
-	{
+      if (pci_register_driver(&rtl8180_pci_driver)) {
 		DMESG("No device found");
-		/*pci_unregister_driver (&rtl8180_pci_driver);*/
 		return -ENODEV;
 	}
 	return 0;
 }
 
-
 static void __exit rtl8180_pci_module_exit(void)
 {
 	pci_unregister_driver (&rtl8180_pci_driver);
@@ -4864,7 +4059,6 @@ static void __exit rtl8180_pci_module_ex
 	DMESG("Exiting");
 }
 
-
 void rtl8180_try_wake_queue(struct net_device *dev, int pri)
 {
 	unsigned long flags;
@@ -4879,25 +4073,17 @@ void rtl8180_try_wake_queue(struct net_d
 		ieee80211_wake_queue(priv->ieee80211);
 }
 
-/*****************************************************************************
-      -----------------------------IRQ STUFF---------------------------
-******************************************************************************/
-
 void rtl8180_tx_isr(struct net_device *dev, int pri,short error)
 {
 	struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
 	u32 *tail; //tail virtual addr
 	u32 *head; //head virtual addr
 	u32 *begin;//start of ring virtual addr
 	u32 *nicv; //nic pointer virtual addr
-//	u32 *txdv; //packet just TXed
 	u32 nic; //nic pointer physical addr
 	u32 nicbegin;// start of ring physical addr
-//	short txed;
 	unsigned long flag;
 	/* physical addr are ok on 32 bits since we set DMA mask*/
-
 	int offs;
 	int j,i;
 	int hd;
@@ -4911,7 +4097,6 @@ void rtl8180_tx_isr(struct net_device *d
 		nic = read_nic_dword(dev,TX_MANAGEPRIORITY_RING_ADDR);
 		nicbegin = priv->txmapringdma;
 		break;
-
 	case BK_PRIORITY:
 		tail = priv->txbkpringtail;
 		begin = priv->txbkpring;
@@ -4919,7 +4104,6 @@ void rtl8180_tx_isr(struct net_device *d
 		nic = read_nic_dword(dev,TX_BKPRIORITY_RING_ADDR);
 		nicbegin = priv->txbkpringdma;
 		break;
-
 	case BE_PRIORITY:
 		tail = priv->txbepringtail;
 		begin = priv->txbepring;
@@ -4927,7 +4111,6 @@ void rtl8180_tx_isr(struct net_device *d
 		nic = read_nic_dword(dev,TX_BEPRIORITY_RING_ADDR);
 		nicbegin = priv->txbepringdma;
 		break;
-
 	case VI_PRIORITY:
 		tail = priv->txvipringtail;
 		begin = priv->txvipring;
@@ -4935,7 +4118,6 @@ void rtl8180_tx_isr(struct net_device *d
 		nic = read_nic_dword(dev,TX_VIPRIORITY_RING_ADDR);
 		nicbegin = priv->txvipringdma;
 		break;
-
 	case VO_PRIORITY:
 		tail = priv->txvopringtail;
 		begin = priv->txvopring;
@@ -4943,7 +4125,6 @@ void rtl8180_tx_isr(struct net_device *d
 		nic = read_nic_dword(dev,TX_VOPRIORITY_RING_ADDR);
 		nicbegin = priv->txvopringdma;
 		break;
-
 	case HI_PRIORITY:
 		tail = priv->txhpringtail;
 		begin = priv->txhpring;
@@ -4956,12 +4137,7 @@ void rtl8180_tx_isr(struct net_device *d
 		spin_unlock_irqrestore(&priv->tx_lock,flag);
 		return ;
 	}
-/*	DMESG("%x %s %x %x",((int)nic & 0xfff)/8/4,
-	*(priv->txnpring + ((int)nic&0xfff)/4/8) & (1<<31) ? "filled" : "empty",
-	(priv->txnpringtail - priv->txnpring)/8,(priv->txnpringhead -
-priv->txnpring)/8);
-*/
-	//nicv = (u32*) ((nic - nicbegin) + (int)begin);
+
 	nicv = (u32*) ((nic - nicbegin) + (u8*)begin);
 	if((head <= tail && (nicv > tail || nicv < head)) ||
 		(head > tail && (nicv > tail && nicv < head))){
@@ -4975,56 +4151,39 @@ priv->txnpring)/8);
 	 * but not the currenly pointed by the nic (the next to be txed)
 	 * and the previous of the pointed (might be in process ??)
 	*/
-	//if (head == nic) return;
-	//DMESG("%x %x",head,nic);
 	offs = (nic - nicbegin);
-	//DMESG("%x %x %x",nic ,(u32)nicbegin, (int)nic -nicbegin);
-
 	offs = offs / 8 /4;
-
 	hd = (head - begin) /8;
 
 	if(offs >= hd)
 		j = offs - hd;
 	else
 		j = offs + (priv->txringcount -1 -hd);
-	//	j= priv->txringcount -1- (hd - offs);
 
 	j-=2;
 	if(j<0) j=0;
 
-
 	for(i=0;i<j;i++)
 	{
-//		printk("+++++++++++++check status desc\n");
 		if((*head) & (1<<31))
 			break;
 		if(((*head)&(0x10000000)) != 0){
-//			printk("++++++++++++++last desc,retry count is %d\n",((*head) & (0x000000ff)));
 			priv->CurrRetryCnt += (u16)((*head) & (0x000000ff));
-#if 1
-			if(!error)
-			{
+			if (!error)
 				priv->NumTxOkTotal++;
-//				printk("NumTxOkTotal is %d\n",priv->NumTxOkTotal++);
-			}
-#endif
-			//	printk("in function %s:curr_retry_count is %d\n",__func__,((*head) & (0x000000ff)));
 		}
-		if(!error){
+
+		if (!error)
 			priv->NumTxOkBytesTotal += (*(head+3)) & (0x00000fff);
-		}
-//		printk("in function %s:curr_txokbyte_count is %d\n",__func__,(*(head+3)) & (0x00000fff));
+
 		*head = *head &~ (1<<31);
 
 		if((head - begin)/8 == priv->txringcount-1)
 			head=begin;
-
 		else
 			head+=8;
 	}
 
-	//DMESG("%x",txdv[0]);
 	/* the head has been moved to the last certainly TXed
 	 * (or at least processed by the nic) packet.
 	 * The driver take forcefully owning of all these packets
@@ -5037,53 +4196,36 @@ priv->txnpring)/8);
 	switch(pri) {
 	case MANAGE_PRIORITY:
 		priv->txmapringhead = head;
-			//printk("1==========================================> priority check!\n");
+
 		if(priv->ack_tx_to_ieee){
-				// try to implement power-save mode 2008.1.22
-		//	printk("2==========================================> priority check!\n");
-#if 1
 			if(rtl8180_is_tx_queue_empty(dev)){
-			//	printk("tx queue empty, after send null sleep packet, try to sleep !\n");
 				priv->ack_tx_to_ieee = 0;
 				ieee80211_ps_tx_ack(priv->ieee80211,!error);
 			}
-#endif
 		}
 		break;
-
 	case BK_PRIORITY:
 		priv->txbkpringhead = head;
 		break;
-
 	case BE_PRIORITY:
 		priv->txbepringhead = head;
 		break;
-
 	case VI_PRIORITY:
 		priv->txvipringhead = head;
 		break;
-
 	case VO_PRIORITY:
 		priv->txvopringhead = head;
 		break;
-
 	case HI_PRIORITY:
 		priv->txhpringhead = head;
 		break;
 	}
 
-	/*DMESG("%x %x %x", (priv->txnpringhead - priv->txnpring) /8 ,
-		(priv->txnpringtail - priv->txnpring) /8,
-		offs );
-	*/
-
 	spin_unlock_irqrestore(&priv->tx_lock,flag);
-
 }
 
 void rtl8180_tx_irq_wq(struct work_struct *work)
 {
-	//struct r8180_priv *priv = container_of(work, struct r8180_priv, reset_wq);
 	struct delayed_work *dwork = to_delayed_work(work);
 	struct ieee80211_device * ieee = (struct ieee80211_device*)
 	                                       container_of(dwork, struct ieee80211_device, watch_dog_wq);
@@ -5109,8 +4251,6 @@ irqreturn_t rtl8180_interrupt(int irq, v
 
 	priv->stats.shints++;
 
-	//DMESG("Enter interrupt, ISR value = 0x%08x", inta);
-
 	if(!inta){
 		spin_unlock_irqrestore(&priv->irq_th_lock,flags);
 		return IRQ_HANDLED;
@@ -5120,41 +4260,30 @@ irqreturn_t rtl8180_interrupt(int irq, v
 	*/
 	}
 
-	if(inta == 0xffff){
-			/* HW disappared */
-			spin_unlock_irqrestore(&priv->irq_th_lock,flags);
-			return IRQ_HANDLED;
+	if (inta == 0xffff) {
+		/* HW disappared */
+		spin_unlock_irqrestore(&priv->irq_th_lock, flags);
+		return IRQ_HANDLED;
 	}
 
 	priv->stats.ints++;
-	//priv->irqpending = inta;
-
 
 	if(!netif_running(dev)) {
 		spin_unlock_irqrestore(&priv->irq_th_lock,flags);
 		return IRQ_HANDLED;
 	}
 
-	if(inta & ISR_TimeOut){
+	if (inta & ISR_TimeOut)
 		write_nic_dword(dev, TimerInt, 0);
-		//DMESG("=================>waking up");
-//		rtl8180_hw_wakeup(dev);
-	}
 
-	if(inta & ISR_TBDOK){
+	if (inta & ISR_TBDOK)
 		priv->stats.txbeacon++;
-	}
 
-	if(inta & ISR_TBDER){
+	if (inta & ISR_TBDER)
 		priv->stats.txbeaconerr++;
-	}
 
-	if(inta  & IMR_TMGDOK ) {
-//		priv->NumTxOkTotal++;
+	if (inta & IMR_TMGDOK)
 		rtl8180_tx_isr(dev,MANAGE_PRIORITY,0);
-//			schedule_work(&priv->tx_irq_wq);
-
-	}
 
 	if(inta & ISR_THPDER){
 		priv->stats.txhperr++;
@@ -5163,8 +4292,6 @@ irqreturn_t rtl8180_interrupt(int irq, v
 	}
 
 	if(inta & ISR_THPDOK){ //High priority tx ok
-//		priv->NumTxOkTotal++;
-		//priv->NumTxOkInPeriod++;  //YJ,del,080828
 		priv->link_detect.NumTxOkInPeriod++; //YJ,add,080828
 		priv->stats.txhpokint++;
 		rtl8180_tx_isr(dev,HI_PRIORITY,0);
@@ -5176,7 +4303,6 @@ irqreturn_t rtl8180_interrupt(int irq, v
 	if(inta & ISR_TBKDER){ //corresponding to BK_PRIORITY
 		priv->stats.txbkperr++;
 		priv->ieee80211->stats.tx_errors++;
-		//tasklet_schedule(&priv->irq_tx_tasklet);
 		rtl8180_tx_isr(dev,BK_PRIORITY,1);
 		rtl8180_try_wake_queue(dev, BE_PRIORITY);
 	}
@@ -5185,13 +4311,11 @@ irqreturn_t rtl8180_interrupt(int irq, v
 		priv->stats.txbeperr++;
 		priv->ieee80211->stats.tx_errors++;
 		rtl8180_tx_isr(dev,BE_PRIORITY,1);
-		//tasklet_schedule(&priv->irq_tx_tasklet);
 		rtl8180_try_wake_queue(dev, BE_PRIORITY);
 	}
 	if(inta & ISR_TNPDER){ //corresponding to VO_PRIORITY
 		priv->stats.txnperr++;
 		priv->ieee80211->stats.tx_errors++;
-		//tasklet_schedule(&priv->irq_tx_tasklet);
 		rtl8180_tx_isr(dev,NORM_PRIORITY,1);
 		rtl8180_try_wake_queue(dev, NORM_PRIORITY);
 	}
@@ -5200,23 +4324,19 @@ irqreturn_t rtl8180_interrupt(int irq, v
 		priv->stats.txlperr++;
 		priv->ieee80211->stats.tx_errors++;
 		rtl8180_tx_isr(dev,LOW_PRIORITY,1);
-		//tasklet_schedule(&priv->irq_tx_tasklet);
 		rtl8180_try_wake_queue(dev, LOW_PRIORITY);
 	}
 
 	if(inta & ISR_ROK){
-		//priv->NumRxOkInPeriod++;  //YJ,del,080828
 		priv->stats.rxint++;
 		tasklet_schedule(&priv->irq_rx_tasklet);
 	}
 
 	if(inta & ISR_RQoSOK ){
-		//priv->NumRxOkInPeriod++;  //YJ,del,080828
 		priv->stats.rxint++;
 		tasklet_schedule(&priv->irq_rx_tasklet);
 	}
 	if(inta & ISR_BcnInt) {
-		//DMESG("Preparing Beacons");
 		rtl8180_prepare_beacon(dev);
 	}
 
@@ -5224,31 +4344,24 @@ irqreturn_t rtl8180_interrupt(int irq, v
 		DMESGW("No RX descriptor available");
 		priv->stats.rxrdu++;
 		tasklet_schedule(&priv->irq_rx_tasklet);
-		/*queue_work(priv->workqueue ,&priv->restart_work);*/
-
 	}
+
 	if(inta & ISR_RXFOVW){
 		priv->stats.rxoverflow++;
 		tasklet_schedule(&priv->irq_rx_tasklet);
-		//queue_work(priv->workqueue ,&priv->restart_work);
 	}
 
-	if(inta & ISR_TXFOVW) priv->stats.txoverflow++;
+	if (inta & ISR_TXFOVW)
+		priv->stats.txoverflow++;
 
 	if(inta & ISR_TNPDOK){ //Normal priority tx ok
-//		priv->NumTxOkTotal++;
-		//priv->NumTxOkInPeriod++;  //YJ,del,080828
 		priv->link_detect.NumTxOkInPeriod++; //YJ,add,080828
-		//	priv->ieee80211->stats.tx_packets++;
 		priv->stats.txnpokint++;
 		rtl8180_tx_isr(dev,NORM_PRIORITY,0);
 	}
 
 	if(inta & ISR_TLPDOK){ //Low priority tx ok
-//		priv->NumTxOkTotal++;
-		//priv->NumTxOkInPeriod++;  //YJ,del,080828
 		priv->link_detect.NumTxOkInPeriod++; //YJ,add,080828
-		//	priv->ieee80211->stats.tx_packets++;
 		priv->stats.txlpokint++;
 		rtl8180_tx_isr(dev,LOW_PRIORITY,0);
 		rtl8180_try_wake_queue(dev, LOW_PRIORITY);
@@ -5256,8 +4369,6 @@ irqreturn_t rtl8180_interrupt(int irq, v
 
 	if(inta & ISR_TBKDOK){ //corresponding to BK_PRIORITY
 		priv->stats.txbkpokint++;
-//		priv->NumTxOkTotal++;
-		//priv->NumTxOkInPeriod++;  //YJ,del,080828
 		priv->link_detect.NumTxOkInPeriod++; //YJ,add,080828
 		rtl8180_tx_isr(dev,BK_PRIORITY,0);
 		rtl8180_try_wake_queue(dev, BE_PRIORITY);
@@ -5265,8 +4376,6 @@ irqreturn_t rtl8180_interrupt(int irq, v
 
 	if(inta & ISR_TBEDOK){ //corresponding to BE_PRIORITY
 		priv->stats.txbeperr++;
-//		priv->NumTxOkTotal++;
-		//priv->NumTxOkInPeriod++;  //YJ,del,080828
 		priv->link_detect.NumTxOkInPeriod++; //YJ,add,080828
 		rtl8180_tx_isr(dev,BE_PRIORITY,0);
 		rtl8180_try_wake_queue(dev, BE_PRIORITY);
@@ -5277,40 +4386,16 @@ irqreturn_t rtl8180_interrupt(int irq, v
 	return IRQ_HANDLED;
 }
 
-
 void rtl8180_irq_rx_tasklet(struct r8180_priv* priv)
 {
-//	unsigned long flags;
-
-/*	spin_lock_irqsave(&priv->irq_lock, flags);
-	priv->irq_mask &=~IMR_ROK;
-	priv->irq_mask &=~IMR_RDU;
-
-	rtl8180_irq_enable(priv->dev);
-	spin_unlock_irqrestore(&priv->irq_lock, flags);
-*/
 	rtl8180_rx(priv->dev);
-
-/*	spin_lock_irqsave(&priv->irq_lock, flags);
-	priv->irq_mask |= IMR_ROK;
-	priv->irq_mask |= IMR_RDU;
-	rtl8180_irq_enable(priv->dev);
-	spin_unlock_irqrestore(&priv->irq_lock, flags);
-*/
 }
 
-/****************************************************************************
-lizhaoming--------------------------- RF power on/power off -----------------
-*****************************************************************************/
-
 void GPIOChangeRFWorkItemCallBack(struct work_struct *work)
 {
-	//struct delayed_work *dwork = to_delayed_work(work);
 	struct ieee80211_device *ieee = container_of(work, struct ieee80211_device, GPIOChangeRFWorkItem.work);
 	struct net_device *dev = ieee->dev;
 	struct r8180_priv *priv = ieee80211_priv(dev);
-
-	//u16 tmp2byte;
 	u8 btPSR;
 	u8 btConfig0;
 	RT_RF_POWER_STATE	eRfPowerStateToSet;
@@ -5320,7 +4405,6 @@ void GPIOChangeRFWorkItemCallBack(struct
         static char *RadioPowerPath = "/etc/acpi/events/RadioPower.sh";
         static char *envp[] = {"HOME=/", "TERM=linux", "PATH=/usr/bin:/bin", NULL};
 	static int readf_count = 0;
-	//printk("============>%s in \n", __func__);
 
 #ifdef ENABLE_LPS
 	if(readf_count % 10 == 0)
@@ -5375,9 +4459,7 @@ void GPIOChangeRFWorkItemCallBack(struct
 
                                 call_usermodehelper(RadioPowerPath,argv,envp,1);
 			}
-
 		}
-
 }
 
 static u8 read_acadapter_file(char *filename)
@@ -5385,9 +4467,5 @@ static u8 read_acadapter_file(char *file
 	return 0;
 }
 
-/***************************************************************************
-     ------------------- module init / exit stubs ----------------
-****************************************************************************/
 module_init(rtl8180_pci_module_init);
 module_exit(rtl8180_pci_module_exit);
-

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2009-06-28 14:17 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-28 14:18 [PATCH 01/18] Staging: rtl8187se: remove ENABLE_DOT11D ifdefs Bartlomiej Zolnierkiewicz
2009-06-28 14:18 ` [PATCH 02/18] Staging: rtl8187se: remove CONFIG_RTL8180_PM ifdefs Bartlomiej Zolnierkiewicz
2009-06-28 14:18 ` [PATCH 03/18] Staging: rtl8187se: remove THOMAS_TURBO ifdefs Bartlomiej Zolnierkiewicz
2009-06-28 14:19 ` [PATCH 04/18] Staging: rtl8187se: remove CONFIG_RTL818x_S ifdefs Bartlomiej Zolnierkiewicz
2009-06-28 14:19 ` [PATCH 05/18] Staging: rtl8187se: remove CONFIG_RTL8185B ifdefs Bartlomiej Zolnierkiewicz
2009-06-28 14:19 ` [PATCH 06/18] Staging: rtl8187se: remove CONFIG_RTL8180_IO_MAP ifdefs Bartlomiej Zolnierkiewicz
2009-06-28 14:19 ` [PATCH 07/18] Staging: rtl8187se: remove dead code Bartlomiej Zolnierkiewicz
2009-06-28 14:19 ` [PATCH 08/18] Staging: rtl8187se: remove unused radio frontends Bartlomiej Zolnierkiewicz
2009-06-28 14:19 ` [PATCH 09/18] Staging: rtl8187se: remove debugging code from r8180_core.c Bartlomiej Zolnierkiewicz
2009-06-28 14:19 ` [PATCH 10/18] Staging: rtl8187se: remove unused rtl8225_rf_* functions Bartlomiej Zolnierkiewicz
2009-06-28 14:19 ` [PATCH 11/18] Staging: rtl8187se: cleanup r8180_rtl8225.c Bartlomiej Zolnierkiewicz
2009-06-28 14:19 ` [PATCH 12/18] Staging: rtl8187se: merge r8180_rtl8225.c with r8180_rtl8225z2.c Bartlomiej Zolnierkiewicz
2009-06-28 14:20 ` [PATCH 13/18] Staging: rtl8187se: cleanup r8180_pm.c Bartlomiej Zolnierkiewicz
2009-06-28 14:20 ` [PATCH 14/18] Staging: rtl8187se: merge r8180_pm.c with r8180_core.c Bartlomiej Zolnierkiewicz
2009-06-28 14:20 ` [PATCH 15/18] Staging: rtl8187se: remove unused definitions from r8180_hw.h Bartlomiej Zolnierkiewicz
2009-06-28 14:20 ` [PATCH 16/18] Staging: rtl8187se: remove unused definitions from r8180.h Bartlomiej Zolnierkiewicz
2009-06-28 14:20 ` [PATCH 17/18] Staging: rtl8187se: cleanup r8180_rtl8225z2.c Bartlomiej Zolnierkiewicz
2009-06-28 14:20 ` [PATCH 18/18] Staging: rtl8187se: cleanup r8180_core.c Bartlomiej Zolnierkiewicz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox