aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBjorn Andersson <bjorn.andersson@linaro.org>2018-05-09 14:58:20 -0400
committerBjorn Andersson <bjorn.andersson@linaro.org>2018-05-09 14:59:07 -0400
commit9935448e207cc9e7e5fd3c6aa3282ff503f263c4 (patch)
treea43f75f5dd940664f468418d59d3879ffff75b8f /lib
parent41a5985f173bf1f93d2634fc93d8aa53683067f9 (diff)
parent75bc37fefc4471e718ba8e651aa74673d4e0a9eb (diff)
Merge tag 'v4.17-rc4' into rproc-next
Pick up fixes from rproc-v4.17-1 Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/dma-direct.c3
-rw-r--r--lib/errseq.c23
-rw-r--r--lib/kobject.c11
-rw-r--r--lib/swiotlb.c2
-rw-r--r--lib/textsearch.c40
5 files changed, 40 insertions, 39 deletions
diff --git a/lib/dma-direct.c b/lib/dma-direct.c
index c0bba30fef0a..bbfb229aa067 100644
--- a/lib/dma-direct.c
+++ b/lib/dma-direct.c
@@ -84,7 +84,8 @@ again:
84 __free_pages(page, page_order); 84 __free_pages(page, page_order);
85 page = NULL; 85 page = NULL;
86 86
87 if (dev->coherent_dma_mask < DMA_BIT_MASK(32) && 87 if (IS_ENABLED(CONFIG_ZONE_DMA) &&
88 dev->coherent_dma_mask < DMA_BIT_MASK(32) &&
88 !(gfp & GFP_DMA)) { 89 !(gfp & GFP_DMA)) {
89 gfp = (gfp & ~GFP_DMA32) | GFP_DMA; 90 gfp = (gfp & ~GFP_DMA32) | GFP_DMA;
90 goto again; 91 goto again;
diff --git a/lib/errseq.c b/lib/errseq.c
index df782418b333..81f9e33aa7e7 100644
--- a/lib/errseq.c
+++ b/lib/errseq.c
@@ -111,27 +111,22 @@ EXPORT_SYMBOL(errseq_set);
111 * errseq_sample() - Grab current errseq_t value. 111 * errseq_sample() - Grab current errseq_t value.
112 * @eseq: Pointer to errseq_t to be sampled. 112 * @eseq: Pointer to errseq_t to be sampled.
113 * 113 *
114 * This function allows callers to sample an errseq_t value, marking it as 114 * This function allows callers to initialise their errseq_t variable.
115 * "seen" if required. 115 * If the error has been "seen", new callers will not see an old error.
116 * If there is an unseen error in @eseq, the caller of this function will
117 * see it the next time it checks for an error.
116 * 118 *
119 * Context: Any context.
117 * Return: The current errseq value. 120 * Return: The current errseq value.
118 */ 121 */
119errseq_t errseq_sample(errseq_t *eseq) 122errseq_t errseq_sample(errseq_t *eseq)
120{ 123{
121 errseq_t old = READ_ONCE(*eseq); 124 errseq_t old = READ_ONCE(*eseq);
122 errseq_t new = old;
123 125
124 /* 126 /* If nobody has seen this error yet, then we can be the first. */
125 * For the common case of no errors ever having been set, we can skip 127 if (!(old & ERRSEQ_SEEN))
126 * marking the SEEN bit. Once an error has been set, the value will 128 old = 0;
127 * never go back to zero. 129 return old;
128 */
129 if (old != 0) {
130 new |= ERRSEQ_SEEN;
131 if (old != new)
132 cmpxchg(eseq, old, new);
133 }
134 return new;
135} 130}
136EXPORT_SYMBOL(errseq_sample); 131EXPORT_SYMBOL(errseq_sample);
137 132
diff --git a/lib/kobject.c b/lib/kobject.c
index e1d1f290bf35..18989b5b3b56 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -233,13 +233,12 @@ static int kobject_add_internal(struct kobject *kobj)
233 233
234 /* be noisy on error issues */ 234 /* be noisy on error issues */
235 if (error == -EEXIST) 235 if (error == -EEXIST)
236 WARN(1, 236 pr_err("%s failed for %s with -EEXIST, don't try to register things with the same name in the same directory.\n",
237 "%s failed for %s with -EEXIST, don't try to register things with the same name in the same directory.\n", 237 __func__, kobject_name(kobj));
238 __func__, kobject_name(kobj));
239 else 238 else
240 WARN(1, "%s failed for %s (error: %d parent: %s)\n", 239 pr_err("%s failed for %s (error: %d parent: %s)\n",
241 __func__, kobject_name(kobj), error, 240 __func__, kobject_name(kobj), error,
242 parent ? kobject_name(parent) : "'none'"); 241 parent ? kobject_name(parent) : "'none'");
243 } else 242 } else
244 kobj->state_in_sysfs = 1; 243 kobj->state_in_sysfs = 1;
245 244
diff --git a/lib/swiotlb.c b/lib/swiotlb.c
index fece57566d45..12fbaa445637 100644
--- a/lib/swiotlb.c
+++ b/lib/swiotlb.c
@@ -737,7 +737,7 @@ out_unmap:
737 swiotlb_tbl_unmap_single(dev, phys_addr, size, DMA_TO_DEVICE, 737 swiotlb_tbl_unmap_single(dev, phys_addr, size, DMA_TO_DEVICE,
738 DMA_ATTR_SKIP_CPU_SYNC); 738 DMA_ATTR_SKIP_CPU_SYNC);
739out_warn: 739out_warn:
740 if ((attrs & DMA_ATTR_NO_WARN) && printk_ratelimit()) { 740 if (!(attrs & DMA_ATTR_NO_WARN) && printk_ratelimit()) {
741 dev_warn(dev, 741 dev_warn(dev,
742 "swiotlb: coherent allocation failed, size=%zu\n", 742 "swiotlb: coherent allocation failed, size=%zu\n",
743 size); 743 size);
diff --git a/lib/textsearch.c b/lib/textsearch.c
index 0b79908dfe89..5939549c0e7b 100644
--- a/lib/textsearch.c
+++ b/lib/textsearch.c
@@ -10,7 +10,10 @@
10 * Pablo Neira Ayuso <pablo@netfilter.org> 10 * Pablo Neira Ayuso <pablo@netfilter.org>
11 * 11 *
12 * ========================================================================== 12 * ==========================================================================
13 * 13 */
14
15/**
16 * DOC: ts_intro
14 * INTRODUCTION 17 * INTRODUCTION
15 * 18 *
16 * The textsearch infrastructure provides text searching facilities for 19 * The textsearch infrastructure provides text searching facilities for
@@ -19,7 +22,9 @@
19 * 22 *
20 * ARCHITECTURE 23 * ARCHITECTURE
21 * 24 *
22 * User 25 * .. code-block:: none
26 *
27 * User
23 * +----------------+ 28 * +----------------+
24 * | finish()|<--------------(6)-----------------+ 29 * | finish()|<--------------(6)-----------------+
25 * |get_next_block()|<--------------(5)---------------+ | 30 * |get_next_block()|<--------------(5)---------------+ |
@@ -33,21 +38,21 @@
33 * | (3)|----->| find()/next() |-----------+ | 38 * | (3)|----->| find()/next() |-----------+ |
34 * | (7)|----->| destroy() |----------------------+ 39 * | (7)|----->| destroy() |----------------------+
35 * +----------------+ +---------------+ 40 * +----------------+ +---------------+
36 * 41 *
37 * (1) User configures a search by calling _prepare() specifying the 42 * (1) User configures a search by calling textsearch_prepare() specifying
38 * search parameters such as the pattern and algorithm name. 43 * the search parameters such as the pattern and algorithm name.
39 * (2) Core requests the algorithm to allocate and initialize a search 44 * (2) Core requests the algorithm to allocate and initialize a search
40 * configuration according to the specified parameters. 45 * configuration according to the specified parameters.
41 * (3) User starts the search(es) by calling _find() or _next() to 46 * (3) User starts the search(es) by calling textsearch_find() or
42 * fetch subsequent occurrences. A state variable is provided 47 * textsearch_next() to fetch subsequent occurrences. A state variable
43 * to the algorithm to store persistent variables. 48 * is provided to the algorithm to store persistent variables.
44 * (4) Core eventually resets the search offset and forwards the find() 49 * (4) Core eventually resets the search offset and forwards the find()
45 * request to the algorithm. 50 * request to the algorithm.
46 * (5) Algorithm calls get_next_block() provided by the user continuously 51 * (5) Algorithm calls get_next_block() provided by the user continuously
47 * to fetch the data to be searched in block by block. 52 * to fetch the data to be searched in block by block.
48 * (6) Algorithm invokes finish() after the last call to get_next_block 53 * (6) Algorithm invokes finish() after the last call to get_next_block
49 * to clean up any leftovers from get_next_block. (Optional) 54 * to clean up any leftovers from get_next_block. (Optional)
50 * (7) User destroys the configuration by calling _destroy(). 55 * (7) User destroys the configuration by calling textsearch_destroy().
51 * (8) Core notifies the algorithm to destroy algorithm specific 56 * (8) Core notifies the algorithm to destroy algorithm specific
52 * allocations. (Optional) 57 * allocations. (Optional)
53 * 58 *
@@ -62,9 +67,10 @@
62 * amount of times and even in parallel as long as a separate struct 67 * amount of times and even in parallel as long as a separate struct
63 * ts_state variable is provided to every instance. 68 * ts_state variable is provided to every instance.
64 * 69 *
65 * The actual search is performed by either calling textsearch_find_- 70 * The actual search is performed by either calling
66 * continuous() for linear data or by providing an own get_next_block() 71 * textsearch_find_continuous() for linear data or by providing
67 * implementation and calling textsearch_find(). Both functions return 72 * an own get_next_block() implementation and
73 * calling textsearch_find(). Both functions return
68 * the position of the first occurrence of the pattern or UINT_MAX if 74 * the position of the first occurrence of the pattern or UINT_MAX if
69 * no match was found. Subsequent occurrences can be found by calling 75 * no match was found. Subsequent occurrences can be found by calling
70 * textsearch_next() regardless of the linearity of the data. 76 * textsearch_next() regardless of the linearity of the data.
@@ -72,7 +78,7 @@
72 * Once you're done using a configuration it must be given back via 78 * Once you're done using a configuration it must be given back via
73 * textsearch_destroy. 79 * textsearch_destroy.
74 * 80 *
75 * EXAMPLE 81 * EXAMPLE::
76 * 82 *
77 * int pos; 83 * int pos;
78 * struct ts_config *conf; 84 * struct ts_config *conf;
@@ -87,13 +93,13 @@
87 * goto errout; 93 * goto errout;
88 * } 94 * }
89 * 95 *
90 * pos = textsearch_find_continuous(conf, &state, example, strlen(example)); 96 * pos = textsearch_find_continuous(conf, \&state, example, strlen(example));
91 * if (pos != UINT_MAX) 97 * if (pos != UINT_MAX)
92 * panic("Oh my god, dancing chickens at %d\n", pos); 98 * panic("Oh my god, dancing chickens at \%d\n", pos);
93 * 99 *
94 * textsearch_destroy(conf); 100 * textsearch_destroy(conf);
95 * ==========================================================================
96 */ 101 */
102/* ========================================================================== */
97 103
98#include <linux/module.h> 104#include <linux/module.h>
99#include <linux/types.h> 105#include <linux/types.h>
@@ -225,7 +231,7 @@ static unsigned int get_linear_data(unsigned int consumed, const u8 **dst,
225 * 231 *
226 * Returns the position of first occurrence of the pattern or 232 * Returns the position of first occurrence of the pattern or
227 * %UINT_MAX if no occurrence was found. 233 * %UINT_MAX if no occurrence was found.
228 */ 234 */
229unsigned int textsearch_find_continuous(struct ts_config *conf, 235unsigned int textsearch_find_continuous(struct ts_config *conf,
230 struct ts_state *state, 236 struct ts_state *state,
231 const void *data, unsigned int len) 237 const void *data, unsigned int len)