All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Hilman <khilman@deeprootsystems.com>
To: Felipe Balbi <balbi@ti.com>
Cc: Tony Lindgren <tony@atomide.com>,
	Linux OMAP Mailing List <linux-omap@vger.kernel.org>
Subject: Re: [PATCH 2/5] arm: omap: counter-32k: convert to pm_runtime API
Date: Thu, 21 Oct 2010 10:46:11 -0700	[thread overview]
Message-ID: <87k4lbzbfg.fsf@deeprootsystems.com> (raw)
In-Reply-To: <1287480136-2046-3-git-send-email-balbi@ti.com> (Felipe Balbi's message of "Tue, 19 Oct 2010 12:22:13 +0300")

Felipe Balbi <balbi@ti.com> writes:

> Trivial patch removing clock framework and adding
> pm_runtime API.
>
> Signed-off-by: Felipe Balbi <balbi@ti.com>

Minor nit: the runtime PM 'put' calls do not need to be the _sync
versions.  You can easily get by using the "normal" (async) versions
here.

Kevin


> ---
>  arch/arm/plat-omap/counter-32k.c |   48 ++++++++++---------------------------
>  1 files changed, 13 insertions(+), 35 deletions(-)
>
> diff --git a/arch/arm/plat-omap/counter-32k.c b/arch/arm/plat-omap/counter-32k.c
> index f3fcb38..7bfd67a 100644
> --- a/arch/arm/plat-omap/counter-32k.c
> +++ b/arch/arm/plat-omap/counter-32k.c
> @@ -27,7 +27,7 @@
>  #include <linux/time.h>
>  #include <linux/clocksource.h>
>  #include <linux/platform_device.h>
> -#include <linux/clk.h>
> +#include <linux/pm_runtime.h>
>  #include <linux/err.h>
>  
>  struct omap_counter_32k_device {
> @@ -37,7 +37,6 @@ struct omap_counter_32k_device {
>  	cycles_t		last_cycles;
>  
>  	struct device		*dev;
> -	struct clk		*ick;
>  	void __iomem		*base;
>  
>  	/*
> @@ -117,7 +116,6 @@ static int __init omap_counter_32k_probe(struct platform_device *pdev)
>  {
>  	struct omap_counter_32k_device		*omap;
>  	struct resource			*res;
> -	struct clk			*ick;
>  
>  	int				ret;
>  
> @@ -130,11 +128,18 @@ static int __init omap_counter_32k_probe(struct platform_device *pdev)
>  		goto err0;
>  	}
>  
> +	pm_runtime_enable(&pdev->dev);
> +	ret = pm_runtime_get_sync(&pdev->dev);
> +	if (ret) {
> +		dev_dbg(&pdev->dev, "unable to enable runtime pm\n");
> +		goto err1;
> +	}
> +
>  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>  	if (!res) {
>  		dev_dbg(&pdev->dev, "couldn't get resource\n");
>  		ret = -ENODEV;
> -		goto err1;
> +		goto err2;
>  	}
>  
>  	base = ioremap(res->start, resource_size(res));
> @@ -144,22 +149,8 @@ static int __init omap_counter_32k_probe(struct platform_device *pdev)
>  		goto err2;
>  	}
>  
> -	ick = clk_get(&pdev->dev, "ick");
> -	if (IS_ERR(ick)) {
> -		dev_dbg(&pdev->dev, "couldn't get clock\n");
> -		ret = PTR_ERR(ick);
> -		goto err3;
> -	}
> -
> -	ret = clk_enable(ick);
> -	if (ret) {
> -		dev_dbg(&pdev->dev, "couldn't enable clock\n");
> -		goto err4;
> -	}
> -
>  	omap->base	= base;
>  	omap->dev	= &pdev->dev;
> -	omap->ick	= ick;
>  
>  	omap->cs.name	= "counter-32k";
>  	omap->cs.rating	= 250;
> @@ -174,7 +165,7 @@ static int __init omap_counter_32k_probe(struct platform_device *pdev)
>  	ret = clocksource_register(&omap->cs);
>  	if (ret) {
>  		dev_dbg(&pdev->dev, "failed to register clocksource\n");
> -		goto err5;
> +		goto err3;
>  	}
>  
>  	/* initialize our offset */
> @@ -190,16 +181,12 @@ static int __init omap_counter_32k_probe(struct platform_device *pdev)
>  
>  	return 0;
>  
> -err5:
> -	clk_disable(ick);
> -
> -err4:
> -	clk_put(ick);
> -
>  err3:
>  	iounmap(base);
>  
>  err2:
> +	pm_runtime_put_sync(&pdev->dev);
> +
>  err1:
>  	kfree(omap);
>  
> @@ -211,9 +198,8 @@ static int __exit omap_counter_32k_remove(struct platform_device *pdev)
>  {
>  	struct omap_counter_32k_device	*omap = platform_get_drvdata(pdev);
>  
> +	pm_runtime_put_sync(&pdev->dev);
>  	clocksource_unregister(&omap->cs);
> -	clk_disable(omap->ick);
> -	clk_put(omap->ick);
>  	iounmap(omap->base);
>  	kfree(omap);
>  	platform_set_drvdata(pdev, NULL);
> @@ -221,16 +207,8 @@ static int __exit omap_counter_32k_remove(struct platform_device *pdev)
>  	return 0;
>  }
>  
> -static void omap_counter_32k_shutdown(struct platform_device *pdev)
> -{
> -	struct omap_counter_32k_device	*omap = platform_get_drvdata(pdev);
> -
> -	clk_disable(omap->ick);
> -}
> -
>  static struct platform_driver omap_counter_32k_driver = {
>  	.remove		= __exit_p(omap_counter_32k_remove),
> -	.shutdown	= omap_counter_32k_shutdown,
>  	.driver		= {
>  		.name	= "omap-counter-32k",
>  	},

  reply	other threads:[~2010-10-21 17:46 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-19  9:22 [PATCH 0/5] 32k sync timer meets hwmod Felipe Balbi
2010-10-19  9:22 ` [PATCH 1/5] arm: omap1/2/3/4: convert 32k-sync driver to a platform_driver Felipe Balbi
2010-10-19  9:22 ` [PATCH 2/5] arm: omap: counter-32k: convert to pm_runtime API Felipe Balbi
2010-10-21 17:46   ` Kevin Hilman [this message]
2010-10-21 19:06     ` Felipe Balbi
2010-10-21 20:17       ` Kevin Hilman
2010-10-22  6:31         ` Felipe Balbi
2010-10-19  9:22 ` [PATCH 3/5] clocksource: move omap 32k timer to drivers/clocksource Felipe Balbi
2010-10-19  9:22 ` [PATCH 4/5] arm: omap: introduce 32k timer hwmod for omap2/3/4 Felipe Balbi
2010-10-20 21:32   ` Cousson, Benoit
2010-10-21  5:30     ` Felipe Balbi
2010-10-21 17:57   ` Kevin Hilman
2010-10-21 19:08     ` Felipe Balbi
2010-10-21 20:20       ` Kevin Hilman
2010-10-21 20:29   ` Kevin Hilman
2010-10-19  9:22 ` [PATCH 5/5] arm: omap: 32k: move to omap_device_build Felipe Balbi
2010-10-19  9:23 ` [PATCH 0/5] 32k sync timer meets hwmod Felipe Balbi
2010-10-20 21:29 ` Cousson, Benoit
2010-10-21  5:04   ` DebBarma, Tarun Kanti
2010-10-21 18:00 ` Kevin Hilman
2010-10-21 19:09   ` Felipe Balbi
2010-10-22 19:01     ` green
2010-10-25  7:45       ` Felipe Balbi

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=87k4lbzbfg.fsf@deeprootsystems.com \
    --to=khilman@deeprootsystems.com \
    --cc=balbi@ti.com \
    --cc=linux-omap@vger.kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.