From patchwork Thu Oct 5 00:45:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 9986033 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 22E0160291 for ; Thu, 5 Oct 2017 00:46:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1358828BCA for ; Thu, 5 Oct 2017 00:46:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 081D828C3F; Thu, 5 Oct 2017 00:46:29 +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 7B55528BCA for ; Thu, 5 Oct 2017 00:46:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751339AbdJEAp7 (ORCPT ); Wed, 4 Oct 2017 20:45:59 -0400 Received: from mail-pf0-f177.google.com ([209.85.192.177]:45100 "EHLO mail-pf0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751336AbdJEAp5 (ORCPT ); Wed, 4 Oct 2017 20:45:57 -0400 Received: by mail-pf0-f177.google.com with SMTP id z84so7123579pfi.2 for ; Wed, 04 Oct 2017 17:45:57 -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=WyCRKpaXjJKAXcXrYQI+txGMcTb9PRriaLPtf+Oi3eU=; b=jxrbwHY8vh31EEFZNz7hZ7rgd97OPHE1bBb3B2t1mYg2131YVzxOrbCZjiIUk4QvVw QqaS8dzJXyfgH/zsIZdTMus51KMLF7VMHjWolHVgnKNGzZtZ2t1439YXHDnO7y1mvL18 HZRKOmATZLfNx7kjRQMg+OYPmj++mPppoFAeQ= 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=WyCRKpaXjJKAXcXrYQI+txGMcTb9PRriaLPtf+Oi3eU=; b=uATiu4QOWP3zLcPg4PE8Mk3LLRxKZFeB237rMSMlQ1LyF9HspnLz1REGP/uj8hxFzV JrP49twbeNf+Oct7b7IR2Epg6MfQhA3KRN5S3YDhU9LfF9kwvjtvNp9TOJoAmZ/FkEbv GFJ1bkw9Dcr8VBLO28O1KZo0p0ofgUv1XYklqoDqY5EXgB5GE1Uh3ALD2LhsQWLoGMFv 9QJvUs0CEKr1xkeEB4JRvdTq3pB+jlzO22oyjvFeHTwJWrngStWxLrlNeFAQxR9whMvB 5zqV5CKYmDtxOwpQ+Vw8OuajQLWOQdUK/tYH7M3oPz4m/XJoeORdfLKaNDUsNm3qdo0V Rzfw== X-Gm-Message-State: AMCzsaViJqoRVAkZUQfiHiO5uHzqHNxN/cKtDFqfvf4R1tjCwLPGgvKV pVp8kopOgJt+HZOxoxjXxYY21A== X-Google-Smtp-Source: AOwi7QDfvDW6HoQyHWMlhl/q2PhTBSoMk13qt/LtzndMgPVpeoXLCndAzurfkOxUQquELZP2ViGklw== X-Received: by 10.98.211.203 with SMTP id z72mr3642320pfk.328.1507164356777; Wed, 04 Oct 2017 17:45:56 -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 e4sm19101906pfa.80.2017.10.04.17.45.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Oct 2017 17:45:55 -0700 (PDT) Date: Wed, 4 Oct 2017 17:45:54 -0700 From: Kees Cook To: linux-kernel@vger.kernel.org Cc: Doug Ledford , Sean Hefty , Hal Rosenstock , Leon Romanovsky , Alex Vesker , Erez Shitrit , Ira Weiny , Dasaratharaman Chandramouli , Zhu Yanjun , "kernel@kyup.com" , Kees Cook , Paolo Abeni , Niranjana Vishwanathapura , Feras Daoud , Alex Estrin , Shamir Rabinovitch , linux-rdma@vger.kernel.org, Yuval Shaia , Thomas Gleixner Subject: [PATCH] IB/ipoib: Convert timers to use timer_setup() Message-ID: <20171005004554.GA22669@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: Doug Ledford Cc: Sean Hefty Cc: Hal Rosenstock Cc: Leon Romanovsky Cc: Alex Vesker Cc: Erez Shitrit Cc: Zhu Yanjun Cc: Dasaratharaman Chandramouli Cc: Paolo Abeni Cc: Ira Weiny Cc: Yuval Shaia Cc: linux-rdma@vger.kernel.org Cc: Thomas Gleixner Signed-off-by: Kees Cook Reviewed-by: Leon Romanovsky --- This requires commit 686fef928bba ("timer: Prepare to change timer callback argument type") in v4.14-rc3, but should be otherwise stand-alone. --- drivers/infiniband/ulp/ipoib/ipoib.h | 2 +- drivers/infiniband/ulp/ipoib/ipoib_ib.c | 6 ++++-- drivers/infiniband/ulp/ipoib/ipoib_main.c | 3 +-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/infiniband/ulp/ipoib/ipoib.h b/drivers/infiniband/ulp/ipoib/ipoib.h index 4a5c7a07a631..7cc2b755413d 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib.h +++ b/drivers/infiniband/ulp/ipoib/ipoib.h @@ -500,7 +500,7 @@ void ipoib_mark_paths_invalid(struct net_device *dev); void ipoib_flush_paths(struct net_device *dev); struct ipoib_dev_priv *ipoib_intf_alloc(struct ib_device *hca, u8 port, const char *format); -void ipoib_ib_tx_timer_func(unsigned long ctx); +void ipoib_ib_tx_timer_func(struct timer_list *t); void ipoib_ib_dev_flush_light(struct work_struct *work); void ipoib_ib_dev_flush_normal(struct work_struct *work); void ipoib_ib_dev_flush_heavy(struct work_struct *work); diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c index 6cd61638b441..918930a0bc70 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c @@ -821,9 +821,11 @@ int ipoib_ib_dev_stop(struct net_device *dev) return 0; } -void ipoib_ib_tx_timer_func(unsigned long ctx) +void ipoib_ib_tx_timer_func(struct timer_list *t) { - drain_tx_cq((struct net_device *)ctx); + struct ipoib_dev_priv *priv = from_timer(priv, t, poll_timer); + + drain_tx_cq(priv->dev); } int ipoib_ib_dev_open_default(struct net_device *dev) diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c index dcc77014018d..77c1b7adbb40 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c @@ -1666,8 +1666,7 @@ static int ipoib_dev_init_default(struct net_device *dev) priv->dev->dev_addr[2] = (priv->qp->qp_num >> 8) & 0xff; priv->dev->dev_addr[3] = (priv->qp->qp_num) & 0xff; - setup_timer(&priv->poll_timer, ipoib_ib_tx_timer_func, - (unsigned long)dev); + timer_setup(&priv->poll_timer, ipoib_ib_tx_timer_func, 0); return 0;