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;
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.
* 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)
{
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;
}
#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)