patch-1.3.9 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 v1.3.8/linux/drivers/sound/midibuf.c linux/drivers/sound/midibuf.c
@@ -184,8 +184,8 @@
     }
 
   /*
- *    Interrupts disabled. Be careful
- */
+     *    Interrupts disabled. Be careful
+   */
 
   DISABLE_INTR (flags);
   if ((err = midi_devs[dev]->open (dev, mode,
@@ -245,14 +245,14 @@
   DISABLE_INTR (flags);
 
   /*
- * Wait until the queue is empty
- */
+     * Wait until the queue is empty
+   */
 
   if (mode != OPEN_READ)
     {
-      midi_devs[dev]->putc (dev, 0xfe);	/*
-						 * Active sensing to shut the
-						 * devices
+      midi_devs[dev]->putc (dev, 0xfe);		/*
+						   * Active sensing to shut the
+						   * devices
 						 */
 
       while (!PROCESS_ABORTING (midi_sleeper[dev], midi_sleep_flag[dev]) &&
@@ -379,22 +379,32 @@
 
   dev = dev >> 4;
 
-  switch (cmd)
+  if (((cmd >> 8) & 0xff) == 'C')
     {
-
-    case SNDCTL_MIDI_PRETIME:
-      val = IOCTL_IN (arg);
-      if (val < 0)
-	val = 0;
-
-      val = (HZ * val) / 10;
-      parms[dev].prech_timeout = val;
-      return IOCTL_OUT (arg, val);
-      break;
-
-    default:
-      return midi_devs[dev]->ioctl (dev, cmd, arg);
-    }
+      if (midi_devs[dev]->coproc)	/* Coprocessor ioctl */
+	return midi_devs[dev]->coproc->ioctl (midi_devs[dev]->coproc->devc, cmd, arg, 0);
+      else
+	printk ("/dev/midi%d: No coprocessor for this device\n", dev);
+
+      return RET_ERROR (EREMOTEIO);
+    }
+  else
+    switch (cmd)
+      {
+
+      case SNDCTL_MIDI_PRETIME:
+	val = IOCTL_IN (arg);
+	if (val < 0)
+	  val = 0;
+
+	val = (HZ * val) / 10;
+	parms[dev].prech_timeout = val;
+	return IOCTL_OUT (arg, val);
+	break;
+
+      default:
+	return midi_devs[dev]->ioctl (dev, cmd, arg);
+      }
 }
 
 #ifdef ALLOW_SELECT

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov with Sam's (original) version
of this