Skip to content

Commit

Permalink
ALSA: oxygen: use match_string() helper
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Yisheng Xie authored and tiwai committed May 31, 2018
1 parent 0d5bcfc commit 9ee92f5
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions sound/pci/oxygen/oxygen_mixer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 9ee92f5

Please sign in to comment.