From: Kartik Rajput <kkartik@nvidia.com>
To: <alexandre.belloni@bootlin.com>, <thierry.reding@gmail.com>,
<jonathanh@nvidia.com>, <andriy.shevchenko@linux.intel.com>,
<linux-rtc@vger.kernel.org>, <linux-tegra@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Cc: Kartik Rajput <kkartik@nvidia.com>
Subject: [PATCH v3 1/3] rtc: tegra: Use devm_clk_get_enabled() in probe
Date: Thu, 23 Oct 2025 15:00:40 +0530 [thread overview]
Message-ID: <20251023093042.770798-1-kkartik@nvidia.com> (raw)
Simplify clock management by replacing devm_clk_get() and manual clock
enable/disable with devm_clk_get_enabled(). This also simplifies the
error handling logic.
Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Kartik Rajput <kkartik@nvidia.com>
---
drivers/rtc/rtc-tegra.c | 18 ++++--------------
1 file changed, 4 insertions(+), 14 deletions(-)
diff --git a/drivers/rtc/rtc-tegra.c b/drivers/rtc/rtc-tegra.c
index 46788db89953..51f5bb55c176 100644
--- a/drivers/rtc/rtc-tegra.c
+++ b/drivers/rtc/rtc-tegra.c
@@ -300,14 +300,10 @@ static int tegra_rtc_probe(struct platform_device *pdev)
info->rtc->ops = &tegra_rtc_ops;
info->rtc->range_max = U32_MAX;
- info->clk = devm_clk_get(&pdev->dev, NULL);
+ info->clk = devm_clk_get_enabled(&pdev->dev, NULL);
if (IS_ERR(info->clk))
return PTR_ERR(info->clk);
- ret = clk_prepare_enable(info->clk);
- if (ret < 0)
- return ret;
-
/* set context info */
info->pdev = pdev;
spin_lock_init(&info->lock);
@@ -324,22 +320,16 @@ static int tegra_rtc_probe(struct platform_device *pdev)
ret = devm_request_irq(&pdev->dev, info->irq, tegra_rtc_irq_handler,
IRQF_TRIGGER_HIGH, dev_name(&pdev->dev),
&pdev->dev);
- if (ret) {
- dev_err(&pdev->dev, "failed to request interrupt: %d\n", ret);
- goto disable_clk;
- }
+ if (ret)
+ return dev_err_probe(&pdev->dev, ret, "failed to request interrupt\n");
ret = devm_rtc_register_device(info->rtc);
if (ret)
- goto disable_clk;
+ return ret;
dev_notice(&pdev->dev, "Tegra internal Real Time Clock\n");
return 0;
-
-disable_clk:
- clk_disable_unprepare(info->clk);
- return ret;
}
static void tegra_rtc_remove(struct platform_device *pdev)
--
2.43.0
next reply other threads:[~2025-10-23 9:31 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-23 9:30 Kartik Rajput [this message]
2025-10-23 9:30 ` [PATCH v3 2/3] rtc: tegra: Add ACPI support Kartik Rajput
2025-10-23 18:04 ` Andy Shevchenko
2025-10-23 9:30 ` [PATCH v3 3/3] rtc: tegra: Drop deprecated SIMPLE_DEV_PM_OPS Kartik Rajput
2025-10-23 18:04 ` Andy Shevchenko
2025-10-23 18:05 ` [PATCH v3 1/3] rtc: tegra: Use devm_clk_get_enabled() in probe Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251023093042.770798-1-kkartik@nvidia.com \
--to=kkartik@nvidia.com \
--cc=alexandre.belloni@bootlin.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=jonathanh@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rtc@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=thierry.reding@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®