[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87sey3b6de.ffs@tglx>
Date: Mon, 27 May 2024 17:51:25 +0200
From: Thomas Gleixner <tglx@...utronix.de>
To: Jiaxun Yang <jiaxun.yang@...goat.com>, Huacai Chen
<chenhuacai@...nel.org>, Thomas Bogendoerfer <tsbogend@...ha.franken.de>,
Daniel Lezcano <daniel.lezcano@...aro.org>
Cc: linux-kernel@...r.kernel.org, linux-mips@...r.kernel.org, Jiaxun Yang
<jiaxun.yang@...goat.com>
Subject: Re: [PATCH v2] clocksource: Add node counter timer driver for
MIPS/Loongson64
Jiaxun!
On Fri, May 17 2024 at 18:13, Jiaxun Yang wrote:
> +static void __iomem *nodecnt_reg;
> +static u64 (*nodecnt_read_fn)(void);
> +
> +static u64 notrace nodecnt_read_2x32(void)
> +{
> + unsigned int hi, hi2, lo;
> +
> + do {
> + hi = readl_relaxed(nodecnt_reg + 4);
> + lo = readl_relaxed(nodecnt_reg);
> + hi2 = readl_relaxed(nodecnt_reg + 4);
> + } while (hi2 != hi);
> +
> + return (((u64) hi) << 32) + lo;
> +}
> +
> +static u64 notrace nodecnt_read_64(void)
> +{
> + return readq_relaxed(nodecnt_reg);
> +}
> +
> +static u64 notrace nodecnt_read_csr(void)
> +{
> + return csr_readq(LOONGSON_CSR_NODECNT);
> +}
> +
> +static u64 nodecnt_clocksource_read(struct clocksource *cs)
> +{
> + return nodecnt_read_fn();
What's this indirection for? Why dont you update
> +static struct clocksource nodecnt_clocksource = {
> + .name = "nodecnt",
> + .read = nodecnt_clocksource_read,
the read function pointer here and spare the indirection?
Thanks
tglx
Powered by blists - more mailing lists