Commit 9ee92f53 authored by Yisheng Xie's avatar Yisheng Xie Committed by Takashi Iwai

ALSA: oxygen: use match_string() helper

match_string() returns the index of an array for a matching string,
which can be used instead of open coded variant.
Signed-off-by: default avatarYisheng Xie <xieyisheng1@huawei.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 0d5bcfc9
...@@ -1052,10 +1052,10 @@ static int add_controls(struct oxygen *chip, ...@@ -1052,10 +1052,10 @@ static int add_controls(struct oxygen *chip,
[CONTROL_CD_CAPTURE_SWITCH] = "CD Capture Switch", [CONTROL_CD_CAPTURE_SWITCH] = "CD Capture Switch",
[CONTROL_AUX_CAPTURE_SWITCH] = "Aux Capture Switch", [CONTROL_AUX_CAPTURE_SWITCH] = "Aux Capture Switch",
}; };
unsigned int i, j; unsigned int i;
struct snd_kcontrol_new template; struct snd_kcontrol_new template;
struct snd_kcontrol *ctl; struct snd_kcontrol *ctl;
int err; int j, err;
for (i = 0; i < count; ++i) { for (i = 0; i < count; ++i) {
template = controls[i]; template = controls[i];
...@@ -1086,11 +1086,11 @@ static int add_controls(struct oxygen *chip, ...@@ -1086,11 +1086,11 @@ static int add_controls(struct oxygen *chip,
err = snd_ctl_add(chip->card, ctl); err = snd_ctl_add(chip->card, ctl);
if (err < 0) if (err < 0)
return err; return err;
for (j = 0; j < CONTROL_COUNT; ++j) j = match_string(known_ctl_names, CONTROL_COUNT, ctl->id.name);
if (!strcmp(ctl->id.name, known_ctl_names[j])) { if (j >= 0) {
chip->controls[j] = ctl; chip->controls[j] = ctl;
ctl->private_free = oxygen_any_ctl_free; ctl->private_free = oxygen_any_ctl_free;
} }
} }
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment