Message ID | 1428622981-9747-2-git-send-email-o-takashi@sakamocchi.jp (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
At Fri, 10 Apr 2015 08:43:00 +0900, Takashi Sakamoto wrote: > > 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> Applied, thanks. Takashi > --- > sound/core/control.c | 13 ++++++++----- > 1 file changed, 8 insertions(+), 5 deletions(-) > > diff --git a/sound/core/control.c b/sound/core/control.c > index 2ab7ee5..de19d56 100644 > --- a/sound/core/control.c > +++ b/sound/core/control.c > @@ -1114,7 +1114,7 @@ static int snd_ctl_elem_user_tlv(struct snd_kcontrol *kcontrol, > int change = 0; > void *new_data; > > - if (op_flag > 0) { > + if (op_flag == SNDRV_CTL_TLV_OP_WRITE) { > if (size > 1024 * 128) /* sane value */ > return -EINVAL; > > @@ -1411,9 +1411,12 @@ static int snd_ctl_tlv_ioctl(struct snd_ctl_file *file, > goto __kctl_end; > } > vd = &kctl->vd[tlv.numid - kctl->id.numid]; > - if ((op_flag == 0 && (vd->access & SNDRV_CTL_ELEM_ACCESS_TLV_READ) == 0) || > - (op_flag > 0 && (vd->access & SNDRV_CTL_ELEM_ACCESS_TLV_WRITE) == 0) || > - (op_flag < 0 && (vd->access & SNDRV_CTL_ELEM_ACCESS_TLV_COMMAND) == 0)) { > + if ((op_flag == SNDRV_CTL_TLV_OP_READ && > + (vd->access & SNDRV_CTL_ELEM_ACCESS_TLV_READ) == 0) || > + (op_flag == SNDRV_CTL_TLV_OP_WRITE && > + (vd->access & SNDRV_CTL_ELEM_ACCESS_TLV_WRITE) == 0) || > + (op_flag == SNDRV_CTL_TLV_OP_CMD && > + (vd->access & SNDRV_CTL_ELEM_ACCESS_TLV_COMMAND) == 0)) { > err = -ENXIO; > goto __kctl_end; > } > @@ -1430,7 +1433,7 @@ static int snd_ctl_tlv_ioctl(struct snd_ctl_file *file, > return 0; > } > } else { > - if (op_flag) { > + if (op_flag != SNDRV_CTL_ELEM_ACCESS_TLV_READ) { > err = -ENXIO; > goto __kctl_end; > } > -- > 2.1.0 >
diff --git a/sound/core/control.c b/sound/core/control.c index 2ab7ee5..de19d56 100644 --- a/sound/core/control.c +++ b/sound/core/control.c @@ -1114,7 +1114,7 @@ static int snd_ctl_elem_user_tlv(struct snd_kcontrol *kcontrol, int change = 0; void *new_data; - if (op_flag > 0) { + if (op_flag == SNDRV_CTL_TLV_OP_WRITE) { if (size > 1024 * 128) /* sane value */ return -EINVAL; @@ -1411,9 +1411,12 @@ static int snd_ctl_tlv_ioctl(struct snd_ctl_file *file, goto __kctl_end; } vd = &kctl->vd[tlv.numid - kctl->id.numid]; - if ((op_flag == 0 && (vd->access & SNDRV_CTL_ELEM_ACCESS_TLV_READ) == 0) || - (op_flag > 0 && (vd->access & SNDRV_CTL_ELEM_ACCESS_TLV_WRITE) == 0) || - (op_flag < 0 && (vd->access & SNDRV_CTL_ELEM_ACCESS_TLV_COMMAND) == 0)) { + if ((op_flag == SNDRV_CTL_TLV_OP_READ && + (vd->access & SNDRV_CTL_ELEM_ACCESS_TLV_READ) == 0) || + (op_flag == SNDRV_CTL_TLV_OP_WRITE && + (vd->access & SNDRV_CTL_ELEM_ACCESS_TLV_WRITE) == 0) || + (op_flag == SNDRV_CTL_TLV_OP_CMD && + (vd->access & SNDRV_CTL_ELEM_ACCESS_TLV_COMMAND) == 0)) { err = -ENXIO; goto __kctl_end; } @@ -1430,7 +1433,7 @@ static int snd_ctl_tlv_ioctl(struct snd_ctl_file *file, return 0; } } else { - if (op_flag) { + if (op_flag != SNDRV_CTL_ELEM_ACCESS_TLV_READ) { err = -ENXIO; goto __kctl_end; }
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> --- sound/core/control.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)