diff options
| author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2018-03-21 19:01:40 +0200 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-06-25 11:46:26 +0200 |
| commit | a83bdc0830f6b421384dd15e812de68d70773600 (patch) | |
| tree | 1d5041ad4fc9f7e1b77dbd583643570beb585549 /include | |
| parent | b7c853adcdfa248f6262df0cdbc48600f1cdc752 (diff) | |
| download | linux-a83bdc0830f6b421384dd15e812de68d70773600.tar.gz linux-a83bdc0830f6b421384dd15e812de68d70773600.tar.bz2 linux-a83bdc0830f6b421384dd15e812de68d70773600.zip | |
crypto: Deduplicate le32_to_cpu_array() and cpu_to_le32_array()
commit 9def051018c08e65c532822749e857eb4b2e12e7 upstream.
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>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/byteorder/generic.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/include/linux/byteorder/generic.h b/include/linux/byteorder/generic.h index 133b76d0d2c0..802f433e5a71 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); |
