diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2022-01-28 20:44:07 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2022-01-28 20:44:07 +0200 |
commit | a7b4b0076b5c76090b35c1eb8eebe308ce800b2d (patch) | |
tree | 177946562b3a5b7d51467a5bdfcd1af5e16ef905 /kernel/power/wakelock.c | |
parent | df0001545b2769e6aa33a45e26c00a4cdac48c29 (diff) | |
parent | 33569ef3c754a82010f266b7b938a66a3ccf90a4 (diff) | |
download | linux-a7b4b0076b5c76090b35c1eb8eebe308ce800b2d.tar.gz linux-a7b4b0076b5c76090b35c1eb8eebe308ce800b2d.tar.bz2 linux-a7b4b0076b5c76090b35c1eb8eebe308ce800b2d.zip |
Merge tag 'pm-5.17-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull power management fixes from Rafael Wysocki:
"These make the buffer handling in pm_show_wakelocks() more robust and
drop an unused hibernation-related function.
Specifics:
- Make the buffer handling in pm_show_wakelocks() more robust by
using sysfs_emit_at() in it to generate output (Greg
Kroah-Hartman).
- Drop register_nosave_region_late() which is not used (Amadeusz
Sławiński)"
* tag 'pm-5.17-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
PM: hibernate: Remove register_nosave_region_late()
PM: wakeup: simplify the output logic of pm_show_wakelocks()
Diffstat (limited to 'kernel/power/wakelock.c')
-rw-r--r-- | kernel/power/wakelock.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/kernel/power/wakelock.c b/kernel/power/wakelock.c index 105df4dfc783..52571dcad768 100644 --- a/kernel/power/wakelock.c +++ b/kernel/power/wakelock.c @@ -39,23 +39,20 @@ 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 |