mirror of https://gitee.com/openkylin/linux.git
Staging: rtl8192u: Combine initialization using setup_timer
The function setup_timer combines the initialization of a timer with the initialization of the timer's function and data fields. So, this patch combines the multiline code for timer initialization using the function setup_timer. This issue is identified via coccinelle script. @@ expression E1, E2, E3; type T; @@ - init_timer(&E1); ... ( - E1.function = E2; ... - E1.data = (T)E3; + setup_timer(&E1, E2, (T)E3); | - E1.data = (T)E3; ... - E1.function = E2; + setup_timer(&E1, E2, (T)E3); | - E1.function = E2; + setup_timer(&E1, E2, 0); ) Signed-off-by: Somya Anand <somyaanand214@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
c3bb45456b
commit
acc6539fe6
|
@ -133,9 +133,8 @@ struct net_device *alloc_ieee80211(int sizeof_priv)
|
|||
ieee->ieee802_1x = 1; /* Default to supporting 802.1x */
|
||||
|
||||
INIT_LIST_HEAD(&ieee->crypt_deinit_list);
|
||||
init_timer(&ieee->crypt_deinit_timer);
|
||||
ieee->crypt_deinit_timer.data = (unsigned long)ieee;
|
||||
ieee->crypt_deinit_timer.function = ieee80211_crypt_deinit_handler;
|
||||
setup_timer(&ieee->crypt_deinit_timer,
|
||||
ieee80211_crypt_deinit_handler, (unsigned long)ieee);
|
||||
|
||||
spin_lock_init(&ieee->lock);
|
||||
spin_lock_init(&ieee->wpax_suitlist_lock);
|
||||
|
|
|
@ -156,26 +156,16 @@ void TSInitialize(struct ieee80211_device *ieee)
|
|||
pTxTS->num = count;
|
||||
// The timers for the operation of Traffic Stream and Block Ack.
|
||||
// DLS related timer will be add here in the future!!
|
||||
init_timer(&pTxTS->TsCommonInfo.SetupTimer);
|
||||
pTxTS->TsCommonInfo.SetupTimer.data = (unsigned long)pTxTS;
|
||||
pTxTS->TsCommonInfo.SetupTimer.function = TsSetupTimeOut;
|
||||
|
||||
init_timer(&pTxTS->TsCommonInfo.InactTimer);
|
||||
pTxTS->TsCommonInfo.InactTimer.data = (unsigned long)pTxTS;
|
||||
pTxTS->TsCommonInfo.InactTimer.function = TsInactTimeout;
|
||||
|
||||
init_timer(&pTxTS->TsAddBaTimer);
|
||||
pTxTS->TsAddBaTimer.data = (unsigned long)pTxTS;
|
||||
pTxTS->TsAddBaTimer.function = TsAddBaProcess;
|
||||
|
||||
init_timer(&pTxTS->TxPendingBARecord.Timer);
|
||||
pTxTS->TxPendingBARecord.Timer.data = (unsigned long)pTxTS;
|
||||
pTxTS->TxPendingBARecord.Timer.function = BaSetupTimeOut;
|
||||
|
||||
init_timer(&pTxTS->TxAdmittedBARecord.Timer);
|
||||
pTxTS->TxAdmittedBARecord.Timer.data = (unsigned long)pTxTS;
|
||||
pTxTS->TxAdmittedBARecord.Timer.function = TxBaInactTimeout;
|
||||
|
||||
setup_timer(&pTxTS->TsCommonInfo.SetupTimer, TsSetupTimeOut,
|
||||
(unsigned long)pTxTS);
|
||||
setup_timer(&pTxTS->TsCommonInfo.InactTimer, TsInactTimeout,
|
||||
(unsigned long)pTxTS);
|
||||
setup_timer(&pTxTS->TsAddBaTimer, TsAddBaProcess,
|
||||
(unsigned long)pTxTS);
|
||||
setup_timer(&pTxTS->TxPendingBARecord.Timer, BaSetupTimeOut,
|
||||
(unsigned long)pTxTS);
|
||||
setup_timer(&pTxTS->TxAdmittedBARecord.Timer,
|
||||
TxBaInactTimeout, (unsigned long)pTxTS);
|
||||
ResetTxTsEntry(pTxTS);
|
||||
list_add_tail(&pTxTS->TsCommonInfo.List, &ieee->Tx_TS_Unused_List);
|
||||
pTxTS++;
|
||||
|
@ -189,23 +179,14 @@ void TSInitialize(struct ieee80211_device *ieee)
|
|||
{
|
||||
pRxTS->num = count;
|
||||
INIT_LIST_HEAD(&pRxTS->RxPendingPktList);
|
||||
|
||||
init_timer(&pRxTS->TsCommonInfo.SetupTimer);
|
||||
pRxTS->TsCommonInfo.SetupTimer.data = (unsigned long)pRxTS;
|
||||
pRxTS->TsCommonInfo.SetupTimer.function = TsSetupTimeOut;
|
||||
|
||||
init_timer(&pRxTS->TsCommonInfo.InactTimer);
|
||||
pRxTS->TsCommonInfo.InactTimer.data = (unsigned long)pRxTS;
|
||||
pRxTS->TsCommonInfo.InactTimer.function = TsInactTimeout;
|
||||
|
||||
init_timer(&pRxTS->RxAdmittedBARecord.Timer);
|
||||
pRxTS->RxAdmittedBARecord.Timer.data = (unsigned long)pRxTS;
|
||||
pRxTS->RxAdmittedBARecord.Timer.function = RxBaInactTimeout;
|
||||
|
||||
init_timer(&pRxTS->RxPktPendingTimer);
|
||||
pRxTS->RxPktPendingTimer.data = (unsigned long)pRxTS;
|
||||
pRxTS->RxPktPendingTimer.function = RxPktPendingTimeout;
|
||||
|
||||
setup_timer(&pRxTS->TsCommonInfo.SetupTimer, TsSetupTimeOut,
|
||||
(unsigned long)pRxTS);
|
||||
setup_timer(&pRxTS->TsCommonInfo.InactTimer, TsInactTimeout,
|
||||
(unsigned long)pRxTS);
|
||||
setup_timer(&pRxTS->RxAdmittedBARecord.Timer,
|
||||
RxBaInactTimeout, (unsigned long)pRxTS);
|
||||
setup_timer(&pRxTS->RxPktPendingTimer, RxPktPendingTimeout,
|
||||
(unsigned long)pRxTS);
|
||||
ResetRxTsEntry(pRxTS);
|
||||
list_add_tail(&pRxTS->TsCommonInfo.List, &ieee->Rx_TS_Unused_List);
|
||||
pRxTS++;
|
||||
|
|
|
@ -2549,9 +2549,8 @@ static short rtl8192_init(struct net_device *dev)
|
|||
rtl8192_read_eeprom_info(dev);
|
||||
rtl8192_get_channel_map(dev);
|
||||
init_hal_dm(dev);
|
||||
init_timer(&priv->watch_dog_timer);
|
||||
priv->watch_dog_timer.data = (unsigned long)dev;
|
||||
priv->watch_dog_timer.function = watch_dog_timer_callback;
|
||||
setup_timer(&priv->watch_dog_timer, watch_dog_timer_callback,
|
||||
(unsigned long)dev);
|
||||
if (rtl8192_usb_initendpoints(dev) != 0) {
|
||||
DMESG("Endopoints initialization failed");
|
||||
return -ENOMEM;
|
||||
|
|
|
@ -2681,10 +2681,8 @@ static void dm_init_fsync(struct net_device *dev)
|
|||
priv->ieee80211->fsync_seconddiff_ratethreshold = 200;
|
||||
priv->ieee80211->fsync_state = Default_Fsync;
|
||||
priv->framesyncMonitor = 1; /* current default 0xc38 monitor on */
|
||||
|
||||
init_timer(&priv->fsync_timer);
|
||||
priv->fsync_timer.data = (unsigned long)dev;
|
||||
priv->fsync_timer.function = dm_fsync_timer_callback;
|
||||
setup_timer(&priv->fsync_timer, dm_fsync_timer_callback,
|
||||
(unsigned long)dev);
|
||||
}
|
||||
|
||||
static void dm_deInit_fsync(struct net_device *dev)
|
||||
|
|
Loading…
Reference in New Issue