[PATCH] clocksource/drivers/arm_arch_timer: export arch_timer_get_rate
Mark Rutland
mark.rutland at arm.com
Tue Jan 12 05:12:47 EST 2021
On Tue, Jan 12, 2021 at 10:31:40AM +0900, Chanho Park wrote:
> This patch adds to export arch_timer_get_rate function for calculating
> absolute timestamp which is based on arch timer like below.
> arch_timer_read_counter was already exported but arch_timer_get_rate
> wasn't. Thus, this patch tries to export this to use this function from
> loadable kernel module.
Can you please explain /where/ this would be used? i.e. which module?
Generally we try to avoid drivers depending on the specific clocksource,
so I think there needs to be stronger rationale for exposing this.
Thanks,
Mark.
>
> u32 rate = arch_timer_get_rate() / (1000 * 1000);
> u64 abs_ns = arch_timer_read_counter() * 1000 / rate;
>
> Cc: Mark Rutland <mark.rutland at arm.com>
> Cc: Marc Zyngier <maz at kernel.org>
> Cc: Daniel Lezcano <daniel.lezcano at linaro.org>
> Cc: Thomas Gleixner <tglx at linutronix.de>
> Signed-off-by: Chanho Park <chanho61.park at samsung.com>
> ---
> drivers/clocksource/arm_arch_timer.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c
> index d0177824c518..f3f49d96dbe9 100644
> --- a/drivers/clocksource/arm_arch_timer.c
> +++ b/drivers/clocksource/arm_arch_timer.c
> @@ -961,6 +961,7 @@ u32 arch_timer_get_rate(void)
> {
> return arch_timer_rate;
> }
> +EXPORT_SYMBOL_GPL(arch_timer_get_rate);
>
> bool arch_timer_evtstrm_available(void)
> {
> --
> 2.23.0
>
More information about the linux-arm-kernel
mailing list