diff options
author | Takashi Sakamoto <o-takashi@sakamocchi.jp> | 2018-05-14 07:09:51 +0900 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2018-05-14 17:47:48 +0200 |
commit | 841bdb7c0bde0fb2068c64a09bb89a06be63c4d6 (patch) | |
tree | 34b59394c2285149f679b9519195f6e8452fc403 /sound/core | |
parent | e6f32bf48fb1d3b7aedc0deb6e791362af71cb17 (diff) | |
download | blackbird-op-linux-841bdb7c0bde0fb2068c64a09bb89a06be63c4d6.tar.gz blackbird-op-linux-841bdb7c0bde0fb2068c64a09bb89a06be63c4d6.zip |
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>
Diffstat (limited to 'sound/core')
-rw-r--r-- | sound/core/vmaster.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/sound/core/vmaster.c b/sound/core/vmaster.c index 9e96186742d0..58fa3f94722a 100644 --- a/sound/core/vmaster.c +++ b/sound/core/vmaster.c @@ -421,13 +421,15 @@ struct snd_kcontrol *snd_ctl_make_virtual_master(char *name, kctl->private_free = master_free; /* additional (constant) TLV read */ - if (tlv && - (tlv[0] == SNDRV_CTL_TLVT_DB_SCALE || - tlv[0] == SNDRV_CTL_TLVT_DB_MINMAX || - tlv[0] == SNDRV_CTL_TLVT_DB_MINMAX_MUTE)) { - kctl->vd[0].access |= SNDRV_CTL_ELEM_ACCESS_TLV_READ; - memcpy(master->tlv, tlv, sizeof(master->tlv)); - kctl->tlv.p = master->tlv; + if (tlv) { + unsigned int type = tlv[SNDRV_CTL_TLVO_TYPE]; + if (type == SNDRV_CTL_TLVT_DB_SCALE || + type == SNDRV_CTL_TLVT_DB_MINMAX || + type == SNDRV_CTL_TLVT_DB_MINMAX_MUTE) { + kctl->vd[0].access |= SNDRV_CTL_ELEM_ACCESS_TLV_READ; + memcpy(master->tlv, tlv, sizeof(master->tlv)); + kctl->tlv.p = master->tlv; + } } return kctl; |