From 44367877c6c5048ac352c529c63ce0698c1ddd5c Mon Sep 17 00:00:00 2001 From: Joshua Clayton Date: Wed, 5 Aug 2015 17:17:18 -0700 Subject: [PATCH] staging: rtl8712: remove duplicate struct struct ndis_wlan_bssid_ex is a doppelganger of struct wlan_bssid_ex, and is used about a third as often. Switch all instances to wlan_bssid_ex, and remove ndis_wlan_bssid_ex This also gets rid of a use of typedef NDIS_802_11_RATES_EX Signed-off-by: Joshua Clayton Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8712/rtl871x_cmd.c | 11 ++++----- drivers/staging/rtl8712/rtl871x_event.h | 2 +- drivers/staging/rtl8712/rtl871x_ioctl_linux.c | 10 ++++---- drivers/staging/rtl8712/rtl871x_mlme.c | 23 +++++++++---------- drivers/staging/rtl8712/rtl871x_mlme.h | 2 +- drivers/staging/rtl8712/rtl871x_mp_ioctl.c | 4 ++-- drivers/staging/rtl8712/wlan_bssdef.h | 23 ++----------------- 7 files changed, 26 insertions(+), 49 deletions(-) diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c index f07050ddd82d..06d9844ac722 100644 --- a/drivers/staging/rtl8712/rtl871x_cmd.c +++ b/drivers/staging/rtl8712/rtl871x_cmd.c @@ -456,9 +456,7 @@ u8 r8712_createbss_cmd(struct _adapter *padapter) INIT_LIST_HEAD(&pcmd->list); pcmd->cmdcode = _CreateBss_CMD_; pcmd->parmbuf = (unsigned char *)pdev_network; - pcmd->cmdsz = r8712_get_ndis_wlan_bssid_ex_sz(( - struct ndis_wlan_bssid_ex *) - pdev_network); + pcmd->cmdsz = r8712_get_ndis_wlan_bssid_ex_sz(pdev_network); pcmd->rsp = NULL; pcmd->rspsz = 0; /* notes: translate IELength & Length after assign to cmdsz; */ @@ -471,7 +469,7 @@ u8 r8712_createbss_cmd(struct _adapter *padapter) u8 r8712_joinbss_cmd(struct _adapter *padapter, struct wlan_network *pnetwork) { - struct ndis_wlan_bssid_ex *psecnetwork; + struct wlan_bssid_ex *psecnetwork; struct cmd_obj *pcmd; struct cmd_priv *pcmdpriv = &padapter->cmdpriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; @@ -502,7 +500,7 @@ u8 r8712_joinbss_cmd(struct _adapter *padapter, struct wlan_network *pnetwork) break; } } - psecnetwork = (struct ndis_wlan_bssid_ex *)&psecuritypriv->sec_bss; + psecnetwork = &psecuritypriv->sec_bss; if (psecnetwork == NULL) { kfree(pcmd); return _FAIL; @@ -894,8 +892,7 @@ void r8712_createbss_cmd_callback(struct _adapter *padapter, struct sta_info *psta = NULL; struct wlan_network *pwlan = NULL; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct ndis_wlan_bssid_ex *pnetwork = (struct ndis_wlan_bssid_ex *) - pcmd->parmbuf; + struct wlan_bssid_ex *pnetwork = (struct wlan_bssid_ex *)pcmd->parmbuf; struct wlan_network *tgt_network = &(pmlmepriv->cur_network); if (pcmd->res != H2C_SUCCESS) diff --git a/drivers/staging/rtl8712/rtl871x_event.h b/drivers/staging/rtl8712/rtl871x_event.h index e03ee90d2870..697c8d735150 100644 --- a/drivers/staging/rtl8712/rtl871x_event.h +++ b/drivers/staging/rtl8712/rtl871x_event.h @@ -36,7 +36,7 @@ * Used to report a bss has been scanned */ struct survey_event { - struct ndis_wlan_bssid_ex bss; + struct wlan_bssid_ex bss; }; /* diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c index 3388f971fb48..4f5f69c950cc 100644 --- a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c +++ b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c @@ -634,7 +634,7 @@ static int r8711_wx_get_name(struct net_device *dev, char *p; u8 ht_cap = false; struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); - struct ndis_wlan_bssid_ex *pcur_bss = &pmlmepriv->cur_network.network; + struct wlan_bssid_ex *pcur_bss = &pmlmepriv->cur_network.network; NDIS_802_11_RATES_EX *prates = NULL; if (check_fwstate(pmlmepriv, _FW_LINKED|WIFI_ADHOC_MASTER_STATE) == @@ -723,7 +723,7 @@ static int r8711_wx_get_freq(struct net_device *dev, { struct _adapter *padapter = netdev_priv(dev); struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct ndis_wlan_bssid_ex *pcur_bss = &pmlmepriv->cur_network.network; + struct wlan_bssid_ex *pcur_bss = &pmlmepriv->cur_network.network; if (check_fwstate(pmlmepriv, _FW_LINKED) == true) { wrqu->freq.m = ieee80211_wlan_frequencies[ @@ -1111,7 +1111,7 @@ static int r8711_wx_get_wap(struct net_device *dev, { struct _adapter *padapter = netdev_priv(dev); struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct ndis_wlan_bssid_ex *pcur_bss = &pmlmepriv->cur_network.network; + struct wlan_bssid_ex *pcur_bss = &pmlmepriv->cur_network.network; wrqu->ap_addr.sa_family = ARPHRD_ETHER; if (check_fwstate(pmlmepriv, _FW_LINKED | WIFI_ADHOC_MASTER_STATE | @@ -1327,7 +1327,7 @@ static int r8711_wx_get_essid(struct net_device *dev, { struct _adapter *padapter = netdev_priv(dev); struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct ndis_wlan_bssid_ex *pcur_bss = &pmlmepriv->cur_network.network; + struct wlan_bssid_ex *pcur_bss = &pmlmepriv->cur_network.network; u32 len, ret = 0; if (check_fwstate(pmlmepriv, _FW_LINKED|WIFI_ADHOC_MASTER_STATE)) { @@ -1419,7 +1419,7 @@ static int r8711_wx_get_rate(struct net_device *dev, { struct _adapter *padapter = netdev_priv(dev); struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct ndis_wlan_bssid_ex *pcur_bss = &pmlmepriv->cur_network.network; + struct wlan_bssid_ex *pcur_bss = &pmlmepriv->cur_network.network; struct ieee80211_ht_cap *pht_capie; unsigned char rf_type = padapter->registrypriv.rf_config; int i; diff --git a/drivers/staging/rtl8712/rtl871x_mlme.c b/drivers/staging/rtl8712/rtl871x_mlme.c index 6b3451f7017b..7af96993c6a5 100644 --- a/drivers/staging/rtl8712/rtl871x_mlme.c +++ b/drivers/staging/rtl8712/rtl871x_mlme.c @@ -208,7 +208,7 @@ void r8712_generate_random_ibss(u8 *pibss) pibss[5] = (u8)((curtime>>16) & 0xff); } -uint r8712_get_ndis_wlan_bssid_ex_sz(struct ndis_wlan_bssid_ex *bss) +uint r8712_get_ndis_wlan_bssid_ex_sz(struct wlan_bssid_ex *bss) { return sizeof(*bss) + bss->IELength - MAX_IE_SZ; } @@ -276,8 +276,8 @@ int r8712_is_same_ibss(struct _adapter *adapter, struct wlan_network *pnetwork) } -static int is_same_network(struct ndis_wlan_bssid_ex *src, - struct ndis_wlan_bssid_ex *dst) +static int is_same_network(struct wlan_bssid_ex *src, + struct wlan_bssid_ex *dst) { u16 s_cap, d_cap; @@ -322,8 +322,8 @@ struct wlan_network *r8712_get_oldest_wlan_network( return oldest; } -static void update_network(struct ndis_wlan_bssid_ex *dst, - struct ndis_wlan_bssid_ex *src, +static void update_network(struct wlan_bssid_ex *dst, + struct wlan_bssid_ex *src, struct _adapter *padapter) { u32 last_evm = 0, tmpVal; @@ -360,7 +360,7 @@ static void update_network(struct ndis_wlan_bssid_ex *dst, } static void update_current_network(struct _adapter *adapter, - struct ndis_wlan_bssid_ex *pnetwork) + struct wlan_bssid_ex *pnetwork) { struct mlme_priv *pmlmepriv = &adapter->mlmepriv; @@ -378,7 +378,7 @@ static void update_current_network(struct _adapter *adapter, Caller must hold pmlmepriv->lock first. */ static void update_scanned_network(struct _adapter *adapter, - struct ndis_wlan_bssid_ex *target) + struct wlan_bssid_ex *target) { struct list_head *plist, *phead; @@ -441,7 +441,7 @@ static void update_scanned_network(struct _adapter *adapter, } static void rtl8711_add_network(struct _adapter *adapter, - struct ndis_wlan_bssid_ex *pnetwork) + struct wlan_bssid_ex *pnetwork) { unsigned long irqL; struct mlme_priv *pmlmepriv = &(((struct _adapter *)adapter)->mlmepriv); @@ -497,10 +497,10 @@ void r8712_survey_event_callback(struct _adapter *adapter, u8 *pbuf) { unsigned long flags; u32 len; - struct ndis_wlan_bssid_ex *pnetwork; + struct wlan_bssid_ex *pnetwork; struct mlme_priv *pmlmepriv = &adapter->mlmepriv; - pnetwork = (struct ndis_wlan_bssid_ex *)pbuf; + pnetwork = (struct wlan_bssid_ex *)pbuf; #ifdef __BIG_ENDIAN /* endian_convert */ pnetwork->Length = le32_to_cpu(pnetwork->Length); @@ -1658,8 +1658,7 @@ void r8712_update_registrypriv_dev_network(struct _adapter *adapter) */ sz = r8712_generate_ie(pregistrypriv); pdev_network->IELength = sz; - pdev_network->Length = r8712_get_ndis_wlan_bssid_ex_sz( - (struct ndis_wlan_bssid_ex *)pdev_network); + pdev_network->Length = r8712_get_ndis_wlan_bssid_ex_sz(pdev_network); } /*the function is at passive_level*/ diff --git a/drivers/staging/rtl8712/rtl871x_mlme.h b/drivers/staging/rtl8712/rtl871x_mlme.h index 42bd0bf8a816..47bb9c5e9708 100644 --- a/drivers/staging/rtl8712/rtl871x_mlme.h +++ b/drivers/staging/rtl8712/rtl871x_mlme.h @@ -202,7 +202,7 @@ sint r8712_set_key(struct _adapter *adapter, struct security_priv *psecuritypriv, sint keyid); sint r8712_set_auth(struct _adapter *adapter, struct security_priv *psecuritypriv); -uint r8712_get_ndis_wlan_bssid_ex_sz(struct ndis_wlan_bssid_ex *bss); +uint r8712_get_ndis_wlan_bssid_ex_sz(struct wlan_bssid_ex *bss); void r8712_generate_random_ibss(u8 *pibss); u8 *r8712_get_capability_from_ie(u8 *ie); struct wlan_network *r8712_get_oldest_wlan_network( diff --git a/drivers/staging/rtl8712/rtl871x_mp_ioctl.c b/drivers/staging/rtl8712/rtl871x_mp_ioctl.c index 0b5461208eb9..c77b63affdc5 100644 --- a/drivers/staging/rtl8712/rtl871x_mp_ioctl.c +++ b/drivers/staging/rtl8712/rtl871x_mp_ioctl.c @@ -160,13 +160,13 @@ static int mp_start_test(struct _adapter *padapter) struct mp_priv *pmppriv = &padapter->mppriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct wlan_network *tgt_network = &pmlmepriv->cur_network; - struct ndis_wlan_bssid_ex bssid; + struct wlan_bssid_ex bssid; struct sta_info *psta; unsigned long length; unsigned long irqL; int res = _SUCCESS; - /* 3 1. initialize a new struct ndis_wlan_bssid_ex */ + /* 3 1. initialize a new struct wlan_bssid_ex */ memcpy(bssid.MacAddress, pmppriv->network_macaddr, ETH_ALEN); bssid.Ssid.SsidLength = 16; memcpy(bssid.Ssid.Ssid, (unsigned char *)"mp_pseudo_adhoc", diff --git a/drivers/staging/rtl8712/wlan_bssdef.h b/drivers/staging/rtl8712/wlan_bssdef.h index 8c5d6e7f82d2..cd3e62a20161 100644 --- a/drivers/staging/rtl8712/wlan_bssdef.h +++ b/drivers/staging/rtl8712/wlan_bssdef.h @@ -83,7 +83,7 @@ struct NDIS_802_11_FIXED_IEs { u16 Capabilities; }; -struct ndis_wlan_bssid_ex { +struct wlan_bssid_ex { u32 Length; unsigned char MacAddress[6]; u8 Reserved[2]; @@ -203,7 +203,7 @@ struct wlan_network { unsigned int last_scanned; /*timestamp for the network */ int aid; /*will only be valid when a BSS is joined. */ int join_res; - struct ndis_wlan_bssid_ex network; /*must be the last item */ + struct wlan_bssid_ex network; /*must be the last item */ }; enum VRTL_CARRIER_SENSE { @@ -234,24 +234,5 @@ enum UAPSD_MAX_SP { #define NUM_PRE_AUTH_KEY 16 #define NUM_PMKID_CACHE NUM_PRE_AUTH_KEY -/* - * WPA2 - */ -struct wlan_bssid_ex { - u32 Length; - unsigned char MacAddress[6]; - u8 Reserved[2]; - struct ndis_802_11_ssid Ssid; - u32 Privacy; - s32 Rssi; - enum NDIS_802_11_NETWORK_TYPE NetworkTypeInUse; - struct NDIS_802_11_CONFIGURATION Configuration; - enum NDIS_802_11_NETWORK_INFRASTRUCTURE InfrastructureMode; - NDIS_802_11_RATES_EX SupportedRates; - u32 IELength; - u8 IEs[MAX_IE_SZ]; /* (timestamp, beacon interval, and capability - * information) */ -}; - #endif /* #ifndef WLAN_BSSDEF_H_ */ -- 2.30.2