Lines Matching refs:wl
37 struct wakelock *wl; in pm_show_wakelocks() local
44 wl = rb_entry(node, struct wakelock, node); in pm_show_wakelocks()
45 if (wl->ws.active == show_active) in pm_show_wakelocks()
46 str += scnprintf(str, end - str, "%s ", wl->name); in pm_show_wakelocks()
87 static inline void wakelocks_lru_add(struct wakelock *wl) in wakelocks_lru_add() argument
89 list_add(&wl->lru, &wakelocks_lru_list); in wakelocks_lru_add()
92 static inline void wakelocks_lru_most_recent(struct wakelock *wl) in wakelocks_lru_most_recent() argument
94 list_move(&wl->lru, &wakelocks_lru_list); in wakelocks_lru_most_recent()
99 struct wakelock *wl, *aux; in wakelocks_gc() local
106 list_for_each_entry_safe_reverse(wl, aux, &wakelocks_lru_list, lru) { in wakelocks_gc()
110 spin_lock_irq(&wl->ws.lock); in wakelocks_gc()
111 idle_time_ns = ktime_to_ns(ktime_sub(now, wl->ws.last_time)); in wakelocks_gc()
112 active = wl->ws.active; in wakelocks_gc()
113 spin_unlock_irq(&wl->ws.lock); in wakelocks_gc()
119 wakeup_source_remove(&wl->ws); in wakelocks_gc()
120 rb_erase(&wl->node, &wakelocks_tree); in wakelocks_gc()
121 list_del(&wl->lru); in wakelocks_gc()
122 kfree(wl->name); in wakelocks_gc()
123 kfree(wl); in wakelocks_gc()
130 static inline void wakelocks_lru_add(struct wakelock *wl) {} in wakelocks_lru_add() argument
131 static inline void wakelocks_lru_most_recent(struct wakelock *wl) {} in wakelocks_lru_most_recent() argument
140 struct wakelock *wl; in wakelock_lookup_add() local
146 wl = rb_entry(*node, struct wakelock, node); in wakelock_lookup_add()
147 diff = strncmp(name, wl->name, len); in wakelock_lookup_add()
149 if (wl->name[len]) in wakelock_lookup_add()
152 return wl; in wakelock_lookup_add()
166 wl = kzalloc(sizeof(*wl), GFP_KERNEL); in wakelock_lookup_add()
167 if (!wl) in wakelock_lookup_add()
170 wl->name = kstrndup(name, len, GFP_KERNEL); in wakelock_lookup_add()
171 if (!wl->name) { in wakelock_lookup_add()
172 kfree(wl); in wakelock_lookup_add()
175 wl->ws.name = wl->name; in wakelock_lookup_add()
176 wakeup_source_add(&wl->ws); in wakelock_lookup_add()
177 rb_link_node(&wl->node, parent, node); in wakelock_lookup_add()
178 rb_insert_color(&wl->node, &wakelocks_tree); in wakelock_lookup_add()
179 wakelocks_lru_add(wl); in wakelock_lookup_add()
181 return wl; in wakelock_lookup_add()
187 struct wakelock *wl; in pm_wake_lock() local
211 wl = wakelock_lookup_add(buf, len, true); in pm_wake_lock()
212 if (IS_ERR(wl)) { in pm_wake_lock()
213 ret = PTR_ERR(wl); in pm_wake_lock()
220 __pm_wakeup_event(&wl->ws, timeout_ms); in pm_wake_lock()
222 __pm_stay_awake(&wl->ws); in pm_wake_lock()
225 wakelocks_lru_most_recent(wl); in pm_wake_lock()
234 struct wakelock *wl; in pm_wake_unlock() local
253 wl = wakelock_lookup_add(buf, len, false); in pm_wake_unlock()
254 if (IS_ERR(wl)) { in pm_wake_unlock()
255 ret = PTR_ERR(wl); in pm_wake_unlock()
258 __pm_relax(&wl->ws); in pm_wake_unlock()
260 wakelocks_lru_most_recent(wl); in pm_wake_unlock()