staging: android: ion_test: unregister the misc device
authorPhong Tran <tranmanphong@gmail.com>
Fri, 3 Apr 2015 14:07:01 +0000 (21:07 +0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 8 May 2015 07:24:08 +0000 (09:24 +0200)
Add the remove() method for deregister from misc device
when it's unloaded.

Signed-off-by: Phong Tran <tranmanphong@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/android/ion/ion_test.c

index 3bc461cbbfa3d06fc9f5c2dfc292eef8a34edbd6..052d5e2177e7fa231fa8833b09b5d727fca1d478 100644 (file)
@@ -261,7 +261,19 @@ static int __init ion_test_probe(struct platform_device *pdev)
        return 0;
 }
 
+static int ion_test_remove(struct platform_device *pdev)
+{
+       struct ion_test_device *testdev;
+
+       testdev = platform_get_drvdata(pdev);
+       if (!testdev)
+               return -ENODATA;
+
+       return misc_deregister(&testdev->misc);
+}
+
 static struct platform_driver ion_test_platform_driver = {
+       .remove = ion_test_remove,
        .driver = {
                .name = "ion-test",
        },