From fc8e5ab4a054ce85f9b8a836ee1d666005f54181 Mon Sep 17 00:00:00 2001 From: Mengdong Lin Date: Sun, 6 Nov 2016 13:11:04 +0800 Subject: [PATCH] topology: Use snd_config_get_bool to simplify boolean flag parsing The link flags in the text conf file are boolean, so this patch uses snd_config_get_bool() to simplify the code. Signed-off-by: Mengdong Lin Signed-off-by: Takashi Iwai --- src/topology/pcm.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/topology/pcm.c b/src/topology/pcm.c index 3f54e949..b7a2df76 100644 --- a/src/topology/pcm.c +++ b/src/topology/pcm.c @@ -400,13 +400,14 @@ static int tplg_parse_fe_dai(snd_tplg_t *tplg ATTRIBUTE_UNUSED, static int parse_flag(snd_config_t *n, unsigned int mask_in, unsigned int *mask, unsigned int *flags) { - const char *val = NULL; + int ret; - if (snd_config_get_string(n, &val) < 0) - return -EINVAL; + ret = snd_config_get_bool(n); + if (ret < 0) + return ret; *mask |= mask_in; - if (strcmp(val, "true") == 0) + if (ret) *flags |= mask_in; else *flags &= ~mask_in; -- 2.47.1