dect
/
linux-2.6
Archived
13
0
Fork 0

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>
This commit is contained in:
Matt Fleming 2012-02-28 13:37:25 +00:00 committed by H. Peter Anvin
parent 92f42c50f2
commit 24fa9a9d6d
2 changed files with 2 additions and 29 deletions

View File

@ -3,7 +3,7 @@
CC = $(CROSS_COMPILE)gcc
PTHREAD_LIBS = -lpthread
WARNINGS = -Wall -Wextra
CFLAGS = $(WARNINGS) -g $(PTHREAD_LIBS)
CFLAGS = $(WARNINGS) -g $(PTHREAD_LIBS) -I../include
all: testusb ffs-test
%: %.c

View File

@ -36,6 +36,7 @@
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <tools/le_byteshift.h>
#include "../../include/linux/usb/functionfs.h"
@ -47,34 +48,6 @@
#define le32_to_cpu(x) le32toh(x)
#define le16_to_cpu(x) le16toh(x)
static inline __u16 get_unaligned_le16(const void *_ptr)
{
const __u8 *ptr = _ptr;
return ptr[0] | (ptr[1] << 8);
}
static inline __u32 get_unaligned_le32(const void *_ptr)
{
const __u8 *ptr = _ptr;
return ptr[0] | (ptr[1] << 8) | (ptr[2] << 16) | (ptr[3] << 24);
}
static inline void put_unaligned_le16(__u16 val, void *_ptr)
{
__u8 *ptr = _ptr;
*ptr++ = val;
*ptr++ = val >> 8;
}
static inline void put_unaligned_le32(__u32 val, void *_ptr)
{
__u8 *ptr = _ptr;
*ptr++ = val;
*ptr++ = val >> 8;
*ptr++ = val >> 16;
*ptr++ = val >> 24;
}
/******************** Messages and Errors ***********************************/