Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/pgoyette-localcount]: src/sys/dev/raidframe Don't call devsw_attach() an...



details:   https://anonhg.NetBSD.org/src/rev/734a8f084f72
branches:  pgoyette-localcount
changeset: 852800:734a8f084f72
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Sun Jul 17 02:44:41 2016 +0000

description:
Don't call devsw_attach() and devsw_detach() for built-in modules.

diffstat:

 sys/dev/raidframe/rf_netbsdkintf.c |  14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diffs (65 lines):

diff -r 18a967b20f27 -r 734a8f084f72 sys/dev/raidframe/rf_netbsdkintf.c
--- a/sys/dev/raidframe/rf_netbsdkintf.c        Sun Jul 17 02:37:54 2016 +0000
+++ b/sys/dev/raidframe/rf_netbsdkintf.c        Sun Jul 17 02:44:41 2016 +0000
@@ -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 @@
 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 @@
        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 @@
                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);



Home | Main Index | Thread Index | Old Index