Lines Matching refs:wl

39 	struct wakelock *wl;  in pm_show_wakelocks()  local
46 wl = rb_entry(node, struct wakelock, node); in pm_show_wakelocks()
47 if (wl->ws.active == show_active) in pm_show_wakelocks()
48 str += scnprintf(str, end - str, "%s ", wl->name); in pm_show_wakelocks()
89 static inline void wakelocks_lru_add(struct wakelock *wl) in wakelocks_lru_add() argument
91 list_add(&wl->lru, &wakelocks_lru_list); in wakelocks_lru_add()
94 static inline void wakelocks_lru_most_recent(struct wakelock *wl) in wakelocks_lru_most_recent() argument
96 list_move(&wl->lru, &wakelocks_lru_list); in wakelocks_lru_most_recent()
101 struct wakelock *wl, *aux; in wakelocks_gc() local
108 list_for_each_entry_safe_reverse(wl, aux, &wakelocks_lru_list, lru) { in wakelocks_gc()
112 spin_lock_irq(&wl->ws.lock); in wakelocks_gc()
113 idle_time_ns = ktime_to_ns(ktime_sub(now, wl->ws.last_time)); in wakelocks_gc()
114 active = wl->ws.active; in wakelocks_gc()
115 spin_unlock_irq(&wl->ws.lock); in wakelocks_gc()
121 wakeup_source_remove(&wl->ws); in wakelocks_gc()
122 rb_erase(&wl->node, &wakelocks_tree); in wakelocks_gc()
123 list_del(&wl->lru); in wakelocks_gc()
124 kfree(wl->name); in wakelocks_gc()
125 kfree(wl); in wakelocks_gc()
132 static inline void wakelocks_lru_add(struct wakelock *wl) {} in wakelocks_lru_add() argument
133 static inline void wakelocks_lru_most_recent(struct wakelock *wl) {} in wakelocks_lru_most_recent() argument
142 struct wakelock *wl; in wakelock_lookup_add() local
148 wl = rb_entry(*node, struct wakelock, node); in wakelock_lookup_add()
149 diff = strncmp(name, wl->name, len); in wakelock_lookup_add()
151 if (wl->name[len]) in wakelock_lookup_add()
154 return wl; in wakelock_lookup_add()
168 wl = kzalloc(sizeof(*wl), GFP_KERNEL); in wakelock_lookup_add()
169 if (!wl) in wakelock_lookup_add()
172 wl->name = kstrndup(name, len, GFP_KERNEL); in wakelock_lookup_add()
173 if (!wl->name) { in wakelock_lookup_add()
174 kfree(wl); in wakelock_lookup_add()
177 wl->ws.name = wl->name; in wakelock_lookup_add()
178 wakeup_source_add(&wl->ws); in wakelock_lookup_add()
179 rb_link_node(&wl->node, parent, node); in wakelock_lookup_add()
180 rb_insert_color(&wl->node, &wakelocks_tree); in wakelock_lookup_add()
181 wakelocks_lru_add(wl); in wakelock_lookup_add()
183 return wl; in wakelock_lookup_add()
189 struct wakelock *wl; in pm_wake_lock() local
213 wl = wakelock_lookup_add(buf, len, true); in pm_wake_lock()
214 if (IS_ERR(wl)) { in pm_wake_lock()
215 ret = PTR_ERR(wl); in pm_wake_lock()
222 __pm_wakeup_event(&wl->ws, timeout_ms); in pm_wake_lock()
224 __pm_stay_awake(&wl->ws); in pm_wake_lock()
227 wakelocks_lru_most_recent(wl); in pm_wake_lock()
236 struct wakelock *wl; in pm_wake_unlock() local
255 wl = wakelock_lookup_add(buf, len, false); in pm_wake_unlock()
256 if (IS_ERR(wl)) { in pm_wake_unlock()
257 ret = PTR_ERR(wl); in pm_wake_unlock()
260 __pm_relax(&wl->ws); in pm_wake_unlock()
262 wakelocks_lru_most_recent(wl); in pm_wake_unlock()