From 1c82ed1bc531746a8fa9b46c593ddce546f28026 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 18 Feb 2008 13:05:50 +0100 Subject: [ALSA] Keep private TLV entry in vmaster itself Use a private array for TLV entries of virtual master controls instead of (supposed) static array. This cleans up the existing codes. Also, now vmaster assumes the simple dB-range TLV that is the only type it can handle. Signed-off-by: Takashi Iwai --- sound/core/vmaster.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'sound/core') diff --git a/sound/core/vmaster.c b/sound/core/vmaster.c index 7cfd8b8fb4e7..4cc57f902e2c 100644 --- a/sound/core/vmaster.c +++ b/sound/core/vmaster.c @@ -12,6 +12,7 @@ #include #include #include +#include /* * a subset of information returned via ctl info callback @@ -34,6 +35,7 @@ struct link_master { struct list_head slaves; struct link_ctl_info info; int val; /* the master value */ + unsigned int tlv[4]; }; /* @@ -357,11 +359,12 @@ struct snd_kcontrol *snd_ctl_make_virtual_master(char *name, kctl->private_free = master_free; /* additional (constant) TLV read */ - if (tlv) { - /* FIXME: this assumes that the max volume is 0 dB */ + if (tlv && tlv[0] == SNDRV_CTL_TLVT_DB_SCALE) { kctl->vd[0].access |= SNDRV_CTL_ELEM_ACCESS_TLV_READ; - kctl->tlv.p = tlv; + memcpy(master->tlv, tlv, sizeof(master->tlv)); + kctl->tlv.p = master->tlv; } + return kctl; } -- cgit v1.2.3