aboutsummaryrefslogtreecommitdiffstats
path: root/tools/usb/ffs-test.c
diff options
context:
space:
mode:
authorMatt Fleming <matt.fleming@intel.com>2012-02-28 08:37:25 -0500
committerH. Peter Anvin <hpa@zytor.com>2012-02-28 13:23:18 -0500
commit24fa9a9d6d70ef7ef7087dce472a8f43a9078da5 (patch)
treef18c93a77027649176327c9e5f66bca3783f6ca6 /tools/usb/ffs-test.c
parent92f42c50f227ad228f815a8f4eec872524dae3a5 (diff)
USB: ffs-test: Don't duplicate {get,put}_unaligned*() functions
Use the header file in tools/include instead of duplicating the endian functions. Cc: Davidlohr Bueso <dave@gnu.org> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Matt Fleming <matt.fleming@intel.com> Link: http://lkml.kernel.org/r/1330436245-24875-7-git-send-email-matt@console-pimps.org Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'tools/usb/ffs-test.c')
-rw-r--r--tools/usb/ffs-test.c29
1 files changed, 1 insertions, 28 deletions
diff --git a/tools/usb/ffs-test.c b/tools/usb/ffs-test.c
index b9c798631699..384f47a5727f 100644
--- a/tools/usb/ffs-test.c
+++ b/tools/usb/ffs-test.c
@@ -36,6 +36,7 @@
36#include <sys/stat.h> 36#include <sys/stat.h>
37#include <sys/types.h> 37#include <sys/types.h>
38#include <unistd.h> 38#include <unistd.h>
39#include <tools/le_byteshift.h>
39 40
40#include "../../include/linux/usb/functionfs.h" 41#include "../../include/linux/usb/functionfs.h"
41 42
@@ -47,34 +48,6 @@
47#define le32_to_cpu(x) le32toh(x) 48#define le32_to_cpu(x) le32toh(x)
48#define le16_to_cpu(x) le16toh(x) 49#define le16_to_cpu(x) le16toh(x)
49 50
50static inline __u16 get_unaligned_le16(const void *_ptr)
51{
52 const __u8 *ptr = _ptr;
53 return ptr[0] | (ptr[1] << 8);
54}
55
56static inline __u32 get_unaligned_le32(const void *_ptr)
57{
58 const __u8 *ptr = _ptr;
59 return ptr[0] | (ptr[1] << 8) | (ptr[2] << 16) | (ptr[3] << 24);
60}
61
62static inline void put_unaligned_le16(__u16 val, void *_ptr)
63{
64 __u8 *ptr = _ptr;
65 *ptr++ = val;
66 *ptr++ = val >> 8;
67}
68
69static inline void put_unaligned_le32(__u32 val, void *_ptr)
70{
71 __u8 *ptr = _ptr;
72 *ptr++ = val;
73 *ptr++ = val >> 8;
74 *ptr++ = val >> 16;
75 *ptr++ = val >> 24;
76}
77
78 51
79/******************** Messages and Errors ***********************************/ 52/******************** Messages and Errors ***********************************/
80 53