mirror of https://gitee.com/openkylin/linux.git
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: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
e6f32bf48f
commit
841bdb7c0b
|
@ -421,13 +421,15 @@ 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 ||
|
||||||
kctl->vd[0].access |= SNDRV_CTL_ELEM_ACCESS_TLV_READ;
|
type == SNDRV_CTL_TLVT_DB_MINMAX_MUTE) {
|
||||||
memcpy(master->tlv, tlv, sizeof(master->tlv));
|
kctl->vd[0].access |= SNDRV_CTL_ELEM_ACCESS_TLV_READ;
|
||||||
kctl->tlv.p = master->tlv;
|
memcpy(master->tlv, tlv, sizeof(master->tlv));
|
||||||
|
kctl->tlv.p = master->tlv;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return kctl;
|
return kctl;
|
||||||
|
|
Loading…
Reference in New Issue