Thu Jan 7 22:39:52 2010 UTC ()
Add a do-nothing child-detachment hook, null_childdetached(device_t,
device_t).


(dyoung)
diff -r1.191 -r1.192 src/sys/kern/subr_autoconf.c
diff -r1.128 -r1.129 src/sys/sys/device.h

cvs diff -r1.191 -r1.192 src/sys/kern/subr_autoconf.c (expand / switch to unified diff)

--- src/sys/kern/subr_autoconf.c 2010/01/05 22:42:16 1.191
+++ src/sys/kern/subr_autoconf.c 2010/01/07 22:39:52 1.192
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: subr_autoconf.c,v 1.191 2010/01/05 22:42:16 dyoung Exp $ */ 1/* $NetBSD: subr_autoconf.c,v 1.192 2010/01/07 22:39:52 dyoung Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1996, 2000 Christopher G. Demetriou 4 * Copyright (c) 1996, 2000 Christopher G. Demetriou
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -67,27 +67,27 @@ @@ -67,27 +67,27 @@
67 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 67 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
68 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 68 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
69 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 69 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
70 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 70 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
71 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 71 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
72 * SUCH DAMAGE. 72 * SUCH DAMAGE.
73 * 73 *
74 * from: Header: subr_autoconf.c,v 1.12 93/02/01 19:31:48 torek Exp (LBL) 74 * from: Header: subr_autoconf.c,v 1.12 93/02/01 19:31:48 torek Exp (LBL)
75 * 75 *
76 * @(#)subr_autoconf.c 8.3 (Berkeley) 5/17/94 76 * @(#)subr_autoconf.c 8.3 (Berkeley) 5/17/94
77 */ 77 */
78 78
79#include <sys/cdefs.h> 79#include <sys/cdefs.h>
80__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.191 2010/01/05 22:42:16 dyoung Exp $"); 80__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.192 2010/01/07 22:39:52 dyoung Exp $");
81 81
82#ifdef _KERNEL_OPT 82#ifdef _KERNEL_OPT
83#include "opt_ddb.h" 83#include "opt_ddb.h"
84#endif 84#endif
85 85
86#include <sys/param.h> 86#include <sys/param.h>
87#include <sys/device.h> 87#include <sys/device.h>
88#include <sys/disklabel.h> 88#include <sys/disklabel.h>
89#include <sys/conf.h> 89#include <sys/conf.h>
90#include <sys/kauth.h> 90#include <sys/kauth.h>
91#include <sys/malloc.h> 91#include <sys/malloc.h>
92#include <sys/kmem.h> 92#include <sys/kmem.h>
93#include <sys/systm.h> 93#include <sys/systm.h>
@@ -2712,26 +2712,32 @@ deviter_release(deviter_t *di) @@ -2712,26 +2712,32 @@ deviter_release(deviter_t *di)
2712{ 2712{
2713 bool rw = (di->di_flags & DEVITER_F_RW) != 0; 2713 bool rw = (di->di_flags & DEVITER_F_RW) != 0;
2714 int s; 2714 int s;
2715 2715
2716 s = config_alldevs_lock(); 2716 s = config_alldevs_lock();
2717 if (rw) 2717 if (rw)
2718 --alldevs_nwrite; 2718 --alldevs_nwrite;
2719 else 2719 else
2720 --alldevs_nread; 2720 --alldevs_nread;
2721 /* XXX wake a garbage-collection thread */ 2721 /* XXX wake a garbage-collection thread */
2722 config_alldevs_unlock(s); 2722 config_alldevs_unlock(s);
2723} 2723}
2724 2724
 2725void
 2726null_childdetached(device_t self, device_t child)
 2727{
 2728 /* do nothing */
 2729}
 2730
2725static void 2731static void
2726sysctl_detach_setup(struct sysctllog **clog) 2732sysctl_detach_setup(struct sysctllog **clog)
2727{ 2733{
2728 const struct sysctlnode *node = NULL; 2734 const struct sysctlnode *node = NULL;
2729 2735
2730 sysctl_createv(clog, 0, NULL, &node, 2736 sysctl_createv(clog, 0, NULL, &node,
2731 CTLFLAG_PERMANENT, 2737 CTLFLAG_PERMANENT,
2732 CTLTYPE_NODE, "kern", NULL, 2738 CTLTYPE_NODE, "kern", NULL,
2733 NULL, 0, NULL, 0, 2739 NULL, 0, NULL, 0,
2734 CTL_KERN, CTL_EOL); 2740 CTL_KERN, CTL_EOL);
2735 2741
2736 if (node == NULL) 2742 if (node == NULL)
2737 return; 2743 return;

cvs diff -r1.128 -r1.129 src/sys/sys/device.h (expand / switch to unified diff)

--- src/sys/sys/device.h 2009/12/15 03:02:25 1.128
+++ src/sys/sys/device.h 2010/01/07 22:39:52 1.129
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: device.h,v 1.128 2009/12/15 03:02:25 dyoung Exp $ */ 1/* $NetBSD: device.h,v 1.129 2010/01/07 22:39:52 dyoung Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1996, 2000 Christopher G. Demetriou 4 * Copyright (c) 1996, 2000 Christopher G. Demetriou
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -469,26 +469,28 @@ int config_deactivate(device_t); @@ -469,26 +469,28 @@ int config_deactivate(device_t);
469void config_defer(device_t, void (*)(device_t)); 469void config_defer(device_t, void (*)(device_t));
470void config_deferred(device_t); 470void config_deferred(device_t);
471void config_interrupts(device_t, void (*)(device_t)); 471void config_interrupts(device_t, void (*)(device_t));
472void config_pending_incr(void); 472void config_pending_incr(void);
473void config_pending_decr(void); 473void config_pending_decr(void);
474void config_create_interruptthreads(void); 474void config_create_interruptthreads(void);
475 475
476int config_finalize_register(device_t, int (*)(device_t)); 476int config_finalize_register(device_t, int (*)(device_t));
477void config_finalize(void); 477void config_finalize(void);
478 478
479void config_twiddle_init(void); 479void config_twiddle_init(void);
480void config_twiddle_fn(void *); 480void config_twiddle_fn(void *);
481 481
 482void null_childdetached(device_t, device_t);
 483
482device_t device_lookup(cfdriver_t, int); 484device_t device_lookup(cfdriver_t, int);
483void *device_lookup_private(cfdriver_t, int); 485void *device_lookup_private(cfdriver_t, int);
484#ifdef __HAVE_DEVICE_REGISTER 486#ifdef __HAVE_DEVICE_REGISTER
485void device_register(device_t, void *); 487void device_register(device_t, void *);
486#endif 488#endif
487 489
488devclass_t device_class(device_t); 490devclass_t device_class(device_t);
489cfdata_t device_cfdata(device_t); 491cfdata_t device_cfdata(device_t);
490cfdriver_t device_cfdriver(device_t); 492cfdriver_t device_cfdriver(device_t);
491cfattach_t device_cfattach(device_t); 493cfattach_t device_cfattach(device_t);
492int device_unit(device_t); 494int device_unit(device_t);
493const char *device_xname(device_t); 495const char *device_xname(device_t);
494device_t device_parent(device_t); 496device_t device_parent(device_t);