Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging: rtl8712: 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: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Florian Schilhabel <florian.c.schilhabel@googlemail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Tejaswini Poluri <tejaswinipoluri3@gmail.com>
Cc: Scott Matheina <scott@matheina.com>
Cc: Varsha Rao <rvarsha016@gmail.com>
Cc: Julia Lawall <julia.lawall@lip6.fr>
Cc: Aleksey Kurbatov <alkbt@yandex.ru>
Cc: Vijai Kumar K <vijaikumar.kanagarajan@gmail.com>
Cc: Wei Yongjun <weiyongjun1@huawei.com>
Cc: "Raphaël Beamonte" <raphael.beamonte@gmail.com>
Cc: Jannik Becher <becher.jannik@gmail.com>
Cc: Joseph Wright <rjosephwright@gmail.com>
Cc: devel@driverdev.osuosl.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Kees Cook and committed by
Greg Kroah-Hartman
36aeebd4 e8c5027d

+34 -33
+24 -24
drivers/staging/rtl8712/mlme_linux.c
··· 32 32 #include "drv_types.h" 33 33 #include "mlme_osdep.h" 34 34 35 - static void sitesurvey_ctrl_handler(unsigned long data) 35 + static void sitesurvey_ctrl_handler(struct timer_list *t) 36 36 { 37 - struct _adapter *adapter = (struct _adapter *)data; 37 + struct _adapter *adapter = 38 + from_timer(adapter, t, 39 + mlmepriv.sitesurveyctrl.sitesurvey_ctrl_timer); 38 40 39 41 _r8712_sitesurvey_ctrl_handler(adapter); 40 42 mod_timer(&adapter->mlmepriv.sitesurveyctrl.sitesurvey_ctrl_timer, 41 43 jiffies + msecs_to_jiffies(3000)); 42 44 } 43 45 44 - static void join_timeout_handler (unsigned long data) 46 + static void join_timeout_handler (struct timer_list *t) 45 47 { 46 - struct _adapter *adapter = (struct _adapter *)data; 48 + struct _adapter *adapter = 49 + from_timer(adapter, t, mlmepriv.assoc_timer); 47 50 48 51 _r8712_join_timeout_handler(adapter); 49 52 } 50 53 51 - static void _scan_timeout_handler (unsigned long data) 54 + static void _scan_timeout_handler (struct timer_list *t) 52 55 { 53 - struct _adapter *adapter = (struct _adapter *)data; 56 + struct _adapter *adapter = 57 + from_timer(adapter, t, mlmepriv.scan_to_timer); 54 58 55 59 r8712_scan_timeout_handler(adapter); 56 60 } 57 61 58 - static void dhcp_timeout_handler (unsigned long data) 62 + static void dhcp_timeout_handler (struct timer_list *t) 59 63 { 60 - struct _adapter *adapter = (struct _adapter *)data; 64 + struct _adapter *adapter = 65 + from_timer(adapter, t, mlmepriv.dhcp_timer); 61 66 62 67 _r8712_dhcp_timeout_handler(adapter); 63 68 } 64 69 65 - static void wdg_timeout_handler (unsigned long data) 70 + static void wdg_timeout_handler (struct timer_list *t) 66 71 { 67 - struct _adapter *adapter = (struct _adapter *)data; 72 + struct _adapter *adapter = 73 + from_timer(adapter, t, mlmepriv.wdg_timer); 68 74 69 75 _r8712_wdg_timeout_handler(adapter); 70 76 ··· 82 76 { 83 77 struct mlme_priv *pmlmepriv = &padapter->mlmepriv; 84 78 85 - setup_timer(&pmlmepriv->assoc_timer, join_timeout_handler, 86 - (unsigned long)padapter); 87 - setup_timer(&pmlmepriv->sitesurveyctrl.sitesurvey_ctrl_timer, 88 - sitesurvey_ctrl_handler, 89 - (unsigned long)padapter); 90 - setup_timer(&pmlmepriv->scan_to_timer, _scan_timeout_handler, 91 - (unsigned long)padapter); 92 - setup_timer(&pmlmepriv->dhcp_timer, dhcp_timeout_handler, 93 - (unsigned long)padapter); 94 - setup_timer(&pmlmepriv->wdg_timer, wdg_timeout_handler, 95 - (unsigned long)padapter); 79 + timer_setup(&pmlmepriv->assoc_timer, join_timeout_handler, 0); 80 + timer_setup(&pmlmepriv->sitesurveyctrl.sitesurvey_ctrl_timer, 81 + sitesurvey_ctrl_handler, 0); 82 + timer_setup(&pmlmepriv->scan_to_timer, _scan_timeout_handler, 0); 83 + timer_setup(&pmlmepriv->dhcp_timer, dhcp_timeout_handler, 0); 84 + timer_setup(&pmlmepriv->wdg_timer, wdg_timeout_handler, 0); 96 85 } 97 86 98 87 void r8712_os_indicate_connect(struct _adapter *adapter) ··· 119 118 adapter->securitypriv.btkip_countermeasure; 120 119 memset((unsigned char *)&adapter->securitypriv, 0, 121 120 sizeof(struct security_priv)); 122 - setup_timer(&adapter->securitypriv.tkip_timer, 123 - r8712_use_tkipkey_handler, 124 - (unsigned long)adapter); 121 + timer_setup(&adapter->securitypriv.tkip_timer, 122 + r8712_use_tkipkey_handler, 0); 125 123 /* Restore the PMK information to securitypriv structure 126 124 * for the following connection. 127 125 */
+2 -2
drivers/staging/rtl8712/os_intfs.c
··· 313 313 _r8712_init_recv_priv(&padapter->recvpriv, padapter); 314 314 memset((unsigned char *)&padapter->securitypriv, 0, 315 315 sizeof(struct security_priv)); 316 - setup_timer(&padapter->securitypriv.tkip_timer, 317 - r8712_use_tkipkey_handler, (unsigned long)padapter); 316 + timer_setup(&padapter->securitypriv.tkip_timer, 317 + r8712_use_tkipkey_handler, 0); 318 318 _r8712_init_sta_priv(&padapter->stapriv); 319 319 padapter->stapriv.padapter = padapter; 320 320 r8712_init_bcmc_stainfo(padapter);
+4 -4
drivers/staging/rtl8712/rtl871x_pwrctrl.c
··· 164 164 } 165 165 } 166 166 167 - static void rpwm_check_handler (unsigned long data) 167 + static void rpwm_check_handler (struct timer_list *t) 168 168 { 169 - struct _adapter *adapter = (struct _adapter *)data; 169 + struct _adapter *adapter = 170 + from_timer(adapter, t, pwrctrlpriv.rpwm_check_timer); 170 171 171 172 _rpwm_check_handler(adapter); 172 173 } ··· 186 185 r8712_write8(padapter, 0x1025FE58, 0); 187 186 INIT_WORK(&pwrctrlpriv->SetPSModeWorkItem, SetPSModeWorkItemCallback); 188 187 INIT_WORK(&pwrctrlpriv->rpwm_workitem, rpwm_workitem_callback); 189 - setup_timer(&pwrctrlpriv->rpwm_check_timer, rpwm_check_handler, 190 - (unsigned long)padapter); 188 + timer_setup(&pwrctrlpriv->rpwm_check_timer, rpwm_check_handler, 0); 191 189 } 192 190 193 191 /*
+3 -2
drivers/staging/rtl8712/rtl871x_security.c
··· 1402 1402 return _SUCCESS; 1403 1403 } 1404 1404 1405 - void r8712_use_tkipkey_handler(unsigned long data) 1405 + void r8712_use_tkipkey_handler(struct timer_list *t) 1406 1406 { 1407 - struct _adapter *padapter = (struct _adapter *)data; 1407 + struct _adapter *padapter = 1408 + from_timer(padapter, t, securitypriv.tkip_timer); 1408 1409 1409 1410 padapter->securitypriv.busetkipkey = true; 1410 1411 }
+1 -1
drivers/staging/rtl8712/rtl871x_security.h
··· 224 224 u32 r8712_aes_decrypt(struct _adapter *padapter, u8 *precvframe); 225 225 u32 r8712_tkip_decrypt(struct _adapter *padapter, u8 *precvframe); 226 226 void r8712_wep_decrypt(struct _adapter *padapter, u8 *precvframe); 227 - void r8712_use_tkipkey_handler(unsigned long data); 227 + void r8712_use_tkipkey_handler(struct timer_list *t); 228 228 229 229 #endif /*__RTL871X_SECURITY_H_ */ 230 230