diff options
author | Jody McIntyre <scjody@modernduck.com> | 2005-11-30 00:45:31 -0500 |
---|---|---|
committer | Jody McIntyre <scjody@modernduck.com> | 2005-11-30 00:45:31 -0500 |
commit | 01fc99864ecc678c4f1f476b2a8b64ebcb14e733 (patch) | |
tree | 947696fdb2f76609d1a079aa6ff57a22e490d803 /lib/genalloc.c | |
parent | a880b11a95fab4618da412d99fc7365d723e702d (diff) | |
parent | d2ef5ebb4c4fe141a82252d4db8d8521e6765c5a (diff) |
Merge with http://kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
Diffstat (limited to 'lib/genalloc.c')
-rw-r--r-- | lib/genalloc.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/genalloc.c b/lib/genalloc.c index d6d30d2e7166..9ce0a6a3b85a 100644 --- a/lib/genalloc.c +++ b/lib/genalloc.c | |||
@@ -95,12 +95,10 @@ unsigned long gen_pool_alloc(struct gen_pool *poolp, int size) | |||
95 | if (size > max_chunk_size) | 95 | if (size > max_chunk_size) |
96 | return 0; | 96 | return 0; |
97 | 97 | ||
98 | i = 0; | ||
99 | |||
100 | size = max(size, 1 << ALLOC_MIN_SHIFT); | 98 | size = max(size, 1 << ALLOC_MIN_SHIFT); |
101 | s = roundup_pow_of_two(size); | 99 | i = fls(size - 1); |
102 | 100 | s = 1 << i; | |
103 | j = i; | 101 | j = i -= ALLOC_MIN_SHIFT; |
104 | 102 | ||
105 | spin_lock_irqsave(&poolp->lock, flags); | 103 | spin_lock_irqsave(&poolp->lock, flags); |
106 | while (!h[j].next) { | 104 | while (!h[j].next) { |
@@ -153,10 +151,10 @@ void gen_pool_free(struct gen_pool *poolp, unsigned long ptr, int size) | |||
153 | if (size > max_chunk_size) | 151 | if (size > max_chunk_size) |
154 | return; | 152 | return; |
155 | 153 | ||
156 | i = 0; | ||
157 | |||
158 | size = max(size, 1 << ALLOC_MIN_SHIFT); | 154 | size = max(size, 1 << ALLOC_MIN_SHIFT); |
159 | s = roundup_pow_of_two(size); | 155 | i = fls(size - 1); |
156 | s = 1 << i; | ||
157 | i -= ALLOC_MIN_SHIFT; | ||
160 | 158 | ||
161 | a = ptr; | 159 | a = ptr; |
162 | 160 | ||