Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Modularize ualea(4).
details: https://anonhg.NetBSD.org/src/rev/5ff3548fb931
branches: trunk
changeset: 353059:5ff3548fb931
user: riastradh <riastradh%NetBSD.org@localhost>
date: Wed Apr 19 00:01:38 2017 +0000
description:
Modularize ualea(4).
Unclear why we have a separate xyz.ioconf for module and XYZ.ioconf
for rump component, but at least xyz_modcmd obviates the need for
xyz_component.c (though evidently the latter could have been replaced
anyway by RUMP_COMPONENT=ioconf in the rump component Makefile).
diffstat:
distrib/sets/lists/modules/mi | 4 +-
sys/dev/usb/ualea.c | 34 +++++++++++++++++++++-
sys/modules/Makefile | 3 +-
sys/modules/ualea/Makefile | 12 +++++++
sys/modules/ualea/ualea.ioconf | 12 +++++++
sys/rump/dev/lib/libualea/Makefile | 4 +-
sys/rump/dev/lib/libualea/ualea_component.c | 44 -----------------------------
7 files changed, 62 insertions(+), 51 deletions(-)
diffs (190 lines):
diff -r 201c35dada1d -r 5ff3548fb931 distrib/sets/lists/modules/mi
--- a/distrib/sets/lists/modules/mi Tue Apr 18 20:02:50 2017 +0000
+++ b/distrib/sets/lists/modules/mi Wed Apr 19 00:01:38 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.108 2017/02/16 08:12:43 knakahara Exp $
+# $NetBSD: mi,v 1.109 2017/04/19 00:01:38 riastradh Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@@ -358,6 +358,8 @@
./@MODULEDIR@/twe/twe.kmod base-obsolete obsolete
./@MODULEDIR@/uatp base-kernel-modules kmod
./@MODULEDIR@/uatp/uatp.kmod base-kernel-modules kmod
+./@MODULEDIR@/ualea base-kernel-modules kmod
+./@MODULEDIR@/ualea/ualea.kmod base-kernel-modules kmod
./@MODULEDIR@/udf base-kernel-modules kmod
./@MODULEDIR@/udf/udf.kmod base-kernel-modules kmod
./@MODULEDIR@/umap base-kernel-modules kmod
diff -r 201c35dada1d -r 5ff3548fb931 sys/dev/usb/ualea.c
--- a/sys/dev/usb/ualea.c Tue Apr 18 20:02:50 2017 +0000
+++ b/sys/dev/usb/ualea.c Wed Apr 19 00:01:38 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ualea.c,v 1.5 2017/04/18 19:09:12 riastradh Exp $ */
+/* $NetBSD: ualea.c,v 1.6 2017/04/19 00:01:38 riastradh Exp $ */
/*-
* Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -30,12 +30,13 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ualea.c,v 1.5 2017/04/18 19:09:12 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ualea.c,v 1.6 2017/04/19 00:01:38 riastradh Exp $");
#include <sys/types.h>
#include <sys/atomic.h>
#include <sys/device_if.h>
#include <sys/kmem.h>
+#include <sys/module.h>
#include <sys/rndpool.h>
#include <sys/rndsource.h>
@@ -230,3 +231,32 @@
sc->sc_inflight = false;
mutex_exit(&sc->sc_lock);
}
+
+MODULE(MODULE_CLASS_DRIVER, ualea, NULL);
+
+#ifdef _MODULE
+#include "ioconf.c"
+#endif
+
+static int
+ualea_modcmd(modcmd_t cmd, void *aux)
+{
+ int error = 0;
+
+ switch (cmd) {
+ case MODULE_CMD_INIT:
+#ifdef _MODULE
+ error = config_init_component(cfdriver_ioconf_ualea,
+ cfattach_ioconf_ualea, cfdata_ioconf_ualea);
+#endif
+ return error;
+ case MODULE_CMD_FINI:
+#ifdef _MODULE
+ error = config_fini_component(cfdriver_ioconf_ualea,
+ cfattach_ioconf_ualea, cfdata_ioconf_ualea);
+#endif
+ return error;
+ default:
+ return ENOTTY;
+ }
+}
diff -r 201c35dada1d -r 5ff3548fb931 sys/modules/Makefile
--- a/sys/modules/Makefile Tue Apr 18 20:02:50 2017 +0000
+++ b/sys/modules/Makefile Wed Apr 19 00:01:38 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.190 2017/03/25 23:17:07 jdolecek Exp $
+# $NetBSD: Makefile,v 1.191 2017/04/19 00:01:38 riastradh Exp $
.include <bsd.own.mk>
@@ -131,6 +131,7 @@
SUBDIR+= swsensor
SUBDIR+= swwdog
SUBDIR+= tmpfs
+SUBDIR+= ualea
SUBDIR+= uatp
SUBDIR+= udf
SUBDIR+= umap
diff -r 201c35dada1d -r 5ff3548fb931 sys/modules/ualea/Makefile
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/modules/ualea/Makefile Wed Apr 19 00:01:38 2017 +0000
@@ -0,0 +1,12 @@
+# $NetBSD: Makefile,v 1.1 2017/04/19 00:01:38 riastradh Exp $
+
+.include "../Makefile.inc"
+
+.PATH: ${S}/dev/usb
+
+KMOD= ualea
+IOCONF= ualea.ioconf
+
+SRCS+= ualea.c
+
+.include <bsd.kmodule.mk>
diff -r 201c35dada1d -r 5ff3548fb931 sys/modules/ualea/ualea.ioconf
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/modules/ualea/ualea.ioconf Wed Apr 19 00:01:38 2017 +0000
@@ -0,0 +1,12 @@
+# $NetBSD: ualea.ioconf,v 1.1 2017/04/19 00:01:38 riastradh Exp $
+#
+
+ioconf ualea
+
+include "conf/files"
+include "dev/usb/files.usb"
+
+pseudo-root uhub*
+
+# Araneus Alea I/II TRNG
+ualea* at uhub? port ? configuration ? interface ?
diff -r 201c35dada1d -r 5ff3548fb931 sys/rump/dev/lib/libualea/Makefile
--- a/sys/rump/dev/lib/libualea/Makefile Tue Apr 18 20:02:50 2017 +0000
+++ b/sys/rump/dev/lib/libualea/Makefile Wed Apr 19 00:01:38 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.1 2017/04/17 08:59:37 riastradh Exp $
+# $NetBSD: Makefile,v 1.2 2017/04/19 00:01:38 riastradh Exp $
#
.PATH: ${.CURDIR}/../../../../dev/usb
@@ -9,8 +9,6 @@
IOCONF= UALEA.ioconf
SRCS+= ualea.c
-SRCS+= ualea_component.c
-
.include <bsd.lib.mk>
.include <bsd.klinks.mk>
diff -r 201c35dada1d -r 5ff3548fb931 sys/rump/dev/lib/libualea/ualea_component.c
--- a/sys/rump/dev/lib/libualea/ualea_component.c Tue Apr 18 20:02:50 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/* $NetBSD: ualea_component.c,v 1.1 2017/04/17 08:59:37 riastradh Exp $ */
-
-/*-
- * Copyright (c) 2017 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Taylor R. Campbell.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ualea_component.c,v 1.1 2017/04/17 08:59:37 riastradh Exp $");
-
-#include "ioconf.c"
-
-#include <rump-sys/kern.h>
-
-RUMP_COMPONENT(RUMP_COMPONENT_DEV)
-{
-
- config_init_component(cfdriver_ioconf_ualea,
- cfattach_ioconf_ualea, cfdata_ioconf_ualea);
-}
Home |
Main Index |
Thread Index |
Old Index