aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ieee1394/video1394.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ieee1394/video1394.c')
-rw-r--r--drivers/ieee1394/video1394.c52
1 files changed, 44 insertions, 8 deletions
diff --git a/drivers/ieee1394/video1394.c b/drivers/ieee1394/video1394.c
index c6e3f02bc6d7..9bc65059cc69 100644
--- a/drivers/ieee1394/video1394.c
+++ b/drivers/ieee1394/video1394.c
@@ -49,16 +49,16 @@
49#include <linux/compat.h> 49#include <linux/compat.h>
50#include <linux/cdev.h> 50#include <linux/cdev.h>
51 51
52#include "ieee1394.h" 52#include "dma.h"
53#include "ieee1394_types.h" 53#include "highlevel.h"
54#include "hosts.h" 54#include "hosts.h"
55#include "ieee1394.h"
55#include "ieee1394_core.h" 56#include "ieee1394_core.h"
56#include "highlevel.h" 57#include "ieee1394_hotplug.h"
57#include "video1394.h" 58#include "ieee1394_types.h"
58#include "nodemgr.h" 59#include "nodemgr.h"
59#include "dma.h"
60
61#include "ohci1394.h" 60#include "ohci1394.h"
61#include "video1394.h"
62 62
63#define ISO_CHANNELS 64 63#define ISO_CHANNELS 64
64 64
@@ -129,7 +129,7 @@ struct file_ctx {
129#define DBGMSG(card, fmt, args...) \ 129#define DBGMSG(card, fmt, args...) \
130printk(KERN_INFO "video1394_%d: " fmt "\n" , card , ## args) 130printk(KERN_INFO "video1394_%d: " fmt "\n" , card , ## args)
131#else 131#else
132#define DBGMSG(card, fmt, args...) 132#define DBGMSG(card, fmt, args...) do {} while (0)
133#endif 133#endif
134 134
135/* print general (card independent) information */ 135/* print general (card independent) information */
@@ -1181,7 +1181,8 @@ static int video1394_mmap(struct file *file, struct vm_area_struct *vma)
1181 1181
1182 lock_kernel(); 1182 lock_kernel();
1183 if (ctx->current_ctx == NULL) { 1183 if (ctx->current_ctx == NULL) {
1184 PRINT(KERN_ERR, ctx->ohci->host->id, "Current iso context not set"); 1184 PRINT(KERN_ERR, ctx->ohci->host->id,
1185 "Current iso context not set");
1185 } else 1186 } else
1186 res = dma_region_mmap(&ctx->current_ctx->dma, file, vma); 1187 res = dma_region_mmap(&ctx->current_ctx->dma, file, vma);
1187 unlock_kernel(); 1188 unlock_kernel();
@@ -1189,6 +1190,40 @@ static int video1394_mmap(struct file *file, struct vm_area_struct *vma)
1189 return res; 1190 return res;
1190} 1191}
1191 1192
1193static unsigned int video1394_poll(struct file *file, poll_table *pt)
1194{
1195 struct file_ctx *ctx;
1196 unsigned int mask = 0;
1197 unsigned long flags;
1198 struct dma_iso_ctx *d;
1199 int i;
1200
1201 lock_kernel();
1202 ctx = file->private_data;
1203 d = ctx->current_ctx;
1204 if (d == NULL) {
1205 PRINT(KERN_ERR, ctx->ohci->host->id,
1206 "Current iso context not set");
1207 mask = POLLERR;
1208 goto done;
1209 }
1210
1211 poll_wait(file, &d->waitq, pt);
1212
1213 spin_lock_irqsave(&d->lock, flags);
1214 for (i = 0; i < d->num_desc; i++) {
1215 if (d->buffer_status[i] == VIDEO1394_BUFFER_READY) {
1216 mask |= POLLIN | POLLRDNORM;
1217 break;
1218 }
1219 }
1220 spin_unlock_irqrestore(&d->lock, flags);
1221done:
1222 unlock_kernel();
1223
1224 return mask;
1225}
1226
1192static int video1394_open(struct inode *inode, struct file *file) 1227static int video1394_open(struct inode *inode, struct file *file)
1193{ 1228{
1194 int i = ieee1394_file_to_instance(file); 1229 int i = ieee1394_file_to_instance(file);
@@ -1257,6 +1292,7 @@ static struct file_operations video1394_fops=
1257#ifdef CONFIG_COMPAT 1292#ifdef CONFIG_COMPAT
1258 .compat_ioctl = video1394_compat_ioctl, 1293 .compat_ioctl = video1394_compat_ioctl,
1259#endif 1294#endif
1295 .poll = video1394_poll,
1260 .mmap = video1394_mmap, 1296 .mmap = video1394_mmap,
1261 .open = video1394_open, 1297 .open = video1394_open,
1262 .release = video1394_release 1298 .release = video1394_release