[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>
diff --git a/sound/pci/maestro3.c b/sound/pci/maestro3.c
index 9badbb3..4c1af42 100644
--- a/sound/pci/maestro3.c
+++ b/sound/pci/maestro3.c
@@ -2240,7 +2240,7 @@
.size = sizeof assp_minisrc_image
};
-#endif /* CONFIG_SND_MAESTRO3_FIRMWARE_IN_KERNEL */
+#else /* CONFIG_SND_MAESTRO3_FIRMWARE_IN_KERNEL */
#ifdef __LITTLE_ENDIAN
static inline void snd_m3_convert_from_le(const struct firmware *fw) { }
@@ -2255,6 +2255,8 @@
}
#endif
+#endif /* CONFIG_SND_MAESTRO3_FIRMWARE_IN_KERNEL */
+
/*
* initialize ASSP
@@ -2548,14 +2550,10 @@
if (chip->iobase)
pci_release_regions(chip->pci);
-#ifdef CONFIG_SND_MAESTRO3_FIRMWARE_IN_KERNEL
- if (chip->assp_kernel_image != &assp_kernel)
+#ifndef CONFIG_SND_MAESTRO3_FIRMWARE_IN_KERNEL
+ release_firmware(chip->assp_kernel_image);
+ release_firmware(chip->assp_minisrc_image);
#endif
- release_firmware(chip->assp_kernel_image);
-#ifdef CONFIG_SND_MAESTRO3_FIRMWARE_IN_KERNEL
- if (chip->assp_minisrc_image != &assp_minisrc)
-#endif
- release_firmware(chip->assp_minisrc_image);
pci_disable_device(chip->pci);
kfree(chip);
@@ -2745,29 +2743,29 @@
return -ENOMEM;
}
+#ifdef CONFIG_SND_MAESTRO3_FIRMWARE_IN_KERNEL
+ chip->assp_kernel_image = &assp_kernel;
+#else
err = request_firmware(&chip->assp_kernel_image,
"ess/maestro3_assp_kernel.fw", &pci->dev);
if (err < 0) {
-#ifdef CONFIG_SND_MAESTRO3_FIRMWARE_IN_KERNEL
- chip->assp_kernel_image = &assp_kernel;
-#else
snd_m3_free(chip);
return err;
-#endif
} else
snd_m3_convert_from_le(chip->assp_kernel_image);
+#endif
+#ifdef CONFIG_SND_MAESTRO3_FIRMWARE_IN_KERNEL
+ chip->assp_minisrc_image = &assp_minisrc;
+#else
err = request_firmware(&chip->assp_minisrc_image,
"ess/maestro3_assp_minisrc.fw", &pci->dev);
if (err < 0) {
-#ifdef CONFIG_SND_MAESTRO3_FIRMWARE_IN_KERNEL
- chip->assp_minisrc_image = &assp_minisrc;
-#else
snd_m3_free(chip);
return err;
-#endif
} else
snd_m3_convert_from_le(chip->assp_minisrc_image);
+#endif
if ((err = pci_request_regions(pci, card->driver)) < 0) {
snd_m3_free(chip);