From patchwork Tue Dec 12 14:52:53 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: 121528 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4222436qgn; Tue, 12 Dec 2017 06:54:34 -0800 (PST) X-Google-Smtp-Source: ACJfBov9e15hr4qHc7sNx7z1pCFxzqhMLVGQIaK1kJbyTbWChBkJBnVzSm5nLEioYnPBU2hJc+47 X-Received: by 10.98.14.144 with SMTP id 16mr2577486pfo.195.1513090474708; Tue, 12 Dec 2017 06:54:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513090474; cv=none; d=google.com; s=arc-20160816; b=vHP6Z/6wbsB0NjyJ5SsTbcsh/4UcTRa+c/uv7jqwrx4Qm8NM0qTJq6RTqbzIpr7lCB 21+d3xEvqBm100S9FmgudJ5aVWbTVaNBdf7L6wuO1gqqQg8le5p+h2jJEwRXIjUGB9Ew +ncJSj7DMrxLHiCPsWNipdFyfws7epPLC6/PrW1ErsffOBNN/SyBW9J6e3jQQHgL6qDZ TPGVEvHTaGo+NTNA+1dL7CxcGLULrJxZpubM4fmrw3zft4rlXm2dGzYC8xrO1MS1+Zeu HmFtPdCl1uWQMXqnq4b7fW0MxR7kg5aoe9WIWBcAeGD36RJTjQ6wQngYqQnwOSInQgdp oE+g== 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=Vs6DD18hzPkmF1nsGae3L8DhUCYV1eCvfGKWlqxXlLE=; b=XJzsQBfceJiIhDmHS1Pzk9wAWSZfwuKAqgdlH1TP9BbyWQukKXj5nJsgq/H+NBUHSv kgU8ui0sjlpywy1usUEKb/VldI92AJaqhPf91LUoT55zZiLUsK1XzNsE91wqNvHuvegh 5FFqKKJCBqOgfZPRpfH9tWgrMqINaBvFCoF8AZ3/y/be+tDl4wAqQfxxRTv8zJPp2d7u 32GqvJC37OPtrWLO20rt+AnmUxcP3psG9kJJ/f5e4OECRj9mdmaf2QlSqvGRKKxPWy3k RXOzNsefoJOz1Lc1jJvR2GDt4wM9Q+gu1g0YigDSXuFJ9XpowCBCq/dt4LwZyhN5EaQ4 /GhA== 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 v9si10144691plo.199.2017.12.12.06.54.34; Tue, 12 Dec 2017 06:54:34 -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 S1752707AbdLLOyb (ORCPT + 11 others); Tue, 12 Dec 2017 09:54:31 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:45080 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752467AbdLLOy0 (ORCPT ); Tue, 12 Dec 2017 09:54:26 -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 AF4BA1529; Tue, 12 Dec 2017 06:54:25 -0800 (PST) Received: from sugar.kfn.arm.com (unknown [10.45.48.196]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0627D3F577; Tue, 12 Dec 2017 06:54:23 -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 07/24] staging: ccree: simplify expression with local var Date: Tue, 12 Dec 2017 14:52:53 +0000 Message-Id: <1513090395-7938-8-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1513090395-7938-1-git-send-email-gilad@benyossef.com> References: <1513090395-7938-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 Simplify expression by using a local variable for better code readability. Signed-off-by: Gilad Ben-Yossef --- drivers/staging/ccree/ssi_buffer_mgr.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) -- 2.7.4 diff --git a/drivers/staging/ccree/ssi_buffer_mgr.c b/drivers/staging/ccree/ssi_buffer_mgr.c index 099d83d..490dd5a 100644 --- a/drivers/staging/ccree/ssi_buffer_mgr.c +++ b/drivers/staging/ccree/ssi_buffer_mgr.c @@ -917,6 +917,7 @@ static int cc_prepare_aead_data_mlli(struct ssi_drvdata *drvdata, unsigned int authsize = areq_ctx->req_authsize; int rc = 0, icv_nents; struct device *dev = drvdata_to_dev(drvdata); + struct scatterlist *sg; if (req->src == req->dst) { /*INPLACE*/ @@ -955,12 +956,11 @@ static int cc_prepare_aead_data_mlli(struct ssi_drvdata *drvdata, areq_ctx->mac_buf_dma_addr; } } else { /* Contig. ICV */ + sg = &areq_ctx->src_sgl[areq_ctx->src.nents - 1]; /*Should hanlde if the sg is not contig.*/ - areq_ctx->icv_dma_addr = sg_dma_address( - &areq_ctx->src_sgl[areq_ctx->src.nents - 1]) + + areq_ctx->icv_dma_addr = sg_dma_address(sg) + (*src_last_bytes - authsize); - areq_ctx->icv_virt_addr = sg_virt( - &areq_ctx->src_sgl[areq_ctx->src.nents - 1]) + + areq_ctx->icv_virt_addr = sg_virt(sg) + (*src_last_bytes - authsize); } @@ -993,12 +993,11 @@ static int cc_prepare_aead_data_mlli(struct ssi_drvdata *drvdata, areq_ctx->icv_virt_addr = areq_ctx->backup_mac; } else { /* Contig. ICV */ + sg = &areq_ctx->src_sgl[areq_ctx->src.nents - 1]; /*Should hanlde if the sg is not contig.*/ - areq_ctx->icv_dma_addr = sg_dma_address( - &areq_ctx->src_sgl[areq_ctx->src.nents - 1]) + + areq_ctx->icv_dma_addr = sg_dma_address(sg) + (*src_last_bytes - authsize); - areq_ctx->icv_virt_addr = sg_virt( - &areq_ctx->src_sgl[areq_ctx->src.nents - 1]) + + areq_ctx->icv_virt_addr = sg_virt(sg) + (*src_last_bytes - authsize); } @@ -1023,12 +1022,11 @@ static int cc_prepare_aead_data_mlli(struct ssi_drvdata *drvdata, } if (!areq_ctx->is_icv_fragmented) { + sg = &areq_ctx->dst_sgl[areq_ctx->dst.nents - 1]; /* Contig. ICV */ - areq_ctx->icv_dma_addr = sg_dma_address( - &areq_ctx->dst_sgl[areq_ctx->dst.nents - 1]) + + areq_ctx->icv_dma_addr = sg_dma_address(sg) + (*dst_last_bytes - authsize); - areq_ctx->icv_virt_addr = sg_virt( - &areq_ctx->dst_sgl[areq_ctx->dst.nents - 1]) + + areq_ctx->icv_virt_addr = sg_virt(sg) + (*dst_last_bytes - authsize); } else { areq_ctx->icv_dma_addr = areq_ctx->mac_buf_dma_addr;