diff options
author | Glauber Costa <gcosta@redhat.com> | 2008-04-08 12:21:01 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-04-19 13:19:58 -0400 |
commit | 71848d687e2a477cb7c68a854d8fdeaa5dff0ffc (patch) | |
tree | 7452d4617f6aeef6e271c6b722bb96a2694eeffe /arch/x86 | |
parent | 2e33e361188617628e47b4bc47e87e84feaf556f (diff) |
x86: remove virt_to_bus in pci-dma_64.c
virt_to_bus() is deprecated according to the docs, and moreover,
won't return the right thing in i386 if we're dealing with high memory mappings.
So we make our allocation function return a page, and then use page_address() (for
virtual addr) and page_to_phys() (for physical addr) instead.
Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/kernel/pci-dma_64.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/arch/x86/kernel/pci-dma_64.c b/arch/x86/kernel/pci-dma_64.c index 5f03e4174210..13a31a4a4c17 100644 --- a/arch/x86/kernel/pci-dma_64.c +++ b/arch/x86/kernel/pci-dma_64.c | |||
@@ -28,13 +28,11 @@ struct device fallback_dev = { | |||
28 | noinline static void * | 28 | noinline static void * |
29 | dma_alloc_pages(struct device *dev, gfp_t gfp, unsigned order) | 29 | dma_alloc_pages(struct device *dev, gfp_t gfp, unsigned order) |
30 | { | 30 | { |
31 | struct page *page; | ||
32 | int node; | 31 | int node; |
33 | 32 | ||
34 | node = dev_to_node(dev); | 33 | node = dev_to_node(dev); |
35 | 34 | ||
36 | page = alloc_pages_node(node, gfp, order); | 35 | return alloc_pages_node(node, gfp, order); |
37 | return page ? page_address(page) : NULL; | ||
38 | } | 36 | } |
39 | 37 | ||
40 | #define dma_alloc_from_coherent_mem(dev, size, handle, ret) (0) | 38 | #define dma_alloc_from_coherent_mem(dev, size, handle, ret) (0) |
@@ -47,6 +45,7 @@ dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, | |||
47 | gfp_t gfp) | 45 | gfp_t gfp) |
48 | { | 46 | { |
49 | void *memory; | 47 | void *memory; |
48 | struct page *page; | ||
50 | unsigned long dma_mask = 0; | 49 | unsigned long dma_mask = 0; |
51 | u64 bus; | 50 | u64 bus; |
52 | 51 | ||
@@ -79,13 +78,14 @@ dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, | |||
79 | gfp |= GFP_DMA32; | 78 | gfp |= GFP_DMA32; |
80 | 79 | ||
81 | again: | 80 | again: |
82 | memory = dma_alloc_pages(dev, gfp, get_order(size)); | 81 | page = dma_alloc_pages(dev, gfp, get_order(size)); |
83 | if (memory == NULL) | 82 | if (page == NULL) |
84 | return NULL; | 83 | return NULL; |
85 | 84 | ||
86 | { | 85 | { |
87 | int high, mmu; | 86 | int high, mmu; |
88 | bus = virt_to_bus(memory); | 87 | bus = page_to_phys(page); |
88 | memory = page_address(page); | ||
89 | high = (bus + size) >= dma_mask; | 89 | high = (bus + size) >= dma_mask; |
90 | mmu = high; | 90 | mmu = high; |
91 | if (force_iommu && !(gfp & GFP_DMA)) | 91 | if (force_iommu && !(gfp & GFP_DMA)) |
@@ -112,7 +112,7 @@ dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, | |||
112 | 112 | ||
113 | memset(memory, 0, size); | 113 | memset(memory, 0, size); |
114 | if (!mmu) { | 114 | if (!mmu) { |
115 | *dma_handle = virt_to_bus(memory); | 115 | *dma_handle = bus; |
116 | return memory; | 116 | return memory; |
117 | } | 117 | } |
118 | } | 118 | } |