Skip to content

Commit c2327da

Browse files
andy-shevIngo Molnar
authored andcommitted
x86/io: Remove mem*io() duplications
Generic header defines memset_io, memcpy_fromio(). and memcpy_toio(). Reuse them from generic header and remove in x86 code. Move the descriptions to the generic header as well. Signed-off-by: Andy Shevchenko <[email protected]> Cc: Baolin Wang <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Mika Westerberg <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
1 parent 3195201 commit c2327da

File tree

2 files changed

+24
-45
lines changed
  • arch/x86/include/asm
  • include/asm-generic

2 files changed

+24
-45
lines changed

arch/x86/include/asm/io.h

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -220,51 +220,6 @@ extern void set_iounmap_nonlazy(void);
220220
*/
221221
#define xlate_dev_kmem_ptr(p) p
222222

223-
/**
224-
* memset_io Set a range of I/O memory to a constant value
225-
* @addr: The beginning of the I/O-memory range to set
226-
* @val: The value to set the memory to
227-
* @count: The number of bytes to set
228-
*
229-
* Set a range of I/O memory to a given value.
230-
*/
231-
static inline void
232-
memset_io(volatile void __iomem *addr, unsigned char val, size_t count)
233-
{
234-
memset((void __force *)addr, val, count);
235-
}
236-
#define memset_io(dst,c,count) memset_io(dst,c,count)
237-
238-
/**
239-
* memcpy_fromio Copy a block of data from I/O memory
240-
* @dst: The (RAM) destination for the copy
241-
* @src: The (I/O memory) source for the data
242-
* @count: The number of bytes to copy
243-
*
244-
* Copy a block of data from I/O memory.
245-
*/
246-
static inline void
247-
memcpy_fromio(void *dst, const volatile void __iomem *src, size_t count)
248-
{
249-
memcpy(dst, (const void __force *)src, count);
250-
}
251-
#define memcpy_fromio(to,from,count) memcpy_fromio(to,from,count)
252-
253-
/**
254-
* memcpy_toio Copy a block of data into I/O memory
255-
* @dst: The (I/O memory) destination for the copy
256-
* @src: The (RAM) source for the data
257-
* @count: The number of bytes to copy
258-
*
259-
* Copy a block of data to I/O memory.
260-
*/
261-
static inline void
262-
memcpy_toio(volatile void __iomem *dst, const void *src, size_t count)
263-
{
264-
memcpy((void __force *)dst, src, count);
265-
}
266-
#define memcpy_toio(to,from,count) memcpy_toio(to,from,count)
267-
268223
/*
269224
* ISA space is 'always mapped' on a typical x86 system, no need to
270225
* explicitly ioremap() it. The fact that the ISA IO space is mapped

include/asm-generic/io.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -954,6 +954,14 @@ static inline void *bus_to_virt(unsigned long address)
954954

955955
#ifndef memset_io
956956
#define memset_io memset_io
957+
/**
958+
* memset_io Set a range of I/O memory to a constant value
959+
* @addr: The beginning of the I/O-memory range to set
960+
* @val: The value to set the memory to
961+
* @count: The number of bytes to set
962+
*
963+
* Set a range of I/O memory to a given value.
964+
*/
957965
static inline void memset_io(volatile void __iomem *addr, int value,
958966
size_t size)
959967
{
@@ -963,6 +971,14 @@ static inline void memset_io(volatile void __iomem *addr, int value,
963971

964972
#ifndef memcpy_fromio
965973
#define memcpy_fromio memcpy_fromio
974+
/**
975+
* memcpy_fromio Copy a block of data from I/O memory
976+
* @dst: The (RAM) destination for the copy
977+
* @src: The (I/O memory) source for the data
978+
* @count: The number of bytes to copy
979+
*
980+
* Copy a block of data from I/O memory.
981+
*/
966982
static inline void memcpy_fromio(void *buffer,
967983
const volatile void __iomem *addr,
968984
size_t size)
@@ -973,6 +989,14 @@ static inline void memcpy_fromio(void *buffer,
973989

974990
#ifndef memcpy_toio
975991
#define memcpy_toio memcpy_toio
992+
/**
993+
* memcpy_toio Copy a block of data into I/O memory
994+
* @dst: The (I/O memory) destination for the copy
995+
* @src: The (RAM) source for the data
996+
* @count: The number of bytes to copy
997+
*
998+
* Copy a block of data to I/O memory.
999+
*/
9761000
static inline void memcpy_toio(volatile void __iomem *addr, const void *buffer,
9771001
size_t size)
9781002
{

0 commit comments

Comments
 (0)