summaryrefslogtreecommitdiffstats
path: root/drivers/macintosh/mac_hid.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2010-01-30 01:44:20 -0800
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2010-01-30 01:48:03 -0800
commit429722e19dff319aa87ee552beadee71d41a3655 (patch)
treeb0d760de09f128ae674b0f318386e5cefd0758c3 /drivers/macintosh/mac_hid.c
parent99b089c3c38a83ebaeb1cc4584ddcde841626467 (diff)
downloadblackbird-op-linux-429722e19dff319aa87ee552beadee71d41a3655.tar.gz
blackbird-op-linux-429722e19dff319aa87ee552beadee71d41a3655.zip
Input: Mac button emulation - allow compiling as a module
Not all systems require Mac-style button emulation, however distributions enable it by default so it is readily available. Allow compiling it as a module so it can be loaded only on systems that actually require it. Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/macintosh/mac_hid.c')
-rw-r--r--drivers/macintosh/mac_hid.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/macintosh/mac_hid.c b/drivers/macintosh/mac_hid.c
index 0b210a90aef5..e943d2a29253 100644
--- a/drivers/macintosh/mac_hid.c
+++ b/drivers/macintosh/mac_hid.c
@@ -14,6 +14,8 @@
#include <linux/input.h>
#include <linux/module.h>
+MODULE_LICENSE("GPL");
+
static int mouse_emulate_buttons;
static int mouse_button2_keycode = KEY_RIGHTCTRL; /* right control key */
static int mouse_button3_keycode = KEY_RIGHTALT; /* right option key */
@@ -252,7 +254,6 @@ static ctl_table mac_hid_root_dir[] = {
static struct ctl_table_header *mac_hid_sysctl_header;
-
static int __init mac_hid_init(void)
{
mac_hid_sysctl_header = register_sysctl_table(mac_hid_root_dir);
@@ -261,5 +262,13 @@ static int __init mac_hid_init(void)
return 0;
}
+module_init(mac_hid_init);
-device_initcall(mac_hid_init);
+static void __exit mac_hid_exit(void)
+{
+ unregister_sysctl_table(mac_hid_sysctl_header);
+
+ if (mouse_emulate_buttons)
+ mac_hid_stop_emulation();
+}
+module_exit(mac_hid_exit);
OpenPOWER on IntegriCloud