From patchwork Tue Mar 3 13:21:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Hicks X-Patchwork-Id: 5922501 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Original-To: patchwork-linux-crypto@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id CA4799F318 for ; Tue, 3 Mar 2015 13:21:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 04B1B2026C for ; Tue, 3 Mar 2015 13:21:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1E792202B4 for ; Tue, 3 Mar 2015 13:21:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756075AbbCCNVv (ORCPT ); Tue, 3 Mar 2015 08:21:51 -0500 Received: from mail-ig0-f172.google.com ([209.85.213.172]:35136 "EHLO mail-ig0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756106AbbCCNVu (ORCPT ); Tue, 3 Mar 2015 08:21:50 -0500 Received: by igqa13 with SMTP id a13so27204850igq.0 for ; Tue, 03 Mar 2015 05:21:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=5R3C7fjDro8K6o8OWL/sukfqGa09myktTjeRw+PKWQU=; b=nQMqTAZmDGDrNwzWpKWJ/2bAaNK/ONcCyDXos+ZD2ZBJiEHd6rmwTooVsh2L8ygtok DfwFylahooee/5vjYcoZ8B8RFPGTrU1+V1CkHuo5AxqazIzBLesZtQem63nVqFK0dyyn suxBnF3+SHUMVWM/D/S/AqeBXSgOLgAKkTXjOBNK1RgdoaldjTUeFXO5uerHTh7WnDQL dTLkTqp1WYjVAbylp4Wfa8fI53xSSQclaVUNdxXI2DUXXkZuRxhprxL27fBx69olj9FE 8MnA/yZ3S4neF5ox4GQAj8B/s7qSmWiXO93o1yBrWeRSN8pxOvbflT17mrr3yHJqU6jq ra1Q== X-Received: by 10.107.34.210 with SMTP id i201mr1744420ioi.1.1425388909840; Tue, 03 Mar 2015 05:21:49 -0800 (PST) Received: from p1022build.eng-services.ca (cmr-208-97-87-171.cr.net.cable.rogers.com. [208.97.87.171]) by mx.google.com with ESMTPSA id mi3sm8782809igb.13.2015.03.03.05.21.48 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Mar 2015 05:21:49 -0800 (PST) From: Martin Hicks To: Kim Phillips , Scott Wood , Kumar Gala Cc: linuxppc-dev@lists.ozlabs.org, linux-crypto@vger.kernel.org, =?UTF-8?q?Horia=20Geant=C4=83?= , Martin Hicks Subject: [PATCH v2 1/5] crypto: talitos: Simplify per-channel initialization Date: Tue, 3 Mar 2015 08:21:33 -0500 Message-Id: <1425388897-5434-2-git-send-email-mort@bork.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1425388897-5434-1-git-send-email-mort@bork.org> References: <1425388897-5434-1-git-send-email-mort@bork.org> Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP There were multiple loops in a row, for each separate step of the initialization of the channels. Simplify to a single loop. Signed-off-by: Martin Hicks Acked-by: Kim Phillips --- drivers/crypto/talitos.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c index 067ec21..c49d977 100644 --- a/drivers/crypto/talitos.c +++ b/drivers/crypto/talitos.c @@ -2706,20 +2706,16 @@ static int talitos_probe(struct platform_device *ofdev) goto err_out; } + priv->fifo_len = roundup_pow_of_two(priv->chfifo_len); + for (i = 0; i < priv->num_channels; i++) { priv->chan[i].reg = priv->reg + TALITOS_CH_STRIDE * (i + 1); if (!priv->irq[1] || !(i & 1)) priv->chan[i].reg += TALITOS_CH_BASE_OFFSET; - } - for (i = 0; i < priv->num_channels; i++) { spin_lock_init(&priv->chan[i].head_lock); spin_lock_init(&priv->chan[i].tail_lock); - } - priv->fifo_len = roundup_pow_of_two(priv->chfifo_len); - - for (i = 0; i < priv->num_channels; i++) { priv->chan[i].fifo = kzalloc(sizeof(struct talitos_request) * priv->fifo_len, GFP_KERNEL); if (!priv->chan[i].fifo) { @@ -2727,11 +2723,10 @@ static int talitos_probe(struct platform_device *ofdev) err = -ENOMEM; goto err_out; } - } - for (i = 0; i < priv->num_channels; i++) atomic_set(&priv->chan[i].submit_count, -(priv->chfifo_len - 1)); + } dma_set_mask(dev, DMA_BIT_MASK(36));