lkml.org 
[lkml]   [2015]   [Apr]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 3/3] staging: android: ion_test: unregister the platform device
Date
The driver has to unregister from platform device when it's unloaded

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

diff --git a/drivers/staging/android/ion/ion_test.c b/drivers/staging/android/ion/ion_test.c
index f36a35e..d2a236e 100644
--- a/drivers/staging/android/ion/ion_test.c
+++ b/drivers/staging/android/ion/ion_test.c
@@ -278,6 +278,7 @@ static int ion_test_remove(struct platform_device *pdev)
return ret;
}

+static struct platform_device *ion_test_platform_device;
static struct platform_driver ion_test_platform_driver = {
.remove = ion_test_remove,
.driver = {
@@ -287,13 +288,21 @@ 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_platform_device = platform_device_register_simple("ion-test",
+ -1, NULL, 0);
+
+ if (!ion_test_platform_device) {
+ pr_err("failed to register ion-test platform device\n");
+ 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_platform_device);
}

module_init(ion_test_init);
--
2.1.0


\
 
 \ /
  Last update: 2015-04-01 20:21    [W:0.075 / U:0.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site