* [PATCH] regulator: core: fix debugfs creation regression
@ 2024-05-09 13:33 Johan Hovold
2024-05-10 6:22 ` Mark Brown
2024-05-13 12:17 ` Geert Uytterhoeven
0 siblings, 2 replies; 3+ messages in thread
From: Johan Hovold @ 2024-05-09 13:33 UTC (permalink / raw)
To: Mark Brown
Cc: Liam Girdwood, linux-kernel, Johan Hovold, stable,
Geert Uytterhoeven
regulator_get() may sometimes be called more than once for the same
consumer device, something which before commit dbe954d8f163 ("regulator:
core: Avoid debugfs: Directory ... already present! error") resulted in
errors being logged.
A couple of recent commits broke the handling of such cases so that
attributes are now erroneously created in the debugfs root directory the
second time a regulator is requested and the log is filled with errors
like:
debugfs: File 'uA_load' in directory '/' already present!
debugfs: File 'min_uV' in directory '/' already present!
debugfs: File 'max_uV' in directory '/' already present!
debugfs: File 'constraint_flags' in directory '/' already present!
on any further calls.
Fixes: 2715bb11cfff ("regulator: core: Fix more error checking for debugfs_create_dir()")
Fixes: 08880713ceec ("regulator: core: Streamline debugfs operations")
Cc: stable@vger.kernel.org
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
---
drivers/regulator/core.c | 27 ++++++++++++++++-----------
1 file changed, 16 insertions(+), 11 deletions(-)
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index dabac9772741..2c33653ffdea 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1911,19 +1911,24 @@ static struct regulator *create_regulator(struct regulator_dev *rdev,
}
}
- if (err != -EEXIST)
+ if (err != -EEXIST) {
regulator->debugfs = debugfs_create_dir(supply_name, rdev->debugfs);
- if (IS_ERR(regulator->debugfs))
- rdev_dbg(rdev, "Failed to create debugfs directory\n");
+ if (IS_ERR(regulator->debugfs)) {
+ rdev_dbg(rdev, "Failed to create debugfs directory\n");
+ regulator->debugfs = NULL;
+ }
+ }
- debugfs_create_u32("uA_load", 0444, regulator->debugfs,
- ®ulator->uA_load);
- debugfs_create_u32("min_uV", 0444, regulator->debugfs,
- ®ulator->voltage[PM_SUSPEND_ON].min_uV);
- debugfs_create_u32("max_uV", 0444, regulator->debugfs,
- ®ulator->voltage[PM_SUSPEND_ON].max_uV);
- debugfs_create_file("constraint_flags", 0444, regulator->debugfs,
- regulator, &constraint_flags_fops);
+ if (regulator->debugfs) {
+ debugfs_create_u32("uA_load", 0444, regulator->debugfs,
+ ®ulator->uA_load);
+ debugfs_create_u32("min_uV", 0444, regulator->debugfs,
+ ®ulator->voltage[PM_SUSPEND_ON].min_uV);
+ debugfs_create_u32("max_uV", 0444, regulator->debugfs,
+ ®ulator->voltage[PM_SUSPEND_ON].max_uV);
+ debugfs_create_file("constraint_flags", 0444, regulator->debugfs,
+ regulator, &constraint_flags_fops);
+ }
/*
* Check now if the regulator is an always on regulator - if
--
2.43.2
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] regulator: core: fix debugfs creation regression
2024-05-09 13:33 [PATCH] regulator: core: fix debugfs creation regression Johan Hovold
@ 2024-05-10 6:22 ` Mark Brown
2024-05-13 12:17 ` Geert Uytterhoeven
1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2024-05-10 6:22 UTC (permalink / raw)
To: Johan Hovold; +Cc: Liam Girdwood, linux-kernel, stable, Geert Uytterhoeven
On Thu, 09 May 2024 15:33:04 +0200, Johan Hovold wrote:
> regulator_get() may sometimes be called more than once for the same
> consumer device, something which before commit dbe954d8f163 ("regulator:
> core: Avoid debugfs: Directory ... already present! error") resulted in
> errors being logged.
>
> A couple of recent commits broke the handling of such cases so that
> attributes are now erroneously created in the debugfs root directory the
> second time a regulator is requested and the log is filled with errors
> like:
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next
Thanks!
[1/1] regulator: core: fix debugfs creation regression
commit: 2a4b49bb58123bad6ec0e07b02845f74c23d5e04
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* Re: [PATCH] regulator: core: fix debugfs creation regression
2024-05-09 13:33 [PATCH] regulator: core: fix debugfs creation regression Johan Hovold
2024-05-10 6:22 ` Mark Brown
@ 2024-05-13 12:17 ` Geert Uytterhoeven
1 sibling, 0 replies; 3+ messages in thread
From: Geert Uytterhoeven @ 2024-05-13 12:17 UTC (permalink / raw)
To: Johan Hovold
Cc: Mark Brown, Liam Girdwood, linux-kernel, stable,
Geert Uytterhoeven
On Thu, May 9, 2024 at 3:34 PM Johan Hovold <johan+linaro@kernel.org> wrote:
> regulator_get() may sometimes be called more than once for the same
> consumer device, something which before commit dbe954d8f163 ("regulator:
> core: Avoid debugfs: Directory ... already present! error") resulted in
> errors being logged.
>
> A couple of recent commits broke the handling of such cases so that
> attributes are now erroneously created in the debugfs root directory the
> second time a regulator is requested and the log is filled with errors
> like:
>
> debugfs: File 'uA_load' in directory '/' already present!
> debugfs: File 'min_uV' in directory '/' already present!
> debugfs: File 'max_uV' in directory '/' already present!
> debugfs: File 'constraint_flags' in directory '/' already present!
>
> on any further calls.
>
> Fixes: 2715bb11cfff ("regulator: core: Fix more error checking for debugfs_create_dir()")
> Fixes: 08880713ceec ("regulator: core: Streamline debugfs operations")
> Cc: stable@vger.kernel.org
> Cc: Geert Uytterhoeven <geert+renesas@glider.be>
> Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
FTR,
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-05-13 12:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-09 13:33 [PATCH] regulator: core: fix debugfs creation regression Johan Hovold
2024-05-10 6:22 ` Mark Brown
2024-05-13 12:17 ` Geert Uytterhoeven
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox