summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYisheng Xie <xieyisheng1@huawei.com>2018-05-31 19:11:20 +0800
committerTakashi Iwai <tiwai@suse.de>2018-05-31 19:42:48 +0200
commit9ee92f5355f8264de20c8337823aff918c717aee (patch)
treebd3722e3ad66f9a09446c78221e919d82166600e
parent0d5bcfc9974ad8ce0fc77a95a53ab704faa0dfb7 (diff)
downloadlinux-9ee92f5355f8264de20c8337823aff918c717aee.tar.bz2
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: Yisheng Xie <xieyisheng1@huawei.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/pci/oxygen/oxygen_mixer.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/sound/pci/oxygen/oxygen_mixer.c b/sound/pci/oxygen/oxygen_mixer.c
index 4ca12665ff73..81af21ac1439 100644
--- a/sound/pci/oxygen/oxygen_mixer.c
+++ b/sound/pci/oxygen/oxygen_mixer.c
@@ -1052,10 +1052,10 @@ static int add_controls(struct oxygen *chip,
[CONTROL_CD_CAPTURE_SWITCH] = "CD Capture Switch",
[CONTROL_AUX_CAPTURE_SWITCH] = "Aux Capture Switch",
};
- unsigned int i, j;
+ unsigned int i;
struct snd_kcontrol_new template;
struct snd_kcontrol *ctl;
- int err;
+ int j, err;
for (i = 0; i < count; ++i) {
template = controls[i];
@@ -1086,11 +1086,11 @@ static int add_controls(struct oxygen *chip,
err = snd_ctl_add(chip->card, ctl);
if (err < 0)
return err;
- for (j = 0; j < CONTROL_COUNT; ++j)
- if (!strcmp(ctl->id.name, known_ctl_names[j])) {
- chip->controls[j] = ctl;
- ctl->private_free = oxygen_any_ctl_free;
- }
+ j = match_string(known_ctl_names, CONTROL_COUNT, ctl->id.name);
+ if (j >= 0) {
+ chip->controls[j] = ctl;
+ ctl->private_free = oxygen_any_ctl_free;
+ }
}
return 0;
}