aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/wm831x-isink.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/wm831x-isink.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/wm831x-isink.c')
-rw-r--r--drivers/regulator/wm831x-isink.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/regulator/wm831x-isink.c b/drivers/regulator/wm831x-isink.c
index 634aac3f2d5f..046fabf648d2 100644
--- a/drivers/regulator/wm831x-isink.c
+++ b/drivers/regulator/wm831x-isink.c
@@ -154,6 +154,7 @@ static __devinit int wm831x_isink_probe(struct platform_device *pdev)
154 struct wm831x_pdata *pdata = wm831x->dev->platform_data; 154 struct wm831x_pdata *pdata = wm831x->dev->platform_data;
155 struct wm831x_isink *isink; 155 struct wm831x_isink *isink;
156 int id = pdev->id % ARRAY_SIZE(pdata->isink); 156 int id = pdev->id % ARRAY_SIZE(pdata->isink);
157 struct regulator_config config = { };
157 struct resource *res; 158 struct resource *res;
158 int ret, irq; 159 int ret, irq;
159 160
@@ -189,8 +190,11 @@ static __devinit int wm831x_isink_probe(struct platform_device *pdev)
189 isink->desc.type = REGULATOR_CURRENT; 190 isink->desc.type = REGULATOR_CURRENT;
190 isink->desc.owner = THIS_MODULE; 191 isink->desc.owner = THIS_MODULE;
191 192
192 isink->regulator = regulator_register(&isink->desc, &pdev->dev, 193 config.dev = pdev->dev.parent;
193 pdata->isink[id], isink, NULL); 194 config.init_data = pdata->isink[id];
195 config.driver_data = isink;
196
197 isink->regulator = regulator_register(&isink->desc, &config);
194 if (IS_ERR(isink->regulator)) { 198 if (IS_ERR(isink->regulator)) {
195 ret = PTR_ERR(isink->regulator); 199 ret = PTR_ERR(isink->regulator);
196 dev_err(wm831x->dev, "Failed to register ISINK%d: %d\n", 200 dev_err(wm831x->dev, "Failed to register ISINK%d: %d\n",