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>
diff --git a/hw/input/virtio-input-hid.c b/hw/input/virtio-input-hid.c
index 386a363..e8ae6c1 100644
--- a/hw/input/virtio-input-hid.c
+++ b/hw/input/virtio-input-hid.c
@@ -222,7 +222,7 @@
DeviceClass *dc = DEVICE_CLASS(klass);
VirtIOInputClass *vic = VIRTIO_INPUT_CLASS(klass);
- dc->props = virtio_input_hid_properties;
+ device_class_set_props(dc, virtio_input_hid_properties);
vic->realize = virtio_input_hid_realize;
vic->unrealize = virtio_input_hid_unrealize;
vic->change_active = virtio_input_hid_change_active;
@@ -362,7 +362,7 @@
{
DeviceClass *dc = DEVICE_CLASS(klass);
- dc->props = virtio_mouse_properties;
+ device_class_set_props(dc, virtio_mouse_properties);
}
static void virtio_mouse_init(Object *obj)
@@ -486,7 +486,7 @@
{
DeviceClass *dc = DEVICE_CLASS(klass);
- dc->props = virtio_tablet_properties;
+ device_class_set_props(dc, virtio_tablet_properties);
}
static void virtio_tablet_init(Object *obj)