regulator: max77693: Remove state container as it is not needed
authorKrzysztof Kozlowski <k.kozlowski@samsung.com>
Mon, 10 Mar 2014 08:32:46 +0000 (09:32 +0100)
committerMark Brown <broonie@linaro.org>
Mon, 10 Mar 2014 09:31:56 +0000 (09:31 +0000)
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>
drivers/regulator/max77693.c

index d6807fd7eadcda56f22165137d6a159b32d0d712..653a58b49cdff81b3f3ab724bc05e8417d1c913d 100644 (file)
 
 #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);
                }
        }
 
This page took 0.026091 seconds and 5 git commands to generate.