netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: mv643xx_eth: Use setup_timer
@ 2015-06-01  4:06 Vaishali Thakkar
  2015-06-01  4:23 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Vaishali Thakkar @ 2015-06-01  4:06 UTC (permalink / raw)
  To: Sebastian Hesselbarth; +Cc: Julia Lawall, netdev, linux-kernel

Use the timer API function setup_timer instead of structure field
assignments to initialize a timer.

A simplified version of the Coccinelle semantic patch that performs
this transformation is as follows:

@change@
expression e, func, da;
@@

-init_timer (&e);
+setup_timer (&e, func, da);
-e.data = da;
-e.function = func;

Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com>
---
 drivers/net/ethernet/marvell/mv643xx_eth.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c
index 1c75829..d52639b 100644
--- a/drivers/net/ethernet/marvell/mv643xx_eth.c
+++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
@@ -3125,9 +3125,8 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
 
 	mib_counters_clear(mp);
 
-	init_timer(&mp->mib_counters_timer);
-	mp->mib_counters_timer.data = (unsigned long)mp;
-	mp->mib_counters_timer.function = mib_counters_timer_wrapper;
+	setup_timer(&mp->mib_counters_timer, mib_counters_timer_wrapper,
+		    (unsigned long)mp);
 	mp->mib_counters_timer.expires = jiffies + 30 * HZ;
 
 	spin_lock_init(&mp->mib_counters_lock);
@@ -3136,9 +3135,7 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
 
 	netif_napi_add(dev, &mp->napi, mv643xx_eth_poll, NAPI_POLL_WEIGHT);
 
-	init_timer(&mp->rx_oom);
-	mp->rx_oom.data = (unsigned long)mp;
-	mp->rx_oom.function = oom_timer_wrapper;
+	setup_timer(&mp->rx_oom, oom_timer_wrapper, (unsigned long)mp);
 
 
 	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] net: mv643xx_eth: Use setup_timer
  2015-06-01  4:06 [PATCH] net: mv643xx_eth: Use setup_timer Vaishali Thakkar
@ 2015-06-01  4:23 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2015-06-01  4:23 UTC (permalink / raw)
  To: vthakkar1994; +Cc: sebastian.hesselbarth, julia.lawall, netdev, linux-kernel

From: Vaishali Thakkar <vthakkar1994@gmail.com>
Date: Mon, 1 Jun 2015 09:36:02 +0530

> Use the timer API function setup_timer instead of structure field
> assignments to initialize a timer.
> 
> A simplified version of the Coccinelle semantic patch that performs
> this transformation is as follows:
> 
> @change@
> expression e, func, da;
> @@
> 
> -init_timer (&e);
> +setup_timer (&e, func, da);
> -e.data = da;
> -e.function = func;
> 
> Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com>

Applied to net-next, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-06-01  4:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-01  4:06 [PATCH] net: mv643xx_eth: Use setup_timer Vaishali Thakkar
2015-06-01  4:23 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).