Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp804120rwi; Wed, 19 Oct 2022 03:13:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Ij2Zm3eo2I1j8VHu8P0lmN+qOZXbv9ywN2dLrjqScOXTBELncGJJ9G6Uv5GwYfLknQ4/7 X-Received: by 2002:a17:907:62a7:b0:789:48ea:ddb0 with SMTP id nd39-20020a17090762a700b0078948eaddb0mr5879616ejc.575.1666174417711; Wed, 19 Oct 2022 03:13:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666174417; cv=none; d=google.com; s=arc-20160816; b=0QXOr+uubipyW7Z0ddDHly62MvSc+f97cbyfQFb+jRbCAx/K/8GrKKF5MThl15u8Yb Kx+e6v62qtGv8FgCFDKRxboL6148NdEaZfYAFhB7jtEq3BvvP2RjxleRG1rFUc7f6ftl cWUxcevouCQgazbqOs29lIzTSHmzbYtqIjv0KrBdjmypnmGbpQGAACSgAaJbk+YO5pYn cmO0QKFv2Me737nKJ2Omaz5Kc0/EyQA0cOp3SongIY/nUsCf0R11pDDU2olsbugT2rkA 9g+kJyvNRX/rrOqrukI/YaqiPnaNlop166wQ3MF8YQZdC/OVvscNjFHYUI4LNMKt6MB6 nwrA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0fPCNKgkZiaLZKf38BTWUjY+CZaIbrEobHdeYN018Wk=; b=nOlKW7EWNtqjgKg/pZQ6vm0IsUURacpANYxNfWF5IAHHWn6QM4lblliMp3BD/Bp89X WZ52Vjn9o/Igu3D0DvmheqFNfXJw7c0TzZ2ULIUiXfgbwZbcDm+mMPCyErqihuaZOQ9Z vMI9fRdIeqKM3JmDxlC6pvDFLvdmjJWstfnR8s1EpuSEGedFSGgKbcQTu8Mpr9DvvDuk eif44YiEkpdYibNRW9NvTxQlapT7Adst2/XVz2GRLWjEHrWFoQo4DL77QOhn2Mif/0bO sKMy/cW+F1Vk6mPctpOK4Qk1dXDrqSDefxZP7fM2jILwBwpSu2VpA9Wp3Z0MHicYOp0y lmCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VPxriR0+; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f17-20020a0564021e9100b00456e33b69e1si17606534edf.347.2022.10.19.03.13.11; Wed, 19 Oct 2022 03:13:37 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VPxriR0+; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234583AbiJSJoe (ORCPT + 99 others); Wed, 19 Oct 2022 05:44:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234769AbiJSJlU (ORCPT ); Wed, 19 Oct 2022 05:41:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97A74D57D9; Wed, 19 Oct 2022 02:18:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CDE0661877; Wed, 19 Oct 2022 09:06:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E131BC433D7; Wed, 19 Oct 2022 09:06:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170372; bh=nHR/2PbanmSV3Ke5Rq57L14m7CqYrrb0pFEQAy9U4aQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VPxriR0+GRM9We3c8DXyhSfylhWOwegKTb1KzR/nXRxWH6cgcH0KQlm/0k1bK3aTT F3oR47LrWgxVUeiIlpIx8nNpYoscob+ZVwvBE34dD3ZvMM2U/r1R4hG2QF0cIJX+kt p5rajRMog6is9YMdemr3iSqC21/9LgNf0dt/egp8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Martin Kaiser , Herbert Xu , Sasha Levin Subject: [PATCH 6.0 629/862] hwrng: imx-rngc - use devm_clk_get_enabled Date: Wed, 19 Oct 2022 10:31:56 +0200 Message-Id: <20221019083317.708239220@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 From: Martin Kaiser [ Upstream commit 6a2bc448423cea44e7dba0f72d7c82ae04ab201e ] Use the new devm_clk_get_enabled function to get our clock. We don't have to disable and unprepare the clock ourselves any more in error paths and in the remove function. Signed-off-by: Martin Kaiser Signed-off-by: Herbert Xu Stable-dep-of: 10a2199caf43 ("hwrng: imx-rngc - Moving IRQ handler registering after imx_rngc_irq_mask_clear()") Signed-off-by: Sasha Levin --- drivers/char/hw_random/imx-rngc.c | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/drivers/char/hw_random/imx-rngc.c b/drivers/char/hw_random/imx-rngc.c index b05d676ca814..e32c52c10d4d 100644 --- a/drivers/char/hw_random/imx-rngc.c +++ b/drivers/char/hw_random/imx-rngc.c @@ -245,7 +245,7 @@ static int imx_rngc_probe(struct platform_device *pdev) if (IS_ERR(rngc->base)) return PTR_ERR(rngc->base); - rngc->clk = devm_clk_get(&pdev->dev, NULL); + rngc->clk = devm_clk_get_enabled(&pdev->dev, NULL); if (IS_ERR(rngc->clk)) { dev_err(&pdev->dev, "Can not get rng_clk\n"); return PTR_ERR(rngc->clk); @@ -255,26 +255,20 @@ static int imx_rngc_probe(struct platform_device *pdev) if (irq < 0) return irq; - ret = clk_prepare_enable(rngc->clk); - if (ret) - return ret; - ver_id = readl(rngc->base + RNGC_VER_ID); rng_type = ver_id >> RNGC_TYPE_SHIFT; /* * This driver supports only RNGC and RNGB. (There's a different * driver for RNGA.) */ - if (rng_type != RNGC_TYPE_RNGC && rng_type != RNGC_TYPE_RNGB) { - ret = -ENODEV; - goto err; - } + if (rng_type != RNGC_TYPE_RNGC && rng_type != RNGC_TYPE_RNGB) + return -ENODEV; ret = devm_request_irq(&pdev->dev, irq, imx_rngc_irq, 0, pdev->name, (void *)rngc); if (ret) { dev_err(rngc->dev, "Can't get interrupt working.\n"); - goto err; + return ret; } init_completion(&rngc->rng_op_done); @@ -294,14 +288,14 @@ static int imx_rngc_probe(struct platform_device *pdev) ret = imx_rngc_self_test(rngc); if (ret) { dev_err(rngc->dev, "self test failed\n"); - goto err; + return ret; } } ret = hwrng_register(&rngc->rng); if (ret) { dev_err(&pdev->dev, "hwrng registration failed\n"); - goto err; + return ret; } dev_info(&pdev->dev, @@ -309,11 +303,6 @@ static int imx_rngc_probe(struct platform_device *pdev) rng_type == RNGC_TYPE_RNGB ? 'B' : 'C', (ver_id >> RNGC_VER_MAJ_SHIFT) & 0xff, ver_id & 0xff); return 0; - -err: - clk_disable_unprepare(rngc->clk); - - return ret; } static int __exit imx_rngc_remove(struct platform_device *pdev) @@ -322,8 +311,6 @@ static int __exit imx_rngc_remove(struct platform_device *pdev) hwrng_unregister(&rngc->rng); - clk_disable_unprepare(rngc->clk); - return 0; } -- 2.35.1