aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2013-04-07 18:37:01 -0400
committerDavid S. Miller <davem@davemloft.net>2013-04-07 18:37:01 -0400
commitd978a6361ad13f1f9694fcb7b5852d253a544d92 (patch)
tree8e8a8c62286fab2c044c4b53563222c1b66d7cb0
parent8303e699f7089a1cd1421750fb33f289e5f3e1b9 (diff)
parentcb28ea3b13b86fb23448525f34720e659bda7aa8 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Conflicts: drivers/nfc/microread/mei.c net/netfilter/nfnetlink_queue_core.c Pull in 'net' to get Eric Biederman's AF_UNIX fix, upon which some cleanups are going to go on-top. Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--Documentation/sound/alsa/ALSA-Configuration.txt5
-rw-r--r--MAINTAINERS1
-rw-r--r--arch/arm/Kconfig14
-rw-r--r--arch/arm/include/asm/delay.h2
-rw-r--r--arch/arm/include/asm/highmem.h7
-rw-r--r--arch/arm/include/asm/mmu_context.h2
-rw-r--r--arch/arm/include/asm/tlbflush.h15
-rw-r--r--arch/arm/kernel/entry-common.S12
-rw-r--r--arch/arm/kernel/head.S2
-rw-r--r--arch/arm/kernel/hw_breakpoint.c6
-rw-r--r--arch/arm/kernel/setup.c24
-rw-r--r--arch/arm/kernel/smp.c3
-rw-r--r--arch/arm/kernel/smp_tlb.c66
-rw-r--r--arch/arm/kvm/vgic.c35
-rw-r--r--arch/arm/lib/delay.c8
-rw-r--r--arch/arm/mm/cache-l2x0.c11
-rw-r--r--arch/arm/mm/context.c3
-rw-r--r--arch/arm/mm/mmu.c73
-rw-r--r--arch/arm/mm/proc-v7.S19
-rw-r--r--arch/mips/Kconfig4
-rw-r--r--arch/mips/cavium-octeon/setup.c5
-rw-r--r--arch/mips/include/uapi/asm/signal.h8
-rw-r--r--arch/mips/kernel/cpu-probe.c6
-rw-r--r--arch/mips/kernel/mcount.S11
-rw-r--r--arch/mips/kernel/traps.c2
-rw-r--r--arch/mips/mm/c-r4k.c6
-rw-r--r--arch/mips/mm/sc-mips.c6
-rw-r--r--arch/mips/pci/pci-alchemy.c4
-rw-r--r--arch/s390/include/asm/pgtable.h4
-rw-r--r--arch/s390/lib/uaccess_pt.c83
-rw-r--r--drivers/acpi/Kconfig2
-rw-r--r--drivers/acpi/acpi_i2c.c2
-rw-r--r--drivers/acpi/processor_idle.c13
-rw-r--r--drivers/base/power/qos.c60
-rw-r--r--drivers/cpufreq/cpufreq-cpu0.c10
-rw-r--r--drivers/cpufreq/cpufreq_governor.h6
-rw-r--r--drivers/dma/Kconfig1
-rw-r--r--drivers/gpio/gpio-ich.c2
-rw-r--r--drivers/gpio/gpio-stmpe.c15
-rw-r--r--drivers/hid/hid-core.c13
-rw-r--r--drivers/hid/hid-ids.h5
-rw-r--r--drivers/hid/hid-magicmouse.c29
-rw-r--r--drivers/i2c/busses/i2c-designware-platdrv.c1
-rw-r--r--drivers/infiniband/hw/qib/qib_sd7220.c2
-rw-r--r--drivers/media/platform/Kconfig2
-rw-r--r--drivers/media/radio/radio-ma901.c11
-rw-r--r--drivers/net/bonding/bond_main.c2
-rw-r--r--drivers/net/ethernet/atheros/atl1e/atl1e.h2
-rw-r--r--drivers/net/ethernet/atheros/atl1e/atl1e_main.c1
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c18
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_main.c11
-rw-r--r--drivers/net/ethernet/realtek/r8169.c28
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/rxon.c18
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/tx.c2
-rw-r--r--drivers/net/wireless/mwifiex/cfg80211.c3
-rw-r--r--drivers/nfc/microread/mei.c38
-rw-r--r--drivers/rtc/rtc-at91rm9200.c50
-rw-r--r--drivers/rtc/rtc-at91rm9200.h1
-rw-r--r--drivers/s390/block/scm_blk.c11
-rw-r--r--drivers/s390/block/scm_drv.c2
-rw-r--r--drivers/s390/char/tty3270.c16
-rw-r--r--drivers/spi/Kconfig3
-rw-r--r--drivers/spi/spi-bcm63xx.c3
-rw-r--r--drivers/spi/spi-mpc512x-psc.c2
-rw-r--r--drivers/spi/spi-pxa2xx.c1
-rw-r--r--drivers/spi/spi-s3c64xx.c41
-rw-r--r--drivers/spi/spi-tegra20-slink.c25
-rw-r--r--drivers/spi/spi.c17
-rw-r--r--drivers/usb/core/port.c1
-rw-r--r--drivers/video/fbmon.c2
-rw-r--r--drivers/video/uvesafb.c3
-rw-r--r--firmware/Makefile2
-rw-r--r--firmware/qlogic/sd7220.fw.ihex (renamed from firmware/intel/sd7220.fw.ihex)0
-rw-r--r--fs/ext4/extents.c11
-rw-r--r--fs/ext4/indirect.c4
-rw-r--r--fs/gfs2/file.c5
-rw-r--r--fs/gfs2/incore.h1
-rw-r--r--fs/gfs2/lock_dlm.c39
-rw-r--r--fs/gfs2/rgrp.c32
-rw-r--r--fs/reiserfs/xattr.c4
-rw-r--r--fs/ubifs/super.c12
-rw-r--r--include/linux/devfreq.h16
-rw-r--r--include/linux/netdevice.h2
-rw-r--r--include/linux/skbuff.h7
-rw-r--r--[-rwxr-xr-x]include/sound/max98090.h0
-rw-r--r--include/sound/soc-dapm.h1
-rw-r--r--mm/mmap.c2
-rw-r--r--mm/nommu.c2
-rw-r--r--net/atm/common.c2
-rw-r--r--net/ax25/af_ax25.c1
-rw-r--r--net/bluetooth/af_bluetooth.c4
-rw-r--r--net/bluetooth/rfcomm/sock.c1
-rw-r--r--net/bluetooth/sco.c1
-rw-r--r--net/caif/caif_socket.c2
-rw-r--r--net/core/dev.c1
-rw-r--r--net/core/dev_addr_lists.c6
-rw-r--r--net/ipv4/devinet.c6
-rw-r--r--net/ipv6/netfilter/ip6t_NPT.c2
-rw-r--r--net/ipv6/tcp_ipv6.c1
-rw-r--r--net/irda/af_irda.c2
-rw-r--r--net/iucv/af_iucv.c2
-rw-r--r--net/l2tp/l2tp_ip6.c1
-rw-r--r--net/llc/af_llc.c2
-rw-r--r--net/mac80211/cfg.c6
-rw-r--r--net/mac80211/chan.c17
-rw-r--r--net/mac80211/ieee80211_i.h4
-rw-r--r--net/mac80211/iface.c2
-rw-r--r--net/mac80211/offchannel.c23
-rw-r--r--net/netfilter/nf_conntrack_standalone.c1
-rw-r--r--net/netfilter/nfnetlink_acct.c2
-rw-r--r--net/netrom/af_netrom.c1
-rw-r--r--net/nfc/llcp/llcp.c8
-rw-r--r--net/nfc/llcp/sock.c9
-rw-r--r--net/rose/af_rose.c1
-rw-r--r--net/tipc/socket.c7
-rw-r--r--net/unix/af_unix.c6
-rw-r--r--net/vmw_vsock/af_vsock.c2
-rw-r--r--net/vmw_vsock/vmci_transport.c3
-rw-r--r--sound/pci/hda/hda_codec.c2
-rw-r--r--sound/pci/hda/hda_eld.c2
-rw-r--r--sound/pci/hda/hda_generic.c2
-rw-r--r--sound/pci/hda/hda_intel.c6
-rw-r--r--sound/pci/hda/patch_hdmi.c2
-rw-r--r--sound/pci/hda/patch_realtek.c4
-rw-r--r--[-rwxr-xr-x]sound/soc/codecs/max98090.c0
-rw-r--r--[-rwxr-xr-x]sound/soc/codecs/max98090.h0
-rw-r--r--sound/soc/codecs/si476x.c1
-rw-r--r--sound/soc/codecs/wm_adsp.c5
-rw-r--r--sound/soc/fsl/imx-ssi.c5
-rw-r--r--sound/soc/fsl/pcm030-audio-fabric.c2
-rw-r--r--sound/soc/sh/dma-sh7760.c4
-rw-r--r--sound/soc/soc-core.c8
-rw-r--r--sound/soc/soc-dapm.c14
-rw-r--r--sound/soc/spear/spear_pcm.c12
-rw-r--r--sound/usb/clock.c45
135 files changed, 852 insertions, 450 deletions
diff --git a/Documentation/sound/alsa/ALSA-Configuration.txt b/Documentation/sound/alsa/ALSA-Configuration.txt
index 4499bd948860..95731a08f257 100644
--- a/Documentation/sound/alsa/ALSA-Configuration.txt
+++ b/Documentation/sound/alsa/ALSA-Configuration.txt
@@ -890,9 +890,8 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
890 enable_msi - Enable Message Signaled Interrupt (MSI) (default = off) 890 enable_msi - Enable Message Signaled Interrupt (MSI) (default = off)
891 power_save - Automatic power-saving timeout (in second, 0 = 891 power_save - Automatic power-saving timeout (in second, 0 =
892 disable) 892 disable)
893 power_save_controller - Support runtime D3 of HD-audio controller 893 power_save_controller - Reset HD-audio controller in power-saving mode
894 (-1 = on for supported chip (default), false = off, 894 (default = on)
895 true = force to on even for unsupported hardware)
896 align_buffer_size - Force rounding of buffer/period sizes to multiples 895 align_buffer_size - Force rounding of buffer/period sizes to multiples
897 of 128 bytes. This is more efficient in terms of memory 896 of 128 bytes. This is more efficient in terms of memory
898 access but isn't required by the HDA spec and prevents 897 access but isn't required by the HDA spec and prevents
diff --git a/MAINTAINERS b/MAINTAINERS
index d3a888cfa0ea..c8f792ae9582 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -6953,7 +6953,6 @@ F: drivers/scsi/st*
6953 6953
6954SCTP PROTOCOL 6954SCTP PROTOCOL
6955M: Vlad Yasevich <vyasevich@gmail.com> 6955M: Vlad Yasevich <vyasevich@gmail.com>
6956M: Sridhar Samudrala <sri@us.ibm.com>
6957M: Neil Horman <nhorman@tuxdriver.com> 6956M: Neil Horman <nhorman@tuxdriver.com>
6958L: linux-sctp@vger.kernel.org 6957L: linux-sctp@vger.kernel.org
6959W: http://lksctp.sourceforge.net 6958W: http://lksctp.sourceforge.net
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 13b739469c51..1cacda426a0e 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1183,9 +1183,9 @@ config ARM_NR_BANKS
1183 default 8 1183 default 8
1184 1184
1185config IWMMXT 1185config IWMMXT
1186 bool "Enable iWMMXt support" 1186 bool "Enable iWMMXt support" if !CPU_PJ4
1187 depends on CPU_XSCALE || CPU_XSC3 || CPU_MOHAWK || CPU_PJ4 1187 depends on CPU_XSCALE || CPU_XSC3 || CPU_MOHAWK || CPU_PJ4
1188 default y if PXA27x || PXA3xx || ARCH_MMP 1188 default y if PXA27x || PXA3xx || ARCH_MMP || CPU_PJ4
1189 help 1189 help
1190 Enable support for iWMMXt context switching at run time if 1190 Enable support for iWMMXt context switching at run time if
1191 running on a CPU that supports it. 1191 running on a CPU that supports it.
@@ -1439,6 +1439,16 @@ config ARM_ERRATA_775420
1439 to deadlock. This workaround puts DSB before executing ISB if 1439 to deadlock. This workaround puts DSB before executing ISB if
1440 an abort may occur on cache maintenance. 1440 an abort may occur on cache maintenance.
1441 1441
1442config ARM_ERRATA_798181
1443 bool "ARM errata: TLBI/DSB failure on Cortex-A15"
1444 depends on CPU_V7 && SMP
1445 help
1446 On Cortex-A15 (r0p0..r3p2) the TLBI*IS/DSB operations are not
1447 adequately shooting down all use of the old entries. This
1448 option enables the Linux kernel workaround for this erratum
1449 which sends an IPI to the CPUs that are running the same ASID
1450 as the one being invalidated.
1451
1442endmenu 1452endmenu
1443 1453
1444source "arch/arm/common/Kconfig" 1454source "arch/arm/common/Kconfig"
diff --git a/arch/arm/include/asm/delay.h b/arch/arm/include/asm/delay.h
index 720799fd3a81..dff714d886d5 100644
--- a/arch/arm/include/asm/delay.h
+++ b/arch/arm/include/asm/delay.h
@@ -24,7 +24,7 @@ extern struct arm_delay_ops {
24 void (*delay)(unsigned long); 24 void (*delay)(unsigned long);
25 void (*const_udelay)(unsigned long); 25 void (*const_udelay)(unsigned long);
26 void (*udelay)(unsigned long); 26 void (*udelay)(unsigned long);
27 bool const_clock; 27 unsigned long ticks_per_jiffy;
28} arm_delay_ops; 28} arm_delay_ops;
29 29
30#define __delay(n) arm_delay_ops.delay(n) 30#define __delay(n) arm_delay_ops.delay(n)
diff --git a/arch/arm/include/asm/highmem.h b/arch/arm/include/asm/highmem.h
index 8c5e828f484d..91b99abe7a95 100644
--- a/arch/arm/include/asm/highmem.h
+++ b/arch/arm/include/asm/highmem.h
@@ -41,6 +41,13 @@ extern void kunmap_high(struct page *page);
41#endif 41#endif
42#endif 42#endif
43 43
44/*
45 * Needed to be able to broadcast the TLB invalidation for kmap.
46 */
47#ifdef CONFIG_ARM_ERRATA_798181
48#undef ARCH_NEEDS_KMAP_HIGH_GET
49#endif
50
44#ifdef ARCH_NEEDS_KMAP_HIGH_GET 51#ifdef ARCH_NEEDS_KMAP_HIGH_GET
45extern void *kmap_high_get(struct page *page); 52extern void *kmap_high_get(struct page *page);
46#else 53#else
diff --git a/arch/arm/include/asm/mmu_context.h b/arch/arm/include/asm/mmu_context.h
index 863a6611323c..a7b85e0d0cc1 100644
--- a/arch/arm/include/asm/mmu_context.h
+++ b/arch/arm/include/asm/mmu_context.h
@@ -27,6 +27,8 @@ void __check_vmalloc_seq(struct mm_struct *mm);
27void check_and_switch_context(struct mm_struct *mm, struct task_struct *tsk); 27void check_and_switch_context(struct mm_struct *mm, struct task_struct *tsk);
28#define init_new_context(tsk,mm) ({ atomic64_set(&mm->context.id, 0); 0; }) 28#define init_new_context(tsk,mm) ({ atomic64_set(&mm->context.id, 0); 0; })
29 29
30DECLARE_PER_CPU(atomic64_t, active_asids);
31
30#else /* !CONFIG_CPU_HAS_ASID */ 32#else /* !CONFIG_CPU_HAS_ASID */
31 33
32#ifdef CONFIG_MMU 34#ifdef CONFIG_MMU
diff --git a/arch/arm/include/asm/tlbflush.h b/arch/arm/include/asm/tlbflush.h
index 4db8c8820f0d..9e9c041358ca 100644
--- a/arch/arm/include/asm/tlbflush.h
+++ b/arch/arm/include/asm/tlbflush.h
@@ -450,6 +450,21 @@ static inline void local_flush_bp_all(void)
450 isb(); 450 isb();
451} 451}
452 452
453#ifdef CONFIG_ARM_ERRATA_798181
454static inline void dummy_flush_tlb_a15_erratum(void)
455{
456 /*
457 * Dummy TLBIMVAIS. Using the unmapped address 0 and ASID 0.
458 */
459 asm("mcr p15, 0, %0, c8, c3, 1" : : "r" (0));
460 dsb();
461}
462#else
463static inline void dummy_flush_tlb_a15_erratum(void)
464{
465}
466#endif
467
453/* 468/*
454 * flush_pmd_entry 469 * flush_pmd_entry
455 * 470 *
diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S
index 3248cde504ed..fefd7f971437 100644
--- a/arch/arm/kernel/entry-common.S
+++ b/arch/arm/kernel/entry-common.S
@@ -276,7 +276,13 @@ ENDPROC(ftrace_graph_caller_old)
276 */ 276 */
277 277
278.macro mcount_enter 278.macro mcount_enter
279/*
280 * This pad compensates for the push {lr} at the call site. Note that we are
281 * unable to unwind through a function which does not otherwise save its lr.
282 */
283 UNWIND(.pad #4)
279 stmdb sp!, {r0-r3, lr} 284 stmdb sp!, {r0-r3, lr}
285 UNWIND(.save {r0-r3, lr})
280.endm 286.endm
281 287
282.macro mcount_get_lr reg 288.macro mcount_get_lr reg
@@ -289,6 +295,7 @@ ENDPROC(ftrace_graph_caller_old)
289.endm 295.endm
290 296
291ENTRY(__gnu_mcount_nc) 297ENTRY(__gnu_mcount_nc)
298UNWIND(.fnstart)
292#ifdef CONFIG_DYNAMIC_FTRACE 299#ifdef CONFIG_DYNAMIC_FTRACE
293 mov ip, lr 300 mov ip, lr
294 ldmia sp!, {lr} 301 ldmia sp!, {lr}
@@ -296,17 +303,22 @@ ENTRY(__gnu_mcount_nc)
296#else 303#else
297 __mcount 304 __mcount
298#endif 305#endif
306UNWIND(.fnend)
299ENDPROC(__gnu_mcount_nc) 307ENDPROC(__gnu_mcount_nc)
300 308
301#ifdef CONFIG_DYNAMIC_FTRACE 309#ifdef CONFIG_DYNAMIC_FTRACE
302ENTRY(ftrace_caller) 310ENTRY(ftrace_caller)
311UNWIND(.fnstart)
303 __ftrace_caller 312 __ftrace_caller
313UNWIND(.fnend)
304ENDPROC(ftrace_caller) 314ENDPROC(ftrace_caller)
305#endif 315#endif
306 316
307#ifdef CONFIG_FUNCTION_GRAPH_TRACER 317#ifdef CONFIG_FUNCTION_GRAPH_TRACER
308ENTRY(ftrace_graph_caller) 318ENTRY(ftrace_graph_caller)
319UNWIND(.fnstart)
309 __ftrace_graph_caller 320 __ftrace_graph_caller
321UNWIND(.fnend)
310ENDPROC(ftrace_graph_caller) 322ENDPROC(ftrace_graph_caller)
311#endif 323#endif
312 324
diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S
index e0eb9a1cae77..8bac553fe213 100644
--- a/arch/arm/kernel/head.S
+++ b/arch/arm/kernel/head.S
@@ -267,7 +267,7 @@ __create_page_tables:
267 addne r6, r6, #1 << SECTION_SHIFT 267 addne r6, r6, #1 << SECTION_SHIFT
268 strne r6, [r3] 268 strne r6, [r3]
269 269
270#if defined(CONFIG_LPAE) && defined(CONFIG_CPU_ENDIAN_BE8) 270#if defined(CONFIG_ARM_LPAE) && defined(CONFIG_CPU_ENDIAN_BE8)
271 sub r4, r4, #4 @ Fixup page table pointer 271 sub r4, r4, #4 @ Fixup page table pointer
272 @ for 64-bit descriptors 272 @ for 64-bit descriptors
273#endif 273#endif
diff --git a/arch/arm/kernel/hw_breakpoint.c b/arch/arm/kernel/hw_breakpoint.c
index 96093b75ab90..5dc1aa6f0f7d 100644
--- a/arch/arm/kernel/hw_breakpoint.c
+++ b/arch/arm/kernel/hw_breakpoint.c
@@ -966,7 +966,7 @@ static void reset_ctrl_regs(void *unused)
966 } 966 }
967 967
968 if (err) { 968 if (err) {
969 pr_warning("CPU %d debug is powered down!\n", cpu); 969 pr_warn_once("CPU %d debug is powered down!\n", cpu);
970 cpumask_or(&debug_err_mask, &debug_err_mask, cpumask_of(cpu)); 970 cpumask_or(&debug_err_mask, &debug_err_mask, cpumask_of(cpu));
971 return; 971 return;
972 } 972 }
@@ -987,7 +987,7 @@ clear_vcr:
987 isb(); 987 isb();
988 988
989 if (cpumask_intersects(&debug_err_mask, cpumask_of(cpu))) { 989 if (cpumask_intersects(&debug_err_mask, cpumask_of(cpu))) {
990 pr_warning("CPU %d failed to disable vector catch\n", cpu); 990 pr_warn_once("CPU %d failed to disable vector catch\n", cpu);
991 return; 991 return;
992 } 992 }
993 993
@@ -1007,7 +1007,7 @@ clear_vcr:
1007 } 1007 }
1008 1008
1009 if (cpumask_intersects(&debug_err_mask, cpumask_of(cpu))) { 1009 if (cpumask_intersects(&debug_err_mask, cpumask_of(cpu))) {
1010 pr_warning("CPU %d failed to clear debug register pairs\n", cpu); 1010 pr_warn_once("CPU %d failed to clear debug register pairs\n", cpu);
1011 return; 1011 return;
1012 } 1012 }
1013 1013
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 3f6cbb2e3eda..d343a6c3a6d1 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -353,6 +353,23 @@ void __init early_print(const char *str, ...)
353 printk("%s", buf); 353 printk("%s", buf);
354} 354}
355 355
356static void __init cpuid_init_hwcaps(void)
357{
358 unsigned int divide_instrs;
359
360 if (cpu_architecture() < CPU_ARCH_ARMv7)
361 return;
362
363 divide_instrs = (read_cpuid_ext(CPUID_EXT_ISAR0) & 0x0f000000) >> 24;
364
365 switch (divide_instrs) {
366 case 2:
367 elf_hwcap |= HWCAP_IDIVA;
368 case 1:
369 elf_hwcap |= HWCAP_IDIVT;
370 }
371}
372
356static void __init feat_v6_fixup(void) 373static void __init feat_v6_fixup(void)
357{ 374{
358 int id = read_cpuid_id(); 375 int id = read_cpuid_id();
@@ -483,8 +500,11 @@ static void __init setup_processor(void)
483 snprintf(elf_platform, ELF_PLATFORM_SIZE, "%s%c", 500 snprintf(elf_platform, ELF_PLATFORM_SIZE, "%s%c",
484 list->elf_name, ENDIANNESS); 501 list->elf_name, ENDIANNESS);
485 elf_hwcap = list->elf_hwcap; 502 elf_hwcap = list->elf_hwcap;
503
504 cpuid_init_hwcaps();
505
486#ifndef CONFIG_ARM_THUMB 506#ifndef CONFIG_ARM_THUMB
487 elf_hwcap &= ~HWCAP_THUMB; 507 elf_hwcap &= ~(HWCAP_THUMB | HWCAP_IDIVT);
488#endif 508#endif
489 509
490 feat_v6_fixup(); 510 feat_v6_fixup();
@@ -524,7 +544,7 @@ int __init arm_add_memory(phys_addr_t start, phys_addr_t size)
524 size -= start & ~PAGE_MASK; 544 size -= start & ~PAGE_MASK;
525 bank->start = PAGE_ALIGN(start); 545 bank->start = PAGE_ALIGN(start);
526 546
527#ifndef CONFIG_LPAE 547#ifndef CONFIG_ARM_LPAE
528 if (bank->start + size < bank->start) { 548 if (bank->start + size < bank->start) {
529 printk(KERN_CRIT "Truncating memory at 0x%08llx to fit in " 549 printk(KERN_CRIT "Truncating memory at 0x%08llx to fit in "
530 "32-bit physical address space\n", (long long)start); 550 "32-bit physical address space\n", (long long)start);
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index 79078edbb9bc..1f2ccccaf009 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -673,9 +673,6 @@ static int cpufreq_callback(struct notifier_block *nb,
673 if (freq->flags & CPUFREQ_CONST_LOOPS) 673 if (freq->flags & CPUFREQ_CONST_LOOPS)
674 return NOTIFY_OK; 674 return NOTIFY_OK;
675 675
676 if (arm_delay_ops.const_clock)
677 return NOTIFY_OK;
678
679 if (!per_cpu(l_p_j_ref, cpu)) { 676 if (!per_cpu(l_p_j_ref, cpu)) {
680 per_cpu(l_p_j_ref, cpu) = 677 per_cpu(l_p_j_ref, cpu) =
681 per_cpu(cpu_data, cpu).loops_per_jiffy; 678 per_cpu(cpu_data, cpu).loops_per_jiffy;
diff --git a/arch/arm/kernel/smp_tlb.c b/arch/arm/kernel/smp_tlb.c
index bd0300531399..e82e1d248772 100644
--- a/arch/arm/kernel/smp_tlb.c
+++ b/arch/arm/kernel/smp_tlb.c
@@ -12,6 +12,7 @@
12 12
13#include <asm/smp_plat.h> 13#include <asm/smp_plat.h>
14#include <asm/tlbflush.h> 14#include <asm/tlbflush.h>
15#include <asm/mmu_context.h>
15 16
16/**********************************************************************/ 17/**********************************************************************/
17 18
@@ -69,12 +70,72 @@ static inline void ipi_flush_bp_all(void *ignored)
69 local_flush_bp_all(); 70 local_flush_bp_all();
70} 71}
71 72
73#ifdef CONFIG_ARM_ERRATA_798181
74static int erratum_a15_798181(void)
75{
76 unsigned int midr = read_cpuid_id();
77
78 /* Cortex-A15 r0p0..r3p2 affected */
79 if ((midr & 0xff0ffff0) != 0x410fc0f0 || midr > 0x413fc0f2)
80 return 0;
81 return 1;
82}
83#else
84static int erratum_a15_798181(void)
85{
86 return 0;
87}
88#endif
89
90static void ipi_flush_tlb_a15_erratum(void *arg)
91{
92 dmb();
93}
94
95static void broadcast_tlb_a15_erratum(void)
96{
97 if (!erratum_a15_798181())
98 return;
99
100 dummy_flush_tlb_a15_erratum();
101 smp_call_function_many(cpu_online_mask, ipi_flush_tlb_a15_erratum,
102 NULL, 1);
103}
104
105static void broadcast_tlb_mm_a15_erratum(struct mm_struct *mm)
106{
107 int cpu;
108 cpumask_t mask = { CPU_BITS_NONE };
109
110 if (!erratum_a15_798181())
111 return;
112
113 dummy_flush_tlb_a15_erratum();
114 for_each_online_cpu(cpu) {
115 if (cpu == smp_processor_id())
116 continue;
117 /*
118 * We only need to send an IPI if the other CPUs are running
119 * the same ASID as the one being invalidated. There is no
120 * need for locking around the active_asids check since the
121 * switch_mm() function has at least one dmb() (as required by
122 * this workaround) in case a context switch happens on
123 * another CPU after the condition below.
124 */
125 if (atomic64_read(&mm->context.id) ==
126 atomic64_read(&per_cpu(active_asids, cpu)))
127 cpumask_set_cpu(cpu, &mask);
128 }
129 smp_call_function_many(&mask, ipi_flush_tlb_a15_erratum, NULL, 1);
130}
131
72void flush_tlb_all(void) 132void flush_tlb_all(void)
73{ 133{
74 if (tlb_ops_need_broadcast()) 134 if (tlb_ops_need_broadcast())
75 on_each_cpu(ipi_flush_tlb_all, NULL, 1); 135 on_each_cpu(ipi_flush_tlb_all, NULL, 1);
76 else 136 else
77 local_flush_tlb_all(); 137 local_flush_tlb_all();
138 broadcast_tlb_a15_erratum();
78} 139}
79 140
80void flush_tlb_mm(struct mm_struct *mm) 141void flush_tlb_mm(struct mm_struct *mm)
@@ -83,6 +144,7 @@ void flush_tlb_mm(struct mm_struct *mm)
83 on_each_cpu_mask(mm_cpumask(mm), ipi_flush_tlb_mm, mm, 1); 144 on_each_cpu_mask(mm_cpumask(mm), ipi_flush_tlb_mm, mm, 1);
84 else 145 else
85 local_flush_tlb_mm(mm); 146 local_flush_tlb_mm(mm);
147 broadcast_tlb_mm_a15_erratum(mm);
86} 148}
87 149
88void flush_tlb_page(struct vm_area_struct *vma, unsigned long uaddr) 150void flush_tlb_page(struct vm_area_struct *vma, unsigned long uaddr)
@@ -95,6 +157,7 @@ void flush_tlb_page(struct vm_area_struct *vma, unsigned long uaddr)
95 &ta, 1); 157 &ta, 1);
96 } else 158 } else
97 local_flush_tlb_page(vma, uaddr); 159 local_flush_tlb_page(vma, uaddr);
160 broadcast_tlb_mm_a15_erratum(vma->vm_mm);
98} 161}
99 162
100void flush_tlb_kernel_page(unsigned long kaddr) 163void flush_tlb_kernel_page(unsigned long kaddr)
@@ -105,6 +168,7 @@ void flush_tlb_kernel_page(unsigned long kaddr)
105 on_each_cpu(ipi_flush_tlb_kernel_page, &ta, 1); 168 on_each_cpu(ipi_flush_tlb_kernel_page, &ta, 1);
106 } else 169 } else
107 local_flush_tlb_kernel_page(kaddr); 170 local_flush_tlb_kernel_page(kaddr);
171 broadcast_tlb_a15_erratum();
108} 172}
109 173
110void flush_tlb_range(struct vm_area_struct *vma, 174void flush_tlb_range(struct vm_area_struct *vma,
@@ -119,6 +183,7 @@ void flush_tlb_range(struct vm_area_struct *vma,
119 &ta, 1); 183 &ta, 1);
120 } else 184 } else
121 local_flush_tlb_range(vma, start, end); 185 local_flush_tlb_range(vma, start, end);
186 broadcast_tlb_mm_a15_erratum(vma->vm_mm);
122} 187}
123 188
124void flush_tlb_kernel_range(unsigned long start, unsigned long end) 189void flush_tlb_kernel_range(unsigned long start, unsigned long end)
@@ -130,6 +195,7 @@ void flush_tlb_kernel_range(unsigned long start, unsigned long end)
130 on_each_cpu(ipi_flush_tlb_kernel_range, &ta, 1); 195 on_each_cpu(ipi_flush_tlb_kernel_range, &ta, 1);
131 } else 196 } else
132 local_flush_tlb_kernel_range(start, end); 197 local_flush_tlb_kernel_range(start, end);
198 broadcast_tlb_a15_erratum();
133} 199}
134 200
135void flush_bp_all(void) 201void flush_bp_all(void)
diff --git a/arch/arm/kvm/vgic.c b/arch/arm/kvm/vgic.c
index c9a17316e9fe..0e4cfe123b38 100644
--- a/arch/arm/kvm/vgic.c
+++ b/arch/arm/kvm/vgic.c
@@ -883,8 +883,7 @@ static bool vgic_queue_irq(struct kvm_vcpu *vcpu, u8 sgi_source_id, int irq)
883 lr, irq, vgic_cpu->vgic_lr[lr]); 883 lr, irq, vgic_cpu->vgic_lr[lr]);
884 BUG_ON(!test_bit(lr, vgic_cpu->lr_used)); 884 BUG_ON(!test_bit(lr, vgic_cpu->lr_used));
885 vgic_cpu->vgic_lr[lr] |= GICH_LR_PENDING_BIT; 885 vgic_cpu->vgic_lr[lr] |= GICH_LR_PENDING_BIT;
886 886 return true;
887 goto out;
888 } 887 }
889 888
890 /* Try to use another LR for this interrupt */ 889 /* Try to use another LR for this interrupt */
@@ -898,7 +897,6 @@ static bool vgic_queue_irq(struct kvm_vcpu *vcpu, u8 sgi_source_id, int irq)
898 vgic_cpu->vgic_irq_lr_map[irq] = lr; 897 vgic_cpu->vgic_irq_lr_map[irq] = lr;
899 set_bit(lr, vgic_cpu->lr_used); 898 set_bit(lr, vgic_cpu->lr_used);
900 899
901out:
902 if (!vgic_irq_is_edge(vcpu, irq)) 900 if (!vgic_irq_is_edge(vcpu, irq))
903 vgic_cpu->vgic_lr[lr] |= GICH_LR_EOI; 901 vgic_cpu->vgic_lr[lr] |= GICH_LR_EOI;
904 902
@@ -1018,21 +1016,6 @@ static bool vgic_process_maintenance(struct kvm_vcpu *vcpu)
1018 1016
1019 kvm_debug("MISR = %08x\n", vgic_cpu->vgic_misr); 1017 kvm_debug("MISR = %08x\n", vgic_cpu->vgic_misr);
1020 1018
1021 /*
1022 * We do not need to take the distributor lock here, since the only
1023 * action we perform is clearing the irq_active_bit for an EOIed
1024 * level interrupt. There is a potential race with
1025 * the queuing of an interrupt in __kvm_vgic_flush_hwstate(), where we
1026 * check if the interrupt is already active. Two possibilities:
1027 *
1028 * - The queuing is occurring on the same vcpu: cannot happen,
1029 * as we're already in the context of this vcpu, and
1030 * executing the handler
1031 * - The interrupt has been migrated to another vcpu, and we
1032 * ignore this interrupt for this run. Big deal. It is still
1033 * pending though, and will get considered when this vcpu
1034 * exits.
1035 */
1036 if (vgic_cpu->vgic_misr & GICH_MISR_EOI) { 1019 if (vgic_cpu->vgic_misr & GICH_MISR_EOI) {
1037 /* 1020 /*
1038 * Some level interrupts have been EOIed. Clear their 1021 * Some level interrupts have been EOIed. Clear their
@@ -1054,6 +1037,13 @@ static bool vgic_process_maintenance(struct kvm_vcpu *vcpu)
1054 } else { 1037 } else {
1055 vgic_cpu_irq_clear(vcpu, irq); 1038 vgic_cpu_irq_clear(vcpu, irq);
1056 } 1039 }
1040
1041 /*
1042 * Despite being EOIed, the LR may not have
1043 * been marked as empty.
1044 */
1045 set_bit(lr, (unsigned long *)vgic_cpu->vgic_elrsr);
1046 vgic_cpu->vgic_lr[lr] &= ~GICH_LR_ACTIVE_BIT;
1057 } 1047 }
1058 } 1048 }
1059 1049
@@ -1064,9 +1054,8 @@ static bool vgic_process_maintenance(struct kvm_vcpu *vcpu)
1064} 1054}
1065 1055
1066/* 1056/*
1067 * Sync back the VGIC state after a guest run. We do not really touch 1057 * Sync back the VGIC state after a guest run. The distributor lock is
1068 * the distributor here (the irq_pending_on_cpu bit is safe to set), 1058 * needed so we don't get preempted in the middle of the state processing.
1069 * so there is no need for taking its lock.
1070 */ 1059 */
1071static void __kvm_vgic_sync_hwstate(struct kvm_vcpu *vcpu) 1060static void __kvm_vgic_sync_hwstate(struct kvm_vcpu *vcpu)
1072{ 1061{
@@ -1112,10 +1101,14 @@ void kvm_vgic_flush_hwstate(struct kvm_vcpu *vcpu)
1112 1101
1113void kvm_vgic_sync_hwstate(struct kvm_vcpu *vcpu) 1102void kvm_vgic_sync_hwstate(struct kvm_vcpu *vcpu)
1114{ 1103{
1104 struct vgic_dist *dist = &vcpu->kvm->arch.vgic;
1105
1115 if (!irqchip_in_kernel(vcpu->kvm)) 1106 if (!irqchip_in_kernel(vcpu->kvm))
1116 return; 1107 return;
1117 1108
1109 spin_lock(&dist->lock);
1118 __kvm_vgic_sync_hwstate(vcpu); 1110 __kvm_vgic_sync_hwstate(vcpu);
1111 spin_unlock(&dist->lock);
1119} 1112}
1120 1113
1121int kvm_vgic_vcpu_pending_irq(struct kvm_vcpu *vcpu) 1114int kvm_vgic_vcpu_pending_irq(struct kvm_vcpu *vcpu)
diff --git a/arch/arm/lib/delay.c b/arch/arm/lib/delay.c
index 6b93f6a1a3c7..64dbfa57204a 100644
--- a/arch/arm/lib/delay.c
+++ b/arch/arm/lib/delay.c
@@ -58,7 +58,7 @@ static void __timer_delay(unsigned long cycles)
58static void __timer_const_udelay(unsigned long xloops) 58static void __timer_const_udelay(unsigned long xloops)
59{ 59{
60 unsigned long long loops = xloops; 60 unsigned long long loops = xloops;
61 loops *= loops_per_jiffy; 61 loops *= arm_delay_ops.ticks_per_jiffy;
62 __timer_delay(loops >> UDELAY_SHIFT); 62 __timer_delay(loops >> UDELAY_SHIFT);
63} 63}
64 64
@@ -73,11 +73,13 @@ void __init register_current_timer_delay(const struct delay_timer *timer)
73 pr_info("Switching to timer-based delay loop\n"); 73 pr_info("Switching to timer-based delay loop\n");
74 delay_timer = timer; 74 delay_timer = timer;
75 lpj_fine = timer->freq / HZ; 75 lpj_fine = timer->freq / HZ;
76 loops_per_jiffy = lpj_fine; 76
77 /* cpufreq may scale loops_per_jiffy, so keep a private copy */
78 arm_delay_ops.ticks_per_jiffy = lpj_fine;
77 arm_delay_ops.delay = __timer_delay; 79 arm_delay_ops.delay = __timer_delay;
78 arm_delay_ops.const_udelay = __timer_const_udelay; 80 arm_delay_ops.const_udelay = __timer_const_udelay;
79 arm_delay_ops.udelay = __timer_udelay; 81 arm_delay_ops.udelay = __timer_udelay;
80 arm_delay_ops.const_clock = true; 82
81 delay_calibrated = true; 83 delay_calibrated = true;
82 } else { 84 } else {
83 pr_info("Ignoring duplicate/late registration of read_current_timer delay\n"); 85 pr_info("Ignoring duplicate/late registration of read_current_timer delay\n");
diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c
index c2f37390308a..c465faca51b0 100644
--- a/arch/arm/mm/cache-l2x0.c
+++ b/arch/arm/mm/cache-l2x0.c
@@ -299,7 +299,7 @@ static void l2x0_unlock(u32 cache_id)
299 int lockregs; 299 int lockregs;
300 int i; 300 int i;
301 301
302 switch (cache_id) { 302 switch (cache_id & L2X0_CACHE_ID_PART_MASK) {
303 case L2X0_CACHE_ID_PART_L310: 303 case L2X0_CACHE_ID_PART_L310:
304 lockregs = 8; 304 lockregs = 8;
305 break; 305 break;
@@ -333,15 +333,14 @@ void __init l2x0_init(void __iomem *base, u32 aux_val, u32 aux_mask)
333 if (cache_id_part_number_from_dt) 333 if (cache_id_part_number_from_dt)
334 cache_id = cache_id_part_number_from_dt; 334 cache_id = cache_id_part_number_from_dt;
335 else 335 else
336 cache_id = readl_relaxed(l2x0_base + L2X0_CACHE_ID) 336 cache_id = readl_relaxed(l2x0_base + L2X0_CACHE_ID);
337 & L2X0_CACHE_ID_PART_MASK;
338 aux = readl_relaxed(l2x0_base + L2X0_AUX_CTRL); 337 aux = readl_relaxed(l2x0_base + L2X0_AUX_CTRL);
339 338
340 aux &= aux_mask; 339 aux &= aux_mask;
341 aux |= aux_val; 340 aux |= aux_val;
342 341
343 /* Determine the number of ways */ 342 /* Determine the number of ways */
344 switch (cache_id) { 343 switch (cache_id & L2X0_CACHE_ID_PART_MASK) {
345 case L2X0_CACHE_ID_PART_L310: 344 case L2X0_CACHE_ID_PART_L310:
346 if (aux & (1 << 16)) 345 if (aux & (1 << 16))
347 ways = 16; 346 ways = 16;
@@ -725,7 +724,6 @@ static const struct l2x0_of_data pl310_data = {
725 .flush_all = l2x0_flush_all, 724 .flush_all = l2x0_flush_all,
726 .inv_all = l2x0_inv_all, 725 .inv_all = l2x0_inv_all,
727 .disable = l2x0_disable, 726 .disable = l2x0_disable,
728 .set_debug = pl310_set_debug,
729 }, 727 },
730}; 728};
731 729
@@ -814,9 +812,8 @@ int __init l2x0_of_init(u32 aux_val, u32 aux_mask)
814 data->save(); 812 data->save();
815 813
816 of_init = true; 814 of_init = true;
817 l2x0_init(l2x0_base, aux_val, aux_mask);
818
819 memcpy(&outer_cache, &data->outer_cache, sizeof(outer_cache)); 815 memcpy(&outer_cache, &data->outer_cache, sizeof(outer_cache));
816 l2x0_init(l2x0_base, aux_val, aux_mask);
820 817
821 return 0; 818 return 0;
822} 819}
diff --git a/arch/arm/mm/context.c b/arch/arm/mm/context.c
index a5a4b2bc42ba..2ac37372ef52 100644
--- a/arch/arm/mm/context.c
+++ b/arch/arm/mm/context.c
@@ -48,7 +48,7 @@ static DEFINE_RAW_SPINLOCK(cpu_asid_lock);
48static atomic64_t asid_generation = ATOMIC64_INIT(ASID_FIRST_VERSION); 48static atomic64_t asid_generation = ATOMIC64_INIT(ASID_FIRST_VERSION);
49static DECLARE_BITMAP(asid_map, NUM_USER_ASIDS); 49static DECLARE_BITMAP(asid_map, NUM_USER_ASIDS);
50 50
51static DEFINE_PER_CPU(atomic64_t, active_asids); 51DEFINE_PER_CPU(atomic64_t, active_asids);
52static DEFINE_PER_CPU(u64, reserved_asids); 52static DEFINE_PER_CPU(u64, reserved_asids);
53static cpumask_t tlb_flush_pending; 53static cpumask_t tlb_flush_pending;
54 54
@@ -215,6 +215,7 @@ void check_and_switch_context(struct mm_struct *mm, struct task_struct *tsk)
215 if (cpumask_test_and_clear_cpu(cpu, &tlb_flush_pending)) { 215 if (cpumask_test_and_clear_cpu(cpu, &tlb_flush_pending)) {
216 local_flush_bp_all(); 216 local_flush_bp_all();
217 local_flush_tlb_all(); 217 local_flush_tlb_all();
218 dummy_flush_tlb_a15_erratum();
218 } 219 }
219 220
220 atomic64_set(&per_cpu(active_asids, cpu), asid); 221 atomic64_set(&per_cpu(active_asids, cpu), asid);
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index e95a996ab78f..78978945492a 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -598,39 +598,60 @@ static void __init alloc_init_pte(pmd_t *pmd, unsigned long addr,
598 } while (pte++, addr += PAGE_SIZE, addr != end); 598 } while (pte++, addr += PAGE_SIZE, addr != end);
599} 599}
600 600
601static void __init alloc_init_section(pud_t *pud, unsigned long addr, 601static void __init map_init_section(pmd_t *pmd, unsigned long addr,
602 unsigned long end, phys_addr_t phys, 602 unsigned long end, phys_addr_t phys,
603 const struct mem_type *type) 603 const struct mem_type *type)
604{ 604{
605 pmd_t *pmd = pmd_offset(pud, addr); 605#ifndef CONFIG_ARM_LPAE
606
607 /* 606 /*
608 * Try a section mapping - end, addr and phys must all be aligned 607 * In classic MMU format, puds and pmds are folded in to
609 * to a section boundary. Note that PMDs refer to the individual 608 * the pgds. pmd_offset gives the PGD entry. PGDs refer to a
610 * L1 entries, whereas PGDs refer to a group of L1 entries making 609 * group of L1 entries making up one logical pointer to
611 * up one logical pointer to an L2 table. 610 * an L2 table (2MB), where as PMDs refer to the individual
611 * L1 entries (1MB). Hence increment to get the correct
612 * offset for odd 1MB sections.
613 * (See arch/arm/include/asm/pgtable-2level.h)
612 */ 614 */
613 if (type->prot_sect && ((addr | end | phys) & ~SECTION_MASK) == 0) { 615 if (addr & SECTION_SIZE)
614 pmd_t *p = pmd; 616 pmd++;
615
616#ifndef CONFIG_ARM_LPAE
617 if (addr & SECTION_SIZE)
618 pmd++;
619#endif 617#endif
618 do {
619 *pmd = __pmd(phys | type->prot_sect);
620 phys += SECTION_SIZE;
621 } while (pmd++, addr += SECTION_SIZE, addr != end);
620 622
621 do { 623 flush_pmd_entry(pmd);
622 *pmd = __pmd(phys | type->prot_sect); 624}
623 phys += SECTION_SIZE;
624 } while (pmd++, addr += SECTION_SIZE, addr != end);
625 625
626 flush_pmd_entry(p); 626static void __init alloc_init_pmd(pud_t *pud, unsigned long addr,
627 } else { 627 unsigned long end, phys_addr_t phys,
628 const struct mem_type *type)
629{
630 pmd_t *pmd = pmd_offset(pud, addr);
631 unsigned long next;
632
633 do {
628 /* 634 /*
629 * No need to loop; pte's aren't interested in the 635 * With LPAE, we must loop over to map
630 * individual L1 entries. 636 * all the pmds for the given range.
631 */ 637 */
632 alloc_init_pte(pmd, addr, end, __phys_to_pfn(phys), type); 638 next = pmd_addr_end(addr, end);
633 } 639
640 /*
641 * Try a section mapping - addr, next and phys must all be
642 * aligned to a section boundary.
643 */
644 if (type->prot_sect &&
645 ((addr | next | phys) & ~SECTION_MASK) == 0) {
646 map_init_section(pmd, addr, next, phys, type);
647 } else {
648 alloc_init_pte(pmd, addr, next,
649 __phys_to_pfn(phys), type);
650 }
651
652 phys += next - addr;
653
654 } while (pmd++, addr = next, addr != end);
634} 655}
635 656
636static void __init alloc_init_pud(pgd_t *pgd, unsigned long addr, 657static void __init alloc_init_pud(pgd_t *pgd, unsigned long addr,
@@ -641,7 +662,7 @@ static void __init alloc_init_pud(pgd_t *pgd, unsigned long addr,
641 662
642 do { 663 do {
643 next = pud_addr_end(addr, end); 664 next = pud_addr_end(addr, end);
644 alloc_init_section(pud, addr, next, phys, type); 665 alloc_init_pmd(pud, addr, next, phys, type);
645 phys += next - addr; 666 phys += next - addr;
646 } while (pud++, addr = next, addr != end); 667 } while (pud++, addr = next, addr != end);
647} 668}
diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S
index 3a3c015f8d5c..f584d3f5b37c 100644
--- a/arch/arm/mm/proc-v7.S
+++ b/arch/arm/mm/proc-v7.S
@@ -420,7 +420,7 @@ __v7_pj4b_proc_info:
420__v7_ca7mp_proc_info: 420__v7_ca7mp_proc_info:
421 .long 0x410fc070 421 .long 0x410fc070
422 .long 0xff0ffff0 422 .long 0xff0ffff0
423 __v7_proc __v7_ca7mp_setup, hwcaps = HWCAP_IDIV 423 __v7_proc __v7_ca7mp_setup
424 .size __v7_ca7mp_proc_info, . - __v7_ca7mp_proc_info 424 .size __v7_ca7mp_proc_info, . - __v7_ca7mp_proc_info
425 425
426 /* 426 /*
@@ -430,10 +430,25 @@ __v7_ca7mp_proc_info:
430__v7_ca15mp_proc_info: 430__v7_ca15mp_proc_info:
431 .long 0x410fc0f0 431 .long 0x410fc0f0
432 .long 0xff0ffff0 432 .long 0xff0ffff0
433 __v7_proc __v7_ca15mp_setup, hwcaps = HWCAP_IDIV 433 __v7_proc __v7_ca15mp_setup
434 .size __v7_ca15mp_proc_info, . - __v7_ca15mp_proc_info 434 .size __v7_ca15mp_proc_info, . - __v7_ca15mp_proc_info
435 435
436 /* 436 /*
437 * Qualcomm Inc. Krait processors.
438 */
439 .type __krait_proc_info, #object
440__krait_proc_info:
441 .long 0x510f0400 @ Required ID value
442 .long 0xff0ffc00 @ Mask for ID
443 /*
444 * Some Krait processors don't indicate support for SDIV and UDIV
445 * instructions in the ARM instruction set, even though they actually
446 * do support them.
447 */
448 __v7_proc __v7_setup, hwcaps = HWCAP_IDIV
449 .size __krait_proc_info, . - __krait_proc_info
450
451 /*
437 * Match any ARMv7 processor core. 452 * Match any ARMv7 processor core.
438 */ 453 */
439 .type __v7_proc_info, #object 454 .type __v7_proc_info, #object
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index a6fdd1643903..51244bf97271 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -657,7 +657,7 @@ config SNI_RM
657 bool "SNI RM200/300/400" 657 bool "SNI RM200/300/400"
658 select FW_ARC if CPU_LITTLE_ENDIAN 658 select FW_ARC if CPU_LITTLE_ENDIAN
659 select FW_ARC32 if CPU_LITTLE_ENDIAN 659 select FW_ARC32 if CPU_LITTLE_ENDIAN
660 select SNIPROM if CPU_BIG_ENDIAN 660 select FW_SNIPROM if CPU_BIG_ENDIAN
661 select ARCH_MAY_HAVE_PC_FDC 661 select ARCH_MAY_HAVE_PC_FDC
662 select BOOT_ELF32 662 select BOOT_ELF32
663 select CEVT_R4K 663 select CEVT_R4K
@@ -1144,7 +1144,7 @@ config DEFAULT_SGI_PARTITION
1144config FW_ARC32 1144config FW_ARC32
1145 bool 1145 bool
1146 1146
1147config SNIPROM 1147config FW_SNIPROM
1148 bool 1148 bool
1149 1149
1150config BOOT_ELF32 1150config BOOT_ELF32
diff --git a/arch/mips/cavium-octeon/setup.c b/arch/mips/cavium-octeon/setup.c
index c594a3d4f743..b0baa299f899 100644
--- a/arch/mips/cavium-octeon/setup.c
+++ b/arch/mips/cavium-octeon/setup.c
@@ -174,7 +174,10 @@ static int octeon_kexec_prepare(struct kimage *image)
174 174
175static void octeon_generic_shutdown(void) 175static void octeon_generic_shutdown(void)
176{ 176{
177 int cpu, i; 177 int i;
178#ifdef CONFIG_SMP
179 int cpu;
180#endif
178 struct cvmx_bootmem_desc *bootmem_desc; 181 struct cvmx_bootmem_desc *bootmem_desc;
179 void *named_block_array_ptr; 182 void *named_block_array_ptr;
180 183
diff --git a/arch/mips/include/uapi/asm/signal.h b/arch/mips/include/uapi/asm/signal.h
index d6b18b4d0f3a..addb9f556b71 100644
--- a/arch/mips/include/uapi/asm/signal.h
+++ b/arch/mips/include/uapi/asm/signal.h
@@ -72,6 +72,12 @@ typedef unsigned long old_sigset_t; /* at least 32 bits */
72 * 72 *
73 * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single 73 * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single
74 * Unix names RESETHAND and NODEFER respectively. 74 * Unix names RESETHAND and NODEFER respectively.
75 *
76 * SA_RESTORER used to be defined as 0x04000000 but only the O32 ABI ever
77 * supported its use and no libc was using it, so the entire sa-restorer
78 * functionality was removed with lmo commit 39bffc12c3580ab for 2.5.48
79 * retaining only the SA_RESTORER definition as a reminder to avoid
80 * accidental reuse of the mask bit.
75 */ 81 */
76#define SA_ONSTACK 0x08000000 82#define SA_ONSTACK 0x08000000
77#define SA_RESETHAND 0x80000000 83#define SA_RESETHAND 0x80000000
@@ -84,8 +90,6 @@ typedef unsigned long old_sigset_t; /* at least 32 bits */
84#define SA_NOMASK SA_NODEFER 90#define SA_NOMASK SA_NODEFER
85#define SA_ONESHOT SA_RESETHAND 91#define SA_ONESHOT SA_RESETHAND
86 92
87#define SA_RESTORER 0x04000000 /* Only for o32 */
88
89#define MINSIGSTKSZ 2048 93#define MINSIGSTKSZ 2048
90#define SIGSTKSZ 8192 94#define SIGSTKSZ 8192
91 95
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
index d069a19112e8..5fe66a0c3224 100644
--- a/arch/mips/kernel/cpu-probe.c
+++ b/arch/mips/kernel/cpu-probe.c
@@ -1227,10 +1227,8 @@ __cpuinit void cpu_probe(void)
1227 if (c->options & MIPS_CPU_FPU) { 1227 if (c->options & MIPS_CPU_FPU) {
1228 c->fpu_id = cpu_get_fpu_id(); 1228 c->fpu_id = cpu_get_fpu_id();
1229 1229
1230 if (c->isa_level == MIPS_CPU_ISA_M32R1 || 1230 if (c->isa_level & (MIPS_CPU_ISA_M32R1 | MIPS_CPU_ISA_M32R2 |
1231 c->isa_level == MIPS_CPU_ISA_M32R2 || 1231 MIPS_CPU_ISA_M64R1 | MIPS_CPU_ISA_M64R2)) {
1232 c->isa_level == MIPS_CPU_ISA_M64R1 ||
1233 c->isa_level == MIPS_CPU_ISA_M64R2) {
1234 if (c->fpu_id & MIPS_FPIR_3D) 1232 if (c->fpu_id & MIPS_FPIR_3D)
1235 c->ases |= MIPS_ASE_MIPS3D; 1233 c->ases |= MIPS_ASE_MIPS3D;
1236 } 1234 }
diff --git a/arch/mips/kernel/mcount.S b/arch/mips/kernel/mcount.S
index 165867673357..33d067148e61 100644
--- a/arch/mips/kernel/mcount.S
+++ b/arch/mips/kernel/mcount.S
@@ -46,10 +46,9 @@
46 PTR_L a5, PT_R9(sp) 46 PTR_L a5, PT_R9(sp)
47 PTR_L a6, PT_R10(sp) 47 PTR_L a6, PT_R10(sp)
48 PTR_L a7, PT_R11(sp) 48 PTR_L a7, PT_R11(sp)
49#else
50 PTR_ADDIU sp, PT_SIZE
51#endif 49#endif
52.endm 50 PTR_ADDIU sp, PT_SIZE
51 .endm
53 52
54 .macro RETURN_BACK 53 .macro RETURN_BACK
55 jr ra 54 jr ra
@@ -68,7 +67,11 @@ NESTED(ftrace_caller, PT_SIZE, ra)
68 .globl _mcount 67 .globl _mcount
69_mcount: 68_mcount:
70 b ftrace_stub 69 b ftrace_stub
71 addiu sp,sp,8 70#ifdef CONFIG_32BIT
71 addiu sp,sp,8
72#else
73 nop
74#endif
72 75
73 /* When tracing is activated, it calls ftrace_caller+8 (aka here) */ 76 /* When tracing is activated, it calls ftrace_caller+8 (aka here) */
74 lw t1, function_trace_stop 77 lw t1, function_trace_stop
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index a200b5bdbb87..c3abb88170fc 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -1571,7 +1571,7 @@ void __cpuinit per_cpu_trap_init(bool is_boot_cpu)
1571#ifdef CONFIG_64BIT 1571#ifdef CONFIG_64BIT
1572 status_set |= ST0_FR|ST0_KX|ST0_SX|ST0_UX; 1572 status_set |= ST0_FR|ST0_KX|ST0_SX|ST0_UX;
1573#endif 1573#endif
1574 if (current_cpu_data.isa_level == MIPS_CPU_ISA_IV) 1574 if (current_cpu_data.isa_level & MIPS_CPU_ISA_IV)
1575 status_set |= ST0_XX; 1575 status_set |= ST0_XX;
1576 if (cpu_has_dsp) 1576 if (cpu_has_dsp)
1577 status_set |= ST0_MX; 1577 status_set |= ST0_MX;
diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c
index ecca559b8d7b..2078915eacb9 100644
--- a/arch/mips/mm/c-r4k.c
+++ b/arch/mips/mm/c-r4k.c
@@ -1247,10 +1247,8 @@ static void __cpuinit setup_scache(void)
1247 return; 1247 return;
1248 1248
1249 default: 1249 default:
1250 if (c->isa_level == MIPS_CPU_ISA_M32R1 || 1250 if (c->isa_level & (MIPS_CPU_ISA_M32R1 | MIPS_CPU_ISA_M32R2 |
1251 c->isa_level == MIPS_CPU_ISA_M32R2 || 1251 MIPS_CPU_ISA_M64R1 | MIPS_CPU_ISA_M64R2)) {
1252 c->isa_level == MIPS_CPU_ISA_M64R1 ||
1253 c->isa_level == MIPS_CPU_ISA_M64R2) {
1254#ifdef CONFIG_MIPS_CPU_SCACHE 1252#ifdef CONFIG_MIPS_CPU_SCACHE
1255 if (mips_sc_init ()) { 1253 if (mips_sc_init ()) {
1256 scache_size = c->scache.ways * c->scache.sets * c->scache.linesz; 1254 scache_size = c->scache.ways * c->scache.sets * c->scache.linesz;
diff --git a/arch/mips/mm/sc-mips.c b/arch/mips/mm/sc-mips.c
index 93d937b4b1ba..df96da7e939b 100644
--- a/arch/mips/mm/sc-mips.c
+++ b/arch/mips/mm/sc-mips.c
@@ -98,10 +98,8 @@ static inline int __init mips_sc_probe(void)
98 c->scache.flags |= MIPS_CACHE_NOT_PRESENT; 98 c->scache.flags |= MIPS_CACHE_NOT_PRESENT;
99 99
100 /* Ignore anything but MIPSxx processors */ 100 /* Ignore anything but MIPSxx processors */
101 if (c->isa_level != MIPS_CPU_ISA_M32R1 && 101 if (!(c->isa_level & (MIPS_CPU_ISA_M32R1 | MIPS_CPU_ISA_M32R2 |
102 c->isa_level != MIPS_CPU_ISA_M32R2 && 102 MIPS_CPU_ISA_M64R1 | MIPS_CPU_ISA_M64R2)))
103 c->isa_level != MIPS_CPU_ISA_M64R1 &&
104 c->isa_level != MIPS_CPU_ISA_M64R2)
105 return 0; 103 return 0;
106 104
107 /* Does this MIPS32/MIPS64 CPU have a config2 register? */ 105 /* Does this MIPS32/MIPS64 CPU have a config2 register? */
diff --git a/arch/mips/pci/pci-alchemy.c b/arch/mips/pci/pci-alchemy.c
index 38a80c83fd67..d1faece21b6a 100644
--- a/arch/mips/pci/pci-alchemy.c
+++ b/arch/mips/pci/pci-alchemy.c
@@ -19,7 +19,7 @@
19#include <asm/mach-au1x00/au1000.h> 19#include <asm/mach-au1x00/au1000.h>
20#include <asm/tlbmisc.h> 20#include <asm/tlbmisc.h>
21 21
22#ifdef CONFIG_DEBUG_PCI 22#ifdef CONFIG_PCI_DEBUG
23#define DBG(x...) printk(KERN_DEBUG x) 23#define DBG(x...) printk(KERN_DEBUG x)
24#else 24#else
25#define DBG(x...) do {} while (0) 25#define DBG(x...) do {} while (0)
@@ -162,7 +162,7 @@ static int config_access(unsigned char access_type, struct pci_bus *bus,
162 if (status & (1 << 29)) { 162 if (status & (1 << 29)) {
163 *data = 0xffffffff; 163 *data = 0xffffffff;
164 error = -1; 164 error = -1;
165 DBG("alchemy-pci: master abort on cfg access %d bus %d dev %d", 165 DBG("alchemy-pci: master abort on cfg access %d bus %d dev %d\n",
166 access_type, bus->number, device); 166 access_type, bus->number, device);
167 } else if ((status >> 28) & 0xf) { 167 } else if ((status >> 28) & 0xf) {
168 DBG("alchemy-pci: PCI ERR detected: dev %d, status %lx\n", 168 DBG("alchemy-pci: PCI ERR detected: dev %d, status %lx\n",
diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h
index 4a2930844d43..4a5443118cfb 100644
--- a/arch/s390/include/asm/pgtable.h
+++ b/arch/s390/include/asm/pgtable.h
@@ -344,6 +344,7 @@ extern unsigned long MODULES_END;
344#define _REGION3_ENTRY_CO 0x100 /* change-recording override */ 344#define _REGION3_ENTRY_CO 0x100 /* change-recording override */
345 345
346/* Bits in the segment table entry */ 346/* Bits in the segment table entry */
347#define _SEGMENT_ENTRY_ORIGIN_LARGE ~0xfffffUL /* large page address */
347#define _SEGMENT_ENTRY_ORIGIN ~0x7ffUL/* segment table origin */ 348#define _SEGMENT_ENTRY_ORIGIN ~0x7ffUL/* segment table origin */
348#define _SEGMENT_ENTRY_RO 0x200 /* page protection bit */ 349#define _SEGMENT_ENTRY_RO 0x200 /* page protection bit */
349#define _SEGMENT_ENTRY_INV 0x20 /* invalid segment table entry */ 350#define _SEGMENT_ENTRY_INV 0x20 /* invalid segment table entry */
@@ -1531,7 +1532,8 @@ extern int s390_enable_sie(void);
1531/* 1532/*
1532 * No page table caches to initialise 1533 * No page table caches to initialise
1533 */ 1534 */
1534#define pgtable_cache_init() do { } while (0) 1535static inline void pgtable_cache_init(void) { }
1536static inline void check_pgt_cache(void) { }
1535 1537
1536#include <asm-generic/pgtable.h> 1538#include <asm-generic/pgtable.h>
1537 1539
diff --git a/arch/s390/lib/uaccess_pt.c b/arch/s390/lib/uaccess_pt.c
index dff631d34b45..466fb3383960 100644
--- a/arch/s390/lib/uaccess_pt.c
+++ b/arch/s390/lib/uaccess_pt.c
@@ -77,42 +77,69 @@ static size_t copy_in_kernel(size_t count, void __user *to,
77 * >= -4095 (IS_ERR_VALUE(x) returns true), a fault has occured and the address 77 * >= -4095 (IS_ERR_VALUE(x) returns true), a fault has occured and the address
78 * contains the (negative) exception code. 78 * contains the (negative) exception code.
79 */ 79 */
80static __always_inline unsigned long follow_table(struct mm_struct *mm, 80#ifdef CONFIG_64BIT
81 unsigned long addr, int write) 81static unsigned long follow_table(struct mm_struct *mm,
82 unsigned long address, int write)
82{ 83{
83 pgd_t *pgd; 84 unsigned long *table = (unsigned long *)__pa(mm->pgd);
84 pud_t *pud; 85
85 pmd_t *pmd; 86 switch (mm->context.asce_bits & _ASCE_TYPE_MASK) {
86 pte_t *ptep; 87 case _ASCE_TYPE_REGION1:
88 table = table + ((address >> 53) & 0x7ff);
89 if (unlikely(*table & _REGION_ENTRY_INV))
90 return -0x39UL;
91 table = (unsigned long *)(*table & _REGION_ENTRY_ORIGIN);
92 case _ASCE_TYPE_REGION2:
93 table = table + ((address >> 42) & 0x7ff);
94 if (unlikely(*table & _REGION_ENTRY_INV))
95 return -0x3aUL;
96 table = (unsigned long *)(*table & _REGION_ENTRY_ORIGIN);
97 case _ASCE_TYPE_REGION3:
98 table = table + ((address >> 31) & 0x7ff);
99 if (unlikely(*table & _REGION_ENTRY_INV))
100 return -0x3bUL;
101 table = (unsigned long *)(*table & _REGION_ENTRY_ORIGIN);
102 case _ASCE_TYPE_SEGMENT:
103 table = table + ((address >> 20) & 0x7ff);
104 if (unlikely(*table & _SEGMENT_ENTRY_INV))
105 return -0x10UL;
106 if (unlikely(*table & _SEGMENT_ENTRY_LARGE)) {
107 if (write && (*table & _SEGMENT_ENTRY_RO))
108 return -0x04UL;
109 return (*table & _SEGMENT_ENTRY_ORIGIN_LARGE) +
110 (address & ~_SEGMENT_ENTRY_ORIGIN_LARGE);
111 }
112 table = (unsigned long *)(*table & _SEGMENT_ENTRY_ORIGIN);
113 }
114 table = table + ((address >> 12) & 0xff);
115 if (unlikely(*table & _PAGE_INVALID))
116 return -0x11UL;
117 if (write && (*table & _PAGE_RO))
118 return -0x04UL;
119 return (*table & PAGE_MASK) + (address & ~PAGE_MASK);
120}
87 121
88 pgd = pgd_offset(mm, addr); 122#else /* CONFIG_64BIT */
89 if (pgd_none(*pgd) || unlikely(pgd_bad(*pgd)))
90 return -0x3aUL;
91 123
92 pud = pud_offset(pgd, addr); 124static unsigned long follow_table(struct mm_struct *mm,
93 if (pud_none(*pud) || unlikely(pud_bad(*pud))) 125 unsigned long address, int write)
94 return -0x3bUL; 126{
127 unsigned long *table = (unsigned long *)__pa(mm->pgd);
95 128
96 pmd = pmd_offset(pud, addr); 129 table = table + ((address >> 20) & 0x7ff);
97 if (pmd_none(*pmd)) 130 if (unlikely(*table & _SEGMENT_ENTRY_INV))
98 return -0x10UL; 131 return -0x10UL;
99 if (pmd_large(*pmd)) { 132 table = (unsigned long *)(*table & _SEGMENT_ENTRY_ORIGIN);
100 if (write && (pmd_val(*pmd) & _SEGMENT_ENTRY_RO)) 133 table = table + ((address >> 12) & 0xff);
101 return -0x04UL; 134 if (unlikely(*table & _PAGE_INVALID))
102 return (pmd_val(*pmd) & HPAGE_MASK) + (addr & ~HPAGE_MASK);
103 }
104 if (unlikely(pmd_bad(*pmd)))
105 return -0x10UL;
106
107 ptep = pte_offset_map(pmd, addr);
108 if (!pte_present(*ptep))
109 return -0x11UL; 135 return -0x11UL;
110 if (write && (!pte_write(*ptep) || !pte_dirty(*ptep))) 136 if (write && (*table & _PAGE_RO))
111 return -0x04UL; 137 return -0x04UL;
112 138 return (*table & PAGE_MASK) + (address & ~PAGE_MASK);
113 return (pte_val(*ptep) & PAGE_MASK) + (addr & ~PAGE_MASK);
114} 139}
115 140
141#endif /* CONFIG_64BIT */
142
116static __always_inline size_t __user_copy_pt(unsigned long uaddr, void *kptr, 143static __always_inline size_t __user_copy_pt(unsigned long uaddr, void *kptr,
117 size_t n, int write_user) 144 size_t n, int write_user)
118{ 145{
@@ -197,7 +224,7 @@ size_t copy_to_user_pt(size_t n, void __user *to, const void *from)
197 224
198static size_t clear_user_pt(size_t n, void __user *to) 225static size_t clear_user_pt(size_t n, void __user *to)
199{ 226{
200 void *zpage = &empty_zero_page; 227 void *zpage = (void *) empty_zero_page;
201 long done, size, ret; 228 long done, size, ret;
202 229
203 done = 0; 230 done = 0;
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index 92ed9692c47e..4bf68c8d4797 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -396,7 +396,7 @@ config ACPI_CUSTOM_METHOD
396 396
397config ACPI_BGRT 397config ACPI_BGRT
398 bool "Boottime Graphics Resource Table support" 398 bool "Boottime Graphics Resource Table support"
399 depends on EFI 399 depends on EFI && X86
400 help 400 help
401 This driver adds support for exposing the ACPI Boottime Graphics 401 This driver adds support for exposing the ACPI Boottime Graphics
402 Resource Table, which allows the operating system to obtain 402 Resource Table, which allows the operating system to obtain
diff --git a/drivers/acpi/acpi_i2c.c b/drivers/acpi/acpi_i2c.c
index 82045e3f5cac..a82c7626aa9b 100644
--- a/drivers/acpi/acpi_i2c.c
+++ b/drivers/acpi/acpi_i2c.c
@@ -90,7 +90,7 @@ void acpi_i2c_register_devices(struct i2c_adapter *adapter)
90 acpi_handle handle; 90 acpi_handle handle;
91 acpi_status status; 91 acpi_status status;
92 92
93 handle = ACPI_HANDLE(&adapter->dev); 93 handle = ACPI_HANDLE(adapter->dev.parent);
94 if (!handle) 94 if (!handle)
95 return; 95 return;
96 96
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index fc95308e9a11..ee255c60bdac 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -66,7 +66,8 @@ module_param(latency_factor, uint, 0644);
66 66
67static DEFINE_PER_CPU(struct cpuidle_device *, acpi_cpuidle_device); 67static DEFINE_PER_CPU(struct cpuidle_device *, acpi_cpuidle_device);
68 68
69static struct acpi_processor_cx *acpi_cstate[CPUIDLE_STATE_MAX]; 69static DEFINE_PER_CPU(struct acpi_processor_cx * [CPUIDLE_STATE_MAX],
70 acpi_cstate);
70 71
71static int disabled_by_idle_boot_param(void) 72static int disabled_by_idle_boot_param(void)
72{ 73{
@@ -722,7 +723,7 @@ static int acpi_idle_enter_c1(struct cpuidle_device *dev,
722 struct cpuidle_driver *drv, int index) 723 struct cpuidle_driver *drv, int index)
723{ 724{
724 struct acpi_processor *pr; 725 struct acpi_processor *pr;
725 struct acpi_processor_cx *cx = acpi_cstate[index]; 726 struct acpi_processor_cx *cx = per_cpu(acpi_cstate[index], dev->cpu);
726 727
727 pr = __this_cpu_read(processors); 728 pr = __this_cpu_read(processors);
728 729
@@ -745,7 +746,7 @@ static int acpi_idle_enter_c1(struct cpuidle_device *dev,
745 */ 746 */
746static int acpi_idle_play_dead(struct cpuidle_device *dev, int index) 747static int acpi_idle_play_dead(struct cpuidle_device *dev, int index)
747{ 748{
748 struct acpi_processor_cx *cx = acpi_cstate[index]; 749 struct acpi_processor_cx *cx = per_cpu(acpi_cstate[index], dev->cpu);
749 750
750 ACPI_FLUSH_CPU_CACHE(); 751 ACPI_FLUSH_CPU_CACHE();
751 752
@@ -775,7 +776,7 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
775 struct cpuidle_driver *drv, int index) 776 struct cpuidle_driver *drv, int index)
776{ 777{
777 struct acpi_processor *pr; 778 struct acpi_processor *pr;
778 struct acpi_processor_cx *cx = acpi_cstate[index]; 779 struct acpi_processor_cx *cx = per_cpu(acpi_cstate[index], dev->cpu);
779 780
780 pr = __this_cpu_read(processors); 781 pr = __this_cpu_read(processors);
781 782
@@ -833,7 +834,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
833 struct cpuidle_driver *drv, int index) 834 struct cpuidle_driver *drv, int index)
834{ 835{
835 struct acpi_processor *pr; 836 struct acpi_processor *pr;
836 struct acpi_processor_cx *cx = acpi_cstate[index]; 837 struct acpi_processor_cx *cx = per_cpu(acpi_cstate[index], dev->cpu);
837 838
838 pr = __this_cpu_read(processors); 839 pr = __this_cpu_read(processors);
839 840
@@ -960,7 +961,7 @@ static int acpi_processor_setup_cpuidle_cx(struct acpi_processor *pr,
960 !(acpi_gbl_FADT.flags & ACPI_FADT_C2_MP_SUPPORTED)) 961 !(acpi_gbl_FADT.flags & ACPI_FADT_C2_MP_SUPPORTED))
961 continue; 962 continue;
962#endif 963#endif
963 acpi_cstate[count] = cx; 964 per_cpu(acpi_cstate[count], dev->cpu) = cx;
964 965
965 count++; 966 count++;
966 if (count == CPUIDLE_STATE_MAX) 967 if (count == CPUIDLE_STATE_MAX)
diff --git a/drivers/base/power/qos.c b/drivers/base/power/qos.c
index 5f74587ef258..71671c42ef45 100644
--- a/drivers/base/power/qos.c
+++ b/drivers/base/power/qos.c
@@ -46,6 +46,7 @@
46#include "power.h" 46#include "power.h"
47 47
48static DEFINE_MUTEX(dev_pm_qos_mtx); 48static DEFINE_MUTEX(dev_pm_qos_mtx);
49static DEFINE_MUTEX(dev_pm_qos_sysfs_mtx);
49 50
50static BLOCKING_NOTIFIER_HEAD(dev_pm_notifiers); 51static BLOCKING_NOTIFIER_HEAD(dev_pm_notifiers);
51 52
@@ -216,12 +217,17 @@ void dev_pm_qos_constraints_destroy(struct device *dev)
216 struct pm_qos_constraints *c; 217 struct pm_qos_constraints *c;
217 struct pm_qos_flags *f; 218 struct pm_qos_flags *f;
218 219
219 mutex_lock(&dev_pm_qos_mtx); 220 mutex_lock(&dev_pm_qos_sysfs_mtx);
220 221
221 /* 222 /*
222 * If the device's PM QoS resume latency limit or PM QoS flags have been 223 * If the device's PM QoS resume latency limit or PM QoS flags have been
223 * exposed to user space, they have to be hidden at this point. 224 * exposed to user space, they have to be hidden at this point.
224 */ 225 */
226 pm_qos_sysfs_remove_latency(dev);
227 pm_qos_sysfs_remove_flags(dev);
228
229 mutex_lock(&dev_pm_qos_mtx);
230
225 __dev_pm_qos_hide_latency_limit(dev); 231 __dev_pm_qos_hide_latency_limit(dev);
226 __dev_pm_qos_hide_flags(dev); 232 __dev_pm_qos_hide_flags(dev);
227 233
@@ -254,6 +260,8 @@ void dev_pm_qos_constraints_destroy(struct device *dev)
254 260
255 out: 261 out:
256 mutex_unlock(&dev_pm_qos_mtx); 262 mutex_unlock(&dev_pm_qos_mtx);
263
264 mutex_unlock(&dev_pm_qos_sysfs_mtx);
257} 265}
258 266
259/** 267/**
@@ -558,6 +566,14 @@ static void __dev_pm_qos_drop_user_request(struct device *dev,
558 kfree(req); 566 kfree(req);
559} 567}
560 568
569static void dev_pm_qos_drop_user_request(struct device *dev,
570 enum dev_pm_qos_req_type type)
571{
572 mutex_lock(&dev_pm_qos_mtx);
573 __dev_pm_qos_drop_user_request(dev, type);
574 mutex_unlock(&dev_pm_qos_mtx);
575}
576
561/** 577/**
562 * dev_pm_qos_expose_latency_limit - Expose PM QoS latency limit to user space. 578 * dev_pm_qos_expose_latency_limit - Expose PM QoS latency limit to user space.
563 * @dev: Device whose PM QoS latency limit is to be exposed to user space. 579 * @dev: Device whose PM QoS latency limit is to be exposed to user space.
@@ -581,6 +597,8 @@ int dev_pm_qos_expose_latency_limit(struct device *dev, s32 value)
581 return ret; 597 return ret;
582 } 598 }
583 599
600 mutex_lock(&dev_pm_qos_sysfs_mtx);
601
584 mutex_lock(&dev_pm_qos_mtx); 602 mutex_lock(&dev_pm_qos_mtx);
585 603
586 if (IS_ERR_OR_NULL(dev->power.qos)) 604 if (IS_ERR_OR_NULL(dev->power.qos))
@@ -591,26 +609,27 @@ int dev_pm_qos_expose_latency_limit(struct device *dev, s32 value)
591 if (ret < 0) { 609 if (ret < 0) {
592 __dev_pm_qos_remove_request(req); 610 __dev_pm_qos_remove_request(req);
593 kfree(req); 611 kfree(req);
612 mutex_unlock(&dev_pm_qos_mtx);
594 goto out; 613 goto out;
595 } 614 }
596
597 dev->power.qos->latency_req = req; 615 dev->power.qos->latency_req = req;
616
617 mutex_unlock(&dev_pm_qos_mtx);
618
598 ret = pm_qos_sysfs_add_latency(dev); 619 ret = pm_qos_sysfs_add_latency(dev);
599 if (ret) 620 if (ret)
600 __dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_LATENCY); 621 dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_LATENCY);
601 622
602 out: 623 out:
603 mutex_unlock(&dev_pm_qos_mtx); 624 mutex_unlock(&dev_pm_qos_sysfs_mtx);
604 return ret; 625 return ret;
605} 626}
606EXPORT_SYMBOL_GPL(dev_pm_qos_expose_latency_limit); 627EXPORT_SYMBOL_GPL(dev_pm_qos_expose_latency_limit);
607 628
608static void __dev_pm_qos_hide_latency_limit(struct device *dev) 629static void __dev_pm_qos_hide_latency_limit(struct device *dev)
609{ 630{
610 if (!IS_ERR_OR_NULL(dev->power.qos) && dev->power.qos->latency_req) { 631 if (!IS_ERR_OR_NULL(dev->power.qos) && dev->power.qos->latency_req)
611 pm_qos_sysfs_remove_latency(dev);
612 __dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_LATENCY); 632 __dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_LATENCY);
613 }
614} 633}
615 634
616/** 635/**
@@ -619,9 +638,15 @@ static void __dev_pm_qos_hide_latency_limit(struct device *dev)
619 */ 638 */
620void dev_pm_qos_hide_latency_limit(struct device *dev) 639void dev_pm_qos_hide_latency_limit(struct device *dev)
621{ 640{
641 mutex_lock(&dev_pm_qos_sysfs_mtx);
642
643 pm_qos_sysfs_remove_latency(dev);
644
622 mutex_lock(&dev_pm_qos_mtx); 645 mutex_lock(&dev_pm_qos_mtx);
623 __dev_pm_qos_hide_latency_limit(dev); 646 __dev_pm_qos_hide_latency_limit(dev);
624 mutex_unlock(&dev_pm_qos_mtx); 647 mutex_unlock(&dev_pm_qos_mtx);
648
649 mutex_unlock(&dev_pm_qos_sysfs_mtx);
625} 650}
626EXPORT_SYMBOL_GPL(dev_pm_qos_hide_latency_limit); 651EXPORT_SYMBOL_GPL(dev_pm_qos_hide_latency_limit);
627 652
@@ -649,6 +674,8 @@ int dev_pm_qos_expose_flags(struct device *dev, s32 val)
649 } 674 }
650 675
651 pm_runtime_get_sync(dev); 676 pm_runtime_get_sync(dev);
677 mutex_lock(&dev_pm_qos_sysfs_mtx);
678
652 mutex_lock(&dev_pm_qos_mtx); 679 mutex_lock(&dev_pm_qos_mtx);
653 680
654 if (IS_ERR_OR_NULL(dev->power.qos)) 681 if (IS_ERR_OR_NULL(dev->power.qos))
@@ -659,16 +686,19 @@ int dev_pm_qos_expose_flags(struct device *dev, s32 val)
659 if (ret < 0) { 686 if (ret < 0) {
660 __dev_pm_qos_remove_request(req); 687 __dev_pm_qos_remove_request(req);
661 kfree(req); 688 kfree(req);
689 mutex_unlock(&dev_pm_qos_mtx);
662 goto out; 690 goto out;
663 } 691 }
664
665 dev->power.qos->flags_req = req; 692 dev->power.qos->flags_req = req;
693
694 mutex_unlock(&dev_pm_qos_mtx);
695
666 ret = pm_qos_sysfs_add_flags(dev); 696 ret = pm_qos_sysfs_add_flags(dev);
667 if (ret) 697 if (ret)
668 __dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_FLAGS); 698 dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_FLAGS);
669 699
670 out: 700 out:
671 mutex_unlock(&dev_pm_qos_mtx); 701 mutex_unlock(&dev_pm_qos_sysfs_mtx);
672 pm_runtime_put(dev); 702 pm_runtime_put(dev);
673 return ret; 703 return ret;
674} 704}
@@ -676,10 +706,8 @@ EXPORT_SYMBOL_GPL(dev_pm_qos_expose_flags);
676 706
677static void __dev_pm_qos_hide_flags(struct device *dev) 707static void __dev_pm_qos_hide_flags(struct device *dev)
678{ 708{
679 if (!IS_ERR_OR_NULL(dev->power.qos) && dev->power.qos->flags_req) { 709 if (!IS_ERR_OR_NULL(dev->power.qos) && dev->power.qos->flags_req)
680 pm_qos_sysfs_remove_flags(dev);
681 __dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_FLAGS); 710 __dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_FLAGS);
682 }
683} 711}
684 712
685/** 713/**
@@ -689,9 +717,15 @@ static void __dev_pm_qos_hide_flags(struct device *dev)
689void dev_pm_qos_hide_flags(struct device *dev) 717void dev_pm_qos_hide_flags(struct device *dev)
690{ 718{
691 pm_runtime_get_sync(dev); 719 pm_runtime_get_sync(dev);
720 mutex_lock(&dev_pm_qos_sysfs_mtx);
721
722 pm_qos_sysfs_remove_flags(dev);
723
692 mutex_lock(&dev_pm_qos_mtx); 724 mutex_lock(&dev_pm_qos_mtx);
693 __dev_pm_qos_hide_flags(dev); 725 __dev_pm_qos_hide_flags(dev);
694 mutex_unlock(&dev_pm_qos_mtx); 726 mutex_unlock(&dev_pm_qos_mtx);
727
728 mutex_unlock(&dev_pm_qos_sysfs_mtx);
695 pm_runtime_put(dev); 729 pm_runtime_put(dev);
696} 730}
697EXPORT_SYMBOL_GPL(dev_pm_qos_hide_flags); 731EXPORT_SYMBOL_GPL(dev_pm_qos_hide_flags);
diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c
index 4e5b7fb8927c..37d23a0f8c56 100644
--- a/drivers/cpufreq/cpufreq-cpu0.c
+++ b/drivers/cpufreq/cpufreq-cpu0.c
@@ -178,10 +178,16 @@ static struct cpufreq_driver cpu0_cpufreq_driver = {
178 178
179static int cpu0_cpufreq_probe(struct platform_device *pdev) 179static int cpu0_cpufreq_probe(struct platform_device *pdev)
180{ 180{
181 struct device_node *np; 181 struct device_node *np, *parent;
182 int ret; 182 int ret;
183 183
184 for_each_child_of_node(of_find_node_by_path("/cpus"), np) { 184 parent = of_find_node_by_path("/cpus");
185 if (!parent) {
186 pr_err("failed to find OF /cpus\n");
187 return -ENOENT;
188 }
189
190 for_each_child_of_node(parent, np) {
185 if (of_get_property(np, "operating-points", NULL)) 191 if (of_get_property(np, "operating-points", NULL))
186 break; 192 break;
187 } 193 }
diff --git a/drivers/cpufreq/cpufreq_governor.h b/drivers/cpufreq/cpufreq_governor.h
index 46bde01eee62..cc4bd2f6838a 100644
--- a/drivers/cpufreq/cpufreq_governor.h
+++ b/drivers/cpufreq/cpufreq_governor.h
@@ -14,8 +14,8 @@
14 * published by the Free Software Foundation. 14 * published by the Free Software Foundation.
15 */ 15 */
16 16
17#ifndef _CPUFREQ_GOVERNER_H 17#ifndef _CPUFREQ_GOVERNOR_H
18#define _CPUFREQ_GOVERNER_H 18#define _CPUFREQ_GOVERNOR_H
19 19
20#include <linux/cpufreq.h> 20#include <linux/cpufreq.h>
21#include <linux/kobject.h> 21#include <linux/kobject.h>
@@ -175,4 +175,4 @@ bool need_load_eval(struct cpu_dbs_common_info *cdbs,
175 unsigned int sampling_rate); 175 unsigned int sampling_rate);
176int cpufreq_governor_dbs(struct dbs_data *dbs_data, 176int cpufreq_governor_dbs(struct dbs_data *dbs_data,
177 struct cpufreq_policy *policy, unsigned int event); 177 struct cpufreq_policy *policy, unsigned int event);
178#endif /* _CPUFREQ_GOVERNER_H */ 178#endif /* _CPUFREQ_GOVERNOR_H */
diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig
index 80b69971cf28..aeaea32bcfda 100644
--- a/drivers/dma/Kconfig
+++ b/drivers/dma/Kconfig
@@ -83,6 +83,7 @@ config INTEL_IOP_ADMA
83 83
84config DW_DMAC 84config DW_DMAC
85 tristate "Synopsys DesignWare AHB DMA support" 85 tristate "Synopsys DesignWare AHB DMA support"
86 depends on GENERIC_HARDIRQS
86 select DMA_ENGINE 87 select DMA_ENGINE
87 default y if CPU_AT32AP7000 88 default y if CPU_AT32AP7000
88 help 89 help
diff --git a/drivers/gpio/gpio-ich.c b/drivers/gpio/gpio-ich.c
index f9dbd503fc40..de3c317bd3e2 100644
--- a/drivers/gpio/gpio-ich.c
+++ b/drivers/gpio/gpio-ich.c
@@ -214,7 +214,7 @@ static int ichx_gpio_request(struct gpio_chip *chip, unsigned nr)
214 * If it can't be trusted, assume that the pin can be used as a GPIO. 214 * If it can't be trusted, assume that the pin can be used as a GPIO.
215 */ 215 */
216 if (ichx_priv.desc->use_sel_ignore[nr / 32] & (1 << (nr & 0x1f))) 216 if (ichx_priv.desc->use_sel_ignore[nr / 32] & (1 << (nr & 0x1f)))
217 return 1; 217 return 0;
218 218
219 return ichx_read_bit(GPIO_USE_SEL, nr) ? 0 : -ENODEV; 219 return ichx_read_bit(GPIO_USE_SEL, nr) ? 0 : -ENODEV;
220} 220}
diff --git a/drivers/gpio/gpio-stmpe.c b/drivers/gpio/gpio-stmpe.c
index 770476a9da87..3ce5bc38ac31 100644
--- a/drivers/gpio/gpio-stmpe.c
+++ b/drivers/gpio/gpio-stmpe.c
@@ -307,11 +307,15 @@ static const struct irq_domain_ops stmpe_gpio_irq_simple_ops = {
307 .xlate = irq_domain_xlate_twocell, 307 .xlate = irq_domain_xlate_twocell,
308}; 308};
309 309
310static int stmpe_gpio_irq_init(struct stmpe_gpio *stmpe_gpio) 310static int stmpe_gpio_irq_init(struct stmpe_gpio *stmpe_gpio,
311 struct device_node *np)
311{ 312{
312 int base = stmpe_gpio->irq_base; 313 int base = 0;
313 314
314 stmpe_gpio->domain = irq_domain_add_simple(NULL, 315 if (!np)
316 base = stmpe_gpio->irq_base;
317
318 stmpe_gpio->domain = irq_domain_add_simple(np,
315 stmpe_gpio->chip.ngpio, base, 319 stmpe_gpio->chip.ngpio, base,
316 &stmpe_gpio_irq_simple_ops, stmpe_gpio); 320 &stmpe_gpio_irq_simple_ops, stmpe_gpio);
317 if (!stmpe_gpio->domain) { 321 if (!stmpe_gpio->domain) {
@@ -346,6 +350,9 @@ static int stmpe_gpio_probe(struct platform_device *pdev)
346 stmpe_gpio->chip = template_chip; 350 stmpe_gpio->chip = template_chip;
347 stmpe_gpio->chip.ngpio = stmpe->num_gpios; 351 stmpe_gpio->chip.ngpio = stmpe->num_gpios;
348 stmpe_gpio->chip.dev = &pdev->dev; 352 stmpe_gpio->chip.dev = &pdev->dev;
353#ifdef CONFIG_OF
354 stmpe_gpio->chip.of_node = np;
355#endif
349 stmpe_gpio->chip.base = pdata ? pdata->gpio_base : -1; 356 stmpe_gpio->chip.base = pdata ? pdata->gpio_base : -1;
350 357
351 if (pdata) 358 if (pdata)
@@ -366,7 +373,7 @@ static int stmpe_gpio_probe(struct platform_device *pdev)
366 goto out_free; 373 goto out_free;
367 374
368 if (irq >= 0) { 375 if (irq >= 0) {
369 ret = stmpe_gpio_irq_init(stmpe_gpio); 376 ret = stmpe_gpio_irq_init(stmpe_gpio, np);
370 if (ret) 377 if (ret)
371 goto out_disable; 378 goto out_disable;
372 379
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 512b01c04ea7..aa341d135867 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -2077,7 +2077,6 @@ static const struct hid_device_id hid_ignore_list[] = {
2077 { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_HYBRID) }, 2077 { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_HYBRID) },
2078 { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_HEATCONTROL) }, 2078 { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_HEATCONTROL) },
2079 { HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_BEATPAD) }, 2079 { HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_BEATPAD) },
2080 { HID_USB_DEVICE(USB_VENDOR_ID_MASTERKIT, USB_DEVICE_ID_MASTERKIT_MA901RADIO) },
2081 { HID_USB_DEVICE(USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1024LS) }, 2080 { HID_USB_DEVICE(USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1024LS) },
2082 { HID_USB_DEVICE(USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1208LS) }, 2081 { HID_USB_DEVICE(USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1208LS) },
2083 { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICKIT1) }, 2082 { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICKIT1) },
@@ -2244,6 +2243,18 @@ bool hid_ignore(struct hid_device *hdev)
2244 hdev->product <= USB_DEVICE_ID_VELLEMAN_K8061_LAST)) 2243 hdev->product <= USB_DEVICE_ID_VELLEMAN_K8061_LAST))
2245 return true; 2244 return true;
2246 break; 2245 break;
2246 case USB_VENDOR_ID_ATMEL_V_USB:
2247 /* Masterkit MA901 usb radio based on Atmel tiny85 chip and
2248 * it has the same USB ID as many Atmel V-USB devices. This
2249 * usb radio is handled by radio-ma901.c driver so we want
2250 * ignore the hid. Check the name, bus, product and ignore
2251 * if we have MA901 usb radio.
2252 */
2253 if (hdev->product == USB_DEVICE_ID_ATMEL_V_USB &&
2254 hdev->bus == BUS_USB &&
2255 strncmp(hdev->name, "www.masterkit.ru MA901", 22) == 0)
2256 return true;
2257 break;
2247 } 2258 }
2248 2259
2249 if (hdev->type == HID_TYPE_USBMOUSE && 2260 if (hdev->type == HID_TYPE_USBMOUSE &&
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index c4388776f4e4..5309fd5eb0eb 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -158,6 +158,8 @@
158#define USB_VENDOR_ID_ATMEL 0x03eb 158#define USB_VENDOR_ID_ATMEL 0x03eb
159#define USB_DEVICE_ID_ATMEL_MULTITOUCH 0x211c 159#define USB_DEVICE_ID_ATMEL_MULTITOUCH 0x211c
160#define USB_DEVICE_ID_ATMEL_MXT_DIGITIZER 0x2118 160#define USB_DEVICE_ID_ATMEL_MXT_DIGITIZER 0x2118
161#define USB_VENDOR_ID_ATMEL_V_USB 0x16c0
162#define USB_DEVICE_ID_ATMEL_V_USB 0x05df
161 163
162#define USB_VENDOR_ID_AUREAL 0x0755 164#define USB_VENDOR_ID_AUREAL 0x0755
163#define USB_DEVICE_ID_AUREAL_W01RN 0x2626 165#define USB_DEVICE_ID_AUREAL_W01RN 0x2626
@@ -557,9 +559,6 @@
557#define USB_VENDOR_ID_MADCATZ 0x0738 559#define USB_VENDOR_ID_MADCATZ 0x0738
558#define USB_DEVICE_ID_MADCATZ_BEATPAD 0x4540 560#define USB_DEVICE_ID_MADCATZ_BEATPAD 0x4540
559 561
560#define USB_VENDOR_ID_MASTERKIT 0x16c0
561#define USB_DEVICE_ID_MASTERKIT_MA901RADIO 0x05df
562
563#define USB_VENDOR_ID_MCC 0x09db 562#define USB_VENDOR_ID_MCC 0x09db
564#define USB_DEVICE_ID_MCC_PMD1024LS 0x0076 563#define USB_DEVICE_ID_MCC_PMD1024LS 0x0076
565#define USB_DEVICE_ID_MCC_PMD1208LS 0x007a 564#define USB_DEVICE_ID_MCC_PMD1208LS 0x007a
diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c
index f7f113ba083e..a8ce44296cfd 100644
--- a/drivers/hid/hid-magicmouse.c
+++ b/drivers/hid/hid-magicmouse.c
@@ -462,6 +462,21 @@ static int magicmouse_input_mapping(struct hid_device *hdev,
462 return 0; 462 return 0;
463} 463}
464 464
465static void magicmouse_input_configured(struct hid_device *hdev,
466 struct hid_input *hi)
467
468{
469 struct magicmouse_sc *msc = hid_get_drvdata(hdev);
470
471 int ret = magicmouse_setup_input(msc->input, hdev);
472 if (ret) {
473 hid_err(hdev, "magicmouse setup input failed (%d)\n", ret);
474 /* clean msc->input to notify probe() of the failure */
475 msc->input = NULL;
476 }
477}
478
479
465static int magicmouse_probe(struct hid_device *hdev, 480static int magicmouse_probe(struct hid_device *hdev,
466 const struct hid_device_id *id) 481 const struct hid_device_id *id)
467{ 482{
@@ -493,15 +508,10 @@ static int magicmouse_probe(struct hid_device *hdev,
493 goto err_free; 508 goto err_free;
494 } 509 }
495 510
496 /* We do this after hid-input is done parsing reports so that 511 if (!msc->input) {
497 * hid-input uses the most natural button and axis IDs. 512 hid_err(hdev, "magicmouse input not registered\n");
498 */ 513 ret = -ENOMEM;
499 if (msc->input) { 514 goto err_stop_hw;
500 ret = magicmouse_setup_input(msc->input, hdev);
501 if (ret) {
502 hid_err(hdev, "magicmouse setup input failed (%d)\n", ret);
503 goto err_stop_hw;
504 }
505 } 515 }
506 516
507 if (id->product == USB_DEVICE_ID_APPLE_MAGICMOUSE) 517 if (id->product == USB_DEVICE_ID_APPLE_MAGICMOUSE)
@@ -568,6 +578,7 @@ static struct hid_driver magicmouse_driver = {
568 .remove = magicmouse_remove, 578 .remove = magicmouse_remove,
569 .raw_event = magicmouse_raw_event, 579 .raw_event = magicmouse_raw_event,
570 .input_mapping = magicmouse_input_mapping, 580 .input_mapping = magicmouse_input_mapping,
581 .input_configured = magicmouse_input_configured,
571}; 582};
572module_hid_driver(magicmouse_driver); 583module_hid_driver(magicmouse_driver);
573 584
diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index 0ceb6e1b0f65..e3085c487ace 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -182,7 +182,6 @@ static int dw_i2c_probe(struct platform_device *pdev)
182 adap->algo = &i2c_dw_algo; 182 adap->algo = &i2c_dw_algo;
183 adap->dev.parent = &pdev->dev; 183 adap->dev.parent = &pdev->dev;
184 adap->dev.of_node = pdev->dev.of_node; 184 adap->dev.of_node = pdev->dev.of_node;
185 ACPI_HANDLE_SET(&adap->dev, ACPI_HANDLE(&pdev->dev));
186 185
187 r = i2c_add_numbered_adapter(adap); 186 r = i2c_add_numbered_adapter(adap);
188 if (r) { 187 if (r) {
diff --git a/drivers/infiniband/hw/qib/qib_sd7220.c b/drivers/infiniband/hw/qib/qib_sd7220.c
index 08a6c6d39e56..911205d3d5a0 100644
--- a/drivers/infiniband/hw/qib/qib_sd7220.c
+++ b/drivers/infiniband/hw/qib/qib_sd7220.c
@@ -44,7 +44,7 @@
44#include "qib.h" 44#include "qib.h"
45#include "qib_7220.h" 45#include "qib_7220.h"
46 46
47#define SD7220_FW_NAME "intel/sd7220.fw" 47#define SD7220_FW_NAME "qlogic/sd7220.fw"
48MODULE_FIRMWARE(SD7220_FW_NAME); 48MODULE_FIRMWARE(SD7220_FW_NAME);
49 49
50/* 50/*
diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig
index 05d7b6333461..a0639e779973 100644
--- a/drivers/media/platform/Kconfig
+++ b/drivers/media/platform/Kconfig
@@ -204,7 +204,7 @@ config VIDEO_SAMSUNG_EXYNOS_GSC
204 204
205config VIDEO_SH_VEU 205config VIDEO_SH_VEU
206 tristate "SuperH VEU mem2mem video processing driver" 206 tristate "SuperH VEU mem2mem video processing driver"
207 depends on VIDEO_DEV && VIDEO_V4L2 207 depends on VIDEO_DEV && VIDEO_V4L2 && GENERIC_HARDIRQS
208 select VIDEOBUF2_DMA_CONTIG 208 select VIDEOBUF2_DMA_CONTIG
209 select V4L2_MEM2MEM_DEV 209 select V4L2_MEM2MEM_DEV
210 help 210 help
diff --git a/drivers/media/radio/radio-ma901.c b/drivers/media/radio/radio-ma901.c
index c61f590029ad..348dafc0318a 100644
--- a/drivers/media/radio/radio-ma901.c
+++ b/drivers/media/radio/radio-ma901.c
@@ -347,9 +347,20 @@ static void usb_ma901radio_release(struct v4l2_device *v4l2_dev)
347static int usb_ma901radio_probe(struct usb_interface *intf, 347static int usb_ma901radio_probe(struct usb_interface *intf,
348 const struct usb_device_id *id) 348 const struct usb_device_id *id)
349{ 349{
350 struct usb_device *dev = interface_to_usbdev(intf);
350 struct ma901radio_device *radio; 351 struct ma901radio_device *radio;
351 int retval = 0; 352 int retval = 0;
352 353
354 /* Masterkit MA901 usb radio has the same USB ID as many others
355 * Atmel V-USB devices. Let's make additional checks to be sure
356 * that this is our device.
357 */
358
359 if (dev->product && dev->manufacturer &&
360 (strncmp(dev->product, "MA901", 5) != 0
361 || strncmp(dev->manufacturer, "www.masterkit.ru", 16) != 0))
362 return -ENODEV;
363
353 radio = kzalloc(sizeof(struct ma901radio_device), GFP_KERNEL); 364 radio = kzalloc(sizeof(struct ma901radio_device), GFP_KERNEL);
354 if (!radio) { 365 if (!radio) {
355 dev_err(&intf->dev, "kzalloc for ma901radio_device failed\n"); 366 dev_err(&intf->dev, "kzalloc for ma901radio_device failed\n");
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 78c9e2d33eb7..2aac890320cb 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -4901,8 +4901,8 @@ static void __exit bonding_exit(void)
4901 4901
4902 bond_destroy_debugfs(); 4902 bond_destroy_debugfs();
4903 4903
4904 rtnl_link_unregister(&bond_link_ops);
4905 unregister_pernet_subsys(&bond_net_ops); 4904 unregister_pernet_subsys(&bond_net_ops);
4905 rtnl_link_unregister(&bond_link_ops);
4906 4906
4907#ifdef CONFIG_NET_POLL_CONTROLLER 4907#ifdef CONFIG_NET_POLL_CONTROLLER
4908 /* 4908 /*
diff --git a/drivers/net/ethernet/atheros/atl1e/atl1e.h b/drivers/net/ethernet/atheros/atl1e/atl1e.h
index edfdf6b950e7..b5fd934585e9 100644
--- a/drivers/net/ethernet/atheros/atl1e/atl1e.h
+++ b/drivers/net/ethernet/atheros/atl1e/atl1e.h
@@ -186,7 +186,7 @@ struct atl1e_tpd_desc {
186/* how about 0x2000 */ 186/* how about 0x2000 */
187#define MAX_TX_BUF_LEN 0x2000 187#define MAX_TX_BUF_LEN 0x2000
188#define MAX_TX_BUF_SHIFT 13 188#define MAX_TX_BUF_SHIFT 13
189/*#define MAX_TX_BUF_LEN 0x3000 */ 189#define MAX_TSO_SEG_SIZE 0x3c00
190 190
191/* rrs word 1 bit 0:31 */ 191/* rrs word 1 bit 0:31 */
192#define RRS_RX_CSUM_MASK 0xFFFF 192#define RRS_RX_CSUM_MASK 0xFFFF
diff --git a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c
index 7e0a822289c3..d058d0061ed0 100644
--- a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c
+++ b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c
@@ -2327,6 +2327,7 @@ static int atl1e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
2327 2327
2328 INIT_WORK(&adapter->reset_task, atl1e_reset_task); 2328 INIT_WORK(&adapter->reset_task, atl1e_reset_task);
2329 INIT_WORK(&adapter->link_chg_task, atl1e_link_chg_task); 2329 INIT_WORK(&adapter->link_chg_task, atl1e_link_chg_task);
2330 netif_set_gso_max_size(netdev, MAX_TSO_SEG_SIZE);
2330 err = register_netdev(netdev); 2331 err = register_netdev(netdev);
2331 if (err) { 2332 if (err) {
2332 netdev_err(netdev, "register netdevice failed\n"); 2333 netdev_err(netdev, "register netdevice failed\n");
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
index 6cc6c6374a92..40f58d73de78 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
@@ -13481,13 +13481,7 @@ static void bnx2x_check_kr2_wa(struct link_params *params,
13481{ 13481{
13482 struct bnx2x *bp = params->bp; 13482 struct bnx2x *bp = params->bp;
13483 u16 base_page, next_page, not_kr2_device, lane; 13483 u16 base_page, next_page, not_kr2_device, lane;
13484 int sigdet = bnx2x_warpcore_get_sigdet(phy, params); 13484 int sigdet;
13485
13486 if (!sigdet) {
13487 if (!(vars->link_attr_sync & LINK_ATTR_SYNC_KR2_ENABLE))
13488 bnx2x_kr2_recovery(params, vars, phy);
13489 return;
13490 }
13491 13485
13492 /* Once KR2 was disabled, wait 5 seconds before checking KR2 recovery 13486 /* Once KR2 was disabled, wait 5 seconds before checking KR2 recovery
13493 * Since some switches tend to reinit the AN process and clear the 13487 * Since some switches tend to reinit the AN process and clear the
@@ -13498,6 +13492,16 @@ static void bnx2x_check_kr2_wa(struct link_params *params,
13498 vars->check_kr2_recovery_cnt--; 13492 vars->check_kr2_recovery_cnt--;
13499 return; 13493 return;
13500 } 13494 }
13495
13496 sigdet = bnx2x_warpcore_get_sigdet(phy, params);
13497 if (!sigdet) {
13498 if (!(vars->link_attr_sync & LINK_ATTR_SYNC_KR2_ENABLE)) {
13499 bnx2x_kr2_recovery(params, vars, phy);
13500 DP(NETIF_MSG_LINK, "No sigdet\n");
13501 }
13502 return;
13503 }
13504
13501 lane = bnx2x_get_warpcore_lane(phy, params); 13505 lane = bnx2x_get_warpcore_lane(phy, params);
13502 CL22_WR_OVER_CL45(bp, phy, MDIO_REG_BANK_AER_BLOCK, 13506 CL22_WR_OVER_CL45(bp, phy, MDIO_REG_BANK_AER_BLOCK,
13503 MDIO_AER_BLOCK_AER_REG, lane); 13507 MDIO_AER_BLOCK_AER_REG, lane);
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index e56a3d169e30..1339932f59b1 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -7882,12 +7882,19 @@ static int __init ixgbe_init_module(void)
7882 ixgbe_dbg_init(); 7882 ixgbe_dbg_init();
7883#endif /* CONFIG_DEBUG_FS */ 7883#endif /* CONFIG_DEBUG_FS */
7884 7884
7885 ret = pci_register_driver(&ixgbe_driver);
7886 if (ret) {
7887#ifdef CONFIG_DEBUG_FS
7888 ixgbe_dbg_exit();
7889#endif /* CONFIG_DEBUG_FS */
7890 return ret;
7891 }
7892
7885#ifdef CONFIG_IXGBE_DCA 7893#ifdef CONFIG_IXGBE_DCA
7886 dca_register_notify(&dca_notifier); 7894 dca_register_notify(&dca_notifier);
7887#endif 7895#endif
7888 7896
7889 ret = pci_register_driver(&ixgbe_driver); 7897 return 0;
7890 return ret;
7891} 7898}
7892 7899
7893module_init(ixgbe_init_module); 7900module_init(ixgbe_init_module);
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index e392dd021b19..9a1bc1a23854 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -3872,6 +3872,30 @@ static void rtl_init_mdio_ops(struct rtl8169_private *tp)
3872 } 3872 }
3873} 3873}
3874 3874
3875static void rtl_speed_down(struct rtl8169_private *tp)
3876{
3877 u32 adv;
3878 int lpa;
3879
3880 rtl_writephy(tp, 0x1f, 0x0000);
3881 lpa = rtl_readphy(tp, MII_LPA);
3882
3883 if (lpa & (LPA_10HALF | LPA_10FULL))
3884 adv = ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full;
3885 else if (lpa & (LPA_100HALF | LPA_100FULL))
3886 adv = ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full |
3887 ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Full;
3888 else
3889 adv = ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full |
3890 ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Full |
3891 (tp->mii.supports_gmii ?
3892 ADVERTISED_1000baseT_Half |
3893 ADVERTISED_1000baseT_Full : 0);
3894
3895 rtl8169_set_speed(tp->dev, AUTONEG_ENABLE, SPEED_1000, DUPLEX_FULL,
3896 adv);
3897}
3898
3875static void rtl_wol_suspend_quirk(struct rtl8169_private *tp) 3899static void rtl_wol_suspend_quirk(struct rtl8169_private *tp)
3876{ 3900{
3877 void __iomem *ioaddr = tp->mmio_addr; 3901 void __iomem *ioaddr = tp->mmio_addr;
@@ -3904,9 +3928,7 @@ static bool rtl_wol_pll_power_down(struct rtl8169_private *tp)
3904 if (!(__rtl8169_get_wol(tp) & WAKE_ANY)) 3928 if (!(__rtl8169_get_wol(tp) & WAKE_ANY))
3905 return false; 3929 return false;
3906 3930
3907 rtl_writephy(tp, 0x1f, 0x0000); 3931 rtl_speed_down(tp);
3908 rtl_writephy(tp, MII_BMCR, 0x0000);
3909
3910 rtl_wol_suspend_quirk(tp); 3932 rtl_wol_suspend_quirk(tp);
3911 3933
3912 return true; 3934 return true;
diff --git a/drivers/net/wireless/iwlwifi/dvm/rxon.c b/drivers/net/wireless/iwlwifi/dvm/rxon.c
index 23be948cf162..a82b6b39d4ff 100644
--- a/drivers/net/wireless/iwlwifi/dvm/rxon.c
+++ b/drivers/net/wireless/iwlwifi/dvm/rxon.c
@@ -1419,6 +1419,14 @@ void iwlagn_bss_info_changed(struct ieee80211_hw *hw,
1419 1419
1420 mutex_lock(&priv->mutex); 1420 mutex_lock(&priv->mutex);
1421 1421
1422 if (changes & BSS_CHANGED_IDLE && bss_conf->idle) {
1423 /*
1424 * If we go idle, then clearly no "passive-no-rx"
1425 * workaround is needed any more, this is a reset.
1426 */
1427 iwlagn_lift_passive_no_rx(priv);
1428 }
1429
1422 if (unlikely(!iwl_is_ready(priv))) { 1430 if (unlikely(!iwl_is_ready(priv))) {
1423 IWL_DEBUG_MAC80211(priv, "leave - not ready\n"); 1431 IWL_DEBUG_MAC80211(priv, "leave - not ready\n");
1424 mutex_unlock(&priv->mutex); 1432 mutex_unlock(&priv->mutex);
@@ -1450,16 +1458,6 @@ void iwlagn_bss_info_changed(struct ieee80211_hw *hw,
1450 priv->timestamp = bss_conf->sync_tsf; 1458 priv->timestamp = bss_conf->sync_tsf;
1451 ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK; 1459 ctx->staging.filter_flags |= RXON_FILTER_ASSOC_MSK;
1452 } else { 1460 } else {
1453 /*
1454 * If we disassociate while there are pending
1455 * frames, just wake up the queues and let the
1456 * frames "escape" ... This shouldn't really
1457 * be happening to start with, but we should
1458 * not get stuck in this case either since it
1459 * can happen if userspace gets confused.
1460 */
1461 iwlagn_lift_passive_no_rx(priv);
1462
1463 ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 1461 ctx->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
1464 1462
1465 if (ctx->ctxid == IWL_RXON_CTX_BSS) 1463 if (ctx->ctxid == IWL_RXON_CTX_BSS)
diff --git a/drivers/net/wireless/iwlwifi/dvm/tx.c b/drivers/net/wireless/iwlwifi/dvm/tx.c
index cc1e0c1a6f48..70b7f68c4958 100644
--- a/drivers/net/wireless/iwlwifi/dvm/tx.c
+++ b/drivers/net/wireless/iwlwifi/dvm/tx.c
@@ -1193,7 +1193,7 @@ int iwlagn_rx_reply_tx(struct iwl_priv *priv, struct iwl_rx_cmd_buffer *rxb,
1193 memset(&info->status, 0, sizeof(info->status)); 1193 memset(&info->status, 0, sizeof(info->status));
1194 1194
1195 if (status == TX_STATUS_FAIL_PASSIVE_NO_RX && 1195 if (status == TX_STATUS_FAIL_PASSIVE_NO_RX &&
1196 iwl_is_associated_ctx(ctx) && ctx->vif && 1196 ctx->vif &&
1197 ctx->vif->type == NL80211_IFTYPE_STATION) { 1197 ctx->vif->type == NL80211_IFTYPE_STATION) {
1198 /* block and stop all queues */ 1198 /* block and stop all queues */
1199 priv->passive_no_rx = true; 1199 priv->passive_no_rx = true;
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c
index dbf5b1289516..78c2bb8d3726 100644
--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/mwifiex/cfg80211.c
@@ -1892,7 +1892,8 @@ mwifiex_cfg80211_scan(struct wiphy *wiphy,
1892 } 1892 }
1893 } 1893 }
1894 1894
1895 for (i = 0; i < request->n_channels; i++) { 1895 for (i = 0; i < min_t(u32, request->n_channels,
1896 MWIFIEX_USER_SCAN_CHAN_MAX); i++) {
1896 chan = request->channels[i]; 1897 chan = request->channels[i];
1897 priv->user_scan_cfg->chan_list[i].chan_number = chan->hw_value; 1898 priv->user_scan_cfg->chan_list[i].chan_number = chan->hw_value;
1898 priv->user_scan_cfg->chan_list[i].radio_type = chan->band; 1899 priv->user_scan_cfg->chan_list[i].radio_type = chan->band;
diff --git a/drivers/nfc/microread/mei.c b/drivers/nfc/microread/mei.c
index 13bde92b1e29..ca33ae193935 100644
--- a/drivers/nfc/microread/mei.c
+++ b/drivers/nfc/microread/mei.c
@@ -22,7 +22,7 @@
22#include <linux/slab.h> 22#include <linux/slab.h>
23#include <linux/interrupt.h> 23#include <linux/interrupt.h>
24#include <linux/gpio.h> 24#include <linux/gpio.h>
25#include <linux/mei_bus.h> 25#include <linux/mei_cl_bus.h>
26 26
27#include <linux/nfc.h> 27#include <linux/nfc.h>
28#include <net/nfc/hci.h> 28#include <net/nfc/hci.h>
@@ -32,9 +32,6 @@
32 32
33#define MICROREAD_DRIVER_NAME "microread" 33#define MICROREAD_DRIVER_NAME "microread"
34 34
35#define MICROREAD_UUID UUID_LE(0x0bb17a78, 0x2a8e, 0x4c50, 0x94, \
36 0xd4, 0x50, 0x26, 0x67, 0x23, 0x77, 0x5c)
37
38struct mei_nfc_hdr { 35struct mei_nfc_hdr {
39 u8 cmd; 36 u8 cmd;
40 u8 status; 37 u8 status;
@@ -48,7 +45,7 @@ struct mei_nfc_hdr {
48#define MEI_NFC_MAX_READ (MEI_NFC_HEADER_SIZE + MEI_NFC_MAX_HCI_PAYLOAD) 45#define MEI_NFC_MAX_READ (MEI_NFC_HEADER_SIZE + MEI_NFC_MAX_HCI_PAYLOAD)
49 46
50struct microread_mei_phy { 47struct microread_mei_phy {
51 struct mei_device *device; 48 struct mei_cl_device *device;
52 struct nfc_hci_dev *hdev; 49 struct nfc_hci_dev *hdev;
53 50
54 int powered; 51 int powered;
@@ -105,14 +102,14 @@ static int microread_mei_write(void *phy_id, struct sk_buff *skb)
105 102
106 MEI_DUMP_SKB_OUT("mei frame sent", skb); 103 MEI_DUMP_SKB_OUT("mei frame sent", skb);
107 104
108 r = mei_send(phy->device, skb->data, skb->len); 105 r = mei_cl_send(phy->device, skb->data, skb->len);
109 if (r > 0) 106 if (r > 0)
110 r = 0; 107 r = 0;
111 108
112 return r; 109 return r;
113} 110}
114 111
115static void microread_event_cb(struct mei_device *device, u32 events, 112static void microread_event_cb(struct mei_cl_device *device, u32 events,
116 void *context) 113 void *context)
117{ 114{
118 struct microread_mei_phy *phy = context; 115 struct microread_mei_phy *phy = context;
@@ -120,7 +117,7 @@ static void microread_event_cb(struct mei_device *device, u32 events,
120 if (phy->hard_fault != 0) 117 if (phy->hard_fault != 0)
121 return; 118 return;
122 119
123 if (events & BIT(MEI_EVENT_RX)) { 120 if (events & BIT(MEI_CL_EVENT_RX)) {
124 struct sk_buff *skb; 121 struct sk_buff *skb;
125 int reply_size; 122 int reply_size;
126 123
@@ -128,7 +125,7 @@ static void microread_event_cb(struct mei_device *device, u32 events,
128 if (!skb) 125 if (!skb)
129 return; 126 return;
130 127
131 reply_size = mei_recv(device, skb->data, MEI_NFC_MAX_READ); 128 reply_size = mei_cl_recv(device, skb->data, MEI_NFC_MAX_READ);
132 if (reply_size < MEI_NFC_HEADER_SIZE) { 129 if (reply_size < MEI_NFC_HEADER_SIZE) {
133 kfree(skb); 130 kfree(skb);
134 return; 131 return;
@@ -149,8 +146,8 @@ static struct nfc_phy_ops mei_phy_ops = {
149 .disable = microread_mei_disable, 146 .disable = microread_mei_disable,
150}; 147};
151 148
152static int microread_mei_probe(struct mei_device *device, 149static int microread_mei_probe(struct mei_cl_device *device,
153 const struct mei_id *id) 150 const struct mei_cl_device_id *id)
154{ 151{
155 struct microread_mei_phy *phy; 152 struct microread_mei_phy *phy;
156 int r; 153 int r;
@@ -164,9 +161,9 @@ static int microread_mei_probe(struct mei_device *device,
164 } 161 }
165 162
166 phy->device = device; 163 phy->device = device;
167 mei_set_clientdata(device, phy); 164 mei_cl_set_drvdata(device, phy);
168 165
169 r = mei_register_event_cb(device, microread_event_cb, phy); 166 r = mei_cl_register_event_cb(device, microread_event_cb, phy);
170 if (r) { 167 if (r) {
171 pr_err(MICROREAD_DRIVER_NAME ": event cb registration failed\n"); 168 pr_err(MICROREAD_DRIVER_NAME ": event cb registration failed\n");
172 goto err_out; 169 goto err_out;
@@ -186,9 +183,9 @@ err_out:
186 return r; 183 return r;
187} 184}
188 185
189static int microread_mei_remove(struct mei_device *device) 186static int microread_mei_remove(struct mei_cl_device *device)
190{ 187{
191 struct microread_mei_phy *phy = mei_get_clientdata(device); 188 struct microread_mei_phy *phy = mei_cl_get_drvdata(device);
192 189
193 pr_info("Removing microread\n"); 190 pr_info("Removing microread\n");
194 191
@@ -202,16 +199,15 @@ static int microread_mei_remove(struct mei_device *device)
202 return 0; 199 return 0;
203} 200}
204 201
205static struct mei_id microread_mei_tbl[] = { 202static struct mei_cl_device_id microread_mei_tbl[] = {
206 { MICROREAD_DRIVER_NAME, MICROREAD_UUID }, 203 { MICROREAD_DRIVER_NAME },
207 204
208 /* required last entry */ 205 /* required last entry */
209 { } 206 { }
210}; 207};
211
212MODULE_DEVICE_TABLE(mei, microread_mei_tbl); 208MODULE_DEVICE_TABLE(mei, microread_mei_tbl);
213 209
214static struct mei_driver microread_driver = { 210static struct mei_cl_driver microread_driver = {
215 .id_table = microread_mei_tbl, 211 .id_table = microread_mei_tbl,
216 .name = MICROREAD_DRIVER_NAME, 212 .name = MICROREAD_DRIVER_NAME,
217 213
@@ -225,7 +221,7 @@ static int microread_mei_init(void)
225 221
226 pr_debug(DRIVER_DESC ": %s\n", __func__); 222 pr_debug(DRIVER_DESC ": %s\n", __func__);
227 223
228 r = mei_driver_register(&microread_driver); 224 r = mei_cl_driver_register(&microread_driver);
229 if (r) { 225 if (r) {
230 pr_err(MICROREAD_DRIVER_NAME ": driver registration failed\n"); 226 pr_err(MICROREAD_DRIVER_NAME ": driver registration failed\n");
231 return r; 227 return r;
@@ -236,7 +232,7 @@ static int microread_mei_init(void)
236 232
237static void microread_mei_exit(void) 233static void microread_mei_exit(void)
238{ 234{
239 mei_driver_unregister(&microread_driver); 235 mei_cl_driver_unregister(&microread_driver);
240} 236}
241 237
242module_init(microread_mei_init); 238module_init(microread_mei_init);
diff --git a/drivers/rtc/rtc-at91rm9200.c b/drivers/rtc/rtc-at91rm9200.c
index 0a9f27e094ea..434ebc3a99dc 100644
--- a/drivers/rtc/rtc-at91rm9200.c
+++ b/drivers/rtc/rtc-at91rm9200.c
@@ -44,7 +44,6 @@ static DECLARE_COMPLETION(at91_rtc_updated);
44static unsigned int at91_alarm_year = AT91_RTC_EPOCH; 44static unsigned int at91_alarm_year = AT91_RTC_EPOCH;
45static void __iomem *at91_rtc_regs; 45static void __iomem *at91_rtc_regs;
46static int irq; 46static int irq;
47static u32 at91_rtc_imr;
48 47
49/* 48/*
50 * Decode time/date into rtc_time structure 49 * Decode time/date into rtc_time structure
@@ -109,11 +108,9 @@ static int at91_rtc_settime(struct device *dev, struct rtc_time *tm)
109 cr = at91_rtc_read(AT91_RTC_CR); 108 cr = at91_rtc_read(AT91_RTC_CR);
110 at91_rtc_write(AT91_RTC_CR, cr | AT91_RTC_UPDCAL | AT91_RTC_UPDTIM); 109 at91_rtc_write(AT91_RTC_CR, cr | AT91_RTC_UPDCAL | AT91_RTC_UPDTIM);
111 110
112 at91_rtc_imr |= AT91_RTC_ACKUPD;
113 at91_rtc_write(AT91_RTC_IER, AT91_RTC_ACKUPD); 111 at91_rtc_write(AT91_RTC_IER, AT91_RTC_ACKUPD);
114 wait_for_completion(&at91_rtc_updated); /* wait for ACKUPD interrupt */ 112 wait_for_completion(&at91_rtc_updated); /* wait for ACKUPD interrupt */
115 at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ACKUPD); 113 at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ACKUPD);
116 at91_rtc_imr &= ~AT91_RTC_ACKUPD;
117 114
118 at91_rtc_write(AT91_RTC_TIMR, 115 at91_rtc_write(AT91_RTC_TIMR,
119 bin2bcd(tm->tm_sec) << 0 116 bin2bcd(tm->tm_sec) << 0
@@ -145,7 +142,7 @@ static int at91_rtc_readalarm(struct device *dev, struct rtc_wkalrm *alrm)
145 tm->tm_yday = rtc_year_days(tm->tm_mday, tm->tm_mon, tm->tm_year); 142 tm->tm_yday = rtc_year_days(tm->tm_mday, tm->tm_mon, tm->tm_year);
146 tm->tm_year = at91_alarm_year - 1900; 143 tm->tm_year = at91_alarm_year - 1900;
147 144
148 alrm->enabled = (at91_rtc_imr & AT91_RTC_ALARM) 145 alrm->enabled = (at91_rtc_read(AT91_RTC_IMR) & AT91_RTC_ALARM)
149 ? 1 : 0; 146 ? 1 : 0;
150 147
151 dev_dbg(dev, "%s(): %4d-%02d-%02d %02d:%02d:%02d\n", __func__, 148 dev_dbg(dev, "%s(): %4d-%02d-%02d %02d:%02d:%02d\n", __func__,
@@ -171,7 +168,6 @@ static int at91_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm)
171 tm.tm_sec = alrm->time.tm_sec; 168 tm.tm_sec = alrm->time.tm_sec;
172 169
173 at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ALARM); 170 at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ALARM);
174 at91_rtc_imr &= ~AT91_RTC_ALARM;
175 at91_rtc_write(AT91_RTC_TIMALR, 171 at91_rtc_write(AT91_RTC_TIMALR,
176 bin2bcd(tm.tm_sec) << 0 172 bin2bcd(tm.tm_sec) << 0
177 | bin2bcd(tm.tm_min) << 8 173 | bin2bcd(tm.tm_min) << 8
@@ -184,7 +180,6 @@ static int at91_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm)
184 180
185 if (alrm->enabled) { 181 if (alrm->enabled) {
186 at91_rtc_write(AT91_RTC_SCCR, AT91_RTC_ALARM); 182 at91_rtc_write(AT91_RTC_SCCR, AT91_RTC_ALARM);
187 at91_rtc_imr |= AT91_RTC_ALARM;
188 at91_rtc_write(AT91_RTC_IER, AT91_RTC_ALARM); 183 at91_rtc_write(AT91_RTC_IER, AT91_RTC_ALARM);
189 } 184 }
190 185
@@ -201,12 +196,9 @@ static int at91_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled)
201 196
202 if (enabled) { 197 if (enabled) {
203 at91_rtc_write(AT91_RTC_SCCR, AT91_RTC_ALARM); 198 at91_rtc_write(AT91_RTC_SCCR, AT91_RTC_ALARM);
204 at91_rtc_imr |= AT91_RTC_ALARM;
205 at91_rtc_write(AT91_RTC_IER, AT91_RTC_ALARM); 199 at91_rtc_write(AT91_RTC_IER, AT91_RTC_ALARM);
206 } else { 200 } else
207 at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ALARM); 201 at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ALARM);
208 at91_rtc_imr &= ~AT91_RTC_ALARM;
209 }
210 202
211 return 0; 203 return 0;
212} 204}
@@ -215,10 +207,12 @@ static int at91_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled)
215 */ 207 */
216static int at91_rtc_proc(struct device *dev, struct seq_file *seq) 208static int at91_rtc_proc(struct device *dev, struct seq_file *seq)
217{ 209{
210 unsigned long imr = at91_rtc_read(AT91_RTC_IMR);
211
218 seq_printf(seq, "update_IRQ\t: %s\n", 212 seq_printf(seq, "update_IRQ\t: %s\n",
219 (at91_rtc_imr & AT91_RTC_ACKUPD) ? "yes" : "no"); 213 (imr & AT91_RTC_ACKUPD) ? "yes" : "no");
220 seq_printf(seq, "periodic_IRQ\t: %s\n", 214 seq_printf(seq, "periodic_IRQ\t: %s\n",
221 (at91_rtc_imr & AT91_RTC_SECEV) ? "yes" : "no"); 215 (imr & AT91_RTC_SECEV) ? "yes" : "no");
222 216
223 return 0; 217 return 0;
224} 218}
@@ -233,7 +227,7 @@ static irqreturn_t at91_rtc_interrupt(int irq, void *dev_id)
233 unsigned int rtsr; 227 unsigned int rtsr;
234 unsigned long events = 0; 228 unsigned long events = 0;
235 229
236 rtsr = at91_rtc_read(AT91_RTC_SR) & at91_rtc_imr; 230 rtsr = at91_rtc_read(AT91_RTC_SR) & at91_rtc_read(AT91_RTC_IMR);
237 if (rtsr) { /* this interrupt is shared! Is it ours? */ 231 if (rtsr) { /* this interrupt is shared! Is it ours? */
238 if (rtsr & AT91_RTC_ALARM) 232 if (rtsr & AT91_RTC_ALARM)
239 events |= (RTC_AF | RTC_IRQF); 233 events |= (RTC_AF | RTC_IRQF);
@@ -297,7 +291,6 @@ static int __init at91_rtc_probe(struct platform_device *pdev)
297 at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ACKUPD | AT91_RTC_ALARM | 291 at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ACKUPD | AT91_RTC_ALARM |
298 AT91_RTC_SECEV | AT91_RTC_TIMEV | 292 AT91_RTC_SECEV | AT91_RTC_TIMEV |
299 AT91_RTC_CALEV); 293 AT91_RTC_CALEV);
300 at91_rtc_imr = 0;
301 294
302 ret = request_irq(irq, at91_rtc_interrupt, 295 ret = request_irq(irq, at91_rtc_interrupt,
303 IRQF_SHARED, 296 IRQF_SHARED,
@@ -336,7 +329,6 @@ static int __exit at91_rtc_remove(struct platform_device *pdev)
336 at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ACKUPD | AT91_RTC_ALARM | 329 at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ACKUPD | AT91_RTC_ALARM |
337 AT91_RTC_SECEV | AT91_RTC_TIMEV | 330 AT91_RTC_SECEV | AT91_RTC_TIMEV |
338 AT91_RTC_CALEV); 331 AT91_RTC_CALEV);
339 at91_rtc_imr = 0;
340 free_irq(irq, pdev); 332 free_irq(irq, pdev);
341 333
342 rtc_device_unregister(rtc); 334 rtc_device_unregister(rtc);
@@ -349,35 +341,31 @@ static int __exit at91_rtc_remove(struct platform_device *pdev)
349 341
350/* AT91RM9200 RTC Power management control */ 342/* AT91RM9200 RTC Power management control */
351 343
352static u32 at91_rtc_bkpimr; 344static u32 at91_rtc_imr;
353
354 345
355static int at91_rtc_suspend(struct device *dev) 346static int at91_rtc_suspend(struct device *dev)
356{ 347{
357 /* this IRQ is shared with DBGU and other hardware which isn't 348 /* this IRQ is shared with DBGU and other hardware which isn't
358 * necessarily doing PM like we are... 349 * necessarily doing PM like we are...
359 */ 350 */
360 at91_rtc_bkpimr = at91_rtc_imr & (AT91_RTC_ALARM|AT91_RTC_SECEV); 351 at91_rtc_imr = at91_rtc_read(AT91_RTC_IMR)
361 if (at91_rtc_bkpimr) { 352 & (AT91_RTC_ALARM|AT91_RTC_SECEV);
362 if (device_may_wakeup(dev)) { 353 if (at91_rtc_imr) {
354 if (device_may_wakeup(dev))
363 enable_irq_wake(irq); 355 enable_irq_wake(irq);
364 } else { 356 else
365 at91_rtc_write(AT91_RTC_IDR, at91_rtc_bkpimr); 357 at91_rtc_write(AT91_RTC_IDR, at91_rtc_imr);
366 at91_rtc_imr &= ~at91_rtc_bkpimr; 358 }
367 }
368}
369 return 0; 359 return 0;
370} 360}
371 361
372static int at91_rtc_resume(struct device *dev) 362static int at91_rtc_resume(struct device *dev)
373{ 363{
374 if (at91_rtc_bkpimr) { 364 if (at91_rtc_imr) {
375 if (device_may_wakeup(dev)) { 365 if (device_may_wakeup(dev))
376 disable_irq_wake(irq); 366 disable_irq_wake(irq);
377 } else { 367 else
378 at91_rtc_imr |= at91_rtc_bkpimr; 368 at91_rtc_write(AT91_RTC_IER, at91_rtc_imr);
379 at91_rtc_write(AT91_RTC_IER, at91_rtc_bkpimr);
380 }
381 } 369 }
382 return 0; 370 return 0;
383} 371}
diff --git a/drivers/rtc/rtc-at91rm9200.h b/drivers/rtc/rtc-at91rm9200.h
index 5f940b6844cb..da1945e5f714 100644
--- a/drivers/rtc/rtc-at91rm9200.h
+++ b/drivers/rtc/rtc-at91rm9200.h
@@ -64,6 +64,7 @@
64#define AT91_RTC_SCCR 0x1c /* Status Clear Command Register */ 64#define AT91_RTC_SCCR 0x1c /* Status Clear Command Register */
65#define AT91_RTC_IER 0x20 /* Interrupt Enable Register */ 65#define AT91_RTC_IER 0x20 /* Interrupt Enable Register */
66#define AT91_RTC_IDR 0x24 /* Interrupt Disable Register */ 66#define AT91_RTC_IDR 0x24 /* Interrupt Disable Register */
67#define AT91_RTC_IMR 0x28 /* Interrupt Mask Register */
67 68
68#define AT91_RTC_VER 0x2c /* Valid Entry Register */ 69#define AT91_RTC_VER 0x2c /* Valid Entry Register */
69#define AT91_RTC_NVTIM (1 << 0) /* Non valid Time */ 70#define AT91_RTC_NVTIM (1 << 0) /* Non valid Time */
diff --git a/drivers/s390/block/scm_blk.c b/drivers/s390/block/scm_blk.c
index 5ac9c935c151..e9b9c8392832 100644
--- a/drivers/s390/block/scm_blk.c
+++ b/drivers/s390/block/scm_blk.c
@@ -307,7 +307,7 @@ static void scm_blk_handle_error(struct scm_request *scmrq)
307 case EQC_WR_PROHIBIT: 307 case EQC_WR_PROHIBIT:
308 spin_lock_irqsave(&bdev->lock, flags); 308 spin_lock_irqsave(&bdev->lock, flags);
309 if (bdev->state != SCM_WR_PROHIBIT) 309 if (bdev->state != SCM_WR_PROHIBIT)
310 pr_info("%lu: Write access to the SCM increment is suspended\n", 310 pr_info("%lx: Write access to the SCM increment is suspended\n",
311 (unsigned long) bdev->scmdev->address); 311 (unsigned long) bdev->scmdev->address);
312 bdev->state = SCM_WR_PROHIBIT; 312 bdev->state = SCM_WR_PROHIBIT;
313 spin_unlock_irqrestore(&bdev->lock, flags); 313 spin_unlock_irqrestore(&bdev->lock, flags);
@@ -445,7 +445,7 @@ void scm_blk_set_available(struct scm_blk_dev *bdev)
445 445
446 spin_lock_irqsave(&bdev->lock, flags); 446 spin_lock_irqsave(&bdev->lock, flags);
447 if (bdev->state == SCM_WR_PROHIBIT) 447 if (bdev->state == SCM_WR_PROHIBIT)
448 pr_info("%lu: Write access to the SCM increment is restored\n", 448 pr_info("%lx: Write access to the SCM increment is restored\n",
449 (unsigned long) bdev->scmdev->address); 449 (unsigned long) bdev->scmdev->address);
450 bdev->state = SCM_OPER; 450 bdev->state = SCM_OPER;
451 spin_unlock_irqrestore(&bdev->lock, flags); 451 spin_unlock_irqrestore(&bdev->lock, flags);
@@ -463,12 +463,15 @@ static int __init scm_blk_init(void)
463 goto out; 463 goto out;
464 464
465 scm_major = ret; 465 scm_major = ret;
466 if (scm_alloc_rqs(nr_requests)) 466 ret = scm_alloc_rqs(nr_requests);
467 if (ret)
467 goto out_unreg; 468 goto out_unreg;
468 469
469 scm_debug = debug_register("scm_log", 16, 1, 16); 470 scm_debug = debug_register("scm_log", 16, 1, 16);
470 if (!scm_debug) 471 if (!scm_debug) {
472 ret = -ENOMEM;
471 goto out_free; 473 goto out_free;
474 }
472 475
473 debug_register_view(scm_debug, &debug_hex_ascii_view); 476 debug_register_view(scm_debug, &debug_hex_ascii_view);
474 debug_set_level(scm_debug, 2); 477 debug_set_level(scm_debug, 2);
diff --git a/drivers/s390/block/scm_drv.c b/drivers/s390/block/scm_drv.c
index 5f6180d6ff08..c98cf52d78d1 100644
--- a/drivers/s390/block/scm_drv.c
+++ b/drivers/s390/block/scm_drv.c
@@ -19,7 +19,7 @@ static void scm_notify(struct scm_device *scmdev, enum scm_event event)
19 19
20 switch (event) { 20 switch (event) {
21 case SCM_CHANGE: 21 case SCM_CHANGE:
22 pr_info("%lu: The capabilities of the SCM increment changed\n", 22 pr_info("%lx: The capabilities of the SCM increment changed\n",
23 (unsigned long) scmdev->address); 23 (unsigned long) scmdev->address);
24 SCM_LOG(2, "State changed"); 24 SCM_LOG(2, "State changed");
25 SCM_LOG_STATE(2, scmdev); 25 SCM_LOG_STATE(2, scmdev);
diff --git a/drivers/s390/char/tty3270.c b/drivers/s390/char/tty3270.c
index b907dba24025..cee69dac3e18 100644
--- a/drivers/s390/char/tty3270.c
+++ b/drivers/s390/char/tty3270.c
@@ -915,7 +915,7 @@ static int tty3270_install(struct tty_driver *driver, struct tty_struct *tty)
915 int i, rc; 915 int i, rc;
916 916
917 /* Check if the tty3270 is already there. */ 917 /* Check if the tty3270 is already there. */
918 view = raw3270_find_view(&tty3270_fn, tty->index); 918 view = raw3270_find_view(&tty3270_fn, tty->index + RAW3270_FIRSTMINOR);
919 if (!IS_ERR(view)) { 919 if (!IS_ERR(view)) {
920 tp = container_of(view, struct tty3270, view); 920 tp = container_of(view, struct tty3270, view);
921 tty->driver_data = tp; 921 tty->driver_data = tp;
@@ -927,15 +927,16 @@ static int tty3270_install(struct tty_driver *driver, struct tty_struct *tty)
927 tp->inattr = TF_INPUT; 927 tp->inattr = TF_INPUT;
928 return tty_port_install(&tp->port, driver, tty); 928 return tty_port_install(&tp->port, driver, tty);
929 } 929 }
930 if (tty3270_max_index < tty->index) 930 if (tty3270_max_index < tty->index + 1)
931 tty3270_max_index = tty->index; 931 tty3270_max_index = tty->index + 1;
932 932
933 /* Allocate tty3270 structure on first open. */ 933 /* Allocate tty3270 structure on first open. */
934 tp = tty3270_alloc_view(); 934 tp = tty3270_alloc_view();
935 if (IS_ERR(tp)) 935 if (IS_ERR(tp))
936 return PTR_ERR(tp); 936 return PTR_ERR(tp);
937 937
938 rc = raw3270_add_view(&tp->view, &tty3270_fn, tty->index); 938 rc = raw3270_add_view(&tp->view, &tty3270_fn,
939 tty->index + RAW3270_FIRSTMINOR);
939 if (rc) { 940 if (rc) {
940 tty3270_free_view(tp); 941 tty3270_free_view(tp);
941 return rc; 942 return rc;
@@ -1846,12 +1847,12 @@ static const struct tty_operations tty3270_ops = {
1846 1847
1847void tty3270_create_cb(int minor) 1848void tty3270_create_cb(int minor)
1848{ 1849{
1849 tty_register_device(tty3270_driver, minor, NULL); 1850 tty_register_device(tty3270_driver, minor - RAW3270_FIRSTMINOR, NULL);
1850} 1851}
1851 1852
1852void tty3270_destroy_cb(int minor) 1853void tty3270_destroy_cb(int minor)
1853{ 1854{
1854 tty_unregister_device(tty3270_driver, minor); 1855 tty_unregister_device(tty3270_driver, minor - RAW3270_FIRSTMINOR);
1855} 1856}
1856 1857
1857struct raw3270_notifier tty3270_notifier = 1858struct raw3270_notifier tty3270_notifier =
@@ -1884,7 +1885,8 @@ static int __init tty3270_init(void)
1884 driver->driver_name = "tty3270"; 1885 driver->driver_name = "tty3270";
1885 driver->name = "3270/tty"; 1886 driver->name = "3270/tty";
1886 driver->major = IBM_TTY3270_MAJOR; 1887 driver->major = IBM_TTY3270_MAJOR;
1887 driver->minor_start = 0; 1888 driver->minor_start = RAW3270_FIRSTMINOR;
1889 driver->name_base = RAW3270_FIRSTMINOR;
1888 driver->type = TTY_DRIVER_TYPE_SYSTEM; 1890 driver->type = TTY_DRIVER_TYPE_SYSTEM;
1889 driver->subtype = SYSTEM_TYPE_TTY; 1891 driver->subtype = SYSTEM_TYPE_TTY;
1890 driver->init_termios = tty_std_termios; 1892 driver->init_termios = tty_std_termios;
diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index f80eee74a311..2be0de920d67 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -55,6 +55,7 @@ comment "SPI Master Controller Drivers"
55 55
56config SPI_ALTERA 56config SPI_ALTERA
57 tristate "Altera SPI Controller" 57 tristate "Altera SPI Controller"
58 depends on GENERIC_HARDIRQS
58 select SPI_BITBANG 59 select SPI_BITBANG
59 help 60 help
60 This is the driver for the Altera SPI Controller. 61 This is the driver for the Altera SPI Controller.
@@ -310,7 +311,7 @@ config SPI_PXA2XX_DMA
310 311
311config SPI_PXA2XX 312config SPI_PXA2XX
312 tristate "PXA2xx SSP SPI master" 313 tristate "PXA2xx SSP SPI master"
313 depends on ARCH_PXA || PCI || ACPI 314 depends on (ARCH_PXA || PCI || ACPI) && GENERIC_HARDIRQS
314 select PXA_SSP if ARCH_PXA 315 select PXA_SSP if ARCH_PXA
315 help 316 help
316 This enables using a PXA2xx or Sodaville SSP port as a SPI master 317 This enables using a PXA2xx or Sodaville SSP port as a SPI master
diff --git a/drivers/spi/spi-bcm63xx.c b/drivers/spi/spi-bcm63xx.c
index 9578af782a77..d7df435d962e 100644
--- a/drivers/spi/spi-bcm63xx.c
+++ b/drivers/spi/spi-bcm63xx.c
@@ -152,7 +152,6 @@ static void bcm63xx_spi_setup_transfer(struct spi_device *spi,
152static int bcm63xx_spi_setup(struct spi_device *spi) 152static int bcm63xx_spi_setup(struct spi_device *spi)
153{ 153{
154 struct bcm63xx_spi *bs; 154 struct bcm63xx_spi *bs;
155 int ret;
156 155
157 bs = spi_master_get_devdata(spi->master); 156 bs = spi_master_get_devdata(spi->master);
158 157
@@ -490,7 +489,7 @@ static int bcm63xx_spi_probe(struct platform_device *pdev)
490 default: 489 default:
491 dev_err(dev, "unsupported MSG_CTL width: %d\n", 490 dev_err(dev, "unsupported MSG_CTL width: %d\n",
492 bs->msg_ctl_width); 491 bs->msg_ctl_width);
493 goto out_clk_disable; 492 goto out_err;
494 } 493 }
495 494
496 /* Initialize hardware */ 495 /* Initialize hardware */
diff --git a/drivers/spi/spi-mpc512x-psc.c b/drivers/spi/spi-mpc512x-psc.c
index 89480b281d74..3e490ee7f275 100644
--- a/drivers/spi/spi-mpc512x-psc.c
+++ b/drivers/spi/spi-mpc512x-psc.c
@@ -164,7 +164,7 @@ static int mpc512x_psc_spi_transfer_rxtx(struct spi_device *spi,
164 164
165 for (i = count; i > 0; i--) { 165 for (i = count; i > 0; i--) {
166 data = tx_buf ? *tx_buf++ : 0; 166 data = tx_buf ? *tx_buf++ : 0;
167 if (len == EOFBYTE) 167 if (len == EOFBYTE && t->cs_change)
168 setbits32(&fifo->txcmd, MPC512x_PSC_FIFO_EOF); 168 setbits32(&fifo->txcmd, MPC512x_PSC_FIFO_EOF);
169 out_8(&fifo->txdata_8, data); 169 out_8(&fifo->txdata_8, data);
170 len--; 170 len--;
diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c
index 90b27a3508a6..810413883c79 100644
--- a/drivers/spi/spi-pxa2xx.c
+++ b/drivers/spi/spi-pxa2xx.c
@@ -1168,7 +1168,6 @@ static int pxa2xx_spi_probe(struct platform_device *pdev)
1168 1168
1169 master->dev.parent = &pdev->dev; 1169 master->dev.parent = &pdev->dev;
1170 master->dev.of_node = pdev->dev.of_node; 1170 master->dev.of_node = pdev->dev.of_node;
1171 ACPI_HANDLE_SET(&master->dev, ACPI_HANDLE(&pdev->dev));
1172 /* the spi->mode bits understood by this driver: */ 1171 /* the spi->mode bits understood by this driver: */
1173 master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | SPI_LOOP; 1172 master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | SPI_LOOP;
1174 1173
diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index e862ab8853aa..4188b2faac5c 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -994,25 +994,30 @@ static irqreturn_t s3c64xx_spi_irq(int irq, void *data)
994{ 994{
995 struct s3c64xx_spi_driver_data *sdd = data; 995 struct s3c64xx_spi_driver_data *sdd = data;
996 struct spi_master *spi = sdd->master; 996 struct spi_master *spi = sdd->master;
997 unsigned int val; 997 unsigned int val, clr = 0;
998 998
999 val = readl(sdd->regs + S3C64XX_SPI_PENDING_CLR); 999 val = readl(sdd->regs + S3C64XX_SPI_STATUS);
1000 1000
1001 val &= S3C64XX_SPI_PND_RX_OVERRUN_CLR | 1001 if (val & S3C64XX_SPI_ST_RX_OVERRUN_ERR) {
1002 S3C64XX_SPI_PND_RX_UNDERRUN_CLR | 1002 clr = S3C64XX_SPI_PND_RX_OVERRUN_CLR;
1003 S3C64XX_SPI_PND_TX_OVERRUN_CLR |
1004 S3C64XX_SPI_PND_TX_UNDERRUN_CLR;
1005
1006 writel(val, sdd->regs + S3C64XX_SPI_PENDING_CLR);
1007
1008 if (val & S3C64XX_SPI_PND_RX_OVERRUN_CLR)
1009 dev_err(&spi->dev, "RX overrun\n"); 1003 dev_err(&spi->dev, "RX overrun\n");
1010 if (val & S3C64XX_SPI_PND_RX_UNDERRUN_CLR) 1004 }
1005 if (val & S3C64XX_SPI_ST_RX_UNDERRUN_ERR) {
1006 clr |= S3C64XX_SPI_PND_RX_UNDERRUN_CLR;
1011 dev_err(&spi->dev, "RX underrun\n"); 1007 dev_err(&spi->dev, "RX underrun\n");
1012 if (val & S3C64XX_SPI_PND_TX_OVERRUN_CLR) 1008 }
1009 if (val & S3C64XX_SPI_ST_TX_OVERRUN_ERR) {
1010 clr |= S3C64XX_SPI_PND_TX_OVERRUN_CLR;
1013 dev_err(&spi->dev, "TX overrun\n"); 1011 dev_err(&spi->dev, "TX overrun\n");
1014 if (val & S3C64XX_SPI_PND_TX_UNDERRUN_CLR) 1012 }
1013 if (val & S3C64XX_SPI_ST_TX_UNDERRUN_ERR) {
1014 clr |= S3C64XX_SPI_PND_TX_UNDERRUN_CLR;
1015 dev_err(&spi->dev, "TX underrun\n"); 1015 dev_err(&spi->dev, "TX underrun\n");
1016 }
1017
1018 /* Clear the pending irq by setting and then clearing it */
1019 writel(clr, sdd->regs + S3C64XX_SPI_PENDING_CLR);
1020 writel(0, sdd->regs + S3C64XX_SPI_PENDING_CLR);
1016 1021
1017 return IRQ_HANDLED; 1022 return IRQ_HANDLED;
1018} 1023}
@@ -1036,9 +1041,13 @@ static void s3c64xx_spi_hwinit(struct s3c64xx_spi_driver_data *sdd, int channel)
1036 writel(0, regs + S3C64XX_SPI_MODE_CFG); 1041 writel(0, regs + S3C64XX_SPI_MODE_CFG);
1037 writel(0, regs + S3C64XX_SPI_PACKET_CNT); 1042 writel(0, regs + S3C64XX_SPI_PACKET_CNT);
1038 1043
1039 /* Clear any irq pending bits */ 1044 /* Clear any irq pending bits, should set and clear the bits */
1040 writel(readl(regs + S3C64XX_SPI_PENDING_CLR), 1045 val = S3C64XX_SPI_PND_RX_OVERRUN_CLR |
1041 regs + S3C64XX_SPI_PENDING_CLR); 1046 S3C64XX_SPI_PND_RX_UNDERRUN_CLR |
1047 S3C64XX_SPI_PND_TX_OVERRUN_CLR |
1048 S3C64XX_SPI_PND_TX_UNDERRUN_CLR;
1049 writel(val, regs + S3C64XX_SPI_PENDING_CLR);
1050 writel(0, regs + S3C64XX_SPI_PENDING_CLR);
1042 1051
1043 writel(0, regs + S3C64XX_SPI_SWAP_CFG); 1052 writel(0, regs + S3C64XX_SPI_SWAP_CFG);
1044 1053
diff --git a/drivers/spi/spi-tegra20-slink.c b/drivers/spi/spi-tegra20-slink.c
index b8698b389ef3..a829563f4713 100644
--- a/drivers/spi/spi-tegra20-slink.c
+++ b/drivers/spi/spi-tegra20-slink.c
@@ -858,21 +858,6 @@ static int tegra_slink_setup(struct spi_device *spi)
858 return 0; 858 return 0;
859} 859}
860 860
861static int tegra_slink_prepare_transfer(struct spi_master *master)
862{
863 struct tegra_slink_data *tspi = spi_master_get_devdata(master);
864
865 return pm_runtime_get_sync(tspi->dev);
866}
867
868static int tegra_slink_unprepare_transfer(struct spi_master *master)
869{
870 struct tegra_slink_data *tspi = spi_master_get_devdata(master);
871
872 pm_runtime_put(tspi->dev);
873 return 0;
874}
875
876static int tegra_slink_transfer_one_message(struct spi_master *master, 861static int tegra_slink_transfer_one_message(struct spi_master *master,
877 struct spi_message *msg) 862 struct spi_message *msg)
878{ 863{
@@ -885,6 +870,12 @@ static int tegra_slink_transfer_one_message(struct spi_master *master,
885 870
886 msg->status = 0; 871 msg->status = 0;
887 msg->actual_length = 0; 872 msg->actual_length = 0;
873 ret = pm_runtime_get_sync(tspi->dev);
874 if (ret < 0) {
875 dev_err(tspi->dev, "runtime get failed: %d\n", ret);
876 goto done;
877 }
878
888 single_xfer = list_is_singular(&msg->transfers); 879 single_xfer = list_is_singular(&msg->transfers);
889 list_for_each_entry(xfer, &msg->transfers, transfer_list) { 880 list_for_each_entry(xfer, &msg->transfers, transfer_list) {
890 INIT_COMPLETION(tspi->xfer_completion); 881 INIT_COMPLETION(tspi->xfer_completion);
@@ -921,6 +912,8 @@ static int tegra_slink_transfer_one_message(struct spi_master *master,
921exit: 912exit:
922 tegra_slink_writel(tspi, tspi->def_command_reg, SLINK_COMMAND); 913 tegra_slink_writel(tspi, tspi->def_command_reg, SLINK_COMMAND);
923 tegra_slink_writel(tspi, tspi->def_command2_reg, SLINK_COMMAND2); 914 tegra_slink_writel(tspi, tspi->def_command2_reg, SLINK_COMMAND2);
915 pm_runtime_put(tspi->dev);
916done:
924 msg->status = ret; 917 msg->status = ret;
925 spi_finalize_current_message(master); 918 spi_finalize_current_message(master);
926 return ret; 919 return ret;
@@ -1148,9 +1141,7 @@ static int tegra_slink_probe(struct platform_device *pdev)
1148 /* the spi->mode bits understood by this driver: */ 1141 /* the spi->mode bits understood by this driver: */
1149 master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH; 1142 master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH;
1150 master->setup = tegra_slink_setup; 1143 master->setup = tegra_slink_setup;
1151 master->prepare_transfer_hardware = tegra_slink_prepare_transfer;
1152 master->transfer_one_message = tegra_slink_transfer_one_message; 1144 master->transfer_one_message = tegra_slink_transfer_one_message;
1153 master->unprepare_transfer_hardware = tegra_slink_unprepare_transfer;
1154 master->num_chipselect = MAX_CHIP_SELECT; 1145 master->num_chipselect = MAX_CHIP_SELECT;
1155 master->bus_num = -1; 1146 master->bus_num = -1;
1156 1147
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index f996c600eb8c..004b10f184d4 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -543,17 +543,16 @@ static void spi_pump_messages(struct kthread_work *work)
543 /* Lock queue and check for queue work */ 543 /* Lock queue and check for queue work */
544 spin_lock_irqsave(&master->queue_lock, flags); 544 spin_lock_irqsave(&master->queue_lock, flags);
545 if (list_empty(&master->queue) || !master->running) { 545 if (list_empty(&master->queue) || !master->running) {
546 if (master->busy && master->unprepare_transfer_hardware) { 546 if (!master->busy) {
547 ret = master->unprepare_transfer_hardware(master); 547 spin_unlock_irqrestore(&master->queue_lock, flags);
548 if (ret) { 548 return;
549 spin_unlock_irqrestore(&master->queue_lock, flags);
550 dev_err(&master->dev,
551 "failed to unprepare transfer hardware\n");
552 return;
553 }
554 } 549 }
555 master->busy = false; 550 master->busy = false;
556 spin_unlock_irqrestore(&master->queue_lock, flags); 551 spin_unlock_irqrestore(&master->queue_lock, flags);
552 if (master->unprepare_transfer_hardware &&
553 master->unprepare_transfer_hardware(master))
554 dev_err(&master->dev,
555 "failed to unprepare transfer hardware\n");
557 return; 556 return;
558 } 557 }
559 558
@@ -984,7 +983,7 @@ static void acpi_register_spi_devices(struct spi_master *master)
984 acpi_status status; 983 acpi_status status;
985 acpi_handle handle; 984 acpi_handle handle;
986 985
987 handle = ACPI_HANDLE(&master->dev); 986 handle = ACPI_HANDLE(master->dev.parent);
988 if (!handle) 987 if (!handle)
989 return; 988 return;
990 989
diff --git a/drivers/usb/core/port.c b/drivers/usb/core/port.c
index 797f9d514732..65d4e55552c6 100644
--- a/drivers/usb/core/port.c
+++ b/drivers/usb/core/port.c
@@ -67,7 +67,6 @@ static void usb_port_device_release(struct device *dev)
67{ 67{
68 struct usb_port *port_dev = to_usb_port(dev); 68 struct usb_port *port_dev = to_usb_port(dev);
69 69
70 dev_pm_qos_hide_flags(dev);
71 kfree(port_dev); 70 kfree(port_dev);
72} 71}
73 72
diff --git a/drivers/video/fbmon.c b/drivers/video/fbmon.c
index 94ad0f71383c..7f6709991a5c 100644
--- a/drivers/video/fbmon.c
+++ b/drivers/video/fbmon.c
@@ -1400,7 +1400,7 @@ int fb_videomode_from_videomode(const struct videomode *vm,
1400 fbmode->vmode = 0; 1400 fbmode->vmode = 0;
1401 if (vm->dmt_flags & VESA_DMT_HSYNC_HIGH) 1401 if (vm->dmt_flags & VESA_DMT_HSYNC_HIGH)
1402 fbmode->sync |= FB_SYNC_HOR_HIGH_ACT; 1402 fbmode->sync |= FB_SYNC_HOR_HIGH_ACT;
1403 if (vm->dmt_flags & VESA_DMT_HSYNC_HIGH) 1403 if (vm->dmt_flags & VESA_DMT_VSYNC_HIGH)
1404 fbmode->sync |= FB_SYNC_VERT_HIGH_ACT; 1404 fbmode->sync |= FB_SYNC_VERT_HIGH_ACT;
1405 if (vm->data_flags & DISPLAY_FLAGS_INTERLACED) 1405 if (vm->data_flags & DISPLAY_FLAGS_INTERLACED)
1406 fbmode->vmode |= FB_VMODE_INTERLACED; 1406 fbmode->vmode |= FB_VMODE_INTERLACED;
diff --git a/drivers/video/uvesafb.c b/drivers/video/uvesafb.c
index b75db0186488..d4284458377e 100644
--- a/drivers/video/uvesafb.c
+++ b/drivers/video/uvesafb.c
@@ -1973,7 +1973,8 @@ static int uvesafb_init(void)
1973 err = -ENOMEM; 1973 err = -ENOMEM;
1974 1974
1975 if (err) { 1975 if (err) {
1976 platform_device_put(uvesafb_device); 1976 if (uvesafb_device)
1977 platform_device_put(uvesafb_device);
1977 platform_driver_unregister(&uvesafb_driver); 1978 platform_driver_unregister(&uvesafb_driver);
1978 cn_del_callback(&uvesafb_cn_id); 1979 cn_del_callback(&uvesafb_cn_id);
1979 return err; 1980 return err;
diff --git a/firmware/Makefile b/firmware/Makefile
index 5d8ee1319b5c..cbb09ce9730a 100644
--- a/firmware/Makefile
+++ b/firmware/Makefile
@@ -82,7 +82,7 @@ fw-shipped-$(CONFIG_SCSI_ADVANSYS) += advansys/mcode.bin advansys/38C1600.bin \
82fw-shipped-$(CONFIG_SCSI_QLOGIC_1280) += qlogic/1040.bin qlogic/1280.bin \ 82fw-shipped-$(CONFIG_SCSI_QLOGIC_1280) += qlogic/1040.bin qlogic/1280.bin \
83 qlogic/12160.bin 83 qlogic/12160.bin
84fw-shipped-$(CONFIG_SCSI_QLOGICPTI) += qlogic/isp1000.bin 84fw-shipped-$(CONFIG_SCSI_QLOGICPTI) += qlogic/isp1000.bin
85fw-shipped-$(CONFIG_INFINIBAND_QIB) += intel/sd7220.fw 85fw-shipped-$(CONFIG_INFINIBAND_QIB) += qlogic/sd7220.fw
86fw-shipped-$(CONFIG_SND_KORG1212) += korg/k1212.dsp 86fw-shipped-$(CONFIG_SND_KORG1212) += korg/k1212.dsp
87fw-shipped-$(CONFIG_SND_MAESTRO3) += ess/maestro3_assp_kernel.fw \ 87fw-shipped-$(CONFIG_SND_MAESTRO3) += ess/maestro3_assp_kernel.fw \
88 ess/maestro3_assp_minisrc.fw 88 ess/maestro3_assp_minisrc.fw
diff --git a/firmware/intel/sd7220.fw.ihex b/firmware/qlogic/sd7220.fw.ihex
index a33636319112..a33636319112 100644
--- a/firmware/intel/sd7220.fw.ihex
+++ b/firmware/qlogic/sd7220.fw.ihex
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 56efcaadf848..9c6d06dcef8b 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -2999,20 +2999,23 @@ static int ext4_split_extent_at(handle_t *handle,
2999 if (split_flag & EXT4_EXT_DATA_VALID1) { 2999 if (split_flag & EXT4_EXT_DATA_VALID1) {
3000 err = ext4_ext_zeroout(inode, ex2); 3000 err = ext4_ext_zeroout(inode, ex2);
3001 zero_ex.ee_block = ex2->ee_block; 3001 zero_ex.ee_block = ex2->ee_block;
3002 zero_ex.ee_len = ext4_ext_get_actual_len(ex2); 3002 zero_ex.ee_len = cpu_to_le16(
3003 ext4_ext_get_actual_len(ex2));
3003 ext4_ext_store_pblock(&zero_ex, 3004 ext4_ext_store_pblock(&zero_ex,
3004 ext4_ext_pblock(ex2)); 3005 ext4_ext_pblock(ex2));
3005 } else { 3006 } else {
3006 err = ext4_ext_zeroout(inode, ex); 3007 err = ext4_ext_zeroout(inode, ex);
3007 zero_ex.ee_block = ex->ee_block; 3008 zero_ex.ee_block = ex->ee_block;
3008 zero_ex.ee_len = ext4_ext_get_actual_len(ex); 3009 zero_ex.ee_len = cpu_to_le16(
3010 ext4_ext_get_actual_len(ex));
3009 ext4_ext_store_pblock(&zero_ex, 3011 ext4_ext_store_pblock(&zero_ex,
3010 ext4_ext_pblock(ex)); 3012 ext4_ext_pblock(ex));
3011 } 3013 }
3012 } else { 3014 } else {
3013 err = ext4_ext_zeroout(inode, &orig_ex); 3015 err = ext4_ext_zeroout(inode, &orig_ex);
3014 zero_ex.ee_block = orig_ex.ee_block; 3016 zero_ex.ee_block = orig_ex.ee_block;
3015 zero_ex.ee_len = ext4_ext_get_actual_len(&orig_ex); 3017 zero_ex.ee_len = cpu_to_le16(
3018 ext4_ext_get_actual_len(&orig_ex));
3016 ext4_ext_store_pblock(&zero_ex, 3019 ext4_ext_store_pblock(&zero_ex,
3017 ext4_ext_pblock(&orig_ex)); 3020 ext4_ext_pblock(&orig_ex));
3018 } 3021 }
@@ -3272,7 +3275,7 @@ static int ext4_ext_convert_to_initialized(handle_t *handle,
3272 if (err) 3275 if (err)
3273 goto out; 3276 goto out;
3274 zero_ex.ee_block = ex->ee_block; 3277 zero_ex.ee_block = ex->ee_block;
3275 zero_ex.ee_len = ext4_ext_get_actual_len(ex); 3278 zero_ex.ee_len = cpu_to_le16(ext4_ext_get_actual_len(ex));
3276 ext4_ext_store_pblock(&zero_ex, ext4_ext_pblock(ex)); 3279 ext4_ext_store_pblock(&zero_ex, ext4_ext_pblock(ex));
3277 3280
3278 err = ext4_ext_get_access(handle, inode, path + depth); 3281 err = ext4_ext_get_access(handle, inode, path + depth);
diff --git a/fs/ext4/indirect.c b/fs/ext4/indirect.c
index b505a145a593..a04183127ef0 100644
--- a/fs/ext4/indirect.c
+++ b/fs/ext4/indirect.c
@@ -1539,9 +1539,9 @@ static int free_hole_blocks(handle_t *handle, struct inode *inode,
1539 blk = *i_data; 1539 blk = *i_data;
1540 if (level > 0) { 1540 if (level > 0) {
1541 ext4_lblk_t first2; 1541 ext4_lblk_t first2;
1542 bh = sb_bread(inode->i_sb, blk); 1542 bh = sb_bread(inode->i_sb, le32_to_cpu(blk));
1543 if (!bh) { 1543 if (!bh) {
1544 EXT4_ERROR_INODE_BLOCK(inode, blk, 1544 EXT4_ERROR_INODE_BLOCK(inode, le32_to_cpu(blk),
1545 "Read failure"); 1545 "Read failure");
1546 return -EIO; 1546 return -EIO;
1547 } 1547 }
diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c
index 019f45e45097..d79c2dadc536 100644
--- a/fs/gfs2/file.c
+++ b/fs/gfs2/file.c
@@ -923,8 +923,11 @@ static int gfs2_lock(struct file *file, int cmd, struct file_lock *fl)
923 cmd = F_SETLK; 923 cmd = F_SETLK;
924 fl->fl_type = F_UNLCK; 924 fl->fl_type = F_UNLCK;
925 } 925 }
926 if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) 926 if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) {
927 if (fl->fl_type == F_UNLCK)
928 posix_lock_file_wait(file, fl);
927 return -EIO; 929 return -EIO;
930 }
928 if (IS_GETLK(cmd)) 931 if (IS_GETLK(cmd))
929 return dlm_posix_get(ls->ls_dlm, ip->i_no_addr, file, fl); 932 return dlm_posix_get(ls->ls_dlm, ip->i_no_addr, file, fl);
930 else if (fl->fl_type == F_UNLCK) 933 else if (fl->fl_type == F_UNLCK)
diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h
index 156e42ec84ea..5c29216e9cc1 100644
--- a/fs/gfs2/incore.h
+++ b/fs/gfs2/incore.h
@@ -588,6 +588,7 @@ struct lm_lockstruct {
588 struct dlm_lksb ls_control_lksb; /* control_lock */ 588 struct dlm_lksb ls_control_lksb; /* control_lock */
589 char ls_control_lvb[GDLM_LVB_SIZE]; /* control_lock lvb */ 589 char ls_control_lvb[GDLM_LVB_SIZE]; /* control_lock lvb */
590 struct completion ls_sync_wait; /* {control,mounted}_{lock,unlock} */ 590 struct completion ls_sync_wait; /* {control,mounted}_{lock,unlock} */
591 char *ls_lvb_bits;
591 592
592 spinlock_t ls_recover_spin; /* protects following fields */ 593 spinlock_t ls_recover_spin; /* protects following fields */
593 unsigned long ls_recover_flags; /* DFL_ */ 594 unsigned long ls_recover_flags; /* DFL_ */
diff --git a/fs/gfs2/lock_dlm.c b/fs/gfs2/lock_dlm.c
index 9802de0f85e6..c8423d6de6c3 100644
--- a/fs/gfs2/lock_dlm.c
+++ b/fs/gfs2/lock_dlm.c
@@ -483,12 +483,8 @@ static void control_lvb_write(struct lm_lockstruct *ls, uint32_t lvb_gen,
483 483
484static int all_jid_bits_clear(char *lvb) 484static int all_jid_bits_clear(char *lvb)
485{ 485{
486 int i; 486 return !memchr_inv(lvb + JID_BITMAP_OFFSET, 0,
487 for (i = JID_BITMAP_OFFSET; i < GDLM_LVB_SIZE; i++) { 487 GDLM_LVB_SIZE - JID_BITMAP_OFFSET);
488 if (lvb[i])
489 return 0;
490 }
491 return 1;
492} 488}
493 489
494static void sync_wait_cb(void *arg) 490static void sync_wait_cb(void *arg)
@@ -580,7 +576,6 @@ static void gfs2_control_func(struct work_struct *work)
580{ 576{
581 struct gfs2_sbd *sdp = container_of(work, struct gfs2_sbd, sd_control_work.work); 577 struct gfs2_sbd *sdp = container_of(work, struct gfs2_sbd, sd_control_work.work);
582 struct lm_lockstruct *ls = &sdp->sd_lockstruct; 578 struct lm_lockstruct *ls = &sdp->sd_lockstruct;
583 char lvb_bits[GDLM_LVB_SIZE];
584 uint32_t block_gen, start_gen, lvb_gen, flags; 579 uint32_t block_gen, start_gen, lvb_gen, flags;
585 int recover_set = 0; 580 int recover_set = 0;
586 int write_lvb = 0; 581 int write_lvb = 0;
@@ -634,7 +629,7 @@ static void gfs2_control_func(struct work_struct *work)
634 return; 629 return;
635 } 630 }
636 631
637 control_lvb_read(ls, &lvb_gen, lvb_bits); 632 control_lvb_read(ls, &lvb_gen, ls->ls_lvb_bits);
638 633
639 spin_lock(&ls->ls_recover_spin); 634 spin_lock(&ls->ls_recover_spin);
640 if (block_gen != ls->ls_recover_block || 635 if (block_gen != ls->ls_recover_block ||
@@ -664,10 +659,10 @@ static void gfs2_control_func(struct work_struct *work)
664 659
665 ls->ls_recover_result[i] = 0; 660 ls->ls_recover_result[i] = 0;
666 661
667 if (!test_bit_le(i, lvb_bits + JID_BITMAP_OFFSET)) 662 if (!test_bit_le(i, ls->ls_lvb_bits + JID_BITMAP_OFFSET))
668 continue; 663 continue;
669 664
670 __clear_bit_le(i, lvb_bits + JID_BITMAP_OFFSET); 665 __clear_bit_le(i, ls->ls_lvb_bits + JID_BITMAP_OFFSET);
671 write_lvb = 1; 666 write_lvb = 1;
672 } 667 }
673 } 668 }
@@ -691,7 +686,7 @@ static void gfs2_control_func(struct work_struct *work)
691 continue; 686 continue;
692 if (ls->ls_recover_submit[i] < start_gen) { 687 if (ls->ls_recover_submit[i] < start_gen) {
693 ls->ls_recover_submit[i] = 0; 688 ls->ls_recover_submit[i] = 0;
694 __set_bit_le(i, lvb_bits + JID_BITMAP_OFFSET); 689 __set_bit_le(i, ls->ls_lvb_bits + JID_BITMAP_OFFSET);
695 } 690 }
696 } 691 }
697 /* even if there are no bits to set, we need to write the 692 /* even if there are no bits to set, we need to write the
@@ -705,7 +700,7 @@ static void gfs2_control_func(struct work_struct *work)
705 spin_unlock(&ls->ls_recover_spin); 700 spin_unlock(&ls->ls_recover_spin);
706 701
707 if (write_lvb) { 702 if (write_lvb) {
708 control_lvb_write(ls, start_gen, lvb_bits); 703 control_lvb_write(ls, start_gen, ls->ls_lvb_bits);
709 flags = DLM_LKF_CONVERT | DLM_LKF_VALBLK; 704 flags = DLM_LKF_CONVERT | DLM_LKF_VALBLK;
710 } else { 705 } else {
711 flags = DLM_LKF_CONVERT; 706 flags = DLM_LKF_CONVERT;
@@ -725,7 +720,7 @@ static void gfs2_control_func(struct work_struct *work)
725 */ 720 */
726 721
727 for (i = 0; i < recover_size; i++) { 722 for (i = 0; i < recover_size; i++) {
728 if (test_bit_le(i, lvb_bits + JID_BITMAP_OFFSET)) { 723 if (test_bit_le(i, ls->ls_lvb_bits + JID_BITMAP_OFFSET)) {
729 fs_info(sdp, "recover generation %u jid %d\n", 724 fs_info(sdp, "recover generation %u jid %d\n",
730 start_gen, i); 725 start_gen, i);
731 gfs2_recover_set(sdp, i); 726 gfs2_recover_set(sdp, i);
@@ -758,7 +753,6 @@ static void gfs2_control_func(struct work_struct *work)
758static int control_mount(struct gfs2_sbd *sdp) 753static int control_mount(struct gfs2_sbd *sdp)
759{ 754{
760 struct lm_lockstruct *ls = &sdp->sd_lockstruct; 755 struct lm_lockstruct *ls = &sdp->sd_lockstruct;
761 char lvb_bits[GDLM_LVB_SIZE];
762 uint32_t start_gen, block_gen, mount_gen, lvb_gen; 756 uint32_t start_gen, block_gen, mount_gen, lvb_gen;
763 int mounted_mode; 757 int mounted_mode;
764 int retries = 0; 758 int retries = 0;
@@ -857,7 +851,7 @@ locks_done:
857 * lvb_gen will be non-zero. 851 * lvb_gen will be non-zero.
858 */ 852 */
859 853
860 control_lvb_read(ls, &lvb_gen, lvb_bits); 854 control_lvb_read(ls, &lvb_gen, ls->ls_lvb_bits);
861 855
862 if (lvb_gen == 0xFFFFFFFF) { 856 if (lvb_gen == 0xFFFFFFFF) {
863 /* special value to force mount attempts to fail */ 857 /* special value to force mount attempts to fail */
@@ -887,7 +881,7 @@ locks_done:
887 * and all lvb bits to be clear (no pending journal recoveries.) 881 * and all lvb bits to be clear (no pending journal recoveries.)
888 */ 882 */
889 883
890 if (!all_jid_bits_clear(lvb_bits)) { 884 if (!all_jid_bits_clear(ls->ls_lvb_bits)) {
891 /* journals need recovery, wait until all are clear */ 885 /* journals need recovery, wait until all are clear */
892 fs_info(sdp, "control_mount wait for journal recovery\n"); 886 fs_info(sdp, "control_mount wait for journal recovery\n");
893 goto restart; 887 goto restart;
@@ -949,7 +943,6 @@ static int dlm_recovery_wait(void *word)
949static int control_first_done(struct gfs2_sbd *sdp) 943static int control_first_done(struct gfs2_sbd *sdp)
950{ 944{
951 struct lm_lockstruct *ls = &sdp->sd_lockstruct; 945 struct lm_lockstruct *ls = &sdp->sd_lockstruct;
952 char lvb_bits[GDLM_LVB_SIZE];
953 uint32_t start_gen, block_gen; 946 uint32_t start_gen, block_gen;
954 int error; 947 int error;
955 948
@@ -991,8 +984,8 @@ restart:
991 memset(ls->ls_recover_result, 0, ls->ls_recover_size*sizeof(uint32_t)); 984 memset(ls->ls_recover_result, 0, ls->ls_recover_size*sizeof(uint32_t));
992 spin_unlock(&ls->ls_recover_spin); 985 spin_unlock(&ls->ls_recover_spin);
993 986
994 memset(lvb_bits, 0, sizeof(lvb_bits)); 987 memset(ls->ls_lvb_bits, 0, GDLM_LVB_SIZE);
995 control_lvb_write(ls, start_gen, lvb_bits); 988 control_lvb_write(ls, start_gen, ls->ls_lvb_bits);
996 989
997 error = mounted_lock(sdp, DLM_LOCK_PR, DLM_LKF_CONVERT); 990 error = mounted_lock(sdp, DLM_LOCK_PR, DLM_LKF_CONVERT);
998 if (error) 991 if (error)
@@ -1022,6 +1015,12 @@ static int set_recover_size(struct gfs2_sbd *sdp, struct dlm_slot *slots,
1022 uint32_t old_size, new_size; 1015 uint32_t old_size, new_size;
1023 int i, max_jid; 1016 int i, max_jid;
1024 1017
1018 if (!ls->ls_lvb_bits) {
1019 ls->ls_lvb_bits = kzalloc(GDLM_LVB_SIZE, GFP_NOFS);
1020 if (!ls->ls_lvb_bits)
1021 return -ENOMEM;
1022 }
1023
1025 max_jid = 0; 1024 max_jid = 0;
1026 for (i = 0; i < num_slots; i++) { 1025 for (i = 0; i < num_slots; i++) {
1027 if (max_jid < slots[i].slot - 1) 1026 if (max_jid < slots[i].slot - 1)
@@ -1057,6 +1056,7 @@ static int set_recover_size(struct gfs2_sbd *sdp, struct dlm_slot *slots,
1057 1056
1058static void free_recover_size(struct lm_lockstruct *ls) 1057static void free_recover_size(struct lm_lockstruct *ls)
1059{ 1058{
1059 kfree(ls->ls_lvb_bits);
1060 kfree(ls->ls_recover_submit); 1060 kfree(ls->ls_recover_submit);
1061 kfree(ls->ls_recover_result); 1061 kfree(ls->ls_recover_result);
1062 ls->ls_recover_submit = NULL; 1062 ls->ls_recover_submit = NULL;
@@ -1205,6 +1205,7 @@ static int gdlm_mount(struct gfs2_sbd *sdp, const char *table)
1205 ls->ls_recover_size = 0; 1205 ls->ls_recover_size = 0;
1206 ls->ls_recover_submit = NULL; 1206 ls->ls_recover_submit = NULL;
1207 ls->ls_recover_result = NULL; 1207 ls->ls_recover_result = NULL;
1208 ls->ls_lvb_bits = NULL;
1208 1209
1209 error = set_recover_size(sdp, NULL, 0); 1210 error = set_recover_size(sdp, NULL, 0);
1210 if (error) 1211 if (error)
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
index d1f51fd73f86..5a51265a4341 100644
--- a/fs/gfs2/rgrp.c
+++ b/fs/gfs2/rgrp.c
@@ -576,7 +576,7 @@ int gfs2_rs_alloc(struct gfs2_inode *ip)
576 RB_CLEAR_NODE(&ip->i_res->rs_node); 576 RB_CLEAR_NODE(&ip->i_res->rs_node);
577out: 577out:
578 up_write(&ip->i_rw_mutex); 578 up_write(&ip->i_rw_mutex);
579 return 0; 579 return error;
580} 580}
581 581
582static void dump_rs(struct seq_file *seq, const struct gfs2_blkreserv *rs) 582static void dump_rs(struct seq_file *seq, const struct gfs2_blkreserv *rs)
@@ -1181,12 +1181,9 @@ int gfs2_rgrp_send_discards(struct gfs2_sbd *sdp, u64 offset,
1181 const struct gfs2_bitmap *bi, unsigned minlen, u64 *ptrimmed) 1181 const struct gfs2_bitmap *bi, unsigned minlen, u64 *ptrimmed)
1182{ 1182{
1183 struct super_block *sb = sdp->sd_vfs; 1183 struct super_block *sb = sdp->sd_vfs;
1184 struct block_device *bdev = sb->s_bdev;
1185 const unsigned int sects_per_blk = sdp->sd_sb.sb_bsize /
1186 bdev_logical_block_size(sb->s_bdev);
1187 u64 blk; 1184 u64 blk;
1188 sector_t start = 0; 1185 sector_t start = 0;
1189 sector_t nr_sects = 0; 1186 sector_t nr_blks = 0;
1190 int rv; 1187 int rv;
1191 unsigned int x; 1188 unsigned int x;
1192 u32 trimmed = 0; 1189 u32 trimmed = 0;
@@ -1206,35 +1203,34 @@ int gfs2_rgrp_send_discards(struct gfs2_sbd *sdp, u64 offset,
1206 if (diff == 0) 1203 if (diff == 0)
1207 continue; 1204 continue;
1208 blk = offset + ((bi->bi_start + x) * GFS2_NBBY); 1205 blk = offset + ((bi->bi_start + x) * GFS2_NBBY);
1209 blk *= sects_per_blk; /* convert to sectors */
1210 while(diff) { 1206 while(diff) {
1211 if (diff & 1) { 1207 if (diff & 1) {
1212 if (nr_sects == 0) 1208 if (nr_blks == 0)
1213 goto start_new_extent; 1209 goto start_new_extent;
1214 if ((start + nr_sects) != blk) { 1210 if ((start + nr_blks) != blk) {
1215 if (nr_sects >= minlen) { 1211 if (nr_blks >= minlen) {
1216 rv = blkdev_issue_discard(bdev, 1212 rv = sb_issue_discard(sb,
1217 start, nr_sects, 1213 start, nr_blks,
1218 GFP_NOFS, 0); 1214 GFP_NOFS, 0);
1219 if (rv) 1215 if (rv)
1220 goto fail; 1216 goto fail;
1221 trimmed += nr_sects; 1217 trimmed += nr_blks;
1222 } 1218 }
1223 nr_sects = 0; 1219 nr_blks = 0;
1224start_new_extent: 1220start_new_extent:
1225 start = blk; 1221 start = blk;
1226 } 1222 }
1227 nr_sects += sects_per_blk; 1223 nr_blks++;
1228 } 1224 }
1229 diff >>= 2; 1225 diff >>= 2;
1230 blk += sects_per_blk; 1226 blk++;
1231 } 1227 }
1232 } 1228 }
1233 if (nr_sects >= minlen) { 1229 if (nr_blks >= minlen) {
1234 rv = blkdev_issue_discard(bdev, start, nr_sects, GFP_NOFS, 0); 1230 rv = sb_issue_discard(sb, start, nr_blks, GFP_NOFS, 0);
1235 if (rv) 1231 if (rv)
1236 goto fail; 1232 goto fail;
1237 trimmed += nr_sects; 1233 trimmed += nr_blks;
1238 } 1234 }
1239 if (ptrimmed) 1235 if (ptrimmed)
1240 *ptrimmed = trimmed; 1236 *ptrimmed = trimmed;
diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c
index c196369fe408..4cce1d9552fb 100644
--- a/fs/reiserfs/xattr.c
+++ b/fs/reiserfs/xattr.c
@@ -187,8 +187,8 @@ fill_with_dentries(void *buf, const char *name, int namelen, loff_t offset,
187 if (dbuf->count == ARRAY_SIZE(dbuf->dentries)) 187 if (dbuf->count == ARRAY_SIZE(dbuf->dentries))
188 return -ENOSPC; 188 return -ENOSPC;
189 189
190 if (name[0] == '.' && (name[1] == '\0' || 190 if (name[0] == '.' && (namelen < 2 ||
191 (name[1] == '.' && name[2] == '\0'))) 191 (namelen == 2 && name[1] == '.')))
192 return 0; 192 return 0;
193 193
194 dentry = lookup_one_len(name, dbuf->xadir, namelen); 194 dentry = lookup_one_len(name, dbuf->xadir, namelen);
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index ac838b844936..f21acf0ef01f 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -1568,6 +1568,12 @@ static int ubifs_remount_rw(struct ubifs_info *c)
1568 c->remounting_rw = 1; 1568 c->remounting_rw = 1;
1569 c->ro_mount = 0; 1569 c->ro_mount = 0;
1570 1570
1571 if (c->space_fixup) {
1572 err = ubifs_fixup_free_space(c);
1573 if (err)
1574 return err;
1575 }
1576
1571 err = check_free_space(c); 1577 err = check_free_space(c);
1572 if (err) 1578 if (err)
1573 goto out; 1579 goto out;
@@ -1684,12 +1690,6 @@ static int ubifs_remount_rw(struct ubifs_info *c)
1684 err = dbg_check_space_info(c); 1690 err = dbg_check_space_info(c);
1685 } 1691 }
1686 1692
1687 if (c->space_fixup) {
1688 err = ubifs_fixup_free_space(c);
1689 if (err)
1690 goto out;
1691 }
1692
1693 mutex_unlock(&c->umount_mutex); 1693 mutex_unlock(&c->umount_mutex);
1694 return err; 1694 return err;
1695 1695
diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h
index e83ef39b3bea..fe8c4476f7e4 100644
--- a/include/linux/devfreq.h
+++ b/include/linux/devfreq.h
@@ -213,7 +213,7 @@ struct devfreq_simple_ondemand_data {
213#endif 213#endif
214 214
215#else /* !CONFIG_PM_DEVFREQ */ 215#else /* !CONFIG_PM_DEVFREQ */
216static struct devfreq *devfreq_add_device(struct device *dev, 216static inline struct devfreq *devfreq_add_device(struct device *dev,
217 struct devfreq_dev_profile *profile, 217 struct devfreq_dev_profile *profile,
218 const char *governor_name, 218 const char *governor_name,
219 void *data) 219 void *data)
@@ -221,34 +221,34 @@ static struct devfreq *devfreq_add_device(struct device *dev,
221 return NULL; 221 return NULL;
222} 222}
223 223
224static int devfreq_remove_device(struct devfreq *devfreq) 224static inline int devfreq_remove_device(struct devfreq *devfreq)
225{ 225{
226 return 0; 226 return 0;
227} 227}
228 228
229static int devfreq_suspend_device(struct devfreq *devfreq) 229static inline int devfreq_suspend_device(struct devfreq *devfreq)
230{ 230{
231 return 0; 231 return 0;
232} 232}
233 233
234static int devfreq_resume_device(struct devfreq *devfreq) 234static inline int devfreq_resume_device(struct devfreq *devfreq)
235{ 235{
236 return 0; 236 return 0;
237} 237}
238 238
239static struct opp *devfreq_recommended_opp(struct device *dev, 239static inline struct opp *devfreq_recommended_opp(struct device *dev,
240 unsigned long *freq, u32 flags) 240 unsigned long *freq, u32 flags)
241{ 241{
242 return -EINVAL; 242 return ERR_PTR(-EINVAL);
243} 243}
244 244
245static int devfreq_register_opp_notifier(struct device *dev, 245static inline int devfreq_register_opp_notifier(struct device *dev,
246 struct devfreq *devfreq) 246 struct devfreq *devfreq)
247{ 247{
248 return -EINVAL; 248 return -EINVAL;
249} 249}
250 250
251static int devfreq_unregister_opp_notifier(struct device *dev, 251static inline int devfreq_unregister_opp_notifier(struct device *dev,
252 struct devfreq *devfreq) 252 struct devfreq *devfreq)
253{ 253{
254 return -EINVAL; 254 return -EINVAL;
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index a302f7f01f86..53d3939358a7 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -208,9 +208,9 @@ struct netdev_hw_addr {
208#define NETDEV_HW_ADDR_T_SLAVE 3 208#define NETDEV_HW_ADDR_T_SLAVE 3
209#define NETDEV_HW_ADDR_T_UNICAST 4 209#define NETDEV_HW_ADDR_T_UNICAST 4
210#define NETDEV_HW_ADDR_T_MULTICAST 5 210#define NETDEV_HW_ADDR_T_MULTICAST 5
211 bool synced;
212 bool global_use; 211 bool global_use;
213 int refcount; 212 int refcount;
213 int synced;
214 struct rcu_head rcu_head; 214 struct rcu_head rcu_head;
215}; 215};
216 216
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 364e2440a7ee..e27d1c782f32 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -2726,6 +2726,13 @@ static inline void nf_reset(struct sk_buff *skb)
2726#endif 2726#endif
2727} 2727}
2728 2728
2729static inline void nf_reset_trace(struct sk_buff *skb)
2730{
2731#if IS_ENABLED(CONFIG_NETFILTER_XT_TARGET_TRACE)
2732 skb->nf_trace = 0;
2733#endif
2734}
2735
2729/* Note: This doesn't put any conntrack and bridge info in dst. */ 2736/* Note: This doesn't put any conntrack and bridge info in dst. */
2730static inline void __nf_copy(struct sk_buff *dst, const struct sk_buff *src) 2737static inline void __nf_copy(struct sk_buff *dst, const struct sk_buff *src)
2731{ 2738{
diff --git a/include/sound/max98090.h b/include/sound/max98090.h
index 95efb13f8478..95efb13f8478 100755..100644
--- a/include/sound/max98090.h
+++ b/include/sound/max98090.h
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index e1ef63d4a5c4..44a30b108683 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -488,6 +488,7 @@ struct snd_soc_dapm_path {
488 /* status */ 488 /* status */
489 u32 connect:1; /* source and sink widgets are connected */ 489 u32 connect:1; /* source and sink widgets are connected */
490 u32 walked:1; /* path has been walked */ 490 u32 walked:1; /* path has been walked */
491 u32 walking:1; /* path is in the process of being walked */
491 u32 weak:1; /* path ignored for power management */ 492 u32 weak:1; /* path ignored for power management */
492 493
493 int (*connected)(struct snd_soc_dapm_widget *source, 494 int (*connected)(struct snd_soc_dapm_widget *source,
diff --git a/mm/mmap.c b/mm/mmap.c
index 6466699b16cb..0db0de1c2fbe 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1940,7 +1940,7 @@ struct vm_area_struct *find_vma(struct mm_struct *mm, unsigned long addr)
1940 1940
1941 /* Check the cache first. */ 1941 /* Check the cache first. */
1942 /* (Cache hit rate is typically around 35%.) */ 1942 /* (Cache hit rate is typically around 35%.) */
1943 vma = mm->mmap_cache; 1943 vma = ACCESS_ONCE(mm->mmap_cache);
1944 if (!(vma && vma->vm_end > addr && vma->vm_start <= addr)) { 1944 if (!(vma && vma->vm_end > addr && vma->vm_start <= addr)) {
1945 struct rb_node *rb_node; 1945 struct rb_node *rb_node;
1946 1946
diff --git a/mm/nommu.c b/mm/nommu.c
index e19328087534..2f3ea749c318 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -821,7 +821,7 @@ struct vm_area_struct *find_vma(struct mm_struct *mm, unsigned long addr)
821 struct vm_area_struct *vma; 821 struct vm_area_struct *vma;
822 822
823 /* check the cache first */ 823 /* check the cache first */
824 vma = mm->mmap_cache; 824 vma = ACCESS_ONCE(mm->mmap_cache);
825 if (vma && vma->vm_start <= addr && vma->vm_end > addr) 825 if (vma && vma->vm_start <= addr && vma->vm_end > addr)
826 return vma; 826 return vma;
827 827
diff --git a/net/atm/common.c b/net/atm/common.c
index 7b491006eaf4..737bef59ce89 100644
--- a/net/atm/common.c
+++ b/net/atm/common.c
@@ -531,6 +531,8 @@ int vcc_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg,
531 struct sk_buff *skb; 531 struct sk_buff *skb;
532 int copied, error = -EINVAL; 532 int copied, error = -EINVAL;
533 533
534 msg->msg_namelen = 0;
535
534 if (sock->state != SS_CONNECTED) 536 if (sock->state != SS_CONNECTED)
535 return -ENOTCONN; 537 return -ENOTCONN;
536 538
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
index 7b11f8bc5071..e277e38f736b 100644
--- a/net/ax25/af_ax25.c
+++ b/net/ax25/af_ax25.c
@@ -1642,6 +1642,7 @@ static int ax25_recvmsg(struct kiocb *iocb, struct socket *sock,
1642 ax25_address src; 1642 ax25_address src;
1643 const unsigned char *mac = skb_mac_header(skb); 1643 const unsigned char *mac = skb_mac_header(skb);
1644 1644
1645 memset(sax, 0, sizeof(struct full_sockaddr_ax25));
1645 ax25_addr_parse(mac + 1, skb->data - mac - 1, &src, NULL, 1646 ax25_addr_parse(mac + 1, skb->data - mac - 1, &src, NULL,
1646 &digi, NULL, NULL); 1647 &digi, NULL, NULL);
1647 sax->sax25_family = AF_AX25; 1648 sax->sax25_family = AF_AX25;
diff --git a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c
index fea778e1dc27..d5a973bf8a6f 100644
--- a/net/bluetooth/af_bluetooth.c
+++ b/net/bluetooth/af_bluetooth.c
@@ -230,6 +230,8 @@ int bt_sock_recvmsg(struct kiocb *iocb, struct socket *sock,
230 if (flags & (MSG_OOB)) 230 if (flags & (MSG_OOB))
231 return -EOPNOTSUPP; 231 return -EOPNOTSUPP;
232 232
233 msg->msg_namelen = 0;
234
233 skb = skb_recv_datagram(sk, flags, noblock, &err); 235 skb = skb_recv_datagram(sk, flags, noblock, &err);
234 if (!skb) { 236 if (!skb) {
235 if (sk->sk_shutdown & RCV_SHUTDOWN) 237 if (sk->sk_shutdown & RCV_SHUTDOWN)
@@ -237,8 +239,6 @@ int bt_sock_recvmsg(struct kiocb *iocb, struct socket *sock,
237 return err; 239 return err;
238 } 240 }
239 241
240 msg->msg_namelen = 0;
241
242 copied = skb->len; 242 copied = skb->len;
243 if (len < copied) { 243 if (len < copied) {
244 msg->msg_flags |= MSG_TRUNC; 244 msg->msg_flags |= MSG_TRUNC;
diff --git a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c
index c23bae86263b..7c9224bcce17 100644
--- a/net/bluetooth/rfcomm/sock.c
+++ b/net/bluetooth/rfcomm/sock.c
@@ -608,6 +608,7 @@ static int rfcomm_sock_recvmsg(struct kiocb *iocb, struct socket *sock,
608 608
609 if (test_and_clear_bit(RFCOMM_DEFER_SETUP, &d->flags)) { 609 if (test_and_clear_bit(RFCOMM_DEFER_SETUP, &d->flags)) {
610 rfcomm_dlc_accept(d); 610 rfcomm_dlc_accept(d);
611 msg->msg_namelen = 0;
611 return 0; 612 return 0;
612 } 613 }
613 614
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
index fad0302bdb32..fb6192c9812e 100644
--- a/net/bluetooth/sco.c
+++ b/net/bluetooth/sco.c
@@ -665,6 +665,7 @@ static int sco_sock_recvmsg(struct kiocb *iocb, struct socket *sock,
665 test_bit(BT_SK_DEFER_SETUP, &bt_sk(sk)->flags)) { 665 test_bit(BT_SK_DEFER_SETUP, &bt_sk(sk)->flags)) {
666 hci_conn_accept(pi->conn->hcon, 0); 666 hci_conn_accept(pi->conn->hcon, 0);
667 sk->sk_state = BT_CONFIG; 667 sk->sk_state = BT_CONFIG;
668 msg->msg_namelen = 0;
668 669
669 release_sock(sk); 670 release_sock(sk);
670 return 0; 671 return 0;
diff --git a/net/caif/caif_socket.c b/net/caif/caif_socket.c
index 1d337e02bc63..630b8be6e748 100644
--- a/net/caif/caif_socket.c
+++ b/net/caif/caif_socket.c
@@ -286,6 +286,8 @@ static int caif_seqpkt_recvmsg(struct kiocb *iocb, struct socket *sock,
286 if (m->msg_flags&MSG_OOB) 286 if (m->msg_flags&MSG_OOB)
287 goto read_error; 287 goto read_error;
288 288
289 m->msg_namelen = 0;
290
289 skb = skb_recv_datagram(sk, flags, 0 , &ret); 291 skb = skb_recv_datagram(sk, flags, 0 , &ret);
290 if (!skb) 292 if (!skb)
291 goto read_error; 293 goto read_error;
diff --git a/net/core/dev.c b/net/core/dev.c
index 63e25332924d..3655ff927315 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1639,6 +1639,7 @@ int dev_forward_skb(struct net_device *dev, struct sk_buff *skb)
1639 skb->mark = 0; 1639 skb->mark = 0;
1640 secpath_reset(skb); 1640 secpath_reset(skb);
1641 nf_reset(skb); 1641 nf_reset(skb);
1642 nf_reset_trace(skb);
1642 return netif_rx(skb); 1643 return netif_rx(skb);
1643} 1644}
1644EXPORT_SYMBOL_GPL(dev_forward_skb); 1645EXPORT_SYMBOL_GPL(dev_forward_skb);
diff --git a/net/core/dev_addr_lists.c b/net/core/dev_addr_lists.c
index bd2eb9d3e369..abdc9e6ef33e 100644
--- a/net/core/dev_addr_lists.c
+++ b/net/core/dev_addr_lists.c
@@ -37,7 +37,7 @@ static int __hw_addr_create_ex(struct netdev_hw_addr_list *list,
37 ha->type = addr_type; 37 ha->type = addr_type;
38 ha->refcount = 1; 38 ha->refcount = 1;
39 ha->global_use = global; 39 ha->global_use = global;
40 ha->synced = false; 40 ha->synced = 0;
41 list_add_tail_rcu(&ha->list, &list->list); 41 list_add_tail_rcu(&ha->list, &list->list);
42 list->count++; 42 list->count++;
43 43
@@ -165,7 +165,7 @@ int __hw_addr_sync(struct netdev_hw_addr_list *to_list,
165 addr_len, ha->type); 165 addr_len, ha->type);
166 if (err) 166 if (err)
167 break; 167 break;
168 ha->synced = true; 168 ha->synced++;
169 ha->refcount++; 169 ha->refcount++;
170 } else if (ha->refcount == 1) { 170 } else if (ha->refcount == 1) {
171 __hw_addr_del(to_list, ha->addr, addr_len, ha->type); 171 __hw_addr_del(to_list, ha->addr, addr_len, ha->type);
@@ -186,7 +186,7 @@ void __hw_addr_unsync(struct netdev_hw_addr_list *to_list,
186 if (ha->synced) { 186 if (ha->synced) {
187 __hw_addr_del(to_list, ha->addr, 187 __hw_addr_del(to_list, ha->addr,
188 addr_len, ha->type); 188 addr_len, ha->type);
189 ha->synced = false; 189 ha->synced--;
190 __hw_addr_del(from_list, ha->addr, 190 __hw_addr_del(from_list, ha->addr,
191 addr_len, ha->type); 191 addr_len, ha->type);
192 } 192 }
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 5d985e367535..2759dfd576ae 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -802,8 +802,10 @@ static int inet_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh)
802 if (nlh->nlmsg_flags & NLM_F_EXCL || 802 if (nlh->nlmsg_flags & NLM_F_EXCL ||
803 !(nlh->nlmsg_flags & NLM_F_REPLACE)) 803 !(nlh->nlmsg_flags & NLM_F_REPLACE))
804 return -EEXIST; 804 return -EEXIST;
805 805 ifa = ifa_existing;
806 set_ifa_lifetime(ifa_existing, valid_lft, prefered_lft); 806 set_ifa_lifetime(ifa, valid_lft, prefered_lft);
807 rtmsg_ifa(RTM_NEWADDR, ifa, nlh, NETLINK_CB(skb).portid);
808 blocking_notifier_call_chain(&inetaddr_chain, NETDEV_UP, ifa);
807 } 809 }
808 return 0; 810 return 0;
809} 811}
diff --git a/net/ipv6/netfilter/ip6t_NPT.c b/net/ipv6/netfilter/ip6t_NPT.c
index 938e0b7ea1bd..590f767db5d4 100644
--- a/net/ipv6/netfilter/ip6t_NPT.c
+++ b/net/ipv6/netfilter/ip6t_NPT.c
@@ -52,7 +52,7 @@ static bool ip6t_npt_map_pfx(const struct ip6t_npt_tginfo *npt,
52 if (pfx_len - i >= 32) 52 if (pfx_len - i >= 32)
53 mask = 0; 53 mask = 0;
54 else 54 else
55 mask = htonl(~((1 << (pfx_len - i)) - 1)); 55 mask = htonl((1 << (i - pfx_len + 32)) - 1);
56 56
57 idx = i / 32; 57 idx = i / 32;
58 addr->s6_addr32[idx] &= mask; 58 addr->s6_addr32[idx] &= mask;
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 1033d2b1d81e..e51bd1a58264 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -386,6 +386,7 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
386 386
387 if (dst) 387 if (dst)
388 dst->ops->redirect(dst, sk, skb); 388 dst->ops->redirect(dst, sk, skb);
389 goto out;
389 } 390 }
390 391
391 if (type == ICMPV6_PKT_TOOBIG) { 392 if (type == ICMPV6_PKT_TOOBIG) {
diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c
index d28e7f014cc6..e493b3397ae3 100644
--- a/net/irda/af_irda.c
+++ b/net/irda/af_irda.c
@@ -1386,6 +1386,8 @@ static int irda_recvmsg_dgram(struct kiocb *iocb, struct socket *sock,
1386 1386
1387 IRDA_DEBUG(4, "%s()\n", __func__); 1387 IRDA_DEBUG(4, "%s()\n", __func__);
1388 1388
1389 msg->msg_namelen = 0;
1390
1389 skb = skb_recv_datagram(sk, flags & ~MSG_DONTWAIT, 1391 skb = skb_recv_datagram(sk, flags & ~MSG_DONTWAIT,
1390 flags & MSG_DONTWAIT, &err); 1392 flags & MSG_DONTWAIT, &err);
1391 if (!skb) 1393 if (!skb)
diff --git a/net/iucv/af_iucv.c b/net/iucv/af_iucv.c
index 7dfb9ed93698..e165e8dc962e 100644
--- a/net/iucv/af_iucv.c
+++ b/net/iucv/af_iucv.c
@@ -1328,6 +1328,8 @@ static int iucv_sock_recvmsg(struct kiocb *iocb, struct socket *sock,
1328 struct sk_buff *skb, *rskb, *cskb; 1328 struct sk_buff *skb, *rskb, *cskb;
1329 int err = 0; 1329 int err = 0;
1330 1330
1331 msg->msg_namelen = 0;
1332
1331 if ((sk->sk_state == IUCV_DISCONN) && 1333 if ((sk->sk_state == IUCV_DISCONN) &&
1332 skb_queue_empty(&iucv->backlog_skb_q) && 1334 skb_queue_empty(&iucv->backlog_skb_q) &&
1333 skb_queue_empty(&sk->sk_receive_queue) && 1335 skb_queue_empty(&sk->sk_receive_queue) &&
diff --git a/net/l2tp/l2tp_ip6.c b/net/l2tp/l2tp_ip6.c
index c74f5a91ff6a..b8a6039314e8 100644
--- a/net/l2tp/l2tp_ip6.c
+++ b/net/l2tp/l2tp_ip6.c
@@ -690,6 +690,7 @@ static int l2tp_ip6_recvmsg(struct kiocb *iocb, struct sock *sk,
690 lsa->l2tp_addr = ipv6_hdr(skb)->saddr; 690 lsa->l2tp_addr = ipv6_hdr(skb)->saddr;
691 lsa->l2tp_flowinfo = 0; 691 lsa->l2tp_flowinfo = 0;
692 lsa->l2tp_scope_id = 0; 692 lsa->l2tp_scope_id = 0;
693 lsa->l2tp_conn_id = 0;
693 if (ipv6_addr_type(&lsa->l2tp_addr) & IPV6_ADDR_LINKLOCAL) 694 if (ipv6_addr_type(&lsa->l2tp_addr) & IPV6_ADDR_LINKLOCAL)
694 lsa->l2tp_scope_id = IP6CB(skb)->iif; 695 lsa->l2tp_scope_id = IP6CB(skb)->iif;
695 } 696 }
diff --git a/net/llc/af_llc.c b/net/llc/af_llc.c
index 88709882c464..48aaa89253e0 100644
--- a/net/llc/af_llc.c
+++ b/net/llc/af_llc.c
@@ -720,6 +720,8 @@ static int llc_ui_recvmsg(struct kiocb *iocb, struct socket *sock,
720 int target; /* Read at least this many bytes */ 720 int target; /* Read at least this many bytes */
721 long timeo; 721 long timeo;
722 722
723 msg->msg_namelen = 0;
724
723 lock_sock(sk); 725 lock_sock(sk);
724 copied = -ENOTCONN; 726 copied = -ENOTCONN;
725 if (unlikely(sk->sk_type == SOCK_STREAM && sk->sk_state == TCP_LISTEN)) 727 if (unlikely(sk->sk_type == SOCK_STREAM && sk->sk_state == TCP_LISTEN))
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 1d1ddabd89ca..c34e6d78a592 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -2636,7 +2636,7 @@ static int ieee80211_cancel_roc(struct ieee80211_local *local,
2636 list_del(&dep->list); 2636 list_del(&dep->list);
2637 mutex_unlock(&local->mtx); 2637 mutex_unlock(&local->mtx);
2638 2638
2639 ieee80211_roc_notify_destroy(dep); 2639 ieee80211_roc_notify_destroy(dep, true);
2640 return 0; 2640 return 0;
2641 } 2641 }
2642 2642
@@ -2676,7 +2676,7 @@ static int ieee80211_cancel_roc(struct ieee80211_local *local,
2676 ieee80211_start_next_roc(local); 2676 ieee80211_start_next_roc(local);
2677 mutex_unlock(&local->mtx); 2677 mutex_unlock(&local->mtx);
2678 2678
2679 ieee80211_roc_notify_destroy(found); 2679 ieee80211_roc_notify_destroy(found, true);
2680 } else { 2680 } else {
2681 /* work may be pending so use it all the time */ 2681 /* work may be pending so use it all the time */
2682 found->abort = true; 2682 found->abort = true;
@@ -2686,6 +2686,8 @@ static int ieee80211_cancel_roc(struct ieee80211_local *local,
2686 2686
2687 /* work will clean up etc */ 2687 /* work will clean up etc */
2688 flush_delayed_work(&found->work); 2688 flush_delayed_work(&found->work);
2689 WARN_ON(!found->to_be_freed);
2690 kfree(found);
2689 } 2691 }
2690 2692
2691 return 0; 2693 return 0;
diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c
index 78c0d90dd641..931be419ab5a 100644
--- a/net/mac80211/chan.c
+++ b/net/mac80211/chan.c
@@ -63,6 +63,7 @@ ieee80211_new_chanctx(struct ieee80211_local *local,
63 enum ieee80211_chanctx_mode mode) 63 enum ieee80211_chanctx_mode mode)
64{ 64{
65 struct ieee80211_chanctx *ctx; 65 struct ieee80211_chanctx *ctx;
66 u32 changed;
66 int err; 67 int err;
67 68
68 lockdep_assert_held(&local->chanctx_mtx); 69 lockdep_assert_held(&local->chanctx_mtx);
@@ -76,6 +77,13 @@ ieee80211_new_chanctx(struct ieee80211_local *local,
76 ctx->conf.rx_chains_dynamic = 1; 77 ctx->conf.rx_chains_dynamic = 1;
77 ctx->mode = mode; 78 ctx->mode = mode;
78 79
80 /* acquire mutex to prevent idle from changing */
81 mutex_lock(&local->mtx);
82 /* turn idle off *before* setting channel -- some drivers need that */
83 changed = ieee80211_idle_off(local);
84 if (changed)
85 ieee80211_hw_config(local, changed);
86
79 if (!local->use_chanctx) { 87 if (!local->use_chanctx) {
80 local->_oper_channel_type = 88 local->_oper_channel_type =
81 cfg80211_get_chandef_type(chandef); 89 cfg80211_get_chandef_type(chandef);
@@ -85,14 +93,17 @@ ieee80211_new_chanctx(struct ieee80211_local *local,
85 err = drv_add_chanctx(local, ctx); 93 err = drv_add_chanctx(local, ctx);
86 if (err) { 94 if (err) {
87 kfree(ctx); 95 kfree(ctx);
88 return ERR_PTR(err); 96 ctx = ERR_PTR(err);
97
98 ieee80211_recalc_idle(local);
99 goto out;
89 } 100 }
90 } 101 }
91 102
103 /* and keep the mutex held until the new chanctx is on the list */
92 list_add_rcu(&ctx->list, &local->chanctx_list); 104 list_add_rcu(&ctx->list, &local->chanctx_list);
93 105
94 mutex_lock(&local->mtx); 106 out:
95 ieee80211_recalc_idle(local);
96 mutex_unlock(&local->mtx); 107 mutex_unlock(&local->mtx);
97 108
98 return ctx; 109 return ctx;
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index f4433f081e77..e140184c28ce 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -309,6 +309,7 @@ struct ieee80211_roc_work {
309 struct ieee80211_channel *chan; 309 struct ieee80211_channel *chan;
310 310
311 bool started, abort, hw_begun, notified; 311 bool started, abort, hw_begun, notified;
312 bool to_be_freed;
312 313
313 unsigned long hw_start_time; 314 unsigned long hw_start_time;
314 315
@@ -1335,7 +1336,7 @@ void ieee80211_offchannel_return(struct ieee80211_local *local);
1335void ieee80211_roc_setup(struct ieee80211_local *local); 1336void ieee80211_roc_setup(struct ieee80211_local *local);
1336void ieee80211_start_next_roc(struct ieee80211_local *local); 1337void ieee80211_start_next_roc(struct ieee80211_local *local);
1337void ieee80211_roc_purge(struct ieee80211_sub_if_data *sdata); 1338void ieee80211_roc_purge(struct ieee80211_sub_if_data *sdata);
1338void ieee80211_roc_notify_destroy(struct ieee80211_roc_work *roc); 1339void ieee80211_roc_notify_destroy(struct ieee80211_roc_work *roc, bool free);
1339void ieee80211_sw_roc_work(struct work_struct *work); 1340void ieee80211_sw_roc_work(struct work_struct *work);
1340void ieee80211_handle_roc_started(struct ieee80211_roc_work *roc); 1341void ieee80211_handle_roc_started(struct ieee80211_roc_work *roc);
1341 1342
@@ -1349,6 +1350,7 @@ int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata,
1349 enum nl80211_iftype type); 1350 enum nl80211_iftype type);
1350void ieee80211_if_remove(struct ieee80211_sub_if_data *sdata); 1351void ieee80211_if_remove(struct ieee80211_sub_if_data *sdata);
1351void ieee80211_remove_interfaces(struct ieee80211_local *local); 1352void ieee80211_remove_interfaces(struct ieee80211_local *local);
1353u32 ieee80211_idle_off(struct ieee80211_local *local);
1352void ieee80211_recalc_idle(struct ieee80211_local *local); 1354void ieee80211_recalc_idle(struct ieee80211_local *local);
1353void ieee80211_adjust_monitor_flags(struct ieee80211_sub_if_data *sdata, 1355void ieee80211_adjust_monitor_flags(struct ieee80211_sub_if_data *sdata,
1354 const int offset); 1356 const int offset);
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index 7530c60fe502..a2b5e17036bb 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -78,7 +78,7 @@ void ieee80211_recalc_txpower(struct ieee80211_sub_if_data *sdata)
78 ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_TXPOWER); 78 ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_TXPOWER);
79} 79}
80 80
81static u32 ieee80211_idle_off(struct ieee80211_local *local) 81u32 ieee80211_idle_off(struct ieee80211_local *local)
82{ 82{
83 if (!(local->hw.conf.flags & IEEE80211_CONF_IDLE)) 83 if (!(local->hw.conf.flags & IEEE80211_CONF_IDLE))
84 return 0; 84 return 0;
diff --git a/net/mac80211/offchannel.c b/net/mac80211/offchannel.c
index db547fceaeb9..950c95bec13d 100644
--- a/net/mac80211/offchannel.c
+++ b/net/mac80211/offchannel.c
@@ -297,10 +297,13 @@ void ieee80211_start_next_roc(struct ieee80211_local *local)
297 } 297 }
298} 298}
299 299
300void ieee80211_roc_notify_destroy(struct ieee80211_roc_work *roc) 300void ieee80211_roc_notify_destroy(struct ieee80211_roc_work *roc, bool free)
301{ 301{
302 struct ieee80211_roc_work *dep, *tmp; 302 struct ieee80211_roc_work *dep, *tmp;
303 303
304 if (WARN_ON(roc->to_be_freed))
305 return;
306
304 /* was never transmitted */ 307 /* was never transmitted */
305 if (roc->frame) { 308 if (roc->frame) {
306 cfg80211_mgmt_tx_status(&roc->sdata->wdev, 309 cfg80211_mgmt_tx_status(&roc->sdata->wdev,
@@ -316,9 +319,12 @@ void ieee80211_roc_notify_destroy(struct ieee80211_roc_work *roc)
316 GFP_KERNEL); 319 GFP_KERNEL);
317 320
318 list_for_each_entry_safe(dep, tmp, &roc->dependents, list) 321 list_for_each_entry_safe(dep, tmp, &roc->dependents, list)
319 ieee80211_roc_notify_destroy(dep); 322 ieee80211_roc_notify_destroy(dep, true);
320 323
321 kfree(roc); 324 if (free)
325 kfree(roc);
326 else
327 roc->to_be_freed = true;
322} 328}
323 329
324void ieee80211_sw_roc_work(struct work_struct *work) 330void ieee80211_sw_roc_work(struct work_struct *work)
@@ -331,6 +337,9 @@ void ieee80211_sw_roc_work(struct work_struct *work)
331 337
332 mutex_lock(&local->mtx); 338 mutex_lock(&local->mtx);
333 339
340 if (roc->to_be_freed)
341 goto out_unlock;
342
334 if (roc->abort) 343 if (roc->abort)
335 goto finish; 344 goto finish;
336 345
@@ -370,7 +379,7 @@ void ieee80211_sw_roc_work(struct work_struct *work)
370 finish: 379 finish:
371 list_del(&roc->list); 380 list_del(&roc->list);
372 started = roc->started; 381 started = roc->started;
373 ieee80211_roc_notify_destroy(roc); 382 ieee80211_roc_notify_destroy(roc, !roc->abort);
374 383
375 if (started) { 384 if (started) {
376 drv_flush(local, false); 385 drv_flush(local, false);
@@ -410,7 +419,7 @@ static void ieee80211_hw_roc_done(struct work_struct *work)
410 419
411 list_del(&roc->list); 420 list_del(&roc->list);
412 421
413 ieee80211_roc_notify_destroy(roc); 422 ieee80211_roc_notify_destroy(roc, true);
414 423
415 /* if there's another roc, start it now */ 424 /* if there's another roc, start it now */
416 ieee80211_start_next_roc(local); 425 ieee80211_start_next_roc(local);
@@ -460,12 +469,14 @@ void ieee80211_roc_purge(struct ieee80211_sub_if_data *sdata)
460 list_for_each_entry_safe(roc, tmp, &tmp_list, list) { 469 list_for_each_entry_safe(roc, tmp, &tmp_list, list) {
461 if (local->ops->remain_on_channel) { 470 if (local->ops->remain_on_channel) {
462 list_del(&roc->list); 471 list_del(&roc->list);
463 ieee80211_roc_notify_destroy(roc); 472 ieee80211_roc_notify_destroy(roc, true);
464 } else { 473 } else {
465 ieee80211_queue_delayed_work(&local->hw, &roc->work, 0); 474 ieee80211_queue_delayed_work(&local->hw, &roc->work, 0);
466 475
467 /* work will clean up etc */ 476 /* work will clean up etc */
468 flush_delayed_work(&roc->work); 477 flush_delayed_work(&roc->work);
478 WARN_ON(!roc->to_be_freed);
479 kfree(roc);
469 } 480 }
470 } 481 }
471 482
diff --git a/net/netfilter/nf_conntrack_standalone.c b/net/netfilter/nf_conntrack_standalone.c
index 6c69fbdb8361..ebb67d33bd63 100644
--- a/net/netfilter/nf_conntrack_standalone.c
+++ b/net/netfilter/nf_conntrack_standalone.c
@@ -572,6 +572,7 @@ static int __init nf_conntrack_standalone_init(void)
572 register_net_sysctl(&init_net, "net", nf_ct_netfilter_table); 572 register_net_sysctl(&init_net, "net", nf_ct_netfilter_table);
573 if (!nf_ct_netfilter_header) { 573 if (!nf_ct_netfilter_header) {
574 pr_err("nf_conntrack: can't register to sysctl.\n"); 574 pr_err("nf_conntrack: can't register to sysctl.\n");
575 ret = -ENOMEM;
575 goto out_sysctl; 576 goto out_sysctl;
576 } 577 }
577#endif 578#endif
diff --git a/net/netfilter/nfnetlink_acct.c b/net/netfilter/nfnetlink_acct.c
index 589d686f0b4c..dc3fd5d44464 100644
--- a/net/netfilter/nfnetlink_acct.c
+++ b/net/netfilter/nfnetlink_acct.c
@@ -49,6 +49,8 @@ nfnl_acct_new(struct sock *nfnl, struct sk_buff *skb,
49 return -EINVAL; 49 return -EINVAL;
50 50
51 acct_name = nla_data(tb[NFACCT_NAME]); 51 acct_name = nla_data(tb[NFACCT_NAME]);
52 if (strlen(acct_name) == 0)
53 return -EINVAL;
52 54
53 list_for_each_entry(nfacct, &nfnl_acct_list, head) { 55 list_for_each_entry(nfacct, &nfnl_acct_list, head) {
54 if (strncmp(nfacct->name, acct_name, NFACCT_NAME_MAX) != 0) 56 if (strncmp(nfacct->name, acct_name, NFACCT_NAME_MAX) != 0)
diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c
index d1fa1d9ffd2e..7fcb307dea47 100644
--- a/net/netrom/af_netrom.c
+++ b/net/netrom/af_netrom.c
@@ -1173,6 +1173,7 @@ static int nr_recvmsg(struct kiocb *iocb, struct socket *sock,
1173 } 1173 }
1174 1174
1175 if (sax != NULL) { 1175 if (sax != NULL) {
1176 memset(sax, 0, sizeof(sax));
1176 sax->sax25_family = AF_NETROM; 1177 sax->sax25_family = AF_NETROM;
1177 skb_copy_from_linear_data_offset(skb, 7, sax->sax25_call.ax25_call, 1178 skb_copy_from_linear_data_offset(skb, 7, sax->sax25_call.ax25_call,
1178 AX25_ADDR_LEN); 1179 AX25_ADDR_LEN);
diff --git a/net/nfc/llcp/llcp.c b/net/nfc/llcp/llcp.c
index bb67b98b9797..7de0368aff0c 100644
--- a/net/nfc/llcp/llcp.c
+++ b/net/nfc/llcp/llcp.c
@@ -107,8 +107,6 @@ static void nfc_llcp_socket_release(struct nfc_llcp_local *local, bool listen,
107 accept_sk->sk_state_change(sk); 107 accept_sk->sk_state_change(sk);
108 108
109 bh_unlock_sock(accept_sk); 109 bh_unlock_sock(accept_sk);
110
111 sock_orphan(accept_sk);
112 } 110 }
113 111
114 if (listen == true) { 112 if (listen == true) {
@@ -134,8 +132,6 @@ static void nfc_llcp_socket_release(struct nfc_llcp_local *local, bool listen,
134 132
135 bh_unlock_sock(sk); 133 bh_unlock_sock(sk);
136 134
137 sock_orphan(sk);
138
139 sk_del_node_init(sk); 135 sk_del_node_init(sk);
140 } 136 }
141 137
@@ -164,8 +160,6 @@ static void nfc_llcp_socket_release(struct nfc_llcp_local *local, bool listen,
164 160
165 bh_unlock_sock(sk); 161 bh_unlock_sock(sk);
166 162
167 sock_orphan(sk);
168
169 sk_del_node_init(sk); 163 sk_del_node_init(sk);
170 } 164 }
171 165
@@ -869,7 +863,6 @@ static void nfc_llcp_recv_ui(struct nfc_llcp_local *local,
869 skb_get(skb); 863 skb_get(skb);
870 } else { 864 } else {
871 pr_err("Receive queue is full\n"); 865 pr_err("Receive queue is full\n");
872 kfree_skb(skb);
873 } 866 }
874 867
875 nfc_llcp_sock_put(llcp_sock); 868 nfc_llcp_sock_put(llcp_sock);
@@ -1072,7 +1065,6 @@ static void nfc_llcp_recv_hdlc(struct nfc_llcp_local *local,
1072 skb_get(skb); 1065 skb_get(skb);
1073 } else { 1066 } else {
1074 pr_err("Receive queue is full\n"); 1067 pr_err("Receive queue is full\n");
1075 kfree_skb(skb);
1076 } 1068 }
1077 } 1069 }
1078 1070
diff --git a/net/nfc/llcp/sock.c b/net/nfc/llcp/sock.c
index 6b3254452b36..c1101e6de170 100644
--- a/net/nfc/llcp/sock.c
+++ b/net/nfc/llcp/sock.c
@@ -388,7 +388,9 @@ struct sock *nfc_llcp_accept_dequeue(struct sock *parent,
388 } 388 }
389 389
390 if (sk->sk_state == LLCP_CONNECTED || !newsock) { 390 if (sk->sk_state == LLCP_CONNECTED || !newsock) {
391 nfc_llcp_accept_unlink(sk); 391 list_del_init(&lsk->accept_queue);
392 sock_put(sk);
393
392 if (newsock) 394 if (newsock)
393 sock_graft(sk, newsock); 395 sock_graft(sk, newsock);
394 396
@@ -583,8 +585,6 @@ static int llcp_sock_release(struct socket *sock)
583 nfc_llcp_accept_unlink(accept_sk); 585 nfc_llcp_accept_unlink(accept_sk);
584 586
585 release_sock(accept_sk); 587 release_sock(accept_sk);
586
587 sock_orphan(accept_sk);
588 } 588 }
589 } 589 }
590 590
@@ -765,6 +765,8 @@ static int llcp_sock_recvmsg(struct kiocb *iocb, struct socket *sock,
765 765
766 pr_debug("%p %zu\n", sk, len); 766 pr_debug("%p %zu\n", sk, len);
767 767
768 msg->msg_namelen = 0;
769
768 lock_sock(sk); 770 lock_sock(sk);
769 771
770 if (sk->sk_state == LLCP_CLOSED && 772 if (sk->sk_state == LLCP_CLOSED &&
@@ -810,6 +812,7 @@ static int llcp_sock_recvmsg(struct kiocb *iocb, struct socket *sock,
810 812
811 pr_debug("Datagram socket %d %d\n", ui_cb->dsap, ui_cb->ssap); 813 pr_debug("Datagram socket %d %d\n", ui_cb->dsap, ui_cb->ssap);
812 814
815 memset(sockaddr, 0, sizeof(*sockaddr));
813 sockaddr->sa_family = AF_NFC; 816 sockaddr->sa_family = AF_NFC;
814 sockaddr->nfc_protocol = NFC_PROTO_NFC_DEP; 817 sockaddr->nfc_protocol = NFC_PROTO_NFC_DEP;
815 sockaddr->dsap = ui_cb->dsap; 818 sockaddr->dsap = ui_cb->dsap;
diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c
index cf68e6e4054a..9c8347451597 100644
--- a/net/rose/af_rose.c
+++ b/net/rose/af_rose.c
@@ -1253,6 +1253,7 @@ static int rose_recvmsg(struct kiocb *iocb, struct socket *sock,
1253 skb_copy_datagram_iovec(skb, 0, msg->msg_iov, copied); 1253 skb_copy_datagram_iovec(skb, 0, msg->msg_iov, copied);
1254 1254
1255 if (srose != NULL) { 1255 if (srose != NULL) {
1256 memset(srose, 0, msg->msg_namelen);
1256 srose->srose_family = AF_ROSE; 1257 srose->srose_family = AF_ROSE;
1257 srose->srose_addr = rose->dest_addr; 1258 srose->srose_addr = rose->dest_addr;
1258 srose->srose_call = rose->dest_call; 1259 srose->srose_call = rose->dest_call;
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index a9622b6cd916..515ce38e4f4c 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -790,6 +790,7 @@ static void set_orig_addr(struct msghdr *m, struct tipc_msg *msg)
790 if (addr) { 790 if (addr) {
791 addr->family = AF_TIPC; 791 addr->family = AF_TIPC;
792 addr->addrtype = TIPC_ADDR_ID; 792 addr->addrtype = TIPC_ADDR_ID;
793 memset(&addr->addr, 0, sizeof(addr->addr));
793 addr->addr.id.ref = msg_origport(msg); 794 addr->addr.id.ref = msg_origport(msg);
794 addr->addr.id.node = msg_orignode(msg); 795 addr->addr.id.node = msg_orignode(msg);
795 addr->addr.name.domain = 0; /* could leave uninitialized */ 796 addr->addr.name.domain = 0; /* could leave uninitialized */
@@ -904,6 +905,9 @@ static int recv_msg(struct kiocb *iocb, struct socket *sock,
904 goto exit; 905 goto exit;
905 } 906 }
906 907
908 /* will be updated in set_orig_addr() if needed */
909 m->msg_namelen = 0;
910
907 timeout = sock_rcvtimeo(sk, flags & MSG_DONTWAIT); 911 timeout = sock_rcvtimeo(sk, flags & MSG_DONTWAIT);
908restart: 912restart:
909 913
@@ -1013,6 +1017,9 @@ static int recv_stream(struct kiocb *iocb, struct socket *sock,
1013 goto exit; 1017 goto exit;
1014 } 1018 }
1015 1019
1020 /* will be updated in set_orig_addr() if needed */
1021 m->msg_namelen = 0;
1022
1016 target = sock_rcvlowat(sk, flags & MSG_WAITALL, buf_len); 1023 target = sock_rcvlowat(sk, flags & MSG_WAITALL, buf_len);
1017 timeout = sock_rcvtimeo(sk, flags & MSG_DONTWAIT); 1024 timeout = sock_rcvtimeo(sk, flags & MSG_DONTWAIT);
1018 1025
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 2e4d90044a52..824eaf2c3afa 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -1412,8 +1412,8 @@ static void maybe_add_creds(struct sk_buff *skb, const struct socket *sock,
1412 if (UNIXCB(skb).cred) 1412 if (UNIXCB(skb).cred)
1413 return; 1413 return;
1414 if (test_bit(SOCK_PASSCRED, &sock->flags) || 1414 if (test_bit(SOCK_PASSCRED, &sock->flags) ||
1415 (other->sk_socket && 1415 !other->sk_socket ||
1416 test_bit(SOCK_PASSCRED, &other->sk_socket->flags))) { 1416 test_bit(SOCK_PASSCRED, &other->sk_socket->flags)) {
1417 UNIXCB(skb).pid = get_pid(task_tgid(current)); 1417 UNIXCB(skb).pid = get_pid(task_tgid(current));
1418 UNIXCB(skb).cred = get_current_cred(); 1418 UNIXCB(skb).cred = get_current_cred();
1419 } 1419 }
@@ -1993,7 +1993,7 @@ again:
1993 if ((UNIXCB(skb).pid != siocb->scm->pid) || 1993 if ((UNIXCB(skb).pid != siocb->scm->pid) ||
1994 (UNIXCB(skb).cred != siocb->scm->cred)) 1994 (UNIXCB(skb).cred != siocb->scm->cred))
1995 break; 1995 break;
1996 } else { 1996 } else if (test_bit(SOCK_PASSCRED, &sock->flags)) {
1997 /* Copy credentials */ 1997 /* Copy credentials */
1998 scm_set_cred(siocb->scm, UNIXCB(skb).pid, UNIXCB(skb).cred); 1998 scm_set_cred(siocb->scm, UNIXCB(skb).pid, UNIXCB(skb).cred);
1999 check_creds = 1; 1999 check_creds = 1;
diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c
index d8079daf1bde..7f93e2a42d7a 100644
--- a/net/vmw_vsock/af_vsock.c
+++ b/net/vmw_vsock/af_vsock.c
@@ -1670,6 +1670,8 @@ vsock_stream_recvmsg(struct kiocb *kiocb,
1670 vsk = vsock_sk(sk); 1670 vsk = vsock_sk(sk);
1671 err = 0; 1671 err = 0;
1672 1672
1673 msg->msg_namelen = 0;
1674
1673 lock_sock(sk); 1675 lock_sock(sk);
1674 1676
1675 if (sk->sk_state != SS_CONNECTED) { 1677 if (sk->sk_state != SS_CONNECTED) {
diff --git a/net/vmw_vsock/vmci_transport.c b/net/vmw_vsock/vmci_transport.c
index 9caa91c0bdaf..daff75200e25 100644
--- a/net/vmw_vsock/vmci_transport.c
+++ b/net/vmw_vsock/vmci_transport.c
@@ -1746,6 +1746,8 @@ static int vmci_transport_dgram_dequeue(struct kiocb *kiocb,
1746 if (flags & MSG_OOB || flags & MSG_ERRQUEUE) 1746 if (flags & MSG_OOB || flags & MSG_ERRQUEUE)
1747 return -EOPNOTSUPP; 1747 return -EOPNOTSUPP;
1748 1748
1749 msg->msg_namelen = 0;
1750
1749 /* Retrieve the head sk_buff from the socket's receive queue. */ 1751 /* Retrieve the head sk_buff from the socket's receive queue. */
1750 err = 0; 1752 err = 0;
1751 skb = skb_recv_datagram(&vsk->sk, flags, noblock, &err); 1753 skb = skb_recv_datagram(&vsk->sk, flags, noblock, &err);
@@ -1778,7 +1780,6 @@ static int vmci_transport_dgram_dequeue(struct kiocb *kiocb,
1778 if (err) 1780 if (err)
1779 goto out; 1781 goto out;
1780 1782
1781 msg->msg_namelen = 0;
1782 if (msg->msg_name) { 1783 if (msg->msg_name) {
1783 struct sockaddr_vm *vm_addr; 1784 struct sockaddr_vm *vm_addr;
1784 1785
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index ecdf30eb5879..4aba7646dd9c 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -173,7 +173,7 @@ const char *snd_hda_get_jack_type(u32 cfg)
173 "Line Out", "Speaker", "HP Out", "CD", 173 "Line Out", "Speaker", "HP Out", "CD",
174 "SPDIF Out", "Digital Out", "Modem Line", "Modem Hand", 174 "SPDIF Out", "Digital Out", "Modem Line", "Modem Hand",
175 "Line In", "Aux", "Mic", "Telephony", 175 "Line In", "Aux", "Mic", "Telephony",
176 "SPDIF In", "Digitial In", "Reserved", "Other" 176 "SPDIF In", "Digital In", "Reserved", "Other"
177 }; 177 };
178 178
179 return jack_types[(cfg & AC_DEFCFG_DEVICE) 179 return jack_types[(cfg & AC_DEFCFG_DEVICE)
diff --git a/sound/pci/hda/hda_eld.c b/sound/pci/hda/hda_eld.c
index 7dd846380a50..d0d7ac1e99d2 100644
--- a/sound/pci/hda/hda_eld.c
+++ b/sound/pci/hda/hda_eld.c
@@ -320,7 +320,7 @@ int snd_hdmi_get_eld(struct hda_codec *codec, hda_nid_t nid,
320 unsigned char *buf, int *eld_size) 320 unsigned char *buf, int *eld_size)
321{ 321{
322 int i; 322 int i;
323 int ret; 323 int ret = 0;
324 int size; 324 int size;
325 325
326 /* 326 /*
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
index 43c2ea539561..2dbe767be16b 100644
--- a/sound/pci/hda/hda_generic.c
+++ b/sound/pci/hda/hda_generic.c
@@ -740,7 +740,7 @@ EXPORT_SYMBOL_HDA(snd_hda_activate_path);
740static void path_power_down_sync(struct hda_codec *codec, struct nid_path *path) 740static void path_power_down_sync(struct hda_codec *codec, struct nid_path *path)
741{ 741{
742 struct hda_gen_spec *spec = codec->spec; 742 struct hda_gen_spec *spec = codec->spec;
743 bool changed; 743 bool changed = false;
744 int i; 744 int i;
745 745
746 if (!spec->power_down_unused || path->active) 746 if (!spec->power_down_unused || path->active)
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 418bfc0eb0a3..bcd40ee488e3 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -134,8 +134,8 @@ MODULE_PARM_DESC(power_save, "Automatic power-saving timeout "
134 * this may give more power-saving, but will take longer time to 134 * this may give more power-saving, but will take longer time to
135 * wake up. 135 * wake up.
136 */ 136 */
137static int power_save_controller = -1; 137static bool power_save_controller = 1;
138module_param(power_save_controller, bint, 0644); 138module_param(power_save_controller, bool, 0644);
139MODULE_PARM_DESC(power_save_controller, "Reset controller in power save mode."); 139MODULE_PARM_DESC(power_save_controller, "Reset controller in power save mode.");
140#endif /* CONFIG_PM */ 140#endif /* CONFIG_PM */
141 141
@@ -2931,8 +2931,6 @@ static int azx_runtime_idle(struct device *dev)
2931 struct snd_card *card = dev_get_drvdata(dev); 2931 struct snd_card *card = dev_get_drvdata(dev);
2932 struct azx *chip = card->private_data; 2932 struct azx *chip = card->private_data;
2933 2933
2934 if (power_save_controller > 0)
2935 return 0;
2936 if (!power_save_controller || 2934 if (!power_save_controller ||
2937 !(chip->driver_caps & AZX_DCAPS_PM_RUNTIME)) 2935 !(chip->driver_caps & AZX_DCAPS_PM_RUNTIME))
2938 return -EBUSY; 2936 return -EBUSY;
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index 78e1827d0a95..de8ac5c07fd0 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -1196,7 +1196,7 @@ static void hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll)
1196 1196
1197 _snd_printd(SND_PR_VERBOSE, 1197 _snd_printd(SND_PR_VERBOSE,
1198 "HDMI status: Codec=%d Pin=%d Presence_Detect=%d ELD_Valid=%d\n", 1198 "HDMI status: Codec=%d Pin=%d Presence_Detect=%d ELD_Valid=%d\n",
1199 codec->addr, pin_nid, eld->monitor_present, eld->eld_valid); 1199 codec->addr, pin_nid, pin_eld->monitor_present, eld->eld_valid);
1200 1200
1201 if (eld->eld_valid) { 1201 if (eld->eld_valid) {
1202 if (snd_hdmi_get_eld(codec, pin_nid, eld->eld_buffer, 1202 if (snd_hdmi_get_eld(codec, pin_nid, eld->eld_buffer,
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 563c24df4d6f..f15c36bde540 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -3440,7 +3440,8 @@ static int alc662_parse_auto_config(struct hda_codec *codec)
3440 const hda_nid_t *ssids; 3440 const hda_nid_t *ssids;
3441 3441
3442 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || 3442 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
3443 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670) 3443 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670 ||
3444 codec->vendor_id == 0x10ec0671)
3444 ssids = alc663_ssids; 3445 ssids = alc663_ssids;
3445 else 3446 else
3446 ssids = alc662_ssids; 3447 ssids = alc662_ssids;
@@ -3894,6 +3895,7 @@ static const struct hda_codec_preset snd_hda_preset_realtek[] = {
3894 { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 }, 3895 { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 },
3895 { .id = 0x10ec0668, .name = "ALC668", .patch = patch_alc662 }, 3896 { .id = 0x10ec0668, .name = "ALC668", .patch = patch_alc662 },
3896 { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 }, 3897 { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 },
3898 { .id = 0x10ec0671, .name = "ALC671", .patch = patch_alc662 },
3897 { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 }, 3899 { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 },
3898 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, 3900 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
3899 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, 3901 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c
index fc176044994d..fc176044994d 100755..100644
--- a/sound/soc/codecs/max98090.c
+++ b/sound/soc/codecs/max98090.c
diff --git a/sound/soc/codecs/max98090.h b/sound/soc/codecs/max98090.h
index 7e103f249053..7e103f249053 100755..100644
--- a/sound/soc/codecs/max98090.h
+++ b/sound/soc/codecs/max98090.h
diff --git a/sound/soc/codecs/si476x.c b/sound/soc/codecs/si476x.c
index f2d61a187830..566ea3256e2d 100644
--- a/sound/soc/codecs/si476x.c
+++ b/sound/soc/codecs/si476x.c
@@ -159,6 +159,7 @@ static int si476x_codec_hw_params(struct snd_pcm_substream *substream,
159 switch (params_format(params)) { 159 switch (params_format(params)) {
160 case SNDRV_PCM_FORMAT_S8: 160 case SNDRV_PCM_FORMAT_S8:
161 width = SI476X_PCM_FORMAT_S8; 161 width = SI476X_PCM_FORMAT_S8;
162 break;
162 case SNDRV_PCM_FORMAT_S16_LE: 163 case SNDRV_PCM_FORMAT_S16_LE:
163 width = SI476X_PCM_FORMAT_S16_LE; 164 width = SI476X_PCM_FORMAT_S16_LE;
164 break; 165 break;
diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c
index f3f7e75f8628..9af1bddc4c62 100644
--- a/sound/soc/codecs/wm_adsp.c
+++ b/sound/soc/codecs/wm_adsp.c
@@ -828,7 +828,8 @@ static int wm_adsp_load_coeff(struct wm_adsp *dsp)
828 &buf_list); 828 &buf_list);
829 if (!buf) { 829 if (!buf) {
830 adsp_err(dsp, "Out of memory\n"); 830 adsp_err(dsp, "Out of memory\n");
831 return -ENOMEM; 831 ret = -ENOMEM;
832 goto out_fw;
832 } 833 }
833 834
834 adsp_dbg(dsp, "%s.%d: Writing %d bytes at %x\n", 835 adsp_dbg(dsp, "%s.%d: Writing %d bytes at %x\n",
@@ -865,7 +866,7 @@ out_fw:
865 wm_adsp_buf_free(&buf_list); 866 wm_adsp_buf_free(&buf_list);
866out: 867out:
867 kfree(file); 868 kfree(file);
868 return 0; 869 return ret;
869} 870}
870 871
871int wm_adsp1_init(struct wm_adsp *adsp) 872int wm_adsp1_init(struct wm_adsp *adsp)
diff --git a/sound/soc/fsl/imx-ssi.c b/sound/soc/fsl/imx-ssi.c
index 55464a5b0706..810c7eeb7b03 100644
--- a/sound/soc/fsl/imx-ssi.c
+++ b/sound/soc/fsl/imx-ssi.c
@@ -496,6 +496,8 @@ static void imx_ssi_ac97_reset(struct snd_ac97 *ac97)
496 496
497 if (imx_ssi->ac97_reset) 497 if (imx_ssi->ac97_reset)
498 imx_ssi->ac97_reset(ac97); 498 imx_ssi->ac97_reset(ac97);
499 /* First read sometimes fails, do a dummy read */
500 imx_ssi_ac97_read(ac97, 0);
499} 501}
500 502
501static void imx_ssi_ac97_warm_reset(struct snd_ac97 *ac97) 503static void imx_ssi_ac97_warm_reset(struct snd_ac97 *ac97)
@@ -504,6 +506,9 @@ static void imx_ssi_ac97_warm_reset(struct snd_ac97 *ac97)
504 506
505 if (imx_ssi->ac97_warm_reset) 507 if (imx_ssi->ac97_warm_reset)
506 imx_ssi->ac97_warm_reset(ac97); 508 imx_ssi->ac97_warm_reset(ac97);
509
510 /* First read sometimes fails, do a dummy read */
511 imx_ssi_ac97_read(ac97, 0);
507} 512}
508 513
509struct snd_ac97_bus_ops soc_ac97_ops = { 514struct snd_ac97_bus_ops soc_ac97_ops = {
diff --git a/sound/soc/fsl/pcm030-audio-fabric.c b/sound/soc/fsl/pcm030-audio-fabric.c
index 8e52c1485df3..eb4373840bb6 100644
--- a/sound/soc/fsl/pcm030-audio-fabric.c
+++ b/sound/soc/fsl/pcm030-audio-fabric.c
@@ -51,7 +51,7 @@ static struct snd_soc_card pcm030_card = {
51 .num_links = ARRAY_SIZE(pcm030_fabric_dai), 51 .num_links = ARRAY_SIZE(pcm030_fabric_dai),
52}; 52};
53 53
54static int __init pcm030_fabric_probe(struct platform_device *op) 54static int pcm030_fabric_probe(struct platform_device *op)
55{ 55{
56 struct device_node *np = op->dev.of_node; 56 struct device_node *np = op->dev.of_node;
57 struct device_node *platform_np; 57 struct device_node *platform_np;
diff --git a/sound/soc/sh/dma-sh7760.c b/sound/soc/sh/dma-sh7760.c
index 19eff8fc4fdd..1a8b03e4b41b 100644
--- a/sound/soc/sh/dma-sh7760.c
+++ b/sound/soc/sh/dma-sh7760.c
@@ -342,8 +342,8 @@ static int camelot_pcm_new(struct snd_soc_pcm_runtime *rtd)
342 return 0; 342 return 0;
343} 343}
344 344
345static struct snd_soc_platform sh7760_soc_platform = { 345static struct snd_soc_platform_driver sh7760_soc_platform = {
346 .pcm_ops = &camelot_pcm_ops, 346 .ops = &camelot_pcm_ops,
347 .pcm_new = camelot_pcm_new, 347 .pcm_new = camelot_pcm_new,
348 .pcm_free = camelot_pcm_free, 348 .pcm_free = camelot_pcm_free,
349}; 349};
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index b7e84a7cd9ee..507d251916af 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -3140,7 +3140,7 @@ int snd_soc_bytes_put(struct snd_kcontrol *kcontrol,
3140 if (params->mask) { 3140 if (params->mask) {
3141 ret = regmap_read(codec->control_data, params->base, &val); 3141 ret = regmap_read(codec->control_data, params->base, &val);
3142 if (ret != 0) 3142 if (ret != 0)
3143 return ret; 3143 goto out;
3144 3144
3145 val &= params->mask; 3145 val &= params->mask;
3146 3146
@@ -3158,13 +3158,15 @@ int snd_soc_bytes_put(struct snd_kcontrol *kcontrol,
3158 ((u32 *)data)[0] |= cpu_to_be32(val); 3158 ((u32 *)data)[0] |= cpu_to_be32(val);
3159 break; 3159 break;
3160 default: 3160 default:
3161 return -EINVAL; 3161 ret = -EINVAL;
3162 goto out;
3162 } 3163 }
3163 } 3164 }
3164 3165
3165 ret = regmap_raw_write(codec->control_data, params->base, 3166 ret = regmap_raw_write(codec->control_data, params->base,
3166 data, len); 3167 data, len);
3167 3168
3169out:
3168 kfree(data); 3170 kfree(data);
3169 3171
3170 return ret; 3172 return ret;
@@ -4197,7 +4199,6 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
4197 dev_err(card->dev, 4199 dev_err(card->dev,
4198 "ASoC: Property '%s' index %d could not be read: %d\n", 4200 "ASoC: Property '%s' index %d could not be read: %d\n",
4199 propname, 2 * i, ret); 4201 propname, 2 * i, ret);
4200 kfree(routes);
4201 return -EINVAL; 4202 return -EINVAL;
4202 } 4203 }
4203 ret = of_property_read_string_index(np, propname, 4204 ret = of_property_read_string_index(np, propname,
@@ -4206,7 +4207,6 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
4206 dev_err(card->dev, 4207 dev_err(card->dev,
4207 "ASoC: Property '%s' index %d could not be read: %d\n", 4208 "ASoC: Property '%s' index %d could not be read: %d\n",
4208 propname, (2 * i) + 1, ret); 4209 propname, (2 * i) + 1, ret);
4209 kfree(routes);
4210 return -EINVAL; 4210 return -EINVAL;
4211 } 4211 }
4212 } 4212 }
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 1d6a9b3ceb27..d6d9ba2e6916 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -831,6 +831,9 @@ static int is_connected_output_ep(struct snd_soc_dapm_widget *widget,
831 if (path->weak) 831 if (path->weak)
832 continue; 832 continue;
833 833
834 if (path->walking)
835 return 1;
836
834 if (path->walked) 837 if (path->walked)
835 continue; 838 continue;
836 839
@@ -838,6 +841,7 @@ static int is_connected_output_ep(struct snd_soc_dapm_widget *widget,
838 841
839 if (path->sink && path->connect) { 842 if (path->sink && path->connect) {
840 path->walked = 1; 843 path->walked = 1;
844 path->walking = 1;
841 845
842 /* do we need to add this widget to the list ? */ 846 /* do we need to add this widget to the list ? */
843 if (list) { 847 if (list) {
@@ -847,11 +851,14 @@ static int is_connected_output_ep(struct snd_soc_dapm_widget *widget,
847 dev_err(widget->dapm->dev, 851 dev_err(widget->dapm->dev,
848 "ASoC: could not add widget %s\n", 852 "ASoC: could not add widget %s\n",
849 widget->name); 853 widget->name);
854 path->walking = 0;
850 return con; 855 return con;
851 } 856 }
852 } 857 }
853 858
854 con += is_connected_output_ep(path->sink, list); 859 con += is_connected_output_ep(path->sink, list);
860
861 path->walking = 0;
855 } 862 }
856 } 863 }
857 864
@@ -931,6 +938,9 @@ static int is_connected_input_ep(struct snd_soc_dapm_widget *widget,
931 if (path->weak) 938 if (path->weak)
932 continue; 939 continue;
933 940
941 if (path->walking)
942 return 1;
943
934 if (path->walked) 944 if (path->walked)
935 continue; 945 continue;
936 946
@@ -938,6 +948,7 @@ static int is_connected_input_ep(struct snd_soc_dapm_widget *widget,
938 948
939 if (path->source && path->connect) { 949 if (path->source && path->connect) {
940 path->walked = 1; 950 path->walked = 1;
951 path->walking = 1;
941 952
942 /* do we need to add this widget to the list ? */ 953 /* do we need to add this widget to the list ? */
943 if (list) { 954 if (list) {
@@ -947,11 +958,14 @@ static int is_connected_input_ep(struct snd_soc_dapm_widget *widget,
947 dev_err(widget->dapm->dev, 958 dev_err(widget->dapm->dev,
948 "ASoC: could not add widget %s\n", 959 "ASoC: could not add widget %s\n",
949 widget->name); 960 widget->name);
961 path->walking = 0;
950 return con; 962 return con;
951 } 963 }
952 } 964 }
953 965
954 con += is_connected_input_ep(path->source, list); 966 con += is_connected_input_ep(path->source, list);
967
968 path->walking = 0;
955 } 969 }
956 } 970 }
957 971
diff --git a/sound/soc/spear/spear_pcm.c b/sound/soc/spear/spear_pcm.c
index 9b76cc5a1148..5e7aebe1e664 100644
--- a/sound/soc/spear/spear_pcm.c
+++ b/sound/soc/spear/spear_pcm.c
@@ -149,9 +149,9 @@ static void spear_pcm_free(struct snd_pcm *pcm)
149 149
150static u64 spear_pcm_dmamask = DMA_BIT_MASK(32); 150static u64 spear_pcm_dmamask = DMA_BIT_MASK(32);
151 151
152static int spear_pcm_new(struct snd_card *card, 152static int spear_pcm_new(struct snd_soc_pcm_runtime *rtd)
153 struct snd_soc_dai *dai, struct snd_pcm *pcm)
154{ 153{
154 struct snd_card *card = rtd->card->snd_card;
155 int ret; 155 int ret;
156 156
157 if (!card->dev->dma_mask) 157 if (!card->dev->dma_mask)
@@ -159,16 +159,16 @@ static int spear_pcm_new(struct snd_card *card,
159 if (!card->dev->coherent_dma_mask) 159 if (!card->dev->coherent_dma_mask)
160 card->dev->coherent_dma_mask = DMA_BIT_MASK(32); 160 card->dev->coherent_dma_mask = DMA_BIT_MASK(32);
161 161
162 if (dai->driver->playback.channels_min) { 162 if (rtd->cpu_dai->driver->playback.channels_min) {
163 ret = spear_pcm_preallocate_dma_buffer(pcm, 163 ret = spear_pcm_preallocate_dma_buffer(rtd->pcm,
164 SNDRV_PCM_STREAM_PLAYBACK, 164 SNDRV_PCM_STREAM_PLAYBACK,
165 spear_pcm_hardware.buffer_bytes_max); 165 spear_pcm_hardware.buffer_bytes_max);
166 if (ret) 166 if (ret)
167 return ret; 167 return ret;
168 } 168 }
169 169
170 if (dai->driver->capture.channels_min) { 170 if (rtd->cpu_dai->driver->capture.channels_min) {
171 ret = spear_pcm_preallocate_dma_buffer(pcm, 171 ret = spear_pcm_preallocate_dma_buffer(rtd->pcm,
172 SNDRV_PCM_STREAM_CAPTURE, 172 SNDRV_PCM_STREAM_CAPTURE,
173 spear_pcm_hardware.buffer_bytes_max); 173 spear_pcm_hardware.buffer_bytes_max);
174 if (ret) 174 if (ret)
diff --git a/sound/usb/clock.c b/sound/usb/clock.c
index 5e634a2eb282..9e2703a25156 100644
--- a/sound/usb/clock.c
+++ b/sound/usb/clock.c
@@ -253,7 +253,7 @@ static int set_sample_rate_v2(struct snd_usb_audio *chip, int iface,
253{ 253{
254 struct usb_device *dev = chip->dev; 254 struct usb_device *dev = chip->dev;
255 unsigned char data[4]; 255 unsigned char data[4];
256 int err, crate; 256 int err, cur_rate, prev_rate;
257 int clock = snd_usb_clock_find_source(chip, fmt->clock); 257 int clock = snd_usb_clock_find_source(chip, fmt->clock);
258 258
259 if (clock < 0) 259 if (clock < 0)
@@ -266,6 +266,19 @@ static int set_sample_rate_v2(struct snd_usb_audio *chip, int iface,
266 return -ENXIO; 266 return -ENXIO;
267 } 267 }
268 268
269 err = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), UAC2_CS_CUR,
270 USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN,
271 UAC2_CS_CONTROL_SAM_FREQ << 8,
272 snd_usb_ctrl_intf(chip) | (clock << 8),
273 data, sizeof(data));
274 if (err < 0) {
275 snd_printk(KERN_WARNING "%d:%d:%d: cannot get freq (v2)\n",
276 dev->devnum, iface, fmt->altsetting);
277 prev_rate = 0;
278 } else {
279 prev_rate = data[0] | (data[1] << 8) | (data[2] << 16) | (data[3] << 24);
280 }
281
269 data[0] = rate; 282 data[0] = rate;
270 data[1] = rate >> 8; 283 data[1] = rate >> 8;
271 data[2] = rate >> 16; 284 data[2] = rate >> 16;
@@ -280,19 +293,31 @@ static int set_sample_rate_v2(struct snd_usb_audio *chip, int iface,
280 return err; 293 return err;
281 } 294 }
282 295
283 if ((err = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), UAC2_CS_CUR, 296 err = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), UAC2_CS_CUR,
284 USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN, 297 USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN,
285 UAC2_CS_CONTROL_SAM_FREQ << 8, 298 UAC2_CS_CONTROL_SAM_FREQ << 8,
286 snd_usb_ctrl_intf(chip) | (clock << 8), 299 snd_usb_ctrl_intf(chip) | (clock << 8),
287 data, sizeof(data))) < 0) { 300 data, sizeof(data));
301 if (err < 0) {
288 snd_printk(KERN_WARNING "%d:%d:%d: cannot get freq (v2)\n", 302 snd_printk(KERN_WARNING "%d:%d:%d: cannot get freq (v2)\n",
289 dev->devnum, iface, fmt->altsetting); 303 dev->devnum, iface, fmt->altsetting);
290 return err; 304 cur_rate = 0;
305 } else {
306 cur_rate = data[0] | (data[1] << 8) | (data[2] << 16) | (data[3] << 24);
291 } 307 }
292 308
293 crate = data[0] | (data[1] << 8) | (data[2] << 16) | (data[3] << 24); 309 if (cur_rate != rate) {
294 if (crate != rate) 310 snd_printd(KERN_WARNING
295 snd_printd(KERN_WARNING "current rate %d is different from the runtime rate %d\n", crate, rate); 311 "current rate %d is different from the runtime rate %d\n",
312 cur_rate, rate);
313 }
314
315 /* Some devices doesn't respond to sample rate changes while the
316 * interface is active. */
317 if (rate != prev_rate) {
318 usb_set_interface(dev, iface, 0);
319 usb_set_interface(dev, iface, fmt->altsetting);
320 }
296 321
297 return 0; 322 return 0;
298} 323}