linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ryan Mallon <rmallon@gmail.com>
To: Luca Clementi <luca.clementi@gmail.com>
Cc: linux-kernel@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Brian Swetland <swetland@google.com>
Subject: Re: [PATCH] Staging: Android: logger: module_exit implementation
Date: Mon, 05 Nov 2012 10:57:11 +1100	[thread overview]
Message-ID: <509700D7.1010809@gmail.com> (raw)
In-Reply-To: <1351836952-3389-1-git-send-email-luca.clementi@gmail.com>

On 02/11/12 17:15, Luca Clementi wrote:
> 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);

ret is undeclared? Has this been tested?

> +		if (unlikely(ret)) {
> +			pr_err("failed to deregister misc device for log '%s'!\n",
> +					current_log->misc.name);
> +		}

Don't need braces on single line if statements, and unlikely is not
needed here (it isn't a hotpath). The whole error can probably just be
removed since it looks like misc_deregister already does a WARN_ON if it
fails.

> +		pr_info("removed loggger '%s'\n", current_log->misc.name);

Don't spam the log with stuff like this. Either change to pr_debug, or
probably just remove it.

> +		vfree(current_log->buffer);
> +		kfree(current_log->misc.name);
> +		kfree(current_log);

Missing:

	list_del(&current_log->logs);

?

> +	}
> +
> +	return;

This is pointless.

> +}
> +
> +
> +module_init(logger_init);
> +module_exit(logger_exit);

Nitpick - Blank line here.

> +MODULE_LICENSE("GPL");
> +MODULE_AUTHOR("Brian Swetland, <swetland@google.com>");

Should be Robert Love according to the header comment.

> +MODULE_DESCRIPTION("Android Logger");
> +
> +

Don't need extra blank lines at the end of the file.

~Ryan


  parent reply	other threads:[~2012-11-04 23:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Ryan Mallon [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-11-22  3:43 [PATCH] Staging: Android: logger: module_exit implementation Luca Clementi

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=509700D7.1010809@gmail.com \
    --to=rmallon@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luca.clementi@gmail.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;
as well as URLs for NNTP newsgroup(s).