Skip to content

Commit 2a047e0

Browse files
author
Christoph Hellwig
committed
dma-mapping: return an unsigned int from dma_map_sg{,_attrs}
These can only return 0 for failure or the number of entries, so turn the return value into an unsigned int. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Logan Gunthorpe <[email protected]>
1 parent d03c544 commit 2a047e0

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

include/linux/dma-mapping.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ dma_addr_t dma_map_page_attrs(struct device *dev, struct page *page,
105105
unsigned long attrs);
106106
void dma_unmap_page_attrs(struct device *dev, dma_addr_t addr, size_t size,
107107
enum dma_data_direction dir, unsigned long attrs);
108-
int dma_map_sg_attrs(struct device *dev, struct scatterlist *sg, int nents,
109-
enum dma_data_direction dir, unsigned long attrs);
108+
unsigned int dma_map_sg_attrs(struct device *dev, struct scatterlist *sg,
109+
int nents, enum dma_data_direction dir, unsigned long attrs);
110110
void dma_unmap_sg_attrs(struct device *dev, struct scatterlist *sg,
111111
int nents, enum dma_data_direction dir,
112112
unsigned long attrs);
@@ -166,8 +166,9 @@ static inline void dma_unmap_page_attrs(struct device *dev, dma_addr_t addr,
166166
size_t size, enum dma_data_direction dir, unsigned long attrs)
167167
{
168168
}
169-
static inline int dma_map_sg_attrs(struct device *dev, struct scatterlist *sg,
170-
int nents, enum dma_data_direction dir, unsigned long attrs)
169+
static inline unsigned int dma_map_sg_attrs(struct device *dev,
170+
struct scatterlist *sg, int nents, enum dma_data_direction dir,
171+
unsigned long attrs)
171172
{
172173
return 0;
173174
}

kernel/dma/mapping.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ static int __dma_map_sg_attrs(struct device *dev, struct scatterlist *sg,
219219
* dma_unmap_sg_attrs() should be used to unmap the buffer with the
220220
* original sg and original nents (not the value returned by this funciton).
221221
*/
222-
int dma_map_sg_attrs(struct device *dev, struct scatterlist *sg,
222+
unsigned int dma_map_sg_attrs(struct device *dev, struct scatterlist *sg,
223223
int nents, enum dma_data_direction dir, unsigned long attrs)
224224
{
225225
int ret;

0 commit comments

Comments
 (0)