From patchwork Mon Jul 10 20:27:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 118074 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp62055vqm; Mon, 10 Jul 2023 13:44:29 -0700 (PDT) X-Google-Smtp-Source: APBJJlGvQ8ZMcu2UjDo2SXQebvbuRvvYaeqjKq5aOo5tIfq+HllUrolWkE6fTYkR7RbxPaObq0d1 X-Received: by 2002:aa7:df95:0:b0:51e:2cdb:ed1f with SMTP id b21-20020aa7df95000000b0051e2cdbed1fmr13652186edy.9.1689021869244; Mon, 10 Jul 2023 13:44:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689021869; cv=none; d=google.com; s=arc-20160816; b=kd5wtfUK/mhU5Dwru1IltzZj0+JDIwHuhI7uiZP+kbkIjnqIb+ED4tL0XlbFoSie37 2Kt/sewjIfqId6bY0MoeEpPjJlLPo0L7tUFM4M65XjD2f6O+0Q1PkZYz3UrN5QQyrGeg +PRMn6f4fdkbJTtN7sYzdbrRBi4v7Gh1Yt7asagCY/R14VmUqRl6JxhOhFDGKTdR4Mln KvgvTWK0PXKD+ufMyz14c7ewrtY+TJey53JQFJXaR2/cGGF4jEOA6vrKHbiPllvvzWlY 3Sh53+2FxVmAe0yKry3CUb/Z6XIQrIWQPUyEkNCsrH1u6Du3O4yFM1JOdDraQiUVCGqu XCEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=eeVlsvRuQWPlkSHD96WnTw5DjqufqmnABGnPz/Rnu7k=; fh=GUQwZ7uCW3sOebrGSFJwPRX8di32vmIzxh/oFyyWwpA=; b=UFp6Mm9tcdKWwHEfKDydxnGj7+yQPxkC0e54a2zS+vxwCSZUmZERIGmOReAr5VQQVW jMNBHT4KzqPCo+mXzH7gDG6aVbTOoAOcZ3cMxAM5ndvW64gQZyf1cyrFpFng0aLJjwGT 17HDurkrC23mHhwITlM3srAAmshCXdRZ4Ji1SQxktFVQNFUlMLgioifiKD2NAndeswoZ +pVUJAnHVtS1NLMkdB0DKB2p3J2L6IYi1dWli81anlj+r90mUNGHDJ0aJkpASXCfC7qn Vp/elaVU+dpo40c9vCZa3N5qsQzgFHJvFJA0uc9/cG1z1R42FwueA7litexFUOza2PdU lLLA== ARC-Authentication-Results: i=1; mx.google.com; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w18-20020aa7cb52000000b0051e3cb37258si340769edt.178.2023.07.10.13.44.05; Mon, 10 Jul 2023 13:44:29 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231673AbjGJU3y (ORCPT + 99 others); Mon, 10 Jul 2023 16:29:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230464AbjGJU3e (ORCPT ); Mon, 10 Jul 2023 16:29:34 -0400 Received: from viti.kaiser.cx (viti.kaiser.cx [IPv6:2a01:238:43fe:e600:cd0c:bd4a:7a3:8e9f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E296C1A8; Mon, 10 Jul 2023 13:29:31 -0700 (PDT) Received: from 250.57.4.146.static.wline.lns.sme.cust.swisscom.ch ([146.4.57.250] helo=martin-debian-2.paytec.ch) by viti.kaiser.cx with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1qIxVh-0002mg-5h; Mon, 10 Jul 2023 22:29:29 +0200 From: Martin Kaiser To: Herbert Xu Cc: aric.pzqi@ingenic.com, linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH 6/7] hwrng: ingenic - don't disable the rng in ingenic_trng_remove Date: Mon, 10 Jul 2023 22:27:32 +0200 Message-Id: <20230710202733.116133-7-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230710202733.116133-1-martin@kaiser.cx> References: <20230710202733.116133-1-martin@kaiser.cx> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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: INBOX X-GMAIL-THRID: 1771067795427529480 X-GMAIL-MSGID: 1771067795427529480 There's no need to disable the rng in ingenic_trng_remove. The driver's init function sets the CFG_GEN_EN bit to enable the rng. The cleanup function clears CFG_GEN_EN to revert this. The remove function calls hwrng_unregister. If the ingenic-trng is not the current rng at this point, CFG_GEN_EN has already been cleared. If the ingenic-trng is the current rng, drop_current_rng will call the cleanup function. Signed-off-by: Martin Kaiser --- drivers/char/hw_random/ingenic-trng.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/char/hw_random/ingenic-trng.c b/drivers/char/hw_random/ingenic-trng.c index cc88a941c929..9c54721f8399 100644 --- a/drivers/char/hw_random/ingenic-trng.c +++ b/drivers/char/hw_random/ingenic-trng.c @@ -111,14 +111,9 @@ static int ingenic_trng_probe(struct platform_device *pdev) static int ingenic_trng_remove(struct platform_device *pdev) { struct ingenic_trng *trng = platform_get_drvdata(pdev); - unsigned int ctrl; hwrng_unregister(&trng->rng); - ctrl = readl(trng->base + TRNG_REG_CFG_OFFSET); - ctrl &= ~CFG_GEN_EN; - writel(ctrl, trng->base + TRNG_REG_CFG_OFFSET); - return 0; }