Commit 0a233c98 authored by Andreas Fenkart's avatar Andreas Fenkart Committed by Kalle Valo

mwifiex: scan: simplify dereference of bss_desc fields

given this structure:
struct foo {
  struct bar {
     int baz;
  }
}

these accesses are equivalent:
(*(foo->bar)).baz
foo->bar->baz
Signed-off-by: default avatarAndreas Fenkart <afenkart@gmail.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 84349698
...@@ -121,8 +121,8 @@ mwifiex_is_rsn_oui_present(struct mwifiex_bssdescriptor *bss_desc, u32 cipher) ...@@ -121,8 +121,8 @@ mwifiex_is_rsn_oui_present(struct mwifiex_bssdescriptor *bss_desc, u32 cipher)
struct ie_body *iebody; struct ie_body *iebody;
u8 ret = MWIFIEX_OUI_NOT_PRESENT; u8 ret = MWIFIEX_OUI_NOT_PRESENT;
if (((bss_desc->bcn_rsn_ie) && ((*(bss_desc->bcn_rsn_ie)). if (bss_desc->bcn_rsn_ie &&
ieee_hdr.element_id == WLAN_EID_RSN))) { bss_desc->bcn_rsn_ie->ieee_hdr.element_id == WLAN_EID_RSN) {
iebody = (struct ie_body *) iebody = (struct ie_body *)
(((u8 *) bss_desc->bcn_rsn_ie->data) + (((u8 *) bss_desc->bcn_rsn_ie->data) +
RSN_GTK_OUI_OFFSET); RSN_GTK_OUI_OFFSET);
...@@ -148,9 +148,9 @@ mwifiex_is_wpa_oui_present(struct mwifiex_bssdescriptor *bss_desc, u32 cipher) ...@@ -148,9 +148,9 @@ mwifiex_is_wpa_oui_present(struct mwifiex_bssdescriptor *bss_desc, u32 cipher)
struct ie_body *iebody; struct ie_body *iebody;
u8 ret = MWIFIEX_OUI_NOT_PRESENT; u8 ret = MWIFIEX_OUI_NOT_PRESENT;
if (((bss_desc->bcn_wpa_ie) && if (bss_desc->bcn_wpa_ie &&
((*(bss_desc->bcn_wpa_ie)).vend_hdr.element_id == bss_desc->bcn_wpa_ie->vend_hdr.element_id ==
WLAN_EID_VENDOR_SPECIFIC))) { WLAN_EID_VENDOR_SPECIFIC) {
iebody = (struct ie_body *) bss_desc->bcn_wpa_ie->data; iebody = (struct ie_body *) bss_desc->bcn_wpa_ie->data;
oui = &mwifiex_wpa_oui[cipher][0]; oui = &mwifiex_wpa_oui[cipher][0];
ret = mwifiex_search_oui_in_ie(iebody, oui); ret = mwifiex_search_oui_in_ie(iebody, oui);
...@@ -181,8 +181,8 @@ mwifiex_is_bss_wapi(struct mwifiex_private *priv, ...@@ -181,8 +181,8 @@ mwifiex_is_bss_wapi(struct mwifiex_private *priv,
{ {
if (priv->sec_info.wapi_enabled && if (priv->sec_info.wapi_enabled &&
(bss_desc->bcn_wapi_ie && (bss_desc->bcn_wapi_ie &&
((*(bss_desc->bcn_wapi_ie)).ieee_hdr.element_id == bss_desc->bcn_wapi_ie->ieee_hdr.element_id ==
WLAN_EID_BSS_AC_ACCESS_DELAY))) { WLAN_EID_BSS_AC_ACCESS_DELAY)) {
return true; return true;
} }
return false; return false;
...@@ -197,12 +197,12 @@ mwifiex_is_bss_no_sec(struct mwifiex_private *priv, ...@@ -197,12 +197,12 @@ mwifiex_is_bss_no_sec(struct mwifiex_private *priv,
struct mwifiex_bssdescriptor *bss_desc) struct mwifiex_bssdescriptor *bss_desc)
{ {
if (!priv->sec_info.wep_enabled && !priv->sec_info.wpa_enabled && if (!priv->sec_info.wep_enabled && !priv->sec_info.wpa_enabled &&
!priv->sec_info.wpa2_enabled && ((!bss_desc->bcn_wpa_ie) || !priv->sec_info.wpa2_enabled &&
((*(bss_desc->bcn_wpa_ie)).vend_hdr.element_id != (!bss_desc->bcn_wpa_ie ||
WLAN_EID_VENDOR_SPECIFIC)) && bss_desc->bcn_wpa_ie->vend_hdr.element_id !=
((!bss_desc->bcn_rsn_ie) || WLAN_EID_VENDOR_SPECIFIC) &&
((*(bss_desc->bcn_rsn_ie)).ieee_hdr.element_id != (!bss_desc->bcn_rsn_ie ||
WLAN_EID_RSN)) && bss_desc->bcn_rsn_ie->ieee_hdr.element_id != WLAN_EID_RSN) &&
!priv->sec_info.encryption_mode && !bss_desc->privacy) { !priv->sec_info.encryption_mode && !bss_desc->privacy) {
return true; return true;
} }
...@@ -233,9 +233,10 @@ mwifiex_is_bss_wpa(struct mwifiex_private *priv, ...@@ -233,9 +233,10 @@ mwifiex_is_bss_wpa(struct mwifiex_private *priv,
struct mwifiex_bssdescriptor *bss_desc) struct mwifiex_bssdescriptor *bss_desc)
{ {
if (!priv->sec_info.wep_enabled && priv->sec_info.wpa_enabled && if (!priv->sec_info.wep_enabled && priv->sec_info.wpa_enabled &&
!priv->sec_info.wpa2_enabled && ((bss_desc->bcn_wpa_ie) && !priv->sec_info.wpa2_enabled &&
((*(bss_desc->bcn_wpa_ie)). (bss_desc->bcn_wpa_ie &&
vend_hdr.element_id == WLAN_EID_VENDOR_SPECIFIC)) bss_desc->bcn_wpa_ie->vend_hdr.element_id ==
WLAN_EID_VENDOR_SPECIFIC)
/* /*
* Privacy bit may NOT be set in some APs like * Privacy bit may NOT be set in some APs like
* LinkSys WRT54G && bss_desc->privacy * LinkSys WRT54G && bss_desc->privacy
...@@ -245,12 +246,10 @@ mwifiex_is_bss_wpa(struct mwifiex_private *priv, ...@@ -245,12 +246,10 @@ mwifiex_is_bss_wpa(struct mwifiex_private *priv,
"info: %s: WPA:\t" "info: %s: WPA:\t"
"wpa_ie=%#x wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s\t" "wpa_ie=%#x wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s\t"
"EncMode=%#x privacy=%#x\n", __func__, "EncMode=%#x privacy=%#x\n", __func__,
(bss_desc->bcn_wpa_ie) ? bss_desc->bcn_wpa_ie ?
(*bss_desc->bcn_wpa_ie). bss_desc->bcn_wpa_ie->vend_hdr.element_id : 0,
vend_hdr.element_id : 0, bss_desc->bcn_rsn_ie ?
(bss_desc->bcn_rsn_ie) ? bss_desc->bcn_rsn_ie->ieee_hdr.element_id : 0,
(*bss_desc->bcn_rsn_ie).
ieee_hdr.element_id : 0,
(priv->sec_info.wep_enabled) ? "e" : "d", (priv->sec_info.wep_enabled) ? "e" : "d",
(priv->sec_info.wpa_enabled) ? "e" : "d", (priv->sec_info.wpa_enabled) ? "e" : "d",
(priv->sec_info.wpa2_enabled) ? "e" : "d", (priv->sec_info.wpa2_enabled) ? "e" : "d",
...@@ -269,11 +268,10 @@ static bool ...@@ -269,11 +268,10 @@ static bool
mwifiex_is_bss_wpa2(struct mwifiex_private *priv, mwifiex_is_bss_wpa2(struct mwifiex_private *priv,
struct mwifiex_bssdescriptor *bss_desc) struct mwifiex_bssdescriptor *bss_desc)
{ {
if (!priv->sec_info.wep_enabled && if (!priv->sec_info.wep_enabled && !priv->sec_info.wpa_enabled &&
!priv->sec_info.wpa_enabled &&
priv->sec_info.wpa2_enabled && priv->sec_info.wpa2_enabled &&
((bss_desc->bcn_rsn_ie) && (bss_desc->bcn_rsn_ie &&
((*(bss_desc->bcn_rsn_ie)).ieee_hdr.element_id == WLAN_EID_RSN))) { bss_desc->bcn_rsn_ie->ieee_hdr.element_id == WLAN_EID_RSN)) {
/* /*
* Privacy bit may NOT be set in some APs like * Privacy bit may NOT be set in some APs like
* LinkSys WRT54G && bss_desc->privacy * LinkSys WRT54G && bss_desc->privacy
...@@ -282,12 +280,10 @@ mwifiex_is_bss_wpa2(struct mwifiex_private *priv, ...@@ -282,12 +280,10 @@ mwifiex_is_bss_wpa2(struct mwifiex_private *priv,
"info: %s: WPA2:\t" "info: %s: WPA2:\t"
"wpa_ie=%#x wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s\t" "wpa_ie=%#x wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s\t"
"EncMode=%#x privacy=%#x\n", __func__, "EncMode=%#x privacy=%#x\n", __func__,
(bss_desc->bcn_wpa_ie) ? bss_desc->bcn_wpa_ie ?
(*bss_desc->bcn_wpa_ie). bss_desc->bcn_wpa_ie->vend_hdr.element_id : 0,
vend_hdr.element_id : 0, bss_desc->bcn_rsn_ie ?
(bss_desc->bcn_rsn_ie) ? bss_desc->bcn_rsn_ie->ieee_hdr.element_id : 0,
(*bss_desc->bcn_rsn_ie).
ieee_hdr.element_id : 0,
(priv->sec_info.wep_enabled) ? "e" : "d", (priv->sec_info.wep_enabled) ? "e" : "d",
(priv->sec_info.wpa_enabled) ? "e" : "d", (priv->sec_info.wpa_enabled) ? "e" : "d",
(priv->sec_info.wpa2_enabled) ? "e" : "d", (priv->sec_info.wpa2_enabled) ? "e" : "d",
...@@ -308,11 +304,11 @@ mwifiex_is_bss_adhoc_aes(struct mwifiex_private *priv, ...@@ -308,11 +304,11 @@ mwifiex_is_bss_adhoc_aes(struct mwifiex_private *priv,
{ {
if (!priv->sec_info.wep_enabled && !priv->sec_info.wpa_enabled && if (!priv->sec_info.wep_enabled && !priv->sec_info.wpa_enabled &&
!priv->sec_info.wpa2_enabled && !priv->sec_info.wpa2_enabled &&
((!bss_desc->bcn_wpa_ie) || (!bss_desc->bcn_wpa_ie ||
((*(bss_desc->bcn_wpa_ie)). bss_desc->bcn_wpa_ie->vend_hdr.element_id !=
vend_hdr.element_id != WLAN_EID_VENDOR_SPECIFIC)) && WLAN_EID_VENDOR_SPECIFIC) &&
((!bss_desc->bcn_rsn_ie) || (!bss_desc->bcn_rsn_ie ||
((*(bss_desc->bcn_rsn_ie)).ieee_hdr.element_id != WLAN_EID_RSN)) && bss_desc->bcn_rsn_ie->ieee_hdr.element_id != WLAN_EID_RSN) &&
!priv->sec_info.encryption_mode && bss_desc->privacy) { !priv->sec_info.encryption_mode && bss_desc->privacy) {
return true; return true;
} }
...@@ -329,23 +325,21 @@ mwifiex_is_bss_dynamic_wep(struct mwifiex_private *priv, ...@@ -329,23 +325,21 @@ mwifiex_is_bss_dynamic_wep(struct mwifiex_private *priv,
{ {
if (!priv->sec_info.wep_enabled && !priv->sec_info.wpa_enabled && if (!priv->sec_info.wep_enabled && !priv->sec_info.wpa_enabled &&
!priv->sec_info.wpa2_enabled && !priv->sec_info.wpa2_enabled &&
((!bss_desc->bcn_wpa_ie) || (!bss_desc->bcn_wpa_ie ||
((*(bss_desc->bcn_wpa_ie)). bss_desc->bcn_wpa_ie->vend_hdr.element_id !=
vend_hdr.element_id != WLAN_EID_VENDOR_SPECIFIC)) && WLAN_EID_VENDOR_SPECIFIC) &&
((!bss_desc->bcn_rsn_ie) || (!bss_desc->bcn_rsn_ie ||
((*(bss_desc->bcn_rsn_ie)).ieee_hdr.element_id != WLAN_EID_RSN)) && bss_desc->bcn_rsn_ie->ieee_hdr.element_id != WLAN_EID_RSN) &&
priv->sec_info.encryption_mode && bss_desc->privacy) { priv->sec_info.encryption_mode && bss_desc->privacy) {
mwifiex_dbg(priv->adapter, INFO, mwifiex_dbg(priv->adapter, INFO,
"info: %s: dynamic\t" "info: %s: dynamic\t"
"WEP: wpa_ie=%#x wpa2_ie=%#x\t" "WEP: wpa_ie=%#x wpa2_ie=%#x\t"
"EncMode=%#x privacy=%#x\n", "EncMode=%#x privacy=%#x\n",
__func__, __func__,
(bss_desc->bcn_wpa_ie) ? bss_desc->bcn_wpa_ie ?
(*bss_desc->bcn_wpa_ie). bss_desc->bcn_wpa_ie->vend_hdr.element_id : 0,
vend_hdr.element_id : 0, bss_desc->bcn_rsn_ie ?
(bss_desc->bcn_rsn_ie) ? bss_desc->bcn_rsn_ie->ieee_hdr.element_id : 0,
(*bss_desc->bcn_rsn_ie).
ieee_hdr.element_id : 0,
priv->sec_info.encryption_mode, priv->sec_info.encryption_mode,
bss_desc->privacy); bss_desc->privacy);
return true; return true;
...@@ -464,10 +458,10 @@ mwifiex_is_network_compatible(struct mwifiex_private *priv, ...@@ -464,10 +458,10 @@ mwifiex_is_network_compatible(struct mwifiex_private *priv,
"info: %s: failed: wpa_ie=%#x wpa2_ie=%#x WEP=%s\t" "info: %s: failed: wpa_ie=%#x wpa2_ie=%#x WEP=%s\t"
"WPA=%s WPA2=%s EncMode=%#x privacy=%#x\n", "WPA=%s WPA2=%s EncMode=%#x privacy=%#x\n",
__func__, __func__,
(bss_desc->bcn_wpa_ie) ? bss_desc->bcn_wpa_ie ?
(*bss_desc->bcn_wpa_ie).vend_hdr.element_id : 0, bss_desc->bcn_wpa_ie->vend_hdr.element_id : 0,
(bss_desc->bcn_rsn_ie) ? bss_desc->bcn_rsn_ie ?
(*bss_desc->bcn_rsn_ie).ieee_hdr.element_id : 0, bss_desc->bcn_rsn_ie->ieee_hdr.element_id : 0,
(priv->sec_info.wep_enabled) ? "e" : "d", (priv->sec_info.wep_enabled) ? "e" : "d",
(priv->sec_info.wpa_enabled) ? "e" : "d", (priv->sec_info.wpa_enabled) ? "e" : "d",
(priv->sec_info.wpa2_enabled) ? "e" : "d", (priv->sec_info.wpa2_enabled) ? "e" : "d",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment