[PATCH] dvb: saa7134-dvb must select tda1004x
[linux-ginger.git] / include / linux / genalloc.h
blob7fd0576a445426f534b7580125dddede7d43375e
1 /*
2 * Basic general purpose allocator for managing special purpose memory
3 * not managed by the regular kmalloc/kfree interface.
4 * Uses for this includes on-device special memory, uncached memory
5 * etc.
7 * This code is based on the buddy allocator found in the sym53c8xx_2
8 * driver, adapted for general purpose use.
10 * This source code is licensed under the GNU General Public License,
11 * Version 2. See the file COPYING for more details.
14 #include <linux/spinlock.h>
16 #define ALLOC_MIN_SHIFT 5 /* 32 bytes minimum */
18 * Link between free memory chunks of a given size.
20 struct gen_pool_link {
21 struct gen_pool_link *next;
25 * Memory pool descriptor.
27 struct gen_pool {
28 spinlock_t lock;
29 unsigned long (*get_new_chunk)(struct gen_pool *);
30 struct gen_pool *next;
31 struct gen_pool_link *h;
32 unsigned long private;
33 int max_chunk_shift;
36 unsigned long gen_pool_alloc(struct gen_pool *poolp, int size);
37 void gen_pool_free(struct gen_pool *mp, unsigned long ptr, int size);
38 struct gen_pool *gen_pool_create(int nr_chunks, int max_chunk_shift,
39 unsigned long (*fp)(struct gen_pool *),
40 unsigned long data);