public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Vaishali Thakkar <vthakkar1994@gmail.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: Wilfried Klaebe <w-lkml@lebenslange-mailadresse.de>,
	Felipe Balbi <balbi@ti.com>,
	Justin van Wijngaarden <justinvanwijngaarden@gmail.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] drivers/net: Use setup_timer and mod_timer
Date: Wed, 11 Feb 2015 15:59:50 +0530	[thread overview]
Message-ID: <20150211102950.GA23755@vaishali-Ideapad-Z570> (raw)

This patch introduces the use of functions setup_timer
and mod_timer.

This is done using Coccinelle and semantic patch used
for this as follows:

// <smpl>
@@
expression x,y,z,a,b;
@@

-init_timer (&x);
+setup_timer (&x, y, z);
+mod_timer (&a, b);
-x.function = y;
-x.data = z;
-x.expires = b;
-add_timer(&a);

// </smpl>

Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com>
---
 drivers/net/ethernet/3com/3c589_cs.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/3com/3c589_cs.c b/drivers/net/ethernet/3com/3c589_cs.c
index f18647c..c5a3205 100644
--- a/drivers/net/ethernet/3com/3c589_cs.c
+++ b/drivers/net/ethernet/3com/3c589_cs.c
@@ -518,11 +518,8 @@ static int el3_open(struct net_device *dev)
 	netif_start_queue(dev);
 
 	tc589_reset(dev);
-	init_timer(&lp->media);
-	lp->media.function = media_check;
-	lp->media.data = (unsigned long) dev;
-	lp->media.expires = jiffies + HZ;
-	add_timer(&lp->media);
+	setup_timer(&lp->media, media_check, (unsigned long)dev);
+	mod_timer(&lp->media, jiffies + HZ);
 
 	dev_dbg(&link->dev, "%s: opened, status %4.4x.\n",
 	  dev->name, inw(dev->base_addr + EL3_STATUS));
-- 
1.9.1

             reply	other threads:[~2015-02-11 10:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-11 10:29 Vaishali Thakkar [this message]
2015-02-12  3:40 ` [PATCH] drivers/net: Use setup_timer and mod_timer David Miller
  -- strict thread matches above, loose matches on Subject: below --
2015-02-27  8:29 Vaishali Thakkar
2015-02-27  8:38 Vaishali Thakkar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150211102950.GA23755@vaishali-Ideapad-Z570 \
    --to=vthakkar1994@gmail.com \
    --cc=balbi@ti.com \
    --cc=davem@davemloft.net \
    --cc=justinvanwijngaarden@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=w-lkml@lebenslange-mailadresse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox