Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/bhnd/bhndb/bhndb.c
| Show First 20 Lines • Show All 1,028 Lines • ▼ Show 20 Lines | bhndb_alloc_resource(device_t dev, device_t child, int type, | ||||
| return (rv); | return (rv); | ||||
| } | } | ||||
| /** | /** | ||||
| * Default bhndb(4) implementation of BUS_RELEASE_RESOURCE(). | * Default bhndb(4) implementation of BUS_RELEASE_RESOURCE(). | ||||
| */ | */ | ||||
| static int | static int | ||||
| bhndb_release_resource(device_t dev, device_t child, int type, int rid, | bhndb_release_resource(device_t dev, device_t child, struct resource *r) | ||||
| struct resource *r) | |||||
| { | { | ||||
| struct bhndb_softc *sc; | struct bhndb_softc *sc; | ||||
| struct resource_list_entry *rle; | struct resource_list_entry *rle; | ||||
| bool passthrough; | bool passthrough; | ||||
| int error; | int error; | ||||
| sc = device_get_softc(dev); | sc = device_get_softc(dev); | ||||
| passthrough = (device_get_parent(child) != dev); | passthrough = (device_get_parent(child) != dev); | ||||
| /* Delegate to our parent device's bus if the requested resource type | /* Delegate to our parent device's bus if the requested resource type | ||||
| * isn't handled locally. */ | * isn't handled locally. */ | ||||
| if (bhndb_get_rman(sc, child, type) == NULL) { | if (bhndb_get_rman(sc, child, rman_get_type(r)) == NULL) { | ||||
| return (BUS_RELEASE_RESOURCE(device_get_parent(sc->parent_dev), | return (BUS_RELEASE_RESOURCE(device_get_parent(sc->parent_dev), | ||||
| child, type, rid, r)); | child, r)); | ||||
| } | } | ||||
| /* Deactivate resources */ | /* Deactivate resources */ | ||||
| if (rman_get_flags(r) & RF_ACTIVE) { | if (rman_get_flags(r) & RF_ACTIVE) { | ||||
| error = BUS_DEACTIVATE_RESOURCE(dev, child, r); | error = BUS_DEACTIVATE_RESOURCE(dev, child, r); | ||||
| if (error) | if (error) | ||||
| return (error); | return (error); | ||||
| } | } | ||||
| if ((error = rman_release_resource(r))) | if ((error = rman_release_resource(r))) | ||||
| return (error); | return (error); | ||||
| if (!passthrough) { | if (!passthrough) { | ||||
| /* Clean resource list entry */ | /* Clean resource list entry */ | ||||
| rle = resource_list_find(BUS_GET_RESOURCE_LIST(dev, child), | rle = resource_list_find(BUS_GET_RESOURCE_LIST(dev, child), | ||||
| type, rid); | rman_get_type(r), rman_get_rid(r)); | ||||
| if (rle != NULL) | if (rle != NULL) | ||||
| rle->res = NULL; | rle->res = NULL; | ||||
| } | } | ||||
| return (0); | return (0); | ||||
| } | } | ||||
| /** | /** | ||||
| ▲ Show 20 Lines • Show All 1,225 Lines • Show Last 20 Lines | |||||