From a90ca697ca6cdb47ae2529202f34086dde224eee Mon Sep 17 00:00:00 2001 From: Larry Finger Date: Sat, 10 Aug 2013 21:53:06 -0500 Subject: [PATCH] rtl8188eu: Fix checkpatch errors in os_dep/os_intfs.c Signed-off-by: Larry Finger --- include/recv_osdep.h | 3 + os_dep/os_intfs.c | 392 +++++++++++++++++++++---------------------- 2 files changed, 193 insertions(+), 202 deletions(-) diff --git a/include/recv_osdep.h b/include/recv_osdep.h index 0d98bb6..9b071f1 100644 --- a/include/recv_osdep.h +++ b/include/recv_osdep.h @@ -52,6 +52,9 @@ void rtw_os_read_port(struct adapter *padapter, struct recv_buf *precvbuf); void rtw_init_recv_timer(struct recv_reorder_ctrl *preorder_ctrl); int nat25_handle_frame(struct adapter *priv, struct sk_buff *skb); +int _netdev_open(struct net_device *pnetdev); +int netdev_open(struct net_device *pnetdev); +static int netdev_close(struct net_device *pnetdev); #endif // diff --git a/os_dep/os_intfs.c b/os_dep/os_intfs.c index 128ae99..1d81cfd 100644 --- a/os_dep/os_intfs.c +++ b/os_dep/os_intfs.c @@ -39,27 +39,25 @@ MODULE_VERSION(DRIVERVERSION); /* module param defaults */ static int rtw_chip_version = 0x00; static int rtw_rfintfs = HWPI; -static int rtw_lbkmode = 0;//RTL8712_AIR_TRX; - - -static int rtw_network_mode = Ndis802_11IBSS;//Ndis802_11Infrastructure;//infra, ad-hoc, auto -static int rtw_channel = 1;//ad-hoc support requirement +static int rtw_lbkmode;/* RTL8712_AIR_TRX; */ +static int rtw_network_mode = Ndis802_11IBSS;/* Ndis802_11Infrastructure; infra, ad-hoc, auto */ +static int rtw_channel = 1;/* ad-hoc support requirement */ static int rtw_wireless_mode = WIRELESS_11BG_24N; static int rtw_vrtl_carrier_sense = AUTO_VCS; -static int rtw_vcs_type = RTS_CTS;//* -static int rtw_rts_thresh = 2347;//* -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_vcs_type = RTS_CTS;/* */ +static int rtw_rts_thresh = 2347;/* */ +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; static int rtw_power_mgnt = 1; static int rtw_ips_mode = IPS_NORMAL; static int rtw_smart_ps = 2; 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_debug = 1; static int rtw_radio_enable = 1; @@ -68,67 +66,67 @@ static int rtw_short_retry_lmt = 7; static int rtw_busy_thresh = 40; static int rtw_ack_policy = NORMAL_ACK; -static int rtw_mp_mode = 0; +static int rtw_mp_mode; -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_wmm_enable = 1;/* default is set to enable the wmm. */ +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; -int rtw_cbw40_enable = 3; // 0 :diable, bit(0): enable 2.4g, bit(1): enable 5g -int rtw_ampdu_enable = 1;//for enable tx_ampdu -static int rtw_rx_stbc = 1;// 0: disable, bit(0):enable 2.4g, bit(1):enable 5g, default is set to enable 2.4GHZ for IOT issue with bufflao's AP at 5GHZ -static int rtw_ampdu_amsdu = 0;// 0: disabled, 1:enabled, 2:auto +int rtw_cbw40_enable = 3; /* 0 :diable, bit(0): enable 2.4g, bit(1): enable 5g */ +int rtw_ampdu_enable = 1;/* for enable tx_ampdu */ +static int rtw_rx_stbc = 1;/* 0: disable, bit(0):enable 2.4g, bit(1):enable 5g, default is set to enable 2.4GHZ for IOT issue with bufflao's AP at 5GHZ */ +static int rtw_ampdu_amsdu;/* 0: disabled, 1:enabled, 2:auto */ -static int rtw_lowrate_two_xmit = 1;//Use 2 path Tx to transmit MCS0~7 and legacy mode +static int rtw_lowrate_two_xmit = 1;/* Use 2 path Tx to transmit MCS0~7 and legacy mode */ -static int rtw_rf_config = RF_819X_MAX_TYPE; //auto -static int rtw_low_power = 0; -static int rtw_wifi_spec = 0; +static int rtw_rf_config = RF_819X_MAX_TYPE; /* auto */ +static int rtw_low_power; +static int rtw_wifi_spec; static int rtw_channel_plan = RT_CHANNEL_DOMAIN_MAX; #ifdef CONFIG_BT_COEXIST int rtw_btcoex_enable = 1; -int rtw_bt_iso = 2;// 0:Low, 1:High, 2:From Efuse -int rtw_bt_sco = 3;// 0:Idle, 1:None-SCO, 2:SCO, 3:From Counter, 4.Busy, 5.OtherBusy -int rtw_bt_ampdu =1 ;// 0:Disable BT control A-MPDU, 1:Enable BT control A-MPDU. +int rtw_bt_iso = 2;/* 0:Low, 1:High, 2:From Efuse */ +int rtw_bt_sco = 3;/* 0:Idle, 1:None-SCO, 2:SCO, 3:From Counter, 4.Busy, 5.OtherBusy */ +int rtw_bt_ampdu = 1 ;/* 0:Disable BT control A-MPDU, 1:Enable BT control A-MPDU. */ #endif -static int rtw_AcceptAddbaReq = true;// 0:Reject AP's Add BA req, 1:Accept AP's Add BA req. +static int rtw_AcceptAddbaReq = true;/* 0:Reject AP's Add BA req, 1:Accept AP's Add BA req. */ -static int rtw_antdiv_cfg = 2; // 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_cfg = 2; /* 0:OFF , 1:ON, 2:decide by Efuse config */ +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 */ -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 */ static int rtw_hw_wps_pbc = 1; -int rtw_mc2u_disable = 0; +int rtw_mc2u_disable; -static int rtw_80211d = 0; +static int rtw_80211d; -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"); -static char* if2name = "wlan%d"; +static char *if2name = "wlan%d"; module_param(if2name, charp, 0644); MODULE_PARM_DESC(if2name, "The default name to allocate for second interface"); -char* rtw_initmac = NULL; // temp mac address if users want to use instead of the mac address in Efuse +char *rtw_initmac; /* 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); @@ -160,13 +158,13 @@ module_param(rtw_hwpdn_mode, int, 0644); 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"); -static int rtw_fw_iol=1;// 0:Disable, 1:enable, 2:by usb speed +static int rtw_fw_iol = 1;/* 0:Disable, 1:enable, 2:by usb speed */ module_param(rtw_fw_iol, int, 0644); -MODULE_PARM_DESC(rtw_fw_iol,"FW IOL"); +MODULE_PARM_DESC(rtw_fw_iol, "FW IOL"); module_param(rtw_mc2u_disable, int, 0644); @@ -184,13 +182,10 @@ MODULE_PARM_DESC(rtw_notch_filter, "0:Disable, 1:Enable, 2:Enable only for P2P") module_param_named(debug, rtw_debug, int, 0444); MODULE_PARM_DESC(debug, "Set debug level (1-9) (default 1)"); -int _netdev_open(struct net_device *pnetdev); -int netdev_open (struct net_device *pnetdev); -static int netdev_close (struct net_device *pnetdev); static char rtw_proc_name[IFNAMSIZ]; -static struct proc_dir_entry *rtw_proc = NULL; -static int rtw_proc_cnt = 0; +static struct proc_dir_entry *rtw_proc; +static int rtw_proc_cnt; #define RTW_PROC_NAME DRV_NAME @@ -208,17 +203,17 @@ void rtw_proc_init_one(struct net_device *dev) void rtw_proc_init_one(struct net_device *dev) { struct proc_dir_entry *dir_dev = NULL; - struct proc_dir_entry *entry=NULL; + struct proc_dir_entry *entry = NULL; struct adapter *padapter = rtw_netdev_priv(dev); u8 rf_type; if (rtw_proc == NULL) { _rtw_memcpy(rtw_proc_name, RTW_PROC_NAME, sizeof(RTW_PROC_NAME)); -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) - rtw_proc=create_proc_entry(rtw_proc_name, S_IFDIR, proc_net); +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)) + rtw_proc = create_proc_entry(rtw_proc_name, S_IFDIR, proc_net); #else - rtw_proc=create_proc_entry(rtw_proc_name, S_IFDIR, init_net.proc_net); + rtw_proc = create_proc_entry(rtw_proc_name, S_IFDIR, init_net.proc_net); #endif if (rtw_proc == NULL) { DBG_88E(KERN_ERR "Unable to create rtw_proc directory\n"); @@ -237,10 +232,10 @@ void rtw_proc_init_one(struct net_device *dev) S_IFDIR | S_IRUGO | S_IXUGO, rtw_proc); dir_dev = padapter->dir_dev; - if (dir_dev==NULL) { + if (dir_dev == NULL) { if (rtw_proc_cnt == 0) { - if (rtw_proc){ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) + if (rtw_proc) { +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)) remove_proc_entry(rtw_proc_name, proc_net); #else remove_proc_entry(rtw_proc_name, init_net.proc_net); @@ -395,7 +390,7 @@ void rtw_proc_init_one(struct net_device *dev) } rtw_hal_get_hwreg(padapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type)); - if ((RF_1T2R == rf_type) ||(RF_1T1R ==rf_type )) { + if ((RF_1T2R == rf_type) || (RF_1T1R == rf_type)) { entry = create_proc_read_entry("rf_reg_dump3", S_IFREG | S_IRUGO, dir_dev, proc_get_rf_reg_dump3, dev); if (!entry) { @@ -521,7 +516,7 @@ void rtw_proc_remove_one(struct net_device *dev) remove_proc_entry("rf_reg_dump1", dir_dev); remove_proc_entry("rf_reg_dump2", dir_dev); rtw_hal_get_hwreg(padapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type)); - if ((RF_1T2R == rf_type) ||(RF_1T1R ==rf_type )) { + if ((RF_1T2R == rf_type) || (RF_1T1R == rf_type)) { remove_proc_entry("rf_reg_dump3", dir_dev); remove_proc_entry("rf_reg_dump4", dir_dev); } @@ -539,7 +534,7 @@ void rtw_proc_remove_one(struct net_device *dev) remove_proc_entry("rssi_disp", dir_dev); #ifdef CONFIG_BT_COEXIST remove_proc_entry("btcoex_dbg", dir_dev); -#endif //CONFIG_BT_COEXIST +#endif /* CONFIG_BT_COEXIST */ remove_proc_entry(dev->name, rtw_proc); dir_dev = NULL; } else { @@ -548,10 +543,10 @@ void rtw_proc_remove_one(struct net_device *dev) rtw_proc_cnt--; if (rtw_proc_cnt == 0) { - if (rtw_proc){ + if (rtw_proc) { remove_proc_entry("ver_info", rtw_proc); -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)) remove_proc_entry(rtw_proc_name, proc_net); #else remove_proc_entry(rtw_proc_name, init_net.proc_net); @@ -562,9 +557,8 @@ void rtw_proc_remove_one(struct net_device *dev) } #endif -static uint loadparam( struct adapter *padapter, struct net_device *pnetdev) +static uint loadparam(struct adapter *padapter, struct net_device *pnetdev) { - uint status = _SUCCESS; struct registry_priv *registry_par = &padapter->registrypriv; @@ -583,12 +577,12 @@ _func_enter_; registry_par->wireless_mode = (u8)rtw_wireless_mode; 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; - registry_par->soft_ap= (u8)rtw_soft_ap; + registry_par->soft_ap = (u8)rtw_soft_ap; registry_par->smart_ps = (u8)rtw_smart_ps; registry_par->power_mgnt = (u8)rtw_power_mgnt; registry_par->ips_mode = (u8)rtw_ips_mode; @@ -602,7 +596,7 @@ _func_enter_; registry_par->software_decrypt = (u8)rtw_software_decrypt; registry_par->acm_method = (u8)rtw_acm_method; - //UAPSD + /* UAPSD */ registry_par->wmm_enable = (u8)rtw_wmm_enable; registry_par->uapsd_enable = (u8)rtw_uapsd_enable; registry_par->uapsd_max_sp = (u8)rtw_uapsd_max_sp; @@ -630,8 +624,8 @@ _func_enter_; registry_par->bAcceptAddbaReq = (u8)rtw_AcceptAddbaReq; registry_par->antdiv_cfg = (u8)rtw_antdiv_cfg; registry_par->antdiv_type = (u8)rtw_antdiv_type; - registry_par->hwpdn_mode = (u8)rtw_hwpdn_mode;//0:disable,1:enable,2:by EFUSE config - registry_par->hwpwrp_detect = (u8)rtw_hwpwrp_detect;//0:disable,1:enable + registry_par->hwpdn_mode = (u8)rtw_hwpdn_mode;/* 0:disable, 1:enable, 2:by EFUSE config */ + registry_par->hwpwrp_detect = (u8)rtw_hwpwrp_detect;/* 0:disable, 1:enable */ registry_par->hw_wps_pbc = (u8)rtw_hw_wps_pbc; registry_par->max_roaming_times = (u8)rtw_max_roaming_times; @@ -651,7 +645,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) _rtw_memcpy(padapter->eeprompriv.mac_addr, addr->sa_data, ETH_ALEN); return 0; @@ -663,8 +657,8 @@ static struct net_device_stats *rtw_net_get_stats(struct net_device *pnetdev) struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); struct recv_priv *precvpriv = &(padapter->recvpriv); - padapter->stats.tx_packets = pxmitpriv->tx_pkts;//pxmitpriv->tx_pkts++; - padapter->stats.rx_packets = precvpriv->rx_pkts;//precvpriv->rx_pkts++; + padapter->stats.tx_packets = pxmitpriv->tx_pkts;/* pxmitpriv->tx_pkts++; */ + padapter->stats.rx_packets = precvpriv->rx_pkts;/* precvpriv->rx_pkts++; */ padapter->stats.tx_dropped = pxmitpriv->tx_drop; padapter->stats.rx_dropped = precvpriv->rx_drop; padapter->stats.tx_bytes = pxmitpriv->tx_bytes; @@ -672,7 +666,7 @@ static struct net_device_stats *rtw_net_get_stats(struct net_device *pnetdev) return &padapter->stats; } -#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,35)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35)) /* * AC to queue mapping * @@ -745,12 +739,12 @@ u16 rtw_recv_select_queue(struct sk_buff *skb) #endif -#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,29)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29)) static const struct net_device_ops rtw_netdev_ops = { .ndo_open = netdev_open, .ndo_stop = netdev_close, .ndo_start_xmit = rtw_xmit_entry, -#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,35)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35)) .ndo_select_queue = rtw_select_queue, #endif .ndo_set_mac_address = rtw_net_set_mac_address, @@ -764,7 +758,7 @@ int rtw_init_netdev_name(struct net_device *pnetdev, const char *ifname) struct adapter *padapter = rtw_netdev_priv(pnetdev); if (dev_alloc_name(pnetdev, ifname) < 0) - RT_TRACE(_module_os_intfs_c_,_drv_err_,("dev_alloc_name, fail!\n")); + RT_TRACE(_module_os_intfs_c_, _drv_err_, ("dev_alloc_name, fail!\n")); netif_carrier_off(pnetdev); return 0; @@ -775,7 +769,7 @@ struct net_device *rtw_init_netdev(struct adapter *old_padapter) struct adapter *padapter; struct net_device *pnetdev; - RT_TRACE(_module_os_intfs_c_,_drv_info_,("+init_net_dev\n")); + RT_TRACE(_module_os_intfs_c_, _drv_info_, ("+init_net_dev\n")); if (old_padapter != NULL) pnetdev = rtw_alloc_etherdev_with_old_priv(sizeof(struct adapter), (void *)old_padapter); @@ -788,11 +782,11 @@ struct net_device *rtw_init_netdev(struct adapter *old_padapter) padapter = rtw_netdev_priv(pnetdev); padapter->pnetdev = pnetdev; -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24) SET_MODULE_OWNER(pnetdev); #endif -#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,29)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29)) DBG_88E("register rtw_netdev_ops to netdev_ops\n"); pnetdev->netdev_ops = &rtw_netdev_ops; #else @@ -808,7 +802,7 @@ struct net_device *rtw_init_netdev(struct adapter *old_padapter) pnetdev->wireless_handlers = (struct iw_handler_def *)&rtw_handlers_def; #endif - //step 2. + /* step 2. */ loadparam(padapter, pnetdev); return pnetdev; @@ -818,23 +812,23 @@ u32 rtw_start_drv_threads(struct adapter *padapter) { u32 _status = _SUCCESS; - RT_TRACE(_module_os_intfs_c_,_drv_info_,("+rtw_start_drv_threads\n")); + RT_TRACE(_module_os_intfs_c_, _drv_info_, ("+rtw_start_drv_threads\n")); padapter->cmdThread = kthread_run(rtw_cmd_thread, padapter, "RTW_CMD_THREAD"); - if (IS_ERR(padapter->cmdThread)) + if (IS_ERR(padapter->cmdThread)) _status = _FAIL; else - _rtw_down_sema(&padapter->cmdpriv.terminate_cmdthread_sema); //wait for cmd_thread to run + _rtw_down_sema(&padapter->cmdpriv.terminate_cmdthread_sema); /* wait for cmd_thread to run */ rtw_hal_start_thread(padapter); return _status; } -void rtw_stop_drv_threads (struct adapter *padapter) +void rtw_stop_drv_threads(struct adapter *padapter) { - RT_TRACE(_module_os_intfs_c_,_drv_info_,("+rtw_stop_drv_threads\n")); + RT_TRACE(_module_os_intfs_c_, _drv_info_, ("+rtw_stop_drv_threads\n")); - //Below is to termindate rtw_cmd_thread & event_thread... + /* Below is to termindate rtw_cmd_thread & event_thread... */ _rtw_up_sema(&padapter->cmdpriv.cmd_queue_sema); if (padapter->cmdThread) _rtw_down_sema(&padapter->cmdpriv.terminate_cmdthread_sema); @@ -845,29 +839,29 @@ 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 mlme_priv *pmlmepriv = &padapter->mlmepriv; struct security_priv *psecuritypriv = &padapter->securitypriv; - //xmit_priv + /* xmit_priv */ pxmitpriv->vcs_setting = pregistrypriv->vrtl_carrier_sense; pxmitpriv->vcs = pregistrypriv->vcs_type; pxmitpriv->vcs_type = pregistrypriv->vcs_type; pxmitpriv->frag_len = pregistrypriv->frag_thresh; - //mlme_priv - pmlmepriv->scan_interval = SCAN_INTERVAL;// 30*2 sec = 60sec + /* mlme_priv */ + pmlmepriv->scan_interval = SCAN_INTERVAL;/* 30*2 sec = 60sec */ pmlmepriv->scan_mode = SCAN_ACTIVE; - //ht_priv - pmlmepriv->htpriv.ampdu_enable = false;//set to disabled + /* ht_priv */ + pmlmepriv->htpriv.ampdu_enable = false;/* set to disabled */ - //security_priv + /* security_priv */ psecuritypriv->binstallGrpkey = _FAIL; - psecuritypriv->sw_encrypt=pregistrypriv->software_encrypt; - psecuritypriv->sw_decrypt=pregistrypriv->software_decrypt; - psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Open; //open system + psecuritypriv->sw_encrypt = pregistrypriv->software_encrypt; + psecuritypriv->sw_decrypt = pregistrypriv->software_decrypt; + psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Open; /* open system */ psecuritypriv->dot11PrivacyAlgrthm = _NO_PRIVACY_; psecuritypriv->dot11PrivacyKeyIndex = 0; psecuritypriv->dot118021XGrpPrivacy = _NO_PRIVACY_; @@ -875,14 +869,14 @@ static u8 rtw_init_default_value(struct adapter *padapter) psecuritypriv->ndisauthtype = Ndis802_11AuthModeOpen; psecuritypriv->ndisencryptstatus = Ndis802_11WEPDisabled; - //registry_priv + /* registry_priv */ rtw_init_registrypriv_dev_network(padapter); rtw_update_registrypriv_dev_network(padapter); - //hal_priv + /* hal_priv */ rtw_hal_def_value_init(padapter); - //misc. + /* misc. */ padapter->bReadPortCancel = false; padapter->bWritePortCancel = false; padapter->bRxRSSIDisplay = 0; @@ -895,29 +889,29 @@ static u8 rtw_init_default_value(struct adapter *padapter) u8 rtw_reset_drv_sw(struct adapter *padapter) { - u8 ret8=_SUCCESS; - struct mlme_priv *pmlmepriv= &padapter->mlmepriv; + u8 ret8 = _SUCCESS; + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct pwrctrl_priv *pwrctrlpriv = &padapter->pwrctrlpriv; - //hal_priv + /* hal_priv */ rtw_hal_def_value_init(padapter); padapter->bReadPortCancel = false; padapter->bWritePortCancel = false; padapter->bRxRSSIDisplay = 0; - pmlmepriv->scan_interval = SCAN_INTERVAL;// 30*2 sec = 60sec + pmlmepriv->scan_interval = SCAN_INTERVAL;/* 30*2 sec = 60sec */ padapter->xmitpriv.tx_pkts = 0; padapter->recvpriv.rx_pkts = 0; pmlmepriv->LinkDetectInfo.bBusyTraffic = false; - _clr_fwstate_(pmlmepriv, _FW_UNDER_SURVEY |_FW_UNDER_LINKING); + _clr_fwstate_(pmlmepriv, _FW_UNDER_SURVEY | _FW_UNDER_LINKING); rtw_hal_sreset_reset_value(padapter); pwrctrlpriv->pwr_state_check_cnts = 0; - //mlmeextpriv - padapter->mlmeextpriv.sitesurvey_res.state= SCAN_DISABLE; + /* mlmeextpriv */ + padapter->mlmeextpriv.sitesurvey_res.state = SCAN_DISABLE; rtw_set_signal_stat_timer(&padapter->recvpriv); @@ -926,29 +920,29 @@ u8 rtw_reset_drv_sw(struct adapter *padapter) u8 rtw_init_drv_sw(struct adapter *padapter) { - u8 ret8=_SUCCESS; + u8 ret8 = _SUCCESS; _func_enter_; - RT_TRACE(_module_os_intfs_c_,_drv_info_,("+rtw_init_drv_sw\n")); + RT_TRACE(_module_os_intfs_c_, _drv_info_, ("+rtw_init_drv_sw\n")); if ((rtw_init_cmd_priv(&padapter->cmdpriv)) == _FAIL) { - RT_TRACE(_module_os_intfs_c_,_drv_err_,("\n Can't init cmd_priv\n")); - ret8=_FAIL; + RT_TRACE(_module_os_intfs_c_, _drv_err_, ("\n Can't init cmd_priv\n")); + ret8 = _FAIL; 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")); - ret8=_FAIL; + RT_TRACE(_module_os_intfs_c_, _drv_err_, ("\n Can't init evt_priv\n")); + ret8 = _FAIL; goto exit; } if (rtw_init_mlme_priv(padapter) == _FAIL) { - RT_TRACE(_module_os_intfs_c_,_drv_err_,("\n Can't init mlme_priv\n")); - ret8=_FAIL; + RT_TRACE(_module_os_intfs_c_, _drv_err_, ("\n Can't init mlme_priv\n")); + ret8 = _FAIL; goto exit; } @@ -959,26 +953,26 @@ _func_enter_; #endif /* CONFIG_P2P */ if (init_mlme_ext_priv(padapter) == _FAIL) { - RT_TRACE(_module_os_intfs_c_,_drv_err_,("\n Can't init mlme_ext_priv\n")); - ret8=_FAIL; + RT_TRACE(_module_os_intfs_c_, _drv_err_, ("\n Can't init mlme_ext_priv\n")); + ret8 = _FAIL; goto exit; } if (_rtw_init_xmit_priv(&padapter->xmitpriv, padapter) == _FAIL) { DBG_88E("Can't _rtw_init_xmit_priv\n"); - ret8=_FAIL; + ret8 = _FAIL; goto exit; } if (_rtw_init_recv_priv(&padapter->recvpriv, padapter) == _FAIL) { DBG_88E("Can't _rtw_init_recv_priv\n"); - ret8=_FAIL; + ret8 = _FAIL; goto exit; } if (_rtw_init_sta_priv(&padapter->stapriv) == _FAIL) { DBG_88E("Can't _rtw_init_sta_priv\n"); - ret8=_FAIL; + ret8 = _FAIL; goto exit; } @@ -1001,7 +995,7 @@ _func_enter_; _rtw_spinlock_init(&padapter->br_ext_lock); exit: - RT_TRACE(_module_os_intfs_c_,_drv_info_,("-rtw_init_drv_sw\n")); + RT_TRACE(_module_os_intfs_c_, _drv_info_, ("-rtw_init_drv_sw\n")); _func_exit_; @@ -1012,50 +1006,50 @@ exit: void rtw_cancel_dynamic_chk_timer(struct adapter *padapter) { _cancel_timer_ex(&padapter->mlmepriv.dynamic_chk_timer); - RT_TRACE(_module_os_intfs_c_,_drv_info_,("rtw_cancel_all_timer:cancel dynamic_chk_timer!\n")); + RT_TRACE(_module_os_intfs_c_, _drv_info_, ("rtw_cancel_all_timer:cancel dynamic_chk_timer!\n")); } #endif void rtw_cancel_all_timer(struct adapter *padapter) { - RT_TRACE(_module_os_intfs_c_,_drv_info_,("+rtw_cancel_all_timer\n")); + RT_TRACE(_module_os_intfs_c_, _drv_info_, ("+rtw_cancel_all_timer\n")); _cancel_timer_ex(&padapter->mlmepriv.assoc_timer); - RT_TRACE(_module_os_intfs_c_,_drv_info_,("rtw_cancel_all_timer:cancel association timer complete!\n")); + RT_TRACE(_module_os_intfs_c_, _drv_info_, ("rtw_cancel_all_timer:cancel association timer complete!\n")); _cancel_timer_ex(&padapter->mlmepriv.scan_to_timer); - RT_TRACE(_module_os_intfs_c_,_drv_info_,("rtw_cancel_all_timer:cancel scan_to_timer!\n")); + RT_TRACE(_module_os_intfs_c_, _drv_info_, ("rtw_cancel_all_timer:cancel scan_to_timer!\n")); _cancel_timer_ex(&padapter->mlmepriv.dynamic_chk_timer); - RT_TRACE(_module_os_intfs_c_,_drv_info_,("rtw_cancel_all_timer:cancel dynamic_chk_timer!\n")); + RT_TRACE(_module_os_intfs_c_, _drv_info_, ("rtw_cancel_all_timer:cancel dynamic_chk_timer!\n")); - // cancel sw led timer + /* cancel sw led timer */ rtw_hal_sw_led_deinit(padapter); - RT_TRACE(_module_os_intfs_c_,_drv_info_,("rtw_cancel_all_timer:cancel DeInitSwLeds!\n")); + RT_TRACE(_module_os_intfs_c_, _drv_info_, ("rtw_cancel_all_timer:cancel DeInitSwLeds!\n")); _cancel_timer_ex(&padapter->pwrctrlpriv.pwr_state_check_timer); _cancel_timer_ex(&padapter->recvpriv.signal_stat_timer); - //cancel dm timer + /* cancel dm timer */ rtw_hal_dm_deinit(padapter); } u8 rtw_free_drv_sw(struct adapter *padapter) { - struct net_device *pnetdev = (struct net_device*)padapter->pnetdev; + struct net_device *pnetdev = (struct net_device *)padapter->pnetdev; - RT_TRACE(_module_os_intfs_c_,_drv_info_,("==>rtw_free_drv_sw")); + RT_TRACE(_module_os_intfs_c_, _drv_info_, ("==>rtw_free_drv_sw")); - //we can call rtw_p2p_enable here, but: - // 1. rtw_p2p_enable may have IO operation - // 2. rtw_p2p_enable is bundled with wext interface + /* we can call rtw_p2p_enable here, but: */ + /* 1. rtw_p2p_enable may have IO operation */ + /* 2. rtw_p2p_enable is bundled with wext interface */ #ifdef CONFIG_P2P { struct wifidirect_info *pwdinfo = &padapter->wdinfo; if (!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) { - _cancel_timer_ex( &pwdinfo->find_phase_timer ); - _cancel_timer_ex( &pwdinfo->restore_p2p_state_timer ); - _cancel_timer_ex( &pwdinfo->pre_tx_scan_timer); + _cancel_timer_ex(&pwdinfo->find_phase_timer); + _cancel_timer_ex(&pwdinfo->restore_p2p_state_timer); + _cancel_timer_ex(&pwdinfo->pre_tx_scan_timer); rtw_p2p_set_state(pwdinfo, P2P_STATE_NONE); } } @@ -1073,7 +1067,7 @@ u8 rtw_free_drv_sw(struct adapter *padapter) rtw_free_mlme_priv(&padapter->mlmepriv); _rtw_free_xmit_priv(&padapter->xmitpriv); - _rtw_free_sta_priv(&padapter->stapriv); //will free bcmc_stainfo here + _rtw_free_sta_priv(&padapter->stapriv); /* will free bcmc_stainfo here */ _rtw_free_recv_priv(&padapter->recvpriv); @@ -1081,19 +1075,19 @@ u8 rtw_free_drv_sw(struct adapter *padapter) rtw_hal_free_data(padapter); - RT_TRACE(_module_os_intfs_c_,_drv_info_,("<==rtw_free_drv_sw\n")); + RT_TRACE(_module_os_intfs_c_, _drv_info_, ("<== rtw_free_drv_sw\n")); - //free the old_pnetdev + /* free the old_pnetdev */ if (padapter->rereg_nd_name_priv.old_pnetdev) { free_netdev(padapter->rereg_nd_name_priv.old_pnetdev); padapter->rereg_nd_name_priv.old_pnetdev = NULL; } - // clear pbuddystruct adapter to avoid access wrong pointer. + /* clear pbuddystruct adapter to avoid access wrong pointer. */ if (padapter->pbuddy_adapter != NULL) padapter->pbuddy_adapter->pbuddy_adapter = NULL; - RT_TRACE(_module_os_intfs_c_,_drv_info_,("-rtw_free_drv_sw\n")); + RT_TRACE(_module_os_intfs_c_, _drv_info_, ("-rtw_free_drv_sw\n")); return _SUCCESS; } @@ -1104,29 +1098,29 @@ void netdev_br_init(struct net_device *netdev) #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 35)) rcu_read_lock(); -#endif // (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 35)) +#endif /* (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 35)) */ { #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 35)) if (netdev->br_port) -#else // (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 35)) +#else /* (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 35)) */ if (rcu_dereference(adapter->pnetdev->rx_handler_data)) -#endif // (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 35)) +#endif /* (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 35)) */ { struct net_device *br_netdev; -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)) br_netdev = dev_get_by_name(CONFIG_BR_EXT_BRNAME); -#else // (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) +#else /* (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)) */ struct net *devnet = NULL; -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26)) +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26)) devnet = netdev->nd_net; -#else // (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26)) +#else /* (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26)) */ devnet = dev_net(netdev); -#endif // (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26)) +#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26)) */ br_netdev = dev_get_by_name(devnet, CONFIG_BR_EXT_BRNAME); -#endif // (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) +#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)) */ if (br_netdev) { memcpy(adapter->br_mac, br_netdev->dev_addr, ETH_ALEN); @@ -1140,7 +1134,7 @@ void netdev_br_init(struct net_device *netdev) #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 35)) rcu_read_unlock(); -#endif // (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 35)) +#endif /* (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 35)) */ } int _netdev_open(struct net_device *pnetdev) @@ -1149,29 +1143,29 @@ int _netdev_open(struct net_device *pnetdev) struct adapter *padapter = (struct adapter *)rtw_netdev_priv(pnetdev); struct pwrctrl_priv *pwrctrlpriv = &padapter->pwrctrlpriv; - RT_TRACE(_module_os_intfs_c_,_drv_info_,("+88eu_drv - dev_open\n")); - DBG_88E("+88eu_drv - drv_open, bup=%d\n", padapter->bup); + RT_TRACE(_module_os_intfs_c_, _drv_info_, ("+88eu_drv - dev_open\n")); + DBG_88E("+88eu_drv - drv_open, bup =%d\n", padapter->bup); - if (pwrctrlpriv->ps_flag == true){ + if (pwrctrlpriv->ps_flag) { padapter->net_closed = false; goto netdev_open_normal_process; } - if (padapter->bup == false) { + if (!padapter->bup) { padapter->bDriverStopped = false; padapter->bSurpriseRemoved = false; padapter->bCardDisableWOHSM = false; status = rtw_hal_init(padapter); - if (status ==_FAIL) { - RT_TRACE(_module_os_intfs_c_,_drv_err_,("rtl88eu_hal_init(): Can't init h/w!\n")); + if (status == _FAIL) { + RT_TRACE(_module_os_intfs_c_, _drv_err_, ("rtl88eu_hal_init(): Can't init h/w!\n")); goto netdev_open_error; } pr_info("MAC Address = %pM\n", pnetdev->dev_addr); - status=rtw_start_drv_threads(padapter); - if (status ==_FAIL) { + status = rtw_start_drv_threads(padapter); + if (status == _FAIL) { pr_info("Initialize driver software resource Failed!\n"); goto netdev_open_error; } @@ -1203,22 +1197,16 @@ int _netdev_open(struct net_device *pnetdev) netdev_br_init(pnetdev); netdev_open_normal_process: - - RT_TRACE(_module_os_intfs_c_,_drv_info_,("-88eu_drv - dev_open\n")); - DBG_88E("-88eu_drv - drv_open, bup=%d\n", padapter->bup); - + RT_TRACE(_module_os_intfs_c_, _drv_info_, ("-88eu_drv - dev_open\n")); + DBG_88E("-88eu_drv - drv_open, bup =%d\n", padapter->bup); return 0; netdev_open_error: - padapter->bup = false; - netif_carrier_off(pnetdev); rtw_netif_stop_queue(pnetdev); - - RT_TRACE(_module_os_intfs_c_,_drv_err_,("-88eu_drv - dev_open, fail!\n")); - DBG_88E("-88eu_drv - drv_open fail, bup=%d\n", padapter->bup); - + RT_TRACE(_module_os_intfs_c_, _drv_err_, ("-88eu_drv - dev_open, fail!\n")); + DBG_88E("-88eu_drv - drv_open fail, bup =%d\n", padapter->bup); return -1; } @@ -1230,7 +1218,6 @@ int netdev_open(struct net_device *pnetdev) _enter_critical_mutex(padapter->hw_init_mutex, NULL); ret = _netdev_open(pnetdev); _exit_critical_mutex(padapter->hw_init_mutex, NULL); - return ret; } @@ -1238,15 +1225,15 @@ static int ips_netdrv_open(struct adapter *padapter) { int status = _SUCCESS; padapter->net_closed = false; - DBG_88E("===> %s.........\n",__func__); + DBG_88E("===> %s.........\n", __func__); padapter->bDriverStopped = false; padapter->bSurpriseRemoved = false; padapter->bCardDisableWOHSM = false; status = rtw_hal_init(padapter); - if (status ==_FAIL) { - RT_TRACE(_module_os_intfs_c_,_drv_err_,("ips_netdrv_open(): Can't init h/w!\n")); + if (status == _FAIL) { + RT_TRACE(_module_os_intfs_c_, _drv_err_, ("ips_netdrv_open(): Can't init h/w!\n")); goto netdev_open_error; } @@ -1254,12 +1241,12 @@ static int ips_netdrv_open(struct adapter *padapter) padapter->intf_start(padapter); rtw_set_pwr_state_check_timer(&padapter->pwrctrlpriv); - _set_timer(&padapter->mlmepriv.dynamic_chk_timer,5000); + _set_timer(&padapter->mlmepriv.dynamic_chk_timer, 5000); return _SUCCESS; netdev_open_error: - DBG_88E("-ips_netdrv_open - drv_open failure, bup=%d\n", padapter->bup); + DBG_88E("-ips_netdrv_open - drv_open failure, bup =%d\n", padapter->bup); return _FAIL; } @@ -1297,28 +1284,28 @@ void rtw_ips_pwr_down(struct adapter *padapter) void rtw_ips_dev_unload(struct adapter *padapter) { - struct net_device *pnetdev= (struct net_device*)padapter->pnetdev; + struct net_device *pnetdev = (struct net_device *)padapter->pnetdev; struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); - DBG_88E("====> %s...\n",__func__); + DBG_88E("====> %s...\n", __func__); rtw_hal_set_hwreg(padapter, HW_VAR_FIFO_CLEARN_UP, NULL); if (padapter->intf_stop) padapter->intf_stop(padapter); - //s5. - if (padapter->bSurpriseRemoved == false) + /* s5. */ + if (!padapter->bSurpriseRemoved) rtw_hal_deinit(padapter); } -int pm_netdev_open(struct net_device *pnetdev,u8 bnormal) +int pm_netdev_open(struct net_device *pnetdev, u8 bnormal) { int status; - if (true == bnormal) + if (bnormal) status = netdev_open(pnetdev); else - status = (_SUCCESS == ips_netdrv_open((struct adapter *)rtw_netdev_priv(pnetdev)))?(0):(-1); + status = (_SUCCESS == ips_netdrv_open((struct adapter *)rtw_netdev_priv(pnetdev))) ? (0) : (-1); return status; } @@ -1326,33 +1313,34 @@ static int netdev_close(struct net_device *pnetdev) { struct adapter *padapter = (struct adapter *)rtw_netdev_priv(pnetdev); - RT_TRACE(_module_os_intfs_c_,_drv_info_,("+88eu_drv - drv_close\n")); + RT_TRACE(_module_os_intfs_c_, _drv_info_, ("+88eu_drv - drv_close\n")); - if (padapter->pwrctrlpriv.bInternalAutoSuspend == true) { + if (padapter->pwrctrlpriv.bInternalAutoSuspend) { if (padapter->pwrctrlpriv.rf_pwrstate == rf_off) padapter->pwrctrlpriv.ps_flag = true; } padapter->net_closed = true; - if (padapter->pwrctrlpriv.rf_pwrstate == rf_on){ - DBG_88E("(2)88eu_drv - drv_close, bup=%d, hw_init_completed=%d\n", padapter->bup, padapter->hw_init_completed); + if (padapter->pwrctrlpriv.rf_pwrstate == rf_on) { + DBG_88E("(2)88eu_drv - drv_close, bup =%d, hw_init_completed =%d\n", + padapter->bup, padapter->hw_init_completed); - //s1. + /* s1. */ if (pnetdev) { if (!rtw_netif_queue_stopped(pnetdev)) rtw_netif_stop_queue(pnetdev); } - //s2. + /* s2. */ LeaveAllPowerSaveMode(padapter); rtw_disassoc_cmd(padapter, 500, false); - //s2-2. indicate disconnect to os + /* s2-2. indicate disconnect to os */ rtw_indicate_disconnect(padapter); - //s2-3. + /* s2-3. */ rtw_free_assoc_resources(padapter, 1); - //s2-4. - rtw_free_network_queue(padapter,true); - // Close LED + /* s2-4. */ + rtw_free_network_queue(padapter, true); + /* Close LED */ rtw_led_control(padapter, LED_CTL_POWER_OFF); } @@ -1360,9 +1348,9 @@ static int netdev_close(struct net_device *pnetdev) #ifdef CONFIG_P2P rtw_p2p_enable(padapter, P2P_ROLE_DISABLE); -#endif //CONFIG_P2P +#endif /* CONFIG_P2P */ - RT_TRACE(_module_os_intfs_c_,_drv_info_,("-88eu_drv - drv_close\n")); - DBG_88E("-88eu_drv - drv_close, bup=%d\n", padapter->bup); + RT_TRACE(_module_os_intfs_c_, _drv_info_, ("-88eu_drv - drv_close\n")); + DBG_88E("-88eu_drv - drv_close, bup =%d\n", padapter->bup); return 0; }