Skip to contentSkip to conversation

regulator: fix OF node imbalance on reuse

PATCH In review Johan Hovold 2 participants 11 messages Apr 8 – Apr 9

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

v2 cover regulator: fix OF node imbalance on reuse

These drivers reuse the OF node of their parent multi-function device but fail to take another reference to balance the one dropped by the platform bus code when unbinding the MFD and deregistering the child devices.

Fix this by using the intended helper for reusing OF nodes.

Note that the first two patches will cause a trivial conflict with Doug's series adding accessor functions for struct device flags which has now been merged to the driver-core tree:

	https://lore.kernel.org/r/[email protected]

Johan

Changes in v2:
- use the correct rk808 Fixes tag
- merge all the fixes into one series

Johan Hovold (7):
regulator: bq257xx: fix OF node reference imbalance
regulator: rk808: fix OF node reference imbalance
regulator: max77650: fix OF node reference imbalance
regulator: mt6357: fix OF node reference imbalance
regulator: s2dos05: fix OF node reference imbalance
regulator: act8945a: fix OF node reference imbalance
regulator: bd9571mwv: fix OF node reference imbalance

 drivers/regulator/act8945a-regulator.c  | 3 ++-
 drivers/regulator/bd9571mwv-regulator.c | 3 ++-
 drivers/regulator/bq257xx-regulator.c   | 3 +--
 drivers/regulator/max77650-regulator.c  | 2 +-
 drivers/regulator/mt6357-regulator.c    | 2 +-
 drivers/regulator/rk808-regulator.c     | 3 +--
 drivers/regulator/s2dos05-regulator.c   | 2 +-
 7 files changed, 9 insertions(+), 9 deletions(-)
Signature · 1 line
2.52.0
#1 lore raw

PATCH v2 1/7 regulator: bq257xx: fix OF node reference imbalance

The driver reuses the OF node of the parent multi-function device but fails to take another reference to balance the one dropped by the platform bus code when unbinding the MFD and deregistering the child devices.

Fix this by using the intended helper for reusing OF nodes.

Fixes 981dd162b635 ("regulator: bq257xx: Add bq257xx boost regulator driver")
Cc Chris Morgan <[email protected]>
---
 drivers/regulator/bq257xx-regulator.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/regulator/bq257xx-regulator.c +1 -2
index dab8f1ab4450..711dbe045383 100644
@@ -142,8 +142,7 @@ static int bq257xx_regulator_probe(struct platform_device *pdev)
 	struct device_node *np = dev->of_node;
 	struct regulator_config cfg = {};
 
-	pdev->dev.of_node = pdev->dev.parent->of_node;
-	pdev->dev.of_node_reused = true;
+	device_set_of_node_from_dev(&pdev->dev, pdev->dev.parent);
 
 	pdata = devm_kzalloc(&pdev->dev, sizeof(struct bq257xx_reg_data), GFP_KERNEL);
 	if (!pdata)
Signature · 1 line
2.52.0
#2 lore raw

PATCH v2 2/7 regulator: rk808: fix OF node reference imbalance

In reply to Johan Hovold

The driver reuses the OF node of the parent multi-function device but fails to take another reference to balance the one dropped by the platform bus code when unbinding the MFD and deregistering the child devices.

Fix this by using the intended helper for reusing OF nodes.

Fixes 647e57351f8e ("regulator: rk808: reduce 'struct rk808' usage")
---
 drivers/regulator/rk808-regulator.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/regulator/rk808-regulator.c +1 -2
index e66408f23bb6..1e956153427e 100644
@@ -2114,8 +2114,7 @@ static int rk808_regulator_probe(struct platform_device *pdev)
 	struct regmap *regmap;
 	int ret, i, nregulators;
 
-	pdev->dev.of_node = pdev->dev.parent->of_node;
-	pdev->dev.of_node_reused = true;
+	device_set_of_node_from_dev(&pdev->dev, pdev->dev.parent);
 
 	regmap = dev_get_regmap(pdev->dev.parent, NULL);
 	if (!regmap)
Signature · 1 line
2.52.0
#3 lore raw

PATCH v2 3/7 regulator: max77650: fix OF node reference imbalance

In reply to Johan Hovold

The driver reuses the OF node of the parent multi-function device but fails to take another reference to balance the one dropped by the platform bus code when unbinding the MFD and deregistering the child devices.

Fix this by using the intended helper for reusing OF nodes.

Fixes bcc61f1c44fd ("regulator: max77650: add regulator support")
---
 drivers/regulator/max77650-regulator.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/regulator/max77650-regulator.c +1 -1
index a809264c77fc..11b04a13f889 100644
@@ -337,7 +337,7 @@ static int max77650_regulator_probe(struct platform_device *pdev)
 	parent = dev->parent;
 
 	if (!dev->of_node)
-		dev->of_node = parent->of_node;
+		device_set_of_node_from_dev(dev, parent);
 
 	rdescs = devm_kcalloc(dev, MAX77650_REGULATOR_NUM_REGULATORS,
 			      sizeof(*rdescs), GFP_KERNEL);
Signature · 1 line
2.52.0
#4 lore raw

PATCH v2 4/7 regulator: mt6357: fix OF node reference imbalance

In reply to Johan Hovold

The driver reuses the OF node of the parent multi-function device but fails to take another reference to balance the one dropped by the platform bus code when unbinding the MFD and deregistering the child devices.

Fix this by using the intended helper for reusing OF nodes.

Fixes dafc7cde23dc ("regulator: add mt6357 regulator")
---
 drivers/regulator/mt6357-regulator.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/regulator/mt6357-regulator.c +1 -1
index 1eb69c7a6acb..09feb454ab6b 100644
@@ -410,7 +410,7 @@ static int mt6357_regulator_probe(struct platform_device *pdev)
 	struct regulator_dev *rdev;
 	int i;
 
-	pdev->dev.of_node = pdev->dev.parent->of_node;
+	device_set_of_node_from_dev(&pdev->dev, pdev->dev.parent);
 
 	for (i = 0; i < MT6357_MAX_REGULATOR; i++) {
 		config.dev = &pdev->dev;
Signature · 1 line
2.52.0
#5 lore raw

PATCH v2 5/7 regulator: s2dos05: fix OF node reference imbalance

In reply to Johan Hovold

The driver reuses the OF node of the parent multi-function device but fails to take another reference to balance the one dropped by the platform bus code when unbinding the MFD and deregistering the child devices.

Fix this by using the intended helper for reusing OF nodes.

Fixes bb2441402392 ("regulator: add s2dos05 regulator support")
Cc Dzmitry Sankouski <[email protected]>
---
 drivers/regulator/s2dos05-regulator.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/regulator/s2dos05-regulator.c +1 -1
index 1463585c4565..a1c394ddbaff 100644
@@ -126,7 +126,7 @@ static int s2dos05_pmic_probe(struct platform_device *pdev)
 	s2dos05->regmap = iodev->regmap_pmic;
 	s2dos05->dev = dev;
 	if (!dev->of_node)
-		dev->of_node = dev->parent->of_node;
+		device_set_of_node_from_dev(dev, dev->parent);
 
 	config.dev = dev;
 	config.driver_data = s2dos05;
Signature · 1 line
2.52.0
#6 lore raw

PATCH v2 6/7 regulator: act8945a: fix OF node reference imbalance

In reply to Johan Hovold

The driver reuses the OF node of the parent multi-function device but fails to take another reference to balance the one dropped by the platform bus code when unbinding the MFD and deregistering the child devices.

Fix this by using the intended helper for reusing OF nodes.

Fixes 38c09961048b ("regulator: act8945a: add regulator driver for ACT8945A")
Cc Wenyou Yang <[email protected]>
---
 drivers/regulator/act8945a-regulator.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/regulator/act8945a-regulator.c +2 -1
index 24cbdd833863..5bbe2bce740e 100644
@@ -302,8 +302,9 @@ static int act8945a_pmic_probe(struct platform_device *pdev)
 		num_regulators = ARRAY_SIZE(act8945a_regulators);
 	}
 
+	device_set_of_node_from_dev(&pdev->dev, pdev->dev.parent);
+
 	config.dev = &pdev->dev;
-	config.dev->of_node = pdev->dev.parent->of_node;
 	config.driver_data = act8945a;
 	for (i = 0; i < num_regulators; i++) {
 		rdev = devm_regulator_register(&pdev->dev, &regulators[i],
Signature · 1 line
2.52.0
#7 lore raw

PATCH v2 7/7 regulator: bd9571mwv: fix OF node reference imbalance

In reply to Johan Hovold

The driver reuses the OF node of the parent multi-function device but fails to take another reference to balance the one dropped by the platform bus code when unbinding the MFD and deregistering the child devices.

Fix this by using the intended helper for reusing OF nodes.

Fixes e85c5a153fe2 ("regulator: Add ROHM BD9571MWV-M PMIC regulator driver")
Cc Marek Vasut <[email protected]>
---
 drivers/regulator/bd9571mwv-regulator.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/regulator/bd9571mwv-regulator.c +2 -1
index 209beabb5c37..f4de24a281b1 100644
@@ -287,8 +287,9 @@ static int bd9571mwv_regulator_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, bdreg);
 
+	device_set_of_node_from_dev(&pdev->dev, pdev->dev.parent);
+
 	config.dev = &pdev->dev;
-	config.dev->of_node = pdev->dev.parent->of_node;
 	config.driver_data = bdreg;
 	config.regmap = bdreg->regmap;
 
Signature · 1 line
2.52.0
maintainer
#8 lore raw
In reply to Johan Hovold
Quoted 3 lines · Johan Hovold

Changes in v2:
- use the correct rk808 Fixes tag
- merge all the fixes into one series

Please don't do stuff like this, it just makes it more annoying to track what's going on, especially given that you have other similar patches not included in this in flight, you sent some of these less than 24 hours ago and the ones this replaces aren't named consistently ("reference" vs "imbalance"). Either leave things a bit longer or stick with the serieses you have.

#9 lore raw
Quoted 6 lines · Mark Brown
Quoted 3 lines · Johan Hovold

Changes in v2:
- use the correct rk808 Fixes tag
- merge all the fixes into one series

Quoted 6 lines

Please don't do stuff like this, it just makes it more annoying to track what's going on, especially given that you have other similar patches not included in this in flight, you sent some of these less than 24 hours ago and the ones this replaces aren't named consistently ("reference" vs "imbalance"). Either leave things a bit longer or stick with the serieses you have.

Sorry, was just trying to make it easier for you since I know you use feature branches when merging series (and these should all have been in one series from the start).

The patches themselves have identical summaries, even if the series names vary a bit.

Here are the three series this one supersedes:

	https://lore.kernel.org/lkml/[email protected]/
	https://lore.kernel.org/lkml/[email protected]/
	https://lore.kernel.org/lkml/[email protected]/

Johan

maintainer
#10 lore raw
In reply to Johan Hovold
Quoted 8 lines · Johan Hovold

regulator: fix OF node imbalance on reuse

These drivers reuse the OF node of their parent multi-function device but fail to take another reference to balance the one dropped by the platform bus code when unbinding the MFD and deregistering the child devices.

[...]

Applied to

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

Thanks!

[1/7] regulator: bq257xx: fix OF node reference imbalance

      https://git.kernel.org/broonie/regulator/c/7ea07bc030d8
[2/7] regulator: rk808: fix OF node reference imbalance
      https://git.kernel.org/broonie/regulator/c/65290b24d8a5
[3/7] regulator: max77650: fix OF node reference imbalance
      https://git.kernel.org/broonie/regulator/c/2edaf5f7ada0
[4/7] regulator: mt6357: fix OF node reference imbalance
      https://git.kernel.org/broonie/regulator/c/2f38e96c273e
[5/7] regulator: s2dos05: fix OF node reference imbalance
      https://git.kernel.org/broonie/regulator/c/ebe694d67f15
[6/7] regulator: act8945a: fix OF node reference imbalance
      https://git.kernel.org/broonie/regulator/c/0d15ce31375c
[7/7] regulator: bd9571mwv: fix OF node reference imbalance
      https://git.kernel.org/broonie/regulator/c/8498100ee1d0

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