]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
skypopen: OSS driver now compiles on newer kernels (no more .ioctl)
authorGiovanni Maruzzelli <gmaruzz@gmail.com>
Mon, 15 Aug 2011 10:37:31 +0000 (05:37 -0500)
committerGiovanni Maruzzelli <gmaruzz@gmail.com>
Mon, 15 Aug 2011 10:37:31 +0000 (05:37 -0500)
src/mod/endpoints/mod_skypopen/oss/main.c

index 72d82cb10c82648df55109b40328bea957dedba2..10ebfc989993b328ded46b86b163940aeb90ff19 100644 (file)
@@ -283,6 +283,7 @@ static ssize_t skypopen_write(struct file *filp, const char __user *buf, size_t
  * The ioctl() implementation
  */
 
+#ifndef HAVE_UNLOCKED_IOCTL
 static int skypopen_ioctl(struct inode *inode, struct file *filp,
                unsigned int cmd, unsigned long arg)
 {
@@ -302,13 +303,38 @@ static int skypopen_ioctl(struct inode *inode, struct file *filp,
        }
 
 }
+#else// HAVE_UNLOCKED_IOCTL
+static long skypopen_unlocked_ioctl(struct file *filp,
+               unsigned int cmd, unsigned long arg)
+{
+       void __user *argp = (void __user *)arg;
+       int __user *p = argp;
+
+       switch (cmd) {
+               case OSS_GETVERSION:
+                       return put_user(SOUND_VERSION, p);
+               case SNDCTL_DSP_GETBLKSIZE:
+                       return put_user(SKYPOPEN_BLK, p);
+               case SNDCTL_DSP_GETFMTS:
+                       return put_user(28731, p);
+
+               default:
+                       return 0;
+       }
+
+}
+#endif// HAVE_UNLOCKED_IOCTL
 
 struct file_operations skypopen_fops = {
        .owner =    THIS_MODULE,
        .llseek =   no_llseek,
        .read =     skypopen_read,
        .write =    skypopen_write,
+#ifndef HAVE_UNLOCKED_IOCTL
        .ioctl =    skypopen_ioctl,
+#else// HAVE_UNLOCKED_IOCTL
+       .unlocked_ioctl =    skypopen_unlocked_ioctl,
+#endif// HAVE_UNLOCKED_IOCTL
        .open =     skypopen_c_open,
        .release =  skypopen_c_release,
 };