regulator: max77693: Remove unnecessary **rdev from struct max77693_pmic_dev
Subsystems (2)
PATCH 1/3 regulator: max77693: Remove unnecessary **rdev from struct max77693_pmic_dev
Now we are using devm_regulator_register(), so we don't need to allocate *rdev[] array to store return value of devm_regulator_register. Use a *rdev variable is enough for checking return status.
--- drivers/regulator/max77693.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-)
drivers/regulator/max77693.c +5 -11
@@ -38,7 +38,6 @@ struct max77693_pmic_dev {struct device *dev;struct max77693_dev *iodev;int num_regulators; -struct regulator_dev **rdev; };/* CHARGER regulator ops */
@@ -249,12 +248,6 @@ static int max77693_pmic_probe(struct platform_device *pdev)if (!max77693_pmic)return -ENOMEM ; - max77693_pmic->rdev =devm_kzalloc (&pdev->dev, -sizeof (struct regulator_dev *) * num_rdata, -GFP_KERNEL ); -if (!max77693_pmic->rdev) -return -ENOMEM ; - max77693_pmic->dev = &pdev->dev; max77693_pmic->iodev = iodev; max77693_pmic->num_regulators = num_rdata;
@@ -265,17 +258,18 @@ static int max77693_pmic_probe(struct platform_device *pdev)platform_set_drvdata (pdev, max77693_pmic);for (i =0 ; i < max77693_pmic->num_regulators; i++) { +struct regulator_dev *rdev;int id = rdata[i].id; config.init_data = rdata[i].initdata; config.of_node = rdata[i].of_node; - max77693_pmic->rdev[i] =devm_regulator_register (&pdev->dev, - ®ulators[id], &config); -if (IS_ERR (max77693_pmic->rdev[i])) { + rdev =devm_regulator_register (&pdev->dev, ®ulators[id], + &config); +if (IS_ERR (rdev)) {dev_err (max77693_pmic->dev,"Failed to initialize regulator-%d\n" , id); -return PTR_ERR (max77693_pmic->rdev[i]); +return PTR_ERR (rdev); } }
Signature · 1 line
1.8.1.2
PATCH 2/3 regulator: max8997: Remove unnecessary **rdev from struct max8997_data
Now we are using devm_regulator_register(), so we don't need to allocate *rdev[] array to store return value of devm_regulator_register. Use a *rdev variable is enough for checking return status.
--- drivers/regulator/max8997.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-)
drivers/regulator/max8997.c +6 -13
@@ -38,7 +38,6 @@ struct max8997_data {struct device *dev;struct max8997_dev *iodev;int num_regulators; -struct regulator_dev **rdev;int ramp_delay;/* in mV/us */ bool buck1_gpiodvs;
@@ -1029,10 +1028,10 @@ static int max8997_pmic_probe(struct platform_device *pdev)struct max8997_dev *iodev =dev_get_drvdata (pdev->dev.parent);struct max8997_platform_data *pdata = iodev->pdata;struct regulator_config config = { }; -struct regulator_dev **rdev; +struct regulator_dev *rdev;struct max8997_data *max8997;struct i2c_client *i2c; -int i, ret, size, nr_dvs; +int i, ret, nr_dvs;u8 max_buck1 =0 , max_buck2 =0 , max_buck5 =0 ;if (!pdata) {
@@ -1051,12 +1050,6 @@ static int max8997_pmic_probe(struct platform_device *pdev)if (!max8997)return -ENOMEM ; - size =sizeof (struct regulator_dev *) * pdata->num_regulators; - max8997->rdev =devm_kzalloc (&pdev->dev, size,GFP_KERNEL ); -if (!max8997->rdev) -return -ENOMEM ; - - rdev = max8997->rdev; max8997->dev = &pdev->dev; max8997->iodev = iodev; max8997->num_regulators = pdata->num_regulators;
@@ -1204,12 +1197,12 @@ static int max8997_pmic_probe(struct platform_device *pdev) config.driver_data = max8997; config.of_node = pdata->regulators[i].reg_node; - rdev[i] =devm_regulator_register (&pdev->dev, ®ulators[id], - &config); -if (IS_ERR (rdev[i])) { + rdev =devm_regulator_register (&pdev->dev, ®ulators[id], + &config); +if (IS_ERR (rdev)) {dev_err (max8997->dev,"regulator init failed for %d\n" , id); -return PTR_ERR (rdev[i]); +return PTR_ERR (rdev); } }
Signature · 1 line
1.8.1.2
PATCH 3/3 regulator: max8998: Remove unnecessary **rdev from struct max8998_data
In reply to Axel LinNow we are using devm_regulator_register(), so we don't need to allocate *rdev[] array to store return value of devm_regulator_register. Use a *rdev variable is enough for checking return status.
--- drivers/regulator/max8998.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-)
drivers/regulator/max8998.c +6 -14
@@ -40,7 +40,6 @@ struct max8998_data {struct device *dev;struct max8998_dev *iodev;int num_regulators; -struct regulator_dev **rdev;u8 buck1_vol[4 ];/* voltages for selection */ u8 buck2_vol[2 ];unsigned int buck1_idx;/* index to last changed voltage */
@@ -746,10 +745,10 @@ static int max8998_pmic_probe(struct platform_device *pdev)struct max8998_dev *iodev =dev_get_drvdata (pdev->dev.parent);struct max8998_platform_data *pdata = iodev->pdata;struct regulator_config config = { }; -struct regulator_dev **rdev; +struct regulator_dev *rdev;struct max8998_data *max8998;struct i2c_client *i2c; -int i, ret, size; +int i, ret;unsigned int v;if (!pdata) {
@@ -768,12 +767,6 @@ static int max8998_pmic_probe(struct platform_device *pdev)if (!max8998)return -ENOMEM ; - size =sizeof (struct regulator_dev *) * pdata->num_regulators; - max8998->rdev =devm_kzalloc (&pdev->dev, size,GFP_KERNEL ); -if (!max8998->rdev) -return -ENOMEM ; - - rdev = max8998->rdev; max8998->dev = &pdev->dev; max8998->iodev = iodev; max8998->num_regulators = pdata->num_regulators;
@@ -877,13 +870,12 @@ static int max8998_pmic_probe(struct platform_device *pdev) config.init_data = pdata->regulators[i].initdata; config.driver_data = max8998; - rdev[i] =devm_regulator_register (&pdev->dev, - ®ulators[index], &config); -if (IS_ERR (rdev[i])) { - ret =PTR_ERR (rdev[i]); + rdev =devm_regulator_register (&pdev->dev, ®ulators[index], + &config); +if (IS_ERR (rdev)) { + ret =PTR_ERR (rdev);dev_err (max8998->dev,"regulator %s init failed (%d)\n" , regulators[index].name, ret); - rdev[i] =NULL ;return ret; } }
Signature · 1 line
1.8.1.2
Re: [PATCH 2/3] regulator: max8997: Remove unnecessary **rdev from struct max8997_data
In reply to Axel LinQuoted 3 lines · Axel Lin
Now we are using
devm_regulator_register(), so we don't need to allocate *rdev[] array to store return value ofdevm_regulator_register. Use a *rdev variable is enough for checking return status.
Applied, thanks.
Re: [PATCH 3/3] regulator: max8998: Remove unnecessary **rdev from struct max8998_data
In reply to Axel LinQuoted 3 lines · Axel Lin
Now we are using
devm_regulator_register(), so we don't need to allocate *rdev[] array to store return value ofdevm_regulator_register. Use a *rdev variable is enough for checking return status.
Applied, thanks.
Mark Brown
maintainerQuoted 3 lines · Axel Lin
Now we are using
devm_regulator_register(), so we don't need to allocate *rdev[] array to store return value ofdevm_regulator_register. Use a *rdev variable is enough for checking return status.
This doesn't apply with Krzysztof's recent (and more comprehensive) patch - I think it's now redundant though? If not can you please resubmit against current code.