dma-mapping: return an unsigned int from dma_map_sg{,_attrs}
PATCH 1/1 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]>
--- include/linux/dma-mapping.h | 9 +++++---- kernel/dma/mapping.c | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-)
include/linux/dma-mapping.h +5 -4
@@ -105,8 +105,8 @@ dma_addr_t dma_map_page_attrs(struct device *dev, struct page *page, unsigned long attrs);void dma_unmap_page_attrs (struct device *dev,dma_addr_t addr,size_t size,enum dma_data_direction dir,unsigned long attrs); -int dma_map_sg_attrs (struct device *dev,struct scatterlist *sg,int nents, -enum dma_data_direction dir,unsigned long attrs); +unsigned int dma_map_sg_attrs (struct device *dev,struct scatterlist *sg, +int nents,enum dma_data_direction dir,unsigned long attrs);void dma_unmap_sg_attrs (struct device *dev,struct scatterlist *sg,int nents,enum dma_data_direction dir,unsigned long attrs);
@@ -166,8 +166,9 @@ static inline void dma_unmap_page_attrs(struct device *dev, dma_addr_t addr, size_t size, enum dma_data_direction dir, unsigned long attrs) { } -static inline int dma_map_sg_attrs (struct device *dev,struct scatterlist *sg, -int nents,enum dma_data_direction dir,unsigned long attrs) +static inline unsigned int dma_map_sg_attrs (struct device *dev, +struct scatterlist *sg,int nents,enum dma_data_direction dir, +unsigned long attrs) {return 0 ; }
kernel/dma/mapping.c +1 -1
@@ -219,7 +219,7 @@ static int __dma_map_sg_attrs(struct device *dev, struct scatterlist *sg,* dma_unmap_sg_attrs() should be used to unmap the buffer with the * original sg and original nents (not the value returned by this funciton). */ -int dma_map_sg_attrs (struct device *dev,struct scatterlist *sg, +unsigned int dma_map_sg_attrs (struct device *dev,struct scatterlist *sg,int nents,enum dma_data_direction dir,unsigned long attrs) {int ret;
Signature · 6 lines
2.30.2 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
Quoted 4 lines · Christoph Hellwig
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]>
Makes sense to me.
Reviewed-by Logan Gunthorpe <[email protected]>
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu