summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorMichael Bestas <mkbestas@lineageos.org>2022-02-09 20:00:28 +0200
committerMichael Bestas <mkbestas@lineageos.org>2022-02-09 20:00:28 +0200
commit2e69f2ae550dcfbde1ffb6daa11492762b122191 (patch)
tree598e8922509ca50771d3a609d0c63eca90a1ecb2 /kernel
parent82e44f01405d6fcccef53c5d2c95cf2fbbda9075 (diff)
parent5626e6fca8c361bc552bf8005d19c301eddea784 (diff)
Merge remote-tracking branch 'msm8998/lineage-18.1' into lineage-18.1
Change-Id: I073391b643e7886de4ca06ca24caab848510f2bd
Diffstat (limited to 'kernel')
-rw-r--r--kernel/power/wakelock.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/kernel/power/wakelock.c b/kernel/power/wakelock.c
index 1896386e16bb..78e354b1c593 100644
--- a/kernel/power/wakelock.c
+++ b/kernel/power/wakelock.c
@@ -38,23 +38,19 @@ ssize_t pm_show_wakelocks(char *buf, bool show_active)
{
struct rb_node *node;
struct wakelock *wl;
- char *str = buf;
- char *end = buf + PAGE_SIZE;
+ int len = 0;
mutex_lock(&wakelocks_lock);
for (node = rb_first(&wakelocks_tree); node; node = rb_next(node)) {
wl = rb_entry(node, struct wakelock, node);
if (wl->ws.active == show_active)
- str += scnprintf(str, end - str, "%s ", wl->name);
+ len += sysfs_emit_at(buf, len, "%s ", wl->name);
}
- if (str > buf)
- str--;
-
- str += scnprintf(str, end - str, "\n");
+ len += sysfs_emit_at(buf, len, "\n");
mutex_unlock(&wakelocks_lock);
- return (str - buf);
+ return len;
}
#if CONFIG_PM_WAKELOCKS_LIMIT > 0