Commit 841bdb7c authored by Takashi Sakamoto's avatar Takashi Sakamoto Committed by Takashi Iwai

ALSA: vmaster: use position offset macro of TLV data

A series of SNDRV_CTL_TLVO_XXX macro was introduced for position offset
of TLV data. This commit applies a code optimization.
Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent e6f32bf4
...@@ -421,14 +421,16 @@ struct snd_kcontrol *snd_ctl_make_virtual_master(char *name, ...@@ -421,14 +421,16 @@ struct snd_kcontrol *snd_ctl_make_virtual_master(char *name,
kctl->private_free = master_free; kctl->private_free = master_free;
/* additional (constant) TLV read */ /* additional (constant) TLV read */
if (tlv && if (tlv) {
(tlv[0] == SNDRV_CTL_TLVT_DB_SCALE || unsigned int type = tlv[SNDRV_CTL_TLVO_TYPE];
tlv[0] == SNDRV_CTL_TLVT_DB_MINMAX || if (type == SNDRV_CTL_TLVT_DB_SCALE ||
tlv[0] == SNDRV_CTL_TLVT_DB_MINMAX_MUTE)) { type == SNDRV_CTL_TLVT_DB_MINMAX ||
type == SNDRV_CTL_TLVT_DB_MINMAX_MUTE) {
kctl->vd[0].access |= SNDRV_CTL_ELEM_ACCESS_TLV_READ; kctl->vd[0].access |= SNDRV_CTL_ELEM_ACCESS_TLV_READ;
memcpy(master->tlv, tlv, sizeof(master->tlv)); memcpy(master->tlv, tlv, sizeof(master->tlv));
kctl->tlv.p = master->tlv; kctl->tlv.p = master->tlv;
} }
}
return kctl; return kctl;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment