Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753237AbbDARjN (ORCPT ); Wed, 1 Apr 2015 13:39:13 -0400 Received: from mail-pd0-f174.google.com ([209.85.192.174]:36623 "EHLO mail-pd0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752870AbbDARir (ORCPT ); Wed, 1 Apr 2015 13:38:47 -0400 From: Phong Tran To: gregkh@linuxfoundation.org, arve@android.com, riandrews@android.com Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, Phong Tran Subject: [PATCH 2/3] staging: android: ion_test: unregister the misc device Date: Thu, 2 Apr 2015 00:38:19 +0700 Message-Id: <1427909900-22650-3-git-send-email-tranmanphong@gmail.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1427909900-22650-1-git-send-email-tranmanphong@gmail.com> References: <1427909900-22650-1-git-send-email-tranmanphong@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1234 Lines: 46 Add the remove() method for deregister from misc device when it's unloaded. Signed-off-by: Phong Tran --- 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/