From patchwork Sun Mar 1 19:46:37 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vaishali Thakkar X-Patchwork-Id: 5909231 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id AB411BF440 for ; Sun, 1 Mar 2015 19:46:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5071F2026D for ; Sun, 1 Mar 2015 19:46:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3D61F20270 for ; Sun, 1 Mar 2015 19:46:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751777AbbCATqp (ORCPT ); Sun, 1 Mar 2015 14:46:45 -0500 Received: from mail-pd0-f176.google.com ([209.85.192.176]:42993 "EHLO mail-pd0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751202AbbCATqo (ORCPT ); Sun, 1 Mar 2015 14:46:44 -0500 Received: by pdbfl12 with SMTP id fl12so2897250pdb.9 for ; Sun, 01 Mar 2015 11:46:44 -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=vXupsR6IUrlue1nROOGWWg6wb0WnmLvQ7eAsoiZffoU=; b=laH//gLc760RwpigkxGm+JYuN8vdfFHBnXLRLguK/ZTy6KlIShtJw6Esl4a6sBNMn5 Li1DV+JDNIoVrCxFncJwKIuwHRJoDEoge1n9kJjl/8yR+zT8j5m3U9kja/W4cOIZahbW lWASHZoNmdHdE8TtxPLmhN1+ytkzEdhPF3oPSR+NFYjS1i1kJvuEXUoHfThROxyc6wn8 M3kDllQ/ZdIiV+v7JttctgIW+J1VXH/pfw1FYSbsdtzTNItlW+AtWKpQIxnv/cclPI5G chLgs5JpxweQH6LF2sGckwWmWCMuRcaVRYB+bOqXMTrec3AcSr3Xxl1SqQgUAAyE9jub X7Pg== X-Received: by 10.68.235.74 with SMTP id uk10mr41366401pbc.33.1425239204462; Sun, 01 Mar 2015 11:46:44 -0800 (PST) Received: from vaishali-Ideapad-Z570 ([27.116.51.179]) by mx.google.com with ESMTPSA id sg4sm9902345pac.11.2015.03.01.11.46.42 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 01 Mar 2015 11:46:43 -0800 (PST) Date: Mon, 2 Mar 2015 01:16:37 +0530 From: Vaishali Thakkar To: Al Viro Cc: Mike Marciniszyn , Roland Dreier , Sean Hefty , Hal Rosenstock , linux-rdma@vger.kernel.org Subject: [PATCH] IB/ipatch: Use setup_timer and mod_timer Message-ID: <20150301194637.GA3441@vaishali-Ideapad-Z570> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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/infiniband/hw/ipath/ipath_driver.c | 9 +++------ drivers/infiniband/hw/ipath/ipath_init_chip.c | 10 +++------- drivers/infiniband/hw/ipath/ipath_verbs.c | 7 ++----- 3 files changed, 8 insertions(+), 18 deletions(-) diff --git a/drivers/infiniband/hw/ipath/ipath_driver.c b/drivers/infiniband/hw/ipath/ipath_driver.c index bd0caed..3854a37 100644 --- a/drivers/infiniband/hw/ipath/ipath_driver.c +++ b/drivers/infiniband/hw/ipath/ipath_driver.c @@ -2300,12 +2300,9 @@ void ipath_set_led_override(struct ipath_devdata *dd, unsigned int val) */ if (atomic_inc_return(&dd->ipath_led_override_timer_active) == 1) { /* Need to start timer */ - init_timer(&dd->ipath_led_override_timer); - dd->ipath_led_override_timer.function = - ipath_run_led_override; - dd->ipath_led_override_timer.data = (unsigned long) dd; - dd->ipath_led_override_timer.expires = jiffies + 1; - add_timer(&dd->ipath_led_override_timer); + setup_timer(&dd->ipath_led_override_timer, + ipath_run_led_override, (unsigned long)dd); + mod_timer(&dd->ipath_led_override_timer, jiffies + 1); } else atomic_dec(&dd->ipath_led_override_timer_active); } diff --git a/drivers/infiniband/hw/ipath/ipath_init_chip.c b/drivers/infiniband/hw/ipath/ipath_init_chip.c index be2a60e..34ffb43 100644 --- a/drivers/infiniband/hw/ipath/ipath_init_chip.c +++ b/drivers/infiniband/hw/ipath/ipath_init_chip.c @@ -950,13 +950,9 @@ int ipath_init_chip(struct ipath_devdata *dd, int reinit) * set up stats retrieval timer, even if we had errors * in last portion of setup */ - init_timer(&dd->ipath_stats_timer); - dd->ipath_stats_timer.function = ipath_get_faststats; - dd->ipath_stats_timer.data = (unsigned long) dd; - /* every 5 seconds; */ - dd->ipath_stats_timer.expires = jiffies + 5 * HZ; - /* takes ~16 seconds to overflow at full IB 4x bandwdith */ - add_timer(&dd->ipath_stats_timer); + setup_timer(&dd->ipath_stats_timer, ipath_get_faststats, + (unsigned long)dd); + mod_timer(&dd->ipath_stats_timer, jiffies + 5 * HZ); dd->ipath_stats_timer_active = 1; } diff --git a/drivers/infiniband/hw/ipath/ipath_verbs.c b/drivers/infiniband/hw/ipath/ipath_verbs.c index 44ea939..41929ea 100644 --- a/drivers/infiniband/hw/ipath/ipath_verbs.c +++ b/drivers/infiniband/hw/ipath/ipath_verbs.c @@ -1952,11 +1952,8 @@ static int enable_timer(struct ipath_devdata *dd) dd->ipath_gpio_mask); } - init_timer(&dd->verbs_timer); - dd->verbs_timer.function = __verbs_timer; - dd->verbs_timer.data = (unsigned long)dd; - dd->verbs_timer.expires = jiffies + 1; - add_timer(&dd->verbs_timer); + setup_timer(&dd->verbs_timer, __verbs_timer, (unsigned long)dd); + mod_timer(&dd->verbs_timer, jiffies + 1); return 0; }