From patchwork Mon Oct 16 23:54:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 10010291 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 D88B0600CC for ; Mon, 16 Oct 2017 23:55:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C847528713 for ; Mon, 16 Oct 2017 23:55:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BB43728715; Mon, 16 Oct 2017 23:55:50 +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 41E3628713 for ; Mon, 16 Oct 2017 23:55:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757416AbdJPXyZ (ORCPT ); Mon, 16 Oct 2017 19:54:25 -0400 Received: from mail-pf0-f177.google.com ([209.85.192.177]:54353 "EHLO mail-pf0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757384AbdJPXyX (ORCPT ); Mon, 16 Oct 2017 19:54:23 -0400 Received: by mail-pf0-f177.google.com with SMTP id n89so9330975pfk.11 for ; Mon, 16 Oct 2017 16:54:23 -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=MzrEbBFc3V00JK4FIhfEvoyxRF0/O5So+dQ28MMVZpA=; b=YKXqxhQmNKnUxNNBrlah9get5IDMLGRPLaVUlRpLZ61MF+NIG1jnBv8CPww7chqnhC q6AUR36xEkj6Lw/u1dIybqQ6yKAA4bSNNKpakuKUAbLYvPavkJ4YK+rF2SDTs6ycec0m ezmBSZcToRiJDlxYi5eUvpyI30j7HtSLZ34rY= 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=MzrEbBFc3V00JK4FIhfEvoyxRF0/O5So+dQ28MMVZpA=; b=BoGWppUKwuJAZW0UGgUOIRwd7ELIqv+Uf0vTKkNSiz7HCPETG3DLHQ1r4r67077V48 M8QTOmvA4CKmrfa4z3mwrZFu2kMnk3QZw6/NLVL8gxqHXPSQZljcq/QHKwu7oMTY/5R2 Ic6iXhY43slquTSszLaKD7fX/cf/bfpAmBn3nIMbETNR1He6SFieKL8KSkUzbNRAH0vN ztVo09lSR00aO4B3SavPh+S6vT5Rtw79llOjCc1X7T4LJ6STsulr45LtQsmz8ZdKiTze 21rYvDtFKt5WzwEedyq/r4zauU0jIJ4SEt5KkF4oe+uwCmP6R6j1n0JKsUxA61MJN86K 8Xmg== X-Gm-Message-State: AMCzsaUpwqoRJVjmS8H02IJ8uEO7sL8vp7NOmZ5Dx1mjwiHNiNmyKe4w rXDx7YQws8CILwgB7fCuSMeB+w== X-Google-Smtp-Source: AOwi7QB8lX7gJxKe8u0HLjneQ6aj+ykiSIeK/nN/AEhdMWIwxYRsPV6Nn6NPP+n1UXMlJ0Yvmsrn4w== X-Received: by 10.84.235.69 with SMTP id g5mr10635542plt.239.1508198063071; Mon, 16 Oct 2017 16:54:23 -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 s71sm10239264pfa.147.2017.10.16.16.54.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Oct 2017 16:54:21 -0700 (PDT) Date: Mon, 16 Oct 2017 16:54:21 -0700 From: Kees Cook To: "Martin K. Petersen" Cc: Subbu Seetharaman , Ketan Mukadam , Jitendra Bhivare , "James E.J. Bottomley" , "Martin K. Petersen" , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] scsi: be2iscsi: Convert timers to use timer_setup() Message-ID: <20171016235421.GA102535@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: Subbu Seetharaman Cc: Ketan Mukadam Cc: Jitendra Bhivare 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/be2iscsi/be_main.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c index 7561e1332257..1013987db49b 100644 --- a/drivers/scsi/be2iscsi/be_main.c +++ b/drivers/scsi/be2iscsi/be_main.c @@ -5249,12 +5249,11 @@ static void beiscsi_eqd_update_work(struct work_struct *work) msecs_to_jiffies(BEISCSI_EQD_UPDATE_INTERVAL)); } -static void beiscsi_hw_tpe_check(unsigned long ptr) +static void beiscsi_hw_tpe_check(struct timer_list *t) { - struct beiscsi_hba *phba; + struct beiscsi_hba *phba = from_timer(phba, t, hw_check); u32 wait; - phba = (struct beiscsi_hba *)ptr; /* if not TPE, do nothing */ if (!beiscsi_detect_tpe(phba)) return; @@ -5267,11 +5266,10 @@ static void beiscsi_hw_tpe_check(unsigned long ptr) msecs_to_jiffies(wait)); } -static void beiscsi_hw_health_check(unsigned long ptr) +static void beiscsi_hw_health_check(struct timer_list *t) { - struct beiscsi_hba *phba; + struct beiscsi_hba *phba = from_timer(phba, t, hw_check); - phba = (struct beiscsi_hba *)ptr; beiscsi_detect_ue(phba); if (beiscsi_detect_ue(phba)) { __beiscsi_log(phba, KERN_ERR, @@ -5283,7 +5281,7 @@ static void beiscsi_hw_health_check(unsigned long ptr) if (!test_bit(BEISCSI_HBA_UER_SUPP, &phba->state)) return; /* modify this timer to check TPE */ - phba->hw_check.function = beiscsi_hw_tpe_check; + phba->hw_check.function = (TIMER_FUNC_TYPE)beiscsi_hw_tpe_check; } mod_timer(&phba->hw_check, @@ -5371,7 +5369,7 @@ static int beiscsi_enable_port(struct beiscsi_hba *phba) * Timer function gets modified for TPE detection. * Always reinit to do health check first. */ - phba->hw_check.function = beiscsi_hw_health_check; + phba->hw_check.function = (TIMER_FUNC_TYPE)beiscsi_hw_health_check; mod_timer(&phba->hw_check, jiffies + msecs_to_jiffies(BEISCSI_UE_DETECT_INTERVAL)); return 0; @@ -5721,9 +5719,7 @@ static int beiscsi_dev_probe(struct pci_dev *pcidev, * Start UE detection here. UE before this will cause stall in probe * and eventually fail the probe. */ - init_timer(&phba->hw_check); - phba->hw_check.function = beiscsi_hw_health_check; - phba->hw_check.data = (unsigned long)phba; + timer_setup(&phba->hw_check, beiscsi_hw_health_check, 0); mod_timer(&phba->hw_check, jiffies + msecs_to_jiffies(BEISCSI_UE_DETECT_INTERVAL)); beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_INIT,