Source-Changes-HG archive

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

[src/netbsd-8]: src/sys/dev Pull up following revision(s) (requested by pgoye...



details:   https://anonhg.NetBSD.org/src/rev/e7f49b92dfd3
branches:  netbsd-8
changeset: 850695:e7f49b92dfd3
user:      snj <snj%NetBSD.org@localhost>
date:      Mon Jun 05 08:13:05 2017 +0000

description:
Pull up following revision(s) (requested by pgoyette in ticket #6):
        sys/dev/hdaudio/hdaudio.c: revision 1.5
        sys/dev/pci/hdaudio_pci.c: revision 1.8
Move the hdaudio_cd out of the hdaudio_pci module and into the main
hdaudio module.  Rearrange the inter-module dependencies accordingly.
Should resolve (my) PR kern/49836

diffstat:

 sys/dev/hdaudio/hdaudio.c |  39 ++++++++++++++++++++++++++++++++-------
 sys/dev/pci/hdaudio_pci.c |  24 +++++++++++++++++++-----
 2 files changed, 51 insertions(+), 12 deletions(-)

diffs (136 lines):

diff -r c22530b7294b -r e7f49b92dfd3 sys/dev/hdaudio/hdaudio.c
--- a/sys/dev/hdaudio/hdaudio.c Mon Jun 05 08:10:24 2017 +0000
+++ b/sys/dev/hdaudio/hdaudio.c Mon Jun 05 08:13:05 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: hdaudio.c,v 1.4 2015/12/23 12:45:06 jmcneill Exp $ */
+/* $NetBSD: hdaudio.c,v 1.4.10.1 2017/06/05 08:13:05 snj Exp $ */
 
 /*
  * Copyright (c) 2009 Precedence Technologies Ltd <support%precedence.co.uk@localhost>
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hdaudio.c,v 1.4 2015/12/23 12:45:06 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hdaudio.c,v 1.4.10.1 2017/06/05 08:13:05 snj Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -1602,7 +1602,18 @@
        return err;
 }
 
-MODULE(MODULE_CLASS_DRIVER, hdaudio, NULL);
+MODULE(MODULE_CLASS_DRIVER, hdaudio, "audio");
+#ifdef _MODULE
+static const struct cfiattrdata hdaudiobuscf_iattrdata = {
+        "hdaudiobus", 1, {
+                { "nid", "-1", -1 },
+        }
+};
+static const struct cfiattrdata * const hdaudio_attrs[] = {
+       &hdaudiobuscf_iattrdata, NULL
+};
+CFDRIVER_DECL(hdaudio, DV_AUDIODEV, hdaudio_attrs);
+#endif
 
 static int
 hdaudio_modcmd(modcmd_t cmd, void *opaque)
@@ -1617,16 +1628,30 @@
 #ifdef _MODULE
                error = devsw_attach("hdaudio", NULL, &bmaj,
                    &hdaudio_cdevsw, &cmaj);
+               if (error)
+                       break;
+               error = config_cfdriver_attach(&hdaudio_cd);
+               if (error)
+                       devsw_detach(NULL, &hdaudio_cdevsw);
 #endif
-               return error;
+               break;
        case MODULE_CMD_FINI:
 #ifdef _MODULE
-               devsw_detach(NULL, &hdaudio_cdevsw);
+               error = config_cfdriver_detach(&hdaudio_cd);
+               if (error)
+                       break;
+               error = devsw_detach(NULL, &hdaudio_cdevsw);
+               if (error) {
+                       config_cfdriver_attach(&hdaudio_cd);
+                       break;
+               }
 #endif
-               return 0;
+               break;
        default:
-               return ENOTTY;
+               error = ENOTTY;
+               break;
        }
+       return error;
 }
 
 DEV_VERBOSE_DEFINE(hdaudio);
diff -r c22530b7294b -r e7f49b92dfd3 sys/dev/pci/hdaudio_pci.c
--- a/sys/dev/pci/hdaudio_pci.c Mon Jun 05 08:10:24 2017 +0000
+++ b/sys/dev/pci/hdaudio_pci.c Mon Jun 05 08:13:05 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: hdaudio_pci.c,v 1.7 2017/04/27 10:01:54 msaitoh Exp $ */
+/* $NetBSD: hdaudio_pci.c,v 1.7.2.1 2017/06/05 08:13:05 snj Exp $ */
 
 /*
  * Copyright (c) 2009 Precedence Technologies Ltd <support%precedence.co.uk@localhost>
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hdaudio_pci.c,v 1.7 2017/04/27 10:01:54 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hdaudio_pci.c,v 1.7.2.1 2017/06/05 08:13:05 snj Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -269,27 +269,41 @@
        return hdaudio_resume(&sc->sc_hdaudio);
 }
 
-MODULE(MODULE_CLASS_DRIVER, hdaudio_pci, "hdaudio");
+MODULE(MODULE_CLASS_DRIVER, hdaudio_pci, "pci,hdaudio,audio");
 
 #ifdef _MODULE
+/*
+ * XXX Don't allow ioconf.c to redefine the "struct cfdriver hdaudio_cd"
+ * XXX it will be defined in the common hdaudio module
+ */
+
+#undef CFDRIVER_DECL
+#define CFDRIVER_DECL(name, class, attr) /* nothing */
 #include "ioconf.c"
 #endif
 
 static int
 hdaudio_pci_modcmd(modcmd_t cmd, void *opaque)
 {
+#ifdef _MODULE
+       /*
+        * We ignore the cfdriver_vec[] that ioconf provides, since
+        * the cfdrivers are attached already.
+        */
+       static struct cfdriver * const no_cfdriver_vec[] = { NULL };
+#endif
        int error = 0;
 
        switch (cmd) {
        case MODULE_CMD_INIT:
 #ifdef _MODULE
-               error = config_init_component(cfdriver_ioconf_hdaudio_pci,
+               error = config_init_component(no_cfdriver_vec,
                    cfattach_ioconf_hdaudio_pci, cfdata_ioconf_hdaudio_pci);
 #endif
                return error;
        case MODULE_CMD_FINI:
 #ifdef _MODULE
-               error = config_fini_component(cfdriver_ioconf_hdaudio_pci,
+               error = config_fini_component(no_cfdriver_vec,
                    cfattach_ioconf_hdaudio_pci, cfdata_ioconf_hdaudio_pci);
 #endif
                return error;



Home | Main Index | Thread Index | Old Index