From ff66a057b8b67749b41fc0ce0298c367952a27fc Mon Sep 17 00:00:00 2001 From: Ricardo Cerqueira Date: Tue, 20 Dec 2005 17:10:17 +0000 Subject: Fix saa7134 ALSA/OSS collisions From: Ricardo Cerqueira When ALSA or OSS are loaded, check if the other is present Fixed hotplug notifiers cleanup on module removal Signed-off-by: --- linux/drivers/media/video/saa7134/saa7134-alsa.c | 15 +++++++++++---- linux/drivers/media/video/saa7134/saa7134-oss.c | 17 +++++++++++++---- 2 files changed, 24 insertions(+), 8 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/video/saa7134/saa7134-alsa.c b/linux/drivers/media/video/saa7134/saa7134-alsa.c index 83f0bc4e2..d05c519d4 100644 --- a/linux/drivers/media/video/saa7134/saa7134-alsa.c +++ b/linux/drivers/media/video/saa7134/saa7134-alsa.c @@ -1,7 +1,7 @@ /* * SAA713x ALSA support for V4L * - * $Id: saa7134-alsa.c,v 1.31 2005/12/18 00:44:19 mchehab Exp $ + * $Id: saa7134-alsa.c,v 1.32 2005/12/20 17:10:17 rmcc Exp $ * * Caveats: * - Volume doesn't work (it's always at max) @@ -1000,6 +1000,14 @@ static int saa7134_alsa_init(void) struct saa7134_dev *dev = NULL; struct list_head *list; + if (!dmasound_init && !dmasound_exit) { + dmasound_init = alsa_device_init; + dmasound_exit = alsa_device_exit; + } else { + printk(KERN_WARNING "saa7134 ALSA: can't load, DMA sound handler already assigned (probably to OSS)\n"); + return -EBUSY; + } + printk(KERN_INFO "saa7134 ALSA driver for DMA sound loaded\n"); list_for_each(list,&saa7134_devlist) { @@ -1012,9 +1020,6 @@ static int saa7134_alsa_init(void) } } - dmasound_init = alsa_device_init; - dmasound_exit = alsa_device_exit; - if (dev == NULL) printk(KERN_INFO "saa7134 ALSA: no saa7134 cards found\n"); @@ -1034,6 +1039,8 @@ static void saa7134_alsa_exit(void) snd_card_free(snd_saa7134_cards[idx]); } + dmasound_init = NULL; + dmasound_exit = NULL; printk(KERN_INFO "saa7134 ALSA driver for DMA sound unloaded\n"); return; diff --git a/linux/drivers/media/video/saa7134/saa7134-oss.c b/linux/drivers/media/video/saa7134/saa7134-oss.c index a2df1dff7..25d9032db 100644 --- a/linux/drivers/media/video/saa7134/saa7134-oss.c +++ b/linux/drivers/media/video/saa7134/saa7134-oss.c @@ -1,5 +1,5 @@ /* - * $Id: saa7134-oss.c,v 1.31 2005/12/10 01:43:26 mchehab Exp $ + * $Id: saa7134-oss.c,v 1.32 2005/12/20 17:10:17 rmcc Exp $ * * device driver for philips saa7134 based TV cards * oss dsp interface @@ -982,8 +982,17 @@ static int saa7134_oss_init(void) struct saa7134_dev *dev = NULL; struct list_head *list; + if (!dmasound_init && !dmasound_exit) { + dmasound_init = oss_device_init; + dmasound_exit = oss_device_exit; + } else { + printk(KERN_WARNING "saa7134 OSS: can't load, DMA sound handler already assigned (probably to ALSA)\n"); + return -EBUSY; + } + printk(KERN_INFO "saa7134 OSS driver for DMA sound loaded\n"); + list_for_each(list,&saa7134_devlist) { dev = list_entry(list, struct saa7134_dev, devlist); if (dev->dmasound.priv_data == NULL) { @@ -997,9 +1006,6 @@ static int saa7134_oss_init(void) if (dev == NULL) printk(KERN_INFO "saa7134 OSS: no saa7134 cards found\n"); - dmasound_init = oss_device_init; - dmasound_exit = oss_device_exit; - return 0; } @@ -1020,6 +1026,9 @@ static void saa7134_oss_exit(void) } + dmasound_init = NULL; + dmasound_exit = NULL; + printk(KERN_INFO "saa7134 OSS driver for DMA sound unloaded\n"); return; -- cgit v1.2.3