Skip to content

Commit f585766

Browse files
Jonathan CorbetIngo Molnar
authored andcommitted
x86/mm: Improve documentation for low-level device I/O functions
Add kerneldoc comments for memcpy_{to,from}io() and memset_io(). The existing documentation for ioremap() was distant from the definition, causing kernel-doc to miss it; move it appropriately. Signed-off-by: Jonathan Corbet <corbet@lwn.net> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Link: http://lkml.kernel.org/r/20170127161752.0b95e95b@lwn.net Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent 1b1bc42 commit f585766

File tree

1 file changed

+35
-11
lines changed
  • arch/x86/include/asm

1 file changed

+35
-11
lines changed

arch/x86/include/asm/io.h

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,17 @@ static inline unsigned int isa_virt_to_bus(volatile void *address)
164164
#define virt_to_bus virt_to_phys
165165
#define bus_to_virt phys_to_virt
166166

167+
/*
168+
* The default ioremap() behavior is non-cached; if you need something
169+
* else, you probably want one of the following.
170+
*/
171+
extern void __iomem *ioremap_nocache(resource_size_t offset, unsigned long size);
172+
extern void __iomem *ioremap_uc(resource_size_t offset, unsigned long size);
173+
#define ioremap_uc ioremap_uc
174+
175+
extern void __iomem *ioremap_cache(resource_size_t offset, unsigned long size);
176+
extern void __iomem *ioremap_prot(resource_size_t offset, unsigned long size, unsigned long prot_val);
177+
167178
/**
168179
* ioremap - map bus memory into CPU space
169180
* @offset: bus address of the memory
@@ -178,17 +189,6 @@ static inline unsigned int isa_virt_to_bus(volatile void *address)
178189
* If the area you are trying to map is a PCI BAR you should have a
179190
* look at pci_iomap().
180191
*/
181-
extern void __iomem *ioremap_nocache(resource_size_t offset, unsigned long size);
182-
extern void __iomem *ioremap_uc(resource_size_t offset, unsigned long size);
183-
#define ioremap_uc ioremap_uc
184-
185-
extern void __iomem *ioremap_cache(resource_size_t offset, unsigned long size);
186-
extern void __iomem *ioremap_prot(resource_size_t offset, unsigned long size,
187-
unsigned long prot_val);
188-
189-
/*
190-
* The default ioremap() behavior is non-cached:
191-
*/
192192
static inline void __iomem *ioremap(resource_size_t offset, unsigned long size)
193193
{
194194
return ioremap_nocache(offset, size);
@@ -207,18 +207,42 @@ extern void set_iounmap_nonlazy(void);
207207
*/
208208
#define xlate_dev_kmem_ptr(p) p
209209

210+
/**
211+
* memset_io Set a range of I/O memory to a constant value
212+
* @addr: The beginning of the I/O-memory range to set
213+
* @val: The value to set the memory to
214+
* @count: The number of bytes to set
215+
*
216+
* Set a range of I/O memory to a given value.
217+
*/
210218
static inline void
211219
memset_io(volatile void __iomem *addr, unsigned char val, size_t count)
212220
{
213221
memset((void __force *)addr, val, count);
214222
}
215223

224+
/**
225+
* memcpy_fromio Copy a block of data from I/O memory
226+
* @dst: The (RAM) destination for the copy
227+
* @src: The (I/O memory) source for the data
228+
* @count: The number of bytes to copy
229+
*
230+
* Copy a block of data from I/O memory.
231+
*/
216232
static inline void
217233
memcpy_fromio(void *dst, const volatile void __iomem *src, size_t count)
218234
{
219235
memcpy(dst, (const void __force *)src, count);
220236
}
221237

238+
/**
239+
* memcpy_toio Copy a block of data into I/O memory
240+
* @dst: The (I/O memory) destination for the copy
241+
* @src: The (RAM) source for the data
242+
* @count: The number of bytes to copy
243+
*
244+
* Copy a block of data to I/O memory.
245+
*/
222246
static inline void
223247
memcpy_toio(volatile void __iomem *dst, const void *src, size_t count)
224248
{

0 commit comments

Comments
 (0)