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>
This commit is contained in:
Marc-André Lureau 2020-01-10 19:30:32 +04:00 committed by Paolo Bonzini
parent b77ade9bb3
commit 4f67d30b5e
399 changed files with 458 additions and 451 deletions

View file

@ -980,7 +980,7 @@ static void ati_vga_class_init(ObjectClass *klass, void *data)
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
dc->reset = ati_vga_reset;
dc->props = ati_vga_properties;
device_class_set_props(dc, ati_vga_properties);
dc->hotpluggable = false;
set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories);

View file

@ -451,7 +451,7 @@ static void bcm2835_fb_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
dc->props = bcm2835_fb_props;
device_class_set_props(dc, bcm2835_fb_props);
dc->realize = bcm2835_fb_realize;
dc->reset = bcm2835_fb_reset;
dc->vmsd = &vmstate_bcm2835_fb;

View file

@ -364,7 +364,7 @@ static void bochs_display_class_init(ObjectClass *klass, void *data)
k->romfile = "vgabios-bochs-display.bin";
k->exit = bochs_display_exit;
dc->vmsd = &vmstate_bochs_display;
dc->props = bochs_display_properties;
device_class_set_props(dc, bochs_display_properties);
set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories);
}

View file

@ -382,7 +382,7 @@ static void cg3_class_init(ObjectClass *klass, void *data)
dc->realize = cg3_realizefn;
dc->reset = cg3_reset;
dc->vmsd = &vmstate_cg3;
dc->props = cg3_properties;
device_class_set_props(dc, cg3_properties);
}
static const TypeInfo cg3_info = {

View file

@ -3031,7 +3031,7 @@ static void cirrus_vga_class_init(ObjectClass *klass, void *data)
set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories);
dc->desc = "Cirrus CLGD 54xx VGA";
dc->vmsd = &vmstate_pci_cirrus_vga;
dc->props = pci_vga_cirrus_properties;
device_class_set_props(dc, pci_vga_cirrus_properties);
dc->hotpluggable = false;
}

View file

@ -80,7 +80,7 @@ static void isa_cirrus_vga_class_init(ObjectClass *klass, void *data)
dc->vmsd = &vmstate_cirrus_vga;
dc->realize = isa_cirrus_vga_realizefn;
dc->props = isa_cirrus_vga_properties;
device_class_set_props(dc, isa_cirrus_vga_properties);
set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories);
}

View file

@ -526,7 +526,7 @@ static void g364fb_sysbus_class_init(ObjectClass *klass, void *data)
dc->desc = "G364 framebuffer";
dc->reset = g364fb_sysbus_reset;
dc->vmsd = &vmstate_g364fb;
dc->props = g364fb_sysbus_properties;
device_class_set_props(dc, g364fb_sysbus_properties);
}
static const TypeInfo g364fb_sysbus_info = {

View file

@ -107,7 +107,7 @@ static void i2c_ddc_class_init(ObjectClass *oc, void *data)
dc->reset = i2c_ddc_reset;
dc->vmsd = &vmstate_i2c_ddc;
dc->props = i2c_ddc_properties;
device_class_set_props(dc, i2c_ddc_properties);
isc->event = i2c_ddc_event;
isc->recv = i2c_ddc_rx;
isc->send = i2c_ddc_tx;

View file

@ -437,7 +437,7 @@ static void macfb_sysbus_class_init(ObjectClass *klass, void *data)
dc->desc = "SysBus Macintosh framebuffer";
dc->reset = macfb_sysbus_reset;
dc->vmsd = &vmstate_macfb;
dc->props = macfb_sysbus_properties;
device_class_set_props(dc, macfb_sysbus_properties);
}
static void macfb_nubus_class_init(ObjectClass *klass, void *data)
@ -450,7 +450,7 @@ static void macfb_nubus_class_init(ObjectClass *klass, void *data)
dc->desc = "Nubus Macintosh framebuffer";
dc->reset = macfb_nubus_reset;
dc->vmsd = &vmstate_macfb;
dc->props = macfb_nubus_properties;
device_class_set_props(dc, macfb_nubus_properties);
}
static TypeInfo macfb_sysbus_info = {

View file

@ -341,7 +341,7 @@ static void milkymist_vgafb_class_init(ObjectClass *klass, void *data)
dc->reset = milkymist_vgafb_reset;
dc->vmsd = &vmstate_milkymist_vgafb;
dc->props = milkymist_vgafb_properties;
device_class_set_props(dc, milkymist_vgafb_properties);
dc->realize = milkymist_vgafb_realize;
}

View file

@ -2478,7 +2478,7 @@ static void qxl_pci_class_init(ObjectClass *klass, void *data)
set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories);
dc->reset = qxl_reset_handler;
dc->vmsd = &qxl_vmstate;
dc->props = qxl_properties;
device_class_set_props(dc, qxl_properties);
}
static const TypeInfo qxl_pci_type_info = {

View file

@ -52,7 +52,7 @@ static void ramfb_class_initfn(ObjectClass *klass, void *data)
set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories);
dc->realize = ramfb_realizefn;
dc->props = ramfb_properties;
device_class_set_props(dc, ramfb_properties);
dc->desc = "ram framebuffer standalone device";
dc->user_creatable = true;
}

View file

@ -1995,7 +1995,7 @@ static void sm501_sysbus_class_init(ObjectClass *klass, void *data)
dc->realize = sm501_realize_sysbus;
set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories);
dc->desc = "SM501 Multimedia Companion";
dc->props = sm501_sysbus_properties;
device_class_set_props(dc, sm501_sysbus_properties);
dc->reset = sm501_reset_sysbus;
dc->vmsd = &vmstate_sm501_sysbus;
}
@ -2085,7 +2085,7 @@ static void sm501_pci_class_init(ObjectClass *klass, void *data)
k->class_id = PCI_CLASS_DISPLAY_OTHER;
set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories);
dc->desc = "SM501 Display Controller";
dc->props = sm501_pci_properties;
device_class_set_props(dc, sm501_pci_properties);
dc->reset = sm501_reset_pci;
dc->hotpluggable = false;
dc->vmsd = &vmstate_sm501_pci;

View file

@ -893,7 +893,7 @@ static void tcx_class_init(ObjectClass *klass, void *data)
dc->realize = tcx_realizefn;
dc->reset = tcx_reset;
dc->vmsd = &vmstate_tcx;
dc->props = tcx_properties;
device_class_set_props(dc, tcx_properties);
}
static const TypeInfo tcx_info = {

View file

@ -95,7 +95,7 @@ static void vga_isa_class_initfn(ObjectClass *klass, void *data)
dc->realize = vga_isa_realizefn;
dc->reset = vga_isa_reset;
dc->vmsd = &vmstate_vga_common;
dc->props = vga_isa_properties;
device_class_set_props(dc, vga_isa_properties);
set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories);
}

View file

@ -383,7 +383,7 @@ static void vga_class_init(ObjectClass *klass, void *data)
k->realize = pci_std_vga_realize;
k->romfile = "vgabios-stdvga.bin";
k->class_id = PCI_CLASS_DISPLAY_VGA;
dc->props = vga_pci_properties;
device_class_set_props(dc, vga_pci_properties);
dc->hotpluggable = false;
}
@ -395,7 +395,7 @@ static void secondary_class_init(ObjectClass *klass, void *data)
k->realize = pci_secondary_vga_realize;
k->exit = pci_secondary_vga_exit;
k->class_id = PCI_CLASS_DISPLAY_OTHER;
dc->props = secondary_pci_properties;
device_class_set_props(dc, secondary_pci_properties);
dc->reset = pci_secondary_vga_reset;
}

View file

@ -588,7 +588,7 @@ vhost_user_gpu_class_init(ObjectClass *klass, void *data)
vdc->get_config = vhost_user_gpu_get_config;
vdc->set_config = vhost_user_gpu_set_config;
dc->props = vhost_user_gpu_properties;
device_class_set_props(dc, vhost_user_gpu_properties);
}
static const TypeInfo vhost_user_gpu_info = {

View file

@ -56,7 +56,7 @@ static void virtio_gpu_pci_base_class_init(ObjectClass *klass, void *data)
PCIDeviceClass *pcidev_k = PCI_DEVICE_CLASS(klass);
set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories);
dc->props = virtio_gpu_pci_base_properties;
device_class_set_props(dc, virtio_gpu_pci_base_properties);
dc->hotpluggable = false;
k->realize = virtio_gpu_pci_base_realize;
pcidev_k->class_id = PCI_CLASS_DISPLAY_OTHER;

View file

@ -1254,7 +1254,7 @@ static void virtio_gpu_class_init(ObjectClass *klass, void *data)
vdc->set_config = virtio_gpu_set_config;
dc->vmsd = &vmstate_virtio_gpu;
dc->props = virtio_gpu_properties;
device_class_set_props(dc, virtio_gpu_properties);
}
static const TypeInfo virtio_gpu_info = {

View file

@ -184,7 +184,7 @@ static void virtio_vga_base_class_init(ObjectClass *klass, void *data)
PCIDeviceClass *pcidev_k = PCI_DEVICE_CLASS(klass);
set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories);
dc->props = virtio_vga_base_properties;
device_class_set_props(dc, virtio_vga_base_properties);
dc->vmsd = &vmstate_virtio_vga_base;
dc->hotpluggable = false;
device_class_set_parent_reset(dc, virtio_vga_base_reset,

View file

@ -1336,7 +1336,7 @@ static void vmsvga_class_init(ObjectClass *klass, void *data)
k->subsystem_id = SVGA_PCI_DEVICE_ID;
dc->reset = vmsvga_reset;
dc->vmsd = &vmstate_vmware_vga;
dc->props = vga_vmware_properties;
device_class_set_props(dc, vga_vmware_properties);
dc->hotpluggable = false;
set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories);
}