aboutsummaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorCharles Keepax <ckeepax@opensource.cirrus.com>2017-09-07 17:04:57 +0100
committerCharles Keepax <ckeepax@opensource.cirrus.com>2018-04-11 15:54:58 +0100
commit9ed7df6bea6e996b7ff2e0d22898425f2ae0feee (patch)
treec47e7c4c01113cb12a1eb932505404b0a6e72fd4 /utils
parente40758bb09cfae53d11b6fa97844c903bbd252e8 (diff)
Pull mixer_ctl_get_value out of loop in tinymix_print_enum
It is only required to obtain the value of the control once whilst processing tinymix_print_enum. This will significantly reduce the amount of IOCTLs sent for reading an enum control. Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Diffstat (limited to 'utils')
-rw-r--r--utils/tinymix.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/utils/tinymix.c b/utils/tinymix.c
index beaab2a..834766b 100644
--- a/utils/tinymix.c
+++ b/utils/tinymix.c
@@ -177,14 +177,15 @@ static void tinymix_print_enum(struct mixer_ctl *ctl)
{
unsigned int num_enums;
unsigned int i;
+ unsigned int value;
const char *string;
num_enums = mixer_ctl_get_num_enums(ctl);
+ value = mixer_ctl_get_value(ctl, 0);
for (i = 0; i < num_enums; i++) {
string = mixer_ctl_get_enum_string(ctl, i);
- printf("%s%s", mixer_ctl_get_value(ctl, 0) == (int)i ? ", " : "",
- string);
+ printf("%s%s", value == i ? ", " : "", string);
}
}