diff mbox

[6/7] ARM: SAMSUNG: use clk_prepare_enable in samsung-time

Message ID 201303120145.21072.heiko@sntech.de (mailing list archive)
State New, archived
Headers show

Commit Message

Heiko Stuebner March 12, 2013, 12:45 a.m. UTC
The common clock framework expects clocks to be prepared
before they are enabled.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
---
 arch/arm/plat-samsung/samsung-time.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

Comments

Pankaj Jangra March 13, 2013, 4:59 p.m. UTC | #1
Hi,

On Tue, Mar 12, 2013 at 6:15 AM, Heiko Stübner <heiko@sntech.de> wrote:
> The common clock framework expects clocks to be prepared
> before they are enabled.
>
> Signed-off-by: Heiko Stuebner <heiko@sntech.de>
> ---
>  arch/arm/plat-samsung/samsung-time.c |    6 +++---
>  1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/arch/arm/plat-samsung/samsung-time.c b/arch/arm/plat-samsung/samsung-time.c
> index f899cbc..6ebb851 100644
> --- a/arch/arm/plat-samsung/samsung-time.c
> +++ b/arch/arm/plat-samsung/samsung-time.c
> @@ -355,7 +355,7 @@ static void __init samsung_timer_resources(void)
>         if (IS_ERR(timerclk))
>                 panic("failed to get timers clock for timer");
>
Also how about calling the clk_prepare_enable() only if the clk_get()
call is a sucess? Though clk framework will take care of it. Just
thinking even to avoid that call if clk_get() fails since you are
modifying the code.

> -       clk_enable(timerclk);
> +       clk_prepare_enable(timerclk);
>
>         sprintf(devname, "s3c24xx-pwm.%lu", event_id);
>         s3c_device_timer[event_id].id = event_id;
> @@ -369,7 +369,7 @@ static void __init samsung_timer_resources(void)
>         if (IS_ERR(tdiv_event))
>                 panic("failed to get pwm-tdiv clock for event timer");
>
Same here...
> -       clk_enable(tin_event);
> +       clk_prepare_enable(tin_event);
>
>         sprintf(devname, "s3c24xx-pwm.%lu", source_id);

Regards,
Pankaj Jangra
Heiko Stuebner March 13, 2013, 11:16 p.m. UTC | #2
Hi,

Am Mittwoch, 13. März 2013, 17:59:04 schrieb Pankaj Jangra:
> Hi,
> 
> On Tue, Mar 12, 2013 at 6:15 AM, Heiko Stübner <heiko@sntech.de> wrote:
> > The common clock framework expects clocks to be prepared
> > before they are enabled.
> > 
> > Signed-off-by: Heiko Stuebner <heiko@sntech.de>
> > ---
> > 
> >  arch/arm/plat-samsung/samsung-time.c |    6 +++---
> >  1 files changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/arch/arm/plat-samsung/samsung-time.c
> > b/arch/arm/plat-samsung/samsung-time.c index f899cbc..6ebb851 100644
> > --- a/arch/arm/plat-samsung/samsung-time.c
> > +++ b/arch/arm/plat-samsung/samsung-time.c
> > @@ -355,7 +355,7 @@ static void __init samsung_timer_resources(void)
> > 
> >         if (IS_ERR(timerclk))
> >         
> >                 panic("failed to get timers clock for timer");
> 
> Also how about calling the clk_prepare_enable() only if the clk_get()
> call is a sucess? Though clk framework will take care of it. Just
> thinking even to avoid that call if clk_get() fails since you are
> modifying the code.

I remember there was a discussion about panic vc error handling when this was 
introduced but I don't remember the specifics, but it seems they agreed to do 
it this way with letting the kernel panic when the clock is missing.


Also the current plan seems to replace the clocksource and pwm drivers that 
occupy the same register space with a driver handling both, making the pwm 
specific clocks obsolete and only the timers clock will remain. So this was 
merely meant as a fixup when using the clock changes with the current 
clocksource code.


> > -       clk_enable(timerclk);
> > +       clk_prepare_enable(timerclk);
> > 
> >         sprintf(devname, "s3c24xx-pwm.%lu", event_id);
> >         s3c_device_timer[event_id].id = event_id;
> > 
> > @@ -369,7 +369,7 @@ static void __init samsung_timer_resources(void)
> > 
> >         if (IS_ERR(tdiv_event))
> >         
> >                 panic("failed to get pwm-tdiv clock for event timer");
> 
> Same here...
> 
> > -       clk_enable(tin_event);
> > +       clk_prepare_enable(tin_event);
> > 
> >         sprintf(devname, "s3c24xx-pwm.%lu", source_id);
> 
> Regards,
> Pankaj Jangra
diff mbox

Patch

diff --git a/arch/arm/plat-samsung/samsung-time.c b/arch/arm/plat-samsung/samsung-time.c
index f899cbc..6ebb851 100644
--- a/arch/arm/plat-samsung/samsung-time.c
+++ b/arch/arm/plat-samsung/samsung-time.c
@@ -355,7 +355,7 @@  static void __init samsung_timer_resources(void)
 	if (IS_ERR(timerclk))
 		panic("failed to get timers clock for timer");
 
-	clk_enable(timerclk);
+	clk_prepare_enable(timerclk);
 
 	sprintf(devname, "s3c24xx-pwm.%lu", event_id);
 	s3c_device_timer[event_id].id = event_id;
@@ -369,7 +369,7 @@  static void __init samsung_timer_resources(void)
 	if (IS_ERR(tdiv_event))
 		panic("failed to get pwm-tdiv clock for event timer");
 
-	clk_enable(tin_event);
+	clk_prepare_enable(tin_event);
 
 	sprintf(devname, "s3c24xx-pwm.%lu", source_id);
 	s3c_device_timer[source_id].id = source_id;
@@ -383,7 +383,7 @@  static void __init samsung_timer_resources(void)
 	if (IS_ERR(tdiv_source))
 		panic("failed to get pwm-tdiv clock for source timer");
 
-	clk_enable(tin_source);
+	clk_prepare_enable(tin_source);
 }
 
 void __init samsung_timer_init(void)