Source-Changes-HG archive

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

[src/trunk]: src/sys Add new dv_flags value DVF_ATTACH_INPROGRESS. Currenty, ...



details:   https://anonhg.NetBSD.org/src/rev/1b8b41d0fe33
branches:  trunk
changeset: 446339:1b8b41d0fe33
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Sat Dec 01 01:51:38 2018 +0000

description:
Add new dv_flags value DVF_ATTACH_INPROGRESS. Currenty, this flags is used
only for checking the registration of pmf.

 This flag should be set when an attach function(ca_attach) doesn't complete
the whole attach work when the function returned. config_interrupts() set it.
It's also required for device drivers who do a part of the attach work in their
own kthread to set it.

diffstat:

 sys/kern/subr_autoconf.c |  17 ++++++++++++-----
 sys/sys/device.h         |   3 ++-
 2 files changed, 14 insertions(+), 6 deletions(-)

diffs (69 lines):

diff -r 12b6a18cd902 -r 1b8b41d0fe33 sys/kern/subr_autoconf.c
--- a/sys/kern/subr_autoconf.c  Sat Dec 01 01:23:24 2018 +0000
+++ b/sys/kern/subr_autoconf.c  Sat Dec 01 01:51:38 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_autoconf.c,v 1.263 2018/09/18 01:25:09 mrg Exp $ */
+/* $NetBSD: subr_autoconf.c,v 1.264 2018/12/01 01:51:38 msaitoh Exp $ */
 
 /*
  * Copyright (c) 1996, 2000 Christopher G. Demetriou
@@ -77,7 +77,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.263 2018/09/18 01:25:09 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.264 2018/12/01 01:51:38 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -446,6 +446,11 @@
        while ((dc = TAILQ_FIRST(&interrupt_config_queue)) != NULL) {
                TAILQ_REMOVE(&interrupt_config_queue, dc, dc_queue);
                (*dc->dc_func)(dc->dc_dev);
+               dc->dc_dev->dv_flags &= ~DVF_ATTACH_INPROGRESS;
+               if (!device_pmf_is_registered(dc->dc_dev))
+                       aprint_debug_dev(dc->dc_dev,
+                           "WARNING: power management not supported\n",
+                           device_xname(dc->dc_dev));
                config_pending_decr(dc->dc_dev);
                kmem_free(dc, sizeof(*dc));
        }
@@ -1597,9 +1602,10 @@
 
        (*dev->dv_cfattach->ca_attach)(parent, dev, aux);
 
-       if (!device_pmf_is_registered(dev))
-               aprint_debug_dev(dev, "WARNING: power management not "
-                   "supported\n");
+       if (((dev->dv_flags & DVF_ATTACH_INPROGRESS) == 0)
+           && !device_pmf_is_registered(dev))
+               aprint_debug_dev(dev,
+                   "WARNING: power management not supported\n");
 
        config_process_deferred(&deferred_config_queue, dev);
 
@@ -1996,6 +2002,7 @@
        dc->dc_func = func;
        TAILQ_INSERT_TAIL(&interrupt_config_queue, dc, dc_queue);
        config_pending_incr(dev);
+       dev->dv_flags |= DVF_ATTACH_INPROGRESS;
 }
 
 /*
diff -r 12b6a18cd902 -r 1b8b41d0fe33 sys/sys/device.h
--- a/sys/sys/device.h  Sat Dec 01 01:23:24 2018 +0000
+++ b/sys/sys/device.h  Sat Dec 01 01:51:38 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: device.h,v 1.156 2018/09/18 01:25:09 mrg Exp $ */
+/* $NetBSD: device.h,v 1.157 2018/12/01 01:51:38 msaitoh Exp $ */
 
 /*
  * Copyright (c) 1996, 2000 Christopher G. Demetriou
@@ -202,6 +202,7 @@
 #define        DVF_CLASS_SUSPENDED     0x0008  /* device class suspend was called */
 #define        DVF_DRIVER_SUSPENDED    0x0010  /* device driver suspend was called */
 #define        DVF_BUS_SUSPENDED       0x0020  /* device bus suspend was called */
+#define        DVF_ATTACH_INPROGRESS   0x0040  /* device attach is in progress */
 #define        DVF_DETACH_SHUTDOWN     0x0080  /* device detaches safely at shutdown */
 
 #ifdef _KERNEL



Home | Main Index | Thread Index | Old Index