提交 1313e704 编写于 作者: D Daniel Mack 提交者: Takashi Iwai

ALSA: snd-usb-caiaq: only warn once on streaming errors

Limit the number of printed warnings to one in case of streaming errors.
printk() happens to be expensive, especially in code called as often as
here.
Signed-off-by: NDaniel Mack <daniel@caiaq.de>
Signed-off-by: NTakashi Iwai <tiwai@suse.de>
上级 238c0270
...@@ -114,6 +114,7 @@ static int stream_start(struct snd_usb_caiaqdev *dev) ...@@ -114,6 +114,7 @@ static int stream_start(struct snd_usb_caiaqdev *dev)
dev->output_panic = 0; dev->output_panic = 0;
dev->first_packet = 1; dev->first_packet = 1;
dev->streaming = 1; dev->streaming = 1;
dev->warned = 0;
for (i = 0; i < N_URBS; i++) { for (i = 0; i < N_URBS; i++) {
ret = usb_submit_urb(dev->data_urbs_in[i], GFP_ATOMIC); ret = usb_submit_urb(dev->data_urbs_in[i], GFP_ATOMIC);
...@@ -406,10 +407,11 @@ static void read_in_urb(struct snd_usb_caiaqdev *dev, ...@@ -406,10 +407,11 @@ static void read_in_urb(struct snd_usb_caiaqdev *dev,
break; break;
} }
if (dev->input_panic || dev->output_panic) { if ((dev->input_panic || dev->output_panic) && !dev->warned) {
debug("streaming error detected %s %s\n", debug("streaming error detected %s %s\n",
dev->input_panic ? "(input)" : "", dev->input_panic ? "(input)" : "",
dev->output_panic ? "(output)" : ""); dev->output_panic ? "(output)" : "");
dev->warned = 1;
} }
} }
......
...@@ -89,7 +89,7 @@ struct snd_usb_caiaqdev { ...@@ -89,7 +89,7 @@ struct snd_usb_caiaqdev {
int audio_out_buf_pos[MAX_STREAMS]; int audio_out_buf_pos[MAX_STREAMS];
int period_in_count[MAX_STREAMS]; int period_in_count[MAX_STREAMS];
int period_out_count[MAX_STREAMS]; int period_out_count[MAX_STREAMS];
int input_panic, output_panic; int input_panic, output_panic, warned;
char *audio_in_buf, *audio_out_buf; char *audio_in_buf, *audio_out_buf;
unsigned int samplerates; unsigned int samplerates;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册