aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/genalloc.h
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
committerJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
commit8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch)
treea8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /include/linux/genalloc.h
parent406089d01562f1e2bf9f089fd7637009ebaad589 (diff)
Patched in Tegra support.
Diffstat (limited to 'include/linux/genalloc.h')
-rw-r--r--include/linux/genalloc.h39
1 files changed, 11 insertions, 28 deletions
diff --git a/include/linux/genalloc.h b/include/linux/genalloc.h
index dd7c569aaca..ae9daa29395 100644
--- a/include/linux/genalloc.h
+++ b/include/linux/genalloc.h
@@ -29,20 +29,6 @@
29 29
30#ifndef __GENALLOC_H__ 30#ifndef __GENALLOC_H__
31#define __GENALLOC_H__ 31#define __GENALLOC_H__
32/**
33 * Allocation callback function type definition
34 * @map: Pointer to bitmap
35 * @size: The bitmap size in bits
36 * @start: The bitnumber to start searching at
37 * @nr: The number of zeroed bits we're looking for
38 * @data: optional additional data used by @genpool_algo_t
39 */
40typedef unsigned long (*genpool_algo_t)(unsigned long *map,
41 unsigned long size,
42 unsigned long start,
43 unsigned int nr,
44 void *data);
45
46/* 32/*
47 * General purpose special memory pool descriptor. 33 * General purpose special memory pool descriptor.
48 */ 34 */
@@ -50,9 +36,6 @@ struct gen_pool {
50 spinlock_t lock; 36 spinlock_t lock;
51 struct list_head chunks; /* list of chunks in this pool */ 37 struct list_head chunks; /* list of chunks in this pool */
52 int min_alloc_order; /* minimum allocation order */ 38 int min_alloc_order; /* minimum allocation order */
53
54 genpool_algo_t algo; /* allocation function */
55 void *data;
56}; 39};
57 40
58/* 41/*
@@ -89,20 +72,20 @@ static inline int gen_pool_add(struct gen_pool *pool, unsigned long addr,
89 return gen_pool_add_virt(pool, addr, -1, size, nid); 72 return gen_pool_add_virt(pool, addr, -1, size, nid);
90} 73}
91extern void gen_pool_destroy(struct gen_pool *); 74extern void gen_pool_destroy(struct gen_pool *);
92extern unsigned long gen_pool_alloc(struct gen_pool *, size_t); 75extern unsigned long gen_pool_alloc_addr(struct gen_pool *,
76 size_t, unsigned long);
77/**
78 * gen_pool_alloc - allocate special memory from the pool
79 * @pool: pool to allocate from
80 * @size: number of bytes to allocate from the pool
81 */
82static inline unsigned long gen_pool_alloc(struct gen_pool *pool, size_t size)
83{
84 return gen_pool_alloc_addr(pool, size, 0);
85}
93extern void gen_pool_free(struct gen_pool *, unsigned long, size_t); 86extern void gen_pool_free(struct gen_pool *, unsigned long, size_t);
94extern void gen_pool_for_each_chunk(struct gen_pool *, 87extern void gen_pool_for_each_chunk(struct gen_pool *,
95 void (*)(struct gen_pool *, struct gen_pool_chunk *, void *), void *); 88 void (*)(struct gen_pool *, struct gen_pool_chunk *, void *), void *);
96extern size_t gen_pool_avail(struct gen_pool *); 89extern size_t gen_pool_avail(struct gen_pool *);
97extern size_t gen_pool_size(struct gen_pool *); 90extern size_t gen_pool_size(struct gen_pool *);
98
99extern void gen_pool_set_algo(struct gen_pool *pool, genpool_algo_t algo,
100 void *data);
101
102extern unsigned long gen_pool_first_fit(unsigned long *map, unsigned long size,
103 unsigned long start, unsigned int nr, void *data);
104
105extern unsigned long gen_pool_best_fit(unsigned long *map, unsigned long size,
106 unsigned long start, unsigned int nr, void *data);
107
108#endif /* __GENALLOC_H__ */ 91#endif /* __GENALLOC_H__ */