patch-2.1.77 linux/drivers/sound/midi_synth.c

Next file: linux/drivers/sound/midibuf.c
Previous file: linux/drivers/sound/ics2101.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.76/linux/drivers/sound/midi_synth.c linux/drivers/sound/midi_synth.c
@@ -10,6 +10,9 @@
  * Version 2 (June 1991). See the "COPYING" file distributed with this software
  * for more info.
  */
+/*
+ * Thomas Sailer   : ioctl code reworked (vmalloc/vfree removed)
+ */
 #include <linux/config.h>
 
 #define USE_SEQ_MACROS
@@ -258,30 +261,23 @@
 	 */
 }
 
-int
-midi_synth_ioctl(int dev,
-		 unsigned int cmd, caddr_t arg)
+int midi_synth_ioctl(int dev, unsigned int cmd, caddr_t arg)
 {
 	/*
 	 * int orig_dev = synth_devs[dev]->midi_dev;
 	 */
 
-	switch (cmd)
-	  {
-
-	  case SNDCTL_SYNTH_INFO:
-		  memcpy((&((char *) arg)[0]), (char *) synth_devs[dev]->info, sizeof(struct synth_info));
-
-		  return 0;
-		  break;
+	switch (cmd) {
 
-	  case SNDCTL_SYNTH_MEMAVL:
-		  return 0x7fffffff;
-		  break;
-
-	  default:
-		  return -EINVAL;
-	  }
+	case SNDCTL_SYNTH_INFO:
+		return __copy_to_user(arg, synth_devs[dev]->info, sizeof(struct synth_info));
+		
+	case SNDCTL_SYNTH_MEMAVL:
+		return 0x7fffffff;
+
+	default:
+		return -EINVAL;
+	}
 }
 
 int

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