Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pci attach also the nvme_cdevsw when loaded as modul...
details: https://anonhg.NetBSD.org/src/rev/2e97b1a201d2
branches: trunk
changeset: 347842:2e97b1a201d2
user: jdolecek <jdolecek%NetBSD.org@localhost>
date: Sun Sep 18 11:58:35 2016 +0000
description:
attach also the nvme_cdevsw when loaded as module, so /dev/nvme* works
diffstat:
sys/dev/pci/nvme_pci.c | 20 +++++++++++++++-----
1 files changed, 15 insertions(+), 5 deletions(-)
diffs (59 lines):
diff -r 93b301593046 -r 2e97b1a201d2 sys/dev/pci/nvme_pci.c
--- a/sys/dev/pci/nvme_pci.c Sun Sep 18 05:16:21 2016 +0000
+++ b/sys/dev/pci/nvme_pci.c Sun Sep 18 11:58:35 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nvme_pci.c,v 1.12 2016/09/17 20:15:09 jdolecek Exp $ */
+/* $NetBSD: nvme_pci.c,v 1.13 2016/09/18 11:58:35 jdolecek Exp $ */
/* $OpenBSD: nvme_pci.c,v 1.3 2016/04/14 11:18:32 dlg Exp $ */
/*
@@ -43,7 +43,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nvme_pci.c,v 1.12 2016/09/17 20:15:09 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvme_pci.c,v 1.13 2016/09/18 11:58:35 jdolecek Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -469,9 +469,6 @@
#ifdef _MODULE
#include "ioconf.c"
-
-extern const struct bdevsw ld_bdevsw;
-extern const struct cdevsw ld_cdevsw;
#endif
static int
@@ -479,6 +476,9 @@
{
#ifdef _MODULE
devmajor_t cmajor, bmajor;
+ extern const struct bdevsw ld_bdevsw;
+ extern const struct cdevsw ld_cdevsw;
+ extern const struct cdevsw nvme_cdevsw;
#endif
int error = 0;
@@ -502,10 +502,20 @@
if (error)
return error;
+ bmajor = cmajor = NODEVMAJOR;
+ error = devsw_attach(nvme_cd.cd_name, NULL, &bmajor,
+ &nvme_cdevsw, &cmajor);
+ if (error) {
+ aprint_error("%s: unable to register devsw\n",
+ nvme_cd.cd_name);
+ /* do not abort, just /dev/nvme* will not work */
+ }
#endif
return error;
case MODULE_CMD_FINI:
#ifdef _MODULE
+ devsw_detach(NULL, &nvme_cdevsw);
+
error = config_fini_component(cfdriver_ioconf_nvme_pci,
cfattach_ioconf_nvme_pci, cfdata_ioconf_nvme_pci);
if (error)
Home |
Main Index |
Thread Index |
Old Index