diff options
| author | Takashi Iwai <tiwai@suse.de> | 2009-06-08 09:58:48 -0400 |
|---|---|---|
| committer | Takashi Iwai <tiwai@suse.de> | 2009-06-08 10:01:47 -0400 |
| commit | c00701101b82f2bc61dfc259748ec6e5288af6a9 (patch) | |
| tree | e3c9c70ed0c36387f030e268c5f7baf30ab25814 | |
| parent | ab1863fc9bc18c806338564124b1e5e7e3ef53d1 (diff) | |
ALSA: pcm - A helper function to compose PCM stream name for debug prints
Use a common helper function for the PCM stream name displayed in
XRUN and buffer-pointer debug prints.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
| -rw-r--r-- | sound/core/pcm_lib.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index adb306fd5525..2288fa07bf59 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c | |||
| @@ -136,6 +136,16 @@ void snd_pcm_playback_silence(struct snd_pcm_substream *substream, snd_pcm_ufram | |||
| 136 | dump_stack(); \ | 136 | dump_stack(); \ |
| 137 | } while (0) | 137 | } while (0) |
| 138 | 138 | ||
| 139 | static void pcm_debug_name(struct snd_pcm_substream *substream, | ||
| 140 | char *name, size_t len) | ||
| 141 | { | ||
| 142 | snprintf(name, len, "pcmC%dD%d%c:%d", | ||
| 143 | substream->pcm->card->number, | ||
| 144 | substream->pcm->device, | ||
| 145 | substream->stream ? 'c' : 'p', | ||
| 146 | substream->number); | ||
| 147 | } | ||
| 148 | |||
| 139 | static void xrun(struct snd_pcm_substream *substream) | 149 | static void xrun(struct snd_pcm_substream *substream) |
| 140 | { | 150 | { |
| 141 | struct snd_pcm_runtime *runtime = substream->runtime; | 151 | struct snd_pcm_runtime *runtime = substream->runtime; |
| @@ -144,10 +154,9 @@ static void xrun(struct snd_pcm_substream *substream) | |||
| 144 | snd_pcm_gettime(runtime, (struct timespec *)&runtime->status->tstamp); | 154 | snd_pcm_gettime(runtime, (struct timespec *)&runtime->status->tstamp); |
| 145 | snd_pcm_stop(substream, SNDRV_PCM_STATE_XRUN); | 155 | snd_pcm_stop(substream, SNDRV_PCM_STATE_XRUN); |
| 146 | if (xrun_debug(substream, 1)) { | 156 | if (xrun_debug(substream, 1)) { |
| 147 | snd_printd(KERN_DEBUG "XRUN: pcmC%dD%d%c\n", | 157 | char name[16]; |
| 148 | substream->pcm->card->number, | 158 | pcm_debug_name(substream, name, sizeof(name)); |
| 149 | substream->pcm->device, | 159 | snd_printd(KERN_DEBUG "XRUN: %s\n", name); |
| 150 | substream->stream ? 'c' : 'p'); | ||
| 151 | dump_stack_on_xrun(substream); | 160 | dump_stack_on_xrun(substream); |
| 152 | } | 161 | } |
| 153 | } | 162 | } |
| @@ -163,9 +172,11 @@ snd_pcm_update_hw_ptr_pos(struct snd_pcm_substream *substream, | |||
| 163 | return pos; /* XRUN */ | 172 | return pos; /* XRUN */ |
| 164 | if (pos >= runtime->buffer_size) { | 173 | if (pos >= runtime->buffer_size) { |
| 165 | if (printk_ratelimit()) { | 174 | if (printk_ratelimit()) { |
| 166 | snd_printd(KERN_ERR "BUG: stream = %i, pos = 0x%lx, " | 175 | char name[16]; |
| 176 | pcm_debug_name(substream, name, sizeof(name)); | ||
| 177 | snd_printd(KERN_ERR "BUG: %s, pos = 0x%lx, " | ||
| 167 | "buffer size = 0x%lx, period size = 0x%lx\n", | 178 | "buffer size = 0x%lx, period size = 0x%lx\n", |
| 168 | substream->stream, pos, runtime->buffer_size, | 179 | name, pos, runtime->buffer_size, |
| 169 | runtime->period_size); | 180 | runtime->period_size); |
| 170 | } | 181 | } |
| 171 | pos = 0; | 182 | pos = 0; |
