All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pravin Shedge <pravin.shedge4linux@gmail.com>
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	[thread overview]
Message-ID: <1513967133-6843-1-git-send-email-pravin.shedge4linux@gmail.com> (raw)
In-Reply-To: <1513504167-4118-1-git-send-email-pravin.shedge4linux@gmail.com>

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 <pravin.shedge4linux@gmail.com>
---
 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

      parent reply	other threads:[~2017-12-22 18:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-17  9:49 [PATCH] lib: add module unload support to sort tests Pravin Shedge
2017-12-18 22:21 ` Andrew Morton
2017-12-19 17:40   ` Pravin Shedge
2017-12-19 22:51     ` Andrew Morton
2017-12-19 23:06       ` Randy Dunlap
2017-12-20  4:13     ` Paul Gortmaker
2017-12-21  2:05       ` Pravin Shedge
2017-12-22 18:25 ` Pravin Shedge [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1513967133-6843-1-git-send-email-pravin.shedge4linux@gmail.com \
    --to=pravin.shedge4linux@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=fkostenzer@live.at \
    --cc=geert@linux-m68k.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paul.gortmaker@windriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.