diff options
Diffstat (limited to 'drivers/media/video/saa7134/saa7134-alsa.c')
-rw-r--r-- | drivers/media/video/saa7134/saa7134-alsa.c | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/drivers/media/video/saa7134/saa7134-alsa.c b/drivers/media/video/saa7134/saa7134-alsa.c index 5707c666660b..263c6e2e3e8e 100644 --- a/drivers/media/video/saa7134/saa7134-alsa.c +++ b/drivers/media/video/saa7134/saa7134-alsa.c | |||
@@ -58,8 +58,6 @@ static int enable[SNDRV_CARDS] = {1, [1 ... (SNDRV_CARDS - 1)] = 0}; | |||
58 | module_param_array(index, int, NULL, 0444); | 58 | module_param_array(index, int, NULL, 0444); |
59 | MODULE_PARM_DESC(index, "Index value for SAA7134 capture interface(s)."); | 59 | MODULE_PARM_DESC(index, "Index value for SAA7134 capture interface(s)."); |
60 | 60 | ||
61 | int position; | ||
62 | |||
63 | #define dprintk(fmt, arg...) if (debug) \ | 61 | #define dprintk(fmt, arg...) if (debug) \ |
64 | printk(KERN_DEBUG "%s/alsa: " fmt, dev->name , ## arg) | 62 | printk(KERN_DEBUG "%s/alsa: " fmt, dev->name , ## arg) |
65 | 63 | ||
@@ -140,7 +138,8 @@ static void saa7134_dma_start(struct saa7134_dev *dev) | |||
140 | * | 138 | * |
141 | */ | 139 | */ |
142 | 140 | ||
143 | void saa7134_irq_alsa_done(struct saa7134_dev *dev, unsigned long status) | 141 | static void saa7134_irq_alsa_done(struct saa7134_dev *dev, |
142 | unsigned long status) | ||
144 | { | 143 | { |
145 | int next_blk, reg = 0; | 144 | int next_blk, reg = 0; |
146 | 145 | ||
@@ -881,7 +880,7 @@ static void snd_saa7134_free(snd_card_t * card) | |||
881 | * | 880 | * |
882 | */ | 881 | */ |
883 | 882 | ||
884 | int alsa_card_saa7134_create(struct saa7134_dev *dev, int devnum) | 883 | static int alsa_card_saa7134_create(struct saa7134_dev *dev, int devnum) |
885 | { | 884 | { |
886 | 885 | ||
887 | snd_card_t *card; | 886 | snd_card_t *card; |
@@ -945,6 +944,8 @@ int alsa_card_saa7134_create(struct saa7134_dev *dev, int devnum) | |||
945 | sprintf(card->longname, "%s at 0x%lx irq %d", | 944 | sprintf(card->longname, "%s at 0x%lx irq %d", |
946 | chip->dev->name, chip->iobase, chip->irq); | 945 | chip->dev->name, chip->iobase, chip->irq); |
947 | 946 | ||
947 | printk(KERN_INFO "%s/alsa: %s registered as card %d\n",dev->name,card->longname,index[devnum]); | ||
948 | |||
948 | if ((err = snd_card_register(card)) == 0) { | 949 | if ((err = snd_card_register(card)) == 0) { |
949 | snd_saa7134_cards[devnum] = card; | 950 | snd_saa7134_cards[devnum] = card; |
950 | return 0; | 951 | return 0; |
@@ -955,6 +956,22 @@ __nodev: | |||
955 | return err; | 956 | return err; |
956 | } | 957 | } |
957 | 958 | ||
959 | |||
960 | static int alsa_device_init(struct saa7134_dev *dev) | ||
961 | { | ||
962 | dev->dmasound.priv_data = dev; | ||
963 | alsa_card_saa7134_create(dev,dev->nr); | ||
964 | return 1; | ||
965 | } | ||
966 | |||
967 | static int alsa_device_exit(struct saa7134_dev *dev) | ||
968 | { | ||
969 | |||
970 | snd_card_free(snd_saa7134_cards[dev->nr]); | ||
971 | snd_saa7134_cards[dev->nr] = NULL; | ||
972 | return 1; | ||
973 | } | ||
974 | |||
958 | /* | 975 | /* |
959 | * Module initializer | 976 | * Module initializer |
960 | * | 977 | * |
@@ -968,22 +985,21 @@ static int saa7134_alsa_init(void) | |||
968 | struct saa7134_dev *dev = NULL; | 985 | struct saa7134_dev *dev = NULL; |
969 | struct list_head *list; | 986 | struct list_head *list; |
970 | 987 | ||
971 | position = 0; | ||
972 | |||
973 | printk(KERN_INFO "saa7134 ALSA driver for DMA sound loaded\n"); | 988 | printk(KERN_INFO "saa7134 ALSA driver for DMA sound loaded\n"); |
974 | 989 | ||
975 | list_for_each(list,&saa7134_devlist) { | 990 | list_for_each(list,&saa7134_devlist) { |
976 | dev = list_entry(list, struct saa7134_dev, devlist); | 991 | dev = list_entry(list, struct saa7134_dev, devlist); |
977 | if (dev->dmasound.priv_data == NULL) { | 992 | if (dev->dmasound.priv_data == NULL) { |
978 | dev->dmasound.priv_data = dev; | 993 | alsa_device_init(dev); |
979 | alsa_card_saa7134_create(dev,position); | ||
980 | position++; | ||
981 | } else { | 994 | } else { |
982 | printk(KERN_ERR "saa7134 ALSA: DMA sound is being handled by OSS. ignoring %s\n",dev->name); | 995 | printk(KERN_ERR "saa7134 ALSA: DMA sound is being handled by OSS. ignoring %s\n",dev->name); |
983 | return -EBUSY; | 996 | return -EBUSY; |
984 | } | 997 | } |
985 | } | 998 | } |
986 | 999 | ||
1000 | dmasound_init = alsa_device_init; | ||
1001 | dmasound_exit = alsa_device_exit; | ||
1002 | |||
987 | if (dev == NULL) | 1003 | if (dev == NULL) |
988 | printk(KERN_INFO "saa7134 ALSA: no saa7134 cards found\n"); | 1004 | printk(KERN_INFO "saa7134 ALSA: no saa7134 cards found\n"); |
989 | 1005 | ||
@@ -994,7 +1010,7 @@ static int saa7134_alsa_init(void) | |||
994 | * Module destructor | 1010 | * Module destructor |
995 | */ | 1011 | */ |
996 | 1012 | ||
997 | void saa7134_alsa_exit(void) | 1013 | static void saa7134_alsa_exit(void) |
998 | { | 1014 | { |
999 | int idx; | 1015 | int idx; |
1000 | 1016 | ||