mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 3/5] include: Add foreign endianess adding functions from kernel
Date: Tue, 15 Jul 2014 15:49:31 +0200	[thread overview]
Message-ID: <1405432173-22448-4-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1405432173-22448-1-git-send-email-s.hauer@pengutronix.de>

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 include/linux/byteorder/generic.h | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/include/linux/byteorder/generic.h b/include/linux/byteorder/generic.h
index 2d68d99..e59ba45 100644
--- a/include/linux/byteorder/generic.h
+++ b/include/linux/byteorder/generic.h
@@ -175,5 +175,34 @@ extern unsigned short int	htons(unsigned short int);
 
 #endif /* OPTIMIZE */
 
+static inline void le16_add_cpu(__le16 *var, u16 val)
+{
+	*var = cpu_to_le16(le16_to_cpu(*var) + val);
+}
+
+static inline void le32_add_cpu(__le32 *var, u32 val)
+{
+	*var = cpu_to_le32(le32_to_cpu(*var) + val);
+}
+
+static inline void le64_add_cpu(__le64 *var, u64 val)
+{
+	*var = cpu_to_le64(le64_to_cpu(*var) + val);
+}
+
+static inline void be16_add_cpu(__be16 *var, u16 val)
+{
+	*var = cpu_to_be16(be16_to_cpu(*var) + val);
+}
+
+static inline void be32_add_cpu(__be32 *var, u32 val)
+{
+	*var = cpu_to_be32(be32_to_cpu(*var) + val);
+}
+
+static inline void be64_add_cpu(__be64 *var, u64 val)
+{
+	*var = cpu_to_be64(be64_to_cpu(*var) + val);
+}
 
 #endif /* _LINUX_BYTEORDER_GENERIC_H */
-- 
2.0.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2014-07-15 13:49 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-15 13:49 Update/include some functions from the Kernel Sascha Hauer
2014-07-15 13:49 ` [PATCH 1/5] include: Add DECLARE_BITMAP from kernel Sascha Hauer
2014-07-15 13:49 ` [PATCH 2/5] include: Add round_up/round_down macros " Sascha Hauer
2014-07-15 13:49 ` Sascha Hauer [this message]
2014-07-15 13:49 ` [PATCH 4/5] lib: Add bitmap functions " Sascha Hauer
2014-07-15 13:49 ` [PATCH 5/5] include: update bitop " Sascha Hauer
2014-07-15 18:42 ` Update/include some functions from the Kernel Antony Pavlov
2014-07-16  8:27   ` Sascha Hauer
2014-07-16 23:15 ` Sebastian Hesselbarth
2014-07-17  5:33   ` Sascha Hauer
2014-07-17  9:29     ` Sebastian Hesselbarth
2014-07-17 12:41       ` Sascha Hauer

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=1405432173-22448-4-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox