From patchwork Tue Oct 31 19:13:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 10035233 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 4B82A602B9 for ; Tue, 31 Oct 2017 19:14:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3D5C228AEA for ; Tue, 31 Oct 2017 19:14:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3176B28AED; Tue, 31 Oct 2017 19:14:09 +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=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 8B2B228AEA for ; Tue, 31 Oct 2017 19:14:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932924AbdJaTOG (ORCPT ); Tue, 31 Oct 2017 15:14:06 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:51005 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932859AbdJaTOC (ORCPT ); Tue, 31 Oct 2017 15:14:02 -0400 Received: by mail-pf0-f196.google.com with SMTP id b6so21408pfh.7 for ; Tue, 31 Oct 2017 12:14:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=UFdu2aswAe+Cbkx1wYCvQK5NEarodZ4oNVmxxl62Ejk=; b=OELv4T79Q1NJdn+uPtW8IXzIgk/8v+Dnqq67H3p19e1XaNctjwM6NwxzbfIbwLulDb 5p3TVbJN64q0aoOiGqY7zaiz0cDEn4h0LGS9IdWl+nFXoIdDacy19uCnv12X3QanpWYc LG/RBEjDerv/KLv99Pt7p4pAAi1RgLxp6Co8o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=UFdu2aswAe+Cbkx1wYCvQK5NEarodZ4oNVmxxl62Ejk=; b=T5syp79EXBPezfyLCpap1iblGWl2uIr4zEw3o+s0c8pn0m/asQVlbUCex0WChHEwID 48jcnNQLldu2Y066ppC/i48RQ9lpgwXy2DRnc7K8HCA4p0n+D8bWsonYKYXQImwjRoIt +fHdqQh2PQpRTPUi7KanzN1uZag82becM7Hz8PkJUT1NB6mnxJCz5TDlTbWeQmK0eKRK fXm/nQsWUnz3La7eZ3YAuW6muFHis868Jbal5TMNGiVclfP2YhGuPFHaWPI9x8/Og3rv pv4YSMBmmQm/33gcqLjr3vIsCz1o3qw58YXUoQF82gTgPJyAyT6FqYd3pb71gYOYx+gp cxug== X-Gm-Message-State: AMCzsaXrjHzS1inj0wVfEC/e2m8PBVhclwWSYuvKxis8LI8bE7nAIn5+ FjkGRcGLEIOmiTx+DO4/vRQ9Mb8u8/w= X-Google-Smtp-Source: ABhQp+Sl1E8BNiHnPhOXTUiMJ8EfTGvSJ8OfvGG2RjwAOxNPSkxV+Qt9qaNdhLoBmaU3VXe8YiRkaw== X-Received: by 10.98.185.10 with SMTP id z10mr3108004pfe.8.1509477242499; Tue, 31 Oct 2017 12:14:02 -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 m78sm4731542pfj.164.2017.10.31.12.13.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 31 Oct 2017 12:13:57 -0700 (PDT) From: Kees Cook To: Himanshu Madhani Cc: Kees Cook , Bart Van Assche , qla2xxx-upstream@qlogic.com, "Martin K. Petersen" , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/4] scsi: qla2xxx: Convert timers to use setup_timer() Date: Tue, 31 Oct 2017 12:13:46 -0700 Message-Id: <1509477229-62141-2-git-send-email-keescook@chromium.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1509477229-62141-1-git-send-email-keescook@chromium.org> References: <1509477229-62141-1-git-send-email-keescook@chromium.org> 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, take the first step by switching from init_timer() and open-coded .function and .data assignments to using the old setup_timer() API. Cc: Himanshu Madhani Cc: Bart Van Assche Cc: qla2xxx-upstream@qlogic.com Cc: "Martin K. Petersen" Cc: linux-scsi@vger.kernel.org Signed-off-by: Kees Cook --- drivers/scsi/qla2xxx/qla_inline.h | 5 ++--- drivers/scsi/qla2xxx/qla_os.c | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_inline.h b/drivers/scsi/qla2xxx/qla_inline.h index 9a2c86eacf44..34cdb5d9c87c 100644 --- a/drivers/scsi/qla2xxx/qla_inline.h +++ b/drivers/scsi/qla2xxx/qla_inline.h @@ -269,10 +269,9 @@ qla2x00_rel_sp(srb_t *sp) static inline void qla2x00_init_timer(srb_t *sp, unsigned long tmo) { - init_timer(&sp->u.iocb_cmd.timer); + setup_timer(&sp->u.iocb_cmd.timer, qla2x00_sp_timeout, + (unsigned long)sp); sp->u.iocb_cmd.timer.expires = jiffies + tmo * HZ; - sp->u.iocb_cmd.timer.data = (unsigned long)sp; - sp->u.iocb_cmd.timer.function = qla2x00_sp_timeout; add_timer(&sp->u.iocb_cmd.timer); sp->free = qla2x00_sp_free; if (IS_QLAFX00(sp->vha->hw) && (sp->type == SRB_FXIOCB_DCMD)) diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 3bd956d3bc5d..6c10a7b970c0 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -332,10 +332,9 @@ struct scsi_transport_template *qla2xxx_transport_vport_template = NULL; __inline__ void qla2x00_start_timer(scsi_qla_host_t *vha, void *func, unsigned long interval) { - init_timer(&vha->timer); + setup_timer(&vha->timer, (void (*)(unsigned long))func, + (unsigned long)vha); vha->timer.expires = jiffies + interval * HZ; - vha->timer.data = (unsigned long)vha; - vha->timer.function = (void (*)(unsigned long))func; add_timer(&vha->timer); vha->timer_active = 1; }