Commit 4a48e29f authored by James Bottomley's avatar James Bottomley Committed by Linus Torvalds

[PATCH] dma_get_required_mask() build fix

This new function fails to build on sparc64 due to nasty include
dependencies.

Fix that by uninlining it - it was too big for inlining anyway.
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 55228659
......@@ -13,6 +13,8 @@
#include <linux/device.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/dma-mapping.h>
#include <linux/bootmem.h>
struct device platform_bus = {
.bus_id = "platform",
......@@ -210,6 +212,28 @@ int __init platform_bus_init(void)
return bus_register(&platform_bus_type);
}
#ifndef ARCH_HAS_DMA_GET_REQUIRED_MASK
u64 dma_get_required_mask(struct device *dev)
{
u32 low_totalram = ((max_pfn - 1) << PAGE_SHIFT);
u32 high_totalram = ((max_pfn - 1) >> (32 - PAGE_SHIFT));
u64 mask;
if (!high_totalram) {
/* convert to mask just covering totalram */
low_totalram = (1 << (fls(low_totalram) - 1));
low_totalram += low_totalram - 1;
mask = low_totalram;
} else {
high_totalram = (1 << (fls(high_totalram) - 1));
high_totalram += high_totalram - 1;
mask = (((u64)high_totalram) << 32) + 0xffffffff;
}
return mask & *dev->dma_mask;
}
EXPORT_SYMBOL(dma_get_required_mask);
#endif
EXPORT_SYMBOL(platform_bus);
EXPORT_SYMBOL(platform_bus_type);
EXPORT_SYMBOL(platform_device_register);
......
......@@ -19,28 +19,7 @@ enum dma_data_direction {
#define dma_sync_single dma_sync_single_for_cpu
#define dma_sync_sg dma_sync_sg_for_cpu
#ifndef ARCH_HAS_DMA_GET_REQUIRED_MASK
static inline u64 dma_get_required_mask(struct device *dev)
{
extern unsigned long max_pfn; /* defined in bootmem.h but may
not be included */
u32 low_totalram = ((max_pfn - 1) << PAGE_SHIFT);
u32 high_totalram = ((max_pfn - 1) >> (32 - PAGE_SHIFT));
u64 mask;
if (!high_totalram) {
/* convert to mask just covering totalram */
low_totalram = (1 << (fls(low_totalram) - 1));
low_totalram += low_totalram - 1;
mask = low_totalram;
} else {
high_totalram = (1 << (fls(high_totalram) - 1));
high_totalram += high_totalram - 1;
mask = (((u64)high_totalram) << 32) + 0xffffffff;
}
return mask & *dev->dma_mask;
}
#endif
extern u64 dma_get_required_mask(struct device *dev);
#endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment