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

@@ -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

@@ -1,17 +1,17 @@
/******************************************************************************
*
* Copyright(c) 2007 - 2017 Realtek Corporation.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
*****************************************************************************/
/******************************************************************************
*
* Copyright(c) 2007 - 2017 Realtek Corporation.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
*****************************************************************************/
#ifndef __OSDEP_CE_SERVICE_H_
#define __OSDEP_CE_SERVICE_H_
@@ -40,11 +40,11 @@ typedef u32 _irqL;
typedef NDIS_HANDLE _nic_hdl;
struct rtw_timer_list {
NDIS_MINIPORT_TIMER ndis_timer;
void (*function)(void *);
void *arg;
};
struct rtw_timer_list {
NDIS_MINIPORT_TIMER ndis_timer;
void (*function)(void *);
void *arg;
};
struct __queue {
LIST_ENTRY queue;
@@ -60,7 +60,7 @@ typedef DWORD thread_return;
typedef void* thread_context;
typedef NDIS_WORK_ITEM _workitem;
#define SEMA_UPBND (0x7FFFFFFF) //8192
@@ -119,33 +119,33 @@ __inline static void rtw_list_delete(_list *plist)
InitializeListHead(plist);
}
static inline void timer_hdl(
IN PVOID SystemSpecific1,
IN PVOID FunctionContext,
IN PVOID SystemSpecific2,
IN PVOID SystemSpecific3)
{
_timer *timer = (_timer *)FunctionContext;
timer->function(timer->arg);
}
static inline void _init_timer(_timer *ptimer, _nic_hdl nic_hdl, void *pfunc, void *cntx)
{
ptimer->function = pfunc;
ptimer->arg = cntx;
NdisMInitializeTimer(&ptimer->ndis_timer, nic_hdl, timer_hdl, ptimer);
}
static inline void _set_timer(_timer *ptimer, u32 delay_time)
{
NdisMSetTimer(ptimer, delay_time);
}
static inline void _cancel_timer(_timer *ptimer, u8 *bcancelled)
{
NdisMCancelTimer(ptimer, bcancelled);
}
static inline void timer_hdl(
IN PVOID SystemSpecific1,
IN PVOID FunctionContext,
IN PVOID SystemSpecific2,
IN PVOID SystemSpecific3)
{
_timer *timer = (_timer *)FunctionContext;
timer->function(timer->arg);
}
static inline void _init_timer(_timer *ptimer, _nic_hdl nic_hdl, void *pfunc, void *cntx)
{
ptimer->function = pfunc;
ptimer->arg = cntx;
NdisMInitializeTimer(&ptimer->ndis_timer, nic_hdl, timer_hdl, ptimer);
}
static inline void _set_timer(_timer *ptimer, u32 delay_time)
{
NdisMSetTimer(ptimer, delay_time);
}
static inline void _cancel_timer(_timer *ptimer, u8 *bcancelled)
{
NdisMCancelTimer(ptimer, bcancelled);
}
__inline static void _init_workitem(_workitem *pwork, void *pfunc, PVOID cntx)
{
@@ -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

@@ -1,17 +1,17 @@
/******************************************************************************
*
* Copyright(c) 2007 - 2017 Realtek Corporation.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
*****************************************************************************/
/******************************************************************************
*
* Copyright(c) 2007 - 2017 Realtek Corporation.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
*****************************************************************************/
#ifndef __OSDEP_LINUX_SERVICE_H_
#define __OSDEP_LINUX_SERVICE_H_
@@ -40,11 +40,11 @@
// USB_PIPE for WINCE , but handle can be use just integer under windows
typedef NDIS_HANDLE _nic_hdl;
struct rtw_timer_list {
NDIS_MINIPORT_TIMER ndis_timer;
void (*function)(void *);
void *arg;
};
struct rtw_timer_list {
NDIS_MINIPORT_TIMER ndis_timer;
void (*function)(void *);
void *arg;
};
struct __queue {
LIST_ENTRY queue;
@@ -128,33 +128,33 @@ __inline static void rtw_list_delete(_list *plist)
InitializeListHead(plist);
}
static inline void timer_hdl(
IN PVOID SystemSpecific1,
IN PVOID FunctionContext,
IN PVOID SystemSpecific2,
IN PVOID SystemSpecific3)
{
_timer *timer = (_timer *)FunctionContext;
timer->function(timer->arg);
}
static inline void _init_timer(_timer *ptimer, _nic_hdl nic_hdl, void *pfunc, void *cntx)
{
ptimer->function = pfunc;
ptimer->arg = cntx;
NdisMInitializeTimer(&ptimer->ndis_timer, nic_hdl, timer_hdl, ptimer);
}
static inline void _set_timer(_timer *ptimer, u32 delay_time)
{
NdisMSetTimer(ptimer, delay_time);
}
static inline void _cancel_timer(_timer *ptimer, u8 *bcancelled)
{
NdisMCancelTimer(ptimer, bcancelled);
}
static inline void timer_hdl(
IN PVOID SystemSpecific1,
IN PVOID FunctionContext,
IN PVOID SystemSpecific2,
IN PVOID SystemSpecific3)
{
_timer *timer = (_timer *)FunctionContext;
timer->function(timer->arg);
}
static inline void _init_timer(_timer *ptimer, _nic_hdl nic_hdl, void *pfunc, void *cntx)
{
ptimer->function = pfunc;
ptimer->arg = cntx;
NdisMInitializeTimer(&ptimer->ndis_timer, nic_hdl, timer_hdl, ptimer);
}
static inline void _set_timer(_timer *ptimer, u32 delay_time)
{
NdisMSetTimer(ptimer, delay_time);
}
static inline void _cancel_timer(_timer *ptimer, u8 *bcancelled)
{
NdisMCancelTimer(ptimer, bcancelled);
}
__inline static void _init_workitem(_workitem *pwork, void *pfunc, PVOID cntx)
{
@@ -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];