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 | * struct wakeup_source - Representation of wakeup sources | 21 | * struct wakeup_source - Representation of wakeup sources |
| 22 | * | 22 | * |
| 23 | * @name: Name of the wakeup source | 23 | * @name: Name of the wakeup source |
| 24 | * @id: Wakeup source id | ||
| 24 | * @entry: Wakeup source list entry | 25 | * @entry: Wakeup source list entry |
| 25 | * @lock: Wakeup source lock | 26 | * @lock: Wakeup source lock |
| 26 | * @wakeirq: Optional device specific wakeirq | 27 | * @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 | */ |
| 41 | struct wakeup_source { | 43 | struct 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 | |||
| 85 | extern void wakeup_source_destroy(struct wakeup_source *ws); | 89 | extern void wakeup_source_destroy(struct wakeup_source *ws); |
| 86 | extern void wakeup_source_add(struct wakeup_source *ws); | 90 | extern void wakeup_source_add(struct wakeup_source *ws); |
| 87 | extern void wakeup_source_remove(struct wakeup_source *ws); | 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 | extern void wakeup_source_unregister(struct wakeup_source *ws); | 94 | extern void wakeup_source_unregister(struct wakeup_source *ws); |
| 90 | extern int device_wakeup_enable(struct device *dev); | 95 | extern int device_wakeup_enable(struct device *dev); |
| 91 | extern int device_wakeup_disable(struct device *dev); | 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 | static inline void wakeup_source_remove(struct wakeup_source *ws) {} | 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 | return NULL; | 133 | return NULL; |
| 128 | } | 134 | } |