diff options
-rw-r--r-- | sys/kern/subr_kobj.c | 13 | ||||
-rw-r--r-- | sys/sys/kobj.h | 5 |
2 files changed, 16 insertions, 2 deletions
diff --git a/sys/kern/subr_kobj.c b/sys/kern/subr_kobj.c index 1704a0f..b8528fa 100644 --- a/sys/kern/subr_kobj.c +++ b/sys/kern/subr_kobj.c @@ -57,6 +57,7 @@ SYSCTL_UINT(_kern, OID_AUTO, kobj_misses, CTLFLAG_RD, #endif static struct mtx kobj_mtx; +static int kobj_mutex_inited; static int kobj_next_id = 1; SYSCTL_UINT(_kern, OID_AUTO, kobj_methodcount, CTLFLAG_RD, @@ -65,12 +66,20 @@ SYSCTL_UINT(_kern, OID_AUTO, kobj_methodcount, CTLFLAG_RD, static void kobj_init_mutex(void *arg) { - - mtx_init(&kobj_mtx, "kobj", NULL, MTX_DEF); + if (!kobj_mutex_inited) { + mtx_init(&kobj_mtx, "kobj", NULL, MTX_DEF); + kobj_mutex_inited = 1; + } } SYSINIT(kobj, SI_SUB_LOCK, SI_ORDER_ANY, kobj_init_mutex, NULL); +void +kobj_machdep_init(void) +{ + kobj_init_mutex(NULL); +} + /* * This method structure is used to initialise new caches. Since the * desc pointer is NULL, it is guaranteed never to match any read diff --git a/sys/sys/kobj.h b/sys/sys/kobj.h index d2cd0da..86788e5 100644 --- a/sys/sys/kobj.h +++ b/sys/sys/kobj.h @@ -246,4 +246,9 @@ kobj_method_t* kobj_lookup_method(kobj_class_t cls, */ int kobj_error_method(void); +/* + * Machine-dependent initialisation call for boot-time kobj clients + */ +void kobj_machdep_init(void); + #endif /* !_SYS_KOBJ_H_ */ |