netbt(4): Initialize bt_lock earlier.
Use a driver-class module modcmd init function, instead of a socket domain init function; the socket-domain ones don't run until after configure, but we need this to be initialized before configure so that Bluetooth HCI drivers like ubt(4) can use it. This is suboptimal but it's the least intrusive way I've thought of to get this working, even if it's a little grody to make netbt a `driver-class' (builtin) module. Note that this doesn't mean netbt becomes dynamically loadable or unloadable; we're just using a module for initialization ordering. PR kern/56988 XXX pullup-10
This commit is contained in:
parent
496d3f3377
commit
6438ad3ab0
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: bt_proto.c,v 1.16 2016/01/21 15:41:30 riastradh Exp $ */
|
||||
/* $NetBSD: bt_proto.c,v 1.17 2023/08/07 13:31:54 riastradh Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2005 Iain Hibbert.
|
||||
|
@ -31,11 +31,12 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: bt_proto.c,v 1.16 2016/01/21 15:41:30 riastradh Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: bt_proto.c,v 1.17 2023/08/07 13:31:54 riastradh Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/domain.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/protosw.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -113,6 +114,21 @@ kmutex_t *bt_lock;
|
|||
static void
|
||||
bt_init(void)
|
||||
{
|
||||
|
||||
bt_lock = mutex_obj_alloc(MUTEX_DEFAULT, IPL_NONE);
|
||||
}
|
||||
|
||||
MODULE(MODULE_CLASS_DRIVER, netbt, NULL);
|
||||
|
||||
static int
|
||||
netbt_modcmd(modcmd_t cmd, void *aux)
|
||||
{
|
||||
|
||||
switch (cmd) {
|
||||
case MODULE_CMD_INIT:
|
||||
bt_lock = mutex_obj_alloc(MUTEX_DEFAULT, IPL_NONE);
|
||||
return 0;
|
||||
case MODULE_CMD_FINI:
|
||||
return EBUSY; /* XXX */
|
||||
default:
|
||||
return ENOTTY;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue