Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ALSA: usb-audio: Avoid potentially repeated XRUN error messages

Some XRUN-related error messages may repeat themselves, because there
can be multiple pending packets. Modify notify_xrun() function to
return whether it's being stopped or not, and show the error message
only once when the XRUN is actually handled.

Along with it, fix a typo of word package to packet in the error
message.

Link: https://patch.msgid.link/20260216141209.1849200-5-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>

+14 -9
+14 -9
sound/usb/endpoint.c
··· 402 402 } 403 403 404 404 /* notify an error as XRUN to the assigned PCM data substream */ 405 - static void notify_xrun(struct snd_usb_endpoint *ep) 405 + static bool notify_xrun(struct snd_usb_endpoint *ep) 406 406 { 407 407 struct snd_usb_substream *data_subs; 408 408 struct snd_pcm_substream *psubs; 409 409 410 410 data_subs = READ_ONCE(ep->data_subs); 411 411 if (!data_subs) 412 - return; 412 + return false; 413 413 psubs = data_subs->pcm_substream; 414 414 if (psubs && psubs->runtime && 415 - psubs->runtime->state == SNDRV_PCM_STATE_RUNNING) 415 + psubs->runtime->state == SNDRV_PCM_STATE_RUNNING) { 416 416 snd_pcm_stop_xrun(psubs); 417 + return true; 418 + } 419 + return false; 417 420 } 418 421 419 422 static struct snd_usb_packet_info * ··· 597 594 return; 598 595 599 596 if (!atomic_read(&ep->chip->shutdown)) { 600 - usb_audio_err(ep->chip, "cannot submit urb (err = %d)\n", err); 601 - notify_xrun(ep); 597 + if (notify_xrun(ep)) 598 + usb_audio_err(ep->chip, 599 + "cannot submit urb (err = %d)\n", err); 602 600 } 603 601 604 602 exit_clear: ··· 1783 1779 spin_lock_irqsave(&ep->lock, flags); 1784 1780 if (ep->next_packet_queued >= ARRAY_SIZE(ep->next_packet)) { 1785 1781 spin_unlock_irqrestore(&ep->lock, flags); 1786 - usb_audio_err(ep->chip, 1787 - "next package FIFO overflow EP 0x%x\n", 1788 - ep->ep_num); 1789 - notify_xrun(ep); 1782 + if (notify_xrun(ep)) { 1783 + usb_audio_err(ep->chip, 1784 + "next packet FIFO overflow EP 0x%x\n", 1785 + ep->ep_num); 1786 + } 1790 1787 return; 1791 1788 } 1792 1789