[v2,1/3] rt2x00: use ratelimited variants dev_warn/dev_err
diff mbox series

Message ID 1545318971-28351-1-git-send-email-sgruszka@redhat.com
State Changes Requested
Delegated to: Kalle Valo
Headers show
Series
  • [v2,1/3] rt2x00: use ratelimited variants dev_warn/dev_err
Related show

Commit Message

Stanislaw Gruszka Dec. 20, 2018, 3:16 p.m. UTC
As reported by Randy we can overwhelm logs on some USB error conditions.
To avoid that use dev_warn_ratelimited() and dev_err_ratelimitd().

Reported-and-tested-by: Randy Oostdyk <linux-kernel@oostdyk.com>
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
---
 drivers/net/wireless/ralink/rt2x00/rt2x00.h | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Comments

Joe Perches Dec. 21, 2018, 11:19 a.m. UTC | #1
On Thu, 2018-12-20 at 16:16 +0100, Stanislaw Gruszka wrote:
> As reported by Randy we can overwhelm logs on some USB error conditions.
> To avoid that use dev_warn_ratelimited() and dev_err_ratelimitd().
> 
> Reported-and-tested-by: Randy Oostdyk <linux-kernel@oostdyk.com>
> Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
> ---
>  drivers/net/wireless/ralink/rt2x00/rt2x00.h | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00.h b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
[]
> @@ -65,14 +65,19 @@
>  /* Utility printing macros
>   * rt2x00_probe_err is for messages when rt2x00_dev is uninitialized
>   */
> +#define wiphy_err_ratelimited(wiphy, format, args...)		\
> +	dev_err_ratelimited(&(wiphy)->dev, format, ##args)
> +#define wiphy_warn_ratelimited(wiphy, format, args...)		\
> +	dev_warn_ratelimited(&(wiphy)->dev, format, ##args)
> +

These should probably be generic in include/net/cfg80211.h
Stanislaw Gruszka Dec. 21, 2018, 11:57 a.m. UTC | #2
On Fri, Dec 21, 2018 at 03:19:31AM -0800, Joe Perches wrote:
> On Thu, 2018-12-20 at 16:16 +0100, Stanislaw Gruszka wrote:
> > As reported by Randy we can overwhelm logs on some USB error conditions.
> > To avoid that use dev_warn_ratelimited() and dev_err_ratelimitd().
> > 
> > Reported-and-tested-by: Randy Oostdyk <linux-kernel@oostdyk.com>
> > Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
> > ---
> >  drivers/net/wireless/ralink/rt2x00/rt2x00.h | 9 +++++++--
> >  1 file changed, 7 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00.h b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
> []
> > @@ -65,14 +65,19 @@
> >  /* Utility printing macros
> >   * rt2x00_probe_err is for messages when rt2x00_dev is uninitialized
> >   */
> > +#define wiphy_err_ratelimited(wiphy, format, args...)		\
> > +	dev_err_ratelimited(&(wiphy)->dev, format, ##args)
> > +#define wiphy_warn_ratelimited(wiphy, format, args...)		\
> > +	dev_warn_ratelimited(&(wiphy)->dev, format, ##args)
> > +
> 
> These should probably be generic in include/net/cfg80211.h

Since there are no other users I do not see reason for that. 
Those macros can be easily move, if other users would show up.

Regards
Stanislaw
Joe Perches Dec. 21, 2018, 12:48 p.m. UTC | #3
On Fri, 2018-12-21 at 12:57 +0100, Stanislaw Gruszka wrote:
> On Fri, Dec 21, 2018 at 03:19:31AM -0800, Joe Perches wrote:
> > On Thu, 2018-12-20 at 16:16 +0100, Stanislaw Gruszka wrote:
> > > As reported by Randy we can overwhelm logs on some USB error conditions.
> > > To avoid that use dev_warn_ratelimited() and dev_err_ratelimitd().
> > > 
> > > Reported-and-tested-by: Randy Oostdyk <linux-kernel@oostdyk.com>
> > > Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
> > > ---
> > >  drivers/net/wireless/ralink/rt2x00/rt2x00.h | 9 +++++++--
> > >  1 file changed, 7 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00.h b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
> > []
> > > @@ -65,14 +65,19 @@
> > >  /* Utility printing macros
> > >   * rt2x00_probe_err is for messages when rt2x00_dev is uninitialized
> > >   */
> > > +#define wiphy_err_ratelimited(wiphy, format, args...)		\
> > > +	dev_err_ratelimited(&(wiphy)->dev, format, ##args)
> > > +#define wiphy_warn_ratelimited(wiphy, format, args...)		\
> > > +	dev_warn_ratelimited(&(wiphy)->dev, format, ##args)
> > > +
> > 
> > These should probably be generic in include/net/cfg80211.h
> 
> Since there are no other users I do not see reason for that. 
> Those macros can be easily move, if other users would show up.

Other users won't show up if it's hidden away.
Stanislaw Gruszka Dec. 21, 2018, 12:51 p.m. UTC | #4
On Fri, Dec 21, 2018 at 04:48:17AM -0800, Joe Perches wrote:
> On Fri, 2018-12-21 at 12:57 +0100, Stanislaw Gruszka wrote:
> > On Fri, Dec 21, 2018 at 03:19:31AM -0800, Joe Perches wrote:
> > > On Thu, 2018-12-20 at 16:16 +0100, Stanislaw Gruszka wrote:
> > > > As reported by Randy we can overwhelm logs on some USB error conditions.
> > > > To avoid that use dev_warn_ratelimited() and dev_err_ratelimitd().
> > > > 
> > > > Reported-and-tested-by: Randy Oostdyk <linux-kernel@oostdyk.com>
> > > > Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
> > > > ---
> > > >  drivers/net/wireless/ralink/rt2x00/rt2x00.h | 9 +++++++--
> > > >  1 file changed, 7 insertions(+), 2 deletions(-)
> > > > 
> > > > diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00.h b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
> > > []
> > > > @@ -65,14 +65,19 @@
> > > >  /* Utility printing macros
> > > >   * rt2x00_probe_err is for messages when rt2x00_dev is uninitialized
> > > >   */
> > > > +#define wiphy_err_ratelimited(wiphy, format, args...)		\
> > > > +	dev_err_ratelimited(&(wiphy)->dev, format, ##args)
> > > > +#define wiphy_warn_ratelimited(wiphy, format, args...)		\
> > > > +	dev_warn_ratelimited(&(wiphy)->dev, format, ##args)
> > > > +
> > > 
> > > These should probably be generic in include/net/cfg80211.h
> > 
> > Since there are no other users I do not see reason for that. 
> > Those macros can be easily move, if other users would show up.
> 
> Other users won't show up if it's hidden away.

That would mean that others do not need this.

Thanks
Stanislaw
Kalle Valo Jan. 29, 2019, 12:30 p.m. UTC | #5
Stanislaw Gruszka <sgruszka@redhat.com> writes:

> On Fri, Dec 21, 2018 at 03:19:31AM -0800, Joe Perches wrote:
>> On Thu, 2018-12-20 at 16:16 +0100, Stanislaw Gruszka wrote:
>> > As reported by Randy we can overwhelm logs on some USB error conditions.
>> > To avoid that use dev_warn_ratelimited() and dev_err_ratelimitd().
>> > 
>> > Reported-and-tested-by: Randy Oostdyk <linux-kernel@oostdyk.com>
>> > Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
>> > ---
>> >  drivers/net/wireless/ralink/rt2x00/rt2x00.h | 9 +++++++--
>> >  1 file changed, 7 insertions(+), 2 deletions(-)
>> > 
>> > diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00.h b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
>> []
>> > @@ -65,14 +65,19 @@
>> >  /* Utility printing macros
>> >   * rt2x00_probe_err is for messages when rt2x00_dev is uninitialized
>> >   */
>> > +#define wiphy_err_ratelimited(wiphy, format, args...)		\
>> > +	dev_err_ratelimited(&(wiphy)->dev, format, ##args)
>> > +#define wiphy_warn_ratelimited(wiphy, format, args...)		\
>> > +	dev_warn_ratelimited(&(wiphy)->dev, format, ##args)
>> > +
>> 
>> These should probably be generic in include/net/cfg80211.h
>
> Since there are no other users I do not see reason for that. 
> Those macros can be easily move, if other users would show up.

I agree with Joe, these should be in cfg80211.h.

Patch
diff mbox series

diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00.h b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
index 4b1744e9fb78..94459d5ee01b 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
@@ -65,14 +65,19 @@ 
 /* Utility printing macros
  * rt2x00_probe_err is for messages when rt2x00_dev is uninitialized
  */
+#define wiphy_err_ratelimited(wiphy, format, args...)		\
+	dev_err_ratelimited(&(wiphy)->dev, format, ##args)
+#define wiphy_warn_ratelimited(wiphy, format, args...)		\
+	dev_warn_ratelimited(&(wiphy)->dev, format, ##args)
+
 #define rt2x00_probe_err(fmt, ...)					\
 	printk(KERN_ERR KBUILD_MODNAME ": %s: Error - " fmt,		\
 	       __func__, ##__VA_ARGS__)
 #define rt2x00_err(dev, fmt, ...)					\
-	wiphy_err((dev)->hw->wiphy, "%s: Error - " fmt,			\
+	wiphy_err_ratelimited((dev)->hw->wiphy, "%s: Error - " fmt,	\
 		  __func__, ##__VA_ARGS__)
 #define rt2x00_warn(dev, fmt, ...)					\
-	wiphy_warn((dev)->hw->wiphy, "%s: Warning - " fmt,		\
+	wiphy_warn_ratelimited((dev)->hw->wiphy, "%s: Warning - " fmt,	\
 		   __func__, ##__VA_ARGS__)
 #define rt2x00_info(dev, fmt, ...)					\
 	wiphy_info((dev)->hw->wiphy, "%s: Info - " fmt,			\