[PATCH] staging: rtl8188eu: Remove redundant CONFIG_88EU_AP_MODE tests

From: Jakub Sitnicki
Date: Fri May 22 2015 - 01:06:34 EST


Remove #ifdef's enclosed by an #ifdef test for the same macro to improve
readability.

No code changes:

md5, CONFIG_88EU_AP_MODE=y:
b819a33f65133607ebc33b8999ee3a79 r8188eu.o.before
b819a33f65133607ebc33b8999ee3a79 r8188eu.o.after

md5, CONFIG_88EU_AP_MODE=n:
94c84035d59285408b866a57b442276d r8188eu.o.before
94c84035d59285408b866a57b442276d r8188eu.o.after

Signed-off-by: Jakub Sitnicki <jsitnicki@xxxxxxxxx>
---

Patch generated with more context to hopefully make the review easier.

drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | 14 +-------------
drivers/staging/rtl8188eu/core/rtw_sta_mgt.c | 2 --
drivers/staging/rtl8188eu/include/rtw_ap.h | 2 --
3 files changed, 1 insertion(+), 17 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
index be9e34a..79fbf7d 100644
--- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
@@ -787,40 +787,36 @@ unsigned int OnAuth(struct adapter *padapter, struct recv_frame *precv_frame)
status = _STATS_OUT_OF_AUTH_SEQ_;
goto auth_fail;
}
}

/* Now, we are going to issue_auth... */
pstat->auth_seq = seq + 1;

-#ifdef CONFIG_88EU_AP_MODE
issue_auth(padapter, pstat, (unsigned short)(_STATS_SUCCESSFUL_));
-#endif

if (pstat->state & WIFI_FW_AUTH_SUCCESS)
pstat->auth_seq = 0;

return _SUCCESS;

auth_fail:

if (pstat)
rtw_free_stainfo(padapter , pstat);

pstat = &stat;
memset((char *)pstat, '\0', sizeof(stat));
pstat->auth_seq = 2;
memcpy(pstat->hwaddr, sa, 6);

-#ifdef CONFIG_88EU_AP_MODE
issue_auth(padapter, pstat, (unsigned short)status);
-#endif

-#endif
+#endif /* CONFIG_88EU_AP_MODE */
return _FAIL;
}

unsigned int OnAuthClient(struct adapter *padapter, struct recv_frame *precv_frame)
{
unsigned int seq, len, status, offset;
unsigned char *p;
unsigned int go2asoc = 0;
@@ -1288,57 +1284,49 @@ unsigned int OnAssocReq(struct adapter *padapter, struct recv_frame *precv_frame
pstat->expire_to = pstapriv->expire_to;
list_add_tail(&pstat->asoc_list, &pstapriv->asoc_list);
pstapriv->asoc_list_cnt++;
}
spin_unlock_bh(&pstapriv->asoc_list_lock);

/* now the station is qualified to join our BSS... */
if (pstat && (pstat->state & WIFI_FW_ASSOC_SUCCESS) && (_STATS_SUCCESSFUL_ == status)) {
-#ifdef CONFIG_88EU_AP_MODE
/* 1 bss_cap_update & sta_info_update */
bss_cap_update_on_sta_join(padapter, pstat);
sta_info_update(padapter, pstat);

/* issue assoc rsp before notify station join event. */
if (frame_type == WIFI_ASSOCREQ)
issue_asocrsp(padapter, status, pstat, WIFI_ASSOCRSP);
else
issue_asocrsp(padapter, status, pstat, WIFI_REASSOCRSP);

/* 2 - report to upper layer */
DBG_88E("indicate_sta_join_event to upper layer - hostapd\n");
rtw_indicate_sta_assoc_event(padapter, pstat);

/* 3-(1) report sta add event */
report_add_sta_event(padapter, pstat->hwaddr, pstat->aid);
-#endif
}

return _SUCCESS;

asoc_class2_error:

-#ifdef CONFIG_88EU_AP_MODE
issue_deauth(padapter, (void *)GetAddr2Ptr(pframe), status);
-#endif

return _FAIL;

OnAssocReqFail:

-
-#ifdef CONFIG_88EU_AP_MODE
pstat->aid = 0;
if (frame_type == WIFI_ASSOCREQ)
issue_asocrsp(padapter, status, pstat, WIFI_ASSOCRSP);
else
issue_asocrsp(padapter, status, pstat, WIFI_REASSOCRSP);
-#endif
-

#endif /* CONFIG_88EU_AP_MODE */

return _FAIL;
}

unsigned int OnAssocRsp(struct adapter *padapter, struct recv_frame *precv_frame)
{
diff --git a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
index dc9d0dd..0b1cb03 100644
--- a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
+++ b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
@@ -49,24 +49,22 @@ static void _rtw_init_stainfo(struct sta_info *psta)
psta->expire_to = 0;

psta->flags = 0;

psta->capability = 0;

psta->bpairwise_key_installed = false;

-#ifdef CONFIG_88EU_AP_MODE
psta->nonerp_set = 0;
psta->no_short_slot_time_set = 0;
psta->no_short_preamble_set = 0;
psta->no_ht_gf_set = 0;
psta->no_ht_set = 0;
psta->ht_20mhz_set = 0;
-#endif

psta->under_exist_checking = 0;

psta->keep_alive_trycnt = 0;

#endif /* CONFIG_88EU_AP_MODE */

}
diff --git a/drivers/staging/rtl8188eu/include/rtw_ap.h b/drivers/staging/rtl8188eu/include/rtw_ap.h
index 9233401..6128ccc 100644
--- a/drivers/staging/rtl8188eu/include/rtw_ap.h
+++ b/drivers/staging/rtl8188eu/include/rtw_ap.h
@@ -42,24 +42,22 @@ void add_RATid(struct adapter *padapter, struct sta_info *psta,
u8 rssi_level);
void expire_timeout_chk(struct adapter *padapter);
void update_sta_info_apmode(struct adapter *padapter, struct sta_info *psta);
int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len);
void rtw_set_macaddr_acl(struct adapter *padapter, int mode);
int rtw_acl_add_sta(struct adapter *padapter, u8 *addr);
int rtw_acl_remove_sta(struct adapter *padapter, u8 *addr);

-#ifdef CONFIG_88EU_AP_MODE
void associated_clients_update(struct adapter *padapter, u8 updated);
void bss_cap_update_on_sta_join(struct adapter *padapter, struct sta_info *psta);
u8 bss_cap_update_on_sta_leave(struct adapter *padapter, struct sta_info *psta);
void sta_info_update(struct adapter *padapter, struct sta_info *psta);
void ap_sta_info_defer_update(struct adapter *padapter, struct sta_info *psta);
u8 ap_free_sta(struct adapter *padapter, struct sta_info *psta,
bool active, u16 reason);
int rtw_sta_flush(struct adapter *padapter);
int rtw_ap_inform_ch_switch(struct adapter *padapter, u8 new_ch, u8 ch_offset);
void start_ap_mode(struct adapter *padapter);
void stop_ap_mode(struct adapter *padapter);
-#endif
#endif /* end of CONFIG_88EU_AP_MODE */

#endif
--
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/