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>
Cette révision appartient à :
Mark Brown
2012-04-04 00:50:22 +01:00
Parent 1474e4dbca
révision c172708d38
45 fichiers modifiés avec 331 ajouts et 120 suppressions

Voir le fichier

@@ -327,13 +327,17 @@ static int __devinit tps65217_regulator_probe(struct platform_device *pdev)
struct regulator_dev *rdev;
struct tps65217 *tps;
struct tps_info *info = &tps65217_pmic_regs[pdev->id];
struct regulator_config config = { };
/* Already set by core driver */
tps = dev_to_tps65217(pdev->dev.parent);
tps->info[pdev->id] = info;
rdev = regulator_register(&regulators[pdev->id], &pdev->dev,
pdev->dev.platform_data, tps, NULL);
config.dev = &pdev->dev;
config.init_data = pdev->dev.platform_data;
config.driver_data = tps;
rdev = regulator_register(&regulators[pdev->id], &config);
if (IS_ERR(rdev))
return PTR_ERR(rdev);