Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

video1394: add poll file operation support

This patch adds support for the poll file operation to the video1394
driver.

Signed-off-by: David Moore <dcm@acm.org>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>

authored by

David Moore and committed by
Stefan Richter
4b60912e a1b3206b

+37 -1
+37 -1
drivers/ieee1394/video1394.c
··· 1181 1181 1182 1182 lock_kernel(); 1183 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 1186 } else 1186 1187 res = dma_region_mmap(&ctx->current_ctx->dma, file, vma); 1187 1188 unlock_kernel(); 1188 1189 1189 1190 return res; 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; 1190 1225 } 1191 1226 1192 1227 static int video1394_open(struct inode *inode, struct file *file) ··· 1292 1257 #ifdef CONFIG_COMPAT 1293 1258 .compat_ioctl = video1394_compat_ioctl, 1294 1259 #endif 1260 + .poll = video1394_poll, 1295 1261 .mmap = video1394_mmap, 1296 1262 .open = video1394_open, 1297 1263 .release = video1394_release