git: a19ed3495d55 - main - gpiobus: Use bus_generic_rl_* methods

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Wed, 22 Nov 2023 17:06:46 UTC
The branch main has been updated by jhb:

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

commit a19ed3495d5556281ea39995d962b93a637183f0
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2023-11-22 17:06:22 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2023-11-22 17:06:22 +0000

    gpiobus: Use bus_generic_rl_* methods
    
    Reviewed by:    imp
    Differential Revision:  https://reviews.freebsd.org/D42715
---
 sys/dev/gpio/gpiobus.c | 22 +++-------------------
 1 file changed, 3 insertions(+), 19 deletions(-)

diff --git a/sys/dev/gpio/gpiobus.c b/sys/dev/gpio/gpiobus.c
index be2fef549460..65e8d1a775fe 100644
--- a/sys/dev/gpio/gpiobus.c
+++ b/sys/dev/gpio/gpiobus.c
@@ -755,24 +755,6 @@ gpiobus_hinted_child(device_t bus, const char *dname, int dunit)
 	}
 }
 
-static int
-gpiobus_set_resource(device_t dev, device_t child, int type, int rid,
-    rman_res_t start, rman_res_t count)
-{
-	struct gpiobus_ivar *devi;
-	struct resource_list_entry *rle;
-
-	dprintf("%s: entry (%p, %p, %d, %d, %p, %ld)\n",
-	    __func__, dev, child, type, rid, (void *)(intptr_t)start, count);
-	devi = GPIOBUS_IVAR(child);
-	rle = resource_list_add(&devi->rl, type, rid, start,
-	    start + count - 1, count);
-	if (rle == NULL)
-		return (ENXIO);
-
-	return (0);
-}
-
 static int
 gpiobus_read_ivar(device_t dev, device_t child, int which, uintptr_t *result)
 {
@@ -1075,7 +1057,9 @@ static device_method_t gpiobus_methods[] = {
 	DEVMETHOD(bus_setup_intr,	bus_generic_setup_intr),
 	DEVMETHOD(bus_config_intr,	bus_generic_config_intr),
 	DEVMETHOD(bus_teardown_intr,	bus_generic_teardown_intr),
-	DEVMETHOD(bus_set_resource,	gpiobus_set_resource),
+	DEVMETHOD(bus_delete_resource,	bus_generic_rl_delete_resource),
+	DEVMETHOD(bus_get_resource,	bus_generic_rl_get_resource),
+	DEVMETHOD(bus_set_resource,	bus_generic_rl_set_resource),
 	DEVMETHOD(bus_alloc_resource,	gpiobus_alloc_resource),
 	DEVMETHOD(bus_release_resource,	gpiobus_release_resource),
 	DEVMETHOD(bus_activate_resource,	bus_generic_activate_resource),