lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20240829072209.7253-8-liaoyuanhong@vivo.com>
Date: Thu, 29 Aug 2024 15:22:09 +0800
From: Liao Yuanhong <liaoyuanhong@...o.com>
To: alexandre.belloni@...tlin.com
Cc: linux-rtc@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Liao Yuanhong <liaoyuanhong@...o.com>
Subject: [PATCH v2 7/7] rtc:rtc-xgene:Use devm_clk_get_enabled() helpers

Use devm_clk_get_enabled() instead of clk functions in rtc-xgene.

Signed-off-by: Liao Yuanhong <liaoyuanhong@...o.com>
---
 drivers/rtc/rtc-xgene.c | 26 ++++----------------------
 1 file changed, 4 insertions(+), 22 deletions(-)

diff --git a/drivers/rtc/rtc-xgene.c b/drivers/rtc/rtc-xgene.c
index f78efc9760c0..cff29d18454c 100644
--- a/drivers/rtc/rtc-xgene.c
+++ b/drivers/rtc/rtc-xgene.c
@@ -162,43 +162,33 @@ static int xgene_rtc_probe(struct platform_device *pdev)
 		return ret;
 	}
 
-	pdata->clk = devm_clk_get(&pdev->dev, NULL);
+	pdata->clk = devm_clk_get_enabled(&pdev->dev, NULL);
 	if (IS_ERR(pdata->clk)) {
 		dev_err(&pdev->dev, "Couldn't get the clock for RTC\n");
 		return -ENODEV;
 	}
-	ret = clk_prepare_enable(pdata->clk);
-	if (ret)
-		return ret;
 
 	/* Turn on the clock and the crystal */
 	writel(RTC_CCR_EN, pdata->csr_base + RTC_CCR);
 
 	ret = device_init_wakeup(&pdev->dev, 1);
-	if (ret) {
-		clk_disable_unprepare(pdata->clk);
+	if (ret)
 		return ret;
-	}
 
 	pdata->rtc->ops = &xgene_rtc_ops;
 	pdata->rtc->range_max = U32_MAX;
 
 	ret = devm_rtc_register_device(pdata->rtc);
-	if (ret) {
-		clk_disable_unprepare(pdata->clk);
+	if (ret)
 		return ret;
-	}
 
 	return 0;
 }
 
 static void xgene_rtc_remove(struct platform_device *pdev)
 {
-	struct xgene_rtc_dev *pdata = platform_get_drvdata(pdev);
-
 	xgene_rtc_alarm_irq_enable(&pdev->dev, 0);
 	device_init_wakeup(&pdev->dev, 0);
-	clk_disable_unprepare(pdata->clk);
 }
 
 static int __maybe_unused xgene_rtc_suspend(struct device *dev)
@@ -220,7 +210,6 @@ static int __maybe_unused xgene_rtc_suspend(struct device *dev)
 	} else {
 		pdata->irq_enabled = xgene_rtc_alarm_irq_enabled(dev);
 		xgene_rtc_alarm_irq_enable(dev, 0);
-		clk_disable_unprepare(pdata->clk);
 	}
 	return 0;
 }
@@ -230,7 +219,6 @@ static int __maybe_unused xgene_rtc_resume(struct device *dev)
 	struct platform_device *pdev = to_platform_device(dev);
 	struct xgene_rtc_dev *pdata = platform_get_drvdata(pdev);
 	int irq;
-	int rc;
 
 	irq = platform_get_irq(pdev, 0);
 
@@ -239,14 +227,8 @@ static int __maybe_unused xgene_rtc_resume(struct device *dev)
 			disable_irq_wake(irq);
 			pdata->irq_wake = 0;
 		}
-	} else {
-		rc = clk_prepare_enable(pdata->clk);
-		if (rc) {
-			dev_err(dev, "Unable to enable clock error %d\n", rc);
-			return rc;
-		}
+	} else
 		xgene_rtc_alarm_irq_enable(dev, pdata->irq_enabled);
-	}
 
 	return 0;
 }
-- 
2.25.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ