Commit 67f76a93 authored by Krzysztof Kozlowski's avatar Krzysztof Kozlowski Committed by Mark Brown

regulator: max8660: Remove regulator_dev pointer from state container

Don't store pointer to regulator_dev returned by
devm_regulator_register() in state container. It isn't used anywhere
outside of max8660_probe() function.
Signed-off-by: default avatarKrzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
parent cde248f9
...@@ -81,7 +81,6 @@ enum { ...@@ -81,7 +81,6 @@ enum {
struct max8660 { struct max8660 {
struct i2c_client *client; struct i2c_client *client;
u8 shadow_regs[MAX8660_N_REGS]; /* as chip is write only */ u8 shadow_regs[MAX8660_N_REGS]; /* as chip is write only */
struct regulator_dev *rdev[];
}; };
static int max8660_write(struct max8660 *max8660, u8 reg, u8 mask, u8 val) static int max8660_write(struct max8660 *max8660, u8 reg, u8 mask, u8 val)
...@@ -374,7 +373,6 @@ static inline int max8660_pdata_from_dt(struct device *dev, ...@@ -374,7 +373,6 @@ static inline int max8660_pdata_from_dt(struct device *dev,
static int max8660_probe(struct i2c_client *client, static int max8660_probe(struct i2c_client *client,
const struct i2c_device_id *i2c_id) const struct i2c_device_id *i2c_id)
{ {
struct regulator_dev **rdev;
struct device *dev = &client->dev; struct device *dev = &client->dev;
struct max8660_platform_data *pdata = dev_get_platdata(dev); struct max8660_platform_data *pdata = dev_get_platdata(dev);
struct regulator_config config = { }; struct regulator_config config = { };
...@@ -407,14 +405,11 @@ static int max8660_probe(struct i2c_client *client, ...@@ -407,14 +405,11 @@ static int max8660_probe(struct i2c_client *client,
return -EINVAL; return -EINVAL;
} }
max8660 = devm_kzalloc(dev, sizeof(struct max8660) + max8660 = devm_kzalloc(dev, sizeof(struct max8660), GFP_KERNEL);
sizeof(struct regulator_dev *) * MAX8660_V_END,
GFP_KERNEL);
if (!max8660) if (!max8660)
return -ENOMEM; return -ENOMEM;
max8660->client = client; max8660->client = client;
rdev = max8660->rdev;
if (pdata->en34_is_high) { if (pdata->en34_is_high) {
/* Simulate always on */ /* Simulate always on */
...@@ -482,6 +477,7 @@ static int max8660_probe(struct i2c_client *client, ...@@ -482,6 +477,7 @@ static int max8660_probe(struct i2c_client *client,
/* Finally register devices */ /* Finally register devices */
for (i = 0; i < pdata->num_subdevs; i++) { for (i = 0; i < pdata->num_subdevs; i++) {
struct regulator_dev *rdev;
id = pdata->subdevs[i].id; id = pdata->subdevs[i].id;
...@@ -490,13 +486,13 @@ static int max8660_probe(struct i2c_client *client, ...@@ -490,13 +486,13 @@ static int max8660_probe(struct i2c_client *client,
config.of_node = of_node[i]; config.of_node = of_node[i];
config.driver_data = max8660; config.driver_data = max8660;
rdev[i] = devm_regulator_register(&client->dev, rdev = devm_regulator_register(&client->dev,
&max8660_reg[id], &config); &max8660_reg[id], &config);
if (IS_ERR(rdev[i])) { if (IS_ERR(rdev)) {
ret = PTR_ERR(rdev[i]); ret = PTR_ERR(rdev);
dev_err(&client->dev, "failed to register %s\n", dev_err(&client->dev, "failed to register %s\n",
max8660_reg[id].name); max8660_reg[id].name);
return PTR_ERR(rdev[i]); return PTR_ERR(rdev);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment