From patchwork Wed Oct 25 10:18:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 10026423 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 470566032C for ; Wed, 25 Oct 2017 10:19:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F15BA28B6E for ; Wed, 25 Oct 2017 10:19:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E5B1D28B57; Wed, 25 Oct 2017 10:19: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=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6DEEB28B57 for ; Wed, 25 Oct 2017 10:19:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Subject:To:From :Date:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=RiH8GoOMJyBfK+LSRe7zOJQmUm+VkhkTsMnyeZLK80U=; b=AvXJ8p3EcEoYUe Y7UNsNjNKLw1kggop1xTzCYE+SgX5Z6Z1UAcEZuXhoNPhiCqflRcpH509COyGCjexp0Ajw2aChXH4 +++GwyPJ+TB3hTnWqamaEhY5IUzV1PRApVPl0gLdZJ8D4sBku3KQq6wSjzcHS52GHHJwXTC61fbkK ZbWiJM2ofhoub5A2TMTbYDQdYHbuczaPHjFkW8sa61zoP4tpq/B59Vhu/f/XIQNRw5VeiWiRCO1i/ ZP/Bu+12AVEW3xc95cZBqM0/ULVO1Vw6OYrdPIv5rzWKIFY9dxaJ7SC2oRabjKbt74FvDfAxCUnxt 7/1tFsrQycs6cBgRRiXQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1e7ImE-000084-83; Wed, 25 Oct 2017 10:19:10 +0000 Received: from mail-pg0-x242.google.com ([2607:f8b0:400e:c05::242]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1e7ImA-00005d-GK for linux-arm-kernel@lists.infradead.org; Wed, 25 Oct 2017 10:19:08 +0000 Received: by mail-pg0-x242.google.com with SMTP id s75so16936566pgs.0 for ; Wed, 25 Oct 2017 03:18:45 -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=ov1eVS8B6a8FdsJVe1ZD1w6I/FhdXu7ShaapMxk9IEE=; b=OsejbfyKl0gh3kFUEnJ97IgLtSytqPnNVyhmLxsTdnARa8cKKKpUJoGzEfBIvppqgG Yw2rsLUsj6Xtl08yKr7Zl9O6Qlh78W/fbTtIeVwEg08dGSKI3LeVNXHGqbKyEelV410t cloOCvEivPbqE0/t1HNi68RdsrbpvtLxoxlrs= 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=ov1eVS8B6a8FdsJVe1ZD1w6I/FhdXu7ShaapMxk9IEE=; b=jcXL9ZsHZCfrT8ZqzUbPSNDYH13RHdTkoaOEJCB62N+1Z6htWJYJtSWbjqNYnGWKC6 M8wlQXngyvBwMGcANq8Ne/ya0sOjIpTWtW/DZGeXDflayH2lBEsdpOBJvvailhyPfyC+ EJedoXtsXrisnzUW1gIT7cw705+20NtOyKcTsA4Uu2GOy8v1T0j5oZsyIPtWkyZxOO5b WdVHcH/2FLM/bxDL+v2qY8qlI8iujYq9E3FDfzM/IG6YqV1jHgd8ZKwSIhmnB2OndM44 3SAoke6HreOvBfB9hAf1ojq0Zchx/pEj+qGpL18Df3g8/TCtoN5tO+0YHr56m646RD0q DHww== X-Gm-Message-State: AMCzsaXSxbaWxVARODzPTvCmK8Puj8nlvbAGXU+hxRPRtHbY4h8wS4yS 67bp5Q9PiwDKAA1W5VVfk9DfzSSSM5s= X-Google-Smtp-Source: ABhQp+SVUqAz1KprWGsl7SrdQfR2jDk5ftrvbf20j+yxyjtX046qsFAXt1i4yCrXZQMp/Bfk5kUPmA== X-Received: by 10.98.79.80 with SMTP id d77mr1727509pfb.238.1508926725062; Wed, 25 Oct 2017 03:18:45 -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 f6sm3783362pgo.11.2017.10.25.03.18.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Oct 2017 03:18:43 -0700 (PDT) Date: Wed, 25 Oct 2017 03:18:42 -0700 From: Kees Cook To: Herbert Xu Subject: [PATCH] drivers/crypto: Convert timers to use timer_setup() Message-ID: <20171025101842.GA145495@beast> MIME-Version: 1.0 Content-Disposition: inline X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171025_031906_572002_57D1DEAA X-CRM114-Status: GOOD ( 13.32 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jesper Nilsson , linux-kernel@vger.kernel.org, linux-arm-kernel@axis.com, Lars Persson , Niklas Cassel , Jamie Iles , "David S. Miller" , linux-arm-kernel@lists.infradead.org, linux-crypto@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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: Herbert Xu Cc: Jesper Nilsson Cc: Lars Persson Cc: Niklas Cassel Cc: "David S. Miller" Cc: Jamie Iles Cc: linux-arm-kernel@axis.com Cc: linux-crypto@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Signed-off-by: Kees Cook Acked-by: Jamie Iles Acked-by: Lars Persson --- drivers/crypto/axis/artpec6_crypto.c | 6 +++--- drivers/crypto/mv_cesa.c | 4 ++-- drivers/crypto/picoxcell_crypto.c | 7 +++---- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/crypto/axis/artpec6_crypto.c b/drivers/crypto/axis/artpec6_crypto.c index 0f9754e07719..456278440863 100644 --- a/drivers/crypto/axis/artpec6_crypto.c +++ b/drivers/crypto/axis/artpec6_crypto.c @@ -2072,9 +2072,9 @@ static void artpec6_crypto_process_queue(struct artpec6_crypto *ac) del_timer(&ac->timer); } -static void artpec6_crypto_timeout(unsigned long data) +static void artpec6_crypto_timeout(struct timer_list *t) { - struct artpec6_crypto *ac = (struct artpec6_crypto *) data; + struct artpec6_crypto *ac = from_timer(ac, t, timer); dev_info_ratelimited(artpec6_crypto_dev, "timeout\n"); @@ -3063,7 +3063,7 @@ static int artpec6_crypto_probe(struct platform_device *pdev) spin_lock_init(&ac->queue_lock); INIT_LIST_HEAD(&ac->queue); INIT_LIST_HEAD(&ac->pending); - setup_timer(&ac->timer, artpec6_crypto_timeout, (unsigned long) ac); + timer_setup(&ac->timer, artpec6_crypto_timeout, 0); ac->base = base; diff --git a/drivers/crypto/mv_cesa.c b/drivers/crypto/mv_cesa.c index c3883b49f56e..6a8275f017a8 100644 --- a/drivers/crypto/mv_cesa.c +++ b/drivers/crypto/mv_cesa.c @@ -149,7 +149,7 @@ struct mv_req_hash_ctx { int count_add; }; -static void mv_completion_timer_callback(unsigned long unused) +static void mv_completion_timer_callback(struct timer_list *unused) { int active = readl(cpg->reg + SEC_ACCEL_CMD) & SEC_CMD_EN_SEC_ACCL0; @@ -167,7 +167,7 @@ static void mv_completion_timer_callback(unsigned long unused) static void mv_setup_timer(void) { - setup_timer(&cpg->completion_timer, &mv_completion_timer_callback, 0); + timer_setup(&cpg->completion_timer, mv_completion_timer_callback, 0); mod_timer(&cpg->completion_timer, jiffies + msecs_to_jiffies(MV_CESA_EXPIRE)); } diff --git a/drivers/crypto/picoxcell_crypto.c b/drivers/crypto/picoxcell_crypto.c index b6f14844702e..5a6dc53b2b9d 100644 --- a/drivers/crypto/picoxcell_crypto.c +++ b/drivers/crypto/picoxcell_crypto.c @@ -1125,9 +1125,9 @@ static irqreturn_t spacc_spacc_irq(int irq, void *dev) return IRQ_HANDLED; } -static void spacc_packet_timeout(unsigned long data) +static void spacc_packet_timeout(struct timer_list *t) { - struct spacc_engine *engine = (struct spacc_engine *)data; + struct spacc_engine *engine = from_timer(engine, t, packet_timeout); spacc_process_done(engine); } @@ -1714,8 +1714,7 @@ static int spacc_probe(struct platform_device *pdev) writel(SPA_IRQ_EN_STAT_EN | SPA_IRQ_EN_GLBL_EN, engine->regs + SPA_IRQ_EN_REG_OFFSET); - setup_timer(&engine->packet_timeout, spacc_packet_timeout, - (unsigned long)engine); + timer_setup(&engine->packet_timeout, spacc_packet_timeout, 0); INIT_LIST_HEAD(&engine->pending); INIT_LIST_HEAD(&engine->completed);