mirror of
https://github.com/torvalds/linux.git
synced 2026-05-28 09:04:39 +02:00
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>
This commit is contained in:
parent
fba2105a15
commit
e98696edac
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user