[PATCH v2 2/3] hw/i386/acpi-build: Avoid 'sun' identifier

Andrew Deason posted 3 patches 3 years, 11 months ago
Maintainers: "Michael S. Tsirkin" <mst@redhat.com>, Igor Mammedov <imammedo@redhat.com>, Ani Sinha <ani@anisinha.ca>, 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 v2 2/3] hw/i386/acpi-build: Avoid 'sun' identifier
Posted by Andrew Deason 3 years, 11 months ago
On Solaris, 'sun' is #define'd to 1, which causes errors if a variable
is named 'sun'. Slightly change the name of the var for the Slot User
Number so we can build on Solaris.

Signed-off-by: Andrew Deason <adeason@sinenomine.net>
---
 hw/i386/acpi-build.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 4ad4d7286c..dcf6ece3d0 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -576,32 +576,32 @@ static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus,
 }
 
 Aml *aml_pci_device_dsm(void)
 {
     Aml *method, *UUID, *ifctx, *ifctx1, *ifctx2, *ifctx3, *elsectx;
     Aml *acpi_index = aml_local(0);
     Aml *zero = aml_int(0);
     Aml *bnum = aml_arg(4);
     Aml *func = aml_arg(2);
     Aml *rev = aml_arg(1);
-    Aml *sun = aml_arg(5);
+    Aml *sunum = aml_arg(5);
 
     method = aml_method("PDSM", 6, AML_SERIALIZED);
 
     /*
      * PCI Firmware Specification 3.1
      * 4.6.  _DSM Definitions for PCI
      */
     UUID = aml_touuid("E5C937D0-3553-4D7A-9117-EA4D19C3434D");
     ifctx = aml_if(aml_equal(aml_arg(0), UUID));
     {
-        aml_append(ifctx, aml_store(aml_call2("AIDX", bnum, sun), acpi_index));
+        aml_append(ifctx, aml_store(aml_call2("AIDX", bnum, sunum), acpi_index));
         ifctx1 = aml_if(aml_equal(func, zero));
         {
             uint8_t byte_list[1];
 
             ifctx2 = aml_if(aml_equal(rev, aml_int(2)));
             {
                 /*
                  * advertise function 7 if device has acpi-index
                  * acpi_index values:
                  *            0: not present (default value)
-- 
2.11.0
Re: [PATCH v2 2/3] hw/i386/acpi-build: Avoid 'sun' identifier
Posted by Ani Sinha 3 years, 11 months ago

On Mon, 14 Mar 2022, Andrew Deason wrote:

> On Solaris, 'sun' is #define'd to 1, which causes errors if a variable
> is named 'sun'. Slightly change the name of the var for the Slot User
> Number so we can build on Solaris.
>
> Signed-off-by: Andrew Deason <adeason@sinenomine.net>

Reviewed-by: Ani Sinha <ani@anisinha.ca>

> ---
>  hw/i386/acpi-build.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
> index 4ad4d7286c..dcf6ece3d0 100644
> --- a/hw/i386/acpi-build.c
> +++ b/hw/i386/acpi-build.c
> @@ -576,32 +576,32 @@ static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus,
>  }
>
>  Aml *aml_pci_device_dsm(void)
>  {
>      Aml *method, *UUID, *ifctx, *ifctx1, *ifctx2, *ifctx3, *elsectx;
>      Aml *acpi_index = aml_local(0);
>      Aml *zero = aml_int(0);
>      Aml *bnum = aml_arg(4);
>      Aml *func = aml_arg(2);
>      Aml *rev = aml_arg(1);
> -    Aml *sun = aml_arg(5);
> +    Aml *sunum = aml_arg(5);
>
>      method = aml_method("PDSM", 6, AML_SERIALIZED);
>
>      /*
>       * PCI Firmware Specification 3.1
>       * 4.6.  _DSM Definitions for PCI
>       */
>      UUID = aml_touuid("E5C937D0-3553-4D7A-9117-EA4D19C3434D");
>      ifctx = aml_if(aml_equal(aml_arg(0), UUID));
>      {
> -        aml_append(ifctx, aml_store(aml_call2("AIDX", bnum, sun), acpi_index));
> +        aml_append(ifctx, aml_store(aml_call2("AIDX", bnum, sunum), acpi_index));
>          ifctx1 = aml_if(aml_equal(func, zero));
>          {
>              uint8_t byte_list[1];
>
>              ifctx2 = aml_if(aml_equal(rev, aml_int(2)));
>              {
>                  /*
>                   * advertise function 7 if device has acpi-index
>                   * acpi_index values:
>                   *            0: not present (default value)
> --
> 2.11.0
>
>