From 4b2c469f5f8a61594066fa36845fd3fbf32d7336 Mon Sep 17 00:00:00 2001 From: Larry Finger Date: Fri, 21 Dec 2018 21:20:04 -0600 Subject: [PATCH] rtl8188eu: Remove most semaphore wrappers Signed-off-by: Larry Finger --- core/rtw_cmd.c | 31 ++++++++++++------------------- core/rtw_mlme.c | 2 +- core/rtw_pwrctrl.c | 4 ++-- core/rtw_recv.c | 15 +++++---------- core/rtw_xmit.c | 16 +++++----------- hal/hal_btcoex.c | 6 +++--- include/osdep_service.h | 3 --- include/rtw_pwrctrl.h | 5 ++--- os_dep/ioctl_linux.c | 4 ++-- os_dep/os_intfs.c | 6 +++--- os_dep/osdep_service.c | 16 ---------------- os_dep/usb_intf.c | 2 +- os_dep/usb_ops_linux.c | 2 +- 13 files changed, 37 insertions(+), 75 deletions(-) diff --git a/core/rtw_cmd.c b/core/rtw_cmd.c index 4f5c460..4fc008c 100644 --- a/core/rtw_cmd.c +++ b/core/rtw_cmd.c @@ -36,9 +36,9 @@ sint _rtw_init_cmd_priv(struct cmd_priv *pcmdpriv) sint res = _SUCCESS; - _rtw_init_sema(&(pcmdpriv->cmd_queue_sema), 0); - /* _rtw_init_sema(&(pcmdpriv->cmd_done_sema), 0); */ - _rtw_init_sema(&(pcmdpriv->terminate_cmdthread_sema), 0); + sema_init(&(pcmdpriv->cmd_queue_sema), 0); + /* sema_init(&(pcmdpriv->cmd_done_sema), 0); */ + sema_init(&(pcmdpriv->terminate_cmdthread_sema), 0); _rtw_init_queue(&(pcmdpriv->cmd_queue)); @@ -138,7 +138,7 @@ sint _rtw_init_evt_priv(struct evt_priv *pevtpriv) #ifdef CONFIG_H2CLBK - _rtw_init_sema(&(pevtpriv->lbkevt_done), 0); + sema_init(&(pevtpriv->lbkevt_done), 0); pevtpriv->lbkevt_limit = 0; pevtpriv->lbkevt_num = 0; pevtpriv->cmdevt_parm = NULL; @@ -150,8 +150,8 @@ sint _rtw_init_evt_priv(struct evt_priv *pevtpriv) #ifdef CONFIG_EVENT_THREAD_MODE - _rtw_init_sema(&(pevtpriv->evt_notify), 0); - _rtw_init_sema(&(pevtpriv->terminate_evtthread_sema), 0); + sema_init(&(pevtpriv->evt_notify), 0); + sema_init(&(pevtpriv->terminate_evtthread_sema), 0); pevtpriv->evt_allocated_buf = rtw_zmalloc(MAX_EVTSZ + 4); if (pevtpriv->evt_allocated_buf == NULL) { @@ -194,10 +194,6 @@ void _rtw_free_evt_priv(struct evt_priv *pevtpriv) #ifdef CONFIG_EVENT_THREAD_MODE - _rtw_free_sema(&(pevtpriv->evt_notify)); - _rtw_free_sema(&(pevtpriv->terminate_evtthread_sema)); - - if (pevtpriv->evt_allocated_buf) rtw_mfree(pevtpriv->evt_allocated_buf, MAX_EVTSZ + 4); #endif @@ -225,9 +221,6 @@ void _rtw_free_cmd_priv(struct cmd_priv *pcmdpriv) if (pcmdpriv) { _rtw_spinlock_free(&(pcmdpriv->cmd_queue.lock)); - _rtw_free_sema(&(pcmdpriv->cmd_queue_sema)); - /* _rtw_free_sema(&(pcmdpriv->cmd_done_sema)); */ - _rtw_free_sema(&(pcmdpriv->terminate_cmdthread_sema)); if (pcmdpriv->cmd_allocated_buf) rtw_mfree(pcmdpriv->cmd_allocated_buf, MAX_CMDSZ + CMDBUFF_ALIGN_SZ); @@ -476,7 +469,7 @@ u32 rtw_enqueue_cmd(struct cmd_priv *pcmdpriv, struct cmd_obj *cmd_obj) res = _rtw_enqueue_cmd(&pcmdpriv->cmd_queue, cmd_obj, 0); if (res == _SUCCESS) - _rtw_up_sema(&pcmdpriv->cmd_queue_sema); + up(&pcmdpriv->cmd_queue_sema); exit: @@ -497,7 +490,7 @@ struct cmd_obj *rtw_dequeue_cmd(struct cmd_priv *pcmdpriv) void rtw_cmd_clr_isr(struct cmd_priv *pcmdpriv) { pcmdpriv->cmd_done_cnt++; - /* _rtw_up_sema(&(pcmdpriv->cmd_done_sema)); */ + /* up(&(pcmdpriv->cmd_done_sema)); */ } void rtw_free_cmd_obj(struct cmd_obj *pcmd) @@ -527,7 +520,7 @@ void rtw_stop_cmd_thread(_adapter *adapter) ATOMIC_READ(&(adapter->cmdpriv.cmdthd_running)) == true && adapter->cmdpriv.stop_req == 0) { adapter->cmdpriv.stop_req = 1; - _rtw_up_sema(&adapter->cmdpriv.cmd_queue_sema); + up(&adapter->cmdpriv.cmd_queue_sema); _rtw_down_sema(&adapter->cmdpriv.terminate_cmdthread_sema); } } @@ -553,7 +546,7 @@ thread_return rtw_cmd_thread(thread_context context) pcmdpriv->stop_req = 0; ATOMIC_SET(&(pcmdpriv->cmdthd_running), true); - _rtw_up_sema(&pcmdpriv->terminate_cmdthread_sema); + up(&pcmdpriv->terminate_cmdthread_sema); while (1) { @@ -732,7 +725,7 @@ post_process: rtw_free_cmd_obj(pcmd); } while (1); - _rtw_up_sema(&pcmdpriv->terminate_cmdthread_sema); + up(&pcmdpriv->terminate_cmdthread_sema); thread_exit(); @@ -803,7 +796,7 @@ void rtw_free_evt_obj(struct evt_obj *pevtobj) void rtw_evt_notify_isr(struct evt_priv *pevtpriv) { pevtpriv->evt_done_cnt++; - _rtw_up_sema(&(pevtpriv->evt_notify)); + up(&(pevtpriv->evt_notify)); } #endif diff --git a/core/rtw_mlme.c b/core/rtw_mlme.c index 2b8146d..dabe10e 100644 --- a/core/rtw_mlme.c +++ b/core/rtw_mlme.c @@ -3365,7 +3365,7 @@ sint rtw_set_key(_adapter *adapter, struct security_priv *psecuritypriv, sint ke INIT_LIST_HEAD(&pcmd->list); - /* _rtw_init_sema(&(pcmd->cmd_sem), 0); */ + /* sema_init(&(pcmd->cmd_sem), 0); */ res = rtw_enqueue_cmd(pcmdpriv, pcmd); } else { diff --git a/core/rtw_pwrctrl.c b/core/rtw_pwrctrl.c index 3446075..453e46a 100644 --- a/core/rtw_pwrctrl.c +++ b/core/rtw_pwrctrl.c @@ -1377,10 +1377,10 @@ void cpwm_int_hdl( if (pwrpriv->cpwm >= PS_STATE_S2) { if (pwrpriv->alives & CMD_ALIVE) - _rtw_up_sema(&padapter->cmdpriv.cmd_queue_sema); + up(&padapter->cmdpriv.cmd_queue_sema); if (pwrpriv->alives & XMIT_ALIVE) - _rtw_up_sema(&padapter->xmitpriv.xmit_sema); + up(&padapter->xmitpriv.xmit_sema); } _exit_pwrlock(&pwrpriv->lock); diff --git a/core/rtw_recv.c b/core/rtw_recv.c index 583d047..0d045ac 100755 --- a/core/rtw_recv.c +++ b/core/rtw_recv.c @@ -77,8 +77,8 @@ sint _rtw_init_recv_priv(struct recv_priv *precvpriv, _adapter *padapter) spin_lock_init(&precvpriv->lock); #ifdef CONFIG_RECV_THREAD_MODE - _rtw_init_sema(&precvpriv->recv_sema, 0); - _rtw_init_sema(&precvpriv->terminate_recvthread_sema, 0); + sema_init(&precvpriv->recv_sema, 0); + sema_init(&precvpriv->terminate_recvthread_sema, 0); #endif _rtw_init_queue(&precvpriv->free_recv_queue); @@ -132,7 +132,7 @@ sint _rtw_init_recv_priv(struct recv_priv *precvpriv, _adapter *padapter) ATOMIC_SET(&(precvpriv->rx_pending_cnt), 1); - _rtw_init_sema(&precvpriv->allrxreturnevt, 0); + sema_init(&precvpriv->allrxreturnevt, 0); res = rtw_hal_init_recv_priv(padapter); @@ -159,11 +159,6 @@ exit: static void rtw_mfree_recv_priv_lock(struct recv_priv *precvpriv) { _rtw_spinlock_free(&precvpriv->lock); -#ifdef CONFIG_RECV_THREAD_MODE - _rtw_free_sema(&precvpriv->recv_sema); - _rtw_free_sema(&precvpriv->terminate_recvthread_sema); -#endif - _rtw_spinlock_free(&precvpriv->free_recv_queue.lock); _rtw_spinlock_free(&precvpriv->recv_pending_queue.lock); @@ -4208,7 +4203,7 @@ thread_return rtw_recv_thread(thread_context context) || err == RTW_RFRAME_PKT_UNAVAIL ) { rtw_msleep_os(1); - _rtw_up_sema(&recvpriv->recv_sema); + up(&recvpriv->recv_sema); } flush_signals_thread(); @@ -4216,7 +4211,7 @@ thread_return rtw_recv_thread(thread_context context) } while (err != _FAIL); exit: - _rtw_up_sema(&adapter->recvpriv.terminate_recvthread_sema); + up(&adapter->recvpriv.terminate_recvthread_sema); RTW_INFO(FUNC_ADPT_FMT" exit\n", FUNC_ADPT_ARG(adapter)); thread_exit(); } diff --git a/core/rtw_xmit.c b/core/rtw_xmit.c index 0ea2efc..6b25557 100644 --- a/core/rtw_xmit.c +++ b/core/rtw_xmit.c @@ -64,8 +64,8 @@ s32 _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, _adapter *padapter) spin_lock_init(&pxmitpriv->lock); spin_lock_init(&pxmitpriv->lock_sctx); - _rtw_init_sema(&pxmitpriv->xmit_sema, 0); - _rtw_init_sema(&pxmitpriv->terminate_xmitthread_sema, 0); + sema_init(&pxmitpriv->xmit_sema, 0); + sema_init(&pxmitpriv->terminate_xmitthread_sema, 0); /* Please insert all the queue initializaiton using _rtw_init_queue below @@ -266,7 +266,7 @@ s32 _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, _adapter *padapter) pxmitpriv->txirp_cnt = 1; - _rtw_init_sema(&(pxmitpriv->tx_retevt), 0); + sema_init(&(pxmitpriv->tx_retevt), 0); /* per AC pending irp */ pxmitpriv->beq_cnt = 0; @@ -313,18 +313,12 @@ void rtw_mfree_xmit_priv_lock(struct xmit_priv *pxmitpriv); void rtw_mfree_xmit_priv_lock(struct xmit_priv *pxmitpriv) { _rtw_spinlock_free(&pxmitpriv->lock); - _rtw_free_sema(&pxmitpriv->xmit_sema); - _rtw_free_sema(&pxmitpriv->terminate_xmitthread_sema); - _rtw_spinlock_free(&pxmitpriv->be_pending.lock); _rtw_spinlock_free(&pxmitpriv->bk_pending.lock); _rtw_spinlock_free(&pxmitpriv->vi_pending.lock); _rtw_spinlock_free(&pxmitpriv->vo_pending.lock); _rtw_spinlock_free(&pxmitpriv->bm_pending.lock); - /* _rtw_spinlock_free(&pxmitpriv->legacy_dz_queue.lock); */ - /* _rtw_spinlock_free(&pxmitpriv->apsd_queue.lock); */ - _rtw_spinlock_free(&pxmitpriv->free_xmit_queue.lock); _rtw_spinlock_free(&pxmitpriv->free_xmitbuf_queue.lock); _rtw_spinlock_free(&pxmitpriv->pending_xmitbuf_queue.lock); @@ -4649,7 +4643,7 @@ void enqueue_pending_xmitbuf( list_del_init(&pxmitbuf->list); list_add_tail(&pxmitbuf->list, get_list_head(pqueue)); _exit_critical_bh(&pqueue->lock, &irql); - _rtw_up_sema(&(pri_adapter->xmitpriv.xmit_sema)); + up(&(pri_adapter->xmitpriv.xmit_sema)); } void enqueue_pending_xmitbuf_to_head( @@ -4826,7 +4820,7 @@ thread_return rtw_xmit_thread(thread_context context) flush_signals_thread(); } while (_SUCCESS == err); - _rtw_up_sema(&padapter->xmitpriv.terminate_xmitthread_sema); + up(&padapter->xmitpriv.terminate_xmitthread_sema); thread_exit(); } diff --git a/hal/hal_btcoex.c b/hal/hal_btcoex.c index 66e1503..831a759 100644 --- a/hal/hal_btcoex.c +++ b/hal/hal_btcoex.c @@ -558,7 +558,7 @@ static void _btmpoper_timer_hdl(void *p) { if (GLBtcBtMpRptWait) { GLBtcBtMpRptWait = 0; - _rtw_up_sema(&GLBtcBtMpRptSema); + up(&GLBtcBtMpRptSema); } } @@ -2009,7 +2009,7 @@ u8 EXhalbtcoutsrc_InitlizeVariables(void *padapter) GLBtcBtMpOperSeq = 0; _rtw_mutex_init(&GLBtcBtMpOperLock); _init_timer(&GLBtcBtMpOperTimer, ((PADAPTER)padapter)->pnetdev, _btmpoper_timer_hdl, pBtCoexist); - _rtw_init_sema(&GLBtcBtMpRptSema, 0); + sema_init(&GLBtcBtMpRptSema, 0); GLBtcBtMpRptSeq = 0; GLBtcBtMpRptStatus = 0; memset(GLBtcBtMpRptRsp, 0, C2H_MAX_SIZE); @@ -3341,7 +3341,7 @@ void hal_btcoex_BtMpRptNotify(PADAPTER padapter, u8 length, u8 *tmpBuf) GLBtcBtMpRptStatus = status; memcpy(GLBtcBtMpRptRsp, tmpBuf + 3, len); GLBtcBtMpRptRspSize = len; - _rtw_up_sema(&GLBtcBtMpRptSema); + up(&GLBtcBtMpRptSema); } void hal_btcoex_SuspendNotify(PADAPTER padapter, u8 state) diff --git a/include/osdep_service.h b/include/osdep_service.h index 9b3b9a6..f4f1106 100644 --- a/include/osdep_service.h +++ b/include/osdep_service.h @@ -256,9 +256,6 @@ extern void rtw_mfree2d(void *pbuf, int h, int w, int size); extern void list_del_init(_list *plist); -extern void _rtw_init_sema(_sema *sema, int init_val); -extern void _rtw_free_sema(_sema *sema); -extern void _rtw_up_sema(_sema *sema); extern u32 _rtw_down_sema(_sema *sema); extern void _rtw_mutex_init(_mutex *pmutex); extern void _rtw_mutex_free(_mutex *pmutex); diff --git a/include/rtw_pwrctrl.h b/include/rtw_pwrctrl.h index 00c397d..4ddf820 100644 --- a/include/rtw_pwrctrl.h +++ b/include/rtw_pwrctrl.h @@ -153,12 +153,11 @@ typedef _sema _pwrlock; __inline static void _init_pwrlock(_pwrlock *plock) { - _rtw_init_sema(plock, 1); + sema_init(plock, 1); } __inline static void _free_pwrlock(_pwrlock *plock) { - _rtw_free_sema(plock); } @@ -170,7 +169,7 @@ __inline static void _enter_pwrlock(_pwrlock *plock) __inline static void _exit_pwrlock(_pwrlock *plock) { - _rtw_up_sema(plock); + up(plock); } #define LPS_DELAY_TIME 1*HZ /* 1 sec */ diff --git a/os_dep/ioctl_linux.c b/os_dep/ioctl_linux.c index a1738b6..27295bf 100644 --- a/os_dep/ioctl_linux.c +++ b/os_dep/ioctl_linux.c @@ -10992,7 +10992,7 @@ static s32 initLoopback(PADAPTER padapter) if (ploopback == NULL) return -ENOMEM; - _rtw_init_sema(&ploopback->sema, 0); + sema_init(&ploopback->sema, 0); ploopback->bstop = true; ploopback->cnt = 0; ploopback->size = 300; @@ -11423,7 +11423,7 @@ static void loopbackTest(PADAPTER padapter, u32 cnt, u32 size, u8 *pmsg) if (ploopback) { if (ploopback->bstop == false) { ploopback->bstop = true; - _rtw_up_sema(&ploopback->sema); + up(&ploopback->sema); } len = 0; do { diff --git a/os_dep/os_intfs.c b/os_dep/os_intfs.c index da73c85..195bf30 100644 --- a/os_dep/os_intfs.c +++ b/os_dep/os_intfs.c @@ -1582,21 +1582,21 @@ void rtw_stop_drv_threads(_adapter *padapter) rtw_stop_cmd_thread(padapter); #ifdef CONFIG_EVENT_THREAD_MODE - _rtw_up_sema(&padapter->evtpriv.evt_notify); + up(&padapter->evtpriv.evt_notify); if (padapter->evtThread) _rtw_down_sema(&padapter->evtpriv.terminate_evtthread_sema); #endif #ifdef CONFIG_XMIT_THREAD_MODE /* Below is to termindate tx_thread... */ - _rtw_up_sema(&padapter->xmitpriv.xmit_sema); + up(&padapter->xmitpriv.xmit_sema); _rtw_down_sema(&padapter->xmitpriv.terminate_xmitthread_sema); #endif #ifdef CONFIG_RECV_THREAD_MODE if (is_primary_adapter(padapter)) { /* Below is to termindate rx_thread... */ - _rtw_up_sema(&padapter->recvpriv.recv_sema); + up(&padapter->recvpriv.recv_sema); _rtw_down_sema(&padapter->recvpriv.terminate_recvthread_sema); } #endif diff --git a/os_dep/osdep_service.c b/os_dep/osdep_service.c index fae6e49..adb39c7 100644 --- a/os_dep/osdep_service.c +++ b/os_dep/osdep_service.c @@ -693,20 +693,6 @@ void rtw_mfree2d(void *pbuf, int h, int w, int size) rtw_mfree((u8 *)pbuf, h * sizeof(void *) + w * h * size); } -void _rtw_init_sema(_sema *sema, int init_val) -{ - sema_init(sema, init_val); -} - -void _rtw_free_sema(_sema *sema) -{ -} - -void _rtw_up_sema(_sema *sema) -{ - up(sema); -} - u32 _rtw_down_sema(_sema *sema) { if (down_interruptible(sema)) @@ -714,8 +700,6 @@ u32 _rtw_down_sema(_sema *sema) return _SUCCESS; } - - void _rtw_mutex_init(_mutex *pmutex) { #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) diff --git a/os_dep/usb_intf.c b/os_dep/usb_intf.c index 562613c..eb3ab66 100644 --- a/os_dep/usb_intf.c +++ b/os_dep/usb_intf.c @@ -384,7 +384,7 @@ static struct dvobj_priv *usb_dvobj_init(struct usb_interface *usb_intf, const s rtw_decide_chip_type_by_usb_info(pdvobjpriv, pdid); /* .3 misc */ - _rtw_init_sema(&(pdvobjpriv->usb_suspend_sema), 0); + sema_init(&(pdvobjpriv->usb_suspend_sema), 0); rtw_reset_continual_io_error(pdvobjpriv); usb_get_dev(pusbd); diff --git a/os_dep/usb_ops_linux.c b/os_dep/usb_ops_linux.c index 344e921..486f93e 100644 --- a/os_dep/usb_ops_linux.c +++ b/os_dep/usb_ops_linux.c @@ -435,7 +435,7 @@ static void usb_write_port_complete(struct urb *purb, struct pt_regs *regs) if(pxmitpriv->txirp_cnt==0) { - _rtw_up_sema(&(pxmitpriv->tx_retevt)); + up(&(pxmitpriv->tx_retevt)); } */ /* rtw_free_xmitframe(pxmitpriv, pxmitframe); */