Re: [PATCH 3/7] rtc:rtc-mt7622:Use devm_clk_get_enabled() helpers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Le 21/08/2024 à 11:28, Liao Yuanhong a écrit :
Use devm_clk_get_enabled() instead of clk functions in rtc-mt7622.

Signed-off-by: Liao Yuanhong <liaoyuanhong@xxxxxxxx>
---
  drivers/rtc/rtc-mt7622.c | 24 ++++--------------------
  1 file changed, 4 insertions(+), 20 deletions(-)

diff --git a/drivers/rtc/rtc-mt7622.c b/drivers/rtc/rtc-mt7622.c
index 094c649fc137..da1d9652d6da 100644
--- a/drivers/rtc/rtc-mt7622.c
+++ b/drivers/rtc/rtc-mt7622.c
@@ -315,27 +315,23 @@ static int mtk_rtc_probe(struct platform_device *pdev)
  	if (IS_ERR(hw->base))
  		return PTR_ERR(hw->base);
- hw->clk = devm_clk_get(&pdev->dev, "rtc");
+	hw->clk = devm_clk_get_enabled(&pdev->dev, "rtc");

Hi,

the clk field in struct mtk_rtc could also be easily removed now.

CJ

  	if (IS_ERR(hw->clk)) {
  		dev_err(&pdev->dev, "No clock\n");
  		return PTR_ERR(hw->clk);
  	}
- ret = clk_prepare_enable(hw->clk);
-	if (ret)
-		return ret;
-
  	hw->irq = platform_get_irq(pdev, 0);
  	if (hw->irq < 0) {
  		ret = hw->irq;
-		goto err;
+		return ret;
  	}
ret = devm_request_irq(&pdev->dev, hw->irq, mtk_rtc_alarmirq,
  			       0, dev_name(&pdev->dev), hw);
  	if (ret) {
  		dev_err(&pdev->dev, "Can't request IRQ\n");
-		goto err;
+		return ret;
  	}
mtk_rtc_hw_init(hw);
@@ -347,21 +343,10 @@ static int mtk_rtc_probe(struct platform_device *pdev)
  	if (IS_ERR(hw->rtc)) {
  		ret = PTR_ERR(hw->rtc);
  		dev_err(&pdev->dev, "Unable to register device\n");
-		goto err;
+		return ret;
  	}
return 0;
-err:
-	clk_disable_unprepare(hw->clk);
-
-	return ret;
-}
-
-static void mtk_rtc_remove(struct platform_device *pdev)
-{
-	struct mtk_rtc *hw = platform_get_drvdata(pdev);
-
-	clk_disable_unprepare(hw->clk);
  }
#ifdef CONFIG_PM_SLEEP
@@ -394,7 +379,6 @@ static SIMPLE_DEV_PM_OPS(mtk_rtc_pm_ops, mtk_rtc_suspend, mtk_rtc_resume);
static struct platform_driver mtk_rtc_driver = {
  	.probe	= mtk_rtc_probe,
-	.remove_new = mtk_rtc_remove,
  	.driver = {
  		.name = MTK_RTC_DEV,
  		.of_match_table = mtk_rtc_match,





[Index of Archives]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux