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:
@@ -574,6 +574,7 @@ ab3100_regulator_desc[AB3100_NUM_REGULATORS] = {
|
||||
static int __devinit ab3100_regulators_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct ab3100_platform_data *plfdata = pdev->dev.platform_data;
|
||||
struct regulator_config config = { };
|
||||
int err = 0;
|
||||
u8 data;
|
||||
int i;
|
||||
@@ -619,15 +620,15 @@ static int __devinit ab3100_regulators_probe(struct platform_device *pdev)
|
||||
reg->dev = &pdev->dev;
|
||||
reg->plfdata = plfdata;
|
||||
|
||||
config.dev = &pdev->dev;
|
||||
config.driver_data = reg;
|
||||
config.init_data = &plfdata->reg_constraints[i];
|
||||
|
||||
/*
|
||||
* Register the regulator, pass around
|
||||
* the ab3100_regulator struct
|
||||
*/
|
||||
rdev = regulator_register(&ab3100_regulator_desc[i],
|
||||
&pdev->dev,
|
||||
&plfdata->reg_constraints[i],
|
||||
reg, NULL);
|
||||
|
||||
rdev = regulator_register(&ab3100_regulator_desc[i], &config);
|
||||
if (IS_ERR(rdev)) {
|
||||
err = PTR_ERR(rdev);
|
||||
dev_err(&pdev->dev,
|
||||
|
Reference in New Issue
Block a user