From patchwork Mon Jun 1 04:06:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vaishali Thakkar X-Patchwork-Id: 478767 X-Patchwork-Delegate: davem@davemloft.net 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 790BF1412DC for ; Mon, 1 Jun 2015 14:06:36 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=0XfSa5NU; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755632AbbFAEGK (ORCPT ); Mon, 1 Jun 2015 00:06:10 -0400 Received: from mail-pd0-f173.google.com ([209.85.192.173]:34322 "EHLO mail-pd0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750828AbbFAEGI (ORCPT ); Mon, 1 Jun 2015 00:06:08 -0400 Received: by pdbki1 with SMTP id ki1so97963690pdb.1; Sun, 31 May 2015 21:06:08 -0700 (PDT) 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=Lb5xhC7VF9OGgf1RzcxHKSQ2v3pxzPHPBFEp5gRfIss=; b=0XfSa5NUpnqDyz6goY7cEZXW3UASUkYiCGrJ6Z1fxKYbkIriIheLywZt5KtdMDRLqk xEu1sXutnI0KJTqffpNQkMwr15Pw4h9eC9utplNooPIw+XnAeCWbD7XKkH1y/RCZBlv8 Tj4Ibo/3XVbMcnbo3JHV45J8uN3nKvptwVVd1lwH6+GhZRhLuy8lcAumifxc9UnXdXsQ R7k+vwx1h99LXKp7fsARAsXlOsGEidjq86/zYjKcTzDMWFrdIIdHWCydZnEZaMN4aG2E nzizrhImbCrAkqamgSYXc7ga9dvMFgI9GwPpz8Hm1JHtba/P8CZa0H513QDO3zY/xJeZ Z9pA== X-Received: by 10.70.38.10 with SMTP id c10mr36576184pdk.72.1433131568218; Sun, 31 May 2015 21:06:08 -0700 (PDT) Received: from vaishali-Ideapad-Z570 ([43.249.235.159]) by mx.google.com with ESMTPSA id j10sm12685155pdk.48.2015.05.31.21.06.05 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 31 May 2015 21:06:06 -0700 (PDT) Date: Mon, 1 Jun 2015 09:36:02 +0530 From: Vaishali Thakkar To: Sebastian Hesselbarth Cc: Julia Lawall , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] net: mv643xx_eth: Use setup_timer Message-ID: <20150601040602.GA3767@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 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 --- 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);