[04/16] acpi: Make acpi_setup() get PCMachineState as argument
diff mbox

Message ID 1449020831-8414-5-git-send-email-ehabkost@redhat.com
State New
Headers show

Commit Message

Eduardo Habkost Dec. 2, 2015, 1:46 a.m. UTC
Lots of PcGuestInfo fields are duplicates of PCMachineClass or
PCMachineState fields. Pass PCMachineState as argument to
acpi_setup(), so we can simply let the ACPI code use those fields
directly.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 hw/i386/acpi-build.c | 3 ++-
 hw/i386/acpi-build.h | 2 +-
 hw/i386/pc.c         | 2 +-
 3 files changed, 4 insertions(+), 3 deletions(-)

Comments

Marcel Apfelbaum Dec. 7, 2015, 3:24 p.m. UTC | #1
On 12/02/2015 03:46 AM, Eduardo Habkost wrote:
> Lots of PcGuestInfo fields are duplicates of PCMachineClass or
> PCMachineState fields. Pass PCMachineState as argument to
> acpi_setup(), so we can simply let the ACPI code use those fields
> directly.

I completely agree with removing duplicated fields and using PCMachine
fields directly, but this not what this patch does.
It only extracts PcGuestInfo info from the machine.

Thanks,
Marcel


>
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
>   hw/i386/acpi-build.c | 3 ++-
>   hw/i386/acpi-build.h | 2 +-
>   hw/i386/pc.c         | 2 +-
>   3 files changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> index bca3f06..74f0922 100644
> --- a/hw/i386/acpi-build.c
> +++ b/hw/i386/acpi-build.c
> @@ -1893,8 +1893,9 @@ static const VMStateDescription vmstate_acpi_build = {
>       },
>   };
>
> -void acpi_setup(PcGuestInfo *guest_info)
> +void acpi_setup(PCMachineState *pcms)
>   {
> +    PcGuestInfo *guest_info = &pcms->acpi_guest_info;
>       AcpiBuildTables tables;
>       AcpiBuildState *build_state;
>
> diff --git a/hw/i386/acpi-build.h b/hw/i386/acpi-build.h
> index e57b1aa..132aba2 100644
> --- a/hw/i386/acpi-build.h
> +++ b/hw/i386/acpi-build.h
> @@ -4,6 +4,6 @@
>
>   #include "qemu/typedefs.h"
>
> -void acpi_setup(PcGuestInfo *);
> +void acpi_setup(PCMachineState *pcms);
>
>   #endif
> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> index a17e5b3e..fc98a20 100644
> --- a/hw/i386/pc.c
> +++ b/hw/i386/pc.c
> @@ -1179,7 +1179,7 @@ void pc_machine_done(Notifier *notifier, void *data)
>           }
>       }
>
> -    acpi_setup(&pcms->acpi_guest_info);
> +    acpi_setup(pcms);
>   }
>
>   PcGuestInfo *pc_guest_info_init(PCMachineState *pcms)
>
Eduardo Habkost Dec. 8, 2015, 5:40 p.m. UTC | #2
On Mon, Dec 07, 2015 at 05:24:27PM +0200, Marcel Apfelbaum wrote:
> On 12/02/2015 03:46 AM, Eduardo Habkost wrote:
> >Lots of PcGuestInfo fields are duplicates of PCMachineClass or
> >PCMachineState fields. Pass PCMachineState as argument to
> >acpi_setup(), so we can simply let the ACPI code use those fields
> >directly.
> 
> I completely agree with removing duplicated fields and using PCMachine
> fields directly, but this not what this patch does.
> It only extracts PcGuestInfo info from the machine.

I should have appended "later" to the commit message. "So we are
able to simply let the ACPI code use those fields later (in
another commit)". The goal of this commit is to just change the
function signature to allow us to move the fields later. Maybe I
will squash some of those changes together in a new version of
the series.

Patch
diff mbox

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index bca3f06..74f0922 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -1893,8 +1893,9 @@  static const VMStateDescription vmstate_acpi_build = {
     },
 };
 
-void acpi_setup(PcGuestInfo *guest_info)
+void acpi_setup(PCMachineState *pcms)
 {
+    PcGuestInfo *guest_info = &pcms->acpi_guest_info;
     AcpiBuildTables tables;
     AcpiBuildState *build_state;
 
diff --git a/hw/i386/acpi-build.h b/hw/i386/acpi-build.h
index e57b1aa..132aba2 100644
--- a/hw/i386/acpi-build.h
+++ b/hw/i386/acpi-build.h
@@ -4,6 +4,6 @@ 
 
 #include "qemu/typedefs.h"
 
-void acpi_setup(PcGuestInfo *);
+void acpi_setup(PCMachineState *pcms);
 
 #endif
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index a17e5b3e..fc98a20 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1179,7 +1179,7 @@  void pc_machine_done(Notifier *notifier, void *data)
         }
     }
 
-    acpi_setup(&pcms->acpi_guest_info);
+    acpi_setup(pcms);
 }
 
 PcGuestInfo *pc_guest_info_init(PCMachineState *pcms)