Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/gpio Register as built-in module when compiled wo/ _...
details: https://anonhg.NetBSD.org/src/rev/f4553c701750
branches: trunk
changeset: 768971:f4553c701750
user: mbalmer <mbalmer%NetBSD.org@localhost>
date: Mon Aug 29 15:14:04 2011 +0000
description:
Register as built-in module when compiled wo/ _MODULE.
diffstat:
sys/dev/gpio/gpio.c | 15 ++++++++++-----
sys/dev/gpio/gpiosim.c | 15 ++++++++++-----
2 files changed, 20 insertions(+), 10 deletions(-)
diffs (125 lines):
diff -r 189b27ec14a2 -r f4553c701750 sys/dev/gpio/gpio.c
--- a/sys/dev/gpio/gpio.c Mon Aug 29 15:06:49 2011 +0000
+++ b/sys/dev/gpio/gpio.c Mon Aug 29 15:14:04 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gpio.c,v 1.36 2011/08/28 07:48:50 mbalmer Exp $ */
+/* $NetBSD: gpio.c,v 1.37 2011/08/29 15:14:04 mbalmer Exp $ */
/* $OpenBSD: gpio.c,v 1.6 2006/01/14 12:33:49 grange Exp $ */
/*
@@ -19,7 +19,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gpio.c,v 1.36 2011/08/28 07:48:50 mbalmer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gpio.c,v 1.37 2011/08/29 15:14:04 mbalmer Exp $");
/*
* General Purpose Input/Output framework.
@@ -897,19 +897,22 @@
return 0;
}
-#ifdef _MODULE
MODULE(MODULE_CLASS_DRIVER, gpio, NULL);
+#ifdef _MODULE
#include "ioconf.c"
+#endif
static int
gpio_modcmd(modcmd_t cmd, void *opaque)
{
+#ifdef _MODULE
devmajor_t cmajor = NODEVMAJOR, bmajor = NODEVMAJOR;
int error;
-
+#endif
switch (cmd) {
case MODULE_CMD_INIT:
+#ifdef _MODULE
error = config_init_component(cfdriver_ioconf_gpio,
cfattach_ioconf_gpio, cfdata_ioconf_gpio);
if (error) {
@@ -925,14 +928,16 @@
return config_fini_component(cfdriver_ioconf_gpio,
cfattach_ioconf_gpio, cfdata_ioconf_gpio);
}
+#endif
return 0;
case MODULE_CMD_FINI:
+#ifdef _MODULE
config_fini_component(cfdriver_ioconf_gpio,
cfattach_ioconf_gpio, cfdata_ioconf_gpio);
devsw_detach(NULL, &gpio_cdevsw);
+#endif
return 0;
default:
return ENOTTY;
}
}
-#endif
diff -r 189b27ec14a2 -r f4553c701750 sys/dev/gpio/gpiosim.c
--- a/sys/dev/gpio/gpiosim.c Mon Aug 29 15:06:49 2011 +0000
+++ b/sys/dev/gpio/gpiosim.c Mon Aug 29 15:14:04 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gpiosim.c,v 1.11 2011/08/28 11:36:17 jmcneill Exp $ */
+/* $NetBSD: gpiosim.c,v 1.12 2011/08/29 15:14:04 mbalmer Exp $ */
/* $OpenBSD: gpiosim.c,v 1.1 2008/11/23 18:46:49 mbalmer Exp $ */
/*
@@ -219,9 +219,9 @@
sc->sc_gpio_pins[pin].pin_flags = flags;
}
-#ifdef _MODULE
MODULE(MODULE_CLASS_DRIVER, gpiosim, "gpio");
+#ifdef _MODULE
static const struct cfiattrdata gpiobus_iattrdata = {
"gpiobus", 0, { { NULL, NULL, 0 },}
};
@@ -247,14 +247,17 @@
},
{ NULL, NULL, 0, FSTATE_NOTFOUND, NULL, 0, NULL }
};
+#endif
static int
gpiosim_modcmd(modcmd_t cmd, void *opaque)
{
+#ifdef _MODULE
int error = 0;
-
+#endif
switch (cmd) {
case MODULE_CMD_INIT:
+#ifdef _MODULE
error = config_cfdriver_attach(&gpiosim_cd);
if (error)
return error;
@@ -276,15 +279,18 @@
gpiosim_cd.cd_name);
return error;
}
- (void)config_attach_pseudo(gpiosim_cfdata);
+ config_attach_pseudo(gpiosim_cfdata);
+#endif
return 0;
case MODULE_CMD_FINI:
+#ifdef _MODULE
error = config_cfdata_detach(gpiosim_cfdata);
if (error)
return error;
config_cfattach_detach(gpiosim_cd.cd_name, &gpiosim_ca);
config_cfdriver_detach(&gpiosim_cd);
+#endif
return 0;
case MODULE_CMD_AUTOUNLOAD:
/* no auto-unload */
@@ -293,4 +299,3 @@
return ENOTTY;
}
}
-#endif
Home |
Main Index |
Thread Index |
Old Index