From patchwork Wed Jan 25 00:23:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 47978 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp10290wrn; Tue, 24 Jan 2023 16:24:58 -0800 (PST) X-Google-Smtp-Source: AMrXdXsmfbfizHcfRr/rCtZKAeUCjJDV4QwKjifJkAg4TBgIFTg5FTYV4qzHWpjsH6JKkEwx6c6j X-Received: by 2002:a17:90a:c298:b0:229:b5e:2e03 with SMTP id f24-20020a17090ac29800b002290b5e2e03mr32065666pjt.32.1674606297760; Tue, 24 Jan 2023 16:24:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674606297; cv=none; d=google.com; s=arc-20160816; b=Zf3vUeSwpE+58F1TqcYxJ61oNc/evJ3bfdrgewhT9GIrz0jZk86YuYWRQMMJhQ1etZ k/i44ARyYv2MmiJJeQEaE80+cCyUT06SyGw43q4w9OOVrZxAtpRMNtIn8zH5Wl4gy4Vq sMBI7sF9vu5i3sLbeEUI78LKaKrsKJLPnpHIZdIorUNWdsekuXFUg9DulCRtHljQH2aM Fbp9zrsGcqrSO2+131cyybrqnINRMM1MesiXCWluZhQ76UOyS5mocXTR85869oF2vaJV R8ZP7NcC7fMJ9ZOfaVOYiN6lMv1P97yUnULJxh4GUnTYd1kX6u8cjckDg7Qrn/ufzaY6 +DsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=9/AsczzAoIWOzK8lXXQYr+oZjWpK7SKdHJ3MVSXvuVY=; b=Ng0XLDLmlLWRgvwh7c7pkWLeAkZKvcEoQ8vtf9Xyb9sMmI84JNM+axazvunX+4fnQu d5oZEuyDTSUrSWomEeE/pfJMvyhhGqDPjLBKlRZONy8iMADChTBLXpn1nDWsnJ5rV5Fx WCuOlkQrMXuhEJRLWtzK5jsREDN/JIFmHEocmSr/dT1/8lWh+/jRVmc4Vns2MmGUB6E/ 3ZeBU1HGVd+K8Zi0v93A5exa6ZyVt0v90gHagrMsqESSi0uRHtjvLBNtzQtdrhkwrPVH GbYOk3vAt4iVoIiyD9hdLnKGzhHAWn1HprqEk6sJ+sbOjJPD1w9KIxYFpSLNdSPXQTWk MPlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=G5sSLdwL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i7-20020a17090a650700b00229125f1426si442371pjj.19.2023.01.24.16.24.45; Tue, 24 Jan 2023 16:24:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=G5sSLdwL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234090AbjAYAXd (ORCPT + 99 others); Tue, 24 Jan 2023 19:23:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231482AbjAYAX2 (ORCPT ); Tue, 24 Jan 2023 19:23:28 -0500 Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1A364B899 for ; Tue, 24 Jan 2023 16:23:22 -0800 (PST) Received: by mail-ed1-x533.google.com with SMTP id y19so20109785edc.2 for ; Tue, 24 Jan 2023 16:23:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=9/AsczzAoIWOzK8lXXQYr+oZjWpK7SKdHJ3MVSXvuVY=; b=G5sSLdwLn4mg94HvxPiDfL7ErUh2JaPb1dvXZIK7dW4TB9o4KJCsGO+civsatRjENj eB5CnYxpgVTynGQFCDLap3gEHuE3VsV6qAYe6Od/8USkm/H7MwWPqfnnX/RD4qIjtb4S 4Z+4o7PbWsOD+zftvKx/HqRqH16rruAVChrd2R9oDdlDjgoVptjcnZNvJ/16j23vI5lf h00IW0b2nnEDfMoEYQHgFLmj8fxPSXiaBc/rNFwJSp2Yef20EZnMAVwg9pnliUanstTj RFPP76mjCFI7dOc92UuDD547Rr68oFWF870u8NqijqqpfY6Jh7jvk8tpRry100+RA/VI 88Bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9/AsczzAoIWOzK8lXXQYr+oZjWpK7SKdHJ3MVSXvuVY=; b=dgwaodanVYyMOg4DacH6CiUaXNnCciRJmYMap1WhXfmbSlSAAOnKPM5zoEJ18AP6vY G0KQW1sLDr3XrwrT1J2mn1qe3Vm4ol2gNWISpPKHXKStKJA/Wca2jgLy1zNFwK/Y315R ykurimLFk7HkvQpPXd55X2FzLogiPnhxYe7T/C/0yiksoTSXycEnU0fEfeGjUghRPxFd ocXzRcj7fRRw1p2+7Yvm696zhCiG/QXYNGXEW2BxR6QJpiOTbfb4lvIvZFtmPAXUcBy/ 2ZTGq3uh8MYSpqvTPkkCLMLSCWWpVfzywIvO8heO4R0qe8+hu7UhhO9/obIB/iuGkfR0 xpoQ== X-Gm-Message-State: AO0yUKUWEeJC4+VcrUVdkbx7GwXY0ug12y5GGxj+9GQ9p9Uc+QgASJG5 qKKwsbLlRPb+oNR3yl3Y7a4PjA== X-Received: by 2002:a05:6402:298c:b0:49f:a3d7:b84d with SMTP id eq12-20020a056402298c00b0049fa3d7b84dmr5449787edb.34.1674606201166; Tue, 24 Jan 2023 16:23:21 -0800 (PST) Received: from fedora.local (c-05d8225c.014-348-6c756e10.bbcust.telenor.se. [92.34.216.5]) by smtp.gmail.com with ESMTPSA id if10-20020a170906df4a00b00738795e7d9bsm1584606ejc.2.2023.01.24.16.23.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Jan 2023 16:23:20 -0800 (PST) From: Linus Walleij Date: Wed, 25 Jan 2023 01:23:07 +0100 Subject: [PATCH v3 2/6] crypto: stm32/hash: Simplify code MIME-Version: 1.0 Message-Id: <20221227-ux500-stm32-hash-v3-2-32ee12cd6f06@linaro.org> References: <20221227-ux500-stm32-hash-v3-0-32ee12cd6f06@linaro.org> In-Reply-To: <20221227-ux500-stm32-hash-v3-0-32ee12cd6f06@linaro.org> To: Herbert Xu , "David S. Miller" , Rob Herring , Krzysztof Kozlowski , Maxime Coquelin , Alexandre Torgue , Lionel Debieve Cc: linux-crypto@vger.kernel.org, devicetree@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Linus Walleij , Rob Herring X-Mailer: b4 0.11.1 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755951973294059588?= X-GMAIL-MSGID: =?utf-8?q?1755951973294059588?= We are passing (rctx->flags & HASH_FLAGS_FINUP) as indicator for the final request but we already know this to be true since we are in the (final) arm of an if-statement set from the same flag. Just open-code it as true. Acked-by: Lionel Debieve Signed-off-by: Linus Walleij --- ChangeLog v2->v3: - No changes ChangeLog v1->v2: - Pick up Lionel's ACK --- drivers/crypto/stm32/stm32-hash.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/crypto/stm32/stm32-hash.c b/drivers/crypto/stm32/stm32-hash.c index d33006d43f76..0473ced7b4ea 100644 --- a/drivers/crypto/stm32/stm32-hash.c +++ b/drivers/crypto/stm32/stm32-hash.c @@ -399,8 +399,7 @@ static int stm32_hash_update_cpu(struct stm32_hash_dev *hdev) if (final) { bufcnt = rctx->bufcnt; rctx->bufcnt = 0; - err = stm32_hash_xmit_cpu(hdev, rctx->buffer, bufcnt, - (rctx->flags & HASH_FLAGS_FINUP)); + err = stm32_hash_xmit_cpu(hdev, rctx->buffer, bufcnt, 1); } return err;