diff options
-rw-r--r-- | drivers/ieee1394/video1394.c | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/drivers/ieee1394/video1394.c b/drivers/ieee1394/video1394.c index 6b5353d81ae2..af78b840dc26 100644 --- a/drivers/ieee1394/video1394.c +++ b/drivers/ieee1394/video1394.c | |||
@@ -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 | ||
1193 | static 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); | ||
1221 | done: | ||
1222 | unlock_kernel(); | ||
1223 | |||
1224 | return mask; | ||
1225 | } | ||
1226 | |||
1192 | static int video1394_open(struct inode *inode, struct file *file) | 1227 | static 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 |