summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_kobj.c
diff options
context:
space:
mode:
authorgrehan <grehan@FreeBSD.org>2005-08-07 02:20:35 +0000
committergrehan <grehan@FreeBSD.org>2005-08-07 02:20:35 +0000
commit449d4474b42c2ce47f7067f0435eb71eda24bd52 (patch)
treec6f2d035295a4e129e1efa946edb3848af5c7b89 /sys/kern/subr_kobj.c
parent8b2c1e15345135ba0259b951654653fa73c718fb (diff)
downloadFreeBSD-src-449d4474b42c2ce47f7067f0435eb71eda24bd52.zip
FreeBSD-src-449d4474b42c2ce47f7067f0435eb71eda24bd52.tar.gz
Export a routine, kobj_machdep_init(), that allows platforms
to use the kobj subsystem as soon at mutex_init() has been called instead of having to wait for the SI_SUB_LOCK sysinit. Reviewed by: dfr
Diffstat (limited to 'sys/kern/subr_kobj.c')
-rw-r--r--sys/kern/subr_kobj.c13
1 files changed, 11 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
OpenPOWER on IntegriCloud