[rtc-linux] Re: [PATCH v3 3/3] rtc: omap: Add external clock enabling support
From: Johan Hovold <johan@kernel.org>
Date: 2015-08-18 07:14:11
On Tue, Aug 18, 2015 at 11:48:44AM +0530, Keerthy wrote:
quoted hunk ↗ jump to hunk
Configure the clock source to external clock if available. External clock is preferred as it can be ticking during suspend. Signed-off-by: Keerthy <j-keerthy@ti.com> --- drivers/rtc/rtc-omap.c | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-)diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c index f31c012..255f7b7 100644 --- a/drivers/rtc/rtc-omap.c +++ b/drivers/rtc/rtc-omap.c
quoted hunk ↗ jump to hunk
@@ -555,11 +557,19 @@ static int omap_rtc_probe(struct platform_device *pdev) if (rtc->irq_alarm <= 0) return -ENOENT; - rtc->clk = devm_clk_get(&pdev->dev, "int-clk"); - - if (!IS_ERR(rtc->clk)) + rtc->clk = devm_clk_get(&pdev->dev, "ext-clk"); + if (!IS_ERR(rtc->clk)) { + rtc->has_ext_clk = true; clk_prepare_enable(rtc->clk); + } else { + rtc->clk = devm_clk_get(&pdev->dev, "int-clk"); + if (IS_ERR(rtc->clk)) + goto no_clk; + } + clk_prepare_enable(rtc->clk);
Just always check for errors before enabling here, and get rid of the double enable and goto above.
+ +no_clk:
Johan -- -- You received this message because you are subscribed to "rtc-linux". Membership options at http://groups.google.com/group/rtc-linux . Please read http://groups.google.com/group/rtc-linux/web/checklist before submitting a driver. --- You received this message because you are subscribed to the Google Groups "rtc-linux" group. To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/d/optout.