Source-Changes-HG archive

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

[src/trunk]: src/sys/dev There is currently a counter nactive which tracks th...



details:   https://anonhg.NetBSD.org/src/rev/b76f01023165
branches:  trunk
changeset: 358249:b76f01023165
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Tue Dec 19 03:24:09 2017 +0000

description:
There is currently a counter nactive which tracks the INSERT and REMOVE
of entries in the ccds LIST.

Since the counter is checked only when the ccd module is being unloaded,
remove the counter completely and just check for LIST_EMPTY(ccds).

No functional change intended.

diffstat:

 sys/dev/ccd.c |  9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)

diffs (51 lines):

diff -r 1ed5d0f28716 -r b76f01023165 sys/dev/ccd.c
--- a/sys/dev/ccd.c     Tue Dec 19 01:59:48 2017 +0000
+++ b/sys/dev/ccd.c     Tue Dec 19 03:24:09 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ccd.c,v 1.172 2017/06/01 02:45:08 chs Exp $    */
+/*     $NetBSD: ccd.c,v 1.173 2017/12/19 03:24:09 pgoyette 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.172 2017/06/01 02:45:08 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ccd.c,v 1.173 2017/12/19 03:24:09 pgoyette Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -218,7 +218,6 @@
 
 static LIST_HEAD(, ccd_softc) ccds = LIST_HEAD_INITIALIZER(ccds);
 static kmutex_t ccd_lock;
-static size_t ccd_nactive = 0;
 
 #ifdef _MODULE
 static struct sysctllog *ccd_clog;
@@ -275,7 +274,6 @@
                return NULL;
        mutex_enter(&ccd_lock);
        LIST_INSERT_HEAD(&ccds, sc, sc_link);
-       ccd_nactive++;
        mutex_exit(&ccd_lock);
        return sc;
 }
@@ -284,7 +282,6 @@
 ccdput(struct ccd_softc *sc) {
        mutex_enter(&ccd_lock);
        LIST_REMOVE(sc, sc_link);
-       ccd_nactive--;
        mutex_exit(&ccd_lock);
        ccddestroy(sc);
 }
@@ -1721,7 +1718,7 @@
        case MODULE_CMD_FINI:
 #ifdef _MODULE
                mutex_enter(&ccd_lock);
-               if (ccd_nactive) {
+               if (!LIST_EMPTY(ccds)) {
                        mutex_exit(&ccd_lock);
                        error = EBUSY;
                } else {



Home | Main Index | Thread Index | Old Index