diff options
author | mdodd <mdodd@FreeBSD.org> | 2000-11-28 07:12:12 +0000 |
---|---|---|
committer | mdodd <mdodd@FreeBSD.org> | 2000-11-28 07:12:12 +0000 |
commit | 2237cef468cf9c99eb0c6c524f18cbfac9dd25ec (patch) | |
tree | ae581c9e5eb71fb22bf905c736f1f49e2ede5e2c /sys/isa | |
parent | c18bb8265fc410ac05ce1f9a0a0cc5f344463f16 (diff) | |
download | FreeBSD-src-2237cef468cf9c99eb0c6c524f18cbfac9dd25ec.zip FreeBSD-src-2237cef468cf9c99eb0c6c524f18cbfac9dd25ec.tar.gz |
Reduce code duplication by using the GET_RESOURCE_LIST bus method and related
generic resource_list management functions.
I'll deal with the EISA bits later.
Not objected to by: new-bus
Diffstat (limited to 'sys/isa')
-rw-r--r-- | sys/isa/isa_common.c | 38 |
1 files changed, 12 insertions, 26 deletions
diff --git a/sys/isa/isa_common.c b/sys/isa/isa_common.c index 79f4d5e..d5fa6b3 100644 --- a/sys/isa/isa_common.c +++ b/sys/isa/isa_common.c @@ -907,32 +907,16 @@ isa_set_resource(device_t dev, device_t child, int type, int rid, return 0; } -static int -isa_get_resource(device_t dev, device_t child, int type, int rid, - u_long *startp, u_long *countp) +static struct resource_list * +isa_get_resource_list (device_t dev, device_t child) { struct isa_device* idev = DEVTOISA(child); struct resource_list *rl = &idev->id_resources; - struct resource_list_entry *rle; - rle = resource_list_find(rl, type, rid); - if (!rle) - return ENOENT; - - if (startp) - *startp = rle->start; - if (countp) - *countp = rle->count; + if (!rl) + return (NULL); - return 0; -} - -static void -isa_delete_resource(device_t dev, device_t child, int type, int rid) -{ - struct isa_device* idev = DEVTOISA(child); - struct resource_list *rl = &idev->id_resources; - resource_list_delete(rl, type, rid); + return (rl); } static int @@ -1012,15 +996,17 @@ static device_method_t isa_methods[] = { DEVMETHOD(bus_write_ivar, isa_write_ivar), DEVMETHOD(bus_child_detached, isa_child_detached), DEVMETHOD(bus_driver_added, isa_driver_added), + DEVMETHOD(bus_setup_intr, isa_setup_intr), + DEVMETHOD(bus_teardown_intr, isa_teardown_intr), + + DEVMETHOD(bus_get_resource_list,isa_get_resource_list), DEVMETHOD(bus_alloc_resource, isa_alloc_resource), DEVMETHOD(bus_release_resource, isa_release_resource), + DEVMETHOD(bus_set_resource, isa_set_resource), + DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource), + DEVMETHOD(bus_delete_resource, bus_generic_rl_delete_resource), DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), - DEVMETHOD(bus_setup_intr, isa_setup_intr), - DEVMETHOD(bus_teardown_intr, isa_teardown_intr), - DEVMETHOD(bus_set_resource, isa_set_resource), - DEVMETHOD(bus_get_resource, isa_get_resource), - DEVMETHOD(bus_delete_resource, isa_delete_resource), /* ISA interface */ DEVMETHOD(isa_add_config, isa_add_config), |