patch-2.2.16 linux/drivers/sbus/audio/audio.c

Next file: linux/drivers/sbus/char/envctrl.c
Previous file: linux/drivers/s390/net/iucv.c
Back to the patch index
Back to the overall index

diff -urN v2.2.15/linux/drivers/sbus/audio/audio.c linux/drivers/sbus/audio/audio.c
@@ -122,6 +122,7 @@
         init_waitqueue_head(&drv->output_write_wait);
         init_waitqueue_head(&drv->output_drain_wait);
         init_waitqueue_head(&drv->input_read_wait);
+        init_waitqueue_head(&drv->poll_wait);
 #endif
 
         drv->num_output_buffers = 8;
@@ -310,6 +311,7 @@
   if ((status & 1) || ((drv->output_count + drv->playing_count) 
                        < drv->num_output_buffers)) {
     wake_up_interruptible(&drv->output_write_wait);
+    wake_up_interruptible(&drv->poll_wait);
   }
 
   /* If the output queue is empty, shut down the driver. */
@@ -323,6 +325,7 @@
     /* Wake up any waiting writers or syncers and return. */
     wake_up_interruptible(&drv->output_write_wait);
     wake_up_interruptible(&drv->output_drain_wait);
+    wake_up_interruptible(&drv->poll_wait);
     return;
   }
 
@@ -344,6 +347,7 @@
     drv->ops->start_input(drv, drv->input_buffers[drv->input_front],
 			  drv->input_buffer_size);
     wake_up_interruptible(&drv->input_read_wait);
+    wake_up_interruptible(&drv->poll_wait);
     return;
   } 
 
@@ -379,6 +383,7 @@
 
   /* Wake up any tasks that are waiting. */
   wake_up_interruptible(&drv->input_read_wait);
+  wake_up_interruptible(&drv->poll_wait);
 }
 
 
@@ -401,14 +406,14 @@
       dprintk(("read ready: c%d o%d\n", drv->input_count, drv->input_offset));
       return 1;
     }
-    select_wait(&drv->input_read_wait, wait);
+    select_wait(&drv->poll_wait, wait);
     break;
   case SEL_OUT:
     dprintk(("sel out: c%d o%d p%d\n", drv->output_count, drv->output_offset, drv->playing_count));
     if ((drv->output_count + drv->playing_count) < (drv->num_output_buffers)) {
       return 1;
     }
-    select_wait(&drv->output_write_wait, wait);
+    select_wait(&drv->poll_wait, wait);
     break;
   case SEL_EX:
     break;
@@ -424,8 +429,7 @@
   struct sparcaudio_driver *drv = drivers[(MINOR(inode->i_rdev) >>
                                            SPARCAUDIO_DEVICE_SHIFT)];
 
-  poll_wait(file, &drv->input_read_wait, wait);
-  poll_wait(file, &drv->output_write_wait, wait);
+  poll_wait(file, &drv->poll_wait, wait);
   if (((!file->f_flags & O_NONBLOCK) && drv->input_count) ||
       (drv->input_size > drv->buffer_size)) {
     mask |= POLLIN | POLLRDNORM;
@@ -509,6 +513,7 @@
      */
     if (drv->duplex == 2) {
       wake_up_interruptible(&drv->output_write_wait);
+      wake_up_interruptible(&drv->poll_wait);
     }
   }
 
@@ -1188,6 +1193,7 @@
 		sparcaudio_sync_output(drv);
 		if (drv->output_active) {
 		  wake_up_interruptible(&drv->output_write_wait);
+		  wake_up_interruptible(&drv->poll_wait);
 		  drv->ops->stop_output(drv);
 		}
 		drv->output_offset = 0;
@@ -1204,6 +1210,7 @@
 		((unsigned int)arg == FLUSHRW)) {
 	      if (drv->input_active && (file->f_mode & FMODE_READ)) {
 		wake_up_interruptible(&drv->input_read_wait);
+		wake_up_interruptible(&drv->poll_wait);
 		drv->ops->stop_input(drv);
 		drv->input_active = 0;
 		drv->input_front = 0;
@@ -1236,6 +1243,7 @@
 	  case AUDIO_FLUSH:
 	    if (drv->output_active && (file->f_mode & FMODE_WRITE)) {
 	      wake_up_interruptible(&drv->output_write_wait);
+	      wake_up_interruptible(&drv->poll_wait);
 	      drv->ops->stop_output(drv);
 	      drv->output_active = 0;
 	      drv->output_front = 0;
@@ -1248,6 +1256,7 @@
 	    }
 	    if (drv->input_active && (file->f_mode & FMODE_READ)) {
 	      wake_up_interruptible(&drv->input_read_wait);
+	      wake_up_interruptible(&drv->poll_wait);
 	      drv->ops->stop_input(drv);
 	      drv->input_active = 0;
 	      drv->input_front = 0;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)