Patchwork [RFC,qom-cpu,v3,02/10] apic: remove redundant variable 'apic_no' from apic_init_common()

login
register
mail settings
Submitter chenfan
Date Sept. 16, 2013, 2:40 a.m.
Message ID <2285b54e1a2d086ffb8d45f9da7a19e59febf72c.1379062188.git.chen.fan.fnst@cn.fujitsu.com>
Download mbox | patch
Permalink /patch/275091/
State New
Headers show

Comments

chenfan - Sept. 16, 2013, 2:40 a.m.
In struct APICCommonState, there is an id field yet, which was set earlier,
qdev_prop_set_uint8(env->apic_state, "id", env->cpuid_apic_id);
so we use the id field instead of the variable 'apic_no' to represent the unique apic
index.

Signed-off-by: Chen Fan <chen.fan.fnst@cn.fujitsu.com>
---
 hw/intc/apic_common.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

Patch

diff --git a/hw/intc/apic_common.c b/hw/intc/apic_common.c
index a0beb10..82fbb7f 100644
--- a/hw/intc/apic_common.c
+++ b/hw/intc/apic_common.c
@@ -289,13 +289,9 @@  static int apic_init_common(ICCDevice *dev)
     APICCommonState *s = APIC_COMMON(dev);
     APICCommonClass *info;
     static DeviceState *vapic;
-    static int apic_no;
     static bool mmio_registered;
 
-    if (apic_no >= MAX_APICS) {
-        return -1;
-    }
-    s->idx = apic_no++;
+    s->idx = s->id;
 
     info = APIC_COMMON_GET_CLASS(s);
     info->init(s);