Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev destroy the pool and the mutex when detaching.
details: https://anonhg.NetBSD.org/src/rev/a8563e359749
branches: trunk
changeset: 335236:a8563e359749
user: christos <christos%NetBSD.org@localhost>
date: Tue Dec 30 20:57:37 2014 +0000
description:
destroy the pool and the mutex when detaching.
diffstat:
sys/dev/ccd.c | 21 ++++++++++++++++-----
1 files changed, 16 insertions(+), 5 deletions(-)
diffs (58 lines):
diff -r 17dab734f2d2 -r a8563e359749 sys/dev/ccd.c
--- a/sys/dev/ccd.c Tue Dec 30 20:29:42 2014 +0000
+++ b/sys/dev/ccd.c Tue Dec 30 20:57:37 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ccd.c,v 1.158 2014/12/30 20:29:42 christos Exp $ */
+/* $NetBSD: ccd.c,v 1.159 2014/12/30 20:57:37 christos Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 1999, 2007, 2009 The NetBSD Foundation, Inc.
@@ -88,7 +88,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ccd.c,v 1.158 2014/12/30 20:29:42 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ccd.c,v 1.159 2014/12/30 20:57:37 christos Exp $");
#if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h"
@@ -161,6 +161,7 @@
/* called by main() at boot time */
void ccdattach(int);
+void ccddetach(void);
/* called by biodone() at interrupt time */
static void ccdiodone(struct buf *);
@@ -299,6 +300,13 @@
0, 0, "ccdbuf", NULL, IPL_BIO, NULL, NULL, NULL);
}
+void
+ccddetach(void)
+{
+ pool_cache_destroy(ccd_cache);
+ mutex_destroy(&ccd_lock);
+}
+
static int
ccdinit(struct ccd_softc *cs, char **cpaths, struct vnode **vpp,
struct lwp *l)
@@ -1716,11 +1724,14 @@
case MODULE_CMD_FINI:
#ifdef _MODULE
mutex_enter(&ccd_lock);
- if (ccd_nactive)
+ if (ccd_nactive) {
+ mutex_exit(&ccd_lock);
error = EBUSY;
- else
+ } else {
+ mutex_exit(&ccd_lock);
error = devsw_detach(&ccd_bdevsw, &ccd_cdevsw);
- mutex_exit(&ccd_lock);
+ ccddetach();
+ }
#endif
break;
Home |
Main Index |
Thread Index |
Old Index