1 From b7a7723513dc89f83d6df13206df55d4dc26e825 Mon Sep 17 00:00:00 2001
2 From: Sander Eikelenboom <linux@eikelenboom.it>
3 Date: Fri, 2 May 2014 15:09:27 +0200
4 Subject: ALSA: usb-audio: Prevent printk ratelimiting from spamming kernel log while DEBUG not defined
6 From: Sander Eikelenboom <linux@eikelenboom.it>
8 commit b7a7723513dc89f83d6df13206df55d4dc26e825 upstream.
10 This (widely used) construction:
12 if(printk_ratelimit())
15 Causes the ratelimiting to spam the kernel log with the "callbacks suppressed"
16 message below, even while the dev_dbg it is supposed to rate limit wouldn't
17 print anything because DEBUG is not defined for this device.
19 [ 533.803964] retire_playback_urb: 852 callbacks suppressed
20 [ 538.807930] retire_playback_urb: 852 callbacks suppressed
21 [ 543.811897] retire_playback_urb: 852 callbacks suppressed
22 [ 548.815745] retire_playback_urb: 852 callbacks suppressed
23 [ 553.819826] retire_playback_urb: 852 callbacks suppressed
25 So use dev_dbg_ratelimited() instead of this construction.
27 Signed-off-by: Sander Eikelenboom <linux@eikelenboom.it>
28 Signed-off-by: Takashi Iwai <tiwai@suse.de>
29 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
32 sound/usb/pcm.c | 6 +++---
33 1 file changed, 3 insertions(+), 3 deletions(-)
37 @@ -1419,9 +1419,9 @@ static void retire_playback_urb(struct s
38 * The error should be lower than 2ms since the estimate relies
39 * on two reads of a counter updated every ms.
41 - if (printk_ratelimit() &&
42 - abs(est_delay - subs->last_delay) * 1000 > runtime->rate * 2)
43 - snd_printk(KERN_DEBUG "delay: estimated %d, actual %d\n",
44 + if (abs(est_delay - subs->last_delay) * 1000 > runtime->rate * 2)
45 + dev_dbg_ratelimited(&subs->dev->dev,
46 + "delay: estimated %d, actual %d\n",
47 est_delay, subs->last_delay);