aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid
diff options
context:
space:
mode:
authorJiri Slaby <jirislaby@gmail.com>2008-05-16 05:49:22 -0400
committerJiri Kosina <jkosina@suse.cz>2008-10-14 17:50:50 -0400
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 41283fff5145..d9d1a5671d95 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -70,6 +70,18 @@ source "drivers/hid/usbhid/Kconfig"
70menu "Special HID drivers" 70menu "Special HID drivers"
71 depends on HID 71 depends on HID
72 72
73config HID_COMPAT
74 bool "Load all HID drivers on hid core load"
75 default y
76 ---help---
77 Compatible option for older userspace. If you have system without udev
78 support of module loading through aliases and also old
79 module-init-tools which can't handle hid bus, choose Y here. Otherwise
80 say N. If you say N and your userspace is old enough, the only
81 functionality you loose is modules autoloading.
82
83 If unsure, say Y.
84
73config HID_APPLE 85config HID_APPLE
74 tristate "Apple" 86 tristate "Apple"
75 default m 87 default m
diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile
index 4a14821ceefa..8e053eca4742 100644
--- a/drivers/hid/Makefile
+++ b/drivers/hid/Makefile
@@ -8,6 +8,10 @@ obj-$(CONFIG_HID) += hid.o
8hid-$(CONFIG_HID_DEBUG) += hid-debug.o 8hid-$(CONFIG_HID_DEBUG) += hid-debug.o
9hid-$(CONFIG_HIDRAW) += hidraw.o 9hid-$(CONFIG_HIDRAW) += hidraw.o
10 10
11ifdef CONFIG_HID_COMPAT
12obj-m += hid-dummy.o
13endif
14
11obj-$(CONFIG_HID_APPLE) += hid-apple.o 15obj-$(CONFIG_HID_APPLE) += hid-apple.o
12obj-$(CONFIG_HID_LOGITECH) += hid-logitech.o 16obj-$(CONFIG_HID_LOGITECH) += hid-logitech.o
13 17
diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c
index 5642e2c685fc..2a68661fcea8 100644
--- a/drivers/hid/hid-apple.c
+++ b/drivers/hid/hid-apple.c
@@ -477,3 +477,5 @@ static void apple_exit(void)
477module_init(apple_init); 477module_init(apple_init);
478module_exit(apple_exit); 478module_exit(apple_exit);
479MODULE_LICENSE("GPL"); 479MODULE_LICENSE("GPL");
480
481HID_COMPAT_LOAD_DRIVER(apple);
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 8e3c264c9b2b..397e1b2ffe5a 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)
1532} 1532}
1533EXPORT_SYMBOL_GPL(hid_unregister_driver); 1533EXPORT_SYMBOL_GPL(hid_unregister_driver);
1534 1534
1535#ifdef CONFIG_HID_COMPAT
1536static void hid_compat_load(struct work_struct *ws)
1537{
1538 request_module("hid-dummy");
1539}
1540static DECLARE_WORK(hid_compat_work, hid_compat_load);
1541#endif
1542
1535static int __init hid_init(void) 1543static int __init hid_init(void)
1536{ 1544{
1537 int ret; 1545 int ret;
@@ -1546,6 +1554,10 @@ static int __init hid_init(void)
1546 if (ret) 1554 if (ret)
1547 goto err_bus; 1555 goto err_bus;
1548 1556
1557#ifdef CONFIG_HID_COMPAT
1558 schedule_work(&hid_compat_work);
1559#endif
1560
1549 return 0; 1561 return 0;
1550err_bus: 1562err_bus:
1551 bus_unregister(&hid_bus_type); 1563 bus_unregister(&hid_bus_type);
diff --git a/drivers/hid/hid-dummy.c b/drivers/hid/hid-dummy.c
new file mode 100644
index 000000000000..b76c44efe1b8
--- /dev/null
+++ b/drivers/hid/hid-dummy.c
@@ -0,0 +1,18 @@
1#include <linux/autoconf.h>
2#include <linux/module.h>
3#include <linux/hid.h>
4
5static int __init hid_dummy_init(void)
6{
7#ifdef CONFIG_HID_APPLE_MODULE
8 HID_COMPAT_CALL_DRIVER(apple);
9#endif
10#ifdef CONFIG_HID_LOGITECH_MODULE
11 HID_COMPAT_CALL_DRIVER(logitech);
12#endif
13
14 return -EIO;
15}
16module_init(hid_dummy_init);
17
18MODULE_LICENSE("GPL");
diff --git a/drivers/hid/hid-logitech.c b/drivers/hid/hid-logitech.c
index 395e42ffb4d5..b2aaebe1ac05 100644
--- a/drivers/hid/hid-logitech.c
+++ b/drivers/hid/hid-logitech.c
@@ -310,3 +310,5 @@ static void lg_exit(void)
310module_init(lg_init); 310module_init(lg_init);
311module_exit(lg_exit); 311module_exit(lg_exit);
312MODULE_LICENSE("GPL"); 312MODULE_LICENSE("GPL");
313
314HID_COMPAT_LOAD_DRIVER(logitech);