From patchwork Wed Mar 4 07:56:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vaishali Thakkar X-Patchwork-Id: 5932691 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 9628DBF440 for ; Wed, 4 Mar 2015 07:56:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A7E2F203C4 for ; Wed, 4 Mar 2015 07:56:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A5C3420411 for ; Wed, 4 Mar 2015 07:56:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933219AbbCDH40 (ORCPT ); Wed, 4 Mar 2015 02:56:26 -0500 Received: from mail-pd0-f177.google.com ([209.85.192.177]:34486 "EHLO mail-pd0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759900AbbCDH4T (ORCPT ); Wed, 4 Mar 2015 02:56:19 -0500 Received: by pdjg10 with SMTP id g10so55499564pdj.1 for ; Tue, 03 Mar 2015 23:56:19 -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=riTnyIgxGXduRku4boMmkbSJ7ifZmeJ9LewUzeKGau4=; b=ox4VcrkBqeq82OV2tViv8ysIstUwqkfyM6uzsjHyKB4kkeCgTGOtEisym3gWmvUuEk CDReusJtA4qlmfRKldQVrB7GsqZst7EpMK0CSTWNWUuLU6ONBBPDXVd2ubD48MUIB08u c5smN4Ckt/ilcx0P9pbeeU4xchYTp4tPqS6+nfoLoEkZx/woYdWXpXWaVIbjAR89SLmZ RLqbqXhTuS8cnhpjWi4u/dbZ+gf1wfaSTlWVQ0rn6dovoRdOBVAUVE49UMQZ8zoK8ZzS HCn1nK/XKNrVepx5l4NYBxAJbksZxH+DALRa8kXDmysbRMhDvZbSsFkT88eF051bsWss 05/w== X-Received: by 10.68.217.103 with SMTP id ox7mr4905138pbc.56.1425455779135; Tue, 03 Mar 2015 23:56:19 -0800 (PST) Received: from vaishali-Ideapad-Z570 ([103.241.45.140]) by mx.google.com with ESMTPSA id gg1sm3109567pbc.38.2015.03.03.23.56.17 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 03 Mar 2015 23:56:18 -0800 (PST) Date: Wed, 4 Mar 2015 13:26:14 +0530 From: Vaishali Thakkar To: Al Viro Cc: Mike Marciniszyn , Roland Dreier , Sean Hefty , Hal Rosenstock , linux-rdma@vger.kernel.org Subject: [PATCH v2] IB/ipatch: Use setup_timer and mod_timer Message-ID: <20150304075614.GA7854@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 --- Changes since v1: - Add useful comments which were removed in v1 drivers/infiniband/hw/ipath/ipath_driver.c | 9 +++------ drivers/infiniband/hw/ipath/ipath_init_chip.c | 8 +++----- drivers/infiniband/hw/ipath/ipath_verbs.c | 7 ++----- 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/drivers/infiniband/hw/ipath/ipath_driver.c b/drivers/infiniband/hw/ipath/ipath_driver.c index bd0caed..7c5968a 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..f59ca1b 100644 --- a/drivers/infiniband/hw/ipath/ipath_init_chip.c +++ b/drivers/infiniband/hw/ipath/ipath_init_chip.c @@ -950,13 +950,11 @@ 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; + setup_timer(&dd->ipath_stats_timer, ipath_get_faststats, + (unsigned long)dd); /* every 5 seconds; */ - dd->ipath_stats_timer.expires = jiffies + 5 * HZ; + mod_timer(&dd->ipath_stats_timer, jiffies + 5 * HZ); /* takes ~16 seconds to overflow at full IB 4x bandwdith */ - add_timer(&dd->ipath_stats_timer); 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; }