Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 336518
b: refs/heads/master
c: 4009793
h: refs/heads/master
v: v3
  • Loading branch information
Vitaly Andrianov authored and Marek Szyprowski committed Dec 11, 2012
1 parent 29b76de commit c630146
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 17 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 387870f2d6d679746020fa8e25ef786ff338dc98
refs/heads/master: 4009793e15d44469da1547a46ab129cc08ffa503
24 changes: 10 additions & 14 deletions trunk/drivers/base/dma-contiguous.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ struct cma *dma_contiguous_default_area;
* Users, who want to set the size of global CMA area for their system
* should use cma= kernel parameter.
*/
static const unsigned long size_bytes = CMA_SIZE_MBYTES * SZ_1M;
static long size_cmdline = -1;
static const phys_addr_t size_bytes = CMA_SIZE_MBYTES * SZ_1M;
static phys_addr_t size_cmdline = -1;

static int __init early_cma(char *p)
{
Expand All @@ -70,7 +70,7 @@ early_param("cma", early_cma);

#ifdef CONFIG_CMA_SIZE_PERCENTAGE

static unsigned long __init __maybe_unused cma_early_percent_memory(void)
static phys_addr_t __init __maybe_unused cma_early_percent_memory(void)
{
struct memblock_region *reg;
unsigned long total_pages = 0;
Expand All @@ -88,7 +88,7 @@ static unsigned long __init __maybe_unused cma_early_percent_memory(void)

#else

static inline __maybe_unused unsigned long cma_early_percent_memory(void)
static inline __maybe_unused phys_addr_t cma_early_percent_memory(void)
{
return 0;
}
Expand All @@ -106,7 +106,7 @@ static inline __maybe_unused unsigned long cma_early_percent_memory(void)
*/
void __init dma_contiguous_reserve(phys_addr_t limit)
{
unsigned long selected_size = 0;
phys_addr_t selected_size = 0;

pr_debug("%s(limit %08lx)\n", __func__, (unsigned long)limit);

Expand All @@ -126,7 +126,7 @@ void __init dma_contiguous_reserve(phys_addr_t limit)

if (selected_size) {
pr_debug("%s: reserving %ld MiB for global area\n", __func__,
selected_size / SZ_1M);
(unsigned long)selected_size / SZ_1M);

dma_declare_contiguous(NULL, selected_size, 0, limit);
}
Expand Down Expand Up @@ -227,11 +227,11 @@ core_initcall(cma_init_reserved_areas);
* called by board specific code when early allocator (memblock or bootmem)
* is still activate.
*/
int __init dma_declare_contiguous(struct device *dev, unsigned long size,
int __init dma_declare_contiguous(struct device *dev, phys_addr_t size,
phys_addr_t base, phys_addr_t limit)
{
struct cma_reserved *r = &cma_reserved[cma_reserved_count];
unsigned long alignment;
phys_addr_t alignment;

pr_debug("%s(size %lx, base %08lx, limit %08lx)\n", __func__,
(unsigned long)size, (unsigned long)base,
Expand Down Expand Up @@ -268,10 +268,6 @@ int __init dma_declare_contiguous(struct device *dev, unsigned long size,
if (!addr) {
base = -ENOMEM;
goto err;
} else if (addr + size > ~(unsigned long)0) {
memblock_free(addr, size);
base = -EINVAL;
goto err;
} else {
base = addr;
}
Expand All @@ -285,14 +281,14 @@ int __init dma_declare_contiguous(struct device *dev, unsigned long size,
r->size = size;
r->dev = dev;
cma_reserved_count++;
pr_info("CMA: reserved %ld MiB at %08lx\n", size / SZ_1M,
pr_info("CMA: reserved %ld MiB at %08lx\n", (unsigned long)size / SZ_1M,
(unsigned long)base);

/* Architecture specific contiguous memory fixup. */
dma_contiguous_early_fixup(base, size);
return 0;
err:
pr_err("CMA: failed to reserve %ld MiB\n", size / SZ_1M);
pr_err("CMA: failed to reserve %ld MiB\n", (unsigned long)size / SZ_1M);
return base;
}

Expand Down
4 changes: 2 additions & 2 deletions trunk/include/linux/dma-contiguous.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ struct device;
extern struct cma *dma_contiguous_default_area;

void dma_contiguous_reserve(phys_addr_t addr_limit);
int dma_declare_contiguous(struct device *dev, unsigned long size,
int dma_declare_contiguous(struct device *dev, phys_addr_t size,
phys_addr_t base, phys_addr_t limit);

struct page *dma_alloc_from_contiguous(struct device *dev, int count,
Expand All @@ -83,7 +83,7 @@ bool dma_release_from_contiguous(struct device *dev, struct page *pages,
static inline void dma_contiguous_reserve(phys_addr_t limit) { }

static inline
int dma_declare_contiguous(struct device *dev, unsigned long size,
int dma_declare_contiguous(struct device *dev, phys_addr_t size,
phys_addr_t base, phys_addr_t limit)
{
return -ENOSYS;
Expand Down

0 comments on commit c630146

Please sign in to comment.