diff options
| author | Steven Whitehouse <swhiteho@redhat.com> | 2006-09-28 08:29:59 -0400 |
|---|---|---|
| committer | Steven Whitehouse <swhiteho@redhat.com> | 2006-09-28 08:29:59 -0400 |
| commit | 185a257f2f73bcd89050ad02da5bedbc28fc43fa (patch) | |
| tree | 5e32586114534ed3f2165614cba3d578f5d87307 /lib | |
| parent | 3f1a9aaeffd8d1cbc5ab9776c45cbd66af1c9699 (diff) | |
| parent | a77c64c1a641950626181b4857abb701d8f38ccc (diff) | |
Merge branch 'master' into gfs2
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/Kconfig.debug | 13 | ||||
| -rw-r--r-- | lib/hweight.c | 10 | ||||
| -rw-r--r-- | lib/klist.c | 26 | ||||
| -rw-r--r-- | lib/kobject.c | 9 |
4 files changed, 41 insertions, 17 deletions
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 554ee688a9f8..b0f5ca72599f 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug | |||
| @@ -8,6 +8,13 @@ config PRINTK_TIME | |||
| 8 | operations. This is useful for identifying long delays | 8 | operations. This is useful for identifying long delays |
| 9 | in kernel startup. | 9 | in kernel startup. |
| 10 | 10 | ||
| 11 | config ENABLE_MUST_CHECK | ||
| 12 | bool "Enable __must_check logic" | ||
| 13 | default y | ||
| 14 | help | ||
| 15 | Enable the __must_check logic in the kernel build. Disable this to | ||
| 16 | suppress the "warning: ignoring return value of 'foo', declared with | ||
| 17 | attribute warn_unused_result" messages. | ||
| 11 | 18 | ||
| 12 | config MAGIC_SYSRQ | 19 | config MAGIC_SYSRQ |
| 13 | bool "Magic SysRq key" | 20 | bool "Magic SysRq key" |
| @@ -218,7 +225,7 @@ config LOCKDEP | |||
| 218 | bool | 225 | bool |
| 219 | depends on DEBUG_KERNEL && TRACE_IRQFLAGS_SUPPORT && STACKTRACE_SUPPORT && LOCKDEP_SUPPORT | 226 | depends on DEBUG_KERNEL && TRACE_IRQFLAGS_SUPPORT && STACKTRACE_SUPPORT && LOCKDEP_SUPPORT |
| 220 | select STACKTRACE | 227 | select STACKTRACE |
| 221 | select FRAME_POINTER | 228 | select FRAME_POINTER if !X86 |
| 222 | select KALLSYMS | 229 | select KALLSYMS |
| 223 | select KALLSYMS_ALL | 230 | select KALLSYMS_ALL |
| 224 | 231 | ||
| @@ -277,7 +284,7 @@ config DEBUG_HIGHMEM | |||
| 277 | config DEBUG_BUGVERBOSE | 284 | config DEBUG_BUGVERBOSE |
| 278 | bool "Verbose BUG() reporting (adds 70K)" if DEBUG_KERNEL && EMBEDDED | 285 | bool "Verbose BUG() reporting (adds 70K)" if DEBUG_KERNEL && EMBEDDED |
| 279 | depends on BUG | 286 | depends on BUG |
| 280 | depends on ARM || ARM26 || M32R || M68K || SPARC32 || SPARC64 || X86_32 || FRV | 287 | depends on ARM || ARM26 || AVR32 || M32R || M68K || SPARC32 || SPARC64 || X86_32 || FRV || SUPERH |
| 281 | default !EMBEDDED | 288 | default !EMBEDDED |
| 282 | help | 289 | help |
| 283 | Say Y here to make BUG() panics output the file name and line number | 290 | Say Y here to make BUG() panics output the file name and line number |
| @@ -315,7 +322,7 @@ config DEBUG_VM | |||
| 315 | 322 | ||
| 316 | config FRAME_POINTER | 323 | config FRAME_POINTER |
| 317 | bool "Compile the kernel with frame pointers" | 324 | bool "Compile the kernel with frame pointers" |
| 318 | depends on DEBUG_KERNEL && (X86 || CRIS || M68K || M68KNOMMU || FRV || UML || S390) | 325 | depends on DEBUG_KERNEL && (X86 || CRIS || M68K || M68KNOMMU || FRV || UML || S390 || AVR32 || SUPERH) |
| 319 | default y if DEBUG_INFO && UML | 326 | default y if DEBUG_INFO && UML |
| 320 | help | 327 | help |
| 321 | If you say Y here the resulting kernel image will be slightly larger | 328 | If you say Y here the resulting kernel image will be slightly larger |
diff --git a/lib/hweight.c b/lib/hweight.c index 438257671708..360556a7803d 100644 --- a/lib/hweight.c +++ b/lib/hweight.c | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | #include <linux/module.h> | 1 | #include <linux/module.h> |
| 2 | #include <asm/types.h> | 2 | #include <asm/types.h> |
| 3 | #include <asm/bitops.h> | ||
| 3 | 4 | ||
| 4 | /** | 5 | /** |
| 5 | * hweightN - returns the hamming weight of a N-bit word | 6 | * hweightN - returns the hamming weight of a N-bit word |
| @@ -40,14 +41,19 @@ unsigned long hweight64(__u64 w) | |||
| 40 | #if BITS_PER_LONG == 32 | 41 | #if BITS_PER_LONG == 32 |
| 41 | return hweight32((unsigned int)(w >> 32)) + hweight32((unsigned int)w); | 42 | return hweight32((unsigned int)(w >> 32)) + hweight32((unsigned int)w); |
| 42 | #elif BITS_PER_LONG == 64 | 43 | #elif BITS_PER_LONG == 64 |
| 44 | #ifdef ARCH_HAS_FAST_MULTIPLIER | ||
| 45 | w -= (w >> 1) & 0x5555555555555555ul; | ||
| 46 | w = (w & 0x3333333333333333ul) + ((w >> 2) & 0x3333333333333333ul); | ||
| 47 | w = (w + (w >> 4)) & 0x0f0f0f0f0f0f0f0ful; | ||
| 48 | return (w * 0x0101010101010101ul) >> 56; | ||
| 49 | #else | ||
| 43 | __u64 res = w - ((w >> 1) & 0x5555555555555555ul); | 50 | __u64 res = w - ((w >> 1) & 0x5555555555555555ul); |
| 44 | res = (res & 0x3333333333333333ul) + ((res >> 2) & 0x3333333333333333ul); | 51 | res = (res & 0x3333333333333333ul) + ((res >> 2) & 0x3333333333333333ul); |
| 45 | res = (res + (res >> 4)) & 0x0F0F0F0F0F0F0F0Ful; | 52 | res = (res + (res >> 4)) & 0x0F0F0F0F0F0F0F0Ful; |
| 46 | res = res + (res >> 8); | 53 | res = res + (res >> 8); |
| 47 | res = res + (res >> 16); | 54 | res = res + (res >> 16); |
| 48 | return (res + (res >> 32)) & 0x00000000000000FFul; | 55 | return (res + (res >> 32)) & 0x00000000000000FFul; |
| 49 | #else | 56 | #endif |
| 50 | #error BITS_PER_LONG not defined | ||
| 51 | #endif | 57 | #endif |
| 52 | } | 58 | } |
| 53 | EXPORT_SYMBOL(hweight64); | 59 | EXPORT_SYMBOL(hweight64); |
diff --git a/lib/klist.c b/lib/klist.c index 9c94f0b163a1..120bd175aa78 100644 --- a/lib/klist.c +++ b/lib/klist.c | |||
| @@ -123,12 +123,10 @@ EXPORT_SYMBOL_GPL(klist_add_tail); | |||
| 123 | static void klist_release(struct kref * kref) | 123 | static void klist_release(struct kref * kref) |
| 124 | { | 124 | { |
| 125 | struct klist_node * n = container_of(kref, struct klist_node, n_ref); | 125 | struct klist_node * n = container_of(kref, struct klist_node, n_ref); |
| 126 | void (*put)(struct klist_node *) = n->n_klist->put; | 126 | |
| 127 | list_del(&n->n_node); | 127 | list_del(&n->n_node); |
| 128 | complete(&n->n_removed); | 128 | complete(&n->n_removed); |
| 129 | n->n_klist = NULL; | 129 | n->n_klist = NULL; |
| 130 | if (put) | ||
| 131 | put(n); | ||
| 132 | } | 130 | } |
| 133 | 131 | ||
| 134 | static int klist_dec_and_del(struct klist_node * n) | 132 | static int klist_dec_and_del(struct klist_node * n) |
| @@ -145,10 +143,14 @@ static int klist_dec_and_del(struct klist_node * n) | |||
| 145 | void klist_del(struct klist_node * n) | 143 | void klist_del(struct klist_node * n) |
| 146 | { | 144 | { |
| 147 | struct klist * k = n->n_klist; | 145 | struct klist * k = n->n_klist; |
| 146 | void (*put)(struct klist_node *) = k->put; | ||
| 148 | 147 | ||
| 149 | spin_lock(&k->k_lock); | 148 | spin_lock(&k->k_lock); |
| 150 | klist_dec_and_del(n); | 149 | if (!klist_dec_and_del(n)) |
| 150 | put = NULL; | ||
| 151 | spin_unlock(&k->k_lock); | 151 | spin_unlock(&k->k_lock); |
| 152 | if (put) | ||
| 153 | put(n); | ||
| 152 | } | 154 | } |
| 153 | 155 | ||
| 154 | EXPORT_SYMBOL_GPL(klist_del); | 156 | EXPORT_SYMBOL_GPL(klist_del); |
| @@ -161,10 +163,7 @@ EXPORT_SYMBOL_GPL(klist_del); | |||
| 161 | 163 | ||
| 162 | void klist_remove(struct klist_node * n) | 164 | void klist_remove(struct klist_node * n) |
| 163 | { | 165 | { |
| 164 | struct klist * k = n->n_klist; | 166 | klist_del(n); |
| 165 | spin_lock(&k->k_lock); | ||
| 166 | klist_dec_and_del(n); | ||
| 167 | spin_unlock(&k->k_lock); | ||
| 168 | wait_for_completion(&n->n_removed); | 167 | wait_for_completion(&n->n_removed); |
| 169 | } | 168 | } |
| 170 | 169 | ||
| @@ -260,12 +259,15 @@ static struct klist_node * to_klist_node(struct list_head * n) | |||
| 260 | struct klist_node * klist_next(struct klist_iter * i) | 259 | struct klist_node * klist_next(struct klist_iter * i) |
| 261 | { | 260 | { |
| 262 | struct list_head * next; | 261 | struct list_head * next; |
| 262 | struct klist_node * lnode = i->i_cur; | ||
| 263 | struct klist_node * knode = NULL; | 263 | struct klist_node * knode = NULL; |
| 264 | void (*put)(struct klist_node *) = i->i_klist->put; | ||
| 264 | 265 | ||
| 265 | spin_lock(&i->i_klist->k_lock); | 266 | spin_lock(&i->i_klist->k_lock); |
| 266 | if (i->i_cur) { | 267 | if (lnode) { |
| 267 | next = i->i_cur->n_node.next; | 268 | next = lnode->n_node.next; |
| 268 | klist_dec_and_del(i->i_cur); | 269 | if (!klist_dec_and_del(lnode)) |
| 270 | put = NULL; | ||
| 269 | } else | 271 | } else |
| 270 | next = i->i_head->next; | 272 | next = i->i_head->next; |
| 271 | 273 | ||
| @@ -275,6 +277,8 @@ struct klist_node * klist_next(struct klist_iter * i) | |||
| 275 | } | 277 | } |
| 276 | i->i_cur = knode; | 278 | i->i_cur = knode; |
| 277 | spin_unlock(&i->i_klist->k_lock); | 279 | spin_unlock(&i->i_klist->k_lock); |
| 280 | if (put && lnode) | ||
| 281 | put(lnode); | ||
| 278 | return knode; | 282 | return knode; |
| 279 | } | 283 | } |
| 280 | 284 | ||
diff --git a/lib/kobject.c b/lib/kobject.c index 8e7c71993487..1699eb9161f3 100644 --- a/lib/kobject.c +++ b/lib/kobject.c | |||
| @@ -407,6 +407,7 @@ static struct kobj_type dir_ktype = { | |||
| 407 | struct kobject *kobject_add_dir(struct kobject *parent, const char *name) | 407 | struct kobject *kobject_add_dir(struct kobject *parent, const char *name) |
| 408 | { | 408 | { |
| 409 | struct kobject *k; | 409 | struct kobject *k; |
| 410 | int ret; | ||
| 410 | 411 | ||
| 411 | if (!parent) | 412 | if (!parent) |
| 412 | return NULL; | 413 | return NULL; |
| @@ -418,7 +419,13 @@ struct kobject *kobject_add_dir(struct kobject *parent, const char *name) | |||
| 418 | k->parent = parent; | 419 | k->parent = parent; |
| 419 | k->ktype = &dir_ktype; | 420 | k->ktype = &dir_ktype; |
| 420 | kobject_set_name(k, name); | 421 | kobject_set_name(k, name); |
| 421 | kobject_register(k); | 422 | ret = kobject_register(k); |
| 423 | if (ret < 0) { | ||
| 424 | printk(KERN_WARNING "kobject_add_dir: " | ||
| 425 | "kobject_register error: %d\n", ret); | ||
| 426 | kobject_del(k); | ||
| 427 | return NULL; | ||
| 428 | } | ||
| 422 | 429 | ||
| 423 | return k; | 430 | return k; |
| 424 | } | 431 | } |
