[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080506021321.GA4928@Pilar.virtua.com.br>
Date: Mon, 5 May 2008 23:13:23 -0300
From: "Carlos R. Mafra" <crmafra2@...il.com>
To: Daniel Walker <dwalker@...sta.com>
Cc: linux-kernel@...r.kernel.org, tglx@...utronix.de,
venkatesh.pallipadi@...el.com
Subject: Re: x86: Clean up computation of HPET .mult variables
On Mon 5.May'08 at 16:58:08 -0700, Daniel Walker wrote:
>
> On Mon, 2008-05-05 at 20:11 -0300, Carlos R. Mafra wrote:
>
> > - tmp = (u64)hpet_period << HPET_SHIFT;
> > - do_div(tmp, FSEC_PER_NSEC);
> > - clocksource_hpet.mult = (u32)tmp;
> > + clocksource_hpet.mult = div_sc(hpet_period, FSEC_PER_NSEC, HPET_SHIFT);
> >
>
> There's helper functions that should be used called clocksource_hz2mult
> and one called clocksource_khz2mult. I think they're more accurate than
> using div_sc.
Ok, but they take the frequency as the input while the "natural" variable
we have is the period, because that's what we get from the hardware (at
least for the HPET, if I understood it correctly).
If I want to use clocksource_hz2mult then I have
to do one more operation (to find the frequency) before calling it (and
that's what the other part of the patch which you didn't quote is
actually doing).
So the savings in my patch is due to using the period directly, and
not the frequency. That's what my idea was, so if you object then
my attempt was a failure and should be forgotten :-)
Or maybe I should create a clocksource_period2mult to replace
clocksource_hz2mult and save the extra operation in more places too?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists