aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/max1586.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2012-04-03 19:50:22 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-04-09 07:37:09 -0400
commitc172708d38a401b2f3f841dfcd862b469fa0b670 (patch)
tree75e89c63fd0c76a2c69bb5ad6e45b3762bceb6b6 /drivers/regulator/max1586.c
parent1474e4dbcae04125ed6e503eadcef266846f4675 (diff)
regulator: core: Use a struct to pass in regulator runtime configuration
Rather than adding new arguments to regulator_register() every time we want to add a new bit of dynamic information at runtime change the function to take these via a struct. By doing this we avoid needing to do further changes like the recent addition of device tree support which required each regulator driver to be updated to take an additional parameter. The regulator_desc which should (mostly) be static data is still passed separately as most drivers are able to configure this statically at build time. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/regulator/max1586.c')
-rw-r--r--drivers/regulator/max1586.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/regulator/max1586.c b/drivers/regulator/max1586.c
index fad0bee10c54..ea832b4ef643 100644
--- a/drivers/regulator/max1586.c
+++ b/drivers/regulator/max1586.c
@@ -185,6 +185,7 @@ static int __devinit max1586_pmic_probe(struct i2c_client *client,
185{ 185{
186 struct regulator_dev **rdev; 186 struct regulator_dev **rdev;
187 struct max1586_platform_data *pdata = client->dev.platform_data; 187 struct max1586_platform_data *pdata = client->dev.platform_data;
188 struct regulator_config config = { };
188 struct max1586_data *max1586; 189 struct max1586_data *max1586;
189 int i, id, ret = -ENOMEM; 190 int i, id, ret = -ENOMEM;
190 191
@@ -212,9 +213,12 @@ static int __devinit max1586_pmic_probe(struct i2c_client *client,
212 dev_err(&client->dev, "invalid regulator id %d\n", id); 213 dev_err(&client->dev, "invalid regulator id %d\n", id);
213 goto err; 214 goto err;
214 } 215 }
215 rdev[i] = regulator_register(&max1586_reg[id], &client->dev, 216
216 pdata->subdevs[i].platform_data, 217 config.dev = &client->dev;
217 max1586, NULL); 218 config.init_data = pdata->subdevs[i].platform_data;
219 config.driver_data = max1586;
220
221 rdev[i] = regulator_register(&max1586_reg[id], &config);
218 if (IS_ERR(rdev[i])) { 222 if (IS_ERR(rdev[i])) {
219 ret = PTR_ERR(rdev[i]); 223 ret = PTR_ERR(rdev[i]);
220 dev_err(&client->dev, "failed to register %s\n", 224 dev_err(&client->dev, "failed to register %s\n",