Commit 3b0f7eef authored by Takashi Iwai's avatar Takashi Iwai

ALSA: ice1724: Remove superfluous loop over model table

The ice1724 driver looks for the matching card_info entry twice, once
at reading EEPROM and another for the rest tasks in the probe call.
Reduce the second one by referring to the already assigned card_info
entry.

Link: https://lore.kernel.org/r/20210712091904.28022-1-tiwai@suse.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 2d52c5dd
...@@ -2150,13 +2150,6 @@ static const struct snd_kcontrol_new snd_vt1724_mixer_pro_peak = { ...@@ -2150,13 +2150,6 @@ static const struct snd_kcontrol_new snd_vt1724_mixer_pro_peak = {
.get = snd_vt1724_pro_peak_get .get = snd_vt1724_pro_peak_get
}; };
/*
*
*/
static const struct snd_ice1712_card_info no_matched;
/* /*
ooAoo cards with no controls ooAoo cards with no controls
*/ */
...@@ -2574,7 +2567,7 @@ static int snd_vt1724_probe(struct pci_dev *pci, ...@@ -2574,7 +2567,7 @@ static int snd_vt1724_probe(struct pci_dev *pci,
struct snd_card *card; struct snd_card *card;
struct snd_ice1712 *ice; struct snd_ice1712 *ice;
int pcm_dev = 0, err; int pcm_dev = 0, err;
const struct snd_ice1712_card_info * const *tbl, *c; const struct snd_ice1712_card_info *c;
if (dev >= SNDRV_CARDS) if (dev >= SNDRV_CARDS)
return -ENODEV; return -ENODEV;
...@@ -2600,27 +2593,20 @@ static int snd_vt1724_probe(struct pci_dev *pci, ...@@ -2600,27 +2593,20 @@ static int snd_vt1724_probe(struct pci_dev *pci,
/* field init before calling chip_init */ /* field init before calling chip_init */
ice->ext_clock_count = 0; ice->ext_clock_count = 0;
for (tbl = card_tables; *tbl; tbl++) { c = ice->card_info;
for (c = *tbl; c->name; c++) { if (c) {
if ((model[dev] && c->model && strcpy(card->shortname, c->name);
!strcmp(model[dev], c->model)) || if (c->driver) /* specific driver? */
(c->subvendor == ice->eeprom.subvendor)) { strcpy(card->driver, c->driver);
strcpy(card->shortname, c->name); if (c->chip_init) {
if (c->driver) /* specific driver? */ err = c->chip_init(ice);
strcpy(card->driver, c->driver); if (err < 0) {
if (c->chip_init) { snd_card_free(card);
err = c->chip_init(ice); return err;
if (err < 0) {
snd_card_free(card);
return err;
}
}
goto __found;
} }
} }
} }
c = &no_matched;
__found:
/* /*
* VT1724 has separate DMAs for the analog and the SPDIF streams while * VT1724 has separate DMAs for the analog and the SPDIF streams while
* ICE1712 has only one for both (mixed up). * ICE1712 has only one for both (mixed up).
...@@ -2688,7 +2674,7 @@ static int snd_vt1724_probe(struct pci_dev *pci, ...@@ -2688,7 +2674,7 @@ static int snd_vt1724_probe(struct pci_dev *pci,
} }
} }
if (c->build_controls) { if (c && c->build_controls) {
err = c->build_controls(ice); err = c->build_controls(ice);
if (err < 0) { if (err < 0) {
snd_card_free(card); snd_card_free(card);
...@@ -2696,7 +2682,7 @@ static int snd_vt1724_probe(struct pci_dev *pci, ...@@ -2696,7 +2682,7 @@ static int snd_vt1724_probe(struct pci_dev *pci,
} }
} }
if (!c->no_mpu401) { if (!c || !c->no_mpu401) {
if (ice->eeprom.data[ICE_EEP2_SYSCONF] & VT1724_CFG_MPU401) { if (ice->eeprom.data[ICE_EEP2_SYSCONF] & VT1724_CFG_MPU401) {
struct snd_rawmidi *rmidi; struct snd_rawmidi *rmidi;
......
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