Module Name: src
Committed By: msaitoh
Date: Sat Dec 1 01:51:38 UTC 2018
Modified Files:
src/sys/kern: subr_autoconf.c
src/sys/sys: device.h
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.263 -r1.264 src/sys/kern/subr_autoconf.c
cvs rdiff -u -r1.156 -r1.157 src/sys/sys/device.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/kern/subr_autoconf.c
diff -u src/sys/kern/subr_autoconf.c:1.263 src/sys/kern/subr_autoconf.c:1.264
--- src/sys/kern/subr_autoconf.c:1.263 Tue Sep 18 01:25:09 2018
+++ src/sys/kern/subr_autoconf.c Sat Dec 1 01:51:38 2018
@@ -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 @@ config_interrupts_thread(void *cookie)
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 @@ config_attach_loc(device_t parent, cfdat
(*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 @@ config_interrupts(device_t dev, void (*f
dc->dc_func = func;
TAILQ_INSERT_TAIL(&interrupt_config_queue, dc, dc_queue);
config_pending_incr(dev);
+ dev->dv_flags |= DVF_ATTACH_INPROGRESS;
}
/*
Index: src/sys/sys/device.h
diff -u src/sys/sys/device.h:1.156 src/sys/sys/device.h:1.157
--- src/sys/sys/device.h:1.156 Tue Sep 18 01:25:09 2018
+++ src/sys/sys/device.h Sat Dec 1 01:51:38 2018
@@ -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 @@ struct device {
#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