aboutsummaryrefslogtreecommitdiff
path: root/drivers/hid
diff options
context:
space:
mode:
authorJiri Slaby <jirislaby@gmail.com>2008-05-16 11:49:22 +0200
committerJiri Kosina <jkosina@suse.cz>2008-10-14 23:50:50 +0200
commit02ae9a1a8bc1d08a8fd5f6a0b8bde400b0f891b9 (patch)
treea7584d1e9bcabdd22e63c12326e696c94d38dad8 /drivers/hid
parent8c19a51591d06f5226499972567f528cf6066bb7 (diff)
HID: add compat support
Add compat option to hid code to allow loading of all modules on systems which don't allow autoloading because of old userspace. Signed-off-by: Jiri Slaby <jirislaby@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid')
-rw-r--r--drivers/hid/Kconfig12
-rw-r--r--drivers/hid/Makefile4
-rw-r--r--drivers/hid/hid-apple.c2
-rw-r--r--drivers/hid/hid-core.c12
-rw-r--r--drivers/hid/hid-dummy.c18
-rw-r--r--drivers/hid/hid-logitech.c2
6 files changed, 50 insertions, 0 deletions
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index 41283fff514..d9d1a5671d9 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -70,6 +70,18 @@ source "drivers/hid/usbhid/Kconfig"
menu "Special HID drivers"
depends on HID
+config HID_COMPAT
+ bool "Load all HID drivers on hid core load"
+ default y
+ ---help---
+ Compatible option for older userspace. If you have system without udev
+ support of module loading through aliases and also old
+ module-init-tools which can't handle hid bus, choose Y here. Otherwise
+ say N. If you say N and your userspace is old enough, the only
+ functionality you loose is modules autoloading.
+
+ If unsure, say Y.
+
config HID_APPLE
tristate "Apple"
default m
diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile
index 4a14821ceef..8e053eca474 100644
--- a/drivers/hid/Makefile
+++ b/drivers/hid/Makefile
@@ -8,6 +8,10 @@ obj-$(CONFIG_HID) += hid.o
hid-$(CONFIG_HID_DEBUG) += hid-debug.o
hid-$(CONFIG_HIDRAW) += hidraw.o
+ifdef CONFIG_HID_COMPAT
+obj-m += hid-dummy.o
+endif
+
obj-$(CONFIG_HID_APPLE) += hid-apple.o
obj-$(CONFIG_HID_LOGITECH) += hid-logitech.o
diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c
index 5642e2c685f..2a68661fcea 100644
--- a/drivers/hid/hid-apple.c
+++ b/drivers/hid/hid-apple.c
@@ -477,3 +477,5 @@ static void apple_exit(void)
module_init(apple_init);
module_exit(apple_exit);
MODULE_LICENSE("GPL");
+
+HID_COMPAT_LOAD_DRIVER(apple);
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 8e3c264c9b2..397e1b2ffe5 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1532,6 +1532,14 @@ void hid_unregister_driver(struct hid_driver *hdrv)
}
EXPORT_SYMBOL_GPL(hid_unregister_driver);
+#ifdef CONFIG_HID_COMPAT
+static void hid_compat_load(struct work_struct *ws)
+{
+ request_module("hid-dummy");
+}
+static DECLARE_WORK(hid_compat_work, hid_compat_load);
+#endif
+
static int __init hid_init(void)
{
int ret;
@@ -1546,6 +1554,10 @@ static int __init hid_init(void)
if (ret)
goto err_bus;
+#ifdef CONFIG_HID_COMPAT
+ schedule_work(&hid_compat_work);
+#endif
+
return 0;
err_bus:
bus_unregister(&hid_bus_type);
diff --git a/drivers/hid/hid-dummy.c b/drivers/hid/hid-dummy.c
new file mode 100644
index 00000000000..b76c44efe1b
--- /dev/null
+++ b/drivers/hid/hid-dummy.c
@@ -0,0 +1,18 @@
+#include <linux/autoconf.h>
+#include <linux/module.h>
+#include <linux/hid.h>
+
+static int __init hid_dummy_init(void)
+{
+#ifdef CONFIG_HID_APPLE_MODULE
+ HID_COMPAT_CALL_DRIVER(apple);
+#endif
+#ifdef CONFIG_HID_LOGITECH_MODULE
+ HID_COMPAT_CALL_DRIVER(logitech);
+#endif
+
+ return -EIO;
+}
+module_init(hid_dummy_init);
+
+MODULE_LICENSE("GPL");
diff --git a/drivers/hid/hid-logitech.c b/drivers/hid/hid-logitech.c
index 395e42ffb4d..b2aaebe1ac0 100644
--- a/drivers/hid/hid-logitech.c
+++ b/drivers/hid/hid-logitech.c
@@ -310,3 +310,5 @@ static void lg_exit(void)
module_init(lg_init);
module_exit(lg_exit);
MODULE_LICENSE("GPL");
+
+HID_COMPAT_LOAD_DRIVER(logitech);