patch-2.1.28 linux/drivers/sound/midibuf.c

Next file: linux/drivers/sound/mpu401.c
Previous file: linux/drivers/sound/midi_synth.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.27/linux/drivers/sound/midibuf.c linux/drivers/sound/midibuf.c
@@ -4,14 +4,13 @@
  * Device file manager for /dev/midi#
  */
 /*
- * Copyright (C) by Hannu Savolainen 1993-1996
+ * Copyright (C) by Hannu Savolainen 1993-1997
  *
  * OSS/Free for Linux is distributed under the GNU GENERAL PUBLIC LICENSE (GPL)
  * Version 2 (June 1991). See the "COPYING" file distributed with this software
  * for more info.
  */
 #include <linux/config.h>
-#include <linux/poll.h>
 
 
 #include "sound_config.h"
@@ -84,7 +83,7 @@
 	  restore_flags(flags); \
 	}
 
-void
+static void
 drain_midi_queue (int dev)
 {
 
@@ -484,13 +483,13 @@
       {
 
       case SNDCTL_MIDI_PRETIME:
-	get_user (val, (int *) arg);
+	val = *(int *) arg;
 	if (val < 0)
 	  val = 0;
 
 	val = (HZ * val) / 10;
 	parms[dev].prech_timeout = val;
-	return ioctl_out (arg, val);
+	return (*(int *) arg = val);
 	break;
 
       default:
@@ -498,21 +497,40 @@
       }
 }
 
-unsigned int
-MIDIbuf_poll (kdev_t dev, struct fileinfo *file, poll_table * wait)
+int
+MIDIbuf_select (int dev, struct fileinfo *file, int sel_type, poll_table * wait)
 {
-  unsigned int mask = 0;
+  dev = dev >> 4;
+
+  switch (sel_type)
+    {
+    case SEL_IN:
+      if (!DATA_AVAIL (midi_in_buf[dev]))
+	{
+
+	  input_sleep_flag[dev].opts = WK_SLEEP;
+	  poll_wait (&input_sleeper[dev], wait);
+	  return 0;
+	}
+      return 1;
+      break;
+
+    case SEL_OUT:
+      if (SPACE_AVAIL (midi_out_buf[dev]))
+	{
+
+	  midi_sleep_flag[dev].opts = WK_SLEEP;
+	  poll_wait (&midi_sleeper[dev], wait);
+	  return 0;
+	}
+      return 1;
+      break;
+
+    case SEL_EX:
+      return 0;
+    }
 
-  input_sleep_flag[dev].opts = WK_SLEEP;
-  poll_wait (&input_sleeper[dev], wait);
-  midi_sleep_flag[dev].opts = WK_SLEEP;
-  poll_wait (&midi_sleeper[dev], wait);
-
-  if (DATA_AVAIL (midi_in_buf[dev]))
-    mask |= POLLIN | POLLRDNORM;
-  if (!SPACE_AVAIL (midi_out_buf[dev]))
-    mask |= POLLOUT | POLLWRNORM;
-  return mask;
+  return 0;
 }
 
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov