aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/saa7134/saa7134-oss.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/saa7134/saa7134-oss.c')
-rw-r--r--drivers/media/video/saa7134/saa7134-oss.c77
1 files changed, 46 insertions, 31 deletions
diff --git a/drivers/media/video/saa7134/saa7134-oss.c b/drivers/media/video/saa7134/saa7134-oss.c
index fd9ed11ab1e2..299046974382 100644
--- a/drivers/media/video/saa7134/saa7134-oss.c
+++ b/drivers/media/video/saa7134/saa7134-oss.c
@@ -903,22 +903,22 @@ int saa7134_dsp_create(struct saa7134_dev *dev)
903{ 903{
904 int err; 904 int err;
905 905
906 err = dev->dmasound.minor_dsp = 906 err = dev->dmasound.minor_dsp =
907 register_sound_dsp(&saa7134_dsp_fops, 907 register_sound_dsp(&saa7134_dsp_fops,
908 dsp_nr[dev->nr]); 908 dsp_nr[dev->nr]);
909 if (err < 0) { 909 if (err < 0) {
910 goto fail; 910 goto fail;
911 } 911 }
912 printk(KERN_INFO "%s: registered device dsp%d\n", 912 printk(KERN_INFO "%s: registered device dsp%d\n",
913 dev->name,dev->dmasound.minor_dsp >> 4); 913 dev->name,dev->dmasound.minor_dsp >> 4);
914 914
915 err = dev->dmasound.minor_mixer = 915 err = dev->dmasound.minor_mixer =
916 register_sound_mixer(&saa7134_mixer_fops, 916 register_sound_mixer(&saa7134_mixer_fops,
917 mixer_nr[dev->nr]); 917 mixer_nr[dev->nr]);
918 if (err < 0) 918 if (err < 0)
919 goto fail; 919 goto fail;
920 printk(KERN_INFO "%s: registered device mixer%d\n", 920 printk(KERN_INFO "%s: registered device mixer%d\n",
921 dev->name,dev->dmasound.minor_mixer >> 4); 921 dev->name,dev->dmasound.minor_mixer >> 4);
922 922
923 return 0; 923 return 0;
924 924
@@ -929,6 +929,31 @@ fail:
929 929
930} 930}
931 931
932static int oss_device_init(struct saa7134_dev *dev)
933{
934 dev->dmasound.priv_data = dev;
935 saa7134_oss_init1(dev);
936 saa7134_dsp_create(dev);
937 return 1;
938}
939
940static int oss_device_exit(struct saa7134_dev *dev)
941{
942
943 unregister_sound_mixer(dev->dmasound.minor_mixer);
944 unregister_sound_dsp(dev->dmasound.minor_dsp);
945
946 saa7134_oss_fini(dev);
947
948 if (dev->pci->irq > 0) {
949 synchronize_irq(dev->pci->irq);
950 free_irq(dev->pci->irq,&dev->dmasound);
951 }
952
953 dev->dmasound.priv_data = NULL;
954 return 1;
955}
956
932static int saa7134_oss_init(void) 957static int saa7134_oss_init(void)
933{ 958{
934 struct saa7134_dev *dev = NULL; 959 struct saa7134_dev *dev = NULL;
@@ -939,9 +964,7 @@ static int saa7134_oss_init(void)
939 list_for_each(list,&saa7134_devlist) { 964 list_for_each(list,&saa7134_devlist) {
940 dev = list_entry(list, struct saa7134_dev, devlist); 965 dev = list_entry(list, struct saa7134_dev, devlist);
941 if (dev->dmasound.priv_data == NULL) { 966 if (dev->dmasound.priv_data == NULL) {
942 dev->dmasound.priv_data = dev; 967 oss_device_init(dev);
943 saa7134_oss_init1(dev);
944 saa7134_dsp_create(dev);
945 } else { 968 } else {
946 printk(KERN_ERR "saa7134 OSS: DMA sound is being handled by ALSA, ignoring %s\n",dev->name); 969 printk(KERN_ERR "saa7134 OSS: DMA sound is being handled by ALSA, ignoring %s\n",dev->name);
947 return -EBUSY; 970 return -EBUSY;
@@ -951,6 +974,9 @@ static int saa7134_oss_init(void)
951 if (dev == NULL) 974 if (dev == NULL)
952 printk(KERN_INFO "saa7134 OSS: no saa7134 cards found\n"); 975 printk(KERN_INFO "saa7134 OSS: no saa7134 cards found\n");
953 976
977 dmasound_init = oss_device_init;
978 dmasound_exit = oss_device_exit;
979
954 return 0; 980 return 0;
955 981
956} 982}
@@ -967,18 +993,7 @@ void saa7134_oss_exit(void)
967 if (!dev->dmasound.minor_dsp) 993 if (!dev->dmasound.minor_dsp)
968 continue; 994 continue;
969 995
970 unregister_sound_mixer(dev->dmasound.minor_mixer); 996 oss_device_exit(dev);
971 unregister_sound_dsp(dev->dmasound.minor_dsp);
972
973 saa7134_oss_fini(dev);
974
975 if (dev->pci->irq > 0) {
976 synchronize_irq(dev->pci->irq);
977 free_irq(dev->pci->irq,&dev->dmasound);
978 }
979
980 dev->dmasound.priv_data = NULL;
981
982 } 997 }
983 998
984 printk(KERN_INFO "saa7134 OSS driver for DMA sound unloaded\n"); 999 printk(KERN_INFO "saa7134 OSS driver for DMA sound unloaded\n");