summaryrefslogtreecommitdiff
path: root/sys/dev/raidframe/rf_driver.c
diff options
context:
space:
mode:
authorpgoyette <pgoyette@NetBSD.org>2015-12-26 00:58:45 +0000
committerpgoyette <pgoyette@NetBSD.org>2015-12-26 00:58:45 +0000
commit765decc01b2b4e0c2c1e1ef941c888282d412396 (patch)
tree23361106b830cdda68138729fbe02e65774cc514 /sys/dev/raidframe/rf_driver.c
parent5b73703d60cc2973729cddfe2317e3d059347c45 (diff)
Modularize the raidframe driver, including rework of the unit attach
code to permit detaching (and possible module unloading). Also, convert tsleep()/wakeup() locking to use cv_wait_sig()/cv_broadcast(). Tested in non-modular, modular-builtin, and modular-loaded-at-runtime environments.
Diffstat (limited to 'sys/dev/raidframe/rf_driver.c')
-rw-r--r--sys/dev/raidframe/rf_driver.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/sys/dev/raidframe/rf_driver.c b/sys/dev/raidframe/rf_driver.c
index 83c0673aed5..5f795cb8947 100644
--- a/sys/dev/raidframe/rf_driver.c
+++ b/sys/dev/raidframe/rf_driver.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_driver.c,v 1.131 2012/12/10 08:36:03 msaitoh Exp $ */
+/* $NetBSD: rf_driver.c,v 1.132 2015/12/26 00:58:45 pgoyette Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -66,7 +66,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_driver.c,v 1.131 2012/12/10 08:36:03 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_driver.c,v 1.132 2015/12/26 00:58:45 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_raid_diagnostic.h"
@@ -158,16 +158,21 @@ static void rf_alloc_mutex_cond(RF_Raid_t *);
/* called at system boot time */
int
-rf_BootRaidframe(void)
+rf_BootRaidframe(bool boot)
{
- if (raidframe_booted)
- return (EBUSY);
- raidframe_booted = 1;
- rf_init_mutex2(configureMutex, IPL_NONE);
- configureCount = 0;
- isconfigged = 0;
- globalShutdown = NULL;
+ if (boot) {
+ if (raidframe_booted)
+ return (EBUSY);
+ raidframe_booted = 1;
+ rf_init_mutex2(configureMutex, IPL_NONE);
+ configureCount = 0;
+ isconfigged = 0;
+ globalShutdown = NULL;
+ } else {
+ rf_destroy_mutex2(configureMutex);
+ raidframe_booted = 0;
+ }
return (0);
}