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

staging: rtl8192u: 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: Derek Robson <robsonde@gmail.com>
Cc: simran singhal <singhalsimran0@gmail.com>
Cc: Riccardo Marotti <riccardo.marotti@gmail.com>
Cc: Fabrizio Perria <fabrizio.perria@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Baoyou Xie <baoyou.xie@linaro.org>
Cc: Tuomo Rinne <tuomo.rinne@gmail.com>
Cc: Colin Ian King <colin.king@canonical.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 fd5b9b83
...@@ -2392,9 +2392,9 @@ void TsInitAddBA(struct ieee80211_device *ieee, PTX_TS_RECORD pTS, ...@@ -2392,9 +2392,9 @@ void TsInitAddBA(struct ieee80211_device *ieee, PTX_TS_RECORD pTS,
u8 Policy, u8 bOverwritePending); u8 Policy, u8 bOverwritePending);
void TsInitDelBA(struct ieee80211_device *ieee, void TsInitDelBA(struct ieee80211_device *ieee,
PTS_COMMON_INFO pTsCommonInfo, TR_SELECT TxRxSelect); PTS_COMMON_INFO pTsCommonInfo, TR_SELECT TxRxSelect);
void BaSetupTimeOut(unsigned long data); void BaSetupTimeOut(struct timer_list *t);
void TxBaInactTimeout(unsigned long data); void TxBaInactTimeout(struct timer_list *t);
void RxBaInactTimeout(unsigned long data); void RxBaInactTimeout(struct timer_list *t);
void ResetBaEntry(PBA_RECORD pBA); void ResetBaEntry(PBA_RECORD pBA);
//function in TS.c //function in TS.c
bool GetTs( bool GetTs(
......
...@@ -57,9 +57,9 @@ void ieee80211_crypt_deinit_entries(struct ieee80211_device *ieee, ...@@ -57,9 +57,9 @@ void ieee80211_crypt_deinit_entries(struct ieee80211_device *ieee,
} }
} }
void ieee80211_crypt_deinit_handler(unsigned long data) void ieee80211_crypt_deinit_handler(struct timer_list *t)
{ {
struct ieee80211_device *ieee = (struct ieee80211_device *)data; struct ieee80211_device *ieee = from_timer(ieee, t, crypt_deinit_timer);
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&ieee->lock, flags); spin_lock_irqsave(&ieee->lock, flags);
......
...@@ -83,7 +83,7 @@ int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops); ...@@ -83,7 +83,7 @@ int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops);
int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops); int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops);
struct ieee80211_crypto_ops *ieee80211_get_crypto_ops(const char *name); struct ieee80211_crypto_ops *ieee80211_get_crypto_ops(const char *name);
void ieee80211_crypt_deinit_entries(struct ieee80211_device *ieee, int force); void ieee80211_crypt_deinit_entries(struct ieee80211_device *ieee, int force);
void ieee80211_crypt_deinit_handler(unsigned long data); void ieee80211_crypt_deinit_handler(struct timer_list *t);
void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee, void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee,
struct ieee80211_crypt_data **crypt); struct ieee80211_crypt_data **crypt);
......
...@@ -133,8 +133,8 @@ struct net_device *alloc_ieee80211(int sizeof_priv) ...@@ -133,8 +133,8 @@ struct net_device *alloc_ieee80211(int sizeof_priv)
ieee->ieee802_1x = 1; /* Default to supporting 802.1x */ ieee->ieee802_1x = 1; /* Default to supporting 802.1x */
INIT_LIST_HEAD(&ieee->crypt_deinit_list); INIT_LIST_HEAD(&ieee->crypt_deinit_list);
setup_timer(&ieee->crypt_deinit_timer, timer_setup(&ieee->crypt_deinit_timer, ieee80211_crypt_deinit_handler,
ieee80211_crypt_deinit_handler, (unsigned long)ieee); 0);
spin_lock_init(&ieee->lock); spin_lock_init(&ieee->lock);
spin_lock_init(&ieee->wpax_suitlist_lock); spin_lock_init(&ieee->wpax_suitlist_lock);
......
...@@ -672,18 +672,18 @@ TsInitDelBA( struct ieee80211_device *ieee, PTS_COMMON_INFO pTsCommonInfo, TR_SE ...@@ -672,18 +672,18 @@ TsInitDelBA( struct ieee80211_device *ieee, PTS_COMMON_INFO pTsCommonInfo, TR_SE
* return: NULL * return: NULL
* notice: * notice:
********************************************************************************************************************/ ********************************************************************************************************************/
void BaSetupTimeOut(unsigned long data) void BaSetupTimeOut(struct timer_list *t)
{ {
PTX_TS_RECORD pTxTs = (PTX_TS_RECORD)data; PTX_TS_RECORD pTxTs = from_timer(pTxTs, t, TxPendingBARecord.Timer);
pTxTs->bAddBaReqInProgress = false; pTxTs->bAddBaReqInProgress = false;
pTxTs->bAddBaReqDelayed = true; pTxTs->bAddBaReqDelayed = true;
pTxTs->TxPendingBARecord.bValid = false; pTxTs->TxPendingBARecord.bValid = false;
} }
void TxBaInactTimeout(unsigned long data) void TxBaInactTimeout(struct timer_list *t)
{ {
PTX_TS_RECORD pTxTs = (PTX_TS_RECORD)data; PTX_TS_RECORD pTxTs = from_timer(pTxTs, t, TxAdmittedBARecord.Timer);
struct ieee80211_device *ieee = container_of(pTxTs, struct ieee80211_device, TxTsRecord[pTxTs->num]); struct ieee80211_device *ieee = container_of(pTxTs, struct ieee80211_device, TxTsRecord[pTxTs->num]);
TxTsDeleteBA(ieee, pTxTs); TxTsDeleteBA(ieee, pTxTs);
ieee80211_send_DELBA( ieee80211_send_DELBA(
...@@ -694,9 +694,9 @@ void TxBaInactTimeout(unsigned long data) ...@@ -694,9 +694,9 @@ void TxBaInactTimeout(unsigned long data)
DELBA_REASON_TIMEOUT); DELBA_REASON_TIMEOUT);
} }
void RxBaInactTimeout(unsigned long data) void RxBaInactTimeout(struct timer_list *t)
{ {
PRX_TS_RECORD pRxTs = (PRX_TS_RECORD)data; PRX_TS_RECORD pRxTs = from_timer(pRxTs, t, RxAdmittedBARecord.Timer);
struct ieee80211_device *ieee = container_of(pRxTs, struct ieee80211_device, RxTsRecord[pRxTs->num]); struct ieee80211_device *ieee = container_of(pRxTs, struct ieee80211_device, RxTsRecord[pRxTs->num]);
RxTsDeleteBA(ieee, pRxTs); RxTsDeleteBA(ieee, pRxTs);
......
...@@ -3,13 +3,13 @@ ...@@ -3,13 +3,13 @@
#include <linux/slab.h> #include <linux/slab.h>
#include "rtl819x_TS.h" #include "rtl819x_TS.h"
static void TsSetupTimeOut(unsigned long data) static void TsSetupTimeOut(struct timer_list *unused)
{ {
// Not implement yet // Not implement yet
// This is used for WMMSA and ACM , that would send ADDTSReq frame. // This is used for WMMSA and ACM , that would send ADDTSReq frame.
} }
static void TsInactTimeout(unsigned long data) static void TsInactTimeout(struct timer_list *unused)
{ {
// Not implement yet // Not implement yet
// This is used for WMMSA and ACM. // This is used for WMMSA and ACM.
...@@ -22,9 +22,9 @@ static void TsInactTimeout(unsigned long data) ...@@ -22,9 +22,9 @@ static void TsInactTimeout(unsigned long data)
* return: NULL * return: NULL
* notice: * notice:
********************************************************************************************************************/ ********************************************************************************************************************/
static void RxPktPendingTimeout(unsigned long data) static void RxPktPendingTimeout(struct timer_list *t)
{ {
PRX_TS_RECORD pRxTs = (PRX_TS_RECORD)data; PRX_TS_RECORD pRxTs = from_timer(pRxTs, t, RxPktPendingTimer);
struct ieee80211_device *ieee = container_of(pRxTs, struct ieee80211_device, RxTsRecord[pRxTs->num]); struct ieee80211_device *ieee = container_of(pRxTs, struct ieee80211_device, RxTsRecord[pRxTs->num]);
PRX_REORDER_ENTRY pReorderEntry = NULL; PRX_REORDER_ENTRY pReorderEntry = NULL;
...@@ -89,9 +89,9 @@ static void RxPktPendingTimeout(unsigned long data) ...@@ -89,9 +89,9 @@ static void RxPktPendingTimeout(unsigned long data)
* return: NULL * return: NULL
* notice: * notice:
********************************************************************************************************************/ ********************************************************************************************************************/
static void TsAddBaProcess(unsigned long data) static void TsAddBaProcess(struct timer_list *t)
{ {
PTX_TS_RECORD pTxTs = (PTX_TS_RECORD)data; PTX_TS_RECORD pTxTs = from_timer(pTxTs, t, TsAddBaTimer);
u8 num = pTxTs->num; u8 num = pTxTs->num;
struct ieee80211_device *ieee = container_of(pTxTs, struct ieee80211_device, TxTsRecord[num]); struct ieee80211_device *ieee = container_of(pTxTs, struct ieee80211_device, TxTsRecord[num]);
...@@ -145,16 +145,15 @@ void TSInitialize(struct ieee80211_device *ieee) ...@@ -145,16 +145,15 @@ void TSInitialize(struct ieee80211_device *ieee)
pTxTS->num = count; pTxTS->num = count;
// The timers for the operation of Traffic Stream and Block Ack. // The timers for the operation of Traffic Stream and Block Ack.
// DLS related timer will be add here in the future!! // DLS related timer will be add here in the future!!
setup_timer(&pTxTS->TsCommonInfo.SetupTimer, TsSetupTimeOut, timer_setup(&pTxTS->TsCommonInfo.SetupTimer, TsSetupTimeOut,
(unsigned long)pTxTS); 0);
setup_timer(&pTxTS->TsCommonInfo.InactTimer, TsInactTimeout, timer_setup(&pTxTS->TsCommonInfo.InactTimer, TsInactTimeout,
(unsigned long)pTxTS); 0);
setup_timer(&pTxTS->TsAddBaTimer, TsAddBaProcess, timer_setup(&pTxTS->TsAddBaTimer, TsAddBaProcess, 0);
(unsigned long)pTxTS); timer_setup(&pTxTS->TxPendingBARecord.Timer, BaSetupTimeOut,
setup_timer(&pTxTS->TxPendingBARecord.Timer, BaSetupTimeOut, 0);
(unsigned long)pTxTS); timer_setup(&pTxTS->TxAdmittedBARecord.Timer,
setup_timer(&pTxTS->TxAdmittedBARecord.Timer, TxBaInactTimeout, 0);
TxBaInactTimeout, (unsigned long)pTxTS);
ResetTxTsEntry(pTxTS); ResetTxTsEntry(pTxTS);
list_add_tail(&pTxTS->TsCommonInfo.List, &ieee->Tx_TS_Unused_List); list_add_tail(&pTxTS->TsCommonInfo.List, &ieee->Tx_TS_Unused_List);
pTxTS++; pTxTS++;
...@@ -167,14 +166,13 @@ void TSInitialize(struct ieee80211_device *ieee) ...@@ -167,14 +166,13 @@ void TSInitialize(struct ieee80211_device *ieee)
for(count = 0; count < TOTAL_TS_NUM; count++) { for(count = 0; count < TOTAL_TS_NUM; count++) {
pRxTS->num = count; pRxTS->num = count;
INIT_LIST_HEAD(&pRxTS->RxPendingPktList); INIT_LIST_HEAD(&pRxTS->RxPendingPktList);
setup_timer(&pRxTS->TsCommonInfo.SetupTimer, TsSetupTimeOut, timer_setup(&pRxTS->TsCommonInfo.SetupTimer, TsSetupTimeOut,
(unsigned long)pRxTS); 0);
setup_timer(&pRxTS->TsCommonInfo.InactTimer, TsInactTimeout, timer_setup(&pRxTS->TsCommonInfo.InactTimer, TsInactTimeout,
(unsigned long)pRxTS); 0);
setup_timer(&pRxTS->RxAdmittedBARecord.Timer, timer_setup(&pRxTS->RxAdmittedBARecord.Timer,
RxBaInactTimeout, (unsigned long)pRxTS); RxBaInactTimeout, 0);
setup_timer(&pRxTS->RxPktPendingTimer, RxPktPendingTimeout, timer_setup(&pRxTS->RxPktPendingTimer, RxPktPendingTimeout, 0);
(unsigned long)pRxTS);
ResetRxTsEntry(pRxTS); ResetRxTsEntry(pRxTS);
list_add_tail(&pRxTS->TsCommonInfo.List, &ieee->Rx_TS_Unused_List); list_add_tail(&pRxTS->TsCommonInfo.List, &ieee->Rx_TS_Unused_List);
pRxTS++; pRxTS++;
......
...@@ -497,7 +497,7 @@ inline void force_pci_posting(struct net_device *dev) ...@@ -497,7 +497,7 @@ inline void force_pci_posting(struct net_device *dev)
static struct net_device_stats *rtl8192_stats(struct net_device *dev); static struct net_device_stats *rtl8192_stats(struct net_device *dev);
static void rtl8192_restart(struct work_struct *work); static void rtl8192_restart(struct work_struct *work);
static void watch_dog_timer_callback(unsigned long data); static void watch_dog_timer_callback(struct timer_list *t);
/**************************************************************************** /****************************************************************************
* -----------------------------PROCFS STUFF------------------------- * -----------------------------PROCFS STUFF-------------------------
...@@ -2698,8 +2698,7 @@ static short rtl8192_init(struct net_device *dev) ...@@ -2698,8 +2698,7 @@ static short rtl8192_init(struct net_device *dev)
} }
rtl8192_get_channel_map(dev); rtl8192_get_channel_map(dev);
init_hal_dm(dev); init_hal_dm(dev);
setup_timer(&priv->watch_dog_timer, watch_dog_timer_callback, timer_setup(&priv->watch_dog_timer, watch_dog_timer_callback, 0);
(unsigned long)dev);
if (rtl8192_usb_initendpoints(dev) != 0) { if (rtl8192_usb_initendpoints(dev) != 0) {
DMESG("Endopoints initialization failed"); DMESG("Endopoints initialization failed");
return -ENOMEM; return -ENOMEM;
...@@ -3500,9 +3499,9 @@ static void rtl819x_watchdog_wqcallback(struct work_struct *work) ...@@ -3500,9 +3499,9 @@ static void rtl819x_watchdog_wqcallback(struct work_struct *work)
RT_TRACE(COMP_TRACE, " <==RtUsbCheckForHangWorkItemCallback()\n"); RT_TRACE(COMP_TRACE, " <==RtUsbCheckForHangWorkItemCallback()\n");
} }
static void watch_dog_timer_callback(unsigned long data) static void watch_dog_timer_callback(struct timer_list *t)
{ {
struct r8192_priv *priv = ieee80211_priv((struct net_device *)data); struct r8192_priv *priv = from_timer(priv, t, watch_dog_timer);
schedule_delayed_work(&priv->watch_dog_wq, 0); schedule_delayed_work(&priv->watch_dog_wq, 0);
mod_timer(&priv->watch_dog_timer, mod_timer(&priv->watch_dog_timer,
...@@ -3529,7 +3528,7 @@ static int _rtl8192_up(struct net_device *dev) ...@@ -3529,7 +3528,7 @@ static int _rtl8192_up(struct net_device *dev)
if (priv->ieee80211->state != IEEE80211_LINKED) if (priv->ieee80211->state != IEEE80211_LINKED)
ieee80211_softmac_start_protocol(priv->ieee80211); ieee80211_softmac_start_protocol(priv->ieee80211);
ieee80211_reset_queue(priv->ieee80211); ieee80211_reset_queue(priv->ieee80211);
watch_dog_timer_callback((unsigned long)dev); watch_dog_timer_callback(&priv->watch_dog_timer);
if (!netif_queue_stopped(dev)) if (!netif_queue_stopped(dev))
netif_start_queue(dev); netif_start_queue(dev);
else else
......
...@@ -2729,8 +2729,7 @@ static void dm_init_fsync(struct net_device *dev) ...@@ -2729,8 +2729,7 @@ static void dm_init_fsync(struct net_device *dev)
priv->ieee80211->fsync_seconddiff_ratethreshold = 200; priv->ieee80211->fsync_seconddiff_ratethreshold = 200;
priv->ieee80211->fsync_state = Default_Fsync; priv->ieee80211->fsync_state = Default_Fsync;
priv->framesyncMonitor = 1; /* current default 0xc38 monitor on */ priv->framesyncMonitor = 1; /* current default 0xc38 monitor on */
setup_timer(&priv->fsync_timer, dm_fsync_timer_callback, timer_setup(&priv->fsync_timer, dm_fsync_timer_callback, 0);
(unsigned long)dev);
} }
static void dm_deInit_fsync(struct net_device *dev) static void dm_deInit_fsync(struct net_device *dev)
...@@ -2740,10 +2739,10 @@ static void dm_deInit_fsync(struct net_device *dev) ...@@ -2740,10 +2739,10 @@ static void dm_deInit_fsync(struct net_device *dev)
del_timer_sync(&priv->fsync_timer); del_timer_sync(&priv->fsync_timer);
} }
void dm_fsync_timer_callback(unsigned long data) void dm_fsync_timer_callback(struct timer_list *t)
{ {
struct net_device *dev = (struct net_device *)data; struct r8192_priv *priv = from_timer(priv, t, fsync_timer);
struct r8192_priv *priv = ieee80211_priv((struct net_device *)data); struct net_device *dev = priv->ieee80211->dev;
u32 rate_index, rate_count = 0, rate_count_diff = 0; u32 rate_index, rate_count = 0, rate_count_diff = 0;
bool bSwitchFromCountDiff = false; bool bSwitchFromCountDiff = false;
bool bDoubleTimeInterval = false; bool bDoubleTimeInterval = false;
......
...@@ -226,7 +226,7 @@ void dm_force_tx_fw_info(struct net_device *dev, ...@@ -226,7 +226,7 @@ void dm_force_tx_fw_info(struct net_device *dev,
void dm_init_edca_turbo(struct net_device *dev); void dm_init_edca_turbo(struct net_device *dev);
void dm_rf_operation_test_callback(unsigned long data); void dm_rf_operation_test_callback(unsigned long data);
void dm_rf_pathcheck_workitemcallback(struct work_struct *work); void dm_rf_pathcheck_workitemcallback(struct work_struct *work);
void dm_fsync_timer_callback(unsigned long data); void dm_fsync_timer_callback(struct timer_list *t);
void dm_cck_txpower_adjust(struct net_device *dev, bool binch14); void dm_cck_txpower_adjust(struct net_device *dev, bool binch14);
void dm_shadow_init(struct net_device *dev); void dm_shadow_init(struct net_device *dev);
void dm_initialize_txpower_tracking(struct net_device *dev); void dm_initialize_txpower_tracking(struct net_device *dev);
......
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