Skip to contentSkip to conversation

regulator: fix sysfs name collision between dummy and fixed dummy regulator

PATCH New Shawn Guo 2 participants 6 messages Mar 31, 2012

Subsystems (4)
lore
Share & tools
lore

Shawn Guo

author
#0 lore raw

PATCH 1/2 regulator: fix sysfs name collision between dummy and fixed dummy regulator

When regulator_register_fixed() is being used to register fixed dummy regulator, the following line will be seen in the boot log. And the sysfs entry for fixed dummy regulator is not shown.

dummy: Failed to create debugfs directory

The patch renames the fixed dummy supply to "fixed-dummy" to avoid the name collision with dummy regulator.

---
 drivers/regulator/fixed-helper.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/regulator/fixed-helper.c +1 -1
index 30d0a15..efb52dc 100644
@@ -32,7 +32,7 @@ struct platform_device *regulator_register_fixed(int id,
 	if (!data)
 		return NULL;
 
-	data->cfg.supply_name = "dummy";
+	data->cfg.supply_name = "fixed-dummy";
 	data->cfg.microvolts = 0;
 	data->cfg.gpio = -EINVAL;
 	data->cfg.enabled_at_boot = 1;
Signature · 1 line
1.7.5.4
author
#1 lore raw

PATCH 2/2 regulator: rename function regulator_register_fixed

Function regulator_register_fixed() is only meant for registering fixed dummy regulators. Rename it to regulator_register_fixed_dummy() for the explicit meaning, so that people do not attempt to register those real fixed regulators with this function.

It also removes the kernel doc for @name which is not a parameter for the function at all.

---
 arch/arm/mach-imx/mach-pcm037.c    |    3 ++-
 arch/arm/plat-mxc/3ds_debugboard.c |    3 ++-
 drivers/regulator/fixed-helper.c   |    5 ++---
 include/linux/regulator/fixed.h    |    4 ++--
 4 files changed, 8 insertions(+), 7 deletions(-)
arch/arm/mach-imx/mach-pcm037.c +2 -1
index 5fddf94..d8ceaba 100644
@@ -586,7 +586,8 @@ static void __init pcm037_init(void)
 
 	imx31_soc_init();
 
-	regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies));
+	regulator_register_fixed_dummy(0, dummy_supplies,
+				       ARRAY_SIZE(dummy_supplies));
 
 	mxc_iomux_set_gpr(MUX_PGP_UH2, 1);
 
arch/arm/plat-mxc/3ds_debugboard.c +2 -1
index d1e31fa..5e3cdf1 100644
@@ -195,7 +195,8 @@ int __init mxc_expio_init(u32 base, u32 p_irq)
 	irq_set_chained_handler(p_irq, mxc_expio_irq_handler);
 
 	/* Register Lan device on the debugboard */
-	regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies));
+	regulator_register_fixed_dummy(0, dummy_supplies,
+				       ARRAY_SIZE(dummy_supplies));
 
 	smsc911x_resources[0].start = LAN9217_BASE_ADDR(base);
 	smsc911x_resources[0].end = LAN9217_BASE_ADDR(base) + 0x100 - 1;
drivers/regulator/fixed-helper.c +2 -3
index efb52dc..b24c90b 100644
@@ -17,13 +17,12 @@ static void regulator_fixed_release(struct device *dev)
 }
 
 /**
- * regulator_register_fixed - register a no-op fixed regulator
- * @name: supply name
+ * regulator_register_fixed_dummy - register a dummy no-op fixed regulator
  * @id: platform device id
  * @supplies: consumers for this regulator
  * @num_supplies: number of consumers
  */
-struct platform_device *regulator_register_fixed(int id,
+struct platform_device *regulator_register_fixed_dummy(int id,
 		struct regulator_consumer_supply *supplies, int num_supplies)
 {
 	struct fixed_regulator_data *data;
include/linux/regulator/fixed.h +2 -2
index 936a7d8..2a956a9 100644
@@ -51,10 +51,10 @@ struct fixed_voltage_config {
 struct regulator_consumer_supply;
 
 #if IS_ENABLED(CONFIG_REGULATOR)
-struct platform_device *regulator_register_fixed(int id,
+struct platform_device *regulator_register_fixed_dummy(int id,
 		struct regulator_consumer_supply *supplies, int num_supplies);
 #else
-static inline struct platform_device *regulator_register_fixed(int id,
+static inline struct platform_device *regulator_register_fixed_dummy(int id,
 		struct regulator_consumer_supply *supplies, int num_supplies)
 {
 	return NULL;
Signature · 1 line
1.7.5.4
#2 lore raw

PATCH 2/2 regulator: rename function regulator_register_fixed

Quoted 4 lines · Shawn Guo

Function regulator_register_fixed() is only meant for registering fixed dummy regulators. Rename it to regulator_register_fixed_dummy() for the explicit meaning, so that people do not attempt to register those real fixed regulators with this function.

There's no harm in using it for regulators that physically exist if nothing cares about any of the information it can't provide and renaming it now is going to cause annoyance with cross tree issues so I'm kind of reluctant to apply this. Are there any concrete problems that have been caused by this or was it just something you noticed when looking at using it yourself?

Quoted 2 lines

It also removes the kernel doc for @name which is not a parameter for the function at all.

This is already done, I can't remember who sent the patch off the top of
my head.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120331/7aa5e044/attachment-0001.sig>

author
#3 lore raw

PATCH 2/2 regulator: rename function regulator_register_fixed

Quoted 9 lines · Mark Brown
Quoted 4 lines · Shawn Guo

Function regulator_register_fixed() is only meant for registering fixed dummy regulators. Rename it to regulator_register_fixed_dummy() for the explicit meaning, so that people do not attempt to register those real fixed regulators with this function.

There's no harm in using it for regulators that physically exist if nothing cares about any of the information it can't provide

I do not think it's practical for physical regulator to use the function, since the function forces microvolts to be 0.

Quoted 5 lines

and renaming
it now is going to cause annoyance with cross tree issues so I'm kind of reluctant to apply this. Are there any concrete problems that have been caused by this or was it just something you noticed when looking at using it yourself?

I noticed it when I was trying to use the function to register a fixed regulator which physically exist, and it turns out that I just was misled by the function name.

Quoted 6 lines
Quoted 3 lines

It also removes the kernel doc for @name which is not a parameter for the function at all.

This is already done, I can't remember who sent the patch off the top of my head.

I did not see it on regulator/for-next branch. But it's so trivial and I do not care much.

Signature · 2 lines
Regards,
Shawn
#4 lore raw

PATCH 2/2 regulator: rename function regulator_register_fixed

Quoted 7 lines · Shawn Guo
Quoted 2 lines · Mark Brown

There's no harm in using it for regulators that physically exist if nothing cares about any of the information it can't provide

I do not think it's practical for physical regulator to use the function, since the function forces microvolts to be 0.

Yeah, but it depends if anyone actually cares what the voltage is - most
consumers never look to see what the voltage is because they have no
reason to care. The lack of naming is more of an issue really.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120331/fd870d51/attachment.sig>

#5 lore raw

PATCH 1/2 regulator: fix sysfs name collision between dummy and fixed dummy regulator

In reply to Shawn Guo
Quoted 8 lines · Shawn Guo

When regulator_register_fixed() is being used to register fixed dummy regulator, the following line will be seen in the boot log. And the sysfs entry for fixed dummy regulator is not shown.

dummy: Failed to create debugfs directory

The patch renames the fixed dummy supply to "fixed-dummy" to avoid the name collision with dummy regulator.

Applied, thanks.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120331/05e720e8/attachment.sig>