From patchwork Tue Oct 17 18:37: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: 10012749 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 1B57860235 for ; Tue, 17 Oct 2017 18:38:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0F3BA289B0 for ; Tue, 17 Oct 2017 18:38:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 030EC289DF; Tue, 17 Oct 2017 18:38:01 +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=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 6F08F289B0 for ; Tue, 17 Oct 2017 18:38:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758182AbdJQSh7 (ORCPT ); Tue, 17 Oct 2017 14:37:59 -0400 Received: from mail-pg0-f50.google.com ([74.125.83.50]:43681 "EHLO mail-pg0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758092AbdJQSh6 (ORCPT ); Tue, 17 Oct 2017 14:37:58 -0400 Received: by mail-pg0-f50.google.com with SMTP id s75so2113378pgs.0 for ; Tue, 17 Oct 2017 11:37:58 -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=pUFKu6OQ3JIv+hQ9ENyHhBm5vKeKWmPriWLXq4GfEbk=; b=mykW2dS1yN6Frn/QKHFSVf18/KVDyPiJFb3WNXmxiqWwTgsKmYlmxWGxYRi8uDg6r7 xdEkuJAYrT4FSOPzl66mLB1L/lM/Zn3EDn+GDO8g5H/fVrpviHYhN1+edRYrHnORsNUk lUquxaK3j2BOD/sLyZfslrtt/eFWo8/0tQZbY= 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=pUFKu6OQ3JIv+hQ9ENyHhBm5vKeKWmPriWLXq4GfEbk=; b=q8Dg2nmiCbewxzATTWCLpv30QgWX+W5QtNu2pfKQj3NnmNTd9QK37E33GaN9cSZ3l4 fWisf4ueDEHoKURG1M7XlYRAhrOsNs2tYilvwV/flU5sXVJgYYfbd5Cj0XIIZ5cMkjcv Zg2YfF8RpkPNp41OMflPE7ns+wA7COAHykCeeKComprdW2U0rZFU6IVedozXjR6hREpR WcJWcme4lCfnPPaLscoDGTAaKdcE0GgQoGuSXcrw8nyV00qMmw/DL+dNJyGxBFZ5C7Th J6KMuKMtdXsZbeT9LdNyYeB7kXOJdQD3g87Kh1PhDfOcjx5sXRSmblfWD54omZ7rgarB g3VQ== X-Gm-Message-State: AMCzsaW4wB5EtQe3pQXWJgBBeWbQkTHAVZydW41OEtJg8IIijmpjbMAj ZyznFQ0vOsITRUdiuC9YWfhAZw== X-Google-Smtp-Source: AOwi7QAWUF5d5i6koTv5aMcVFgmV/q/qJpQfdw6v9dVbeRycha3Jp0bZpi/9lpVo65mqx6syFEnBjQ== X-Received: by 10.159.207.139 with SMTP id z11mr12589915plo.335.1508265478169; Tue, 17 Oct 2017 11:37:58 -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 p90sm19698418pfj.157.2017.10.17.11.37.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 17 Oct 2017 11:37:55 -0700 (PDT) Date: Tue, 17 Oct 2017 11:37:54 -0700 From: Kees Cook To: Shiraz Saleem , Doug Ledford Cc: Faisal Latif , Sean Hefty , Hal Rosenstock , linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org Subject: [PATCH] RDMA/i40iw: Convert timers to use timer_setup() (part 2) Message-ID: <20171017183754.GA108519@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. This includes the remaining timers missed in the earlier i40iw patch. Cc: Faisal Latif Cc: Shiraz Saleem Cc: Doug Ledford Cc: Sean Hefty Cc: Hal Rosenstock Cc: linux-rdma@vger.kernel.org Signed-off-by: Kees Cook Acked-by: Shiraz Saleem --- drivers/infiniband/hw/i40iw/i40iw_cm.c | 7 +++---- drivers/infiniband/hw/i40iw/i40iw_utils.c | 7 +++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/infiniband/hw/i40iw/i40iw_cm.c b/drivers/infiniband/hw/i40iw/i40iw_cm.c index 50c43766defd..789d925df227 100644 --- a/drivers/infiniband/hw/i40iw/i40iw_cm.c +++ b/drivers/infiniband/hw/i40iw/i40iw_cm.c @@ -1188,7 +1188,7 @@ static void i40iw_handle_close_entry(struct i40iw_cm_node *cm_node, u32 rem_node * i40iw_cm_timer_tick - system's timer expired callback * @pass: Pointing to cm_core */ -static void i40iw_cm_timer_tick(unsigned long pass) +static void i40iw_cm_timer_tick(struct timer_list *t) { unsigned long nexttimeout = jiffies + I40IW_LONG_TIME; struct i40iw_cm_node *cm_node; @@ -1196,7 +1196,7 @@ static void i40iw_cm_timer_tick(unsigned long pass) struct list_head *list_core_temp; struct i40iw_sc_vsi *vsi; struct list_head *list_node; - struct i40iw_cm_core *cm_core = (struct i40iw_cm_core *)pass; + struct i40iw_cm_core *cm_core = from_timer(cm_core, t, tcp_timer); u32 settimer = 0; unsigned long timetosend; struct i40iw_sc_dev *dev; @@ -3202,8 +3202,7 @@ void i40iw_setup_cm_core(struct i40iw_device *iwdev) INIT_LIST_HEAD(&cm_core->connected_nodes); INIT_LIST_HEAD(&cm_core->listen_nodes); - setup_timer(&cm_core->tcp_timer, i40iw_cm_timer_tick, - (unsigned long)cm_core); + timer_setup(&cm_core->tcp_timer, i40iw_cm_timer_tick, 0); spin_lock_init(&cm_core->ht_lock); spin_lock_init(&cm_core->listen_list_lock); diff --git a/drivers/infiniband/hw/i40iw/i40iw_utils.c b/drivers/infiniband/hw/i40iw/i40iw_utils.c index f6c76595e834..2ed31004b19c 100644 --- a/drivers/infiniband/hw/i40iw/i40iw_utils.c +++ b/drivers/infiniband/hw/i40iw/i40iw_utils.c @@ -870,9 +870,9 @@ void i40iw_terminate_done(struct i40iw_sc_qp *qp, int timeout_occurred) * i40iw_terminate_imeout - timeout happened * @context: points to iwarp qp */ -static void i40iw_terminate_timeout(unsigned long context) +static void i40iw_terminate_timeout(struct timer_list *t) { - struct i40iw_qp *iwqp = (struct i40iw_qp *)context; + struct i40iw_qp *iwqp = from_timer(iwqp, t, terminate_timer); struct i40iw_sc_qp *qp = (struct i40iw_sc_qp *)&iwqp->sc_qp; i40iw_terminate_done(qp, 1); @@ -889,8 +889,7 @@ void i40iw_terminate_start_timer(struct i40iw_sc_qp *qp) iwqp = (struct i40iw_qp *)qp->back_qp; i40iw_add_ref(&iwqp->ibqp); - setup_timer(&iwqp->terminate_timer, i40iw_terminate_timeout, - (unsigned long)iwqp); + timer_setup(&iwqp->terminate_timer, i40iw_terminate_timeout, 0); iwqp->terminate_timer.expires = jiffies + HZ; add_timer(&iwqp->terminate_timer); }