[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 07/11] hpet: remove unnecessary variable "index"
From: |
Paolo Bonzini |
Subject: |
[PULL 07/11] hpet: remove unnecessary variable "index" |
Date: |
Tue, 23 Jul 2024 16:15:25 +0200 |
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
hw/timer/hpet.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/hw/timer/hpet.c b/hw/timer/hpet.c
index bbb1e5f0897..380e272fbeb 100644
--- a/hw/timer/hpet.c
+++ b/hw/timer/hpet.c
@@ -437,12 +437,12 @@ static uint64_t hpet_ram_read(void *opaque, hwaddr addr,
unsigned size)
{
HPETState *s = opaque;
- uint64_t cur_tick, index;
+ uint64_t cur_tick;
trace_hpet_ram_read(addr);
- index = addr;
+
/*address range of all TN regs*/
- if (index >= 0x100 && index <= 0x3ff) {
+ if (addr >= 0x100 && addr <= 0x3ff) {
uint8_t timer_id = (addr - 0x100) / 0x20;
HPETTimer *timer = &s->timer[timer_id];
@@ -469,7 +469,7 @@ static uint64_t hpet_ram_read(void *opaque, hwaddr addr,
break;
}
} else {
- switch (index) {
+ switch (addr) {
case HPET_ID:
return s->capability;
case HPET_PERIOD:
@@ -510,15 +510,14 @@ static void hpet_ram_write(void *opaque, hwaddr addr,
{
int i;
HPETState *s = opaque;
- uint64_t old_val, new_val, val, index;
+ uint64_t old_val, new_val, val;
trace_hpet_ram_write(addr, value);
- index = addr;
old_val = hpet_ram_read(opaque, addr, 4);
new_val = value;
/*address range of all TN regs*/
- if (index >= 0x100 && index <= 0x3ff) {
+ if (addr >= 0x100 && addr <= 0x3ff) {
uint8_t timer_id = (addr - 0x100) / 0x20;
HPETTimer *timer = &s->timer[timer_id];
@@ -620,7 +619,7 @@ static void hpet_ram_write(void *opaque, hwaddr addr,
}
return;
} else {
- switch (index) {
+ switch (addr) {
case HPET_ID:
return;
case HPET_CFG:
--
2.45.2
- [PULL 00/11] target/i386, HPET changes for QEMU 9.1 soft freeze, Paolo Bonzini, 2024/07/23
- [PULL 01/11] target/i386: do not crash if microvm guest uses SGX CPUID leaves, Paolo Bonzini, 2024/07/23
- [PULL 02/11] qio: add support for SO_PEERCRED for socket channel, Paolo Bonzini, 2024/07/23
- [PULL 03/11] tools: build qemu-vmsr-helper, Paolo Bonzini, 2024/07/23
- [PULL 05/11] hpet: fix and cleanup persistence of interrupt status, Paolo Bonzini, 2024/07/23
- [PULL 04/11] Add support for RAPL MSRs in KVM/Qemu, Paolo Bonzini, 2024/07/23
- [PULL 07/11] hpet: remove unnecessary variable "index",
Paolo Bonzini <=
- [PULL 08/11] hpet: place read-only bits directly in "new_val", Paolo Bonzini, 2024/07/23
- [PULL 06/11] hpet: ignore high bits of comparator in 32-bit mode, Paolo Bonzini, 2024/07/23
- [PULL 11/11] hpet: avoid timer storms on periodic timers, Paolo Bonzini, 2024/07/23
- [PULL 09/11] hpet: accept 64-bit reads and writes, Paolo Bonzini, 2024/07/23
- [PULL 10/11] hpet: store full 64-bit target value of the counter, Paolo Bonzini, 2024/07/23
- Re: [PULL 00/11] target/i386, HPET changes for QEMU 9.1 soft freeze, Richard Henderson, 2024/07/23