diff mbox

[v2,2/2] clocksource: sh_tmu: Add clk_prepare/unprepare support

Message ID 1383057097-22689-2-git-send-email-laurent.pinchart+renesas@ideasonboard.com (mailing list archive)
State New, archived
Headers show

Commit Message

Laurent Pinchart Oct. 29, 2013, 2:31 p.m. UTC
Prepare the clock at probe time, as there is no other appropriate place
in the driver where we're allowed to sleep.

Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
 drivers/clocksource/sh_tmu.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Comments

Simon Horman Oct. 31, 2013, 5:24 a.m. UTC | #1
On Tue, Oct 29, 2013 at 03:31:37PM +0100, Laurent Pinchart wrote:
> Prepare the clock at probe time, as there is no other appropriate place
> in the driver where we're allowed to sleep.
> 
> Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

Thanks, I have queued this up.
Daniel Lezcano Nov. 7, 2013, 1:40 p.m. UTC | #2
On 10/31/2013 06:24 AM, Simon Horman wrote:
> On Tue, Oct 29, 2013 at 03:31:37PM +0100, Laurent Pinchart wrote:
>> Prepare the clock at probe time, as there is no other appropriate place
>> in the driver where we're allowed to sleep.
>>
>> Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
>> Cc: linux-kernel@vger.kernel.org
>> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
>
> Thanks, I have queued this up.

Ok, so those patches go through your tree, right ?

I have been out for the Linaro connect but I saw you picked them. In the 
future, I would prefer to take them in my tree as they fall under the 
drivers/clocksource maintainer's umbrella.

Thanks
   -- Daniel
Simon Horman Nov. 8, 2013, 5:22 a.m. UTC | #3
On Thu, Nov 07, 2013 at 02:40:49PM +0100, Daniel Lezcano wrote:
> On 10/31/2013 06:24 AM, Simon Horman wrote:
> >On Tue, Oct 29, 2013 at 03:31:37PM +0100, Laurent Pinchart wrote:
> >>Prepare the clock at probe time, as there is no other appropriate place
> >>in the driver where we're allowed to sleep.
> >>
> >>Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
> >>Cc: linux-kernel@vger.kernel.org
> >>Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> >
> >Thanks, I have queued this up.
> 
> Ok, so those patches go through your tree, right ?
> 
> I have been out for the Linaro connect but I saw you picked them. In
> the future, I would prefer to take them in my tree as they fall
> under the drivers/clocksource maintainer's umbrella.

I was planning to send a pull request to you.
But if you would rather just pick them up directly that is quite fine by me.

Acked-by: Simon Horman <horms+renesas@verge.net.au>
Daniel Lezcano Nov. 8, 2013, 10:10 a.m. UTC | #4
On 10/29/2013 03:31 PM, Laurent Pinchart wrote:
> Prepare the clock at probe time, as there is no other appropriate place
> in the driver where we're allowed to sleep.
>
> Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

Applied in my tree as 3.13 fixes

Thanks Laurent.

   -- Daniel

> ---
>   drivers/clocksource/sh_tmu.c | 9 ++++++++-
>   1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/clocksource/sh_tmu.c b/drivers/clocksource/sh_tmu.c
> index 1597837..63557cd 100644
> --- a/drivers/clocksource/sh_tmu.c
> +++ b/drivers/clocksource/sh_tmu.c
> @@ -472,6 +472,11 @@ static int sh_tmu_setup(struct sh_tmu_priv *p, struct platform_device *pdev)
>   		ret = PTR_ERR(p->clk);
>   		goto err1;
>   	}
> +
> +	ret = clk_prepare(p->clk);
> +	if (ret < 0)
> +		goto err2;
> +
>   	p->cs_enabled = false;
>   	p->enable_count = 0;
>
> @@ -479,10 +484,12 @@ static int sh_tmu_setup(struct sh_tmu_priv *p, struct platform_device *pdev)
>   			      cfg->clockevent_rating,
>   			      cfg->clocksource_rating);
>   	if (ret < 0)
> -		goto err2;
> +		goto err3;
>
>   	return 0;
>
> + err3:
> +	clk_unprepare(p->clk);
>    err2:
>   	clk_put(p->clk);
>    err1:
>
diff mbox

Patch

diff --git a/drivers/clocksource/sh_tmu.c b/drivers/clocksource/sh_tmu.c
index 1597837..63557cd 100644
--- a/drivers/clocksource/sh_tmu.c
+++ b/drivers/clocksource/sh_tmu.c
@@ -472,6 +472,11 @@  static int sh_tmu_setup(struct sh_tmu_priv *p, struct platform_device *pdev)
 		ret = PTR_ERR(p->clk);
 		goto err1;
 	}
+
+	ret = clk_prepare(p->clk);
+	if (ret < 0)
+		goto err2;
+
 	p->cs_enabled = false;
 	p->enable_count = 0;
 
@@ -479,10 +484,12 @@  static int sh_tmu_setup(struct sh_tmu_priv *p, struct platform_device *pdev)
 			      cfg->clockevent_rating,
 			      cfg->clocksource_rating);
 	if (ret < 0)
-		goto err2;
+		goto err3;
 
 	return 0;
 
+ err3:
+	clk_unprepare(p->clk);
  err2:
 	clk_put(p->clk);
  err1: