From nobody Wed Nov 5 02:29:52 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1532374432986301.21090513688034; Mon, 23 Jul 2018 12:33:52 -0700 (PDT) Received: from localhost ([::1]:36161 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fhgaV-0004s6-8k for importer@patchew.org; Mon, 23 Jul 2018 15:33:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55248) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fhgYp-0003vk-5C for qemu-devel@nongnu.org; Mon, 23 Jul 2018 15:32:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fhgYn-0001JS-Us for qemu-devel@nongnu.org; Mon, 23 Jul 2018 15:31:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:61149) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fhgYn-0001JA-Mx for qemu-devel@nongnu.org; Mon, 23 Jul 2018 15:31:57 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D816D31500A1; Mon, 23 Jul 2018 19:31:56 +0000 (UTC) Received: from localhost (ovpn-116-56.gru2.redhat.com [10.97.116.56]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7F2D35C26E; Mon, 23 Jul 2018 19:31:53 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Date: Mon, 23 Jul 2018 16:31:44 -0300 Message-Id: <20180723193145.24705-2-ehabkost@redhat.com> In-Reply-To: <20180723193145.24705-1-ehabkost@redhat.com> References: <20180723193145.24705-1-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Mon, 23 Jul 2018 19:31:56 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-3.1 1/2] acpi: Improve acpi_send_event() type safety X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Igor Mammedov , Ben Warren , Xiao Guangrong , "Michael S. Tsirkin" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" acpi_send_event() requires an object that implements TYPE_ACPI_DEVICE_IF. Indicate that in the function prototype. Signed-off-by: Eduardo Habkost Reviewed-by: Igor Mammedov --- include/hw/acpi/acpi_dev_interface.h | 2 +- hw/acpi/acpi_interface.c | 5 ++--- hw/acpi/cpu.c | 4 ++-- hw/acpi/cpu_hotplug.c | 2 +- hw/acpi/memory_hotplug.c | 4 ++-- hw/acpi/nvdimm.c | 2 +- hw/acpi/pcihp.c | 4 ++-- hw/acpi/vmgenid.c | 2 +- 8 files changed, 12 insertions(+), 13 deletions(-) diff --git a/include/hw/acpi/acpi_dev_interface.h b/include/hw/acpi/acpi_de= v_interface.h index dabf4c4fc9..bab71f9d60 100644 --- a/include/hw/acpi/acpi_dev_interface.h +++ b/include/hw/acpi/acpi_dev_interface.h @@ -31,7 +31,7 @@ typedef struct AcpiDeviceIf { Object Parent; } AcpiDeviceIf; =20 -void acpi_send_event(DeviceState *dev, AcpiEventStatusBits event); +void acpi_send_event(AcpiDeviceIf *dev, AcpiEventStatusBits event); =20 /** * AcpiDeviceIfClass: diff --git a/hw/acpi/acpi_interface.c b/hw/acpi/acpi_interface.c index 6583917b8e..f9b538293e 100644 --- a/hw/acpi/acpi_interface.c +++ b/hw/acpi/acpi_interface.c @@ -2,12 +2,11 @@ #include "hw/acpi/acpi_dev_interface.h" #include "qemu/module.h" =20 -void acpi_send_event(DeviceState *dev, AcpiEventStatusBits event) +void acpi_send_event(AcpiDeviceIf *dev, AcpiEventStatusBits event) { AcpiDeviceIfClass *adevc =3D ACPI_DEVICE_IF_GET_CLASS(dev); if (adevc->send_event) { - AcpiDeviceIf *adev =3D ACPI_DEVICE_IF(dev); - adevc->send_event(adev, event); + adevc->send_event(dev, event); } } =20 diff --git a/hw/acpi/cpu.c b/hw/acpi/cpu.c index 5ae595ecbe..2eb9b5a032 100644 --- a/hw/acpi/cpu.c +++ b/hw/acpi/cpu.c @@ -233,7 +233,7 @@ void acpi_cpu_plug_cb(HotplugHandler *hotplug_dev, cdev->cpu =3D CPU(dev); if (dev->hotplugged) { cdev->is_inserting =3D true; - acpi_send_event(DEVICE(hotplug_dev), ACPI_CPU_HOTPLUG_STATUS); + acpi_send_event(ACPI_DEVICE_IF(hotplug_dev), ACPI_CPU_HOTPLUG_STAT= US); } } =20 @@ -249,7 +249,7 @@ void acpi_cpu_unplug_request_cb(HotplugHandler *hotplug= _dev, } =20 cdev->is_removing =3D true; - acpi_send_event(DEVICE(hotplug_dev), ACPI_CPU_HOTPLUG_STATUS); + acpi_send_event(ACPI_DEVICE_IF(hotplug_dev), ACPI_CPU_HOTPLUG_STATUS); } =20 void acpi_cpu_unplug_cb(CPUHotplugState *cpu_st, diff --git a/hw/acpi/cpu_hotplug.c b/hw/acpi/cpu_hotplug.c index 5243918125..5a1599796b 100644 --- a/hw/acpi/cpu_hotplug.c +++ b/hw/acpi/cpu_hotplug.c @@ -79,7 +79,7 @@ void legacy_acpi_cpu_plug_cb(HotplugHandler *hotplug_dev, if (*errp !=3D NULL) { return; } - acpi_send_event(DEVICE(hotplug_dev), ACPI_CPU_HOTPLUG_STATUS); + acpi_send_event(ACPI_DEVICE_IF(hotplug_dev), ACPI_CPU_HOTPLUG_STATUS); } =20 void legacy_acpi_cpu_hotplug_init(MemoryRegion *parent, Object *owner, diff --git a/hw/acpi/memory_hotplug.c b/hw/acpi/memory_hotplug.c index 0ff1712c4c..24b2aa0301 100644 --- a/hw/acpi/memory_hotplug.c +++ b/hw/acpi/memory_hotplug.c @@ -280,7 +280,7 @@ void acpi_memory_plug_cb(HotplugHandler *hotplug_dev, M= emHotplugState *mem_st, mdev->is_enabled =3D true; if (dev->hotplugged) { mdev->is_inserting =3D true; - acpi_send_event(DEVICE(hotplug_dev), ACPI_MEMORY_HOTPLUG_STATUS); + acpi_send_event(ACPI_DEVICE_IF(hotplug_dev), ACPI_MEMORY_HOTPLUG_S= TATUS); } } =20 @@ -296,7 +296,7 @@ void acpi_memory_unplug_request_cb(HotplugHandler *hotp= lug_dev, } =20 mdev->is_removing =3D true; - acpi_send_event(DEVICE(hotplug_dev), ACPI_MEMORY_HOTPLUG_STATUS); + acpi_send_event(ACPI_DEVICE_IF(hotplug_dev), ACPI_MEMORY_HOTPLUG_STATU= S); } =20 void acpi_memory_unplug_cb(MemHotplugState *mem_st, diff --git a/hw/acpi/nvdimm.c b/hw/acpi/nvdimm.c index 27eeb6609f..bdc373696d 100644 --- a/hw/acpi/nvdimm.c +++ b/hw/acpi/nvdimm.c @@ -921,7 +921,7 @@ static const MemoryRegionOps nvdimm_dsm_ops =3D { void nvdimm_acpi_plug_cb(HotplugHandler *hotplug_dev, DeviceState *dev) { if (dev->hotplugged) { - acpi_send_event(DEVICE(hotplug_dev), ACPI_NVDIMM_HOTPLUG_STATUS); + acpi_send_event(ACPI_DEVICE_IF(hotplug_dev), ACPI_NVDIMM_HOTPLUG_S= TATUS); } } =20 diff --git a/hw/acpi/pcihp.c b/hw/acpi/pcihp.c index 80d42e12ff..b3bb11dac5 100644 --- a/hw/acpi/pcihp.c +++ b/hw/acpi/pcihp.c @@ -237,7 +237,7 @@ void acpi_pcihp_device_plug_cb(HotplugHandler *hotplug_= dev, AcpiPciHpState *s, } =20 s->acpi_pcihp_pci_status[bsel].up |=3D (1U << slot); - acpi_send_event(DEVICE(hotplug_dev), ACPI_PCI_HOTPLUG_STATUS); + acpi_send_event(ACPI_DEVICE_IF(hotplug_dev), ACPI_PCI_HOTPLUG_STATUS); } =20 void acpi_pcihp_device_unplug_cb(HotplugHandler *hotplug_dev, AcpiPciHpSta= te *s, @@ -253,7 +253,7 @@ void acpi_pcihp_device_unplug_cb(HotplugHandler *hotplu= g_dev, AcpiPciHpState *s, } =20 s->acpi_pcihp_pci_status[bsel].down |=3D (1U << slot); - acpi_send_event(DEVICE(hotplug_dev), ACPI_PCI_HOTPLUG_STATUS); + acpi_send_event(ACPI_DEVICE_IF(hotplug_dev), ACPI_PCI_HOTPLUG_STATUS); } =20 static uint64_t pci_read(void *opaque, hwaddr addr, unsigned int size) diff --git a/hw/acpi/vmgenid.c b/hw/acpi/vmgenid.c index d78b579a20..74caedde79 100644 --- a/hw/acpi/vmgenid.c +++ b/hw/acpi/vmgenid.c @@ -158,7 +158,7 @@ static void vmgenid_update_guest(VmGenIdState *vms) cpu_physical_memory_write(vmgenid_addr, guid_le.data, sizeof(guid_le.data)); /* Send _GPE.E05 event */ - acpi_send_event(DEVICE(obj), ACPI_VMGENID_CHANGE_STATUS); + acpi_send_event(ACPI_DEVICE_IF(obj), ACPI_VMGENID_CHANGE_STATU= S); } } } --=20 2.18.0.rc1.1.g3f1ff2140