summary refs log tree commit diff stats
path: root/hw/core
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2020-01-10 19:30:32 +0400
committerPaolo Bonzini <pbonzini@redhat.com>2020-01-24 20:59:15 +0100
commit4f67d30b5e74e060b8dbe10528829b47345cd6e8 (patch)
tree025b44a1cb86fe029ed4c105b2764a13c21c5bba /hw/core
parentb77ade9bb37b2e9813a42008cb21d0c743aa50a1 (diff)
downloadfocaccia-qemu-4f67d30b5e74e060b8dbe10528829b47345cd6e8.tar.gz
focaccia-qemu-4f67d30b5e74e060b8dbe10528829b47345cd6e8.zip
qdev: set properties with device_class_set_props()
The following patch will need to handle properties registration during
class_init time. Let's use a device_class_set_props() setter.

spatch --macro-file scripts/cocci-macro-file.h  --sp-file
./scripts/coccinelle/qdev-set-props.cocci --keep-comments --in-place
--dir .

@@
typedef DeviceClass;
DeviceClass *d;
expression val;
@@
- d->props = val
+ device_class_set_props(d, val)

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20200110153039.1379601-20-marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw/core')
-rw-r--r--hw/core/cpu.c2
-rw-r--r--hw/core/generic-loader.c2
-rw-r--r--hw/core/or-irq.c2
-rw-r--r--hw/core/platform-bus.c2
-rw-r--r--hw/core/qdev.c5
-rw-r--r--hw/core/split-irq.c2
6 files changed, 10 insertions, 5 deletions
diff --git a/hw/core/cpu.c b/hw/core/cpu.c
index fde5fd395b..fe65ca62ac 100644
--- a/hw/core/cpu.c
+++ b/hw/core/cpu.c
@@ -440,7 +440,7 @@ static void cpu_class_init(ObjectClass *klass, void *data)
     set_bit(DEVICE_CATEGORY_CPU, dc->categories);
     dc->realize = cpu_common_realizefn;
     dc->unrealize = cpu_common_unrealizefn;
-    dc->props = cpu_common_props;
+    device_class_set_props(dc, cpu_common_props);
     /*
      * Reason: CPUs still need special care by board code: wiring up
      * IRQs, adding reset handlers, halting non-first CPUs, ...
diff --git a/hw/core/generic-loader.c b/hw/core/generic-loader.c
index 4b1fc86a06..e7eb57e860 100644
--- a/hw/core/generic-loader.c
+++ b/hw/core/generic-loader.c
@@ -201,7 +201,7 @@ static void generic_loader_class_init(ObjectClass *klass, void *data)
      */
     dc->realize = generic_loader_realize;
     dc->unrealize = generic_loader_unrealize;
-    dc->props = generic_loader_props;
+    device_class_set_props(dc, generic_loader_props);
     dc->desc = "Generic Loader";
     set_bit(DEVICE_CATEGORY_MISC, dc->categories);
 }
diff --git a/hw/core/or-irq.c b/hw/core/or-irq.c
index 18d63831cd..4bbdbcb321 100644
--- a/hw/core/or-irq.c
+++ b/hw/core/or-irq.c
@@ -125,7 +125,7 @@ static void or_irq_class_init(ObjectClass *klass, void *data)
     DeviceClass *dc = DEVICE_CLASS(klass);
 
     dc->reset = or_irq_reset;
-    dc->props = or_irq_properties;
+    device_class_set_props(dc, or_irq_properties);
     dc->realize = or_irq_realize;
     dc->vmsd = &vmstate_or_irq;
 
diff --git a/hw/core/platform-bus.c b/hw/core/platform-bus.c
index edb0da1de8..22c5f76dd0 100644
--- a/hw/core/platform-bus.c
+++ b/hw/core/platform-bus.c
@@ -211,7 +211,7 @@ static void platform_bus_class_init(ObjectClass *klass, void *data)
     DeviceClass *dc = DEVICE_CLASS(klass);
 
     dc->realize = platform_bus_realize;
-    dc->props = platform_bus_properties;
+    device_class_set_props(dc, platform_bus_properties);
 }
 
 static const TypeInfo platform_bus_info = {
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index 87086053a9..8047ac9c26 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -1061,6 +1061,11 @@ static void device_class_init(ObjectClass *class, void *data)
     vc->get_id = device_vmstate_if_get_id;
 }
 
+void device_class_set_props(DeviceClass *dc, Property *props)
+{
+    dc->props = props;
+}
+
 void device_class_set_parent_reset(DeviceClass *dc,
                                    DeviceReset dev_reset,
                                    DeviceReset *parent_reset)
diff --git a/hw/core/split-irq.c b/hw/core/split-irq.c
index b5acc669fb..3b90af2e8f 100644
--- a/hw/core/split-irq.c
+++ b/hw/core/split-irq.c
@@ -69,7 +69,7 @@ static void split_irq_class_init(ObjectClass *klass, void *data)
     DeviceClass *dc = DEVICE_CLASS(klass);
 
     /* No state to reset or migrate */
-    dc->props = split_irq_properties;
+    device_class_set_props(dc, split_irq_properties);
     dc->realize = split_irq_realize;
 
     /* Reason: Needs to be wired up to work */