me8100.c
changeset 18 d1686272f84d
parent 15 b9baa645576a
child 22 7b722739e329
--- a/me8100.c	Wed Jan 23 19:23:14 2002 +0100
+++ b/me8100.c	Wed Jan 23 19:23:53 2002 +0100
@@ -134,6 +134,7 @@
 static void me8100_isr(int, void *, struct pt_regs *);
 static ssize_t me8100_read(struct file *, char *, size_t, loff_t *);
 static ssize_t me8100_write(struct file *, const char *, size_t, loff_t *);
+static unsigned int me8100_poll(struct file *, struct poll_table_struct *);
 
 static int me8100_init_board(me8100_info_type *, struct pci_dev *);
 static int me8100_reset_board(me8100_info_type *);
@@ -185,7 +186,7 @@
   read:	    me8100_read, 	/* read()              */
   write:    me8100_write,	/* write()             */
   readdir:  NULL,	        /* readdir()           */
-  poll:	    NULL,	        /* poll()              */
+  poll:	    me8100_poll,	/* poll()              */
   ioctl:    me8100_ioctl,       /* ioctl()             */
   mmap:	    NULL,   		/* mmap()              */
   open:	    me8100_open,        /* open()              */
@@ -2289,6 +2290,22 @@
   return len;
 }
 
+static unsigned int me8100_poll(struct file *file_ptr, struct poll_table_struct *wait)
+{
+  int minor = MINOR(file_ptr->f_dentry->d_inode->i_rdev);
+  me8100_info_type *info = &info_vec[DEVICE(minor)];
+  struct me8100_subinfo *subinfo = &info->subinfo[SUBDEVICE(minor)];
+  struct me8100_private_data *priv = file_ptr->private_data;
+
+  PDEBUG("***  me8100_poll()\n");
+  poll_wait(file_ptr, &subinfo->readq, wait);
+  PDEBUG("***  me8100_poll()\n");
+
+  if (priv->last_read >= subinfo->int_seen) return 0;
+  return POLLIN | POLLRDNORM;
+
+}
+
 /* 
   vim:sts=2 sw=2 aw ai sm: 
  */