public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: Ionut Alexa <ionut.m.alexa@gmail.com>
Cc: linux-kernel@vger.kernel.org, Ionut Alexa <ionut.m.alexa@gmail.com>
Subject: Re: [PATCH] kernel:module Fix coding style errors and warnings.
Date: Fri, 17 Oct 2014 09:36:20 +1030	[thread overview]
Message-ID: <87tx33aa37.fsf@rustcorp.com.au> (raw)
In-Reply-To: <1413455749-29357-1-git-send-email-ionut.m.alexa@gmail.com>

Ionut Alexa <ionut.m.alexa@gmail.com> writes:
> Fixed codin style errors and warnings. Changes printk with
> print_debug/warn. Changed seq_printf to seq_puts.
>
> Signed-off-by: Ionut Alexa <ionut.m.alexa@gmail.com>

Hi Ionut,

Please drop the following changes:
> @@ -110,7 +110,7 @@ struct list_head *kdb_modules = &modules; /* kdb needs the list of modules */
>  #ifdef CONFIG_MODULE_SIG_FORCE
>  static bool sig_enforce = true;
>  #else
> -static bool sig_enforce = false;
> +static bool sig_enforce; /* by default set to false */
>  
>  static int param_set_bool_enable_only(const char *val,
>  				      const struct kernel_param *kp)
> @@ -156,15 +156,15 @@ static BLOCKING_NOTIFIER_HEAD(module_notify_list);
>  
>  /* Bounds of module allocation, for speeding __module_address.
>   * Protected by module_mutex. */
> -static unsigned long module_addr_min = -1UL, module_addr_max = 0;
> +static unsigned long module_addr_min = -1UL, module_addr_max; /* addr_max=0 */

I think the explicit initializers are clearer.  Gcc realizes they're
zero and puts them in bss anyway, so there's no size cost.

> -int register_module_notifier(struct notifier_block * nb)
> +int register_module_notifier(struct notifier_block *nb)
>  {
>  	return blocking_notifier_chain_register(&module_notify_list, nb);
>  }
>  EXPORT_SYMBOL(register_module_notifier);
>  
> -int unregister_module_notifier(struct notifier_block * nb)
> +int unregister_module_notifier(struct notifier_block *nb)
>  {
>  	return blocking_notifier_chain_unregister(&module_notify_list, nb);
>  }
> @@ -740,8 +740,7 @@ static inline int try_force_unload(unsigned int flags)
>  }
>  #endif /* CONFIG_MODULE_FORCE_UNLOAD */
>  
> -struct stopref
> -{
> +struct stopref {
>  	struct module *mod;
>  	int flags;
>  	int *forced;

These are fine.

> @@ -878,7 +877,7 @@ static inline void print_unload_info(struct seq_file *m, struct module *mod)
>  	seq_printf(m, " %lu ", module_refcount(mod));
>  
>  	/* Always include a trailing , so userspace can differentiate
> -           between this and the old multi-field proc format. */
> +	 * between this and the old multi-field proc format. */
>  	list_for_each_entry(use, &mod->source_list, source_list) {
>  		printed_something = 1;
>  		seq_printf(m, "%s,", use->source->name);

Actually, kernel style for multi-line comments, like it or not, is:

  	/*
         * Always include a trailing , so userspace can differentiate
	 * between this and the old multi-field proc format.
         */
        
> @@ -1953,7 +1951,7 @@ static int simplify_symbols(struct module *mod, const struct load_info *info)
>  			/* We compiled with -fno-common.  These are not
>  			   supposed to happen.  */
>  			pr_debug("Common symbol: %s\n", name);
> -			printk("%s: please compile with -fno-common\n",
> +			pr_debug("%s: please compile with -fno-common\n",
>  			       mod->name);
>  			ret = -ENOEXEC;
>  			break;

Please change it to pr_warn rather than pr_debug!

> @@ -3022,7 +3020,7 @@ static int do_init_module(struct module *mod)
>  		ret = do_one_initcall(mod->init);
>  	if (ret < 0) {
>  		/* Init routine failed: abort.  Try to protect us from
> -                   buggy refcounters. */
> +		 * buggy refcounters. */
>  		mod->state = MODULE_STATE_GOING;
>  		synchronize_sched();
>  		module_put(mod);
> @@ -3174,7 +3172,7 @@ out:

Comment style here, too.

> @@ -3816,7 +3814,7 @@ void print_modules(void)
>  	struct module *mod;
>  	char buf[8];
>  
> -	printk(KERN_DEFAULT "Modules linked in:");
> +	pr_warn("Modules linked in:");

This is not the same as KERN_DEFAULT; is it correct?

Thanks,
Rusty.

  reply	other threads:[~2014-10-16 23:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-16 10:35 [PATCH] kernel:module Fix coding style errors and warnings Ionut Alexa
2014-10-16 23:06 ` Rusty Russell [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-10-17  8:32 Ionut Alexa
2014-10-19 23:57 ` Rusty Russell
2014-10-16  9:36 Ionut Alexa
2014-10-16  9:38 ` Joe Perches
2014-10-16 12:57   ` Sudip Mukherjee
2014-10-16 14:46     ` Joe Perches

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=87tx33aa37.fsf@rustcorp.com.au \
    --to=rusty@rustcorp.com.au \
    --cc=ionut.m.alexa@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /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