Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/ofw/ofwbus.c
Show First 20 Lines • Show All 265 Lines • ▼ Show 20 Lines | ofwbus_adjust_resource(device_t bus, device_t child __unused, int type, | ||||
return (rman_adjust_resource(r, start, end)); | return (rman_adjust_resource(r, start, end)); | ||||
} | } | ||||
static int | static int | ||||
ofwbus_release_resource(device_t bus, device_t child, int type, | ofwbus_release_resource(device_t bus, device_t child, int type, | ||||
int rid, struct resource *r) | int rid, struct resource *r) | ||||
{ | { | ||||
struct resource_list_entry *rle; | struct resource_list_entry *rle; | ||||
int passthrough; | |||||
int error; | int error; | ||||
passthrough = (device_get_parent(child) != bus); | |||||
if (!passthrough) { | |||||
/* Clean resource list entry */ | /* Clean resource list entry */ | ||||
rle = resource_list_find(BUS_GET_RESOURCE_LIST(bus, child), type, rid); | rle = resource_list_find(BUS_GET_RESOURCE_LIST(bus, child), | ||||
type, rid); | |||||
if (rle != NULL) | if (rle != NULL) | ||||
rle->res = NULL; | rle->res = NULL; | ||||
} | |||||
if ((rman_get_flags(r) & RF_ACTIVE) != 0) { | if ((rman_get_flags(r) & RF_ACTIVE) != 0) { | ||||
error = bus_deactivate_resource(child, type, rid, r); | error = bus_deactivate_resource(child, type, rid, r); | ||||
if (error) | if (error) | ||||
return (error); | return (error); | ||||
} | } | ||||
return (rman_release_resource(r)); | return (rman_release_resource(r)); | ||||
} | } |