diff options
Diffstat (limited to 'drivers/media/video/saa7134')
-rw-r--r-- | drivers/media/video/saa7134/saa7134-core.c | 44 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134-video.c | 14 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134.h | 1 |
3 files changed, 30 insertions, 29 deletions
diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c index 6a1738dccda7..ac574452d01e 100644 --- a/drivers/media/video/saa7134/saa7134-core.c +++ b/drivers/media/video/saa7134/saa7134-core.c | |||
@@ -86,8 +86,10 @@ MODULE_PARM_DESC(radio_nr, "radio device number"); | |||
86 | MODULE_PARM_DESC(tuner, "tuner type"); | 86 | MODULE_PARM_DESC(tuner, "tuner type"); |
87 | MODULE_PARM_DESC(card, "card type"); | 87 | MODULE_PARM_DESC(card, "card type"); |
88 | 88 | ||
89 | static DEFINE_MUTEX(devlist_lock); | 89 | DEFINE_MUTEX(saa7134_devlist_lock); |
90 | EXPORT_SYMBOL(saa7134_devlist_lock); | ||
90 | LIST_HEAD(saa7134_devlist); | 91 | LIST_HEAD(saa7134_devlist); |
92 | EXPORT_SYMBOL(saa7134_devlist); | ||
91 | static LIST_HEAD(mops_list); | 93 | static LIST_HEAD(mops_list); |
92 | static unsigned int saa7134_devcount; | 94 | static unsigned int saa7134_devcount; |
93 | 95 | ||
@@ -991,6 +993,18 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, | |||
991 | 993 | ||
992 | v4l2_prio_init(&dev->prio); | 994 | v4l2_prio_init(&dev->prio); |
993 | 995 | ||
996 | mutex_lock(&saa7134_devlist_lock); | ||
997 | list_for_each_entry(mops, &mops_list, next) | ||
998 | mpeg_ops_attach(mops, dev); | ||
999 | list_add_tail(&dev->devlist, &saa7134_devlist); | ||
1000 | mutex_unlock(&saa7134_devlist_lock); | ||
1001 | |||
1002 | /* check for signal */ | ||
1003 | saa7134_irq_video_signalchange(dev); | ||
1004 | |||
1005 | if (TUNER_ABSENT != dev->tuner_type) | ||
1006 | saa_call_all(dev, core, s_standby, 0); | ||
1007 | |||
994 | /* register v4l devices */ | 1008 | /* register v4l devices */ |
995 | if (saa7134_no_overlay > 0) | 1009 | if (saa7134_no_overlay > 0) |
996 | printk(KERN_INFO "%s: Overlay support disabled.\n", dev->name); | 1010 | printk(KERN_INFO "%s: Overlay support disabled.\n", dev->name); |
@@ -1028,21 +1042,8 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, | |||
1028 | /* everything worked */ | 1042 | /* everything worked */ |
1029 | saa7134_devcount++; | 1043 | saa7134_devcount++; |
1030 | 1044 | ||
1031 | mutex_lock(&devlist_lock); | 1045 | if (saa7134_dmasound_init && !dev->dmasound.priv_data) |
1032 | list_for_each_entry(mops, &mops_list, next) | ||
1033 | mpeg_ops_attach(mops, dev); | ||
1034 | list_add_tail(&dev->devlist,&saa7134_devlist); | ||
1035 | mutex_unlock(&devlist_lock); | ||
1036 | |||
1037 | /* check for signal */ | ||
1038 | saa7134_irq_video_signalchange(dev); | ||
1039 | |||
1040 | if (saa7134_dmasound_init && !dev->dmasound.priv_data) { | ||
1041 | saa7134_dmasound_init(dev); | 1046 | saa7134_dmasound_init(dev); |
1042 | } | ||
1043 | |||
1044 | if (TUNER_ABSENT != dev->tuner_type) | ||
1045 | saa_call_all(dev, core, s_standby, 0); | ||
1046 | 1047 | ||
1047 | return 0; | 1048 | return 0; |
1048 | 1049 | ||
@@ -1093,11 +1094,11 @@ static void __devexit saa7134_finidev(struct pci_dev *pci_dev) | |||
1093 | saa7134_hwfini(dev); | 1094 | saa7134_hwfini(dev); |
1094 | 1095 | ||
1095 | /* unregister */ | 1096 | /* unregister */ |
1096 | mutex_lock(&devlist_lock); | 1097 | mutex_lock(&saa7134_devlist_lock); |
1097 | list_del(&dev->devlist); | 1098 | list_del(&dev->devlist); |
1098 | list_for_each_entry(mops, &mops_list, next) | 1099 | list_for_each_entry(mops, &mops_list, next) |
1099 | mpeg_ops_detach(mops, dev); | 1100 | mpeg_ops_detach(mops, dev); |
1100 | mutex_unlock(&devlist_lock); | 1101 | mutex_unlock(&saa7134_devlist_lock); |
1101 | saa7134_devcount--; | 1102 | saa7134_devcount--; |
1102 | 1103 | ||
1103 | saa7134_i2c_unregister(dev); | 1104 | saa7134_i2c_unregister(dev); |
@@ -1254,11 +1255,11 @@ int saa7134_ts_register(struct saa7134_mpeg_ops *ops) | |||
1254 | { | 1255 | { |
1255 | struct saa7134_dev *dev; | 1256 | struct saa7134_dev *dev; |
1256 | 1257 | ||
1257 | mutex_lock(&devlist_lock); | 1258 | mutex_lock(&saa7134_devlist_lock); |
1258 | list_for_each_entry(dev, &saa7134_devlist, devlist) | 1259 | list_for_each_entry(dev, &saa7134_devlist, devlist) |
1259 | mpeg_ops_attach(ops, dev); | 1260 | mpeg_ops_attach(ops, dev); |
1260 | list_add_tail(&ops->next,&mops_list); | 1261 | list_add_tail(&ops->next,&mops_list); |
1261 | mutex_unlock(&devlist_lock); | 1262 | mutex_unlock(&saa7134_devlist_lock); |
1262 | return 0; | 1263 | return 0; |
1263 | } | 1264 | } |
1264 | 1265 | ||
@@ -1266,11 +1267,11 @@ void saa7134_ts_unregister(struct saa7134_mpeg_ops *ops) | |||
1266 | { | 1267 | { |
1267 | struct saa7134_dev *dev; | 1268 | struct saa7134_dev *dev; |
1268 | 1269 | ||
1269 | mutex_lock(&devlist_lock); | 1270 | mutex_lock(&saa7134_devlist_lock); |
1270 | list_del(&ops->next); | 1271 | list_del(&ops->next); |
1271 | list_for_each_entry(dev, &saa7134_devlist, devlist) | 1272 | list_for_each_entry(dev, &saa7134_devlist, devlist) |
1272 | mpeg_ops_detach(ops, dev); | 1273 | mpeg_ops_detach(ops, dev); |
1273 | mutex_unlock(&devlist_lock); | 1274 | mutex_unlock(&saa7134_devlist_lock); |
1274 | } | 1275 | } |
1275 | 1276 | ||
1276 | EXPORT_SYMBOL(saa7134_ts_register); | 1277 | EXPORT_SYMBOL(saa7134_ts_register); |
@@ -1314,7 +1315,6 @@ module_exit(saa7134_fini); | |||
1314 | /* ----------------------------------------------------------- */ | 1315 | /* ----------------------------------------------------------- */ |
1315 | 1316 | ||
1316 | EXPORT_SYMBOL(saa7134_set_gpio); | 1317 | EXPORT_SYMBOL(saa7134_set_gpio); |
1317 | EXPORT_SYMBOL(saa7134_devlist); | ||
1318 | EXPORT_SYMBOL(saa7134_boards); | 1318 | EXPORT_SYMBOL(saa7134_boards); |
1319 | 1319 | ||
1320 | /* ----------------- for the DMA sound modules --------------- */ | 1320 | /* ----------------- for the DMA sound modules --------------- */ |
diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c index adfdb662c5eb..aa7fa1f73a56 100644 --- a/drivers/media/video/saa7134/saa7134-video.c +++ b/drivers/media/video/saa7134/saa7134-video.c | |||
@@ -1335,7 +1335,7 @@ static int video_open(struct file *file) | |||
1335 | enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | 1335 | enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
1336 | int radio = 0; | 1336 | int radio = 0; |
1337 | 1337 | ||
1338 | lock_kernel(); | 1338 | mutex_lock(&saa7134_devlist_lock); |
1339 | list_for_each_entry(dev, &saa7134_devlist, devlist) { | 1339 | list_for_each_entry(dev, &saa7134_devlist, devlist) { |
1340 | if (dev->video_dev && (dev->video_dev->minor == minor)) | 1340 | if (dev->video_dev && (dev->video_dev->minor == minor)) |
1341 | goto found; | 1341 | goto found; |
@@ -1348,19 +1348,20 @@ static int video_open(struct file *file) | |||
1348 | goto found; | 1348 | goto found; |
1349 | } | 1349 | } |
1350 | } | 1350 | } |
1351 | unlock_kernel(); | 1351 | mutex_unlock(&saa7134_devlist_lock); |
1352 | return -ENODEV; | 1352 | return -ENODEV; |
1353 | found: | 1353 | |
1354 | found: | ||
1355 | mutex_unlock(&saa7134_devlist_lock); | ||
1354 | 1356 | ||
1355 | dprintk("open minor=%d radio=%d type=%s\n",minor,radio, | 1357 | dprintk("open minor=%d radio=%d type=%s\n",minor,radio, |
1356 | v4l2_type_names[type]); | 1358 | v4l2_type_names[type]); |
1357 | 1359 | ||
1358 | /* allocate + initialize per filehandle data */ | 1360 | /* allocate + initialize per filehandle data */ |
1359 | fh = kzalloc(sizeof(*fh),GFP_KERNEL); | 1361 | fh = kzalloc(sizeof(*fh),GFP_KERNEL); |
1360 | if (NULL == fh) { | 1362 | if (NULL == fh) |
1361 | unlock_kernel(); | ||
1362 | return -ENOMEM; | 1363 | return -ENOMEM; |
1363 | } | 1364 | |
1364 | file->private_data = fh; | 1365 | file->private_data = fh; |
1365 | fh->dev = dev; | 1366 | fh->dev = dev; |
1366 | fh->radio = radio; | 1367 | fh->radio = radio; |
@@ -1393,7 +1394,6 @@ static int video_open(struct file *file) | |||
1393 | /* switch to video/vbi mode */ | 1394 | /* switch to video/vbi mode */ |
1394 | video_mux(dev,dev->ctl_input); | 1395 | video_mux(dev,dev->ctl_input); |
1395 | } | 1396 | } |
1396 | unlock_kernel(); | ||
1397 | return 0; | 1397 | return 0; |
1398 | } | 1398 | } |
1399 | 1399 | ||
diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index 157f595c3ed1..4552a4d6f192 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h | |||
@@ -641,6 +641,7 @@ struct saa7134_dev { | |||
641 | /* saa7134-core.c */ | 641 | /* saa7134-core.c */ |
642 | 642 | ||
643 | extern struct list_head saa7134_devlist; | 643 | extern struct list_head saa7134_devlist; |
644 | extern struct mutex saa7134_devlist_lock; | ||
644 | extern int saa7134_no_overlay; | 645 | extern int saa7134_no_overlay; |
645 | 646 | ||
646 | void saa7134_track_gpio(struct saa7134_dev *dev, char *msg); | 647 | void saa7134_track_gpio(struct saa7134_dev *dev, char *msg); |