PM: sleep: Narrow down -DDEBUG on kernel/power/ files

The macro -DDEBUG is broadly enabled on kernel/power/ directory if
CONFIG_DYNAMIC_DEBUG is enabled. As side effect all debug messages using
pr_debug() and dev_dbg() are enabled by default on dynamic debug.
We're reworking pm_pr_dbg() to support dynamic debug, where pm_pr_dbg()
will print message if either pm_debug_messages_on flag is set or if it's
explicitly enabled on dynamic debug's control. That means if we let
-DDEBUG broadly set, the pm_debug_messages_on flag will be bypassed by
default on pm_pr_dbg() if dynamic debug is also enabled.

The files that directly use pr_debug() and dev_dbg() on kernel/power/ are:
 - swap.c
 - snapshot.c
 - energy_model.c

And those files do not use pm_pr_dbg(). So if we limit -DDEBUG to them,
we keep the same functional behavior while allowing the pm_pr_dbg()
refactor.

Signed-off-by: David Cohen <dacohen@pm.me>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
David Cohen 2022-03-24 08:07:24 +00:00 committed by Rafael J. Wysocki
parent ce522ba9ef
commit ae20cb9aec
2 changed files with 5 additions and 4 deletions

View File

@ -1,6 +1,10 @@
# SPDX-License-Identifier: GPL-2.0
ccflags-$(CONFIG_PM_DEBUG) := -DDEBUG
ifeq ($(CONFIG_DYNAMIC_DEBUG), y)
CFLAGS_swap.o := -DDEBUG
CFLAGS_snapshot.o := -DDEBUG
CFLAGS_energy_model.o := -DDEBUG
endif
KASAN_SANITIZE_snapshot.o := n

View File

@ -6,9 +6,6 @@
* Originally from swsusp.
*/
#undef DEBUG
#include <linux/interrupt.h>
#include <linux/oom.h>
#include <linux/suspend.h>