From patchwork Thu Oct 5 00:51: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: 9986131 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 C0C4A60291 for ; Thu, 5 Oct 2017 00:52:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B21B428C41 for ; Thu, 5 Oct 2017 00:52:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A702A28C44; Thu, 5 Oct 2017 00:52:02 +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.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham 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 2911F28C41 for ; Thu, 5 Oct 2017 00:52:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752696AbdJEAv7 (ORCPT ); Wed, 4 Oct 2017 20:51:59 -0400 Received: from mail-pf0-f178.google.com ([209.85.192.178]:53649 "EHLO mail-pf0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752705AbdJEAv5 (ORCPT ); Wed, 4 Oct 2017 20:51:57 -0400 Received: by mail-pf0-f178.google.com with SMTP id n73so452170pfg.10 for ; Wed, 04 Oct 2017 17:51:56 -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=MFzcUpk/nOq8jevkIhYC/Y4skJoVHKiA5c+hzSYXIiA=; b=NjyKlVz7HjaHSvuvp2cchBYuWo4Ga75yQ9g3IWHefUDyNXsmcbLNla01YFvmfaNzqO 1sjMsnMQIERr1xEu83LNymebbbhNcdRJUkqteRI6F3GmodW0AnsgZ4UqHMJsAJZAqMIF bs0meE0i08nuTqOXWMGp075EX1PysoCWAz5uU= 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=MFzcUpk/nOq8jevkIhYC/Y4skJoVHKiA5c+hzSYXIiA=; b=uSL2fMnzPHmRWXLtIfwp8gwTgUqW3ohYi+FhnMwSFML+u7b3kg/B+6E1K+Puej3irZ zErYZ8XFLKxn3Y6IQBiMPIyoPIUiBUUhMqtj5sV18eNEOus5ndiRYXw5Hg7Wrp1njbqm FVIyf31+nBqQ+XVNHQBGpaLnLkVgSLRzMS1JQMbnICdBPCmMMXNrG4wE9HnJrb9iwfws pWVJXAxHeTOgRVGVncbVjfjsBFVZL42xtk9ZU2V6gtk3LFn/Y5GoJsngzdqGNyW0BVoO hfCKK13eujWIO9Q+Nu1L6g53Ft+Bof8YOlz1kXWS570/WBUkn4bjUZW/IB2/lnqha8Jl anSw== X-Gm-Message-State: AMCzsaUt3HS3Gg5Pa02iHJu8uaOoJo5i6OgKSzot/C0FHFogUTfXxX3H ay0/hleqg2LoLULpFo2dKc0L3g== X-Google-Smtp-Source: AOwi7QD/Q2cbALYCln4Rvj41uOTvrcTvMMHfy1lCzCvjUtJrrorAs5QKFAdW+88Ix8opoBvZlpjhdg== X-Received: by 10.98.215.67 with SMTP id v3mr9336360pfl.39.1507164716428; Wed, 04 Oct 2017 17:51: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 g5sm28189467pfe.94.2017.10.04.17.51.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Oct 2017 17:51:55 -0700 (PDT) Date: Wed, 4 Oct 2017 17:51:54 -0700 From: Kees Cook To: linux-kernel@vger.kernel.org Cc: Tariq Toukan , netdev@vger.kernel.org, linux-rdma@vger.kernel.org, Thomas Gleixner Subject: [PATCH] net/mlx4_core: Convert timers to use timer_setup() Message-ID: <20171005005154.GA23500@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: Tariq Toukan Cc: netdev@vger.kernel.org Cc: linux-rdma@vger.kernel.org Cc: Thomas Gleixner Signed-off-by: Kees Cook --- This requires commit 686fef928bba ("timer: Prepare to change timer callback argument type") in v4.14-rc3, but should be otherwise stand-alone. --- drivers/net/ethernet/mellanox/mlx4/catas.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx4/catas.c b/drivers/net/ethernet/mellanox/mlx4/catas.c index 53daa6ca5d83..e2b6b0cac1ac 100644 --- a/drivers/net/ethernet/mellanox/mlx4/catas.c +++ b/drivers/net/ethernet/mellanox/mlx4/catas.c @@ -231,10 +231,10 @@ static void dump_err_buf(struct mlx4_dev *dev) i, swab32(readl(priv->catas_err.map + i))); } -static void poll_catas(unsigned long dev_ptr) +static void poll_catas(struct timer_list *t) { - struct mlx4_dev *dev = (struct mlx4_dev *) dev_ptr; - struct mlx4_priv *priv = mlx4_priv(dev); + struct mlx4_priv *priv = from_timer(priv, t, catas_err.timer); + struct mlx4_dev *dev = &priv->dev; u32 slave_read; if (mlx4_is_slave(dev)) { @@ -277,7 +277,7 @@ void mlx4_start_catas_poll(struct mlx4_dev *dev) phys_addr_t addr; INIT_LIST_HEAD(&priv->catas_err.list); - init_timer(&priv->catas_err.timer); + timer_setup(&priv->catas_err.timer, poll_catas, 0); priv->catas_err.map = NULL; if (!mlx4_is_slave(dev)) { @@ -293,8 +293,6 @@ void mlx4_start_catas_poll(struct mlx4_dev *dev) } } - priv->catas_err.timer.data = (unsigned long) dev; - priv->catas_err.timer.function = poll_catas; priv->catas_err.timer.expires = round_jiffies(jiffies + MLX4_CATAS_POLL_INTERVAL); add_timer(&priv->catas_err.timer);