Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev Move cgd selftest from module init to cgdattach.



details:   https://anonhg.NetBSD.org/src/rev/b5de3dd79dca
branches:  trunk
changeset: 934536:b5de3dd79dca
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sat Jun 13 18:42:22 2020 +0000

description:
Move cgd selftest from module init to cgdattach.

This defers it until considerably later at boot, after cpu_attach has
run, which will be needed in order to make AES-NI work.

diffstat:

 sys/dev/cgd.c |  11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diffs (53 lines):

diff -r b23152e8b8cb -r b5de3dd79dca sys/dev/cgd.c
--- a/sys/dev/cgd.c     Sat Jun 13 18:40:44 2020 +0000
+++ b/sys/dev/cgd.c     Sat Jun 13 18:42:22 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cgd.c,v 1.130 2020/06/13 18:40:44 riastradh Exp $ */
+/* $NetBSD: cgd.c,v 1.131 2020/06/13 18:42:22 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.130 2020/06/13 18:40:44 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.131 2020/06/13 18:42:22 riastradh Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -389,6 +389,8 @@
 static void    cgd_cipher(struct cgd_softc *, void *, void *,
                           size_t, daddr_t, size_t, int);
 
+static void    cgd_selftest(void);
+
 static const struct dkdriver cgddkdriver = {
         .d_minphys  = minphys,
         .d_open = cgdopen,
@@ -534,6 +536,8 @@
                aprint_error("%s: unable to register cfattach\n",
                    cgd_cd.cd_name);
 #endif
+
+       cgd_selftest();
 }
 
 static struct cgd_softc *
@@ -1598,7 +1602,7 @@
 #endif
 
 static void
-selftest(void)
+cgd_selftest(void)
 {
        struct cgd_softc sc;
        void *buf;
@@ -1673,7 +1677,6 @@
 
        switch (cmd) {
        case MODULE_CMD_INIT:
-               selftest();
 #ifdef _MODULE
                mutex_init(&cgd_spawning_mtx, MUTEX_DEFAULT, IPL_NONE);
                cv_init(&cgd_spawning_cv, "cgspwn");



Home | Main Index | Thread Index | Old Index