* [PATCH 08/10] clocksource: add read2() callback
@ 2008-12-01 10:33 Magnus Damm
2008-12-01 20:57 ` john stultz
0 siblings, 1 reply; 2+ messages in thread
From: Magnus Damm @ 2008-12-01 10:33 UTC (permalink / raw)
To: linux-sh
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();
}
/**
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH 08/10] clocksource: add read2() callback
2008-12-01 10:33 [PATCH 08/10] clocksource: add read2() callback Magnus Damm
@ 2008-12-01 20:57 ` john stultz
0 siblings, 0 replies; 2+ messages in thread
From: john stultz @ 2008-12-01 20:57 UTC (permalink / raw)
To: linux-sh
On Mon, 2008-12-01 at 19:33 +0900, Magnus Damm wrote:
> 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>
I'm still not yet totally sold on the reasons we need this change, but I
don't have any issue with this implementation. Hopefully the discussion
around the timer_inc code will help resolve my concerns.
Also, if we're going to go this way, you might want to add read() to the
feature-removal list and add a warning in clocksource_register() for any
clocksource that doesn't implement read2, just so we don't have to keep
both around forever
thanks
-john
> ---
>
> 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();
> }
>
> /**
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-12-01 20:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-01 10:33 [PATCH 08/10] clocksource: add read2() callback Magnus Damm
2008-12-01 20:57 ` john stultz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox