@samitouri / QOSamiQemu / commits / dc407aa6c6

hw/isa/lpc_ich9.c: convert ich9_lpc_initfn() object props to class props

ACPI_PM_PROP_SCI_INT can be updated to use object_class_property_add_uint8_ptr() with OBJ_PROP_FLAG_READ, whilst ICH9_LPC_SMI_NEGOTIATED_FEAT_PROP can be updated to use object_class_property_add_uint64_ptr(). Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com> Message-Id: <20260825134320.1039012-7-mark.caveayland@nutanix.com>

Mark Cave-Ayland committed Aug 25, 2026 at 14:41 UTC dc407aa6c684d06e98f66ee880fd1549c36fc119
1 file changed +20 -13
hw/isa/lpc_ich9.c
+20 -13
@@ -683,24 +683,11 @@ static void ich9_lpc_initfn(Object *obj)
683 {
684 ICH9LPCState *lpc = ICH9_LPC_DEVICE(obj);
685
686 - static const uint8_t acpi_enable_cmd = ICH9_APM_ACPI_ENABLE;
687 - static const uint8_t acpi_disable_cmd = ICH9_APM_ACPI_DISABLE;
688 -
686 object_initialize_child(obj, "rtc", &lpc->rtc, TYPE_MC146818_RTC);
687
688 qdev_init_gpio_out_named(DEVICE(lpc), lpc->gsi, ICH9_GPIO_GSI,
689 IOAPIC_NUM_PINS);
690
694 - object_property_add_uint8_ptr(obj, ACPI_PM_PROP_SCI_INT,
695 - &lpc->sci_gsi, OBJ_PROP_FLAG_READ);
696 - object_property_add_uint8_ptr(OBJECT(lpc), ACPI_PM_PROP_ACPI_ENABLE_CMD,
697 - &acpi_enable_cmd, OBJ_PROP_FLAG_READ);
698 - object_property_add_uint8_ptr(OBJECT(lpc), ACPI_PM_PROP_ACPI_DISABLE_CMD,
699 - &acpi_disable_cmd, OBJ_PROP_FLAG_READ);
700 - object_property_add_uint64_ptr(obj, ICH9_LPC_SMI_NEGOTIATED_FEAT_PROP,
701 - &lpc->smi_negotiated_features,
702 - OBJ_PROP_FLAG_READ);
703 -
691 ich9_pm_reset_properties(&lpc->pm);
692 ich9_pm_add_properties(obj, &lpc->pm);
693 }
@@ -888,6 +875,9 @@ static void ich9_lpc_class_init(ObjectClass *klass, const void *data)
875 AcpiDeviceIfClass *adevc = ACPI_DEVICE_IF_CLASS(klass);
876 AcpiDevAmlIfClass *amldevc = ACPI_DEV_AML_IF_CLASS(klass);
877
878 + static const uint8_t acpi_enable_cmd = ICH9_APM_ACPI_ENABLE;
879 + static const uint8_t acpi_disable_cmd = ICH9_APM_ACPI_DISABLE;
880 +
881 set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
882 device_class_set_legacy_reset(dc, ich9_lpc_reset);
883 k->realize = ich9_lpc_realize;
@@ -912,6 +902,23 @@ static void ich9_lpc_class_init(ObjectClass *klass, const void *data)
902 adevc->ospm_status = ich9_pm_ospm_status;
903 adevc->send_event = ich9_send_gpe;
904 amldevc->build_dev_aml = build_ich9_isa_aml;
905 +
906 + object_class_property_add_uint8_ptr(klass, ACPI_PM_PROP_SCI_INT,
907 + offsetof(ICH9LPCState, sci_gsi),
908 + OBJ_PROP_FLAG_READ);
909 + object_class_property_add_uint64_ptr(klass,
910 + ICH9_LPC_SMI_NEGOTIATED_FEAT_PROP,
911 + offsetof(ICH9LPCState,
912 + smi_negotiated_features),
913 + OBJ_PROP_FLAG_READ);
914 + object_class_static_property_add_uint8_ptr(klass,
915 + ACPI_PM_PROP_ACPI_ENABLE_CMD,
916 + &acpi_enable_cmd,
917 + OBJ_PROP_FLAG_READ);
918 + object_class_static_property_add_uint8_ptr(klass,
919 + ACPI_PM_PROP_ACPI_DISABLE_CMD,
920 + &acpi_disable_cmd,
921 + OBJ_PROP_FLAG_READ);
922 }
923
924 static const TypeInfo ich9_lpc_info = {