Commit b7749656 authored by Kees Cook's avatar Kees Cook Committed by Greg Kroah-Hartman

staging: rtl8188eu: 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.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Juliana Rodrigues <juliana.orod@gmail.com>
Cc: Ivan Safonov <insafonov@gmail.com>
Cc: Gargi Sharma <gs051095@gmail.com>
Cc: sayli karnik <karniksayli1995@gmail.com>
Cc: Yamanappagouda Patil <goudapatilk@gmail.com>
Cc: Luca Ceresoli <luca@lucaceresoli.net>
Cc: Victor Carvajal <carva005@gmail.com>
Cc: Sebastian Haas <sehaas@deebas.com>
Cc: devel@driverdev.osuosl.org
Signed-off-by: default avatarKees Cook <keescook@chromium.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c8454682
...@@ -22,9 +22,9 @@ ...@@ -22,9 +22,9 @@
/* Callback function of LED BlinkTimer, */ /* Callback function of LED BlinkTimer, */
/* it just schedules to corresponding BlinkWorkItem/led_blink_hdl */ /* it just schedules to corresponding BlinkWorkItem/led_blink_hdl */
/* */ /* */
void BlinkTimerCallback(unsigned long data) static void BlinkTimerCallback(struct timer_list *t)
{ {
struct LED_871x *pLed = (struct LED_871x *)data; struct LED_871x *pLed = from_timer(pLed, t, BlinkTimer);
struct adapter *padapter = pLed->padapter; struct adapter *padapter = pLed->padapter;
if ((padapter->bSurpriseRemoved) || (padapter->bDriverStopped)) if ((padapter->bSurpriseRemoved) || (padapter->bDriverStopped))
...@@ -73,8 +73,7 @@ void InitLed871x(struct adapter *padapter, struct LED_871x *pLed) ...@@ -73,8 +73,7 @@ void InitLed871x(struct adapter *padapter, struct LED_871x *pLed)
ResetLedStatus(pLed); ResetLedStatus(pLed);
setup_timer(&pLed->BlinkTimer, BlinkTimerCallback, timer_setup(&pLed->BlinkTimer, BlinkTimerCallback, 0);
(unsigned long)pLed);
INIT_WORK(&pLed->BlinkWorkItem, BlinkWorkItemCallback); INIT_WORK(&pLed->BlinkWorkItem, BlinkWorkItemCallback);
} }
......
...@@ -1332,9 +1332,10 @@ void rtw_cpwm_event_callback(struct adapter *padapter, u8 *pbuf) ...@@ -1332,9 +1332,10 @@ void rtw_cpwm_event_callback(struct adapter *padapter, u8 *pbuf)
* _rtw_join_timeout_handler - Timeout/failure handler for CMD JoinBss * _rtw_join_timeout_handler - Timeout/failure handler for CMD JoinBss
* @adapter: pointer to struct adapter structure * @adapter: pointer to struct adapter structure
*/ */
void _rtw_join_timeout_handler (unsigned long data) void _rtw_join_timeout_handler (struct timer_list *t)
{ {
struct adapter *adapter = (struct adapter *)data; struct adapter *adapter =
from_timer(adapter, t, mlmepriv.assoc_timer);
struct mlme_priv *pmlmepriv = &adapter->mlmepriv; struct mlme_priv *pmlmepriv = &adapter->mlmepriv;
int do_join_r; int do_join_r;
...@@ -1373,9 +1374,10 @@ void _rtw_join_timeout_handler (unsigned long data) ...@@ -1373,9 +1374,10 @@ void _rtw_join_timeout_handler (unsigned long data)
* rtw_scan_timeout_handler - Timeout/Faliure handler for CMD SiteSurvey * rtw_scan_timeout_handler - Timeout/Faliure handler for CMD SiteSurvey
* @adapter: pointer to struct adapter structure * @adapter: pointer to struct adapter structure
*/ */
void rtw_scan_timeout_handler (unsigned long data) void rtw_scan_timeout_handler (struct timer_list *t)
{ {
struct adapter *adapter = (struct adapter *)data; struct adapter *adapter =
from_timer(adapter, t, mlmepriv.scan_to_timer);
struct mlme_priv *pmlmepriv = &adapter->mlmepriv; struct mlme_priv *pmlmepriv = &adapter->mlmepriv;
DBG_88E(FUNC_ADPT_FMT" fw_state=%x\n", FUNC_ADPT_ARG(adapter), get_fwstate(pmlmepriv)); DBG_88E(FUNC_ADPT_FMT" fw_state=%x\n", FUNC_ADPT_ARG(adapter), get_fwstate(pmlmepriv));
...@@ -1400,9 +1402,10 @@ static void rtw_auto_scan_handler(struct adapter *padapter) ...@@ -1400,9 +1402,10 @@ static void rtw_auto_scan_handler(struct adapter *padapter)
} }
} }
void rtw_dynamic_check_timer_handlder(unsigned long data) void rtw_dynamic_check_timer_handlder(struct timer_list *t)
{ {
struct adapter *adapter = (struct adapter *)data; struct adapter *adapter =
from_timer(adapter, t, mlmepriv.dynamic_chk_timer);
struct registry_priv *pregistrypriv = &adapter->registrypriv; struct registry_priv *pregistrypriv = &adapter->registrypriv;
if (!adapter) if (!adapter)
......
...@@ -4803,9 +4803,10 @@ void linked_status_chk(struct adapter *padapter) ...@@ -4803,9 +4803,10 @@ void linked_status_chk(struct adapter *padapter)
} }
} }
void survey_timer_hdl(unsigned long data) void survey_timer_hdl(struct timer_list *t)
{ {
struct adapter *padapter = (struct adapter *)data; struct adapter *padapter = from_timer(padapter, t,
mlmeextpriv.link_timer);
struct cmd_obj *ph2c; struct cmd_obj *ph2c;
struct sitesurvey_parm *psurveyPara; struct sitesurvey_parm *psurveyPara;
struct cmd_priv *pcmdpriv = &padapter->cmdpriv; struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
...@@ -4843,9 +4844,10 @@ void survey_timer_hdl(unsigned long data) ...@@ -4843,9 +4844,10 @@ void survey_timer_hdl(unsigned long data)
return; return;
} }
void link_timer_hdl(unsigned long data) void link_timer_hdl(struct timer_list *t)
{ {
struct adapter *padapter = (struct adapter *)data; struct adapter *padapter = from_timer(padapter, t,
mlmeextpriv.link_timer);
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
...@@ -4879,9 +4881,9 @@ void link_timer_hdl(unsigned long data) ...@@ -4879,9 +4881,9 @@ void link_timer_hdl(unsigned long data)
} }
} }
void addba_timer_hdl(unsigned long data) void addba_timer_hdl(struct timer_list *t)
{ {
struct sta_info *psta = (struct sta_info *)data; struct sta_info *psta = from_timer(psta, t, addba_retry_timer);
struct ht_priv *phtpriv; struct ht_priv *phtpriv;
if (!psta) if (!psta)
......
...@@ -276,9 +276,11 @@ void rtw_ps_processor(struct adapter *padapter) ...@@ -276,9 +276,11 @@ void rtw_ps_processor(struct adapter *padapter)
pwrpriv->ps_processing = false; pwrpriv->ps_processing = false;
} }
static void pwr_state_check_handler(unsigned long data) static void pwr_state_check_handler(struct timer_list *t)
{ {
struct adapter *padapter = (struct adapter *)data; struct adapter *padapter =
from_timer(padapter, t,
pwrctrlpriv.pwr_state_check_timer);
rtw_ps_cmd(padapter); rtw_ps_cmd(padapter);
} }
...@@ -540,9 +542,8 @@ void rtw_init_pwrctrl_priv(struct adapter *padapter) ...@@ -540,9 +542,8 @@ void rtw_init_pwrctrl_priv(struct adapter *padapter)
pwrctrlpriv->btcoex_rfon = false; pwrctrlpriv->btcoex_rfon = false;
setup_timer(&pwrctrlpriv->pwr_state_check_timer, timer_setup(&pwrctrlpriv->pwr_state_check_timer,
pwr_state_check_handler, pwr_state_check_handler, 0);
(unsigned long)padapter);
} }
/* /*
......
...@@ -39,7 +39,7 @@ static u8 rtw_rfc1042_header[] = { ...@@ -39,7 +39,7 @@ static u8 rtw_rfc1042_header[] = {
0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00
}; };
static void rtw_signal_stat_timer_hdl(unsigned long data); static void rtw_signal_stat_timer_hdl(struct timer_list *t);
void _rtw_init_sta_recv_priv(struct sta_recv_priv *psta_recvpriv) void _rtw_init_sta_recv_priv(struct sta_recv_priv *psta_recvpriv)
{ {
...@@ -86,9 +86,8 @@ int _rtw_init_recv_priv(struct recv_priv *precvpriv, struct adapter *padapter) ...@@ -86,9 +86,8 @@ int _rtw_init_recv_priv(struct recv_priv *precvpriv, struct adapter *padapter)
} }
res = rtw_hal_init_recv_priv(padapter); res = rtw_hal_init_recv_priv(padapter);
setup_timer(&precvpriv->signal_stat_timer, timer_setup(&precvpriv->signal_stat_timer, rtw_signal_stat_timer_hdl,
rtw_signal_stat_timer_hdl, 0);
(unsigned long)padapter);
precvpriv->signal_stat_sampling_interval = 1000; /* ms */ precvpriv->signal_stat_sampling_interval = 1000; /* ms */
...@@ -1837,9 +1836,10 @@ static int recv_indicatepkt_reorder(struct adapter *padapter, ...@@ -1837,9 +1836,10 @@ static int recv_indicatepkt_reorder(struct adapter *padapter,
return _FAIL; return _FAIL;
} }
void rtw_reordering_ctrl_timeout_handler(unsigned long data) void rtw_reordering_ctrl_timeout_handler(struct timer_list *t)
{ {
struct recv_reorder_ctrl *preorder_ctrl = (struct recv_reorder_ctrl *)data; struct recv_reorder_ctrl *preorder_ctrl = from_timer(preorder_ctrl, t,
reordering_ctrl_timer);
struct adapter *padapter = preorder_ctrl->padapter; struct adapter *padapter = preorder_ctrl->padapter;
struct __queue *ppending_recvframe_queue = &preorder_ctrl->pending_recvframe_queue; struct __queue *ppending_recvframe_queue = &preorder_ctrl->pending_recvframe_queue;
...@@ -2007,9 +2007,10 @@ s32 rtw_recv_entry(struct recv_frame *precvframe) ...@@ -2007,9 +2007,10 @@ s32 rtw_recv_entry(struct recv_frame *precvframe)
return ret; return ret;
} }
static void rtw_signal_stat_timer_hdl(unsigned long data) static void rtw_signal_stat_timer_hdl(struct timer_list *t)
{ {
struct adapter *adapter = (struct adapter *)data; struct adapter *adapter =
from_timer(adapter, t, recvpriv.signal_stat_timer);
struct recv_priv *recvpriv = &adapter->recvpriv; struct recv_priv *recvpriv = &adapter->recvpriv;
u32 tmp_s, tmp_q; u32 tmp_s, tmp_q;
......
...@@ -91,7 +91,6 @@ struct led_priv { ...@@ -91,7 +91,6 @@ struct led_priv {
/* add for led control */ /* add for led control */
}; };
void BlinkTimerCallback(unsigned long data);
void BlinkWorkItemCallback(struct work_struct *work); void BlinkWorkItemCallback(struct work_struct *work);
void ResetLedStatus(struct LED_871x *pLed); void ResetLedStatus(struct LED_871x *pLed);
......
...@@ -325,10 +325,10 @@ void rtw_update_registrypriv_dev_network(struct adapter *adapter); ...@@ -325,10 +325,10 @@ void rtw_update_registrypriv_dev_network(struct adapter *adapter);
void rtw_get_encrypt_decrypt_from_registrypriv(struct adapter *adapter); void rtw_get_encrypt_decrypt_from_registrypriv(struct adapter *adapter);
void _rtw_join_timeout_handler(unsigned long data); void _rtw_join_timeout_handler(struct timer_list *t);
void rtw_scan_timeout_handler(unsigned long data); void rtw_scan_timeout_handler(struct timer_list *t);
void rtw_dynamic_check_timer_handlder(unsigned long data); void rtw_dynamic_check_timer_handlder(struct timer_list *t);
#define rtw_is_scan_deny(adapter) false #define rtw_is_scan_deny(adapter) false
#define rtw_clear_scan_deny(adapter) do {} while (0) #define rtw_clear_scan_deny(adapter) do {} while (0)
#define rtw_set_scan_deny_timer_hdl(adapter) do {} while (0) #define rtw_set_scan_deny_timer_hdl(adapter) do {} while (0)
......
...@@ -572,9 +572,9 @@ void mlmeext_sta_add_event_callback(struct adapter *padapter, ...@@ -572,9 +572,9 @@ void mlmeext_sta_add_event_callback(struct adapter *padapter,
void linked_status_chk(struct adapter *padapter); void linked_status_chk(struct adapter *padapter);
void survey_timer_hdl(unsigned long data); void survey_timer_hdl(struct timer_list *t);
void link_timer_hdl(unsigned long data); void link_timer_hdl(struct timer_list *t);
void addba_timer_hdl(unsigned long data); void addba_timer_hdl(struct timer_list *t);
#define set_survey_timer(mlmeext, ms) \ #define set_survey_timer(mlmeext, ms) \
mod_timer(&mlmeext->survey_timer, jiffies + \ mod_timer(&mlmeext->survey_timer, jiffies + \
......
...@@ -247,7 +247,7 @@ void rtw_free_recvframe_queue(struct __queue *pframequeue, ...@@ -247,7 +247,7 @@ void rtw_free_recvframe_queue(struct __queue *pframequeue,
struct __queue *pfree_recv_queue); struct __queue *pfree_recv_queue);
u32 rtw_free_uc_swdec_pending_queue(struct adapter *adapter); u32 rtw_free_uc_swdec_pending_queue(struct adapter *adapter);
void rtw_reordering_ctrl_timeout_handler(unsigned long data); void rtw_reordering_ctrl_timeout_handler(struct timer_list *t);
static inline s32 translate_percentage_to_dbm(u32 sig_stren_index) static inline s32 translate_percentage_to_dbm(u32 sig_stren_index)
{ {
......
...@@ -24,12 +24,10 @@ void rtw_init_mlme_timer(struct adapter *padapter) ...@@ -24,12 +24,10 @@ void rtw_init_mlme_timer(struct adapter *padapter)
{ {
struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
setup_timer(&pmlmepriv->assoc_timer, _rtw_join_timeout_handler, timer_setup(&pmlmepriv->assoc_timer, _rtw_join_timeout_handler, 0);
(unsigned long)padapter); timer_setup(&pmlmepriv->scan_to_timer, rtw_scan_timeout_handler, 0);
setup_timer(&pmlmepriv->scan_to_timer, rtw_scan_timeout_handler, timer_setup(&pmlmepriv->dynamic_chk_timer,
(unsigned long)padapter); rtw_dynamic_check_timer_handlder, 0);
setup_timer(&pmlmepriv->dynamic_chk_timer,
rtw_dynamic_check_timer_handlder, (unsigned long)padapter);
} }
void rtw_os_indicate_connect(struct adapter *adapter) void rtw_os_indicate_connect(struct adapter *adapter)
...@@ -125,18 +123,15 @@ void rtw_report_sec_ie(struct adapter *adapter, u8 authmode, u8 *sec_ie) ...@@ -125,18 +123,15 @@ void rtw_report_sec_ie(struct adapter *adapter, u8 authmode, u8 *sec_ie)
void init_addba_retry_timer(struct adapter *padapter, struct sta_info *psta) void init_addba_retry_timer(struct adapter *padapter, struct sta_info *psta)
{ {
setup_timer(&psta->addba_retry_timer, addba_timer_hdl, timer_setup(&psta->addba_retry_timer, addba_timer_hdl, 0);
(unsigned long)psta);
} }
void init_mlme_ext_timer(struct adapter *padapter) void init_mlme_ext_timer(struct adapter *padapter)
{ {
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
setup_timer(&pmlmeext->survey_timer, survey_timer_hdl, timer_setup(&pmlmeext->survey_timer, survey_timer_hdl, 0);
(unsigned long)padapter); timer_setup(&pmlmeext->link_timer, link_timer_hdl, 0);
setup_timer(&pmlmeext->link_timer, link_timer_hdl,
(unsigned long)padapter);
} }
#ifdef CONFIG_88EU_AP_MODE #ifdef CONFIG_88EU_AP_MODE
......
...@@ -155,7 +155,6 @@ int rtw_recv_indicatepkt(struct adapter *padapter, ...@@ -155,7 +155,6 @@ int rtw_recv_indicatepkt(struct adapter *padapter,
void rtw_init_recv_timer(struct recv_reorder_ctrl *preorder_ctrl) void rtw_init_recv_timer(struct recv_reorder_ctrl *preorder_ctrl)
{ {
setup_timer(&preorder_ctrl->reordering_ctrl_timer, timer_setup(&preorder_ctrl->reordering_ctrl_timer,
rtw_reordering_ctrl_timeout_handler, rtw_reordering_ctrl_timeout_handler, 0);
(unsigned long)preorder_ctrl);
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment