summary refs log tree commit diff
path: root/sound/isa
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2007-04-26 14:13:44 +0200
committerJaroslav Kysela <perex@suse.cz>2007-05-11 16:56:11 +0200
commitb7dd2b349a9fa9e4347780c2bbb41e51484b5bb5 (patch)
treef5b896fd062a410e46bc35963fe15cdaed38f654 /sound/isa
parentf223a9fc3d5707c354588570e2cf1f3abf6b1f84 (diff)
downloadlinux-b7dd2b349a9fa9e4347780c2bbb41e51484b5bb5.tar.gz
[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>
Diffstat (limited to 'sound/isa')
-rw-r--r--sound/isa/sb/sb16_csp.c17
-rw-r--r--sound/isa/wavefront/wavefront_fx.c15
2 files changed, 16 insertions, 16 deletions
diff --git a/sound/isa/sb/sb16_csp.c b/sound/isa/sb/sb16_csp.c
index ef71e50744e9..92e2bc413178 100644
--- a/sound/isa/sb/sb16_csp.c
+++ b/sound/isa/sb/sb16_csp.c
@@ -161,13 +161,17 @@ int snd_sb_csp_new(struct snd_sb *chip, int device, struct snd_hwdep ** rhwdep)
  */
 static void snd_sb_csp_free(struct snd_hwdep *hwdep)
 {
+#ifndef CONFIG_SND_SB16_CSP_FIRMWARE_IN_KERNEL
 	int i;
+#endif
 	struct snd_sb_csp *p = hwdep->private_data;
 	if (p) {
 		if (p->running & SNDRV_SB_CSP_ST_RUNNING)
 			snd_sb_csp_stop(p);
+#ifndef CONFIG_SND_SB16_CSP_FIRMWARE_IN_KERNEL
 		for (i = 0; i < ARRAY_SIZE(p->csp_programs); ++i)
 			release_firmware(p->csp_programs[i]);
+#endif
 		kfree(p);
 	}
 }
@@ -712,22 +716,19 @@ static int snd_sb_csp_firmware_load(struct snd_sb_csp *p, int index, int flags)
 		"sb16/ima_adpcm_capture.csp",
 	};
 	const struct firmware *program;
-	int err;
 
 	BUILD_BUG_ON(ARRAY_SIZE(names) != CSP_PROGRAM_COUNT);
 	program = p->csp_programs[index];
 	if (!program) {
-		err = request_firmware(&program, names[index],
-				       p->chip->card->dev);
-		if (err >= 0)
-			p->csp_programs[index] = program;
-		else {
 #ifdef CONFIG_SND_SB16_CSP_FIRMWARE_IN_KERNEL
-			program = &snd_sb_csp_static_programs[index];
+		program = &snd_sb_csp_static_programs[index];
 #else
+		int err = request_firmware(&program, names[index],
+				       p->chip->card->dev);
+		if (err < 0)
 			return err;
 #endif
-		}
+		p->csp_programs[index] = program;
 	}
 	return snd_sb_csp_load(p, program->data, program->size, flags);
 }
diff --git a/sound/isa/wavefront/wavefront_fx.c b/sound/isa/wavefront/wavefront_fx.c
index 3a8c0565d676..0e948a9a7205 100644
--- a/sound/isa/wavefront/wavefront_fx.c
+++ b/sound/isa/wavefront/wavefront_fx.c
@@ -256,21 +256,21 @@ snd_wavefront_fx_start (snd_wavefront_t *dev)
 {
 	unsigned int i;
 	int err;
-	const struct firmware *firmware;
+	const struct firmware *firmware = NULL;
 
 	if (dev->fx_initialized)
 		return 0;
 
+#ifdef CONFIG_SND_WAVEFRONT_FIRMWARE_IN_KERNEL
+	firmware = &yss225_registers_firmware;
+#else
 	err = request_firmware(&firmware, "yamaha/yss225_registers.bin",
 			       dev->card->dev);
 	if (err < 0) {
-#ifdef CONFIG_SND_WAVEFRONT_FIRMWARE_IN_KERNEL
-		firmware = &yss225_registers_firmware;
-#else
 		err = -1;
 		goto out;
-#endif
 	}
+#endif
 
 	for (i = 0; i + 1 < firmware->size; i += 2) {
 		if (firmware->data[i] >= 8 && firmware->data[i] < 16) {
@@ -293,9 +293,8 @@ snd_wavefront_fx_start (snd_wavefront_t *dev)
 	err = 0;
 
 out:
-#ifdef CONFIG_SND_WAVEFRONT_FIRMWARE_IN_KERNEL
-	if (firmware != &yss225_registers_firmware)
+#ifndef CONFIG_SND_WAVEFRONT_FIRMWARE_IN_KERNEL
+	release_firmware(firmware);
 #endif
-		release_firmware(firmware);
 	return err;
 }