These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / drivers / staging / android / ion / ion_test.c
index 3bc461c..b8dcf5a 100644 (file)
@@ -261,7 +261,21 @@ 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;
+
+       misc_deregister(&testdev->misc);
+       return 0;
+}
+
+static struct platform_device *ion_test_pdev;
 static struct platform_driver ion_test_platform_driver = {
+       .remove = ion_test_remove,
        .driver = {
                .name = "ion-test",
        },
@@ -269,13 +283,18 @@ static struct platform_driver ion_test_platform_driver = {
 
 static int __init ion_test_init(void)
 {
-       platform_device_register_simple("ion-test", -1, NULL, 0);
+       ion_test_pdev = platform_device_register_simple("ion-test",
+                                                       -1, NULL, 0);
+       if (!ion_test_pdev)
+               return -ENODEV;
+
        return platform_driver_probe(&ion_test_platform_driver, ion_test_probe);
 }
 
 static void __exit ion_test_exit(void)
 {
        platform_driver_unregister(&ion_test_platform_driver);
+       platform_device_unregister(ion_test_pdev);
 }
 
 module_init(ion_test_init);