From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756557AbdLVSZy (ORCPT ); Fri, 22 Dec 2017 13:25:54 -0500 Received: from mail-pg0-f67.google.com ([74.125.83.67]:40621 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752549AbdLVSZx (ORCPT ); Fri, 22 Dec 2017 13:25:53 -0500 X-Google-Smtp-Source: ACJfBouO2+/eE1V2aPp7SiUk+/HntC6a7RfRdbXut+094IQxOHAddFmHftWQkqyDvAIi150mC4LN3g== From: Pravin Shedge To: akpm@linux-foundation.org, fkostenzer@live.at, andriy.shevchenko@linux.intel.com, geert@linux-m68k.org, paul.gortmaker@windriver.com, linux-kernel@vger.kernel.org Cc: pravin.shedge4linux@gmail.com Subject: [PATCH v2] lib: add module unload support to sort tests Date: Fri, 22 Dec 2017 23:55:33 +0530 Message-Id: <1513967133-6843-1-git-send-email-pravin.shedge4linux@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1513504167-4118-1-git-send-email-pravin.shedge4linux@gmail.com> References: <1513504167-4118-1-git-send-email-pravin.shedge4linux@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org test_sort.c perform array-based and linked list sort test. Code allows to compile either as a loadable modules or builtin into the kernel. Current code is not allow to unload the test_sort.ko module after successful completion. This patch add support to unload the "test_sort.ko" module by adding module_exit support. Previous patch was implemented auto unload support by returning -EAGAIN from module_init() function on successful case, but this approach is not ideal. The auto-unload might seem like a nice optimization, but it encourages inconsistent behaviour. And behaviour that is different from all other normal modules. Signed-off-by: Pravin Shedge --- lib/test_sort.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/test_sort.c b/lib/test_sort.c index d389c1c..385c0ed 100644 --- a/lib/test_sort.c +++ b/lib/test_sort.c @@ -39,5 +39,11 @@ static int __init test_sort_init(void) return err; } +static void __exit test_sort_exit(void) +{ +} + module_init(test_sort_init); +module_exit(test_sort_exit); + MODULE_LICENSE("GPL"); -- 2.7.4