byteorder: Add memcpy_to_le32() and memcpy_from_le32()
Add common memcpy APIs for copying u32 array to/from __le32 array. Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Anup Patel <apatel@ventanamicro.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Jassi Brar <jassisinghbrar@gmail.com> Link: https://lore.kernel.org/r/20250818040920.272664-7-apatel@ventanamicro.com Signed-off-by: Paul Walmsley <pjw@kernel.org>
This commit is contained in:
committed by
Paul Walmsley
parent
ba879dfc05
commit
6f01c24f3a
@@ -173,6 +173,22 @@ static inline void cpu_to_le32_array(u32 *buf, unsigned int words)
|
||||
}
|
||||
}
|
||||
|
||||
static inline void memcpy_from_le32(u32 *dst, const __le32 *src, size_t words)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < words; i++)
|
||||
dst[i] = le32_to_cpu(src[i]);
|
||||
}
|
||||
|
||||
static inline void memcpy_to_le32(__le32 *dst, const u32 *src, size_t words)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < words; i++)
|
||||
dst[i] = cpu_to_le32(src[i]);
|
||||
}
|
||||
|
||||
static inline void be16_add_cpu(__be16 *var, u16 val)
|
||||
{
|
||||
*var = cpu_to_be16(be16_to_cpu(*var) + val);
|
||||
|
||||
Reference in New Issue
Block a user