aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid
diff options
context:
space:
mode:
authorBenjamin Tissoires <benjamin.tissoires@gmail.com>2012-11-14 10:59:16 -0500
committerJiri Kosina <jkosina@suse.cz>2012-11-15 04:08:14 -0500
commitf262d1fa2c651a5e2f92b6aee8779597631cd5d4 (patch)
treecdb954e3eae7d1aeb462617742ed13217354828f /drivers/hid
parent774638386826621c984ab6994439f474709cac5e (diff)
HID: add usage_index in struct hid_usage.
Currently, there is no way to know the index of the current field in the .input_mapping and .event callbacks when this field is inside an array of HID fields. This patch adds this index to the struct hid_usage so that this information is available to input_mapping and event callbacks. Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com> Acked-by: Jiri Kosina <jkosina@suse.cz> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid')
-rw-r--r--drivers/hid/hid-core.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index f5004e2ca0c5..b5974cd45968 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -92,6 +92,7 @@ EXPORT_SYMBOL_GPL(hid_register_report);
92static struct hid_field *hid_register_field(struct hid_report *report, unsigned usages, unsigned values) 92static struct hid_field *hid_register_field(struct hid_report *report, unsigned usages, unsigned values)
93{ 93{
94 struct hid_field *field; 94 struct hid_field *field;
95 int i;
95 96
96 if (report->maxfield == HID_MAX_FIELDS) { 97 if (report->maxfield == HID_MAX_FIELDS) {
97 hid_err(report->device, "too many fields in report\n"); 98 hid_err(report->device, "too many fields in report\n");
@@ -110,6 +111,9 @@ static struct hid_field *hid_register_field(struct hid_report *report, unsigned
110 field->value = (s32 *)(field->usage + usages); 111 field->value = (s32 *)(field->usage + usages);
111 field->report = report; 112 field->report = report;
112 113
114 for (i = 0; i < usages; i++)
115 field->usage[i].usage_index = i;
116
113 return field; 117 return field;
114} 118}
115 119