The branch main has been updated by jhb:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=2a23faee4f12cebf57fd1716bf846a53cc737c3b

commit 2a23faee4f12cebf57fd1716bf846a53cc737c3b
Author:     John Baldwin <[email protected]>
AuthorDate: 2025-12-09 20:02:43 +0000
Commit:     John Baldwin <[email protected]>
CommitDate: 2025-12-09 20:02:43 +0000

    acpi_bus_alloc_gas: Pass rid by value
    
    Reviewed by:    imp
    Differential Revision:  https://reviews.freebsd.org/D53405
---
 sys/dev/acpica/acpi.c          | 8 ++++----
 sys/dev/acpica/acpi_apei.c     | 4 ++--
 sys/dev/acpica/acpi_cpu.c      | 4 ++--
 sys/dev/acpica/acpi_package.c  | 2 +-
 sys/dev/acpica/acpi_throttle.c | 4 ++--
 sys/dev/acpica/acpivar.h       | 2 +-
 sys/dev/wdatwd/wdatwd.c        | 2 +-
 7 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c
index 408570f53a21..d2ccdfbf6535 100644
--- a/sys/dev/acpica/acpi.c
+++ b/sys/dev/acpica/acpi.c
@@ -1770,13 +1770,13 @@ acpi_unmap_resource(device_t bus, device_t child, 
struct resource *r,
 
 /* Allocate an IO port or memory resource, given its GAS. */
 int
-acpi_bus_alloc_gas(device_t dev, int *type, int *rid, ACPI_GENERIC_ADDRESS 
*gas,
+acpi_bus_alloc_gas(device_t dev, int *type, int rid, ACPI_GENERIC_ADDRESS *gas,
     struct resource **res, u_int flags)
 {
     int error, res_type;
 
     error = ENOMEM;
-    if (type == NULL || rid == NULL || gas == NULL || res == NULL)
+    if (type == NULL || gas == NULL || res == NULL)
        return (EINVAL);
 
     /* We only support memory and IO spaces. */
@@ -1802,14 +1802,14 @@ acpi_bus_alloc_gas(device_t dev, int *type, int *rid, 
ACPI_GENERIC_ADDRESS *gas,
     if (gas->Address == 0 || gas->BitWidth == 0)
        return (EINVAL);
 
-    bus_set_resource(dev, res_type, *rid, gas->Address,
+    bus_set_resource(dev, res_type, rid, gas->Address,
        gas->BitWidth / 8);
     *res = bus_alloc_resource_any(dev, res_type, rid, RF_ACTIVE | flags);
     if (*res != NULL) {
        *type = res_type;
        error = 0;
     } else
-       bus_delete_resource(dev, res_type, *rid);
+       bus_delete_resource(dev, res_type, rid);
 
     return (error);
 }
diff --git a/sys/dev/acpica/acpi_apei.c b/sys/dev/acpica/acpi_apei.c
index 624c81ad1b4f..0d23b504cb60 100644
--- a/sys/dev/acpica/acpi_apei.c
+++ b/sys/dev/acpica/acpi_apei.c
@@ -700,7 +700,7 @@ apei_attach(device_t dev)
        rid = 0;
        TAILQ_FOREACH(ge, &sc->ges, link) {
                ge->res_rid = rid++;
-               acpi_bus_alloc_gas(dev, &ge->res_type, &ge->res_rid,
+               acpi_bus_alloc_gas(dev, &ge->res_type, ge->res_rid,
                    &ge->v1.ErrorStatusAddress, &ge->res, 0);
                if (ge->res) {
                        ge->buf = pmap_mapdev_attr(READ8(ge->res, 0),
@@ -710,7 +710,7 @@ apei_attach(device_t dev)
                }
                if (ge->v1.Header.Type == ACPI_HEST_TYPE_GENERIC_ERROR_V2) {
                        ge->res2_rid = rid++;
-                       acpi_bus_alloc_gas(dev, &ge->res2_type, &ge->res2_rid,
+                       acpi_bus_alloc_gas(dev, &ge->res2_type, ge->res2_rid,
                            &ge->v2.ReadAckRegister, &ge->res2, RF_SHAREABLE);
                        if (ge->res2 == NULL)
                                device_printf(dev, "Can't allocate ack 
resource.\n");
diff --git a/sys/dev/acpica/acpi_cpu.c b/sys/dev/acpica/acpi_cpu.c
index 2cd6c8bd4758..37246890fd79 100644
--- a/sys/dev/acpica/acpi_cpu.c
+++ b/sys/dev/acpica/acpi_cpu.c
@@ -732,7 +732,7 @@ acpi_cpu_generic_cx_probe(struct acpi_cpu_softc *sc)
     if (AcpiGbl_FADT.C2Latency <= 100) {
        gas.Address = sc->cpu_p_blk + 4;
        cx_ptr->res_rid = 0;
-       acpi_bus_alloc_gas(sc->cpu_dev, &cx_ptr->res_type, &cx_ptr->res_rid,
+       acpi_bus_alloc_gas(sc->cpu_dev, &cx_ptr->res_type, cx_ptr->res_rid,
            &gas, &cx_ptr->p_lvlx, RF_SHAREABLE);
        if (cx_ptr->p_lvlx != NULL) {
            cx_ptr->type = ACPI_STATE_C2;
@@ -749,7 +749,7 @@ acpi_cpu_generic_cx_probe(struct acpi_cpu_softc *sc)
     if (AcpiGbl_FADT.C3Latency <= 1000 && !(cpu_quirks & CPU_QUIRK_NO_C3)) {
        gas.Address = sc->cpu_p_blk + 5;
        cx_ptr->res_rid = 1;
-       acpi_bus_alloc_gas(sc->cpu_dev, &cx_ptr->res_type, &cx_ptr->res_rid,
+       acpi_bus_alloc_gas(sc->cpu_dev, &cx_ptr->res_type, cx_ptr->res_rid,
            &gas, &cx_ptr->p_lvlx, RF_SHAREABLE);
        if (cx_ptr->p_lvlx != NULL) {
            cx_ptr->type = ACPI_STATE_C3;
diff --git a/sys/dev/acpica/acpi_package.c b/sys/dev/acpica/acpi_package.c
index 4e64fdbbab2b..e0a3b40e507e 100644
--- a/sys/dev/acpica/acpi_package.c
+++ b/sys/dev/acpica/acpi_package.c
@@ -126,7 +126,7 @@ acpi_PkgGas(device_t dev, ACPI_OBJECT *res, int idx, int 
*type, int *rid,
 
     memcpy(&gas, obj->Buffer.Pointer + 3, sizeof(gas));
 
-    return (acpi_bus_alloc_gas(dev, type, rid, &gas, dst, flags));
+    return (acpi_bus_alloc_gas(dev, type, *rid, &gas, dst, flags));
 }
 
 int
diff --git a/sys/dev/acpica/acpi_throttle.c b/sys/dev/acpica/acpi_throttle.c
index 8b2919c71073..ce8b7c411859 100644
--- a/sys/dev/acpica/acpi_throttle.c
+++ b/sys/dev/acpica/acpi_throttle.c
@@ -275,7 +275,7 @@ acpi_throttle_evaluate(struct acpi_throttle_softc *sc)
                        return (ENXIO);
                }
                memcpy(&gas, obj.Buffer.Pointer + 3, sizeof(gas));
-               acpi_bus_alloc_gas(sc->cpu_dev, &sc->cpu_p_type, &thr_rid,
+               acpi_bus_alloc_gas(sc->cpu_dev, &sc->cpu_p_type, thr_rid,
                    &gas, &sc->cpu_p_cnt, 0);
                if (sc->cpu_p_cnt != NULL && bootverbose) {
                        device_printf(sc->cpu_dev, "P_CNT from _PTC %#jx\n",
@@ -295,7 +295,7 @@ acpi_throttle_evaluate(struct acpi_throttle_softc *sc)
                gas.Address = sc->cpu_p_blk;
                gas.SpaceId = ACPI_ADR_SPACE_SYSTEM_IO;
                gas.BitWidth = 32;
-               acpi_bus_alloc_gas(sc->cpu_dev, &sc->cpu_p_type, &thr_rid,
+               acpi_bus_alloc_gas(sc->cpu_dev, &sc->cpu_p_type, thr_rid,
                    &gas, &sc->cpu_p_cnt, 0);
                if (sc->cpu_p_cnt != NULL) {
                        if (bootverbose)
diff --git a/sys/dev/acpica/acpivar.h b/sys/dev/acpica/acpivar.h
index 71d8e46ab310..4da1a5a35a41 100644
--- a/sys/dev/acpica/acpivar.h
+++ b/sys/dev/acpica/acpivar.h
@@ -419,7 +419,7 @@ int         acpi_parse_prw(ACPI_HANDLE h, struct 
acpi_prw_data *prw);
 ACPI_STATUS    acpi_Startup(void);
 void           acpi_UserNotify(const char *subsystem, ACPI_HANDLE h,
                    uint8_t notify);
-int            acpi_bus_alloc_gas(device_t dev, int *type, int *rid,
+int            acpi_bus_alloc_gas(device_t dev, int *type, int rid,
                    ACPI_GENERIC_ADDRESS *gas, struct resource **res,
                    u_int flags);
 void           acpi_walk_subtables(void *first, void *end,
diff --git a/sys/dev/wdatwd/wdatwd.c b/sys/dev/wdatwd/wdatwd.c
index c67e37281307..8873dd74103c 100644
--- a/sys/dev/wdatwd/wdatwd.c
+++ b/sys/dev/wdatwd/wdatwd.c
@@ -612,7 +612,7 @@ wdatwd_probe(device_t dev)
                int             type, rid = 0;
                struct resource *res;
 
-               if (acpi_bus_alloc_gas(dev, &type, &rid,
+               if (acpi_bus_alloc_gas(dev, &type, rid,
                    &((ACPI_WDAT_ENTRY *)(wdat + 1))->RegisterRegion,
                    &res, 0))
                        return (ENXIO);

Reply via email to