]> git.karo-electronics.de Git - linux-beck.git/commitdiff
staging: nvec: add remove function to nvec childs
authorMarc Dietrich <marvin24@gmx.de>
Sun, 24 Jun 2012 21:25:21 +0000 (23:25 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 25 Jun 2012 17:55:38 +0000 (10:55 -0700)
This patch cleanups registered devices on remove.

Signed-off-by: Marc Dietrich <marvin24@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/nvec/nvec_kbd.c
drivers/staging/nvec/nvec_power.c
drivers/staging/nvec/nvec_ps2.c

index 36ef6a6b01af98a4b8a941ce63e2494441b06a13..6cc30dcd8306506a4115d96a22440b09014a1b83 100644 (file)
@@ -159,8 +159,17 @@ fail:
        return err;
 }
 
+static int __devexit nvec_kbd_remove(struct platform_device *pdev)
+{
+       input_unregister_device(keys_dev.input);
+       input_free_device(keys_dev.input);
+
+       return 0;
+}
+
 static struct platform_driver nvec_kbd_driver = {
        .probe  = nvec_kbd_probe,
+       .remove = __devexit_p(nvec_kbd_remove),
        .driver = {
                .name = "nvec-kbd",
                .owner = THIS_MODULE,
index 063f6d5e8ab1f94101bf146943e7f18d14ab8a84..cc8ccd75e7f4ab879e4e79803540aefd42606cb2 100644 (file)
@@ -407,8 +407,25 @@ static int __devinit nvec_power_probe(struct platform_device *pdev)
        return power_supply_register(&pdev->dev, psy);
 }
 
+static int __devexit nvec_power_remove(struct platform_device *pdev)
+{
+       struct nvec_power *power = platform_get_drvdata(pdev);
+
+       cancel_delayed_work_sync(&power->poller);
+       switch (pdev->id) {
+       case AC:
+               power_supply_unregister(&nvec_psy);
+               break;
+       case BAT:
+               power_supply_unregister(&nvec_bat_psy);
+       }
+
+       return 0;
+}
+
 static struct platform_driver nvec_power_driver = {
        .probe = nvec_power_probe,
+       .remove = __devexit_p(nvec_power_remove),
        .driver = {
                   .name = "nvec-power",
                   .owner = THIS_MODULE,
index 2481df2d3bfcfc179f9c00dc55a49cfeb44b0c87..d7c65110213111e76702601b2d89d4ba6618fecc 100644 (file)
@@ -123,6 +123,13 @@ static int __devinit nvec_mouse_probe(struct platform_device *pdev)
        return 0;
 }
 
+static int __devexit nvec_mouse_remove(struct platform_device *pdev)
+{
+       serio_unregister_port(ps2_dev.ser_dev);
+
+       return 0;
+}
+
 #ifdef CONFIG_PM_SLEEP
 static int nvec_mouse_suspend(struct device *dev)
 {
@@ -157,6 +164,7 @@ static const SIMPLE_DEV_PM_OPS(nvec_mouse_pm_ops, nvec_mouse_suspend,
 
 static struct platform_driver nvec_mouse_driver = {
        .probe  = nvec_mouse_probe,
+       .remove = __devexit_p(nvec_mouse_remove),
        .driver = {
                .name = "nvec-mouse",
                .owner = THIS_MODULE,