comedi: get rid of indirection via translated_ioctl()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
e0d0bf8a28
commit
5c6a8747e0
|
@ -2871,16 +2871,6 @@ struct comedi32_insnlist_struct {
|
||||||
compat_uptr_t insns; /* 32-bit 'struct comedi_insn *' */
|
compat_uptr_t insns; /* 32-bit 'struct comedi_insn *' */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Handle translated ioctl. */
|
|
||||||
static int translated_ioctl(struct file *file, unsigned int cmd,
|
|
||||||
unsigned long arg)
|
|
||||||
{
|
|
||||||
if (file->f_op->unlocked_ioctl)
|
|
||||||
return file->f_op->unlocked_ioctl(file, cmd, arg);
|
|
||||||
|
|
||||||
return -ENOTTY;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Handle 32-bit COMEDI_CHANINFO ioctl. */
|
/* Handle 32-bit COMEDI_CHANINFO ioctl. */
|
||||||
static int compat_chaninfo(struct file *file, unsigned long arg)
|
static int compat_chaninfo(struct file *file, unsigned long arg)
|
||||||
{
|
{
|
||||||
|
@ -2912,7 +2902,7 @@ static int compat_chaninfo(struct file *file, unsigned long arg)
|
||||||
if (err)
|
if (err)
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
return translated_ioctl(file, COMEDI_CHANINFO, (unsigned long)chaninfo);
|
return comedi_unlocked_ioctl(file, COMEDI_CHANINFO, (unsigned long)chaninfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Handle 32-bit COMEDI_RANGEINFO ioctl. */
|
/* Handle 32-bit COMEDI_RANGEINFO ioctl. */
|
||||||
|
@ -2942,7 +2932,7 @@ static int compat_rangeinfo(struct file *file, unsigned long arg)
|
||||||
if (err)
|
if (err)
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
return translated_ioctl(file, COMEDI_RANGEINFO,
|
return comedi_unlocked_ioctl(file, COMEDI_RANGEINFO,
|
||||||
(unsigned long)rangeinfo);
|
(unsigned long)rangeinfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3063,7 +3053,7 @@ static int compat_cmd(struct file *file, unsigned long arg)
|
||||||
if (rc)
|
if (rc)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
rc = translated_ioctl(file, COMEDI_CMD, (unsigned long)cmd);
|
rc = comedi_unlocked_ioctl(file, COMEDI_CMD, (unsigned long)cmd);
|
||||||
if (rc == -EAGAIN) {
|
if (rc == -EAGAIN) {
|
||||||
/* Special case: copy cmd back to user. */
|
/* Special case: copy cmd back to user. */
|
||||||
err = put_compat_cmd(cmd32, cmd);
|
err = put_compat_cmd(cmd32, cmd);
|
||||||
|
@ -3088,7 +3078,7 @@ static int compat_cmdtest(struct file *file, unsigned long arg)
|
||||||
if (rc)
|
if (rc)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
rc = translated_ioctl(file, COMEDI_CMDTEST, (unsigned long)cmd);
|
rc = comedi_unlocked_ioctl(file, COMEDI_CMDTEST, (unsigned long)cmd);
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
|
@ -3174,7 +3164,7 @@ static int compat_insnlist(struct file *file, unsigned long arg)
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
return translated_ioctl(file, COMEDI_INSNLIST,
|
return comedi_unlocked_ioctl(file, COMEDI_INSNLIST,
|
||||||
(unsigned long)&s->insnlist);
|
(unsigned long)&s->insnlist);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3192,7 +3182,7 @@ static int compat_insn(struct file *file, unsigned long arg)
|
||||||
if (rc)
|
if (rc)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
return translated_ioctl(file, COMEDI_INSN, (unsigned long)insn);
|
return comedi_unlocked_ioctl(file, COMEDI_INSN, (unsigned long)insn);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -3212,7 +3202,7 @@ static long comedi_compat_ioctl(struct file *file, unsigned int cmd, unsigned lo
|
||||||
case COMEDI_BUFINFO:
|
case COMEDI_BUFINFO:
|
||||||
/* Just need to translate the pointer argument. */
|
/* Just need to translate the pointer argument. */
|
||||||
arg = (unsigned long)compat_ptr(arg);
|
arg = (unsigned long)compat_ptr(arg);
|
||||||
rc = translated_ioctl(file, cmd, arg);
|
rc = comedi_unlocked_ioctl(file, cmd, arg);
|
||||||
break;
|
break;
|
||||||
case COMEDI_LOCK:
|
case COMEDI_LOCK:
|
||||||
case COMEDI_UNLOCK:
|
case COMEDI_UNLOCK:
|
||||||
|
@ -3221,7 +3211,7 @@ static long comedi_compat_ioctl(struct file *file, unsigned int cmd, unsigned lo
|
||||||
case COMEDI_SETRSUBD:
|
case COMEDI_SETRSUBD:
|
||||||
case COMEDI_SETWSUBD:
|
case COMEDI_SETWSUBD:
|
||||||
/* No translation needed. */
|
/* No translation needed. */
|
||||||
rc = translated_ioctl(file, cmd, arg);
|
rc = comedi_unlocked_ioctl(file, cmd, arg);
|
||||||
break;
|
break;
|
||||||
case COMEDI32_CHANINFO:
|
case COMEDI32_CHANINFO:
|
||||||
rc = compat_chaninfo(file, arg);
|
rc = compat_chaninfo(file, arg);
|
||||||
|
|
Loading…
Reference in New Issue