regulator: rk818: remove the repeated operations.
authorShengfei xu <xsf@rock-chips.com>
Wed, 27 Jan 2016 09:28:59 +0000 (17:28 +0800)
committerGerrit Code Review <gerrit@rock-chips.com>
Sat, 30 Jan 2016 02:04:44 +0000 (10:04 +0800)
Populates regulator_init_data structure by extracting data from device
tree node, when regulator drivers register a regulator.  so we don't
repeat it.

Change-Id: I481e7c802a24916f15c5b3a5eaf66f32dc0272d7
Signed-off-by: Shengfei xu <xsf@rock-chips.com>
drivers/regulator/rk818-regulator.c

index 6fe92365498aed931fc13ddcb5ee8964ccce0881..30496c6f157d10d0fcc5f42ebc81242bbf6e3048 100644 (file)
@@ -395,43 +395,16 @@ static struct of_regulator_match rk818_reg_matches[] = {
        [RK818_ID_SWITCH]       = { .name = "SWITCH_REG" },
 };
 
-static int rk818_regulator_dt_parse_pdata(struct device *dev,
-                                         struct device *client_dev,
-                                         struct regmap *map)
-{
-       struct device_node *np;
-       int ret;
-
-       np = of_get_child_by_name(client_dev->of_node, "regulators");
-       if (!np)
-               return -ENXIO;
-
-       ret = of_regulator_match(dev, np, rk818_reg_matches,
-                                RK818_NUM_REGULATORS);
-
-       of_node_put(np);
-       return ret;
-}
-
 static int rk818_regulator_probe(struct platform_device *pdev)
 {
        struct rk808 *rk818 = dev_get_drvdata(pdev->dev.parent);
        struct i2c_client *client = rk818->i2c;
        struct regulator_config config = {};
        struct regulator_dev *rk818_rdev;
-       int ret, i;
-
-       ret = rk818_regulator_dt_parse_pdata(&pdev->dev, &client->dev,
-                                            rk818->regmap);
-       if (ret < 0)
-               return ret;
+       int i;
 
        /* Instantiate the regulators */
        for (i = 0; i < RK818_NUM_REGULATORS; i++) {
-               if (!rk818_reg_matches[i].init_data ||
-                   !rk818_reg_matches[i].of_node)
-                       continue;
-
                config.dev = &client->dev;
                config.regmap = rk818->regmap;
                config.of_node = rk818_reg_matches[i].of_node;