The branch main has been updated by jhb:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=1033312267d66496c661feefe6c14a86d7e4b95e

commit 1033312267d66496c661feefe6c14a86d7e4b95e
Author:     John Baldwin <[email protected]>
AuthorDate: 2025-12-09 20:03:25 +0000
Commit:     John Baldwin <[email protected]>
CommitDate: 2025-12-09 20:03:25 +0000

    bhnd_bus_alloc_resource*: Pass rid by value
    
    Reviewed by:    imp
    Differential Revision:  https://reviews.freebsd.org/D53409
---
 sys/dev/bhnd/bcma/bcma_subr.c          | 2 +-
 sys/dev/bhnd/bhnd.h                    | 6 +++---
 sys/dev/bhnd/bhnd_bus_if.m             | 2 +-
 sys/dev/bhnd/bhnd_erom.c               | 2 +-
 sys/dev/bhnd/bhnd_subr.c               | 8 ++++----
 sys/dev/bhnd/cores/chipc/chipc_gpio.c  | 2 +-
 sys/dev/bhnd/cores/chipc/chipc_subr.c  | 2 +-
 sys/dev/bhnd/cores/pci/bhnd_pci.c      | 2 +-
 sys/dev/bhnd/cores/pcie2/bhnd_pcie2.c  | 2 +-
 sys/dev/bhnd/cores/pmu/bhnd_pmu_core.c | 2 +-
 sys/dev/bhnd/nvram/bhnd_sprom.c        | 2 +-
 sys/dev/bhnd/siba/siba.c               | 2 +-
 12 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/sys/dev/bhnd/bcma/bcma_subr.c b/sys/dev/bhnd/bcma/bcma_subr.c
index d10501c70564..9e442ce911d4 100644
--- a/sys/dev/bhnd/bcma/bcma_subr.c
+++ b/sys/dev/bhnd/bcma/bcma_subr.c
@@ -239,7 +239,7 @@ bcma_dinfo_init_agent(device_t bus, device_t child, struct 
bcma_devinfo *dinfo)
 
        dinfo->rid_agent = BCMA_AGENT_RID(dinfo);
        dinfo->res_agent = BHND_BUS_ALLOC_RESOURCE(bus, bus, SYS_RES_MEMORY,
-           &dinfo->rid_agent, r_start, r_end, r_count, RF_ACTIVE|RF_SHAREABLE);
+           dinfo->rid_agent, r_start, r_end, r_count, RF_ACTIVE|RF_SHAREABLE);
        if (dinfo->res_agent == NULL) {
                device_printf(bus, "failed allocating agent register block for "
                    "core %u\n", BCMA_DINFO_COREIDX(dinfo));
diff --git a/sys/dev/bhnd/bhnd.h b/sys/dev/bhnd/bhnd.h
index c21cca0f48dd..da1686f4d6c9 100644
--- a/sys/dev/bhnd/bhnd.h
+++ b/sys/dev/bhnd/bhnd.h
@@ -617,7 +617,7 @@ int                          
bhnd_bus_generic_read_board_info(device_t dev,
                                     device_t child,
                                     struct bhnd_board_info *info);
 struct bhnd_resource           *bhnd_bus_generic_alloc_resource (device_t dev,
-                                    device_t child, int type, int *rid,
+                                    device_t child, int type, int rid,
                                     rman_res_t start, rman_res_t end,
                                     rman_res_t count, u_int flags);
 int                             bhnd_bus_generic_release_resource (device_t 
dev,
@@ -1292,7 +1292,7 @@ bhnd_nvram_getvar(device_t dev, const char *name, void 
*buf, size_t *len,
  * @retval resource The allocated resource.
  */
 static inline struct bhnd_resource *
-bhnd_alloc_resource(device_t dev, int type, int *rid, rman_res_t start,
+bhnd_alloc_resource(device_t dev, int type, int rid, rman_res_t start,
     rman_res_t end, rman_res_t count, u_int flags)
 {
        return BHND_BUS_ALLOC_RESOURCE(device_get_parent(dev), dev, type, rid,
@@ -1314,7 +1314,7 @@ bhnd_alloc_resource(device_t dev, int type, int *rid, 
rman_res_t start,
  * @retval resource The allocated resource.
  */
 static inline struct bhnd_resource *
-bhnd_alloc_resource_any(device_t dev, int type, int *rid, u_int flags)
+bhnd_alloc_resource_any(device_t dev, int type, int rid, u_int flags)
 {
        return bhnd_alloc_resource(dev, type, rid, 0, ~0, 1, flags);
 }
diff --git a/sys/dev/bhnd/bhnd_bus_if.m b/sys/dev/bhnd/bhnd_bus_if.m
index adb2af9c4d85..62c34404e87f 100644
--- a/sys/dev/bhnd/bhnd_bus_if.m
+++ b/sys/dev/bhnd/bhnd_bus_if.m
@@ -923,7 +923,7 @@ METHOD struct bhnd_resource * alloc_resource {
        device_t dev;
        device_t child;
        int type;
-       int *rid;
+       int rid;
        rman_res_t start;
        rman_res_t end;
        rman_res_t count;
diff --git a/sys/dev/bhnd/bhnd_erom.c b/sys/dev/bhnd/bhnd_erom.c
index 6cb98dec9858..2c4af61438fe 100644
--- a/sys/dev/bhnd/bhnd_erom.c
+++ b/sys/dev/bhnd/bhnd_erom.c
@@ -429,7 +429,7 @@ bhnd_erom_iores_map(struct bhnd_erom_io *eio, bhnd_addr_t 
addr,
        /* Try to allocate the new mapping */
        iores->mapped_rid = iores->owner_rid;
        iores->mapped = bhnd_alloc_resource(iores->owner, SYS_RES_MEMORY,
-           &iores->mapped_rid, addr, addr+size-1, size,
+           iores->mapped_rid, addr, addr+size-1, size,
            RF_ACTIVE|RF_SHAREABLE);
        if (iores->mapped == NULL) {
                iores->mapped_rid = -1;
diff --git a/sys/dev/bhnd/bhnd_subr.c b/sys/dev/bhnd/bhnd_subr.c
index ac4f69db8cae..299388d51626 100644
--- a/sys/dev/bhnd/bhnd_subr.c
+++ b/sys/dev/bhnd/bhnd_subr.c
@@ -1015,7 +1015,7 @@ bhnd_alloc_resources(device_t dev, struct resource_spec 
*rs,
                res[i] = NULL;
 
        for (u_int i = 0; rs[i].type != -1; i++) {
-               res[i] = bhnd_alloc_resource_any(dev, rs[i].type, &rs[i].rid,
+               res[i] = bhnd_alloc_resource_any(dev, rs[i].type, rs[i].rid,
                    rs[i].flags);
 
                /* Clean up all allocations on failure */
@@ -2190,7 +2190,7 @@ bhnd_bus_generic_get_nvram_var(device_t dev, device_t 
child, const char *name,
  */
 struct bhnd_resource *
 bhnd_bus_generic_alloc_resource(device_t dev, device_t child, int type,
-       int *rid, rman_res_t start, rman_res_t end, rman_res_t count,
+       int rid, rman_res_t start, rman_res_t end, rman_res_t count,
        u_int flags)
 {
        struct bhnd_resource    *br;
@@ -2201,7 +2201,7 @@ bhnd_bus_generic_alloc_resource(device_t dev, device_t 
child, int type,
        res = NULL;
 
        /* Allocate the real bus resource (without activating it) */
-       res = BUS_ALLOC_RESOURCE(dev, child, type, *rid, start, end, count,
+       res = BUS_ALLOC_RESOURCE(dev, child, type, rid, start, end, count,
            (flags & ~RF_ACTIVE));
        if (res == NULL)
                return (NULL);
@@ -2216,7 +2216,7 @@ bhnd_bus_generic_alloc_resource(device_t dev, device_t 
child, int type,
 
        /* Attempt activation */
        if (flags & RF_ACTIVE) {
-               error = BHND_BUS_ACTIVATE_RESOURCE(dev, child, type, *rid, br);
+               error = BHND_BUS_ACTIVATE_RESOURCE(dev, child, type, rid, br);
                if (error)
                        goto failed;
        }
diff --git a/sys/dev/bhnd/cores/chipc/chipc_gpio.c 
b/sys/dev/bhnd/cores/chipc/chipc_gpio.c
index 429de0fc1fd8..8e4445155f7b 100644
--- a/sys/dev/bhnd/cores/chipc/chipc_gpio.c
+++ b/sys/dev/bhnd/cores/chipc/chipc_gpio.c
@@ -139,7 +139,7 @@ chipc_gpio_attach(device_t dev)
        CC_GPIO_LOCK_INIT(sc);
 
        sc->mem_rid = 0;
-       sc->mem_res = bhnd_alloc_resource_any(dev, SYS_RES_MEMORY, &sc->mem_rid,
+       sc->mem_res = bhnd_alloc_resource_any(dev, SYS_RES_MEMORY, sc->mem_rid,
            RF_ACTIVE|RF_SHAREABLE);
        if (sc->mem_res == NULL) {
                device_printf(dev, "failed to allocate chipcommon registers\n");
diff --git a/sys/dev/bhnd/cores/chipc/chipc_subr.c 
b/sys/dev/bhnd/cores/chipc/chipc_subr.c
index 1137d3ab67cc..bb5764af1ef3 100644
--- a/sys/dev/bhnd/cores/chipc/chipc_subr.c
+++ b/sys/dev/bhnd/cores/chipc/chipc_subr.c
@@ -469,7 +469,7 @@ chipc_retain_region(struct chipc_softc *sc, struct 
chipc_region *cr, int flags)
 
                        /* Allocate resource */
                        cr->cr_res = bhnd_alloc_resource(sc->dev,
-                           SYS_RES_MEMORY, &cr->cr_res_rid, cr->cr_addr,
+                           SYS_RES_MEMORY, cr->cr_res_rid, cr->cr_addr,
                            cr->cr_end, cr->cr_count, RF_SHAREABLE);
                        if (cr->cr_res == NULL) {
                                CHIPC_UNLOCK(sc);
diff --git a/sys/dev/bhnd/cores/pci/bhnd_pci.c 
b/sys/dev/bhnd/cores/pci/bhnd_pci.c
index 45775916e5cf..b8af7dd29fc5 100644
--- a/sys/dev/bhnd/cores/pci/bhnd_pci.c
+++ b/sys/dev/bhnd/cores/pci/bhnd_pci.c
@@ -132,7 +132,7 @@ bhnd_pci_generic_attach(device_t dev)
            sizeof(bhnd_pci_devs[0]));
 
        /* Allocate bus resources */
-       sc->mem_res = bhnd_alloc_resource_any(dev, SYS_RES_MEMORY, &sc->mem_rid,
+       sc->mem_res = bhnd_alloc_resource_any(dev, SYS_RES_MEMORY, sc->mem_rid,
            RF_ACTIVE);
        if (sc->mem_res == NULL)
                return (ENXIO);
diff --git a/sys/dev/bhnd/cores/pcie2/bhnd_pcie2.c 
b/sys/dev/bhnd/cores/pcie2/bhnd_pcie2.c
index 15a93f9e0b93..01881aca3876 100644
--- a/sys/dev/bhnd/cores/pcie2/bhnd_pcie2.c
+++ b/sys/dev/bhnd/cores/pcie2/bhnd_pcie2.c
@@ -96,7 +96,7 @@ bhnd_pcie2_generic_attach(device_t dev)
            sizeof(bhnd_pcie2_devs[0]));
 
        /* Allocate bus resources */
-       sc->mem_res = bhnd_alloc_resource_any(dev, SYS_RES_MEMORY, &sc->mem_rid,
+       sc->mem_res = bhnd_alloc_resource_any(dev, SYS_RES_MEMORY, sc->mem_rid,
            RF_ACTIVE);
        if (sc->mem_res == NULL)
                return (ENXIO);
diff --git a/sys/dev/bhnd/cores/pmu/bhnd_pmu_core.c 
b/sys/dev/bhnd/cores/pmu/bhnd_pmu_core.c
index d324cb8c0924..e4bb34cab5a8 100644
--- a/sys/dev/bhnd/cores/pmu/bhnd_pmu_core.c
+++ b/sys/dev/bhnd/cores/pmu/bhnd_pmu_core.c
@@ -87,7 +87,7 @@ bhnd_pmu_core_attach(device_t dev)
 
        /* Allocate register block */
        rid = 0;
-       res = bhnd_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE);
+       res = bhnd_alloc_resource_any(dev, SYS_RES_MEMORY, rid, RF_ACTIVE);
        if (res == NULL) {
                device_printf(dev, "failed to allocate resources\n");
                return (ENXIO);
diff --git a/sys/dev/bhnd/nvram/bhnd_sprom.c b/sys/dev/bhnd/nvram/bhnd_sprom.c
index 32bc882f6df0..9975b4525cdf 100644
--- a/sys/dev/bhnd/nvram/bhnd_sprom.c
+++ b/sys/dev/bhnd/nvram/bhnd_sprom.c
@@ -108,7 +108,7 @@ bhnd_sprom_attach(device_t dev, bus_size_t offset)
 
        /* Allocate SPROM resource */
        rid = 0;
-       r = bhnd_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE);
+       r = bhnd_alloc_resource_any(dev, SYS_RES_MEMORY, rid, RF_ACTIVE);
        if (r == NULL) {
                device_printf(dev, "failed to allocate resources\n");
                return (ENXIO);
diff --git a/sys/dev/bhnd/siba/siba.c b/sys/dev/bhnd/siba/siba.c
index a8e83f843506..c4abf8b75765 100644
--- a/sys/dev/bhnd/siba/siba.c
+++ b/sys/dev/bhnd/siba/siba.c
@@ -1220,7 +1220,7 @@ siba_map_cfg_resources(device_t dev, struct siba_devinfo 
*dinfo)
                /* Map the config resource for bus-level access */
                dinfo->cfg_rid[i] = SIBA_CFG_RID(dinfo, i);
                dinfo->cfg_res[i] = BHND_BUS_ALLOC_RESOURCE(dev, dev,
-                   SYS_RES_MEMORY, &dinfo->cfg_rid[i], r_start, r_end,
+                   SYS_RES_MEMORY, dinfo->cfg_rid[i], r_start, r_end,
                    r_count, RF_ACTIVE|RF_SHAREABLE);
 
                if (dinfo->cfg_res[i] == NULL) {

Reply via email to