From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753236AbbDCOHf (ORCPT ); Fri, 3 Apr 2015 10:07:35 -0400 Received: from mail-pd0-f173.google.com ([209.85.192.173]:35863 "EHLO mail-pd0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753173AbbDCOH3 (ORCPT ); Fri, 3 Apr 2015 10:07:29 -0400 From: Phong Tran To: gregkh@linuxfoundation.org, arve@android.com, riandrews@android.com, dan.carpenter@oracle.com Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, Phong Tran Subject: [PATCH V3 2/2] staging: android: ion_test: unregister the platform device Date: Fri, 3 Apr 2015 21:07:02 +0700 Message-Id: <1428070022-5782-3-git-send-email-tranmanphong@gmail.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1428070022-5782-1-git-send-email-tranmanphong@gmail.com> References: <20150403131323.GA11031@kroah.com> <1428070022-5782-1-git-send-email-tranmanphong@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The driver has to unregister from platform device when it's unloaded Signed-off-by: Phong Tran --- 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