Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Convert the homegrown module declarations to use ioconf.
details: https://anonhg.NetBSD.org/src/rev/ba46bd13a271
branches: trunk
changeset: 762122:ba46bd13a271
user: jruoho <jruoho%NetBSD.org@localhost>
date: Wed Feb 16 08:19:56 2011 +0000
description:
Convert the homegrown module declarations to use ioconf.
diffstat:
sys/dev/acpi/wmi/wmi_acpi.c | 80 +++++++++----------------------------
sys/dev/acpi/wmi/wmi_dell.c | 80 +++++++++----------------------------
sys/dev/acpi/wmi/wmi_hp.c | 80 +++++++++----------------------------
sys/dev/acpi/wmi/wmi_msi.c | 80 +++++++++----------------------------
sys/modules/acpiwmi/Makefile | 3 +-
sys/modules/acpiwmi/acpiwmi.ioconf | 10 ++++
sys/modules/wmidell/Makefile | 3 +-
sys/modules/wmidell/wmidell.ioconf | 10 ++++
sys/modules/wmihp/Makefile | 3 +-
sys/modules/wmihp/wmihp.ioconf | 10 ++++
sys/modules/wmimsi/Makefile | 3 +-
sys/modules/wmimsi/wmimsi.ioconf | 10 ++++
12 files changed, 128 insertions(+), 244 deletions(-)
diffs (truncated from 580 to 300 lines):
diff -r a9eed34f2447 -r ba46bd13a271 sys/dev/acpi/wmi/wmi_acpi.c
--- a/sys/dev/acpi/wmi/wmi_acpi.c Wed Feb 16 08:01:52 2011 +0000
+++ b/sys/dev/acpi/wmi/wmi_acpi.c Wed Feb 16 08:19:56 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: wmi_acpi.c,v 1.11 2010/10/28 15:55:04 jruoho Exp $ */
+/* $NetBSD: wmi_acpi.c,v 1.12 2011/02/16 08:19:56 jruoho Exp $ */
/*-
* Copyright (c) 2009, 2010 Jukka Ruohonen <jruohonen%iki.fi@localhost>
@@ -27,7 +27,7 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wmi_acpi.c,v 1.11 2010/10/28 15:55:04 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wmi_acpi.c,v 1.12 2011/02/16 08:19:56 jruoho Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -800,78 +800,38 @@
return AcpiEvaluateObject(sc->sc_node->ad_handle, path, &arg, obuf);
}
-#ifdef _MODULE
-
MODULE(MODULE_CLASS_DRIVER, acpiwmi, NULL);
-CFDRIVER_DECL(acpiwmi, DV_DULL, NULL);
-
-static int acpiwmiloc[] = { -1 };
-extern struct cfattach acpiwmi_ca;
-
-static struct cfparent acpiparent = {
- "acpinodebus", NULL, DVUNIT_ANY
-};
-static struct cfdata acpiwmi_cfdata[] = {
- {
- .cf_name = "acpiwmi",
- .cf_atname = "acpiwmi",
- .cf_unit = 0,
- .cf_fstate = FSTATE_STAR,
- .cf_loc = acpiwmiloc,
- .cf_flags = 0,
- .cf_pspec = &acpiparent,
- },
-
- { NULL, NULL, 0, 0, NULL, 0, NULL }
-};
+#ifdef _MODULE
+#include "ioconf.c"
+#endif
static int
-acpiwmi_modcmd(modcmd_t cmd, void *opaque)
+acpiwmi_modcmd(modcmd_t cmd, void *aux)
{
- int err;
+ int rv = 0;
switch (cmd) {
case MODULE_CMD_INIT:
- err = config_cfdriver_attach(&acpiwmi_cd);
-
- if (err != 0)
- return err;
-
- err = config_cfattach_attach("acpiwmi", &acpiwmi_ca);
-
- if (err != 0) {
- config_cfdriver_detach(&acpiwmi_cd);
- return err;
- }
-
- err = config_cfdata_attach(acpiwmi_cfdata, 1);
-
- if (err != 0) {
- config_cfattach_detach("acpiwmi", &acpiwmi_ca);
- config_cfdriver_detach(&acpiwmi_cd);
- return err;
- }
-
- return 0;
+#ifdef _MODULE
+ rv = config_init_component(cfdriver_ioconf_acpiwmi,
+ cfattach_ioconf_acpiwmi, cfdata_ioconf_acpiwmi);
+#endif
+ break;
case MODULE_CMD_FINI:
- err = config_cfdata_detach(acpiwmi_cfdata);
-
- if (err != 0)
- return err;
-
- config_cfattach_detach("acpiwmi", &acpiwmi_ca);
- config_cfdriver_detach(&acpiwmi_cd);
-
- return 0;
+#ifdef _MODULE
+ rv = config_fini_component(cfdriver_ioconf_acpiwmi,
+ cfattach_ioconf_acpiwmi, cfdata_ioconf_acpiwmi);
+#endif
+ break;
default:
- return ENOTTY;
+ rv = ENOTTY;
}
+
+ return rv;
}
-
-#endif /* _MODULE */
diff -r a9eed34f2447 -r ba46bd13a271 sys/dev/acpi/wmi/wmi_dell.c
--- a/sys/dev/acpi/wmi/wmi_dell.c Wed Feb 16 08:01:52 2011 +0000
+++ b/sys/dev/acpi/wmi/wmi_dell.c Wed Feb 16 08:19:56 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: wmi_dell.c,v 1.6 2010/10/25 07:53:22 jruoho Exp $ */
+/* $NetBSD: wmi_dell.c,v 1.7 2011/02/16 08:19:56 jruoho Exp $ */
/*-
* Copyright (c) 2009, 2010 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wmi_dell.c,v 1.6 2010/10/25 07:53:22 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wmi_dell.c,v 1.7 2011/02/16 08:19:56 jruoho Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -233,78 +233,38 @@
"event 0x%02X: %s\n", evt, AcpiFormatException(rv));
}
-#ifdef _MODULE
-
MODULE(MODULE_CLASS_DRIVER, wmidell, NULL);
-CFDRIVER_DECL(wmidell, DV_DULL, NULL);
-
-static int wmidellloc[] = { -1 };
-extern struct cfattach wmidell_ca;
-
-static struct cfparent wmiparent = {
- "acpiwmibus", NULL, DVUNIT_ANY
-};
-static struct cfdata wmidell_cfdata[] = {
- {
- .cf_name = "wmidell",
- .cf_atname = "wmidell",
- .cf_unit = 0,
- .cf_fstate = FSTATE_STAR,
- .cf_loc = wmidellloc,
- .cf_flags = 0,
- .cf_pspec = &wmiparent,
- },
-
- { NULL, NULL, 0, 0, NULL, 0, NULL }
-};
+#ifdef _MODULE
+#include "ioconf.c"
+#endif
static int
-wmidell_modcmd(modcmd_t cmd, void *opaque)
+wmidell_modcmd(modcmd_t cmd, void *aux)
{
- int err;
+ int rv = 0;
switch (cmd) {
case MODULE_CMD_INIT:
- err = config_cfdriver_attach(&wmidell_cd);
-
- if (err != 0)
- return err;
-
- err = config_cfattach_attach("wmidell", &wmidell_ca);
-
- if (err != 0) {
- config_cfdriver_detach(&wmidell_cd);
- return err;
- }
-
- err = config_cfdata_attach(wmidell_cfdata, 1);
-
- if (err != 0) {
- config_cfattach_detach("wmidell", &wmidell_ca);
- config_cfdriver_detach(&wmidell_cd);
- return err;
- }
-
- return 0;
+#ifdef _MODULE
+ rv = config_init_component(cfdriver_ioconf_wmidell,
+ cfattach_ioconf_wmidell, cfdata_ioconf_wmidell);
+#endif
+ break;
case MODULE_CMD_FINI:
- err = config_cfdata_detach(wmidell_cfdata);
-
- if (err != 0)
- return err;
-
- config_cfattach_detach("wmidell", &wmidell_ca);
- config_cfdriver_detach(&wmidell_cd);
-
- return 0;
+#ifdef _MODULE
+ rv = config_fini_component(cfdriver_ioconf_wmidell,
+ cfattach_ioconf_wmidell, cfdata_ioconf_wmidell);
+#endif
+ break;
default:
- return ENOTTY;
+ rv = ENOTTY;
}
+
+ return rv;
}
-
-#endif /* _MODULE */
diff -r a9eed34f2447 -r ba46bd13a271 sys/dev/acpi/wmi/wmi_hp.c
--- a/sys/dev/acpi/wmi/wmi_hp.c Wed Feb 16 08:01:52 2011 +0000
+++ b/sys/dev/acpi/wmi/wmi_hp.c Wed Feb 16 08:19:56 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: wmi_hp.c,v 1.4 2010/10/25 07:53:22 jruoho Exp $ */
+/* $NetBSD: wmi_hp.c,v 1.5 2011/02/16 08:19:56 jruoho Exp $ */
/*-
* Copyright (c) 2009, 2010 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wmi_hp.c,v 1.4 2010/10/25 07:53:22 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wmi_hp.c,v 1.5 2011/02/16 08:19:56 jruoho Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -531,78 +531,38 @@
}
}
-#ifdef _MODULE
-
MODULE(MODULE_CLASS_DRIVER, wmihp, NULL);
-CFDRIVER_DECL(wmihp, DV_DULL, NULL);
-
-static int wmihploc[] = { -1 };
-extern struct cfattach wmihp_ca;
-
-static struct cfparent wmiparent = {
- "acpiwmibus", NULL, DVUNIT_ANY
-};
-static struct cfdata wmihp_cfdata[] = {
- {
- .cf_name = "wmihp",
- .cf_atname = "wmihp",
- .cf_unit = 0,
- .cf_fstate = FSTATE_STAR,
- .cf_loc = wmihploc,
- .cf_flags = 0,
- .cf_pspec = &wmiparent,
- },
-
- { NULL, NULL, 0, 0, NULL, 0, NULL }
-};
+#ifdef _MODULE
+#include "ioconf.c"
+#endif
static int
-wmihp_modcmd(modcmd_t cmd, void *opaque)
+wmihp_modcmd(modcmd_t cmd, void *aux)
{
- int err;
+ int rv = 0;
switch (cmd) {
case MODULE_CMD_INIT:
- err = config_cfdriver_attach(&wmihp_cd);
-
- if (err != 0)
- return err;
-
- err = config_cfattach_attach("wmihp", &wmihp_ca);
-
- if (err != 0) {
Home |
Main Index |
Thread Index |
Old Index