Skip to contentSkip to conversation

replace init_timer by setup_timer

PATCH New Aya Mahfouz 1 participant 6 messages Feb 19, 2015 Staging

lore
Share & tools
lore
#0 lore raw

cover replace init_timer by setup_timer

This patch replaces init_timer and the 2 step initialization of function and data by setup_timer in 5 different files. This is done to make the code look more concise. Each file resides in a different driver.

Aya Mahfouz (5):
staging: wlan-ng: replace init_timer by setup_timer
staging: dgnc: replace init_timer by setup_timer
staging: panel: replace init_timer by setup_timer
staging: rtl8192u: ieee80211: replace init_timer by setup_timer
staging: slicloss: replace init_timer by setup_timer

 drivers/staging/dgnc/dgnc_driver.c                    |  8 ++------
 drivers/staging/panel/panel.c                         |  4 +---
 .../staging/rtl8192u/ieee80211/ieee80211_softmac.c    | 10 ++++------
 drivers/staging/slicoss/slicoss.c                     |  9 +++------
 drivers/staging/wlan-ng/hfa384x_usb.c                 | 19 +++++++------------
 5 files changed, 17 insertions(+), 33 deletions(-)
Signature · 1 line
1.9.3
#1 lore raw

PATCH 1/5 staging: wlan-ng: replace init_timer by setup_timer

This patch replaces init_timer and the 2 step initialization of function and data by setup_timer to make the code more concise.

The issue was discovered using the following coccinelle script:

@@
expression ds, e1, e2;
@@

-init_timer (&ds);
+setup_timer (&ds, e1, e2);
...
(
-ds.function = e1;
...
-ds.data = e2;
|
-ds.data = e2;
...
-ds.function = e1;
)

---
 drivers/staging/wlan-ng/hfa384x_usb.c | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)
drivers/staging/wlan-ng/hfa384x_usb.c +7 -12
index 28cd1c4..c85b1b5 100644
@@ -557,17 +557,13 @@ void hfa384x_create(hfa384x_t *hw, struct usb_device *usb)
 	INIT_WORK(&hw->link_bh, prism2sta_processing_defer);
 	INIT_WORK(&hw->usb_work, hfa384x_usb_defer);
 
-	init_timer(&hw->throttle);
-	hw->throttle.function = hfa384x_usb_throttlefn;
-	hw->throttle.data = (unsigned long)hw;
+	setup_timer(&hw->throttle, hfa384x_usb_throttlefn, (unsigned long)hw);
 
-	init_timer(&hw->resptimer);
-	hw->resptimer.function = hfa384x_usbctlx_resptimerfn;
-	hw->resptimer.data = (unsigned long)hw;
+	setup_timer(&hw->resptimer, hfa384x_usbctlx_resptimerfn,
+		    (unsigned long)hw);
 
-	init_timer(&hw->reqtimer);
-	hw->reqtimer.function = hfa384x_usbctlx_reqtimerfn;
-	hw->reqtimer.data = (unsigned long)hw;
+	setup_timer(&hw->reqtimer, hfa384x_usbctlx_reqtimerfn,
+		    (unsigned long)hw);
 
 	usb_init_urb(&hw->rx_urb);
 	usb_init_urb(&hw->tx_urb);
@@ -577,9 +573,8 @@ void hfa384x_create(hfa384x_t *hw, struct usb_device *usb)
 	hw->state = HFA384x_STATE_INIT;
 
 	INIT_WORK(&hw->commsqual_bh, prism2sta_commsqual_defer);
-	init_timer(&hw->commsqual_timer);
-	hw->commsqual_timer.data = (unsigned long)hw;
-	hw->commsqual_timer.function = prism2sta_commsqual_timer;
+	setup_timer(&hw->commsqual_timer, prism2sta_commsqual_timer,
+		    (unsigned long)hw);
 }
 
 /*----------------------------------------------------------------
Signature · 1 line
1.9.3
#2 lore raw

PATCH 2/5 staging: dgnc: replace init_timer by setup_timer

In reply to Aya Mahfouz

This patch replaces init_timer and the 2 step initialization of function and data by setup_timer to make the code more concise.

The issue was discovered using the following coccinelle script:

@@
expression ds, e1, e2;
@@

-init_timer (&ds);
+setup_timer (&ds, e1, e2);
...
(
-ds.function = e1;
...
-ds.data = e2;
|
-ds.data = e2;
...
-ds.function = e1;
)

---
 drivers/staging/dgnc/dgnc_driver.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/staging/dgnc/dgnc_driver.c +2 -6
index f177d3a..5d47c61 100644
@@ -285,9 +285,7 @@ static int dgnc_start(void)
 
 	/* Start the poller */
 	spin_lock_irqsave(&dgnc_poll_lock, flags);
-	init_timer(&dgnc_poll_timer);
-	dgnc_poll_timer.function = dgnc_poll_handler;
-	dgnc_poll_timer.data = 0;
+	setup_timer(&dgnc_poll_timer, dgnc_poll_handler, 0);
 	dgnc_poll_time = jiffies + dgnc_jiffies_from_ms(dgnc_poll_tick);
 	dgnc_poll_timer.expires = dgnc_poll_time;
 	spin_unlock_irqrestore(&dgnc_poll_lock, flags);
@@ -731,9 +729,7 @@ static void dgnc_poll_handler(ulong dummy)
 	if ((ulong) new_time >= 2 * dgnc_poll_tick)
 		dgnc_poll_time = jiffies +  dgnc_jiffies_from_ms(dgnc_poll_tick);
 
-	init_timer(&dgnc_poll_timer);
-	dgnc_poll_timer.function = dgnc_poll_handler;
-	dgnc_poll_timer.data = 0;
+	setup_timer(&dgnc_poll_timer, dgnc_poll_handler, 0);
 	dgnc_poll_timer.expires = dgnc_poll_time;
 	spin_unlock_irqrestore(&dgnc_poll_lock, flags);
 
Signature · 1 line
1.9.3
#3 lore raw

PATCH 3/5 staging: panel: replace init_timer by setup_timer

In reply to Aya Mahfouz

This patch replaces init_timer and the 2 step initialization of function and data by setup_timer to make the code more concise.

The issue was discovered using the following coccinelle script:

@@
expression ds, e1, e2;
@@

-init_timer (&ds);
+setup_timer (&ds, e1, e2);
...
(
-ds.function = e1;
...
-ds.data = e2;
|
-ds.data = e2;
...
-ds.function = e1;
)

---
 drivers/staging/panel/panel.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/staging/panel/panel.c +1 -3
index 6ed35b6..4da854c 100644
@@ -2010,10 +2010,8 @@ static void init_scan_timer(void)
 	if (scan_timer.function != NULL)
 		return;		/* already started */
 
-	init_timer(&scan_timer);
+	setup_timer(&scan_timer, (void *)&panel_scan_timer, 0);
 	scan_timer.expires = jiffies + INPUT_POLL_TIME;
-	scan_timer.data = 0;
-	scan_timer.function = (void *)&panel_scan_timer;
 	add_timer(&scan_timer);
 }
 
Signature · 1 line
1.9.3
#4 lore raw

PATCH 4/5 staging: rtl8192u: ieee80211: replace init_timer by setup_timer

In reply to Aya Mahfouz

This patch replaces init_timer and the 2 step initialization of function and data by setup_timer to make the code more concise.

The issue was discovered using the following coccinelle script:

@@
expression ds, e1, e2;
@@

-init_timer (&ds);
+setup_timer (&ds, e1, e2);
...
(
-ds.function = e1;
...
-ds.data = e2;
|
-ds.data = e2;
...
-ds.function = e1;
)

---
 drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +4 -6
index d147187..3a54071 100644
@@ -2722,13 +2722,11 @@ void ieee80211_softmac_init(struct ieee80211_device *ieee)
 	ieee->enable_rx_imm_BA = 1;
 	ieee->tx_pending.txb = NULL;
 
-	init_timer(&ieee->associate_timer);
-	ieee->associate_timer.data = (unsigned long)ieee;
-	ieee->associate_timer.function = ieee80211_associate_abort_cb;
+	setup_timer(&ieee->associate_timer, ieee80211_associate_abort_cb,
+		    (unsigned long)ieee);
 
-	init_timer(&ieee->beacon_timer);
-	ieee->beacon_timer.data = (unsigned long) ieee;
-	ieee->beacon_timer.function = ieee80211_send_beacon_cb;
+	setup_timer(&ieee->beacon_timer, ieee80211_send_beacon_cb,
+		    (unsigned long)ieee);
 
 	ieee->wq = create_workqueue(DRV_NAME);
 
Signature · 1 line
1.9.3
#5 lore raw

PATCH 5/5 staging: slicloss: replace init_timer by setup_timer

In reply to Aya Mahfouz

This patch replaces init_timer and the 2 step initialization of function and data by setup_timer to make the code more concise.

The issue was discovered using the following coccinelle script:

@@
expression ds, e1, e2;
@@

-init_timer (&ds);
+setup_timer (&ds, e1, e2);
...
(
-ds.function = e1;
...
-ds.data = e2;
|
-ds.data = e2;
...
-ds.function = e1;
)

---
 drivers/staging/slicoss/slicoss.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/staging/slicoss/slicoss.c +3 -6
index 42d62ef..1248f62 100644
@@ -2362,22 +2362,19 @@ static int slic_if_init(struct adapter *adapter)
 
 	adapter->state = ADAPT_UP;
 	if (!card->loadtimerset) {
-		init_timer(&card->loadtimer);
+		setup_timer(&card->loadtimer, &slic_timer_load_check,
+			    (ulong)card);
 		card->loadtimer.expires =
 		    jiffies + (SLIC_LOADTIMER_PERIOD * HZ);
-		card->loadtimer.data = (ulong) card;
-		card->loadtimer.function = &slic_timer_load_check;
 		add_timer(&card->loadtimer);
 
 		card->loadtimerset = 1;
 	}
 
 	if (!adapter->pingtimerset) {
-		init_timer(&adapter->pingtimer);
+		setup_timer(&adapter->pingtimer, &slic_timer_ping, (ulong)dev);
 		adapter->pingtimer.expires =
 		    jiffies + (PING_TIMER_INTERVAL * HZ);
-		adapter->pingtimer.data = (ulong) dev;
-		adapter->pingtimer.function = &slic_timer_ping;
 		add_timer(&adapter->pingtimer);
 		adapter->pingtimerset = 1;
 		adapter->card->pingstatus = ISR_PINGMASK;
Signature · 1 line
1.9.3