linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/12] Prepare various SH/R Mobile/Car drivers for CCF migration
@ 2013-10-28 22:49 Laurent Pinchart
  2013-10-28 22:49 ` [PATCH 01/12] clocksource: sh_cmt: Add clk_prepare/unprepare support Laurent Pinchart
                   ` (2 more replies)
  0 siblings, 3 replies; 28+ messages in thread
From: Laurent Pinchart @ 2013-10-28 22:49 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: linux-sh, Mike Turquette, Daniel Lezcano, linux-kernel,
	Tejun Heo, linux-ide, David Airlie, dri-devel, Wolfram Sang,
	linux-i2c, Chris Ball, Guennadi Liakhovetski, linux-mmc,
	Felipe Balbi, linux-usb, Greg Kroah-Hartman, Yoshihiro Shimoda,
	Jean-Christophe Plagniol-Villard, Tomi Valkeinen, linux-fbdev

Hello,

This patch series, based on v3.12-rc7, prepares various Renesas SH-Mobile,
R-Mobile and R-Car drivers for migration to CCF by adding clock prepare and
unprepare support.

The patches are pretty straightforward. Most of the drivers called
clk_enable and clk_disable in sleepable context, I've thus just converted them
to clk_prepare_enable and clk_disable_unprepare.

The clocksource drivers were slightly more complex to handle as clk_enable and
clk_disable were called in non-sleepable context. As the clocksource framework
architecture doesn't provide any sleepable callback in which clocks could be
prepared and unprepared, I've added clk_prepare and clk_unprepare calls in the
probe and suspend/resume handlers (clocksources can't be removed so the remove
handler doesn't need a clk_unprepare call).

I'd like to get all these patches merged in v3.14. As they will need to go
through their respective subsystems' trees, I would appreciate if all
maintainers involved could notify me when they merge patches from this series
in their tree to help me tracking the merge status. I don't plan to send pull
requests individually for these patches, and I will repost patches
individually if changes are requested during review.

Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: linux-kernel@vger.kernel.org
Cc: Tejun Heo <tj@kernel.org>
Cc: linux-ide@vger.kernel.org
Cc: David Airlie <airlied@linux.ie>
Cc: dri-devel@lists.freedesktop.org
Cc: Wolfram Sang <wsa@the-dreams.de>
Cc: linux-i2c@vger.kernel.org
Cc: Chris Ball <cjb@laptop.org>
Cc: Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com>
Cc: linux-mmc@vger.kernel.org
Cc: Felipe Balbi <balbi@ti.com>
Cc: linux-usb@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Cc: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: linux-fbdev@vger.kernel.org

Laurent Pinchart (12):
  clocksource: sh_cmt: Add clk_prepare/unprepare support
  clocksource: sh_mtu2: Add clk_prepare/unprepare support
  clocksource: sh_tmu: Add clk_prepare/unprepare support
  sata_rcar: Convert to clk_prepare/unprepare
  drm: shmob_drm: Convert to clk_prepare/unprepare
  i2c: sh_mobile: Convert to clk_prepare/unprepare
  mmc: sh_mmcif: Convert to clk_prepare/unprepare
  mmc: sh_mobile_sdhi: Convert to clk_prepare/unprepare
  usb: gadget: r8a66597-udc: Convert to clk_prepare/unprepare
  usb: r8a66597-hcd: Convert to clk_prepare/unprepare
  fbdev: shmobile-hdmi: Convert to clk_prepare/unprepare
  fbdev: shmobile-lcdcfb: Convert to clk_prepare/unprepare

 drivers/ata/sata_rcar.c                   | 10 +++++-----
 drivers/clocksource/sh_cmt.c              | 20 ++++++++++++++++----
 drivers/clocksource/sh_mtu2.c             | 16 ++++++++++++++--
 drivers/clocksource/sh_tmu.c              | 20 +++++++++++++++++---
 drivers/gpu/drm/shmobile/shmob_drm_crtc.c |  4 ++--
 drivers/i2c/busses/i2c-sh_mobile.c        |  8 ++++----
 drivers/mmc/host/sh_mmcif.c               | 12 ++++++------
 drivers/mmc/host/sh_mobile_sdhi.c         |  4 ++--
 drivers/usb/gadget/r8a66597-udc.c         |  6 +++---
 drivers/usb/host/r8a66597-hcd.c           |  4 ++--
 drivers/video/sh_mobile_hdmi.c            |  6 +++---
 drivers/video/sh_mobile_lcdcfb.c          |  4 ++--
 12 files changed, 76 insertions(+), 38 deletions(-)

-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH 01/12] clocksource: sh_cmt: Add clk_prepare/unprepare support
  2013-10-28 22:49 [PATCH 00/12] Prepare various SH/R Mobile/Car drivers for CCF migration Laurent Pinchart
@ 2013-10-28 22:49 ` Laurent Pinchart
  2013-10-29  5:55   ` Simon Horman
  2013-10-28 22:49 ` [PATCH 02/12] clocksource: sh_mtu2: " Laurent Pinchart
  2013-10-28 22:49 ` [PATCH 03/12] clocksource: sh_tmu: Add clk_prepare/unprepare support Laurent Pinchart
  2 siblings, 1 reply; 28+ messages in thread
From: Laurent Pinchart @ 2013-10-28 22:49 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: linux-sh, Mike Turquette, Daniel Lezcano, linux-kernel

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_cmt.c | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c
index 0965e98..940341a 100644
--- a/drivers/clocksource/sh_cmt.c
+++ b/drivers/clocksource/sh_cmt.c
@@ -634,12 +634,18 @@ static int sh_cmt_clock_event_next(unsigned long delta,
 
 static void sh_cmt_clock_event_suspend(struct clock_event_device *ced)
 {
-	pm_genpd_syscore_poweroff(&ced_to_sh_cmt(ced)->pdev->dev);
+	struct sh_cmt_priv *p = ced_to_sh_cmt(ced);
+
+	pm_genpd_syscore_poweroff(&p->pdev->dev);
+	clk_unprepare(p->clk);
 }
 
 static void sh_cmt_clock_event_resume(struct clock_event_device *ced)
 {
-	pm_genpd_syscore_poweron(&ced_to_sh_cmt(ced)->pdev->dev);
+	struct sh_cmt_priv *p = ced_to_sh_cmt(ced);
+
+	clk_prepare(p->clk);
+	pm_genpd_syscore_poweron(&p->pdev->dev);
 }
 
 static void sh_cmt_register_clockevent(struct sh_cmt_priv *p,
@@ -737,6 +743,10 @@ static int sh_cmt_setup(struct sh_cmt_priv *p, struct platform_device *pdev)
 		goto err2;
 	}
 
+	ret = clk_prepare(p->clk);
+	if (ret < 0)
+		goto err3;
+
 	if (res2 && (resource_size(res2) == 4)) {
 		/* assume both CMSTR and CMCSR to be 32-bit */
 		p->read_control = sh_cmt_read32;
@@ -773,19 +783,21 @@ static int sh_cmt_setup(struct sh_cmt_priv *p, struct platform_device *pdev)
 			      cfg->clocksource_rating);
 	if (ret) {
 		dev_err(&p->pdev->dev, "registration failed\n");
-		goto err3;
+		goto err4;
 	}
 	p->cs_enabled = false;
 
 	ret = setup_irq(irq, &p->irqaction);
 	if (ret) {
 		dev_err(&p->pdev->dev, "failed to request irq %d\n", irq);
-		goto err3;
+		goto err4;
 	}
 
 	platform_set_drvdata(pdev, p);
 
 	return 0;
+err4:
+	clk_unprepare(p->clk);
 err3:
 	clk_put(p->clk);
 err2:
-- 
1.8.1.5


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 02/12] clocksource: sh_mtu2: Add clk_prepare/unprepare support
  2013-10-28 22:49 [PATCH 00/12] Prepare various SH/R Mobile/Car drivers for CCF migration Laurent Pinchart
  2013-10-28 22:49 ` [PATCH 01/12] clocksource: sh_cmt: Add clk_prepare/unprepare support Laurent Pinchart
@ 2013-10-28 22:49 ` Laurent Pinchart
  2013-10-29  5:55   ` Simon Horman
                     ` (2 more replies)
  2013-10-28 22:49 ` [PATCH 03/12] clocksource: sh_tmu: Add clk_prepare/unprepare support Laurent Pinchart
  2 siblings, 3 replies; 28+ messages in thread
From: Laurent Pinchart @ 2013-10-28 22:49 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: linux-sh, Mike Turquette, Daniel Lezcano, linux-kernel

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_mtu2.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/clocksource/sh_mtu2.c b/drivers/clocksource/sh_mtu2.c
index 4aac9ee..3cf1283 100644
--- a/drivers/clocksource/sh_mtu2.c
+++ b/drivers/clocksource/sh_mtu2.c
@@ -313,8 +313,20 @@ static int sh_mtu2_setup(struct sh_mtu2_priv *p, struct platform_device *pdev)
 		goto err1;
 	}
 
-	return sh_mtu2_register(p, (char *)dev_name(&p->pdev->dev),
-				cfg->clockevent_rating);
+	ret = clk_prepare(p->clk);
+	if (ret < 0)
+		goto err2;
+
+	ret = sh_mtu2_register(p, (char *)dev_name(&p->pdev->dev),
+			       cfg->clockevent_rating);
+	if (ret < 0)
+		goto err3;
+
+	return 0;
+ err3:
+	clk_unprepare(p->clk);
+ err2:
+	clk_put(p->clk);
  err1:
 	iounmap(p->mapbase);
  err0:
-- 
1.8.1.5


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH 03/12] clocksource: sh_tmu: Add clk_prepare/unprepare support
  2013-10-28 22:49 [PATCH 00/12] Prepare various SH/R Mobile/Car drivers for CCF migration Laurent Pinchart
  2013-10-28 22:49 ` [PATCH 01/12] clocksource: sh_cmt: Add clk_prepare/unprepare support Laurent Pinchart
  2013-10-28 22:49 ` [PATCH 02/12] clocksource: sh_mtu2: " Laurent Pinchart
@ 2013-10-28 22:49 ` Laurent Pinchart
  2013-10-29  5:55   ` Simon Horman
                     ` (2 more replies)
  2 siblings, 3 replies; 28+ messages in thread
From: Laurent Pinchart @ 2013-10-28 22:49 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: linux-sh, Mike Turquette, Daniel Lezcano, linux-kernel

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 | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/drivers/clocksource/sh_tmu.c b/drivers/clocksource/sh_tmu.c
index 78b8dae..63557cd 100644
--- a/drivers/clocksource/sh_tmu.c
+++ b/drivers/clocksource/sh_tmu.c
@@ -472,12 +472,26 @@ 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;
 
-	return sh_tmu_register(p, (char *)dev_name(&p->pdev->dev),
-			       cfg->clockevent_rating,
-			       cfg->clocksource_rating);
+	ret = sh_tmu_register(p, (char *)dev_name(&p->pdev->dev),
+			      cfg->clockevent_rating,
+			      cfg->clocksource_rating);
+	if (ret < 0)
+		goto err3;
+
+	return 0;
+
+ err3:
+	clk_unprepare(p->clk);
+ err2:
+	clk_put(p->clk);
  err1:
 	iounmap(p->mapbase);
  err0:
-- 
1.8.1.5


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* Re: [PATCH 01/12] clocksource: sh_cmt: Add clk_prepare/unprepare support
  2013-10-28 22:49 ` [PATCH 01/12] clocksource: sh_cmt: Add clk_prepare/unprepare support Laurent Pinchart
@ 2013-10-29  5:55   ` Simon Horman
  2013-10-29  9:55     ` Laurent Pinchart
  0 siblings, 1 reply; 28+ messages in thread
From: Simon Horman @ 2013-10-29  5:55 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: linux-arm-kernel, linux-sh, Mike Turquette, Daniel Lezcano, linux-kernel

On Mon, Oct 28, 2013 at 11:49:18PM +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 Laurent,

I have queued this up in the clocksources branch of my renesas tree.
I will send a pull request to Mike once v3.13-rc1 has hit the shelves.
Mike, please let me know if you would prefer something earlier than that.

> ---
>  drivers/clocksource/sh_cmt.c | 20 ++++++++++++++++----
>  1 file changed, 16 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c
> index 0965e98..940341a 100644
> --- a/drivers/clocksource/sh_cmt.c
> +++ b/drivers/clocksource/sh_cmt.c
> @@ -634,12 +634,18 @@ static int sh_cmt_clock_event_next(unsigned long delta,
>  
>  static void sh_cmt_clock_event_suspend(struct clock_event_device *ced)
>  {
> -	pm_genpd_syscore_poweroff(&ced_to_sh_cmt(ced)->pdev->dev);
> +	struct sh_cmt_priv *p = ced_to_sh_cmt(ced);
> +
> +	pm_genpd_syscore_poweroff(&p->pdev->dev);
> +	clk_unprepare(p->clk);
>  }
>  
>  static void sh_cmt_clock_event_resume(struct clock_event_device *ced)
>  {
> -	pm_genpd_syscore_poweron(&ced_to_sh_cmt(ced)->pdev->dev);
> +	struct sh_cmt_priv *p = ced_to_sh_cmt(ced);
> +
> +	clk_prepare(p->clk);
> +	pm_genpd_syscore_poweron(&p->pdev->dev);
>  }
>  
>  static void sh_cmt_register_clockevent(struct sh_cmt_priv *p,
> @@ -737,6 +743,10 @@ static int sh_cmt_setup(struct sh_cmt_priv *p, struct platform_device *pdev)
>  		goto err2;
>  	}
>  
> +	ret = clk_prepare(p->clk);
> +	if (ret < 0)
> +		goto err3;
> +
>  	if (res2 && (resource_size(res2) == 4)) {
>  		/* assume both CMSTR and CMCSR to be 32-bit */
>  		p->read_control = sh_cmt_read32;
> @@ -773,19 +783,21 @@ static int sh_cmt_setup(struct sh_cmt_priv *p, struct platform_device *pdev)
>  			      cfg->clocksource_rating);
>  	if (ret) {
>  		dev_err(&p->pdev->dev, "registration failed\n");
> -		goto err3;
> +		goto err4;
>  	}
>  	p->cs_enabled = false;
>  
>  	ret = setup_irq(irq, &p->irqaction);
>  	if (ret) {
>  		dev_err(&p->pdev->dev, "failed to request irq %d\n", irq);
> -		goto err3;
> +		goto err4;
>  	}
>  
>  	platform_set_drvdata(pdev, p);
>  
>  	return 0;
> +err4:
> +	clk_unprepare(p->clk);
>  err3:
>  	clk_put(p->clk);
>  err2:
> -- 
> 1.8.1.5
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sh" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 02/12] clocksource: sh_mtu2: Add clk_prepare/unprepare support
  2013-10-28 22:49 ` [PATCH 02/12] clocksource: sh_mtu2: " Laurent Pinchart
@ 2013-10-29  5:55   ` Simon Horman
  2013-10-29 11:15   ` Sergei Shtylyov
  2013-10-29 14:30   ` [PATCH v2 1/2] clocksource: sh_mtu2: Release clock when sh_mtu2_register() fails Laurent Pinchart
  2 siblings, 0 replies; 28+ messages in thread
From: Simon Horman @ 2013-10-29  5:55 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: linux-arm-kernel, linux-sh, Mike Turquette, Daniel Lezcano, linux-kernel

On Mon, Oct 28, 2013 at 11:49:19PM +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>
> ---
>  drivers/clocksource/sh_mtu2.c | 16 ++++++++++++++--
>  1 file changed, 14 insertions(+), 2 deletions(-)

Thanks Laurent,

I have queued this up in the clocksources branch of my renesas tree.
I will send a pull request to Mike once v3.13-rc1 has hit the shelves.
Mike, please let me know if you would prefer something earlier than that.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 03/12] clocksource: sh_tmu: Add clk_prepare/unprepare support
  2013-10-28 22:49 ` [PATCH 03/12] clocksource: sh_tmu: Add clk_prepare/unprepare support Laurent Pinchart
@ 2013-10-29  5:55   ` Simon Horman
  2013-10-29 11:17   ` Sergei Shtylyov
  2013-10-29 14:31   ` [PATCH v2 1/2] clocksource: sh_tmu: Release clock when sh_tmu_register() fails Laurent Pinchart
  2 siblings, 0 replies; 28+ messages in thread
From: Simon Horman @ 2013-10-29  5:55 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: linux-arm-kernel, linux-sh, Mike Turquette, Daniel Lezcano, linux-kernel

On Mon, Oct 28, 2013 at 11:49:20PM +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>
> ---
>  drivers/clocksource/sh_tmu.c | 20 +++++++++++++++++---
>  1 file changed, 17 insertions(+), 3 deletions(-)

Thanks Laurent,

I have queued this up in the clocksources branch of my renesas tree.
I will send a pull request to Mike once v3.13-rc1 has hit the shelves.
Mike, please let me know if you would prefer something earlier than that.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 01/12] clocksource: sh_cmt: Add clk_prepare/unprepare support
  2013-10-29  5:55   ` Simon Horman
@ 2013-10-29  9:55     ` Laurent Pinchart
  2013-10-30  0:10       ` Simon Horman
  0 siblings, 1 reply; 28+ messages in thread
From: Laurent Pinchart @ 2013-10-29  9:55 UTC (permalink / raw)
  To: Simon Horman
  Cc: Laurent Pinchart, linux-arm-kernel, linux-sh, Mike Turquette,
	Daniel Lezcano, linux-kernel

Hi Simon,

On Tuesday 29 October 2013 14:55:35 Simon Horman wrote:
> On Mon, Oct 28, 2013 at 11:49:18PM +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 Laurent,
> 
> I have queued this up in the clocksources branch of my renesas tree.
> I will send a pull request to Mike once v3.13-rc1 has hit the shelves.
> Mike, please let me know if you would prefer something earlier than that.

I thought the clocksource patches had to go through Daniel's tree. If you can 
take them directly that's easier, so I'm fine with that. Does this imply your 
Acked-by (for patches 01 to 03) ?

> > ---
> > 
> >  drivers/clocksource/sh_cmt.c | 20 ++++++++++++++++----
> >  1 file changed, 16 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c
> > index 0965e98..940341a 100644
> > --- a/drivers/clocksource/sh_cmt.c
> > +++ b/drivers/clocksource/sh_cmt.c
> > @@ -634,12 +634,18 @@ static int sh_cmt_clock_event_next(unsigned long
> > delta,> 
> >  static void sh_cmt_clock_event_suspend(struct clock_event_device *ced)
> >  {
> > -	pm_genpd_syscore_poweroff(&ced_to_sh_cmt(ced)->pdev->dev);
> > +	struct sh_cmt_priv *p = ced_to_sh_cmt(ced);
> > +
> > +	pm_genpd_syscore_poweroff(&p->pdev->dev);
> > +	clk_unprepare(p->clk);
> >  }
> >  
> >  static void sh_cmt_clock_event_resume(struct clock_event_device *ced)
> >  {
> > -	pm_genpd_syscore_poweron(&ced_to_sh_cmt(ced)->pdev->dev);
> > +	struct sh_cmt_priv *p = ced_to_sh_cmt(ced);
> > +
> > +	clk_prepare(p->clk);
> > +	pm_genpd_syscore_poweron(&p->pdev->dev);
> >  }
> >  
> >  static void sh_cmt_register_clockevent(struct sh_cmt_priv *p,
> > 
> > @@ -737,6 +743,10 @@ static int sh_cmt_setup(struct sh_cmt_priv *p, struct
> > platform_device *pdev)> 
> >  		goto err2;
> >  	}
> > 
> > +	ret = clk_prepare(p->clk);
> > +	if (ret < 0)
> > +		goto err3;
> > +
> >  	if (res2 && (resource_size(res2) == 4)) {
> >  		/* assume both CMSTR and CMCSR to be 32-bit */
> >  		p->read_control = sh_cmt_read32;
> > @@ -773,19 +783,21 @@ static int sh_cmt_setup(struct sh_cmt_priv *p,
> > struct platform_device *pdev)> 
> >  			      cfg->clocksource_rating);
> >  	if (ret) {
> >  		dev_err(&p->pdev->dev, "registration failed\n");
> > -		goto err3;
> > +		goto err4;
> >  	}
> >  	p->cs_enabled = false;
> >  	
> >  	ret = setup_irq(irq, &p->irqaction);
> >  	if (ret) {
> >  		dev_err(&p->pdev->dev, "failed to request irq %d\n", irq);
> > -		goto err3;
> > +		goto err4;
> >  	}
> >  	
> >  	platform_set_drvdata(pdev, p);
> >  	
> >  	return 0;
> > 
> > +err4:
> > +	clk_unprepare(p->clk);
> >  err3:
> >  	clk_put(p->clk);
> >  err2:
-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 02/12] clocksource: sh_mtu2: Add clk_prepare/unprepare support
  2013-10-28 22:49 ` [PATCH 02/12] clocksource: sh_mtu2: " Laurent Pinchart
  2013-10-29  5:55   ` Simon Horman
@ 2013-10-29 11:15   ` Sergei Shtylyov
  2013-10-29 13:24     ` Laurent Pinchart
  2013-10-29 14:30   ` [PATCH v2 1/2] clocksource: sh_mtu2: Release clock when sh_mtu2_register() fails Laurent Pinchart
  2 siblings, 1 reply; 28+ messages in thread
From: Sergei Shtylyov @ 2013-10-29 11:15 UTC (permalink / raw)
  To: Laurent Pinchart, linux-arm-kernel
  Cc: linux-sh, Mike Turquette, Daniel Lezcano, linux-kernel

Hello.

On 29-10-2013 2:49, 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>
> ---
>   drivers/clocksource/sh_mtu2.c | 16 ++++++++++++++--
>   1 file changed, 14 insertions(+), 2 deletions(-)

> diff --git a/drivers/clocksource/sh_mtu2.c b/drivers/clocksource/sh_mtu2.c
> index 4aac9ee..3cf1283 100644
> --- a/drivers/clocksource/sh_mtu2.c
> +++ b/drivers/clocksource/sh_mtu2.c
> @@ -313,8 +313,20 @@ static int sh_mtu2_setup(struct sh_mtu2_priv *p, struct platform_device *pdev)
>   		goto err1;
>   	}
>
> -	return sh_mtu2_register(p, (char *)dev_name(&p->pdev->dev),
> -				cfg->clockevent_rating);
> +	ret = clk_prepare(p->clk);
> +	if (ret < 0)
> +		goto err2;
> +
> +	ret = sh_mtu2_register(p, (char *)dev_name(&p->pdev->dev),
> +			       cfg->clockevent_rating);
> +	if (ret < 0)
> +		goto err3;
> +
> +	return 0;
> + err3:
> +	clk_unprepare(p->clk);
> + err2:
> +	clk_put(p->clk);

    This one seems to be a fix and so needs to be in a separate patch...

WBR, Sergei


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 03/12] clocksource: sh_tmu: Add clk_prepare/unprepare support
  2013-10-28 22:49 ` [PATCH 03/12] clocksource: sh_tmu: Add clk_prepare/unprepare support Laurent Pinchart
  2013-10-29  5:55   ` Simon Horman
@ 2013-10-29 11:17   ` Sergei Shtylyov
  2013-10-29 14:31   ` [PATCH v2 1/2] clocksource: sh_tmu: Release clock when sh_tmu_register() fails Laurent Pinchart
  2 siblings, 0 replies; 28+ messages in thread
From: Sergei Shtylyov @ 2013-10-29 11:17 UTC (permalink / raw)
  To: Laurent Pinchart, linux-arm-kernel
  Cc: linux-sh, Mike Turquette, Daniel Lezcano, linux-kernel

On 29-10-2013 2:49, 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>
> ---
>   drivers/clocksource/sh_tmu.c | 20 +++++++++++++++++---
>   1 file changed, 17 insertions(+), 3 deletions(-)

> diff --git a/drivers/clocksource/sh_tmu.c b/drivers/clocksource/sh_tmu.c
> index 78b8dae..63557cd 100644
> --- a/drivers/clocksource/sh_tmu.c
> +++ b/drivers/clocksource/sh_tmu.c
> @@ -472,12 +472,26 @@ 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;
>
> -	return sh_tmu_register(p, (char *)dev_name(&p->pdev->dev),
> -			       cfg->clockevent_rating,
> -			       cfg->clocksource_rating);
> +	ret = sh_tmu_register(p, (char *)dev_name(&p->pdev->dev),
> +			      cfg->clockevent_rating,
> +			      cfg->clocksource_rating);
> +	if (ret < 0)
> +		goto err3;
> +
> +	return 0;
> +
> + err3:
> +	clk_unprepare(p->clk);
> + err2:
> +	clk_put(p->clk);

    This one seems to be a fix, and should be done separately.

WBR, Sergei


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 02/12] clocksource: sh_mtu2: Add clk_prepare/unprepare support
  2013-10-29 11:15   ` Sergei Shtylyov
@ 2013-10-29 13:24     ` Laurent Pinchart
  0 siblings, 0 replies; 28+ messages in thread
From: Laurent Pinchart @ 2013-10-29 13:24 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: Laurent Pinchart, linux-arm-kernel, linux-sh, Mike Turquette,
	Daniel Lezcano, linux-kernel

Hi Sergei,

On Tuesday 29 October 2013 15:15:09 Sergei Shtylyov wrote:
> On 29-10-2013 2:49, 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>
> > ---
> > 
> >   drivers/clocksource/sh_mtu2.c | 16 ++++++++++++++--
> >   1 file changed, 14 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/clocksource/sh_mtu2.c b/drivers/clocksource/sh_mtu2.c
> > index 4aac9ee..3cf1283 100644
> > --- a/drivers/clocksource/sh_mtu2.c
> > +++ b/drivers/clocksource/sh_mtu2.c
> > @@ -313,8 +313,20 @@ static int sh_mtu2_setup(struct sh_mtu2_priv *p,
> > struct platform_device *pdev)> 
> >   		goto err1;
> >   	}
> > 
> > -	return sh_mtu2_register(p, (char *)dev_name(&p->pdev->dev),
> > -				cfg->clockevent_rating);
> > +	ret = clk_prepare(p->clk);
> > +	if (ret < 0)
> > +		goto err2;
> > +
> > +	ret = sh_mtu2_register(p, (char *)dev_name(&p->pdev->dev),
> > +			       cfg->clockevent_rating);
> > +	if (ret < 0)
> > +		goto err3;
> > +
> > +	return 0;
> > + err3:
> > +	clk_unprepare(p->clk);
> > + err2:
> > +	clk_put(p->clk);
> 
>     This one seems to be a fix and so needs to be in a separate patch...

I'll split the patch and repost (same for 03/12)

-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCH v2 1/2] clocksource: sh_mtu2: Release clock when sh_mtu2_register() fails
  2013-10-28 22:49 ` [PATCH 02/12] clocksource: sh_mtu2: " Laurent Pinchart
  2013-10-29  5:55   ` Simon Horman
  2013-10-29 11:15   ` Sergei Shtylyov
@ 2013-10-29 14:30   ` Laurent Pinchart
  2013-10-29 14:30     ` [PATCH v2 2/2] clocksource: sh_mtu2: Add clk_prepare/unprepare support Laurent Pinchart
                       ` (2 more replies)
  2 siblings, 3 replies; 28+ messages in thread
From: Laurent Pinchart @ 2013-10-29 14:30 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: linux-sh, Mike Turquette, Daniel Lezcano, linux-kernel

Fix the probe error path to release the clock resource when the
sh_mtu2_register() call fails.

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_mtu2.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/clocksource/sh_mtu2.c b/drivers/clocksource/sh_mtu2.c
index 4aac9ee..e6cfb32 100644
--- a/drivers/clocksource/sh_mtu2.c
+++ b/drivers/clocksource/sh_mtu2.c
@@ -313,8 +313,15 @@ static int sh_mtu2_setup(struct sh_mtu2_priv *p, struct platform_device *pdev)
 		goto err1;
 	}
 
-	return sh_mtu2_register(p, (char *)dev_name(&p->pdev->dev),
-				cfg->clockevent_rating);
+	ret = sh_mtu2_register(p, (char *)dev_name(&p->pdev->dev),
+			       cfg->clockevent_rating);
+	if (ret < 0)
+		goto err2;
+
+	return 0;
+
+ err2:
+	clk_put(p->clk);
  err1:
 	iounmap(p->mapbase);
  err0:
-- 
1.8.1.5


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH v2 2/2] clocksource: sh_mtu2: Add clk_prepare/unprepare support
  2013-10-29 14:30   ` [PATCH v2 1/2] clocksource: sh_mtu2: Release clock when sh_mtu2_register() fails Laurent Pinchart
@ 2013-10-29 14:30     ` Laurent Pinchart
  2013-10-31  5:23       ` Simon Horman
  2013-11-08 10:10       ` Daniel Lezcano
  2013-10-31  5:23     ` [PATCH v2 1/2] clocksource: sh_mtu2: Release clock when sh_mtu2_register() fails Simon Horman
  2013-11-08 10:10     ` Daniel Lezcano
  2 siblings, 2 replies; 28+ messages in thread
From: Laurent Pinchart @ 2013-10-29 14:30 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: linux-sh, Mike Turquette, Daniel Lezcano, linux-kernel

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_mtu2.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/clocksource/sh_mtu2.c b/drivers/clocksource/sh_mtu2.c
index e6cfb32..3cf1283 100644
--- a/drivers/clocksource/sh_mtu2.c
+++ b/drivers/clocksource/sh_mtu2.c
@@ -313,13 +313,18 @@ static int sh_mtu2_setup(struct sh_mtu2_priv *p, struct platform_device *pdev)
 		goto err1;
 	}
 
+	ret = clk_prepare(p->clk);
+	if (ret < 0)
+		goto err2;
+
 	ret = sh_mtu2_register(p, (char *)dev_name(&p->pdev->dev),
 			       cfg->clockevent_rating);
 	if (ret < 0)
-		goto err2;
+		goto err3;
 
 	return 0;
-
+ err3:
+	clk_unprepare(p->clk);
  err2:
 	clk_put(p->clk);
  err1:
-- 
1.8.1.5


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH v2 1/2] clocksource: sh_tmu: Release clock when sh_tmu_register() fails
  2013-10-28 22:49 ` [PATCH 03/12] clocksource: sh_tmu: Add clk_prepare/unprepare support Laurent Pinchart
  2013-10-29  5:55   ` Simon Horman
  2013-10-29 11:17   ` Sergei Shtylyov
@ 2013-10-29 14:31   ` Laurent Pinchart
  2013-10-29 14:31     ` [PATCH v2 2/2] clocksource: sh_tmu: Add clk_prepare/unprepare support Laurent Pinchart
                       ` (2 more replies)
  2 siblings, 3 replies; 28+ messages in thread
From: Laurent Pinchart @ 2013-10-29 14:31 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: linux-sh, Mike Turquette, Daniel Lezcano, linux-kernel

Fix the probe error path to release the clock resource when the
sh_tmu_register() call fails.

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 | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/clocksource/sh_tmu.c b/drivers/clocksource/sh_tmu.c
index 78b8dae..1597837 100644
--- a/drivers/clocksource/sh_tmu.c
+++ b/drivers/clocksource/sh_tmu.c
@@ -475,9 +475,16 @@ static int sh_tmu_setup(struct sh_tmu_priv *p, struct platform_device *pdev)
 	p->cs_enabled = false;
 	p->enable_count = 0;
 
-	return sh_tmu_register(p, (char *)dev_name(&p->pdev->dev),
-			       cfg->clockevent_rating,
-			       cfg->clocksource_rating);
+	ret = sh_tmu_register(p, (char *)dev_name(&p->pdev->dev),
+			      cfg->clockevent_rating,
+			      cfg->clocksource_rating);
+	if (ret < 0)
+		goto err2;
+
+	return 0;
+
+ err2:
+	clk_put(p->clk);
  err1:
 	iounmap(p->mapbase);
  err0:
-- 
1.8.1.5


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH v2 2/2] clocksource: sh_tmu: Add clk_prepare/unprepare support
  2013-10-29 14:31   ` [PATCH v2 1/2] clocksource: sh_tmu: Release clock when sh_tmu_register() fails Laurent Pinchart
@ 2013-10-29 14:31     ` Laurent Pinchart
  2013-10-31  5:24       ` Simon Horman
  2013-11-08 10:10       ` Daniel Lezcano
  2013-10-31  5:23     ` [PATCH v2 1/2] clocksource: sh_tmu: Release clock when sh_tmu_register() fails Simon Horman
  2013-11-08 10:10     ` Daniel Lezcano
  2 siblings, 2 replies; 28+ messages in thread
From: Laurent Pinchart @ 2013-10-29 14:31 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: linux-sh, Mike Turquette, Daniel Lezcano, linux-kernel

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(-)

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:
-- 
1.8.1.5


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* Re: [PATCH 01/12] clocksource: sh_cmt: Add clk_prepare/unprepare support
  2013-10-29  9:55     ` Laurent Pinchart
@ 2013-10-30  0:10       ` Simon Horman
  2013-10-30  0:13         ` Laurent Pinchart
  0 siblings, 1 reply; 28+ messages in thread
From: Simon Horman @ 2013-10-30  0:10 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Laurent Pinchart, linux-arm-kernel, linux-sh, Mike Turquette,
	Daniel Lezcano, linux-kernel

On Tue, Oct 29, 2013 at 10:55:05AM +0100, Laurent Pinchart wrote:
> Hi Simon,
> 
> On Tuesday 29 October 2013 14:55:35 Simon Horman wrote:
> > On Mon, Oct 28, 2013 at 11:49:18PM +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 Laurent,
> > 
> > I have queued this up in the clocksources branch of my renesas tree.
> > I will send a pull request to Mike once v3.13-rc1 has hit the shelves.
> > Mike, please let me know if you would prefer something earlier than that.
> 
> I thought the clocksource patches had to go through Daniel's tree. If you can 
> take them directly that's easier, so I'm fine with that. Does this imply your 
> Acked-by (for patches 01 to 03) ?

Sorry, my mistake. The do go through Daniel. As a convenience
I have been picking up Renesas clocksource patches and passing
them on to Daniel. I'm happy to keep doing this. And I'm happy to
go the next step and add some entries to MAINTAINERS if that is
useful to others.

As I mentioned above I have queued these up (though not yet pushed them
as I got bogged down yesterday afternoon). But if you would
prefer Daniel to take them directly then please use the following:

Patches 01 - 03:

Acked-by: Simon Horman <horms+renesas@verge.net.au>

> 
> > > ---
> > > 
> > >  drivers/clocksource/sh_cmt.c | 20 ++++++++++++++++----
> > >  1 file changed, 16 insertions(+), 4 deletions(-)
> > > 
> > > diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c
> > > index 0965e98..940341a 100644
> > > --- a/drivers/clocksource/sh_cmt.c
> > > +++ b/drivers/clocksource/sh_cmt.c
> > > @@ -634,12 +634,18 @@ static int sh_cmt_clock_event_next(unsigned long
> > > delta,> 
> > >  static void sh_cmt_clock_event_suspend(struct clock_event_device *ced)
> > >  {
> > > -	pm_genpd_syscore_poweroff(&ced_to_sh_cmt(ced)->pdev->dev);
> > > +	struct sh_cmt_priv *p = ced_to_sh_cmt(ced);
> > > +
> > > +	pm_genpd_syscore_poweroff(&p->pdev->dev);
> > > +	clk_unprepare(p->clk);
> > >  }
> > >  
> > >  static void sh_cmt_clock_event_resume(struct clock_event_device *ced)
> > >  {
> > > -	pm_genpd_syscore_poweron(&ced_to_sh_cmt(ced)->pdev->dev);
> > > +	struct sh_cmt_priv *p = ced_to_sh_cmt(ced);
> > > +
> > > +	clk_prepare(p->clk);
> > > +	pm_genpd_syscore_poweron(&p->pdev->dev);
> > >  }
> > >  
> > >  static void sh_cmt_register_clockevent(struct sh_cmt_priv *p,
> > > 
> > > @@ -737,6 +743,10 @@ static int sh_cmt_setup(struct sh_cmt_priv *p, struct
> > > platform_device *pdev)> 
> > >  		goto err2;
> > >  	}
> > > 
> > > +	ret = clk_prepare(p->clk);
> > > +	if (ret < 0)
> > > +		goto err3;
> > > +
> > >  	if (res2 && (resource_size(res2) == 4)) {
> > >  		/* assume both CMSTR and CMCSR to be 32-bit */
> > >  		p->read_control = sh_cmt_read32;
> > > @@ -773,19 +783,21 @@ static int sh_cmt_setup(struct sh_cmt_priv *p,
> > > struct platform_device *pdev)> 
> > >  			      cfg->clocksource_rating);
> > >  	if (ret) {
> > >  		dev_err(&p->pdev->dev, "registration failed\n");
> > > -		goto err3;
> > > +		goto err4;
> > >  	}
> > >  	p->cs_enabled = false;
> > >  	
> > >  	ret = setup_irq(irq, &p->irqaction);
> > >  	if (ret) {
> > >  		dev_err(&p->pdev->dev, "failed to request irq %d\n", irq);
> > > -		goto err3;
> > > +		goto err4;
> > >  	}
> > >  	
> > >  	platform_set_drvdata(pdev, p);
> > >  	
> > >  	return 0;
> > > 
> > > +err4:
> > > +	clk_unprepare(p->clk);
> > >  err3:
> > >  	clk_put(p->clk);
> > >  err2:
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sh" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 01/12] clocksource: sh_cmt: Add clk_prepare/unprepare support
  2013-10-30  0:10       ` Simon Horman
@ 2013-10-30  0:13         ` Laurent Pinchart
  2013-10-30  0:27           ` Simon Horman
  0 siblings, 1 reply; 28+ messages in thread
From: Laurent Pinchart @ 2013-10-30  0:13 UTC (permalink / raw)
  To: Simon Horman
  Cc: Laurent Pinchart, linux-arm-kernel, linux-sh, Mike Turquette,
	Daniel Lezcano, linux-kernel

Hi Simon,

On Wednesday 30 October 2013 09:10:19 Simon Horman wrote:
> On Tue, Oct 29, 2013 at 10:55:05AM +0100, Laurent Pinchart wrote:
> > On Tuesday 29 October 2013 14:55:35 Simon Horman wrote:
> > > On Mon, Oct 28, 2013 at 11:49:18PM +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 Laurent,
> > > 
> > > I have queued this up in the clocksources branch of my renesas tree.
> > > I will send a pull request to Mike once v3.13-rc1 has hit the shelves.
> > > Mike, please let me know if you would prefer something earlier than
> > > that.
> > 
> > I thought the clocksource patches had to go through Daniel's tree. If you
> > can take them directly that's easier, so I'm fine with that. Does this
> > imply your Acked-by (for patches 01 to 03) ?
> 
> Sorry, my mistake. The do go through Daniel. As a convenience
> I have been picking up Renesas clocksource patches and passing
> them on to Daniel. I'm happy to keep doing this. And I'm happy to
> go the next step and add some entries to MAINTAINERS if that is
> useful to others.
> 
> As I mentioned above I have queued these up (though not yet pushed them
> as I got bogged down yesterday afternoon). But if you would
> prefer Daniel to take them directly then please use the following:
> 
> Patches 01 - 03:
> 
> Acked-by: Simon Horman <horms+renesas@verge.net.au>

I'm certainly fine with you picking the patches up, that would be helpful. 
Could I ask you to pick v2 up instead though ? :-)

> > > > ---
> > > > 
> > > >  drivers/clocksource/sh_cmt.c | 20 ++++++++++++++++----
> > > >  1 file changed, 16 insertions(+), 4 deletions(-)
> > > > 
> > > > diff --git a/drivers/clocksource/sh_cmt.c
> > > > b/drivers/clocksource/sh_cmt.c
> > > > index 0965e98..940341a 100644
> > > > --- a/drivers/clocksource/sh_cmt.c
> > > > +++ b/drivers/clocksource/sh_cmt.c
> > > > @@ -634,12 +634,18 @@ static int sh_cmt_clock_event_next(unsigned long
> > > > delta,>
> > > > 
> > > >  static void sh_cmt_clock_event_suspend(struct clock_event_device
> > > >  *ced)
> > > >  {
> > > > 
> > > > -	pm_genpd_syscore_poweroff(&ced_to_sh_cmt(ced)->pdev->dev);
> > > > +	struct sh_cmt_priv *p = ced_to_sh_cmt(ced);
> > > > +
> > > > +	pm_genpd_syscore_poweroff(&p->pdev->dev);
> > > > +	clk_unprepare(p->clk);
> > > > 
> > > >  }
> > > >  
> > > >  static void sh_cmt_clock_event_resume(struct clock_event_device *ced)
> > > >  {
> > > > 
> > > > -	pm_genpd_syscore_poweron(&ced_to_sh_cmt(ced)->pdev->dev);
> > > > +	struct sh_cmt_priv *p = ced_to_sh_cmt(ced);
> > > > +
> > > > +	clk_prepare(p->clk);
> > > > +	pm_genpd_syscore_poweron(&p->pdev->dev);
> > > > 
> > > >  }
> > > >  
> > > >  static void sh_cmt_register_clockevent(struct sh_cmt_priv *p,
> > > > 
> > > > @@ -737,6 +743,10 @@ static int sh_cmt_setup(struct sh_cmt_priv *p,
> > > > struct
> > > > platform_device *pdev)>
> > > > 
> > > >  		goto err2;
> > > >  	
> > > >  	}
> > > > 
> > > > +	ret = clk_prepare(p->clk);
> > > > +	if (ret < 0)
> > > > +		goto err3;
> > > > +
> > > > 
> > > >  	if (res2 && (resource_size(res2) == 4)) {
> > > >  	
> > > >  		/* assume both CMSTR and CMCSR to be 32-bit */
> > > >  		p->read_control = sh_cmt_read32;
> > > > 
> > > > @@ -773,19 +783,21 @@ static int sh_cmt_setup(struct sh_cmt_priv *p,
> > > > struct platform_device *pdev)>
> > > > 
> > > >  			      cfg->clocksource_rating);
> > > >  	
> > > >  	if (ret) {
> > > >  	
> > > >  		dev_err(&p->pdev->dev, "registration failed\n");
> > > > 
> > > > -		goto err3;
> > > > +		goto err4;
> > > > 
> > > >  	}
> > > >  	p->cs_enabled = false;
> > > >  	
> > > >  	ret = setup_irq(irq, &p->irqaction);
> > > >  	if (ret) {
> > > >  	
> > > >  		dev_err(&p->pdev->dev, "failed to request irq %d\n", irq);
> > > > 
> > > > -		goto err3;
> > > > +		goto err4;
> > > > 
> > > >  	}
> > > >  	
> > > >  	platform_set_drvdata(pdev, p);
> > > >  	
> > > >  	return 0;
> > > > 
> > > > +err4:
> > > > +	clk_unprepare(p->clk);
> > > > 
> > > >  err3:
> > > >  	clk_put(p->clk);
> > > >  
> > > >  err2:
-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH 01/12] clocksource: sh_cmt: Add clk_prepare/unprepare support
  2013-10-30  0:13         ` Laurent Pinchart
@ 2013-10-30  0:27           ` Simon Horman
  0 siblings, 0 replies; 28+ messages in thread
From: Simon Horman @ 2013-10-30  0:27 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Laurent Pinchart, linux-arm-kernel, linux-sh, Mike Turquette,
	Daniel Lezcano, linux-kernel

On Wed, Oct 30, 2013 at 01:13:40AM +0100, Laurent Pinchart wrote:
> Hi Simon,
> 
> On Wednesday 30 October 2013 09:10:19 Simon Horman wrote:
> > On Tue, Oct 29, 2013 at 10:55:05AM +0100, Laurent Pinchart wrote:
> > > On Tuesday 29 October 2013 14:55:35 Simon Horman wrote:
> > > > On Mon, Oct 28, 2013 at 11:49:18PM +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 Laurent,
> > > > 
> > > > I have queued this up in the clocksources branch of my renesas tree.
> > > > I will send a pull request to Mike once v3.13-rc1 has hit the shelves.
> > > > Mike, please let me know if you would prefer something earlier than
> > > > that.
> > > 
> > > I thought the clocksource patches had to go through Daniel's tree. If you
> > > can take them directly that's easier, so I'm fine with that. Does this
> > > imply your Acked-by (for patches 01 to 03) ?
> > 
> > Sorry, my mistake. The do go through Daniel. As a convenience
> > I have been picking up Renesas clocksource patches and passing
> > them on to Daniel. I'm happy to keep doing this. And I'm happy to
> > go the next step and add some entries to MAINTAINERS if that is
> > useful to others.
> > 
> > As I mentioned above I have queued these up (though not yet pushed them
> > as I got bogged down yesterday afternoon). But if you would
> > prefer Daniel to take them directly then please use the following:
> > 
> > Patches 01 - 03:
> > 
> > Acked-by: Simon Horman <horms+renesas@verge.net.au>
> 
> I'm certainly fine with you picking the patches up, that would be helpful. 
> Could I ask you to pick v2 up instead though ? :-)

Sure. I have dropped v1 and will pick up v2 when I see them.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH v2 1/2] clocksource: sh_mtu2: Release clock when sh_mtu2_register() fails
  2013-10-29 14:30   ` [PATCH v2 1/2] clocksource: sh_mtu2: Release clock when sh_mtu2_register() fails Laurent Pinchart
  2013-10-29 14:30     ` [PATCH v2 2/2] clocksource: sh_mtu2: Add clk_prepare/unprepare support Laurent Pinchart
@ 2013-10-31  5:23     ` Simon Horman
  2013-11-08 10:10     ` Daniel Lezcano
  2 siblings, 0 replies; 28+ messages in thread
From: Simon Horman @ 2013-10-31  5:23 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: linux-arm-kernel, linux-sh, Mike Turquette, Daniel Lezcano, linux-kernel

On Tue, Oct 29, 2013 at 03:30:44PM +0100, Laurent Pinchart wrote:
> Fix the probe error path to release the clock resource when the
> sh_mtu2_register() call fails.
> 
> 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.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH v2 2/2] clocksource: sh_mtu2: Add clk_prepare/unprepare support
  2013-10-29 14:30     ` [PATCH v2 2/2] clocksource: sh_mtu2: Add clk_prepare/unprepare support Laurent Pinchart
@ 2013-10-31  5:23       ` Simon Horman
  2013-11-08 10:10       ` Daniel Lezcano
  1 sibling, 0 replies; 28+ messages in thread
From: Simon Horman @ 2013-10-31  5:23 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: linux-arm-kernel, linux-sh, Mike Turquette, Daniel Lezcano, linux-kernel

On Tue, Oct 29, 2013 at 03:30:45PM +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.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH v2 1/2] clocksource: sh_tmu: Release clock when sh_tmu_register() fails
  2013-10-29 14:31   ` [PATCH v2 1/2] clocksource: sh_tmu: Release clock when sh_tmu_register() fails Laurent Pinchart
  2013-10-29 14:31     ` [PATCH v2 2/2] clocksource: sh_tmu: Add clk_prepare/unprepare support Laurent Pinchart
@ 2013-10-31  5:23     ` Simon Horman
  2013-11-08 10:10     ` Daniel Lezcano
  2 siblings, 0 replies; 28+ messages in thread
From: Simon Horman @ 2013-10-31  5:23 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: linux-arm-kernel, linux-sh, Mike Turquette, Daniel Lezcano, linux-kernel

On Tue, Oct 29, 2013 at 03:31:36PM +0100, Laurent Pinchart wrote:
> Fix the probe error path to release the clock resource when the
> sh_tmu_register() call fails.
> 
> 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.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH v2 2/2] clocksource: sh_tmu: Add clk_prepare/unprepare support
  2013-10-29 14:31     ` [PATCH v2 2/2] clocksource: sh_tmu: Add clk_prepare/unprepare support Laurent Pinchart
@ 2013-10-31  5:24       ` Simon Horman
  2013-11-07 13:40         ` Daniel Lezcano
  2013-11-08 10:10       ` Daniel Lezcano
  1 sibling, 1 reply; 28+ messages in thread
From: Simon Horman @ 2013-10-31  5:24 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: linux-arm-kernel, linux-sh, Mike Turquette, Daniel Lezcano, linux-kernel

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.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH v2 2/2] clocksource: sh_tmu: Add clk_prepare/unprepare support
  2013-10-31  5:24       ` Simon Horman
@ 2013-11-07 13:40         ` Daniel Lezcano
  2013-11-08  5:22           ` Simon Horman
  0 siblings, 1 reply; 28+ messages in thread
From: Daniel Lezcano @ 2013-11-07 13:40 UTC (permalink / raw)
  To: Simon Horman, Laurent Pinchart
  Cc: linux-arm-kernel, linux-sh, Mike Turquette, linux-kernel

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

-- 
  <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH v2 2/2] clocksource: sh_tmu: Add clk_prepare/unprepare support
  2013-11-07 13:40         ` Daniel Lezcano
@ 2013-11-08  5:22           ` Simon Horman
  0 siblings, 0 replies; 28+ messages in thread
From: Simon Horman @ 2013-11-08  5:22 UTC (permalink / raw)
  To: Daniel Lezcano
  Cc: Laurent Pinchart, linux-arm-kernel, linux-sh, Mike Turquette,
	linux-kernel

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>

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH v2 1/2] clocksource: sh_mtu2: Release clock when sh_mtu2_register() fails
  2013-10-29 14:30   ` [PATCH v2 1/2] clocksource: sh_mtu2: Release clock when sh_mtu2_register() fails Laurent Pinchart
  2013-10-29 14:30     ` [PATCH v2 2/2] clocksource: sh_mtu2: Add clk_prepare/unprepare support Laurent Pinchart
  2013-10-31  5:23     ` [PATCH v2 1/2] clocksource: sh_mtu2: Release clock when sh_mtu2_register() fails Simon Horman
@ 2013-11-08 10:10     ` Daniel Lezcano
  2 siblings, 0 replies; 28+ messages in thread
From: Daniel Lezcano @ 2013-11-08 10:10 UTC (permalink / raw)
  To: Laurent Pinchart, linux-arm-kernel; +Cc: linux-sh, Mike Turquette, linux-kernel

On 10/29/2013 03:30 PM, Laurent Pinchart wrote:
> Fix the probe error path to release the clock resource when the
> sh_mtu2_register() call fails.
>
> 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

> ---
>   drivers/clocksource/sh_mtu2.c | 11 +++++++++--
>   1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/clocksource/sh_mtu2.c b/drivers/clocksource/sh_mtu2.c
> index 4aac9ee..e6cfb32 100644
> --- a/drivers/clocksource/sh_mtu2.c
> +++ b/drivers/clocksource/sh_mtu2.c
> @@ -313,8 +313,15 @@ static int sh_mtu2_setup(struct sh_mtu2_priv *p, struct platform_device *pdev)
>   		goto err1;
>   	}
>
> -	return sh_mtu2_register(p, (char *)dev_name(&p->pdev->dev),
> -				cfg->clockevent_rating);
> +	ret = sh_mtu2_register(p, (char *)dev_name(&p->pdev->dev),
> +			       cfg->clockevent_rating);
> +	if (ret < 0)
> +		goto err2;
> +
> +	return 0;
> +
> + err2:
> +	clk_put(p->clk);
>    err1:
>   	iounmap(p->mapbase);
>    err0:
>


-- 
  <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH v2 2/2] clocksource: sh_mtu2: Add clk_prepare/unprepare support
  2013-10-29 14:30     ` [PATCH v2 2/2] clocksource: sh_mtu2: Add clk_prepare/unprepare support Laurent Pinchart
  2013-10-31  5:23       ` Simon Horman
@ 2013-11-08 10:10       ` Daniel Lezcano
  1 sibling, 0 replies; 28+ messages in thread
From: Daniel Lezcano @ 2013-11-08 10:10 UTC (permalink / raw)
  To: Laurent Pinchart, linux-arm-kernel; +Cc: linux-sh, Mike Turquette, linux-kernel

On 10/29/2013 03:30 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

> ---
>   drivers/clocksource/sh_mtu2.c | 9 +++++++--
>   1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/clocksource/sh_mtu2.c b/drivers/clocksource/sh_mtu2.c
> index e6cfb32..3cf1283 100644
> --- a/drivers/clocksource/sh_mtu2.c
> +++ b/drivers/clocksource/sh_mtu2.c
> @@ -313,13 +313,18 @@ static int sh_mtu2_setup(struct sh_mtu2_priv *p, struct platform_device *pdev)
>   		goto err1;
>   	}
>
> +	ret = clk_prepare(p->clk);
> +	if (ret < 0)
> +		goto err2;
> +
>   	ret = sh_mtu2_register(p, (char *)dev_name(&p->pdev->dev),
>   			       cfg->clockevent_rating);
>   	if (ret < 0)
> -		goto err2;
> +		goto err3;
>
>   	return 0;
> -
> + err3:
> +	clk_unprepare(p->clk);
>    err2:
>   	clk_put(p->clk);
>    err1:
>


-- 
  <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH v2 1/2] clocksource: sh_tmu: Release clock when sh_tmu_register() fails
  2013-10-29 14:31   ` [PATCH v2 1/2] clocksource: sh_tmu: Release clock when sh_tmu_register() fails Laurent Pinchart
  2013-10-29 14:31     ` [PATCH v2 2/2] clocksource: sh_tmu: Add clk_prepare/unprepare support Laurent Pinchart
  2013-10-31  5:23     ` [PATCH v2 1/2] clocksource: sh_tmu: Release clock when sh_tmu_register() fails Simon Horman
@ 2013-11-08 10:10     ` Daniel Lezcano
  2 siblings, 0 replies; 28+ messages in thread
From: Daniel Lezcano @ 2013-11-08 10:10 UTC (permalink / raw)
  To: Laurent Pinchart, linux-arm-kernel; +Cc: linux-sh, Mike Turquette, linux-kernel

On 10/29/2013 03:31 PM, Laurent Pinchart wrote:
> Fix the probe error path to release the clock resource when the
> sh_tmu_register() call fails.
>
> 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

> ---
>   drivers/clocksource/sh_tmu.c | 13 ++++++++++---
>   1 file changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/clocksource/sh_tmu.c b/drivers/clocksource/sh_tmu.c
> index 78b8dae..1597837 100644
> --- a/drivers/clocksource/sh_tmu.c
> +++ b/drivers/clocksource/sh_tmu.c
> @@ -475,9 +475,16 @@ static int sh_tmu_setup(struct sh_tmu_priv *p, struct platform_device *pdev)
>   	p->cs_enabled = false;
>   	p->enable_count = 0;
>
> -	return sh_tmu_register(p, (char *)dev_name(&p->pdev->dev),
> -			       cfg->clockevent_rating,
> -			       cfg->clocksource_rating);
> +	ret = sh_tmu_register(p, (char *)dev_name(&p->pdev->dev),
> +			      cfg->clockevent_rating,
> +			      cfg->clocksource_rating);
> +	if (ret < 0)
> +		goto err2;
> +
> +	return 0;
> +
> + err2:
> +	clk_put(p->clk);
>    err1:
>   	iounmap(p->mapbase);
>    err0:
>


-- 
  <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH v2 2/2] clocksource: sh_tmu: Add clk_prepare/unprepare support
  2013-10-29 14:31     ` [PATCH v2 2/2] clocksource: sh_tmu: Add clk_prepare/unprepare support Laurent Pinchart
  2013-10-31  5:24       ` Simon Horman
@ 2013-11-08 10:10       ` Daniel Lezcano
  1 sibling, 0 replies; 28+ messages in thread
From: Daniel Lezcano @ 2013-11-08 10:10 UTC (permalink / raw)
  To: Laurent Pinchart, linux-arm-kernel; +Cc: linux-sh, Mike Turquette, linux-kernel

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:
>


-- 
  <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog


^ permalink raw reply	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2013-11-08 10:10 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-28 22:49 [PATCH 00/12] Prepare various SH/R Mobile/Car drivers for CCF migration Laurent Pinchart
2013-10-28 22:49 ` [PATCH 01/12] clocksource: sh_cmt: Add clk_prepare/unprepare support Laurent Pinchart
2013-10-29  5:55   ` Simon Horman
2013-10-29  9:55     ` Laurent Pinchart
2013-10-30  0:10       ` Simon Horman
2013-10-30  0:13         ` Laurent Pinchart
2013-10-30  0:27           ` Simon Horman
2013-10-28 22:49 ` [PATCH 02/12] clocksource: sh_mtu2: " Laurent Pinchart
2013-10-29  5:55   ` Simon Horman
2013-10-29 11:15   ` Sergei Shtylyov
2013-10-29 13:24     ` Laurent Pinchart
2013-10-29 14:30   ` [PATCH v2 1/2] clocksource: sh_mtu2: Release clock when sh_mtu2_register() fails Laurent Pinchart
2013-10-29 14:30     ` [PATCH v2 2/2] clocksource: sh_mtu2: Add clk_prepare/unprepare support Laurent Pinchart
2013-10-31  5:23       ` Simon Horman
2013-11-08 10:10       ` Daniel Lezcano
2013-10-31  5:23     ` [PATCH v2 1/2] clocksource: sh_mtu2: Release clock when sh_mtu2_register() fails Simon Horman
2013-11-08 10:10     ` Daniel Lezcano
2013-10-28 22:49 ` [PATCH 03/12] clocksource: sh_tmu: Add clk_prepare/unprepare support Laurent Pinchart
2013-10-29  5:55   ` Simon Horman
2013-10-29 11:17   ` Sergei Shtylyov
2013-10-29 14:31   ` [PATCH v2 1/2] clocksource: sh_tmu: Release clock when sh_tmu_register() fails Laurent Pinchart
2013-10-29 14:31     ` [PATCH v2 2/2] clocksource: sh_tmu: Add clk_prepare/unprepare support Laurent Pinchart
2013-10-31  5:24       ` Simon Horman
2013-11-07 13:40         ` Daniel Lezcano
2013-11-08  5:22           ` Simon Horman
2013-11-08 10:10       ` Daniel Lezcano
2013-10-31  5:23     ` [PATCH v2 1/2] clocksource: sh_tmu: Release clock when sh_tmu_register() fails Simon Horman
2013-11-08 10:10     ` Daniel Lezcano

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).