From: Daniel Mack <daniel@caiaq.de>
To: alsa-devel@alsa-project.org
Subject: [PATCH 1/3] snd-usb-caiaq: only warn once on streaming errors
Date: Wed, 18 Mar 2009 11:03:53 +0100 [thread overview]
Message-ID: <1237370635-27728-2-git-send-email-daniel@caiaq.de> (raw)
In-Reply-To: <1237370635-27728-1-git-send-email-daniel@caiaq.de>
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: Daniel Mack <daniel@caiaq.de>
---
sound/usb/caiaq/caiaq-audio.c | 4 +++-
sound/usb/caiaq/caiaq-device.h | 2 +-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/sound/usb/caiaq/caiaq-audio.c b/sound/usb/caiaq/caiaq-audio.c
index fc6d571..577b112 100644
--- a/sound/usb/caiaq/caiaq-audio.c
+++ b/sound/usb/caiaq/caiaq-audio.c
@@ -114,6 +114,7 @@ static int stream_start(struct snd_usb_caiaqdev *dev)
dev->output_panic = 0;
dev->first_packet = 1;
dev->streaming = 1;
+ dev->warned = 0;
for (i = 0; i < N_URBS; i++) {
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,
break;
}
- if (dev->input_panic || dev->output_panic) {
+ if ((dev->input_panic || dev->output_panic) && !dev->warned) {
debug("streaming error detected %s %s\n",
dev->input_panic ? "(input)" : "",
dev->output_panic ? "(output)" : "");
+ dev->warned = 1;
}
}
diff --git a/sound/usb/caiaq/caiaq-device.h b/sound/usb/caiaq/caiaq-device.h
index 3edd94d..4aa8631 100644
--- a/sound/usb/caiaq/caiaq-device.h
+++ b/sound/usb/caiaq/caiaq-device.h
@@ -90,7 +90,7 @@ struct snd_usb_caiaqdev {
int audio_out_buf_pos[MAX_STREAMS];
int period_in_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;
unsigned int samplerates;
--
1.6.2
next prev parent reply other threads:[~2009-03-18 10:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-18 10:03 Cleanup patches for snd-usb-caiaq Daniel Mack
2009-03-18 10:03 ` Daniel Mack [this message]
2009-03-18 10:03 ` [PATCH 2/3] snd-usb-caiaq: drop bogus iso packets Daniel Mack
2009-03-18 10:03 ` [PATCH 3/3] snd-usb-caiaq: bump version number Daniel Mack
2009-03-18 10:34 ` Cleanup patches for snd-usb-caiaq Takashi Iwai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1237370635-27728-2-git-send-email-daniel@caiaq.de \
--to=daniel@caiaq.de \
--cc=alsa-devel@alsa-project.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.