linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] regulator: Make constraint debug processing conditional on DEBUG
@ 2020-10-05 13:15 Geert Uytterhoeven
  2020-10-05 14:21 ` Mark Brown
  2020-10-05 17:54 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Geert Uytterhoeven @ 2020-10-05 13:15 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Guenter Roeck; +Cc: linux-kernel, Geert Uytterhoeven

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).

Fixes: 194dbaefa0da24bb ("regulator: Lower priority of constraint logging")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/regulator/core.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 607c2a76bb604f96..98beccef3fcd0905 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1059,7 +1059,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] = "";
@@ -1127,6 +1128,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))
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] regulator: Make constraint debug processing conditional on DEBUG
  2020-10-05 13:15 [PATCH] regulator: Make constraint debug processing conditional on DEBUG Geert Uytterhoeven
@ 2020-10-05 14:21 ` Mark Brown
  2020-10-05 17:54 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2020-10-05 14:21 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: Liam Girdwood, Guenter Roeck, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 195 bytes --]

On Mon, Oct 05, 2020 at 03:15:46PM +0200, Geert Uytterhoeven wrote:

> Fixes: 194dbaefa0da24bb ("regulator: Lower priority of constraint logging")

This is an optimization rather than a bug fix.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] regulator: Make constraint debug processing conditional on DEBUG
  2020-10-05 13:15 [PATCH] regulator: Make constraint debug processing conditional on DEBUG Geert Uytterhoeven
  2020-10-05 14:21 ` Mark Brown
@ 2020-10-05 17:54 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2020-10-05 17:54 UTC (permalink / raw)
  To: Liam Girdwood, Geert Uytterhoeven, Guenter Roeck; +Cc: linux-kernel

On Mon, 5 Oct 2020 15:15:46 +0200, Geert Uytterhoeven wrote:
> 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).

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next

Thanks!

[1/1] regulator: Make constraint debug processing conditional on DEBUG
      commit: c845f21ad86528f888db27849f2d315e08126816

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-10-05 17:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-05 13:15 [PATCH] regulator: Make constraint debug processing conditional on DEBUG Geert Uytterhoeven
2020-10-05 14:21 ` Mark Brown
2020-10-05 17:54 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).