Commit 81fb0b90 authored by Phong Tran's avatar Phong Tran Committed by Greg Kroah-Hartman

staging: android: ion_test: unregister the platform device

The driver has to unregister from platform device when it's unloaded
Signed-off-by: default avatarPhong Tran <tranmanphong@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 954c2d8f
...@@ -272,6 +272,7 @@ static int ion_test_remove(struct platform_device *pdev) ...@@ -272,6 +272,7 @@ static int ion_test_remove(struct platform_device *pdev)
return misc_deregister(&testdev->misc); return misc_deregister(&testdev->misc);
} }
static struct platform_device *ion_test_pdev;
static struct platform_driver ion_test_platform_driver = { static struct platform_driver ion_test_platform_driver = {
.remove = ion_test_remove, .remove = ion_test_remove,
.driver = { .driver = {
...@@ -281,13 +282,18 @@ static struct platform_driver ion_test_platform_driver = { ...@@ -281,13 +282,18 @@ static struct platform_driver ion_test_platform_driver = {
static int __init ion_test_init(void) 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); return platform_driver_probe(&ion_test_platform_driver, ion_test_probe);
} }
static void __exit ion_test_exit(void) static void __exit ion_test_exit(void)
{ {
platform_driver_unregister(&ion_test_platform_driver); platform_driver_unregister(&ion_test_platform_driver);
platform_device_unregister(ion_test_pdev);
} }
module_init(ion_test_init); module_init(ion_test_init);
......
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