regulator: max77693: Remove state container as it is not needed

Don't store pointers to regulator_dev returned by
devm_regulator_register() in allocated memory in state container. They
aren't used anywhere outside of max77693_pmic_probe() function.

This change allows removing completely the 'struct max77693_pmic_dev'
state container as none of its fields are used outside of probe.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
This commit is contained in:
Krzysztof Kozlowski 2014-03-10 09:32:46 +01:00 коммит произвёл Mark Brown
Родитель d9aa5c5631
Коммит 640c24a77b
1 изменённых файлов: 6 добавлений и 31 удалений

Просмотреть файл

@ -34,13 +34,6 @@
#define CHGIN_ILIM_STEP_20mA 20000
struct max77693_pmic_dev {
struct device *dev;
struct max77693_dev *iodev;
int num_regulators;
struct regulator_dev **rdev;
};
/* CHARGER regulator ops */
/* CHARGER regulator uses two bits for enabling */
static int max77693_chg_is_enabled(struct regulator_dev *rdev)
@ -232,7 +225,6 @@ static int max77693_pmic_init_rdata(struct device *dev,
static int max77693_pmic_probe(struct platform_device *pdev)
{
struct max77693_dev *iodev = dev_get_drvdata(pdev->dev.parent);
struct max77693_pmic_dev *max77693_pmic;
struct max77693_regulator_data *rdata = NULL;
int num_rdata, i;
struct regulator_config config;
@ -243,39 +235,22 @@ static int max77693_pmic_probe(struct platform_device *pdev)
return -ENODEV;
}
max77693_pmic = devm_kzalloc(&pdev->dev,
sizeof(struct max77693_pmic_dev),
GFP_KERNEL);
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;
config.dev = &pdev->dev;
config.regmap = iodev->regmap;
config.driver_data = max77693_pmic;
platform_set_drvdata(pdev, max77693_pmic);
for (i = 0; i < max77693_pmic->num_regulators; i++) {
for (i = 0; i < num_rdata; i++) {
int id = rdata[i].id;
struct regulator_dev *rdev;
config.init_data = rdata[i].initdata;
config.of_node = rdata[i].of_node;
max77693_pmic->rdev[i] = devm_regulator_register(&pdev->dev,
rdev = devm_regulator_register(&pdev->dev,
&regulators[id], &config);
if (IS_ERR(max77693_pmic->rdev[i])) {
dev_err(max77693_pmic->dev,
if (IS_ERR(rdev)) {
dev_err(&pdev->dev,
"Failed to initialize regulator-%d\n", id);
return PTR_ERR(max77693_pmic->rdev[i]);
return PTR_ERR(rdev);
}
}