aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Corbet <corbet@lwn.net>2017-01-27 18:17:52 -0500
committerIngo Molnar <mingo@kernel.org>2017-01-28 03:37:51 -0500
commitf58576666ccdcfb9cf7cae8669dffe1eed844f88 (patch)
tree5d564d090fa61400c69bf35e85072cb99682166a
parent1b1bc42c1692e9b62756323c675a44cb1a1f9dbd (diff)
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>
-rw-r--r--arch/x86/include/asm/io.h46
1 files changed, 35 insertions, 11 deletions
diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h
index d34bd370074b..7afb0e2f07f4 100644
--- a/arch/x86/include/asm/io.h
+++ b/arch/x86/include/asm/io.h
@@ -164,6 +164,17 @@ static inline unsigned int isa_virt_to_bus(volatile void *address)
164#define virt_to_bus virt_to_phys 164#define virt_to_bus virt_to_phys
165#define bus_to_virt phys_to_virt 165#define bus_to_virt phys_to_virt
166 166
167/*
168 * The default ioremap() behavior is non-cached; if you need something
169 * else, you probably want one of the following.
170 */
171extern void __iomem *ioremap_nocache(resource_size_t offset, unsigned long size);
172extern void __iomem *ioremap_uc(resource_size_t offset, unsigned long size);
173#define ioremap_uc ioremap_uc
174
175extern void __iomem *ioremap_cache(resource_size_t offset, unsigned long size);
176extern void __iomem *ioremap_prot(resource_size_t offset, unsigned long size, unsigned long prot_val);
177
167/** 178/**
168 * ioremap - map bus memory into CPU space 179 * ioremap - map bus memory into CPU space
169 * @offset: bus address of the memory 180 * @offset: bus address of the memory
@@ -178,17 +189,6 @@ static inline unsigned int isa_virt_to_bus(volatile void *address)
178 * If the area you are trying to map is a PCI BAR you should have a 189 * If the area you are trying to map is a PCI BAR you should have a
179 * look at pci_iomap(). 190 * look at pci_iomap().
180 */ 191 */
181extern void __iomem *ioremap_nocache(resource_size_t offset, unsigned long size);
182extern void __iomem *ioremap_uc(resource_size_t offset, unsigned long size);
183#define ioremap_uc ioremap_uc
184
185extern void __iomem *ioremap_cache(resource_size_t offset, unsigned long size);
186extern 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 */
192static inline void __iomem *ioremap(resource_size_t offset, unsigned long size) 192static inline void __iomem *ioremap(resource_size_t offset, unsigned long size)
193{ 193{
194 return ioremap_nocache(offset, size); 194 return ioremap_nocache(offset, size);
@@ -207,18 +207,42 @@ extern void set_iounmap_nonlazy(void);
207 */ 207 */
208#define xlate_dev_kmem_ptr(p) p 208#define xlate_dev_kmem_ptr(p) p
209 209
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 */
210static inline void 218static inline void
211memset_io(volatile void __iomem *addr, unsigned char val, size_t count) 219memset_io(volatile void __iomem *addr, unsigned char val, size_t count)
212{ 220{
213 memset((void __force *)addr, val, count); 221 memset((void __force *)addr, val, count);
214} 222}
215 223
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 */
216static inline void 232static inline void
217memcpy_fromio(void *dst, const volatile void __iomem *src, size_t count) 233memcpy_fromio(void *dst, const volatile void __iomem *src, size_t count)
218{ 234{
219 memcpy(dst, (const void __force *)src, count); 235 memcpy(dst, (const void __force *)src, count);
220} 236}
221 237
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 */
222static inline void 246static inline void
223memcpy_toio(volatile void __iomem *dst, const void *src, size_t count) 247memcpy_toio(volatile void __iomem *dst, const void *src, size_t count)
224{ 248{