All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Petr Mládek" <pmladek@suse.cz>
To: Alex Elder <elder@linaro.org>
Cc: akpm@linux-foundation.org, ak@linux.intel.com, bp@suse.de,
	jack@suse.cz, john.stultz@linaro.org, rostedt@goodmis.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/4] printk: use a clever macro
Date: Wed, 9 Jul 2014 18:19:46 +0200	[thread overview]
Message-ID: <20140709161946.GA26508@pathway.suse.cz> (raw)
In-Reply-To: <1404911056-29064-4-git-send-email-elder@linaro.org>

On Wed 2014-07-09 08:04:15, Alex Elder wrote:
> Use the IS_ENABLED() macro rather than #ifdef blocks to set certain
> global values.
> 
> Signed-off-by: Alex Elder <elder@linaro.org>
> ---
>  kernel/printk/printk.c | 12 ++----------
>  1 file changed, 2 insertions(+), 10 deletions(-)
> 
> diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
> index 646146c..6f75e8a 100644
> --- a/kernel/printk/printk.c
> +++ b/kernel/printk/printk.c
> @@ -453,11 +453,7 @@ static int log_store(int facility, int level,
>  	return msg->text_len;
>  }
>  
> -#ifdef CONFIG_SECURITY_DMESG_RESTRICT
> -int dmesg_restrict = 1;
> -#else
> -int dmesg_restrict;
> -#endif
> +int dmesg_restrict = IS_ENABLED(CONFIG_SECURITY_DMESG_RESTRICT);

I wondered if IS_ENABLED() is guaranteed to set 1 when enabled. Well, it
does not matter because the variable is used as a boolean.

>  static int syslog_action_restricted(int type)
>  {
> @@ -947,11 +943,7 @@ static inline void boot_delay_msec(int level)
>  }
>  #endif
>  
> -#if defined(CONFIG_PRINTK_TIME)
> -static bool printk_time = 1;
> -#else
> -static bool printk_time;
> -#endif
> +static bool printk_time = IS_ENABLED(CONFIG_PRINTK_TIME);
>  module_param_named(time, printk_time, bool, S_IRUGO | S_IWUSR);
>  
>  static size_t print_time(u64 ts, char *buf)
> -- 
> 1.9.1

Nice clean up.

Reviewed-by: Petr Mladek <pmladek@suse.cz>

Best Regards,
Petr

  parent reply	other threads:[~2014-07-09 16:19 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-09 13:04 [PATCH 0/4] printk: some minor fixups Alex Elder
2014-07-09 13:04 ` [PATCH 1/4] printk: rename DEFAULT_MESSAGE_LOGLEVEL Alex Elder
2014-07-09 15:00   ` Borislav Petkov
2014-07-09 15:10     ` Alex Elder
2014-07-09 15:13       ` Borislav Petkov
2014-07-09 15:14         ` Alex Elder
2014-07-09 15:17           ` Borislav Petkov
2014-07-09 13:04 ` [PATCH 2/4] printk: fix some comments Alex Elder
2014-07-09 15:53   ` Petr Mládek
2014-07-09 13:04 ` [PATCH 3/4] printk: use a clever macro Alex Elder
2014-07-09 15:05   ` Borislav Petkov
2014-07-09 16:19   ` Petr Mládek [this message]
2014-07-09 16:24     ` Borislav Petkov
2014-07-09 16:32       ` Petr Mládek
2014-07-09 16:40         ` Borislav Petkov
2014-07-09 17:58   ` Geert Uytterhoeven
2014-07-09 18:15     ` Alex Elder
2014-07-09 13:04 ` [PATCH 4/4] printk: miscellaneous cleanups Alex Elder
2014-07-09 16:29   ` Petr Mládek
2014-07-09 16:45     ` Alex Elder
2014-07-09 16:03 ` Alex Elder

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=20140709161946.GA26508@pathway.suse.cz \
    --to=pmladek@suse.cz \
    --cc=ak@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=bp@suse.de \
    --cc=elder@linaro.org \
    --cc=jack@suse.cz \
    --cc=john.stultz@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rostedt@goodmis.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 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.