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>
This commit is contained in:
@@ -185,6 +185,7 @@ static int __devinit max1586_pmic_probe(struct i2c_client *client,
|
||||
{
|
||||
struct regulator_dev **rdev;
|
||||
struct max1586_platform_data *pdata = client->dev.platform_data;
|
||||
struct regulator_config config = { };
|
||||
struct max1586_data *max1586;
|
||||
int i, id, ret = -ENOMEM;
|
||||
|
||||
@@ -212,9 +213,12 @@ static int __devinit max1586_pmic_probe(struct i2c_client *client,
|
||||
dev_err(&client->dev, "invalid regulator id %d\n", id);
|
||||
goto err;
|
||||
}
|
||||
rdev[i] = regulator_register(&max1586_reg[id], &client->dev,
|
||||
pdata->subdevs[i].platform_data,
|
||||
max1586, NULL);
|
||||
|
||||
config.dev = &client->dev;
|
||||
config.init_data = pdata->subdevs[i].platform_data;
|
||||
config.driver_data = max1586;
|
||||
|
||||
rdev[i] = regulator_register(&max1586_reg[id], &config);
|
||||
if (IS_ERR(rdev[i])) {
|
||||
ret = PTR_ERR(rdev[i]);
|
||||
dev_err(&client->dev, "failed to register %s\n",
|
||||
|
Reference in New Issue
Block a user