Skip to content

Commit e43e265

Browse files
author
Christoph Hellwig
committed
x86/dma: Remove the x86_dma_fallback_dev hack
Now that we removed support for the NULL device argument in the DMA API, there is no need to cater for that in the x86 code. Signed-off-by: Christoph Hellwig <hch@lst.de>
1 parent d7e02a9 commit e43e265

4 files changed

Lines changed: 0 additions & 43 deletions

File tree

‎arch/x86/include/asm/dma-mapping.h‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,7 @@
1313
#include <asm/swiotlb.h>
1414
#include <linux/dma-contiguous.h>
1515

16-
#ifdef CONFIG_ISA
17-
# define ISA_DMA_BIT_MASK DMA_BIT_MASK(24)
18-
#else
19-
# define ISA_DMA_BIT_MASK DMA_BIT_MASK(32)
20-
#endif
21-
2216
extern int iommu_merge;
23-
extern struct device x86_dma_fallback_dev;
2417
extern int panic_on_overflow;
2518

2619
extern const struct dma_map_ops *dma_ops;
@@ -30,7 +23,4 @@ static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
3023
return dma_ops;
3124
}
3225

33-
bool arch_dma_alloc_attrs(struct device **dev);
34-
#define arch_dma_alloc_attrs arch_dma_alloc_attrs
35-
3626
#endif

‎arch/x86/kernel/amd_gart_64.c‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,6 @@ static dma_addr_t gart_map_page(struct device *dev, struct page *page,
233233
unsigned long bus;
234234
phys_addr_t paddr = page_to_phys(page) + offset;
235235

236-
if (!dev)
237-
dev = &x86_dma_fallback_dev;
238-
239236
if (!need_iommu(dev, paddr, size))
240237
return paddr;
241238

@@ -392,9 +389,6 @@ static int gart_map_sg(struct device *dev, struct scatterlist *sg, int nents,
392389
if (nents == 0)
393390
return 0;
394391

395-
if (!dev)
396-
dev = &x86_dma_fallback_dev;
397-
398392
out = 0;
399393
start = 0;
400394
start_sg = sg;

‎arch/x86/kernel/pci-dma.c‎

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,6 @@ int iommu_pass_through __read_mostly;
5151

5252
extern struct iommu_table_entry __iommu_table[], __iommu_table_end[];
5353

54-
/* Dummy device used for NULL arguments (normally ISA). */
55-
struct device x86_dma_fallback_dev = {
56-
.init_name = "fallback device",
57-
.coherent_dma_mask = ISA_DMA_BIT_MASK,
58-
.dma_mask = &x86_dma_fallback_dev.coherent_dma_mask,
59-
};
60-
EXPORT_SYMBOL(x86_dma_fallback_dev);
61-
6254
void __init pci_iommu_alloc(void)
6355
{
6456
struct iommu_table_entry *p;
@@ -77,18 +69,6 @@ void __init pci_iommu_alloc(void)
7769
}
7870
}
7971

80-
bool arch_dma_alloc_attrs(struct device **dev)
81-
{
82-
if (!*dev)
83-
*dev = &x86_dma_fallback_dev;
84-
85-
if (!is_device_dma_capable(*dev))
86-
return false;
87-
return true;
88-
89-
}
90-
EXPORT_SYMBOL(arch_dma_alloc_attrs);
91-
9272
/*
9373
* See <Documentation/x86/x86_64/boot-options.txt> for the iommu kernel
9474
* parameter documentation.

‎kernel/dma/mapping.c‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -238,10 +238,6 @@ u64 dma_get_required_mask(struct device *dev)
238238
}
239239
EXPORT_SYMBOL_GPL(dma_get_required_mask);
240240

241-
#ifndef arch_dma_alloc_attrs
242-
#define arch_dma_alloc_attrs(dev) (true)
243-
#endif
244-
245241
void *dma_alloc_attrs(struct device *dev, size_t size, dma_addr_t *dma_handle,
246242
gfp_t flag, unsigned long attrs)
247243
{
@@ -256,9 +252,6 @@ void *dma_alloc_attrs(struct device *dev, size_t size, dma_addr_t *dma_handle,
256252
/* let the implementation decide on the zone to allocate from: */
257253
flag &= ~(__GFP_DMA | __GFP_DMA32 | __GFP_HIGHMEM);
258254

259-
if (!arch_dma_alloc_attrs(&dev))
260-
return NULL;
261-
262255
if (dma_is_direct(ops))
263256
cpu_addr = dma_direct_alloc(dev, size, dma_handle, flag, attrs);
264257
else if (ops->alloc)

0 commit comments

Comments
 (0)