From patchwork Thu Oct 5 00:48:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 9986263 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 6DFED605A8 for ; Thu, 5 Oct 2017 01:11:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5F8A628C21 for ; Thu, 5 Oct 2017 01:11:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 53C7E28C2E; Thu, 5 Oct 2017 01:11:07 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI 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 CDF8228C21 for ; Thu, 5 Oct 2017 01:11:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751892AbdJEAsI (ORCPT ); Wed, 4 Oct 2017 20:48:08 -0400 Received: from mail-pf0-f179.google.com ([209.85.192.179]:44252 "EHLO mail-pf0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751420AbdJEAsG (ORCPT ); Wed, 4 Oct 2017 20:48:06 -0400 Received: by mail-pf0-f179.google.com with SMTP id t62so5935249pfd.1 for ; Wed, 04 Oct 2017 17:48:05 -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=qoBtcfTQ4LfWwLEUB/b2RrgPVTJCRByBQXeWnQg7yR0=; b=LF0wGxi3W3xdGlmvKJtddEVGcwvh7OVoJXHBZL4y5wWPH86JK2iy8XPmifmwapwMdx A1SjUBionIJnKCX9j9Cwe/pG3FQZ2j8WidlspZ1oOjmwmMUChJVrJkMc1D6y/fyMwPLA 0pkoPG+5qEIRk9uPXxzw5HPI9BjjAVT+qod2Q= 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=qoBtcfTQ4LfWwLEUB/b2RrgPVTJCRByBQXeWnQg7yR0=; b=H2y7LXRq++xnWWZtDaSy3g8Kfa51aOK/qJdfJ5irrcptQiNUSAPB/q3bmqKIcRwIjw +45ywzT8gCEdD/VKfOHS7n3TdLiyHbKqrITRb/GnIt+tzBHC8CsqKXwwsGufFraXGbMY EAyqgtOy1VHCifcllwVqFh6eVTsrt6+1vc1sPVlLJ4TLhgQugdH63KcH2jM38VQNKpWI mJKVBW3jH6+GcHIxAQvCJxZlOzLJcvL94StXhHY3QhL8SJ8O68TTi5CtcQA6pZWwdjnM qQcIP2bYc2M6+eTizZ5L0LhqAYhFeMeSWT9T/aUHb8MJ+CAch+AcvDmASCYs7le+nQiD /DQA== X-Gm-Message-State: AMCzsaUASrP/mo8eylm+0bX2N1/pZ9W0WQ8rMrLNaE6jtWdeSRs05RzD 1u0opssM7A0awdG3gVl+anHP3w== X-Google-Smtp-Source: AOwi7QCD7oJOZIpkz4y1nOG8vTGx8PL3WCBDxLpYzO0b0xDnvJ5I0ZfVrKIcRCojY3IEGNcYO6sd9w== X-Received: by 10.98.97.7 with SMTP id v7mr6248203pfb.212.1507164485662; Wed, 04 Oct 2017 17:48:05 -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 v41sm22219995pgn.44.2017.10.04.17.48.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Oct 2017 17:48:04 -0700 (PDT) Date: Wed, 4 Oct 2017 17:48:03 -0700 From: Kees Cook To: linux-kernel@vger.kernel.org Cc: Karen Xie , "James E.J. Bottomley" , "Martin K. Petersen" , linux-scsi@vger.kernel.org, Thomas Gleixner Subject: [PATCH] scsi/cxgbi: Convert timers to use timer_setup() Message-ID: <20171005004803.GA22926@beast> MIME-Version: 1.0 Content-Disposition: inline Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@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: Karen Xie Cc: "James E.J. Bottomley" Cc: "Martin K. Petersen" Cc: linux-scsi@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/scsi/cxgbi/cxgb3i/cxgb3i.c | 8 ++++---- drivers/scsi/cxgbi/cxgb4i/cxgb4i.c | 8 ++++---- drivers/scsi/cxgbi/libcxgbi.c | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c b/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c index 7b09e7ddf35e..babd79361a46 100644 --- a/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c +++ b/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c @@ -545,10 +545,10 @@ static int act_open_rpl_status_to_errno(int status) } } -static void act_open_retry_timer(unsigned long data) +static void act_open_retry_timer(struct timer_list *t) { + struct cxgbi_sock *csk = from_timer(csk, t, retry_timer); struct sk_buff *skb; - struct cxgbi_sock *csk = (struct cxgbi_sock *)data; log_debug(1 << CXGBI_DBG_TOE | 1 << CXGBI_DBG_SOCK, "csk 0x%p,%u,0x%lx,%u.\n", @@ -586,8 +586,8 @@ static int do_act_open_rpl(struct t3cdev *tdev, struct sk_buff *skb, void *ctx) cxgbi_sock_get(csk); spin_lock_bh(&csk->lock); if (rpl->status == CPL_ERR_CONN_EXIST && - csk->retry_timer.function != act_open_retry_timer) { - csk->retry_timer.function = act_open_retry_timer; + csk->retry_timer.function != (TIMER_FUNC_TYPE)act_open_retry_timer) { + csk->retry_timer.function = (TIMER_FUNC_TYPE)act_open_retry_timer; mod_timer(&csk->retry_timer, jiffies + HZ / 2); } else cxgbi_sock_fail_act_open(csk, diff --git a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c index 1d02cf9fe06c..1bef2724eb78 100644 --- a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c +++ b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c @@ -872,10 +872,10 @@ static int act_open_rpl_status_to_errno(int status) } } -static void csk_act_open_retry_timer(unsigned long data) +static void csk_act_open_retry_timer(struct timer_list *t) { struct sk_buff *skb = NULL; - struct cxgbi_sock *csk = (struct cxgbi_sock *)data; + struct cxgbi_sock *csk = from_timer(csk, t, retry_timer); struct cxgb4_lld_info *lldi = cxgbi_cdev_priv(csk->cdev); void (*send_act_open_func)(struct cxgbi_sock *, struct sk_buff *, struct l2t_entry *); @@ -963,8 +963,8 @@ static void do_act_open_rpl(struct cxgbi_device *cdev, struct sk_buff *skb) spin_lock_bh(&csk->lock); if (status == CPL_ERR_CONN_EXIST && - csk->retry_timer.function != csk_act_open_retry_timer) { - csk->retry_timer.function = csk_act_open_retry_timer; + csk->retry_timer.function != (TIMER_FUNC_TYPE)csk_act_open_retry_timer) { + csk->retry_timer.function = (TIMER_FUNC_TYPE)csk_act_open_retry_timer; mod_timer(&csk->retry_timer, jiffies + HZ / 2); } else cxgbi_sock_fail_act_open(csk, diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c index 512c8f1ea5b0..a61a152136a3 100644 --- a/drivers/scsi/cxgbi/libcxgbi.c +++ b/drivers/scsi/cxgbi/libcxgbi.c @@ -572,7 +572,7 @@ static struct cxgbi_sock *cxgbi_sock_create(struct cxgbi_device *cdev) kref_init(&csk->refcnt); skb_queue_head_init(&csk->receive_queue); skb_queue_head_init(&csk->write_queue); - setup_timer(&csk->retry_timer, NULL, (unsigned long)csk); + timer_setup(&csk->retry_timer, NULL, 0); rwlock_init(&csk->callback_lock); csk->cdev = cdev; csk->flags = 0;