From: Jiri Slaby <jirislaby@gmail.com>
To: Jiri Kosina <jkosina@suse.cz>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
linux-input@vger.kernel.org, marcel@holtmann.org,
linux-kernel@vger.kernel.org, anssi.hannula@gmail.com,
Jiri Slaby <jirislaby@gmail.com>
Subject: [PATCH v2] modpost: add support for hid
Date: Mon, 19 May 2008 15:50:01 +0200 [thread overview]
Message-ID: <1211205001-11888-1-git-send-email-jirislaby@gmail.com> (raw)
In-Reply-To: <1210931362-18422-1-git-send-email-jirislaby@gmail.com>
Generate aliases for hid device modules to support autoloading.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
---
include/linux/hid.h | 1 +
include/linux/mod_devicetable.h | 10 ++++++++++
scripts/mod/file2alias.c | 18 ++++++++++++++++++
3 files changed, 29 insertions(+), 0 deletions(-)
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 6fc10d1..8466292 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -69,6 +69,7 @@
#include <linux/types.h>
#include <linux/slab.h>
#include <linux/list.h>
+#include <linux/mod_devicetable.h> /* hid_device_id */
#include <linux/timer.h>
#include <linux/workqueue.h>
#include <linux/input.h>
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index d73ecea..3511694 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -131,6 +131,16 @@ struct usb_device_id {
#define USB_DEVICE_ID_MATCH_INT_SUBCLASS 0x0100
#define USB_DEVICE_ID_MATCH_INT_PROTOCOL 0x0200
+#define HID_ANY_ID (~0)
+
+struct hid_device_id {
+ __u16 bus;
+ __u32 vendor;
+ __u32 product;
+ kernel_ulong_t driver_data
+ __attribute__((aligned(sizeof(kernel_ulong_t))));
+};
+
/* s390 CCW devices */
struct ccw_device_id {
__u16 match_flags; /* which fields to match against */
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index cea4a79..383af1b 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,
do_usb_entry_multi(symval + i, mod);
}
+/* Looks like: hid:bNvNpN */
+static int do_hid_entry(const char *filename,
+ struct hid_device_id *id, char *alias)
+{
+ id->vendor = TO_NATIVE(id->vendor);
+ id->product = TO_NATIVE(id->product);
+
+ sprintf(alias, "hid:b%04X", id->bus);
+ ADD(alias, "v", id->vendor != HID_ANY_ID, id->vendor);
+ ADD(alias, "p", id->product != HID_ANY_ID, id->product);
+
+ return 1;
+}
+
/* Looks like: ieee1394:venNmoNspNverN */
static int do_ieee1394_entry(const char *filename,
struct ieee1394_device_id *id, char *alias)
@@ -668,6 +682,10 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
else if (sym_is(symname, "__mod_usb_device_table"))
/* special case to handle bcdDevice ranges */
do_usb_table(symval, sym->st_size, mod);
+ else if (sym_is(symname, "__mod_hid_device_table"))
+ do_table(symval, sym->st_size,
+ sizeof(struct hid_device_id), "hid",
+ do_hid_entry, mod);
else if (sym_is(symname, "__mod_ieee1394_device_table"))
do_table(symval, sym->st_size,
sizeof(struct ieee1394_device_id), "ieee1394",
--
1.5.4.5
next prev parent reply other threads:[~2008-05-19 13:50 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-16 9:49 [PATCH 01/10] modpost: add support for hid Jiri Slaby
2008-05-16 9:49 ` [PATCH 02/10] HID: make a bus from hid code Jiri Slaby
2008-05-16 9:49 ` [PATCH 03/10] HID: hid, make parsing event driven Jiri Slaby
2008-05-16 9:49 ` [PATCH 04/10] HID: move ids into separate file Jiri Slaby
2008-05-16 9:49 ` [PATCH 05/10] HID: move usage input mapping to hid.h Jiri Slaby
2008-05-16 9:49 ` [PATCH 06/10] HID: move logitech report quirks Jiri Slaby
2008-05-16 9:49 ` [PATCH 07/10] HID: move ignore quirks Jiri Slaby
2008-05-16 9:49 ` [PATCH 08/10] HID: move apple quirks Jiri Slaby
2008-05-16 9:49 ` [PATCH 09/10] HID: add compat support Jiri Slaby
2008-06-04 8:55 ` Jiri Kosina
2008-06-04 9:00 ` Jiri Slaby
2009-01-24 5:55 ` Jaswinder Singh Rajput
2009-01-25 13:03 ` Jiri Slaby
2009-01-25 16:57 ` Jiri Kosina
2009-01-25 17:11 ` Jaswinder Singh Rajput
2008-06-04 14:13 ` [PATCH 08/10] HID: move apple quirks Jiri Kosina
2008-06-09 10:40 ` Jiri Slaby
2008-06-04 12:16 ` [PATCH 06/10] HID: move logitech report quirks Jiri Kosina
2008-06-09 10:29 ` Jiri Slaby
2008-06-16 10:15 ` Jiri Kosina
2008-06-04 13:21 ` Jiri Kosina
2008-06-09 10:33 ` Jiri Slaby
2008-06-11 14:13 ` Jiri Kosina
2008-06-11 15:39 ` Oliver Neukum
2008-06-11 18:35 ` Jiri Slaby
2008-06-11 18:23 ` Anssi Hannula
2008-05-19 13:36 ` [PATCH 01/10] modpost: add support for hid Jiri Kosina
2008-05-19 13:38 ` Jiri Slaby
2008-05-19 13:50 ` Jiri Slaby [this message]
2008-06-05 9:26 ` Jiri Kosina
2008-06-09 10:41 ` Jiri Slaby
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1211205001-11888-1-git-send-email-jirislaby@gmail.com \
--to=jirislaby@gmail.com \
--cc=anssi.hannula@gmail.com \
--cc=dmitry.torokhov@gmail.com \
--cc=jkosina@suse.cz \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marcel@holtmann.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).