linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ALSA: usb-audio: Don't use printk_ratelimit for debug prints
@ 2025-08-01 15:47 Sean Anderson
  2025-08-02 14:19 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Sean Anderson @ 2025-08-01 15:47 UTC (permalink / raw)
  To: Jaroslav Kysela, Takashi Iwai, linux-sound; +Cc: linux-kernel, Sean Anderson

printk_ratelimit is deprecated, since it shares state with all other
printk sites. Additionally, the suppression message is printed at
warning level even though the actual messages are printed at debug and
are (usually) invisible! This can result in thousands of messages like

retire_capture_urb: 4992 callbacks suppressed

in the console, and can inhibit debugging since it is unclear what the
source of the suppressed callbacks is.

Switch to dev_dbg_ratelimited which doesn't print anything unless debug
is enabled.

Signed-off-by: Sean Anderson <sean.anderson@linux.dev>
---

 sound/usb/pcm.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
index 08bf535ed163..96339594dfd5 100644
--- a/sound/usb/pcm.c
+++ b/sound/usb/pcm.c
@@ -1280,11 +1280,10 @@ static void retire_capture_urb(struct snd_usb_substream *subs,
 
 	for (i = 0; i < urb->number_of_packets; i++) {
 		cp = (unsigned char *)urb->transfer_buffer + urb->iso_frame_desc[i].offset + subs->pkt_offset_adj;
-		if (urb->iso_frame_desc[i].status && printk_ratelimit()) {
-			dev_dbg(&subs->dev->dev, "frame %d active: %d\n",
-				i, urb->iso_frame_desc[i].status);
-			// continue;
-		}
+		if (urb->iso_frame_desc[i].status)
+			dev_dbg_ratelimited(&subs->dev->dev,
+					    "frame %d active: %d\n", i,
+					    urb->iso_frame_desc[i].status);
 		bytes = urb->iso_frame_desc[i].actual_length;
 		if (subs->stream_offset_adj > 0) {
 			unsigned int adj = min(subs->stream_offset_adj, bytes);
-- 
2.35.1.1320.gc452695387.dirty


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

* Re: [PATCH] ALSA: usb-audio: Don't use printk_ratelimit for debug prints
  2025-08-01 15:47 [PATCH] ALSA: usb-audio: Don't use printk_ratelimit for debug prints Sean Anderson
@ 2025-08-02 14:19 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2025-08-02 14:19 UTC (permalink / raw)
  To: Sean Anderson; +Cc: Jaroslav Kysela, Takashi Iwai, linux-sound, linux-kernel

On Fri, 01 Aug 2025 17:47:10 +0200,
Sean Anderson wrote:
> 
> printk_ratelimit is deprecated, since it shares state with all other
> printk sites. Additionally, the suppression message is printed at
> warning level even though the actual messages are printed at debug and
> are (usually) invisible! This can result in thousands of messages like
> 
> retire_capture_urb: 4992 callbacks suppressed
> 
> in the console, and can inhibit debugging since it is unclear what the
> source of the suppressed callbacks is.
> 
> Switch to dev_dbg_ratelimited which doesn't print anything unless debug
> is enabled.
> 
> Signed-off-by: Sean Anderson <sean.anderson@linux.dev>

Applied now.  Thanks.


Takashi

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

end of thread, other threads:[~2025-08-02 14:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-01 15:47 [PATCH] ALSA: usb-audio: Don't use printk_ratelimit for debug prints Sean Anderson
2025-08-02 14:19 ` Takashi Iwai

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).