From patchwork Wed Oct 25 10:05:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 10026369 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 3E73860375 for ; Wed, 25 Oct 2017 10:09:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 36070283F9 for ; Wed, 25 Oct 2017 10:09:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2A5E828B35; Wed, 25 Oct 2017 10:09:16 +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.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_HI,RCVD_IN_SORBS_SPAM 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 CDFF1283F9 for ; Wed, 25 Oct 2017 10:09:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932332AbdJYKJN (ORCPT ); Wed, 25 Oct 2017 06:09:13 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:45156 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932409AbdJYKFu (ORCPT ); Wed, 25 Oct 2017 06:05:50 -0400 Received: by mail-pf0-f193.google.com with SMTP id d28so21869378pfe.2 for ; Wed, 25 Oct 2017 03:05:49 -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=8t3QBz4WaNt27lw8/vP3WdFOBrEJr2ufjyr/xVhG49E=; b=MAw3rhM4LSLfW7u0MdL7lyGdYSgyAO/wRDS2EXN/10EkGrWxFQq8nwJXJ0elCZoyWP YKzVN8y0GULm7JdjEQ8IiQlgbIzUiiO9adlzpyww5b+vtKuE1kp58DhemG2m6ST4hJxA 3D2YgC+JIyHNj8WudnXRt3lErrKRFaIVkzcQE= 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=8t3QBz4WaNt27lw8/vP3WdFOBrEJr2ufjyr/xVhG49E=; b=VibViE4UeVgtWkKRSEb5Ykw/7uX7bsvmb2iAF8wtmcKw0LuYcoFF5jygfpIdZ6N0Fl oY8cEhAeK8AMHYdEFC5uGR0Ol5ct8mDNyGDYowsk19AUpGaPQXsh9vw+Fsx20xuI0VYy SIV7Ny0DE9UxFAsWo1Ol/uR5vLi5aJoR83z4BDlM8X0jZsjzGxoqXPH6oI1wW7khZlYJ YuYdIGuPEUnLdKW/NWPAxtDOmHWaOnskelCXZ2rT2Vbxe64DZeTm7lbnVyH5b7gcarxe V8Ayv9urOoArNzk6qu3cNMFUMEmH2DTC5QaPuIYrLxc6QLaOQGfLdEc6Xu5rUX6IAF8j biMA== X-Gm-Message-State: AMCzsaXO8ct+SzlRCD8JfXKFYK6/jkehJSEL0nyJIwDh/Q7sO7n2AmUW U07thvWy9sjcreMYFuFAYJqADA== X-Google-Smtp-Source: ABhQp+TN842zstg0ZQyOVGKGjrOf9tVVFv1BA7gcB4z1vneUSO3KbjTewh7i4cUVStQJO8RcOFSAsw== X-Received: by 10.98.64.75 with SMTP id n72mr1660368pfa.317.1508925949098; Wed, 25 Oct 2017 03:05:49 -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 f1sm5183410pfe.150.2017.10.25.03.05.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Oct 2017 03:05:48 -0700 (PDT) Date: Wed, 25 Oct 2017 03:05:47 -0700 From: Kees Cook To: "Martin K. Petersen" Cc: Karen Xie , "James E.J. Bottomley" , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] scsi: cxgbi: Convert timers to use timer_setup() Message-ID: <20171025100547.GA144998@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 Signed-off-by: Kees Cook Reviewed-by: Martin K. Petersen --- 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 30d5f0ef29bb..266eddf17a99 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 858e32e8ad2d..ce1336414e0a 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;