From patchwork Mon Oct 16 23:54:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 10010283 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 F2EBE600CC for ; Mon, 16 Oct 2017 23:55:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E12C928713 for ; Mon, 16 Oct 2017 23:55:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D1EDE28715; Mon, 16 Oct 2017 23:55:27 +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 5ACE628713 for ; Mon, 16 Oct 2017 23:55:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757549AbdJPXy7 (ORCPT ); Mon, 16 Oct 2017 19:54:59 -0400 Received: from mail-pf0-f176.google.com ([209.85.192.176]:46909 "EHLO mail-pf0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757531AbdJPXy4 (ORCPT ); Mon, 16 Oct 2017 19:54:56 -0400 Received: by mail-pf0-f176.google.com with SMTP id p87so16969354pfj.3 for ; Mon, 16 Oct 2017 16:54:56 -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=d5x+x9PMriSubUIpVxryWhx06z8rkFcnsmCyPsjJGNU=; b=eWz5/HuF2OisuTjbriOTV1qj4dG9rv6nn3r/K/yTDYgttelQTHL8s5+CJG9v4yftYa 0uic/MeoWs6P6BdTlKfX2mBNeZJ68fEdqlF3xeRknB/v7W2dw04oylmwkNT5yGqPt4fa A0bparR53BV3voMMl+HgKP9yJ28KiLbsUbrxc= 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=d5x+x9PMriSubUIpVxryWhx06z8rkFcnsmCyPsjJGNU=; b=VDlcPE4IxxAu+U8p0cjz0O8stWBqcu8a1vf2Vj7HVZ8pGfq2mQecK6ZjcDsOBVhD/B yBpiUEvwcVsmW9NX/W6R8EhlRqx+jHs9a+24voJAdF2nBCv+4jhxsNY42EKgZ15LVVjB fS/+7gyg0kIcpj2Zgz+svfie2KFwb3RySmA50061M6151BHYQVb/bRhtBfSmmjSN3Ycn kNXwK3LazowEY/hRA3fNKTWXZvN9u4N6jpIB+/l2n2kMHlXCmereSB0Az2u5SUEk2u0H dbf6Ya+kOhv4Wmhp2bDXEvTcL1vj4qrm5xdlPgPvfOjtNCnDh97nlwLlnUbXoLKm/h96 mgJg== X-Gm-Message-State: AMCzsaVgq2DArgEm1QktHIRbH5Xzra7M1v/luTWMxUXDtaK2JmFHNQC0 WE3J/u6fZLhaScoZtzvjp23rfA== X-Google-Smtp-Source: AOwi7QAXRoC0tqAI/h/up4eQdFy4XT5HICYLOEnFKAeiXmIvA1VDU15MucsKONBoETR201cnMqm80A== X-Received: by 10.98.160.13 with SMTP id r13mr10145965pfe.187.1508198095965; Mon, 16 Oct 2017 16:54:55 -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 a81sm15986227pfe.32.2017.10.16.16.54.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Oct 2017 16:54:54 -0700 (PDT) Date: Mon, 16 Oct 2017 16:54:53 -0700 From: Kees Cook To: "Martin K. Petersen" Cc: Oliver Neukum , Ali Akcaagac , Jamie Lenehan , "James E.J. Bottomley" , "Martin K. Petersen" , dc395x@twibble.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] scsi: dc395x: Convert timers to use timer_setup() Message-ID: <20171016235453.GA102593@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: Oliver Neukum Cc: Ali Akcaagac Cc: Jamie Lenehan Cc: "James E.J. Bottomley" Cc: "Martin K. Petersen" Cc: dc395x@twibble.org Cc: linux-scsi@vger.kernel.org Signed-off-by: Kees Cook Reviewed-by: Martin K. Petersen --- drivers/scsi/dc395x.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/scsi/dc395x.c b/drivers/scsi/dc395x.c index 5ee7f44cf869..60ef8df42b95 100644 --- a/drivers/scsi/dc395x.c +++ b/drivers/scsi/dc395x.c @@ -395,7 +395,7 @@ static void request_sense(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb, struct ScsiReqBlk *srb); static void set_xfer_rate(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb); -static void waiting_timeout(unsigned long ptr); +static void waiting_timeout(struct timer_list *t); /*--------------------------------------------------------------------------- @@ -857,9 +857,6 @@ static void waiting_set_timer(struct AdapterCtlBlk *acb, unsigned long to) { if (timer_pending(&acb->waiting_timer)) return; - init_timer(&acb->waiting_timer); - acb->waiting_timer.function = waiting_timeout; - acb->waiting_timer.data = (unsigned long) acb; if (time_before(jiffies + to, acb->last_reset - HZ / 2)) acb->waiting_timer.expires = acb->last_reset - HZ / 2 + 1; @@ -936,10 +933,10 @@ static void waiting_process_next(struct AdapterCtlBlk *acb) /* Wake up waiting queue */ -static void waiting_timeout(unsigned long ptr) +static void waiting_timeout(struct timer_list *t) { unsigned long flags; - struct AdapterCtlBlk *acb = (struct AdapterCtlBlk *)ptr; + struct AdapterCtlBlk *acb = from_timer(acb, t, waiting_timer); dprintkdbg(DBG_1, "waiting_timeout: Queue woken up by timer. acb=%p\n", acb); DC395x_LOCK_IO(acb->scsi_host, flags); @@ -4366,8 +4363,8 @@ static void adapter_init_params(struct AdapterCtlBlk *acb) INIT_LIST_HEAD(&acb->srb_free_list); /* temp SRB for Q tag used or abort command used */ acb->tmp_srb = &acb->srb; - init_timer(&acb->waiting_timer); - init_timer(&acb->selto_timer); + timer_setup(&acb->waiting_timer, waiting_timeout, 0); + timer_setup(&acb->selto_timer, NULL, 0); acb->srb_count = DC395x_MAX_SRB_CNT;