aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2017-10-24 01:27:23 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-11-03 14:49:08 +0100
commite8b1844a7e59fc35c086358021d9d42b4ce3ee22 (patch)
treea367d7d4aaca6d86b841561c679a1643c6b4e0ab /drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
parentstaging: VME: Remove PIO2 driver (diff)
downloadlinux-dev-e8b1844a7e59fc35c086358021d9d42b4ce3ee22.tar.xz
linux-dev-e8b1844a7e59fc35c086358021d9d42b4ce3ee22.zip
staging: rtl8723bs: Convert timers to use timer_setup()
In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly. This performs some refactoring to remove needless wrapper functions, and adds a pointer back to the desired adapter. Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Shreeya Patel <shreeya.patel23498@gmail.com> Cc: Hans de Goede <hdegoede@redhat.com> Cc: Larry Finger <Larry.Finger@lwfinger.net> Cc: Himanshu Jha <himanshujha199640@gmail.com> Cc: Joe Perches <joe@perches.com> Cc: Derek Robson <robsonde@gmail.com> Cc: Harsha Sharma <harshasharmaiitr@gmail.com> Cc: Dan Carpenter <dan.carpenter@oracle.com> Cc: "David S. Miller" <davem@davemloft.net> Cc: Stephen Hemminger <stephen@networkplumber.org> Cc: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn> Cc: Johannes Berg <johannes.berg@intel.com> Cc: devel@driverdev.osuosl.org Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/rtl8723bs/core/rtw_pwrctrl.c')
-rw-r--r--drivers/staging/rtl8723bs/core/rtw_pwrctrl.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
index a3ba5518ecc6..4a6af72013fa 100644
--- a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
+++ b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
@@ -201,10 +201,12 @@ exit:
return;
}
-void pwr_state_check_handler(RTW_TIMER_HDL_ARGS);
-void pwr_state_check_handler(RTW_TIMER_HDL_ARGS)
+static void pwr_state_check_handler(struct timer_list *t)
{
- struct adapter *padapter = (struct adapter *)FunctionContext;
+ struct pwrctrl_priv *pwrctrlpriv =
+ from_timer(pwrctrlpriv, t, pwr_state_check_timer);
+ struct adapter *padapter = pwrctrlpriv->adapter;
+
rtw_ps_cmd(padapter);
}
@@ -823,14 +825,10 @@ exit:
/*
* This function is a timer handler, can't do any IO in it.
*/
-static void pwr_rpwm_timeout_handler(void *FunctionContext)
+static void pwr_rpwm_timeout_handler(struct timer_list *t)
{
- struct adapter *padapter;
- struct pwrctrl_priv *pwrpriv;
+ struct pwrctrl_priv *pwrpriv = from_timer(pwrpriv, t, pwr_rpwm_timer);
-
- padapter = FunctionContext;
- pwrpriv = adapter_to_pwrctl(padapter);
DBG_871X("+%s: rpwm = 0x%02X cpwm = 0x%02X\n", __func__, pwrpriv->rpwm, pwrpriv->cpwm);
if ((pwrpriv->rpwm == pwrpriv->cpwm) || (pwrpriv->cpwm >= PS_STATE_S2)) {
@@ -1173,10 +1171,11 @@ void rtw_init_pwrctrl_priv(struct adapter *padapter)
_init_workitem(&pwrctrlpriv->cpwm_event, cpwm_event_callback, NULL);
pwrctrlpriv->brpwmtimeout = false;
+ pwrctrlpriv->adapter = padapter;
_init_workitem(&pwrctrlpriv->rpwmtimeoutwi, rpwmtimeout_workitem_callback, NULL);
- _init_timer(&pwrctrlpriv->pwr_rpwm_timer, padapter->pnetdev, pwr_rpwm_timeout_handler, padapter);
-
- rtw_init_timer(&pwrctrlpriv->pwr_state_check_timer, padapter, pwr_state_check_handler);
+ timer_setup(&pwrctrlpriv->pwr_rpwm_timer, pwr_rpwm_timeout_handler, 0);
+ timer_setup(&pwrctrlpriv->pwr_state_check_timer,
+ pwr_state_check_handler, 0);
pwrctrlpriv->wowlan_mode = false;
pwrctrlpriv->wowlan_ap_mode = false;