Skip to contentSkip to conversation

gpio: mvebu: name regmaps to fix debugfs collisions

PATCH Applied Rosen Penev 3 participants 3 messages Sep 5 – Sep 7 GPIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpio: mvebu: name regmaps to fix debugfs collisions

Each marvell,armada-370-gpio node provides both 'gpio' and 'pwm' register windows, and the driver creates one regmap per window on the same platform device. The shared regmap_config was unnamed, so both maps defaulted their debugfs directory to dev_name(), e.g.

debugfs: 'f1018100.gpio' already exists in 'regmap'

because the PWM regmap (and on Armada XP the per-CPU regmap) claimed the same directory as the GPIO regmap.

Give each regmap a distinct .name so the debugfs directories become '<dev>.gpio', '<dev>.percpu' and '<dev>.pwm'. This only affects debugfs naming; register access is unchanged.

Assisted-by opencode:big-pickle
---
 drivers/gpio/gpio-mvebu.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)
drivers/gpio/gpio-mvebu.c +17 -2
index 93b8a08b04b9..c57758019e92 100644
@@ -599,6 +599,21 @@ static void mvebu_gpio_irq_handler(struct irq_desc *desc)
 }
 
 static const struct regmap_config mvebu_gpio_regmap_config = {
+	.name = "gpio",
+	.reg_bits = 32,
+	.reg_stride = 4,
+	.val_bits = 32,
+};
+
+static const struct regmap_config mvebu_gpio_percpu_regmap_config = {
+	.name = "percpu",
+	.reg_bits = 32,
+	.reg_stride = 4,
+	.val_bits = 32,
+};
+
+static const struct regmap_config mvebu_pwm_regmap_config = {
+	.name = "pwm",
 	.reg_bits = 32,
 	.reg_stride = 4,
 	.val_bits = 32,
@@ -868,7 +883,7 @@ static int mvebu_pwm_probe(struct platform_device *pdev,
 			return PTR_ERR(base);
 
 		mvpwm->regs = devm_regmap_init_mmio(&pdev->dev, base,
-						    &mvebu_gpio_regmap_config);
+						    &mvebu_pwm_regmap_config);
 		if (IS_ERR(mvpwm->regs))
 			return PTR_ERR(mvpwm->regs);
 
@@ -1114,7 +1129,7 @@ static int mvebu_gpio_probe_raw(struct platform_device *pdev,
 
 		mvchip->percpu_regs =
 			devm_regmap_init_mmio(&pdev->dev, base,
-					      &mvebu_gpio_regmap_config);
+					      &mvebu_gpio_percpu_regmap_config);
 		if (IS_ERR(mvchip->percpu_regs))
 			return PTR_ERR(mvchip->percpu_regs);
 	}
Signature · 1 line
2.55.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Rosen Penev

Each marvell,armada-370-gpio node provides both 'gpio' and 'pwm' register windows, and the driver creates one regmap per window on the same platform device. The shared regmap_config was unnamed, so both maps defaulted their debugfs directory to dev_name(), e.g.

debugfs: 'f1018100.gpio' already exists in 'regmap'

because the PWM regmap (and on Armada XP the per-CPU regmap) claimed the same directory as the GPIO regmap.

Quoted 6 lines

Give each regmap a distinct .name so the debugfs directories become '<dev>.gpio', '<dev>.percpu' and '<dev>.pwm'. This only affects debugfs naming; register access is unchanged.

Assisted-by opencode:big-pickle

Makes sense.

Yours,
Linus Walleij

#2 lore raw
In reply to Rosen Penev
Quoted 8 lines · Rosen Penev

Each marvell,armada-370-gpio node provides both 'gpio' and 'pwm' register windows, and the driver creates one regmap per window on the same platform device. The shared regmap_config was unnamed, so both maps defaulted their debugfs directory to dev_name(), e.g.

debugfs: 'f1018100.gpio' already exists in 'regmap'

[...]

Applied, thanks!

[1/1] gpio: mvebu: name regmaps to fix debugfs collisions

      https://git.kernel.org/brgl/c/4d305c2273123119c27d6e4c822215e650c451e3

Best regards,

Signature · 1 line
Bartosz Golaszewski <[email protected]>