1 |
commit: b7948130f9c9b6acc069b1667d0fe5fe32d7e38b |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Sep 30 10:48:47 2021 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Sep 30 10:48:47 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=b7948130 |
7 |
|
8 |
Linux patch 5.10.70 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1069_linux-5.10.70.patch | 4252 ++++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 4256 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index 456fb50..89a885a 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -319,6 +319,10 @@ Patch: 1068_linux-5.10.69.patch |
21 |
From: http://www.kernel.org |
22 |
Desc: Linux 5.10.69 |
23 |
|
24 |
+Patch: 1069_linux-5.10.70.patch |
25 |
+From: http://www.kernel.org |
26 |
+Desc: Linux 5.10.70 |
27 |
+ |
28 |
Patch: 1500_XATTR_USER_PREFIX.patch |
29 |
From: https://bugs.gentoo.org/show_bug.cgi?id=470644 |
30 |
Desc: Support for namespace user.pax.* on tmpfs. |
31 |
|
32 |
diff --git a/1069_linux-5.10.70.patch b/1069_linux-5.10.70.patch |
33 |
new file mode 100644 |
34 |
index 0000000..84d190b |
35 |
--- /dev/null |
36 |
+++ b/1069_linux-5.10.70.patch |
37 |
@@ -0,0 +1,4252 @@ |
38 |
+diff --git a/Makefile b/Makefile |
39 |
+index e14943205b832..4a9541a18618b 100644 |
40 |
+--- a/Makefile |
41 |
++++ b/Makefile |
42 |
+@@ -1,7 +1,7 @@ |
43 |
+ # SPDX-License-Identifier: GPL-2.0 |
44 |
+ VERSION = 5 |
45 |
+ PATCHLEVEL = 10 |
46 |
+-SUBLEVEL = 69 |
47 |
++SUBLEVEL = 70 |
48 |
+ EXTRAVERSION = |
49 |
+ NAME = Dare mighty things |
50 |
+ |
51 |
+diff --git a/arch/alpha/include/asm/io.h b/arch/alpha/include/asm/io.h |
52 |
+index 1f6a909d1fa59..7bc2f444a89a2 100644 |
53 |
+--- a/arch/alpha/include/asm/io.h |
54 |
++++ b/arch/alpha/include/asm/io.h |
55 |
+@@ -60,7 +60,7 @@ extern inline void set_hae(unsigned long new_hae) |
56 |
+ * Change virtual addresses to physical addresses and vv. |
57 |
+ */ |
58 |
+ #ifdef USE_48_BIT_KSEG |
59 |
+-static inline unsigned long virt_to_phys(void *address) |
60 |
++static inline unsigned long virt_to_phys(volatile void *address) |
61 |
+ { |
62 |
+ return (unsigned long)address - IDENT_ADDR; |
63 |
+ } |
64 |
+@@ -70,7 +70,7 @@ static inline void * phys_to_virt(unsigned long address) |
65 |
+ return (void *) (address + IDENT_ADDR); |
66 |
+ } |
67 |
+ #else |
68 |
+-static inline unsigned long virt_to_phys(void *address) |
69 |
++static inline unsigned long virt_to_phys(volatile void *address) |
70 |
+ { |
71 |
+ unsigned long phys = (unsigned long)address; |
72 |
+ |
73 |
+@@ -106,7 +106,7 @@ static inline void * phys_to_virt(unsigned long address) |
74 |
+ extern unsigned long __direct_map_base; |
75 |
+ extern unsigned long __direct_map_size; |
76 |
+ |
77 |
+-static inline unsigned long __deprecated virt_to_bus(void *address) |
78 |
++static inline unsigned long __deprecated virt_to_bus(volatile void *address) |
79 |
+ { |
80 |
+ unsigned long phys = virt_to_phys(address); |
81 |
+ unsigned long bus = phys + __direct_map_base; |
82 |
+diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c |
83 |
+index ed919f633ed8e..4999caff32818 100644 |
84 |
+--- a/arch/arm64/kernel/process.c |
85 |
++++ b/arch/arm64/kernel/process.c |
86 |
+@@ -60,7 +60,7 @@ |
87 |
+ |
88 |
+ #if defined(CONFIG_STACKPROTECTOR) && !defined(CONFIG_STACKPROTECTOR_PER_TASK) |
89 |
+ #include <linux/stackprotector.h> |
90 |
+-unsigned long __stack_chk_guard __read_mostly; |
91 |
++unsigned long __stack_chk_guard __ro_after_init; |
92 |
+ EXPORT_SYMBOL(__stack_chk_guard); |
93 |
+ #endif |
94 |
+ |
95 |
+diff --git a/arch/arm64/kvm/vgic/vgic-its.c b/arch/arm64/kvm/vgic/vgic-its.c |
96 |
+index 40cbaca813334..b9518f94bd435 100644 |
97 |
+--- a/arch/arm64/kvm/vgic/vgic-its.c |
98 |
++++ b/arch/arm64/kvm/vgic/vgic-its.c |
99 |
+@@ -2190,8 +2190,8 @@ static int vgic_its_restore_ite(struct vgic_its *its, u32 event_id, |
100 |
+ return offset; |
101 |
+ } |
102 |
+ |
103 |
+-static int vgic_its_ite_cmp(void *priv, struct list_head *a, |
104 |
+- struct list_head *b) |
105 |
++static int vgic_its_ite_cmp(void *priv, const struct list_head *a, |
106 |
++ const struct list_head *b) |
107 |
+ { |
108 |
+ struct its_ite *itea = container_of(a, struct its_ite, ite_list); |
109 |
+ struct its_ite *iteb = container_of(b, struct its_ite, ite_list); |
110 |
+@@ -2329,8 +2329,8 @@ static int vgic_its_restore_dte(struct vgic_its *its, u32 id, |
111 |
+ return offset; |
112 |
+ } |
113 |
+ |
114 |
+-static int vgic_its_device_cmp(void *priv, struct list_head *a, |
115 |
+- struct list_head *b) |
116 |
++static int vgic_its_device_cmp(void *priv, const struct list_head *a, |
117 |
++ const struct list_head *b) |
118 |
+ { |
119 |
+ struct its_device *deva = container_of(a, struct its_device, dev_list); |
120 |
+ struct its_device *devb = container_of(b, struct its_device, dev_list); |
121 |
+diff --git a/arch/arm64/kvm/vgic/vgic.c b/arch/arm64/kvm/vgic/vgic.c |
122 |
+index c3643b7f101b7..4abf7a867b654 100644 |
123 |
+--- a/arch/arm64/kvm/vgic/vgic.c |
124 |
++++ b/arch/arm64/kvm/vgic/vgic.c |
125 |
+@@ -255,7 +255,8 @@ static struct kvm_vcpu *vgic_target_oracle(struct vgic_irq *irq) |
126 |
+ * Return negative if "a" sorts before "b", 0 to preserve order, and positive |
127 |
+ * to sort "b" before "a". |
128 |
+ */ |
129 |
+-static int vgic_irq_cmp(void *priv, struct list_head *a, struct list_head *b) |
130 |
++static int vgic_irq_cmp(void *priv, const struct list_head *a, |
131 |
++ const struct list_head *b) |
132 |
+ { |
133 |
+ struct vgic_irq *irqa = container_of(a, struct vgic_irq, ap_list); |
134 |
+ struct vgic_irq *irqb = container_of(b, struct vgic_irq, ap_list); |
135 |
+diff --git a/arch/m68k/include/asm/raw_io.h b/arch/m68k/include/asm/raw_io.h |
136 |
+index 911826ea83ce1..80eb2396d01eb 100644 |
137 |
+--- a/arch/m68k/include/asm/raw_io.h |
138 |
++++ b/arch/m68k/include/asm/raw_io.h |
139 |
+@@ -17,21 +17,21 @@ |
140 |
+ * two accesses to memory, which may be undesirable for some devices. |
141 |
+ */ |
142 |
+ #define in_8(addr) \ |
143 |
+- ({ u8 __v = (*(__force volatile u8 *) (addr)); __v; }) |
144 |
++ ({ u8 __v = (*(__force volatile u8 *) (unsigned long)(addr)); __v; }) |
145 |
+ #define in_be16(addr) \ |
146 |
+- ({ u16 __v = (*(__force volatile u16 *) (addr)); __v; }) |
147 |
++ ({ u16 __v = (*(__force volatile u16 *) (unsigned long)(addr)); __v; }) |
148 |
+ #define in_be32(addr) \ |
149 |
+- ({ u32 __v = (*(__force volatile u32 *) (addr)); __v; }) |
150 |
++ ({ u32 __v = (*(__force volatile u32 *) (unsigned long)(addr)); __v; }) |
151 |
+ #define in_le16(addr) \ |
152 |
+- ({ u16 __v = le16_to_cpu(*(__force volatile __le16 *) (addr)); __v; }) |
153 |
++ ({ u16 __v = le16_to_cpu(*(__force volatile __le16 *) (unsigned long)(addr)); __v; }) |
154 |
+ #define in_le32(addr) \ |
155 |
+- ({ u32 __v = le32_to_cpu(*(__force volatile __le32 *) (addr)); __v; }) |
156 |
++ ({ u32 __v = le32_to_cpu(*(__force volatile __le32 *) (unsigned long)(addr)); __v; }) |
157 |
+ |
158 |
+-#define out_8(addr,b) (void)((*(__force volatile u8 *) (addr)) = (b)) |
159 |
+-#define out_be16(addr,w) (void)((*(__force volatile u16 *) (addr)) = (w)) |
160 |
+-#define out_be32(addr,l) (void)((*(__force volatile u32 *) (addr)) = (l)) |
161 |
+-#define out_le16(addr,w) (void)((*(__force volatile __le16 *) (addr)) = cpu_to_le16(w)) |
162 |
+-#define out_le32(addr,l) (void)((*(__force volatile __le32 *) (addr)) = cpu_to_le32(l)) |
163 |
++#define out_8(addr,b) (void)((*(__force volatile u8 *) (unsigned long)(addr)) = (b)) |
164 |
++#define out_be16(addr,w) (void)((*(__force volatile u16 *) (unsigned long)(addr)) = (w)) |
165 |
++#define out_be32(addr,l) (void)((*(__force volatile u32 *) (unsigned long)(addr)) = (l)) |
166 |
++#define out_le16(addr,w) (void)((*(__force volatile __le16 *) (unsigned long)(addr)) = cpu_to_le16(w)) |
167 |
++#define out_le32(addr,l) (void)((*(__force volatile __le32 *) (unsigned long)(addr)) = cpu_to_le32(l)) |
168 |
+ |
169 |
+ #define raw_inb in_8 |
170 |
+ #define raw_inw in_be16 |
171 |
+diff --git a/arch/parisc/include/asm/page.h b/arch/parisc/include/asm/page.h |
172 |
+index 6b3f6740a6a67..8802ce651a3af 100644 |
173 |
+--- a/arch/parisc/include/asm/page.h |
174 |
++++ b/arch/parisc/include/asm/page.h |
175 |
+@@ -184,7 +184,7 @@ extern int npmem_ranges; |
176 |
+ #include <asm-generic/getorder.h> |
177 |
+ #include <asm/pdc.h> |
178 |
+ |
179 |
+-#define PAGE0 ((struct zeropage *)__PAGE_OFFSET) |
180 |
++#define PAGE0 ((struct zeropage *)absolute_pointer(__PAGE_OFFSET)) |
181 |
+ |
182 |
+ /* DEFINITION OF THE ZERO-PAGE (PAG0) */ |
183 |
+ /* based on work by Jason Eckhardt (jason@×××××××.com) */ |
184 |
+diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c |
185 |
+index 8e1d72a167594..7ceae24b0ca99 100644 |
186 |
+--- a/arch/sparc/kernel/ioport.c |
187 |
++++ b/arch/sparc/kernel/ioport.c |
188 |
+@@ -356,7 +356,9 @@ err_nomem: |
189 |
+ void arch_dma_free(struct device *dev, size_t size, void *cpu_addr, |
190 |
+ dma_addr_t dma_addr, unsigned long attrs) |
191 |
+ { |
192 |
+- if (!sparc_dma_free_resource(cpu_addr, PAGE_ALIGN(size))) |
193 |
++ size = PAGE_ALIGN(size); |
194 |
++ |
195 |
++ if (!sparc_dma_free_resource(cpu_addr, size)) |
196 |
+ return; |
197 |
+ |
198 |
+ dma_make_coherent(dma_addr, size); |
199 |
+diff --git a/arch/sparc/kernel/mdesc.c b/arch/sparc/kernel/mdesc.c |
200 |
+index 8e645ddac58e2..30f171b7b00c2 100644 |
201 |
+--- a/arch/sparc/kernel/mdesc.c |
202 |
++++ b/arch/sparc/kernel/mdesc.c |
203 |
+@@ -39,6 +39,7 @@ struct mdesc_hdr { |
204 |
+ u32 node_sz; /* node block size */ |
205 |
+ u32 name_sz; /* name block size */ |
206 |
+ u32 data_sz; /* data block size */ |
207 |
++ char data[]; |
208 |
+ } __attribute__((aligned(16))); |
209 |
+ |
210 |
+ struct mdesc_elem { |
211 |
+@@ -612,7 +613,7 @@ EXPORT_SYMBOL(mdesc_get_node_info); |
212 |
+ |
213 |
+ static struct mdesc_elem *node_block(struct mdesc_hdr *mdesc) |
214 |
+ { |
215 |
+- return (struct mdesc_elem *) (mdesc + 1); |
216 |
++ return (struct mdesc_elem *) mdesc->data; |
217 |
+ } |
218 |
+ |
219 |
+ static void *name_block(struct mdesc_hdr *mdesc) |
220 |
+diff --git a/arch/x86/include/asm/special_insns.h b/arch/x86/include/asm/special_insns.h |
221 |
+index cc177b4431ae8..415693f5d909d 100644 |
222 |
+--- a/arch/x86/include/asm/special_insns.h |
223 |
++++ b/arch/x86/include/asm/special_insns.h |
224 |
+@@ -286,8 +286,8 @@ static inline void movdir64b(void *dst, const void *src) |
225 |
+ static inline int enqcmds(void __iomem *dst, const void *src) |
226 |
+ { |
227 |
+ const struct { char _[64]; } *__src = src; |
228 |
+- struct { char _[64]; } *__dst = dst; |
229 |
+- int zf; |
230 |
++ struct { char _[64]; } __iomem *__dst = dst; |
231 |
++ bool zf; |
232 |
+ |
233 |
+ /* |
234 |
+ * ENQCMDS %(rdx), rax |
235 |
+diff --git a/arch/x86/xen/enlighten_pv.c b/arch/x86/xen/enlighten_pv.c |
236 |
+index c758fd913cedd..5af0421ef74ba 100644 |
237 |
+--- a/arch/x86/xen/enlighten_pv.c |
238 |
++++ b/arch/x86/xen/enlighten_pv.c |
239 |
+@@ -736,8 +736,8 @@ static void xen_write_idt_entry(gate_desc *dt, int entrynum, const gate_desc *g) |
240 |
+ preempt_enable(); |
241 |
+ } |
242 |
+ |
243 |
+-static void xen_convert_trap_info(const struct desc_ptr *desc, |
244 |
+- struct trap_info *traps) |
245 |
++static unsigned xen_convert_trap_info(const struct desc_ptr *desc, |
246 |
++ struct trap_info *traps, bool full) |
247 |
+ { |
248 |
+ unsigned in, out, count; |
249 |
+ |
250 |
+@@ -747,17 +747,18 @@ static void xen_convert_trap_info(const struct desc_ptr *desc, |
251 |
+ for (in = out = 0; in < count; in++) { |
252 |
+ gate_desc *entry = (gate_desc *)(desc->address) + in; |
253 |
+ |
254 |
+- if (cvt_gate_to_trap(in, entry, &traps[out])) |
255 |
++ if (cvt_gate_to_trap(in, entry, &traps[out]) || full) |
256 |
+ out++; |
257 |
+ } |
258 |
+- traps[out].address = 0; |
259 |
++ |
260 |
++ return out; |
261 |
+ } |
262 |
+ |
263 |
+ void xen_copy_trap_info(struct trap_info *traps) |
264 |
+ { |
265 |
+ const struct desc_ptr *desc = this_cpu_ptr(&idt_desc); |
266 |
+ |
267 |
+- xen_convert_trap_info(desc, traps); |
268 |
++ xen_convert_trap_info(desc, traps, true); |
269 |
+ } |
270 |
+ |
271 |
+ /* Load a new IDT into Xen. In principle this can be per-CPU, so we |
272 |
+@@ -767,6 +768,7 @@ static void xen_load_idt(const struct desc_ptr *desc) |
273 |
+ { |
274 |
+ static DEFINE_SPINLOCK(lock); |
275 |
+ static struct trap_info traps[257]; |
276 |
++ unsigned out; |
277 |
+ |
278 |
+ trace_xen_cpu_load_idt(desc); |
279 |
+ |
280 |
+@@ -774,7 +776,8 @@ static void xen_load_idt(const struct desc_ptr *desc) |
281 |
+ |
282 |
+ memcpy(this_cpu_ptr(&idt_desc), desc, sizeof(idt_desc)); |
283 |
+ |
284 |
+- xen_convert_trap_info(desc, traps); |
285 |
++ out = xen_convert_trap_info(desc, traps, false); |
286 |
++ memset(&traps[out], 0, sizeof(traps[0])); |
287 |
+ |
288 |
+ xen_mc_flush(); |
289 |
+ if (HYPERVISOR_set_trap_table(traps)) |
290 |
+diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c |
291 |
+index f13688c4b9317..5b19665bc486a 100644 |
292 |
+--- a/block/blk-cgroup.c |
293 |
++++ b/block/blk-cgroup.c |
294 |
+@@ -1387,10 +1387,14 @@ enomem: |
295 |
+ /* alloc failed, nothing's initialized yet, free everything */ |
296 |
+ spin_lock_irq(&q->queue_lock); |
297 |
+ list_for_each_entry(blkg, &q->blkg_list, q_node) { |
298 |
++ struct blkcg *blkcg = blkg->blkcg; |
299 |
++ |
300 |
++ spin_lock(&blkcg->lock); |
301 |
+ if (blkg->pd[pol->plid]) { |
302 |
+ pol->pd_free_fn(blkg->pd[pol->plid]); |
303 |
+ blkg->pd[pol->plid] = NULL; |
304 |
+ } |
305 |
++ spin_unlock(&blkcg->lock); |
306 |
+ } |
307 |
+ spin_unlock_irq(&q->queue_lock); |
308 |
+ ret = -ENOMEM; |
309 |
+@@ -1422,12 +1426,16 @@ void blkcg_deactivate_policy(struct request_queue *q, |
310 |
+ __clear_bit(pol->plid, q->blkcg_pols); |
311 |
+ |
312 |
+ list_for_each_entry(blkg, &q->blkg_list, q_node) { |
313 |
++ struct blkcg *blkcg = blkg->blkcg; |
314 |
++ |
315 |
++ spin_lock(&blkcg->lock); |
316 |
+ if (blkg->pd[pol->plid]) { |
317 |
+ if (pol->pd_offline_fn) |
318 |
+ pol->pd_offline_fn(blkg->pd[pol->plid]); |
319 |
+ pol->pd_free_fn(blkg->pd[pol->plid]); |
320 |
+ blkg->pd[pol->plid] = NULL; |
321 |
+ } |
322 |
++ spin_unlock(&blkcg->lock); |
323 |
+ } |
324 |
+ |
325 |
+ spin_unlock_irq(&q->queue_lock); |
326 |
+diff --git a/block/blk-integrity.c b/block/blk-integrity.c |
327 |
+index 410da060d1f5a..9e83159f5a527 100644 |
328 |
+--- a/block/blk-integrity.c |
329 |
++++ b/block/blk-integrity.c |
330 |
+@@ -426,8 +426,15 @@ EXPORT_SYMBOL(blk_integrity_register); |
331 |
+ */ |
332 |
+ void blk_integrity_unregister(struct gendisk *disk) |
333 |
+ { |
334 |
++ struct blk_integrity *bi = &disk->queue->integrity; |
335 |
++ |
336 |
++ if (!bi->profile) |
337 |
++ return; |
338 |
++ |
339 |
++ /* ensure all bios are off the integrity workqueue */ |
340 |
++ blk_flush_integrity(); |
341 |
+ blk_queue_flag_clear(QUEUE_FLAG_STABLE_WRITES, disk->queue); |
342 |
+- memset(&disk->queue->integrity, 0, sizeof(struct blk_integrity)); |
343 |
++ memset(bi, 0, sizeof(*bi)); |
344 |
+ } |
345 |
+ EXPORT_SYMBOL(blk_integrity_unregister); |
346 |
+ |
347 |
+diff --git a/block/blk-mq-sched.c b/block/blk-mq-sched.c |
348 |
+index 581be65a53c15..24c08963890e9 100644 |
349 |
+--- a/block/blk-mq-sched.c |
350 |
++++ b/block/blk-mq-sched.c |
351 |
+@@ -75,7 +75,8 @@ void blk_mq_sched_restart(struct blk_mq_hw_ctx *hctx) |
352 |
+ blk_mq_run_hw_queue(hctx, true); |
353 |
+ } |
354 |
+ |
355 |
+-static int sched_rq_cmp(void *priv, struct list_head *a, struct list_head *b) |
356 |
++static int sched_rq_cmp(void *priv, const struct list_head *a, |
357 |
++ const struct list_head *b) |
358 |
+ { |
359 |
+ struct request *rqa = container_of(a, struct request, queuelist); |
360 |
+ struct request *rqb = container_of(b, struct request, queuelist); |
361 |
+diff --git a/block/blk-mq-tag.c b/block/blk-mq-tag.c |
362 |
+index c4f2f6c123aed..16ad9e6566108 100644 |
363 |
+--- a/block/blk-mq-tag.c |
364 |
++++ b/block/blk-mq-tag.c |
365 |
+@@ -207,7 +207,7 @@ static struct request *blk_mq_find_and_get_req(struct blk_mq_tags *tags, |
366 |
+ |
367 |
+ spin_lock_irqsave(&tags->lock, flags); |
368 |
+ rq = tags->rqs[bitnr]; |
369 |
+- if (!rq || !refcount_inc_not_zero(&rq->ref)) |
370 |
++ if (!rq || rq->tag != bitnr || !refcount_inc_not_zero(&rq->ref)) |
371 |
+ rq = NULL; |
372 |
+ spin_unlock_irqrestore(&tags->lock, flags); |
373 |
+ return rq; |
374 |
+diff --git a/block/blk-mq.c b/block/blk-mq.c |
375 |
+index 6dcb86c1c985d..eed9a4c1519df 100644 |
376 |
+--- a/block/blk-mq.c |
377 |
++++ b/block/blk-mq.c |
378 |
+@@ -1866,7 +1866,8 @@ void blk_mq_insert_requests(struct blk_mq_hw_ctx *hctx, struct blk_mq_ctx *ctx, |
379 |
+ spin_unlock(&ctx->lock); |
380 |
+ } |
381 |
+ |
382 |
+-static int plug_rq_cmp(void *priv, struct list_head *a, struct list_head *b) |
383 |
++static int plug_rq_cmp(void *priv, const struct list_head *a, |
384 |
++ const struct list_head *b) |
385 |
+ { |
386 |
+ struct request *rqa = container_of(a, struct request, queuelist); |
387 |
+ struct request *rqb = container_of(b, struct request, queuelist); |
388 |
+diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c |
389 |
+index cb18cb5c51b17..d061bff5cc96c 100644 |
390 |
+--- a/drivers/acpi/nfit/core.c |
391 |
++++ b/drivers/acpi/nfit/core.c |
392 |
+@@ -1194,7 +1194,8 @@ static int __nfit_mem_init(struct acpi_nfit_desc *acpi_desc, |
393 |
+ return 0; |
394 |
+ } |
395 |
+ |
396 |
+-static int nfit_mem_cmp(void *priv, struct list_head *_a, struct list_head *_b) |
397 |
++static int nfit_mem_cmp(void *priv, const struct list_head *_a, |
398 |
++ const struct list_head *_b) |
399 |
+ { |
400 |
+ struct nfit_mem *a = container_of(_a, typeof(*a), list); |
401 |
+ struct nfit_mem *b = container_of(_b, typeof(*b), list); |
402 |
+diff --git a/drivers/acpi/numa/hmat.c b/drivers/acpi/numa/hmat.c |
403 |
+index cb73a5d6ea76d..137a5dd880c26 100644 |
404 |
+--- a/drivers/acpi/numa/hmat.c |
405 |
++++ b/drivers/acpi/numa/hmat.c |
406 |
+@@ -558,7 +558,8 @@ static bool hmat_update_best(u8 type, u32 value, u32 *best) |
407 |
+ return updated; |
408 |
+ } |
409 |
+ |
410 |
+-static int initiator_cmp(void *priv, struct list_head *a, struct list_head *b) |
411 |
++static int initiator_cmp(void *priv, const struct list_head *a, |
412 |
++ const struct list_head *b) |
413 |
+ { |
414 |
+ struct memory_initiator *ia; |
415 |
+ struct memory_initiator *ib; |
416 |
+diff --git a/drivers/android/binder.c b/drivers/android/binder.c |
417 |
+index 2a3952925855d..65b22b5af51ac 100644 |
418 |
+--- a/drivers/android/binder.c |
419 |
++++ b/drivers/android/binder.c |
420 |
+@@ -2236,6 +2236,7 @@ static void binder_deferred_fd_close(int fd) |
421 |
+ } |
422 |
+ |
423 |
+ static void binder_transaction_buffer_release(struct binder_proc *proc, |
424 |
++ struct binder_thread *thread, |
425 |
+ struct binder_buffer *buffer, |
426 |
+ binder_size_t failed_at, |
427 |
+ bool is_failure) |
428 |
+@@ -2395,8 +2396,16 @@ static void binder_transaction_buffer_release(struct binder_proc *proc, |
429 |
+ &proc->alloc, &fd, buffer, |
430 |
+ offset, sizeof(fd)); |
431 |
+ WARN_ON(err); |
432 |
+- if (!err) |
433 |
++ if (!err) { |
434 |
+ binder_deferred_fd_close(fd); |
435 |
++ /* |
436 |
++ * Need to make sure the thread goes |
437 |
++ * back to userspace to complete the |
438 |
++ * deferred close |
439 |
++ */ |
440 |
++ if (thread) |
441 |
++ thread->looper_need_return = true; |
442 |
++ } |
443 |
+ } |
444 |
+ } break; |
445 |
+ default: |
446 |
+@@ -3465,7 +3474,7 @@ err_bad_parent: |
447 |
+ err_copy_data_failed: |
448 |
+ binder_free_txn_fixups(t); |
449 |
+ trace_binder_transaction_failed_buffer_release(t->buffer); |
450 |
+- binder_transaction_buffer_release(target_proc, t->buffer, |
451 |
++ binder_transaction_buffer_release(target_proc, NULL, t->buffer, |
452 |
+ buffer_offset, true); |
453 |
+ if (target_node) |
454 |
+ binder_dec_node_tmpref(target_node); |
455 |
+@@ -3542,7 +3551,9 @@ err_invalid_target_handle: |
456 |
+ * Cleanup buffer and free it. |
457 |
+ */ |
458 |
+ static void |
459 |
+-binder_free_buf(struct binder_proc *proc, struct binder_buffer *buffer) |
460 |
++binder_free_buf(struct binder_proc *proc, |
461 |
++ struct binder_thread *thread, |
462 |
++ struct binder_buffer *buffer) |
463 |
+ { |
464 |
+ binder_inner_proc_lock(proc); |
465 |
+ if (buffer->transaction) { |
466 |
+@@ -3570,7 +3581,7 @@ binder_free_buf(struct binder_proc *proc, struct binder_buffer *buffer) |
467 |
+ binder_node_inner_unlock(buf_node); |
468 |
+ } |
469 |
+ trace_binder_transaction_buffer_release(buffer); |
470 |
+- binder_transaction_buffer_release(proc, buffer, 0, false); |
471 |
++ binder_transaction_buffer_release(proc, thread, buffer, 0, false); |
472 |
+ binder_alloc_free_buf(&proc->alloc, buffer); |
473 |
+ } |
474 |
+ |
475 |
+@@ -3771,7 +3782,7 @@ static int binder_thread_write(struct binder_proc *proc, |
476 |
+ proc->pid, thread->pid, (u64)data_ptr, |
477 |
+ buffer->debug_id, |
478 |
+ buffer->transaction ? "active" : "finished"); |
479 |
+- binder_free_buf(proc, buffer); |
480 |
++ binder_free_buf(proc, thread, buffer); |
481 |
+ break; |
482 |
+ } |
483 |
+ |
484 |
+@@ -4459,7 +4470,7 @@ retry: |
485 |
+ buffer->transaction = NULL; |
486 |
+ binder_cleanup_transaction(t, "fd fixups failed", |
487 |
+ BR_FAILED_REPLY); |
488 |
+- binder_free_buf(proc, buffer); |
489 |
++ binder_free_buf(proc, thread, buffer); |
490 |
+ binder_debug(BINDER_DEBUG_FAILED_TRANSACTION, |
491 |
+ "%d:%d %stransaction %d fd fixups failed %d/%d, line %d\n", |
492 |
+ proc->pid, thread->pid, |
493 |
+diff --git a/drivers/clk/keystone/sci-clk.c b/drivers/clk/keystone/sci-clk.c |
494 |
+index aaf31abe1c8ff..7e1b136e71ae0 100644 |
495 |
+--- a/drivers/clk/keystone/sci-clk.c |
496 |
++++ b/drivers/clk/keystone/sci-clk.c |
497 |
+@@ -503,8 +503,8 @@ static int ti_sci_scan_clocks_from_fw(struct sci_clk_provider *provider) |
498 |
+ |
499 |
+ #else |
500 |
+ |
501 |
+-static int _cmp_sci_clk_list(void *priv, struct list_head *a, |
502 |
+- struct list_head *b) |
503 |
++static int _cmp_sci_clk_list(void *priv, const struct list_head *a, |
504 |
++ const struct list_head *b) |
505 |
+ { |
506 |
+ struct sci_clk *ca = container_of(a, struct sci_clk, node); |
507 |
+ struct sci_clk *cb = container_of(b, struct sci_clk, node); |
508 |
+diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c |
509 |
+index 44a5d15a75728..1686705bee7bd 100644 |
510 |
+--- a/drivers/cpufreq/intel_pstate.c |
511 |
++++ b/drivers/cpufreq/intel_pstate.c |
512 |
+@@ -3035,11 +3035,15 @@ static int __init intel_pstate_init(void) |
513 |
+ if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL) |
514 |
+ return -ENODEV; |
515 |
+ |
516 |
+- if (no_load) |
517 |
+- return -ENODEV; |
518 |
+- |
519 |
+ id = x86_match_cpu(hwp_support_ids); |
520 |
+ if (id) { |
521 |
++ bool hwp_forced = intel_pstate_hwp_is_enabled(); |
522 |
++ |
523 |
++ if (hwp_forced) |
524 |
++ pr_info("HWP enabled by BIOS\n"); |
525 |
++ else if (no_load) |
526 |
++ return -ENODEV; |
527 |
++ |
528 |
+ copy_cpu_funcs(&core_funcs); |
529 |
+ /* |
530 |
+ * Avoid enabling HWP for processors without EPP support, |
531 |
+@@ -3049,8 +3053,7 @@ static int __init intel_pstate_init(void) |
532 |
+ * If HWP is enabled already, though, there is no choice but to |
533 |
+ * deal with it. |
534 |
+ */ |
535 |
+- if ((!no_hwp && boot_cpu_has(X86_FEATURE_HWP_EPP)) || |
536 |
+- intel_pstate_hwp_is_enabled()) { |
537 |
++ if ((!no_hwp && boot_cpu_has(X86_FEATURE_HWP_EPP)) || hwp_forced) { |
538 |
+ hwp_active++; |
539 |
+ hwp_mode_bdw = id->driver_data; |
540 |
+ intel_pstate.attr = hwp_cpufreq_attrs; |
541 |
+@@ -3061,7 +3064,11 @@ static int __init intel_pstate_init(void) |
542 |
+ |
543 |
+ goto hwp_cpu_matched; |
544 |
+ } |
545 |
++ pr_info("HWP not enabled\n"); |
546 |
+ } else { |
547 |
++ if (no_load) |
548 |
++ return -ENODEV; |
549 |
++ |
550 |
+ id = x86_match_cpu(intel_pstate_cpu_ids); |
551 |
+ if (!id) { |
552 |
+ pr_info("CPU model not supported\n"); |
553 |
+@@ -3138,10 +3145,9 @@ static int __init intel_pstate_setup(char *str) |
554 |
+ else if (!strcmp(str, "passive")) |
555 |
+ default_driver = &intel_cpufreq; |
556 |
+ |
557 |
+- if (!strcmp(str, "no_hwp")) { |
558 |
+- pr_info("HWP disabled\n"); |
559 |
++ if (!strcmp(str, "no_hwp")) |
560 |
+ no_hwp = 1; |
561 |
+- } |
562 |
++ |
563 |
+ if (!strcmp(str, "force")) |
564 |
+ force_load = 1; |
565 |
+ if (!strcmp(str, "hwp_only")) |
566 |
+diff --git a/drivers/edac/dmc520_edac.c b/drivers/edac/dmc520_edac.c |
567 |
+index fc1153ab1ebbc..b8a7d9594afd4 100644 |
568 |
+--- a/drivers/edac/dmc520_edac.c |
569 |
++++ b/drivers/edac/dmc520_edac.c |
570 |
+@@ -464,7 +464,7 @@ static void dmc520_init_csrow(struct mem_ctl_info *mci) |
571 |
+ dimm->grain = pvt->mem_width_in_bytes; |
572 |
+ dimm->dtype = dt; |
573 |
+ dimm->mtype = mt; |
574 |
+- dimm->edac_mode = EDAC_FLAG_SECDED; |
575 |
++ dimm->edac_mode = EDAC_SECDED; |
576 |
+ dimm->nr_pages = pages_per_rank / csi->nr_channels; |
577 |
+ } |
578 |
+ } |
579 |
+diff --git a/drivers/edac/synopsys_edac.c b/drivers/edac/synopsys_edac.c |
580 |
+index 12211dc040e8f..1a801a5d3b08b 100644 |
581 |
+--- a/drivers/edac/synopsys_edac.c |
582 |
++++ b/drivers/edac/synopsys_edac.c |
583 |
+@@ -782,7 +782,7 @@ static void init_csrows(struct mem_ctl_info *mci) |
584 |
+ |
585 |
+ for (j = 0; j < csi->nr_channels; j++) { |
586 |
+ dimm = csi->channels[j]->dimm; |
587 |
+- dimm->edac_mode = EDAC_FLAG_SECDED; |
588 |
++ dimm->edac_mode = EDAC_SECDED; |
589 |
+ dimm->mtype = p_data->get_mtype(priv->baseaddr); |
590 |
+ dimm->nr_pages = (size >> PAGE_SHIFT) / csi->nr_channels; |
591 |
+ dimm->grain = SYNPS_EDAC_ERR_GRAIN; |
592 |
+diff --git a/drivers/fpga/machxo2-spi.c b/drivers/fpga/machxo2-spi.c |
593 |
+index b316369156fe6..9eef18349eee6 100644 |
594 |
+--- a/drivers/fpga/machxo2-spi.c |
595 |
++++ b/drivers/fpga/machxo2-spi.c |
596 |
+@@ -225,8 +225,10 @@ static int machxo2_write_init(struct fpga_manager *mgr, |
597 |
+ goto fail; |
598 |
+ |
599 |
+ get_status(spi, &status); |
600 |
+- if (test_bit(FAIL, &status)) |
601 |
++ if (test_bit(FAIL, &status)) { |
602 |
++ ret = -EINVAL; |
603 |
+ goto fail; |
604 |
++ } |
605 |
+ dump_status_reg(&status); |
606 |
+ |
607 |
+ spi_message_init(&msg); |
608 |
+@@ -313,6 +315,7 @@ static int machxo2_write_complete(struct fpga_manager *mgr, |
609 |
+ dump_status_reg(&status); |
610 |
+ if (!test_bit(DONE, &status)) { |
611 |
+ machxo2_cleanup(mgr); |
612 |
++ ret = -EINVAL; |
613 |
+ goto fail; |
614 |
+ } |
615 |
+ |
616 |
+@@ -335,6 +338,7 @@ static int machxo2_write_complete(struct fpga_manager *mgr, |
617 |
+ break; |
618 |
+ if (++refreshloop == MACHXO2_MAX_REFRESH_LOOP) { |
619 |
+ machxo2_cleanup(mgr); |
620 |
++ ret = -EINVAL; |
621 |
+ goto fail; |
622 |
+ } |
623 |
+ } while (1); |
624 |
+diff --git a/drivers/gpio/gpio-uniphier.c b/drivers/gpio/gpio-uniphier.c |
625 |
+index f99f3c10bed03..39dca147d587a 100644 |
626 |
+--- a/drivers/gpio/gpio-uniphier.c |
627 |
++++ b/drivers/gpio/gpio-uniphier.c |
628 |
+@@ -184,7 +184,7 @@ static void uniphier_gpio_irq_mask(struct irq_data *data) |
629 |
+ |
630 |
+ uniphier_gpio_reg_update(priv, UNIPHIER_GPIO_IRQ_EN, mask, 0); |
631 |
+ |
632 |
+- return irq_chip_mask_parent(data); |
633 |
++ irq_chip_mask_parent(data); |
634 |
+ } |
635 |
+ |
636 |
+ static void uniphier_gpio_irq_unmask(struct irq_data *data) |
637 |
+@@ -194,7 +194,7 @@ static void uniphier_gpio_irq_unmask(struct irq_data *data) |
638 |
+ |
639 |
+ uniphier_gpio_reg_update(priv, UNIPHIER_GPIO_IRQ_EN, mask, mask); |
640 |
+ |
641 |
+- return irq_chip_unmask_parent(data); |
642 |
++ irq_chip_unmask_parent(data); |
643 |
+ } |
644 |
+ |
645 |
+ static int uniphier_gpio_irq_set_type(struct irq_data *data, unsigned int type) |
646 |
+diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |
647 |
+index bc9df3f216f56..ce21a21ddb235 100644 |
648 |
+--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |
649 |
++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |
650 |
+@@ -8962,7 +8962,8 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev, |
651 |
+ goto fail; |
652 |
+ status = dc_validate_global_state(dc, dm_state->context, false); |
653 |
+ if (status != DC_OK) { |
654 |
+- DC_LOG_WARNING("DC global validation failure: %s (%d)", |
655 |
++ drm_dbg_atomic(dev, |
656 |
++ "DC global validation failure: %s (%d)", |
657 |
+ dc_status_to_str(status), status); |
658 |
+ ret = -EINVAL; |
659 |
+ goto fail; |
660 |
+diff --git a/drivers/gpu/drm/amd/pm/powerplay/si_dpm.c b/drivers/gpu/drm/amd/pm/powerplay/si_dpm.c |
661 |
+index b5986d19dc08b..a1e7ba5995c57 100644 |
662 |
+--- a/drivers/gpu/drm/amd/pm/powerplay/si_dpm.c |
663 |
++++ b/drivers/gpu/drm/amd/pm/powerplay/si_dpm.c |
664 |
+@@ -6870,6 +6870,8 @@ static int si_dpm_enable(struct amdgpu_device *adev) |
665 |
+ si_enable_auto_throttle_source(adev, AMDGPU_DPM_AUTO_THROTTLE_SRC_THERMAL, true); |
666 |
+ si_thermal_start_thermal_controller(adev); |
667 |
+ |
668 |
++ ni_update_current_ps(adev, boot_ps); |
669 |
++ |
670 |
+ return 0; |
671 |
+ } |
672 |
+ |
673 |
+diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c |
674 |
+index 511cde5c7fa6f..0f99e5453f152 100644 |
675 |
+--- a/drivers/gpu/drm/drm_modes.c |
676 |
++++ b/drivers/gpu/drm/drm_modes.c |
677 |
+@@ -1290,7 +1290,8 @@ EXPORT_SYMBOL(drm_mode_prune_invalid); |
678 |
+ * Negative if @lh_a is better than @lh_b, zero if they're equivalent, or |
679 |
+ * positive if @lh_b is better than @lh_a. |
680 |
+ */ |
681 |
+-static int drm_mode_compare(void *priv, struct list_head *lh_a, struct list_head *lh_b) |
682 |
++static int drm_mode_compare(void *priv, const struct list_head *lh_a, |
683 |
++ const struct list_head *lh_b) |
684 |
+ { |
685 |
+ struct drm_display_mode *a = list_entry(lh_a, struct drm_display_mode, head); |
686 |
+ struct drm_display_mode *b = list_entry(lh_b, struct drm_display_mode, head); |
687 |
+diff --git a/drivers/gpu/drm/i915/gt/intel_engine_user.c b/drivers/gpu/drm/i915/gt/intel_engine_user.c |
688 |
+index 34e6096f196ed..da21d2a10cc94 100644 |
689 |
+--- a/drivers/gpu/drm/i915/gt/intel_engine_user.c |
690 |
++++ b/drivers/gpu/drm/i915/gt/intel_engine_user.c |
691 |
+@@ -49,7 +49,8 @@ static const u8 uabi_classes[] = { |
692 |
+ [VIDEO_ENHANCEMENT_CLASS] = I915_ENGINE_CLASS_VIDEO_ENHANCE, |
693 |
+ }; |
694 |
+ |
695 |
+-static int engine_cmp(void *priv, struct list_head *A, struct list_head *B) |
696 |
++static int engine_cmp(void *priv, const struct list_head *A, |
697 |
++ const struct list_head *B) |
698 |
+ { |
699 |
+ const struct intel_engine_cs *a = |
700 |
+ container_of((struct rb_node *)A, typeof(*a), uabi_node); |
701 |
+diff --git a/drivers/gpu/drm/i915/gvt/debugfs.c b/drivers/gpu/drm/i915/gvt/debugfs.c |
702 |
+index 62e6a14ad58ef..9f1c209d92511 100644 |
703 |
+--- a/drivers/gpu/drm/i915/gvt/debugfs.c |
704 |
++++ b/drivers/gpu/drm/i915/gvt/debugfs.c |
705 |
+@@ -41,7 +41,7 @@ struct diff_mmio { |
706 |
+ |
707 |
+ /* Compare two diff_mmio items. */ |
708 |
+ static int mmio_offset_compare(void *priv, |
709 |
+- struct list_head *a, struct list_head *b) |
710 |
++ const struct list_head *a, const struct list_head *b) |
711 |
+ { |
712 |
+ struct diff_mmio *ma; |
713 |
+ struct diff_mmio *mb; |
714 |
+diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c |
715 |
+index 713770fb2b92d..65e28c4cd4ce5 100644 |
716 |
+--- a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c |
717 |
++++ b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c |
718 |
+@@ -1075,7 +1075,8 @@ static int igt_ppgtt_shrink_boom(void *arg) |
719 |
+ return exercise_ppgtt(arg, shrink_boom); |
720 |
+ } |
721 |
+ |
722 |
+-static int sort_holes(void *priv, struct list_head *A, struct list_head *B) |
723 |
++static int sort_holes(void *priv, const struct list_head *A, |
724 |
++ const struct list_head *B) |
725 |
+ { |
726 |
+ struct drm_mm_node *a = list_entry(A, typeof(*a), hole_stack); |
727 |
+ struct drm_mm_node *b = list_entry(B, typeof(*b), hole_stack); |
728 |
+diff --git a/drivers/gpu/drm/radeon/radeon_cs.c b/drivers/gpu/drm/radeon/radeon_cs.c |
729 |
+index 21ce2f9502c09..a78b60b62caf2 100644 |
730 |
+--- a/drivers/gpu/drm/radeon/radeon_cs.c |
731 |
++++ b/drivers/gpu/drm/radeon/radeon_cs.c |
732 |
+@@ -394,8 +394,8 @@ int radeon_cs_parser_init(struct radeon_cs_parser *p, void *data) |
733 |
+ return 0; |
734 |
+ } |
735 |
+ |
736 |
+-static int cmp_size_smaller_first(void *priv, struct list_head *a, |
737 |
+- struct list_head *b) |
738 |
++static int cmp_size_smaller_first(void *priv, const struct list_head *a, |
739 |
++ const struct list_head *b) |
740 |
+ { |
741 |
+ struct radeon_bo_list *la = list_entry(a, struct radeon_bo_list, tv.head); |
742 |
+ struct radeon_bo_list *lb = list_entry(b, struct radeon_bo_list, tv.head); |
743 |
+diff --git a/drivers/infiniband/hw/usnic/usnic_uiom_interval_tree.c b/drivers/infiniband/hw/usnic/usnic_uiom_interval_tree.c |
744 |
+index d399523206c78..29d71267af786 100644 |
745 |
+--- a/drivers/infiniband/hw/usnic/usnic_uiom_interval_tree.c |
746 |
++++ b/drivers/infiniband/hw/usnic/usnic_uiom_interval_tree.c |
747 |
+@@ -83,7 +83,8 @@ usnic_uiom_interval_node_alloc(long int start, long int last, int ref_cnt, |
748 |
+ return interval; |
749 |
+ } |
750 |
+ |
751 |
+-static int interval_cmp(void *priv, struct list_head *a, struct list_head *b) |
752 |
++static int interval_cmp(void *priv, const struct list_head *a, |
753 |
++ const struct list_head *b) |
754 |
+ { |
755 |
+ struct usnic_uiom_interval_node *node_a, *node_b; |
756 |
+ |
757 |
+diff --git a/drivers/interconnect/qcom/bcm-voter.c b/drivers/interconnect/qcom/bcm-voter.c |
758 |
+index dd0e3bd50b94c..3c0809095a31c 100644 |
759 |
+--- a/drivers/interconnect/qcom/bcm-voter.c |
760 |
++++ b/drivers/interconnect/qcom/bcm-voter.c |
761 |
+@@ -39,7 +39,7 @@ struct bcm_voter { |
762 |
+ u32 tcs_wait; |
763 |
+ }; |
764 |
+ |
765 |
+-static int cmp_vcd(void *priv, struct list_head *a, struct list_head *b) |
766 |
++static int cmp_vcd(void *priv, const struct list_head *a, const struct list_head *b) |
767 |
+ { |
768 |
+ const struct qcom_icc_bcm *bcm_a = |
769 |
+ list_entry(a, struct qcom_icc_bcm, list); |
770 |
+diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig |
771 |
+index 6156a065681bc..dc062e8c2caf8 100644 |
772 |
+--- a/drivers/irqchip/Kconfig |
773 |
++++ b/drivers/irqchip/Kconfig |
774 |
+@@ -425,6 +425,7 @@ config MESON_IRQ_GPIO |
775 |
+ config GOLDFISH_PIC |
776 |
+ bool "Goldfish programmable interrupt controller" |
777 |
+ depends on MIPS && (GOLDFISH || COMPILE_TEST) |
778 |
++ select GENERIC_IRQ_CHIP |
779 |
+ select IRQ_DOMAIN |
780 |
+ help |
781 |
+ Say yes here to enable Goldfish interrupt controller driver used |
782 |
+diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c |
783 |
+index 4069c215328b3..95e0b82b6c661 100644 |
784 |
+--- a/drivers/irqchip/irq-gic-v3-its.c |
785 |
++++ b/drivers/irqchip/irq-gic-v3-its.c |
786 |
+@@ -4489,7 +4489,7 @@ static int its_vpe_irq_domain_alloc(struct irq_domain *domain, unsigned int virq |
787 |
+ |
788 |
+ if (err) { |
789 |
+ if (i > 0) |
790 |
+- its_vpe_irq_domain_free(domain, virq, i - 1); |
791 |
++ its_vpe_irq_domain_free(domain, virq, i); |
792 |
+ |
793 |
+ its_lpi_free(bitmap, base, nr_ids); |
794 |
+ its_free_prop_table(vprop_page); |
795 |
+diff --git a/drivers/mcb/mcb-core.c b/drivers/mcb/mcb-core.c |
796 |
+index 38fbb3b598731..38cc8340e817d 100644 |
797 |
+--- a/drivers/mcb/mcb-core.c |
798 |
++++ b/drivers/mcb/mcb-core.c |
799 |
+@@ -277,8 +277,8 @@ struct mcb_bus *mcb_alloc_bus(struct device *carrier) |
800 |
+ |
801 |
+ bus_nr = ida_simple_get(&mcb_ida, 0, 0, GFP_KERNEL); |
802 |
+ if (bus_nr < 0) { |
803 |
+- rc = bus_nr; |
804 |
+- goto err_free; |
805 |
++ kfree(bus); |
806 |
++ return ERR_PTR(bus_nr); |
807 |
+ } |
808 |
+ |
809 |
+ bus->bus_nr = bus_nr; |
810 |
+@@ -293,12 +293,12 @@ struct mcb_bus *mcb_alloc_bus(struct device *carrier) |
811 |
+ dev_set_name(&bus->dev, "mcb:%d", bus_nr); |
812 |
+ rc = device_add(&bus->dev); |
813 |
+ if (rc) |
814 |
+- goto err_free; |
815 |
++ goto err_put; |
816 |
+ |
817 |
+ return bus; |
818 |
+-err_free: |
819 |
+- put_device(carrier); |
820 |
+- kfree(bus); |
821 |
++ |
822 |
++err_put: |
823 |
++ put_device(&bus->dev); |
824 |
+ return ERR_PTR(rc); |
825 |
+ } |
826 |
+ EXPORT_SYMBOL_NS_GPL(mcb_alloc_bus, MCB); |
827 |
+diff --git a/drivers/md/md.c b/drivers/md/md.c |
828 |
+index 288d26013de27..f16f190546ef3 100644 |
829 |
+--- a/drivers/md/md.c |
830 |
++++ b/drivers/md/md.c |
831 |
+@@ -5759,10 +5759,6 @@ static int md_alloc(dev_t dev, char *name) |
832 |
+ disk->flags |= GENHD_FL_EXT_DEVT; |
833 |
+ disk->events |= DISK_EVENT_MEDIA_CHANGE; |
834 |
+ mddev->gendisk = disk; |
835 |
+- /* As soon as we call add_disk(), another thread could get |
836 |
+- * through to md_open, so make sure it doesn't get too far |
837 |
+- */ |
838 |
+- mutex_lock(&mddev->open_mutex); |
839 |
+ add_disk(disk); |
840 |
+ |
841 |
+ error = kobject_add(&mddev->kobj, &disk_to_dev(disk)->kobj, "%s", "md"); |
842 |
+@@ -5777,7 +5773,6 @@ static int md_alloc(dev_t dev, char *name) |
843 |
+ if (mddev->kobj.sd && |
844 |
+ sysfs_create_group(&mddev->kobj, &md_bitmap_group)) |
845 |
+ pr_debug("pointless warning\n"); |
846 |
+- mutex_unlock(&mddev->open_mutex); |
847 |
+ abort: |
848 |
+ mutex_unlock(&disks_mutex); |
849 |
+ if (!error && mddev->kobj.sd) { |
850 |
+diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c |
851 |
+index 39343479ac2a9..c82953a3299e2 100644 |
852 |
+--- a/drivers/md/raid5.c |
853 |
++++ b/drivers/md/raid5.c |
854 |
+@@ -953,7 +953,8 @@ static void dispatch_bio_list(struct bio_list *tmp) |
855 |
+ submit_bio_noacct(bio); |
856 |
+ } |
857 |
+ |
858 |
+-static int cmp_stripe(void *priv, struct list_head *a, struct list_head *b) |
859 |
++static int cmp_stripe(void *priv, const struct list_head *a, |
860 |
++ const struct list_head *b) |
861 |
+ { |
862 |
+ const struct r5pending_data *da = list_entry(a, |
863 |
+ struct r5pending_data, sibling); |
864 |
+diff --git a/drivers/misc/sram.c b/drivers/misc/sram.c |
865 |
+index 6c1a23cb3e8c0..202bf951e9095 100644 |
866 |
+--- a/drivers/misc/sram.c |
867 |
++++ b/drivers/misc/sram.c |
868 |
+@@ -144,8 +144,8 @@ static void sram_free_partitions(struct sram_dev *sram) |
869 |
+ } |
870 |
+ } |
871 |
+ |
872 |
+-static int sram_reserve_cmp(void *priv, struct list_head *a, |
873 |
+- struct list_head *b) |
874 |
++static int sram_reserve_cmp(void *priv, const struct list_head *a, |
875 |
++ const struct list_head *b) |
876 |
+ { |
877 |
+ struct sram_reserve *ra = list_entry(a, struct sram_reserve, list); |
878 |
+ struct sram_reserve *rb = list_entry(b, struct sram_reserve, list); |
879 |
+diff --git a/drivers/net/dsa/realtek-smi-core.c b/drivers/net/dsa/realtek-smi-core.c |
880 |
+index 8e49d4f85d48c..6bf46d76c0281 100644 |
881 |
+--- a/drivers/net/dsa/realtek-smi-core.c |
882 |
++++ b/drivers/net/dsa/realtek-smi-core.c |
883 |
+@@ -368,7 +368,7 @@ int realtek_smi_setup_mdio(struct realtek_smi *smi) |
884 |
+ smi->slave_mii_bus->parent = smi->dev; |
885 |
+ smi->ds->slave_mii_bus = smi->slave_mii_bus; |
886 |
+ |
887 |
+- ret = of_mdiobus_register(smi->slave_mii_bus, mdio_np); |
888 |
++ ret = devm_of_mdiobus_register(smi->dev, smi->slave_mii_bus, mdio_np); |
889 |
+ if (ret) { |
890 |
+ dev_err(smi->dev, "unable to register MDIO bus %s\n", |
891 |
+ smi->slave_mii_bus->id); |
892 |
+diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c b/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c |
893 |
+index f26d037356191..5b996330f228b 100644 |
894 |
+--- a/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c |
895 |
++++ b/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c |
896 |
+@@ -419,13 +419,13 @@ static int atl_resume_common(struct device *dev, bool deep) |
897 |
+ if (deep) { |
898 |
+ /* Reinitialize Nic/Vecs objects */ |
899 |
+ aq_nic_deinit(nic, !nic->aq_hw->aq_nic_cfg->wol); |
900 |
++ } |
901 |
+ |
902 |
++ if (netif_running(nic->ndev)) { |
903 |
+ ret = aq_nic_init(nic); |
904 |
+ if (ret) |
905 |
+ goto err_exit; |
906 |
+- } |
907 |
+ |
908 |
+- if (netif_running(nic->ndev)) { |
909 |
+ ret = aq_nic_start(nic); |
910 |
+ if (ret) |
911 |
+ goto err_exit; |
912 |
+diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
913 |
+index 26179e437bbfd..cb0c270418a4d 100644 |
914 |
+--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
915 |
++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c |
916 |
+@@ -381,7 +381,7 @@ static bool bnxt_txr_netif_try_stop_queue(struct bnxt *bp, |
917 |
+ * netif_tx_queue_stopped(). |
918 |
+ */ |
919 |
+ smp_mb(); |
920 |
+- if (bnxt_tx_avail(bp, txr) > bp->tx_wake_thresh) { |
921 |
++ if (bnxt_tx_avail(bp, txr) >= bp->tx_wake_thresh) { |
922 |
+ netif_tx_wake_queue(txq); |
923 |
+ return false; |
924 |
+ } |
925 |
+@@ -717,7 +717,7 @@ next_tx_int: |
926 |
+ smp_mb(); |
927 |
+ |
928 |
+ if (unlikely(netif_tx_queue_stopped(txq)) && |
929 |
+- bnxt_tx_avail(bp, txr) > bp->tx_wake_thresh && |
930 |
++ bnxt_tx_avail(bp, txr) >= bp->tx_wake_thresh && |
931 |
+ READ_ONCE(txr->dev_state) != BNXT_DEV_STATE_CLOSING) |
932 |
+ netif_tx_wake_queue(txq); |
933 |
+ } |
934 |
+@@ -2300,7 +2300,7 @@ static int __bnxt_poll_work(struct bnxt *bp, struct bnxt_cp_ring_info *cpr, |
935 |
+ if (TX_CMP_TYPE(txcmp) == CMP_TYPE_TX_L2_CMP) { |
936 |
+ tx_pkts++; |
937 |
+ /* return full budget so NAPI will complete. */ |
938 |
+- if (unlikely(tx_pkts > bp->tx_wake_thresh)) { |
939 |
++ if (unlikely(tx_pkts >= bp->tx_wake_thresh)) { |
940 |
+ rx_pkts = budget; |
941 |
+ raw_cons = NEXT_RAW_CMP(raw_cons); |
942 |
+ if (budget) |
943 |
+@@ -3431,7 +3431,7 @@ static int bnxt_init_tx_rings(struct bnxt *bp) |
944 |
+ u16 i; |
945 |
+ |
946 |
+ bp->tx_wake_thresh = max_t(int, bp->tx_ring_size / 2, |
947 |
+- MAX_SKB_FRAGS + 1); |
948 |
++ BNXT_MIN_TX_DESC_CNT); |
949 |
+ |
950 |
+ for (i = 0; i < bp->tx_nr_rings; i++) { |
951 |
+ struct bnxt_tx_ring_info *txr = &bp->tx_ring[i]; |
952 |
+diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h |
953 |
+index 95d10e7bbb041..92f9f7f5240b6 100644 |
954 |
+--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h |
955 |
++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h |
956 |
+@@ -611,6 +611,11 @@ struct nqe_cn { |
957 |
+ #define BNXT_MAX_RX_JUM_DESC_CNT (RX_DESC_CNT * MAX_RX_AGG_PAGES - 1) |
958 |
+ #define BNXT_MAX_TX_DESC_CNT (TX_DESC_CNT * MAX_TX_PAGES - 1) |
959 |
+ |
960 |
++/* Minimum TX BDs for a TX packet with MAX_SKB_FRAGS + 1. We need one extra |
961 |
++ * BD because the first TX BD is always a long BD. |
962 |
++ */ |
963 |
++#define BNXT_MIN_TX_DESC_CNT (MAX_SKB_FRAGS + 2) |
964 |
++ |
965 |
+ #define RX_RING(x) (((x) & ~(RX_DESC_CNT - 1)) >> (BNXT_PAGE_SHIFT - 4)) |
966 |
+ #define RX_IDX(x) ((x) & (RX_DESC_CNT - 1)) |
967 |
+ |
968 |
+diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c |
969 |
+index 1471c9a362388..6f9196ff2ac4f 100644 |
970 |
+--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c |
971 |
++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c |
972 |
+@@ -780,7 +780,7 @@ static int bnxt_set_ringparam(struct net_device *dev, |
973 |
+ |
974 |
+ if ((ering->rx_pending > BNXT_MAX_RX_DESC_CNT) || |
975 |
+ (ering->tx_pending > BNXT_MAX_TX_DESC_CNT) || |
976 |
+- (ering->tx_pending <= MAX_SKB_FRAGS)) |
977 |
++ (ering->tx_pending < BNXT_MIN_TX_DESC_CNT)) |
978 |
+ return -EINVAL; |
979 |
+ |
980 |
+ if (netif_running(dev)) |
981 |
+diff --git a/drivers/net/ethernet/cadence/macb_pci.c b/drivers/net/ethernet/cadence/macb_pci.c |
982 |
+index 353393dea6394..3593b310c325d 100644 |
983 |
+--- a/drivers/net/ethernet/cadence/macb_pci.c |
984 |
++++ b/drivers/net/ethernet/cadence/macb_pci.c |
985 |
+@@ -111,9 +111,9 @@ static void macb_remove(struct pci_dev *pdev) |
986 |
+ struct platform_device *plat_dev = pci_get_drvdata(pdev); |
987 |
+ struct macb_platform_data *plat_data = dev_get_platdata(&plat_dev->dev); |
988 |
+ |
989 |
+- platform_device_unregister(plat_dev); |
990 |
+ clk_unregister(plat_data->pclk); |
991 |
+ clk_unregister(plat_data->hclk); |
992 |
++ platform_device_unregister(plat_dev); |
993 |
+ } |
994 |
+ |
995 |
+ static const struct pci_device_id dev_id_table[] = { |
996 |
+diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c b/drivers/net/ethernet/freescale/enetc/enetc.c |
997 |
+index df4a858c80015..15aa3b3c0089f 100644 |
998 |
+--- a/drivers/net/ethernet/freescale/enetc/enetc.c |
999 |
++++ b/drivers/net/ethernet/freescale/enetc/enetc.c |
1000 |
+@@ -299,7 +299,7 @@ static void enetc_rx_dim_work(struct work_struct *w) |
1001 |
+ |
1002 |
+ static void enetc_rx_net_dim(struct enetc_int_vector *v) |
1003 |
+ { |
1004 |
+- struct dim_sample dim_sample; |
1005 |
++ struct dim_sample dim_sample = {}; |
1006 |
+ |
1007 |
+ v->comp_cnt++; |
1008 |
+ |
1009 |
+@@ -1320,7 +1320,6 @@ static void enetc_clear_bdrs(struct enetc_ndev_priv *priv) |
1010 |
+ static int enetc_setup_irqs(struct enetc_ndev_priv *priv) |
1011 |
+ { |
1012 |
+ struct pci_dev *pdev = priv->si->pdev; |
1013 |
+- cpumask_t cpu_mask; |
1014 |
+ int i, j, err; |
1015 |
+ |
1016 |
+ for (i = 0; i < priv->bdr_int_num; i++) { |
1017 |
+@@ -1349,9 +1348,7 @@ static int enetc_setup_irqs(struct enetc_ndev_priv *priv) |
1018 |
+ |
1019 |
+ enetc_wr(hw, ENETC_SIMSITRV(idx), entry); |
1020 |
+ } |
1021 |
+- cpumask_clear(&cpu_mask); |
1022 |
+- cpumask_set_cpu(i % num_online_cpus(), &cpu_mask); |
1023 |
+- irq_set_affinity_hint(irq, &cpu_mask); |
1024 |
++ irq_set_affinity_hint(irq, get_cpu_mask(i % num_online_cpus())); |
1025 |
+ } |
1026 |
+ |
1027 |
+ return 0; |
1028 |
+diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c |
1029 |
+index 59ec538eba1f0..24357e9071553 100644 |
1030 |
+--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c |
1031 |
++++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c |
1032 |
+@@ -4377,6 +4377,24 @@ static int hclge_get_rss(struct hnae3_handle *handle, u32 *indir, |
1033 |
+ return 0; |
1034 |
+ } |
1035 |
+ |
1036 |
++static int hclge_parse_rss_hfunc(struct hclge_vport *vport, const u8 hfunc, |
1037 |
++ u8 *hash_algo) |
1038 |
++{ |
1039 |
++ switch (hfunc) { |
1040 |
++ case ETH_RSS_HASH_TOP: |
1041 |
++ *hash_algo = HCLGE_RSS_HASH_ALGO_TOEPLITZ; |
1042 |
++ return 0; |
1043 |
++ case ETH_RSS_HASH_XOR: |
1044 |
++ *hash_algo = HCLGE_RSS_HASH_ALGO_SIMPLE; |
1045 |
++ return 0; |
1046 |
++ case ETH_RSS_HASH_NO_CHANGE: |
1047 |
++ *hash_algo = vport->rss_algo; |
1048 |
++ return 0; |
1049 |
++ default: |
1050 |
++ return -EINVAL; |
1051 |
++ } |
1052 |
++} |
1053 |
++ |
1054 |
+ static int hclge_set_rss(struct hnae3_handle *handle, const u32 *indir, |
1055 |
+ const u8 *key, const u8 hfunc) |
1056 |
+ { |
1057 |
+@@ -4385,30 +4403,27 @@ static int hclge_set_rss(struct hnae3_handle *handle, const u32 *indir, |
1058 |
+ u8 hash_algo; |
1059 |
+ int ret, i; |
1060 |
+ |
1061 |
++ ret = hclge_parse_rss_hfunc(vport, hfunc, &hash_algo); |
1062 |
++ if (ret) { |
1063 |
++ dev_err(&hdev->pdev->dev, "invalid hfunc type %u\n", hfunc); |
1064 |
++ return ret; |
1065 |
++ } |
1066 |
++ |
1067 |
+ /* Set the RSS Hash Key if specififed by the user */ |
1068 |
+ if (key) { |
1069 |
+- switch (hfunc) { |
1070 |
+- case ETH_RSS_HASH_TOP: |
1071 |
+- hash_algo = HCLGE_RSS_HASH_ALGO_TOEPLITZ; |
1072 |
+- break; |
1073 |
+- case ETH_RSS_HASH_XOR: |
1074 |
+- hash_algo = HCLGE_RSS_HASH_ALGO_SIMPLE; |
1075 |
+- break; |
1076 |
+- case ETH_RSS_HASH_NO_CHANGE: |
1077 |
+- hash_algo = vport->rss_algo; |
1078 |
+- break; |
1079 |
+- default: |
1080 |
+- return -EINVAL; |
1081 |
+- } |
1082 |
+- |
1083 |
+ ret = hclge_set_rss_algo_key(hdev, hash_algo, key); |
1084 |
+ if (ret) |
1085 |
+ return ret; |
1086 |
+ |
1087 |
+ /* Update the shadow RSS key with user specified qids */ |
1088 |
+ memcpy(vport->rss_hash_key, key, HCLGE_RSS_KEY_SIZE); |
1089 |
+- vport->rss_algo = hash_algo; |
1090 |
++ } else { |
1091 |
++ ret = hclge_set_rss_algo_key(hdev, hash_algo, |
1092 |
++ vport->rss_hash_key); |
1093 |
++ if (ret) |
1094 |
++ return ret; |
1095 |
+ } |
1096 |
++ vport->rss_algo = hash_algo; |
1097 |
+ |
1098 |
+ /* Update the shadow RSS table with user specified qids */ |
1099 |
+ for (i = 0; i < HCLGE_RSS_IND_TBL_SIZE; i++) |
1100 |
+diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c |
1101 |
+index ff9d84a7147f1..5d39967672561 100644 |
1102 |
+--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c |
1103 |
++++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c |
1104 |
+@@ -581,9 +581,17 @@ static void hclge_get_queue_id_in_pf(struct hclge_vport *vport, |
1105 |
+ struct hclge_mbx_vf_to_pf_cmd *mbx_req, |
1106 |
+ struct hclge_respond_to_vf_msg *resp_msg) |
1107 |
+ { |
1108 |
++ struct hnae3_handle *handle = &vport->nic; |
1109 |
++ struct hclge_dev *hdev = vport->back; |
1110 |
+ u16 queue_id, qid_in_pf; |
1111 |
+ |
1112 |
+ memcpy(&queue_id, mbx_req->msg.data, sizeof(queue_id)); |
1113 |
++ if (queue_id >= handle->kinfo.num_tqps) { |
1114 |
++ dev_err(&hdev->pdev->dev, "Invalid queue id(%u) from VF %u\n", |
1115 |
++ queue_id, mbx_req->mbx_src_vfid); |
1116 |
++ return; |
1117 |
++ } |
1118 |
++ |
1119 |
+ qid_in_pf = hclge_covert_handle_qid_global(&vport->nic, queue_id); |
1120 |
+ memcpy(resp_msg->data, &qid_in_pf, sizeof(qid_in_pf)); |
1121 |
+ resp_msg->len = sizeof(qid_in_pf); |
1122 |
+diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c |
1123 |
+index 447457cacf973..3641d7c31451c 100644 |
1124 |
+--- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c |
1125 |
++++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c |
1126 |
+@@ -785,40 +785,56 @@ static int hclgevf_get_rss(struct hnae3_handle *handle, u32 *indir, u8 *key, |
1127 |
+ return 0; |
1128 |
+ } |
1129 |
+ |
1130 |
++static int hclgevf_parse_rss_hfunc(struct hclgevf_dev *hdev, const u8 hfunc, |
1131 |
++ u8 *hash_algo) |
1132 |
++{ |
1133 |
++ switch (hfunc) { |
1134 |
++ case ETH_RSS_HASH_TOP: |
1135 |
++ *hash_algo = HCLGEVF_RSS_HASH_ALGO_TOEPLITZ; |
1136 |
++ return 0; |
1137 |
++ case ETH_RSS_HASH_XOR: |
1138 |
++ *hash_algo = HCLGEVF_RSS_HASH_ALGO_SIMPLE; |
1139 |
++ return 0; |
1140 |
++ case ETH_RSS_HASH_NO_CHANGE: |
1141 |
++ *hash_algo = hdev->rss_cfg.hash_algo; |
1142 |
++ return 0; |
1143 |
++ default: |
1144 |
++ return -EINVAL; |
1145 |
++ } |
1146 |
++} |
1147 |
++ |
1148 |
+ static int hclgevf_set_rss(struct hnae3_handle *handle, const u32 *indir, |
1149 |
+ const u8 *key, const u8 hfunc) |
1150 |
+ { |
1151 |
+ struct hclgevf_dev *hdev = hclgevf_ae_get_hdev(handle); |
1152 |
+ struct hclgevf_rss_cfg *rss_cfg = &hdev->rss_cfg; |
1153 |
++ u8 hash_algo; |
1154 |
+ int ret, i; |
1155 |
+ |
1156 |
+ if (hdev->ae_dev->dev_version >= HNAE3_DEVICE_VERSION_V2) { |
1157 |
++ ret = hclgevf_parse_rss_hfunc(hdev, hfunc, &hash_algo); |
1158 |
++ if (ret) |
1159 |
++ return ret; |
1160 |
++ |
1161 |
+ /* Set the RSS Hash Key if specififed by the user */ |
1162 |
+ if (key) { |
1163 |
+- switch (hfunc) { |
1164 |
+- case ETH_RSS_HASH_TOP: |
1165 |
+- rss_cfg->hash_algo = |
1166 |
+- HCLGEVF_RSS_HASH_ALGO_TOEPLITZ; |
1167 |
+- break; |
1168 |
+- case ETH_RSS_HASH_XOR: |
1169 |
+- rss_cfg->hash_algo = |
1170 |
+- HCLGEVF_RSS_HASH_ALGO_SIMPLE; |
1171 |
+- break; |
1172 |
+- case ETH_RSS_HASH_NO_CHANGE: |
1173 |
+- break; |
1174 |
+- default: |
1175 |
+- return -EINVAL; |
1176 |
+- } |
1177 |
+- |
1178 |
+- ret = hclgevf_set_rss_algo_key(hdev, rss_cfg->hash_algo, |
1179 |
+- key); |
1180 |
+- if (ret) |
1181 |
++ ret = hclgevf_set_rss_algo_key(hdev, hash_algo, key); |
1182 |
++ if (ret) { |
1183 |
++ dev_err(&hdev->pdev->dev, |
1184 |
++ "invalid hfunc type %u\n", hfunc); |
1185 |
+ return ret; |
1186 |
++ } |
1187 |
+ |
1188 |
+ /* Update the shadow RSS key with user specified qids */ |
1189 |
+ memcpy(rss_cfg->rss_hash_key, key, |
1190 |
+ HCLGEVF_RSS_KEY_SIZE); |
1191 |
++ } else { |
1192 |
++ ret = hclgevf_set_rss_algo_key(hdev, hash_algo, |
1193 |
++ rss_cfg->rss_hash_key); |
1194 |
++ if (ret) |
1195 |
++ return ret; |
1196 |
+ } |
1197 |
++ rss_cfg->hash_algo = hash_algo; |
1198 |
+ } |
1199 |
+ |
1200 |
+ /* update the shadow RSS table with user specified qids */ |
1201 |
+diff --git a/drivers/net/ethernet/i825xx/82596.c b/drivers/net/ethernet/i825xx/82596.c |
1202 |
+index fc8c7cd674712..8b12a5ab3818c 100644 |
1203 |
+--- a/drivers/net/ethernet/i825xx/82596.c |
1204 |
++++ b/drivers/net/ethernet/i825xx/82596.c |
1205 |
+@@ -1155,7 +1155,7 @@ struct net_device * __init i82596_probe(int unit) |
1206 |
+ err = -ENODEV; |
1207 |
+ goto out; |
1208 |
+ } |
1209 |
+- memcpy(eth_addr, (void *) 0xfffc1f2c, ETH_ALEN); /* YUCK! Get addr from NOVRAM */ |
1210 |
++ memcpy(eth_addr, absolute_pointer(0xfffc1f2c), ETH_ALEN); /* YUCK! Get addr from NOVRAM */ |
1211 |
+ dev->base_addr = MVME_I596_BASE; |
1212 |
+ dev->irq = (unsigned) MVME16x_IRQ_I596; |
1213 |
+ goto found; |
1214 |
+diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c |
1215 |
+index d8a20e83d9040..8999e9ce4f08e 100644 |
1216 |
+--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c |
1217 |
++++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c |
1218 |
+@@ -372,6 +372,9 @@ mlx4_en_filter_rfs(struct net_device *net_dev, const struct sk_buff *skb, |
1219 |
+ int nhoff = skb_network_offset(skb); |
1220 |
+ int ret = 0; |
1221 |
+ |
1222 |
++ if (skb->encapsulation) |
1223 |
++ return -EPROTONOSUPPORT; |
1224 |
++ |
1225 |
+ if (skb->protocol != htons(ETH_P_IP)) |
1226 |
+ return -EPROTONOSUPPORT; |
1227 |
+ |
1228 |
+diff --git a/drivers/net/ethernet/qlogic/qed/qed_iwarp.c b/drivers/net/ethernet/qlogic/qed/qed_iwarp.c |
1229 |
+index a99861124630a..68fbe536a1f32 100644 |
1230 |
+--- a/drivers/net/ethernet/qlogic/qed/qed_iwarp.c |
1231 |
++++ b/drivers/net/ethernet/qlogic/qed/qed_iwarp.c |
1232 |
+@@ -1297,6 +1297,14 @@ qed_iwarp_wait_cid_map_cleared(struct qed_hwfn *p_hwfn, struct qed_bmap *bmap) |
1233 |
+ prev_weight = weight; |
1234 |
+ |
1235 |
+ while (weight) { |
1236 |
++ /* If the HW device is during recovery, all resources are |
1237 |
++ * immediately reset without receiving a per-cid indication |
1238 |
++ * from HW. In this case we don't expect the cid_map to be |
1239 |
++ * cleared. |
1240 |
++ */ |
1241 |
++ if (p_hwfn->cdev->recov_in_prog) |
1242 |
++ return 0; |
1243 |
++ |
1244 |
+ msleep(QED_IWARP_MAX_CID_CLEAN_TIME); |
1245 |
+ |
1246 |
+ weight = bitmap_weight(bmap->bitmap, bmap->max_count); |
1247 |
+diff --git a/drivers/net/ethernet/qlogic/qed/qed_roce.c b/drivers/net/ethernet/qlogic/qed/qed_roce.c |
1248 |
+index f16a157bb95a0..cf5baa5e59bcc 100644 |
1249 |
+--- a/drivers/net/ethernet/qlogic/qed/qed_roce.c |
1250 |
++++ b/drivers/net/ethernet/qlogic/qed/qed_roce.c |
1251 |
+@@ -77,6 +77,14 @@ void qed_roce_stop(struct qed_hwfn *p_hwfn) |
1252 |
+ * Beyond the added delay we clear the bitmap anyway. |
1253 |
+ */ |
1254 |
+ while (bitmap_weight(rcid_map->bitmap, rcid_map->max_count)) { |
1255 |
++ /* If the HW device is during recovery, all resources are |
1256 |
++ * immediately reset without receiving a per-cid indication |
1257 |
++ * from HW. In this case we don't expect the cid bitmap to be |
1258 |
++ * cleared. |
1259 |
++ */ |
1260 |
++ if (p_hwfn->cdev->recov_in_prog) |
1261 |
++ return; |
1262 |
++ |
1263 |
+ msleep(100); |
1264 |
+ if (wait_count++ > 20) { |
1265 |
+ DP_NOTICE(p_hwfn, "cid bitmap wait timed out\n"); |
1266 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |
1267 |
+index 3134f7e669f80..6133b2fe8a78a 100644 |
1268 |
+--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |
1269 |
++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |
1270 |
+@@ -226,7 +226,7 @@ static void stmmac_clk_csr_set(struct stmmac_priv *priv) |
1271 |
+ priv->clk_csr = STMMAC_CSR_100_150M; |
1272 |
+ else if ((clk_rate >= CSR_F_150M) && (clk_rate < CSR_F_250M)) |
1273 |
+ priv->clk_csr = STMMAC_CSR_150_250M; |
1274 |
+- else if ((clk_rate >= CSR_F_250M) && (clk_rate < CSR_F_300M)) |
1275 |
++ else if ((clk_rate >= CSR_F_250M) && (clk_rate <= CSR_F_300M)) |
1276 |
+ priv->clk_csr = STMMAC_CSR_250_300M; |
1277 |
+ } |
1278 |
+ |
1279 |
+diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c |
1280 |
+index da13683d52d1a..bd0beb16d68a9 100644 |
1281 |
+--- a/drivers/net/hamradio/6pack.c |
1282 |
++++ b/drivers/net/hamradio/6pack.c |
1283 |
+@@ -68,9 +68,9 @@ |
1284 |
+ #define SIXP_DAMA_OFF 0 |
1285 |
+ |
1286 |
+ /* default level 2 parameters */ |
1287 |
+-#define SIXP_TXDELAY (HZ/4) /* in 1 s */ |
1288 |
++#define SIXP_TXDELAY 25 /* 250 ms */ |
1289 |
+ #define SIXP_PERSIST 50 /* in 256ths */ |
1290 |
+-#define SIXP_SLOTTIME (HZ/10) /* in 1 s */ |
1291 |
++#define SIXP_SLOTTIME 10 /* 100 ms */ |
1292 |
+ #define SIXP_INIT_RESYNC_TIMEOUT (3*HZ/2) /* in 1 s */ |
1293 |
+ #define SIXP_RESYNC_TIMEOUT 5*HZ /* in 1 s */ |
1294 |
+ |
1295 |
+diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c |
1296 |
+index 6072e87ed6c3c..025c3246f3396 100644 |
1297 |
+--- a/drivers/net/phy/phylink.c |
1298 |
++++ b/drivers/net/phy/phylink.c |
1299 |
+@@ -1493,6 +1493,32 @@ int phylink_ethtool_ksettings_set(struct phylink *pl, |
1300 |
+ if (config.an_enabled && phylink_is_empty_linkmode(config.advertising)) |
1301 |
+ return -EINVAL; |
1302 |
+ |
1303 |
++ /* If this link is with an SFP, ensure that changes to advertised modes |
1304 |
++ * also cause the associated interface to be selected such that the |
1305 |
++ * link can be configured correctly. |
1306 |
++ */ |
1307 |
++ if (pl->sfp_port && pl->sfp_bus) { |
1308 |
++ config.interface = sfp_select_interface(pl->sfp_bus, |
1309 |
++ config.advertising); |
1310 |
++ if (config.interface == PHY_INTERFACE_MODE_NA) { |
1311 |
++ phylink_err(pl, |
1312 |
++ "selection of interface failed, advertisement %*pb\n", |
1313 |
++ __ETHTOOL_LINK_MODE_MASK_NBITS, |
1314 |
++ config.advertising); |
1315 |
++ return -EINVAL; |
1316 |
++ } |
1317 |
++ |
1318 |
++ /* Revalidate with the selected interface */ |
1319 |
++ linkmode_copy(support, pl->supported); |
1320 |
++ if (phylink_validate(pl, support, &config)) { |
1321 |
++ phylink_err(pl, "validation of %s/%s with support %*pb failed\n", |
1322 |
++ phylink_an_mode_str(pl->cur_link_an_mode), |
1323 |
++ phy_modes(config.interface), |
1324 |
++ __ETHTOOL_LINK_MODE_MASK_NBITS, support); |
1325 |
++ return -EINVAL; |
1326 |
++ } |
1327 |
++ } |
1328 |
++ |
1329 |
+ mutex_lock(&pl->state_mutex); |
1330 |
+ pl->link_config.speed = config.speed; |
1331 |
+ pl->link_config.duplex = config.duplex; |
1332 |
+@@ -2072,7 +2098,9 @@ static int phylink_sfp_config(struct phylink *pl, u8 mode, |
1333 |
+ if (phy_interface_mode_is_8023z(iface) && pl->phydev) |
1334 |
+ return -EINVAL; |
1335 |
+ |
1336 |
+- changed = !linkmode_equal(pl->supported, support); |
1337 |
++ changed = !linkmode_equal(pl->supported, support) || |
1338 |
++ !linkmode_equal(pl->link_config.advertising, |
1339 |
++ config.advertising); |
1340 |
+ if (changed) { |
1341 |
+ linkmode_copy(pl->supported, support); |
1342 |
+ linkmode_copy(pl->link_config.advertising, config.advertising); |
1343 |
+diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c |
1344 |
+index f269337c82c58..df8d4c1e5be74 100644 |
1345 |
+--- a/drivers/net/usb/hso.c |
1346 |
++++ b/drivers/net/usb/hso.c |
1347 |
+@@ -2721,14 +2721,14 @@ struct hso_device *hso_create_mux_serial_device(struct usb_interface *interface, |
1348 |
+ |
1349 |
+ serial = kzalloc(sizeof(*serial), GFP_KERNEL); |
1350 |
+ if (!serial) |
1351 |
+- goto exit; |
1352 |
++ goto err_free_dev; |
1353 |
+ |
1354 |
+ hso_dev->port_data.dev_serial = serial; |
1355 |
+ serial->parent = hso_dev; |
1356 |
+ |
1357 |
+ if (hso_serial_common_create |
1358 |
+ (serial, 1, CTRL_URB_RX_SIZE, CTRL_URB_TX_SIZE)) |
1359 |
+- goto exit; |
1360 |
++ goto err_free_serial; |
1361 |
+ |
1362 |
+ serial->tx_data_length--; |
1363 |
+ serial->write_data = hso_mux_serial_write_data; |
1364 |
+@@ -2744,11 +2744,9 @@ struct hso_device *hso_create_mux_serial_device(struct usb_interface *interface, |
1365 |
+ /* done, return it */ |
1366 |
+ return hso_dev; |
1367 |
+ |
1368 |
+-exit: |
1369 |
+- if (serial) { |
1370 |
+- tty_unregister_device(tty_drv, serial->minor); |
1371 |
+- kfree(serial); |
1372 |
+- } |
1373 |
++err_free_serial: |
1374 |
++ kfree(serial); |
1375 |
++err_free_dev: |
1376 |
+ kfree(hso_dev); |
1377 |
+ return NULL; |
1378 |
+ |
1379 |
+diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c |
1380 |
+index 5a9b2f1b1418a..bbc3efef50278 100644 |
1381 |
+--- a/drivers/nvme/host/core.c |
1382 |
++++ b/drivers/nvme/host/core.c |
1383 |
+@@ -13,7 +13,6 @@ |
1384 |
+ #include <linux/kernel.h> |
1385 |
+ #include <linux/module.h> |
1386 |
+ #include <linux/backing-dev.h> |
1387 |
+-#include <linux/list_sort.h> |
1388 |
+ #include <linux/slab.h> |
1389 |
+ #include <linux/types.h> |
1390 |
+ #include <linux/pr.h> |
1391 |
+@@ -3801,14 +3800,6 @@ out_unlock: |
1392 |
+ return ret; |
1393 |
+ } |
1394 |
+ |
1395 |
+-static int ns_cmp(void *priv, struct list_head *a, struct list_head *b) |
1396 |
+-{ |
1397 |
+- struct nvme_ns *nsa = container_of(a, struct nvme_ns, list); |
1398 |
+- struct nvme_ns *nsb = container_of(b, struct nvme_ns, list); |
1399 |
+- |
1400 |
+- return nsa->head->ns_id - nsb->head->ns_id; |
1401 |
+-} |
1402 |
+- |
1403 |
+ struct nvme_ns *nvme_find_get_ns(struct nvme_ctrl *ctrl, unsigned nsid) |
1404 |
+ { |
1405 |
+ struct nvme_ns *ns, *ret = NULL; |
1406 |
+@@ -3829,6 +3820,22 @@ struct nvme_ns *nvme_find_get_ns(struct nvme_ctrl *ctrl, unsigned nsid) |
1407 |
+ } |
1408 |
+ EXPORT_SYMBOL_NS_GPL(nvme_find_get_ns, NVME_TARGET_PASSTHRU); |
1409 |
+ |
1410 |
++/* |
1411 |
++ * Add the namespace to the controller list while keeping the list ordered. |
1412 |
++ */ |
1413 |
++static void nvme_ns_add_to_ctrl_list(struct nvme_ns *ns) |
1414 |
++{ |
1415 |
++ struct nvme_ns *tmp; |
1416 |
++ |
1417 |
++ list_for_each_entry_reverse(tmp, &ns->ctrl->namespaces, list) { |
1418 |
++ if (tmp->head->ns_id < ns->head->ns_id) { |
1419 |
++ list_add(&ns->list, &tmp->list); |
1420 |
++ return; |
1421 |
++ } |
1422 |
++ } |
1423 |
++ list_add(&ns->list, &ns->ctrl->namespaces); |
1424 |
++} |
1425 |
++ |
1426 |
+ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid, |
1427 |
+ struct nvme_ns_ids *ids) |
1428 |
+ { |
1429 |
+@@ -3888,9 +3895,8 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid, |
1430 |
+ } |
1431 |
+ |
1432 |
+ down_write(&ctrl->namespaces_rwsem); |
1433 |
+- list_add_tail(&ns->list, &ctrl->namespaces); |
1434 |
++ nvme_ns_add_to_ctrl_list(ns); |
1435 |
+ up_write(&ctrl->namespaces_rwsem); |
1436 |
+- |
1437 |
+ nvme_get_ctrl(ctrl); |
1438 |
+ |
1439 |
+ device_add_disk(ctrl->device, ns->disk, nvme_ns_id_attr_groups); |
1440 |
+@@ -4159,10 +4165,6 @@ static void nvme_scan_work(struct work_struct *work) |
1441 |
+ if (nvme_scan_ns_list(ctrl) != 0) |
1442 |
+ nvme_scan_ns_sequential(ctrl); |
1443 |
+ mutex_unlock(&ctrl->scan_lock); |
1444 |
+- |
1445 |
+- down_write(&ctrl->namespaces_rwsem); |
1446 |
+- list_sort(NULL, &ctrl->namespaces, ns_cmp); |
1447 |
+- up_write(&ctrl->namespaces_rwsem); |
1448 |
+ } |
1449 |
+ |
1450 |
+ /* |
1451 |
+diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c |
1452 |
+index 2747efc03825c..46a1e24ba6f47 100644 |
1453 |
+--- a/drivers/nvme/host/multipath.c |
1454 |
++++ b/drivers/nvme/host/multipath.c |
1455 |
+@@ -509,14 +509,17 @@ static int nvme_update_ana_state(struct nvme_ctrl *ctrl, |
1456 |
+ |
1457 |
+ down_read(&ctrl->namespaces_rwsem); |
1458 |
+ list_for_each_entry(ns, &ctrl->namespaces, list) { |
1459 |
+- unsigned nsid = le32_to_cpu(desc->nsids[n]); |
1460 |
+- |
1461 |
++ unsigned nsid; |
1462 |
++again: |
1463 |
++ nsid = le32_to_cpu(desc->nsids[n]); |
1464 |
+ if (ns->head->ns_id < nsid) |
1465 |
+ continue; |
1466 |
+ if (ns->head->ns_id == nsid) |
1467 |
+ nvme_update_ns_ana_state(desc, ns); |
1468 |
+ if (++n == nr_nsids) |
1469 |
+ break; |
1470 |
++ if (ns->head->ns_id > nsid) |
1471 |
++ goto again; |
1472 |
+ } |
1473 |
+ up_read(&ctrl->namespaces_rwsem); |
1474 |
+ return 0; |
1475 |
+diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c |
1476 |
+index 9c356be7f016e..51f4647ea2142 100644 |
1477 |
+--- a/drivers/nvme/host/rdma.c |
1478 |
++++ b/drivers/nvme/host/rdma.c |
1479 |
+@@ -655,8 +655,8 @@ static void nvme_rdma_free_queue(struct nvme_rdma_queue *queue) |
1480 |
+ if (!test_and_clear_bit(NVME_RDMA_Q_ALLOCATED, &queue->flags)) |
1481 |
+ return; |
1482 |
+ |
1483 |
+- nvme_rdma_destroy_queue_ib(queue); |
1484 |
+ rdma_destroy_id(queue->cm_id); |
1485 |
++ nvme_rdma_destroy_queue_ib(queue); |
1486 |
+ mutex_destroy(&queue->queue_lock); |
1487 |
+ } |
1488 |
+ |
1489 |
+@@ -1823,14 +1823,10 @@ static int nvme_rdma_conn_established(struct nvme_rdma_queue *queue) |
1490 |
+ for (i = 0; i < queue->queue_size; i++) { |
1491 |
+ ret = nvme_rdma_post_recv(queue, &queue->rsp_ring[i]); |
1492 |
+ if (ret) |
1493 |
+- goto out_destroy_queue_ib; |
1494 |
++ return ret; |
1495 |
+ } |
1496 |
+ |
1497 |
+ return 0; |
1498 |
+- |
1499 |
+-out_destroy_queue_ib: |
1500 |
+- nvme_rdma_destroy_queue_ib(queue); |
1501 |
+- return ret; |
1502 |
+ } |
1503 |
+ |
1504 |
+ static int nvme_rdma_conn_rejected(struct nvme_rdma_queue *queue, |
1505 |
+@@ -1924,14 +1920,10 @@ static int nvme_rdma_route_resolved(struct nvme_rdma_queue *queue) |
1506 |
+ if (ret) { |
1507 |
+ dev_err(ctrl->ctrl.device, |
1508 |
+ "rdma_connect_locked failed (%d).\n", ret); |
1509 |
+- goto out_destroy_queue_ib; |
1510 |
++ return ret; |
1511 |
+ } |
1512 |
+ |
1513 |
+ return 0; |
1514 |
+- |
1515 |
+-out_destroy_queue_ib: |
1516 |
+- nvme_rdma_destroy_queue_ib(queue); |
1517 |
+- return ret; |
1518 |
+ } |
1519 |
+ |
1520 |
+ static int nvme_rdma_cm_handler(struct rdma_cm_id *cm_id, |
1521 |
+@@ -1962,8 +1954,6 @@ static int nvme_rdma_cm_handler(struct rdma_cm_id *cm_id, |
1522 |
+ case RDMA_CM_EVENT_ROUTE_ERROR: |
1523 |
+ case RDMA_CM_EVENT_CONNECT_ERROR: |
1524 |
+ case RDMA_CM_EVENT_UNREACHABLE: |
1525 |
+- nvme_rdma_destroy_queue_ib(queue); |
1526 |
+- fallthrough; |
1527 |
+ case RDMA_CM_EVENT_ADDR_ERROR: |
1528 |
+ dev_dbg(queue->ctrl->ctrl.device, |
1529 |
+ "CM error event %d\n", ev->event); |
1530 |
+diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c |
1531 |
+index a6b3b07627630..05ad6bee085c1 100644 |
1532 |
+--- a/drivers/nvme/host/tcp.c |
1533 |
++++ b/drivers/nvme/host/tcp.c |
1534 |
+@@ -611,7 +611,7 @@ static int nvme_tcp_setup_h2c_data_pdu(struct nvme_tcp_request *req, |
1535 |
+ cpu_to_le32(data->hdr.hlen + hdgst + req->pdu_len + ddgst); |
1536 |
+ data->ttag = pdu->ttag; |
1537 |
+ data->command_id = nvme_cid(rq); |
1538 |
+- data->data_offset = cpu_to_le32(req->data_sent); |
1539 |
++ data->data_offset = pdu->r2t_offset; |
1540 |
+ data->data_length = cpu_to_le32(req->pdu_len); |
1541 |
+ return 0; |
1542 |
+ } |
1543 |
+@@ -937,7 +937,15 @@ static int nvme_tcp_try_send_data(struct nvme_tcp_request *req) |
1544 |
+ nvme_tcp_ddgst_update(queue->snd_hash, page, |
1545 |
+ offset, ret); |
1546 |
+ |
1547 |
+- /* fully successful last write*/ |
1548 |
++ /* |
1549 |
++ * update the request iterator except for the last payload send |
1550 |
++ * in the request where we don't want to modify it as we may |
1551 |
++ * compete with the RX path completing the request. |
1552 |
++ */ |
1553 |
++ if (req->data_sent + ret < req->data_len) |
1554 |
++ nvme_tcp_advance_req(req, ret); |
1555 |
++ |
1556 |
++ /* fully successful last send in current PDU */ |
1557 |
+ if (last && ret == len) { |
1558 |
+ if (queue->data_digest) { |
1559 |
+ nvme_tcp_ddgst_final(queue->snd_hash, |
1560 |
+@@ -949,7 +957,6 @@ static int nvme_tcp_try_send_data(struct nvme_tcp_request *req) |
1561 |
+ } |
1562 |
+ return 1; |
1563 |
+ } |
1564 |
+- nvme_tcp_advance_req(req, ret); |
1565 |
+ } |
1566 |
+ return -EAGAIN; |
1567 |
+ } |
1568 |
+diff --git a/drivers/pci/controller/cadence/pcie-cadence-host.c b/drivers/pci/controller/cadence/pcie-cadence-host.c |
1569 |
+index a40ed9e12b4bb..fb96d37a135c1 100644 |
1570 |
+--- a/drivers/pci/controller/cadence/pcie-cadence-host.c |
1571 |
++++ b/drivers/pci/controller/cadence/pcie-cadence-host.c |
1572 |
+@@ -345,7 +345,8 @@ static int cdns_pcie_host_bar_config(struct cdns_pcie_rc *rc, |
1573 |
+ return 0; |
1574 |
+ } |
1575 |
+ |
1576 |
+-static int cdns_pcie_host_dma_ranges_cmp(void *priv, struct list_head *a, struct list_head *b) |
1577 |
++static int cdns_pcie_host_dma_ranges_cmp(void *priv, const struct list_head *a, |
1578 |
++ const struct list_head *b) |
1579 |
+ { |
1580 |
+ struct resource_entry *entry1, *entry2; |
1581 |
+ |
1582 |
+diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c |
1583 |
+index f175cff39b460..4f1a29ede576a 100644 |
1584 |
+--- a/drivers/pci/controller/pci-aardvark.c |
1585 |
++++ b/drivers/pci/controller/pci-aardvark.c |
1586 |
+@@ -214,7 +214,7 @@ |
1587 |
+ (PCIE_CONF_BUS(bus) | PCIE_CONF_DEV(PCI_SLOT(devfn)) | \ |
1588 |
+ PCIE_CONF_FUNC(PCI_FUNC(devfn)) | PCIE_CONF_REG(where)) |
1589 |
+ |
1590 |
+-#define PIO_RETRY_CNT 500 |
1591 |
++#define PIO_RETRY_CNT 750000 /* 1.5 s */ |
1592 |
+ #define PIO_RETRY_DELAY 2 /* 2 us*/ |
1593 |
+ |
1594 |
+ #define LINK_WAIT_MAX_RETRIES 10 |
1595 |
+diff --git a/drivers/platform/x86/intel_punit_ipc.c b/drivers/platform/x86/intel_punit_ipc.c |
1596 |
+index f58b8543f6ac5..66bb39fd0ef90 100644 |
1597 |
+--- a/drivers/platform/x86/intel_punit_ipc.c |
1598 |
++++ b/drivers/platform/x86/intel_punit_ipc.c |
1599 |
+@@ -8,7 +8,6 @@ |
1600 |
+ * which provide mailbox interface for power management usage. |
1601 |
+ */ |
1602 |
+ |
1603 |
+-#include <linux/acpi.h> |
1604 |
+ #include <linux/bitops.h> |
1605 |
+ #include <linux/delay.h> |
1606 |
+ #include <linux/device.h> |
1607 |
+@@ -319,7 +318,7 @@ static struct platform_driver intel_punit_ipc_driver = { |
1608 |
+ .remove = intel_punit_ipc_remove, |
1609 |
+ .driver = { |
1610 |
+ .name = "intel_punit_ipc", |
1611 |
+- .acpi_match_table = ACPI_PTR(punit_ipc_acpi_ids), |
1612 |
++ .acpi_match_table = punit_ipc_acpi_ids, |
1613 |
+ }, |
1614 |
+ }; |
1615 |
+ |
1616 |
+diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c |
1617 |
+index 4d51c4ace8ea3..7b0155b0e99ee 100644 |
1618 |
+--- a/drivers/s390/net/qeth_core_main.c |
1619 |
++++ b/drivers/s390/net/qeth_core_main.c |
1620 |
+@@ -210,6 +210,9 @@ static void qeth_clear_working_pool_list(struct qeth_card *card) |
1621 |
+ &card->qdio.in_buf_pool.entry_list, list) |
1622 |
+ list_del(&pool_entry->list); |
1623 |
+ |
1624 |
++ if (!queue) |
1625 |
++ return; |
1626 |
++ |
1627 |
+ for (i = 0; i < ARRAY_SIZE(queue->bufs); i++) |
1628 |
+ queue->bufs[i].pool_entry = NULL; |
1629 |
+ } |
1630 |
+diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c |
1631 |
+index bdea2867516c0..2c59a5bf35390 100644 |
1632 |
+--- a/drivers/scsi/lpfc/lpfc_attr.c |
1633 |
++++ b/drivers/scsi/lpfc/lpfc_attr.c |
1634 |
+@@ -6005,7 +6005,8 @@ lpfc_sg_seg_cnt_show(struct device *dev, struct device_attribute *attr, |
1635 |
+ len = scnprintf(buf, PAGE_SIZE, "SGL sz: %d total SGEs: %d\n", |
1636 |
+ phba->cfg_sg_dma_buf_size, phba->cfg_total_seg_cnt); |
1637 |
+ |
1638 |
+- len += scnprintf(buf + len, PAGE_SIZE, "Cfg: %d SCSI: %d NVME: %d\n", |
1639 |
++ len += scnprintf(buf + len, PAGE_SIZE - len, |
1640 |
++ "Cfg: %d SCSI: %d NVME: %d\n", |
1641 |
+ phba->cfg_sg_seg_cnt, phba->cfg_scsi_seg_cnt, |
1642 |
+ phba->cfg_nvme_seg_cnt); |
1643 |
+ return len; |
1644 |
+diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c |
1645 |
+index 6faf34fa62206..b7aac3116f2db 100644 |
1646 |
+--- a/drivers/scsi/qla2xxx/qla_init.c |
1647 |
++++ b/drivers/scsi/qla2xxx/qla_init.c |
1648 |
+@@ -6934,7 +6934,8 @@ qla2x00_abort_isp(scsi_qla_host_t *vha) |
1649 |
+ return 0; |
1650 |
+ break; |
1651 |
+ case QLA2XXX_INI_MODE_DUAL: |
1652 |
+- if (!qla_dual_mode_enabled(vha)) |
1653 |
++ if (!qla_dual_mode_enabled(vha) && |
1654 |
++ !qla_ini_mode_enabled(vha)) |
1655 |
+ return 0; |
1656 |
+ break; |
1657 |
+ case QLA2XXX_INI_MODE_ENABLED: |
1658 |
+diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c |
1659 |
+index ac07a9ef35780..41772b88610ae 100644 |
1660 |
+--- a/drivers/scsi/scsi_transport_iscsi.c |
1661 |
++++ b/drivers/scsi/scsi_transport_iscsi.c |
1662 |
+@@ -442,9 +442,7 @@ static umode_t iscsi_iface_attr_is_visible(struct kobject *kobj, |
1663 |
+ struct iscsi_transport *t = iface->transport; |
1664 |
+ int param = -1; |
1665 |
+ |
1666 |
+- if (attr == &dev_attr_iface_enabled.attr) |
1667 |
+- param = ISCSI_NET_PARAM_IFACE_ENABLE; |
1668 |
+- else if (attr == &dev_attr_iface_def_taskmgmt_tmo.attr) |
1669 |
++ if (attr == &dev_attr_iface_def_taskmgmt_tmo.attr) |
1670 |
+ param = ISCSI_IFACE_PARAM_DEF_TASKMGMT_TMO; |
1671 |
+ else if (attr == &dev_attr_iface_header_digest.attr) |
1672 |
+ param = ISCSI_IFACE_PARAM_HDRDGST_EN; |
1673 |
+@@ -484,7 +482,9 @@ static umode_t iscsi_iface_attr_is_visible(struct kobject *kobj, |
1674 |
+ if (param != -1) |
1675 |
+ return t->attr_is_visible(ISCSI_IFACE_PARAM, param); |
1676 |
+ |
1677 |
+- if (attr == &dev_attr_iface_vlan_id.attr) |
1678 |
++ if (attr == &dev_attr_iface_enabled.attr) |
1679 |
++ param = ISCSI_NET_PARAM_IFACE_ENABLE; |
1680 |
++ else if (attr == &dev_attr_iface_vlan_id.attr) |
1681 |
+ param = ISCSI_NET_PARAM_VLAN_ID; |
1682 |
+ else if (attr == &dev_attr_iface_vlan_priority.attr) |
1683 |
+ param = ISCSI_NET_PARAM_VLAN_PRIORITY; |
1684 |
+diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c |
1685 |
+index 87a7274e4632b..01088f333dbc4 100644 |
1686 |
+--- a/drivers/scsi/sd_zbc.c |
1687 |
++++ b/drivers/scsi/sd_zbc.c |
1688 |
+@@ -155,8 +155,8 @@ static void *sd_zbc_alloc_report_buffer(struct scsi_disk *sdkp, |
1689 |
+ |
1690 |
+ /* |
1691 |
+ * Report zone buffer size should be at most 64B times the number of |
1692 |
+- * zones requested plus the 64B reply header, but should be at least |
1693 |
+- * SECTOR_SIZE for ATA devices. |
1694 |
++ * zones requested plus the 64B reply header, but should be aligned |
1695 |
++ * to SECTOR_SIZE for ATA devices. |
1696 |
+ * Make sure that this size does not exceed the hardware capabilities. |
1697 |
+ * Furthermore, since the report zone command cannot be split, make |
1698 |
+ * sure that the allocated buffer can always be mapped by limiting the |
1699 |
+@@ -175,7 +175,7 @@ static void *sd_zbc_alloc_report_buffer(struct scsi_disk *sdkp, |
1700 |
+ *buflen = bufsize; |
1701 |
+ return buf; |
1702 |
+ } |
1703 |
+- bufsize >>= 1; |
1704 |
++ bufsize = rounddown(bufsize >> 1, SECTOR_SIZE); |
1705 |
+ } |
1706 |
+ |
1707 |
+ return NULL; |
1708 |
+diff --git a/drivers/spi/spi-loopback-test.c b/drivers/spi/spi-loopback-test.c |
1709 |
+index 89b91cdfb2a54..4d4f77a186a98 100644 |
1710 |
+--- a/drivers/spi/spi-loopback-test.c |
1711 |
++++ b/drivers/spi/spi-loopback-test.c |
1712 |
+@@ -454,7 +454,8 @@ struct rx_ranges { |
1713 |
+ u8 *end; |
1714 |
+ }; |
1715 |
+ |
1716 |
+-static int rx_ranges_cmp(void *priv, struct list_head *a, struct list_head *b) |
1717 |
++static int rx_ranges_cmp(void *priv, const struct list_head *a, |
1718 |
++ const struct list_head *b) |
1719 |
+ { |
1720 |
+ struct rx_ranges *rx_a = list_entry(a, struct rx_ranges, list); |
1721 |
+ struct rx_ranges *rx_b = list_entry(b, struct rx_ranges, list); |
1722 |
+diff --git a/drivers/spi/spi-tegra20-slink.c b/drivers/spi/spi-tegra20-slink.c |
1723 |
+index f7c832fd40036..669fc4286231f 100644 |
1724 |
+--- a/drivers/spi/spi-tegra20-slink.c |
1725 |
++++ b/drivers/spi/spi-tegra20-slink.c |
1726 |
+@@ -1201,7 +1201,7 @@ static int tegra_slink_resume(struct device *dev) |
1727 |
+ } |
1728 |
+ #endif |
1729 |
+ |
1730 |
+-static int tegra_slink_runtime_suspend(struct device *dev) |
1731 |
++static int __maybe_unused tegra_slink_runtime_suspend(struct device *dev) |
1732 |
+ { |
1733 |
+ struct spi_master *master = dev_get_drvdata(dev); |
1734 |
+ struct tegra_slink_data *tspi = spi_master_get_devdata(master); |
1735 |
+@@ -1213,7 +1213,7 @@ static int tegra_slink_runtime_suspend(struct device *dev) |
1736 |
+ return 0; |
1737 |
+ } |
1738 |
+ |
1739 |
+-static int tegra_slink_runtime_resume(struct device *dev) |
1740 |
++static int __maybe_unused tegra_slink_runtime_resume(struct device *dev) |
1741 |
+ { |
1742 |
+ struct spi_master *master = dev_get_drvdata(dev); |
1743 |
+ struct tegra_slink_data *tspi = spi_master_get_devdata(master); |
1744 |
+diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c |
1745 |
+index 80d74cce2a010..9858fae816f72 100644 |
1746 |
+--- a/drivers/staging/comedi/comedi_fops.c |
1747 |
++++ b/drivers/staging/comedi/comedi_fops.c |
1748 |
+@@ -3090,6 +3090,7 @@ static int compat_insnlist(struct file *file, unsigned long arg) |
1749 |
+ mutex_lock(&dev->mutex); |
1750 |
+ rc = do_insnlist_ioctl(dev, insns, insnlist32.n_insns, file); |
1751 |
+ mutex_unlock(&dev->mutex); |
1752 |
++ kfree(insns); |
1753 |
+ return rc; |
1754 |
+ } |
1755 |
+ |
1756 |
+diff --git a/drivers/staging/greybus/uart.c b/drivers/staging/greybus/uart.c |
1757 |
+index a520f7f213db0..edaa83a693d27 100644 |
1758 |
+--- a/drivers/staging/greybus/uart.c |
1759 |
++++ b/drivers/staging/greybus/uart.c |
1760 |
+@@ -778,6 +778,17 @@ out: |
1761 |
+ gbphy_runtime_put_autosuspend(gb_tty->gbphy_dev); |
1762 |
+ } |
1763 |
+ |
1764 |
++static void gb_tty_port_destruct(struct tty_port *port) |
1765 |
++{ |
1766 |
++ struct gb_tty *gb_tty = container_of(port, struct gb_tty, port); |
1767 |
++ |
1768 |
++ if (gb_tty->minor != GB_NUM_MINORS) |
1769 |
++ release_minor(gb_tty); |
1770 |
++ kfifo_free(&gb_tty->write_fifo); |
1771 |
++ kfree(gb_tty->buffer); |
1772 |
++ kfree(gb_tty); |
1773 |
++} |
1774 |
++ |
1775 |
+ static const struct tty_operations gb_ops = { |
1776 |
+ .install = gb_tty_install, |
1777 |
+ .open = gb_tty_open, |
1778 |
+@@ -803,6 +814,7 @@ static const struct tty_port_operations gb_port_ops = { |
1779 |
+ .dtr_rts = gb_tty_dtr_rts, |
1780 |
+ .activate = gb_tty_port_activate, |
1781 |
+ .shutdown = gb_tty_port_shutdown, |
1782 |
++ .destruct = gb_tty_port_destruct, |
1783 |
+ }; |
1784 |
+ |
1785 |
+ static int gb_uart_probe(struct gbphy_device *gbphy_dev, |
1786 |
+@@ -815,17 +827,11 @@ static int gb_uart_probe(struct gbphy_device *gbphy_dev, |
1787 |
+ int retval; |
1788 |
+ int minor; |
1789 |
+ |
1790 |
+- gb_tty = kzalloc(sizeof(*gb_tty), GFP_KERNEL); |
1791 |
+- if (!gb_tty) |
1792 |
+- return -ENOMEM; |
1793 |
+- |
1794 |
+ connection = gb_connection_create(gbphy_dev->bundle, |
1795 |
+ le16_to_cpu(gbphy_dev->cport_desc->id), |
1796 |
+ gb_uart_request_handler); |
1797 |
+- if (IS_ERR(connection)) { |
1798 |
+- retval = PTR_ERR(connection); |
1799 |
+- goto exit_tty_free; |
1800 |
+- } |
1801 |
++ if (IS_ERR(connection)) |
1802 |
++ return PTR_ERR(connection); |
1803 |
+ |
1804 |
+ max_payload = gb_operation_get_payload_size_max(connection); |
1805 |
+ if (max_payload < sizeof(struct gb_uart_send_data_request)) { |
1806 |
+@@ -833,13 +839,23 @@ static int gb_uart_probe(struct gbphy_device *gbphy_dev, |
1807 |
+ goto exit_connection_destroy; |
1808 |
+ } |
1809 |
+ |
1810 |
++ gb_tty = kzalloc(sizeof(*gb_tty), GFP_KERNEL); |
1811 |
++ if (!gb_tty) { |
1812 |
++ retval = -ENOMEM; |
1813 |
++ goto exit_connection_destroy; |
1814 |
++ } |
1815 |
++ |
1816 |
++ tty_port_init(&gb_tty->port); |
1817 |
++ gb_tty->port.ops = &gb_port_ops; |
1818 |
++ gb_tty->minor = GB_NUM_MINORS; |
1819 |
++ |
1820 |
+ gb_tty->buffer_payload_max = max_payload - |
1821 |
+ sizeof(struct gb_uart_send_data_request); |
1822 |
+ |
1823 |
+ gb_tty->buffer = kzalloc(gb_tty->buffer_payload_max, GFP_KERNEL); |
1824 |
+ if (!gb_tty->buffer) { |
1825 |
+ retval = -ENOMEM; |
1826 |
+- goto exit_connection_destroy; |
1827 |
++ goto exit_put_port; |
1828 |
+ } |
1829 |
+ |
1830 |
+ INIT_WORK(&gb_tty->tx_work, gb_uart_tx_write_work); |
1831 |
+@@ -847,7 +863,7 @@ static int gb_uart_probe(struct gbphy_device *gbphy_dev, |
1832 |
+ retval = kfifo_alloc(&gb_tty->write_fifo, GB_UART_WRITE_FIFO_SIZE, |
1833 |
+ GFP_KERNEL); |
1834 |
+ if (retval) |
1835 |
+- goto exit_buf_free; |
1836 |
++ goto exit_put_port; |
1837 |
+ |
1838 |
+ gb_tty->credits = GB_UART_FIRMWARE_CREDITS; |
1839 |
+ init_completion(&gb_tty->credits_complete); |
1840 |
+@@ -861,7 +877,7 @@ static int gb_uart_probe(struct gbphy_device *gbphy_dev, |
1841 |
+ } else { |
1842 |
+ retval = minor; |
1843 |
+ } |
1844 |
+- goto exit_kfifo_free; |
1845 |
++ goto exit_put_port; |
1846 |
+ } |
1847 |
+ |
1848 |
+ gb_tty->minor = minor; |
1849 |
+@@ -870,9 +886,6 @@ static int gb_uart_probe(struct gbphy_device *gbphy_dev, |
1850 |
+ init_waitqueue_head(&gb_tty->wioctl); |
1851 |
+ mutex_init(&gb_tty->mutex); |
1852 |
+ |
1853 |
+- tty_port_init(&gb_tty->port); |
1854 |
+- gb_tty->port.ops = &gb_port_ops; |
1855 |
+- |
1856 |
+ gb_tty->connection = connection; |
1857 |
+ gb_tty->gbphy_dev = gbphy_dev; |
1858 |
+ gb_connection_set_data(connection, gb_tty); |
1859 |
+@@ -880,7 +893,7 @@ static int gb_uart_probe(struct gbphy_device *gbphy_dev, |
1860 |
+ |
1861 |
+ retval = gb_connection_enable_tx(connection); |
1862 |
+ if (retval) |
1863 |
+- goto exit_release_minor; |
1864 |
++ goto exit_put_port; |
1865 |
+ |
1866 |
+ send_control(gb_tty, gb_tty->ctrlout); |
1867 |
+ |
1868 |
+@@ -907,16 +920,10 @@ static int gb_uart_probe(struct gbphy_device *gbphy_dev, |
1869 |
+ |
1870 |
+ exit_connection_disable: |
1871 |
+ gb_connection_disable(connection); |
1872 |
+-exit_release_minor: |
1873 |
+- release_minor(gb_tty); |
1874 |
+-exit_kfifo_free: |
1875 |
+- kfifo_free(&gb_tty->write_fifo); |
1876 |
+-exit_buf_free: |
1877 |
+- kfree(gb_tty->buffer); |
1878 |
++exit_put_port: |
1879 |
++ tty_port_put(&gb_tty->port); |
1880 |
+ exit_connection_destroy: |
1881 |
+ gb_connection_destroy(connection); |
1882 |
+-exit_tty_free: |
1883 |
+- kfree(gb_tty); |
1884 |
+ |
1885 |
+ return retval; |
1886 |
+ } |
1887 |
+@@ -947,15 +954,10 @@ static void gb_uart_remove(struct gbphy_device *gbphy_dev) |
1888 |
+ gb_connection_disable_rx(connection); |
1889 |
+ tty_unregister_device(gb_tty_driver, gb_tty->minor); |
1890 |
+ |
1891 |
+- /* FIXME - free transmit / receive buffers */ |
1892 |
+- |
1893 |
+ gb_connection_disable(connection); |
1894 |
+- tty_port_destroy(&gb_tty->port); |
1895 |
+ gb_connection_destroy(connection); |
1896 |
+- release_minor(gb_tty); |
1897 |
+- kfifo_free(&gb_tty->write_fifo); |
1898 |
+- kfree(gb_tty->buffer); |
1899 |
+- kfree(gb_tty); |
1900 |
++ |
1901 |
++ tty_port_put(&gb_tty->port); |
1902 |
+ } |
1903 |
+ |
1904 |
+ static int gb_tty_init(void) |
1905 |
+diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c |
1906 |
+index f043522851550..56ae882fb7b39 100644 |
1907 |
+--- a/drivers/target/target_core_configfs.c |
1908 |
++++ b/drivers/target/target_core_configfs.c |
1909 |
+@@ -1110,20 +1110,24 @@ static ssize_t alua_support_store(struct config_item *item, |
1910 |
+ { |
1911 |
+ struct se_dev_attrib *da = to_attrib(item); |
1912 |
+ struct se_device *dev = da->da_dev; |
1913 |
+- bool flag; |
1914 |
++ bool flag, oldflag; |
1915 |
+ int ret; |
1916 |
+ |
1917 |
++ ret = strtobool(page, &flag); |
1918 |
++ if (ret < 0) |
1919 |
++ return ret; |
1920 |
++ |
1921 |
++ oldflag = !(dev->transport_flags & TRANSPORT_FLAG_PASSTHROUGH_ALUA); |
1922 |
++ if (flag == oldflag) |
1923 |
++ return count; |
1924 |
++ |
1925 |
+ if (!(dev->transport->transport_flags_changeable & |
1926 |
+ TRANSPORT_FLAG_PASSTHROUGH_ALUA)) { |
1927 |
+ pr_err("dev[%p]: Unable to change SE Device alua_support:" |
1928 |
+ " alua_support has fixed value\n", dev); |
1929 |
+- return -EINVAL; |
1930 |
++ return -ENOSYS; |
1931 |
+ } |
1932 |
+ |
1933 |
+- ret = strtobool(page, &flag); |
1934 |
+- if (ret < 0) |
1935 |
+- return ret; |
1936 |
+- |
1937 |
+ if (flag) |
1938 |
+ dev->transport_flags &= ~TRANSPORT_FLAG_PASSTHROUGH_ALUA; |
1939 |
+ else |
1940 |
+@@ -1145,20 +1149,24 @@ static ssize_t pgr_support_store(struct config_item *item, |
1941 |
+ { |
1942 |
+ struct se_dev_attrib *da = to_attrib(item); |
1943 |
+ struct se_device *dev = da->da_dev; |
1944 |
+- bool flag; |
1945 |
++ bool flag, oldflag; |
1946 |
+ int ret; |
1947 |
+ |
1948 |
++ ret = strtobool(page, &flag); |
1949 |
++ if (ret < 0) |
1950 |
++ return ret; |
1951 |
++ |
1952 |
++ oldflag = !(dev->transport_flags & TRANSPORT_FLAG_PASSTHROUGH_PGR); |
1953 |
++ if (flag == oldflag) |
1954 |
++ return count; |
1955 |
++ |
1956 |
+ if (!(dev->transport->transport_flags_changeable & |
1957 |
+ TRANSPORT_FLAG_PASSTHROUGH_PGR)) { |
1958 |
+ pr_err("dev[%p]: Unable to change SE Device pgr_support:" |
1959 |
+ " pgr_support has fixed value\n", dev); |
1960 |
+- return -EINVAL; |
1961 |
++ return -ENOSYS; |
1962 |
+ } |
1963 |
+ |
1964 |
+- ret = strtobool(page, &flag); |
1965 |
+- if (ret < 0) |
1966 |
+- return ret; |
1967 |
+- |
1968 |
+ if (flag) |
1969 |
+ dev->transport_flags &= ~TRANSPORT_FLAG_PASSTHROUGH_PGR; |
1970 |
+ else |
1971 |
+diff --git a/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c b/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c |
1972 |
+index 74158fa660ddf..f5204f96fe723 100644 |
1973 |
+--- a/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c |
1974 |
++++ b/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c |
1975 |
+@@ -185,7 +185,7 @@ static int tcc_offset_update(unsigned int tcc) |
1976 |
+ return 0; |
1977 |
+ } |
1978 |
+ |
1979 |
+-static unsigned int tcc_offset_save; |
1980 |
++static int tcc_offset_save = -1; |
1981 |
+ |
1982 |
+ static ssize_t tcc_offset_degree_celsius_store(struct device *dev, |
1983 |
+ struct device_attribute *attr, const char *buf, |
1984 |
+@@ -709,7 +709,8 @@ static int proc_thermal_resume(struct device *dev) |
1985 |
+ proc_dev = dev_get_drvdata(dev); |
1986 |
+ proc_thermal_read_ppcc(proc_dev); |
1987 |
+ |
1988 |
+- tcc_offset_update(tcc_offset_save); |
1989 |
++ if (tcc_offset_save >= 0) |
1990 |
++ tcc_offset_update(tcc_offset_save); |
1991 |
+ |
1992 |
+ return 0; |
1993 |
+ } |
1994 |
+diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c |
1995 |
+index e669f83faa3c5..17de8a9b991e9 100644 |
1996 |
+--- a/drivers/thermal/thermal_core.c |
1997 |
++++ b/drivers/thermal/thermal_core.c |
1998 |
+@@ -224,15 +224,14 @@ int thermal_build_list_of_policies(char *buf) |
1999 |
+ { |
2000 |
+ struct thermal_governor *pos; |
2001 |
+ ssize_t count = 0; |
2002 |
+- ssize_t size = PAGE_SIZE; |
2003 |
+ |
2004 |
+ mutex_lock(&thermal_governor_lock); |
2005 |
+ |
2006 |
+ list_for_each_entry(pos, &thermal_governor_list, governor_list) { |
2007 |
+- size = PAGE_SIZE - count; |
2008 |
+- count += scnprintf(buf + count, size, "%s ", pos->name); |
2009 |
++ count += scnprintf(buf + count, PAGE_SIZE - count, "%s ", |
2010 |
++ pos->name); |
2011 |
+ } |
2012 |
+- count += scnprintf(buf + count, size, "\n"); |
2013 |
++ count += scnprintf(buf + count, PAGE_SIZE - count, "\n"); |
2014 |
+ |
2015 |
+ mutex_unlock(&thermal_governor_lock); |
2016 |
+ |
2017 |
+diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c |
2018 |
+index efe4cf32add2c..537bee8d2258a 100644 |
2019 |
+--- a/drivers/tty/serial/8250/8250_omap.c |
2020 |
++++ b/drivers/tty/serial/8250/8250_omap.c |
2021 |
+@@ -106,7 +106,7 @@ |
2022 |
+ #define UART_OMAP_EFR2_TIMEOUT_BEHAVE BIT(6) |
2023 |
+ |
2024 |
+ /* RX FIFO occupancy indicator */ |
2025 |
+-#define UART_OMAP_RX_LVL 0x64 |
2026 |
++#define UART_OMAP_RX_LVL 0x19 |
2027 |
+ |
2028 |
+ struct omap8250_priv { |
2029 |
+ int line; |
2030 |
+diff --git a/drivers/tty/serial/mvebu-uart.c b/drivers/tty/serial/mvebu-uart.c |
2031 |
+index 1e26220c78527..34ff2181afd1a 100644 |
2032 |
+--- a/drivers/tty/serial/mvebu-uart.c |
2033 |
++++ b/drivers/tty/serial/mvebu-uart.c |
2034 |
+@@ -164,7 +164,7 @@ static unsigned int mvebu_uart_tx_empty(struct uart_port *port) |
2035 |
+ st = readl(port->membase + UART_STAT); |
2036 |
+ spin_unlock_irqrestore(&port->lock, flags); |
2037 |
+ |
2038 |
+- return (st & STAT_TX_FIFO_EMP) ? TIOCSER_TEMT : 0; |
2039 |
++ return (st & STAT_TX_EMP) ? TIOCSER_TEMT : 0; |
2040 |
+ } |
2041 |
+ |
2042 |
+ static unsigned int mvebu_uart_get_mctrl(struct uart_port *port) |
2043 |
+diff --git a/drivers/tty/synclink_gt.c b/drivers/tty/synclink_gt.c |
2044 |
+index afa4cc52e48d7..1a0c7beec1019 100644 |
2045 |
+--- a/drivers/tty/synclink_gt.c |
2046 |
++++ b/drivers/tty/synclink_gt.c |
2047 |
+@@ -137,37 +137,14 @@ MODULE_PARM_DESC(maxframe, "Maximum frame size used by device (4096 to 65535)"); |
2048 |
+ */ |
2049 |
+ static struct tty_driver *serial_driver; |
2050 |
+ |
2051 |
+-static int open(struct tty_struct *tty, struct file * filp); |
2052 |
+-static void close(struct tty_struct *tty, struct file * filp); |
2053 |
+-static void hangup(struct tty_struct *tty); |
2054 |
+-static void set_termios(struct tty_struct *tty, struct ktermios *old_termios); |
2055 |
+- |
2056 |
+-static int write(struct tty_struct *tty, const unsigned char *buf, int count); |
2057 |
+-static int put_char(struct tty_struct *tty, unsigned char ch); |
2058 |
+-static void send_xchar(struct tty_struct *tty, char ch); |
2059 |
+ static void wait_until_sent(struct tty_struct *tty, int timeout); |
2060 |
+-static int write_room(struct tty_struct *tty); |
2061 |
+-static void flush_chars(struct tty_struct *tty); |
2062 |
+ static void flush_buffer(struct tty_struct *tty); |
2063 |
+-static void tx_hold(struct tty_struct *tty); |
2064 |
+ static void tx_release(struct tty_struct *tty); |
2065 |
+ |
2066 |
+-static int ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg); |
2067 |
+-static int chars_in_buffer(struct tty_struct *tty); |
2068 |
+-static void throttle(struct tty_struct * tty); |
2069 |
+-static void unthrottle(struct tty_struct * tty); |
2070 |
+-static int set_break(struct tty_struct *tty, int break_state); |
2071 |
+- |
2072 |
+ /* |
2073 |
+- * generic HDLC support and callbacks |
2074 |
++ * generic HDLC support |
2075 |
+ */ |
2076 |
+-#if SYNCLINK_GENERIC_HDLC |
2077 |
+ #define dev_to_port(D) (dev_to_hdlc(D)->priv) |
2078 |
+-static void hdlcdev_tx_done(struct slgt_info *info); |
2079 |
+-static void hdlcdev_rx(struct slgt_info *info, char *buf, int size); |
2080 |
+-static int hdlcdev_init(struct slgt_info *info); |
2081 |
+-static void hdlcdev_exit(struct slgt_info *info); |
2082 |
+-#endif |
2083 |
+ |
2084 |
+ |
2085 |
+ /* |
2086 |
+@@ -186,9 +163,6 @@ struct cond_wait { |
2087 |
+ wait_queue_entry_t wait; |
2088 |
+ unsigned int data; |
2089 |
+ }; |
2090 |
+-static void init_cond_wait(struct cond_wait *w, unsigned int data); |
2091 |
+-static void add_cond_wait(struct cond_wait **head, struct cond_wait *w); |
2092 |
+-static void remove_cond_wait(struct cond_wait **head, struct cond_wait *w); |
2093 |
+ static void flush_cond_wait(struct cond_wait **head); |
2094 |
+ |
2095 |
+ /* |
2096 |
+@@ -443,12 +417,8 @@ static void shutdown(struct slgt_info *info); |
2097 |
+ static void program_hw(struct slgt_info *info); |
2098 |
+ static void change_params(struct slgt_info *info); |
2099 |
+ |
2100 |
+-static int register_test(struct slgt_info *info); |
2101 |
+-static int irq_test(struct slgt_info *info); |
2102 |
+-static int loopback_test(struct slgt_info *info); |
2103 |
+ static int adapter_test(struct slgt_info *info); |
2104 |
+ |
2105 |
+-static void reset_adapter(struct slgt_info *info); |
2106 |
+ static void reset_port(struct slgt_info *info); |
2107 |
+ static void async_mode(struct slgt_info *info); |
2108 |
+ static void sync_mode(struct slgt_info *info); |
2109 |
+@@ -457,41 +427,23 @@ static void rx_stop(struct slgt_info *info); |
2110 |
+ static void rx_start(struct slgt_info *info); |
2111 |
+ static void reset_rbufs(struct slgt_info *info); |
2112 |
+ static void free_rbufs(struct slgt_info *info, unsigned int first, unsigned int last); |
2113 |
+-static void rdma_reset(struct slgt_info *info); |
2114 |
+ static bool rx_get_frame(struct slgt_info *info); |
2115 |
+ static bool rx_get_buf(struct slgt_info *info); |
2116 |
+ |
2117 |
+ static void tx_start(struct slgt_info *info); |
2118 |
+ static void tx_stop(struct slgt_info *info); |
2119 |
+ static void tx_set_idle(struct slgt_info *info); |
2120 |
+-static unsigned int free_tbuf_count(struct slgt_info *info); |
2121 |
+ static unsigned int tbuf_bytes(struct slgt_info *info); |
2122 |
+ static void reset_tbufs(struct slgt_info *info); |
2123 |
+ static void tdma_reset(struct slgt_info *info); |
2124 |
+ static bool tx_load(struct slgt_info *info, const char *buf, unsigned int count); |
2125 |
+ |
2126 |
+-static void get_signals(struct slgt_info *info); |
2127 |
+-static void set_signals(struct slgt_info *info); |
2128 |
+-static void enable_loopback(struct slgt_info *info); |
2129 |
++static void get_gtsignals(struct slgt_info *info); |
2130 |
++static void set_gtsignals(struct slgt_info *info); |
2131 |
+ static void set_rate(struct slgt_info *info, u32 data_rate); |
2132 |
+ |
2133 |
+-static int bh_action(struct slgt_info *info); |
2134 |
+-static void bh_handler(struct work_struct *work); |
2135 |
+ static void bh_transmit(struct slgt_info *info); |
2136 |
+-static void isr_serial(struct slgt_info *info); |
2137 |
+-static void isr_rdma(struct slgt_info *info); |
2138 |
+ static void isr_txeom(struct slgt_info *info, unsigned short status); |
2139 |
+-static void isr_tdma(struct slgt_info *info); |
2140 |
+- |
2141 |
+-static int alloc_dma_bufs(struct slgt_info *info); |
2142 |
+-static void free_dma_bufs(struct slgt_info *info); |
2143 |
+-static int alloc_desc(struct slgt_info *info); |
2144 |
+-static void free_desc(struct slgt_info *info); |
2145 |
+-static int alloc_bufs(struct slgt_info *info, struct slgt_desc *bufs, int count); |
2146 |
+-static void free_bufs(struct slgt_info *info, struct slgt_desc *bufs, int count); |
2147 |
+- |
2148 |
+-static int alloc_tmp_rbuf(struct slgt_info *info); |
2149 |
+-static void free_tmp_rbuf(struct slgt_info *info); |
2150 |
+ |
2151 |
+ static void tx_timeout(struct timer_list *t); |
2152 |
+ static void rx_timeout(struct timer_list *t); |
2153 |
+@@ -509,10 +461,6 @@ static int tx_abort(struct slgt_info *info); |
2154 |
+ static int rx_enable(struct slgt_info *info, int enable); |
2155 |
+ static int modem_input_wait(struct slgt_info *info,int arg); |
2156 |
+ static int wait_mgsl_event(struct slgt_info *info, int __user *mask_ptr); |
2157 |
+-static int tiocmget(struct tty_struct *tty); |
2158 |
+-static int tiocmset(struct tty_struct *tty, |
2159 |
+- unsigned int set, unsigned int clear); |
2160 |
+-static int set_break(struct tty_struct *tty, int break_state); |
2161 |
+ static int get_interface(struct slgt_info *info, int __user *if_mode); |
2162 |
+ static int set_interface(struct slgt_info *info, int if_mode); |
2163 |
+ static int set_gpio(struct slgt_info *info, struct gpio_desc __user *gpio); |
2164 |
+@@ -526,9 +474,6 @@ static int set_xctrl(struct slgt_info *info, int if_mode); |
2165 |
+ /* |
2166 |
+ * driver functions |
2167 |
+ */ |
2168 |
+-static void add_device(struct slgt_info *info); |
2169 |
+-static void device_init(int adapter_num, struct pci_dev *pdev); |
2170 |
+-static int claim_resources(struct slgt_info *info); |
2171 |
+ static void release_resources(struct slgt_info *info); |
2172 |
+ |
2173 |
+ /* |
2174 |
+@@ -776,7 +721,7 @@ static void set_termios(struct tty_struct *tty, struct ktermios *old_termios) |
2175 |
+ if ((old_termios->c_cflag & CBAUD) && !C_BAUD(tty)) { |
2176 |
+ info->signals &= ~(SerialSignal_RTS | SerialSignal_DTR); |
2177 |
+ spin_lock_irqsave(&info->lock,flags); |
2178 |
+- set_signals(info); |
2179 |
++ set_gtsignals(info); |
2180 |
+ spin_unlock_irqrestore(&info->lock,flags); |
2181 |
+ } |
2182 |
+ |
2183 |
+@@ -786,7 +731,7 @@ static void set_termios(struct tty_struct *tty, struct ktermios *old_termios) |
2184 |
+ if (!C_CRTSCTS(tty) || !tty_throttled(tty)) |
2185 |
+ info->signals |= SerialSignal_RTS; |
2186 |
+ spin_lock_irqsave(&info->lock,flags); |
2187 |
+- set_signals(info); |
2188 |
++ set_gtsignals(info); |
2189 |
+ spin_unlock_irqrestore(&info->lock,flags); |
2190 |
+ } |
2191 |
+ |
2192 |
+@@ -1237,7 +1182,7 @@ static inline void line_info(struct seq_file *m, struct slgt_info *info) |
2193 |
+ |
2194 |
+ /* output current serial signal states */ |
2195 |
+ spin_lock_irqsave(&info->lock,flags); |
2196 |
+- get_signals(info); |
2197 |
++ get_gtsignals(info); |
2198 |
+ spin_unlock_irqrestore(&info->lock,flags); |
2199 |
+ |
2200 |
+ stat_buf[0] = 0; |
2201 |
+@@ -1337,7 +1282,7 @@ static void throttle(struct tty_struct * tty) |
2202 |
+ if (C_CRTSCTS(tty)) { |
2203 |
+ spin_lock_irqsave(&info->lock,flags); |
2204 |
+ info->signals &= ~SerialSignal_RTS; |
2205 |
+- set_signals(info); |
2206 |
++ set_gtsignals(info); |
2207 |
+ spin_unlock_irqrestore(&info->lock,flags); |
2208 |
+ } |
2209 |
+ } |
2210 |
+@@ -1362,7 +1307,7 @@ static void unthrottle(struct tty_struct * tty) |
2211 |
+ if (C_CRTSCTS(tty)) { |
2212 |
+ spin_lock_irqsave(&info->lock,flags); |
2213 |
+ info->signals |= SerialSignal_RTS; |
2214 |
+- set_signals(info); |
2215 |
++ set_gtsignals(info); |
2216 |
+ spin_unlock_irqrestore(&info->lock,flags); |
2217 |
+ } |
2218 |
+ } |
2219 |
+@@ -1533,7 +1478,7 @@ static int hdlcdev_open(struct net_device *dev) |
2220 |
+ |
2221 |
+ /* inform generic HDLC layer of current DCD status */ |
2222 |
+ spin_lock_irqsave(&info->lock, flags); |
2223 |
+- get_signals(info); |
2224 |
++ get_gtsignals(info); |
2225 |
+ spin_unlock_irqrestore(&info->lock, flags); |
2226 |
+ if (info->signals & SerialSignal_DCD) |
2227 |
+ netif_carrier_on(dev); |
2228 |
+@@ -2287,7 +2232,7 @@ static void isr_txeom(struct slgt_info *info, unsigned short status) |
2229 |
+ if (info->params.mode != MGSL_MODE_ASYNC && info->drop_rts_on_tx_done) { |
2230 |
+ info->signals &= ~SerialSignal_RTS; |
2231 |
+ info->drop_rts_on_tx_done = false; |
2232 |
+- set_signals(info); |
2233 |
++ set_gtsignals(info); |
2234 |
+ } |
2235 |
+ |
2236 |
+ #if SYNCLINK_GENERIC_HDLC |
2237 |
+@@ -2452,7 +2397,7 @@ static void shutdown(struct slgt_info *info) |
2238 |
+ |
2239 |
+ if (!info->port.tty || info->port.tty->termios.c_cflag & HUPCL) { |
2240 |
+ info->signals &= ~(SerialSignal_RTS | SerialSignal_DTR); |
2241 |
+- set_signals(info); |
2242 |
++ set_gtsignals(info); |
2243 |
+ } |
2244 |
+ |
2245 |
+ flush_cond_wait(&info->gpio_wait_q); |
2246 |
+@@ -2480,7 +2425,7 @@ static void program_hw(struct slgt_info *info) |
2247 |
+ else |
2248 |
+ async_mode(info); |
2249 |
+ |
2250 |
+- set_signals(info); |
2251 |
++ set_gtsignals(info); |
2252 |
+ |
2253 |
+ info->dcd_chkcount = 0; |
2254 |
+ info->cts_chkcount = 0; |
2255 |
+@@ -2488,7 +2433,7 @@ static void program_hw(struct slgt_info *info) |
2256 |
+ info->dsr_chkcount = 0; |
2257 |
+ |
2258 |
+ slgt_irq_on(info, IRQ_DCD | IRQ_CTS | IRQ_DSR | IRQ_RI); |
2259 |
+- get_signals(info); |
2260 |
++ get_gtsignals(info); |
2261 |
+ |
2262 |
+ if (info->netcount || |
2263 |
+ (info->port.tty && info->port.tty->termios.c_cflag & CREAD)) |
2264 |
+@@ -2732,7 +2677,7 @@ static int wait_mgsl_event(struct slgt_info *info, int __user *mask_ptr) |
2265 |
+ spin_lock_irqsave(&info->lock,flags); |
2266 |
+ |
2267 |
+ /* return immediately if state matches requested events */ |
2268 |
+- get_signals(info); |
2269 |
++ get_gtsignals(info); |
2270 |
+ s = info->signals; |
2271 |
+ |
2272 |
+ events = mask & |
2273 |
+@@ -3150,7 +3095,7 @@ static int tiocmget(struct tty_struct *tty) |
2274 |
+ unsigned long flags; |
2275 |
+ |
2276 |
+ spin_lock_irqsave(&info->lock,flags); |
2277 |
+- get_signals(info); |
2278 |
++ get_gtsignals(info); |
2279 |
+ spin_unlock_irqrestore(&info->lock,flags); |
2280 |
+ |
2281 |
+ result = ((info->signals & SerialSignal_RTS) ? TIOCM_RTS:0) + |
2282 |
+@@ -3189,7 +3134,7 @@ static int tiocmset(struct tty_struct *tty, |
2283 |
+ info->signals &= ~SerialSignal_DTR; |
2284 |
+ |
2285 |
+ spin_lock_irqsave(&info->lock,flags); |
2286 |
+- set_signals(info); |
2287 |
++ set_gtsignals(info); |
2288 |
+ spin_unlock_irqrestore(&info->lock,flags); |
2289 |
+ return 0; |
2290 |
+ } |
2291 |
+@@ -3200,7 +3145,7 @@ static int carrier_raised(struct tty_port *port) |
2292 |
+ struct slgt_info *info = container_of(port, struct slgt_info, port); |
2293 |
+ |
2294 |
+ spin_lock_irqsave(&info->lock,flags); |
2295 |
+- get_signals(info); |
2296 |
++ get_gtsignals(info); |
2297 |
+ spin_unlock_irqrestore(&info->lock,flags); |
2298 |
+ return (info->signals & SerialSignal_DCD) ? 1 : 0; |
2299 |
+ } |
2300 |
+@@ -3215,7 +3160,7 @@ static void dtr_rts(struct tty_port *port, int on) |
2301 |
+ info->signals |= SerialSignal_RTS | SerialSignal_DTR; |
2302 |
+ else |
2303 |
+ info->signals &= ~(SerialSignal_RTS | SerialSignal_DTR); |
2304 |
+- set_signals(info); |
2305 |
++ set_gtsignals(info); |
2306 |
+ spin_unlock_irqrestore(&info->lock,flags); |
2307 |
+ } |
2308 |
+ |
2309 |
+@@ -4018,10 +3963,10 @@ static void tx_start(struct slgt_info *info) |
2310 |
+ |
2311 |
+ if (info->params.mode != MGSL_MODE_ASYNC) { |
2312 |
+ if (info->params.flags & HDLC_FLAG_AUTO_RTS) { |
2313 |
+- get_signals(info); |
2314 |
++ get_gtsignals(info); |
2315 |
+ if (!(info->signals & SerialSignal_RTS)) { |
2316 |
+ info->signals |= SerialSignal_RTS; |
2317 |
+- set_signals(info); |
2318 |
++ set_gtsignals(info); |
2319 |
+ info->drop_rts_on_tx_done = true; |
2320 |
+ } |
2321 |
+ } |
2322 |
+@@ -4075,7 +4020,7 @@ static void reset_port(struct slgt_info *info) |
2323 |
+ rx_stop(info); |
2324 |
+ |
2325 |
+ info->signals &= ~(SerialSignal_RTS | SerialSignal_DTR); |
2326 |
+- set_signals(info); |
2327 |
++ set_gtsignals(info); |
2328 |
+ |
2329 |
+ slgt_irq_off(info, IRQ_ALL | IRQ_MASTER); |
2330 |
+ } |
2331 |
+@@ -4497,7 +4442,7 @@ static void tx_set_idle(struct slgt_info *info) |
2332 |
+ /* |
2333 |
+ * get state of V24 status (input) signals |
2334 |
+ */ |
2335 |
+-static void get_signals(struct slgt_info *info) |
2336 |
++static void get_gtsignals(struct slgt_info *info) |
2337 |
+ { |
2338 |
+ unsigned short status = rd_reg16(info, SSR); |
2339 |
+ |
2340 |
+@@ -4559,7 +4504,7 @@ static void msc_set_vcr(struct slgt_info *info) |
2341 |
+ /* |
2342 |
+ * set state of V24 control (output) signals |
2343 |
+ */ |
2344 |
+-static void set_signals(struct slgt_info *info) |
2345 |
++static void set_gtsignals(struct slgt_info *info) |
2346 |
+ { |
2347 |
+ unsigned char val = rd_reg8(info, VCR); |
2348 |
+ if (info->signals & SerialSignal_DTR) |
2349 |
+diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c |
2350 |
+index df5b2d1e214f1..7748b1335558e 100644 |
2351 |
+--- a/drivers/usb/class/cdc-acm.c |
2352 |
++++ b/drivers/usb/class/cdc-acm.c |
2353 |
+@@ -726,7 +726,8 @@ static void acm_port_destruct(struct tty_port *port) |
2354 |
+ { |
2355 |
+ struct acm *acm = container_of(port, struct acm, port); |
2356 |
+ |
2357 |
+- acm_release_minor(acm); |
2358 |
++ if (acm->minor != ACM_MINOR_INVALID) |
2359 |
++ acm_release_minor(acm); |
2360 |
+ usb_put_intf(acm->control); |
2361 |
+ kfree(acm->country_codes); |
2362 |
+ kfree(acm); |
2363 |
+@@ -1343,8 +1344,10 @@ made_compressed_probe: |
2364 |
+ usb_get_intf(acm->control); /* undone in destruct() */ |
2365 |
+ |
2366 |
+ minor = acm_alloc_minor(acm); |
2367 |
+- if (minor < 0) |
2368 |
++ if (minor < 0) { |
2369 |
++ acm->minor = ACM_MINOR_INVALID; |
2370 |
+ goto alloc_fail1; |
2371 |
++ } |
2372 |
+ |
2373 |
+ acm->minor = minor; |
2374 |
+ acm->dev = usb_dev; |
2375 |
+diff --git a/drivers/usb/class/cdc-acm.h b/drivers/usb/class/cdc-acm.h |
2376 |
+index 8aef5eb769a0d..3aa7f0a3ad71e 100644 |
2377 |
+--- a/drivers/usb/class/cdc-acm.h |
2378 |
++++ b/drivers/usb/class/cdc-acm.h |
2379 |
+@@ -22,6 +22,8 @@ |
2380 |
+ #define ACM_TTY_MAJOR 166 |
2381 |
+ #define ACM_TTY_MINORS 256 |
2382 |
+ |
2383 |
++#define ACM_MINOR_INVALID ACM_TTY_MINORS |
2384 |
++ |
2385 |
+ /* |
2386 |
+ * Requests. |
2387 |
+ */ |
2388 |
+diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c |
2389 |
+index 99908d8d2dd36..4bbf3316a9a53 100644 |
2390 |
+--- a/drivers/usb/core/hcd.c |
2391 |
++++ b/drivers/usb/core/hcd.c |
2392 |
+@@ -2640,6 +2640,7 @@ int usb_add_hcd(struct usb_hcd *hcd, |
2393 |
+ { |
2394 |
+ int retval; |
2395 |
+ struct usb_device *rhdev; |
2396 |
++ struct usb_hcd *shared_hcd; |
2397 |
+ |
2398 |
+ if (!hcd->skip_phy_initialization && usb_hcd_is_primary_hcd(hcd)) { |
2399 |
+ hcd->phy_roothub = usb_phy_roothub_alloc(hcd->self.sysdev); |
2400 |
+@@ -2796,13 +2797,26 @@ int usb_add_hcd(struct usb_hcd *hcd, |
2401 |
+ goto err_hcd_driver_start; |
2402 |
+ } |
2403 |
+ |
2404 |
++ /* starting here, usbcore will pay attention to the shared HCD roothub */ |
2405 |
++ shared_hcd = hcd->shared_hcd; |
2406 |
++ if (!usb_hcd_is_primary_hcd(hcd) && shared_hcd && HCD_DEFER_RH_REGISTER(shared_hcd)) { |
2407 |
++ retval = register_root_hub(shared_hcd); |
2408 |
++ if (retval != 0) |
2409 |
++ goto err_register_root_hub; |
2410 |
++ |
2411 |
++ if (shared_hcd->uses_new_polling && HCD_POLL_RH(shared_hcd)) |
2412 |
++ usb_hcd_poll_rh_status(shared_hcd); |
2413 |
++ } |
2414 |
++ |
2415 |
+ /* starting here, usbcore will pay attention to this root hub */ |
2416 |
+- retval = register_root_hub(hcd); |
2417 |
+- if (retval != 0) |
2418 |
+- goto err_register_root_hub; |
2419 |
++ if (!HCD_DEFER_RH_REGISTER(hcd)) { |
2420 |
++ retval = register_root_hub(hcd); |
2421 |
++ if (retval != 0) |
2422 |
++ goto err_register_root_hub; |
2423 |
+ |
2424 |
+- if (hcd->uses_new_polling && HCD_POLL_RH(hcd)) |
2425 |
+- usb_hcd_poll_rh_status(hcd); |
2426 |
++ if (hcd->uses_new_polling && HCD_POLL_RH(hcd)) |
2427 |
++ usb_hcd_poll_rh_status(hcd); |
2428 |
++ } |
2429 |
+ |
2430 |
+ return retval; |
2431 |
+ |
2432 |
+@@ -2845,6 +2859,7 @@ EXPORT_SYMBOL_GPL(usb_add_hcd); |
2433 |
+ void usb_remove_hcd(struct usb_hcd *hcd) |
2434 |
+ { |
2435 |
+ struct usb_device *rhdev = hcd->self.root_hub; |
2436 |
++ bool rh_registered; |
2437 |
+ |
2438 |
+ dev_info(hcd->self.controller, "remove, state %x\n", hcd->state); |
2439 |
+ |
2440 |
+@@ -2855,6 +2870,7 @@ void usb_remove_hcd(struct usb_hcd *hcd) |
2441 |
+ |
2442 |
+ dev_dbg(hcd->self.controller, "roothub graceful disconnect\n"); |
2443 |
+ spin_lock_irq (&hcd_root_hub_lock); |
2444 |
++ rh_registered = hcd->rh_registered; |
2445 |
+ hcd->rh_registered = 0; |
2446 |
+ spin_unlock_irq (&hcd_root_hub_lock); |
2447 |
+ |
2448 |
+@@ -2864,7 +2880,8 @@ void usb_remove_hcd(struct usb_hcd *hcd) |
2449 |
+ cancel_work_sync(&hcd->died_work); |
2450 |
+ |
2451 |
+ mutex_lock(&usb_bus_idr_lock); |
2452 |
+- usb_disconnect(&rhdev); /* Sets rhdev to NULL */ |
2453 |
++ if (rh_registered) |
2454 |
++ usb_disconnect(&rhdev); /* Sets rhdev to NULL */ |
2455 |
+ mutex_unlock(&usb_bus_idr_lock); |
2456 |
+ |
2457 |
+ /* |
2458 |
+diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c |
2459 |
+index b06286f132c6f..7207a36c6e26b 100644 |
2460 |
+--- a/drivers/usb/dwc2/gadget.c |
2461 |
++++ b/drivers/usb/dwc2/gadget.c |
2462 |
+@@ -115,10 +115,16 @@ static inline bool using_desc_dma(struct dwc2_hsotg *hsotg) |
2463 |
+ */ |
2464 |
+ static inline void dwc2_gadget_incr_frame_num(struct dwc2_hsotg_ep *hs_ep) |
2465 |
+ { |
2466 |
++ struct dwc2_hsotg *hsotg = hs_ep->parent; |
2467 |
++ u16 limit = DSTS_SOFFN_LIMIT; |
2468 |
++ |
2469 |
++ if (hsotg->gadget.speed != USB_SPEED_HIGH) |
2470 |
++ limit >>= 3; |
2471 |
++ |
2472 |
+ hs_ep->target_frame += hs_ep->interval; |
2473 |
+- if (hs_ep->target_frame > DSTS_SOFFN_LIMIT) { |
2474 |
++ if (hs_ep->target_frame > limit) { |
2475 |
+ hs_ep->frame_overrun = true; |
2476 |
+- hs_ep->target_frame &= DSTS_SOFFN_LIMIT; |
2477 |
++ hs_ep->target_frame &= limit; |
2478 |
+ } else { |
2479 |
+ hs_ep->frame_overrun = false; |
2480 |
+ } |
2481 |
+@@ -136,10 +142,16 @@ static inline void dwc2_gadget_incr_frame_num(struct dwc2_hsotg_ep *hs_ep) |
2482 |
+ */ |
2483 |
+ static inline void dwc2_gadget_dec_frame_num_by_one(struct dwc2_hsotg_ep *hs_ep) |
2484 |
+ { |
2485 |
++ struct dwc2_hsotg *hsotg = hs_ep->parent; |
2486 |
++ u16 limit = DSTS_SOFFN_LIMIT; |
2487 |
++ |
2488 |
++ if (hsotg->gadget.speed != USB_SPEED_HIGH) |
2489 |
++ limit >>= 3; |
2490 |
++ |
2491 |
+ if (hs_ep->target_frame) |
2492 |
+ hs_ep->target_frame -= 1; |
2493 |
+ else |
2494 |
+- hs_ep->target_frame = DSTS_SOFFN_LIMIT; |
2495 |
++ hs_ep->target_frame = limit; |
2496 |
+ } |
2497 |
+ |
2498 |
+ /** |
2499 |
+@@ -1018,6 +1030,12 @@ static void dwc2_gadget_start_isoc_ddma(struct dwc2_hsotg_ep *hs_ep) |
2500 |
+ dwc2_writel(hsotg, ctrl, depctl); |
2501 |
+ } |
2502 |
+ |
2503 |
++static bool dwc2_gadget_target_frame_elapsed(struct dwc2_hsotg_ep *hs_ep); |
2504 |
++static void dwc2_hsotg_complete_request(struct dwc2_hsotg *hsotg, |
2505 |
++ struct dwc2_hsotg_ep *hs_ep, |
2506 |
++ struct dwc2_hsotg_req *hs_req, |
2507 |
++ int result); |
2508 |
++ |
2509 |
+ /** |
2510 |
+ * dwc2_hsotg_start_req - start a USB request from an endpoint's queue |
2511 |
+ * @hsotg: The controller state. |
2512 |
+@@ -1170,14 +1188,19 @@ static void dwc2_hsotg_start_req(struct dwc2_hsotg *hsotg, |
2513 |
+ } |
2514 |
+ } |
2515 |
+ |
2516 |
+- if (hs_ep->isochronous && hs_ep->interval == 1) { |
2517 |
+- hs_ep->target_frame = dwc2_hsotg_read_frameno(hsotg); |
2518 |
+- dwc2_gadget_incr_frame_num(hs_ep); |
2519 |
+- |
2520 |
+- if (hs_ep->target_frame & 0x1) |
2521 |
+- ctrl |= DXEPCTL_SETODDFR; |
2522 |
+- else |
2523 |
+- ctrl |= DXEPCTL_SETEVENFR; |
2524 |
++ if (hs_ep->isochronous) { |
2525 |
++ if (!dwc2_gadget_target_frame_elapsed(hs_ep)) { |
2526 |
++ if (hs_ep->interval == 1) { |
2527 |
++ if (hs_ep->target_frame & 0x1) |
2528 |
++ ctrl |= DXEPCTL_SETODDFR; |
2529 |
++ else |
2530 |
++ ctrl |= DXEPCTL_SETEVENFR; |
2531 |
++ } |
2532 |
++ ctrl |= DXEPCTL_CNAK; |
2533 |
++ } else { |
2534 |
++ dwc2_hsotg_complete_request(hsotg, hs_ep, hs_req, -ENODATA); |
2535 |
++ return; |
2536 |
++ } |
2537 |
+ } |
2538 |
+ |
2539 |
+ ctrl |= DXEPCTL_EPENA; /* ensure ep enabled */ |
2540 |
+@@ -1325,12 +1348,16 @@ static bool dwc2_gadget_target_frame_elapsed(struct dwc2_hsotg_ep *hs_ep) |
2541 |
+ u32 target_frame = hs_ep->target_frame; |
2542 |
+ u32 current_frame = hsotg->frame_number; |
2543 |
+ bool frame_overrun = hs_ep->frame_overrun; |
2544 |
++ u16 limit = DSTS_SOFFN_LIMIT; |
2545 |
++ |
2546 |
++ if (hsotg->gadget.speed != USB_SPEED_HIGH) |
2547 |
++ limit >>= 3; |
2548 |
+ |
2549 |
+ if (!frame_overrun && current_frame >= target_frame) |
2550 |
+ return true; |
2551 |
+ |
2552 |
+ if (frame_overrun && current_frame >= target_frame && |
2553 |
+- ((current_frame - target_frame) < DSTS_SOFFN_LIMIT / 2)) |
2554 |
++ ((current_frame - target_frame) < limit / 2)) |
2555 |
+ return true; |
2556 |
+ |
2557 |
+ return false; |
2558 |
+@@ -1713,11 +1740,9 @@ static struct dwc2_hsotg_req *get_ep_head(struct dwc2_hsotg_ep *hs_ep) |
2559 |
+ */ |
2560 |
+ static void dwc2_gadget_start_next_request(struct dwc2_hsotg_ep *hs_ep) |
2561 |
+ { |
2562 |
+- u32 mask; |
2563 |
+ struct dwc2_hsotg *hsotg = hs_ep->parent; |
2564 |
+ int dir_in = hs_ep->dir_in; |
2565 |
+ struct dwc2_hsotg_req *hs_req; |
2566 |
+- u32 epmsk_reg = dir_in ? DIEPMSK : DOEPMSK; |
2567 |
+ |
2568 |
+ if (!list_empty(&hs_ep->queue)) { |
2569 |
+ hs_req = get_ep_head(hs_ep); |
2570 |
+@@ -1733,9 +1758,6 @@ static void dwc2_gadget_start_next_request(struct dwc2_hsotg_ep *hs_ep) |
2571 |
+ } else { |
2572 |
+ dev_dbg(hsotg->dev, "%s: No more ISOC-OUT requests\n", |
2573 |
+ __func__); |
2574 |
+- mask = dwc2_readl(hsotg, epmsk_reg); |
2575 |
+- mask |= DOEPMSK_OUTTKNEPDISMSK; |
2576 |
+- dwc2_writel(hsotg, mask, epmsk_reg); |
2577 |
+ } |
2578 |
+ } |
2579 |
+ |
2580 |
+@@ -2305,19 +2327,6 @@ static void dwc2_hsotg_ep0_zlp(struct dwc2_hsotg *hsotg, bool dir_in) |
2581 |
+ dwc2_hsotg_program_zlp(hsotg, hsotg->eps_out[0]); |
2582 |
+ } |
2583 |
+ |
2584 |
+-static void dwc2_hsotg_change_ep_iso_parity(struct dwc2_hsotg *hsotg, |
2585 |
+- u32 epctl_reg) |
2586 |
+-{ |
2587 |
+- u32 ctrl; |
2588 |
+- |
2589 |
+- ctrl = dwc2_readl(hsotg, epctl_reg); |
2590 |
+- if (ctrl & DXEPCTL_EOFRNUM) |
2591 |
+- ctrl |= DXEPCTL_SETEVENFR; |
2592 |
+- else |
2593 |
+- ctrl |= DXEPCTL_SETODDFR; |
2594 |
+- dwc2_writel(hsotg, ctrl, epctl_reg); |
2595 |
+-} |
2596 |
+- |
2597 |
+ /* |
2598 |
+ * dwc2_gadget_get_xfersize_ddma - get transferred bytes amount from desc |
2599 |
+ * @hs_ep - The endpoint on which transfer went |
2600 |
+@@ -2438,20 +2447,11 @@ static void dwc2_hsotg_handle_outdone(struct dwc2_hsotg *hsotg, int epnum) |
2601 |
+ dwc2_hsotg_ep0_zlp(hsotg, true); |
2602 |
+ } |
2603 |
+ |
2604 |
+- /* |
2605 |
+- * Slave mode OUT transfers do not go through XferComplete so |
2606 |
+- * adjust the ISOC parity here. |
2607 |
+- */ |
2608 |
+- if (!using_dma(hsotg)) { |
2609 |
+- if (hs_ep->isochronous && hs_ep->interval == 1) |
2610 |
+- dwc2_hsotg_change_ep_iso_parity(hsotg, DOEPCTL(epnum)); |
2611 |
+- else if (hs_ep->isochronous && hs_ep->interval > 1) |
2612 |
+- dwc2_gadget_incr_frame_num(hs_ep); |
2613 |
+- } |
2614 |
+- |
2615 |
+ /* Set actual frame number for completed transfers */ |
2616 |
+- if (!using_desc_dma(hsotg) && hs_ep->isochronous) |
2617 |
+- req->frame_number = hsotg->frame_number; |
2618 |
++ if (!using_desc_dma(hsotg) && hs_ep->isochronous) { |
2619 |
++ req->frame_number = hs_ep->target_frame; |
2620 |
++ dwc2_gadget_incr_frame_num(hs_ep); |
2621 |
++ } |
2622 |
+ |
2623 |
+ dwc2_hsotg_complete_request(hsotg, hs_ep, hs_req, result); |
2624 |
+ } |
2625 |
+@@ -2765,6 +2765,12 @@ static void dwc2_hsotg_complete_in(struct dwc2_hsotg *hsotg, |
2626 |
+ return; |
2627 |
+ } |
2628 |
+ |
2629 |
++ /* Set actual frame number for completed transfers */ |
2630 |
++ if (!using_desc_dma(hsotg) && hs_ep->isochronous) { |
2631 |
++ hs_req->req.frame_number = hs_ep->target_frame; |
2632 |
++ dwc2_gadget_incr_frame_num(hs_ep); |
2633 |
++ } |
2634 |
++ |
2635 |
+ dwc2_hsotg_complete_request(hsotg, hs_ep, hs_req, 0); |
2636 |
+ } |
2637 |
+ |
2638 |
+@@ -2825,23 +2831,18 @@ static void dwc2_gadget_handle_ep_disabled(struct dwc2_hsotg_ep *hs_ep) |
2639 |
+ |
2640 |
+ dwc2_hsotg_txfifo_flush(hsotg, hs_ep->fifo_index); |
2641 |
+ |
2642 |
+- if (hs_ep->isochronous) { |
2643 |
+- dwc2_hsotg_complete_in(hsotg, hs_ep); |
2644 |
+- return; |
2645 |
+- } |
2646 |
+- |
2647 |
+ if ((epctl & DXEPCTL_STALL) && (epctl & DXEPCTL_EPTYPE_BULK)) { |
2648 |
+ int dctl = dwc2_readl(hsotg, DCTL); |
2649 |
+ |
2650 |
+ dctl |= DCTL_CGNPINNAK; |
2651 |
+ dwc2_writel(hsotg, dctl, DCTL); |
2652 |
+ } |
2653 |
+- return; |
2654 |
+- } |
2655 |
++ } else { |
2656 |
+ |
2657 |
+- if (dctl & DCTL_GOUTNAKSTS) { |
2658 |
+- dctl |= DCTL_CGOUTNAK; |
2659 |
+- dwc2_writel(hsotg, dctl, DCTL); |
2660 |
++ if (dctl & DCTL_GOUTNAKSTS) { |
2661 |
++ dctl |= DCTL_CGOUTNAK; |
2662 |
++ dwc2_writel(hsotg, dctl, DCTL); |
2663 |
++ } |
2664 |
+ } |
2665 |
+ |
2666 |
+ if (!hs_ep->isochronous) |
2667 |
+@@ -2862,8 +2863,6 @@ static void dwc2_gadget_handle_ep_disabled(struct dwc2_hsotg_ep *hs_ep) |
2668 |
+ /* Update current frame number value. */ |
2669 |
+ hsotg->frame_number = dwc2_hsotg_read_frameno(hsotg); |
2670 |
+ } while (dwc2_gadget_target_frame_elapsed(hs_ep)); |
2671 |
+- |
2672 |
+- dwc2_gadget_start_next_request(hs_ep); |
2673 |
+ } |
2674 |
+ |
2675 |
+ /** |
2676 |
+@@ -2880,8 +2879,8 @@ static void dwc2_gadget_handle_ep_disabled(struct dwc2_hsotg_ep *hs_ep) |
2677 |
+ static void dwc2_gadget_handle_out_token_ep_disabled(struct dwc2_hsotg_ep *ep) |
2678 |
+ { |
2679 |
+ struct dwc2_hsotg *hsotg = ep->parent; |
2680 |
++ struct dwc2_hsotg_req *hs_req; |
2681 |
+ int dir_in = ep->dir_in; |
2682 |
+- u32 doepmsk; |
2683 |
+ |
2684 |
+ if (dir_in || !ep->isochronous) |
2685 |
+ return; |
2686 |
+@@ -2895,28 +2894,39 @@ static void dwc2_gadget_handle_out_token_ep_disabled(struct dwc2_hsotg_ep *ep) |
2687 |
+ return; |
2688 |
+ } |
2689 |
+ |
2690 |
+- if (ep->interval > 1 && |
2691 |
+- ep->target_frame == TARGET_FRAME_INITIAL) { |
2692 |
++ if (ep->target_frame == TARGET_FRAME_INITIAL) { |
2693 |
+ u32 ctrl; |
2694 |
+ |
2695 |
+ ep->target_frame = hsotg->frame_number; |
2696 |
+- dwc2_gadget_incr_frame_num(ep); |
2697 |
++ if (ep->interval > 1) { |
2698 |
++ ctrl = dwc2_readl(hsotg, DOEPCTL(ep->index)); |
2699 |
++ if (ep->target_frame & 0x1) |
2700 |
++ ctrl |= DXEPCTL_SETODDFR; |
2701 |
++ else |
2702 |
++ ctrl |= DXEPCTL_SETEVENFR; |
2703 |
+ |
2704 |
+- ctrl = dwc2_readl(hsotg, DOEPCTL(ep->index)); |
2705 |
+- if (ep->target_frame & 0x1) |
2706 |
+- ctrl |= DXEPCTL_SETODDFR; |
2707 |
+- else |
2708 |
+- ctrl |= DXEPCTL_SETEVENFR; |
2709 |
++ dwc2_writel(hsotg, ctrl, DOEPCTL(ep->index)); |
2710 |
++ } |
2711 |
++ } |
2712 |
++ |
2713 |
++ while (dwc2_gadget_target_frame_elapsed(ep)) { |
2714 |
++ hs_req = get_ep_head(ep); |
2715 |
++ if (hs_req) |
2716 |
++ dwc2_hsotg_complete_request(hsotg, ep, hs_req, -ENODATA); |
2717 |
+ |
2718 |
+- dwc2_writel(hsotg, ctrl, DOEPCTL(ep->index)); |
2719 |
++ dwc2_gadget_incr_frame_num(ep); |
2720 |
++ /* Update current frame number value. */ |
2721 |
++ hsotg->frame_number = dwc2_hsotg_read_frameno(hsotg); |
2722 |
+ } |
2723 |
+ |
2724 |
+- dwc2_gadget_start_next_request(ep); |
2725 |
+- doepmsk = dwc2_readl(hsotg, DOEPMSK); |
2726 |
+- doepmsk &= ~DOEPMSK_OUTTKNEPDISMSK; |
2727 |
+- dwc2_writel(hsotg, doepmsk, DOEPMSK); |
2728 |
++ if (!ep->req) |
2729 |
++ dwc2_gadget_start_next_request(ep); |
2730 |
++ |
2731 |
+ } |
2732 |
+ |
2733 |
++static void dwc2_hsotg_ep_stop_xfr(struct dwc2_hsotg *hsotg, |
2734 |
++ struct dwc2_hsotg_ep *hs_ep); |
2735 |
++ |
2736 |
+ /** |
2737 |
+ * dwc2_gadget_handle_nak - handle NAK interrupt |
2738 |
+ * @hs_ep: The endpoint on which interrupt is asserted. |
2739 |
+@@ -2934,7 +2944,9 @@ static void dwc2_gadget_handle_out_token_ep_disabled(struct dwc2_hsotg_ep *ep) |
2740 |
+ static void dwc2_gadget_handle_nak(struct dwc2_hsotg_ep *hs_ep) |
2741 |
+ { |
2742 |
+ struct dwc2_hsotg *hsotg = hs_ep->parent; |
2743 |
++ struct dwc2_hsotg_req *hs_req; |
2744 |
+ int dir_in = hs_ep->dir_in; |
2745 |
++ u32 ctrl; |
2746 |
+ |
2747 |
+ if (!dir_in || !hs_ep->isochronous) |
2748 |
+ return; |
2749 |
+@@ -2976,13 +2988,29 @@ static void dwc2_gadget_handle_nak(struct dwc2_hsotg_ep *hs_ep) |
2750 |
+ |
2751 |
+ dwc2_writel(hsotg, ctrl, DIEPCTL(hs_ep->index)); |
2752 |
+ } |
2753 |
+- |
2754 |
+- dwc2_hsotg_complete_request(hsotg, hs_ep, |
2755 |
+- get_ep_head(hs_ep), 0); |
2756 |
+ } |
2757 |
+ |
2758 |
+- if (!using_desc_dma(hsotg)) |
2759 |
++ if (using_desc_dma(hsotg)) |
2760 |
++ return; |
2761 |
++ |
2762 |
++ ctrl = dwc2_readl(hsotg, DIEPCTL(hs_ep->index)); |
2763 |
++ if (ctrl & DXEPCTL_EPENA) |
2764 |
++ dwc2_hsotg_ep_stop_xfr(hsotg, hs_ep); |
2765 |
++ else |
2766 |
++ dwc2_hsotg_txfifo_flush(hsotg, hs_ep->fifo_index); |
2767 |
++ |
2768 |
++ while (dwc2_gadget_target_frame_elapsed(hs_ep)) { |
2769 |
++ hs_req = get_ep_head(hs_ep); |
2770 |
++ if (hs_req) |
2771 |
++ dwc2_hsotg_complete_request(hsotg, hs_ep, hs_req, -ENODATA); |
2772 |
++ |
2773 |
+ dwc2_gadget_incr_frame_num(hs_ep); |
2774 |
++ /* Update current frame number value. */ |
2775 |
++ hsotg->frame_number = dwc2_hsotg_read_frameno(hsotg); |
2776 |
++ } |
2777 |
++ |
2778 |
++ if (!hs_ep->req) |
2779 |
++ dwc2_gadget_start_next_request(hs_ep); |
2780 |
+ } |
2781 |
+ |
2782 |
+ /** |
2783 |
+@@ -3038,21 +3066,15 @@ static void dwc2_hsotg_epint(struct dwc2_hsotg *hsotg, unsigned int idx, |
2784 |
+ |
2785 |
+ /* In DDMA handle isochronous requests separately */ |
2786 |
+ if (using_desc_dma(hsotg) && hs_ep->isochronous) { |
2787 |
+- /* XferCompl set along with BNA */ |
2788 |
+- if (!(ints & DXEPINT_BNAINTR)) |
2789 |
+- dwc2_gadget_complete_isoc_request_ddma(hs_ep); |
2790 |
++ dwc2_gadget_complete_isoc_request_ddma(hs_ep); |
2791 |
+ } else if (dir_in) { |
2792 |
+ /* |
2793 |
+ * We get OutDone from the FIFO, so we only |
2794 |
+ * need to look at completing IN requests here |
2795 |
+ * if operating slave mode |
2796 |
+ */ |
2797 |
+- if (hs_ep->isochronous && hs_ep->interval > 1) |
2798 |
+- dwc2_gadget_incr_frame_num(hs_ep); |
2799 |
+- |
2800 |
+- dwc2_hsotg_complete_in(hsotg, hs_ep); |
2801 |
+- if (ints & DXEPINT_NAKINTRPT) |
2802 |
+- ints &= ~DXEPINT_NAKINTRPT; |
2803 |
++ if (!hs_ep->isochronous || !(ints & DXEPINT_NAKINTRPT)) |
2804 |
++ dwc2_hsotg_complete_in(hsotg, hs_ep); |
2805 |
+ |
2806 |
+ if (idx == 0 && !hs_ep->req) |
2807 |
+ dwc2_hsotg_enqueue_setup(hsotg); |
2808 |
+@@ -3061,10 +3083,8 @@ static void dwc2_hsotg_epint(struct dwc2_hsotg *hsotg, unsigned int idx, |
2809 |
+ * We're using DMA, we need to fire an OutDone here |
2810 |
+ * as we ignore the RXFIFO. |
2811 |
+ */ |
2812 |
+- if (hs_ep->isochronous && hs_ep->interval > 1) |
2813 |
+- dwc2_gadget_incr_frame_num(hs_ep); |
2814 |
+- |
2815 |
+- dwc2_hsotg_handle_outdone(hsotg, idx); |
2816 |
++ if (!hs_ep->isochronous || !(ints & DXEPINT_OUTTKNEPDIS)) |
2817 |
++ dwc2_hsotg_handle_outdone(hsotg, idx); |
2818 |
+ } |
2819 |
+ } |
2820 |
+ |
2821 |
+@@ -4083,6 +4103,7 @@ static int dwc2_hsotg_ep_enable(struct usb_ep *ep, |
2822 |
+ mask |= DIEPMSK_NAKMSK; |
2823 |
+ dwc2_writel(hsotg, mask, DIEPMSK); |
2824 |
+ } else { |
2825 |
++ epctrl |= DXEPCTL_SNAK; |
2826 |
+ mask = dwc2_readl(hsotg, DOEPMSK); |
2827 |
+ mask |= DOEPMSK_OUTTKNEPDISMSK; |
2828 |
+ dwc2_writel(hsotg, mask, DOEPMSK); |
2829 |
+diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c |
2830 |
+index bfb72902f3a68..1580d51aea4f7 100644 |
2831 |
+--- a/drivers/usb/dwc3/core.c |
2832 |
++++ b/drivers/usb/dwc3/core.c |
2833 |
+@@ -264,19 +264,6 @@ static int dwc3_core_soft_reset(struct dwc3 *dwc) |
2834 |
+ { |
2835 |
+ u32 reg; |
2836 |
+ int retries = 1000; |
2837 |
+- int ret; |
2838 |
+- |
2839 |
+- usb_phy_init(dwc->usb2_phy); |
2840 |
+- usb_phy_init(dwc->usb3_phy); |
2841 |
+- ret = phy_init(dwc->usb2_generic_phy); |
2842 |
+- if (ret < 0) |
2843 |
+- return ret; |
2844 |
+- |
2845 |
+- ret = phy_init(dwc->usb3_generic_phy); |
2846 |
+- if (ret < 0) { |
2847 |
+- phy_exit(dwc->usb2_generic_phy); |
2848 |
+- return ret; |
2849 |
+- } |
2850 |
+ |
2851 |
+ /* |
2852 |
+ * We're resetting only the device side because, if we're in host mode, |
2853 |
+@@ -310,9 +297,6 @@ static int dwc3_core_soft_reset(struct dwc3 *dwc) |
2854 |
+ udelay(1); |
2855 |
+ } while (--retries); |
2856 |
+ |
2857 |
+- phy_exit(dwc->usb3_generic_phy); |
2858 |
+- phy_exit(dwc->usb2_generic_phy); |
2859 |
+- |
2860 |
+ return -ETIMEDOUT; |
2861 |
+ |
2862 |
+ done: |
2863 |
+@@ -979,9 +963,21 @@ static int dwc3_core_init(struct dwc3 *dwc) |
2864 |
+ dwc->phys_ready = true; |
2865 |
+ } |
2866 |
+ |
2867 |
++ usb_phy_init(dwc->usb2_phy); |
2868 |
++ usb_phy_init(dwc->usb3_phy); |
2869 |
++ ret = phy_init(dwc->usb2_generic_phy); |
2870 |
++ if (ret < 0) |
2871 |
++ goto err0a; |
2872 |
++ |
2873 |
++ ret = phy_init(dwc->usb3_generic_phy); |
2874 |
++ if (ret < 0) { |
2875 |
++ phy_exit(dwc->usb2_generic_phy); |
2876 |
++ goto err0a; |
2877 |
++ } |
2878 |
++ |
2879 |
+ ret = dwc3_core_soft_reset(dwc); |
2880 |
+ if (ret) |
2881 |
+- goto err0a; |
2882 |
++ goto err1; |
2883 |
+ |
2884 |
+ if (hw_mode == DWC3_GHWPARAMS0_MODE_DRD && |
2885 |
+ !DWC3_VER_IS_WITHIN(DWC3, ANY, 194A)) { |
2886 |
+diff --git a/drivers/usb/gadget/udc/r8a66597-udc.c b/drivers/usb/gadget/udc/r8a66597-udc.c |
2887 |
+index 65cae48834545..38e4d6b505a05 100644 |
2888 |
+--- a/drivers/usb/gadget/udc/r8a66597-udc.c |
2889 |
++++ b/drivers/usb/gadget/udc/r8a66597-udc.c |
2890 |
+@@ -1250,7 +1250,7 @@ static void set_feature(struct r8a66597 *r8a66597, struct usb_ctrlrequest *ctrl) |
2891 |
+ do { |
2892 |
+ tmp = r8a66597_read(r8a66597, INTSTS0) & CTSQ; |
2893 |
+ udelay(1); |
2894 |
+- } while (tmp != CS_IDST || timeout-- > 0); |
2895 |
++ } while (tmp != CS_IDST && timeout-- > 0); |
2896 |
+ |
2897 |
+ if (tmp == CS_IDST) |
2898 |
+ r8a66597_bset(r8a66597, |
2899 |
+diff --git a/drivers/usb/host/bcma-hcd.c b/drivers/usb/host/bcma-hcd.c |
2900 |
+index 337b425dd4b04..2df52f75f6b3c 100644 |
2901 |
+--- a/drivers/usb/host/bcma-hcd.c |
2902 |
++++ b/drivers/usb/host/bcma-hcd.c |
2903 |
+@@ -406,12 +406,9 @@ static int bcma_hcd_probe(struct bcma_device *core) |
2904 |
+ return -ENOMEM; |
2905 |
+ usb_dev->core = core; |
2906 |
+ |
2907 |
+- if (core->dev.of_node) { |
2908 |
++ if (core->dev.of_node) |
2909 |
+ usb_dev->gpio_desc = devm_gpiod_get(&core->dev, "vcc", |
2910 |
+ GPIOD_OUT_HIGH); |
2911 |
+- if (IS_ERR(usb_dev->gpio_desc)) |
2912 |
+- return PTR_ERR(usb_dev->gpio_desc); |
2913 |
+- } |
2914 |
+ |
2915 |
+ switch (core->id.id) { |
2916 |
+ case BCMA_CORE_USB20_HOST: |
2917 |
+diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c |
2918 |
+index c51391b45207e..6389dc99bc9a4 100644 |
2919 |
+--- a/drivers/usb/host/xhci.c |
2920 |
++++ b/drivers/usb/host/xhci.c |
2921 |
+@@ -693,6 +693,7 @@ int xhci_run(struct usb_hcd *hcd) |
2922 |
+ if (ret) |
2923 |
+ xhci_free_command(xhci, command); |
2924 |
+ } |
2925 |
++ set_bit(HCD_FLAG_DEFER_RH_REGISTER, &hcd->flags); |
2926 |
+ xhci_dbg_trace(xhci, trace_xhci_dbg_init, |
2927 |
+ "Finished xhci_run for USB2 roothub"); |
2928 |
+ |
2929 |
+diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c |
2930 |
+index c26683a2702b6..0c2afed4131bc 100644 |
2931 |
+--- a/drivers/usb/musb/tusb6010.c |
2932 |
++++ b/drivers/usb/musb/tusb6010.c |
2933 |
+@@ -190,6 +190,7 @@ tusb_fifo_write_unaligned(void __iomem *fifo, const u8 *buf, u16 len) |
2934 |
+ } |
2935 |
+ if (len > 0) { |
2936 |
+ /* Write the rest 1 - 3 bytes to FIFO */ |
2937 |
++ val = 0; |
2938 |
+ memcpy(&val, buf, len); |
2939 |
+ musb_writel(fifo, 0, val); |
2940 |
+ } |
2941 |
+diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c |
2942 |
+index 329fc25f78a44..6d858bdaf33ce 100644 |
2943 |
+--- a/drivers/usb/serial/cp210x.c |
2944 |
++++ b/drivers/usb/serial/cp210x.c |
2945 |
+@@ -237,6 +237,7 @@ static const struct usb_device_id id_table[] = { |
2946 |
+ { USB_DEVICE(0x1FB9, 0x0602) }, /* Lake Shore Model 648 Magnet Power Supply */ |
2947 |
+ { USB_DEVICE(0x1FB9, 0x0700) }, /* Lake Shore Model 737 VSM Controller */ |
2948 |
+ { USB_DEVICE(0x1FB9, 0x0701) }, /* Lake Shore Model 776 Hall Matrix */ |
2949 |
++ { USB_DEVICE(0x2184, 0x0030) }, /* GW Instek GDM-834x Digital Multimeter */ |
2950 |
+ { USB_DEVICE(0x2626, 0xEA60) }, /* Aruba Networks 7xxx USB Serial Console */ |
2951 |
+ { USB_DEVICE(0x3195, 0xF190) }, /* Link Instruments MSO-19 */ |
2952 |
+ { USB_DEVICE(0x3195, 0xF280) }, /* Link Instruments MSO-28 */ |
2953 |
+@@ -260,6 +261,7 @@ struct cp210x_serial_private { |
2954 |
+ speed_t min_speed; |
2955 |
+ speed_t max_speed; |
2956 |
+ bool use_actual_rate; |
2957 |
++ bool no_event_mode; |
2958 |
+ }; |
2959 |
+ |
2960 |
+ enum cp210x_event_state { |
2961 |
+@@ -1331,12 +1333,16 @@ static void cp210x_change_speed(struct tty_struct *tty, |
2962 |
+ |
2963 |
+ static void cp210x_enable_event_mode(struct usb_serial_port *port) |
2964 |
+ { |
2965 |
++ struct cp210x_serial_private *priv = usb_get_serial_data(port->serial); |
2966 |
+ struct cp210x_port_private *port_priv = usb_get_serial_port_data(port); |
2967 |
+ int ret; |
2968 |
+ |
2969 |
+ if (port_priv->event_mode) |
2970 |
+ return; |
2971 |
+ |
2972 |
++ if (priv->no_event_mode) |
2973 |
++ return; |
2974 |
++ |
2975 |
+ port_priv->event_state = ES_DATA; |
2976 |
+ port_priv->event_mode = true; |
2977 |
+ |
2978 |
+@@ -2086,6 +2092,46 @@ static void cp210x_init_max_speed(struct usb_serial *serial) |
2979 |
+ priv->use_actual_rate = use_actual_rate; |
2980 |
+ } |
2981 |
+ |
2982 |
++static void cp2102_determine_quirks(struct usb_serial *serial) |
2983 |
++{ |
2984 |
++ struct cp210x_serial_private *priv = usb_get_serial_data(serial); |
2985 |
++ u8 *buf; |
2986 |
++ int ret; |
2987 |
++ |
2988 |
++ buf = kmalloc(2, GFP_KERNEL); |
2989 |
++ if (!buf) |
2990 |
++ return; |
2991 |
++ /* |
2992 |
++ * Some (possibly counterfeit) CP2102 do not support event-insertion |
2993 |
++ * mode and respond differently to malformed vendor requests. |
2994 |
++ * Specifically, they return one instead of two bytes when sent a |
2995 |
++ * two-byte part-number request. |
2996 |
++ */ |
2997 |
++ ret = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), |
2998 |
++ CP210X_VENDOR_SPECIFIC, REQTYPE_DEVICE_TO_HOST, |
2999 |
++ CP210X_GET_PARTNUM, 0, buf, 2, USB_CTRL_GET_TIMEOUT); |
3000 |
++ if (ret == 1) { |
3001 |
++ dev_dbg(&serial->interface->dev, |
3002 |
++ "device does not support event-insertion mode\n"); |
3003 |
++ priv->no_event_mode = true; |
3004 |
++ } |
3005 |
++ |
3006 |
++ kfree(buf); |
3007 |
++} |
3008 |
++ |
3009 |
++static void cp210x_determine_quirks(struct usb_serial *serial) |
3010 |
++{ |
3011 |
++ struct cp210x_serial_private *priv = usb_get_serial_data(serial); |
3012 |
++ |
3013 |
++ switch (priv->partnum) { |
3014 |
++ case CP210X_PARTNUM_CP2102: |
3015 |
++ cp2102_determine_quirks(serial); |
3016 |
++ break; |
3017 |
++ default: |
3018 |
++ break; |
3019 |
++ } |
3020 |
++} |
3021 |
++ |
3022 |
+ static int cp210x_attach(struct usb_serial *serial) |
3023 |
+ { |
3024 |
+ int result; |
3025 |
+@@ -2106,6 +2152,7 @@ static int cp210x_attach(struct usb_serial *serial) |
3026 |
+ |
3027 |
+ usb_set_serial_data(serial, priv); |
3028 |
+ |
3029 |
++ cp210x_determine_quirks(serial); |
3030 |
+ cp210x_init_max_speed(serial); |
3031 |
+ |
3032 |
+ result = cp210x_gpio_init(serial); |
3033 |
+diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c |
3034 |
+index 30c25ef0dacd2..48a9a0476a453 100644 |
3035 |
+--- a/drivers/usb/serial/mos7840.c |
3036 |
++++ b/drivers/usb/serial/mos7840.c |
3037 |
+@@ -107,7 +107,6 @@ |
3038 |
+ #define BANDB_DEVICE_ID_USOPTL4_2P 0xBC02 |
3039 |
+ #define BANDB_DEVICE_ID_USOPTL4_4 0xAC44 |
3040 |
+ #define BANDB_DEVICE_ID_USOPTL4_4P 0xBC03 |
3041 |
+-#define BANDB_DEVICE_ID_USOPTL2_4 0xAC24 |
3042 |
+ |
3043 |
+ /* Interrupt Routine Defines */ |
3044 |
+ |
3045 |
+@@ -186,7 +185,6 @@ static const struct usb_device_id id_table[] = { |
3046 |
+ { USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_2P) }, |
3047 |
+ { USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_4) }, |
3048 |
+ { USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_4P) }, |
3049 |
+- { USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL2_4) }, |
3050 |
+ {} /* terminating entry */ |
3051 |
+ }; |
3052 |
+ MODULE_DEVICE_TABLE(usb, id_table); |
3053 |
+diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c |
3054 |
+index acb8eec14f689..1e990a8264a53 100644 |
3055 |
+--- a/drivers/usb/serial/option.c |
3056 |
++++ b/drivers/usb/serial/option.c |
3057 |
+@@ -1205,6 +1205,14 @@ static const struct usb_device_id option_ids[] = { |
3058 |
+ .driver_info = NCTRL(0) | RSVD(1) }, |
3059 |
+ { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1056, 0xff), /* Telit FD980 */ |
3060 |
+ .driver_info = NCTRL(2) | RSVD(3) }, |
3061 |
++ { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1060, 0xff), /* Telit LN920 (rmnet) */ |
3062 |
++ .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) }, |
3063 |
++ { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1061, 0xff), /* Telit LN920 (MBIM) */ |
3064 |
++ .driver_info = NCTRL(0) | RSVD(1) }, |
3065 |
++ { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1062, 0xff), /* Telit LN920 (RNDIS) */ |
3066 |
++ .driver_info = NCTRL(2) | RSVD(3) }, |
3067 |
++ { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1063, 0xff), /* Telit LN920 (ECM) */ |
3068 |
++ .driver_info = NCTRL(0) | RSVD(1) }, |
3069 |
+ { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910), |
3070 |
+ .driver_info = NCTRL(0) | RSVD(1) | RSVD(3) }, |
3071 |
+ { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910_DUAL_MODEM), |
3072 |
+@@ -1650,7 +1658,6 @@ static const struct usb_device_id option_ids[] = { |
3073 |
+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0060, 0xff, 0xff, 0xff) }, |
3074 |
+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0070, 0xff, 0xff, 0xff) }, |
3075 |
+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0073, 0xff, 0xff, 0xff) }, |
3076 |
+- { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0094, 0xff, 0xff, 0xff) }, |
3077 |
+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0130, 0xff, 0xff, 0xff), |
3078 |
+ .driver_info = RSVD(1) }, |
3079 |
+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0133, 0xff, 0xff, 0xff), |
3080 |
+@@ -2068,6 +2075,8 @@ static const struct usb_device_id option_ids[] = { |
3081 |
+ .driver_info = RSVD(0) | RSVD(1) | RSVD(6) }, |
3082 |
+ { USB_DEVICE(0x0489, 0xe0b5), /* Foxconn T77W968 ESIM */ |
3083 |
+ .driver_info = RSVD(0) | RSVD(1) | RSVD(6) }, |
3084 |
++ { USB_DEVICE_INTERFACE_CLASS(0x0489, 0xe0db, 0xff), /* Foxconn T99W265 MBIM */ |
3085 |
++ .driver_info = RSVD(3) }, |
3086 |
+ { USB_DEVICE(0x1508, 0x1001), /* Fibocom NL668 (IOT version) */ |
3087 |
+ .driver_info = RSVD(4) | RSVD(5) | RSVD(6) }, |
3088 |
+ { USB_DEVICE(0x2cb7, 0x0104), /* Fibocom NL678 series */ |
3089 |
+diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h |
3090 |
+index efa972be2ee34..c6b3fcf901805 100644 |
3091 |
+--- a/drivers/usb/storage/unusual_devs.h |
3092 |
++++ b/drivers/usb/storage/unusual_devs.h |
3093 |
+@@ -416,9 +416,16 @@ UNUSUAL_DEV( 0x04cb, 0x0100, 0x0000, 0x2210, |
3094 |
+ USB_SC_UFI, USB_PR_DEVICE, NULL, US_FL_FIX_INQUIRY | US_FL_SINGLE_LUN), |
3095 |
+ |
3096 |
+ /* |
3097 |
+- * Reported by Ondrej Zary <linux@××××××××××××××××.org> |
3098 |
++ * Reported by Ondrej Zary <linux@××××.sk> |
3099 |
+ * The device reports one sector more and breaks when that sector is accessed |
3100 |
++ * Firmwares older than 2.6c (the latest one and the only that claims Linux |
3101 |
++ * support) have also broken tag handling |
3102 |
+ */ |
3103 |
++UNUSUAL_DEV( 0x04ce, 0x0002, 0x0000, 0x026b, |
3104 |
++ "ScanLogic", |
3105 |
++ "SL11R-IDE", |
3106 |
++ USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
3107 |
++ US_FL_FIX_CAPACITY | US_FL_BULK_IGNORE_TAG), |
3108 |
+ UNUSUAL_DEV( 0x04ce, 0x0002, 0x026c, 0x026c, |
3109 |
+ "ScanLogic", |
3110 |
+ "SL11R-IDE", |
3111 |
+diff --git a/drivers/usb/storage/unusual_uas.h b/drivers/usb/storage/unusual_uas.h |
3112 |
+index c35a6db993f1b..4051c8cd0cd8a 100644 |
3113 |
+--- a/drivers/usb/storage/unusual_uas.h |
3114 |
++++ b/drivers/usb/storage/unusual_uas.h |
3115 |
+@@ -50,7 +50,7 @@ UNUSUAL_DEV(0x059f, 0x1061, 0x0000, 0x9999, |
3116 |
+ "LaCie", |
3117 |
+ "Rugged USB3-FW", |
3118 |
+ USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
3119 |
+- US_FL_IGNORE_UAS), |
3120 |
++ US_FL_NO_REPORT_OPCODES | US_FL_NO_SAME), |
3121 |
+ |
3122 |
+ /* |
3123 |
+ * Apricorn USB3 dongle sometimes returns "USBSUSBSUSBS" in response to SCSI |
3124 |
+diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c |
3125 |
+index b57b2067ecbfb..15d4b1ef19f83 100644 |
3126 |
+--- a/drivers/xen/balloon.c |
3127 |
++++ b/drivers/xen/balloon.c |
3128 |
+@@ -43,6 +43,8 @@ |
3129 |
+ #include <linux/sched.h> |
3130 |
+ #include <linux/cred.h> |
3131 |
+ #include <linux/errno.h> |
3132 |
++#include <linux/freezer.h> |
3133 |
++#include <linux/kthread.h> |
3134 |
+ #include <linux/mm.h> |
3135 |
+ #include <linux/memblock.h> |
3136 |
+ #include <linux/pagemap.h> |
3137 |
+@@ -115,7 +117,7 @@ static struct ctl_table xen_root[] = { |
3138 |
+ #define EXTENT_ORDER (fls(XEN_PFN_PER_PAGE) - 1) |
3139 |
+ |
3140 |
+ /* |
3141 |
+- * balloon_process() state: |
3142 |
++ * balloon_thread() state: |
3143 |
+ * |
3144 |
+ * BP_DONE: done or nothing to do, |
3145 |
+ * BP_WAIT: wait to be rescheduled, |
3146 |
+@@ -130,6 +132,8 @@ enum bp_state { |
3147 |
+ BP_ECANCELED |
3148 |
+ }; |
3149 |
+ |
3150 |
++/* Main waiting point for xen-balloon thread. */ |
3151 |
++static DECLARE_WAIT_QUEUE_HEAD(balloon_thread_wq); |
3152 |
+ |
3153 |
+ static DEFINE_MUTEX(balloon_mutex); |
3154 |
+ |
3155 |
+@@ -144,10 +148,6 @@ static xen_pfn_t frame_list[PAGE_SIZE / sizeof(xen_pfn_t)]; |
3156 |
+ static LIST_HEAD(ballooned_pages); |
3157 |
+ static DECLARE_WAIT_QUEUE_HEAD(balloon_wq); |
3158 |
+ |
3159 |
+-/* Main work function, always executed in process context. */ |
3160 |
+-static void balloon_process(struct work_struct *work); |
3161 |
+-static DECLARE_DELAYED_WORK(balloon_worker, balloon_process); |
3162 |
+- |
3163 |
+ /* When ballooning out (allocating memory to return to Xen) we don't really |
3164 |
+ want the kernel to try too hard since that can trigger the oom killer. */ |
3165 |
+ #define GFP_BALLOON \ |
3166 |
+@@ -366,7 +366,7 @@ static void xen_online_page(struct page *page, unsigned int order) |
3167 |
+ static int xen_memory_notifier(struct notifier_block *nb, unsigned long val, void *v) |
3168 |
+ { |
3169 |
+ if (val == MEM_ONLINE) |
3170 |
+- schedule_delayed_work(&balloon_worker, 0); |
3171 |
++ wake_up(&balloon_thread_wq); |
3172 |
+ |
3173 |
+ return NOTIFY_OK; |
3174 |
+ } |
3175 |
+@@ -491,18 +491,43 @@ static enum bp_state decrease_reservation(unsigned long nr_pages, gfp_t gfp) |
3176 |
+ } |
3177 |
+ |
3178 |
+ /* |
3179 |
+- * As this is a work item it is guaranteed to run as a single instance only. |
3180 |
++ * Stop waiting if either state is not BP_EAGAIN and ballooning action is |
3181 |
++ * needed, or if the credit has changed while state is BP_EAGAIN. |
3182 |
++ */ |
3183 |
++static bool balloon_thread_cond(enum bp_state state, long credit) |
3184 |
++{ |
3185 |
++ if (state != BP_EAGAIN) |
3186 |
++ credit = 0; |
3187 |
++ |
3188 |
++ return current_credit() != credit || kthread_should_stop(); |
3189 |
++} |
3190 |
++ |
3191 |
++/* |
3192 |
++ * As this is a kthread it is guaranteed to run as a single instance only. |
3193 |
+ * We may of course race updates of the target counts (which are protected |
3194 |
+ * by the balloon lock), or with changes to the Xen hard limit, but we will |
3195 |
+ * recover from these in time. |
3196 |
+ */ |
3197 |
+-static void balloon_process(struct work_struct *work) |
3198 |
++static int balloon_thread(void *unused) |
3199 |
+ { |
3200 |
+ enum bp_state state = BP_DONE; |
3201 |
+ long credit; |
3202 |
++ unsigned long timeout; |
3203 |
++ |
3204 |
++ set_freezable(); |
3205 |
++ for (;;) { |
3206 |
++ if (state == BP_EAGAIN) |
3207 |
++ timeout = balloon_stats.schedule_delay * HZ; |
3208 |
++ else |
3209 |
++ timeout = 3600 * HZ; |
3210 |
++ credit = current_credit(); |
3211 |
+ |
3212 |
++ wait_event_freezable_timeout(balloon_thread_wq, |
3213 |
++ balloon_thread_cond(state, credit), timeout); |
3214 |
++ |
3215 |
++ if (kthread_should_stop()) |
3216 |
++ return 0; |
3217 |
+ |
3218 |
+- do { |
3219 |
+ mutex_lock(&balloon_mutex); |
3220 |
+ |
3221 |
+ credit = current_credit(); |
3222 |
+@@ -529,12 +554,7 @@ static void balloon_process(struct work_struct *work) |
3223 |
+ mutex_unlock(&balloon_mutex); |
3224 |
+ |
3225 |
+ cond_resched(); |
3226 |
+- |
3227 |
+- } while (credit && state == BP_DONE); |
3228 |
+- |
3229 |
+- /* Schedule more work if there is some still to be done. */ |
3230 |
+- if (state == BP_EAGAIN) |
3231 |
+- schedule_delayed_work(&balloon_worker, balloon_stats.schedule_delay * HZ); |
3232 |
++ } |
3233 |
+ } |
3234 |
+ |
3235 |
+ /* Resets the Xen limit, sets new target, and kicks off processing. */ |
3236 |
+@@ -542,7 +562,7 @@ void balloon_set_new_target(unsigned long target) |
3237 |
+ { |
3238 |
+ /* No need for lock. Not read-modify-write updates. */ |
3239 |
+ balloon_stats.target_pages = target; |
3240 |
+- schedule_delayed_work(&balloon_worker, 0); |
3241 |
++ wake_up(&balloon_thread_wq); |
3242 |
+ } |
3243 |
+ EXPORT_SYMBOL_GPL(balloon_set_new_target); |
3244 |
+ |
3245 |
+@@ -647,7 +667,7 @@ void free_xenballooned_pages(int nr_pages, struct page **pages) |
3246 |
+ |
3247 |
+ /* The balloon may be too large now. Shrink it if needed. */ |
3248 |
+ if (current_credit()) |
3249 |
+- schedule_delayed_work(&balloon_worker, 0); |
3250 |
++ wake_up(&balloon_thread_wq); |
3251 |
+ |
3252 |
+ mutex_unlock(&balloon_mutex); |
3253 |
+ } |
3254 |
+@@ -679,6 +699,8 @@ static void __init balloon_add_region(unsigned long start_pfn, |
3255 |
+ |
3256 |
+ static int __init balloon_init(void) |
3257 |
+ { |
3258 |
++ struct task_struct *task; |
3259 |
++ |
3260 |
+ if (!xen_domain()) |
3261 |
+ return -ENODEV; |
3262 |
+ |
3263 |
+@@ -722,6 +744,12 @@ static int __init balloon_init(void) |
3264 |
+ } |
3265 |
+ #endif |
3266 |
+ |
3267 |
++ task = kthread_run(balloon_thread, NULL, "xen-balloon"); |
3268 |
++ if (IS_ERR(task)) { |
3269 |
++ pr_err("xen-balloon thread could not be started, ballooning will not work!\n"); |
3270 |
++ return PTR_ERR(task); |
3271 |
++ } |
3272 |
++ |
3273 |
+ /* Init the xen-balloon driver. */ |
3274 |
+ xen_balloon_init(); |
3275 |
+ |
3276 |
+diff --git a/fs/afs/dir.c b/fs/afs/dir.c |
3277 |
+index 92d7fd7436cb8..262c0ae505af9 100644 |
3278 |
+--- a/fs/afs/dir.c |
3279 |
++++ b/fs/afs/dir.c |
3280 |
+@@ -997,9 +997,9 @@ static struct dentry *afs_lookup(struct inode *dir, struct dentry *dentry, |
3281 |
+ */ |
3282 |
+ static int afs_d_revalidate_rcu(struct dentry *dentry) |
3283 |
+ { |
3284 |
+- struct afs_vnode *dvnode, *vnode; |
3285 |
++ struct afs_vnode *dvnode; |
3286 |
+ struct dentry *parent; |
3287 |
+- struct inode *dir, *inode; |
3288 |
++ struct inode *dir; |
3289 |
+ long dir_version, de_version; |
3290 |
+ |
3291 |
+ _enter("%p", dentry); |
3292 |
+@@ -1029,18 +1029,6 @@ static int afs_d_revalidate_rcu(struct dentry *dentry) |
3293 |
+ return -ECHILD; |
3294 |
+ } |
3295 |
+ |
3296 |
+- /* Check to see if the vnode referred to by the dentry still |
3297 |
+- * has a callback. |
3298 |
+- */ |
3299 |
+- if (d_really_is_positive(dentry)) { |
3300 |
+- inode = d_inode_rcu(dentry); |
3301 |
+- if (inode) { |
3302 |
+- vnode = AFS_FS_I(inode); |
3303 |
+- if (!afs_check_validity(vnode)) |
3304 |
+- return -ECHILD; |
3305 |
+- } |
3306 |
+- } |
3307 |
+- |
3308 |
+ return 1; /* Still valid */ |
3309 |
+ } |
3310 |
+ |
3311 |
+@@ -1076,17 +1064,7 @@ static int afs_d_revalidate(struct dentry *dentry, unsigned int flags) |
3312 |
+ if (IS_ERR(key)) |
3313 |
+ key = NULL; |
3314 |
+ |
3315 |
+- if (d_really_is_positive(dentry)) { |
3316 |
+- inode = d_inode(dentry); |
3317 |
+- if (inode) { |
3318 |
+- vnode = AFS_FS_I(inode); |
3319 |
+- afs_validate(vnode, key); |
3320 |
+- if (test_bit(AFS_VNODE_DELETED, &vnode->flags)) |
3321 |
+- goto out_bad; |
3322 |
+- } |
3323 |
+- } |
3324 |
+- |
3325 |
+- /* lock down the parent dentry so we can peer at it */ |
3326 |
++ /* Hold the parent dentry so we can peer at it */ |
3327 |
+ parent = dget_parent(dentry); |
3328 |
+ dir = AFS_FS_I(d_inode(parent)); |
3329 |
+ |
3330 |
+@@ -1095,7 +1073,7 @@ static int afs_d_revalidate(struct dentry *dentry, unsigned int flags) |
3331 |
+ |
3332 |
+ if (test_bit(AFS_VNODE_DELETED, &dir->flags)) { |
3333 |
+ _debug("%pd: parent dir deleted", dentry); |
3334 |
+- goto out_bad_parent; |
3335 |
++ goto not_found; |
3336 |
+ } |
3337 |
+ |
3338 |
+ /* We only need to invalidate a dentry if the server's copy changed |
3339 |
+@@ -1121,12 +1099,12 @@ static int afs_d_revalidate(struct dentry *dentry, unsigned int flags) |
3340 |
+ case 0: |
3341 |
+ /* the filename maps to something */ |
3342 |
+ if (d_really_is_negative(dentry)) |
3343 |
+- goto out_bad_parent; |
3344 |
++ goto not_found; |
3345 |
+ inode = d_inode(dentry); |
3346 |
+ if (is_bad_inode(inode)) { |
3347 |
+ printk("kAFS: afs_d_revalidate: %pd2 has bad inode\n", |
3348 |
+ dentry); |
3349 |
+- goto out_bad_parent; |
3350 |
++ goto not_found; |
3351 |
+ } |
3352 |
+ |
3353 |
+ vnode = AFS_FS_I(inode); |
3354 |
+@@ -1148,9 +1126,6 @@ static int afs_d_revalidate(struct dentry *dentry, unsigned int flags) |
3355 |
+ dentry, fid.unique, |
3356 |
+ vnode->fid.unique, |
3357 |
+ vnode->vfs_inode.i_generation); |
3358 |
+- write_seqlock(&vnode->cb_lock); |
3359 |
+- set_bit(AFS_VNODE_DELETED, &vnode->flags); |
3360 |
+- write_sequnlock(&vnode->cb_lock); |
3361 |
+ goto not_found; |
3362 |
+ } |
3363 |
+ goto out_valid; |
3364 |
+@@ -1165,7 +1140,7 @@ static int afs_d_revalidate(struct dentry *dentry, unsigned int flags) |
3365 |
+ default: |
3366 |
+ _debug("failed to iterate dir %pd: %d", |
3367 |
+ parent, ret); |
3368 |
+- goto out_bad_parent; |
3369 |
++ goto not_found; |
3370 |
+ } |
3371 |
+ |
3372 |
+ out_valid: |
3373 |
+@@ -1176,16 +1151,9 @@ out_valid_noupdate: |
3374 |
+ _leave(" = 1 [valid]"); |
3375 |
+ return 1; |
3376 |
+ |
3377 |
+- /* the dirent, if it exists, now points to a different vnode */ |
3378 |
+ not_found: |
3379 |
+- spin_lock(&dentry->d_lock); |
3380 |
+- dentry->d_flags |= DCACHE_NFSFS_RENAMED; |
3381 |
+- spin_unlock(&dentry->d_lock); |
3382 |
+- |
3383 |
+-out_bad_parent: |
3384 |
+ _debug("dropping dentry %pd2", dentry); |
3385 |
+ dput(parent); |
3386 |
+-out_bad: |
3387 |
+ key_put(key); |
3388 |
+ |
3389 |
+ _leave(" = 0 [bad]"); |
3390 |
+diff --git a/fs/afs/dir_edit.c b/fs/afs/dir_edit.c |
3391 |
+index 2ffe09abae7fc..3a9cffc081b98 100644 |
3392 |
+--- a/fs/afs/dir_edit.c |
3393 |
++++ b/fs/afs/dir_edit.c |
3394 |
+@@ -264,7 +264,7 @@ void afs_edit_dir_add(struct afs_vnode *vnode, |
3395 |
+ if (b == nr_blocks) { |
3396 |
+ _debug("init %u", b); |
3397 |
+ afs_edit_init_block(meta, block, b); |
3398 |
+- i_size_write(&vnode->vfs_inode, (b + 1) * AFS_DIR_BLOCK_SIZE); |
3399 |
++ afs_set_i_size(vnode, (b + 1) * AFS_DIR_BLOCK_SIZE); |
3400 |
+ } |
3401 |
+ |
3402 |
+ /* Only lower dir pages have a counter in the header. */ |
3403 |
+@@ -297,7 +297,7 @@ void afs_edit_dir_add(struct afs_vnode *vnode, |
3404 |
+ new_directory: |
3405 |
+ afs_edit_init_block(meta, meta, 0); |
3406 |
+ i_size = AFS_DIR_BLOCK_SIZE; |
3407 |
+- i_size_write(&vnode->vfs_inode, i_size); |
3408 |
++ afs_set_i_size(vnode, i_size); |
3409 |
+ slot = AFS_DIR_RESV_BLOCKS0; |
3410 |
+ page = page0; |
3411 |
+ block = meta; |
3412 |
+diff --git a/fs/afs/inode.c b/fs/afs/inode.c |
3413 |
+index ae3016a9fb23c..f81a972bdd294 100644 |
3414 |
+--- a/fs/afs/inode.c |
3415 |
++++ b/fs/afs/inode.c |
3416 |
+@@ -53,16 +53,6 @@ static noinline void dump_vnode(struct afs_vnode *vnode, struct afs_vnode *paren |
3417 |
+ dump_stack(); |
3418 |
+ } |
3419 |
+ |
3420 |
+-/* |
3421 |
+- * Set the file size and block count. Estimate the number of 512 bytes blocks |
3422 |
+- * used, rounded up to nearest 1K for consistency with other AFS clients. |
3423 |
+- */ |
3424 |
+-static void afs_set_i_size(struct afs_vnode *vnode, u64 size) |
3425 |
+-{ |
3426 |
+- i_size_write(&vnode->vfs_inode, size); |
3427 |
+- vnode->vfs_inode.i_blocks = ((size + 1023) >> 10) << 1; |
3428 |
+-} |
3429 |
+- |
3430 |
+ /* |
3431 |
+ * Initialise an inode from the vnode status. |
3432 |
+ */ |
3433 |
+diff --git a/fs/afs/internal.h b/fs/afs/internal.h |
3434 |
+index ffe318ad2e026..dc08a3d9b3a8b 100644 |
3435 |
+--- a/fs/afs/internal.h |
3436 |
++++ b/fs/afs/internal.h |
3437 |
+@@ -1573,6 +1573,16 @@ static inline void afs_update_dentry_version(struct afs_operation *op, |
3438 |
+ (void *)(unsigned long)dir_vp->scb.status.data_version; |
3439 |
+ } |
3440 |
+ |
3441 |
++/* |
3442 |
++ * Set the file size and block count. Estimate the number of 512 bytes blocks |
3443 |
++ * used, rounded up to nearest 1K for consistency with other AFS clients. |
3444 |
++ */ |
3445 |
++static inline void afs_set_i_size(struct afs_vnode *vnode, u64 size) |
3446 |
++{ |
3447 |
++ i_size_write(&vnode->vfs_inode, size); |
3448 |
++ vnode->vfs_inode.i_blocks = ((size + 1023) >> 10) << 1; |
3449 |
++} |
3450 |
++ |
3451 |
+ /* |
3452 |
+ * Check for a conflicting operation on a directory that we just unlinked from. |
3453 |
+ * If someone managed to sneak a link or an unlink in on the file we just |
3454 |
+diff --git a/fs/afs/write.c b/fs/afs/write.c |
3455 |
+index d37b5cfcf28f5..be60cf1103829 100644 |
3456 |
+--- a/fs/afs/write.c |
3457 |
++++ b/fs/afs/write.c |
3458 |
+@@ -184,7 +184,7 @@ int afs_write_end(struct file *file, struct address_space *mapping, |
3459 |
+ write_seqlock(&vnode->cb_lock); |
3460 |
+ i_size = i_size_read(&vnode->vfs_inode); |
3461 |
+ if (maybe_i_size > i_size) |
3462 |
+- i_size_write(&vnode->vfs_inode, maybe_i_size); |
3463 |
++ afs_set_i_size(vnode, maybe_i_size); |
3464 |
+ write_sequnlock(&vnode->cb_lock); |
3465 |
+ } |
3466 |
+ |
3467 |
+diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c |
3468 |
+index 9d33bf0154abf..e65d0fabb83e5 100644 |
3469 |
+--- a/fs/btrfs/raid56.c |
3470 |
++++ b/fs/btrfs/raid56.c |
3471 |
+@@ -1646,7 +1646,8 @@ struct btrfs_plug_cb { |
3472 |
+ /* |
3473 |
+ * rbios on the plug list are sorted for easier merging. |
3474 |
+ */ |
3475 |
+-static int plug_cmp(void *priv, struct list_head *a, struct list_head *b) |
3476 |
++static int plug_cmp(void *priv, const struct list_head *a, |
3477 |
++ const struct list_head *b) |
3478 |
+ { |
3479 |
+ struct btrfs_raid_bio *ra = container_of(a, struct btrfs_raid_bio, |
3480 |
+ plug_list); |
3481 |
+diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c |
3482 |
+index e8347461c8ddd..69ab10c9237fc 100644 |
3483 |
+--- a/fs/btrfs/space-info.c |
3484 |
++++ b/fs/btrfs/space-info.c |
3485 |
+@@ -417,9 +417,10 @@ static void __btrfs_dump_space_info(struct btrfs_fs_info *fs_info, |
3486 |
+ { |
3487 |
+ lockdep_assert_held(&info->lock); |
3488 |
+ |
3489 |
+- btrfs_info(fs_info, "space_info %llu has %llu free, is %sfull", |
3490 |
++ /* The free space could be negative in case of overcommit */ |
3491 |
++ btrfs_info(fs_info, "space_info %llu has %lld free, is %sfull", |
3492 |
+ info->flags, |
3493 |
+- info->total_bytes - btrfs_space_info_used(info, true), |
3494 |
++ (s64)(info->total_bytes - btrfs_space_info_used(info, true)), |
3495 |
+ info->full ? "" : "not "); |
3496 |
+ btrfs_info(fs_info, |
3497 |
+ "space_info total=%llu, used=%llu, pinned=%llu, reserved=%llu, may_use=%llu, readonly=%llu", |
3498 |
+diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c |
3499 |
+index ec25e5eab3499..7bf3936aceda2 100644 |
3500 |
+--- a/fs/btrfs/tree-log.c |
3501 |
++++ b/fs/btrfs/tree-log.c |
3502 |
+@@ -4070,7 +4070,8 @@ static noinline int copy_items(struct btrfs_trans_handle *trans, |
3503 |
+ return ret; |
3504 |
+ } |
3505 |
+ |
3506 |
+-static int extent_cmp(void *priv, struct list_head *a, struct list_head *b) |
3507 |
++static int extent_cmp(void *priv, const struct list_head *a, |
3508 |
++ const struct list_head *b) |
3509 |
+ { |
3510 |
+ struct extent_map *em1, *em2; |
3511 |
+ |
3512 |
+diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c |
3513 |
+index 509811aabb3fd..d8b8764f5bd10 100644 |
3514 |
+--- a/fs/btrfs/volumes.c |
3515 |
++++ b/fs/btrfs/volumes.c |
3516 |
+@@ -1226,7 +1226,8 @@ static int open_fs_devices(struct btrfs_fs_devices *fs_devices, |
3517 |
+ return 0; |
3518 |
+ } |
3519 |
+ |
3520 |
+-static int devid_cmp(void *priv, struct list_head *a, struct list_head *b) |
3521 |
++static int devid_cmp(void *priv, const struct list_head *a, |
3522 |
++ const struct list_head *b) |
3523 |
+ { |
3524 |
+ struct btrfs_device *dev1, *dev2; |
3525 |
+ |
3526 |
+diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c |
3527 |
+index 8ffe8063e42c1..7f5d173760cfc 100644 |
3528 |
+--- a/fs/cifs/connect.c |
3529 |
++++ b/fs/cifs/connect.c |
3530 |
+@@ -3504,9 +3504,10 @@ cifs_match_super(struct super_block *sb, void *data) |
3531 |
+ spin_lock(&cifs_tcp_ses_lock); |
3532 |
+ cifs_sb = CIFS_SB(sb); |
3533 |
+ tlink = cifs_get_tlink(cifs_sb_master_tlink(cifs_sb)); |
3534 |
+- if (IS_ERR(tlink)) { |
3535 |
++ if (tlink == NULL) { |
3536 |
++ /* can not match superblock if tlink were ever null */ |
3537 |
+ spin_unlock(&cifs_tcp_ses_lock); |
3538 |
+- return rc; |
3539 |
++ return 0; |
3540 |
+ } |
3541 |
+ tcon = tlink_tcon(tlink); |
3542 |
+ ses = tcon->ses; |
3543 |
+diff --git a/fs/cifs/file.c b/fs/cifs/file.c |
3544 |
+index f46904a4ead31..67139f9d583f2 100644 |
3545 |
+--- a/fs/cifs/file.c |
3546 |
++++ b/fs/cifs/file.c |
3547 |
+@@ -3039,7 +3039,7 @@ static void collect_uncached_write_data(struct cifs_aio_ctx *ctx) |
3548 |
+ struct cifs_tcon *tcon; |
3549 |
+ struct cifs_sb_info *cifs_sb; |
3550 |
+ struct dentry *dentry = ctx->cfile->dentry; |
3551 |
+- int rc; |
3552 |
++ ssize_t rc; |
3553 |
+ |
3554 |
+ tcon = tlink_tcon(ctx->cfile->tlink); |
3555 |
+ cifs_sb = CIFS_SB(dentry->d_sb); |
3556 |
+diff --git a/fs/ext4/fsmap.c b/fs/ext4/fsmap.c |
3557 |
+index 4c2a9fe300672..4493ef0c715e9 100644 |
3558 |
+--- a/fs/ext4/fsmap.c |
3559 |
++++ b/fs/ext4/fsmap.c |
3560 |
+@@ -354,8 +354,8 @@ static unsigned int ext4_getfsmap_find_sb(struct super_block *sb, |
3561 |
+ |
3562 |
+ /* Compare two fsmap items. */ |
3563 |
+ static int ext4_getfsmap_compare(void *priv, |
3564 |
+- struct list_head *a, |
3565 |
+- struct list_head *b) |
3566 |
++ const struct list_head *a, |
3567 |
++ const struct list_head *b) |
3568 |
+ { |
3569 |
+ struct ext4_fsmap *fa; |
3570 |
+ struct ext4_fsmap *fb; |
3571 |
+diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c |
3572 |
+index cd43c481df4b4..03c3407c8e26f 100644 |
3573 |
+--- a/fs/gfs2/glock.c |
3574 |
++++ b/fs/gfs2/glock.c |
3575 |
+@@ -1744,7 +1744,8 @@ void gfs2_glock_complete(struct gfs2_glock *gl, int ret) |
3576 |
+ spin_unlock(&gl->gl_lockref.lock); |
3577 |
+ } |
3578 |
+ |
3579 |
+-static int glock_cmp(void *priv, struct list_head *a, struct list_head *b) |
3580 |
++static int glock_cmp(void *priv, const struct list_head *a, |
3581 |
++ const struct list_head *b) |
3582 |
+ { |
3583 |
+ struct gfs2_glock *gla, *glb; |
3584 |
+ |
3585 |
+diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c |
3586 |
+index 1955dea999f79..7473b894e3c6c 100644 |
3587 |
+--- a/fs/gfs2/log.c |
3588 |
++++ b/fs/gfs2/log.c |
3589 |
+@@ -605,7 +605,7 @@ void log_flush_wait(struct gfs2_sbd *sdp) |
3590 |
+ } |
3591 |
+ } |
3592 |
+ |
3593 |
+-static int ip_cmp(void *priv, struct list_head *a, struct list_head *b) |
3594 |
++static int ip_cmp(void *priv, const struct list_head *a, const struct list_head *b) |
3595 |
+ { |
3596 |
+ struct gfs2_inode *ipa, *ipb; |
3597 |
+ |
3598 |
+diff --git a/fs/gfs2/lops.c b/fs/gfs2/lops.c |
3599 |
+index 3922b26264f5a..383ac2190ded4 100644 |
3600 |
+--- a/fs/gfs2/lops.c |
3601 |
++++ b/fs/gfs2/lops.c |
3602 |
+@@ -627,7 +627,8 @@ static void gfs2_check_magic(struct buffer_head *bh) |
3603 |
+ kunmap_atomic(kaddr); |
3604 |
+ } |
3605 |
+ |
3606 |
+-static int blocknr_cmp(void *priv, struct list_head *a, struct list_head *b) |
3607 |
++static int blocknr_cmp(void *priv, const struct list_head *a, |
3608 |
++ const struct list_head *b) |
3609 |
+ { |
3610 |
+ struct gfs2_bufdata *bda, *bdb; |
3611 |
+ |
3612 |
+diff --git a/fs/io_uring.c b/fs/io_uring.c |
3613 |
+index a8d07273ddc05..26753d0cb4312 100644 |
3614 |
+--- a/fs/io_uring.c |
3615 |
++++ b/fs/io_uring.c |
3616 |
+@@ -4041,7 +4041,7 @@ static int io_add_buffers(struct io_provide_buf *pbuf, struct io_buffer **head) |
3617 |
+ int i, bid = pbuf->bid; |
3618 |
+ |
3619 |
+ for (i = 0; i < pbuf->nbufs; i++) { |
3620 |
+- buf = kmalloc(sizeof(*buf), GFP_KERNEL); |
3621 |
++ buf = kmalloc(sizeof(*buf), GFP_KERNEL_ACCOUNT); |
3622 |
+ if (!buf) |
3623 |
+ break; |
3624 |
+ |
3625 |
+diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c |
3626 |
+index caed9d98c64aa..cd9f7baa5bb7b 100644 |
3627 |
+--- a/fs/iomap/buffered-io.c |
3628 |
++++ b/fs/iomap/buffered-io.c |
3629 |
+@@ -1155,7 +1155,8 @@ iomap_ioend_try_merge(struct iomap_ioend *ioend, struct list_head *more_ioends, |
3630 |
+ EXPORT_SYMBOL_GPL(iomap_ioend_try_merge); |
3631 |
+ |
3632 |
+ static int |
3633 |
+-iomap_ioend_compare(void *priv, struct list_head *a, struct list_head *b) |
3634 |
++iomap_ioend_compare(void *priv, const struct list_head *a, |
3635 |
++ const struct list_head *b) |
3636 |
+ { |
3637 |
+ struct iomap_ioend *ia = container_of(a, struct iomap_ioend, io_list); |
3638 |
+ struct iomap_ioend *ib = container_of(b, struct iomap_ioend, io_list); |
3639 |
+diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c |
3640 |
+index 8e3a369086dbd..3e06e9a8cf594 100644 |
3641 |
+--- a/fs/ocfs2/dlmglue.c |
3642 |
++++ b/fs/ocfs2/dlmglue.c |
3643 |
+@@ -3933,7 +3933,7 @@ static int ocfs2_data_convert_worker(struct ocfs2_lock_res *lockres, |
3644 |
+ oi = OCFS2_I(inode); |
3645 |
+ oi->ip_dir_lock_gen++; |
3646 |
+ mlog(0, "generation: %u\n", oi->ip_dir_lock_gen); |
3647 |
+- goto out; |
3648 |
++ goto out_forget; |
3649 |
+ } |
3650 |
+ |
3651 |
+ if (!S_ISREG(inode->i_mode)) |
3652 |
+@@ -3964,6 +3964,7 @@ static int ocfs2_data_convert_worker(struct ocfs2_lock_res *lockres, |
3653 |
+ filemap_fdatawait(mapping); |
3654 |
+ } |
3655 |
+ |
3656 |
++out_forget: |
3657 |
+ forget_all_cached_acls(inode); |
3658 |
+ |
3659 |
+ out: |
3660 |
+diff --git a/fs/qnx4/dir.c b/fs/qnx4/dir.c |
3661 |
+index a6ee23aadd283..66645a5a35f30 100644 |
3662 |
+--- a/fs/qnx4/dir.c |
3663 |
++++ b/fs/qnx4/dir.c |
3664 |
+@@ -15,13 +15,48 @@ |
3665 |
+ #include <linux/buffer_head.h> |
3666 |
+ #include "qnx4.h" |
3667 |
+ |
3668 |
++/* |
3669 |
++ * A qnx4 directory entry is an inode entry or link info |
3670 |
++ * depending on the status field in the last byte. The |
3671 |
++ * first byte is where the name start either way, and a |
3672 |
++ * zero means it's empty. |
3673 |
++ * |
3674 |
++ * Also, due to a bug in gcc, we don't want to use the |
3675 |
++ * real (differently sized) name arrays in the inode and |
3676 |
++ * link entries, but always the 'de_name[]' one in the |
3677 |
++ * fake struct entry. |
3678 |
++ * |
3679 |
++ * See |
3680 |
++ * |
3681 |
++ * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99578#c6 |
3682 |
++ * |
3683 |
++ * for details, but basically gcc will take the size of the |
3684 |
++ * 'name' array from one of the used union entries randomly. |
3685 |
++ * |
3686 |
++ * This use of 'de_name[]' (48 bytes) avoids the false positive |
3687 |
++ * warnings that would happen if gcc decides to use 'inode.di_name' |
3688 |
++ * (16 bytes) even when the pointer and size were to come from |
3689 |
++ * 'link.dl_name' (48 bytes). |
3690 |
++ * |
3691 |
++ * In all cases the actual name pointer itself is the same, it's |
3692 |
++ * only the gcc internal 'what is the size of this field' logic |
3693 |
++ * that can get confused. |
3694 |
++ */ |
3695 |
++union qnx4_directory_entry { |
3696 |
++ struct { |
3697 |
++ const char de_name[48]; |
3698 |
++ u8 de_pad[15]; |
3699 |
++ u8 de_status; |
3700 |
++ }; |
3701 |
++ struct qnx4_inode_entry inode; |
3702 |
++ struct qnx4_link_info link; |
3703 |
++}; |
3704 |
++ |
3705 |
+ static int qnx4_readdir(struct file *file, struct dir_context *ctx) |
3706 |
+ { |
3707 |
+ struct inode *inode = file_inode(file); |
3708 |
+ unsigned int offset; |
3709 |
+ struct buffer_head *bh; |
3710 |
+- struct qnx4_inode_entry *de; |
3711 |
+- struct qnx4_link_info *le; |
3712 |
+ unsigned long blknum; |
3713 |
+ int ix, ino; |
3714 |
+ int size; |
3715 |
+@@ -38,27 +73,27 @@ static int qnx4_readdir(struct file *file, struct dir_context *ctx) |
3716 |
+ } |
3717 |
+ ix = (ctx->pos >> QNX4_DIR_ENTRY_SIZE_BITS) % QNX4_INODES_PER_BLOCK; |
3718 |
+ for (; ix < QNX4_INODES_PER_BLOCK; ix++, ctx->pos += QNX4_DIR_ENTRY_SIZE) { |
3719 |
++ union qnx4_directory_entry *de; |
3720 |
++ |
3721 |
+ offset = ix * QNX4_DIR_ENTRY_SIZE; |
3722 |
+- de = (struct qnx4_inode_entry *) (bh->b_data + offset); |
3723 |
+- if (!de->di_fname[0]) |
3724 |
++ de = (union qnx4_directory_entry *) (bh->b_data + offset); |
3725 |
++ |
3726 |
++ if (!de->de_name[0]) |
3727 |
+ continue; |
3728 |
+- if (!(de->di_status & (QNX4_FILE_USED|QNX4_FILE_LINK))) |
3729 |
++ if (!(de->de_status & (QNX4_FILE_USED|QNX4_FILE_LINK))) |
3730 |
+ continue; |
3731 |
+- if (!(de->di_status & QNX4_FILE_LINK)) |
3732 |
+- size = QNX4_SHORT_NAME_MAX; |
3733 |
+- else |
3734 |
+- size = QNX4_NAME_MAX; |
3735 |
+- size = strnlen(de->di_fname, size); |
3736 |
+- QNX4DEBUG((KERN_INFO "qnx4_readdir:%.*s\n", size, de->di_fname)); |
3737 |
+- if (!(de->di_status & QNX4_FILE_LINK)) |
3738 |
++ if (!(de->de_status & QNX4_FILE_LINK)) { |
3739 |
++ size = sizeof(de->inode.di_fname); |
3740 |
+ ino = blknum * QNX4_INODES_PER_BLOCK + ix - 1; |
3741 |
+- else { |
3742 |
+- le = (struct qnx4_link_info*)de; |
3743 |
+- ino = ( le32_to_cpu(le->dl_inode_blk) - 1 ) * |
3744 |
++ } else { |
3745 |
++ size = sizeof(de->link.dl_fname); |
3746 |
++ ino = ( le32_to_cpu(de->link.dl_inode_blk) - 1 ) * |
3747 |
+ QNX4_INODES_PER_BLOCK + |
3748 |
+- le->dl_inode_ndx; |
3749 |
++ de->link.dl_inode_ndx; |
3750 |
+ } |
3751 |
+- if (!dir_emit(ctx, de->di_fname, size, ino, DT_UNKNOWN)) { |
3752 |
++ size = strnlen(de->de_name, size); |
3753 |
++ QNX4DEBUG((KERN_INFO "qnx4_readdir:%.*s\n", size, name)); |
3754 |
++ if (!dir_emit(ctx, de->de_name, size, ino, DT_UNKNOWN)) { |
3755 |
+ brelse(bh); |
3756 |
+ return 0; |
3757 |
+ } |
3758 |
+diff --git a/fs/ubifs/gc.c b/fs/ubifs/gc.c |
3759 |
+index a4aaeea63893e..dc3e26e9ed7b2 100644 |
3760 |
+--- a/fs/ubifs/gc.c |
3761 |
++++ b/fs/ubifs/gc.c |
3762 |
+@@ -102,7 +102,8 @@ static int switch_gc_head(struct ubifs_info *c) |
3763 |
+ * This function compares data nodes @a and @b. Returns %1 if @a has greater |
3764 |
+ * inode or block number, and %-1 otherwise. |
3765 |
+ */ |
3766 |
+-static int data_nodes_cmp(void *priv, struct list_head *a, struct list_head *b) |
3767 |
++static int data_nodes_cmp(void *priv, const struct list_head *a, |
3768 |
++ const struct list_head *b) |
3769 |
+ { |
3770 |
+ ino_t inuma, inumb; |
3771 |
+ struct ubifs_info *c = priv; |
3772 |
+@@ -145,8 +146,8 @@ static int data_nodes_cmp(void *priv, struct list_head *a, struct list_head *b) |
3773 |
+ * first and sorted by length in descending order. Directory entry nodes go |
3774 |
+ * after inode nodes and are sorted in ascending hash valuer order. |
3775 |
+ */ |
3776 |
+-static int nondata_nodes_cmp(void *priv, struct list_head *a, |
3777 |
+- struct list_head *b) |
3778 |
++static int nondata_nodes_cmp(void *priv, const struct list_head *a, |
3779 |
++ const struct list_head *b) |
3780 |
+ { |
3781 |
+ ino_t inuma, inumb; |
3782 |
+ struct ubifs_info *c = priv; |
3783 |
+diff --git a/fs/ubifs/replay.c b/fs/ubifs/replay.c |
3784 |
+index 1c6fc99fca30e..b2f5563d1489b 100644 |
3785 |
+--- a/fs/ubifs/replay.c |
3786 |
++++ b/fs/ubifs/replay.c |
3787 |
+@@ -299,8 +299,8 @@ static int apply_replay_entry(struct ubifs_info *c, struct replay_entry *r) |
3788 |
+ * entries @a and @b by comparing their sequence numer. Returns %1 if @a has |
3789 |
+ * greater sequence number and %-1 otherwise. |
3790 |
+ */ |
3791 |
+-static int replay_entries_cmp(void *priv, struct list_head *a, |
3792 |
+- struct list_head *b) |
3793 |
++static int replay_entries_cmp(void *priv, const struct list_head *a, |
3794 |
++ const struct list_head *b) |
3795 |
+ { |
3796 |
+ struct ubifs_info *c = priv; |
3797 |
+ struct replay_entry *ra, *rb; |
3798 |
+diff --git a/fs/xfs/scrub/bitmap.c b/fs/xfs/scrub/bitmap.c |
3799 |
+index f88694f22d059..813b5f2191138 100644 |
3800 |
+--- a/fs/xfs/scrub/bitmap.c |
3801 |
++++ b/fs/xfs/scrub/bitmap.c |
3802 |
+@@ -63,8 +63,8 @@ xbitmap_init( |
3803 |
+ static int |
3804 |
+ xbitmap_range_cmp( |
3805 |
+ void *priv, |
3806 |
+- struct list_head *a, |
3807 |
+- struct list_head *b) |
3808 |
++ const struct list_head *a, |
3809 |
++ const struct list_head *b) |
3810 |
+ { |
3811 |
+ struct xbitmap_range *ap; |
3812 |
+ struct xbitmap_range *bp; |
3813 |
+diff --git a/fs/xfs/xfs_bmap_item.c b/fs/xfs/xfs_bmap_item.c |
3814 |
+index 9e16a4d0f97cc..984bb480f1774 100644 |
3815 |
+--- a/fs/xfs/xfs_bmap_item.c |
3816 |
++++ b/fs/xfs/xfs_bmap_item.c |
3817 |
+@@ -265,8 +265,8 @@ xfs_trans_log_finish_bmap_update( |
3818 |
+ static int |
3819 |
+ xfs_bmap_update_diff_items( |
3820 |
+ void *priv, |
3821 |
+- struct list_head *a, |
3822 |
+- struct list_head *b) |
3823 |
++ const struct list_head *a, |
3824 |
++ const struct list_head *b) |
3825 |
+ { |
3826 |
+ struct xfs_bmap_intent *ba; |
3827 |
+ struct xfs_bmap_intent *bb; |
3828 |
+diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c |
3829 |
+index 4e4cf91f4f9fe..118819030dbb5 100644 |
3830 |
+--- a/fs/xfs/xfs_buf.c |
3831 |
++++ b/fs/xfs/xfs_buf.c |
3832 |
+@@ -2114,9 +2114,9 @@ xfs_buf_delwri_queue( |
3833 |
+ */ |
3834 |
+ static int |
3835 |
+ xfs_buf_cmp( |
3836 |
+- void *priv, |
3837 |
+- struct list_head *a, |
3838 |
+- struct list_head *b) |
3839 |
++ void *priv, |
3840 |
++ const struct list_head *a, |
3841 |
++ const struct list_head *b) |
3842 |
+ { |
3843 |
+ struct xfs_buf *ap = container_of(a, struct xfs_buf, b_list); |
3844 |
+ struct xfs_buf *bp = container_of(b, struct xfs_buf, b_list); |
3845 |
+diff --git a/fs/xfs/xfs_extent_busy.c b/fs/xfs/xfs_extent_busy.c |
3846 |
+index 3991e59cfd18b..5c2695a42de15 100644 |
3847 |
+--- a/fs/xfs/xfs_extent_busy.c |
3848 |
++++ b/fs/xfs/xfs_extent_busy.c |
3849 |
+@@ -643,8 +643,8 @@ xfs_extent_busy_wait_all( |
3850 |
+ int |
3851 |
+ xfs_extent_busy_ag_cmp( |
3852 |
+ void *priv, |
3853 |
+- struct list_head *l1, |
3854 |
+- struct list_head *l2) |
3855 |
++ const struct list_head *l1, |
3856 |
++ const struct list_head *l2) |
3857 |
+ { |
3858 |
+ struct xfs_extent_busy *b1 = |
3859 |
+ container_of(l1, struct xfs_extent_busy, list); |
3860 |
+diff --git a/fs/xfs/xfs_extent_busy.h b/fs/xfs/xfs_extent_busy.h |
3861 |
+index 990ab38919717..8aea071000923 100644 |
3862 |
+--- a/fs/xfs/xfs_extent_busy.h |
3863 |
++++ b/fs/xfs/xfs_extent_busy.h |
3864 |
+@@ -58,7 +58,8 @@ void |
3865 |
+ xfs_extent_busy_wait_all(struct xfs_mount *mp); |
3866 |
+ |
3867 |
+ int |
3868 |
+-xfs_extent_busy_ag_cmp(void *priv, struct list_head *a, struct list_head *b); |
3869 |
++xfs_extent_busy_ag_cmp(void *priv, const struct list_head *a, |
3870 |
++ const struct list_head *b); |
3871 |
+ |
3872 |
+ static inline void xfs_extent_busy_sort(struct list_head *list) |
3873 |
+ { |
3874 |
+diff --git a/fs/xfs/xfs_extfree_item.c b/fs/xfs/xfs_extfree_item.c |
3875 |
+index 6c11bfc3d452a..5c0395256bd1d 100644 |
3876 |
+--- a/fs/xfs/xfs_extfree_item.c |
3877 |
++++ b/fs/xfs/xfs_extfree_item.c |
3878 |
+@@ -397,8 +397,8 @@ xfs_trans_free_extent( |
3879 |
+ static int |
3880 |
+ xfs_extent_free_diff_items( |
3881 |
+ void *priv, |
3882 |
+- struct list_head *a, |
3883 |
+- struct list_head *b) |
3884 |
++ const struct list_head *a, |
3885 |
++ const struct list_head *b) |
3886 |
+ { |
3887 |
+ struct xfs_mount *mp = priv; |
3888 |
+ struct xfs_extent_free_item *ra; |
3889 |
+diff --git a/fs/xfs/xfs_refcount_item.c b/fs/xfs/xfs_refcount_item.c |
3890 |
+index 7529eb63ce947..0dee316283a90 100644 |
3891 |
+--- a/fs/xfs/xfs_refcount_item.c |
3892 |
++++ b/fs/xfs/xfs_refcount_item.c |
3893 |
+@@ -269,8 +269,8 @@ xfs_trans_log_finish_refcount_update( |
3894 |
+ static int |
3895 |
+ xfs_refcount_update_diff_items( |
3896 |
+ void *priv, |
3897 |
+- struct list_head *a, |
3898 |
+- struct list_head *b) |
3899 |
++ const struct list_head *a, |
3900 |
++ const struct list_head *b) |
3901 |
+ { |
3902 |
+ struct xfs_mount *mp = priv; |
3903 |
+ struct xfs_refcount_intent *ra; |
3904 |
+diff --git a/fs/xfs/xfs_rmap_item.c b/fs/xfs/xfs_rmap_item.c |
3905 |
+index 7adc996ca6e30..20905953fe763 100644 |
3906 |
+--- a/fs/xfs/xfs_rmap_item.c |
3907 |
++++ b/fs/xfs/xfs_rmap_item.c |
3908 |
+@@ -337,8 +337,8 @@ xfs_trans_log_finish_rmap_update( |
3909 |
+ static int |
3910 |
+ xfs_rmap_update_diff_items( |
3911 |
+ void *priv, |
3912 |
+- struct list_head *a, |
3913 |
+- struct list_head *b) |
3914 |
++ const struct list_head *a, |
3915 |
++ const struct list_head *b) |
3916 |
+ { |
3917 |
+ struct xfs_mount *mp = priv; |
3918 |
+ struct xfs_rmap_intent *ra; |
3919 |
+diff --git a/include/linux/compiler.h b/include/linux/compiler.h |
3920 |
+index b8fe0c23cfffb..475d0a3ce059e 100644 |
3921 |
+--- a/include/linux/compiler.h |
3922 |
++++ b/include/linux/compiler.h |
3923 |
+@@ -180,6 +180,8 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val, |
3924 |
+ (typeof(ptr)) (__ptr + (off)); }) |
3925 |
+ #endif |
3926 |
+ |
3927 |
++#define absolute_pointer(val) RELOC_HIDE((void *)(val), 0) |
3928 |
++ |
3929 |
+ #ifndef OPTIMIZER_HIDE_VAR |
3930 |
+ /* Make the optimizer believe the variable can be manipulated arbitrarily. */ |
3931 |
+ #define OPTIMIZER_HIDE_VAR(var) \ |
3932 |
+diff --git a/include/linux/list_sort.h b/include/linux/list_sort.h |
3933 |
+index 20f178c24e9d1..453105f74e050 100644 |
3934 |
+--- a/include/linux/list_sort.h |
3935 |
++++ b/include/linux/list_sort.h |
3936 |
+@@ -6,8 +6,9 @@ |
3937 |
+ |
3938 |
+ struct list_head; |
3939 |
+ |
3940 |
++typedef int __attribute__((nonnull(2,3))) (*list_cmp_func_t)(void *, |
3941 |
++ const struct list_head *, const struct list_head *); |
3942 |
++ |
3943 |
+ __attribute__((nonnull(2,3))) |
3944 |
+-void list_sort(void *priv, struct list_head *head, |
3945 |
+- int (*cmp)(void *priv, struct list_head *a, |
3946 |
+- struct list_head *b)); |
3947 |
++void list_sort(void *priv, struct list_head *head, list_cmp_func_t cmp); |
3948 |
+ #endif |
3949 |
+diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h |
3950 |
+index 3dbb42c637c14..9f05016d823f8 100644 |
3951 |
+--- a/include/linux/usb/hcd.h |
3952 |
++++ b/include/linux/usb/hcd.h |
3953 |
+@@ -124,6 +124,7 @@ struct usb_hcd { |
3954 |
+ #define HCD_FLAG_RH_RUNNING 5 /* root hub is running? */ |
3955 |
+ #define HCD_FLAG_DEAD 6 /* controller has died? */ |
3956 |
+ #define HCD_FLAG_INTF_AUTHORIZED 7 /* authorize interfaces? */ |
3957 |
++#define HCD_FLAG_DEFER_RH_REGISTER 8 /* Defer roothub registration */ |
3958 |
+ |
3959 |
+ /* The flags can be tested using these macros; they are likely to |
3960 |
+ * be slightly faster than test_bit(). |
3961 |
+@@ -134,6 +135,7 @@ struct usb_hcd { |
3962 |
+ #define HCD_WAKEUP_PENDING(hcd) ((hcd)->flags & (1U << HCD_FLAG_WAKEUP_PENDING)) |
3963 |
+ #define HCD_RH_RUNNING(hcd) ((hcd)->flags & (1U << HCD_FLAG_RH_RUNNING)) |
3964 |
+ #define HCD_DEAD(hcd) ((hcd)->flags & (1U << HCD_FLAG_DEAD)) |
3965 |
++#define HCD_DEFER_RH_REGISTER(hcd) ((hcd)->flags & (1U << HCD_FLAG_DEFER_RH_REGISTER)) |
3966 |
+ |
3967 |
+ /* |
3968 |
+ * Specifies if interfaces are authorized by default |
3969 |
+diff --git a/include/trace/events/erofs.h b/include/trace/events/erofs.h |
3970 |
+index bf9806fd13065..db4f2cec83606 100644 |
3971 |
+--- a/include/trace/events/erofs.h |
3972 |
++++ b/include/trace/events/erofs.h |
3973 |
+@@ -35,20 +35,20 @@ TRACE_EVENT(erofs_lookup, |
3974 |
+ TP_STRUCT__entry( |
3975 |
+ __field(dev_t, dev ) |
3976 |
+ __field(erofs_nid_t, nid ) |
3977 |
+- __field(const char *, name ) |
3978 |
++ __string(name, dentry->d_name.name ) |
3979 |
+ __field(unsigned int, flags ) |
3980 |
+ ), |
3981 |
+ |
3982 |
+ TP_fast_assign( |
3983 |
+ __entry->dev = dir->i_sb->s_dev; |
3984 |
+ __entry->nid = EROFS_I(dir)->nid; |
3985 |
+- __entry->name = dentry->d_name.name; |
3986 |
++ __assign_str(name, dentry->d_name.name); |
3987 |
+ __entry->flags = flags; |
3988 |
+ ), |
3989 |
+ |
3990 |
+ TP_printk("dev = (%d,%d), pnid = %llu, name:%s, flags:%x", |
3991 |
+ show_dev_nid(__entry), |
3992 |
+- __entry->name, |
3993 |
++ __get_str(name), |
3994 |
+ __entry->flags) |
3995 |
+ ); |
3996 |
+ |
3997 |
+diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c |
3998 |
+index cba1f86e75cdb..0c26757ea7fbb 100644 |
3999 |
+--- a/kernel/bpf/verifier.c |
4000 |
++++ b/kernel/bpf/verifier.c |
4001 |
+@@ -8822,6 +8822,8 @@ static int check_btf_line(struct bpf_verifier_env *env, |
4002 |
+ nr_linfo = attr->line_info_cnt; |
4003 |
+ if (!nr_linfo) |
4004 |
+ return 0; |
4005 |
++ if (nr_linfo > INT_MAX / sizeof(struct bpf_line_info)) |
4006 |
++ return -EINVAL; |
4007 |
+ |
4008 |
+ rec_size = attr->line_info_rec_size; |
4009 |
+ if (rec_size < MIN_BPF_LINEINFO_SIZE || |
4010 |
+diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c |
4011 |
+index f1022945e3460..b89ff188a6183 100644 |
4012 |
+--- a/kernel/trace/blktrace.c |
4013 |
++++ b/kernel/trace/blktrace.c |
4014 |
+@@ -1670,6 +1670,14 @@ static int blk_trace_remove_queue(struct request_queue *q) |
4015 |
+ if (bt == NULL) |
4016 |
+ return -EINVAL; |
4017 |
+ |
4018 |
++ if (bt->trace_state == Blktrace_running) { |
4019 |
++ bt->trace_state = Blktrace_stopped; |
4020 |
++ spin_lock_irq(&running_trace_lock); |
4021 |
++ list_del_init(&bt->running_list); |
4022 |
++ spin_unlock_irq(&running_trace_lock); |
4023 |
++ relay_flush(bt->rchan); |
4024 |
++ } |
4025 |
++ |
4026 |
+ put_probe_ref(); |
4027 |
+ synchronize_rcu(); |
4028 |
+ blk_trace_free(bt); |
4029 |
+diff --git a/lib/list_sort.c b/lib/list_sort.c |
4030 |
+index 52f0c258c895a..a926d96ffd44d 100644 |
4031 |
+--- a/lib/list_sort.c |
4032 |
++++ b/lib/list_sort.c |
4033 |
+@@ -7,16 +7,13 @@ |
4034 |
+ #include <linux/list_sort.h> |
4035 |
+ #include <linux/list.h> |
4036 |
+ |
4037 |
+-typedef int __attribute__((nonnull(2,3))) (*cmp_func)(void *, |
4038 |
+- struct list_head const *, struct list_head const *); |
4039 |
+- |
4040 |
+ /* |
4041 |
+ * Returns a list organized in an intermediate format suited |
4042 |
+ * to chaining of merge() calls: null-terminated, no reserved or |
4043 |
+ * sentinel head node, "prev" links not maintained. |
4044 |
+ */ |
4045 |
+ __attribute__((nonnull(2,3,4))) |
4046 |
+-static struct list_head *merge(void *priv, cmp_func cmp, |
4047 |
++static struct list_head *merge(void *priv, list_cmp_func_t cmp, |
4048 |
+ struct list_head *a, struct list_head *b) |
4049 |
+ { |
4050 |
+ struct list_head *head, **tail = &head; |
4051 |
+@@ -52,7 +49,7 @@ static struct list_head *merge(void *priv, cmp_func cmp, |
4052 |
+ * throughout. |
4053 |
+ */ |
4054 |
+ __attribute__((nonnull(2,3,4,5))) |
4055 |
+-static void merge_final(void *priv, cmp_func cmp, struct list_head *head, |
4056 |
++static void merge_final(void *priv, list_cmp_func_t cmp, struct list_head *head, |
4057 |
+ struct list_head *a, struct list_head *b) |
4058 |
+ { |
4059 |
+ struct list_head *tail = head; |
4060 |
+@@ -185,9 +182,7 @@ static void merge_final(void *priv, cmp_func cmp, struct list_head *head, |
4061 |
+ * 2^(k+1) - 1 (second merge of case 5 when x == 2^(k-1) - 1). |
4062 |
+ */ |
4063 |
+ __attribute__((nonnull(2,3))) |
4064 |
+-void list_sort(void *priv, struct list_head *head, |
4065 |
+- int (*cmp)(void *priv, struct list_head *a, |
4066 |
+- struct list_head *b)) |
4067 |
++void list_sort(void *priv, struct list_head *head, list_cmp_func_t cmp) |
4068 |
+ { |
4069 |
+ struct list_head *list = head->next, *pending = NULL; |
4070 |
+ size_t count = 0; /* Count of pending */ |
4071 |
+@@ -227,7 +222,7 @@ void list_sort(void *priv, struct list_head *head, |
4072 |
+ if (likely(bits)) { |
4073 |
+ struct list_head *a = *tail, *b = a->prev; |
4074 |
+ |
4075 |
+- a = merge(priv, (cmp_func)cmp, b, a); |
4076 |
++ a = merge(priv, cmp, b, a); |
4077 |
+ /* Install the merged result in place of the inputs */ |
4078 |
+ a->prev = b->prev; |
4079 |
+ *tail = a; |
4080 |
+@@ -249,10 +244,10 @@ void list_sort(void *priv, struct list_head *head, |
4081 |
+ |
4082 |
+ if (!next) |
4083 |
+ break; |
4084 |
+- list = merge(priv, (cmp_func)cmp, pending, list); |
4085 |
++ list = merge(priv, cmp, pending, list); |
4086 |
+ pending = next; |
4087 |
+ } |
4088 |
+ /* The final merge, rebuilding prev links */ |
4089 |
+- merge_final(priv, (cmp_func)cmp, head, pending, list); |
4090 |
++ merge_final(priv, cmp, head, pending, list); |
4091 |
+ } |
4092 |
+ EXPORT_SYMBOL(list_sort); |
4093 |
+diff --git a/lib/test_list_sort.c b/lib/test_list_sort.c |
4094 |
+index 1f017d3b610ee..00daaf23316f4 100644 |
4095 |
+--- a/lib/test_list_sort.c |
4096 |
++++ b/lib/test_list_sort.c |
4097 |
+@@ -56,7 +56,8 @@ static int __init check(struct debug_el *ela, struct debug_el *elb) |
4098 |
+ return 0; |
4099 |
+ } |
4100 |
+ |
4101 |
+-static int __init cmp(void *priv, struct list_head *a, struct list_head *b) |
4102 |
++static int __init cmp(void *priv, const struct list_head *a, |
4103 |
++ const struct list_head *b) |
4104 |
+ { |
4105 |
+ struct debug_el *ela, *elb; |
4106 |
+ |
4107 |
+diff --git a/mm/util.c b/mm/util.c |
4108 |
+index 4ddb6e186dd5c..d5be677718500 100644 |
4109 |
+--- a/mm/util.c |
4110 |
++++ b/mm/util.c |
4111 |
+@@ -756,7 +756,7 @@ int overcommit_policy_handler(struct ctl_table *table, int write, void *buffer, |
4112 |
+ size_t *lenp, loff_t *ppos) |
4113 |
+ { |
4114 |
+ struct ctl_table t; |
4115 |
+- int new_policy; |
4116 |
++ int new_policy = -1; |
4117 |
+ int ret; |
4118 |
+ |
4119 |
+ /* |
4120 |
+@@ -774,7 +774,7 @@ int overcommit_policy_handler(struct ctl_table *table, int write, void *buffer, |
4121 |
+ t = *table; |
4122 |
+ t.data = &new_policy; |
4123 |
+ ret = proc_dointvec_minmax(&t, write, buffer, lenp, ppos); |
4124 |
+- if (ret) |
4125 |
++ if (ret || new_policy == -1) |
4126 |
+ return ret; |
4127 |
+ |
4128 |
+ mm_compute_batch(new_policy); |
4129 |
+diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c |
4130 |
+index 3ada338d7e08b..71c8ef7d40870 100644 |
4131 |
+--- a/net/dsa/dsa2.c |
4132 |
++++ b/net/dsa/dsa2.c |
4133 |
+@@ -459,7 +459,7 @@ static int dsa_switch_setup(struct dsa_switch *ds) |
4134 |
+ devlink_params_publish(ds->devlink); |
4135 |
+ |
4136 |
+ if (!ds->slave_mii_bus && ds->ops->phy_read) { |
4137 |
+- ds->slave_mii_bus = devm_mdiobus_alloc(ds->dev); |
4138 |
++ ds->slave_mii_bus = mdiobus_alloc(); |
4139 |
+ if (!ds->slave_mii_bus) { |
4140 |
+ err = -ENOMEM; |
4141 |
+ goto teardown; |
4142 |
+@@ -469,13 +469,16 @@ static int dsa_switch_setup(struct dsa_switch *ds) |
4143 |
+ |
4144 |
+ err = mdiobus_register(ds->slave_mii_bus); |
4145 |
+ if (err < 0) |
4146 |
+- goto teardown; |
4147 |
++ goto free_slave_mii_bus; |
4148 |
+ } |
4149 |
+ |
4150 |
+ ds->setup = true; |
4151 |
+ |
4152 |
+ return 0; |
4153 |
+ |
4154 |
++free_slave_mii_bus: |
4155 |
++ if (ds->slave_mii_bus && ds->ops->phy_read) |
4156 |
++ mdiobus_free(ds->slave_mii_bus); |
4157 |
+ teardown: |
4158 |
+ if (ds->ops->teardown) |
4159 |
+ ds->ops->teardown(ds); |
4160 |
+@@ -500,8 +503,11 @@ static void dsa_switch_teardown(struct dsa_switch *ds) |
4161 |
+ if (!ds->setup) |
4162 |
+ return; |
4163 |
+ |
4164 |
+- if (ds->slave_mii_bus && ds->ops->phy_read) |
4165 |
++ if (ds->slave_mii_bus && ds->ops->phy_read) { |
4166 |
+ mdiobus_unregister(ds->slave_mii_bus); |
4167 |
++ mdiobus_free(ds->slave_mii_bus); |
4168 |
++ ds->slave_mii_bus = NULL; |
4169 |
++ } |
4170 |
+ |
4171 |
+ dsa_switch_unregister_notifier(ds); |
4172 |
+ |
4173 |
+diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c |
4174 |
+index 1fb79dbde0cb3..e43f1fbac28b6 100644 |
4175 |
+--- a/net/ipv6/ip6_fib.c |
4176 |
++++ b/net/ipv6/ip6_fib.c |
4177 |
+@@ -1376,7 +1376,6 @@ int fib6_add(struct fib6_node *root, struct fib6_info *rt, |
4178 |
+ int err = -ENOMEM; |
4179 |
+ int allow_create = 1; |
4180 |
+ int replace_required = 0; |
4181 |
+- int sernum = fib6_new_sernum(info->nl_net); |
4182 |
+ |
4183 |
+ if (info->nlh) { |
4184 |
+ if (!(info->nlh->nlmsg_flags & NLM_F_CREATE)) |
4185 |
+@@ -1476,7 +1475,7 @@ int fib6_add(struct fib6_node *root, struct fib6_info *rt, |
4186 |
+ if (!err) { |
4187 |
+ if (rt->nh) |
4188 |
+ list_add(&rt->nh_list, &rt->nh->f6i_list); |
4189 |
+- __fib6_update_sernum_upto_root(rt, sernum); |
4190 |
++ __fib6_update_sernum_upto_root(rt, fib6_new_sernum(info->nl_net)); |
4191 |
+ fib6_start_gc(info->nl_net, rt); |
4192 |
+ } |
4193 |
+ |
4194 |
+diff --git a/net/smc/smc_clc.c b/net/smc/smc_clc.c |
4195 |
+index 696d89c2dce4a..5ee5b2ce29a6e 100644 |
4196 |
+--- a/net/smc/smc_clc.c |
4197 |
++++ b/net/smc/smc_clc.c |
4198 |
+@@ -230,7 +230,8 @@ static int smc_clc_prfx_set(struct socket *clcsock, |
4199 |
+ goto out_rel; |
4200 |
+ } |
4201 |
+ /* get address to which the internal TCP socket is bound */ |
4202 |
+- kernel_getsockname(clcsock, (struct sockaddr *)&addrs); |
4203 |
++ if (kernel_getsockname(clcsock, (struct sockaddr *)&addrs) < 0) |
4204 |
++ goto out_rel; |
4205 |
+ /* analyze IP specific data of net_device belonging to TCP socket */ |
4206 |
+ addr6 = (struct sockaddr_in6 *)&addrs; |
4207 |
+ rcu_read_lock(); |
4208 |
+diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c |
4209 |
+index af96f813c0752..c491dd8e67cda 100644 |
4210 |
+--- a/net/smc/smc_core.c |
4211 |
++++ b/net/smc/smc_core.c |
4212 |
+@@ -1089,7 +1089,9 @@ static void smc_conn_abort_work(struct work_struct *work) |
4213 |
+ abort_work); |
4214 |
+ struct smc_sock *smc = container_of(conn, struct smc_sock, conn); |
4215 |
+ |
4216 |
++ lock_sock(&smc->sk); |
4217 |
+ smc_conn_kill(conn, true); |
4218 |
++ release_sock(&smc->sk); |
4219 |
+ sock_put(&smc->sk); /* sock_hold done by schedulers of abort_work */ |
4220 |
+ } |
4221 |
+ |
4222 |
+diff --git a/net/tipc/name_table.c b/net/tipc/name_table.c |
4223 |
+index 2ac33d32edc2b..f6a6acef42235 100644 |
4224 |
+--- a/net/tipc/name_table.c |
4225 |
++++ b/net/tipc/name_table.c |
4226 |
+@@ -381,8 +381,8 @@ static struct publication *tipc_service_remove_publ(struct service_range *sr, |
4227 |
+ * Code reused: time_after32() for the same purpose |
4228 |
+ */ |
4229 |
+ #define publication_after(pa, pb) time_after32((pa)->id, (pb)->id) |
4230 |
+-static int tipc_publ_sort(void *priv, struct list_head *a, |
4231 |
+- struct list_head *b) |
4232 |
++static int tipc_publ_sort(void *priv, const struct list_head *a, |
4233 |
++ const struct list_head *b) |
4234 |
+ { |
4235 |
+ struct publication *pa, *pb; |
4236 |
+ |
4237 |
+diff --git a/tools/testing/selftests/arm64/signal/test_signals.h b/tools/testing/selftests/arm64/signal/test_signals.h |
4238 |
+index f96baf1cef1a9..ebe8694dbef0f 100644 |
4239 |
+--- a/tools/testing/selftests/arm64/signal/test_signals.h |
4240 |
++++ b/tools/testing/selftests/arm64/signal/test_signals.h |
4241 |
+@@ -33,10 +33,12 @@ |
4242 |
+ */ |
4243 |
+ enum { |
4244 |
+ FSSBS_BIT, |
4245 |
++ FSVE_BIT, |
4246 |
+ FMAX_END |
4247 |
+ }; |
4248 |
+ |
4249 |
+ #define FEAT_SSBS (1UL << FSSBS_BIT) |
4250 |
++#define FEAT_SVE (1UL << FSVE_BIT) |
4251 |
+ |
4252 |
+ /* |
4253 |
+ * A descriptor used to describe and configure a test case. |
4254 |
+diff --git a/tools/testing/selftests/arm64/signal/test_signals_utils.c b/tools/testing/selftests/arm64/signal/test_signals_utils.c |
4255 |
+index 2de6e5ed5e258..22722abc9dfa9 100644 |
4256 |
+--- a/tools/testing/selftests/arm64/signal/test_signals_utils.c |
4257 |
++++ b/tools/testing/selftests/arm64/signal/test_signals_utils.c |
4258 |
+@@ -26,6 +26,7 @@ static int sig_copyctx = SIGTRAP; |
4259 |
+ |
4260 |
+ static char const *const feats_names[FMAX_END] = { |
4261 |
+ " SSBS ", |
4262 |
++ " SVE ", |
4263 |
+ }; |
4264 |
+ |
4265 |
+ #define MAX_FEATS_SZ 128 |
4266 |
+@@ -263,16 +264,21 @@ int test_init(struct tdescr *td) |
4267 |
+ */ |
4268 |
+ if (getauxval(AT_HWCAP) & HWCAP_SSBS) |
4269 |
+ td->feats_supported |= FEAT_SSBS; |
4270 |
+- if (feats_ok(td)) |
4271 |
++ if (getauxval(AT_HWCAP) & HWCAP_SVE) |
4272 |
++ td->feats_supported |= FEAT_SVE; |
4273 |
++ if (feats_ok(td)) { |
4274 |
+ fprintf(stderr, |
4275 |
+ "Required Features: [%s] supported\n", |
4276 |
+ feats_to_string(td->feats_required & |
4277 |
+ td->feats_supported)); |
4278 |
+- else |
4279 |
++ } else { |
4280 |
+ fprintf(stderr, |
4281 |
+ "Required Features: [%s] NOT supported\n", |
4282 |
+ feats_to_string(td->feats_required & |
4283 |
+ ~td->feats_supported)); |
4284 |
++ td->result = KSFT_SKIP; |
4285 |
++ return 0; |
4286 |
++ } |
4287 |
+ } |
4288 |
+ |
4289 |
+ /* Perform test specific additional initialization */ |