Skip to contentSkip to conversation

regulator: rk808: Remove unused variables

PATCH Applied Axel Lin 3 participants 5 messages Sep 11, 2014 – Sep 13, 2014 Voltage and current regulator framework

lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/2 regulator: rk808: Remove unused variables

Also remove non-informative comment.

---
 drivers/regulator/rk808-regulator.c | 26 --------------------------
 1 file changed, 26 deletions(-)
drivers/regulator/rk808-regulator.c +0 -26
index d91f2b6..9557428 100644
@@ -28,32 +28,6 @@
 #define RK808_BUCK4_VSEL_MASK	0xf
 #define RK808_LDO_VSEL_MASK	0x1f
 
-static const int buck_set_vol_base_addr[] = {
-	RK808_BUCK1_ON_VSEL_REG,
-	RK808_BUCK2_ON_VSEL_REG,
-	RK808_BUCK3_CONFIG_REG,
-	RK808_BUCK4_ON_VSEL_REG,
-};
-
-static const int buck_contr_base_addr[] = {
-	RK808_BUCK1_CONFIG_REG,
-	RK808_BUCK2_CONFIG_REG,
-	RK808_BUCK3_CONFIG_REG,
-	RK808_BUCK4_CONFIG_REG,
-};
-
-static const int ldo_set_vol_base_addr[] = {
-	RK808_LDO1_ON_VSEL_REG,
-	RK808_LDO2_ON_VSEL_REG,
-	RK808_LDO3_ON_VSEL_REG,
-	RK808_LDO4_ON_VSEL_REG,
-	RK808_LDO5_ON_VSEL_REG,
-	RK808_LDO6_ON_VSEL_REG,
-	RK808_LDO7_ON_VSEL_REG,
-	RK808_LDO8_ON_VSEL_REG,
-};
-
-/* rk808 voltage number */
 static const struct regulator_linear_range rk808_buck_voltage_ranges[] = {
 	REGULATOR_LINEAR_RANGE(700000, 0, 63, 12500),
 };
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH 2/2 regulator: rk808: Fix missing of_node_put

1. Pass &pdev->dev rather than &client->dev to of_regulator_match, the *dev argument is used for devres to ensure devm_of_regulator_put_matches() will be called when unload the module.

2. of_get_child_by_name() returns a node pointer with refcount incremented. Thus add missing of_node_put(reg_np).

---
 drivers/regulator/rk808-regulator.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/regulator/rk808-regulator.c +2 -1
index 9557428..07b0eb4 100644
@@ -281,8 +281,9 @@ static int rk808_regulator_probe(struct platform_device *pdev)
 	if (!reg_np)
 		return -ENXIO;
 
-	ret = of_regulator_match(&client->dev, reg_np, rk808_reg_matches,
+	ret = of_regulator_match(&pdev->dev, reg_np, rk808_reg_matches,
 				 RK808_NUM_REGULATORS);
+	of_node_put(reg_np);
 	if (ret < 0)
 		return ret;
 
Signature · 1 line
1.9.1
Reviewed-by Tested-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] regulator: rk808: Fix missing of_node_put

Axel,

Quoted 11 lines · Axel Lin

1. Pass &pdev->dev rather than &client->dev to of_regulator_match, the *dev argument is used for devres to ensure devm_of_regulator_put_matches() will be called when unload the module.

2. of_get_child_by_name() returns a node pointer with refcount incremented. Thus add missing of_node_put(reg_np).

---
 drivers/regulator/rk808-regulator.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

I've tested that things still work fine after applying this patch and confirmed both of your statements are true to the best of my knowledge. I haven't tested module removal (which is where some of this matters) but what's here looks good.

-Doug