Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp28006201rwd; Tue, 4 Jul 2023 11:08:23 -0700 (PDT) X-Google-Smtp-Source: APBJJlEN7SmHhF0h22GzfpvELZ90cGoao74sAa+pt1xgJtyJXj9BE2vESMoTLiHdb+YxpVHr1aHK X-Received: by 2002:a17:90b:1d83:b0:263:730b:f568 with SMTP id pf3-20020a17090b1d8300b00263730bf568mr15697880pjb.3.1688494103386; Tue, 04 Jul 2023 11:08:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688494103; cv=none; d=google.com; s=arc-20160816; b=erzu1b45dWMr3j9XmJ5G/MCHuEY+FjVYvuHZwPMTimz6rYHNgtViEFmVjbz3IZChuB SV6N4uQezRJ+VUTSyxHsxXcGhYXFHp7vbYNgp90Lh71iSFNHnSFlhhLJn8VHdCH98Jcg L1tKY/cJqge+ndHczMDXoa2L8Crk2rbPXERh6fWs+3b21HOl8KHV5z5f3onK241WpfRn nNq3cFQc8qytBseuz1bM6xOYYNnFP2ZVU1VHbz9KeiKUSIyPQGtjV43i2qccuwVrrBrr BfIz+ryDfq3jxIxmo8mMIAcKEeCT9ftugSh0BcjV4td2v1y+sPgDqoFxmq66Z94SFrLo blYQ== 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=yW1T5aVd81nPIOIoHH4RxZnIfjzCSw0xd9QOOcaTaBg=; fh=lO4wmMQhvm8y/jaHDv9dt1CS5yb5ZTFKyt5xlt/d/d8=; b=0EOqzEr1aCNFwZKDWZ+t63squGpmOc6i8XHMcSnfRkPqcQ95cNhFdVplJyNkMLKO+4 5TAGDYs008XtC8MMmQNu2ORi+3IYLpWXpWnKt2vUKT0rlfeBvULJB3xPyqbmimxhqp3v eAjh2rgM36wA73AIcDFmkInrgnfsV7elLklLjWBN2GWUAI5RNtTIPIM8g9ykU7RtBqDO 4aHjqGFvQP01FhZ7zVOYCddSGyMDXzIT0hsqPQq/P3y+Fv9XQeZjoh1bIkplxnuQE5vK CIfAwBwaLskwYguh8DEbt/usQ6eMqRUCfiyBgyf4JB50pPd2PPHwNMzHVB0TsBObO7zW beRg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v19-20020a17090a899300b002563fbb8a85si19976509pjn.111.2023.07.04.11.08.03; Tue, 04 Jul 2023 11:08:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-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-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230255AbjGDRdx (ORCPT + 99 others); Tue, 4 Jul 2023 13:33:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231642AbjGDRdw (ORCPT ); Tue, 4 Jul 2023 13:33:52 -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 4A34910D5; Tue, 4 Jul 2023 10:33:51 -0700 (PDT) Received: from ipservice-092-217-072-126.092.217.pools.vodafone-ip.de ([92.217.72.126] 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 1qGjuO-0000yT-DV; Tue, 04 Jul 2023 19:33:48 +0200 From: Martin Kaiser To: Herbert Xu Cc: Joshua Henderson , linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH 2/4] hwrng: pic32 - use devm_clk_get_enabled Date: Tue, 4 Jul 2023 19:32:01 +0200 Message-Id: <20230704173203.70706-3-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230704173203.70706-1-martin@kaiser.cx> References: <20230704173203.70706-1-martin@kaiser.cx> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE,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-crypto@vger.kernel.org Use devm_clk_get_enabled in the pic32 driver. Ensure that the clock is enabled as long as the driver is registered with the hwrng core. Fixes: 7ea39973d1e5 ("hwrng: pic32 - Use device-managed registration API") Signed-off-by: Martin Kaiser --- drivers/char/hw_random/pic32-rng.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/drivers/char/hw_random/pic32-rng.c b/drivers/char/hw_random/pic32-rng.c index 99c8bd0859a1..e04a054e8930 100644 --- a/drivers/char/hw_random/pic32-rng.c +++ b/drivers/char/hw_random/pic32-rng.c @@ -36,7 +36,6 @@ struct pic32_rng { void __iomem *base; struct hwrng rng; - struct clk *clk; }; /* @@ -70,6 +69,7 @@ static int pic32_rng_read(struct hwrng *rng, void *buf, size_t max, static int pic32_rng_probe(struct platform_device *pdev) { struct pic32_rng *priv; + struct clk *clk; u32 v; int ret; @@ -81,13 +81,9 @@ static int pic32_rng_probe(struct platform_device *pdev) if (IS_ERR(priv->base)) return PTR_ERR(priv->base); - priv->clk = devm_clk_get(&pdev->dev, NULL); - if (IS_ERR(priv->clk)) - return PTR_ERR(priv->clk); - - ret = clk_prepare_enable(priv->clk); - if (ret) - return ret; + clk = devm_clk_get_enabled(&pdev->dev, NULL); + if (IS_ERR(clk)) + return PTR_ERR(clk); /* enable TRNG in enhanced mode */ v = TRNGEN | TRNGMOD; @@ -98,15 +94,11 @@ static int pic32_rng_probe(struct platform_device *pdev) ret = devm_hwrng_register(&pdev->dev, &priv->rng); if (ret) - goto err_register; + return ret; platform_set_drvdata(pdev, priv); return 0; - -err_register: - clk_disable_unprepare(priv->clk); - return ret; } static int pic32_rng_remove(struct platform_device *pdev) @@ -114,7 +106,6 @@ static int pic32_rng_remove(struct platform_device *pdev) struct pic32_rng *rng = platform_get_drvdata(pdev); writel(0, rng->base + RNGCON); - clk_disable_unprepare(rng->clk); return 0; } -- 2.30.2