aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Kconfig3
-rw-r--r--lib/Kconfig.debug11
-rw-r--r--lib/assoc_array.c6
-rw-r--r--lib/bitmap.c4
-rw-r--r--lib/dma-debug.c2
-rw-r--r--lib/genalloc.c1
-rw-r--r--lib/hweight.c4
-rw-r--r--lib/idr.c2
-rw-r--r--lib/percpu-refcount.c16
-rw-r--r--lib/rhashtable.c13
-rw-r--r--lib/string.c4
-rw-r--r--lib/vsprintf.c2
12 files changed, 49 insertions, 19 deletions
diff --git a/lib/Kconfig b/lib/Kconfig
index a5ce0c7f6c30..54cf309a92a5 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -51,6 +51,9 @@ config PERCPU_RWSEM
51config ARCH_USE_CMPXCHG_LOCKREF 51config ARCH_USE_CMPXCHG_LOCKREF
52 bool 52 bool
53 53
54config ARCH_HAS_FAST_MULTIPLIER
55 bool
56
54config CRC_CCITT 57config CRC_CCITT
55 tristate "CRC-CCITT functions" 58 tristate "CRC-CCITT functions"
56 help 59 help
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 07c28323f88f..a28590083622 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -892,6 +892,10 @@ config DEBUG_WW_MUTEX_SLOWPATH
892 the full mutex checks enabled with (CONFIG_PROVE_LOCKING) this 892 the full mutex checks enabled with (CONFIG_PROVE_LOCKING) this
893 will test all possible w/w mutex interface abuse with the 893 will test all possible w/w mutex interface abuse with the
894 exception of simply not acquiring all the required locks. 894 exception of simply not acquiring all the required locks.
895 Note that this feature can introduce significant overhead, so
896 it really should not be enabled in a production or distro kernel,
897 even a debug kernel. If you are a driver writer, enable it. If
898 you are a distro, do not.
895 899
896config DEBUG_LOCK_ALLOC 900config DEBUG_LOCK_ALLOC
897 bool "Lock debugging: detect incorrect freeing of live locks" 901 bool "Lock debugging: detect incorrect freeing of live locks"
@@ -1032,8 +1036,13 @@ config TRACE_IRQFLAGS
1032 either tracing or lock debugging. 1036 either tracing or lock debugging.
1033 1037
1034config STACKTRACE 1038config STACKTRACE
1035 bool 1039 bool "Stack backtrace support"
1036 depends on STACKTRACE_SUPPORT 1040 depends on STACKTRACE_SUPPORT
1041 help
1042 This option causes the kernel to create a /proc/pid/stack for
1043 every process, showing its current stack trace.
1044 It is also used by various kernel debugging features that require
1045 stack trace generation.
1037 1046
1038config DEBUG_KOBJECT 1047config DEBUG_KOBJECT
1039 bool "kobject debugging" 1048 bool "kobject debugging"
diff --git a/lib/assoc_array.c b/lib/assoc_array.c
index c0b1007011e1..2404d03e251a 100644
--- a/lib/assoc_array.c
+++ b/lib/assoc_array.c
@@ -1723,11 +1723,13 @@ ascend_old_tree:
1723 shortcut = assoc_array_ptr_to_shortcut(ptr); 1723 shortcut = assoc_array_ptr_to_shortcut(ptr);
1724 slot = shortcut->parent_slot; 1724 slot = shortcut->parent_slot;
1725 cursor = shortcut->back_pointer; 1725 cursor = shortcut->back_pointer;
1726 if (!cursor)
1727 goto gc_complete;
1726 } else { 1728 } else {
1727 slot = node->parent_slot; 1729 slot = node->parent_slot;
1728 cursor = ptr; 1730 cursor = ptr;
1729 } 1731 }
1730 BUG_ON(!ptr); 1732 BUG_ON(!cursor);
1731 node = assoc_array_ptr_to_node(cursor); 1733 node = assoc_array_ptr_to_node(cursor);
1732 slot++; 1734 slot++;
1733 goto continue_node; 1735 goto continue_node;
@@ -1735,7 +1737,7 @@ ascend_old_tree:
1735gc_complete: 1737gc_complete:
1736 edit->set[0].to = new_root; 1738 edit->set[0].to = new_root;
1737 assoc_array_apply_edit(edit); 1739 assoc_array_apply_edit(edit);
1738 edit->array->nr_leaves_on_tree = nr_leaves_on_tree; 1740 array->nr_leaves_on_tree = nr_leaves_on_tree;
1739 return 0; 1741 return 0;
1740 1742
1741enomem: 1743enomem:
diff --git a/lib/bitmap.c b/lib/bitmap.c
index 1e031f2c9aba..cd250a2e14cb 100644
--- a/lib/bitmap.c
+++ b/lib/bitmap.c
@@ -884,7 +884,7 @@ EXPORT_SYMBOL(bitmap_bitremap);
884 * read it, you're overqualified for your current job.) 884 * read it, you're overqualified for your current job.)
885 * 885 *
886 * In other words, @orig is mapped onto (surjectively) @dst, 886 * In other words, @orig is mapped onto (surjectively) @dst,
887 * using the the map { <n, m> | the n-th bit of @relmap is the 887 * using the map { <n, m> | the n-th bit of @relmap is the
888 * m-th set bit of @relmap }. 888 * m-th set bit of @relmap }.
889 * 889 *
890 * Any set bits in @orig above bit number W, where W is the 890 * Any set bits in @orig above bit number W, where W is the
@@ -932,7 +932,7 @@ EXPORT_SYMBOL(bitmap_bitremap);
932 * 932 *
933 * Further lets say we use the following code, invoking 933 * Further lets say we use the following code, invoking
934 * bitmap_fold() then bitmap_onto, as suggested above to 934 * bitmap_fold() then bitmap_onto, as suggested above to
935 * avoid the possitility of an empty @dst result: 935 * avoid the possibility of an empty @dst result:
936 * 936 *
937 * unsigned long *tmp; // a temporary bitmap's bits 937 * unsigned long *tmp; // a temporary bitmap's bits
938 * 938 *
diff --git a/lib/dma-debug.c b/lib/dma-debug.c
index 98f2d7e91a91..add80cc02dbe 100644
--- a/lib/dma-debug.c
+++ b/lib/dma-debug.c
@@ -1149,7 +1149,7 @@ static void check_unmap(struct dma_debug_entry *ref)
1149static void check_for_stack(struct device *dev, void *addr) 1149static void check_for_stack(struct device *dev, void *addr)
1150{ 1150{
1151 if (object_is_on_stack(addr)) 1151 if (object_is_on_stack(addr))
1152 err_printk(dev, NULL, "DMA-API: device driver maps memory from" 1152 err_printk(dev, NULL, "DMA-API: device driver maps memory from "
1153 "stack [addr=%p]\n", addr); 1153 "stack [addr=%p]\n", addr);
1154} 1154}
1155 1155
diff --git a/lib/genalloc.c b/lib/genalloc.c
index bdb9a456bcbb..38d2db82228c 100644
--- a/lib/genalloc.c
+++ b/lib/genalloc.c
@@ -588,6 +588,7 @@ struct gen_pool *of_get_named_gen_pool(struct device_node *np,
588 if (!np_pool) 588 if (!np_pool)
589 return NULL; 589 return NULL;
590 pdev = of_find_device_by_node(np_pool); 590 pdev = of_find_device_by_node(np_pool);
591 of_node_put(np_pool);
591 if (!pdev) 592 if (!pdev)
592 return NULL; 593 return NULL;
593 return dev_get_gen_pool(&pdev->dev); 594 return dev_get_gen_pool(&pdev->dev);
diff --git a/lib/hweight.c b/lib/hweight.c
index b7d81ba143d1..9a5c1f221558 100644
--- a/lib/hweight.c
+++ b/lib/hweight.c
@@ -11,7 +11,7 @@
11 11
12unsigned int __sw_hweight32(unsigned int w) 12unsigned int __sw_hweight32(unsigned int w)
13{ 13{
14#ifdef ARCH_HAS_FAST_MULTIPLIER 14#ifdef CONFIG_ARCH_HAS_FAST_MULTIPLIER
15 w -= (w >> 1) & 0x55555555; 15 w -= (w >> 1) & 0x55555555;
16 w = (w & 0x33333333) + ((w >> 2) & 0x33333333); 16 w = (w & 0x33333333) + ((w >> 2) & 0x33333333);
17 w = (w + (w >> 4)) & 0x0f0f0f0f; 17 w = (w + (w >> 4)) & 0x0f0f0f0f;
@@ -49,7 +49,7 @@ unsigned long __sw_hweight64(__u64 w)
49 return __sw_hweight32((unsigned int)(w >> 32)) + 49 return __sw_hweight32((unsigned int)(w >> 32)) +
50 __sw_hweight32((unsigned int)w); 50 __sw_hweight32((unsigned int)w);
51#elif BITS_PER_LONG == 64 51#elif BITS_PER_LONG == 64
52#ifdef ARCH_HAS_FAST_MULTIPLIER 52#ifdef CONFIG_ARCH_HAS_FAST_MULTIPLIER
53 w -= (w >> 1) & 0x5555555555555555ul; 53 w -= (w >> 1) & 0x5555555555555555ul;
54 w = (w & 0x3333333333333333ul) + ((w >> 2) & 0x3333333333333333ul); 54 w = (w & 0x3333333333333333ul) + ((w >> 2) & 0x3333333333333333ul);
55 w = (w + (w >> 4)) & 0x0f0f0f0f0f0f0f0ful; 55 w = (w + (w >> 4)) & 0x0f0f0f0f0f0f0f0ful;
diff --git a/lib/idr.c b/lib/idr.c
index 50be3fa9b657..e654aebd5f80 100644
--- a/lib/idr.c
+++ b/lib/idr.c
@@ -626,7 +626,7 @@ static void __idr_remove_all(struct idr *idp)
626 * idr_destroy(). 626 * idr_destroy().
627 * 627 *
628 * A typical clean-up sequence for objects stored in an idr tree will use 628 * A typical clean-up sequence for objects stored in an idr tree will use
629 * idr_for_each() to free all objects, if necessay, then idr_destroy() to 629 * idr_for_each() to free all objects, if necessary, then idr_destroy() to
630 * free up the id mappings and cached idr_layers. 630 * free up the id mappings and cached idr_layers.
631 */ 631 */
632void idr_destroy(struct idr *idp) 632void idr_destroy(struct idr *idp)
diff --git a/lib/percpu-refcount.c b/lib/percpu-refcount.c
index fe5a3342e960..a89cf09a8268 100644
--- a/lib/percpu-refcount.c
+++ b/lib/percpu-refcount.c
@@ -184,3 +184,19 @@ void percpu_ref_kill_and_confirm(struct percpu_ref *ref,
184 call_rcu_sched(&ref->rcu, percpu_ref_kill_rcu); 184 call_rcu_sched(&ref->rcu, percpu_ref_kill_rcu);
185} 185}
186EXPORT_SYMBOL_GPL(percpu_ref_kill_and_confirm); 186EXPORT_SYMBOL_GPL(percpu_ref_kill_and_confirm);
187
188/*
189 * XXX: Temporary kludge to work around SCSI blk-mq stall. Used only by
190 * block/blk-mq.c::blk_mq_freeze_queue(). Will be removed during v3.18
191 * devel cycle. Do not use anywhere else.
192 */
193void __percpu_ref_kill_expedited(struct percpu_ref *ref)
194{
195 WARN_ONCE(ref->pcpu_count_ptr & PCPU_REF_DEAD,
196 "percpu_ref_kill() called more than once on %pf!",
197 ref->release);
198
199 ref->pcpu_count_ptr |= PCPU_REF_DEAD;
200 synchronize_sched_expedited();
201 percpu_ref_kill_rcu(&ref->rcu);
202}
diff --git a/lib/rhashtable.c b/lib/rhashtable.c
index a2c78810ebc1..3d2b4733f6cb 100644
--- a/lib/rhashtable.c
+++ b/lib/rhashtable.c
@@ -23,7 +23,6 @@
23#include <linux/hash.h> 23#include <linux/hash.h>
24#include <linux/random.h> 24#include <linux/random.h>
25#include <linux/rhashtable.h> 25#include <linux/rhashtable.h>
26#include <linux/log2.h>
27 26
28#define HASH_DEFAULT_SIZE 64UL 27#define HASH_DEFAULT_SIZE 64UL
29#define HASH_MIN_SIZE 4UL 28#define HASH_MIN_SIZE 4UL
@@ -55,7 +54,7 @@ static u32 __hashfn(const struct rhashtable *ht, const void *key,
55 54
56/** 55/**
57 * rhashtable_hashfn - compute hash for key of given length 56 * rhashtable_hashfn - compute hash for key of given length
58 * @ht: hash table to compuate for 57 * @ht: hash table to compute for
59 * @key: pointer to key 58 * @key: pointer to key
60 * @len: length of key 59 * @len: length of key
61 * 60 *
@@ -86,7 +85,7 @@ static u32 obj_hashfn(const struct rhashtable *ht, const void *ptr, u32 hsize)
86 85
87/** 86/**
88 * rhashtable_obj_hashfn - compute hash for hashed object 87 * rhashtable_obj_hashfn - compute hash for hashed object
89 * @ht: hash table to compuate for 88 * @ht: hash table to compute for
90 * @ptr: pointer to hashed object 89 * @ptr: pointer to hashed object
91 * 90 *
92 * Computes the hash value using the hash function `hashfn` respectively 91 * Computes the hash value using the hash function `hashfn` respectively
@@ -589,13 +588,13 @@ EXPORT_SYMBOL_GPL(rhashtable_init);
589 * rhashtable_destroy - destroy hash table 588 * rhashtable_destroy - destroy hash table
590 * @ht: the hash table to destroy 589 * @ht: the hash table to destroy
591 * 590 *
592 * Frees the bucket array. 591 * Frees the bucket array. This function is not rcu safe, therefore the caller
592 * has to make sure that no resizing may happen by unpublishing the hashtable
593 * and waiting for the quiescent cycle before releasing the bucket array.
593 */ 594 */
594void rhashtable_destroy(const struct rhashtable *ht) 595void rhashtable_destroy(const struct rhashtable *ht)
595{ 596{
596 const struct bucket_table *tbl = rht_dereference(ht->tbl, ht); 597 bucket_table_free(ht->tbl);
597
598 bucket_table_free(tbl);
599} 598}
600EXPORT_SYMBOL_GPL(rhashtable_destroy); 599EXPORT_SYMBOL_GPL(rhashtable_destroy);
601 600
diff --git a/lib/string.c b/lib/string.c
index 992bf30af759..f3c6ff596414 100644
--- a/lib/string.c
+++ b/lib/string.c
@@ -807,9 +807,9 @@ void *memchr_inv(const void *start, int c, size_t bytes)
807 return check_bytes8(start, value, bytes); 807 return check_bytes8(start, value, bytes);
808 808
809 value64 = value; 809 value64 = value;
810#if defined(ARCH_HAS_FAST_MULTIPLIER) && BITS_PER_LONG == 64 810#if defined(CONFIG_ARCH_HAS_FAST_MULTIPLIER) && BITS_PER_LONG == 64
811 value64 *= 0x0101010101010101; 811 value64 *= 0x0101010101010101;
812#elif defined(ARCH_HAS_FAST_MULTIPLIER) 812#elif defined(CONFIG_ARCH_HAS_FAST_MULTIPLIER)
813 value64 *= 0x01010101; 813 value64 *= 0x01010101;
814 value64 |= value64 << 32; 814 value64 |= value64 << 32;
815#else 815#else
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 6fe2c84eb055..ba3cd0a35640 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -1937,7 +1937,7 @@ EXPORT_SYMBOL(sprintf);
1937 * @args: Arguments for the format string 1937 * @args: Arguments for the format string
1938 * 1938 *
1939 * The format follows C99 vsnprintf, except %n is ignored, and its argument 1939 * The format follows C99 vsnprintf, except %n is ignored, and its argument
1940 * is skiped. 1940 * is skipped.
1941 * 1941 *
1942 * The return value is the number of words(32bits) which would be generated for 1942 * The return value is the number of words(32bits) which would be generated for
1943 * the given input. 1943 * the given input.