From: Takashi Sakamoto <o-takashi@sakamocchi.jp>
To: clemens@ladisch.de, tiwai@suse.de
Cc: alsa-devel@alsa-project.org
Subject: [PATCH 1/2] ALSA: ctl: evaluate macro instead of numerical value
Date: Thu, 9 Apr 2015 01:55:07 +0900 [thread overview]
Message-ID: <1428512108-1852-2-git-send-email-o-takashi@sakamocchi.jp> (raw)
In-Reply-To: <1428512108-1852-1-git-send-email-o-takashi@sakamocchi.jp>
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(-)
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
next prev parent reply other threads:[~2015-04-08 16:55 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-08 16:55 [PATCH 0/2 RFC] control core refactoring Takashi Sakamoto
2015-04-08 16:55 ` Takashi Sakamoto [this message]
2015-04-08 16:55 ` [PATCH 2/2] ALSA: ctl: refactoring for read operation Takashi Sakamoto
2015-04-09 5:33 ` Takashi Iwai
2015-04-09 7:35 ` Takashi Sakamoto
2015-04-09 8:17 ` Takashi Iwai
2015-04-09 23:42 ` [PATCH 0/2] control core refactoring Takashi Sakamoto
2015-04-09 23:43 ` [PATCH 1/2] ALSA: ctl: evaluate macro instead of numerical value Takashi Sakamoto
2015-04-10 7:49 ` Takashi Iwai
2015-04-12 7:20 ` Takashi Iwai
2015-04-09 23:43 ` [PATCH 2/2] ALSA: ctl: refactoring for read operation Takashi Sakamoto
2015-04-10 7:48 ` Takashi Iwai
2015-04-10 10:32 ` Takashi Sakamoto
2015-04-10 10:43 ` Takashi Iwai
2015-04-10 10:52 ` Takashi Sakamoto
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1428512108-1852-2-git-send-email-o-takashi@sakamocchi.jp \
--to=o-takashi@sakamocchi.jp \
--cc=alsa-devel@alsa-project.org \
--cc=clemens@ladisch.de \
--cc=tiwai@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.