Magellan Linux

Contents of /trunk/kernel-magellan/patches-3.8/0106-3.8.7-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2153 - (show annotations) (download)
Tue Apr 16 06:31:03 2013 UTC (11 years ago) by niro
File size: 72843 byte(s)
-linux-3.8.7
1 diff --git a/arch/alpha/kernel/sys_nautilus.c b/arch/alpha/kernel/sys_nautilus.c
2 index 4d4c046..1383f86 100644
3 --- a/arch/alpha/kernel/sys_nautilus.c
4 +++ b/arch/alpha/kernel/sys_nautilus.c
5 @@ -188,6 +188,10 @@ nautilus_machine_check(unsigned long vector, unsigned long la_ptr)
6 extern void free_reserved_mem(void *, void *);
7 extern void pcibios_claim_one_bus(struct pci_bus *);
8
9 +static struct resource irongate_io = {
10 + .name = "Irongate PCI IO",
11 + .flags = IORESOURCE_IO,
12 +};
13 static struct resource irongate_mem = {
14 .name = "Irongate PCI MEM",
15 .flags = IORESOURCE_MEM,
16 @@ -209,6 +213,7 @@ nautilus_init_pci(void)
17
18 irongate = pci_get_bus_and_slot(0, 0);
19 bus->self = irongate;
20 + bus->resource[0] = &irongate_io;
21 bus->resource[1] = &irongate_mem;
22
23 pci_bus_size_bridges(bus);
24 diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c
25 index 1a89824..3b6de7a 100644
26 --- a/arch/arm/mach-exynos/common.c
27 +++ b/arch/arm/mach-exynos/common.c
28 @@ -299,6 +299,7 @@ void exynos4_restart(char mode, const char *cmd)
29
30 void exynos5_restart(char mode, const char *cmd)
31 {
32 + struct device_node *np;
33 u32 val;
34 void __iomem *addr;
35
36 @@ -306,8 +307,9 @@ void exynos5_restart(char mode, const char *cmd)
37 val = 0x1;
38 addr = EXYNOS_SWRESET;
39 } else if (of_machine_is_compatible("samsung,exynos5440")) {
40 - val = (0x10 << 20) | (0x1 << 16);
41 - addr = EXYNOS5440_SWRESET;
42 + np = of_find_compatible_node(NULL, NULL, "samsung,exynos5440-clock");
43 + addr = of_iomap(np, 0) + 0xcc;
44 + val = (0xfff << 20) | (0x1 << 16);
45 } else {
46 pr_err("%s: cannot support non-DT\n", __func__);
47 return;
48 diff --git a/arch/mips/kernel/mcount.S b/arch/mips/kernel/mcount.S
49 index 1658676..33d0671 100644
50 --- a/arch/mips/kernel/mcount.S
51 +++ b/arch/mips/kernel/mcount.S
52 @@ -46,10 +46,9 @@
53 PTR_L a5, PT_R9(sp)
54 PTR_L a6, PT_R10(sp)
55 PTR_L a7, PT_R11(sp)
56 -#else
57 - PTR_ADDIU sp, PT_SIZE
58 #endif
59 -.endm
60 + PTR_ADDIU sp, PT_SIZE
61 + .endm
62
63 .macro RETURN_BACK
64 jr ra
65 @@ -68,7 +67,11 @@ NESTED(ftrace_caller, PT_SIZE, ra)
66 .globl _mcount
67 _mcount:
68 b ftrace_stub
69 - addiu sp,sp,8
70 +#ifdef CONFIG_32BIT
71 + addiu sp,sp,8
72 +#else
73 + nop
74 +#endif
75
76 /* When tracing is activated, it calls ftrace_caller+8 (aka here) */
77 lw t1, function_trace_stop
78 diff --git a/arch/mips/lib/bitops.c b/arch/mips/lib/bitops.c
79 index 239a9c9..f3f7756 100644
80 --- a/arch/mips/lib/bitops.c
81 +++ b/arch/mips/lib/bitops.c
82 @@ -90,12 +90,12 @@ int __mips_test_and_set_bit(unsigned long nr,
83 unsigned bit = nr & SZLONG_MASK;
84 unsigned long mask;
85 unsigned long flags;
86 - unsigned long res;
87 + int res;
88
89 a += nr >> SZLONG_LOG;
90 mask = 1UL << bit;
91 raw_local_irq_save(flags);
92 - res = (mask & *a);
93 + res = (mask & *a) != 0;
94 *a |= mask;
95 raw_local_irq_restore(flags);
96 return res;
97 @@ -116,12 +116,12 @@ int __mips_test_and_set_bit_lock(unsigned long nr,
98 unsigned bit = nr & SZLONG_MASK;
99 unsigned long mask;
100 unsigned long flags;
101 - unsigned long res;
102 + int res;
103
104 a += nr >> SZLONG_LOG;
105 mask = 1UL << bit;
106 raw_local_irq_save(flags);
107 - res = (mask & *a);
108 + res = (mask & *a) != 0;
109 *a |= mask;
110 raw_local_irq_restore(flags);
111 return res;
112 @@ -141,12 +141,12 @@ int __mips_test_and_clear_bit(unsigned long nr, volatile unsigned long *addr)
113 unsigned bit = nr & SZLONG_MASK;
114 unsigned long mask;
115 unsigned long flags;
116 - unsigned long res;
117 + int res;
118
119 a += nr >> SZLONG_LOG;
120 mask = 1UL << bit;
121 raw_local_irq_save(flags);
122 - res = (mask & *a);
123 + res = (mask & *a) != 0;
124 *a &= ~mask;
125 raw_local_irq_restore(flags);
126 return res;
127 @@ -166,12 +166,12 @@ int __mips_test_and_change_bit(unsigned long nr, volatile unsigned long *addr)
128 unsigned bit = nr & SZLONG_MASK;
129 unsigned long mask;
130 unsigned long flags;
131 - unsigned long res;
132 + int res;
133
134 a += nr >> SZLONG_LOG;
135 mask = 1UL << bit;
136 raw_local_irq_save(flags);
137 - res = (mask & *a);
138 + res = (mask & *a) != 0;
139 *a ^= mask;
140 raw_local_irq_restore(flags);
141 return res;
142 diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
143 index 0da39fe..299731e 100644
144 --- a/arch/powerpc/platforms/pseries/lpar.c
145 +++ b/arch/powerpc/platforms/pseries/lpar.c
146 @@ -186,7 +186,13 @@ static long pSeries_lpar_hpte_remove(unsigned long hpte_group)
147 (0x1UL << 4), &dummy1, &dummy2);
148 if (lpar_rc == H_SUCCESS)
149 return i;
150 - BUG_ON(lpar_rc != H_NOT_FOUND);
151 +
152 + /*
153 + * The test for adjunct partition is performed before the
154 + * ANDCOND test. H_RESOURCE may be returned, so we need to
155 + * check for that as well.
156 + */
157 + BUG_ON(lpar_rc != H_NOT_FOUND && lpar_rc != H_RESOURCE);
158
159 slot_offset++;
160 slot_offset &= 0x7;
161 diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile
162 index 8a84501..5ef205c 100644
163 --- a/arch/x86/boot/compressed/Makefile
164 +++ b/arch/x86/boot/compressed/Makefile
165 @@ -4,7 +4,7 @@
166 # create a compressed vmlinux image from the original vmlinux
167 #
168
169 -targets := vmlinux.lds vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma vmlinux.bin.xz vmlinux.bin.lzo head_$(BITS).o misc.o string.o cmdline.o early_serial_console.o piggy.o
170 +targets := vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma vmlinux.bin.xz vmlinux.bin.lzo
171
172 KBUILD_CFLAGS := -m$(BITS) -D__KERNEL__ $(LINUX_INCLUDE) -O2
173 KBUILD_CFLAGS += -fno-strict-aliasing -fPIC
174 @@ -29,7 +29,6 @@ VMLINUX_OBJS = $(obj)/vmlinux.lds $(obj)/head_$(BITS).o $(obj)/misc.o \
175 $(obj)/piggy.o
176
177 $(obj)/eboot.o: KBUILD_CFLAGS += -fshort-wchar -mno-red-zone
178 -$(obj)/efi_stub_$(BITS).o: KBUILD_CLFAGS += -fshort-wchar -mno-red-zone
179
180 ifeq ($(CONFIG_EFI_STUB), y)
181 VMLINUX_OBJS += $(obj)/eboot.o $(obj)/efi_stub_$(BITS).o
182 @@ -43,7 +42,7 @@ OBJCOPYFLAGS_vmlinux.bin := -R .comment -S
183 $(obj)/vmlinux.bin: vmlinux FORCE
184 $(call if_changed,objcopy)
185
186 -targets += vmlinux.bin.all vmlinux.relocs
187 +targets += $(patsubst $(obj)/%,%,$(VMLINUX_OBJS)) vmlinux.bin.all vmlinux.relocs
188
189 CMD_RELOCS = arch/x86/tools/relocs
190 quiet_cmd_relocs = RELOCS $@
191 diff --git a/arch/x86/include/asm/syscall.h b/arch/x86/include/asm/syscall.h
192 index 1ace47b..2e188d6 100644
193 --- a/arch/x86/include/asm/syscall.h
194 +++ b/arch/x86/include/asm/syscall.h
195 @@ -29,13 +29,13 @@ extern const unsigned long sys_call_table[];
196 */
197 static inline int syscall_get_nr(struct task_struct *task, struct pt_regs *regs)
198 {
199 - return regs->orig_ax & __SYSCALL_MASK;
200 + return regs->orig_ax;
201 }
202
203 static inline void syscall_rollback(struct task_struct *task,
204 struct pt_regs *regs)
205 {
206 - regs->ax = regs->orig_ax & __SYSCALL_MASK;
207 + regs->ax = regs->orig_ax;
208 }
209
210 static inline long syscall_get_error(struct task_struct *task,
211 diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
212 index 7881477..6d2f7c0 100644
213 --- a/block/blk-sysfs.c
214 +++ b/block/blk-sysfs.c
215 @@ -229,6 +229,8 @@ queue_store_##name(struct request_queue *q, const char *page, size_t count) \
216 unsigned long val; \
217 ssize_t ret; \
218 ret = queue_var_store(&val, page, count); \
219 + if (ret < 0) \
220 + return ret; \
221 if (neg) \
222 val = !val; \
223 \
224 diff --git a/crypto/gcm.c b/crypto/gcm.c
225 index 1a25263..b97b186 100644
226 --- a/crypto/gcm.c
227 +++ b/crypto/gcm.c
228 @@ -44,6 +44,7 @@ struct crypto_rfc4543_ctx {
229
230 struct crypto_rfc4543_req_ctx {
231 u8 auth_tag[16];
232 + u8 assocbuf[32];
233 struct scatterlist cipher[1];
234 struct scatterlist payload[2];
235 struct scatterlist assoc[2];
236 @@ -1142,9 +1143,19 @@ static struct aead_request *crypto_rfc4543_crypt(struct aead_request *req,
237 scatterwalk_crypto_chain(payload, dst, vdst == req->iv + 8, 2);
238 assoclen += 8 + req->cryptlen - (enc ? 0 : authsize);
239
240 - sg_init_table(assoc, 2);
241 - sg_set_page(assoc, sg_page(req->assoc), req->assoc->length,
242 - req->assoc->offset);
243 + if (req->assoc->length == req->assoclen) {
244 + sg_init_table(assoc, 2);
245 + sg_set_page(assoc, sg_page(req->assoc), req->assoc->length,
246 + req->assoc->offset);
247 + } else {
248 + BUG_ON(req->assoclen > sizeof(rctx->assocbuf));
249 +
250 + scatterwalk_map_and_copy(rctx->assocbuf, req->assoc, 0,
251 + req->assoclen, 0);
252 +
253 + sg_init_table(assoc, 2);
254 + sg_set_buf(assoc, rctx->assocbuf, req->assoclen);
255 + }
256 scatterwalk_crypto_chain(assoc, payload, 0, 2);
257
258 aead_request_set_tfm(subreq, ctx->child);
259 diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
260 index 7928d4d..eb73798 100644
261 --- a/drivers/acpi/pci_root.c
262 +++ b/drivers/acpi/pci_root.c
263 @@ -454,7 +454,6 @@ static int acpi_pci_root_add(struct acpi_device *device)
264 acpi_handle handle;
265 struct acpi_device *child;
266 u32 flags, base_flags;
267 - bool is_osc_granted = false;
268
269 root = kzalloc(sizeof(struct acpi_pci_root), GFP_KERNEL);
270 if (!root)
271 @@ -525,60 +524,6 @@ static int acpi_pci_root_add(struct acpi_device *device)
272 flags = base_flags = OSC_PCI_SEGMENT_GROUPS_SUPPORT;
273 acpi_pci_osc_support(root, flags);
274
275 - /* Indicate support for various _OSC capabilities. */
276 - if (pci_ext_cfg_avail())
277 - flags |= OSC_EXT_PCI_CONFIG_SUPPORT;
278 - if (pcie_aspm_support_enabled()) {
279 - flags |= OSC_ACTIVE_STATE_PWR_SUPPORT |
280 - OSC_CLOCK_PWR_CAPABILITY_SUPPORT;
281 - }
282 - if (pci_msi_enabled())
283 - flags |= OSC_MSI_SUPPORT;
284 - if (flags != base_flags) {
285 - status = acpi_pci_osc_support(root, flags);
286 - if (ACPI_FAILURE(status)) {
287 - dev_info(&device->dev, "ACPI _OSC support "
288 - "notification failed, disabling PCIe ASPM\n");
289 - pcie_no_aspm();
290 - flags = base_flags;
291 - }
292 - }
293 - if (!pcie_ports_disabled
294 - && (flags & ACPI_PCIE_REQ_SUPPORT) == ACPI_PCIE_REQ_SUPPORT) {
295 - flags = OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL
296 - | OSC_PCI_EXPRESS_NATIVE_HP_CONTROL
297 - | OSC_PCI_EXPRESS_PME_CONTROL;
298 -
299 - if (pci_aer_available()) {
300 - if (aer_acpi_firmware_first())
301 - dev_dbg(&device->dev,
302 - "PCIe errors handled by BIOS.\n");
303 - else
304 - flags |= OSC_PCI_EXPRESS_AER_CONTROL;
305 - }
306 -
307 - dev_info(&device->dev,
308 - "Requesting ACPI _OSC control (0x%02x)\n", flags);
309 -
310 - status = acpi_pci_osc_control_set(device->handle, &flags,
311 - OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL);
312 - if (ACPI_SUCCESS(status)) {
313 - is_osc_granted = true;
314 - dev_info(&device->dev,
315 - "ACPI _OSC control (0x%02x) granted\n", flags);
316 - } else {
317 - is_osc_granted = false;
318 - dev_info(&device->dev,
319 - "ACPI _OSC request failed (%s), "
320 - "returned control mask: 0x%02x\n",
321 - acpi_format_exception(status), flags);
322 - }
323 - } else {
324 - dev_info(&device->dev,
325 - "Unable to request _OSC control "
326 - "(_OSC support mask: 0x%02x)\n", flags);
327 - }
328 -
329 /*
330 * TBD: Need PCI interface for enumeration/configuration of roots.
331 */
332 @@ -618,14 +563,66 @@ static int acpi_pci_root_add(struct acpi_device *device)
333 list_for_each_entry(child, &device->children, node)
334 acpi_pci_bridge_scan(child);
335
336 - /* ASPM setting */
337 - if (is_osc_granted) {
338 - if (acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_ASPM)
339 - pcie_clear_aspm(root->bus);
340 + /* Indicate support for various _OSC capabilities. */
341 + if (pci_ext_cfg_avail())
342 + flags |= OSC_EXT_PCI_CONFIG_SUPPORT;
343 + if (pcie_aspm_support_enabled())
344 + flags |= OSC_ACTIVE_STATE_PWR_SUPPORT |
345 + OSC_CLOCK_PWR_CAPABILITY_SUPPORT;
346 + if (pci_msi_enabled())
347 + flags |= OSC_MSI_SUPPORT;
348 + if (flags != base_flags) {
349 + status = acpi_pci_osc_support(root, flags);
350 + if (ACPI_FAILURE(status)) {
351 + dev_info(root->bus->bridge, "ACPI _OSC support "
352 + "notification failed, disabling PCIe ASPM\n");
353 + pcie_no_aspm();
354 + flags = base_flags;
355 + }
356 + }
357 +
358 + if (!pcie_ports_disabled
359 + && (flags & ACPI_PCIE_REQ_SUPPORT) == ACPI_PCIE_REQ_SUPPORT) {
360 + flags = OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL
361 + | OSC_PCI_EXPRESS_NATIVE_HP_CONTROL
362 + | OSC_PCI_EXPRESS_PME_CONTROL;
363 +
364 + if (pci_aer_available()) {
365 + if (aer_acpi_firmware_first())
366 + dev_dbg(root->bus->bridge,
367 + "PCIe errors handled by BIOS.\n");
368 + else
369 + flags |= OSC_PCI_EXPRESS_AER_CONTROL;
370 + }
371 +
372 + dev_info(root->bus->bridge,
373 + "Requesting ACPI _OSC control (0x%02x)\n", flags);
374 +
375 + status = acpi_pci_osc_control_set(device->handle, &flags,
376 + OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL);
377 + if (ACPI_SUCCESS(status)) {
378 + dev_info(root->bus->bridge,
379 + "ACPI _OSC control (0x%02x) granted\n", flags);
380 + if (acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_ASPM) {
381 + /*
382 + * We have ASPM control, but the FADT indicates
383 + * that it's unsupported. Clear it.
384 + */
385 + pcie_clear_aspm(root->bus);
386 + }
387 + } else {
388 + dev_info(root->bus->bridge,
389 + "ACPI _OSC request failed (%s), "
390 + "returned control mask: 0x%02x\n",
391 + acpi_format_exception(status), flags);
392 + pr_info("ACPI _OSC control for PCIe not granted, "
393 + "disabling ASPM\n");
394 + pcie_no_aspm();
395 + }
396 } else {
397 - pr_info("ACPI _OSC control for PCIe not granted, "
398 - "disabling ASPM\n");
399 - pcie_no_aspm();
400 + dev_info(root->bus->bridge,
401 + "Unable to request _OSC control "
402 + "(_OSC support mask: 0x%02x)\n", flags);
403 }
404
405 pci_acpi_add_bus_pm_notifier(device, root->bus);
406 diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
407 index d2ba439..78283bb 100644
408 --- a/drivers/ata/ata_piix.c
409 +++ b/drivers/ata/ata_piix.c
410 @@ -150,6 +150,7 @@ enum piix_controller_ids {
411 tolapai_sata,
412 piix_pata_vmw, /* PIIX4 for VMware, spurious DMA_ERR */
413 ich8_sata_snb,
414 + ich8_2port_sata_snb,
415 };
416
417 struct piix_map_db {
418 @@ -304,7 +305,7 @@ static const struct pci_device_id piix_pci_tbl[] = {
419 /* SATA Controller IDE (Lynx Point) */
420 { 0x8086, 0x8c01, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_snb },
421 /* SATA Controller IDE (Lynx Point) */
422 - { 0x8086, 0x8c08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata },
423 + { 0x8086, 0x8c08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata_snb },
424 /* SATA Controller IDE (Lynx Point) */
425 { 0x8086, 0x8c09, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata },
426 /* SATA Controller IDE (Lynx Point-LP) */
427 @@ -439,6 +440,7 @@ static const struct piix_map_db *piix_map_db_table[] = {
428 [ich8m_apple_sata] = &ich8m_apple_map_db,
429 [tolapai_sata] = &tolapai_map_db,
430 [ich8_sata_snb] = &ich8_map_db,
431 + [ich8_2port_sata_snb] = &ich8_2port_map_db,
432 };
433
434 static struct pci_bits piix_enable_bits[] = {
435 @@ -1242,6 +1244,16 @@ static struct ata_port_info piix_port_info[] = {
436 .udma_mask = ATA_UDMA6,
437 .port_ops = &piix_sata_ops,
438 },
439 +
440 + [ich8_2port_sata_snb] =
441 + {
442 + .flags = PIIX_SATA_FLAGS | PIIX_FLAG_SIDPR
443 + | PIIX_FLAG_PIO16,
444 + .pio_mask = ATA_PIO4,
445 + .mwdma_mask = ATA_MWDMA2,
446 + .udma_mask = ATA_UDMA6,
447 + .port_ops = &piix_sata_ops,
448 + },
449 };
450
451 #define AHCI_PCI_BAR 5
452 diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
453 index 46cd3f4..501c209 100644
454 --- a/drivers/ata/libata-core.c
455 +++ b/drivers/ata/libata-core.c
456 @@ -2329,7 +2329,7 @@ int ata_dev_configure(struct ata_device *dev)
457 * from SATA Settings page of Identify Device Data Log.
458 */
459 if (ata_id_has_devslp(dev->id)) {
460 - u8 sata_setting[ATA_SECT_SIZE];
461 + u8 *sata_setting = ap->sector_buf;
462 int i, j;
463
464 dev->flags |= ATA_DFLAG_DEVSLP;
465 @@ -2437,6 +2437,9 @@ int ata_dev_configure(struct ata_device *dev)
466 dev->max_sectors = min_t(unsigned int, ATA_MAX_SECTORS_128,
467 dev->max_sectors);
468
469 + if (dev->horkage & ATA_HORKAGE_MAX_SEC_LBA48)
470 + dev->max_sectors = ATA_MAX_SECTORS_LBA48;
471 +
472 if (ap->ops->dev_config)
473 ap->ops->dev_config(dev);
474
475 @@ -4098,6 +4101,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
476 /* Weird ATAPI devices */
477 { "TORiSAN DVD-ROM DRD-N216", NULL, ATA_HORKAGE_MAX_SEC_128 },
478 { "QUANTUM DAT DAT72-000", NULL, ATA_HORKAGE_ATAPI_MOD16_DMA },
479 + { "Slimtype DVD A DS8A8SH", NULL, ATA_HORKAGE_MAX_SEC_LBA48 },
480
481 /* Devices we expect to fail diagnostics */
482
483 diff --git a/drivers/base/regmap/regcache-rbtree.c b/drivers/base/regmap/regcache-rbtree.c
484 index e6732cf..79f4fca 100644
485 --- a/drivers/base/regmap/regcache-rbtree.c
486 +++ b/drivers/base/regmap/regcache-rbtree.c
487 @@ -398,7 +398,7 @@ static int regcache_rbtree_sync(struct regmap *map, unsigned int min,
488 base = 0;
489
490 if (max < rbnode->base_reg + rbnode->blklen)
491 - end = rbnode->base_reg + rbnode->blklen - max;
492 + end = max - rbnode->base_reg + 1;
493 else
494 end = rbnode->blklen;
495
496 diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
497 index f00b059..ab3a020 100644
498 --- a/drivers/base/regmap/regmap.c
499 +++ b/drivers/base/regmap/regmap.c
500 @@ -662,12 +662,12 @@ struct regmap *regmap_init(struct device *dev,
501 }
502 }
503
504 + regmap_debugfs_init(map, config->name);
505 +
506 ret = regcache_init(map, config);
507 if (ret != 0)
508 goto err_range;
509
510 - regmap_debugfs_init(map, config->name);
511 -
512 /* Add a devres resource for dev_get_regmap() */
513 m = devres_alloc(dev_get_regmap_release, sizeof(*m), GFP_KERNEL);
514 if (!m) {
515 diff --git a/drivers/cpufreq/exynos-cpufreq.c b/drivers/cpufreq/exynos-cpufreq.c
516 index 7012ea8..41fc550 100644
517 --- a/drivers/cpufreq/exynos-cpufreq.c
518 +++ b/drivers/cpufreq/exynos-cpufreq.c
519 @@ -222,8 +222,6 @@ static int exynos_cpufreq_cpu_init(struct cpufreq_policy *policy)
520
521 cpufreq_frequency_table_get_attr(exynos_info->freq_table, policy->cpu);
522
523 - locking_frequency = exynos_getspeed(0);
524 -
525 /* set the transition latency value */
526 policy->cpuinfo.transition_latency = 100000;
527
528 @@ -288,6 +286,8 @@ static int __init exynos_cpufreq_init(void)
529 goto err_vdd_arm;
530 }
531
532 + locking_frequency = exynos_getspeed(0);
533 +
534 register_pm_notifier(&exynos_cpufreq_nb);
535
536 if (cpufreq_register_driver(&exynos_driver)) {
537 diff --git a/drivers/crypto/ux500/cryp/cryp_core.c b/drivers/crypto/ux500/cryp/cryp_core.c
538 index 8bc5fef..22c9063 100644
539 --- a/drivers/crypto/ux500/cryp/cryp_core.c
540 +++ b/drivers/crypto/ux500/cryp/cryp_core.c
541 @@ -1750,7 +1750,7 @@ static struct platform_driver cryp_driver = {
542 .shutdown = ux500_cryp_shutdown,
543 .driver = {
544 .owner = THIS_MODULE,
545 - .name = "cryp1"
546 + .name = "cryp1",
547 .pm = &ux500_cryp_pm,
548 }
549 };
550 diff --git a/drivers/eisa/pci_eisa.c b/drivers/eisa/pci_eisa.c
551 index cdae207..6c3fca9 100644
552 --- a/drivers/eisa/pci_eisa.c
553 +++ b/drivers/eisa/pci_eisa.c
554 @@ -19,10 +19,10 @@
555 /* There is only *one* pci_eisa device per machine, right ? */
556 static struct eisa_root_device pci_eisa_root;
557
558 -static int __init pci_eisa_init(struct pci_dev *pdev,
559 - const struct pci_device_id *ent)
560 +static int __init pci_eisa_init(struct pci_dev *pdev)
561 {
562 - int rc;
563 + int rc, i;
564 + struct resource *res, *bus_res = NULL;
565
566 if ((rc = pci_enable_device (pdev))) {
567 printk (KERN_ERR "pci_eisa : Could not enable device %s\n",
568 @@ -30,9 +30,30 @@ static int __init pci_eisa_init(struct pci_dev *pdev,
569 return rc;
570 }
571
572 + /*
573 + * The Intel 82375 PCI-EISA bridge is a subtractive-decode PCI
574 + * device, so the resources available on EISA are the same as those
575 + * available on the 82375 bus. This works the same as a PCI-PCI
576 + * bridge in subtractive-decode mode (see pci_read_bridge_bases()).
577 + * We assume other PCI-EISA bridges are similar.
578 + *
579 + * eisa_root_register() can only deal with a single io port resource,
580 + * so we use the first valid io port resource.
581 + */
582 + pci_bus_for_each_resource(pdev->bus, res, i)
583 + if (res && (res->flags & IORESOURCE_IO)) {
584 + bus_res = res;
585 + break;
586 + }
587 +
588 + if (!bus_res) {
589 + dev_err(&pdev->dev, "No resources available\n");
590 + return -1;
591 + }
592 +
593 pci_eisa_root.dev = &pdev->dev;
594 - pci_eisa_root.res = pdev->bus->resource[0];
595 - pci_eisa_root.bus_base_addr = pdev->bus->resource[0]->start;
596 + pci_eisa_root.res = bus_res;
597 + pci_eisa_root.bus_base_addr = bus_res->start;
598 pci_eisa_root.slots = EISA_MAX_SLOTS;
599 pci_eisa_root.dma_mask = pdev->dma_mask;
600 dev_set_drvdata(pci_eisa_root.dev, &pci_eisa_root);
601 @@ -45,22 +66,26 @@ static int __init pci_eisa_init(struct pci_dev *pdev,
602 return 0;
603 }
604
605 -static struct pci_device_id pci_eisa_pci_tbl[] = {
606 - { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
607 - PCI_CLASS_BRIDGE_EISA << 8, 0xffff00, 0 },
608 - { 0, }
609 -};
610 +/*
611 + * We have to call pci_eisa_init_early() before pnpacpi_init()/isapnp_init().
612 + * Otherwise pnp resource will get enabled early and could prevent eisa
613 + * to be initialized.
614 + * Also need to make sure pci_eisa_init_early() is called after
615 + * x86/pci_subsys_init().
616 + * So need to use subsys_initcall_sync with it.
617 + */
618 +static int __init pci_eisa_init_early(void)
619 +{
620 + struct pci_dev *dev = NULL;
621 + int ret;
622
623 -static struct pci_driver __refdata pci_eisa_driver = {
624 - .name = "pci_eisa",
625 - .id_table = pci_eisa_pci_tbl,
626 - .probe = pci_eisa_init,
627 -};
628 + for_each_pci_dev(dev)
629 + if ((dev->class >> 8) == PCI_CLASS_BRIDGE_EISA) {
630 + ret = pci_eisa_init(dev);
631 + if (ret)
632 + return ret;
633 + }
634
635 -static int __init pci_eisa_init_module (void)
636 -{
637 - return pci_register_driver (&pci_eisa_driver);
638 + return 0;
639 }
640 -
641 -device_initcall(pci_eisa_init_module);
642 -MODULE_DEVICE_TABLE(pci, pci_eisa_pci_tbl);
643 +subsys_initcall_sync(pci_eisa_init_early);
644 diff --git a/drivers/gpio/gpio-stmpe.c b/drivers/gpio/gpio-stmpe.c
645 index 770476a..3ce5bc3 100644
646 --- a/drivers/gpio/gpio-stmpe.c
647 +++ b/drivers/gpio/gpio-stmpe.c
648 @@ -307,11 +307,15 @@ static const struct irq_domain_ops stmpe_gpio_irq_simple_ops = {
649 .xlate = irq_domain_xlate_twocell,
650 };
651
652 -static int stmpe_gpio_irq_init(struct stmpe_gpio *stmpe_gpio)
653 +static int stmpe_gpio_irq_init(struct stmpe_gpio *stmpe_gpio,
654 + struct device_node *np)
655 {
656 - int base = stmpe_gpio->irq_base;
657 + int base = 0;
658
659 - stmpe_gpio->domain = irq_domain_add_simple(NULL,
660 + if (!np)
661 + base = stmpe_gpio->irq_base;
662 +
663 + stmpe_gpio->domain = irq_domain_add_simple(np,
664 stmpe_gpio->chip.ngpio, base,
665 &stmpe_gpio_irq_simple_ops, stmpe_gpio);
666 if (!stmpe_gpio->domain) {
667 @@ -346,6 +350,9 @@ static int stmpe_gpio_probe(struct platform_device *pdev)
668 stmpe_gpio->chip = template_chip;
669 stmpe_gpio->chip.ngpio = stmpe->num_gpios;
670 stmpe_gpio->chip.dev = &pdev->dev;
671 +#ifdef CONFIG_OF
672 + stmpe_gpio->chip.of_node = np;
673 +#endif
674 stmpe_gpio->chip.base = pdata ? pdata->gpio_base : -1;
675
676 if (pdata)
677 @@ -366,7 +373,7 @@ static int stmpe_gpio_probe(struct platform_device *pdev)
678 goto out_free;
679
680 if (irq >= 0) {
681 - ret = stmpe_gpio_irq_init(stmpe_gpio);
682 + ret = stmpe_gpio_irq_init(stmpe_gpio, np);
683 if (ret)
684 goto out_disable;
685
686 diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c
687 index 133b413..32d7775 100644
688 --- a/drivers/gpu/drm/drm_fops.c
689 +++ b/drivers/gpu/drm/drm_fops.c
690 @@ -123,6 +123,7 @@ int drm_open(struct inode *inode, struct file *filp)
691 int retcode = 0;
692 int need_setup = 0;
693 struct address_space *old_mapping;
694 + struct address_space *old_imapping;
695
696 minor = idr_find(&drm_minors_idr, minor_id);
697 if (!minor)
698 @@ -137,6 +138,7 @@ int drm_open(struct inode *inode, struct file *filp)
699 if (!dev->open_count++)
700 need_setup = 1;
701 mutex_lock(&dev->struct_mutex);
702 + old_imapping = inode->i_mapping;
703 old_mapping = dev->dev_mapping;
704 if (old_mapping == NULL)
705 dev->dev_mapping = &inode->i_data;
706 @@ -159,8 +161,8 @@ int drm_open(struct inode *inode, struct file *filp)
707
708 err_undo:
709 mutex_lock(&dev->struct_mutex);
710 - filp->f_mapping = old_mapping;
711 - inode->i_mapping = old_mapping;
712 + filp->f_mapping = old_imapping;
713 + inode->i_mapping = old_imapping;
714 iput(container_of(dev->dev_mapping, struct inode, i_data));
715 dev->dev_mapping = old_mapping;
716 mutex_unlock(&dev->struct_mutex);
717 diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
718 index 7adf5a7..ba8805a 100644
719 --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
720 +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
721 @@ -43,7 +43,7 @@ eb_create(int size)
722 {
723 struct eb_objects *eb;
724 int count = PAGE_SIZE / sizeof(struct hlist_head) / 2;
725 - BUILD_BUG_ON(!is_power_of_2(PAGE_SIZE / sizeof(struct hlist_head)));
726 + BUILD_BUG_ON_NOT_POWER_OF_2(PAGE_SIZE / sizeof(struct hlist_head));
727 while (count > size)
728 count >>= 1;
729 eb = kzalloc(count*sizeof(struct hlist_head) +
730 diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
731 index b52ed09..625b091 100644
732 --- a/drivers/gpu/drm/i915/intel_crt.c
733 +++ b/drivers/gpu/drm/i915/intel_crt.c
734 @@ -45,6 +45,9 @@
735
736 struct intel_crt {
737 struct intel_encoder base;
738 + /* DPMS state is stored in the connector, which we need in the
739 + * encoder's enable/disable callbacks */
740 + struct intel_connector *connector;
741 bool force_hotplug_required;
742 u32 adpa_reg;
743 };
744 @@ -81,29 +84,6 @@ static bool intel_crt_get_hw_state(struct intel_encoder *encoder,
745 return true;
746 }
747
748 -static void intel_disable_crt(struct intel_encoder *encoder)
749 -{
750 - struct drm_i915_private *dev_priv = encoder->base.dev->dev_private;
751 - struct intel_crt *crt = intel_encoder_to_crt(encoder);
752 - u32 temp;
753 -
754 - temp = I915_READ(crt->adpa_reg);
755 - temp |= ADPA_HSYNC_CNTL_DISABLE | ADPA_VSYNC_CNTL_DISABLE;
756 - temp &= ~ADPA_DAC_ENABLE;
757 - I915_WRITE(crt->adpa_reg, temp);
758 -}
759 -
760 -static void intel_enable_crt(struct intel_encoder *encoder)
761 -{
762 - struct drm_i915_private *dev_priv = encoder->base.dev->dev_private;
763 - struct intel_crt *crt = intel_encoder_to_crt(encoder);
764 - u32 temp;
765 -
766 - temp = I915_READ(crt->adpa_reg);
767 - temp |= ADPA_DAC_ENABLE;
768 - I915_WRITE(crt->adpa_reg, temp);
769 -}
770 -
771 /* Note: The caller is required to filter out dpms modes not supported by the
772 * platform. */
773 static void intel_crt_set_dpms(struct intel_encoder *encoder, int mode)
774 @@ -135,6 +115,19 @@ static void intel_crt_set_dpms(struct intel_encoder *encoder, int mode)
775 I915_WRITE(crt->adpa_reg, temp);
776 }
777
778 +static void intel_disable_crt(struct intel_encoder *encoder)
779 +{
780 + intel_crt_set_dpms(encoder, DRM_MODE_DPMS_OFF);
781 +}
782 +
783 +static void intel_enable_crt(struct intel_encoder *encoder)
784 +{
785 + struct intel_crt *crt = intel_encoder_to_crt(encoder);
786 +
787 + intel_crt_set_dpms(encoder, crt->connector->base.dpms);
788 +}
789 +
790 +
791 static void intel_crt_dpms(struct drm_connector *connector, int mode)
792 {
793 struct drm_device *dev = connector->dev;
794 @@ -746,6 +739,7 @@ void intel_crt_init(struct drm_device *dev)
795 }
796
797 connector = &intel_connector->base;
798 + crt->connector = intel_connector;
799 drm_connector_init(dev, &intel_connector->base,
800 &intel_crt_connector_funcs, DRM_MODE_CONNECTOR_VGA);
801
802 diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
803 index e6e4df7..d3f834a 100644
804 --- a/drivers/gpu/drm/i915/intel_display.c
805 +++ b/drivers/gpu/drm/i915/intel_display.c
806 @@ -8901,6 +8901,15 @@ static struct intel_quirk intel_quirks[] = {
807
808 /* Acer Aspire 4736Z */
809 { 0x2a42, 0x1025, 0x0260, quirk_invert_brightness },
810 +
811 + /* Acer/eMachines G725 */
812 + { 0x2a42, 0x1025, 0x0210, quirk_invert_brightness },
813 +
814 + /* Acer/eMachines e725 */
815 + { 0x2a42, 0x1025, 0x0212, quirk_invert_brightness },
816 +
817 + /* Acer/Packard Bell NCL20 */
818 + { 0x2a42, 0x1025, 0x034b, quirk_invert_brightness },
819 };
820
821 static void intel_init_quirks(struct drm_device *dev)
822 diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c b/drivers/gpu/drm/mgag200/mgag200_mode.c
823 index 4f50c40..2e7c949 100644
824 --- a/drivers/gpu/drm/mgag200/mgag200_mode.c
825 +++ b/drivers/gpu/drm/mgag200/mgag200_mode.c
826 @@ -751,8 +751,6 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc,
827 int i;
828 unsigned char misc = 0;
829 unsigned char ext_vga[6];
830 - unsigned char ext_vga_index24;
831 - unsigned char dac_index90 = 0;
832 u8 bppshift;
833
834 static unsigned char dacvalue[] = {
835 @@ -803,7 +801,6 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc,
836 option2 = 0x0000b000;
837 break;
838 case G200_ER:
839 - dac_index90 = 0;
840 break;
841 }
842
843 @@ -852,10 +849,8 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc,
844 WREG_DAC(i, dacvalue[i]);
845 }
846
847 - if (mdev->type == G200_ER) {
848 - WREG_DAC(0x90, dac_index90);
849 - }
850 -
851 + if (mdev->type == G200_ER)
852 + WREG_DAC(0x90, 0);
853
854 if (option)
855 pci_write_config_dword(dev->pdev, PCI_MGA_OPTION, option);
856 @@ -952,8 +947,6 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc,
857 if (mdev->type == G200_WB)
858 ext_vga[1] |= 0x88;
859
860 - ext_vga_index24 = 0x05;
861 -
862 /* Set pixel clocks */
863 misc = 0x2d;
864 WREG8(MGA_MISC_OUT, misc);
865 @@ -965,7 +958,7 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc,
866 }
867
868 if (mdev->type == G200_ER)
869 - WREG_ECRT(24, ext_vga_index24);
870 + WREG_ECRT(0x24, 0x5);
871
872 if (mdev->type == G200_EV) {
873 WREG_ECRT(6, 0);
874 diff --git a/drivers/gpu/drm/nouveau/nouveau_abi16.c b/drivers/gpu/drm/nouveau/nouveau_abi16.c
875 index 4124192..b569fe8 100644
876 --- a/drivers/gpu/drm/nouveau/nouveau_abi16.c
877 +++ b/drivers/gpu/drm/nouveau/nouveau_abi16.c
878 @@ -386,7 +386,7 @@ nouveau_abi16_ioctl_notifierobj_alloc(ABI16_IOCTL_ARGS)
879 struct nouveau_drm *drm = nouveau_drm(dev);
880 struct nouveau_device *device = nv_device(drm->device);
881 struct nouveau_abi16 *abi16 = nouveau_abi16_get(file_priv, dev);
882 - struct nouveau_abi16_chan *chan, *temp;
883 + struct nouveau_abi16_chan *chan = NULL, *temp;
884 struct nouveau_abi16_ntfy *ntfy;
885 struct nouveau_object *object;
886 struct nv_dma_class args = {};
887 @@ -399,10 +399,11 @@ nouveau_abi16_ioctl_notifierobj_alloc(ABI16_IOCTL_ARGS)
888 if (unlikely(nv_device(abi16->device)->card_type >= NV_C0))
889 return nouveau_abi16_put(abi16, -EINVAL);
890
891 - list_for_each_entry_safe(chan, temp, &abi16->channels, head) {
892 - if (chan->chan->handle == (NVDRM_CHAN | info->channel))
893 + list_for_each_entry(temp, &abi16->channels, head) {
894 + if (temp->chan->handle == (NVDRM_CHAN | info->channel)) {
895 + chan = temp;
896 break;
897 - chan = NULL;
898 + }
899 }
900
901 if (!chan)
902 @@ -454,17 +455,18 @@ nouveau_abi16_ioctl_gpuobj_free(ABI16_IOCTL_ARGS)
903 {
904 struct drm_nouveau_gpuobj_free *fini = data;
905 struct nouveau_abi16 *abi16 = nouveau_abi16_get(file_priv, dev);
906 - struct nouveau_abi16_chan *chan, *temp;
907 + struct nouveau_abi16_chan *chan = NULL, *temp;
908 struct nouveau_abi16_ntfy *ntfy;
909 int ret;
910
911 if (unlikely(!abi16))
912 return -ENOMEM;
913
914 - list_for_each_entry_safe(chan, temp, &abi16->channels, head) {
915 - if (chan->chan->handle == (NVDRM_CHAN | fini->channel))
916 + list_for_each_entry(temp, &abi16->channels, head) {
917 + if (temp->chan->handle == (NVDRM_CHAN | fini->channel)) {
918 + chan = temp;
919 break;
920 - chan = NULL;
921 + }
922 }
923
924 if (!chan)
925 diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c
926 index 25ddf3e..811062c 100644
927 --- a/drivers/hid/hid-magicmouse.c
928 +++ b/drivers/hid/hid-magicmouse.c
929 @@ -462,6 +462,21 @@ static int magicmouse_input_mapping(struct hid_device *hdev,
930 return 0;
931 }
932
933 +static void magicmouse_input_configured(struct hid_device *hdev,
934 + struct hid_input *hi)
935 +
936 +{
937 + struct magicmouse_sc *msc = hid_get_drvdata(hdev);
938 +
939 + int ret = magicmouse_setup_input(msc->input, hdev);
940 + if (ret) {
941 + hid_err(hdev, "magicmouse setup input failed (%d)\n", ret);
942 + /* clean msc->input to notify probe() of the failure */
943 + msc->input = NULL;
944 + }
945 +}
946 +
947 +
948 static int magicmouse_probe(struct hid_device *hdev,
949 const struct hid_device_id *id)
950 {
951 @@ -493,15 +508,10 @@ static int magicmouse_probe(struct hid_device *hdev,
952 goto err_free;
953 }
954
955 - /* We do this after hid-input is done parsing reports so that
956 - * hid-input uses the most natural button and axis IDs.
957 - */
958 - if (msc->input) {
959 - ret = magicmouse_setup_input(msc->input, hdev);
960 - if (ret) {
961 - hid_err(hdev, "magicmouse setup input failed (%d)\n", ret);
962 - goto err_stop_hw;
963 - }
964 + if (!msc->input) {
965 + hid_err(hdev, "magicmouse input not registered\n");
966 + ret = -ENOMEM;
967 + goto err_stop_hw;
968 }
969
970 if (id->product == USB_DEVICE_ID_APPLE_MAGICMOUSE)
971 @@ -568,6 +578,7 @@ static struct hid_driver magicmouse_driver = {
972 .remove = magicmouse_remove,
973 .raw_event = magicmouse_raw_event,
974 .input_mapping = magicmouse_input_mapping,
975 + .input_configured = magicmouse_input_configured,
976 };
977
978 static int __init magicmouse_init(void)
979 diff --git a/drivers/hwspinlock/hwspinlock_core.c b/drivers/hwspinlock/hwspinlock_core.c
980 index db713c0..461a0d7 100644
981 --- a/drivers/hwspinlock/hwspinlock_core.c
982 +++ b/drivers/hwspinlock/hwspinlock_core.c
983 @@ -416,6 +416,8 @@ static int __hwspin_lock_request(struct hwspinlock *hwlock)
984 ret = pm_runtime_get_sync(dev);
985 if (ret < 0) {
986 dev_err(dev, "%s: can't power on device\n", __func__);
987 + pm_runtime_put_noidle(dev);
988 + module_put(dev->driver->owner);
989 return ret;
990 }
991
992 diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
993 index b3e3294..0d03d38 100644
994 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
995 +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
996 @@ -7858,12 +7858,19 @@ static int __init ixgbe_init_module(void)
997 ixgbe_dbg_init();
998 #endif /* CONFIG_DEBUG_FS */
999
1000 + ret = pci_register_driver(&ixgbe_driver);
1001 + if (ret) {
1002 +#ifdef CONFIG_DEBUG_FS
1003 + ixgbe_dbg_exit();
1004 +#endif /* CONFIG_DEBUG_FS */
1005 + return ret;
1006 + }
1007 +
1008 #ifdef CONFIG_IXGBE_DCA
1009 dca_register_notify(&dca_notifier);
1010 #endif
1011
1012 - ret = pci_register_driver(&ixgbe_driver);
1013 - return ret;
1014 + return 0;
1015 }
1016
1017 module_init(ixgbe_init_module);
1018 diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
1019 index 998974f..2d849da 100644
1020 --- a/drivers/net/ethernet/realtek/r8169.c
1021 +++ b/drivers/net/ethernet/realtek/r8169.c
1022 @@ -3819,6 +3819,30 @@ static void rtl_init_mdio_ops(struct rtl8169_private *tp)
1023 }
1024 }
1025
1026 +static void rtl_speed_down(struct rtl8169_private *tp)
1027 +{
1028 + u32 adv;
1029 + int lpa;
1030 +
1031 + rtl_writephy(tp, 0x1f, 0x0000);
1032 + lpa = rtl_readphy(tp, MII_LPA);
1033 +
1034 + if (lpa & (LPA_10HALF | LPA_10FULL))
1035 + adv = ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full;
1036 + else if (lpa & (LPA_100HALF | LPA_100FULL))
1037 + adv = ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full |
1038 + ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Full;
1039 + else
1040 + adv = ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full |
1041 + ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Full |
1042 + (tp->mii.supports_gmii ?
1043 + ADVERTISED_1000baseT_Half |
1044 + ADVERTISED_1000baseT_Full : 0);
1045 +
1046 + rtl8169_set_speed(tp->dev, AUTONEG_ENABLE, SPEED_1000, DUPLEX_FULL,
1047 + adv);
1048 +}
1049 +
1050 static void rtl_wol_suspend_quirk(struct rtl8169_private *tp)
1051 {
1052 void __iomem *ioaddr = tp->mmio_addr;
1053 @@ -3849,9 +3873,7 @@ static bool rtl_wol_pll_power_down(struct rtl8169_private *tp)
1054 if (!(__rtl8169_get_wol(tp) & WAKE_ANY))
1055 return false;
1056
1057 - rtl_writephy(tp, 0x1f, 0x0000);
1058 - rtl_writephy(tp, MII_BMCR, 0x0000);
1059 -
1060 + rtl_speed_down(tp);
1061 rtl_wol_suspend_quirk(tp);
1062
1063 return true;
1064 diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c
1065 index cdb11b3..3eca710 100644
1066 --- a/drivers/net/wireless/mwifiex/cfg80211.c
1067 +++ b/drivers/net/wireless/mwifiex/cfg80211.c
1068 @@ -1846,7 +1846,8 @@ mwifiex_cfg80211_scan(struct wiphy *wiphy,
1069 }
1070 }
1071
1072 - for (i = 0; i < request->n_channels; i++) {
1073 + for (i = 0; i < min_t(u32, request->n_channels,
1074 + MWIFIEX_USER_SCAN_CHAN_MAX); i++) {
1075 chan = request->channels[i];
1076 priv->user_scan_cfg->chan_list[i].chan_number = chan->hw_value;
1077 priv->user_scan_cfg->chan_list[i].radio_type = chan->band;
1078 diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c
1079 index 8955a0e..771be26 100644
1080 --- a/drivers/net/wireless/mwifiex/scan.c
1081 +++ b/drivers/net/wireless/mwifiex/scan.c
1082 @@ -1371,8 +1371,10 @@ int mwifiex_scan_networks(struct mwifiex_private *priv,
1083 queue_work(adapter->workqueue, &adapter->main_work);
1084
1085 /* Perform internal scan synchronously */
1086 - if (!priv->scan_request)
1087 + if (!priv->scan_request) {
1088 + dev_dbg(adapter->dev, "wait internal scan\n");
1089 mwifiex_wait_queue_complete(adapter, cmd_node);
1090 + }
1091 } else {
1092 spin_unlock_irqrestore(&adapter->scan_pending_q_lock,
1093 flags);
1094 @@ -1768,7 +1770,12 @@ check_next_scan:
1095 /* Need to indicate IOCTL complete */
1096 if (adapter->curr_cmd->wait_q_enabled) {
1097 adapter->cmd_wait_q.status = 0;
1098 - mwifiex_complete_cmd(adapter, adapter->curr_cmd);
1099 + if (!priv->scan_request) {
1100 + dev_dbg(adapter->dev,
1101 + "complete internal scan\n");
1102 + mwifiex_complete_cmd(adapter,
1103 + adapter->curr_cmd);
1104 + }
1105 }
1106 if (priv->report_scan_result)
1107 priv->report_scan_result = false;
1108 diff --git a/drivers/net/wireless/rt2x00/rt2x00pci.c b/drivers/net/wireless/rt2x00/rt2x00pci.c
1109 index a0c8cae..b1c673e 100644
1110 --- a/drivers/net/wireless/rt2x00/rt2x00pci.c
1111 +++ b/drivers/net/wireless/rt2x00/rt2x00pci.c
1112 @@ -52,8 +52,8 @@ int rt2x00pci_regbusy_read(struct rt2x00_dev *rt2x00dev,
1113 udelay(REGISTER_BUSY_DELAY);
1114 }
1115
1116 - ERROR(rt2x00dev, "Indirect register access failed: "
1117 - "offset=0x%.08x, value=0x%.08x\n", offset, *reg);
1118 + printk_once(KERN_ERR "%s() Indirect register access failed: "
1119 + "offset=0x%.08x, value=0x%.08x\n", __func__, offset, *reg);
1120 *reg = ~0;
1121
1122 return 0;
1123 diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
1124 index 1af4008..21354bf 100644
1125 --- a/drivers/pci/pci-acpi.c
1126 +++ b/drivers/pci/pci-acpi.c
1127 @@ -53,14 +53,15 @@ static void pci_acpi_wake_dev(acpi_handle handle, u32 event, void *context)
1128 return;
1129 }
1130
1131 - if (!pci_dev->pm_cap || !pci_dev->pme_support
1132 - || pci_check_pme_status(pci_dev)) {
1133 - if (pci_dev->pme_poll)
1134 - pci_dev->pme_poll = false;
1135 + /* Clear PME Status if set. */
1136 + if (pci_dev->pme_support)
1137 + pci_check_pme_status(pci_dev);
1138
1139 - pci_wakeup_event(pci_dev);
1140 - pm_runtime_resume(&pci_dev->dev);
1141 - }
1142 + if (pci_dev->pme_poll)
1143 + pci_dev->pme_poll = false;
1144 +
1145 + pci_wakeup_event(pci_dev);
1146 + pm_runtime_resume(&pci_dev->dev);
1147
1148 if (pci_dev->subordinate)
1149 pci_pme_wakeup_bus(pci_dev->subordinate);
1150 diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c
1151 index 08c243a..ed4d094 100644
1152 --- a/drivers/pci/pcie/portdrv_pci.c
1153 +++ b/drivers/pci/pcie/portdrv_pci.c
1154 @@ -185,14 +185,6 @@ static const struct dev_pm_ops pcie_portdrv_pm_ops = {
1155 #endif /* !PM */
1156
1157 /*
1158 - * PCIe port runtime suspend is broken for some chipsets, so use a
1159 - * black list to disable runtime PM for these chipsets.
1160 - */
1161 -static const struct pci_device_id port_runtime_pm_black_list[] = {
1162 - { /* end: all zeroes */ }
1163 -};
1164 -
1165 -/*
1166 * pcie_portdrv_probe - Probe PCI-Express port devices
1167 * @dev: PCI-Express port device being probed
1168 *
1169 @@ -225,16 +217,11 @@ static int pcie_portdrv_probe(struct pci_dev *dev,
1170 * it by default.
1171 */
1172 dev->d3cold_allowed = false;
1173 - if (!pci_match_id(port_runtime_pm_black_list, dev))
1174 - pm_runtime_put_noidle(&dev->dev);
1175 -
1176 return 0;
1177 }
1178
1179 static void pcie_portdrv_remove(struct pci_dev *dev)
1180 {
1181 - if (!pci_match_id(port_runtime_pm_black_list, dev))
1182 - pm_runtime_get_noresume(&dev->dev);
1183 pcie_port_device_remove(dev);
1184 pci_disable_device(dev);
1185 }
1186 diff --git a/drivers/platform/x86/msi-wmi.c b/drivers/platform/x86/msi-wmi.c
1187 index 2264331..b96766b 100644
1188 --- a/drivers/platform/x86/msi-wmi.c
1189 +++ b/drivers/platform/x86/msi-wmi.c
1190 @@ -176,7 +176,7 @@ static void msi_wmi_notify(u32 value, void *context)
1191 pr_debug("Suppressed key event 0x%X - "
1192 "Last press was %lld us ago\n",
1193 key->code, ktime_to_us(diff));
1194 - return;
1195 + goto msi_wmi_notify_exit;
1196 }
1197 last_pressed[key->code - SCANCODE_BASE] = cur;
1198
1199 @@ -195,6 +195,8 @@ static void msi_wmi_notify(u32 value, void *context)
1200 pr_info("Unknown key pressed - %x\n", eventcode);
1201 } else
1202 pr_info("Unknown event received\n");
1203 +
1204 +msi_wmi_notify_exit:
1205 kfree(response.pointer);
1206 }
1207
1208 diff --git a/drivers/remoteproc/Kconfig b/drivers/remoteproc/Kconfig
1209 index 96ce101..a936efb 100644
1210 --- a/drivers/remoteproc/Kconfig
1211 +++ b/drivers/remoteproc/Kconfig
1212 @@ -5,7 +5,7 @@ config REMOTEPROC
1213 tristate
1214 depends on EXPERIMENTAL
1215 depends on HAS_DMA
1216 - select FW_CONFIG
1217 + select FW_LOADER
1218 select VIRTIO
1219
1220 config OMAP_REMOTEPROC
1221 diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
1222 index dd3bfaf..752b507 100644
1223 --- a/drivers/remoteproc/remoteproc_core.c
1224 +++ b/drivers/remoteproc/remoteproc_core.c
1225 @@ -370,10 +370,12 @@ static int rproc_handle_vdev(struct rproc *rproc, struct fw_rsc_vdev *rsc,
1226 /* it is now safe to add the virtio device */
1227 ret = rproc_add_virtio_dev(rvdev, rsc->id);
1228 if (ret)
1229 - goto free_rvdev;
1230 + goto remove_rvdev;
1231
1232 return 0;
1233
1234 +remove_rvdev:
1235 + list_del(&rvdev->node);
1236 free_rvdev:
1237 kfree(rvdev);
1238 return ret;
1239 diff --git a/drivers/remoteproc/ste_modem_rproc.c b/drivers/remoteproc/ste_modem_rproc.c
1240 index a7743c0..fb95c42 100644
1241 --- a/drivers/remoteproc/ste_modem_rproc.c
1242 +++ b/drivers/remoteproc/ste_modem_rproc.c
1243 @@ -240,6 +240,8 @@ static int sproc_drv_remove(struct platform_device *pdev)
1244
1245 /* Unregister as remoteproc device */
1246 rproc_del(sproc->rproc);
1247 + dma_free_coherent(sproc->rproc->dev.parent, SPROC_FW_SIZE,
1248 + sproc->fw_addr, sproc->fw_dma_addr);
1249 rproc_put(sproc->rproc);
1250
1251 mdev->drv_data = NULL;
1252 @@ -297,10 +299,13 @@ static int sproc_probe(struct platform_device *pdev)
1253 /* Register as a remoteproc device */
1254 err = rproc_add(rproc);
1255 if (err)
1256 - goto free_rproc;
1257 + goto free_mem;
1258
1259 return 0;
1260
1261 +free_mem:
1262 + dma_free_coherent(rproc->dev.parent, SPROC_FW_SIZE,
1263 + sproc->fw_addr, sproc->fw_dma_addr);
1264 free_rproc:
1265 /* Reset device data upon error */
1266 mdev->drv_data = NULL;
1267 diff --git a/drivers/rtc/rtc-at91rm9200.c b/drivers/rtc/rtc-at91rm9200.c
1268 index d38b267..b6469e2 100644
1269 --- a/drivers/rtc/rtc-at91rm9200.c
1270 +++ b/drivers/rtc/rtc-at91rm9200.c
1271 @@ -44,7 +44,6 @@ static DECLARE_COMPLETION(at91_rtc_updated);
1272 static unsigned int at91_alarm_year = AT91_RTC_EPOCH;
1273 static void __iomem *at91_rtc_regs;
1274 static int irq;
1275 -static u32 at91_rtc_imr;
1276
1277 /*
1278 * Decode time/date into rtc_time structure
1279 @@ -109,11 +108,9 @@ static int at91_rtc_settime(struct device *dev, struct rtc_time *tm)
1280 cr = at91_rtc_read(AT91_RTC_CR);
1281 at91_rtc_write(AT91_RTC_CR, cr | AT91_RTC_UPDCAL | AT91_RTC_UPDTIM);
1282
1283 - at91_rtc_imr |= AT91_RTC_ACKUPD;
1284 at91_rtc_write(AT91_RTC_IER, AT91_RTC_ACKUPD);
1285 wait_for_completion(&at91_rtc_updated); /* wait for ACKUPD interrupt */
1286 at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ACKUPD);
1287 - at91_rtc_imr &= ~AT91_RTC_ACKUPD;
1288
1289 at91_rtc_write(AT91_RTC_TIMR,
1290 bin2bcd(tm->tm_sec) << 0
1291 @@ -145,7 +142,7 @@ static int at91_rtc_readalarm(struct device *dev, struct rtc_wkalrm *alrm)
1292 tm->tm_yday = rtc_year_days(tm->tm_mday, tm->tm_mon, tm->tm_year);
1293 tm->tm_year = at91_alarm_year - 1900;
1294
1295 - alrm->enabled = (at91_rtc_imr & AT91_RTC_ALARM)
1296 + alrm->enabled = (at91_rtc_read(AT91_RTC_IMR) & AT91_RTC_ALARM)
1297 ? 1 : 0;
1298
1299 pr_debug("%s(): %4d-%02d-%02d %02d:%02d:%02d\n", __func__,
1300 @@ -171,7 +168,6 @@ static int at91_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm)
1301 tm.tm_sec = alrm->time.tm_sec;
1302
1303 at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ALARM);
1304 - at91_rtc_imr &= ~AT91_RTC_ALARM;
1305 at91_rtc_write(AT91_RTC_TIMALR,
1306 bin2bcd(tm.tm_sec) << 0
1307 | bin2bcd(tm.tm_min) << 8
1308 @@ -184,7 +180,6 @@ static int at91_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm)
1309
1310 if (alrm->enabled) {
1311 at91_rtc_write(AT91_RTC_SCCR, AT91_RTC_ALARM);
1312 - at91_rtc_imr |= AT91_RTC_ALARM;
1313 at91_rtc_write(AT91_RTC_IER, AT91_RTC_ALARM);
1314 }
1315
1316 @@ -201,12 +196,9 @@ static int at91_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled)
1317
1318 if (enabled) {
1319 at91_rtc_write(AT91_RTC_SCCR, AT91_RTC_ALARM);
1320 - at91_rtc_imr |= AT91_RTC_ALARM;
1321 at91_rtc_write(AT91_RTC_IER, AT91_RTC_ALARM);
1322 - } else {
1323 + } else
1324 at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ALARM);
1325 - at91_rtc_imr &= ~AT91_RTC_ALARM;
1326 - }
1327
1328 return 0;
1329 }
1330 @@ -215,10 +207,12 @@ static int at91_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled)
1331 */
1332 static int at91_rtc_proc(struct device *dev, struct seq_file *seq)
1333 {
1334 + unsigned long imr = at91_rtc_read(AT91_RTC_IMR);
1335 +
1336 seq_printf(seq, "update_IRQ\t: %s\n",
1337 - (at91_rtc_imr & AT91_RTC_ACKUPD) ? "yes" : "no");
1338 + (imr & AT91_RTC_ACKUPD) ? "yes" : "no");
1339 seq_printf(seq, "periodic_IRQ\t: %s\n",
1340 - (at91_rtc_imr & AT91_RTC_SECEV) ? "yes" : "no");
1341 + (imr & AT91_RTC_SECEV) ? "yes" : "no");
1342
1343 return 0;
1344 }
1345 @@ -233,7 +227,7 @@ static irqreturn_t at91_rtc_interrupt(int irq, void *dev_id)
1346 unsigned int rtsr;
1347 unsigned long events = 0;
1348
1349 - rtsr = at91_rtc_read(AT91_RTC_SR) & at91_rtc_imr;
1350 + rtsr = at91_rtc_read(AT91_RTC_SR) & at91_rtc_read(AT91_RTC_IMR);
1351 if (rtsr) { /* this interrupt is shared! Is it ours? */
1352 if (rtsr & AT91_RTC_ALARM)
1353 events |= (RTC_AF | RTC_IRQF);
1354 @@ -297,7 +291,6 @@ static int __init at91_rtc_probe(struct platform_device *pdev)
1355 at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ACKUPD | AT91_RTC_ALARM |
1356 AT91_RTC_SECEV | AT91_RTC_TIMEV |
1357 AT91_RTC_CALEV);
1358 - at91_rtc_imr = 0;
1359
1360 ret = request_irq(irq, at91_rtc_interrupt,
1361 IRQF_SHARED,
1362 @@ -337,7 +330,6 @@ static int __exit at91_rtc_remove(struct platform_device *pdev)
1363 at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ACKUPD | AT91_RTC_ALARM |
1364 AT91_RTC_SECEV | AT91_RTC_TIMEV |
1365 AT91_RTC_CALEV);
1366 - at91_rtc_imr = 0;
1367 free_irq(irq, pdev);
1368
1369 rtc_device_unregister(rtc);
1370 @@ -350,35 +342,31 @@ static int __exit at91_rtc_remove(struct platform_device *pdev)
1371
1372 /* AT91RM9200 RTC Power management control */
1373
1374 -static u32 at91_rtc_bkpimr;
1375 -
1376 +static u32 at91_rtc_imr;
1377
1378 static int at91_rtc_suspend(struct device *dev)
1379 {
1380 /* this IRQ is shared with DBGU and other hardware which isn't
1381 * necessarily doing PM like we are...
1382 */
1383 - at91_rtc_bkpimr = at91_rtc_imr & (AT91_RTC_ALARM|AT91_RTC_SECEV);
1384 - if (at91_rtc_bkpimr) {
1385 - if (device_may_wakeup(dev)) {
1386 + at91_rtc_imr = at91_rtc_read(AT91_RTC_IMR)
1387 + & (AT91_RTC_ALARM|AT91_RTC_SECEV);
1388 + if (at91_rtc_imr) {
1389 + if (device_may_wakeup(dev))
1390 enable_irq_wake(irq);
1391 - } else {
1392 - at91_rtc_write(AT91_RTC_IDR, at91_rtc_bkpimr);
1393 - at91_rtc_imr &= ~at91_rtc_bkpimr;
1394 - }
1395 -}
1396 + else
1397 + at91_rtc_write(AT91_RTC_IDR, at91_rtc_imr);
1398 + }
1399 return 0;
1400 }
1401
1402 static int at91_rtc_resume(struct device *dev)
1403 {
1404 - if (at91_rtc_bkpimr) {
1405 - if (device_may_wakeup(dev)) {
1406 + if (at91_rtc_imr) {
1407 + if (device_may_wakeup(dev))
1408 disable_irq_wake(irq);
1409 - } else {
1410 - at91_rtc_imr |= at91_rtc_bkpimr;
1411 - at91_rtc_write(AT91_RTC_IER, at91_rtc_bkpimr);
1412 - }
1413 + else
1414 + at91_rtc_write(AT91_RTC_IER, at91_rtc_imr);
1415 }
1416 return 0;
1417 }
1418 diff --git a/drivers/rtc/rtc-at91rm9200.h b/drivers/rtc/rtc-at91rm9200.h
1419 index 5f940b6..da1945e 100644
1420 --- a/drivers/rtc/rtc-at91rm9200.h
1421 +++ b/drivers/rtc/rtc-at91rm9200.h
1422 @@ -64,6 +64,7 @@
1423 #define AT91_RTC_SCCR 0x1c /* Status Clear Command Register */
1424 #define AT91_RTC_IER 0x20 /* Interrupt Enable Register */
1425 #define AT91_RTC_IDR 0x24 /* Interrupt Disable Register */
1426 +#define AT91_RTC_IMR 0x28 /* Interrupt Mask Register */
1427
1428 #define AT91_RTC_VER 0x2c /* Valid Entry Register */
1429 #define AT91_RTC_NVTIM (1 << 0) /* Non valid Time */
1430 diff --git a/drivers/spi/spi-mpc512x-psc.c b/drivers/spi/spi-mpc512x-psc.c
1431 index cb3a310..41e21bf 100644
1432 --- a/drivers/spi/spi-mpc512x-psc.c
1433 +++ b/drivers/spi/spi-mpc512x-psc.c
1434 @@ -164,7 +164,7 @@ static int mpc512x_psc_spi_transfer_rxtx(struct spi_device *spi,
1435
1436 for (i = count; i > 0; i--) {
1437 data = tx_buf ? *tx_buf++ : 0;
1438 - if (len == EOFBYTE)
1439 + if (len == EOFBYTE && t->cs_change)
1440 setbits32(&fifo->txcmd, MPC512x_PSC_FIFO_EOF);
1441 out_8(&fifo->txdata_8, data);
1442 len--;
1443 diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
1444 index ad93231..6796a25 100644
1445 --- a/drivers/spi/spi-s3c64xx.c
1446 +++ b/drivers/spi/spi-s3c64xx.c
1447 @@ -997,25 +997,30 @@ static irqreturn_t s3c64xx_spi_irq(int irq, void *data)
1448 {
1449 struct s3c64xx_spi_driver_data *sdd = data;
1450 struct spi_master *spi = sdd->master;
1451 - unsigned int val;
1452 + unsigned int val, clr = 0;
1453
1454 - val = readl(sdd->regs + S3C64XX_SPI_PENDING_CLR);
1455 + val = readl(sdd->regs + S3C64XX_SPI_STATUS);
1456
1457 - val &= S3C64XX_SPI_PND_RX_OVERRUN_CLR |
1458 - S3C64XX_SPI_PND_RX_UNDERRUN_CLR |
1459 - S3C64XX_SPI_PND_TX_OVERRUN_CLR |
1460 - S3C64XX_SPI_PND_TX_UNDERRUN_CLR;
1461 -
1462 - writel(val, sdd->regs + S3C64XX_SPI_PENDING_CLR);
1463 -
1464 - if (val & S3C64XX_SPI_PND_RX_OVERRUN_CLR)
1465 + if (val & S3C64XX_SPI_ST_RX_OVERRUN_ERR) {
1466 + clr = S3C64XX_SPI_PND_RX_OVERRUN_CLR;
1467 dev_err(&spi->dev, "RX overrun\n");
1468 - if (val & S3C64XX_SPI_PND_RX_UNDERRUN_CLR)
1469 + }
1470 + if (val & S3C64XX_SPI_ST_RX_UNDERRUN_ERR) {
1471 + clr |= S3C64XX_SPI_PND_RX_UNDERRUN_CLR;
1472 dev_err(&spi->dev, "RX underrun\n");
1473 - if (val & S3C64XX_SPI_PND_TX_OVERRUN_CLR)
1474 + }
1475 + if (val & S3C64XX_SPI_ST_TX_OVERRUN_ERR) {
1476 + clr |= S3C64XX_SPI_PND_TX_OVERRUN_CLR;
1477 dev_err(&spi->dev, "TX overrun\n");
1478 - if (val & S3C64XX_SPI_PND_TX_UNDERRUN_CLR)
1479 + }
1480 + if (val & S3C64XX_SPI_ST_TX_UNDERRUN_ERR) {
1481 + clr |= S3C64XX_SPI_PND_TX_UNDERRUN_CLR;
1482 dev_err(&spi->dev, "TX underrun\n");
1483 + }
1484 +
1485 + /* Clear the pending irq by setting and then clearing it */
1486 + writel(clr, sdd->regs + S3C64XX_SPI_PENDING_CLR);
1487 + writel(0, sdd->regs + S3C64XX_SPI_PENDING_CLR);
1488
1489 return IRQ_HANDLED;
1490 }
1491 @@ -1039,9 +1044,13 @@ static void s3c64xx_spi_hwinit(struct s3c64xx_spi_driver_data *sdd, int channel)
1492 writel(0, regs + S3C64XX_SPI_MODE_CFG);
1493 writel(0, regs + S3C64XX_SPI_PACKET_CNT);
1494
1495 - /* Clear any irq pending bits */
1496 - writel(readl(regs + S3C64XX_SPI_PENDING_CLR),
1497 - regs + S3C64XX_SPI_PENDING_CLR);
1498 + /* Clear any irq pending bits, should set and clear the bits */
1499 + val = S3C64XX_SPI_PND_RX_OVERRUN_CLR |
1500 + S3C64XX_SPI_PND_RX_UNDERRUN_CLR |
1501 + S3C64XX_SPI_PND_TX_OVERRUN_CLR |
1502 + S3C64XX_SPI_PND_TX_UNDERRUN_CLR;
1503 + writel(val, regs + S3C64XX_SPI_PENDING_CLR);
1504 + writel(0, regs + S3C64XX_SPI_PENDING_CLR);
1505
1506 writel(0, regs + S3C64XX_SPI_SWAP_CFG);
1507
1508 diff --git a/drivers/thermal/thermal_sys.c b/drivers/thermal/thermal_sys.c
1509 index 8c8ce80..bfbf9fb 100644
1510 --- a/drivers/thermal/thermal_sys.c
1511 +++ b/drivers/thermal/thermal_sys.c
1512 @@ -1807,6 +1807,7 @@ static int __init thermal_init(void)
1513 idr_destroy(&thermal_cdev_idr);
1514 mutex_destroy(&thermal_idr_lock);
1515 mutex_destroy(&thermal_list_lock);
1516 + return result;
1517 }
1518 result = genetlink_init();
1519 return result;
1520 diff --git a/drivers/tty/serial/8250/8250_pnp.c b/drivers/tty/serial/8250/8250_pnp.c
1521 index b3455a9..35d9ab9 100644
1522 --- a/drivers/tty/serial/8250/8250_pnp.c
1523 +++ b/drivers/tty/serial/8250/8250_pnp.c
1524 @@ -429,7 +429,6 @@ serial_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id)
1525 {
1526 struct uart_8250_port uart;
1527 int ret, line, flags = dev_id->driver_data;
1528 - struct resource *res = NULL;
1529
1530 if (flags & UNKNOWN_DEV) {
1531 ret = serial_pnp_guess_board(dev);
1532 @@ -440,12 +439,11 @@ serial_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id)
1533 memset(&uart, 0, sizeof(uart));
1534 if (pnp_irq_valid(dev, 0))
1535 uart.port.irq = pnp_irq(dev, 0);
1536 - if ((flags & CIR_PORT) && pnp_port_valid(dev, 2))
1537 - res = pnp_get_resource(dev, IORESOURCE_IO, 2);
1538 - else if (pnp_port_valid(dev, 0))
1539 - res = pnp_get_resource(dev, IORESOURCE_IO, 0);
1540 - if (pnp_resource_enabled(res)) {
1541 - uart.port.iobase = res->start;
1542 + if ((flags & CIR_PORT) && pnp_port_valid(dev, 2)) {
1543 + uart.port.iobase = pnp_port_start(dev, 2);
1544 + uart.port.iotype = UPIO_PORT;
1545 + } else if (pnp_port_valid(dev, 0)) {
1546 + uart.port.iobase = pnp_port_start(dev, 0);
1547 uart.port.iotype = UPIO_PORT;
1548 } else if (pnp_mem_valid(dev, 0)) {
1549 uart.port.mapbase = pnp_mem_start(dev, 0);
1550 diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c
1551 index b28e66c..4a62e12 100644
1552 --- a/drivers/vfio/pci/vfio_pci.c
1553 +++ b/drivers/vfio/pci/vfio_pci.c
1554 @@ -331,6 +331,7 @@ static long vfio_pci_ioctl(void *device_data,
1555
1556 if (!(hdr.flags & VFIO_IRQ_SET_DATA_NONE)) {
1557 size_t size;
1558 + int max = vfio_pci_get_irq_count(vdev, hdr.index);
1559
1560 if (hdr.flags & VFIO_IRQ_SET_DATA_BOOL)
1561 size = sizeof(uint8_t);
1562 @@ -340,7 +341,7 @@ static long vfio_pci_ioctl(void *device_data,
1563 return -EINVAL;
1564
1565 if (hdr.argsz - minsz < hdr.count * size ||
1566 - hdr.count > vfio_pci_get_irq_count(vdev, hdr.index))
1567 + hdr.start >= max || hdr.start + hdr.count > max)
1568 return -EINVAL;
1569
1570 data = memdup_user((void __user *)(arg + minsz),
1571 diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c
1572 index 2e9779b..c53189d 100644
1573 --- a/fs/nfs/nfs4client.c
1574 +++ b/fs/nfs/nfs4client.c
1575 @@ -300,7 +300,7 @@ int nfs40_walk_client_list(struct nfs_client *new,
1576 struct rpc_cred *cred)
1577 {
1578 struct nfs_net *nn = net_generic(new->cl_net, nfs_net_id);
1579 - struct nfs_client *pos, *n, *prev = NULL;
1580 + struct nfs_client *pos, *prev = NULL;
1581 struct nfs4_setclientid_res clid = {
1582 .clientid = new->cl_clientid,
1583 .confirm = new->cl_confirm,
1584 @@ -308,10 +308,23 @@ int nfs40_walk_client_list(struct nfs_client *new,
1585 int status = -NFS4ERR_STALE_CLIENTID;
1586
1587 spin_lock(&nn->nfs_client_lock);
1588 - list_for_each_entry_safe(pos, n, &nn->nfs_client_list, cl_share_link) {
1589 + list_for_each_entry(pos, &nn->nfs_client_list, cl_share_link) {
1590 /* If "pos" isn't marked ready, we can't trust the
1591 * remaining fields in "pos" */
1592 - if (pos->cl_cons_state < NFS_CS_READY)
1593 + if (pos->cl_cons_state > NFS_CS_READY) {
1594 + atomic_inc(&pos->cl_count);
1595 + spin_unlock(&nn->nfs_client_lock);
1596 +
1597 + if (prev)
1598 + nfs_put_client(prev);
1599 + prev = pos;
1600 +
1601 + status = nfs_wait_client_init_complete(pos);
1602 + spin_lock(&nn->nfs_client_lock);
1603 + if (status < 0)
1604 + continue;
1605 + }
1606 + if (pos->cl_cons_state != NFS_CS_READY)
1607 continue;
1608
1609 if (pos->rpc_ops != new->rpc_ops)
1610 @@ -423,16 +436,16 @@ int nfs41_walk_client_list(struct nfs_client *new,
1611 struct rpc_cred *cred)
1612 {
1613 struct nfs_net *nn = net_generic(new->cl_net, nfs_net_id);
1614 - struct nfs_client *pos, *n, *prev = NULL;
1615 + struct nfs_client *pos, *prev = NULL;
1616 int status = -NFS4ERR_STALE_CLIENTID;
1617
1618 spin_lock(&nn->nfs_client_lock);
1619 - list_for_each_entry_safe(pos, n, &nn->nfs_client_list, cl_share_link) {
1620 + list_for_each_entry(pos, &nn->nfs_client_list, cl_share_link) {
1621 /* If "pos" isn't marked ready, we can't trust the
1622 * remaining fields in "pos", especially the client
1623 * ID and serverowner fields. Wait for CREATE_SESSION
1624 * to finish. */
1625 - if (pos->cl_cons_state < NFS_CS_READY) {
1626 + if (pos->cl_cons_state > NFS_CS_READY) {
1627 atomic_inc(&pos->cl_count);
1628 spin_unlock(&nn->nfs_client_lock);
1629
1630 @@ -440,18 +453,17 @@ int nfs41_walk_client_list(struct nfs_client *new,
1631 nfs_put_client(prev);
1632 prev = pos;
1633
1634 - nfs4_schedule_lease_recovery(pos);
1635 status = nfs_wait_client_init_complete(pos);
1636 - if (status < 0) {
1637 - nfs_put_client(pos);
1638 - spin_lock(&nn->nfs_client_lock);
1639 - continue;
1640 + if (status == 0) {
1641 + nfs4_schedule_lease_recovery(pos);
1642 + status = nfs4_wait_clnt_recover(pos);
1643 }
1644 - status = pos->cl_cons_state;
1645 spin_lock(&nn->nfs_client_lock);
1646 if (status < 0)
1647 continue;
1648 }
1649 + if (pos->cl_cons_state != NFS_CS_READY)
1650 + continue;
1651
1652 if (pos->rpc_ops != new->rpc_ops)
1653 continue;
1654 @@ -469,17 +481,18 @@ int nfs41_walk_client_list(struct nfs_client *new,
1655 continue;
1656
1657 atomic_inc(&pos->cl_count);
1658 - spin_unlock(&nn->nfs_client_lock);
1659 + *result = pos;
1660 + status = 0;
1661 dprintk("NFS: <-- %s using nfs_client = %p ({%d})\n",
1662 __func__, pos, atomic_read(&pos->cl_count));
1663 -
1664 - *result = pos;
1665 - return 0;
1666 + break;
1667 }
1668
1669 /* No matching nfs_client found. */
1670 spin_unlock(&nn->nfs_client_lock);
1671 dprintk("NFS: <-- %s status = %d\n", __func__, status);
1672 + if (prev)
1673 + nfs_put_client(prev);
1674 return status;
1675 }
1676 #endif /* CONFIG_NFS_V4_1 */
1677 diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
1678 index e61f68d..994fbe2 100644
1679 --- a/fs/nfs/nfs4state.c
1680 +++ b/fs/nfs/nfs4state.c
1681 @@ -1877,7 +1877,13 @@ again:
1682 status = PTR_ERR(clnt);
1683 break;
1684 }
1685 - clp->cl_rpcclient = clnt;
1686 + /* Note: this is safe because we haven't yet marked the
1687 + * client as ready, so we are the only user of
1688 + * clp->cl_rpcclient
1689 + */
1690 + clnt = xchg(&clp->cl_rpcclient, clnt);
1691 + rpc_shutdown_client(clnt);
1692 + clnt = clp->cl_rpcclient;
1693 goto again;
1694
1695 case -NFS4ERR_MINOR_VERS_MISMATCH:
1696 diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c
1697 index c196369..4cce1d9 100644
1698 --- a/fs/reiserfs/xattr.c
1699 +++ b/fs/reiserfs/xattr.c
1700 @@ -187,8 +187,8 @@ fill_with_dentries(void *buf, const char *name, int namelen, loff_t offset,
1701 if (dbuf->count == ARRAY_SIZE(dbuf->dentries))
1702 return -ENOSPC;
1703
1704 - if (name[0] == '.' && (name[1] == '\0' ||
1705 - (name[1] == '.' && name[2] == '\0')))
1706 + if (name[0] == '.' && (namelen < 2 ||
1707 + (namelen == 2 && name[1] == '.')))
1708 return 0;
1709
1710 dentry = lookup_one_len(name, dbuf->xadir, namelen);
1711 diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
1712 index ddc0f6a..97f6875 100644
1713 --- a/fs/ubifs/super.c
1714 +++ b/fs/ubifs/super.c
1715 @@ -1568,6 +1568,12 @@ static int ubifs_remount_rw(struct ubifs_info *c)
1716 c->remounting_rw = 1;
1717 c->ro_mount = 0;
1718
1719 + if (c->space_fixup) {
1720 + err = ubifs_fixup_free_space(c);
1721 + if (err)
1722 + return err;
1723 + }
1724 +
1725 err = check_free_space(c);
1726 if (err)
1727 goto out;
1728 @@ -1684,12 +1690,6 @@ static int ubifs_remount_rw(struct ubifs_info *c)
1729 err = dbg_check_space_info(c);
1730 }
1731
1732 - if (c->space_fixup) {
1733 - err = ubifs_fixup_free_space(c);
1734 - if (err)
1735 - goto out;
1736 - }
1737 -
1738 mutex_unlock(&c->umount_mutex);
1739 return err;
1740
1741 diff --git a/include/linux/ata.h b/include/linux/ata.h
1742 index 8f7a3d6..ee0bd95 100644
1743 --- a/include/linux/ata.h
1744 +++ b/include/linux/ata.h
1745 @@ -954,7 +954,7 @@ static inline int atapi_cdb_len(const u16 *dev_id)
1746 }
1747 }
1748
1749 -static inline bool atapi_command_packet_set(const u16 *dev_id)
1750 +static inline int atapi_command_packet_set(const u16 *dev_id)
1751 {
1752 return (dev_id[ATA_ID_CONFIG] >> 8) & 0x1f;
1753 }
1754 diff --git a/include/linux/libata.h b/include/linux/libata.h
1755 index 649e5f8..0621bca 100644
1756 --- a/include/linux/libata.h
1757 +++ b/include/linux/libata.h
1758 @@ -398,6 +398,7 @@ enum {
1759 ATA_HORKAGE_NOSETXFER = (1 << 14), /* skip SETXFER, SATA only */
1760 ATA_HORKAGE_BROKEN_FPDMA_AA = (1 << 15), /* skip AA */
1761 ATA_HORKAGE_DUMP_ID = (1 << 16), /* dump IDENTIFY data */
1762 + ATA_HORKAGE_MAX_SEC_LBA48 = (1 << 17), /* Set max sects to 65535 */
1763
1764 /* DMA mask for user DMA control: User visible values; DO NOT
1765 renumber */
1766 diff --git a/include/linux/preempt.h b/include/linux/preempt.h
1767 index 5a710b9..87a03c7 100644
1768 --- a/include/linux/preempt.h
1769 +++ b/include/linux/preempt.h
1770 @@ -93,14 +93,20 @@ do { \
1771
1772 #else /* !CONFIG_PREEMPT_COUNT */
1773
1774 -#define preempt_disable() do { } while (0)
1775 -#define sched_preempt_enable_no_resched() do { } while (0)
1776 -#define preempt_enable_no_resched() do { } while (0)
1777 -#define preempt_enable() do { } while (0)
1778 -
1779 -#define preempt_disable_notrace() do { } while (0)
1780 -#define preempt_enable_no_resched_notrace() do { } while (0)
1781 -#define preempt_enable_notrace() do { } while (0)
1782 +/*
1783 + * Even if we don't have any preemption, we need preempt disable/enable
1784 + * to be barriers, so that we don't have things like get_user/put_user
1785 + * that can cause faults and scheduling migrate into our preempt-protected
1786 + * region.
1787 + */
1788 +#define preempt_disable() barrier()
1789 +#define sched_preempt_enable_no_resched() barrier()
1790 +#define preempt_enable_no_resched() barrier()
1791 +#define preempt_enable() barrier()
1792 +
1793 +#define preempt_disable_notrace() barrier()
1794 +#define preempt_enable_no_resched_notrace() barrier()
1795 +#define preempt_enable_notrace() barrier()
1796
1797 #endif /* CONFIG_PREEMPT_COUNT */
1798
1799 diff --git a/include/linux/spinlock_up.h b/include/linux/spinlock_up.h
1800 index a26e2fb..e2369c1 100644
1801 --- a/include/linux/spinlock_up.h
1802 +++ b/include/linux/spinlock_up.h
1803 @@ -16,7 +16,10 @@
1804 * In the debug case, 1 means unlocked, 0 means locked. (the values
1805 * are inverted, to catch initialization bugs)
1806 *
1807 - * No atomicity anywhere, we are on UP.
1808 + * No atomicity anywhere, we are on UP. However, we still need
1809 + * the compiler barriers, because we do not want the compiler to
1810 + * move potentially faulting instructions (notably user accesses)
1811 + * into the locked sequence, resulting in non-atomic execution.
1812 */
1813
1814 #ifdef CONFIG_DEBUG_SPINLOCK
1815 @@ -25,6 +28,7 @@
1816 static inline void arch_spin_lock(arch_spinlock_t *lock)
1817 {
1818 lock->slock = 0;
1819 + barrier();
1820 }
1821
1822 static inline void
1823 @@ -32,6 +36,7 @@ arch_spin_lock_flags(arch_spinlock_t *lock, unsigned long flags)
1824 {
1825 local_irq_save(flags);
1826 lock->slock = 0;
1827 + barrier();
1828 }
1829
1830 static inline int arch_spin_trylock(arch_spinlock_t *lock)
1831 @@ -39,32 +44,34 @@ static inline int arch_spin_trylock(arch_spinlock_t *lock)
1832 char oldval = lock->slock;
1833
1834 lock->slock = 0;
1835 + barrier();
1836
1837 return oldval > 0;
1838 }
1839
1840 static inline void arch_spin_unlock(arch_spinlock_t *lock)
1841 {
1842 + barrier();
1843 lock->slock = 1;
1844 }
1845
1846 /*
1847 * Read-write spinlocks. No debug version.
1848 */
1849 -#define arch_read_lock(lock) do { (void)(lock); } while (0)
1850 -#define arch_write_lock(lock) do { (void)(lock); } while (0)
1851 -#define arch_read_trylock(lock) ({ (void)(lock); 1; })
1852 -#define arch_write_trylock(lock) ({ (void)(lock); 1; })
1853 -#define arch_read_unlock(lock) do { (void)(lock); } while (0)
1854 -#define arch_write_unlock(lock) do { (void)(lock); } while (0)
1855 +#define arch_read_lock(lock) do { barrier(); (void)(lock); } while (0)
1856 +#define arch_write_lock(lock) do { barrier(); (void)(lock); } while (0)
1857 +#define arch_read_trylock(lock) ({ barrier(); (void)(lock); 1; })
1858 +#define arch_write_trylock(lock) ({ barrier(); (void)(lock); 1; })
1859 +#define arch_read_unlock(lock) do { barrier(); (void)(lock); } while (0)
1860 +#define arch_write_unlock(lock) do { barrier(); (void)(lock); } while (0)
1861
1862 #else /* DEBUG_SPINLOCK */
1863 #define arch_spin_is_locked(lock) ((void)(lock), 0)
1864 /* for sched.c and kernel_lock.c: */
1865 -# define arch_spin_lock(lock) do { (void)(lock); } while (0)
1866 -# define arch_spin_lock_flags(lock, flags) do { (void)(lock); } while (0)
1867 -# define arch_spin_unlock(lock) do { (void)(lock); } while (0)
1868 -# define arch_spin_trylock(lock) ({ (void)(lock); 1; })
1869 +# define arch_spin_lock(lock) do { barrier(); (void)(lock); } while (0)
1870 +# define arch_spin_lock_flags(lock, flags) do { barrier(); (void)(lock); } while (0)
1871 +# define arch_spin_unlock(lock) do { barrier(); (void)(lock); } while (0)
1872 +# define arch_spin_trylock(lock) ({ barrier(); (void)(lock); 1; })
1873 #endif /* DEBUG_SPINLOCK */
1874
1875 #define arch_spin_is_contended(lock) (((void)(lock), 0))
1876 diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
1877 index b27052c..64bc5d8 100644
1878 --- a/kernel/trace/ftrace.c
1879 +++ b/kernel/trace/ftrace.c
1880 @@ -4537,12 +4537,8 @@ ftrace_enable_sysctl(struct ctl_table *table, int write,
1881 ftrace_startup_sysctl();
1882
1883 /* we are starting ftrace again */
1884 - if (ftrace_ops_list != &ftrace_list_end) {
1885 - if (ftrace_ops_list->next == &ftrace_list_end)
1886 - ftrace_trace_function = ftrace_ops_list->func;
1887 - else
1888 - ftrace_trace_function = ftrace_ops_list_func;
1889 - }
1890 + if (ftrace_ops_list != &ftrace_list_end)
1891 + update_ftrace_function();
1892
1893 } else {
1894 /* stopping ftrace calls (just send to ftrace_stub) */
1895 diff --git a/mm/mmap.c b/mm/mmap.c
1896 index 8832b87..90db251 100644
1897 --- a/mm/mmap.c
1898 +++ b/mm/mmap.c
1899 @@ -1922,7 +1922,7 @@ struct vm_area_struct *find_vma(struct mm_struct *mm, unsigned long addr)
1900
1901 /* Check the cache first. */
1902 /* (Cache hit rate is typically around 35%.) */
1903 - vma = mm->mmap_cache;
1904 + vma = ACCESS_ONCE(mm->mmap_cache);
1905 if (!(vma && vma->vm_end > addr && vma->vm_start <= addr)) {
1906 struct rb_node *rb_node;
1907
1908 diff --git a/mm/nommu.c b/mm/nommu.c
1909 index 79c3cac..bbe1f3f 100644
1910 --- a/mm/nommu.c
1911 +++ b/mm/nommu.c
1912 @@ -819,7 +819,7 @@ struct vm_area_struct *find_vma(struct mm_struct *mm, unsigned long addr)
1913 struct vm_area_struct *vma;
1914
1915 /* check the cache first */
1916 - vma = mm->mmap_cache;
1917 + vma = ACCESS_ONCE(mm->mmap_cache);
1918 if (vma && vma->vm_start <= addr && vma->vm_end > addr)
1919 return vma;
1920
1921 diff --git a/net/can/gw.c b/net/can/gw.c
1922 index 574dda78e..28e7bdc 100644
1923 --- a/net/can/gw.c
1924 +++ b/net/can/gw.c
1925 @@ -436,7 +436,7 @@ static int cgw_notifier(struct notifier_block *nb,
1926 if (gwj->src.dev == dev || gwj->dst.dev == dev) {
1927 hlist_del(&gwj->list);
1928 cgw_unregister_filter(gwj);
1929 - kfree(gwj);
1930 + kmem_cache_free(cgw_cache, gwj);
1931 }
1932 }
1933 }
1934 @@ -829,7 +829,7 @@ static void cgw_remove_all_jobs(void)
1935 hlist_for_each_entry_safe(gwj, n, nx, &cgw_list, list) {
1936 hlist_del(&gwj->list);
1937 cgw_unregister_filter(gwj);
1938 - kfree(gwj);
1939 + kmem_cache_free(cgw_cache, gwj);
1940 }
1941 }
1942
1943 @@ -885,7 +885,7 @@ static int cgw_remove_job(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
1944
1945 hlist_del(&gwj->list);
1946 cgw_unregister_filter(gwj);
1947 - kfree(gwj);
1948 + kmem_cache_free(cgw_cache, gwj);
1949 err = 0;
1950 break;
1951 }
1952 diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
1953 index 0479c64..49c48c6 100644
1954 --- a/net/mac80211/cfg.c
1955 +++ b/net/mac80211/cfg.c
1956 @@ -2499,7 +2499,7 @@ static int ieee80211_cancel_roc(struct ieee80211_local *local,
1957 list_del(&dep->list);
1958 mutex_unlock(&local->mtx);
1959
1960 - ieee80211_roc_notify_destroy(dep);
1961 + ieee80211_roc_notify_destroy(dep, true);
1962 return 0;
1963 }
1964
1965 @@ -2539,7 +2539,7 @@ static int ieee80211_cancel_roc(struct ieee80211_local *local,
1966 ieee80211_start_next_roc(local);
1967 mutex_unlock(&local->mtx);
1968
1969 - ieee80211_roc_notify_destroy(found);
1970 + ieee80211_roc_notify_destroy(found, true);
1971 } else {
1972 /* work may be pending so use it all the time */
1973 found->abort = true;
1974 @@ -2549,6 +2549,8 @@ static int ieee80211_cancel_roc(struct ieee80211_local *local,
1975
1976 /* work will clean up etc */
1977 flush_delayed_work(&found->work);
1978 + WARN_ON(!found->to_be_freed);
1979 + kfree(found);
1980 }
1981
1982 return 0;
1983 diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
1984 index 2ed065c..55d8f89 100644
1985 --- a/net/mac80211/ieee80211_i.h
1986 +++ b/net/mac80211/ieee80211_i.h
1987 @@ -346,6 +346,7 @@ struct ieee80211_roc_work {
1988 struct ieee80211_channel *chan;
1989
1990 bool started, abort, hw_begun, notified;
1991 + bool to_be_freed;
1992
1993 unsigned long hw_start_time;
1994
1995 @@ -1363,7 +1364,7 @@ void ieee80211_offchannel_return(struct ieee80211_local *local);
1996 void ieee80211_roc_setup(struct ieee80211_local *local);
1997 void ieee80211_start_next_roc(struct ieee80211_local *local);
1998 void ieee80211_roc_purge(struct ieee80211_sub_if_data *sdata);
1999 -void ieee80211_roc_notify_destroy(struct ieee80211_roc_work *roc);
2000 +void ieee80211_roc_notify_destroy(struct ieee80211_roc_work *roc, bool free);
2001 void ieee80211_sw_roc_work(struct work_struct *work);
2002 void ieee80211_handle_roc_started(struct ieee80211_roc_work *roc);
2003
2004 diff --git a/net/mac80211/offchannel.c b/net/mac80211/offchannel.c
2005 index a3ad4c3..7acbdaa 100644
2006 --- a/net/mac80211/offchannel.c
2007 +++ b/net/mac80211/offchannel.c
2008 @@ -299,10 +299,13 @@ void ieee80211_start_next_roc(struct ieee80211_local *local)
2009 }
2010 }
2011
2012 -void ieee80211_roc_notify_destroy(struct ieee80211_roc_work *roc)
2013 +void ieee80211_roc_notify_destroy(struct ieee80211_roc_work *roc, bool free)
2014 {
2015 struct ieee80211_roc_work *dep, *tmp;
2016
2017 + if (WARN_ON(roc->to_be_freed))
2018 + return;
2019 +
2020 /* was never transmitted */
2021 if (roc->frame) {
2022 cfg80211_mgmt_tx_status(&roc->sdata->wdev,
2023 @@ -318,9 +321,12 @@ void ieee80211_roc_notify_destroy(struct ieee80211_roc_work *roc)
2024 GFP_KERNEL);
2025
2026 list_for_each_entry_safe(dep, tmp, &roc->dependents, list)
2027 - ieee80211_roc_notify_destroy(dep);
2028 + ieee80211_roc_notify_destroy(dep, true);
2029
2030 - kfree(roc);
2031 + if (free)
2032 + kfree(roc);
2033 + else
2034 + roc->to_be_freed = true;
2035 }
2036
2037 void ieee80211_sw_roc_work(struct work_struct *work)
2038 @@ -333,6 +339,9 @@ void ieee80211_sw_roc_work(struct work_struct *work)
2039
2040 mutex_lock(&local->mtx);
2041
2042 + if (roc->to_be_freed)
2043 + goto out_unlock;
2044 +
2045 if (roc->abort)
2046 goto finish;
2047
2048 @@ -372,7 +381,7 @@ void ieee80211_sw_roc_work(struct work_struct *work)
2049 finish:
2050 list_del(&roc->list);
2051 started = roc->started;
2052 - ieee80211_roc_notify_destroy(roc);
2053 + ieee80211_roc_notify_destroy(roc, !roc->abort);
2054
2055 if (started) {
2056 drv_flush(local, false);
2057 @@ -412,7 +421,7 @@ static void ieee80211_hw_roc_done(struct work_struct *work)
2058
2059 list_del(&roc->list);
2060
2061 - ieee80211_roc_notify_destroy(roc);
2062 + ieee80211_roc_notify_destroy(roc, true);
2063
2064 /* if there's another roc, start it now */
2065 ieee80211_start_next_roc(local);
2066 @@ -462,12 +471,14 @@ void ieee80211_roc_purge(struct ieee80211_sub_if_data *sdata)
2067 list_for_each_entry_safe(roc, tmp, &tmp_list, list) {
2068 if (local->ops->remain_on_channel) {
2069 list_del(&roc->list);
2070 - ieee80211_roc_notify_destroy(roc);
2071 + ieee80211_roc_notify_destroy(roc, true);
2072 } else {
2073 ieee80211_queue_delayed_work(&local->hw, &roc->work, 0);
2074
2075 /* work will clean up etc */
2076 flush_delayed_work(&roc->work);
2077 + WARN_ON(!roc->to_be_freed);
2078 + kfree(roc);
2079 }
2080 }
2081
2082 diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
2083 index 507b5e8..716aa41 100644
2084 --- a/net/sunrpc/clnt.c
2085 +++ b/net/sunrpc/clnt.c
2086 @@ -511,7 +511,7 @@ static struct rpc_clnt *__rpc_clone_client(struct rpc_create_args *args,
2087 new = rpc_new_client(args, xprt);
2088 if (IS_ERR(new)) {
2089 err = PTR_ERR(new);
2090 - goto out_put;
2091 + goto out_err;
2092 }
2093
2094 atomic_inc(&clnt->cl_count);
2095 @@ -524,8 +524,6 @@ static struct rpc_clnt *__rpc_clone_client(struct rpc_create_args *args,
2096 new->cl_chatty = clnt->cl_chatty;
2097 return new;
2098
2099 -out_put:
2100 - xprt_put(xprt);
2101 out_err:
2102 dprintk("RPC: %s: returned error %d\n", __func__, err);
2103 return ERR_PTR(err);
2104 diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
2105 index e46b6a3..622f726 100644
2106 --- a/sound/pci/hda/hda_codec.c
2107 +++ b/sound/pci/hda/hda_codec.c
2108 @@ -173,7 +173,7 @@ const char *snd_hda_get_jack_type(u32 cfg)
2109 "Line Out", "Speaker", "HP Out", "CD",
2110 "SPDIF Out", "Digital Out", "Modem Line", "Modem Hand",
2111 "Line In", "Aux", "Mic", "Telephony",
2112 - "SPDIF In", "Digitial In", "Reserved", "Other"
2113 + "SPDIF In", "Digital In", "Reserved", "Other"
2114 };
2115
2116 return jack_types[(cfg & AC_DEFCFG_DEVICE)
2117 diff --git a/sound/pci/hda/hda_eld.c b/sound/pci/hda/hda_eld.c
2118 index 4c054f4..86f6468 100644
2119 --- a/sound/pci/hda/hda_eld.c
2120 +++ b/sound/pci/hda/hda_eld.c
2121 @@ -322,7 +322,7 @@ int snd_hdmi_get_eld(struct hdmi_eld *eld,
2122 struct hda_codec *codec, hda_nid_t nid)
2123 {
2124 int i;
2125 - int ret;
2126 + int ret = 0;
2127 int size;
2128 unsigned char *buf;
2129
2130 diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
2131 index 47fb18d..ee975a2 100644
2132 --- a/sound/pci/hda/patch_realtek.c
2133 +++ b/sound/pci/hda/patch_realtek.c
2134 @@ -6720,7 +6720,8 @@ static int alc662_parse_auto_config(struct hda_codec *codec)
2135 const hda_nid_t *ssids;
2136
2137 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
2138 - codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670)
2139 + codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670 ||
2140 + codec->vendor_id == 0x10ec0671)
2141 ssids = alc663_ssids;
2142 else
2143 ssids = alc662_ssids;
2144 @@ -7173,6 +7174,7 @@ static const struct hda_codec_preset snd_hda_preset_realtek[] = {
2145 { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 },
2146 { .id = 0x10ec0668, .name = "ALC668", .patch = patch_alc662 },
2147 { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 },
2148 + { .id = 0x10ec0671, .name = "ALC671", .patch = patch_alc662 },
2149 { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 },
2150 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
2151 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
2152 diff --git a/sound/soc/fsl/imx-ssi.c b/sound/soc/fsl/imx-ssi.c
2153 index 3b48042..63e453f 100644
2154 --- a/sound/soc/fsl/imx-ssi.c
2155 +++ b/sound/soc/fsl/imx-ssi.c
2156 @@ -496,6 +496,8 @@ static void imx_ssi_ac97_reset(struct snd_ac97 *ac97)
2157
2158 if (imx_ssi->ac97_reset)
2159 imx_ssi->ac97_reset(ac97);
2160 + /* First read sometimes fails, do a dummy read */
2161 + imx_ssi_ac97_read(ac97, 0);
2162 }
2163
2164 static void imx_ssi_ac97_warm_reset(struct snd_ac97 *ac97)
2165 @@ -504,6 +506,9 @@ static void imx_ssi_ac97_warm_reset(struct snd_ac97 *ac97)
2166
2167 if (imx_ssi->ac97_warm_reset)
2168 imx_ssi->ac97_warm_reset(ac97);
2169 +
2170 + /* First read sometimes fails, do a dummy read */
2171 + imx_ssi_ac97_read(ac97, 0);
2172 }
2173
2174 struct snd_ac97_bus_ops soc_ac97_ops = {
2175 diff --git a/sound/soc/sh/dma-sh7760.c b/sound/soc/sh/dma-sh7760.c
2176 index 19eff8f..1a8b03e 100644
2177 --- a/sound/soc/sh/dma-sh7760.c
2178 +++ b/sound/soc/sh/dma-sh7760.c
2179 @@ -342,8 +342,8 @@ static int camelot_pcm_new(struct snd_soc_pcm_runtime *rtd)
2180 return 0;
2181 }
2182
2183 -static struct snd_soc_platform sh7760_soc_platform = {
2184 - .pcm_ops = &camelot_pcm_ops,
2185 +static struct snd_soc_platform_driver sh7760_soc_platform = {
2186 + .ops = &camelot_pcm_ops,
2187 .pcm_new = camelot_pcm_new,
2188 .pcm_free = camelot_pcm_free,
2189 };
2190 diff --git a/sound/soc/spear/spear_pcm.c b/sound/soc/spear/spear_pcm.c
2191 index 9b76cc5..5e7aebe 100644
2192 --- a/sound/soc/spear/spear_pcm.c
2193 +++ b/sound/soc/spear/spear_pcm.c
2194 @@ -149,9 +149,9 @@ static void spear_pcm_free(struct snd_pcm *pcm)
2195
2196 static u64 spear_pcm_dmamask = DMA_BIT_MASK(32);
2197
2198 -static int spear_pcm_new(struct snd_card *card,
2199 - struct snd_soc_dai *dai, struct snd_pcm *pcm)
2200 +static int spear_pcm_new(struct snd_soc_pcm_runtime *rtd)
2201 {
2202 + struct snd_card *card = rtd->card->snd_card;
2203 int ret;
2204
2205 if (!card->dev->dma_mask)
2206 @@ -159,16 +159,16 @@ static int spear_pcm_new(struct snd_card *card,
2207 if (!card->dev->coherent_dma_mask)
2208 card->dev->coherent_dma_mask = DMA_BIT_MASK(32);
2209
2210 - if (dai->driver->playback.channels_min) {
2211 - ret = spear_pcm_preallocate_dma_buffer(pcm,
2212 + if (rtd->cpu_dai->driver->playback.channels_min) {
2213 + ret = spear_pcm_preallocate_dma_buffer(rtd->pcm,
2214 SNDRV_PCM_STREAM_PLAYBACK,
2215 spear_pcm_hardware.buffer_bytes_max);
2216 if (ret)
2217 return ret;
2218 }
2219
2220 - if (dai->driver->capture.channels_min) {
2221 - ret = spear_pcm_preallocate_dma_buffer(pcm,
2222 + if (rtd->cpu_dai->driver->capture.channels_min) {
2223 + ret = spear_pcm_preallocate_dma_buffer(rtd->pcm,
2224 SNDRV_PCM_STREAM_CAPTURE,
2225 spear_pcm_hardware.buffer_bytes_max);
2226 if (ret)