aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/byteorder
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2018-03-21 19:01:40 +0200
committerHerbert Xu <herbert@gondor.apana.org.au>2018-03-31 01:33:09 +0800
commit9def051018c08e65c532822749e857eb4b2e12e7 (patch)
tree3a8c6d7fd82e4828669b561c84255e4c0d35a5bd /include/linux/byteorder
parentcrypto: doc - clarify hash callbacks state machine (diff)
downloadlinux-dev-9def051018c08e65c532822749e857eb4b2e12e7.tar.xz
linux-dev-9def051018c08e65c532822749e857eb4b2e12e7.zip
crypto: Deduplicate le32_to_cpu_array() and cpu_to_le32_array()
Deduplicate le32_to_cpu_array() and cpu_to_le32_array() by moving them to the generic header. No functional change implied. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'include/linux/byteorder')
-rw-r--r--include/linux/byteorder/generic.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/include/linux/byteorder/generic.h b/include/linux/byteorder/generic.h
index 451aaa0786ae..4b13e0a3e15b 100644
--- a/include/linux/byteorder/generic.h
+++ b/include/linux/byteorder/generic.h
@@ -156,6 +156,23 @@ static inline void le64_add_cpu(__le64 *var, u64 val)
*var = cpu_to_le64(le64_to_cpu(*var) + val);
}
+/* XXX: this stuff can be optimized */
+static inline void le32_to_cpu_array(u32 *buf, unsigned int words)
+{
+ while (words--) {
+ __le32_to_cpus(buf);
+ buf++;
+ }
+}
+
+static inline void cpu_to_le32_array(u32 *buf, unsigned int words)
+{
+ while (words--) {
+ __cpu_to_le32s(buf);
+ buf++;
+ }
+}
+
static inline void be16_add_cpu(__be16 *var, u16 val)
{
*var = cpu_to_be16(be16_to_cpu(*var) + val);