Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Anup Patel and committed by
Paul Walmsley
6f01c24f ba879dfc

+16
+16
include/linux/byteorder/generic.h
··· 173 173 } 174 174 } 175 175 176 + static inline void memcpy_from_le32(u32 *dst, const __le32 *src, size_t words) 177 + { 178 + size_t i; 179 + 180 + for (i = 0; i < words; i++) 181 + dst[i] = le32_to_cpu(src[i]); 182 + } 183 + 184 + static inline void memcpy_to_le32(__le32 *dst, const u32 *src, size_t words) 185 + { 186 + size_t i; 187 + 188 + for (i = 0; i < words; i++) 189 + dst[i] = cpu_to_le32(src[i]); 190 + } 191 + 176 192 static inline void be16_add_cpu(__be16 *var, u16 val) 177 193 { 178 194 *var = cpu_to_be16(be16_to_cpu(*var) + val);