regulator: rk808: Remove unused variables
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
@@ -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
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
@@ -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
Re: [PATCH 2/2] regulator: rk808: Fix missing of_node_put
Axel,
Quoted 11 lines · Axel Lin
1. Pass
&pdev->devrather than&client->devtoof_regulator_match, the *dev argument is used for devres to ensuredevm_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 missingof_node_put(reg_np).Signed-off-by Axel Lin <[email protected]>--- 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
Axel,
Quoted 6 lines · Axel Lin
Also remove non-informative comment.
Signed-off-by Axel Lin <[email protected]>--- drivers/regulator/rk808-regulator.c | 26 -------------------------- 1 file changed, 26 deletions(-)
Seems reasonable to me.
Quoted 1 line · Axel Lin
Also remove non-informative comment.
Applied both, thanks.