From: Harvey Harrison <harvey.harrison@gmail.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Christoph Hellwig <hch@infradead.org>,
Geert Uytterhoeven <geert@linux-m68k.org>,
LKML <linux-kernel@vger.kernel.org>,
Boaz Harrosh <bharrosh@panasas.com>
Subject: [PATCH 2/2] unaligned: add load/store_{endian}_noalign API
Date: Mon, 02 Mar 2009 16:06:58 -0800 [thread overview]
Message-ID: <1236038818.5756.12.camel@brick> (raw)
The existing get/put_unaligned_{endian} API is not typed, the
arguments are in the oposite of the usual order, and the name
get/put usually implies taking/releasing a reference.
Add a typed API with the usual argument ordering and use load/store,
this API is also consistent with the aligned versions.
Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
---
include/linux/unaligned/generic.h | 60 +++++++++++++++++++++++++++++++++++++
1 files changed, 60 insertions(+), 0 deletions(-)
diff --git a/include/linux/unaligned/generic.h b/include/linux/unaligned/generic.h
index 02d97ff..1e3e267 100644
--- a/include/linux/unaligned/generic.h
+++ b/include/linux/unaligned/generic.h
@@ -1,6 +1,66 @@
#ifndef _LINUX_UNALIGNED_GENERIC_H
#define _LINUX_UNALIGNED_GENERIC_H
+static inline u16 load_le16_noalign(const __le16 *p)
+{
+ return get_unaligned_le16(p);
+}
+
+static inline u32 load_le32_noalign(const __le32 *p)
+{
+ return get_unaligned_le32(p);
+}
+
+static inline u64 load_le64_noalign(const __le64 *p)
+{
+ return get_unaligned_le64(p);
+}
+
+static inline u16 load_be16_noalign(const __be16 *p)
+{
+ return get_unaligned_be16(p);
+}
+
+static inline u32 load_be32_noalign(const __be32 *p)
+{
+ return get_unaligned_be32(p);
+}
+
+static inline u64 load_be64_noalign(const __be64 *p)
+{
+ return get_unaligned_be64(p);
+}
+
+static inline void store_le16_noalign(__le16 *p, u16 val)
+{
+ return put_unaligned_le16(val, p);
+}
+
+static inline void store_le32_noalign(__le32 *p, u32 val)
+{
+ return put_unaligned_le32(val, p);
+}
+
+static inline void store_le64_noalign(__le64 *p, u64 val)
+{
+ return put_unaligned_le64(val, p);
+}
+
+static inline void store_be16_noalign(__be16 *p, u16 val)
+{
+ return put_unaligned_be16(val, p);
+}
+
+static inline void store_be32_noalign(__be32 *p, u32 val)
+{
+ return put_unaligned_be32(val, p);
+}
+
+static inline void store_be64_noalign(__be64 *p, u64 val)
+{
+ return put_unaligned_be64(val, p);
+}
+
/*
* Cause a link-time error if we try an unaligned access other than
* 1,2,4 or 8 bytes long
--
1.6.2.rc2.289.g2fa25
next reply other threads:[~2009-03-03 0:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-03 0:06 Harvey Harrison [this message]
2009-03-03 0:18 ` [PATCH 2/2] unaligned: add load/store_{endian}_noalign API Linus Torvalds
2009-03-03 0:38 ` Harvey Harrison
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=1236038818.5756.12.camel@brick \
--to=harvey.harrison@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=bharrosh@panasas.com \
--cc=geert@linux-m68k.org \
--cc=hch@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.