Lines Matching refs:wl

40 	struct wakelock *wl;  in pm_show_wakelocks()  local
47 wl = rb_entry(node, struct wakelock, node); in pm_show_wakelocks()
48 if (wl->ws.active == show_active) in pm_show_wakelocks()
49 str += scnprintf(str, end - str, "%s ", wl->name); in pm_show_wakelocks()
92 static inline void wakelocks_lru_add(struct wakelock *wl) in wakelocks_lru_add() argument
94 list_add(&wl->lru, &wakelocks_lru_list); in wakelocks_lru_add()
97 static inline void wakelocks_lru_most_recent(struct wakelock *wl) in wakelocks_lru_most_recent() argument
99 list_move(&wl->lru, &wakelocks_lru_list); in wakelocks_lru_most_recent()
104 struct wakelock *wl, *aux; in __wakelocks_gc() local
110 list_for_each_entry_safe_reverse(wl, aux, &wakelocks_lru_list, lru) { in __wakelocks_gc()
114 spin_lock_irq(&wl->ws.lock); in __wakelocks_gc()
115 idle_time_ns = ktime_to_ns(ktime_sub(now, wl->ws.last_time)); in __wakelocks_gc()
116 active = wl->ws.active; in __wakelocks_gc()
117 spin_unlock_irq(&wl->ws.lock); in __wakelocks_gc()
123 wakeup_source_remove(&wl->ws); in __wakelocks_gc()
124 rb_erase(&wl->node, &wakelocks_tree); in __wakelocks_gc()
125 list_del(&wl->lru); in __wakelocks_gc()
126 kfree(wl->name); in __wakelocks_gc()
127 kfree(wl); in __wakelocks_gc()
144 static inline void wakelocks_lru_add(struct wakelock *wl) {} in wakelocks_lru_add() argument
145 static inline void wakelocks_lru_most_recent(struct wakelock *wl) {} in wakelocks_lru_most_recent() argument
154 struct wakelock *wl; in wakelock_lookup_add() local
160 wl = rb_entry(*node, struct wakelock, node); in wakelock_lookup_add()
161 diff = strncmp(name, wl->name, len); in wakelock_lookup_add()
163 if (wl->name[len]) in wakelock_lookup_add()
166 return wl; in wakelock_lookup_add()
180 wl = kzalloc(sizeof(*wl), GFP_KERNEL); in wakelock_lookup_add()
181 if (!wl) in wakelock_lookup_add()
184 wl->name = kstrndup(name, len, GFP_KERNEL); in wakelock_lookup_add()
185 if (!wl->name) { in wakelock_lookup_add()
186 kfree(wl); in wakelock_lookup_add()
189 wl->ws.name = wl->name; in wakelock_lookup_add()
190 wakeup_source_add(&wl->ws); in wakelock_lookup_add()
191 rb_link_node(&wl->node, parent, node); in wakelock_lookup_add()
192 rb_insert_color(&wl->node, &wakelocks_tree); in wakelock_lookup_add()
193 wakelocks_lru_add(wl); in wakelock_lookup_add()
195 return wl; in wakelock_lookup_add()
201 struct wakelock *wl; in pm_wake_lock() local
225 wl = wakelock_lookup_add(buf, len, true); in pm_wake_lock()
226 if (IS_ERR(wl)) { in pm_wake_lock()
227 ret = PTR_ERR(wl); in pm_wake_lock()
234 __pm_wakeup_event(&wl->ws, timeout_ms); in pm_wake_lock()
236 __pm_stay_awake(&wl->ws); in pm_wake_lock()
239 wakelocks_lru_most_recent(wl); in pm_wake_lock()
248 struct wakelock *wl; in pm_wake_unlock() local
267 wl = wakelock_lookup_add(buf, len, false); in pm_wake_unlock()
268 if (IS_ERR(wl)) { in pm_wake_unlock()
269 ret = PTR_ERR(wl); in pm_wake_unlock()
272 __pm_relax(&wl->ws); in pm_wake_unlock()
274 wakelocks_lru_most_recent(wl); in pm_wake_unlock()