提交 8be292cc 编写于 作者: J Jarod Wilson 提交者: Mauro Carvalho Chehab

[media] lirc: wire up .compat_ioctl to main ioctl handler

As pointed out (and tested) by Joris van Rantwijk, we do actually need
to wire up .compat_ioctl for 32-bit lirc userspace to work with 64-bit
lirc kernelspace. Do it. And add a check to make sure we get a valid
irctl in the ioctl handler.
Signed-off-by: NJarod Wilson <jarod@redhat.com>
Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
上级 a1266818
...@@ -231,6 +231,9 @@ static struct file_operations lirc_fops = { ...@@ -231,6 +231,9 @@ static struct file_operations lirc_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.write = ir_lirc_transmit_ir, .write = ir_lirc_transmit_ir,
.unlocked_ioctl = ir_lirc_ioctl, .unlocked_ioctl = ir_lirc_ioctl,
#ifdef CONFIG_COMPAT
.compat_ioctl = ir_lirc_ioctl,
#endif
.read = lirc_dev_fop_read, .read = lirc_dev_fop_read,
.poll = lirc_dev_fop_poll, .poll = lirc_dev_fop_poll,
.open = lirc_dev_fop_open, .open = lirc_dev_fop_open,
......
...@@ -161,6 +161,9 @@ static struct file_operations fops = { ...@@ -161,6 +161,9 @@ static struct file_operations fops = {
.write = lirc_dev_fop_write, .write = lirc_dev_fop_write,
.poll = lirc_dev_fop_poll, .poll = lirc_dev_fop_poll,
.unlocked_ioctl = lirc_dev_fop_ioctl, .unlocked_ioctl = lirc_dev_fop_ioctl,
#ifdef CONFIG_COMPAT
.compat_ioctl = lirc_dev_fop_ioctl,
#endif
.open = lirc_dev_fop_open, .open = lirc_dev_fop_open,
.release = lirc_dev_fop_close, .release = lirc_dev_fop_close,
}; };
...@@ -528,6 +531,11 @@ long lirc_dev_fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -528,6 +531,11 @@ long lirc_dev_fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
int result = 0; int result = 0;
struct irctl *ir = file->private_data; struct irctl *ir = file->private_data;
if (!ir) {
printk(KERN_ERR "lirc_dev: %s: no irctl found!\n", __func__);
return -ENODEV;
}
dev_dbg(ir->d.dev, LOGHEAD "ioctl called (0x%x)\n", dev_dbg(ir->d.dev, LOGHEAD "ioctl called (0x%x)\n",
ir->d.name, ir->d.minor, cmd); ir->d.name, ir->d.minor, cmd);
......
...@@ -339,6 +339,9 @@ static const struct file_operations lirc_fops = { ...@@ -339,6 +339,9 @@ static const struct file_operations lirc_fops = {
.write = lirc_write, .write = lirc_write,
.poll = lirc_poll, .poll = lirc_poll,
.unlocked_ioctl = lirc_ioctl, .unlocked_ioctl = lirc_ioctl,
#ifdef CONFIG_COMPAT
.compat_ioctl = lirc_ioctl,
#endif
.open = lirc_open, .open = lirc_open,
.release = lirc_close, .release = lirc_close,
}; };
......
...@@ -546,6 +546,9 @@ static const struct file_operations lirc_fops = { ...@@ -546,6 +546,9 @@ static const struct file_operations lirc_fops = {
.write = lirc_write, .write = lirc_write,
.poll = lirc_poll, .poll = lirc_poll,
.unlocked_ioctl = lirc_ioctl, .unlocked_ioctl = lirc_ioctl,
#ifdef CONFIG_COMPAT
.compat_ioctl = lirc_ioctl,
#endif
.open = lirc_open, .open = lirc_open,
.release = lirc_close .release = lirc_close
}; };
......
...@@ -1053,6 +1053,9 @@ static const struct file_operations lirc_fops = { ...@@ -1053,6 +1053,9 @@ static const struct file_operations lirc_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.write = lirc_write, .write = lirc_write,
.unlocked_ioctl = lirc_ioctl, .unlocked_ioctl = lirc_ioctl,
#ifdef CONFIG_COMPAT
.compat_ioctl = lirc_ioctl,
#endif
.read = lirc_dev_fop_read, .read = lirc_dev_fop_read,
.poll = lirc_dev_fop_poll, .poll = lirc_dev_fop_poll,
.open = lirc_dev_fop_open, .open = lirc_dev_fop_open,
......
...@@ -456,6 +456,9 @@ static const struct file_operations lirc_fops = { ...@@ -456,6 +456,9 @@ static const struct file_operations lirc_fops = {
.write = lirc_write, .write = lirc_write,
.poll = lirc_poll, .poll = lirc_poll,
.unlocked_ioctl = lirc_ioctl, .unlocked_ioctl = lirc_ioctl,
#ifdef CONFIG_COMPAT
.compat_ioctl = lirc_ioctl,
#endif
.open = lirc_dev_fop_open, .open = lirc_dev_fop_open,
.release = lirc_dev_fop_close, .release = lirc_dev_fop_close,
}; };
......
...@@ -1139,6 +1139,9 @@ static const struct file_operations lirc_fops = { ...@@ -1139,6 +1139,9 @@ static const struct file_operations lirc_fops = {
.write = write, .write = write,
.poll = poll, .poll = poll,
.unlocked_ioctl = ioctl, .unlocked_ioctl = ioctl,
#ifdef CONFIG_COMPAT
.compat_ioctl = ioctl,
#endif
.open = open, .open = open,
.release = close .release = close
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册