[OPW,kernel,06/11] staging: rtl8187se: Fix indent errors in ieee80211/ieee80211_softmac.c
diff mbox

Message ID 746a98f92e9589b61746f0f18e5d440d2466ba4e.1394195021.git.anarey@gmail.com
State New, archived
Headers show

Commit Message

Ana Rey March 7, 2014, 12:33 p.m. UTC
This patch fixes indent as the codingStyle of the kernel recommends in
ieee80211/ieee80211_softmac.c

Thus, this patch fixes these errors found by checkpatch.pl:

suspect code indent for conditional statements.
switch and case should be at the same indent.
WARNING: labels should not be indented.

Signed-off-by: Ana Rey <anarey@gmail.com>
---
 .../rtl8187se/ieee80211/ieee80211_softmac.c        | 300 ++++++++++-----------
 1 file changed, 148 insertions(+), 152 deletions(-)

Comments

Sarah Sharp March 7, 2014, 11:58 p.m. UTC | #1
On Fri, Mar 07, 2014 at 01:33:06PM +0100, Ana Rey wrote:
> This patch fixes indent as the codingStyle of the kernel recommends in
> ieee80211/ieee80211_softmac.c
> 
> Thus, this patch fixes these errors found by checkpatch.pl:
> 
> suspect code indent for conditional statements.
> switch and case should be at the same indent.
> WARNING: labels should not be indented.
> 
> Signed-off-by: Ana Rey <anarey@gmail.com>
> ---
>  .../rtl8187se/ieee80211/ieee80211_softmac.c        | 300 ++++++++++-----------
>  1 file changed, 148 insertions(+), 152 deletions(-)
> 
> diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c
> index 9143b40..fb40969 100644
> --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c
> +++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c
> @@ -83,8 +83,7 @@ static void ieee80211_MFIE_Grate(struct ieee80211_device *ieee, u8 **tag_p)
>  {
>  	u8 *tag = *tag_p;
>  
> -		if (ieee->modulation & IEEE80211_OFDM_MODULATION) {
> -
> +	if (ieee->modulation & IEEE80211_OFDM_MODULATION) {
>  		*tag++ = MFIE_TYPE_RATES_EX;
>  		*tag++ = 8;
>  		*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_6MB;
> @@ -95,7 +94,6 @@ static void ieee80211_MFIE_Grate(struct ieee80211_device *ieee, u8 **tag_p)
>  		*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_36MB;
>  		*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_48MB;
>  		*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_54MB;
> -

This patch removes unnecessary blank lines, which wasn't mentioned in
the patch description.  You should do that in a separate patch.

More comments below.

>  	}
>  	/* We may add an option for custom rates that specific HW might support */
>  	*tag_p = tag;
> @@ -784,9 +782,9 @@ static struct sk_buff *ieee80211_probe_resp(struct ieee80211_device *ieee,
>  
>  	if (wpa_ie_len)	{
>  		if (ieee->iw_mode == IW_MODE_ADHOC) {
> -		 /* as Windows will set pairwise key same as the group key
> -		  * which is not allowed in Linux, so set this for IOT issue.
> -		  * WB 2008.07.07 */
> +			/* as Windows will set pairwise key same as the group
> +			 * key which is not allowed in Linux, so set this for
> +			 * IOT issue. WB 2008.07.07 */
>  			memcpy(&ieee->wpa_ie[14], &ieee->wpa_ie[8], 4);
>  		}
>  
> @@ -1141,8 +1139,8 @@ static void ieee80211_associate_step2(struct ieee80211_device *ieee)
>  	else {
>  		softmac_mgmt_xmit(skb, ieee);
>  		if (!timer_pending(&ieee->associate_timer)) {
> -		ieee->associate_timer.expires = jiffies + (HZ / 2);
> -		add_timer(&ieee->associate_timer);
> +			ieee->associate_timer.expires = jiffies + (HZ / 2);
> +			add_timer(&ieee->associate_timer);
>  		}
>  	}
>  }
> @@ -1640,146 +1638,144 @@ inline int ieee80211_rx_frame_softmac(struct ieee80211_device *ieee,
>  		ieee->last_rx_ps_time = jiffies;
>  
>  	switch (WLAN_FC_GET_STYPE(header->frame_control)) {
> -		case IEEE80211_STYPE_ASSOC_RESP:
> -		case IEEE80211_STYPE_REASSOC_RESP:
> -			IEEE80211_DEBUG_MGMT("received [RE]ASSOCIATION RESPONSE (%d)\n",
> -					WLAN_FC_GET_STYPE(header->frame_ctl));
> -			if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
> -				ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATED &&
> -				ieee->iw_mode == IW_MODE_INFRA) {
> -				if (0 == (errcode = assoc_parse(skb, &aid))) {
> -					u16 left;
> -
> -					ieee->state = IEEE80211_LINKED;
> -					ieee->assoc_id = aid;
> -					ieee->softmac_stats.rx_ass_ok++;
> -
> -					if (1 == rx_stats->nic_type) /* card type is 8187 */
> -						goto associate_complete;
> -
> -					assoc_resp = (struct ieee80211_assoc_response_frame*)skb->data;
> -					info_element = &assoc_resp->info_element;
> -					left = skb->len - ((void*)info_element - (void*)assoc_resp);
> -
> -					while (left >= sizeof(struct ieee80211_info_element_hdr)) {
> -						if (sizeof(struct ieee80211_info_element_hdr) + info_element->len > left) {
> -							printk(KERN_WARNING "[re]associate response error!");
> -							return 1;
> +	case IEEE80211_STYPE_ASSOC_RESP:
> +	case IEEE80211_STYPE_REASSOC_RESP:
> +		IEEE80211_DEBUG_MGMT("received [RE]ASSOCIATION RESPONSE (%d)\n",
> +				WLAN_FC_GET_STYPE(header->frame_ctl));
> +		if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
> +			ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATED &&
> +			ieee->iw_mode == IW_MODE_INFRA) {
> +			if (0 == (errcode = assoc_parse(skb, &aid))) {
> +				u16 left;
> +
> +				ieee->state = IEEE80211_LINKED;
> +				ieee->assoc_id = aid;
> +				ieee->softmac_stats.rx_ass_ok++;
> +
> +				if (1 == rx_stats->nic_type) /* card type is 8187 */
> +					goto associate_complete;
> +
> +				assoc_resp = (struct ieee80211_assoc_response_frame*)skb->data;
> +				info_element = &assoc_resp->info_element;
> +				left = skb->len - ((void*)info_element - (void*)assoc_resp);
> +
> +				while (left >= sizeof(struct ieee80211_info_element_hdr)) {
> +					if (sizeof(struct ieee80211_info_element_hdr) + info_element->len > left) {
> +						printk(KERN_WARNING "[re]associate response error!");
> +						return 1;
> +					}
> +					switch (info_element->id) {
> +					case MFIE_TYPE_GENERIC:
> +						IEEE80211_DEBUG_SCAN("MFIE_TYPE_GENERIC: %d bytes\n", info_element->len);
> +						if (info_element->len >= 8  &&
> +						    info_element->data[0] == 0x00 &&
> +						    info_element->data[1] == 0x50 &&
> +						    info_element->data[2] == 0xf2 &&
> +						    info_element->data[3] == 0x02 &&
> +						    info_element->data[4] == 0x01) {
> +							/* Not care about version at present. */
> +							/* WMM Parameter Element */
> +							memcpy(ieee->current_network.wmm_param, (u8*)(info_element->data\
> +								+ 8), (info_element->len - 8));
> +
> +						if (((ieee->current_network.wmm_info^info_element->data[6])& \
> +									    0x0f) || (!ieee->init_wmmparam_flag)) {
> +							/* refresh parameter element for current network */
> +							/* update the register parameter for hardware */
> +							ieee->init_wmmparam_flag = 1;
> +							queue_work(ieee->wq, &ieee->wmm_param_update_wq);
> +
>  						}
> -						switch (info_element->id) {
> -						  case MFIE_TYPE_GENERIC:
> -						         IEEE80211_DEBUG_SCAN("MFIE_TYPE_GENERIC: %d bytes\n", info_element->len);
> -							if (info_element->len >= 8  &&
> -							    info_element->data[0] == 0x00 &&
> -							    info_element->data[1] == 0x50 &&
> -							    info_element->data[2] == 0xf2 &&
> -							    info_element->data[3] == 0x02 &&
> -							    info_element->data[4] == 0x01) {
> -							    /* Not care about version at present. */
> -							    /* WMM Parameter Element */
> -							    memcpy(ieee->current_network.wmm_param, (u8*)(info_element->data\
> -										    + 8), (info_element->len - 8));
> -
> -						            if (((ieee->current_network.wmm_info^info_element->data[6])& \
> -										    0x0f) || (!ieee->init_wmmparam_flag)) {
> -							      /* refresh parameter element for current network */
> -							      /* update the register parameter for hardware */
> -							      ieee->init_wmmparam_flag = 1;
> -							      queue_work(ieee->wq, &ieee->wmm_param_update_wq);
> -
> -						            }
> -						            /* update info_element for current network */
> -						            ieee->current_network.wmm_info  = info_element->data[6];
> -							}
> -							break;
> -						  default:
> -							/* nothing to do at present!!! */
> -							break;
> +						/* update info_element for current network */
> +						ieee->current_network.wmm_info  = info_element->data[6];
>  						}

The above { looks suspect.  It pairs with the switch statement you added
above, correct?  I think it should be moved one tab indent in.

> +						break;
> +					default:
> +						/* nothing to do at present!!! */
> +						break;
> +					}

And probably other lines as well?  This is pretty hard to parse.

Actually, instead of re-indenting this, why don't you refactor it a bit
instead?  Break the larger switch statements into a series of function
calls if possible.

Or perhaps this chunk could be turned into a series of patches, where
you move the inner most case statements inwards, then move the outer
ones in?  At the very least, it this chunk should be a separate patch,
to make it easier to review.

Sarah Sharp

>  
>  						left -= sizeof(struct ieee80211_info_element_hdr) +
>  							info_element->len;
>  						info_element = (struct ieee80211_info_element *)
>  							&info_element->data[info_element->len];
> -					}
> -					/* legacy AP, reset the AC_xx_param register */
> -					if (!ieee->init_wmmparam_flag) {
> -						queue_work(ieee->wq, &ieee->wmm_param_update_wq);
> -						ieee->init_wmmparam_flag = 1; /* indicate AC_xx_param upated since last associate */
> -					}
> -associate_complete:
> -					ieee80211_associate_complete(ieee);
> -				} else {
> -					ieee->softmac_stats.rx_ass_err++;
> -					IEEE80211_DEBUG_MGMT(
> -						"Association response status code 0x%x\n",
> -						errcode);
> -					ieee80211_associate_abort(ieee);
>  				}
> +				/* legacy AP, reset the AC_xx_param register */
> +				if (!ieee->init_wmmparam_flag) {
> +					queue_work(ieee->wq, &ieee->wmm_param_update_wq);
> +					ieee->init_wmmparam_flag = 1; /* indicate AC_xx_param upated since last associate */
> +				}
> +associate_complete:
> +				ieee80211_associate_complete(ieee);
> +			} else {
> +				ieee->softmac_stats.rx_ass_err++;
> +				IEEE80211_DEBUG_MGMT(
> +					"Association response status code 0x%x\n",
> +					errcode);
> +				ieee80211_associate_abort(ieee);
>  			}
> -			break;
> -		case IEEE80211_STYPE_ASSOC_REQ:
> -		case IEEE80211_STYPE_REASSOC_REQ:
> -			if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
> -				ieee->iw_mode == IW_MODE_MASTER)
> +		}
> +		break;
> +	case IEEE80211_STYPE_ASSOC_REQ:
> +	case IEEE80211_STYPE_REASSOC_REQ:
> +		if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
> +			ieee->iw_mode == IW_MODE_MASTER)
>  
> -				ieee80211_rx_assoc_rq(ieee, skb);
> -			break;
> -		case IEEE80211_STYPE_AUTH:
> -			if (ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) {
> -				if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING &&
> +			ieee80211_rx_assoc_rq(ieee, skb);
> +		break;
> +	case IEEE80211_STYPE_AUTH:
> +		if (ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) {
> +			if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING &&
>  				ieee->iw_mode == IW_MODE_INFRA){
>  
> -						IEEE80211_DEBUG_MGMT("Received authentication response");
> -
> -						if (0 == (errcode = auth_parse(skb, &challenge, &chlen))) {
> -							if (ieee->open_wep || !challenge) {
> -								ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATED;
> -								ieee->softmac_stats.rx_auth_rs_ok++;
> -
> -								ieee80211_associate_step2(ieee);
> -							} else {
> -								ieee80211_rtl_auth_challenge(ieee, challenge, chlen);
> -							}
> -						} else {
> -							ieee->softmac_stats.rx_auth_rs_err++;
> -							IEEE80211_DEBUG_MGMT("Authentication response status code 0x%x", errcode);
> -							ieee80211_associate_abort(ieee);
> -						}
> +				IEEE80211_DEBUG_MGMT("Received authentication response");
> +
> +				if (0 == (errcode = auth_parse(skb, &challenge, &chlen))) {
> +					if (ieee->open_wep || !challenge) {
> +						ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATED;
> +						ieee->softmac_stats.rx_auth_rs_ok++;
>  
> -					} else if (ieee->iw_mode == IW_MODE_MASTER) {
> -						ieee80211_rx_auth_rq(ieee, skb);
> +						ieee80211_associate_step2(ieee);
> +					} else {
> +						ieee80211_rtl_auth_challenge(ieee, challenge, chlen);
>  					}
> +				} else {
> +					ieee->softmac_stats.rx_auth_rs_err++;
> +					IEEE80211_DEBUG_MGMT("Authentication response status code 0x%x", errcode);
> +					ieee80211_associate_abort(ieee);
>  				}
> -			break;
> -		case IEEE80211_STYPE_PROBE_REQ:
> -
> -			if ((ieee->softmac_features & IEEE_SOFTMAC_PROBERS) &&
> -				((ieee->iw_mode == IW_MODE_ADHOC ||
> -				ieee->iw_mode == IW_MODE_MASTER) &&
> -				ieee->state == IEEE80211_LINKED))
> -
> -				ieee80211_rx_probe_rq(ieee, skb);
> -			break;
> -		case IEEE80211_STYPE_DISASSOC:
> -		case IEEE80211_STYPE_DEAUTH:
> -			/* FIXME for now repeat all the association procedure
> -			* both for disassociation and deauthentication
> -			*/
> -			if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
> -				(ieee->state == IEEE80211_LINKED) &&
> -				(ieee->iw_mode == IW_MODE_INFRA) &&
> -				(!memcmp(header->addr2, ieee->current_network.bssid, ETH_ALEN))) {
> -				ieee->state = IEEE80211_ASSOCIATING;
> -				ieee->softmac_stats.reassoc++;
>  
> -				queue_work(ieee->wq, &ieee->associate_procedure_wq);
> +			} else if (ieee->iw_mode == IW_MODE_MASTER) {
> +				ieee80211_rx_auth_rq(ieee, skb);
>  			}
> +		}
> +		break;
> +	case IEEE80211_STYPE_PROBE_REQ:
> +		if ((ieee->softmac_features & IEEE_SOFTMAC_PROBERS) &&
> +			((ieee->iw_mode == IW_MODE_ADHOC ||
> +			ieee->iw_mode == IW_MODE_MASTER) &&
> +			ieee->state == IEEE80211_LINKED))
>  
> -			break;
> -		default:
> -			return -1;
> -			break;
> +			ieee80211_rx_probe_rq(ieee, skb);
> +		break;
> +	case IEEE80211_STYPE_DISASSOC:
> +	case IEEE80211_STYPE_DEAUTH:
> +		/* FIXME for now repeat all the association procedure
> +		 * both for disassociation and deauthentication
> +		 */
> +		if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
> +			(ieee->state == IEEE80211_LINKED) &&
> +			(ieee->iw_mode == IW_MODE_INFRA) &&
> +			(!memcmp(header->addr2, ieee->current_network.bssid, ETH_ALEN))) {
> +			ieee->state = IEEE80211_ASSOCIATING;
> +			ieee->softmac_stats.reassoc++;
> +
> +			queue_work(ieee->wq, &ieee->associate_procedure_wq);
> +		}
> +		break;
> +	default:
> +		return -1;
> +		break;
>  	}
>  	return 0;
>  }
> @@ -1828,7 +1824,7 @@ void ieee80211_softmac_xmit(struct ieee80211_txb *txb,
>  
>  	ieee80211_txb_free(txb);
>  
> -	exit:
> +exit:
>  	spin_unlock_irqrestore(&ieee->lock, flags);
>  
>  }
> @@ -2266,9 +2262,9 @@ void ieee80211_start_protocol(struct ieee80211_device *ieee)
>  	ieee->set_chan(ieee->dev, ieee->current_network.channel);
>  
>  	for (i = 0; i < 17; i++) {
> -	  ieee->last_rxseq_num[i] = -1;
> -	  ieee->last_rxfrag_num[i] = -1;
> -	  ieee->last_packet_time[i] = 0;
> +		ieee->last_rxseq_num[i] = -1;
> +		ieee->last_rxfrag_num[i] = -1;
> +		ieee->last_packet_time[i] = 0;
>  	}
>  
>  	ieee->init_wmmparam_flag = 0; /* reinitialize AC_xx_PARAM registers. */
> @@ -2279,25 +2275,25 @@ void ieee80211_start_protocol(struct ieee80211_device *ieee)
>  	 * and the nic is still checking for the AP MAC ??
>  	 */
>  	switch (ieee->iw_mode) {
> -		case IW_MODE_AUTO:
> -			ieee->iw_mode = IW_MODE_INFRA;
> -			/* not set break here intentionly */
> -		case IW_MODE_INFRA:
> -			ieee80211_start_bss(ieee);
> -			break;
> -		case IW_MODE_ADHOC:
> -			ieee80211_start_ibss(ieee);
> -			break;
> -		case IW_MODE_MASTER:
> -			ieee80211_start_master_bss(ieee);
> +	case IW_MODE_AUTO:
> +		ieee->iw_mode = IW_MODE_INFRA;
> +		/* not set break here intentionly */
> +	case IW_MODE_INFRA:
> +		ieee80211_start_bss(ieee);
> +		break;
> +	case IW_MODE_ADHOC:
> +		ieee80211_start_ibss(ieee);
> +		break;
> +	case IW_MODE_MASTER:
> +		ieee80211_start_master_bss(ieee);
> +	break;
> +	case IW_MODE_MONITOR:
> +		ieee80211_start_monitor_mode(ieee);
> +		break;
> +	default:
> +		ieee->iw_mode = IW_MODE_INFRA;
> +		ieee80211_start_bss(ieee);
>  		break;
> -		case IW_MODE_MONITOR:
> -			ieee80211_start_monitor_mode(ieee);
> -			break;
> -		default:
> -			ieee->iw_mode = IW_MODE_INFRA;
> -			ieee80211_start_bss(ieee);
> -			break;
>  	}
>  }
>  
> -- 
> 1.8.5.3
> 
> -- 
> You received this message because you are subscribed to the Google Groups "opw-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to opw-kernel+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Patch
diff mbox

diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c
index 9143b40..fb40969 100644
--- a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c
+++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c
@@ -83,8 +83,7 @@  static void ieee80211_MFIE_Grate(struct ieee80211_device *ieee, u8 **tag_p)
 {
 	u8 *tag = *tag_p;
 
-		if (ieee->modulation & IEEE80211_OFDM_MODULATION) {
-
+	if (ieee->modulation & IEEE80211_OFDM_MODULATION) {
 		*tag++ = MFIE_TYPE_RATES_EX;
 		*tag++ = 8;
 		*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_6MB;
@@ -95,7 +94,6 @@  static void ieee80211_MFIE_Grate(struct ieee80211_device *ieee, u8 **tag_p)
 		*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_36MB;
 		*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_48MB;
 		*tag++ = IEEE80211_BASIC_RATE_MASK | IEEE80211_OFDM_RATE_54MB;
-
 	}
 	/* We may add an option for custom rates that specific HW might support */
 	*tag_p = tag;
@@ -784,9 +782,9 @@  static struct sk_buff *ieee80211_probe_resp(struct ieee80211_device *ieee,
 
 	if (wpa_ie_len)	{
 		if (ieee->iw_mode == IW_MODE_ADHOC) {
-		 /* as Windows will set pairwise key same as the group key
-		  * which is not allowed in Linux, so set this for IOT issue.
-		  * WB 2008.07.07 */
+			/* as Windows will set pairwise key same as the group
+			 * key which is not allowed in Linux, so set this for
+			 * IOT issue. WB 2008.07.07 */
 			memcpy(&ieee->wpa_ie[14], &ieee->wpa_ie[8], 4);
 		}
 
@@ -1141,8 +1139,8 @@  static void ieee80211_associate_step2(struct ieee80211_device *ieee)
 	else {
 		softmac_mgmt_xmit(skb, ieee);
 		if (!timer_pending(&ieee->associate_timer)) {
-		ieee->associate_timer.expires = jiffies + (HZ / 2);
-		add_timer(&ieee->associate_timer);
+			ieee->associate_timer.expires = jiffies + (HZ / 2);
+			add_timer(&ieee->associate_timer);
 		}
 	}
 }
@@ -1640,146 +1638,144 @@  inline int ieee80211_rx_frame_softmac(struct ieee80211_device *ieee,
 		ieee->last_rx_ps_time = jiffies;
 
 	switch (WLAN_FC_GET_STYPE(header->frame_control)) {
-		case IEEE80211_STYPE_ASSOC_RESP:
-		case IEEE80211_STYPE_REASSOC_RESP:
-			IEEE80211_DEBUG_MGMT("received [RE]ASSOCIATION RESPONSE (%d)\n",
-					WLAN_FC_GET_STYPE(header->frame_ctl));
-			if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
-				ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATED &&
-				ieee->iw_mode == IW_MODE_INFRA) {
-				if (0 == (errcode = assoc_parse(skb, &aid))) {
-					u16 left;
-
-					ieee->state = IEEE80211_LINKED;
-					ieee->assoc_id = aid;
-					ieee->softmac_stats.rx_ass_ok++;
-
-					if (1 == rx_stats->nic_type) /* card type is 8187 */
-						goto associate_complete;
-
-					assoc_resp = (struct ieee80211_assoc_response_frame*)skb->data;
-					info_element = &assoc_resp->info_element;
-					left = skb->len - ((void*)info_element - (void*)assoc_resp);
-
-					while (left >= sizeof(struct ieee80211_info_element_hdr)) {
-						if (sizeof(struct ieee80211_info_element_hdr) + info_element->len > left) {
-							printk(KERN_WARNING "[re]associate response error!");
-							return 1;
+	case IEEE80211_STYPE_ASSOC_RESP:
+	case IEEE80211_STYPE_REASSOC_RESP:
+		IEEE80211_DEBUG_MGMT("received [RE]ASSOCIATION RESPONSE (%d)\n",
+				WLAN_FC_GET_STYPE(header->frame_ctl));
+		if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
+			ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATED &&
+			ieee->iw_mode == IW_MODE_INFRA) {
+			if (0 == (errcode = assoc_parse(skb, &aid))) {
+				u16 left;
+
+				ieee->state = IEEE80211_LINKED;
+				ieee->assoc_id = aid;
+				ieee->softmac_stats.rx_ass_ok++;
+
+				if (1 == rx_stats->nic_type) /* card type is 8187 */
+					goto associate_complete;
+
+				assoc_resp = (struct ieee80211_assoc_response_frame*)skb->data;
+				info_element = &assoc_resp->info_element;
+				left = skb->len - ((void*)info_element - (void*)assoc_resp);
+
+				while (left >= sizeof(struct ieee80211_info_element_hdr)) {
+					if (sizeof(struct ieee80211_info_element_hdr) + info_element->len > left) {
+						printk(KERN_WARNING "[re]associate response error!");
+						return 1;
+					}
+					switch (info_element->id) {
+					case MFIE_TYPE_GENERIC:
+						IEEE80211_DEBUG_SCAN("MFIE_TYPE_GENERIC: %d bytes\n", info_element->len);
+						if (info_element->len >= 8  &&
+						    info_element->data[0] == 0x00 &&
+						    info_element->data[1] == 0x50 &&
+						    info_element->data[2] == 0xf2 &&
+						    info_element->data[3] == 0x02 &&
+						    info_element->data[4] == 0x01) {
+							/* Not care about version at present. */
+							/* WMM Parameter Element */
+							memcpy(ieee->current_network.wmm_param, (u8*)(info_element->data\
+								+ 8), (info_element->len - 8));
+
+						if (((ieee->current_network.wmm_info^info_element->data[6])& \
+									    0x0f) || (!ieee->init_wmmparam_flag)) {
+							/* refresh parameter element for current network */
+							/* update the register parameter for hardware */
+							ieee->init_wmmparam_flag = 1;
+							queue_work(ieee->wq, &ieee->wmm_param_update_wq);
+
 						}
-						switch (info_element->id) {
-						  case MFIE_TYPE_GENERIC:
-						         IEEE80211_DEBUG_SCAN("MFIE_TYPE_GENERIC: %d bytes\n", info_element->len);
-							if (info_element->len >= 8  &&
-							    info_element->data[0] == 0x00 &&
-							    info_element->data[1] == 0x50 &&
-							    info_element->data[2] == 0xf2 &&
-							    info_element->data[3] == 0x02 &&
-							    info_element->data[4] == 0x01) {
-							    /* Not care about version at present. */
-							    /* WMM Parameter Element */
-							    memcpy(ieee->current_network.wmm_param, (u8*)(info_element->data\
-										    + 8), (info_element->len - 8));
-
-						            if (((ieee->current_network.wmm_info^info_element->data[6])& \
-										    0x0f) || (!ieee->init_wmmparam_flag)) {
-							      /* refresh parameter element for current network */
-							      /* update the register parameter for hardware */
-							      ieee->init_wmmparam_flag = 1;
-							      queue_work(ieee->wq, &ieee->wmm_param_update_wq);
-
-						            }
-						            /* update info_element for current network */
-						            ieee->current_network.wmm_info  = info_element->data[6];
-							}
-							break;
-						  default:
-							/* nothing to do at present!!! */
-							break;
+						/* update info_element for current network */
+						ieee->current_network.wmm_info  = info_element->data[6];
 						}
+						break;
+					default:
+						/* nothing to do at present!!! */
+						break;
+					}
 
 						left -= sizeof(struct ieee80211_info_element_hdr) +
 							info_element->len;
 						info_element = (struct ieee80211_info_element *)
 							&info_element->data[info_element->len];
-					}
-					/* legacy AP, reset the AC_xx_param register */
-					if (!ieee->init_wmmparam_flag) {
-						queue_work(ieee->wq, &ieee->wmm_param_update_wq);
-						ieee->init_wmmparam_flag = 1; /* indicate AC_xx_param upated since last associate */
-					}
-associate_complete:
-					ieee80211_associate_complete(ieee);
-				} else {
-					ieee->softmac_stats.rx_ass_err++;
-					IEEE80211_DEBUG_MGMT(
-						"Association response status code 0x%x\n",
-						errcode);
-					ieee80211_associate_abort(ieee);
 				}
+				/* legacy AP, reset the AC_xx_param register */
+				if (!ieee->init_wmmparam_flag) {
+					queue_work(ieee->wq, &ieee->wmm_param_update_wq);
+					ieee->init_wmmparam_flag = 1; /* indicate AC_xx_param upated since last associate */
+				}
+associate_complete:
+				ieee80211_associate_complete(ieee);
+			} else {
+				ieee->softmac_stats.rx_ass_err++;
+				IEEE80211_DEBUG_MGMT(
+					"Association response status code 0x%x\n",
+					errcode);
+				ieee80211_associate_abort(ieee);
 			}
-			break;
-		case IEEE80211_STYPE_ASSOC_REQ:
-		case IEEE80211_STYPE_REASSOC_REQ:
-			if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
-				ieee->iw_mode == IW_MODE_MASTER)
+		}
+		break;
+	case IEEE80211_STYPE_ASSOC_REQ:
+	case IEEE80211_STYPE_REASSOC_REQ:
+		if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
+			ieee->iw_mode == IW_MODE_MASTER)
 
-				ieee80211_rx_assoc_rq(ieee, skb);
-			break;
-		case IEEE80211_STYPE_AUTH:
-			if (ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) {
-				if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING &&
+			ieee80211_rx_assoc_rq(ieee, skb);
+		break;
+	case IEEE80211_STYPE_AUTH:
+		if (ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) {
+			if (ieee->state == IEEE80211_ASSOCIATING_AUTHENTICATING &&
 				ieee->iw_mode == IW_MODE_INFRA){
 
-						IEEE80211_DEBUG_MGMT("Received authentication response");
-
-						if (0 == (errcode = auth_parse(skb, &challenge, &chlen))) {
-							if (ieee->open_wep || !challenge) {
-								ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATED;
-								ieee->softmac_stats.rx_auth_rs_ok++;
-
-								ieee80211_associate_step2(ieee);
-							} else {
-								ieee80211_rtl_auth_challenge(ieee, challenge, chlen);
-							}
-						} else {
-							ieee->softmac_stats.rx_auth_rs_err++;
-							IEEE80211_DEBUG_MGMT("Authentication response status code 0x%x", errcode);
-							ieee80211_associate_abort(ieee);
-						}
+				IEEE80211_DEBUG_MGMT("Received authentication response");
+
+				if (0 == (errcode = auth_parse(skb, &challenge, &chlen))) {
+					if (ieee->open_wep || !challenge) {
+						ieee->state = IEEE80211_ASSOCIATING_AUTHENTICATED;
+						ieee->softmac_stats.rx_auth_rs_ok++;
 
-					} else if (ieee->iw_mode == IW_MODE_MASTER) {
-						ieee80211_rx_auth_rq(ieee, skb);
+						ieee80211_associate_step2(ieee);
+					} else {
+						ieee80211_rtl_auth_challenge(ieee, challenge, chlen);
 					}
+				} else {
+					ieee->softmac_stats.rx_auth_rs_err++;
+					IEEE80211_DEBUG_MGMT("Authentication response status code 0x%x", errcode);
+					ieee80211_associate_abort(ieee);
 				}
-			break;
-		case IEEE80211_STYPE_PROBE_REQ:
-
-			if ((ieee->softmac_features & IEEE_SOFTMAC_PROBERS) &&
-				((ieee->iw_mode == IW_MODE_ADHOC ||
-				ieee->iw_mode == IW_MODE_MASTER) &&
-				ieee->state == IEEE80211_LINKED))
-
-				ieee80211_rx_probe_rq(ieee, skb);
-			break;
-		case IEEE80211_STYPE_DISASSOC:
-		case IEEE80211_STYPE_DEAUTH:
-			/* FIXME for now repeat all the association procedure
-			* both for disassociation and deauthentication
-			*/
-			if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
-				(ieee->state == IEEE80211_LINKED) &&
-				(ieee->iw_mode == IW_MODE_INFRA) &&
-				(!memcmp(header->addr2, ieee->current_network.bssid, ETH_ALEN))) {
-				ieee->state = IEEE80211_ASSOCIATING;
-				ieee->softmac_stats.reassoc++;
 
-				queue_work(ieee->wq, &ieee->associate_procedure_wq);
+			} else if (ieee->iw_mode == IW_MODE_MASTER) {
+				ieee80211_rx_auth_rq(ieee, skb);
 			}
+		}
+		break;
+	case IEEE80211_STYPE_PROBE_REQ:
+		if ((ieee->softmac_features & IEEE_SOFTMAC_PROBERS) &&
+			((ieee->iw_mode == IW_MODE_ADHOC ||
+			ieee->iw_mode == IW_MODE_MASTER) &&
+			ieee->state == IEEE80211_LINKED))
 
-			break;
-		default:
-			return -1;
-			break;
+			ieee80211_rx_probe_rq(ieee, skb);
+		break;
+	case IEEE80211_STYPE_DISASSOC:
+	case IEEE80211_STYPE_DEAUTH:
+		/* FIXME for now repeat all the association procedure
+		 * both for disassociation and deauthentication
+		 */
+		if ((ieee->softmac_features & IEEE_SOFTMAC_ASSOCIATE) &&
+			(ieee->state == IEEE80211_LINKED) &&
+			(ieee->iw_mode == IW_MODE_INFRA) &&
+			(!memcmp(header->addr2, ieee->current_network.bssid, ETH_ALEN))) {
+			ieee->state = IEEE80211_ASSOCIATING;
+			ieee->softmac_stats.reassoc++;
+
+			queue_work(ieee->wq, &ieee->associate_procedure_wq);
+		}
+		break;
+	default:
+		return -1;
+		break;
 	}
 	return 0;
 }
@@ -1828,7 +1824,7 @@  void ieee80211_softmac_xmit(struct ieee80211_txb *txb,
 
 	ieee80211_txb_free(txb);
 
-	exit:
+exit:
 	spin_unlock_irqrestore(&ieee->lock, flags);
 
 }
@@ -2266,9 +2262,9 @@  void ieee80211_start_protocol(struct ieee80211_device *ieee)
 	ieee->set_chan(ieee->dev, ieee->current_network.channel);
 
 	for (i = 0; i < 17; i++) {
-	  ieee->last_rxseq_num[i] = -1;
-	  ieee->last_rxfrag_num[i] = -1;
-	  ieee->last_packet_time[i] = 0;
+		ieee->last_rxseq_num[i] = -1;
+		ieee->last_rxfrag_num[i] = -1;
+		ieee->last_packet_time[i] = 0;
 	}
 
 	ieee->init_wmmparam_flag = 0; /* reinitialize AC_xx_PARAM registers. */
@@ -2279,25 +2275,25 @@  void ieee80211_start_protocol(struct ieee80211_device *ieee)
 	 * and the nic is still checking for the AP MAC ??
 	 */
 	switch (ieee->iw_mode) {
-		case IW_MODE_AUTO:
-			ieee->iw_mode = IW_MODE_INFRA;
-			/* not set break here intentionly */
-		case IW_MODE_INFRA:
-			ieee80211_start_bss(ieee);
-			break;
-		case IW_MODE_ADHOC:
-			ieee80211_start_ibss(ieee);
-			break;
-		case IW_MODE_MASTER:
-			ieee80211_start_master_bss(ieee);
+	case IW_MODE_AUTO:
+		ieee->iw_mode = IW_MODE_INFRA;
+		/* not set break here intentionly */
+	case IW_MODE_INFRA:
+		ieee80211_start_bss(ieee);
+		break;
+	case IW_MODE_ADHOC:
+		ieee80211_start_ibss(ieee);
+		break;
+	case IW_MODE_MASTER:
+		ieee80211_start_master_bss(ieee);
+	break;
+	case IW_MODE_MONITOR:
+		ieee80211_start_monitor_mode(ieee);
+		break;
+	default:
+		ieee->iw_mode = IW_MODE_INFRA;
+		ieee80211_start_bss(ieee);
 		break;
-		case IW_MODE_MONITOR:
-			ieee80211_start_monitor_mode(ieee);
-			break;
-		default:
-			ieee->iw_mode = IW_MODE_INFRA;
-			ieee80211_start_bss(ieee);
-			break;
 	}
 }