aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2015-01-06 22:29:20 -0500
committerDavid S. Miller <davem@davemloft.net>2015-01-06 22:29:20 -0500
commit44d84d7272e5848878a96029b8a8b6e86854f146 (patch)
tree91b188c0ae21255510ace7507d42cdf0e8f6f5ae
parentde7b5b3d790a2524c3f992d357983600635c441b (diff)
parentbdec41963890f8ed9ad89f8b418959ab3cdc2aa3 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
-rw-r--r--Documentation/devicetree/bindings/input/gpio-keys.txt10
-rw-r--r--Documentation/devicetree/bindings/input/stmpe-keypad.txt2
-rw-r--r--Makefile2
-rw-r--r--arch/arm/boot/dts/armada-370-db.dts24
-rw-r--r--arch/arm/configs/multi_v7_defconfig1
-rw-r--r--arch/arm/kernel/setup.c9
-rw-r--r--arch/arm/kernel/smp.c12
-rw-r--r--arch/ia64/include/asm/unistd.h2
-rw-r--r--arch/ia64/include/uapi/asm/unistd.h1
-rw-r--r--arch/ia64/kernel/entry.S1
-rw-r--r--arch/nios2/kernel/cpuinfo.c1
-rw-r--r--arch/nios2/kernel/entry.S20
-rw-r--r--arch/powerpc/include/asm/kexec.h10
-rw-r--r--arch/powerpc/include/asm/systbl.h1
-rw-r--r--arch/powerpc/include/asm/unistd.h2
-rw-r--r--arch/powerpc/include/uapi/asm/unistd.h1
-rw-r--r--arch/powerpc/kernel/machine_kexec_64.c2
-rw-r--r--arch/powerpc/kernel/smp.c9
-rw-r--r--arch/powerpc/platforms/pseries/lpar.c8
-rw-r--r--arch/um/Kconfig.common1
-rw-r--r--arch/x86/um/sys_call_table_32.c2
-rw-r--r--arch/x86/um/sys_call_table_64.c2
-rw-r--r--crypto/af_alg.c3
-rw-r--r--drivers/char/ipmi/ipmi_ssif.c3
-rw-r--r--drivers/clocksource/arm_arch_timer.c2
-rw-r--r--drivers/input/evdev.c60
-rw-r--r--drivers/input/input.c22
-rw-r--r--drivers/input/keyboard/Kconfig1
-rw-r--r--drivers/input/keyboard/gpio_keys.c114
-rw-r--r--drivers/input/keyboard/hil_kbd.c6
-rw-r--r--drivers/input/keyboard/stmpe-keypad.c141
-rw-r--r--drivers/input/mouse/alps.c84
-rw-r--r--drivers/input/mouse/trackpoint.c4
-rw-r--r--drivers/input/mouse/trackpoint.h5
-rw-r--r--drivers/input/touchscreen/atmel_mxt_ts.c99
-rw-r--r--drivers/input/touchscreen/edt-ft5x06.c4
-rw-r--r--drivers/mfd/stmpe.c4
-rw-r--r--drivers/mfd/stmpe.h3
-rw-r--r--drivers/net/ethernet/allwinner/sun4i-emac.c4
-rw-r--r--drivers/net/ethernet/altera/altera_tse_main.c15
-rw-r--r--drivers/net/ethernet/cisco/enic/enic_main.c6
-rw-r--r--drivers/net/ethernet/intel/e100.c2
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_debugfs.c4
-rw-r--r--drivers/net/ethernet/intel/igb/e1000_82575.c2
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/main.c13
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/mr.c9
-rw-r--r--drivers/net/ethernet/myricom/myri10ge/myri10ge.c4
-rw-r--r--drivers/net/ethernet/qlogic/qla3xxx.c8
-rw-r--r--drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c1
-rw-r--r--drivers/net/ethernet/ti/cpsw.c19
-rw-r--r--drivers/net/ethernet/xilinx/ll_temac_main.c2
-rw-r--r--drivers/net/ethernet/xilinx/xilinx_axienet_main.c2
-rw-r--r--drivers/net/ethernet/xilinx/xilinx_emaclite.c1
-rw-r--r--drivers/net/usb/qmi_wwan.c10
-rw-r--r--drivers/net/usb/r8152.c17
-rw-r--r--drivers/net/xen-netback/xenbus.c1
-rw-r--r--drivers/scsi/fnic/fnic.h2
-rw-r--r--drivers/scsi/fnic/fnic_scsi.c15
-rw-r--r--drivers/scsi/scsi_error.c4
-rw-r--r--drivers/scsi/sd.c5
-rw-r--r--drivers/vhost/vhost.c10
-rw-r--r--drivers/video/fbdev/core/fb_defio.c5
-rw-r--r--drivers/video/fbdev/omap2/dss/hdmi_pll.c2
-rw-r--r--drivers/video/fbdev/omap2/dss/pll.c3
-rw-r--r--drivers/video/fbdev/omap2/dss/sdi.c2
-rw-r--r--drivers/video/logo/logo.c17
-rw-r--r--fs/ext4/extents.c4
-rw-r--r--fs/ext4/file.c220
-rw-r--r--fs/ext4/resize.c24
-rw-r--r--fs/ext4/super.c2
-rw-r--r--include/linux/mfd/stmpe.h22
-rw-r--r--include/linux/mm.h2
-rw-r--r--include/net/mac80211.h7
-rw-r--r--include/sound/pcm.h10
-rw-r--r--include/uapi/linux/virtio_ring.h7
-rw-r--r--kernel/auditsc.c49
-rw-r--r--mm/memory.c4
-rw-r--r--net/batman-adv/multicast.c11
-rw-r--r--net/batman-adv/network-coding.c2
-rw-r--r--net/batman-adv/originator.c7
-rw-r--r--net/batman-adv/routing.c6
-rw-r--r--net/ipv4/tcp_output.c4
-rw-r--r--net/mac80211/key.c12
-rw-r--r--net/openvswitch/flow.c5
-rw-r--r--net/openvswitch/vport.c2
-rw-r--r--net/wireless/Kconfig2
-rw-r--r--sound/soc/codecs/rt5677.c9
-rw-r--r--sound/soc/dwc/designware_i2s.c49
-rw-r--r--sound/soc/intel/Kconfig4
-rw-r--r--sound/soc/intel/bytcr_dpcm_rt5640.c2
-rw-r--r--sound/soc/intel/sst-firmware.c6
-rw-r--r--sound/soc/intel/sst/sst_acpi.c2
-rw-r--r--sound/soc/rockchip/rockchip_i2s.c4
-rw-r--r--sound/soc/rockchip/rockchip_i2s.h2
-rw-r--r--sound/soc/soc-core.c14
95 files changed, 781 insertions, 576 deletions
diff --git a/Documentation/devicetree/bindings/input/gpio-keys.txt b/Documentation/devicetree/bindings/input/gpio-keys.txt
index a4a38fcf2ed6..44b705767aca 100644
--- a/Documentation/devicetree/bindings/input/gpio-keys.txt
+++ b/Documentation/devicetree/bindings/input/gpio-keys.txt
@@ -10,12 +10,13 @@ Optional properties:
10Each button (key) is represented as a sub-node of "gpio-keys": 10Each button (key) is represented as a sub-node of "gpio-keys":
11Subnode properties: 11Subnode properties:
12 12
13 - gpios: OF device-tree gpio specification.
14 - interrupts: the interrupt line for that input.
13 - label: Descriptive name of the key. 15 - label: Descriptive name of the key.
14 - linux,code: Keycode to emit. 16 - linux,code: Keycode to emit.
15 17
16Required mutual exclusive subnode-properties: 18Note that either "interrupts" or "gpios" properties can be omitted, but not
17 - gpios: OF device-tree gpio specification. 19both at the same time. Specifying both properties is allowed.
18 - interrupts: the interrupt line for that input
19 20
20Optional subnode-properties: 21Optional subnode-properties:
21 - linux,input-type: Specify event type this button/key generates. 22 - linux,input-type: Specify event type this button/key generates.
@@ -23,6 +24,9 @@ Optional subnode-properties:
23 - debounce-interval: Debouncing interval time in milliseconds. 24 - debounce-interval: Debouncing interval time in milliseconds.
24 If not specified defaults to 5. 25 If not specified defaults to 5.
25 - gpio-key,wakeup: Boolean, button can wake-up the system. 26 - gpio-key,wakeup: Boolean, button can wake-up the system.
27 - linux,can-disable: Boolean, indicates that button is connected
28 to dedicated (not shared) interrupt which can be disabled to
29 suppress events from the button.
26 30
27Example nodes: 31Example nodes:
28 32
diff --git a/Documentation/devicetree/bindings/input/stmpe-keypad.txt b/Documentation/devicetree/bindings/input/stmpe-keypad.txt
index 1b97222e8a0b..12bb771d66d4 100644
--- a/Documentation/devicetree/bindings/input/stmpe-keypad.txt
+++ b/Documentation/devicetree/bindings/input/stmpe-keypad.txt
@@ -8,6 +8,8 @@ Optional properties:
8 - debounce-interval : Debouncing interval time in milliseconds 8 - debounce-interval : Debouncing interval time in milliseconds
9 - st,scan-count : Scanning cycles elapsed before key data is updated 9 - st,scan-count : Scanning cycles elapsed before key data is updated
10 - st,no-autorepeat : If specified device will not autorepeat 10 - st,no-autorepeat : If specified device will not autorepeat
11 - keypad,num-rows : See ./matrix-keymap.txt
12 - keypad,num-columns : See ./matrix-keymap.txt
11 13
12Example: 14Example:
13 15
diff --git a/Makefile b/Makefile
index ef748e17702f..eb4eca56843a 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 3 1VERSION = 3
2PATCHLEVEL = 19 2PATCHLEVEL = 19
3SUBLEVEL = 0 3SUBLEVEL = 0
4EXTRAVERSION = -rc2 4EXTRAVERSION = -rc3
5NAME = Diseased Newt 5NAME = Diseased Newt
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
diff --git a/arch/arm/boot/dts/armada-370-db.dts b/arch/arm/boot/dts/armada-370-db.dts
index 1466580be295..70b1943a86b1 100644
--- a/arch/arm/boot/dts/armada-370-db.dts
+++ b/arch/arm/boot/dts/armada-370-db.dts
@@ -203,27 +203,3 @@
203 compatible = "linux,spdif-dir"; 203 compatible = "linux,spdif-dir";
204 }; 204 };
205}; 205};
206
207&pinctrl {
208 /*
209 * These pins might be muxed as I2S by
210 * the bootloader, but it conflicts
211 * with the real I2S pins that are
212 * muxed using i2s_pins. We must mux
213 * those pins to a function other than
214 * I2S.
215 */
216 pinctrl-0 = <&hog_pins1 &hog_pins2>;
217 pinctrl-names = "default";
218
219 hog_pins1: hog-pins1 {
220 marvell,pins = "mpp6", "mpp8", "mpp10",
221 "mpp12", "mpp13";
222 marvell,function = "gpio";
223 };
224
225 hog_pins2: hog-pins2 {
226 marvell,pins = "mpp5", "mpp7", "mpp9";
227 marvell,function = "gpo";
228 };
229};
diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig
index 2328fe752e9c..bc393b7e5ece 100644
--- a/arch/arm/configs/multi_v7_defconfig
+++ b/arch/arm/configs/multi_v7_defconfig
@@ -338,6 +338,7 @@ CONFIG_USB=y
338CONFIG_USB_XHCI_HCD=y 338CONFIG_USB_XHCI_HCD=y
339CONFIG_USB_XHCI_MVEBU=y 339CONFIG_USB_XHCI_MVEBU=y
340CONFIG_USB_EHCI_HCD=y 340CONFIG_USB_EHCI_HCD=y
341CONFIG_USB_EHCI_EXYNOS=y
341CONFIG_USB_EHCI_TEGRA=y 342CONFIG_USB_EHCI_TEGRA=y
342CONFIG_USB_EHCI_HCD_STI=y 343CONFIG_USB_EHCI_HCD_STI=y
343CONFIG_USB_EHCI_HCD_PLATFORM=y 344CONFIG_USB_EHCI_HCD_PLATFORM=y
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index f9c863911038..715ae19bc7c8 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -1046,6 +1046,15 @@ static int c_show(struct seq_file *m, void *v)
1046 seq_printf(m, "model name\t: %s rev %d (%s)\n", 1046 seq_printf(m, "model name\t: %s rev %d (%s)\n",
1047 cpu_name, cpuid & 15, elf_platform); 1047 cpu_name, cpuid & 15, elf_platform);
1048 1048
1049#if defined(CONFIG_SMP)
1050 seq_printf(m, "BogoMIPS\t: %lu.%02lu\n",
1051 per_cpu(cpu_data, i).loops_per_jiffy / (500000UL/HZ),
1052 (per_cpu(cpu_data, i).loops_per_jiffy / (5000UL/HZ)) % 100);
1053#else
1054 seq_printf(m, "BogoMIPS\t: %lu.%02lu\n",
1055 loops_per_jiffy / (500000/HZ),
1056 (loops_per_jiffy / (5000/HZ)) % 100);
1057#endif
1049 /* dump out the processor features */ 1058 /* dump out the processor features */
1050 seq_puts(m, "Features\t: "); 1059 seq_puts(m, "Features\t: ");
1051 1060
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index 5e6052e18850..86ef244c5a24 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -387,6 +387,18 @@ asmlinkage void secondary_start_kernel(void)
387 387
388void __init smp_cpus_done(unsigned int max_cpus) 388void __init smp_cpus_done(unsigned int max_cpus)
389{ 389{
390 int cpu;
391 unsigned long bogosum = 0;
392
393 for_each_online_cpu(cpu)
394 bogosum += per_cpu(cpu_data, cpu).loops_per_jiffy;
395
396 printk(KERN_INFO "SMP: Total of %d processors activated "
397 "(%lu.%02lu BogoMIPS).\n",
398 num_online_cpus(),
399 bogosum / (500000/HZ),
400 (bogosum / (5000/HZ)) % 100);
401
390 hyp_mode_check(); 402 hyp_mode_check();
391} 403}
392 404
diff --git a/arch/ia64/include/asm/unistd.h b/arch/ia64/include/asm/unistd.h
index f3b51b57740a..95c39b95e97e 100644
--- a/arch/ia64/include/asm/unistd.h
+++ b/arch/ia64/include/asm/unistd.h
@@ -11,7 +11,7 @@
11 11
12 12
13 13
14#define NR_syscalls 318 /* length of syscall table */ 14#define NR_syscalls 319 /* length of syscall table */
15 15
16/* 16/*
17 * The following defines stop scripts/checksyscalls.sh from complaining about 17 * The following defines stop scripts/checksyscalls.sh from complaining about
diff --git a/arch/ia64/include/uapi/asm/unistd.h b/arch/ia64/include/uapi/asm/unistd.h
index 4c2240c1b0cb..461079560c78 100644
--- a/arch/ia64/include/uapi/asm/unistd.h
+++ b/arch/ia64/include/uapi/asm/unistd.h
@@ -331,5 +331,6 @@
331#define __NR_getrandom 1339 331#define __NR_getrandom 1339
332#define __NR_memfd_create 1340 332#define __NR_memfd_create 1340
333#define __NR_bpf 1341 333#define __NR_bpf 1341
334#define __NR_execveat 1342
334 335
335#endif /* _UAPI_ASM_IA64_UNISTD_H */ 336#endif /* _UAPI_ASM_IA64_UNISTD_H */
diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S
index f5e96dffc63c..fcf8b8cbca0b 100644
--- a/arch/ia64/kernel/entry.S
+++ b/arch/ia64/kernel/entry.S
@@ -1779,6 +1779,7 @@ sys_call_table:
1779 data8 sys_getrandom 1779 data8 sys_getrandom
1780 data8 sys_memfd_create // 1340 1780 data8 sys_memfd_create // 1340
1781 data8 sys_bpf 1781 data8 sys_bpf
1782 data8 sys_execveat
1782 1783
1783 .org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls 1784 .org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls
1784#endif /* __IA64_ASM_PARAVIRTUALIZED_NATIVE */ 1785#endif /* __IA64_ASM_PARAVIRTUALIZED_NATIVE */
diff --git a/arch/nios2/kernel/cpuinfo.c b/arch/nios2/kernel/cpuinfo.c
index 51d5bb90d3e5..a223691dff4f 100644
--- a/arch/nios2/kernel/cpuinfo.c
+++ b/arch/nios2/kernel/cpuinfo.c
@@ -72,6 +72,7 @@ void __init setup_cpuinfo(void)
72 cpuinfo.has_div = fcpu_has(cpu, "altr,has-div"); 72 cpuinfo.has_div = fcpu_has(cpu, "altr,has-div");
73 cpuinfo.has_mul = fcpu_has(cpu, "altr,has-mul"); 73 cpuinfo.has_mul = fcpu_has(cpu, "altr,has-mul");
74 cpuinfo.has_mulx = fcpu_has(cpu, "altr,has-mulx"); 74 cpuinfo.has_mulx = fcpu_has(cpu, "altr,has-mulx");
75 cpuinfo.mmu = fcpu_has(cpu, "altr,has-mmu");
75 76
76 if (IS_ENABLED(CONFIG_NIOS2_HW_DIV_SUPPORT) && !cpuinfo.has_div) 77 if (IS_ENABLED(CONFIG_NIOS2_HW_DIV_SUPPORT) && !cpuinfo.has_div)
77 err_cpu("DIV"); 78 err_cpu("DIV");
diff --git a/arch/nios2/kernel/entry.S b/arch/nios2/kernel/entry.S
index 83bca17d1008..0bdfd13ff98b 100644
--- a/arch/nios2/kernel/entry.S
+++ b/arch/nios2/kernel/entry.S
@@ -365,30 +365,14 @@ ENTRY(ret_from_interrupt)
365 GET_THREAD_INFO r1 365 GET_THREAD_INFO r1
366 ldw r4, TI_PREEMPT_COUNT(r1) 366 ldw r4, TI_PREEMPT_COUNT(r1)
367 bne r4, r0, restore_all 367 bne r4, r0, restore_all
368
369need_resched:
370 ldw r4, TI_FLAGS(r1) /* ? Need resched set */ 368 ldw r4, TI_FLAGS(r1) /* ? Need resched set */
371 BTBZ r10, r4, TIF_NEED_RESCHED, restore_all 369 BTBZ r10, r4, TIF_NEED_RESCHED, restore_all
372 ldw r4, PT_ESTATUS(sp) /* ? Interrupts off */ 370 ldw r4, PT_ESTATUS(sp) /* ? Interrupts off */
373 andi r10, r4, ESTATUS_EPIE 371 andi r10, r4, ESTATUS_EPIE
374 beq r10, r0, restore_all 372 beq r10, r0, restore_all
375 movia r4, PREEMPT_ACTIVE 373 call preempt_schedule_irq
376 stw r4, TI_PREEMPT_COUNT(r1)
377 rdctl r10, status /* enable intrs again */
378 ori r10, r10 ,STATUS_PIE
379 wrctl status, r10
380 PUSH r1
381 call schedule
382 POP r1
383 mov r4, r0
384 stw r4, TI_PREEMPT_COUNT(r1)
385 rdctl r10, status /* disable intrs */
386 andi r10, r10, %lo(~STATUS_PIE)
387 wrctl status, r10
388 br need_resched
389#else
390 br restore_all
391#endif 374#endif
375 br restore_all
392 376
393/*********************************************************************** 377/***********************************************************************
394 * A few syscall wrappers 378 * A few syscall wrappers
diff --git a/arch/powerpc/include/asm/kexec.h b/arch/powerpc/include/asm/kexec.h
index 19c36cba37c4..a46f5f45570c 100644
--- a/arch/powerpc/include/asm/kexec.h
+++ b/arch/powerpc/include/asm/kexec.h
@@ -86,6 +86,11 @@ extern int overlaps_crashkernel(unsigned long start, unsigned long size);
86extern void reserve_crashkernel(void); 86extern void reserve_crashkernel(void);
87extern void machine_kexec_mask_interrupts(void); 87extern void machine_kexec_mask_interrupts(void);
88 88
89static inline bool kdump_in_progress(void)
90{
91 return crashing_cpu >= 0;
92}
93
89#else /* !CONFIG_KEXEC */ 94#else /* !CONFIG_KEXEC */
90static inline void crash_kexec_secondary(struct pt_regs *regs) { } 95static inline void crash_kexec_secondary(struct pt_regs *regs) { }
91 96
@@ -106,6 +111,11 @@ static inline int crash_shutdown_unregister(crash_shutdown_t handler)
106 return 0; 111 return 0;
107} 112}
108 113
114static inline bool kdump_in_progress(void)
115{
116 return false;
117}
118
109#endif /* CONFIG_KEXEC */ 119#endif /* CONFIG_KEXEC */
110#endif /* ! __ASSEMBLY__ */ 120#endif /* ! __ASSEMBLY__ */
111#endif /* __KERNEL__ */ 121#endif /* __KERNEL__ */
diff --git a/arch/powerpc/include/asm/systbl.h b/arch/powerpc/include/asm/systbl.h
index ce9577d693be..91062eef582f 100644
--- a/arch/powerpc/include/asm/systbl.h
+++ b/arch/powerpc/include/asm/systbl.h
@@ -366,3 +366,4 @@ SYSCALL_SPU(seccomp)
366SYSCALL_SPU(getrandom) 366SYSCALL_SPU(getrandom)
367SYSCALL_SPU(memfd_create) 367SYSCALL_SPU(memfd_create)
368SYSCALL_SPU(bpf) 368SYSCALL_SPU(bpf)
369COMPAT_SYS(execveat)
diff --git a/arch/powerpc/include/asm/unistd.h b/arch/powerpc/include/asm/unistd.h
index e0da021caa00..36b79c31eedd 100644
--- a/arch/powerpc/include/asm/unistd.h
+++ b/arch/powerpc/include/asm/unistd.h
@@ -12,7 +12,7 @@
12#include <uapi/asm/unistd.h> 12#include <uapi/asm/unistd.h>
13 13
14 14
15#define __NR_syscalls 362 15#define __NR_syscalls 363
16 16
17#define __NR__exit __NR_exit 17#define __NR__exit __NR_exit
18#define NR_syscalls __NR_syscalls 18#define NR_syscalls __NR_syscalls
diff --git a/arch/powerpc/include/uapi/asm/unistd.h b/arch/powerpc/include/uapi/asm/unistd.h
index f55351f2e66e..ef5b5b1f3123 100644
--- a/arch/powerpc/include/uapi/asm/unistd.h
+++ b/arch/powerpc/include/uapi/asm/unistd.h
@@ -384,5 +384,6 @@
384#define __NR_getrandom 359 384#define __NR_getrandom 359
385#define __NR_memfd_create 360 385#define __NR_memfd_create 360
386#define __NR_bpf 361 386#define __NR_bpf 361
387#define __NR_execveat 362
387 388
388#endif /* _UAPI_ASM_POWERPC_UNISTD_H_ */ 389#endif /* _UAPI_ASM_POWERPC_UNISTD_H_ */
diff --git a/arch/powerpc/kernel/machine_kexec_64.c b/arch/powerpc/kernel/machine_kexec_64.c
index 879b3aacac32..f96d1ec24189 100644
--- a/arch/powerpc/kernel/machine_kexec_64.c
+++ b/arch/powerpc/kernel/machine_kexec_64.c
@@ -330,7 +330,7 @@ void default_machine_kexec(struct kimage *image)
330 * using debugger IPI. 330 * using debugger IPI.
331 */ 331 */
332 332
333 if (crashing_cpu == -1) 333 if (!kdump_in_progress())
334 kexec_prepare_cpus(); 334 kexec_prepare_cpus();
335 335
336 pr_debug("kexec: Starting switchover sequence.\n"); 336 pr_debug("kexec: Starting switchover sequence.\n");
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index 8ec017cb4446..8b2d2dc8ef10 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -700,6 +700,7 @@ void start_secondary(void *unused)
700 smp_store_cpu_info(cpu); 700 smp_store_cpu_info(cpu);
701 set_dec(tb_ticks_per_jiffy); 701 set_dec(tb_ticks_per_jiffy);
702 preempt_disable(); 702 preempt_disable();
703 cpu_callin_map[cpu] = 1;
703 704
704 if (smp_ops->setup_cpu) 705 if (smp_ops->setup_cpu)
705 smp_ops->setup_cpu(cpu); 706 smp_ops->setup_cpu(cpu);
@@ -738,14 +739,6 @@ void start_secondary(void *unused)
738 notify_cpu_starting(cpu); 739 notify_cpu_starting(cpu);
739 set_cpu_online(cpu, true); 740 set_cpu_online(cpu, true);
740 741
741 /*
742 * CPU must be marked active and online before we signal back to the
743 * master, because the scheduler needs to see the cpu_online and
744 * cpu_active bits set.
745 */
746 smp_wmb();
747 cpu_callin_map[cpu] = 1;
748
749 local_irq_enable(); 742 local_irq_enable();
750 743
751 cpu_startup_entry(CPUHP_ONLINE); 744 cpu_startup_entry(CPUHP_ONLINE);
diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
index 469751d92004..b5682fd6c984 100644
--- a/arch/powerpc/platforms/pseries/lpar.c
+++ b/arch/powerpc/platforms/pseries/lpar.c
@@ -43,6 +43,7 @@
43#include <asm/trace.h> 43#include <asm/trace.h>
44#include <asm/firmware.h> 44#include <asm/firmware.h>
45#include <asm/plpar_wrappers.h> 45#include <asm/plpar_wrappers.h>
46#include <asm/kexec.h>
46#include <asm/fadump.h> 47#include <asm/fadump.h>
47 48
48#include "pseries.h" 49#include "pseries.h"
@@ -267,8 +268,13 @@ static void pSeries_lpar_hptab_clear(void)
267 * out to the user, but at least this will stop us from 268 * out to the user, but at least this will stop us from
268 * continuing on further and creating an even more 269 * continuing on further and creating an even more
269 * difficult to debug situation. 270 * difficult to debug situation.
271 *
272 * There is a known problem when kdump'ing, if cpus are offline
273 * the above call will fail. Rather than panicking again, keep
274 * going and hope the kdump kernel is also little endian, which
275 * it usually is.
270 */ 276 */
271 if (rc) 277 if (rc && !kdump_in_progress())
272 panic("Could not enable big endian exceptions"); 278 panic("Could not enable big endian exceptions");
273 } 279 }
274#endif 280#endif
diff --git a/arch/um/Kconfig.common b/arch/um/Kconfig.common
index 87bc86821bc9..d195a87ca542 100644
--- a/arch/um/Kconfig.common
+++ b/arch/um/Kconfig.common
@@ -3,6 +3,7 @@ config UML
3 default y 3 default y
4 select HAVE_ARCH_AUDITSYSCALL 4 select HAVE_ARCH_AUDITSYSCALL
5 select HAVE_UID16 5 select HAVE_UID16
6 select HAVE_FUTEX_CMPXCHG if FUTEX
6 select GENERIC_IRQ_SHOW 7 select GENERIC_IRQ_SHOW
7 select GENERIC_CPU_DEVICES 8 select GENERIC_CPU_DEVICES
8 select GENERIC_IO 9 select GENERIC_IO
diff --git a/arch/x86/um/sys_call_table_32.c b/arch/x86/um/sys_call_table_32.c
index 531d4269e2e3..bd16d6c370ec 100644
--- a/arch/x86/um/sys_call_table_32.c
+++ b/arch/x86/um/sys_call_table_32.c
@@ -34,7 +34,7 @@ typedef asmlinkage void (*sys_call_ptr_t)(void);
34 34
35extern asmlinkage void sys_ni_syscall(void); 35extern asmlinkage void sys_ni_syscall(void);
36 36
37const sys_call_ptr_t sys_call_table[] __cacheline_aligned = { 37const sys_call_ptr_t sys_call_table[] ____cacheline_aligned = {
38 /* 38 /*
39 * Smells like a compiler bug -- it doesn't work 39 * Smells like a compiler bug -- it doesn't work
40 * when the & below is removed. 40 * when the & below is removed.
diff --git a/arch/x86/um/sys_call_table_64.c b/arch/x86/um/sys_call_table_64.c
index 20c3649d0691..5cdfa9db2217 100644
--- a/arch/x86/um/sys_call_table_64.c
+++ b/arch/x86/um/sys_call_table_64.c
@@ -47,7 +47,7 @@ typedef void (*sys_call_ptr_t)(void);
47 47
48extern void sys_ni_syscall(void); 48extern void sys_ni_syscall(void);
49 49
50const sys_call_ptr_t sys_call_table[] __cacheline_aligned = { 50const sys_call_ptr_t sys_call_table[] ____cacheline_aligned = {
51 /* 51 /*
52 * Smells like a compiler bug -- it doesn't work 52 * Smells like a compiler bug -- it doesn't work
53 * when the & below is removed. 53 * when the & below is removed.
diff --git a/crypto/af_alg.c b/crypto/af_alg.c
index 1fa7bc31be63..4665b79c729a 100644
--- a/crypto/af_alg.c
+++ b/crypto/af_alg.c
@@ -455,6 +455,9 @@ void af_alg_complete(struct crypto_async_request *req, int err)
455{ 455{
456 struct af_alg_completion *completion = req->data; 456 struct af_alg_completion *completion = req->data;
457 457
458 if (err == -EINPROGRESS)
459 return;
460
458 completion->err = err; 461 completion->err = err;
459 complete(&completion->completion); 462 complete(&completion->completion);
460} 463}
diff --git a/drivers/char/ipmi/ipmi_ssif.c b/drivers/char/ipmi/ipmi_ssif.c
index fd5a5e85d7dc..982b96323f82 100644
--- a/drivers/char/ipmi/ipmi_ssif.c
+++ b/drivers/char/ipmi/ipmi_ssif.c
@@ -969,7 +969,8 @@ static void sender(void *send_info,
969 969
970 do_gettimeofday(&t); 970 do_gettimeofday(&t);
971 pr_info("**Enqueue %02x %02x: %ld.%6.6ld\n", 971 pr_info("**Enqueue %02x %02x: %ld.%6.6ld\n",
972 msg->data[0], msg->data[1], t.tv_sec, t.tv_usec); 972 msg->data[0], msg->data[1],
973 (long) t.tv_sec, (long) t.tv_usec);
973 } 974 }
974} 975}
975 976
diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c
index 8e67e72f8795..a3025e7ae35f 100644
--- a/drivers/clocksource/arm_arch_timer.c
+++ b/drivers/clocksource/arm_arch_timer.c
@@ -463,7 +463,7 @@ static void __init arch_counter_register(unsigned type)
463 463
464 /* Register the CP15 based counter if we have one */ 464 /* Register the CP15 based counter if we have one */
465 if (type & ARCH_CP15_TIMER) { 465 if (type & ARCH_CP15_TIMER) {
466 if (arch_timer_use_virtual) 466 if (IS_ENABLED(CONFIG_ARM64) || arch_timer_use_virtual)
467 arch_timer_read_counter = arch_counter_get_cntvct; 467 arch_timer_read_counter = arch_counter_get_cntvct;
468 else 468 else
469 arch_timer_read_counter = arch_counter_get_cntpct; 469 arch_timer_read_counter = arch_counter_get_cntpct;
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
index 8afa28e4570e..18d4b2c8fe55 100644
--- a/drivers/input/evdev.c
+++ b/drivers/input/evdev.c
@@ -28,6 +28,13 @@
28#include <linux/cdev.h> 28#include <linux/cdev.h>
29#include "input-compat.h" 29#include "input-compat.h"
30 30
31enum evdev_clock_type {
32 EV_CLK_REAL = 0,
33 EV_CLK_MONO,
34 EV_CLK_BOOT,
35 EV_CLK_MAX
36};
37
31struct evdev { 38struct evdev {
32 int open; 39 int open;
33 struct input_handle handle; 40 struct input_handle handle;
@@ -49,12 +56,32 @@ struct evdev_client {
49 struct fasync_struct *fasync; 56 struct fasync_struct *fasync;
50 struct evdev *evdev; 57 struct evdev *evdev;
51 struct list_head node; 58 struct list_head node;
52 int clkid; 59 int clk_type;
53 bool revoked; 60 bool revoked;
54 unsigned int bufsize; 61 unsigned int bufsize;
55 struct input_event buffer[]; 62 struct input_event buffer[];
56}; 63};
57 64
65static int evdev_set_clk_type(struct evdev_client *client, unsigned int clkid)
66{
67 switch (clkid) {
68
69 case CLOCK_REALTIME:
70 client->clk_type = EV_CLK_REAL;
71 break;
72 case CLOCK_MONOTONIC:
73 client->clk_type = EV_CLK_MONO;
74 break;
75 case CLOCK_BOOTTIME:
76 client->clk_type = EV_CLK_BOOT;
77 break;
78 default:
79 return -EINVAL;
80 }
81
82 return 0;
83}
84
58/* flush queued events of type @type, caller must hold client->buffer_lock */ 85/* flush queued events of type @type, caller must hold client->buffer_lock */
59static void __evdev_flush_queue(struct evdev_client *client, unsigned int type) 86static void __evdev_flush_queue(struct evdev_client *client, unsigned int type)
60{ 87{
@@ -108,8 +135,11 @@ static void evdev_queue_syn_dropped(struct evdev_client *client)
108 struct input_event ev; 135 struct input_event ev;
109 ktime_t time; 136 ktime_t time;
110 137
111 time = (client->clkid == CLOCK_MONOTONIC) ? 138 time = client->clk_type == EV_CLK_REAL ?
112 ktime_get() : ktime_get_real(); 139 ktime_get_real() :
140 client->clk_type == EV_CLK_MONO ?
141 ktime_get() :
142 ktime_get_boottime();
113 143
114 ev.time = ktime_to_timeval(time); 144 ev.time = ktime_to_timeval(time);
115 ev.type = EV_SYN; 145 ev.type = EV_SYN;
@@ -159,7 +189,7 @@ static void __pass_event(struct evdev_client *client,
159 189
160static void evdev_pass_values(struct evdev_client *client, 190static void evdev_pass_values(struct evdev_client *client,
161 const struct input_value *vals, unsigned int count, 191 const struct input_value *vals, unsigned int count,
162 ktime_t mono, ktime_t real) 192 ktime_t *ev_time)
163{ 193{
164 struct evdev *evdev = client->evdev; 194 struct evdev *evdev = client->evdev;
165 const struct input_value *v; 195 const struct input_value *v;
@@ -169,8 +199,7 @@ static void evdev_pass_values(struct evdev_client *client,
169 if (client->revoked) 199 if (client->revoked)
170 return; 200 return;
171 201
172 event.time = ktime_to_timeval(client->clkid == CLOCK_MONOTONIC ? 202 event.time = ktime_to_timeval(ev_time[client->clk_type]);
173 mono : real);
174 203
175 /* Interrupts are disabled, just acquire the lock. */ 204 /* Interrupts are disabled, just acquire the lock. */
176 spin_lock(&client->buffer_lock); 205 spin_lock(&client->buffer_lock);
@@ -198,21 +227,22 @@ static void evdev_events(struct input_handle *handle,
198{ 227{
199 struct evdev *evdev = handle->private; 228 struct evdev *evdev = handle->private;
200 struct evdev_client *client; 229 struct evdev_client *client;
201 ktime_t time_mono, time_real; 230 ktime_t ev_time[EV_CLK_MAX];
202 231
203 time_mono = ktime_get(); 232 ev_time[EV_CLK_MONO] = ktime_get();
204 time_real = ktime_mono_to_real(time_mono); 233 ev_time[EV_CLK_REAL] = ktime_mono_to_real(ev_time[EV_CLK_MONO]);
234 ev_time[EV_CLK_BOOT] = ktime_mono_to_any(ev_time[EV_CLK_MONO],
235 TK_OFFS_BOOT);
205 236
206 rcu_read_lock(); 237 rcu_read_lock();
207 238
208 client = rcu_dereference(evdev->grab); 239 client = rcu_dereference(evdev->grab);
209 240
210 if (client) 241 if (client)
211 evdev_pass_values(client, vals, count, time_mono, time_real); 242 evdev_pass_values(client, vals, count, ev_time);
212 else 243 else
213 list_for_each_entry_rcu(client, &evdev->client_list, node) 244 list_for_each_entry_rcu(client, &evdev->client_list, node)
214 evdev_pass_values(client, vals, count, 245 evdev_pass_values(client, vals, count, ev_time);
215 time_mono, time_real);
216 246
217 rcu_read_unlock(); 247 rcu_read_unlock();
218} 248}
@@ -877,10 +907,8 @@ static long evdev_do_ioctl(struct file *file, unsigned int cmd,
877 case EVIOCSCLOCKID: 907 case EVIOCSCLOCKID:
878 if (copy_from_user(&i, p, sizeof(unsigned int))) 908 if (copy_from_user(&i, p, sizeof(unsigned int)))
879 return -EFAULT; 909 return -EFAULT;
880 if (i != CLOCK_MONOTONIC && i != CLOCK_REALTIME) 910
881 return -EINVAL; 911 return evdev_set_clk_type(client, i);
882 client->clkid = i;
883 return 0;
884 912
885 case EVIOCGKEYCODE: 913 case EVIOCGKEYCODE:
886 return evdev_handle_get_keycode(dev, p); 914 return evdev_handle_get_keycode(dev, p);
diff --git a/drivers/input/input.c b/drivers/input/input.c
index 04217c2e345c..213e3a1903ee 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -1974,18 +1974,22 @@ static unsigned int input_estimate_events_per_packet(struct input_dev *dev)
1974 1974
1975 events = mt_slots + 1; /* count SYN_MT_REPORT and SYN_REPORT */ 1975 events = mt_slots + 1; /* count SYN_MT_REPORT and SYN_REPORT */
1976 1976
1977 for (i = 0; i < ABS_CNT; i++) { 1977 if (test_bit(EV_ABS, dev->evbit)) {
1978 if (test_bit(i, dev->absbit)) { 1978 for (i = 0; i < ABS_CNT; i++) {
1979 if (input_is_mt_axis(i)) 1979 if (test_bit(i, dev->absbit)) {
1980 events += mt_slots; 1980 if (input_is_mt_axis(i))
1981 else 1981 events += mt_slots;
1982 events++; 1982 else
1983 events++;
1984 }
1983 } 1985 }
1984 } 1986 }
1985 1987
1986 for (i = 0; i < REL_CNT; i++) 1988 if (test_bit(EV_REL, dev->evbit)) {
1987 if (test_bit(i, dev->relbit)) 1989 for (i = 0; i < REL_CNT; i++)
1988 events++; 1990 if (test_bit(i, dev->relbit))
1991 events++;
1992 }
1989 1993
1990 /* Make room for KEY and MSC events */ 1994 /* Make room for KEY and MSC events */
1991 events += 7; 1995 events += 7;
diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
index 96ee26c555e0..a5d9b3f3c871 100644
--- a/drivers/input/keyboard/Kconfig
+++ b/drivers/input/keyboard/Kconfig
@@ -559,6 +559,7 @@ config KEYBOARD_SH_KEYSC
559config KEYBOARD_STMPE 559config KEYBOARD_STMPE
560 tristate "STMPE keypad support" 560 tristate "STMPE keypad support"
561 depends on MFD_STMPE 561 depends on MFD_STMPE
562 depends on OF
562 select INPUT_MATRIXKMAP 563 select INPUT_MATRIXKMAP
563 help 564 help
564 Say Y here if you want to use the keypad controller on STMPE I/O 565 Say Y here if you want to use the keypad controller on STMPE I/O
diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
index d4dd78a7d56b..883d6aed5b9a 100644
--- a/drivers/input/keyboard/gpio_keys.c
+++ b/drivers/input/keyboard/gpio_keys.c
@@ -35,9 +35,13 @@
35struct gpio_button_data { 35struct gpio_button_data {
36 const struct gpio_keys_button *button; 36 const struct gpio_keys_button *button;
37 struct input_dev *input; 37 struct input_dev *input;
38 struct timer_list timer; 38
39 struct work_struct work; 39 struct timer_list release_timer;
40 unsigned int timer_debounce; /* in msecs */ 40 unsigned int release_delay; /* in msecs, for IRQ-only buttons */
41
42 struct delayed_work work;
43 unsigned int software_debounce; /* in msecs, for GPIO-driven buttons */
44
41 unsigned int irq; 45 unsigned int irq;
42 spinlock_t lock; 46 spinlock_t lock;
43 bool disabled; 47 bool disabled;
@@ -116,11 +120,14 @@ static void gpio_keys_disable_button(struct gpio_button_data *bdata)
116{ 120{
117 if (!bdata->disabled) { 121 if (!bdata->disabled) {
118 /* 122 /*
119 * Disable IRQ and possible debouncing timer. 123 * Disable IRQ and associated timer/work structure.
120 */ 124 */
121 disable_irq(bdata->irq); 125 disable_irq(bdata->irq);
122 if (bdata->timer_debounce) 126
123 del_timer_sync(&bdata->timer); 127 if (gpio_is_valid(bdata->button->gpio))
128 cancel_delayed_work_sync(&bdata->work);
129 else
130 del_timer_sync(&bdata->release_timer);
124 131
125 bdata->disabled = true; 132 bdata->disabled = true;
126 } 133 }
@@ -343,7 +350,7 @@ static void gpio_keys_gpio_report_event(struct gpio_button_data *bdata)
343static void gpio_keys_gpio_work_func(struct work_struct *work) 350static void gpio_keys_gpio_work_func(struct work_struct *work)
344{ 351{
345 struct gpio_button_data *bdata = 352 struct gpio_button_data *bdata =
346 container_of(work, struct gpio_button_data, work); 353 container_of(work, struct gpio_button_data, work.work);
347 354
348 gpio_keys_gpio_report_event(bdata); 355 gpio_keys_gpio_report_event(bdata);
349 356
@@ -351,13 +358,6 @@ static void gpio_keys_gpio_work_func(struct work_struct *work)
351 pm_relax(bdata->input->dev.parent); 358 pm_relax(bdata->input->dev.parent);
352} 359}
353 360
354static void gpio_keys_gpio_timer(unsigned long _data)
355{
356 struct gpio_button_data *bdata = (struct gpio_button_data *)_data;
357
358 schedule_work(&bdata->work);
359}
360
361static irqreturn_t gpio_keys_gpio_isr(int irq, void *dev_id) 361static irqreturn_t gpio_keys_gpio_isr(int irq, void *dev_id)
362{ 362{
363 struct gpio_button_data *bdata = dev_id; 363 struct gpio_button_data *bdata = dev_id;
@@ -366,11 +366,10 @@ static irqreturn_t gpio_keys_gpio_isr(int irq, void *dev_id)
366 366
367 if (bdata->button->wakeup) 367 if (bdata->button->wakeup)
368 pm_stay_awake(bdata->input->dev.parent); 368 pm_stay_awake(bdata->input->dev.parent);
369 if (bdata->timer_debounce) 369
370 mod_timer(&bdata->timer, 370 mod_delayed_work(system_wq,
371 jiffies + msecs_to_jiffies(bdata->timer_debounce)); 371 &bdata->work,
372 else 372 msecs_to_jiffies(bdata->software_debounce));
373 schedule_work(&bdata->work);
374 373
375 return IRQ_HANDLED; 374 return IRQ_HANDLED;
376} 375}
@@ -408,7 +407,7 @@ static irqreturn_t gpio_keys_irq_isr(int irq, void *dev_id)
408 input_event(input, EV_KEY, button->code, 1); 407 input_event(input, EV_KEY, button->code, 1);
409 input_sync(input); 408 input_sync(input);
410 409
411 if (!bdata->timer_debounce) { 410 if (!bdata->release_delay) {
412 input_event(input, EV_KEY, button->code, 0); 411 input_event(input, EV_KEY, button->code, 0);
413 input_sync(input); 412 input_sync(input);
414 goto out; 413 goto out;
@@ -417,9 +416,9 @@ static irqreturn_t gpio_keys_irq_isr(int irq, void *dev_id)
417 bdata->key_pressed = true; 416 bdata->key_pressed = true;
418 } 417 }
419 418
420 if (bdata->timer_debounce) 419 if (bdata->release_delay)
421 mod_timer(&bdata->timer, 420 mod_timer(&bdata->release_timer,
422 jiffies + msecs_to_jiffies(bdata->timer_debounce)); 421 jiffies + msecs_to_jiffies(bdata->release_delay));
423out: 422out:
424 spin_unlock_irqrestore(&bdata->lock, flags); 423 spin_unlock_irqrestore(&bdata->lock, flags);
425 return IRQ_HANDLED; 424 return IRQ_HANDLED;
@@ -429,10 +428,10 @@ static void gpio_keys_quiesce_key(void *data)
429{ 428{
430 struct gpio_button_data *bdata = data; 429 struct gpio_button_data *bdata = data;
431 430
432 if (bdata->timer_debounce) 431 if (gpio_is_valid(bdata->button->gpio))
433 del_timer_sync(&bdata->timer); 432 cancel_delayed_work_sync(&bdata->work);
434 433 else
435 cancel_work_sync(&bdata->work); 434 del_timer_sync(&bdata->release_timer);
436} 435}
437 436
438static int gpio_keys_setup_key(struct platform_device *pdev, 437static int gpio_keys_setup_key(struct platform_device *pdev,
@@ -466,23 +465,25 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
466 button->debounce_interval * 1000); 465 button->debounce_interval * 1000);
467 /* use timer if gpiolib doesn't provide debounce */ 466 /* use timer if gpiolib doesn't provide debounce */
468 if (error < 0) 467 if (error < 0)
469 bdata->timer_debounce = 468 bdata->software_debounce =
470 button->debounce_interval; 469 button->debounce_interval;
471 } 470 }
472 471
473 irq = gpio_to_irq(button->gpio); 472 if (button->irq) {
474 if (irq < 0) { 473 bdata->irq = button->irq;
475 error = irq; 474 } else {
476 dev_err(dev, 475 irq = gpio_to_irq(button->gpio);
477 "Unable to get irq number for GPIO %d, error %d\n", 476 if (irq < 0) {
478 button->gpio, error); 477 error = irq;
479 return error; 478 dev_err(dev,
479 "Unable to get irq number for GPIO %d, error %d\n",
480 button->gpio, error);
481 return error;
482 }
483 bdata->irq = irq;
480 } 484 }
481 bdata->irq = irq;
482 485
483 INIT_WORK(&bdata->work, gpio_keys_gpio_work_func); 486 INIT_DELAYED_WORK(&bdata->work, gpio_keys_gpio_work_func);
484 setup_timer(&bdata->timer,
485 gpio_keys_gpio_timer, (unsigned long)bdata);
486 487
487 isr = gpio_keys_gpio_isr; 488 isr = gpio_keys_gpio_isr;
488 irqflags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING; 489 irqflags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING;
@@ -499,8 +500,8 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
499 return -EINVAL; 500 return -EINVAL;
500 } 501 }
501 502
502 bdata->timer_debounce = button->debounce_interval; 503 bdata->release_delay = button->debounce_interval;
503 setup_timer(&bdata->timer, 504 setup_timer(&bdata->release_timer,
504 gpio_keys_irq_timer, (unsigned long)bdata); 505 gpio_keys_irq_timer, (unsigned long)bdata);
505 506
506 isr = gpio_keys_irq_isr; 507 isr = gpio_keys_irq_isr;
@@ -510,7 +511,7 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
510 input_set_capability(input, button->type ?: EV_KEY, button->code); 511 input_set_capability(input, button->type ?: EV_KEY, button->code);
511 512
512 /* 513 /*
513 * Install custom action to cancel debounce timer and 514 * Install custom action to cancel release timer and
514 * workqueue item. 515 * workqueue item.
515 */ 516 */
516 error = devm_add_action(&pdev->dev, gpio_keys_quiesce_key, bdata); 517 error = devm_add_action(&pdev->dev, gpio_keys_quiesce_key, bdata);
@@ -618,33 +619,30 @@ gpio_keys_get_devtree_pdata(struct device *dev)
618 619
619 i = 0; 620 i = 0;
620 for_each_child_of_node(node, pp) { 621 for_each_child_of_node(node, pp) {
621 int gpio = -1;
622 enum of_gpio_flags flags; 622 enum of_gpio_flags flags;
623 623
624 button = &pdata->buttons[i++]; 624 button = &pdata->buttons[i++];
625 625
626 if (!of_find_property(pp, "gpios", NULL)) { 626 button->gpio = of_get_gpio_flags(pp, 0, &flags);
627 button->irq = irq_of_parse_and_map(pp, 0); 627 if (button->gpio < 0) {
628 if (button->irq == 0) { 628 error = button->gpio;
629 i--; 629 if (error != -ENOENT) {
630 pdata->nbuttons--;
631 dev_warn(dev, "Found button without gpios or irqs\n");
632 continue;
633 }
634 } else {
635 gpio = of_get_gpio_flags(pp, 0, &flags);
636 if (gpio < 0) {
637 error = gpio;
638 if (error != -EPROBE_DEFER) 630 if (error != -EPROBE_DEFER)
639 dev_err(dev, 631 dev_err(dev,
640 "Failed to get gpio flags, error: %d\n", 632 "Failed to get gpio flags, error: %d\n",
641 error); 633 error);
642 return ERR_PTR(error); 634 return ERR_PTR(error);
643 } 635 }
636 } else {
637 button->active_low = flags & OF_GPIO_ACTIVE_LOW;
644 } 638 }
645 639
646 button->gpio = gpio; 640 button->irq = irq_of_parse_and_map(pp, 0);
647 button->active_low = flags & OF_GPIO_ACTIVE_LOW; 641
642 if (!gpio_is_valid(button->gpio) && !button->irq) {
643 dev_err(dev, "Found button without gpios or irqs\n");
644 return ERR_PTR(-EINVAL);
645 }
648 646
649 if (of_property_read_u32(pp, "linux,code", &button->code)) { 647 if (of_property_read_u32(pp, "linux,code", &button->code)) {
650 dev_err(dev, "Button without keycode: 0x%x\n", 648 dev_err(dev, "Button without keycode: 0x%x\n",
@@ -659,6 +657,8 @@ gpio_keys_get_devtree_pdata(struct device *dev)
659 657
660 button->wakeup = !!of_get_property(pp, "gpio-key,wakeup", NULL); 658 button->wakeup = !!of_get_property(pp, "gpio-key,wakeup", NULL);
661 659
660 button->can_disable = !!of_get_property(pp, "linux,can-disable", NULL);
661
662 if (of_property_read_u32(pp, "debounce-interval", 662 if (of_property_read_u32(pp, "debounce-interval",
663 &button->debounce_interval)) 663 &button->debounce_interval))
664 button->debounce_interval = 5; 664 button->debounce_interval = 5;
diff --git a/drivers/input/keyboard/hil_kbd.c b/drivers/input/keyboard/hil_kbd.c
index 610a8af795a1..5b152f25a8e1 100644
--- a/drivers/input/keyboard/hil_kbd.c
+++ b/drivers/input/keyboard/hil_kbd.c
@@ -473,7 +473,7 @@ static int hil_dev_connect(struct serio *serio, struct serio_driver *drv)
473 if (error) 473 if (error)
474 goto bail1; 474 goto bail1;
475 475
476 init_completion(&dev->cmd_done); 476 reinit_completion(&dev->cmd_done);
477 serio_write(serio, 0); 477 serio_write(serio, 0);
478 serio_write(serio, 0); 478 serio_write(serio, 0);
479 serio_write(serio, HIL_PKT_CMD >> 8); 479 serio_write(serio, HIL_PKT_CMD >> 8);
@@ -482,7 +482,7 @@ static int hil_dev_connect(struct serio *serio, struct serio_driver *drv)
482 if (error) 482 if (error)
483 goto bail1; 483 goto bail1;
484 484
485 init_completion(&dev->cmd_done); 485 reinit_completion(&dev->cmd_done);
486 serio_write(serio, 0); 486 serio_write(serio, 0);
487 serio_write(serio, 0); 487 serio_write(serio, 0);
488 serio_write(serio, HIL_PKT_CMD >> 8); 488 serio_write(serio, HIL_PKT_CMD >> 8);
@@ -491,7 +491,7 @@ static int hil_dev_connect(struct serio *serio, struct serio_driver *drv)
491 if (error) 491 if (error)
492 goto bail1; 492 goto bail1;
493 493
494 init_completion(&dev->cmd_done); 494 reinit_completion(&dev->cmd_done);
495 serio_write(serio, 0); 495 serio_write(serio, 0);
496 serio_write(serio, 0); 496 serio_write(serio, 0);
497 serio_write(serio, HIL_PKT_CMD >> 8); 497 serio_write(serio, HIL_PKT_CMD >> 8);
diff --git a/drivers/input/keyboard/stmpe-keypad.c b/drivers/input/keyboard/stmpe-keypad.c
index ef5e67fb567e..fe6e3f22eed7 100644
--- a/drivers/input/keyboard/stmpe-keypad.c
+++ b/drivers/input/keyboard/stmpe-keypad.c
@@ -45,13 +45,14 @@
45#define STMPE_KEYPAD_MAX_ROWS 8 45#define STMPE_KEYPAD_MAX_ROWS 8
46#define STMPE_KEYPAD_MAX_COLS 8 46#define STMPE_KEYPAD_MAX_COLS 8
47#define STMPE_KEYPAD_ROW_SHIFT 3 47#define STMPE_KEYPAD_ROW_SHIFT 3
48#define STMPE_KEYPAD_KEYMAP_SIZE \ 48#define STMPE_KEYPAD_KEYMAP_MAX_SIZE \
49 (STMPE_KEYPAD_MAX_ROWS * STMPE_KEYPAD_MAX_COLS) 49 (STMPE_KEYPAD_MAX_ROWS * STMPE_KEYPAD_MAX_COLS)
50 50
51/** 51/**
52 * struct stmpe_keypad_variant - model-specific attributes 52 * struct stmpe_keypad_variant - model-specific attributes
53 * @auto_increment: whether the KPC_DATA_BYTE register address 53 * @auto_increment: whether the KPC_DATA_BYTE register address
54 * auto-increments on multiple read 54 * auto-increments on multiple read
55 * @set_pullup: whether the pins need to have their pull-ups set
55 * @num_data: number of data bytes 56 * @num_data: number of data bytes
56 * @num_normal_data: number of normal keys' data bytes 57 * @num_normal_data: number of normal keys' data bytes
57 * @max_cols: maximum number of columns supported 58 * @max_cols: maximum number of columns supported
@@ -61,6 +62,7 @@
61 */ 62 */
62struct stmpe_keypad_variant { 63struct stmpe_keypad_variant {
63 bool auto_increment; 64 bool auto_increment;
65 bool set_pullup;
64 int num_data; 66 int num_data;
65 int num_normal_data; 67 int num_normal_data;
66 int max_cols; 68 int max_cols;
@@ -81,6 +83,7 @@ static const struct stmpe_keypad_variant stmpe_keypad_variants[] = {
81 }, 83 },
82 [STMPE2401] = { 84 [STMPE2401] = {
83 .auto_increment = false, 85 .auto_increment = false,
86 .set_pullup = true,
84 .num_data = 3, 87 .num_data = 3,
85 .num_normal_data = 2, 88 .num_normal_data = 2,
86 .max_cols = 8, 89 .max_cols = 8,
@@ -90,6 +93,7 @@ static const struct stmpe_keypad_variant stmpe_keypad_variants[] = {
90 }, 93 },
91 [STMPE2403] = { 94 [STMPE2403] = {
92 .auto_increment = true, 95 .auto_increment = true,
96 .set_pullup = true,
93 .num_data = 5, 97 .num_data = 5,
94 .num_normal_data = 3, 98 .num_normal_data = 3,
95 .max_cols = 8, 99 .max_cols = 8,
@@ -99,16 +103,30 @@ static const struct stmpe_keypad_variant stmpe_keypad_variants[] = {
99 }, 103 },
100}; 104};
101 105
106/**
107 * struct stmpe_keypad - STMPE keypad state container
108 * @stmpe: pointer to parent STMPE device
109 * @input: spawned input device
110 * @variant: STMPE variant
111 * @debounce_ms: debounce interval, in ms. Maximum is
112 * %STMPE_KEYPAD_MAX_DEBOUNCE.
113 * @scan_count: number of key scanning cycles to confirm key data.
114 * Maximum is %STMPE_KEYPAD_MAX_SCAN_COUNT.
115 * @no_autorepeat: disable key autorepeat
116 * @rows: bitmask for the rows
117 * @cols: bitmask for the columns
118 * @keymap: the keymap
119 */
102struct stmpe_keypad { 120struct stmpe_keypad {
103 struct stmpe *stmpe; 121 struct stmpe *stmpe;
104 struct input_dev *input; 122 struct input_dev *input;
105 const struct stmpe_keypad_variant *variant; 123 const struct stmpe_keypad_variant *variant;
106 const struct stmpe_keypad_platform_data *plat; 124 unsigned int debounce_ms;
107 125 unsigned int scan_count;
126 bool no_autorepeat;
108 unsigned int rows; 127 unsigned int rows;
109 unsigned int cols; 128 unsigned int cols;
110 129 unsigned short keymap[STMPE_KEYPAD_KEYMAP_MAX_SIZE];
111 unsigned short keymap[STMPE_KEYPAD_KEYMAP_SIZE];
112}; 130};
113 131
114static int stmpe_keypad_read_data(struct stmpe_keypad *keypad, u8 *data) 132static int stmpe_keypad_read_data(struct stmpe_keypad *keypad, u8 *data)
@@ -171,7 +189,10 @@ static int stmpe_keypad_altfunc_init(struct stmpe_keypad *keypad)
171 unsigned int col_gpios = variant->col_gpios; 189 unsigned int col_gpios = variant->col_gpios;
172 unsigned int row_gpios = variant->row_gpios; 190 unsigned int row_gpios = variant->row_gpios;
173 struct stmpe *stmpe = keypad->stmpe; 191 struct stmpe *stmpe = keypad->stmpe;
192 u8 pureg = stmpe->regs[STMPE_IDX_GPPUR_LSB];
174 unsigned int pins = 0; 193 unsigned int pins = 0;
194 unsigned int pu_pins = 0;
195 int ret;
175 int i; 196 int i;
176 197
177 /* 198 /*
@@ -188,8 +209,10 @@ static int stmpe_keypad_altfunc_init(struct stmpe_keypad *keypad)
188 for (i = 0; i < variant->max_cols; i++) { 209 for (i = 0; i < variant->max_cols; i++) {
189 int num = __ffs(col_gpios); 210 int num = __ffs(col_gpios);
190 211
191 if (keypad->cols & (1 << i)) 212 if (keypad->cols & (1 << i)) {
192 pins |= 1 << num; 213 pins |= 1 << num;
214 pu_pins |= 1 << num;
215 }
193 216
194 col_gpios &= ~(1 << num); 217 col_gpios &= ~(1 << num);
195 } 218 }
@@ -203,20 +226,43 @@ static int stmpe_keypad_altfunc_init(struct stmpe_keypad *keypad)
203 row_gpios &= ~(1 << num); 226 row_gpios &= ~(1 << num);
204 } 227 }
205 228
206 return stmpe_set_altfunc(stmpe, pins, STMPE_BLOCK_KEYPAD); 229 ret = stmpe_set_altfunc(stmpe, pins, STMPE_BLOCK_KEYPAD);
230 if (ret)
231 return ret;
232
233 /*
234 * On STMPE24xx, set pin bias to pull-up on all keypad input
235 * pins (columns), this incidentally happen to be maximum 8 pins
236 * and placed at GPIO0-7 so only the LSB of the pull up register
237 * ever needs to be written.
238 */
239 if (variant->set_pullup) {
240 u8 val;
241
242 ret = stmpe_reg_read(stmpe, pureg);
243 if (ret)
244 return ret;
245
246 /* Do not touch unused pins, may be used for GPIO */
247 val = ret & ~pu_pins;
248 val |= pu_pins;
249
250 ret = stmpe_reg_write(stmpe, pureg, val);
251 }
252
253 return 0;
207} 254}
208 255
209static int stmpe_keypad_chip_init(struct stmpe_keypad *keypad) 256static int stmpe_keypad_chip_init(struct stmpe_keypad *keypad)
210{ 257{
211 const struct stmpe_keypad_platform_data *plat = keypad->plat;
212 const struct stmpe_keypad_variant *variant = keypad->variant; 258 const struct stmpe_keypad_variant *variant = keypad->variant;
213 struct stmpe *stmpe = keypad->stmpe; 259 struct stmpe *stmpe = keypad->stmpe;
214 int ret; 260 int ret;
215 261
216 if (plat->debounce_ms > STMPE_KEYPAD_MAX_DEBOUNCE) 262 if (keypad->debounce_ms > STMPE_KEYPAD_MAX_DEBOUNCE)
217 return -EINVAL; 263 return -EINVAL;
218 264
219 if (plat->scan_count > STMPE_KEYPAD_MAX_SCAN_COUNT) 265 if (keypad->scan_count > STMPE_KEYPAD_MAX_SCAN_COUNT)
220 return -EINVAL; 266 return -EINVAL;
221 267
222 ret = stmpe_enable(stmpe, STMPE_BLOCK_KEYPAD); 268 ret = stmpe_enable(stmpe, STMPE_BLOCK_KEYPAD);
@@ -245,7 +291,7 @@ static int stmpe_keypad_chip_init(struct stmpe_keypad *keypad)
245 291
246 ret = stmpe_set_bits(stmpe, STMPE_KPC_CTRL_MSB, 292 ret = stmpe_set_bits(stmpe, STMPE_KPC_CTRL_MSB,
247 STMPE_KPC_CTRL_MSB_SCAN_COUNT, 293 STMPE_KPC_CTRL_MSB_SCAN_COUNT,
248 plat->scan_count << 4); 294 keypad->scan_count << 4);
249 if (ret < 0) 295 if (ret < 0)
250 return ret; 296 return ret;
251 297
@@ -253,17 +299,18 @@ static int stmpe_keypad_chip_init(struct stmpe_keypad *keypad)
253 STMPE_KPC_CTRL_LSB_SCAN | 299 STMPE_KPC_CTRL_LSB_SCAN |
254 STMPE_KPC_CTRL_LSB_DEBOUNCE, 300 STMPE_KPC_CTRL_LSB_DEBOUNCE,
255 STMPE_KPC_CTRL_LSB_SCAN | 301 STMPE_KPC_CTRL_LSB_SCAN |
256 (plat->debounce_ms << 1)); 302 (keypad->debounce_ms << 1));
257} 303}
258 304
259static void stmpe_keypad_fill_used_pins(struct stmpe_keypad *keypad) 305static void stmpe_keypad_fill_used_pins(struct stmpe_keypad *keypad,
306 u32 used_rows, u32 used_cols)
260{ 307{
261 int row, col; 308 int row, col;
262 309
263 for (row = 0; row < STMPE_KEYPAD_MAX_ROWS; row++) { 310 for (row = 0; row < used_rows; row++) {
264 for (col = 0; col < STMPE_KEYPAD_MAX_COLS; col++) { 311 for (col = 0; col < used_cols; col++) {
265 int code = MATRIX_SCAN_CODE(row, col, 312 int code = MATRIX_SCAN_CODE(row, col,
266 STMPE_KEYPAD_ROW_SHIFT); 313 STMPE_KEYPAD_ROW_SHIFT);
267 if (keypad->keymap[code] != KEY_RESERVED) { 314 if (keypad->keymap[code] != KEY_RESERVED) {
268 keypad->rows |= 1 << row; 315 keypad->rows |= 1 << row;
269 keypad->cols |= 1 << col; 316 keypad->cols |= 1 << col;
@@ -272,51 +319,17 @@ static void stmpe_keypad_fill_used_pins(struct stmpe_keypad *keypad)
272 } 319 }
273} 320}
274 321
275#ifdef CONFIG_OF
276static const struct stmpe_keypad_platform_data *
277stmpe_keypad_of_probe(struct device *dev)
278{
279 struct device_node *np = dev->of_node;
280 struct stmpe_keypad_platform_data *plat;
281
282 if (!np)
283 return ERR_PTR(-ENODEV);
284
285 plat = devm_kzalloc(dev, sizeof(*plat), GFP_KERNEL);
286 if (!plat)
287 return ERR_PTR(-ENOMEM);
288
289 of_property_read_u32(np, "debounce-interval", &plat->debounce_ms);
290 of_property_read_u32(np, "st,scan-count", &plat->scan_count);
291
292 plat->no_autorepeat = of_property_read_bool(np, "st,no-autorepeat");
293
294 return plat;
295}
296#else
297static inline const struct stmpe_keypad_platform_data *
298stmpe_keypad_of_probe(struct device *dev)
299{
300 return ERR_PTR(-EINVAL);
301}
302#endif
303
304static int stmpe_keypad_probe(struct platform_device *pdev) 322static int stmpe_keypad_probe(struct platform_device *pdev)
305{ 323{
306 struct stmpe *stmpe = dev_get_drvdata(pdev->dev.parent); 324 struct stmpe *stmpe = dev_get_drvdata(pdev->dev.parent);
307 const struct stmpe_keypad_platform_data *plat; 325 struct device_node *np = pdev->dev.of_node;
308 struct stmpe_keypad *keypad; 326 struct stmpe_keypad *keypad;
309 struct input_dev *input; 327 struct input_dev *input;
328 u32 rows;
329 u32 cols;
310 int error; 330 int error;
311 int irq; 331 int irq;
312 332
313 plat = stmpe->pdata->keypad;
314 if (!plat) {
315 plat = stmpe_keypad_of_probe(&pdev->dev);
316 if (IS_ERR(plat))
317 return PTR_ERR(plat);
318 }
319
320 irq = platform_get_irq(pdev, 0); 333 irq = platform_get_irq(pdev, 0);
321 if (irq < 0) 334 if (irq < 0)
322 return irq; 335 return irq;
@@ -326,6 +339,13 @@ static int stmpe_keypad_probe(struct platform_device *pdev)
326 if (!keypad) 339 if (!keypad)
327 return -ENOMEM; 340 return -ENOMEM;
328 341
342 keypad->stmpe = stmpe;
343 keypad->variant = &stmpe_keypad_variants[stmpe->partnum];
344
345 of_property_read_u32(np, "debounce-interval", &keypad->debounce_ms);
346 of_property_read_u32(np, "st,scan-count", &keypad->scan_count);
347 keypad->no_autorepeat = of_property_read_bool(np, "st,no-autorepeat");
348
329 input = devm_input_allocate_device(&pdev->dev); 349 input = devm_input_allocate_device(&pdev->dev);
330 if (!input) 350 if (!input)
331 return -ENOMEM; 351 return -ENOMEM;
@@ -334,23 +354,22 @@ static int stmpe_keypad_probe(struct platform_device *pdev)
334 input->id.bustype = BUS_I2C; 354 input->id.bustype = BUS_I2C;
335 input->dev.parent = &pdev->dev; 355 input->dev.parent = &pdev->dev;
336 356
337 error = matrix_keypad_build_keymap(plat->keymap_data, NULL, 357 error = matrix_keypad_parse_of_params(&pdev->dev, &rows, &cols);
338 STMPE_KEYPAD_MAX_ROWS, 358 if (error)
339 STMPE_KEYPAD_MAX_COLS, 359 return error;
360
361 error = matrix_keypad_build_keymap(NULL, NULL, rows, cols,
340 keypad->keymap, input); 362 keypad->keymap, input);
341 if (error) 363 if (error)
342 return error; 364 return error;
343 365
344 input_set_capability(input, EV_MSC, MSC_SCAN); 366 input_set_capability(input, EV_MSC, MSC_SCAN);
345 if (!plat->no_autorepeat) 367 if (!keypad->no_autorepeat)
346 __set_bit(EV_REP, input->evbit); 368 __set_bit(EV_REP, input->evbit);
347 369
348 stmpe_keypad_fill_used_pins(keypad); 370 stmpe_keypad_fill_used_pins(keypad, rows, cols);
349 371
350 keypad->stmpe = stmpe;
351 keypad->plat = plat;
352 keypad->input = input; 372 keypad->input = input;
353 keypad->variant = &stmpe_keypad_variants[stmpe->partnum];
354 373
355 error = stmpe_keypad_chip_init(keypad); 374 error = stmpe_keypad_chip_init(keypad);
356 if (error < 0) 375 if (error < 0)
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
index d125a019383f..d88d73d83552 100644
--- a/drivers/input/mouse/alps.c
+++ b/drivers/input/mouse/alps.c
@@ -881,6 +881,34 @@ static void alps_get_finger_coordinate_v7(struct input_mt_pos *mt,
881 unsigned char *pkt, 881 unsigned char *pkt,
882 unsigned char pkt_id) 882 unsigned char pkt_id)
883{ 883{
884 /*
885 * packet-fmt b7 b6 b5 b4 b3 b2 b1 b0
886 * Byte0 TWO & MULTI L 1 R M 1 Y0-2 Y0-1 Y0-0
887 * Byte0 NEW L 1 X1-5 1 1 Y0-2 Y0-1 Y0-0
888 * Byte1 Y0-10 Y0-9 Y0-8 Y0-7 Y0-6 Y0-5 Y0-4 Y0-3
889 * Byte2 X0-11 1 X0-10 X0-9 X0-8 X0-7 X0-6 X0-5
890 * Byte3 X1-11 1 X0-4 X0-3 1 X0-2 X0-1 X0-0
891 * Byte4 TWO X1-10 TWO X1-9 X1-8 X1-7 X1-6 X1-5 X1-4
892 * Byte4 MULTI X1-10 TWO X1-9 X1-8 X1-7 X1-6 Y1-5 1
893 * Byte4 NEW X1-10 TWO X1-9 X1-8 X1-7 X1-6 0 0
894 * Byte5 TWO & NEW Y1-10 0 Y1-9 Y1-8 Y1-7 Y1-6 Y1-5 Y1-4
895 * Byte5 MULTI Y1-10 0 Y1-9 Y1-8 Y1-7 Y1-6 F-1 F-0
896 * L: Left button
897 * R / M: Non-clickpads: Right / Middle button
898 * Clickpads: When > 2 fingers are down, and some fingers
899 * are in the button area, then the 2 coordinates reported
900 * are for fingers outside the button area and these report
901 * extra fingers being present in the right / left button
902 * area. Note these fingers are not added to the F field!
903 * so if a TWO packet is received and R = 1 then there are
904 * 3 fingers down, etc.
905 * TWO: 1: Two touches present, byte 0/4/5 are in TWO fmt
906 * 0: If byte 4 bit 0 is 1, then byte 0/4/5 are in MULTI fmt
907 * otherwise byte 0 bit 4 must be set and byte 0/4/5 are
908 * in NEW fmt
909 * F: Number of fingers - 3, 0 means 3 fingers, 1 means 4 ...
910 */
911
884 mt[0].x = ((pkt[2] & 0x80) << 4); 912 mt[0].x = ((pkt[2] & 0x80) << 4);
885 mt[0].x |= ((pkt[2] & 0x3F) << 5); 913 mt[0].x |= ((pkt[2] & 0x3F) << 5);
886 mt[0].x |= ((pkt[3] & 0x30) >> 1); 914 mt[0].x |= ((pkt[3] & 0x30) >> 1);
@@ -919,18 +947,21 @@ static void alps_get_finger_coordinate_v7(struct input_mt_pos *mt,
919 947
920static int alps_get_mt_count(struct input_mt_pos *mt) 948static int alps_get_mt_count(struct input_mt_pos *mt)
921{ 949{
922 int i; 950 int i, fingers = 0;
923 951
924 for (i = 0; i < MAX_TOUCHES && mt[i].x != 0 && mt[i].y != 0; i++) 952 for (i = 0; i < MAX_TOUCHES; i++) {
925 /* empty */; 953 if (mt[i].x != 0 || mt[i].y != 0)
954 fingers++;
955 }
926 956
927 return i; 957 return fingers;
928} 958}
929 959
930static int alps_decode_packet_v7(struct alps_fields *f, 960static int alps_decode_packet_v7(struct alps_fields *f,
931 unsigned char *p, 961 unsigned char *p,
932 struct psmouse *psmouse) 962 struct psmouse *psmouse)
933{ 963{
964 struct alps_data *priv = psmouse->private;
934 unsigned char pkt_id; 965 unsigned char pkt_id;
935 966
936 pkt_id = alps_get_packet_id_v7(p); 967 pkt_id = alps_get_packet_id_v7(p);
@@ -938,19 +969,52 @@ static int alps_decode_packet_v7(struct alps_fields *f,
938 return 0; 969 return 0;
939 if (pkt_id == V7_PACKET_ID_UNKNOWN) 970 if (pkt_id == V7_PACKET_ID_UNKNOWN)
940 return -1; 971 return -1;
972 /*
973 * NEW packets are send to indicate a discontinuity in the finger
974 * coordinate reporting. Specifically a finger may have moved from
975 * slot 0 to 1 or vice versa. INPUT_MT_TRACK takes care of this for
976 * us.
977 *
978 * NEW packets have 3 problems:
979 * 1) They do not contain middle / right button info (on non clickpads)
980 * this can be worked around by preserving the old button state
981 * 2) They do not contain an accurate fingercount, and they are
982 * typically send when the number of fingers changes. We cannot use
983 * the old finger count as that may mismatch with the amount of
984 * touch coordinates we've available in the NEW packet
985 * 3) Their x data for the second touch is inaccurate leading to
986 * a possible jump of the x coordinate by 16 units when the first
987 * non NEW packet comes in
988 * Since problems 2 & 3 cannot be worked around, just ignore them.
989 */
990 if (pkt_id == V7_PACKET_ID_NEW)
991 return 1;
941 992
942 alps_get_finger_coordinate_v7(f->mt, p, pkt_id); 993 alps_get_finger_coordinate_v7(f->mt, p, pkt_id);
943 994
944 if (pkt_id == V7_PACKET_ID_TWO || pkt_id == V7_PACKET_ID_MULTI) { 995 if (pkt_id == V7_PACKET_ID_TWO)
945 f->left = (p[0] & 0x80) >> 7; 996 f->fingers = alps_get_mt_count(f->mt);
997 else /* pkt_id == V7_PACKET_ID_MULTI */
998 f->fingers = 3 + (p[5] & 0x03);
999
1000 f->left = (p[0] & 0x80) >> 7;
1001 if (priv->flags & ALPS_BUTTONPAD) {
1002 if (p[0] & 0x20)
1003 f->fingers++;
1004 if (p[0] & 0x10)
1005 f->fingers++;
1006 } else {
946 f->right = (p[0] & 0x20) >> 5; 1007 f->right = (p[0] & 0x20) >> 5;
947 f->middle = (p[0] & 0x10) >> 4; 1008 f->middle = (p[0] & 0x10) >> 4;
948 } 1009 }
949 1010
950 if (pkt_id == V7_PACKET_ID_TWO) 1011 /* Sometimes a single touch is reported in mt[1] rather then mt[0] */
951 f->fingers = alps_get_mt_count(f->mt); 1012 if (f->fingers == 1 && f->mt[0].x == 0 && f->mt[0].y == 0) {
952 else if (pkt_id == V7_PACKET_ID_MULTI) 1013 f->mt[0].x = f->mt[1].x;
953 f->fingers = 3 + (p[5] & 0x03); 1014 f->mt[0].y = f->mt[1].y;
1015 f->mt[1].x = 0;
1016 f->mt[1].y = 0;
1017 }
954 1018
955 return 0; 1019 return 0;
956} 1020}
diff --git a/drivers/input/mouse/trackpoint.c b/drivers/input/mouse/trackpoint.c
index 30c8b6998808..354d47ecd66a 100644
--- a/drivers/input/mouse/trackpoint.c
+++ b/drivers/input/mouse/trackpoint.c
@@ -227,6 +227,7 @@ TRACKPOINT_INT_ATTR(thresh, TP_THRESH, TP_DEF_THRESH);
227TRACKPOINT_INT_ATTR(upthresh, TP_UP_THRESH, TP_DEF_UP_THRESH); 227TRACKPOINT_INT_ATTR(upthresh, TP_UP_THRESH, TP_DEF_UP_THRESH);
228TRACKPOINT_INT_ATTR(ztime, TP_Z_TIME, TP_DEF_Z_TIME); 228TRACKPOINT_INT_ATTR(ztime, TP_Z_TIME, TP_DEF_Z_TIME);
229TRACKPOINT_INT_ATTR(jenks, TP_JENKS_CURV, TP_DEF_JENKS_CURV); 229TRACKPOINT_INT_ATTR(jenks, TP_JENKS_CURV, TP_DEF_JENKS_CURV);
230TRACKPOINT_INT_ATTR(drift_time, TP_DRIFT_TIME, TP_DEF_DRIFT_TIME);
230 231
231TRACKPOINT_BIT_ATTR(press_to_select, TP_TOGGLE_PTSON, TP_MASK_PTSON, 0, 232TRACKPOINT_BIT_ATTR(press_to_select, TP_TOGGLE_PTSON, TP_MASK_PTSON, 0,
232 TP_DEF_PTSON); 233 TP_DEF_PTSON);
@@ -246,6 +247,7 @@ static struct attribute *trackpoint_attrs[] = {
246 &psmouse_attr_upthresh.dattr.attr, 247 &psmouse_attr_upthresh.dattr.attr,
247 &psmouse_attr_ztime.dattr.attr, 248 &psmouse_attr_ztime.dattr.attr,
248 &psmouse_attr_jenks.dattr.attr, 249 &psmouse_attr_jenks.dattr.attr,
250 &psmouse_attr_drift_time.dattr.attr,
249 &psmouse_attr_press_to_select.dattr.attr, 251 &psmouse_attr_press_to_select.dattr.attr,
250 &psmouse_attr_skipback.dattr.attr, 252 &psmouse_attr_skipback.dattr.attr,
251 &psmouse_attr_ext_dev.dattr.attr, 253 &psmouse_attr_ext_dev.dattr.attr,
@@ -312,6 +314,7 @@ static int trackpoint_sync(struct psmouse *psmouse, bool in_power_on_state)
312 TRACKPOINT_UPDATE(in_power_on_state, psmouse, tp, upthresh); 314 TRACKPOINT_UPDATE(in_power_on_state, psmouse, tp, upthresh);
313 TRACKPOINT_UPDATE(in_power_on_state, psmouse, tp, ztime); 315 TRACKPOINT_UPDATE(in_power_on_state, psmouse, tp, ztime);
314 TRACKPOINT_UPDATE(in_power_on_state, psmouse, tp, jenks); 316 TRACKPOINT_UPDATE(in_power_on_state, psmouse, tp, jenks);
317 TRACKPOINT_UPDATE(in_power_on_state, psmouse, tp, drift_time);
315 318
316 /* toggles */ 319 /* toggles */
317 TRACKPOINT_UPDATE(in_power_on_state, psmouse, tp, press_to_select); 320 TRACKPOINT_UPDATE(in_power_on_state, psmouse, tp, press_to_select);
@@ -332,6 +335,7 @@ static void trackpoint_defaults(struct trackpoint_data *tp)
332 TRACKPOINT_SET_POWER_ON_DEFAULT(tp, upthresh); 335 TRACKPOINT_SET_POWER_ON_DEFAULT(tp, upthresh);
333 TRACKPOINT_SET_POWER_ON_DEFAULT(tp, ztime); 336 TRACKPOINT_SET_POWER_ON_DEFAULT(tp, ztime);
334 TRACKPOINT_SET_POWER_ON_DEFAULT(tp, jenks); 337 TRACKPOINT_SET_POWER_ON_DEFAULT(tp, jenks);
338 TRACKPOINT_SET_POWER_ON_DEFAULT(tp, drift_time);
335 TRACKPOINT_SET_POWER_ON_DEFAULT(tp, inertia); 339 TRACKPOINT_SET_POWER_ON_DEFAULT(tp, inertia);
336 340
337 /* toggles */ 341 /* toggles */
diff --git a/drivers/input/mouse/trackpoint.h b/drivers/input/mouse/trackpoint.h
index ecd0547964a5..5617ed3a7d7a 100644
--- a/drivers/input/mouse/trackpoint.h
+++ b/drivers/input/mouse/trackpoint.h
@@ -70,6 +70,9 @@
70#define TP_UP_THRESH 0x5A /* Used to generate a 'click' on Z-axis */ 70#define TP_UP_THRESH 0x5A /* Used to generate a 'click' on Z-axis */
71#define TP_Z_TIME 0x5E /* How sharp of a press */ 71#define TP_Z_TIME 0x5E /* How sharp of a press */
72#define TP_JENKS_CURV 0x5D /* Minimum curvature for double click */ 72#define TP_JENKS_CURV 0x5D /* Minimum curvature for double click */
73#define TP_DRIFT_TIME 0x5F /* How long a 'hands off' condition */
74 /* must last (x*107ms) for drift */
75 /* correction to occur */
73 76
74/* 77/*
75 * Toggling Flag bits 78 * Toggling Flag bits
@@ -120,6 +123,7 @@
120#define TP_DEF_UP_THRESH 0xFF 123#define TP_DEF_UP_THRESH 0xFF
121#define TP_DEF_Z_TIME 0x26 124#define TP_DEF_Z_TIME 0x26
122#define TP_DEF_JENKS_CURV 0x87 125#define TP_DEF_JENKS_CURV 0x87
126#define TP_DEF_DRIFT_TIME 0x05
123 127
124/* Toggles */ 128/* Toggles */
125#define TP_DEF_MB 0x00 129#define TP_DEF_MB 0x00
@@ -137,6 +141,7 @@ struct trackpoint_data
137 unsigned char draghys, mindrag; 141 unsigned char draghys, mindrag;
138 unsigned char thresh, upthresh; 142 unsigned char thresh, upthresh;
139 unsigned char ztime, jenks; 143 unsigned char ztime, jenks;
144 unsigned char drift_time;
140 145
141 /* toggles */ 146 /* toggles */
142 unsigned char press_to_select; 147 unsigned char press_to_select;
diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
index bb070206223c..95ee92a91bd2 100644
--- a/drivers/input/touchscreen/atmel_mxt_ts.c
+++ b/drivers/input/touchscreen/atmel_mxt_ts.c
@@ -99,13 +99,9 @@
99#define MXT_T6_STATUS_COMSERR (1 << 2) 99#define MXT_T6_STATUS_COMSERR (1 << 2)
100 100
101/* MXT_GEN_POWER_T7 field */ 101/* MXT_GEN_POWER_T7 field */
102struct t7_config { 102#define MXT_POWER_IDLEACQINT 0
103 u8 idle; 103#define MXT_POWER_ACTVACQINT 1
104 u8 active; 104#define MXT_POWER_ACTV2IDLETO 2
105} __packed;
106
107#define MXT_POWER_CFG_RUN 0
108#define MXT_POWER_CFG_DEEPSLEEP 1
109 105
110/* MXT_GEN_ACQUIRE_T8 field */ 106/* MXT_GEN_ACQUIRE_T8 field */
111#define MXT_ACQUIRE_CHRGTIME 0 107#define MXT_ACQUIRE_CHRGTIME 0
@@ -117,6 +113,7 @@ struct t7_config {
117#define MXT_ACQUIRE_ATCHCALSTHR 7 113#define MXT_ACQUIRE_ATCHCALSTHR 7
118 114
119/* MXT_TOUCH_MULTI_T9 field */ 115/* MXT_TOUCH_MULTI_T9 field */
116#define MXT_TOUCH_CTRL 0
120#define MXT_T9_ORIENT 9 117#define MXT_T9_ORIENT 9
121#define MXT_T9_RANGE 18 118#define MXT_T9_RANGE 18
122 119
@@ -256,7 +253,6 @@ struct mxt_data {
256 bool update_input; 253 bool update_input;
257 u8 last_message_count; 254 u8 last_message_count;
258 u8 num_touchids; 255 u8 num_touchids;
259 struct t7_config t7_cfg;
260 256
261 /* Cached parameters from object table */ 257 /* Cached parameters from object table */
262 u16 T5_address; 258 u16 T5_address;
@@ -672,6 +668,20 @@ static void mxt_proc_t6_messages(struct mxt_data *data, u8 *msg)
672 data->t6_status = status; 668 data->t6_status = status;
673} 669}
674 670
671static int mxt_write_object(struct mxt_data *data,
672 u8 type, u8 offset, u8 val)
673{
674 struct mxt_object *object;
675 u16 reg;
676
677 object = mxt_get_object(data, type);
678 if (!object || offset >= mxt_obj_size(object))
679 return -EINVAL;
680
681 reg = object->start_address;
682 return mxt_write_reg(data->client, reg + offset, val);
683}
684
675static void mxt_input_button(struct mxt_data *data, u8 *message) 685static void mxt_input_button(struct mxt_data *data, u8 *message)
676{ 686{
677 struct input_dev *input = data->input_dev; 687 struct input_dev *input = data->input_dev;
@@ -1742,60 +1752,6 @@ err_free_object_table:
1742 return error; 1752 return error;
1743} 1753}
1744 1754
1745static int mxt_set_t7_power_cfg(struct mxt_data *data, u8 sleep)
1746{
1747 struct device *dev = &data->client->dev;
1748 int error;
1749 struct t7_config *new_config;
1750 struct t7_config deepsleep = { .active = 0, .idle = 0 };
1751
1752 if (sleep == MXT_POWER_CFG_DEEPSLEEP)
1753 new_config = &deepsleep;
1754 else
1755 new_config = &data->t7_cfg;
1756
1757 error = __mxt_write_reg(data->client, data->T7_address,
1758 sizeof(data->t7_cfg), new_config);
1759 if (error)
1760 return error;
1761
1762 dev_dbg(dev, "Set T7 ACTV:%d IDLE:%d\n",
1763 new_config->active, new_config->idle);
1764
1765 return 0;
1766}
1767
1768static int mxt_init_t7_power_cfg(struct mxt_data *data)
1769{
1770 struct device *dev = &data->client->dev;
1771 int error;
1772 bool retry = false;
1773
1774recheck:
1775 error = __mxt_read_reg(data->client, data->T7_address,
1776 sizeof(data->t7_cfg), &data->t7_cfg);
1777 if (error)
1778 return error;
1779
1780 if (data->t7_cfg.active == 0 || data->t7_cfg.idle == 0) {
1781 if (!retry) {
1782 dev_dbg(dev, "T7 cfg zero, resetting\n");
1783 mxt_soft_reset(data);
1784 retry = true;
1785 goto recheck;
1786 } else {
1787 dev_dbg(dev, "T7 cfg zero after reset, overriding\n");
1788 data->t7_cfg.active = 20;
1789 data->t7_cfg.idle = 100;
1790 return mxt_set_t7_power_cfg(data, MXT_POWER_CFG_RUN);
1791 }
1792 }
1793
1794 dev_dbg(dev, "Initialized power cfg: ACTV %d, IDLE %d\n",
1795 data->t7_cfg.active, data->t7_cfg.idle);
1796 return 0;
1797}
1798
1799static int mxt_configure_objects(struct mxt_data *data, 1755static int mxt_configure_objects(struct mxt_data *data,
1800 const struct firmware *cfg) 1756 const struct firmware *cfg)
1801{ 1757{
@@ -1809,12 +1765,6 @@ static int mxt_configure_objects(struct mxt_data *data,
1809 dev_warn(dev, "Error %d updating config\n", error); 1765 dev_warn(dev, "Error %d updating config\n", error);
1810 } 1766 }
1811 1767
1812 error = mxt_init_t7_power_cfg(data);
1813 if (error) {
1814 dev_err(dev, "Failed to initialize power cfg\n");
1815 return error;
1816 }
1817
1818 error = mxt_initialize_t9_input_device(data); 1768 error = mxt_initialize_t9_input_device(data);
1819 if (error) 1769 if (error)
1820 return error; 1770 return error;
@@ -2093,15 +2043,16 @@ static const struct attribute_group mxt_attr_group = {
2093 2043
2094static void mxt_start(struct mxt_data *data) 2044static void mxt_start(struct mxt_data *data)
2095{ 2045{
2096 mxt_set_t7_power_cfg(data, MXT_POWER_CFG_RUN); 2046 /* Touch enable */
2097 2047 mxt_write_object(data,
2098 /* Recalibrate since chip has been in deep sleep */ 2048 MXT_TOUCH_MULTI_T9, MXT_TOUCH_CTRL, 0x83);
2099 mxt_t6_command(data, MXT_COMMAND_CALIBRATE, 1, false);
2100} 2049}
2101 2050
2102static void mxt_stop(struct mxt_data *data) 2051static void mxt_stop(struct mxt_data *data)
2103{ 2052{
2104 mxt_set_t7_power_cfg(data, MXT_POWER_CFG_DEEPSLEEP); 2053 /* Touch disable */
2054 mxt_write_object(data,
2055 MXT_TOUCH_MULTI_T9, MXT_TOUCH_CTRL, 0);
2105} 2056}
2106 2057
2107static int mxt_input_open(struct input_dev *dev) 2058static int mxt_input_open(struct input_dev *dev)
@@ -2266,6 +2217,8 @@ static int __maybe_unused mxt_resume(struct device *dev)
2266 struct mxt_data *data = i2c_get_clientdata(client); 2217 struct mxt_data *data = i2c_get_clientdata(client);
2267 struct input_dev *input_dev = data->input_dev; 2218 struct input_dev *input_dev = data->input_dev;
2268 2219
2220 mxt_soft_reset(data);
2221
2269 mutex_lock(&input_dev->mutex); 2222 mutex_lock(&input_dev->mutex);
2270 2223
2271 if (input_dev->users) 2224 if (input_dev->users)
diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c
index 3793fcc7e5db..d4c24fb7704f 100644
--- a/drivers/input/touchscreen/edt-ft5x06.c
+++ b/drivers/input/touchscreen/edt-ft5x06.c
@@ -850,9 +850,11 @@ static int edt_ft5x06_ts_identify(struct i2c_client *client,
850} 850}
851 851
852#define EDT_ATTR_CHECKSET(name, reg) \ 852#define EDT_ATTR_CHECKSET(name, reg) \
853do { \
853 if (pdata->name >= edt_ft5x06_attr_##name.limit_low && \ 854 if (pdata->name >= edt_ft5x06_attr_##name.limit_low && \
854 pdata->name <= edt_ft5x06_attr_##name.limit_high) \ 855 pdata->name <= edt_ft5x06_attr_##name.limit_high) \
855 edt_ft5x06_register_write(tsdata, reg, pdata->name) 856 edt_ft5x06_register_write(tsdata, reg, pdata->name); \
857} while (0)
856 858
857#define EDT_GET_PROP(name, reg) { \ 859#define EDT_GET_PROP(name, reg) { \
858 u32 val; \ 860 u32 val; \
diff --git a/drivers/mfd/stmpe.c b/drivers/mfd/stmpe.c
index e2f9df1c0c36..2d7fae94c861 100644
--- a/drivers/mfd/stmpe.c
+++ b/drivers/mfd/stmpe.c
@@ -519,6 +519,7 @@ static const u8 stmpe1601_regs[] = {
519 [STMPE_IDX_GPDR_LSB] = STMPE1601_REG_GPIO_SET_DIR_LSB, 519 [STMPE_IDX_GPDR_LSB] = STMPE1601_REG_GPIO_SET_DIR_LSB,
520 [STMPE_IDX_GPRER_LSB] = STMPE1601_REG_GPIO_RE_LSB, 520 [STMPE_IDX_GPRER_LSB] = STMPE1601_REG_GPIO_RE_LSB,
521 [STMPE_IDX_GPFER_LSB] = STMPE1601_REG_GPIO_FE_LSB, 521 [STMPE_IDX_GPFER_LSB] = STMPE1601_REG_GPIO_FE_LSB,
522 [STMPE_IDX_GPPUR_LSB] = STMPE1601_REG_GPIO_PU_LSB,
522 [STMPE_IDX_GPAFR_U_MSB] = STMPE1601_REG_GPIO_AF_U_MSB, 523 [STMPE_IDX_GPAFR_U_MSB] = STMPE1601_REG_GPIO_AF_U_MSB,
523 [STMPE_IDX_IEGPIOR_LSB] = STMPE1601_REG_INT_EN_GPIO_MASK_LSB, 524 [STMPE_IDX_IEGPIOR_LSB] = STMPE1601_REG_INT_EN_GPIO_MASK_LSB,
524 [STMPE_IDX_ISGPIOR_MSB] = STMPE1601_REG_INT_STA_GPIO_MSB, 525 [STMPE_IDX_ISGPIOR_MSB] = STMPE1601_REG_INT_STA_GPIO_MSB,
@@ -667,6 +668,7 @@ static const u8 stmpe1801_regs[] = {
667 [STMPE_IDX_GPDR_LSB] = STMPE1801_REG_GPIO_SET_DIR_LOW, 668 [STMPE_IDX_GPDR_LSB] = STMPE1801_REG_GPIO_SET_DIR_LOW,
668 [STMPE_IDX_GPRER_LSB] = STMPE1801_REG_GPIO_RE_LOW, 669 [STMPE_IDX_GPRER_LSB] = STMPE1801_REG_GPIO_RE_LOW,
669 [STMPE_IDX_GPFER_LSB] = STMPE1801_REG_GPIO_FE_LOW, 670 [STMPE_IDX_GPFER_LSB] = STMPE1801_REG_GPIO_FE_LOW,
671 [STMPE_IDX_GPPUR_LSB] = STMPE1801_REG_GPIO_PULL_UP_LOW,
670 [STMPE_IDX_IEGPIOR_LSB] = STMPE1801_REG_INT_EN_GPIO_MASK_LOW, 672 [STMPE_IDX_IEGPIOR_LSB] = STMPE1801_REG_INT_EN_GPIO_MASK_LOW,
671 [STMPE_IDX_ISGPIOR_LSB] = STMPE1801_REG_INT_STA_GPIO_LOW, 673 [STMPE_IDX_ISGPIOR_LSB] = STMPE1801_REG_INT_STA_GPIO_LOW,
672}; 674};
@@ -750,6 +752,8 @@ static const u8 stmpe24xx_regs[] = {
750 [STMPE_IDX_GPDR_LSB] = STMPE24XX_REG_GPDR_LSB, 752 [STMPE_IDX_GPDR_LSB] = STMPE24XX_REG_GPDR_LSB,
751 [STMPE_IDX_GPRER_LSB] = STMPE24XX_REG_GPRER_LSB, 753 [STMPE_IDX_GPRER_LSB] = STMPE24XX_REG_GPRER_LSB,
752 [STMPE_IDX_GPFER_LSB] = STMPE24XX_REG_GPFER_LSB, 754 [STMPE_IDX_GPFER_LSB] = STMPE24XX_REG_GPFER_LSB,
755 [STMPE_IDX_GPPUR_LSB] = STMPE24XX_REG_GPPUR_LSB,
756 [STMPE_IDX_GPPDR_LSB] = STMPE24XX_REG_GPPDR_LSB,
753 [STMPE_IDX_GPAFR_U_MSB] = STMPE24XX_REG_GPAFR_U_MSB, 757 [STMPE_IDX_GPAFR_U_MSB] = STMPE24XX_REG_GPAFR_U_MSB,
754 [STMPE_IDX_IEGPIOR_LSB] = STMPE24XX_REG_IEGPIOR_LSB, 758 [STMPE_IDX_IEGPIOR_LSB] = STMPE24XX_REG_IEGPIOR_LSB,
755 [STMPE_IDX_ISGPIOR_MSB] = STMPE24XX_REG_ISGPIOR_MSB, 759 [STMPE_IDX_ISGPIOR_MSB] = STMPE24XX_REG_ISGPIOR_MSB,
diff --git a/drivers/mfd/stmpe.h b/drivers/mfd/stmpe.h
index bee0abf82040..84adb46b3e2f 100644
--- a/drivers/mfd/stmpe.h
+++ b/drivers/mfd/stmpe.h
@@ -188,6 +188,7 @@ int stmpe_remove(struct stmpe *stmpe);
188#define STMPE1601_REG_GPIO_ED_MSB 0x8A 188#define STMPE1601_REG_GPIO_ED_MSB 0x8A
189#define STMPE1601_REG_GPIO_RE_LSB 0x8D 189#define STMPE1601_REG_GPIO_RE_LSB 0x8D
190#define STMPE1601_REG_GPIO_FE_LSB 0x8F 190#define STMPE1601_REG_GPIO_FE_LSB 0x8F
191#define STMPE1601_REG_GPIO_PU_LSB 0x91
191#define STMPE1601_REG_GPIO_AF_U_MSB 0x92 192#define STMPE1601_REG_GPIO_AF_U_MSB 0x92
192 193
193#define STMPE1601_SYS_CTRL_ENABLE_GPIO (1 << 3) 194#define STMPE1601_SYS_CTRL_ENABLE_GPIO (1 << 3)
@@ -276,6 +277,8 @@ int stmpe_remove(struct stmpe *stmpe);
276#define STMPE24XX_REG_GPEDR_MSB 0x8C 277#define STMPE24XX_REG_GPEDR_MSB 0x8C
277#define STMPE24XX_REG_GPRER_LSB 0x91 278#define STMPE24XX_REG_GPRER_LSB 0x91
278#define STMPE24XX_REG_GPFER_LSB 0x94 279#define STMPE24XX_REG_GPFER_LSB 0x94
280#define STMPE24XX_REG_GPPUR_LSB 0x97
281#define STMPE24XX_REG_GPPDR_LSB 0x9a
279#define STMPE24XX_REG_GPAFR_U_MSB 0x9B 282#define STMPE24XX_REG_GPAFR_U_MSB 0x9B
280 283
281#define STMPE24XX_SYS_CTRL_ENABLE_GPIO (1 << 3) 284#define STMPE24XX_SYS_CTRL_ENABLE_GPIO (1 << 3)
diff --git a/drivers/net/ethernet/allwinner/sun4i-emac.c b/drivers/net/ethernet/allwinner/sun4i-emac.c
index 1fcd5568a352..f3470d96837a 100644
--- a/drivers/net/ethernet/allwinner/sun4i-emac.c
+++ b/drivers/net/ethernet/allwinner/sun4i-emac.c
@@ -850,8 +850,10 @@ static int emac_probe(struct platform_device *pdev)
850 } 850 }
851 851
852 db->clk = devm_clk_get(&pdev->dev, NULL); 852 db->clk = devm_clk_get(&pdev->dev, NULL);
853 if (IS_ERR(db->clk)) 853 if (IS_ERR(db->clk)) {
854 ret = PTR_ERR(db->clk);
854 goto out; 855 goto out;
856 }
855 857
856 clk_prepare_enable(db->clk); 858 clk_prepare_enable(db->clk);
857 859
diff --git a/drivers/net/ethernet/altera/altera_tse_main.c b/drivers/net/ethernet/altera/altera_tse_main.c
index 3498760dc22a..760c72c6e2ac 100644
--- a/drivers/net/ethernet/altera/altera_tse_main.c
+++ b/drivers/net/ethernet/altera/altera_tse_main.c
@@ -1170,10 +1170,6 @@ tx_request_irq_error:
1170init_error: 1170init_error:
1171 free_skbufs(dev); 1171 free_skbufs(dev);
1172alloc_skbuf_error: 1172alloc_skbuf_error:
1173 if (priv->phydev) {
1174 phy_disconnect(priv->phydev);
1175 priv->phydev = NULL;
1176 }
1177phy_error: 1173phy_error:
1178 return ret; 1174 return ret;
1179} 1175}
@@ -1186,12 +1182,9 @@ static int tse_shutdown(struct net_device *dev)
1186 int ret; 1182 int ret;
1187 unsigned long int flags; 1183 unsigned long int flags;
1188 1184
1189 /* Stop and disconnect the PHY */ 1185 /* Stop the PHY */
1190 if (priv->phydev) { 1186 if (priv->phydev)
1191 phy_stop(priv->phydev); 1187 phy_stop(priv->phydev);
1192 phy_disconnect(priv->phydev);
1193 priv->phydev = NULL;
1194 }
1195 1188
1196 netif_stop_queue(dev); 1189 netif_stop_queue(dev);
1197 napi_disable(&priv->napi); 1190 napi_disable(&priv->napi);
@@ -1525,6 +1518,10 @@ err_free_netdev:
1525static int altera_tse_remove(struct platform_device *pdev) 1518static int altera_tse_remove(struct platform_device *pdev)
1526{ 1519{
1527 struct net_device *ndev = platform_get_drvdata(pdev); 1520 struct net_device *ndev = platform_get_drvdata(pdev);
1521 struct altera_tse_private *priv = netdev_priv(ndev);
1522
1523 if (priv->phydev)
1524 phy_disconnect(priv->phydev);
1528 1525
1529 platform_set_drvdata(pdev, NULL); 1526 platform_set_drvdata(pdev, NULL);
1530 altera_tse_mdio_destroy(ndev); 1527 altera_tse_mdio_destroy(ndev);
diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c
index 9027fc1cc5f7..9a952df6606e 100644
--- a/drivers/net/ethernet/cisco/enic/enic_main.c
+++ b/drivers/net/ethernet/cisco/enic/enic_main.c
@@ -1653,7 +1653,7 @@ static int enic_open(struct net_device *netdev)
1653 if (vnic_rq_desc_used(&enic->rq[i]) == 0) { 1653 if (vnic_rq_desc_used(&enic->rq[i]) == 0) {
1654 netdev_err(netdev, "Unable to alloc receive buffers\n"); 1654 netdev_err(netdev, "Unable to alloc receive buffers\n");
1655 err = -ENOMEM; 1655 err = -ENOMEM;
1656 goto err_out_notify_unset; 1656 goto err_out_free_rq;
1657 } 1657 }
1658 } 1658 }
1659 1659
@@ -1686,7 +1686,9 @@ static int enic_open(struct net_device *netdev)
1686 1686
1687 return 0; 1687 return 0;
1688 1688
1689err_out_notify_unset: 1689err_out_free_rq:
1690 for (i = 0; i < enic->rq_count; i++)
1691 vnic_rq_clean(&enic->rq[i], enic_free_rq_buf);
1690 enic_dev_notify_unset(enic); 1692 enic_dev_notify_unset(enic);
1691err_out_free_intr: 1693err_out_free_intr:
1692 enic_free_intr(enic); 1694 enic_free_intr(enic);
diff --git a/drivers/net/ethernet/intel/e100.c b/drivers/net/ethernet/intel/e100.c
index 781065eb5431..e9c3a87e5b11 100644
--- a/drivers/net/ethernet/intel/e100.c
+++ b/drivers/net/ethernet/intel/e100.c
@@ -1543,7 +1543,7 @@ static int e100_phy_init(struct nic *nic)
1543 mdio_write(netdev, nic->mii.phy_id, MII_BMCR, bmcr); 1543 mdio_write(netdev, nic->mii.phy_id, MII_BMCR, bmcr);
1544 } else if ((nic->mac >= mac_82550_D102) || ((nic->flags & ich) && 1544 } else if ((nic->mac >= mac_82550_D102) || ((nic->flags & ich) &&
1545 (mdio_read(netdev, nic->mii.phy_id, MII_TPISTATUS) & 0x8000) && 1545 (mdio_read(netdev, nic->mii.phy_id, MII_TPISTATUS) & 0x8000) &&
1546 !(nic->eeprom[eeprom_cnfg_mdix] & eeprom_mdix_enabled))) { 1546 (nic->eeprom[eeprom_cnfg_mdix] & eeprom_mdix_enabled))) {
1547 /* enable/disable MDI/MDI-X auto-switching. */ 1547 /* enable/disable MDI/MDI-X auto-switching. */
1548 mdio_write(netdev, nic->mii.phy_id, MII_NCONFIG, 1548 mdio_write(netdev, nic->mii.phy_id, MII_NCONFIG,
1549 nic->mii.force_media ? 0 : NCONFIG_AUTO_SWITCH); 1549 nic->mii.force_media ? 0 : NCONFIG_AUTO_SWITCH);
diff --git a/drivers/net/ethernet/intel/i40e/i40e_debugfs.c b/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
index 433a55886ad2..cb0de455683e 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
@@ -829,7 +829,7 @@ static void i40e_dbg_dump_desc(int cnt, int vsi_seid, int ring_id, int desc_n,
829 if (desc_n >= ring->count || desc_n < 0) { 829 if (desc_n >= ring->count || desc_n < 0) {
830 dev_info(&pf->pdev->dev, 830 dev_info(&pf->pdev->dev,
831 "descriptor %d not found\n", desc_n); 831 "descriptor %d not found\n", desc_n);
832 return; 832 goto out;
833 } 833 }
834 if (!is_rx_ring) { 834 if (!is_rx_ring) {
835 txd = I40E_TX_DESC(ring, desc_n); 835 txd = I40E_TX_DESC(ring, desc_n);
@@ -855,6 +855,8 @@ static void i40e_dbg_dump_desc(int cnt, int vsi_seid, int ring_id, int desc_n,
855 } else { 855 } else {
856 dev_info(&pf->pdev->dev, "dump desc rx/tx <vsi_seid> <ring_id> [<desc_n>]\n"); 856 dev_info(&pf->pdev->dev, "dump desc rx/tx <vsi_seid> <ring_id> [<desc_n>]\n");
857 } 857 }
858
859out:
858 kfree(ring); 860 kfree(ring);
859} 861}
860 862
diff --git a/drivers/net/ethernet/intel/igb/e1000_82575.c b/drivers/net/ethernet/intel/igb/e1000_82575.c
index 051ea94bdcd3..0f69ef81751a 100644
--- a/drivers/net/ethernet/intel/igb/e1000_82575.c
+++ b/drivers/net/ethernet/intel/igb/e1000_82575.c
@@ -1125,7 +1125,7 @@ static s32 igb_acquire_swfw_sync_82575(struct e1000_hw *hw, u16 mask)
1125 u32 swmask = mask; 1125 u32 swmask = mask;
1126 u32 fwmask = mask << 16; 1126 u32 fwmask = mask << 16;
1127 s32 ret_val = 0; 1127 s32 ret_val = 0;
1128 s32 i = 0, timeout = 200; /* FIXME: find real value to use here */ 1128 s32 i = 0, timeout = 200;
1129 1129
1130 while (i < timeout) { 1130 while (i < timeout) {
1131 if (igb_get_hw_semaphore(hw)) { 1131 if (igb_get_hw_semaphore(hw)) {
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
index 943cbd47d832..03e9eb0dc761 100644
--- a/drivers/net/ethernet/mellanox/mlx4/main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/main.c
@@ -1829,7 +1829,7 @@ static int mlx4_init_hca(struct mlx4_dev *dev)
1829 err = mlx4_dev_cap(dev, &dev_cap); 1829 err = mlx4_dev_cap(dev, &dev_cap);
1830 if (err) { 1830 if (err) {
1831 mlx4_err(dev, "QUERY_DEV_CAP command failed, aborting\n"); 1831 mlx4_err(dev, "QUERY_DEV_CAP command failed, aborting\n");
1832 goto err_stop_fw; 1832 return err;
1833 } 1833 }
1834 1834
1835 choose_steering_mode(dev, &dev_cap); 1835 choose_steering_mode(dev, &dev_cap);
@@ -1860,7 +1860,7 @@ static int mlx4_init_hca(struct mlx4_dev *dev)
1860 &init_hca); 1860 &init_hca);
1861 if ((long long) icm_size < 0) { 1861 if ((long long) icm_size < 0) {
1862 err = icm_size; 1862 err = icm_size;
1863 goto err_stop_fw; 1863 return err;
1864 } 1864 }
1865 1865
1866 dev->caps.max_fmr_maps = (1 << (32 - ilog2(dev->caps.num_mpts))) - 1; 1866 dev->caps.max_fmr_maps = (1 << (32 - ilog2(dev->caps.num_mpts))) - 1;
@@ -1874,7 +1874,7 @@ static int mlx4_init_hca(struct mlx4_dev *dev)
1874 1874
1875 err = mlx4_init_icm(dev, &dev_cap, &init_hca, icm_size); 1875 err = mlx4_init_icm(dev, &dev_cap, &init_hca, icm_size);
1876 if (err) 1876 if (err)
1877 goto err_stop_fw; 1877 return err;
1878 1878
1879 err = mlx4_INIT_HCA(dev, &init_hca); 1879 err = mlx4_INIT_HCA(dev, &init_hca);
1880 if (err) { 1880 if (err) {
@@ -1886,7 +1886,7 @@ static int mlx4_init_hca(struct mlx4_dev *dev)
1886 err = mlx4_query_func(dev, &dev_cap); 1886 err = mlx4_query_func(dev, &dev_cap);
1887 if (err < 0) { 1887 if (err < 0) {
1888 mlx4_err(dev, "QUERY_FUNC command failed, aborting.\n"); 1888 mlx4_err(dev, "QUERY_FUNC command failed, aborting.\n");
1889 goto err_stop_fw; 1889 goto err_close;
1890 } else if (err & MLX4_QUERY_FUNC_NUM_SYS_EQS) { 1890 } else if (err & MLX4_QUERY_FUNC_NUM_SYS_EQS) {
1891 dev->caps.num_eqs = dev_cap.max_eqs; 1891 dev->caps.num_eqs = dev_cap.max_eqs;
1892 dev->caps.reserved_eqs = dev_cap.reserved_eqs; 1892 dev->caps.reserved_eqs = dev_cap.reserved_eqs;
@@ -2006,11 +2006,6 @@ err_free_icm:
2006 if (!mlx4_is_slave(dev)) 2006 if (!mlx4_is_slave(dev))
2007 mlx4_free_icms(dev); 2007 mlx4_free_icms(dev);
2008 2008
2009err_stop_fw:
2010 if (!mlx4_is_slave(dev)) {
2011 mlx4_UNMAP_FA(dev);
2012 mlx4_free_icm(dev, priv->fw.fw_icm, 0);
2013 }
2014 return err; 2009 return err;
2015} 2010}
2016 2011
diff --git a/drivers/net/ethernet/mellanox/mlx4/mr.c b/drivers/net/ethernet/mellanox/mlx4/mr.c
index d6f549685c0f..7094a9c70fd5 100644
--- a/drivers/net/ethernet/mellanox/mlx4/mr.c
+++ b/drivers/net/ethernet/mellanox/mlx4/mr.c
@@ -584,6 +584,7 @@ EXPORT_SYMBOL_GPL(mlx4_mr_free);
584void mlx4_mr_rereg_mem_cleanup(struct mlx4_dev *dev, struct mlx4_mr *mr) 584void mlx4_mr_rereg_mem_cleanup(struct mlx4_dev *dev, struct mlx4_mr *mr)
585{ 585{
586 mlx4_mtt_cleanup(dev, &mr->mtt); 586 mlx4_mtt_cleanup(dev, &mr->mtt);
587 mr->mtt.order = -1;
587} 588}
588EXPORT_SYMBOL_GPL(mlx4_mr_rereg_mem_cleanup); 589EXPORT_SYMBOL_GPL(mlx4_mr_rereg_mem_cleanup);
589 590
@@ -593,14 +594,14 @@ int mlx4_mr_rereg_mem_write(struct mlx4_dev *dev, struct mlx4_mr *mr,
593{ 594{
594 int err; 595 int err;
595 596
596 mpt_entry->start = cpu_to_be64(iova);
597 mpt_entry->length = cpu_to_be64(size);
598 mpt_entry->entity_size = cpu_to_be32(page_shift);
599
600 err = mlx4_mtt_init(dev, npages, page_shift, &mr->mtt); 597 err = mlx4_mtt_init(dev, npages, page_shift, &mr->mtt);
601 if (err) 598 if (err)
602 return err; 599 return err;
603 600
601 mpt_entry->start = cpu_to_be64(mr->iova);
602 mpt_entry->length = cpu_to_be64(mr->size);
603 mpt_entry->entity_size = cpu_to_be32(mr->mtt.page_shift);
604
604 mpt_entry->pd_flags &= cpu_to_be32(MLX4_MPT_PD_MASK | 605 mpt_entry->pd_flags &= cpu_to_be32(MLX4_MPT_PD_MASK |
605 MLX4_MPT_PD_FLAG_EN_INV); 606 MLX4_MPT_PD_FLAG_EN_INV);
606 mpt_entry->flags &= cpu_to_be32(MLX4_MPT_FLAG_FREE | 607 mpt_entry->flags &= cpu_to_be32(MLX4_MPT_FLAG_FREE |
diff --git a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
index af099057f0e9..71af98bb72cb 100644
--- a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
+++ b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
@@ -4033,8 +4033,10 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
4033 (void)pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)); 4033 (void)pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64));
4034 mgp->cmd = dma_alloc_coherent(&pdev->dev, sizeof(*mgp->cmd), 4034 mgp->cmd = dma_alloc_coherent(&pdev->dev, sizeof(*mgp->cmd),
4035 &mgp->cmd_bus, GFP_KERNEL); 4035 &mgp->cmd_bus, GFP_KERNEL);
4036 if (mgp->cmd == NULL) 4036 if (!mgp->cmd) {
4037 status = -ENOMEM;
4037 goto abort_with_enabled; 4038 goto abort_with_enabled;
4039 }
4038 4040
4039 mgp->board_span = pci_resource_len(pdev, 0); 4041 mgp->board_span = pci_resource_len(pdev, 0);
4040 mgp->iomem_base = pci_resource_start(pdev, 0); 4042 mgp->iomem_base = pci_resource_start(pdev, 0);
diff --git a/drivers/net/ethernet/qlogic/qla3xxx.c b/drivers/net/ethernet/qlogic/qla3xxx.c
index c2f09af5c25b..4847713211ca 100644
--- a/drivers/net/ethernet/qlogic/qla3xxx.c
+++ b/drivers/net/ethernet/qlogic/qla3xxx.c
@@ -146,10 +146,7 @@ static int ql_wait_for_drvr_lock(struct ql3_adapter *qdev)
146{ 146{
147 int i = 0; 147 int i = 0;
148 148
149 while (i < 10) { 149 do {
150 if (i)
151 ssleep(1);
152
153 if (ql_sem_lock(qdev, 150 if (ql_sem_lock(qdev,
154 QL_DRVR_SEM_MASK, 151 QL_DRVR_SEM_MASK,
155 (QL_RESOURCE_BITS_BASE_CODE | (qdev->mac_index) 152 (QL_RESOURCE_BITS_BASE_CODE | (qdev->mac_index)
@@ -158,7 +155,8 @@ static int ql_wait_for_drvr_lock(struct ql3_adapter *qdev)
158 "driver lock acquired\n"); 155 "driver lock acquired\n");
159 return 1; 156 return 1;
160 } 157 }
161 } 158 ssleep(1);
159 } while (++i < 10);
162 160
163 netdev_err(qdev->ndev, "Timed out waiting for driver lock...\n"); 161 netdev_err(qdev->ndev, "Timed out waiting for driver lock...\n");
164 return 0; 162 return 0;
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
index 9929b97cfb36..2528c3fb6b90 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
@@ -2605,6 +2605,7 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
2605 } else { 2605 } else {
2606 dev_err(&pdev->dev, 2606 dev_err(&pdev->dev,
2607 "%s: failed. Please Reboot\n", __func__); 2607 "%s: failed. Please Reboot\n", __func__);
2608 err = -ENODEV;
2608 goto err_out_free_hw; 2609 goto err_out_free_hw;
2609 } 2610 }
2610 2611
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index c560f9aeb55d..e61ee8351272 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -757,6 +757,14 @@ requeue:
757static irqreturn_t cpsw_interrupt(int irq, void *dev_id) 757static irqreturn_t cpsw_interrupt(int irq, void *dev_id)
758{ 758{
759 struct cpsw_priv *priv = dev_id; 759 struct cpsw_priv *priv = dev_id;
760 int value = irq - priv->irqs_table[0];
761
762 /* NOTICE: Ending IRQ here. The trick with the 'value' variable above
763 * is to make sure we will always write the correct value to the EOI
764 * register. Namely 0 for RX_THRESH Interrupt, 1 for RX Interrupt, 2
765 * for TX Interrupt and 3 for MISC Interrupt.
766 */
767 cpdma_ctlr_eoi(priv->dma, value);
760 768
761 cpsw_intr_disable(priv); 769 cpsw_intr_disable(priv);
762 if (priv->irq_enabled == true) { 770 if (priv->irq_enabled == true) {
@@ -786,8 +794,6 @@ static int cpsw_poll(struct napi_struct *napi, int budget)
786 int num_tx, num_rx; 794 int num_tx, num_rx;
787 795
788 num_tx = cpdma_chan_process(priv->txch, 128); 796 num_tx = cpdma_chan_process(priv->txch, 128);
789 if (num_tx)
790 cpdma_ctlr_eoi(priv->dma, CPDMA_EOI_TX);
791 797
792 num_rx = cpdma_chan_process(priv->rxch, budget); 798 num_rx = cpdma_chan_process(priv->rxch, budget);
793 if (num_rx < budget) { 799 if (num_rx < budget) {
@@ -795,7 +801,6 @@ static int cpsw_poll(struct napi_struct *napi, int budget)
795 801
796 napi_complete(napi); 802 napi_complete(napi);
797 cpsw_intr_enable(priv); 803 cpsw_intr_enable(priv);
798 cpdma_ctlr_eoi(priv->dma, CPDMA_EOI_RX);
799 prim_cpsw = cpsw_get_slave_priv(priv, 0); 804 prim_cpsw = cpsw_get_slave_priv(priv, 0);
800 if (prim_cpsw->irq_enabled == false) { 805 if (prim_cpsw->irq_enabled == false) {
801 prim_cpsw->irq_enabled = true; 806 prim_cpsw->irq_enabled = true;
@@ -1310,8 +1315,6 @@ static int cpsw_ndo_open(struct net_device *ndev)
1310 napi_enable(&priv->napi); 1315 napi_enable(&priv->napi);
1311 cpdma_ctlr_start(priv->dma); 1316 cpdma_ctlr_start(priv->dma);
1312 cpsw_intr_enable(priv); 1317 cpsw_intr_enable(priv);
1313 cpdma_ctlr_eoi(priv->dma, CPDMA_EOI_RX);
1314 cpdma_ctlr_eoi(priv->dma, CPDMA_EOI_TX);
1315 1318
1316 prim_cpsw = cpsw_get_slave_priv(priv, 0); 1319 prim_cpsw = cpsw_get_slave_priv(priv, 0);
1317 if (prim_cpsw->irq_enabled == false) { 1320 if (prim_cpsw->irq_enabled == false) {
@@ -1578,9 +1581,6 @@ static void cpsw_ndo_tx_timeout(struct net_device *ndev)
1578 cpdma_chan_start(priv->txch); 1581 cpdma_chan_start(priv->txch);
1579 cpdma_ctlr_int_ctrl(priv->dma, true); 1582 cpdma_ctlr_int_ctrl(priv->dma, true);
1580 cpsw_intr_enable(priv); 1583 cpsw_intr_enable(priv);
1581 cpdma_ctlr_eoi(priv->dma, CPDMA_EOI_RX);
1582 cpdma_ctlr_eoi(priv->dma, CPDMA_EOI_TX);
1583
1584} 1584}
1585 1585
1586static int cpsw_ndo_set_mac_address(struct net_device *ndev, void *p) 1586static int cpsw_ndo_set_mac_address(struct net_device *ndev, void *p)
@@ -1620,9 +1620,6 @@ static void cpsw_ndo_poll_controller(struct net_device *ndev)
1620 cpsw_interrupt(ndev->irq, priv); 1620 cpsw_interrupt(ndev->irq, priv);
1621 cpdma_ctlr_int_ctrl(priv->dma, true); 1621 cpdma_ctlr_int_ctrl(priv->dma, true);
1622 cpsw_intr_enable(priv); 1622 cpsw_intr_enable(priv);
1623 cpdma_ctlr_eoi(priv->dma, CPDMA_EOI_RX);
1624 cpdma_ctlr_eoi(priv->dma, CPDMA_EOI_TX);
1625
1626} 1623}
1627#endif 1624#endif
1628 1625
diff --git a/drivers/net/ethernet/xilinx/ll_temac_main.c b/drivers/net/ethernet/xilinx/ll_temac_main.c
index 9c2d91ea0af4..dbcbf0c5bcfa 100644
--- a/drivers/net/ethernet/xilinx/ll_temac_main.c
+++ b/drivers/net/ethernet/xilinx/ll_temac_main.c
@@ -1043,6 +1043,7 @@ static int temac_of_probe(struct platform_device *op)
1043 lp->regs = of_iomap(op->dev.of_node, 0); 1043 lp->regs = of_iomap(op->dev.of_node, 0);
1044 if (!lp->regs) { 1044 if (!lp->regs) {
1045 dev_err(&op->dev, "could not map temac regs.\n"); 1045 dev_err(&op->dev, "could not map temac regs.\n");
1046 rc = -ENOMEM;
1046 goto nodev; 1047 goto nodev;
1047 } 1048 }
1048 1049
@@ -1062,6 +1063,7 @@ static int temac_of_probe(struct platform_device *op)
1062 np = of_parse_phandle(op->dev.of_node, "llink-connected", 0); 1063 np = of_parse_phandle(op->dev.of_node, "llink-connected", 0);
1063 if (!np) { 1064 if (!np) {
1064 dev_err(&op->dev, "could not find DMA node\n"); 1065 dev_err(&op->dev, "could not find DMA node\n");
1066 rc = -ENODEV;
1065 goto err_iounmap; 1067 goto err_iounmap;
1066 } 1068 }
1067 1069
diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
index c18a0c637c44..a6d2860b712c 100644
--- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
+++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
@@ -1501,6 +1501,7 @@ static int axienet_of_probe(struct platform_device *op)
1501 lp->regs = of_iomap(op->dev.of_node, 0); 1501 lp->regs = of_iomap(op->dev.of_node, 0);
1502 if (!lp->regs) { 1502 if (!lp->regs) {
1503 dev_err(&op->dev, "could not map Axi Ethernet regs.\n"); 1503 dev_err(&op->dev, "could not map Axi Ethernet regs.\n");
1504 ret = -ENOMEM;
1504 goto nodev; 1505 goto nodev;
1505 } 1506 }
1506 /* Setup checksum offload, but default to off if not specified */ 1507 /* Setup checksum offload, but default to off if not specified */
@@ -1563,6 +1564,7 @@ static int axienet_of_probe(struct platform_device *op)
1563 np = of_parse_phandle(op->dev.of_node, "axistream-connected", 0); 1564 np = of_parse_phandle(op->dev.of_node, "axistream-connected", 0);
1564 if (!np) { 1565 if (!np) {
1565 dev_err(&op->dev, "could not find DMA node\n"); 1566 dev_err(&op->dev, "could not find DMA node\n");
1567 ret = -ENODEV;
1566 goto err_iounmap; 1568 goto err_iounmap;
1567 } 1569 }
1568 lp->dma_regs = of_iomap(np, 0); 1570 lp->dma_regs = of_iomap(np, 0);
diff --git a/drivers/net/ethernet/xilinx/xilinx_emaclite.c b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
index 24858799c204..9d4ce388510a 100644
--- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c
+++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
@@ -1109,6 +1109,7 @@ static int xemaclite_of_probe(struct platform_device *ofdev)
1109 res = platform_get_resource(ofdev, IORESOURCE_IRQ, 0); 1109 res = platform_get_resource(ofdev, IORESOURCE_IRQ, 0);
1110 if (!res) { 1110 if (!res) {
1111 dev_err(dev, "no IRQ found\n"); 1111 dev_err(dev, "no IRQ found\n");
1112 rc = -ENXIO;
1112 goto error; 1113 goto error;
1113 } 1114 }
1114 1115
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
index b8a82b86f909..602dc6668c3a 100644
--- a/drivers/net/usb/qmi_wwan.c
+++ b/drivers/net/usb/qmi_wwan.c
@@ -56,6 +56,8 @@ struct qmi_wwan_state {
56/* default ethernet address used by the modem */ 56/* default ethernet address used by the modem */
57static const u8 default_modem_addr[ETH_ALEN] = {0x02, 0x50, 0xf3}; 57static const u8 default_modem_addr[ETH_ALEN] = {0x02, 0x50, 0xf3};
58 58
59static const u8 buggy_fw_addr[ETH_ALEN] = {0x00, 0xa0, 0xc6, 0x00, 0x00, 0x00};
60
59/* Make up an ethernet header if the packet doesn't have one. 61/* Make up an ethernet header if the packet doesn't have one.
60 * 62 *
61 * A firmware bug common among several devices cause them to send raw 63 * A firmware bug common among several devices cause them to send raw
@@ -332,10 +334,12 @@ next_desc:
332 usb_driver_release_interface(driver, info->data); 334 usb_driver_release_interface(driver, info->data);
333 } 335 }
334 336
335 /* Never use the same address on both ends of the link, even 337 /* Never use the same address on both ends of the link, even if the
336 * if the buggy firmware told us to. 338 * buggy firmware told us to. Or, if device is assigned the well-known
339 * buggy firmware MAC address, replace it with a random address,
337 */ 340 */
338 if (ether_addr_equal(dev->net->dev_addr, default_modem_addr)) 341 if (ether_addr_equal(dev->net->dev_addr, default_modem_addr) ||
342 ether_addr_equal(dev->net->dev_addr, buggy_fw_addr))
339 eth_hw_addr_random(dev->net); 343 eth_hw_addr_random(dev->net);
340 344
341 /* make MAC addr easily distinguishable from an IP header */ 345 /* make MAC addr easily distinguishable from an IP header */
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index 2d1c77e81836..57ec23e8ccfa 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -1897,6 +1897,22 @@ static void _rtl8152_set_rx_mode(struct net_device *netdev)
1897 netif_wake_queue(netdev); 1897 netif_wake_queue(netdev);
1898} 1898}
1899 1899
1900static netdev_features_t
1901rtl8152_features_check(struct sk_buff *skb, struct net_device *dev,
1902 netdev_features_t features)
1903{
1904 u32 mss = skb_shinfo(skb)->gso_size;
1905 int max_offset = mss ? GTTCPHO_MAX : TCPHO_MAX;
1906 int offset = skb_transport_offset(skb);
1907
1908 if ((mss || skb->ip_summed == CHECKSUM_PARTIAL) && offset > max_offset)
1909 features &= ~(NETIF_F_ALL_CSUM | NETIF_F_GSO_MASK);
1910 else if ((skb->len + sizeof(struct tx_desc)) > agg_buf_sz)
1911 features &= ~NETIF_F_GSO_MASK;
1912
1913 return features;
1914}
1915
1900static netdev_tx_t rtl8152_start_xmit(struct sk_buff *skb, 1916static netdev_tx_t rtl8152_start_xmit(struct sk_buff *skb,
1901 struct net_device *netdev) 1917 struct net_device *netdev)
1902{ 1918{
@@ -3706,6 +3722,7 @@ static const struct net_device_ops rtl8152_netdev_ops = {
3706 .ndo_set_mac_address = rtl8152_set_mac_address, 3722 .ndo_set_mac_address = rtl8152_set_mac_address,
3707 .ndo_change_mtu = rtl8152_change_mtu, 3723 .ndo_change_mtu = rtl8152_change_mtu,
3708 .ndo_validate_addr = eth_validate_addr, 3724 .ndo_validate_addr = eth_validate_addr,
3725 .ndo_features_check = rtl8152_features_check,
3709}; 3726};
3710 3727
3711static void r8152b_get_version(struct r8152 *tp) 3728static void r8152b_get_version(struct r8152 *tp)
diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c
index efbaf2ae1999..794204e34fba 100644
--- a/drivers/net/xen-netback/xenbus.c
+++ b/drivers/net/xen-netback/xenbus.c
@@ -737,6 +737,7 @@ static void connect(struct backend_info *be)
737 } 737 }
738 738
739 queue->remaining_credit = credit_bytes; 739 queue->remaining_credit = credit_bytes;
740 queue->credit_usec = credit_usec;
740 741
741 err = connect_rings(be, queue); 742 err = connect_rings(be, queue);
742 if (err) { 743 if (err) {
diff --git a/drivers/scsi/fnic/fnic.h b/drivers/scsi/fnic/fnic.h
index 3b73b96619e2..26270c351624 100644
--- a/drivers/scsi/fnic/fnic.h
+++ b/drivers/scsi/fnic/fnic.h
@@ -39,7 +39,7 @@
39 39
40#define DRV_NAME "fnic" 40#define DRV_NAME "fnic"
41#define DRV_DESCRIPTION "Cisco FCoE HBA Driver" 41#define DRV_DESCRIPTION "Cisco FCoE HBA Driver"
42#define DRV_VERSION "1.6.0.16" 42#define DRV_VERSION "1.6.0.17"
43#define PFX DRV_NAME ": " 43#define PFX DRV_NAME ": "
44#define DFX DRV_NAME "%d: " 44#define DFX DRV_NAME "%d: "
45 45
diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c
index 2097de42a147..155b286f1a9d 100644
--- a/drivers/scsi/fnic/fnic_scsi.c
+++ b/drivers/scsi/fnic/fnic_scsi.c
@@ -1892,6 +1892,21 @@ int fnic_abort_cmd(struct scsi_cmnd *sc)
1892 goto fnic_abort_cmd_end; 1892 goto fnic_abort_cmd_end;
1893 } 1893 }
1894 1894
1895 /* IO out of order */
1896
1897 if (!(CMD_FLAGS(sc) & (FNIC_IO_ABORTED | FNIC_IO_DONE))) {
1898 spin_unlock_irqrestore(io_lock, flags);
1899 FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host,
1900 "Issuing Host reset due to out of order IO\n");
1901
1902 if (fnic_host_reset(sc) == FAILED) {
1903 FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host,
1904 "fnic_host_reset failed.\n");
1905 }
1906 ret = FAILED;
1907 goto fnic_abort_cmd_end;
1908 }
1909
1895 CMD_STATE(sc) = FNIC_IOREQ_ABTS_COMPLETE; 1910 CMD_STATE(sc) = FNIC_IOREQ_ABTS_COMPLETE;
1896 1911
1897 /* 1912 /*
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index e42fff6e8c10..8afb01604d51 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -1041,7 +1041,7 @@ retry:
1041 } 1041 }
1042 /* signal not to enter either branch of the if () below */ 1042 /* signal not to enter either branch of the if () below */
1043 timeleft = 0; 1043 timeleft = 0;
1044 rtn = NEEDS_RETRY; 1044 rtn = FAILED;
1045 } else { 1045 } else {
1046 timeleft = wait_for_completion_timeout(&done, timeout); 1046 timeleft = wait_for_completion_timeout(&done, timeout);
1047 rtn = SUCCESS; 1047 rtn = SUCCESS;
@@ -1081,7 +1081,7 @@ retry:
1081 rtn = FAILED; 1081 rtn = FAILED;
1082 break; 1082 break;
1083 } 1083 }
1084 } else if (!rtn) { 1084 } else if (rtn != FAILED) {
1085 scsi_abort_eh_cmnd(scmd); 1085 scsi_abort_eh_cmnd(scmd);
1086 rtn = FAILED; 1086 rtn = FAILED;
1087 } 1087 }
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index fedab3c21ddf..399516925d80 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -2623,8 +2623,9 @@ static void sd_read_block_limits(struct scsi_disk *sdkp)
2623 sd_config_discard(sdkp, SD_LBP_WS16); 2623 sd_config_discard(sdkp, SD_LBP_WS16);
2624 2624
2625 } else { /* LBP VPD page tells us what to use */ 2625 } else { /* LBP VPD page tells us what to use */
2626 2626 if (sdkp->lbpu && sdkp->max_unmap_blocks && !sdkp->lbprz)
2627 if (sdkp->lbpws) 2627 sd_config_discard(sdkp, SD_LBP_UNMAP);
2628 else if (sdkp->lbpws)
2628 sd_config_discard(sdkp, SD_LBP_WS16); 2629 sd_config_discard(sdkp, SD_LBP_WS16);
2629 else if (sdkp->lbpws10) 2630 else if (sdkp->lbpws10)
2630 sd_config_discard(sdkp, SD_LBP_WS10); 2631 sd_config_discard(sdkp, SD_LBP_WS10);
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index ed71b5347a76..cb807d0ea498 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -713,9 +713,13 @@ long vhost_vring_ioctl(struct vhost_dev *d, int ioctl, void __user *argp)
713 r = -EFAULT; 713 r = -EFAULT;
714 break; 714 break;
715 } 715 }
716 if ((a.avail_user_addr & (sizeof *vq->avail->ring - 1)) || 716
717 (a.used_user_addr & (sizeof *vq->used->ring - 1)) || 717 /* Make sure it's safe to cast pointers to vring types. */
718 (a.log_guest_addr & (sizeof *vq->used->ring - 1))) { 718 BUILD_BUG_ON(__alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE);
719 BUILD_BUG_ON(__alignof__ *vq->used > VRING_USED_ALIGN_SIZE);
720 if ((a.avail_user_addr & (VRING_AVAIL_ALIGN_SIZE - 1)) ||
721 (a.used_user_addr & (VRING_USED_ALIGN_SIZE - 1)) ||
722 (a.log_guest_addr & (sizeof(u64) - 1))) {
719 r = -EINVAL; 723 r = -EINVAL;
720 break; 724 break;
721 } 725 }
diff --git a/drivers/video/fbdev/core/fb_defio.c b/drivers/video/fbdev/core/fb_defio.c
index 900aa4ecd617..d6cab1fd9a47 100644
--- a/drivers/video/fbdev/core/fb_defio.c
+++ b/drivers/video/fbdev/core/fb_defio.c
@@ -83,9 +83,10 @@ int fb_deferred_io_fsync(struct file *file, loff_t start, loff_t end, int datasy
83 cancel_delayed_work_sync(&info->deferred_work); 83 cancel_delayed_work_sync(&info->deferred_work);
84 84
85 /* Run it immediately */ 85 /* Run it immediately */
86 err = schedule_delayed_work(&info->deferred_work, 0); 86 schedule_delayed_work(&info->deferred_work, 0);
87 mutex_unlock(&inode->i_mutex); 87 mutex_unlock(&inode->i_mutex);
88 return err; 88
89 return 0;
89} 90}
90EXPORT_SYMBOL_GPL(fb_deferred_io_fsync); 91EXPORT_SYMBOL_GPL(fb_deferred_io_fsync);
91 92
diff --git a/drivers/video/fbdev/omap2/dss/hdmi_pll.c b/drivers/video/fbdev/omap2/dss/hdmi_pll.c
index 87accdb59c81..ac83ef5cfd7d 100644
--- a/drivers/video/fbdev/omap2/dss/hdmi_pll.c
+++ b/drivers/video/fbdev/omap2/dss/hdmi_pll.c
@@ -132,7 +132,6 @@ static const struct dss_pll_hw dss_omap4_hdmi_pll_hw = {
132 .mX_max = 127, 132 .mX_max = 127,
133 .fint_min = 500000, 133 .fint_min = 500000,
134 .fint_max = 2500000, 134 .fint_max = 2500000,
135 .clkdco_max = 1800000000,
136 135
137 .clkdco_min = 500000000, 136 .clkdco_min = 500000000,
138 .clkdco_low = 1000000000, 137 .clkdco_low = 1000000000,
@@ -156,7 +155,6 @@ static const struct dss_pll_hw dss_omap5_hdmi_pll_hw = {
156 .mX_max = 127, 155 .mX_max = 127,
157 .fint_min = 620000, 156 .fint_min = 620000,
158 .fint_max = 2500000, 157 .fint_max = 2500000,
159 .clkdco_max = 1800000000,
160 158
161 .clkdco_min = 750000000, 159 .clkdco_min = 750000000,
162 .clkdco_low = 1500000000, 160 .clkdco_low = 1500000000,
diff --git a/drivers/video/fbdev/omap2/dss/pll.c b/drivers/video/fbdev/omap2/dss/pll.c
index 50bc62c5d367..335ffac224b9 100644
--- a/drivers/video/fbdev/omap2/dss/pll.c
+++ b/drivers/video/fbdev/omap2/dss/pll.c
@@ -97,7 +97,8 @@ int dss_pll_enable(struct dss_pll *pll)
97 return 0; 97 return 0;
98 98
99err_enable: 99err_enable:
100 regulator_disable(pll->regulator); 100 if (pll->regulator)
101 regulator_disable(pll->regulator);
101err_reg: 102err_reg:
102 clk_disable_unprepare(pll->clkin); 103 clk_disable_unprepare(pll->clkin);
103 return r; 104 return r;
diff --git a/drivers/video/fbdev/omap2/dss/sdi.c b/drivers/video/fbdev/omap2/dss/sdi.c
index d51a983075bc..5c2ccab5a958 100644
--- a/drivers/video/fbdev/omap2/dss/sdi.c
+++ b/drivers/video/fbdev/omap2/dss/sdi.c
@@ -342,6 +342,8 @@ static void sdi_init_output(struct platform_device *pdev)
342 out->output_type = OMAP_DISPLAY_TYPE_SDI; 342 out->output_type = OMAP_DISPLAY_TYPE_SDI;
343 out->name = "sdi.0"; 343 out->name = "sdi.0";
344 out->dispc_channel = OMAP_DSS_CHANNEL_LCD; 344 out->dispc_channel = OMAP_DSS_CHANNEL_LCD;
345 /* We have SDI only on OMAP3, where it's on port 1 */
346 out->port_num = 1;
345 out->ops.sdi = &sdi_ops; 347 out->ops.sdi = &sdi_ops;
346 out->owner = THIS_MODULE; 348 out->owner = THIS_MODULE;
347 349
diff --git a/drivers/video/logo/logo.c b/drivers/video/logo/logo.c
index 940cd196eef5..10fbfd8ab963 100644
--- a/drivers/video/logo/logo.c
+++ b/drivers/video/logo/logo.c
@@ -21,6 +21,21 @@ static bool nologo;
21module_param(nologo, bool, 0); 21module_param(nologo, bool, 0);
22MODULE_PARM_DESC(nologo, "Disables startup logo"); 22MODULE_PARM_DESC(nologo, "Disables startup logo");
23 23
24/*
25 * Logos are located in the initdata, and will be freed in kernel_init.
26 * Use late_init to mark the logos as freed to prevent any further use.
27 */
28
29static bool logos_freed;
30
31static int __init fb_logo_late_init(void)
32{
33 logos_freed = true;
34 return 0;
35}
36
37late_initcall(fb_logo_late_init);
38
24/* logo's are marked __initdata. Use __init_refok to tell 39/* logo's are marked __initdata. Use __init_refok to tell
25 * modpost that it is intended that this function uses data 40 * modpost that it is intended that this function uses data
26 * marked __initdata. 41 * marked __initdata.
@@ -29,7 +44,7 @@ const struct linux_logo * __init_refok fb_find_logo(int depth)
29{ 44{
30 const struct linux_logo *logo = NULL; 45 const struct linux_logo *logo = NULL;
31 46
32 if (nologo) 47 if (nologo || logos_freed)
33 return NULL; 48 return NULL;
34 49
35 if (depth >= 1) { 50 if (depth >= 1) {
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index e5d3eadf47b1..bed43081720f 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -5166,8 +5166,8 @@ int ext4_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
5166 5166
5167 /* fallback to generic here if not in extents fmt */ 5167 /* fallback to generic here if not in extents fmt */
5168 if (!(ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))) 5168 if (!(ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)))
5169 return __generic_block_fiemap(inode, fieinfo, start, len, 5169 return generic_block_fiemap(inode, fieinfo, start, len,
5170 ext4_get_block); 5170 ext4_get_block);
5171 5171
5172 if (fiemap_check_flags(fieinfo, EXT4_FIEMAP_FLAGS)) 5172 if (fiemap_check_flags(fieinfo, EXT4_FIEMAP_FLAGS))
5173 return -EBADR; 5173 return -EBADR;
diff --git a/fs/ext4/file.c b/fs/ext4/file.c
index 513c12cf444c..8131be8c0af3 100644
--- a/fs/ext4/file.c
+++ b/fs/ext4/file.c
@@ -273,19 +273,24 @@ static int ext4_file_open(struct inode * inode, struct file * filp)
273 * we determine this extent as a data or a hole according to whether the 273 * we determine this extent as a data or a hole according to whether the
274 * page cache has data or not. 274 * page cache has data or not.
275 */ 275 */
276static int ext4_find_unwritten_pgoff(struct inode *inode, int whence, 276static int ext4_find_unwritten_pgoff(struct inode *inode,
277 loff_t endoff, loff_t *offset) 277 int whence,
278 struct ext4_map_blocks *map,
279 loff_t *offset)
278{ 280{
279 struct pagevec pvec; 281 struct pagevec pvec;
282 unsigned int blkbits;
280 pgoff_t index; 283 pgoff_t index;
281 pgoff_t end; 284 pgoff_t end;
285 loff_t endoff;
282 loff_t startoff; 286 loff_t startoff;
283 loff_t lastoff; 287 loff_t lastoff;
284 int found = 0; 288 int found = 0;
285 289
290 blkbits = inode->i_sb->s_blocksize_bits;
286 startoff = *offset; 291 startoff = *offset;
287 lastoff = startoff; 292 lastoff = startoff;
288 293 endoff = (loff_t)(map->m_lblk + map->m_len) << blkbits;
289 294
290 index = startoff >> PAGE_CACHE_SHIFT; 295 index = startoff >> PAGE_CACHE_SHIFT;
291 end = endoff >> PAGE_CACHE_SHIFT; 296 end = endoff >> PAGE_CACHE_SHIFT;
@@ -403,144 +408,147 @@ out:
403static loff_t ext4_seek_data(struct file *file, loff_t offset, loff_t maxsize) 408static loff_t ext4_seek_data(struct file *file, loff_t offset, loff_t maxsize)
404{ 409{
405 struct inode *inode = file->f_mapping->host; 410 struct inode *inode = file->f_mapping->host;
406 struct fiemap_extent_info fie; 411 struct ext4_map_blocks map;
407 struct fiemap_extent ext[2]; 412 struct extent_status es;
408 loff_t next; 413 ext4_lblk_t start, last, end;
409 int i, ret = 0; 414 loff_t dataoff, isize;
415 int blkbits;
416 int ret = 0;
410 417
411 mutex_lock(&inode->i_mutex); 418 mutex_lock(&inode->i_mutex);
412 if (offset >= inode->i_size) { 419
420 isize = i_size_read(inode);
421 if (offset >= isize) {
413 mutex_unlock(&inode->i_mutex); 422 mutex_unlock(&inode->i_mutex);
414 return -ENXIO; 423 return -ENXIO;
415 } 424 }
416 fie.fi_flags = 0; 425
417 fie.fi_extents_max = 2; 426 blkbits = inode->i_sb->s_blocksize_bits;
418 fie.fi_extents_start = (struct fiemap_extent __user *) &ext; 427 start = offset >> blkbits;
419 while (1) { 428 last = start;
420 mm_segment_t old_fs = get_fs(); 429 end = isize >> blkbits;
421 430 dataoff = offset;
422 fie.fi_extents_mapped = 0; 431
423 memset(ext, 0, sizeof(*ext) * fie.fi_extents_max); 432 do {
424 433 map.m_lblk = last;
425 set_fs(get_ds()); 434 map.m_len = end - last + 1;
426 ret = ext4_fiemap(inode, &fie, offset, maxsize - offset); 435 ret = ext4_map_blocks(NULL, inode, &map, 0);
427 set_fs(old_fs); 436 if (ret > 0 && !(map.m_flags & EXT4_MAP_UNWRITTEN)) {
428 if (ret) 437 if (last != start)
438 dataoff = (loff_t)last << blkbits;
429 break; 439 break;
440 }
430 441
431 /* No extents found, EOF */ 442 /*
432 if (!fie.fi_extents_mapped) { 443 * If there is a delay extent at this offset,
433 ret = -ENXIO; 444 * it will be as a data.
445 */
446 ext4_es_find_delayed_extent_range(inode, last, last, &es);
447 if (es.es_len != 0 && in_range(last, es.es_lblk, es.es_len)) {
448 if (last != start)
449 dataoff = (loff_t)last << blkbits;
434 break; 450 break;
435 } 451 }
436 for (i = 0; i < fie.fi_extents_mapped; i++) {
437 next = (loff_t)(ext[i].fe_length + ext[i].fe_logical);
438 452
439 if (offset < (loff_t)ext[i].fe_logical) 453 /*
440 offset = (loff_t)ext[i].fe_logical; 454 * If there is a unwritten extent at this offset,
441 /* 455 * it will be as a data or a hole according to page
442 * If extent is not unwritten, then it contains valid 456 * cache that has data or not.
443 * data, mapped or delayed. 457 */
444 */ 458 if (map.m_flags & EXT4_MAP_UNWRITTEN) {
445 if (!(ext[i].fe_flags & FIEMAP_EXTENT_UNWRITTEN)) 459 int unwritten;
446 goto out; 460 unwritten = ext4_find_unwritten_pgoff(inode, SEEK_DATA,
461 &map, &dataoff);
462 if (unwritten)
463 break;
464 }
447 465
448 /* 466 last++;
449 * If there is a unwritten extent at this offset, 467 dataoff = (loff_t)last << blkbits;
450 * it will be as a data or a hole according to page 468 } while (last <= end);
451 * cache that has data or not.
452 */
453 if (ext4_find_unwritten_pgoff(inode, SEEK_DATA,
454 next, &offset))
455 goto out;
456 469
457 if (ext[i].fe_flags & FIEMAP_EXTENT_LAST) {
458 ret = -ENXIO;
459 goto out;
460 }
461 offset = next;
462 }
463 }
464 if (offset > inode->i_size)
465 offset = inode->i_size;
466out:
467 mutex_unlock(&inode->i_mutex); 470 mutex_unlock(&inode->i_mutex);
468 if (ret)
469 return ret;
470 471
471 return vfs_setpos(file, offset, maxsize); 472 if (dataoff > isize)
473 return -ENXIO;
474
475 return vfs_setpos(file, dataoff, maxsize);
472} 476}
473 477
474/* 478/*
475 * ext4_seek_hole() retrieves the offset for SEEK_HOLE 479 * ext4_seek_hole() retrieves the offset for SEEK_HOLE.
476 */ 480 */
477static loff_t ext4_seek_hole(struct file *file, loff_t offset, loff_t maxsize) 481static loff_t ext4_seek_hole(struct file *file, loff_t offset, loff_t maxsize)
478{ 482{
479 struct inode *inode = file->f_mapping->host; 483 struct inode *inode = file->f_mapping->host;
480 struct fiemap_extent_info fie; 484 struct ext4_map_blocks map;
481 struct fiemap_extent ext[2]; 485 struct extent_status es;
482 loff_t next; 486 ext4_lblk_t start, last, end;
483 int i, ret = 0; 487 loff_t holeoff, isize;
488 int blkbits;
489 int ret = 0;
484 490
485 mutex_lock(&inode->i_mutex); 491 mutex_lock(&inode->i_mutex);
486 if (offset >= inode->i_size) { 492
493 isize = i_size_read(inode);
494 if (offset >= isize) {
487 mutex_unlock(&inode->i_mutex); 495 mutex_unlock(&inode->i_mutex);
488 return -ENXIO; 496 return -ENXIO;
489 } 497 }
490 498
491 fie.fi_flags = 0; 499 blkbits = inode->i_sb->s_blocksize_bits;
492 fie.fi_extents_max = 2; 500 start = offset >> blkbits;
493 fie.fi_extents_start = (struct fiemap_extent __user *)&ext; 501 last = start;
494 while (1) { 502 end = isize >> blkbits;
495 mm_segment_t old_fs = get_fs(); 503 holeoff = offset;
496
497 fie.fi_extents_mapped = 0;
498 memset(ext, 0, sizeof(*ext));
499 504
500 set_fs(get_ds()); 505 do {
501 ret = ext4_fiemap(inode, &fie, offset, maxsize - offset); 506 map.m_lblk = last;
502 set_fs(old_fs); 507 map.m_len = end - last + 1;
503 if (ret) 508 ret = ext4_map_blocks(NULL, inode, &map, 0);
504 break; 509 if (ret > 0 && !(map.m_flags & EXT4_MAP_UNWRITTEN)) {
510 last += ret;
511 holeoff = (loff_t)last << blkbits;
512 continue;
513 }
505 514
506 /* No extents found */ 515 /*
507 if (!fie.fi_extents_mapped) 516 * If there is a delay extent at this offset,
508 break; 517 * we will skip this extent.
518 */
519 ext4_es_find_delayed_extent_range(inode, last, last, &es);
520 if (es.es_len != 0 && in_range(last, es.es_lblk, es.es_len)) {
521 last = es.es_lblk + es.es_len;
522 holeoff = (loff_t)last << blkbits;
523 continue;
524 }
509 525
510 for (i = 0; i < fie.fi_extents_mapped; i++) { 526 /*
511 next = (loff_t)(ext[i].fe_logical + ext[i].fe_length); 527 * If there is a unwritten extent at this offset,
512 /* 528 * it will be as a data or a hole according to page
513 * If extent is not unwritten, then it contains valid 529 * cache that has data or not.
514 * data, mapped or delayed. 530 */
515 */ 531 if (map.m_flags & EXT4_MAP_UNWRITTEN) {
516 if (!(ext[i].fe_flags & FIEMAP_EXTENT_UNWRITTEN)) { 532 int unwritten;
517 if (offset < (loff_t)ext[i].fe_logical) 533 unwritten = ext4_find_unwritten_pgoff(inode, SEEK_HOLE,
518 goto out; 534 &map, &holeoff);
519 offset = next; 535 if (!unwritten) {
536 last += ret;
537 holeoff = (loff_t)last << blkbits;
520 continue; 538 continue;
521 } 539 }
522 /*
523 * If there is a unwritten extent at this offset,
524 * it will be as a data or a hole according to page
525 * cache that has data or not.
526 */
527 if (ext4_find_unwritten_pgoff(inode, SEEK_HOLE,
528 next, &offset))
529 goto out;
530
531 offset = next;
532 if (ext[i].fe_flags & FIEMAP_EXTENT_LAST)
533 goto out;
534 } 540 }
535 } 541
536 if (offset > inode->i_size) 542 /* find a hole */
537 offset = inode->i_size; 543 break;
538out: 544 } while (last <= end);
545
539 mutex_unlock(&inode->i_mutex); 546 mutex_unlock(&inode->i_mutex);
540 if (ret)
541 return ret;
542 547
543 return vfs_setpos(file, offset, maxsize); 548 if (holeoff > isize)
549 holeoff = isize;
550
551 return vfs_setpos(file, holeoff, maxsize);
544} 552}
545 553
546/* 554/*
diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
index bf76f405a5f9..8a8ec6293b19 100644
--- a/fs/ext4/resize.c
+++ b/fs/ext4/resize.c
@@ -24,6 +24,18 @@ int ext4_resize_begin(struct super_block *sb)
24 return -EPERM; 24 return -EPERM;
25 25
26 /* 26 /*
27 * If we are not using the primary superblock/GDT copy don't resize,
28 * because the user tools have no way of handling this. Probably a
29 * bad time to do it anyways.
30 */
31 if (EXT4_SB(sb)->s_sbh->b_blocknr !=
32 le32_to_cpu(EXT4_SB(sb)->s_es->s_first_data_block)) {
33 ext4_warning(sb, "won't resize using backup superblock at %llu",
34 (unsigned long long)EXT4_SB(sb)->s_sbh->b_blocknr);
35 return -EPERM;
36 }
37
38 /*
27 * We are not allowed to do online-resizing on a filesystem mounted 39 * We are not allowed to do online-resizing on a filesystem mounted
28 * with error, because it can destroy the filesystem easily. 40 * with error, because it can destroy the filesystem easily.
29 */ 41 */
@@ -758,18 +770,6 @@ static int add_new_gdb(handle_t *handle, struct inode *inode,
758 "EXT4-fs: ext4_add_new_gdb: adding group block %lu\n", 770 "EXT4-fs: ext4_add_new_gdb: adding group block %lu\n",
759 gdb_num); 771 gdb_num);
760 772
761 /*
762 * If we are not using the primary superblock/GDT copy don't resize,
763 * because the user tools have no way of handling this. Probably a
764 * bad time to do it anyways.
765 */
766 if (EXT4_SB(sb)->s_sbh->b_blocknr !=
767 le32_to_cpu(EXT4_SB(sb)->s_es->s_first_data_block)) {
768 ext4_warning(sb, "won't resize using backup superblock at %llu",
769 (unsigned long long)EXT4_SB(sb)->s_sbh->b_blocknr);
770 return -EPERM;
771 }
772
773 gdb_bh = sb_bread(sb, gdblock); 773 gdb_bh = sb_bread(sb, gdblock);
774 if (!gdb_bh) 774 if (!gdb_bh)
775 return -EIO; 775 return -EIO;
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 43c92b1685cb..74c5f53595fb 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -3482,7 +3482,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
3482 if (EXT4_HAS_RO_COMPAT_FEATURE(sb, 3482 if (EXT4_HAS_RO_COMPAT_FEATURE(sb,
3483 EXT4_FEATURE_RO_COMPAT_METADATA_CSUM) && 3483 EXT4_FEATURE_RO_COMPAT_METADATA_CSUM) &&
3484 EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_GDT_CSUM)) 3484 EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_GDT_CSUM))
3485 ext4_warning(sb, KERN_INFO "metadata_csum and uninit_bg are " 3485 ext4_warning(sb, "metadata_csum and uninit_bg are "
3486 "redundant flags; please run fsck."); 3486 "redundant flags; please run fsck.");
3487 3487
3488 /* Check for a known checksum algorithm */ 3488 /* Check for a known checksum algorithm */
diff --git a/include/linux/mfd/stmpe.h b/include/linux/mfd/stmpe.h
index 575a86c7fcbd..f742b6717d52 100644
--- a/include/linux/mfd/stmpe.h
+++ b/include/linux/mfd/stmpe.h
@@ -50,6 +50,8 @@ enum {
50 STMPE_IDX_GPEDR_MSB, 50 STMPE_IDX_GPEDR_MSB,
51 STMPE_IDX_GPRER_LSB, 51 STMPE_IDX_GPRER_LSB,
52 STMPE_IDX_GPFER_LSB, 52 STMPE_IDX_GPFER_LSB,
53 STMPE_IDX_GPPUR_LSB,
54 STMPE_IDX_GPPDR_LSB,
53 STMPE_IDX_GPAFR_U_MSB, 55 STMPE_IDX_GPAFR_U_MSB,
54 STMPE_IDX_IEGPIOR_LSB, 56 STMPE_IDX_IEGPIOR_LSB,
55 STMPE_IDX_ISGPIOR_LSB, 57 STMPE_IDX_ISGPIOR_LSB,
@@ -113,24 +115,6 @@ extern int stmpe_set_altfunc(struct stmpe *stmpe, u32 pins,
113extern int stmpe_enable(struct stmpe *stmpe, unsigned int blocks); 115extern int stmpe_enable(struct stmpe *stmpe, unsigned int blocks);
114extern int stmpe_disable(struct stmpe *stmpe, unsigned int blocks); 116extern int stmpe_disable(struct stmpe *stmpe, unsigned int blocks);
115 117
116struct matrix_keymap_data;
117
118/**
119 * struct stmpe_keypad_platform_data - STMPE keypad platform data
120 * @keymap_data: key map table and size
121 * @debounce_ms: debounce interval, in ms. Maximum is
122 * %STMPE_KEYPAD_MAX_DEBOUNCE.
123 * @scan_count: number of key scanning cycles to confirm key data.
124 * Maximum is %STMPE_KEYPAD_MAX_SCAN_COUNT.
125 * @no_autorepeat: disable key autorepeat
126 */
127struct stmpe_keypad_platform_data {
128 const struct matrix_keymap_data *keymap_data;
129 unsigned int debounce_ms;
130 unsigned int scan_count;
131 bool no_autorepeat;
132};
133
134#define STMPE_GPIO_NOREQ_811_TOUCH (0xf0) 118#define STMPE_GPIO_NOREQ_811_TOUCH (0xf0)
135 119
136/** 120/**
@@ -199,7 +183,6 @@ struct stmpe_ts_platform_data {
199 * @irq_gpio: gpio number over which irq will be requested (significant only if 183 * @irq_gpio: gpio number over which irq will be requested (significant only if
200 * irq_over_gpio is true) 184 * irq_over_gpio is true)
201 * @gpio: GPIO-specific platform data 185 * @gpio: GPIO-specific platform data
202 * @keypad: keypad-specific platform data
203 * @ts: touchscreen-specific platform data 186 * @ts: touchscreen-specific platform data
204 */ 187 */
205struct stmpe_platform_data { 188struct stmpe_platform_data {
@@ -212,7 +195,6 @@ struct stmpe_platform_data {
212 int autosleep_timeout; 195 int autosleep_timeout;
213 196
214 struct stmpe_gpio_platform_data *gpio; 197 struct stmpe_gpio_platform_data *gpio;
215 struct stmpe_keypad_platform_data *keypad;
216 struct stmpe_ts_platform_data *ts; 198 struct stmpe_ts_platform_data *ts;
217}; 199};
218 200
diff --git a/include/linux/mm.h b/include/linux/mm.h
index f80d0194c9bc..80fc92a49649 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1952,7 +1952,7 @@ extern int expand_downwards(struct vm_area_struct *vma,
1952#if VM_GROWSUP 1952#if VM_GROWSUP
1953extern int expand_upwards(struct vm_area_struct *vma, unsigned long address); 1953extern int expand_upwards(struct vm_area_struct *vma, unsigned long address);
1954#else 1954#else
1955 #define expand_upwards(vma, address) do { } while (0) 1955 #define expand_upwards(vma, address) (0)
1956#endif 1956#endif
1957 1957
1958/* Look up the first VMA which satisfies addr < vm_end, NULL if none. */ 1958/* Look up the first VMA which satisfies addr < vm_end, NULL if none. */
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 58d719ddaa60..29c7be8808d5 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -1270,8 +1270,7 @@ struct ieee80211_vif *wdev_to_ieee80211_vif(struct wireless_dev *wdev);
1270 * 1270 *
1271 * @IEEE80211_KEY_FLAG_GENERATE_IV: This flag should be set by the 1271 * @IEEE80211_KEY_FLAG_GENERATE_IV: This flag should be set by the
1272 * driver to indicate that it requires IV generation for this 1272 * driver to indicate that it requires IV generation for this
1273 * particular key. Setting this flag does not necessarily mean that SKBs 1273 * particular key.
1274 * will have sufficient tailroom for ICV or MIC.
1275 * @IEEE80211_KEY_FLAG_GENERATE_MMIC: This flag should be set by 1274 * @IEEE80211_KEY_FLAG_GENERATE_MMIC: This flag should be set by
1276 * the driver for a TKIP key if it requires Michael MIC 1275 * the driver for a TKIP key if it requires Michael MIC
1277 * generation in software. 1276 * generation in software.
@@ -1283,9 +1282,7 @@ struct ieee80211_vif *wdev_to_ieee80211_vif(struct wireless_dev *wdev);
1283 * @IEEE80211_KEY_FLAG_PUT_IV_SPACE: This flag should be set by the driver 1282 * @IEEE80211_KEY_FLAG_PUT_IV_SPACE: This flag should be set by the driver
1284 * if space should be prepared for the IV, but the IV 1283 * if space should be prepared for the IV, but the IV
1285 * itself should not be generated. Do not set together with 1284 * itself should not be generated. Do not set together with
1286 * @IEEE80211_KEY_FLAG_GENERATE_IV on the same key. Setting this flag does 1285 * @IEEE80211_KEY_FLAG_GENERATE_IV on the same key.
1287 * not necessarily mean that SKBs will have sufficient tailroom for ICV or
1288 * MIC.
1289 * @IEEE80211_KEY_FLAG_RX_MGMT: This key will be used to decrypt received 1286 * @IEEE80211_KEY_FLAG_RX_MGMT: This key will be used to decrypt received
1290 * management frames. The flag can help drivers that have a hardware 1287 * management frames. The flag can help drivers that have a hardware
1291 * crypto implementation that doesn't deal with management frames 1288 * crypto implementation that doesn't deal with management frames
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index 1e7f74acc2ec..b429b73e875e 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -857,7 +857,7 @@ static inline unsigned int params_channels(const struct snd_pcm_hw_params *p)
857} 857}
858 858
859/** 859/**
860 * params_channels - Get the sample rate from the hw params 860 * params_rate - Get the sample rate from the hw params
861 * @p: hw params 861 * @p: hw params
862 */ 862 */
863static inline unsigned int params_rate(const struct snd_pcm_hw_params *p) 863static inline unsigned int params_rate(const struct snd_pcm_hw_params *p)
@@ -866,7 +866,7 @@ static inline unsigned int params_rate(const struct snd_pcm_hw_params *p)
866} 866}
867 867
868/** 868/**
869 * params_channels - Get the period size (in frames) from the hw params 869 * params_period_size - Get the period size (in frames) from the hw params
870 * @p: hw params 870 * @p: hw params
871 */ 871 */
872static inline unsigned int params_period_size(const struct snd_pcm_hw_params *p) 872static inline unsigned int params_period_size(const struct snd_pcm_hw_params *p)
@@ -875,7 +875,7 @@ static inline unsigned int params_period_size(const struct snd_pcm_hw_params *p)
875} 875}
876 876
877/** 877/**
878 * params_channels - Get the number of periods from the hw params 878 * params_periods - Get the number of periods from the hw params
879 * @p: hw params 879 * @p: hw params
880 */ 880 */
881static inline unsigned int params_periods(const struct snd_pcm_hw_params *p) 881static inline unsigned int params_periods(const struct snd_pcm_hw_params *p)
@@ -884,7 +884,7 @@ static inline unsigned int params_periods(const struct snd_pcm_hw_params *p)
884} 884}
885 885
886/** 886/**
887 * params_channels - Get the buffer size (in frames) from the hw params 887 * params_buffer_size - Get the buffer size (in frames) from the hw params
888 * @p: hw params 888 * @p: hw params
889 */ 889 */
890static inline unsigned int params_buffer_size(const struct snd_pcm_hw_params *p) 890static inline unsigned int params_buffer_size(const struct snd_pcm_hw_params *p)
@@ -893,7 +893,7 @@ static inline unsigned int params_buffer_size(const struct snd_pcm_hw_params *p)
893} 893}
894 894
895/** 895/**
896 * params_channels - Get the buffer size (in bytes) from the hw params 896 * params_buffer_bytes - Get the buffer size (in bytes) from the hw params
897 * @p: hw params 897 * @p: hw params
898 */ 898 */
899static inline unsigned int params_buffer_bytes(const struct snd_pcm_hw_params *p) 899static inline unsigned int params_buffer_bytes(const struct snd_pcm_hw_params *p)
diff --git a/include/uapi/linux/virtio_ring.h b/include/uapi/linux/virtio_ring.h
index 61c818a7fe70..a3318f31e8e7 100644
--- a/include/uapi/linux/virtio_ring.h
+++ b/include/uapi/linux/virtio_ring.h
@@ -101,6 +101,13 @@ struct vring {
101 struct vring_used *used; 101 struct vring_used *used;
102}; 102};
103 103
104/* Alignment requirements for vring elements.
105 * When using pre-virtio 1.0 layout, these fall out naturally.
106 */
107#define VRING_AVAIL_ALIGN_SIZE 2
108#define VRING_USED_ALIGN_SIZE 4
109#define VRING_DESC_ALIGN_SIZE 16
110
104/* The standard layout for the ring is a continuous chunk of memory which looks 111/* The standard layout for the ring is a continuous chunk of memory which looks
105 * like this. We assume num is a power of 2. 112 * like this. We assume num is a power of 2.
106 * 113 *
diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index 37c69ab561da..072566dd0caf 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -72,6 +72,8 @@
72#include <linux/fs_struct.h> 72#include <linux/fs_struct.h>
73#include <linux/compat.h> 73#include <linux/compat.h>
74#include <linux/ctype.h> 74#include <linux/ctype.h>
75#include <linux/string.h>
76#include <uapi/linux/limits.h>
75 77
76#include "audit.h" 78#include "audit.h"
77 79
@@ -1861,8 +1863,7 @@ void __audit_inode(struct filename *name, const struct dentry *dentry,
1861 } 1863 }
1862 1864
1863 list_for_each_entry_reverse(n, &context->names_list, list) { 1865 list_for_each_entry_reverse(n, &context->names_list, list) {
1864 /* does the name pointer match? */ 1866 if (!n->name || strcmp(n->name->name, name->name))
1865 if (!n->name || n->name->name != name->name)
1866 continue; 1867 continue;
1867 1868
1868 /* match the correct record type */ 1869 /* match the correct record type */
@@ -1881,14 +1882,44 @@ out_alloc:
1881 n = audit_alloc_name(context, AUDIT_TYPE_UNKNOWN); 1882 n = audit_alloc_name(context, AUDIT_TYPE_UNKNOWN);
1882 if (!n) 1883 if (!n)
1883 return; 1884 return;
1884 if (name) 1885 /* unfortunately, while we may have a path name to record with the
1885 /* since name is not NULL we know there is already a matching 1886 * inode, we can't always rely on the string lasting until the end of
1886 * name record, see audit_getname(), so there must be a type 1887 * the syscall so we need to create our own copy, it may fail due to
1887 * mismatch; reuse the string path since the original name 1888 * memory allocation issues, but we do our best */
1888 * record will keep the string valid until we free it in 1889 if (name) {
1889 * audit_free_names() */ 1890 /* we can't use getname_kernel() due to size limits */
1890 n->name = name; 1891 size_t len = strlen(name->name) + 1;
1892 struct filename *new = __getname();
1893
1894 if (unlikely(!new))
1895 goto out;
1896
1897 if (len <= (PATH_MAX - sizeof(*new))) {
1898 new->name = (char *)(new) + sizeof(*new);
1899 new->separate = false;
1900 } else if (len <= PATH_MAX) {
1901 /* this looks odd, but is due to final_putname() */
1902 struct filename *new2;
1891 1903
1904 new2 = kmalloc(sizeof(*new2), GFP_KERNEL);
1905 if (unlikely(!new2)) {
1906 __putname(new);
1907 goto out;
1908 }
1909 new2->name = (char *)new;
1910 new2->separate = true;
1911 new = new2;
1912 } else {
1913 /* we should never get here, but let's be safe */
1914 __putname(new);
1915 goto out;
1916 }
1917 strlcpy((char *)new->name, name->name, len);
1918 new->uptr = NULL;
1919 new->aname = n;
1920 n->name = new;
1921 n->name_put = true;
1922 }
1892out: 1923out:
1893 if (parent) { 1924 if (parent) {
1894 n->name_len = n->name ? parent_len(n->name->name) : AUDIT_NAME_FULL; 1925 n->name_len = n->name ? parent_len(n->name->name) : AUDIT_NAME_FULL;
diff --git a/mm/memory.c b/mm/memory.c
index ca920d1fd314..d7e497e98f46 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -2593,7 +2593,7 @@ static inline int check_stack_guard_page(struct vm_area_struct *vma, unsigned lo
2593 if (prev && prev->vm_end == address) 2593 if (prev && prev->vm_end == address)
2594 return prev->vm_flags & VM_GROWSDOWN ? 0 : -ENOMEM; 2594 return prev->vm_flags & VM_GROWSDOWN ? 0 : -ENOMEM;
2595 2595
2596 expand_downwards(vma, address - PAGE_SIZE); 2596 return expand_downwards(vma, address - PAGE_SIZE);
2597 } 2597 }
2598 if ((vma->vm_flags & VM_GROWSUP) && address + PAGE_SIZE == vma->vm_end) { 2598 if ((vma->vm_flags & VM_GROWSUP) && address + PAGE_SIZE == vma->vm_end) {
2599 struct vm_area_struct *next = vma->vm_next; 2599 struct vm_area_struct *next = vma->vm_next;
@@ -2602,7 +2602,7 @@ static inline int check_stack_guard_page(struct vm_area_struct *vma, unsigned lo
2602 if (next && next->vm_start == address + PAGE_SIZE) 2602 if (next && next->vm_start == address + PAGE_SIZE)
2603 return next->vm_flags & VM_GROWSUP ? 0 : -ENOMEM; 2603 return next->vm_flags & VM_GROWSUP ? 0 : -ENOMEM;
2604 2604
2605 expand_upwards(vma, address + PAGE_SIZE); 2605 return expand_upwards(vma, address + PAGE_SIZE);
2606 } 2606 }
2607 return 0; 2607 return 0;
2608} 2608}
diff --git a/net/batman-adv/multicast.c b/net/batman-adv/multicast.c
index ab6bb2af1d45..b24e4bb64fb5 100644
--- a/net/batman-adv/multicast.c
+++ b/net/batman-adv/multicast.c
@@ -685,11 +685,13 @@ static void batadv_mcast_tvlv_ogm_handler_v1(struct batadv_priv *bat_priv,
685 if (orig_initialized) 685 if (orig_initialized)
686 atomic_dec(&bat_priv->mcast.num_disabled); 686 atomic_dec(&bat_priv->mcast.num_disabled);
687 orig->capabilities |= BATADV_ORIG_CAPA_HAS_MCAST; 687 orig->capabilities |= BATADV_ORIG_CAPA_HAS_MCAST;
688 /* If mcast support is being switched off increase the disabled 688 /* If mcast support is being switched off or if this is an initial
689 * mcast node counter. 689 * OGM without mcast support then increase the disabled mcast
690 * node counter.
690 */ 691 */
691 } else if (!orig_mcast_enabled && 692 } else if (!orig_mcast_enabled &&
692 orig->capabilities & BATADV_ORIG_CAPA_HAS_MCAST) { 693 (orig->capabilities & BATADV_ORIG_CAPA_HAS_MCAST ||
694 !orig_initialized)) {
693 atomic_inc(&bat_priv->mcast.num_disabled); 695 atomic_inc(&bat_priv->mcast.num_disabled);
694 orig->capabilities &= ~BATADV_ORIG_CAPA_HAS_MCAST; 696 orig->capabilities &= ~BATADV_ORIG_CAPA_HAS_MCAST;
695 } 697 }
@@ -738,7 +740,8 @@ void batadv_mcast_purge_orig(struct batadv_orig_node *orig)
738{ 740{
739 struct batadv_priv *bat_priv = orig->bat_priv; 741 struct batadv_priv *bat_priv = orig->bat_priv;
740 742
741 if (!(orig->capabilities & BATADV_ORIG_CAPA_HAS_MCAST)) 743 if (!(orig->capabilities & BATADV_ORIG_CAPA_HAS_MCAST) &&
744 orig->capa_initialized & BATADV_ORIG_CAPA_HAS_MCAST)
742 atomic_dec(&bat_priv->mcast.num_disabled); 745 atomic_dec(&bat_priv->mcast.num_disabled);
743 746
744 batadv_mcast_want_unsnoop_update(bat_priv, orig, BATADV_NO_FLAGS); 747 batadv_mcast_want_unsnoop_update(bat_priv, orig, BATADV_NO_FLAGS);
diff --git a/net/batman-adv/network-coding.c b/net/batman-adv/network-coding.c
index 8d04d174669e..fab47f1f3ef9 100644
--- a/net/batman-adv/network-coding.c
+++ b/net/batman-adv/network-coding.c
@@ -133,7 +133,7 @@ int batadv_nc_mesh_init(struct batadv_priv *bat_priv)
133 if (!bat_priv->nc.decoding_hash) 133 if (!bat_priv->nc.decoding_hash)
134 goto err; 134 goto err;
135 135
136 batadv_hash_set_lock_class(bat_priv->nc.coding_hash, 136 batadv_hash_set_lock_class(bat_priv->nc.decoding_hash,
137 &batadv_nc_decoding_hash_lock_class_key); 137 &batadv_nc_decoding_hash_lock_class_key);
138 138
139 INIT_DELAYED_WORK(&bat_priv->nc.work, batadv_nc_worker); 139 INIT_DELAYED_WORK(&bat_priv->nc.work, batadv_nc_worker);
diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c
index 6a484514cd3e..bea8198d0198 100644
--- a/net/batman-adv/originator.c
+++ b/net/batman-adv/originator.c
@@ -570,9 +570,6 @@ static void batadv_orig_node_free_rcu(struct rcu_head *rcu)
570 570
571 batadv_frag_purge_orig(orig_node, NULL); 571 batadv_frag_purge_orig(orig_node, NULL);
572 572
573 batadv_tt_global_del_orig(orig_node->bat_priv, orig_node, -1,
574 "originator timed out");
575
576 if (orig_node->bat_priv->bat_algo_ops->bat_orig_free) 573 if (orig_node->bat_priv->bat_algo_ops->bat_orig_free)
577 orig_node->bat_priv->bat_algo_ops->bat_orig_free(orig_node); 574 orig_node->bat_priv->bat_algo_ops->bat_orig_free(orig_node);
578 575
@@ -678,6 +675,7 @@ struct batadv_orig_node *batadv_orig_node_new(struct batadv_priv *bat_priv,
678 atomic_set(&orig_node->last_ttvn, 0); 675 atomic_set(&orig_node->last_ttvn, 0);
679 orig_node->tt_buff = NULL; 676 orig_node->tt_buff = NULL;
680 orig_node->tt_buff_len = 0; 677 orig_node->tt_buff_len = 0;
678 orig_node->last_seen = jiffies;
681 reset_time = jiffies - 1 - msecs_to_jiffies(BATADV_RESET_PROTECTION_MS); 679 reset_time = jiffies - 1 - msecs_to_jiffies(BATADV_RESET_PROTECTION_MS);
682 orig_node->bcast_seqno_reset = reset_time; 680 orig_node->bcast_seqno_reset = reset_time;
683#ifdef CONFIG_BATMAN_ADV_MCAST 681#ifdef CONFIG_BATMAN_ADV_MCAST
@@ -977,6 +975,9 @@ static void _batadv_purge_orig(struct batadv_priv *bat_priv)
977 if (batadv_purge_orig_node(bat_priv, orig_node)) { 975 if (batadv_purge_orig_node(bat_priv, orig_node)) {
978 batadv_gw_node_delete(bat_priv, orig_node); 976 batadv_gw_node_delete(bat_priv, orig_node);
979 hlist_del_rcu(&orig_node->hash_entry); 977 hlist_del_rcu(&orig_node->hash_entry);
978 batadv_tt_global_del_orig(orig_node->bat_priv,
979 orig_node, -1,
980 "originator timed out");
980 batadv_orig_node_free_ref(orig_node); 981 batadv_orig_node_free_ref(orig_node);
981 continue; 982 continue;
982 } 983 }
diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index 35f76f2f7824..6648f321864d 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -443,11 +443,13 @@ batadv_find_router(struct batadv_priv *bat_priv,
443 443
444 router = batadv_orig_router_get(orig_node, recv_if); 444 router = batadv_orig_router_get(orig_node, recv_if);
445 445
446 if (!router)
447 return router;
448
446 /* only consider bonding for recv_if == BATADV_IF_DEFAULT (first hop) 449 /* only consider bonding for recv_if == BATADV_IF_DEFAULT (first hop)
447 * and if activated. 450 * and if activated.
448 */ 451 */
449 if (recv_if == BATADV_IF_DEFAULT || !atomic_read(&bat_priv->bonding) || 452 if (!(recv_if == BATADV_IF_DEFAULT && atomic_read(&bat_priv->bonding)))
450 !router)
451 return router; 453 return router;
452 454
453 /* bonding: loop through the list of possible routers found 455 /* bonding: loop through the list of possible routers found
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index dc30cb563e4f..20ab06b228ac 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -2019,7 +2019,7 @@ static bool tcp_write_xmit(struct sock *sk, unsigned int mss_now, int nonagle,
2019 if (unlikely(!tcp_snd_wnd_test(tp, skb, mss_now))) 2019 if (unlikely(!tcp_snd_wnd_test(tp, skb, mss_now)))
2020 break; 2020 break;
2021 2021
2022 if (tso_segs == 1) { 2022 if (tso_segs == 1 || !max_segs) {
2023 if (unlikely(!tcp_nagle_test(tp, skb, mss_now, 2023 if (unlikely(!tcp_nagle_test(tp, skb, mss_now,
2024 (tcp_skb_is_last(sk, skb) ? 2024 (tcp_skb_is_last(sk, skb) ?
2025 nonagle : TCP_NAGLE_PUSH)))) 2025 nonagle : TCP_NAGLE_PUSH))))
@@ -2032,7 +2032,7 @@ static bool tcp_write_xmit(struct sock *sk, unsigned int mss_now, int nonagle,
2032 } 2032 }
2033 2033
2034 limit = mss_now; 2034 limit = mss_now;
2035 if (tso_segs > 1 && !tcp_urg_mode(tp)) 2035 if (tso_segs > 1 && max_segs && !tcp_urg_mode(tp))
2036 limit = tcp_mss_split_point(sk, skb, mss_now, 2036 limit = tcp_mss_split_point(sk, skb, mss_now,
2037 min_t(unsigned int, 2037 min_t(unsigned int,
2038 cwnd_quota, 2038 cwnd_quota,
diff --git a/net/mac80211/key.c b/net/mac80211/key.c
index 0bb7038121ac..bd4e46ec32bd 100644
--- a/net/mac80211/key.c
+++ b/net/mac80211/key.c
@@ -140,7 +140,9 @@ static int ieee80211_key_enable_hw_accel(struct ieee80211_key *key)
140 if (!ret) { 140 if (!ret) {
141 key->flags |= KEY_FLAG_UPLOADED_TO_HARDWARE; 141 key->flags |= KEY_FLAG_UPLOADED_TO_HARDWARE;
142 142
143 if (!(key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC)) 143 if (!((key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC) ||
144 (key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV) ||
145 (key->conf.flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE)))
144 sdata->crypto_tx_tailroom_needed_cnt--; 146 sdata->crypto_tx_tailroom_needed_cnt--;
145 147
146 WARN_ON((key->conf.flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE) && 148 WARN_ON((key->conf.flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE) &&
@@ -188,7 +190,9 @@ static void ieee80211_key_disable_hw_accel(struct ieee80211_key *key)
188 sta = key->sta; 190 sta = key->sta;
189 sdata = key->sdata; 191 sdata = key->sdata;
190 192
191 if (!(key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC)) 193 if (!((key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC) ||
194 (key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV) ||
195 (key->conf.flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE)))
192 increment_tailroom_need_count(sdata); 196 increment_tailroom_need_count(sdata);
193 197
194 ret = drv_set_key(key->local, DISABLE_KEY, sdata, 198 ret = drv_set_key(key->local, DISABLE_KEY, sdata,
@@ -884,7 +888,9 @@ void ieee80211_remove_key(struct ieee80211_key_conf *keyconf)
884 if (key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) { 888 if (key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) {
885 key->flags &= ~KEY_FLAG_UPLOADED_TO_HARDWARE; 889 key->flags &= ~KEY_FLAG_UPLOADED_TO_HARDWARE;
886 890
887 if (!(key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC)) 891 if (!((key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC) ||
892 (key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV) ||
893 (key->conf.flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE)))
888 increment_tailroom_need_count(key->sdata); 894 increment_tailroom_need_count(key->sdata);
889 } 895 }
890 896
diff --git a/net/openvswitch/flow.c b/net/openvswitch/flow.c
index 70bef2ab7f2b..da2fae0873a5 100644
--- a/net/openvswitch/flow.c
+++ b/net/openvswitch/flow.c
@@ -70,6 +70,7 @@ void ovs_flow_stats_update(struct sw_flow *flow, __be16 tcp_flags,
70{ 70{
71 struct flow_stats *stats; 71 struct flow_stats *stats;
72 int node = numa_node_id(); 72 int node = numa_node_id();
73 int len = skb->len + (vlan_tx_tag_present(skb) ? VLAN_HLEN : 0);
73 74
74 stats = rcu_dereference(flow->stats[node]); 75 stats = rcu_dereference(flow->stats[node]);
75 76
@@ -105,7 +106,7 @@ void ovs_flow_stats_update(struct sw_flow *flow, __be16 tcp_flags,
105 if (likely(new_stats)) { 106 if (likely(new_stats)) {
106 new_stats->used = jiffies; 107 new_stats->used = jiffies;
107 new_stats->packet_count = 1; 108 new_stats->packet_count = 1;
108 new_stats->byte_count = skb->len; 109 new_stats->byte_count = len;
109 new_stats->tcp_flags = tcp_flags; 110 new_stats->tcp_flags = tcp_flags;
110 spin_lock_init(&new_stats->lock); 111 spin_lock_init(&new_stats->lock);
111 112
@@ -120,7 +121,7 @@ void ovs_flow_stats_update(struct sw_flow *flow, __be16 tcp_flags,
120 121
121 stats->used = jiffies; 122 stats->used = jiffies;
122 stats->packet_count++; 123 stats->packet_count++;
123 stats->byte_count += skb->len; 124 stats->byte_count += len;
124 stats->tcp_flags |= tcp_flags; 125 stats->tcp_flags |= tcp_flags;
125unlock: 126unlock:
126 spin_unlock(&stats->lock); 127 spin_unlock(&stats->lock);
diff --git a/net/openvswitch/vport.c b/net/openvswitch/vport.c
index 53f3ebbfceab..2034c6d9cb5a 100644
--- a/net/openvswitch/vport.c
+++ b/net/openvswitch/vport.c
@@ -480,7 +480,7 @@ void ovs_vport_receive(struct vport *vport, struct sk_buff *skb,
480 stats = this_cpu_ptr(vport->percpu_stats); 480 stats = this_cpu_ptr(vport->percpu_stats);
481 u64_stats_update_begin(&stats->syncp); 481 u64_stats_update_begin(&stats->syncp);
482 stats->rx_packets++; 482 stats->rx_packets++;
483 stats->rx_bytes += skb->len; 483 stats->rx_bytes += skb->len + (vlan_tx_tag_present(skb) ? VLAN_HLEN : 0);
484 u64_stats_update_end(&stats->syncp); 484 u64_stats_update_end(&stats->syncp);
485 485
486 OVS_CB(skb)->input_vport = vport; 486 OVS_CB(skb)->input_vport = vport;
diff --git a/net/wireless/Kconfig b/net/wireless/Kconfig
index 22ba971741e5..29c8675f9a11 100644
--- a/net/wireless/Kconfig
+++ b/net/wireless/Kconfig
@@ -175,7 +175,7 @@ config CFG80211_INTERNAL_REGDB
175 Most distributions have a CRDA package. So if unsure, say N. 175 Most distributions have a CRDA package. So if unsure, say N.
176 176
177config CFG80211_WEXT 177config CFG80211_WEXT
178 bool 178 bool "cfg80211 wireless extensions compatibility"
179 depends on CFG80211 179 depends on CFG80211
180 select WEXT_CORE 180 select WEXT_CORE
181 help 181 help
diff --git a/sound/soc/codecs/rt5677.c b/sound/soc/codecs/rt5677.c
index 81fe1464d268..c0fbe1881439 100644
--- a/sound/soc/codecs/rt5677.c
+++ b/sound/soc/codecs/rt5677.c
@@ -784,8 +784,8 @@ static unsigned int bst_tlv[] = {
784static int rt5677_dsp_vad_get(struct snd_kcontrol *kcontrol, 784static int rt5677_dsp_vad_get(struct snd_kcontrol *kcontrol,
785 struct snd_ctl_elem_value *ucontrol) 785 struct snd_ctl_elem_value *ucontrol)
786{ 786{
787 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 787 struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
788 struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); 788 struct rt5677_priv *rt5677 = snd_soc_component_get_drvdata(component);
789 789
790 ucontrol->value.integer.value[0] = rt5677->dsp_vad_en; 790 ucontrol->value.integer.value[0] = rt5677->dsp_vad_en;
791 791
@@ -795,8 +795,9 @@ static int rt5677_dsp_vad_get(struct snd_kcontrol *kcontrol,
795static int rt5677_dsp_vad_put(struct snd_kcontrol *kcontrol, 795static int rt5677_dsp_vad_put(struct snd_kcontrol *kcontrol,
796 struct snd_ctl_elem_value *ucontrol) 796 struct snd_ctl_elem_value *ucontrol)
797{ 797{
798 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 798 struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
799 struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); 799 struct rt5677_priv *rt5677 = snd_soc_component_get_drvdata(component);
800 struct snd_soc_codec *codec = snd_soc_component_to_codec(component);
800 801
801 rt5677->dsp_vad_en = !!ucontrol->value.integer.value[0]; 802 rt5677->dsp_vad_en = !!ucontrol->value.integer.value[0];
802 803
diff --git a/sound/soc/dwc/designware_i2s.c b/sound/soc/dwc/designware_i2s.c
index b93168d4f648..8d18bbda661b 100644
--- a/sound/soc/dwc/designware_i2s.c
+++ b/sound/soc/dwc/designware_i2s.c
@@ -209,16 +209,9 @@ static int dw_i2s_hw_params(struct snd_pcm_substream *substream,
209 209
210 switch (config->chan_nr) { 210 switch (config->chan_nr) {
211 case EIGHT_CHANNEL_SUPPORT: 211 case EIGHT_CHANNEL_SUPPORT:
212 ch_reg = 3;
213 break;
214 case SIX_CHANNEL_SUPPORT: 212 case SIX_CHANNEL_SUPPORT:
215 ch_reg = 2;
216 break;
217 case FOUR_CHANNEL_SUPPORT: 213 case FOUR_CHANNEL_SUPPORT:
218 ch_reg = 1;
219 break;
220 case TWO_CHANNEL_SUPPORT: 214 case TWO_CHANNEL_SUPPORT:
221 ch_reg = 0;
222 break; 215 break;
223 default: 216 default:
224 dev_err(dev->dev, "channel not supported\n"); 217 dev_err(dev->dev, "channel not supported\n");
@@ -227,18 +220,22 @@ static int dw_i2s_hw_params(struct snd_pcm_substream *substream,
227 220
228 i2s_disable_channels(dev, substream->stream); 221 i2s_disable_channels(dev, substream->stream);
229 222
230 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { 223 for (ch_reg = 0; ch_reg < (config->chan_nr / 2); ch_reg++) {
231 i2s_write_reg(dev->i2s_base, TCR(ch_reg), xfer_resolution); 224 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
232 i2s_write_reg(dev->i2s_base, TFCR(ch_reg), 0x02); 225 i2s_write_reg(dev->i2s_base, TCR(ch_reg),
233 irq = i2s_read_reg(dev->i2s_base, IMR(ch_reg)); 226 xfer_resolution);
234 i2s_write_reg(dev->i2s_base, IMR(ch_reg), irq & ~0x30); 227 i2s_write_reg(dev->i2s_base, TFCR(ch_reg), 0x02);
235 i2s_write_reg(dev->i2s_base, TER(ch_reg), 1); 228 irq = i2s_read_reg(dev->i2s_base, IMR(ch_reg));
236 } else { 229 i2s_write_reg(dev->i2s_base, IMR(ch_reg), irq & ~0x30);
237 i2s_write_reg(dev->i2s_base, RCR(ch_reg), xfer_resolution); 230 i2s_write_reg(dev->i2s_base, TER(ch_reg), 1);
238 i2s_write_reg(dev->i2s_base, RFCR(ch_reg), 0x07); 231 } else {
239 irq = i2s_read_reg(dev->i2s_base, IMR(ch_reg)); 232 i2s_write_reg(dev->i2s_base, RCR(ch_reg),
240 i2s_write_reg(dev->i2s_base, IMR(ch_reg), irq & ~0x03); 233 xfer_resolution);
241 i2s_write_reg(dev->i2s_base, RER(ch_reg), 1); 234 i2s_write_reg(dev->i2s_base, RFCR(ch_reg), 0x07);
235 irq = i2s_read_reg(dev->i2s_base, IMR(ch_reg));
236 i2s_write_reg(dev->i2s_base, IMR(ch_reg), irq & ~0x03);
237 i2s_write_reg(dev->i2s_base, RER(ch_reg), 1);
238 }
242 } 239 }
243 240
244 i2s_write_reg(dev->i2s_base, CCR, ccr); 241 i2s_write_reg(dev->i2s_base, CCR, ccr);
@@ -263,6 +260,19 @@ static void dw_i2s_shutdown(struct snd_pcm_substream *substream,
263 snd_soc_dai_set_dma_data(dai, substream, NULL); 260 snd_soc_dai_set_dma_data(dai, substream, NULL);
264} 261}
265 262
263static int dw_i2s_prepare(struct snd_pcm_substream *substream,
264 struct snd_soc_dai *dai)
265{
266 struct dw_i2s_dev *dev = snd_soc_dai_get_drvdata(dai);
267
268 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
269 i2s_write_reg(dev->i2s_base, TXFFR, 1);
270 else
271 i2s_write_reg(dev->i2s_base, RXFFR, 1);
272
273 return 0;
274}
275
266static int dw_i2s_trigger(struct snd_pcm_substream *substream, 276static int dw_i2s_trigger(struct snd_pcm_substream *substream,
267 int cmd, struct snd_soc_dai *dai) 277 int cmd, struct snd_soc_dai *dai)
268{ 278{
@@ -294,6 +304,7 @@ static struct snd_soc_dai_ops dw_i2s_dai_ops = {
294 .startup = dw_i2s_startup, 304 .startup = dw_i2s_startup,
295 .shutdown = dw_i2s_shutdown, 305 .shutdown = dw_i2s_shutdown,
296 .hw_params = dw_i2s_hw_params, 306 .hw_params = dw_i2s_hw_params,
307 .prepare = dw_i2s_prepare,
297 .trigger = dw_i2s_trigger, 308 .trigger = dw_i2s_trigger,
298}; 309};
299 310
diff --git a/sound/soc/intel/Kconfig b/sound/soc/intel/Kconfig
index e989ecf046c9..f86de1211b96 100644
--- a/sound/soc/intel/Kconfig
+++ b/sound/soc/intel/Kconfig
@@ -89,7 +89,7 @@ config SND_SOC_INTEL_BROADWELL_MACH
89 89
90config SND_SOC_INTEL_BYTCR_RT5640_MACH 90config SND_SOC_INTEL_BYTCR_RT5640_MACH
91 tristate "ASoC Audio DSP Support for MID BYT Platform" 91 tristate "ASoC Audio DSP Support for MID BYT Platform"
92 depends on X86 92 depends on X86 && I2C
93 select SND_SOC_RT5640 93 select SND_SOC_RT5640
94 select SND_SST_MFLD_PLATFORM 94 select SND_SST_MFLD_PLATFORM
95 select SND_SST_IPC_ACPI 95 select SND_SST_IPC_ACPI
@@ -101,7 +101,7 @@ config SND_SOC_INTEL_BYTCR_RT5640_MACH
101 101
102config SND_SOC_INTEL_CHT_BSW_RT5672_MACH 102config SND_SOC_INTEL_CHT_BSW_RT5672_MACH
103 tristate "ASoC Audio driver for Intel Cherrytrail & Braswell with RT5672 codec" 103 tristate "ASoC Audio driver for Intel Cherrytrail & Braswell with RT5672 codec"
104 depends on X86_INTEL_LPSS 104 depends on X86_INTEL_LPSS && I2C
105 select SND_SOC_RT5670 105 select SND_SOC_RT5670
106 select SND_SST_MFLD_PLATFORM 106 select SND_SST_MFLD_PLATFORM
107 select SND_SST_IPC_ACPI 107 select SND_SST_IPC_ACPI
diff --git a/sound/soc/intel/bytcr_dpcm_rt5640.c b/sound/soc/intel/bytcr_dpcm_rt5640.c
index f5d0fc1ab10c..eef0c56ec32e 100644
--- a/sound/soc/intel/bytcr_dpcm_rt5640.c
+++ b/sound/soc/intel/bytcr_dpcm_rt5640.c
@@ -227,4 +227,4 @@ module_platform_driver(snd_byt_mc_driver);
227MODULE_DESCRIPTION("ASoC Intel(R) Baytrail CR Machine driver"); 227MODULE_DESCRIPTION("ASoC Intel(R) Baytrail CR Machine driver");
228MODULE_AUTHOR("Subhransu S. Prusty <subhransu.s.prusty@intel.com>"); 228MODULE_AUTHOR("Subhransu S. Prusty <subhransu.s.prusty@intel.com>");
229MODULE_LICENSE("GPL v2"); 229MODULE_LICENSE("GPL v2");
230MODULE_ALIAS("platform:bytrt5640-audio"); 230MODULE_ALIAS("platform:bytt100_rt5640");
diff --git a/sound/soc/intel/sst-firmware.c b/sound/soc/intel/sst-firmware.c
index 4a5bde9c686b..ef2e8b5766a1 100644
--- a/sound/soc/intel/sst-firmware.c
+++ b/sound/soc/intel/sst-firmware.c
@@ -763,8 +763,12 @@ static int block_alloc_fixed(struct sst_dsp *dsp, struct sst_block_allocator *ba
763 /* does block span more than 1 section */ 763 /* does block span more than 1 section */
764 if (ba->offset >= block->offset && ba->offset < block_end) { 764 if (ba->offset >= block->offset && ba->offset < block_end) {
765 765
766 /* add block */
767 list_move(&block->list, &dsp->used_block_list);
768 list_add(&block->module_list, block_list);
766 /* align ba to block boundary */ 769 /* align ba to block boundary */
767 ba->offset = block->offset; 770 ba->size -= block_end - ba->offset;
771 ba->offset = block_end;
768 772
769 err = block_alloc_contiguous(dsp, ba, block_list); 773 err = block_alloc_contiguous(dsp, ba, block_list);
770 if (err < 0) 774 if (err < 0)
diff --git a/sound/soc/intel/sst/sst_acpi.c b/sound/soc/intel/sst/sst_acpi.c
index 3abc29e8a928..2ac72eb5e75d 100644
--- a/sound/soc/intel/sst/sst_acpi.c
+++ b/sound/soc/intel/sst/sst_acpi.c
@@ -343,7 +343,7 @@ int sst_acpi_remove(struct platform_device *pdev)
343} 343}
344 344
345static struct sst_machines sst_acpi_bytcr[] = { 345static struct sst_machines sst_acpi_bytcr[] = {
346 {"10EC5640", "T100", "bytt100_rt5640", NULL, "fw_sst_0f28.bin", 346 {"10EC5640", "T100", "bytt100_rt5640", NULL, "intel/fw_sst_0f28.bin",
347 &byt_rvp_platform_data }, 347 &byt_rvp_platform_data },
348 {}, 348 {},
349}; 349};
diff --git a/sound/soc/rockchip/rockchip_i2s.c b/sound/soc/rockchip/rockchip_i2s.c
index 26ec5117b35c..13d8507333b8 100644
--- a/sound/soc/rockchip/rockchip_i2s.c
+++ b/sound/soc/rockchip/rockchip_i2s.c
@@ -454,11 +454,11 @@ static int rockchip_i2s_probe(struct platform_device *pdev)
454 454
455 i2s->playback_dma_data.addr = res->start + I2S_TXDR; 455 i2s->playback_dma_data.addr = res->start + I2S_TXDR;
456 i2s->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; 456 i2s->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
457 i2s->playback_dma_data.maxburst = 16; 457 i2s->playback_dma_data.maxburst = 4;
458 458
459 i2s->capture_dma_data.addr = res->start + I2S_RXDR; 459 i2s->capture_dma_data.addr = res->start + I2S_RXDR;
460 i2s->capture_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; 460 i2s->capture_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
461 i2s->capture_dma_data.maxburst = 16; 461 i2s->capture_dma_data.maxburst = 4;
462 462
463 i2s->dev = &pdev->dev; 463 i2s->dev = &pdev->dev;
464 dev_set_drvdata(&pdev->dev, i2s); 464 dev_set_drvdata(&pdev->dev, i2s);
diff --git a/sound/soc/rockchip/rockchip_i2s.h b/sound/soc/rockchip/rockchip_i2s.h
index 89a5d8bc6ee7..93f456f518a9 100644
--- a/sound/soc/rockchip/rockchip_i2s.h
+++ b/sound/soc/rockchip/rockchip_i2s.h
@@ -127,7 +127,7 @@
127#define I2S_DMACR_TDE_DISABLE (0 << I2S_DMACR_TDE_SHIFT) 127#define I2S_DMACR_TDE_DISABLE (0 << I2S_DMACR_TDE_SHIFT)
128#define I2S_DMACR_TDE_ENABLE (1 << I2S_DMACR_TDE_SHIFT) 128#define I2S_DMACR_TDE_ENABLE (1 << I2S_DMACR_TDE_SHIFT)
129#define I2S_DMACR_TDL_SHIFT 0 129#define I2S_DMACR_TDL_SHIFT 0
130#define I2S_DMACR_TDL(x) ((x - 1) << I2S_DMACR_TDL_SHIFT) 130#define I2S_DMACR_TDL(x) ((x) << I2S_DMACR_TDL_SHIFT)
131#define I2S_DMACR_TDL_MASK (0x1f << I2S_DMACR_TDL_SHIFT) 131#define I2S_DMACR_TDL_MASK (0x1f << I2S_DMACR_TDL_SHIFT)
132 132
133/* 133/*
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 985052b3fbed..2c62620abca6 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -3230,7 +3230,7 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
3230 const char *propname) 3230 const char *propname)
3231{ 3231{
3232 struct device_node *np = card->dev->of_node; 3232 struct device_node *np = card->dev->of_node;
3233 int num_routes, old_routes; 3233 int num_routes;
3234 struct snd_soc_dapm_route *routes; 3234 struct snd_soc_dapm_route *routes;
3235 int i, ret; 3235 int i, ret;
3236 3236
@@ -3248,9 +3248,7 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
3248 return -EINVAL; 3248 return -EINVAL;
3249 } 3249 }
3250 3250
3251 old_routes = card->num_dapm_routes; 3251 routes = devm_kzalloc(card->dev, num_routes * sizeof(*routes),
3252 routes = devm_kzalloc(card->dev,
3253 (old_routes + num_routes) * sizeof(*routes),
3254 GFP_KERNEL); 3252 GFP_KERNEL);
3255 if (!routes) { 3253 if (!routes) {
3256 dev_err(card->dev, 3254 dev_err(card->dev,
@@ -3258,11 +3256,9 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
3258 return -EINVAL; 3256 return -EINVAL;
3259 } 3257 }
3260 3258
3261 memcpy(routes, card->dapm_routes, old_routes * sizeof(*routes));
3262
3263 for (i = 0; i < num_routes; i++) { 3259 for (i = 0; i < num_routes; i++) {
3264 ret = of_property_read_string_index(np, propname, 3260 ret = of_property_read_string_index(np, propname,
3265 2 * i, &routes[old_routes + i].sink); 3261 2 * i, &routes[i].sink);
3266 if (ret) { 3262 if (ret) {
3267 dev_err(card->dev, 3263 dev_err(card->dev,
3268 "ASoC: Property '%s' index %d could not be read: %d\n", 3264 "ASoC: Property '%s' index %d could not be read: %d\n",
@@ -3270,7 +3266,7 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
3270 return -EINVAL; 3266 return -EINVAL;
3271 } 3267 }
3272 ret = of_property_read_string_index(np, propname, 3268 ret = of_property_read_string_index(np, propname,
3273 (2 * i) + 1, &routes[old_routes + i].source); 3269 (2 * i) + 1, &routes[i].source);
3274 if (ret) { 3270 if (ret) {
3275 dev_err(card->dev, 3271 dev_err(card->dev,
3276 "ASoC: Property '%s' index %d could not be read: %d\n", 3272 "ASoC: Property '%s' index %d could not be read: %d\n",
@@ -3279,7 +3275,7 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
3279 } 3275 }
3280 } 3276 }
3281 3277
3282 card->num_dapm_routes += num_routes; 3278 card->num_dapm_routes = num_routes;
3283 card->dapm_routes = routes; 3279 card->dapm_routes = routes;
3284 3280
3285 return 0; 3281 return 0;