All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC 1/1] driver core: Add dev_*_ratelimited() family
@ 2012-05-12 10:52 ` Hiroshi Doyu
  0 siblings, 0 replies; 25+ messages in thread
From: Hiroshi Doyu @ 2012-05-12 10:52 UTC (permalink / raw)
  To: linux-kernel-u79uwXL29TY76Z2rM5mHXA; +Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA

Hi,

An unclosed "if" statement in the MACRO seems a bit risky, but I don't
have any better/simple solution for this, ATM. Is there any alternative?


From: Hiroshi DOYU <hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>

Add dev_*_ratelimited() family, dev_* version of pr_*_ratelimited().

Signed-off-by: Hiroshi DOYU <hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
---
 include/linux/device.h |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/include/linux/device.h b/include/linux/device.h
index 8b9d03a..9d976df 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -23,6 +23,7 @@
 #include <linux/mutex.h>
 #include <linux/pm.h>
 #include <linux/atomic.h>
+#include <linux/ratelimit.h>
 #include <asm/device.h>
 
 struct device;
@@ -937,6 +938,27 @@ int _dev_info(const struct device *dev, const char *fmt, ...)
 
 #endif
 
+#define IF_DEV_RATELIMITED						\
+	static DEFINE_RATELIMIT_STATE(_rs,				\
+				      DEFAULT_RATELIMIT_INTERVAL,	\
+				      DEFAULT_RATELIMIT_BURST);		\
+	if (__ratelimit(&_rs))
+
+#define dev_emerg_ratelimited(dev, fmt, ...)				\
+	do { IF_DEV_RATELIMITED dev_printk(KERN_EMERG, dev, fmt, ##__VA_ARGS__); } while (0)
+#define dev_alert_ratelimited(dev, fmt, ...)				\
+	do { IF_DEV_RATELIMITED dev_printk(KERN_ALERT, dev, fmt, ##__VA_ARGS__); } while (0)
+#define dev_crit_ratelimited(dev, fmt, ...)				\
+	do { IF_DEV_RATELIMITED dev_printk(KERN_CRIT, dev, fmt, ##__VA_ARGS__); } while (0)
+#define dev_err_ratelimited(dev, fmt, ...)				\
+	do { IF_DEV_RATELIMITED dev_printk(KERN_ERR, dev, fmt, ##__VA_ARGS__); } while (0)
+#define dev_warn_ratelimited(dev, fmt, ...)				\
+	do { IF_DEV_RATELIMITED dev_printk(KERN_WARNING, dev, fmt, ##__VA_ARGS__); } while (0)
+#define dev_notice_ratelimited(dev, fmt, ...)				\
+	do { IF_DEV_RATELIMITED dev_printk(KERN_NOTICE, dev, fmt, ##__VA_ARGS__); } while (0)
+#define dev_info_ratelimited(dev, fmt, ...)				\
+	do { IF_DEV_RATELIMITED dev_printk(KERN_INFO, dev, fmt, ##__VA_ARGS__); } while (0)
+
 /*
  * Stupid hackaround for existing uses of non-printk uses dev_info
  *
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [RFC 1/1] driver core: Add dev_*_ratelimited() family
@ 2012-05-12 10:52 ` Hiroshi Doyu
  0 siblings, 0 replies; 25+ messages in thread
From: Hiroshi Doyu @ 2012-05-12 10:52 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-tegra

Hi,

An unclosed "if" statement in the MACRO seems a bit risky, but I don't
have any better/simple solution for this, ATM. Is there any alternative?


From: Hiroshi DOYU <hdoyu@nvidia.com>

Add dev_*_ratelimited() family, dev_* version of pr_*_ratelimited().

Signed-off-by: Hiroshi DOYU <hdoyu@nvidia.com>
---
 include/linux/device.h |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/include/linux/device.h b/include/linux/device.h
index 8b9d03a..9d976df 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -23,6 +23,7 @@
 #include <linux/mutex.h>
 #include <linux/pm.h>
 #include <linux/atomic.h>
+#include <linux/ratelimit.h>
 #include <asm/device.h>
 
 struct device;
@@ -937,6 +938,27 @@ int _dev_info(const struct device *dev, const char *fmt, ...)
 
 #endif
 
+#define IF_DEV_RATELIMITED						\
+	static DEFINE_RATELIMIT_STATE(_rs,				\
+				      DEFAULT_RATELIMIT_INTERVAL,	\
+				      DEFAULT_RATELIMIT_BURST);		\
+	if (__ratelimit(&_rs))
+
+#define dev_emerg_ratelimited(dev, fmt, ...)				\
+	do { IF_DEV_RATELIMITED dev_printk(KERN_EMERG, dev, fmt, ##__VA_ARGS__); } while (0)
+#define dev_alert_ratelimited(dev, fmt, ...)				\
+	do { IF_DEV_RATELIMITED dev_printk(KERN_ALERT, dev, fmt, ##__VA_ARGS__); } while (0)
+#define dev_crit_ratelimited(dev, fmt, ...)				\
+	do { IF_DEV_RATELIMITED dev_printk(KERN_CRIT, dev, fmt, ##__VA_ARGS__); } while (0)
+#define dev_err_ratelimited(dev, fmt, ...)				\
+	do { IF_DEV_RATELIMITED dev_printk(KERN_ERR, dev, fmt, ##__VA_ARGS__); } while (0)
+#define dev_warn_ratelimited(dev, fmt, ...)				\
+	do { IF_DEV_RATELIMITED dev_printk(KERN_WARNING, dev, fmt, ##__VA_ARGS__); } while (0)
+#define dev_notice_ratelimited(dev, fmt, ...)				\
+	do { IF_DEV_RATELIMITED dev_printk(KERN_NOTICE, dev, fmt, ##__VA_ARGS__); } while (0)
+#define dev_info_ratelimited(dev, fmt, ...)				\
+	do { IF_DEV_RATELIMITED dev_printk(KERN_INFO, dev, fmt, ##__VA_ARGS__); } while (0)
+
 /*
  * Stupid hackaround for existing uses of non-printk uses dev_info
  *
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* Re: [RFC 1/1] driver core: Add dev_*_ratelimited() family
  2012-05-12 10:52 ` Hiroshi Doyu
@ 2012-05-12 11:32     ` Bernd Petrovitsch
  -1 siblings, 0 replies; 25+ messages in thread
From: Bernd Petrovitsch @ 2012-05-12 11:32 UTC (permalink / raw)
  To: Hiroshi Doyu
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-tegra-u79uwXL29TY76Z2rM5mHXA

Hi!

On Sam, 2012-05-12 at 12:52 +0200, Hiroshi Doyu wrote:
[...]
> An unclosed "if" statement in the MACRO seems a bit risky, but I don't
> have any better/simple solution for this, ATM. Is there any alternative?

No, the "do { ... } while (0)" is actually the only one and widely used
- not only in the Linux kernel.

[....]

	Bernd
-- 
Bernd Petrovitsch                  Email : bernd-JY8rjfDgnXcb9sJ47jD7nuTv7YV0F9Eg@public.gmane.org
                     LUGA : http://www.luga.at

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [RFC 1/1] driver core: Add dev_*_ratelimited() family
@ 2012-05-12 11:32     ` Bernd Petrovitsch
  0 siblings, 0 replies; 25+ messages in thread
From: Bernd Petrovitsch @ 2012-05-12 11:32 UTC (permalink / raw)
  To: Hiroshi Doyu; +Cc: linux-kernel, linux-tegra

Hi!

On Sam, 2012-05-12 at 12:52 +0200, Hiroshi Doyu wrote:
[...]
> An unclosed "if" statement in the MACRO seems a bit risky, but I don't
> have any better/simple solution for this, ATM. Is there any alternative?

No, the "do { ... } while (0)" is actually the only one and widely used
- not only in the Linux kernel.

[....]

	Bernd
-- 
Bernd Petrovitsch                  Email : bernd@petrovitsch.priv.at
                     LUGA : http://www.luga.at


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [RFC 1/1] driver core: Add dev_*_ratelimited() family
  2012-05-12 10:52 ` Hiroshi Doyu
  (?)
  (?)
@ 2012-05-12 15:31 ` Joe Perches
  2012-05-14  5:00   ` Hiroshi Doyu
  -1 siblings, 1 reply; 25+ messages in thread
From: Joe Perches @ 2012-05-12 15:31 UTC (permalink / raw)
  To: Hiroshi Doyu; +Cc: linux-kernel, linux-tegra

On Sat, 2012-05-12 at 12:52 +0200, Hiroshi Doyu wrote:
> Hi,
> 
> An unclosed "if" statement in the MACRO seems a bit risky, but I don't
> have any better/simple solution for this, ATM. Is there any alternative?

maybe something like:

#define dev_ratelimited_level(dev, level, fmt, ...)
do {
	static DEFINE_RATELIMIT_STATE(_rs,				\
				      DEFAULT_RATELIMIT_INTERVAL,	\
				      DEFAULT_RATELIMIT_BURST);		\
	if (__ratelimit(&_rs))						\
		dev_##level(fmt, ##__VA_ARGS__);			\
} while (0)

#define dev_emerg_ratelimited(dev, fmt, ...)				\
	dev_ratelimited_level(dev, emerg, fmt, ##__VA_ARGS__)
#define dev_alert_ratelimited(dev, fmt, ...)				\
	dev_ratelimited_level(dev, alert, fmt, ##__VA_ARGS__)
#define dev_crit_ratelimited(dev, fmt, ...)				\
	dev_ratelimited_level(dev, crit, fmt, ##__VA_ARGS__)
#define dev_err_ratelimited(dev, fmt, ...)				\
	dev_ratelimited_level(dev, err, fmt, ##__VA_ARGS__)
#define dev_warn_ratelimited(dev, fmt, ...)				\
	dev_ratelimited_level(dev, warn, fmt, ##__VA_ARGS__)
#define dev_notice_ratelimited(dev, fmt, ...)				\
	dev_ratelimited_level(dev, notice, fmt, ##__VA_ARGS__)
#define dev_info_ratelimited(dev, fmt, ...)				\
	dev_ratelimited_level(dev, info, fmt, ##__VA_ARGS__)
#define dev_dbg_ratelimited(dev, fmt, ...)				\
	dev_ratelimited_level(dev, dbg, fmt, ##__VA_ARGS__)

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [RFC 1/1] driver core: Add dev_*_ratelimited() family
  2012-05-12 15:31 ` Joe Perches
@ 2012-05-14  5:00   ` Hiroshi Doyu
  2012-05-14  5:25     ` Joe Perches
  0 siblings, 1 reply; 25+ messages in thread
From: Hiroshi Doyu @ 2012-05-14  5:00 UTC (permalink / raw)
  To: joe; +Cc: linux-kernel, linux-tegra

Hi Joe,

Joe Perches <joe@perches.com> wrote @ Sat, 12 May 2012 17:31:35 +0200:

> On Sat, 2012-05-12 at 12:52 +0200, Hiroshi Doyu wrote:
> > Hi,
> > 
> > An unclosed "if" statement in the MACRO seems a bit risky, but I don't
> > have any better/simple solution for this, ATM. Is there any alternative?
> 
> maybe something like:
> 
> #define dev_ratelimited_level(dev, level, fmt, ...)
> do {
> 	static DEFINE_RATELIMIT_STATE(_rs,				\
> 				      DEFAULT_RATELIMIT_INTERVAL,	\
> 				      DEFAULT_RATELIMIT_BURST);		\
> 	if (__ratelimit(&_rs))						\
> 		dev_##level(fmt, ##__VA_ARGS__);			\
> } while (0)
> 
> #define dev_emerg_ratelimited(dev, fmt, ...)				\
> 	dev_ratelimited_level(dev, emerg, fmt, ##__VA_ARGS__)
> #define dev_alert_ratelimited(dev, fmt, ...)				\
> 	dev_ratelimited_level(dev, alert, fmt, ##__VA_ARGS__)
> #define dev_crit_ratelimited(dev, fmt, ...)				\
> 	dev_ratelimited_level(dev, crit, fmt, ##__VA_ARGS__)
> #define dev_err_ratelimited(dev, fmt, ...)				\
> 	dev_ratelimited_level(dev, err, fmt, ##__VA_ARGS__)
> #define dev_warn_ratelimited(dev, fmt, ...)				\
> 	dev_ratelimited_level(dev, warn, fmt, ##__VA_ARGS__)
> #define dev_notice_ratelimited(dev, fmt, ...)				\
> 	dev_ratelimited_level(dev, notice, fmt, ##__VA_ARGS__)
> #define dev_info_ratelimited(dev, fmt, ...)				\
> 	dev_ratelimited_level(dev, info, fmt, ##__VA_ARGS__)
> #define dev_dbg_ratelimited(dev, fmt, ...)				\
> 	dev_ratelimited_level(dev, dbg, fmt, ##__VA_ARGS__)

"dev" isn't handled separately with __VA_ARGS__, and failed to build
as below:

  Example:
    dev_err_ratelimited(&pdev->dev, "%d\n", __LINE__);
  
  After preprocessded:
    do { ... if (___ratelimit(&_rs, __func__)) dev_err("%d\n", 18); } while (0);

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [RFC 1/1] driver core: Add dev_*_ratelimited() family
  2012-05-14  5:00   ` Hiroshi Doyu
@ 2012-05-14  5:25     ` Joe Perches
  2012-05-14  5:40         ` Hiroshi Doyu
  0 siblings, 1 reply; 25+ messages in thread
From: Joe Perches @ 2012-05-14  5:25 UTC (permalink / raw)
  To: Hiroshi Doyu; +Cc: linux-kernel, linux-tegra

On Mon, 2012-05-14 at 07:00 +0200, Hiroshi Doyu wrote:
> Hi Joe,
> 
> Joe Perches <joe@perches.com> wrote @ Sat, 12 May 2012 17:31:35 +0200:
> 
> > On Sat, 2012-05-12 at 12:52 +0200, Hiroshi Doyu wrote:
> > > Hi,
> > > 
> > > An unclosed "if" statement in the MACRO seems a bit risky, but I don't
> > > have any better/simple solution for this, ATM. Is there any alternative?
> > 
> > maybe something like:
> > 
> > #define dev_ratelimited_level(dev, level, fmt, ...)
> > do {
> > 	static DEFINE_RATELIMIT_STATE(_rs,				\
> > 				      DEFAULT_RATELIMIT_INTERVAL,	\
> > 				      DEFAULT_RATELIMIT_BURST);		\
> > 	if (__ratelimit(&_rs))						\
> > 		dev_##level(fmt, ##__VA_ARGS__);			\
> > } while (0)
> > 
> > #define dev_emerg_ratelimited(dev, fmt, ...)				\
> > 	dev_ratelimited_level(dev, emerg, fmt, ##__VA_ARGS__)
> > #define dev_alert_ratelimited(dev, fmt, ...)				\
> > 	dev_ratelimited_level(dev, alert, fmt, ##__VA_ARGS__)
> > #define dev_crit_ratelimited(dev, fmt, ...)				\
> > 	dev_ratelimited_level(dev, crit, fmt, ##__VA_ARGS__)
> > #define dev_err_ratelimited(dev, fmt, ...)				\
> > 	dev_ratelimited_level(dev, err, fmt, ##__VA_ARGS__)
> > #define dev_warn_ratelimited(dev, fmt, ...)				\
> > 	dev_ratelimited_level(dev, warn, fmt, ##__VA_ARGS__)
> > #define dev_notice_ratelimited(dev, fmt, ...)				\
> > 	dev_ratelimited_level(dev, notice, fmt, ##__VA_ARGS__)
> > #define dev_info_ratelimited(dev, fmt, ...)				\
> > 	dev_ratelimited_level(dev, info, fmt, ##__VA_ARGS__)
> > #define dev_dbg_ratelimited(dev, fmt, ...)				\
> > 	dev_ratelimited_level(dev, dbg, fmt, ##__VA_ARGS__)
> 
> "dev" isn't handled separately with __VA_ARGS__, and failed to build
> as below:
> 
>   Example:
>     dev_err_ratelimited(&pdev->dev, "%d\n", __LINE__);
>   
>   After preprocessded:
>     do { ... if (___ratelimit(&_rs, __func__)) dev_err("%d\n", 18); } while (0);
> 

Sorry, I was just typing in the email client and
I missed the "dev" argument.

Add "dev" to the dev_##level statement like:

#define dev_ratelimited_level(dev, level, fmt, ...)			\
do {									\
	static DEFINE_RATELIMIT_STATE(_rs,				\
				      DEFAULT_RATELIMIT_INTERVAL,	\
				      DEFAULT_RATELIMIT_BURST);		\
	if (__ratelimit(&_rs))						\
		dev_##level(dev, fmt, ##__VA_ARGS__);			\
} while (0)
 

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [RFC 1/1] driver core: Add dev_*_ratelimited() family
  2012-05-14  5:25     ` Joe Perches
@ 2012-05-14  5:40         ` Hiroshi Doyu
  0 siblings, 0 replies; 25+ messages in thread
From: Hiroshi Doyu @ 2012-05-14  5:40 UTC (permalink / raw)
  To: joe-6d6DIl74uiNBDgjK7y7TUQ
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-tegra-u79uwXL29TY76Z2rM5mHXA

Joe Perches <joe-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org> wrote @ Mon, 14 May 2012 07:25:55 +0200:

> On Mon, 2012-05-14 at 07:00 +0200, Hiroshi Doyu wrote:
> > Hi Joe,
> > 
> > Joe Perches <joe-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org> wrote @ Sat, 12 May 2012 17:31:35 +0200:
> > 
> > > On Sat, 2012-05-12 at 12:52 +0200, Hiroshi Doyu wrote:
> > > > Hi,
> > > > 
> > > > An unclosed "if" statement in the MACRO seems a bit risky, but I don't
> > > > have any better/simple solution for this, ATM. Is there any alternative?
> > > 
> > > maybe something like:
> > > 
> > > #define dev_ratelimited_level(dev, level, fmt, ...)
> > > do {
> > > 	static DEFINE_RATELIMIT_STATE(_rs,				\
> > > 				      DEFAULT_RATELIMIT_INTERVAL,	\
> > > 				      DEFAULT_RATELIMIT_BURST);		\
> > > 	if (__ratelimit(&_rs))						\
> > > 		dev_##level(fmt, ##__VA_ARGS__);			\
> > > } while (0)
> > > 
> > > #define dev_emerg_ratelimited(dev, fmt, ...)				\
> > > 	dev_ratelimited_level(dev, emerg, fmt, ##__VA_ARGS__)
> > > #define dev_alert_ratelimited(dev, fmt, ...)				\
> > > 	dev_ratelimited_level(dev, alert, fmt, ##__VA_ARGS__)
> > > #define dev_crit_ratelimited(dev, fmt, ...)				\
> > > 	dev_ratelimited_level(dev, crit, fmt, ##__VA_ARGS__)
> > > #define dev_err_ratelimited(dev, fmt, ...)				\
> > > 	dev_ratelimited_level(dev, err, fmt, ##__VA_ARGS__)
> > > #define dev_warn_ratelimited(dev, fmt, ...)				\
> > > 	dev_ratelimited_level(dev, warn, fmt, ##__VA_ARGS__)
> > > #define dev_notice_ratelimited(dev, fmt, ...)				\
> > > 	dev_ratelimited_level(dev, notice, fmt, ##__VA_ARGS__)
> > > #define dev_info_ratelimited(dev, fmt, ...)				\
> > > 	dev_ratelimited_level(dev, info, fmt, ##__VA_ARGS__)
> > > #define dev_dbg_ratelimited(dev, fmt, ...)				\
> > > 	dev_ratelimited_level(dev, dbg, fmt, ##__VA_ARGS__)
> > 
> > "dev" isn't handled separately with __VA_ARGS__, and failed to build
> > as below:
> > 
> >   Example:
> >     dev_err_ratelimited(&pdev->dev, "%d\n", __LINE__);
> >   
> >   After preprocessded:
> >     do { ... if (___ratelimit(&_rs, __func__)) dev_err("%d\n", 18); } while (0);
> > 
> 
> Sorry, I was just typing in the email client and
> I missed the "dev" argument.
> 
> Add "dev" to the dev_##level statement like:
> 
> #define dev_ratelimited_level(dev, level, fmt, ...)			\
> do {									\
> 	static DEFINE_RATELIMIT_STATE(_rs,				\
> 				      DEFAULT_RATELIMIT_INTERVAL,	\
> 				      DEFAULT_RATELIMIT_BURST);		\
> 	if (__ratelimit(&_rs))						\
> 		dev_##level(dev, fmt, ##__VA_ARGS__);			\
> } while (0)

Verified that the above works. Would you mind sending the complete version of this patch?

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [RFC 1/1] driver core: Add dev_*_ratelimited() family
@ 2012-05-14  5:40         ` Hiroshi Doyu
  0 siblings, 0 replies; 25+ messages in thread
From: Hiroshi Doyu @ 2012-05-14  5:40 UTC (permalink / raw)
  To: joe; +Cc: linux-kernel, linux-tegra

Joe Perches <joe@perches.com> wrote @ Mon, 14 May 2012 07:25:55 +0200:

> On Mon, 2012-05-14 at 07:00 +0200, Hiroshi Doyu wrote:
> > Hi Joe,
> > 
> > Joe Perches <joe@perches.com> wrote @ Sat, 12 May 2012 17:31:35 +0200:
> > 
> > > On Sat, 2012-05-12 at 12:52 +0200, Hiroshi Doyu wrote:
> > > > Hi,
> > > > 
> > > > An unclosed "if" statement in the MACRO seems a bit risky, but I don't
> > > > have any better/simple solution for this, ATM. Is there any alternative?
> > > 
> > > maybe something like:
> > > 
> > > #define dev_ratelimited_level(dev, level, fmt, ...)
> > > do {
> > > 	static DEFINE_RATELIMIT_STATE(_rs,				\
> > > 				      DEFAULT_RATELIMIT_INTERVAL,	\
> > > 				      DEFAULT_RATELIMIT_BURST);		\
> > > 	if (__ratelimit(&_rs))						\
> > > 		dev_##level(fmt, ##__VA_ARGS__);			\
> > > } while (0)
> > > 
> > > #define dev_emerg_ratelimited(dev, fmt, ...)				\
> > > 	dev_ratelimited_level(dev, emerg, fmt, ##__VA_ARGS__)
> > > #define dev_alert_ratelimited(dev, fmt, ...)				\
> > > 	dev_ratelimited_level(dev, alert, fmt, ##__VA_ARGS__)
> > > #define dev_crit_ratelimited(dev, fmt, ...)				\
> > > 	dev_ratelimited_level(dev, crit, fmt, ##__VA_ARGS__)
> > > #define dev_err_ratelimited(dev, fmt, ...)				\
> > > 	dev_ratelimited_level(dev, err, fmt, ##__VA_ARGS__)
> > > #define dev_warn_ratelimited(dev, fmt, ...)				\
> > > 	dev_ratelimited_level(dev, warn, fmt, ##__VA_ARGS__)
> > > #define dev_notice_ratelimited(dev, fmt, ...)				\
> > > 	dev_ratelimited_level(dev, notice, fmt, ##__VA_ARGS__)
> > > #define dev_info_ratelimited(dev, fmt, ...)				\
> > > 	dev_ratelimited_level(dev, info, fmt, ##__VA_ARGS__)
> > > #define dev_dbg_ratelimited(dev, fmt, ...)				\
> > > 	dev_ratelimited_level(dev, dbg, fmt, ##__VA_ARGS__)
> > 
> > "dev" isn't handled separately with __VA_ARGS__, and failed to build
> > as below:
> > 
> >   Example:
> >     dev_err_ratelimited(&pdev->dev, "%d\n", __LINE__);
> >   
> >   After preprocessded:
> >     do { ... if (___ratelimit(&_rs, __func__)) dev_err("%d\n", 18); } while (0);
> > 
> 
> Sorry, I was just typing in the email client and
> I missed the "dev" argument.
> 
> Add "dev" to the dev_##level statement like:
> 
> #define dev_ratelimited_level(dev, level, fmt, ...)			\
> do {									\
> 	static DEFINE_RATELIMIT_STATE(_rs,				\
> 				      DEFAULT_RATELIMIT_INTERVAL,	\
> 				      DEFAULT_RATELIMIT_BURST);		\
> 	if (__ratelimit(&_rs))						\
> 		dev_##level(dev, fmt, ##__VA_ARGS__);			\
> } while (0)

Verified that the above works. Would you mind sending the complete version of this patch?

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [RFC 1/1] driver core: Add dev_*_ratelimited() family
  2012-05-14  5:40         ` Hiroshi Doyu
@ 2012-05-14  6:05             ` Joe Perches
  -1 siblings, 0 replies; 25+ messages in thread
From: Joe Perches @ 2012-05-14  6:05 UTC (permalink / raw)
  To: Hiroshi Doyu
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-tegra-u79uwXL29TY76Z2rM5mHXA

On Mon, 2012-05-14 at 07:40 +0200, Hiroshi Doyu wrote:
> Joe Perches <joe-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org> wrote @ Mon, 14 May 2012 07:25:55 +0200:
> > On Mon, 2012-05-14 at 07:00 +0200, Hiroshi Doyu wrote:
> > > Joe Perches <joe-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org> wrote @ Sat, 12 May 2012 17:31:35 +0200:
> > > > On Sat, 2012-05-12 at 12:52 +0200, Hiroshi Doyu wrote:
> > > > > An unclosed "if" statement in the MACRO seems a bit risky, but I don't
> > > > > have any better/simple solution for this, ATM. Is there any alternative?
> > > > 
> > > > maybe something like:
> > > > 
> > > > #define dev_ratelimited_level(dev, level, fmt, ...)
> > > > do {
> > > > 	static DEFINE_RATELIMIT_STATE(_rs,				\
> > > > 				      DEFAULT_RATELIMIT_INTERVAL,	\
> > > > 				      DEFAULT_RATELIMIT_BURST);		\
> > > > 	if (__ratelimit(&_rs))						\
> > > > 		dev_##level(fmt, ##__VA_ARGS__);			\
> > > > } while (0)
> > > > 
> > > > #define dev_emerg_ratelimited(dev, fmt, ...)				\
> > > > 	dev_ratelimited_level(dev, emerg, fmt, ##__VA_ARGS__)
[...]
> > > > #define dev_dbg_ratelimited(dev, fmt, ...)				\
> > > > 	dev_ratelimited_level(dev, dbg, fmt, ##__VA_ARGS__)
> > > 
> > > "dev" isn't handled separately with __VA_ARGS__, and failed to build
> > > as below:
> > > 
> > >   Example:
> > >     dev_err_ratelimited(&pdev->dev, "%d\n", __LINE__);
> > >   
> > >   After preprocessded:
> > >     do { ... if (___ratelimit(&_rs, __func__)) dev_err("%d\n", 18); } while (0);
> > > 
> > 
> > Sorry, I was just typing in the email client and
> > I missed the "dev" argument.
> > 
> > Add "dev" to the dev_##level statement like:
> > 
> > #define dev_ratelimited_level(dev, level, fmt, ...)			\
> > do {									\
> > 	static DEFINE_RATELIMIT_STATE(_rs,				\
> > 				      DEFAULT_RATELIMIT_INTERVAL,	\
> > 				      DEFAULT_RATELIMIT_BURST);		\
> > 	if (__ratelimit(&_rs))						\
> > 		dev_##level(dev, fmt, ##__VA_ARGS__);			\
> > } while (0)
> 
> Verified that the above works. Would you mind sending the complete version of this patch?

Hello Hiroshi.

It's your patch and your idea.
I think you should submit it.
You were just asking for alternatives or a bit
of guidance.

Maybe a better name for dev_ratelimited_level is
dev_level_ratelimited and the macro should be

#define dev_level_ratelimited(dev_level, dev, fmt, ...)			\
do {									\
	static DEFINE_RATELIMIT_STATE(_rs,				\
				      DEFAULT_RATELIMIT_INTERVAL,	\
				      DEFAULT_RATELIMIT_BURST);		\
	if (__ratelimit(&_rs))						\
		dev_level(dev, fmt, ##__VA_ARGS__);			\
} while (0)

with uses like

#define dev_notice_ratelimited(dev, fmt, ...)				\
	dev_level_ratelimited(dev_notice, fmt, ##__VA_ARGS__)


Your choice though I think the last option above
may be better because it more closely follows the
style a dev_printk_ratelimited would use.

cheers, Joe

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [RFC 1/1] driver core: Add dev_*_ratelimited() family
@ 2012-05-14  6:05             ` Joe Perches
  0 siblings, 0 replies; 25+ messages in thread
From: Joe Perches @ 2012-05-14  6:05 UTC (permalink / raw)
  To: Hiroshi Doyu; +Cc: linux-kernel, linux-tegra

On Mon, 2012-05-14 at 07:40 +0200, Hiroshi Doyu wrote:
> Joe Perches <joe@perches.com> wrote @ Mon, 14 May 2012 07:25:55 +0200:
> > On Mon, 2012-05-14 at 07:00 +0200, Hiroshi Doyu wrote:
> > > Joe Perches <joe@perches.com> wrote @ Sat, 12 May 2012 17:31:35 +0200:
> > > > On Sat, 2012-05-12 at 12:52 +0200, Hiroshi Doyu wrote:
> > > > > An unclosed "if" statement in the MACRO seems a bit risky, but I don't
> > > > > have any better/simple solution for this, ATM. Is there any alternative?
> > > > 
> > > > maybe something like:
> > > > 
> > > > #define dev_ratelimited_level(dev, level, fmt, ...)
> > > > do {
> > > > 	static DEFINE_RATELIMIT_STATE(_rs,				\
> > > > 				      DEFAULT_RATELIMIT_INTERVAL,	\
> > > > 				      DEFAULT_RATELIMIT_BURST);		\
> > > > 	if (__ratelimit(&_rs))						\
> > > > 		dev_##level(fmt, ##__VA_ARGS__);			\
> > > > } while (0)
> > > > 
> > > > #define dev_emerg_ratelimited(dev, fmt, ...)				\
> > > > 	dev_ratelimited_level(dev, emerg, fmt, ##__VA_ARGS__)
[...]
> > > > #define dev_dbg_ratelimited(dev, fmt, ...)				\
> > > > 	dev_ratelimited_level(dev, dbg, fmt, ##__VA_ARGS__)
> > > 
> > > "dev" isn't handled separately with __VA_ARGS__, and failed to build
> > > as below:
> > > 
> > >   Example:
> > >     dev_err_ratelimited(&pdev->dev, "%d\n", __LINE__);
> > >   
> > >   After preprocessded:
> > >     do { ... if (___ratelimit(&_rs, __func__)) dev_err("%d\n", 18); } while (0);
> > > 
> > 
> > Sorry, I was just typing in the email client and
> > I missed the "dev" argument.
> > 
> > Add "dev" to the dev_##level statement like:
> > 
> > #define dev_ratelimited_level(dev, level, fmt, ...)			\
> > do {									\
> > 	static DEFINE_RATELIMIT_STATE(_rs,				\
> > 				      DEFAULT_RATELIMIT_INTERVAL,	\
> > 				      DEFAULT_RATELIMIT_BURST);		\
> > 	if (__ratelimit(&_rs))						\
> > 		dev_##level(dev, fmt, ##__VA_ARGS__);			\
> > } while (0)
> 
> Verified that the above works. Would you mind sending the complete version of this patch?

Hello Hiroshi.

It's your patch and your idea.
I think you should submit it.
You were just asking for alternatives or a bit
of guidance.

Maybe a better name for dev_ratelimited_level is
dev_level_ratelimited and the macro should be

#define dev_level_ratelimited(dev_level, dev, fmt, ...)			\
do {									\
	static DEFINE_RATELIMIT_STATE(_rs,				\
				      DEFAULT_RATELIMIT_INTERVAL,	\
				      DEFAULT_RATELIMIT_BURST);		\
	if (__ratelimit(&_rs))						\
		dev_level(dev, fmt, ##__VA_ARGS__);			\
} while (0)

with uses like

#define dev_notice_ratelimited(dev, fmt, ...)				\
	dev_level_ratelimited(dev_notice, fmt, ##__VA_ARGS__)


Your choice though I think the last option above
may be better because it more closely follows the
style a dev_printk_ratelimited would use.

cheers, Joe


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [RFC 1/1] driver core: Add dev_*_ratelimited() family
  2012-05-14  6:05             ` Joe Perches
  (?)
@ 2012-05-14  7:45             ` Hiroshi Doyu
       [not found]               ` <20120514.104512.775373956832728793.hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
  -1 siblings, 1 reply; 25+ messages in thread
From: Hiroshi Doyu @ 2012-05-14  7:45 UTC (permalink / raw)
  To: joe; +Cc: linux-kernel, linux-tegra

Joe Perches <joe@perches.com> wrote @ Mon, 14 May 2012 08:05:39 +0200:

> On Mon, 2012-05-14 at 07:40 +0200, Hiroshi Doyu wrote:
> > Joe Perches <joe@perches.com> wrote @ Mon, 14 May 2012 07:25:55 +0200:
> > > On Mon, 2012-05-14 at 07:00 +0200, Hiroshi Doyu wrote:
> > > > Joe Perches <joe@perches.com> wrote @ Sat, 12 May 2012 17:31:35 +0200:
> > > > > On Sat, 2012-05-12 at 12:52 +0200, Hiroshi Doyu wrote:
> > > > > > An unclosed "if" statement in the MACRO seems a bit risky, but I don't
> > > > > > have any better/simple solution for this, ATM. Is there any alternative?
> > > > > 
> > > > > maybe something like:
> > > > > 
> > > > > #define dev_ratelimited_level(dev, level, fmt, ...)
> > > > > do {
> > > > > 	static DEFINE_RATELIMIT_STATE(_rs,				\
> > > > > 				      DEFAULT_RATELIMIT_INTERVAL,	\
> > > > > 				      DEFAULT_RATELIMIT_BURST);		\
> > > > > 	if (__ratelimit(&_rs))						\
> > > > > 		dev_##level(fmt, ##__VA_ARGS__);			\
> > > > > } while (0)
> > > > > 
> > > > > #define dev_emerg_ratelimited(dev, fmt, ...)				\
> > > > > 	dev_ratelimited_level(dev, emerg, fmt, ##__VA_ARGS__)
> [...]
> > > > > #define dev_dbg_ratelimited(dev, fmt, ...)				\
> > > > > 	dev_ratelimited_level(dev, dbg, fmt, ##__VA_ARGS__)
> > > > 
> > > > "dev" isn't handled separately with __VA_ARGS__, and failed to build
> > > > as below:
> > > > 
> > > >   Example:
> > > >     dev_err_ratelimited(&pdev->dev, "%d\n", __LINE__);
> > > >   
> > > >   After preprocessded:
> > > >     do { ... if (___ratelimit(&_rs, __func__)) dev_err("%d\n", 18); } while (0);
> > > > 
> > > 
> > > Sorry, I was just typing in the email client and
> > > I missed the "dev" argument.
> > > 
> > > Add "dev" to the dev_##level statement like:
> > > 
> > > #define dev_ratelimited_level(dev, level, fmt, ...)			\
> > > do {									\
> > > 	static DEFINE_RATELIMIT_STATE(_rs,				\
> > > 				      DEFAULT_RATELIMIT_INTERVAL,	\
> > > 				      DEFAULT_RATELIMIT_BURST);		\
> > > 	if (__ratelimit(&_rs))						\
> > > 		dev_##level(dev, fmt, ##__VA_ARGS__);			\
> > > } while (0)
> > 
> > Verified that the above works. Would you mind sending the complete version of this patch?
> 
> Hello Hiroshi.
> 
> It's your patch and your idea.
> I think you should submit it.
> You were just asking for alternatives or a bit
> of guidance.

Thanks.

> Maybe a better name for dev_ratelimited_level is
> dev_level_ratelimited and the macro should be
> 
> #define dev_level_ratelimited(dev_level, dev, fmt, ...)			\
> do {									\
> 	static DEFINE_RATELIMIT_STATE(_rs,				\
> 				      DEFAULT_RATELIMIT_INTERVAL,	\
> 				      DEFAULT_RATELIMIT_BURST);		\
> 	if (__ratelimit(&_rs))						\
> 		dev_level(dev, fmt, ##__VA_ARGS__);			\
> } while (0)
> 
> with uses like
> 
> #define dev_notice_ratelimited(dev, fmt, ...)				\
> 	dev_level_ratelimited(dev_notice, fmt, ##__VA_ARGS__)
> 
> 
> Your choice though I think the last option above
> may be better because it more closely follows the
> style a dev_printk_ratelimited would use.

Agree. The complete version of the above patch follows this email.

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [PATCH 1/2] driver core: Add dev_*_ratelimited() family
  2012-05-14  7:45             ` Hiroshi Doyu
       [not found]               ` <20120514.104512.775373956832728793.hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
@ 2012-05-14  7:47                   ` Hiroshi DOYU
  0 siblings, 0 replies; 25+ messages in thread
From: Hiroshi DOYU @ 2012-05-14  7:47 UTC (permalink / raw)
  To: hdoyu-DDmLM1+adcrQT0dZR+AlfA
  Cc: joe-6d6DIl74uiNBDgjK7y7TUQ, linux-tegra-u79uwXL29TY76Z2rM5mHXA,
	Greg Kroah-Hartman, Grant Likely, Randy Dunlap,
	Rafael J. Wysocki, David S. Miller,
	netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

Add dev_*_ratelimited() family, dev_* version of pr_*_ratelimited().

Using Joe Perches's proposal/implementation.

Signed-off-by: Hiroshi DOYU <hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Cc: Joe Perches <joe-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org>
---
 include/linux/device.h |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/include/linux/device.h b/include/linux/device.h
index 8b9d03a..d3aafdb 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -23,6 +23,7 @@
 #include <linux/mutex.h>
 #include <linux/pm.h>
 #include <linux/atomic.h>
+#include <linux/ratelimit.h>
 #include <asm/device.h>
 
 struct device;
@@ -937,6 +938,32 @@ int _dev_info(const struct device *dev, const char *fmt, ...)
 
 #endif
 
+#define dev_level_ratelimited(dev_level, dev, fmt, ...)			\
+do {									\
+	static DEFINE_RATELIMIT_STATE(_rs,				\
+				      DEFAULT_RATELIMIT_INTERVAL,	\
+				      DEFAULT_RATELIMIT_BURST);		\
+	if (__ratelimit(&_rs))						\
+		dev_level(dev, fmt, ##__VA_ARGS__);			\
+} while (0)
+
+#define dev_emerg_ratelimited(dev, fmt, ...)				\
+	dev_level_ratelimited(dev_emerg, dev, fmt, ##__VA_ARGS__)
+#define dev_alert_ratelimited(dev, fmt, ...)				\
+	dev_level_ratelimited(dev_alert, dev, fmt, ##__VA_ARGS__)
+#define dev_crit_ratelimited(dev, fmt, ...)				\
+	dev_level_ratelimited(dev_crit, dev, fmt, ##__VA_ARGS__)
+#define dev_err_ratelimited(dev, fmt, ...)				\
+	dev_level_ratelimited(dev_err, dev, fmt, ##__VA_ARGS__)
+#define dev_warn_ratelimited(dev, fmt, ...)				\
+	dev_level_ratelimited(dev_warn, dev, fmt, ##__VA_ARGS__)
+#define dev_notice_ratelimited(dev, fmt, ...)				\
+	dev_level_ratelimited(dev_notice, dev, fmt, ##__VA_ARGS__)
+#define dev_info_ratelimited(dev, fmt, ...)				\
+	dev_level_ratelimited(dev_info, dev, fmt, ##__VA_ARGS__)
+#define dev_dbg_ratelimited(dev, fmt, ...)				\
+	dev_level_ratelimited(dev_dbg, dev, fmt, ##__VA_ARGS__)
+
 /*
  * Stupid hackaround for existing uses of non-printk uses dev_info
  *
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 1/2] driver core: Add dev_*_ratelimited() family
@ 2012-05-14  7:47                   ` Hiroshi DOYU
  0 siblings, 0 replies; 25+ messages in thread
From: Hiroshi DOYU @ 2012-05-14  7:47 UTC (permalink / raw)
  To: hdoyu
  Cc: joe, linux-tegra, Greg Kroah-Hartman, Grant Likely, Randy Dunlap,
	Rafael J. Wysocki, David S. Miller, netdev, linux-kernel

Add dev_*_ratelimited() family, dev_* version of pr_*_ratelimited().

Using Joe Perches's proposal/implementation.

Signed-off-by: Hiroshi DOYU <hdoyu@nvidia.com>
Cc: Joe Perches <joe@perches.com>
---
 include/linux/device.h |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/include/linux/device.h b/include/linux/device.h
index 8b9d03a..d3aafdb 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -23,6 +23,7 @@
 #include <linux/mutex.h>
 #include <linux/pm.h>
 #include <linux/atomic.h>
+#include <linux/ratelimit.h>
 #include <asm/device.h>
 
 struct device;
@@ -937,6 +938,32 @@ int _dev_info(const struct device *dev, const char *fmt, ...)
 
 #endif
 
+#define dev_level_ratelimited(dev_level, dev, fmt, ...)			\
+do {									\
+	static DEFINE_RATELIMIT_STATE(_rs,				\
+				      DEFAULT_RATELIMIT_INTERVAL,	\
+				      DEFAULT_RATELIMIT_BURST);		\
+	if (__ratelimit(&_rs))						\
+		dev_level(dev, fmt, ##__VA_ARGS__);			\
+} while (0)
+
+#define dev_emerg_ratelimited(dev, fmt, ...)				\
+	dev_level_ratelimited(dev_emerg, dev, fmt, ##__VA_ARGS__)
+#define dev_alert_ratelimited(dev, fmt, ...)				\
+	dev_level_ratelimited(dev_alert, dev, fmt, ##__VA_ARGS__)
+#define dev_crit_ratelimited(dev, fmt, ...)				\
+	dev_level_ratelimited(dev_crit, dev, fmt, ##__VA_ARGS__)
+#define dev_err_ratelimited(dev, fmt, ...)				\
+	dev_level_ratelimited(dev_err, dev, fmt, ##__VA_ARGS__)
+#define dev_warn_ratelimited(dev, fmt, ...)				\
+	dev_level_ratelimited(dev_warn, dev, fmt, ##__VA_ARGS__)
+#define dev_notice_ratelimited(dev, fmt, ...)				\
+	dev_level_ratelimited(dev_notice, dev, fmt, ##__VA_ARGS__)
+#define dev_info_ratelimited(dev, fmt, ...)				\
+	dev_level_ratelimited(dev_info, dev, fmt, ##__VA_ARGS__)
+#define dev_dbg_ratelimited(dev, fmt, ...)				\
+	dev_level_ratelimited(dev_dbg, dev, fmt, ##__VA_ARGS__)
+
 /*
  * Stupid hackaround for existing uses of non-printk uses dev_info
  *
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 1/2] driver core: Add dev_*_ratelimited() family
@ 2012-05-14  7:47                   ` Hiroshi DOYU
  0 siblings, 0 replies; 25+ messages in thread
From: Hiroshi DOYU @ 2012-05-14  7:47 UTC (permalink / raw)
  To: hdoyu-DDmLM1+adcrQT0dZR+AlfA
  Cc: joe-6d6DIl74uiNBDgjK7y7TUQ, linux-tegra-u79uwXL29TY76Z2rM5mHXA,
	Greg Kroah-Hartman, Grant Likely, Randy Dunlap,
	Rafael J. Wysocki, David S. Miller,
	netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

Add dev_*_ratelimited() family, dev_* version of pr_*_ratelimited().

Using Joe Perches's proposal/implementation.

Signed-off-by: Hiroshi DOYU <hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Cc: Joe Perches <joe-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org>
---
 include/linux/device.h |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/include/linux/device.h b/include/linux/device.h
index 8b9d03a..d3aafdb 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -23,6 +23,7 @@
 #include <linux/mutex.h>
 #include <linux/pm.h>
 #include <linux/atomic.h>
+#include <linux/ratelimit.h>
 #include <asm/device.h>
 
 struct device;
@@ -937,6 +938,32 @@ int _dev_info(const struct device *dev, const char *fmt, ...)
 
 #endif
 
+#define dev_level_ratelimited(dev_level, dev, fmt, ...)			\
+do {									\
+	static DEFINE_RATELIMIT_STATE(_rs,				\
+				      DEFAULT_RATELIMIT_INTERVAL,	\
+				      DEFAULT_RATELIMIT_BURST);		\
+	if (__ratelimit(&_rs))						\
+		dev_level(dev, fmt, ##__VA_ARGS__);			\
+} while (0)
+
+#define dev_emerg_ratelimited(dev, fmt, ...)				\
+	dev_level_ratelimited(dev_emerg, dev, fmt, ##__VA_ARGS__)
+#define dev_alert_ratelimited(dev, fmt, ...)				\
+	dev_level_ratelimited(dev_alert, dev, fmt, ##__VA_ARGS__)
+#define dev_crit_ratelimited(dev, fmt, ...)				\
+	dev_level_ratelimited(dev_crit, dev, fmt, ##__VA_ARGS__)
+#define dev_err_ratelimited(dev, fmt, ...)				\
+	dev_level_ratelimited(dev_err, dev, fmt, ##__VA_ARGS__)
+#define dev_warn_ratelimited(dev, fmt, ...)				\
+	dev_level_ratelimited(dev_warn, dev, fmt, ##__VA_ARGS__)
+#define dev_notice_ratelimited(dev, fmt, ...)				\
+	dev_level_ratelimited(dev_notice, dev, fmt, ##__VA_ARGS__)
+#define dev_info_ratelimited(dev, fmt, ...)				\
+	dev_level_ratelimited(dev_info, dev, fmt, ##__VA_ARGS__)
+#define dev_dbg_ratelimited(dev, fmt, ...)				\
+	dev_level_ratelimited(dev_dbg, dev, fmt, ##__VA_ARGS__)
+
 /*
  * Stupid hackaround for existing uses of non-printk uses dev_info
  *
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 2/2] memory: tegra{20,30}-mc: Use dev_err_ratelimited()
  2012-05-14  7:47                   ` Hiroshi DOYU
@ 2012-05-14  7:47                     ` Hiroshi DOYU
  -1 siblings, 0 replies; 25+ messages in thread
From: Hiroshi DOYU @ 2012-05-14  7:47 UTC (permalink / raw)
  To: hdoyu; +Cc: joe, linux-tegra, Greg Kroah-Hartman, Stephen Warren, linux-kernel

Introduce a new dev_*_ratelimited() instead of pr_*_ratelimited() for
better info to print.

Signed-off-by: Hiroshi DOYU <hdoyu@nvidia.com>
---
 drivers/memory/tegra20-mc.c |    3 ++-
 drivers/memory/tegra30-mc.c |    3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/memory/tegra20-mc.c b/drivers/memory/tegra20-mc.c
index 21a735e..d525322 100644
--- a/drivers/memory/tegra20-mc.c
+++ b/drivers/memory/tegra20-mc.c
@@ -161,7 +161,8 @@ static void tegra20_mc_decode(struct tegra20_mc *mc, int n)
 
 	idx = n - MC_INT_ERR_SHIFT;
 	if ((idx < 0) || (idx >= ARRAY_SIZE(reg))) {
-		pr_err_ratelimited("Unknown interrupt status %08lx\n", BIT(n));
+		dev_err_ratelimited(mc->dev, "Unknown interrupt status %08lx\n",
+				    BIT(n));
 		return;
 	}
 
diff --git a/drivers/memory/tegra30-mc.c b/drivers/memory/tegra30-mc.c
index c391c4e..fad6bb5 100644
--- a/drivers/memory/tegra30-mc.c
+++ b/drivers/memory/tegra30-mc.c
@@ -220,7 +220,8 @@ static void tegra30_mc_decode(struct tegra30_mc *mc, int n)
 
 	idx = n - MC_INT_ERR_SHIFT;
 	if ((idx < 0) || (idx >= ARRAY_SIZE(mc_int_err)) || (idx == 1)) {
-		pr_err_ratelimited("Unknown interrupt status %08lx\n", BIT(n));
+		dev_err_ratelimited(mc->dev, "Unknown interrupt status %08lx\n",
+				    BIT(n));
 		return;
 	}
 
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 2/2] memory: tegra{20,30}-mc: Use dev_err_ratelimited()
@ 2012-05-14  7:47                     ` Hiroshi DOYU
  0 siblings, 0 replies; 25+ messages in thread
From: Hiroshi DOYU @ 2012-05-14  7:47 UTC (permalink / raw)
  To: hdoyu; +Cc: joe, linux-tegra, Greg Kroah-Hartman, Stephen Warren, linux-kernel

Introduce a new dev_*_ratelimited() instead of pr_*_ratelimited() for
better info to print.

Signed-off-by: Hiroshi DOYU <hdoyu@nvidia.com>
---
 drivers/memory/tegra20-mc.c |    3 ++-
 drivers/memory/tegra30-mc.c |    3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/memory/tegra20-mc.c b/drivers/memory/tegra20-mc.c
index 21a735e..d525322 100644
--- a/drivers/memory/tegra20-mc.c
+++ b/drivers/memory/tegra20-mc.c
@@ -161,7 +161,8 @@ static void tegra20_mc_decode(struct tegra20_mc *mc, int n)
 
 	idx = n - MC_INT_ERR_SHIFT;
 	if ((idx < 0) || (idx >= ARRAY_SIZE(reg))) {
-		pr_err_ratelimited("Unknown interrupt status %08lx\n", BIT(n));
+		dev_err_ratelimited(mc->dev, "Unknown interrupt status %08lx\n",
+				    BIT(n));
 		return;
 	}
 
diff --git a/drivers/memory/tegra30-mc.c b/drivers/memory/tegra30-mc.c
index c391c4e..fad6bb5 100644
--- a/drivers/memory/tegra30-mc.c
+++ b/drivers/memory/tegra30-mc.c
@@ -220,7 +220,8 @@ static void tegra30_mc_decode(struct tegra30_mc *mc, int n)
 
 	idx = n - MC_INT_ERR_SHIFT;
 	if ((idx < 0) || (idx >= ARRAY_SIZE(mc_int_err)) || (idx == 1)) {
-		pr_err_ratelimited("Unknown interrupt status %08lx\n", BIT(n));
+		dev_err_ratelimited(mc->dev, "Unknown interrupt status %08lx\n",
+				    BIT(n));
 		return;
 	}
 
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [v2 1/1] memory: tegra{20,30}-mc: Use dev_err_ratelimited()
  2012-05-14  7:47                     ` Hiroshi DOYU
@ 2012-05-14 10:07                       ` Hiroshi DOYU
  -1 siblings, 0 replies; 25+ messages in thread
From: Hiroshi DOYU @ 2012-05-14 10:07 UTC (permalink / raw)
  To: hdoyu; +Cc: linux-tegra, Greg Kroah-Hartman, Stephen Warren, linux-kernel

Introduce a new dev_*_ratelimited() instead of pr_*_ratelimited() for
better info to print.

Signed-off-by: Hiroshi DOYU <hdoyu@nvidia.com>
---
 drivers/memory/tegra20-mc.c |    5 +++--
 drivers/memory/tegra30-mc.c |    5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/memory/tegra20-mc.c b/drivers/memory/tegra20-mc.c
index 2a437e9..a38d9d3 100644
--- a/drivers/memory/tegra20-mc.c
+++ b/drivers/memory/tegra20-mc.c
@@ -161,7 +161,8 @@ static void tegra20_mc_decode(struct tegra20_mc *mc, int n)
 
 	idx = n - MC_INT_ERR_SHIFT;
 	if ((idx < 0) || (idx >= ARRAY_SIZE(reg))) {
-		pr_err_ratelimited("Unknown interrupt status %08lx\n", BIT(n));
+		dev_err_ratelimited(mc->dev, "Unknown interrupt status %08lx\n",
+				    BIT(n));
 		return;
 	}
 
@@ -172,7 +173,7 @@ static void tegra20_mc_decode(struct tegra20_mc *mc, int n)
 
 	addr = mc_readl(mc, reg[idx].offset + sizeof(u32));
 
-	pr_err_ratelimited("%s (0x%08x): 0x%08x %s (%s %s)\n",
+	dev_err_ratelimited(mc->dev, "%s (0x%08x): 0x%08x %s (%s %s)\n",
 			   reg[idx].message, req, addr, client,
 			   (req & BIT(reg[idx].write_bit)) ? "write" : "read",
 			   (reg[idx].offset == MC_SECURITY_VIOLATION_STATUS) ?
diff --git a/drivers/memory/tegra30-mc.c b/drivers/memory/tegra30-mc.c
index ec9fc78..cb639b1 100644
--- a/drivers/memory/tegra30-mc.c
+++ b/drivers/memory/tegra30-mc.c
@@ -220,7 +220,8 @@ static void tegra30_mc_decode(struct tegra30_mc *mc, int n)
 
 	idx = n - MC_INT_ERR_SHIFT;
 	if ((idx < 0) || (idx >= ARRAY_SIZE(mc_int_err)) || (idx == 1)) {
-		pr_err_ratelimited("Unknown interrupt status %08lx\n", BIT(n));
+		dev_err_ratelimited(mc->dev, "Unknown interrupt status %08lx\n",
+				    BIT(n));
 		return;
 	}
 
@@ -243,7 +244,7 @@ static void tegra30_mc_decode(struct tegra30_mc *mc, int n)
 
 	addr = readl(mc + MC_ERR_ADR);
 
-	pr_err_ratelimited("%s (0x%08x): 0x%08x %s (%s %s %s %s)\n",
+	dev_err_ratelimited(mc->dev, "%s (0x%08x): 0x%08x %s (%s %s %s %s)\n",
 			   mc_int_err[idx], err, addr, client,
 			   (err & MC_ERR_SECURITY) ? "secure" : "non-secure",
 			   (err & MC_ERR_RW) ? "write" : "read",
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [v2 1/1] memory: tegra{20,30}-mc: Use dev_err_ratelimited()
@ 2012-05-14 10:07                       ` Hiroshi DOYU
  0 siblings, 0 replies; 25+ messages in thread
From: Hiroshi DOYU @ 2012-05-14 10:07 UTC (permalink / raw)
  To: hdoyu; +Cc: linux-tegra, Greg Kroah-Hartman, Stephen Warren, linux-kernel

Introduce a new dev_*_ratelimited() instead of pr_*_ratelimited() for
better info to print.

Signed-off-by: Hiroshi DOYU <hdoyu@nvidia.com>
---
 drivers/memory/tegra20-mc.c |    5 +++--
 drivers/memory/tegra30-mc.c |    5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/memory/tegra20-mc.c b/drivers/memory/tegra20-mc.c
index 2a437e9..a38d9d3 100644
--- a/drivers/memory/tegra20-mc.c
+++ b/drivers/memory/tegra20-mc.c
@@ -161,7 +161,8 @@ static void tegra20_mc_decode(struct tegra20_mc *mc, int n)
 
 	idx = n - MC_INT_ERR_SHIFT;
 	if ((idx < 0) || (idx >= ARRAY_SIZE(reg))) {
-		pr_err_ratelimited("Unknown interrupt status %08lx\n", BIT(n));
+		dev_err_ratelimited(mc->dev, "Unknown interrupt status %08lx\n",
+				    BIT(n));
 		return;
 	}
 
@@ -172,7 +173,7 @@ static void tegra20_mc_decode(struct tegra20_mc *mc, int n)
 
 	addr = mc_readl(mc, reg[idx].offset + sizeof(u32));
 
-	pr_err_ratelimited("%s (0x%08x): 0x%08x %s (%s %s)\n",
+	dev_err_ratelimited(mc->dev, "%s (0x%08x): 0x%08x %s (%s %s)\n",
 			   reg[idx].message, req, addr, client,
 			   (req & BIT(reg[idx].write_bit)) ? "write" : "read",
 			   (reg[idx].offset == MC_SECURITY_VIOLATION_STATUS) ?
diff --git a/drivers/memory/tegra30-mc.c b/drivers/memory/tegra30-mc.c
index ec9fc78..cb639b1 100644
--- a/drivers/memory/tegra30-mc.c
+++ b/drivers/memory/tegra30-mc.c
@@ -220,7 +220,8 @@ static void tegra30_mc_decode(struct tegra30_mc *mc, int n)
 
 	idx = n - MC_INT_ERR_SHIFT;
 	if ((idx < 0) || (idx >= ARRAY_SIZE(mc_int_err)) || (idx == 1)) {
-		pr_err_ratelimited("Unknown interrupt status %08lx\n", BIT(n));
+		dev_err_ratelimited(mc->dev, "Unknown interrupt status %08lx\n",
+				    BIT(n));
 		return;
 	}
 
@@ -243,7 +244,7 @@ static void tegra30_mc_decode(struct tegra30_mc *mc, int n)
 
 	addr = readl(mc + MC_ERR_ADR);
 
-	pr_err_ratelimited("%s (0x%08x): 0x%08x %s (%s %s %s %s)\n",
+	dev_err_ratelimited(mc->dev, "%s (0x%08x): 0x%08x %s (%s %s %s %s)\n",
 			   mc_int_err[idx], err, addr, client,
 			   (err & MC_ERR_SECURITY) ? "secure" : "non-secure",
 			   (err & MC_ERR_RW) ? "write" : "read",
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* Re: [v2 1/1] memory: tegra{20,30}-mc: Use dev_err_ratelimited()
  2012-05-14 10:07                       ` Hiroshi DOYU
@ 2012-05-14 18:33                           ` Stephen Warren
  -1 siblings, 0 replies; 25+ messages in thread
From: Stephen Warren @ 2012-05-14 18:33 UTC (permalink / raw)
  To: Hiroshi DOYU
  Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA, Greg Kroah-Hartman,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

On 05/14/2012 04:07 AM, Hiroshi DOYU wrote:
> Introduce a new dev_*_ratelimited() instead of pr_*_ratelimited() for
> better info to print.
> 
> Signed-off-by: Hiroshi DOYU <hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>

Acked-by: Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>

But note that this relies on the following patch or a variant of it:

http://patchwork.ozlabs.org/patch/158899/

which isn't anywhere yet.

(A variant of that patch was patch 1/2 the first time this patch was
posted, but v2 of this patch was posted separately without mentioning
the dependency)

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [v2 1/1] memory: tegra{20,30}-mc: Use dev_err_ratelimited()
@ 2012-05-14 18:33                           ` Stephen Warren
  0 siblings, 0 replies; 25+ messages in thread
From: Stephen Warren @ 2012-05-14 18:33 UTC (permalink / raw)
  To: Hiroshi DOYU; +Cc: linux-tegra, Greg Kroah-Hartman, linux-kernel

On 05/14/2012 04:07 AM, Hiroshi DOYU wrote:
> Introduce a new dev_*_ratelimited() instead of pr_*_ratelimited() for
> better info to print.
> 
> Signed-off-by: Hiroshi DOYU <hdoyu@nvidia.com>

Acked-by: Stephen Warren <swarren@wwwdotorg.org>

But note that this relies on the following patch or a variant of it:

http://patchwork.ozlabs.org/patch/158899/

which isn't anywhere yet.

(A variant of that patch was patch 1/2 the first time this patch was
posted, but v2 of this patch was posted separately without mentioning
the dependency)

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [v2 1/1] memory: tegra{20,30}-mc: Use dev_err_ratelimited()
  2012-05-14 18:33                           ` Stephen Warren
@ 2012-05-14 18:57                               ` Hiroshi Doyu
  -1 siblings, 0 replies; 25+ messages in thread
From: Hiroshi Doyu @ 2012-05-14 18:57 UTC (permalink / raw)
  To: swarren-3lzwWm7+Weoh9ZMKESR00Q, gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r
  Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA

Hi Stepehn,

Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org> wrote @ Mon, 14 May 2012 20:33:02 +0200:

> On 05/14/2012 04:07 AM, Hiroshi DOYU wrote:
> > Introduce a new dev_*_ratelimited() instead of pr_*_ratelimited() for
> > better info to print.
> > 
> > Signed-off-by: Hiroshi DOYU <hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
> 
> Acked-by: Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
> 
> But note that this relies on the following patch or a variant of it:
> 
> http://patchwork.ozlabs.org/patch/158899/
> 
> which isn't anywhere yet.
> 
> (A variant of that patch was patch 1/2 the first time this patch was
> posted, but v2 of this patch was posted separately without mentioning
> the dependency)

Greg has put the dependee patch in:

http://git.kernel.org/?p=linux/kernel/git/gregkh/driver-core.git;a=commit;h=6ca045930338485a8cdef117e74372aa1678009d

Anyway, I should have described the above dependency in commit note in
the patch, sorry for confusion.

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [v2 1/1] memory: tegra{20,30}-mc: Use dev_err_ratelimited()
@ 2012-05-14 18:57                               ` Hiroshi Doyu
  0 siblings, 0 replies; 25+ messages in thread
From: Hiroshi Doyu @ 2012-05-14 18:57 UTC (permalink / raw)
  To: swarren, gregkh; +Cc: linux-tegra, linux-kernel

Hi Stepehn,

Stephen Warren <swarren@wwwdotorg.org> wrote @ Mon, 14 May 2012 20:33:02 +0200:

> On 05/14/2012 04:07 AM, Hiroshi DOYU wrote:
> > Introduce a new dev_*_ratelimited() instead of pr_*_ratelimited() for
> > better info to print.
> > 
> > Signed-off-by: Hiroshi DOYU <hdoyu@nvidia.com>
> 
> Acked-by: Stephen Warren <swarren@wwwdotorg.org>
> 
> But note that this relies on the following patch or a variant of it:
> 
> http://patchwork.ozlabs.org/patch/158899/
> 
> which isn't anywhere yet.
> 
> (A variant of that patch was patch 1/2 the first time this patch was
> posted, but v2 of this patch was posted separately without mentioning
> the dependency)

Greg has put the dependee patch in:

http://git.kernel.org/?p=linux/kernel/git/gregkh/driver-core.git;a=commit;h=6ca045930338485a8cdef117e74372aa1678009d

Anyway, I should have described the above dependency in commit note in
the patch, sorry for confusion.

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [v2 1/1] memory: tegra{20,30}-mc: Use dev_err_ratelimited()
  2012-05-14 18:33                           ` Stephen Warren
@ 2012-05-14 19:09                               ` Greg Kroah-Hartman
  -1 siblings, 0 replies; 25+ messages in thread
From: Greg Kroah-Hartman @ 2012-05-14 19:09 UTC (permalink / raw)
  To: Stephen Warren
  Cc: Hiroshi DOYU, linux-tegra-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

On Mon, May 14, 2012 at 12:33:02PM -0600, Stephen Warren wrote:
> On 05/14/2012 04:07 AM, Hiroshi DOYU wrote:
> > Introduce a new dev_*_ratelimited() instead of pr_*_ratelimited() for
> > better info to print.
> > 
> > Signed-off-by: Hiroshi DOYU <hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
> 
> Acked-by: Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
> 
> But note that this relies on the following patch or a variant of it:
> 
> http://patchwork.ozlabs.org/patch/158899/
> 
> which isn't anywhere yet.
> 
> (A variant of that patch was patch 1/2 the first time this patch was
> posted, but v2 of this patch was posted separately without mentioning
> the dependency)

It was part of this thread, which I don't think you were copied on for
some reason.  Anyway, I applied it earlier today, thanks.

greg k-h

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [v2 1/1] memory: tegra{20,30}-mc: Use dev_err_ratelimited()
@ 2012-05-14 19:09                               ` Greg Kroah-Hartman
  0 siblings, 0 replies; 25+ messages in thread
From: Greg Kroah-Hartman @ 2012-05-14 19:09 UTC (permalink / raw)
  To: Stephen Warren; +Cc: Hiroshi DOYU, linux-tegra, linux-kernel

On Mon, May 14, 2012 at 12:33:02PM -0600, Stephen Warren wrote:
> On 05/14/2012 04:07 AM, Hiroshi DOYU wrote:
> > Introduce a new dev_*_ratelimited() instead of pr_*_ratelimited() for
> > better info to print.
> > 
> > Signed-off-by: Hiroshi DOYU <hdoyu@nvidia.com>
> 
> Acked-by: Stephen Warren <swarren@wwwdotorg.org>
> 
> But note that this relies on the following patch or a variant of it:
> 
> http://patchwork.ozlabs.org/patch/158899/
> 
> which isn't anywhere yet.
> 
> (A variant of that patch was patch 1/2 the first time this patch was
> posted, but v2 of this patch was posted separately without mentioning
> the dependency)

It was part of this thread, which I don't think you were copied on for
some reason.  Anyway, I applied it earlier today, thanks.

greg k-h

^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2012-05-14 19:09 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-12 10:52 [RFC 1/1] driver core: Add dev_*_ratelimited() family Hiroshi Doyu
2012-05-12 10:52 ` Hiroshi Doyu
     [not found] ` <20120512.135227.1196366807162247040.hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2012-05-12 11:32   ` Bernd Petrovitsch
2012-05-12 11:32     ` Bernd Petrovitsch
2012-05-12 15:31 ` Joe Perches
2012-05-14  5:00   ` Hiroshi Doyu
2012-05-14  5:25     ` Joe Perches
2012-05-14  5:40       ` Hiroshi Doyu
2012-05-14  5:40         ` Hiroshi Doyu
     [not found]         ` <20120514.084014.1683295633804914511.hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2012-05-14  6:05           ` Joe Perches
2012-05-14  6:05             ` Joe Perches
2012-05-14  7:45             ` Hiroshi Doyu
     [not found]               ` <20120514.104512.775373956832728793.hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2012-05-14  7:47                 ` [PATCH 1/2] " Hiroshi DOYU
2012-05-14  7:47                   ` Hiroshi DOYU
2012-05-14  7:47                   ` Hiroshi DOYU
2012-05-14  7:47                   ` [PATCH 2/2] memory: tegra{20,30}-mc: Use dev_err_ratelimited() Hiroshi DOYU
2012-05-14  7:47                     ` Hiroshi DOYU
2012-05-14 10:07                     ` [v2 1/1] " Hiroshi DOYU
2012-05-14 10:07                       ` Hiroshi DOYU
     [not found]                       ` <1336990031-15567-1-git-send-email-hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2012-05-14 18:33                         ` Stephen Warren
2012-05-14 18:33                           ` Stephen Warren
     [not found]                           ` <4FB14FDE.2080409-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-05-14 18:57                             ` Hiroshi Doyu
2012-05-14 18:57                               ` Hiroshi Doyu
2012-05-14 19:09                             ` Greg Kroah-Hartman
2012-05-14 19:09                               ` Greg Kroah-Hartman

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.