Source-Changes-HG archive

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

[src/trunk]: src/sys Let the linker instead of the C preprocessor configure t...



details:   https://anonhg.NetBSD.org/src/rev/9c6012fe59cc
branches:  trunk
changeset: 761551:9c6012fe59cc
user:      dyoung <dyoung%NetBSD.org@localhost>
date:      Mon Jan 31 23:07:16 2011 +0000

description:
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.

diffstat:

 sys/kern/kern_stub.c     |   6 ++++--
 sys/kern/subr_autoconf.c |  10 ++--------
 sys/sys/device.h         |   6 +-----
 3 files changed, 7 insertions(+), 15 deletions(-)

diffs (98 lines):

diff -r 7bc5dd639f4b -r 9c6012fe59cc sys/kern/kern_stub.c
--- a/sys/kern/kern_stub.c      Mon Jan 31 23:00:34 2011 +0000
+++ b/sys/kern/kern_stub.c      Mon Jan 31 23:07:16 2011 +0000
@@ -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);
diff -r 7bc5dd639f4b -r 9c6012fe59cc sys/kern/subr_autoconf.c
--- a/sys/kern/subr_autoconf.c  Mon Jan 31 23:00:34 2011 +0000
+++ b/sys/kern/subr_autoconf.c  Mon Jan 31 23:07:16 2011 +0000
@@ -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;
diff -r 7bc5dd639f4b -r 9c6012fe59cc sys/sys/device.h
--- a/sys/sys/device.h  Mon Jan 31 23:00:34 2011 +0000
+++ b/sys/sys/device.h  Mon Jan 31 23:07:16 2011 +0000
@@ -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);



Home | Main Index | Thread Index | Old Index