[PATCH V2 3/3] staging: android: ion_test: unregister the platform device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The driver has to unregister from platform device when it's unloaded

Signed-off-by: Phong Tran <tranmanphong@xxxxxxxxx>
---
 drivers/staging/android/ion/ion_test.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/android/ion/ion_test.c b/drivers/staging/android/ion/ion_test.c
index d6a9653..24fd77d3 100644
--- a/drivers/staging/android/ion/ion_test.c
+++ b/drivers/staging/android/ion/ion_test.c
@@ -272,6 +272,7 @@ static int ion_test_remove(struct platform_device *pdev)
 	return  misc_deregister(&testdev->misc);
 }
 
+static struct platform_device *ion_test_pdev;
 static struct platform_driver ion_test_platform_driver = {
 	.remove = ion_test_remove,
 	.driver = {
@@ -281,13 +282,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);
-- 
2.1.0

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux