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

@ -606,7 +606,7 @@ static void floppy_drive_class_init(ObjectClass *klass, void *data)
k->realize = floppy_drive_realize;
set_bit(DEVICE_CATEGORY_STORAGE, k->categories);
k->bus_type = TYPE_FLOPPY_BUS;
k->props = floppy_drive_properties;
device_class_set_props(k, floppy_drive_properties);
k->desc = "virtual floppy drive";
}
@ -2827,7 +2827,7 @@ static void isabus_fdc_class_init(ObjectClass *klass, void *data)
dc->fw_name = "fdc";
dc->reset = fdctrl_external_reset_isa;
dc->vmsd = &vmstate_isa_fdc;
dc->props = isa_fdc_properties;
device_class_set_props(dc, isa_fdc_properties);
set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
}
@ -2880,7 +2880,7 @@ static void sysbus_fdc_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
dc->props = sysbus_fdc_properties;
device_class_set_props(dc, sysbus_fdc_properties);
set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
}
@ -2906,7 +2906,7 @@ static void sun4m_fdc_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
dc->props = sun4m_fdc_properties;
device_class_set_props(dc, sun4m_fdc_properties);
set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
}

View file

@ -1391,7 +1391,7 @@ static void m25p80_class_init(ObjectClass *klass, void *data)
k->set_cs = m25p80_cs;
k->cs_polarity = SSI_CS_LOW;
dc->vmsd = &vmstate_m25p80;
dc->props = m25p80_properties;
device_class_set_props(dc, m25p80_properties);
dc->reset = m25p80_reset;
mc->pi = data;
}

View file

@ -448,7 +448,7 @@ static void nand_class_init(ObjectClass *klass, void *data)
dc->realize = nand_realize;
dc->reset = nand_reset;
dc->vmsd = &vmstate_nand;
dc->props = nand_properties;
device_class_set_props(dc, nand_properties);
}
static const TypeInfo nand_info = {

View file

@ -1475,7 +1475,7 @@ static void nvme_class_init(ObjectClass *oc, void *data)
set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
dc->desc = "Non-Volatile Memory Express";
dc->props = nvme_props;
device_class_set_props(dc, nvme_props);
dc->vmsd = &nvme_vmstate;
}

View file

@ -845,7 +845,7 @@ static void onenand_class_init(ObjectClass *klass, void *data)
dc->realize = onenand_realize;
dc->reset = onenand_system_reset;
dc->props = onenand_properties;
device_class_set_props(dc, onenand_properties);
}
static const TypeInfo onenand_info = {

View file

@ -930,7 +930,7 @@ static void pflash_cfi01_class_init(ObjectClass *klass, void *data)
dc->reset = pflash_cfi01_system_reset;
dc->realize = pflash_cfi01_realize;
dc->props = pflash_cfi01_properties;
device_class_set_props(dc, pflash_cfi01_properties);
dc->vmsd = &vmstate_pflash;
set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
}

View file

@ -963,7 +963,7 @@ static void pflash_cfi02_class_init(ObjectClass *klass, void *data)
dc->realize = pflash_cfi02_realize;
dc->unrealize = pflash_cfi02_unrealize;
dc->props = pflash_cfi02_properties;
device_class_set_props(dc, pflash_cfi02_properties);
set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
}

View file

@ -239,7 +239,7 @@ static void swim_drive_class_init(ObjectClass *klass, void *data)
k->realize = swim_drive_realize;
set_bit(DEVICE_CATEGORY_STORAGE, k->categories);
k->bus_type = TYPE_SWIM_BUS;
k->props = swim_drive_properties;
device_class_set_props(k, swim_drive_properties);
k->desc = "virtual SWIM drive";
}

View file

@ -511,7 +511,7 @@ static void vhost_user_blk_class_init(ObjectClass *klass, void *data)
DeviceClass *dc = DEVICE_CLASS(klass);
VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass);
dc->props = vhost_user_blk_properties;
device_class_set_props(dc, vhost_user_blk_properties);
dc->vmsd = &vmstate_vhost_user_blk;
set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
vdc->realize = vhost_user_blk_device_realize;

View file

@ -1294,7 +1294,7 @@ static void virtio_blk_class_init(ObjectClass *klass, void *data)
DeviceClass *dc = DEVICE_CLASS(klass);
VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass);
dc->props = virtio_blk_properties;
device_class_set_props(dc, virtio_blk_properties);
dc->vmsd = &vmstate_virtio_blk;
set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
vdc->realize = virtio_blk_device_realize;

View file

@ -554,7 +554,7 @@ static void xen_block_class_init(ObjectClass *class, void *data)
xendev_class->frontend_changed = xen_block_frontend_changed;
xendev_class->unrealize = xen_block_unrealize;
dev_class->props = xen_block_props;
device_class_set_props(dev_class, xen_block_props);
}
static const TypeInfo xen_block_type_info = {