aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/devicetree/bindings/arm/mrvl.txt6
-rw-r--r--Documentation/devicetree/bindings/gpio/mrvl-gpio.txt23
-rw-r--r--Documentation/devicetree/bindings/i2c/mrvl-i2c.txt37
-rw-r--r--Documentation/devicetree/bindings/rtc/sa1100-rtc.txt17
-rw-r--r--Documentation/devicetree/bindings/serial/mrvl-serial.txt4
-rw-r--r--MAINTAINERS6
-rw-r--r--Makefile2
-rw-r--r--arch/arm/boot/dts/pxa168-aspenite.dts38
-rw-r--r--arch/arm/boot/dts/pxa168.dtsi98
-rw-r--r--arch/arm/mach-lpc32xx/include/mach/irqs.h2
-rw-r--r--arch/arm/mach-lpc32xx/irq.c25
-rw-r--r--arch/arm/mach-lpc32xx/serial.c20
-rw-r--r--arch/arm/mach-mmp/Kconfig10
-rw-r--r--arch/arm/mach-mmp/Makefile1
-rw-r--r--arch/arm/mach-mmp/aspenite.c1
-rw-r--r--arch/arm/mach-mmp/mmp-dt.c75
-rw-r--r--arch/arm/mach-mmp/pxa168.c3
-rw-r--r--arch/arm/mach-mmp/tavorevb.c1
-rw-r--r--arch/arm/mach-omap1/board-innovator.c4
-rw-r--r--arch/arm/mach-omap2/Kconfig4
-rw-r--r--arch/arm/mach-omap2/board-n8x0.c4
-rw-r--r--arch/arm/mach-omap2/board-omap3evm.c2
-rw-r--r--arch/arm/mach-omap2/common.h1
-rw-r--r--arch/arm/mach-omap2/cpuidle44xx.c5
-rw-r--r--arch/arm/mach-omap2/gpmc-smsc911x.c52
-rw-r--r--arch/arm/mach-omap2/hsmmc.c6
-rw-r--r--arch/arm/mach-omap2/io.c1
-rw-r--r--arch/arm/mach-omap2/mailbox.c13
-rw-r--r--arch/arm/mach-omap2/mux.c2
-rw-r--r--arch/arm/mach-omap2/omap4-common.c25
-rw-r--r--arch/arm/mach-omap2/pm.c3
-rw-r--r--arch/arm/mach-omap2/usb-host.c6
-rw-r--r--arch/arm/mach-pxa/hx4700.c25
-rw-r--r--arch/arm/mach-pxa/pxa25x.c1
-rw-r--r--arch/arm/mach-pxa/pxa27x.c1
-rw-r--r--arch/arm/mach-pxa/saarb.c1
-rw-r--r--arch/arm/mach-pxa/sharpsl_pm.c3
-rw-r--r--arch/arm/mach-pxa/spitz_pm.c5
-rw-r--r--arch/arm/plat-omap/common.c1
-rw-r--r--arch/arm/plat-omap/include/plat/omap-secure.h6
-rw-r--r--arch/openrisc/include/asm/ptrace.h8
-rw-r--r--arch/openrisc/kernel/init_task.c1
-rw-r--r--arch/openrisc/kernel/irq.c1
-rw-r--r--arch/openrisc/kernel/ptrace.c12
-rw-r--r--arch/parisc/Makefile4
-rw-r--r--arch/s390/Kconfig3
-rw-r--r--arch/s390/include/asm/compat.h7
-rw-r--r--arch/s390/kernel/crash_dump.c1
-rw-r--r--arch/s390/kernel/process.c1
-rw-r--r--arch/s390/kernel/ptrace.c2
-rw-r--r--arch/s390/kernel/setup.c2
-rw-r--r--arch/s390/kernel/signal.c1
-rw-r--r--arch/s390/mm/fault.c1
-rw-r--r--arch/s390/mm/init.c30
-rw-r--r--arch/s390/mm/mmap.c2
-rw-r--r--arch/x86/include/asm/perf_event.h8
-rw-r--r--arch/x86/kernel/cpu/intel_cacheinfo.c44
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce_amd.c2
-rw-r--r--arch/x86/kernel/cpu/perf_event.h8
-rw-r--r--arch/x86/kernel/cpu/perf_event_amd.c37
-rw-r--r--arch/x86/kernel/entry_64.S9
-rw-r--r--arch/x86/kernel/microcode_amd.c1
-rw-r--r--arch/x86/kvm/svm.c5
-rw-r--r--arch/x86/xen/enlighten.c6
-rw-r--r--arch/x86/xen/mmu.c8
-rw-r--r--block/partitions/ldm.c11
-rw-r--r--drivers/atm/solos-pci.c4
-rw-r--r--drivers/bluetooth/btusb.c4
-rw-r--r--drivers/crypto/mv_cesa.c1
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_connector.c16
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_drv.h4
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_fimd.c27
-rw-r--r--drivers/gpu/drm/i915/intel_display.c15
-rw-r--r--drivers/gpu/drm/i915/intel_ringbuffer.c14
-rw-r--r--drivers/gpu/drm/radeon/r600_cs.c1
-rw-r--r--drivers/gpu/drm/radeon/radeon_connectors.c25
-rw-r--r--drivers/gpu/drm/radeon/radeon_gart.c2
-rw-r--r--drivers/hwmon/f75375s.c89
-rw-r--r--drivers/i2c/busses/i2c-mxs.c13
-rw-r--r--drivers/i2c/busses/i2c-pxa.c95
-rw-r--r--drivers/iommu/omap-iommu-debug.c59
-rw-r--r--drivers/iommu/omap-iommu.c3
-rw-r--r--drivers/net/can/sja1000/sja1000.c13
-rw-r--r--drivers/net/ethernet/atheros/atl1c/atl1c_main.c4
-rw-r--r--drivers/net/ethernet/broadcom/b44.c2
-rw-r--r--drivers/net/ethernet/broadcom/cnic.c6
-rw-r--r--drivers/net/ethernet/cisco/enic/cq_enet_desc.h2
-rw-r--r--drivers/net/ethernet/cisco/enic/enic_pp.c2
-rw-r--r--drivers/net/ethernet/jme.c10
-rw-r--r--drivers/net/ethernet/jme.h2
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/eq.c8
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/main.c10
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/mlx4.h2
-rw-r--r--drivers/net/ethernet/micrel/ks8851_mll.c2
-rw-r--r--drivers/net/ethernet/sfc/rx.c4
-rw-r--r--drivers/net/ethernet/ti/davinci_emac.c6
-rw-r--r--drivers/net/phy/icplus.c55
-rw-r--r--drivers/net/ppp/ppp_generic.c23
-rw-r--r--drivers/net/usb/cdc_ether.c7
-rw-r--r--drivers/net/usb/hso.c2
-rw-r--r--drivers/net/usb/zaurus.c12
-rw-r--r--drivers/net/vmxnet3/vmxnet3_drv.c4
-rw-r--r--drivers/net/wireless/ath/ath9k/rc.c2
-rw-r--r--drivers/net/wireless/mwifiex/cfg80211.c8
-rw-r--r--drivers/parisc/iommu-helpers.h2
-rw-r--r--drivers/pcmcia/pxa2xx_base.c12
-rw-r--r--drivers/regulator/88pm8607.c6
-rw-r--r--drivers/s390/block/dasd_eckd.c2
-rw-r--r--drivers/s390/block/dasd_ioctl.c1
-rw-r--r--drivers/s390/char/fs3270.c1
-rw-r--r--drivers/s390/char/vmcp.c1
-rw-r--r--drivers/s390/cio/chsc_sch.c1
-rw-r--r--drivers/s390/scsi/zfcp_cfdc.c1
-rw-r--r--drivers/scsi/osd/osd_uld.c4
-rw-r--r--drivers/tty/serial/pxa.c49
-rw-r--r--drivers/video/omap2/displays/Kconfig2
-rw-r--r--drivers/video/omap2/dss/apply.c6
-rw-r--r--drivers/video/omap2/dss/hdmi.c24
-rw-r--r--drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c9
-rw-r--r--drivers/video/via/hw.c4
-rw-r--r--drivers/virtio/virtio_balloon.c33
-rw-r--r--drivers/watchdog/Kconfig2
-rw-r--r--drivers/watchdog/booke_wdt.c6
-rw-r--r--drivers/watchdog/hpwdt.c5
-rw-r--r--drivers/watchdog/pnx4008_wdt.c2
-rw-r--r--drivers/watchdog/s3c2410_wdt.c57
-rw-r--r--fs/binfmt_elf.c2
-rw-r--r--fs/dcache.c13
-rw-r--r--fs/ecryptfs/miscdev.c2
-rw-r--r--fs/gfs2/glock.c14
-rw-r--r--fs/gfs2/inode.c5
-rw-r--r--fs/gfs2/ops_fstype.c5
-rw-r--r--fs/gfs2/rgrp.c13
-rw-r--r--fs/namei.c66
-rw-r--r--fs/ntfs/attrib.c6
-rw-r--r--fs/ntfs/mft.c6
-rw-r--r--fs/ntfs/super.c4
-rw-r--r--include/asm-generic/iomap.h2
-rw-r--r--include/asm-generic/pci_iomap.h2
-rw-r--r--include/drm/Kbuild1
-rw-r--r--include/drm/exynos_drm.h22
-rw-r--r--include/linux/compat.h4
-rw-r--r--include/linux/dcache.h21
-rw-r--r--include/linux/if_link.h1
-rw-r--r--include/linux/netfilter_bridge/ebtables.h4
-rw-r--r--include/linux/regset.h10
-rw-r--r--include/linux/rtnetlink.h3
-rw-r--r--include/linux/skbuff.h10
-rw-r--r--include/net/bluetooth/bluetooth.h2
-rw-r--r--include/net/bluetooth/hci_core.h6
-rw-r--r--include/net/bluetooth/l2cap.h12
-rw-r--r--include/net/netfilter/nf_conntrack.h2
-rw-r--r--include/net/rtnetlink.h2
-rw-r--r--include/trace/events/sched.h50
-rw-r--r--kernel/events/hw_breakpoint.c4
-rw-r--r--kernel/irq/autoprobe.c4
-rw-r--r--kernel/irq/chip.c42
-rw-r--r--kernel/irq/internals.h2
-rw-r--r--kernel/irq/manage.c2
-rw-r--r--kernel/sched/core.c5
-rw-r--r--kernel/sched/fair.c2
-rw-r--r--mm/memblock.c6
-rw-r--r--net/atm/clip.c10
-rw-r--r--net/bluetooth/af_bluetooth.c12
-rw-r--r--net/bluetooth/hci_conn.c4
-rw-r--r--net/bluetooth/hci_core.c3
-rw-r--r--net/bluetooth/l2cap_core.c24
-rw-r--r--net/bluetooth/l2cap_sock.c4
-rw-r--r--net/bluetooth/rfcomm/core.c18
-rw-r--r--net/bluetooth/rfcomm/sock.c2
-rw-r--r--net/core/neighbour.c2
-rw-r--r--net/core/rtnetlink.c78
-rw-r--r--net/ipv4/ip_gre.c10
-rw-r--r--net/ipv4/ping.c1
-rw-r--r--net/ipv4/xfrm4_mode_beet.c5
-rw-r--r--net/ipv4/xfrm4_mode_tunnel.c6
-rw-r--r--net/ipv6/ip6mr.c4
-rw-r--r--net/ipv6/ndisc.c5
-rw-r--r--net/ipv6/xfrm6_mode_beet.c6
-rw-r--r--net/ipv6/xfrm6_mode_tunnel.c6
-rw-r--r--net/mac80211/debugfs_sta.c4
-rw-r--r--net/mac80211/rate.c2
-rw-r--r--net/mac80211/rate.h3
-rw-r--r--net/mac80211/sta_info.h2
-rw-r--r--net/netfilter/ipvs/ip_vs_core.c2
-rw-r--r--net/netfilter/nf_conntrack_core.c38
-rw-r--r--net/netfilter/nf_conntrack_netlink.c46
-rw-r--r--net/netfilter/nf_queue.c40
-rw-r--r--net/netfilter/xt_TEE.c5
-rw-r--r--net/sched/sch_netem.c6
-rw-r--r--scripts/mod/file2alias.c35
-rw-r--r--sound/pci/azt3328.c3
-rw-r--r--sound/pci/hda/hda_codec.c12
-rw-r--r--sound/pci/hda/hda_codec.h3
-rw-r--r--sound/pci/hda/patch_cirrus.c4
-rw-r--r--sound/pci/hda/patch_conexant.c24
-rw-r--r--sound/pci/hda/patch_realtek.c8
-rw-r--r--sound/pci/hda/patch_sigmatel.c2
-rw-r--r--sound/soc/imx/imx-ssi.c2
-rw-r--r--sound/soc/soc-dapm.c12
-rw-r--r--tools/perf/util/event.c1
-rw-r--r--tools/perf/util/evlist.c4
-rw-r--r--tools/perf/util/probe-event.c6
-rw-r--r--tools/perf/util/probe-finder.c12
-rwxr-xr-xtools/testing/ktest/ktest.pl8
205 files changed, 1733 insertions, 651 deletions
diff --git a/Documentation/devicetree/bindings/arm/mrvl.txt b/Documentation/devicetree/bindings/arm/mrvl.txt
new file mode 100644
index 000000000000..d8de933e9d81
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/mrvl.txt
@@ -0,0 +1,6 @@
1Marvell Platforms Device Tree Bindings
2----------------------------------------------------
3
4PXA168 Aspenite Board
5Required root node properties:
6 - compatible = "mrvl,pxa168-aspenite", "mrvl,pxa168";
diff --git a/Documentation/devicetree/bindings/gpio/mrvl-gpio.txt b/Documentation/devicetree/bindings/gpio/mrvl-gpio.txt
new file mode 100644
index 000000000000..1e34cfe5ebea
--- /dev/null
+++ b/Documentation/devicetree/bindings/gpio/mrvl-gpio.txt
@@ -0,0 +1,23 @@
1* Marvell PXA GPIO controller
2
3Required properties:
4- compatible : Should be "mrvl,pxa-gpio" or "mrvl,mmp-gpio"
5- reg : Address and length of the register set for the device
6- interrupts : Should be the port interrupt shared by all gpio pins, if
7- interrupt-name : Should be the name of irq resource.
8 one number.
9- gpio-controller : Marks the device node as a gpio controller.
10- #gpio-cells : Should be one. It is the pin number.
11
12Example:
13
14 gpio: gpio@d4019000 {
15 compatible = "mrvl,mmp-gpio", "mrvl,pxa-gpio";
16 reg = <0xd4019000 0x1000>;
17 interrupts = <49>, <17>, <18>;
18 interrupt-name = "gpio_mux", "gpio0", "gpio1";
19 gpio-controller;
20 #gpio-cells = <1>;
21 interrupt-controller;
22 #interrupt-cells = <1>;
23 };
diff --git a/Documentation/devicetree/bindings/i2c/mrvl-i2c.txt b/Documentation/devicetree/bindings/i2c/mrvl-i2c.txt
new file mode 100644
index 000000000000..071eb3caae91
--- /dev/null
+++ b/Documentation/devicetree/bindings/i2c/mrvl-i2c.txt
@@ -0,0 +1,37 @@
1* I2C
2
3Required properties :
4
5 - reg : Offset and length of the register set for the device
6 - compatible : should be "mrvl,mmp-twsi" where CHIP is the name of a
7 compatible processor, e.g. pxa168, pxa910, mmp2, mmp3.
8 For the pxa2xx/pxa3xx, an additional node "mrvl,pxa-i2c" is required
9 as shown in the example below.
10
11Recommended properties :
12
13 - interrupts : <a b> where a is the interrupt number and b is a
14 field that represents an encoding of the sense and level
15 information for the interrupt. This should be encoded based on
16 the information in section 2) depending on the type of interrupt
17 controller you have.
18 - interrupt-parent : the phandle for the interrupt controller that
19 services interrupts for this device.
20 - mrvl,i2c-polling : Disable interrupt of i2c controller. Polling
21 status register of i2c controller instead.
22 - mrvl,i2c-fast-mode : Enable fast mode of i2c controller.
23
24Examples:
25 twsi1: i2c@d4011000 {
26 compatible = "mrvl,mmp-twsi", "mrvl,pxa-i2c";
27 reg = <0xd4011000 0x1000>;
28 interrupts = <7>;
29 mrvl,i2c-fast-mode;
30 };
31
32 twsi2: i2c@d4025000 {
33 compatible = "mrvl,mmp-twsi", "mrvl,pxa-i2c";
34 reg = <0xd4025000 0x1000>;
35 interrupts = <58>;
36 };
37
diff --git a/Documentation/devicetree/bindings/rtc/sa1100-rtc.txt b/Documentation/devicetree/bindings/rtc/sa1100-rtc.txt
new file mode 100644
index 000000000000..0cda19ad4859
--- /dev/null
+++ b/Documentation/devicetree/bindings/rtc/sa1100-rtc.txt
@@ -0,0 +1,17 @@
1* Marvell Real Time Clock controller
2
3Required properties:
4- compatible: should be "mrvl,sa1100-rtc"
5- reg: physical base address of the controller and length of memory mapped
6 region.
7- interrupts: Should be two. The first interrupt number is the rtc alarm
8 interrupt and the second interrupt number is the rtc hz interrupt.
9- interrupt-names: Assign name of irq resource.
10
11Example:
12 rtc: rtc@d4010000 {
13 compatible = "mrvl,mmp-rtc";
14 reg = <0xd4010000 0x1000>;
15 interrupts = <5>, <6>;
16 interrupt-name = "rtc 1Hz", "rtc alarm";
17 };
diff --git a/Documentation/devicetree/bindings/serial/mrvl-serial.txt b/Documentation/devicetree/bindings/serial/mrvl-serial.txt
new file mode 100644
index 000000000000..d744340de887
--- /dev/null
+++ b/Documentation/devicetree/bindings/serial/mrvl-serial.txt
@@ -0,0 +1,4 @@
1PXA UART controller
2
3Required properties:
4- compatible : should be "mrvl,mmp-uart" or "mrvl,pxa-uart".
diff --git a/MAINTAINERS b/MAINTAINERS
index 09a04b4141a8..f096b0d8e973 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3789,7 +3789,7 @@ F: Documentation/kdump/
3789 3789
3790KERNEL AUTOMOUNTER v4 (AUTOFS4) 3790KERNEL AUTOMOUNTER v4 (AUTOFS4)
3791M: Ian Kent <raven@themaw.net> 3791M: Ian Kent <raven@themaw.net>
3792L: autofs@linux.kernel.org 3792L: autofs@vger.kernel.org
3793S: Maintained 3793S: Maintained
3794F: fs/autofs4/ 3794F: fs/autofs4/
3795 3795
@@ -4694,7 +4694,7 @@ NTFS FILESYSTEM
4694M: Anton Altaparmakov <anton@tuxera.com> 4694M: Anton Altaparmakov <anton@tuxera.com>
4695L: linux-ntfs-dev@lists.sourceforge.net 4695L: linux-ntfs-dev@lists.sourceforge.net
4696W: http://www.tuxera.com/ 4696W: http://www.tuxera.com/
4697T: git git://git.kernel.org/pub/scm/linux/kernel/git/aia21/ntfs-2.6.git 4697T: git git://git.kernel.org/pub/scm/linux/kernel/git/aia21/ntfs.git
4698S: Supported 4698S: Supported
4699F: Documentation/filesystems/ntfs.txt 4699F: Documentation/filesystems/ntfs.txt
4700F: fs/ntfs/ 4700F: fs/ntfs/
@@ -7280,7 +7280,7 @@ WATCHDOG DEVICE DRIVERS
7280M: Wim Van Sebroeck <wim@iguana.be> 7280M: Wim Van Sebroeck <wim@iguana.be>
7281L: linux-watchdog@vger.kernel.org 7281L: linux-watchdog@vger.kernel.org
7282W: http://www.linux-watchdog.org/ 7282W: http://www.linux-watchdog.org/
7283T: git git://git.kernel.org/pub/scm/linux/kernel/git/wim/linux-2.6-watchdog.git 7283T: git git://www.linux-watchdog.org/linux-watchdog.git
7284S: Maintained 7284S: Maintained
7285F: Documentation/watchdog/ 7285F: Documentation/watchdog/
7286F: drivers/watchdog/ 7286F: drivers/watchdog/
diff --git a/Makefile b/Makefile
index b61a9638b6fc..66d13c917bc7 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 3 1VERSION = 3
2PATCHLEVEL = 3 2PATCHLEVEL = 3
3SUBLEVEL = 0 3SUBLEVEL = 0
4EXTRAVERSION = -rc5 4EXTRAVERSION = -rc6
5NAME = Saber-toothed Squirrel 5NAME = Saber-toothed Squirrel
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
diff --git a/arch/arm/boot/dts/pxa168-aspenite.dts b/arch/arm/boot/dts/pxa168-aspenite.dts
new file mode 100644
index 000000000000..e762facb3fa4
--- /dev/null
+++ b/arch/arm/boot/dts/pxa168-aspenite.dts
@@ -0,0 +1,38 @@
1/*
2 * Copyright (C) 2012 Marvell Technology Group Ltd.
3 * Author: Haojian Zhuang <haojian.zhuang@marvell.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * publishhed by the Free Software Foundation.
8 */
9
10/dts-v1/;
11/include/ "pxa168.dtsi"
12
13/ {
14 model = "Marvell PXA168 Aspenite Development Board";
15 compatible = "mrvl,pxa168-aspenite", "mrvl,pxa168";
16
17 chosen {
18 bootargs = "console=ttyS0,115200 root=/dev/nfs nfsroot=192.168.1.100:/nfsroot/ ip=192.168.1.101:192.168.1.100::255.255.255.0::eth0:on";
19 };
20
21 memory {
22 reg = <0x00000000 0x04000000>;
23 };
24
25 soc {
26 apb@d4000000 {
27 uart1: uart@d4017000 {
28 status = "okay";
29 };
30 twsi1: i2c@d4011000 {
31 status = "okay";
32 };
33 rtc: rtc@d4010000 {
34 status = "okay";
35 };
36 };
37 };
38};
diff --git a/arch/arm/boot/dts/pxa168.dtsi b/arch/arm/boot/dts/pxa168.dtsi
new file mode 100644
index 000000000000..d32d5128f225
--- /dev/null
+++ b/arch/arm/boot/dts/pxa168.dtsi
@@ -0,0 +1,98 @@
1/*
2 * Copyright (C) 2012 Marvell Technology Group Ltd.
3 * Author: Haojian Zhuang <haojian.zhuang@marvell.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * publishhed by the Free Software Foundation.
8 */
9
10/include/ "skeleton.dtsi"
11
12/ {
13 aliases {
14 serial0 = &uart1;
15 serial1 = &uart2;
16 serial2 = &uart3;
17 i2c0 = &twsi1;
18 i2c1 = &twsi2;
19 };
20
21 intc: intc-interrupt-controller@d4282000 {
22 compatible = "mrvl,mmp-intc", "mrvl,intc";
23 interrupt-controller;
24 #interrupt-cells = <1>;
25 reg = <0xd4282000 0x1000>;
26 };
27
28 soc {
29 #address-cells = <1>;
30 #size-cells = <1>;
31 compatible = "simple-bus";
32 interrupt-parent = <&intc>;
33 ranges;
34
35 apb@d4000000 { /* APB */
36 compatible = "mrvl,apb-bus", "simple-bus";
37 #address-cells = <1>;
38 #size-cells = <1>;
39 reg = <0xd4000000 0x00200000>;
40 ranges;
41
42 uart1: uart@d4017000 {
43 compatible = "mrvl,mmp-uart", "mrvl,pxa-uart";
44 reg = <0xd4017000 0x1000>;
45 interrupts = <27>;
46 status = "disabled";
47 };
48
49 uart2: uart@d4018000 {
50 compatible = "mrvl,mmp-uart", "mrvl,pxa-uart";
51 reg = <0xd4018000 0x1000>;
52 interrupts = <28>;
53 status = "disabled";
54 };
55
56 uart3: uart@d4026000 {
57 compatible = "mrvl,mmp-uart", "mrvl,pxa-uart";
58 reg = <0xd4026000 0x1000>;
59 interrupts = <29>;
60 status = "disabled";
61 };
62
63 gpio: gpio@d4019000 {
64 compatible = "mrvl,mmp-gpio", "mrvl,pxa-gpio";
65 reg = <0xd4019000 0x1000>;
66 interrupts = <49>;
67 interrupt-names = "gpio_mux";
68 gpio-controller;
69 #gpio-cells = <1>;
70 interrupt-controller;
71 #interrupt-cells = <1>;
72 };
73
74 twsi1: i2c@d4011000 {
75 compatible = "mrvl,mmp-twsi", "mrvl,pxa-i2c";
76 reg = <0xd4011000 0x1000>;
77 interrupts = <7>;
78 mrvl,i2c-fast-mode;
79 status = "disabled";
80 };
81
82 twsi2: i2c@d4025000 {
83 compatible = "mrvl,mmp-twsi", "mrvl,pxa-i2c";
84 reg = <0xd4025000 0x1000>;
85 interrupts = <58>;
86 status = "disabled";
87 };
88
89 rtc: rtc@d4010000 {
90 compatible = "mrvl,mmp-rtc";
91 reg = <0xd4010000 0x1000>;
92 interrupts = <5 6>;
93 interrupt-names = "rtc 1Hz", "rtc alarm";
94 status = "disabled";
95 };
96 };
97 };
98};
diff --git a/arch/arm/mach-lpc32xx/include/mach/irqs.h b/arch/arm/mach-lpc32xx/include/mach/irqs.h
index 2667f52e3b04..9e3b90df32e1 100644
--- a/arch/arm/mach-lpc32xx/include/mach/irqs.h
+++ b/arch/arm/mach-lpc32xx/include/mach/irqs.h
@@ -61,7 +61,7 @@
61 */ 61 */
62#define IRQ_LPC32XX_JTAG_COMM_TX LPC32XX_SIC1_IRQ(1) 62#define IRQ_LPC32XX_JTAG_COMM_TX LPC32XX_SIC1_IRQ(1)
63#define IRQ_LPC32XX_JTAG_COMM_RX LPC32XX_SIC1_IRQ(2) 63#define IRQ_LPC32XX_JTAG_COMM_RX LPC32XX_SIC1_IRQ(2)
64#define IRQ_LPC32XX_GPI_11 LPC32XX_SIC1_IRQ(4) 64#define IRQ_LPC32XX_GPI_28 LPC32XX_SIC1_IRQ(4)
65#define IRQ_LPC32XX_TS_P LPC32XX_SIC1_IRQ(6) 65#define IRQ_LPC32XX_TS_P LPC32XX_SIC1_IRQ(6)
66#define IRQ_LPC32XX_TS_IRQ LPC32XX_SIC1_IRQ(7) 66#define IRQ_LPC32XX_TS_IRQ LPC32XX_SIC1_IRQ(7)
67#define IRQ_LPC32XX_TS_AUX LPC32XX_SIC1_IRQ(8) 67#define IRQ_LPC32XX_TS_AUX LPC32XX_SIC1_IRQ(8)
diff --git a/arch/arm/mach-lpc32xx/irq.c b/arch/arm/mach-lpc32xx/irq.c
index 4eae566dfdc7..c74de01ab5b6 100644
--- a/arch/arm/mach-lpc32xx/irq.c
+++ b/arch/arm/mach-lpc32xx/irq.c
@@ -118,6 +118,10 @@ static const struct lpc32xx_event_info lpc32xx_events[NR_IRQS] = {
118 .event_group = &lpc32xx_event_pin_regs, 118 .event_group = &lpc32xx_event_pin_regs,
119 .mask = LPC32XX_CLKPWR_EXTSRC_GPI_06_BIT, 119 .mask = LPC32XX_CLKPWR_EXTSRC_GPI_06_BIT,
120 }, 120 },
121 [IRQ_LPC32XX_GPI_28] = {
122 .event_group = &lpc32xx_event_pin_regs,
123 .mask = LPC32XX_CLKPWR_EXTSRC_GPI_28_BIT,
124 },
121 [IRQ_LPC32XX_GPIO_00] = { 125 [IRQ_LPC32XX_GPIO_00] = {
122 .event_group = &lpc32xx_event_int_regs, 126 .event_group = &lpc32xx_event_int_regs,
123 .mask = LPC32XX_CLKPWR_INTSRC_GPIO_00_BIT, 127 .mask = LPC32XX_CLKPWR_INTSRC_GPIO_00_BIT,
@@ -305,9 +309,18 @@ static int lpc32xx_irq_wake(struct irq_data *d, unsigned int state)
305 309
306 if (state) 310 if (state)
307 eventreg |= lpc32xx_events[d->irq].mask; 311 eventreg |= lpc32xx_events[d->irq].mask;
308 else 312 else {
309 eventreg &= ~lpc32xx_events[d->irq].mask; 313 eventreg &= ~lpc32xx_events[d->irq].mask;
310 314
315 /*
316 * When disabling the wakeup, clear the latched
317 * event
318 */
319 __raw_writel(lpc32xx_events[d->irq].mask,
320 lpc32xx_events[d->irq].
321 event_group->rawstat_reg);
322 }
323
311 __raw_writel(eventreg, 324 __raw_writel(eventreg,
312 lpc32xx_events[d->irq].event_group->enab_reg); 325 lpc32xx_events[d->irq].event_group->enab_reg);
313 326
@@ -380,13 +393,15 @@ void __init lpc32xx_init_irq(void)
380 393
381 /* Setup SIC1 */ 394 /* Setup SIC1 */
382 __raw_writel(0, LPC32XX_INTC_MASK(LPC32XX_SIC1_BASE)); 395 __raw_writel(0, LPC32XX_INTC_MASK(LPC32XX_SIC1_BASE));
383 __raw_writel(MIC_APR_DEFAULT, LPC32XX_INTC_POLAR(LPC32XX_SIC1_BASE)); 396 __raw_writel(SIC1_APR_DEFAULT, LPC32XX_INTC_POLAR(LPC32XX_SIC1_BASE));
384 __raw_writel(MIC_ATR_DEFAULT, LPC32XX_INTC_ACT_TYPE(LPC32XX_SIC1_BASE)); 397 __raw_writel(SIC1_ATR_DEFAULT,
398 LPC32XX_INTC_ACT_TYPE(LPC32XX_SIC1_BASE));
385 399
386 /* Setup SIC2 */ 400 /* Setup SIC2 */
387 __raw_writel(0, LPC32XX_INTC_MASK(LPC32XX_SIC2_BASE)); 401 __raw_writel(0, LPC32XX_INTC_MASK(LPC32XX_SIC2_BASE));
388 __raw_writel(MIC_APR_DEFAULT, LPC32XX_INTC_POLAR(LPC32XX_SIC2_BASE)); 402 __raw_writel(SIC2_APR_DEFAULT, LPC32XX_INTC_POLAR(LPC32XX_SIC2_BASE));
389 __raw_writel(MIC_ATR_DEFAULT, LPC32XX_INTC_ACT_TYPE(LPC32XX_SIC2_BASE)); 403 __raw_writel(SIC2_ATR_DEFAULT,
404 LPC32XX_INTC_ACT_TYPE(LPC32XX_SIC2_BASE));
390 405
391 /* Configure supported IRQ's */ 406 /* Configure supported IRQ's */
392 for (i = 0; i < NR_IRQS; i++) { 407 for (i = 0; i < NR_IRQS; i++) {
diff --git a/arch/arm/mach-lpc32xx/serial.c b/arch/arm/mach-lpc32xx/serial.c
index 429cfdbb2b3d..f2735281616a 100644
--- a/arch/arm/mach-lpc32xx/serial.c
+++ b/arch/arm/mach-lpc32xx/serial.c
@@ -88,6 +88,7 @@ struct uartinit {
88 char *uart_ck_name; 88 char *uart_ck_name;
89 u32 ck_mode_mask; 89 u32 ck_mode_mask;
90 void __iomem *pdiv_clk_reg; 90 void __iomem *pdiv_clk_reg;
91 resource_size_t mapbase;
91}; 92};
92 93
93static struct uartinit uartinit_data[] __initdata = { 94static struct uartinit uartinit_data[] __initdata = {
@@ -97,6 +98,7 @@ static struct uartinit uartinit_data[] __initdata = {
97 .ck_mode_mask = 98 .ck_mode_mask =
98 LPC32XX_UART_CLKMODE_LOAD(LPC32XX_UART_CLKMODE_ON, 5), 99 LPC32XX_UART_CLKMODE_LOAD(LPC32XX_UART_CLKMODE_ON, 5),
99 .pdiv_clk_reg = LPC32XX_CLKPWR_UART5_CLK_CTRL, 100 .pdiv_clk_reg = LPC32XX_CLKPWR_UART5_CLK_CTRL,
101 .mapbase = LPC32XX_UART5_BASE,
100 }, 102 },
101#endif 103#endif
102#ifdef CONFIG_ARCH_LPC32XX_UART3_SELECT 104#ifdef CONFIG_ARCH_LPC32XX_UART3_SELECT
@@ -105,6 +107,7 @@ static struct uartinit uartinit_data[] __initdata = {
105 .ck_mode_mask = 107 .ck_mode_mask =
106 LPC32XX_UART_CLKMODE_LOAD(LPC32XX_UART_CLKMODE_ON, 3), 108 LPC32XX_UART_CLKMODE_LOAD(LPC32XX_UART_CLKMODE_ON, 3),
107 .pdiv_clk_reg = LPC32XX_CLKPWR_UART3_CLK_CTRL, 109 .pdiv_clk_reg = LPC32XX_CLKPWR_UART3_CLK_CTRL,
110 .mapbase = LPC32XX_UART3_BASE,
108 }, 111 },
109#endif 112#endif
110#ifdef CONFIG_ARCH_LPC32XX_UART4_SELECT 113#ifdef CONFIG_ARCH_LPC32XX_UART4_SELECT
@@ -113,6 +116,7 @@ static struct uartinit uartinit_data[] __initdata = {
113 .ck_mode_mask = 116 .ck_mode_mask =
114 LPC32XX_UART_CLKMODE_LOAD(LPC32XX_UART_CLKMODE_ON, 4), 117 LPC32XX_UART_CLKMODE_LOAD(LPC32XX_UART_CLKMODE_ON, 4),
115 .pdiv_clk_reg = LPC32XX_CLKPWR_UART4_CLK_CTRL, 118 .pdiv_clk_reg = LPC32XX_CLKPWR_UART4_CLK_CTRL,
119 .mapbase = LPC32XX_UART4_BASE,
116 }, 120 },
117#endif 121#endif
118#ifdef CONFIG_ARCH_LPC32XX_UART6_SELECT 122#ifdef CONFIG_ARCH_LPC32XX_UART6_SELECT
@@ -121,6 +125,7 @@ static struct uartinit uartinit_data[] __initdata = {
121 .ck_mode_mask = 125 .ck_mode_mask =
122 LPC32XX_UART_CLKMODE_LOAD(LPC32XX_UART_CLKMODE_ON, 6), 126 LPC32XX_UART_CLKMODE_LOAD(LPC32XX_UART_CLKMODE_ON, 6),
123 .pdiv_clk_reg = LPC32XX_CLKPWR_UART6_CLK_CTRL, 127 .pdiv_clk_reg = LPC32XX_CLKPWR_UART6_CLK_CTRL,
128 .mapbase = LPC32XX_UART6_BASE,
124 }, 129 },
125#endif 130#endif
126}; 131};
@@ -165,11 +170,24 @@ void __init lpc32xx_serial_init(void)
165 170
166 /* pre-UART clock divider set to 1 */ 171 /* pre-UART clock divider set to 1 */
167 __raw_writel(0x0101, uartinit_data[i].pdiv_clk_reg); 172 __raw_writel(0x0101, uartinit_data[i].pdiv_clk_reg);
173
174 /*
175 * Force a flush of the RX FIFOs to work around a
176 * HW bug
177 */
178 puart = uartinit_data[i].mapbase;
179 __raw_writel(0xC1, LPC32XX_UART_IIR_FCR(puart));
180 __raw_writel(0x00, LPC32XX_UART_DLL_FIFO(puart));
181 j = LPC32XX_SUART_FIFO_SIZE;
182 while (j--)
183 tmp = __raw_readl(
184 LPC32XX_UART_DLL_FIFO(puart));
185 __raw_writel(0, LPC32XX_UART_IIR_FCR(puart));
168 } 186 }
169 187
170 /* This needs to be done after all UART clocks are setup */ 188 /* This needs to be done after all UART clocks are setup */
171 __raw_writel(clkmodes, LPC32XX_UARTCTL_CLKMODE); 189 __raw_writel(clkmodes, LPC32XX_UARTCTL_CLKMODE);
172 for (i = 0; i < ARRAY_SIZE(uartinit_data) - 1; i++) { 190 for (i = 0; i < ARRAY_SIZE(uartinit_data); i++) {
173 /* Force a flush of the RX FIFOs to work around a HW bug */ 191 /* Force a flush of the RX FIFOs to work around a HW bug */
174 puart = serial_std_platform_data[i].mapbase; 192 puart = serial_std_platform_data[i].mapbase;
175 __raw_writel(0xC1, LPC32XX_UART_IIR_FCR(puart)); 193 __raw_writel(0xC1, LPC32XX_UART_IIR_FCR(puart));
diff --git a/arch/arm/mach-mmp/Kconfig b/arch/arm/mach-mmp/Kconfig
index 323d4c9e9f44..5a90b9a3ab6e 100644
--- a/arch/arm/mach-mmp/Kconfig
+++ b/arch/arm/mach-mmp/Kconfig
@@ -2,6 +2,16 @@ if ARCH_MMP
2 2
3menu "Marvell PXA168/910/MMP2 Implmentations" 3menu "Marvell PXA168/910/MMP2 Implmentations"
4 4
5config MACH_MMP_DT
6 bool "Support MMP2 platforms from device tree"
7 select CPU_PXA168
8 select CPU_PXA910
9 select USE_OF
10 help
11 Include support for Marvell MMP2 based platforms using
12 the device tree. Needn't select any other machine while
13 MACH_MMP_DT is enabled.
14
5config MACH_ASPENITE 15config MACH_ASPENITE
6 bool "Marvell's PXA168 Aspenite Development Board" 16 bool "Marvell's PXA168 Aspenite Development Board"
7 select CPU_PXA168 17 select CPU_PXA168
diff --git a/arch/arm/mach-mmp/Makefile b/arch/arm/mach-mmp/Makefile
index ba254a71691a..4fc0ff5dc96d 100644
--- a/arch/arm/mach-mmp/Makefile
+++ b/arch/arm/mach-mmp/Makefile
@@ -18,5 +18,6 @@ obj-$(CONFIG_MACH_TTC_DKB) += ttc_dkb.o
18obj-$(CONFIG_MACH_BROWNSTONE) += brownstone.o 18obj-$(CONFIG_MACH_BROWNSTONE) += brownstone.o
19obj-$(CONFIG_MACH_FLINT) += flint.o 19obj-$(CONFIG_MACH_FLINT) += flint.o
20obj-$(CONFIG_MACH_MARVELL_JASPER) += jasper.o 20obj-$(CONFIG_MACH_MARVELL_JASPER) += jasper.o
21obj-$(CONFIG_MACH_MMP_DT) += mmp-dt.o
21obj-$(CONFIG_MACH_TETON_BGA) += teton_bga.o 22obj-$(CONFIG_MACH_TETON_BGA) += teton_bga.o
22obj-$(CONFIG_MACH_GPLUGD) += gplugd.o 23obj-$(CONFIG_MACH_GPLUGD) += gplugd.o
diff --git a/arch/arm/mach-mmp/aspenite.c b/arch/arm/mach-mmp/aspenite.c
index 17cb76060125..3588a5584153 100644
--- a/arch/arm/mach-mmp/aspenite.c
+++ b/arch/arm/mach-mmp/aspenite.c
@@ -17,7 +17,6 @@
17#include <linux/mtd/partitions.h> 17#include <linux/mtd/partitions.h>
18#include <linux/mtd/nand.h> 18#include <linux/mtd/nand.h>
19#include <linux/interrupt.h> 19#include <linux/interrupt.h>
20#include <linux/gpio.h>
21 20
22#include <asm/mach-types.h> 21#include <asm/mach-types.h>
23#include <asm/mach/arch.h> 22#include <asm/mach/arch.h>
diff --git a/arch/arm/mach-mmp/mmp-dt.c b/arch/arm/mach-mmp/mmp-dt.c
new file mode 100644
index 000000000000..67075395e400
--- /dev/null
+++ b/arch/arm/mach-mmp/mmp-dt.c
@@ -0,0 +1,75 @@
1/*
2 * linux/arch/arm/mach-mmp/mmp-dt.c
3 *
4 * Copyright (C) 2012 Marvell Technology Group Ltd.
5 * Author: Haojian Zhuang <haojian.zhuang@marvell.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * publishhed by the Free Software Foundation.
10 */
11
12#include <linux/irq.h>
13#include <linux/irqdomain.h>
14#include <linux/of_irq.h>
15#include <linux/of_platform.h>
16#include <asm/mach/arch.h>
17#include <mach/irqs.h>
18
19#include "common.h"
20
21extern struct sys_timer pxa168_timer;
22extern void __init icu_init_irq(void);
23
24static const struct of_dev_auxdata mmp_auxdata_lookup[] __initconst = {
25 OF_DEV_AUXDATA("mrvl,mmp-uart", 0xd4017000, "pxa2xx-uart.0", NULL),
26 OF_DEV_AUXDATA("mrvl,mmp-uart", 0xd4018000, "pxa2xx-uart.1", NULL),
27 OF_DEV_AUXDATA("mrvl,mmp-uart", 0xd4026000, "pxa2xx-uart.2", NULL),
28 OF_DEV_AUXDATA("mrvl,mmp-twsi", 0xd4011000, "pxa2xx-i2c.0", NULL),
29 OF_DEV_AUXDATA("mrvl,mmp-twsi", 0xd4025000, "pxa2xx-i2c.1", NULL),
30 OF_DEV_AUXDATA("mrvl,mmp-gpio", 0xd4019000, "pxa-gpio", NULL),
31 OF_DEV_AUXDATA("mrvl,mmp-rtc", 0xd4010000, "sa1100-rtc", NULL),
32 {}
33};
34
35static int __init mmp_intc_add_irq_domain(struct device_node *np,
36 struct device_node *parent)
37{
38 irq_domain_add_simple(np, 0);
39 return 0;
40}
41
42static int __init mmp_gpio_add_irq_domain(struct device_node *np,
43 struct device_node *parent)
44{
45 irq_domain_add_simple(np, IRQ_GPIO_START);
46 return 0;
47}
48
49static const struct of_device_id mmp_irq_match[] __initconst = {
50 { .compatible = "mrvl,mmp-intc", .data = mmp_intc_add_irq_domain, },
51 { .compatible = "mrvl,mmp-gpio", .data = mmp_gpio_add_irq_domain, },
52 {}
53};
54
55static void __init mmp_dt_init(void)
56{
57
58 of_irq_init(mmp_irq_match);
59
60 of_platform_populate(NULL, of_default_bus_match_table,
61 mmp_auxdata_lookup, NULL);
62}
63
64static const char *pxa168_dt_board_compat[] __initdata = {
65 "mrvl,pxa168-aspenite",
66 NULL,
67};
68
69DT_MACHINE_START(PXA168_DT, "Marvell PXA168 (Device Tree Support)")
70 .map_io = mmp_map_io,
71 .init_irq = icu_init_irq,
72 .timer = &pxa168_timer,
73 .init_machine = mmp_dt_init,
74 .dt_compat = pxa168_dt_board_compat,
75MACHINE_END
diff --git a/arch/arm/mach-mmp/pxa168.c b/arch/arm/mach-mmp/pxa168.c
index 7bc17eaa12eb..e3d3533a5a3b 100644
--- a/arch/arm/mach-mmp/pxa168.c
+++ b/arch/arm/mach-mmp/pxa168.c
@@ -24,7 +24,6 @@
24#include <mach/dma.h> 24#include <mach/dma.h>
25#include <mach/devices.h> 25#include <mach/devices.h>
26#include <mach/mfp.h> 26#include <mach/mfp.h>
27#include <linux/platform_device.h>
28#include <linux/dma-mapping.h> 27#include <linux/dma-mapping.h>
29#include <mach/pxa168.h> 28#include <mach/pxa168.h>
30 29
@@ -65,6 +64,7 @@ static APBC_CLK(ssp4, PXA168_SSP4, 4, 0);
65static APBC_CLK(ssp5, PXA168_SSP5, 4, 0); 64static APBC_CLK(ssp5, PXA168_SSP5, 4, 0);
66static APBC_CLK(gpio, PXA168_GPIO, 0, 13000000); 65static APBC_CLK(gpio, PXA168_GPIO, 0, 13000000);
67static APBC_CLK(keypad, PXA168_KPC, 0, 32000); 66static APBC_CLK(keypad, PXA168_KPC, 0, 32000);
67static APBC_CLK(rtc, PXA168_RTC, 8, 32768);
68 68
69static APMU_CLK(nand, NAND, 0x19b, 156000000); 69static APMU_CLK(nand, NAND, 0x19b, 156000000);
70static APMU_CLK(lcd, LCD, 0x7f, 312000000); 70static APMU_CLK(lcd, LCD, 0x7f, 312000000);
@@ -93,6 +93,7 @@ static struct clk_lookup pxa168_clkregs[] = {
93 INIT_CLKREG(&clk_keypad, "pxa27x-keypad", NULL), 93 INIT_CLKREG(&clk_keypad, "pxa27x-keypad", NULL),
94 INIT_CLKREG(&clk_eth, "pxa168-eth", "MFUCLK"), 94 INIT_CLKREG(&clk_eth, "pxa168-eth", "MFUCLK"),
95 INIT_CLKREG(&clk_usb, "pxa168-ehci", "PXA168-USBCLK"), 95 INIT_CLKREG(&clk_usb, "pxa168-ehci", "PXA168-USBCLK"),
96 INIT_CLKREG(&clk_rtc, "sa1100-rtc", NULL),
96}; 97};
97 98
98static int __init pxa168_init(void) 99static int __init pxa168_init(void)
diff --git a/arch/arm/mach-mmp/tavorevb.c b/arch/arm/mach-mmp/tavorevb.c
index 8e3b5af04a57..bc97170125bf 100644
--- a/arch/arm/mach-mmp/tavorevb.c
+++ b/arch/arm/mach-mmp/tavorevb.c
@@ -12,7 +12,6 @@
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/platform_device.h> 13#include <linux/platform_device.h>
14#include <linux/smc91x.h> 14#include <linux/smc91x.h>
15#include <linux/gpio.h>
16 15
17#include <asm/mach-types.h> 16#include <asm/mach-types.h>
18#include <asm/mach/arch.h> 17#include <asm/mach/arch.h>
diff --git a/arch/arm/mach-omap1/board-innovator.c b/arch/arm/mach-omap1/board-innovator.c
index 309369ea6978..be2002f42dea 100644
--- a/arch/arm/mach-omap1/board-innovator.c
+++ b/arch/arm/mach-omap1/board-innovator.c
@@ -416,13 +416,13 @@ static void __init innovator_init(void)
416#ifdef CONFIG_ARCH_OMAP15XX 416#ifdef CONFIG_ARCH_OMAP15XX
417 if (cpu_is_omap1510()) { 417 if (cpu_is_omap1510()) {
418 omap1_usb_init(&innovator1510_usb_config); 418 omap1_usb_init(&innovator1510_usb_config);
419 innovator_config[1].data = &innovator1510_lcd_config; 419 innovator_config[0].data = &innovator1510_lcd_config;
420 } 420 }
421#endif 421#endif
422#ifdef CONFIG_ARCH_OMAP16XX 422#ifdef CONFIG_ARCH_OMAP16XX
423 if (cpu_is_omap1610()) { 423 if (cpu_is_omap1610()) {
424 omap1_usb_init(&h2_usb_config); 424 omap1_usb_init(&h2_usb_config);
425 innovator_config[1].data = &innovator1610_lcd_config; 425 innovator_config[0].data = &innovator1610_lcd_config;
426 } 426 }
427#endif 427#endif
428 omap_board_config = innovator_config; 428 omap_board_config = innovator_config;
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index 72ce50ecf328..3fdfaeb4ce20 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -363,8 +363,8 @@ config OMAP3_SDRC_AC_TIMING
363 going on could result in system crashes; 363 going on could result in system crashes;
364 364
365config OMAP4_ERRATA_I688 365config OMAP4_ERRATA_I688
366 bool "OMAP4 errata: Async Bridge Corruption (BROKEN)" 366 bool "OMAP4 errata: Async Bridge Corruption"
367 depends on ARCH_OMAP4 && BROKEN 367 depends on ARCH_OMAP4
368 select ARCH_HAS_BARRIERS 368 select ARCH_HAS_BARRIERS
369 help 369 help
370 If a data is stalled inside asynchronous bridge because of back 370 If a data is stalled inside asynchronous bridge because of back
diff --git a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c
index 42a4d11fad23..672262717601 100644
--- a/arch/arm/mach-omap2/board-n8x0.c
+++ b/arch/arm/mach-omap2/board-n8x0.c
@@ -371,7 +371,11 @@ static void n8x0_mmc_callback(void *data, u8 card_mask)
371 else 371 else
372 *openp = 0; 372 *openp = 0;
373 373
374#ifdef CONFIG_MMC_OMAP
374 omap_mmc_notify_cover_event(mmc_device, index, *openp); 375 omap_mmc_notify_cover_event(mmc_device, index, *openp);
376#else
377 pr_warn("MMC: notify cover event not available\n");
378#endif
375} 379}
376 380
377static int n8x0_mmc_late_init(struct device *dev) 381static int n8x0_mmc_late_init(struct device *dev)
diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
index c775bead1497..c877236a8442 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -381,7 +381,7 @@ static int omap3evm_twl_gpio_setup(struct device *dev,
381 gpio_request_one(gpio + 7, GPIOF_OUT_INIT_LOW, "EN_DVI"); 381 gpio_request_one(gpio + 7, GPIOF_OUT_INIT_LOW, "EN_DVI");
382 382
383 /* TWL4030_GPIO_MAX + 1 == ledB (out, active low LED) */ 383 /* TWL4030_GPIO_MAX + 1 == ledB (out, active low LED) */
384 gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1; 384 gpio_leds[0].gpio = gpio + TWL4030_GPIO_MAX + 1;
385 385
386 platform_device_register(&leds_gpio); 386 platform_device_register(&leds_gpio);
387 387
diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h
index febffde2ff10..7e9338e8d684 100644
--- a/arch/arm/mach-omap2/common.h
+++ b/arch/arm/mach-omap2/common.h
@@ -132,6 +132,7 @@ void omap3_map_io(void);
132void am33xx_map_io(void); 132void am33xx_map_io(void);
133void omap4_map_io(void); 133void omap4_map_io(void);
134void ti81xx_map_io(void); 134void ti81xx_map_io(void);
135void omap_barriers_init(void);
135 136
136/** 137/**
137 * omap_test_timeout - busy-loop, testing a condition 138 * omap_test_timeout - busy-loop, testing a condition
diff --git a/arch/arm/mach-omap2/cpuidle44xx.c b/arch/arm/mach-omap2/cpuidle44xx.c
index cfdbb86bc84e..72e018b9b260 100644
--- a/arch/arm/mach-omap2/cpuidle44xx.c
+++ b/arch/arm/mach-omap2/cpuidle44xx.c
@@ -65,7 +65,6 @@ static int omap4_enter_idle(struct cpuidle_device *dev,
65 struct timespec ts_preidle, ts_postidle, ts_idle; 65 struct timespec ts_preidle, ts_postidle, ts_idle;
66 u32 cpu1_state; 66 u32 cpu1_state;
67 int idle_time; 67 int idle_time;
68 int new_state_idx;
69 int cpu_id = smp_processor_id(); 68 int cpu_id = smp_processor_id();
70 69
71 /* Used to keep track of the total time in idle */ 70 /* Used to keep track of the total time in idle */
@@ -84,8 +83,8 @@ static int omap4_enter_idle(struct cpuidle_device *dev,
84 */ 83 */
85 cpu1_state = pwrdm_read_pwrst(cpu1_pd); 84 cpu1_state = pwrdm_read_pwrst(cpu1_pd);
86 if (cpu1_state != PWRDM_POWER_OFF) { 85 if (cpu1_state != PWRDM_POWER_OFF) {
87 new_state_idx = drv->safe_state_index; 86 index = drv->safe_state_index;
88 cx = cpuidle_get_statedata(&dev->states_usage[new_state_idx]); 87 cx = cpuidle_get_statedata(&dev->states_usage[index]);
89 } 88 }
90 89
91 if (index > 0) 90 if (index > 0)
diff --git a/arch/arm/mach-omap2/gpmc-smsc911x.c b/arch/arm/mach-omap2/gpmc-smsc911x.c
index 997033129d26..bbb870c04a5e 100644
--- a/arch/arm/mach-omap2/gpmc-smsc911x.c
+++ b/arch/arm/mach-omap2/gpmc-smsc911x.c
@@ -19,6 +19,8 @@
19#include <linux/interrupt.h> 19#include <linux/interrupt.h>
20#include <linux/io.h> 20#include <linux/io.h>
21#include <linux/smsc911x.h> 21#include <linux/smsc911x.h>
22#include <linux/regulator/fixed.h>
23#include <linux/regulator/machine.h>
22 24
23#include <plat/board.h> 25#include <plat/board.h>
24#include <plat/gpmc.h> 26#include <plat/gpmc.h>
@@ -42,6 +44,50 @@ static struct smsc911x_platform_config gpmc_smsc911x_config = {
42 .flags = SMSC911X_USE_16BIT, 44 .flags = SMSC911X_USE_16BIT,
43}; 45};
44 46
47static struct regulator_consumer_supply gpmc_smsc911x_supply[] = {
48 REGULATOR_SUPPLY("vddvario", "smsc911x.0"),
49 REGULATOR_SUPPLY("vdd33a", "smsc911x.0"),
50};
51
52/* Generic regulator definition to satisfy smsc911x */
53static struct regulator_init_data gpmc_smsc911x_reg_init_data = {
54 .constraints = {
55 .min_uV = 3300000,
56 .max_uV = 3300000,
57 .valid_modes_mask = REGULATOR_MODE_NORMAL
58 | REGULATOR_MODE_STANDBY,
59 .valid_ops_mask = REGULATOR_CHANGE_MODE
60 | REGULATOR_CHANGE_STATUS,
61 },
62 .num_consumer_supplies = ARRAY_SIZE(gpmc_smsc911x_supply),
63 .consumer_supplies = gpmc_smsc911x_supply,
64};
65
66static struct fixed_voltage_config gpmc_smsc911x_fixed_reg_data = {
67 .supply_name = "gpmc_smsc911x",
68 .microvolts = 3300000,
69 .gpio = -EINVAL,
70 .startup_delay = 0,
71 .enable_high = 0,
72 .enabled_at_boot = 1,
73 .init_data = &gpmc_smsc911x_reg_init_data,
74};
75
76/*
77 * Platform device id of 42 is a temporary fix to avoid conflicts
78 * with other reg-fixed-voltage devices. The real fix should
79 * involve the driver core providing a way of dynamically
80 * assigning a unique id on registration for platform devices
81 * in the same name space.
82 */
83static struct platform_device gpmc_smsc911x_regulator = {
84 .name = "reg-fixed-voltage",
85 .id = 42,
86 .dev = {
87 .platform_data = &gpmc_smsc911x_fixed_reg_data,
88 },
89};
90
45/* 91/*
46 * Initialize smsc911x device connected to the GPMC. Note that we 92 * Initialize smsc911x device connected to the GPMC. Note that we
47 * assume that pin multiplexing is done in the board-*.c file, 93 * assume that pin multiplexing is done in the board-*.c file,
@@ -55,6 +101,12 @@ void __init gpmc_smsc911x_init(struct omap_smsc911x_platform_data *board_data)
55 101
56 gpmc_cfg = board_data; 102 gpmc_cfg = board_data;
57 103
104 ret = platform_device_register(&gpmc_smsc911x_regulator);
105 if (ret < 0) {
106 pr_err("Unable to register smsc911x regulators: %d\n", ret);
107 return;
108 }
109
58 if (gpmc_cs_request(gpmc_cfg->cs, SZ_16M, &cs_mem_base) < 0) { 110 if (gpmc_cs_request(gpmc_cfg->cs, SZ_16M, &cs_mem_base) < 0) {
59 pr_err("Failed to request GPMC mem region\n"); 111 pr_err("Failed to request GPMC mem region\n");
60 return; 112 return;
diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c
index b40c28895298..19dd1657245c 100644
--- a/arch/arm/mach-omap2/hsmmc.c
+++ b/arch/arm/mach-omap2/hsmmc.c
@@ -428,6 +428,7 @@ static int omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c,
428 return 0; 428 return 0;
429} 429}
430 430
431static int omap_hsmmc_done;
431#define MAX_OMAP_MMC_HWMOD_NAME_LEN 16 432#define MAX_OMAP_MMC_HWMOD_NAME_LEN 16
432 433
433void omap_init_hsmmc(struct omap2_hsmmc_info *hsmmcinfo, int ctrl_nr) 434void omap_init_hsmmc(struct omap2_hsmmc_info *hsmmcinfo, int ctrl_nr)
@@ -491,6 +492,11 @@ void omap2_hsmmc_init(struct omap2_hsmmc_info *controllers)
491{ 492{
492 u32 reg; 493 u32 reg;
493 494
495 if (omap_hsmmc_done)
496 return;
497
498 omap_hsmmc_done = 1;
499
494 if (!cpu_is_omap44xx()) { 500 if (!cpu_is_omap44xx()) {
495 if (cpu_is_omap2430()) { 501 if (cpu_is_omap2430()) {
496 control_pbias_offset = OMAP243X_CONTROL_PBIAS_LITE; 502 control_pbias_offset = OMAP243X_CONTROL_PBIAS_LITE;
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index eb50c29fb644..fb11b44fbdec 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -307,6 +307,7 @@ void __init omapam33xx_map_common_io(void)
307void __init omap44xx_map_common_io(void) 307void __init omap44xx_map_common_io(void)
308{ 308{
309 iotable_init(omap44xx_io_desc, ARRAY_SIZE(omap44xx_io_desc)); 309 iotable_init(omap44xx_io_desc, ARRAY_SIZE(omap44xx_io_desc));
310 omap_barriers_init();
310} 311}
311#endif 312#endif
312 313
diff --git a/arch/arm/mach-omap2/mailbox.c b/arch/arm/mach-omap2/mailbox.c
index 609ea2ded7e3..2cc1aa004b94 100644
--- a/arch/arm/mach-omap2/mailbox.c
+++ b/arch/arm/mach-omap2/mailbox.c
@@ -281,8 +281,16 @@ static struct omap_mbox mbox_iva_info = {
281 .ops = &omap2_mbox_ops, 281 .ops = &omap2_mbox_ops,
282 .priv = &omap2_mbox_iva_priv, 282 .priv = &omap2_mbox_iva_priv,
283}; 283};
284#endif
284 285
285struct omap_mbox *omap2_mboxes[] = { &mbox_dsp_info, &mbox_iva_info, NULL }; 286#ifdef CONFIG_ARCH_OMAP2
287struct omap_mbox *omap2_mboxes[] = {
288 &mbox_dsp_info,
289#ifdef CONFIG_SOC_OMAP2420
290 &mbox_iva_info,
291#endif
292 NULL
293};
286#endif 294#endif
287 295
288#if defined(CONFIG_ARCH_OMAP4) 296#if defined(CONFIG_ARCH_OMAP4)
@@ -412,7 +420,8 @@ static void __exit omap2_mbox_exit(void)
412 platform_driver_unregister(&omap2_mbox_driver); 420 platform_driver_unregister(&omap2_mbox_driver);
413} 421}
414 422
415module_init(omap2_mbox_init); 423/* must be ready before omap3isp is probed */
424subsys_initcall(omap2_mbox_init);
416module_exit(omap2_mbox_exit); 425module_exit(omap2_mbox_exit);
417 426
418MODULE_LICENSE("GPL v2"); 427MODULE_LICENSE("GPL v2");
diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c
index fb8bc9fa43b1..611a0e3d54ca 100644
--- a/arch/arm/mach-omap2/mux.c
+++ b/arch/arm/mach-omap2/mux.c
@@ -218,7 +218,7 @@ static int _omap_mux_get_by_name(struct omap_mux_partition *partition,
218 return -ENODEV; 218 return -ENODEV;
219} 219}
220 220
221static int __init 221static int
222omap_mux_get_by_name(const char *muxname, 222omap_mux_get_by_name(const char *muxname,
223 struct omap_mux_partition **found_partition, 223 struct omap_mux_partition **found_partition,
224 struct omap_mux **found_mux) 224 struct omap_mux **found_mux)
diff --git a/arch/arm/mach-omap2/omap4-common.c b/arch/arm/mach-omap2/omap4-common.c
index 40a8fbc07e4b..ebc595091312 100644
--- a/arch/arm/mach-omap2/omap4-common.c
+++ b/arch/arm/mach-omap2/omap4-common.c
@@ -24,6 +24,7 @@
24 24
25#include <plat/irqs.h> 25#include <plat/irqs.h>
26#include <plat/sram.h> 26#include <plat/sram.h>
27#include <plat/omap-secure.h>
27 28
28#include <mach/hardware.h> 29#include <mach/hardware.h>
29#include <mach/omap-wakeupgen.h> 30#include <mach/omap-wakeupgen.h>
@@ -43,6 +44,9 @@ static void __iomem *sar_ram_base;
43 44
44void __iomem *dram_sync, *sram_sync; 45void __iomem *dram_sync, *sram_sync;
45 46
47static phys_addr_t paddr;
48static u32 size;
49
46void omap_bus_sync(void) 50void omap_bus_sync(void)
47{ 51{
48 if (dram_sync && sram_sync) { 52 if (dram_sync && sram_sync) {
@@ -52,18 +56,20 @@ void omap_bus_sync(void)
52 } 56 }
53} 57}
54 58
55static int __init omap_barriers_init(void) 59/* Steal one page physical memory for barrier implementation */
60int __init omap_barrier_reserve_memblock(void)
56{ 61{
57 struct map_desc dram_io_desc[1];
58 phys_addr_t paddr;
59 u32 size;
60
61 if (!cpu_is_omap44xx())
62 return -ENODEV;
63 62
64 size = ALIGN(PAGE_SIZE, SZ_1M); 63 size = ALIGN(PAGE_SIZE, SZ_1M);
65 paddr = arm_memblock_steal(size, SZ_1M); 64 paddr = arm_memblock_steal(size, SZ_1M);
66 65
66 return 0;
67}
68
69void __init omap_barriers_init(void)
70{
71 struct map_desc dram_io_desc[1];
72
67 dram_io_desc[0].virtual = OMAP4_DRAM_BARRIER_VA; 73 dram_io_desc[0].virtual = OMAP4_DRAM_BARRIER_VA;
68 dram_io_desc[0].pfn = __phys_to_pfn(paddr); 74 dram_io_desc[0].pfn = __phys_to_pfn(paddr);
69 dram_io_desc[0].length = size; 75 dram_io_desc[0].length = size;
@@ -75,9 +81,10 @@ static int __init omap_barriers_init(void)
75 pr_info("OMAP4: Map 0x%08llx to 0x%08lx for dram barrier\n", 81 pr_info("OMAP4: Map 0x%08llx to 0x%08lx for dram barrier\n",
76 (long long) paddr, dram_io_desc[0].virtual); 82 (long long) paddr, dram_io_desc[0].virtual);
77 83
78 return 0;
79} 84}
80core_initcall(omap_barriers_init); 85#else
86void __init omap_barriers_init(void)
87{}
81#endif 88#endif
82 89
83void __init gic_init_irq(void) 90void __init gic_init_irq(void)
diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c
index ad4f69394166..44551edd8351 100644
--- a/arch/arm/mach-omap2/pm.c
+++ b/arch/arm/mach-omap2/pm.c
@@ -174,14 +174,17 @@ static int __init omap2_set_init_voltage(char *vdd_name, char *clk_name,
174 freq = clk->rate; 174 freq = clk->rate;
175 clk_put(clk); 175 clk_put(clk);
176 176
177 rcu_read_lock();
177 opp = opp_find_freq_ceil(dev, &freq); 178 opp = opp_find_freq_ceil(dev, &freq);
178 if (IS_ERR(opp)) { 179 if (IS_ERR(opp)) {
180 rcu_read_unlock();
179 pr_err("%s: unable to find boot up OPP for vdd_%s\n", 181 pr_err("%s: unable to find boot up OPP for vdd_%s\n",
180 __func__, vdd_name); 182 __func__, vdd_name);
181 goto exit; 183 goto exit;
182 } 184 }
183 185
184 bootup_volt = opp_get_voltage(opp); 186 bootup_volt = opp_get_voltage(opp);
187 rcu_read_unlock();
185 if (!bootup_volt) { 188 if (!bootup_volt) {
186 pr_err("%s: unable to find voltage corresponding " 189 pr_err("%s: unable to find voltage corresponding "
187 "to the bootup OPP for vdd_%s\n", __func__, vdd_name); 190 "to the bootup OPP for vdd_%s\n", __func__, vdd_name);
diff --git a/arch/arm/mach-omap2/usb-host.c b/arch/arm/mach-omap2/usb-host.c
index 771dc781b746..f51348dafafd 100644
--- a/arch/arm/mach-omap2/usb-host.c
+++ b/arch/arm/mach-omap2/usb-host.c
@@ -486,7 +486,7 @@ static void setup_4430ohci_io_mux(const enum usbhs_omap_port_mode *port_mode)
486void __init usbhs_init(const struct usbhs_omap_board_data *pdata) 486void __init usbhs_init(const struct usbhs_omap_board_data *pdata)
487{ 487{
488 struct omap_hwmod *oh[2]; 488 struct omap_hwmod *oh[2];
489 struct omap_device *od; 489 struct platform_device *pdev;
490 int bus_id = -1; 490 int bus_id = -1;
491 int i; 491 int i;
492 492
@@ -522,11 +522,11 @@ void __init usbhs_init(const struct usbhs_omap_board_data *pdata)
522 return; 522 return;
523 } 523 }
524 524
525 od = omap_device_build_ss(OMAP_USBHS_DEVICE, bus_id, oh, 2, 525 pdev = omap_device_build_ss(OMAP_USBHS_DEVICE, bus_id, oh, 2,
526 (void *)&usbhs_data, sizeof(usbhs_data), 526 (void *)&usbhs_data, sizeof(usbhs_data),
527 omap_uhhtll_latency, 527 omap_uhhtll_latency,
528 ARRAY_SIZE(omap_uhhtll_latency), false); 528 ARRAY_SIZE(omap_uhhtll_latency), false);
529 if (IS_ERR(od)) { 529 if (IS_ERR(pdev)) {
530 pr_err("Could not build hwmod devices %s,%s\n", 530 pr_err("Could not build hwmod devices %s,%s\n",
531 USBHS_UHH_HWMODNAME, USBHS_TLL_HWMODNAME); 531 USBHS_UHH_HWMODNAME, USBHS_TLL_HWMODNAME);
532 return; 532 return;
diff --git a/arch/arm/mach-pxa/hx4700.c b/arch/arm/mach-pxa/hx4700.c
index fb9b62dcf4ca..208eef1c0485 100644
--- a/arch/arm/mach-pxa/hx4700.c
+++ b/arch/arm/mach-pxa/hx4700.c
@@ -45,6 +45,7 @@
45#include <mach/hx4700.h> 45#include <mach/hx4700.h>
46#include <mach/irda.h> 46#include <mach/irda.h>
47 47
48#include <sound/ak4641.h>
48#include <video/platform_lcd.h> 49#include <video/platform_lcd.h>
49#include <video/w100fb.h> 50#include <video/w100fb.h>
50 51
@@ -765,6 +766,28 @@ static struct i2c_board_info __initdata pi2c_board_info[] = {
765}; 766};
766 767
767/* 768/*
769 * Asahi Kasei AK4641 on I2C
770 */
771
772static struct ak4641_platform_data ak4641_info = {
773 .gpio_power = GPIO27_HX4700_CODEC_ON,
774 .gpio_npdn = GPIO109_HX4700_CODEC_nPDN,
775};
776
777static struct i2c_board_info i2c_board_info[] __initdata = {
778 {
779 I2C_BOARD_INFO("ak4641", 0x12),
780 .platform_data = &ak4641_info,
781 },
782};
783
784static struct platform_device audio = {
785 .name = "hx4700-audio",
786 .id = -1,
787};
788
789
790/*
768 * PCMCIA 791 * PCMCIA
769 */ 792 */
770 793
@@ -790,6 +813,7 @@ static struct platform_device *devices[] __initdata = {
790 &gpio_vbus, 813 &gpio_vbus,
791 &power_supply, 814 &power_supply,
792 &strataflash, 815 &strataflash,
816 &audio,
793 &pcmcia, 817 &pcmcia,
794}; 818};
795 819
@@ -827,6 +851,7 @@ static void __init hx4700_init(void)
827 pxa_set_ficp_info(&ficp_info); 851 pxa_set_ficp_info(&ficp_info);
828 pxa27x_set_i2c_power_info(NULL); 852 pxa27x_set_i2c_power_info(NULL);
829 pxa_set_i2c_info(NULL); 853 pxa_set_i2c_info(NULL);
854 i2c_register_board_info(0, ARRAY_AND_SIZE(i2c_board_info));
830 i2c_register_board_info(1, ARRAY_AND_SIZE(pi2c_board_info)); 855 i2c_register_board_info(1, ARRAY_AND_SIZE(pi2c_board_info));
831 pxa2xx_set_spi_info(2, &pxa_ssp2_master_info); 856 pxa2xx_set_spi_info(2, &pxa_ssp2_master_info);
832 spi_register_board_info(ARRAY_AND_SIZE(tsc2046_board_info)); 857 spi_register_board_info(ARRAY_AND_SIZE(tsc2046_board_info));
diff --git a/arch/arm/mach-pxa/pxa25x.c b/arch/arm/mach-pxa/pxa25x.c
index 91e4f6c03766..00d6eacab8e4 100644
--- a/arch/arm/mach-pxa/pxa25x.c
+++ b/arch/arm/mach-pxa/pxa25x.c
@@ -25,7 +25,6 @@
25#include <linux/suspend.h> 25#include <linux/suspend.h>
26#include <linux/syscore_ops.h> 26#include <linux/syscore_ops.h>
27#include <linux/irq.h> 27#include <linux/irq.h>
28#include <linux/gpio.h>
29 28
30#include <asm/mach/map.h> 29#include <asm/mach/map.h>
31#include <asm/suspend.h> 30#include <asm/suspend.h>
diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c
index aed6cbcf3866..c1673b3441d4 100644
--- a/arch/arm/mach-pxa/pxa27x.c
+++ b/arch/arm/mach-pxa/pxa27x.c
@@ -22,7 +22,6 @@
22#include <linux/io.h> 22#include <linux/io.h>
23#include <linux/irq.h> 23#include <linux/irq.h>
24#include <linux/i2c/pxa-i2c.h> 24#include <linux/i2c/pxa-i2c.h>
25#include <linux/gpio.h>
26 25
27#include <asm/mach/map.h> 26#include <asm/mach/map.h>
28#include <mach/hardware.h> 27#include <mach/hardware.h>
diff --git a/arch/arm/mach-pxa/saarb.c b/arch/arm/mach-pxa/saarb.c
index febc809ed5a6..5aded5e6148f 100644
--- a/arch/arm/mach-pxa/saarb.c
+++ b/arch/arm/mach-pxa/saarb.c
@@ -15,7 +15,6 @@
15#include <linux/i2c.h> 15#include <linux/i2c.h>
16#include <linux/i2c/pxa-i2c.h> 16#include <linux/i2c/pxa-i2c.h>
17#include <linux/mfd/88pm860x.h> 17#include <linux/mfd/88pm860x.h>
18#include <linux/gpio.h>
19 18
20#include <asm/mach-types.h> 19#include <asm/mach-types.h>
21#include <asm/mach/arch.h> 20#include <asm/mach/arch.h>
diff --git a/arch/arm/mach-pxa/sharpsl_pm.c b/arch/arm/mach-pxa/sharpsl_pm.c
index 8d5168d253a9..30989baf7f2a 100644
--- a/arch/arm/mach-pxa/sharpsl_pm.c
+++ b/arch/arm/mach-pxa/sharpsl_pm.c
@@ -168,6 +168,7 @@ struct battery_thresh sharpsl_battery_levels_noac[] = {
168#define MAXCTRL_SEL_SH 4 168#define MAXCTRL_SEL_SH 4
169#define MAXCTRL_STR (1u << 7) 169#define MAXCTRL_STR (1u << 7)
170 170
171extern int max1111_read_channel(int);
171/* 172/*
172 * Read MAX1111 ADC 173 * Read MAX1111 ADC
173 */ 174 */
@@ -177,8 +178,6 @@ int sharpsl_pm_pxa_read_max1111(int channel)
177 if (machine_is_tosa()) 178 if (machine_is_tosa())
178 return 0; 179 return 0;
179 180
180 extern int max1111_read_channel(int);
181
182 /* max1111 accepts channels from 0-3, however, 181 /* max1111 accepts channels from 0-3, however,
183 * it is encoded from 0-7 here in the code. 182 * it is encoded from 0-7 here in the code.
184 */ 183 */
diff --git a/arch/arm/mach-pxa/spitz_pm.c b/arch/arm/mach-pxa/spitz_pm.c
index 34cbdac51525..438f02fe122a 100644
--- a/arch/arm/mach-pxa/spitz_pm.c
+++ b/arch/arm/mach-pxa/spitz_pm.c
@@ -172,10 +172,9 @@ static int spitz_should_wakeup(unsigned int resume_on_alarm)
172static unsigned long spitz_charger_wakeup(void) 172static unsigned long spitz_charger_wakeup(void)
173{ 173{
174 unsigned long ret; 174 unsigned long ret;
175 ret = (!gpio_get_value(SPITZ_GPIO_KEY_INT) 175 ret = ((!gpio_get_value(SPITZ_GPIO_KEY_INT)
176 << GPIO_bit(SPITZ_GPIO_KEY_INT)) 176 << GPIO_bit(SPITZ_GPIO_KEY_INT))
177 | (!gpio_get_value(SPITZ_GPIO_SYNC) 177 | gpio_get_value(SPITZ_GPIO_SYNC));
178 << GPIO_bit(SPITZ_GPIO_SYNC));
179 return ret; 178 return ret;
180} 179}
181 180
diff --git a/arch/arm/plat-omap/common.c b/arch/arm/plat-omap/common.c
index 06383b51e655..4de7d1e79e73 100644
--- a/arch/arm/plat-omap/common.c
+++ b/arch/arm/plat-omap/common.c
@@ -69,6 +69,7 @@ void __init omap_reserve(void)
69 omap_vram_reserve_sdram_memblock(); 69 omap_vram_reserve_sdram_memblock();
70 omap_dsp_reserve_sdram_memblock(); 70 omap_dsp_reserve_sdram_memblock();
71 omap_secure_ram_reserve_memblock(); 71 omap_secure_ram_reserve_memblock();
72 omap_barrier_reserve_memblock();
72} 73}
73 74
74void __init omap_init_consistent_dma_size(void) 75void __init omap_init_consistent_dma_size(void)
diff --git a/arch/arm/plat-omap/include/plat/omap-secure.h b/arch/arm/plat-omap/include/plat/omap-secure.h
index 3047ff923a63..8c7994ce9869 100644
--- a/arch/arm/plat-omap/include/plat/omap-secure.h
+++ b/arch/arm/plat-omap/include/plat/omap-secure.h
@@ -10,4 +10,10 @@ static inline void omap_secure_ram_reserve_memblock(void)
10{ } 10{ }
11#endif 11#endif
12 12
13#ifdef CONFIG_OMAP4_ERRATA_I688
14extern int omap_barrier_reserve_memblock(void);
15#else
16static inline void omap_barrier_reserve_memblock(void)
17{ }
18#endif
13#endif /* __OMAP_SECURE_H__ */ 19#endif /* __OMAP_SECURE_H__ */
diff --git a/arch/openrisc/include/asm/ptrace.h b/arch/openrisc/include/asm/ptrace.h
index 054537c5f9c9..e612ce4512c7 100644
--- a/arch/openrisc/include/asm/ptrace.h
+++ b/arch/openrisc/include/asm/ptrace.h
@@ -77,7 +77,6 @@ struct pt_regs {
77 long syscallno; /* Syscall number (used by strace) */ 77 long syscallno; /* Syscall number (used by strace) */
78 long dummy; /* Cheap alignment fix */ 78 long dummy; /* Cheap alignment fix */
79}; 79};
80#endif /* __ASSEMBLY__ */
81 80
82/* TODO: Rename this to REDZONE because that's what it is */ 81/* TODO: Rename this to REDZONE because that's what it is */
83#define STACK_FRAME_OVERHEAD 128 /* size of minimum stack frame */ 82#define STACK_FRAME_OVERHEAD 128 /* size of minimum stack frame */
@@ -87,6 +86,13 @@ struct pt_regs {
87#define user_stack_pointer(regs) ((unsigned long)(regs)->sp) 86#define user_stack_pointer(regs) ((unsigned long)(regs)->sp)
88#define profile_pc(regs) instruction_pointer(regs) 87#define profile_pc(regs) instruction_pointer(regs)
89 88
89static inline long regs_return_value(struct pt_regs *regs)
90{
91 return regs->gpr[11];
92}
93
94#endif /* __ASSEMBLY__ */
95
90/* 96/*
91 * Offsets used by 'ptrace' system call interface. 97 * Offsets used by 'ptrace' system call interface.
92 */ 98 */
diff --git a/arch/openrisc/kernel/init_task.c b/arch/openrisc/kernel/init_task.c
index 45744a384927..ca534082d5f3 100644
--- a/arch/openrisc/kernel/init_task.c
+++ b/arch/openrisc/kernel/init_task.c
@@ -17,6 +17,7 @@
17 17
18#include <linux/init_task.h> 18#include <linux/init_task.h>
19#include <linux/mqueue.h> 19#include <linux/mqueue.h>
20#include <linux/export.h>
20 21
21static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 22static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
22static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 23static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
diff --git a/arch/openrisc/kernel/irq.c b/arch/openrisc/kernel/irq.c
index 59b302338331..4bfead220956 100644
--- a/arch/openrisc/kernel/irq.c
+++ b/arch/openrisc/kernel/irq.c
@@ -23,6 +23,7 @@
23#include <linux/irq.h> 23#include <linux/irq.h>
24#include <linux/seq_file.h> 24#include <linux/seq_file.h>
25#include <linux/kernel_stat.h> 25#include <linux/kernel_stat.h>
26#include <linux/export.h>
26 27
27#include <linux/irqflags.h> 28#include <linux/irqflags.h>
28 29
diff --git a/arch/openrisc/kernel/ptrace.c b/arch/openrisc/kernel/ptrace.c
index 656b94beab89..7259047d5f9d 100644
--- a/arch/openrisc/kernel/ptrace.c
+++ b/arch/openrisc/kernel/ptrace.c
@@ -188,11 +188,9 @@ asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
188 */ 188 */
189 ret = -1L; 189 ret = -1L;
190 190
191 /* Are these regs right??? */ 191 audit_syscall_entry(audit_arch(), regs->syscallno,
192 if (unlikely(current->audit_context)) 192 regs->gpr[3], regs->gpr[4],
193 audit_syscall_entry(audit_arch(), regs->syscallno, 193 regs->gpr[5], regs->gpr[6]);
194 regs->gpr[3], regs->gpr[4],
195 regs->gpr[5], regs->gpr[6]);
196 194
197 return ret ? : regs->syscallno; 195 return ret ? : regs->syscallno;
198} 196}
@@ -201,9 +199,7 @@ asmlinkage void do_syscall_trace_leave(struct pt_regs *regs)
201{ 199{
202 int step; 200 int step;
203 201
204 if (unlikely(current->audit_context)) 202 audit_syscall_exit(regs);
205 audit_syscall_exit(AUDITSC_RESULT(regs->gpr[11]),
206 regs->gpr[11]);
207 203
208 step = test_thread_flag(TIF_SINGLESTEP); 204 step = test_thread_flag(TIF_SINGLESTEP);
209 if (step || test_thread_flag(TIF_SYSCALL_TRACE)) 205 if (step || test_thread_flag(TIF_SYSCALL_TRACE))
diff --git a/arch/parisc/Makefile b/arch/parisc/Makefile
index 55cca1dac431..19ab7b2ea1cd 100644
--- a/arch/parisc/Makefile
+++ b/arch/parisc/Makefile
@@ -31,7 +31,11 @@ ifdef CONFIG_64BIT
31UTS_MACHINE := parisc64 31UTS_MACHINE := parisc64
32CHECKFLAGS += -D__LP64__=1 -m64 32CHECKFLAGS += -D__LP64__=1 -m64
33WIDTH := 64 33WIDTH := 64
34
35# FIXME: if no default set, should really try to locate dynamically
36ifeq ($(CROSS_COMPILE),)
34CROSS_COMPILE := hppa64-linux-gnu- 37CROSS_COMPILE := hppa64-linux-gnu-
38endif
35else # 32-bit 39else # 32-bit
36WIDTH := 40WIDTH :=
37endif 41endif
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index d1727584230a..6d99a5fcc090 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -227,6 +227,9 @@ config COMPAT
227config SYSVIPC_COMPAT 227config SYSVIPC_COMPAT
228 def_bool y if COMPAT && SYSVIPC 228 def_bool y if COMPAT && SYSVIPC
229 229
230config KEYS_COMPAT
231 def_bool y if COMPAT && KEYS
232
230config AUDIT_ARCH 233config AUDIT_ARCH
231 def_bool y 234 def_bool y
232 235
diff --git a/arch/s390/include/asm/compat.h b/arch/s390/include/asm/compat.h
index 2e49748b27da..234f1d859cea 100644
--- a/arch/s390/include/asm/compat.h
+++ b/arch/s390/include/asm/compat.h
@@ -172,13 +172,6 @@ static inline int is_compat_task(void)
172 return is_32bit_task(); 172 return is_32bit_task();
173} 173}
174 174
175#else
176
177static inline int is_compat_task(void)
178{
179 return 0;
180}
181
182#endif 175#endif
183 176
184static inline void __user *arch_compat_alloc_user_space(long len) 177static inline void __user *arch_compat_alloc_user_space(long len)
diff --git a/arch/s390/kernel/crash_dump.c b/arch/s390/kernel/crash_dump.c
index 39f8fd4438fc..c383ce440d99 100644
--- a/arch/s390/kernel/crash_dump.c
+++ b/arch/s390/kernel/crash_dump.c
@@ -11,7 +11,6 @@
11#include <linux/module.h> 11#include <linux/module.h>
12#include <linux/gfp.h> 12#include <linux/gfp.h>
13#include <linux/slab.h> 13#include <linux/slab.h>
14#include <linux/crash_dump.h>
15#include <linux/bootmem.h> 14#include <linux/bootmem.h>
16#include <linux/elf.h> 15#include <linux/elf.h>
17#include <asm/ipl.h> 16#include <asm/ipl.h>
diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c
index 4261aa799774..e795933eb2cb 100644
--- a/arch/s390/kernel/process.c
+++ b/arch/s390/kernel/process.c
@@ -29,7 +29,6 @@
29#include <asm/irq.h> 29#include <asm/irq.h>
30#include <asm/timer.h> 30#include <asm/timer.h>
31#include <asm/nmi.h> 31#include <asm/nmi.h>
32#include <asm/compat.h>
33#include <asm/smp.h> 32#include <asm/smp.h>
34#include "entry.h" 33#include "entry.h"
35 34
diff --git a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c
index 9d82ed4bcb27..61f95489d70c 100644
--- a/arch/s390/kernel/ptrace.c
+++ b/arch/s390/kernel/ptrace.c
@@ -20,8 +20,8 @@
20#include <linux/regset.h> 20#include <linux/regset.h>
21#include <linux/tracehook.h> 21#include <linux/tracehook.h>
22#include <linux/seccomp.h> 22#include <linux/seccomp.h>
23#include <linux/compat.h>
23#include <trace/syscall.h> 24#include <trace/syscall.h>
24#include <asm/compat.h>
25#include <asm/segment.h> 25#include <asm/segment.h>
26#include <asm/page.h> 26#include <asm/page.h>
27#include <asm/pgtable.h> 27#include <asm/pgtable.h>
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index 354de0763eff..3b2efc81f34e 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -46,6 +46,7 @@
46#include <linux/kexec.h> 46#include <linux/kexec.h>
47#include <linux/crash_dump.h> 47#include <linux/crash_dump.h>
48#include <linux/memory.h> 48#include <linux/memory.h>
49#include <linux/compat.h>
49 50
50#include <asm/ipl.h> 51#include <asm/ipl.h>
51#include <asm/uaccess.h> 52#include <asm/uaccess.h>
@@ -59,7 +60,6 @@
59#include <asm/ptrace.h> 60#include <asm/ptrace.h>
60#include <asm/sections.h> 61#include <asm/sections.h>
61#include <asm/ebcdic.h> 62#include <asm/ebcdic.h>
62#include <asm/compat.h>
63#include <asm/kvm_virtio.h> 63#include <asm/kvm_virtio.h>
64#include <asm/diag.h> 64#include <asm/diag.h>
65 65
diff --git a/arch/s390/kernel/signal.c b/arch/s390/kernel/signal.c
index a8ba840294ff..2d421d90fada 100644
--- a/arch/s390/kernel/signal.c
+++ b/arch/s390/kernel/signal.c
@@ -30,7 +30,6 @@
30#include <asm/ucontext.h> 30#include <asm/ucontext.h>
31#include <asm/uaccess.h> 31#include <asm/uaccess.h>
32#include <asm/lowcore.h> 32#include <asm/lowcore.h>
33#include <asm/compat.h>
34#include "entry.h" 33#include "entry.h"
35 34
36#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 35#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c
index 354dd39073ef..e8fcd928dc78 100644
--- a/arch/s390/mm/fault.c
+++ b/arch/s390/mm/fault.c
@@ -36,7 +36,6 @@
36#include <asm/pgtable.h> 36#include <asm/pgtable.h>
37#include <asm/irq.h> 37#include <asm/irq.h>
38#include <asm/mmu_context.h> 38#include <asm/mmu_context.h>
39#include <asm/compat.h>
40#include "../kernel/entry.h" 39#include "../kernel/entry.h"
41 40
42#ifndef CONFIG_64BIT 41#ifndef CONFIG_64BIT
diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c
index 5d633019d8f3..50236610de83 100644
--- a/arch/s390/mm/init.c
+++ b/arch/s390/mm/init.c
@@ -223,16 +223,38 @@ void free_initrd_mem(unsigned long start, unsigned long end)
223#ifdef CONFIG_MEMORY_HOTPLUG 223#ifdef CONFIG_MEMORY_HOTPLUG
224int arch_add_memory(int nid, u64 start, u64 size) 224int arch_add_memory(int nid, u64 start, u64 size)
225{ 225{
226 struct pglist_data *pgdat; 226 unsigned long zone_start_pfn, zone_end_pfn, nr_pages;
227 unsigned long start_pfn = PFN_DOWN(start);
228 unsigned long size_pages = PFN_DOWN(size);
227 struct zone *zone; 229 struct zone *zone;
228 int rc; 230 int rc;
229 231
230 pgdat = NODE_DATA(nid);
231 zone = pgdat->node_zones + ZONE_MOVABLE;
232 rc = vmem_add_mapping(start, size); 232 rc = vmem_add_mapping(start, size);
233 if (rc) 233 if (rc)
234 return rc; 234 return rc;
235 rc = __add_pages(nid, zone, PFN_DOWN(start), PFN_DOWN(size)); 235 for_each_zone(zone) {
236 if (zone_idx(zone) != ZONE_MOVABLE) {
237 /* Add range within existing zone limits */
238 zone_start_pfn = zone->zone_start_pfn;
239 zone_end_pfn = zone->zone_start_pfn +
240 zone->spanned_pages;
241 } else {
242 /* Add remaining range to ZONE_MOVABLE */
243 zone_start_pfn = start_pfn;
244 zone_end_pfn = start_pfn + size_pages;
245 }
246 if (start_pfn < zone_start_pfn || start_pfn >= zone_end_pfn)
247 continue;
248 nr_pages = (start_pfn + size_pages > zone_end_pfn) ?
249 zone_end_pfn - start_pfn : size_pages;
250 rc = __add_pages(nid, zone, start_pfn, nr_pages);
251 if (rc)
252 break;
253 start_pfn += nr_pages;
254 size_pages -= nr_pages;
255 if (!size_pages)
256 break;
257 }
236 if (rc) 258 if (rc)
237 vmem_remove_mapping(start, size); 259 vmem_remove_mapping(start, size);
238 return rc; 260 return rc;
diff --git a/arch/s390/mm/mmap.c b/arch/s390/mm/mmap.c
index f09c74881b7e..a0155c02e324 100644
--- a/arch/s390/mm/mmap.c
+++ b/arch/s390/mm/mmap.c
@@ -29,8 +29,8 @@
29#include <linux/mman.h> 29#include <linux/mman.h>
30#include <linux/module.h> 30#include <linux/module.h>
31#include <linux/random.h> 31#include <linux/random.h>
32#include <linux/compat.h>
32#include <asm/pgalloc.h> 33#include <asm/pgalloc.h>
33#include <asm/compat.h>
34 34
35static unsigned long stack_maxrandom_size(void) 35static unsigned long stack_maxrandom_size(void)
36{ 36{
diff --git a/arch/x86/include/asm/perf_event.h b/arch/x86/include/asm/perf_event.h
index 096c975e099f..461ce432b1c2 100644
--- a/arch/x86/include/asm/perf_event.h
+++ b/arch/x86/include/asm/perf_event.h
@@ -242,4 +242,12 @@ static inline void perf_get_x86_pmu_capability(struct x86_pmu_capability *cap)
242static inline void perf_events_lapic_init(void) { } 242static inline void perf_events_lapic_init(void) { }
243#endif 243#endif
244 244
245#if defined(CONFIG_PERF_EVENTS) && defined(CONFIG_CPU_SUP_AMD)
246 extern void amd_pmu_enable_virt(void);
247 extern void amd_pmu_disable_virt(void);
248#else
249 static inline void amd_pmu_enable_virt(void) { }
250 static inline void amd_pmu_disable_virt(void) { }
251#endif
252
245#endif /* _ASM_X86_PERF_EVENT_H */ 253#endif /* _ASM_X86_PERF_EVENT_H */
diff --git a/arch/x86/kernel/cpu/intel_cacheinfo.c b/arch/x86/kernel/cpu/intel_cacheinfo.c
index 6b45e5e7a901..73d08ed98a64 100644
--- a/arch/x86/kernel/cpu/intel_cacheinfo.c
+++ b/arch/x86/kernel/cpu/intel_cacheinfo.c
@@ -326,8 +326,7 @@ static void __cpuinit amd_calc_l3_indices(struct amd_northbridge *nb)
326 l3->indices = (max(max3(sc0, sc1, sc2), sc3) << 10) - 1; 326 l3->indices = (max(max3(sc0, sc1, sc2), sc3) << 10) - 1;
327} 327}
328 328
329static void __cpuinit amd_init_l3_cache(struct _cpuid4_info_regs *this_leaf, 329static void __cpuinit amd_init_l3_cache(struct _cpuid4_info_regs *this_leaf, int index)
330 int index)
331{ 330{
332 int node; 331 int node;
333 332
@@ -725,14 +724,16 @@ static DEFINE_PER_CPU(struct _cpuid4_info *, ici_cpuid4_info);
725#define CPUID4_INFO_IDX(x, y) (&((per_cpu(ici_cpuid4_info, x))[y])) 724#define CPUID4_INFO_IDX(x, y) (&((per_cpu(ici_cpuid4_info, x))[y]))
726 725
727#ifdef CONFIG_SMP 726#ifdef CONFIG_SMP
728static void __cpuinit cache_shared_cpu_map_setup(unsigned int cpu, int index) 727
728static int __cpuinit cache_shared_amd_cpu_map_setup(unsigned int cpu, int index)
729{ 729{
730 struct _cpuid4_info *this_leaf, *sibling_leaf; 730 struct _cpuid4_info *this_leaf;
731 unsigned long num_threads_sharing; 731 int ret, i, sibling;
732 int index_msb, i, sibling;
733 struct cpuinfo_x86 *c = &cpu_data(cpu); 732 struct cpuinfo_x86 *c = &cpu_data(cpu);
734 733
735 if ((index == 3) && (c->x86_vendor == X86_VENDOR_AMD)) { 734 ret = 0;
735 if (index == 3) {
736 ret = 1;
736 for_each_cpu(i, cpu_llc_shared_mask(cpu)) { 737 for_each_cpu(i, cpu_llc_shared_mask(cpu)) {
737 if (!per_cpu(ici_cpuid4_info, i)) 738 if (!per_cpu(ici_cpuid4_info, i))
738 continue; 739 continue;
@@ -743,8 +744,35 @@ static void __cpuinit cache_shared_cpu_map_setup(unsigned int cpu, int index)
743 set_bit(sibling, this_leaf->shared_cpu_map); 744 set_bit(sibling, this_leaf->shared_cpu_map);
744 } 745 }
745 } 746 }
746 return; 747 } else if ((c->x86 == 0x15) && ((index == 1) || (index == 2))) {
748 ret = 1;
749 for_each_cpu(i, cpu_sibling_mask(cpu)) {
750 if (!per_cpu(ici_cpuid4_info, i))
751 continue;
752 this_leaf = CPUID4_INFO_IDX(i, index);
753 for_each_cpu(sibling, cpu_sibling_mask(cpu)) {
754 if (!cpu_online(sibling))
755 continue;
756 set_bit(sibling, this_leaf->shared_cpu_map);
757 }
758 }
747 } 759 }
760
761 return ret;
762}
763
764static void __cpuinit cache_shared_cpu_map_setup(unsigned int cpu, int index)
765{
766 struct _cpuid4_info *this_leaf, *sibling_leaf;
767 unsigned long num_threads_sharing;
768 int index_msb, i;
769 struct cpuinfo_x86 *c = &cpu_data(cpu);
770
771 if (c->x86_vendor == X86_VENDOR_AMD) {
772 if (cache_shared_amd_cpu_map_setup(cpu, index))
773 return;
774 }
775
748 this_leaf = CPUID4_INFO_IDX(cpu, index); 776 this_leaf = CPUID4_INFO_IDX(cpu, index);
749 num_threads_sharing = 1 + this_leaf->base.eax.split.num_threads_sharing; 777 num_threads_sharing = 1 + this_leaf->base.eax.split.num_threads_sharing;
750 778
diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd.c b/arch/x86/kernel/cpu/mcheck/mce_amd.c
index 786e76a86322..e4eeaaf58a47 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_amd.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_amd.c
@@ -528,6 +528,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
528 528
529 sprintf(name, "threshold_bank%i", bank); 529 sprintf(name, "threshold_bank%i", bank);
530 530
531#ifdef CONFIG_SMP
531 if (cpu_data(cpu).cpu_core_id && shared_bank[bank]) { /* symlink */ 532 if (cpu_data(cpu).cpu_core_id && shared_bank[bank]) { /* symlink */
532 i = cpumask_first(cpu_llc_shared_mask(cpu)); 533 i = cpumask_first(cpu_llc_shared_mask(cpu));
533 534
@@ -553,6 +554,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
553 554
554 goto out; 555 goto out;
555 } 556 }
557#endif
556 558
557 b = kzalloc(sizeof(struct threshold_bank), GFP_KERNEL); 559 b = kzalloc(sizeof(struct threshold_bank), GFP_KERNEL);
558 if (!b) { 560 if (!b) {
diff --git a/arch/x86/kernel/cpu/perf_event.h b/arch/x86/kernel/cpu/perf_event.h
index 8944062f46e2..c30c807ddc72 100644
--- a/arch/x86/kernel/cpu/perf_event.h
+++ b/arch/x86/kernel/cpu/perf_event.h
@@ -147,7 +147,9 @@ struct cpu_hw_events {
147 /* 147 /*
148 * AMD specific bits 148 * AMD specific bits
149 */ 149 */
150 struct amd_nb *amd_nb; 150 struct amd_nb *amd_nb;
151 /* Inverted mask of bits to clear in the perf_ctr ctrl registers */
152 u64 perf_ctr_virt_mask;
151 153
152 void *kfree_on_online; 154 void *kfree_on_online;
153}; 155};
@@ -417,9 +419,11 @@ void x86_pmu_disable_all(void);
417static inline void __x86_pmu_enable_event(struct hw_perf_event *hwc, 419static inline void __x86_pmu_enable_event(struct hw_perf_event *hwc,
418 u64 enable_mask) 420 u64 enable_mask)
419{ 421{
422 u64 disable_mask = __this_cpu_read(cpu_hw_events.perf_ctr_virt_mask);
423
420 if (hwc->extra_reg.reg) 424 if (hwc->extra_reg.reg)
421 wrmsrl(hwc->extra_reg.reg, hwc->extra_reg.config); 425 wrmsrl(hwc->extra_reg.reg, hwc->extra_reg.config);
422 wrmsrl(hwc->config_base, hwc->config | enable_mask); 426 wrmsrl(hwc->config_base, (hwc->config | enable_mask) & ~disable_mask);
423} 427}
424 428
425void x86_pmu_enable_all(int added); 429void x86_pmu_enable_all(int added);
diff --git a/arch/x86/kernel/cpu/perf_event_amd.c b/arch/x86/kernel/cpu/perf_event_amd.c
index 0397b23be8e9..67250a52430b 100644
--- a/arch/x86/kernel/cpu/perf_event_amd.c
+++ b/arch/x86/kernel/cpu/perf_event_amd.c
@@ -1,4 +1,5 @@
1#include <linux/perf_event.h> 1#include <linux/perf_event.h>
2#include <linux/export.h>
2#include <linux/types.h> 3#include <linux/types.h>
3#include <linux/init.h> 4#include <linux/init.h>
4#include <linux/slab.h> 5#include <linux/slab.h>
@@ -357,7 +358,9 @@ static void amd_pmu_cpu_starting(int cpu)
357 struct amd_nb *nb; 358 struct amd_nb *nb;
358 int i, nb_id; 359 int i, nb_id;
359 360
360 if (boot_cpu_data.x86_max_cores < 2) 361 cpuc->perf_ctr_virt_mask = AMD_PERFMON_EVENTSEL_HOSTONLY;
362
363 if (boot_cpu_data.x86_max_cores < 2 || boot_cpu_data.x86 == 0x15)
361 return; 364 return;
362 365
363 nb_id = amd_get_nb_id(cpu); 366 nb_id = amd_get_nb_id(cpu);
@@ -587,9 +590,9 @@ static __initconst const struct x86_pmu amd_pmu_f15h = {
587 .put_event_constraints = amd_put_event_constraints, 590 .put_event_constraints = amd_put_event_constraints,
588 591
589 .cpu_prepare = amd_pmu_cpu_prepare, 592 .cpu_prepare = amd_pmu_cpu_prepare,
590 .cpu_starting = amd_pmu_cpu_starting,
591 .cpu_dead = amd_pmu_cpu_dead, 593 .cpu_dead = amd_pmu_cpu_dead,
592#endif 594#endif
595 .cpu_starting = amd_pmu_cpu_starting,
593}; 596};
594 597
595__init int amd_pmu_init(void) 598__init int amd_pmu_init(void)
@@ -621,3 +624,33 @@ __init int amd_pmu_init(void)
621 624
622 return 0; 625 return 0;
623} 626}
627
628void amd_pmu_enable_virt(void)
629{
630 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
631
632 cpuc->perf_ctr_virt_mask = 0;
633
634 /* Reload all events */
635 x86_pmu_disable_all();
636 x86_pmu_enable_all(0);
637}
638EXPORT_SYMBOL_GPL(amd_pmu_enable_virt);
639
640void amd_pmu_disable_virt(void)
641{
642 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
643
644 /*
645 * We only mask out the Host-only bit so that host-only counting works
646 * when SVM is disabled. If someone sets up a guest-only counter when
647 * SVM is disabled the Guest-only bits still gets set and the counter
648 * will not count anything.
649 */
650 cpuc->perf_ctr_virt_mask = AMD_PERFMON_EVENTSEL_HOSTONLY;
651
652 /* Reload all events */
653 x86_pmu_disable_all();
654 x86_pmu_enable_all(0);
655}
656EXPORT_SYMBOL_GPL(amd_pmu_disable_virt);
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index 3fe8239fd8fb..1333d9851778 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -1532,10 +1532,17 @@ ENTRY(nmi)
1532 pushq_cfi %rdx 1532 pushq_cfi %rdx
1533 1533
1534 /* 1534 /*
1535 * If %cs was not the kernel segment, then the NMI triggered in user
1536 * space, which means it is definitely not nested.
1537 */
1538 cmpl $__KERNEL_CS, 16(%rsp)
1539 jne first_nmi
1540
1541 /*
1535 * Check the special variable on the stack to see if NMIs are 1542 * Check the special variable on the stack to see if NMIs are
1536 * executing. 1543 * executing.
1537 */ 1544 */
1538 cmp $1, -8(%rsp) 1545 cmpl $1, -8(%rsp)
1539 je nested_nmi 1546 je nested_nmi
1540 1547
1541 /* 1548 /*
diff --git a/arch/x86/kernel/microcode_amd.c b/arch/x86/kernel/microcode_amd.c
index ac0417be9131..73465aab28f8 100644
--- a/arch/x86/kernel/microcode_amd.c
+++ b/arch/x86/kernel/microcode_amd.c
@@ -360,7 +360,6 @@ out:
360static enum ucode_state 360static enum ucode_state
361request_microcode_user(int cpu, const void __user *buf, size_t size) 361request_microcode_user(int cpu, const void __user *buf, size_t size)
362{ 362{
363 pr_info("AMD microcode update via /dev/cpu/microcode not supported\n");
364 return UCODE_ERROR; 363 return UCODE_ERROR;
365} 364}
366 365
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 5fa553babe56..e385214711cb 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -29,6 +29,7 @@
29#include <linux/ftrace_event.h> 29#include <linux/ftrace_event.h>
30#include <linux/slab.h> 30#include <linux/slab.h>
31 31
32#include <asm/perf_event.h>
32#include <asm/tlbflush.h> 33#include <asm/tlbflush.h>
33#include <asm/desc.h> 34#include <asm/desc.h>
34#include <asm/kvm_para.h> 35#include <asm/kvm_para.h>
@@ -575,6 +576,8 @@ static void svm_hardware_disable(void *garbage)
575 wrmsrl(MSR_AMD64_TSC_RATIO, TSC_RATIO_DEFAULT); 576 wrmsrl(MSR_AMD64_TSC_RATIO, TSC_RATIO_DEFAULT);
576 577
577 cpu_svm_disable(); 578 cpu_svm_disable();
579
580 amd_pmu_disable_virt();
578} 581}
579 582
580static int svm_hardware_enable(void *garbage) 583static int svm_hardware_enable(void *garbage)
@@ -622,6 +625,8 @@ static int svm_hardware_enable(void *garbage)
622 625
623 svm_init_erratum_383(); 626 svm_init_erratum_383();
624 627
628 amd_pmu_enable_virt();
629
625 return 0; 630 return 0;
626} 631}
627 632
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 12eb07bfb267..4172af8ceeb3 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -1141,7 +1141,9 @@ asmlinkage void __init xen_start_kernel(void)
1141 1141
1142 /* Prevent unwanted bits from being set in PTEs. */ 1142 /* Prevent unwanted bits from being set in PTEs. */
1143 __supported_pte_mask &= ~_PAGE_GLOBAL; 1143 __supported_pte_mask &= ~_PAGE_GLOBAL;
1144#if 0
1144 if (!xen_initial_domain()) 1145 if (!xen_initial_domain())
1146#endif
1145 __supported_pte_mask &= ~(_PAGE_PWT | _PAGE_PCD); 1147 __supported_pte_mask &= ~(_PAGE_PWT | _PAGE_PCD);
1146 1148
1147 __supported_pte_mask |= _PAGE_IOMAP; 1149 __supported_pte_mask |= _PAGE_IOMAP;
@@ -1204,10 +1206,6 @@ asmlinkage void __init xen_start_kernel(void)
1204 1206
1205 pgd = (pgd_t *)xen_start_info->pt_base; 1207 pgd = (pgd_t *)xen_start_info->pt_base;
1206 1208
1207 if (!xen_initial_domain())
1208 __supported_pte_mask &= ~(_PAGE_PWT | _PAGE_PCD);
1209
1210 __supported_pte_mask |= _PAGE_IOMAP;
1211 /* Don't do the full vcpu_info placement stuff until we have a 1209 /* Don't do the full vcpu_info placement stuff until we have a
1212 possible map and a non-dummy shared_info. */ 1210 possible map and a non-dummy shared_info. */
1213 per_cpu(xen_vcpu, 0) = &HYPERVISOR_shared_info->vcpu_info[0]; 1211 per_cpu(xen_vcpu, 0) = &HYPERVISOR_shared_info->vcpu_info[0];
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index 58a0e46c404d..95c1cf60c669 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -415,13 +415,13 @@ static pteval_t iomap_pte(pteval_t val)
415static pteval_t xen_pte_val(pte_t pte) 415static pteval_t xen_pte_val(pte_t pte)
416{ 416{
417 pteval_t pteval = pte.pte; 417 pteval_t pteval = pte.pte;
418 418#if 0
419 /* If this is a WC pte, convert back from Xen WC to Linux WC */ 419 /* If this is a WC pte, convert back from Xen WC to Linux WC */
420 if ((pteval & (_PAGE_PAT | _PAGE_PCD | _PAGE_PWT)) == _PAGE_PAT) { 420 if ((pteval & (_PAGE_PAT | _PAGE_PCD | _PAGE_PWT)) == _PAGE_PAT) {
421 WARN_ON(!pat_enabled); 421 WARN_ON(!pat_enabled);
422 pteval = (pteval & ~_PAGE_PAT) | _PAGE_PWT; 422 pteval = (pteval & ~_PAGE_PAT) | _PAGE_PWT;
423 } 423 }
424 424#endif
425 if (xen_initial_domain() && (pteval & _PAGE_IOMAP)) 425 if (xen_initial_domain() && (pteval & _PAGE_IOMAP))
426 return pteval; 426 return pteval;
427 427
@@ -463,7 +463,7 @@ void xen_set_pat(u64 pat)
463static pte_t xen_make_pte(pteval_t pte) 463static pte_t xen_make_pte(pteval_t pte)
464{ 464{
465 phys_addr_t addr = (pte & PTE_PFN_MASK); 465 phys_addr_t addr = (pte & PTE_PFN_MASK);
466 466#if 0
467 /* If Linux is trying to set a WC pte, then map to the Xen WC. 467 /* If Linux is trying to set a WC pte, then map to the Xen WC.
468 * If _PAGE_PAT is set, then it probably means it is really 468 * If _PAGE_PAT is set, then it probably means it is really
469 * _PAGE_PSE, so avoid fiddling with the PAT mapping and hope 469 * _PAGE_PSE, so avoid fiddling with the PAT mapping and hope
@@ -476,7 +476,7 @@ static pte_t xen_make_pte(pteval_t pte)
476 if ((pte & (_PAGE_PCD | _PAGE_PWT)) == _PAGE_PWT) 476 if ((pte & (_PAGE_PCD | _PAGE_PWT)) == _PAGE_PWT)
477 pte = (pte & ~(_PAGE_PCD | _PAGE_PWT)) | _PAGE_PAT; 477 pte = (pte & ~(_PAGE_PCD | _PAGE_PWT)) | _PAGE_PAT;
478 } 478 }
479 479#endif
480 /* 480 /*
481 * Unprivileged domains are allowed to do IOMAPpings for 481 * Unprivileged domains are allowed to do IOMAPpings for
482 * PCI passthrough, but not map ISA space. The ISA 482 * PCI passthrough, but not map ISA space. The ISA
diff --git a/block/partitions/ldm.c b/block/partitions/ldm.c
index bd8ae788f689..e507cfbd044e 100644
--- a/block/partitions/ldm.c
+++ b/block/partitions/ldm.c
@@ -2,7 +2,7 @@
2 * ldm - Support for Windows Logical Disk Manager (Dynamic Disks) 2 * ldm - Support for Windows Logical Disk Manager (Dynamic Disks)
3 * 3 *
4 * Copyright (C) 2001,2002 Richard Russon <ldm@flatcap.org> 4 * Copyright (C) 2001,2002 Richard Russon <ldm@flatcap.org>
5 * Copyright (c) 2001-2007 Anton Altaparmakov 5 * Copyright (c) 2001-2012 Anton Altaparmakov
6 * Copyright (C) 2001,2002 Jakob Kemi <jakob.kemi@telia.com> 6 * Copyright (C) 2001,2002 Jakob Kemi <jakob.kemi@telia.com>
7 * 7 *
8 * Documentation is available at http://www.linux-ntfs.org/doku.php?id=downloads 8 * Documentation is available at http://www.linux-ntfs.org/doku.php?id=downloads
@@ -1341,20 +1341,17 @@ found:
1341 ldm_error("REC value (%d) exceeds NUM value (%d)", rec, f->num); 1341 ldm_error("REC value (%d) exceeds NUM value (%d)", rec, f->num);
1342 return false; 1342 return false;
1343 } 1343 }
1344
1345 if (f->map & (1 << rec)) { 1344 if (f->map & (1 << rec)) {
1346 ldm_error ("Duplicate VBLK, part %d.", rec); 1345 ldm_error ("Duplicate VBLK, part %d.", rec);
1347 f->map &= 0x7F; /* Mark the group as broken */ 1346 f->map &= 0x7F; /* Mark the group as broken */
1348 return false; 1347 return false;
1349 } 1348 }
1350
1351 f->map |= (1 << rec); 1349 f->map |= (1 << rec);
1352 1350 if (!rec)
1351 memcpy(f->data, data, VBLK_SIZE_HEAD);
1353 data += VBLK_SIZE_HEAD; 1352 data += VBLK_SIZE_HEAD;
1354 size -= VBLK_SIZE_HEAD; 1353 size -= VBLK_SIZE_HEAD;
1355 1354 memcpy(f->data + VBLK_SIZE_HEAD + rec * size, data, size);
1356 memcpy (f->data+rec*(size-VBLK_SIZE_HEAD)+VBLK_SIZE_HEAD, data, size);
1357
1358 return true; 1355 return true;
1359} 1356}
1360 1357
diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c
index 5d1d07645132..e8cd652d2017 100644
--- a/drivers/atm/solos-pci.c
+++ b/drivers/atm/solos-pci.c
@@ -1206,9 +1206,9 @@ static int fpga_probe(struct pci_dev *dev, const struct pci_device_id *id)
1206 1206
1207 out_unmap_both: 1207 out_unmap_both:
1208 pci_set_drvdata(dev, NULL); 1208 pci_set_drvdata(dev, NULL);
1209 pci_iounmap(dev, card->config_regs);
1210 out_unmap_config:
1211 pci_iounmap(dev, card->buffers); 1209 pci_iounmap(dev, card->buffers);
1210 out_unmap_config:
1211 pci_iounmap(dev, card->config_regs);
1212 out_release_regions: 1212 out_release_regions:
1213 pci_release_regions(dev); 1213 pci_release_regions(dev);
1214 out: 1214 out:
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index f00f596c1029..789c9b579aea 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -102,6 +102,7 @@ static struct usb_device_id btusb_table[] = {
102 102
103 /* Broadcom BCM20702A0 */ 103 /* Broadcom BCM20702A0 */
104 { USB_DEVICE(0x0a5c, 0x21e3) }, 104 { USB_DEVICE(0x0a5c, 0x21e3) },
105 { USB_DEVICE(0x0a5c, 0x21f3) },
105 { USB_DEVICE(0x413c, 0x8197) }, 106 { USB_DEVICE(0x413c, 0x8197) },
106 107
107 { } /* Terminating entry */ 108 { } /* Terminating entry */
@@ -726,9 +727,6 @@ static int btusb_send_frame(struct sk_buff *skb)
726 usb_fill_bulk_urb(urb, data->udev, pipe, 727 usb_fill_bulk_urb(urb, data->udev, pipe,
727 skb->data, skb->len, btusb_tx_complete, skb); 728 skb->data, skb->len, btusb_tx_complete, skb);
728 729
729 if (skb->priority >= HCI_PRIO_MAX - 1)
730 urb->transfer_flags = URB_ISO_ASAP;
731
732 hdev->stat.acl_tx++; 730 hdev->stat.acl_tx++;
733 break; 731 break;
734 732
diff --git a/drivers/crypto/mv_cesa.c b/drivers/crypto/mv_cesa.c
index 597235a2f8f9..0d40cf66b3cc 100644
--- a/drivers/crypto/mv_cesa.c
+++ b/drivers/crypto/mv_cesa.c
@@ -714,6 +714,7 @@ static int mv_hash_final(struct ahash_request *req)
714{ 714{
715 struct mv_req_hash_ctx *ctx = ahash_request_ctx(req); 715 struct mv_req_hash_ctx *ctx = ahash_request_ctx(req);
716 716
717 ahash_request_set_crypt(req, NULL, req->result, 0);
717 mv_update_hash_req_ctx(ctx, 1, 0); 718 mv_update_hash_req_ctx(ctx, 1, 0);
718 return mv_handle_req(&req->base); 719 return mv_handle_req(&req->base);
719} 720}
diff --git a/drivers/gpu/drm/exynos/exynos_drm_connector.c b/drivers/gpu/drm/exynos/exynos_drm_connector.c
index d620b0784257..618bd4d87d28 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_connector.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_connector.c
@@ -28,6 +28,7 @@
28#include "drmP.h" 28#include "drmP.h"
29#include "drm_crtc_helper.h" 29#include "drm_crtc_helper.h"
30 30
31#include <drm/exynos_drm.h>
31#include "exynos_drm_drv.h" 32#include "exynos_drm_drv.h"
32#include "exynos_drm_encoder.h" 33#include "exynos_drm_encoder.h"
33 34
@@ -44,8 +45,9 @@ struct exynos_drm_connector {
44/* convert exynos_video_timings to drm_display_mode */ 45/* convert exynos_video_timings to drm_display_mode */
45static inline void 46static inline void
46convert_to_display_mode(struct drm_display_mode *mode, 47convert_to_display_mode(struct drm_display_mode *mode,
47 struct fb_videomode *timing) 48 struct exynos_drm_panel_info *panel)
48{ 49{
50 struct fb_videomode *timing = &panel->timing;
49 DRM_DEBUG_KMS("%s\n", __FILE__); 51 DRM_DEBUG_KMS("%s\n", __FILE__);
50 52
51 mode->clock = timing->pixclock / 1000; 53 mode->clock = timing->pixclock / 1000;
@@ -60,6 +62,8 @@ convert_to_display_mode(struct drm_display_mode *mode,
60 mode->vsync_start = mode->vdisplay + timing->upper_margin; 62 mode->vsync_start = mode->vdisplay + timing->upper_margin;
61 mode->vsync_end = mode->vsync_start + timing->vsync_len; 63 mode->vsync_end = mode->vsync_start + timing->vsync_len;
62 mode->vtotal = mode->vsync_end + timing->lower_margin; 64 mode->vtotal = mode->vsync_end + timing->lower_margin;
65 mode->width_mm = panel->width_mm;
66 mode->height_mm = panel->height_mm;
63 67
64 if (timing->vmode & FB_VMODE_INTERLACED) 68 if (timing->vmode & FB_VMODE_INTERLACED)
65 mode->flags |= DRM_MODE_FLAG_INTERLACE; 69 mode->flags |= DRM_MODE_FLAG_INTERLACE;
@@ -148,16 +152,18 @@ static int exynos_drm_connector_get_modes(struct drm_connector *connector)
148 connector->display_info.raw_edid = edid; 152 connector->display_info.raw_edid = edid;
149 } else { 153 } else {
150 struct drm_display_mode *mode = drm_mode_create(connector->dev); 154 struct drm_display_mode *mode = drm_mode_create(connector->dev);
151 struct fb_videomode *timing; 155 struct exynos_drm_panel_info *panel;
152 156
153 if (display_ops->get_timing) 157 if (display_ops->get_panel)
154 timing = display_ops->get_timing(manager->dev); 158 panel = display_ops->get_panel(manager->dev);
155 else { 159 else {
156 drm_mode_destroy(connector->dev, mode); 160 drm_mode_destroy(connector->dev, mode);
157 return 0; 161 return 0;
158 } 162 }
159 163
160 convert_to_display_mode(mode, timing); 164 convert_to_display_mode(mode, panel);
165 connector->display_info.width_mm = mode->width_mm;
166 connector->display_info.height_mm = mode->height_mm;
161 167
162 mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED; 168 mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
163 drm_mode_set_name(mode); 169 drm_mode_set_name(mode);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h
index e685e1e33055..13540de90bfc 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
@@ -136,7 +136,7 @@ struct exynos_drm_overlay {
136 * @type: one of EXYNOS_DISPLAY_TYPE_LCD and HDMI. 136 * @type: one of EXYNOS_DISPLAY_TYPE_LCD and HDMI.
137 * @is_connected: check for that display is connected or not. 137 * @is_connected: check for that display is connected or not.
138 * @get_edid: get edid modes from display driver. 138 * @get_edid: get edid modes from display driver.
139 * @get_timing: get timing object from display driver. 139 * @get_panel: get panel object from display driver.
140 * @check_timing: check if timing is valid or not. 140 * @check_timing: check if timing is valid or not.
141 * @power_on: display device on or off. 141 * @power_on: display device on or off.
142 */ 142 */
@@ -145,7 +145,7 @@ struct exynos_drm_display_ops {
145 bool (*is_connected)(struct device *dev); 145 bool (*is_connected)(struct device *dev);
146 int (*get_edid)(struct device *dev, struct drm_connector *connector, 146 int (*get_edid)(struct device *dev, struct drm_connector *connector,
147 u8 *edid, int len); 147 u8 *edid, int len);
148 void *(*get_timing)(struct device *dev); 148 void *(*get_panel)(struct device *dev);
149 int (*check_timing)(struct device *dev, void *timing); 149 int (*check_timing)(struct device *dev, void *timing);
150 int (*power_on)(struct device *dev, int mode); 150 int (*power_on)(struct device *dev, int mode);
151}; 151};
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 0dbb32bb18a3..360adf2bba04 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -89,7 +89,7 @@ struct fimd_context {
89 bool suspended; 89 bool suspended;
90 struct mutex lock; 90 struct mutex lock;
91 91
92 struct fb_videomode *timing; 92 struct exynos_drm_panel_info *panel;
93}; 93};
94 94
95static bool fimd_display_is_connected(struct device *dev) 95static bool fimd_display_is_connected(struct device *dev)
@@ -101,13 +101,13 @@ static bool fimd_display_is_connected(struct device *dev)
101 return true; 101 return true;
102} 102}
103 103
104static void *fimd_get_timing(struct device *dev) 104static void *fimd_get_panel(struct device *dev)
105{ 105{
106 struct fimd_context *ctx = get_fimd_context(dev); 106 struct fimd_context *ctx = get_fimd_context(dev);
107 107
108 DRM_DEBUG_KMS("%s\n", __FILE__); 108 DRM_DEBUG_KMS("%s\n", __FILE__);
109 109
110 return ctx->timing; 110 return ctx->panel;
111} 111}
112 112
113static int fimd_check_timing(struct device *dev, void *timing) 113static int fimd_check_timing(struct device *dev, void *timing)
@@ -131,7 +131,7 @@ static int fimd_display_power_on(struct device *dev, int mode)
131static struct exynos_drm_display_ops fimd_display_ops = { 131static struct exynos_drm_display_ops fimd_display_ops = {
132 .type = EXYNOS_DISPLAY_TYPE_LCD, 132 .type = EXYNOS_DISPLAY_TYPE_LCD,
133 .is_connected = fimd_display_is_connected, 133 .is_connected = fimd_display_is_connected,
134 .get_timing = fimd_get_timing, 134 .get_panel = fimd_get_panel,
135 .check_timing = fimd_check_timing, 135 .check_timing = fimd_check_timing,
136 .power_on = fimd_display_power_on, 136 .power_on = fimd_display_power_on,
137}; 137};
@@ -193,7 +193,8 @@ static void fimd_apply(struct device *subdrv_dev)
193static void fimd_commit(struct device *dev) 193static void fimd_commit(struct device *dev)
194{ 194{
195 struct fimd_context *ctx = get_fimd_context(dev); 195 struct fimd_context *ctx = get_fimd_context(dev);
196 struct fb_videomode *timing = ctx->timing; 196 struct exynos_drm_panel_info *panel = ctx->panel;
197 struct fb_videomode *timing = &panel->timing;
197 u32 val; 198 u32 val;
198 199
199 if (ctx->suspended) 200 if (ctx->suspended)
@@ -786,7 +787,7 @@ static int __devinit fimd_probe(struct platform_device *pdev)
786 struct fimd_context *ctx; 787 struct fimd_context *ctx;
787 struct exynos_drm_subdrv *subdrv; 788 struct exynos_drm_subdrv *subdrv;
788 struct exynos_drm_fimd_pdata *pdata; 789 struct exynos_drm_fimd_pdata *pdata;
789 struct fb_videomode *timing; 790 struct exynos_drm_panel_info *panel;
790 struct resource *res; 791 struct resource *res;
791 int win; 792 int win;
792 int ret = -EINVAL; 793 int ret = -EINVAL;
@@ -799,9 +800,9 @@ static int __devinit fimd_probe(struct platform_device *pdev)
799 return -EINVAL; 800 return -EINVAL;
800 } 801 }
801 802
802 timing = &pdata->timing; 803 panel = &pdata->panel;
803 if (!timing) { 804 if (!panel) {
804 dev_err(dev, "timing is null.\n"); 805 dev_err(dev, "panel is null.\n");
805 return -EINVAL; 806 return -EINVAL;
806 } 807 }
807 808
@@ -863,16 +864,16 @@ static int __devinit fimd_probe(struct platform_device *pdev)
863 goto err_req_irq; 864 goto err_req_irq;
864 } 865 }
865 866
866 ctx->clkdiv = fimd_calc_clkdiv(ctx, timing); 867 ctx->clkdiv = fimd_calc_clkdiv(ctx, &panel->timing);
867 ctx->vidcon0 = pdata->vidcon0; 868 ctx->vidcon0 = pdata->vidcon0;
868 ctx->vidcon1 = pdata->vidcon1; 869 ctx->vidcon1 = pdata->vidcon1;
869 ctx->default_win = pdata->default_win; 870 ctx->default_win = pdata->default_win;
870 ctx->timing = timing; 871 ctx->panel = panel;
871 872
872 timing->pixclock = clk_get_rate(ctx->lcd_clk) / ctx->clkdiv; 873 panel->timing.pixclock = clk_get_rate(ctx->lcd_clk) / ctx->clkdiv;
873 874
874 DRM_DEBUG_KMS("pixel clock = %d, clkdiv = %d\n", 875 DRM_DEBUG_KMS("pixel clock = %d, clkdiv = %d\n",
875 timing->pixclock, ctx->clkdiv); 876 panel->timing.pixclock, ctx->clkdiv);
876 877
877 subdrv = &ctx->subdrv; 878 subdrv = &ctx->subdrv;
878 879
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index f425b23e3803..f851db7be2cc 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -4680,8 +4680,17 @@ sandybridge_compute_sprite_srwm(struct drm_device *dev, int plane,
4680 4680
4681 crtc = intel_get_crtc_for_plane(dev, plane); 4681 crtc = intel_get_crtc_for_plane(dev, plane);
4682 clock = crtc->mode.clock; 4682 clock = crtc->mode.clock;
4683 if (!clock) {
4684 *sprite_wm = 0;
4685 return false;
4686 }
4683 4687
4684 line_time_us = (sprite_width * 1000) / clock; 4688 line_time_us = (sprite_width * 1000) / clock;
4689 if (!line_time_us) {
4690 *sprite_wm = 0;
4691 return false;
4692 }
4693
4685 line_count = (latency_ns / line_time_us + 1000) / 1000; 4694 line_count = (latency_ns / line_time_us + 1000) / 1000;
4686 line_size = sprite_width * pixel_size; 4695 line_size = sprite_width * pixel_size;
4687 4696
@@ -6175,7 +6184,7 @@ void intel_crtc_load_lut(struct drm_crtc *crtc)
6175 int i; 6184 int i;
6176 6185
6177 /* The clocks have to be on to load the palette. */ 6186 /* The clocks have to be on to load the palette. */
6178 if (!crtc->enabled) 6187 if (!crtc->enabled || !intel_crtc->active)
6179 return; 6188 return;
6180 6189
6181 /* use legacy palette for Ironlake */ 6190 /* use legacy palette for Ironlake */
@@ -6561,7 +6570,7 @@ intel_framebuffer_create_for_mode(struct drm_device *dev,
6561 mode_cmd.height = mode->vdisplay; 6570 mode_cmd.height = mode->vdisplay;
6562 mode_cmd.pitches[0] = intel_framebuffer_pitch_for_width(mode_cmd.width, 6571 mode_cmd.pitches[0] = intel_framebuffer_pitch_for_width(mode_cmd.width,
6563 bpp); 6572 bpp);
6564 mode_cmd.pixel_format = 0; 6573 mode_cmd.pixel_format = drm_mode_legacy_fb_format(bpp, depth);
6565 6574
6566 return intel_framebuffer_create(dev, &mode_cmd, obj); 6575 return intel_framebuffer_create(dev, &mode_cmd, obj);
6567} 6576}
@@ -8185,7 +8194,7 @@ void gen6_enable_rps(struct drm_i915_private *dev_priv)
8185 8194
8186 if (intel_enable_rc6(dev_priv->dev)) 8195 if (intel_enable_rc6(dev_priv->dev))
8187 rc6_mask = GEN6_RC_CTL_RC6_ENABLE | 8196 rc6_mask = GEN6_RC_CTL_RC6_ENABLE |
8188 (IS_GEN7(dev_priv->dev)) ? GEN6_RC_CTL_RC6p_ENABLE : 0; 8197 ((IS_GEN7(dev_priv->dev)) ? GEN6_RC_CTL_RC6p_ENABLE : 0);
8189 8198
8190 I915_WRITE(GEN6_RC_CONTROL, 8199 I915_WRITE(GEN6_RC_CONTROL,
8191 rc6_mask | 8200 rc6_mask |
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
index 1ab842c6032e..536191540b03 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -301,7 +301,7 @@ static int init_ring_common(struct intel_ring_buffer *ring)
301 301
302 I915_WRITE_CTL(ring, 302 I915_WRITE_CTL(ring,
303 ((ring->size - PAGE_SIZE) & RING_NR_PAGES) 303 ((ring->size - PAGE_SIZE) & RING_NR_PAGES)
304 | RING_REPORT_64K | RING_VALID); 304 | RING_VALID);
305 305
306 /* If the head is still not zero, the ring is dead */ 306 /* If the head is still not zero, the ring is dead */
307 if ((I915_READ_CTL(ring) & RING_VALID) == 0 || 307 if ((I915_READ_CTL(ring) & RING_VALID) == 0 ||
@@ -1132,18 +1132,6 @@ int intel_wait_ring_buffer(struct intel_ring_buffer *ring, int n)
1132 struct drm_device *dev = ring->dev; 1132 struct drm_device *dev = ring->dev;
1133 struct drm_i915_private *dev_priv = dev->dev_private; 1133 struct drm_i915_private *dev_priv = dev->dev_private;
1134 unsigned long end; 1134 unsigned long end;
1135 u32 head;
1136
1137 /* If the reported head position has wrapped or hasn't advanced,
1138 * fallback to the slow and accurate path.
1139 */
1140 head = intel_read_status_page(ring, 4);
1141 if (head > ring->head) {
1142 ring->head = head;
1143 ring->space = ring_space(ring);
1144 if (ring->space >= n)
1145 return 0;
1146 }
1147 1135
1148 trace_i915_ring_wait_begin(ring); 1136 trace_i915_ring_wait_begin(ring);
1149 if (drm_core_check_feature(dev, DRIVER_GEM)) 1137 if (drm_core_check_feature(dev, DRIVER_GEM))
diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600_cs.c
index 38ce5d0427e3..387fcc9f03ef 100644
--- a/drivers/gpu/drm/radeon/r600_cs.c
+++ b/drivers/gpu/drm/radeon/r600_cs.c
@@ -1304,6 +1304,7 @@ static int r600_check_texture_resource(struct radeon_cs_parser *p, u32 idx,
1304 h0 = G_038004_TEX_HEIGHT(word1) + 1; 1304 h0 = G_038004_TEX_HEIGHT(word1) + 1;
1305 d0 = G_038004_TEX_DEPTH(word1); 1305 d0 = G_038004_TEX_DEPTH(word1);
1306 nfaces = 1; 1306 nfaces = 1;
1307 array = 0;
1307 switch (G_038000_DIM(word0)) { 1308 switch (G_038000_DIM(word0)) {
1308 case V_038000_SQ_TEX_DIM_1D: 1309 case V_038000_SQ_TEX_DIM_1D:
1309 case V_038000_SQ_TEX_DIM_2D: 1310 case V_038000_SQ_TEX_DIM_2D:
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c
index e7cb3ab09243..8b3d8ed52ff6 100644
--- a/drivers/gpu/drm/radeon/radeon_connectors.c
+++ b/drivers/gpu/drm/radeon/radeon_connectors.c
@@ -1117,13 +1117,23 @@ static int radeon_dp_get_modes(struct drm_connector *connector)
1117 (connector->connector_type == DRM_MODE_CONNECTOR_LVDS)) { 1117 (connector->connector_type == DRM_MODE_CONNECTOR_LVDS)) {
1118 struct drm_display_mode *mode; 1118 struct drm_display_mode *mode;
1119 1119
1120 if (!radeon_dig_connector->edp_on) 1120 if (connector->connector_type == DRM_MODE_CONNECTOR_eDP) {
1121 atombios_set_edp_panel_power(connector, 1121 if (!radeon_dig_connector->edp_on)
1122 ATOM_TRANSMITTER_ACTION_POWER_ON); 1122 atombios_set_edp_panel_power(connector,
1123 ret = radeon_ddc_get_modes(radeon_connector); 1123 ATOM_TRANSMITTER_ACTION_POWER_ON);
1124 if (!radeon_dig_connector->edp_on) 1124 ret = radeon_ddc_get_modes(radeon_connector);
1125 atombios_set_edp_panel_power(connector, 1125 if (!radeon_dig_connector->edp_on)
1126 ATOM_TRANSMITTER_ACTION_POWER_OFF); 1126 atombios_set_edp_panel_power(connector,
1127 ATOM_TRANSMITTER_ACTION_POWER_OFF);
1128 } else {
1129 /* need to setup ddc on the bridge */
1130 if (radeon_connector_encoder_get_dp_bridge_encoder_id(connector) !=
1131 ENCODER_OBJECT_ID_NONE) {
1132 if (encoder)
1133 radeon_atom_ext_encoder_setup_ddc(encoder);
1134 }
1135 ret = radeon_ddc_get_modes(radeon_connector);
1136 }
1127 1137
1128 if (ret > 0) { 1138 if (ret > 0) {
1129 if (encoder) { 1139 if (encoder) {
@@ -1134,7 +1144,6 @@ static int radeon_dp_get_modes(struct drm_connector *connector)
1134 return ret; 1144 return ret;
1135 } 1145 }
1136 1146
1137 encoder = radeon_best_single_encoder(connector);
1138 if (!encoder) 1147 if (!encoder)
1139 return 0; 1148 return 0;
1140 1149
diff --git a/drivers/gpu/drm/radeon/radeon_gart.c b/drivers/gpu/drm/radeon/radeon_gart.c
index 010dad8b66ae..c58a036233fb 100644
--- a/drivers/gpu/drm/radeon/radeon_gart.c
+++ b/drivers/gpu/drm/radeon/radeon_gart.c
@@ -597,13 +597,13 @@ int radeon_vm_bo_rmv(struct radeon_device *rdev,
597 if (bo_va == NULL) 597 if (bo_va == NULL)
598 return 0; 598 return 0;
599 599
600 list_del(&bo_va->bo_list);
601 mutex_lock(&vm->mutex); 600 mutex_lock(&vm->mutex);
602 radeon_mutex_lock(&rdev->cs_mutex); 601 radeon_mutex_lock(&rdev->cs_mutex);
603 radeon_vm_bo_update_pte(rdev, vm, bo, NULL); 602 radeon_vm_bo_update_pte(rdev, vm, bo, NULL);
604 radeon_mutex_unlock(&rdev->cs_mutex); 603 radeon_mutex_unlock(&rdev->cs_mutex);
605 list_del(&bo_va->vm_list); 604 list_del(&bo_va->vm_list);
606 mutex_unlock(&vm->mutex); 605 mutex_unlock(&vm->mutex);
606 list_del(&bo_va->bo_list);
607 607
608 kfree(bo_va); 608 kfree(bo_va);
609 return 0; 609 return 0;
diff --git a/drivers/hwmon/f75375s.c b/drivers/hwmon/f75375s.c
index 6bab2001ef3b..6aa5a9fad879 100644
--- a/drivers/hwmon/f75375s.c
+++ b/drivers/hwmon/f75375s.c
@@ -178,6 +178,16 @@ static inline void f75375_write16(struct i2c_client *client, u8 reg,
178 i2c_smbus_write_byte_data(client, reg + 1, (value & 0xFF)); 178 i2c_smbus_write_byte_data(client, reg + 1, (value & 0xFF));
179} 179}
180 180
181static void f75375_write_pwm(struct i2c_client *client, int nr)
182{
183 struct f75375_data *data = i2c_get_clientdata(client);
184 if (data->kind == f75387)
185 f75375_write16(client, F75375_REG_FAN_EXP(nr), data->pwm[nr]);
186 else
187 f75375_write8(client, F75375_REG_FAN_PWM_DUTY(nr),
188 data->pwm[nr]);
189}
190
181static struct f75375_data *f75375_update_device(struct device *dev) 191static struct f75375_data *f75375_update_device(struct device *dev)
182{ 192{
183 struct i2c_client *client = to_i2c_client(dev); 193 struct i2c_client *client = to_i2c_client(dev);
@@ -254,6 +264,36 @@ static inline u16 rpm_to_reg(int rpm)
254 return 1500000 / rpm; 264 return 1500000 / rpm;
255} 265}
256 266
267static bool duty_mode_enabled(u8 pwm_enable)
268{
269 switch (pwm_enable) {
270 case 0: /* Manual, duty mode (full speed) */
271 case 1: /* Manual, duty mode */
272 case 4: /* Auto, duty mode */
273 return true;
274 case 2: /* Auto, speed mode */
275 case 3: /* Manual, speed mode */
276 return false;
277 default:
278 BUG();
279 }
280}
281
282static bool auto_mode_enabled(u8 pwm_enable)
283{
284 switch (pwm_enable) {
285 case 0: /* Manual, duty mode (full speed) */
286 case 1: /* Manual, duty mode */
287 case 3: /* Manual, speed mode */
288 return false;
289 case 2: /* Auto, speed mode */
290 case 4: /* Auto, duty mode */
291 return true;
292 default:
293 BUG();
294 }
295}
296
257static ssize_t set_fan_min(struct device *dev, struct device_attribute *attr, 297static ssize_t set_fan_min(struct device *dev, struct device_attribute *attr,
258 const char *buf, size_t count) 298 const char *buf, size_t count)
259{ 299{
@@ -287,6 +327,11 @@ static ssize_t set_fan_target(struct device *dev, struct device_attribute *attr,
287 if (err < 0) 327 if (err < 0)
288 return err; 328 return err;
289 329
330 if (auto_mode_enabled(data->pwm_enable[nr]))
331 return -EINVAL;
332 if (data->kind == f75387 && duty_mode_enabled(data->pwm_enable[nr]))
333 return -EINVAL;
334
290 mutex_lock(&data->update_lock); 335 mutex_lock(&data->update_lock);
291 data->fan_target[nr] = rpm_to_reg(val); 336 data->fan_target[nr] = rpm_to_reg(val);
292 f75375_write16(client, F75375_REG_FAN_EXP(nr), data->fan_target[nr]); 337 f75375_write16(client, F75375_REG_FAN_EXP(nr), data->fan_target[nr]);
@@ -307,9 +352,13 @@ static ssize_t set_pwm(struct device *dev, struct device_attribute *attr,
307 if (err < 0) 352 if (err < 0)
308 return err; 353 return err;
309 354
355 if (auto_mode_enabled(data->pwm_enable[nr]) ||
356 !duty_mode_enabled(data->pwm_enable[nr]))
357 return -EINVAL;
358
310 mutex_lock(&data->update_lock); 359 mutex_lock(&data->update_lock);
311 data->pwm[nr] = SENSORS_LIMIT(val, 0, 255); 360 data->pwm[nr] = SENSORS_LIMIT(val, 0, 255);
312 f75375_write8(client, F75375_REG_FAN_PWM_DUTY(nr), data->pwm[nr]); 361 f75375_write_pwm(client, nr);
313 mutex_unlock(&data->update_lock); 362 mutex_unlock(&data->update_lock);
314 return count; 363 return count;
315} 364}
@@ -327,11 +376,15 @@ static int set_pwm_enable_direct(struct i2c_client *client, int nr, int val)
327 struct f75375_data *data = i2c_get_clientdata(client); 376 struct f75375_data *data = i2c_get_clientdata(client);
328 u8 fanmode; 377 u8 fanmode;
329 378
330 if (val < 0 || val > 3) 379 if (val < 0 || val > 4)
331 return -EINVAL; 380 return -EINVAL;
332 381
333 fanmode = f75375_read8(client, F75375_REG_FAN_TIMER); 382 fanmode = f75375_read8(client, F75375_REG_FAN_TIMER);
334 if (data->kind == f75387) { 383 if (data->kind == f75387) {
384 /* For now, deny dangerous toggling of duty mode */
385 if (duty_mode_enabled(data->pwm_enable[nr]) !=
386 duty_mode_enabled(val))
387 return -EOPNOTSUPP;
335 /* clear each fanX_mode bit before setting them properly */ 388 /* clear each fanX_mode bit before setting them properly */
336 fanmode &= ~(1 << F75387_FAN_DUTY_MODE(nr)); 389 fanmode &= ~(1 << F75387_FAN_DUTY_MODE(nr));
337 fanmode &= ~(1 << F75387_FAN_MANU_MODE(nr)); 390 fanmode &= ~(1 << F75387_FAN_MANU_MODE(nr));
@@ -345,12 +398,14 @@ static int set_pwm_enable_direct(struct i2c_client *client, int nr, int val)
345 fanmode |= (1 << F75387_FAN_MANU_MODE(nr)); 398 fanmode |= (1 << F75387_FAN_MANU_MODE(nr));
346 fanmode |= (1 << F75387_FAN_DUTY_MODE(nr)); 399 fanmode |= (1 << F75387_FAN_DUTY_MODE(nr));
347 break; 400 break;
348 case 2: /* AUTOMATIC*/ 401 case 2: /* Automatic, speed mode */
349 fanmode |= (1 << F75387_FAN_DUTY_MODE(nr));
350 break; 402 break;
351 case 3: /* fan speed */ 403 case 3: /* fan speed */
352 fanmode |= (1 << F75387_FAN_MANU_MODE(nr)); 404 fanmode |= (1 << F75387_FAN_MANU_MODE(nr));
353 break; 405 break;
406 case 4: /* Automatic, pwm */
407 fanmode |= (1 << F75387_FAN_DUTY_MODE(nr));
408 break;
354 } 409 }
355 } else { 410 } else {
356 /* clear each fanX_mode bit before setting them properly */ 411 /* clear each fanX_mode bit before setting them properly */
@@ -368,14 +423,15 @@ static int set_pwm_enable_direct(struct i2c_client *client, int nr, int val)
368 break; 423 break;
369 case 3: /* fan speed */ 424 case 3: /* fan speed */
370 break; 425 break;
426 case 4: /* Automatic pwm */
427 return -EINVAL;
371 } 428 }
372 } 429 }
373 430
374 f75375_write8(client, F75375_REG_FAN_TIMER, fanmode); 431 f75375_write8(client, F75375_REG_FAN_TIMER, fanmode);
375 data->pwm_enable[nr] = val; 432 data->pwm_enable[nr] = val;
376 if (val == 0) 433 if (val == 0)
377 f75375_write8(client, F75375_REG_FAN_PWM_DUTY(nr), 434 f75375_write_pwm(client, nr);
378 data->pwm[nr]);
379 return 0; 435 return 0;
380} 436}
381 437
@@ -726,14 +782,17 @@ static void f75375_init(struct i2c_client *client, struct f75375_data *data,
726 782
727 manu = ((mode >> F75387_FAN_MANU_MODE(nr)) & 1); 783 manu = ((mode >> F75387_FAN_MANU_MODE(nr)) & 1);
728 duty = ((mode >> F75387_FAN_DUTY_MODE(nr)) & 1); 784 duty = ((mode >> F75387_FAN_DUTY_MODE(nr)) & 1);
729 if (manu && duty) 785 if (!manu && duty)
730 /* speed */ 786 /* auto, pwm */
787 data->pwm_enable[nr] = 4;
788 else if (manu && !duty)
789 /* manual, speed */
731 data->pwm_enable[nr] = 3; 790 data->pwm_enable[nr] = 3;
732 else if (!manu && duty) 791 else if (!manu && !duty)
733 /* automatic */ 792 /* automatic, speed */
734 data->pwm_enable[nr] = 2; 793 data->pwm_enable[nr] = 2;
735 else 794 else
736 /* manual */ 795 /* manual, pwm */
737 data->pwm_enable[nr] = 1; 796 data->pwm_enable[nr] = 1;
738 } else { 797 } else {
739 if (!(conf & (1 << F75375_FAN_CTRL_LINEAR(nr)))) 798 if (!(conf & (1 << F75375_FAN_CTRL_LINEAR(nr))))
@@ -758,9 +817,11 @@ static void f75375_init(struct i2c_client *client, struct f75375_data *data,
758 set_pwm_enable_direct(client, 0, f75375s_pdata->pwm_enable[0]); 817 set_pwm_enable_direct(client, 0, f75375s_pdata->pwm_enable[0]);
759 set_pwm_enable_direct(client, 1, f75375s_pdata->pwm_enable[1]); 818 set_pwm_enable_direct(client, 1, f75375s_pdata->pwm_enable[1]);
760 for (nr = 0; nr < 2; nr++) { 819 for (nr = 0; nr < 2; nr++) {
820 if (auto_mode_enabled(f75375s_pdata->pwm_enable[nr]) ||
821 !duty_mode_enabled(f75375s_pdata->pwm_enable[nr]))
822 continue;
761 data->pwm[nr] = SENSORS_LIMIT(f75375s_pdata->pwm[nr], 0, 255); 823 data->pwm[nr] = SENSORS_LIMIT(f75375s_pdata->pwm[nr], 0, 255);
762 f75375_write8(client, F75375_REG_FAN_PWM_DUTY(nr), 824 f75375_write_pwm(client, nr);
763 data->pwm[nr]);
764 } 825 }
765 826
766} 827}
@@ -787,7 +848,7 @@ static int f75375_probe(struct i2c_client *client,
787 if (err) 848 if (err)
788 goto exit_free; 849 goto exit_free;
789 850
790 if (data->kind == f75375) { 851 if (data->kind != f75373) {
791 err = sysfs_chmod_file(&client->dev.kobj, 852 err = sysfs_chmod_file(&client->dev.kobj,
792 &sensor_dev_attr_pwm1_mode.dev_attr.attr, 853 &sensor_dev_attr_pwm1_mode.dev_attr.attr,
793 S_IRUGO | S_IWUSR); 854 S_IRUGO | S_IWUSR);
diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c
index 7e78f7c87857..3d471d56bf15 100644
--- a/drivers/i2c/busses/i2c-mxs.c
+++ b/drivers/i2c/busses/i2c-mxs.c
@@ -72,6 +72,7 @@
72 72
73#define MXS_I2C_QUEUESTAT (0x70) 73#define MXS_I2C_QUEUESTAT (0x70)
74#define MXS_I2C_QUEUESTAT_RD_QUEUE_EMPTY 0x00002000 74#define MXS_I2C_QUEUESTAT_RD_QUEUE_EMPTY 0x00002000
75#define MXS_I2C_QUEUESTAT_WRITE_QUEUE_CNT_MASK 0x0000001F
75 76
76#define MXS_I2C_QUEUECMD (0x80) 77#define MXS_I2C_QUEUECMD (0x80)
77 78
@@ -219,14 +220,14 @@ static int mxs_i2c_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg,
219 int ret; 220 int ret;
220 int flags; 221 int flags;
221 222
222 init_completion(&i2c->cmd_complete);
223
224 dev_dbg(i2c->dev, "addr: 0x%04x, len: %d, flags: 0x%x, stop: %d\n", 223 dev_dbg(i2c->dev, "addr: 0x%04x, len: %d, flags: 0x%x, stop: %d\n",
225 msg->addr, msg->len, msg->flags, stop); 224 msg->addr, msg->len, msg->flags, stop);
226 225
227 if (msg->len == 0) 226 if (msg->len == 0)
228 return -EINVAL; 227 return -EINVAL;
229 228
229 init_completion(&i2c->cmd_complete);
230
230 flags = stop ? MXS_I2C_CTRL0_POST_SEND_STOP : 0; 231 flags = stop ? MXS_I2C_CTRL0_POST_SEND_STOP : 0;
231 232
232 if (msg->flags & I2C_M_RD) 233 if (msg->flags & I2C_M_RD)
@@ -286,6 +287,7 @@ static irqreturn_t mxs_i2c_isr(int this_irq, void *dev_id)
286{ 287{
287 struct mxs_i2c_dev *i2c = dev_id; 288 struct mxs_i2c_dev *i2c = dev_id;
288 u32 stat = readl(i2c->regs + MXS_I2C_CTRL1) & MXS_I2C_IRQ_MASK; 289 u32 stat = readl(i2c->regs + MXS_I2C_CTRL1) & MXS_I2C_IRQ_MASK;
290 bool is_last_cmd;
289 291
290 if (!stat) 292 if (!stat)
291 return IRQ_NONE; 293 return IRQ_NONE;
@@ -300,9 +302,14 @@ static irqreturn_t mxs_i2c_isr(int this_irq, void *dev_id)
300 else 302 else
301 i2c->cmd_err = 0; 303 i2c->cmd_err = 0;
302 304
303 complete(&i2c->cmd_complete); 305 is_last_cmd = (readl(i2c->regs + MXS_I2C_QUEUESTAT) &
306 MXS_I2C_QUEUESTAT_WRITE_QUEUE_CNT_MASK) == 0;
307
308 if (is_last_cmd || i2c->cmd_err)
309 complete(&i2c->cmd_complete);
304 310
305 writel(stat, i2c->regs + MXS_I2C_CTRL1_CLR); 311 writel(stat, i2c->regs + MXS_I2C_CTRL1_CLR);
312
306 return IRQ_HANDLED; 313 return IRQ_HANDLED;
307} 314}
308 315
diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
index d60364650990..f6733267fa9c 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
@@ -29,6 +29,8 @@
29#include <linux/errno.h> 29#include <linux/errno.h>
30#include <linux/interrupt.h> 30#include <linux/interrupt.h>
31#include <linux/i2c-pxa.h> 31#include <linux/i2c-pxa.h>
32#include <linux/of.h>
33#include <linux/of_device.h>
32#include <linux/of_i2c.h> 34#include <linux/of_i2c.h>
33#include <linux/platform_device.h> 35#include <linux/platform_device.h>
34#include <linux/err.h> 36#include <linux/err.h>
@@ -1044,23 +1046,60 @@ static const struct i2c_algorithm i2c_pxa_pio_algorithm = {
1044 .functionality = i2c_pxa_functionality, 1046 .functionality = i2c_pxa_functionality,
1045}; 1047};
1046 1048
1047static int i2c_pxa_probe(struct platform_device *dev) 1049static struct of_device_id i2c_pxa_dt_ids[] = {
1050 { .compatible = "mrvl,pxa-i2c", .data = (void *)REGS_PXA2XX },
1051 { .compatible = "mrvl,pwri2c", .data = (void *)REGS_PXA3XX },
1052 { .compatible = "mrvl,mmp-twsi", .data = (void *)REGS_PXA2XX },
1053 {}
1054};
1055MODULE_DEVICE_TABLE(of, i2c_pxa_dt_ids);
1056
1057static int i2c_pxa_probe_dt(struct platform_device *pdev, struct pxa_i2c *i2c,
1058 enum pxa_i2c_types *i2c_types)
1048{ 1059{
1049 struct pxa_i2c *i2c; 1060 struct device_node *np = pdev->dev.of_node;
1050 struct resource *res; 1061 const struct of_device_id *of_id =
1051 struct i2c_pxa_platform_data *plat = dev->dev.platform_data; 1062 of_match_device(i2c_pxa_dt_ids, &pdev->dev);
1052 const struct platform_device_id *id = platform_get_device_id(dev);
1053 enum pxa_i2c_types i2c_type = id->driver_data;
1054 int ret; 1063 int ret;
1055 int irq;
1056 1064
1057 res = platform_get_resource(dev, IORESOURCE_MEM, 0); 1065 if (!of_id)
1058 irq = platform_get_irq(dev, 0); 1066 return 1;
1059 if (res == NULL || irq < 0) 1067 ret = of_alias_get_id(np, "i2c");
1060 return -ENODEV; 1068 if (ret < 0) {
1069 dev_err(&pdev->dev, "failed to get alias id, errno %d\n", ret);
1070 return ret;
1071 }
1072 pdev->id = ret;
1073 if (of_get_property(np, "mrvl,i2c-polling", NULL))
1074 i2c->use_pio = 1;
1075 if (of_get_property(np, "mrvl,i2c-fast-mode", NULL))
1076 i2c->fast_mode = 1;
1077 *i2c_types = (u32)(of_id->data);
1078 return 0;
1079}
1061 1080
1062 if (!request_mem_region(res->start, resource_size(res), res->name)) 1081static int i2c_pxa_probe_pdata(struct platform_device *pdev,
1063 return -ENOMEM; 1082 struct pxa_i2c *i2c,
1083 enum pxa_i2c_types *i2c_types)
1084{
1085 struct i2c_pxa_platform_data *plat = pdev->dev.platform_data;
1086 const struct platform_device_id *id = platform_get_device_id(pdev);
1087
1088 *i2c_types = id->driver_data;
1089 if (plat) {
1090 i2c->use_pio = plat->use_pio;
1091 i2c->fast_mode = plat->fast_mode;
1092 }
1093 return 0;
1094}
1095
1096static int i2c_pxa_probe(struct platform_device *dev)
1097{
1098 struct i2c_pxa_platform_data *plat = dev->dev.platform_data;
1099 enum pxa_i2c_types i2c_type;
1100 struct pxa_i2c *i2c;
1101 struct resource *res = NULL;
1102 int ret, irq;
1064 1103
1065 i2c = kzalloc(sizeof(struct pxa_i2c), GFP_KERNEL); 1104 i2c = kzalloc(sizeof(struct pxa_i2c), GFP_KERNEL);
1066 if (!i2c) { 1105 if (!i2c) {
@@ -1068,6 +1107,24 @@ static int i2c_pxa_probe(struct platform_device *dev)
1068 goto emalloc; 1107 goto emalloc;
1069 } 1108 }
1070 1109
1110 ret = i2c_pxa_probe_dt(dev, i2c, &i2c_type);
1111 if (ret > 0)
1112 ret = i2c_pxa_probe_pdata(dev, i2c, &i2c_type);
1113 if (ret < 0)
1114 goto eclk;
1115
1116 res = platform_get_resource(dev, IORESOURCE_MEM, 0);
1117 irq = platform_get_irq(dev, 0);
1118 if (res == NULL || irq < 0) {
1119 ret = -ENODEV;
1120 goto eclk;
1121 }
1122
1123 if (!request_mem_region(res->start, resource_size(res), res->name)) {
1124 ret = -ENOMEM;
1125 goto eclk;
1126 }
1127
1071 i2c->adap.owner = THIS_MODULE; 1128 i2c->adap.owner = THIS_MODULE;
1072 i2c->adap.retries = 5; 1129 i2c->adap.retries = 5;
1073 1130
@@ -1109,21 +1166,16 @@ static int i2c_pxa_probe(struct platform_device *dev)
1109 1166
1110 i2c->slave_addr = I2C_PXA_SLAVE_ADDR; 1167 i2c->slave_addr = I2C_PXA_SLAVE_ADDR;
1111 1168
1112#ifdef CONFIG_I2C_PXA_SLAVE
1113 if (plat) { 1169 if (plat) {
1170#ifdef CONFIG_I2C_PXA_SLAVE
1114 i2c->slave_addr = plat->slave_addr; 1171 i2c->slave_addr = plat->slave_addr;
1115 i2c->slave = plat->slave; 1172 i2c->slave = plat->slave;
1116 }
1117#endif 1173#endif
1118
1119 clk_enable(i2c->clk);
1120
1121 if (plat) {
1122 i2c->adap.class = plat->class; 1174 i2c->adap.class = plat->class;
1123 i2c->use_pio = plat->use_pio;
1124 i2c->fast_mode = plat->fast_mode;
1125 } 1175 }
1126 1176
1177 clk_enable(i2c->clk);
1178
1127 if (i2c->use_pio) { 1179 if (i2c->use_pio) {
1128 i2c->adap.algo = &i2c_pxa_pio_algorithm; 1180 i2c->adap.algo = &i2c_pxa_pio_algorithm;
1129 } else { 1181 } else {
@@ -1234,6 +1286,7 @@ static struct platform_driver i2c_pxa_driver = {
1234 .name = "pxa2xx-i2c", 1286 .name = "pxa2xx-i2c",
1235 .owner = THIS_MODULE, 1287 .owner = THIS_MODULE,
1236 .pm = I2C_PXA_DEV_PM_OPS, 1288 .pm = I2C_PXA_DEV_PM_OPS,
1289 .of_match_table = i2c_pxa_dt_ids,
1237 }, 1290 },
1238 .id_table = i2c_pxa_id_table, 1291 .id_table = i2c_pxa_id_table,
1239}; 1292};
diff --git a/drivers/iommu/omap-iommu-debug.c b/drivers/iommu/omap-iommu-debug.c
index 288da5c1499d..103dbd92e256 100644
--- a/drivers/iommu/omap-iommu-debug.c
+++ b/drivers/iommu/omap-iommu-debug.c
@@ -44,7 +44,8 @@ static ssize_t debug_read_ver(struct file *file, char __user *userbuf,
44static ssize_t debug_read_regs(struct file *file, char __user *userbuf, 44static ssize_t debug_read_regs(struct file *file, char __user *userbuf,
45 size_t count, loff_t *ppos) 45 size_t count, loff_t *ppos)
46{ 46{
47 struct omap_iommu *obj = file->private_data; 47 struct device *dev = file->private_data;
48 struct omap_iommu *obj = dev_to_omap_iommu(dev);
48 char *p, *buf; 49 char *p, *buf;
49 ssize_t bytes; 50 ssize_t bytes;
50 51
@@ -67,7 +68,8 @@ static ssize_t debug_read_regs(struct file *file, char __user *userbuf,
67static ssize_t debug_read_tlb(struct file *file, char __user *userbuf, 68static ssize_t debug_read_tlb(struct file *file, char __user *userbuf,
68 size_t count, loff_t *ppos) 69 size_t count, loff_t *ppos)
69{ 70{
70 struct omap_iommu *obj = file->private_data; 71 struct device *dev = file->private_data;
72 struct omap_iommu *obj = dev_to_omap_iommu(dev);
71 char *p, *buf; 73 char *p, *buf;
72 ssize_t bytes, rest; 74 ssize_t bytes, rest;
73 75
@@ -97,7 +99,8 @@ static ssize_t debug_write_pagetable(struct file *file,
97 struct iotlb_entry e; 99 struct iotlb_entry e;
98 struct cr_regs cr; 100 struct cr_regs cr;
99 int err; 101 int err;
100 struct omap_iommu *obj = file->private_data; 102 struct device *dev = file->private_data;
103 struct omap_iommu *obj = dev_to_omap_iommu(dev);
101 char buf[MAXCOLUMN], *p = buf; 104 char buf[MAXCOLUMN], *p = buf;
102 105
103 count = min(count, sizeof(buf)); 106 count = min(count, sizeof(buf));
@@ -184,7 +187,8 @@ out:
184static ssize_t debug_read_pagetable(struct file *file, char __user *userbuf, 187static ssize_t debug_read_pagetable(struct file *file, char __user *userbuf,
185 size_t count, loff_t *ppos) 188 size_t count, loff_t *ppos)
186{ 189{
187 struct omap_iommu *obj = file->private_data; 190 struct device *dev = file->private_data;
191 struct omap_iommu *obj = dev_to_omap_iommu(dev);
188 char *p, *buf; 192 char *p, *buf;
189 size_t bytes; 193 size_t bytes;
190 194
@@ -212,7 +216,8 @@ static ssize_t debug_read_pagetable(struct file *file, char __user *userbuf,
212static ssize_t debug_read_mmap(struct file *file, char __user *userbuf, 216static ssize_t debug_read_mmap(struct file *file, char __user *userbuf,
213 size_t count, loff_t *ppos) 217 size_t count, loff_t *ppos)
214{ 218{
215 struct omap_iommu *obj = file->private_data; 219 struct device *dev = file->private_data;
220 struct omap_iommu *obj = dev_to_omap_iommu(dev);
216 char *p, *buf; 221 char *p, *buf;
217 struct iovm_struct *tmp; 222 struct iovm_struct *tmp;
218 int uninitialized_var(i); 223 int uninitialized_var(i);
@@ -254,7 +259,7 @@ static ssize_t debug_read_mmap(struct file *file, char __user *userbuf,
254static ssize_t debug_read_mem(struct file *file, char __user *userbuf, 259static ssize_t debug_read_mem(struct file *file, char __user *userbuf,
255 size_t count, loff_t *ppos) 260 size_t count, loff_t *ppos)
256{ 261{
257 struct omap_iommu *obj = file->private_data; 262 struct device *dev = file->private_data;
258 char *p, *buf; 263 char *p, *buf;
259 struct iovm_struct *area; 264 struct iovm_struct *area;
260 ssize_t bytes; 265 ssize_t bytes;
@@ -268,8 +273,8 @@ static ssize_t debug_read_mem(struct file *file, char __user *userbuf,
268 273
269 mutex_lock(&iommu_debug_lock); 274 mutex_lock(&iommu_debug_lock);
270 275
271 area = omap_find_iovm_area(obj, (u32)ppos); 276 area = omap_find_iovm_area(dev, (u32)ppos);
272 if (IS_ERR(area)) { 277 if (!area) {
273 bytes = -EINVAL; 278 bytes = -EINVAL;
274 goto err_out; 279 goto err_out;
275 } 280 }
@@ -287,7 +292,7 @@ err_out:
287static ssize_t debug_write_mem(struct file *file, const char __user *userbuf, 292static ssize_t debug_write_mem(struct file *file, const char __user *userbuf,
288 size_t count, loff_t *ppos) 293 size_t count, loff_t *ppos)
289{ 294{
290 struct omap_iommu *obj = file->private_data; 295 struct device *dev = file->private_data;
291 struct iovm_struct *area; 296 struct iovm_struct *area;
292 char *p, *buf; 297 char *p, *buf;
293 298
@@ -305,8 +310,8 @@ static ssize_t debug_write_mem(struct file *file, const char __user *userbuf,
305 goto err_out; 310 goto err_out;
306 } 311 }
307 312
308 area = omap_find_iovm_area(obj, (u32)ppos); 313 area = omap_find_iovm_area(dev, (u32)ppos);
309 if (IS_ERR(area)) { 314 if (!area) {
310 count = -EINVAL; 315 count = -EINVAL;
311 goto err_out; 316 goto err_out;
312 } 317 }
@@ -350,7 +355,7 @@ DEBUG_FOPS(mem);
350 { \ 355 { \
351 struct dentry *dent; \ 356 struct dentry *dent; \
352 dent = debugfs_create_file(#attr, mode, parent, \ 357 dent = debugfs_create_file(#attr, mode, parent, \
353 obj, &debug_##attr##_fops); \ 358 dev, &debug_##attr##_fops); \
354 if (!dent) \ 359 if (!dent) \
355 return -ENOMEM; \ 360 return -ENOMEM; \
356 } 361 }
@@ -362,20 +367,29 @@ static int iommu_debug_register(struct device *dev, void *data)
362{ 367{
363 struct platform_device *pdev = to_platform_device(dev); 368 struct platform_device *pdev = to_platform_device(dev);
364 struct omap_iommu *obj = platform_get_drvdata(pdev); 369 struct omap_iommu *obj = platform_get_drvdata(pdev);
370 struct omap_iommu_arch_data *arch_data;
365 struct dentry *d, *parent; 371 struct dentry *d, *parent;
366 372
367 if (!obj || !obj->dev) 373 if (!obj || !obj->dev)
368 return -EINVAL; 374 return -EINVAL;
369 375
376 arch_data = kzalloc(sizeof(*arch_data), GFP_KERNEL);
377 if (!arch_data)
378 return -ENOMEM;
379
380 arch_data->iommu_dev = obj;
381
382 dev->archdata.iommu = arch_data;
383
370 d = debugfs_create_dir(obj->name, iommu_debug_root); 384 d = debugfs_create_dir(obj->name, iommu_debug_root);
371 if (!d) 385 if (!d)
372 return -ENOMEM; 386 goto nomem;
373 parent = d; 387 parent = d;
374 388
375 d = debugfs_create_u8("nr_tlb_entries", 400, parent, 389 d = debugfs_create_u8("nr_tlb_entries", 400, parent,
376 (u8 *)&obj->nr_tlb_entries); 390 (u8 *)&obj->nr_tlb_entries);
377 if (!d) 391 if (!d)
378 return -ENOMEM; 392 goto nomem;
379 393
380 DEBUG_ADD_FILE_RO(ver); 394 DEBUG_ADD_FILE_RO(ver);
381 DEBUG_ADD_FILE_RO(regs); 395 DEBUG_ADD_FILE_RO(regs);
@@ -385,6 +399,22 @@ static int iommu_debug_register(struct device *dev, void *data)
385 DEBUG_ADD_FILE(mem); 399 DEBUG_ADD_FILE(mem);
386 400
387 return 0; 401 return 0;
402
403nomem:
404 kfree(arch_data);
405 return -ENOMEM;
406}
407
408static int iommu_debug_unregister(struct device *dev, void *data)
409{
410 if (!dev->archdata.iommu)
411 return 0;
412
413 kfree(dev->archdata.iommu);
414
415 dev->archdata.iommu = NULL;
416
417 return 0;
388} 418}
389 419
390static int __init iommu_debug_init(void) 420static int __init iommu_debug_init(void)
@@ -411,6 +441,7 @@ module_init(iommu_debug_init)
411static void __exit iommu_debugfs_exit(void) 441static void __exit iommu_debugfs_exit(void)
412{ 442{
413 debugfs_remove_recursive(iommu_debug_root); 443 debugfs_remove_recursive(iommu_debug_root);
444 omap_foreach_iommu_device(NULL, iommu_debug_unregister);
414} 445}
415module_exit(iommu_debugfs_exit) 446module_exit(iommu_debugfs_exit)
416 447
diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c
index d8edd979d01b..6899dcd02dfa 100644
--- a/drivers/iommu/omap-iommu.c
+++ b/drivers/iommu/omap-iommu.c
@@ -1223,7 +1223,8 @@ static int __init omap_iommu_init(void)
1223 1223
1224 return platform_driver_register(&omap_iommu_driver); 1224 return platform_driver_register(&omap_iommu_driver);
1225} 1225}
1226module_init(omap_iommu_init); 1226/* must be ready before omap3isp is probed */
1227subsys_initcall(omap_iommu_init);
1227 1228
1228static void __exit omap_iommu_exit(void) 1229static void __exit omap_iommu_exit(void)
1229{ 1230{
diff --git a/drivers/net/can/sja1000/sja1000.c b/drivers/net/can/sja1000/sja1000.c
index 04a3f1b756a8..192b0d118df4 100644
--- a/drivers/net/can/sja1000/sja1000.c
+++ b/drivers/net/can/sja1000/sja1000.c
@@ -95,11 +95,16 @@ static void sja1000_write_cmdreg(struct sja1000_priv *priv, u8 val)
95 spin_unlock_irqrestore(&priv->cmdreg_lock, flags); 95 spin_unlock_irqrestore(&priv->cmdreg_lock, flags);
96} 96}
97 97
98static int sja1000_is_absent(struct sja1000_priv *priv)
99{
100 return (priv->read_reg(priv, REG_MOD) == 0xFF);
101}
102
98static int sja1000_probe_chip(struct net_device *dev) 103static int sja1000_probe_chip(struct net_device *dev)
99{ 104{
100 struct sja1000_priv *priv = netdev_priv(dev); 105 struct sja1000_priv *priv = netdev_priv(dev);
101 106
102 if (priv->reg_base && (priv->read_reg(priv, 0) == 0xFF)) { 107 if (priv->reg_base && sja1000_is_absent(priv)) {
103 printk(KERN_INFO "%s: probing @0x%lX failed\n", 108 printk(KERN_INFO "%s: probing @0x%lX failed\n",
104 DRV_NAME, dev->base_addr); 109 DRV_NAME, dev->base_addr);
105 return 0; 110 return 0;
@@ -493,6 +498,9 @@ irqreturn_t sja1000_interrupt(int irq, void *dev_id)
493 while ((isrc = priv->read_reg(priv, REG_IR)) && (n < SJA1000_MAX_IRQ)) { 498 while ((isrc = priv->read_reg(priv, REG_IR)) && (n < SJA1000_MAX_IRQ)) {
494 n++; 499 n++;
495 status = priv->read_reg(priv, REG_SR); 500 status = priv->read_reg(priv, REG_SR);
501 /* check for absent controller due to hw unplug */
502 if (status == 0xFF && sja1000_is_absent(priv))
503 return IRQ_NONE;
496 504
497 if (isrc & IRQ_WUI) 505 if (isrc & IRQ_WUI)
498 dev_warn(dev->dev.parent, "wakeup interrupt\n"); 506 dev_warn(dev->dev.parent, "wakeup interrupt\n");
@@ -509,6 +517,9 @@ irqreturn_t sja1000_interrupt(int irq, void *dev_id)
509 while (status & SR_RBS) { 517 while (status & SR_RBS) {
510 sja1000_rx(dev); 518 sja1000_rx(dev);
511 status = priv->read_reg(priv, REG_SR); 519 status = priv->read_reg(priv, REG_SR);
520 /* check for absent controller */
521 if (status == 0xFF && sja1000_is_absent(priv))
522 return IRQ_NONE;
512 } 523 }
513 } 524 }
514 if (isrc & (IRQ_DOI | IRQ_EI | IRQ_BEI | IRQ_EPI | IRQ_ALI)) { 525 if (isrc & (IRQ_DOI | IRQ_EI | IRQ_BEI | IRQ_EPI | IRQ_ALI)) {
diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
index b8591246eb4c..1ff3c6df35a2 100644
--- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
+++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
@@ -2244,10 +2244,6 @@ static netdev_tx_t atl1c_xmit_frame(struct sk_buff *skb,
2244 dev_info(&adapter->pdev->dev, "tx locked\n"); 2244 dev_info(&adapter->pdev->dev, "tx locked\n");
2245 return NETDEV_TX_LOCKED; 2245 return NETDEV_TX_LOCKED;
2246 } 2246 }
2247 if (skb->mark == 0x01)
2248 type = atl1c_trans_high;
2249 else
2250 type = atl1c_trans_normal;
2251 2247
2252 if (atl1c_tpd_avail(adapter, type) < tpd_req) { 2248 if (atl1c_tpd_avail(adapter, type) < tpd_req) {
2253 /* no enough descriptor, just stop queue */ 2249 /* no enough descriptor, just stop queue */
diff --git a/drivers/net/ethernet/broadcom/b44.c b/drivers/net/ethernet/broadcom/b44.c
index 3fb66d09ece5..cab87456a34a 100644
--- a/drivers/net/ethernet/broadcom/b44.c
+++ b/drivers/net/ethernet/broadcom/b44.c
@@ -2339,7 +2339,7 @@ static inline int __init b44_pci_init(void)
2339 return err; 2339 return err;
2340} 2340}
2341 2341
2342static inline void __exit b44_pci_exit(void) 2342static inline void b44_pci_exit(void)
2343{ 2343{
2344#ifdef CONFIG_B44_PCI 2344#ifdef CONFIG_B44_PCI
2345 ssb_pcihost_unregister(&b44_pci_driver); 2345 ssb_pcihost_unregister(&b44_pci_driver);
diff --git a/drivers/net/ethernet/broadcom/cnic.c b/drivers/net/ethernet/broadcom/cnic.c
index dd3a0a232ea0..818a573669e6 100644
--- a/drivers/net/ethernet/broadcom/cnic.c
+++ b/drivers/net/ethernet/broadcom/cnic.c
@@ -3584,7 +3584,11 @@ static int cnic_get_v6_route(struct sockaddr_in6 *dst_addr,
3584 fl6.flowi6_oif = dst_addr->sin6_scope_id; 3584 fl6.flowi6_oif = dst_addr->sin6_scope_id;
3585 3585
3586 *dst = ip6_route_output(&init_net, NULL, &fl6); 3586 *dst = ip6_route_output(&init_net, NULL, &fl6);
3587 if (*dst) 3587 if ((*dst)->error) {
3588 dst_release(*dst);
3589 *dst = NULL;
3590 return -ENETUNREACH;
3591 } else
3588 return 0; 3592 return 0;
3589#endif 3593#endif
3590 3594
diff --git a/drivers/net/ethernet/cisco/enic/cq_enet_desc.h b/drivers/net/ethernet/cisco/enic/cq_enet_desc.h
index c2c0680a1146..ac37cacc6136 100644
--- a/drivers/net/ethernet/cisco/enic/cq_enet_desc.h
+++ b/drivers/net/ethernet/cisco/enic/cq_enet_desc.h
@@ -157,7 +157,7 @@ static inline void cq_enet_rq_desc_dec(struct cq_enet_rq_desc *desc,
157 CQ_ENET_RQ_DESC_FCOE_FC_CRC_OK) ? 1 : 0; 157 CQ_ENET_RQ_DESC_FCOE_FC_CRC_OK) ? 1 : 0;
158 *fcoe_enc_error = (desc->flags & 158 *fcoe_enc_error = (desc->flags &
159 CQ_ENET_RQ_DESC_FCOE_ENC_ERROR) ? 1 : 0; 159 CQ_ENET_RQ_DESC_FCOE_ENC_ERROR) ? 1 : 0;
160 *fcoe_eof = (u8)((desc->checksum_fcoe >> 160 *fcoe_eof = (u8)((le16_to_cpu(desc->checksum_fcoe) >>
161 CQ_ENET_RQ_DESC_FCOE_EOF_SHIFT) & 161 CQ_ENET_RQ_DESC_FCOE_EOF_SHIFT) &
162 CQ_ENET_RQ_DESC_FCOE_EOF_MASK); 162 CQ_ENET_RQ_DESC_FCOE_EOF_MASK);
163 *checksum = 0; 163 *checksum = 0;
diff --git a/drivers/net/ethernet/cisco/enic/enic_pp.c b/drivers/net/ethernet/cisco/enic/enic_pp.c
index 22bf03a1829e..c347b6236f8f 100644
--- a/drivers/net/ethernet/cisco/enic/enic_pp.c
+++ b/drivers/net/ethernet/cisco/enic/enic_pp.c
@@ -72,7 +72,7 @@ static int enic_set_port_profile(struct enic *enic, int vf)
72 struct enic_port_profile *pp; 72 struct enic_port_profile *pp;
73 struct vic_provinfo *vp; 73 struct vic_provinfo *vp;
74 const u8 oui[3] = VIC_PROVINFO_CISCO_OUI; 74 const u8 oui[3] = VIC_PROVINFO_CISCO_OUI;
75 const u16 os_type = htons(VIC_GENERIC_PROV_OS_TYPE_LINUX); 75 const __be16 os_type = htons(VIC_GENERIC_PROV_OS_TYPE_LINUX);
76 char uuid_str[38]; 76 char uuid_str[38];
77 char client_mac_str[18]; 77 char client_mac_str[18];
78 u8 *client_mac; 78 u8 *client_mac;
diff --git a/drivers/net/ethernet/jme.c b/drivers/net/ethernet/jme.c
index 27d651a80f3f..55cbf65512c3 100644
--- a/drivers/net/ethernet/jme.c
+++ b/drivers/net/ethernet/jme.c
@@ -2328,19 +2328,11 @@ jme_change_mtu(struct net_device *netdev, int new_mtu)
2328 ((new_mtu) < IPV6_MIN_MTU)) 2328 ((new_mtu) < IPV6_MIN_MTU))
2329 return -EINVAL; 2329 return -EINVAL;
2330 2330
2331 if (new_mtu > 4000) {
2332 jme->reg_rxcs &= ~RXCS_FIFOTHNP;
2333 jme->reg_rxcs |= RXCS_FIFOTHNP_64QW;
2334 jme_restart_rx_engine(jme);
2335 } else {
2336 jme->reg_rxcs &= ~RXCS_FIFOTHNP;
2337 jme->reg_rxcs |= RXCS_FIFOTHNP_128QW;
2338 jme_restart_rx_engine(jme);
2339 }
2340 2331
2341 netdev->mtu = new_mtu; 2332 netdev->mtu = new_mtu;
2342 netdev_update_features(netdev); 2333 netdev_update_features(netdev);
2343 2334
2335 jme_restart_rx_engine(jme);
2344 jme_reset_link(jme); 2336 jme_reset_link(jme);
2345 2337
2346 return 0; 2338 return 0;
diff --git a/drivers/net/ethernet/jme.h b/drivers/net/ethernet/jme.h
index 4304072bd3c5..3efc897c9913 100644
--- a/drivers/net/ethernet/jme.h
+++ b/drivers/net/ethernet/jme.h
@@ -730,7 +730,7 @@ enum jme_rxcs_values {
730 RXCS_RETRYCNT_60 = 0x00000F00, 730 RXCS_RETRYCNT_60 = 0x00000F00,
731 731
732 RXCS_DEFAULT = RXCS_FIFOTHTP_128T | 732 RXCS_DEFAULT = RXCS_FIFOTHTP_128T |
733 RXCS_FIFOTHNP_128QW | 733 RXCS_FIFOTHNP_16QW |
734 RXCS_DMAREQSZ_128B | 734 RXCS_DMAREQSZ_128B |
735 RXCS_RETRYGAP_256ns | 735 RXCS_RETRYGAP_256ns |
736 RXCS_RETRYCNT_32, 736 RXCS_RETRYCNT_32,
diff --git a/drivers/net/ethernet/mellanox/mlx4/eq.c b/drivers/net/ethernet/mellanox/mlx4/eq.c
index 8fa41f3082cf..9129ace02560 100644
--- a/drivers/net/ethernet/mellanox/mlx4/eq.c
+++ b/drivers/net/ethernet/mellanox/mlx4/eq.c
@@ -1036,7 +1036,7 @@ int mlx4_assign_eq(struct mlx4_dev *dev, char* name, int * vector)
1036 struct mlx4_priv *priv = mlx4_priv(dev); 1036 struct mlx4_priv *priv = mlx4_priv(dev);
1037 int vec = 0, err = 0, i; 1037 int vec = 0, err = 0, i;
1038 1038
1039 spin_lock(&priv->msix_ctl.pool_lock); 1039 mutex_lock(&priv->msix_ctl.pool_lock);
1040 for (i = 0; !vec && i < dev->caps.comp_pool; i++) { 1040 for (i = 0; !vec && i < dev->caps.comp_pool; i++) {
1041 if (~priv->msix_ctl.pool_bm & 1ULL << i) { 1041 if (~priv->msix_ctl.pool_bm & 1ULL << i) {
1042 priv->msix_ctl.pool_bm |= 1ULL << i; 1042 priv->msix_ctl.pool_bm |= 1ULL << i;
@@ -1058,7 +1058,7 @@ int mlx4_assign_eq(struct mlx4_dev *dev, char* name, int * vector)
1058 eq_set_ci(&priv->eq_table.eq[vec], 1); 1058 eq_set_ci(&priv->eq_table.eq[vec], 1);
1059 } 1059 }
1060 } 1060 }
1061 spin_unlock(&priv->msix_ctl.pool_lock); 1061 mutex_unlock(&priv->msix_ctl.pool_lock);
1062 1062
1063 if (vec) { 1063 if (vec) {
1064 *vector = vec; 1064 *vector = vec;
@@ -1079,13 +1079,13 @@ void mlx4_release_eq(struct mlx4_dev *dev, int vec)
1079 if (likely(i >= 0)) { 1079 if (likely(i >= 0)) {
1080 /*sanity check , making sure were not trying to free irq's 1080 /*sanity check , making sure were not trying to free irq's
1081 Belonging to a legacy EQ*/ 1081 Belonging to a legacy EQ*/
1082 spin_lock(&priv->msix_ctl.pool_lock); 1082 mutex_lock(&priv->msix_ctl.pool_lock);
1083 if (priv->msix_ctl.pool_bm & 1ULL << i) { 1083 if (priv->msix_ctl.pool_bm & 1ULL << i) {
1084 free_irq(priv->eq_table.eq[vec].irq, 1084 free_irq(priv->eq_table.eq[vec].irq,
1085 &priv->eq_table.eq[vec]); 1085 &priv->eq_table.eq[vec]);
1086 priv->msix_ctl.pool_bm &= ~(1ULL << i); 1086 priv->msix_ctl.pool_bm &= ~(1ULL << i);
1087 } 1087 }
1088 spin_unlock(&priv->msix_ctl.pool_lock); 1088 mutex_unlock(&priv->msix_ctl.pool_lock);
1089 } 1089 }
1090 1090
1091} 1091}
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
index 678558b502fc..d498f049c74e 100644
--- a/drivers/net/ethernet/mellanox/mlx4/main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/main.c
@@ -531,15 +531,14 @@ int mlx4_change_port_types(struct mlx4_dev *dev,
531 for (port = 0; port < dev->caps.num_ports; port++) { 531 for (port = 0; port < dev->caps.num_ports; port++) {
532 /* Change the port type only if the new type is different 532 /* Change the port type only if the new type is different
533 * from the current, and not set to Auto */ 533 * from the current, and not set to Auto */
534 if (port_types[port] != dev->caps.port_type[port + 1]) { 534 if (port_types[port] != dev->caps.port_type[port + 1])
535 change = 1; 535 change = 1;
536 dev->caps.port_type[port + 1] = port_types[port];
537 }
538 } 536 }
539 if (change) { 537 if (change) {
540 mlx4_unregister_device(dev); 538 mlx4_unregister_device(dev);
541 for (port = 1; port <= dev->caps.num_ports; port++) { 539 for (port = 1; port <= dev->caps.num_ports; port++) {
542 mlx4_CLOSE_PORT(dev, port); 540 mlx4_CLOSE_PORT(dev, port);
541 dev->caps.port_type[port] = port_types[port - 1];
543 err = mlx4_SET_PORT(dev, port); 542 err = mlx4_SET_PORT(dev, port);
544 if (err) { 543 if (err) {
545 mlx4_err(dev, "Failed to set port %d, " 544 mlx4_err(dev, "Failed to set port %d, "
@@ -986,6 +985,9 @@ static int map_bf_area(struct mlx4_dev *dev)
986 resource_size_t bf_len; 985 resource_size_t bf_len;
987 int err = 0; 986 int err = 0;
988 987
988 if (!dev->caps.bf_reg_size)
989 return -ENXIO;
990
989 bf_start = pci_resource_start(dev->pdev, 2) + 991 bf_start = pci_resource_start(dev->pdev, 2) +
990 (dev->caps.num_uars << PAGE_SHIFT); 992 (dev->caps.num_uars << PAGE_SHIFT);
991 bf_len = pci_resource_len(dev->pdev, 2) - 993 bf_len = pci_resource_len(dev->pdev, 2) -
@@ -1825,7 +1827,7 @@ slave_start:
1825 goto err_master_mfunc; 1827 goto err_master_mfunc;
1826 1828
1827 priv->msix_ctl.pool_bm = 0; 1829 priv->msix_ctl.pool_bm = 0;
1828 spin_lock_init(&priv->msix_ctl.pool_lock); 1830 mutex_init(&priv->msix_ctl.pool_lock);
1829 1831
1830 mlx4_enable_msi_x(dev); 1832 mlx4_enable_msi_x(dev);
1831 if ((mlx4_is_mfunc(dev)) && 1833 if ((mlx4_is_mfunc(dev)) &&
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4.h b/drivers/net/ethernet/mellanox/mlx4/mlx4.h
index c92269f8c057..28f8251561f4 100644
--- a/drivers/net/ethernet/mellanox/mlx4/mlx4.h
+++ b/drivers/net/ethernet/mellanox/mlx4/mlx4.h
@@ -697,7 +697,7 @@ struct mlx4_sense {
697 697
698struct mlx4_msix_ctl { 698struct mlx4_msix_ctl {
699 u64 pool_bm; 699 u64 pool_bm;
700 spinlock_t pool_lock; 700 struct mutex pool_lock;
701}; 701};
702 702
703struct mlx4_steer { 703struct mlx4_steer {
diff --git a/drivers/net/ethernet/micrel/ks8851_mll.c b/drivers/net/ethernet/micrel/ks8851_mll.c
index 231176fcd2ba..2784bc706f1e 100644
--- a/drivers/net/ethernet/micrel/ks8851_mll.c
+++ b/drivers/net/ethernet/micrel/ks8851_mll.c
@@ -1545,7 +1545,7 @@ static int __devinit ks8851_probe(struct platform_device *pdev)
1545 1545
1546 netdev->irq = platform_get_irq(pdev, 0); 1546 netdev->irq = platform_get_irq(pdev, 0);
1547 1547
1548 if (netdev->irq < 0) { 1548 if ((int)netdev->irq < 0) {
1549 err = netdev->irq; 1549 err = netdev->irq;
1550 goto err_get_irq; 1550 goto err_get_irq;
1551 } 1551 }
diff --git a/drivers/net/ethernet/sfc/rx.c b/drivers/net/ethernet/sfc/rx.c
index aca349861767..fc52fca74193 100644
--- a/drivers/net/ethernet/sfc/rx.c
+++ b/drivers/net/ethernet/sfc/rx.c
@@ -156,11 +156,10 @@ static int efx_init_rx_buffers_skb(struct efx_rx_queue *rx_queue)
156 if (unlikely(!skb)) 156 if (unlikely(!skb))
157 return -ENOMEM; 157 return -ENOMEM;
158 158
159 /* Adjust the SKB for padding and checksum */ 159 /* Adjust the SKB for padding */
160 skb_reserve(skb, NET_IP_ALIGN); 160 skb_reserve(skb, NET_IP_ALIGN);
161 rx_buf->len = skb_len - NET_IP_ALIGN; 161 rx_buf->len = skb_len - NET_IP_ALIGN;
162 rx_buf->is_page = false; 162 rx_buf->is_page = false;
163 skb->ip_summed = CHECKSUM_UNNECESSARY;
164 163
165 rx_buf->dma_addr = pci_map_single(efx->pci_dev, 164 rx_buf->dma_addr = pci_map_single(efx->pci_dev,
166 skb->data, rx_buf->len, 165 skb->data, rx_buf->len,
@@ -496,6 +495,7 @@ static void efx_rx_packet_gro(struct efx_channel *channel,
496 495
497 EFX_BUG_ON_PARANOID(!checksummed); 496 EFX_BUG_ON_PARANOID(!checksummed);
498 rx_buf->u.skb = NULL; 497 rx_buf->u.skb = NULL;
498 skb->ip_summed = CHECKSUM_UNNECESSARY;
499 499
500 gro_result = napi_gro_receive(napi, skb); 500 gro_result = napi_gro_receive(napi, skb);
501 } 501 }
diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c
index 4fa0bcb25dfc..4b2f54565f64 100644
--- a/drivers/net/ethernet/ti/davinci_emac.c
+++ b/drivers/net/ethernet/ti/davinci_emac.c
@@ -1009,7 +1009,7 @@ static void emac_rx_handler(void *token, int len, int status)
1009 int ret; 1009 int ret;
1010 1010
1011 /* free and bail if we are shutting down */ 1011 /* free and bail if we are shutting down */
1012 if (unlikely(!netif_running(ndev) || !netif_carrier_ok(ndev))) { 1012 if (unlikely(!netif_running(ndev))) {
1013 dev_kfree_skb_any(skb); 1013 dev_kfree_skb_any(skb);
1014 return; 1014 return;
1015 } 1015 }
@@ -1038,7 +1038,9 @@ static void emac_rx_handler(void *token, int len, int status)
1038recycle: 1038recycle:
1039 ret = cpdma_chan_submit(priv->rxchan, skb, skb->data, 1039 ret = cpdma_chan_submit(priv->rxchan, skb, skb->data,
1040 skb_tailroom(skb), GFP_KERNEL); 1040 skb_tailroom(skb), GFP_KERNEL);
1041 if (WARN_ON(ret < 0)) 1041
1042 WARN_ON(ret == -ENOMEM);
1043 if (unlikely(ret < 0))
1042 dev_kfree_skb_any(skb); 1044 dev_kfree_skb_any(skb);
1043} 1045}
1044 1046
diff --git a/drivers/net/phy/icplus.c b/drivers/net/phy/icplus.c
index c81f136ae670..0856e1b7a849 100644
--- a/drivers/net/phy/icplus.c
+++ b/drivers/net/phy/icplus.c
@@ -30,16 +30,16 @@
30#include <asm/irq.h> 30#include <asm/irq.h>
31#include <asm/uaccess.h> 31#include <asm/uaccess.h>
32 32
33MODULE_DESCRIPTION("ICPlus IP175C/IP101A/IC1001 PHY drivers"); 33MODULE_DESCRIPTION("ICPlus IP175C/IP101A/IP101G/IC1001 PHY drivers");
34MODULE_AUTHOR("Michael Barkowski"); 34MODULE_AUTHOR("Michael Barkowski");
35MODULE_LICENSE("GPL"); 35MODULE_LICENSE("GPL");
36 36
37/* IP101A/IP1001 */ 37/* IP101A/G - IP1001 */
38#define IP10XX_SPEC_CTRL_STATUS 16 /* Spec. Control Register */ 38#define IP10XX_SPEC_CTRL_STATUS 16 /* Spec. Control Register */
39#define IP1001_SPEC_CTRL_STATUS_2 20 /* IP1001 Spec. Control Reg 2 */ 39#define IP1001_SPEC_CTRL_STATUS_2 20 /* IP1001 Spec. Control Reg 2 */
40#define IP1001_PHASE_SEL_MASK 3 /* IP1001 RX/TXPHASE_SEL */ 40#define IP1001_PHASE_SEL_MASK 3 /* IP1001 RX/TXPHASE_SEL */
41#define IP1001_APS_ON 11 /* IP1001 APS Mode bit */ 41#define IP1001_APS_ON 11 /* IP1001 APS Mode bit */
42#define IP101A_APS_ON 2 /* IP101A APS Mode bit */ 42#define IP101A_G_APS_ON 2 /* IP101A/G APS Mode bit */
43 43
44static int ip175c_config_init(struct phy_device *phydev) 44static int ip175c_config_init(struct phy_device *phydev)
45{ 45{
@@ -98,20 +98,24 @@ static int ip175c_config_init(struct phy_device *phydev)
98 98
99static int ip1xx_reset(struct phy_device *phydev) 99static int ip1xx_reset(struct phy_device *phydev)
100{ 100{
101 int err, bmcr; 101 int bmcr;
102 102
103 /* Software Reset PHY */ 103 /* Software Reset PHY */
104 bmcr = phy_read(phydev, MII_BMCR); 104 bmcr = phy_read(phydev, MII_BMCR);
105 if (bmcr < 0)
106 return bmcr;
105 bmcr |= BMCR_RESET; 107 bmcr |= BMCR_RESET;
106 err = phy_write(phydev, MII_BMCR, bmcr); 108 bmcr = phy_write(phydev, MII_BMCR, bmcr);
107 if (err < 0) 109 if (bmcr < 0)
108 return err; 110 return bmcr;
109 111
110 do { 112 do {
111 bmcr = phy_read(phydev, MII_BMCR); 113 bmcr = phy_read(phydev, MII_BMCR);
114 if (bmcr < 0)
115 return bmcr;
112 } while (bmcr & BMCR_RESET); 116 } while (bmcr & BMCR_RESET);
113 117
114 return err; 118 return 0;
115} 119}
116 120
117static int ip1001_config_init(struct phy_device *phydev) 121static int ip1001_config_init(struct phy_device *phydev)
@@ -124,7 +128,10 @@ static int ip1001_config_init(struct phy_device *phydev)
124 128
125 /* Enable Auto Power Saving mode */ 129 /* Enable Auto Power Saving mode */
126 c = phy_read(phydev, IP1001_SPEC_CTRL_STATUS_2); 130 c = phy_read(phydev, IP1001_SPEC_CTRL_STATUS_2);
131 if (c < 0)
132 return c;
127 c |= IP1001_APS_ON; 133 c |= IP1001_APS_ON;
134 c = phy_write(phydev, IP1001_SPEC_CTRL_STATUS_2, c);
128 if (c < 0) 135 if (c < 0)
129 return c; 136 return c;
130 137
@@ -132,14 +139,19 @@ static int ip1001_config_init(struct phy_device *phydev)
132 /* Additional delay (2ns) used to adjust RX clock phase 139 /* Additional delay (2ns) used to adjust RX clock phase
133 * at RGMII interface */ 140 * at RGMII interface */
134 c = phy_read(phydev, IP10XX_SPEC_CTRL_STATUS); 141 c = phy_read(phydev, IP10XX_SPEC_CTRL_STATUS);
142 if (c < 0)
143 return c;
144
135 c |= IP1001_PHASE_SEL_MASK; 145 c |= IP1001_PHASE_SEL_MASK;
136 c = phy_write(phydev, IP10XX_SPEC_CTRL_STATUS, c); 146 c = phy_write(phydev, IP10XX_SPEC_CTRL_STATUS, c);
147 if (c < 0)
148 return c;
137 } 149 }
138 150
139 return c; 151 return 0;
140} 152}
141 153
142static int ip101a_config_init(struct phy_device *phydev) 154static int ip101a_g_config_init(struct phy_device *phydev)
143{ 155{
144 int c; 156 int c;
145 157
@@ -149,7 +161,7 @@ static int ip101a_config_init(struct phy_device *phydev)
149 161
150 /* Enable Auto Power Saving mode */ 162 /* Enable Auto Power Saving mode */
151 c = phy_read(phydev, IP10XX_SPEC_CTRL_STATUS); 163 c = phy_read(phydev, IP10XX_SPEC_CTRL_STATUS);
152 c |= IP101A_APS_ON; 164 c |= IP101A_G_APS_ON;
153 return c; 165 return c;
154} 166}
155 167
@@ -191,6 +203,7 @@ static struct phy_driver ip1001_driver = {
191 .phy_id_mask = 0x0ffffff0, 203 .phy_id_mask = 0x0ffffff0,
192 .features = PHY_GBIT_FEATURES | SUPPORTED_Pause | 204 .features = PHY_GBIT_FEATURES | SUPPORTED_Pause |
193 SUPPORTED_Asym_Pause, 205 SUPPORTED_Asym_Pause,
206 .flags = PHY_HAS_INTERRUPT,
194 .config_init = &ip1001_config_init, 207 .config_init = &ip1001_config_init,
195 .config_aneg = &genphy_config_aneg, 208 .config_aneg = &genphy_config_aneg,
196 .read_status = &genphy_read_status, 209 .read_status = &genphy_read_status,
@@ -199,13 +212,14 @@ static struct phy_driver ip1001_driver = {
199 .driver = { .owner = THIS_MODULE,}, 212 .driver = { .owner = THIS_MODULE,},
200}; 213};
201 214
202static struct phy_driver ip101a_driver = { 215static struct phy_driver ip101a_g_driver = {
203 .phy_id = 0x02430c54, 216 .phy_id = 0x02430c54,
204 .name = "ICPlus IP101A", 217 .name = "ICPlus IP101A/G",
205 .phy_id_mask = 0x0ffffff0, 218 .phy_id_mask = 0x0ffffff0,
206 .features = PHY_BASIC_FEATURES | SUPPORTED_Pause | 219 .features = PHY_BASIC_FEATURES | SUPPORTED_Pause |
207 SUPPORTED_Asym_Pause, 220 SUPPORTED_Asym_Pause,
208 .config_init = &ip101a_config_init, 221 .flags = PHY_HAS_INTERRUPT,
222 .config_init = &ip101a_g_config_init,
209 .config_aneg = &genphy_config_aneg, 223 .config_aneg = &genphy_config_aneg,
210 .read_status = &genphy_read_status, 224 .read_status = &genphy_read_status,
211 .suspend = genphy_suspend, 225 .suspend = genphy_suspend,
@@ -221,7 +235,7 @@ static int __init icplus_init(void)
221 if (ret < 0) 235 if (ret < 0)
222 return -ENODEV; 236 return -ENODEV;
223 237
224 ret = phy_driver_register(&ip101a_driver); 238 ret = phy_driver_register(&ip101a_g_driver);
225 if (ret < 0) 239 if (ret < 0)
226 return -ENODEV; 240 return -ENODEV;
227 241
@@ -231,7 +245,7 @@ static int __init icplus_init(void)
231static void __exit icplus_exit(void) 245static void __exit icplus_exit(void)
232{ 246{
233 phy_driver_unregister(&ip1001_driver); 247 phy_driver_unregister(&ip1001_driver);
234 phy_driver_unregister(&ip101a_driver); 248 phy_driver_unregister(&ip101a_g_driver);
235 phy_driver_unregister(&ip175c_driver); 249 phy_driver_unregister(&ip175c_driver);
236} 250}
237 251
@@ -241,6 +255,7 @@ module_exit(icplus_exit);
241static struct mdio_device_id __maybe_unused icplus_tbl[] = { 255static struct mdio_device_id __maybe_unused icplus_tbl[] = {
242 { 0x02430d80, 0x0ffffff0 }, 256 { 0x02430d80, 0x0ffffff0 },
243 { 0x02430d90, 0x0ffffff0 }, 257 { 0x02430d90, 0x0ffffff0 },
258 { 0x02430c54, 0x0ffffff0 },
244 { } 259 { }
245}; 260};
246 261
diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c
index edfa15d2e795..486b4048850d 100644
--- a/drivers/net/ppp/ppp_generic.c
+++ b/drivers/net/ppp/ppp_generic.c
@@ -2024,14 +2024,22 @@ ppp_mp_reconstruct(struct ppp *ppp)
2024 continue; 2024 continue;
2025 } 2025 }
2026 if (PPP_MP_CB(p)->sequence != seq) { 2026 if (PPP_MP_CB(p)->sequence != seq) {
2027 u32 oldseq;
2027 /* Fragment `seq' is missing. If it is after 2028 /* Fragment `seq' is missing. If it is after
2028 minseq, it might arrive later, so stop here. */ 2029 minseq, it might arrive later, so stop here. */
2029 if (seq_after(seq, minseq)) 2030 if (seq_after(seq, minseq))
2030 break; 2031 break;
2031 /* Fragment `seq' is lost, keep going. */ 2032 /* Fragment `seq' is lost, keep going. */
2032 lost = 1; 2033 lost = 1;
2034 oldseq = seq;
2033 seq = seq_before(minseq, PPP_MP_CB(p)->sequence)? 2035 seq = seq_before(minseq, PPP_MP_CB(p)->sequence)?
2034 minseq + 1: PPP_MP_CB(p)->sequence; 2036 minseq + 1: PPP_MP_CB(p)->sequence;
2037
2038 if (ppp->debug & 1)
2039 netdev_printk(KERN_DEBUG, ppp->dev,
2040 "lost frag %u..%u\n",
2041 oldseq, seq-1);
2042
2035 goto again; 2043 goto again;
2036 } 2044 }
2037 2045
@@ -2076,6 +2084,10 @@ ppp_mp_reconstruct(struct ppp *ppp)
2076 struct sk_buff *tmp2; 2084 struct sk_buff *tmp2;
2077 2085
2078 skb_queue_reverse_walk_from_safe(list, p, tmp2) { 2086 skb_queue_reverse_walk_from_safe(list, p, tmp2) {
2087 if (ppp->debug & 1)
2088 netdev_printk(KERN_DEBUG, ppp->dev,
2089 "discarding frag %u\n",
2090 PPP_MP_CB(p)->sequence);
2079 __skb_unlink(p, list); 2091 __skb_unlink(p, list);
2080 kfree_skb(p); 2092 kfree_skb(p);
2081 } 2093 }
@@ -2091,6 +2103,17 @@ ppp_mp_reconstruct(struct ppp *ppp)
2091 /* If we have discarded any fragments, 2103 /* If we have discarded any fragments,
2092 signal a receive error. */ 2104 signal a receive error. */
2093 if (PPP_MP_CB(head)->sequence != ppp->nextseq) { 2105 if (PPP_MP_CB(head)->sequence != ppp->nextseq) {
2106 skb_queue_walk_safe(list, p, tmp) {
2107 if (p == head)
2108 break;
2109 if (ppp->debug & 1)
2110 netdev_printk(KERN_DEBUG, ppp->dev,
2111 "discarding frag %u\n",
2112 PPP_MP_CB(p)->sequence);
2113 __skb_unlink(p, list);
2114 kfree_skb(p);
2115 }
2116
2094 if (ppp->debug & 1) 2117 if (ppp->debug & 1)
2095 netdev_printk(KERN_DEBUG, ppp->dev, 2118 netdev_printk(KERN_DEBUG, ppp->dev,
2096 " missed pkts %u..%u\n", 2119 " missed pkts %u..%u\n",
diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c
index 41a61efc331e..90a30026a931 100644
--- a/drivers/net/usb/cdc_ether.c
+++ b/drivers/net/usb/cdc_ether.c
@@ -573,6 +573,13 @@ static const struct usb_device_id products [] = {
573 .driver_info = 0, 573 .driver_info = 0,
574}, 574},
575 575
576/* Logitech Harmony 900 - uses the pseudo-MDLM (BLAN) driver */
577{
578 USB_DEVICE_AND_INTERFACE_INFO(0x046d, 0xc11f, USB_CLASS_COMM,
579 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
580 .driver_info = 0,
581},
582
576/* 583/*
577 * WHITELIST!!! 584 * WHITELIST!!!
578 * 585 *
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
index 304fe78ff60e..e1324b4a0f66 100644
--- a/drivers/net/usb/hso.c
+++ b/drivers/net/usb/hso.c
@@ -1632,7 +1632,7 @@ static int hso_get_count(struct tty_struct *tty,
1632 struct hso_serial *serial = get_serial_by_tty(tty); 1632 struct hso_serial *serial = get_serial_by_tty(tty);
1633 struct hso_tiocmget *tiocmget = serial->tiocmget; 1633 struct hso_tiocmget *tiocmget = serial->tiocmget;
1634 1634
1635 memset(&icount, 0, sizeof(struct serial_icounter_struct)); 1635 memset(icount, 0, sizeof(struct serial_icounter_struct));
1636 1636
1637 if (!tiocmget) 1637 if (!tiocmget)
1638 return -ENOENT; 1638 return -ENOENT;
diff --git a/drivers/net/usb/zaurus.c b/drivers/net/usb/zaurus.c
index f701d4127087..c3197ce0e2ad 100644
--- a/drivers/net/usb/zaurus.c
+++ b/drivers/net/usb/zaurus.c
@@ -316,6 +316,11 @@ static const struct usb_device_id products [] = {
316 ZAURUS_MASTER_INTERFACE, 316 ZAURUS_MASTER_INTERFACE,
317 .driver_info = ZAURUS_PXA_INFO, 317 .driver_info = ZAURUS_PXA_INFO,
318}, { 318}, {
319 /* C-750/C-760/C-860/SL-C3000 PDA in MDLM mode */
320 USB_DEVICE_AND_INTERFACE_INFO(0x04DD, 0x9031, USB_CLASS_COMM,
321 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
322 .driver_info = (unsigned long) &bogus_mdlm_info,
323}, {
319 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO 324 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
320 | USB_DEVICE_ID_MATCH_DEVICE, 325 | USB_DEVICE_ID_MATCH_DEVICE,
321 .idVendor = 0x04DD, 326 .idVendor = 0x04DD,
@@ -349,6 +354,13 @@ static const struct usb_device_id products [] = {
349 ZAURUS_MASTER_INTERFACE, 354 ZAURUS_MASTER_INTERFACE,
350 .driver_info = OLYMPUS_MXL_INFO, 355 .driver_info = OLYMPUS_MXL_INFO,
351}, 356},
357
358/* Logitech Harmony 900 - uses the pseudo-MDLM (BLAN) driver */
359{
360 USB_DEVICE_AND_INTERFACE_INFO(0x046d, 0xc11f, USB_CLASS_COMM,
361 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
362 .driver_info = (unsigned long) &bogus_mdlm_info,
363},
352 { }, // END 364 { }, // END
353}; 365};
354MODULE_DEVICE_TABLE(usb, products); 366MODULE_DEVICE_TABLE(usb, products);
diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c
index de7fc345148a..3dcd3857a36c 100644
--- a/drivers/net/vmxnet3/vmxnet3_drv.c
+++ b/drivers/net/vmxnet3/vmxnet3_drv.c
@@ -843,8 +843,8 @@ vmxnet3_parse_and_copy_hdr(struct sk_buff *skb, struct vmxnet3_tx_queue *tq,
843 /* for simplicity, don't copy L4 headers */ 843 /* for simplicity, don't copy L4 headers */
844 ctx->l4_hdr_size = 0; 844 ctx->l4_hdr_size = 0;
845 } 845 }
846 ctx->copy_size = ctx->eth_ip_hdr_size + 846 ctx->copy_size = min(ctx->eth_ip_hdr_size +
847 ctx->l4_hdr_size; 847 ctx->l4_hdr_size, skb->len);
848 } else { 848 } else {
849 ctx->eth_ip_hdr_size = 0; 849 ctx->eth_ip_hdr_size = 0;
850 ctx->l4_hdr_size = 0; 850 ctx->l4_hdr_size = 0;
diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c
index 635b592ad961..a427a16bb739 100644
--- a/drivers/net/wireless/ath/ath9k/rc.c
+++ b/drivers/net/wireless/ath/ath9k/rc.c
@@ -1346,7 +1346,7 @@ static void ath_tx_status(void *priv, struct ieee80211_supported_band *sband,
1346 fc = hdr->frame_control; 1346 fc = hdr->frame_control;
1347 for (i = 0; i < sc->hw->max_rates; i++) { 1347 for (i = 0; i < sc->hw->max_rates; i++) {
1348 struct ieee80211_tx_rate *rate = &tx_info->status.rates[i]; 1348 struct ieee80211_tx_rate *rate = &tx_info->status.rates[i];
1349 if (!rate->count) 1349 if (rate->idx < 0 || !rate->count)
1350 break; 1350 break;
1351 1351
1352 final_ts_idx = i; 1352 final_ts_idx = i;
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c
index c3b6c4652cd6..5b2972b43b0e 100644
--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/mwifiex/cfg80211.c
@@ -841,7 +841,12 @@ mwifiex_cfg80211_assoc(struct mwifiex_private *priv, size_t ssid_len, u8 *ssid,
841 ret = mwifiex_set_rf_channel(priv, channel, 841 ret = mwifiex_set_rf_channel(priv, channel,
842 priv->adapter->channel_type); 842 priv->adapter->channel_type);
843 843
844 ret = mwifiex_set_encode(priv, NULL, 0, 0, 1); /* Disable keys */ 844 /* As this is new association, clear locally stored
845 * keys and security related flags */
846 priv->sec_info.wpa_enabled = false;
847 priv->sec_info.wpa2_enabled = false;
848 priv->wep_key_curr_index = 0;
849 ret = mwifiex_set_encode(priv, NULL, 0, 0, 1);
845 850
846 if (mode == NL80211_IFTYPE_ADHOC) { 851 if (mode == NL80211_IFTYPE_ADHOC) {
847 /* "privacy" is set only for ad-hoc mode */ 852 /* "privacy" is set only for ad-hoc mode */
@@ -886,6 +891,7 @@ mwifiex_cfg80211_assoc(struct mwifiex_private *priv, size_t ssid_len, u8 *ssid,
886 dev_dbg(priv->adapter->dev, 891 dev_dbg(priv->adapter->dev,
887 "info: setting wep encryption" 892 "info: setting wep encryption"
888 " with key len %d\n", sme->key_len); 893 " with key len %d\n", sme->key_len);
894 priv->wep_key_curr_index = sme->key_idx;
889 ret = mwifiex_set_encode(priv, sme->key, sme->key_len, 895 ret = mwifiex_set_encode(priv, sme->key, sme->key_len,
890 sme->key_idx, 0); 896 sme->key_idx, 0);
891 } 897 }
diff --git a/drivers/parisc/iommu-helpers.h b/drivers/parisc/iommu-helpers.h
index a9c46cc2db37..8c33491b21fe 100644
--- a/drivers/parisc/iommu-helpers.h
+++ b/drivers/parisc/iommu-helpers.h
@@ -1,3 +1,5 @@
1#include <linux/prefetch.h>
2
1/** 3/**
2 * iommu_fill_pdir - Insert coalesced scatter/gather chunks into the I/O Pdir. 4 * iommu_fill_pdir - Insert coalesced scatter/gather chunks into the I/O Pdir.
3 * @ioc: The I/O Controller. 5 * @ioc: The I/O Controller.
diff --git a/drivers/pcmcia/pxa2xx_base.c b/drivers/pcmcia/pxa2xx_base.c
index a87e2728b2c3..64d433ec4fc6 100644
--- a/drivers/pcmcia/pxa2xx_base.c
+++ b/drivers/pcmcia/pxa2xx_base.c
@@ -328,21 +328,15 @@ static int pxa2xx_drv_pcmcia_probe(struct platform_device *dev)
328 goto err1; 328 goto err1;
329 } 329 }
330 330
331 if (ret) { 331 pxa2xx_configure_sockets(&dev->dev);
332 while (--i >= 0) 332 dev_set_drvdata(&dev->dev, sinfo);
333 soc_pcmcia_remove_one(&sinfo->skt[i]);
334 kfree(sinfo);
335 clk_put(clk);
336 } else {
337 pxa2xx_configure_sockets(&dev->dev);
338 dev_set_drvdata(&dev->dev, sinfo);
339 }
340 333
341 return 0; 334 return 0;
342 335
343err1: 336err1:
344 while (--i >= 0) 337 while (--i >= 0)
345 soc_pcmcia_remove_one(&sinfo->skt[i]); 338 soc_pcmcia_remove_one(&sinfo->skt[i]);
339 clk_put(clk);
346 kfree(sinfo); 340 kfree(sinfo);
347err0: 341err0:
348 return ret; 342 return ret;
diff --git a/drivers/regulator/88pm8607.c b/drivers/regulator/88pm8607.c
index df33530cec4a..28b81ae4cf7f 100644
--- a/drivers/regulator/88pm8607.c
+++ b/drivers/regulator/88pm8607.c
@@ -196,7 +196,7 @@ static const unsigned int LDO12_suspend_table[] = {
196}; 196};
197 197
198static const unsigned int LDO13_table[] = { 198static const unsigned int LDO13_table[] = {
199 1300000, 1800000, 2000000, 2500000, 2800000, 3000000, 0, 0, 199 1200000, 1300000, 1800000, 2000000, 2500000, 2800000, 3000000, 0,
200}; 200};
201 201
202static const unsigned int LDO13_suspend_table[] = { 202static const unsigned int LDO13_suspend_table[] = {
@@ -389,10 +389,10 @@ static struct pm8607_regulator_info pm8607_regulator_info[] = {
389 PM8607_LDO( 7, LDO7, 0, 3, SUPPLIES_EN12, 1), 389 PM8607_LDO( 7, LDO7, 0, 3, SUPPLIES_EN12, 1),
390 PM8607_LDO( 8, LDO8, 0, 3, SUPPLIES_EN12, 2), 390 PM8607_LDO( 8, LDO8, 0, 3, SUPPLIES_EN12, 2),
391 PM8607_LDO( 9, LDO9, 0, 3, SUPPLIES_EN12, 3), 391 PM8607_LDO( 9, LDO9, 0, 3, SUPPLIES_EN12, 3),
392 PM8607_LDO(10, LDO10, 0, 3, SUPPLIES_EN12, 4), 392 PM8607_LDO(10, LDO10, 0, 4, SUPPLIES_EN12, 4),
393 PM8607_LDO(12, LDO12, 0, 4, SUPPLIES_EN12, 5), 393 PM8607_LDO(12, LDO12, 0, 4, SUPPLIES_EN12, 5),
394 PM8607_LDO(13, VIBRATOR_SET, 1, 3, VIBRATOR_SET, 0), 394 PM8607_LDO(13, VIBRATOR_SET, 1, 3, VIBRATOR_SET, 0),
395 PM8607_LDO(14, LDO14, 0, 4, SUPPLIES_EN12, 6), 395 PM8607_LDO(14, LDO14, 0, 3, SUPPLIES_EN12, 6),
396}; 396};
397 397
398static int __devinit pm8607_regulator_probe(struct platform_device *pdev) 398static int __devinit pm8607_regulator_probe(struct platform_device *pdev)
diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c
index 70880be26015..2617b1ed4709 100644
--- a/drivers/s390/block/dasd_eckd.c
+++ b/drivers/s390/block/dasd_eckd.c
@@ -18,12 +18,12 @@
18#include <linux/hdreg.h> /* HDIO_GETGEO */ 18#include <linux/hdreg.h> /* HDIO_GETGEO */
19#include <linux/bio.h> 19#include <linux/bio.h>
20#include <linux/module.h> 20#include <linux/module.h>
21#include <linux/compat.h>
21#include <linux/init.h> 22#include <linux/init.h>
22 23
23#include <asm/debug.h> 24#include <asm/debug.h>
24#include <asm/idals.h> 25#include <asm/idals.h>
25#include <asm/ebcdic.h> 26#include <asm/ebcdic.h>
26#include <asm/compat.h>
27#include <asm/io.h> 27#include <asm/io.h>
28#include <asm/uaccess.h> 28#include <asm/uaccess.h>
29#include <asm/cio.h> 29#include <asm/cio.h>
diff --git a/drivers/s390/block/dasd_ioctl.c b/drivers/s390/block/dasd_ioctl.c
index f1a2016829fc..792c69e78fe2 100644
--- a/drivers/s390/block/dasd_ioctl.c
+++ b/drivers/s390/block/dasd_ioctl.c
@@ -13,6 +13,7 @@
13#define KMSG_COMPONENT "dasd" 13#define KMSG_COMPONENT "dasd"
14 14
15#include <linux/interrupt.h> 15#include <linux/interrupt.h>
16#include <linux/compat.h>
16#include <linux/major.h> 17#include <linux/major.h>
17#include <linux/fs.h> 18#include <linux/fs.h>
18#include <linux/blkpg.h> 19#include <linux/blkpg.h>
diff --git a/drivers/s390/char/fs3270.c b/drivers/s390/char/fs3270.c
index e71298158f9e..911704571b9c 100644
--- a/drivers/s390/char/fs3270.c
+++ b/drivers/s390/char/fs3270.c
@@ -11,6 +11,7 @@
11#include <linux/console.h> 11#include <linux/console.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/interrupt.h> 13#include <linux/interrupt.h>
14#include <linux/compat.h>
14#include <linux/module.h> 15#include <linux/module.h>
15#include <linux/list.h> 16#include <linux/list.h>
16#include <linux/slab.h> 17#include <linux/slab.h>
diff --git a/drivers/s390/char/vmcp.c b/drivers/s390/char/vmcp.c
index 75bde6a8b7dc..89c03e6b1c0c 100644
--- a/drivers/s390/char/vmcp.c
+++ b/drivers/s390/char/vmcp.c
@@ -13,6 +13,7 @@
13 13
14#include <linux/fs.h> 14#include <linux/fs.h>
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/compat.h>
16#include <linux/kernel.h> 17#include <linux/kernel.h>
17#include <linux/miscdevice.h> 18#include <linux/miscdevice.h>
18#include <linux/slab.h> 19#include <linux/slab.h>
diff --git a/drivers/s390/cio/chsc_sch.c b/drivers/s390/cio/chsc_sch.c
index 0c87b0fc7714..8f9a1a384496 100644
--- a/drivers/s390/cio/chsc_sch.c
+++ b/drivers/s390/cio/chsc_sch.c
@@ -8,6 +8,7 @@
8 */ 8 */
9 9
10#include <linux/slab.h> 10#include <linux/slab.h>
11#include <linux/compat.h>
11#include <linux/device.h> 12#include <linux/device.h>
12#include <linux/module.h> 13#include <linux/module.h>
13#include <linux/uaccess.h> 14#include <linux/uaccess.h>
diff --git a/drivers/s390/scsi/zfcp_cfdc.c b/drivers/s390/scsi/zfcp_cfdc.c
index 303dde09d294..fab2c2592a97 100644
--- a/drivers/s390/scsi/zfcp_cfdc.c
+++ b/drivers/s390/scsi/zfcp_cfdc.c
@@ -11,6 +11,7 @@
11#define KMSG_COMPONENT "zfcp" 11#define KMSG_COMPONENT "zfcp"
12#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt 12#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
13 13
14#include <linux/compat.h>
14#include <linux/slab.h> 15#include <linux/slab.h>
15#include <linux/types.h> 16#include <linux/types.h>
16#include <linux/miscdevice.h> 17#include <linux/miscdevice.h>
diff --git a/drivers/scsi/osd/osd_uld.c b/drivers/scsi/osd/osd_uld.c
index b31a8e3841d7..d4ed9eb52657 100644
--- a/drivers/scsi/osd/osd_uld.c
+++ b/drivers/scsi/osd/osd_uld.c
@@ -69,10 +69,10 @@
69#ifndef SCSI_OSD_MAJOR 69#ifndef SCSI_OSD_MAJOR
70# define SCSI_OSD_MAJOR 260 70# define SCSI_OSD_MAJOR 260
71#endif 71#endif
72#define SCSI_OSD_MAX_MINOR 64 72#define SCSI_OSD_MAX_MINOR MINORMASK
73 73
74static const char osd_name[] = "osd"; 74static const char osd_name[] = "osd";
75static const char *osd_version_string = "open-osd 0.2.0"; 75static const char *osd_version_string = "open-osd 0.2.1";
76 76
77MODULE_AUTHOR("Boaz Harrosh <bharrosh@panasas.com>"); 77MODULE_AUTHOR("Boaz Harrosh <bharrosh@panasas.com>");
78MODULE_DESCRIPTION("open-osd Upper-Layer-Driver osd.ko"); 78MODULE_DESCRIPTION("open-osd Upper-Layer-Driver osd.ko");
diff --git a/drivers/tty/serial/pxa.c b/drivers/tty/serial/pxa.c
index 5c8e3bba6c84..cdf4b2bfad80 100644
--- a/drivers/tty/serial/pxa.c
+++ b/drivers/tty/serial/pxa.c
@@ -36,6 +36,7 @@
36#include <linux/circ_buf.h> 36#include <linux/circ_buf.h>
37#include <linux/delay.h> 37#include <linux/delay.h>
38#include <linux/interrupt.h> 38#include <linux/interrupt.h>
39#include <linux/of.h>
39#include <linux/platform_device.h> 40#include <linux/platform_device.h>
40#include <linux/tty.h> 41#include <linux/tty.h>
41#include <linux/tty_flip.h> 42#include <linux/tty_flip.h>
@@ -44,6 +45,8 @@
44#include <linux/io.h> 45#include <linux/io.h>
45#include <linux/slab.h> 46#include <linux/slab.h>
46 47
48#define PXA_NAME_LEN 8
49
47struct uart_pxa_port { 50struct uart_pxa_port {
48 struct uart_port port; 51 struct uart_port port;
49 unsigned char ier; 52 unsigned char ier;
@@ -51,7 +54,7 @@ struct uart_pxa_port {
51 unsigned char mcr; 54 unsigned char mcr;
52 unsigned int lsr_break_flag; 55 unsigned int lsr_break_flag;
53 struct clk *clk; 56 struct clk *clk;
54 char *name; 57 char name[PXA_NAME_LEN];
55}; 58};
56 59
57static inline unsigned int serial_in(struct uart_pxa_port *up, int offset) 60static inline unsigned int serial_in(struct uart_pxa_port *up, int offset)
@@ -781,6 +784,31 @@ static const struct dev_pm_ops serial_pxa_pm_ops = {
781}; 784};
782#endif 785#endif
783 786
787static struct of_device_id serial_pxa_dt_ids[] = {
788 { .compatible = "mrvl,pxa-uart", },
789 { .compatible = "mrvl,mmp-uart", },
790 {}
791};
792MODULE_DEVICE_TABLE(of, serial_pxa_dt_ids);
793
794static int serial_pxa_probe_dt(struct platform_device *pdev,
795 struct uart_pxa_port *sport)
796{
797 struct device_node *np = pdev->dev.of_node;
798 int ret;
799
800 if (!np)
801 return 1;
802
803 ret = of_alias_get_id(np, "serial");
804 if (ret < 0) {
805 dev_err(&pdev->dev, "failed to get alias id, errno %d\n", ret);
806 return ret;
807 }
808 sport->port.line = ret;
809 return 0;
810}
811
784static int serial_pxa_probe(struct platform_device *dev) 812static int serial_pxa_probe(struct platform_device *dev)
785{ 813{
786 struct uart_pxa_port *sport; 814 struct uart_pxa_port *sport;
@@ -808,20 +836,16 @@ static int serial_pxa_probe(struct platform_device *dev)
808 sport->port.irq = irqres->start; 836 sport->port.irq = irqres->start;
809 sport->port.fifosize = 64; 837 sport->port.fifosize = 64;
810 sport->port.ops = &serial_pxa_pops; 838 sport->port.ops = &serial_pxa_pops;
811 sport->port.line = dev->id;
812 sport->port.dev = &dev->dev; 839 sport->port.dev = &dev->dev;
813 sport->port.flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF; 840 sport->port.flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF;
814 sport->port.uartclk = clk_get_rate(sport->clk); 841 sport->port.uartclk = clk_get_rate(sport->clk);
815 842
816 switch (dev->id) { 843 ret = serial_pxa_probe_dt(dev, sport);
817 case 0: sport->name = "FFUART"; break; 844 if (ret > 0)
818 case 1: sport->name = "BTUART"; break; 845 sport->port.line = dev->id;
819 case 2: sport->name = "STUART"; break; 846 else if (ret < 0)
820 case 3: sport->name = "HWUART"; break; 847 goto err_clk;
821 default: 848 snprintf(sport->name, PXA_NAME_LEN - 1, "UART%d", sport->port.line + 1);
822 sport->name = "???";
823 break;
824 }
825 849
826 sport->port.membase = ioremap(mmres->start, resource_size(mmres)); 850 sport->port.membase = ioremap(mmres->start, resource_size(mmres));
827 if (!sport->port.membase) { 851 if (!sport->port.membase) {
@@ -829,7 +853,7 @@ static int serial_pxa_probe(struct platform_device *dev)
829 goto err_clk; 853 goto err_clk;
830 } 854 }
831 855
832 serial_pxa_ports[dev->id] = sport; 856 serial_pxa_ports[sport->port.line] = sport;
833 857
834 uart_add_one_port(&serial_pxa_reg, &sport->port); 858 uart_add_one_port(&serial_pxa_reg, &sport->port);
835 platform_set_drvdata(dev, sport); 859 platform_set_drvdata(dev, sport);
@@ -866,6 +890,7 @@ static struct platform_driver serial_pxa_driver = {
866#ifdef CONFIG_PM 890#ifdef CONFIG_PM
867 .pm = &serial_pxa_pm_ops, 891 .pm = &serial_pxa_pm_ops,
868#endif 892#endif
893 .of_match_table = serial_pxa_dt_ids,
869 }, 894 },
870}; 895};
871 896
diff --git a/drivers/video/omap2/displays/Kconfig b/drivers/video/omap2/displays/Kconfig
index 74d29b552901..408a9927be92 100644
--- a/drivers/video/omap2/displays/Kconfig
+++ b/drivers/video/omap2/displays/Kconfig
@@ -12,7 +12,7 @@ config PANEL_GENERIC_DPI
12 12
13config PANEL_DVI 13config PANEL_DVI
14 tristate "DVI output" 14 tristate "DVI output"
15 depends on OMAP2_DSS_DPI 15 depends on OMAP2_DSS_DPI && I2C
16 help 16 help
17 Driver for external monitors, connected via DVI. The driver uses i2c 17 Driver for external monitors, connected via DVI. The driver uses i2c
18 to read EDID information from the monitor. 18 to read EDID information from the monitor.
diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c
index 052dc874cd3d..87b3e25294cf 100644
--- a/drivers/video/omap2/dss/apply.c
+++ b/drivers/video/omap2/dss/apply.c
@@ -1276,6 +1276,9 @@ int dss_ovl_enable(struct omap_overlay *ovl)
1276 1276
1277 spin_unlock_irqrestore(&data_lock, flags); 1277 spin_unlock_irqrestore(&data_lock, flags);
1278 1278
1279 /* wait for overlay to be enabled */
1280 wait_pending_extra_info_updates();
1281
1279 mutex_unlock(&apply_lock); 1282 mutex_unlock(&apply_lock);
1280 1283
1281 return 0; 1284 return 0;
@@ -1313,6 +1316,9 @@ int dss_ovl_disable(struct omap_overlay *ovl)
1313 1316
1314 spin_unlock_irqrestore(&data_lock, flags); 1317 spin_unlock_irqrestore(&data_lock, flags);
1315 1318
1319 /* wait for the overlay to be disabled */
1320 wait_pending_extra_info_updates();
1321
1316 mutex_unlock(&apply_lock); 1322 mutex_unlock(&apply_lock);
1317 1323
1318 return 0; 1324 return 0;
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index d7aa3b056529..a36b934b2db4 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -165,9 +165,25 @@ static int hdmi_runtime_get(void)
165 165
166 DSSDBG("hdmi_runtime_get\n"); 166 DSSDBG("hdmi_runtime_get\n");
167 167
168 /*
169 * HACK: Add dss_runtime_get() to ensure DSS clock domain is enabled.
170 * This should be removed later.
171 */
172 r = dss_runtime_get();
173 if (r < 0)
174 goto err_get_dss;
175
168 r = pm_runtime_get_sync(&hdmi.pdev->dev); 176 r = pm_runtime_get_sync(&hdmi.pdev->dev);
169 WARN_ON(r < 0); 177 WARN_ON(r < 0);
170 return r < 0 ? r : 0; 178 if (r < 0)
179 goto err_get_hdmi;
180
181 return 0;
182
183err_get_hdmi:
184 dss_runtime_put();
185err_get_dss:
186 return r;
171} 187}
172 188
173static void hdmi_runtime_put(void) 189static void hdmi_runtime_put(void)
@@ -178,6 +194,12 @@ static void hdmi_runtime_put(void)
178 194
179 r = pm_runtime_put_sync(&hdmi.pdev->dev); 195 r = pm_runtime_put_sync(&hdmi.pdev->dev);
180 WARN_ON(r < 0); 196 WARN_ON(r < 0);
197
198 /*
199 * HACK: This is added to complement the dss_runtime_get() call in
200 * hdmi_runtime_get(). This should be removed later.
201 */
202 dss_runtime_put();
181} 203}
182 204
183int hdmi_init_display(struct omap_dss_device *dssdev) 205int hdmi_init_display(struct omap_dss_device *dssdev)
diff --git a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
index 2d72334ca3da..6847a478b459 100644
--- a/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
+++ b/drivers/video/omap2/dss/ti_hdmi_4xxx_ip.c
@@ -479,14 +479,7 @@ int ti_hdmi_4xxx_read_edid(struct hdmi_ip_data *ip_data,
479 479
480bool ti_hdmi_4xxx_detect(struct hdmi_ip_data *ip_data) 480bool ti_hdmi_4xxx_detect(struct hdmi_ip_data *ip_data)
481{ 481{
482 int r; 482 return gpio_get_value(ip_data->hpd_gpio);
483
484 void __iomem *base = hdmi_core_sys_base(ip_data);
485
486 /* HPD */
487 r = REG_GET(base, HDMI_CORE_SYS_SYS_STAT, 1, 1);
488
489 return r == 1;
490} 483}
491 484
492static void hdmi_core_init(struct hdmi_core_video_config *video_cfg, 485static void hdmi_core_init(struct hdmi_core_video_config *video_cfg,
diff --git a/drivers/video/via/hw.c b/drivers/video/via/hw.c
index d5aaca9cfa7e..8497727d66de 100644
--- a/drivers/video/via/hw.c
+++ b/drivers/video/via/hw.c
@@ -1810,7 +1810,11 @@ static void hw_init(void)
1810 break; 1810 break;
1811 } 1811 }
1812 1812
1813 /* magic required on VX900 for correct modesetting on IGA1 */
1814 via_write_reg_mask(VIACR, 0x45, 0x00, 0x01);
1815
1813 /* probably this should go to the scaling code one day */ 1816 /* probably this should go to the scaling code one day */
1817 via_write_reg_mask(VIACR, 0xFD, 0, 0x80); /* VX900 hw scale on IGA2 */
1814 viafb_write_regx(scaling_parameters, ARRAY_SIZE(scaling_parameters)); 1818 viafb_write_regx(scaling_parameters, ARRAY_SIZE(scaling_parameters));
1815 1819
1816 /* Fill VPIT Parameters */ 1820 /* Fill VPIT Parameters */
diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
index 95aeedf198f8..958e5129c601 100644
--- a/drivers/virtio/virtio_balloon.c
+++ b/drivers/virtio/virtio_balloon.c
@@ -367,29 +367,45 @@ static void __devexit virtballoon_remove(struct virtio_device *vdev)
367#ifdef CONFIG_PM 367#ifdef CONFIG_PM
368static int virtballoon_freeze(struct virtio_device *vdev) 368static int virtballoon_freeze(struct virtio_device *vdev)
369{ 369{
370 struct virtio_balloon *vb = vdev->priv;
371
370 /* 372 /*
371 * The kthread is already frozen by the PM core before this 373 * The kthread is already frozen by the PM core before this
372 * function is called. 374 * function is called.
373 */ 375 */
374 376
377 while (vb->num_pages)
378 leak_balloon(vb, vb->num_pages);
379 update_balloon_size(vb);
380
375 /* Ensure we don't get any more requests from the host */ 381 /* Ensure we don't get any more requests from the host */
376 vdev->config->reset(vdev); 382 vdev->config->reset(vdev);
377 vdev->config->del_vqs(vdev); 383 vdev->config->del_vqs(vdev);
378 return 0; 384 return 0;
379} 385}
380 386
387static int restore_common(struct virtio_device *vdev)
388{
389 struct virtio_balloon *vb = vdev->priv;
390 int ret;
391
392 ret = init_vqs(vdev->priv);
393 if (ret)
394 return ret;
395
396 fill_balloon(vb, towards_target(vb));
397 update_balloon_size(vb);
398 return 0;
399}
400
381static int virtballoon_thaw(struct virtio_device *vdev) 401static int virtballoon_thaw(struct virtio_device *vdev)
382{ 402{
383 return init_vqs(vdev->priv); 403 return restore_common(vdev);
384} 404}
385 405
386static int virtballoon_restore(struct virtio_device *vdev) 406static int virtballoon_restore(struct virtio_device *vdev)
387{ 407{
388 struct virtio_balloon *vb = vdev->priv; 408 struct virtio_balloon *vb = vdev->priv;
389 struct page *page, *page2;
390
391 /* We're starting from a clean slate */
392 vb->num_pages = 0;
393 409
394 /* 410 /*
395 * If a request wasn't complete at the time of freezing, this 411 * If a request wasn't complete at the time of freezing, this
@@ -397,12 +413,7 @@ static int virtballoon_restore(struct virtio_device *vdev)
397 */ 413 */
398 vb->need_stats_update = 0; 414 vb->need_stats_update = 0;
399 415
400 /* We don't have these pages in the balloon anymore! */ 416 return restore_common(vdev);
401 list_for_each_entry_safe(page, page2, &vb->pages, lru) {
402 list_del(&page->lru);
403 totalram_pages++;
404 }
405 return init_vqs(vdev->priv);
406} 417}
407#endif 418#endif
408 419
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index 877b107f77a7..df9e8f0e327d 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -1098,7 +1098,7 @@ config BOOKE_WDT_DEFAULT_TIMEOUT
1098 For Freescale Book-E processors, this is a number between 0 and 63. 1098 For Freescale Book-E processors, this is a number between 0 and 63.
1099 For other Book-E processors, this is a number between 0 and 3. 1099 For other Book-E processors, this is a number between 0 and 3.
1100 1100
1101 The value can be overidden by the wdt_period command-line parameter. 1101 The value can be overridden by the wdt_period command-line parameter.
1102 1102
1103# PPC64 Architecture 1103# PPC64 Architecture
1104 1104
diff --git a/drivers/watchdog/booke_wdt.c b/drivers/watchdog/booke_wdt.c
index 337265b47305..7c0fdfca2646 100644
--- a/drivers/watchdog/booke_wdt.c
+++ b/drivers/watchdog/booke_wdt.c
@@ -198,9 +198,13 @@ static long booke_wdt_ioctl(struct file *file,
198 booke_wdt_period = tmp; 198 booke_wdt_period = tmp;
199#endif 199#endif
200 booke_wdt_set(); 200 booke_wdt_set();
201 return 0; 201 /* Fall */
202 case WDIOC_GETTIMEOUT: 202 case WDIOC_GETTIMEOUT:
203#ifdef CONFIG_FSL_BOOKE
204 return put_user(period_to_sec(booke_wdt_period), p);
205#else
203 return put_user(booke_wdt_period, p); 206 return put_user(booke_wdt_period, p);
207#endif
204 default: 208 default:
205 return -ENOTTY; 209 return -ENOTTY;
206 } 210 }
diff --git a/drivers/watchdog/hpwdt.c b/drivers/watchdog/hpwdt.c
index 8464ea1c36a1..3c166d3f4e55 100644
--- a/drivers/watchdog/hpwdt.c
+++ b/drivers/watchdog/hpwdt.c
@@ -231,7 +231,7 @@ static int __devinit cru_detect(unsigned long map_entry,
231 231
232 cmn_regs.u1.reax = CRU_BIOS_SIGNATURE_VALUE; 232 cmn_regs.u1.reax = CRU_BIOS_SIGNATURE_VALUE;
233 233
234 set_memory_x((unsigned long)bios32_entrypoint, (2 * PAGE_SIZE)); 234 set_memory_x((unsigned long)bios32_map, 2);
235 asminline_call(&cmn_regs, bios32_entrypoint); 235 asminline_call(&cmn_regs, bios32_entrypoint);
236 236
237 if (cmn_regs.u1.ral != 0) { 237 if (cmn_regs.u1.ral != 0) {
@@ -250,7 +250,8 @@ static int __devinit cru_detect(unsigned long map_entry,
250 cru_rom_addr = 250 cru_rom_addr =
251 ioremap(cru_physical_address, cru_length); 251 ioremap(cru_physical_address, cru_length);
252 if (cru_rom_addr) { 252 if (cru_rom_addr) {
253 set_memory_x((unsigned long)cru_rom_addr, cru_length); 253 set_memory_x((unsigned long)cru_rom_addr & PAGE_MASK,
254 (cru_length + PAGE_SIZE - 1) >> PAGE_SHIFT);
254 retval = 0; 255 retval = 0;
255 } 256 }
256 } 257 }
diff --git a/drivers/watchdog/pnx4008_wdt.c b/drivers/watchdog/pnx4008_wdt.c
index 8e210aafdfd0..dfae030a7ef2 100644
--- a/drivers/watchdog/pnx4008_wdt.c
+++ b/drivers/watchdog/pnx4008_wdt.c
@@ -264,7 +264,7 @@ static int __devinit pnx4008_wdt_probe(struct platform_device *pdev)
264 wdt_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); 264 wdt_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
265 if (wdt_mem == NULL) { 265 if (wdt_mem == NULL) {
266 printk(KERN_INFO MODULE_NAME 266 printk(KERN_INFO MODULE_NAME
267 "failed to get memory region resouce\n"); 267 "failed to get memory region resource\n");
268 return -ENOENT; 268 return -ENOENT;
269 } 269 }
270 270
diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c
index 4bc3744e14e4..404172f02c9b 100644
--- a/drivers/watchdog/s3c2410_wdt.c
+++ b/drivers/watchdog/s3c2410_wdt.c
@@ -312,18 +312,26 @@ static int __devinit s3c2410wdt_probe(struct platform_device *pdev)
312 dev = &pdev->dev; 312 dev = &pdev->dev;
313 wdt_dev = &pdev->dev; 313 wdt_dev = &pdev->dev;
314 314
315 /* get the memory region for the watchdog timer */
316
317 wdt_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); 315 wdt_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
318 if (wdt_mem == NULL) { 316 if (wdt_mem == NULL) {
319 dev_err(dev, "no memory resource specified\n"); 317 dev_err(dev, "no memory resource specified\n");
320 return -ENOENT; 318 return -ENOENT;
321 } 319 }
322 320
321 wdt_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
322 if (wdt_irq == NULL) {
323 dev_err(dev, "no irq resource specified\n");
324 ret = -ENOENT;
325 goto err;
326 }
327
328 /* get the memory region for the watchdog timer */
329
323 size = resource_size(wdt_mem); 330 size = resource_size(wdt_mem);
324 if (!request_mem_region(wdt_mem->start, size, pdev->name)) { 331 if (!request_mem_region(wdt_mem->start, size, pdev->name)) {
325 dev_err(dev, "failed to get memory region\n"); 332 dev_err(dev, "failed to get memory region\n");
326 return -EBUSY; 333 ret = -EBUSY;
334 goto err;
327 } 335 }
328 336
329 wdt_base = ioremap(wdt_mem->start, size); 337 wdt_base = ioremap(wdt_mem->start, size);
@@ -335,29 +343,17 @@ static int __devinit s3c2410wdt_probe(struct platform_device *pdev)
335 343
336 DBG("probe: mapped wdt_base=%p\n", wdt_base); 344 DBG("probe: mapped wdt_base=%p\n", wdt_base);
337 345
338 wdt_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
339 if (wdt_irq == NULL) {
340 dev_err(dev, "no irq resource specified\n");
341 ret = -ENOENT;
342 goto err_map;
343 }
344
345 ret = request_irq(wdt_irq->start, s3c2410wdt_irq, 0, pdev->name, pdev);
346 if (ret != 0) {
347 dev_err(dev, "failed to install irq (%d)\n", ret);
348 goto err_map;
349 }
350
351 wdt_clock = clk_get(&pdev->dev, "watchdog"); 346 wdt_clock = clk_get(&pdev->dev, "watchdog");
352 if (IS_ERR(wdt_clock)) { 347 if (IS_ERR(wdt_clock)) {
353 dev_err(dev, "failed to find watchdog clock source\n"); 348 dev_err(dev, "failed to find watchdog clock source\n");
354 ret = PTR_ERR(wdt_clock); 349 ret = PTR_ERR(wdt_clock);
355 goto err_irq; 350 goto err_map;
356 } 351 }
357 352
358 clk_enable(wdt_clock); 353 clk_enable(wdt_clock);
359 354
360 if (s3c2410wdt_cpufreq_register() < 0) { 355 ret = s3c2410wdt_cpufreq_register();
356 if (ret < 0) {
361 printk(KERN_ERR PFX "failed to register cpufreq\n"); 357 printk(KERN_ERR PFX "failed to register cpufreq\n");
362 goto err_clk; 358 goto err_clk;
363 } 359 }
@@ -378,12 +374,18 @@ static int __devinit s3c2410wdt_probe(struct platform_device *pdev)
378 "cannot start\n"); 374 "cannot start\n");
379 } 375 }
380 376
377 ret = request_irq(wdt_irq->start, s3c2410wdt_irq, 0, pdev->name, pdev);
378 if (ret != 0) {
379 dev_err(dev, "failed to install irq (%d)\n", ret);
380 goto err_cpufreq;
381 }
382
381 watchdog_set_nowayout(&s3c2410_wdd, nowayout); 383 watchdog_set_nowayout(&s3c2410_wdd, nowayout);
382 384
383 ret = watchdog_register_device(&s3c2410_wdd); 385 ret = watchdog_register_device(&s3c2410_wdd);
384 if (ret) { 386 if (ret) {
385 dev_err(dev, "cannot register watchdog (%d)\n", ret); 387 dev_err(dev, "cannot register watchdog (%d)\n", ret);
386 goto err_cpufreq; 388 goto err_irq;
387 } 389 }
388 390
389 if (tmr_atboot && started == 0) { 391 if (tmr_atboot && started == 0) {
@@ -408,23 +410,26 @@ static int __devinit s3c2410wdt_probe(struct platform_device *pdev)
408 410
409 return 0; 411 return 0;
410 412
413 err_irq:
414 free_irq(wdt_irq->start, pdev);
415
411 err_cpufreq: 416 err_cpufreq:
412 s3c2410wdt_cpufreq_deregister(); 417 s3c2410wdt_cpufreq_deregister();
413 418
414 err_clk: 419 err_clk:
415 clk_disable(wdt_clock); 420 clk_disable(wdt_clock);
416 clk_put(wdt_clock); 421 clk_put(wdt_clock);
417 422 wdt_clock = NULL;
418 err_irq:
419 free_irq(wdt_irq->start, pdev);
420 423
421 err_map: 424 err_map:
422 iounmap(wdt_base); 425 iounmap(wdt_base);
423 426
424 err_req: 427 err_req:
425 release_mem_region(wdt_mem->start, size); 428 release_mem_region(wdt_mem->start, size);
426 wdt_mem = NULL;
427 429
430 err:
431 wdt_irq = NULL;
432 wdt_mem = NULL;
428 return ret; 433 return ret;
429} 434}
430 435
@@ -432,18 +437,18 @@ static int __devexit s3c2410wdt_remove(struct platform_device *dev)
432{ 437{
433 watchdog_unregister_device(&s3c2410_wdd); 438 watchdog_unregister_device(&s3c2410_wdd);
434 439
440 free_irq(wdt_irq->start, dev);
441
435 s3c2410wdt_cpufreq_deregister(); 442 s3c2410wdt_cpufreq_deregister();
436 443
437 clk_disable(wdt_clock); 444 clk_disable(wdt_clock);
438 clk_put(wdt_clock); 445 clk_put(wdt_clock);
439 wdt_clock = NULL; 446 wdt_clock = NULL;
440 447
441 free_irq(wdt_irq->start, dev);
442 wdt_irq = NULL;
443
444 iounmap(wdt_base); 448 iounmap(wdt_base);
445 449
446 release_mem_region(wdt_mem->start, resource_size(wdt_mem)); 450 release_mem_region(wdt_mem->start, resource_size(wdt_mem));
451 wdt_irq = NULL;
447 wdt_mem = NULL; 452 wdt_mem = NULL;
448 return 0; 453 return 0;
449} 454}
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index bcb884e2d613..07d096c49920 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -1421,7 +1421,7 @@ static int fill_thread_core_info(struct elf_thread_core_info *t,
1421 for (i = 1; i < view->n; ++i) { 1421 for (i = 1; i < view->n; ++i) {
1422 const struct user_regset *regset = &view->regsets[i]; 1422 const struct user_regset *regset = &view->regsets[i];
1423 do_thread_regset_writeback(t->task, regset); 1423 do_thread_regset_writeback(t->task, regset);
1424 if (regset->core_note_type && 1424 if (regset->core_note_type && regset->get &&
1425 (!regset->active || regset->active(t->task, regset))) { 1425 (!regset->active || regset->active(t->task, regset))) {
1426 int ret; 1426 int ret;
1427 size_t size = regset->n * regset->size; 1427 size_t size = regset->n * regset->size;
diff --git a/fs/dcache.c b/fs/dcache.c
index fe19ac13f75f..138be96e25b6 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -104,7 +104,7 @@ static unsigned int d_hash_shift __read_mostly;
104 104
105static struct hlist_bl_head *dentry_hashtable __read_mostly; 105static struct hlist_bl_head *dentry_hashtable __read_mostly;
106 106
107static inline struct hlist_bl_head *d_hash(struct dentry *parent, 107static inline struct hlist_bl_head *d_hash(const struct dentry *parent,
108 unsigned long hash) 108 unsigned long hash)
109{ 109{
110 hash += ((unsigned long) parent ^ GOLDEN_RATIO_PRIME) / L1_CACHE_BYTES; 110 hash += ((unsigned long) parent ^ GOLDEN_RATIO_PRIME) / L1_CACHE_BYTES;
@@ -1717,8 +1717,9 @@ EXPORT_SYMBOL(d_add_ci);
1717 * child is looked up. Thus, an interlocking stepping of sequence lock checks 1717 * child is looked up. Thus, an interlocking stepping of sequence lock checks
1718 * is formed, giving integrity down the path walk. 1718 * is formed, giving integrity down the path walk.
1719 */ 1719 */
1720struct dentry *__d_lookup_rcu(struct dentry *parent, struct qstr *name, 1720struct dentry *__d_lookup_rcu(const struct dentry *parent,
1721 unsigned *seq, struct inode **inode) 1721 const struct qstr *name,
1722 unsigned *seqp, struct inode **inode)
1722{ 1723{
1723 unsigned int len = name->len; 1724 unsigned int len = name->len;
1724 unsigned int hash = name->hash; 1725 unsigned int hash = name->hash;
@@ -1748,6 +1749,7 @@ struct dentry *__d_lookup_rcu(struct dentry *parent, struct qstr *name,
1748 * See Documentation/filesystems/path-lookup.txt for more details. 1749 * See Documentation/filesystems/path-lookup.txt for more details.
1749 */ 1750 */
1750 hlist_bl_for_each_entry_rcu(dentry, node, b, d_hash) { 1751 hlist_bl_for_each_entry_rcu(dentry, node, b, d_hash) {
1752 unsigned seq;
1751 struct inode *i; 1753 struct inode *i;
1752 const char *tname; 1754 const char *tname;
1753 int tlen; 1755 int tlen;
@@ -1756,7 +1758,7 @@ struct dentry *__d_lookup_rcu(struct dentry *parent, struct qstr *name,
1756 continue; 1758 continue;
1757 1759
1758seqretry: 1760seqretry:
1759 *seq = read_seqcount_begin(&dentry->d_seq); 1761 seq = read_seqcount_begin(&dentry->d_seq);
1760 if (dentry->d_parent != parent) 1762 if (dentry->d_parent != parent)
1761 continue; 1763 continue;
1762 if (d_unhashed(dentry)) 1764 if (d_unhashed(dentry))
@@ -1771,7 +1773,7 @@ seqretry:
1771 * edge of memory when walking. If we could load this 1773 * edge of memory when walking. If we could load this
1772 * atomically some other way, we could drop this check. 1774 * atomically some other way, we could drop this check.
1773 */ 1775 */
1774 if (read_seqcount_retry(&dentry->d_seq, *seq)) 1776 if (read_seqcount_retry(&dentry->d_seq, seq))
1775 goto seqretry; 1777 goto seqretry;
1776 if (unlikely(parent->d_flags & DCACHE_OP_COMPARE)) { 1778 if (unlikely(parent->d_flags & DCACHE_OP_COMPARE)) {
1777 if (parent->d_op->d_compare(parent, *inode, 1779 if (parent->d_op->d_compare(parent, *inode,
@@ -1788,6 +1790,7 @@ seqretry:
1788 * order to do anything useful with the returned dentry 1790 * order to do anything useful with the returned dentry
1789 * anyway. 1791 * anyway.
1790 */ 1792 */
1793 *seqp = seq;
1791 *inode = i; 1794 *inode = i;
1792 return dentry; 1795 return dentry;
1793 } 1796 }
diff --git a/fs/ecryptfs/miscdev.c b/fs/ecryptfs/miscdev.c
index 349209dc6a91..3a06f4043df4 100644
--- a/fs/ecryptfs/miscdev.c
+++ b/fs/ecryptfs/miscdev.c
@@ -429,7 +429,7 @@ ecryptfs_miscdev_write(struct file *file, const char __user *buf,
429 goto memdup; 429 goto memdup;
430 } else if (count < MIN_MSG_PKT_SIZE || count > MAX_MSG_PKT_SIZE) { 430 } else if (count < MIN_MSG_PKT_SIZE || count > MAX_MSG_PKT_SIZE) {
431 printk(KERN_WARNING "%s: Acceptable packet size range is " 431 printk(KERN_WARNING "%s: Acceptable packet size range is "
432 "[%d-%lu], but amount of data written is [%zu].", 432 "[%d-%zu], but amount of data written is [%zu].",
433 __func__, MIN_MSG_PKT_SIZE, MAX_MSG_PKT_SIZE, count); 433 __func__, MIN_MSG_PKT_SIZE, MAX_MSG_PKT_SIZE, count);
434 return -EINVAL; 434 return -EINVAL;
435 } 435 }
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index 376816fcd040..351a3e797789 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -167,14 +167,19 @@ void gfs2_glock_add_to_lru(struct gfs2_glock *gl)
167 spin_unlock(&lru_lock); 167 spin_unlock(&lru_lock);
168} 168}
169 169
170static void gfs2_glock_remove_from_lru(struct gfs2_glock *gl) 170static void __gfs2_glock_remove_from_lru(struct gfs2_glock *gl)
171{ 171{
172 spin_lock(&lru_lock);
173 if (!list_empty(&gl->gl_lru)) { 172 if (!list_empty(&gl->gl_lru)) {
174 list_del_init(&gl->gl_lru); 173 list_del_init(&gl->gl_lru);
175 atomic_dec(&lru_count); 174 atomic_dec(&lru_count);
176 clear_bit(GLF_LRU, &gl->gl_flags); 175 clear_bit(GLF_LRU, &gl->gl_flags);
177 } 176 }
177}
178
179static void gfs2_glock_remove_from_lru(struct gfs2_glock *gl)
180{
181 spin_lock(&lru_lock);
182 __gfs2_glock_remove_from_lru(gl);
178 spin_unlock(&lru_lock); 183 spin_unlock(&lru_lock);
179} 184}
180 185
@@ -217,11 +222,12 @@ void gfs2_glock_put(struct gfs2_glock *gl)
217 struct gfs2_sbd *sdp = gl->gl_sbd; 222 struct gfs2_sbd *sdp = gl->gl_sbd;
218 struct address_space *mapping = gfs2_glock2aspace(gl); 223 struct address_space *mapping = gfs2_glock2aspace(gl);
219 224
220 if (atomic_dec_and_test(&gl->gl_ref)) { 225 if (atomic_dec_and_lock(&gl->gl_ref, &lru_lock)) {
226 __gfs2_glock_remove_from_lru(gl);
227 spin_unlock(&lru_lock);
221 spin_lock_bucket(gl->gl_hash); 228 spin_lock_bucket(gl->gl_hash);
222 hlist_bl_del_rcu(&gl->gl_list); 229 hlist_bl_del_rcu(&gl->gl_list);
223 spin_unlock_bucket(gl->gl_hash); 230 spin_unlock_bucket(gl->gl_hash);
224 gfs2_glock_remove_from_lru(gl);
225 GLOCK_BUG_ON(gl, !list_empty(&gl->gl_holders)); 231 GLOCK_BUG_ON(gl, !list_empty(&gl->gl_holders));
226 GLOCK_BUG_ON(gl, mapping && mapping->nrpages); 232 GLOCK_BUG_ON(gl, mapping && mapping->nrpages);
227 trace_gfs2_glock_put(gl); 233 trace_gfs2_glock_put(gl);
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index a7d611b93f0f..56987460cdae 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -391,10 +391,6 @@ static int alloc_dinode(struct gfs2_inode *dip, u64 *no_addr, u64 *generation)
391 int error; 391 int error;
392 int dblocks = 1; 392 int dblocks = 1;
393 393
394 error = gfs2_rindex_update(sdp);
395 if (error)
396 fs_warn(sdp, "rindex update returns %d\n", error);
397
398 error = gfs2_inplace_reserve(dip, RES_DINODE); 394 error = gfs2_inplace_reserve(dip, RES_DINODE);
399 if (error) 395 if (error)
400 goto out; 396 goto out;
@@ -1043,6 +1039,7 @@ static int gfs2_unlink(struct inode *dir, struct dentry *dentry)
1043 rgd = gfs2_blk2rgrpd(sdp, ip->i_no_addr); 1039 rgd = gfs2_blk2rgrpd(sdp, ip->i_no_addr);
1044 if (!rgd) 1040 if (!rgd)
1045 goto out_inodes; 1041 goto out_inodes;
1042
1046 gfs2_holder_init(rgd->rd_gl, LM_ST_EXCLUSIVE, 0, ghs + 2); 1043 gfs2_holder_init(rgd->rd_gl, LM_ST_EXCLUSIVE, 0, ghs + 2);
1047 1044
1048 1045
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
index 6aacf3f230a2..24f609c9ef91 100644
--- a/fs/gfs2/ops_fstype.c
+++ b/fs/gfs2/ops_fstype.c
@@ -800,6 +800,11 @@ static int init_inodes(struct gfs2_sbd *sdp, int undo)
800 fs_err(sdp, "can't get quota file inode: %d\n", error); 800 fs_err(sdp, "can't get quota file inode: %d\n", error);
801 goto fail_rindex; 801 goto fail_rindex;
802 } 802 }
803
804 error = gfs2_rindex_update(sdp);
805 if (error)
806 goto fail_qinode;
807
803 return 0; 808 return 0;
804 809
805fail_qinode: 810fail_qinode:
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
index 981bfa32121a..49ada95209d0 100644
--- a/fs/gfs2/rgrp.c
+++ b/fs/gfs2/rgrp.c
@@ -683,16 +683,21 @@ int gfs2_rindex_update(struct gfs2_sbd *sdp)
683 struct gfs2_glock *gl = ip->i_gl; 683 struct gfs2_glock *gl = ip->i_gl;
684 struct gfs2_holder ri_gh; 684 struct gfs2_holder ri_gh;
685 int error = 0; 685 int error = 0;
686 int unlock_required = 0;
686 687
687 /* Read new copy from disk if we don't have the latest */ 688 /* Read new copy from disk if we don't have the latest */
688 if (!sdp->sd_rindex_uptodate) { 689 if (!sdp->sd_rindex_uptodate) {
689 mutex_lock(&sdp->sd_rindex_mutex); 690 mutex_lock(&sdp->sd_rindex_mutex);
690 error = gfs2_glock_nq_init(gl, LM_ST_SHARED, 0, &ri_gh); 691 if (!gfs2_glock_is_locked_by_me(gl)) {
691 if (error) 692 error = gfs2_glock_nq_init(gl, LM_ST_SHARED, 0, &ri_gh);
692 return error; 693 if (error)
694 return error;
695 unlock_required = 1;
696 }
693 if (!sdp->sd_rindex_uptodate) 697 if (!sdp->sd_rindex_uptodate)
694 error = gfs2_ri_update(ip); 698 error = gfs2_ri_update(ip);
695 gfs2_glock_dq_uninit(&ri_gh); 699 if (unlock_required)
700 gfs2_glock_dq_uninit(&ri_gh);
696 mutex_unlock(&sdp->sd_rindex_mutex); 701 mutex_unlock(&sdp->sd_rindex_mutex);
697 } 702 }
698 703
diff --git a/fs/namei.c b/fs/namei.c
index a780ea515c47..e2ba62820a0f 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1374,6 +1374,34 @@ static inline int can_lookup(struct inode *inode)
1374 return 1; 1374 return 1;
1375} 1375}
1376 1376
1377unsigned int full_name_hash(const unsigned char *name, unsigned int len)
1378{
1379 unsigned long hash = init_name_hash();
1380 while (len--)
1381 hash = partial_name_hash(*name++, hash);
1382 return end_name_hash(hash);
1383}
1384EXPORT_SYMBOL(full_name_hash);
1385
1386/*
1387 * We know there's a real path component here of at least
1388 * one character.
1389 */
1390static inline unsigned long hash_name(const char *name, unsigned int *hashp)
1391{
1392 unsigned long hash = init_name_hash();
1393 unsigned long len = 0, c;
1394
1395 c = (unsigned char)*name;
1396 do {
1397 len++;
1398 hash = partial_name_hash(c, hash);
1399 c = (unsigned char)name[len];
1400 } while (c && c != '/');
1401 *hashp = end_name_hash(hash);
1402 return len;
1403}
1404
1377/* 1405/*
1378 * Name resolution. 1406 * Name resolution.
1379 * This is the basic name resolution function, turning a pathname into 1407 * This is the basic name resolution function, turning a pathname into
@@ -1394,31 +1422,22 @@ static int link_path_walk(const char *name, struct nameidata *nd)
1394 1422
1395 /* At this point we know we have a real path component. */ 1423 /* At this point we know we have a real path component. */
1396 for(;;) { 1424 for(;;) {
1397 unsigned long hash;
1398 struct qstr this; 1425 struct qstr this;
1399 unsigned int c; 1426 long len;
1400 int type; 1427 int type;
1401 1428
1402 err = may_lookup(nd); 1429 err = may_lookup(nd);
1403 if (err) 1430 if (err)
1404 break; 1431 break;
1405 1432
1433 len = hash_name(name, &this.hash);
1406 this.name = name; 1434 this.name = name;
1407 c = *(const unsigned char *)name; 1435 this.len = len;
1408
1409 hash = init_name_hash();
1410 do {
1411 name++;
1412 hash = partial_name_hash(c, hash);
1413 c = *(const unsigned char *)name;
1414 } while (c && (c != '/'));
1415 this.len = name - (const char *) this.name;
1416 this.hash = end_name_hash(hash);
1417 1436
1418 type = LAST_NORM; 1437 type = LAST_NORM;
1419 if (this.name[0] == '.') switch (this.len) { 1438 if (name[0] == '.') switch (len) {
1420 case 2: 1439 case 2:
1421 if (this.name[1] == '.') { 1440 if (name[1] == '.') {
1422 type = LAST_DOTDOT; 1441 type = LAST_DOTDOT;
1423 nd->flags |= LOOKUP_JUMPED; 1442 nd->flags |= LOOKUP_JUMPED;
1424 } 1443 }
@@ -1437,12 +1456,18 @@ static int link_path_walk(const char *name, struct nameidata *nd)
1437 } 1456 }
1438 } 1457 }
1439 1458
1440 /* remove trailing slashes? */ 1459 if (!name[len])
1441 if (!c)
1442 goto last_component; 1460 goto last_component;
1443 while (*++name == '/'); 1461 /*
1444 if (!*name) 1462 * If it wasn't NUL, we know it was '/'. Skip that
1463 * slash, and continue until no more slashes.
1464 */
1465 do {
1466 len++;
1467 } while (unlikely(name[len] == '/'));
1468 if (!name[len])
1445 goto last_component; 1469 goto last_component;
1470 name += len;
1446 1471
1447 err = walk_component(nd, &next, &this, type, LOOKUP_FOLLOW); 1472 err = walk_component(nd, &next, &this, type, LOOKUP_FOLLOW);
1448 if (err < 0) 1473 if (err < 0)
@@ -1775,24 +1800,21 @@ static struct dentry *lookup_hash(struct nameidata *nd)
1775struct dentry *lookup_one_len(const char *name, struct dentry *base, int len) 1800struct dentry *lookup_one_len(const char *name, struct dentry *base, int len)
1776{ 1801{
1777 struct qstr this; 1802 struct qstr this;
1778 unsigned long hash;
1779 unsigned int c; 1803 unsigned int c;
1780 1804
1781 WARN_ON_ONCE(!mutex_is_locked(&base->d_inode->i_mutex)); 1805 WARN_ON_ONCE(!mutex_is_locked(&base->d_inode->i_mutex));
1782 1806
1783 this.name = name; 1807 this.name = name;
1784 this.len = len; 1808 this.len = len;
1809 this.hash = full_name_hash(name, len);
1785 if (!len) 1810 if (!len)
1786 return ERR_PTR(-EACCES); 1811 return ERR_PTR(-EACCES);
1787 1812
1788 hash = init_name_hash();
1789 while (len--) { 1813 while (len--) {
1790 c = *(const unsigned char *)name++; 1814 c = *(const unsigned char *)name++;
1791 if (c == '/' || c == '\0') 1815 if (c == '/' || c == '\0')
1792 return ERR_PTR(-EACCES); 1816 return ERR_PTR(-EACCES);
1793 hash = partial_name_hash(c, hash);
1794 } 1817 }
1795 this.hash = end_name_hash(hash);
1796 /* 1818 /*
1797 * See if the low-level filesystem might want 1819 * See if the low-level filesystem might want
1798 * to use its own hash.. 1820 * to use its own hash..
diff --git a/fs/ntfs/attrib.c b/fs/ntfs/attrib.c
index f14fde2b03d6..e0281992ddc3 100644
--- a/fs/ntfs/attrib.c
+++ b/fs/ntfs/attrib.c
@@ -1,7 +1,7 @@
1/** 1/**
2 * attrib.c - NTFS attribute operations. Part of the Linux-NTFS project. 2 * attrib.c - NTFS attribute operations. Part of the Linux-NTFS project.
3 * 3 *
4 * Copyright (c) 2001-2007 Anton Altaparmakov 4 * Copyright (c) 2001-2012 Anton Altaparmakov and Tuxera Inc.
5 * Copyright (c) 2002 Richard Russon 5 * Copyright (c) 2002 Richard Russon
6 * 6 *
7 * This program/include file is free software; you can redistribute it and/or 7 * This program/include file is free software; you can redistribute it and/or
@@ -345,10 +345,10 @@ LCN ntfs_attr_vcn_to_lcn_nolock(ntfs_inode *ni, const VCN vcn,
345 unsigned long flags; 345 unsigned long flags;
346 bool is_retry = false; 346 bool is_retry = false;
347 347
348 BUG_ON(!ni);
348 ntfs_debug("Entering for i_ino 0x%lx, vcn 0x%llx, %s_locked.", 349 ntfs_debug("Entering for i_ino 0x%lx, vcn 0x%llx, %s_locked.",
349 ni->mft_no, (unsigned long long)vcn, 350 ni->mft_no, (unsigned long long)vcn,
350 write_locked ? "write" : "read"); 351 write_locked ? "write" : "read");
351 BUG_ON(!ni);
352 BUG_ON(!NInoNonResident(ni)); 352 BUG_ON(!NInoNonResident(ni));
353 BUG_ON(vcn < 0); 353 BUG_ON(vcn < 0);
354 if (!ni->runlist.rl) { 354 if (!ni->runlist.rl) {
@@ -469,9 +469,9 @@ runlist_element *ntfs_attr_find_vcn_nolock(ntfs_inode *ni, const VCN vcn,
469 int err = 0; 469 int err = 0;
470 bool is_retry = false; 470 bool is_retry = false;
471 471
472 BUG_ON(!ni);
472 ntfs_debug("Entering for i_ino 0x%lx, vcn 0x%llx, with%s ctx.", 473 ntfs_debug("Entering for i_ino 0x%lx, vcn 0x%llx, with%s ctx.",
473 ni->mft_no, (unsigned long long)vcn, ctx ? "" : "out"); 474 ni->mft_no, (unsigned long long)vcn, ctx ? "" : "out");
474 BUG_ON(!ni);
475 BUG_ON(!NInoNonResident(ni)); 475 BUG_ON(!NInoNonResident(ni));
476 BUG_ON(vcn < 0); 476 BUG_ON(vcn < 0);
477 if (!ni->runlist.rl) { 477 if (!ni->runlist.rl) {
diff --git a/fs/ntfs/mft.c b/fs/ntfs/mft.c
index 382857f9c7db..3014a36a255b 100644
--- a/fs/ntfs/mft.c
+++ b/fs/ntfs/mft.c
@@ -1,7 +1,7 @@
1/** 1/**
2 * mft.c - NTFS kernel mft record operations. Part of the Linux-NTFS project. 2 * mft.c - NTFS kernel mft record operations. Part of the Linux-NTFS project.
3 * 3 *
4 * Copyright (c) 2001-2011 Anton Altaparmakov and Tuxera Inc. 4 * Copyright (c) 2001-2012 Anton Altaparmakov and Tuxera Inc.
5 * Copyright (c) 2002 Richard Russon 5 * Copyright (c) 2002 Richard Russon
6 * 6 *
7 * This program/include file is free software; you can redistribute it and/or 7 * This program/include file is free software; you can redistribute it and/or
@@ -1367,7 +1367,7 @@ static int ntfs_mft_bitmap_extend_allocation_nolock(ntfs_volume *vol)
1367 ntfs_error(vol->sb, "Failed to merge runlists for mft " 1367 ntfs_error(vol->sb, "Failed to merge runlists for mft "
1368 "bitmap."); 1368 "bitmap.");
1369 if (ntfs_cluster_free_from_rl(vol, rl2)) { 1369 if (ntfs_cluster_free_from_rl(vol, rl2)) {
1370 ntfs_error(vol->sb, "Failed to dealocate " 1370 ntfs_error(vol->sb, "Failed to deallocate "
1371 "allocated cluster.%s", es); 1371 "allocated cluster.%s", es);
1372 NVolSetErrors(vol); 1372 NVolSetErrors(vol);
1373 } 1373 }
@@ -1805,7 +1805,7 @@ static int ntfs_mft_data_extend_allocation_nolock(ntfs_volume *vol)
1805 ntfs_error(vol->sb, "Failed to merge runlists for mft data " 1805 ntfs_error(vol->sb, "Failed to merge runlists for mft data "
1806 "attribute."); 1806 "attribute.");
1807 if (ntfs_cluster_free_from_rl(vol, rl2)) { 1807 if (ntfs_cluster_free_from_rl(vol, rl2)) {
1808 ntfs_error(vol->sb, "Failed to dealocate clusters " 1808 ntfs_error(vol->sb, "Failed to deallocate clusters "
1809 "from the mft data attribute.%s", es); 1809 "from the mft data attribute.%s", es);
1810 NVolSetErrors(vol); 1810 NVolSetErrors(vol);
1811 } 1811 }
diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c
index 5a4a8af5c406..f907611cca73 100644
--- a/fs/ntfs/super.c
+++ b/fs/ntfs/super.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * super.c - NTFS kernel super block handling. Part of the Linux-NTFS project. 2 * super.c - NTFS kernel super block handling. Part of the Linux-NTFS project.
3 * 3 *
4 * Copyright (c) 2001-2011 Anton Altaparmakov and Tuxera Inc. 4 * Copyright (c) 2001-2012 Anton Altaparmakov and Tuxera Inc.
5 * Copyright (c) 2001,2002 Richard Russon 5 * Copyright (c) 2001,2002 Richard Russon
6 * 6 *
7 * This program/include file is free software; you can redistribute it and/or 7 * This program/include file is free software; you can redistribute it and/or
@@ -1239,7 +1239,6 @@ static int check_windows_hibernation_status(ntfs_volume *vol)
1239{ 1239{
1240 MFT_REF mref; 1240 MFT_REF mref;
1241 struct inode *vi; 1241 struct inode *vi;
1242 ntfs_inode *ni;
1243 struct page *page; 1242 struct page *page;
1244 u32 *kaddr, *kend; 1243 u32 *kaddr, *kend;
1245 ntfs_name *name = NULL; 1244 ntfs_name *name = NULL;
@@ -1290,7 +1289,6 @@ static int check_windows_hibernation_status(ntfs_volume *vol)
1290 "is not the system volume.", i_size_read(vi)); 1289 "is not the system volume.", i_size_read(vi));
1291 goto iput_out; 1290 goto iput_out;
1292 } 1291 }
1293 ni = NTFS_I(vi);
1294 page = ntfs_map_page(vi->i_mapping, 0); 1292 page = ntfs_map_page(vi->i_mapping, 0);
1295 if (IS_ERR(page)) { 1293 if (IS_ERR(page)) {
1296 ntfs_error(vol->sb, "Failed to read from hiberfil.sys."); 1294 ntfs_error(vol->sb, "Failed to read from hiberfil.sys.");
diff --git a/include/asm-generic/iomap.h b/include/asm-generic/iomap.h
index 8a3d4fde2604..6afd7d6a9899 100644
--- a/include/asm-generic/iomap.h
+++ b/include/asm-generic/iomap.h
@@ -70,7 +70,7 @@ extern void ioport_unmap(void __iomem *);
70/* Destroy a virtual mapping cookie for a PCI BAR (memory or IO) */ 70/* Destroy a virtual mapping cookie for a PCI BAR (memory or IO) */
71struct pci_dev; 71struct pci_dev;
72extern void pci_iounmap(struct pci_dev *dev, void __iomem *); 72extern void pci_iounmap(struct pci_dev *dev, void __iomem *);
73#else 73#elif defined(CONFIG_GENERIC_IOMAP)
74struct pci_dev; 74struct pci_dev;
75static inline void pci_iounmap(struct pci_dev *dev, void __iomem *addr) 75static inline void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
76{ } 76{ }
diff --git a/include/asm-generic/pci_iomap.h b/include/asm-generic/pci_iomap.h
index e58fcf891370..ce37349860fe 100644
--- a/include/asm-generic/pci_iomap.h
+++ b/include/asm-generic/pci_iomap.h
@@ -25,7 +25,7 @@ extern void __iomem *__pci_ioport_map(struct pci_dev *dev, unsigned long port,
25#define __pci_ioport_map(dev, port, nr) ioport_map((port), (nr)) 25#define __pci_ioport_map(dev, port, nr) ioport_map((port), (nr))
26#endif 26#endif
27 27
28#else 28#elif defined(CONFIG_GENERIC_PCI_IOMAP)
29static inline void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max) 29static inline void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max)
30{ 30{
31 return NULL; 31 return NULL;
diff --git a/include/drm/Kbuild b/include/drm/Kbuild
index a5c0e10fd47d..1e38a19d68f6 100644
--- a/include/drm/Kbuild
+++ b/include/drm/Kbuild
@@ -2,6 +2,7 @@ header-y += drm.h
2header-y += drm_fourcc.h 2header-y += drm_fourcc.h
3header-y += drm_mode.h 3header-y += drm_mode.h
4header-y += drm_sarea.h 4header-y += drm_sarea.h
5header-y += exynos_drm.h
5header-y += i810_drm.h 6header-y += i810_drm.h
6header-y += i915_drm.h 7header-y += i915_drm.h
7header-y += mga_drm.h 8header-y += mga_drm.h
diff --git a/include/drm/exynos_drm.h b/include/drm/exynos_drm.h
index 5e120f1c5cd9..1ed3aae893a5 100644
--- a/include/drm/exynos_drm.h
+++ b/include/drm/exynos_drm.h
@@ -97,15 +97,30 @@ struct drm_exynos_plane_set_zpos {
97#define DRM_IOCTL_EXYNOS_PLANE_SET_ZPOS DRM_IOWR(DRM_COMMAND_BASE + \ 97#define DRM_IOCTL_EXYNOS_PLANE_SET_ZPOS DRM_IOWR(DRM_COMMAND_BASE + \
98 DRM_EXYNOS_PLANE_SET_ZPOS, struct drm_exynos_plane_set_zpos) 98 DRM_EXYNOS_PLANE_SET_ZPOS, struct drm_exynos_plane_set_zpos)
99 99
100#ifdef __KERNEL__
101
100/** 102/**
101 * Platform Specific Structure for DRM based FIMD. 103 * A structure for lcd panel information.
102 * 104 *
103 * @timing: default video mode for initializing 105 * @timing: default video mode for initializing
106 * @width_mm: physical size of lcd width.
107 * @height_mm: physical size of lcd height.
108 */
109struct exynos_drm_panel_info {
110 struct fb_videomode timing;
111 u32 width_mm;
112 u32 height_mm;
113};
114
115/**
116 * Platform Specific Structure for DRM based FIMD.
117 *
118 * @panel: default panel info for initializing
104 * @default_win: default window layer number to be used for UI. 119 * @default_win: default window layer number to be used for UI.
105 * @bpp: default bit per pixel. 120 * @bpp: default bit per pixel.
106 */ 121 */
107struct exynos_drm_fimd_pdata { 122struct exynos_drm_fimd_pdata {
108 struct fb_videomode timing; 123 struct exynos_drm_panel_info panel;
109 u32 vidcon0; 124 u32 vidcon0;
110 u32 vidcon1; 125 u32 vidcon1;
111 unsigned int default_win; 126 unsigned int default_win;
@@ -139,4 +154,5 @@ struct exynos_drm_hdmi_pdata {
139 unsigned int bpp; 154 unsigned int bpp;
140}; 155};
141 156
142#endif 157#endif /* __KERNEL__ */
158#endif /* _EXYNOS_DRM_H_ */
diff --git a/include/linux/compat.h b/include/linux/compat.h
index 41c9f6515f46..7e05fcee75a1 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -561,5 +561,9 @@ asmlinkage ssize_t compat_sys_process_vm_writev(compat_pid_t pid,
561 unsigned long liovcnt, const struct compat_iovec __user *rvec, 561 unsigned long liovcnt, const struct compat_iovec __user *rvec,
562 unsigned long riovcnt, unsigned long flags); 562 unsigned long riovcnt, unsigned long flags);
563 563
564#else
565
566#define is_compat_task() (0)
567
564#endif /* CONFIG_COMPAT */ 568#endif /* CONFIG_COMPAT */
565#endif /* _LINUX_COMPAT_H */ 569#endif /* _LINUX_COMPAT_H */
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index d64a55b23afd..4270bedd2308 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -54,18 +54,17 @@ extern struct dentry_stat_t dentry_stat;
54static inline int dentry_cmp(const unsigned char *cs, size_t scount, 54static inline int dentry_cmp(const unsigned char *cs, size_t scount,
55 const unsigned char *ct, size_t tcount) 55 const unsigned char *ct, size_t tcount)
56{ 56{
57 int ret;
58 if (scount != tcount) 57 if (scount != tcount)
59 return 1; 58 return 1;
59
60 do { 60 do {
61 ret = (*cs != *ct); 61 if (*cs != *ct)
62 if (ret) 62 return 1;
63 break;
64 cs++; 63 cs++;
65 ct++; 64 ct++;
66 tcount--; 65 tcount--;
67 } while (tcount); 66 } while (tcount);
68 return ret; 67 return 0;
69} 68}
70 69
71/* Name hashing routines. Initial hash value */ 70/* Name hashing routines. Initial hash value */
@@ -89,14 +88,7 @@ static inline unsigned long end_name_hash(unsigned long hash)
89} 88}
90 89
91/* Compute the hash for a name string. */ 90/* Compute the hash for a name string. */
92static inline unsigned int 91extern unsigned int full_name_hash(const unsigned char *, unsigned int);
93full_name_hash(const unsigned char *name, unsigned int len)
94{
95 unsigned long hash = init_name_hash();
96 while (len--)
97 hash = partial_name_hash(*name++, hash);
98 return end_name_hash(hash);
99}
100 92
101/* 93/*
102 * Try to keep struct dentry aligned on 64 byte cachelines (this will 94 * Try to keep struct dentry aligned on 64 byte cachelines (this will
@@ -309,7 +301,8 @@ extern struct dentry *d_ancestor(struct dentry *, struct dentry *);
309extern struct dentry *d_lookup(struct dentry *, struct qstr *); 301extern struct dentry *d_lookup(struct dentry *, struct qstr *);
310extern struct dentry *d_hash_and_lookup(struct dentry *, struct qstr *); 302extern struct dentry *d_hash_and_lookup(struct dentry *, struct qstr *);
311extern struct dentry *__d_lookup(struct dentry *, struct qstr *); 303extern struct dentry *__d_lookup(struct dentry *, struct qstr *);
312extern struct dentry *__d_lookup_rcu(struct dentry *parent, struct qstr *name, 304extern struct dentry *__d_lookup_rcu(const struct dentry *parent,
305 const struct qstr *name,
313 unsigned *seq, struct inode **inode); 306 unsigned *seq, struct inode **inode);
314 307
315/** 308/**
diff --git a/include/linux/if_link.h b/include/linux/if_link.h
index c52d4b5f872a..4b24ff453aee 100644
--- a/include/linux/if_link.h
+++ b/include/linux/if_link.h
@@ -137,6 +137,7 @@ enum {
137 IFLA_AF_SPEC, 137 IFLA_AF_SPEC,
138 IFLA_GROUP, /* Group the device belongs to */ 138 IFLA_GROUP, /* Group the device belongs to */
139 IFLA_NET_NS_FD, 139 IFLA_NET_NS_FD,
140 IFLA_EXT_MASK, /* Extended info mask, VFs, etc */
140 __IFLA_MAX 141 __IFLA_MAX
141}; 142};
142 143
diff --git a/include/linux/netfilter_bridge/ebtables.h b/include/linux/netfilter_bridge/ebtables.h
index 8797ed16feb2..4dd5bd6994a8 100644
--- a/include/linux/netfilter_bridge/ebtables.h
+++ b/include/linux/netfilter_bridge/ebtables.h
@@ -285,8 +285,8 @@ struct ebt_table {
285 struct module *me; 285 struct module *me;
286}; 286};
287 287
288#define EBT_ALIGN(s) (((s) + (__alignof__(struct ebt_replace)-1)) & \ 288#define EBT_ALIGN(s) (((s) + (__alignof__(struct _xt_align)-1)) & \
289 ~(__alignof__(struct ebt_replace)-1)) 289 ~(__alignof__(struct _xt_align)-1))
290extern struct ebt_table *ebt_register_table(struct net *net, 290extern struct ebt_table *ebt_register_table(struct net *net,
291 const struct ebt_table *table); 291 const struct ebt_table *table);
292extern void ebt_unregister_table(struct net *net, struct ebt_table *table); 292extern void ebt_unregister_table(struct net *net, struct ebt_table *table);
diff --git a/include/linux/regset.h b/include/linux/regset.h
index 8abee6556223..686f37327a49 100644
--- a/include/linux/regset.h
+++ b/include/linux/regset.h
@@ -335,8 +335,11 @@ static inline int copy_regset_to_user(struct task_struct *target,
335{ 335{
336 const struct user_regset *regset = &view->regsets[setno]; 336 const struct user_regset *regset = &view->regsets[setno];
337 337
338 if (!regset->get)
339 return -EOPNOTSUPP;
340
338 if (!access_ok(VERIFY_WRITE, data, size)) 341 if (!access_ok(VERIFY_WRITE, data, size))
339 return -EIO; 342 return -EFAULT;
340 343
341 return regset->get(target, regset, offset, size, NULL, data); 344 return regset->get(target, regset, offset, size, NULL, data);
342} 345}
@@ -358,8 +361,11 @@ static inline int copy_regset_from_user(struct task_struct *target,
358{ 361{
359 const struct user_regset *regset = &view->regsets[setno]; 362 const struct user_regset *regset = &view->regsets[setno];
360 363
364 if (!regset->set)
365 return -EOPNOTSUPP;
366
361 if (!access_ok(VERIFY_READ, data, size)) 367 if (!access_ok(VERIFY_READ, data, size))
362 return -EIO; 368 return -EFAULT;
363 369
364 return regset->set(target, regset, offset, size, NULL, data); 370 return regset->set(target, regset, offset, size, NULL, data);
365} 371}
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 8e872ead88b5..577592ea0ea0 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -602,6 +602,9 @@ struct tcamsg {
602#define TCA_ACT_TAB 1 /* attr type must be >=1 */ 602#define TCA_ACT_TAB 1 /* attr type must be >=1 */
603#define TCAA_MAX 1 603#define TCAA_MAX 1
604 604
605/* New extended info filters for IFLA_EXT_MASK */
606#define RTEXT_FILTER_VF (1 << 0)
607
605/* End of information exported to user level */ 608/* End of information exported to user level */
606 609
607#ifdef __KERNEL__ 610#ifdef __KERNEL__
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 50db9b04a552..ae86adee3746 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -1465,6 +1465,16 @@ static inline void skb_set_mac_header(struct sk_buff *skb, const int offset)
1465} 1465}
1466#endif /* NET_SKBUFF_DATA_USES_OFFSET */ 1466#endif /* NET_SKBUFF_DATA_USES_OFFSET */
1467 1467
1468static inline void skb_mac_header_rebuild(struct sk_buff *skb)
1469{
1470 if (skb_mac_header_was_set(skb)) {
1471 const unsigned char *old_mac = skb_mac_header(skb);
1472
1473 skb_set_mac_header(skb, -skb->mac_len);
1474 memmove(skb_mac_header(skb), old_mac, skb->mac_len);
1475 }
1476}
1477
1468static inline int skb_checksum_start_offset(const struct sk_buff *skb) 1478static inline int skb_checksum_start_offset(const struct sk_buff *skb)
1469{ 1479{
1470 return skb->csum_start - skb_headroom(skb); 1480 return skb->csum_start - skb_headroom(skb);
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index abaad6ed9b83..4a82ca0bb0b2 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -256,4 +256,6 @@ void l2cap_exit(void);
256int sco_init(void); 256int sco_init(void);
257void sco_exit(void); 257void sco_exit(void);
258 258
259void bt_sock_reclassify_lock(struct sock *sk, int proto);
260
259#endif /* __BLUETOOTH_H */ 261#endif /* __BLUETOOTH_H */
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index ea9231f4935f..453893b3120e 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -540,7 +540,7 @@ void hci_conn_put_device(struct hci_conn *conn);
540static inline void hci_conn_hold(struct hci_conn *conn) 540static inline void hci_conn_hold(struct hci_conn *conn)
541{ 541{
542 atomic_inc(&conn->refcnt); 542 atomic_inc(&conn->refcnt);
543 cancel_delayed_work_sync(&conn->disc_work); 543 cancel_delayed_work(&conn->disc_work);
544} 544}
545 545
546static inline void hci_conn_put(struct hci_conn *conn) 546static inline void hci_conn_put(struct hci_conn *conn)
@@ -559,9 +559,9 @@ static inline void hci_conn_put(struct hci_conn *conn)
559 } else { 559 } else {
560 timeo = msecs_to_jiffies(10); 560 timeo = msecs_to_jiffies(10);
561 } 561 }
562 cancel_delayed_work_sync(&conn->disc_work); 562 cancel_delayed_work(&conn->disc_work);
563 queue_delayed_work(conn->hdev->workqueue, 563 queue_delayed_work(conn->hdev->workqueue,
564 &conn->disc_work, jiffies + timeo); 564 &conn->disc_work, timeo);
565 } 565 }
566} 566}
567 567
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index 68f589150692..b1664ed884e6 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -611,7 +611,7 @@ static inline void l2cap_set_timer(struct l2cap_chan *chan,
611{ 611{
612 BT_DBG("chan %p state %d timeout %ld", chan, chan->state, timeout); 612 BT_DBG("chan %p state %d timeout %ld", chan, chan->state, timeout);
613 613
614 if (!__cancel_delayed_work(work)) 614 if (!cancel_delayed_work(work))
615 l2cap_chan_hold(chan); 615 l2cap_chan_hold(chan);
616 schedule_delayed_work(work, timeout); 616 schedule_delayed_work(work, timeout);
617} 617}
@@ -619,20 +619,20 @@ static inline void l2cap_set_timer(struct l2cap_chan *chan,
619static inline void l2cap_clear_timer(struct l2cap_chan *chan, 619static inline void l2cap_clear_timer(struct l2cap_chan *chan,
620 struct delayed_work *work) 620 struct delayed_work *work)
621{ 621{
622 if (__cancel_delayed_work(work)) 622 if (cancel_delayed_work(work))
623 l2cap_chan_put(chan); 623 l2cap_chan_put(chan);
624} 624}
625 625
626#define __set_chan_timer(c, t) l2cap_set_timer(c, &c->chan_timer, (t)) 626#define __set_chan_timer(c, t) l2cap_set_timer(c, &c->chan_timer, (t))
627#define __clear_chan_timer(c) l2cap_clear_timer(c, &c->chan_timer) 627#define __clear_chan_timer(c) l2cap_clear_timer(c, &c->chan_timer)
628#define __set_retrans_timer(c) l2cap_set_timer(c, &c->retrans_timer, \ 628#define __set_retrans_timer(c) l2cap_set_timer(c, &c->retrans_timer, \
629 L2CAP_DEFAULT_RETRANS_TO); 629 msecs_to_jiffies(L2CAP_DEFAULT_RETRANS_TO));
630#define __clear_retrans_timer(c) l2cap_clear_timer(c, &c->retrans_timer) 630#define __clear_retrans_timer(c) l2cap_clear_timer(c, &c->retrans_timer)
631#define __set_monitor_timer(c) l2cap_set_timer(c, &c->monitor_timer, \ 631#define __set_monitor_timer(c) l2cap_set_timer(c, &c->monitor_timer, \
632 L2CAP_DEFAULT_MONITOR_TO); 632 msecs_to_jiffies(L2CAP_DEFAULT_MONITOR_TO));
633#define __clear_monitor_timer(c) l2cap_clear_timer(c, &c->monitor_timer) 633#define __clear_monitor_timer(c) l2cap_clear_timer(c, &c->monitor_timer)
634#define __set_ack_timer(c) l2cap_set_timer(c, &chan->ack_timer, \ 634#define __set_ack_timer(c) l2cap_set_timer(c, &chan->ack_timer, \
635 L2CAP_DEFAULT_ACK_TO); 635 msecs_to_jiffies(L2CAP_DEFAULT_ACK_TO));
636#define __clear_ack_timer(c) l2cap_clear_timer(c, &c->ack_timer) 636#define __clear_ack_timer(c) l2cap_clear_timer(c, &c->ack_timer)
637 637
638static inline int __seq_offset(struct l2cap_chan *chan, __u16 seq1, __u16 seq2) 638static inline int __seq_offset(struct l2cap_chan *chan, __u16 seq1, __u16 seq2)
@@ -834,7 +834,7 @@ int l2cap_add_scid(struct l2cap_chan *chan, __u16 scid);
834struct l2cap_chan *l2cap_chan_create(struct sock *sk); 834struct l2cap_chan *l2cap_chan_create(struct sock *sk);
835void l2cap_chan_close(struct l2cap_chan *chan, int reason); 835void l2cap_chan_close(struct l2cap_chan *chan, int reason);
836void l2cap_chan_destroy(struct l2cap_chan *chan); 836void l2cap_chan_destroy(struct l2cap_chan *chan);
837inline int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid, 837int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid,
838 bdaddr_t *dst); 838 bdaddr_t *dst);
839int l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len, 839int l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len,
840 u32 priority); 840 u32 priority);
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index 8a2b0ae7dbd2..ab86036bbf0c 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -209,7 +209,7 @@ extern struct nf_conntrack_tuple_hash *
209__nf_conntrack_find(struct net *net, u16 zone, 209__nf_conntrack_find(struct net *net, u16 zone,
210 const struct nf_conntrack_tuple *tuple); 210 const struct nf_conntrack_tuple *tuple);
211 211
212extern void nf_conntrack_hash_insert(struct nf_conn *ct); 212extern int nf_conntrack_hash_check_insert(struct nf_conn *ct);
213extern void nf_ct_delete_from_lists(struct nf_conn *ct); 213extern void nf_ct_delete_from_lists(struct nf_conn *ct);
214extern void nf_ct_insert_dying_list(struct nf_conn *ct); 214extern void nf_ct_insert_dying_list(struct nf_conn *ct);
215 215
diff --git a/include/net/rtnetlink.h b/include/net/rtnetlink.h
index 678f1ffaf843..370293901971 100644
--- a/include/net/rtnetlink.h
+++ b/include/net/rtnetlink.h
@@ -6,7 +6,7 @@
6 6
7typedef int (*rtnl_doit_func)(struct sk_buff *, struct nlmsghdr *, void *); 7typedef int (*rtnl_doit_func)(struct sk_buff *, struct nlmsghdr *, void *);
8typedef int (*rtnl_dumpit_func)(struct sk_buff *, struct netlink_callback *); 8typedef int (*rtnl_dumpit_func)(struct sk_buff *, struct netlink_callback *);
9typedef u16 (*rtnl_calcit_func)(struct sk_buff *); 9typedef u16 (*rtnl_calcit_func)(struct sk_buff *, struct nlmsghdr *);
10 10
11extern int __rtnl_register(int protocol, int msgtype, 11extern int __rtnl_register(int protocol, int msgtype,
12 rtnl_doit_func, rtnl_dumpit_func, 12 rtnl_doit_func, rtnl_dumpit_func,
diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
index 6ba596b07a72..e33ed1bfa113 100644
--- a/include/trace/events/sched.h
+++ b/include/trace/events/sched.h
@@ -370,56 +370,6 @@ TRACE_EVENT(sched_stat_runtime,
370 (unsigned long long)__entry->vruntime) 370 (unsigned long long)__entry->vruntime)
371); 371);
372 372
373#ifdef CREATE_TRACE_POINTS
374static inline u64 trace_get_sleeptime(struct task_struct *tsk)
375{
376#ifdef CONFIG_SCHEDSTATS
377 u64 block, sleep;
378
379 block = tsk->se.statistics.block_start;
380 sleep = tsk->se.statistics.sleep_start;
381 tsk->se.statistics.block_start = 0;
382 tsk->se.statistics.sleep_start = 0;
383
384 return block ? block : sleep ? sleep : 0;
385#else
386 return 0;
387#endif
388}
389#endif
390
391/*
392 * Tracepoint for accounting sleeptime (time the task is sleeping
393 * or waiting for I/O).
394 */
395TRACE_EVENT(sched_stat_sleeptime,
396
397 TP_PROTO(struct task_struct *tsk, u64 now),
398
399 TP_ARGS(tsk, now),
400
401 TP_STRUCT__entry(
402 __array( char, comm, TASK_COMM_LEN )
403 __field( pid_t, pid )
404 __field( u64, sleeptime )
405 ),
406
407 TP_fast_assign(
408 memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN);
409 __entry->pid = tsk->pid;
410 __entry->sleeptime = trace_get_sleeptime(tsk);
411 __entry->sleeptime = __entry->sleeptime ?
412 now - __entry->sleeptime : 0;
413 )
414 TP_perf_assign(
415 __perf_count(__entry->sleeptime);
416 ),
417
418 TP_printk("comm=%s pid=%d sleeptime=%Lu [ns]",
419 __entry->comm, __entry->pid,
420 (unsigned long long)__entry->sleeptime)
421);
422
423/* 373/*
424 * Tracepoint for showing priority inheritance modifying a tasks 374 * Tracepoint for showing priority inheritance modifying a tasks
425 * priority. 375 * priority.
diff --git a/kernel/events/hw_breakpoint.c b/kernel/events/hw_breakpoint.c
index b7971d6f38bf..ee706ce44aa0 100644
--- a/kernel/events/hw_breakpoint.c
+++ b/kernel/events/hw_breakpoint.c
@@ -651,10 +651,10 @@ int __init init_hw_breakpoint(void)
651 651
652 err_alloc: 652 err_alloc:
653 for_each_possible_cpu(err_cpu) { 653 for_each_possible_cpu(err_cpu) {
654 if (err_cpu == cpu)
655 break;
656 for (i = 0; i < TYPE_MAX; i++) 654 for (i = 0; i < TYPE_MAX; i++)
657 kfree(per_cpu(nr_task_bp_pinned[i], cpu)); 655 kfree(per_cpu(nr_task_bp_pinned[i], cpu));
656 if (err_cpu == cpu)
657 break;
658 } 658 }
659 659
660 return -ENOMEM; 660 return -ENOMEM;
diff --git a/kernel/irq/autoprobe.c b/kernel/irq/autoprobe.c
index 342d8f44e401..0119b9d467ae 100644
--- a/kernel/irq/autoprobe.c
+++ b/kernel/irq/autoprobe.c
@@ -53,7 +53,7 @@ unsigned long probe_irq_on(void)
53 if (desc->irq_data.chip->irq_set_type) 53 if (desc->irq_data.chip->irq_set_type)
54 desc->irq_data.chip->irq_set_type(&desc->irq_data, 54 desc->irq_data.chip->irq_set_type(&desc->irq_data,
55 IRQ_TYPE_PROBE); 55 IRQ_TYPE_PROBE);
56 irq_startup(desc); 56 irq_startup(desc, false);
57 } 57 }
58 raw_spin_unlock_irq(&desc->lock); 58 raw_spin_unlock_irq(&desc->lock);
59 } 59 }
@@ -70,7 +70,7 @@ unsigned long probe_irq_on(void)
70 raw_spin_lock_irq(&desc->lock); 70 raw_spin_lock_irq(&desc->lock);
71 if (!desc->action && irq_settings_can_probe(desc)) { 71 if (!desc->action && irq_settings_can_probe(desc)) {
72 desc->istate |= IRQS_AUTODETECT | IRQS_WAITING; 72 desc->istate |= IRQS_AUTODETECT | IRQS_WAITING;
73 if (irq_startup(desc)) 73 if (irq_startup(desc, false))
74 desc->istate |= IRQS_PENDING; 74 desc->istate |= IRQS_PENDING;
75 } 75 }
76 raw_spin_unlock_irq(&desc->lock); 76 raw_spin_unlock_irq(&desc->lock);
diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index f7c543a801d9..fb7db75ee0c8 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -157,19 +157,22 @@ static void irq_state_set_masked(struct irq_desc *desc)
157 irqd_set(&desc->irq_data, IRQD_IRQ_MASKED); 157 irqd_set(&desc->irq_data, IRQD_IRQ_MASKED);
158} 158}
159 159
160int irq_startup(struct irq_desc *desc) 160int irq_startup(struct irq_desc *desc, bool resend)
161{ 161{
162 int ret = 0;
163
162 irq_state_clr_disabled(desc); 164 irq_state_clr_disabled(desc);
163 desc->depth = 0; 165 desc->depth = 0;
164 166
165 if (desc->irq_data.chip->irq_startup) { 167 if (desc->irq_data.chip->irq_startup) {
166 int ret = desc->irq_data.chip->irq_startup(&desc->irq_data); 168 ret = desc->irq_data.chip->irq_startup(&desc->irq_data);
167 irq_state_clr_masked(desc); 169 irq_state_clr_masked(desc);
168 return ret; 170 } else {
171 irq_enable(desc);
169 } 172 }
170 173 if (resend)
171 irq_enable(desc); 174 check_irq_resend(desc, desc->irq_data.irq);
172 return 0; 175 return ret;
173} 176}
174 177
175void irq_shutdown(struct irq_desc *desc) 178void irq_shutdown(struct irq_desc *desc)
@@ -330,6 +333,24 @@ out_unlock:
330} 333}
331EXPORT_SYMBOL_GPL(handle_simple_irq); 334EXPORT_SYMBOL_GPL(handle_simple_irq);
332 335
336/*
337 * Called unconditionally from handle_level_irq() and only for oneshot
338 * interrupts from handle_fasteoi_irq()
339 */
340static void cond_unmask_irq(struct irq_desc *desc)
341{
342 /*
343 * We need to unmask in the following cases:
344 * - Standard level irq (IRQF_ONESHOT is not set)
345 * - Oneshot irq which did not wake the thread (caused by a
346 * spurious interrupt or a primary handler handling it
347 * completely).
348 */
349 if (!irqd_irq_disabled(&desc->irq_data) &&
350 irqd_irq_masked(&desc->irq_data) && !desc->threads_oneshot)
351 unmask_irq(desc);
352}
353
333/** 354/**
334 * handle_level_irq - Level type irq handler 355 * handle_level_irq - Level type irq handler
335 * @irq: the interrupt number 356 * @irq: the interrupt number
@@ -362,8 +383,8 @@ handle_level_irq(unsigned int irq, struct irq_desc *desc)
362 383
363 handle_irq_event(desc); 384 handle_irq_event(desc);
364 385
365 if (!irqd_irq_disabled(&desc->irq_data) && !(desc->istate & IRQS_ONESHOT)) 386 cond_unmask_irq(desc);
366 unmask_irq(desc); 387
367out_unlock: 388out_unlock:
368 raw_spin_unlock(&desc->lock); 389 raw_spin_unlock(&desc->lock);
369} 390}
@@ -417,6 +438,9 @@ handle_fasteoi_irq(unsigned int irq, struct irq_desc *desc)
417 preflow_handler(desc); 438 preflow_handler(desc);
418 handle_irq_event(desc); 439 handle_irq_event(desc);
419 440
441 if (desc->istate & IRQS_ONESHOT)
442 cond_unmask_irq(desc);
443
420out_eoi: 444out_eoi:
421 desc->irq_data.chip->irq_eoi(&desc->irq_data); 445 desc->irq_data.chip->irq_eoi(&desc->irq_data);
422out_unlock: 446out_unlock:
@@ -625,7 +649,7 @@ __irq_set_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained,
625 irq_settings_set_noprobe(desc); 649 irq_settings_set_noprobe(desc);
626 irq_settings_set_norequest(desc); 650 irq_settings_set_norequest(desc);
627 irq_settings_set_nothread(desc); 651 irq_settings_set_nothread(desc);
628 irq_startup(desc); 652 irq_startup(desc, true);
629 } 653 }
630out: 654out:
631 irq_put_desc_busunlock(desc, flags); 655 irq_put_desc_busunlock(desc, flags);
diff --git a/kernel/irq/internals.h b/kernel/irq/internals.h
index b7952316016a..40378ff877e7 100644
--- a/kernel/irq/internals.h
+++ b/kernel/irq/internals.h
@@ -67,7 +67,7 @@ extern int __irq_set_trigger(struct irq_desc *desc, unsigned int irq,
67extern void __disable_irq(struct irq_desc *desc, unsigned int irq, bool susp); 67extern void __disable_irq(struct irq_desc *desc, unsigned int irq, bool susp);
68extern void __enable_irq(struct irq_desc *desc, unsigned int irq, bool resume); 68extern void __enable_irq(struct irq_desc *desc, unsigned int irq, bool resume);
69 69
70extern int irq_startup(struct irq_desc *desc); 70extern int irq_startup(struct irq_desc *desc, bool resend);
71extern void irq_shutdown(struct irq_desc *desc); 71extern void irq_shutdown(struct irq_desc *desc);
72extern void irq_enable(struct irq_desc *desc); 72extern void irq_enable(struct irq_desc *desc);
73extern void irq_disable(struct irq_desc *desc); 73extern void irq_disable(struct irq_desc *desc);
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index a9a9dbe49fea..32313c084442 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -1027,7 +1027,7 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new)
1027 desc->istate |= IRQS_ONESHOT; 1027 desc->istate |= IRQS_ONESHOT;
1028 1028
1029 if (irq_settings_can_autoenable(desc)) 1029 if (irq_settings_can_autoenable(desc))
1030 irq_startup(desc); 1030 irq_startup(desc, true);
1031 else 1031 else
1032 /* Undo nested disables: */ 1032 /* Undo nested disables: */
1033 desc->depth = 1; 1033 desc->depth = 1;
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 5255c9d2e053..33a0676ea744 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -1932,7 +1932,6 @@ static void finish_task_switch(struct rq *rq, struct task_struct *prev)
1932 local_irq_enable(); 1932 local_irq_enable();
1933#endif /* __ARCH_WANT_INTERRUPTS_ON_CTXSW */ 1933#endif /* __ARCH_WANT_INTERRUPTS_ON_CTXSW */
1934 finish_lock_switch(rq, prev); 1934 finish_lock_switch(rq, prev);
1935 trace_sched_stat_sleeptime(current, rq->clock);
1936 1935
1937 fire_sched_in_preempt_notifiers(current); 1936 fire_sched_in_preempt_notifiers(current);
1938 if (mm) 1937 if (mm)
@@ -6729,7 +6728,7 @@ int __init sched_create_sysfs_power_savings_entries(struct device *dev)
6729static int cpuset_cpu_active(struct notifier_block *nfb, unsigned long action, 6728static int cpuset_cpu_active(struct notifier_block *nfb, unsigned long action,
6730 void *hcpu) 6729 void *hcpu)
6731{ 6730{
6732 switch (action & ~CPU_TASKS_FROZEN) { 6731 switch (action) {
6733 case CPU_ONLINE: 6732 case CPU_ONLINE:
6734 case CPU_DOWN_FAILED: 6733 case CPU_DOWN_FAILED:
6735 cpuset_update_active_cpus(); 6734 cpuset_update_active_cpus();
@@ -6742,7 +6741,7 @@ static int cpuset_cpu_active(struct notifier_block *nfb, unsigned long action,
6742static int cpuset_cpu_inactive(struct notifier_block *nfb, unsigned long action, 6741static int cpuset_cpu_inactive(struct notifier_block *nfb, unsigned long action,
6743 void *hcpu) 6742 void *hcpu)
6744{ 6743{
6745 switch (action & ~CPU_TASKS_FROZEN) { 6744 switch (action) {
6746 case CPU_DOWN_PREPARE: 6745 case CPU_DOWN_PREPARE:
6747 cpuset_update_active_cpus(); 6746 cpuset_update_active_cpus();
6748 return NOTIFY_OK; 6747 return NOTIFY_OK;
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 7c6414fc669d..aca16b843b7e 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -1003,6 +1003,7 @@ static void enqueue_sleeper(struct cfs_rq *cfs_rq, struct sched_entity *se)
1003 if (unlikely(delta > se->statistics.sleep_max)) 1003 if (unlikely(delta > se->statistics.sleep_max))
1004 se->statistics.sleep_max = delta; 1004 se->statistics.sleep_max = delta;
1005 1005
1006 se->statistics.sleep_start = 0;
1006 se->statistics.sum_sleep_runtime += delta; 1007 se->statistics.sum_sleep_runtime += delta;
1007 1008
1008 if (tsk) { 1009 if (tsk) {
@@ -1019,6 +1020,7 @@ static void enqueue_sleeper(struct cfs_rq *cfs_rq, struct sched_entity *se)
1019 if (unlikely(delta > se->statistics.block_max)) 1020 if (unlikely(delta > se->statistics.block_max))
1020 se->statistics.block_max = delta; 1021 se->statistics.block_max = delta;
1021 1022
1023 se->statistics.block_start = 0;
1022 se->statistics.sum_sleep_runtime += delta; 1024 se->statistics.sum_sleep_runtime += delta;
1023 1025
1024 if (tsk) { 1026 if (tsk) {
diff --git a/mm/memblock.c b/mm/memblock.c
index 77b5f227e1d8..99f285599501 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -99,9 +99,6 @@ phys_addr_t __init_memblock memblock_find_in_range_node(phys_addr_t start,
99 phys_addr_t this_start, this_end, cand; 99 phys_addr_t this_start, this_end, cand;
100 u64 i; 100 u64 i;
101 101
102 /* align @size to avoid excessive fragmentation on reserved array */
103 size = round_up(size, align);
104
105 /* pump up @end */ 102 /* pump up @end */
106 if (end == MEMBLOCK_ALLOC_ACCESSIBLE) 103 if (end == MEMBLOCK_ALLOC_ACCESSIBLE)
107 end = memblock.current_limit; 104 end = memblock.current_limit;
@@ -731,6 +728,9 @@ static phys_addr_t __init memblock_alloc_base_nid(phys_addr_t size,
731{ 728{
732 phys_addr_t found; 729 phys_addr_t found;
733 730
731 /* align @size to avoid excessive fragmentation on reserved array */
732 size = round_up(size, align);
733
734 found = memblock_find_in_range_node(0, max_addr, size, align, nid); 734 found = memblock_find_in_range_node(0, max_addr, size, align, nid);
735 if (found && !memblock_reserve(found, size)) 735 if (found && !memblock_reserve(found, size))
736 return found; 736 return found;
diff --git a/net/atm/clip.c b/net/atm/clip.c
index c12c2582457c..127fe70a1baa 100644
--- a/net/atm/clip.c
+++ b/net/atm/clip.c
@@ -46,8 +46,8 @@
46 46
47static struct net_device *clip_devs; 47static struct net_device *clip_devs;
48static struct atm_vcc *atmarpd; 48static struct atm_vcc *atmarpd;
49static struct neigh_table clip_tbl;
50static struct timer_list idle_timer; 49static struct timer_list idle_timer;
50static const struct neigh_ops clip_neigh_ops;
51 51
52static int to_atmarpd(enum atmarp_ctrl_type type, int itf, __be32 ip) 52static int to_atmarpd(enum atmarp_ctrl_type type, int itf, __be32 ip)
53{ 53{
@@ -123,6 +123,8 @@ static int neigh_check_cb(struct neighbour *n)
123 struct atmarp_entry *entry = neighbour_priv(n); 123 struct atmarp_entry *entry = neighbour_priv(n);
124 struct clip_vcc *cv; 124 struct clip_vcc *cv;
125 125
126 if (n->ops != &clip_neigh_ops)
127 return 0;
126 for (cv = entry->vccs; cv; cv = cv->next) { 128 for (cv = entry->vccs; cv; cv = cv->next) {
127 unsigned long exp = cv->last_use + cv->idle_timeout; 129 unsigned long exp = cv->last_use + cv->idle_timeout;
128 130
@@ -154,10 +156,10 @@ static int neigh_check_cb(struct neighbour *n)
154 156
155static void idle_timer_check(unsigned long dummy) 157static void idle_timer_check(unsigned long dummy)
156{ 158{
157 write_lock(&clip_tbl.lock); 159 write_lock(&arp_tbl.lock);
158 __neigh_for_each_release(&clip_tbl, neigh_check_cb); 160 __neigh_for_each_release(&arp_tbl, neigh_check_cb);
159 mod_timer(&idle_timer, jiffies + CLIP_CHECK_INTERVAL * HZ); 161 mod_timer(&idle_timer, jiffies + CLIP_CHECK_INTERVAL * HZ);
160 write_unlock(&clip_tbl.lock); 162 write_unlock(&arp_tbl.lock);
161} 163}
162 164
163static int clip_arp_rcv(struct sk_buff *skb) 165static int clip_arp_rcv(struct sk_buff *skb)
diff --git a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c
index ef92864ac625..72eb187a5f60 100644
--- a/net/bluetooth/af_bluetooth.c
+++ b/net/bluetooth/af_bluetooth.c
@@ -71,19 +71,16 @@ static const char *const bt_slock_key_strings[BT_MAX_PROTO] = {
71 "slock-AF_BLUETOOTH-BTPROTO_AVDTP", 71 "slock-AF_BLUETOOTH-BTPROTO_AVDTP",
72}; 72};
73 73
74static inline void bt_sock_reclassify_lock(struct socket *sock, int proto) 74void bt_sock_reclassify_lock(struct sock *sk, int proto)
75{ 75{
76 struct sock *sk = sock->sk; 76 BUG_ON(!sk);
77
78 if (!sk)
79 return;
80
81 BUG_ON(sock_owned_by_user(sk)); 77 BUG_ON(sock_owned_by_user(sk));
82 78
83 sock_lock_init_class_and_name(sk, 79 sock_lock_init_class_and_name(sk,
84 bt_slock_key_strings[proto], &bt_slock_key[proto], 80 bt_slock_key_strings[proto], &bt_slock_key[proto],
85 bt_key_strings[proto], &bt_lock_key[proto]); 81 bt_key_strings[proto], &bt_lock_key[proto]);
86} 82}
83EXPORT_SYMBOL(bt_sock_reclassify_lock);
87 84
88int bt_sock_register(int proto, const struct net_proto_family *ops) 85int bt_sock_register(int proto, const struct net_proto_family *ops)
89{ 86{
@@ -145,7 +142,8 @@ static int bt_sock_create(struct net *net, struct socket *sock, int proto,
145 142
146 if (bt_proto[proto] && try_module_get(bt_proto[proto]->owner)) { 143 if (bt_proto[proto] && try_module_get(bt_proto[proto]->owner)) {
147 err = bt_proto[proto]->create(net, sock, proto, kern); 144 err = bt_proto[proto]->create(net, sock, proto, kern);
148 bt_sock_reclassify_lock(sock, proto); 145 if (!err)
146 bt_sock_reclassify_lock(sock->sk, proto);
149 module_put(bt_proto[proto]->owner); 147 module_put(bt_proto[proto]->owner);
150 } 148 }
151 149
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index 3db432473ad5..07bc69ed9498 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -635,6 +635,10 @@ static int hci_conn_auth(struct hci_conn *conn, __u8 sec_level, __u8 auth_type)
635 635
636 if (!test_and_set_bit(HCI_CONN_AUTH_PEND, &conn->pend)) { 636 if (!test_and_set_bit(HCI_CONN_AUTH_PEND, &conn->pend)) {
637 struct hci_cp_auth_requested cp; 637 struct hci_cp_auth_requested cp;
638
639 /* encrypt must be pending if auth is also pending */
640 set_bit(HCI_CONN_ENCRYPT_PEND, &conn->pend);
641
638 cp.handle = cpu_to_le16(conn->handle); 642 cp.handle = cpu_to_le16(conn->handle);
639 hci_send_cmd(conn->hdev, HCI_OP_AUTH_REQUESTED, 643 hci_send_cmd(conn->hdev, HCI_OP_AUTH_REQUESTED,
640 sizeof(cp), &cp); 644 sizeof(cp), &cp);
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 9de93714213a..5aeb62491198 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -640,7 +640,8 @@ static int hci_dev_do_close(struct hci_dev *hdev)
640 /* Reset device */ 640 /* Reset device */
641 skb_queue_purge(&hdev->cmd_q); 641 skb_queue_purge(&hdev->cmd_q);
642 atomic_set(&hdev->cmd_cnt, 1); 642 atomic_set(&hdev->cmd_cnt, 1);
643 if (!test_bit(HCI_RAW, &hdev->flags)) { 643 if (!test_bit(HCI_RAW, &hdev->flags) &&
644 test_bit(HCI_QUIRK_NO_RESET, &hdev->quirks)) {
644 set_bit(HCI_INIT, &hdev->flags); 645 set_bit(HCI_INIT, &hdev->flags);
645 __hci_request(hdev, hci_reset_req, 0, 646 __hci_request(hdev, hci_reset_req, 0,
646 msecs_to_jiffies(250)); 647 msecs_to_jiffies(250));
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index faf0b11ac1d3..32d338c30e65 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -1018,10 +1018,10 @@ static void l2cap_conn_del(struct hci_conn *hcon, int err)
1018 hci_chan_del(conn->hchan); 1018 hci_chan_del(conn->hchan);
1019 1019
1020 if (conn->info_state & L2CAP_INFO_FEAT_MASK_REQ_SENT) 1020 if (conn->info_state & L2CAP_INFO_FEAT_MASK_REQ_SENT)
1021 __cancel_delayed_work(&conn->info_timer); 1021 cancel_delayed_work_sync(&conn->info_timer);
1022 1022
1023 if (test_and_clear_bit(HCI_CONN_LE_SMP_PEND, &hcon->pend)) { 1023 if (test_and_clear_bit(HCI_CONN_LE_SMP_PEND, &hcon->pend)) {
1024 __cancel_delayed_work(&conn->security_timer); 1024 cancel_delayed_work_sync(&conn->security_timer);
1025 smp_chan_destroy(conn); 1025 smp_chan_destroy(conn);
1026 } 1026 }
1027 1027
@@ -1120,7 +1120,7 @@ static struct l2cap_chan *l2cap_global_chan_by_psm(int state, __le16 psm, bdaddr
1120 return c1; 1120 return c1;
1121} 1121}
1122 1122
1123inline int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid, bdaddr_t *dst) 1123int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid, bdaddr_t *dst)
1124{ 1124{
1125 struct sock *sk = chan->sk; 1125 struct sock *sk = chan->sk;
1126 bdaddr_t *src = &bt_sk(sk)->src; 1126 bdaddr_t *src = &bt_sk(sk)->src;
@@ -2574,7 +2574,7 @@ static inline int l2cap_command_rej(struct l2cap_conn *conn, struct l2cap_cmd_hd
2574 2574
2575 if ((conn->info_state & L2CAP_INFO_FEAT_MASK_REQ_SENT) && 2575 if ((conn->info_state & L2CAP_INFO_FEAT_MASK_REQ_SENT) &&
2576 cmd->ident == conn->info_ident) { 2576 cmd->ident == conn->info_ident) {
2577 __cancel_delayed_work(&conn->info_timer); 2577 cancel_delayed_work(&conn->info_timer);
2578 2578
2579 conn->info_state |= L2CAP_INFO_FEAT_MASK_REQ_DONE; 2579 conn->info_state |= L2CAP_INFO_FEAT_MASK_REQ_DONE;
2580 conn->info_ident = 0; 2580 conn->info_ident = 0;
@@ -2970,7 +2970,8 @@ static inline int l2cap_config_rsp(struct l2cap_conn *conn, struct l2cap_cmd_hdr
2970 2970
2971 default: 2971 default:
2972 sk->sk_err = ECONNRESET; 2972 sk->sk_err = ECONNRESET;
2973 __set_chan_timer(chan, L2CAP_DISC_REJ_TIMEOUT); 2973 __set_chan_timer(chan,
2974 msecs_to_jiffies(L2CAP_DISC_REJ_TIMEOUT));
2974 l2cap_send_disconn_req(conn, chan, ECONNRESET); 2975 l2cap_send_disconn_req(conn, chan, ECONNRESET);
2975 goto done; 2976 goto done;
2976 } 2977 }
@@ -3120,7 +3121,7 @@ static inline int l2cap_information_rsp(struct l2cap_conn *conn, struct l2cap_cm
3120 conn->info_state & L2CAP_INFO_FEAT_MASK_REQ_DONE) 3121 conn->info_state & L2CAP_INFO_FEAT_MASK_REQ_DONE)
3121 return 0; 3122 return 0;
3122 3123
3123 __cancel_delayed_work(&conn->info_timer); 3124 cancel_delayed_work(&conn->info_timer);
3124 3125
3125 if (result != L2CAP_IR_SUCCESS) { 3126 if (result != L2CAP_IR_SUCCESS) {
3126 conn->info_state |= L2CAP_INFO_FEAT_MASK_REQ_DONE; 3127 conn->info_state |= L2CAP_INFO_FEAT_MASK_REQ_DONE;
@@ -4478,7 +4479,8 @@ static inline void l2cap_check_encryption(struct l2cap_chan *chan, u8 encrypt)
4478 if (encrypt == 0x00) { 4479 if (encrypt == 0x00) {
4479 if (chan->sec_level == BT_SECURITY_MEDIUM) { 4480 if (chan->sec_level == BT_SECURITY_MEDIUM) {
4480 __clear_chan_timer(chan); 4481 __clear_chan_timer(chan);
4481 __set_chan_timer(chan, L2CAP_ENC_TIMEOUT); 4482 __set_chan_timer(chan,
4483 msecs_to_jiffies(L2CAP_ENC_TIMEOUT));
4482 } else if (chan->sec_level == BT_SECURITY_HIGH) 4484 } else if (chan->sec_level == BT_SECURITY_HIGH)
4483 l2cap_chan_close(chan, ECONNREFUSED); 4485 l2cap_chan_close(chan, ECONNREFUSED);
4484 } else { 4486 } else {
@@ -4499,7 +4501,7 @@ int l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt)
4499 4501
4500 if (hcon->type == LE_LINK) { 4502 if (hcon->type == LE_LINK) {
4501 smp_distribute_keys(conn, 0); 4503 smp_distribute_keys(conn, 0);
4502 __cancel_delayed_work(&conn->security_timer); 4504 cancel_delayed_work(&conn->security_timer);
4503 } 4505 }
4504 4506
4505 rcu_read_lock(); 4507 rcu_read_lock();
@@ -4546,7 +4548,8 @@ int l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt)
4546 L2CAP_CONN_REQ, sizeof(req), &req); 4548 L2CAP_CONN_REQ, sizeof(req), &req);
4547 } else { 4549 } else {
4548 __clear_chan_timer(chan); 4550 __clear_chan_timer(chan);
4549 __set_chan_timer(chan, L2CAP_DISC_TIMEOUT); 4551 __set_chan_timer(chan,
4552 msecs_to_jiffies(L2CAP_DISC_TIMEOUT));
4550 } 4553 }
4551 } else if (chan->state == BT_CONNECT2) { 4554 } else if (chan->state == BT_CONNECT2) {
4552 struct l2cap_conn_rsp rsp; 4555 struct l2cap_conn_rsp rsp;
@@ -4566,7 +4569,8 @@ int l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt)
4566 } 4569 }
4567 } else { 4570 } else {
4568 l2cap_state_change(chan, BT_DISCONN); 4571 l2cap_state_change(chan, BT_DISCONN);
4569 __set_chan_timer(chan, L2CAP_DISC_TIMEOUT); 4572 __set_chan_timer(chan,
4573 msecs_to_jiffies(L2CAP_DISC_TIMEOUT));
4570 res = L2CAP_CR_SEC_BLOCK; 4574 res = L2CAP_CR_SEC_BLOCK;
4571 stat = L2CAP_CS_NO_INFO; 4575 stat = L2CAP_CS_NO_INFO;
4572 } 4576 }
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
index c61d967012b2..401d9428ae4c 100644
--- a/net/bluetooth/l2cap_sock.c
+++ b/net/bluetooth/l2cap_sock.c
@@ -849,6 +849,8 @@ static struct l2cap_chan *l2cap_sock_new_connection_cb(void *data)
849 if (!sk) 849 if (!sk)
850 return NULL; 850 return NULL;
851 851
852 bt_sock_reclassify_lock(sk, BTPROTO_L2CAP);
853
852 l2cap_sock_init(sk, parent); 854 l2cap_sock_init(sk, parent);
853 855
854 return l2cap_pi(sk)->chan; 856 return l2cap_pi(sk)->chan;
@@ -1002,7 +1004,7 @@ static struct sock *l2cap_sock_alloc(struct net *net, struct socket *sock, int p
1002 INIT_LIST_HEAD(&bt_sk(sk)->accept_q); 1004 INIT_LIST_HEAD(&bt_sk(sk)->accept_q);
1003 1005
1004 sk->sk_destruct = l2cap_sock_destruct; 1006 sk->sk_destruct = l2cap_sock_destruct;
1005 sk->sk_sndtimeo = L2CAP_CONN_TIMEOUT; 1007 sk->sk_sndtimeo = msecs_to_jiffies(L2CAP_CONN_TIMEOUT);
1006 1008
1007 sock_reset_flag(sk, SOCK_ZAPPED); 1009 sock_reset_flag(sk, SOCK_ZAPPED);
1008 1010
diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c
index 501649bf5596..8a602388f1e7 100644
--- a/net/bluetooth/rfcomm/core.c
+++ b/net/bluetooth/rfcomm/core.c
@@ -1164,12 +1164,18 @@ static int rfcomm_recv_ua(struct rfcomm_session *s, u8 dlci)
1164 break; 1164 break;
1165 1165
1166 case BT_DISCONN: 1166 case BT_DISCONN:
1167 /* When socket is closed and we are not RFCOMM 1167 /* rfcomm_session_put is called later so don't do
1168 * initiator rfcomm_process_rx already calls 1168 * anything here otherwise we will mess up the session
1169 * rfcomm_session_put() */ 1169 * reference counter:
1170 if (s->sock->sk->sk_state != BT_CLOSED) 1170 *
1171 if (list_empty(&s->dlcs)) 1171 * (a) when we are the initiator dlc_unlink will drive
1172 rfcomm_session_put(s); 1172 * the reference counter to 0 (there is no initial put
1173 * after session_add)
1174 *
1175 * (b) when we are not the initiator rfcomm_rx_process
1176 * will explicitly call put to balance the initial hold
1177 * done after session add.
1178 */
1173 break; 1179 break;
1174 } 1180 }
1175 } 1181 }
diff --git a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c
index f066678faeee..22169c3f1482 100644
--- a/net/bluetooth/rfcomm/sock.c
+++ b/net/bluetooth/rfcomm/sock.c
@@ -956,6 +956,8 @@ int rfcomm_connect_ind(struct rfcomm_session *s, u8 channel, struct rfcomm_dlc *
956 if (!sk) 956 if (!sk)
957 goto done; 957 goto done;
958 958
959 bt_sock_reclassify_lock(sk, BTPROTO_RFCOMM);
960
959 rfcomm_sock_init(sk, parent); 961 rfcomm_sock_init(sk, parent);
960 bacpy(&bt_sk(sk)->src, &src); 962 bacpy(&bt_sk(sk)->src, &src);
961 bacpy(&bt_sk(sk)->dst, &dst); 963 bacpy(&bt_sk(sk)->dst, &dst);
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index e287346e0934..2a83914b0277 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -826,6 +826,8 @@ next_elt:
826 write_unlock_bh(&tbl->lock); 826 write_unlock_bh(&tbl->lock);
827 cond_resched(); 827 cond_resched();
828 write_lock_bh(&tbl->lock); 828 write_lock_bh(&tbl->lock);
829 nht = rcu_dereference_protected(tbl->nht,
830 lockdep_is_held(&tbl->lock));
829 } 831 }
830 /* Cycle through all hash buckets every base_reachable_time/2 ticks. 832 /* Cycle through all hash buckets every base_reachable_time/2 ticks.
831 * ARP entry timeouts range from 1/2 base_reachable_time to 3/2 833 * ARP entry timeouts range from 1/2 base_reachable_time to 3/2
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 65aebd450027..606a6e8f3671 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -60,7 +60,6 @@ struct rtnl_link {
60}; 60};
61 61
62static DEFINE_MUTEX(rtnl_mutex); 62static DEFINE_MUTEX(rtnl_mutex);
63static u16 min_ifinfo_dump_size;
64 63
65void rtnl_lock(void) 64void rtnl_lock(void)
66{ 65{
@@ -724,10 +723,11 @@ static void copy_rtnl_link_stats64(void *v, const struct rtnl_link_stats64 *b)
724} 723}
725 724
726/* All VF info */ 725/* All VF info */
727static inline int rtnl_vfinfo_size(const struct net_device *dev) 726static inline int rtnl_vfinfo_size(const struct net_device *dev,
727 u32 ext_filter_mask)
728{ 728{
729 if (dev->dev.parent && dev_is_pci(dev->dev.parent)) { 729 if (dev->dev.parent && dev_is_pci(dev->dev.parent) &&
730 730 (ext_filter_mask & RTEXT_FILTER_VF)) {
731 int num_vfs = dev_num_vf(dev->dev.parent); 731 int num_vfs = dev_num_vf(dev->dev.parent);
732 size_t size = nla_total_size(sizeof(struct nlattr)); 732 size_t size = nla_total_size(sizeof(struct nlattr));
733 size += nla_total_size(num_vfs * sizeof(struct nlattr)); 733 size += nla_total_size(num_vfs * sizeof(struct nlattr));
@@ -766,7 +766,8 @@ static size_t rtnl_port_size(const struct net_device *dev)
766 return port_self_size; 766 return port_self_size;
767} 767}
768 768
769static noinline size_t if_nlmsg_size(const struct net_device *dev) 769static noinline size_t if_nlmsg_size(const struct net_device *dev,
770 u32 ext_filter_mask)
770{ 771{
771 return NLMSG_ALIGN(sizeof(struct ifinfomsg)) 772 return NLMSG_ALIGN(sizeof(struct ifinfomsg))
772 + nla_total_size(IFNAMSIZ) /* IFLA_IFNAME */ 773 + nla_total_size(IFNAMSIZ) /* IFLA_IFNAME */
@@ -784,8 +785,9 @@ static noinline size_t if_nlmsg_size(const struct net_device *dev)
784 + nla_total_size(4) /* IFLA_MASTER */ 785 + nla_total_size(4) /* IFLA_MASTER */
785 + nla_total_size(1) /* IFLA_OPERSTATE */ 786 + nla_total_size(1) /* IFLA_OPERSTATE */
786 + nla_total_size(1) /* IFLA_LINKMODE */ 787 + nla_total_size(1) /* IFLA_LINKMODE */
787 + nla_total_size(4) /* IFLA_NUM_VF */ 788 + nla_total_size(ext_filter_mask
788 + rtnl_vfinfo_size(dev) /* IFLA_VFINFO_LIST */ 789 & RTEXT_FILTER_VF ? 4 : 0) /* IFLA_NUM_VF */
790 + rtnl_vfinfo_size(dev, ext_filter_mask) /* IFLA_VFINFO_LIST */
789 + rtnl_port_size(dev) /* IFLA_VF_PORTS + IFLA_PORT_SELF */ 791 + rtnl_port_size(dev) /* IFLA_VF_PORTS + IFLA_PORT_SELF */
790 + rtnl_link_get_size(dev) /* IFLA_LINKINFO */ 792 + rtnl_link_get_size(dev) /* IFLA_LINKINFO */
791 + rtnl_link_get_af_size(dev); /* IFLA_AF_SPEC */ 793 + rtnl_link_get_af_size(dev); /* IFLA_AF_SPEC */
@@ -868,7 +870,7 @@ static int rtnl_port_fill(struct sk_buff *skb, struct net_device *dev)
868 870
869static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev, 871static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev,
870 int type, u32 pid, u32 seq, u32 change, 872 int type, u32 pid, u32 seq, u32 change,
871 unsigned int flags) 873 unsigned int flags, u32 ext_filter_mask)
872{ 874{
873 struct ifinfomsg *ifm; 875 struct ifinfomsg *ifm;
874 struct nlmsghdr *nlh; 876 struct nlmsghdr *nlh;
@@ -941,10 +943,11 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev,
941 goto nla_put_failure; 943 goto nla_put_failure;
942 copy_rtnl_link_stats64(nla_data(attr), stats); 944 copy_rtnl_link_stats64(nla_data(attr), stats);
943 945
944 if (dev->dev.parent) 946 if (dev->dev.parent && (ext_filter_mask & RTEXT_FILTER_VF))
945 NLA_PUT_U32(skb, IFLA_NUM_VF, dev_num_vf(dev->dev.parent)); 947 NLA_PUT_U32(skb, IFLA_NUM_VF, dev_num_vf(dev->dev.parent));
946 948
947 if (dev->netdev_ops->ndo_get_vf_config && dev->dev.parent) { 949 if (dev->netdev_ops->ndo_get_vf_config && dev->dev.parent
950 && (ext_filter_mask & RTEXT_FILTER_VF)) {
948 int i; 951 int i;
949 952
950 struct nlattr *vfinfo, *vf; 953 struct nlattr *vfinfo, *vf;
@@ -1048,6 +1051,8 @@ static int rtnl_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb)
1048 struct net_device *dev; 1051 struct net_device *dev;
1049 struct hlist_head *head; 1052 struct hlist_head *head;
1050 struct hlist_node *node; 1053 struct hlist_node *node;
1054 struct nlattr *tb[IFLA_MAX+1];
1055 u32 ext_filter_mask = 0;
1051 1056
1052 s_h = cb->args[0]; 1057 s_h = cb->args[0];
1053 s_idx = cb->args[1]; 1058 s_idx = cb->args[1];
@@ -1055,6 +1060,12 @@ static int rtnl_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb)
1055 rcu_read_lock(); 1060 rcu_read_lock();
1056 cb->seq = net->dev_base_seq; 1061 cb->seq = net->dev_base_seq;
1057 1062
1063 nlmsg_parse(cb->nlh, sizeof(struct rtgenmsg), tb, IFLA_MAX,
1064 ifla_policy);
1065
1066 if (tb[IFLA_EXT_MASK])
1067 ext_filter_mask = nla_get_u32(tb[IFLA_EXT_MASK]);
1068
1058 for (h = s_h; h < NETDEV_HASHENTRIES; h++, s_idx = 0) { 1069 for (h = s_h; h < NETDEV_HASHENTRIES; h++, s_idx = 0) {
1059 idx = 0; 1070 idx = 0;
1060 head = &net->dev_index_head[h]; 1071 head = &net->dev_index_head[h];
@@ -1064,7 +1075,8 @@ static int rtnl_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb)
1064 if (rtnl_fill_ifinfo(skb, dev, RTM_NEWLINK, 1075 if (rtnl_fill_ifinfo(skb, dev, RTM_NEWLINK,
1065 NETLINK_CB(cb->skb).pid, 1076 NETLINK_CB(cb->skb).pid,
1066 cb->nlh->nlmsg_seq, 0, 1077 cb->nlh->nlmsg_seq, 0,
1067 NLM_F_MULTI) <= 0) 1078 NLM_F_MULTI,
1079 ext_filter_mask) <= 0)
1068 goto out; 1080 goto out;
1069 1081
1070 nl_dump_check_consistent(cb, nlmsg_hdr(skb)); 1082 nl_dump_check_consistent(cb, nlmsg_hdr(skb));
@@ -1100,6 +1112,7 @@ const struct nla_policy ifla_policy[IFLA_MAX+1] = {
1100 [IFLA_VF_PORTS] = { .type = NLA_NESTED }, 1112 [IFLA_VF_PORTS] = { .type = NLA_NESTED },
1101 [IFLA_PORT_SELF] = { .type = NLA_NESTED }, 1113 [IFLA_PORT_SELF] = { .type = NLA_NESTED },
1102 [IFLA_AF_SPEC] = { .type = NLA_NESTED }, 1114 [IFLA_AF_SPEC] = { .type = NLA_NESTED },
1115 [IFLA_EXT_MASK] = { .type = NLA_U32 },
1103}; 1116};
1104EXPORT_SYMBOL(ifla_policy); 1117EXPORT_SYMBOL(ifla_policy);
1105 1118
@@ -1509,8 +1522,6 @@ errout:
1509 1522
1510 if (send_addr_notify) 1523 if (send_addr_notify)
1511 call_netdevice_notifiers(NETDEV_CHANGEADDR, dev); 1524 call_netdevice_notifiers(NETDEV_CHANGEADDR, dev);
1512 min_ifinfo_dump_size = max_t(u16, if_nlmsg_size(dev),
1513 min_ifinfo_dump_size);
1514 1525
1515 return err; 1526 return err;
1516} 1527}
@@ -1842,6 +1853,7 @@ static int rtnl_getlink(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
1842 struct net_device *dev = NULL; 1853 struct net_device *dev = NULL;
1843 struct sk_buff *nskb; 1854 struct sk_buff *nskb;
1844 int err; 1855 int err;
1856 u32 ext_filter_mask = 0;
1845 1857
1846 err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFLA_MAX, ifla_policy); 1858 err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFLA_MAX, ifla_policy);
1847 if (err < 0) 1859 if (err < 0)
@@ -1850,6 +1862,9 @@ static int rtnl_getlink(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
1850 if (tb[IFLA_IFNAME]) 1862 if (tb[IFLA_IFNAME])
1851 nla_strlcpy(ifname, tb[IFLA_IFNAME], IFNAMSIZ); 1863 nla_strlcpy(ifname, tb[IFLA_IFNAME], IFNAMSIZ);
1852 1864
1865 if (tb[IFLA_EXT_MASK])
1866 ext_filter_mask = nla_get_u32(tb[IFLA_EXT_MASK]);
1867
1853 ifm = nlmsg_data(nlh); 1868 ifm = nlmsg_data(nlh);
1854 if (ifm->ifi_index > 0) 1869 if (ifm->ifi_index > 0)
1855 dev = __dev_get_by_index(net, ifm->ifi_index); 1870 dev = __dev_get_by_index(net, ifm->ifi_index);
@@ -1861,12 +1876,12 @@ static int rtnl_getlink(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
1861 if (dev == NULL) 1876 if (dev == NULL)
1862 return -ENODEV; 1877 return -ENODEV;
1863 1878
1864 nskb = nlmsg_new(if_nlmsg_size(dev), GFP_KERNEL); 1879 nskb = nlmsg_new(if_nlmsg_size(dev, ext_filter_mask), GFP_KERNEL);
1865 if (nskb == NULL) 1880 if (nskb == NULL)
1866 return -ENOBUFS; 1881 return -ENOBUFS;
1867 1882
1868 err = rtnl_fill_ifinfo(nskb, dev, RTM_NEWLINK, NETLINK_CB(skb).pid, 1883 err = rtnl_fill_ifinfo(nskb, dev, RTM_NEWLINK, NETLINK_CB(skb).pid,
1869 nlh->nlmsg_seq, 0, 0); 1884 nlh->nlmsg_seq, 0, 0, ext_filter_mask);
1870 if (err < 0) { 1885 if (err < 0) {
1871 /* -EMSGSIZE implies BUG in if_nlmsg_size */ 1886 /* -EMSGSIZE implies BUG in if_nlmsg_size */
1872 WARN_ON(err == -EMSGSIZE); 1887 WARN_ON(err == -EMSGSIZE);
@@ -1877,8 +1892,31 @@ static int rtnl_getlink(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
1877 return err; 1892 return err;
1878} 1893}
1879 1894
1880static u16 rtnl_calcit(struct sk_buff *skb) 1895static u16 rtnl_calcit(struct sk_buff *skb, struct nlmsghdr *nlh)
1881{ 1896{
1897 struct net *net = sock_net(skb->sk);
1898 struct net_device *dev;
1899 struct nlattr *tb[IFLA_MAX+1];
1900 u32 ext_filter_mask = 0;
1901 u16 min_ifinfo_dump_size = 0;
1902
1903 nlmsg_parse(nlh, sizeof(struct rtgenmsg), tb, IFLA_MAX, ifla_policy);
1904
1905 if (tb[IFLA_EXT_MASK])
1906 ext_filter_mask = nla_get_u32(tb[IFLA_EXT_MASK]);
1907
1908 if (!ext_filter_mask)
1909 return NLMSG_GOODSIZE;
1910 /*
1911 * traverse the list of net devices and compute the minimum
1912 * buffer size based upon the filter mask.
1913 */
1914 list_for_each_entry(dev, &net->dev_base_head, dev_list) {
1915 min_ifinfo_dump_size = max_t(u16, min_ifinfo_dump_size,
1916 if_nlmsg_size(dev,
1917 ext_filter_mask));
1918 }
1919
1882 return min_ifinfo_dump_size; 1920 return min_ifinfo_dump_size;
1883} 1921}
1884 1922
@@ -1913,13 +1951,11 @@ void rtmsg_ifinfo(int type, struct net_device *dev, unsigned change)
1913 int err = -ENOBUFS; 1951 int err = -ENOBUFS;
1914 size_t if_info_size; 1952 size_t if_info_size;
1915 1953
1916 skb = nlmsg_new((if_info_size = if_nlmsg_size(dev)), GFP_KERNEL); 1954 skb = nlmsg_new((if_info_size = if_nlmsg_size(dev, 0)), GFP_KERNEL);
1917 if (skb == NULL) 1955 if (skb == NULL)
1918 goto errout; 1956 goto errout;
1919 1957
1920 min_ifinfo_dump_size = max_t(u16, if_info_size, min_ifinfo_dump_size); 1958 err = rtnl_fill_ifinfo(skb, dev, type, 0, 0, change, 0, 0);
1921
1922 err = rtnl_fill_ifinfo(skb, dev, type, 0, 0, change, 0);
1923 if (err < 0) { 1959 if (err < 0) {
1924 /* -EMSGSIZE implies BUG in if_nlmsg_size() */ 1960 /* -EMSGSIZE implies BUG in if_nlmsg_size() */
1925 WARN_ON(err == -EMSGSIZE); 1961 WARN_ON(err == -EMSGSIZE);
@@ -1977,7 +2013,7 @@ static int rtnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
1977 return -EOPNOTSUPP; 2013 return -EOPNOTSUPP;
1978 calcit = rtnl_get_calcit(family, type); 2014 calcit = rtnl_get_calcit(family, type);
1979 if (calcit) 2015 if (calcit)
1980 min_dump_alloc = calcit(skb); 2016 min_dump_alloc = calcit(skb, nlh);
1981 2017
1982 __rtnl_unlock(); 2018 __rtnl_unlock();
1983 rtnl = net->rtnl; 2019 rtnl = net->rtnl;
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index 6b3ca5ba4450..38673d2860e2 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -65,7 +65,7 @@
65 it is infeasible task. The most general solutions would be 65 it is infeasible task. The most general solutions would be
66 to keep skb->encapsulation counter (sort of local ttl), 66 to keep skb->encapsulation counter (sort of local ttl),
67 and silently drop packet when it expires. It is a good 67 and silently drop packet when it expires. It is a good
68 solution, but it supposes maintaing new variable in ALL 68 solution, but it supposes maintaining new variable in ALL
69 skb, even if no tunneling is used. 69 skb, even if no tunneling is used.
70 70
71 Current solution: xmit_recursion breaks dead loops. This is a percpu 71 Current solution: xmit_recursion breaks dead loops. This is a percpu
@@ -91,14 +91,14 @@
91 91
92 One of them is to parse packet trying to detect inner encapsulation 92 One of them is to parse packet trying to detect inner encapsulation
93 made by our node. It is difficult or even impossible, especially, 93 made by our node. It is difficult or even impossible, especially,
94 taking into account fragmentation. TO be short, tt is not solution at all. 94 taking into account fragmentation. TO be short, ttl is not solution at all.
95 95
96 Current solution: The solution was UNEXPECTEDLY SIMPLE. 96 Current solution: The solution was UNEXPECTEDLY SIMPLE.
97 We force DF flag on tunnels with preconfigured hop limit, 97 We force DF flag on tunnels with preconfigured hop limit,
98 that is ALL. :-) Well, it does not remove the problem completely, 98 that is ALL. :-) Well, it does not remove the problem completely,
99 but exponential growth of network traffic is changed to linear 99 but exponential growth of network traffic is changed to linear
100 (branches, that exceed pmtu are pruned) and tunnel mtu 100 (branches, that exceed pmtu are pruned) and tunnel mtu
101 fastly degrades to value <68, where looping stops. 101 rapidly degrades to value <68, where looping stops.
102 Yes, it is not good if there exists a router in the loop, 102 Yes, it is not good if there exists a router in the loop,
103 which does not force DF, even when encapsulating packets have DF set. 103 which does not force DF, even when encapsulating packets have DF set.
104 But it is not our problem! Nobody could accuse us, we made 104 But it is not our problem! Nobody could accuse us, we made
@@ -457,8 +457,8 @@ static void ipgre_err(struct sk_buff *skb, u32 info)
457 GRE tunnels with enabled checksum. Tell them "thank you". 457 GRE tunnels with enabled checksum. Tell them "thank you".
458 458
459 Well, I wonder, rfc1812 was written by Cisco employee, 459 Well, I wonder, rfc1812 was written by Cisco employee,
460 what the hell these idiots break standrads established 460 what the hell these idiots break standards established
461 by themself??? 461 by themselves???
462 */ 462 */
463 463
464 const struct iphdr *iph = (const struct iphdr *)skb->data; 464 const struct iphdr *iph = (const struct iphdr *)skb->data;
diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c
index aea5a199c37a..b072386cee21 100644
--- a/net/ipv4/ping.c
+++ b/net/ipv4/ping.c
@@ -630,6 +630,7 @@ static int ping_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
630 630
631 pr_debug("ping_recvmsg(sk=%p,sk->num=%u)\n", isk, isk->inet_num); 631 pr_debug("ping_recvmsg(sk=%p,sk->num=%u)\n", isk, isk->inet_num);
632 632
633 err = -EOPNOTSUPP;
633 if (flags & MSG_OOB) 634 if (flags & MSG_OOB)
634 goto out; 635 goto out;
635 636
diff --git a/net/ipv4/xfrm4_mode_beet.c b/net/ipv4/xfrm4_mode_beet.c
index 63418185f524..e3db3f915114 100644
--- a/net/ipv4/xfrm4_mode_beet.c
+++ b/net/ipv4/xfrm4_mode_beet.c
@@ -110,10 +110,7 @@ static int xfrm4_beet_input(struct xfrm_state *x, struct sk_buff *skb)
110 110
111 skb_push(skb, sizeof(*iph)); 111 skb_push(skb, sizeof(*iph));
112 skb_reset_network_header(skb); 112 skb_reset_network_header(skb);
113 113 skb_mac_header_rebuild(skb);
114 memmove(skb->data - skb->mac_len, skb_mac_header(skb),
115 skb->mac_len);
116 skb_set_mac_header(skb, -skb->mac_len);
117 114
118 xfrm4_beet_make_header(skb); 115 xfrm4_beet_make_header(skb);
119 116
diff --git a/net/ipv4/xfrm4_mode_tunnel.c b/net/ipv4/xfrm4_mode_tunnel.c
index 534972e114ac..ed4bf11ef9f4 100644
--- a/net/ipv4/xfrm4_mode_tunnel.c
+++ b/net/ipv4/xfrm4_mode_tunnel.c
@@ -66,7 +66,6 @@ static int xfrm4_mode_tunnel_output(struct xfrm_state *x, struct sk_buff *skb)
66 66
67static int xfrm4_mode_tunnel_input(struct xfrm_state *x, struct sk_buff *skb) 67static int xfrm4_mode_tunnel_input(struct xfrm_state *x, struct sk_buff *skb)
68{ 68{
69 const unsigned char *old_mac;
70 int err = -EINVAL; 69 int err = -EINVAL;
71 70
72 if (XFRM_MODE_SKB_CB(skb)->protocol != IPPROTO_IPIP) 71 if (XFRM_MODE_SKB_CB(skb)->protocol != IPPROTO_IPIP)
@@ -84,10 +83,9 @@ static int xfrm4_mode_tunnel_input(struct xfrm_state *x, struct sk_buff *skb)
84 if (!(x->props.flags & XFRM_STATE_NOECN)) 83 if (!(x->props.flags & XFRM_STATE_NOECN))
85 ipip_ecn_decapsulate(skb); 84 ipip_ecn_decapsulate(skb);
86 85
87 old_mac = skb_mac_header(skb);
88 skb_set_mac_header(skb, -skb->mac_len);
89 memmove(skb_mac_header(skb), old_mac, skb->mac_len);
90 skb_reset_network_header(skb); 86 skb_reset_network_header(skb);
87 skb_mac_header_rebuild(skb);
88
91 err = 0; 89 err = 0;
92 90
93out: 91out:
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index c7e95c8c579f..5aa3981a3922 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -1926,8 +1926,10 @@ static int ip6mr_forward2(struct net *net, struct mr6_table *mrt,
1926 }; 1926 };
1927 1927
1928 dst = ip6_route_output(net, NULL, &fl6); 1928 dst = ip6_route_output(net, NULL, &fl6);
1929 if (!dst) 1929 if (dst->error) {
1930 dst_release(dst);
1930 goto out_free; 1931 goto out_free;
1932 }
1931 1933
1932 skb_dst_drop(skb); 1934 skb_dst_drop(skb);
1933 skb_dst_set(skb, dst); 1935 skb_dst_set(skb, dst);
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index d8f02ef88e59..c964958ac470 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -1545,9 +1545,10 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
1545 &saddr_buf, &ipv6_hdr(skb)->saddr, dev->ifindex); 1545 &saddr_buf, &ipv6_hdr(skb)->saddr, dev->ifindex);
1546 1546
1547 dst = ip6_route_output(net, NULL, &fl6); 1547 dst = ip6_route_output(net, NULL, &fl6);
1548 if (dst == NULL) 1548 if (dst->error) {
1549 dst_release(dst);
1549 return; 1550 return;
1550 1551 }
1551 dst = xfrm_lookup(net, dst, flowi6_to_flowi(&fl6), NULL, 0); 1552 dst = xfrm_lookup(net, dst, flowi6_to_flowi(&fl6), NULL, 0);
1552 if (IS_ERR(dst)) 1553 if (IS_ERR(dst))
1553 return; 1554 return;
diff --git a/net/ipv6/xfrm6_mode_beet.c b/net/ipv6/xfrm6_mode_beet.c
index a81ce9450750..9949a356d62c 100644
--- a/net/ipv6/xfrm6_mode_beet.c
+++ b/net/ipv6/xfrm6_mode_beet.c
@@ -80,7 +80,6 @@ static int xfrm6_beet_output(struct xfrm_state *x, struct sk_buff *skb)
80static int xfrm6_beet_input(struct xfrm_state *x, struct sk_buff *skb) 80static int xfrm6_beet_input(struct xfrm_state *x, struct sk_buff *skb)
81{ 81{
82 struct ipv6hdr *ip6h; 82 struct ipv6hdr *ip6h;
83 const unsigned char *old_mac;
84 int size = sizeof(struct ipv6hdr); 83 int size = sizeof(struct ipv6hdr);
85 int err; 84 int err;
86 85
@@ -90,10 +89,7 @@ static int xfrm6_beet_input(struct xfrm_state *x, struct sk_buff *skb)
90 89
91 __skb_push(skb, size); 90 __skb_push(skb, size);
92 skb_reset_network_header(skb); 91 skb_reset_network_header(skb);
93 92 skb_mac_header_rebuild(skb);
94 old_mac = skb_mac_header(skb);
95 skb_set_mac_header(skb, -skb->mac_len);
96 memmove(skb_mac_header(skb), old_mac, skb->mac_len);
97 93
98 xfrm6_beet_make_header(skb); 94 xfrm6_beet_make_header(skb);
99 95
diff --git a/net/ipv6/xfrm6_mode_tunnel.c b/net/ipv6/xfrm6_mode_tunnel.c
index 261e6e6f487e..9f2095b19ad0 100644
--- a/net/ipv6/xfrm6_mode_tunnel.c
+++ b/net/ipv6/xfrm6_mode_tunnel.c
@@ -63,7 +63,6 @@ static int xfrm6_mode_tunnel_output(struct xfrm_state *x, struct sk_buff *skb)
63static int xfrm6_mode_tunnel_input(struct xfrm_state *x, struct sk_buff *skb) 63static int xfrm6_mode_tunnel_input(struct xfrm_state *x, struct sk_buff *skb)
64{ 64{
65 int err = -EINVAL; 65 int err = -EINVAL;
66 const unsigned char *old_mac;
67 66
68 if (XFRM_MODE_SKB_CB(skb)->protocol != IPPROTO_IPV6) 67 if (XFRM_MODE_SKB_CB(skb)->protocol != IPPROTO_IPV6)
69 goto out; 68 goto out;
@@ -80,10 +79,9 @@ static int xfrm6_mode_tunnel_input(struct xfrm_state *x, struct sk_buff *skb)
80 if (!(x->props.flags & XFRM_STATE_NOECN)) 79 if (!(x->props.flags & XFRM_STATE_NOECN))
81 ipip6_ecn_decapsulate(skb); 80 ipip6_ecn_decapsulate(skb);
82 81
83 old_mac = skb_mac_header(skb);
84 skb_set_mac_header(skb, -skb->mac_len);
85 memmove(skb_mac_header(skb), old_mac, skb->mac_len);
86 skb_reset_network_header(skb); 82 skb_reset_network_header(skb);
83 skb_mac_header_rebuild(skb);
84
87 err = 0; 85 err = 0;
88 86
89out: 87out:
diff --git a/net/mac80211/debugfs_sta.c b/net/mac80211/debugfs_sta.c
index 2406b3e7393f..d86217d56bd7 100644
--- a/net/mac80211/debugfs_sta.c
+++ b/net/mac80211/debugfs_sta.c
@@ -63,14 +63,14 @@ static ssize_t sta_flags_read(struct file *file, char __user *userbuf,
63 test_sta_flag(sta, WLAN_STA_##flg) ? #flg "\n" : "" 63 test_sta_flag(sta, WLAN_STA_##flg) ? #flg "\n" : ""
64 64
65 int res = scnprintf(buf, sizeof(buf), 65 int res = scnprintf(buf, sizeof(buf),
66 "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", 66 "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
67 TEST(AUTH), TEST(ASSOC), TEST(PS_STA), 67 TEST(AUTH), TEST(ASSOC), TEST(PS_STA),
68 TEST(PS_DRIVER), TEST(AUTHORIZED), 68 TEST(PS_DRIVER), TEST(AUTHORIZED),
69 TEST(SHORT_PREAMBLE), 69 TEST(SHORT_PREAMBLE),
70 TEST(WME), TEST(WDS), TEST(CLEAR_PS_FILT), 70 TEST(WME), TEST(WDS), TEST(CLEAR_PS_FILT),
71 TEST(MFP), TEST(BLOCK_BA), TEST(PSPOLL), 71 TEST(MFP), TEST(BLOCK_BA), TEST(PSPOLL),
72 TEST(UAPSD), TEST(SP), TEST(TDLS_PEER), 72 TEST(UAPSD), TEST(SP), TEST(TDLS_PEER),
73 TEST(TDLS_PEER_AUTH)); 73 TEST(TDLS_PEER_AUTH), TEST(RATE_CONTROL));
74#undef TEST 74#undef TEST
75 return simple_read_from_buffer(userbuf, count, ppos, buf, res); 75 return simple_read_from_buffer(userbuf, count, ppos, buf, res);
76} 76}
diff --git a/net/mac80211/rate.c b/net/mac80211/rate.c
index 5a5a7767d541..ad64f4d5271a 100644
--- a/net/mac80211/rate.c
+++ b/net/mac80211/rate.c
@@ -336,7 +336,7 @@ void rate_control_get_rate(struct ieee80211_sub_if_data *sdata,
336 int i; 336 int i;
337 u32 mask; 337 u32 mask;
338 338
339 if (sta) { 339 if (sta && test_sta_flag(sta, WLAN_STA_RATE_CONTROL)) {
340 ista = &sta->sta; 340 ista = &sta->sta;
341 priv_sta = sta->rate_ctrl_priv; 341 priv_sta = sta->rate_ctrl_priv;
342 } 342 }
diff --git a/net/mac80211/rate.h b/net/mac80211/rate.h
index 168427b0ffdc..80cfc006dd74 100644
--- a/net/mac80211/rate.h
+++ b/net/mac80211/rate.h
@@ -41,7 +41,7 @@ static inline void rate_control_tx_status(struct ieee80211_local *local,
41 struct ieee80211_sta *ista = &sta->sta; 41 struct ieee80211_sta *ista = &sta->sta;
42 void *priv_sta = sta->rate_ctrl_priv; 42 void *priv_sta = sta->rate_ctrl_priv;
43 43
44 if (!ref) 44 if (!ref || !test_sta_flag(sta, WLAN_STA_RATE_CONTROL))
45 return; 45 return;
46 46
47 ref->ops->tx_status(ref->priv, sband, ista, priv_sta, skb); 47 ref->ops->tx_status(ref->priv, sband, ista, priv_sta, skb);
@@ -62,6 +62,7 @@ static inline void rate_control_rate_init(struct sta_info *sta)
62 sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; 62 sband = local->hw.wiphy->bands[local->hw.conf.channel->band];
63 63
64 ref->ops->rate_init(ref->priv, sband, ista, priv_sta); 64 ref->ops->rate_init(ref->priv, sband, ista, priv_sta);
65 set_sta_flag(sta, WLAN_STA_RATE_CONTROL);
65} 66}
66 67
67static inline void rate_control_rate_update(struct ieee80211_local *local, 68static inline void rate_control_rate_update(struct ieee80211_local *local,
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h
index 6f77f12dc3fc..bfed851d0d36 100644
--- a/net/mac80211/sta_info.h
+++ b/net/mac80211/sta_info.h
@@ -52,6 +52,7 @@
52 * @WLAN_STA_SP: Station is in a service period, so don't try to 52 * @WLAN_STA_SP: Station is in a service period, so don't try to
53 * reply to other uAPSD trigger frames or PS-Poll. 53 * reply to other uAPSD trigger frames or PS-Poll.
54 * @WLAN_STA_4ADDR_EVENT: 4-addr event was already sent for this frame. 54 * @WLAN_STA_4ADDR_EVENT: 4-addr event was already sent for this frame.
55 * @WLAN_STA_RATE_CONTROL: rate control was initialized for this station.
55 */ 56 */
56enum ieee80211_sta_info_flags { 57enum ieee80211_sta_info_flags {
57 WLAN_STA_AUTH, 58 WLAN_STA_AUTH,
@@ -71,6 +72,7 @@ enum ieee80211_sta_info_flags {
71 WLAN_STA_UAPSD, 72 WLAN_STA_UAPSD,
72 WLAN_STA_SP, 73 WLAN_STA_SP,
73 WLAN_STA_4ADDR_EVENT, 74 WLAN_STA_4ADDR_EVENT,
75 WLAN_STA_RATE_CONTROL,
74}; 76};
75 77
76enum ieee80211_sta_state { 78enum ieee80211_sta_state {
diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c
index 611c3359b94d..2555816e7788 100644
--- a/net/netfilter/ipvs/ip_vs_core.c
+++ b/net/netfilter/ipvs/ip_vs_core.c
@@ -232,6 +232,7 @@ ip_vs_sched_persist(struct ip_vs_service *svc,
232 __be16 dport = 0; /* destination port to forward */ 232 __be16 dport = 0; /* destination port to forward */
233 unsigned int flags; 233 unsigned int flags;
234 struct ip_vs_conn_param param; 234 struct ip_vs_conn_param param;
235 const union nf_inet_addr fwmark = { .ip = htonl(svc->fwmark) };
235 union nf_inet_addr snet; /* source network of the client, 236 union nf_inet_addr snet; /* source network of the client,
236 after masking */ 237 after masking */
237 238
@@ -267,7 +268,6 @@ ip_vs_sched_persist(struct ip_vs_service *svc,
267 { 268 {
268 int protocol = iph.protocol; 269 int protocol = iph.protocol;
269 const union nf_inet_addr *vaddr = &iph.daddr; 270 const union nf_inet_addr *vaddr = &iph.daddr;
270 const union nf_inet_addr fwmark = { .ip = htonl(svc->fwmark) };
271 __be16 vport = 0; 271 __be16 vport = 0;
272 272
273 if (dst_port == svc->port) { 273 if (dst_port == svc->port) {
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index 76613f5a55c0..ed86a3be678e 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -404,19 +404,49 @@ static void __nf_conntrack_hash_insert(struct nf_conn *ct,
404 &net->ct.hash[repl_hash]); 404 &net->ct.hash[repl_hash]);
405} 405}
406 406
407void nf_conntrack_hash_insert(struct nf_conn *ct) 407int
408nf_conntrack_hash_check_insert(struct nf_conn *ct)
408{ 409{
409 struct net *net = nf_ct_net(ct); 410 struct net *net = nf_ct_net(ct);
410 unsigned int hash, repl_hash; 411 unsigned int hash, repl_hash;
412 struct nf_conntrack_tuple_hash *h;
413 struct hlist_nulls_node *n;
411 u16 zone; 414 u16 zone;
412 415
413 zone = nf_ct_zone(ct); 416 zone = nf_ct_zone(ct);
414 hash = hash_conntrack(net, zone, &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple); 417 hash = hash_conntrack(net, zone,
415 repl_hash = hash_conntrack(net, zone, &ct->tuplehash[IP_CT_DIR_REPLY].tuple); 418 &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple);
419 repl_hash = hash_conntrack(net, zone,
420 &ct->tuplehash[IP_CT_DIR_REPLY].tuple);
421
422 spin_lock_bh(&nf_conntrack_lock);
416 423
424 /* See if there's one in the list already, including reverse */
425 hlist_nulls_for_each_entry(h, n, &net->ct.hash[hash], hnnode)
426 if (nf_ct_tuple_equal(&ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple,
427 &h->tuple) &&
428 zone == nf_ct_zone(nf_ct_tuplehash_to_ctrack(h)))
429 goto out;
430 hlist_nulls_for_each_entry(h, n, &net->ct.hash[repl_hash], hnnode)
431 if (nf_ct_tuple_equal(&ct->tuplehash[IP_CT_DIR_REPLY].tuple,
432 &h->tuple) &&
433 zone == nf_ct_zone(nf_ct_tuplehash_to_ctrack(h)))
434 goto out;
435
436 add_timer(&ct->timeout);
437 nf_conntrack_get(&ct->ct_general);
417 __nf_conntrack_hash_insert(ct, hash, repl_hash); 438 __nf_conntrack_hash_insert(ct, hash, repl_hash);
439 NF_CT_STAT_INC(net, insert);
440 spin_unlock_bh(&nf_conntrack_lock);
441
442 return 0;
443
444out:
445 NF_CT_STAT_INC(net, insert_failed);
446 spin_unlock_bh(&nf_conntrack_lock);
447 return -EEXIST;
418} 448}
419EXPORT_SYMBOL_GPL(nf_conntrack_hash_insert); 449EXPORT_SYMBOL_GPL(nf_conntrack_hash_check_insert);
420 450
421/* Confirm a connection given skb; places it in hash table */ 451/* Confirm a connection given skb; places it in hash table */
422int 452int
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c
index 9307b033c0c9..30c9d4ca0218 100644
--- a/net/netfilter/nf_conntrack_netlink.c
+++ b/net/netfilter/nf_conntrack_netlink.c
@@ -1367,15 +1367,12 @@ ctnetlink_create_conntrack(struct net *net, u16 zone,
1367 nf_ct_protonum(ct)); 1367 nf_ct_protonum(ct));
1368 if (helper == NULL) { 1368 if (helper == NULL) {
1369 rcu_read_unlock(); 1369 rcu_read_unlock();
1370 spin_unlock_bh(&nf_conntrack_lock);
1371#ifdef CONFIG_MODULES 1370#ifdef CONFIG_MODULES
1372 if (request_module("nfct-helper-%s", helpname) < 0) { 1371 if (request_module("nfct-helper-%s", helpname) < 0) {
1373 spin_lock_bh(&nf_conntrack_lock);
1374 err = -EOPNOTSUPP; 1372 err = -EOPNOTSUPP;
1375 goto err1; 1373 goto err1;
1376 } 1374 }
1377 1375
1378 spin_lock_bh(&nf_conntrack_lock);
1379 rcu_read_lock(); 1376 rcu_read_lock();
1380 helper = __nf_conntrack_helper_find(helpname, 1377 helper = __nf_conntrack_helper_find(helpname,
1381 nf_ct_l3num(ct), 1378 nf_ct_l3num(ct),
@@ -1468,8 +1465,10 @@ ctnetlink_create_conntrack(struct net *net, u16 zone,
1468 if (tstamp) 1465 if (tstamp)
1469 tstamp->start = ktime_to_ns(ktime_get_real()); 1466 tstamp->start = ktime_to_ns(ktime_get_real());
1470 1467
1471 add_timer(&ct->timeout); 1468 err = nf_conntrack_hash_check_insert(ct);
1472 nf_conntrack_hash_insert(ct); 1469 if (err < 0)
1470 goto err2;
1471
1473 rcu_read_unlock(); 1472 rcu_read_unlock();
1474 1473
1475 return ct; 1474 return ct;
@@ -1490,6 +1489,7 @@ ctnetlink_new_conntrack(struct sock *ctnl, struct sk_buff *skb,
1490 struct nf_conntrack_tuple otuple, rtuple; 1489 struct nf_conntrack_tuple otuple, rtuple;
1491 struct nf_conntrack_tuple_hash *h = NULL; 1490 struct nf_conntrack_tuple_hash *h = NULL;
1492 struct nfgenmsg *nfmsg = nlmsg_data(nlh); 1491 struct nfgenmsg *nfmsg = nlmsg_data(nlh);
1492 struct nf_conn *ct;
1493 u_int8_t u3 = nfmsg->nfgen_family; 1493 u_int8_t u3 = nfmsg->nfgen_family;
1494 u16 zone; 1494 u16 zone;
1495 int err; 1495 int err;
@@ -1510,27 +1510,22 @@ ctnetlink_new_conntrack(struct sock *ctnl, struct sk_buff *skb,
1510 return err; 1510 return err;
1511 } 1511 }
1512 1512
1513 spin_lock_bh(&nf_conntrack_lock);
1514 if (cda[CTA_TUPLE_ORIG]) 1513 if (cda[CTA_TUPLE_ORIG])
1515 h = __nf_conntrack_find(net, zone, &otuple); 1514 h = nf_conntrack_find_get(net, zone, &otuple);
1516 else if (cda[CTA_TUPLE_REPLY]) 1515 else if (cda[CTA_TUPLE_REPLY])
1517 h = __nf_conntrack_find(net, zone, &rtuple); 1516 h = nf_conntrack_find_get(net, zone, &rtuple);
1518 1517
1519 if (h == NULL) { 1518 if (h == NULL) {
1520 err = -ENOENT; 1519 err = -ENOENT;
1521 if (nlh->nlmsg_flags & NLM_F_CREATE) { 1520 if (nlh->nlmsg_flags & NLM_F_CREATE) {
1522 struct nf_conn *ct;
1523 enum ip_conntrack_events events; 1521 enum ip_conntrack_events events;
1524 1522
1525 ct = ctnetlink_create_conntrack(net, zone, cda, &otuple, 1523 ct = ctnetlink_create_conntrack(net, zone, cda, &otuple,
1526 &rtuple, u3); 1524 &rtuple, u3);
1527 if (IS_ERR(ct)) { 1525 if (IS_ERR(ct))
1528 err = PTR_ERR(ct); 1526 return PTR_ERR(ct);
1529 goto out_unlock; 1527
1530 }
1531 err = 0; 1528 err = 0;
1532 nf_conntrack_get(&ct->ct_general);
1533 spin_unlock_bh(&nf_conntrack_lock);
1534 if (test_bit(IPS_EXPECTED_BIT, &ct->status)) 1529 if (test_bit(IPS_EXPECTED_BIT, &ct->status))
1535 events = IPCT_RELATED; 1530 events = IPCT_RELATED;
1536 else 1531 else
@@ -1545,23 +1540,19 @@ ctnetlink_new_conntrack(struct sock *ctnl, struct sk_buff *skb,
1545 ct, NETLINK_CB(skb).pid, 1540 ct, NETLINK_CB(skb).pid,
1546 nlmsg_report(nlh)); 1541 nlmsg_report(nlh));
1547 nf_ct_put(ct); 1542 nf_ct_put(ct);
1548 } else 1543 }
1549 spin_unlock_bh(&nf_conntrack_lock);
1550 1544
1551 return err; 1545 return err;
1552 } 1546 }
1553 /* implicit 'else' */ 1547 /* implicit 'else' */
1554 1548
1555 /* We manipulate the conntrack inside the global conntrack table lock,
1556 * so there's no need to increase the refcount */
1557 err = -EEXIST; 1549 err = -EEXIST;
1550 ct = nf_ct_tuplehash_to_ctrack(h);
1558 if (!(nlh->nlmsg_flags & NLM_F_EXCL)) { 1551 if (!(nlh->nlmsg_flags & NLM_F_EXCL)) {
1559 struct nf_conn *ct = nf_ct_tuplehash_to_ctrack(h); 1552 spin_lock_bh(&nf_conntrack_lock);
1560
1561 err = ctnetlink_change_conntrack(ct, cda); 1553 err = ctnetlink_change_conntrack(ct, cda);
1554 spin_unlock_bh(&nf_conntrack_lock);
1562 if (err == 0) { 1555 if (err == 0) {
1563 nf_conntrack_get(&ct->ct_general);
1564 spin_unlock_bh(&nf_conntrack_lock);
1565 nf_conntrack_eventmask_report((1 << IPCT_REPLY) | 1556 nf_conntrack_eventmask_report((1 << IPCT_REPLY) |
1566 (1 << IPCT_ASSURED) | 1557 (1 << IPCT_ASSURED) |
1567 (1 << IPCT_HELPER) | 1558 (1 << IPCT_HELPER) |
@@ -1570,15 +1561,10 @@ ctnetlink_new_conntrack(struct sock *ctnl, struct sk_buff *skb,
1570 (1 << IPCT_MARK), 1561 (1 << IPCT_MARK),
1571 ct, NETLINK_CB(skb).pid, 1562 ct, NETLINK_CB(skb).pid,
1572 nlmsg_report(nlh)); 1563 nlmsg_report(nlh));
1573 nf_ct_put(ct); 1564 }
1574 } else
1575 spin_unlock_bh(&nf_conntrack_lock);
1576
1577 return err;
1578 } 1565 }
1579 1566
1580out_unlock: 1567 nf_ct_put(ct);
1581 spin_unlock_bh(&nf_conntrack_lock);
1582 return err; 1568 return err;
1583} 1569}
1584 1570
diff --git a/net/netfilter/nf_queue.c b/net/netfilter/nf_queue.c
index b3a7db678b8d..ce60cf0f6c11 100644
--- a/net/netfilter/nf_queue.c
+++ b/net/netfilter/nf_queue.c
@@ -203,6 +203,27 @@ err:
203 return status; 203 return status;
204} 204}
205 205
206#ifdef CONFIG_BRIDGE_NETFILTER
207/* When called from bridge netfilter, skb->data must point to MAC header
208 * before calling skb_gso_segment(). Else, original MAC header is lost
209 * and segmented skbs will be sent to wrong destination.
210 */
211static void nf_bridge_adjust_skb_data(struct sk_buff *skb)
212{
213 if (skb->nf_bridge)
214 __skb_push(skb, skb->network_header - skb->mac_header);
215}
216
217static void nf_bridge_adjust_segmented_data(struct sk_buff *skb)
218{
219 if (skb->nf_bridge)
220 __skb_pull(skb, skb->network_header - skb->mac_header);
221}
222#else
223#define nf_bridge_adjust_skb_data(s) do {} while (0)
224#define nf_bridge_adjust_segmented_data(s) do {} while (0)
225#endif
226
206int nf_queue(struct sk_buff *skb, 227int nf_queue(struct sk_buff *skb,
207 struct list_head *elem, 228 struct list_head *elem,
208 u_int8_t pf, unsigned int hook, 229 u_int8_t pf, unsigned int hook,
@@ -212,7 +233,7 @@ int nf_queue(struct sk_buff *skb,
212 unsigned int queuenum) 233 unsigned int queuenum)
213{ 234{
214 struct sk_buff *segs; 235 struct sk_buff *segs;
215 int err; 236 int err = -EINVAL;
216 unsigned int queued; 237 unsigned int queued;
217 238
218 if (!skb_is_gso(skb)) 239 if (!skb_is_gso(skb))
@@ -228,23 +249,25 @@ int nf_queue(struct sk_buff *skb,
228 break; 249 break;
229 } 250 }
230 251
252 nf_bridge_adjust_skb_data(skb);
231 segs = skb_gso_segment(skb, 0); 253 segs = skb_gso_segment(skb, 0);
232 /* Does not use PTR_ERR to limit the number of error codes that can be 254 /* Does not use PTR_ERR to limit the number of error codes that can be
233 * returned by nf_queue. For instance, callers rely on -ECANCELED to mean 255 * returned by nf_queue. For instance, callers rely on -ECANCELED to mean
234 * 'ignore this hook'. 256 * 'ignore this hook'.
235 */ 257 */
236 if (IS_ERR(segs)) 258 if (IS_ERR(segs))
237 return -EINVAL; 259 goto out_err;
238
239 queued = 0; 260 queued = 0;
240 err = 0; 261 err = 0;
241 do { 262 do {
242 struct sk_buff *nskb = segs->next; 263 struct sk_buff *nskb = segs->next;
243 264
244 segs->next = NULL; 265 segs->next = NULL;
245 if (err == 0) 266 if (err == 0) {
267 nf_bridge_adjust_segmented_data(segs);
246 err = __nf_queue(segs, elem, pf, hook, indev, 268 err = __nf_queue(segs, elem, pf, hook, indev,
247 outdev, okfn, queuenum); 269 outdev, okfn, queuenum);
270 }
248 if (err == 0) 271 if (err == 0)
249 queued++; 272 queued++;
250 else 273 else
@@ -252,11 +275,12 @@ int nf_queue(struct sk_buff *skb,
252 segs = nskb; 275 segs = nskb;
253 } while (segs); 276 } while (segs);
254 277
255 /* also free orig skb if only some segments were queued */ 278 if (queued) {
256 if (unlikely(err && queued))
257 err = 0;
258 if (err == 0)
259 kfree_skb(skb); 279 kfree_skb(skb);
280 return 0;
281 }
282 out_err:
283 nf_bridge_adjust_segmented_data(skb);
260 return err; 284 return err;
261} 285}
262 286
diff --git a/net/netfilter/xt_TEE.c b/net/netfilter/xt_TEE.c
index 3aae66facf9f..4d5057902839 100644
--- a/net/netfilter/xt_TEE.c
+++ b/net/netfilter/xt_TEE.c
@@ -152,9 +152,10 @@ tee_tg_route6(struct sk_buff *skb, const struct xt_tee_tginfo *info)
152 fl6.flowlabel = ((iph->flow_lbl[0] & 0xF) << 16) | 152 fl6.flowlabel = ((iph->flow_lbl[0] & 0xF) << 16) |
153 (iph->flow_lbl[1] << 8) | iph->flow_lbl[2]; 153 (iph->flow_lbl[1] << 8) | iph->flow_lbl[2];
154 dst = ip6_route_output(net, NULL, &fl6); 154 dst = ip6_route_output(net, NULL, &fl6);
155 if (dst == NULL) 155 if (dst->error) {
156 dst_release(dst);
156 return false; 157 return false;
157 158 }
158 skb_dst_drop(skb); 159 skb_dst_drop(skb);
159 skb_dst_set(skb, dst); 160 skb_dst_set(skb, dst);
160 skb->dev = dst->dev; 161 skb->dev = dst->dev;
diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c
index e83d61ca78ca..5da548fa7ae9 100644
--- a/net/sched/sch_netem.c
+++ b/net/sched/sch_netem.c
@@ -501,9 +501,8 @@ tfifo_dequeue:
501 501
502 /* if more time remaining? */ 502 /* if more time remaining? */
503 if (cb->time_to_send <= psched_get_time()) { 503 if (cb->time_to_send <= psched_get_time()) {
504 skb = qdisc_dequeue_tail(sch); 504 __skb_unlink(skb, &sch->q);
505 if (unlikely(!skb)) 505 sch->qstats.backlog -= qdisc_pkt_len(skb);
506 goto qdisc_dequeue;
507 506
508#ifdef CONFIG_NET_CLS_ACT 507#ifdef CONFIG_NET_CLS_ACT
509 /* 508 /*
@@ -539,7 +538,6 @@ deliver:
539 qdisc_watchdog_schedule(&q->watchdog, cb->time_to_send); 538 qdisc_watchdog_schedule(&q->watchdog, cb->time_to_send);
540 } 539 }
541 540
542qdisc_dequeue:
543 if (q->qdisc) { 541 if (q->qdisc) {
544 skb = q->qdisc->ops->dequeue(q->qdisc); 542 skb = q->qdisc->ops->dequeue(q->qdisc);
545 if (skb) 543 if (skb)
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index d0de2a2c3a2d..b89efe6e4c85 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -46,11 +46,37 @@ struct devtable {
46 void *function; 46 void *function;
47}; 47};
48 48
49#define ___cat(a,b) a ## b
50#define __cat(a,b) ___cat(a,b)
51
52/* we need some special handling for this host tool running eventually on
53 * Darwin. The Mach-O section handling is a bit different than ELF section
54 * handling. The differnces in detail are:
55 * a) we have segments which have sections
56 * b) we need a API call to get the respective section symbols */
57#if defined(__MACH__)
58#include <mach-o/getsect.h>
59
60#define INIT_SECTION(name) do { \
61 unsigned long name ## _len; \
62 char *__cat(pstart_,name) = getsectdata("__TEXT", \
63 #name, &__cat(name,_len)); \
64 char *__cat(pstop_,name) = __cat(pstart_,name) + \
65 __cat(name, _len); \
66 __cat(__start_,name) = (void *)__cat(pstart_,name); \
67 __cat(__stop_,name) = (void *)__cat(pstop_,name); \
68 } while (0)
69#define SECTION(name) __attribute__((section("__TEXT, " #name)))
70
71struct devtable **__start___devtable, **__stop___devtable;
72#else
73#define INIT_SECTION(name) /* no-op for ELF */
74#define SECTION(name) __attribute__((section(#name)))
75
49/* We construct a table of pointers in an ELF section (pointers generally 76/* We construct a table of pointers in an ELF section (pointers generally
50 * go unpadded by gcc). ld creates boundary syms for us. */ 77 * go unpadded by gcc). ld creates boundary syms for us. */
51extern struct devtable *__start___devtable[], *__stop___devtable[]; 78extern struct devtable *__start___devtable[], *__stop___devtable[];
52#define ___cat(a,b) a ## b 79#endif /* __MACH__ */
53#define __cat(a,b) ___cat(a,b)
54 80
55#if __GNUC__ == 3 && __GNUC_MINOR__ < 3 81#if __GNUC__ == 3 && __GNUC_MINOR__ < 3
56# define __used __attribute__((__unused__)) 82# define __used __attribute__((__unused__))
@@ -65,8 +91,8 @@ extern struct devtable *__start___devtable[], *__stop___devtable[];
65 (type *)NULL, \ 91 (type *)NULL, \
66 (char *)NULL)), \ 92 (char *)NULL)), \
67 sizeof(type), (function) }; \ 93 sizeof(type), (function) }; \
68 static struct devtable *__attribute__((section("__devtable"))) \ 94 static struct devtable *SECTION(__devtable) __used \
69 __used __cat(devtable_ptr,__LINE__) = &__cat(devtable,__LINE__) 95 __cat(devtable_ptr,__LINE__) = &__cat(devtable,__LINE__)
70 96
71#define ADD(str, sep, cond, field) \ 97#define ADD(str, sep, cond, field) \
72do { \ 98do { \
@@ -1080,6 +1106,7 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
1080 do_pnp_card_entries(symval, sym->st_size, mod); 1106 do_pnp_card_entries(symval, sym->st_size, mod);
1081 else { 1107 else {
1082 struct devtable **p; 1108 struct devtable **p;
1109 INIT_SECTION(__devtable);
1083 1110
1084 for (p = __start___devtable; p < __stop___devtable; p++) { 1111 for (p = __start___devtable; p < __stop___devtable; p++) {
1085 if (sym_is(name, namelen, (*p)->device_id)) { 1112 if (sym_is(name, namelen, (*p)->device_id)) {
diff --git a/sound/pci/azt3328.c b/sound/pci/azt3328.c
index 95ffa6a9db6e..496f14c1a731 100644
--- a/sound/pci/azt3328.c
+++ b/sound/pci/azt3328.c
@@ -2684,10 +2684,9 @@ snd_azf3328_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
2684 err = snd_opl3_hwdep_new(opl3, 0, 1, NULL); 2684 err = snd_opl3_hwdep_new(opl3, 0, 1, NULL);
2685 if (err < 0) 2685 if (err < 0)
2686 goto out_err; 2686 goto out_err;
2687 opl3->private_data = chip;
2687 } 2688 }
2688 2689
2689 opl3->private_data = chip;
2690
2691 sprintf(card->longname, "%s at 0x%lx, irq %i", 2690 sprintf(card->longname, "%s at 0x%lx, irq %i",
2692 card->shortname, chip->ctrl_io, chip->irq); 2691 card->shortname, chip->ctrl_io, chip->irq);
2693 2692
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index c2c65f63bf06..684307372d73 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -1759,7 +1759,11 @@ static void put_vol_mute(struct hda_codec *codec, struct hda_amp_info *info,
1759 parm = ch ? AC_AMP_SET_RIGHT : AC_AMP_SET_LEFT; 1759 parm = ch ? AC_AMP_SET_RIGHT : AC_AMP_SET_LEFT;
1760 parm |= direction == HDA_OUTPUT ? AC_AMP_SET_OUTPUT : AC_AMP_SET_INPUT; 1760 parm |= direction == HDA_OUTPUT ? AC_AMP_SET_OUTPUT : AC_AMP_SET_INPUT;
1761 parm |= index << AC_AMP_SET_INDEX_SHIFT; 1761 parm |= index << AC_AMP_SET_INDEX_SHIFT;
1762 parm |= val; 1762 if ((val & HDA_AMP_MUTE) && !(info->amp_caps & AC_AMPCAP_MUTE) &&
1763 (info->amp_caps & AC_AMPCAP_MIN_MUTE))
1764 ; /* set the zero value as a fake mute */
1765 else
1766 parm |= val;
1763 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, parm); 1767 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, parm);
1764 info->vol[ch] = val; 1768 info->vol[ch] = val;
1765} 1769}
@@ -2026,7 +2030,7 @@ int snd_hda_mixer_amp_tlv(struct snd_kcontrol *kcontrol, int op_flag,
2026 val1 = -((caps & AC_AMPCAP_OFFSET) >> AC_AMPCAP_OFFSET_SHIFT); 2030 val1 = -((caps & AC_AMPCAP_OFFSET) >> AC_AMPCAP_OFFSET_SHIFT);
2027 val1 += ofs; 2031 val1 += ofs;
2028 val1 = ((int)val1) * ((int)val2); 2032 val1 = ((int)val1) * ((int)val2);
2029 if (min_mute) 2033 if (min_mute || (caps & AC_AMPCAP_MIN_MUTE))
2030 val2 |= TLV_DB_SCALE_MUTE; 2034 val2 |= TLV_DB_SCALE_MUTE;
2031 if (put_user(SNDRV_CTL_TLVT_DB_SCALE, _tlv)) 2035 if (put_user(SNDRV_CTL_TLVT_DB_SCALE, _tlv))
2032 return -EFAULT; 2036 return -EFAULT;
@@ -5114,7 +5118,7 @@ static int fill_audio_out_name(struct hda_codec *codec, hda_nid_t nid,
5114 const char *pfx = "", *sfx = ""; 5118 const char *pfx = "", *sfx = "";
5115 5119
5116 /* handle as a speaker if it's a fixed line-out */ 5120 /* handle as a speaker if it's a fixed line-out */
5117 if (!strcmp(name, "Line-Out") && attr == INPUT_PIN_ATTR_INT) 5121 if (!strcmp(name, "Line Out") && attr == INPUT_PIN_ATTR_INT)
5118 name = "Speaker"; 5122 name = "Speaker";
5119 /* check the location */ 5123 /* check the location */
5120 switch (attr) { 5124 switch (attr) {
@@ -5173,7 +5177,7 @@ int snd_hda_get_pin_label(struct hda_codec *codec, hda_nid_t nid,
5173 5177
5174 switch (get_defcfg_device(def_conf)) { 5178 switch (get_defcfg_device(def_conf)) {
5175 case AC_JACK_LINE_OUT: 5179 case AC_JACK_LINE_OUT:
5176 return fill_audio_out_name(codec, nid, cfg, "Line-Out", 5180 return fill_audio_out_name(codec, nid, cfg, "Line Out",
5177 label, maxlen, indexp); 5181 label, maxlen, indexp);
5178 case AC_JACK_SPEAKER: 5182 case AC_JACK_SPEAKER:
5179 return fill_audio_out_name(codec, nid, cfg, "Speaker", 5183 return fill_audio_out_name(codec, nid, cfg, "Speaker",
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h
index e9f71dc0d464..f0f1943a4b2c 100644
--- a/sound/pci/hda/hda_codec.h
+++ b/sound/pci/hda/hda_codec.h
@@ -298,6 +298,9 @@ enum {
298#define AC_AMPCAP_MUTE (1<<31) /* mute capable */ 298#define AC_AMPCAP_MUTE (1<<31) /* mute capable */
299#define AC_AMPCAP_MUTE_SHIFT 31 299#define AC_AMPCAP_MUTE_SHIFT 31
300 300
301/* driver-specific amp-caps: using bits 24-30 */
302#define AC_AMPCAP_MIN_MUTE (1 << 30) /* min-volume = mute */
303
301/* Connection list */ 304/* Connection list */
302#define AC_CLIST_LENGTH (0x7f<<0) 305#define AC_CLIST_LENGTH (0x7f<<0)
303#define AC_CLIST_LONG (1<<7) 306#define AC_CLIST_LONG (1<<7)
diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c
index bc5a993d1146..c83ccdba1e5a 100644
--- a/sound/pci/hda/patch_cirrus.c
+++ b/sound/pci/hda/patch_cirrus.c
@@ -609,7 +609,7 @@ static int add_output(struct hda_codec *codec, hda_nid_t dac, int idx,
609 "Front Speaker", "Surround Speaker", "Bass Speaker" 609 "Front Speaker", "Surround Speaker", "Bass Speaker"
610 }; 610 };
611 static const char * const line_outs[] = { 611 static const char * const line_outs[] = {
612 "Front Line-Out", "Surround Line-Out", "Bass Line-Out" 612 "Front Line Out", "Surround Line Out", "Bass Line Out"
613 }; 613 };
614 614
615 fix_volume_caps(codec, dac); 615 fix_volume_caps(codec, dac);
@@ -635,7 +635,7 @@ static int add_output(struct hda_codec *codec, hda_nid_t dac, int idx,
635 if (num_ctls > 1) 635 if (num_ctls > 1)
636 name = line_outs[idx]; 636 name = line_outs[idx];
637 else 637 else
638 name = "Line-Out"; 638 name = "Line Out";
639 break; 639 break;
640 } 640 }
641 641
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index a7a5733aa4d2..d29d6d377904 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -3482,7 +3482,7 @@ static int cx_automute_mode_info(struct snd_kcontrol *kcontrol,
3482 "Disabled", "Enabled" 3482 "Disabled", "Enabled"
3483 }; 3483 };
3484 static const char * const texts3[] = { 3484 static const char * const texts3[] = {
3485 "Disabled", "Speaker Only", "Line-Out+Speaker" 3485 "Disabled", "Speaker Only", "Line Out+Speaker"
3486 }; 3486 };
3487 const char * const *texts; 3487 const char * const *texts;
3488 3488
@@ -4079,7 +4079,8 @@ static int cx_auto_add_volume_idx(struct hda_codec *codec, const char *basename,
4079 err = snd_hda_ctl_add(codec, nid, kctl); 4079 err = snd_hda_ctl_add(codec, nid, kctl);
4080 if (err < 0) 4080 if (err < 0)
4081 return err; 4081 return err;
4082 if (!(query_amp_caps(codec, nid, hda_dir) & AC_AMPCAP_MUTE)) 4082 if (!(query_amp_caps(codec, nid, hda_dir) &
4083 (AC_AMPCAP_MUTE | AC_AMPCAP_MIN_MUTE)))
4083 break; 4084 break;
4084 } 4085 }
4085 return 0; 4086 return 0;
@@ -4379,6 +4380,22 @@ static const struct snd_pci_quirk cxt_fixups[] = {
4379 {} 4380 {}
4380}; 4381};
4381 4382
4383/* add "fake" mute amp-caps to DACs on cx5051 so that mixer mute switches
4384 * can be created (bko#42825)
4385 */
4386static void add_cx5051_fake_mutes(struct hda_codec *codec)
4387{
4388 static hda_nid_t out_nids[] = {
4389 0x10, 0x11, 0
4390 };
4391 hda_nid_t *p;
4392
4393 for (p = out_nids; *p; p++)
4394 snd_hda_override_amp_caps(codec, *p, HDA_OUTPUT,
4395 AC_AMPCAP_MIN_MUTE |
4396 query_amp_caps(codec, *p, HDA_OUTPUT));
4397}
4398
4382static int patch_conexant_auto(struct hda_codec *codec) 4399static int patch_conexant_auto(struct hda_codec *codec)
4383{ 4400{
4384 struct conexant_spec *spec; 4401 struct conexant_spec *spec;
@@ -4397,6 +4414,9 @@ static int patch_conexant_auto(struct hda_codec *codec)
4397 case 0x14f15045: 4414 case 0x14f15045:
4398 spec->single_adc_amp = 1; 4415 spec->single_adc_amp = 1;
4399 break; 4416 break;
4417 case 0x14f15051:
4418 add_cx5051_fake_mutes(codec);
4419 break;
4400 } 4420 }
4401 4421
4402 apply_pin_fixup(codec, cxt_fixups, cxt_pincfg_tbl); 4422 apply_pin_fixup(codec, cxt_fixups, cxt_pincfg_tbl);
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 3647baa9bfed..f286bb8fda13 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -802,7 +802,7 @@ static int alc_automute_mode_info(struct snd_kcontrol *kcontrol,
802 "Disabled", "Enabled" 802 "Disabled", "Enabled"
803 }; 803 };
804 static const char * const texts3[] = { 804 static const char * const texts3[] = {
805 "Disabled", "Speaker Only", "Line-Out+Speaker" 805 "Disabled", "Speaker Only", "Line Out+Speaker"
806 }; 806 };
807 const char * const *texts; 807 const char * const *texts;
808 808
@@ -1856,7 +1856,7 @@ static const char * const alc_slave_vols[] = {
1856 "Headphone Playback Volume", 1856 "Headphone Playback Volume",
1857 "Speaker Playback Volume", 1857 "Speaker Playback Volume",
1858 "Mono Playback Volume", 1858 "Mono Playback Volume",
1859 "Line-Out Playback Volume", 1859 "Line Out Playback Volume",
1860 "CLFE Playback Volume", 1860 "CLFE Playback Volume",
1861 "Bass Speaker Playback Volume", 1861 "Bass Speaker Playback Volume",
1862 "PCM Playback Volume", 1862 "PCM Playback Volume",
@@ -1873,7 +1873,7 @@ static const char * const alc_slave_sws[] = {
1873 "Speaker Playback Switch", 1873 "Speaker Playback Switch",
1874 "Mono Playback Switch", 1874 "Mono Playback Switch",
1875 "IEC958 Playback Switch", 1875 "IEC958 Playback Switch",
1876 "Line-Out Playback Switch", 1876 "Line Out Playback Switch",
1877 "CLFE Playback Switch", 1877 "CLFE Playback Switch",
1878 "Bass Speaker Playback Switch", 1878 "Bass Speaker Playback Switch",
1879 "PCM Playback Switch", 1879 "PCM Playback Switch",
@@ -3797,7 +3797,7 @@ static void alc_auto_init_input_src(struct hda_codec *codec)
3797 else 3797 else
3798 nums = spec->num_adc_nids; 3798 nums = spec->num_adc_nids;
3799 for (c = 0; c < nums; c++) 3799 for (c = 0; c < nums; c++)
3800 alc_mux_select(codec, 0, spec->cur_mux[c], true); 3800 alc_mux_select(codec, c, spec->cur_mux[c], true);
3801} 3801}
3802 3802
3803/* add mic boosts if needed */ 3803/* add mic boosts if needed */
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 6345df131a00..9dbb5735d778 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -4629,7 +4629,7 @@ static void stac92xx_hp_detect(struct hda_codec *codec)
4629 unsigned int val = AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN; 4629 unsigned int val = AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN;
4630 if (no_hp_sensing(spec, i)) 4630 if (no_hp_sensing(spec, i))
4631 continue; 4631 continue;
4632 if (presence) 4632 if (1 /*presence*/)
4633 stac92xx_set_pinctl(codec, cfg->hp_pins[i], val); 4633 stac92xx_set_pinctl(codec, cfg->hp_pins[i], val);
4634#if 0 /* FIXME */ 4634#if 0 /* FIXME */
4635/* Resetting the pinctl like below may lead to (a sort of) regressions 4635/* Resetting the pinctl like below may lead to (a sort of) regressions
diff --git a/sound/soc/imx/imx-ssi.c b/sound/soc/imx/imx-ssi.c
index 01d1f749cf02..b6adbed6e506 100644
--- a/sound/soc/imx/imx-ssi.c
+++ b/sound/soc/imx/imx-ssi.c
@@ -112,7 +112,7 @@ static int imx_ssi_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt)
112 break; 112 break;
113 case SND_SOC_DAIFMT_DSP_A: 113 case SND_SOC_DAIFMT_DSP_A:
114 /* data on rising edge of bclk, frame high 1clk before data */ 114 /* data on rising edge of bclk, frame high 1clk before data */
115 strcr |= SSI_STCR_TFSL | SSI_STCR_TEFS; 115 strcr |= SSI_STCR_TFSL | SSI_STCR_TXBIT0 | SSI_STCR_TEFS;
116 break; 116 break;
117 } 117 }
118 118
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 1f55ded4047f..1315663c1c09 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -3068,9 +3068,13 @@ static void soc_dapm_shutdown_codec(struct snd_soc_dapm_context *dapm)
3068 * standby. 3068 * standby.
3069 */ 3069 */
3070 if (powerdown) { 3070 if (powerdown) {
3071 snd_soc_dapm_set_bias_level(dapm, SND_SOC_BIAS_PREPARE); 3071 if (dapm->bias_level == SND_SOC_BIAS_ON)
3072 snd_soc_dapm_set_bias_level(dapm,
3073 SND_SOC_BIAS_PREPARE);
3072 dapm_seq_run(dapm, &down_list, 0, false); 3074 dapm_seq_run(dapm, &down_list, 0, false);
3073 snd_soc_dapm_set_bias_level(dapm, SND_SOC_BIAS_STANDBY); 3075 if (dapm->bias_level == SND_SOC_BIAS_PREPARE)
3076 snd_soc_dapm_set_bias_level(dapm,
3077 SND_SOC_BIAS_STANDBY);
3074 } 3078 }
3075} 3079}
3076 3080
@@ -3083,7 +3087,9 @@ void snd_soc_dapm_shutdown(struct snd_soc_card *card)
3083 3087
3084 list_for_each_entry(codec, &card->codec_dev_list, list) { 3088 list_for_each_entry(codec, &card->codec_dev_list, list) {
3085 soc_dapm_shutdown_codec(&codec->dapm); 3089 soc_dapm_shutdown_codec(&codec->dapm);
3086 snd_soc_dapm_set_bias_level(&codec->dapm, SND_SOC_BIAS_OFF); 3090 if (codec->dapm.bias_level == SND_SOC_BIAS_STANDBY)
3091 snd_soc_dapm_set_bias_level(&codec->dapm,
3092 SND_SOC_BIAS_OFF);
3087 } 3093 }
3088} 3094}
3089 3095
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index 2044324b755a..2a6f33cd888c 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -74,6 +74,7 @@ static pid_t perf_event__get_comm_tgid(pid_t pid, char *comm, size_t len)
74 if (size >= len) 74 if (size >= len)
75 size = len - 1; 75 size = len - 1;
76 memcpy(comm, name, size); 76 memcpy(comm, name, size);
77 comm[size] = '\0';
77 78
78 } else if (memcmp(bf, "Tgid:", 5) == 0) { 79 } else if (memcmp(bf, "Tgid:", 5) == 0) {
79 char *tgids = bf + 5; 80 char *tgids = bf + 5;
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 3f16e08a5c8d..ea32a061f1c8 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -349,6 +349,10 @@ struct perf_evsel *perf_evlist__id2evsel(struct perf_evlist *evlist, u64 id)
349 hlist_for_each_entry(sid, pos, head, node) 349 hlist_for_each_entry(sid, pos, head, node)
350 if (sid->id == id) 350 if (sid->id == id)
351 return sid->evsel; 351 return sid->evsel;
352
353 if (!perf_evlist__sample_id_all(evlist))
354 return list_entry(evlist->entries.next, struct perf_evsel, node);
355
352 return NULL; 356 return NULL;
353} 357}
354 358
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index 29cb65459811..e33554a562b3 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -1867,6 +1867,12 @@ static int convert_to_probe_trace_events(struct perf_probe_event *pev,
1867 tev->point.symbol); 1867 tev->point.symbol);
1868 ret = -ENOENT; 1868 ret = -ENOENT;
1869 goto error; 1869 goto error;
1870 } else if (tev->point.offset > sym->end - sym->start) {
1871 pr_warning("Offset specified is greater than size of %s\n",
1872 tev->point.symbol);
1873 ret = -ENOENT;
1874 goto error;
1875
1870 } 1876 }
1871 1877
1872 return 1; 1878 return 1;
diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
index 5d732621a462..74bd2e63c4b4 100644
--- a/tools/perf/util/probe-finder.c
+++ b/tools/perf/util/probe-finder.c
@@ -672,7 +672,7 @@ static int find_variable(Dwarf_Die *sc_die, struct probe_finder *pf)
672static int convert_to_trace_point(Dwarf_Die *sp_die, Dwarf_Addr paddr, 672static int convert_to_trace_point(Dwarf_Die *sp_die, Dwarf_Addr paddr,
673 bool retprobe, struct probe_trace_point *tp) 673 bool retprobe, struct probe_trace_point *tp)
674{ 674{
675 Dwarf_Addr eaddr; 675 Dwarf_Addr eaddr, highaddr;
676 const char *name; 676 const char *name;
677 677
678 /* Copy the name of probe point */ 678 /* Copy the name of probe point */
@@ -683,6 +683,16 @@ static int convert_to_trace_point(Dwarf_Die *sp_die, Dwarf_Addr paddr,
683 dwarf_diename(sp_die)); 683 dwarf_diename(sp_die));
684 return -ENOENT; 684 return -ENOENT;
685 } 685 }
686 if (dwarf_highpc(sp_die, &highaddr) != 0) {
687 pr_warning("Failed to get end address of %s\n",
688 dwarf_diename(sp_die));
689 return -ENOENT;
690 }
691 if (paddr > highaddr) {
692 pr_warning("Offset specified is greater than size of %s\n",
693 dwarf_diename(sp_die));
694 return -EINVAL;
695 }
686 tp->symbol = strdup(name); 696 tp->symbol = strdup(name);
687 if (tp->symbol == NULL) 697 if (tp->symbol == NULL)
688 return -ENOMEM; 698 return -ENOMEM;
diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
index 62a134dc421a..9507c4b251a8 100755
--- a/tools/testing/ktest/ktest.pl
+++ b/tools/testing/ktest/ktest.pl
@@ -3244,9 +3244,11 @@ sub make_min_config {
3244 $in_bisect = 1; 3244 $in_bisect = 1;
3245 3245
3246 my $failed = 0; 3246 my $failed = 0;
3247 build "oldconfig"; 3247 build "oldconfig" or $failed = 1;
3248 start_monitor_and_boot or $failed = 1; 3248 if (!$failed) {
3249 end_monitor; 3249 start_monitor_and_boot or $failed = 1;
3250 end_monitor;
3251 }
3250 3252
3251 $in_bisect = 0; 3253 $in_bisect = 0;
3252 3254