OSDN Git Service

qdev: Set DeviceClass::hotpluggable default in class_init()
authorIgor Mammedov <imammedo@redhat.com>
Tue, 18 Feb 2014 16:56:53 +0000 (17:56 +0100)
committerAndreas Färber <afaerber@suse.de>
Wed, 12 Mar 2014 19:13:02 +0000 (20:13 +0100)
Move setting DeviceClass::hotpluggable default from device's
class_base_init() to device's class_init().

Reported-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
hw/core/qdev.c

index 5377893..71b7045 100644 (file)
@@ -793,14 +793,6 @@ static void device_class_base_init(ObjectClass *class, void *data)
      * so do not propagate them to the subclasses.
      */
     klass->props = NULL;
-
-    /* by default all devices were considered as hotpluggable,
-     * so with intent to check it in generic qdev_unplug() /
-     * device_set_realized() functions make every device
-     * hotpluggable. Devices that shouldn't be hotpluggable,
-     * should override it in their class_init()
-     */
-    klass->hotpluggable = true;
 }
 
 static void device_unparent(Object *obj)
@@ -846,6 +838,14 @@ static void device_class_init(ObjectClass *class, void *data)
     class->unparent = device_unparent;
     dc->realize = device_realize;
     dc->unrealize = device_unrealize;
+
+    /* by default all devices were considered as hotpluggable,
+     * so with intent to check it in generic qdev_unplug() /
+     * device_set_realized() functions make every device
+     * hotpluggable. Devices that shouldn't be hotpluggable,
+     * should override it in their class_init()
+     */
+    dc->hotpluggable = true;
 }
 
 void device_reset(DeviceState *dev)