lkml.org 
[lkml]   [2008]   [Dec]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] clocksource: add enable() and disable() callbacks
Hi Ingo,

On Fri, Dec 12, 2008 at 3:36 PM, Ingo Molnar <mingo@elte.hu> wrote:
> * Magnus Damm <magnus.damm@gmail.com> wrote:
>> +static inline int clocksource_enable(struct clocksource *cs)
>> +{
>> + return cs->enable ? cs->enable(cs) : 0;
>> +}
>
>> +static inline void clocksource_disable(struct clocksource *cs)
>> +{
>> + if (cs->disable)
>> + cs->disable(cs);
>> +}
>
> why have the two different styles? The first one should be:
>
> if (cs->enable)
> return cs->enable(cs);
> return 0;

Sure, that's fine too.

>> @@ -193,11 +193,16 @@ static void change_clocksource(void)
>>
>> clocksource_forward_now();
>>
>> - new->raw_time = clock->raw_time;
>> + if (clocksource_enable(new))
>> + return;
>
> that looks fragile to me: if the enable fails we'll return silently,
> while change_clocksource() assumes that things went fine. At least put a
> WARN_ON_ONCE() in there.

Yeah, John and I discussed this before. What we really want it to move
the failing clocksource out of the list of available clocksources.
That type of change is pretty intrusive though, and I rather see it as
a separate topic.

> also, why does it have to fail? If a clocksource cannot be enabled it
> should not be offered as a clocksource.

Right. I guess most clocksource drivers for embedded platforms will
tie in the clock framework and use clk_enable() and clk_disable().
clk_enable() returns an int.

>> + clocksource_disable(old);
>
> i do agree with the core purpose here, to allow lowlevel code to
> deactivate unused clocksources.

That's good! I hope we can sort out the details then!

Cheers,

/ magnus


\
 
 \ /
  Last update: 2008-12-12 08:21    [W:0.064 / U:0.136 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site