diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2009-11-19 11:46:02 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2009-11-24 12:41:35 -0500 |
commit | 88c58f3b92bc7c26439802c300d39b6377739d81 (patch) | |
tree | ffcc5f555fb871a3a5e7d8b5a17757563b43a5df /arch/arm/mm/dma-mapping.c | |
parent | 695ae0af5a52df09dffcc2ce2d625d56ef36ce14 (diff) |
ARM: dma-mapping: move consistent_init into CONFIG_MMU section
No point wrapping the contents of this function with #ifdef CONFIG_MMU
when we can place it and the core_initcall() entirely within the
existing conditional block.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Acked-by: Greg Ungerer <gerg@uclinux.org>
Diffstat (limited to 'arch/arm/mm/dma-mapping.c')
-rw-r--r-- | arch/arm/mm/dma-mapping.c | 78 |
1 files changed, 38 insertions, 40 deletions
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index 6b24e5ed85c2..19357f76ce89 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c | |||
@@ -144,6 +144,44 @@ static struct arm_vmregion_head consistent_head = { | |||
144 | #error ARM Coherent DMA allocator does not (yet) support huge TLB | 144 | #error ARM Coherent DMA allocator does not (yet) support huge TLB |
145 | #endif | 145 | #endif |
146 | 146 | ||
147 | /* | ||
148 | * Initialise the consistent memory allocation. | ||
149 | */ | ||
150 | static int __init consistent_init(void) | ||
151 | { | ||
152 | int ret = 0; | ||
153 | pgd_t *pgd; | ||
154 | pmd_t *pmd; | ||
155 | pte_t *pte; | ||
156 | int i = 0; | ||
157 | u32 base = CONSISTENT_BASE; | ||
158 | |||
159 | do { | ||
160 | pgd = pgd_offset(&init_mm, base); | ||
161 | pmd = pmd_alloc(&init_mm, pgd, base); | ||
162 | if (!pmd) { | ||
163 | printk(KERN_ERR "%s: no pmd tables\n", __func__); | ||
164 | ret = -ENOMEM; | ||
165 | break; | ||
166 | } | ||
167 | WARN_ON(!pmd_none(*pmd)); | ||
168 | |||
169 | pte = pte_alloc_kernel(pmd, base); | ||
170 | if (!pte) { | ||
171 | printk(KERN_ERR "%s: no pte tables\n", __func__); | ||
172 | ret = -ENOMEM; | ||
173 | break; | ||
174 | } | ||
175 | |||
176 | consistent_pte[i++] = pte; | ||
177 | base += (1 << PGDIR_SHIFT); | ||
178 | } while (base < CONSISTENT_END); | ||
179 | |||
180 | return ret; | ||
181 | } | ||
182 | |||
183 | core_initcall(consistent_init); | ||
184 | |||
147 | static void * | 185 | static void * |
148 | __dma_alloc(struct device *dev, size_t size, dma_addr_t *handle, gfp_t gfp, | 186 | __dma_alloc(struct device *dev, size_t size, dma_addr_t *handle, gfp_t gfp, |
149 | pgprot_t prot) | 187 | pgprot_t prot) |
@@ -400,46 +438,6 @@ void dma_free_coherent(struct device *dev, size_t size, void *cpu_addr, dma_addr | |||
400 | EXPORT_SYMBOL(dma_free_coherent); | 438 | EXPORT_SYMBOL(dma_free_coherent); |
401 | 439 | ||
402 | /* | 440 | /* |
403 | * Initialise the consistent memory allocation. | ||
404 | */ | ||
405 | static int __init consistent_init(void) | ||
406 | { | ||
407 | int ret = 0; | ||
408 | #ifdef CONFIG_MMU | ||
409 | pgd_t *pgd; | ||
410 | pmd_t *pmd; | ||
411 | pte_t *pte; | ||
412 | int i = 0; | ||
413 | u32 base = CONSISTENT_BASE; | ||
414 | |||
415 | do { | ||
416 | pgd = pgd_offset(&init_mm, base); | ||
417 | pmd = pmd_alloc(&init_mm, pgd, base); | ||
418 | if (!pmd) { | ||
419 | printk(KERN_ERR "%s: no pmd tables\n", __func__); | ||
420 | ret = -ENOMEM; | ||
421 | break; | ||
422 | } | ||
423 | WARN_ON(!pmd_none(*pmd)); | ||
424 | |||
425 | pte = pte_alloc_kernel(pmd, base); | ||
426 | if (!pte) { | ||
427 | printk(KERN_ERR "%s: no pte tables\n", __func__); | ||
428 | ret = -ENOMEM; | ||
429 | break; | ||
430 | } | ||
431 | |||
432 | consistent_pte[i++] = pte; | ||
433 | base += (1 << PGDIR_SHIFT); | ||
434 | } while (base < CONSISTENT_END); | ||
435 | #endif /* !CONFIG_MMU */ | ||
436 | |||
437 | return ret; | ||
438 | } | ||
439 | |||
440 | core_initcall(consistent_init); | ||
441 | |||
442 | /* | ||
443 | * Make an area consistent for devices. | 441 | * Make an area consistent for devices. |
444 | * Note: Drivers should NOT use this function directly, as it will break | 442 | * Note: Drivers should NOT use this function directly, as it will break |
445 | * platforms with CONFIG_DMABOUNCE. | 443 | * platforms with CONFIG_DMABOUNCE. |