linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] Fix some issues of staging ion test driver
@ 2015-04-01 17:38 Phong Tran
  2015-04-01 17:38 ` [PATCH 1/3] staging: android: ion_test: Add the MODULE_LICENSE macro Phong Tran
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Phong Tran @ 2015-04-01 17:38 UTC (permalink / raw)
  To: gregkh, arve, riandrews; +Cc: devel, linux-kernel, Phong Tran

Hi Greg, Arve, Riley,

This patcheset fixes:
(1) Define the GPL V2 for ion_test driver
(2) Add the remove() platform driver callback to
    deregister the misc device
(3) unregister platform device when driver is unloaded

Phong Tran (3):
  staging: android: ion_test: Add the MODULE_LICENSE macro
  staging: android: ion_test: unregister the misc device
  staging: android: ion_test: unregister the platform device

 drivers/staging/android/ion/ion_test.c | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

-- 
2.1.0


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 1/3] staging: android: ion_test: Add the MODULE_LICENSE macro
  2015-04-01 17:38 [PATCH 0/3] Fix some issues of staging ion test driver Phong Tran
@ 2015-04-01 17:38 ` Phong Tran
  2015-04-01 17:38 ` [PATCH 2/3] staging: android: ion_test: unregister the misc device Phong Tran
  2015-04-01 17:38 ` [PATCH 3/3] staging: android: ion_test: unregister the platform device Phong Tran
  2 siblings, 0 replies; 15+ messages in thread
From: Phong Tran @ 2015-04-01 17:38 UTC (permalink / raw)
  To: gregkh, arve, riandrews; +Cc: devel, linux-kernel, Phong Tran

Base on the file comment should define GPL v2 for ion test driver

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

diff --git a/drivers/staging/android/ion/ion_test.c b/drivers/staging/android/ion/ion_test.c
index 654acb5..3bc461c 100644
--- a/drivers/staging/android/ion/ion_test.c
+++ b/drivers/staging/android/ion/ion_test.c
@@ -280,3 +280,4 @@ static void __exit ion_test_exit(void)
 
 module_init(ion_test_init);
 module_exit(ion_test_exit);
+MODULE_LICENSE("GPL v2");
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 2/3] staging: android: ion_test: unregister the misc device
  2015-04-01 17:38 [PATCH 0/3] Fix some issues of staging ion test driver Phong Tran
  2015-04-01 17:38 ` [PATCH 1/3] staging: android: ion_test: Add the MODULE_LICENSE macro Phong Tran
@ 2015-04-01 17:38 ` Phong Tran
  2015-04-01 22:22   ` Dan Carpenter
  2015-04-01 17:38 ` [PATCH 3/3] staging: android: ion_test: unregister the platform device Phong Tran
  2 siblings, 1 reply; 15+ messages in thread
From: Phong Tran @ 2015-04-01 17:38 UTC (permalink / raw)
  To: gregkh, arve, riandrews; +Cc: devel, linux-kernel, Phong Tran

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


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 3/3] staging: android: ion_test: unregister the platform device
  2015-04-01 17:38 [PATCH 0/3] Fix some issues of staging ion test driver Phong Tran
  2015-04-01 17:38 ` [PATCH 1/3] staging: android: ion_test: Add the MODULE_LICENSE macro Phong Tran
  2015-04-01 17:38 ` [PATCH 2/3] staging: android: ion_test: unregister the misc device Phong Tran
@ 2015-04-01 17:38 ` Phong Tran
  2015-04-01 22:34   ` Dan Carpenter
  2015-04-02 14:36   ` [PATCH V2 0/3] Fix some issues of staging ion test driver Phong Tran
  2 siblings, 2 replies; 15+ messages in thread
From: Phong Tran @ 2015-04-01 17:38 UTC (permalink / raw)
  To: gregkh, arve, riandrews; +Cc: devel, linux-kernel, Phong Tran

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


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH 2/3] staging: android: ion_test: unregister the misc device
  2015-04-01 17:38 ` [PATCH 2/3] staging: android: ion_test: unregister the misc device Phong Tran
@ 2015-04-01 22:22   ` Dan Carpenter
  0 siblings, 0 replies; 15+ messages in thread
From: Dan Carpenter @ 2015-04-01 22:22 UTC (permalink / raw)
  To: Phong Tran; +Cc: gregkh, arve, riandrews, devel, linux-kernel

On Thu, Apr 02, 2015 at 12:38:19AM +0700, Phong Tran wrote:
> 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;

Don't initialize variables if you don't need to.  Just remove the ret
variable completely.

> +	struct ion_test_device *testdev;
> +
> +	testdev = platform_get_drvdata(pdev);
> +
> +	if (!testdev) {

Remove the blank line between the function and the check.  They are part
of the same thing/paragraph.

> +		pr_err("failed to get pdev data.\n");

Just leave this error statement out.  It will never get printed.  It's
just a waste of RAM.  If it were printed the -ENODATA error is unique
to this path so it's all the debug out put we need.

> +		return -ENODATA;
> +	}
> +
> +	ret = misc_deregister(&testdev->misc);
> +
> +	return ret;
	return misc_deregister(&testdev->misc);

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 3/3] staging: android: ion_test: unregister the platform device
  2015-04-01 17:38 ` [PATCH 3/3] staging: android: ion_test: unregister the platform device Phong Tran
@ 2015-04-01 22:34   ` Dan Carpenter
  2015-04-02 14:36   ` [PATCH V2 0/3] Fix some issues of staging ion test driver Phong Tran
  1 sibling, 0 replies; 15+ messages in thread
From: Dan Carpenter @ 2015-04-01 22:34 UTC (permalink / raw)
  To: Phong Tran; +Cc: gregkh, arve, riandrews, devel, linux-kernel

On Thu, Apr 02, 2015 at 12:38:20AM +0700, Phong Tran wrote:
> 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;

This name is too long.  You will run into the 80 character limit.

>  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);

This indenting is off.  It should be:

	ion_test_dev = platform_device_register_simple("ion-test",
						       -1, NULL, 0);

or something similar.

> +
> +	if (!ion_test_platform_device) {
> +		pr_err("failed to register ion-test platform device\n");

People add error messages without thinking about it because they think,
"Obviously, the more error messages the better."  Almost all the bad
things that can happen in platform_device_register_simple() generate
their own error message.

Also platform_driver_probe() doesn't have an error message so it's
possible to leave them out if you want.  Be bold!  Leave out the
message!  Or if you want go ahead and leave it in.  So long as you have
thought about it is what matters.

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH V2 0/3] Fix some issues of staging ion test driver
  2015-04-01 17:38 ` [PATCH 3/3] staging: android: ion_test: unregister the platform device Phong Tran
  2015-04-01 22:34   ` Dan Carpenter
@ 2015-04-02 14:36   ` Phong Tran
  2015-04-02 14:36     ` [PATCH V2 1/3] staging: android: ion_test: Add the MODULE_LICENSE macro Phong Tran
                       ` (3 more replies)
  1 sibling, 4 replies; 15+ messages in thread
From: Phong Tran @ 2015-04-02 14:36 UTC (permalink / raw)
  To: gregkh, arve, riandrews, dan.carpenter; +Cc: devel, linux-kernel, Phong Tran

Hi Greg, Arve, Riley, Dan,

This patcheset fixes:
(1) Define the GPL V2 for ion_test driver
(2) Add the remove() platform driver callback to
    deregister the misc device
(3) unregister platform device when driver is unloaded

Thank for Dan's reivew.

Changes from v1:
	Imporve the coding style

Phong Tran (3):
  staging: android: ion_test: Add the MODULE_LICENSE macro
  staging: android: ion_test: unregister the misc device
  staging: android: ion_test: unregister the platform device

 drivers/staging/android/ion/ion_test.c | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

-- 
2.1.0


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH V2 1/3] staging: android: ion_test: Add the MODULE_LICENSE macro
  2015-04-02 14:36   ` [PATCH V2 0/3] Fix some issues of staging ion test driver Phong Tran
@ 2015-04-02 14:36     ` Phong Tran
  2015-04-02 14:36     ` [PATCH V2 2/3] staging: android: ion_test: unregister the misc device Phong Tran
                       ` (2 subsequent siblings)
  3 siblings, 0 replies; 15+ messages in thread
From: Phong Tran @ 2015-04-02 14:36 UTC (permalink / raw)
  To: gregkh, arve, riandrews, dan.carpenter; +Cc: devel, linux-kernel, Phong Tran

Base on the file comment should define GPL v2 for ion test driver

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

diff --git a/drivers/staging/android/ion/ion_test.c b/drivers/staging/android/ion/ion_test.c
index 654acb5..3bc461c 100644
--- a/drivers/staging/android/ion/ion_test.c
+++ b/drivers/staging/android/ion/ion_test.c
@@ -280,3 +280,4 @@ static void __exit ion_test_exit(void)
 
 module_init(ion_test_init);
 module_exit(ion_test_exit);
+MODULE_LICENSE("GPL v2");
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH V2 2/3] staging: android: ion_test: unregister the misc device
  2015-04-02 14:36   ` [PATCH V2 0/3] Fix some issues of staging ion test driver Phong Tran
  2015-04-02 14:36     ` [PATCH V2 1/3] staging: android: ion_test: Add the MODULE_LICENSE macro Phong Tran
@ 2015-04-02 14:36     ` Phong Tran
  2015-04-03 13:13       ` Greg KH
  2015-04-02 14:36     ` [PATCH V2 3/3] " Phong Tran
  2015-04-02 15:22     ` [PATCH V2 0/3] Fix some issues of staging ion test driver Dan Carpenter
  3 siblings, 1 reply; 15+ messages in thread
From: Phong Tran @ 2015-04-02 14:36 UTC (permalink / raw)
  To: gregkh, arve, riandrews, dan.carpenter; +Cc: devel, linux-kernel, Phong Tran

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 | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/staging/android/ion/ion_test.c b/drivers/staging/android/ion/ion_test.c
index 3bc461c..d6a9653 100644
--- a/drivers/staging/android/ion/ion_test.c
+++ b/drivers/staging/android/ion/ion_test.c
@@ -261,7 +261,19 @@ 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;
+
+	return  misc_deregister(&testdev->misc);
+}
+
 static struct platform_driver ion_test_platform_driver = {
+	.remove = ion_test_remove,
 	.driver = {
 		.name = "ion-test",
 	},
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH V2 3/3] staging: android: ion_test: unregister the platform device
  2015-04-02 14:36   ` [PATCH V2 0/3] Fix some issues of staging ion test driver Phong Tran
  2015-04-02 14:36     ` [PATCH V2 1/3] staging: android: ion_test: Add the MODULE_LICENSE macro Phong Tran
  2015-04-02 14:36     ` [PATCH V2 2/3] staging: android: ion_test: unregister the misc device Phong Tran
@ 2015-04-02 14:36     ` Phong Tran
  2015-04-02 15:22     ` [PATCH V2 0/3] Fix some issues of staging ion test driver Dan Carpenter
  3 siblings, 0 replies; 15+ messages in thread
From: Phong Tran @ 2015-04-02 14:36 UTC (permalink / raw)
  To: gregkh, arve, riandrews, dan.carpenter; +Cc: devel, linux-kernel, Phong Tran

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 | 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


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH V2 0/3] Fix some issues of staging ion test driver
  2015-04-02 14:36   ` [PATCH V2 0/3] Fix some issues of staging ion test driver Phong Tran
                       ` (2 preceding siblings ...)
  2015-04-02 14:36     ` [PATCH V2 3/3] " Phong Tran
@ 2015-04-02 15:22     ` Dan Carpenter
  3 siblings, 0 replies; 15+ messages in thread
From: Dan Carpenter @ 2015-04-02 15:22 UTC (permalink / raw)
  To: Phong Tran; +Cc: gregkh, arve, riandrews, devel, linux-kernel

Thanks!

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH V2 2/3] staging: android: ion_test: unregister the misc device
  2015-04-02 14:36     ` [PATCH V2 2/3] staging: android: ion_test: unregister the misc device Phong Tran
@ 2015-04-03 13:13       ` Greg KH
  2015-04-03 14:07         ` [PATCH V3 0/2] Fix some issues of staging ion test driver Phong Tran
  0 siblings, 1 reply; 15+ messages in thread
From: Greg KH @ 2015-04-03 13:13 UTC (permalink / raw)
  To: Phong Tran; +Cc: arve, riandrews, dan.carpenter, devel, linux-kernel

On Thu, Apr 02, 2015 at 09:36:06PM +0700, Phong Tran wrote:
> 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 | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/drivers/staging/android/ion/ion_test.c b/drivers/staging/android/ion/ion_test.c
> index 3bc461c..d6a9653 100644
> --- a/drivers/staging/android/ion/ion_test.c
> +++ b/drivers/staging/android/ion/ion_test.c
> @@ -261,7 +261,19 @@ 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;
> +
> +	return  misc_deregister(&testdev->misc);

Extra space here :(


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH V3 0/2] Fix some issues of staging ion test driver
  2015-04-03 13:13       ` Greg KH
@ 2015-04-03 14:07         ` Phong Tran
  2015-04-03 14:07           ` [PATCH V3 1/2] staging: android: ion_test: unregister the misc device Phong Tran
  2015-04-03 14:07           ` [PATCH V3 2/2] staging: android: ion_test: unregister the platform device Phong Tran
  0 siblings, 2 replies; 15+ messages in thread
From: Phong Tran @ 2015-04-03 14:07 UTC (permalink / raw)
  To: gregkh, arve, riandrews, dan.carpenter; +Cc: devel, linux-kernel, Phong Tran

Hi Greg,

I resend 2 patches
(1) add the remove() platform driver callback to
    deregister the misc device
(2) unregister platform device when driver is unloaded

Changes from v2:
	Remove the extra space of patch (1)

Changes from v1:
	Imporve the coding style

Phong Tran (2):
  (1) staging: android: ion_test: unregister the misc device
  (2) staging: android: ion_test: unregister the platform device

 drivers/staging/android/ion/ion_test.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

-- 
2.1.0


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH V3 1/2] staging: android: ion_test: unregister the misc device
  2015-04-03 14:07         ` [PATCH V3 0/2] Fix some issues of staging ion test driver Phong Tran
@ 2015-04-03 14:07           ` Phong Tran
  2015-04-03 14:07           ` [PATCH V3 2/2] staging: android: ion_test: unregister the platform device Phong Tran
  1 sibling, 0 replies; 15+ messages in thread
From: Phong Tran @ 2015-04-03 14:07 UTC (permalink / raw)
  To: gregkh, arve, riandrews, dan.carpenter; +Cc: devel, linux-kernel, Phong Tran

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 | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/staging/android/ion/ion_test.c b/drivers/staging/android/ion/ion_test.c
index 3bc461c..052d5e2 100644
--- a/drivers/staging/android/ion/ion_test.c
+++ b/drivers/staging/android/ion/ion_test.c
@@ -261,7 +261,19 @@ 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;
+
+	return misc_deregister(&testdev->misc);
+}
+
 static struct platform_driver ion_test_platform_driver = {
+	.remove = ion_test_remove,
 	.driver = {
 		.name = "ion-test",
 	},
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH V3 2/2] staging: android: ion_test: unregister the platform device
  2015-04-03 14:07         ` [PATCH V3 0/2] Fix some issues of staging ion test driver Phong Tran
  2015-04-03 14:07           ` [PATCH V3 1/2] staging: android: ion_test: unregister the misc device Phong Tran
@ 2015-04-03 14:07           ` Phong Tran
  1 sibling, 0 replies; 15+ messages in thread
From: Phong Tran @ 2015-04-03 14:07 UTC (permalink / raw)
  To: gregkh, arve, riandrews, dan.carpenter; +Cc: devel, linux-kernel, Phong Tran

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 | 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 052d5e2..7d6e6b6 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


^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2015-04-03 14:07 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-01 17:38 [PATCH 0/3] Fix some issues of staging ion test driver Phong Tran
2015-04-01 17:38 ` [PATCH 1/3] staging: android: ion_test: Add the MODULE_LICENSE macro Phong Tran
2015-04-01 17:38 ` [PATCH 2/3] staging: android: ion_test: unregister the misc device Phong Tran
2015-04-01 22:22   ` Dan Carpenter
2015-04-01 17:38 ` [PATCH 3/3] staging: android: ion_test: unregister the platform device Phong Tran
2015-04-01 22:34   ` Dan Carpenter
2015-04-02 14:36   ` [PATCH V2 0/3] Fix some issues of staging ion test driver Phong Tran
2015-04-02 14:36     ` [PATCH V2 1/3] staging: android: ion_test: Add the MODULE_LICENSE macro Phong Tran
2015-04-02 14:36     ` [PATCH V2 2/3] staging: android: ion_test: unregister the misc device Phong Tran
2015-04-03 13:13       ` Greg KH
2015-04-03 14:07         ` [PATCH V3 0/2] Fix some issues of staging ion test driver Phong Tran
2015-04-03 14:07           ` [PATCH V3 1/2] staging: android: ion_test: unregister the misc device Phong Tran
2015-04-03 14:07           ` [PATCH V3 2/2] staging: android: ion_test: unregister the platform device Phong Tran
2015-04-02 14:36     ` [PATCH V2 3/3] " Phong Tran
2015-04-02 15:22     ` [PATCH V2 0/3] Fix some issues of staging ion test driver Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).