Skip to content

Commit eba304c

Browse files
author
Christoph Hellwig
committed
dma-mapping: better document dma_addr_t and DMA_MAPPING_ERROR
Move the comment documenting dma_addr_t away from the dma_map_ops definition which isn't very related to it, and toward DMA_MAPPING_ERROR, which is somewhat related. Add a little blurb about DMA_MAPPING_ERROR as well. Signed-off-by: Christoph Hellwig <hch@lst.de>
1 parent db4268f commit eba304c

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

‎include/linux/dma-mapping.h‎

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,6 @@
6767
*/
6868
#define DMA_ATTR_PRIVILEGED (1UL << 9)
6969

70-
/*
71-
* A dma_addr_t can hold any valid DMA or bus address for the platform.
72-
* It can be given to a device to use as a DMA source or target. A CPU cannot
73-
* reference a dma_addr_t directly because there may be translation between
74-
* its physical address space and the bus address space.
75-
*/
7670
struct dma_map_ops {
7771
void* (*alloc)(struct device *dev, size_t size,
7872
dma_addr_t *dma_handle, gfp_t gfp,
@@ -131,6 +125,16 @@ struct dma_map_ops {
131125
unsigned long (*get_merge_boundary)(struct device *dev);
132126
};
133127

128+
/*
129+
* A dma_addr_t can hold any valid DMA or bus address for the platform. It can
130+
* be given to a device to use as a DMA source or target. It is specific to a
131+
* given device and there may be a translation between the CPU physical address
132+
* space and the bus address space.
133+
*
134+
* DMA_MAPPING_ERROR is the magic error code if a mapping failed. It should not
135+
* be used directly in drivers, but checked for using dma_mapping_error()
136+
* instead.
137+
*/
134138
#define DMA_MAPPING_ERROR (~(dma_addr_t)0)
135139

136140
extern const struct dma_map_ops dma_virt_ops;

0 commit comments

Comments
 (0)