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 2/3] staging: android: ion_test: unregister the misc device
Date
Add the remove() method for deregister from misc device
when it's unloaded.

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

diff --git a/drivers/staging/android/ion/ion_test.c b/drivers/staging/android/ion/ion_test.c
index 3bc461c..f36a35e 100644
--- a/drivers/staging/android/ion/ion_test.c
+++ b/drivers/staging/android/ion/ion_test.c
@@ -261,7 +261,25 @@ static int __init ion_test_probe(struct platform_device *pdev)
return 0;
}

+static int ion_test_remove(struct platform_device *pdev)
+{
+ int ret = 0;
+ struct ion_test_device *testdev;
+
+ testdev = platform_get_drvdata(pdev);
+
+ if (!testdev) {
+ pr_err("failed to get pdev data.\n");
+ return -ENODATA;
+ }
+
+ ret = misc_deregister(&testdev->misc);
+
+ return ret;
+}
+
static struct platform_driver ion_test_platform_driver = {
+ .remove = ion_test_remove,
.driver = {
.name = "ion-test",
},
--
2.1.0


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