Commit acc6539f authored by Somya Anand's avatar Somya Anand Committed by Greg Kroah-Hartman

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: default avatarSomya Anand <somyaanand214@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c3bb4545
...@@ -133,9 +133,8 @@ struct net_device *alloc_ieee80211(int sizeof_priv) ...@@ -133,9 +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);
init_timer(&ieee->crypt_deinit_timer); setup_timer(&ieee->crypt_deinit_timer,
ieee->crypt_deinit_timer.data = (unsigned long)ieee; ieee80211_crypt_deinit_handler, (unsigned long)ieee);
ieee->crypt_deinit_timer.function = ieee80211_crypt_deinit_handler;
spin_lock_init(&ieee->lock); spin_lock_init(&ieee->lock);
spin_lock_init(&ieee->wpax_suitlist_lock); spin_lock_init(&ieee->wpax_suitlist_lock);
......
...@@ -156,26 +156,16 @@ void TSInitialize(struct ieee80211_device *ieee) ...@@ -156,26 +156,16 @@ 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!!
init_timer(&pTxTS->TsCommonInfo.SetupTimer); setup_timer(&pTxTS->TsCommonInfo.SetupTimer, TsSetupTimeOut,
pTxTS->TsCommonInfo.SetupTimer.data = (unsigned long)pTxTS; (unsigned long)pTxTS);
pTxTS->TsCommonInfo.SetupTimer.function = TsSetupTimeOut; setup_timer(&pTxTS->TsCommonInfo.InactTimer, TsInactTimeout,
(unsigned long)pTxTS);
init_timer(&pTxTS->TsCommonInfo.InactTimer); setup_timer(&pTxTS->TsAddBaTimer, TsAddBaProcess,
pTxTS->TsCommonInfo.InactTimer.data = (unsigned long)pTxTS; (unsigned long)pTxTS);
pTxTS->TsCommonInfo.InactTimer.function = TsInactTimeout; setup_timer(&pTxTS->TxPendingBARecord.Timer, BaSetupTimeOut,
(unsigned long)pTxTS);
init_timer(&pTxTS->TsAddBaTimer); setup_timer(&pTxTS->TxAdmittedBARecord.Timer,
pTxTS->TsAddBaTimer.data = (unsigned long)pTxTS; TxBaInactTimeout, (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;
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++;
...@@ -189,23 +179,14 @@ void TSInitialize(struct ieee80211_device *ieee) ...@@ -189,23 +179,14 @@ void TSInitialize(struct ieee80211_device *ieee)
{ {
pRxTS->num = count; pRxTS->num = count;
INIT_LIST_HEAD(&pRxTS->RxPendingPktList); INIT_LIST_HEAD(&pRxTS->RxPendingPktList);
setup_timer(&pRxTS->TsCommonInfo.SetupTimer, TsSetupTimeOut,
init_timer(&pRxTS->TsCommonInfo.SetupTimer); (unsigned long)pRxTS);
pRxTS->TsCommonInfo.SetupTimer.data = (unsigned long)pRxTS; setup_timer(&pRxTS->TsCommonInfo.InactTimer, TsInactTimeout,
pRxTS->TsCommonInfo.SetupTimer.function = TsSetupTimeOut; (unsigned long)pRxTS);
setup_timer(&pRxTS->RxAdmittedBARecord.Timer,
init_timer(&pRxTS->TsCommonInfo.InactTimer); RxBaInactTimeout, (unsigned long)pRxTS);
pRxTS->TsCommonInfo.InactTimer.data = (unsigned long)pRxTS; setup_timer(&pRxTS->RxPktPendingTimer, RxPktPendingTimeout,
pRxTS->TsCommonInfo.InactTimer.function = TsInactTimeout; (unsigned long)pRxTS);
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;
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++;
......
...@@ -2549,9 +2549,8 @@ static short rtl8192_init(struct net_device *dev) ...@@ -2549,9 +2549,8 @@ static short rtl8192_init(struct net_device *dev)
rtl8192_read_eeprom_info(dev); rtl8192_read_eeprom_info(dev);
rtl8192_get_channel_map(dev); rtl8192_get_channel_map(dev);
init_hal_dm(dev); init_hal_dm(dev);
init_timer(&priv->watch_dog_timer); setup_timer(&priv->watch_dog_timer, watch_dog_timer_callback,
priv->watch_dog_timer.data = (unsigned long)dev; (unsigned long)dev);
priv->watch_dog_timer.function = watch_dog_timer_callback;
if (rtl8192_usb_initendpoints(dev) != 0) { if (rtl8192_usb_initendpoints(dev) != 0) {
DMESG("Endopoints initialization failed"); DMESG("Endopoints initialization failed");
return -ENOMEM; return -ENOMEM;
......
...@@ -2681,10 +2681,8 @@ static void dm_init_fsync(struct net_device *dev) ...@@ -2681,10 +2681,8 @@ 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,
init_timer(&priv->fsync_timer); (unsigned long)dev);
priv->fsync_timer.data = (unsigned long)dev;
priv->fsync_timer.function = dm_fsync_timer_callback;
} }
static void dm_deInit_fsync(struct net_device *dev) static void dm_deInit_fsync(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