Skip to content

Commit 14a9aad

Browse files
author
Christoph Hellwig
committed
x86/pci-nommu: implement ->mapping_error
DMA_ERROR_CODE is going to go away, so don't rely on it. Signed-off-by: Christoph Hellwig <hch@lst.de>
1 parent 6009faa commit 14a9aad

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

arch/x86/kernel/pci-nommu.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
#include <asm/iommu.h>
1212
#include <asm/dma.h>
1313

14+
#define NOMMU_MAPPING_ERROR 0
15+
1416
static int
1517
check_addr(char *name, struct device *hwdev, dma_addr_t bus, size_t size)
1618
{
@@ -33,7 +35,7 @@ static dma_addr_t nommu_map_page(struct device *dev, struct page *page,
3335
dma_addr_t bus = page_to_phys(page) + offset;
3436
WARN_ON(size == 0);
3537
if (!check_addr("map_single", dev, bus, size))
36-
return DMA_ERROR_CODE;
38+
return NOMMU_MAPPING_ERROR;
3739
flush_write_buffers();
3840
return bus;
3941
}
@@ -88,6 +90,11 @@ static void nommu_sync_sg_for_device(struct device *dev,
8890
flush_write_buffers();
8991
}
9092

93+
static int nommu_mapping_error(struct device *dev, dma_addr_t dma_addr)
94+
{
95+
return dma_addr == NOMMU_MAPPING_ERROR;
96+
}
97+
9198
const struct dma_map_ops nommu_dma_ops = {
9299
.alloc = dma_generic_alloc_coherent,
93100
.free = dma_generic_free_coherent,
@@ -96,4 +103,5 @@ const struct dma_map_ops nommu_dma_ops = {
96103
.sync_single_for_device = nommu_sync_single_for_device,
97104
.sync_sg_for_device = nommu_sync_sg_for_device,
98105
.is_phys = 1,
106+
.mapping_error = nommu_mapping_error,
99107
};

0 commit comments

Comments
 (0)