aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/ad5398.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/ad5398.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/ad5398.c')
-rw-r--r--drivers/regulator/ad5398.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/regulator/ad5398.c b/drivers/regulator/ad5398.c
index 9ba69c431da8..46d05f38baf8 100644
--- a/drivers/regulator/ad5398.c
+++ b/drivers/regulator/ad5398.c
@@ -212,6 +212,7 @@ static int __devinit ad5398_probe(struct i2c_client *client,
212 const struct i2c_device_id *id) 212 const struct i2c_device_id *id)
213{ 213{
214 struct regulator_init_data *init_data = client->dev.platform_data; 214 struct regulator_init_data *init_data = client->dev.platform_data;
215 struct regulator_config config = { };
215 struct ad5398_chip_info *chip; 216 struct ad5398_chip_info *chip;
216 const struct ad5398_current_data_format *df = 217 const struct ad5398_current_data_format *df =
217 (struct ad5398_current_data_format *)id->driver_data; 218 (struct ad5398_current_data_format *)id->driver_data;
@@ -224,6 +225,10 @@ static int __devinit ad5398_probe(struct i2c_client *client,
224 if (!chip) 225 if (!chip)
225 return -ENOMEM; 226 return -ENOMEM;
226 227
228 config.dev = &client->dev;
229 config.init_data = init_data;
230 config.driver_data = chip;
231
227 chip->client = client; 232 chip->client = client;
228 233
229 chip->min_uA = df->min_uA; 234 chip->min_uA = df->min_uA;
@@ -232,8 +237,7 @@ static int __devinit ad5398_probe(struct i2c_client *client,
232 chip->current_offset = df->current_offset; 237 chip->current_offset = df->current_offset;
233 chip->current_mask = (chip->current_level - 1) << chip->current_offset; 238 chip->current_mask = (chip->current_level - 1) << chip->current_offset;
234 239
235 chip->rdev = regulator_register(&ad5398_reg, &client->dev, 240 chip->rdev = regulator_register(&ad5398_reg, &config);
236 init_data, chip, NULL);
237 if (IS_ERR(chip->rdev)) { 241 if (IS_ERR(chip->rdev)) {
238 ret = PTR_ERR(chip->rdev); 242 ret = PTR_ERR(chip->rdev);
239 dev_err(&client->dev, "failed to register %s %s\n", 243 dev_err(&client->dev, "failed to register %s %s\n",