public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Magnus Damm <magnus.damm@gmail.com>
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 07:36:45 +0100	[thread overview]
Message-ID: <20081212063645.GF12451@elte.hu> (raw)
In-Reply-To: <20081211114909.17624.85712.sendpatchset@rx1.opensource.se>


* 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;

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

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

> +	clocksource_disable(old);

i do agree with the core purpose here, to allow lowlevel code to 
deactivate unused clocksources.

John, Thomas, what's your take on this?

	Ingo

  parent reply	other threads:[~2008-12-12  6:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-11 11:49 [PATCH] clocksource: add enable() and disable() callbacks Magnus Damm
2008-12-12  3:08 ` Andrew Morton
2008-12-12  3:34   ` Magnus Damm
2008-12-12  6:36 ` Ingo Molnar [this message]
2008-12-12  7:18   ` Magnus Damm

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=20081212063645.GF12451@elte.hu \
    --to=mingo@elte.hu \
    --cc=akpm@linux-foundation.org \
    --cc=johnstul@us.ibm.com \
    --cc=lethal@linux-sh.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=magnus.damm@gmail.com \
    --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