clocksource: fix misleading comment for __clocksource_updatefreq_scale()
PATCH v2 1/1 clocksource: fix misleading comment for __clocksource_updatefreq_scale()
Functions clocksource_updatefreq_hz() and clocksource_updatefreq_khz() mentioned in the comment of __clocksource_updatefreq_scale() do not exist.
As Thomas Gleixner's suggestion, I renamed the functions and the few call sites because the underscores are completely meaningless.
--- drivers/clocksource/cadence_ttc_timer.c | 2 +- drivers/clocksource/em_sti.c | 2 +- drivers/clocksource/sh_cmt.c | 2 +- drivers/clocksource/sh_tmu.c | 2 +- include/linux/clocksource.h | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-)
drivers/clocksource/cadence_ttc_timer.c +1 -1
@@ -226,7 +226,7 @@ static int ttc_rate_change_clocksource_cb(struct notifier_block *nb,* Do whatever is necessary to maintain a proper time base * * I cannot find a way to adjust the currently used clocksource -* to the new frequency. __clocksource_updatefreq_hz() sounds +* to the new frequency. clocksource_updatefreq_hz() sounds * good, but does not work. Not sure what's that missing. * * This approach works, but triggers two clocksource switches.
drivers/clocksource/em_sti.c +1 -1
@@ -210,7 +210,7 @@ static int em_sti_clocksource_enable(struct clocksource *cs) ret =em_sti_start (p,USER_CLOCKSOURCE );if (!ret) -__clocksource_updatefreq_hz (cs, p->rate); +clocksource_updatefreq_hz (cs, p->rate);return ret; }
drivers/clocksource/sh_cmt.c +1 -1
@@ -504,7 +504,7 @@ static int sh_cmt_clocksource_enable(struct clocksource *cs) ret =sh_cmt_start (p,FLAG_CLOCKSOURCE );if (!ret) { -__clocksource_updatefreq_hz (cs, p->rate); +clocksource_updatefreq_hz (cs, p->rate); p->cs_enabled = true; }return ret;
drivers/clocksource/sh_tmu.c +1 -1
@@ -236,7 +236,7 @@ static int sh_tmu_clocksource_enable(struct clocksource *cs) ret =sh_tmu_enable (p);if (!ret) { -__clocksource_updatefreq_hz (cs, p->rate); +clocksource_updatefreq_hz (cs, p->rate); p->cs_enabled = true; }
include/linux/clocksource.h +2 -2
@@ -314,12 +314,12 @@ static inline int clocksource_register_khz(struct clocksource *cs, u32 khz)return __clocksource_register_scale (cs,1000 , khz); } -static inline void __clocksource_updatefreq_hz (struct clocksource *cs,u32 hz) +static inline void clocksource_updatefreq_hz (struct clocksource *cs,u32 hz) {__clocksource_updatefreq_scale (cs,1 , hz); } -static inline void __clocksource_updatefreq_khz (struct clocksource *cs,u32 khz) +static inline void clocksource_updatefreq_khz (struct clocksource *cs,u32 khz) {__clocksource_updatefreq_scale (cs,1000 , khz); }
Signature · 1 line
1.8.2.1
Quoted 5 lines · Xie XiuQi
Functions
clocksource_updatefreq_hz()andclocksource_updatefreq_khz()mentioned in the comment of__clocksource_updatefreq_scale()do not exist.As Thomas Gleixner's suggestion, I renamed the functions and the few call sites because the underscores are completely meaningless.
First of all, sorry for taking so long to reply here.
So I think the __ tries to imply that those are semi-internal functions that aren't to be causally used w/o understanding the internal details.
Quoted 15 lines
Signed-off-by Xie XiuQi <[email protected]>Cc Thomas Gleixner <[email protected]>--- drivers/clocksource/cadence_ttc_timer.c | 2 +- drivers/clocksource/em_sti.c | 2 +- drivers/clocksource/sh_cmt.c | 2 +- drivers/clocksource/sh_tmu.c | 2 +- include/linux/clocksource.h | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-)drivers/clocksource/cadence_ttc_timer.c +0
-0
drivers/clocksource/cadence_ttc_timer.c static int ttc_rate_change_clocksource_cb(struct notifier_block *nb, · line 231
Quoted 7 lines
drivers/clocksource/cadence_ttc_timer.c +1
-1@@ -226,7 +226,7 @@ static int ttc_rate_change_clocksource_cb(struct notifier_block *nb,* Do whatever is necessary to maintain a proper time base * * I cannot find a way to adjust the currently used clocksource -* to the new frequency. __clocksource_updatefreq_hz() sounds +* to the new frequency. clocksource_updatefreq_hz() sounds * good, but does not work. Not sure what's that missing. *
So I know you didn't write the comment, but my issue with this comment is that there isn't a way to adjust the currently used clocksource frequency, because that is totally unsupported. The __clocksource_updatefreq_hz() method is really only there for clocksources that are currently not in-use and are disabled. Specifically for clocksources that may come out of resume at a different frequency, like the sh_ ones. Hacks like what the cadence_ttc driver is trying to do result in very poor timekeeping.
So I'm sort of on the fence about this patch.
Thomas: Any other thoughts?
thanks
-john