All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philip Langdale <philipl@overt.org>
To: Jiri Kosina <jkosina@suse.cz>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] hiddev: Add 32bit ioctl compatibilty
Date: Fri, 12 Oct 2007 16:51:00 -0700	[thread overview]
Message-ID: <47100864.2090208@overt.org> (raw)

The hiddev driver currently lacks 32bit ioctl compatibility, so
if you're running with a 64bit kernel and 32bit userspace, it won't
work.

I'm pretty sure that the only thing missing is a compat_ioctl
implementation as all structs have fixed size fields.

With this change I can use revoco to configure my MX Revolution mouse.

Signed-off-by: Philip Langdale <philipl@overt.org>

--- linux-2.6.23/drivers/hid/usbhid/hiddev.c	2007-10-09 13:31:38.000000000 -0700
+++ linux-phil/drivers/hid/usbhid/hiddev.c	2007-10-12 15:02:15.000000000 -0700
@@ -34,6 +34,7 @@
 #include <linux/usb.h>
 #include <linux/hid.h>
 #include <linux/hiddev.h>
+#include <linux/compat.h>
 #include "usbhid.h"

 #ifdef CONFIG_USB_DYNAMIC_MINORS
@@ -738,6 +738,14 @@
 	return -EINVAL;
 }

+#ifdef CONFIG_COMPAT
+static long hiddev_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
+{
+	struct inode *inode = file->f_path.dentry->d_inode;
+	return hiddev_ioctl(inode, file, cmd, compat_ptr(arg));
+}
+#endif
+
 static const struct file_operations hiddev_fops = {
 	.owner =	THIS_MODULE,
 	.read =		hiddev_read,
@@ -747,6 +754,9 @@
 	.release =	hiddev_release,
 	.ioctl =	hiddev_ioctl,
 	.fasync =	hiddev_fasync,
+#ifdef CONFIG_COMPAT
+	.compat_ioctl	= hiddev_compat_ioctl,
+#endif
 };

 static struct usb_class_driver hiddev_class = {

             reply	other threads:[~2007-10-12 23:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-12 23:51 Philip Langdale [this message]
2007-10-13  0:02 ` [PATCH] hiddev: Add 32bit ioctl compatibilty Al Viro
2007-10-13 17:42   ` Philip Langdale
2007-10-20 15:50   ` [PATCH] compat_ioctl: introduce generic_compat_ioctl helper Arnd Bergmann
2007-10-20 16:03     ` [PATCH] hiddev: simplify 32bit ioctl compatibilty Arnd Bergmann
2007-10-20 16:11     ` [PATCH] compat_ioctl: introduce generic_compat_ioctl helper Christoph Hellwig
2007-10-20 16:23       ` Arnd Bergmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47100864.2090208@overt.org \
    --to=philipl@overt.org \
    --cc=jkosina@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.