linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@amd64.org>
To: Markus Trippelsdorf <markus@trippelsdorf.de>
Cc: Jiri Slaby <jslaby@suse.cz>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: tty_init_dev: 24 callbacks suppressed
Date: Thu, 4 Oct 2012 14:40:25 +0200	[thread overview]
Message-ID: <20121004124025.GC21028@aftab.osrc.amd.com> (raw)
In-Reply-To: <20121004115157.GA245@x4>

On Thu, Oct 04, 2012 at 01:51:57PM +0200, Markus Trippelsdorf wrote:
> diff --git a/include/linux/ratelimit.h b/include/linux/ratelimit.h
> index e11ccb4..d8de255 100644
> --- a/include/linux/ratelimit.h
> +++ b/include/linux/ratelimit.h
> @@ -46,20 +46,17 @@ extern int ___ratelimit(struct ratelimit_state *rs, const char *func);
>  #define WARN_ON_RATELIMIT(condition, state)			\
>  		WARN_ON((condition) && __ratelimit(state))
>  
> -#define __WARN_RATELIMIT(condition, state, format...)		\
> -({								\
> -	int rtn = 0;						\
> -	if (unlikely(__ratelimit(state)))			\
> -		rtn = WARN(condition, format);			\
> -	rtn;							\
> -})
> -
> -#define WARN_RATELIMIT(condition, format...)			\
> +#define WARN_RATELIMIT(condition, fmt, ...)			\
>  ({								\
>  	static DEFINE_RATELIMIT_STATE(_rs,			\
>  				      DEFAULT_RATELIMIT_INTERVAL,	\
>  				      DEFAULT_RATELIMIT_BURST);	\
> -	__WARN_RATELIMIT(condition, &_rs, format);		\
> +	int rtn = !!(condition);				\
> +								\
> +	if (unlikely(rtn && __ratelimit(&_rs)))		\
> +		WARN(rtn, fmt, ##__VA_ARGS__);			\
> +								\
> +	rtn;							\
>  })

Aha, I see it. We need to look at the condition before the __ratelimit,
otherwise we WARN unnecessarily, good catch.

>  #else
> @@ -67,15 +64,9 @@ extern int ___ratelimit(struct ratelimit_state *rs, const char *func);
>  #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...)			\
> +#define WARN_RATELIMIT(condition, fmt, ...)			\

... except this change is unrelated and unneeded - there's enough room
in 80 cols to leave it as "format" instead of shortening it.

Other than that:

Acked-and-tested-by: Borislav Petkov <borislav.petkov@amd.com>

Thanks.

-- 
Regards/Gruss,
Boris.

Advanced Micro Devices GmbH
Einsteinring 24, 85609 Dornach
GM: Alberto Bozzo
Reg: Dornach, Landkreis Muenchen
HRB Nr. 43632 WEEE Registernr: 129 19551

  reply	other threads:[~2012-10-04 12:40 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-04  9:20 tty_init_dev: 24 callbacks suppressed Borislav Petkov
2012-10-04 11:23 ` Markus Trippelsdorf
2012-10-04 11:51   ` Markus Trippelsdorf
2012-10-04 12:40     ` Borislav Petkov [this message]
2012-10-04 13:11       ` Markus Trippelsdorf
2012-10-05 11:17         ` Jiri Slaby
2012-10-05 11:25           ` Alan Cox
2012-10-05 12:27           ` Borislav Petkov
2012-10-05 12:57             ` [PATCH] Fix bogus "callbacks suppressed" messages Markus Trippelsdorf
2012-10-05 14:26               ` Greg Kroah-Hartman
2012-10-05 15:28                 ` Markus Trippelsdorf
2012-10-05 15:29                 ` Borislav Petkov
2012-10-05 15:37                   ` Greg Kroah-Hartman
2012-10-05 15:41                     ` Markus Trippelsdorf
2012-10-05 15:43                     ` Borislav Petkov
2012-10-05 15:48                       ` Markus Trippelsdorf
2012-10-05 16:03                         ` Borislav Petkov
2012-10-05 16:06                         ` Greg Kroah-Hartman
2012-10-05 18:06               ` Jiri Slaby
2012-10-05 15:33           ` tty_init_dev: 24 callbacks suppressed 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=20121004124025.GC21028@aftab.osrc.amd.com \
    --to=bp@amd64.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=markus@trippelsdorf.de \
    /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).