Commit 598b3578 authored by Dmitry Torokhov's avatar Dmitry Torokhov Committed by Liam Girdwood

Regulators: wm8994 - clean up driver data after removal

It is a good tone to reset driver data after unbinding the device.
Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
Acked-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: default avatarLiam Girdwood <lrg@slimlogic.co.uk>
parent eb66d565
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
struct wm8994_ldo { struct wm8994_ldo {
int enable; int enable;
int is_enabled; bool is_enabled;
struct regulator_dev *regulator; struct regulator_dev *regulator;
struct wm8994 *wm8994; struct wm8994 *wm8994;
}; };
...@@ -43,7 +43,7 @@ static int wm8994_ldo_enable(struct regulator_dev *rdev) ...@@ -43,7 +43,7 @@ static int wm8994_ldo_enable(struct regulator_dev *rdev)
return 0; return 0;
gpio_set_value(ldo->enable, 1); gpio_set_value(ldo->enable, 1);
ldo->is_enabled = 1; ldo->is_enabled = true;
return 0; return 0;
} }
...@@ -57,7 +57,7 @@ static int wm8994_ldo_disable(struct regulator_dev *rdev) ...@@ -57,7 +57,7 @@ static int wm8994_ldo_disable(struct regulator_dev *rdev)
return -EINVAL; return -EINVAL;
gpio_set_value(ldo->enable, 0); gpio_set_value(ldo->enable, 0);
ldo->is_enabled = 0; ldo->is_enabled = false;
return 0; return 0;
} }
...@@ -218,7 +218,7 @@ static __devinit int wm8994_ldo_probe(struct platform_device *pdev) ...@@ -218,7 +218,7 @@ static __devinit int wm8994_ldo_probe(struct platform_device *pdev)
ldo->wm8994 = wm8994; ldo->wm8994 = wm8994;
ldo->is_enabled = 1; ldo->is_enabled = true;
if (pdata->ldo[id].enable && gpio_is_valid(pdata->ldo[id].enable)) { if (pdata->ldo[id].enable && gpio_is_valid(pdata->ldo[id].enable)) {
ldo->enable = pdata->ldo[id].enable; ldo->enable = pdata->ldo[id].enable;
...@@ -263,6 +263,8 @@ static __devexit int wm8994_ldo_remove(struct platform_device *pdev) ...@@ -263,6 +263,8 @@ static __devexit int wm8994_ldo_remove(struct platform_device *pdev)
{ {
struct wm8994_ldo *ldo = platform_get_drvdata(pdev); struct wm8994_ldo *ldo = platform_get_drvdata(pdev);
platform_set_drvdata(pdev, NULL);
regulator_unregister(ldo->regulator); regulator_unregister(ldo->regulator);
if (gpio_is_valid(ldo->enable)) if (gpio_is_valid(ldo->enable))
gpio_free(ldo->enable); gpio_free(ldo->enable);
...@@ -276,6 +278,7 @@ static struct platform_driver wm8994_ldo_driver = { ...@@ -276,6 +278,7 @@ static struct platform_driver wm8994_ldo_driver = {
.remove = __devexit_p(wm8994_ldo_remove), .remove = __devexit_p(wm8994_ldo_remove),
.driver = { .driver = {
.name = "wm8994-ldo", .name = "wm8994-ldo",
.owner = THIS_MODULE,
}, },
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment