diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-04-03 19:50:22 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-04-09 07:37:09 -0400 |
commit | c172708d38a401b2f3f841dfcd862b469fa0b670 (patch) | |
tree | 75e89c63fd0c76a2c69bb5ad6e45b3762bceb6b6 /drivers/regulator/fixed.c | |
parent | 1474e4dbcae04125ed6e503eadcef266846f4675 (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/fixed.c')
-rw-r--r-- | drivers/regulator/fixed.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c index 9a7d70a9c8d7..b47b005a8d28 100644 --- a/drivers/regulator/fixed.c +++ b/drivers/regulator/fixed.c | |||
@@ -167,6 +167,7 @@ static int __devinit reg_fixed_voltage_probe(struct platform_device *pdev) | |||
167 | { | 167 | { |
168 | struct fixed_voltage_config *config; | 168 | struct fixed_voltage_config *config; |
169 | struct fixed_voltage_data *drvdata; | 169 | struct fixed_voltage_data *drvdata; |
170 | struct regulator_config cfg = { }; | ||
170 | int ret; | 171 | int ret; |
171 | 172 | ||
172 | if (pdev->dev.of_node) | 173 | if (pdev->dev.of_node) |
@@ -247,9 +248,12 @@ static int __devinit reg_fixed_voltage_probe(struct platform_device *pdev) | |||
247 | drvdata->desc.ops = &fixed_voltage_ops; | 248 | drvdata->desc.ops = &fixed_voltage_ops; |
248 | } | 249 | } |
249 | 250 | ||
250 | drvdata->dev = regulator_register(&drvdata->desc, &pdev->dev, | 251 | cfg.dev = &pdev->dev; |
251 | config->init_data, drvdata, | 252 | cfg.init_data = config->init_data; |
252 | pdev->dev.of_node); | 253 | cfg.driver_data = drvdata; |
254 | cfg.of_node = pdev->dev.of_node; | ||
255 | |||
256 | drvdata->dev = regulator_register(&drvdata->desc, &cfg); | ||
253 | if (IS_ERR(drvdata->dev)) { | 257 | if (IS_ERR(drvdata->dev)) { |
254 | ret = PTR_ERR(drvdata->dev); | 258 | ret = PTR_ERR(drvdata->dev); |
255 | dev_err(&pdev->dev, "Failed to register regulator: %d\n", ret); | 259 | dev_err(&pdev->dev, "Failed to register regulator: %d\n", ret); |