hw/acpi/piix4.c: convert static variables to static class properties
The majority of the properties in piix4_pm_add_properties() are assigned to static variables and so can be converted to static class properties. Introduce piix4_pm_add_class_properties() to hold the static properties and soon all other class props after they have been converted from object props. Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20260825134320.1039012-16-mark.caveayland@nutanix.com>
Mark Cave-Ayland committed
Aug 25, 2026 at 14:41 UTC
2f4220bc5ff3bfce3f9ae84945d93fe6913a77b4
1 file changed
+28
-12
hw/acpi/piix4.c
+28
-12
@@ -406,6 +406,12 @@ static void piix4_pm_machine_ready(Notifier *n, void *opaque)
406
}
407
408
static void piix4_pm_add_properties(PIIX4PMState *s)
409
+{
410
+ object_property_add_uint32_ptr(OBJECT(s), ACPI_PM_PROP_PM_IO_BASE,
411
+ &s->io_base, OBJ_PROP_FLAG_READ);
412
+}
413
+
414
+static void piix4_pm_add_class_properties(ObjectClass *oc)
415
{
416
static const uint8_t acpi_enable_cmd = ACPI_ENABLE;
417
static const uint8_t acpi_disable_cmd = ACPI_DISABLE;
@@ -413,18 +419,26 @@ static void piix4_pm_add_properties(PIIX4PMState *s)
419
static const uint32_t gpe0_blk_len = GPE_LEN;
420
static const uint16_t sci_int = 9;
421
416
- object_property_add_uint8_ptr(OBJECT(s), ACPI_PM_PROP_ACPI_ENABLE_CMD,
417
- &acpi_enable_cmd, OBJ_PROP_FLAG_READ);
418
- object_property_add_uint8_ptr(OBJECT(s), ACPI_PM_PROP_ACPI_DISABLE_CMD,
419
- &acpi_disable_cmd, OBJ_PROP_FLAG_READ);
420
- object_property_add_uint32_ptr(OBJECT(s), ACPI_PM_PROP_GPE0_BLK,
421
- &gpe0_blk, OBJ_PROP_FLAG_READ);
422
- object_property_add_uint32_ptr(OBJECT(s), ACPI_PM_PROP_GPE0_BLK_LEN,
423
- &gpe0_blk_len, OBJ_PROP_FLAG_READ);
424
- object_property_add_uint16_ptr(OBJECT(s), ACPI_PM_PROP_SCI_INT,
425
- &sci_int, OBJ_PROP_FLAG_READ);
426
- object_property_add_uint32_ptr(OBJECT(s), ACPI_PM_PROP_PM_IO_BASE,
427
- &s->io_base, OBJ_PROP_FLAG_READ);
422
+ object_class_static_property_add_uint8_ptr(oc,
423
+ ACPI_PM_PROP_ACPI_ENABLE_CMD,
424
+ &acpi_enable_cmd,
425
+ OBJ_PROP_FLAG_READ);
426
+ object_class_static_property_add_uint8_ptr(oc,
427
+ ACPI_PM_PROP_ACPI_DISABLE_CMD,
428
+ &acpi_disable_cmd,
429
+ OBJ_PROP_FLAG_READ);
430
+ object_class_static_property_add_uint32_ptr(oc,
431
+ ACPI_PM_PROP_GPE0_BLK,
432
+ &gpe0_blk,
433
+ OBJ_PROP_FLAG_READ);
434
+ object_class_static_property_add_uint32_ptr(oc,
435
+ ACPI_PM_PROP_GPE0_BLK_LEN,
436
+ &gpe0_blk_len,
437
+ OBJ_PROP_FLAG_READ);
438
+ object_class_static_property_add_uint16_ptr(oc,
439
+ ACPI_PM_PROP_SCI_INT,
440
+ &sci_int,
441
+ OBJ_PROP_FLAG_READ);
442
}
443
444
static void piix4_pm_realize(PCIDevice *dev, Error **errp)
@@ -616,6 +630,8 @@ static void piix4_pm_class_init(ObjectClass *klass, const void *data)
630
offsetof(PIIX4PMState,
631
acpi_pci_hotplug.io_len),
632
OBJ_PROP_FLAG_READ);
633
+
634
+ piix4_pm_add_class_properties(klass);
635
}
636
637
static const TypeInfo piix4_pm_info = {