[PATCH v5 2/5] Replace generic memcpy and memset by IO memcpy functions

Julian Vetter
2024-09-24T12:14:50Z

Some architectures implement their own memcpy_{to,from}io and memset_io
functions, because the generic memcpy_{to,from}io and memset_io just use
memcpy/memset.This commit replaces the generic memcpy/memset functions
by IO memcpy/memset functions that respect the given architectures
alignment constraints. So, later we can get rid of the individual
implementations and use the generic ones.

Reviewed-by: Yann Sionneau <ysionneau@kalrayinc.com>
Signed-off-by: Julian Vetter <jvetter@kalrayinc.com>
---
Changes for v5
- New patch which replaces the "generic" memcpy/memset by our new
__memset_io/__memcpy_{to,from}io in asm-generic/io.h
---
include/asm-generic/io.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
index 9b8e0449da28..3b7deb724a2c 100644
--- a/include/asm-generic/io.h
+++ b/include/asm-generic/io.h
@@ -1175,7 +1175,7 @@ static inline void unxlate_dev_mem_ptr(phys_addr_t phys, void *addr)
static inline void memset_io(volatile void __iomem *addr, int value,
size_t size)
{
- memset(__io_virt(addr), value, size);
+ __memset_io(__io_virt(addr), value, size);
}
#endif

@@ -1193,7 +1193,7 @@ static inline void memcpy_fromio(void *buffer,
const volatile void __iomem *addr,
size_t size)
{
- memcpy(buffer, __io_virt(addr), size);
+ __memcpy_fromio(buffer, __io_virt(addr), size);
}
#endif

@@ -1210,7 +1210,7 @@ static inline void memcpy_fromio(void *buffer,
static inline void memcpy_toio(volatile void __iomem *addr, const void *buffer,
size_t size)
{
- memcpy(__io_virt(addr), buffer, size);
+ __memcpy_toio(__io_virt(addr), buffer, size);
}
#endif

--
2.34.1