x86/HPET: reduce hpet_next_event() call sites

I'm surprised gcc doesn't manage to do that: At least in debug builds two
call sites exist, just like source code has it. That's not necessary
though - by using do/while we can reduce this to a single call site. Then
the function will be inlined.

While improving code gen, also switch the function's 2nd parameter to
unsigned.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
This commit is contained in:
Jan Beulich committed 2026-01-22 16:06:22 +01:00
1 parent bb34713d9a
commit 8da2d4ec14
1 file changed
+4 -6
+4 -6
View File
@@ -124,7 +124,7 @@ static inline unsigned long ns2ticks(unsigned long nsec, int shift,
return (unsigned long) tmp;
}
static int hpet_next_event(unsigned long delta, int timer)
static int hpet_next_event(unsigned long delta, unsigned int timer)
{
uint32_t cnt, cmp;
unsigned long flags;
@@ -173,12 +173,10 @@ static int reprogram_hpet_evt_channel(
delta = max_t(int64_t, delta, MIN_DELTA_NS);
delta = ns2ticks(delta, ch->shift, ch->mult);
ret = hpet_next_event(delta, ch->idx);
while ( ret && force )
{
delta += delta;
do {
ret = hpet_next_event(delta, ch->idx);
}
delta += delta;
} while ( ret && force );
return ret;
}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.