diff options
| author | Jiri Kosina <jkosina@suse.cz> | 2010-08-04 09:14:38 -0400 |
|---|---|---|
| committer | Jiri Kosina <jkosina@suse.cz> | 2010-08-04 09:14:38 -0400 |
| commit | d790d4d583aeaed9fc6f8a9f4d9f8ce6b1c15c7f (patch) | |
| tree | 854ab394486288d40fa8179cbfaf66e8bdc44b0f /lib | |
| parent | 73b2c7165b76b20eb1290e7efebc33cfd21db1ca (diff) | |
| parent | 3a09b1be53d23df780a0cd0e4087a05e2ca4a00c (diff) | |
Merge branch 'master' into for-next
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/Kconfig | 3 | ||||
| -rw-r--r-- | lib/Makefile | 2 | ||||
| -rw-r--r-- | lib/atomic64_test.c | 2 | ||||
| -rw-r--r-- | lib/dynamic_debug.c | 2 | ||||
| -rw-r--r-- | lib/genalloc.c | 1 | ||||
| -rw-r--r-- | lib/idr.c | 4 | ||||
| -rw-r--r-- | lib/lmb.c | 541 | ||||
| -rw-r--r-- | lib/rbtree.c | 116 |
8 files changed, 76 insertions, 595 deletions
diff --git a/lib/Kconfig b/lib/Kconfig index 170d8ca901d8..5b916bc0fbae 100644 --- a/lib/Kconfig +++ b/lib/Kconfig | |||
| @@ -181,9 +181,6 @@ config HAS_DMA | |||
| 181 | config CHECK_SIGNATURE | 181 | config CHECK_SIGNATURE |
| 182 | bool | 182 | bool |
| 183 | 183 | ||
| 184 | config HAVE_LMB | ||
| 185 | boolean | ||
| 186 | |||
| 187 | config CPUMASK_OFFSTACK | 184 | config CPUMASK_OFFSTACK |
| 188 | bool "Force CPU masks off stack" if DEBUG_PER_CPU_MAPS | 185 | bool "Force CPU masks off stack" if DEBUG_PER_CPU_MAPS |
| 189 | help | 186 | help |
diff --git a/lib/Makefile b/lib/Makefile index 3f1062cbbff4..0bfabba1bb32 100644 --- a/lib/Makefile +++ b/lib/Makefile | |||
| @@ -89,8 +89,6 @@ obj-$(CONFIG_CPU_NOTIFIER_ERROR_INJECT) += cpu-notifier-error-inject.o | |||
| 89 | 89 | ||
| 90 | lib-$(CONFIG_GENERIC_BUG) += bug.o | 90 | lib-$(CONFIG_GENERIC_BUG) += bug.o |
| 91 | 91 | ||
| 92 | obj-$(CONFIG_HAVE_LMB) += lmb.o | ||
| 93 | |||
| 94 | obj-$(CONFIG_HAVE_ARCH_TRACEHOOK) += syscall.o | 92 | obj-$(CONFIG_HAVE_ARCH_TRACEHOOK) += syscall.o |
| 95 | 93 | ||
| 96 | obj-$(CONFIG_DYNAMIC_DEBUG) += dynamic_debug.o | 94 | obj-$(CONFIG_DYNAMIC_DEBUG) += dynamic_debug.o |
diff --git a/lib/atomic64_test.c b/lib/atomic64_test.c index 250ed11d3ed2..44524cc8c32a 100644 --- a/lib/atomic64_test.c +++ b/lib/atomic64_test.c | |||
| @@ -114,7 +114,7 @@ static __init int test_atomic64(void) | |||
| 114 | BUG_ON(v.counter != r); | 114 | BUG_ON(v.counter != r); |
| 115 | 115 | ||
| 116 | #if defined(CONFIG_X86) || defined(CONFIG_MIPS) || defined(CONFIG_PPC) || \ | 116 | #if defined(CONFIG_X86) || defined(CONFIG_MIPS) || defined(CONFIG_PPC) || \ |
| 117 | defined(CONFIG_S390) || defined(_ASM_GENERIC_ATOMIC64_H) | 117 | defined(CONFIG_S390) || defined(_ASM_GENERIC_ATOMIC64_H) || defined(CONFIG_ARM) |
| 118 | INIT(onestwos); | 118 | INIT(onestwos); |
| 119 | BUG_ON(atomic64_dec_if_positive(&v) != (onestwos - 1)); | 119 | BUG_ON(atomic64_dec_if_positive(&v) != (onestwos - 1)); |
| 120 | r -= one; | 120 | r -= one; |
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 3df8eb17a607..02afc2533728 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c | |||
| @@ -692,7 +692,7 @@ static void ddebug_table_free(struct ddebug_table *dt) | |||
| 692 | * Called in response to a module being unloaded. Removes | 692 | * Called in response to a module being unloaded. Removes |
| 693 | * any ddebug_table's which point at the module. | 693 | * any ddebug_table's which point at the module. |
| 694 | */ | 694 | */ |
| 695 | int ddebug_remove_module(char *mod_name) | 695 | int ddebug_remove_module(const char *mod_name) |
| 696 | { | 696 | { |
| 697 | struct ddebug_table *dt, *nextdt; | 697 | struct ddebug_table *dt, *nextdt; |
| 698 | int ret = -ENOENT; | 698 | int ret = -ENOENT; |
diff --git a/lib/genalloc.c b/lib/genalloc.c index 736c3b06398e..1923f1490e72 100644 --- a/lib/genalloc.c +++ b/lib/genalloc.c | |||
| @@ -128,7 +128,6 @@ unsigned long gen_pool_alloc(struct gen_pool *pool, size_t size) | |||
| 128 | chunk = list_entry(_chunk, struct gen_pool_chunk, next_chunk); | 128 | chunk = list_entry(_chunk, struct gen_pool_chunk, next_chunk); |
| 129 | 129 | ||
| 130 | end_bit = (chunk->end_addr - chunk->start_addr) >> order; | 130 | end_bit = (chunk->end_addr - chunk->start_addr) >> order; |
| 131 | end_bit -= nbits + 1; | ||
| 132 | 131 | ||
| 133 | spin_lock_irqsave(&chunk->lock, flags); | 132 | spin_lock_irqsave(&chunk->lock, flags); |
| 134 | start_bit = bitmap_find_next_zero_area(chunk->bits, end_bit, 0, | 133 | start_bit = bitmap_find_next_zero_area(chunk->bits, end_bit, 0, |
| @@ -602,7 +602,7 @@ void *idr_get_next(struct idr *idp, int *nextidp) | |||
| 602 | /* find first ent */ | 602 | /* find first ent */ |
| 603 | n = idp->layers * IDR_BITS; | 603 | n = idp->layers * IDR_BITS; |
| 604 | max = 1 << n; | 604 | max = 1 << n; |
| 605 | p = rcu_dereference(idp->top); | 605 | p = rcu_dereference_raw(idp->top); |
| 606 | if (!p) | 606 | if (!p) |
| 607 | return NULL; | 607 | return NULL; |
| 608 | 608 | ||
| @@ -610,7 +610,7 @@ void *idr_get_next(struct idr *idp, int *nextidp) | |||
| 610 | while (n > 0 && p) { | 610 | while (n > 0 && p) { |
| 611 | n -= IDR_BITS; | 611 | n -= IDR_BITS; |
| 612 | *paa++ = p; | 612 | *paa++ = p; |
| 613 | p = rcu_dereference(p->ary[(id >> n) & IDR_MASK]); | 613 | p = rcu_dereference_raw(p->ary[(id >> n) & IDR_MASK]); |
| 614 | } | 614 | } |
| 615 | 615 | ||
| 616 | if (p) { | 616 | if (p) { |
diff --git a/lib/lmb.c b/lib/lmb.c deleted file mode 100644 index b1fc52606524..000000000000 --- a/lib/lmb.c +++ /dev/null | |||
| @@ -1,541 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * Procedures for maintaining information about logical memory blocks. | ||
| 3 | * | ||
| 4 | * Peter Bergner, IBM Corp. June 2001. | ||
| 5 | * Copyright (C) 2001 Peter Bergner. | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or | ||
| 8 | * modify it under the terms of the GNU General Public License | ||
| 9 | * as published by the Free Software Foundation; either version | ||
| 10 | * 2 of the License, or (at your option) any later version. | ||
| 11 | */ | ||
| 12 | |||
| 13 | #include <linux/kernel.h> | ||
| 14 | #include <linux/init.h> | ||
| 15 | #include <linux/bitops.h> | ||
| 16 | #include <linux/lmb.h> | ||
| 17 | |||
| 18 | #define LMB_ALLOC_ANYWHERE 0 | ||
| 19 | |||
| 20 | struct lmb lmb; | ||
| 21 | |||
| 22 | static int lmb_debug; | ||
| 23 | |||
| 24 | static int __init early_lmb(char *p) | ||
| 25 | { | ||
| 26 | if (p && strstr(p, "debug")) | ||
| 27 | lmb_debug = 1; | ||
| 28 | return 0; | ||
| 29 | } | ||
| 30 | early_param("lmb", early_lmb); | ||
| 31 | |||
| 32 | static void lmb_dump(struct lmb_region *region, char *name) | ||
| 33 | { | ||
| 34 | unsigned long long base, size; | ||
| 35 | int i; | ||
| 36 | |||
| 37 | pr_info(" %s.cnt = 0x%lx\n", name, region->cnt); | ||
| 38 | |||
| 39 | for (i = 0; i < region->cnt; i++) { | ||
| 40 | base = region->region[i].base; | ||
| 41 | size = region->region[i].size; | ||
| 42 | |||
| 43 | pr_info(" %s[0x%x]\t0x%016llx - 0x%016llx, 0x%llx bytes\n", | ||
| 44 | name, i, base, base + size - 1, size); | ||
| 45 | } | ||
| 46 | } | ||
| 47 | |||
| 48 | void lmb_dump_all(void) | ||
| 49 | { | ||
| 50 | if (!lmb_debug) | ||
| 51 | return; | ||
| 52 | |||
| 53 | pr_info("LMB configuration:\n"); | ||
| 54 | pr_info(" rmo_size = 0x%llx\n", (unsigned long long)lmb.rmo_size); | ||
| 55 | pr_info(" memory.size = 0x%llx\n", (unsigned long long)lmb.memory.size); | ||
| 56 | |||
| 57 | lmb_dump(&lmb.memory, "memory"); | ||
| 58 | lmb_dump(&lmb.reserved, "reserved"); | ||
| 59 | } | ||
| 60 | |||
| 61 | static unsigned long lmb_addrs_overlap(u64 base1, u64 size1, u64 base2, | ||
| 62 | u64 size2) | ||
| 63 | { | ||
| 64 | return ((base1 < (base2 + size2)) && (base2 < (base1 + size1))); | ||
| 65 | } | ||
| 66 | |||
| 67 | static long lmb_addrs_adjacent(u64 base1, u64 size1, u64 base2, u64 size2) | ||
| 68 | { | ||
| 69 | if (base2 == base1 + size1) | ||
| 70 | return 1; | ||
| 71 | else if (base1 == base2 + size2) | ||
| 72 | return -1; | ||
| 73 | |||
| 74 | return 0; | ||
| 75 | } | ||
| 76 | |||
| 77 | static long lmb_regions_adjacent(struct lmb_region *rgn, | ||
| 78 | unsigned long r1, unsigned long r2) | ||
| 79 | { | ||
| 80 | u64 base1 = rgn->region[r1].base; | ||
| 81 | u64 size1 = rgn->region[r1].size; | ||
| 82 | u64 base2 = rgn->region[r2].base; | ||
| 83 | u64 size2 = rgn->region[r2].size; | ||
| 84 | |||
| 85 | return lmb_addrs_adjacent(base1, size1, base2, size2); | ||
| 86 | } | ||
| 87 | |||
| 88 | static void lmb_remove_region(struct lmb_region *rgn, unsigned long r) | ||
| 89 | { | ||
| 90 | unsigned long i; | ||
| 91 | |||
| 92 | for (i = r; i < rgn->cnt - 1; i++) { | ||
| 93 | rgn->region[i].base = rgn->region[i + 1].base; | ||
| 94 | rgn->region[i].size = rgn->region[i + 1].size; | ||
| 95 | } | ||
| 96 | rgn->cnt--; | ||
| 97 | } | ||
| 98 | |||
| 99 | /* Assumption: base addr of region 1 < base addr of region 2 */ | ||
| 100 | static void lmb_coalesce_regions(struct lmb_region *rgn, | ||
| 101 | unsigned long r1, unsigned long r2) | ||
| 102 | { | ||
| 103 | rgn->region[r1].size += rgn->region[r2].size; | ||
| 104 | lmb_remove_region(rgn, r2); | ||
| 105 | } | ||
| 106 | |||
| 107 | void __init lmb_init(void) | ||
