Linux RTC
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Keerthy <j-keerthy@ti.com>
Cc: alexandre.belloni@free-electrons.com, tony@atomide.com,
	johan@kernel.org, linux-omap@vger.kernel.org,
	rtc-linux@googlegroups.com, grygorii.strashko@ti.com
Subject: [rtc-linux] Re: [PATCH v3 3/3] rtc: omap: Add external clock enabling support
Date: Tue, 18 Aug 2015 09:14:10 +0200	[thread overview]
Message-ID: <20150818071410.GA8151@localhost> (raw)
In-Reply-To: <1439878724-5828-4-git-send-email-j-keerthy@ti.com>

On Tue, Aug 18, 2015 at 11:48:44AM +0530, Keerthy wrote:
> 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
 
> @@ -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.

      reply	other threads:[~2015-08-18  7:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-18  6:18 [rtc-linux] [PATCH v3 0/2] ARM: AM437X: Add rtc clock handling Keerthy
2015-08-18  6:18 ` [rtc-linux] [PATCH v3 1/3] ARM: dts: AM437x: Add the internal and external clock nodes for rtc Keerthy
2015-08-18  6:18 ` [rtc-linux] [PATCH v3 2/3] rtc: omap: Add internal clock enabling support Keerthy
2015-08-18  6:18 ` [rtc-linux] [PATCH v3 3/3] rtc: omap: Add external " Keerthy
2015-08-18  7:14   ` Johan Hovold [this message]

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=20150818071410.GA8151@localhost \
    --to=johan@kernel.org \
    --cc=alexandre.belloni@free-electrons.com \
    --cc=grygorii.strashko@ti.com \
    --cc=j-keerthy@ti.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=rtc-linux@googlegroups.com \
    --cc=tony@atomide.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