All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Staging: Android: logger: module_exit implementation
@ 2012-11-02  6:15 Luca Clementi
  2012-11-02 18:29 ` [PATCH] Staging: Android: logger: module_exit implementationg Greg Kroah-Hartman
  2012-11-04 23:57 ` [PATCH] Staging: Android: logger: module_exit implementation Ryan Mallon
  0 siblings, 2 replies; 6+ messages in thread
From: Luca Clementi @ 2012-11-02  6:15 UTC (permalink / raw)
  To: linux-kernel; +Cc: Luca Clementi, Greg Kroah-Hartman, Brian Swetland

Created the module_exit for the android logger so that
it can be loaded and unloaded as a module. Fixed
module_init and some other minor issues.

Signed-off-by: Luca Clementi <luca.clementi@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Brian Swetland <swetland@google.com>
---
 drivers/staging/android/logger.c |   30 +++++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/android/logger.c b/drivers/staging/android/logger.c
index 1d5ed47..050be01 100644
--- a/drivers/staging/android/logger.c
+++ b/drivers/staging/android/logger.c
@@ -676,4 +676,32 @@ static int __init logger_init(void)
 out:
 	return ret;
 }
-device_initcall(logger_init);
+
+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 */
+		ret = misc_deregister(&current_log->misc);
+		if (unlikely(ret)) {
+			pr_err("failed to deregister misc device for log '%s'!\n",
+					current_log->misc.name);
+		}
+		pr_info("removed loggger '%s'\n", current_log->misc.name);
+		vfree(current_log->buffer);
+		kfree(current_log->misc.name);
+		kfree(current_log);
+	}
+
+	return;
+}
+
+
+module_init(logger_init);
+module_exit(logger_exit);
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Brian Swetland, <swetland@google.com>");
+MODULE_DESCRIPTION("Android Logger");
+
+
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-11-05  0:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-02  6:15 [PATCH] Staging: Android: logger: module_exit implementation Luca Clementi
2012-11-02 18:29 ` [PATCH] Staging: Android: logger: module_exit implementationg Greg Kroah-Hartman
2012-11-03  5:40   ` Brian Swetland
2012-11-03 17:45   ` Luca Clementi
2012-11-05  0:03     ` Ryan Mallon
2012-11-04 23:57 ` [PATCH] Staging: Android: logger: module_exit implementation Ryan Mallon

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.