From: Magnus Damm <magnus.damm@gmail.com>
To: linux-sh@vger.kernel.org
Subject: [PATCH 08/10] clocksource: add read2() callback
Date: Mon, 01 Dec 2008 10:33:37 +0000 [thread overview]
Message-ID: <20081201103337.26620.38744.sendpatchset@rx1.opensource.se> (raw)
From: Magnus Damm <damm@igel.co.jp>
Add a read2() callback for clocksources. This callback is passing
a pointer to struct clocksource which makes it easy to share the
same callback for multiple clocksource instances.
The function clocksource_read() is modified to prefer read2() over
read() if initialized.
Signed-off-by: Magnus Damm <damm@igel.co.jp>
---
include/linux/clocksource.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
--- 0001/include/linux/clocksource.h
+++ work/include/linux/clocksource.h 2008-11-27 13:58:25.000000000 +0900
@@ -43,6 +43,7 @@ struct clocksource;
* The ideal clocksource. A must-use where
* available.
* @read: returns a cycle value
+ * @read2: returns a cycle value, passes clocksource as argument
* @mask: bitmask for two's complement
* subtraction of non 64 bit counters
* @mult: cycle to nanosecond multiplier (adjusted by NTP)
@@ -62,6 +63,7 @@ struct clocksource {
struct list_head list;
int rating;
cycle_t (*read)(void);
+ cycle_t (*read2)(struct clocksource *cs);
cycle_t mask;
u32 mult;
u32 mult_orig;
@@ -170,7 +172,7 @@ static inline u32 clocksource_hz2mult(u3
*/
static inline cycle_t clocksource_read(struct clocksource *cs)
{
- return cs->read();
+ return cs->read2 ? cs->read2(cs) : cs->read();
}
/**
next reply other threads:[~2008-12-01 10:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-01 10:33 Magnus Damm [this message]
2008-12-01 20:57 ` [PATCH 08/10] clocksource: add read2() callback john stultz
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=20081201103337.26620.38744.sendpatchset@rx1.opensource.se \
--to=magnus.damm@gmail.com \
--cc=linux-sh@vger.kernel.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