aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/hda_proc.c
diff options
context:
space:
mode:
authorWu Fengguang <wfg@linux.intel.com>2008-11-19 15:14:02 +0800
committerTakashi Iwai <tiwai@suse.de>2008-11-19 09:42:30 +0100
commitd39b4352f2356bde9d4dae8591d4c8022360922f (patch)
tree366adb79cec9aad126037d113686948c0b7696ac /sound/pci/hda/hda_proc.c
parent06f69d17a90ced7d74ff12ce69b7b101aed4ffd9 (diff)
downloadkernel_goldelico_gta04-d39b4352f2356bde9d4dae8591d4c8022360922f.zip
kernel_goldelico_gta04-d39b4352f2356bde9d4dae8591d4c8022360922f.tar.gz
kernel_goldelico_gta04-d39b4352f2356bde9d4dae8591d4c8022360922f.tar.bz2
ALSA: hda: make global snd_print_pcm_bits()
Introduce a global function snd_print_pcm_bits() and use it in the ELD code. 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.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/sound/pci/hda/hda_proc.c b/sound/pci/hda/hda_proc.c
index 512eb67..d956e97 100644
--- a/sound/pci/hda/hda_proc.c
+++ b/sound/pci/hda/hda_proc.c
@@ -107,23 +107,33 @@ void snd_print_pcm_rates(int pcm, char *buf, int buflen)
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);
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)
+void snd_print_pcm_bits(int pcm, char *buf, int buflen)
{
static unsigned int bits[] = { 8, 16, 20, 24, 32 };
- int i;
+ int i, j;
+
+ for (i = 0, j = 0; i < ARRAY_SIZE(bits); i++)
+ if (pcm & (1 << i))
+ j += snprintf(buf + j, buflen - j, " %d", bits[i]);
+
+ buf[j] = '\0'; /* necessary when j == 0 */
+}
+
+static void print_pcm_bits(struct snd_info_buffer *buffer, unsigned int pcm)
+{
+ char buf[SND_PRINT_BITS_ADVISED_BUFSIZE];
pcm = (pcm >> 16) & 0xff;
snd_iprintf(buffer, " bits [0x%x]:", pcm);
- for (i = 0; i < ARRAY_SIZE(bits); i++)
- if (pcm & (1 << i))
- snd_iprintf(buffer, " %d", bits[i]);
- snd_iprintf(buffer, "\n");
+ snd_print_pcm_bits(pcm, buf, sizeof(buf));
+ snd_iprintf(buffer, "%s\n", buf);
}
static void print_pcm_formats(struct snd_info_buffer *buffer,