summaryrefslogtreecommitdiffstats
path: root/drivers/macintosh/mac_hid.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor_core@ameritech.net>2005-09-15 02:01:41 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2005-10-28 09:52:53 -0700
commitc7f7a569d9b4ea7c53ab6fcd1377895312d8372b (patch)
tree554febf346b80a93c8dad5dff57fa60c4ea675b8 /drivers/macintosh/mac_hid.c
parentb7df3910c1298fee8ed7b9dfd2da74b85df5539c (diff)
downloadop-kernel-dev-c7f7a569d9b4ea7c53ab6fcd1377895312d8372b.zip
op-kernel-dev-c7f7a569d9b4ea7c53ab6fcd1377895312d8372b.tar.gz
[PATCH] Input: convert drivers/macintosh to dynamic input_dev allocation
Input: convert drivers/macntosh to dynamic input_dev allocation This is required for input_dev sysfs integration Signed-off-by: Dmitry Torokhov <dtor@mail.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/macintosh/mac_hid.c')
-rw-r--r--drivers/macintosh/mac_hid.c40
1 files changed, 22 insertions, 18 deletions
diff --git a/drivers/macintosh/mac_hid.c b/drivers/macintosh/mac_hid.c
index 5ad3a5a..a666361 100644
--- a/drivers/macintosh/mac_hid.c
+++ b/drivers/macintosh/mac_hid.c
@@ -16,8 +16,8 @@
#include <linux/module.h>
-static struct input_dev emumousebtn;
-static void emumousebtn_input_register(void);
+static struct input_dev *emumousebtn;
+static int emumousebtn_input_register(void);
static int mouse_emulate_buttons = 0;
static int mouse_button2_keycode = KEY_RIGHTCTRL; /* right control key */
static int mouse_button3_keycode = KEY_RIGHTALT; /* right option key */
@@ -90,10 +90,10 @@ int mac_hid_mouse_emulate_buttons(int caller, unsigned int keycode, int down)
&& (keycode == mouse_button2_keycode
|| keycode == mouse_button3_keycode)) {
if (mouse_emulate_buttons == 1) {
- input_report_key(&emumousebtn,
+ input_report_key(emumousebtn,
keycode == mouse_button2_keycode ? BTN_MIDDLE : BTN_RIGHT,
down);
- input_sync(&emumousebtn);
+ input_sync(emumousebtn);
return 1;
}
mouse_last_keycode = down ? keycode : 0;
@@ -105,30 +105,34 @@ int mac_hid_mouse_emulate_buttons(int caller, unsigned int keycode, int down)
EXPORT_SYMBOL(mac_hid_mouse_emulate_buttons);
-static void emumousebtn_input_register(void)
+static int emumousebtn_input_register(void)
{
- emumousebtn.name = "Macintosh mouse button emulation";
+ emumousebtn = input_allocate_device();
+ if (!emumousebtn)
+ return -ENOMEM;
- init_input_dev(&emumousebtn);
+ emumousebtn->name = "Macintosh mouse button emulation";
+ emumousebtn->id.bustype = BUS_ADB;
+ emumousebtn->id.vendor = 0x0001;
+ emumousebtn->id.product = 0x0001;
+ emumousebtn->id.version = 0x0100;
- emumousebtn.evbit[0] = BIT(EV_KEY) | BIT(EV_REL);
- emumousebtn.keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT);
- emumousebtn.relbit[0] = BIT(REL_X) | BIT(REL_Y);
+ emumousebtn->evbit[0] = BIT(EV_KEY) | BIT(EV_REL);
+ emumousebtn->keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT);
+ emumousebtn->relbit[0] = BIT(REL_X) | BIT(REL_Y);
- emumousebtn.id.bustype = BUS_ADB;
- emumousebtn.id.vendor = 0x0001;
- emumousebtn.id.product = 0x0001;
- emumousebtn.id.version = 0x0100;
+ input_register_device(emumousebtn);
- input_register_device(&emumousebtn);
-
- printk(KERN_INFO "input: Macintosh mouse button emulation\n");
+ return 0;
}
int __init mac_hid_init(void)
{
+ int err;
- emumousebtn_input_register();
+ err = emumousebtn_input_register();
+ if (err)
+ return err;
#if defined(CONFIG_SYSCTL)
mac_hid_sysctl_header = register_sysctl_table(mac_hid_root_dir, 1);
OpenPOWER on IntegriCloud