From patchwork Fri Feb 27 08:38:12 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vaishali Thakkar X-Patchwork-Id: 444207 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 338B7140082 for ; Fri, 27 Feb 2015 19:38:36 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="verification failed; unprotected key" header.d=gmail.com header.i=@gmail.com header.b=kNfYltCS; dkim-adsp=none (unprotected policy); dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932102AbbB0IiV (ORCPT ); Fri, 27 Feb 2015 03:38:21 -0500 Received: from mail-pa0-f41.google.com ([209.85.220.41]:44783 "EHLO mail-pa0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754738AbbB0IiU (ORCPT ); Fri, 27 Feb 2015 03:38:20 -0500 Received: by padet14 with SMTP id et14so20993989pad.11; Fri, 27 Feb 2015 00:38:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; bh=M7fhWDs27J55y09x0UcNceUeC2Csj/xDez3Cn0dJKBc=; b=kNfYltCS/MZmsoNko/kRe0eaSZQJtWIPugUWezhemBd2y5YPrHkyYZeJ32fKWXPUtA Q/8hHpEqhoc3Ce7eyJjRaaig82H1WYqKflDUoYgPVsk1pJrhNAIuJ9d0dlB/phLBlDSs V7tnlAq2hQwk3lkC8pB5IlXqWzzVgfGseZgIcROzfuCEsxYdTKBWw9grmQLh7nsdq2Wg lKU/hX5cqOF7vITbEUj/nlKaGMv4FvAOzlEt0LAqIhdLWWIlYa38gAfo7yXOJPeltXzO EQrLDVbpkx19YletQ4FT9Qmcx+kYWJZlQ5oh6BOk+5KqlIc8jlPiMpHgyz5FM1rCwxC6 edMA== X-Received: by 10.68.135.97 with SMTP id pr1mr22289436pbb.71.1425026300185; Fri, 27 Feb 2015 00:38:20 -0800 (PST) Received: from vaishali-Ideapad-Z570 ([43.249.235.201]) by mx.google.com with ESMTPSA id ph7sm3287150pbb.6.2015.02.27.00.38.17 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 27 Feb 2015 00:38:19 -0800 (PST) Date: Fri, 27 Feb 2015 14:08:12 +0530 From: Vaishali Thakkar To: "David S. Miller" Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] drivers/net: Use setup_timer and mod_timer Message-ID: <20150227083812.GA15793@vaishali-Ideapad-Z570> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Use timer API functions setup_timer and mod_timer instead of structure assignments as they are standard way to set the timer and to update the expire field of an active timer respectively. This is done using Coccinelle and semantic patch used for this is as follows: // @@ 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); Signed-off-by: Vaishali Thakkar --- drivers/net/ethernet/8390/pcnet_cs.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/8390/pcnet_cs.c b/drivers/net/ethernet/8390/pcnet_cs.c index 9fb7b9d..2777289 100644 --- a/drivers/net/ethernet/8390/pcnet_cs.c +++ b/drivers/net/ethernet/8390/pcnet_cs.c @@ -918,11 +918,8 @@ static int pcnet_open(struct net_device *dev) info->phy_id = info->eth_phy; info->link_status = 0x00; - init_timer(&info->watchdog); - info->watchdog.function = ei_watchdog; - info->watchdog.data = (u_long)dev; - info->watchdog.expires = jiffies + HZ; - add_timer(&info->watchdog); + setup_timer(&info->watchdog, ei_watchdog, (u_long)dev); + mod_timer(&info->watchdog, jiffies + HZ); return ei_open(dev); } /* pcnet_open */