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-24 20:59:15 +01:00
committed by Paolo Bonzini
parent b77ade9bb3
commit 4f67d30b5e
399 changed files with 458 additions and 451 deletions
+1 -1
View File
@@ -245,7 +245,7 @@ static void virtio_9p_class_init(ObjectClass *klass, void *data)
DeviceClass *dc = DEVICE_CLASS(klass);
VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass);
dc->props = virtio_9p_properties;
device_class_set_props(dc, virtio_9p_properties);
dc->vmsd = &vmstate_virtio_9p;
set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
vdc->realize = virtio_9p_device_realize;
+1 -1
View File
@@ -282,7 +282,7 @@ static void acpi_ged_class_init(ObjectClass *class, void *data)
AcpiDeviceIfClass *adevc = ACPI_DEVICE_IF_CLASS(class);
dc->desc = "ACPI Generic Event Device";
dc->props = acpi_ged_properties;
device_class_set_props(dc, acpi_ged_properties);
dc->vmsd = &vmstate_acpi_ged;
hc->plug = acpi_ged_device_plug_cb;
+1 -1
View File
@@ -653,7 +653,7 @@ static void piix4_pm_class_init(ObjectClass *klass, void *data)
dc->reset = piix4_pm_reset;
dc->desc = "PM";
dc->vmsd = &vmstate_acpi;
dc->props = piix4_pm_properties;
device_class_set_props(dc, piix4_pm_properties);
/*
* Reason: part of PIIX4 southbridge, needs to be wired up,
* e.g. by mips_malta_init()
+1 -1
View File
@@ -226,7 +226,7 @@ static void vmgenid_device_class_init(ObjectClass *klass, void *data)
dc->vmsd = &vmstate_vmgenid;
dc->realize = vmgenid_realize;
dc->props = vmgenid_device_properties;
device_class_set_props(dc, vmgenid_device_properties);
dc->hotpluggable = false;
set_bit(DEVICE_CATEGORY_MISC, dc->categories);
}
+1 -1
View File
@@ -1283,7 +1283,7 @@ static void armsse_class_init(ObjectClass *klass, void *data)
dc->realize = armsse_realize;
dc->vmsd = &armsse_vmstate;
dc->props = info->props;
device_class_set_props(dc, info->props);
dc->reset = armsse_reset;
iic->check = armsse_idau_check;
asc->info = info;
+2 -2
View File
@@ -288,7 +288,7 @@ static void armv7m_class_init(ObjectClass *klass, void *data)
DeviceClass *dc = DEVICE_CLASS(klass);
dc->realize = armv7m_realize;
dc->props = armv7m_properties;
device_class_set_props(dc, armv7m_properties);
}
static const TypeInfo armv7m_info = {
@@ -367,7 +367,7 @@ static void bitband_class_init(ObjectClass *klass, void *data)
DeviceClass *dc = DEVICE_CLASS(klass);
dc->realize = bitband_realize;
dc->props = bitband_properties;
device_class_set_props(dc, bitband_properties);
}
static const TypeInfo bitband_info = {
+1 -1
View File
@@ -449,7 +449,7 @@ static void aspeed_soc_class_init(ObjectClass *oc, void *data)
dc->realize = aspeed_soc_realize;
/* Reason: Uses serial_hds and nd_table in realize() directly */
dc->user_creatable = false;
dc->props = aspeed_soc_properties;
device_class_set_props(dc, aspeed_soc_properties);
}
static const TypeInfo aspeed_soc_type_info = {
+1 -1
View File
@@ -180,7 +180,7 @@ static void bcm283x_class_init(ObjectClass *oc, void *data)
bc->info = data;
dc->realize = bcm2836_realize;
dc->props = bcm2836_props;
device_class_set_props(dc, bcm2836_props);
/* Reason: Must be wired up in code (see raspi_init() function) */
dc->user_creatable = false;
}
+1 -1
View File
@@ -673,7 +673,7 @@ static void core_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
dc->props = core_properties;
device_class_set_props(dc, core_properties);
dc->realize = integratorcm_realize;
dc->vmsd = &vmstate_integratorcm;
}
+1 -1
View File
@@ -229,7 +229,7 @@ static void m2sxxx_soc_class_init(ObjectClass *klass, void *data)
DeviceClass *dc = DEVICE_CLASS(klass);
dc->realize = m2sxxx_soc_realize;
dc->props = m2sxxx_soc_properties;
device_class_set_props(dc, m2sxxx_soc_properties);
}
static const TypeInfo m2sxxx_soc_info = {
+1 -1
View File
@@ -435,7 +435,7 @@ static void mv88w8618_eth_class_init(ObjectClass *klass, void *data)
DeviceClass *dc = DEVICE_CLASS(klass);
dc->vmsd = &mv88w8618_eth_vmsd;
dc->props = mv88w8618_eth_properties;
device_class_set_props(dc, mv88w8618_eth_properties);
dc->realize = mv88w8618_eth_realize;
}
+1 -1
View File
@@ -224,7 +224,7 @@ static void nrf51_soc_class_init(ObjectClass *klass, void *data)
DeviceClass *dc = DEVICE_CLASS(klass);
dc->realize = nrf51_soc_realize;
dc->props = nrf51_soc_properties;
device_class_set_props(dc, nrf51_soc_properties);
}
static const TypeInfo nrf51_soc_info = {
+2 -2
View File
@@ -1531,7 +1531,7 @@ static void pxa2xx_i2c_class_init(ObjectClass *klass, void *data)
dc->desc = "PXA2xx I2C Bus Controller";
dc->vmsd = &vmstate_pxa2xx_i2c;
dc->props = pxa2xx_i2c_properties;
device_class_set_props(dc, pxa2xx_i2c_properties);
}
static const TypeInfo pxa2xx_i2c_info = {
@@ -2015,7 +2015,7 @@ static void pxa2xx_fir_class_init(ObjectClass *klass, void *data)
dc->realize = pxa2xx_fir_realize;
dc->vmsd = &pxa2xx_fir_vmsd;
dc->props = pxa2xx_fir_properties;
device_class_set_props(dc, pxa2xx_fir_properties);
dc->reset = pxa2xx_fir_reset;
}
+1 -1
View File
@@ -347,7 +347,7 @@ static void pxa2xx_gpio_class_init(ObjectClass *klass, void *data)
DeviceClass *dc = DEVICE_CLASS(klass);
dc->desc = "PXA2xx GPIO controller";
dc->props = pxa2xx_gpio_properties;
device_class_set_props(dc, pxa2xx_gpio_properties);
dc->vmsd = &vmstate_pxa2xx_gpio_regs;
dc->realize = pxa2xx_gpio_realize;
}
+1 -1
View File
@@ -461,7 +461,7 @@ static void smmu_base_class_init(ObjectClass *klass, void *data)
DeviceClass *dc = DEVICE_CLASS(klass);
SMMUBaseClass *sbc = ARM_SMMU_CLASS(klass);
dc->props = smmu_dev_properties;
device_class_set_props(dc, smmu_dev_properties);
device_class_set_parent_realize(dc, smmu_base_realize,
&sbc->parent_realize);
dc->reset = smmu_base_reset;
+1 -1
View File
@@ -1083,7 +1083,7 @@ static void sl_nand_class_init(ObjectClass *klass, void *data)
DeviceClass *dc = DEVICE_CLASS(klass);
dc->vmsd = &vmstate_sl_nand_info;
dc->props = sl_nand_properties;
device_class_set_props(dc, sl_nand_properties);
dc->realize = sl_nand_realize;
/* Reason: init() method uses drive_get() */
dc->user_creatable = false;
+1 -1
View File
@@ -207,7 +207,7 @@ static void stm32f205_soc_class_init(ObjectClass *klass, void *data)
DeviceClass *dc = DEVICE_CLASS(klass);
dc->realize = stm32f205_soc_realize;
dc->props = stm32f205_soc_properties;
device_class_set_props(dc, stm32f205_soc_properties);
}
static const TypeInfo stm32f205_soc_info = {
+1 -1
View File
@@ -282,7 +282,7 @@ static void stm32f405_soc_class_init(ObjectClass *klass, void *data)
DeviceClass *dc = DEVICE_CLASS(klass);
dc->realize = stm32f405_soc_realize;
dc->props = stm32f405_soc_properties;
device_class_set_props(dc, stm32f405_soc_properties);
/* No vmstate or reset required: device has no internal state */
}
+1 -1
View File
@@ -1327,7 +1327,7 @@ static void strongarm_uart_class_init(ObjectClass *klass, void *data)
dc->desc = "StrongARM UART controller";
dc->reset = strongarm_uart_reset;
dc->vmsd = &vmstate_strongarm_uart_regs;
dc->props = strongarm_uart_properties;
device_class_set_props(dc, strongarm_uart_properties);
dc->realize = strongarm_uart_realize;
}
+1 -1
View File
@@ -305,7 +305,7 @@ static void versal_class_init(ObjectClass *klass, void *data)
DeviceClass *dc = DEVICE_CLASS(klass);
dc->realize = versal_realize;
dc->props = versal_properties;
device_class_set_props(dc, versal_properties);
/* No VMSD since we haven't got any top-level SoC state to save. */
}

Some files were not shown because too many files have changed in this diff Show More