aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiri Slaby <jirislaby@gmail.com>2008-05-19 09:50:01 -0400
committerJiri Kosina <jkosina@suse.cz>2008-10-14 17:50:47 -0400
commite8c84f9a5f06912c94c38961096c994da3890a2e (patch)
tree4b53131a3dc0ec39f82d33230df76764be9acd07
parent7591103c08abade60aeddb432ed0686ddd0de1c6 (diff)
modpost: add support for hid
Generate aliases for hid device modules to support autoloading. Signed-off-by: Jiri Slaby <jirislaby@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r--include/linux/hid.h1
-rw-r--r--include/linux/mod_devicetable.h10
-rw-r--r--scripts/mod/file2alias.c18
3 files changed, 29 insertions, 0 deletions
diff --git a/include/linux/hid.h b/include/linux/hid.h
index ac4e678a04ed..b7a17762a0b2 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -67,6 +67,7 @@
67#include <linux/types.h> 67#include <linux/types.h>
68#include <linux/slab.h> 68#include <linux/slab.h>
69#include <linux/list.h> 69#include <linux/list.h>
70#include <linux/mod_devicetable.h> /* hid_device_id */
70#include <linux/timer.h> 71#include <linux/timer.h>
71#include <linux/workqueue.h> 72#include <linux/workqueue.h>
72#include <linux/input.h> 73#include <linux/input.h>
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index 3481a7d5bc0a..d6a3f47e95cb 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -131,6 +131,16 @@ struct usb_device_id {
131#define USB_DEVICE_ID_MATCH_INT_SUBCLASS 0x0100 131#define USB_DEVICE_ID_MATCH_INT_SUBCLASS 0x0100
132#define USB_DEVICE_ID_MATCH_INT_PROTOCOL 0x0200 132#define USB_DEVICE_ID_MATCH_INT_PROTOCOL 0x0200
133 133
134#define HID_ANY_ID (~0)
135
136struct hid_device_id {
137 __u16 bus;
138 __u32 vendor;
139 __u32 product;
140 kernel_ulong_t driver_data
141 __attribute__((aligned(sizeof(kernel_ulong_t))));
142};
143
134/* s390 CCW devices */ 144/* s390 CCW devices */
135struct ccw_device_id { 145struct ccw_device_id {
136 __u16 match_flags; /* which fields to match against */ 146 __u16 match_flags; /* which fields to match against */
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index 473f94e56ead..d4dc222a74f3 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -206,6 +206,20 @@ static void do_usb_table(void *symval, unsigned long size,
206 do_usb_entry_multi(symval + i, mod); 206 do_usb_entry_multi(symval + i, mod);
207} 207}
208 208
209/* Looks like: hid:bNvNpN */
210static int do_hid_entry(const char *filename,
211 struct hid_device_id *id, char *alias)
212{
213 id->vendor = TO_NATIVE(id->vendor);
214 id->product = TO_NATIVE(id->product);
215
216 sprintf(alias, "hid:b%04X", id->bus);
217 ADD(alias, "v", id->vendor != HID_ANY_ID, id->vendor);
218 ADD(alias, "p", id->product != HID_ANY_ID, id->product);
219
220 return 1;
221}
222
209/* Looks like: ieee1394:venNmoNspNverN */ 223/* Looks like: ieee1394:venNmoNspNverN */
210static int do_ieee1394_entry(const char *filename, 224static int do_ieee1394_entry(const char *filename,
211 struct ieee1394_device_id *id, char *alias) 225 struct ieee1394_device_id *id, char *alias)
@@ -745,6 +759,10 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
745 else if (sym_is(symname, "__mod_usb_device_table")) 759 else if (sym_is(symname, "__mod_usb_device_table"))
746 /* special case to handle bcdDevice ranges */ 760 /* special case to handle bcdDevice ranges */
747 do_usb_table(symval, sym->st_size, mod); 761 do_usb_table(symval, sym->st_size, mod);
762 else if (sym_is(symname, "__mod_hid_device_table"))
763 do_table(symval, sym->st_size,
764 sizeof(struct hid_device_id), "hid",
765 do_hid_entry, mod);
748 else if (sym_is(symname, "__mod_ieee1394_device_table")) 766 else if (sym_is(symname, "__mod_ieee1394_device_table"))
749 do_table(symval, sym->st_size, 767 do_table(symval, sym->st_size,
750 sizeof(struct ieee1394_device_id), "ieee1394", 768 sizeof(struct ieee1394_device_id), "ieee1394",