From: Gonglei <arei.gong...@huawei.com>

Add a qom property with the same name 'bootindex',
when we remove it form qdev property, things will
continue to work just fine, and we can use qom features
which are not supported by qdev property.

Signed-ooff-by: Gonglei <arei.gong...@huawei.com>
---
 hw/net/eepro100.c | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/hw/net/eepro100.c b/hw/net/eepro100.c
index dcfaa48..5a29f20 100644
--- a/hw/net/eepro100.c
+++ b/hw/net/eepro100.c
@@ -1911,6 +1911,29 @@ static void eepro100_reset(DeviceState *dev)
     add_boot_device_path(s->conf.bootindex, dev, "/ethernet-phy@0");
 }
 
+static void eepro100_get_bootindex(Object *obj, Visitor *v, void *opaque,
+                                   const char *name, Error **errp)
+{
+    EEPRO100State *s = DO_UPCAST(EEPRO100State, dev, PCI_DEVICE(obj));
+
+    get_bootindex(&s->conf.bootindex, v, name, errp);
+}
+
+static void eepro100_set_bootindex(Object *obj, Visitor *v, void *opaque,
+                                   const char *name, Error **errp)
+{
+    EEPRO100State *s = DO_UPCAST(EEPRO100State, dev, PCI_DEVICE(obj));
+
+    set_bootindex(&s->conf.bootindex, v, name, errp);
+}
+
+static void eepro100_instance_init(Object *obj)
+{
+    object_property_add(obj, "bootindex", "int",
+                        eepro100_get_bootindex,
+                        eepro100_set_bootindex, NULL, NULL, NULL);
+}
+
 static E100PCIDeviceInfo e100_devices[] = {
     {
         .name = "i82550",
@@ -2110,7 +2133,8 @@ static void eepro100_register_types(void)
         type_info.parent = TYPE_PCI_DEVICE;
         type_info.class_init = eepro100_class_init;
         type_info.instance_size = sizeof(EEPRO100State);
-        
+        type_info.instance_init = eepro100_instance_init;
+
         type_register(&type_info);
     }
 }
-- 
1.7.12.4



Reply via email to