diff mbox series

[v4,2/5] Replace generic memcpy and memset by IO memcpy functions

Message ID 20240924092223.534040-3-jvetter@kalrayinc.com (mailing list archive)
State New, archived
Headers show
Series Consolidate IO memcpy functions | expand

Commit Message

Julian Vetter Sept. 24, 2024, 9:22 a.m. UTC
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>
---
 include/asm-generic/io.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

kernel test robot Sept. 24, 2024, 5:31 p.m. UTC | #1
Hi Julian,

kernel test robot noticed the following build errors:

[auto build test ERROR on akpm-mm/mm-nonmm-unstable]
[also build test ERROR on arm64/for-next/core soc/for-next linus/master v6.11 next-20240924]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Julian-Vetter/Consolidate-__memcpy_-to-from-io-and-__memset_io-into-a-single-lib/20240924-172751
base:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-nonmm-unstable
patch link:    https://lore.kernel.org/r/20240924092223.534040-3-jvetter%40kalrayinc.com
patch subject: [PATCH v4 2/5] Replace generic memcpy and memset by IO memcpy functions
config: openrisc-defconfig (https://download.01.org/0day-ci/archive/20240925/202409250049.WzbuwMDw-lkp@intel.com/config)
compiler: or1k-linux-gcc (GCC) 14.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240925/202409250049.WzbuwMDw-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202409250049.WzbuwMDw-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from arch/openrisc/include/asm/io.h:37,
                    from include/linux/io.h:14,
                    from arch/openrisc/kernel/asm-offsets.c:31:
   include/asm-generic/io.h: In function 'memset_io':
>> include/asm-generic/io.h:1166:9: error: implicit declaration of function '__memset_io'; did you mean 'memset_io'? [-Wimplicit-function-declaration]
    1166 |         __memset_io(__io_virt(addr), value, size);
         |         ^~~~~~~~~~~
         |         memset_io
   include/asm-generic/io.h: In function 'memcpy_fromio':
>> include/asm-generic/io.h:1184:9: error: implicit declaration of function '__memcpy_fromio'; did you mean 'memcpy_fromio'? [-Wimplicit-function-declaration]
    1184 |         __memcpy_fromio(buffer, __io_virt(addr), size);
         |         ^~~~~~~~~~~~~~~
         |         memcpy_fromio
   include/asm-generic/io.h: In function 'memcpy_toio':
>> include/asm-generic/io.h:1201:9: error: implicit declaration of function '__memcpy_toio'; did you mean 'memcpy_toio'? [-Wimplicit-function-declaration]
    1201 |         __memcpy_toio(__io_virt(addr), buffer, size);
         |         ^~~~~~~~~~~~~
         |         memcpy_toio
   make[3]: *** [scripts/Makefile.build:117: arch/openrisc/kernel/asm-offsets.s] Error 1
   make[3]: Target 'prepare' not remade because of errors.
   make[2]: *** [Makefile:1193: prepare0] Error 2
   make[2]: Target 'prepare' not remade because of errors.
   make[1]: *** [Makefile:224: __sub-make] Error 2
   make[1]: Target 'prepare' not remade because of errors.
   make: *** [Makefile:224: __sub-make] Error 2
   make: Target 'prepare' not remade because of errors.


vim +1166 include/asm-generic/io.h

  1152	
  1153	#ifndef memset_io
  1154	#define memset_io memset_io
  1155	/**
  1156	 * memset_io	Set a range of I/O memory to a constant value
  1157	 * @addr:	The beginning of the I/O-memory range to set
  1158	 * @val:	The value to set the memory to
  1159	 * @count:	The number of bytes to set
  1160	 *
  1161	 * Set a range of I/O memory to a given value.
  1162	 */
  1163	static inline void memset_io(volatile void __iomem *addr, int value,
  1164				     size_t size)
  1165	{
> 1166		__memset_io(__io_virt(addr), value, size);
  1167	}
  1168	#endif
  1169	
  1170	#ifndef memcpy_fromio
  1171	#define memcpy_fromio memcpy_fromio
  1172	/**
  1173	 * memcpy_fromio	Copy a block of data from I/O memory
  1174	 * @dst:		The (RAM) destination for the copy
  1175	 * @src:		The (I/O memory) source for the data
  1176	 * @count:		The number of bytes to copy
  1177	 *
  1178	 * Copy a block of data from I/O memory.
  1179	 */
  1180	static inline void memcpy_fromio(void *buffer,
  1181					 const volatile void __iomem *addr,
  1182					 size_t size)
  1183	{
> 1184		__memcpy_fromio(buffer, __io_virt(addr), size);
  1185	}
  1186	#endif
  1187	
  1188	#ifndef memcpy_toio
  1189	#define memcpy_toio memcpy_toio
  1190	/**
  1191	 * memcpy_toio		Copy a block of data into I/O memory
  1192	 * @dst:		The (I/O memory) destination for the copy
  1193	 * @src:		The (RAM) source for the data
  1194	 * @count:		The number of bytes to copy
  1195	 *
  1196	 * Copy a block of data to I/O memory.
  1197	 */
  1198	static inline void memcpy_toio(volatile void __iomem *addr, const void *buffer,
  1199				       size_t size)
  1200	{
> 1201		__memcpy_toio(__io_virt(addr), buffer, size);
  1202	}
  1203	#endif
  1204
kernel test robot Sept. 24, 2024, 8:25 p.m. UTC | #2
Hi Julian,

kernel test robot noticed the following build errors:

[auto build test ERROR on akpm-mm/mm-nonmm-unstable]
[also build test ERROR on arm64/for-next/core soc/for-next linus/master v6.11 next-20240924]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Julian-Vetter/Consolidate-__memcpy_-to-from-io-and-__memset_io-into-a-single-lib/20240924-172751
base:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-nonmm-unstable
patch link:    https://lore.kernel.org/r/20240924092223.534040-3-jvetter%40kalrayinc.com
patch subject: [PATCH v4 2/5] Replace generic memcpy and memset by IO memcpy functions
config: um-x86_64_defconfig (https://download.01.org/0day-ci/archive/20240925/202409250346.N624LLrr-lkp@intel.com/config)
compiler: clang version 15.0.7 (https://github.com/llvm/llvm-project 8dfdcc7b7bf66834a761bd8de445840ef68e4d1a)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240925/202409250346.N624LLrr-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202409250346.N624LLrr-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from kernel/time/time.c:31:
   In file included from include/linux/timekeeper_internal.h:10:
   In file included from include/linux/clocksource.h:22:
   In file included from arch/um/include/asm/io.h:24:
   include/asm-generic/io.h:548:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __raw_readb(PCI_IOBASE + addr);
                             ~~~~~~~~~~ ^
   include/asm-generic/io.h:561:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
                                                           ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu'
   #define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
                                                     ^
   In file included from kernel/time/time.c:31:
   In file included from include/linux/timekeeper_internal.h:10:
   In file included from include/linux/clocksource.h:22:
   In file included from arch/um/include/asm/io.h:24:
   include/asm-generic/io.h:574:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
                                                           ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu'
   #define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
                                                     ^
   In file included from kernel/time/time.c:31:
   In file included from include/linux/timekeeper_internal.h:10:
   In file included from include/linux/clocksource.h:22:
   In file included from arch/um/include/asm/io.h:24:
   include/asm-generic/io.h:585:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writeb(value, PCI_IOBASE + addr);
                               ~~~~~~~~~~ ^
   include/asm-generic/io.h:595:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
                                                         ~~~~~~~~~~ ^
   include/asm-generic/io.h:605:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
                                                         ~~~~~~~~~~ ^
   include/asm-generic/io.h:693:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           readsb(PCI_IOBASE + addr, buffer, count);
                  ~~~~~~~~~~ ^
   include/asm-generic/io.h:701:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           readsw(PCI_IOBASE + addr, buffer, count);
                  ~~~~~~~~~~ ^
   include/asm-generic/io.h:709:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           readsl(PCI_IOBASE + addr, buffer, count);
                  ~~~~~~~~~~ ^
   include/asm-generic/io.h:718:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           writesb(PCI_IOBASE + addr, buffer, count);
                   ~~~~~~~~~~ ^
   include/asm-generic/io.h:727:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           writesw(PCI_IOBASE + addr, buffer, count);
                   ~~~~~~~~~~ ^
   include/asm-generic/io.h:736:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           writesl(PCI_IOBASE + addr, buffer, count);
                   ~~~~~~~~~~ ^
>> include/asm-generic/io.h:1166:2: error: call to undeclared function '__memset_io'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration]
           __memset_io(__io_virt(addr), value, size);
           ^
   include/asm-generic/io.h:1166:2: note: did you mean 'memset_io'?
   include/asm-generic/io.h:1163:20: note: 'memset_io' declared here
   static inline void memset_io(volatile void __iomem *addr, int value,
                      ^
   include/asm-generic/io.h:1154:19: note: expanded from macro 'memset_io'
   #define memset_io memset_io
                     ^
>> include/asm-generic/io.h:1184:2: error: call to undeclared function '__memcpy_fromio'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration]
           __memcpy_fromio(buffer, __io_virt(addr), size);
           ^
   include/asm-generic/io.h:1184:2: note: did you mean 'memcpy_fromio'?
   include/asm-generic/io.h:1180:20: note: 'memcpy_fromio' declared here
   static inline void memcpy_fromio(void *buffer,
                      ^
   include/asm-generic/io.h:1171:23: note: expanded from macro 'memcpy_fromio'
   #define memcpy_fromio memcpy_fromio
                         ^
>> include/asm-generic/io.h:1201:2: error: call to undeclared function '__memcpy_toio'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration]
           __memcpy_toio(__io_virt(addr), buffer, size);
           ^
   include/asm-generic/io.h:1201:2: note: did you mean 'memcpy_toio'?
   include/asm-generic/io.h:1198:20: note: 'memcpy_toio' declared here
   static inline void memcpy_toio(volatile void __iomem *addr, const void *buffer,
                      ^
   include/asm-generic/io.h:1189:21: note: expanded from macro 'memcpy_toio'
   #define memcpy_toio memcpy_toio
                       ^
   12 warnings and 3 errors generated.
--
   In file included from kernel/time/hrtimer.c:30:
   In file included from include/linux/syscalls.h:93:
   In file included from include/trace/syscall.h:7:
   In file included from include/linux/trace_events.h:9:
   In file included from include/linux/hardirq.h:11:
   In file included from arch/um/include/asm/hardirq.h:5:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:14:
   In file included from arch/um/include/asm/io.h:24:
   include/asm-generic/io.h:548:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __raw_readb(PCI_IOBASE + addr);
                             ~~~~~~~~~~ ^
   include/asm-generic/io.h:561:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
                                                           ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu'
   #define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
                                                     ^
   In file included from kernel/time/hrtimer.c:30:
   In file included from include/linux/syscalls.h:93:
   In file included from include/trace/syscall.h:7:
   In file included from include/linux/trace_events.h:9:
   In file included from include/linux/hardirq.h:11:
   In file included from arch/um/include/asm/hardirq.h:5:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:14:
   In file included from arch/um/include/asm/io.h:24:
   include/asm-generic/io.h:574:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
                                                           ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu'
   #define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
                                                     ^
   In file included from kernel/time/hrtimer.c:30:
   In file included from include/linux/syscalls.h:93:
   In file included from include/trace/syscall.h:7:
   In file included from include/linux/trace_events.h:9:
   In file included from include/linux/hardirq.h:11:
   In file included from arch/um/include/asm/hardirq.h:5:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:14:
   In file included from arch/um/include/asm/io.h:24:
   include/asm-generic/io.h:585:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writeb(value, PCI_IOBASE + addr);
                               ~~~~~~~~~~ ^
   include/asm-generic/io.h:595:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
                                                         ~~~~~~~~~~ ^
   include/asm-generic/io.h:605:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
                                                         ~~~~~~~~~~ ^
   include/asm-generic/io.h:693:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           readsb(PCI_IOBASE + addr, buffer, count);
                  ~~~~~~~~~~ ^
   include/asm-generic/io.h:701:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           readsw(PCI_IOBASE + addr, buffer, count);
                  ~~~~~~~~~~ ^
   include/asm-generic/io.h:709:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           readsl(PCI_IOBASE + addr, buffer, count);
                  ~~~~~~~~~~ ^
   include/asm-generic/io.h:718:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           writesb(PCI_IOBASE + addr, buffer, count);
                   ~~~~~~~~~~ ^
   include/asm-generic/io.h:727:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           writesw(PCI_IOBASE + addr, buffer, count);
                   ~~~~~~~~~~ ^
   include/asm-generic/io.h:736:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           writesl(PCI_IOBASE + addr, buffer, count);
                   ~~~~~~~~~~ ^
>> include/asm-generic/io.h:1166:2: error: call to undeclared function '__memset_io'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration]
           __memset_io(__io_virt(addr), value, size);
           ^
   include/asm-generic/io.h:1166:2: note: did you mean 'memset_io'?
   include/asm-generic/io.h:1163:20: note: 'memset_io' declared here
   static inline void memset_io(volatile void __iomem *addr, int value,
                      ^
   include/asm-generic/io.h:1154:19: note: expanded from macro 'memset_io'
   #define memset_io memset_io
                     ^
>> include/asm-generic/io.h:1184:2: error: call to undeclared function '__memcpy_fromio'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration]
           __memcpy_fromio(buffer, __io_virt(addr), size);
           ^
   include/asm-generic/io.h:1184:2: note: did you mean 'memcpy_fromio'?
   include/asm-generic/io.h:1180:20: note: 'memcpy_fromio' declared here
   static inline void memcpy_fromio(void *buffer,
                      ^
   include/asm-generic/io.h:1171:23: note: expanded from macro 'memcpy_fromio'
   #define memcpy_fromio memcpy_fromio
                         ^
>> include/asm-generic/io.h:1201:2: error: call to undeclared function '__memcpy_toio'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration]
           __memcpy_toio(__io_virt(addr), buffer, size);
           ^
   include/asm-generic/io.h:1201:2: note: did you mean 'memcpy_toio'?
   include/asm-generic/io.h:1198:20: note: 'memcpy_toio' declared here
   static inline void memcpy_toio(volatile void __iomem *addr, const void *buffer,
                      ^
   include/asm-generic/io.h:1189:21: note: expanded from macro 'memcpy_toio'
   #define memcpy_toio memcpy_toio
                       ^
   kernel/time/hrtimer.c:121:21: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
           [CLOCK_REALTIME]        = HRTIMER_BASE_REALTIME,
                                     ^~~~~~~~~~~~~~~~~~~~~
   kernel/time/hrtimer.c:119:27: note: previous initialization is here
           [0 ... MAX_CLOCKS - 1]  = HRTIMER_MAX_CLOCK_BASES,
                                     ^~~~~~~~~~~~~~~~~~~~~~~
   kernel/time/hrtimer.c:122:22: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
           [CLOCK_MONOTONIC]       = HRTIMER_BASE_MONOTONIC,
                                     ^~~~~~~~~~~~~~~~~~~~~~
   kernel/time/hrtimer.c:119:27: note: previous initialization is here
           [0 ... MAX_CLOCKS - 1]  = HRTIMER_MAX_CLOCK_BASES,
                                     ^~~~~~~~~~~~~~~~~~~~~~~
   kernel/time/hrtimer.c:123:21: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
           [CLOCK_BOOTTIME]        = HRTIMER_BASE_BOOTTIME,
                                     ^~~~~~~~~~~~~~~~~~~~~
   kernel/time/hrtimer.c:119:27: note: previous initialization is here
           [0 ... MAX_CLOCKS - 1]  = HRTIMER_MAX_CLOCK_BASES,
                                     ^~~~~~~~~~~~~~~~~~~~~~~
   kernel/time/hrtimer.c:124:17: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
           [CLOCK_TAI]             = HRTIMER_BASE_TAI,
                                     ^~~~~~~~~~~~~~~~
   kernel/time/hrtimer.c:119:27: note: previous initialization is here
           [0 ... MAX_CLOCKS - 1]  = HRTIMER_MAX_CLOCK_BASES,
                                     ^~~~~~~~~~~~~~~~~~~~~~~
   16 warnings and 3 errors generated.


vim +/__memset_io +1166 include/asm-generic/io.h

  1152	
  1153	#ifndef memset_io
  1154	#define memset_io memset_io
  1155	/**
  1156	 * memset_io	Set a range of I/O memory to a constant value
  1157	 * @addr:	The beginning of the I/O-memory range to set
  1158	 * @val:	The value to set the memory to
  1159	 * @count:	The number of bytes to set
  1160	 *
  1161	 * Set a range of I/O memory to a given value.
  1162	 */
  1163	static inline void memset_io(volatile void __iomem *addr, int value,
  1164				     size_t size)
  1165	{
> 1166		__memset_io(__io_virt(addr), value, size);
  1167	}
  1168	#endif
  1169	
  1170	#ifndef memcpy_fromio
  1171	#define memcpy_fromio memcpy_fromio
  1172	/**
  1173	 * memcpy_fromio	Copy a block of data from I/O memory
  1174	 * @dst:		The (RAM) destination for the copy
  1175	 * @src:		The (I/O memory) source for the data
  1176	 * @count:		The number of bytes to copy
  1177	 *
  1178	 * Copy a block of data from I/O memory.
  1179	 */
  1180	static inline void memcpy_fromio(void *buffer,
  1181					 const volatile void __iomem *addr,
  1182					 size_t size)
  1183	{
> 1184		__memcpy_fromio(buffer, __io_virt(addr), size);
  1185	}
  1186	#endif
  1187	
  1188	#ifndef memcpy_toio
  1189	#define memcpy_toio memcpy_toio
  1190	/**
  1191	 * memcpy_toio		Copy a block of data into I/O memory
  1192	 * @dst:		The (I/O memory) destination for the copy
  1193	 * @src:		The (RAM) source for the data
  1194	 * @count:		The number of bytes to copy
  1195	 *
  1196	 * Copy a block of data to I/O memory.
  1197	 */
  1198	static inline void memcpy_toio(volatile void __iomem *addr, const void *buffer,
  1199				       size_t size)
  1200	{
> 1201		__memcpy_toio(__io_virt(addr), buffer, size);
  1202	}
  1203	#endif
  1204
diff mbox series

Patch

diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
index 80de699bf6af..0f05d2399938 100644
--- a/include/asm-generic/io.h
+++ b/include/asm-generic/io.h
@@ -1163,7 +1163,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
 
@@ -1181,7 +1181,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
 
@@ -1198,7 +1198,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