From: Andrew Morton <akpm@linux-foundation.org>
To: Namhyung Kim <namhyung@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/4] printk: Declare printk_ratelimit_state in ratelimit.h
Date: Tue, 21 Sep 2010 16:13:45 -0700 [thread overview]
Message-ID: <20100921161345.cc89e283.akpm@linux-foundation.org> (raw)
In-Reply-To: <1284825182-32588-5-git-send-email-namhyung@gmail.com>
On Sun, 19 Sep 2010 00:53:02 +0900
Namhyung Kim <namhyung@gmail.com> wrote:
> Adding declaration of printk_ratelimit_state in ratelimit.h removes
> potential build breakage and following sparse warning:
>
> kernel/printk.c:1426:1: warning: symbol 'printk_ratelimit_state' was not declared. Should it be static?
>
> Signed-off-by: Namhyung Kim <namhyung@gmail.com>
> ---
> include/linux/ratelimit.h | 4 ++++
> kernel/sysctl.c | 2 --
> 2 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/ratelimit.h b/include/linux/ratelimit.h
> index 8f69d09..55e1bbc 100644
> --- a/include/linux/ratelimit.h
> +++ b/include/linux/ratelimit.h
> @@ -36,6 +36,10 @@ static inline void ratelimit_state_init(struct ratelimit_state *rs,
> rs->begin = 0;
> }
>
> +#ifdef CONFIG_PRINTK
> +extern struct ratelimit_state printk_ratelimit_state;
> +#endif
> +
We don't actually need the ifdefs there.
If we remove them then it adds a risk that someone will discover their
error at link-timer rather than at compile-time. On the other hand,
removing the ifdefs deuglifies the code for everyone, for ever.
Personally I prefer to not have the ifdefs.
--- a/include/linux/ratelimit.h~printk-declare-printk_ratelimit_state-in-ratelimith-fix
+++ a/include/linux/ratelimit.h
@@ -36,9 +36,7 @@ static inline void ratelimit_state_init(
rs->begin = 0;
}
-#ifdef CONFIG_PRINTK
extern struct ratelimit_state printk_ratelimit_state;
-#endif
extern int ___ratelimit(struct ratelimit_state *rs, const char *func);
#define __ratelimit(state) ___ratelimit(state, __func__)
diff -puN kernel/sysctl.c~printk-declare-printk_ratelimit_state-in-ratelimith-fix kernel/sysctl.c
_
prev parent reply other threads:[~2010-09-21 23:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-18 15:52 [PATCH 0/4] printk cleanups Namhyung Kim
2010-09-18 15:52 ` [PATCH 1/4] printk: Fixup declaration of kmsg_reasons Namhyung Kim
2010-09-18 15:53 ` [PATCH 2/4] printk: Add lock context annotation Namhyung Kim
2010-09-18 15:53 ` [PATCH 3/4] printk: Change type of 'boot_delay' to int * Namhyung Kim
2010-09-18 15:53 ` [PATCH 4/4] printk: Declare printk_ratelimit_state in ratelimit.h Namhyung Kim
2010-09-21 23:13 ` Andrew Morton [this message]
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=20100921161345.cc89e283.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=namhyung@gmail.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