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