netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: joe@perches.com
Cc: randy.dunlap@oracle.com, sfr@canb.auug.org.au,
	netdev@vger.kernel.org, linux-next@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: linux-next: Tree for May 24 (ratelimits, CONFIG_PRINTK not enabled)
Date: Tue, 24 May 2011 15:53:37 -0400 (EDT)	[thread overview]
Message-ID: <20110524.155337.1293466135362760665.davem@davemloft.net> (raw)
In-Reply-To: <1306266580.2298.55.camel@Joe-Laptop>

From: Joe Perches <joe@perches.com>
Date: Tue, 24 May 2011 12:49:40 -0700

> On Tue, 2011-05-24 at 15:32 -0400, David Miller wrote:
>> From: Joe Perches <joe@perches.com>
>> Date: Tue, 24 May 2011 11:49:48 -0700
>> > On Tue, 2011-05-24 at 11:33 -0700, Randy Dunlap wrote:
>> >> Adding <linux/ratelimit.h> to <asm-generic/bug.h> causes other problems:
>> > Yup, that's not a good solution.
>> Please come up with a fix or I'll have to revert, thanks Joe.
> 
> I have some errands to run for awhile.
> 
> Probably a revert today and another patch set tomorrow
> might be best.
> 
> This seems to work and doesn't cause any extra state to be
> instantiated when !CONFIG_PRINTK.  What do you think?

Seems fine, here it is as a patch.

Randy please test this, thanks:

diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index 12b250c..9178484 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -162,6 +162,8 @@ extern void warn_slowpath_null(const char *file, const int line);
 	unlikely(__ret_warn_once);				\
 })
 
+#ifdef CONFIG_PRINTK
+
 #define WARN_ON_RATELIMIT(condition, state)			\
 		WARN_ON((condition) && __ratelimit(state))
 
@@ -181,6 +183,25 @@ extern void warn_slowpath_null(const char *file, const int line);
 	__WARN_RATELIMIT(condition, &_rs, format);		\
 })
 
+#else
+
+#define WARN_ON_RATELIMIT(condition, state)			\
+	WARN_ON(condition)
+
+#define __WARN_RATELIMIT(condition, state, format...)		\
+({								\
+	int rtn = WARN(condition, format);			\
+	rtn;							\
+})
+
+#define WARN_RATELIMIT(condition, format...)			\
+({								\
+	int rtn = WARN(condition, format);			\
+	rtn;							\
+})
+
+#endif
+
 /*
  * WARN_ON_SMP() is for cases that the warning is either
  * meaningless for !SMP or may even cause failures.

  reply	other threads:[~2011-05-24 19:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20110524140212.a4f19769.sfr@canb.auug.org.au>
2011-05-24 18:33 ` linux-next: Tree for May 24 (ratelimits, CONFIG_PRINTK not enabled) Randy Dunlap
2011-05-24 18:49   ` Joe Perches
2011-05-24 19:32     ` David Miller
2011-05-24 19:49       ` Joe Perches
2011-05-24 19:53         ` David Miller [this message]
2011-05-24 20:11           ` Randy Dunlap
2011-05-24 20:14             ` David Miller

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=20110524.155337.1293466135362760665.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=randy.dunlap@oracle.com \
    --cc=sfr@canb.auug.org.au \
    /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).