diff options
author | Takashi Sakamoto <o-takashi@sakamocchi.jp> | 2015-04-09 19:43:00 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2015-04-10 03:36:25 -0400 |
commit | 39d118677baa531cd9ee4c025a34f243746a3d18 (patch) | |
tree | c7f51ab981efa7e30afc13a68442fc371a254410 /sound/core/control.c | |
parent | cfd3113e7cc358b68bc13a2ca46714b0445dca56 (diff) |
ALSA: ctl: evaluate macro instead of numerical value
SNDRV_CTL_TLV_OP_XXX is defined but not used in core code. Instead,
raw numerical value is evaluated.
This commit replaces these values to these macros for better looking.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core/control.c')
-rw-r--r-- | sound/core/control.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/sound/core/control.c b/sound/core/control.c index d677c27746e9..00fcaa0ca647 100644 --- a/sound/core/control.c +++ b/sound/core/control.c | |||
@@ -1099,7 +1099,7 @@ static int snd_ctl_elem_user_tlv(struct snd_kcontrol *kcontrol, | |||
1099 | int change = 0; | 1099 | int change = 0; |
1100 | void *new_data; | 1100 | void *new_data; |
1101 | 1101 | ||
1102 | if (op_flag > 0) { | 1102 | if (op_flag == SNDRV_CTL_TLV_OP_WRITE) { |
1103 | if (size > 1024 * 128) /* sane value */ | 1103 | if (size > 1024 * 128) /* sane value */ |
1104 | return -EINVAL; | 1104 | return -EINVAL; |
1105 | 1105 | ||
@@ -1381,9 +1381,12 @@ static int snd_ctl_tlv_ioctl(struct snd_ctl_file *file, | |||
1381 | goto __kctl_end; | 1381 | goto __kctl_end; |
1382 | } | 1382 | } |
1383 | vd = &kctl->vd[tlv.numid - kctl->id.numid]; | 1383 | vd = &kctl->vd[tlv.numid - kctl->id.numid]; |
1384 | if ((op_flag == 0 && (vd->access & SNDRV_CTL_ELEM_ACCESS_TLV_READ) == 0) || | 1384 | if ((op_flag == SNDRV_CTL_TLV_OP_READ && |
1385 | (op_flag > 0 && (vd->access & SNDRV_CTL_ELEM_ACCESS_TLV_WRITE) == 0) || | 1385 | (vd->access & SNDRV_CTL_ELEM_ACCESS_TLV_READ) == 0) || |
1386 | (op_flag < 0 && (vd->access & SNDRV_CTL_ELEM_ACCESS_TLV_COMMAND) == 0)) { | 1386 | (op_flag == SNDRV_CTL_TLV_OP_WRITE && |
1387 | (vd->access & SNDRV_CTL_ELEM_ACCESS_TLV_WRITE) == 0) || | ||
1388 | (op_flag == SNDRV_CTL_TLV_OP_CMD && | ||
1389 | (vd->access & SNDRV_CTL_ELEM_ACCESS_TLV_COMMAND) == 0)) { | ||
1387 | err = -ENXIO; | 1390 | err = -ENXIO; |
1388 | goto __kctl_end; | 1391 | goto __kctl_end; |
1389 | } | 1392 | } |
@@ -1400,7 +1403,7 @@ static int snd_ctl_tlv_ioctl(struct snd_ctl_file *file, | |||
1400 | return 0; | 1403 | return 0; |
1401 | } | 1404 | } |
1402 | } else { | 1405 | } else { |
1403 | if (op_flag) { | 1406 | if (op_flag != SNDRV_CTL_ELEM_ACCESS_TLV_READ) { |
1404 | err = -ENXIO; | 1407 | err = -ENXIO; |
1405 | goto __kctl_end; | 1408 | goto __kctl_end; |
1406 | } | 1409 | } |