Module Name: src
Committed By: dyoung
Date: Mon Jan 31 23:07:17 UTC 2011
Modified Files:
src/sys/kern: kern_stub.c subr_autoconf.c
src/sys/sys: device.h
Log Message:
Let the linker instead of the C preprocessor configure the kernel: make
weak aliases device_register(9) and device_register_post_config(9)
for the stub routine voidop(). Get rid of __HAVE_DEVICE_REGISTER and
__HAVE_DEVICE_REGISTER_POST_CONFIG.
To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/kern/kern_stub.c
cvs rdiff -u -r1.211 -r1.212 src/sys/kern/subr_autoconf.c
cvs rdiff -u -r1.137 -r1.138 src/sys/sys/device.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/kern/kern_stub.c
diff -u src/sys/kern/kern_stub.c:1.29 src/sys/kern/kern_stub.c:1.30
--- src/sys/kern/kern_stub.c:1.29 Sun Jun 13 13:43:02 2010
+++ src/sys/kern/kern_stub.c Mon Jan 31 23:07:16 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_stub.c,v 1.29 2010/06/13 13:43:02 simonb Exp $ */
+/* $NetBSD: kern_stub.c,v 1.30 2011/01/31 23:07:16 dyoung Exp $ */
/*-
* Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_stub.c,v 1.29 2010/06/13 13:43:02 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_stub.c,v 1.30 2011/01/31 23:07:16 dyoung Exp $");
#include "opt_ptrace.h"
#include "opt_ktrace.h"
@@ -122,6 +122,8 @@
__weak_alias(ktr_point,nullop);
#endif /* KTRACE */
+__weak_alias(device_register, voidop);
+__weak_alias(device_register_post_config, voidop);
__weak_alias(spldebug_start, voidop);
__weak_alias(spldebug_stop, voidop);
__weak_alias(machdep_init,nullop);
Index: src/sys/kern/subr_autoconf.c
diff -u src/sys/kern/subr_autoconf.c:1.211 src/sys/kern/subr_autoconf.c:1.212
--- src/sys/kern/subr_autoconf.c:1.211 Mon Jan 31 23:00:34 2011
+++ src/sys/kern/subr_autoconf.c Mon Jan 31 23:07:16 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_autoconf.c,v 1.211 2011/01/31 23:00:34 dyoung Exp $ */
+/* $NetBSD: subr_autoconf.c,v 1.212 2011/01/31 23:07:16 dyoung Exp $ */
/*
* Copyright (c) 1996, 2000 Christopher G. Demetriou
@@ -77,7 +77,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.211 2011/01/31 23:00:34 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.212 2011/01/31 23:07:16 dyoung Exp $");
#ifdef _KERNEL_OPT
#include "opt_ddb.h"
@@ -1468,9 +1468,7 @@
}
}
}
-#ifdef __HAVE_DEVICE_REGISTER
device_register(dev, aux);
-#endif
/* Let userland know */
devmon_report_device(dev, true);
@@ -1490,9 +1488,7 @@
config_process_deferred(&deferred_config_queue, dev);
-#ifdef __HAVE_DEVICE_REGISTER_POSTCONFIG
device_register_post_config(dev, aux);
-#endif
return dev;
}
@@ -1531,10 +1527,8 @@
config_devlink(dev);
#if 0 /* XXXJRT not yet */
-#ifdef __HAVE_DEVICE_REGISTER
device_register(dev, NULL); /* like a root node */
#endif
-#endif
(*dev->dv_cfattach->ca_attach)(ROOT, dev, NULL);
config_process_deferred(&deferred_config_queue, dev);
return dev;
Index: src/sys/sys/device.h
diff -u src/sys/sys/device.h:1.137 src/sys/sys/device.h:1.138
--- src/sys/sys/device.h:1.137 Fri Jun 25 15:10:42 2010
+++ src/sys/sys/device.h Mon Jan 31 23:07:17 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: device.h,v 1.137 2010/06/25 15:10:42 tsutsui Exp $ */
+/* $NetBSD: device.h,v 1.138 2011/01/31 23:07:17 dyoung Exp $ */
/*
* Copyright (c) 1996, 2000 Christopher G. Demetriou
@@ -495,12 +495,8 @@
device_t device_lookup(cfdriver_t, int);
void *device_lookup_private(cfdriver_t, int);
-#ifdef __HAVE_DEVICE_REGISTER
void device_register(device_t, void *);
-#endif
-#ifdef __HAVE_DEVICE_REGISTER_POSTCONFIG
void device_register_post_config(device_t, void *);
-#endif
devclass_t device_class(device_t);
cfdata_t device_cfdata(device_t);