diff mbox series

[4/7] hw/acpi/ich9: Use ICH9_PMIO_GPE0_STS just once

Message ID 20230122170724.21868-5-shentey@gmail.com (mailing list archive)
State New, archived
Headers show
Series ACPI controller cleanup | expand

Commit Message

Bernhard Beschow Jan. 22, 2023, 5:07 p.m. UTC
Cosmetic change emphasizing that always the actual address of the gpe0
block is returned.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
 hw/acpi/ich9.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Igor Mammedov Jan. 24, 2023, 5:18 p.m. UTC | #1
On Sun, 22 Jan 2023 18:07:21 +0100
Bernhard Beschow <shentey@gmail.com> wrote:

> Cosmetic change emphasizing 

... how 3/7 makes it more confusing
  
> that always the actual address of the gpe0
> block is returned.
> 
> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
> ---
>  hw/acpi/ich9.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c
> index f8af238974..40a20e01ea 100644
> --- a/hw/acpi/ich9.c
> +++ b/hw/acpi/ich9.c
> @@ -348,7 +348,9 @@ static void ich9_pm_get_gpe0_blk(Object *obj, Visitor *v, const char *name,
>                                   void *opaque, Error **errp)
>  {
>      ICH9LPCPMRegs *pm = opaque;
> -    uint64_t value = pm->io.addr + ICH9_PMIO_GPE0_STS;
> +    uint64_t value = pm->io.addr + pm->io_gpe.addr;

do not poke inside of MemoryRegion, right API to use here
if you really want to get it from memory region would be
  
memory_region_find && MemoryRegionSection::offset_within_address_space
magic

I'd just drop 3/7 and this patch

> +
> +    assert(&pm->io == pm->io_gpe.container);
>  
>      visit_type_uint64(v, name, &value, errp);
>  }
diff mbox series

Patch

diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c
index f8af238974..40a20e01ea 100644
--- a/hw/acpi/ich9.c
+++ b/hw/acpi/ich9.c
@@ -348,7 +348,9 @@  static void ich9_pm_get_gpe0_blk(Object *obj, Visitor *v, const char *name,
                                  void *opaque, Error **errp)
 {
     ICH9LPCPMRegs *pm = opaque;
-    uint64_t value = pm->io.addr + ICH9_PMIO_GPE0_STS;
+    uint64_t value = pm->io.addr + pm->io_gpe.addr;
+
+    assert(&pm->io == pm->io_gpe.container);
 
     visit_type_uint64(v, name, &value, errp);
 }