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
21 * struct wakeup_source - Representation of wakeup sources21 * struct wakeup_source - Representation of wakeup sources
22 *22 *
23 * @name: Name of the wakeup source23 * @name: Name of the wakeup source
24 * @id: Wakeup source id
24 * @entry: Wakeup source list entry25 * @entry: Wakeup source list entry
25 * @lock: Wakeup source lock26 * @lock: Wakeup source lock
26 * @wakeirq: Optional device specific wakeirq27 * @wakeirq: Optional device specific wakeirq
@@ -35,11 +36,13 @@ struct wake_irq; · 8 unmodified lines
35 * @relax_count: Number of times the wakeup source was deactivated.36 * @relax_count: Number of times the wakeup source was deactivated.
36 * @expire_count: Number of times the wakeup source's timeout has expired.37 * @expire_count: Number of times the wakeup source's timeout has expired.
37 * @wakeup_count: Number of times the wakeup source might abort suspend.38 * @wakeup_count: Number of times the wakeup source might abort suspend.
39 * @dev: Struct device for sysfs statistics about the wakeup source.
38 * @active: Status of the wakeup source.40 * @active: Status of the wakeup source.
39 * @autosleep_enabled: Autosleep is active, so update @prevent_sleep_time.41 * @autosleep_enabled: Autosleep is active, so update @prevent_sleep_time.
40 */42 */
41struct wakeup_source {43struct wakeup_source {
42 const char *name;44 const char *name;
45 int id;
43 struct list_head entry;46 struct list_head entry;
44 spinlock_t lock;47 spinlock_t lock;
45 struct wake_irq *wakeirq;48 struct wake_irq *wakeirq;
@@ -55,6 +58,7 @@ struct wakeup_source { · 9 unmodified lines
55 unsigned long relax_count;58 unsigned long relax_count;
56 unsigned long expire_count;59 unsigned long expire_count;
57 unsigned long wakeup_count;60 unsigned long wakeup_count;
61 struct device *dev;
58 bool active:1;62 bool active:1;
59 bool autosleep_enabled:1;63 bool autosleep_enabled:1;
60};64};
@@ -85,7 +89,8 @@ extern struct wakeup_source *wakeup_source_create(const char *name); · 24 unmodified lines
85extern void wakeup_source_destroy(struct wakeup_source *ws);89extern void wakeup_source_destroy(struct wakeup_source *ws);
86extern void wakeup_source_add(struct wakeup_source *ws);90extern void wakeup_source_add(struct wakeup_source *ws);
87extern void wakeup_source_remove(struct wakeup_source *ws);91extern void wakeup_source_remove(struct wakeup_source *ws);
88extern struct wakeup_source *wakeup_source_register(const char *name);92extern struct wakeup_source *wakeup_source_register(struct device *dev,
93 const char *name);
89extern void wakeup_source_unregister(struct wakeup_source *ws);94extern void wakeup_source_unregister(struct wakeup_source *ws);
90extern int device_wakeup_enable(struct device *dev);95extern int device_wakeup_enable(struct device *dev);
91extern int device_wakeup_disable(struct device *dev);96extern int device_wakeup_disable(struct device *dev);
@@ -122,7 +127,8 @@ static inline void wakeup_source_add(struct wakeup_source *ws) {} · 30 unmodified lines
122 127
123static inline void wakeup_source_remove(struct wakeup_source *ws) {}128static inline void wakeup_source_remove(struct wakeup_source *ws) {}
124 129
125static inline struct wakeup_source *wakeup_source_register(const char *name)130static inline struct wakeup_source *wakeup_source_register(struct device *dev,
131 const char *name)
126{132{
127 return NULL;133 return NULL;
128}134}

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