summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2026-02-16 15:12:08 +0100
committerTakashi Iwai <tiwai@suse.de>2026-02-16 15:13:59 +0100
commite98696edac6945144ece6819b0fad47192df4b2b (patch)
treee8e9b992b01d71e53d268e9a5fd8b1da29abbe12
parentfba2105a157fffcf19825e4eea498346738c9948 (diff)
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>
-rw-r--r--sound/usb/endpoint.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c
index 6e443f762de8..a855b2cc60c7 100644
--- a/sound/usb/endpoint.c
+++ b/sound/usb/endpoint.c
@@ -402,18 +402,21 @@ static int prepare_inbound_urb(struct snd_usb_endpoint *ep,
}
/* notify an error as XRUN to the assigned PCM data substream */
-static void notify_xrun(struct snd_usb_endpoint *ep)
+static bool notify_xrun(struct snd_usb_endpoint *ep)
{
struct snd_usb_substream *data_subs;
struct snd_pcm_substream *psubs;
data_subs = READ_ONCE(ep->data_subs);
if (!data_subs)
- return;
+ return false;
psubs = data_subs->pcm_substream;
if (psubs && psubs->runtime &&
- psubs->runtime->state == SNDRV_PCM_STATE_RUNNING)
+ psubs->runtime->state == SNDRV_PCM_STATE_RUNNING) {
snd_pcm_stop_xrun(psubs);
+ return true;
+ }
+ return false;
}
static struct snd_usb_packet_info *
@@ -594,8 +597,9 @@ static void snd_complete_urb(struct urb *urb)
return;
if (!atomic_read(&ep->chip->shutdown)) {
- usb_audio_err(ep->chip, "cannot submit urb (err = %d)\n", err);
- notify_xrun(ep);
+ if (notify_xrun(ep))
+ usb_audio_err(ep->chip,
+ "cannot submit urb (err = %d)\n", err);
}
exit_clear:
@@ -1779,10 +1783,11 @@ static void snd_usb_handle_sync_urb(struct snd_usb_endpoint *ep,
spin_lock_irqsave(&ep->lock, flags);
if (ep->next_packet_queued >= ARRAY_SIZE(ep->next_packet)) {
spin_unlock_irqrestore(&ep->lock, flags);
- usb_audio_err(ep->chip,
- "next package FIFO overflow EP 0x%x\n",
- ep->ep_num);
- notify_xrun(ep);
+ if (notify_xrun(ep)) {
+ usb_audio_err(ep->chip,
+ "next packet FIFO overflow EP 0x%x\n",
+ ep->ep_num);
+ }
return;
}