[PATCH 02/10] hw/acpi: Move acpi_send_event() function out of acpi_interface.c

Philippe Mathieu-Daudé posted 10 patches 1 month, 2 weeks ago
Maintainers: Christian Schoenebeck <qemu_oss@crudebyte.com>, Greg Kurz <groug@kaod.org>, "Michael S. Tsirkin" <mst@redhat.com>, Igor Mammedov <imammedo@redhat.com>, Ani Sinha <anisinha@redhat.com>, Jonathan Cameron <jonathan.cameron@huawei.com>, Fan Ni <fan.ni@samsung.com>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, Paolo Bonzini <pbonzini@redhat.com>, Richard Henderson <richard.henderson@linaro.org>, Eduardo Habkost <eduardo@habkost.net>, Jason Wang <jasowang@redhat.com>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, "Daniel P. Berrangé" <berrange@redhat.com>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, "Alex Bennée" <alex.bennee@linaro.org>
There is a newer version of this series
[PATCH 02/10] hw/acpi: Move acpi_send_event() function out of acpi_interface.c
Posted by Philippe Mathieu-Daudé 1 month, 2 weeks ago
acpi_interface.c should only register QOM interfaces. Move
the acpi_send_event() function to core.c with the other
event handlers.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/acpi/acpi_interface.c |  9 ---------
 hw/acpi/core.c           | 10 ++++++++++
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/hw/acpi/acpi_interface.c b/hw/acpi/acpi_interface.c
index 8637ff18fca..e58e8aaee23 100644
--- a/hw/acpi/acpi_interface.c
+++ b/hw/acpi/acpi_interface.c
@@ -4,15 +4,6 @@
 #include "qemu/module.h"
 #include "qemu/queue.h"
 
-void acpi_send_event(DeviceState *dev, AcpiEventStatusBits event)
-{
-    AcpiDeviceIfClass *adevc = ACPI_DEVICE_IF_GET_CLASS(dev);
-    if (adevc->send_event) {
-        AcpiDeviceIf *adev = ACPI_DEVICE_IF(dev);
-        adevc->send_event(adev, event);
-    }
-}
-
 void qbus_build_aml(BusState *bus, Aml *scope)
 {
     BusChild *kid;
diff --git a/hw/acpi/core.c b/hw/acpi/core.c
index 6b65e587f2a..a6a62a742d1 100644
--- a/hw/acpi/core.c
+++ b/hw/acpi/core.c
@@ -22,6 +22,7 @@
 #include "qemu/osdep.h"
 #include "hw/core/irq.h"
 #include "hw/acpi/acpi.h"
+#include "hw/acpi/acpi_dev_interface.h"
 #include "hw/nvram/fw_cfg.h"
 #include "qemu/config-file.h"
 #include "qapi/error.h"
@@ -753,3 +754,12 @@ void acpi_update_sci(ACPIREGS *regs, qemu_irq irq)
                        (regs->pm1.evt.en & ACPI_BITMASK_TIMER_ENABLE) &&
                        !(pm1a_sts & ACPI_BITMASK_TIMER_STATUS));
 }
+
+void acpi_send_event(DeviceState *dev, AcpiEventStatusBits event)
+{
+    AcpiDeviceIfClass *adevc = ACPI_DEVICE_IF_GET_CLASS(dev);
+    if (adevc->send_event) {
+        AcpiDeviceIf *adev = ACPI_DEVICE_IF(dev);
+        adevc->send_event(adev, event);
+    }
+}
-- 
2.52.0


Re: [PATCH 02/10] hw/acpi: Move acpi_send_event() function out of acpi_interface.c
Posted by Pierrick Bouvier 1 month, 2 weeks ago
On 2/24/26 10:20 AM, Philippe Mathieu-Daudé wrote:
> acpi_interface.c should only register QOM interfaces. Move
> the acpi_send_event() function to core.c with the other
> event handlers.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   hw/acpi/acpi_interface.c |  9 ---------
>   hw/acpi/core.c           | 10 ++++++++++
>   2 files changed, 10 insertions(+), 9 deletions(-)
> 

Should you move the function declaration to hw/acpi/acpi.h in this case?
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>

Re: [PATCH 02/10] hw/acpi: Move acpi_send_event() function out of acpi_interface.c
Posted by Philippe Mathieu-Daudé 1 month, 2 weeks ago
On 24/2/26 20:23, Pierrick Bouvier wrote:
> On 2/24/26 10:20 AM, Philippe Mathieu-Daudé wrote:
>> acpi_interface.c should only register QOM interfaces. Move
>> the acpi_send_event() function to core.c with the other
>> event handlers.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> ---
>>   hw/acpi/acpi_interface.c |  9 ---------
>>   hw/acpi/core.c           | 10 ++++++++++
>>   2 files changed, 10 insertions(+), 9 deletions(-)
>>
> 
> Should you move the function declaration to hw/acpi/acpi.h in this case?

Good point, will do.

> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>

Thanks!