From patchwork Thu Oct 5 00:45:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 9986035 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0216B60291 for ; Thu, 5 Oct 2017 00:46:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E4F5B28BCA for ; Thu, 5 Oct 2017 00:46:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D9D1228C3F; Thu, 5 Oct 2017 00:46:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7D0A328BCA for ; Thu, 5 Oct 2017 00:46:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751296AbdJEApr (ORCPT ); Wed, 4 Oct 2017 20:45:47 -0400 Received: from mail-pf0-f175.google.com ([209.85.192.175]:56813 "EHLO mail-pf0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751294AbdJEApo (ORCPT ); Wed, 4 Oct 2017 20:45:44 -0400 Received: by mail-pf0-f175.google.com with SMTP id g65so7110952pfe.13 for ; Wed, 04 Oct 2017 17:45:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:mime-version:content-disposition; bh=h42ngQTUPWfdsHyOEeWmvBnNOLfmk3i7Em33XMy3kpo=; b=RjoQ5JE7wMTAQU8K5XPnfP2iMeY5Tf3w0uxTEWqxWBSJWrEC8/pNzepMYweN0DHSkJ 8o5dX3k2oM+42HrFWKzl8IC8r1CsrX9zJU8h7KEQkjNM71PBnquoj6UIpHDCHMqc1cfn H/Dv185gndFWpN+1kuo76Oxx/hwmKfVCx4ngc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=h42ngQTUPWfdsHyOEeWmvBnNOLfmk3i7Em33XMy3kpo=; b=H6JIHHDb0rwJ14UK6wrcbM3xlK14hEHCszAyR6kckF+K3RAXrtruVU6iH0fOy+uBCK 0Fz8vya25NYITbQNF4K0CcmyHUVU+QS7z67nrVc4qY2zMl7DTv1rtG8RgG34UEN+oUqx 2Spvg7ONI9LDKahP1SxJPXrkBOKpHO7g7Twoe5+29TsfgLZyEV4r5b5On6S1XHMvBZyU akmaIkOfaue0XXYET8y4CiEKCYJI5LyJbL0FkbYWQNva++m/TgXkZzXAF3fCyvJaqglE GjquqRUqWWZ1CQo43FUe7uRmHQCl20Jm0ZAhYzIXZfkt+Ivsq3WdbDun4QlfeSP8jGtU UbWw== X-Gm-Message-State: AHPjjUhU537JCDwIAEk1vddXTilFSsisWr1O6Y+3jhF/gP3FMmE5VhUy ID61c667pqwS35nm8caON3tYjg== X-Google-Smtp-Source: AOwi7QAuKcWMrSTNKw0wkDiqeOHKn6ktv1TWk+HN/7Yq9K2BHwO7wBAPj2acuQp0dNTuRIv5FB6cZw== X-Received: by 10.98.29.74 with SMTP id d71mr22137001pfd.141.1507164343672; Wed, 04 Oct 2017 17:45:43 -0700 (PDT) Received: from www.outflux.net (173-164-112-133-Oregon.hfc.comcastbusiness.net. [173.164.112.133]) by smtp.gmail.com with ESMTPSA id d13sm25583346pgn.53.2017.10.04.17.45.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Oct 2017 17:45:42 -0700 (PDT) Date: Wed, 4 Oct 2017 17:45:41 -0700 From: Kees Cook To: linux-kernel@vger.kernel.org Cc: Faisal Latif , Shiraz Saleem , Doug Ledford , Sean Hefty , Hal Rosenstock , linux-rdma@vger.kernel.org, Thomas Gleixner Subject: [PATCH] RDMA/i40iw: Convert timers to use timer_setup() Message-ID: <20171005004541.GA22645@beast> MIME-Version: 1.0 Content-Disposition: inline Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly. Cc: Faisal Latif Cc: Shiraz Saleem Cc: Doug Ledford Cc: Sean Hefty Cc: Hal Rosenstock Cc: linux-rdma@vger.kernel.org Cc: Thomas Gleixner Signed-off-by: Kees Cook Acked-by: Shiraz Saleem --- This requires commit 686fef928bba ("timer: Prepare to change timer callback argument type") in v4.14-rc3, but should be otherwise stand-alone. --- drivers/infiniband/hw/i40iw/i40iw_ctrl.c | 1 + drivers/infiniband/hw/i40iw/i40iw_type.h | 1 + drivers/infiniband/hw/i40iw/i40iw_utils.c | 10 +++++----- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/infiniband/hw/i40iw/i40iw_ctrl.c b/drivers/infiniband/hw/i40iw/i40iw_ctrl.c index d1f5345f04f0..2d076cf946e0 100644 --- a/drivers/infiniband/hw/i40iw/i40iw_ctrl.c +++ b/drivers/infiniband/hw/i40iw/i40iw_ctrl.c @@ -4873,6 +4873,7 @@ enum i40iw_status_code i40iw_vsi_stats_init(struct i40iw_sc_vsi *vsi, struct i40 vsi->pestat = info->pestat; vsi->pestat->hw = vsi->dev->hw; + vsi->pestat->vsi = vsi; if (info->stats_initialize) { i40iw_hw_stats_init(vsi->pestat, fcn_id, true); diff --git a/drivers/infiniband/hw/i40iw/i40iw_type.h b/drivers/infiniband/hw/i40iw/i40iw_type.h index 63118f6d5ab4..7798e8e2f9bd 100644 --- a/drivers/infiniband/hw/i40iw/i40iw_type.h +++ b/drivers/infiniband/hw/i40iw/i40iw_type.h @@ -250,6 +250,7 @@ struct i40iw_vsi_pestat { struct i40iw_dev_hw_stats last_read_hw_stats; struct i40iw_dev_hw_stats_offsets hw_stats_offsets; struct timer_list stats_timer; + struct i40iw_sc_vsi *vsi; spinlock_t lock; /* rdma stats lock */ }; diff --git a/drivers/infiniband/hw/i40iw/i40iw_utils.c b/drivers/infiniband/hw/i40iw/i40iw_utils.c index e52dbbb4165e..f6c76595e834 100644 --- a/drivers/infiniband/hw/i40iw/i40iw_utils.c +++ b/drivers/infiniband/hw/i40iw/i40iw_utils.c @@ -1445,11 +1445,12 @@ enum i40iw_status_code i40iw_puda_get_tcpip_info(struct i40iw_puda_completion_in * i40iw_hw_stats_timeout - Stats timer-handler which updates all HW stats * @vsi: pointer to the vsi structure */ -static void i40iw_hw_stats_timeout(unsigned long vsi) +static void i40iw_hw_stats_timeout(struct timer_list *t) { - struct i40iw_sc_vsi *sc_vsi = (struct i40iw_sc_vsi *)vsi; + struct i40iw_vsi_pestat *pf_devstat = from_timer(pf_devstat, t, + stats_timer); + struct i40iw_sc_vsi *sc_vsi = pf_devstat->vsi; struct i40iw_sc_dev *pf_dev = sc_vsi->dev; - struct i40iw_vsi_pestat *pf_devstat = sc_vsi->pestat; struct i40iw_vsi_pestat *vf_devstat = NULL; u16 iw_vf_idx; unsigned long flags; @@ -1480,8 +1481,7 @@ void i40iw_hw_stats_start_timer(struct i40iw_sc_vsi *vsi) { struct i40iw_vsi_pestat *devstat = vsi->pestat; - setup_timer(&devstat->stats_timer, i40iw_hw_stats_timeout, - (unsigned long)vsi); + timer_setup(&devstat->stats_timer, i40iw_hw_stats_timeout, 0); mod_timer(&devstat->stats_timer, jiffies + msecs_to_jiffies(STATS_TIMER_DELAY)); }