a new @@ -392,7 +388,7 @@ rman_adjust_resource(struct resource *rr, rman_res_t start, rman_res_t end) new->r_start = r->r_start; new->r_end = start - 1; new->r_rm = rm; - mtx_lock(rm->rm_mtx); + mtx_lock(&rm->rm_mtx); r->r_start = start; s = TAILQ_PREV(r, resource_head, r_link); if (s != NULL && !(s->r_flags & RF_ALLOCATED)) { @@ -400,14 +396,14 @@ rman_adjust_resource(struct resource *rr, rman_res_t start, rman_res_t end) free(new, M_RMAN); } else TAILQ_INSERT_BEFORE(r, new, r_link); - mtx_unlock(rm->rm_mtx); + mtx_unlock(&rm->rm_mtx); } if (end < r->r_end) { new = int_alloc_resource(M_WAITOK); new->r_start = end + 1; new->r_end = r->r_end; new->r_rm = rm; - mtx_lock(rm->rm_mtx); + mtx_lock(&rm->rm_mtx); r->r_end = end; t = TAILQ_NEXT(r, r_link); if (t != NULL && !(t->r_flags & RF_ALLOCATED)) { @@ -415,7 +411,7 @@ rman_adjust_resource(struct resource *rr, rman_res_t start, rman_res_t end) free(new, M_RMAN); } else TAILQ_INSERT_AFTER(&rm->rm_list, r, new, r_link); - mtx_unlock(rm->rm_mtx); + mtx_unlock(&rm->rm_mtx); } return (0); } @@ -441,7 +437,7 @@ rman_reserve_resource(struct rman *rm, rman_res_t start, rman_res_t end, ("invalid flags %#x", flags)); new_rflags = (flags & ~RF_FIRSTSHARE) | RF_ALLOCATED; - mtx_lock(rm->rm_mtx); + mtx_lock(&rm->rm_mtx); r = TAILQ_FIRST(&rm->rm_list); if (r == NULL) @@ -628,7 +624,7 @@ rman_reserve_resource(struct rman *rm, rman_res_t start, rman_res_t end, */ out: - mtx_unlock(rm->rm_mtx); + mtx_unlock(&rm->rm_mtx); return (rv == NULL ? NULL : &rv->r_r); } @@ -640,9 +636,9 @@ rman_activate_resource(struct resource *re) r = re->__r_i; rm = r->r_rm; - mtx_lock(rm->rm_mtx); + mtx_lock(&rm->rm_mtx); r->r_flags |= RF_ACTIVE; - mtx_unlock(rm->rm_mtx); + mtx_unlock(&rm->rm_mtx); return 0; } @@ -652,9 +648,9 @@ rman_deactivate_resource(struct resource *r) struct rman *rm; rm = r->__r_i->r_rm; - mtx_lock(rm->rm_mtx); + mtx_lock(&rm->rm_mtx); r->__r_i->r_flags &= ~RF_ACTIVE; - mtx_unlock(rm->rm_mtx); + mtx_unlock(&rm->rm_mtx); return 0; } @@ -761,9 +757,9 @@ rman_release_resource(struct resource *re) r = re->__r_i; rm = r->r_rm; - mtx_lock(rm->rm_mtx); + mtx_lock(&rm->rm_mtx); rv = int_rman_release_resource(rm, r); - mtx_unlock(rm->rm_mtx); + mtx_unlock(&rm->rm_mtx); return (rv); } @@ -991,7 +987,7 @@ sysctl_rman(SYSCTL_HANDLER_ARGS) /* * Find the indexed resource and return it. */ - mtx_lock(rm->rm_mtx); + mtx_lock(&rm->rm_mtx); TAILQ_FOREACH(res, &rm->rm_list, r_link) { if (res->r_sharehead != NULL) { LIST_FOREACH(sres, res->r_sharehead, r_sharelink) @@ -1003,7 +999,7 @@ sysctl_rman(SYSCTL_HANDLER_ARGS) else if (res_idx-- == 0) goto found; } - mtx_unlock(rm->rm_mtx); + mtx_unlock(&rm->rm_mtx); return (ENOENT); found: @@ -1028,7 +1024,7 @@ found: ures.r_size = res->r_end - res->r_start + 1; ures.r_flags = res->r_flags; - mtx_unlock(rm->rm_mtx); + mtx_unlock(&rm->rm_mtx); error = SYSCTL_OUT(req, &ures, sizeof(ures)); return (error); } diff --git a/sys/sys/rman.h b/sys/sys/rman.h index 323da4a62201..2479942c3217 100644 --- a/sys/sys/rman.h +++ b/sys/sys/rman.h @@ -35,6 +35,7 @@ #ifndef _KERNEL #include #else +#include #include #include #endif @@ -112,7 +113,7 @@ TAILQ_HEAD(resource_head, resource_i); struct rman { struct resource_head rm_list; - struct mtx *rm_mtx; /* mutex used to protect rm_list */ + struct mtx rm_mtx; /* mutex used to protect rm_list */ TAILQ_ENTRY(rman) rm_link; /* link in list of all rmans */ rman_res_t rm_start; /* index of globally first entry */ rman_res_t rm_end; /* index of globally last entry */