Annotation of /trunk/kernel-alx/patches-4.4/0116-4.4.17-all-fixes.patch
Parent Directory | Revision Log
Revision 2825 -
(hide annotations)
(download)
Tue Sep 13 07:18:15 2016 UTC (8 years ago) by niro
File size: 67407 byte(s)
Tue Sep 13 07:18:15 2016 UTC (8 years ago) by niro
File size: 67407 byte(s)
-linux-4.4.17
1 | niro | 2825 | diff --git a/Makefile b/Makefile |
2 | index da7621cadc8e..76d34f763a41 100644 | ||
3 | --- a/Makefile | ||
4 | +++ b/Makefile | ||
5 | @@ -1,6 +1,6 @@ | ||
6 | VERSION = 4 | ||
7 | PATCHLEVEL = 4 | ||
8 | -SUBLEVEL = 16 | ||
9 | +SUBLEVEL = 17 | ||
10 | EXTRAVERSION = | ||
11 | NAME = Blurry Fish Butt | ||
12 | |||
13 | diff --git a/arch/arc/Makefile b/arch/arc/Makefile | ||
14 | index aeb19021099e..209d8451e23d 100644 | ||
15 | --- a/arch/arc/Makefile | ||
16 | +++ b/arch/arc/Makefile | ||
17 | @@ -48,8 +48,6 @@ endif | ||
18 | |||
19 | endif | ||
20 | |||
21 | -cflags-$(CONFIG_ARC_DW2_UNWIND) += -fasynchronous-unwind-tables | ||
22 | - | ||
23 | # By default gcc 4.8 generates dwarf4 which kernel unwinder can't grok | ||
24 | ifeq ($(atleast_gcc48),y) | ||
25 | cflags-$(CONFIG_ARC_DW2_UNWIND) += -gdwarf-2 | ||
26 | diff --git a/arch/arc/kernel/stacktrace.c b/arch/arc/kernel/stacktrace.c | ||
27 | index 001de4ce711e..11b50959f20e 100644 | ||
28 | --- a/arch/arc/kernel/stacktrace.c | ||
29 | +++ b/arch/arc/kernel/stacktrace.c | ||
30 | @@ -142,7 +142,7 @@ arc_unwind_core(struct task_struct *tsk, struct pt_regs *regs, | ||
31 | * prelogue is setup (callee regs saved and then fp set and not other | ||
32 | * way around | ||
33 | */ | ||
34 | - pr_warn("CONFIG_ARC_DW2_UNWIND needs to be enabled\n"); | ||
35 | + pr_warn_once("CONFIG_ARC_DW2_UNWIND needs to be enabled\n"); | ||
36 | return 0; | ||
37 | |||
38 | #endif | ||
39 | diff --git a/arch/x86/include/asm/pvclock.h b/arch/x86/include/asm/pvclock.h | ||
40 | index 7a6bed5c08bc..baad72e4c100 100644 | ||
41 | --- a/arch/x86/include/asm/pvclock.h | ||
42 | +++ b/arch/x86/include/asm/pvclock.h | ||
43 | @@ -76,6 +76,8 @@ unsigned __pvclock_read_cycles(const struct pvclock_vcpu_time_info *src, | ||
44 | u8 ret_flags; | ||
45 | |||
46 | version = src->version; | ||
47 | + /* Make the latest version visible */ | ||
48 | + smp_rmb(); | ||
49 | |||
50 | offset = pvclock_get_nsec_offset(src); | ||
51 | ret = src->system_time + offset; | ||
52 | diff --git a/arch/x86/kernel/cpu/perf_event_intel_ds.c b/arch/x86/kernel/cpu/perf_event_intel_ds.c | ||
53 | index 7abb2b88572e..1e7de3cefc9c 100644 | ||
54 | --- a/arch/x86/kernel/cpu/perf_event_intel_ds.c | ||
55 | +++ b/arch/x86/kernel/cpu/perf_event_intel_ds.c | ||
56 | @@ -1110,6 +1110,13 @@ get_next_pebs_record_by_bit(void *base, void *top, int bit) | ||
57 | void *at; | ||
58 | u64 pebs_status; | ||
59 | |||
60 | + /* | ||
61 | + * fmt0 does not have a status bitfield (does not use | ||
62 | + * perf_record_nhm format) | ||
63 | + */ | ||
64 | + if (x86_pmu.intel_cap.pebs_format < 1) | ||
65 | + return base; | ||
66 | + | ||
67 | if (base == NULL) | ||
68 | return NULL; | ||
69 | |||
70 | @@ -1195,7 +1202,7 @@ static void intel_pmu_drain_pebs_core(struct pt_regs *iregs) | ||
71 | if (!event->attr.precise_ip) | ||
72 | return; | ||
73 | |||
74 | - n = (top - at) / x86_pmu.pebs_record_size; | ||
75 | + n = top - at; | ||
76 | if (n <= 0) | ||
77 | return; | ||
78 | |||
79 | diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c | ||
80 | index db9a675e751b..9fdf1d330727 100644 | ||
81 | --- a/arch/x86/kernel/early-quirks.c | ||
82 | +++ b/arch/x86/kernel/early-quirks.c | ||
83 | @@ -11,7 +11,11 @@ | ||
84 | |||
85 | #include <linux/pci.h> | ||
86 | #include <linux/acpi.h> | ||
87 | +#include <linux/delay.h> | ||
88 | +#include <linux/dmi.h> | ||
89 | #include <linux/pci_ids.h> | ||
90 | +#include <linux/bcma/bcma.h> | ||
91 | +#include <linux/bcma/bcma_regs.h> | ||
92 | #include <drm/i915_drm.h> | ||
93 | #include <asm/pci-direct.h> | ||
94 | #include <asm/dma.h> | ||
95 | @@ -21,6 +25,9 @@ | ||
96 | #include <asm/iommu.h> | ||
97 | #include <asm/gart.h> | ||
98 | #include <asm/irq_remapping.h> | ||
99 | +#include <asm/early_ioremap.h> | ||
100 | + | ||
101 | +#define dev_err(msg) pr_err("pci 0000:%02x:%02x.%d: %s", bus, slot, func, msg) | ||
102 | |||
103 | static void __init fix_hypertransport_config(int num, int slot, int func) | ||
104 | { | ||
105 | @@ -76,6 +83,13 @@ static void __init nvidia_bugs(int num, int slot, int func) | ||
106 | #ifdef CONFIG_ACPI | ||
107 | #ifdef CONFIG_X86_IO_APIC | ||
108 | /* | ||
109 | + * Only applies to Nvidia root ports (bus 0) and not to | ||
110 | + * Nvidia graphics cards with PCI ports on secondary buses. | ||
111 | + */ | ||
112 | + if (num) | ||
113 | + return; | ||
114 | + | ||
115 | + /* | ||
116 | * All timer overrides on Nvidia are | ||
117 | * wrong unless HPET is enabled. | ||
118 | * Unfortunately that's not true on many Asus boards. | ||
119 | @@ -589,6 +603,61 @@ static void __init force_disable_hpet(int num, int slot, int func) | ||
120 | #endif | ||
121 | } | ||
122 | |||
123 | +#define BCM4331_MMIO_SIZE 16384 | ||
124 | +#define BCM4331_PM_CAP 0x40 | ||
125 | +#define bcma_aread32(reg) ioread32(mmio + 1 * BCMA_CORE_SIZE + reg) | ||
126 | +#define bcma_awrite32(reg, val) iowrite32(val, mmio + 1 * BCMA_CORE_SIZE + reg) | ||
127 | + | ||
128 | +static void __init apple_airport_reset(int bus, int slot, int func) | ||
129 | +{ | ||
130 | + void __iomem *mmio; | ||
131 | + u16 pmcsr; | ||
132 | + u64 addr; | ||
133 | + int i; | ||
134 | + | ||
135 | + if (!dmi_match(DMI_SYS_VENDOR, "Apple Inc.")) | ||
136 | + return; | ||
137 | + | ||
138 | + /* Card may have been put into PCI_D3hot by grub quirk */ | ||
139 | + pmcsr = read_pci_config_16(bus, slot, func, BCM4331_PM_CAP + PCI_PM_CTRL); | ||
140 | + | ||
141 | + if ((pmcsr & PCI_PM_CTRL_STATE_MASK) != PCI_D0) { | ||
142 | + pmcsr &= ~PCI_PM_CTRL_STATE_MASK; | ||
143 | + write_pci_config_16(bus, slot, func, BCM4331_PM_CAP + PCI_PM_CTRL, pmcsr); | ||
144 | + mdelay(10); | ||
145 | + | ||
146 | + pmcsr = read_pci_config_16(bus, slot, func, BCM4331_PM_CAP + PCI_PM_CTRL); | ||
147 | + if ((pmcsr & PCI_PM_CTRL_STATE_MASK) != PCI_D0) { | ||
148 | + dev_err("Cannot power up Apple AirPort card\n"); | ||
149 | + return; | ||
150 | + } | ||
151 | + } | ||
152 | + | ||
153 | + addr = read_pci_config(bus, slot, func, PCI_BASE_ADDRESS_0); | ||
154 | + addr |= (u64)read_pci_config(bus, slot, func, PCI_BASE_ADDRESS_1) << 32; | ||
155 | + addr &= PCI_BASE_ADDRESS_MEM_MASK; | ||
156 | + | ||
157 | + mmio = early_ioremap(addr, BCM4331_MMIO_SIZE); | ||
158 | + if (!mmio) { | ||
159 | + dev_err("Cannot iomap Apple AirPort card\n"); | ||
160 | + return; | ||
161 | + } | ||
162 | + | ||
163 | + pr_info("Resetting Apple AirPort card (left enabled by EFI)\n"); | ||
164 | + | ||
165 | + for (i = 0; bcma_aread32(BCMA_RESET_ST) && i < 30; i++) | ||
166 | + udelay(10); | ||
167 | + | ||
168 | + bcma_awrite32(BCMA_RESET_CTL, BCMA_RESET_CTL_RESET); | ||
169 | + bcma_aread32(BCMA_RESET_CTL); | ||
170 | + udelay(1); | ||
171 | + | ||
172 | + bcma_awrite32(BCMA_RESET_CTL, 0); | ||
173 | + bcma_aread32(BCMA_RESET_CTL); | ||
174 | + udelay(10); | ||
175 | + | ||
176 | + early_iounmap(mmio, BCM4331_MMIO_SIZE); | ||
177 | +} | ||
178 | |||
179 | #define QFLAG_APPLY_ONCE 0x1 | ||
180 | #define QFLAG_APPLIED 0x2 | ||
181 | @@ -602,12 +671,6 @@ struct chipset { | ||
182 | void (*f)(int num, int slot, int func); | ||
183 | }; | ||
184 | |||
185 | -/* | ||
186 | - * Only works for devices on the root bus. If you add any devices | ||
187 | - * not on bus 0 readd another loop level in early_quirks(). But | ||
188 | - * be careful because at least the Nvidia quirk here relies on | ||
189 | - * only matching on bus 0. | ||
190 | - */ | ||
191 | static struct chipset early_qrk[] __initdata = { | ||
192 | { PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID, | ||
193 | PCI_CLASS_BRIDGE_PCI, PCI_ANY_ID, QFLAG_APPLY_ONCE, nvidia_bugs }, | ||
194 | @@ -637,9 +700,13 @@ static struct chipset early_qrk[] __initdata = { | ||
195 | */ | ||
196 | { PCI_VENDOR_ID_INTEL, 0x0f00, | ||
197 | PCI_CLASS_BRIDGE_HOST, PCI_ANY_ID, 0, force_disable_hpet}, | ||
198 | + { PCI_VENDOR_ID_BROADCOM, 0x4331, | ||
199 | + PCI_CLASS_NETWORK_OTHER, PCI_ANY_ID, 0, apple_airport_reset}, | ||
200 | {} | ||
201 | }; | ||
202 | |||
203 | +static void __init early_pci_scan_bus(int bus); | ||
204 | + | ||
205 | /** | ||
206 | * check_dev_quirk - apply early quirks to a given PCI device | ||
207 | * @num: bus number | ||
208 | @@ -648,7 +715,7 @@ static struct chipset early_qrk[] __initdata = { | ||
209 | * | ||
210 | * Check the vendor & device ID against the early quirks table. | ||
211 | * | ||
212 | - * If the device is single function, let early_quirks() know so we don't | ||
213 | + * If the device is single function, let early_pci_scan_bus() know so we don't | ||
214 | * poke at this device again. | ||
215 | */ | ||
216 | static int __init check_dev_quirk(int num, int slot, int func) | ||
217 | @@ -657,6 +724,7 @@ static int __init check_dev_quirk(int num, int slot, int func) | ||
218 | u16 vendor; | ||
219 | u16 device; | ||
220 | u8 type; | ||
221 | + u8 sec; | ||
222 | int i; | ||
223 | |||
224 | class = read_pci_config_16(num, slot, func, PCI_CLASS_DEVICE); | ||
225 | @@ -684,25 +752,36 @@ static int __init check_dev_quirk(int num, int slot, int func) | ||
226 | |||
227 | type = read_pci_config_byte(num, slot, func, | ||
228 | PCI_HEADER_TYPE); | ||
229 | + | ||
230 | + if ((type & 0x7f) == PCI_HEADER_TYPE_BRIDGE) { | ||
231 | + sec = read_pci_config_byte(num, slot, func, PCI_SECONDARY_BUS); | ||
232 | + if (sec > num) | ||
233 | + early_pci_scan_bus(sec); | ||
234 | + } | ||
235 | + | ||
236 | if (!(type & 0x80)) | ||
237 | return -1; | ||
238 | |||
239 | return 0; | ||
240 | } | ||
241 | |||
242 | -void __init early_quirks(void) | ||
243 | +static void __init early_pci_scan_bus(int bus) | ||
244 | { | ||
245 | int slot, func; | ||
246 | |||
247 | - if (!early_pci_allowed()) | ||
248 | - return; | ||
249 | - | ||
250 | /* Poor man's PCI discovery */ | ||
251 | - /* Only scan the root bus */ | ||
252 | for (slot = 0; slot < 32; slot++) | ||
253 | for (func = 0; func < 8; func++) { | ||
254 | /* Only probe function 0 on single fn devices */ | ||
255 | - if (check_dev_quirk(0, slot, func)) | ||
256 | + if (check_dev_quirk(bus, slot, func)) | ||
257 | break; | ||
258 | } | ||
259 | } | ||
260 | + | ||
261 | +void __init early_quirks(void) | ||
262 | +{ | ||
263 | + if (!early_pci_allowed()) | ||
264 | + return; | ||
265 | + | ||
266 | + early_pci_scan_bus(0); | ||
267 | +} | ||
268 | diff --git a/arch/x86/kernel/pvclock.c b/arch/x86/kernel/pvclock.c | ||
269 | index 2f355d229a58..bf0ce75735b0 100644 | ||
270 | --- a/arch/x86/kernel/pvclock.c | ||
271 | +++ b/arch/x86/kernel/pvclock.c | ||
272 | @@ -66,6 +66,8 @@ u8 pvclock_read_flags(struct pvclock_vcpu_time_info *src) | ||
273 | |||
274 | do { | ||
275 | version = __pvclock_read_cycles(src, &ret, &flags); | ||
276 | + /* Make sure that the version double-check is last. */ | ||
277 | + smp_rmb(); | ||
278 | } while ((src->version & 1) || version != src->version); | ||
279 | |||
280 | return flags & valid_flags; | ||
281 | @@ -80,6 +82,8 @@ cycle_t pvclock_clocksource_read(struct pvclock_vcpu_time_info *src) | ||
282 | |||
283 | do { | ||
284 | version = __pvclock_read_cycles(src, &ret, &flags); | ||
285 | + /* Make sure that the version double-check is last. */ | ||
286 | + smp_rmb(); | ||
287 | } while ((src->version & 1) || version != src->version); | ||
288 | |||
289 | if (unlikely((flags & PVCLOCK_GUEST_STOPPED) != 0)) { | ||
290 | diff --git a/block/ioprio.c b/block/ioprio.c | ||
291 | index cc7800e9eb44..01b8116298a1 100644 | ||
292 | --- a/block/ioprio.c | ||
293 | +++ b/block/ioprio.c | ||
294 | @@ -150,8 +150,10 @@ static int get_task_ioprio(struct task_struct *p) | ||
295 | if (ret) | ||
296 | goto out; | ||
297 | ret = IOPRIO_PRIO_VALUE(IOPRIO_CLASS_NONE, IOPRIO_NORM); | ||
298 | + task_lock(p); | ||
299 | if (p->io_context) | ||
300 | ret = p->io_context->ioprio; | ||
301 | + task_unlock(p); | ||
302 | out: | ||
303 | return ret; | ||
304 | } | ||
305 | diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c | ||
306 | index b79cb10e289e..bd370c98f77d 100644 | ||
307 | --- a/drivers/ata/libata-core.c | ||
308 | +++ b/drivers/ata/libata-core.c | ||
309 | @@ -4138,6 +4138,12 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { | ||
310 | */ | ||
311 | { "ST380013AS", "3.20", ATA_HORKAGE_MAX_SEC_1024 }, | ||
312 | |||
313 | + /* | ||
314 | + * Device times out with higher max sects. | ||
315 | + * https://bugzilla.kernel.org/show_bug.cgi?id=121671 | ||
316 | + */ | ||
317 | + { "LITEON CX1-JB256-HP", NULL, ATA_HORKAGE_MAX_SEC_1024 }, | ||
318 | + | ||
319 | /* Devices we expect to fail diagnostics */ | ||
320 | |||
321 | /* Devices where NCQ should be avoided */ | ||
322 | diff --git a/drivers/bcma/bcma_private.h b/drivers/bcma/bcma_private.h | ||
323 | index 38f156745d53..71df8f2afc6c 100644 | ||
324 | --- a/drivers/bcma/bcma_private.h | ||
325 | +++ b/drivers/bcma/bcma_private.h | ||
326 | @@ -8,8 +8,6 @@ | ||
327 | #include <linux/bcma/bcma.h> | ||
328 | #include <linux/delay.h> | ||
329 | |||
330 | -#define BCMA_CORE_SIZE 0x1000 | ||
331 | - | ||
332 | #define bcma_err(bus, fmt, ...) \ | ||
333 | pr_err("bus%d: " fmt, (bus)->num, ##__VA_ARGS__) | ||
334 | #define bcma_warn(bus, fmt, ...) \ | ||
335 | diff --git a/drivers/clk/rockchip/clk-mmc-phase.c b/drivers/clk/rockchip/clk-mmc-phase.c | ||
336 | index 2685644826a0..33c20c6b45af 100644 | ||
337 | --- a/drivers/clk/rockchip/clk-mmc-phase.c | ||
338 | +++ b/drivers/clk/rockchip/clk-mmc-phase.c | ||
339 | @@ -153,6 +153,7 @@ struct clk *rockchip_clk_register_mmc(const char *name, | ||
340 | return NULL; | ||
341 | |||
342 | init.name = name; | ||
343 | + init.flags = 0; | ||
344 | init.num_parents = num_parents; | ||
345 | init.parent_names = parent_names; | ||
346 | init.ops = &rockchip_mmc_clk_ops; | ||
347 | diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c | ||
348 | index 02f9aa4ebe05..e44a1bfb0250 100644 | ||
349 | --- a/drivers/dma/at_xdmac.c | ||
350 | +++ b/drivers/dma/at_xdmac.c | ||
351 | @@ -242,7 +242,7 @@ struct at_xdmac_lld { | ||
352 | u32 mbr_dus; /* Destination Microblock Stride Register */ | ||
353 | }; | ||
354 | |||
355 | - | ||
356 | +/* 64-bit alignment needed to update CNDA and CUBC registers in an atomic way. */ | ||
357 | struct at_xdmac_desc { | ||
358 | struct at_xdmac_lld lld; | ||
359 | enum dma_transfer_direction direction; | ||
360 | @@ -253,7 +253,7 @@ struct at_xdmac_desc { | ||
361 | unsigned int xfer_size; | ||
362 | struct list_head descs_list; | ||
363 | struct list_head xfer_node; | ||
364 | -}; | ||
365 | +} __aligned(sizeof(u64)); | ||
366 | |||
367 | static inline void __iomem *at_xdmac_chan_reg_base(struct at_xdmac *atxdmac, unsigned int chan_nb) | ||
368 | { | ||
369 | @@ -1388,6 +1388,7 @@ at_xdmac_tx_status(struct dma_chan *chan, dma_cookie_t cookie, | ||
370 | u32 cur_nda, check_nda, cur_ubc, mask, value; | ||
371 | u8 dwidth = 0; | ||
372 | unsigned long flags; | ||
373 | + bool initd; | ||
374 | |||
375 | ret = dma_cookie_status(chan, cookie, txstate); | ||
376 | if (ret == DMA_COMPLETE) | ||
377 | @@ -1412,7 +1413,16 @@ at_xdmac_tx_status(struct dma_chan *chan, dma_cookie_t cookie, | ||
378 | residue = desc->xfer_size; | ||
379 | /* | ||
380 | * Flush FIFO: only relevant when the transfer is source peripheral | ||
381 | - * synchronized. | ||
382 | + * synchronized. Flush is needed before reading CUBC because data in | ||
383 | + * the FIFO are not reported by CUBC. Reporting a residue of the | ||
384 | + * transfer length while we have data in FIFO can cause issue. | ||
385 | + * Usecase: atmel USART has a timeout which means I have received | ||
386 | + * characters but there is no more character received for a while. On | ||
387 | + * timeout, it requests the residue. If the data are in the DMA FIFO, | ||
388 | + * we will return a residue of the transfer length. It means no data | ||
389 | + * received. If an application is waiting for these data, it will hang | ||
390 | + * since we won't have another USART timeout without receiving new | ||
391 | + * data. | ||
392 | */ | ||
393 | mask = AT_XDMAC_CC_TYPE | AT_XDMAC_CC_DSYNC; | ||
394 | value = AT_XDMAC_CC_TYPE_PER_TRAN | AT_XDMAC_CC_DSYNC_PER2MEM; | ||
395 | @@ -1423,34 +1433,43 @@ at_xdmac_tx_status(struct dma_chan *chan, dma_cookie_t cookie, | ||
396 | } | ||
397 | |||
398 | /* | ||
399 | - * When processing the residue, we need to read two registers but we | ||
400 | - * can't do it in an atomic way. AT_XDMAC_CNDA is used to find where | ||
401 | - * we stand in the descriptor list and AT_XDMAC_CUBC is used | ||
402 | - * to know how many data are remaining for the current descriptor. | ||
403 | - * Since the dma channel is not paused to not loose data, between the | ||
404 | - * AT_XDMAC_CNDA and AT_XDMAC_CUBC read, we may have change of | ||
405 | - * descriptor. | ||
406 | - * For that reason, after reading AT_XDMAC_CUBC, we check if we are | ||
407 | - * still using the same descriptor by reading a second time | ||
408 | - * AT_XDMAC_CNDA. If AT_XDMAC_CNDA has changed, it means we have to | ||
409 | - * read again AT_XDMAC_CUBC. | ||
410 | + * The easiest way to compute the residue should be to pause the DMA | ||
411 | + * but doing this can lead to miss some data as some devices don't | ||
412 | + * have FIFO. | ||
413 | + * We need to read several registers because: | ||
414 | + * - DMA is running therefore a descriptor change is possible while | ||
415 | + * reading these registers | ||
416 | + * - When the block transfer is done, the value of the CUBC register | ||
417 | + * is set to its initial value until the fetch of the next descriptor. | ||
418 | + * This value will corrupt the residue calculation so we have to skip | ||
419 | + * it. | ||
420 | + * | ||
421 | + * INITD -------- ------------ | ||
422 | + * |____________________| | ||
423 | + * _______________________ _______________ | ||
424 | + * NDA @desc2 \/ @desc3 | ||
425 | + * _______________________/\_______________ | ||
426 | + * __________ ___________ _______________ | ||
427 | + * CUBC 0 \/ MAX desc1 \/ MAX desc2 | ||
428 | + * __________/\___________/\_______________ | ||
429 | + * | ||
430 | + * Since descriptors are aligned on 64 bits, we can assume that | ||
431 | + * the update of NDA and CUBC is atomic. | ||
432 | * Memory barriers are used to ensure the read order of the registers. | ||
433 | - * A max number of retries is set because unlikely it can never ends if | ||
434 | - * we are transferring a lot of data with small buffers. | ||
435 | + * A max number of retries is set because unlikely it could never ends. | ||
436 | */ | ||
437 | - cur_nda = at_xdmac_chan_read(atchan, AT_XDMAC_CNDA) & 0xfffffffc; | ||
438 | - rmb(); | ||
439 | - cur_ubc = at_xdmac_chan_read(atchan, AT_XDMAC_CUBC); | ||
440 | for (retry = 0; retry < AT_XDMAC_RESIDUE_MAX_RETRIES; retry++) { | ||
441 | - rmb(); | ||
442 | check_nda = at_xdmac_chan_read(atchan, AT_XDMAC_CNDA) & 0xfffffffc; | ||
443 | - | ||
444 | - if (likely(cur_nda == check_nda)) | ||
445 | - break; | ||
446 | - | ||
447 | - cur_nda = check_nda; | ||
448 | + rmb(); | ||
449 | + initd = !!(at_xdmac_chan_read(atchan, AT_XDMAC_CC) & AT_XDMAC_CC_INITD); | ||
450 | rmb(); | ||
451 | cur_ubc = at_xdmac_chan_read(atchan, AT_XDMAC_CUBC); | ||
452 | + rmb(); | ||
453 | + cur_nda = at_xdmac_chan_read(atchan, AT_XDMAC_CNDA) & 0xfffffffc; | ||
454 | + rmb(); | ||
455 | + | ||
456 | + if ((check_nda == cur_nda) && initd) | ||
457 | + break; | ||
458 | } | ||
459 | |||
460 | if (unlikely(retry >= AT_XDMAC_RESIDUE_MAX_RETRIES)) { | ||
461 | @@ -1459,6 +1478,19 @@ at_xdmac_tx_status(struct dma_chan *chan, dma_cookie_t cookie, | ||
462 | } | ||
463 | |||
464 | /* | ||
465 | + * Flush FIFO: only relevant when the transfer is source peripheral | ||
466 | + * synchronized. Another flush is needed here because CUBC is updated | ||
467 | + * when the controller sends the data write command. It can lead to | ||
468 | + * report data that are not written in the memory or the device. The | ||
469 | + * FIFO flush ensures that data are really written. | ||
470 | + */ | ||
471 | + if ((desc->lld.mbr_cfg & mask) == value) { | ||
472 | + at_xdmac_write(atxdmac, AT_XDMAC_GSWF, atchan->mask); | ||
473 | + while (!(at_xdmac_chan_read(atchan, AT_XDMAC_CIS) & AT_XDMAC_CIS_FIS)) | ||
474 | + cpu_relax(); | ||
475 | + } | ||
476 | + | ||
477 | + /* | ||
478 | * Remove size of all microblocks already transferred and the current | ||
479 | * one. Then add the remaining size to transfer of the current | ||
480 | * microblock. | ||
481 | diff --git a/drivers/hwtracing/intel_th/core.c b/drivers/hwtracing/intel_th/core.c | ||
482 | index 165d3001c301..c6ec5c62b7a9 100644 | ||
483 | --- a/drivers/hwtracing/intel_th/core.c | ||
484 | +++ b/drivers/hwtracing/intel_th/core.c | ||
485 | @@ -419,6 +419,38 @@ static struct intel_th_subdevice { | ||
486 | }, | ||
487 | }; | ||
488 | |||
489 | +#ifdef CONFIG_MODULES | ||
490 | +static void __intel_th_request_hub_module(struct work_struct *work) | ||
491 | +{ | ||
492 | + struct intel_th *th = container_of(work, struct intel_th, | ||
493 | + request_module_work); | ||
494 | + | ||
495 | + request_module("intel_th_%s", th->hub->name); | ||
496 | +} | ||
497 | + | ||
498 | +static int intel_th_request_hub_module(struct intel_th *th) | ||
499 | +{ | ||
500 | + INIT_WORK(&th->request_module_work, __intel_th_request_hub_module); | ||
501 | + schedule_work(&th->request_module_work); | ||
502 | + | ||
503 | + return 0; | ||
504 | +} | ||
505 | + | ||
506 | +static void intel_th_request_hub_module_flush(struct intel_th *th) | ||
507 | +{ | ||
508 | + flush_work(&th->request_module_work); | ||
509 | +} | ||
510 | +#else | ||
511 | +static inline int intel_th_request_hub_module(struct intel_th *th) | ||
512 | +{ | ||
513 | + return -EINVAL; | ||
514 | +} | ||
515 | + | ||
516 | +static inline void intel_th_request_hub_module_flush(struct intel_th *th) | ||
517 | +{ | ||
518 | +} | ||
519 | +#endif /* CONFIG_MODULES */ | ||
520 | + | ||
521 | static int intel_th_populate(struct intel_th *th, struct resource *devres, | ||
522 | unsigned int ndevres, int irq) | ||
523 | { | ||
524 | @@ -488,7 +520,7 @@ static int intel_th_populate(struct intel_th *th, struct resource *devres, | ||
525 | /* need switch driver to be loaded to enumerate the rest */ | ||
526 | if (subdev->type == INTEL_TH_SWITCH && !req) { | ||
527 | th->hub = thdev; | ||
528 | - err = request_module("intel_th_%s", subdev->name); | ||
529 | + err = intel_th_request_hub_module(th); | ||
530 | if (!err) | ||
531 | req++; | ||
532 | } | ||
533 | @@ -603,6 +635,7 @@ void intel_th_free(struct intel_th *th) | ||
534 | { | ||
535 | int i; | ||
536 | |||
537 | + intel_th_request_hub_module_flush(th); | ||
538 | for (i = 0; i < TH_SUBDEVICE_MAX; i++) | ||
539 | if (th->thdev[i] != th->hub) | ||
540 | intel_th_device_remove(th->thdev[i]); | ||
541 | diff --git a/drivers/hwtracing/intel_th/intel_th.h b/drivers/hwtracing/intel_th/intel_th.h | ||
542 | index 57fd72b20fae..d03a6cd1c65d 100644 | ||
543 | --- a/drivers/hwtracing/intel_th/intel_th.h | ||
544 | +++ b/drivers/hwtracing/intel_th/intel_th.h | ||
545 | @@ -197,6 +197,9 @@ struct intel_th { | ||
546 | |||
547 | int id; | ||
548 | int major; | ||
549 | +#ifdef CONFIG_MODULES | ||
550 | + struct work_struct request_module_work; | ||
551 | +#endif /* CONFIG_MODULES */ | ||
552 | #ifdef CONFIG_INTEL_TH_DEBUG | ||
553 | struct dentry *dbg; | ||
554 | #endif | ||
555 | diff --git a/drivers/hwtracing/intel_th/pci.c b/drivers/hwtracing/intel_th/pci.c | ||
556 | index 641e87936064..d57a2f75dccf 100644 | ||
557 | --- a/drivers/hwtracing/intel_th/pci.c | ||
558 | +++ b/drivers/hwtracing/intel_th/pci.c | ||
559 | @@ -67,6 +67,11 @@ static const struct pci_device_id intel_th_pci_id_table[] = { | ||
560 | PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xa126), | ||
561 | .driver_data = (kernel_ulong_t)0, | ||
562 | }, | ||
563 | + { | ||
564 | + /* Kaby Lake PCH-H */ | ||
565 | + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xa2a6), | ||
566 | + .driver_data = (kernel_ulong_t)0, | ||
567 | + }, | ||
568 | { 0 }, | ||
569 | }; | ||
570 | |||
571 | diff --git a/drivers/i2c/muxes/i2c-mux-reg.c b/drivers/i2c/muxes/i2c-mux-reg.c | ||
572 | index 5fbd5bd0878f..49fc2c7e560a 100644 | ||
573 | --- a/drivers/i2c/muxes/i2c-mux-reg.c | ||
574 | +++ b/drivers/i2c/muxes/i2c-mux-reg.c | ||
575 | @@ -150,7 +150,7 @@ static int i2c_mux_reg_probe_dt(struct regmux *mux, | ||
576 | mux->data.idle_in_use = true; | ||
577 | |||
578 | /* map address from "reg" if exists */ | ||
579 | - if (of_address_to_resource(np, 0, &res)) { | ||
580 | + if (of_address_to_resource(np, 0, &res) == 0) { | ||
581 | mux->data.reg_size = resource_size(&res); | ||
582 | mux->data.reg = devm_ioremap_resource(&pdev->dev, &res); | ||
583 | if (IS_ERR(mux->data.reg)) | ||
584 | diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c | ||
585 | index fd4100d56d8c..2b2f9d66c2c7 100644 | ||
586 | --- a/drivers/input/joystick/xpad.c | ||
587 | +++ b/drivers/input/joystick/xpad.c | ||
588 | @@ -1200,22 +1200,15 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id | ||
589 | int ep_irq_in_idx; | ||
590 | int i, error; | ||
591 | |||
592 | + if (intf->cur_altsetting->desc.bNumEndpoints != 2) | ||
593 | + return -ENODEV; | ||
594 | + | ||
595 | for (i = 0; xpad_device[i].idVendor; i++) { | ||
596 | if ((le16_to_cpu(udev->descriptor.idVendor) == xpad_device[i].idVendor) && | ||
597 | (le16_to_cpu(udev->descriptor.idProduct) == xpad_device[i].idProduct)) | ||
598 | break; | ||
599 | } | ||
600 | |||
601 | - if (xpad_device[i].xtype == XTYPE_XBOXONE && | ||
602 | - intf->cur_altsetting->desc.bInterfaceNumber != 0) { | ||
603 | - /* | ||
604 | - * The Xbox One controller lists three interfaces all with the | ||
605 | - * same interface class, subclass and protocol. Differentiate by | ||
606 | - * interface number. | ||
607 | - */ | ||
608 | - return -ENODEV; | ||
609 | - } | ||
610 | - | ||
611 | xpad = kzalloc(sizeof(struct usb_xpad), GFP_KERNEL); | ||
612 | if (!xpad) | ||
613 | return -ENOMEM; | ||
614 | @@ -1246,6 +1239,8 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id | ||
615 | if (intf->cur_altsetting->desc.bInterfaceClass == USB_CLASS_VENDOR_SPEC) { | ||
616 | if (intf->cur_altsetting->desc.bInterfaceProtocol == 129) | ||
617 | xpad->xtype = XTYPE_XBOX360W; | ||
618 | + else if (intf->cur_altsetting->desc.bInterfaceProtocol == 208) | ||
619 | + xpad->xtype = XTYPE_XBOXONE; | ||
620 | else | ||
621 | xpad->xtype = XTYPE_XBOX360; | ||
622 | } else { | ||
623 | @@ -1260,6 +1255,17 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id | ||
624 | xpad->mapping |= MAP_STICKS_TO_NULL; | ||
625 | } | ||
626 | |||
627 | + if (xpad->xtype == XTYPE_XBOXONE && | ||
628 | + intf->cur_altsetting->desc.bInterfaceNumber != 0) { | ||
629 | + /* | ||
630 | + * The Xbox One controller lists three interfaces all with the | ||
631 | + * same interface class, subclass and protocol. Differentiate by | ||
632 | + * interface number. | ||
633 | + */ | ||
634 | + error = -ENODEV; | ||
635 | + goto err_free_in_urb; | ||
636 | + } | ||
637 | + | ||
638 | error = xpad_init_output(intf, xpad); | ||
639 | if (error) | ||
640 | goto err_free_in_urb; | ||
641 | diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c | ||
642 | index 78f93cf68840..be5b399da5d3 100644 | ||
643 | --- a/drivers/input/mouse/elantech.c | ||
644 | +++ b/drivers/input/mouse/elantech.c | ||
645 | @@ -1568,13 +1568,7 @@ static int elantech_set_properties(struct elantech_data *etd) | ||
646 | case 5: | ||
647 | etd->hw_version = 3; | ||
648 | break; | ||
649 | - case 6: | ||
650 | - case 7: | ||
651 | - case 8: | ||
652 | - case 9: | ||
653 | - case 10: | ||
654 | - case 13: | ||
655 | - case 14: | ||
656 | + case 6 ... 14: | ||
657 | etd->hw_version = 4; | ||
658 | break; | ||
659 | default: | ||
660 | diff --git a/drivers/input/mouse/vmmouse.c b/drivers/input/mouse/vmmouse.c | ||
661 | index a3f0f5a47490..0f586780ceb4 100644 | ||
662 | --- a/drivers/input/mouse/vmmouse.c | ||
663 | +++ b/drivers/input/mouse/vmmouse.c | ||
664 | @@ -355,18 +355,11 @@ int vmmouse_detect(struct psmouse *psmouse, bool set_properties) | ||
665 | return -ENXIO; | ||
666 | } | ||
667 | |||
668 | - if (!request_region(VMMOUSE_PROTO_PORT, 4, "vmmouse")) { | ||
669 | - psmouse_dbg(psmouse, "VMMouse port in use.\n"); | ||
670 | - return -EBUSY; | ||
671 | - } | ||
672 | - | ||
673 | /* Check if the device is present */ | ||
674 | response = ~VMMOUSE_PROTO_MAGIC; | ||
675 | VMMOUSE_CMD(GETVERSION, 0, version, response, dummy1, dummy2); | ||
676 | - if (response != VMMOUSE_PROTO_MAGIC || version == 0xffffffffU) { | ||
677 | - release_region(VMMOUSE_PROTO_PORT, 4); | ||
678 | + if (response != VMMOUSE_PROTO_MAGIC || version == 0xffffffffU) | ||
679 | return -ENXIO; | ||
680 | - } | ||
681 | |||
682 | if (set_properties) { | ||
683 | psmouse->vendor = VMMOUSE_VENDOR; | ||
684 | @@ -374,8 +367,6 @@ int vmmouse_detect(struct psmouse *psmouse, bool set_properties) | ||
685 | psmouse->model = version; | ||
686 | } | ||
687 | |||
688 | - release_region(VMMOUSE_PROTO_PORT, 4); | ||
689 | - | ||
690 | return 0; | ||
691 | } | ||
692 | |||
693 | @@ -394,7 +385,6 @@ static void vmmouse_disconnect(struct psmouse *psmouse) | ||
694 | psmouse_reset(psmouse); | ||
695 | input_unregister_device(priv->abs_dev); | ||
696 | kfree(priv); | ||
697 | - release_region(VMMOUSE_PROTO_PORT, 4); | ||
698 | } | ||
699 | |||
700 | /** | ||
701 | @@ -438,15 +428,10 @@ int vmmouse_init(struct psmouse *psmouse) | ||
702 | struct input_dev *rel_dev = psmouse->dev, *abs_dev; | ||
703 | int error; | ||
704 | |||
705 | - if (!request_region(VMMOUSE_PROTO_PORT, 4, "vmmouse")) { | ||
706 | - psmouse_dbg(psmouse, "VMMouse port in use.\n"); | ||
707 | - return -EBUSY; | ||
708 | - } | ||
709 | - | ||
710 | psmouse_reset(psmouse); | ||
711 | error = vmmouse_enable(psmouse); | ||
712 | if (error) | ||
713 | - goto release_region; | ||
714 | + return error; | ||
715 | |||
716 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); | ||
717 | abs_dev = input_allocate_device(); | ||
718 | @@ -502,8 +487,5 @@ init_fail: | ||
719 | kfree(priv); | ||
720 | psmouse->private = NULL; | ||
721 | |||
722 | -release_region: | ||
723 | - release_region(VMMOUSE_PROTO_PORT, 4); | ||
724 | - | ||
725 | return error; | ||
726 | } | ||
727 | diff --git a/drivers/input/touchscreen/tsc2004.c b/drivers/input/touchscreen/tsc2004.c | ||
728 | index 7295c198aa08..6fe55d598fac 100644 | ||
729 | --- a/drivers/input/touchscreen/tsc2004.c | ||
730 | +++ b/drivers/input/touchscreen/tsc2004.c | ||
731 | @@ -22,6 +22,11 @@ | ||
732 | #include <linux/regmap.h> | ||
733 | #include "tsc200x-core.h" | ||
734 | |||
735 | +static const struct input_id tsc2004_input_id = { | ||
736 | + .bustype = BUS_I2C, | ||
737 | + .product = 2004, | ||
738 | +}; | ||
739 | + | ||
740 | static int tsc2004_cmd(struct device *dev, u8 cmd) | ||
741 | { | ||
742 | u8 tx = TSC200X_CMD | TSC200X_CMD_12BIT | cmd; | ||
743 | @@ -42,7 +47,7 @@ static int tsc2004_probe(struct i2c_client *i2c, | ||
744 | const struct i2c_device_id *id) | ||
745 | |||
746 | { | ||
747 | - return tsc200x_probe(&i2c->dev, i2c->irq, BUS_I2C, | ||
748 | + return tsc200x_probe(&i2c->dev, i2c->irq, &tsc2004_input_id, | ||
749 | devm_regmap_init_i2c(i2c, &tsc200x_regmap_config), | ||
750 | tsc2004_cmd); | ||
751 | } | ||
752 | diff --git a/drivers/input/touchscreen/tsc2005.c b/drivers/input/touchscreen/tsc2005.c | ||
753 | index b9f593dfd2ef..f2c5f0e47f77 100644 | ||
754 | --- a/drivers/input/touchscreen/tsc2005.c | ||
755 | +++ b/drivers/input/touchscreen/tsc2005.c | ||
756 | @@ -24,6 +24,11 @@ | ||
757 | #include <linux/regmap.h> | ||
758 | #include "tsc200x-core.h" | ||
759 | |||
760 | +static const struct input_id tsc2005_input_id = { | ||
761 | + .bustype = BUS_SPI, | ||
762 | + .product = 2005, | ||
763 | +}; | ||
764 | + | ||
765 | static int tsc2005_cmd(struct device *dev, u8 cmd) | ||
766 | { | ||
767 | u8 tx = TSC200X_CMD | TSC200X_CMD_12BIT | cmd; | ||
768 | @@ -62,7 +67,7 @@ static int tsc2005_probe(struct spi_device *spi) | ||
769 | if (error) | ||
770 | return error; | ||
771 | |||
772 | - return tsc200x_probe(&spi->dev, spi->irq, BUS_SPI, | ||
773 | + return tsc200x_probe(&spi->dev, spi->irq, &tsc2005_input_id, | ||
774 | devm_regmap_init_spi(spi, &tsc200x_regmap_config), | ||
775 | tsc2005_cmd); | ||
776 | } | ||
777 | diff --git a/drivers/input/touchscreen/tsc200x-core.c b/drivers/input/touchscreen/tsc200x-core.c | ||
778 | index 15240c1ee850..dfa7f1c4f545 100644 | ||
779 | --- a/drivers/input/touchscreen/tsc200x-core.c | ||
780 | +++ b/drivers/input/touchscreen/tsc200x-core.c | ||
781 | @@ -450,7 +450,7 @@ static void tsc200x_close(struct input_dev *input) | ||
782 | mutex_unlock(&ts->mutex); | ||
783 | } | ||
784 | |||
785 | -int tsc200x_probe(struct device *dev, int irq, __u16 bustype, | ||
786 | +int tsc200x_probe(struct device *dev, int irq, const struct input_id *tsc_id, | ||
787 | struct regmap *regmap, | ||
788 | int (*tsc200x_cmd)(struct device *dev, u8 cmd)) | ||
789 | { | ||
790 | @@ -547,9 +547,18 @@ int tsc200x_probe(struct device *dev, int irq, __u16 bustype, | ||
791 | snprintf(ts->phys, sizeof(ts->phys), | ||
792 | "%s/input-ts", dev_name(dev)); | ||
793 | |||
794 | - input_dev->name = "TSC200X touchscreen"; | ||
795 | + if (tsc_id->product == 2004) { | ||
796 | + input_dev->name = "TSC200X touchscreen"; | ||
797 | + } else { | ||
798 | + input_dev->name = devm_kasprintf(dev, GFP_KERNEL, | ||
799 | + "TSC%04d touchscreen", | ||
800 | + tsc_id->product); | ||
801 | + if (!input_dev->name) | ||
802 | + return -ENOMEM; | ||
803 | + } | ||
804 | + | ||
805 | input_dev->phys = ts->phys; | ||
806 | - input_dev->id.bustype = bustype; | ||
807 | + input_dev->id = *tsc_id; | ||
808 | input_dev->dev.parent = dev; | ||
809 | input_dev->evbit[0] = BIT(EV_ABS) | BIT(EV_KEY); | ||
810 | input_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH); | ||
811 | diff --git a/drivers/input/touchscreen/tsc200x-core.h b/drivers/input/touchscreen/tsc200x-core.h | ||
812 | index 7a482d102614..49a63a3c6840 100644 | ||
813 | --- a/drivers/input/touchscreen/tsc200x-core.h | ||
814 | +++ b/drivers/input/touchscreen/tsc200x-core.h | ||
815 | @@ -70,7 +70,7 @@ | ||
816 | extern const struct regmap_config tsc200x_regmap_config; | ||
817 | extern const struct dev_pm_ops tsc200x_pm_ops; | ||
818 | |||
819 | -int tsc200x_probe(struct device *dev, int irq, __u16 bustype, | ||
820 | +int tsc200x_probe(struct device *dev, int irq, const struct input_id *tsc_id, | ||
821 | struct regmap *regmap, | ||
822 | int (*tsc200x_cmd)(struct device *dev, u8 cmd)); | ||
823 | int tsc200x_remove(struct device *dev); | ||
824 | diff --git a/drivers/input/touchscreen/wacom_w8001.c b/drivers/input/touchscreen/wacom_w8001.c | ||
825 | index 2792ca397dd0..3ed0ce1e4dcb 100644 | ||
826 | --- a/drivers/input/touchscreen/wacom_w8001.c | ||
827 | +++ b/drivers/input/touchscreen/wacom_w8001.c | ||
828 | @@ -27,7 +27,7 @@ MODULE_AUTHOR("Jaya Kumar <jayakumar.lkml@gmail.com>"); | ||
829 | MODULE_DESCRIPTION(DRIVER_DESC); | ||
830 | MODULE_LICENSE("GPL"); | ||
831 | |||
832 | -#define W8001_MAX_LENGTH 11 | ||
833 | +#define W8001_MAX_LENGTH 13 | ||
834 | #define W8001_LEAD_MASK 0x80 | ||
835 | #define W8001_LEAD_BYTE 0x80 | ||
836 | #define W8001_TAB_MASK 0x40 | ||
837 | diff --git a/drivers/media/usb/airspy/airspy.c b/drivers/media/usb/airspy/airspy.c | ||
838 | index 565a59310747..34b35ebd60ac 100644 | ||
839 | --- a/drivers/media/usb/airspy/airspy.c | ||
840 | +++ b/drivers/media/usb/airspy/airspy.c | ||
841 | @@ -1073,7 +1073,7 @@ static int airspy_probe(struct usb_interface *intf, | ||
842 | if (ret) { | ||
843 | dev_err(s->dev, "Failed to register as video device (%d)\n", | ||
844 | ret); | ||
845 | - goto err_unregister_v4l2_dev; | ||
846 | + goto err_free_controls; | ||
847 | } | ||
848 | dev_info(s->dev, "Registered as %s\n", | ||
849 | video_device_node_name(&s->vdev)); | ||
850 | @@ -1082,7 +1082,6 @@ static int airspy_probe(struct usb_interface *intf, | ||
851 | |||
852 | err_free_controls: | ||
853 | v4l2_ctrl_handler_free(&s->hdl); | ||
854 | -err_unregister_v4l2_dev: | ||
855 | v4l2_device_unregister(&s->v4l2_dev); | ||
856 | err_free_mem: | ||
857 | kfree(s); | ||
858 | diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c | ||
859 | index c641c202fe7e..64950035613b 100644 | ||
860 | --- a/drivers/mmc/card/block.c | ||
861 | +++ b/drivers/mmc/card/block.c | ||
862 | @@ -1767,8 +1767,8 @@ static void mmc_blk_packed_hdr_wrq_prep(struct mmc_queue_req *mqrq, | ||
863 | |||
864 | packed_cmd_hdr = packed->cmd_hdr; | ||
865 | memset(packed_cmd_hdr, 0, sizeof(packed->cmd_hdr)); | ||
866 | - packed_cmd_hdr[0] = (packed->nr_entries << 16) | | ||
867 | - (PACKED_CMD_WR << 8) | PACKED_CMD_VER; | ||
868 | + packed_cmd_hdr[0] = cpu_to_le32((packed->nr_entries << 16) | | ||
869 | + (PACKED_CMD_WR << 8) | PACKED_CMD_VER); | ||
870 | hdr_blocks = mmc_large_sector(card) ? 8 : 1; | ||
871 | |||
872 | /* | ||
873 | @@ -1782,14 +1782,14 @@ static void mmc_blk_packed_hdr_wrq_prep(struct mmc_queue_req *mqrq, | ||
874 | ((brq->data.blocks * brq->data.blksz) >= | ||
875 | card->ext_csd.data_tag_unit_size); | ||
876 | /* Argument of CMD23 */ | ||
877 | - packed_cmd_hdr[(i * 2)] = | ||
878 | + packed_cmd_hdr[(i * 2)] = cpu_to_le32( | ||
879 | (do_rel_wr ? MMC_CMD23_ARG_REL_WR : 0) | | ||
880 | (do_data_tag ? MMC_CMD23_ARG_TAG_REQ : 0) | | ||
881 | - blk_rq_sectors(prq); | ||
882 | + blk_rq_sectors(prq)); | ||
883 | /* Argument of CMD18 or CMD25 */ | ||
884 | - packed_cmd_hdr[((i * 2)) + 1] = | ||
885 | + packed_cmd_hdr[((i * 2)) + 1] = cpu_to_le32( | ||
886 | mmc_card_blockaddr(card) ? | ||
887 | - blk_rq_pos(prq) : blk_rq_pos(prq) << 9; | ||
888 | + blk_rq_pos(prq) : blk_rq_pos(prq) << 9); | ||
889 | packed->blocks += blk_rq_sectors(prq); | ||
890 | i++; | ||
891 | } | ||
892 | diff --git a/drivers/net/can/at91_can.c b/drivers/net/can/at91_can.c | ||
893 | index 8b3275d7792a..8f5e93cb7975 100644 | ||
894 | --- a/drivers/net/can/at91_can.c | ||
895 | +++ b/drivers/net/can/at91_can.c | ||
896 | @@ -712,9 +712,10 @@ static int at91_poll_rx(struct net_device *dev, int quota) | ||
897 | |||
898 | /* upper group completed, look again in lower */ | ||
899 | if (priv->rx_next > get_mb_rx_low_last(priv) && | ||
900 | - quota > 0 && mb > get_mb_rx_last(priv)) { | ||
901 | + mb > get_mb_rx_last(priv)) { | ||
902 | priv->rx_next = get_mb_rx_first(priv); | ||
903 | - goto again; | ||
904 | + if (quota > 0) | ||
905 | + goto again; | ||
906 | } | ||
907 | |||
908 | return received; | ||
909 | diff --git a/drivers/net/can/c_can/c_can.c b/drivers/net/can/c_can/c_can.c | ||
910 | index f91b094288da..e3dccd3200d5 100644 | ||
911 | --- a/drivers/net/can/c_can/c_can.c | ||
912 | +++ b/drivers/net/can/c_can/c_can.c | ||
913 | @@ -332,9 +332,23 @@ static void c_can_setup_tx_object(struct net_device *dev, int iface, | ||
914 | |||
915 | priv->write_reg(priv, C_CAN_IFACE(MSGCTRL_REG, iface), ctrl); | ||
916 | |||
917 | - for (i = 0; i < frame->can_dlc; i += 2) { | ||
918 | - priv->write_reg(priv, C_CAN_IFACE(DATA1_REG, iface) + i / 2, | ||
919 | - frame->data[i] | (frame->data[i + 1] << 8)); | ||
920 | + if (priv->type == BOSCH_D_CAN) { | ||
921 | + u32 data = 0, dreg = C_CAN_IFACE(DATA1_REG, iface); | ||
922 | + | ||
923 | + for (i = 0; i < frame->can_dlc; i += 4, dreg += 2) { | ||
924 | + data = (u32)frame->data[i]; | ||
925 | + data |= (u32)frame->data[i + 1] << 8; | ||
926 | + data |= (u32)frame->data[i + 2] << 16; | ||
927 | + data |= (u32)frame->data[i + 3] << 24; | ||
928 | + priv->write_reg32(priv, dreg, data); | ||
929 | + } | ||
930 | + } else { | ||
931 | + for (i = 0; i < frame->can_dlc; i += 2) { | ||
932 | + priv->write_reg(priv, | ||
933 | + C_CAN_IFACE(DATA1_REG, iface) + i / 2, | ||
934 | + frame->data[i] | | ||
935 | + (frame->data[i + 1] << 8)); | ||
936 | + } | ||
937 | } | ||
938 | } | ||
939 | |||
940 | @@ -402,10 +416,20 @@ static int c_can_read_msg_object(struct net_device *dev, int iface, u32 ctrl) | ||
941 | } else { | ||
942 | int i, dreg = C_CAN_IFACE(DATA1_REG, iface); | ||
943 | |||
944 | - for (i = 0; i < frame->can_dlc; i += 2, dreg ++) { | ||
945 | - data = priv->read_reg(priv, dreg); | ||
946 | - frame->data[i] = data; | ||
947 | - frame->data[i + 1] = data >> 8; | ||
948 | + if (priv->type == BOSCH_D_CAN) { | ||
949 | + for (i = 0; i < frame->can_dlc; i += 4, dreg += 2) { | ||
950 | + data = priv->read_reg32(priv, dreg); | ||
951 | + frame->data[i] = data; | ||
952 | + frame->data[i + 1] = data >> 8; | ||
953 | + frame->data[i + 2] = data >> 16; | ||
954 | + frame->data[i + 3] = data >> 24; | ||
955 | + } | ||
956 | + } else { | ||
957 | + for (i = 0; i < frame->can_dlc; i += 2, dreg++) { | ||
958 | + data = priv->read_reg(priv, dreg); | ||
959 | + frame->data[i] = data; | ||
960 | + frame->data[i + 1] = data >> 8; | ||
961 | + } | ||
962 | } | ||
963 | } | ||
964 | |||
965 | diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c | ||
966 | index 910c12e2638e..ad535a854e5c 100644 | ||
967 | --- a/drivers/net/can/dev.c | ||
968 | +++ b/drivers/net/can/dev.c | ||
969 | @@ -798,6 +798,9 @@ static int can_validate(struct nlattr *tb[], struct nlattr *data[]) | ||
970 | * - control mode with CAN_CTRLMODE_FD set | ||
971 | */ | ||
972 | |||
973 | + if (!data) | ||
974 | + return 0; | ||
975 | + | ||
976 | if (data[IFLA_CAN_CTRLMODE]) { | ||
977 | struct can_ctrlmode *cm = nla_data(data[IFLA_CAN_CTRLMODE]); | ||
978 | |||
979 | @@ -1008,6 +1011,11 @@ static int can_newlink(struct net *src_net, struct net_device *dev, | ||
980 | return -EOPNOTSUPP; | ||
981 | } | ||
982 | |||
983 | +static void can_dellink(struct net_device *dev, struct list_head *head) | ||
984 | +{ | ||
985 | + return; | ||
986 | +} | ||
987 | + | ||
988 | static struct rtnl_link_ops can_link_ops __read_mostly = { | ||
989 | .kind = "can", | ||
990 | .maxtype = IFLA_CAN_MAX, | ||
991 | @@ -1016,6 +1024,7 @@ static struct rtnl_link_ops can_link_ops __read_mostly = { | ||
992 | .validate = can_validate, | ||
993 | .newlink = can_newlink, | ||
994 | .changelink = can_changelink, | ||
995 | + .dellink = can_dellink, | ||
996 | .get_size = can_get_size, | ||
997 | .fill_info = can_fill_info, | ||
998 | .get_xstats_size = can_get_xstats_size, | ||
999 | diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c | ||
1000 | index a4ac6fedac75..71ec9cb08e06 100644 | ||
1001 | --- a/drivers/net/ethernet/marvell/mvneta.c | ||
1002 | +++ b/drivers/net/ethernet/marvell/mvneta.c | ||
1003 | @@ -226,7 +226,7 @@ | ||
1004 | /* Various constants */ | ||
1005 | |||
1006 | /* Coalescing */ | ||
1007 | -#define MVNETA_TXDONE_COAL_PKTS 1 | ||
1008 | +#define MVNETA_TXDONE_COAL_PKTS 0 /* interrupt per packet */ | ||
1009 | #define MVNETA_RX_COAL_PKTS 32 | ||
1010 | #define MVNETA_RX_COAL_USEC 100 | ||
1011 | |||
1012 | diff --git a/drivers/pinctrl/freescale/pinctrl-imx.c b/drivers/pinctrl/freescale/pinctrl-imx.c | ||
1013 | index 1029aa7889b5..398ec45aadef 100644 | ||
1014 | --- a/drivers/pinctrl/freescale/pinctrl-imx.c | ||
1015 | +++ b/drivers/pinctrl/freescale/pinctrl-imx.c | ||
1016 | @@ -207,9 +207,9 @@ static int imx_pmx_set(struct pinctrl_dev *pctldev, unsigned selector, | ||
1017 | pin_reg = &info->pin_regs[pin_id]; | ||
1018 | |||
1019 | if (pin_reg->mux_reg == -1) { | ||
1020 | - dev_err(ipctl->dev, "Pin(%s) does not support mux function\n", | ||
1021 | + dev_dbg(ipctl->dev, "Pin(%s) does not support mux function\n", | ||
1022 | info->pins[pin_id].name); | ||
1023 | - return -EINVAL; | ||
1024 | + continue; | ||
1025 | } | ||
1026 | |||
1027 | if (info->flags & SHARE_MUX_CONF_REG) { | ||
1028 | diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c | ||
1029 | index 23b6b8c29a99..73d8d47ea465 100644 | ||
1030 | --- a/drivers/pinctrl/pinctrl-single.c | ||
1031 | +++ b/drivers/pinctrl/pinctrl-single.c | ||
1032 | @@ -1576,6 +1576,9 @@ static inline void pcs_irq_set(struct pcs_soc_data *pcs_soc, | ||
1033 | else | ||
1034 | mask &= ~soc_mask; | ||
1035 | pcs->write(mask, pcswi->reg); | ||
1036 | + | ||
1037 | + /* flush posted write */ | ||
1038 | + mask = pcs->read(pcswi->reg); | ||
1039 | raw_spin_unlock(&pcs->lock); | ||
1040 | } | ||
1041 | |||
1042 | diff --git a/drivers/platform/chrome/cros_ec_dev.c b/drivers/platform/chrome/cros_ec_dev.c | ||
1043 | index d45cd254ed1c..2b331d5b9e79 100644 | ||
1044 | --- a/drivers/platform/chrome/cros_ec_dev.c | ||
1045 | +++ b/drivers/platform/chrome/cros_ec_dev.c | ||
1046 | @@ -147,13 +147,19 @@ static long ec_device_ioctl_xcmd(struct cros_ec_dev *ec, void __user *arg) | ||
1047 | goto exit; | ||
1048 | } | ||
1049 | |||
1050 | + if (u_cmd.outsize != s_cmd->outsize || | ||
1051 | + u_cmd.insize != s_cmd->insize) { | ||
1052 | + ret = -EINVAL; | ||
1053 | + goto exit; | ||
1054 | + } | ||
1055 | + | ||
1056 | s_cmd->command += ec->cmd_offset; | ||
1057 | ret = cros_ec_cmd_xfer(ec->ec_dev, s_cmd); | ||
1058 | /* Only copy data to userland if data was received. */ | ||
1059 | if (ret < 0) | ||
1060 | goto exit; | ||
1061 | |||
1062 | - if (copy_to_user(arg, s_cmd, sizeof(*s_cmd) + u_cmd.insize)) | ||
1063 | + if (copy_to_user(arg, s_cmd, sizeof(*s_cmd) + s_cmd->insize)) | ||
1064 | ret = -EFAULT; | ||
1065 | exit: | ||
1066 | kfree(s_cmd); | ||
1067 | diff --git a/drivers/power/power_supply_core.c b/drivers/power/power_supply_core.c | ||
1068 | index 456987c88baa..b13cd074c52a 100644 | ||
1069 | --- a/drivers/power/power_supply_core.c | ||
1070 | +++ b/drivers/power/power_supply_core.c | ||
1071 | @@ -565,11 +565,12 @@ static int power_supply_read_temp(struct thermal_zone_device *tzd, | ||
1072 | |||
1073 | WARN_ON(tzd == NULL); | ||
1074 | psy = tzd->devdata; | ||
1075 | - ret = psy->desc->get_property(psy, POWER_SUPPLY_PROP_TEMP, &val); | ||
1076 | + ret = power_supply_get_property(psy, POWER_SUPPLY_PROP_TEMP, &val); | ||
1077 | + if (ret) | ||
1078 | + return ret; | ||
1079 | |||
1080 | /* Convert tenths of degree Celsius to milli degree Celsius. */ | ||
1081 | - if (!ret) | ||
1082 | - *temp = val.intval * 100; | ||
1083 | + *temp = val.intval * 100; | ||
1084 | |||
1085 | return ret; | ||
1086 | } | ||
1087 | @@ -612,10 +613,12 @@ static int ps_get_max_charge_cntl_limit(struct thermal_cooling_device *tcd, | ||
1088 | int ret; | ||
1089 | |||
1090 | psy = tcd->devdata; | ||
1091 | - ret = psy->desc->get_property(psy, | ||
1092 | - POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT_MAX, &val); | ||
1093 | - if (!ret) | ||
1094 | - *state = val.intval; | ||
1095 | + ret = power_supply_get_property(psy, | ||
1096 | + POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT_MAX, &val); | ||
1097 | + if (ret) | ||
1098 | + return ret; | ||
1099 | + | ||
1100 | + *state = val.intval; | ||
1101 | |||
1102 | return ret; | ||
1103 | } | ||
1104 | @@ -628,10 +631,12 @@ static int ps_get_cur_chrage_cntl_limit(struct thermal_cooling_device *tcd, | ||
1105 | int ret; | ||
1106 | |||
1107 | psy = tcd->devdata; | ||
1108 | - ret = psy->desc->get_property(psy, | ||
1109 | - POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT, &val); | ||
1110 | - if (!ret) | ||
1111 | - *state = val.intval; | ||
1112 | + ret = power_supply_get_property(psy, | ||
1113 | + POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT, &val); | ||
1114 | + if (ret) | ||
1115 | + return ret; | ||
1116 | + | ||
1117 | + *state = val.intval; | ||
1118 | |||
1119 | return ret; | ||
1120 | } | ||
1121 | diff --git a/drivers/pps/clients/pps_parport.c b/drivers/pps/clients/pps_parport.c | ||
1122 | index 38a8bbe74810..83797d89c30f 100644 | ||
1123 | --- a/drivers/pps/clients/pps_parport.c | ||
1124 | +++ b/drivers/pps/clients/pps_parport.c | ||
1125 | @@ -195,7 +195,7 @@ static void parport_detach(struct parport *port) | ||
1126 | struct pps_client_pp *device; | ||
1127 | |||
1128 | /* FIXME: oooh, this is ugly! */ | ||
1129 | - if (strcmp(pardev->name, KBUILD_MODNAME)) | ||
1130 | + if (!pardev || strcmp(pardev->name, KBUILD_MODNAME)) | ||
1131 | /* not our port */ | ||
1132 | return; | ||
1133 | |||
1134 | diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c | ||
1135 | index 8f1b091e1732..12b2cb7769f9 100644 | ||
1136 | --- a/drivers/s390/net/qeth_l2_main.c | ||
1137 | +++ b/drivers/s390/net/qeth_l2_main.c | ||
1138 | @@ -1051,6 +1051,7 @@ static void qeth_l2_remove_device(struct ccwgroup_device *cgdev) | ||
1139 | qeth_l2_set_offline(cgdev); | ||
1140 | |||
1141 | if (card->dev) { | ||
1142 | + netif_napi_del(&card->napi); | ||
1143 | unregister_netdev(card->dev); | ||
1144 | card->dev = NULL; | ||
1145 | } | ||
1146 | diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c | ||
1147 | index 543960e96b42..50cec6b13d27 100644 | ||
1148 | --- a/drivers/s390/net/qeth_l3_main.c | ||
1149 | +++ b/drivers/s390/net/qeth_l3_main.c | ||
1150 | @@ -3246,6 +3246,7 @@ static void qeth_l3_remove_device(struct ccwgroup_device *cgdev) | ||
1151 | qeth_l3_set_offline(cgdev); | ||
1152 | |||
1153 | if (card->dev) { | ||
1154 | + netif_napi_del(&card->napi); | ||
1155 | unregister_netdev(card->dev); | ||
1156 | card->dev = NULL; | ||
1157 | } | ||
1158 | diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c | ||
1159 | index 43ac62623bf2..7a58128a0000 100644 | ||
1160 | --- a/drivers/scsi/ipr.c | ||
1161 | +++ b/drivers/scsi/ipr.c | ||
1162 | @@ -10095,6 +10095,7 @@ static int ipr_probe_ioa(struct pci_dev *pdev, | ||
1163 | ioa_cfg->intr_flag = IPR_USE_MSI; | ||
1164 | else { | ||
1165 | ioa_cfg->intr_flag = IPR_USE_LSI; | ||
1166 | + ioa_cfg->clear_isr = 1; | ||
1167 | ioa_cfg->nvectors = 1; | ||
1168 | dev_info(&pdev->dev, "Cannot enable MSI.\n"); | ||
1169 | } | ||
1170 | diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c | ||
1171 | index 93cbefa75b26..11cdb172cfaf 100644 | ||
1172 | --- a/drivers/scsi/scsi_devinfo.c | ||
1173 | +++ b/drivers/scsi/scsi_devinfo.c | ||
1174 | @@ -426,7 +426,7 @@ static struct scsi_dev_info_list *scsi_dev_info_list_find(const char *vendor, | ||
1175 | * here, and we don't know what device it is | ||
1176 | * trying to work with, leave it as-is. | ||
1177 | */ | ||
1178 | - vmax = 8; /* max length of vendor */ | ||
1179 | + vmax = sizeof(devinfo->vendor); | ||
1180 | vskip = vendor; | ||
1181 | while (vmax > 0 && *vskip == ' ') { | ||
1182 | vmax--; | ||
1183 | @@ -436,7 +436,7 @@ static struct scsi_dev_info_list *scsi_dev_info_list_find(const char *vendor, | ||
1184 | while (vmax > 0 && vskip[vmax - 1] == ' ') | ||
1185 | --vmax; | ||
1186 | |||
1187 | - mmax = 16; /* max length of model */ | ||
1188 | + mmax = sizeof(devinfo->model); | ||
1189 | mskip = model; | ||
1190 | while (mmax > 0 && *mskip == ' ') { | ||
1191 | mmax--; | ||
1192 | @@ -452,10 +452,12 @@ static struct scsi_dev_info_list *scsi_dev_info_list_find(const char *vendor, | ||
1193 | * Behave like the older version of get_device_flags. | ||
1194 | */ | ||
1195 | if (memcmp(devinfo->vendor, vskip, vmax) || | ||
1196 | - devinfo->vendor[vmax]) | ||
1197 | + (vmax < sizeof(devinfo->vendor) && | ||
1198 | + devinfo->vendor[vmax])) | ||
1199 | continue; | ||
1200 | if (memcmp(devinfo->model, mskip, mmax) || | ||
1201 | - devinfo->model[mmax]) | ||
1202 | + (mmax < sizeof(devinfo->model) && | ||
1203 | + devinfo->model[mmax])) | ||
1204 | continue; | ||
1205 | return devinfo; | ||
1206 | } else { | ||
1207 | diff --git a/drivers/spi/spi-sun4i.c b/drivers/spi/spi-sun4i.c | ||
1208 | index fbb0a4d74e91..39d7c7c70112 100644 | ||
1209 | --- a/drivers/spi/spi-sun4i.c | ||
1210 | +++ b/drivers/spi/spi-sun4i.c | ||
1211 | @@ -170,13 +170,17 @@ static int sun4i_spi_transfer_one(struct spi_master *master, | ||
1212 | { | ||
1213 | struct sun4i_spi *sspi = spi_master_get_devdata(master); | ||
1214 | unsigned int mclk_rate, div, timeout; | ||
1215 | + unsigned int start, end, tx_time; | ||
1216 | unsigned int tx_len = 0; | ||
1217 | int ret = 0; | ||
1218 | u32 reg; | ||
1219 | |||
1220 | /* We don't support transfer larger than the FIFO */ | ||
1221 | if (tfr->len > SUN4I_FIFO_DEPTH) | ||
1222 | - return -EINVAL; | ||
1223 | + return -EMSGSIZE; | ||
1224 | + | ||
1225 | + if (tfr->tx_buf && tfr->len >= SUN4I_FIFO_DEPTH) | ||
1226 | + return -EMSGSIZE; | ||
1227 | |||
1228 | reinit_completion(&sspi->done); | ||
1229 | sspi->tx_buf = tfr->tx_buf; | ||
1230 | @@ -269,8 +273,12 @@ static int sun4i_spi_transfer_one(struct spi_master *master, | ||
1231 | sun4i_spi_write(sspi, SUN4I_BURST_CNT_REG, SUN4I_BURST_CNT(tfr->len)); | ||
1232 | sun4i_spi_write(sspi, SUN4I_XMIT_CNT_REG, SUN4I_XMIT_CNT(tx_len)); | ||
1233 | |||
1234 | - /* Fill the TX FIFO */ | ||
1235 | - sun4i_spi_fill_fifo(sspi, SUN4I_FIFO_DEPTH); | ||
1236 | + /* | ||
1237 | + * Fill the TX FIFO | ||
1238 | + * Filling the FIFO fully causes timeout for some reason | ||
1239 | + * at least on spi2 on A10s | ||
1240 | + */ | ||
1241 | + sun4i_spi_fill_fifo(sspi, SUN4I_FIFO_DEPTH - 1); | ||
1242 | |||
1243 | /* Enable the interrupts */ | ||
1244 | sun4i_spi_write(sspi, SUN4I_INT_CTL_REG, SUN4I_INT_CTL_TC); | ||
1245 | @@ -279,9 +287,16 @@ static int sun4i_spi_transfer_one(struct spi_master *master, | ||
1246 | reg = sun4i_spi_read(sspi, SUN4I_CTL_REG); | ||
1247 | sun4i_spi_write(sspi, SUN4I_CTL_REG, reg | SUN4I_CTL_XCH); | ||
1248 | |||
1249 | + tx_time = max(tfr->len * 8 * 2 / (tfr->speed_hz / 1000), 100U); | ||
1250 | + start = jiffies; | ||
1251 | timeout = wait_for_completion_timeout(&sspi->done, | ||
1252 | - msecs_to_jiffies(1000)); | ||
1253 | + msecs_to_jiffies(tx_time)); | ||
1254 | + end = jiffies; | ||
1255 | if (!timeout) { | ||
1256 | + dev_warn(&master->dev, | ||
1257 | + "%s: timeout transferring %u bytes@%iHz for %i(%i)ms", | ||
1258 | + dev_name(&spi->dev), tfr->len, tfr->speed_hz, | ||
1259 | + jiffies_to_msecs(end - start), tx_time); | ||
1260 | ret = -ETIMEDOUT; | ||
1261 | goto out; | ||
1262 | } | ||
1263 | diff --git a/drivers/spi/spi-sun6i.c b/drivers/spi/spi-sun6i.c | ||
1264 | index ac48f59705a8..e77add01b0e9 100644 | ||
1265 | --- a/drivers/spi/spi-sun6i.c | ||
1266 | +++ b/drivers/spi/spi-sun6i.c | ||
1267 | @@ -160,6 +160,7 @@ static int sun6i_spi_transfer_one(struct spi_master *master, | ||
1268 | { | ||
1269 | struct sun6i_spi *sspi = spi_master_get_devdata(master); | ||
1270 | unsigned int mclk_rate, div, timeout; | ||
1271 | + unsigned int start, end, tx_time; | ||
1272 | unsigned int tx_len = 0; | ||
1273 | int ret = 0; | ||
1274 | u32 reg; | ||
1275 | @@ -269,9 +270,16 @@ static int sun6i_spi_transfer_one(struct spi_master *master, | ||
1276 | reg = sun6i_spi_read(sspi, SUN6I_TFR_CTL_REG); | ||
1277 | sun6i_spi_write(sspi, SUN6I_TFR_CTL_REG, reg | SUN6I_TFR_CTL_XCH); | ||
1278 | |||
1279 | + tx_time = max(tfr->len * 8 * 2 / (tfr->speed_hz / 1000), 100U); | ||
1280 | + start = jiffies; | ||
1281 | timeout = wait_for_completion_timeout(&sspi->done, | ||
1282 | - msecs_to_jiffies(1000)); | ||
1283 | + msecs_to_jiffies(tx_time)); | ||
1284 | + end = jiffies; | ||
1285 | if (!timeout) { | ||
1286 | + dev_warn(&master->dev, | ||
1287 | + "%s: timeout transferring %u bytes@%iHz for %i(%i)ms", | ||
1288 | + dev_name(&spi->dev), tfr->len, tfr->speed_hz, | ||
1289 | + jiffies_to_msecs(end - start), tx_time); | ||
1290 | ret = -ETIMEDOUT; | ||
1291 | goto out; | ||
1292 | } | ||
1293 | diff --git a/drivers/usb/host/ohci-q.c b/drivers/usb/host/ohci-q.c | ||
1294 | index d029bbe9eb36..641fed609911 100644 | ||
1295 | --- a/drivers/usb/host/ohci-q.c | ||
1296 | +++ b/drivers/usb/host/ohci-q.c | ||
1297 | @@ -183,7 +183,6 @@ static int ed_schedule (struct ohci_hcd *ohci, struct ed *ed) | ||
1298 | { | ||
1299 | int branch; | ||
1300 | |||
1301 | - ed->state = ED_OPER; | ||
1302 | ed->ed_prev = NULL; | ||
1303 | ed->ed_next = NULL; | ||
1304 | ed->hwNextED = 0; | ||
1305 | @@ -259,6 +258,8 @@ static int ed_schedule (struct ohci_hcd *ohci, struct ed *ed) | ||
1306 | /* the HC may not see the schedule updates yet, but if it does | ||
1307 | * then they'll be properly ordered. | ||
1308 | */ | ||
1309 | + | ||
1310 | + ed->state = ED_OPER; | ||
1311 | return 0; | ||
1312 | } | ||
1313 | |||
1314 | diff --git a/drivers/xen/xen-pciback/conf_space.c b/drivers/xen/xen-pciback/conf_space.c | ||
1315 | index 9c234209d8b5..47a4177b16d2 100644 | ||
1316 | --- a/drivers/xen/xen-pciback/conf_space.c | ||
1317 | +++ b/drivers/xen/xen-pciback/conf_space.c | ||
1318 | @@ -183,8 +183,7 @@ int xen_pcibk_config_read(struct pci_dev *dev, int offset, int size, | ||
1319 | field_start = OFFSET(cfg_entry); | ||
1320 | field_end = OFFSET(cfg_entry) + field->size; | ||
1321 | |||
1322 | - if ((req_start >= field_start && req_start < field_end) | ||
1323 | - || (req_end > field_start && req_end <= field_end)) { | ||
1324 | + if (req_end > field_start && field_end > req_start) { | ||
1325 | err = conf_space_read(dev, cfg_entry, field_start, | ||
1326 | &tmp_val); | ||
1327 | if (err) | ||
1328 | @@ -230,8 +229,7 @@ int xen_pcibk_config_write(struct pci_dev *dev, int offset, int size, u32 value) | ||
1329 | field_start = OFFSET(cfg_entry); | ||
1330 | field_end = OFFSET(cfg_entry) + field->size; | ||
1331 | |||
1332 | - if ((req_start >= field_start && req_start < field_end) | ||
1333 | - || (req_end > field_start && req_end <= field_end)) { | ||
1334 | + if (req_end > field_start && field_end > req_start) { | ||
1335 | tmp_val = 0; | ||
1336 | |||
1337 | err = xen_pcibk_config_read(dev, field_start, | ||
1338 | diff --git a/drivers/xen/xenbus/xenbus_dev_frontend.c b/drivers/xen/xenbus/xenbus_dev_frontend.c | ||
1339 | index 9433e46518c8..531e76474983 100644 | ||
1340 | --- a/drivers/xen/xenbus/xenbus_dev_frontend.c | ||
1341 | +++ b/drivers/xen/xenbus/xenbus_dev_frontend.c | ||
1342 | @@ -316,11 +316,18 @@ static int xenbus_write_transaction(unsigned msg_type, | ||
1343 | rc = -ENOMEM; | ||
1344 | goto out; | ||
1345 | } | ||
1346 | + } else { | ||
1347 | + list_for_each_entry(trans, &u->transactions, list) | ||
1348 | + if (trans->handle.id == u->u.msg.tx_id) | ||
1349 | + break; | ||
1350 | + if (&trans->list == &u->transactions) | ||
1351 | + return -ESRCH; | ||
1352 | } | ||
1353 | |||
1354 | reply = xenbus_dev_request_and_reply(&u->u.msg); | ||
1355 | if (IS_ERR(reply)) { | ||
1356 | - kfree(trans); | ||
1357 | + if (msg_type == XS_TRANSACTION_START) | ||
1358 | + kfree(trans); | ||
1359 | rc = PTR_ERR(reply); | ||
1360 | goto out; | ||
1361 | } | ||
1362 | @@ -333,12 +340,7 @@ static int xenbus_write_transaction(unsigned msg_type, | ||
1363 | list_add(&trans->list, &u->transactions); | ||
1364 | } | ||
1365 | } else if (u->u.msg.type == XS_TRANSACTION_END) { | ||
1366 | - list_for_each_entry(trans, &u->transactions, list) | ||
1367 | - if (trans->handle.id == u->u.msg.tx_id) | ||
1368 | - break; | ||
1369 | - BUG_ON(&trans->list == &u->transactions); | ||
1370 | list_del(&trans->list); | ||
1371 | - | ||
1372 | kfree(trans); | ||
1373 | } | ||
1374 | |||
1375 | diff --git a/drivers/xen/xenbus/xenbus_xs.c b/drivers/xen/xenbus/xenbus_xs.c | ||
1376 | index ba804f3d8278..ce65591b4168 100644 | ||
1377 | --- a/drivers/xen/xenbus/xenbus_xs.c | ||
1378 | +++ b/drivers/xen/xenbus/xenbus_xs.c | ||
1379 | @@ -250,9 +250,6 @@ void *xenbus_dev_request_and_reply(struct xsd_sockmsg *msg) | ||
1380 | |||
1381 | mutex_unlock(&xs_state.request_mutex); | ||
1382 | |||
1383 | - if (IS_ERR(ret)) | ||
1384 | - return ret; | ||
1385 | - | ||
1386 | if ((msg->type == XS_TRANSACTION_END) || | ||
1387 | ((req_msg.type == XS_TRANSACTION_START) && | ||
1388 | (msg->type == XS_ERROR))) | ||
1389 | diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c | ||
1390 | index 7bf835f85bc8..12ceaf52dae6 100644 | ||
1391 | --- a/fs/9p/vfs_file.c | ||
1392 | +++ b/fs/9p/vfs_file.c | ||
1393 | @@ -74,7 +74,7 @@ int v9fs_file_open(struct inode *inode, struct file *file) | ||
1394 | v9fs_proto_dotu(v9ses)); | ||
1395 | fid = file->private_data; | ||
1396 | if (!fid) { | ||
1397 | - fid = v9fs_fid_clone(file->f_path.dentry); | ||
1398 | + fid = v9fs_fid_clone(file_dentry(file)); | ||
1399 | if (IS_ERR(fid)) | ||
1400 | return PTR_ERR(fid); | ||
1401 | |||
1402 | @@ -100,7 +100,7 @@ int v9fs_file_open(struct inode *inode, struct file *file) | ||
1403 | * because we want write after unlink usecase | ||
1404 | * to work. | ||
1405 | */ | ||
1406 | - fid = v9fs_writeback_fid(file->f_path.dentry); | ||
1407 | + fid = v9fs_writeback_fid(file_dentry(file)); | ||
1408 | if (IS_ERR(fid)) { | ||
1409 | err = PTR_ERR(fid); | ||
1410 | mutex_unlock(&v9inode->v_mutex); | ||
1411 | @@ -516,7 +516,7 @@ v9fs_mmap_file_mmap(struct file *filp, struct vm_area_struct *vma) | ||
1412 | * because we want write after unlink usecase | ||
1413 | * to work. | ||
1414 | */ | ||
1415 | - fid = v9fs_writeback_fid(filp->f_path.dentry); | ||
1416 | + fid = v9fs_writeback_fid(file_dentry(filp)); | ||
1417 | if (IS_ERR(fid)) { | ||
1418 | retval = PTR_ERR(fid); | ||
1419 | mutex_unlock(&v9inode->v_mutex); | ||
1420 | diff --git a/fs/ecryptfs/file.c b/fs/ecryptfs/file.c | ||
1421 | index feef8a9c4de7..11309683d65f 100644 | ||
1422 | --- a/fs/ecryptfs/file.c | ||
1423 | +++ b/fs/ecryptfs/file.c | ||
1424 | @@ -170,6 +170,19 @@ out: | ||
1425 | return rc; | ||
1426 | } | ||
1427 | |||
1428 | +static int ecryptfs_mmap(struct file *file, struct vm_area_struct *vma) | ||
1429 | +{ | ||
1430 | + struct file *lower_file = ecryptfs_file_to_lower(file); | ||
1431 | + /* | ||
1432 | + * Don't allow mmap on top of file systems that don't support it | ||
1433 | + * natively. If FILESYSTEM_MAX_STACK_DEPTH > 2 or ecryptfs | ||
1434 | + * allows recursive mounting, this will need to be extended. | ||
1435 | + */ | ||
1436 | + if (!lower_file->f_op->mmap) | ||
1437 | + return -ENODEV; | ||
1438 | + return generic_file_mmap(file, vma); | ||
1439 | +} | ||
1440 | + | ||
1441 | /** | ||
1442 | * ecryptfs_open | ||
1443 | * @inode: inode speciying file to open | ||
1444 | @@ -364,7 +377,7 @@ const struct file_operations ecryptfs_main_fops = { | ||
1445 | #ifdef CONFIG_COMPAT | ||
1446 | .compat_ioctl = ecryptfs_compat_ioctl, | ||
1447 | #endif | ||
1448 | - .mmap = generic_file_mmap, | ||
1449 | + .mmap = ecryptfs_mmap, | ||
1450 | .open = ecryptfs_open, | ||
1451 | .flush = ecryptfs_flush, | ||
1452 | .release = ecryptfs_release, | ||
1453 | diff --git a/fs/ecryptfs/kthread.c b/fs/ecryptfs/kthread.c | ||
1454 | index e818f5ac7a26..866bb18efefe 100644 | ||
1455 | --- a/fs/ecryptfs/kthread.c | ||
1456 | +++ b/fs/ecryptfs/kthread.c | ||
1457 | @@ -25,7 +25,6 @@ | ||
1458 | #include <linux/slab.h> | ||
1459 | #include <linux/wait.h> | ||
1460 | #include <linux/mount.h> | ||
1461 | -#include <linux/file.h> | ||
1462 | #include "ecryptfs_kernel.h" | ||
1463 | |||
1464 | struct ecryptfs_open_req { | ||
1465 | @@ -148,7 +147,7 @@ int ecryptfs_privileged_open(struct file **lower_file, | ||
1466 | flags |= IS_RDONLY(d_inode(lower_dentry)) ? O_RDONLY : O_RDWR; | ||
1467 | (*lower_file) = dentry_open(&req.path, flags, cred); | ||
1468 | if (!IS_ERR(*lower_file)) | ||
1469 | - goto have_file; | ||
1470 | + goto out; | ||
1471 | if ((flags & O_ACCMODE) == O_RDONLY) { | ||
1472 | rc = PTR_ERR((*lower_file)); | ||
1473 | goto out; | ||
1474 | @@ -166,16 +165,8 @@ int ecryptfs_privileged_open(struct file **lower_file, | ||
1475 | mutex_unlock(&ecryptfs_kthread_ctl.mux); | ||
1476 | wake_up(&ecryptfs_kthread_ctl.wait); | ||
1477 | wait_for_completion(&req.done); | ||
1478 | - if (IS_ERR(*lower_file)) { | ||
1479 | + if (IS_ERR(*lower_file)) | ||
1480 | rc = PTR_ERR(*lower_file); | ||
1481 | - goto out; | ||
1482 | - } | ||
1483 | -have_file: | ||
1484 | - if ((*lower_file)->f_op->mmap == NULL) { | ||
1485 | - fput(*lower_file); | ||
1486 | - *lower_file = NULL; | ||
1487 | - rc = -EMEDIUMTYPE; | ||
1488 | - } | ||
1489 | out: | ||
1490 | return rc; | ||
1491 | } | ||
1492 | diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c | ||
1493 | index 3578b25fccfd..62880586ed85 100644 | ||
1494 | --- a/fs/ext4/extents.c | ||
1495 | +++ b/fs/ext4/extents.c | ||
1496 | @@ -469,6 +469,10 @@ static int __ext4_ext_check(const char *function, unsigned int line, | ||
1497 | error_msg = "invalid extent entries"; | ||
1498 | goto corrupted; | ||
1499 | } | ||
1500 | + if (unlikely(depth > 32)) { | ||
1501 | + error_msg = "too large eh_depth"; | ||
1502 | + goto corrupted; | ||
1503 | + } | ||
1504 | /* Verify checksum on non-root extent tree nodes */ | ||
1505 | if (ext_depth(inode) != depth && | ||
1506 | !ext4_extent_block_csum_verify(inode, eh)) { | ||
1507 | diff --git a/fs/inode.c b/fs/inode.c | ||
1508 | index 1be5f9003eb3..b0edef500590 100644 | ||
1509 | --- a/fs/inode.c | ||
1510 | +++ b/fs/inode.c | ||
1511 | @@ -1733,8 +1733,8 @@ static int __remove_privs(struct dentry *dentry, int kill) | ||
1512 | */ | ||
1513 | int file_remove_privs(struct file *file) | ||
1514 | { | ||
1515 | - struct dentry *dentry = file->f_path.dentry; | ||
1516 | - struct inode *inode = d_inode(dentry); | ||
1517 | + struct dentry *dentry = file_dentry(file); | ||
1518 | + struct inode *inode = file_inode(file); | ||
1519 | int kill; | ||
1520 | int error = 0; | ||
1521 | |||
1522 | @@ -1742,7 +1742,7 @@ int file_remove_privs(struct file *file) | ||
1523 | if (IS_NOSEC(inode)) | ||
1524 | return 0; | ||
1525 | |||
1526 | - kill = file_needs_remove_privs(file); | ||
1527 | + kill = dentry_needs_remove_privs(dentry); | ||
1528 | if (kill < 0) | ||
1529 | return kill; | ||
1530 | if (kill) | ||
1531 | diff --git a/fs/locks.c b/fs/locks.c | ||
1532 | index 6333263b7bc8..8eddae23e10b 100644 | ||
1533 | --- a/fs/locks.c | ||
1534 | +++ b/fs/locks.c | ||
1535 | @@ -1602,7 +1602,7 @@ generic_add_lease(struct file *filp, long arg, struct file_lock **flp, void **pr | ||
1536 | { | ||
1537 | struct file_lock *fl, *my_fl = NULL, *lease; | ||
1538 | struct dentry *dentry = filp->f_path.dentry; | ||
1539 | - struct inode *inode = dentry->d_inode; | ||
1540 | + struct inode *inode = file_inode(filp); | ||
1541 | struct file_lock_context *ctx; | ||
1542 | bool is_deleg = (*flp)->fl_flags & FL_DELEG; | ||
1543 | int error; | ||
1544 | diff --git a/fs/namespace.c b/fs/namespace.c | ||
1545 | index 33064fcbfff9..5be02a0635be 100644 | ||
1546 | --- a/fs/namespace.c | ||
1547 | +++ b/fs/namespace.c | ||
1548 | @@ -1562,6 +1562,7 @@ void __detach_mounts(struct dentry *dentry) | ||
1549 | goto out_unlock; | ||
1550 | |||
1551 | lock_mount_hash(); | ||
1552 | + event++; | ||
1553 | while (!hlist_empty(&mp->m_list)) { | ||
1554 | mnt = hlist_entry(mp->m_list.first, struct mount, mnt_mp_list); | ||
1555 | if (mnt->mnt.mnt_flags & MNT_UMOUNT) { | ||
1556 | diff --git a/fs/nilfs2/the_nilfs.c b/fs/nilfs2/the_nilfs.c | ||
1557 | index 69bd801afb53..37e49cb2ac4c 100644 | ||
1558 | --- a/fs/nilfs2/the_nilfs.c | ||
1559 | +++ b/fs/nilfs2/the_nilfs.c | ||
1560 | @@ -443,7 +443,7 @@ static int nilfs_valid_sb(struct nilfs_super_block *sbp) | ||
1561 | if (!sbp || le16_to_cpu(sbp->s_magic) != NILFS_SUPER_MAGIC) | ||
1562 | return 0; | ||
1563 | bytes = le16_to_cpu(sbp->s_bytes); | ||
1564 | - if (bytes > BLOCK_SIZE) | ||
1565 | + if (bytes < sumoff + 4 || bytes > BLOCK_SIZE) | ||
1566 | return 0; | ||
1567 | crc = crc32_le(le32_to_cpu(sbp->s_crc_seed), (unsigned char *)sbp, | ||
1568 | sumoff); | ||
1569 | diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c | ||
1570 | index 0597820f5d9d..4f729ffff75d 100644 | ||
1571 | --- a/fs/overlayfs/inode.c | ||
1572 | +++ b/fs/overlayfs/inode.c | ||
1573 | @@ -63,6 +63,9 @@ int ovl_setattr(struct dentry *dentry, struct iattr *attr) | ||
1574 | if (!err) { | ||
1575 | upperdentry = ovl_dentry_upper(dentry); | ||
1576 | |||
1577 | + if (attr->ia_valid & (ATTR_KILL_SUID|ATTR_KILL_SGID)) | ||
1578 | + attr->ia_valid &= ~ATTR_MODE; | ||
1579 | + | ||
1580 | mutex_lock(&upperdentry->d_inode->i_mutex); | ||
1581 | err = notify_change(upperdentry, attr, NULL); | ||
1582 | if (!err) | ||
1583 | diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h | ||
1584 | index c4bd0e2c173c..ef2e8c97e183 100644 | ||
1585 | --- a/include/asm-generic/vmlinux.lds.h | ||
1586 | +++ b/include/asm-generic/vmlinux.lds.h | ||
1587 | @@ -531,15 +531,19 @@ | ||
1588 | |||
1589 | #define INIT_TEXT \ | ||
1590 | *(.init.text) \ | ||
1591 | + *(.text.startup) \ | ||
1592 | MEM_DISCARD(init.text) | ||
1593 | |||
1594 | #define EXIT_DATA \ | ||
1595 | *(.exit.data) \ | ||
1596 | + *(.fini_array) \ | ||
1597 | + *(.dtors) \ | ||
1598 | MEM_DISCARD(exit.data) \ | ||
1599 | MEM_DISCARD(exit.rodata) | ||
1600 | |||
1601 | #define EXIT_TEXT \ | ||
1602 | *(.exit.text) \ | ||
1603 | + *(.text.exit) \ | ||
1604 | MEM_DISCARD(exit.text) | ||
1605 | |||
1606 | #define EXIT_CALL \ | ||
1607 | diff --git a/include/linux/bcma/bcma.h b/include/linux/bcma/bcma.h | ||
1608 | index 3feb1b2d75d8..14cd6f77e284 100644 | ||
1609 | --- a/include/linux/bcma/bcma.h | ||
1610 | +++ b/include/linux/bcma/bcma.h | ||
1611 | @@ -156,6 +156,7 @@ struct bcma_host_ops { | ||
1612 | #define BCMA_CORE_DEFAULT 0xFFF | ||
1613 | |||
1614 | #define BCMA_MAX_NR_CORES 16 | ||
1615 | +#define BCMA_CORE_SIZE 0x1000 | ||
1616 | |||
1617 | /* Chip IDs of PCIe devices */ | ||
1618 | #define BCMA_CHIP_ID_BCM4313 0x4313 | ||
1619 | diff --git a/kernel/cgroup.c b/kernel/cgroup.c | ||
1620 | index 1c9d701f7a72..a3424f28aaf4 100644 | ||
1621 | --- a/kernel/cgroup.c | ||
1622 | +++ b/kernel/cgroup.c | ||
1623 | @@ -4793,6 +4793,7 @@ static void init_and_link_css(struct cgroup_subsys_state *css, | ||
1624 | memset(css, 0, sizeof(*css)); | ||
1625 | css->cgroup = cgrp; | ||
1626 | css->ss = ss; | ||
1627 | + css->id = -1; | ||
1628 | INIT_LIST_HEAD(&css->sibling); | ||
1629 | INIT_LIST_HEAD(&css->children); | ||
1630 | css->serial_nr = css_serial_nr_next++; | ||
1631 | diff --git a/kernel/sched/core.c b/kernel/sched/core.c | ||
1632 | index 6c0cdb5a73f8..67d1e1597d9c 100644 | ||
1633 | --- a/kernel/sched/core.c | ||
1634 | +++ b/kernel/sched/core.c | ||
1635 | @@ -4951,14 +4951,16 @@ void show_state_filter(unsigned long state_filter) | ||
1636 | /* | ||
1637 | * reset the NMI-timeout, listing all files on a slow | ||
1638 | * console might take a lot of time: | ||
1639 | + * Also, reset softlockup watchdogs on all CPUs, because | ||
1640 | + * another CPU might be blocked waiting for us to process | ||
1641 | + * an IPI. | ||
1642 | */ | ||
1643 | touch_nmi_watchdog(); | ||
1644 | + touch_all_softlockup_watchdogs(); | ||
1645 | if (!state_filter || (p->state & state_filter)) | ||
1646 | sched_show_task(p); | ||
1647 | } | ||
1648 | |||
1649 | - touch_all_softlockup_watchdogs(); | ||
1650 | - | ||
1651 | #ifdef CONFIG_SCHED_DEBUG | ||
1652 | sysrq_sched_debug_show(); | ||
1653 | #endif | ||
1654 | diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c | ||
1655 | index 51c615279b23..b8b516c37bf1 100644 | ||
1656 | --- a/kernel/sched/fair.c | ||
1657 | +++ b/kernel/sched/fair.c | ||
1658 | @@ -687,8 +687,6 @@ void init_entity_runnable_average(struct sched_entity *se) | ||
1659 | /* when this task enqueue'ed, it will contribute to its cfs_rq's load_avg */ | ||
1660 | } | ||
1661 | |||
1662 | -static inline unsigned long cfs_rq_runnable_load_avg(struct cfs_rq *cfs_rq); | ||
1663 | -static inline unsigned long cfs_rq_load_avg(struct cfs_rq *cfs_rq); | ||
1664 | #else | ||
1665 | void init_entity_runnable_average(struct sched_entity *se) | ||
1666 | { | ||
1667 | @@ -4594,19 +4592,24 @@ static long effective_load(struct task_group *tg, int cpu, long wl, long wg) | ||
1668 | return wl; | ||
1669 | |||
1670 | for_each_sched_entity(se) { | ||
1671 | - long w, W; | ||
1672 | + struct cfs_rq *cfs_rq = se->my_q; | ||
1673 | + long W, w = cfs_rq_load_avg(cfs_rq); | ||
1674 | |||
1675 | - tg = se->my_q->tg; | ||
1676 | + tg = cfs_rq->tg; | ||
1677 | |||
1678 | /* | ||
1679 | * W = @wg + \Sum rw_j | ||
1680 | */ | ||
1681 | - W = wg + calc_tg_weight(tg, se->my_q); | ||
1682 | + W = wg + atomic_long_read(&tg->load_avg); | ||
1683 | + | ||
1684 | + /* Ensure \Sum rw_j >= rw_i */ | ||
1685 | + W -= cfs_rq->tg_load_avg_contrib; | ||
1686 | + W += w; | ||
1687 | |||
1688 | /* | ||
1689 | * w = rw_i + @wl | ||
1690 | */ | ||
1691 | - w = cfs_rq_load_avg(se->my_q) + wl; | ||
1692 | + w += wl; | ||
1693 | |||
1694 | /* | ||
1695 | * wl = S * s'_i; see (2) | ||
1696 | diff --git a/kernel/time/posix-cpu-timers.c b/kernel/time/posix-cpu-timers.c | ||
1697 | index f5e86d282d52..80016b329d94 100644 | ||
1698 | --- a/kernel/time/posix-cpu-timers.c | ||
1699 | +++ b/kernel/time/posix-cpu-timers.c | ||
1700 | @@ -808,6 +808,7 @@ static void posix_cpu_timer_get(struct k_itimer *timer, struct itimerspec *itp) | ||
1701 | timer->it.cpu.expires = 0; | ||
1702 | sample_to_timespec(timer->it_clock, timer->it.cpu.expires, | ||
1703 | &itp->it_value); | ||
1704 | + return; | ||
1705 | } else { | ||
1706 | cpu_timer_sample_group(timer->it_clock, p, &now); | ||
1707 | unlock_task_sighand(p, &flags); | ||
1708 | diff --git a/mm/compaction.c b/mm/compaction.c | ||
1709 | index 7881e072dc33..dba02dec7195 100644 | ||
1710 | --- a/mm/compaction.c | ||
1711 | +++ b/mm/compaction.c | ||
1712 | @@ -475,25 +475,23 @@ static unsigned long isolate_freepages_block(struct compact_control *cc, | ||
1713 | |||
1714 | /* Found a free page, break it into order-0 pages */ | ||
1715 | isolated = split_free_page(page); | ||
1716 | + if (!isolated) | ||
1717 | + break; | ||
1718 | + | ||
1719 | total_isolated += isolated; | ||
1720 | + cc->nr_freepages += isolated; | ||
1721 | for (i = 0; i < isolated; i++) { | ||
1722 | list_add(&page->lru, freelist); | ||
1723 | page++; | ||
1724 | } | ||
1725 | - | ||
1726 | - /* If a page was split, advance to the end of it */ | ||
1727 | - if (isolated) { | ||
1728 | - cc->nr_freepages += isolated; | ||
1729 | - if (!strict && | ||
1730 | - cc->nr_migratepages <= cc->nr_freepages) { | ||
1731 | - blockpfn += isolated; | ||
1732 | - break; | ||
1733 | - } | ||
1734 | - | ||
1735 | - blockpfn += isolated - 1; | ||
1736 | - cursor += isolated - 1; | ||
1737 | - continue; | ||
1738 | + if (!strict && cc->nr_migratepages <= cc->nr_freepages) { | ||
1739 | + blockpfn += isolated; | ||
1740 | + break; | ||
1741 | } | ||
1742 | + /* Advance to the end of split page */ | ||
1743 | + blockpfn += isolated - 1; | ||
1744 | + cursor += isolated - 1; | ||
1745 | + continue; | ||
1746 | |||
1747 | isolate_fail: | ||
1748 | if (strict) | ||
1749 | @@ -503,6 +501,9 @@ isolate_fail: | ||
1750 | |||
1751 | } | ||
1752 | |||
1753 | + if (locked) | ||
1754 | + spin_unlock_irqrestore(&cc->zone->lock, flags); | ||
1755 | + | ||
1756 | /* | ||
1757 | * There is a tiny chance that we have read bogus compound_order(), | ||
1758 | * so be careful to not go outside of the pageblock. | ||
1759 | @@ -524,9 +525,6 @@ isolate_fail: | ||
1760 | if (strict && blockpfn < end_pfn) | ||
1761 | total_isolated = 0; | ||
1762 | |||
1763 | - if (locked) | ||
1764 | - spin_unlock_irqrestore(&cc->zone->lock, flags); | ||
1765 | - | ||
1766 | /* Update the pageblock-skip if the whole pageblock was scanned */ | ||
1767 | if (blockpfn == end_pfn) | ||
1768 | update_pageblock_skip(cc, valid_page, total_isolated, false); | ||
1769 | @@ -966,7 +964,6 @@ static void isolate_freepages(struct compact_control *cc) | ||
1770 | block_end_pfn = block_start_pfn, | ||
1771 | block_start_pfn -= pageblock_nr_pages, | ||
1772 | isolate_start_pfn = block_start_pfn) { | ||
1773 | - | ||
1774 | /* | ||
1775 | * This can iterate a massively long zone without finding any | ||
1776 | * suitable migration targets, so periodically check if we need | ||
1777 | @@ -990,32 +987,30 @@ static void isolate_freepages(struct compact_control *cc) | ||
1778 | continue; | ||
1779 | |||
1780 | /* Found a block suitable for isolating free pages from. */ | ||
1781 | - isolate_freepages_block(cc, &isolate_start_pfn, | ||
1782 | - block_end_pfn, freelist, false); | ||
1783 | + isolate_freepages_block(cc, &isolate_start_pfn, block_end_pfn, | ||
1784 | + freelist, false); | ||
1785 | |||
1786 | /* | ||
1787 | - * If we isolated enough freepages, or aborted due to async | ||
1788 | - * compaction being contended, terminate the loop. | ||
1789 | - * Remember where the free scanner should restart next time, | ||
1790 | - * which is where isolate_freepages_block() left off. | ||
1791 | - * But if it scanned the whole pageblock, isolate_start_pfn | ||
1792 | - * now points at block_end_pfn, which is the start of the next | ||
1793 | - * pageblock. | ||
1794 | - * In that case we will however want to restart at the start | ||
1795 | - * of the previous pageblock. | ||
1796 | + * If we isolated enough freepages, or aborted due to lock | ||
1797 | + * contention, terminate. | ||
1798 | */ | ||
1799 | if ((cc->nr_freepages >= cc->nr_migratepages) | ||
1800 | || cc->contended) { | ||
1801 | - if (isolate_start_pfn >= block_end_pfn) | ||
1802 | + if (isolate_start_pfn >= block_end_pfn) { | ||
1803 | + /* | ||
1804 | + * Restart at previous pageblock if more | ||
1805 | + * freepages can be isolated next time. | ||
1806 | + */ | ||
1807 | isolate_start_pfn = | ||
1808 | block_start_pfn - pageblock_nr_pages; | ||
1809 | + } | ||
1810 | break; | ||
1811 | - } else { | ||
1812 | + } else if (isolate_start_pfn < block_end_pfn) { | ||
1813 | /* | ||
1814 | - * isolate_freepages_block() should not terminate | ||
1815 | - * prematurely unless contended, or isolated enough | ||
1816 | + * If isolation failed early, do not continue | ||
1817 | + * needlessly. | ||
1818 | */ | ||
1819 | - VM_BUG_ON(isolate_start_pfn < block_end_pfn); | ||
1820 | + break; | ||
1821 | } | ||
1822 | } | ||
1823 | |||
1824 | diff --git a/mm/internal.h b/mm/internal.h | ||
1825 | index 38e24b89e4c4..6979b2bd3227 100644 | ||
1826 | --- a/mm/internal.h | ||
1827 | +++ b/mm/internal.h | ||
1828 | @@ -22,7 +22,8 @@ | ||
1829 | */ | ||
1830 | #define GFP_RECLAIM_MASK (__GFP_RECLAIM|__GFP_HIGH|__GFP_IO|__GFP_FS|\ | ||
1831 | __GFP_NOWARN|__GFP_REPEAT|__GFP_NOFAIL|\ | ||
1832 | - __GFP_NORETRY|__GFP_MEMALLOC|__GFP_NOMEMALLOC) | ||
1833 | + __GFP_NORETRY|__GFP_MEMALLOC|__GFP_NOMEMALLOC|\ | ||
1834 | + __GFP_ATOMIC) | ||
1835 | |||
1836 | /* The GFP flags allowed during early boot */ | ||
1837 | #define GFP_BOOT_MASK (__GFP_BITS_MASK & ~(__GFP_RECLAIM|__GFP_IO|__GFP_FS)) | ||
1838 | diff --git a/mm/page_alloc.c b/mm/page_alloc.c | ||
1839 | index 99c1738684ec..2bcdfbf8c36d 100644 | ||
1840 | --- a/mm/page_alloc.c | ||
1841 | +++ b/mm/page_alloc.c | ||
1842 | @@ -275,7 +275,9 @@ static inline void reset_deferred_meminit(pg_data_t *pgdat) | ||
1843 | /* Returns true if the struct page for the pfn is uninitialised */ | ||
1844 | static inline bool __meminit early_page_uninitialised(unsigned long pfn) | ||
1845 | { | ||
1846 | - if (pfn >= NODE_DATA(early_pfn_to_nid(pfn))->first_deferred_pfn) | ||
1847 | + int nid = early_pfn_to_nid(pfn); | ||
1848 | + | ||
1849 | + if (node_online(nid) && pfn >= NODE_DATA(nid)->first_deferred_pfn) | ||
1850 | return true; | ||
1851 | |||
1852 | return false; | ||
1853 | @@ -1057,7 +1059,7 @@ int __meminit early_pfn_to_nid(unsigned long pfn) | ||
1854 | spin_lock(&early_pfn_lock); | ||
1855 | nid = __early_pfn_to_nid(pfn, &early_pfnnid_cache); | ||
1856 | if (nid < 0) | ||
1857 | - nid = 0; | ||
1858 | + nid = first_online_node; | ||
1859 | spin_unlock(&early_pfn_lock); | ||
1860 | |||
1861 | return nid; | ||
1862 | diff --git a/net/ceph/osdmap.c b/net/ceph/osdmap.c | ||
1863 | index 7d8f581d9f1f..ddc3573894b0 100644 | ||
1864 | --- a/net/ceph/osdmap.c | ||
1865 | +++ b/net/ceph/osdmap.c | ||
1866 | @@ -1192,6 +1192,115 @@ struct ceph_osdmap *ceph_osdmap_decode(void **p, void *end) | ||
1867 | } | ||
1868 | |||
1869 | /* | ||
1870 | + * Encoding order is (new_up_client, new_state, new_weight). Need to | ||
1871 | + * apply in the (new_weight, new_state, new_up_client) order, because | ||
1872 | + * an incremental map may look like e.g. | ||
1873 | + * | ||
1874 | + * new_up_client: { osd=6, addr=... } # set osd_state and addr | ||
1875 | + * new_state: { osd=6, xorstate=EXISTS } # clear osd_state | ||
1876 | + */ | ||
1877 | +static int decode_new_up_state_weight(void **p, void *end, | ||
1878 | + struct ceph_osdmap *map) | ||
1879 | +{ | ||
1880 | + void *new_up_client; | ||
1881 | + void *new_state; | ||
1882 | + void *new_weight_end; | ||
1883 | + u32 len; | ||
1884 | + | ||
1885 | + new_up_client = *p; | ||
1886 | + ceph_decode_32_safe(p, end, len, e_inval); | ||
1887 | + len *= sizeof(u32) + sizeof(struct ceph_entity_addr); | ||
1888 | + ceph_decode_need(p, end, len, e_inval); | ||
1889 | + *p += len; | ||
1890 | + | ||
1891 | + new_state = *p; | ||
1892 | + ceph_decode_32_safe(p, end, len, e_inval); | ||
1893 | + len *= sizeof(u32) + sizeof(u8); | ||
1894 | + ceph_decode_need(p, end, len, e_inval); | ||
1895 | + *p += len; | ||
1896 | + | ||
1897 | + /* new_weight */ | ||
1898 | + ceph_decode_32_safe(p, end, len, e_inval); | ||
1899 | + while (len--) { | ||
1900 | + s32 osd; | ||
1901 | + u32 w; | ||
1902 | + | ||
1903 | + ceph_decode_need(p, end, 2*sizeof(u32), e_inval); | ||
1904 | + osd = ceph_decode_32(p); | ||
1905 | + w = ceph_decode_32(p); | ||
1906 | + BUG_ON(osd >= map->max_osd); | ||
1907 | + pr_info("osd%d weight 0x%x %s\n", osd, w, | ||
1908 | + w == CEPH_OSD_IN ? "(in)" : | ||
1909 | + (w == CEPH_OSD_OUT ? "(out)" : "")); | ||
1910 | + map->osd_weight[osd] = w; | ||
1911 | + | ||
1912 | + /* | ||
1913 | + * If we are marking in, set the EXISTS, and clear the | ||
1914 | + * AUTOOUT and NEW bits. | ||
1915 | + */ | ||
1916 | + if (w) { | ||
1917 | + map->osd_state[osd] |= CEPH_OSD_EXISTS; | ||
1918 | + map->osd_state[osd] &= ~(CEPH_OSD_AUTOOUT | | ||
1919 | + CEPH_OSD_NEW); | ||
1920 | + } | ||
1921 | + } | ||
1922 | + new_weight_end = *p; | ||
1923 | + | ||
1924 | + /* new_state (up/down) */ | ||
1925 | + *p = new_state; | ||
1926 | + len = ceph_decode_32(p); | ||
1927 | + while (len--) { | ||
1928 | + s32 osd; | ||
1929 | + u8 xorstate; | ||
1930 | + int ret; | ||
1931 | + | ||
1932 | + osd = ceph_decode_32(p); | ||
1933 | + xorstate = ceph_decode_8(p); | ||
1934 | + if (xorstate == 0) | ||
1935 | + xorstate = CEPH_OSD_UP; | ||
1936 | + BUG_ON(osd >= map->max_osd); | ||
1937 | + if ((map->osd_state[osd] & CEPH_OSD_UP) && | ||
1938 | + (xorstate & CEPH_OSD_UP)) | ||
1939 | + pr_info("osd%d down\n", osd); | ||
1940 | + if ((map->osd_state[osd] & CEPH_OSD_EXISTS) && | ||
1941 | + (xorstate & CEPH_OSD_EXISTS)) { | ||
1942 | + pr_info("osd%d does not exist\n", osd); | ||
1943 | + map->osd_weight[osd] = CEPH_OSD_IN; | ||
1944 | + ret = set_primary_affinity(map, osd, | ||
1945 | + CEPH_OSD_DEFAULT_PRIMARY_AFFINITY); | ||
1946 | + if (ret) | ||
1947 | + return ret; | ||
1948 | + memset(map->osd_addr + osd, 0, sizeof(*map->osd_addr)); | ||
1949 | + map->osd_state[osd] = 0; | ||
1950 | + } else { | ||
1951 | + map->osd_state[osd] ^= xorstate; | ||
1952 | + } | ||
1953 | + } | ||
1954 | + | ||
1955 | + /* new_up_client */ | ||
1956 | + *p = new_up_client; | ||
1957 | + len = ceph_decode_32(p); | ||
1958 | + while (len--) { | ||
1959 | + s32 osd; | ||
1960 | + struct ceph_entity_addr addr; | ||
1961 | + | ||
1962 | + osd = ceph_decode_32(p); | ||
1963 | + ceph_decode_copy(p, &addr, sizeof(addr)); | ||
1964 | + ceph_decode_addr(&addr); | ||
1965 | + BUG_ON(osd >= map->max_osd); | ||
1966 | + pr_info("osd%d up\n", osd); | ||
1967 | + map->osd_state[osd] |= CEPH_OSD_EXISTS | CEPH_OSD_UP; | ||
1968 | + map->osd_addr[osd] = addr; | ||
1969 | + } | ||
1970 | + | ||
1971 | + *p = new_weight_end; | ||
1972 | + return 0; | ||
1973 | + | ||
1974 | +e_inval: | ||
1975 | + return -EINVAL; | ||
1976 | +} | ||
1977 | + | ||
1978 | +/* | ||
1979 | * decode and apply an incremental map update. | ||
1980 | */ | ||
1981 | struct ceph_osdmap *osdmap_apply_incremental(void **p, void *end, | ||
1982 | @@ -1290,49 +1399,10 @@ struct ceph_osdmap *osdmap_apply_incremental(void **p, void *end, | ||
1983 | __remove_pg_pool(&map->pg_pools, pi); | ||
1984 | } | ||
1985 | |||
1986 | - /* new_up */ | ||
1987 | - ceph_decode_32_safe(p, end, len, e_inval); | ||
1988 | - while (len--) { | ||
1989 | - u32 osd; | ||
1990 | - struct ceph_entity_addr addr; | ||
1991 | - ceph_decode_32_safe(p, end, osd, e_inval); | ||
1992 | - ceph_decode_copy_safe(p, end, &addr, sizeof(addr), e_inval); | ||
1993 | - ceph_decode_addr(&addr); | ||
1994 | - pr_info("osd%d up\n", osd); | ||
1995 | - BUG_ON(osd >= map->max_osd); | ||
1996 | - map->osd_state[osd] |= CEPH_OSD_UP | CEPH_OSD_EXISTS; | ||
1997 | - map->osd_addr[osd] = addr; | ||
1998 | - } | ||
1999 | - | ||
2000 | - /* new_state */ | ||
2001 | - ceph_decode_32_safe(p, end, len, e_inval); | ||
2002 | - while (len--) { | ||
2003 | - u32 osd; | ||
2004 | - u8 xorstate; | ||
2005 | - ceph_decode_32_safe(p, end, osd, e_inval); | ||
2006 | - xorstate = **(u8 **)p; | ||
2007 | - (*p)++; /* clean flag */ | ||
2008 | - if (xorstate == 0) | ||
2009 | - xorstate = CEPH_OSD_UP; | ||
2010 | - if (xorstate & CEPH_OSD_UP) | ||
2011 | - pr_info("osd%d down\n", osd); | ||
2012 | - if (osd < map->max_osd) | ||
2013 | - map->osd_state[osd] ^= xorstate; | ||
2014 | - } | ||
2015 | - | ||
2016 | - /* new_weight */ | ||
2017 | - ceph_decode_32_safe(p, end, len, e_inval); | ||
2018 | - while (len--) { | ||
2019 | - u32 osd, off; | ||
2020 | - ceph_decode_need(p, end, sizeof(u32)*2, e_inval); | ||
2021 | - osd = ceph_decode_32(p); | ||
2022 | - off = ceph_decode_32(p); | ||
2023 | - pr_info("osd%d weight 0x%x %s\n", osd, off, | ||
2024 | - off == CEPH_OSD_IN ? "(in)" : | ||
2025 | - (off == CEPH_OSD_OUT ? "(out)" : "")); | ||
2026 | - if (osd < map->max_osd) | ||
2027 | - map->osd_weight[osd] = off; | ||
2028 | - } | ||
2029 | + /* new_up_client, new_state, new_weight */ | ||
2030 | + err = decode_new_up_state_weight(p, end, map); | ||
2031 | + if (err) | ||
2032 | + goto bad; | ||
2033 | |||
2034 | /* new_pg_temp */ | ||
2035 | err = decode_new_pg_temp(p, end, map); | ||
2036 | diff --git a/net/rds/tcp.c b/net/rds/tcp.c | ||
2037 | index 9d6ddbacd875..18e50a8fc05f 100644 | ||
2038 | --- a/net/rds/tcp.c | ||
2039 | +++ b/net/rds/tcp.c | ||
2040 | @@ -421,7 +421,7 @@ static int rds_tcp_init(void) | ||
2041 | |||
2042 | ret = rds_tcp_recv_init(); | ||
2043 | if (ret) | ||
2044 | - goto out_slab; | ||
2045 | + goto out_pernet; | ||
2046 | |||
2047 | ret = rds_trans_register(&rds_tcp_transport); | ||
2048 | if (ret) | ||
2049 | @@ -433,8 +433,9 @@ static int rds_tcp_init(void) | ||
2050 | |||
2051 | out_recv: | ||
2052 | rds_tcp_recv_exit(); | ||
2053 | -out_slab: | ||
2054 | +out_pernet: | ||
2055 | unregister_pernet_subsys(&rds_tcp_net_ops); | ||
2056 | +out_slab: | ||
2057 | kmem_cache_destroy(rds_tcp_conn_slab); | ||
2058 | out: | ||
2059 | return ret; | ||
2060 | diff --git a/sound/core/timer.c b/sound/core/timer.c | ||
2061 | index 7c6155f5865b..637d034bb084 100644 | ||
2062 | --- a/sound/core/timer.c | ||
2063 | +++ b/sound/core/timer.c | ||
2064 | @@ -1247,6 +1247,7 @@ static void snd_timer_user_ccallback(struct snd_timer_instance *timeri, | ||
2065 | tu->tstamp = *tstamp; | ||
2066 | if ((tu->filter & (1 << event)) == 0 || !tu->tread) | ||
2067 | return; | ||
2068 | + memset(&r1, 0, sizeof(r1)); | ||
2069 | r1.event = event; | ||
2070 | r1.tstamp = *tstamp; | ||
2071 | r1.val = resolution; | ||
2072 | @@ -1281,6 +1282,7 @@ static void snd_timer_user_tinterrupt(struct snd_timer_instance *timeri, | ||
2073 | } | ||
2074 | if ((tu->filter & (1 << SNDRV_TIMER_EVENT_RESOLUTION)) && | ||
2075 | tu->last_resolution != resolution) { | ||
2076 | + memset(&r1, 0, sizeof(r1)); | ||
2077 | r1.event = SNDRV_TIMER_EVENT_RESOLUTION; | ||
2078 | r1.tstamp = tstamp; | ||
2079 | r1.val = resolution; | ||
2080 | @@ -1746,6 +1748,7 @@ static int snd_timer_user_params(struct file *file, | ||
2081 | if (tu->timeri->flags & SNDRV_TIMER_IFLG_EARLY_EVENT) { | ||
2082 | if (tu->tread) { | ||
2083 | struct snd_timer_tread tread; | ||
2084 | + memset(&tread, 0, sizeof(tread)); | ||
2085 | tread.event = SNDRV_TIMER_EVENT_EARLY; | ||
2086 | tread.tstamp.tv_sec = 0; | ||
2087 | tread.tstamp.tv_nsec = 0; |