diff options
Diffstat (limited to 'drivers/staging/rtl8723bs/os_dep')
-rw-r--r-- | drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 16 | ||||
-rw-r--r-- | drivers/staging/rtl8723bs/os_dep/ioctl_linux.c | 45 | ||||
-rw-r--r-- | drivers/staging/rtl8723bs/os_dep/mlme_linux.c | 62 | ||||
-rw-r--r-- | drivers/staging/rtl8723bs/os_dep/os_intfs.c | 243 | ||||
-rw-r--r-- | drivers/staging/rtl8723bs/os_dep/osdep_service.c | 24 | ||||
-rw-r--r-- | drivers/staging/rtl8723bs/os_dep/recv_linux.c | 5 | ||||
-rw-r--r-- | drivers/staging/rtl8723bs/os_dep/rtw_proc.c | 6 |
7 files changed, 171 insertions, 230 deletions
diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c index bd4352fe2de3..51d48de24a24 100644 --- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c @@ -136,11 +136,9 @@ static struct ieee80211_supported_band *rtw_spt_band_alloc( goto exit; } - spt_band = (struct ieee80211_supported_band *)rtw_zmalloc( - sizeof(struct ieee80211_supported_band) - + sizeof(struct ieee80211_channel)*n_channels - + sizeof(struct ieee80211_rate)*n_bitrates - ); + spt_band = rtw_zmalloc(sizeof(struct ieee80211_supported_band) + + sizeof(struct ieee80211_channel) * n_channels + + sizeof(struct ieee80211_rate) * n_bitrates); if (!spt_band) goto exit; @@ -1094,7 +1092,7 @@ static int cfg80211_rtw_add_key(struct wiphy *wiphy, struct net_device *ndev, DBG_871X("pairwise =%d\n", pairwise); param_len = sizeof(struct ieee_param) + params->key_len; - param = (struct ieee_param *)rtw_malloc(param_len); + param = rtw_malloc(param_len); if (param == NULL) return -1; @@ -2183,7 +2181,7 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, struct net_device *ndev, { wep_key_len = wep_key_len <= 5 ? 5 : 13; wep_total_len = wep_key_len + FIELD_OFFSET(struct ndis_802_11_wep, KeyMaterial); - pwep =(struct ndis_802_11_wep *) rtw_malloc(wep_total_len); + pwep = rtw_malloc(wep_total_len); if (pwep == NULL) { DBG_871X(" wpa_set_encryption: pwep allocate fail !!!\n"); ret = -ENOMEM; @@ -2677,7 +2675,7 @@ static int rtw_cfg80211_add_monitor_if (struct adapter *padapter, char *name, st pnpi->sizeof_priv = sizeof(struct adapter); /* wdev */ - mon_wdev = (struct wireless_dev *)rtw_zmalloc(sizeof(struct wireless_dev)); + mon_wdev = rtw_zmalloc(sizeof(struct wireless_dev)); if (!mon_wdev) { DBG_871X(FUNC_ADPT_FMT" allocate mon_wdev fail\n", FUNC_ADPT_ARG(padapter)); ret = -ENOMEM; @@ -3497,7 +3495,7 @@ int rtw_wdev_alloc(struct adapter *padapter, struct device *dev) } /* wdev */ - wdev = (struct wireless_dev *)rtw_zmalloc(sizeof(struct wireless_dev)); + wdev = rtw_zmalloc(sizeof(struct wireless_dev)); if (!wdev) { DBG_8192C("Couldn't allocate wireless device\n"); ret = -ENOMEM; diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c index d5e5f830f2a1..3fca0c2d4c8d 100644 --- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c @@ -18,6 +18,7 @@ #include <rtw_debug.h> #include <rtw_mp.h> #include <linux/jiffies.h> +#include <linux/kernel.h> #define RTL_IOCTL_WPA_SUPPLICANT (SIOCIWFIRSTPRIV+30) @@ -557,7 +558,7 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param, if (wep_key_len > 0) { wep_key_len = wep_key_len <= 5 ? 5 : 13; wep_total_len = wep_key_len + FIELD_OFFSET(struct ndis_802_11_wep, KeyMaterial); - pwep =(struct ndis_802_11_wep *) rtw_malloc(wep_total_len); + pwep = rtw_malloc(wep_total_len); if (pwep == NULL) { RT_TRACE(_module_rtl871x_ioctl_os_c, _drv_err_, (" wpa_set_encryption: pwep allocate fail !!!\n")); goto exit; @@ -2123,12 +2124,9 @@ static int rtw_wx_set_gen_ie(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - int ret; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); - ret = rtw_set_wpa_ie(padapter, extra, wrqu->data.length); - - return ret; + return rtw_set_wpa_ie(padapter, extra, wrqu->data.length); } static int rtw_wx_set_auth(struct net_device *dev, @@ -2238,7 +2236,7 @@ static int rtw_wx_set_enc_ext(struct net_device *dev, int ret = 0; param_len = sizeof(struct ieee_param) + pext->key_len; - param = (struct ieee_param *)rtw_malloc(param_len); + param = rtw_malloc(param_len); if (param == NULL) return -1; @@ -2347,7 +2345,7 @@ static int rtw_wx_read32(struct net_device *dev, if (0 == len) return -EINVAL; - ptmp = (u8 *)rtw_malloc(len); + ptmp = rtw_malloc(len); if (NULL == ptmp) return -ENOMEM; @@ -3500,7 +3498,7 @@ static int wpa_supplicant_ioctl(struct net_device *dev, struct iw_point *p) goto out; } - param = (struct ieee_param *)rtw_malloc(p->length); + param = rtw_malloc(p->length); if (param == NULL) { ret = -ENOMEM; goto out; @@ -3621,7 +3619,7 @@ static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param, if (wep_key_len > 0) { wep_key_len = wep_key_len <= 5 ? 5 : 13; wep_total_len = wep_key_len + FIELD_OFFSET(struct ndis_802_11_wep, KeyMaterial); - pwep =(struct ndis_802_11_wep *)rtw_malloc(wep_total_len); + pwep = rtw_malloc(wep_total_len); if (pwep == NULL) { DBG_871X(" r871x_set_encryption: pwep allocate fail !!!\n"); goto exit; @@ -3857,7 +3855,6 @@ static int rtw_hostapd_sta_flush(struct net_device *dev) { /* _irqL irqL; */ /* struct list_head *phead, *plist; */ - int ret = 0; /* struct sta_info *psta = NULL; */ struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); /* struct sta_priv *pstapriv = &padapter->stapriv; */ @@ -3866,9 +3863,7 @@ static int rtw_hostapd_sta_flush(struct net_device *dev) flush_all_cam_entry(padapter); /* clear CAM */ - ret = rtw_sta_flush(padapter); - - return ret; + return rtw_sta_flush(padapter); } @@ -4266,7 +4261,6 @@ static int rtw_set_hidden_ssid(struct net_device *dev, struct ieee_param *param, static int rtw_ioctl_acl_remove_sta(struct net_device *dev, struct ieee_param *param, int len) { - int ret = 0; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); @@ -4279,15 +4273,12 @@ static int rtw_ioctl_acl_remove_sta(struct net_device *dev, struct ieee_param *p return -EINVAL; } - ret = rtw_acl_remove_sta(padapter, param->sta_addr); - - return ret; + return rtw_acl_remove_sta(padapter, param->sta_addr); } static int rtw_ioctl_acl_add_sta(struct net_device *dev, struct ieee_param *param, int len) { - int ret = 0; struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); @@ -4300,9 +4291,7 @@ static int rtw_ioctl_acl_add_sta(struct net_device *dev, struct ieee_param *para return -EINVAL; } - ret = rtw_acl_add_sta(padapter, param->sta_addr); - - return ret; + return rtw_acl_add_sta(padapter, param->sta_addr); } @@ -4345,7 +4334,7 @@ static int rtw_hostapd_ioctl(struct net_device *dev, struct iw_point *p) goto out; } - param = (struct ieee_param *)rtw_malloc(p->length); + param = rtw_malloc(p->length); if (param == NULL) { ret = -ENOMEM; goto out; @@ -4673,7 +4662,7 @@ static int rtw_test( DBG_871X("+%s\n", __func__); len = wrqu->data.length; - pbuf = (u8 *)rtw_zmalloc(len); + pbuf = rtw_zmalloc(len); if (pbuf == NULL) { DBG_871X("%s: no memory!\n", __func__); return -ENOMEM; @@ -5029,12 +5018,12 @@ static struct iw_statistics *rtw_get_wireless_stats(struct net_device *dev) struct iw_handler_def rtw_handlers_def = { .standard = rtw_handlers, - .num_standard = sizeof(rtw_handlers) / sizeof(iw_handler), + .num_standard = ARRAY_SIZE(rtw_handlers), #if defined(CONFIG_WEXT_PRIV) .private = rtw_private_handler, .private_args = (struct iw_priv_args *)rtw_private_args, - .num_private = sizeof(rtw_private_handler) / sizeof(iw_handler), - .num_private_args = sizeof(rtw_private_args) / sizeof(struct iw_priv_args), + .num_private = ARRAY_SIZE(rtw_private_handler), + .num_private_args = ARRAY_SIZE(rtw_private_args), #endif .get_wireless_stats = rtw_get_wireless_stats, }; @@ -5121,8 +5110,8 @@ static int rtw_ioctl_wext_private(struct net_device *dev, union iwreq_data *wrq_ priv = rtw_private_handler; priv_args = rtw_private_args; - num_priv = sizeof(rtw_private_handler) / sizeof(iw_handler); - num_priv_args = sizeof(rtw_private_args) / sizeof(struct iw_priv_args); + num_priv = ARRAY_SIZE(rtw_private_handler); + num_priv_args = ARRAY_SIZE(rtw_private_args); if (num_priv_args == 0) { err = -EOPNOTSUPP; diff --git a/drivers/staging/rtl8723bs/os_dep/mlme_linux.c b/drivers/staging/rtl8723bs/os_dep/mlme_linux.c index 80ca2d781c5d..a4ef5789d794 100644 --- a/drivers/staging/rtl8723bs/os_dep/mlme_linux.c +++ b/drivers/staging/rtl8723bs/os_dep/mlme_linux.c @@ -19,18 +19,21 @@ #include <drv_types.h> #include <rtw_debug.h> -static void _dynamic_check_timer_handlder (void *FunctionContext) +static void _dynamic_check_timer_handler(struct timer_list *t) { - struct adapter *adapter = FunctionContext; + struct adapter *adapter = + from_timer(adapter, t, mlmepriv.dynamic_chk_timer); - rtw_dynamic_check_timer_handlder(adapter); + rtw_dynamic_check_timer_handler(adapter); _set_timer(&adapter->mlmepriv.dynamic_chk_timer, 2000); } -static void _rtw_set_scan_deny_timer_hdl(void *FunctionContext) +static void _rtw_set_scan_deny_timer_hdl(struct timer_list *t) { - struct adapter *adapter = FunctionContext; + struct adapter *adapter = + from_timer(adapter, t, mlmepriv.set_scan_deny_timer); + rtw_set_scan_deny_timer_hdl(adapter); } @@ -38,21 +41,20 @@ void rtw_init_mlme_timer(struct adapter *padapter) { struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - _init_timer(&(pmlmepriv->assoc_timer), padapter->pnetdev, _rtw_join_timeout_handler, padapter); - /* _init_timer(&(pmlmepriv->sitesurveyctrl.sitesurvey_ctrl_timer), padapter->pnetdev, sitesurvey_ctrl_handler, padapter); */ - _init_timer(&(pmlmepriv->scan_to_timer), padapter->pnetdev, rtw_scan_timeout_handler, padapter); - - _init_timer(&(pmlmepriv->dynamic_chk_timer), padapter->pnetdev, _dynamic_check_timer_handlder, padapter); - - _init_timer(&(pmlmepriv->set_scan_deny_timer), padapter->pnetdev, _rtw_set_scan_deny_timer_hdl, padapter); + timer_setup(&pmlmepriv->assoc_timer, _rtw_join_timeout_handler, 0); + timer_setup(&pmlmepriv->scan_to_timer, rtw_scan_timeout_handler, 0); + timer_setup(&pmlmepriv->dynamic_chk_timer, + _dynamic_check_timer_handler, 0); + timer_setup(&pmlmepriv->set_scan_deny_timer, + _rtw_set_scan_deny_timer_hdl, 0); } void rtw_os_indicate_connect(struct adapter *adapter) { struct mlme_priv *pmlmepriv = &(adapter->mlmepriv); - if ((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) ==true) || - (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) ==true)) + if ((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true) || + (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == true)) { rtw_cfg80211_ibss_indicate_connect(adapter); } @@ -99,7 +101,7 @@ void rtw_reset_securitypriv(struct adapter *adapter) /* reset RX BIP packet number */ pmlmeext->mgnt_80211w_IPN_rx = 0; - memset((unsigned char *)&adapter->securitypriv, 0, sizeof (struct security_priv)); + memset((unsigned char *)&adapter->securitypriv, 0, sizeof(struct security_priv)); /* Added by Albert 2009/02/18 */ /* Restore the PMK information to securitypriv structure for the following connection. */ @@ -116,9 +118,9 @@ void rtw_reset_securitypriv(struct adapter *adapter) { /* if (adapter->mlmepriv.fw_state & WIFI_STATION_STATE) */ /* */ - struct security_priv *psec_priv =&adapter->securitypriv; + struct security_priv *psec_priv = &adapter->securitypriv; - psec_priv->dot11AuthAlgrthm =dot11AuthAlgrthm_Open; /* open system */ + psec_priv->dot11AuthAlgrthm = dot11AuthAlgrthm_Open; /* open system */ psec_priv->dot11PrivacyAlgrthm = _NO_PRIVACY_; psec_priv->dot11PrivacyKeyIndex = 0; @@ -150,7 +152,7 @@ void rtw_os_indicate_disconnect(struct adapter *adapter) void rtw_report_sec_ie(struct adapter *adapter, u8 authmode, u8 *sec_ie) { uint len; - u8 *buff,*p, i; + u8 *buff, *p, i; union iwreq_data wrqu; RT_TRACE(_module_mlme_osdep_c_, _drv_info_, ("+rtw_report_sec_ie, authmode =%d\n", authmode)); @@ -168,22 +170,22 @@ void rtw_report_sec_ie(struct adapter *adapter, u8 authmode, u8 *sec_ie) } p = buff; - p+=sprintf(p,"ASSOCINFO(ReqIEs ="); + p += sprintf(p, "ASSOCINFO(ReqIEs ="); - len = sec_ie[1]+2; - len = (len < IW_CUSTOM_MAX) ? len:IW_CUSTOM_MAX; + len = sec_ie[1] + 2; + len = (len < IW_CUSTOM_MAX) ? len : IW_CUSTOM_MAX; - for (i = 0;i<len;i++) { - p+=sprintf(p,"%02x", sec_ie[i]); + for (i = 0; i < len; i++) { + p += sprintf(p, "%02x", sec_ie[i]); } - p+=sprintf(p,")"); + p += sprintf(p, ")"); memset(&wrqu, 0, sizeof(wrqu)); - wrqu.data.length =p-buff; + wrqu.data.length = p - buff; - wrqu.data.length = (wrqu.data.length<IW_CUSTOM_MAX) ? wrqu.data.length:IW_CUSTOM_MAX; + wrqu.data.length = (wrqu.data.length < IW_CUSTOM_MAX) ? wrqu.data.length : IW_CUSTOM_MAX; kfree(buff); } @@ -191,14 +193,14 @@ void rtw_report_sec_ie(struct adapter *adapter, u8 authmode, u8 *sec_ie) void init_addba_retry_timer(struct adapter *padapter, struct sta_info *psta) { - _init_timer(&psta->addba_retry_timer, padapter->pnetdev, addba_timer_hdl, psta); + timer_setup(&psta->addba_retry_timer, addba_timer_hdl, 0); } void init_mlme_ext_timer(struct adapter *padapter) { struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; - _init_timer(&pmlmeext->survey_timer, padapter->pnetdev, survey_timer_hdl, padapter); - _init_timer(&pmlmeext->link_timer, padapter->pnetdev, link_timer_hdl, padapter); - _init_timer(&pmlmeext->sa_query_timer, padapter->pnetdev, sa_query_timer_hdl, padapter); + timer_setup(&pmlmeext->survey_timer, survey_timer_hdl, 0); + timer_setup(&pmlmeext->link_timer, link_timer_hdl, 0); + timer_setup(&pmlmeext->sa_query_timer, sa_query_timer_hdl, 0); } diff --git a/drivers/staging/rtl8723bs/os_dep/os_intfs.c b/drivers/staging/rtl8723bs/os_dep/os_intfs.c index 021589913681..fc5e3d4739c0 100644 --- a/drivers/staging/rtl8723bs/os_dep/os_intfs.c +++ b/drivers/staging/rtl8723bs/os_dep/os_intfs.c @@ -24,9 +24,9 @@ MODULE_AUTHOR("Realtek Semiconductor Corp."); MODULE_VERSION(DRIVERVERSION); /* module param defaults */ -static int rtw_chip_version = 0x00; +static int rtw_chip_version; static int rtw_rfintfs = HWPI; -static int rtw_lbkmode = 0;/* RTL8712_AIR_TRX; */ +static int rtw_lbkmode;/* RTL8712_AIR_TRX; */ static int rtw_network_mode = Ndis802_11IBSS;/* Ndis802_11Infrastructure;infra, ad-hoc, auto */ @@ -40,12 +40,12 @@ static int rtw_frag_thresh = 2346;/* */ static int rtw_preamble = PREAMBLE_LONG;/* long, short, auto */ static int rtw_scan_mode = 1;/* active, passive */ static int rtw_adhoc_tx_pwr = 1; -static int rtw_soft_ap = 0; +static int rtw_soft_ap; /* int smart_ps = 1; */ static int rtw_power_mgnt = 1; static int rtw_ips_mode = IPS_NORMAL; module_param(rtw_ips_mode, int, 0644); -MODULE_PARM_DESC(rtw_ips_mode,"The default IPS mode"); +MODULE_PARM_DESC(rtw_ips_mode, "The default IPS mode"); static int rtw_smart_ps = 2; @@ -61,18 +61,18 @@ static int rtw_busy_thresh = 40; /* int qos_enable = 0; */ static int rtw_ack_policy = NORMAL_ACK; -static int rtw_software_encrypt = 0; -static int rtw_software_decrypt = 0; +static int rtw_software_encrypt; +static int rtw_software_decrypt; -static int rtw_acm_method = 0;/* 0:By SW 1:By HW. */ +static int rtw_acm_method;/* 0:By SW 1:By HW. */ static int rtw_wmm_enable = 1;/* default is set to enable the wmm. */ -static int rtw_uapsd_enable = 0; +static int rtw_uapsd_enable; static int rtw_uapsd_max_sp = NO_LIMIT; -static int rtw_uapsd_acbk_en = 0; -static int rtw_uapsd_acbe_en = 0; -static int rtw_uapsd_acvi_en = 0; -static int rtw_uapsd_acvo_en = 0; +static int rtw_uapsd_acbk_en; +static int rtw_uapsd_acbe_en; +static int rtw_uapsd_acvi_en; +static int rtw_uapsd_acvo_en; int rtw_ht_enable = 1; /* 0: 20 MHz, 1: 40 MHz, 2: 80 MHz, 3: 160MHz, 4: 80+80MHz */ @@ -81,7 +81,7 @@ int rtw_ht_enable = 1; static int rtw_bw_mode = 0x21; static int rtw_ampdu_enable = 1;/* for enable tx_ampdu ,0: disable, 0x1:enable (but wifi_spec should be 0), 0x2: force enable (don't care wifi_spec) */ static int rtw_rx_stbc = 1;/* 0: disable, 1:enable 2.4g */ -static int rtw_ampdu_amsdu = 0;/* 0: disabled, 1:enabled, 2:auto . There is an IOT issu with DLINK DIR-629 when the flag turn on */ +static int rtw_ampdu_amsdu;/* 0: disabled, 1:enabled, 2:auto . There is an IOT issu with DLINK DIR-629 when the flag turn on */ /* Short GI support Bit Map */ /* BIT0 - 20MHz, 0: non-support, 1: support */ /* BIT1 - 40MHz, 0: non-support, 1: support */ @@ -99,8 +99,8 @@ static int rtw_lowrate_two_xmit = 1;/* Use 2 path Tx to transmit MCS0~7 and lega /* int rf_config = RF_1T2R; 1T2R */ static int rtw_rf_config = RF_MAX_TYPE; /* auto */ -static int rtw_low_power = 0; -static int rtw_wifi_spec = 0; +static int rtw_low_power; +static int rtw_wifi_spec; static int rtw_channel_plan = RT_CHANNEL_DOMAIN_MAX; static int rtw_btcoex_enable = 1; @@ -113,40 +113,38 @@ static int rtw_ant_num = -1; /* <0: undefined, >0: Antenna number */ module_param(rtw_ant_num, int, 0644); MODULE_PARM_DESC(rtw_ant_num, "Antenna number setting"); -static int rtw_AcceptAddbaReq = true;/* 0:Reject AP's Add BA req, 1:Accept AP's Add BA req. */ - static int rtw_antdiv_cfg = 1; /* 0:OFF , 1:ON, 2:decide by Efuse config */ -static int rtw_antdiv_type = 0 ; /* 0:decide by efuse 1: for 88EE, 1Tx and 1RxCG are diversity.(2 Ant with SPDT), 2: for 88EE, 1Tx and 2Rx are diversity.(2 Ant, Tx and RxCG are both on aux port, RxCS is on main port), 3: for 88EE, 1Tx and 1RxCG are fixed.(1Ant, Tx and RxCG are both on aux port) */ +static int rtw_antdiv_type; /* 0:decide by efuse 1: for 88EE, 1Tx and 1RxCG are diversity.(2 Ant with SPDT), 2: for 88EE, 1Tx and 2Rx are diversity.(2 Ant, Tx and RxCG are both on aux port, RxCS is on main port), 3: for 88EE, 1Tx and 1RxCG are fixed.(1Ant, Tx and RxCG are both on aux port) */ -static int rtw_enusbss = 0;/* 0:disable, 1:enable */ +static int rtw_enusbss;/* 0:disable, 1:enable */ -static int rtw_hwpdn_mode =2;/* 0:disable, 1:enable, 2: by EFUSE config */ +static int rtw_hwpdn_mode = 2;/* 0:disable, 1:enable, 2: by EFUSE config */ #ifdef CONFIG_HW_PWRP_DETECTION static int rtw_hwpwrp_detect = 1; #else -static int rtw_hwpwrp_detect = 0; /* HW power ping detect 0:disable , 1:enable */ +static int rtw_hwpwrp_detect; /* HW power ping detect 0:disable , 1:enable */ #endif -static int rtw_hw_wps_pbc = 0; +static int rtw_hw_wps_pbc; int rtw_mc2u_disable = 0; -static int rtw_80211d = 0; +static int rtw_80211d; #ifdef CONFIG_QOS_OPTIMIZATION static int rtw_qos_opt_enable = 1;/* 0: disable, 1:enable */ #else -static int rtw_qos_opt_enable = 0;/* 0: disable, 1:enable */ +static int rtw_qos_opt_enable;/* 0: disable, 1:enable */ #endif module_param(rtw_qos_opt_enable, int, 0644); -static char* ifname = "wlan%d"; +static char *ifname = "wlan%d"; module_param(ifname, charp, 0644); MODULE_PARM_DESC(ifname, "The default name to allocate for first interface"); -char* rtw_initmac = NULL; /* temp mac address if users want to use instead of the mac address in Efuse */ +char *rtw_initmac = NULL; /* temp mac address if users want to use instead of the mac address in Efuse */ module_param(rtw_initmac, charp, 0644); module_param(rtw_channel_plan, int, 0644); @@ -183,16 +181,16 @@ module_param(rtw_hwpwrp_detect, int, 0644); module_param(rtw_hw_wps_pbc, int, 0644); -static uint rtw_max_roaming_times =2; +static uint rtw_max_roaming_times = 2; module_param(rtw_max_roaming_times, uint, 0644); -MODULE_PARM_DESC(rtw_max_roaming_times,"The max roaming times to try"); +MODULE_PARM_DESC(rtw_max_roaming_times, "The max roaming times to try"); module_param(rtw_mc2u_disable, int, 0644); module_param(rtw_80211d, int, 0644); MODULE_PARM_DESC(rtw_80211d, "Enable 802.11d mechanism"); -static uint rtw_notch_filter = 0; +static uint rtw_notch_filter; module_param(rtw_notch_filter, uint, 0644); MODULE_PARM_DESC(rtw_notch_filter, "0:Disable, 1:Enable, 2:Enable only for P2P"); @@ -202,14 +200,14 @@ static uint rtw_hiq_filter = CONFIG_RTW_HIQ_FILTER; module_param(rtw_hiq_filter, uint, 0644); MODULE_PARM_DESC(rtw_hiq_filter, "0:allow all, 1:allow special, 2:deny all"); -static int rtw_tx_pwr_lmt_enable = 0; -static int rtw_tx_pwr_by_rate = 0; +static int rtw_tx_pwr_lmt_enable; +static int rtw_tx_pwr_by_rate; module_param(rtw_tx_pwr_lmt_enable, int, 0644); -MODULE_PARM_DESC(rtw_tx_pwr_lmt_enable,"0:Disable, 1:Enable, 2: Depend on efuse"); +MODULE_PARM_DESC(rtw_tx_pwr_lmt_enable, "0:Disable, 1:Enable, 2: Depend on efuse"); module_param(rtw_tx_pwr_by_rate, int, 0644); -MODULE_PARM_DESC(rtw_tx_pwr_by_rate,"0:Disable, 1:Enable, 2: Depend on efuse"); +MODULE_PARM_DESC(rtw_tx_pwr_by_rate, "0:Disable, 1:Enable, 2: Depend on efuse"); char *rtw_phy_file_path = ""; module_param(rtw_phy_file_path, charp, 0644); @@ -222,12 +220,12 @@ MODULE_PARM_DESC(rtw_phy_file_path, "The path of phy parameter"); /* BIT4 - RF, 0: non-support, 1: support */ /* BIT5 - RF_TXPWR_TRACK, 0: non-support, 1: support */ /* BIT6 - RF_TXPWR_LMT, 0: non-support, 1: support */ -static int rtw_load_phy_file = (BIT2|BIT6); +static int rtw_load_phy_file = (BIT2 | BIT6); module_param(rtw_load_phy_file, int, 0644); -MODULE_PARM_DESC(rtw_load_phy_file,"PHY File Bit Map"); -static int rtw_decrypt_phy_file = 0; +MODULE_PARM_DESC(rtw_load_phy_file, "PHY File Bit Map"); +static int rtw_decrypt_phy_file; module_param(rtw_decrypt_phy_file, int, 0644); -MODULE_PARM_DESC(rtw_decrypt_phy_file,"Enable Decrypt PHY File"); +MODULE_PARM_DESC(rtw_decrypt_phy_file, "Enable Decrypt PHY File"); int _netdev_open(struct net_device *pnetdev); int netdev_open (struct net_device *pnetdev); @@ -255,8 +253,8 @@ static uint loadparam(struct adapter *padapter, _nic_hdl pnetdev) registry_par->vrtl_carrier_sense = (u8)rtw_vrtl_carrier_sense ; registry_par->vcs_type = (u8)rtw_vcs_type; - registry_par->rts_thresh =(u16)rtw_rts_thresh; - registry_par->frag_thresh =(u16)rtw_frag_thresh; + registry_par->rts_thresh = (u16)rtw_rts_thresh; + registry_par->frag_thresh = (u16)rtw_frag_thresh; registry_par->preamble = (u8)rtw_preamble; registry_par->scan_mode = (u8)rtw_scan_mode; registry_par->adhoc_tx_pwr = (u8)rtw_adhoc_tx_pwr; @@ -311,7 +309,7 @@ static uint loadparam(struct adapter *padapter, _nic_hdl pnetdev) registry_par->bt_ampdu = (u8)rtw_bt_ampdu; registry_par->ant_num = (s8)rtw_ant_num; - registry_par->bAcceptAddbaReq = (u8)rtw_AcceptAddbaReq; + registry_par->accept_addba_req = true; registry_par->antdiv_cfg = (u8)rtw_antdiv_cfg; registry_par->antdiv_type = (u8)rtw_antdiv_type; @@ -351,8 +349,7 @@ static int rtw_net_set_mac_address(struct net_device *pnetdev, void *p) struct adapter *padapter = (struct adapter *)rtw_netdev_priv(pnetdev); struct sockaddr *addr = p; - if (padapter->bup == false) - { + if (padapter->bup == false) { /* DBG_871X("r8711_net_set_mac_address(), MAC =%x:%x:%x:%x:%x:%x\n", addr->sa_data[0], addr->sa_data[1], addr->sa_data[2], addr->sa_data[3], */ /* addr->sa_data[4], addr->sa_data[5]); */ memcpy(padapter->eeprompriv.mac_addr, addr->sa_data, ETH_ALEN); @@ -425,9 +422,7 @@ static u16 rtw_select_queue(struct net_device *dev, struct sk_buff *skb skb->priority = rtw_classify8021d(skb); if (pmlmepriv->acm_mask != 0) - { skb->priority = qos_acm(pmlmepriv->acm_mask, skb->priority); - } return rtw_1d_to_queue[skb->priority]; } @@ -440,12 +435,12 @@ u16 rtw_recv_select_queue(struct sk_buff *skb) u32 priority; u8 *pdata = skb->data; - memcpy(ð_type, pdata+(ETH_ALEN<<1), 2); + memcpy(ð_type, pdata + (ETH_ALEN << 1), 2); switch (be16_to_cpu(eth_type)) { case ETH_P_IP: - piphdr = (struct iphdr *)(pdata+ETH_HLEN); + piphdr = (struct iphdr *)(pdata + ETH_HLEN); dscp = piphdr->tos & 0xfc; @@ -457,17 +452,16 @@ u16 rtw_recv_select_queue(struct sk_buff *skb) } return rtw_1d_to_queue[priority]; - } -static int rtw_ndev_notifier_call(struct notifier_block * nb, unsigned long state, void *ptr) +static int rtw_ndev_notifier_call(struct notifier_block *nb, unsigned long state, void *ptr) { struct net_device *dev = netdev_notifier_info_to_dev(ptr); if (dev->netdev_ops->ndo_do_ioctl != rtw_ioctl) return NOTIFY_DONE; - DBG_871X_LEVEL(_drv_info_, FUNC_NDEV_FMT" state:%lu\n", FUNC_NDEV_ARG(dev), state); + DBG_871X_LEVEL(_drv_info_, FUNC_NDEV_FMT " state:%lu\n", FUNC_NDEV_ARG(dev), state); switch (state) { case NETDEV_CHANGENAME: @@ -497,7 +491,7 @@ static int rtw_ndev_init(struct net_device *dev) { struct adapter *adapter = rtw_netdev_priv(dev); - DBG_871X_LEVEL(_drv_always_, FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(adapter)); + DBG_871X_LEVEL(_drv_always_, FUNC_ADPT_FMT "\n", FUNC_ADPT_ARG(adapter)); strncpy(adapter->old_ifname, dev->name, IFNAMSIZ); rtw_adapter_proc_init(dev); @@ -508,7 +502,7 @@ static void rtw_ndev_uninit(struct net_device *dev) { struct adapter *adapter = rtw_netdev_priv(dev); - DBG_871X_LEVEL(_drv_always_, FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(adapter)); + DBG_871X_LEVEL(_drv_always_, FUNC_ADPT_FMT "\n", FUNC_ADPT_ARG(adapter)); rtw_adapter_proc_deinit(dev); } @@ -561,7 +555,7 @@ struct net_device *rtw_init_netdev(struct adapter *old_padapter) pnetdev->netdev_ops = &rtw_netdev_ops; /* pnetdev->tx_timeout = NULL; */ - pnetdev->watchdog_timeo = HZ*3; /* 3 second timeout */ + pnetdev->watchdog_timeo = HZ * 3; /* 3 second timeout */ pnetdev->wireless_handlers = (struct iw_handler_def *)&rtw_handlers_def; /* step 2. */ @@ -597,7 +591,7 @@ u32 rtw_start_drv_threads(struct adapter *padapter) _status = _FAIL; padapter->cmdThread = kthread_run(rtw_cmd_thread, padapter, "RTW_CMD_THREAD"); - if (IS_ERR(padapter->cmdThread)) + if (IS_ERR(padapter->cmdThread)) _status = _FAIL; else down(&padapter->cmdpriv.terminate_cmdthread_sema); /* wait for cmd_thread to run */ @@ -623,7 +617,7 @@ void rtw_stop_drv_threads (struct adapter *padapter) static u8 rtw_init_default_value(struct adapter *padapter) { u8 ret = _SUCCESS; - struct registry_priv* pregistrypriv = &padapter->registrypriv; + struct registry_priv *pregistrypriv = &padapter->registrypriv; struct xmit_priv *pxmitpriv = &padapter->xmitpriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct security_priv *psecuritypriv = &padapter->securitypriv; @@ -652,8 +646,8 @@ static u8 rtw_init_default_value(struct adapter *padapter) #ifdef CONFIG_GTK_OL psecuritypriv->binstallKCK_KEK = _FAIL; #endif /* CONFIG_GTK_OL */ - psecuritypriv->sw_encrypt =pregistrypriv->software_encrypt; - psecuritypriv->sw_decrypt =pregistrypriv->software_decrypt; + psecuritypriv->sw_encrypt = pregistrypriv->software_encrypt; + psecuritypriv->sw_decrypt = pregistrypriv->software_decrypt; psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Open; /* open system */ psecuritypriv->dot11PrivacyAlgrthm = _NO_PRIVACY_; @@ -691,7 +685,8 @@ struct dvobj_priv *devobj_init(void) { struct dvobj_priv *pdvobj = NULL; - if ((pdvobj = (struct dvobj_priv*)rtw_zmalloc(sizeof(*pdvobj))) == NULL) + pdvobj = rtw_zmalloc(sizeof(*pdvobj)); + if (pdvobj == NULL) return NULL; mutex_init(&pdvobj->hw_init_mutex); @@ -722,7 +717,7 @@ void devobj_deinit(struct dvobj_priv *pdvobj) mutex_destroy(&pdvobj->setch_mutex); mutex_destroy(&pdvobj->setbw_mutex); - kfree((u8 *)pdvobj); + kfree(pdvobj); } u8 rtw_reset_drv_sw(struct adapter *padapter) @@ -748,7 +743,7 @@ u8 rtw_reset_drv_sw(struct adapter *padapter) pmlmepriv->LinkDetectInfo.TrafficTransitionCount = 0; pmlmepriv->LinkDetectInfo.LowPowerTransitionCount = 0; - _clr_fwstate_(pmlmepriv, _FW_UNDER_SURVEY |_FW_UNDER_LINKING); + _clr_fwstate_(pmlmepriv, _FW_UNDER_SURVEY | _FW_UNDER_LINKING); pwrctrlpriv->pwr_state_check_cnts = 0; @@ -777,7 +772,7 @@ u8 rtw_init_drv_sw(struct adapter *padapter) goto exit; } - padapter->cmdpriv.padapter =padapter; + padapter->cmdpriv.padapter = padapter; if ((rtw_init_evt_priv(&padapter->evtpriv)) == _FAIL) { RT_TRACE(_module_os_intfs_c_, _drv_err_, ("\n Can't init evt_priv\n")); @@ -935,7 +930,7 @@ static int _rtw_drv_register_netdev(struct adapter *padapter, char *name) goto error_register_netdev; } - DBG_871X("%s, MAC Address (if%d) = " MAC_FMT "\n", __func__, (padapter->iface_id+1), MAC_ARG(pnetdev->dev_addr)); + DBG_871X("%s, MAC Address (if%d) = " MAC_FMT "\n", __func__, (padapter->iface_id + 1), MAC_ARG(pnetdev->dev_addr)); return ret; @@ -984,9 +979,9 @@ int _netdev_open(struct net_device *pnetdev) goto netdev_open_error; } - DBG_871X("MAC Address = "MAC_FMT"\n", MAC_ARG(pnetdev->dev_addr)); + DBG_871X("MAC Address = " MAC_FMT "\n", MAC_ARG(pnetdev->dev_addr)); - status =rtw_start_drv_threads(padapter); + status = rtw_start_drv_threads(padapter); if (status == _FAIL) { DBG_871X("Initialize driver software resource Failed!\n"); goto netdev_open_error; @@ -1027,7 +1022,6 @@ netdev_open_error: DBG_871X("-871x_drv - drv_open fail, bup =%d\n", padapter->bup); return (-1); - } int netdev_open(struct net_device *pnetdev) @@ -1036,8 +1030,7 @@ int netdev_open(struct net_device *pnetdev) struct adapter *padapter = (struct adapter *)rtw_netdev_priv(pnetdev); struct pwrctrl_priv *pwrctrlpriv = adapter_to_pwrctl(padapter); - if (pwrctrlpriv->bInSuspend == true) - { + if (pwrctrlpriv->bInSuspend == true) { DBG_871X("+871x_drv - drv_open, bInSuspend =%d\n", pwrctrlpriv->bInSuspend); return 0; } @@ -1066,16 +1059,13 @@ static int ips_netdrv_open(struct adapter *padapter) /* padapter->bup = true; */ status = rtw_hal_init(padapter); - if (status == _FAIL) - { + if (status == _FAIL) { RT_TRACE(_module_os_intfs_c_, _drv_err_, ("ips_netdrv_open(): Can't init h/w!\n")); goto netdev_open_error; } if (padapter->intf_start) - { padapter->intf_start(padapter); - } _set_timer(&padapter->mlmepriv.dynamic_chk_timer, 2000); @@ -1098,7 +1088,6 @@ int rtw_ips_pwr_up(struct adapter *padapter) DBG_871X("<=== rtw_ips_pwr_up..............\n"); return result; - } void rtw_ips_pwr_down(struct adapter *padapter) @@ -1119,10 +1108,7 @@ void rtw_ips_dev_unload(struct adapter *padapter) if (padapter->bSurpriseRemoved == false) - { rtw_hal_deinit(padapter); - } - } @@ -1132,15 +1118,14 @@ static int pm_netdev_open(struct net_device *pnetdev, u8 bnormal) struct adapter *padapter = (struct adapter *)rtw_netdev_priv(pnetdev); - if (true == bnormal) - { + if (true == bnormal) { if (mutex_lock_interruptible(&(adapter_to_dvobj(padapter)->hw_init_mutex)) == 0) { status = _netdev_open(pnetdev); mutex_unlock(&(adapter_to_dvobj(padapter)->hw_init_mutex)); } } else - status = (_SUCCESS == ips_netdrv_open(padapter))?(0):(-1); + status = (_SUCCESS == ips_netdrv_open(padapter)) ? (0) : (-1); return status; } @@ -1152,8 +1137,7 @@ static int netdev_close(struct net_device *pnetdev) RT_TRACE(_module_os_intfs_c_, _drv_info_, ("+871x_drv - drv_close\n")); - if (pwrctl->bInternalAutoSuspend == true) - { + if (pwrctl->bInternalAutoSuspend == true) { /* rtw_pwr_wakeup(padapter); */ if (pwrctl->rf_pwrstate == rf_off) pwrctl->ps_flag = true; @@ -1174,8 +1158,7 @@ static int netdev_close(struct net_device *pnetdev) DBG_871X("(2)871x_drv - drv_close, bup =%d, hw_init_completed =%d\n", padapter->bup, padapter->hw_init_completed); /* s1. */ - if (pnetdev) - { + if (pnetdev) { if (!rtw_netif_queue_stopped(pnetdev)) rtw_netif_stop_queue(pnetdev); } @@ -1198,12 +1181,11 @@ static int netdev_close(struct net_device *pnetdev) DBG_871X("-871x_drv - drv_close, bup =%d\n", padapter->bup); return 0; - } void rtw_ndev_destructor(struct net_device *ndev) { - DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); + DBG_871X(FUNC_NDEV_FMT "\n", FUNC_NDEV_ARG(ndev)); if (ndev->ieee80211_ptr) kfree((u8 *)ndev->ieee80211_ptr); @@ -1219,8 +1201,7 @@ void rtw_dev_unload(struct adapter *padapter) RT_TRACE(_module_hci_intfs_c_, _drv_notice_, ("+%s\n", __func__)); - if (padapter->bup == true) - { + if (padapter->bup == true) { DBG_871X("===> %s\n", __func__); padapter->bDriverStopped = true; @@ -1257,12 +1238,11 @@ void rtw_dev_unload(struct adapter *padapter) DBG_871X_LEVEL(_drv_always_, "%s: driver not in IPS\n", __func__); } - if (padapter->bSurpriseRemoved == false) - { + if (padapter->bSurpriseRemoved == false) { rtw_btcoex_IpsNotify(padapter, pwrctl->ips_mode_req); #ifdef CONFIG_WOWLAN if (pwrctl->bSupportRemoteWakeup == true && - pwrctl->wowlan_mode ==true) { + pwrctl->wowlan_mode == true) { DBG_871X_LEVEL(_drv_always_, "%s bSupportRemoteWakeup ==true do not run rtw_hal_deinit()\n", __func__); } else @@ -1292,12 +1272,11 @@ static int rtw_suspend_free_assoc_resource(struct adapter *padapter) { struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - DBG_871X("==> "FUNC_ADPT_FMT" entry....\n", FUNC_ADPT_ARG(padapter)); + DBG_871X("==> " FUNC_ADPT_FMT " entry....\n", FUNC_ADPT_ARG(padapter)); if (rtw_chk_roam_flags(padapter, RTW_ROAM_ON_RESUME)) { if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) - && check_fwstate(pmlmepriv, _FW_LINKED)) - { + && check_fwstate(pmlmepriv, _FW_LINKED)) { DBG_871X("%s %s(" MAC_FMT "), length:%d assoc_ssid.length:%d\n", __func__, pmlmepriv->cur_network.network.Ssid.Ssid, MAC_ARG(pmlmepriv->cur_network.network.MacAddress), @@ -1307,14 +1286,12 @@ static int rtw_suspend_free_assoc_resource(struct adapter *padapter) } } - if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) && check_fwstate(pmlmepriv, _FW_LINKED)) - { + if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) && check_fwstate(pmlmepriv, _FW_LINKED)) { rtw_disassoc_cmd(padapter, 0, false); /* s2-2. indicate disconnect to os */ rtw_indicate_disconnect(padapter); } - else if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) - { + else if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) { rtw_sta_flush(padapter); } @@ -1327,13 +1304,12 @@ static int rtw_suspend_free_assoc_resource(struct adapter *padapter) if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY)) rtw_indicate_scan_done(padapter, 1); - if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING) == true) - { + if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING) == true) { DBG_871X_LEVEL(_drv_always_, "%s: fw_under_linking\n", __func__); rtw_indicate_disconnect(padapter); } - DBG_871X("<== "FUNC_ADPT_FMT" exit....\n", FUNC_ADPT_ARG(padapter)); + DBG_871X("<== " FUNC_ADPT_FMT " exit....\n", FUNC_ADPT_ARG(padapter)); return _SUCCESS; } @@ -1347,7 +1323,7 @@ int rtw_suspend_wow(struct adapter *padapter) struct wowlan_ioctl_param poidparam; int ret = _SUCCESS; - DBG_871X("==> "FUNC_ADPT_FMT" entry....\n", FUNC_ADPT_ARG(padapter)); + DBG_871X("==> " FUNC_ADPT_FMT " entry....\n", FUNC_ADPT_ARG(padapter)); DBG_871X("wowlan_mode: %d\n", pwrpriv->wowlan_mode); @@ -1379,8 +1355,7 @@ int rtw_suspend_wow(struct adapter *padapter) padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_WOWLAN, (u8 *)&poidparam); if (rtw_chk_roam_flags(padapter, RTW_ROAM_ON_RESUME)) { if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) - && check_fwstate(pmlmepriv, _FW_LINKED)) - { + && check_fwstate(pmlmepriv, _FW_LINKED)) { DBG_871X("%s %s(" MAC_FMT "), length:%d assoc_ssid.length:%d\n", __func__, pmlmepriv->cur_network.network.Ssid.Ssid, MAC_ARG(pmlmepriv->cur_network.network.MacAddress), @@ -1393,15 +1368,14 @@ int rtw_suspend_wow(struct adapter *padapter) DBG_871X_LEVEL(_drv_always_, "%s: wowmode suspending\n", __func__); - if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) == true) - { + if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY) == true) { DBG_871X_LEVEL(_drv_always_, "%s: fw_under_survey\n", __func__); rtw_indicate_scan_done(padapter, 1); clr_fwstate(pmlmepriv, _FW_UNDER_SURVEY); } if (rtw_get_ch_setting_union(padapter, &ch, &bw, &offset) != 0) { - DBG_871X(FUNC_ADPT_FMT" back to linked/linking union - ch:%u, bw:%u, offset:%u\n", + DBG_871X(FUNC_ADPT_FMT " back to linked/linking union - ch:%u, bw:%u, offset:%u\n", FUNC_ADPT_ARG(padapter), ch, bw, offset); set_channel_bwmode(padapter, ch, offset, bw); } @@ -1410,13 +1384,11 @@ int rtw_suspend_wow(struct adapter *padapter) DBG_871X_LEVEL(_drv_always_, "%s: pno: %d\n", __func__, pwrpriv->wowlan_pno_enable); else rtw_set_ps_mode(padapter, PS_MODE_DTIM, 0, 0, "WOWLAN"); - } - else - { + else { DBG_871X_LEVEL(_drv_always_, "%s: ### ERROR ### wowlan_mode =%d\n", __func__, pwrpriv->wowlan_mode); } - DBG_871X("<== "FUNC_ADPT_FMT" exit....\n", FUNC_ADPT_ARG(padapter)); + DBG_871X("<== " FUNC_ADPT_FMT " exit....\n", FUNC_ADPT_ARG(padapter)); return ret; } #endif /* ifdef CONFIG_WOWLAN */ @@ -1430,7 +1402,7 @@ int rtw_suspend_ap_wow(struct adapter *padapter) struct wowlan_ioctl_param poidparam; int ret = _SUCCESS; - DBG_871X("==> "FUNC_ADPT_FMT" entry....\n", FUNC_ADPT_ARG(padapter)); + DBG_871X("==> " FUNC_ADPT_FMT " entry....\n", FUNC_ADPT_ARG(padapter)); pwrpriv->wowlan_ap_mode = true; @@ -1462,14 +1434,14 @@ int rtw_suspend_ap_wow(struct adapter *padapter) DBG_871X_LEVEL(_drv_always_, "%s: wowmode suspending\n", __func__); if (rtw_get_ch_setting_union(padapter, &ch, &bw, &offset) != 0) { - DBG_871X(FUNC_ADPT_FMT" back to linked/linking union - ch:%u, bw:%u, offset:%u\n", + DBG_871X(FUNC_ADPT_FMT " back to linked/linking union - ch:%u, bw:%u, offset:%u\n", FUNC_ADPT_ARG(padapter), ch, bw, offset); set_channel_bwmode(padapter, ch, offset, bw); } rtw_set_ps_mode(padapter, PS_MODE_MIN, 0, 0, "AP-WOWLAN"); - DBG_871X("<== "FUNC_ADPT_FMT" exit....\n", FUNC_ADPT_ARG(padapter)); + DBG_871X("<== " FUNC_ADPT_FMT " exit....\n", FUNC_ADPT_ARG(padapter)); return ret; } #endif /* ifdef CONFIG_AP_WOWLAN */ @@ -1480,7 +1452,7 @@ static int rtw_suspend_normal(struct adapter *padapter) struct net_device *pnetdev = padapter->pnetdev; int ret = _SUCCESS; - DBG_871X("==> "FUNC_ADPT_FMT" entry....\n", FUNC_ADPT_ARG(padapter)); + DBG_871X("==> " FUNC_ADPT_FMT " entry....\n", FUNC_ADPT_ARG(padapter)); if (pnetdev) { netif_carrier_off(pnetdev); rtw_netif_stop_queue(pnetdev); @@ -1489,10 +1461,8 @@ static int rtw_suspend_normal(struct adapter *padapter) rtw_suspend_free_assoc_resource(padapter); if ((rtw_hal_check_ips_status(padapter) == true) - || (adapter_to_pwrctl(padapter)->rf_pwrstate == rf_off)) - { + || (adapter_to_pwrctl(padapter)->rf_pwrstate == rf_off)) { DBG_871X_LEVEL(_drv_always_, "%s: ### ERROR #### driver in IPS ####ERROR###!!!\n", __func__); - } rtw_dev_unload(padapter); @@ -1501,7 +1471,7 @@ static int rtw_suspend_normal(struct adapter *padapter) if (padapter->intf_deinit) padapter->intf_deinit(adapter_to_dvobj(padapter)); - DBG_871X("<== "FUNC_ADPT_FMT" exit....\n", FUNC_ADPT_ARG(padapter)); + DBG_871X("<== " FUNC_ADPT_FMT " exit....\n", FUNC_ADPT_ARG(padapter)); return ret; } @@ -1524,8 +1494,7 @@ int rtw_suspend_common(struct adapter *padapter) while (pwrpriv->bips_processing == true) msleep(1); - if ((!padapter->bup) || (padapter->bDriverStopped)||(padapter->bSurpriseRemoved)) - { + if ((!padapter->bup) || (padapter->bDriverStopped) || (padapter->bSurpriseRemoved)) { DBG_871X("%s bup =%d bDriverStopped =%d bSurpriseRemoved = %d\n", __func__ , padapter->bup, padapter->bDriverStopped, padapter->bSurpriseRemoved); pdbgpriv->dbg_suspend_error_cnt++; @@ -1599,7 +1568,7 @@ int rtw_resume_process_wow(struct adapter *padapter) struct sta_info *psta = NULL; int ret = _SUCCESS; - DBG_871X("==> "FUNC_ADPT_FMT" entry....\n", FUNC_ADPT_ARG(padapter)); + DBG_871X("==> " FUNC_ADPT_FMT " entry....\n", FUNC_ADPT_ARG(padapter)); if (padapter) { pnetdev = padapter->pnetdev; @@ -1641,7 +1610,7 @@ int rtw_resume_process_wow(struct adapter *padapter) } /* Disable WOW, set H2C command */ - poidparam.subcode =WOWLAN_DISABLE; + poidparam.subcode = WOWLAN_DISABLE; padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_WOWLAN, (u8 *)&poidparam); psta = rtw_get_stainfo(&padapter->stapriv, get_bssid(&padapter->mlmepriv)); @@ -1667,11 +1636,10 @@ int rtw_resume_process_wow(struct adapter *padapter) } } else { - DBG_871X_LEVEL(_drv_always_, "%s: ### ERROR ### wowlan_mode =%d\n", __func__, pwrpriv->wowlan_mode); } - if (padapter->pid[1]!= 0) { + if (padapter->pid[1] != 0) { DBG_871X("pid[1]:%d\n", padapter->pid[1]); rtw_signal_process(padapter->pid[1], SIGUSR2); } @@ -1680,7 +1648,6 @@ int rtw_resume_process_wow(struct adapter *padapter) if (pwrpriv->wowlan_wake_reason == FWDecisionDisconnect || pwrpriv->wowlan_wake_reason == Rx_DisAssoc || pwrpriv->wowlan_wake_reason == Rx_DeAuth) { - DBG_871X("%s: disconnect reason: %02x\n", __func__, pwrpriv->wowlan_wake_reason); rtw_indicate_disconnect(padapter); @@ -1705,12 +1672,12 @@ int rtw_resume_process_wow(struct adapter *padapter) DBG_871X_LEVEL(_drv_always_, "do not reset timer\n"); } - pwrpriv->wowlan_mode =false; + pwrpriv->wowlan_mode = false; /* clean driver side wake up reason. */ pwrpriv->wowlan_wake_reason = 0; exit: - DBG_871X("<== "FUNC_ADPT_FMT" exit....\n", FUNC_ADPT_ARG(padapter)); + DBG_871X("<== " FUNC_ADPT_FMT " exit....\n", FUNC_ADPT_ARG(padapter)); return ret; } #endif /* ifdef CONFIG_WOWLAN */ @@ -1725,7 +1692,7 @@ int rtw_resume_process_ap_wow(struct adapter *padapter) struct wowlan_ioctl_param poidparam; int ret = _SUCCESS; - DBG_871X("==> "FUNC_ADPT_FMT" entry....\n", FUNC_ADPT_ARG(padapter)); + DBG_871X("==> " FUNC_ADPT_FMT " entry....\n", FUNC_ADPT_ARG(padapter)); if (padapter) { pnetdev = padapter->pnetdev; @@ -1774,7 +1741,7 @@ int rtw_resume_process_ap_wow(struct adapter *padapter) rtw_netif_wake_queue(pnetdev); } - if (padapter->pid[1]!= 0) { + if (padapter->pid[1] != 0) { DBG_871X("pid[1]:%d\n", padapter->pid[1]); rtw_signal_process(padapter->pid[1], SIGUSR2); } @@ -1785,7 +1752,7 @@ int rtw_resume_process_ap_wow(struct adapter *padapter) /* clean driver side wake up reason. */ pwrpriv->wowlan_wake_reason = 0; exit: - DBG_871X("<== "FUNC_ADPT_FMT" exit....\n", FUNC_ADPT_ARG(padapter)); + DBG_871X("<== " FUNC_ADPT_FMT " exit....\n", FUNC_ADPT_ARG(padapter)); return ret; } #endif /* ifdef CONFIG_APWOWLAN */ @@ -1811,19 +1778,17 @@ static int rtw_resume_process_normal(struct adapter *padapter) psdpriv = padapter->dvobj; pdbgpriv = &psdpriv->drv_dbg; - DBG_871X("==> "FUNC_ADPT_FMT" entry....\n", FUNC_ADPT_ARG(padapter)); + DBG_871X("==> " FUNC_ADPT_FMT " entry....\n", FUNC_ADPT_ARG(padapter)); /* interface init */ /* if (sdio_init(adapter_to_dvobj(padapter)) != _SUCCESS) */ - if ((padapter->intf_init) && (padapter->intf_init(adapter_to_dvobj(padapter)) != _SUCCESS)) - { + if ((padapter->intf_init) && (padapter->intf_init(adapter_to_dvobj(padapter)) != _SUCCESS)) { ret = -1; RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("%s: initialize SDIO Failed!!\n", __func__)); goto exit; } rtw_hal_disable_interrupt(padapter); /* if (sdio_alloc_irq(adapter_to_dvobj(padapter)) != _SUCCESS) */ - if ((padapter->intf_alloc_irq) && (padapter->intf_alloc_irq(adapter_to_dvobj(padapter)) != _SUCCESS)) - { + if ((padapter->intf_alloc_irq) && (padapter->intf_alloc_irq(adapter_to_dvobj(padapter)) != _SUCCESS)) { ret = -1; RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("%s: sdio_alloc_irq Failed!!\n", __func__)); goto exit; @@ -1842,28 +1807,28 @@ static int rtw_resume_process_normal(struct adapter *padapter) netif_device_attach(pnetdev); netif_carrier_on(pnetdev); - if (padapter->pid[1]!= 0) { + if (padapter->pid[1] != 0) { DBG_871X("pid[1]:%d\n", padapter->pid[1]); rtw_signal_process(padapter->pid[1], SIGUSR2); } if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) { - DBG_871X(FUNC_ADPT_FMT" fwstate:0x%08x - WIFI_STATION_STATE\n", FUNC_ADPT_ARG(padapter), get_fwstate(pmlmepriv)); + DBG_871X(FUNC_ADPT_FMT " fwstate:0x%08x - WIFI_STATION_STATE\n", FUNC_ADPT_ARG(padapter), get_fwstate(pmlmepriv)); if (rtw_chk_roam_flags(padapter, RTW_ROAM_ON_RESUME)) rtw_roaming(padapter, NULL); } else if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) { - DBG_871X(FUNC_ADPT_FMT" fwstate:0x%08x - WIFI_AP_STATE\n", FUNC_ADPT_ARG(padapter), get_fwstate(pmlmepriv)); + DBG_871X(FUNC_ADPT_FMT " fwstate:0x%08x - WIFI_AP_STATE\n", FUNC_ADPT_ARG(padapter), get_fwstate(pmlmepriv)); rtw_ap_restore_network(padapter); } else if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) { - DBG_871X(FUNC_ADPT_FMT" fwstate:0x%08x - WIFI_ADHOC_STATE\n", FUNC_ADPT_ARG(padapter), get_fwstate(pmlmepriv)); + DBG_871X(FUNC_ADPT_FMT " fwstate:0x%08x - WIFI_ADHOC_STATE\n", FUNC_ADPT_ARG(padapter), get_fwstate(pmlmepriv)); } else { - DBG_871X(FUNC_ADPT_FMT" fwstate:0x%08x - ???\n", FUNC_ADPT_ARG(padapter), get_fwstate(pmlmepriv)); + DBG_871X(FUNC_ADPT_FMT " fwstate:0x%08x - ???\n", FUNC_ADPT_ARG(padapter), get_fwstate(pmlmepriv)); } - DBG_871X("<== "FUNC_ADPT_FMT" exit....\n", FUNC_ADPT_ARG(padapter)); + DBG_871X("<== " FUNC_ADPT_FMT " exit....\n", FUNC_ADPT_ARG(padapter)); exit: return ret; diff --git a/drivers/staging/rtl8723bs/os_dep/osdep_service.c b/drivers/staging/rtl8723bs/os_dep/osdep_service.c index a05daf06a870..f4221952dd1b 100644 --- a/drivers/staging/rtl8723bs/os_dep/osdep_service.c +++ b/drivers/staging/rtl8723bs/os_dep/osdep_service.c @@ -30,22 +30,17 @@ inline int RTW_STATUS_CODE(int error_code) return _FAIL; } -u8 *_rtw_malloc(u32 sz) +void *_rtw_malloc(u32 sz) { - u8 *pbuf = NULL; - - pbuf = kmalloc(sz, in_interrupt() ? GFP_ATOMIC : GFP_KERNEL); - - return pbuf; + return kmalloc(sz, in_interrupt() ? GFP_ATOMIC : GFP_KERNEL); } -u8 *_rtw_zmalloc(u32 sz) +void *_rtw_zmalloc(u32 sz) { - u8 *pbuf = _rtw_malloc(sz); + void *pbuf = _rtw_malloc(sz); - if (pbuf != NULL) { + if (pbuf) memset(pbuf, 0, sz); - } return pbuf; } @@ -71,13 +66,6 @@ inline int _rtw_netif_rx(_nic_hdl ndev, struct sk_buff *skb) return netif_rx(skb); } -void rtw_init_timer(_timer *ptimer, void *padapter, void *pfunc) -{ - struct adapter *adapter = padapter; - - _init_timer(ptimer, adapter->pnetdev, pfunc, adapter); -} - void _rtw_init_queue(struct __queue *pqueue) { INIT_LIST_HEAD(&(pqueue->queue)); @@ -470,7 +458,7 @@ struct rtw_cbuf *rtw_cbuf_alloc(u32 size) { struct rtw_cbuf *cbuf; - cbuf = (struct rtw_cbuf *)rtw_malloc(sizeof(*cbuf) + sizeof(void*)*size); + cbuf = rtw_malloc(sizeof(*cbuf) + sizeof(void *) * size); if (cbuf) { cbuf->write = cbuf->read = 0; diff --git a/drivers/staging/rtl8723bs/os_dep/recv_linux.c b/drivers/staging/rtl8723bs/os_dep/recv_linux.c index f42e00081e0e..e804b430931c 100644 --- a/drivers/staging/rtl8723bs/os_dep/recv_linux.c +++ b/drivers/staging/rtl8723bs/os_dep/recv_linux.c @@ -356,8 +356,7 @@ _recv_indicatepkt_drop: void rtw_init_recv_timer(struct recv_reorder_ctrl *preorder_ctrl) { - struct adapter *padapter = preorder_ctrl->padapter; - - _init_timer(&(preorder_ctrl->reordering_ctrl_timer), padapter->pnetdev, rtw_reordering_ctrl_timeout_handler, preorder_ctrl); + timer_setup(&preorder_ctrl->reordering_ctrl_timer, + rtw_reordering_ctrl_timeout_handler, 0); } diff --git a/drivers/staging/rtl8723bs/os_dep/rtw_proc.c b/drivers/staging/rtl8723bs/os_dep/rtw_proc.c index ce1dd6f9036f..9a885e626d1c 100644 --- a/drivers/staging/rtl8723bs/os_dep/rtw_proc.c +++ b/drivers/staging/rtl8723bs/os_dep/rtw_proc.c @@ -87,7 +87,7 @@ static ssize_t proc_set_log_level(struct file *file, const char __user *buffer, * rtw_drv_proc: * init/deinit when register/unregister driver */ -static const struct rtw_proc_hdl drv_proc_hdls [] = { +static const struct rtw_proc_hdl drv_proc_hdls[] = { {"ver_info", proc_get_drv_version, NULL}, {"log_level", proc_get_log_level, proc_set_log_level}, }; @@ -365,7 +365,7 @@ static int proc_get_cam_cache(struct seq_file *m, void *v) * rtw_adapter_proc: * init/deinit when register/unregister net_device */ -static const struct rtw_proc_hdl adapter_proc_hdls [] = { +static const struct rtw_proc_hdl adapter_proc_hdls[] = { {"write_reg", proc_get_dummy, proc_set_write_reg}, {"read_reg", proc_get_read_reg, proc_set_read_reg}, {"fwstate", proc_get_fwstate, NULL}, @@ -600,7 +600,7 @@ ssize_t proc_set_odm_adaptivity(struct file *file, const char __user *buffer, si * rtw_odm_proc: * init/deinit when register/unregister net_device, along with rtw_adapter_proc */ -static const struct rtw_proc_hdl odm_proc_hdls [] = { +static const struct rtw_proc_hdl odm_proc_hdls[] = { {"dbg_comp", proc_get_odm_dbg_comp, proc_set_odm_dbg_comp}, {"dbg_level", proc_get_odm_dbg_level, proc_set_odm_dbg_level}, {"ability", proc_get_odm_ability, proc_set_odm_ability}, |