History

PM / wakeup: Show wakeup sources stats in sysfs

Add an ID and a device pointer to 'struct wakeup_source'. Use them to to expose wakeup sources statistics in sysfs under /sys/class/wakeup/wakeup<ID>/*.

Tri Vo committed 7 years ago

Commit c8377ad1 parent 2434aea11 files · +328 −13Browse files

Showing the changes to include/linux (1 of 11 files). Show all

Unified · Split

include/linux/pm_wakeup.h+8−2
@@ -21,6 +21,7 @@ struct wake_irq; · 20 unmodified lines
2121 * struct wakeup_source - Representation of wakeup sources
2222 *
2323 * @name: Name of the wakeup source
24+ * @id: Wakeup source id
2425 * @entry: Wakeup source list entry
2526 * @lock: Wakeup source lock
2627 * @wakeirq: Optional device specific wakeirq
@@ -35,11 +36,13 @@ struct wake_irq; · 8 unmodified lines
3536 * @relax_count: Number of times the wakeup source was deactivated.
3637 * @expire_count: Number of times the wakeup source's timeout has expired.
3738 * @wakeup_count: Number of times the wakeup source might abort suspend.
39+ * @dev: Struct device for sysfs statistics about the wakeup source.
3840 * @active: Status of the wakeup source.
3941 * @autosleep_enabled: Autosleep is active, so update @prevent_sleep_time.
4042 */
4143 struct wakeup_source {
4244 const char *name;
45+ int id;
4346 struct list_head entry;
4447 spinlock_t lock;
4548 struct wake_irq *wakeirq;
@@ -55,6 +58,7 @@ struct wakeup_source { · 9 unmodified lines
5558 unsigned long relax_count;
5659 unsigned long expire_count;
5760 unsigned long wakeup_count;
61+ struct device *dev;
5862 bool active:1;
5963 bool autosleep_enabled:1;
6064 };
@@ -85,7 +89,8 @@ extern struct wakeup_source *wakeup_source_create(const char *name); · 24 unmodified lines
8589 extern void wakeup_source_destroy(struct wakeup_source *ws);
8690 extern void wakeup_source_add(struct wakeup_source *ws);
8791 extern void wakeup_source_remove(struct wakeup_source *ws);
88−extern struct wakeup_source *wakeup_source_register(const char *name);
92+extern struct wakeup_source *wakeup_source_register(struct device *dev,
93+ const char *name);
8994 extern void wakeup_source_unregister(struct wakeup_source *ws);
9095 extern int device_wakeup_enable(struct device *dev);
9196 extern int device_wakeup_disable(struct device *dev);
@@ -122,7 +127,8 @@ static inline void wakeup_source_add(struct wakeup_source *ws) {} · 30 unmodified lines
122127
123128 static inline void wakeup_source_remove(struct wakeup_source *ws) {}
124129
125−static inline struct wakeup_source *wakeup_source_register(const char *name)
130+static inline struct wakeup_source *wakeup_source_register(struct device *dev,
131+ const char *name)
126132 {
127133 return NULL;
128134 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t