linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matt Fleming <matt@console-pimps.org>
To: "H. Peter Anvin" <hpa@zytor.com>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org,
	Matt Fleming <matt.fleming@intel.com>,
	Davidlohr Bueso <dave@gnu.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: [RFC][PATCH 6/6] USB: ffs-test: Don't duplicate {get,put}_unaligned*() functions
Date: Tue, 28 Feb 2012 13:37:25 +0000	[thread overview]
Message-ID: <1330436245-24875-7-git-send-email-matt@console-pimps.org> (raw)
In-Reply-To: <1330436245-24875-1-git-send-email-matt@console-pimps.org>

From: Matt Fleming <matt.fleming@intel.com>

Use the header file in tools/include instead of duplicating the endian
functions.

Cc: Davidlohr Bueso <dave@gnu.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
---
 tools/usb/Makefile   |    2 +-
 tools/usb/ffs-test.c |   29 +----------------------------
 2 files changed, 2 insertions(+), 29 deletions(-)

diff --git a/tools/usb/Makefile b/tools/usb/Makefile
index 8b704af..396d6c4 100644
--- a/tools/usb/Makefile
+++ b/tools/usb/Makefile
@@ -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
diff --git a/tools/usb/ffs-test.c b/tools/usb/ffs-test.c
index b9c7986..384f47a 100644
--- a/tools/usb/ffs-test.c
+++ b/tools/usb/ffs-test.c
@@ -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 ***********************************/
 
-- 
1.7.4.4


  parent reply	other threads:[~2012-02-28 13:37 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-28 13:37 [RFC][PATCH 0/6] Add endian functions to tools/include Matt Fleming
2012-02-28 13:37 ` [RFC][PATCH 1/6] tools/include: Add byteshift headers for endian access Matt Fleming
2012-02-28 19:23   ` [tip:x86/build] " tip-bot for Matt Fleming
2012-02-28 13:37 ` [RFC][PATCH 2/6] x86, relocs: Don't open code put_unaligned_le32() Matt Fleming
2012-02-28 19:23   ` [tip:x86/build] " tip-bot for Matt Fleming
2012-02-28 13:37 ` [RFC][PATCH 3/6] x86, mkpiggy: " Matt Fleming
2012-02-28 19:24   ` [tip:x86/build] " tip-bot for Matt Fleming
2012-02-28 13:37 ` [RFC][PATCH 4/6] x86, boot: Restrict CFLAGS for hostprogs Matt Fleming
2012-02-28 19:25   ` [tip:x86/build] " tip-bot for Matt Fleming
2012-03-22 21:26   ` [tip:x86/urgent] x86, boot: Correct " tip-bot for H. Peter Anvin
2012-02-28 13:37 ` [RFC][PATCH 5/6] x86, efi: Fix endian issues and unaligned accesses Matt Fleming
2012-02-28 19:26   ` [tip:x86/build] " tip-bot for Matt Fleming
2012-02-28 23:52   ` [RFC][PATCH 5/6] " Stephen Rothwell
2012-02-29  0:13     ` Stephen Rothwell
2012-02-29  0:28       ` Stephen Rothwell
2012-02-29  8:04         ` Stephen Rothwell
2012-02-29  7:49       ` [tip:x86/build] x86, tools: Remove unneeded header files from tools/build.c tip-bot for H. Peter Anvin
2012-02-29  7:50       ` [tip:x86/build] x86, build: Fix portability issues when cross-building tip-bot for H. Peter Anvin
2012-02-28 13:37 ` Matt Fleming [this message]
2012-02-28 17:50   ` [RFC][PATCH 6/6] USB: ffs-test: Don't duplicate {get,put}_unaligned*() functions H. Peter Anvin
2012-02-28 17:58     ` Greg Kroah-Hartman
2012-02-28 19:25     ` Davidlohr Bueso
2012-02-28 19:27   ` [tip:x86/build] USB: ffs-test: Don't duplicate {get, put}_unaligned*() functions tip-bot for Matt Fleming

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1330436245-24875-7-git-send-email-matt@console-pimps.org \
    --to=matt@console-pimps.org \
    --cc=akpm@linux-foundation.org \
    --cc=dave@gnu.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matt.fleming@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).