diff --git a/core/rtw_cmd.c b/core/rtw_cmd.c index 21bc1eb..390fb8e 100644 --- a/core/rtw_cmd.c +++ b/core/rtw_cmd.c @@ -1829,9 +1829,9 @@ static void traffic_status_watchdog(struct adapter *padapter) if (((pmlmepriv->LinkDetectInfo.NumRxUnicastOkInPeriod + pmlmepriv->LinkDetectInfo.NumTxOkInPeriod) > 8 ) || (pmlmepriv->LinkDetectInfo.NumRxUnicastOkInPeriod > 2)) - bEnterPS = false; - else - bEnterPS = true; + bEnterPS = false; + else + bEnterPS = true; /* LeisurePS only work in infra mode. */ if (bEnterPS) diff --git a/core/rtw_pwrctrl.c b/core/rtw_pwrctrl.c index a884edc..4193188 100644 --- a/core/rtw_pwrctrl.c +++ b/core/rtw_pwrctrl.c @@ -309,9 +309,19 @@ exit: return; } -static void pwr_state_check_handler(void *FunctionContext) +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0) +void pwr_state_check_handler(RTW_TIMER_HDL_ARGS) +#else +void pwr_state_check_handler(struct timer_list *t) +#endif { - struct adapter *padapter = (struct adapter *)FunctionContext; +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0) + struct adapter *padapter = (struct adapter *)FunctionContext; +#else + struct dvobj_priv *dvobj = from_timer(dvobj, t, pwrctl_priv.pwr_state_check_timer); + struct adapter *padapter = dvobj-> +#endif + rtw_ps_cmd(padapter); } @@ -693,7 +703,11 @@ void rtw_init_pwrctrl_priv(struct adapter *padapter) pwrctrlpriv->btcoex_rfon = false; +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0) _init_timer(&(pwrctrlpriv->pwr_state_check_timer), padapter->pnetdev, pwr_state_check_handler, (u8 *)padapter); +#else + timer_setup(&pwrctrlpriv->pwr_state_check_timer, pwr_state_check_handler, 0); +#endif } void rtw_free_pwrctrl_priv(struct adapter *adapter) diff --git a/include/osdep_service.h b/include/osdep_service.h index 158f9de..ada7aca 100644 --- a/include/osdep_service.h +++ b/include/osdep_service.h @@ -20,6 +20,10 @@ #ifndef __OSDEP_SERVICE_H_ #define __OSDEP_SERVICE_H_ +#include +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0) +#include +#endif #include #include @@ -202,12 +206,14 @@ __inline static void rtw_list_delete(struct list_head *plist) list_del_init(plist); } +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0) __inline static void _init_timer(struct timer_list *ptimer,struct net_device * nic_hdl,void *pfunc,void* cntx) { ptimer->function = pfunc; ptimer->data = (unsigned long)cntx; init_timer(ptimer); } +#endif __inline static void _set_timer(struct timer_list *ptimer,u32 delay_time) {