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.
This commit is contained in:
dyoung 2011-01-31 23:07:16 +00:00
parent 25fc6f07bf
commit dcda6c56b0
3 changed files with 7 additions and 15 deletions

View File

@ -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(ktruser,enosys);
__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);

View File

@ -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 @@ config_attach_loc(device_t parent, cfdata_t cf,
}
}
}
#ifdef __HAVE_DEVICE_REGISTER
device_register(dev, aux);
#endif
/* Let userland know */
devmon_report_device(dev, true);
@ -1490,9 +1488,7 @@ config_attach_loc(device_t parent, cfdata_t cf,
config_process_deferred(&deferred_config_queue, dev);
#ifdef __HAVE_DEVICE_REGISTER_POSTCONFIG
device_register_post_config(dev, aux);
#endif
return dev;
}
@ -1531,9 +1527,7 @@ config_attach_pseudo(cfdata_t cf)
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);

View File

@ -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 @@ void null_childdetached(device_t, device_t);
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);