hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/include/linux/pm_wakeup.h
....@@ -1,22 +1,9 @@
1
+/* SPDX-License-Identifier: GPL-2.0-or-later */
12 /*
23 * pm_wakeup.h - Power management wakeup interface
34 *
45 * Copyright (C) 2008 Alan Stern
56 * Copyright (C) 2010 Rafael J. Wysocki, Novell Inc.
6
- *
7
- * This program is free software; you can redistribute it and/or modify
8
- * it under the terms of the GNU General Public License as published by
9
- * the Free Software Foundation; either version 2 of the License, or
10
- * (at your option) any later version.
11
- *
12
- * This program is distributed in the hope that it will be useful,
13
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
- * GNU General Public License for more details.
16
- *
17
- * You should have received a copy of the GNU General Public License
18
- * along with this program; if not, write to the Free Software
19
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
207 */
218
229 #ifndef _LINUX_PM_WAKEUP_H
....@@ -51,7 +38,7 @@
5138 * @wakeup_count: Number of times the wakeup source might abort suspend.
5239 * @dev: Struct device for sysfs statistics about the wakeup source.
5340 * @active: Status of the wakeup source.
54
- * @has_timeout: The wakeup source has been activated with a timeout.
41
+ * @autosleep_enabled: Autosleep is active, so update @prevent_sleep_time.
5542 */
5643 struct wakeup_source {
5744 const char *name;
....@@ -75,6 +62,11 @@
7562 bool active:1;
7663 bool autosleep_enabled:1;
7764 };
65
+
66
+#define for_each_wakeup_source(ws) \
67
+ for ((ws) = wakeup_sources_walk_start(); \
68
+ (ws); \
69
+ (ws) = wakeup_sources_walk_next((ws)))
7870
7971 #ifdef CONFIG_PM_SLEEP
8072
....@@ -105,6 +97,10 @@
10597 extern struct wakeup_source *wakeup_source_register(struct device *dev,
10698 const char *name);
10799 extern void wakeup_source_unregister(struct wakeup_source *ws);
100
+extern int wakeup_sources_read_lock(void);
101
+extern void wakeup_sources_read_unlock(int idx);
102
+extern struct wakeup_source *wakeup_sources_walk_start(void);
103
+extern struct wakeup_source *wakeup_sources_walk_next(struct wakeup_source *ws);
108104 extern int device_wakeup_enable(struct device *dev);
109105 extern int device_wakeup_disable(struct device *dev);
110106 extern void device_set_wakeup_capable(struct device *dev, bool capable);