Remove wrappers for atomic operations

These wrappers were useful when this driver had the hooks for Windows,
but are no longer needed.

Link: https://lore.kernel.org/r/20210802192721.23110-4-Larry.Finger@lwfinger.net
This commit is contained in:
Larry Finger 2021-08-02 14:27:18 -05:00 committed by Carlos Garcés
parent e8b235e056
commit d7c3737cd5
40 changed files with 284 additions and 439 deletions

View File

@ -3087,7 +3087,7 @@ void rtw_mesh_init_mesh_info(_adapter *adapter)
/* minfo->last_sn_update = rtw_get_current_time(); */
minfo->next_perr = rtw_get_current_time();
ATOMIC_SET(&minfo->mpaths, 0);
atomic_set(&minfo->mpaths, 0);
rtw_mesh_pathtbl_init(adapter);
_rtw_init_queue(&minfo->mpath_tx_queue);

View File

@ -377,7 +377,7 @@ struct rtw_mesh_info {
/* Last used Path Discovery ID */
u32 preq_id;
ATOMIC_T mpaths;
atomic_t mpaths;
struct rtw_mesh_table *mesh_paths;
struct rtw_mesh_table *mpp_paths;
int mesh_paths_generation;

View File

@ -82,7 +82,7 @@ static struct rtw_mesh_table *rtw_mesh_table_alloc(void)
return NULL;
rtw_hlist_head_init(&newtbl->known_gates);
ATOMIC_SET(&newtbl->entries, 0);
atomic_set(&newtbl->entries, 0);
_rtw_spinlock_init(&newtbl->gates_lock);
return newtbl;
@ -584,7 +584,7 @@ struct rtw_mesh_path *rtw_mesh_path_add(_adapter *adapter,
if (is_multicast_mac_addr(dst))
return ERR_PTR(-ENOTSUPP);
if (ATOMIC_INC_UNLESS(&adapter->mesh_info.mpaths, RTW_MESH_MAX_MPATHS) == 0)
if (atomic_inc_unless(&adapter->mesh_info.mpaths, RTW_MESH_MAX_MPATHS) == 0)
return ERR_PTR(-ENOSPC);
new_mpath = rtw_mesh_path_new(adapter, dst);
@ -739,8 +739,8 @@ static void rtw_mesh_path_free_rcu(struct rtw_mesh_table *tbl,
rtw_mesh_gate_del(tbl, mpath);
exit_critical_bh(&mpath->state_lock);
_cancel_timer_ex(&mpath->timer);
ATOMIC_DEC(&adapter->mesh_info.mpaths);
ATOMIC_DEC(&tbl->entries);
atomic_dec(&adapter->mesh_info.mpaths);
atomic_dec(&tbl->entries);
_rtw_spinlock_free(&mpath->state_lock);
rtw_mesh_path_flush_pending(mpath);

View File

@ -140,7 +140,7 @@ struct rtw_mesh_table {
rtw_hlist_head known_gates;
_lock gates_lock;
rtw_rhashtable rhead;
ATOMIC_T entries;
atomic_t entries;
};
#define RTW_MESH_PATH_EXPIRE (600 * HZ)

View File

@ -1510,11 +1510,11 @@ static void rtw_ap_check_scan(_adapter *padapter)
if (pbuf == NULL) {
/* HT CAP INFO IE don't exist, it is b/g mode bss.*/
if (_FALSE == ATOMIC_READ(&pmlmepriv->olbc))
ATOMIC_SET(&pmlmepriv->olbc, _TRUE);
if (_FALSE == atomic_read(&pmlmepriv->olbc))
atomic_set(&pmlmepriv->olbc, _TRUE);
if (_FALSE == ATOMIC_READ(&pmlmepriv->olbc_ht))
ATOMIC_SET(&pmlmepriv->olbc_ht, _TRUE);
if (_FALSE == atomic_read(&pmlmepriv->olbc_ht))
atomic_set(&pmlmepriv->olbc_ht, _TRUE);
if (padapter->registrypriv.wifi_spec)
RTW_INFO("%s: %s is a/b/g ap\n", __func__, pnetwork->network.Ssid.Ssid);
@ -1811,7 +1811,7 @@ update_beacon:
mlme = &(pdvobj->padapters[i]->mlmepriv);
#ifdef CONFIG_80211N_HT
if ((ATOMIC_READ(&mlme->olbc) == _TRUE) || (ATOMIC_READ(&mlme->olbc_ht) == _TRUE)) {
if ((atomic_read(&mlme->olbc) == _TRUE) || (atomic_read(&mlme->olbc_ht) == _TRUE)) {
/* AP is not starting a 40 MHz BSS in presence of an 802.11g BSS. */
mlme->ht_op_mode &= (~HT_INFO_OPERATION_MODE_OP_MODE_MASK);
mlme->ht_op_mode |= OP_MODE_MAY_BE_LEGACY_STAS;
@ -3086,7 +3086,7 @@ static void update_bcn_htinfo_ie(_adapter *padapter)
__FUNCTION__, pmlmepriv->ht_op_mode);
RTW_INFO("num_sta_40mhz_intolerant(%d), 20mhz_width_req(%d), intolerant_ch_rpt(%d), olbc(%d)\n",
pmlmepriv->num_sta_40mhz_intolerant, pmlmepriv->ht_20mhz_width_req, pmlmepriv->ht_intolerant_ch_reported, ATOMIC_READ(&pmlmepriv->olbc));
pmlmepriv->num_sta_40mhz_intolerant, pmlmepriv->ht_20mhz_width_req, pmlmepriv->ht_intolerant_ch_reported, atomic_read(&pmlmepriv->olbc));
/*parsing HT_INFO_IE, currently only update ht_op_mode - pht_info->infos[1] & pht_info->infos[2] for wifi logo test*/
p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _HT_ADD_INFO_IE_, &len, (pnetwork->IELength - _BEACON_IE_OFFSET_));
@ -3098,7 +3098,7 @@ static void update_bcn_htinfo_ie(_adapter *padapter)
/* for STA Channel Width/Secondary Channel Offset*/
if ((pmlmepriv->sw_to_20mhz == 0) && (pmlmeext->cur_channel <= 14)) {
if ((pmlmepriv->num_sta_40mhz_intolerant > 0) || (pmlmepriv->ht_20mhz_width_req == _TRUE)
|| (pmlmepriv->ht_intolerant_ch_reported == _TRUE) || (ATOMIC_READ(&pmlmepriv->olbc) == _TRUE)) {
|| (pmlmepriv->ht_intolerant_ch_reported == _TRUE) || (atomic_read(&pmlmepriv->olbc) == _TRUE)) {
SET_HT_OP_ELE_2ND_CHL_OFFSET(pht_info, 0);
SET_HT_OP_ELE_STA_CHL_WIDTH(pht_info, 0);
@ -3115,7 +3115,7 @@ static void update_bcn_htinfo_ie(_adapter *padapter)
} else {
if ((pmlmepriv->num_sta_40mhz_intolerant == 0) && (pmlmepriv->ht_20mhz_width_req == _FALSE)
&& (pmlmepriv->ht_intolerant_ch_reported == _FALSE) && (ATOMIC_READ(&pmlmepriv->olbc) == _FALSE)) {
&& (pmlmepriv->ht_intolerant_ch_reported == _FALSE) && (atomic_read(&pmlmepriv->olbc) == _FALSE)) {
if (pmlmeext->cur_bwmode >= CHANNEL_WIDTH_40) {
@ -3467,12 +3467,12 @@ int rtw_ht_operation_update(_adapter *padapter)
}
if (!(pmlmepriv->ht_op_mode & HT_INFO_OPERATION_MODE_NON_HT_STA_PRESENT) &&
(pmlmepriv->num_sta_no_ht || ATOMIC_READ(&pmlmepriv->olbc_ht))) {
(pmlmepriv->num_sta_no_ht || atomic_read(&pmlmepriv->olbc_ht))) {
pmlmepriv->ht_op_mode |= HT_INFO_OPERATION_MODE_NON_HT_STA_PRESENT;
op_mode_changes++;
} else if ((pmlmepriv->ht_op_mode &
HT_INFO_OPERATION_MODE_NON_HT_STA_PRESENT) &&
(pmlmepriv->num_sta_no_ht == 0 && !ATOMIC_READ(&pmlmepriv->olbc_ht))) {
(pmlmepriv->num_sta_no_ht == 0 && !atomic_read(&pmlmepriv->olbc_ht))) {
pmlmepriv->ht_op_mode &=
~HT_INFO_OPERATION_MODE_NON_HT_STA_PRESENT;
op_mode_changes++;
@ -3489,7 +3489,7 @@ int rtw_ht_operation_update(_adapter *padapter)
else if ((phtpriv_ap->ht_cap.cap_info & IEEE80211_HT_CAP_SUP_WIDTH)
&& pmlmepriv->num_sta_ht_20mhz)
new_op_mode = OP_MODE_20MHZ_HT_STA_ASSOCED;
else if (ATOMIC_READ(&pmlmepriv->olbc_ht))
else if (atomic_read(&pmlmepriv->olbc_ht))
new_op_mode = OP_MODE_MAY_BE_LEGACY_STAS;
else
new_op_mode = OP_MODE_PURE;
@ -4148,8 +4148,8 @@ void start_ap_mode(_adapter *padapter)
pmlmepriv->num_sta_ht_20mhz = 0;
pmlmepriv->num_sta_40mhz_intolerant = 0;
ATOMIC_SET(&pmlmepriv->olbc, _FALSE);
ATOMIC_SET(&pmlmepriv->olbc_ht, _FALSE);
atomic_set(&pmlmepriv->olbc, _FALSE);
atomic_set(&pmlmepriv->olbc_ht, _FALSE);
#ifdef CONFIG_80211N_HT
pmlmepriv->ht_20mhz_width_req = _FALSE;

View File

@ -139,7 +139,7 @@ sint _rtw_init_evt_priv(struct evt_priv *pevtpriv)
#endif
/* allocate DMA-able/Non-Page memory for cmd_buf and rsp_buf */
ATOMIC_SET(&pevtpriv->event_seq, 0);
atomic_set(&pevtpriv->event_seq, 0);
pevtpriv->evt_done_cnt = 0;
#ifdef CONFIG_EVENT_THREAD_MODE
@ -424,11 +424,11 @@ int rtw_cmd_filter(struct cmd_priv *pcmdpriv, struct cmd_obj *cmd_obj)
bAllow = _TRUE;
if ((!rtw_is_hw_init_completed(pcmdpriv->padapter) && (bAllow == _FALSE))
|| ATOMIC_READ(&(pcmdpriv->cmdthd_running)) == _FALSE /* com_thread not running */
|| atomic_read(&(pcmdpriv->cmdthd_running)) == _FALSE /* com_thread not running */
) {
if (DBG_CMD_EXECUTE)
RTW_INFO(ADPT_FMT" drop "CMD_FMT" hw_init_completed:%u, cmdthd_running:%u\n", ADPT_ARG(cmd_obj->padapter)
, CMD_ARG(cmd_obj), rtw_get_hw_init_completed(cmd_obj->padapter), ATOMIC_READ(&pcmdpriv->cmdthd_running));
, CMD_ARG(cmd_obj), rtw_get_hw_init_completed(cmd_obj->padapter), atomic_read(&pcmdpriv->cmdthd_running));
if (0)
rtw_warn_on(1);
@ -545,7 +545,7 @@ thread_return rtw_cmd_thread(thread_context context)
pcmdbuf = pcmdpriv->cmd_buf;
prspbuf = pcmdpriv->rsp_buf;
ATOMIC_SET(&(pcmdpriv->cmdthd_running), _TRUE);
atomic_set(&(pcmdpriv->cmdthd_running), _TRUE);
_rtw_up_sema(&pcmdpriv->start_cmdthread_sema);
@ -702,7 +702,7 @@ post_process:
#endif
/* to avoid enqueue cmd after free all cmd_obj */
ATOMIC_SET(&(pcmdpriv->cmdthd_running), _FALSE);
atomic_set(&(pcmdpriv->cmdthd_running), _FALSE);
/* free all cmd_obj resources */
do {
@ -3243,8 +3243,8 @@ static void dynamic_update_bcn_check(_adapter *padapter)
if (count % 10 == 0) {
count = 1;
#ifdef CONFIG_80211N_HT
if (_FALSE == ATOMIC_READ(&pmlmepriv->olbc)
&& _FALSE == ATOMIC_READ(&pmlmepriv->olbc_ht)) {
if (_FALSE == atomic_read(&pmlmepriv->olbc)
&& _FALSE == atomic_read(&pmlmepriv->olbc_ht)) {
if (rtw_ht_operation_update(padapter) > 0) {
update_beacon(padapter, _HT_CAPABILITY_IE_, NULL, _FALSE);
@ -3257,16 +3257,16 @@ static void dynamic_update_bcn_check(_adapter *padapter)
#ifdef CONFIG_80211N_HT
/* In 2s, there are any legacy AP, update HT info, and then reset count */
if (_FALSE != ATOMIC_READ(&pmlmepriv->olbc)
&& _FALSE != ATOMIC_READ(&pmlmepriv->olbc_ht)) {
if (_FALSE != atomic_read(&pmlmepriv->olbc)
&& _FALSE != atomic_read(&pmlmepriv->olbc_ht)) {
if (rtw_ht_operation_update(padapter) > 0) {
update_beacon(padapter, _HT_CAPABILITY_IE_, NULL, _FALSE);
update_beacon(padapter, _HT_ADD_INFO_IE_, NULL, _TRUE);
}
ATOMIC_SET(&pmlmepriv->olbc, _FALSE);
ATOMIC_SET(&pmlmepriv->olbc_ht, _FALSE);
atomic_set(&pmlmepriv->olbc, _FALSE);
atomic_set(&pmlmepriv->olbc_ht, _FALSE);
count = 0;
}
#endif /* CONFIG_80211N_HT */

View File

@ -1718,7 +1718,7 @@ int proc_get_trx_info(struct seq_file *m, void *v)
rtw_hal_get_hwreg(padapter, HW_VAR_DUMP_MAC_TXFIFO, (u8 *)m);
#ifdef CONFIG_USB_HCI
RTW_PRINT_SEL(m, "rx_urb_pending_cn=%d\n", ATOMIC_READ(&(precvpriv->rx_pending_cnt)));
RTW_PRINT_SEL(m, "rx_urb_pending_cn=%d\n", atomic_read(&(precvpriv->rx_pending_cnt)));
#endif
dump_rx_bh_tk(m, &GET_PRIMARY_ADAPTER(padapter)->recvpriv);
@ -5132,7 +5132,7 @@ static int proc_tdls_display_tdls_function_info(struct seq_file *m)
}
}
RTW_PRINT_SEL(m, "%-*s = %s\n", SpaceBtwnItemAndValue, "TDLS CH SW On", (ATOMIC_READ(&ptdlsinfo->chsw_info.chsw_on) == _TRUE) ? "_TRUE" : "_FALSE");
RTW_PRINT_SEL(m, "%-*s = %s\n", SpaceBtwnItemAndValue, "TDLS CH SW On", (atomic_read(&ptdlsinfo->chsw_info.chsw_on) == _TRUE) ? "_TRUE" : "_FALSE");
RTW_PRINT_SEL(m, "%-*s = %d\n", SpaceBtwnItemAndValue, "TDLS CH SW Off-Channel Num", ptdlsinfo->chsw_info.off_ch_num);
RTW_PRINT_SEL(m, "%-*s = %d\n", SpaceBtwnItemAndValue, "TDLS CH SW Channel Offset", ptdlsinfo->chsw_info.ch_offset);
RTW_PRINT_SEL(m, "%-*s = %d\n", SpaceBtwnItemAndValue, "TDLS CH SW Current Time", ptdlsinfo->chsw_info.cur_time);

View File

@ -469,7 +469,7 @@ int rtw_inc_and_chk_continual_io_error(struct dvobj_priv *dvobj)
int ret = _FALSE;
int value;
value = ATOMIC_INC_RETURN(&dvobj->continual_io_error);
value = atomic_inc_return(&dvobj->continual_io_error);
if (value > MAX_CONTINUAL_IO_ERR) {
RTW_INFO("[dvobj:%p][ERROR] continual_io_error:%d > %d\n", dvobj, value, MAX_CONTINUAL_IO_ERR);
ret = _TRUE;
@ -484,7 +484,7 @@ int rtw_inc_and_chk_continual_io_error(struct dvobj_priv *dvobj)
*/
void rtw_reset_continual_io_error(struct dvobj_priv *dvobj)
{
ATOMIC_SET(&dvobj->continual_io_error, 0);
atomic_set(&dvobj->continual_io_error, 0);
}
#ifdef DBG_IO

View File

@ -3527,13 +3527,13 @@ exit:
inline bool rtw_is_scan_deny(_adapter *adapter)
{
struct mlme_priv *mlmepriv = &adapter->mlmepriv;
return (ATOMIC_READ(&mlmepriv->set_scan_deny) != 0) ? _TRUE : _FALSE;
return (atomic_read(&mlmepriv->set_scan_deny) != 0) ? _TRUE : _FALSE;
}
inline void rtw_clear_scan_deny(_adapter *adapter)
{
struct mlme_priv *mlmepriv = &adapter->mlmepriv;
ATOMIC_SET(&mlmepriv->set_scan_deny, 0);
atomic_set(&mlmepriv->set_scan_deny, 0);
if (0)
RTW_INFO(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(adapter));
}
@ -3549,7 +3549,7 @@ void rtw_set_scan_deny(_adapter *adapter, u32 ms)
struct mlme_priv *mlmepriv = &adapter->mlmepriv;
if (0)
RTW_INFO(FUNC_ADPT_FMT"\n", FUNC_ADPT_ARG(adapter));
ATOMIC_SET(&mlmepriv->set_scan_deny, 1);
atomic_set(&mlmepriv->set_scan_deny, 1);
_set_timer(&mlmepriv->set_scan_deny_timer, ms);
}
#endif

View File

@ -935,25 +935,25 @@ bool rtw_mlme_band_check(_adapter *adapter, const u32 ch)
}
inline void RTW_SET_SCAN_BAND_SKIP(_adapter *padapter, int skip_band)
{
int bs = ATOMIC_READ(&padapter->bandskip);
int bs = atomic_read(&padapter->bandskip);
bs |= skip_band;
ATOMIC_SET(&padapter->bandskip, bs);
atomic_set(&padapter->bandskip, bs);
}
inline void RTW_CLR_SCAN_BAND_SKIP(_adapter *padapter, int skip_band)
{
int bs = ATOMIC_READ(&padapter->bandskip);
int bs = atomic_read(&padapter->bandskip);
bs &= ~(skip_band);
ATOMIC_SET(&padapter->bandskip, bs);
atomic_set(&padapter->bandskip, bs);
}
inline int RTW_GET_SCAN_BAND_SKIP(_adapter *padapter)
{
return ATOMIC_READ(&padapter->bandskip);
return atomic_read(&padapter->bandskip);
}
#define RTW_IS_SCAN_BAND_SKIP(padapter, skip_band) (ATOMIC_READ(&padapter->bandskip) & (skip_band))
#define RTW_IS_SCAN_BAND_SKIP(padapter, skip_band) (atomic_read(&padapter->bandskip) & (skip_band))
bool rtw_mlme_ignore_chan(_adapter *adapter, const u32 ch)
{
@ -1037,7 +1037,7 @@ static void init_mlme_ext_priv_value(_adapter *padapter)
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
ATOMIC_SET(&pmlmeext->event_seq, 0);
atomic_set(&pmlmeext->event_seq, 0);
pmlmeext->mgnt_seq = 0;/* reset to zero when disconnect at client mode */
#ifdef CONFIG_IEEE80211W
pmlmeext->sa_query_seq = 0;
@ -1805,8 +1805,8 @@ static void rtw_check_legacy_ap(_adapter *padapter, u8 *pframe, u32 len)
if (0)
RTW_INFO("%s: "MAC_FMT" is legacy ap\n", __func__, MAC_ARG(GetAddr3Ptr(pframe)));
ATOMIC_SET(&pmlmepriv->olbc, _TRUE);
ATOMIC_SET(&pmlmepriv->olbc_ht, _TRUE);
atomic_set(&pmlmepriv->olbc, _TRUE);
atomic_set(&pmlmepriv->olbc_ht, _TRUE);
}
}
@ -1949,7 +1949,7 @@ unsigned int OnBeacon(_adapter *padapter, union recv_frame *precv_frame)
#ifdef CONFIG_TDLS_CH_SW
if (rtw_tdls_is_chsw_allowed(padapter) == _TRUE) {
/* Send TDLS Channel Switch Request when receiving Beacon */
if ((padapter->tdlsinfo.chsw_info.ch_sw_state & TDLS_CH_SW_INITIATOR_STATE) && (ATOMIC_READ(&pchsw_info->chsw_on) == _TRUE)
if ((padapter->tdlsinfo.chsw_info.ch_sw_state & TDLS_CH_SW_INITIATOR_STATE) && (atomic_read(&pchsw_info->chsw_on) == _TRUE)
&& (pmlmeext->cur_channel == rtw_get_oper_ch(padapter))) {
ptdls_sta = rtw_get_stainfo(&padapter->stapriv, padapter->tdlsinfo.chsw_info.addr);
if (ptdls_sta != NULL) {
@ -11765,7 +11765,7 @@ void report_survey_event(_adapter *padapter, union recv_frame *precv_frame)
pc2h_evt_hdr = (struct C2HEvent_Header *)(pevtcmd);
pc2h_evt_hdr->len = sizeof(struct survey_event);
pc2h_evt_hdr->ID = GEN_EVT_CODE(_Survey);
pc2h_evt_hdr->seq = ATOMIC_INC_RETURN(&pmlmeext->event_seq);
pc2h_evt_hdr->seq = atomic_inc_return(&pmlmeext->event_seq);
psurvey_evt = (struct survey_event *)(pevtcmd + sizeof(struct C2HEvent_Header));
@ -11836,7 +11836,7 @@ void report_surveydone_event(_adapter *padapter)
pc2h_evt_hdr = (struct C2HEvent_Header *)(pevtcmd);
pc2h_evt_hdr->len = sizeof(struct surveydone_event);
pc2h_evt_hdr->ID = GEN_EVT_CODE(_SurveyDone);
pc2h_evt_hdr->seq = ATOMIC_INC_RETURN(&pmlmeext->event_seq);
pc2h_evt_hdr->seq = atomic_inc_return(&pmlmeext->event_seq);
psurveydone_evt = (struct surveydone_event *)(pevtcmd + sizeof(struct C2HEvent_Header));
psurveydone_evt->bss_cnt = pmlmeext->sitesurvey_res.bss_cnt;
@ -11884,7 +11884,7 @@ u32 report_join_res(_adapter *padapter, int aid_res, u16 status)
pc2h_evt_hdr = (struct C2HEvent_Header *)(pevtcmd);
pc2h_evt_hdr->len = sizeof(struct joinbss_event);
pc2h_evt_hdr->ID = GEN_EVT_CODE(_JoinBss);
pc2h_evt_hdr->seq = ATOMIC_INC_RETURN(&pmlmeext->event_seq);
pc2h_evt_hdr->seq = atomic_inc_return(&pmlmeext->event_seq);
pjoinbss_evt = (struct joinbss_event *)(pevtcmd + sizeof(struct C2HEvent_Header));
_rtw_memcpy((unsigned char *)(&(pjoinbss_evt->network.network)), &(pmlmeinfo->network), sizeof(WLAN_BSSID_EX));
@ -11935,7 +11935,7 @@ void report_wmm_edca_update(_adapter *padapter)
pc2h_evt_hdr = (struct C2HEvent_Header *)(pevtcmd);
pc2h_evt_hdr->len = sizeof(struct wmm_event);
pc2h_evt_hdr->ID = GEN_EVT_CODE(_WMM);
pc2h_evt_hdr->seq = ATOMIC_INC_RETURN(&pmlmeext->event_seq);
pc2h_evt_hdr->seq = atomic_inc_return(&pmlmeext->event_seq);
pwmm_event = (struct wmm_event *)(pevtcmd + sizeof(struct C2HEvent_Header));
pwmm_event->wmm = 0;
@ -11970,7 +11970,7 @@ u32 report_del_sta_event(_adapter *padapter, unsigned char *MacAddr, unsigned sh
pc2h_evt_hdr = (struct C2HEvent_Header *)(pevtcmd);
pc2h_evt_hdr->len = sizeof(struct stadel_event);
pc2h_evt_hdr->ID = GEN_EVT_CODE(_DelSTA);
pc2h_evt_hdr->seq = ATOMIC_INC_RETURN(&pmlmeext->event_seq);
pc2h_evt_hdr->seq = atomic_inc_return(&pmlmeext->event_seq);
pdel_sta_evt = (struct stadel_event *)(pevtcmd + sizeof(struct C2HEvent_Header));
_rtw_memcpy((unsigned char *)(&(pdel_sta_evt->macaddr)), MacAddr, ETH_ALEN);
@ -12047,7 +12047,7 @@ void report_add_sta_event(_adapter *padapter, unsigned char *MacAddr)
pc2h_evt_hdr = (struct C2HEvent_Header *)(pevtcmd);
pc2h_evt_hdr->len = sizeof(struct stassoc_event);
pc2h_evt_hdr->ID = GEN_EVT_CODE(_AddSTA);
pc2h_evt_hdr->seq = ATOMIC_INC_RETURN(&pmlmeext->event_seq);
pc2h_evt_hdr->seq = atomic_inc_return(&pmlmeext->event_seq);
padd_sta_evt = (struct stassoc_event *)(pevtcmd + sizeof(struct C2HEvent_Header));
_rtw_memcpy((unsigned char *)(&(padd_sta_evt->macaddr)), MacAddr, ETH_ALEN);
@ -12842,7 +12842,7 @@ void linked_status_chk(_adapter *padapter, u8 from_timer)
#ifdef CONFIG_TDLS
#ifdef CONFIG_TDLS_CH_SW
if (ATOMIC_READ(&padapter->tdlsinfo.chsw_info.chsw_on) == _TRUE)
if (atomic_read(&padapter->tdlsinfo.chsw_info.chsw_on) == _TRUE)
return;
#endif /* CONFIG_TDLS_CH_SW */
@ -13202,7 +13202,7 @@ void report_sta_timeout_event(_adapter *padapter, u8 *MacAddr, unsigned short re
pc2h_evt_hdr = (struct C2HEvent_Header *)(pevtcmd);
pc2h_evt_hdr->len = sizeof(struct stadel_event);
pc2h_evt_hdr->ID = GEN_EVT_CODE(_TimeoutSTA);
pc2h_evt_hdr->seq = ATOMIC_INC_RETURN(&pmlmeext->event_seq);
pc2h_evt_hdr->seq = atomic_inc_return(&pmlmeext->event_seq);
pdel_sta_evt = (struct stadel_event *)(pevtcmd + sizeof(struct C2HEvent_Header));
_rtw_memcpy((unsigned char *)(&(pdel_sta_evt->macaddr)), MacAddr, ETH_ALEN);
@ -13602,7 +13602,7 @@ void rtw_ft_report_reassoc_evt(_adapter *padapter, u8 *pMacAddr)
pc2h_evt_hdr = (struct C2HEvent_Header *)(pevtcmd);
pc2h_evt_hdr->len = sizeof(struct stassoc_event);
pc2h_evt_hdr->ID = GEN_EVT_CODE(_FT_REASSOC);
pc2h_evt_hdr->seq = ATOMIC_INC_RETURN(&pmlmeext->event_seq);
pc2h_evt_hdr->seq = atomic_inc_return(&pmlmeext->event_seq);
passoc_sta_evt = (struct stassoc_event *)(pevtcmd + sizeof(struct C2HEvent_Header));
_rtw_memcpy((unsigned char *)(&(passoc_sta_evt->macaddr)), pMacAddr, ETH_ALEN);
@ -15815,7 +15815,7 @@ u8 mlme_evt_hdl(_adapter *padapter, unsigned char *pbuf)
#ifdef CHECK_EVENT_SEQ
/* checking event sequence... */
if (evt_seq != (ATOMIC_READ(&pevt_priv->event_seq) & 0x7f)) {
if (evt_seq != (atomic_read(&pevt_priv->event_seq) & 0x7f)) {
pevt_priv->event_seq = (evt_seq + 1) & 0x7f;
@ -15836,7 +15836,7 @@ u8 mlme_evt_hdl(_adapter *padapter, unsigned char *pbuf)
}
ATOMIC_INC(&pevt_priv->event_seq);
atomic_inc(&pevt_priv->event_seq);
peventbuf += 2;

View File

@ -3363,14 +3363,14 @@ static int ro_ch_handler(_adapter *adapter, u8 *buf)
if ((remain_ch != rtw_mi_get_union_chan(adapter)) && !check_fwstate(&adapter->mlmepriv, _FW_LINKED)) {
if (remain_ch != pmlmeext->cur_channel
#ifdef RTW_ROCH_BACK_OP
|| ATOMIC_READ(&pwdev_priv->switch_ch_to) == 1
|| atomic_read(&pwdev_priv->switch_ch_to) == 1
#endif
) {
rtw_leave_opch(adapter);
#ifdef RTW_ROCH_BACK_OP
RTW_INFO("%s, set switch ch timer, duration=%d\n", __func__, duration - pwdinfo->ext_listen_interval);
ATOMIC_SET(&pwdev_priv->switch_ch_to, 0);
atomic_set(&pwdev_priv->switch_ch_to, 0);
_set_timer(&pwdinfo->ap_p2p_switch_timer, duration - pwdinfo->ext_listen_interval);
#endif
}
@ -3442,7 +3442,7 @@ static int cancel_ro_ch_handler(_adapter *padapter, u8 *buf)
#if defined(RTW_ROCH_BACK_OP) && defined(CONFIG_CONCURRENT_MODE)
_cancel_timer_ex(&pwdinfo->ap_p2p_switch_timer);
ATOMIC_SET(&pwdev_priv->switch_ch_to, 1);
atomic_set(&pwdev_priv->switch_ch_to, 1);
#endif
if (rtw_mi_get_ch_setting_union(padapter, &ch, &bw, &offset) != 0) {
@ -4779,7 +4779,7 @@ void ap_p2p_switch_timer_process(void *FunctionContext)
return;
#ifdef CONFIG_IOCTL_CFG80211
ATOMIC_SET(&pwdev_priv->switch_ch_to, 1);
atomic_set(&pwdev_priv->switch_ch_to, 1);
#endif
p2p_protocol_wk_cmd(adapter, P2P_AP_P2P_CH_SWITCH_PROCESS_WK);

View File

@ -141,7 +141,7 @@ sint _rtw_init_recv_priv(struct recv_priv *precvpriv, _adapter *padapter)
#ifdef CONFIG_USB_HCI
ATOMIC_SET(&(precvpriv->rx_pending_cnt), 1);
atomic_set(&(precvpriv->rx_pending_cnt), 1);
_rtw_init_sema(&precvpriv->allrxreturnevt, 0);
@ -1254,7 +1254,7 @@ sint sta2sta_data_frame(
}
#ifdef CONFIG_TDLS_CH_SW
if (ATOMIC_READ(&pchsw_info->chsw_on) == _TRUE) {
if (atomic_read(&pchsw_info->chsw_on) == _TRUE) {
if (adapter->mlmeextpriv.cur_channel != rtw_get_oper_ch(adapter)) {
pchsw_info->ch_sw_state |= TDLS_PEER_AT_OFF_STATE;
if (!(pchsw_info->ch_sw_state & TDLS_CH_SW_INITIATOR_STATE))
@ -4905,7 +4905,7 @@ int rtw_inc_and_chk_continual_no_rx_packet(struct sta_info *sta, int tid_index)
{
int ret = _FALSE;
int value = ATOMIC_INC_RETURN(&sta->continual_no_rx_packet[tid_index]);
int value = atomic_inc_return(&sta->continual_no_rx_packet[tid_index]);
if (value >= MAX_CONTINUAL_NORXPACKET_COUNT)
ret = _TRUE;
@ -4918,7 +4918,7 @@ int rtw_inc_and_chk_continual_no_rx_packet(struct sta_info *sta, int tid_index)
*/
void rtw_reset_continual_no_rx_packet(struct sta_info *sta, int tid_index)
{
ATOMIC_SET(&sta->continual_no_rx_packet[tid_index], 0);
atomic_set(&sta->continual_no_rx_packet[tid_index], 0);
}
u8 adapter_allow_bmc_data_rx(_adapter *adapter)

View File

@ -2374,7 +2374,7 @@ static void rm_dbg_show_meas(struct rm_obj *prm, char *s)
psta->cmn.aid, MAC_ARG(psta->cmn.mac_addr));
sprintf(pstr(s), "clock=%d, state=%s, rpt=%u/%u\n",
(int)ATOMIC_READ(&prm->pclock->counter),
(int)atomic_read(&prm->pclock->counter),
rm_state_name(prm->state), prm->p.rpt, prm->q.rpt);
}

View File

@ -42,12 +42,12 @@ void rm_timer_callback(void *data)
for (i=0;i<RM_TIMER_NUM;i++) {
pclock = &prmpriv->clock[i];
if (pclock->prm == NULL
||(ATOMIC_READ(&(pclock->counter)) == 0))
||(atomic_read(&(pclock->counter)) == 0))
continue;
ATOMIC_DEC(&(pclock->counter));
atomic_dec(&(pclock->counter));
if (ATOMIC_READ(&(pclock->counter)) == 0)
if (atomic_read(&(pclock->counter)) == 0)
rm_post_event(pclock->prm->psta->padapter,
pclock->prm->rmid, prmpriv->clock[i].evid);
}
@ -176,7 +176,7 @@ static int rm_enqueue_ev(_queue *queue, struct rm_event *obj, bool to_head)
static void rm_set_clock(struct rm_obj *prm, u32 ms, enum RM_EV_ID evid)
{
ATOMIC_SET(&(prm->pclock->counter), (ms/CLOCK_UNIT));
atomic_set(&(prm->pclock->counter), (ms/CLOCK_UNIT));
prm->pclock->evid = evid;
}
@ -192,7 +192,7 @@ static struct rm_clock *rm_alloc_clock(_adapter *padapter, struct rm_obj *prm)
if (pclock->prm == NULL) {
pclock->prm = prm;
ATOMIC_SET(&(pclock->counter), 0);
atomic_set(&(pclock->counter), 0);
pclock->evid = RM_EV_max;
break;
}
@ -202,14 +202,14 @@ static struct rm_clock *rm_alloc_clock(_adapter *padapter, struct rm_obj *prm)
static void rm_cancel_clock(struct rm_obj *prm)
{
ATOMIC_SET(&(prm->pclock->counter), 0);
atomic_set(&(prm->pclock->counter), 0);
prm->pclock->evid = RM_EV_max;
}
static void rm_free_clock(struct rm_clock *pclock)
{
pclock->prm = NULL;
ATOMIC_SET(&(pclock->counter), 0);
atomic_set(&(pclock->counter), 0);
pclock->evid = RM_EV_max;
}

View File

@ -60,7 +60,7 @@ static u8 sdio_io(struct dvobj_priv *d, u32 addr, void *buf, size_t len, u8 writ
if (retry) {
RTW_INFO("%s: Retry %s OK! addr=0x%05x %zu bytes, retry=%u,%u\n",
__FUNCTION__, write?"write":"read",
addr, len, retry, ATOMIC_READ(&d->continual_io_error));
addr, len, retry, atomic_read(&d->continual_io_error));
RTW_INFO_DUMP("Data: ", buf, len);
}
rtw_reset_continual_io_error(d);
@ -68,14 +68,14 @@ static u8 sdio_io(struct dvobj_priv *d, u32 addr, void *buf, size_t len, u8 writ
}
RTW_ERR("%s: %s FAIL! error(%d) addr=0x%05x %zu bytes, retry=%u,%u\n",
__FUNCTION__, write?"write":"read", err, addr, len,
retry, ATOMIC_READ(&d->continual_io_error));
retry, atomic_read(&d->continual_io_error));
retry++;
stop_retry = rtw_inc_and_chk_continual_io_error(d);
if ((err == -1) || (stop_retry == _TRUE) || (retry > SD_IO_TRY_CNT)) {
/* critical error, unrecoverable */
RTW_ERR("%s: Fatal error! Set surprise remove flag ON! (retry=%u,%u)\n",
__FUNCTION__, retry, ATOMIC_READ(&d->continual_io_error));
__FUNCTION__, retry, atomic_read(&d->continual_io_error));
rtw_set_surprise_removed(dvobj_get_primary_adapter(d));
return _FAIL;
}
@ -84,7 +84,7 @@ static u8 sdio_io(struct dvobj_priv *d, u32 addr, void *buf, size_t len, u8 writ
if ((addr & 0x10000) || !(addr & 0xE000)) {
RTW_WARN("%s: Retry %s addr=0x%05x %zu bytes, retry=%u,%u\n",
__FUNCTION__, write?"write":"read", addr, len,
retry, ATOMIC_READ(&d->continual_io_error));
retry, atomic_read(&d->continual_io_error));
continue;
}
return _FAIL;

View File

@ -47,7 +47,7 @@ void rtw_reset_tdls_info(_adapter *padapter)
#ifdef CONFIG_TDLS_CH_SW
ptdlsinfo->chsw_info.ch_sw_state = TDLS_STATE_NONE;
ATOMIC_SET(&ptdlsinfo->chsw_info.chsw_on, _FALSE);
atomic_set(&ptdlsinfo->chsw_info.chsw_on, _FALSE);
ptdlsinfo->chsw_info.off_ch_num = 0;
ptdlsinfo->chsw_info.ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
ptdlsinfo->chsw_info.cur_time = 0;
@ -945,8 +945,8 @@ void rtw_tdls_set_ch_sw_oper_control(_adapter *padapter, u8 enable)
else
pHalData->ch_switch_offload = _FALSE;
if (ATOMIC_READ(&padapter->tdlsinfo.chsw_info.chsw_on) != enable)
ATOMIC_SET(&padapter->tdlsinfo.chsw_info.chsw_on, enable);
if (atomic_read(&padapter->tdlsinfo.chsw_info.chsw_on) != enable)
atomic_set(&padapter->tdlsinfo.chsw_info.chsw_on, enable);
rtw_hal_set_hwreg(padapter, HW_VAR_TDLS_BCN_EARLY_C2H_RPT, &enable);
RTW_INFO("[TDLS] %s Bcn Early C2H Report\n", (enable == _TRUE) ? "Start" : "Stop");
@ -959,7 +959,7 @@ void rtw_tdls_ch_sw_back_to_base_chnl(_adapter *padapter)
pmlmepriv = &padapter->mlmepriv;
if ((ATOMIC_READ(&pchsw_info->chsw_on) == _TRUE) &&
if ((atomic_read(&pchsw_info->chsw_on) == _TRUE) &&
(padapter->mlmeextpriv.cur_channel != rtw_get_oper_ch(padapter)))
rtw_tdls_cmd(padapter, pchsw_info->addr, TDLS_CH_SW_TO_BASE_CHNL_UNSOLICITED);
}
@ -2614,7 +2614,7 @@ sint On_TDLS_Ch_Switch_Req(_adapter *padapter, union recv_frame *precv_frame, st
if (_rtw_memcmp(pchsw_info->addr, zaddr, ETH_ALEN) == _TRUE)
_rtw_memcpy(pchsw_info->addr, ptdls_sta->cmn.mac_addr, ETH_ALEN);
if (ATOMIC_READ(&pchsw_info->chsw_on) == _FALSE)
if (atomic_read(&pchsw_info->chsw_on) == _FALSE)
rtw_tdls_cmd(padapter, ptdls_sta->cmn.mac_addr, TDLS_CH_SW_START);
rtw_tdls_cmd(padapter, ptdls_sta->cmn.mac_addr, TDLS_CH_SW_RESP);
@ -2642,7 +2642,7 @@ sint On_TDLS_Ch_Switch_Rsp(_adapter *padapter, union recv_frame *precv_frame, st
/* If we receive Unsolicited TDLS Channel Switch Response when channel switch is running, */
/* we will go back to base channel and terminate this channel switch procedure */
if (ATOMIC_READ(&pchsw_info->chsw_on) == _TRUE) {
if (atomic_read(&pchsw_info->chsw_on) == _TRUE) {
if (pmlmeext->cur_channel != rtw_get_oper_ch(padapter)) {
RTW_INFO("[TDLS] Rx unsolicited channel switch response\n");
rtw_tdls_cmd(padapter, ptdls_sta->cmn.mac_addr, TDLS_CH_SW_TO_BASE_CHNL);
@ -2694,7 +2694,7 @@ sint On_TDLS_Ch_Switch_Rsp(_adapter *padapter, union recv_frame *precv_frame, st
if ((pmlmeext->cur_channel == rtw_get_oper_ch(padapter)) &&
(pchsw_info->ch_sw_state & TDLS_WAIT_CH_RSP_STATE)) {
if (ATOMIC_READ(&pchsw_info->chsw_on) == _TRUE)
if (atomic_read(&pchsw_info->chsw_on) == _TRUE)
rtw_tdls_cmd(padapter, ptdls_sta->cmn.mac_addr, TDLS_CH_SW_TO_OFF_CHNL);
}

View File

@ -2489,7 +2489,7 @@ void rtw_mbid_cam_init(struct dvobj_priv *dvobj)
_rtw_spinlock_init(&mbid_cam_ctl->lock);
mbid_cam_ctl->bitmap = 0;
ATOMIC_SET(&mbid_cam_ctl->mbid_entry_num, 0);
atomic_set(&mbid_cam_ctl->mbid_entry_num, 0);
_rtw_memset(&dvobj->mbid_cam_cache, 0, sizeof(dvobj->mbid_cam_cache));
}
@ -2511,7 +2511,7 @@ void rtw_mbid_cam_reset(_adapter *adapter)
_rtw_memset(&dvobj->mbid_cam_cache, 0, sizeof(dvobj->mbid_cam_cache));
_exit_critical_bh(&mbid_cam_ctl->lock, &irqL);
ATOMIC_SET(&mbid_cam_ctl->mbid_entry_num, 0);
atomic_set(&mbid_cam_ctl->mbid_entry_num, 0);
}
static u8 _rtw_mbid_cam_search_by_macaddr(_adapter *adapter, u8 *mac_addr)
{
@ -2601,7 +2601,7 @@ inline u8 rtw_get_mbid_cam_entry_num(_adapter *adapter)
struct dvobj_priv *dvobj = adapter_to_dvobj(adapter);
struct mbid_cam_ctl_t *mbid_cam_ctl = &dvobj->mbid_cam_ctl;
return ATOMIC_READ(&mbid_cam_ctl->mbid_entry_num);
return atomic_read(&mbid_cam_ctl->mbid_entry_num);
}
static inline void mbid_cam_cache_init(_adapter *adapter, struct mbid_cam_cache *pmbid_cam, u8 *mac_addr)
@ -2625,7 +2625,7 @@ u8 rtw_mbid_camid_alloc(_adapter *adapter, u8 *mac_addr)
u8 cam_id = INVALID_CAM_ID, i;
struct dvobj_priv *dvobj = adapter_to_dvobj(adapter);
struct mbid_cam_ctl_t *mbid_cam_ctl = &dvobj->mbid_cam_ctl;
u8 entry_num = ATOMIC_READ(&mbid_cam_ctl->mbid_entry_num);
u8 entry_num = atomic_read(&mbid_cam_ctl->mbid_entry_num);
if (INVALID_CAM_ID != rtw_mbid_cam_search_by_macaddr(adapter, mac_addr))
goto exit;
@ -2648,7 +2648,7 @@ u8 rtw_mbid_camid_alloc(_adapter *adapter, u8 *mac_addr)
_exit_critical_bh(&mbid_cam_ctl->lock, &irqL);
if (cam_id != INVALID_CAM_ID) {
ATOMIC_INC(&mbid_cam_ctl->mbid_entry_num);
atomic_inc(&mbid_cam_ctl->mbid_entry_num);
RTW_INFO("%s mac:"MAC_FMT" - cam_id:%d\n", __func__, MAC_ARG(mac_addr), cam_id);
#ifdef DBG_MBID_CAM_DUMP
rtw_mbid_cam_cache_dump(RTW_DBGDUMP, __func__, adapter);
@ -2701,7 +2701,7 @@ u8 rtw_mbid_cam_assign(_adapter *adapter, u8 *mac_addr, u8 camid)
_exit_critical_bh(&mbid_cam_ctl->lock, &irqL);
if (ret == _TRUE) {
ATOMIC_INC(&mbid_cam_ctl->mbid_entry_num);
atomic_inc(&mbid_cam_ctl->mbid_entry_num);
RTW_INFO("%s mac:"MAC_FMT" - cam_id:%d\n", __func__, MAC_ARG(mac_addr), camid);
#ifdef DBG_MBID_CAM_DUMP
rtw_mbid_cam_cache_dump(RTW_DBGDUMP, __func__, adapter);
@ -2727,7 +2727,7 @@ void rtw_mbid_camid_clean(_adapter *adapter, u8 mbss_canid)
mbid_cam_cache_clr(&dvobj->mbid_cam_cache[mbss_canid]);
mbid_cam_ctl->bitmap &= (~BIT(mbss_canid));
_exit_critical_bh(&mbid_cam_ctl->lock, &irqL);
ATOMIC_DEC(&mbid_cam_ctl->mbid_entry_num);
atomic_dec(&mbid_cam_ctl->mbid_entry_num);
RTW_INFO("%s - cam_id:%d\n", __func__, mbss_canid);
}
int rtw_mbid_cam_cache_dump(void *sel, const char *fun_name, _adapter *adapter)
@ -2738,7 +2738,7 @@ int rtw_mbid_cam_cache_dump(void *sel, const char *fun_name, _adapter *adapter)
u8 iface_id;
struct dvobj_priv *dvobj = adapter_to_dvobj(adapter);
struct mbid_cam_ctl_t *mbid_cam_ctl = &dvobj->mbid_cam_ctl;
u8 entry_num = ATOMIC_READ(&mbid_cam_ctl->mbid_entry_num);
u8 entry_num = atomic_read(&mbid_cam_ctl->mbid_entry_num);
u8 max_cam_id = rtw_get_max_mbid_cam_id(adapter);
RTW_PRINT_SEL(sel, "== MBSSID CAM DUMP (%s)==\n", fun_name);

View File

@ -60,8 +60,8 @@ void rtw_acs_version_dump(void *sel, _adapter *adapter);
extern void phydm_ccx_monitor_trigger(void *p_dm_void, u16 monitor_time);
extern void phydm_ccx_monitor_result(void *p_dm_void);
#define GET_ACS_STATE(padapter) (ATOMIC_READ(&GET_HAL_DATA(padapter)->acs.state))
#define SET_ACS_STATE(padapter, set_state) (ATOMIC_SET(&GET_HAL_DATA(padapter)->acs.state, set_state))
#define GET_ACS_STATE(padapter) (atomic_read(&GET_HAL_DATA(padapter)->acs.state))
#define SET_ACS_STATE(padapter, set_state) (atomic_set(&GET_HAL_DATA(padapter)->acs.state, set_state))
#define IS_ACS_ENABLE(padapter) ((GET_ACS_STATE(padapter) == ACS_ENABLE) ? _TRUE : _FALSE)
enum ACS_STATE {
@ -75,7 +75,7 @@ enum ACS_STATE {
#define ACS_BW_160M BIT(3)
struct auto_chan_sel {
ATOMIC_T state;
atomic_t state;
u8 trigger_ch;
bool triggered;
u8 clm_ratio[MAX_CHANNEL_NUM];
@ -142,8 +142,8 @@ void rtw_acs_stop(_adapter *adapter);
#ifdef CONFIG_BACKGROUND_NOISE_MONITOR
#define RTK_NOISE_MONITOR_VERSION 3
#define GET_NM_STATE(padapter) (ATOMIC_READ(&GET_HAL_DATA(padapter)->nm.state))
#define SET_NM_STATE(padapter, set_state) (ATOMIC_SET(&GET_HAL_DATA(padapter)->nm.state, set_state))
#define GET_NM_STATE(padapter) (atomic_read(&GET_HAL_DATA(padapter)->nm.state))
#define SET_NM_STATE(padapter, set_state) (atomic_set(&GET_HAL_DATA(padapter)->nm.state, set_state))
#define IS_NM_ENABLE(padapter) ((GET_NM_STATE(padapter) == NM_ENABLE) ? _TRUE : _FALSE)
enum NM_STATE {
@ -152,7 +152,7 @@ enum NM_STATE {
};
struct noise_monitor {
ATOMIC_T state;
atomic_t state;
s16 noise[MAX_CHANNEL_NUM];
u8 bss_nums[MAX_CHANNEL_NUM];
};

View File

@ -1114,7 +1114,7 @@ phy_SwChnlAndSetBwMode8192E(
#ifdef CONFIG_TDLS
#ifdef CONFIG_TDLS_CH_SW
/* It takes too much time of setting tx power, influence channel switch */
if ((ATOMIC_READ(&Adapter->tdlsinfo.chsw_info.chsw_on) == _FALSE))
if ((atomic_read(&Adapter->tdlsinfo.chsw_info.chsw_on) == _FALSE))
#endif
#endif /* CONFIG_TDLS */
PHY_SetTxPowerLevel8192E(Adapter, pHalData->current_channel);

View File

@ -52,7 +52,7 @@ void interrupt_handler_8192eu(_adapter *padapter, u16 pkt_len, u8 *pbuf)
struct tdls_ch_switch *pchsw_info = &padapter->tdlsinfo.chsw_info;
u32 last_time = pchsw_info->cur_time;
pchsw_info->cur_time = rtw_systime_to_ms(rtw_get_current_time());
if ((ATOMIC_READ(&pchsw_info->chsw_on) == _TRUE) &&
if ((atomic_read(&pchsw_info->chsw_on) == _TRUE) &&
/* Sometimes we receive multiple interrupts in very little time period, use the follow condition test to filter */
(pchsw_info->cur_time - last_time > padapter->mlmeextpriv.mlmext_info.bcn_interval - 5) &&
(padapter->mlmeextpriv.cur_channel != rtw_get_oper_ch(padapter))) {

View File

@ -942,7 +942,7 @@ struct rf_ctl_t {
struct mbid_cam_ctl_t {
_lock lock;
u8 bitmap;
ATOMIC_T mbid_entry_num;
atomic_t mbid_entry_num;
};
struct mbid_cam_cache {
u8 iface_id;
@ -995,8 +995,8 @@ struct dvobj_priv {
u8 HardwareType;
u8 interface_type;/*USB,SDIO,SPI,PCI*/
ATOMIC_T bSurpriseRemoved;
ATOMIC_T bDriverStopped;
atomic_t bSurpriseRemoved;
atomic_t bDriverStopped;
s32 processing_dev_remove;
@ -1076,9 +1076,9 @@ struct dvobj_priv {
u8 Queue2Pipe[HW_QUEUE_ENTRY];/* for out pipe mapping */
u8 irq_alloc;
ATOMIC_T continual_io_error;
atomic_t continual_io_error;
ATOMIC_T disable_func;
atomic_t disable_func;
u8 xmit_block;
_lock xmit_block_lock;
@ -1248,7 +1248,6 @@ struct dvobj_priv {
#endif
/* also for RTK T/P Testing Mode */
u8 scan_deny;
};
#define DEV_STA_NUM(_dvobj) MSTATE_STA_NUM(&((_dvobj)->iface_state))
@ -1286,22 +1285,22 @@ struct dvobj_priv {
static inline void dev_set_surprise_removed(struct dvobj_priv *dvobj)
{
ATOMIC_SET(&dvobj->bSurpriseRemoved, _TRUE);
atomic_set(&dvobj->bSurpriseRemoved, _TRUE);
}
static inline void dev_clr_surprise_removed(struct dvobj_priv *dvobj)
{
ATOMIC_SET(&dvobj->bSurpriseRemoved, _FALSE);
atomic_set(&dvobj->bSurpriseRemoved, _FALSE);
}
static inline void dev_set_drv_stopped(struct dvobj_priv *dvobj)
{
ATOMIC_SET(&dvobj->bDriverStopped, _TRUE);
atomic_set(&dvobj->bDriverStopped, _TRUE);
}
static inline void dev_clr_drv_stopped(struct dvobj_priv *dvobj)
{
ATOMIC_SET(&dvobj->bDriverStopped, _FALSE);
atomic_set(&dvobj->bDriverStopped, _FALSE);
}
#define dev_is_surprise_removed(dvobj) (ATOMIC_READ(&dvobj->bSurpriseRemoved) == _TRUE)
#define dev_is_drv_stopped(dvobj) (ATOMIC_READ(&dvobj->bDriverStopped) == _TRUE)
#define dev_is_surprise_removed(dvobj) (atomic_read(&dvobj->bSurpriseRemoved) == _TRUE)
#define dev_is_drv_stopped(dvobj) (atomic_read(&dvobj->bDriverStopped) == _TRUE)
#ifdef PLATFORM_LINUX
static inline struct device *dvobj_to_dev(struct dvobj_priv *dvobj)
@ -1448,7 +1447,7 @@ struct _ADAPTER {
#endif /* CONFIG_P2P */
#endif /* CONFIG_IOCTL_CFG80211 */
u32 setband;
ATOMIC_T bandskip;
atomic_t bandskip;
#ifdef CONFIG_P2P
struct wifidirect_info wdinfo;
@ -1741,27 +1740,27 @@ static inline void rtw_clr_drv_stopped(_adapter *padapter)
#define DF_RX_BIT BIT1 /*read_port_cancel*/
#define DF_IO_BIT BIT2
/* #define RTW_DISABLE_FUNC(padapter, func) (ATOMIC_ADD(&adapter_to_dvobj(padapter)->disable_func, (func))) */
/* #define RTW_ENABLE_FUNC(padapter, func) (ATOMIC_SUB(&adapter_to_dvobj(padapter)->disable_func, (func))) */
/* #define RTW_DISABLE_FUNC(padapter, func) (atomic_add(&adapter_to_dvobj(padapter)->disable_func, (func))) */
/* #define RTW_ENABLE_FUNC(padapter, func) (atomic_sub(&adapter_to_dvobj(padapter)->disable_func, (func))) */
__inline static void RTW_DISABLE_FUNC(_adapter *padapter, int func_bit)
{
int df = ATOMIC_READ(&adapter_to_dvobj(padapter)->disable_func);
int df = atomic_read(&adapter_to_dvobj(padapter)->disable_func);
df |= func_bit;
ATOMIC_SET(&adapter_to_dvobj(padapter)->disable_func, df);
atomic_set(&adapter_to_dvobj(padapter)->disable_func, df);
}
__inline static void RTW_ENABLE_FUNC(_adapter *padapter, int func_bit)
{
int df = ATOMIC_READ(&adapter_to_dvobj(padapter)->disable_func);
int df = atomic_read(&adapter_to_dvobj(padapter)->disable_func);
df &= ~(func_bit);
ATOMIC_SET(&adapter_to_dvobj(padapter)->disable_func, df);
atomic_set(&adapter_to_dvobj(padapter)->disable_func, df);
}
#define RTW_CANNOT_RUN(padapter) \
(rtw_is_surprise_removed(padapter) || \
rtw_is_drv_stopped(padapter))
#define RTW_IS_FUNC_DISABLED(padapter, func_bit) (ATOMIC_READ(&adapter_to_dvobj(padapter)->disable_func) & (func_bit))
#define RTW_IS_FUNC_DISABLED(padapter, func_bit) (atomic_read(&adapter_to_dvobj(padapter)->disable_func) & (func_bit))
#define RTW_CANNOT_IO(padapter) \
(rtw_is_surprise_removed(padapter) || \

View File

@ -610,18 +610,6 @@ extern void rtw_set_bit(int nr, unsigned long *addr);
extern void rtw_clear_bit(int nr, unsigned long *addr);
extern int rtw_test_and_clear_bit(int nr, unsigned long *addr);
extern void ATOMIC_SET(ATOMIC_T *v, int i);
extern int ATOMIC_READ(ATOMIC_T *v);
extern void ATOMIC_ADD(ATOMIC_T *v, int i);
extern void ATOMIC_SUB(ATOMIC_T *v, int i);
extern void ATOMIC_INC(ATOMIC_T *v);
extern void ATOMIC_DEC(ATOMIC_T *v);
extern int ATOMIC_ADD_RETURN(ATOMIC_T *v, int i);
extern int ATOMIC_SUB_RETURN(ATOMIC_T *v, int i);
extern int ATOMIC_INC_RETURN(ATOMIC_T *v);
extern int ATOMIC_DEC_RETURN(ATOMIC_T *v);
extern bool ATOMIC_INC_UNLESS(ATOMIC_T *v, int u);
/* File operation APIs, just for linux now */
extern int rtw_is_file_readable(const char *path);
extern int rtw_is_file_readable_with_size(const char *path, u32 *sz);

View File

@ -732,9 +732,6 @@ __inline static void _set_workitem(_workitem *pwork)
static __inline void thread_enter(char *name);
//Atomic integer operations
typedef uint32_t ATOMIC_T ;
#define rtw_netdev_priv(netdev) (((struct ifnet *)netdev)->if_softc)
#define rtw_free_netdev(netdev) if_free((netdev))

View File

@ -182,7 +182,7 @@ __inline static void _set_workitem(_workitem *pwork)
#define PATH_LENGTH_MAX MAX_PATH
//Atomic integer operations
#define ATOMIC_T LONG
#define atomic_t LONG
#define NDEV_FMT "%s"
#define NDEV_ARG(ndev) ""

View File

@ -513,7 +513,7 @@ static inline int rtw_merge_string(char *dst, int dst_len, const char *src1, con
#define PATH_LENGTH_MAX PATH_MAX
/* Atomic integer operations */
#define ATOMIC_T atomic_t
#define atomic_t atomic_t
#define rtw_netdev_priv(netdev) (((struct rtw_netdev_priv_indicator *)netdev_priv(netdev))->priv)

View File

@ -192,7 +192,7 @@ __inline static void _set_workitem(_workitem *pwork)
#define PATH_LENGTH_MAX MAX_PATH
//Atomic integer operations
#define ATOMIC_T LONG
#define atomic_t LONG
#define NDEV_FMT "%s"

View File

@ -66,7 +66,7 @@ struct cmd_priv {
u32 cmd_issued_cnt;
u32 cmd_done_cnt;
u32 rsp_cnt;
ATOMIC_T cmdthd_running;
atomic_t cmdthd_running;
/* u8 cmdthd_running; */
_adapter *padapter;
@ -107,7 +107,7 @@ struct evt_priv {
u8 lbkevt_num;
u8 *cmdevt_parm;
#endif
ATOMIC_T event_seq;
atomic_t event_seq;
u8 *evt_buf; /* shall be non-paged, and 4 bytes aligned */
u8 *evt_allocated_buf;
u32 evt_done_cnt;

View File

@ -359,7 +359,7 @@ struct cfg80211_wifidirect_info {
u8 restore_channel;
struct ieee80211_channel remain_on_ch_channel;
enum nl80211_channel_type remain_on_ch_type;
ATOMIC_T ro_ch_cookie_gen;
atomic_t ro_ch_cookie_gen;
u64 remain_on_ch_cookie;
bool is_ro_ch;
struct wireless_dev *ro_ch_wdev;
@ -504,7 +504,7 @@ struct tdls_temp_mgmt {
#ifdef CONFIG_TDLS_CH_SW
struct tdls_ch_switch {
u32 ch_sw_state;
ATOMIC_T chsw_on;
atomic_t chsw_on;
u8 addr[ETH_ALEN];
u8 off_ch_num;
u8 ch_offset;
@ -731,7 +731,7 @@ struct nb_rpt_hdr {
u8 phy_type;
};
/*IEEE Std 80211v, Figure 7-95e2¡XBSS Termination Duration subelement field format */
/*IEEE Std 80211v, Figure 7-95e2<EFBFBD>XBSS Termination Duration subelement field format */
struct btm_term_duration {
u8 id;
u8 len;
@ -739,7 +739,7 @@ struct btm_term_duration {
u16 duration;
};
/*IEEE Std 80211v, Figure 7-101n8¡XBSS Transition Management Request frame body format */
/*IEEE Std 80211v, Figure 7-101n8<EFBFBD>XBSS Transition Management Request frame body format */
struct btm_req_hdr {
u8 req_mode;
u16 disassoc_timer;
@ -843,7 +843,7 @@ struct mlme_priv {
#ifdef CONFIG_SET_SCAN_DENY_TIMER
_timer set_scan_deny_timer;
ATOMIC_T set_scan_deny; /* 0: allowed, 1: deny */
atomic_t set_scan_deny; /* 0: allowed, 1: deny */
#endif
u8 wpa_phase;/*wpa_phase after wps finished*/
@ -914,7 +914,7 @@ struct mlme_priv {
/* Number of associated stations that do not support Short Preamble */
int num_sta_no_short_preamble;
ATOMIC_T olbc; /* Overlapping Legacy BSS Condition (Legacy b/g)*/
atomic_t olbc; /* Overlapping Legacy BSS Condition (Legacy b/g)*/
/* Number of HT associated stations that do not support greenfield */
int num_sta_ht_no_gf;
@ -929,7 +929,7 @@ struct mlme_priv {
int num_sta_40mhz_intolerant;
/* Overlapping BSS information */
ATOMIC_T olbc_ht;
atomic_t olbc_ht;
#ifdef CONFIG_80211N_HT
int ht_20mhz_width_req;
@ -1019,7 +1019,7 @@ struct mlme_priv {
int widi_state;
int listen_state;
_timer listen_timer;
ATOMIC_T rx_probe_rsp; /* 1:receive probe respone from RDS source. */
atomic_t rx_probe_rsp; /* 1:receive probe respone from RDS source. */
u8 *l2sdTaBuffer;
u8 channel_idx;
u8 group_cnt; /* In WiDi 3.5, they specified another scan algo. for WFD/RDS co-existed */

View File

@ -482,7 +482,7 @@ struct p2p_oper_class_map {
struct mlme_ext_priv {
_adapter *padapter;
u8 mlmeext_init;
ATOMIC_T event_seq;
atomic_t event_seq;
u16 mgnt_seq;
#ifdef CONFIG_IEEE80211W
u16 sa_query_seq;

View File

@ -291,9 +291,9 @@ typedef struct lps_poff_info {
u32 tx_bndy_dynamic;
u16 ConfLenForPTK;
u16 ConfLenForGTK;
ATOMIC_T bEnterPOFF;
ATOMIC_T bTxBoundInProgress;
ATOMIC_T bSetPOFFParm;
atomic_t bEnterPOFF;
atomic_t bTxBoundInProgress;
atomic_t bSetPOFFParm;
} lps_poff_info_t;
#endif /*CONFIG_LPS_POFF*/

View File

@ -387,7 +387,7 @@ struct recv_priv {
/* u8 *pallocated_urb_buf; */
_sema allrxreturnevt;
uint ff_hwaddr;
ATOMIC_T rx_pending_cnt;
atomic_t rx_pending_cnt;
#ifdef CONFIG_USB_INTERRUPT_IN_PIPE
#ifdef PLATFORM_LINUX

View File

@ -53,7 +53,7 @@ struct rm_event {
struct rm_clock {
struct rm_obj *prm;
ATOMIC_T counter;
atomic_t counter;
enum RM_EV_ID evid;
};

View File

@ -357,7 +357,7 @@ struct sta_info {
/* for A-MPDU Rx reordering buffer control */
struct recv_reorder_ctrl recvreorder_ctrl[TID_NUM];
ATOMIC_T continual_no_rx_packet[TID_NUM];
atomic_t continual_no_rx_packet[TID_NUM];
/* for A-MPDU Tx */
/* unsigned char ampdu_txen_bitmap; */
u16 BA_starting_seqctrl[16];

View File

@ -6687,7 +6687,7 @@ static s32 cfg80211_rtw_remain_on_channel(struct wiphy *wiphy,
is_p2p_find = (duration < (pwdinfo->ext_listen_interval)) ? _TRUE : _FALSE;
#endif
*cookie = ATOMIC_INC_RETURN(&pcfg80211_wdinfo->ro_ch_cookie_gen);
*cookie = atomic_inc_return(&pcfg80211_wdinfo->ro_ch_cookie_gen);
RTW_INFO(FUNC_ADPT_FMT"%s ch:%u duration:%d, cookie:0x%llx\n"
, FUNC_ADPT_ARG(padapter), wdev == wiphy_to_pd_wdev(wiphy) ? " PD" : ""
@ -7079,7 +7079,7 @@ static int _cfg80211_rtw_mgmt_tx(_adapter *padapter, u8 tx_ch, u8 no_cck, const
#if defined(RTW_ROCH_BACK_OP) && defined(CONFIG_P2P) && defined(CONFIG_CONCURRENT_MODE)
if (rtw_cfg80211_get_is_roch(padapter)
&& ATOMIC_READ(&pwdev_priv->switch_ch_to) == 1
&& atomic_read(&pwdev_priv->switch_ch_to) == 1
) {
u16 ext_listen_period;
@ -7087,7 +7087,7 @@ static int _cfg80211_rtw_mgmt_tx(_adapter *padapter, u8 tx_ch, u8 no_cck, const
ext_listen_period = 500;
else
ext_listen_period = pwdinfo->ext_listen_period;
ATOMIC_SET(&pwdev_priv->switch_ch_to, 0);
atomic_set(&pwdev_priv->switch_ch_to, 0);
_set_timer(&pwdinfo->ap_p2p_switch_timer, ext_listen_period);
RTW_INFO("%s, set switch ch timer, period=%d\n", __func__, ext_listen_period);
}
@ -9362,7 +9362,7 @@ void rtw_cfg80211_init_wdev_data(_adapter *padapter)
#ifdef CONFIG_CONCURRENT_MODE
struct rtw_wdev_priv *pwdev_priv = adapter_wdev_data(padapter);
ATOMIC_SET(&pwdev_priv->switch_ch_to, 1);
atomic_set(&pwdev_priv->switch_ch_to, 1);
#endif
}
@ -10103,7 +10103,7 @@ int rtw_wdev_alloc(_adapter *padapter, struct wiphy *wiphy)
_rtw_mutex_init(&pwdev_priv->roch_mutex);
#ifdef CONFIG_CONCURRENT_MODE
ATOMIC_SET(&pwdev_priv->switch_ch_to, 1);
atomic_set(&pwdev_priv->switch_ch_to, 1);
#endif
#ifdef CONFIG_RTW_CFGVEDNOR_RSSIMONITOR

View File

@ -177,7 +177,7 @@ struct rtw_wdev_priv {
_mutex roch_mutex;
#ifdef CONFIG_CONCURRENT_MODE
ATOMIC_T switch_ch_to;
atomic_t switch_ch_to;
#endif
#ifdef CONFIG_RTW_CFGVENDOR_RANDOM_MAC_OUI

View File

@ -6225,7 +6225,7 @@ static int rtw_dbg_port(struct net_device *dev,
pxmitpriv->free_xmit_extbuf_cnt, pxmitpriv->free_xframe_ext_cnt,
precvpriv->free_recvframe_cnt);
#ifdef CONFIG_USB_HCI
RTW_INFO("rx_urb_pending_cn=%d\n", ATOMIC_READ(&(precvpriv->rx_pending_cnt)));
RTW_INFO("rx_urb_pending_cn=%d\n", atomic_read(&(precvpriv->rx_pending_cnt)));
#endif
}
break;
@ -11042,7 +11042,7 @@ static int rtw_wfd_tdls_status(struct net_device *dev,
#ifdef CONFIG_TDLS_CH_SW
,
ptdlsinfo->chsw_info.ch_sw_state,
ATOMIC_READ(&padapter->tdlsinfo.chsw_info.chsw_on),
atomic_read(&padapter->tdlsinfo.chsw_info.chsw_on),
ptdlsinfo->chsw_info.off_ch_num,
ptdlsinfo->chsw_info.cur_time,
ptdlsinfo->chsw_info.ch_offset,

View File

@ -2134,7 +2134,7 @@ struct dvobj_priv *devobj_init(void)
pdvobj->processing_dev_remove = _FALSE;
ATOMIC_SET(&pdvobj->disable_func, 0);
atomic_set(&pdvobj->disable_func, 0);
rtw_macid_ctl_init(&pdvobj->macid_ctl);
#ifdef CONFIG_CLIENT_PORT_CFG
@ -4273,7 +4273,7 @@ void rtw_dev_unload(PADAPTER padapter)
{
rtw_stop_drv_threads(padapter);
if (ATOMIC_READ(&(pcmdpriv->cmdthd_running)) == _TRUE) {
if (atomic_read(&(pcmdpriv->cmdthd_running)) == _TRUE) {
RTW_ERR("cmd_thread not stop !!\n");
rtw_warn_on(1);
}

View File

@ -79,7 +79,7 @@ static void rtw_dev_shutdown(struct device *dev)
}
}
}
ATOMIC_SET(&dvobj->continual_io_error, MAX_CONTINUAL_IO_ERR + 1);
atomic_set(&dvobj->continual_io_error, MAX_CONTINUAL_IO_ERR + 1);
}
}
}
@ -686,7 +686,7 @@ static void usb_dvobj_deinit(struct usb_interface *usb_intf)
devobj_deinit(dvobj);
}
/* RTW_INFO("%s %d\n", __func__, ATOMIC_READ(&usb_intf->dev.kobj.kref.refcount)); */
/* RTW_INFO("%s %d\n", __func__, atomic_read(&usb_intf->dev.kobj.kref.refcount)); */
usb_put_dev(interface_to_usbdev(usb_intf));
}

View File

@ -753,7 +753,7 @@ void usb_read_port_complete(struct urb *purb, struct pt_regs *regs)
_adapter *padapter = (_adapter *)precvbuf->adapter;
struct recv_priv *precvpriv = &padapter->recvpriv;
ATOMIC_DEC(&(precvpriv->rx_pending_cnt));
atomic_dec(&(precvpriv->rx_pending_cnt));
if (RTW_CANNOT_RX(padapter)) {
RTW_INFO("%s() RX Warning! bDriverStopped(%s) OR bSurpriseRemoved(%s)\n"
@ -837,7 +837,7 @@ u32 usb_read_port(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *rmem)
usb_init_recvbuf(adapter, precvbuf);
if (precvbuf->pbuf) {
ATOMIC_INC(&(precvpriv->rx_pending_cnt));
atomic_inc(&(precvpriv->rx_pending_cnt));
purb = precvbuf->purb;
/* translate DMA FIFO addr to pipehandle */
@ -906,7 +906,7 @@ void usb_read_port_complete(struct urb *purb, struct pt_regs *regs)
_adapter *padapter = (_adapter *)precvbuf->adapter;
struct recv_priv *precvpriv = &padapter->recvpriv;
ATOMIC_DEC(&(precvpriv->rx_pending_cnt));
atomic_dec(&(precvpriv->rx_pending_cnt));
if (RTW_CANNOT_RX(padapter)) {
RTW_INFO("%s() RX Warning! bDriverStopped(%s) OR bSurpriseRemoved(%s)\n"
@ -1046,7 +1046,7 @@ recv_buf_hook:
goto exit;
}
ATOMIC_INC(&(precvpriv->rx_pending_cnt));
atomic_inc(&(precvpriv->rx_pending_cnt));
ret = _SUCCESS;
exit:

View File

@ -20,14 +20,6 @@
#define RT_TAG '1178'
#ifdef DBG_MEMORY_LEAK
#ifdef PLATFORM_LINUX
atomic_t _malloc_cnt = ATOMIC_INIT(0);
atomic_t _malloc_size = ATOMIC_INIT(0);
#endif
#endif /* DBG_MEMORY_LEAK */
#if defined(PLATFORM_LINUX)
/*
* Translate the OS dependent @param error_code to OS independent RTW_STATUS_CODE
@ -407,10 +399,10 @@ inline void _rtw_usb_buffer_free(struct usb_device *dev, size_t size, void *addr
#if defined(DBG_MEM_ALLOC)
struct rtw_mem_stat {
ATOMIC_T alloc; /* the memory bytes we allocate currently */
ATOMIC_T peak; /* the peak memory bytes we allocate */
ATOMIC_T alloc_cnt; /* the alloc count for alloc currently */
ATOMIC_T alloc_err_cnt; /* the error times we fail to allocate memory */
atomic_t alloc; /* the memory bytes we allocate currently */
atomic_t peak; /* the peak memory bytes we allocate */
atomic_t alloc_cnt; /* the alloc count for alloc currently */
atomic_t alloc_err_cnt; /* the error times we fail to allocate memory */
};
struct rtw_mem_stat rtw_mem_type_stat[mstat_tf_idx(MSTAT_TYPE_MAX)];
@ -448,18 +440,18 @@ void rtw_mstat_dump(void *sel)
int tx_alloc, tx_peak, tx_alloc_err, rx_alloc, rx_peak, rx_alloc_err;
for (i = 0; i < mstat_tf_idx(MSTAT_TYPE_MAX); i++) {
value_t[0][i] = ATOMIC_READ(&(rtw_mem_type_stat[i].alloc));
value_t[1][i] = ATOMIC_READ(&(rtw_mem_type_stat[i].peak));
value_t[2][i] = ATOMIC_READ(&(rtw_mem_type_stat[i].alloc_cnt));
value_t[3][i] = ATOMIC_READ(&(rtw_mem_type_stat[i].alloc_err_cnt));
value_t[0][i] = atomic_read(&(rtw_mem_type_stat[i].alloc));
value_t[1][i] = atomic_read(&(rtw_mem_type_stat[i].peak));
value_t[2][i] = atomic_read(&(rtw_mem_type_stat[i].alloc_cnt));
value_t[3][i] = atomic_read(&(rtw_mem_type_stat[i].alloc_err_cnt));
}
#ifdef RTW_MEM_FUNC_STAT
for (i = 0; i < mstat_ff_idx(MSTAT_FUNC_MAX); i++) {
value_f[0][i] = ATOMIC_READ(&(rtw_mem_func_stat[i].alloc));
value_f[1][i] = ATOMIC_READ(&(rtw_mem_func_stat[i].peak));
value_f[2][i] = ATOMIC_READ(&(rtw_mem_func_stat[i].alloc_cnt));
value_f[3][i] = ATOMIC_READ(&(rtw_mem_func_stat[i].alloc_err_cnt));
value_f[0][i] = atomic_read(&(rtw_mem_func_stat[i].alloc));
value_f[1][i] = atomic_read(&(rtw_mem_func_stat[i].peak));
value_f[2][i] = atomic_read(&(rtw_mem_func_stat[i].alloc_cnt));
value_f[3][i] = atomic_read(&(rtw_mem_func_stat[i].alloc_err_cnt));
}
#endif
@ -484,51 +476,51 @@ void rtw_mstat_update(const enum mstat_f flags, const MSTAT_STATUS status, u32 s
/* initialization */
if (!update_time) {
for (i = 0; i < mstat_tf_idx(MSTAT_TYPE_MAX); i++) {
ATOMIC_SET(&(rtw_mem_type_stat[i].alloc), 0);
ATOMIC_SET(&(rtw_mem_type_stat[i].peak), 0);
ATOMIC_SET(&(rtw_mem_type_stat[i].alloc_cnt), 0);
ATOMIC_SET(&(rtw_mem_type_stat[i].alloc_err_cnt), 0);
atomic_set(&(rtw_mem_type_stat[i].alloc), 0);
atomic_set(&(rtw_mem_type_stat[i].peak), 0);
atomic_set(&(rtw_mem_type_stat[i].alloc_cnt), 0);
atomic_set(&(rtw_mem_type_stat[i].alloc_err_cnt), 0);
}
#ifdef RTW_MEM_FUNC_STAT
for (i = 0; i < mstat_ff_idx(MSTAT_FUNC_MAX); i++) {
ATOMIC_SET(&(rtw_mem_func_stat[i].alloc), 0);
ATOMIC_SET(&(rtw_mem_func_stat[i].peak), 0);
ATOMIC_SET(&(rtw_mem_func_stat[i].alloc_cnt), 0);
ATOMIC_SET(&(rtw_mem_func_stat[i].alloc_err_cnt), 0);
atomic_set(&(rtw_mem_func_stat[i].alloc), 0);
atomic_set(&(rtw_mem_func_stat[i].peak), 0);
atomic_set(&(rtw_mem_func_stat[i].alloc_cnt), 0);
atomic_set(&(rtw_mem_func_stat[i].alloc_err_cnt), 0);
}
#endif
}
switch (status) {
case MSTAT_ALLOC_SUCCESS:
ATOMIC_INC(&(rtw_mem_type_stat[mstat_tf_idx(flags)].alloc_cnt));
alloc = ATOMIC_ADD_RETURN(&(rtw_mem_type_stat[mstat_tf_idx(flags)].alloc), sz);
peak = ATOMIC_READ(&(rtw_mem_type_stat[mstat_tf_idx(flags)].peak));
atomic_inc(&(rtw_mem_type_stat[mstat_tf_idx(flags)].alloc_cnt));
alloc = atomic_add_RETURN(&(rtw_mem_type_stat[mstat_tf_idx(flags)].alloc), sz);
peak = atomic_read(&(rtw_mem_type_stat[mstat_tf_idx(flags)].peak));
if (peak < alloc)
ATOMIC_SET(&(rtw_mem_type_stat[mstat_tf_idx(flags)].peak), alloc);
atomic_set(&(rtw_mem_type_stat[mstat_tf_idx(flags)].peak), alloc);
#ifdef RTW_MEM_FUNC_STAT
ATOMIC_INC(&(rtw_mem_func_stat[mstat_ff_idx(flags)].alloc_cnt));
alloc = ATOMIC_ADD_RETURN(&(rtw_mem_func_stat[mstat_ff_idx(flags)].alloc), sz);
peak = ATOMIC_READ(&(rtw_mem_func_stat[mstat_ff_idx(flags)].peak));
atomic_inc(&(rtw_mem_func_stat[mstat_ff_idx(flags)].alloc_cnt));
alloc = atomic_add_RETURN(&(rtw_mem_func_stat[mstat_ff_idx(flags)].alloc), sz);
peak = atomic_read(&(rtw_mem_func_stat[mstat_ff_idx(flags)].peak));
if (peak < alloc)
ATOMIC_SET(&(rtw_mem_func_stat[mstat_ff_idx(flags)].peak), alloc);
atomic_set(&(rtw_mem_func_stat[mstat_ff_idx(flags)].peak), alloc);
#endif
break;
case MSTAT_ALLOC_FAIL:
ATOMIC_INC(&(rtw_mem_type_stat[mstat_tf_idx(flags)].alloc_err_cnt));
atomic_inc(&(rtw_mem_type_stat[mstat_tf_idx(flags)].alloc_err_cnt));
#ifdef RTW_MEM_FUNC_STAT
ATOMIC_INC(&(rtw_mem_func_stat[mstat_ff_idx(flags)].alloc_err_cnt));
atomic_inc(&(rtw_mem_func_stat[mstat_ff_idx(flags)].alloc_err_cnt));
#endif
break;
case MSTAT_FREE:
ATOMIC_DEC(&(rtw_mem_type_stat[mstat_tf_idx(flags)].alloc_cnt));
ATOMIC_SUB(&(rtw_mem_type_stat[mstat_tf_idx(flags)].alloc), sz);
atomic_dec(&(rtw_mem_type_stat[mstat_tf_idx(flags)].alloc_cnt));
atomic_sub(&(rtw_mem_type_stat[mstat_tf_idx(flags)].alloc), sz);
#ifdef RTW_MEM_FUNC_STAT
ATOMIC_DEC(&(rtw_mem_func_stat[mstat_ff_idx(flags)].alloc_cnt));
ATOMIC_SUB(&(rtw_mem_func_stat[mstat_ff_idx(flags)].alloc), sz);
atomic_dec(&(rtw_mem_func_stat[mstat_ff_idx(flags)].alloc_cnt));
atomic_sub(&(rtw_mem_func_stat[mstat_ff_idx(flags)].alloc), sz);
#endif
break;
};
@ -1961,137 +1953,6 @@ inline int rtw_test_and_clear_bit(int nr, unsigned long *addr)
#endif
}
inline void ATOMIC_SET(ATOMIC_T *v, int i)
{
#ifdef PLATFORM_LINUX
atomic_set(v, i);
#elif defined(PLATFORM_WINDOWS)
*v = i; /* other choice???? */
#elif defined(PLATFORM_FREEBSD)
atomic_set_int(v, i);
#endif
}
inline int ATOMIC_READ(ATOMIC_T *v)
{
#ifdef PLATFORM_LINUX
return atomic_read(v);
#elif defined(PLATFORM_WINDOWS)
return *v; /* other choice???? */
#elif defined(PLATFORM_FREEBSD)
return atomic_load_acq_32(v);
#endif
}
inline void ATOMIC_ADD(ATOMIC_T *v, int i)
{
#ifdef PLATFORM_LINUX
atomic_add(i, v);
#elif defined(PLATFORM_WINDOWS)
InterlockedAdd(v, i);
#elif defined(PLATFORM_FREEBSD)
atomic_add_int(v, i);
#endif
}
inline void ATOMIC_SUB(ATOMIC_T *v, int i)
{
#ifdef PLATFORM_LINUX
atomic_sub(i, v);
#elif defined(PLATFORM_WINDOWS)
InterlockedAdd(v, -i);
#elif defined(PLATFORM_FREEBSD)
atomic_subtract_int(v, i);
#endif
}
inline void ATOMIC_INC(ATOMIC_T *v)
{
#ifdef PLATFORM_LINUX
atomic_inc(v);
#elif defined(PLATFORM_WINDOWS)
InterlockedIncrement(v);
#elif defined(PLATFORM_FREEBSD)
atomic_add_int(v, 1);
#endif
}
inline void ATOMIC_DEC(ATOMIC_T *v)
{
#ifdef PLATFORM_LINUX
atomic_dec(v);
#elif defined(PLATFORM_WINDOWS)
InterlockedDecrement(v);
#elif defined(PLATFORM_FREEBSD)
atomic_subtract_int(v, 1);
#endif
}
inline int ATOMIC_ADD_RETURN(ATOMIC_T *v, int i)
{
#ifdef PLATFORM_LINUX
return atomic_add_return(i, v);
#elif defined(PLATFORM_WINDOWS)
return InterlockedAdd(v, i);
#elif defined(PLATFORM_FREEBSD)
atomic_add_int(v, i);
return atomic_load_acq_32(v);
#endif
}
inline int ATOMIC_SUB_RETURN(ATOMIC_T *v, int i)
{
#ifdef PLATFORM_LINUX
return atomic_sub_return(i, v);
#elif defined(PLATFORM_WINDOWS)
return InterlockedAdd(v, -i);
#elif defined(PLATFORM_FREEBSD)
atomic_subtract_int(v, i);
return atomic_load_acq_32(v);
#endif
}
inline int ATOMIC_INC_RETURN(ATOMIC_T *v)
{
#ifdef PLATFORM_LINUX
return atomic_inc_return(v);
#elif defined(PLATFORM_WINDOWS)
return InterlockedIncrement(v);
#elif defined(PLATFORM_FREEBSD)
atomic_add_int(v, 1);
return atomic_load_acq_32(v);
#endif
}
inline int ATOMIC_DEC_RETURN(ATOMIC_T *v)
{
#ifdef PLATFORM_LINUX
return atomic_dec_return(v);
#elif defined(PLATFORM_WINDOWS)
return InterlockedDecrement(v);
#elif defined(PLATFORM_FREEBSD)
atomic_subtract_int(v, 1);
return atomic_load_acq_32(v);
#endif
}
inline bool ATOMIC_INC_UNLESS(ATOMIC_T *v, int u)
{
#ifdef PLATFORM_LINUX
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 15))
return atomic_add_unless(v, 1, u);
#else
/* only make sure not exceed after this function */
if (ATOMIC_INC_RETURN(v) > u) {
ATOMIC_DEC(v);
return 0;
}
return 1;
#endif
#else
#error "TBD\n"
#endif
}
#ifdef PLATFORM_LINUX
/*
* Open a file with the specific @param path, @param flag, @param mode