PM: sleep: enable dynamic debug support within pm_pr_dbg()
authorDavid Cohen <dacohen@pm.me>
Thu, 24 Mar 2022 08:07:30 +0000 (08:07 +0000)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 13 Apr 2022 14:34:01 +0000 (16:34 +0200)
commitce1cb680ff1c5b88505f878137796b1723e00193
treefe80445e7148462c42c5e58b4dc11ed9716729da
parentae20cb9aec91ec3c668e413b93a6080803464ae5
PM: sleep: enable dynamic debug support within pm_pr_dbg()

Currently pm_pr_dbg() is used to filter kernel pm debug messages based
on pm_debug_messages_on flag. The problem is if we enable/disable this
flag it will affect all pm_pr_dbg() calls at once, so we can't
individually control them.

This patch changes pm_pr_dbg() implementation as such:

 - If pm_debug_messages_on is enabled, print the message.
 - If pm_debug_messages_on is disabled and CONFIG_DYNAMIC_DEBUG is
   enabled, only print the messages explicitly enabled on
   /sys/kernel/debug/dynamic_debug/control.
 - If pm_debug_messages_on is disabled and CONFIG_DYNAMIC_DEBUG is
   disabled, don't print the message.

Signed-off-by: David Cohen <dacohen@pm.me>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
include/linux/suspend.h
kernel/power/main.c