Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-8]: src/sys/dev/pad Pull up following revision(s) (requested by p...
details: https://anonhg.NetBSD.org/src/rev/6e9811c5ca17
branches: netbsd-8
changeset: 434514:6e9811c5ca17
user: snj <snj%NetBSD.org@localhost>
date: Sat Dec 23 18:48:41 2017 +0000
description:
Pull up following revision(s) (requested by pgoyette in ticket #450):
sys/dev/pad/pad.c: revision 1.44
Rework so that module infrastructure is provided even when the module
is built-in to the kernel.
diffstat:
sys/dev/pad/pad.c | 42 +++++++++++++++++++++++-------------------
1 files changed, 23 insertions(+), 19 deletions(-)
diffs (118 lines):
diff -r 26480f02cd25 -r 6e9811c5ca17 sys/dev/pad/pad.c
--- a/sys/dev/pad/pad.c Fri Dec 22 06:06:21 2017 +0000
+++ b/sys/dev/pad/pad.c Sat Dec 23 18:48:41 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pad.c,v 1.32.2.1 2017/06/10 06:05:47 snj Exp $ */
+/* $NetBSD: pad.c,v 1.32.2.2 2017/12/23 18:48:41 snj Exp $ */
/*-
* Copyright (c) 2007 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.32.2.1 2017/06/10 06:05:47 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.32.2.2 2017/12/23 18:48:41 snj Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -719,9 +719,9 @@
kmem_free(this, sizeof(auvolconv_filter_t));
}
-#ifdef _MODULE
+MODULE(MODULE_CLASS_DRIVER, pad, "audio");
-MODULE(MODULE_CLASS_DRIVER, pad, "audio");
+#ifdef _MODULE
static const struct cfiattrdata audiobuscf_iattrdata = {
"audiobus", 0, { { NULL, NULL, 0 }, }
@@ -746,18 +746,22 @@
},
{ NULL, NULL, 0, 0, NULL, 0, NULL }
};
+#endif
static int
pad_modcmd(modcmd_t cmd, void *arg)
{
+#ifdef _MODULE
devmajor_t cmajor = NODEVMAJOR, bmajor = NODEVMAJOR;
- int error;
+#endif
+ int error = 0;
switch (cmd) {
case MODULE_CMD_INIT:
+#ifdef _MODULE
error = config_cfdriver_attach(&pad_cd);
if (error) {
- return error;
+ break;
}
error = config_cfattach_attach(pad_cd.cd_name, &pad_ca);
@@ -766,7 +770,7 @@
aprint_error("%s: unable to register cfattach\n",
pad_cd.cd_name);
- return error;
+ break;
}
error = config_cfdata_attach(pad_cfdata, 1);
@@ -776,41 +780,41 @@
aprint_error("%s: unable to register cfdata\n",
pad_cd.cd_name);
- return error;
+ break;
}
error = devsw_attach(pad_cd.cd_name, NULL, &bmajor,
&pad_cdevsw, &cmajor);
if (error) {
- error = config_cfdata_detach(pad_cfdata);
- if (error) {
- return error;
- }
+ config_cfdata_detach(pad_cfdata);
config_cfattach_detach(pad_cd.cd_name, &pad_ca);
config_cfdriver_detach(&pad_cd);
aprint_error("%s: unable to register devsw\n",
pad_cd.cd_name);
- return error;
+ break;
}
(void)config_attach_pseudo(pad_cfdata);
+#endif
- return 0;
+ break;
case MODULE_CMD_FINI:
+#ifdef _MODULE
error = config_cfdata_detach(pad_cfdata);
if (error) {
- return error;
+ break;
}
config_cfattach_detach(pad_cd.cd_name, &pad_ca);
config_cfdriver_detach(&pad_cd);
devsw_detach(NULL, &pad_cdevsw);
+#endif
- return 0;
+ break;
default:
- return ENOTTY;
+ error = ENOTTY;
}
+
+ return error;
}
-
-#endif
Home |
Main Index |
Thread Index |
Old Index