From: Jarod Wilson Date: Sat, 9 Oct 2010 18:07:06 +0000 (-0300) Subject: [media] lirc: wire up .compat_ioctl to main ioctl handler X-Git-Tag: v2.6.37-rc1~64^2~207 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8be292cc035ebc3422f08e84682626dd8ed8334b;p=profile%2Fivi%2Fkernel-adaptation-intel-automotive.git [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: Jarod Wilson Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/IR/ir-lirc-codec.c b/drivers/media/IR/ir-lirc-codec.c index c6d5b3e..20ac9a4 100644 --- a/drivers/media/IR/ir-lirc-codec.c +++ b/drivers/media/IR/ir-lirc-codec.c @@ -231,6 +231,9 @@ static struct file_operations lirc_fops = { .owner = THIS_MODULE, .write = ir_lirc_transmit_ir, .unlocked_ioctl = ir_lirc_ioctl, +#ifdef CONFIG_COMPAT + .compat_ioctl = ir_lirc_ioctl, +#endif .read = lirc_dev_fop_read, .poll = lirc_dev_fop_poll, .open = lirc_dev_fop_open, diff --git a/drivers/media/IR/lirc_dev.c b/drivers/media/IR/lirc_dev.c index e4e4d99..c20cfd1 100644 --- a/drivers/media/IR/lirc_dev.c +++ b/drivers/media/IR/lirc_dev.c @@ -161,6 +161,9 @@ static struct file_operations fops = { .write = lirc_dev_fop_write, .poll = lirc_dev_fop_poll, .unlocked_ioctl = lirc_dev_fop_ioctl, +#ifdef CONFIG_COMPAT + .compat_ioctl = lirc_dev_fop_ioctl, +#endif .open = lirc_dev_fop_open, .release = lirc_dev_fop_close, }; @@ -528,6 +531,11 @@ long lirc_dev_fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg) int result = 0; 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", ir->d.name, ir->d.minor, cmd); diff --git a/drivers/staging/lirc/lirc_it87.c b/drivers/staging/lirc/lirc_it87.c index 7d1b427..bd5006c 100644 --- a/drivers/staging/lirc/lirc_it87.c +++ b/drivers/staging/lirc/lirc_it87.c @@ -339,6 +339,9 @@ static const struct file_operations lirc_fops = { .write = lirc_write, .poll = lirc_poll, .unlocked_ioctl = lirc_ioctl, +#ifdef CONFIG_COMPAT + .compat_ioctl = lirc_ioctl, +#endif .open = lirc_open, .release = lirc_close, }; diff --git a/drivers/staging/lirc/lirc_parallel.c b/drivers/staging/lirc/lirc_parallel.c index be3d60d..b8cce87 100644 --- a/drivers/staging/lirc/lirc_parallel.c +++ b/drivers/staging/lirc/lirc_parallel.c @@ -546,6 +546,9 @@ static const struct file_operations lirc_fops = { .write = lirc_write, .poll = lirc_poll, .unlocked_ioctl = lirc_ioctl, +#ifdef CONFIG_COMPAT + .compat_ioctl = lirc_ioctl, +#endif .open = lirc_open, .release = lirc_close }; diff --git a/drivers/staging/lirc/lirc_serial.c b/drivers/staging/lirc/lirc_serial.c index 02906b4..05a9bf3 100644 --- a/drivers/staging/lirc/lirc_serial.c +++ b/drivers/staging/lirc/lirc_serial.c @@ -1053,6 +1053,9 @@ static const struct file_operations lirc_fops = { .owner = THIS_MODULE, .write = lirc_write, .unlocked_ioctl = lirc_ioctl, +#ifdef CONFIG_COMPAT + .compat_ioctl = lirc_ioctl, +#endif .read = lirc_dev_fop_read, .poll = lirc_dev_fop_poll, .open = lirc_dev_fop_open, diff --git a/drivers/staging/lirc/lirc_sir.c b/drivers/staging/lirc/lirc_sir.c index 10354f9..c4cb3aa 100644 --- a/drivers/staging/lirc/lirc_sir.c +++ b/drivers/staging/lirc/lirc_sir.c @@ -456,6 +456,9 @@ static const struct file_operations lirc_fops = { .write = lirc_write, .poll = lirc_poll, .unlocked_ioctl = lirc_ioctl, +#ifdef CONFIG_COMPAT + .compat_ioctl = lirc_ioctl, +#endif .open = lirc_dev_fop_open, .release = lirc_dev_fop_close, }; diff --git a/drivers/staging/lirc/lirc_zilog.c b/drivers/staging/lirc/lirc_zilog.c index 100caab1..d920644 100644 --- a/drivers/staging/lirc/lirc_zilog.c +++ b/drivers/staging/lirc/lirc_zilog.c @@ -1139,6 +1139,9 @@ static const struct file_operations lirc_fops = { .write = write, .poll = poll, .unlocked_ioctl = ioctl, +#ifdef CONFIG_COMPAT + .compat_ioctl = ioctl, +#endif .open = open, .release = close };