vserver 1.9.5.x5
[linux-2.6.git] / sound / oss / wf_midi.c
index c1a09af..7b167b7 100644 (file)
@@ -81,7 +81,7 @@ static struct wf_mpu_config *phys_dev = &devs[0];
 static struct wf_mpu_config *virt_dev = &devs[1];
 
 static void start_uart_mode (void);
-static spinlock_t lock=SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(lock);
 
 #define        OUTPUT_READY    0x40
 #define        INPUT_AVAIL     0x80
@@ -537,7 +537,7 @@ static inline int wf_mpu_end_read (int dev) {
        return 0;
 }
 
-static int wf_mpu_ioctl (int dev, unsigned cmd, caddr_t arg)
+static int wf_mpu_ioctl (int dev, unsigned cmd, void __user *arg)
 {
        printk (KERN_WARNING
                "WF-MPU: Intelligent mode not supported by hardware.\n");
@@ -573,8 +573,7 @@ static struct synth_info wf_mpu_synth_info_proto =
 static struct synth_info wf_mpu_synth_info[2];
 
 static int
-wf_mpu_synth_ioctl (int dev,
-                   unsigned int cmd, caddr_t arg)
+wf_mpu_synth_ioctl (int dev, unsigned int cmd, void __user *arg)
 {
        int             midi_dev;
        int index;
@@ -595,7 +594,7 @@ wf_mpu_synth_ioctl (int dev,
        switch (cmd) {
 
        case SNDCTL_SYNTH_INFO:
-               if(copy_to_user (&((char *) arg)[0],
+               if (copy_to_user(arg,
                              &wf_mpu_synth_info[index],
                              sizeof (struct synth_info)))
                        return -EFAULT;
@@ -785,7 +784,7 @@ virtual_midi_disable (void)
 
 int __init detect_wf_mpu (int irq, int io_base)
 {
-       if (check_region (io_base, 2)) {
+       if (!request_region(io_base, 2, "wavefront midi")) {
                printk (KERN_WARNING "WF-MPU: I/O port %x already in use.\n",
                        io_base);
                return -1;
@@ -804,11 +803,10 @@ int __init install_wf_mpu (void)
        if ((phys_dev->devno = sound_alloc_mididev()) < 0){
 
                printk (KERN_ERR "WF-MPU: Too many MIDI devices detected.\n");
+               release_region(phys_dev->base, 2);
                return -1;
-
        }
 
-       request_region (phys_dev->base, 2, "wavefront midi");
        phys_dev->isvirtual = 0;
 
        if (config_wf_mpu (phys_dev)) {