From 16dab54b8cbac39bd3f639db5d7d0fd8300a6cb0 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 5 Sep 2005 17:17:58 +0200 Subject: [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 --- sound/drivers/Kconfig | 5 +++++ sound/drivers/dummy.c | 4 ++++ sound/drivers/mpu401/mpu401.c | 26 ++++++++++++++++---------- sound/drivers/mtpav.c | 3 +++ sound/drivers/serial-u16550.c | 26 ++++++++++++++------------ sound/drivers/virmidi.c | 4 ++++ 6 files changed, 46 insertions(+), 22 deletions(-) (limited to 'sound/drivers') diff --git a/sound/drivers/Kconfig b/sound/drivers/Kconfig index 3b2bee19e2c0..efcb4eb2d1a0 100644 --- a/sound/drivers/Kconfig +++ b/sound/drivers/Kconfig @@ -29,6 +29,7 @@ config SND_DUMMY tristate "Dummy (/dev/null) soundcard" depends on SND select SND_PCM + select SND_GENERIC_DRIVER help Say Y here to include the dummy driver. This driver does nothing, but emulates various mixer controls and PCM devices. @@ -44,6 +45,7 @@ config SND_VIRMIDI depends on SND_SEQUENCER select SND_TIMER select SND_RAWMIDI + select SND_GENERIC_DRIVER help Say Y here to include the virtual MIDI driver. This driver allows to connect applications using raw MIDI devices to @@ -59,6 +61,7 @@ config SND_MTPAV depends on SND select SND_TIMER select SND_RAWMIDI + select SND_GENERIC_DRIVER help To use a MOTU MidiTimePiece AV multiport MIDI adapter connected to the parallel port, say Y here and make sure that @@ -72,6 +75,7 @@ config SND_SERIAL_U16550 depends on SND select SND_TIMER select SND_RAWMIDI + select SND_GENERIC_DRIVER help To include support for MIDI serial port interfaces, say Y here and read . @@ -88,6 +92,7 @@ config SND_MPU401 tristate "Generic MPU-401 UART driver" depends on SND select SND_MPU401_UART + select SND_GENERIC_DRIVER help Say Y here to include support for MIDI ports compatible with the Roland MPU-401 interface in UART mode. diff --git a/sound/drivers/dummy.c b/sound/drivers/dummy.c index a61640cf7ae7..977d98d26a81 100644 --- a/sound/drivers/dummy.c +++ b/sound/drivers/dummy.c @@ -600,6 +600,10 @@ static int __init snd_card_dummy_probe(int dev) strcpy(card->driver, "Dummy"); strcpy(card->shortname, "Dummy"); 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) { snd_dummy_cards[dev] = card; return 0; diff --git a/sound/drivers/mpu401/mpu401.c b/sound/drivers/mpu401/mpu401.c index cb36ecb78697..54e2ff9b5ca1 100644 --- a/sound/drivers/mpu401/mpu401.c +++ b/sound/drivers/mpu401/mpu401.c @@ -77,20 +77,26 @@ static int snd_mpu401_create(int dev, snd_card_t **rcard) 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]); - 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; return 0; + + _err: + snd_card_free(card); + return err; } static int __devinit snd_mpu401_probe(int dev) diff --git a/sound/drivers/mtpav.c b/sound/drivers/mtpav.c index 1280a57c49eb..b8199d20be82 100644 --- a/sound/drivers/mtpav.c +++ b/sound/drivers/mtpav.c @@ -757,6 +757,9 @@ static int __init alsa_card_mtpav_init(void) if (err < 0) 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! //printk("snd_card_register returned %d\n", err); diff --git a/sound/drivers/serial-u16550.c b/sound/drivers/serial-u16550.c index 986df35fb829..fd3bb9dd1d24 100644 --- a/sound/drivers/serial-u16550.c +++ b/sound/drivers/serial-u16550.c @@ -928,15 +928,11 @@ static int __init snd_serial_probe(int dev) base[dev], adaptor[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", card->shortname, @@ -949,12 +945,18 @@ static int __init snd_serial_probe(int dev) adaptor_names[uart->adaptor], 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; return 0; + + _err: + snd_card_free(card); + return err; } static int __init alsa_card_serial_init(void) diff --git a/sound/drivers/virmidi.c b/sound/drivers/virmidi.c index 5937711e9505..af12185ab8a2 100644 --- a/sound/drivers/virmidi.c +++ b/sound/drivers/virmidi.c @@ -116,6 +116,10 @@ static int __init snd_card_virmidi_probe(int dev) strcpy(card->driver, "VirMIDI"); strcpy(card->shortname, "VirMIDI"); 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) { snd_virmidi_cards[dev] = card; return 0; -- cgit v1.2.2