From: tglx@linutronix.de (Thomas Gleixner)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 1/2] clocksource: track usage
Date: Tue, 20 Jan 2015 11:51:59 +0100 (CET) [thread overview]
Message-ID: <alpine.DEB.2.11.1501201148550.5526@nanos> (raw)
In-Reply-To: <1421427439-11699-2-git-send-email-alexandre.belloni@free-electrons.com>
On Fri, 16 Jan 2015, Alexandre Belloni wrote:
> diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
> index abcafaa20b86..7735902fc5f6 100644
> --- a/include/linux/clocksource.h
> +++ b/include/linux/clocksource.h
> @@ -210,6 +210,8 @@ struct clocksource {
> #define CLOCK_SOURCE_SUSPEND_NONSTOP 0x80
> #define CLOCK_SOURCE_RESELECT 0x100
>
> +#define CLOCK_SOURCE_USED 0x200
You track whether the clocksource is enabled or not, right?
> /* simplify initialization of mask field */
> #define CLOCKSOURCE_MASK(bits) (cycle_t)((bits) < 64 ? ((1ULL<<(bits))-1) : -1)
>
> @@ -282,6 +284,8 @@ static inline s64 clocksource_cyc2ns(cycle_t cycles, u32 mult, u32 shift)
>
> extern int clocksource_register(struct clocksource*);
> extern int clocksource_unregister(struct clocksource*);
> +extern int clocksource_enable(struct clocksource *);
> +extern void clocksource_disable(struct clocksource *);
This should be in kernel/time/timekeeping_internal.h
> extern void clocksource_touch_watchdog(void);
> extern struct clocksource* clocksource_get_next(void);
> extern void clocksource_change_rating(struct clocksource *cs, int rating);
> diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
> index b79f39bda7e1..03cfc5a08e3b 100644
> --- a/kernel/time/clocksource.c
> +++ b/kernel/time/clocksource.c
> @@ -889,6 +889,36 @@ int clocksource_unregister(struct clocksource *cs)
> }
> EXPORT_SYMBOL(clocksource_unregister);
>
> +/**
> + * clocksource_enable - enable a registered clocksource
> + * @cs: clocksource to enable
> + */
> +int clocksource_enable(struct clocksource *cs)
> +{
> + int ret = 0;
> +
> + if (cs->enable)
> + ret = cs->enable(cs);
> +
> + if (!ret)
> + cs->flags |= CLOCK_SOURCE_USED;
> +
> + return ret;
> +}
> +EXPORT_SYMBOL(clocksource_enable);
Why on earth do you want to export that?
> +/**
> + * clocksource_disable - disable a registered clocksource
> + * @cs: clocksource to disable
> + */
> +void clocksource_disable(struct clocksource *cs)
> +{
> + cs->flags &= ~CLOCK_SOURCE_USED;
> + if (cs->disable)
> + cs->disable(cs);
> +}
> +EXPORT_SYMBOL(clocksource_disable);
Ditto.
Thanks,
tglx
next prev parent reply other threads:[~2015-01-20 10:51 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-16 16:57 [PATCH v2 0/2] clocksource: don't suspend/resume when unused Alexandre Belloni
2015-01-16 16:57 ` [PATCH v2 1/2] clocksource: track usage Alexandre Belloni
2015-01-16 19:05 ` John Stultz
2015-01-17 1:26 ` Alexandre Belloni
2015-01-20 10:51 ` Thomas Gleixner [this message]
2015-01-16 16:57 ` [PATCH v2 2/2] clocksource: don't suspend/resume when unused Alexandre Belloni
2015-01-20 11:13 ` Thomas Gleixner
2015-01-16 17:45 ` [PATCH v2 0/2] " Boris Brezillon
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=alpine.DEB.2.11.1501201148550.5526@nanos \
--to=tglx@linutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
/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;
as well as URLs for NNTP newsgroup(s).