aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/hda_proc.c
diff options
context:
space:
mode:
authorWu Fengguang <wfg@linux.intel.com>2008-11-18 11:47:51 +0800
committerTakashi Iwai <tiwai@suse.de>2008-11-18 07:38:51 +0100
commit33deeca3bb6a945677d70876ea9d044fc5797eb3 (patch)
treef66885f6f6122559cbb38de1bcced20a0007ef5d /sound/pci/hda/hda_proc.c
parent2eca83ba9cc6f811f8c63314b22b4bc0532e2207 (diff)
downloadkernel_samsung_smdk4412-33deeca3bb6a945677d70876ea9d044fc5797eb3.zip
kernel_samsung_smdk4412-33deeca3bb6a945677d70876ea9d044fc5797eb3.tar.gz
kernel_samsung_smdk4412-33deeca3bb6a945677d70876ea9d044fc5797eb3.tar.bz2
ALSA: introduce snd_print_pcm_rates()
We want to share some code with print_pcm_rates(), so extract a common routine snd_print_pcm_rates() from it. Signed-off-by: Wu Fengguang <wfg@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/hda_proc.c')
-rw-r--r--sound/pci/hda/hda_proc.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/sound/pci/hda/hda_proc.c b/sound/pci/hda/hda_proc.c
index 64b6a38..512eb67 100644
--- a/sound/pci/hda/hda_proc.c
+++ b/sound/pci/hda/hda_proc.c
@@ -89,20 +89,28 @@ static void print_amp_vals(struct snd_info_buffer *buffer,
snd_iprintf(buffer, "\n");
}
-static void print_pcm_rates(struct snd_info_buffer *buffer, unsigned int pcm)
+void snd_print_pcm_rates(int pcm, char *buf, int buflen)
{
static unsigned int rates[] = {
8000, 11025, 16000, 22050, 32000, 44100, 48000, 88200,
96000, 176400, 192000, 384000
};
- int i;
+ int i, j;
+
+ for (i = 0, j = 0; i < ARRAY_SIZE(rates); i++)
+ if (pcm & (1 << i))
+ j += snprintf(buf + j, buflen - j, " %d", rates[i]);
+
+ buf[j] = '\0'; /* necessary when j == 0 */
+}
+static void print_pcm_rates(struct snd_info_buffer *buffer, unsigned int pcm)
+{
+ char buf[SND_PRINT_RATES_ADVISED_BUFSIZE];
pcm &= AC_SUPPCM_RATES;
snd_iprintf(buffer, " rates [0x%x]:", pcm);
- for (i = 0; i < ARRAY_SIZE(rates); i++)
- if (pcm & (1 << i))
- snd_iprintf(buffer, " %d", rates[i]);
- snd_iprintf(buffer, "\n");
+ snd_print_pcm_rates(pcm, buf, sizeof(buf));
+ snd_iprintf(buffer, "%s\n", buf);
}
static void print_pcm_bits(struct snd_info_buffer *buffer, unsigned int pcm)