[ALSA] Don't use request_firmware if internal firmwares are defined
Don't use request_firmware() if the internal firmwares are defined via Kconfig. Otherwise it results in a significant delay at loading time (minutes). Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
This commit is contained in:
committed by
Jaroslav Kysela
parent
f223a9fc3d
commit
b7dd2b349a
@@ -2016,6 +2016,24 @@ static struct firmware snd_ymfpci_controller_1e_microcode = {
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SND_YMFPCI_FIRMWARE_IN_KERNEL
|
||||
static int snd_ymfpci_request_firmware(struct snd_ymfpci *chip)
|
||||
{
|
||||
chip->dsp_microcode = &snd_ymfpci_dsp_microcode;
|
||||
if (chip->device_id == PCI_DEVICE_ID_YAMAHA_724F ||
|
||||
chip->device_id == PCI_DEVICE_ID_YAMAHA_740C ||
|
||||
chip->device_id == PCI_DEVICE_ID_YAMAHA_744 ||
|
||||
chip->device_id == PCI_DEVICE_ID_YAMAHA_754)
|
||||
chip->controller_microcode =
|
||||
&snd_ymfpci_controller_1e_microcode;
|
||||
else
|
||||
chip->controller_microcode =
|
||||
&snd_ymfpci_controller_microcode;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else /* use fw_loader */
|
||||
|
||||
#ifdef __LITTLE_ENDIAN
|
||||
static inline void snd_ymfpci_convert_from_le(const struct firmware *fw) { }
|
||||
#else
|
||||
@@ -2044,13 +2062,8 @@ static int snd_ymfpci_request_firmware(struct snd_ymfpci *chip)
|
||||
err = -EINVAL;
|
||||
}
|
||||
}
|
||||
if (err < 0) {
|
||||
#ifdef CONFIG_SND_YMFPCI_FIRMWARE_IN_KERNEL
|
||||
chip->dsp_microcode = &snd_ymfpci_dsp_microcode;
|
||||
#else
|
||||
if (err < 0)
|
||||
return err;
|
||||
#endif
|
||||
}
|
||||
is_1e = chip->device_id == PCI_DEVICE_ID_YAMAHA_724F ||
|
||||
chip->device_id == PCI_DEVICE_ID_YAMAHA_740C ||
|
||||
chip->device_id == PCI_DEVICE_ID_YAMAHA_744 ||
|
||||
@@ -2067,17 +2080,11 @@ static int snd_ymfpci_request_firmware(struct snd_ymfpci *chip)
|
||||
err = -EINVAL;
|
||||
}
|
||||
}
|
||||
if (err < 0) {
|
||||
#ifdef CONFIG_SND_YMFPCI_FIRMWARE_IN_KERNEL
|
||||
chip->controller_microcode =
|
||||
is_1e ? &snd_ymfpci_controller_1e_microcode
|
||||
: &snd_ymfpci_controller_microcode;
|
||||
#else
|
||||
if (err < 0)
|
||||
return err;
|
||||
#endif
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void snd_ymfpci_download_image(struct snd_ymfpci *chip)
|
||||
{
|
||||
@@ -2257,15 +2264,10 @@ static int snd_ymfpci_free(struct snd_ymfpci *chip)
|
||||
pci_write_config_word(chip->pci, 0x40, chip->old_legacy_ctrl);
|
||||
|
||||
pci_disable_device(chip->pci);
|
||||
#ifdef CONFIG_SND_YMFPCI_FIRMWARE_IN_KERNEL
|
||||
if (chip->dsp_microcode != &snd_ymfpci_dsp_microcode)
|
||||
#ifndef CONFIG_SND_YMFPCI_FIRMWARE_IN_KERNEL
|
||||
release_firmware(chip->dsp_microcode);
|
||||
release_firmware(chip->controller_microcode);
|
||||
#endif
|
||||
release_firmware(chip->dsp_microcode);
|
||||
#ifdef CONFIG_SND_YMFPCI_FIRMWARE_IN_KERNEL
|
||||
if (chip->controller_microcode != &snd_ymfpci_controller_microcode &&
|
||||
chip->controller_microcode != &snd_ymfpci_controller_1e_microcode)
|
||||
#endif
|
||||
release_firmware(chip->controller_microcode);
|
||||
kfree(chip);
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user