aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAl Viro <viro@ftp.linux.org.uk>2007-03-14 05:19:50 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-03-14 18:27:50 -0400
commitb87496aa493a540b9c084b16b73f915705ebdbcc (patch)
tree01a34ba4f00f8ad903f8e19dd309bf06a2778d06 /drivers
parent82c05a13c9e0d782941f975eabf6c5a7928cc4d9 (diff)
[PATCH] hid-core endianness annotations
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/hid/hid-core.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index f4ee1afe488f..9c8157fb6d75 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -753,8 +753,7 @@ static __inline__ __u32 extract(__u8 *report, unsigned offset, unsigned n)
753 753
754 report += offset >> 3; /* adjust byte index */ 754 report += offset >> 3; /* adjust byte index */
755 offset &= 7; /* now only need bit offset into one byte */ 755 offset &= 7; /* now only need bit offset into one byte */
756 x = get_unaligned((u64 *) report); 756 x = le64_to_cpu(get_unaligned((__le64 *) report));
757 x = le64_to_cpu(x);
758 x = (x >> offset) & ((1ULL << n) - 1); /* extract bit field */ 757 x = (x >> offset) & ((1ULL << n) - 1); /* extract bit field */
759 return (u32) x; 758 return (u32) x;
760} 759}
@@ -769,7 +768,7 @@ static __inline__ __u32 extract(__u8 *report, unsigned offset, unsigned n)
769 */ 768 */
770static __inline__ void implement(__u8 *report, unsigned offset, unsigned n, __u32 value) 769static __inline__ void implement(__u8 *report, unsigned offset, unsigned n, __u32 value)
771{ 770{
772 u64 x; 771 __le64 x;
773 u64 m = (1ULL << n) - 1; 772 u64 m = (1ULL << n) - 1;
774 773
775 WARN_ON(n > 32); 774 WARN_ON(n > 32);
@@ -780,10 +779,10 @@ static __inline__ void implement(__u8 *report, unsigned offset, unsigned n, __u3
780 report += offset >> 3; 779 report += offset >> 3;
781 offset &= 7; 780 offset &= 7;
782 781
783 x = get_unaligned((u64 *)report); 782 x = get_unaligned((__le64 *)report);
784 x &= cpu_to_le64(~(m << offset)); 783 x &= cpu_to_le64(~(m << offset));
785 x |= cpu_to_le64(((u64) value) << offset); 784 x |= cpu_to_le64(((u64) value) << offset);
786 put_unaligned(x, (u64 *) report); 785 put_unaligned(x, (__le64 *) report);
787} 786}
788 787
789/* 788/*