linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Jiaxun Yang <jiaxun.yang@flygoat.com>,
	Huacai Chen <chenhuacai@kernel.org>,
	Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
	Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org,
	Jiaxun Yang <jiaxun.yang@flygoat.com>
Subject: Re: [PATCH v2] clocksource: Add node counter timer driver for MIPS/Loongson64
Date: Mon, 27 May 2024 17:51:25 +0200	[thread overview]
Message-ID: <87sey3b6de.ffs@tglx> (raw)
In-Reply-To: <20240517-loongson_nodecnt-v2-1-5bd0bb20ff5f@flygoat.com>

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

  parent reply	other threads:[~2024-05-27 15:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-17 17:13 [PATCH v2] clocksource: Add node counter timer driver for MIPS/Loongson64 Jiaxun Yang
2024-05-27 12:20 ` Philippe Mathieu-Daudé
2024-05-27 15:51 ` Thomas Gleixner [this message]
2024-05-27 16:32   ` Jiaxun Yang
2024-05-28 14:31     ` Jiaxun Yang
2024-05-28 19:17       ` Thomas Gleixner
2024-06-05 13:17         ` Jiaxun Yang

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=87sey3b6de.ffs@tglx \
    --to=tglx@linutronix.de \
    --cc=chenhuacai@kernel.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=jiaxun.yang@flygoat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=tsbogend@alpha.franken.de \
    /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;
as well as URLs for NNTP newsgroup(s).