[media] lirc: wire up .compat_ioctl to main ioctl handler
authorJarod Wilson <jarod@redhat.com>
Sat, 9 Oct 2010 18:07:06 +0000 (15:07 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Thu, 21 Oct 2010 03:18:36 +0000 (01:18 -0200)
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 <jarod@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/IR/ir-lirc-codec.c
drivers/media/IR/lirc_dev.c
drivers/staging/lirc/lirc_it87.c
drivers/staging/lirc/lirc_parallel.c
drivers/staging/lirc/lirc_serial.c
drivers/staging/lirc/lirc_sir.c
drivers/staging/lirc/lirc_zilog.c

index c6d5b3eb13256b141c5954d3524e790d54b6349a..20ac9a4ce522c8fa620eda2478c740584308f6b7 100644 (file)
@@ -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,
index e4e4d99725e6b30d418a2c720777740507436996..c20cfd1d5557f9353799a435be49c0ccd9932970 100644 (file)
@@ -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);
 
index 7d1b42735697b4fef019efff8186e727ea80a839..bd5006c8fcaaca59d26b33f9a490e020bcf398b4 100644 (file)
@@ -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,
 };
index be3d60d9a498d6e837921bd46cf222df089041b0..b8cce87c70329633f8842a02429363e50e28dc2e 100644 (file)
@@ -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
 };
index 02906b432234bd5f5eb83dd7fb098b6b895deddb..05a9bf3980ab329f384562f44fcc82df5fa6fa23 100644 (file)
@@ -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,
index 10354f9a380459dd72baebc1c6b32535ef65c993..c4cb3aa842db4c2a6bbe2ec53a003f82d0ac91e0 100644 (file)
@@ -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,
 };
index 100caab104518430da1b402cff9b1bf16433e192..d920644985235e452a51ffbee891a3946171837b 100644 (file)
@@ -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
 };