mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-07-22 23:45:41 +08:00
nexus: Fix resouce allocation
This commit is contained in:
parent
9cea6da780
commit
d43544ef12
@ -132,7 +132,6 @@ static struct resource *
|
|||||||
nexus_alloc_resource(device_t bus, device_t child, int type, int *rid,
|
nexus_alloc_resource(device_t bus, device_t child, int type, int *rid,
|
||||||
u_long start, u_long end, u_long count, u_int flags)
|
u_long start, u_long end, u_long count, u_int flags)
|
||||||
{
|
{
|
||||||
struct resource *rv;
|
|
||||||
struct rman *rm;
|
struct rman *rm;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
@ -152,22 +151,24 @@ nexus_alloc_resource(device_t bus, device_t child, int type, int *rid,
|
|||||||
|
|
||||||
if (strcmp(device_get_name(child), nd->name) == 0
|
if (strcmp(device_get_name(child), nd->name) == 0
|
||||||
&& device_get_unit(child) == nd->unit) {
|
&& device_get_unit(child) == nd->unit) {
|
||||||
if (!nexus_get_start(nd, type, &start)) {
|
struct resource *res = NULL;
|
||||||
return (NULL);
|
|
||||||
|
if (nexus_get_start(nd, type, &start)) {
|
||||||
|
res = rman_reserve_resource(rm, start, end,
|
||||||
|
count, flags, child);
|
||||||
|
if (res != NULL) {
|
||||||
|
rman_set_rid(res, *rid);
|
||||||
|
rman_set_bushandle(res,
|
||||||
|
rman_get_start(res));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
} else {
|
|
||||||
|
return (res);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
rv = rman_reserve_resource(rm, start, end, count, flags, child);
|
|
||||||
if (rv != NULL) {
|
|
||||||
rman_set_rid(rv, *rid);
|
|
||||||
rman_set_bushandle(rv, rman_get_start(rv));
|
|
||||||
}
|
|
||||||
|
|
||||||
return (rv);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
nexus_release_resource(device_t bus, device_t child, int type, int rid,
|
nexus_release_resource(device_t bus, device_t child, int type, int rid,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user