From patchwork Thu Oct 5 00:48:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 9986069 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 2198760291 for ; Thu, 5 Oct 2017 00:48:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1342B28BCA for ; Thu, 5 Oct 2017 00:48:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 07BA828C45; Thu, 5 Oct 2017 00:48:42 +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 83E6528BCA for ; Thu, 5 Oct 2017 00:48:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752000AbdJEAsb (ORCPT ); Wed, 4 Oct 2017 20:48:31 -0400 Received: from mail-pf0-f176.google.com ([209.85.192.176]:54361 "EHLO mail-pf0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751450AbdJEAs3 (ORCPT ); Wed, 4 Oct 2017 20:48:29 -0400 Received: by mail-pf0-f176.google.com with SMTP id m28so2187255pfi.11 for ; Wed, 04 Oct 2017 17:48:28 -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=kKUaiL5jmPsYU3iGqRP/uIVPc8xLWxjteaeLbDpLaIQ=; b=iyIQwLShMir3/heOwRKI2aXxwlVMsVD8ZmaO/09oGxrPSrCwIMInVEfuL+exKdA/H8 9mwHacCsB1zNM1ds7RYLFHVOzRe7DTUqV+xaUL2SB07BpVbOJ+FmIbjuo0iwfx3B8B/9 3Ia4qG8J0uxVehAFOyPL/l28o2uR1wyKpWZNY= 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=kKUaiL5jmPsYU3iGqRP/uIVPc8xLWxjteaeLbDpLaIQ=; b=aPaBleIlHepFE+JD7V0KyAmXZvlQPOpoALmEBcX/hwN9VodCRfw1ZSf5Qe8SeIAOBk UqbdHevwXXSY9MfoStmwtT8RbqD4pduRtE5m1U60SEJcJLT9gMoItRDTzY1OUtVeLReU ZeZuGU1MLWQ83Ma3W/9T8HC+vo0d4+Fr+UVCnWkrWM4bGfqOV4OiCep5u/Ru/DJ5SVlP Y4j64XzfvKZV6mgw1DyKAdRhS8umaLxoJtT40MEgoNhCQ2inZHvc4zpNfnjOTLnR2LC4 cFO/9LqVzmvA3ziL/VV1oV/AHkxy3fFpE/pqzA7+1AswF74Kn+1Tds/xLymUL4ZMsAiP +RQw== X-Gm-Message-State: AHPjjUjmqhdt6SwhTaTR6Jtzqy1Qa0CqondBalH7LGus3CY/fz5CQPsX 6AnOtbsKMhLhCbkz32oEBHKO8g== X-Google-Smtp-Source: AOwi7QBPA4NM6MP+rJSo0epeGnuJDIDSimhDd/ZeTqZ66IhdsDlcynWuOegBFV/P91MsXF7MredICw== X-Received: by 10.99.174.78 with SMTP id e14mr19521977pgp.155.1507164508582; Wed, 04 Oct 2017 17:48:28 -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 g68sm26915716pfc.64.2017.10.04.17.48.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Oct 2017 17:48:27 -0700 (PDT) Date: Wed, 4 Oct 2017 17:48:26 -0700 From: Kees Cook To: linux-kernel@vger.kernel.org Cc: QLogic-Storage-Upstream@qlogic.com, "James E.J. Bottomley" , "Martin K. Petersen" , Johannes Thumshirn , linux-scsi@vger.kernel.org, fcoe-devel@open-fcoe.org, Thomas Gleixner Subject: [PATCH] scsi: fcoe: Convert timers to use timer_setup() Message-ID: <20171005004826.GA22983@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: QLogic-Storage-Upstream@qlogic.com Cc: "James E.J. Bottomley" Cc: "Martin K. Petersen" Cc: Johannes Thumshirn Cc: linux-scsi@vger.kernel.org Cc: fcoe-devel@open-fcoe.org Cc: Thomas Gleixner Signed-off-by: Kees Cook Acked-by: Johannes Thumshirn --- This requires commit 686fef928bba ("timer: Prepare to change timer callback argument type") in v4.14-rc3, but should be otherwise stand-alone. --- drivers/scsi/bnx2fc/bnx2fc_fcoe.c | 11 +++++------ drivers/scsi/fcoe/fcoe.c | 2 +- drivers/scsi/fcoe/fcoe_transport.c | 6 ++++-- include/scsi/libfcoe.h | 2 +- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c index 6844ba361616..e6b9de7d41ac 100644 --- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c +++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c @@ -823,7 +823,7 @@ static int bnx2fc_net_config(struct fc_lport *lport, struct net_device *netdev) skb_queue_head_init(&port->fcoe_pending_queue); port->fcoe_pending_queue_active = 0; - setup_timer(&port->timer, fcoe_queue_timer, (unsigned long) lport); + timer_setup(&port->timer, fcoe_queue_timer, 0); fcoe_link_speed_update(lport); @@ -845,9 +845,9 @@ static int bnx2fc_net_config(struct fc_lport *lport, struct net_device *netdev) return 0; } -static void bnx2fc_destroy_timer(unsigned long data) +static void bnx2fc_destroy_timer(struct timer_list *t) { - struct bnx2fc_hba *hba = (struct bnx2fc_hba *)data; + struct bnx2fc_hba *hba = from_timer(hba, t, destroy_timer); printk(KERN_ERR PFX "ERROR:bnx2fc_destroy_timer - " "Destroy compl not received!!\n"); @@ -1946,11 +1946,10 @@ static void bnx2fc_fw_destroy(struct bnx2fc_hba *hba) { if (test_and_clear_bit(BNX2FC_FLAG_FW_INIT_DONE, &hba->flags)) { if (bnx2fc_send_fw_fcoe_destroy_msg(hba) == 0) { - init_timer(&hba->destroy_timer); + timer_setup(&hba->destroy_timer, bnx2fc_destroy_timer, + 0); hba->destroy_timer.expires = BNX2FC_FW_TIMEOUT + jiffies; - hba->destroy_timer.function = bnx2fc_destroy_timer; - hba->destroy_timer.data = (unsigned long)hba; add_timer(&hba->destroy_timer); wait_event_interruptible(hba->destroy_wait, test_bit(BNX2FC_FLAG_DESTROY_CMPL, diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c index 85f9a3eba387..5cc09dce4d25 100644 --- a/drivers/scsi/fcoe/fcoe.c +++ b/drivers/scsi/fcoe/fcoe.c @@ -754,7 +754,7 @@ static int fcoe_netdev_config(struct fc_lport *lport, struct net_device *netdev) skb_queue_head_init(&port->fcoe_pending_queue); port->fcoe_pending_queue_active = 0; - setup_timer(&port->timer, fcoe_queue_timer, (unsigned long)lport); + timer_setup(&port->timer, fcoe_queue_timer, 0); fcoe_link_speed_update(lport); diff --git a/drivers/scsi/fcoe/fcoe_transport.c b/drivers/scsi/fcoe/fcoe_transport.c index 375c536cbc68..1ba5f51713a3 100644 --- a/drivers/scsi/fcoe/fcoe_transport.c +++ b/drivers/scsi/fcoe/fcoe_transport.c @@ -455,9 +455,11 @@ EXPORT_SYMBOL_GPL(fcoe_check_wait_queue); * * Calls fcoe_check_wait_queue on timeout */ -void fcoe_queue_timer(ulong lport) +void fcoe_queue_timer(struct timer_list *t) { - fcoe_check_wait_queue((struct fc_lport *)lport, NULL); + struct fcoe_port *port = from_timer(port, t, timer); + + fcoe_check_wait_queue(port->lport, NULL); } EXPORT_SYMBOL_GPL(fcoe_queue_timer); diff --git a/include/scsi/libfcoe.h b/include/scsi/libfcoe.h index 722d3264d3bf..cb8a273732cf 100644 --- a/include/scsi/libfcoe.h +++ b/include/scsi/libfcoe.h @@ -382,7 +382,7 @@ static inline struct net_device *fcoe_get_netdev(const struct fc_lport *lport) void fcoe_clean_pending_queue(struct fc_lport *); void fcoe_check_wait_queue(struct fc_lport *lport, struct sk_buff *skb); -void fcoe_queue_timer(ulong lport); +void fcoe_queue_timer(struct timer_list *t); int fcoe_get_paged_crc_eof(struct sk_buff *skb, int tlen, struct fcoe_percpu_s *fps);