Contents of /trunk/kernel-magellan/patches-4.5/0103-4.5.4-all-fixes.patch
Parent Directory | Revision Log
Revision 2785 -
(show annotations)
(download)
Fri May 13 07:36:36 2016 UTC (8 years, 4 months ago) by niro
File size: 83599 byte(s)
Fri May 13 07:36:36 2016 UTC (8 years, 4 months ago) by niro
File size: 83599 byte(s)
-linux-4.5.4
1 | diff --git a/Documentation/devicetree/bindings/ata/ahci-platform.txt b/Documentation/devicetree/bindings/ata/ahci-platform.txt |
2 | index c2340eeeb97f..c000832a7fb9 100644 |
3 | --- a/Documentation/devicetree/bindings/ata/ahci-platform.txt |
4 | +++ b/Documentation/devicetree/bindings/ata/ahci-platform.txt |
5 | @@ -30,6 +30,10 @@ Optional properties: |
6 | - target-supply : regulator for SATA target power |
7 | - phys : reference to the SATA PHY node |
8 | - phy-names : must be "sata-phy" |
9 | +- ports-implemented : Mask that indicates which ports that the HBA supports |
10 | + are available for software to use. Useful if PORTS_IMPL |
11 | + is not programmed by the BIOS, which is true with |
12 | + some embedded SOC's. |
13 | |
14 | Required properties when using sub-nodes: |
15 | - #address-cells : number of cells to encode an address |
16 | diff --git a/MAINTAINERS b/MAINTAINERS |
17 | index 5a389bc68e0e..77e4c10b4c06 100644 |
18 | --- a/MAINTAINERS |
19 | +++ b/MAINTAINERS |
20 | @@ -4163,8 +4163,8 @@ F: Documentation/efi-stub.txt |
21 | F: arch/ia64/kernel/efi.c |
22 | F: arch/x86/boot/compressed/eboot.[ch] |
23 | F: arch/x86/include/asm/efi.h |
24 | -F: arch/x86/platform/efi/* |
25 | -F: drivers/firmware/efi/* |
26 | +F: arch/x86/platform/efi/ |
27 | +F: drivers/firmware/efi/ |
28 | F: include/linux/efi*.h |
29 | |
30 | EFI VARIABLE FILESYSTEM |
31 | diff --git a/Makefile b/Makefile |
32 | index 9b56a6c5e36f..d64eade37241 100644 |
33 | --- a/Makefile |
34 | +++ b/Makefile |
35 | @@ -1,6 +1,6 @@ |
36 | VERSION = 4 |
37 | PATCHLEVEL = 5 |
38 | -SUBLEVEL = 3 |
39 | +SUBLEVEL = 4 |
40 | EXTRAVERSION = |
41 | NAME = Blurry Fish Butt |
42 | |
43 | diff --git a/arch/arc/include/asm/io.h b/arch/arc/include/asm/io.h |
44 | index 27b17adea50d..cb69299a492e 100644 |
45 | --- a/arch/arc/include/asm/io.h |
46 | +++ b/arch/arc/include/asm/io.h |
47 | @@ -13,6 +13,15 @@ |
48 | #include <asm/byteorder.h> |
49 | #include <asm/page.h> |
50 | |
51 | +#ifdef CONFIG_ISA_ARCV2 |
52 | +#include <asm/barrier.h> |
53 | +#define __iormb() rmb() |
54 | +#define __iowmb() wmb() |
55 | +#else |
56 | +#define __iormb() do { } while (0) |
57 | +#define __iowmb() do { } while (0) |
58 | +#endif |
59 | + |
60 | extern void __iomem *ioremap(unsigned long physaddr, unsigned long size); |
61 | extern void __iomem *ioremap_prot(phys_addr_t offset, unsigned long size, |
62 | unsigned long flags); |
63 | @@ -22,6 +31,15 @@ extern void iounmap(const void __iomem *addr); |
64 | #define ioremap_wc(phy, sz) ioremap(phy, sz) |
65 | #define ioremap_wt(phy, sz) ioremap(phy, sz) |
66 | |
67 | +/* |
68 | + * io{read,write}{16,32}be() macros |
69 | + */ |
70 | +#define ioread16be(p) ({ u16 __v = be16_to_cpu((__force __be16)__raw_readw(p)); __iormb(); __v; }) |
71 | +#define ioread32be(p) ({ u32 __v = be32_to_cpu((__force __be32)__raw_readl(p)); __iormb(); __v; }) |
72 | + |
73 | +#define iowrite16be(v,p) ({ __iowmb(); __raw_writew((__force u16)cpu_to_be16(v), p); }) |
74 | +#define iowrite32be(v,p) ({ __iowmb(); __raw_writel((__force u32)cpu_to_be32(v), p); }) |
75 | + |
76 | /* Change struct page to physical address */ |
77 | #define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) |
78 | |
79 | @@ -99,15 +117,6 @@ static inline void __raw_writel(u32 w, volatile void __iomem *addr) |
80 | |
81 | } |
82 | |
83 | -#ifdef CONFIG_ISA_ARCV2 |
84 | -#include <asm/barrier.h> |
85 | -#define __iormb() rmb() |
86 | -#define __iowmb() wmb() |
87 | -#else |
88 | -#define __iormb() do { } while (0) |
89 | -#define __iowmb() do { } while (0) |
90 | -#endif |
91 | - |
92 | /* |
93 | * MMIO can also get buffered/optimized in micro-arch, so barriers needed |
94 | * Based on ARM model for the typical use case |
95 | diff --git a/arch/arm/boot/dts/qcom-apq8064.dtsi b/arch/arm/boot/dts/qcom-apq8064.dtsi |
96 | index ed521e85e208..e8bc7e8bedd2 100644 |
97 | --- a/arch/arm/boot/dts/qcom-apq8064.dtsi |
98 | +++ b/arch/arm/boot/dts/qcom-apq8064.dtsi |
99 | @@ -665,7 +665,7 @@ |
100 | }; |
101 | |
102 | sata0: sata@29000000 { |
103 | - compatible = "generic-ahci"; |
104 | + compatible = "qcom,apq8064-ahci", "generic-ahci"; |
105 | status = "disabled"; |
106 | reg = <0x29000000 0x180>; |
107 | interrupts = <GIC_SPI 209 IRQ_TYPE_NONE>; |
108 | @@ -687,6 +687,7 @@ |
109 | |
110 | phys = <&sata_phy0>; |
111 | phy-names = "sata-phy"; |
112 | + ports-implemented = <0x1>; |
113 | }; |
114 | |
115 | /* Temporary fixed regulator */ |
116 | diff --git a/arch/arm/mach-cns3xxx/pcie.c b/arch/arm/mach-cns3xxx/pcie.c |
117 | index 47905a50e075..318394ed5c7a 100644 |
118 | --- a/arch/arm/mach-cns3xxx/pcie.c |
119 | +++ b/arch/arm/mach-cns3xxx/pcie.c |
120 | @@ -220,13 +220,13 @@ static void cns3xxx_write_config(struct cns3xxx_pcie *cnspci, |
121 | u32 mask = (0x1ull << (size * 8)) - 1; |
122 | int shift = (where % 4) * 8; |
123 | |
124 | - v = readl_relaxed(base + (where & 0xffc)); |
125 | + v = readl_relaxed(base); |
126 | |
127 | v &= ~(mask << shift); |
128 | v |= (val & mask) << shift; |
129 | |
130 | - writel_relaxed(v, base + (where & 0xffc)); |
131 | - readl_relaxed(base + (where & 0xffc)); |
132 | + writel_relaxed(v, base); |
133 | + readl_relaxed(base); |
134 | } |
135 | |
136 | static void __init cns3xxx_pcie_hw_init(struct cns3xxx_pcie *cnspci) |
137 | diff --git a/arch/arm/mach-exynos/pm_domains.c b/arch/arm/mach-exynos/pm_domains.c |
138 | index 7c21760f590f..875a2bab64f6 100644 |
139 | --- a/arch/arm/mach-exynos/pm_domains.c |
140 | +++ b/arch/arm/mach-exynos/pm_domains.c |
141 | @@ -92,7 +92,7 @@ static int exynos_pd_power(struct generic_pm_domain *domain, bool power_on) |
142 | if (IS_ERR(pd->clk[i])) |
143 | break; |
144 | |
145 | - if (IS_ERR(pd->clk[i])) |
146 | + if (IS_ERR(pd->pclk[i])) |
147 | continue; /* Skip on first power up */ |
148 | if (clk_set_parent(pd->clk[i], pd->pclk[i])) |
149 | pr_err("%s: error setting parent to clock%d\n", |
150 | diff --git a/arch/arm/mach-socfpga/headsmp.S b/arch/arm/mach-socfpga/headsmp.S |
151 | index 5d94b7a2fb10..c160fa3007e9 100644 |
152 | --- a/arch/arm/mach-socfpga/headsmp.S |
153 | +++ b/arch/arm/mach-socfpga/headsmp.S |
154 | @@ -13,6 +13,7 @@ |
155 | #include <asm/assembler.h> |
156 | |
157 | .arch armv7-a |
158 | + .arm |
159 | |
160 | ENTRY(secondary_trampoline) |
161 | /* CPU1 will always fetch from 0x0 when it is brought out of reset. |
162 | diff --git a/arch/parisc/kernel/syscall.S b/arch/parisc/kernel/syscall.S |
163 | index c976ebfe2269..57b4836b7ecd 100644 |
164 | --- a/arch/parisc/kernel/syscall.S |
165 | +++ b/arch/parisc/kernel/syscall.S |
166 | @@ -344,7 +344,7 @@ tracesys_next: |
167 | #endif |
168 | |
169 | cmpib,COND(=),n -1,%r20,tracesys_exit /* seccomp may have returned -1 */ |
170 | - comiclr,>>= __NR_Linux_syscalls, %r20, %r0 |
171 | + comiclr,>> __NR_Linux_syscalls, %r20, %r0 |
172 | b,n .Ltracesys_nosys |
173 | |
174 | LDREGX %r20(%r19), %r19 |
175 | diff --git a/arch/powerpc/include/asm/word-at-a-time.h b/arch/powerpc/include/asm/word-at-a-time.h |
176 | index e4396a7d0f7c..4afe66aa1400 100644 |
177 | --- a/arch/powerpc/include/asm/word-at-a-time.h |
178 | +++ b/arch/powerpc/include/asm/word-at-a-time.h |
179 | @@ -82,7 +82,7 @@ static inline unsigned long create_zero_mask(unsigned long bits) |
180 | "andc %1,%1,%2\n\t" |
181 | "popcntd %0,%1" |
182 | : "=r" (leading_zero_bits), "=&r" (trailing_zero_bit_mask) |
183 | - : "r" (bits)); |
184 | + : "b" (bits)); |
185 | |
186 | return leading_zero_bits; |
187 | } |
188 | diff --git a/arch/x86/kernel/cpu/mcheck/therm_throt.c b/arch/x86/kernel/cpu/mcheck/therm_throt.c |
189 | index 2c5aaf8c2e2f..05538582a809 100644 |
190 | --- a/arch/x86/kernel/cpu/mcheck/therm_throt.c |
191 | +++ b/arch/x86/kernel/cpu/mcheck/therm_throt.c |
192 | @@ -385,6 +385,9 @@ static void intel_thermal_interrupt(void) |
193 | { |
194 | __u64 msr_val; |
195 | |
196 | + if (static_cpu_has(X86_FEATURE_HWP)) |
197 | + wrmsrl_safe(MSR_HWP_STATUS, 0); |
198 | + |
199 | rdmsrl(MSR_IA32_THERM_STATUS, msr_val); |
200 | |
201 | /* Check for violation of core thermal thresholds*/ |
202 | diff --git a/arch/x86/kernel/sysfb_efi.c b/arch/x86/kernel/sysfb_efi.c |
203 | index b285d4e8c68e..5da924bbf0a0 100644 |
204 | --- a/arch/x86/kernel/sysfb_efi.c |
205 | +++ b/arch/x86/kernel/sysfb_efi.c |
206 | @@ -106,14 +106,24 @@ static int __init efifb_set_system(const struct dmi_system_id *id) |
207 | continue; |
208 | for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) { |
209 | resource_size_t start, end; |
210 | + unsigned long flags; |
211 | + |
212 | + flags = pci_resource_flags(dev, i); |
213 | + if (!(flags & IORESOURCE_MEM)) |
214 | + continue; |
215 | + |
216 | + if (flags & IORESOURCE_UNSET) |
217 | + continue; |
218 | + |
219 | + if (pci_resource_len(dev, i) == 0) |
220 | + continue; |
221 | |
222 | start = pci_resource_start(dev, i); |
223 | - if (start == 0) |
224 | - break; |
225 | end = pci_resource_end(dev, i); |
226 | if (screen_info.lfb_base >= start && |
227 | screen_info.lfb_base < end) { |
228 | found_bar = 1; |
229 | + break; |
230 | } |
231 | } |
232 | } |
233 | diff --git a/arch/x86/kernel/tsc_msr.c b/arch/x86/kernel/tsc_msr.c |
234 | index 92ae6acac8a7..6aa0f4d9eea6 100644 |
235 | --- a/arch/x86/kernel/tsc_msr.c |
236 | +++ b/arch/x86/kernel/tsc_msr.c |
237 | @@ -92,7 +92,7 @@ unsigned long try_msr_calibrate_tsc(void) |
238 | |
239 | if (freq_desc_tables[cpu_index].msr_plat) { |
240 | rdmsr(MSR_PLATFORM_INFO, lo, hi); |
241 | - ratio = (lo >> 8) & 0x1f; |
242 | + ratio = (lo >> 8) & 0xff; |
243 | } else { |
244 | rdmsr(MSR_IA32_PERF_STATUS, lo, hi); |
245 | ratio = (hi >> 8) & 0x1f; |
246 | diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c |
247 | index 6979186dbd4b..9f77943653fb 100644 |
248 | --- a/drivers/acpi/acpi_processor.c |
249 | +++ b/drivers/acpi/acpi_processor.c |
250 | @@ -491,6 +491,58 @@ static void acpi_processor_remove(struct acpi_device *device) |
251 | } |
252 | #endif /* CONFIG_ACPI_HOTPLUG_CPU */ |
253 | |
254 | +#ifdef CONFIG_X86 |
255 | +static bool acpi_hwp_native_thermal_lvt_set; |
256 | +static acpi_status __init acpi_hwp_native_thermal_lvt_osc(acpi_handle handle, |
257 | + u32 lvl, |
258 | + void *context, |
259 | + void **rv) |
260 | +{ |
261 | + u8 sb_uuid_str[] = "4077A616-290C-47BE-9EBD-D87058713953"; |
262 | + u32 capbuf[2]; |
263 | + struct acpi_osc_context osc_context = { |
264 | + .uuid_str = sb_uuid_str, |
265 | + .rev = 1, |
266 | + .cap.length = 8, |
267 | + .cap.pointer = capbuf, |
268 | + }; |
269 | + |
270 | + if (acpi_hwp_native_thermal_lvt_set) |
271 | + return AE_CTRL_TERMINATE; |
272 | + |
273 | + capbuf[0] = 0x0000; |
274 | + capbuf[1] = 0x1000; /* set bit 12 */ |
275 | + |
276 | + if (ACPI_SUCCESS(acpi_run_osc(handle, &osc_context))) { |
277 | + if (osc_context.ret.pointer && osc_context.ret.length > 1) { |
278 | + u32 *capbuf_ret = osc_context.ret.pointer; |
279 | + |
280 | + if (capbuf_ret[1] & 0x1000) { |
281 | + acpi_handle_info(handle, |
282 | + "_OSC native thermal LVT Acked\n"); |
283 | + acpi_hwp_native_thermal_lvt_set = true; |
284 | + } |
285 | + } |
286 | + kfree(osc_context.ret.pointer); |
287 | + } |
288 | + |
289 | + return AE_OK; |
290 | +} |
291 | + |
292 | +void __init acpi_early_processor_osc(void) |
293 | +{ |
294 | + if (boot_cpu_has(X86_FEATURE_HWP)) { |
295 | + acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT, |
296 | + ACPI_UINT32_MAX, |
297 | + acpi_hwp_native_thermal_lvt_osc, |
298 | + NULL, NULL, NULL); |
299 | + acpi_get_devices(ACPI_PROCESSOR_DEVICE_HID, |
300 | + acpi_hwp_native_thermal_lvt_osc, |
301 | + NULL, NULL); |
302 | + } |
303 | +} |
304 | +#endif |
305 | + |
306 | /* |
307 | * The following ACPI IDs are known to be suitable for representing as |
308 | * processor devices. |
309 | diff --git a/drivers/acpi/acpica/dsmethod.c b/drivers/acpi/acpica/dsmethod.c |
310 | index 6a72047aae1c..c3a052d43317 100644 |
311 | --- a/drivers/acpi/acpica/dsmethod.c |
312 | +++ b/drivers/acpi/acpica/dsmethod.c |
313 | @@ -428,6 +428,9 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node, |
314 | obj_desc->method.mutex->mutex. |
315 | original_sync_level = |
316 | obj_desc->method.mutex->mutex.sync_level; |
317 | + |
318 | + obj_desc->method.mutex->mutex.thread_id = |
319 | + acpi_os_get_thread_id(); |
320 | } |
321 | } |
322 | |
323 | diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c |
324 | index 891c42d1cd65..f9081b791b81 100644 |
325 | --- a/drivers/acpi/bus.c |
326 | +++ b/drivers/acpi/bus.c |
327 | @@ -1005,6 +1005,9 @@ static int __init acpi_bus_init(void) |
328 | goto error1; |
329 | } |
330 | |
331 | + /* Set capability bits for _OSC under processor scope */ |
332 | + acpi_early_processor_osc(); |
333 | + |
334 | /* |
335 | * _OSC method may exist in module level code, |
336 | * so it must be run after ACPI_FULL_INITIALIZATION |
337 | diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h |
338 | index 1e6833a5cd44..6f41c73f82bb 100644 |
339 | --- a/drivers/acpi/internal.h |
340 | +++ b/drivers/acpi/internal.h |
341 | @@ -138,6 +138,12 @@ void acpi_early_processor_set_pdc(void); |
342 | static inline void acpi_early_processor_set_pdc(void) {} |
343 | #endif |
344 | |
345 | +#ifdef CONFIG_X86 |
346 | +void acpi_early_processor_osc(void); |
347 | +#else |
348 | +static inline void acpi_early_processor_osc(void) {} |
349 | +#endif |
350 | + |
351 | /* -------------------------------------------------------------------------- |
352 | Embedded Controller |
353 | -------------------------------------------------------------------------- */ |
354 | diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c |
355 | index 04975b851c23..639adb1f8abd 100644 |
356 | --- a/drivers/ata/ahci_platform.c |
357 | +++ b/drivers/ata/ahci_platform.c |
358 | @@ -51,6 +51,9 @@ static int ahci_probe(struct platform_device *pdev) |
359 | if (rc) |
360 | return rc; |
361 | |
362 | + of_property_read_u32(dev->of_node, |
363 | + "ports-implemented", &hpriv->force_port_map); |
364 | + |
365 | if (of_device_is_compatible(dev->of_node, "hisilicon,hisi-ahci")) |
366 | hpriv->flags |= AHCI_HFLAG_NO_FBS | AHCI_HFLAG_NO_NCQ; |
367 | |
368 | diff --git a/drivers/ata/ahci_xgene.c b/drivers/ata/ahci_xgene.c |
369 | index 8e3f7faf00d3..73b19b277138 100644 |
370 | --- a/drivers/ata/ahci_xgene.c |
371 | +++ b/drivers/ata/ahci_xgene.c |
372 | @@ -821,9 +821,9 @@ static int xgene_ahci_probe(struct platform_device *pdev) |
373 | dev_warn(&pdev->dev, "%s: Error reading device info. Assume version1\n", |
374 | __func__); |
375 | version = XGENE_AHCI_V1; |
376 | - } |
377 | - if (info->valid & ACPI_VALID_CID) |
378 | + } else if (info->valid & ACPI_VALID_CID) { |
379 | version = XGENE_AHCI_V2; |
380 | + } |
381 | } |
382 | } |
383 | #endif |
384 | diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c |
385 | index 85ea5142a095..bb050ea26101 100644 |
386 | --- a/drivers/ata/libahci.c |
387 | +++ b/drivers/ata/libahci.c |
388 | @@ -469,6 +469,7 @@ void ahci_save_initial_config(struct device *dev, struct ahci_host_priv *hpriv) |
389 | dev_info(dev, "forcing port_map 0x%x -> 0x%x\n", |
390 | port_map, hpriv->force_port_map); |
391 | port_map = hpriv->force_port_map; |
392 | + hpriv->saved_port_map = port_map; |
393 | } |
394 | |
395 | if (hpriv->mask_port_map) { |
396 | diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c |
397 | index e4c5cc107934..c65d41f4007a 100644 |
398 | --- a/drivers/block/nbd.c |
399 | +++ b/drivers/block/nbd.c |
400 | @@ -618,8 +618,8 @@ static void nbd_request_handler(struct request_queue *q) |
401 | req, req->cmd_type); |
402 | |
403 | if (unlikely(!nbd->sock)) { |
404 | - dev_err(disk_to_dev(nbd->disk), |
405 | - "Attempted send on closed socket\n"); |
406 | + dev_err_ratelimited(disk_to_dev(nbd->disk), |
407 | + "Attempted send on closed socket\n"); |
408 | req->errors++; |
409 | nbd_end_request(nbd, req); |
410 | spin_lock_irq(q->queue_lock); |
411 | diff --git a/drivers/block/null_blk.c b/drivers/block/null_blk.c |
412 | index 64a7b5971b57..cab97593ba54 100644 |
413 | --- a/drivers/block/null_blk.c |
414 | +++ b/drivers/block/null_blk.c |
415 | @@ -742,10 +742,11 @@ static int null_add_dev(void) |
416 | |
417 | add_disk(disk); |
418 | |
419 | +done: |
420 | mutex_lock(&lock); |
421 | list_add_tail(&nullb->list, &nullb_list); |
422 | mutex_unlock(&lock); |
423 | -done: |
424 | + |
425 | return 0; |
426 | |
427 | out_cleanup_lightnvm: |
428 | diff --git a/drivers/clk/bcm/clk-bcm2835-aux.c b/drivers/clk/bcm/clk-bcm2835-aux.c |
429 | index e4f89e28b5ec..3a177ade6e6c 100644 |
430 | --- a/drivers/clk/bcm/clk-bcm2835-aux.c |
431 | +++ b/drivers/clk/bcm/clk-bcm2835-aux.c |
432 | @@ -38,8 +38,8 @@ static int bcm2835_aux_clk_probe(struct platform_device *pdev) |
433 | |
434 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
435 | reg = devm_ioremap_resource(dev, res); |
436 | - if (!reg) |
437 | - return -ENODEV; |
438 | + if (IS_ERR(reg)) |
439 | + return PTR_ERR(reg); |
440 | |
441 | onecell = devm_kmalloc(dev, sizeof(*onecell), GFP_KERNEL); |
442 | if (!onecell) |
443 | diff --git a/drivers/clk/clk-divider.c b/drivers/clk/clk-divider.c |
444 | index ded3ff4b91b9..aa1dacdaa39d 100644 |
445 | --- a/drivers/clk/clk-divider.c |
446 | +++ b/drivers/clk/clk-divider.c |
447 | @@ -423,6 +423,12 @@ const struct clk_ops clk_divider_ops = { |
448 | }; |
449 | EXPORT_SYMBOL_GPL(clk_divider_ops); |
450 | |
451 | +const struct clk_ops clk_divider_ro_ops = { |
452 | + .recalc_rate = clk_divider_recalc_rate, |
453 | + .round_rate = clk_divider_round_rate, |
454 | +}; |
455 | +EXPORT_SYMBOL_GPL(clk_divider_ro_ops); |
456 | + |
457 | static struct clk *_register_divider(struct device *dev, const char *name, |
458 | const char *parent_name, unsigned long flags, |
459 | void __iomem *reg, u8 shift, u8 width, |
460 | @@ -446,7 +452,10 @@ static struct clk *_register_divider(struct device *dev, const char *name, |
461 | return ERR_PTR(-ENOMEM); |
462 | |
463 | init.name = name; |
464 | - init.ops = &clk_divider_ops; |
465 | + if (clk_divider_flags & CLK_DIVIDER_READ_ONLY) |
466 | + init.ops = &clk_divider_ro_ops; |
467 | + else |
468 | + init.ops = &clk_divider_ops; |
469 | init.flags = flags | CLK_IS_BASIC; |
470 | init.parent_names = (parent_name ? &parent_name: NULL); |
471 | init.num_parents = (parent_name ? 1 : 0); |
472 | diff --git a/drivers/clk/clk-xgene.c b/drivers/clk/clk-xgene.c |
473 | index 10224b01b97c..b134a8b15e2c 100644 |
474 | --- a/drivers/clk/clk-xgene.c |
475 | +++ b/drivers/clk/clk-xgene.c |
476 | @@ -351,8 +351,8 @@ static int xgene_clk_set_rate(struct clk_hw *hw, unsigned long rate, |
477 | /* Set new divider */ |
478 | data = xgene_clk_read(pclk->param.divider_reg + |
479 | pclk->param.reg_divider_offset); |
480 | - data &= ~((1 << pclk->param.reg_divider_width) - 1) |
481 | - << pclk->param.reg_divider_shift; |
482 | + data &= ~(((1 << pclk->param.reg_divider_width) - 1) |
483 | + << pclk->param.reg_divider_shift); |
484 | data |= divider; |
485 | xgene_clk_write(data, pclk->param.divider_reg + |
486 | pclk->param.reg_divider_offset); |
487 | diff --git a/drivers/clk/meson/clkc.c b/drivers/clk/meson/clkc.c |
488 | index c83ae1367abc..d920d410b51d 100644 |
489 | --- a/drivers/clk/meson/clkc.c |
490 | +++ b/drivers/clk/meson/clkc.c |
491 | @@ -198,7 +198,7 @@ meson_clk_register_fixed_rate(const struct clk_conf *clk_conf, |
492 | } |
493 | |
494 | void __init meson_clk_register_clks(const struct clk_conf *clk_confs, |
495 | - size_t nr_confs, |
496 | + unsigned int nr_confs, |
497 | void __iomem *clk_base) |
498 | { |
499 | unsigned int i; |
500 | diff --git a/drivers/clk/nxp/clk-lpc18xx-ccu.c b/drivers/clk/nxp/clk-lpc18xx-ccu.c |
501 | index 13aabbb3acbe..558da89555af 100644 |
502 | --- a/drivers/clk/nxp/clk-lpc18xx-ccu.c |
503 | +++ b/drivers/clk/nxp/clk-lpc18xx-ccu.c |
504 | @@ -222,7 +222,7 @@ static void lpc18xx_ccu_register_branch_gate_div(struct lpc18xx_clk_branch *bran |
505 | div->width = 1; |
506 | |
507 | div_hw = &div->hw; |
508 | - div_ops = &clk_divider_ops; |
509 | + div_ops = &clk_divider_ro_ops; |
510 | } |
511 | |
512 | branch->gate.reg = branch->offset + reg_base; |
513 | diff --git a/drivers/clk/qcom/gcc-msm8960.c b/drivers/clk/qcom/gcc-msm8960.c |
514 | index 983dd7dc89a7..0a0c1f533249 100644 |
515 | --- a/drivers/clk/qcom/gcc-msm8960.c |
516 | +++ b/drivers/clk/qcom/gcc-msm8960.c |
517 | @@ -2753,7 +2753,7 @@ static struct clk_rcg ce3_src = { |
518 | }, |
519 | .freq_tbl = clk_tbl_ce3, |
520 | .clkr = { |
521 | - .enable_reg = 0x2c08, |
522 | + .enable_reg = 0x36c0, |
523 | .enable_mask = BIT(7), |
524 | .hw.init = &(struct clk_init_data){ |
525 | .name = "ce3_src", |
526 | @@ -2769,7 +2769,7 @@ static struct clk_branch ce3_core_clk = { |
527 | .halt_reg = 0x2fdc, |
528 | .halt_bit = 5, |
529 | .clkr = { |
530 | - .enable_reg = 0x36c4, |
531 | + .enable_reg = 0x36cc, |
532 | .enable_mask = BIT(4), |
533 | .hw.init = &(struct clk_init_data){ |
534 | .name = "ce3_core_clk", |
535 | diff --git a/drivers/clk/rockchip/clk-rk3228.c b/drivers/clk/rockchip/clk-rk3228.c |
536 | index 981a50205339..97f49aab8d42 100644 |
537 | --- a/drivers/clk/rockchip/clk-rk3228.c |
538 | +++ b/drivers/clk/rockchip/clk-rk3228.c |
539 | @@ -605,13 +605,13 @@ static struct rockchip_clk_branch rk3228_clk_branches[] __initdata = { |
540 | |
541 | /* PD_MMC */ |
542 | MMC(SCLK_SDMMC_DRV, "sdmmc_drv", "sclk_sdmmc", RK3228_SDMMC_CON0, 1), |
543 | - MMC(SCLK_SDMMC_SAMPLE, "sdmmc_sample", "sclk_sdmmc", RK3228_SDMMC_CON1, 1), |
544 | + MMC(SCLK_SDMMC_SAMPLE, "sdmmc_sample", "sclk_sdmmc", RK3228_SDMMC_CON1, 0), |
545 | |
546 | MMC(SCLK_SDIO_DRV, "sdio_drv", "sclk_sdio", RK3228_SDIO_CON0, 1), |
547 | - MMC(SCLK_SDIO_SAMPLE, "sdio_sample", "sclk_sdio", RK3228_SDIO_CON1, 1), |
548 | + MMC(SCLK_SDIO_SAMPLE, "sdio_sample", "sclk_sdio", RK3228_SDIO_CON1, 0), |
549 | |
550 | MMC(SCLK_EMMC_DRV, "emmc_drv", "sclk_emmc", RK3228_EMMC_CON0, 1), |
551 | - MMC(SCLK_EMMC_SAMPLE, "emmc_sample", "sclk_emmc", RK3228_EMMC_CON1, 1), |
552 | + MMC(SCLK_EMMC_SAMPLE, "emmc_sample", "sclk_emmc", RK3228_EMMC_CON1, 0), |
553 | }; |
554 | |
555 | static const char *const rk3228_critical_clocks[] __initconst = { |
556 | diff --git a/drivers/clk/rockchip/clk.c b/drivers/clk/rockchip/clk.c |
557 | index d9a0b5d4d47f..226af5720c9e 100644 |
558 | --- a/drivers/clk/rockchip/clk.c |
559 | +++ b/drivers/clk/rockchip/clk.c |
560 | @@ -70,7 +70,7 @@ static struct clk *rockchip_clk_register_branch(const char *name, |
561 | if (gate_offset >= 0) { |
562 | gate = kzalloc(sizeof(*gate), GFP_KERNEL); |
563 | if (!gate) |
564 | - return ERR_PTR(-ENOMEM); |
565 | + goto err_gate; |
566 | |
567 | gate->flags = gate_flags; |
568 | gate->reg = base + gate_offset; |
569 | @@ -82,7 +82,7 @@ static struct clk *rockchip_clk_register_branch(const char *name, |
570 | if (div_width > 0) { |
571 | div = kzalloc(sizeof(*div), GFP_KERNEL); |
572 | if (!div) |
573 | - return ERR_PTR(-ENOMEM); |
574 | + goto err_div; |
575 | |
576 | div->flags = div_flags; |
577 | div->reg = base + muxdiv_offset; |
578 | @@ -90,7 +90,9 @@ static struct clk *rockchip_clk_register_branch(const char *name, |
579 | div->width = div_width; |
580 | div->lock = lock; |
581 | div->table = div_table; |
582 | - div_ops = &clk_divider_ops; |
583 | + div_ops = (div_flags & CLK_DIVIDER_READ_ONLY) |
584 | + ? &clk_divider_ro_ops |
585 | + : &clk_divider_ops; |
586 | } |
587 | |
588 | clk = clk_register_composite(NULL, name, parent_names, num_parents, |
589 | @@ -100,6 +102,11 @@ static struct clk *rockchip_clk_register_branch(const char *name, |
590 | flags); |
591 | |
592 | return clk; |
593 | +err_div: |
594 | + kfree(gate); |
595 | +err_gate: |
596 | + kfree(mux); |
597 | + return ERR_PTR(-ENOMEM); |
598 | } |
599 | |
600 | struct rockchip_clk_frac { |
601 | diff --git a/drivers/clk/sunxi/clk-sun8i-apb0.c b/drivers/clk/sunxi/clk-sun8i-apb0.c |
602 | index 7ba61103a6f5..2ea61debffc1 100644 |
603 | --- a/drivers/clk/sunxi/clk-sun8i-apb0.c |
604 | +++ b/drivers/clk/sunxi/clk-sun8i-apb0.c |
605 | @@ -36,7 +36,7 @@ static struct clk *sun8i_a23_apb0_register(struct device_node *node, |
606 | |
607 | /* The A23 APB0 clock is a standard 2 bit wide divider clock */ |
608 | clk = clk_register_divider(NULL, clk_name, clk_parent, 0, reg, |
609 | - 0, 2, CLK_DIVIDER_POWER_OF_TWO, NULL); |
610 | + 0, 2, 0, NULL); |
611 | if (IS_ERR(clk)) |
612 | return clk; |
613 | |
614 | diff --git a/drivers/clk/versatile/clk-sp810.c b/drivers/clk/versatile/clk-sp810.c |
615 | index e78755e0ef78..1fe1e8d970cf 100644 |
616 | --- a/drivers/clk/versatile/clk-sp810.c |
617 | +++ b/drivers/clk/versatile/clk-sp810.c |
618 | @@ -92,6 +92,7 @@ static void __init clk_sp810_of_setup(struct device_node *node) |
619 | int num = ARRAY_SIZE(parent_names); |
620 | char name[12]; |
621 | struct clk_init_data init; |
622 | + static int instance; |
623 | int i; |
624 | bool deprecated; |
625 | |
626 | @@ -117,7 +118,7 @@ static void __init clk_sp810_of_setup(struct device_node *node) |
627 | deprecated = !of_find_property(node, "assigned-clock-parents", NULL); |
628 | |
629 | for (i = 0; i < ARRAY_SIZE(sp810->timerclken); i++) { |
630 | - snprintf(name, ARRAY_SIZE(name), "timerclken%d", i); |
631 | + snprintf(name, sizeof(name), "sp810_%d_%d", instance, i); |
632 | |
633 | sp810->timerclken[i].sp810 = sp810; |
634 | sp810->timerclken[i].channel = i; |
635 | @@ -138,5 +139,6 @@ static void __init clk_sp810_of_setup(struct device_node *node) |
636 | } |
637 | |
638 | of_clk_add_provider(node, clk_sp810_timerclken_of_get, sp810); |
639 | + instance++; |
640 | } |
641 | CLK_OF_DECLARE(sp810, "arm,sp810", clk_sp810_of_setup); |
642 | diff --git a/drivers/clocksource/tango_xtal.c b/drivers/clocksource/tango_xtal.c |
643 | index 2bcecafdeaea..c407c47a3232 100644 |
644 | --- a/drivers/clocksource/tango_xtal.c |
645 | +++ b/drivers/clocksource/tango_xtal.c |
646 | @@ -42,7 +42,7 @@ static void __init tango_clocksource_init(struct device_node *np) |
647 | |
648 | ret = clocksource_mmio_init(xtal_in_cnt, "tango-xtal", xtal_freq, 350, |
649 | 32, clocksource_mmio_readl_up); |
650 | - if (!ret) { |
651 | + if (ret) { |
652 | pr_err("%s: registration failed\n", np->full_name); |
653 | return; |
654 | } |
655 | diff --git a/drivers/cpufreq/sti-cpufreq.c b/drivers/cpufreq/sti-cpufreq.c |
656 | index a9c659f58974..04042038ec4b 100644 |
657 | --- a/drivers/cpufreq/sti-cpufreq.c |
658 | +++ b/drivers/cpufreq/sti-cpufreq.c |
659 | @@ -259,6 +259,10 @@ static int sti_cpufreq_init(void) |
660 | { |
661 | int ret; |
662 | |
663 | + if ((!of_machine_is_compatible("st,stih407")) && |
664 | + (!of_machine_is_compatible("st,stih410"))) |
665 | + return -ENODEV; |
666 | + |
667 | ddata.cpu = get_cpu_device(0); |
668 | if (!ddata.cpu) { |
669 | dev_err(ddata.cpu, "Failed to get device for CPU0\n"); |
670 | diff --git a/drivers/cpuidle/cpuidle-arm.c b/drivers/cpuidle/cpuidle-arm.c |
671 | index 545069d5fdfb..e342565e8715 100644 |
672 | --- a/drivers/cpuidle/cpuidle-arm.c |
673 | +++ b/drivers/cpuidle/cpuidle-arm.c |
674 | @@ -50,7 +50,7 @@ static int arm_enter_idle_state(struct cpuidle_device *dev, |
675 | * call the CPU ops suspend protocol with idle index as a |
676 | * parameter. |
677 | */ |
678 | - arm_cpuidle_suspend(idx); |
679 | + ret = arm_cpuidle_suspend(idx); |
680 | |
681 | cpu_pm_exit(); |
682 | } |
683 | diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c |
684 | index 540cbc88c7a2..cc4d9bd0839e 100644 |
685 | --- a/drivers/gpio/gpiolib-acpi.c |
686 | +++ b/drivers/gpio/gpiolib-acpi.c |
687 | @@ -977,7 +977,7 @@ bool acpi_can_fallback_to_crs(struct acpi_device *adev, const char *con_id) |
688 | lookup = kmalloc(sizeof(*lookup), GFP_KERNEL); |
689 | if (lookup) { |
690 | lookup->adev = adev; |
691 | - lookup->con_id = con_id; |
692 | + lookup->con_id = kstrdup(con_id, GFP_KERNEL); |
693 | list_add_tail(&lookup->node, &acpi_crs_lookup_list); |
694 | } |
695 | } |
696 | diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c |
697 | index b8fbbd7699e4..73628c7599e7 100644 |
698 | --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c |
699 | +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c |
700 | @@ -540,6 +540,7 @@ int amdgpu_bo_set_metadata (struct amdgpu_bo *bo, void *metadata, |
701 | if (!metadata_size) { |
702 | if (bo->metadata_size) { |
703 | kfree(bo->metadata); |
704 | + bo->metadata = NULL; |
705 | bo->metadata_size = 0; |
706 | } |
707 | return 0; |
708 | diff --git a/drivers/gpu/drm/amd/amdgpu/atombios_encoders.c b/drivers/gpu/drm/amd/amdgpu/atombios_encoders.c |
709 | index 1e0bba29e167..1cd6de575305 100644 |
710 | --- a/drivers/gpu/drm/amd/amdgpu/atombios_encoders.c |
711 | +++ b/drivers/gpu/drm/amd/amdgpu/atombios_encoders.c |
712 | @@ -298,6 +298,10 @@ bool amdgpu_atombios_encoder_mode_fixup(struct drm_encoder *encoder, |
713 | && (mode->crtc_vsync_start < (mode->crtc_vdisplay + 2))) |
714 | adjusted_mode->crtc_vsync_start = adjusted_mode->crtc_vdisplay + 2; |
715 | |
716 | + /* vertical FP must be at least 1 */ |
717 | + if (mode->crtc_vsync_start == mode->crtc_vdisplay) |
718 | + adjusted_mode->crtc_vsync_start++; |
719 | + |
720 | /* get the native mode for scaling */ |
721 | if (amdgpu_encoder->active_device & (ATOM_DEVICE_LCD_SUPPORT)) |
722 | amdgpu_panel_mode_fixup(encoder, adjusted_mode); |
723 | diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c |
724 | index f357058c74d9..2e832fa07e09 100644 |
725 | --- a/drivers/gpu/drm/i915/i915_drv.c |
726 | +++ b/drivers/gpu/drm/i915/i915_drv.c |
727 | @@ -797,7 +797,7 @@ static int i915_drm_resume(struct drm_device *dev) |
728 | static int i915_drm_resume_early(struct drm_device *dev) |
729 | { |
730 | struct drm_i915_private *dev_priv = dev->dev_private; |
731 | - int ret = 0; |
732 | + int ret; |
733 | |
734 | /* |
735 | * We have a resume ordering issue with the snd-hda driver also |
736 | @@ -808,6 +808,36 @@ static int i915_drm_resume_early(struct drm_device *dev) |
737 | * FIXME: This should be solved with a special hdmi sink device or |
738 | * similar so that power domains can be employed. |
739 | */ |
740 | + |
741 | + /* |
742 | + * Note that we need to set the power state explicitly, since we |
743 | + * powered off the device during freeze and the PCI core won't power |
744 | + * it back up for us during thaw. Powering off the device during |
745 | + * freeze is not a hard requirement though, and during the |
746 | + * suspend/resume phases the PCI core makes sure we get here with the |
747 | + * device powered on. So in case we change our freeze logic and keep |
748 | + * the device powered we can also remove the following set power state |
749 | + * call. |
750 | + */ |
751 | + ret = pci_set_power_state(dev->pdev, PCI_D0); |
752 | + if (ret) { |
753 | + DRM_ERROR("failed to set PCI D0 power state (%d)\n", ret); |
754 | + goto out; |
755 | + } |
756 | + |
757 | + /* |
758 | + * Note that pci_enable_device() first enables any parent bridge |
759 | + * device and only then sets the power state for this device. The |
760 | + * bridge enabling is a nop though, since bridge devices are resumed |
761 | + * first. The order of enabling power and enabling the device is |
762 | + * imposed by the PCI core as described above, so here we preserve the |
763 | + * same order for the freeze/thaw phases. |
764 | + * |
765 | + * TODO: eventually we should remove pci_disable_device() / |
766 | + * pci_enable_enable_device() from suspend/resume. Due to how they |
767 | + * depend on the device enable refcount we can't anyway depend on them |
768 | + * disabling/enabling the device. |
769 | + */ |
770 | if (pci_enable_device(dev->pdev)) { |
771 | ret = -EIO; |
772 | goto out; |
773 | diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h |
774 | index 4897728713f6..9b6737c85acb 100644 |
775 | --- a/drivers/gpu/drm/i915/i915_reg.h |
776 | +++ b/drivers/gpu/drm/i915/i915_reg.h |
777 | @@ -2898,7 +2898,14 @@ enum skl_disp_power_wells { |
778 | #define GEN6_RP_STATE_CAP _MMIO(MCHBAR_MIRROR_BASE_SNB + 0x5998) |
779 | #define BXT_RP_STATE_CAP _MMIO(0x138170) |
780 | |
781 | -#define INTERVAL_1_28_US(us) (((us) * 100) >> 7) |
782 | +/* |
783 | + * Make these a multiple of magic 25 to avoid SNB (eg. Dell XPS |
784 | + * 8300) freezing up around GPU hangs. Looks as if even |
785 | + * scheduling/timer interrupts start misbehaving if the RPS |
786 | + * EI/thresholds are "bad", leading to a very sluggish or even |
787 | + * frozen machine. |
788 | + */ |
789 | +#define INTERVAL_1_28_US(us) roundup(((us) * 100) >> 7, 25) |
790 | #define INTERVAL_1_33_US(us) (((us) * 3) >> 2) |
791 | #define INTERVAL_0_833_US(us) (((us) * 6) / 5) |
792 | #define GT_INTERVAL_FROM_US(dev_priv, us) (IS_GEN9(dev_priv) ? \ |
793 | diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c |
794 | index 084d5586585d..33b8e0a2b3fd 100644 |
795 | --- a/drivers/gpu/drm/i915/intel_ddi.c |
796 | +++ b/drivers/gpu/drm/i915/intel_ddi.c |
797 | @@ -464,9 +464,17 @@ static void intel_prepare_ddi_buffers(struct drm_device *dev, enum port port, |
798 | } else if (IS_BROADWELL(dev)) { |
799 | ddi_translations_fdi = bdw_ddi_translations_fdi; |
800 | ddi_translations_dp = bdw_ddi_translations_dp; |
801 | - ddi_translations_edp = bdw_ddi_translations_edp; |
802 | + |
803 | + if (dev_priv->edp_low_vswing) { |
804 | + ddi_translations_edp = bdw_ddi_translations_edp; |
805 | + n_edp_entries = ARRAY_SIZE(bdw_ddi_translations_edp); |
806 | + } else { |
807 | + ddi_translations_edp = bdw_ddi_translations_dp; |
808 | + n_edp_entries = ARRAY_SIZE(bdw_ddi_translations_dp); |
809 | + } |
810 | + |
811 | ddi_translations_hdmi = bdw_ddi_translations_hdmi; |
812 | - n_edp_entries = ARRAY_SIZE(bdw_ddi_translations_edp); |
813 | + |
814 | n_dp_entries = ARRAY_SIZE(bdw_ddi_translations_dp); |
815 | n_hdmi_entries = ARRAY_SIZE(bdw_ddi_translations_hdmi); |
816 | hdmi_default_entry = 7; |
817 | @@ -3260,12 +3268,6 @@ void intel_ddi_get_config(struct intel_encoder *encoder, |
818 | intel_ddi_clock_get(encoder, pipe_config); |
819 | } |
820 | |
821 | -static void intel_ddi_destroy(struct drm_encoder *encoder) |
822 | -{ |
823 | - /* HDMI has nothing special to destroy, so we can go with this. */ |
824 | - intel_dp_encoder_destroy(encoder); |
825 | -} |
826 | - |
827 | static bool intel_ddi_compute_config(struct intel_encoder *encoder, |
828 | struct intel_crtc_state *pipe_config) |
829 | { |
830 | @@ -3284,7 +3286,8 @@ static bool intel_ddi_compute_config(struct intel_encoder *encoder, |
831 | } |
832 | |
833 | static const struct drm_encoder_funcs intel_ddi_funcs = { |
834 | - .destroy = intel_ddi_destroy, |
835 | + .reset = intel_dp_encoder_reset, |
836 | + .destroy = intel_dp_encoder_destroy, |
837 | }; |
838 | |
839 | static struct intel_connector * |
840 | @@ -3356,6 +3359,7 @@ void intel_ddi_init(struct drm_device *dev, enum port port) |
841 | intel_encoder->post_disable = intel_ddi_post_disable; |
842 | intel_encoder->get_hw_state = intel_ddi_get_hw_state; |
843 | intel_encoder->get_config = intel_ddi_get_config; |
844 | + intel_encoder->suspend = intel_dp_encoder_suspend; |
845 | |
846 | intel_dig_port->port = port; |
847 | intel_dig_port->saved_port_bits = I915_READ(DDI_BUF_CTL(port)) & |
848 | diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c |
849 | index a9c35134f2e2..c023a04c44d0 100644 |
850 | --- a/drivers/gpu/drm/i915/intel_display.c |
851 | +++ b/drivers/gpu/drm/i915/intel_display.c |
852 | @@ -13429,6 +13429,9 @@ static int intel_atomic_prepare_commit(struct drm_device *dev, |
853 | } |
854 | |
855 | for_each_crtc_in_state(state, crtc, crtc_state, i) { |
856 | + if (state->legacy_cursor_update) |
857 | + continue; |
858 | + |
859 | ret = intel_crtc_wait_for_pending_flips(crtc); |
860 | if (ret) |
861 | return ret; |
862 | diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c |
863 | index cdc2c15873dc..3cd4996c791c 100644 |
864 | --- a/drivers/gpu/drm/i915/intel_dp.c |
865 | +++ b/drivers/gpu/drm/i915/intel_dp.c |
866 | @@ -4905,7 +4905,7 @@ void intel_dp_encoder_destroy(struct drm_encoder *encoder) |
867 | kfree(intel_dig_port); |
868 | } |
869 | |
870 | -static void intel_dp_encoder_suspend(struct intel_encoder *intel_encoder) |
871 | +void intel_dp_encoder_suspend(struct intel_encoder *intel_encoder) |
872 | { |
873 | struct intel_dp *intel_dp = enc_to_intel_dp(&intel_encoder->base); |
874 | |
875 | @@ -4947,7 +4947,7 @@ static void intel_edp_panel_vdd_sanitize(struct intel_dp *intel_dp) |
876 | edp_panel_vdd_schedule_off(intel_dp); |
877 | } |
878 | |
879 | -static void intel_dp_encoder_reset(struct drm_encoder *encoder) |
880 | +void intel_dp_encoder_reset(struct drm_encoder *encoder) |
881 | { |
882 | struct intel_dp *intel_dp; |
883 | |
884 | diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h |
885 | index df7f3cb66056..3ce3bee368fe 100644 |
886 | --- a/drivers/gpu/drm/i915/intel_drv.h |
887 | +++ b/drivers/gpu/drm/i915/intel_drv.h |
888 | @@ -1234,6 +1234,8 @@ void intel_dp_set_link_params(struct intel_dp *intel_dp, |
889 | void intel_dp_start_link_train(struct intel_dp *intel_dp); |
890 | void intel_dp_stop_link_train(struct intel_dp *intel_dp); |
891 | void intel_dp_sink_dpms(struct intel_dp *intel_dp, int mode); |
892 | +void intel_dp_encoder_reset(struct drm_encoder *encoder); |
893 | +void intel_dp_encoder_suspend(struct intel_encoder *intel_encoder); |
894 | void intel_dp_encoder_destroy(struct drm_encoder *encoder); |
895 | int intel_dp_sink_crc(struct intel_dp *intel_dp, u8 *crc); |
896 | bool intel_dp_compute_config(struct intel_encoder *encoder, |
897 | diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c |
898 | index 616108c4bc3e..43fdae8ff3c3 100644 |
899 | --- a/drivers/gpu/drm/i915/intel_hdmi.c |
900 | +++ b/drivers/gpu/drm/i915/intel_hdmi.c |
901 | @@ -1407,8 +1407,16 @@ intel_hdmi_detect(struct drm_connector *connector, bool force) |
902 | hdmi_to_dig_port(intel_hdmi)); |
903 | } |
904 | |
905 | - if (!live_status) |
906 | - DRM_DEBUG_KMS("Live status not up!"); |
907 | + if (!live_status) { |
908 | + DRM_DEBUG_KMS("HDMI live status down\n"); |
909 | + /* |
910 | + * Live status register is not reliable on all intel platforms. |
911 | + * So consider live_status only for certain platforms, for |
912 | + * others, read EDID to determine presence of sink. |
913 | + */ |
914 | + if (INTEL_INFO(dev_priv)->gen < 7 || IS_IVYBRIDGE(dev_priv)) |
915 | + live_status = true; |
916 | + } |
917 | |
918 | intel_hdmi_unset_edid(connector); |
919 | |
920 | diff --git a/drivers/gpu/drm/radeon/atombios_encoders.c b/drivers/gpu/drm/radeon/atombios_encoders.c |
921 | index 6104d7d7449e..9de6503b10d8 100644 |
922 | --- a/drivers/gpu/drm/radeon/atombios_encoders.c |
923 | +++ b/drivers/gpu/drm/radeon/atombios_encoders.c |
924 | @@ -310,6 +310,10 @@ static bool radeon_atom_mode_fixup(struct drm_encoder *encoder, |
925 | && (mode->crtc_vsync_start < (mode->crtc_vdisplay + 2))) |
926 | adjusted_mode->crtc_vsync_start = adjusted_mode->crtc_vdisplay + 2; |
927 | |
928 | + /* vertical FP must be at least 1 */ |
929 | + if (mode->crtc_vsync_start == mode->crtc_vdisplay) |
930 | + adjusted_mode->crtc_vsync_start++; |
931 | + |
932 | /* get the native mode for scaling */ |
933 | if (radeon_encoder->active_device & (ATOM_DEVICE_LCD_SUPPORT)) { |
934 | radeon_panel_mode_fixup(encoder, adjusted_mode); |
935 | diff --git a/drivers/gpu/ipu-v3/ipu-common.c b/drivers/gpu/ipu-v3/ipu-common.c |
936 | index e00db3f510dd..abb98c77bad2 100644 |
937 | --- a/drivers/gpu/ipu-v3/ipu-common.c |
938 | +++ b/drivers/gpu/ipu-v3/ipu-common.c |
939 | @@ -1068,7 +1068,6 @@ static int ipu_add_client_devices(struct ipu_soc *ipu, unsigned long ipu_base) |
940 | goto err_register; |
941 | } |
942 | |
943 | - pdev->dev.of_node = of_node; |
944 | pdev->dev.parent = dev; |
945 | |
946 | ret = platform_device_add_data(pdev, ®->pdata, |
947 | @@ -1079,6 +1078,12 @@ static int ipu_add_client_devices(struct ipu_soc *ipu, unsigned long ipu_base) |
948 | platform_device_put(pdev); |
949 | goto err_register; |
950 | } |
951 | + |
952 | + /* |
953 | + * Set of_node only after calling platform_device_add. Otherwise |
954 | + * the platform:imx-ipuv3-crtc modalias won't be used. |
955 | + */ |
956 | + pdev->dev.of_node = of_node; |
957 | } |
958 | |
959 | return 0; |
960 | diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h |
961 | index b6ff6e78ac54..14c14c82795c 100644 |
962 | --- a/drivers/hid/hid-ids.h |
963 | +++ b/drivers/hid/hid-ids.h |
964 | @@ -255,6 +255,7 @@ |
965 | #define USB_DEVICE_ID_CORSAIR_K90 0x1b02 |
966 | |
967 | #define USB_VENDOR_ID_CREATIVELABS 0x041e |
968 | +#define USB_DEVICE_ID_CREATIVE_SB_OMNI_SURROUND_51 0x322c |
969 | #define USB_DEVICE_ID_PRODIKEYS_PCMIDI 0x2801 |
970 | |
971 | #define USB_VENDOR_ID_CVTOUCH 0x1ff7 |
972 | diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c |
973 | index 7dd0953cd70f..dc8e6adf95a4 100644 |
974 | --- a/drivers/hid/usbhid/hid-quirks.c |
975 | +++ b/drivers/hid/usbhid/hid-quirks.c |
976 | @@ -70,6 +70,7 @@ static const struct hid_blacklist { |
977 | { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_3AXIS_5BUTTON_STICK, HID_QUIRK_NOGET }, |
978 | { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_AXIS_295, HID_QUIRK_NOGET }, |
979 | { USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_PIXART_USB_OPTICAL_MOUSE, HID_QUIRK_ALWAYS_POLL }, |
980 | + { USB_VENDOR_ID_CREATIVELABS, USB_DEVICE_ID_CREATIVE_SB_OMNI_SURROUND_51, HID_QUIRK_NOGET }, |
981 | { USB_VENDOR_ID_DMI, USB_DEVICE_ID_DMI_ENC, HID_QUIRK_NOGET }, |
982 | { USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_WIIU, HID_QUIRK_MULTI_INPUT }, |
983 | { USB_VENDOR_ID_ELAN, HID_ANY_ID, HID_QUIRK_ALWAYS_POLL }, |
984 | diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c |
985 | index 94a8875b38fb..f71187aad0d0 100644 |
986 | --- a/drivers/hid/wacom_wac.c |
987 | +++ b/drivers/hid/wacom_wac.c |
988 | @@ -3378,6 +3378,10 @@ static const struct wacom_features wacom_features_0x33E = |
989 | { "Wacom Intuos PT M 2", 21600, 13500, 2047, 63, |
990 | INTUOSHT2, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 16, |
991 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; |
992 | +static const struct wacom_features wacom_features_0x343 = |
993 | + { "Wacom DTK1651", 34616, 19559, 1023, 0, |
994 | + DTUS, WACOM_INTUOS_RES, WACOM_INTUOS_RES, 4, |
995 | + WACOM_DTU_OFFSET, WACOM_DTU_OFFSET }; |
996 | |
997 | static const struct wacom_features wacom_features_HID_ANY_ID = |
998 | { "Wacom HID", .type = HID_GENERIC }; |
999 | @@ -3543,6 +3547,7 @@ const struct hid_device_id wacom_ids[] = { |
1000 | { USB_DEVICE_WACOM(0x33C) }, |
1001 | { USB_DEVICE_WACOM(0x33D) }, |
1002 | { USB_DEVICE_WACOM(0x33E) }, |
1003 | + { USB_DEVICE_WACOM(0x343) }, |
1004 | { USB_DEVICE_WACOM(0x4001) }, |
1005 | { USB_DEVICE_WACOM(0x4004) }, |
1006 | { USB_DEVICE_WACOM(0x5000) }, |
1007 | diff --git a/drivers/hv/ring_buffer.c b/drivers/hv/ring_buffer.c |
1008 | index b53702ce692f..e35560b955b1 100644 |
1009 | --- a/drivers/hv/ring_buffer.c |
1010 | +++ b/drivers/hv/ring_buffer.c |
1011 | @@ -103,15 +103,29 @@ static bool hv_need_to_signal(u32 old_write, struct hv_ring_buffer_info *rbi) |
1012 | * there is room for the producer to send the pending packet. |
1013 | */ |
1014 | |
1015 | -static bool hv_need_to_signal_on_read(u32 prev_write_sz, |
1016 | - struct hv_ring_buffer_info *rbi) |
1017 | +static bool hv_need_to_signal_on_read(struct hv_ring_buffer_info *rbi) |
1018 | { |
1019 | u32 cur_write_sz; |
1020 | u32 r_size; |
1021 | - u32 write_loc = rbi->ring_buffer->write_index; |
1022 | + u32 write_loc; |
1023 | u32 read_loc = rbi->ring_buffer->read_index; |
1024 | - u32 pending_sz = rbi->ring_buffer->pending_send_sz; |
1025 | + u32 pending_sz; |
1026 | |
1027 | + /* |
1028 | + * Issue a full memory barrier before making the signaling decision. |
1029 | + * Here is the reason for having this barrier: |
1030 | + * If the reading of the pend_sz (in this function) |
1031 | + * were to be reordered and read before we commit the new read |
1032 | + * index (in the calling function) we could |
1033 | + * have a problem. If the host were to set the pending_sz after we |
1034 | + * have sampled pending_sz and go to sleep before we commit the |
1035 | + * read index, we could miss sending the interrupt. Issue a full |
1036 | + * memory barrier to address this. |
1037 | + */ |
1038 | + mb(); |
1039 | + |
1040 | + pending_sz = rbi->ring_buffer->pending_send_sz; |
1041 | + write_loc = rbi->ring_buffer->write_index; |
1042 | /* If the other end is not blocked on write don't bother. */ |
1043 | if (pending_sz == 0) |
1044 | return false; |
1045 | @@ -120,7 +134,7 @@ static bool hv_need_to_signal_on_read(u32 prev_write_sz, |
1046 | cur_write_sz = write_loc >= read_loc ? r_size - (write_loc - read_loc) : |
1047 | read_loc - write_loc; |
1048 | |
1049 | - if ((prev_write_sz < pending_sz) && (cur_write_sz >= pending_sz)) |
1050 | + if (cur_write_sz >= pending_sz) |
1051 | return true; |
1052 | |
1053 | return false; |
1054 | @@ -458,7 +472,7 @@ int hv_ringbuffer_read(struct hv_ring_buffer_info *inring_info, |
1055 | /* Update the read index */ |
1056 | hv_set_next_read_location(inring_info, next_read_location); |
1057 | |
1058 | - *signal = hv_need_to_signal_on_read(bytes_avail_towrite, inring_info); |
1059 | + *signal = hv_need_to_signal_on_read(inring_info); |
1060 | |
1061 | out_unlock: |
1062 | spin_unlock_irqrestore(&inring_info->ring_lock, flags); |
1063 | diff --git a/drivers/iio/magnetometer/ak8975.c b/drivers/iio/magnetometer/ak8975.c |
1064 | index b13936dacc78..f2a7f72f7aa6 100644 |
1065 | --- a/drivers/iio/magnetometer/ak8975.c |
1066 | +++ b/drivers/iio/magnetometer/ak8975.c |
1067 | @@ -462,6 +462,8 @@ static int ak8975_setup_irq(struct ak8975_data *data) |
1068 | int rc; |
1069 | int irq; |
1070 | |
1071 | + init_waitqueue_head(&data->data_ready_queue); |
1072 | + clear_bit(0, &data->flags); |
1073 | if (client->irq) |
1074 | irq = client->irq; |
1075 | else |
1076 | @@ -477,8 +479,6 @@ static int ak8975_setup_irq(struct ak8975_data *data) |
1077 | return rc; |
1078 | } |
1079 | |
1080 | - init_waitqueue_head(&data->data_ready_queue); |
1081 | - clear_bit(0, &data->flags); |
1082 | data->eoc_irq = irq; |
1083 | |
1084 | return rc; |
1085 | @@ -732,7 +732,7 @@ static int ak8975_probe(struct i2c_client *client, |
1086 | int eoc_gpio; |
1087 | int err; |
1088 | const char *name = NULL; |
1089 | - enum asahi_compass_chipset chipset; |
1090 | + enum asahi_compass_chipset chipset = AK_MAX_TYPE; |
1091 | |
1092 | /* Grab and set up the supplied GPIO. */ |
1093 | if (client->dev.platform_data) |
1094 | diff --git a/drivers/infiniband/hw/cxgb4/cq.c b/drivers/infiniband/hw/cxgb4/cq.c |
1095 | index cf21df4a8bf5..4e94cff5ba71 100644 |
1096 | --- a/drivers/infiniband/hw/cxgb4/cq.c |
1097 | +++ b/drivers/infiniband/hw/cxgb4/cq.c |
1098 | @@ -162,7 +162,7 @@ static int create_cq(struct c4iw_rdev *rdev, struct t4_cq *cq, |
1099 | cq->bar2_va = c4iw_bar2_addrs(rdev, cq->cqid, T4_BAR2_QTYPE_INGRESS, |
1100 | &cq->bar2_qid, |
1101 | user ? &cq->bar2_pa : NULL); |
1102 | - if (user && !cq->bar2_va) { |
1103 | + if (user && !cq->bar2_pa) { |
1104 | pr_warn(MOD "%s: cqid %u not in BAR2 range.\n", |
1105 | pci_name(rdev->lldi.pdev), cq->cqid); |
1106 | ret = -EINVAL; |
1107 | diff --git a/drivers/infiniband/hw/cxgb4/qp.c b/drivers/infiniband/hw/cxgb4/qp.c |
1108 | index e99345eb875a..8ff690bf09d9 100644 |
1109 | --- a/drivers/infiniband/hw/cxgb4/qp.c |
1110 | +++ b/drivers/infiniband/hw/cxgb4/qp.c |
1111 | @@ -185,6 +185,10 @@ void __iomem *c4iw_bar2_addrs(struct c4iw_rdev *rdev, unsigned int qid, |
1112 | |
1113 | if (pbar2_pa) |
1114 | *pbar2_pa = (rdev->bar2_pa + bar2_qoffset) & PAGE_MASK; |
1115 | + |
1116 | + if (is_t4(rdev->lldi.adapter_type)) |
1117 | + return NULL; |
1118 | + |
1119 | return rdev->bar2_kva + bar2_qoffset; |
1120 | } |
1121 | |
1122 | @@ -270,7 +274,7 @@ static int create_qp(struct c4iw_rdev *rdev, struct t4_wq *wq, |
1123 | /* |
1124 | * User mode must have bar2 access. |
1125 | */ |
1126 | - if (user && (!wq->sq.bar2_va || !wq->rq.bar2_va)) { |
1127 | + if (user && (!wq->sq.bar2_pa || !wq->rq.bar2_pa)) { |
1128 | pr_warn(MOD "%s: sqid %u or rqid %u not in BAR2 range.\n", |
1129 | pci_name(rdev->lldi.pdev), wq->sq.qid, wq->rq.qid); |
1130 | goto free_dma; |
1131 | diff --git a/drivers/input/touchscreen/zforce_ts.c b/drivers/input/touchscreen/zforce_ts.c |
1132 | index 9bbadaaf6bc3..7b3845aa5983 100644 |
1133 | --- a/drivers/input/touchscreen/zforce_ts.c |
1134 | +++ b/drivers/input/touchscreen/zforce_ts.c |
1135 | @@ -370,8 +370,8 @@ static int zforce_touch_event(struct zforce_ts *ts, u8 *payload) |
1136 | point.coord_x = point.coord_y = 0; |
1137 | } |
1138 | |
1139 | - point.state = payload[9 * i + 5] & 0x03; |
1140 | - point.id = (payload[9 * i + 5] & 0xfc) >> 2; |
1141 | + point.state = payload[9 * i + 5] & 0x0f; |
1142 | + point.id = (payload[9 * i + 5] & 0xf0) >> 4; |
1143 | |
1144 | /* determine touch major, minor and orientation */ |
1145 | point.area_major = max(payload[9 * i + 6], |
1146 | diff --git a/drivers/lightnvm/rrpc.c b/drivers/lightnvm/rrpc.c |
1147 | index 307db1ea22de..b7ddfb352792 100644 |
1148 | --- a/drivers/lightnvm/rrpc.c |
1149 | +++ b/drivers/lightnvm/rrpc.c |
1150 | @@ -499,12 +499,21 @@ static void rrpc_gc_queue(struct work_struct *work) |
1151 | struct rrpc *rrpc = gcb->rrpc; |
1152 | struct rrpc_block *rblk = gcb->rblk; |
1153 | struct nvm_lun *lun = rblk->parent->lun; |
1154 | + struct nvm_block *blk = rblk->parent; |
1155 | struct rrpc_lun *rlun = &rrpc->luns[lun->id - rrpc->lun_offset]; |
1156 | |
1157 | spin_lock(&rlun->lock); |
1158 | list_add_tail(&rblk->prio, &rlun->prio_list); |
1159 | spin_unlock(&rlun->lock); |
1160 | |
1161 | + spin_lock(&lun->lock); |
1162 | + lun->nr_open_blocks--; |
1163 | + lun->nr_closed_blocks++; |
1164 | + blk->state &= ~NVM_BLK_ST_OPEN; |
1165 | + blk->state |= NVM_BLK_ST_CLOSED; |
1166 | + list_move_tail(&rblk->list, &rlun->closed_list); |
1167 | + spin_unlock(&lun->lock); |
1168 | + |
1169 | mempool_free(gcb, rrpc->gcb_pool); |
1170 | pr_debug("nvm: block '%lu' is full, allow GC (sched)\n", |
1171 | rblk->parent->id); |
1172 | @@ -668,20 +677,8 @@ static void rrpc_end_io_write(struct rrpc *rrpc, struct rrpc_rq *rrqd, |
1173 | lun = rblk->parent->lun; |
1174 | |
1175 | cmnt_size = atomic_inc_return(&rblk->data_cmnt_size); |
1176 | - if (unlikely(cmnt_size == rrpc->dev->pgs_per_blk)) { |
1177 | - struct nvm_block *blk = rblk->parent; |
1178 | - struct rrpc_lun *rlun = rblk->rlun; |
1179 | - |
1180 | - spin_lock(&lun->lock); |
1181 | - lun->nr_open_blocks--; |
1182 | - lun->nr_closed_blocks++; |
1183 | - blk->state &= ~NVM_BLK_ST_OPEN; |
1184 | - blk->state |= NVM_BLK_ST_CLOSED; |
1185 | - list_move_tail(&rblk->list, &rlun->closed_list); |
1186 | - spin_unlock(&lun->lock); |
1187 | - |
1188 | + if (unlikely(cmnt_size == rrpc->dev->pgs_per_blk)) |
1189 | rrpc_run_gc(rrpc, rblk); |
1190 | - } |
1191 | } |
1192 | } |
1193 | |
1194 | diff --git a/drivers/md/md.c b/drivers/md/md.c |
1195 | index e55e6cf9ec17..7551278030d8 100644 |
1196 | --- a/drivers/md/md.c |
1197 | +++ b/drivers/md/md.c |
1198 | @@ -284,6 +284,8 @@ static blk_qc_t md_make_request(struct request_queue *q, struct bio *bio) |
1199 | * go away inside make_request |
1200 | */ |
1201 | sectors = bio_sectors(bio); |
1202 | + /* bio could be mergeable after passing to underlayer */ |
1203 | + bio->bi_rw &= ~REQ_NOMERGE; |
1204 | mddev->pers->make_request(mddev, bio); |
1205 | |
1206 | cpu = part_stat_lock(); |
1207 | diff --git a/drivers/mfd/intel-lpss.c b/drivers/mfd/intel-lpss.c |
1208 | index 1743788f1595..1bbbe877ba7e 100644 |
1209 | --- a/drivers/mfd/intel-lpss.c |
1210 | +++ b/drivers/mfd/intel-lpss.c |
1211 | @@ -453,6 +453,7 @@ int intel_lpss_probe(struct device *dev, |
1212 | err_remove_ltr: |
1213 | intel_lpss_debugfs_remove(lpss); |
1214 | intel_lpss_ltr_hide(lpss); |
1215 | + intel_lpss_unregister_clock(lpss); |
1216 | |
1217 | err_clk_register: |
1218 | ida_simple_remove(&intel_lpss_devid_ida, lpss->devid); |
1219 | diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c |
1220 | index 1545a944c309..b86fe50d5d93 100644 |
1221 | --- a/drivers/net/ethernet/mellanox/mlx5/core/main.c |
1222 | +++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c |
1223 | @@ -423,6 +423,10 @@ static int handle_hca_cap_atomic(struct mlx5_core_dev *dev) |
1224 | HCA_CAP_OPMOD_GET_CUR); |
1225 | if (err) |
1226 | return err; |
1227 | + err = mlx5_core_get_caps(dev, MLX5_CAP_ATOMIC, |
1228 | + HCA_CAP_OPMOD_GET_MAX); |
1229 | + if (err) |
1230 | + return err; |
1231 | } else { |
1232 | return 0; |
1233 | } |
1234 | diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c |
1235 | index 91afa3ae414c..a192d451dab2 100644 |
1236 | --- a/drivers/net/wireless/ath/ath10k/htt_rx.c |
1237 | +++ b/drivers/net/wireless/ath/ath10k/htt_rx.c |
1238 | @@ -2143,11 +2143,7 @@ EXPORT_SYMBOL(ath10k_htt_t2h_msg_handler); |
1239 | void ath10k_htt_rx_pktlog_completion_handler(struct ath10k *ar, |
1240 | struct sk_buff *skb) |
1241 | { |
1242 | - struct ath10k_pktlog_10_4_hdr *hdr = |
1243 | - (struct ath10k_pktlog_10_4_hdr *)skb->data; |
1244 | - |
1245 | - trace_ath10k_htt_pktlog(ar, hdr->payload, |
1246 | - sizeof(*hdr) + __le16_to_cpu(hdr->size)); |
1247 | + trace_ath10k_htt_pktlog(ar, skb->data, skb->len); |
1248 | dev_kfree_skb_any(skb); |
1249 | } |
1250 | EXPORT_SYMBOL(ath10k_htt_rx_pktlog_completion_handler); |
1251 | diff --git a/drivers/net/wireless/ath/ath9k/ar5008_phy.c b/drivers/net/wireless/ath/ath9k/ar5008_phy.c |
1252 | index 8f8793004b9f..1b271b99c49e 100644 |
1253 | --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c |
1254 | +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c |
1255 | @@ -274,6 +274,9 @@ void ar5008_hw_cmn_spur_mitigate(struct ath_hw *ah, |
1256 | }; |
1257 | static const int inc[4] = { 0, 100, 0, 0 }; |
1258 | |
1259 | + memset(&mask_m, 0, sizeof(int8_t) * 123); |
1260 | + memset(&mask_p, 0, sizeof(int8_t) * 123); |
1261 | + |
1262 | cur_bin = -6000; |
1263 | upper = bin + 100; |
1264 | lower = bin - 100; |
1265 | @@ -424,14 +427,9 @@ static void ar5008_hw_spur_mitigate(struct ath_hw *ah, |
1266 | int tmp, new; |
1267 | int i; |
1268 | |
1269 | - int8_t mask_m[123]; |
1270 | - int8_t mask_p[123]; |
1271 | int cur_bb_spur; |
1272 | bool is2GHz = IS_CHAN_2GHZ(chan); |
1273 | |
1274 | - memset(&mask_m, 0, sizeof(int8_t) * 123); |
1275 | - memset(&mask_p, 0, sizeof(int8_t) * 123); |
1276 | - |
1277 | for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++) { |
1278 | cur_bb_spur = ah->eep_ops->get_spur_channel(ah, i, is2GHz); |
1279 | if (AR_NO_SPUR == cur_bb_spur) |
1280 | diff --git a/drivers/net/wireless/ath/ath9k/ar9002_phy.c b/drivers/net/wireless/ath/ath9k/ar9002_phy.c |
1281 | index db6624527d99..53d7445a5d12 100644 |
1282 | --- a/drivers/net/wireless/ath/ath9k/ar9002_phy.c |
1283 | +++ b/drivers/net/wireless/ath/ath9k/ar9002_phy.c |
1284 | @@ -178,14 +178,9 @@ static void ar9002_hw_spur_mitigate(struct ath_hw *ah, |
1285 | int i; |
1286 | struct chan_centers centers; |
1287 | |
1288 | - int8_t mask_m[123]; |
1289 | - int8_t mask_p[123]; |
1290 | int cur_bb_spur; |
1291 | bool is2GHz = IS_CHAN_2GHZ(chan); |
1292 | |
1293 | - memset(&mask_m, 0, sizeof(int8_t) * 123); |
1294 | - memset(&mask_p, 0, sizeof(int8_t) * 123); |
1295 | - |
1296 | ath9k_hw_get_channel_centers(ah, chan, ¢ers); |
1297 | freq = centers.synth_center; |
1298 | |
1299 | diff --git a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c |
1300 | index 6a4fc5d183cf..d7db6f23e728 100644 |
1301 | --- a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c |
1302 | +++ b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c |
1303 | @@ -314,6 +314,7 @@ int mwifiex_bss_start(struct mwifiex_private *priv, struct cfg80211_bss *bss, |
1304 | mwifiex_dbg(adapter, ERROR, |
1305 | "Attempt to reconnect on csa closed chan(%d)\n", |
1306 | bss_desc->channel); |
1307 | + ret = -1; |
1308 | goto done; |
1309 | } |
1310 | |
1311 | diff --git a/drivers/net/wireless/realtek/rtlwifi/rc.c b/drivers/net/wireless/realtek/rtlwifi/rc.c |
1312 | index 28f7010e7108..1aca77719521 100644 |
1313 | --- a/drivers/net/wireless/realtek/rtlwifi/rc.c |
1314 | +++ b/drivers/net/wireless/realtek/rtlwifi/rc.c |
1315 | @@ -41,7 +41,7 @@ static u8 _rtl_rc_get_highest_rix(struct rtl_priv *rtlpriv, |
1316 | struct rtl_hal *rtlhal = rtl_hal(rtlpriv); |
1317 | struct rtl_phy *rtlphy = &(rtlpriv->phy); |
1318 | struct rtl_sta_info *sta_entry = NULL; |
1319 | - u8 wireless_mode = 0; |
1320 | + u16 wireless_mode = 0; |
1321 | |
1322 | /* |
1323 | *this rate is no use for true rate, firmware |
1324 | @@ -99,7 +99,7 @@ static void _rtl_rc_rate_set_series(struct rtl_priv *rtlpriv, |
1325 | { |
1326 | struct rtl_mac *mac = rtl_mac(rtlpriv); |
1327 | struct rtl_sta_info *sta_entry = NULL; |
1328 | - u8 wireless_mode = 0; |
1329 | + u16 wireless_mode = 0; |
1330 | u8 sgi_20 = 0, sgi_40 = 0, sgi_80 = 0; |
1331 | |
1332 | if (sta) { |
1333 | diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c |
1334 | index bbb789f8990b..5e5719b26774 100644 |
1335 | --- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c |
1336 | +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/hw.c |
1337 | @@ -3855,7 +3855,7 @@ void rtl8821ae_update_channel_access_setting(struct ieee80211_hw *hw) |
1338 | { |
1339 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
1340 | struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); |
1341 | - u8 wireless_mode = mac->mode; |
1342 | + u16 wireless_mode = mac->mode; |
1343 | u8 sifs_timer, r2t_sifs; |
1344 | |
1345 | rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_SLOT_TIME, |
1346 | diff --git a/drivers/net/wireless/realtek/rtlwifi/wifi.h b/drivers/net/wireless/realtek/rtlwifi/wifi.h |
1347 | index 4544752a2ba8..84397b190cc0 100644 |
1348 | --- a/drivers/net/wireless/realtek/rtlwifi/wifi.h |
1349 | +++ b/drivers/net/wireless/realtek/rtlwifi/wifi.h |
1350 | @@ -1323,14 +1323,13 @@ struct rtl_tid_data { |
1351 | |
1352 | struct rtl_sta_info { |
1353 | struct list_head list; |
1354 | - u8 ratr_index; |
1355 | - u8 wireless_mode; |
1356 | - u8 mimo_ps; |
1357 | - u8 mac_addr[ETH_ALEN]; |
1358 | struct rtl_tid_data tids[MAX_TID_COUNT]; |
1359 | - |
1360 | /* just used for ap adhoc or mesh*/ |
1361 | struct rssi_sta rssi_stat; |
1362 | + u16 wireless_mode; |
1363 | + u8 ratr_index; |
1364 | + u8 mimo_ps; |
1365 | + u8 mac_addr[ETH_ALEN]; |
1366 | } __packed; |
1367 | |
1368 | struct rtl_priv; |
1369 | diff --git a/drivers/net/wireless/ti/wlcore/event.c b/drivers/net/wireless/ti/wlcore/event.c |
1370 | index c96405498bf4..4b59f67724de 100644 |
1371 | --- a/drivers/net/wireless/ti/wlcore/event.c |
1372 | +++ b/drivers/net/wireless/ti/wlcore/event.c |
1373 | @@ -38,7 +38,7 @@ |
1374 | |
1375 | int wlcore_event_fw_logger(struct wl1271 *wl) |
1376 | { |
1377 | - u32 ret; |
1378 | + int ret; |
1379 | struct fw_logger_information fw_log; |
1380 | u8 *buffer; |
1381 | u32 internal_fw_addrbase = WL18XX_DATA_RAM_BASE_ADDRESS; |
1382 | diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c |
1383 | index 544b802a594c..02c574f8ccb3 100644 |
1384 | --- a/drivers/nvdimm/pmem.c |
1385 | +++ b/drivers/nvdimm/pmem.c |
1386 | @@ -314,9 +314,16 @@ static int nd_pfn_init(struct nd_pfn *nd_pfn) |
1387 | * implementation will limit the pfns advertised through |
1388 | * ->direct_access() to those that are included in the memmap. |
1389 | */ |
1390 | - if (nd_pfn->mode == PFN_MODE_PMEM) |
1391 | - offset = ALIGN(SZ_8K + 64 * npfns, nd_pfn->align); |
1392 | - else if (nd_pfn->mode == PFN_MODE_RAM) |
1393 | + if (nd_pfn->mode == PFN_MODE_PMEM) { |
1394 | + unsigned long memmap_size; |
1395 | + |
1396 | + /* |
1397 | + * vmemmap_populate_hugepages() allocates the memmap array in |
1398 | + * HPAGE_SIZE chunks. |
1399 | + */ |
1400 | + memmap_size = ALIGN(64 * npfns, PMD_SIZE); |
1401 | + offset = ALIGN(SZ_8K + memmap_size, nd_pfn->align); |
1402 | + } else if (nd_pfn->mode == PFN_MODE_RAM) |
1403 | offset = ALIGN(SZ_8K, nd_pfn->align); |
1404 | else |
1405 | goto err; |
1406 | diff --git a/drivers/nvmem/mxs-ocotp.c b/drivers/nvmem/mxs-ocotp.c |
1407 | index 8ba19bba3156..2bb3c5799ac4 100644 |
1408 | --- a/drivers/nvmem/mxs-ocotp.c |
1409 | +++ b/drivers/nvmem/mxs-ocotp.c |
1410 | @@ -94,7 +94,7 @@ static int mxs_ocotp_read(void *context, const void *reg, size_t reg_size, |
1411 | if (ret) |
1412 | goto close_banks; |
1413 | |
1414 | - while (val_size) { |
1415 | + while (val_size >= reg_size) { |
1416 | if ((offset < OCOTP_DATA_OFFSET) || (offset % 16)) { |
1417 | /* fill up non-data register */ |
1418 | *buf = 0; |
1419 | @@ -103,7 +103,7 @@ static int mxs_ocotp_read(void *context, const void *reg, size_t reg_size, |
1420 | } |
1421 | |
1422 | buf++; |
1423 | - val_size--; |
1424 | + val_size -= reg_size; |
1425 | offset += reg_size; |
1426 | } |
1427 | |
1428 | diff --git a/drivers/pwm/pwm-omap-dmtimer.c b/drivers/pwm/pwm-omap-dmtimer.c |
1429 | index 826634ec0d5c..e0679eb399f6 100644 |
1430 | --- a/drivers/pwm/pwm-omap-dmtimer.c |
1431 | +++ b/drivers/pwm/pwm-omap-dmtimer.c |
1432 | @@ -31,6 +31,7 @@ |
1433 | #include <linux/time.h> |
1434 | |
1435 | #define DM_TIMER_LOAD_MIN 0xfffffffe |
1436 | +#define DM_TIMER_MAX 0xffffffff |
1437 | |
1438 | struct pwm_omap_dmtimer_chip { |
1439 | struct pwm_chip chip; |
1440 | @@ -46,13 +47,9 @@ to_pwm_omap_dmtimer_chip(struct pwm_chip *chip) |
1441 | return container_of(chip, struct pwm_omap_dmtimer_chip, chip); |
1442 | } |
1443 | |
1444 | -static int pwm_omap_dmtimer_calc_value(unsigned long clk_rate, int ns) |
1445 | +static u32 pwm_omap_dmtimer_get_clock_cycles(unsigned long clk_rate, int ns) |
1446 | { |
1447 | - u64 c = (u64)clk_rate * ns; |
1448 | - |
1449 | - do_div(c, NSEC_PER_SEC); |
1450 | - |
1451 | - return DM_TIMER_LOAD_MIN - c; |
1452 | + return DIV_ROUND_CLOSEST_ULL((u64)clk_rate * ns, NSEC_PER_SEC); |
1453 | } |
1454 | |
1455 | static void pwm_omap_dmtimer_start(struct pwm_omap_dmtimer_chip *omap) |
1456 | @@ -99,7 +96,8 @@ static int pwm_omap_dmtimer_config(struct pwm_chip *chip, |
1457 | int duty_ns, int period_ns) |
1458 | { |
1459 | struct pwm_omap_dmtimer_chip *omap = to_pwm_omap_dmtimer_chip(chip); |
1460 | - int load_value, match_value; |
1461 | + u32 period_cycles, duty_cycles; |
1462 | + u32 load_value, match_value; |
1463 | struct clk *fclk; |
1464 | unsigned long clk_rate; |
1465 | bool timer_active; |
1466 | @@ -117,15 +115,13 @@ static int pwm_omap_dmtimer_config(struct pwm_chip *chip, |
1467 | fclk = omap->pdata->get_fclk(omap->dm_timer); |
1468 | if (!fclk) { |
1469 | dev_err(chip->dev, "invalid pmtimer fclk\n"); |
1470 | - mutex_unlock(&omap->mutex); |
1471 | - return -EINVAL; |
1472 | + goto err_einval; |
1473 | } |
1474 | |
1475 | clk_rate = clk_get_rate(fclk); |
1476 | if (!clk_rate) { |
1477 | dev_err(chip->dev, "invalid pmtimer fclk rate\n"); |
1478 | - mutex_unlock(&omap->mutex); |
1479 | - return -EINVAL; |
1480 | + goto err_einval; |
1481 | } |
1482 | |
1483 | dev_dbg(chip->dev, "clk rate: %luHz\n", clk_rate); |
1484 | @@ -133,11 +129,45 @@ static int pwm_omap_dmtimer_config(struct pwm_chip *chip, |
1485 | /* |
1486 | * Calculate the appropriate load and match values based on the |
1487 | * specified period and duty cycle. The load value determines the |
1488 | - * cycle time and the match value determines the duty cycle. |
1489 | + * period time and the match value determines the duty time. |
1490 | + * |
1491 | + * The period lasts for (DM_TIMER_MAX-load_value+1) clock cycles. |
1492 | + * Similarly, the active time lasts (match_value-load_value+1) cycles. |
1493 | + * The non-active time is the remainder: (DM_TIMER_MAX-match_value) |
1494 | + * clock cycles. |
1495 | + * |
1496 | + * NOTE: It is required that: load_value <= match_value < DM_TIMER_MAX |
1497 | + * |
1498 | + * References: |
1499 | + * OMAP4430/60/70 TRM sections 22.2.4.10 and 22.2.4.11 |
1500 | + * AM335x Sitara TRM sections 20.1.3.5 and 20.1.3.6 |
1501 | */ |
1502 | - load_value = pwm_omap_dmtimer_calc_value(clk_rate, period_ns); |
1503 | - match_value = pwm_omap_dmtimer_calc_value(clk_rate, |
1504 | - period_ns - duty_ns); |
1505 | + period_cycles = pwm_omap_dmtimer_get_clock_cycles(clk_rate, period_ns); |
1506 | + duty_cycles = pwm_omap_dmtimer_get_clock_cycles(clk_rate, duty_ns); |
1507 | + |
1508 | + if (period_cycles < 2) { |
1509 | + dev_info(chip->dev, |
1510 | + "period %d ns too short for clock rate %lu Hz\n", |
1511 | + period_ns, clk_rate); |
1512 | + goto err_einval; |
1513 | + } |
1514 | + |
1515 | + if (duty_cycles < 1) { |
1516 | + dev_dbg(chip->dev, |
1517 | + "duty cycle %d ns is too short for clock rate %lu Hz\n", |
1518 | + duty_ns, clk_rate); |
1519 | + dev_dbg(chip->dev, "using minimum of 1 clock cycle\n"); |
1520 | + duty_cycles = 1; |
1521 | + } else if (duty_cycles >= period_cycles) { |
1522 | + dev_dbg(chip->dev, |
1523 | + "duty cycle %d ns is too long for period %d ns at clock rate %lu Hz\n", |
1524 | + duty_ns, period_ns, clk_rate); |
1525 | + dev_dbg(chip->dev, "using maximum of 1 clock cycle less than period\n"); |
1526 | + duty_cycles = period_cycles - 1; |
1527 | + } |
1528 | + |
1529 | + load_value = (DM_TIMER_MAX - period_cycles) + 1; |
1530 | + match_value = load_value + duty_cycles - 1; |
1531 | |
1532 | /* |
1533 | * We MUST stop the associated dual-mode timer before attempting to |
1534 | @@ -166,6 +196,11 @@ static int pwm_omap_dmtimer_config(struct pwm_chip *chip, |
1535 | mutex_unlock(&omap->mutex); |
1536 | |
1537 | return 0; |
1538 | + |
1539 | +err_einval: |
1540 | + mutex_unlock(&omap->mutex); |
1541 | + |
1542 | + return -EINVAL; |
1543 | } |
1544 | |
1545 | static int pwm_omap_dmtimer_set_polarity(struct pwm_chip *chip, |
1546 | diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c |
1547 | index a544366a367e..f57d02c3b6cf 100644 |
1548 | --- a/drivers/scsi/lpfc/lpfc_init.c |
1549 | +++ b/drivers/scsi/lpfc/lpfc_init.c |
1550 | @@ -2860,7 +2860,7 @@ lpfc_online(struct lpfc_hba *phba) |
1551 | } |
1552 | |
1553 | vports = lpfc_create_vport_work_array(phba); |
1554 | - if (vports != NULL) |
1555 | + if (vports != NULL) { |
1556 | for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { |
1557 | struct Scsi_Host *shost; |
1558 | shost = lpfc_shost_from_vport(vports[i]); |
1559 | @@ -2877,7 +2877,8 @@ lpfc_online(struct lpfc_hba *phba) |
1560 | } |
1561 | spin_unlock_irq(shost->host_lock); |
1562 | } |
1563 | - lpfc_destroy_vport_work_array(phba, vports); |
1564 | + } |
1565 | + lpfc_destroy_vport_work_array(phba, vports); |
1566 | |
1567 | lpfc_unblock_mgmt_io(phba); |
1568 | return 0; |
1569 | diff --git a/drivers/soc/rockchip/pm_domains.c b/drivers/soc/rockchip/pm_domains.c |
1570 | index 534c58937a56..4a65c5bda146 100644 |
1571 | --- a/drivers/soc/rockchip/pm_domains.c |
1572 | +++ b/drivers/soc/rockchip/pm_domains.c |
1573 | @@ -419,6 +419,7 @@ static int rockchip_pm_domain_probe(struct platform_device *pdev) |
1574 | if (error) { |
1575 | dev_err(dev, "failed to handle node %s: %d\n", |
1576 | node->name, error); |
1577 | + of_node_put(node); |
1578 | goto err_out; |
1579 | } |
1580 | } |
1581 | diff --git a/drivers/usb/core/port.c b/drivers/usb/core/port.c |
1582 | index 14718a9ffcfb..460c855be0d0 100644 |
1583 | --- a/drivers/usb/core/port.c |
1584 | +++ b/drivers/usb/core/port.c |
1585 | @@ -249,18 +249,12 @@ static int usb_port_runtime_suspend(struct device *dev) |
1586 | |
1587 | return retval; |
1588 | } |
1589 | - |
1590 | -static int usb_port_prepare(struct device *dev) |
1591 | -{ |
1592 | - return 1; |
1593 | -} |
1594 | #endif |
1595 | |
1596 | static const struct dev_pm_ops usb_port_pm_ops = { |
1597 | #ifdef CONFIG_PM |
1598 | .runtime_suspend = usb_port_runtime_suspend, |
1599 | .runtime_resume = usb_port_runtime_resume, |
1600 | - .prepare = usb_port_prepare, |
1601 | #endif |
1602 | }; |
1603 | |
1604 | diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c |
1605 | index ebb29caa3fe4..77e4c9bc0ab1 100644 |
1606 | --- a/drivers/usb/core/usb.c |
1607 | +++ b/drivers/usb/core/usb.c |
1608 | @@ -311,13 +311,7 @@ static int usb_dev_uevent(struct device *dev, struct kobj_uevent_env *env) |
1609 | |
1610 | static int usb_dev_prepare(struct device *dev) |
1611 | { |
1612 | - struct usb_device *udev = to_usb_device(dev); |
1613 | - |
1614 | - /* Return 0 if the current wakeup setting is wrong, otherwise 1 */ |
1615 | - if (udev->do_remote_wakeup != device_may_wakeup(dev)) |
1616 | - return 0; |
1617 | - |
1618 | - return 1; |
1619 | + return 0; /* Implement eventually? */ |
1620 | } |
1621 | |
1622 | static void usb_dev_complete(struct device *dev) |
1623 | diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c |
1624 | index 9bc0e090b881..a543cdc0f88f 100644 |
1625 | --- a/drivers/usb/serial/cp210x.c |
1626 | +++ b/drivers/usb/serial/cp210x.c |
1627 | @@ -109,6 +109,7 @@ static const struct usb_device_id id_table[] = { |
1628 | { USB_DEVICE(0x10C4, 0x826B) }, /* Cygnal Integrated Products, Inc., Fasttrax GPS demonstration module */ |
1629 | { USB_DEVICE(0x10C4, 0x8281) }, /* Nanotec Plug & Drive */ |
1630 | { USB_DEVICE(0x10C4, 0x8293) }, /* Telegesis ETRX2USB */ |
1631 | + { USB_DEVICE(0x10C4, 0x82F4) }, /* Starizona MicroTouch */ |
1632 | { USB_DEVICE(0x10C4, 0x82F9) }, /* Procyon AVS */ |
1633 | { USB_DEVICE(0x10C4, 0x8341) }, /* Siemens MC35PU GPRS Modem */ |
1634 | { USB_DEVICE(0x10C4, 0x8382) }, /* Cygnal Integrated Products, Inc. */ |
1635 | @@ -118,6 +119,7 @@ static const struct usb_device_id id_table[] = { |
1636 | { USB_DEVICE(0x10C4, 0x8418) }, /* IRZ Automation Teleport SG-10 GSM/GPRS Modem */ |
1637 | { USB_DEVICE(0x10C4, 0x846E) }, /* BEI USB Sensor Interface (VCP) */ |
1638 | { USB_DEVICE(0x10C4, 0x8477) }, /* Balluff RFID */ |
1639 | + { USB_DEVICE(0x10C4, 0x84B6) }, /* Starizona Hyperion */ |
1640 | { USB_DEVICE(0x10C4, 0x85EA) }, /* AC-Services IBUS-IF */ |
1641 | { USB_DEVICE(0x10C4, 0x85EB) }, /* AC-Services CIS-IBUS */ |
1642 | { USB_DEVICE(0x10C4, 0x85F8) }, /* Virtenio Preon32 */ |
1643 | @@ -141,6 +143,8 @@ static const struct usb_device_id id_table[] = { |
1644 | { USB_DEVICE(0x10C4, 0xF004) }, /* Elan Digital Systems USBcount50 */ |
1645 | { USB_DEVICE(0x10C5, 0xEA61) }, /* Silicon Labs MobiData GPRS USB Modem */ |
1646 | { USB_DEVICE(0x10CE, 0xEA6A) }, /* Silicon Labs MobiData GPRS USB Modem 100EU */ |
1647 | + { USB_DEVICE(0x12B8, 0xEC60) }, /* Link G4 ECU */ |
1648 | + { USB_DEVICE(0x12B8, 0xEC62) }, /* Link G4+ ECU */ |
1649 | { USB_DEVICE(0x13AD, 0x9999) }, /* Baltech card reader */ |
1650 | { USB_DEVICE(0x1555, 0x0004) }, /* Owen AC4 USB-RS485 Converter */ |
1651 | { USB_DEVICE(0x166A, 0x0201) }, /* Clipsal 5500PACA C-Bus Pascal Automation Controller */ |
1652 | diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c |
1653 | index 12eab503efd1..364bc44610c1 100644 |
1654 | --- a/drivers/xen/balloon.c |
1655 | +++ b/drivers/xen/balloon.c |
1656 | @@ -152,6 +152,8 @@ static DECLARE_WAIT_QUEUE_HEAD(balloon_wq); |
1657 | static void balloon_process(struct work_struct *work); |
1658 | static DECLARE_DELAYED_WORK(balloon_worker, balloon_process); |
1659 | |
1660 | +static void release_memory_resource(struct resource *resource); |
1661 | + |
1662 | /* When ballooning out (allocating memory to return to Xen) we don't really |
1663 | want the kernel to try too hard since that can trigger the oom killer. */ |
1664 | #define GFP_BALLOON \ |
1665 | @@ -268,6 +270,20 @@ static struct resource *additional_memory_resource(phys_addr_t size) |
1666 | return NULL; |
1667 | } |
1668 | |
1669 | +#ifdef CONFIG_SPARSEMEM |
1670 | + { |
1671 | + unsigned long limit = 1UL << (MAX_PHYSMEM_BITS - PAGE_SHIFT); |
1672 | + unsigned long pfn = res->start >> PAGE_SHIFT; |
1673 | + |
1674 | + if (pfn > limit) { |
1675 | + pr_err("New System RAM resource outside addressable RAM (%lu > %lu)\n", |
1676 | + pfn, limit); |
1677 | + release_memory_resource(res); |
1678 | + return NULL; |
1679 | + } |
1680 | + } |
1681 | +#endif |
1682 | + |
1683 | return res; |
1684 | } |
1685 | |
1686 | diff --git a/drivers/xen/evtchn.c b/drivers/xen/evtchn.c |
1687 | index 38272ad24551..f4edd6df3df2 100644 |
1688 | --- a/drivers/xen/evtchn.c |
1689 | +++ b/drivers/xen/evtchn.c |
1690 | @@ -316,7 +316,6 @@ static int evtchn_resize_ring(struct per_user_data *u) |
1691 | { |
1692 | unsigned int new_size; |
1693 | evtchn_port_t *new_ring, *old_ring; |
1694 | - unsigned int p, c; |
1695 | |
1696 | /* |
1697 | * Ensure the ring is large enough to capture all possible |
1698 | @@ -346,20 +345,17 @@ static int evtchn_resize_ring(struct per_user_data *u) |
1699 | /* |
1700 | * Copy the old ring contents to the new ring. |
1701 | * |
1702 | - * If the ring contents crosses the end of the current ring, |
1703 | - * it needs to be copied in two chunks. |
1704 | + * To take care of wrapping, a full ring, and the new index |
1705 | + * pointing into the second half, simply copy the old contents |
1706 | + * twice. |
1707 | * |
1708 | * +---------+ +------------------+ |
1709 | - * |34567 12| -> | 1234567 | |
1710 | - * +-----p-c-+ +------------------+ |
1711 | + * |34567 12| -> |34567 1234567 12| |
1712 | + * +-----p-c-+ +-------c------p---+ |
1713 | */ |
1714 | - p = evtchn_ring_offset(u, u->ring_prod); |
1715 | - c = evtchn_ring_offset(u, u->ring_cons); |
1716 | - if (p < c) { |
1717 | - memcpy(new_ring + c, u->ring + c, (u->ring_size - c) * sizeof(*u->ring)); |
1718 | - memcpy(new_ring + u->ring_size, u->ring, p * sizeof(*u->ring)); |
1719 | - } else |
1720 | - memcpy(new_ring + c, u->ring + c, (p - c) * sizeof(*u->ring)); |
1721 | + memcpy(new_ring, old_ring, u->ring_size * sizeof(*u->ring)); |
1722 | + memcpy(new_ring + u->ring_size, old_ring, |
1723 | + u->ring_size * sizeof(*u->ring)); |
1724 | |
1725 | u->ring = new_ring; |
1726 | u->ring_size = new_size; |
1727 | diff --git a/fs/pnode.c b/fs/pnode.c |
1728 | index c524fdddc7fb..99899705b105 100644 |
1729 | --- a/fs/pnode.c |
1730 | +++ b/fs/pnode.c |
1731 | @@ -198,7 +198,7 @@ static struct mount *next_group(struct mount *m, struct mount *origin) |
1732 | |
1733 | /* all accesses are serialized by namespace_sem */ |
1734 | static struct user_namespace *user_ns; |
1735 | -static struct mount *last_dest, *last_source, *dest_master; |
1736 | +static struct mount *last_dest, *first_source, *last_source, *dest_master; |
1737 | static struct mountpoint *mp; |
1738 | static struct hlist_head *list; |
1739 | |
1740 | @@ -221,20 +221,22 @@ static int propagate_one(struct mount *m) |
1741 | type = CL_MAKE_SHARED; |
1742 | } else { |
1743 | struct mount *n, *p; |
1744 | + bool done; |
1745 | for (n = m; ; n = p) { |
1746 | p = n->mnt_master; |
1747 | - if (p == dest_master || IS_MNT_MARKED(p)) { |
1748 | - while (last_dest->mnt_master != p) { |
1749 | - last_source = last_source->mnt_master; |
1750 | - last_dest = last_source->mnt_parent; |
1751 | - } |
1752 | - if (!peers(n, last_dest)) { |
1753 | - last_source = last_source->mnt_master; |
1754 | - last_dest = last_source->mnt_parent; |
1755 | - } |
1756 | + if (p == dest_master || IS_MNT_MARKED(p)) |
1757 | break; |
1758 | - } |
1759 | } |
1760 | + do { |
1761 | + struct mount *parent = last_source->mnt_parent; |
1762 | + if (last_source == first_source) |
1763 | + break; |
1764 | + done = parent->mnt_master == p; |
1765 | + if (done && peers(n, parent)) |
1766 | + break; |
1767 | + last_source = last_source->mnt_master; |
1768 | + } while (!done); |
1769 | + |
1770 | type = CL_SLAVE; |
1771 | /* beginning of peer group among the slaves? */ |
1772 | if (IS_MNT_SHARED(m)) |
1773 | @@ -286,6 +288,7 @@ int propagate_mnt(struct mount *dest_mnt, struct mountpoint *dest_mp, |
1774 | */ |
1775 | user_ns = current->nsproxy->mnt_ns->user_ns; |
1776 | last_dest = dest_mnt; |
1777 | + first_source = source_mnt; |
1778 | last_source = source_mnt; |
1779 | mp = dest_mp; |
1780 | list = tree_list; |
1781 | diff --git a/fs/proc/base.c b/fs/proc/base.c |
1782 | index 4f764c2ac1a5..45f2162e55b2 100644 |
1783 | --- a/fs/proc/base.c |
1784 | +++ b/fs/proc/base.c |
1785 | @@ -955,7 +955,8 @@ static ssize_t environ_read(struct file *file, char __user *buf, |
1786 | struct mm_struct *mm = file->private_data; |
1787 | unsigned long env_start, env_end; |
1788 | |
1789 | - if (!mm) |
1790 | + /* Ensure the process spawned far enough to have an environment. */ |
1791 | + if (!mm || !mm->env_end) |
1792 | return 0; |
1793 | |
1794 | page = (char *)__get_free_page(GFP_TEMPORARY); |
1795 | diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h |
1796 | index 1143e38555a4..408a60dca353 100644 |
1797 | --- a/include/linux/clk-provider.h |
1798 | +++ b/include/linux/clk-provider.h |
1799 | @@ -385,6 +385,7 @@ struct clk_divider { |
1800 | #define CLK_DIVIDER_MAX_AT_ZERO BIT(6) |
1801 | |
1802 | extern const struct clk_ops clk_divider_ops; |
1803 | +extern const struct clk_ops clk_divider_ro_ops; |
1804 | |
1805 | unsigned long divider_recalc_rate(struct clk_hw *hw, unsigned long parent_rate, |
1806 | unsigned int val, const struct clk_div_table *table, |
1807 | diff --git a/include/linux/hash.h b/include/linux/hash.h |
1808 | index 1afde47e1528..79c52fa81cac 100644 |
1809 | --- a/include/linux/hash.h |
1810 | +++ b/include/linux/hash.h |
1811 | @@ -32,12 +32,28 @@ |
1812 | #error Wordsize not 32 or 64 |
1813 | #endif |
1814 | |
1815 | +/* |
1816 | + * The above primes are actively bad for hashing, since they are |
1817 | + * too sparse. The 32-bit one is mostly ok, the 64-bit one causes |
1818 | + * real problems. Besides, the "prime" part is pointless for the |
1819 | + * multiplicative hash. |
1820 | + * |
1821 | + * Although a random odd number will do, it turns out that the golden |
1822 | + * ratio phi = (sqrt(5)-1)/2, or its negative, has particularly nice |
1823 | + * properties. |
1824 | + * |
1825 | + * These are the negative, (1 - phi) = (phi^2) = (3 - sqrt(5))/2. |
1826 | + * (See Knuth vol 3, section 6.4, exercise 9.) |
1827 | + */ |
1828 | +#define GOLDEN_RATIO_32 0x61C88647 |
1829 | +#define GOLDEN_RATIO_64 0x61C8864680B583EBull |
1830 | + |
1831 | static __always_inline u64 hash_64(u64 val, unsigned int bits) |
1832 | { |
1833 | u64 hash = val; |
1834 | |
1835 | -#if defined(CONFIG_ARCH_HAS_FAST_MULTIPLIER) && BITS_PER_LONG == 64 |
1836 | - hash = hash * GOLDEN_RATIO_PRIME_64; |
1837 | +#if BITS_PER_LONG == 64 |
1838 | + hash = hash * GOLDEN_RATIO_64; |
1839 | #else |
1840 | /* Sigh, gcc can't optimise this alone like it does for 32 bits. */ |
1841 | u64 n = hash; |
1842 | diff --git a/include/linux/swap.h b/include/linux/swap.h |
1843 | index d18b65c53dbb..5fa4aa4ddd05 100644 |
1844 | --- a/include/linux/swap.h |
1845 | +++ b/include/linux/swap.h |
1846 | @@ -533,6 +533,10 @@ static inline swp_entry_t get_swap_page(void) |
1847 | #ifdef CONFIG_MEMCG |
1848 | static inline int mem_cgroup_swappiness(struct mem_cgroup *memcg) |
1849 | { |
1850 | + /* Cgroup2 doesn't have per-cgroup swappiness */ |
1851 | + if (cgroup_subsys_on_dfl(memory_cgrp_subsys)) |
1852 | + return vm_swappiness; |
1853 | + |
1854 | /* root ? */ |
1855 | if (mem_cgroup_disabled() || !memcg->css.parent) |
1856 | return vm_swappiness; |
1857 | diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h |
1858 | index 0816c872b689..a6cc576fd467 100644 |
1859 | --- a/include/net/ip_vs.h |
1860 | +++ b/include/net/ip_vs.h |
1861 | @@ -1588,6 +1588,23 @@ static inline void ip_vs_conn_drop_conntrack(struct ip_vs_conn *cp) |
1862 | } |
1863 | #endif /* CONFIG_IP_VS_NFCT */ |
1864 | |
1865 | +/* Really using conntrack? */ |
1866 | +static inline bool ip_vs_conn_uses_conntrack(struct ip_vs_conn *cp, |
1867 | + struct sk_buff *skb) |
1868 | +{ |
1869 | +#ifdef CONFIG_IP_VS_NFCT |
1870 | + enum ip_conntrack_info ctinfo; |
1871 | + struct nf_conn *ct; |
1872 | + |
1873 | + if (!(cp->flags & IP_VS_CONN_F_NFCT)) |
1874 | + return false; |
1875 | + ct = nf_ct_get(skb, &ctinfo); |
1876 | + if (ct && !nf_ct_is_untracked(ct)) |
1877 | + return true; |
1878 | +#endif |
1879 | + return false; |
1880 | +} |
1881 | + |
1882 | static inline int |
1883 | ip_vs_dest_conn_overhead(struct ip_vs_dest *dest) |
1884 | { |
1885 | diff --git a/include/xen/page.h b/include/xen/page.h |
1886 | index 96294ac93755..9dc46cb8a0fd 100644 |
1887 | --- a/include/xen/page.h |
1888 | +++ b/include/xen/page.h |
1889 | @@ -15,9 +15,9 @@ |
1890 | */ |
1891 | |
1892 | #define xen_pfn_to_page(xen_pfn) \ |
1893 | - ((pfn_to_page(((unsigned long)(xen_pfn) << XEN_PAGE_SHIFT) >> PAGE_SHIFT))) |
1894 | + (pfn_to_page((unsigned long)(xen_pfn) >> (PAGE_SHIFT - XEN_PAGE_SHIFT))) |
1895 | #define page_to_xen_pfn(page) \ |
1896 | - (((page_to_pfn(page)) << PAGE_SHIFT) >> XEN_PAGE_SHIFT) |
1897 | + ((page_to_pfn(page)) << (PAGE_SHIFT - XEN_PAGE_SHIFT)) |
1898 | |
1899 | #define XEN_PFN_PER_PAGE (PAGE_SIZE / XEN_PAGE_SIZE) |
1900 | |
1901 | diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c |
1902 | index 05ddc0820771..6f965864cc02 100644 |
1903 | --- a/kernel/trace/trace_events.c |
1904 | +++ b/kernel/trace/trace_events.c |
1905 | @@ -2095,8 +2095,13 @@ event_create_dir(struct dentry *parent, struct trace_event_file *file) |
1906 | trace_create_file("filter", 0644, file->dir, file, |
1907 | &ftrace_event_filter_fops); |
1908 | |
1909 | - trace_create_file("trigger", 0644, file->dir, file, |
1910 | - &event_trigger_fops); |
1911 | + /* |
1912 | + * Only event directories that can be enabled should have |
1913 | + * triggers. |
1914 | + */ |
1915 | + if (!(call->flags & TRACE_EVENT_FL_IGNORE_ENABLE)) |
1916 | + trace_create_file("trigger", 0644, file->dir, file, |
1917 | + &event_trigger_fops); |
1918 | |
1919 | trace_create_file("format", 0444, file->dir, call, |
1920 | &ftrace_event_format_fops); |
1921 | diff --git a/mm/compaction.c b/mm/compaction.c |
1922 | index 585de54dbe8c..29fb26970fba 100644 |
1923 | --- a/mm/compaction.c |
1924 | +++ b/mm/compaction.c |
1925 | @@ -880,16 +880,8 @@ isolate_migratepages_range(struct compact_control *cc, unsigned long start_pfn, |
1926 | pfn = isolate_migratepages_block(cc, pfn, block_end_pfn, |
1927 | ISOLATE_UNEVICTABLE); |
1928 | |
1929 | - /* |
1930 | - * In case of fatal failure, release everything that might |
1931 | - * have been isolated in the previous iteration, and signal |
1932 | - * the failure back to caller. |
1933 | - */ |
1934 | - if (!pfn) { |
1935 | - putback_movable_pages(&cc->migratepages); |
1936 | - cc->nr_migratepages = 0; |
1937 | + if (!pfn) |
1938 | break; |
1939 | - } |
1940 | |
1941 | if (cc->nr_migratepages == COMPACT_CLUSTER_MAX) |
1942 | break; |
1943 | diff --git a/mm/page-writeback.c b/mm/page-writeback.c |
1944 | index 6fe7d15bd1f7..62bbf350ddf7 100644 |
1945 | --- a/mm/page-writeback.c |
1946 | +++ b/mm/page-writeback.c |
1947 | @@ -1909,7 +1909,8 @@ bool wb_over_bg_thresh(struct bdi_writeback *wb) |
1948 | if (gdtc->dirty > gdtc->bg_thresh) |
1949 | return true; |
1950 | |
1951 | - if (wb_stat(wb, WB_RECLAIMABLE) > __wb_calc_thresh(gdtc)) |
1952 | + if (wb_stat(wb, WB_RECLAIMABLE) > |
1953 | + wb_calc_thresh(gdtc->wb, gdtc->bg_thresh)) |
1954 | return true; |
1955 | |
1956 | if (mdtc) { |
1957 | @@ -1923,7 +1924,8 @@ bool wb_over_bg_thresh(struct bdi_writeback *wb) |
1958 | if (mdtc->dirty > mdtc->bg_thresh) |
1959 | return true; |
1960 | |
1961 | - if (wb_stat(wb, WB_RECLAIMABLE) > __wb_calc_thresh(mdtc)) |
1962 | + if (wb_stat(wb, WB_RECLAIMABLE) > |
1963 | + wb_calc_thresh(mdtc->wb, mdtc->bg_thresh)) |
1964 | return true; |
1965 | } |
1966 | |
1967 | diff --git a/mm/page_alloc.c b/mm/page_alloc.c |
1968 | index 9d9044e91ac5..629ce645cffd 100644 |
1969 | --- a/mm/page_alloc.c |
1970 | +++ b/mm/page_alloc.c |
1971 | @@ -6214,7 +6214,7 @@ int __meminit init_per_zone_wmark_min(void) |
1972 | setup_per_zone_inactive_ratio(); |
1973 | return 0; |
1974 | } |
1975 | -module_init(init_per_zone_wmark_min) |
1976 | +core_initcall(init_per_zone_wmark_min) |
1977 | |
1978 | /* |
1979 | * min_free_kbytes_sysctl_handler - just a wrapper around proc_dointvec() so |
1980 | diff --git a/mm/zswap.c b/mm/zswap.c |
1981 | index bf14508afd64..340261946fda 100644 |
1982 | --- a/mm/zswap.c |
1983 | +++ b/mm/zswap.c |
1984 | @@ -170,6 +170,8 @@ static struct zswap_tree *zswap_trees[MAX_SWAPFILES]; |
1985 | static LIST_HEAD(zswap_pools); |
1986 | /* protects zswap_pools list modification */ |
1987 | static DEFINE_SPINLOCK(zswap_pools_lock); |
1988 | +/* pool counter to provide unique names to zpool */ |
1989 | +static atomic_t zswap_pools_count = ATOMIC_INIT(0); |
1990 | |
1991 | /* used by param callback function */ |
1992 | static bool zswap_init_started; |
1993 | @@ -565,6 +567,7 @@ static struct zswap_pool *zswap_pool_find_get(char *type, char *compressor) |
1994 | static struct zswap_pool *zswap_pool_create(char *type, char *compressor) |
1995 | { |
1996 | struct zswap_pool *pool; |
1997 | + char name[38]; /* 'zswap' + 32 char (max) num + \0 */ |
1998 | gfp_t gfp = __GFP_NORETRY | __GFP_NOWARN | __GFP_KSWAPD_RECLAIM; |
1999 | |
2000 | pool = kzalloc(sizeof(*pool), GFP_KERNEL); |
2001 | @@ -573,7 +576,10 @@ static struct zswap_pool *zswap_pool_create(char *type, char *compressor) |
2002 | return NULL; |
2003 | } |
2004 | |
2005 | - pool->zpool = zpool_create_pool(type, "zswap", gfp, &zswap_zpool_ops); |
2006 | + /* unique name for each pool specifically required by zsmalloc */ |
2007 | + snprintf(name, 38, "zswap%x", atomic_inc_return(&zswap_pools_count)); |
2008 | + |
2009 | + pool->zpool = zpool_create_pool(type, name, gfp, &zswap_zpool_ops); |
2010 | if (!pool->zpool) { |
2011 | pr_err("%s zpool not available\n", type); |
2012 | goto error; |
2013 | diff --git a/net/batman-adv/distributed-arp-table.c b/net/batman-adv/distributed-arp-table.c |
2014 | index a49c705fb86b..5f19133c5530 100644 |
2015 | --- a/net/batman-adv/distributed-arp-table.c |
2016 | +++ b/net/batman-adv/distributed-arp-table.c |
2017 | @@ -553,6 +553,7 @@ static void batadv_choose_next_candidate(struct batadv_priv *bat_priv, |
2018 | * be sent to |
2019 | * @bat_priv: the bat priv with all the soft interface information |
2020 | * @ip_dst: ipv4 to look up in the DHT |
2021 | + * @vid: VLAN identifier |
2022 | * |
2023 | * An originator O is selected if and only if its DHT_ID value is one of three |
2024 | * closest values (from the LEFT, with wrap around if needed) then the hash |
2025 | @@ -561,7 +562,8 @@ static void batadv_choose_next_candidate(struct batadv_priv *bat_priv, |
2026 | * Returns the candidate array of size BATADV_DAT_CANDIDATE_NUM. |
2027 | */ |
2028 | static struct batadv_dat_candidate * |
2029 | -batadv_dat_select_candidates(struct batadv_priv *bat_priv, __be32 ip_dst) |
2030 | +batadv_dat_select_candidates(struct batadv_priv *bat_priv, __be32 ip_dst, |
2031 | + unsigned short vid) |
2032 | { |
2033 | int select; |
2034 | batadv_dat_addr_t last_max = BATADV_DAT_ADDR_MAX, ip_key; |
2035 | @@ -577,7 +579,7 @@ batadv_dat_select_candidates(struct batadv_priv *bat_priv, __be32 ip_dst) |
2036 | return NULL; |
2037 | |
2038 | dat.ip = ip_dst; |
2039 | - dat.vid = 0; |
2040 | + dat.vid = vid; |
2041 | ip_key = (batadv_dat_addr_t)batadv_hash_dat(&dat, |
2042 | BATADV_DAT_ADDR_MAX); |
2043 | |
2044 | @@ -597,6 +599,7 @@ batadv_dat_select_candidates(struct batadv_priv *bat_priv, __be32 ip_dst) |
2045 | * @bat_priv: the bat priv with all the soft interface information |
2046 | * @skb: payload to send |
2047 | * @ip: the DHT key |
2048 | + * @vid: VLAN identifier |
2049 | * @packet_subtype: unicast4addr packet subtype to use |
2050 | * |
2051 | * This function copies the skb with pskb_copy() and is sent as unicast packet |
2052 | @@ -607,7 +610,7 @@ batadv_dat_select_candidates(struct batadv_priv *bat_priv, __be32 ip_dst) |
2053 | */ |
2054 | static bool batadv_dat_send_data(struct batadv_priv *bat_priv, |
2055 | struct sk_buff *skb, __be32 ip, |
2056 | - int packet_subtype) |
2057 | + unsigned short vid, int packet_subtype) |
2058 | { |
2059 | int i; |
2060 | bool ret = false; |
2061 | @@ -616,7 +619,7 @@ static bool batadv_dat_send_data(struct batadv_priv *bat_priv, |
2062 | struct sk_buff *tmp_skb; |
2063 | struct batadv_dat_candidate *cand; |
2064 | |
2065 | - cand = batadv_dat_select_candidates(bat_priv, ip); |
2066 | + cand = batadv_dat_select_candidates(bat_priv, ip, vid); |
2067 | if (!cand) |
2068 | goto out; |
2069 | |
2070 | @@ -1004,7 +1007,7 @@ bool batadv_dat_snoop_outgoing_arp_request(struct batadv_priv *bat_priv, |
2071 | ret = true; |
2072 | } else { |
2073 | /* Send the request to the DHT */ |
2074 | - ret = batadv_dat_send_data(bat_priv, skb, ip_dst, |
2075 | + ret = batadv_dat_send_data(bat_priv, skb, ip_dst, vid, |
2076 | BATADV_P_DAT_DHT_GET); |
2077 | } |
2078 | out: |
2079 | @@ -1132,8 +1135,8 @@ void batadv_dat_snoop_outgoing_arp_reply(struct batadv_priv *bat_priv, |
2080 | /* Send the ARP reply to the candidates for both the IP addresses that |
2081 | * the node obtained from the ARP reply |
2082 | */ |
2083 | - batadv_dat_send_data(bat_priv, skb, ip_src, BATADV_P_DAT_DHT_PUT); |
2084 | - batadv_dat_send_data(bat_priv, skb, ip_dst, BATADV_P_DAT_DHT_PUT); |
2085 | + batadv_dat_send_data(bat_priv, skb, ip_src, vid, BATADV_P_DAT_DHT_PUT); |
2086 | + batadv_dat_send_data(bat_priv, skb, ip_dst, vid, BATADV_P_DAT_DHT_PUT); |
2087 | } |
2088 | |
2089 | /** |
2090 | diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c |
2091 | index e4f2646d9246..43d15d6c4b6a 100644 |
2092 | --- a/net/batman-adv/routing.c |
2093 | +++ b/net/batman-adv/routing.c |
2094 | @@ -104,6 +104,15 @@ static void _batadv_update_route(struct batadv_priv *bat_priv, |
2095 | neigh_node = NULL; |
2096 | |
2097 | spin_lock_bh(&orig_node->neigh_list_lock); |
2098 | + /* curr_router used earlier may not be the current orig_ifinfo->router |
2099 | + * anymore because it was dereferenced outside of the neigh_list_lock |
2100 | + * protected region. After the new best neighbor has replace the current |
2101 | + * best neighbor the reference counter needs to decrease. Consequently, |
2102 | + * the code needs to ensure the curr_router variable contains a pointer |
2103 | + * to the replaced best neighbor. |
2104 | + */ |
2105 | + curr_router = rcu_dereference_protected(orig_ifinfo->router, true); |
2106 | + |
2107 | rcu_assign_pointer(orig_ifinfo->router, neigh_node); |
2108 | spin_unlock_bh(&orig_node->neigh_list_lock); |
2109 | batadv_orig_ifinfo_free_ref(orig_ifinfo); |
2110 | diff --git a/net/batman-adv/send.c b/net/batman-adv/send.c |
2111 | index 782fa33ec296..45bfdefa15a5 100644 |
2112 | --- a/net/batman-adv/send.c |
2113 | +++ b/net/batman-adv/send.c |
2114 | @@ -629,6 +629,9 @@ batadv_purge_outstanding_packets(struct batadv_priv *bat_priv, |
2115 | |
2116 | if (pending) { |
2117 | hlist_del(&forw_packet->list); |
2118 | + if (!forw_packet->own) |
2119 | + atomic_inc(&bat_priv->bcast_queue_left); |
2120 | + |
2121 | batadv_forw_packet_free(forw_packet); |
2122 | } |
2123 | } |
2124 | @@ -656,6 +659,9 @@ batadv_purge_outstanding_packets(struct batadv_priv *bat_priv, |
2125 | |
2126 | if (pending) { |
2127 | hlist_del(&forw_packet->list); |
2128 | + if (!forw_packet->own) |
2129 | + atomic_inc(&bat_priv->batman_queue_left); |
2130 | + |
2131 | batadv_forw_packet_free(forw_packet); |
2132 | } |
2133 | } |
2134 | diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c |
2135 | index ac4d08de5df4..720f1a5b81ac 100644 |
2136 | --- a/net/batman-adv/soft-interface.c |
2137 | +++ b/net/batman-adv/soft-interface.c |
2138 | @@ -407,11 +407,17 @@ void batadv_interface_rx(struct net_device *soft_iface, |
2139 | */ |
2140 | nf_reset(skb); |
2141 | |
2142 | + if (unlikely(!pskb_may_pull(skb, ETH_HLEN))) |
2143 | + goto dropped; |
2144 | + |
2145 | vid = batadv_get_vid(skb, 0); |
2146 | ethhdr = eth_hdr(skb); |
2147 | |
2148 | switch (ntohs(ethhdr->h_proto)) { |
2149 | case ETH_P_8021Q: |
2150 | + if (!pskb_may_pull(skb, VLAN_ETH_HLEN)) |
2151 | + goto dropped; |
2152 | + |
2153 | vhdr = (struct vlan_ethhdr *)skb->data; |
2154 | |
2155 | if (vhdr->h_vlan_encapsulated_proto != ethertype) |
2156 | @@ -423,8 +429,6 @@ void batadv_interface_rx(struct net_device *soft_iface, |
2157 | } |
2158 | |
2159 | /* skb->dev & skb->pkt_type are set here */ |
2160 | - if (unlikely(!pskb_may_pull(skb, ETH_HLEN))) |
2161 | - goto dropped; |
2162 | skb->protocol = eth_type_trans(skb, soft_iface); |
2163 | |
2164 | /* should not be necessary anymore as we use skb_pull_rcsum() |
2165 | diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c |
2166 | index 7a2b7915093b..bcb0a1b64556 100644 |
2167 | --- a/net/mac80211/iface.c |
2168 | +++ b/net/mac80211/iface.c |
2169 | @@ -1750,7 +1750,7 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name, |
2170 | |
2171 | ret = dev_alloc_name(ndev, ndev->name); |
2172 | if (ret < 0) { |
2173 | - free_netdev(ndev); |
2174 | + ieee80211_if_free(ndev); |
2175 | return ret; |
2176 | } |
2177 | |
2178 | @@ -1836,7 +1836,7 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name, |
2179 | |
2180 | ret = register_netdevice(ndev); |
2181 | if (ret) { |
2182 | - free_netdev(ndev); |
2183 | + ieee80211_if_free(ndev); |
2184 | return ret; |
2185 | } |
2186 | } |
2187 | diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c |
2188 | index f57b4dcdb233..4da560005b0e 100644 |
2189 | --- a/net/netfilter/ipvs/ip_vs_core.c |
2190 | +++ b/net/netfilter/ipvs/ip_vs_core.c |
2191 | @@ -1757,15 +1757,34 @@ ip_vs_in(struct netns_ipvs *ipvs, unsigned int hooknum, struct sk_buff *skb, int |
2192 | cp = pp->conn_in_get(ipvs, af, skb, &iph); |
2193 | |
2194 | conn_reuse_mode = sysctl_conn_reuse_mode(ipvs); |
2195 | - if (conn_reuse_mode && !iph.fragoffs && |
2196 | - is_new_conn(skb, &iph) && cp && |
2197 | - ((unlikely(sysctl_expire_nodest_conn(ipvs)) && cp->dest && |
2198 | - unlikely(!atomic_read(&cp->dest->weight))) || |
2199 | - unlikely(is_new_conn_expected(cp, conn_reuse_mode)))) { |
2200 | - if (!atomic_read(&cp->n_control)) |
2201 | - ip_vs_conn_expire_now(cp); |
2202 | - __ip_vs_conn_put(cp); |
2203 | - cp = NULL; |
2204 | + if (conn_reuse_mode && !iph.fragoffs && is_new_conn(skb, &iph) && cp) { |
2205 | + bool uses_ct = false, resched = false; |
2206 | + |
2207 | + if (unlikely(sysctl_expire_nodest_conn(ipvs)) && cp->dest && |
2208 | + unlikely(!atomic_read(&cp->dest->weight))) { |
2209 | + resched = true; |
2210 | + uses_ct = ip_vs_conn_uses_conntrack(cp, skb); |
2211 | + } else if (is_new_conn_expected(cp, conn_reuse_mode)) { |
2212 | + uses_ct = ip_vs_conn_uses_conntrack(cp, skb); |
2213 | + if (!atomic_read(&cp->n_control)) { |
2214 | + resched = true; |
2215 | + } else { |
2216 | + /* Do not reschedule controlling connection |
2217 | + * that uses conntrack while it is still |
2218 | + * referenced by controlled connection(s). |
2219 | + */ |
2220 | + resched = !uses_ct; |
2221 | + } |
2222 | + } |
2223 | + |
2224 | + if (resched) { |
2225 | + if (!atomic_read(&cp->n_control)) |
2226 | + ip_vs_conn_expire_now(cp); |
2227 | + __ip_vs_conn_put(cp); |
2228 | + if (uses_ct) |
2229 | + return NF_DROP; |
2230 | + cp = NULL; |
2231 | + } |
2232 | } |
2233 | |
2234 | if (unlikely(!cp)) { |
2235 | diff --git a/net/netfilter/ipvs/ip_vs_pe_sip.c b/net/netfilter/ipvs/ip_vs_pe_sip.c |
2236 | index 1b8d594e493a..0a6eb5c0d9e9 100644 |
2237 | --- a/net/netfilter/ipvs/ip_vs_pe_sip.c |
2238 | +++ b/net/netfilter/ipvs/ip_vs_pe_sip.c |
2239 | @@ -70,10 +70,10 @@ ip_vs_sip_fill_param(struct ip_vs_conn_param *p, struct sk_buff *skb) |
2240 | const char *dptr; |
2241 | int retc; |
2242 | |
2243 | - ip_vs_fill_iph_skb(p->af, skb, false, &iph); |
2244 | + retc = ip_vs_fill_iph_skb(p->af, skb, false, &iph); |
2245 | |
2246 | /* Only useful with UDP */ |
2247 | - if (iph.protocol != IPPROTO_UDP) |
2248 | + if (!retc || iph.protocol != IPPROTO_UDP) |
2249 | return -EINVAL; |
2250 | /* todo: IPv6 fragments: |
2251 | * I think this only should be done for the first fragment. /HS |
2252 | @@ -88,7 +88,7 @@ ip_vs_sip_fill_param(struct ip_vs_conn_param *p, struct sk_buff *skb) |
2253 | dptr = skb->data + dataoff; |
2254 | datalen = skb->len - dataoff; |
2255 | |
2256 | - if (get_callid(dptr, dataoff, datalen, &matchoff, &matchlen)) |
2257 | + if (get_callid(dptr, 0, datalen, &matchoff, &matchlen)) |
2258 | return -EINVAL; |
2259 | |
2260 | /* N.B: pe_data is only set on success, |
2261 | diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c |
2262 | index 161dd0d67da8..a9155077feef 100644 |
2263 | --- a/scripts/mod/file2alias.c |
2264 | +++ b/scripts/mod/file2alias.c |
2265 | @@ -371,6 +371,49 @@ static void do_usb_table(void *symval, unsigned long size, |
2266 | do_usb_entry_multi(symval + i, mod); |
2267 | } |
2268 | |
2269 | +static void do_of_entry_multi(void *symval, struct module *mod) |
2270 | +{ |
2271 | + char alias[500]; |
2272 | + int len; |
2273 | + char *tmp; |
2274 | + |
2275 | + DEF_FIELD_ADDR(symval, of_device_id, name); |
2276 | + DEF_FIELD_ADDR(symval, of_device_id, type); |
2277 | + DEF_FIELD_ADDR(symval, of_device_id, compatible); |
2278 | + |
2279 | + len = sprintf(alias, "of:N%sT%s", (*name)[0] ? *name : "*", |
2280 | + (*type)[0] ? *type : "*"); |
2281 | + |
2282 | + if (compatible[0]) |
2283 | + sprintf(&alias[len], "%sC%s", (*type)[0] ? "*" : "", |
2284 | + *compatible); |
2285 | + |
2286 | + /* Replace all whitespace with underscores */ |
2287 | + for (tmp = alias; tmp && *tmp; tmp++) |
2288 | + if (isspace(*tmp)) |
2289 | + *tmp = '_'; |
2290 | + |
2291 | + buf_printf(&mod->dev_table_buf, "MODULE_ALIAS(\"%s\");\n", alias); |
2292 | + strcat(alias, "C"); |
2293 | + add_wildcard(alias); |
2294 | + buf_printf(&mod->dev_table_buf, "MODULE_ALIAS(\"%s\");\n", alias); |
2295 | +} |
2296 | + |
2297 | +static void do_of_table(void *symval, unsigned long size, |
2298 | + struct module *mod) |
2299 | +{ |
2300 | + unsigned int i; |
2301 | + const unsigned long id_size = SIZE_of_device_id; |
2302 | + |
2303 | + device_id_check(mod->name, "of", size, id_size, symval); |
2304 | + |
2305 | + /* Leave last one: it's the terminator. */ |
2306 | + size -= id_size; |
2307 | + |
2308 | + for (i = 0; i < size; i += id_size) |
2309 | + do_of_entry_multi(symval + i, mod); |
2310 | +} |
2311 | + |
2312 | /* Looks like: hid:bNvNpN */ |
2313 | static int do_hid_entry(const char *filename, |
2314 | void *symval, char *alias) |
2315 | @@ -684,30 +727,6 @@ static int do_pcmcia_entry(const char *filename, |
2316 | } |
2317 | ADD_TO_DEVTABLE("pcmcia", pcmcia_device_id, do_pcmcia_entry); |
2318 | |
2319 | -static int do_of_entry (const char *filename, void *symval, char *alias) |
2320 | -{ |
2321 | - int len; |
2322 | - char *tmp; |
2323 | - DEF_FIELD_ADDR(symval, of_device_id, name); |
2324 | - DEF_FIELD_ADDR(symval, of_device_id, type); |
2325 | - DEF_FIELD_ADDR(symval, of_device_id, compatible); |
2326 | - |
2327 | - len = sprintf(alias, "of:N%sT%s", (*name)[0] ? *name : "*", |
2328 | - (*type)[0] ? *type : "*"); |
2329 | - |
2330 | - if (compatible[0]) |
2331 | - sprintf(&alias[len], "%sC%s", (*type)[0] ? "*" : "", |
2332 | - *compatible); |
2333 | - |
2334 | - /* Replace all whitespace with underscores */ |
2335 | - for (tmp = alias; tmp && *tmp; tmp++) |
2336 | - if (isspace (*tmp)) |
2337 | - *tmp = '_'; |
2338 | - |
2339 | - return 1; |
2340 | -} |
2341 | -ADD_TO_DEVTABLE("of", of_device_id, do_of_entry); |
2342 | - |
2343 | static int do_vio_entry(const char *filename, void *symval, |
2344 | char *alias) |
2345 | { |
2346 | @@ -1348,6 +1367,8 @@ void handle_moddevtable(struct module *mod, struct elf_info *info, |
2347 | /* First handle the "special" cases */ |
2348 | if (sym_is(name, namelen, "usb")) |
2349 | do_usb_table(symval, sym->st_size, mod); |
2350 | + if (sym_is(name, namelen, "of")) |
2351 | + do_of_table(symval, sym->st_size, mod); |
2352 | else if (sym_is(name, namelen, "pnp")) |
2353 | do_pnp_device_entry(symval, sym->st_size, mod); |
2354 | else if (sym_is(name, namelen, "pnp_card")) |