Module Name: src
Committed By: pgoyette
Date: Sun Jul 17 02:44:41 UTC 2016
Modified Files:
src/sys/dev/raidframe [pgoyette-localcount]: rf_netbsdkintf.c
Log Message:
Don't call devsw_attach() and devsw_detach() for built-in modules.
To generate a diff of this commit:
cvs rdiff -u -r1.345 -r1.345.2.1 src/sys/dev/raidframe/rf_netbsdkintf.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/raidframe/rf_netbsdkintf.c
diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.345 src/sys/dev/raidframe/rf_netbsdkintf.c:1.345.2.1
--- src/sys/dev/raidframe/rf_netbsdkintf.c:1.345 Wed Apr 27 02:47:39 2016
+++ src/sys/dev/raidframe/rf_netbsdkintf.c Sun Jul 17 02:44:41 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_netbsdkintf.c,v 1.345 2016/04/27 02:47:39 christos Exp $ */
+/* $NetBSD: rf_netbsdkintf.c,v 1.345.2.1 2016/07/17 02:44:41 pgoyette Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
***********************************************************/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.345 2016/04/27 02:47:39 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.345.2.1 2016/07/17 02:44:41 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -3766,7 +3766,9 @@ static int
raid_modcmd_init(void)
{
int error;
+#ifdef _MODULE
int bmajor, cmajor;
+#endif
mutex_init(&raid_lock, MUTEX_DEFAULT, IPL_NONE);
mutex_enter(&raid_lock);
@@ -3778,15 +3780,15 @@ raid_modcmd_init(void)
rf_sparet_wait_queue = rf_sparet_resp_queue = NULL;
#endif
+#ifdef _MODULE
bmajor = cmajor = -1;
error = devsw_attach("raid", &raid_bdevsw, &bmajor,
&raid_cdevsw, &cmajor);
- if (error != 0 && error != EEXIST) {
+ if (error != 0) {
aprint_error("%s: devsw_attach failed %d\n", __func__, error);
mutex_exit(&raid_lock);
return error;
}
-#ifdef _MODULE
error = config_cfdriver_attach(&raid_cd);
if (error != 0) {
aprint_error("%s: config_cfdriver_attach failed %d\n",
@@ -3860,17 +3862,15 @@ raid_modcmd_fini(void)
mutex_exit(&raid_lock);
return error;
}
-#endif
error = devsw_detach(&raid_bdevsw, &raid_cdevsw);
if (error != 0) {
aprint_error("%s: cannot detach devsw\n",__func__);
-#ifdef _MODULE
config_cfdriver_attach(&raid_cd);
-#endif
config_cfattach_attach(raid_cd.cd_name, &raid_ca);
mutex_exit(&raid_lock);
return error;
}
+#endif
rf_BootRaidframe(false);
#if (RF_INCLUDE_PARITY_DECLUSTERING_DS > 0)
rf_destroy_mutex2(rf_sparet_wait_mutex);