From patchwork Mon Aug 15 19:37:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 12944026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id ADA2EC25B08 for ; Mon, 15 Aug 2022 19:39:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=8MQuEtOg58tAX2MuQzLZ9bSKE7a8W4bTvObXcQLe8Ew=; b=f+zp+7dvrhYoUi pvp9JdOVoWhw5QyUxPBYiXpUxmuRBcN18/oBYXXzK4dK/yCdD5It25AtmcHGRoYhZ7GnunZtIjMwF 7xizVAUA0R4twtz4aglJxOcwQmt3q/ZDJ455Ma+IpuwNKZQJtpILjDiph88CE2neh2afoIo0WD91r lSVAQEbJpFH3T+7gzthjuzBAm/0kz3xxn9Ls9CJsQLgT/jJrBOSDEmYj7z10hz7Vj2gzNWTbAN9N9 B6iWIjED3vs2HflhjKelB0ZURmpC5KCysdMFRJDZ7LqwQe38Ze/RobI0MZefBZmDCCDausC1MRuG2 /eXINR4xMvn6khhxDf3A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oNfuY-0048Zh-Mi; Mon, 15 Aug 2022 19:38:06 +0000 Received: from viti.kaiser.cx ([2a01:238:43fe:e600:cd0c:bd4a:7a3:8e9f]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oNfuU-0048U2-QB for linux-arm-kernel@lists.infradead.org; Mon, 15 Aug 2022 19:38:04 +0000 Received: from dslb-188-096-143-237.188.096.pools.vodafone-ip.de ([188.96.143.237] 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 1oNfuP-000485-S1; Mon, 15 Aug 2022 21:37:57 +0200 From: Martin Kaiser To: Herbert Xu , Olivia Mackall Cc: linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH 2/2] hwrng: imx-rngc - use devres for hwrng registration Date: Mon, 15 Aug 2022 21:37:43 +0200 Message-Id: <20220815193743.105926-3-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220815193743.105926-1-martin@kaiser.cx> References: <20220815193743.105926-1-martin@kaiser.cx> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220815_123803_065385_8E66445D X-CRM114-Status: GOOD ( 13.96 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Replace hwrng_register with devm_hwrng_register and let devres unregister our hwrng when the device is removed. It's possible to do this now that devres also handles clock disable+uprepare. When we had to disable+unprepare the clock ourselves, we had to unregister the hwrng before this and couldn't use devres. There's nothing left to do for imx_rngc_remove, this function can go. Signed-off-by: Martin Kaiser --- drivers/char/hw_random/imx-rngc.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/drivers/char/hw_random/imx-rngc.c b/drivers/char/hw_random/imx-rngc.c index 23f490204341..97d8dc931ca6 100644 --- a/drivers/char/hw_random/imx-rngc.c +++ b/drivers/char/hw_random/imx-rngc.c @@ -292,7 +292,7 @@ static int imx_rngc_probe(struct platform_device *pdev) } } - ret = hwrng_register(&rngc->rng); + ret = devm_hwrng_register(&pdev->dev, &rngc->rng); if (ret) { dev_err(&pdev->dev, "hwrng registration failed\n"); return ret; @@ -305,15 +305,6 @@ static int imx_rngc_probe(struct platform_device *pdev) return 0; } -static int __exit imx_rngc_remove(struct platform_device *pdev) -{ - struct imx_rngc *rngc = platform_get_drvdata(pdev); - - hwrng_unregister(&rngc->rng); - - return 0; -} - static int __maybe_unused imx_rngc_suspend(struct device *dev) { struct imx_rngc *rngc = dev_get_drvdata(dev); @@ -346,7 +337,6 @@ static struct platform_driver imx_rngc_driver = { .pm = &imx_rngc_pm_ops, .of_match_table = imx_rngc_dt_ids, }, - .remove = __exit_p(imx_rngc_remove), }; module_platform_driver_probe(imx_rngc_driver, imx_rngc_probe);