Commit c105068f authored by Harvey Harrison's avatar Harvey Harrison Committed by Linus Torvalds

hid-core: use get_unaligned_* helpers

Signed-off-by: default avatarHarvey Harrison <harvey.harrison@gmail.com>
Acked-by: default avatarJiri Kosina <jkosina@suse.cz>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent f885f8d1
...@@ -606,7 +606,7 @@ static u8 *fetch_item(__u8 *start, __u8 *end, struct hid_item *item) ...@@ -606,7 +606,7 @@ static u8 *fetch_item(__u8 *start, __u8 *end, struct hid_item *item)
case 2: case 2:
if ((end - start) < 2) if ((end - start) < 2)
return NULL; return NULL;
item->data.u16 = le16_to_cpu(get_unaligned((__le16*)start)); item->data.u16 = get_unaligned_le16(start);
start = (__u8 *)((__le16 *)start + 1); start = (__u8 *)((__le16 *)start + 1);
return start; return start;
...@@ -614,7 +614,7 @@ static u8 *fetch_item(__u8 *start, __u8 *end, struct hid_item *item) ...@@ -614,7 +614,7 @@ static u8 *fetch_item(__u8 *start, __u8 *end, struct hid_item *item)
item->size++; item->size++;
if ((end - start) < 4) if ((end - start) < 4)
return NULL; return NULL;
item->data.u32 = le32_to_cpu(get_unaligned((__le32*)start)); item->data.u32 = get_unaligned_le32(start);
start = (__u8 *)((__le32 *)start + 1); start = (__u8 *)((__le32 *)start + 1);
return start; return start;
} }
...@@ -765,7 +765,7 @@ static __inline__ __u32 extract(__u8 *report, unsigned offset, unsigned n) ...@@ -765,7 +765,7 @@ static __inline__ __u32 extract(__u8 *report, unsigned offset, unsigned n)
report += offset >> 3; /* adjust byte index */ report += offset >> 3; /* adjust byte index */
offset &= 7; /* now only need bit offset into one byte */ 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 */ x = (x >> offset) & ((1ULL << n) - 1); /* extract bit field */
return (u32) x; return (u32) x;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment