X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fhid%2Fhid-core.c;h=f43d6d3cf2fa2429d5689bbe05e87cf0f99358e0;hb=625f694936cbbdee98e6cc65f72724a7660e7946;hp=538bf28e4dd5233d84341fc45b25f59b9cc9c6e2;hpb=377e10fbb4ef219f540d06796e9fb0d3ec35a58f;p=linux-2.6 diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 538bf28e4d..f43d6d3cf2 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c @@ -97,7 +97,7 @@ static struct hid_field *hid_register_field(struct hid_report *report, unsigned field->index = report->maxfield++; report->field[field->index] = field; field->usage = (struct hid_usage *)(field + 1); - field->value = (unsigned *)(field->usage + usages); + field->value = (s32 *)(field->usage + usages); field->report = report; return field; @@ -606,7 +606,7 @@ static u8 *fetch_item(__u8 *start, __u8 *end, struct hid_item *item) case 2: if ((end - start) < 2) return NULL; - item->data.u16 = le16_to_cpu(get_unaligned((__le16*)start)); + item->data.u16 = get_unaligned_le16(start); start = (__u8 *)((__le16 *)start + 1); return start; @@ -614,7 +614,7 @@ static u8 *fetch_item(__u8 *start, __u8 *end, struct hid_item *item) item->size++; if ((end - start) < 4) return NULL; - item->data.u32 = le32_to_cpu(get_unaligned((__le32*)start)); + item->data.u32 = get_unaligned_le32(start); start = (__u8 *)((__le32 *)start + 1); return start; } @@ -765,7 +765,7 @@ static __inline__ __u32 extract(__u8 *report, unsigned offset, unsigned n) report += offset >> 3; /* adjust byte index */ offset &= 7; /* now only need bit offset into one byte */ - x = le64_to_cpu(get_unaligned((__le64 *) report)); + x = get_unaligned_le64(report); x = (x >> offset) & ((1ULL << n) - 1); /* extract bit field */ return (u32) x; } @@ -830,7 +830,8 @@ static void hid_process_event(struct hid_device *hid, struct hid_field *field, s * reporting to the layer). */ -void hid_input_field(struct hid_device *hid, struct hid_field *field, __u8 *data, int interrupt) +static void hid_input_field(struct hid_device *hid, struct hid_field *field, + __u8 *data, int interrupt) { unsigned n; unsigned count = field->report_count; @@ -876,7 +877,6 @@ void hid_input_field(struct hid_device *hid, struct hid_field *field, __u8 *data exit: kfree(value); } -EXPORT_SYMBOL_GPL(hid_input_field); /* * Output the field into the report. @@ -988,8 +988,13 @@ int hid_input_report(struct hid_device *hid, int type, u8 *data, int size, int i if ((hid->claimed & HID_CLAIMED_HIDDEV) && hid->hiddev_report_event) hid->hiddev_report_event(hid, report); - if (hid->claimed & HID_CLAIMED_HIDRAW) - hidraw_report_event(hid, data, size); + if (hid->claimed & HID_CLAIMED_HIDRAW) { + /* numbered reports need to be passed with the report num */ + if (report_enum->numbered) + hidraw_report_event(hid, data - 1, size + 1); + else + hidraw_report_event(hid, data, size); + } for (n = 0; n < report->maxfield; n++) hid_input_field(hid, report->field[n], data, interrupt);