qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH v6 18/27] host-libusb: remove bootindex property fro


From: arei.gonglei
Subject: [Qemu-devel] [PATCH v6 18/27] host-libusb: remove bootindex property from qdev to qom
Date: Sat, 30 Aug 2014 18:00:18 +0800

From: Gonglei <address@hidden>

Remove bootindex form qdev property to qom, things will
continue to work just fine, and we can use qom features
which are not supported by qdev property.

Signed-off-by: Gonglei <address@hidden>
---
 hw/usb/host-libusb.c | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c
index f37708d..c3c91f3 100644
--- a/hw/usb/host-libusb.c
+++ b/hw/usb/host-libusb.c
@@ -979,6 +979,30 @@ static int usb_host_initfn(USBDevice *udev)
     return 0;
 }
 
+static void usb_host_get_bootindex(Object *obj, Visitor *v, void *opaque,
+                                   const char *name, Error **errp)
+{
+    USBHostDevice *s = USB_HOST_DEVICE(obj);
+
+    get_bootindex(&s->bootindex, v, name, errp);
+}
+
+static void usb_host_set_bootindex(Object *obj, Visitor *v, void *opaque,
+                                   const char *name, Error **errp)
+{
+    USBHostDevice *s = USB_HOST_DEVICE(obj);
+
+    set_bootindex(&s->bootindex, v, name, errp);
+}
+
+static void usb_host_instance_init(Object *obj)
+{
+    object_property_add(obj, "bootindex", "int",
+                        usb_host_get_bootindex,
+                        usb_host_set_bootindex, NULL, NULL, NULL);
+    object_property_set_int(obj, -1, "bootindex", NULL);
+}
+
 static void usb_host_handle_destroy(USBDevice *udev)
 {
     USBHostDevice *s = USB_HOST_DEVICE(udev);
@@ -1465,7 +1489,6 @@ static Property usb_host_dev_properties[] = {
     DEFINE_PROP_UINT32("productid", USBHostDevice, match.product_id, 0),
     DEFINE_PROP_UINT32("isobufs",  USBHostDevice, iso_urb_count,    4),
     DEFINE_PROP_UINT32("isobsize", USBHostDevice, iso_urb_frames,   32),
-    DEFINE_PROP_INT32("bootindex", USBHostDevice, bootindex,        -1),
     DEFINE_PROP_UINT32("loglevel",  USBHostDevice, loglevel,
                        LIBUSB_LOG_LEVEL_WARNING),
     DEFINE_PROP_BIT("pipeline",    USBHostDevice, options,
@@ -1498,6 +1521,7 @@ static TypeInfo usb_host_dev_info = {
     .parent        = TYPE_USB_DEVICE,
     .instance_size = sizeof(USBHostDevice),
     .class_init    = usb_host_class_initfn,
+    .instance_init = usb_host_instance_init,
 };
 
 static void usb_host_register_types(void)
-- 
1.7.12.4





reply via email to

[Prev in Thread] Current Thread [Next in Thread]