[PATCH 3/5] hw/acpi/ich9: Include missing headers

Philippe Mathieu-Daudé posted 5 patches 8 months, 4 weeks ago
Maintainers: "Michael S. Tsirkin" <mst@redhat.com>, Igor Mammedov <imammedo@redhat.com>, Ani Sinha <anisinha@redhat.com>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, Paolo Bonzini <pbonzini@redhat.com>, Richard Henderson <richard.henderson@linaro.org>, Eduardo Habkost <eduardo@habkost.net>
There is a newer version of this series
[PATCH 3/5] hw/acpi/ich9: Include missing headers
Posted by Philippe Mathieu-Daudé 8 months, 4 weeks ago
The ICH9LPCPMRegs structure has MemoryRegion and
Notifier fields, so requires the "qemu/notify.h"
and "exec/memory.h" headers.

However nothing from "hw/acpi/acpi_dev_interface.h"
is required, so reduce its inclusion to hw/acpi/ich9.c
source file where it is used.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/acpi/ich9.h | 3 ++-
 hw/acpi/ich9.c         | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/include/hw/acpi/ich9.h b/include/hw/acpi/ich9.h
index 2faf7f0cae..215de3c91f 100644
--- a/include/hw/acpi/ich9.h
+++ b/include/hw/acpi/ich9.h
@@ -21,12 +21,13 @@
 #ifndef HW_ACPI_ICH9_H
 #define HW_ACPI_ICH9_H
 
+#include "qemu/notify.h"
+#include "exec/memory.h"
 #include "hw/acpi/acpi.h"
 #include "hw/acpi/cpu_hotplug.h"
 #include "hw/acpi/cpu.h"
 #include "hw/acpi/pcihp.h"
 #include "hw/acpi/memory_hotplug.h"
-#include "hw/acpi/acpi_dev_interface.h"
 #include "hw/acpi/ich9_tco.h"
 
 #define ACPI_PCIHP_ADDR_ICH9 0x0cc0
diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c
index 573d032e8e..be375a8b9d 100644
--- a/hw/acpi/ich9.c
+++ b/hw/acpi/ich9.c
@@ -35,7 +35,7 @@
 #include "sysemu/runstate.h"
 #include "hw/acpi/acpi.h"
 #include "hw/acpi/ich9_tco.h"
-
+#include "hw/acpi/acpi_dev_interface.h"
 #include "hw/southbridge/ich9.h"
 #include "hw/mem/pc-dimm.h"
 #include "hw/mem/nvdimm.h"
-- 
2.41.0


Re: [PATCH 3/5] hw/acpi/ich9: Include missing headers
Posted by Zhao Liu 8 months, 4 weeks ago
Hi Philippe,

On Mon, Feb 19, 2024 at 03:14:09PM +0100, Philippe Mathieu-Daudé wrote:
> Date: Mon, 19 Feb 2024 15:14:09 +0100
> From: Philippe Mathieu-Daudé <philmd@linaro.org>
> Subject: [PATCH 3/5] hw/acpi/ich9: Include missing headers
> X-Mailer: git-send-email 2.41.0
> 
> The ICH9LPCPMRegs structure has MemoryRegion and
> Notifier fields, so requires the "qemu/notify.h"
> and "exec/memory.h" headers.
> 
> However nothing from "hw/acpi/acpi_dev_interface.h"
> is required, so reduce its inclusion to hw/acpi/ich9.c
> source file where it is used.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>  include/hw/acpi/ich9.h | 3 ++-
>  hw/acpi/ich9.c         | 2 +-
>  2 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/include/hw/acpi/ich9.h b/include/hw/acpi/ich9.h
> index 2faf7f0cae..215de3c91f 100644
> --- a/include/hw/acpi/ich9.h
> +++ b/include/hw/acpi/ich9.h
> @@ -21,12 +21,13 @@
>  #ifndef HW_ACPI_ICH9_H
>  #define HW_ACPI_ICH9_H
>  
> +#include "qemu/notify.h"
> +#include "exec/memory.h"
>  #include "hw/acpi/acpi.h"
>  #include "hw/acpi/cpu_hotplug.h"
>  #include "hw/acpi/cpu.h"
>  #include "hw/acpi/pcihp.h"
>  #include "hw/acpi/memory_hotplug.h"
> -#include "hw/acpi/acpi_dev_interface.h"
>  #include "hw/acpi/ich9_tco.h"
>  
>  #define ACPI_PCIHP_ADDR_ICH9 0x0cc0
> diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c
> index 573d032e8e..be375a8b9d 100644
> --- a/hw/acpi/ich9.c
> +++ b/hw/acpi/ich9.c
> @@ -35,7 +35,7 @@
>  #include "sysemu/runstate.h"
>  #include "hw/acpi/acpi.h"
>  #include "hw/acpi/ich9_tco.h"
> -
> +#include "hw/acpi/acpi_dev_interface.h"

Do we have the requirement for included header ordering?
If so, it would be better to put it before "hw/acpi/ich9_tco.h".

-Zhao

>  #include "hw/southbridge/ich9.h"
>  #include "hw/mem/pc-dimm.h"
>  #include "hw/mem/nvdimm.h"
> -- 
> 2.41.0
> 
> 
Re: [PATCH 3/5] hw/acpi/ich9: Include missing headers
Posted by Philippe Mathieu-Daudé 8 months, 3 weeks ago
On 20/2/24 03:33, Zhao Liu wrote:
> Hi Philippe,
> 
> On Mon, Feb 19, 2024 at 03:14:09PM +0100, Philippe Mathieu-Daudé wrote:
>> Date: Mon, 19 Feb 2024 15:14:09 +0100
>> From: Philippe Mathieu-Daudé <philmd@linaro.org>
>> Subject: [PATCH 3/5] hw/acpi/ich9: Include missing headers
>> X-Mailer: git-send-email 2.41.0
>>
>> The ICH9LPCPMRegs structure has MemoryRegion and
>> Notifier fields, so requires the "qemu/notify.h"
>> and "exec/memory.h" headers.
>>
>> However nothing from "hw/acpi/acpi_dev_interface.h"
>> is required, so reduce its inclusion to hw/acpi/ich9.c
>> source file where it is used.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> ---
>>   include/hw/acpi/ich9.h | 3 ++-
>>   hw/acpi/ich9.c         | 2 +-
>>   2 files changed, 3 insertions(+), 2 deletions(-)


>> diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c
>> index 573d032e8e..be375a8b9d 100644
>> --- a/hw/acpi/ich9.c
>> +++ b/hw/acpi/ich9.c
>> @@ -35,7 +35,7 @@
>>   #include "sysemu/runstate.h"
>>   #include "hw/acpi/acpi.h"
>>   #include "hw/acpi/ich9_tco.h"
>> -
>> +#include "hw/acpi/acpi_dev_interface.h"
> 
> Do we have the requirement for included header ordering?

We don't. If headers were properly including requisites and
self-contained, order shouldn't matter, and we could sort them
alphabetically to enforce a common style.

> If so, it would be better to put it before "hw/acpi/ich9_tco.h".

Sure, no problem.

> 
> -Zhao
> 
>>   #include "hw/southbridge/ich9.h"
>>   #include "hw/mem/pc-dimm.h"
>>   #include "hw/mem/nvdimm.h"
>> -- 
>> 2.41.0
>>
>>