diff --git a/core/rtw_ap.c b/core/rtw_ap.c index b10ea46..a5f15c2 100644 --- a/core/rtw_ap.c +++ b/core/rtw_ap.c @@ -127,19 +127,14 @@ static void update_BCNTIM(_adapter *padapter) *dst_ie++ = BIT(0);/*bitmap ctrl */ else *dst_ie++ = 0; - if (tim_ielen == 4) { u8 pvb = 0; - if (pstapriv->tim_bitmap & 0x00fe) - pvb = (u8)tim_bitmap_le; - else if (pstapriv->tim_bitmap & 0xff00) - pvb = (u8)(tim_bitmap_le >> 8); + if (pstapriv->tim_bitmap & 0xff00) + pvb = le16_to_cpu(tim_bitmap_le) >> 8; else - pvb = (u8)tim_bitmap_le; - + pvb = le16_to_cpu(tim_bitmap_le); *dst_ie++ = pvb; - } else if (tim_ielen == 5) { _rtw_memcpy(dst_ie, &tim_bitmap_le, 2); dst_ie += 2; diff --git a/core/rtw_br_ext.c b/core/rtw_br_ext.c index b7c44e3..9b00c29 100644 --- a/core/rtw_br_ext.c +++ b/core/rtw_br_ext.c @@ -45,6 +45,7 @@ #endif #ifdef CONFIG_BR_EXT +#include /* #define BR_EXT_DEBUG */ @@ -808,7 +809,6 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method) /* forward unknow IP packet to upper TCP/IP */ RTW_INFO("NAT25: Replace DA with BR's MAC\n"); if ((*(u32 *)priv->br_mac) == 0 && (*(u16 *)(priv->br_mac + 4)) == 0) { - void netdev_br_init(struct net_device *netdev); RTW_INFO("Re-init netdev_br_init() due to br_mac==0!\n"); netdev_br_init(priv->pnetdev); } diff --git a/core/rtw_cmd.c b/core/rtw_cmd.c index 08bac24..13ce5c1 100644 --- a/core/rtw_cmd.c +++ b/core/rtw_cmd.c @@ -4403,9 +4403,9 @@ static void session_tracker_cmd_hdl(_adapter *adapter, struct st_cmd_parm *parm) st = LIST_CONTAINOR(plist, struct session_tracker, list); if (st->local_naddr == local_naddr - && st->local_port == local_port + && st->local_port == cpu_to_be16(local_port) && st->remote_naddr == remote_naddr - && st->remote_port == remote_port) + && st->remote_port == cpu_to_be16(remote_port)) break; plist = get_next(plist); @@ -4440,9 +4440,9 @@ unlock: goto exit; st->local_naddr = local_naddr; - st->local_port = local_port; + st->local_port = cpu_to_be16(local_port); st->remote_naddr = remote_naddr; - st->remote_port = remote_port; + st->remote_port = cpu_to_be16(remote_port); st->set_time = rtw_get_current_time(); st->status = ST_STATUS_CHECK; diff --git a/core/rtw_efuse.c b/core/rtw_efuse.c index 8caca5e..eabd3fe 100644 --- a/core/rtw_efuse.c +++ b/core/rtw_efuse.c @@ -43,7 +43,7 @@ u8 fakeBTEfuseModifiedMap[EFUSE_BT_MAX_MAP_LEN] = {0}; u8 maskfileBuffer[64]; /*------------------------Define local variable------------------------------*/ -BOOLEAN rtw_file_efuse_IsMasked(PADAPTER pAdapter, u16 Offset) +static BOOLEAN rtw_file_efuse_IsMasked(PADAPTER pAdapter, u16 Offset) { int r = Offset / 16; int c = (Offset % 16) / 2; @@ -60,7 +60,7 @@ BOOLEAN rtw_file_efuse_IsMasked(PADAPTER pAdapter, u16 Offset) return (result > 0) ? 0 : 1; } -BOOLEAN efuse_IsMasked(PADAPTER pAdapter, u16 Offset) +static BOOLEAN efuse_IsMasked(PADAPTER pAdapter, u16 Offset) { PHAL_DATA_TYPE pHalData = GET_HAL_DATA(pAdapter); @@ -1436,7 +1436,7 @@ u8 EfusePgPacketWrite_BT( #define EFUSE_CTRL REG_EFUSE_CTRL /* E-Fuse Control. */ /* ------------------------------------------------------------------------------ */ -VOID efuse_PreUpdateAction( +static VOID efuse_PreUpdateAction( PADAPTER pAdapter, pu4Byte BackupRegs) { @@ -1462,7 +1462,7 @@ VOID efuse_PreUpdateAction( #endif } -VOID efuse_PostUpdateAction( +static VOID efuse_PostUpdateAction( PADAPTER pAdapter, pu4Byte BackupRegs) { @@ -1860,7 +1860,7 @@ Efuse_PgPacketWrite(IN PADAPTER pAdapter, } -int +static int Efuse_PgPacketWrite_BT(IN PADAPTER pAdapter, IN u8 offset, IN u8 word_en, diff --git a/core/rtw_ieee80211.c b/core/rtw_ieee80211.c index 39ef5a9..cb3518f 100644 --- a/core/rtw_ieee80211.c +++ b/core/rtw_ieee80211.c @@ -23,7 +23,7 @@ #include #endif #include - +#include u8 RTW_WPA_OUI_TYPE[] = { 0x00, 0x50, 0xf2, 1 }; u16 RTW_WPA_VERSION = 1; @@ -1361,7 +1361,6 @@ func_exit: return res; } -extern char *rtw_initmac; /** * rtw_macaddr_cfg - Decide the mac address used * @out: buf to store mac address decided diff --git a/core/rtw_io.c b/core/rtw_io.c index 4f2f450..b75fb6b 100644 --- a/core/rtw_io.c +++ b/core/rtw_io.c @@ -80,28 +80,24 @@ u8 _rtw_read8(_adapter *adapter, u32 addr) u16 _rtw_read16(_adapter *adapter, u32 addr) { - __le16 r_val; /* struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; */ struct io_priv *pio_priv = &adapter->iopriv; struct intf_hdl *pintfhdl = &(pio_priv->intf); - __le16(*_read16)(struct intf_hdl *pintfhdl, u32 addr); + u16(*_read16)(struct intf_hdl *pintfhdl, u32 addr); _read16 = pintfhdl->io_ops._read16; - r_val = _read16(pintfhdl, addr); - return le16_to_cpu(r_val); + return _read16(pintfhdl, addr); } u32 _rtw_read32(_adapter *adapter, u32 addr) { - __le32 r_val; /* struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; */ struct io_priv *pio_priv = &adapter->iopriv; struct intf_hdl *pintfhdl = &(pio_priv->intf); - __le32(*_read32)(struct intf_hdl *pintfhdl, u32 addr); + u32(*_read32)(struct intf_hdl *pintfhdl, u32 addr); _read32 = pintfhdl->io_ops._read32; - r_val = _read32(pintfhdl, addr); - return rtw_le32_to_cpu(r_val); + return _read32(pintfhdl, addr); } int _rtw_write8(_adapter *adapter, u32 addr, u8 val) diff --git a/core/rtw_odm.c b/core/rtw_odm.c index 95b7b9b..d8b3624 100644 --- a/core/rtw_odm.c +++ b/core/rtw_odm.c @@ -49,7 +49,7 @@ inline u8 rtw_odm_get_force_igi_lb(_adapter *adapter) return hal_data->u1ForcedIgiLb; } -void rtw_odm_adaptivity_ver_msg(void *sel, _adapter *adapter) +static void rtw_odm_adaptivity_ver_msg(void *sel, _adapter *adapter) { RTW_PRINT_SEL(sel, "ADAPTIVITY_VERSION "ADAPTIVITY_VERSION"\n"); } @@ -57,7 +57,7 @@ void rtw_odm_adaptivity_ver_msg(void *sel, _adapter *adapter) #define RTW_ADAPTIVITY_EN_DISABLE 0 #define RTW_ADAPTIVITY_EN_ENABLE 1 -void rtw_odm_adaptivity_en_msg(void *sel, _adapter *adapter) +static void rtw_odm_adaptivity_en_msg(void *sel, _adapter *adapter) { struct registry_priv *regsty = &adapter->registrypriv; struct mlme_priv *mlme = &adapter->mlmepriv; @@ -77,7 +77,7 @@ void rtw_odm_adaptivity_en_msg(void *sel, _adapter *adapter) #define RTW_ADAPTIVITY_MODE_NORMAL 0 #define RTW_ADAPTIVITY_MODE_CARRIER_SENSE 1 -void rtw_odm_adaptivity_mode_msg(void *sel, _adapter *adapter) +static void rtw_odm_adaptivity_mode_msg(void *sel, _adapter *adapter) { struct registry_priv *regsty = &adapter->registrypriv; @@ -94,7 +94,7 @@ void rtw_odm_adaptivity_mode_msg(void *sel, _adapter *adapter) #define RTW_ADAPTIVITY_DML_DISABLE 0 #define RTW_ADAPTIVITY_DML_ENABLE 1 -void rtw_odm_adaptivity_dml_msg(void *sel, _adapter *adapter) +static void rtw_odm_adaptivity_dml_msg(void *sel, _adapter *adapter) { struct registry_priv *regsty = &adapter->registrypriv; @@ -108,7 +108,7 @@ void rtw_odm_adaptivity_dml_msg(void *sel, _adapter *adapter) _RTW_PRINT_SEL(sel, "INVALID\n"); } -void rtw_odm_adaptivity_dc_backoff_msg(void *sel, _adapter *adapter) +static void rtw_odm_adaptivity_dc_backoff_msg(void *sel, _adapter *adapter) { struct registry_priv *regsty = &adapter->registrypriv; diff --git a/core/rtw_recv.c b/core/rtw_recv.c index a38fa14..a9f41ee 100755 --- a/core/rtw_recv.c +++ b/core/rtw_recv.c @@ -2339,8 +2339,8 @@ sint wlanhdr_to_ethhdr(union recv_frame *precvframe) _rtw_memcpy(ptr + ETH_ALEN, pattrib->src, ETH_ALEN); if (!bsnaphdr) { - len = htons(len); - _rtw_memcpy(ptr + 12, &len, 2); + be_tmp = htons(len); + _rtw_memcpy(ptr + 12, &be_tmp, 2); } } diff --git a/core/rtw_sreset.c b/core/rtw_sreset.c index 434be7c..40d82e3 100644 --- a/core/rtw_sreset.c +++ b/core/rtw_sreset.c @@ -107,7 +107,7 @@ bool sreset_inprogress(_adapter *padapter) #endif } -void sreset_restore_security_station(_adapter *padapter) +static void sreset_restore_security_station(_adapter *padapter) { u8 EntryId = 0; struct mlme_priv *mlmepriv = &padapter->mlmepriv; @@ -158,7 +158,7 @@ void sreset_restore_security_station(_adapter *padapter) } } -void sreset_restore_network_station(_adapter *padapter) +static void sreset_restore_network_station(_adapter *padapter) { struct mlme_priv *mlmepriv = &padapter->mlmepriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; @@ -225,13 +225,13 @@ void sreset_restore_network_station(_adapter *padapter) mlmeext_joinbss_event_callback(padapter, 1); /* restore Sequence No. */ - rtw_hal_set_hwreg(padapter, HW_VAR_RESTORE_HW_SEQ, 0); + rtw_hal_set_hwreg(padapter, HW_VAR_RESTORE_HW_SEQ, NULL); sreset_restore_security_station(padapter); } -void sreset_restore_network_status(_adapter *padapter) +static void sreset_restore_network_status(_adapter *padapter) { struct mlme_priv *mlmepriv = &padapter->mlmepriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; diff --git a/core/rtw_sta_mgt.c b/core/rtw_sta_mgt.c index 3541e6d..31dec86 100644 --- a/core/rtw_sta_mgt.c +++ b/core/rtw_sta_mgt.c @@ -21,14 +21,15 @@ #include -bool test_st_match_rule(_adapter *adapter, u8 *local_naddr, u8 *local_port, u8 *remote_naddr, u8 *remote_port) +static bool test_st_match_rule(_adapter *adapter, u8 *local_naddr, u8 *local_port, u8 *remote_naddr, u8 *remote_port) { - if (ntohs(*((u16 *)local_port)) == 5001 || ntohs(*((u16 *)remote_port)) == 5001) + if (ntohs(*((__be16 *)local_port)) == 5001 || + ntohs(*((__be16 *)remote_port)) == 5001) return _TRUE; return _FALSE; } -struct st_register test_st_reg = { +static struct st_register test_st_reg = { .s_proto = 0x06, .rule = test_st_match_rule, }; @@ -458,109 +459,103 @@ struct sta_info *rtw_alloc_stainfo(struct sta_priv *pstapriv, u8 *hwaddr) /* _enter_critical_bh(&(pfree_sta_queue->lock), &irqL); */ _enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL2); if (_rtw_queue_empty(pfree_sta_queue) == _TRUE) { - /* _exit_critical_bh(&(pfree_sta_queue->lock), &irqL); */ - _exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL2); psta = NULL; - } else { - psta = LIST_CONTAINOR(get_next(&pfree_sta_queue->queue), struct sta_info, list); + goto exit; + } + psta = LIST_CONTAINOR(get_next(&pfree_sta_queue->queue), struct sta_info, list); - rtw_list_delete(&(psta->list)); + rtw_list_delete(&(psta->list)); - /* _exit_critical_bh(&(pfree_sta_queue->lock), &irqL); */ + /* _exit_critical_bh(&(pfree_sta_queue->lock), &irqL); */ - tmp_aid = psta->aid; + tmp_aid = psta->aid; - _rtw_init_stainfo(psta); + _rtw_init_stainfo(psta); - psta->padapter = pstapriv->padapter; + psta->padapter = pstapriv->padapter; - _rtw_memcpy(psta->hwaddr, hwaddr, ETH_ALEN); + _rtw_memcpy(psta->hwaddr, hwaddr, ETH_ALEN); - index = wifi_mac_hash(hwaddr); + index = wifi_mac_hash(hwaddr); - if (index >= NUM_STA) { - psta = NULL; - goto exit; - } - phash_list = &(pstapriv->sta_hash[index]); + if (index >= NUM_STA) { + psta = NULL; + goto exit; + } + phash_list = &(pstapriv->sta_hash[index]); - /* _enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL2); */ + /* _enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL2); */ - rtw_list_insert_tail(&psta->hash_list, phash_list); + rtw_list_insert_tail(&psta->hash_list, phash_list); - pstapriv->asoc_sta_count++; + pstapriv->asoc_sta_count++; - /* _exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL2); */ + /* _exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL2); */ - /* Commented by Albert 2009/08/13 - * For the SMC router, the sequence number of first packet of WPS handshake will be 0. - * In this case, this packet will be dropped by recv_decache function if we use the 0x00 as the default value for tid_rxseq variable. - * So, we initialize the tid_rxseq variable as the 0xffff. */ + /* Commented by Albert 2009/08/13 + * For the SMC router, the sequence number of first packet of WPS handshake will be 0. + * In this case, this packet will be dropped by recv_decache function if we use the 0x00 as the default value for tid_rxseq variable. + * So, we initialize the tid_rxseq variable as the 0xffff. */ - for (i = 0; i < 16; i++) { - _rtw_memcpy(&psta->sta_recvpriv.rxcache.tid_rxseq[i], &wRxSeqInitialValue, 2); - _rtw_memset(&psta->sta_recvpriv.rxcache.iv[i], 0, sizeof(psta->sta_recvpriv.rxcache.iv[i])); - } + for (i = 0; i < 16; i++) { + _rtw_memcpy(&psta->sta_recvpriv.rxcache.tid_rxseq[i], &wRxSeqInitialValue, 2); + _rtw_memset(&psta->sta_recvpriv.rxcache.iv[i], 0, sizeof(psta->sta_recvpriv.rxcache.iv[i])); + } - init_addba_retry_timer(pstapriv->padapter, psta); + init_addba_retry_timer(pstapriv->padapter, psta); #ifdef CONFIG_IEEE80211W - init_dot11w_expire_timer(pstapriv->padapter, psta); + init_dot11w_expire_timer(pstapriv->padapter, psta); #endif /* CONFIG_IEEE80211W */ #ifdef CONFIG_TDLS - rtw_init_tdls_timer(pstapriv->padapter, psta); + rtw_init_tdls_timer(pstapriv->padapter, psta); #endif /* CONFIG_TDLS */ - /* for A-MPDU Rx reordering buffer control */ - for (i = 0; i < 16 ; i++) { - preorder_ctrl = &psta->recvreorder_ctrl[i]; + /* for A-MPDU Rx reordering buffer control */ + for (i = 0; i < 16 ; i++) { + preorder_ctrl = &psta->recvreorder_ctrl[i]; - preorder_ctrl->padapter = pstapriv->padapter; + preorder_ctrl->padapter = pstapriv->padapter; - preorder_ctrl->enable = _FALSE; + preorder_ctrl->enable = _FALSE; - preorder_ctrl->indicate_seq = 0xffff; + preorder_ctrl->indicate_seq = 0xffff; #ifdef DBG_RX_SEQ - RTW_INFO("DBG_RX_SEQ %s:%d IndicateSeq: %d\n", __FUNCTION__, __LINE__, - preorder_ctrl->indicate_seq); + RTW_INFO("DBG_RX_SEQ %s:%d IndicateSeq: %d\n", __FUNCTION__, __LINE__, + preorder_ctrl->indicate_seq); #endif - preorder_ctrl->wend_b = 0xffff; - /* preorder_ctrl->wsize_b = (NR_RECVBUFF-2); */ - preorder_ctrl->wsize_b = 64;/* 64; */ - preorder_ctrl->ampdu_size = RX_AMPDU_SIZE_INVALID; + preorder_ctrl->wend_b = 0xffff; + /* preorder_ctrl->wsize_b = (NR_RECVBUFF-2); */ + preorder_ctrl->wsize_b = 64;/* 64; */ + preorder_ctrl->ampdu_size = RX_AMPDU_SIZE_INVALID; - _rtw_init_queue(&preorder_ctrl->pending_recvframe_queue); - - rtw_init_recv_timer(preorder_ctrl); - } - - - /* init for DM */ - psta->rssi_stat.undecorated_smoothed_pwdb = (-1); - psta->rssi_stat.undecorated_smoothed_cck = (-1); -#ifdef CONFIG_ATMEL_RC_PATCH - psta->flag_atmel_rc = 0; -#endif - /* init for the sequence number of received management frame */ - psta->RxMgmtFrameSeqNum = 0xffff; - psta->ra_rpt_linked = _FALSE; - - rtw_alloc_macid(pstapriv->padapter, psta); + _rtw_init_queue(&preorder_ctrl->pending_recvframe_queue); + rtw_init_recv_timer(preorder_ctrl); } + + /* init for DM */ + psta->rssi_stat.undecorated_smoothed_pwdb = (-1); + psta->rssi_stat.undecorated_smoothed_cck = (-1); +#ifdef CONFIG_ATMEL_RC_PATCH + psta->flag_atmel_rc = 0; +#endif + /* init for the sequence number of received management frame */ + psta->RxMgmtFrameSeqNum = 0xffff; + psta->ra_rpt_linked = _FALSE; + + rtw_alloc_macid(pstapriv->padapter, psta); + exit: _exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL2); - if (psta) rtw_mi_update_iface_status(&(pstapriv->padapter->mlmepriv), 0); - return psta; } - /* using pstapriv->sta_hash_lock to protect */ u32 rtw_free_stainfo(_adapter *padapter , struct sta_info *psta) { diff --git a/core/rtw_xmit.c b/core/rtw_xmit.c index 57f59c0..75bbe1e 100644 --- a/core/rtw_xmit.c +++ b/core/rtw_xmit.c @@ -3707,7 +3707,7 @@ static int rtw_br_client_tx(_adapter *padapter, struct sk_buff **pskb) /* if (priv->dev->br_port && * !memcmp(skb->data+MACADDRLEN, priv->br_mac, MACADDRLEN)) { */ #if 1 - if (*((unsigned short *)(skb->data + MACADDRLEN * 2)) == __constant_htons(ETH_P_8021Q)) { + if (*((__be16 *)(skb->data + MACADDRLEN * 2)) == __constant_htons(ETH_P_8021Q)) { is_vlan_tag = 1; vlan_hdr = *((unsigned short *)(skb->data + MACADDRLEN * 2 + 2)); for (i = 0; i < 6; i++) diff --git a/hal/hal_btcoex_wifionly.c b/hal/hal_btcoex_wifionly.c index 861bcfb..077c24d 100644 --- a/hal/hal_btcoex_wifionly.c +++ b/hal/hal_btcoex_wifionly.c @@ -1,7 +1,7 @@ #include "btc/mp_precomp.h" #include -struct wifi_only_cfg GLBtCoexistWifiOnly; +static struct wifi_only_cfg GLBtCoexistWifiOnly; void halwifionly_write1byte(PVOID pwifionlyContext, u32 RegAddr, u8 Data) { diff --git a/hal/hal_mp.c b/hal/hal_mp.c index 8ddb33e..84d5726 100644 --- a/hal/hal_mp.c +++ b/hal/hal_mp.c @@ -53,7 +53,7 @@ #endif /* !RTW_HALMAC */ -u8 MgntQuery_NssTxRate(u16 Rate) +static u8 MgntQuery_NssTxRate(u16 Rate) { u8 NssNum = RF_TX_NUM_NONIMPLEMENT; @@ -349,7 +349,7 @@ void hal_mpt_SetBandwidth(PADAPTER pAdapter) hal_mpt_SwitchRfSetting(pAdapter); } -void mpt_SetTxPower_Old(PADAPTER pAdapter, MPT_TXPWR_DEF Rate, u8 *pTxPower) +static void mpt_SetTxPower_Old(PADAPTER pAdapter, MPT_TXPWR_DEF Rate, u8 *pTxPower) { switch (Rate) { case MPT_CCK: { @@ -407,7 +407,7 @@ void mpt_SetTxPower_Old(PADAPTER pAdapter, MPT_TXPWR_DEF Rate, u8 *pTxPower) RTW_INFO("<===mpt_SetTxPower_Old()\n"); } -void +static void mpt_SetTxPower( PADAPTER pAdapter, MPT_TXPWR_DEF Rate, @@ -1263,7 +1263,7 @@ void mpt_SetRFPath_8723D(PADAPTER pAdapter) } #endif -VOID mpt_SetRFPath_819X(PADAPTER pAdapter) +static void mpt_SetRFPath_819X(PADAPTER pAdapter) { HAL_DATA_TYPE *pHalData = GET_HAL_DATA(pAdapter); PMPT_CONTEXT pMptCtx = &(pAdapter->mppriv.mpt_ctx); diff --git a/hal/hal_usb.c b/hal/hal_usb.c index 25ddb60..43a8170 100644 --- a/hal/hal_usb.c +++ b/hal/hal_usb.c @@ -249,9 +249,9 @@ int usb_async_write8(struct intf_hdl *pintfhdl, u32 addr, u8 val) return ret; } -int usb_async_write16(struct intf_hdl *pintfhdl, u32 addr, u16 val) +int usb_async_write16(struct intf_hdl *pintfhdl, u32 addr, __le16 val) { - u16 data; + __le16 data; int ret; struct dvobj_priv *pdvobjpriv = (struct dvobj_priv *)pintfhdl->pintf_dev; struct usb_device *udev = pdvobjpriv->pusbdev; @@ -304,7 +304,7 @@ u16 usb_read16(struct intf_hdl *pintfhdl, u32 addr) u16 wvalue; u16 index; u16 len; - u16 data = 0; + __le16 data = 0; request = 0x05; requesttype = 0x01;/* read_in */ @@ -315,8 +315,7 @@ u16 usb_read16(struct intf_hdl *pintfhdl, u32 addr) usbctrl_vendorreq(pintfhdl, request, wvalue, index, &data, len, requesttype); - return data; - + return le16_to_cpu(data); } u32 usb_read32(struct intf_hdl *pintfhdl, u32 addr) @@ -326,7 +325,7 @@ u32 usb_read32(struct intf_hdl *pintfhdl, u32 addr) u16 wvalue; u16 index; u16 len; - u32 data = 0; + __le32 data = 0; request = 0x05; requesttype = 0x01;/* read_in */ @@ -337,7 +336,7 @@ u32 usb_read32(struct intf_hdl *pintfhdl, u32 addr) usbctrl_vendorreq(pintfhdl, request, wvalue, index, &data, len, requesttype); - return data; + return le32_to_cpu(data); } int usb_write8(struct intf_hdl *pintfhdl, u32 addr, u8 val) @@ -364,14 +363,14 @@ int usb_write8(struct intf_hdl *pintfhdl, u32 addr, u8 val) return ret; } -int usb_write16(struct intf_hdl *pintfhdl, u32 addr, u16 val) +int usb_write16(struct intf_hdl *pintfhdl, u32 addr, __le16 val) { u8 request; u8 requesttype; u16 wvalue; u16 index; u16 len; - u16 data; + __le16 data; int ret; request = 0x05; @@ -389,14 +388,14 @@ int usb_write16(struct intf_hdl *pintfhdl, u32 addr, u16 val) } -int usb_write32(struct intf_hdl *pintfhdl, u32 addr, u32 val) +int usb_write32(struct intf_hdl *pintfhdl, u32 addr, __le32 val) { u8 request; u8 requesttype; u16 wvalue; u16 index; u16 len; - u32 data; + __le32 data; int ret; request = 0x05; diff --git a/hal/hal_usb_led.c b/hal/hal_usb_led.c index b22455b..a0f6b01 100644 --- a/hal/hal_usb_led.c +++ b/hal/hal_usb_led.c @@ -26,7 +26,7 @@ * Implementation of LED blinking behavior. * It toggle off LED and schedule corresponding timer if necessary. * */ -void +static void SwLedBlink( PLED_USB pLed ) @@ -116,7 +116,7 @@ SwLedBlink( } } -void +static void SwLedBlink1( PLED_USB pLed ) @@ -293,7 +293,7 @@ SwLedBlink1( } -void +static void SwLedBlink2( PLED_USB pLed ) @@ -379,7 +379,7 @@ SwLedBlink2( } -void +static void SwLedBlink3( PLED_USB pLed ) @@ -505,7 +505,7 @@ SwLedBlink3( } -void +static void SwLedBlink4( PLED_USB pLed ) @@ -693,7 +693,7 @@ SwLedBlink4( } -void +static void SwLedBlink5( PLED_USB pLed ) @@ -783,7 +783,7 @@ SwLedBlink5( } -void +static void SwLedBlink6( PLED_USB pLed ) @@ -801,7 +801,7 @@ SwLedBlink6( } -void +static void SwLedBlink7( PLED_USB pLed ) @@ -890,7 +890,7 @@ SwLedBlink7( } -void +static void SwLedBlink8( PLED_USB pLed ) @@ -908,7 +908,7 @@ SwLedBlink8( } /* page added for Belkin AC950. 20120813 */ -void +static void SwLedBlink9( PLED_USB pLed ) @@ -1144,7 +1144,7 @@ SwLedBlink9( } /* page added for Netgear A6200V2. 20120827 */ -void +static void SwLedBlink10( PLED_USB pLed ) @@ -1340,11 +1340,9 @@ SwLedBlink10( default: break; } - - } -void +static void SwLedBlink11( PLED_USB pLed ) @@ -1415,7 +1413,7 @@ SwLedBlink11( } -void +static void SwLedBlink12( PLED_USB pLed ) @@ -1483,7 +1481,7 @@ SwLedBlink12( } -VOID +static void SwLedBlink13( IN PLED_USB pLed ) @@ -1544,7 +1542,7 @@ SwLedBlink13( } -VOID +static void SwLedBlink14( IN PLED_USB pLed ) @@ -1601,7 +1599,7 @@ SwLedBlink14( } -VOID +static void SwLedBlink15( IN PLED_USB pLed ) @@ -2914,7 +2912,7 @@ SwLedControlMode6( } /* Netgear, added by sinda, 2011/11/11 */ -void +static void SwLedControlMode7( PADAPTER Adapter, LED_CTL_MODE LedAction @@ -3053,7 +3051,7 @@ SwLedControlMode7( } -void +static void SwLedControlMode8( PADAPTER Adapter, LED_CTL_MODE LedAction @@ -3090,7 +3088,7 @@ SwLedControlMode8( } /* page added for Belkin AC950, 20120813 */ -void +static void SwLedControlMode9( IN PADAPTER Adapter, IN LED_CTL_MODE LedAction @@ -3392,7 +3390,7 @@ SwLedControlMode9( } /* page added for Netgear A6200V2, 20120827 */ -void +static void SwLedControlMode10( PADAPTER Adapter, LED_CTL_MODE LedAction @@ -3590,7 +3588,7 @@ SwLedControlMode10( } /* Edimax-ASUS, added by Page, 20121221 */ -void +static void SwLedControlMode11( PADAPTER Adapter, LED_CTL_MODE LedAction @@ -3689,7 +3687,7 @@ SwLedControlMode11( /* page added for NEC */ -VOID +static void SwLedControlMode12( PADAPTER Adapter, LED_CTL_MODE LedAction @@ -3770,7 +3768,7 @@ SwLedControlMode12( /* Maddest add for NETGEAR R6100 */ -VOID +static void SwLedControlMode13( IN PADAPTER Adapter, IN LED_CTL_MODE LedAction @@ -3916,7 +3914,7 @@ SwLedControlMode13( /* Maddest add for DNI Buffalo */ -VOID +static void SwLedControlMode14( IN PADAPTER Adapter, IN LED_CTL_MODE LedAction @@ -3975,7 +3973,7 @@ SwLedControlMode14( /* Maddest add for Dlink */ -VOID +static void SwLedControlMode15( IN PADAPTER Adapter, IN LED_CTL_MODE LedAction diff --git a/hal/rtl8188e_cmd.c b/hal/rtl8188e_cmd.c index 847525b..716206a 100644 --- a/hal/rtl8188e_cmd.c +++ b/hal/rtl8188e_cmd.c @@ -148,7 +148,7 @@ exit: return ret; } -u8 rtl8192c_h2c_msg_hdl(_adapter *padapter, unsigned char *pbuf) +static u8 rtl8192c_h2c_msg_hdl(_adapter *padapter, unsigned char *pbuf) { u8 ElementID, CmdLen; u8 *pCmdBuffer; @@ -190,10 +190,9 @@ u8 rtl8188e_set_rssi_cmd(_adapter *padapter, u8 *param) return _FAIL; } - *((u32 *) param) = cpu_to_le32(*((u32 *) param)); + *((__le32 *) param) = cpu_to_le32(*((u32 *) param)); FillH2CCmd_88E(padapter, H2C_RSSI_REPORT, 3, param); - return res; } @@ -320,11 +319,11 @@ void rtl8188e_set_FwPwrMode_cmd(PADAPTER padapter, u8 Mode) } -void ConstructBeacon(_adapter *padapter, u8 *pframe, u32 *pLength) +static void ConstructBeacon(_adapter *padapter, u8 *pframe, u32 *pLength) { struct rtw_ieee80211_hdr *pwlanhdr; - u16 *fctrl; - u32 rate_len, pktlen; + __le16 *fctrl; + u32 rate_len, pktlen; struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); WLAN_BSSID_EX *cur_network = &(pmlmeinfo->network); @@ -417,11 +416,11 @@ _ConstructBeacon: } -void ConstructPSPoll(_adapter *padapter, u8 *pframe, u32 *pLength) +static void ConstructPSPoll(_adapter *padapter, u8 *pframe, u32 *pLength) { struct rtw_ieee80211_hdr *pwlanhdr; - u16 *fctrl; - u32 pktlen; + __le16 *fctrl; + u32 pktlen; struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); @@ -447,7 +446,7 @@ void ConstructPSPoll(_adapter *padapter, u8 *pframe, u32 *pLength) *pLength = 16; } -void ConstructNullFunctionData( +static void ConstructNullFunctionData( PADAPTER padapter, u8 *pframe, u32 *pLength, @@ -458,8 +457,8 @@ void ConstructNullFunctionData( u8 bForcePowerSave) { struct rtw_ieee80211_hdr *pwlanhdr; - u16 *fctrl; - u32 pktlen; + __le16 *fctrl; + u32 pktlen; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct wlan_network *cur_network = &pmlmepriv->cur_network; struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); @@ -517,7 +516,7 @@ void ConstructNullFunctionData( *pLength = pktlen; } -void rtl8188e_set_FwRsvdPage_cmd(PADAPTER padapter, PRSVDPAGE_LOC rsvdpageloc) +static void rtl8188e_set_FwRsvdPage_cmd(PADAPTER padapter, PRSVDPAGE_LOC rsvdpageloc) { u8 u1H2CRsvdPageParm[H2C_RSVDPAGE_LOC_LEN] = {0}; u8 u1H2CAoacRsvdPageParm[H2C_AOAC_RSVDPAGE_LOC_LEN] = {0}; diff --git a/hal/rtl8188e_hal_init.c b/hal/rtl8188e_hal_init.c index 4abdc41..310ba88 100644 --- a/hal/rtl8188e_hal_init.c +++ b/hal/rtl8188e_hal_init.c @@ -251,7 +251,7 @@ exit: rtw_mfree2d((void *)eFuseWord, EFUSE_MAX_SECTION_88E, EFUSE_MAX_WORD_UNIT, sizeof(u16)); } -void efuse_read_phymap_from_txpktbuf( +static void efuse_read_phymap_from_txpktbuf( ADAPTER *adapter, int bcnhead, /* beacon head, where FW store len(2-byte) and efuse physical map. */ u8 *content, /* buffer to store efuse physical map */ @@ -323,11 +323,11 @@ void efuse_read_phymap_from_txpktbuf( lenc[0] = rtw_read8(adapter, REG_PKTBUF_DBG_DATA_L); lenc[1] = rtw_read8(adapter, REG_PKTBUF_DBG_DATA_L + 1); - aaabak = le16_to_cpup((u16 *)lenc); - lenbak = le16_to_cpu(*((u16 *)lenc)); - aaa = le16_to_cpup((u16 *)&lo32); + aaabak = le16_to_cpup((__le16 *)lenc); + lenbak = le16_to_cpu(*((__le16 *)lenc)); + aaa = le16_to_cpup((__le16 *)&lo32); #endif - len = le16_to_cpu(*((u16 *)&lo32)); + len = le16_to_cpu(*((__le16 *)&lo32)); limit = (len - 2 < limit) ? len - 2 : limit; @@ -445,7 +445,7 @@ static s32 iol_ioconfig( return rst; } -int rtl8188e_IOL_exec_cmds_sync(ADAPTER *adapter, struct xmit_frame *xmit_frame, u32 max_wating_ms, u32 bndy_cnt) +static int rtl8188e_IOL_exec_cmds_sync(ADAPTER *adapter, struct xmit_frame *xmit_frame, u32 max_wating_ms, u32 bndy_cnt) { u32 start_time = rtw_get_current_time(); @@ -733,7 +733,7 @@ exit: return ret; } -void _MCUIO_Reset88E(PADAPTER padapter, u8 bReset) +static void _MCUIO_Reset88E(PADAPTER padapter, u8 bReset) { u8 u1bTmp; @@ -968,8 +968,9 @@ s32 rtl8188e_FirmwareDownload(PADAPTER padapter, BOOLEAN bUsedWoWLANFw) pHalData->FirmwareSignature = le16_to_cpu(pFwHdr->Signature); RTW_INFO("%s: fw_ver=%x fw_subver=%04x sig=0x%x, Month=%02x, Date=%02x, Hour=%02x, Minute=%02x\n", - __FUNCTION__, pHalData->firmware_version, pHalData->firmware_sub_version, pHalData->FirmwareSignature - , pFwHdr->Month, pFwHdr->Date, pFwHdr->Hour, pFwHdr->Minute); + __func__, pHalData->firmware_version, + pHalData->firmware_sub_version, pHalData->FirmwareSignature, + pFwHdr->Month, pFwHdr->Date, pFwHdr->Hour, pFwHdr->Minute); if (IS_FW_HEADER_EXIST_88E(pFwHdr)) { /* Shift 32 bytes for FW header */ @@ -1466,7 +1467,7 @@ rtl8188e_ReadEFuse( } /* Do not support BT */ -VOID +static void Hal_EFUSEGetEfuseDefinition88E( IN PADAPTER pAdapter, IN u1Byte efuseType, @@ -1525,7 +1526,8 @@ Hal_EFUSEGetEfuseDefinition88E( break; } } -VOID + +static void Hal_EFUSEGetEfuseDefinition_Pseudo88E( IN PADAPTER pAdapter, IN u8 efuseType, @@ -2497,7 +2499,8 @@ void rtl8188e_stop_thread(_adapter *padapter) #endif #endif } -void hal_notch_filter_8188e(_adapter *adapter, bool enable) + +static void hal_notch_filter_8188e(_adapter *adapter, bool enable) { if (enable) { RTW_INFO("Enable notch filter\n"); @@ -2508,7 +2511,7 @@ void hal_notch_filter_8188e(_adapter *adapter, bool enable) } } -void update_ra_mask_8188e(_adapter *padapter, struct sta_info *psta, struct macid_cfg *h2c_macid_cfg) +static void update_ra_mask_8188e(_adapter *padapter, struct sta_info *psta, struct macid_cfg *h2c_macid_cfg) { HAL_DATA_TYPE *hal_data = GET_HAL_DATA(padapter); @@ -2679,7 +2682,7 @@ u8 GetEEPROMSize8188E(PADAPTER padapter) * LLT R/W/Init function * * ------------------------------------------------------------------------- */ -s32 _LLTWrite(PADAPTER padapter, u32 address, u32 data) +static s32 _LLTWrite(PADAPTER padapter, u32 address, u32 data) { s32 status = _SUCCESS; s8 count = POLLING_LLT_THRESHOLD; @@ -2702,7 +2705,7 @@ s32 _LLTWrite(PADAPTER padapter, u32 address, u32 data) return status; } -u8 _LLTRead(PADAPTER padapter, u32 address) +static u8 _LLTRead(PADAPTER padapter, u32 address) { s32 count = POLLING_LLT_THRESHOLD; u32 value = _LLT_INIT_ADDR(address) | _LLT_OP(_LLT_READ_ACCESS); @@ -2815,7 +2818,7 @@ Hal_EfuseParseIDCode88E( /* Checl 0x8129 again for making sure autoload status!! */ - EEPROMId = le16_to_cpu(*((u16 *)hwinfo)); + EEPROMId = le16_to_cpu(*((__le16 *)hwinfo)); if (EEPROMId != RTL_EEPROM_ID) { RTW_INFO("EEPROM ID(%#x) is invalid!!\n", EEPROMId); pHalData->bautoload_fail_flag = _TRUE; @@ -4583,7 +4586,7 @@ struct bcn_qinfo_88e { u16 pkt_num:8; }; -void dump_qinfo_88e(void *sel, struct qinfo_88e *info, const char *tag) +static void dump_qinfo_88e(void *sel, struct qinfo_88e *info, const char *tag) { /* if (info->pkt_num) */ RTW_PRINT_SEL(sel, "%shead:0x%02x, tail:0x%02x, pkt_num:%u, macid:%u, ac:%u\n" @@ -4591,7 +4594,7 @@ void dump_qinfo_88e(void *sel, struct qinfo_88e *info, const char *tag) ); } -void dump_bcn_qinfo_88e(void *sel, struct bcn_qinfo_88e *info, const char *tag) +static void dump_bcn_qinfo_88e(void *sel, struct bcn_qinfo_88e *info, const char *tag) { /* if (info->pkt_num) */ RTW_PRINT_SEL(sel, "%shead:0x%02x, pkt_num:%u\n" @@ -4599,7 +4602,7 @@ void dump_bcn_qinfo_88e(void *sel, struct bcn_qinfo_88e *info, const char *tag) ); } -void dump_mac_qinfo_88e(void *sel, _adapter *adapter) +static void dump_mac_qinfo_88e(void *sel, _adapter *adapter) { u32 q0_info; u32 q1_info; @@ -4693,7 +4696,8 @@ void GetHwReg8188E(_adapter *adapter, u8 variable, u8 *val) } } -void hal_ra_info_dump(_adapter *padapter , void *sel) + +static void hal_ra_info_dump(_adapter *padapter , void *sel) { int i; u8 mac_id; diff --git a/hal/rtl8188e_xmit.c b/hal/rtl8188e_xmit.c index cf345be..ecddd8d 100644 --- a/hal/rtl8188e_xmit.c +++ b/hal/rtl8188e_xmit.c @@ -290,7 +290,7 @@ void fill_txdesc_force_bmc_camid(struct pkt_attrib *pattrib, struct tx_desc *ptx void rtl8188e_cal_txdesc_chksum(struct tx_desc *ptxdesc) { - u16 *usPtr = (u16 *)ptxdesc; + __le16 *usPtr = (__le16 *)ptxdesc; u32 count = 16; /* (32 bytes / 2 bytes per XOR) => 16 times */ u32 index; u16 checksum = 0; diff --git a/include/hal_data.h b/include/hal_data.h index 17fd4c9..77db350 100755 --- a/include/hal_data.h +++ b/include/hal_data.h @@ -1053,5 +1053,17 @@ extern int new_bcn_max; extern u8 REALTEK_96B_IE[]; extern unsigned char WPA_TKIP_CIPHER[4]; extern unsigned char RSN_TKIP_CIPHER[4]; +extern char *rtw_initmac; +#ifdef CONFIG_TX_MCAST2UNI +extern int rtw_mc2u_disable; +#endif +#ifdef CONFIG_80211N_HT +extern int rtw_ht_enable; +extern int rtw_bw_mode; +extern int rtw_ampdu_enable;/* for enable tx_ampdu */ +#endif + +int pm_netdev_open(struct net_device *pnetdev, u8 bnormal); +void netdev_br_init(struct net_device *netdev); #endif /* __HAL_DATA_H__ */ diff --git a/include/rtl8188e_hal.h b/include/rtl8188e_hal.h index ebc402b..0c999ed 100644 --- a/include/rtl8188e_hal.h +++ b/include/rtl8188e_hal.h @@ -82,12 +82,12 @@ typedef struct _RT_8188E_FIRMWARE_HDR { /* 8-byte alinment required */ /* --- LONG WORD 0 ---- */ - u16 Signature; /* 92C0: test chip; 92C, 88C0: test chip; 88C1: MP A-cut; 92C1: MP A-cut */ + __le16 Signature; /* 92C0: test chip; 92C, 88C0: test chip; 88C1: MP A-cut; 92C1: MP A-cut */ u8 Category; /* AP/NIC and USB/PCI */ u8 Function; /* Reserved for different FW function indcation, for further use when driver needs to download different FW in different conditions */ - u16 Version; /* FW Version */ + __le16 Version; /* FW Version */ u8 Subversion; /* FW Subversion, default 0x00 */ - u16 Rsvd1; + __le16 Rsvd1; /* --- LONG WORD 1 ---- */ @@ -95,17 +95,17 @@ typedef struct _RT_8188E_FIRMWARE_HDR { u8 Date; /* Release time Date field */ u8 Hour; /* Release time Hour field */ u8 Minute; /* Release time Minute field */ - u16 RamCodeSize; /* The size of RAM code */ + __le16 RamCodeSize; /* The size of RAM code */ u8 Foundry; u8 Rsvd2; /* --- LONG WORD 2 ---- */ - u32 SvnIdx; /* The SVN entry index */ - u32 Rsvd3; + __le32 SvnIdx; /* The SVN entry index */ + __le32 Rsvd3; /* --- LONG WORD 3 ---- */ - u32 Rsvd4; - u32 Rsvd5; + __le32 Rsvd4; + __le32 Rsvd5; } RT_8188E_FIRMWARE_HDR, *PRT_8188E_FIRMWARE_HDR; #endif /* download firmware related data structure */ diff --git a/include/rtw_debug.h b/include/rtw_debug.h index 206a443..c235d1b 100644 --- a/include/rtw_debug.h +++ b/include/rtw_debug.h @@ -68,9 +68,7 @@ enum { #ifdef CONFIG_RTW_DEBUG -#ifndef _OS_INTFS_C_ extern uint rtw_drv_log_level; -#endif #if defined(_dbgdump) diff --git a/include/rtw_io.h b/include/rtw_io.h index b01d4ef..b20ae5f 100644 --- a/include/rtw_io.h +++ b/include/rtw_io.h @@ -91,8 +91,8 @@ struct io_queue; struct _io_ops { u8(*_read8)(struct intf_hdl *pintfhdl, u32 addr); - __le16(*_read16)(struct intf_hdl *pintfhdl, u32 addr); - __le32(*_read32)(struct intf_hdl *pintfhdl, u32 addr); + u16(*_read16)(struct intf_hdl *pintfhdl, u32 addr); + u32(*_read32)(struct intf_hdl *pintfhdl, u32 addr); int (*_write8)(struct intf_hdl *pintfhdl, u32 addr, u8 val); int (*_write16)(struct intf_hdl *pintfhdl, u32 addr, __le16 val); diff --git a/include/sta_info.h b/include/sta_info.h index 02844b7..951c0f0 100644 --- a/include/sta_info.h +++ b/include/sta_info.h @@ -159,9 +159,9 @@ struct stainfo_stats { struct session_tracker { _list list; /* session_tracker_queue */ u32 local_naddr; - u16 local_port; + __be16 local_port; u32 remote_naddr; - u16 remote_port; + __be16 remote_port; u32 set_time; u8 status; }; diff --git a/include/usb_ops_linux.h b/include/usb_ops_linux.h index adf0750..f2d860c 100644 --- a/include/usb_ops_linux.h +++ b/include/usb_ops_linux.h @@ -66,8 +66,8 @@ #ifdef CONFIG_USB_SUPPORT_ASYNC_VDN_REQ int usb_async_write8(struct intf_hdl *pintfhdl, u32 addr, u8 val); -int usb_async_write16(struct intf_hdl *pintfhdl, u32 addr, u16 val); -int usb_async_write32(struct intf_hdl *pintfhdl, u32 addr, u32 val); +int usb_async_write16(struct intf_hdl *pintfhdl, u32 addr, __le16 val); +int usb_async_write32(struct intf_hdl *pintfhdl, u32 addr, __le32 val); #endif /* CONFIG_USB_SUPPORT_ASYNC_VDN_REQ */ unsigned int ffaddr2pipehdl(struct dvobj_priv *pdvobj, u32 addr); @@ -90,8 +90,8 @@ u8 usb_read8(struct intf_hdl *pintfhdl, u32 addr); u16 usb_read16(struct intf_hdl *pintfhdl, u32 addr); u32 usb_read32(struct intf_hdl *pintfhdl, u32 addr); int usb_write8(struct intf_hdl *pintfhdl, u32 addr, u8 val); -int usb_write16(struct intf_hdl *pintfhdl, u32 addr, u16 val); -int usb_write32(struct intf_hdl *pintfhdl, u32 addr, u32 val); +int usb_write16(struct intf_hdl *pintfhdl, u32 addr, __le16 val); +int usb_write32(struct intf_hdl *pintfhdl, u32 addr, __le32 val); int usb_writeN(struct intf_hdl *pintfhdl, u32 addr, u32 length, u8 *pdata); u32 usb_read_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *rmem); void usb_recv_tasklet(void *priv); diff --git a/os_dep/ioctl_mp.c b/os_dep/ioctl_mp.c index b7109f9..2a8c533 100644 --- a/os_dep/ioctl_mp.c +++ b/os_dep/ioctl_mp.c @@ -48,8 +48,10 @@ int rtw_mp_write_reg(struct net_device *dev, u32 addr, data; int ret; PADAPTER padapter = rtw_netdev_priv(dev); - char input[wrqu->length]; + char input[128]; + if (wrqu->length > 128) + return -EFAULT; if (copy_from_user(input, wrqu->pointer, wrqu->length)) return -EFAULT; @@ -130,7 +132,7 @@ int rtw_mp_read_reg(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrqu, char *extra) { - char input[wrqu->length]; + char input[128]; char *pch, *pnext, *ptmp; char *width_str; char width; @@ -262,9 +264,10 @@ int rtw_mp_write_rf(struct net_device *dev, u32 path, addr, data; int ret; PADAPTER padapter = rtw_netdev_priv(dev); - char input[wrqu->length]; - + char input[128]; + if (wrqu->length > 128) + return -EFAULT; _rtw_memset(input, 0, wrqu->length); if (copy_from_user(input, wrqu->pointer, wrqu->length)) return -EFAULT; @@ -304,7 +307,7 @@ int rtw_mp_read_rf(struct net_device *dev, struct iw_request_info *info, struct iw_point *wrqu, char *extra) { - char input[wrqu->length]; + char input[128]; char *pch, *pnext, *ptmp; char data[20], tmp[20], buf[3]; u32 path, addr, strtou; @@ -412,10 +415,12 @@ int rtw_mp_rate(struct net_device *dev, struct iw_point *wrqu, char *extra) { u32 rate = MPT_RATE_1M; - u8 input[wrqu->length]; + u8 input[128]; PADAPTER padapter = rtw_netdev_priv(dev); PMPT_CONTEXT pMptCtx = &(padapter->mppriv.mpt_ctx); + if (wrqu->length > 128) + return -EFAULT; if (copy_from_user(input, wrqu->pointer, wrqu->length)) return -EFAULT; @@ -460,10 +465,12 @@ int rtw_mp_channel(struct net_device *dev, PADAPTER padapter = rtw_netdev_priv(dev); HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); - u8 input[wrqu->length]; + u8 input[128]; u32 channel = 1; int cur_ch_offset; + if (wrqu->length > 128) + return -EFAULT; if (copy_from_user(input, wrqu->pointer, wrqu->length)) return -EFAULT; @@ -488,8 +495,10 @@ int rtw_mp_bandwidth(struct net_device *dev, int cur_ch_offset; PADAPTER padapter = rtw_netdev_priv(dev); HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); - u8 input[wrqu->length]; + u8 input[128]; + if (wrqu->length > 128) + return -EFAULT; if (copy_from_user(input, wrqu->pointer, wrqu->length)) return -EFAULT; @@ -521,7 +530,7 @@ int rtw_mp_txpower_index(struct net_device *dev, struct iw_point *wrqu, char *extra) { PADAPTER padapter = rtw_netdev_priv(dev); - char input[wrqu->length]; + char input[128]; u32 rfpath; u32 txpower_inx; @@ -546,11 +555,13 @@ int rtw_mp_txpower(struct net_device *dev, { u32 idx_a = 0, idx_b = 0, idx_c = 0, idx_d = 0, status = 0; int MsetPower = 1; - u8 input[wrqu->length]; + u8 input[128]; PADAPTER padapter = rtw_netdev_priv(dev); PMPT_CONTEXT pMptCtx = &(padapter->mppriv.mpt_ctx); + if (wrqu->length > 128) + return -EFAULT; if (copy_from_user(input, wrqu->pointer, wrqu->length)) return -EFAULT; @@ -584,11 +595,13 @@ int rtw_mp_ant_tx(struct net_device *dev, struct iw_point *wrqu, char *extra) { u8 i; - u8 input[wrqu->length]; + u8 input[128]; u16 antenna = 0; PADAPTER padapter = rtw_netdev_priv(dev); HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); + if (wrqu->length > 128) + return -EFAULT; if (copy_from_user(input, wrqu->pointer, wrqu->length)) return -EFAULT; @@ -630,10 +643,12 @@ int rtw_mp_ant_rx(struct net_device *dev, { u8 i; u16 antenna = 0; - u8 input[wrqu->length]; + u8 input[128]; PADAPTER padapter = rtw_netdev_priv(dev); HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); + if (wrqu->length > 128) + return -EFAULT; if (copy_from_user(input, wrqu->pointer, wrqu->length)) return -EFAULT; /*RTW_INFO("%s: input=%s\n", __func__, input);*/ @@ -806,9 +821,11 @@ int rtw_mp_disable_bt_coexist(struct net_device *dev, HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); struct hal_ops *pHalFunc = &padapter->hal_func; - u8 input[wrqu->data.length]; + u8 input[128]; u32 bt_coexist; + if (wrqu->data.length > 128) + return -EFAULT; if (copy_from_user(input, wrqu->data.pointer, wrqu->data.length)) return -EFAULT; @@ -840,13 +857,15 @@ int rtw_mp_arx(struct net_device *dev, { int bStartRx = 0, bStopRx = 0, bQueryPhy = 0, bQueryMac = 0, bSetBssid = 0; int bmac_filter = 0, bfilter_init = 0, bmon = 0, bSmpCfg = 0, bloopbk = 0; - u8 input[wrqu->length]; - char *pch, *ptmp, *token, *tmp[2] = {0x00, 0x00}; + u8 input[128]; + char *pch, *ptmp, *token, *tmp[2] = {NULL, NULL}; u32 i = 0, ii = 0, jj = 0, kk = 0, cnts = 0, ret; PADAPTER padapter = rtw_netdev_priv(dev); struct mp_priv *pmppriv = &padapter->mppriv; struct dbg_rx_counter rx_counter; + if (wrqu->length > 128) + return -EFAULT; if (copy_from_user(input, wrqu->pointer, wrqu->length)) return -EFAULT; @@ -1019,8 +1038,10 @@ int rtw_mp_pwrtrk(struct net_device *dev, s32 ret; PADAPTER padapter = rtw_netdev_priv(dev); HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); - u8 input[wrqu->length]; + u8 input[128]; + if (wrqu->length > 128) + return -EFAULT; if (copy_from_user(input, wrqu->pointer, wrqu->length)) return -EFAULT; @@ -1057,8 +1078,10 @@ int rtw_mp_psd(struct net_device *dev, struct iw_point *wrqu, char *extra) { PADAPTER padapter = rtw_netdev_priv(dev); - u8 input[wrqu->length]; + u8 input[128]; + if (wrqu->length > 128) + return -EFAULT; if (copy_from_user(input, wrqu->pointer, wrqu->length)) return -EFAULT; @@ -1170,13 +1193,15 @@ int rtw_mp_dump(struct net_device *dev, struct mp_priv *pmp_priv; struct pkt_attrib *pattrib; u32 value; - u8 input[wrqu->length]; + u8 input[128]; u8 rf_type, path_nums = 0; u32 i, j = 1, path; PADAPTER padapter = rtw_netdev_priv(dev); pmp_priv = &padapter->mppriv; + if (wrqu->length > 128) + return -EFAULT; if (copy_from_user(input, wrqu->pointer, wrqu->length)) return -EFAULT; @@ -1196,9 +1221,11 @@ int rtw_mp_phypara(struct net_device *dev, PADAPTER padapter = rtw_netdev_priv(dev); HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); - char input[wrqu->length]; + char input[128]; u32 valxcap, ret; + if (wrqu->length > 128) + return -EFAULT; if (copy_from_user(input, wrqu->pointer, wrqu->length)) return -EFAULT; @@ -1222,9 +1249,11 @@ int rtw_mp_SetRFPath(struct net_device *dev, struct iw_point *wrqu, char *extra) { PADAPTER padapter = rtw_netdev_priv(dev); - char input[wrqu->length]; + char input[128]; int bMain = 1, bTurnoff = 1; + if (wrqu->length > 128) + return -EFAULT; RTW_INFO("%s:iwpriv in=%s\n", __func__, input); if (copy_from_user(input, wrqu->pointer, wrqu->length)) @@ -1261,11 +1290,12 @@ int rtw_mp_QueryDrv(struct net_device *dev, union iwreq_data *wrqu, char *extra) { PADAPTER padapter = rtw_netdev_priv(dev); - char input[wrqu->data.length]; + char input[128]; int qAutoLoad = 1; - PHAL_DATA_TYPE pHalData = GET_HAL_DATA(padapter); + if (wrqu->data.length > 128) + return -EFAULT; if (copy_from_user(input, wrqu->data.pointer, wrqu->data.length)) return -EFAULT; RTW_INFO("%s:iwpriv in=%s\n", __func__, input); @@ -1290,9 +1320,11 @@ int rtw_mp_PwrCtlDM(struct net_device *dev, struct iw_point *wrqu, char *extra) { PADAPTER padapter = rtw_netdev_priv(dev); - u8 input[wrqu->length]; + u8 input[128]; int bstart = 1; + if (wrqu->length > 128) + return -EFAULT; if (copy_from_user(input, wrqu->pointer, wrqu->length)) return -EFAULT; @@ -1932,8 +1964,10 @@ int rtw_mp_hwtx(struct net_device *dev, PMPT_CONTEXT pMptCtx = &(padapter->mppriv.mpt_ctx); #if defined(CONFIG_RTL8814A) || defined(CONFIG_RTL8821B) || defined(CONFIG_RTL8822B) || defined(CONFIG_RTL8821C) - u8 input[wrqu->data.length]; + u8 input[128]; + if (wrqu->data.length > 128) + return -EFAULT; if (copy_from_user(input, wrqu->data.pointer, wrqu->data.length)) return -EFAULT; @@ -2092,6 +2126,8 @@ int rtw_mp_SetBT(struct net_device *dev, u32 i = 0, ii = 0, jj = 0, kk = 0, cnts = 0, status = 0; PRT_MP_FIRMWARE pBTFirmware = NULL; + if (wrqu->data.length > 128) + return -EFAULT; if (copy_from_user(extra, wrqu->data.pointer, wrqu->data.length)) return -EFAULT; if (strlen(extra) < 1) diff --git a/os_dep/os_intfs.c b/os_dep/os_intfs.c index 39de2c2..1cf03fb 100644 --- a/os_dep/os_intfs.c +++ b/os_dep/os_intfs.c @@ -21,6 +21,7 @@ #include #include +#include MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("Realtek Wireless Lan Driver"); @@ -28,45 +29,45 @@ MODULE_AUTHOR("Realtek Semiconductor Corp."); MODULE_VERSION(DRIVERVERSION); /* module param defaults */ -int rtw_chip_version = 0x00; -int rtw_rfintfs = HWPI; -int rtw_lbkmode = 0;/* RTL8712_AIR_TRX; */ -int rtw_network_mode = Ndis802_11IBSS;/* Ndis802_11Infrastructure; */ /* infra, ad-hoc, auto */ +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 */ /* NDIS_802_11_SSID ssid; */ -int rtw_channel = 1;/* ad-hoc support requirement */ -int rtw_wireless_mode = WIRELESS_MODE_MAX; -int rtw_vrtl_carrier_sense = AUTO_VCS; -int rtw_vcs_type = RTS_CTS; -int rtw_rts_thresh = 2347; -int rtw_frag_thresh = 2346; -int rtw_preamble = PREAMBLE_LONG;/* long, short, auto */ -int rtw_scan_mode = 1;/* active, passive */ -int rtw_adhoc_tx_pwr = 1; -int rtw_soft_ap = 0; +static int rtw_channel = 1;/* ad-hoc support requirement */ +static int rtw_wireless_mode = WIRELESS_MODE_MAX; +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_adhoc_tx_pwr = 1; +static int rtw_soft_ap = 0; /* int smart_ps = 1; */ #ifdef CONFIG_POWER_SAVING - int rtw_power_mgnt = PS_MODE_MAX; + static int rtw_power_mgnt = PS_MODE_MAX; #ifdef CONFIG_IPS_LEVEL_2 - int rtw_ips_mode = IPS_LEVEL_2; + static int rtw_ips_mode = IPS_LEVEL_2; #else - int rtw_ips_mode = IPS_NORMAL; + static int rtw_ips_mode = IPS_NORMAL; #endif #else - int rtw_power_mgnt = PS_MODE_ACTIVE; - int rtw_ips_mode = IPS_NONE; + static int rtw_power_mgnt = PS_MODE_ACTIVE; + static int rtw_ips_mode = IPS_NONE; #endif module_param(rtw_ips_mode, int, 0644); MODULE_PARM_DESC(rtw_ips_mode, "The default IPS mode"); -int rtw_smart_ps = 2; +static int rtw_smart_ps = 2; -int rtw_check_fw_ps = 1; +static int rtw_check_fw_ps = 1; #ifdef CONFIG_TX_EARLY_MODE -int rtw_early_mode = 1; +static int rtw_early_mode = 1; #endif -int rtw_usb_rxagg_mode = 2;/* RX_AGG_DMA=1, RX_AGG_USB=2 */ +static int rtw_usb_rxagg_mode = 2;/* RX_AGG_DMA=1, RX_AGG_USB=2 */ module_param(rtw_usb_rxagg_mode, int, 0644); /* set log level when inserting driver module, default log level is _DRV_INFO_ = 4, @@ -80,33 +81,33 @@ module_param(rtw_usb_rxagg_mode, int, 0644); module_param(rtw_drv_log_level, uint, 0644); MODULE_PARM_DESC(rtw_drv_log_level, "set log level when insert driver module, default log level is _DRV_INFO_ = 4"); -int rtw_radio_enable = 1; -int rtw_long_retry_lmt = 7; -int rtw_short_retry_lmt = 7; -int rtw_busy_thresh = 40; +static int rtw_radio_enable = 1; +static int rtw_long_retry_lmt = 7; +static int rtw_short_retry_lmt = 7; +static int rtw_busy_thresh = 40; /* int qos_enable = 0; */ /* * */ -int rtw_ack_policy = NORMAL_ACK; +static int rtw_ack_policy = NORMAL_ACK; -int rtw_mp_mode = 0; +static int rtw_mp_mode = 0; #if defined(CONFIG_MP_INCLUDED) && defined(CONFIG_RTW_CUSTOMER_STR) -uint rtw_mp_customer_str = 0; +static uint rtw_mp_customer_str = 0; module_param(rtw_mp_customer_str, uint, 0644); MODULE_PARM_DESC(rtw_mp_customer_str, "Whether or not to enable customer str support on MP mode"); #endif -int rtw_software_encrypt = 0; -int rtw_software_decrypt = 0; +static int rtw_software_encrypt = 0; +static int rtw_software_decrypt = 0; -int rtw_acm_method = 0;/* 0:By SW 1:By HW. */ +static int rtw_acm_method = 0;/* 0:By SW 1:By HW. */ -int rtw_wmm_enable = 1;/* default is set to enable the wmm. */ -int rtw_uapsd_enable = 0; -int rtw_uapsd_max_sp = NO_LIMIT; -int rtw_uapsd_acbk_en = 0; -int rtw_uapsd_acbe_en = 0; -int rtw_uapsd_acvi_en = 0; -int rtw_uapsd_acvo_en = 0; +static int rtw_wmm_enable = 1;/* default is set to enable the wmm. */ +static int rtw_uapsd_enable = 0; +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; #if defined(CONFIG_RTL8814A) || defined(CONFIG_RTL8822B) || defined(CONFIG_RTL8821C) static int rtw_pwrtrim_enable = 2; /* disable kfree , rename to power trim disable */ #else @@ -3035,9 +3036,6 @@ int pm_netdev_open(struct net_device *pnetdev, u8 bnormal) if (_TRUE == bnormal) { _enter_critical_mutex(&(adapter_to_dvobj(padapter)->hw_init_mutex), NULL); status = _netdev_open(pnetdev); -#if 0 - rtw_restore_mac_addr(padapter); -#endif _exit_critical_mutex(&(adapter_to_dvobj(padapter)->hw_init_mutex), NULL); } #ifdef CONFIG_IPS diff --git a/os_dep/recv_linux.c b/os_dep/recv_linux.c index 167f408..37c38a5 100644 --- a/os_dep/recv_linux.c +++ b/os_dep/recv_linux.c @@ -79,7 +79,7 @@ int rtw_os_alloc_recvframe(_adapter *padapter, union recv_frame *precvframe, u8 /* For 8 bytes IP header alignment. */ shift_sz = pattrib->qos ? 6 : 0; /* Qos data, wireless lan header length is 26 */ - skb_len = pattrib->pkt_len; + skb_len = le16_to_cpu(pattrib->pkt_len); /* for first fragment packet, driver need allocate 1536+drvinfo_sz+RXDESC_SIZE to defrag packet. */ /* modify alloc_sz for recvive crc error packet by thomas 2011-06-02 */ @@ -315,7 +315,7 @@ _pkt *rtw_os_alloc_msdu_pkt(union recv_frame *prframe, u16 nSubframe_Length, u8 _rtw_memcpy(skb_push(sub_skb, ETH_ALEN), pattrib->src, ETH_ALEN); _rtw_memcpy(skb_push(sub_skb, ETH_ALEN), pattrib->dst, ETH_ALEN); } else { - u16 len; + __be16 len; /* Leave Ethernet header part of hdr and full payload */ len = htons(sub_skb->len); _rtw_memcpy(skb_push(sub_skb, 2), &len, 2); @@ -733,7 +733,7 @@ int rtw_recv_indicatepkt(_adapter *padapter, union recv_frame *precv_frame) skb->len = precv_frame->u.hdr.len; - if (pattrib->eth_type == 0x888e) + if (pattrib->eth_type == cpu_to_le16(0x888e)) RTW_INFO("recv eapol packet\n"); #ifdef CONFIG_AUTO_AP_MODE @@ -848,9 +848,9 @@ void rtw_os_read_port(_adapter *padapter, struct recv_buf *precvbuf) } #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0) -void _rtw_reordering_ctrl_timeout_handler(void *FunctionContext) +static void _rtw_reordering_ctrl_timeout_handler(void *FunctionContext) #else -void _rtw_reordering_ctrl_timeout_handler(struct timer_list *t) +static void _rtw_reordering_ctrl_timeout_handler(struct timer_list *t) #endif { #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0) diff --git a/os_dep/rtw_android.c b/os_dep/rtw_android.c index 9c85dfb..a09cae9 100644 --- a/os_dep/rtw_android.c +++ b/os_dep/rtw_android.c @@ -46,7 +46,7 @@ extern void macstr2num(u8 *dst, u8 *src); -const char *android_wifi_cmd_str[ANDROID_WIFI_CMD_MAX] = { +static const char *android_wifi_cmd_str[ANDROID_WIFI_CMD_MAX] = { "START", "STOP", "SCAN-ACTIVE", @@ -169,8 +169,8 @@ typedef struct compat_android_wifi_priv_cmd { */ static int g_wifi_on = _TRUE; -unsigned int oob_irq = 0; -unsigned int oob_gpio = 0; +static unsigned int oob_irq = 0; +static unsigned int oob_gpio = 0; #ifdef CONFIG_PNO_SUPPORT /* @@ -363,7 +363,7 @@ int rtw_android_cmdstr_to_num(char *cmdstr) return cmd_num; } -int rtw_android_get_rssi(struct net_device *net, char *command, int total_len) +static int rtw_android_get_rssi(struct net_device *net, char *command, int total_len) { _adapter *padapter = (_adapter *)rtw_netdev_priv(net); struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); @@ -378,7 +378,7 @@ int rtw_android_get_rssi(struct net_device *net, char *command, int total_len) return bytes_written; } -int rtw_android_get_link_speed(struct net_device *net, char *command, int total_len) +static int rtw_android_get_link_speed(struct net_device *net, char *command, int total_len) { _adapter *padapter = (_adapter *)rtw_netdev_priv(net); struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); @@ -392,7 +392,7 @@ int rtw_android_get_link_speed(struct net_device *net, char *command, int total_ return bytes_written; } -int rtw_android_get_macaddr(struct net_device *net, char *command, int total_len) +static int rtw_android_get_macaddr(struct net_device *net, char *command, int total_len) { _adapter *adapter = (_adapter *)rtw_netdev_priv(net); int bytes_written = 0; @@ -401,7 +401,7 @@ int rtw_android_get_macaddr(struct net_device *net, char *command, int total_len return bytes_written; } -int rtw_android_set_country(struct net_device *net, char *command, int total_len) +static int rtw_android_set_country(struct net_device *net, char *command, int total_len) { _adapter *adapter = (_adapter *)rtw_netdev_priv(net); char *country_code = command + strlen(android_wifi_cmd_str[ANDROID_WIFI_CMD_COUNTRY]) + 1; @@ -412,7 +412,7 @@ int rtw_android_set_country(struct net_device *net, char *command, int total_len return (ret == _SUCCESS) ? 0 : -1; } -int rtw_android_get_p2p_dev_addr(struct net_device *net, char *command, int total_len) +static int rtw_android_get_p2p_dev_addr(struct net_device *net, char *command, int total_len) { int bytes_written = 0; @@ -423,7 +423,7 @@ int rtw_android_get_p2p_dev_addr(struct net_device *net, char *command, int tota return bytes_written; } -int rtw_android_set_block_scan(struct net_device *net, char *command, int total_len) +static int rtw_android_set_block_scan(struct net_device *net, char *command, int total_len) { _adapter *adapter = (_adapter *)rtw_netdev_priv(net); char *block_value = command + strlen(android_wifi_cmd_str[ANDROID_WIFI_CMD_BLOCK_SCAN]) + 1; @@ -435,7 +435,7 @@ int rtw_android_set_block_scan(struct net_device *net, char *command, int total_ return 0; } -int rtw_android_set_block(struct net_device *net, char *command, int total_len) +static int rtw_android_set_block(struct net_device *net, char *command, int total_len) { _adapter *adapter = (_adapter *)rtw_netdev_priv(net); char *block_value = command + strlen(android_wifi_cmd_str[ANDROID_WIFI_CMD_BLOCK]) + 1; @@ -447,7 +447,7 @@ int rtw_android_set_block(struct net_device *net, char *command, int total_len) return 0; } -int rtw_android_setband(struct net_device *net, char *command, int total_len) +static int rtw_android_setband(struct net_device *net, char *command, int total_len) { _adapter *adapter = (_adapter *)rtw_netdev_priv(net); char *arg = command + strlen(android_wifi_cmd_str[ANDROID_WIFI_CMD_SETBAND]) + 1; @@ -460,7 +460,7 @@ int rtw_android_setband(struct net_device *net, char *command, int total_len) return (ret == _SUCCESS) ? 0 : -1; } -int rtw_android_getband(struct net_device *net, char *command, int total_len) +static int rtw_android_getband(struct net_device *net, char *command, int total_len) { _adapter *adapter = (_adapter *)rtw_netdev_priv(net); int bytes_written = 0; @@ -471,7 +471,7 @@ int rtw_android_getband(struct net_device *net, char *command, int total_len) } #ifdef CONFIG_WFD -int rtw_android_set_miracast_mode(struct net_device *net, char *command, int total_len) +static int rtw_android_set_miracast_mode(struct net_device *net, char *command, int total_len) { _adapter *adapter = (_adapter *)rtw_netdev_priv(net); struct wifi_display_info *wfd_info = &adapter->wfd_info; @@ -507,7 +507,7 @@ exit: } #endif /* CONFIG_WFD */ -int get_int_from_command(char *pcmd) +static int get_int_from_command(char *pcmd) { int i = 0; @@ -631,7 +631,7 @@ int rtw_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd) ret = -EFAULT; goto exit; } - if (copy_from_user(command, (void *)priv_cmd.buf, priv_cmd.total_len)) { + if (copy_from_user(command, (void __user *)priv_cmd.buf, priv_cmd.total_len)) { ret = -EFAULT; goto exit; } @@ -910,7 +910,7 @@ response: } else bytes_written++; priv_cmd.used_len = bytes_written; - if (copy_to_user((void *)priv_cmd.buf, command, bytes_written)) { + if (copy_to_user((void __user *)priv_cmd.buf, command, bytes_written)) { RTW_INFO("%s: failed to copy data to user buffer\n", __FUNCTION__); ret = -EFAULT; } diff --git a/os_dep/rtw_cfgvendor.c b/os_dep/rtw_cfgvendor.c index f4e7651..8622007 100644 --- a/os_dep/rtw_cfgvendor.c +++ b/os_dep/rtw_cfgvendor.c @@ -144,7 +144,7 @@ int dbg_rtw_cfg80211_vendor_cmd_reply(struct sk_buff *skb dbg_rtw_cfg80211_vendor_cmd_reply(skb, MSTAT_FUNC_CFG_VENDOR | MSTAT_TYPE_SKB, __FUNCTION__, __LINE__) #else -struct sk_buff *rtw_cfg80211_vendor_event_alloc( +static struct sk_buff *rtw_cfg80211_vendor_event_alloc( struct wiphy *wiphy, struct wireless_dev *wdev, int len, int event_id, gfp_t gfp) { struct sk_buff *skb; @@ -176,7 +176,7 @@ struct sk_buff *rtw_cfg80211_vendor_event_alloc( int rtw_cfgvendor_send_async_event(struct wiphy *wiphy, struct net_device *dev, int event_id, const void *data, int len) { - u16 kflags; + gfp_t kflags; struct sk_buff *skb; kflags = in_atomic() ? GFP_ATOMIC : GFP_KERNEL; @@ -234,7 +234,7 @@ static int rtw_cfgvendor_send_cmd_reply(struct wiphy *wiphy, #define MAX_FEATURE_SET_CONCURRRENT_GROUPS 3 #include -int rtw_dev_get_feature_set(struct net_device *dev) +static int rtw_dev_get_feature_set(struct net_device *dev) { _adapter *adapter = (_adapter *)rtw_netdev_priv(dev); HAL_DATA_TYPE *HalData = GET_HAL_DATA(adapter); @@ -256,7 +256,7 @@ int rtw_dev_get_feature_set(struct net_device *dev) return feature_set; } -int *rtw_dev_get_feature_set_matrix(struct net_device *dev, int *num) +static int *rtw_dev_get_feature_set_matrix(struct net_device *dev, int *num) { int feature_set_full, mem_needed; int *ret; diff --git a/os_dep/rtw_proc.c b/os_dep/rtw_proc.c index c28d630..bc82f9a 100644 --- a/os_dep/rtw_proc.c +++ b/os_dep/rtw_proc.c @@ -170,7 +170,7 @@ static int proc_get_chplan_test(struct seq_file *m, void *v) * rtw_drv_proc: * init/deinit when register/unregister driver */ -const struct rtw_proc_hdl drv_proc_hdls[] = { +static const struct rtw_proc_hdl drv_proc_hdls[] = { RTW_PROC_HDL_SSEQ("ver_info", proc_get_drv_version, NULL), RTW_PROC_HDL_SSEQ("log_level", proc_get_log_level, proc_set_log_level), RTW_PROC_HDL_SSEQ("drv_cfg", proc_get_drv_cfg, NULL), @@ -182,7 +182,7 @@ const struct rtw_proc_hdl drv_proc_hdls[] = { RTW_PROC_HDL_SSEQ("chplan_test", proc_get_chplan_test, NULL), }; -const int drv_proc_hdls_num = sizeof(drv_proc_hdls) / sizeof(struct rtw_proc_hdl); +static const int drv_proc_hdls_num = sizeof(drv_proc_hdls) / sizeof(struct rtw_proc_hdl); static int rtw_drv_proc_open(struct inode *inode, struct file *file) { @@ -846,7 +846,7 @@ static int proc_get_macaddr_acl(struct seq_file *m, void *v) return 0; } -ssize_t proc_set_macaddr_acl(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data) +static ssize_t proc_set_macaddr_acl(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data) { struct net_device *dev = data; _adapter *adapter = (_adapter *)rtw_netdev_priv(dev); @@ -2056,7 +2056,7 @@ int proc_get_mbid_cam_cache(struct seq_file *m, void *v) } #endif /* CONFIG_MBSSID_CAM */ -int proc_get_mac_addr(struct seq_file *m, void *v) +static int proc_get_mac_addr(struct seq_file *m, void *v) { struct net_device *dev = m->private; _adapter *adapter = (_adapter *)rtw_netdev_priv(dev); @@ -2314,7 +2314,7 @@ static int proc_get_napi_info(struct seq_file *m, void *v) * rtw_adapter_proc: * init/deinit when register/unregister net_device */ -const struct rtw_proc_hdl adapter_proc_hdls[] = { +static const struct rtw_proc_hdl adapter_proc_hdls[] = { #if RTW_SEQ_FILE_TEST RTW_PROC_HDL_SEQ("seq_file_test", &seq_file_test, NULL), #endif @@ -2546,7 +2546,7 @@ const struct rtw_proc_hdl adapter_proc_hdls[] = { RTW_PROC_HDL_SSEQ("ack_timeout", proc_get_ack_timeout, proc_set_ack_timeout), }; -const int adapter_proc_hdls_num = sizeof(adapter_proc_hdls) / sizeof(struct rtw_proc_hdl); +static const int adapter_proc_hdls_num = sizeof(adapter_proc_hdls) / sizeof(struct rtw_proc_hdl); static int rtw_adapter_proc_open(struct inode *inode, struct file *file) { @@ -2601,7 +2601,7 @@ static const struct file_operations rtw_adapter_proc_sseq_fops = { }; -int proc_get_odm_force_igi_lb(struct seq_file *m, void *v) +static int proc_get_odm_force_igi_lb(struct seq_file *m, void *v) { struct net_device *dev = m->private; _adapter *padapter = (_adapter *)rtw_netdev_priv(dev); @@ -2611,7 +2611,7 @@ int proc_get_odm_force_igi_lb(struct seq_file *m, void *v) return 0; } -ssize_t proc_set_odm_force_igi_lb(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data) +static ssize_t proc_set_odm_force_igi_lb(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data) { struct net_device *dev = data; _adapter *padapter = (_adapter *)rtw_netdev_priv(dev); @@ -2684,7 +2684,7 @@ ssize_t proc_set_odm_adaptivity(struct file *file, const char __user *buffer, si static char *phydm_msg = NULL; #define PHYDM_MSG_LEN 80*24 -int proc_get_phydm_cmd(struct seq_file *m, void *v) +static int proc_get_phydm_cmd(struct seq_file *m, void *v) { struct net_device *netdev; PADAPTER padapter; @@ -2713,7 +2713,7 @@ int proc_get_phydm_cmd(struct seq_file *m, void *v) return 0; } -ssize_t proc_set_phydm_cmd(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data) +static ssize_t proc_set_phydm_cmd(struct file *file, const char __user *buffer, size_t count, loff_t *pos, void *data) { struct net_device *netdev; PADAPTER padapter; @@ -2836,7 +2836,7 @@ static struct seq_operations seq_ops_lamode = { * rtw_odm_proc: * init/deinit when register/unregister net_device, along with rtw_adapter_proc */ -const struct rtw_proc_hdl odm_proc_hdls[] = { +static const struct rtw_proc_hdl odm_proc_hdls[] = { RTW_PROC_HDL_SSEQ("adaptivity", proc_get_odm_adaptivity, proc_set_odm_adaptivity), RTW_PROC_HDL_SSEQ("force_igi_lb", proc_get_odm_force_igi_lb, proc_set_odm_force_igi_lb), RTW_PROC_HDL_SSEQ("cmd", proc_get_phydm_cmd, proc_set_phydm_cmd), @@ -2845,7 +2845,7 @@ const struct rtw_proc_hdl odm_proc_hdls[] = { #endif /* CONFIG_LAMODE */ }; -const int odm_proc_hdls_num = sizeof(odm_proc_hdls) / sizeof(struct rtw_proc_hdl); +static const int odm_proc_hdls_num = sizeof(odm_proc_hdls) / sizeof(struct rtw_proc_hdl); static int rtw_odm_proc_open(struct inode *inode, struct file *file) { @@ -2899,7 +2899,7 @@ static const struct file_operations rtw_odm_proc_sseq_fops = { .write = rtw_odm_proc_write, }; -struct proc_dir_entry *rtw_odm_proc_init(struct net_device *dev) +static struct proc_dir_entry *rtw_odm_proc_init(struct net_device *dev) { struct proc_dir_entry *dir_odm = NULL; struct proc_dir_entry *entry = NULL; @@ -2942,7 +2942,7 @@ exit: return dir_odm; } -void rtw_odm_proc_deinit(_adapter *adapter) +static void rtw_odm_proc_deinit(_adapter *adapter) { struct proc_dir_entry *dir_odm = NULL; int i; diff --git a/os_dep/usb_intf.c b/os_dep/usb_intf.c index 0dace5f..c581c25 100644 --- a/os_dep/usb_intf.c +++ b/os_dep/usb_intf.c @@ -32,18 +32,11 @@ #error "Shall be Linux or Windows, but not both!\n" #endif -#ifdef CONFIG_80211N_HT -extern int rtw_ht_enable; -extern int rtw_bw_mode; -extern int rtw_ampdu_enable;/* for enable tx_ampdu */ -#endif - #ifdef CONFIG_GLOBAL_UI_PID int ui_pid[3] = {0, 0, 0}; #endif -extern int pm_netdev_open(struct net_device *pnetdev, u8 bnormal); static int rtw_suspend(struct usb_interface *intf, pm_message_t message); static int rtw_resume(struct usb_interface *intf); diff --git a/os_dep/wifi_regd.c b/os_dep/wifi_regd.c index 2f6f5b1..0e4e391 100644 --- a/os_dep/wifi_regd.c +++ b/os_dep/wifi_regd.c @@ -457,7 +457,7 @@ static const struct ieee80211_regdomain *_rtw_regdomain_select(struct #endif } -void _rtw_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request) +static void _rtw_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request) { struct rtw_regulatory *reg = NULL; @@ -467,9 +467,9 @@ void _rtw_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request) } #if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 9, 0)) -int rtw_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request) +static int rtw_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request) #else -void rtw_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request) +static void rtw_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request) #endif { _rtw_reg_notifier(wiphy, request); diff --git a/os_dep/xmit_linux.c b/os_dep/xmit_linux.c index 7721b7d..b1d042a 100644 --- a/os_dep/xmit_linux.c +++ b/os_dep/xmit_linux.c @@ -20,6 +20,7 @@ #define _XMIT_OSDEP_C_ #include +#include #define DBG_DUMP_OS_QUEUE_CTL 0 @@ -445,7 +446,6 @@ int _rtw_xmit_entry(_pkt *pkt, _nic_hdl pnetdev) struct xmit_priv *pxmitpriv = &padapter->xmitpriv; #ifdef CONFIG_TX_MCAST2UNI struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - extern int rtw_mc2u_disable; #endif /* CONFIG_TX_MCAST2UNI */ s32 res = 0; #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35))