Module Name:    src
Committed By:   riastradh
Date:           Wed Aug 24 11:19:10 UTC 2022

Modified Files:
        src/sys/sys: device.h device_impl.h

Log Message:
kern: Move various pmf declarations to device_impl.h.

These are used only inside subr_autoconf.c and subr_pmf.c.  Let's
stop having changes to these trigger rebuilds of all device drivers.


To generate a diff of this commit:
cvs rdiff -u -r1.183 -r1.184 src/sys/sys/device.h
cvs rdiff -u -r1.1 -r1.2 src/sys/sys/device_impl.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/sys/device.h
diff -u src/sys/sys/device.h:1.183 src/sys/sys/device.h:1.184
--- src/sys/sys/device.h:1.183	Wed Aug 24 11:18:56 2022
+++ src/sys/sys/device.h	Wed Aug 24 11:19:10 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: device.h,v 1.183 2022/08/24 11:18:56 riastradh Exp $ */
+/* $NetBSD: device.h,v 1.184 2022/08/24 11:19:10 riastradh Exp $ */
 
 /*
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -188,21 +188,11 @@ struct device_compatible_entry {
 
 #define	DEVICE_COMPAT_EOL	{ .compat = NULL }
 
-struct device_lock {
-	int		dvl_nwait;
-	int		dvl_nlock;
-	lwp_t		*dvl_holder;
-	kmutex_t	dvl_mtx;
-	kcondvar_t	dvl_cv;
-};
-
 struct device_suspensor {
 	const device_suspensor_t	*ds_delegator;
 	char				ds_name[32];
 };
 
-#define	DEVICE_SUSPENSORS_MAX	16
-
 struct device_garbage {
 	device_t	*dg_devs;
 	int		dg_ndevs;
@@ -679,19 +669,6 @@ const struct device_compatible_entry *
 		device_compatible_lookup_id(uintptr_t const, uintptr_t const,
 				const struct device_compatible_entry *);
 
-bool		device_pmf_is_registered(device_t);
-bool		device_pmf_is_registered(device_t);
-
-bool		device_pmf_driver_suspend(device_t, const pmf_qual_t *);
-bool		device_pmf_driver_resume(device_t, const pmf_qual_t *);
-bool		device_pmf_driver_shutdown(device_t, int);
-
-void		device_pmf_driver_register(device_t,
-		    bool (*)(device_t, const pmf_qual_t *),
-		    bool (*)(device_t, const pmf_qual_t *),
-		    bool (*)(device_t, int));
-void		device_pmf_driver_deregister(device_t);
-
 bool		device_pmf_driver_child_register(device_t);
 void		device_pmf_driver_set_child_register(device_t,
 		    bool (*)(device_t));
@@ -701,15 +678,6 @@ bool		device_pmf_bus_suspend(device_t, c
 bool		device_pmf_bus_resume(device_t, const pmf_qual_t *);
 bool		device_pmf_bus_shutdown(device_t, int);
 
-device_lock_t	device_getlock(device_t);
-void		device_pmf_unlock(device_t);
-bool		device_pmf_lock(device_t);
-
-bool		device_is_self_suspended(device_t);
-void		device_pmf_self_suspend(device_t, const pmf_qual_t *);
-void		device_pmf_self_resume(device_t, const pmf_qual_t *);
-bool		device_pmf_self_wait(device_t, const pmf_qual_t *);
-
 void		device_pmf_bus_register(device_t, void *,
 		    bool (*)(device_t, const pmf_qual_t *),
 		    bool (*)(device_t, const pmf_qual_t *),
@@ -717,16 +685,6 @@ void		device_pmf_bus_register(device_t, 
 		    void (*)(device_t));
 void		device_pmf_bus_deregister(device_t);
 
-void		*device_pmf_class_private(device_t);
-bool		device_pmf_class_suspend(device_t, const pmf_qual_t *);
-bool		device_pmf_class_resume(device_t, const pmf_qual_t *);
-
-void		device_pmf_class_register(device_t, void *,
-		    bool (*)(device_t, const pmf_qual_t *),
-		    bool (*)(device_t, const pmf_qual_t *),
-		    void (*)(device_t));
-void		device_pmf_class_deregister(device_t);
-
 device_t	shutdown_first(struct shutdown_state *);
 device_t	shutdown_next(struct shutdown_state *);
 

Index: src/sys/sys/device_impl.h
diff -u src/sys/sys/device_impl.h:1.1 src/sys/sys/device_impl.h:1.2
--- src/sys/sys/device_impl.h:1.1	Mon Mar 28 12:38:59 2022
+++ src/sys/sys/device_impl.h	Wed Aug 24 11:19:10 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: device_impl.h,v 1.1 2022/03/28 12:38:59 riastradh Exp $	*/
+/*	$NetBSD: device_impl.h,v 1.2 2022/08/24 11:19:10 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2022 The NetBSD Foundation, Inc.
@@ -111,6 +111,16 @@
 
 #include <sys/device.h>
 
+struct device_lock {
+	int		dvl_nwait;
+	int		dvl_nlock;
+	lwp_t		*dvl_holder;
+	kmutex_t	dvl_mtx;
+	kcondvar_t	dvl_cv;
+};
+
+#define	DEVICE_SUSPENSORS_MAX	16
+
 struct device {
 	devhandle_t	dv_handle;	/* this device's handle;
 					   new device_t's get INVALID */
@@ -180,4 +190,36 @@ struct device {
 #define	DVF_BUS_SUSPENDED	0x0020	/* device bus suspend was called */
 #define	DVF_ATTACH_INPROGRESS	0x0040	/* device attach is in progress */
 
+bool		device_pmf_is_registered(device_t);
+bool		device_pmf_is_registered(device_t);
+
+bool		device_pmf_driver_suspend(device_t, const pmf_qual_t *);
+bool		device_pmf_driver_resume(device_t, const pmf_qual_t *);
+bool		device_pmf_driver_shutdown(device_t, int);
+
+void		device_pmf_driver_register(device_t,
+		    bool (*)(device_t, const pmf_qual_t *),
+		    bool (*)(device_t, const pmf_qual_t *),
+		    bool (*)(device_t, int));
+void		device_pmf_driver_deregister(device_t);
+
+device_lock_t	device_getlock(device_t);
+void		device_pmf_unlock(device_t);
+bool		device_pmf_lock(device_t);
+
+bool		device_is_self_suspended(device_t);
+void		device_pmf_self_suspend(device_t, const pmf_qual_t *);
+void		device_pmf_self_resume(device_t, const pmf_qual_t *);
+bool		device_pmf_self_wait(device_t, const pmf_qual_t *);
+
+void		*device_pmf_class_private(device_t);
+bool		device_pmf_class_suspend(device_t, const pmf_qual_t *);
+bool		device_pmf_class_resume(device_t, const pmf_qual_t *);
+
+void		device_pmf_class_register(device_t, void *,
+		    bool (*)(device_t, const pmf_qual_t *),
+		    bool (*)(device_t, const pmf_qual_t *),
+		    void (*)(device_t));
+void		device_pmf_class_deregister(device_t);
+
 #endif	/* _SYS_DEVICE_IMPL_H_ */

Reply via email to