Make the 'comedi_compat_ioctl' symbole a function (again) instead of a
authorIan Abbott <abbotti@mev.co.uk>
Fri, 9 Nov 2007 11:12:36 +0000 (11:12 +0000)
committerIan Abbott <abbotti@mev.co.uk>
Fri, 9 Nov 2007 11:12:36 +0000 (11:12 +0000)
macro (if HAVE_COMPAT_IOCTL is defined).

comedi/comedi_compat32.c
comedi/comedi_compat32.h

index ac3c60ff6298f8d1f6a1848c6b14e9b09b6a97c0..dd7936fbbc91e1d6d6b8a87038a6e518f837516a 100644 (file)
@@ -428,8 +428,9 @@ static int compat_insn(struct file *file, unsigned long arg)
        return translated_ioctl(file, COMEDI_INSN, (unsigned long)insn);
 }
 
-/* compat_ioctl file operation. */
-long comedi_compat_ioctl_(struct file *file, unsigned int cmd,
+/* Process untranslated ioctl. */
+/* Returns -ENOIOCTLCMD for unrecognised ioctl codes. */
+static inline int raw_ioctl(struct file *file, unsigned int cmd,
                unsigned long arg)
 {
        int rc;
@@ -476,7 +477,17 @@ long comedi_compat_ioctl_(struct file *file, unsigned int cmd,
        return rc;
 }
 
-#ifndef HAVE_COMPAT_IOCTL      /* defined in <linux/fs.h> 2.6.11 onwards */
+#ifdef HAVE_COMPAT_IOCTL       /* defined in <linux/fs.h> 2.6.11 onwards */
+
+/* compat_ioctl file operation. */
+/* Returns -ENOIOCTLCMD for unrecognised ioctl codes. */
+long comedi_compat_ioctl_(struct file *file, unsigned int cmd,
+               unsigned long arg)
+{
+       return raw_ioctl(file, cmd, arg);
+}
+
+#else /* HAVE_COMPAT_IOCTL */
 
 /*
  * Brain-dead ioctl compatibility for 2.6.10 and earlier.
@@ -488,6 +499,7 @@ long comedi_compat_ioctl_(struct file *file, unsigned int cmd,
  * device because it registered the cmd code first.  Chaos ensues.
  */
 
+/* Handler for all 32-bit ioctl codes registered by this driver. */
 static int mapped_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg,
                struct file *file)
 {
@@ -497,7 +509,8 @@ static int mapped_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg,
        if (imajor(file->f_dentry->d_inode) != COMEDI_MAJOR) {
                return -ENOTTY;
        }
-       rc = (int)comedi_compat_ioctl_(file, cmd, arg);
+       rc = raw_ioctl(file, cmd, arg);
+       /* Do not return -ENOIOCTLCMD. */
        if (rc == -ENOIOCTLCMD) {
                rc = -ENOTTY;
        }
index 8f556ee868525098b48fc0a86bd2600f0035570f..198aea5476f9151a6460737bf4c70cf13ce53478 100644 (file)
@@ -34,9 +34,8 @@
 
 #ifdef HAVE_COMPAT_IOCTL
 
-extern long comedi_compat_ioctl_(struct file *file, unsigned int cmd,
+extern long comedi_compat_ioctl(struct file *file, unsigned int cmd,
                unsigned long arg);
-#define comedi_compat_ioctl comedi_compat_ioctl_
 #define comedi_register_ioctl32() do{}while(0)
 #define comedi_unregister_ioctl32() do{}while(0)