From: "Magnus Damm" <magnus.damm@gmail.com>
To: "Ingo Molnar" <mingo@elte.hu>
Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
johnstul@us.ibm.com, lethal@linux-sh.org, tglx@linutronix.de,
mingo@redhat.com
Subject: Re: [PATCH] clocksource: add enable() and disable() callbacks
Date: Fri, 12 Dec 2008 16:18:38 +0900 [thread overview]
Message-ID: <aec7e5c30812112318t1c4bddd6n1559ea20da9debe1@mail.gmail.com> (raw)
In-Reply-To: <20081212063645.GF12451@elte.hu>
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
prev parent reply other threads:[~2008-12-12 7:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-11 11:49 Magnus Damm
2008-12-12 3:08 ` Andrew Morton
2008-12-12 3:34 ` Magnus Damm
2008-12-12 6:36 ` Ingo Molnar
2008-12-12 7:18 ` Magnus Damm [this message]
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=aec7e5c30812112318t1c4bddd6n1559ea20da9debe1@mail.gmail.com \
--to=magnus.damm@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=johnstul@us.ibm.com \
--cc=lethal@linux-sh.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®