From patchwork Mon Nov 13 14:45:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Ben-Yossef X-Patchwork-Id: 118793 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp1879688qgn; Mon, 13 Nov 2017 06:47:15 -0800 (PST) X-Google-Smtp-Source: AGs4zMb/KXrD3ZcHnysyoJWAw5wKNm4tsWC7x1aFB/kBQK9tBrqRIZUk6oI97jYRLb7GquK++jyV X-Received: by 10.101.67.137 with SMTP id m9mr8656463pgp.51.1510584435016; Mon, 13 Nov 2017 06:47:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510584435; cv=none; d=google.com; s=arc-20160816; b=z+u0YRNi4h8l3R/KJLPPulL+Qik5kqMOaO7G+PSesKS7GmWbo3djqOcvExeL97NFDO uA0p+aPokCCY08m1azY1DqfD+IGhYYrdM2QE6h4zlgjFR+Mjs7HRUbJk7ZmboLpz8QZN Zyg09BPWQl8Jj9IwaOs6d8tGJGi9RmQpYBK0BUV9sDNWqHai6xWMsSY8dnAHIgI4q6PO cNcfja1mqoB7mSR8yPwkLo2EBb0CLGnn5aan0KAM1xav3WL1e70JCwJ8FMBYFveZAqU/ 9Hg+lOqSOihzHqX40MS8Mzk9ICoi5ykScmNKVHz84fQXY4Gonen4a/6w+YuT7+OYjzO5 HUfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=fW2CcWsh5PoHyDZLqVbNT73ux3BK1gWVE4+7c1Co+Mw=; b=NLrIMK92hMNAVCctlqZw6atdFcqafAOrMTZbbhMOLSrVpEk87OioMD0JJunYbZcEX2 652LvE8E103lYbDjzB6hJgqX/74GCbXv7pBvX3LMZvcCki+Zkr/B242gUvGZ7YWI0N/p XeJ0YtYPqV3mGfCl0B/2uYYDzDW26WwKSQUdijaKa/gvO3ohhtKGX6S0hE++hymhM8p1 B7FHceXvpEWmr9UZ6wK++WCjIIbiVWKw0Oc1au+e5B5aeSGCkZVu3WyECpA8sCTqisDO uj70LEEvWrbuh3gA2Kx79goTLnF61bzv5vFx/cyGrbXKKzje7gLuBhGmZhQN6DfejCsw ghhA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g2si13632225pgr.506.2017.11.13.06.47.14; Mon, 13 Nov 2017 06:47:15 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753284AbdKMOrN (ORCPT + 27 others); Mon, 13 Nov 2017 09:47:13 -0500 Received: from foss.arm.com ([217.140.101.70]:47338 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752769AbdKMOrK (ORCPT ); Mon, 13 Nov 2017 09:47:10 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 530591435; Mon, 13 Nov 2017 06:47:10 -0800 (PST) Received: from sugar.kfn.arm.com (unknown [10.45.48.133]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 467433F318; Mon, 13 Nov 2017 06:47:08 -0800 (PST) From: Gilad Ben-Yossef To: Greg Kroah-Hartman Cc: Ofir Drang , linux-crypto@vger.kernel.org, driverdev-devel@linuxdriverproject.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH 09/24] staging: ccree: replace open coded loop with for Date: Mon, 13 Nov 2017 14:45:37 +0000 Message-Id: <1510584358-29473-10-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1510584358-29473-1-git-send-email-gilad@benyossef.com> References: <1510584358-29473-1-git-send-email-gilad@benyossef.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Replace open coded register writing loop with a for. Further simplify code by using a local var to precompute the register address for readability. Signed-off-by: Gilad Ben-Yossef --- drivers/staging/ccree/ssi_request_mgr.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) -- 2.7.4 diff --git a/drivers/staging/ccree/ssi_request_mgr.c b/drivers/staging/ccree/ssi_request_mgr.c index f5041f7..65c4d9f 100644 --- a/drivers/staging/ccree/ssi_request_mgr.c +++ b/drivers/staging/ccree/ssi_request_mgr.c @@ -164,15 +164,17 @@ static inline void enqueue_seq( void __iomem *cc_base, struct cc_hw_desc seq[], unsigned int seq_len) { - int i; + int i, w; + void * __iomem reg = cc_base + CC_REG(DSCRPTR_QUEUE_WORD0); + + /* + * We do indeed write all 6 command words to the same + * register. The HW supports this. + */ for (i = 0; i < seq_len; i++) { - writel_relaxed(seq[i].word[0], (cc_base + CC_REG(DSCRPTR_QUEUE_WORD0))); - writel_relaxed(seq[i].word[1], (cc_base + CC_REG(DSCRPTR_QUEUE_WORD0))); - writel_relaxed(seq[i].word[2], (cc_base + CC_REG(DSCRPTR_QUEUE_WORD0))); - writel_relaxed(seq[i].word[3], (cc_base + CC_REG(DSCRPTR_QUEUE_WORD0))); - writel_relaxed(seq[i].word[4], (cc_base + CC_REG(DSCRPTR_QUEUE_WORD0))); - writel_relaxed(seq[i].word[5], (cc_base + CC_REG(DSCRPTR_QUEUE_WORD0))); + for (w = 0; w <= 5; w++) + writel_relaxed(seq[i].word[w], reg); #ifdef DX_DUMP_DESCS dev_dbg(dev, "desc[%02d]: 0x%08X 0x%08X 0x%08X 0x%08X 0x%08X 0x%08X\n", i, seq[i].word[0], seq[i].word[1], seq[i].word[2],