mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Luca Clementi <luca.clementi@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Luca Clementi <luca.clementi@gmail.com>,
	Greg Kroah-Hartman <greg@kroah.com>,
	Brian Swetland <swetland@google.com>,
	Robert Love <rlove@google.com>
Subject: [PATCH] Staging: Android: logger: module_exit implementation
Date: Wed, 21 Nov 2012 19:43:17 -0800	[thread overview]
Message-ID: <1353555797-4284-1-git-send-email-luca.clementi@gmail.com> (raw)

This patch creates the module_exit for the android logger
so that it can be loaded and unloaded as a module.

The android logger is already declared as a tristate in the
Kconfig but the module_exit function was missing.

device_initcall works also with modprobe since include/linux/init.h:

 #define module_init(x)  __initcall(x);
 ...
 #define __initcall(fn) device_initcall(fn)

Tested against f4a75d2eb7b1e2206094b901be09adb31ba63681 Linux 3.7-rc6

Signed-off-by: Luca Clementi <luca.clementi@gmail.com>
---
 drivers/staging/android/logger.c |   21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/drivers/staging/android/logger.c b/drivers/staging/android/logger.c
index 1d5ed47..dbc63cb 100644
--- a/drivers/staging/android/logger.c
+++ b/drivers/staging/android/logger.c
@@ -676,4 +676,25 @@ static int __init logger_init(void)
 out:
 	return ret;
 }
+
+static void __exit logger_exit(void)
+{
+	struct logger_log *current_log, *next_log;
+
+	list_for_each_entry_safe(current_log, next_log, &log_list, logs) {
+		/* we have to delete all the entry inside log_list */
+		misc_deregister(&current_log->misc);
+		vfree(current_log->buffer);
+		kfree(current_log->misc.name);
+		list_del(&current_log->logs);
+		kfree(current_log);
+	}
+}
+
+
 device_initcall(logger_init);
+module_exit(logger_exit);
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Robert Love, <rlove@google.com>");
+MODULE_DESCRIPTION("Android Logger");
-- 
1.7.9.5


             reply	other threads:[~2012-11-22 20:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-22  3:43 Luca Clementi [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-11-02  6:15 Luca Clementi
2012-11-04 23:57 ` Ryan Mallon

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=1353555797-4284-1-git-send-email-luca.clementi@gmail.com \
    --to=luca.clementi@gmail.com \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rlove@google.com \
    --cc=swetland@google.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome