Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit de171bd6 authored by Tracey Dent's avatar Tracey Dent Committed by Greg Kroah-Hartman
Browse files

Staging: rtl8187se: r8180_wx: fixed a lot of checkptahc.pl issues



Fixed numerous coding style issues using checkpatch.pl

Signed-off-by: default avatarTracey Dent <tdent48227@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 7042b09a
Loading
Loading
Loading
Loading
+354 −368
Original line number Original line Diff line number Diff line
@@ -23,24 +23,24 @@


#include "ieee80211/dot11d.h"
#include "ieee80211/dot11d.h"


//#define RATE_COUNT 4
/* #define RATE_COUNT 4 */
u32 rtl8180_rates[] = {1000000, 2000000, 5500000, 11000000,
u32 rtl8180_rates[] = {1000000, 2000000, 5500000, 11000000,
	6000000, 9000000, 12000000, 18000000, 24000000, 36000000, 48000000, 54000000};
	6000000, 9000000, 12000000, 18000000, 24000000, 36000000, 48000000, 54000000};


#define RATE_COUNT ARRAY_SIZE(rtl8180_rates)
#define RATE_COUNT ARRAY_SIZE(rtl8180_rates)


static CHANNEL_LIST DefaultChannelPlan[] = {
static CHANNEL_LIST DefaultChannelPlan[] = {
//	{{1,2,3,4,5,6,7,8,9,10,11,12,13,14},14},			//Default channel plan
/*	{{1,2,3,4,5,6,7,8,9,10,11,12,13,14},14},	*/	/*Default channel plan	*/
	{{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, 36, 40, 44, 48, 52, 56, 60, 64}, 19},			/*FCC							*/
	{{1,2,3,4,5,6,7,8,9,10,11},11},                    				//IC
	{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}, 11},											/*IC							*/
	{{1,2,3,4,5,6,7,8,9,10,11,12,13,36,40,44,48,52,56,60,64},21},  	//ETSI
	{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 36, 40, 44, 48, 52, 56, 60, 64}, 21},	/*ETSI							*/
	{{1,2,3,4,5,6,7,8,9,10,11,12,13,36,40,44,48,52,56,60,64},21},    //Spain. Change to ETSI.
	{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 36, 40, 44, 48, 52, 56, 60, 64}, 21},	/*Spain. Change to ETSI.		*/
	{{1,2,3,4,5,6,7,8,9,10,11,12,13,36,40,44,48,52,56,60,64},21},  	//France. Change to ETSI.
	{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 36, 40, 44, 48, 52, 56, 60, 64}, 21},	/*France. Change to ETSI.		*/
	{{14,36,40,44,48,52,56,60,64},9},						//MKK
	{{14, 36, 40, 44, 48, 52, 56, 60, 64}, 9},											/*MKK							*/
	{{1,2,3,4,5,6,7,8,9,10,11,12,13,14, 36,40,44,48,52,56,60,64},22},//MKK1
	{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 36, 40, 44, 48, 52, 56, 60, 64}, 22},/*MKK1						*/
	{{1,2,3,4,5,6,7,8,9,10,11,12,13,36,40,44,48,52,56,60,64},21},	//Israel.
	{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 36, 40, 44, 48, 52, 56, 60, 64}, 21},	/*Israel.						*/
	{{1,2,3,4,5,6,7,8,9,10,11,12,13,34,38,42,46},17},			// For 11a , TELEC
	{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 34, 38, 42, 46}, 17},					/*For 11a , TELEC				*/
	{{1,2,3,4,5,6,7,8,9,10,11,12,13,14},14}					//For Global Domain. 1-11:active scan, 12-14 passive scan. //+YJ, 080626
	{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}, 14}								/*For Global Domain. 1-11:active scan, 12-14 passive scan.*/	/* +YJ, 080626 */
};
};
static int r8180_wx_get_freq(struct net_device *dev,
static int r8180_wx_get_freq(struct net_device *dev,
			     struct iw_request_info *a,
			     struct iw_request_info *a,
@@ -61,9 +61,7 @@ int r8180_wx_set_key(struct net_device *dev, struct iw_request_info *info,
	if (priv->ieee80211->bHwRadioOff)
	if (priv->ieee80211->bHwRadioOff)
		return 0;
		return 0;


	if (erq->flags & IW_ENCODE_DISABLED) {
	if (erq->flags & IW_ENCODE_DISABLED)
	}



/*	i = erq->flags & IW_ENCODE_INDEX;
/*	i = erq->flags & IW_ENCODE_INDEX;
	if (i < 1 || i > 4)
	if (i < 1 || i > 4)
@@ -71,7 +69,7 @@ int r8180_wx_set_key(struct net_device *dev, struct iw_request_info *info,


	if (erq->length > 0) {
	if (erq->length > 0) {


		//int len = erq->length <= 5 ? 5 : 13;
		/*int len = erq->length <= 5 ? 5 : 13;	*/


		u32* tkey = (u32*) key;
		u32* tkey = (u32*) key;
		priv->key0[0] = tkey[0];
		priv->key0[0] = tkey[0];
@@ -194,22 +192,21 @@ static int r8180_wx_set_mode(struct net_device *dev, struct iw_request_info *a,
		return 0;
		return 0;


	down(&priv->wx_sem);
	down(&priv->wx_sem);
//	printk("set mode ENABLE_IPS\n");
/*	printk("set mode ENABLE_IPS\n");	*/
	if (priv->bInactivePs)	{
	if (priv->bInactivePs)	{
		if (wrqu->mode == IW_MODE_ADHOC)
		if (wrqu->mode == IW_MODE_ADHOC)
			IPSLeave(dev);
			IPSLeave(dev);
	}
	}
	ret = ieee80211_wx_set_mode(priv->ieee80211, a, wrqu, b);
	ret = ieee80211_wx_set_mode(priv->ieee80211, a, wrqu, b);


	//rtl8180_commit(dev);
/*	rtl8180_commit(dev);	*/


	up(&priv->wx_sem);
	up(&priv->wx_sem);
	return ret;
	return ret;
}
}


//YJ,add,080819,for hidden ap
/* YJ,add,080819,for hidden ap */
struct  iw_range_with_scan_capa
struct  iw_range_with_scan_capa	{
{
		/* Informative stuff (to choose between different interface)	*/
		/* Informative stuff (to choose between different interface)	*/
		__u32		throughput;		/* To give an idea...				*/
		__u32		throughput;		/* To give an idea...				*/
		/* In theory this value should be the maximum benchmarked
		/* In theory this value should be the maximum benchmarked
@@ -230,7 +227,7 @@ struct iw_range_with_scan_capa
		/* Scan capabilities */
		/* Scan capabilities */
		__u8			scan_capa;
		__u8			scan_capa;
};
};
//YJ,add,080819,for hidden ap
/* YJ,add,080819,for hidden ap */




static int rtl8180_wx_get_range(struct net_device *dev,
static int rtl8180_wx_get_range(struct net_device *dev,
@@ -241,7 +238,7 @@ static int rtl8180_wx_get_range(struct net_device *dev,
	struct r8180_priv *priv = ieee80211_priv(dev);
	struct r8180_priv *priv = ieee80211_priv(dev);
	u16 val;
	u16 val;
	int i;
	int i;
	//struct iw_range_with_scan_capa* tmp = (struct iw_range_with_scan_capa*)range; //YJ,add,080819,for hidden ap
	/*struct iw_range_with_scan_capa* tmp = (struct iw_range_with_scan_capa*)range; */ /*YJ,add,080819,for hidden ap */


	wrqu->data.length = sizeof(*range);
	wrqu->data.length = sizeof(*range);
	memset(range, 0, sizeof(*range));
	memset(range, 0, sizeof(*range));
@@ -257,15 +254,15 @@ static int rtl8180_wx_get_range(struct net_device *dev,
	/* ~5 Mb/s real (802.11b) */
	/* ~5 Mb/s real (802.11b) */
	range->throughput = 5 * 1000 * 1000;
	range->throughput = 5 * 1000 * 1000;


	// TODO: Not used in 802.11b?
	/* TODO: Not used in 802.11b?	*/
//	range->min_nwid;	/* Minimal NWID we are able to set */
/*	range->min_nwid; */	/* Minimal NWID we are able to set */
	// TODO: Not used in 802.11b?
	/* TODO: Not used in 802.11b?	*/
//	range->max_nwid;	/* Maximal NWID we are able to set */
/*	range->max_nwid; */	/* Maximal NWID we are able to set */


		/* Old Frequency (backward compat - moved lower ) */
		/* Old Frequency (backward compat - moved lower ) */
//	range->old_num_channels;
/*	range->old_num_channels; */
//	range->old_num_frequency;
/*	range->old_num_frequency; */
//	range->old_freq[6]; /* Filler to keep "version" at the same offset */
/*	range->old_freq[6]; */ /* Filler to keep "version" at the same offset */
	if (priv->rf_set_sens != NULL)
	if (priv->rf_set_sens != NULL)
		range->sensitivity = priv->max_sens;	/* signal level threshold range */
		range->sensitivity = priv->max_sens;	/* signal level threshold range */


@@ -283,9 +280,8 @@ static int rtl8180_wx_get_range(struct net_device *dev,


	range->num_bitrates = RATE_COUNT;
	range->num_bitrates = RATE_COUNT;


	for (i = 0; i < RATE_COUNT && i < IW_MAX_BITRATES; i++) {
	for (i = 0; i < RATE_COUNT && i < IW_MAX_BITRATES; i++)
		range->bitrate[i] = rtl8180_rates[i];
		range->bitrate[i] = rtl8180_rates[i];
	}


	range->min_frag = MIN_FRAG_THRESHOLD;
	range->min_frag = MIN_FRAG_THRESHOLD;
	range->max_frag = MAX_FRAG_THRESHOLD;
	range->max_frag = MAX_FRAG_THRESHOLD;
@@ -295,27 +291,27 @@ static int rtl8180_wx_get_range(struct net_device *dev,
	range->we_version_compiled = WIRELESS_EXT;
	range->we_version_compiled = WIRELESS_EXT;
	range->we_version_source = 16;
	range->we_version_source = 16;


//	range->retry_capa;	/* What retry options are supported */
/*	range->retry_capa;	*/	/* What retry options are supported */
//	range->retry_flags;	/* How to decode max/min retry limit */
/*	range->retry_flags;	*/	/* How to decode max/min retry limit */
//	range->r_time_flags;	/* How to decode max/min retry life */
/*	range->r_time_flags;*/	/* How to decode max/min retry life */
//	range->min_retry;	/* Minimal number of retries */
/*	range->min_retry;	*/	/* Minimal number of retries */
//	range->max_retry;	/* Maximal number of retries */
/*	range->max_retry;	*/	/* Maximal number of retries */
//	range->min_r_time;	/* Minimal retry lifetime */
/*	range->min_r_time;	*/	/* Minimal retry lifetime */
//	range->max_r_time;	/* Maximal retry lifetime */
/*	range->max_r_time;	*/	/* Maximal retry lifetime */


		range->num_channels = 14;
		range->num_channels = 14;


	for (i = 0, val = 0; i < 14; i++) {
	for (i = 0, val = 0; i < 14; i++) {


		// Include only legal frequencies for some countries
		/* Include only legal frequencies for some countries */
		if ((GET_DOT11D_INFO(priv->ieee80211)->channel_map)[i+1]) {
		if ((GET_DOT11D_INFO(priv->ieee80211)->channel_map)[i+1]) {
				range->freq[val].i = i + 1;
				range->freq[val].i = i + 1;
			range->freq[val].m = ieee80211_wlan_frequencies[i] * 100000;
			range->freq[val].m = ieee80211_wlan_frequencies[i] * 100000;
			range->freq[val].e = 1;
			range->freq[val].e = 1;
			val++;
			val++;
		} else {
		} else {
			// FIXME: do we need to set anything for channels
			/* FIXME: do we need to set anything for channels	*/
			// we don't use ?
			/* we don't use ?	*/
		}
		}


		if (val == IW_MAX_FREQUENCIES)
		if (val == IW_MAX_FREQUENCIES)
@@ -326,7 +322,7 @@ static int rtl8180_wx_get_range(struct net_device *dev,
	range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 |
	range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 |
						IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP;
						IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP;


	//tmp->scan_capa = 0x01; //YJ,add,080819,for hidden ap
	/*tmp->scan_capa = 0x01;	*/	/*YJ,add,080819,for hidden ap	*/


	return 0;
	return 0;
}
}
@@ -343,60 +339,53 @@ static int r8180_wx_set_scan(struct net_device *dev, struct iw_request_info *a,
	if (priv->ieee80211->bHwRadioOff)
	if (priv->ieee80211->bHwRadioOff)
		return 0;
		return 0;


//YJ,add,080819, for hidden ap
/*YJ,add,080819, for hidden ap	*/
	//printk("==*&*&*&==>%s in\n", __func__);
	/*printk("==*&*&*&==>%s in\n", __func__);	*/
	//printk("=*&*&*&*===>flag:%x, %x\n", wrqu->data.flags, IW_SCAN_THIS_ESSID);
	/*printk("=*&*&*&*===>flag:%x, %x\n", wrqu->data.flags, IW_SCAN_THIS_ESSID);	*/
	if (wrqu->data.flags & IW_SCAN_THIS_ESSID)
	if (wrqu->data.flags & IW_SCAN_THIS_ESSID)	{
	{
		struct iw_scan_req* req = (struct iw_scan_req*)b;
		struct iw_scan_req* req = (struct iw_scan_req*)b;
		if (req->essid_len)
		if (req->essid_len)		{
		{
			/*printk("==**&*&*&**===>scan set ssid:%s\n", req->essid); */
			//printk("==**&*&*&**===>scan set ssid:%s\n", req->essid);
			ieee->current_network.ssid_len = req->essid_len;
			ieee->current_network.ssid_len = req->essid_len;
			memcpy(ieee->current_network.ssid, req->essid, req->essid_len);
			memcpy(ieee->current_network.ssid, req->essid, req->essid_len);
			//printk("=====>network ssid:%s\n", ieee->current_network.ssid);
			/*printk("=====>network ssid:%s\n", ieee->current_network.ssid); */
		}
		}
	}
	}
//YJ,add,080819, for hidden ap, end
/*YJ,add,080819, for hidden ap, end */


	down(&priv->wx_sem);
	down(&priv->wx_sem);
	if (priv->up)	{
	if (priv->up)	{
//		printk("set scan ENABLE_IPS\n");
/*		printk("set scan ENABLE_IPS\n");	*/
		priv->ieee80211->actscanning = true;
		priv->ieee80211->actscanning = true;
		if (priv->bInactivePs && (priv->ieee80211->state != IEEE80211_LINKED))	{
		if (priv->bInactivePs && (priv->ieee80211->state != IEEE80211_LINKED))	{
			IPSLeave(dev);
			IPSLeave(dev);
//			down(&priv->ieee80211->wx_sem);
			/*down(&priv->ieee80211->wx_sem);	*/

/*
//			if (priv->ieee80211->iw_mode == IW_MODE_MONITOR || !(priv->ieee80211->proto_started)){
			if (priv->ieee80211->iw_mode == IW_MODE_MONITOR || !(priv->ieee80211->proto_started)){
//				ret = -1;
				ret = -1;
//				up(&priv->ieee80211->wx_sem);
				up(&priv->ieee80211->wx_sem);
//				up(&priv->wx_sem);
				up(&priv->wx_sem);
//				return ret;
				return ret;
//			}
			}

*/
	//	queue_work(priv->ieee80211->wq, &priv->ieee80211->wx_sync_scan_wq);
	/*	queue_work(priv->ieee80211->wq, &priv->ieee80211->wx_sync_scan_wq); */
		//printk("start scan============================>\n");
		/* printk("start scan============================>\n"); */
		ieee80211_softmac_ips_scan_syncro(priv->ieee80211);
		ieee80211_softmac_ips_scan_syncro(priv->ieee80211);
//ieee80211_rtl_start_scan(priv->ieee80211);
/* ieee80211_rtl_start_scan(priv->ieee80211); */
		/* intentionally forget to up sem */
		/* intentionally forget to up sem */
//			up(&priv->ieee80211->wx_sem);
/*			up(&priv->ieee80211->wx_sem); */
			ret = 0;
			ret = 0;
		}
		}	else	{
		else
			/* YJ,add,080828, prevent scan in BusyTraffic */
		{
			/* FIXME: Need to consider last scan time */
			//YJ,add,080828, prevent scan in BusyTraffic
			if ((priv->link_detect.bBusyTraffic) && (true))	{
			//FIXME: Need to consider last scan time
			if ((priv->link_detect.bBusyTraffic) && (true))
			{
				ret = 0;
				ret = 0;
				printk("Now traffic is busy, please try later!\n");
				printk("Now traffic is busy, please try later!\n");
			}
			}	else
			else
				/* YJ,add,080828, prevent scan in BusyTraffic,end */
			//YJ,add,080828, prevent scan in BusyTraffic,end
				ret = ieee80211_wx_set_scan(priv->ieee80211, a, wrqu, b);
				ret = ieee80211_wx_set_scan(priv->ieee80211, a, wrqu, b);
		}
		}
	}
	}	else
	else
			ret = -1;
			ret = -1;


	up(&priv->wx_sem);
	up(&priv->wx_sem);
@@ -435,10 +424,10 @@ static int r8180_wx_set_essid(struct net_device *dev,
		return 0;
		return 0;


	down(&priv->wx_sem);
	down(&priv->wx_sem);
	//printk("set essid ENABLE_IPS\n");
	/* printk("set essid ENABLE_IPS\n"); */
	if (priv->bInactivePs)
	if (priv->bInactivePs)
		IPSLeave(dev);
		IPSLeave(dev);
//	printk("haha:set essid %s essid_len = %d essid_flgs = %d\n",b,  wrqu->essid.length, wrqu->essid.flags);
/*	printk("haha:set essid %s essid_len = %d essid_flgs = %d\n",b,  wrqu->essid.length, wrqu->essid.flags);	*/


	ret = ieee80211_wx_set_essid(priv->ieee80211, a, wrqu, b);
	ret = ieee80211_wx_set_essid(priv->ieee80211, a, wrqu, b);


@@ -627,7 +616,7 @@ static int r8180_wx_set_monitor_type(struct net_device *dev, struct iw_request_i


}
}
*/
*/
//of         r8180_wx_set_monitor_type
/*of         r8180_wx_set_monitor_type */
/* end added christian */
/* end added christian */


static int r8180_wx_set_retry(struct net_device *dev,
static int r8180_wx_set_retry(struct net_device *dev,
@@ -706,7 +695,7 @@ static int r8180_wx_get_retry(struct net_device *dev,
		wrqu->retry.flags = IW_RETRY_LIMIT & IW_RETRY_MIN;
		wrqu->retry.flags = IW_RETRY_LIMIT & IW_RETRY_MIN;
		wrqu->retry.value = priv->retry_data;
		wrqu->retry.value = priv->retry_data;
	}
	}
	//DMESG("returning %d",wrqu->retry.value);
	/* DMESG("returning %d",wrqu->retry.value); */




	return 0;
	return 0;
@@ -737,7 +726,7 @@ static int r8180_wx_set_sens(struct net_device *dev,
		return 0;
		return 0;


	down(&priv->wx_sem);
	down(&priv->wx_sem);
	//DMESG("attempt to set sensivity to %ddb",wrqu->sens.value);
	/* DMESG("attempt to set sensivity to %ddb",wrqu->sens.value); */
	if (priv->rf_set_sens == NULL) {
	if (priv->rf_set_sens == NULL) {
		err = -1; /* we have not this support for this radio */
		err = -1; /* we have not this support for this radio */
		goto exit;
		goto exit;
@@ -975,7 +964,7 @@ static int r8180_wx_set_iwmode(struct net_device *dev,
	} else {
	} else {
		ieee->mode = mode;
		ieee->mode = mode;
		ieee->modulation = modulation;
		ieee->modulation = modulation;
//		ieee80211_start_protocol(ieee);
/*		ieee80211_start_protocol(ieee); */
	}
	}


	up(&priv->wx_sem);
	up(&priv->wx_sem);
@@ -994,7 +983,7 @@ static int r8180_wx_get_preamble(struct net_device *dev,






	*extra = (char) priv->plcp_preamble_mode; 	// 0:auto 1:short 2:long
	*extra = (char) priv->plcp_preamble_mode;	/* 0:auto 1:short 2:long */
	up(&priv->wx_sem);
	up(&priv->wx_sem);


	return 0;
	return 0;
@@ -1027,14 +1016,14 @@ static int r8180_wx_get_siglevel(struct net_device *dev,
			       union iwreq_data *wrqu, char *extra)
			       union iwreq_data *wrqu, char *extra)
{
{
	struct r8180_priv *priv = ieee80211_priv(dev);
	struct r8180_priv *priv = ieee80211_priv(dev);
	//struct ieee80211_network *network = &(priv->ieee80211->current_network);
	/* struct ieee80211_network *network = &(priv->ieee80211->current_network); */
	int ret = 0;
	int ret = 0;






	down(&priv->wx_sem);
	down(&priv->wx_sem);
	// Modify by hikaru 6.5
	/* Modify by hikaru 6.5 */
	*((int *)extra) = priv->wstats.qual.level;//for interface test ,it should be the priv->wstats.qual.level;
	*((int *)extra) = priv->wstats.qual.level;/*for interface test ,it should be the priv->wstats.qual.level; */






@@ -1047,14 +1036,14 @@ static int r8180_wx_get_sigqual(struct net_device *dev,
			       union iwreq_data *wrqu, char *extra)
			       union iwreq_data *wrqu, char *extra)
{
{
	struct r8180_priv *priv = ieee80211_priv(dev);
	struct r8180_priv *priv = ieee80211_priv(dev);
	//struct ieee80211_network *network = &(priv->ieee80211->current_network);
	/* struct ieee80211_network *network = &(priv->ieee80211->current_network); */
	int ret = 0;
	int ret = 0;






	down(&priv->wx_sem);
	down(&priv->wx_sem);
	// Modify by hikaru 6.5
	/* Modify by hikaru 6.5	*/
	*((int *)extra) = priv->wstats.qual.qual;//for interface test ,it should be the priv->wstats.qual.qual;
	*((int *)extra) = priv->wstats.qual.qual;/* for interface test ,it should be the priv->wstats.qual.qual; */






@@ -1091,7 +1080,7 @@ static int r8180_wx_reset_stats(struct net_device *dev,
	priv->stats.txbeaconerr = 0;
	priv->stats.txbeaconerr = 0;
	priv->stats.txlpokint = 0;
	priv->stats.txlpokint = 0;
	priv->stats.txlperr = 0;
	priv->stats.txlperr = 0;
	priv->stats.txretry =0;//20060601
	priv->stats.txretry = 0;/* 20060601 */
	priv->stats.rxcrcerrmin = 0 ;
	priv->stats.rxcrcerrmin = 0 ;
	priv->stats.rxcrcerrmid = 0;
	priv->stats.rxcrcerrmid = 0;
	priv->stats.rxcrcerrmax = 0;
	priv->stats.rxcrcerrmax = 0;
@@ -1161,7 +1150,7 @@ static int r8180_wx_set_channelplan(struct net_device *dev,
			     union iwreq_data *wrqu, char *extra)
			     union iwreq_data *wrqu, char *extra)
{
{
	struct r8180_priv *priv = ieee80211_priv(dev);
	struct r8180_priv *priv = ieee80211_priv(dev);
	//struct ieee80211_device *ieee = netdev_priv(dev);
	/* struct ieee80211_device *ieee = netdev_priv(dev); */
	int *val = (int *)extra;
	int *val = (int *)extra;
	int i;
	int i;
	printk("-----in fun %s\n", __func__);
	printk("-----in fun %s\n", __func__);
@@ -1169,20 +1158,18 @@ static int r8180_wx_set_channelplan(struct net_device *dev,
	if (priv->ieee80211->bHwRadioOff)
	if (priv->ieee80211->bHwRadioOff)
		return 0;
		return 0;


	//unsigned long flags;
	/* unsigned long flags; */
	down(&priv->wx_sem);
	down(&priv->wx_sem);
	if (DefaultChannelPlan[*val].Len != 0)	{
	if (DefaultChannelPlan[*val].Len != 0)	{
		priv->channel_plan = *val;
		priv->channel_plan = *val;
		// Clear old channel map
		/* Clear old channel map 8 */
		for (i = 1; i <= MAX_CHANNEL_NUMBER; i++)
		for (i = 1; i <= MAX_CHANNEL_NUMBER; i++)
		{
			GET_DOT11D_INFO(priv->ieee80211)->channel_map[i] = 0;
			GET_DOT11D_INFO(priv->ieee80211)->channel_map[i] = 0;
		}

		// Set new channel map
		/* Set new channel map */
		for (i = 1; i <= DefaultChannelPlan[*val].Len; i++)
		for (i = 1; i <= DefaultChannelPlan[*val].Len; i++)
		{
			GET_DOT11D_INFO(priv->ieee80211)->channel_map[DefaultChannelPlan[*val].Channel[i-1]] = 1;
			GET_DOT11D_INFO(priv->ieee80211)->channel_map[DefaultChannelPlan[*val].Channel[i-1]] = 1;
		}
		
	}
	}
	up(&priv->wx_sem);
	up(&priv->wx_sem);


@@ -1194,7 +1181,7 @@ static int r8180_wx_get_version(struct net_device *dev,
			       union iwreq_data *wrqu, char *extra)
			       union iwreq_data *wrqu, char *extra)
{
{
	struct r8180_priv *priv = ieee80211_priv(dev);
	struct r8180_priv *priv = ieee80211_priv(dev);
	//struct ieee80211_device *ieee;
	/* struct ieee80211_device *ieee; */


	down(&priv->wx_sem);
	down(&priv->wx_sem);
	strcpy(extra, "1020.0808");
	strcpy(extra, "1020.0808");
@@ -1203,8 +1190,8 @@ static int r8180_wx_get_version(struct net_device *dev,
	return 0;
	return 0;
}
}


//added by amy 080818
/* added by amy 080818 */
//receive datarate from user typing valid rate is from 2 to 108 (1 - 54M), if input 0, return to normal rate adaptive.
/*receive datarate from user typing valid rate is from 2 to 108 (1 - 54M), if input 0, return to normal rate adaptive. */
static int r8180_wx_set_forcerate(struct net_device *dev,
static int r8180_wx_set_forcerate(struct net_device *dev,
			     struct iw_request_info *info,
			     struct iw_request_info *info,
			     union iwreq_data *wrqu, char *extra)
			     union iwreq_data *wrqu, char *extra)
@@ -1221,13 +1208,10 @@ static int r8180_wx_set_forcerate(struct net_device *dev,
	{
	{
		priv->ForcedDataRate = 1;
		priv->ForcedDataRate = 1;
		priv->ieee80211->rate = forcerate * 5;
		priv->ieee80211->rate = forcerate * 5;
	}
	}	else if (forcerate == 0)	{
	else if(forcerate == 0)
	{
		priv->ForcedDataRate = 0;
		priv->ForcedDataRate = 0;
		printk("OK! return rate adaptive\n");
		printk("OK! return rate adaptive\n");
	}
	}	else
	else
			printk("ERR: wrong rate\n");
			printk("ERR: wrong rate\n");
	up(&priv->wx_sem);
	up(&priv->wx_sem);
	return 0;
	return 0;
@@ -1239,7 +1223,7 @@ static int r8180_wx_set_enc_ext(struct net_device *dev,
{
{


	struct r8180_priv *priv = ieee80211_priv(dev);
	struct r8180_priv *priv = ieee80211_priv(dev);
	//printk("===>%s()\n", __func__);
	/* printk("===>%s()\n", __func__); */


	int ret = 0;
	int ret = 0;


@@ -1256,7 +1240,7 @@ static int r8180_wx_set_auth(struct net_device *dev,
			     struct iw_request_info *info,
			     struct iw_request_info *info,
			     union iwreq_data *wrqu, char *extra)
			     union iwreq_data *wrqu, char *extra)
{
{
	//printk("====>%s()\n", __func__);
	/* printk("====>%s()\n", __func__); */
	struct r8180_priv *priv = ieee80211_priv(dev);
	struct r8180_priv *priv = ieee80211_priv(dev);
	int ret = 0;
	int ret = 0;


@@ -1273,7 +1257,7 @@ static int r8180_wx_set_mlme(struct net_device *dev,
										struct iw_request_info *info,
										struct iw_request_info *info,
										union iwreq_data *wrqu, char *extra)
										union iwreq_data *wrqu, char *extra)
{
{
	//printk("====>%s()\n", __func__);
	/* printk("====>%s()\n", __func__); */


	int ret = 0;
	int ret = 0;
	struct r8180_priv *priv = ieee80211_priv(dev);
	struct r8180_priv *priv = ieee80211_priv(dev);
@@ -1294,7 +1278,7 @@ static int r8180_wx_set_gen_ie(struct net_device *dev,
			       struct iw_request_info *info,
			       struct iw_request_info *info,
			       union iwreq_data *wrqu, char *extra)
			       union iwreq_data *wrqu, char *extra)
{
{
//	printk("====>%s(), len:%d\n", __func__, data->length);
/*	printk("====>%s(), len:%d\n", __func__, data->length); */
	int ret = 0;
	int ret = 0;
		struct r8180_priv *priv = ieee80211_priv(dev);
		struct r8180_priv *priv = ieee80211_priv(dev);


@@ -1307,13 +1291,12 @@ static int r8180_wx_set_gen_ie(struct net_device *dev,
		ret = ieee80211_wx_set_gen_ie(priv->ieee80211, extra, wrqu->data.length);
		ret = ieee80211_wx_set_gen_ie(priv->ieee80211, extra, wrqu->data.length);
#endif
#endif
		up(&priv->wx_sem);
		up(&priv->wx_sem);
	//printk("<======%s(), ret:%d\n", __func__, ret);
	/* printk("<======%s(), ret:%d\n", __func__, ret); */
		return ret;
		return ret;




}
}
static iw_handler r8180_wx_handlers[] =
static iw_handler r8180_wx_handlers[] =	{
{
		NULL,						/* SIOCSIWCOMMIT */
		NULL,						/* SIOCSIWCOMMIT */
		r8180_wx_get_name,			/* SIOCGIWNAME */
		r8180_wx_get_name,			/* SIOCGIWNAME */
		dummy,						/* SIOCSIWNWID */
		dummy,						/* SIOCSIWNWID */
@@ -1391,10 +1374,12 @@ static const struct iw_priv_args r8180_private_args[] = {


	},
	},
	/* added by christian */
	/* added by christian */
	//{
	/*
	//	SIOCIWFIRSTPRIV + 0x2,
	{
	//	IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "prismhdr"
		SIOCIWFIRSTPRIV + 0x2,
	//},
		IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "prismhdr"
	},
	*/
	/* end added by christian */
	/* end added by christian */
	{
	{
		SIOCIWFIRSTPRIV + 0x4,
		SIOCIWFIRSTPRIV + 0x4,
@@ -1414,15 +1399,17 @@ static const struct iw_priv_args r8180_private_args[] = {
		0, 0, "dummy"
		0, 0, "dummy"


	},
	},
//	{
/*
//		SIOCIWFIRSTPRIV + 0x5,
	{
//		0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "getpsmode"
		SIOCIWFIRSTPRIV + 0x5,
//	},
		0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "getpsmode"
//	{
	},
//		SIOCIWFIRSTPRIV + 0x6,
	{
//		IW_PRIV_SIZE_FIXED, 0, "setpsmode"
		SIOCIWFIRSTPRIV + 0x6,
//	},
		IW_PRIV_SIZE_FIXED, 0, "setpsmode"
//set/get mode have been realized in public handlers
	},
*/
/* set/get mode have been realized in public handlers */


	{
	{
		SIOCIWFIRSTPRIV + 0x8,
		SIOCIWFIRSTPRIV + 0x8,
@@ -1498,7 +1485,7 @@ static iw_handler r8180_private_handler[] = {
	dummy,
	dummy,
	r8180_wx_set_beaconinterval,
	r8180_wx_set_beaconinterval,
	dummy,
	dummy,
	//r8180_wx_set_monitor_type,
	/* r8180_wx_set_monitor_type, */
	r8180_wx_set_scan_type,
	r8180_wx_set_scan_type,
	dummy,
	dummy,
	r8180_wx_set_rawtx,
	r8180_wx_set_rawtx,
@@ -1512,7 +1499,7 @@ static iw_handler r8180_private_handler[] = {
	dummy,
	dummy,
	r8180_wx_get_sigqual,
	r8180_wx_get_sigqual,
	r8180_wx_reset_stats,
	r8180_wx_reset_stats,
	dummy,//r8180_wx_get_stats
	dummy,/* r8180_wx_get_stats */
	r8180_wx_radio_on,
	r8180_wx_radio_on,
	r8180_wx_radio_off,
	r8180_wx_radio_off,
	r8180_wx_set_channelplan,
	r8180_wx_set_channelplan,
@@ -1530,32 +1517,31 @@ static inline int is_same_network(struct ieee80211_network *src,
		* and the capability field (in particular IBSS and BSS) all match.
		* and the capability field (in particular IBSS and BSS) all match.
		* We treat all <hidden> with the same BSSID and channel
		* We treat all <hidden> with the same BSSID and channel
		* as one network		*/
		* as one network		*/
        return (((src->ssid_len == dst->ssid_len)||(ieee->iw_mode == IW_MODE_INFRA)) &&  //YJ,mod, 080819,for hidden ap
		return (((src->ssid_len == dst->ssid_len) || (ieee->iw_mode == IW_MODE_INFRA)) &&	/* YJ,mod, 080819,for hidden ap	*/
			//((src->ssid_len == dst->ssid_len) &&
			/* ((src->ssid_len == dst->ssid_len) && */
			(src->channel == dst->channel) &&
			(src->channel == dst->channel) &&
			!memcmp(src->bssid, dst->bssid, ETH_ALEN) &&
			!memcmp(src->bssid, dst->bssid, ETH_ALEN) &&
			(!memcmp(src->ssid, dst->ssid, src->ssid_len)||(ieee->iw_mode == IW_MODE_INFRA)) &&  //YJ,mod, 080819,for hidden ap
			(!memcmp(src->ssid, dst->ssid, src->ssid_len) || (ieee->iw_mode == IW_MODE_INFRA)) &&  /* YJ,mod, 080819,for hidden ap */
			//!memcmp(src->ssid, dst->ssid, src->ssid_len) &&
			/*!memcmp(src->ssid, dst->ssid, src->ssid_len) && */
			((src->capability & WLAN_CAPABILITY_IBSS) ==
			((src->capability & WLAN_CAPABILITY_IBSS) ==
			(dst->capability & WLAN_CAPABILITY_IBSS)) &&
			(dst->capability & WLAN_CAPABILITY_IBSS)) &&
			((src->capability & WLAN_CAPABILITY_BSS) ==
			((src->capability & WLAN_CAPABILITY_BSS) ==
			(dst->capability & WLAN_CAPABILITY_BSS)));
			(dst->capability & WLAN_CAPABILITY_BSS)));
}
}


//WB modefied to show signal to GUI on 18-01-2008
/* WB modefied to show signal to GUI on 18-01-2008 */
static struct iw_statistics *r8180_get_wireless_stats(struct net_device *dev)
static struct iw_statistics *r8180_get_wireless_stats(struct net_device *dev)
{
{
	struct r8180_priv *priv = ieee80211_priv(dev);
	struct r8180_priv *priv = ieee80211_priv(dev);
	struct ieee80211_device* ieee = priv->ieee80211;
	struct ieee80211_device* ieee = priv->ieee80211;
	struct iw_statistics* wstats = &priv->wstats;
	struct iw_statistics* wstats = &priv->wstats;
	//struct ieee80211_network* target = NULL;
	/* struct ieee80211_network* target = NULL; */
	int tmp_level = 0;
	int tmp_level = 0;
	int tmp_qual = 0;
	int tmp_qual = 0;
	int tmp_noise = 0;
	int tmp_noise = 0;
	//unsigned long flag;
	/* unsigned long flag; */


	if (ieee->state < IEEE80211_LINKED)
	if (ieee->state < IEEE80211_LINKED)	{
	{
		wstats->qual.qual = 0;
		wstats->qual.qual = 0;
		wstats->qual.level = 0;
		wstats->qual.level = 0;
		wstats->qual.noise = 0;
		wstats->qual.noise = 0;
@@ -1566,9 +1552,9 @@ static struct iw_statistics *r8180_get_wireless_stats(struct net_device *dev)
	tmp_level = (&ieee->current_network)->stats.signal;
	tmp_level = (&ieee->current_network)->stats.signal;
	tmp_qual = (&ieee->current_network)->stats.signalstrength;
	tmp_qual = (&ieee->current_network)->stats.signalstrength;
	tmp_noise = (&ieee->current_network)->stats.noise;
	tmp_noise = (&ieee->current_network)->stats.noise;
	//printk("level:%d, qual:%d, noise:%d\n", tmp_level, tmp_qual, tmp_noise);
	/* printk("level:%d, qual:%d, noise:%d\n", tmp_level, tmp_qual, tmp_noise); */


//	printk("level:%d\n", tmp_level);
/*	printk("level:%d\n", tmp_level);	*/
	wstats->qual.level = tmp_level;
	wstats->qual.level = tmp_level;
	wstats->qual.qual = tmp_qual;
	wstats->qual.qual = tmp_qual;
	wstats->qual.noise = tmp_noise;
	wstats->qual.noise = tmp_noise;