mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-12-18 05:28:36 -07:00
Replaced get_tick_per_sec() by NANOSECONDS_PER_SECOND
This patch replaces get_ticks_per_sec() calls with the macro
NANOSECONDS_PER_SECOND. Also, as there are no callers, get_ticks_per_sec()
is then removed. This replacement improves the readability and
understandability of code.
For example,
timer_mod(fdctrl->result_timer,
qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + (get_ticks_per_sec() / 50));
NANOSECONDS_PER_SECOND makes it obvious that qemu_clock_get_ns
matches the unit of the expression on the right side of the plus.
Signed-off-by: Rutuja Shah <rutu.shah.26@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
4771d756f4
commit
73bcb24d93
53 changed files with 143 additions and 134 deletions
|
|
@ -119,11 +119,11 @@ static void pxa2xx_timer_update(void *opaque, uint64_t now_qemu)
|
|||
uint64_t new_qemu;
|
||||
|
||||
now_vm = s->clock +
|
||||
muldiv64(now_qemu - s->lastload, s->freq, get_ticks_per_sec());
|
||||
muldiv64(now_qemu - s->lastload, s->freq, NANOSECONDS_PER_SECOND);
|
||||
|
||||
for (i = 0; i < 4; i ++) {
|
||||
new_qemu = now_qemu + muldiv64((uint32_t) (s->timer[i].value - now_vm),
|
||||
get_ticks_per_sec(), s->freq);
|
||||
NANOSECONDS_PER_SECOND, s->freq);
|
||||
timer_mod(s->timer[i].qtimer, new_qemu);
|
||||
}
|
||||
}
|
||||
|
|
@ -148,10 +148,10 @@ static void pxa2xx_timer_update4(void *opaque, uint64_t now_qemu, int n)
|
|||
|
||||
now_vm = s->tm4[counter].clock + muldiv64(now_qemu -
|
||||
s->tm4[counter].lastload,
|
||||
s->tm4[counter].freq, get_ticks_per_sec());
|
||||
s->tm4[counter].freq, NANOSECONDS_PER_SECOND);
|
||||
|
||||
new_qemu = now_qemu + muldiv64((uint32_t) (s->tm4[n].tm.value - now_vm),
|
||||
get_ticks_per_sec(), s->tm4[counter].freq);
|
||||
NANOSECONDS_PER_SECOND, s->tm4[counter].freq);
|
||||
timer_mod(s->tm4[n].tm.qtimer, new_qemu);
|
||||
}
|
||||
|
||||
|
|
@ -190,7 +190,7 @@ static uint64_t pxa2xx_timer_read(void *opaque, hwaddr offset,
|
|||
return s->tm4[tm].tm.value;
|
||||
case OSCR:
|
||||
return s->clock + muldiv64(qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) -
|
||||
s->lastload, s->freq, get_ticks_per_sec());
|
||||
s->lastload, s->freq, NANOSECONDS_PER_SECOND);
|
||||
case OSCR11: tm ++;
|
||||
/* fall through */
|
||||
case OSCR10: tm ++;
|
||||
|
|
@ -214,15 +214,17 @@ static uint64_t pxa2xx_timer_read(void *opaque, hwaddr offset,
|
|||
s->snapshot = s->tm4[tm - 1].clock + muldiv64(
|
||||
qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) -
|
||||
s->tm4[tm - 1].lastload,
|
||||
s->tm4[tm - 1].freq, get_ticks_per_sec());
|
||||
s->tm4[tm - 1].freq, NANOSECONDS_PER_SECOND);
|
||||
else
|
||||
s->snapshot = s->tm4[tm - 1].clock;
|
||||
}
|
||||
|
||||
if (!s->tm4[tm].freq)
|
||||
return s->tm4[tm].clock;
|
||||
return s->tm4[tm].clock + muldiv64(qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) -
|
||||
s->tm4[tm].lastload, s->tm4[tm].freq, get_ticks_per_sec());
|
||||
return s->tm4[tm].clock +
|
||||
muldiv64(qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) -
|
||||
s->tm4[tm].lastload, s->tm4[tm].freq,
|
||||
NANOSECONDS_PER_SECOND);
|
||||
case OIER:
|
||||
return s->irq_enabled;
|
||||
case OSSR: /* Status register */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue