From patchwork Mon Jul 10 20:27:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 118072 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp59923vqm; Mon, 10 Jul 2023 13:39:18 -0700 (PDT) X-Google-Smtp-Source: APBJJlET6wQlUYtmiMUvUC9bwcIWYDaOhqnl8skiNlTEksJufT3QhXNfNF1fjp5i1t7e4bmUZhAY X-Received: by 2002:a17:906:7952:b0:98e:4f1:f987 with SMTP id l18-20020a170906795200b0098e04f1f987mr21139467ejo.3.1689021558222; Mon, 10 Jul 2023 13:39:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689021558; cv=none; d=google.com; s=arc-20160816; b=ePj0H/YacDOTpHF5osFSbV+F7JxbQDnXoQZdioF5VG1uw/whxoYD9uUB2jLrbACmQ/ 7vlDf3UpyuxyiI2SmqkpAYKowlQ9+a9swHI5nFNH+AqHngDxVx/eRctzO0wWMiSbsfcT NNYmMncVwIlU9DfO0QBdSaL6mJYx0PcgEv72nNG6ieIvAQ/Udg0CwTNdtAerBBxYlZdp TmHq0pNKXN6u/LHabFTSlDanywWClvmy2qt9nXDwrAb5RWAw0a0TOHJ1aySePOfdF2CB 9mFRw6GAvMQhQahnQ00+Lc84i6nQ3ODl3GJ5CeqOR5S2KsBYt8EhIO29hQXbeaJIo+yR gYtQ== 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=lKOjKWFhmIYH8ykh6p+nJ9NXANgqUKcVeDoigqoW1CY=; fh=GUQwZ7uCW3sOebrGSFJwPRX8di32vmIzxh/oFyyWwpA=; b=LSw9fZgintCBADdqBrijrirWXpYinUdGvE81m9Z5OCUf3HB68pMEyF65qodR3xNY5d gueUiFKx68bIuk6GCqkBAK5ZOahkMp5wV2DxjovV38J3EFZPLwLPVsco6F5dQY2De63a sL47sZG5jiEQDSJhQeNUfcmeq73ZRES1b9z2xWYuYYF+4D8b0pjeFOelxaB5XLoOqr1V EgryuYCPzcd0DeROqpi86h7R+q3wgH7FHvCiWtONTRy9mGKi7QZZBIHP7zpB2tLsGF7t OemlzGBM6TBLmdWYLJiDaevmLnKvzOSjPGRCwJQSBCClBOQBRlul1Qr5WGSMb+XqfZpo /64w== 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 lf16-20020a170907175000b0099331b3e6f6si344506ejc.661.2023.07.10.13.38.54; Mon, 10 Jul 2023 13:39:18 -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 S232174AbjGJU3h (ORCPT + 99 others); Mon, 10 Jul 2023 16:29:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231217AbjGJU3d (ORCPT ); Mon, 10 Jul 2023 16:29:33 -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 5A0D31B9; Mon, 10 Jul 2023 13:29:28 -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 1qIxVd-0002mg-ET; Mon, 10 Jul 2023 22:29:25 +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 1/7] hwrng: ingenic - enable compile testing Date: Mon, 10 Jul 2023 22:27:27 +0200 Message-Id: <20230710202733.116133-2-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: 1771067469298649760 X-GMAIL-MSGID: 1771067469298649760 Enable compile testing for the ingenic-trng driver. Remove the dependency on HW_RANDOM. The ingenic-trng config section is under "if HW_RANDOM". Signed-off-by: Martin Kaiser --- drivers/char/hw_random/Kconfig | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/char/hw_random/Kconfig b/drivers/char/hw_random/Kconfig index 1aeba12391a1..5d72b8da3c36 100644 --- a/drivers/char/hw_random/Kconfig +++ b/drivers/char/hw_random/Kconfig @@ -271,8 +271,7 @@ config HW_RANDOM_INGENIC_RNG config HW_RANDOM_INGENIC_TRNG tristate "Ingenic True Random Number Generator support" - depends on HW_RANDOM - depends on MACH_X1830 + depends on MACH_X1830 || COMPILE_TEST default HW_RANDOM help This driver provides kernel-side support for the True Random Number Generator From patchwork Mon Jul 10 20:27:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 118077 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp62657vqm; Mon, 10 Jul 2023 13:45:48 -0700 (PDT) X-Google-Smtp-Source: APBJJlEn0pq9zskONOkXxyADeciD8o1p4ji5Ug0Im/44IEXlzDxTGkQnjof/mHb+TufRBiINxXC9 X-Received: by 2002:a50:ee8a:0:b0:51e:3bb0:aa44 with SMTP id f10-20020a50ee8a000000b0051e3bb0aa44mr9454806edr.17.1689021927293; Mon, 10 Jul 2023 13:45:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689021927; cv=none; d=google.com; s=arc-20160816; b=OJVbBpk8Ae6QE/Mb2wG3GPCukrwBpcXZe1ZHzmazQH7kDk8fVG9xVUjEtNa/Egm2VA YIMi7cA942KZlqYj8m7TAwweHzD7+PE86x+d/TkziIDN0w7OnzMe9+Qth630+yZQJFco IWgwbjOmZjtPlVJi/1EJHGZiQcncxExhArKQK8oF50JRRt32TjnFI01foolYol97W47h DBMlsLgEUe5N99nzzat7YqnMtVkf21cNDdGn4gq2MKqpOFWZchRFKa8d/ZZX9WpGYG00 OCRINRvOC4yNl9p5bKOJmMLlMjtEg3wFQxemfrN5tTJWMiT2Yax8S9tqLglDsykSC+QK NzBA== 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=2d0oLrcfSbT2hn8XEJ+5QwZTiiy/B0Mk3vCcovJ4LwI=; fh=GUQwZ7uCW3sOebrGSFJwPRX8di32vmIzxh/oFyyWwpA=; b=phGsm507GOASz98iUfZmwMfJcbyeoe98Inwq1bVw/vPII0QddHLO2hD9evpQqUhBKy Hw1BpRFdQYkmy2FPbC9/wRqBckZF/k+7GF/iFz9OXnC2SQGlfzw1JIlM2YD6XiGN3j/x eG0Lsw8WhsjPBmtiRsU2mFydqoSD4C5zA6RxO2TO8g3xpZnHxgvBqe+gVVOfu6uZNceV 2/n5aLYlXke/+3qhCLktLfsQdbomDOurC5ZxmyC3VGZjCYusoXtAimxz31SZEvd4WGfq PYLFL9DsRs1b5M1q2zLcar+uI1y0TDiTT7ru+TjCtF/oFwjFCtZ8QG50RmLoMhcExqDv wXMw== 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 f25-20020a50ee99000000b0051e2667a8absi389943edr.94.2023.07.10.13.45.04; Mon, 10 Jul 2023 13:45:27 -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 S229468AbjGJU34 (ORCPT + 99 others); Mon, 10 Jul 2023 16:29:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231769AbjGJU3e (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 21BF91BB; Mon, 10 Jul 2023 13:29:29 -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 1qIxVe-0002mg-9D; Mon, 10 Jul 2023 22:29:26 +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 2/7] hwrng: ingenic - remove two unused defines Date: Mon, 10 Jul 2023 22:27:28 +0200 Message-Id: <20230710202733.116133-3-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: 1771067856327182494 X-GMAIL-MSGID: 1771067856327182494 Remove two defines which are not used in the ingenic-trng driver's code. Signed-off-by: Martin Kaiser --- drivers/char/hw_random/ingenic-trng.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/char/hw_random/ingenic-trng.c b/drivers/char/hw_random/ingenic-trng.c index 0eb80f786f4d..64286cbdf158 100644 --- a/drivers/char/hw_random/ingenic-trng.c +++ b/drivers/char/hw_random/ingenic-trng.c @@ -22,8 +22,6 @@ #define TRNG_REG_STATUS_OFFSET 0x08 /* bits within the CFG register */ -#define CFG_RDY_CLR BIT(12) -#define CFG_INT_MASK BIT(11) #define CFG_GEN_EN BIT(0) /* bits within the STATUS register */ From patchwork Mon Jul 10 20:27:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 118071 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp57882vqm; Mon, 10 Jul 2023 13:34:47 -0700 (PDT) X-Google-Smtp-Source: APBJJlGt1lZRIV4BVXnJ1PegsdkVaoglIZsnw3IJwJOPR4XdBlq9XWRX/qxdIy9cl2uPyAMFESo8 X-Received: by 2002:a05:6a20:54a6:b0:12d:346f:d8ac with SMTP id i38-20020a056a2054a600b0012d346fd8acmr17493303pzk.44.1689021286962; Mon, 10 Jul 2023 13:34:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689021286; cv=none; d=google.com; s=arc-20160816; b=DI9MZBgqo7leX5cKAqJZaKl/fcnSCTCo4l4A7kgup7TdtSCzegISAnkgvet0xT6pxX v7/p03PwVTqhOK270SAahqlyruySUE2tEkYolywW3VCSrcM8uaP/pKVjcXtgwXrDEiub 9s+2IWNIpsHsX5FxGuhGw3Ad+kqyBx60VeDjwKTh7qvcoutHrByUG5WTQ0NG2uXzBgk7 pj5HFF/z5WAVWGfdTuTdyFWV6GyQgWcD0MmkylBkzaFyxjUZkT3nGpP4HENorZMzLDTk HZ8nDvGoZIlWd0mcPpXZzPjmQoU/HKEiw/eUzaMUdIy6rLrvYEvpxJzVup9bEWxThc0X cY1A== 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=NGagndghDOkiNn3CGVhgbcZSeOY+UYy66oNmW3rStuk=; fh=GUQwZ7uCW3sOebrGSFJwPRX8di32vmIzxh/oFyyWwpA=; b=BypYPBpUjCB5sKXKajhvTnk/MjBI0dO9IQq+GAK+XmH2GRQfyx6nfaLGORJer3jbM+ R3pRUS7FVxs6L7xZvXpJhz8OO8RXqokyw440cL3Cxl1xR/KzGb/gaFrdtpgamfCqHKq1 P2GbWH1xyZf58Bzm2Yk8kDAR3jgPMXpumFNrlANsQUFpZotyDzjXrwCCweE5+HlSWrGg qwvCZ5qQEMd/3qYHXj2Oi8nkbNCK++RGMAr2RV9G5p0yuFKwDWJSM4KQh/D3WSzCzibt sncydSy+RUuYzl2G1JAXx52r6EEiApcYPS/kS1DH6ePDKrY4I1tJHl3jlgyV7g1rs/d8 lp0w== 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 m190-20020a6326c7000000b0053ff537164fsi154163pgm.783.2023.07.10.13.34.33; Mon, 10 Jul 2023 13:34:46 -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 S232292AbjGJU3q (ORCPT + 99 others); Mon, 10 Jul 2023 16:29:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230406AbjGJU3e (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 F2642195; Mon, 10 Jul 2023 13:29:29 -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 1qIxVf-0002mg-1g; Mon, 10 Jul 2023 22:29:27 +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 3/7] hwrng: ingenic - remove dead assignments Date: Mon, 10 Jul 2023 22:27:29 +0200 Message-Id: <20230710202733.116133-4-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: 1771067185289474168 X-GMAIL-MSGID: 1771067185289474168 Don't assign a value to ret if we're about to return from the probe function and ret's value is not used. Signed-off-by: Martin Kaiser --- drivers/char/hw_random/ingenic-trng.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/char/hw_random/ingenic-trng.c b/drivers/char/hw_random/ingenic-trng.c index 64286cbdf158..bfec28ceab00 100644 --- a/drivers/char/hw_random/ingenic-trng.c +++ b/drivers/char/hw_random/ingenic-trng.c @@ -86,13 +86,11 @@ static int ingenic_trng_probe(struct platform_device *pdev) trng->base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(trng->base)) { pr_err("%s: Failed to map DTRNG registers\n", __func__); - ret = PTR_ERR(trng->base); return PTR_ERR(trng->base); } trng->clk = devm_clk_get(&pdev->dev, NULL); if (IS_ERR(trng->clk)) { - ret = PTR_ERR(trng->clk); pr_crit("%s: Cannot get DTRNG clock\n", __func__); return PTR_ERR(trng->clk); } From patchwork Mon Jul 10 20:27:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 118069 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp57655vqm; Mon, 10 Jul 2023 13:34:20 -0700 (PDT) X-Google-Smtp-Source: APBJJlHbFpSUvcF0y1iG4pjJtFzGPy4WjsBoO6dela4aI2fvV2y1jcc6HIBree/aV0zCJHhQYK/H X-Received: by 2002:a05:6a00:179b:b0:667:d0ff:6a0f with SMTP id s27-20020a056a00179b00b00667d0ff6a0fmr19704808pfg.5.1689021260074; Mon, 10 Jul 2023 13:34:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689021260; cv=none; d=google.com; s=arc-20160816; b=ScciN4O1RwmJT5Qk7+6Rloi4nCcV6NIcX8QNsg5Z/fLDJZnCTojPpmWwjVk+tpBLCm weReUtFiLhwJ2nTuM/piWDqu1MnOEaMcoQnSTcmqcDFQlUKjGuRvuuGaeI7cuAc8JS0P hMKkDDyrXq9xa03e1vSp1fkJ43XqzVq0pOBw5EOpDM3WQtURG9wDnmzDROZPycmi3oTt SlRjeqQ419yBqdCRlHjADyylDATjQPjo7u5yqr9UNKG6Jzy3g0XU7wcf0vQwf37tUDvQ F21t4wgelK0gF5V2ryWLHna4mUyfd9aCdQXLDL4u7JrwOSrtFlBX/25Qu4KaDhMn7oSN VOUw== 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=i/wbYjwFFvmTp0Y3JUIUuRNE6Y+C5dsFxTE78YP6G34=; fh=GUQwZ7uCW3sOebrGSFJwPRX8di32vmIzxh/oFyyWwpA=; b=Cj8QJ5q964PJCt3GCjjqUKDBWJysw7wqIz+R/5bc4MO3m9SOp16LC4xaIf4Rk7l7tR 6VJHheJptkKmJoeioSl1GznVgIEzqMSZZWcS9ZzrYQhZ2t6ErlSQkaE1/9KRSesohFaV gvoV9Wv6eVrX5rpn3JrqH25jIvUI+VZQPiCLgEb+tNRlOUHGd+M6U5H3Mne5OcOxWinR AWtAW6govxmNEgJdBSYHN2Gjl7ctf32KpGLaIzGuo5NA+gWH2xmyRNifRzu8ZbSz+nKj FG8ABVpcfTOZ2cCjf/9KFYngEy75P3TVpDjnWqg6/l8GRAxcpozAy1W1hj1P7EW8qGtu L1fw== 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 y11-20020a056a00190b00b006824cda542fsi215672pfi.395.2023.07.10.13.34.06; Mon, 10 Jul 2023 13:34:20 -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 S232271AbjGJU3n (ORCPT + 99 others); Mon, 10 Jul 2023 16:29:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231689AbjGJU3e (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 87165AD; Mon, 10 Jul 2023 13:29:30 -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 1qIxVf-0002mg-OH; Mon, 10 Jul 2023 22:29:27 +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 4/7] hwrng: ingenic - use devm_clk_get_enabled Date: Mon, 10 Jul 2023 22:27:30 +0200 Message-Id: <20230710202733.116133-5-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: 1771067156826100113 X-GMAIL-MSGID: 1771067156826100113 Use devm_clk_get_enabled in the ingenic-trng driver. We don't have to disable and unprepare the clock any more in error paths or in the remove function. Signed-off-by: Martin Kaiser --- drivers/char/hw_random/ingenic-trng.c | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/drivers/char/hw_random/ingenic-trng.c b/drivers/char/hw_random/ingenic-trng.c index bfec28ceab00..906fa78de47e 100644 --- a/drivers/char/hw_random/ingenic-trng.c +++ b/drivers/char/hw_random/ingenic-trng.c @@ -29,7 +29,6 @@ struct ingenic_trng { void __iomem *base; - struct clk *clk; struct hwrng rng; }; @@ -77,6 +76,7 @@ static int ingenic_trng_read(struct hwrng *rng, void *buf, size_t max, bool wait static int ingenic_trng_probe(struct platform_device *pdev) { struct ingenic_trng *trng; + struct clk *clk; int ret; trng = devm_kzalloc(&pdev->dev, sizeof(*trng), GFP_KERNEL); @@ -89,16 +89,10 @@ static int ingenic_trng_probe(struct platform_device *pdev) return PTR_ERR(trng->base); } - trng->clk = devm_clk_get(&pdev->dev, NULL); - if (IS_ERR(trng->clk)) { - pr_crit("%s: Cannot get DTRNG clock\n", __func__); - return PTR_ERR(trng->clk); - } - - ret = clk_prepare_enable(trng->clk); - if (ret) { - pr_crit("%s: Unable to enable DTRNG clock\n", __func__); - return ret; + clk = devm_clk_get_enabled(&pdev->dev, NULL); + if (IS_ERR(clk)) { + pr_crit("%s: Cannot get and enable DTRNG clock\n", __func__); + return PTR_ERR(clk); } trng->rng.name = pdev->name; @@ -109,17 +103,13 @@ static int ingenic_trng_probe(struct platform_device *pdev) ret = hwrng_register(&trng->rng); if (ret) { dev_err(&pdev->dev, "Failed to register hwrng\n"); - goto err_unprepare_clk; + return ret; } platform_set_drvdata(pdev, trng); dev_info(&pdev->dev, "Ingenic DTRNG driver registered\n"); return 0; - -err_unprepare_clk: - clk_disable_unprepare(trng->clk); - return ret; } static int ingenic_trng_remove(struct platform_device *pdev) @@ -133,8 +123,6 @@ static int ingenic_trng_remove(struct platform_device *pdev) ctrl &= ~CFG_GEN_EN; writel(ctrl, trng->base + TRNG_REG_CFG_OFFSET); - clk_disable_unprepare(trng->clk); - return 0; } From patchwork Mon Jul 10 20:27:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 118073 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp61798vqm; Mon, 10 Jul 2023 13:43:52 -0700 (PDT) X-Google-Smtp-Source: APBJJlEUYPBKdZ+bPH2ARxbOWxl71wbzt6QIEEULc/oZAEqgcIyzWXKt4g3iyezzcLeGSmzJW7sc X-Received: by 2002:aa7:d413:0:b0:51d:df35:3818 with SMTP id z19-20020aa7d413000000b0051ddf353818mr11246217edq.5.1689021832521; Mon, 10 Jul 2023 13:43:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689021832; cv=none; d=google.com; s=arc-20160816; b=wfunZlGTIwAEhEKUFkBYhOr+uNoXrYWCmmVfWK/axLGP0pzAuGpg99lM50AHxGjMDF JJRT2MSPQ2CwBwcLFtOhencqwJsVUe2GPGlsKvZZwGBjLd1qxJ21eIg9xD7qUq+Xvdbt tMZFVIOIaIPdJgiI6dnGQyLr8AyzeSJiYjLfpFxwAvo61KFvLMWqPluBqYVhU2JucVLa lUqyrPeVR4UymjIZrM6HNrkhCkx1ehgX1TfOG3bQnbgvzxapfC8zye2s9QyDF+vS9Nnr Iq1UOrlHnHAnyqvPumsMQSlioK32kXKA0t7YIlBUWyax1AAUPrWDFbxF1MgHhVwVyGJM Bsyw== 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=wNwIp2eDLifUPKEudLKPIWNgOcmAOkLaJHe+IIHR+GY=; fh=GUQwZ7uCW3sOebrGSFJwPRX8di32vmIzxh/oFyyWwpA=; b=dJ3Z6gIIgMTSTUAKzm6+RDDPniB5pc92zxl0ptYtJsMAVP8xkQ+2iq2R4ceMnm4KVk 6wF9cD0rw3AGW1kctqFMFdsRb+JQn9kC1QeQxScNPmM+RtZkM5kC5axhwZSy8oifAGSg U64+z+pxKFOscNzQyZ0SjXg8Vr1W16fzaE3EBKqYH5nyDhJ7vggvZ4Ka6NF7u+J0ihEm /eSQ1EhF9Q8dol5ftryEQa1ULFKK+NQhTwuluBx0ubJMfbDoIi11nTMbMrLfCsdQKeta nwjKc/WDvWzMa1dSyYZ2LATwqX9nloyxPqZMod0NaosqCxYJfVs2nwJiPW1IuFvDHfvw Hv7Q== 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 d12-20020aa7c1cc000000b0051e26731172si294756edp.672.2023.07.10.13.43.29; Mon, 10 Jul 2023 13:43:52 -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 S232382AbjGJU3s (ORCPT + 99 others); Mon, 10 Jul 2023 16:29:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232067AbjGJU3f (ORCPT ); Mon, 10 Jul 2023 16:29:35 -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 367B419A; 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 1qIxVg-0002mg-FV; Mon, 10 Jul 2023 22:29:28 +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 5/7] hwrng: ingenic - use dev_err_probe in error paths Date: Mon, 10 Jul 2023 22:27:31 +0200 Message-Id: <20230710202733.116133-6-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: 1771067756806905532 X-GMAIL-MSGID: 1771067756806905532 Use dev_err_probe in error paths to make the code a bit shorter. Signed-off-by: Martin Kaiser --- drivers/char/hw_random/ingenic-trng.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/drivers/char/hw_random/ingenic-trng.c b/drivers/char/hw_random/ingenic-trng.c index 906fa78de47e..cc88a941c929 100644 --- a/drivers/char/hw_random/ingenic-trng.c +++ b/drivers/char/hw_random/ingenic-trng.c @@ -84,16 +84,14 @@ static int ingenic_trng_probe(struct platform_device *pdev) return -ENOMEM; trng->base = devm_platform_ioremap_resource(pdev, 0); - if (IS_ERR(trng->base)) { - pr_err("%s: Failed to map DTRNG registers\n", __func__); - return PTR_ERR(trng->base); - } + if (IS_ERR(trng->base)) + return dev_err_probe(&pdev->dev, PTR_ERR(trng->base), + "%s: Failed to map DTRNG registers\n", __func__); clk = devm_clk_get_enabled(&pdev->dev, NULL); - if (IS_ERR(clk)) { - pr_crit("%s: Cannot get and enable DTRNG clock\n", __func__); - return PTR_ERR(clk); - } + if (IS_ERR(clk)) + return dev_err_probe(&pdev->dev, PTR_ERR(clk), + "%s: Cannot get and enable DTRNG clock\n", __func__); trng->rng.name = pdev->name; trng->rng.init = ingenic_trng_init; @@ -101,10 +99,8 @@ static int ingenic_trng_probe(struct platform_device *pdev) trng->rng.read = ingenic_trng_read; ret = hwrng_register(&trng->rng); - if (ret) { - dev_err(&pdev->dev, "Failed to register hwrng\n"); - return ret; - } + if (ret) + return dev_err_probe(&pdev->dev, ret, "Failed to register hwrng\n"); platform_set_drvdata(pdev, trng); 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; } From patchwork Mon Jul 10 20:27:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 118076 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp62457vqm; Mon, 10 Jul 2023 13:45:28 -0700 (PDT) X-Google-Smtp-Source: APBJJlGHAlkd+i/TJok84uRkCMeaVXhm7n7ppCTJRJ9NJalOfJWvVHlUT7uRMCxL4ffBtVo3ltta X-Received: by 2002:adf:fa51:0:b0:314:16d3:d1ee with SMTP id y17-20020adffa51000000b0031416d3d1eemr11609326wrr.68.1689021928710; Mon, 10 Jul 2023 13:45:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689021928; cv=none; d=google.com; s=arc-20160816; b=wDaC4CggmXSVrky2ABd9HS1truIyf8fwH9gQArkObh5b/DYHrSWfCgSBt2v3bGaBNo WHSMkGcTP/qXS9A1X3uD9rumB/Q+X5SquxfAfDbMGlUJwunJGVWVDs0ibOGdOpHvugwm jMiRyC+pbgrwYNevXqyD2vvoIejtHSpBDY8Ji5g0dxI5tUsojoYMzcDFXdEQUP0HkSj3 QzXqBid/Vrvi3+8LlbVjc4ZWqWuwpi/iC7dAVJs+s48eAlZaeoIzxVbYPHYMYeFnl+ie 6K81BU7b+saedhKqYM5+c6LwGbbred5hQb2TQMy7XxjiEQAwF8sF+birsbjgRikf+g/a wEPg== 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=5L4Y41EMlcZQIIM8iqchfzrMfSKqKG7eenir0Q2uofM=; fh=GUQwZ7uCW3sOebrGSFJwPRX8di32vmIzxh/oFyyWwpA=; b=YjBvQWRnPxAVhWFLWp653HMrLnkLSO9k4PHwucUnG12rgimAsecmahb3XN8njc2uYd 39oTc2nZ9TP19SatJkv7ivTdOgT/v/WnibTNSQlauxZWlNU9qRBnnnNpIlV6MxWfq/5l 9NTknAmS+o/Lk/n6wVL4M4vNkFEvIAkBjqCh7a/hjk/X1Ck9zoVU74Fo6A64awtNVAGg 5sKgihLRsdB+kik5onBmIXIQrv0T53/BMEF60HlI4cLO40qgkbRm3LgFDIgaubmjj/Nd ipDTuHZUqbrHRfkiWK7kTPjI+aFfpr6hC+fGVxYki9sjOpEiN1Z9xhFIsdJijzylYtWP QQLw== 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 jp25-20020a170906f75900b00992d8355decsi451885ejb.249.2023.07.10.13.45.05; Mon, 10 Jul 2023 13:45:28 -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 S232420AbjGJU3v (ORCPT + 99 others); Mon, 10 Jul 2023 16:29:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232143AbjGJU3g (ORCPT ); Mon, 10 Jul 2023 16:29:36 -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 E9E2D1AB; Mon, 10 Jul 2023 13:29:32 -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-Uz; 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 7/7] hwrng: ingenic - switch to device managed registration Date: Mon, 10 Jul 2023 22:27:33 +0200 Message-Id: <20230710202733.116133-8-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: 1771067857924759163 X-GMAIL-MSGID: 1771067857924759163 Call devm_hwrng_register for device managed registration of the ingenic-trng driver. ingenic_trng_remove can then be deleted. Signed-off-by: Martin Kaiser --- drivers/char/hw_random/ingenic-trng.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/drivers/char/hw_random/ingenic-trng.c b/drivers/char/hw_random/ingenic-trng.c index 9c54721f8399..3967a8dbe967 100644 --- a/drivers/char/hw_random/ingenic-trng.c +++ b/drivers/char/hw_random/ingenic-trng.c @@ -98,7 +98,7 @@ static int ingenic_trng_probe(struct platform_device *pdev) trng->rng.cleanup = ingenic_trng_cleanup; trng->rng.read = ingenic_trng_read; - ret = hwrng_register(&trng->rng); + ret = devm_hwrng_register(&pdev->dev, &trng->rng); if (ret) return dev_err_probe(&pdev->dev, ret, "Failed to register hwrng\n"); @@ -108,15 +108,6 @@ static int ingenic_trng_probe(struct platform_device *pdev) return 0; } -static int ingenic_trng_remove(struct platform_device *pdev) -{ - struct ingenic_trng *trng = platform_get_drvdata(pdev); - - hwrng_unregister(&trng->rng); - - return 0; -} - static const struct of_device_id ingenic_trng_of_match[] = { { .compatible = "ingenic,x1830-dtrng" }, { /* sentinel */ } @@ -125,7 +116,6 @@ MODULE_DEVICE_TABLE(of, ingenic_trng_of_match); static struct platform_driver ingenic_trng_driver = { .probe = ingenic_trng_probe, - .remove = ingenic_trng_remove, .driver = { .name = "ingenic-trng", .of_match_table = ingenic_trng_of_match,