regulator: rc5t583: Get rid of struct rc5t583_regulator

The struct rc5t583_regulator only has 2 members, the *rdev is no longer
used because this driver is using devm_regulator_register now. After remove
*rdev, only *reg_info left. We can use struct rc5t583_regulator_info
directly, so remove struct rc5t583_regulator.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Axel Lin 2019-03-27 19:54:13 +08:00 committed by Mark Brown
parent 7cae255d27
commit c07608f737
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
1 changed files with 3 additions and 22 deletions

View File

@ -47,18 +47,13 @@ struct rc5t583_regulator_info {
struct regulator_desc desc; struct regulator_desc desc;
}; };
struct rc5t583_regulator {
struct rc5t583_regulator_info *reg_info;
struct regulator_dev *rdev;
};
static int rc5t583_regulator_enable_time(struct regulator_dev *rdev) static int rc5t583_regulator_enable_time(struct regulator_dev *rdev)
{ {
struct rc5t583_regulator *reg = rdev_get_drvdata(rdev); struct rc5t583_regulator_info *reg_info = rdev_get_drvdata(rdev);
int vsel = regulator_get_voltage_sel_regmap(rdev); int vsel = regulator_get_voltage_sel_regmap(rdev);
int curr_uV = regulator_list_voltage_linear(rdev, vsel); int curr_uV = regulator_list_voltage_linear(rdev, vsel);
return DIV_ROUND_UP(curr_uV, reg->reg_info->enable_uv_per_us); return DIV_ROUND_UP(curr_uV, reg_info->enable_uv_per_us);
} }
static const struct regulator_ops rc5t583_ops = { static const struct regulator_ops rc5t583_ops = {
@ -120,8 +115,6 @@ static int rc5t583_regulator_probe(struct platform_device *pdev)
struct rc5t583 *rc5t583 = dev_get_drvdata(pdev->dev.parent); struct rc5t583 *rc5t583 = dev_get_drvdata(pdev->dev.parent);
struct rc5t583_platform_data *pdata = dev_get_platdata(rc5t583->dev); struct rc5t583_platform_data *pdata = dev_get_platdata(rc5t583->dev);
struct regulator_config config = { }; struct regulator_config config = { };
struct rc5t583_regulator *reg = NULL;
struct rc5t583_regulator *regs;
struct regulator_dev *rdev; struct regulator_dev *rdev;
struct rc5t583_regulator_info *ri; struct rc5t583_regulator_info *ri;
int ret; int ret;
@ -132,18 +125,8 @@ static int rc5t583_regulator_probe(struct platform_device *pdev)
return -ENODEV; return -ENODEV;
} }
regs = devm_kcalloc(&pdev->dev,
RC5T583_REGULATOR_MAX,
sizeof(struct rc5t583_regulator),
GFP_KERNEL);
if (!regs)
return -ENOMEM;
for (id = 0; id < RC5T583_REGULATOR_MAX; ++id) { for (id = 0; id < RC5T583_REGULATOR_MAX; ++id) {
reg = &regs[id];
ri = &rc5t583_reg_info[id]; ri = &rc5t583_reg_info[id];
reg->reg_info = ri;
if (ri->deepsleep_id == RC5T583_DS_NONE) if (ri->deepsleep_id == RC5T583_DS_NONE)
goto skip_ext_pwr_config; goto skip_ext_pwr_config;
@ -163,7 +146,7 @@ static int rc5t583_regulator_probe(struct platform_device *pdev)
skip_ext_pwr_config: skip_ext_pwr_config:
config.dev = &pdev->dev; config.dev = &pdev->dev;
config.init_data = pdata->reg_init_data[id]; config.init_data = pdata->reg_init_data[id];
config.driver_data = reg; config.driver_data = ri;
config.regmap = rc5t583->regmap; config.regmap = rc5t583->regmap;
rdev = devm_regulator_register(&pdev->dev, &ri->desc, &config); rdev = devm_regulator_register(&pdev->dev, &ri->desc, &config);
@ -172,9 +155,7 @@ skip_ext_pwr_config:
ri->desc.name); ri->desc.name);
return PTR_ERR(rdev); return PTR_ERR(rdev);
} }
reg->rdev = rdev;
} }
platform_set_drvdata(pdev, regs);
return 0; return 0;
} }