From de4394f13cc843fae2a3ba2df752ee20e6e779a8 Mon Sep 17 00:00:00 2001 From: Stefan Richter Date: Mon, 3 Jul 2006 12:02:29 -0400 Subject: [PATCH] ieee1394: update #include directives in midlayer header files Remove unnecessary includes, add missing includes. Use forward type declarations for some structs. Signed-off-by: Stefan Richter Signed-off-by: Ben Collins --- drivers/ieee1394/video1394.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'drivers/ieee1394/video1394.c') diff --git a/drivers/ieee1394/video1394.c b/drivers/ieee1394/video1394.c index c6e3f02bc6d..6b5353d81ae 100644 --- a/drivers/ieee1394/video1394.c +++ b/drivers/ieee1394/video1394.c @@ -49,16 +49,16 @@ #include #include -#include "ieee1394.h" -#include "ieee1394_types.h" +#include "dma.h" +#include "highlevel.h" #include "hosts.h" +#include "ieee1394.h" #include "ieee1394_core.h" -#include "highlevel.h" -#include "video1394.h" +#include "ieee1394_hotplug.h" +#include "ieee1394_types.h" #include "nodemgr.h" -#include "dma.h" - #include "ohci1394.h" +#include "video1394.h" #define ISO_CHANNELS 64 -- cgit v1.2.3 From 4b60912e52bc6ccdf587f2b92f3435ee2678d730 Mon Sep 17 00:00:00 2001 From: David Moore Date: Wed, 2 Aug 2006 01:00:00 +0200 Subject: video1394: add poll file operation support This patch adds support for the poll file operation to the video1394 driver. Signed-off-by: David Moore Signed-off-by: Stefan Richter --- drivers/ieee1394/video1394.c | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) (limited to 'drivers/ieee1394/video1394.c') diff --git a/drivers/ieee1394/video1394.c b/drivers/ieee1394/video1394.c index 6b5353d81ae..af78b840dc2 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) lock_kernel(); if (ctx->current_ctx == NULL) { - PRINT(KERN_ERR, ctx->ohci->host->id, "Current iso context not set"); + PRINT(KERN_ERR, ctx->ohci->host->id, + "Current iso context not set"); } else res = dma_region_mmap(&ctx->current_ctx->dma, file, vma); unlock_kernel(); @@ -1189,6 +1190,40 @@ static int video1394_mmap(struct file *file, struct vm_area_struct *vma) return res; } +static unsigned int video1394_poll(struct file *file, poll_table *pt) +{ + struct file_ctx *ctx; + unsigned int mask = 0; + unsigned long flags; + struct dma_iso_ctx *d; + int i; + + lock_kernel(); + ctx = file->private_data; + d = ctx->current_ctx; + if (d == NULL) { + PRINT(KERN_ERR, ctx->ohci->host->id, + "Current iso context not set"); + mask = POLLERR; + goto done; + } + + poll_wait(file, &d->waitq, pt); + + spin_lock_irqsave(&d->lock, flags); + for (i = 0; i < d->num_desc; i++) { + if (d->buffer_status[i] == VIDEO1394_BUFFER_READY) { + mask |= POLLIN | POLLRDNORM; + break; + } + } + spin_unlock_irqrestore(&d->lock, flags); +done: + unlock_kernel(); + + return mask; +} + static int video1394_open(struct inode *inode, struct file *file) { int i = ieee1394_file_to_instance(file); @@ -1257,6 +1292,7 @@ static struct file_operations video1394_fops= #ifdef CONFIG_COMPAT .compat_ioctl = video1394_compat_ioctl, #endif + .poll = video1394_poll, .mmap = video1394_mmap, .open = video1394_open, .release = video1394_release -- cgit v1.2.3 From 611aa19fd60fe57059d9972fa6ae29f7472a13cf Mon Sep 17 00:00:00 2001 From: Stefan Richter Date: Wed, 2 Aug 2006 18:44:00 +0200 Subject: ieee1394: safer definition of empty macros A deactivated macro, defined as "#define foo(bar)", will result in silent corruption if somebody forgets a semicolon after a call to foo. Replace it by "#define foo(bar) do {} while (0)" which will reveal any respective syntax errors. Signed-off-by: Stefan Richter --- drivers/ieee1394/video1394.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/ieee1394/video1394.c') diff --git a/drivers/ieee1394/video1394.c b/drivers/ieee1394/video1394.c index af78b840dc2..9bc65059cc6 100644 --- a/drivers/ieee1394/video1394.c +++ b/drivers/ieee1394/video1394.c @@ -129,7 +129,7 @@ struct file_ctx { #define DBGMSG(card, fmt, args...) \ printk(KERN_INFO "video1394_%d: " fmt "\n" , card , ## args) #else -#define DBGMSG(card, fmt, args...) +#define DBGMSG(card, fmt, args...) do {} while (0) #endif /* print general (card independent) information */ -- cgit v1.2.3