Re: [PATCH 2/3] x86/tsc: Define and use HZ_PER_KHZ and KHZ_PER_MHZ

From: Petr Tesarik

Date: Mon Oct 12 2026 - 02:06:56 EST


On Fri, 9 Oct 2026 15:42:27 +0200
Thorsten Blum <blum@xxxxxxxxxx> wrote:

> On Fri, Oct 09, 2026 at 12:04:35PM +0200, Petr Tesarik wrote:
> > The KHZ macro is ambiguous. Sometimes it is used for conversion between Hz
> > and KHz, and sometimes for conversion between KHz and MHz. Use two
> > different macros to distinguish between them.
> >
> > Convert plain 1000 constants to one of the two macros where appropriate.
> >
> > No functional change intended.
> >
> > Signed-off-by: Petr Tesarik <ptesarik@xxxxxxxx>
> > ---
> > arch/x86/kernel/tsc.c | 39 ++++++++++++++++++++-------------------
> > 1 file changed, 20 insertions(+), 19 deletions(-)
> >
> > diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
> > index bac81d37a90ce..8b905c4dbefe2 100644
> > --- a/arch/x86/kernel/tsc.c
> > +++ b/arch/x86/kernel/tsc.c
> > @@ -41,7 +41,8 @@ EXPORT_SYMBOL(cpu_khz);
> > unsigned int __read_mostly tsc_khz;
> > EXPORT_SYMBOL(tsc_khz);
> >
> > -#define KHZ 1000
> > +#define HZ_PER_KHZ 1000
> > +#define KHZ_PER_MHZ 1000
>
> These are already defined in linux/units.h.

Oh, that's cool. I'll use those for v2.
Thanks for the pointer!

Petr T