Browse Source

[ALSA] Add snd_card_set_generic_dev() call

ARM,SA11xx UDA1341 driver,Generic drivers,MPU401 UART,MIPS
MIPS AU1x00 driver,PPC,PPC PowerMac driver,SPARC,SPARC AMD7930 driver
SPARC cs4231 driver,SPARC DBRI driver
- Added snd_card_set_generic_dev() call.
- Added SND_GENERIC_DRIVER to Kconfig.
- Clean up the error path in probe if necessary.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai 19 years ago
parent
commit
16dab54b8c

+ 1 - 0
sound/arm/Kconfig

@@ -7,6 +7,7 @@ config SND_SA11XX_UDA1341
 	tristate "SA11xx UDA1341TS driver (iPaq H3600)"
 	tristate "SA11xx UDA1341TS driver (iPaq H3600)"
 	depends on ARCH_SA1100 && SND && L3
 	depends on ARCH_SA1100 && SND && L3
 	select SND_PCM
 	select SND_PCM
+	select SND_GENERIC_DRIVER
 	help
 	help
 	  Say Y here if you have a Compaq iPaq H3x00 handheld computer
 	  Say Y here if you have a Compaq iPaq H3x00 handheld computer
 	  and want to use its Philips UDA 1341 audio chip.
 	  and want to use its Philips UDA 1341 audio chip.

+ 4 - 1
sound/arm/sa11xx-uda1341.c

@@ -21,7 +21,7 @@
  *                              merged HAL layer (patches from Brian)
  *                              merged HAL layer (patches from Brian)
  */
  */
 
 
-/* $Id: sa11xx-uda1341.c,v 1.21 2005/01/28 19:34:04 tiwai Exp $ */
+/* $Id: sa11xx-uda1341.c,v 1.22 2005/09/05 16:17:58 tiwai Exp $ */
 
 
 /***************************************************************************************************
 /***************************************************************************************************
 *
 *
@@ -946,6 +946,9 @@ static int __init sa11xx_uda1341_init(void)
 	strcpy(card->shortname, "H3600 UDA1341TS");
 	strcpy(card->shortname, "H3600 UDA1341TS");
 	sprintf(card->longname, "Compaq iPAQ H3600 with Philips UDA1341TS");
 	sprintf(card->longname, "Compaq iPAQ H3600 with Philips UDA1341TS");
         
         
+	if ((err = snd_card_set_generic_dev(card)) < 0)
+		goto nodev;
+
 	if ((err = snd_card_register(card)) == 0) {
 	if ((err = snd_card_register(card)) == 0) {
 		printk( KERN_INFO "iPAQ audio support initialized\n" );
 		printk( KERN_INFO "iPAQ audio support initialized\n" );
 		return 0;
 		return 0;

+ 5 - 0
sound/drivers/Kconfig

@@ -29,6 +29,7 @@ config SND_DUMMY
 	tristate "Dummy (/dev/null) soundcard"
 	tristate "Dummy (/dev/null) soundcard"
 	depends on SND
 	depends on SND
 	select SND_PCM
 	select SND_PCM
+	select SND_GENERIC_DRIVER
 	help
 	help
 	  Say Y here to include the dummy driver.  This driver does
 	  Say Y here to include the dummy driver.  This driver does
 	  nothing, but emulates various mixer controls and PCM devices.
 	  nothing, but emulates various mixer controls and PCM devices.
@@ -44,6 +45,7 @@ config SND_VIRMIDI
 	depends on SND_SEQUENCER
 	depends on SND_SEQUENCER
 	select SND_TIMER
 	select SND_TIMER
 	select SND_RAWMIDI
 	select SND_RAWMIDI
+	select SND_GENERIC_DRIVER
 	help
 	help
 	  Say Y here to include the virtual MIDI driver.  This driver
 	  Say Y here to include the virtual MIDI driver.  This driver
 	  allows to connect applications using raw MIDI devices to
 	  allows to connect applications using raw MIDI devices to
@@ -59,6 +61,7 @@ config SND_MTPAV
 	depends on SND
 	depends on SND
 	select SND_TIMER
 	select SND_TIMER
 	select SND_RAWMIDI
 	select SND_RAWMIDI
+	select SND_GENERIC_DRIVER
 	help
 	help
 	  To use a MOTU MidiTimePiece AV multiport MIDI adapter
 	  To use a MOTU MidiTimePiece AV multiport MIDI adapter
 	  connected to the parallel port, say Y here and make sure that
 	  connected to the parallel port, say Y here and make sure that
@@ -72,6 +75,7 @@ config SND_SERIAL_U16550
 	depends on SND
 	depends on SND
 	select SND_TIMER
 	select SND_TIMER
 	select SND_RAWMIDI
 	select SND_RAWMIDI
+	select SND_GENERIC_DRIVER
 	help
 	help
 	  To include support for MIDI serial port interfaces, say Y here
 	  To include support for MIDI serial port interfaces, say Y here
 	  and read <file:Documentation/sound/alsa/serial-u16550.txt>.
 	  and read <file:Documentation/sound/alsa/serial-u16550.txt>.
@@ -88,6 +92,7 @@ config SND_MPU401
 	tristate "Generic MPU-401 UART driver"
 	tristate "Generic MPU-401 UART driver"
 	depends on SND
 	depends on SND
 	select SND_MPU401_UART
 	select SND_MPU401_UART
+	select SND_GENERIC_DRIVER
 	help
 	help
 	  Say Y here to include support for MIDI ports compatible with
 	  Say Y here to include support for MIDI ports compatible with
 	  the Roland MPU-401 interface in UART mode.
 	  the Roland MPU-401 interface in UART mode.

+ 4 - 0
sound/drivers/dummy.c

@@ -600,6 +600,10 @@ static int __init snd_card_dummy_probe(int dev)
 	strcpy(card->driver, "Dummy");
 	strcpy(card->driver, "Dummy");
 	strcpy(card->shortname, "Dummy");
 	strcpy(card->shortname, "Dummy");
 	sprintf(card->longname, "Dummy %i", dev + 1);
 	sprintf(card->longname, "Dummy %i", dev + 1);
+
+	if ((err = snd_card_set_generic_dev(card)) < 0)
+		goto __nodev;
+
 	if ((err = snd_card_register(card)) == 0) {
 	if ((err = snd_card_register(card)) == 0) {
 		snd_dummy_cards[dev] = card;
 		snd_dummy_cards[dev] = card;
 		return 0;
 		return 0;

+ 16 - 10
sound/drivers/mpu401/mpu401.c

@@ -77,20 +77,26 @@ static int snd_mpu401_create(int dev, snd_card_t **rcard)
 		strcat(card->longname, "polled");
 		strcat(card->longname, "polled");
 	}
 	}
 
 
-	if (snd_mpu401_uart_new(card, 0,
-				MPU401_HW_MPU401,
-				port[dev], 0,
-				irq[dev], irq[dev] >= 0 ? SA_INTERRUPT : 0, NULL) < 0) {
+	if ((err = snd_mpu401_uart_new(card, 0,
+				       MPU401_HW_MPU401,
+				       port[dev], 0,
+				       irq[dev], irq[dev] >= 0 ? SA_INTERRUPT : 0, NULL)) < 0) {
 		printk(KERN_ERR "MPU401 not detected at 0x%lx\n", port[dev]);
 		printk(KERN_ERR "MPU401 not detected at 0x%lx\n", port[dev]);
-		snd_card_free(card);
-		return -ENODEV;
-	}
-	if ((err = snd_card_register(card)) < 0) {
-		snd_card_free(card);
-		return err;
+		goto _err;
 	}
 	}
+
+	if ((err = snd_card_set_generic_dev(card)) < 0)
+		goto _err;
+
+	if ((err = snd_card_register(card)) < 0)
+		goto _err;
+
 	*rcard = card;
 	*rcard = card;
 	return 0;
 	return 0;
+
+ _err:
+	snd_card_free(card);
+	return err;
 }
 }
 
 
 static int __devinit snd_mpu401_probe(int dev)
 static int __devinit snd_mpu401_probe(int dev)

+ 3 - 0
sound/drivers/mtpav.c

@@ -757,6 +757,9 @@ static int __init alsa_card_mtpav_init(void)
 	if (err < 0)
 	if (err < 0)
 		goto __error;
 		goto __error;
 
 
+	if ((err = snd_card_set_generic_dev(mtp_card->card)) < 0)
+		goto __error;
+
 	err = snd_card_register(mtp_card->card);	// don't snd_card_register until AFTER all cards reources done!
 	err = snd_card_register(mtp_card->card);	// don't snd_card_register until AFTER all cards reources done!
 
 
 	//printk("snd_card_register returned %d\n", err);
 	//printk("snd_card_register returned %d\n", err);

+ 14 - 12
sound/drivers/serial-u16550.c

@@ -928,15 +928,11 @@ static int __init snd_serial_probe(int dev)
 					base[dev],
 					base[dev],
 					adaptor[dev],
 					adaptor[dev],
 					droponfull[dev],
 					droponfull[dev],
-					&uart)) < 0) {
-		snd_card_free(card);
-		return err;
-	}
+					&uart)) < 0)
+		goto _err;
 
 
-	if ((err = snd_uart16550_rmidi(uart, 0, outs[dev], ins[dev], &uart->rmidi)) < 0) {
-		snd_card_free(card);
-		return err;
-	}
+	if ((err = snd_uart16550_rmidi(uart, 0, outs[dev], ins[dev], &uart->rmidi)) < 0)
+		goto _err;
 
 
 	sprintf(card->longname, "%s at 0x%lx, irq %d speed %d div %d outs %d ins %d adaptor %s droponfull %d",
 	sprintf(card->longname, "%s at 0x%lx, irq %d speed %d div %d outs %d ins %d adaptor %s droponfull %d",
 		card->shortname,
 		card->shortname,
@@ -949,12 +945,18 @@ static int __init snd_serial_probe(int dev)
 		adaptor_names[uart->adaptor],
 		adaptor_names[uart->adaptor],
 		uart->drop_on_full);
 		uart->drop_on_full);
 
 
-	if ((err = snd_card_register(card)) < 0) {
-		snd_card_free(card);
-		return err;
-	}
+	if ((err = snd_card_set_generic_dev(card)) < 0)
+		goto _err;
+
+	if ((err = snd_card_register(card)) < 0)
+		goto _err;
+
 	snd_serial_cards[dev] = card;
 	snd_serial_cards[dev] = card;
 	return 0;
 	return 0;
+
+ _err:
+	snd_card_free(card);
+	return err;
 }
 }
 
 
 static int __init alsa_card_serial_init(void)
 static int __init alsa_card_serial_init(void)

+ 4 - 0
sound/drivers/virmidi.c

@@ -116,6 +116,10 @@ static int __init snd_card_virmidi_probe(int dev)
 	strcpy(card->driver, "VirMIDI");
 	strcpy(card->driver, "VirMIDI");
 	strcpy(card->shortname, "VirMIDI");
 	strcpy(card->shortname, "VirMIDI");
 	sprintf(card->longname, "Virtual MIDI Card %i", dev + 1);
 	sprintf(card->longname, "Virtual MIDI Card %i", dev + 1);
+
+	if ((err = snd_card_set_generic_dev(card)) < 0)
+		goto __nodev;
+
 	if ((err = snd_card_register(card)) == 0) {
 	if ((err = snd_card_register(card)) == 0) {
 		snd_virmidi_cards[dev] = card;
 		snd_virmidi_cards[dev] = card;
 		return 0;
 		return 0;

+ 1 - 0
sound/mips/Kconfig

@@ -8,6 +8,7 @@ config SND_AU1X00
 	depends on (SOC_AU1000 || SOC_AU1100 || SOC_AU1500) && SND
 	depends on (SOC_AU1000 || SOC_AU1100 || SOC_AU1500) && SND
 	select SND_PCM
 	select SND_PCM
 	select SND_AC97_CODEC
 	select SND_AC97_CODEC
+	select SND_GENERIC_DRIVER
 	help
 	help
 	  ALSA Sound driver for the Au1x00's AC97 port.
 	  ALSA Sound driver for the Au1x00's AC97 port.
 
 

+ 5 - 0
sound/mips/au1x00.c

@@ -667,6 +667,11 @@ au1000_init(void)
 	strcpy(au1000->card->shortname, "Au1000-AC97");
 	strcpy(au1000->card->shortname, "Au1000-AC97");
 	sprintf(au1000->card->longname, "AMD Au1000--AC97 ALSA Driver");
 	sprintf(au1000->card->longname, "AMD Au1000--AC97 ALSA Driver");
 
 
+	if ((err = snd_card_set_generic_dev(au1000->card)) < 0) {
+		snd_card_free(au1000->card);
+		return err;
+	}
+
 	if ((err = snd_card_register(au1000->card)) < 0) {
 	if ((err = snd_card_register(au1000->card)) < 0) {
 		snd_card_free(au1000->card);
 		snd_card_free(au1000->card);
 		return err;
 		return err;

+ 1 - 0
sound/ppc/Kconfig

@@ -13,6 +13,7 @@ config SND_POWERMAC
 	tristate "PowerMac (AWACS, DACA, Burgundy, Tumbler, Keywest)"
 	tristate "PowerMac (AWACS, DACA, Burgundy, Tumbler, Keywest)"
 	depends on SND && I2C && INPUT && PPC_PMAC
 	depends on SND && I2C && INPUT && PPC_PMAC
 	select SND_PCM
 	select SND_PCM
+	select SND_GENERIC_DRIVER
 	help
 	help
 	  Say Y here to include support for the integrated sound device.
 	  Say Y here to include support for the integrated sound device.
 
 

+ 3 - 0
sound/ppc/powermac.c

@@ -131,6 +131,9 @@ static int __init snd_pmac_probe(void)
 	if (enable_beep)
 	if (enable_beep)
 		snd_pmac_attach_beep(chip);
 		snd_pmac_attach_beep(chip);
 
 
+	if ((err = snd_card_set_generic_dev(card)) < 0)
+		goto __error;
+
 	if ((err = snd_card_register(card)) < 0)
 	if ((err = snd_card_register(card)) < 0)
 		goto __error;
 		goto __error;
 
 

+ 3 - 0
sound/sparc/Kconfig

@@ -7,6 +7,7 @@ config SND_SUN_AMD7930
 	tristate "Sun AMD7930"
 	tristate "Sun AMD7930"
 	depends on SBUS && SND
 	depends on SBUS && SND
 	select SND_PCM
 	select SND_PCM
+	select SND_GENERIC_DRIVER
 	help
 	help
 	  Say Y here to include support for AMD7930 sound device on Sun.
 	  Say Y here to include support for AMD7930 sound device on Sun.
 
 
@@ -17,6 +18,7 @@ config SND_SUN_CS4231
 	tristate "Sun CS4231"
 	tristate "Sun CS4231"
 	depends on SND
 	depends on SND
 	select SND_PCM
 	select SND_PCM
+	select SND_GENERIC_DRIVER
 	help
 	help
 	  Say Y here to include support for CS4231 sound device on Sun.
 	  Say Y here to include support for CS4231 sound device on Sun.
 
 
@@ -27,6 +29,7 @@ config SND_SUN_DBRI
 	tristate "Sun DBRI"
 	tristate "Sun DBRI"
 	depends on SND && SBUS
 	depends on SND && SBUS
 	select SND_PCM
 	select SND_PCM
+	select SND_GENERIC_DRIVER
 	help
 	help
 	  Say Y here to include support for DBRI sound device on Sun.
 	  Say Y here to include support for DBRI sound device on Sun.
 
 

+ 3 - 0
sound/sparc/amd7930.c

@@ -1088,6 +1088,9 @@ static int __init amd7930_attach(int prom_node, struct sbus_dev *sdev)
 	if ((err = snd_amd7930_mixer(amd)) < 0)
 	if ((err = snd_amd7930_mixer(amd)) < 0)
 		goto out_err;
 		goto out_err;
 
 
+	if ((err = snd_card_set_generic_dev(card)) < 0)
+		goto out_err;
+
 	if ((err = snd_card_register(card)) < 0)
 	if ((err = snd_card_register(card)) < 0)
 		goto out_err;
 		goto out_err;
 
 

+ 3 - 0
sound/sparc/cs4231.c

@@ -1915,6 +1915,9 @@ static int cs4231_attach_finish(snd_card_t *card, cs4231_t *chip)
 	if ((err = snd_cs4231_timer(chip)) < 0)
 	if ((err = snd_cs4231_timer(chip)) < 0)
 		goto out_err;
 		goto out_err;
 
 
+	if ((err = snd_card_set_generic_dev(card)) < 0)
+		goto out_err;
+
 	if ((err = snd_card_register(card)) < 0)
 	if ((err = snd_card_register(card)) < 0)
 		goto out_err;
 		goto out_err;
 
 

+ 14 - 15
sound/sparc/dbri.c

@@ -2657,26 +2657,20 @@ static int __init dbri_attach(int prom_node, struct sbus_dev *sdev)
 	}
 	}
 
 
 	dbri = (snd_dbri_t *) card->private_data;
 	dbri = (snd_dbri_t *) card->private_data;
-	if ((err = snd_dbri_pcm(dbri)) < 0) {
-		snd_dbri_free(dbri);
-		snd_card_free(card);
-		return err;
-	}
+	if ((err = snd_dbri_pcm(dbri)) < 0)
+		goto _err;
 
 
-	if ((err = snd_dbri_mixer(dbri)) < 0) {
-		snd_dbri_free(dbri);
-		snd_card_free(card);
-		return err;
-	}
+	if ((err = snd_dbri_mixer(dbri)) < 0)
+		goto _err;
 
 
 	/* /proc file handling */
 	/* /proc file handling */
 	snd_dbri_proc(dbri);
 	snd_dbri_proc(dbri);
 
 
-	if ((err = snd_card_register(card)) < 0) {
-		snd_dbri_free(dbri);
-		snd_card_free(card);
-		return err;
-	}
+	if ((err = snd_card_set_generic_dev(card)) < 0)
+		goto _err;
+
+	if ((err = snd_card_register(card)) < 0)
+		goto _err;
 
 
 	printk(KERN_INFO "audio%d at %p (irq %d) is DBRI(%c)+CS4215(%d)\n",
 	printk(KERN_INFO "audio%d at %p (irq %d) is DBRI(%c)+CS4215(%d)\n",
 	       dev, dbri->regs,
 	       dev, dbri->regs,
@@ -2684,6 +2678,11 @@ static int __init dbri_attach(int prom_node, struct sbus_dev *sdev)
 	dev++;
 	dev++;
 
 
 	return 0;
 	return 0;
+
+ _err:
+	snd_dbri_free(dbri);
+	snd_card_free(card);
+	return err;
 }
 }
 
 
 /* Probe for the dbri chip and then attach the driver. */
 /* Probe for the dbri chip and then attach the driver. */