diff options
author | Geert Uytterhoeven <geert+renesas@glider.be> | 2020-10-05 15:15:46 +0200 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2020-10-05 17:18:36 +0200 |
commit | c845f21ad86528f888db27849f2d315e08126816 (patch) | |
tree | 4203079842ea41ea2bfd2644947e902b8794b283 /drivers/regulator | |
parent | Merge series "Support for PM660/PM660L SPMI and SMD regulators" from kholk11@... (diff) | |
download | linux-c845f21ad86528f888db27849f2d315e08126816.tar.xz linux-c845f21ad86528f888db27849f2d315e08126816.zip |
regulator: Make constraint debug processing conditional on DEBUG
If debugging is disabled, print_constraints() does not print the actual
constraints, but still performs some processing and string formatting,
only to throw away the result later.
Fix this by moving all constraint debug processing to a separate
function, and replacing it by a dummy when debugging is disabled.
This reduces kernel size by almost 800 bytes (on arm/arm64).
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/20201005131546.22448-1-geert+renesas@glider.be
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/regulator')
-rw-r--r-- | drivers/regulator/core.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 16497192e99b..bba25935e79e 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -1056,7 +1056,8 @@ static int suspend_set_initial_state(struct regulator_dev *rdev) return __suspend_set_state(rdev, rstate); } -static void print_constraints(struct regulator_dev *rdev) +#if defined(DEBUG) || defined(CONFIG_DYNAMIC_DEBUG) +static void print_constraints_debug(struct regulator_dev *rdev) { struct regulation_constraints *constraints = rdev->constraints; char buf[160] = ""; @@ -1124,6 +1125,16 @@ static void print_constraints(struct regulator_dev *rdev) _regulator_is_enabled(rdev) ? "enabled" : "disabled"); rdev_dbg(rdev, "%s\n", buf); +} +#else /* !DEBUG && !CONFIG_DYNAMIC_DEBUG */ +static inline void print_constraints_debug(struct regulator_dev *rdev) {} +#endif /* !DEBUG && !CONFIG_DYNAMIC_DEBUG */ + +static void print_constraints(struct regulator_dev *rdev) +{ + struct regulation_constraints *constraints = rdev->constraints; + + print_constraints_debug(rdev); if ((constraints->min_uV != constraints->max_uV) && !regulator_ops_is_valid(rdev, REGULATOR_CHANGE_VOLTAGE)) |