Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

dma-mapping: remove unused mapping resource callbacks

After ARM and XEN conversions to use physical addresses for the mapping,
there are no in-kernel users for map_resource/unmap_resource callbacks,
so remove them.

Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Link: https://lore.kernel.org/r/20251015-remove-map-page-v5-6-3bbfe3a25cdf@kernel.org

authored by

Leon Romanovsky and committed by
Marek Szyprowski
14cb413a af85de5a

+4 -18
-6
include/linux/dma-map-ops.h
··· 53 53 enum dma_data_direction dir, unsigned long attrs); 54 54 void (*unmap_sg)(struct device *dev, struct scatterlist *sg, int nents, 55 55 enum dma_data_direction dir, unsigned long attrs); 56 - dma_addr_t (*map_resource)(struct device *dev, phys_addr_t phys_addr, 57 - size_t size, enum dma_data_direction dir, 58 - unsigned long attrs); 59 - void (*unmap_resource)(struct device *dev, dma_addr_t dma_handle, 60 - size_t size, enum dma_data_direction dir, 61 - unsigned long attrs); 62 56 void (*sync_single_for_cpu)(struct device *dev, dma_addr_t dma_handle, 63 57 size_t size, enum dma_data_direction dir); 64 58 void (*sync_single_for_device)(struct device *dev,
+4 -12
kernel/dma/mapping.c
··· 157 157 { 158 158 const struct dma_map_ops *ops = get_dma_ops(dev); 159 159 bool is_mmio = attrs & DMA_ATTR_MMIO; 160 - dma_addr_t addr; 160 + dma_addr_t addr = DMA_MAPPING_ERROR; 161 161 162 162 BUG_ON(!valid_dma_direction(dir)); 163 163 ··· 171 171 addr = iommu_dma_map_phys(dev, phys, size, dir, attrs); 172 172 else if (ops->map_phys) 173 173 addr = ops->map_phys(dev, phys, size, dir, attrs); 174 - else if (is_mmio) { 175 - if (!ops->map_resource) 176 - return DMA_MAPPING_ERROR; 177 - 178 - addr = ops->map_resource(dev, phys, size, dir, attrs); 179 - } else { 174 + else if (!is_mmio && ops->map_page) { 180 175 struct page *page = phys_to_page(phys); 181 176 size_t offset = offset_in_page(phys); 182 177 183 178 /* 184 179 * The dma_ops API contract for ops->map_page() requires 185 - * kmappable memory, while ops->map_resource() does not. 180 + * kmappable memory. 186 181 */ 187 182 addr = ops->map_page(dev, page, offset, size, dir, attrs); 188 183 } ··· 222 227 iommu_dma_unmap_phys(dev, addr, size, dir, attrs); 223 228 else if (ops->unmap_phys) 224 229 ops->unmap_phys(dev, addr, size, dir, attrs); 225 - else if (is_mmio) { 226 - if (ops->unmap_resource) 227 - ops->unmap_resource(dev, addr, size, dir, attrs); 228 - } else 230 + else 229 231 ops->unmap_page(dev, addr, size, dir, attrs); 230 232 trace_dma_unmap_phys(dev, addr, size, dir, attrs); 231 233 debug_dma_unmap_phys(dev, addr, size, dir);