mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stefan Richter <stefanr@s5r6.in-berlin.de>
To: linux-kernel@vger.kernel.org
Cc: Ben Collins <bcollins@ubuntu.com>, Andrew Morton <akpm@osdl.org>,
	linux1394-devel@lists.sourceforge.net
Subject: [PATCH 1/4] video1394: add poll file operation support
Date: Tue, 8 Aug 2006 21:21:05 +0200 (CEST)	[thread overview]
Message-ID: <tkrat.d621130a6a44b56c@s5r6.in-berlin.de> (raw)
In-Reply-To: <tkrat.57bb8cb1b7c97d1e@s5r6.in-berlin.de>

Date: Tue, 01 Aug 2006 19:00:31 -0400
From: David Moore <dcm@acm.org>
Subject: [PATCH] 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>
---
Index: linux/drivers/ieee1394/video1394.c
===================================================================
--- linux.orig/drivers/ieee1394/video1394.c	2006-08-02 18:23:28.000000000 +0200
+++ linux/drivers/ieee1394/video1394.c	2006-08-02 18:23:42.000000000 +0200
@@ -1181,7 +1181,8 @@ static int video1394_mmap(struct file *f
 
 	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 *f
 	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_
 #ifdef CONFIG_COMPAT
 	.compat_ioctl = video1394_compat_ioctl,
 #endif
+	.poll =		video1394_poll,
 	.mmap =		video1394_mmap,
 	.open =		video1394_open,
 	.release =	video1394_release


  reply	other threads:[~2006-08-08 19:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-08 19:18 [PATCH 0/4] ieee1394: misc updates Stefan Richter
2006-08-08 19:21 ` Stefan Richter [this message]
2006-08-08 19:22 ` [PATCH 2/4] ieee1394: safer definition of empty macros Stefan Richter
2006-08-08 19:24 ` [PATCH 3/4] ieee1394: sbp2: workaround for write protect bit of Initio firmware Stefan Richter
2006-08-08 19:25 ` [PATCH 4/4] ieee1394: sbp2: enable auto spin-up for all SBP-2 devices Stefan Richter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tkrat.d621130a6a44b56c@s5r6.in-berlin.de \
    --to=stefanr@s5r6.in-berlin.de \
    --cc=akpm@osdl.org \
    --cc=bcollins@ubuntu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux1394-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®