Regulators: wm8994 - clean up driver data after removal
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Wed, 24 Feb 2010 07:38:44 +0000 (23:38 -0800)
committerLiam Girdwood <lrg@slimlogic.co.uk>
Wed, 3 Mar 2010 14:49:29 +0000 (14:49 +0000)
It is a good tone to reset driver data after unbinding the device.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
drivers/regulator/wm8994-regulator.c

index d09e018b317739b7a685dc39bb0fd2ee42de019c..95454a4637b7ef771c426d0540df313afe5fe087 100644 (file)
@@ -26,7 +26,7 @@
 
 struct wm8994_ldo {
        int enable;
-       int is_enabled;
+       bool is_enabled;
        struct regulator_dev *regulator;
        struct wm8994 *wm8994;
 };
@@ -43,7 +43,7 @@ static int wm8994_ldo_enable(struct regulator_dev *rdev)
                return 0;
 
        gpio_set_value(ldo->enable, 1);
-       ldo->is_enabled = 1;
+       ldo->is_enabled = true;
 
        return 0;
 }
@@ -57,7 +57,7 @@ static int wm8994_ldo_disable(struct regulator_dev *rdev)
                return -EINVAL;
 
        gpio_set_value(ldo->enable, 0);
-       ldo->is_enabled = 0;
+       ldo->is_enabled = false;
 
        return 0;
 }
@@ -218,7 +218,7 @@ static __devinit int wm8994_ldo_probe(struct platform_device *pdev)
 
        ldo->wm8994 = wm8994;
 
-       ldo->is_enabled = 1;
+       ldo->is_enabled = true;
 
        if (pdata->ldo[id].enable && gpio_is_valid(pdata->ldo[id].enable)) {
                ldo->enable = pdata->ldo[id].enable;
@@ -263,6 +263,8 @@ static __devexit int wm8994_ldo_remove(struct platform_device *pdev)
 {
        struct wm8994_ldo *ldo = platform_get_drvdata(pdev);
 
+       platform_set_drvdata(pdev, NULL);
+
        regulator_unregister(ldo->regulator);
        if (gpio_is_valid(ldo->enable))
                gpio_free(ldo->enable);
@@ -276,6 +278,7 @@ static struct platform_driver wm8994_ldo_driver = {
        .remove = __devexit_p(wm8994_ldo_remove),
        .driver         = {
                .name   = "wm8994-ldo",
+               .owner  = THIS_MODULE,
        },
 };