From: linux@armlinux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/3] rtc: gemini: Add optional clock handling
Date: Thu, 18 May 2017 23:30:00 +0100 [thread overview]
Message-ID: <20170518223000.GP22219@n2100.armlinux.org.uk> (raw)
In-Reply-To: <20170518215635.13505-1-linus.walleij@linaro.org>
On Thu, May 18, 2017 at 11:56:33PM +0200, Linus Walleij wrote:
> + rtc->pclk = clk_get(dev, "PCLK");
> + if (IS_ERR(rtc->pclk)) {
> + dev_err(dev, "could not get PCLK\n");
> + } else {
> + ret = clk_prepare_enable(rtc->pclk);
> + if (ret) {
> + dev_err(dev, "failed to enable PCLK\n");
> + return ret;
Proper cleanup? Maybe consider using devm_clk_get() right from the get-go?
> + }
> + }
> + rtc->extclk = clk_get(dev, "EXTCLK");
> + if (IS_ERR(rtc->extclk)) {
> + dev_err(dev, "could not get EXTCLK\n");
> + } else {
> + ret = clk_prepare_enable(rtc->extclk);
> + if (ret) {
> + dev_err(dev, "failed to enable EXTCLK\n");
> + return ret;
Ditto.
> + }
> + }
> +
> res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
> if (!res)
> return -ENODEV;
> @@ -156,6 +180,10 @@ static int gemini_rtc_remove(struct platform_device *pdev)
> {
> struct gemini_rtc *rtc = platform_get_drvdata(pdev);
>
> + if (!IS_ERR(rtc->extclk))
> + clk_disable_unprepare(rtc->extclk);
> + if (!IS_ERR(rtc->pclk))
> + clk_disable_unprepare(rtc->pclk);
No clk_put(), but if you used devm_clk_get(), you don't need it.
> rtc_device_unregister(rtc->rtc_dev);
>
> return 0;
> --
> 2.9.3
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
--
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
next prev parent reply other threads:[~2017-05-18 22:30 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-18 21:56 [PATCH 1/3] rtc: gemini: Add optional clock handling Linus Walleij
2017-05-18 21:56 ` [PATCH 2/3] rtc: gemini: Augment DT bindings for Faraday Linus Walleij
2017-05-23 14:27 ` Rob Herring
2017-05-18 21:56 ` [PATCH 3/3] rtc: gemini/ftrtc010: rename driver and symbols Linus Walleij
2017-05-19 18:10 ` Hans Ulli Kroll
2017-05-18 22:30 ` Russell King - ARM Linux [this message]
2017-05-19 18:11 ` [PATCH 1/3] rtc: gemini: Add optional clock handling Hans Ulli Kroll
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=20170518223000.GP22219@n2100.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=linux-arm-kernel@lists.infradead.org \
/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;
as well as URLs for NNTP newsgroup(s).