aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/devicetree/bindings/watchdog/twl4030-wdt.txt10
-rw-r--r--MAINTAINERS9
-rw-r--r--Makefile2
-rw-r--r--arch/arm/boot/dts/twl4030.dtsi4
-rw-r--r--arch/arm/configs/multi_v7_defconfig1
-rw-r--r--arch/arm/configs/omap2plus_defconfig5
-rw-r--r--arch/arm/mach-omap1/Makefile2
-rw-r--r--arch/arm/mach-omap1/fb.c80
-rw-r--r--arch/arm/mach-omap2/Makefile2
-rw-r--r--arch/arm/mach-omap2/control.h2
-rw-r--r--arch/arm/mach-omap2/dpll3xxx.c3
-rw-r--r--arch/arm/mach-omap2/drm.c1
-rw-r--r--arch/arm/mach-omap2/dss-common.c3
-rw-r--r--arch/arm/mach-omap2/fb.c (renamed from arch/arm/plat-omap/fb.c)50
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_44xx_data.c1
-rw-r--r--arch/arm/mach-omap2/omap_twl.c8
-rw-r--r--arch/arm/mach-omap2/pmu.c2
-rw-r--r--arch/arm/mach-omap2/prm2xxx.c3
-rw-r--r--arch/arm/mach-omap2/prm3xxx.c3
-rw-r--r--arch/arm/mach-sunxi/sunxi.c4
-rw-r--r--arch/arm/plat-omap/Makefile2
-rw-r--r--arch/arm/plat-omap/dmtimer.c13
-rw-r--r--arch/arm/plat-omap/include/plat/cpu.h4
-rw-r--r--arch/x86/pci/common.c3
-rw-r--r--drivers/atm/solos-pci.c2
-rw-r--r--drivers/gpu/drm/drm_mm.c41
-rw-r--r--drivers/gpu/drm/i915/i915_dma.c3
-rw-r--r--drivers/gpu/drm/i915/i915_drv.h8
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c77
-rw-r--r--drivers/gpu/drm/i915/i915_gem_dmabuf.c2
-rw-r--r--drivers/gpu/drm/i915/i915_gem_execbuffer.c2
-rw-r--r--drivers/gpu/drm/i915/i915_irq.c12
-rw-r--r--drivers/gpu/drm/i915/i915_reg.h4
-rw-r--r--drivers/gpu/drm/i915/intel_display.c23
-rw-r--r--drivers/gpu/drm/i915/intel_pm.c160
-rw-r--r--drivers/gpu/drm/i915/intel_ringbuffer.c76
-rw-r--r--drivers/gpu/drm/i915/intel_ringbuffer.h1
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnve0.fuc5
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnve0.fuc.h17
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvc0.fuc10
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvc0.fuc.h147
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnve0.fuc13
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnve0.fuc.h157
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c11
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/nvc0.h1
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/nve0.c3
-rw-r--r--drivers/gpu/drm/nouveau/core/include/subdev/bios.h1
-rw-r--r--drivers/gpu/drm/nouveau/core/include/subdev/bios/gpio.h8
-rw-r--r--drivers/gpu/drm/nouveau/core/include/subdev/bios/init.h1
-rw-r--r--drivers/gpu/drm/nouveau/core/include/subdev/gpio.h2
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/bios/base.c5
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/bios/gpio.c128
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/bios/init.c65
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/device/nve0.c28
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/gpio/base.c9
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/gpio/nv50.c9
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/gpio/nvd0.c9
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/mxm/base.c2
-rw-r--r--drivers/gpu/drm/radeon/evergreen_cs.c30
-rw-r--r--drivers/gpu/drm/radeon/r600_cs.c29
-rw-r--r--drivers/gpu/drm/radeon/radeon.h3
-rw-r--r--drivers/gpu/drm/radeon/radeon_device.c17
-rw-r--r--drivers/gpu/drm/radeon/radeon_drv.c3
-rw-r--r--drivers/gpu/drm/radeon/radeon_fence.c49
-rw-r--r--drivers/gpu/drm/radeon/radeon_pm.c15
-rw-r--r--drivers/gpu/drm/tegra/dc.c11
-rw-r--r--drivers/gpu/drm/tegra/drm.h18
-rw-r--r--drivers/gpu/drm/tegra/hdmi.c25
-rw-r--r--drivers/gpu/drm/tegra/host1x.c2
-rw-r--r--drivers/hwmon/emc6w201.c2
-rw-r--r--drivers/hwmon/lm73.c16
-rw-r--r--drivers/i2c/busses/i2c-ali1535.c8
-rw-r--r--drivers/i2c/busses/i2c-ali1563.c10
-rw-r--r--drivers/i2c/busses/i2c-ali15x3.c8
-rw-r--r--drivers/i2c/busses/i2c-amd756.c7
-rw-r--r--drivers/i2c/busses/i2c-amd8111.c7
-rw-r--r--drivers/i2c/busses/i2c-at91.c14
-rw-r--r--drivers/i2c/busses/i2c-au1550.c6
-rw-r--r--drivers/i2c/busses/i2c-cpm.c8
-rw-r--r--drivers/i2c/busses/i2c-designware-pcidrv.c6
-rw-r--r--drivers/i2c/busses/i2c-designware-platdrv.c6
-rw-r--r--drivers/i2c/busses/i2c-eg20t.c6
-rw-r--r--drivers/i2c/busses/i2c-elektor.c8
-rw-r--r--drivers/i2c/busses/i2c-gpio.c8
-rw-r--r--drivers/i2c/busses/i2c-highlander.c6
-rw-r--r--drivers/i2c/busses/i2c-hydra.c6
-rw-r--r--drivers/i2c/busses/i2c-i801.c28
-rw-r--r--drivers/i2c/busses/i2c-ibm_iic.c8
-rw-r--r--drivers/i2c/busses/i2c-intel-mid.c6
-rw-r--r--drivers/i2c/busses/i2c-isch.c6
-rw-r--r--drivers/i2c/busses/i2c-mpc.c38
-rw-r--r--drivers/i2c/busses/i2c-mv64xxx.c18
-rw-r--r--drivers/i2c/busses/i2c-mxs.c6
-rw-r--r--drivers/i2c/busses/i2c-nforce2.c12
-rw-r--r--drivers/i2c/busses/i2c-nuc900.c6
-rw-r--r--drivers/i2c/busses/i2c-ocores.c6
-rw-r--r--drivers/i2c/busses/i2c-octeon.c10
-rw-r--r--drivers/i2c/busses/i2c-omap.c6
-rw-r--r--drivers/i2c/busses/i2c-parport-light.c6
-rw-r--r--drivers/i2c/busses/i2c-pasemi.c6
-rw-r--r--drivers/i2c/busses/i2c-pca-isa.c8
-rw-r--r--drivers/i2c/busses/i2c-pca-platform.c6
-rw-r--r--drivers/i2c/busses/i2c-piix4.c32
-rw-r--r--drivers/i2c/busses/i2c-pmcmsp.c6
-rw-r--r--drivers/i2c/busses/i2c-pnx.c6
-rw-r--r--drivers/i2c/busses/i2c-powermac.c16
-rw-r--r--drivers/i2c/busses/i2c-puv3.c6
-rw-r--r--drivers/i2c/busses/i2c-pxa-pci.c6
-rw-r--r--drivers/i2c/busses/i2c-rcar.c6
-rw-r--r--drivers/i2c/busses/i2c-s6000.c8
-rw-r--r--drivers/i2c/busses/i2c-sh7760.c8
-rw-r--r--drivers/i2c/busses/i2c-sh_mobile.c2
-rw-r--r--drivers/i2c/busses/i2c-sirf.c8
-rw-r--r--drivers/i2c/busses/i2c-sis5595.c4
-rw-r--r--drivers/i2c/busses/i2c-sis630.c8
-rw-r--r--drivers/i2c/busses/i2c-sis96x.c6
-rw-r--r--drivers/i2c/busses/i2c-tegra.c8
-rw-r--r--drivers/i2c/busses/i2c-via.c6
-rw-r--r--drivers/i2c/busses/i2c-viapro.c4
-rw-r--r--drivers/i2c/busses/i2c-viperboard.c6
-rw-r--r--drivers/i2c/busses/i2c-xiic.c8
-rw-r--r--drivers/i2c/busses/i2c-xlr.c6
-rw-r--r--drivers/i2c/busses/scx200_acb.c16
-rw-r--r--drivers/i2c/muxes/i2c-mux-gpio.c14
-rw-r--r--drivers/i2c/muxes/i2c-mux-pinctrl.c8
-rw-r--r--drivers/leds/leds-gpio.c5
-rw-r--r--drivers/media/platform/omap3isp/isp.c2
-rw-r--r--drivers/media/usb/uvc/uvc_ctrl.c19
-rw-r--r--drivers/media/usb/uvc/uvc_v4l2.c12
-rw-r--r--drivers/net/ethernet/marvell/mvmdio.c6
-rw-r--r--drivers/net/ethernet/marvell/mvneta.c19
-rw-r--r--drivers/net/ethernet/ti/cpts.c3
-rw-r--r--drivers/net/ethernet/ti/cpts.h1
-rw-r--r--drivers/net/tun.c24
-rw-r--r--drivers/net/vxlan.c6
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8723ae/sw.c2
-rw-r--r--drivers/pci/pci-sysfs.c85
-rw-r--r--drivers/pci/pcie/portdrv_pci.c20
-rw-r--r--drivers/pci/quirks.c7
-rw-r--r--drivers/power/avs/smartreflex.c2
-rw-r--r--drivers/watchdog/da9055_wdt.c17
-rw-r--r--drivers/watchdog/omap_wdt.c1
-rw-r--r--drivers/watchdog/twl4030_wdt.c11
-rw-r--r--fs/ecryptfs/crypto.c2
-rw-r--r--fs/ecryptfs/kthread.c6
-rw-r--r--fs/ecryptfs/mmap.c12
-rw-r--r--fs/eventpoll.c22
-rw-r--r--fs/ext4/extents.c22
-rw-r--r--fs/ext4/file.c8
-rw-r--r--fs/ext4/fsync.c2
-rw-r--r--fs/ext4/inode.c99
-rw-r--r--fs/ext4/namei.c3
-rw-r--r--fs/ext4/super.c30
-rw-r--r--fs/f2fs/acl.c1
-rw-r--r--fs/jbd2/transaction.c30
-rw-r--r--fs/proc/generic.c13
-rw-r--r--fs/proc/task_mmu.c2
-rw-r--r--include/Kbuild3
-rw-r--r--include/drm/drm_mm.h25
-rw-r--r--include/linux/Kbuild5
-rw-r--r--include/linux/hdlc/Kbuild0
-rw-r--r--include/linux/hsi/Kbuild0
-rw-r--r--include/linux/jbd2.h2
-rw-r--r--include/linux/mempolicy.h13
-rw-r--r--include/linux/netdevice.h2
-rw-r--r--include/linux/page-flags.h8
-rw-r--r--include/linux/pci_ids.h1
-rw-r--r--include/linux/pid.h1
-rw-r--r--include/linux/pid_namespace.h4
-rw-r--r--include/linux/raid/Kbuild0
-rw-r--r--include/linux/usb/Kbuild0
-rw-r--r--include/net/sock.h2
-rw-r--r--include/rdma/Kbuild0
-rw-r--r--include/sound/Kbuild0
-rw-r--r--include/trace/events/ext4.h14
-rw-r--r--include/uapi/drm/i915_drm.h10
-rw-r--r--include/uapi/linux/pci_regs.h2
-rw-r--r--kernel/fork.c8
-rw-r--r--kernel/pid.c15
-rw-r--r--kernel/pid_namespace.c4
-rw-r--r--mm/mempolicy.c130
-rw-r--r--mm/shmem.c4
-rw-r--r--mm/vmscan.c107
-rw-r--r--net/batman-adv/bat_iv_ogm.c2
-rw-r--r--net/bridge/br_if.c8
-rw-r--r--net/ceph/messenger.c23
-rw-r--r--net/ceph/osd_client.c34
-rw-r--r--net/core/dev.c18
-rw-r--r--net/core/net-sysfs.c4
-rw-r--r--net/core/sock.c4
-rw-r--r--net/ipv4/arp.c10
-rw-r--r--net/ipv4/ip_gre.c13
-rw-r--r--net/ipv4/tcp_input.c14
-rw-r--r--net/ipv6/ip6_gre.c3
-rw-r--r--net/rds/ib_cm.c11
-rw-r--r--net/rds/ib_recv.c9
-rw-r--r--net/sched/sch_htb.c2
-rw-r--r--net/wireless/reg.c7
-rw-r--r--net/wireless/sysfs.c4
-rw-r--r--scripts/headers_install.pl6
-rw-r--r--sound/soc/codecs/wm_adsp.c367
-rw-r--r--sound/soc/codecs/wm_adsp.h14
202 files changed, 2193 insertions, 1181 deletions
diff --git a/Documentation/devicetree/bindings/watchdog/twl4030-wdt.txt b/Documentation/devicetree/bindings/watchdog/twl4030-wdt.txt
new file mode 100644
index 000000000000..80a37193c0b8
--- /dev/null
+++ b/Documentation/devicetree/bindings/watchdog/twl4030-wdt.txt
@@ -0,0 +1,10 @@
1Device tree bindings for twl4030-wdt driver (TWL4030 watchdog)
2
3Required properties:
4 compatible = "ti,twl4030-wdt";
5
6Example:
7
8watchdog {
9 compatible = "ti,twl4030-wdt";
10};
diff --git a/MAINTAINERS b/MAINTAINERS
index 4e2a1f67a1fc..fa309ab7ccbf 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -5385,6 +5385,15 @@ F: arch/arm/*omap*/
5385F: drivers/i2c/busses/i2c-omap.c 5385F: drivers/i2c/busses/i2c-omap.c
5386F: include/linux/i2c-omap.h 5386F: include/linux/i2c-omap.h
5387 5387
5388OMAP DEVICE TREE SUPPORT
5389M: Benoît Cousson <b-cousson@ti.com>
5390M: Tony Lindgren <tony@atomide.com>
5391L: linux-omap@vger.kernel.org
5392L: devicetree-discuss@lists.ozlabs.org (moderated for non-subscribers)
5393S: Maintained
5394F: arch/arm/boot/dts/*omap*
5395F: arch/arm/boot/dts/*am3*
5396
5388OMAP CLOCK FRAMEWORK SUPPORT 5397OMAP CLOCK FRAMEWORK SUPPORT
5389M: Paul Walmsley <paul@pwsan.com> 5398M: Paul Walmsley <paul@pwsan.com>
5390L: linux-omap@vger.kernel.org 5399L: linux-omap@vger.kernel.org
diff --git a/Makefile b/Makefile
index 275b9567382c..80c5694b29fd 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 3 1VERSION = 3
2PATCHLEVEL = 8 2PATCHLEVEL = 8
3SUBLEVEL = 0 3SUBLEVEL = 0
4EXTRAVERSION = -rc1 4EXTRAVERSION = -rc2
5NAME = Terrified Chipmunk 5NAME = Terrified Chipmunk
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
diff --git a/arch/arm/boot/dts/twl4030.dtsi b/arch/arm/boot/dts/twl4030.dtsi
index 63411b036932..ed0bc9546837 100644
--- a/arch/arm/boot/dts/twl4030.dtsi
+++ b/arch/arm/boot/dts/twl4030.dtsi
@@ -19,6 +19,10 @@
19 interrupts = <11>; 19 interrupts = <11>;
20 }; 20 };
21 21
22 watchdog {
23 compatible = "ti,twl4030-wdt";
24 };
25
22 vdac: regulator-vdac { 26 vdac: regulator-vdac {
23 compatible = "ti,twl4030-vdac"; 27 compatible = "ti,twl4030-vdac";
24 regulator-min-microvolt = <1800000>; 28 regulator-min-microvolt = <1800000>;
diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig
index dbea6f4efe9f..2eeff1e64b6e 100644
--- a/arch/arm/configs/multi_v7_defconfig
+++ b/arch/arm/configs/multi_v7_defconfig
@@ -6,6 +6,7 @@ CONFIG_MACH_ARMADA_370=y
6CONFIG_MACH_ARMADA_XP=y 6CONFIG_MACH_ARMADA_XP=y
7CONFIG_ARCH_HIGHBANK=y 7CONFIG_ARCH_HIGHBANK=y
8CONFIG_ARCH_SOCFPGA=y 8CONFIG_ARCH_SOCFPGA=y
9CONFIG_ARCH_SUNXI=y
9# CONFIG_ARCH_VEXPRESS_CORTEX_A5_A9_ERRATA is not set 10# CONFIG_ARCH_VEXPRESS_CORTEX_A5_A9_ERRATA is not set
10CONFIG_ARM_ERRATA_754322=y 11CONFIG_ARM_ERRATA_754322=y
11CONFIG_SMP=y 12CONFIG_SMP=y
diff --git a/arch/arm/configs/omap2plus_defconfig b/arch/arm/configs/omap2plus_defconfig
index a1dc5c071e71..82ce8d738fa1 100644
--- a/arch/arm/configs/omap2plus_defconfig
+++ b/arch/arm/configs/omap2plus_defconfig
@@ -65,6 +65,8 @@ CONFIG_MAC80211_RC_PID=y
65CONFIG_MAC80211_RC_DEFAULT_PID=y 65CONFIG_MAC80211_RC_DEFAULT_PID=y
66CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 66CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
67CONFIG_CONNECTOR=y 67CONFIG_CONNECTOR=y
68CONFIG_DEVTMPFS=y
69CONFIG_DEVTMPFS_MOUNT=y
68CONFIG_MTD=y 70CONFIG_MTD=y
69CONFIG_MTD_CMDLINE_PARTS=y 71CONFIG_MTD_CMDLINE_PARTS=y
70CONFIG_MTD_CHAR=y 72CONFIG_MTD_CHAR=y
@@ -132,9 +134,11 @@ CONFIG_POWER_SUPPLY=y
132CONFIG_WATCHDOG=y 134CONFIG_WATCHDOG=y
133CONFIG_OMAP_WATCHDOG=y 135CONFIG_OMAP_WATCHDOG=y
134CONFIG_TWL4030_WATCHDOG=y 136CONFIG_TWL4030_WATCHDOG=y
137CONFIG_MFD_TPS65217=y
135CONFIG_REGULATOR_TWL4030=y 138CONFIG_REGULATOR_TWL4030=y
136CONFIG_REGULATOR_TPS65023=y 139CONFIG_REGULATOR_TPS65023=y
137CONFIG_REGULATOR_TPS6507X=y 140CONFIG_REGULATOR_TPS6507X=y
141CONFIG_REGULATOR_TPS65217=y
138CONFIG_FB=y 142CONFIG_FB=y
139CONFIG_FIRMWARE_EDID=y 143CONFIG_FIRMWARE_EDID=y
140CONFIG_FB_MODE_HELPERS=y 144CONFIG_FB_MODE_HELPERS=y
@@ -170,6 +174,7 @@ CONFIG_SND_DEBUG=y
170CONFIG_SND_USB_AUDIO=m 174CONFIG_SND_USB_AUDIO=m
171CONFIG_SND_SOC=m 175CONFIG_SND_SOC=m
172CONFIG_SND_OMAP_SOC=m 176CONFIG_SND_OMAP_SOC=m
177CONFIG_SND_OMAP_SOC_OMAP_TWL4030=m
173CONFIG_SND_OMAP_SOC_OMAP3_PANDORA=m 178CONFIG_SND_OMAP_SOC_OMAP3_PANDORA=m
174CONFIG_USB=y 179CONFIG_USB=y
175CONFIG_USB_DEBUG=y 180CONFIG_USB_DEBUG=y
diff --git a/arch/arm/mach-omap1/Makefile b/arch/arm/mach-omap1/Makefile
index f0e69cbc5baa..222d58c0ae76 100644
--- a/arch/arm/mach-omap1/Makefile
+++ b/arch/arm/mach-omap1/Makefile
@@ -4,7 +4,7 @@
4 4
5# Common support 5# Common support
6obj-y := io.o id.o sram-init.o sram.o time.o irq.o mux.o flash.o \ 6obj-y := io.o id.o sram-init.o sram.o time.o irq.o mux.o flash.o \
7 serial.o devices.o dma.o 7 serial.o devices.o dma.o fb.o
8obj-y += clock.o clock_data.o opp_data.o reset.o pm_bus.o timer.o 8obj-y += clock.o clock_data.o opp_data.o reset.o pm_bus.o timer.o
9 9
10ifneq ($(CONFIG_SND_OMAP_SOC_MCBSP),) 10ifneq ($(CONFIG_SND_OMAP_SOC_MCBSP),)
diff --git a/arch/arm/mach-omap1/fb.c b/arch/arm/mach-omap1/fb.c
new file mode 100644
index 000000000000..c770d45c7226
--- /dev/null
+++ b/arch/arm/mach-omap1/fb.c
@@ -0,0 +1,80 @@
1/*
2 * File: arch/arm/plat-omap/fb.c
3 *
4 * Framebuffer device registration for TI OMAP platforms
5 *
6 * Copyright (C) 2006 Nokia Corporation
7 * Author: Imre Deak <imre.deak@nokia.com>
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 */
23
24#include <linux/module.h>
25#include <linux/kernel.h>
26#include <linux/mm.h>
27#include <linux/init.h>
28#include <linux/platform_device.h>
29#include <linux/memblock.h>
30#include <linux/io.h>
31#include <linux/omapfb.h>
32#include <linux/dma-mapping.h>
33
34#include <asm/mach/map.h>
35
36#if defined(CONFIG_FB_OMAP) || defined(CONFIG_FB_OMAP_MODULE)
37
38static bool omapfb_lcd_configured;
39static struct omapfb_platform_data omapfb_config;
40
41static u64 omap_fb_dma_mask = ~(u32)0;
42
43static struct platform_device omap_fb_device = {
44 .name = "omapfb",
45 .id = -1,
46 .dev = {
47 .dma_mask = &omap_fb_dma_mask,
48 .coherent_dma_mask = DMA_BIT_MASK(32),
49 .platform_data = &omapfb_config,
50 },
51 .num_resources = 0,
52};
53
54void __init omapfb_set_lcd_config(const struct omap_lcd_config *config)
55{
56 omapfb_config.lcd = *config;
57 omapfb_lcd_configured = true;
58}
59
60static int __init omap_init_fb(void)
61{
62 /*
63 * If the board file has not set the lcd config with
64 * omapfb_set_lcd_config(), don't bother registering the omapfb device
65 */
66 if (!omapfb_lcd_configured)
67 return 0;
68
69 return platform_device_register(&omap_fb_device);
70}
71
72arch_initcall(omap_init_fb);
73
74#else
75
76void __init omapfb_set_lcd_config(const struct omap_lcd_config *config)
77{
78}
79
80#endif
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index a8004f33b7e2..947cafe65aef 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -3,7 +3,7 @@
3# 3#
4 4
5# Common support 5# Common support
6obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer.o pm.o \ 6obj-y := id.o io.o control.o mux.o devices.o fb.o serial.o gpmc.o timer.o pm.o \
7 common.o gpio.o dma.o wd_timer.o display.o i2c.o hdq1w.o omap_hwmod.o \ 7 common.o gpio.o dma.o wd_timer.o display.o i2c.o hdq1w.o omap_hwmod.o \
8 omap_device.o sram.o 8 omap_device.o sram.o
9 9
diff --git a/arch/arm/mach-omap2/control.h b/arch/arm/mach-omap2/control.h
index 3d944d3263d2..e6c328128a0a 100644
--- a/arch/arm/mach-omap2/control.h
+++ b/arch/arm/mach-omap2/control.h
@@ -234,7 +234,7 @@
234#define OMAP343X_PADCONF_ETK_D14 OMAP343X_PADCONF_ETK(16) 234#define OMAP343X_PADCONF_ETK_D14 OMAP343X_PADCONF_ETK(16)
235#define OMAP343X_PADCONF_ETK_D15 OMAP343X_PADCONF_ETK(17) 235#define OMAP343X_PADCONF_ETK_D15 OMAP343X_PADCONF_ETK(17)
236 236
237/* 34xx GENERAL_WKUP regist offsets */ 237/* 34xx GENERAL_WKUP register offsets */
238#define OMAP343X_CONTROL_WKUP_DEBOBSMUX(i) (OMAP343X_CONTROL_GENERAL_WKUP + \ 238#define OMAP343X_CONTROL_WKUP_DEBOBSMUX(i) (OMAP343X_CONTROL_GENERAL_WKUP + \
239 0x008 + (i)) 239 0x008 + (i))
240#define OMAP343X_CONTROL_WKUP_DEBOBS0 (OMAP343X_CONTROL_GENERAL_WKUP + 0x008) 240#define OMAP343X_CONTROL_WKUP_DEBOBS0 (OMAP343X_CONTROL_GENERAL_WKUP + 0x008)
diff --git a/arch/arm/mach-omap2/dpll3xxx.c b/arch/arm/mach-omap2/dpll3xxx.c
index 2bb18838cba9..0a02aab5df67 100644
--- a/arch/arm/mach-omap2/dpll3xxx.c
+++ b/arch/arm/mach-omap2/dpll3xxx.c
@@ -504,8 +504,7 @@ int omap3_noncore_dpll_set_rate(struct clk_hw *hw, unsigned long rate,
504 if (!cpu_is_omap44xx() && !cpu_is_omap3630()) { 504 if (!cpu_is_omap44xx() && !cpu_is_omap3630()) {
505 freqsel = _omap3_dpll_compute_freqsel(clk, 505 freqsel = _omap3_dpll_compute_freqsel(clk,
506 dd->last_rounded_n); 506 dd->last_rounded_n);
507 if (!freqsel) 507 WARN_ON(!freqsel);
508 WARN_ON(1);
509 } 508 }
510 509
511 pr_debug("%s: %s: set rate: locking rate to %lu.\n", 510 pr_debug("%s: %s: set rate: locking rate to %lu.\n",
diff --git a/arch/arm/mach-omap2/drm.c b/arch/arm/mach-omap2/drm.c
index fce5aa3fff49..4c7566c7e24a 100644
--- a/arch/arm/mach-omap2/drm.c
+++ b/arch/arm/mach-omap2/drm.c
@@ -27,7 +27,6 @@
27 27
28#include "omap_device.h" 28#include "omap_device.h"
29#include "omap_hwmod.h" 29#include "omap_hwmod.h"
30#include <plat/cpu.h>
31 30
32#if defined(CONFIG_DRM_OMAP) || (CONFIG_DRM_OMAP_MODULE) 31#if defined(CONFIG_DRM_OMAP) || (CONFIG_DRM_OMAP_MODULE)
33 32
diff --git a/arch/arm/mach-omap2/dss-common.c b/arch/arm/mach-omap2/dss-common.c
index 679a0478644f..4be5cfc81ab8 100644
--- a/arch/arm/mach-omap2/dss-common.c
+++ b/arch/arm/mach-omap2/dss-common.c
@@ -31,8 +31,7 @@
31#include <video/omap-panel-nokia-dsi.h> 31#include <video/omap-panel-nokia-dsi.h>
32#include <video/omap-panel-picodlp.h> 32#include <video/omap-panel-picodlp.h>
33 33
34#include <plat/cpu.h> 34#include "soc.h"
35
36#include "dss-common.h" 35#include "dss-common.h"
37#include "mux.h" 36#include "mux.h"
38 37
diff --git a/arch/arm/plat-omap/fb.c b/arch/arm/mach-omap2/fb.c
index a3367b783fc7..d9bd965f6d07 100644
--- a/arch/arm/plat-omap/fb.c
+++ b/arch/arm/mach-omap2/fb.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * File: arch/arm/plat-omap/fb.c
3 *
4 * Framebuffer device registration for TI OMAP platforms 2 * Framebuffer device registration for TI OMAP platforms
5 * 3 *
6 * Copyright (C) 2006 Nokia Corporation 4 * Copyright (C) 2006 Nokia Corporation
@@ -33,7 +31,7 @@
33 31
34#include <asm/mach/map.h> 32#include <asm/mach/map.h>
35 33
36#include <plat/cpu.h> 34#include "soc.h"
37 35
38#ifdef CONFIG_OMAP2_VRFB 36#ifdef CONFIG_OMAP2_VRFB
39 37
@@ -94,45 +92,7 @@ static int __init omap_init_vrfb(void)
94arch_initcall(omap_init_vrfb); 92arch_initcall(omap_init_vrfb);
95#endif 93#endif
96 94
97#if defined(CONFIG_FB_OMAP) || defined(CONFIG_FB_OMAP_MODULE) 95#if defined(CONFIG_FB_OMAP2) || defined(CONFIG_FB_OMAP2_MODULE)
98
99static bool omapfb_lcd_configured;
100static struct omapfb_platform_data omapfb_config;
101
102static u64 omap_fb_dma_mask = ~(u32)0;
103
104static struct platform_device omap_fb_device = {
105 .name = "omapfb",
106 .id = -1,
107 .dev = {
108 .dma_mask = &omap_fb_dma_mask,
109 .coherent_dma_mask = DMA_BIT_MASK(32),
110 .platform_data = &omapfb_config,
111 },
112 .num_resources = 0,
113};
114
115void __init omapfb_set_lcd_config(const struct omap_lcd_config *config)
116{
117 omapfb_config.lcd = *config;
118 omapfb_lcd_configured = true;
119}
120
121static int __init omap_init_fb(void)
122{
123 /*
124 * If the board file has not set the lcd config with
125 * omapfb_set_lcd_config(), don't bother registering the omapfb device
126 */
127 if (!omapfb_lcd_configured)
128 return 0;
129
130 return platform_device_register(&omap_fb_device);
131}
132
133arch_initcall(omap_init_fb);
134
135#elif defined(CONFIG_FB_OMAP2) || defined(CONFIG_FB_OMAP2_MODULE)
136 96
137static u64 omap_fb_dma_mask = ~(u32)0; 97static u64 omap_fb_dma_mask = ~(u32)0;
138static struct omapfb_platform_data omapfb_config; 98static struct omapfb_platform_data omapfb_config;
@@ -155,10 +115,4 @@ static int __init omap_init_fb(void)
155 115
156arch_initcall(omap_init_fb); 116arch_initcall(omap_init_fb);
157 117
158#else
159
160void __init omapfb_set_lcd_config(const struct omap_lcd_config *config)
161{
162}
163
164#endif 118#endif
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index f9fab942d5ba..129d5081ed15 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -26,7 +26,6 @@
26 26
27#include <linux/omap-dma.h> 27#include <linux/omap-dma.h>
28 28
29#include <linux/platform_data/omap_ocp2scp.h>
30#include <linux/platform_data/spi-omap2-mcspi.h> 29#include <linux/platform_data/spi-omap2-mcspi.h>
31#include <linux/platform_data/asoc-ti-mcbsp.h> 30#include <linux/platform_data/asoc-ti-mcbsp.h>
32#include <linux/platform_data/iommu-omap.h> 31#include <linux/platform_data/iommu-omap.h>
diff --git a/arch/arm/mach-omap2/omap_twl.c b/arch/arm/mach-omap2/omap_twl.c
index fefd40166624..615e5b1fb025 100644
--- a/arch/arm/mach-omap2/omap_twl.c
+++ b/arch/arm/mach-omap2/omap_twl.c
@@ -292,8 +292,8 @@ int __init omap3_twl_set_sr_bit(bool enable)
292 if (twl_sr_enable_autoinit) 292 if (twl_sr_enable_autoinit)
293 pr_warning("%s: unexpected multiple calls\n", __func__); 293 pr_warning("%s: unexpected multiple calls\n", __func__);
294 294
295 ret = twl_i2c_read_u8(TWL4030_MODULE_PM_RECEIVER, &temp, 295 ret = twl_i2c_read_u8(TWL_MODULE_PM_RECEIVER, &temp,
296 TWL4030_DCDC_GLOBAL_CFG); 296 TWL4030_DCDC_GLOBAL_CFG);
297 if (ret) 297 if (ret)
298 goto err; 298 goto err;
299 299
@@ -302,8 +302,8 @@ int __init omap3_twl_set_sr_bit(bool enable)
302 else 302 else
303 temp &= ~SMARTREFLEX_ENABLE; 303 temp &= ~SMARTREFLEX_ENABLE;
304 304
305 ret = twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, temp, 305 ret = twl_i2c_write_u8(TWL_MODULE_PM_RECEIVER, temp,
306 TWL4030_DCDC_GLOBAL_CFG); 306 TWL4030_DCDC_GLOBAL_CFG);
307 if (!ret) { 307 if (!ret) {
308 twl_sr_enable_autoinit = true; 308 twl_sr_enable_autoinit = true;
309 return 0; 309 return 0;
diff --git a/arch/arm/mach-omap2/pmu.c b/arch/arm/mach-omap2/pmu.c
index 250d909e38bd..eb78ae7a3464 100644
--- a/arch/arm/mach-omap2/pmu.c
+++ b/arch/arm/mach-omap2/pmu.c
@@ -11,8 +11,6 @@
11 * the Free Software Foundation; either version 2 of the License, or 11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version. 12 * (at your option) any later version.
13 */ 13 */
14#include <linux/pm_runtime.h>
15
16#include <asm/pmu.h> 14#include <asm/pmu.h>
17 15
18#include "soc.h" 16#include "soc.h"
diff --git a/arch/arm/mach-omap2/prm2xxx.c b/arch/arm/mach-omap2/prm2xxx.c
index faeab18696df..cc0e71430af1 100644
--- a/arch/arm/mach-omap2/prm2xxx.c
+++ b/arch/arm/mach-omap2/prm2xxx.c
@@ -18,9 +18,8 @@
18#include <linux/io.h> 18#include <linux/io.h>
19#include <linux/irq.h> 19#include <linux/irq.h>
20 20
21#include "soc.h"
21#include "common.h" 22#include "common.h"
22#include <plat/cpu.h>
23
24#include "vp.h" 23#include "vp.h"
25#include "powerdomain.h" 24#include "powerdomain.h"
26#include "clockdomain.h" 25#include "clockdomain.h"
diff --git a/arch/arm/mach-omap2/prm3xxx.c b/arch/arm/mach-omap2/prm3xxx.c
index db198d058584..39822aabcff3 100644
--- a/arch/arm/mach-omap2/prm3xxx.c
+++ b/arch/arm/mach-omap2/prm3xxx.c
@@ -18,9 +18,8 @@
18#include <linux/io.h> 18#include <linux/io.h>
19#include <linux/irq.h> 19#include <linux/irq.h>
20 20
21#include "soc.h"
21#include "common.h" 22#include "common.h"
22#include <plat/cpu.h>
23
24#include "vp.h" 23#include "vp.h"
25#include "powerdomain.h" 24#include "powerdomain.h"
26#include "prm3xxx.h" 25#include "prm3xxx.h"
diff --git a/arch/arm/mach-sunxi/sunxi.c b/arch/arm/mach-sunxi/sunxi.c
index 9be910f7920b..1dc8a92e5a5f 100644
--- a/arch/arm/mach-sunxi/sunxi.c
+++ b/arch/arm/mach-sunxi/sunxi.c
@@ -80,8 +80,8 @@ static void __init sunxi_dt_init(void)
80} 80}
81 81
82static const char * const sunxi_board_dt_compat[] = { 82static const char * const sunxi_board_dt_compat[] = {
83 "allwinner,sun4i", 83 "allwinner,sun4i-a10",
84 "allwinner,sun5i", 84 "allwinner,sun5i-a13",
85 NULL, 85 NULL,
86}; 86};
87 87
diff --git a/arch/arm/plat-omap/Makefile b/arch/arm/plat-omap/Makefile
index 9d9aa2f55129..a14a78a2f149 100644
--- a/arch/arm/plat-omap/Makefile
+++ b/arch/arm/plat-omap/Makefile
@@ -3,7 +3,7 @@
3# 3#
4 4
5# Common support 5# Common support
6obj-y := sram.o dma.o fb.o counter_32k.o 6obj-y := sram.o dma.o counter_32k.o
7obj-m := 7obj-m :=
8obj-n := 8obj-n :=
9obj- := 9obj- :=
diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c
index 89585c293554..d51b75bdcad4 100644
--- a/arch/arm/plat-omap/dmtimer.c
+++ b/arch/arm/plat-omap/dmtimer.c
@@ -898,19 +898,8 @@ static struct platform_driver omap_dm_timer_driver = {
898 }, 898 },
899}; 899};
900 900
901static int __init omap_dm_timer_driver_init(void)
902{
903 return platform_driver_register(&omap_dm_timer_driver);
904}
905
906static void __exit omap_dm_timer_driver_exit(void)
907{
908 platform_driver_unregister(&omap_dm_timer_driver);
909}
910
911early_platform_init("earlytimer", &omap_dm_timer_driver); 901early_platform_init("earlytimer", &omap_dm_timer_driver);
912module_init(omap_dm_timer_driver_init); 902module_platform_driver(omap_dm_timer_driver);
913module_exit(omap_dm_timer_driver_exit);
914 903
915MODULE_DESCRIPTION("OMAP Dual-Mode Timer Driver"); 904MODULE_DESCRIPTION("OMAP Dual-Mode Timer Driver");
916MODULE_LICENSE("GPL"); 905MODULE_LICENSE("GPL");
diff --git a/arch/arm/plat-omap/include/plat/cpu.h b/arch/arm/plat-omap/include/plat/cpu.h
index b4516aba67ed..c9a66bf36c9a 100644
--- a/arch/arm/plat-omap/include/plat/cpu.h
+++ b/arch/arm/plat-omap/include/plat/cpu.h
@@ -32,8 +32,4 @@
32#include <mach/soc.h> 32#include <mach/soc.h>
33#endif 33#endif
34 34
35#ifdef CONFIG_ARCH_OMAP2PLUS
36#include "../../mach-omap2/soc.h"
37#endif
38
39#endif 35#endif
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
index 1b1dda90a945..412e1286d1fc 100644
--- a/arch/x86/pci/common.c
+++ b/arch/x86/pci/common.c
@@ -434,7 +434,8 @@ static const struct dmi_system_id __devinitconst pciprobe_dmi_table[] = {
434 .callback = set_scan_all, 434 .callback = set_scan_all,
435 .ident = "Stratus/NEC ftServer", 435 .ident = "Stratus/NEC ftServer",
436 .matches = { 436 .matches = {
437 DMI_MATCH(DMI_SYS_VENDOR, "ftServer"), 437 DMI_MATCH(DMI_SYS_VENDOR, "Stratus"),
438 DMI_MATCH(DMI_PRODUCT_NAME, "ftServer"),
438 }, 439 },
439 }, 440 },
440 {} 441 {}
diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c
index d70abe77f737..d47db401027f 100644
--- a/drivers/atm/solos-pci.c
+++ b/drivers/atm/solos-pci.c
@@ -538,7 +538,7 @@ static ssize_t geos_gpio_store(struct device *dev, struct device_attribute *attr
538 } else { 538 } else {
539 count = -EINVAL; 539 count = -EINVAL;
540 } 540 }
541 spin_lock_irq(&card->param_queue_lock); 541 spin_unlock_irq(&card->param_queue_lock);
542 return count; 542 return count;
543} 543}
544 544
diff --git a/drivers/gpu/drm/drm_mm.c b/drivers/gpu/drm/drm_mm.c
index 0761a03cdbb2..2bf9670ba29b 100644
--- a/drivers/gpu/drm/drm_mm.c
+++ b/drivers/gpu/drm/drm_mm.c
@@ -184,19 +184,27 @@ EXPORT_SYMBOL(drm_mm_get_block_generic);
184 * -ENOSPC if no suitable free area is available. The preallocated memory node 184 * -ENOSPC if no suitable free area is available. The preallocated memory node
185 * must be cleared. 185 * must be cleared.
186 */ 186 */
187int drm_mm_insert_node(struct drm_mm *mm, struct drm_mm_node *node, 187int drm_mm_insert_node_generic(struct drm_mm *mm, struct drm_mm_node *node,
188 unsigned long size, unsigned alignment) 188 unsigned long size, unsigned alignment,
189 unsigned long color)
189{ 190{
190 struct drm_mm_node *hole_node; 191 struct drm_mm_node *hole_node;
191 192
192 hole_node = drm_mm_search_free(mm, size, alignment, false); 193 hole_node = drm_mm_search_free_generic(mm, size, alignment,
194 color, 0);
193 if (!hole_node) 195 if (!hole_node)
194 return -ENOSPC; 196 return -ENOSPC;
195 197
196 drm_mm_insert_helper(hole_node, node, size, alignment, 0); 198 drm_mm_insert_helper(hole_node, node, size, alignment, color);
197
198 return 0; 199 return 0;
199} 200}
201EXPORT_SYMBOL(drm_mm_insert_node_generic);
202
203int drm_mm_insert_node(struct drm_mm *mm, struct drm_mm_node *node,
204 unsigned long size, unsigned alignment)
205{
206 return drm_mm_insert_node_generic(mm, node, size, alignment, 0);
207}
200EXPORT_SYMBOL(drm_mm_insert_node); 208EXPORT_SYMBOL(drm_mm_insert_node);
201 209
202static void drm_mm_insert_helper_range(struct drm_mm_node *hole_node, 210static void drm_mm_insert_helper_range(struct drm_mm_node *hole_node,
@@ -275,22 +283,31 @@ EXPORT_SYMBOL(drm_mm_get_block_range_generic);
275 * -ENOSPC if no suitable free area is available. This is for range 283 * -ENOSPC if no suitable free area is available. This is for range
276 * restricted allocations. The preallocated memory node must be cleared. 284 * restricted allocations. The preallocated memory node must be cleared.
277 */ 285 */
278int drm_mm_insert_node_in_range(struct drm_mm *mm, struct drm_mm_node *node, 286int drm_mm_insert_node_in_range_generic(struct drm_mm *mm, struct drm_mm_node *node,
279 unsigned long size, unsigned alignment, 287 unsigned long size, unsigned alignment, unsigned long color,
280 unsigned long start, unsigned long end) 288 unsigned long start, unsigned long end)
281{ 289{
282 struct drm_mm_node *hole_node; 290 struct drm_mm_node *hole_node;
283 291
284 hole_node = drm_mm_search_free_in_range(mm, size, alignment, 292 hole_node = drm_mm_search_free_in_range_generic(mm,
285 start, end, false); 293 size, alignment, color,
294 start, end, 0);
286 if (!hole_node) 295 if (!hole_node)
287 return -ENOSPC; 296 return -ENOSPC;
288 297
289 drm_mm_insert_helper_range(hole_node, node, size, alignment, 0, 298 drm_mm_insert_helper_range(hole_node, node,
299 size, alignment, color,
290 start, end); 300 start, end);
291
292 return 0; 301 return 0;
293} 302}
303EXPORT_SYMBOL(drm_mm_insert_node_in_range_generic);
304
305int drm_mm_insert_node_in_range(struct drm_mm *mm, struct drm_mm_node *node,
306 unsigned long size, unsigned alignment,
307 unsigned long start, unsigned long end)
308{
309 return drm_mm_insert_node_in_range_generic(mm, node, size, alignment, 0, start, end);
310}
294EXPORT_SYMBOL(drm_mm_insert_node_in_range); 311EXPORT_SYMBOL(drm_mm_insert_node_in_range);
295 312
296/** 313/**
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index 8f63cd5de4b4..99daa896105d 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -989,6 +989,9 @@ static int i915_getparam(struct drm_device *dev, void *data,
989 case I915_PARAM_HAS_SECURE_BATCHES: 989 case I915_PARAM_HAS_SECURE_BATCHES:
990 value = capable(CAP_SYS_ADMIN); 990 value = capable(CAP_SYS_ADMIN);
991 break; 991 break;
992 case I915_PARAM_HAS_PINNED_BATCHES:
993 value = 1;
994 break;
992 default: 995 default:
993 DRM_DEBUG_DRIVER("Unknown parameter %d\n", 996 DRM_DEBUG_DRIVER("Unknown parameter %d\n",
994 param->param); 997 param->param);
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 557843dd4b2e..ed3059575576 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -780,6 +780,7 @@ typedef struct drm_i915_private {
780 struct i915_hw_ppgtt *aliasing_ppgtt; 780 struct i915_hw_ppgtt *aliasing_ppgtt;
781 781
782 struct shrinker inactive_shrinker; 782 struct shrinker inactive_shrinker;
783 bool shrinker_no_lock_stealing;
783 784
784 /** 785 /**
785 * List of objects currently involved in rendering. 786 * List of objects currently involved in rendering.
@@ -1100,6 +1101,7 @@ struct drm_i915_gem_object {
1100 */ 1101 */
1101 atomic_t pending_flip; 1102 atomic_t pending_flip;
1102}; 1103};
1104#define to_gem_object(obj) (&((struct drm_i915_gem_object *)(obj))->base)
1103 1105
1104#define to_intel_bo(x) container_of(x, struct drm_i915_gem_object, base) 1106#define to_intel_bo(x) container_of(x, struct drm_i915_gem_object, base)
1105 1107
@@ -1166,6 +1168,9 @@ struct drm_i915_file_private {
1166#define IS_IVB_GT1(dev) ((dev)->pci_device == 0x0156 || \ 1168#define IS_IVB_GT1(dev) ((dev)->pci_device == 0x0156 || \
1167 (dev)->pci_device == 0x0152 || \ 1169 (dev)->pci_device == 0x0152 || \
1168 (dev)->pci_device == 0x015a) 1170 (dev)->pci_device == 0x015a)
1171#define IS_SNB_GT1(dev) ((dev)->pci_device == 0x0102 || \
1172 (dev)->pci_device == 0x0106 || \
1173 (dev)->pci_device == 0x010A)
1169#define IS_VALLEYVIEW(dev) (INTEL_INFO(dev)->is_valleyview) 1174#define IS_VALLEYVIEW(dev) (INTEL_INFO(dev)->is_valleyview)
1170#define IS_HASWELL(dev) (INTEL_INFO(dev)->is_haswell) 1175#define IS_HASWELL(dev) (INTEL_INFO(dev)->is_haswell)
1171#define IS_MOBILE(dev) (INTEL_INFO(dev)->is_mobile) 1176#define IS_MOBILE(dev) (INTEL_INFO(dev)->is_mobile)
@@ -1196,6 +1201,9 @@ struct drm_i915_file_private {
1196#define HAS_OVERLAY(dev) (INTEL_INFO(dev)->has_overlay) 1201#define HAS_OVERLAY(dev) (INTEL_INFO(dev)->has_overlay)
1197#define OVERLAY_NEEDS_PHYSICAL(dev) (INTEL_INFO(dev)->overlay_needs_physical) 1202#define OVERLAY_NEEDS_PHYSICAL(dev) (INTEL_INFO(dev)->overlay_needs_physical)
1198 1203
1204/* Early gen2 have a totally busted CS tlb and require pinned batches. */
1205#define HAS_BROKEN_CS_TLB(dev) (IS_I830(dev) || IS_845G(dev))
1206
1199/* With the 945 and later, Y tiling got adjusted so that it was 32 128-byte 1207/* With the 945 and later, Y tiling got adjusted so that it was 32 128-byte
1200 * rows, which changed the alignment requirements and fence programming. 1208 * rows, which changed the alignment requirements and fence programming.
1201 */ 1209 */
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 742206e45103..da3c82e301b1 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1517,9 +1517,11 @@ static int i915_gem_object_create_mmap_offset(struct drm_i915_gem_object *obj)
1517 if (obj->base.map_list.map) 1517 if (obj->base.map_list.map)
1518 return 0; 1518 return 0;
1519 1519
1520 dev_priv->mm.shrinker_no_lock_stealing = true;
1521
1520 ret = drm_gem_create_mmap_offset(&obj->base); 1522 ret = drm_gem_create_mmap_offset(&obj->base);
1521 if (ret != -ENOSPC) 1523 if (ret != -ENOSPC)
1522 return ret; 1524 goto out;
1523 1525
1524 /* Badly fragmented mmap space? The only way we can recover 1526 /* Badly fragmented mmap space? The only way we can recover
1525 * space is by destroying unwanted objects. We can't randomly release 1527 * space is by destroying unwanted objects. We can't randomly release
@@ -1531,10 +1533,14 @@ static int i915_gem_object_create_mmap_offset(struct drm_i915_gem_object *obj)
1531 i915_gem_purge(dev_priv, obj->base.size >> PAGE_SHIFT); 1533 i915_gem_purge(dev_priv, obj->base.size >> PAGE_SHIFT);
1532 ret = drm_gem_create_mmap_offset(&obj->base); 1534 ret = drm_gem_create_mmap_offset(&obj->base);
1533 if (ret != -ENOSPC) 1535 if (ret != -ENOSPC)
1534 return ret; 1536 goto out;
1535 1537
1536 i915_gem_shrink_all(dev_priv); 1538 i915_gem_shrink_all(dev_priv);
1537 return drm_gem_create_mmap_offset(&obj->base); 1539 ret = drm_gem_create_mmap_offset(&obj->base);
1540out:
1541 dev_priv->mm.shrinker_no_lock_stealing = false;
1542
1543 return ret;
1538} 1544}
1539 1545
1540static void i915_gem_object_free_mmap_offset(struct drm_i915_gem_object *obj) 1546static void i915_gem_object_free_mmap_offset(struct drm_i915_gem_object *obj)
@@ -2890,7 +2896,7 @@ i915_gem_object_bind_to_gtt(struct drm_i915_gem_object *obj,
2890{ 2896{
2891 struct drm_device *dev = obj->base.dev; 2897 struct drm_device *dev = obj->base.dev;
2892 drm_i915_private_t *dev_priv = dev->dev_private; 2898 drm_i915_private_t *dev_priv = dev->dev_private;
2893 struct drm_mm_node *free_space; 2899 struct drm_mm_node *node;
2894 u32 size, fence_size, fence_alignment, unfenced_alignment; 2900 u32 size, fence_size, fence_alignment, unfenced_alignment;
2895 bool mappable, fenceable; 2901 bool mappable, fenceable;
2896 int ret; 2902 int ret;
@@ -2936,66 +2942,54 @@ i915_gem_object_bind_to_gtt(struct drm_i915_gem_object *obj,
2936 2942
2937 i915_gem_object_pin_pages(obj); 2943 i915_gem_object_pin_pages(obj);
2938 2944
2945 node = kzalloc(sizeof(*node), GFP_KERNEL);
2946 if (node == NULL) {
2947 i915_gem_object_unpin_pages(obj);
2948 return -ENOMEM;
2949 }
2950
2939 search_free: 2951 search_free:
2940 if (map_and_fenceable) 2952 if (map_and_fenceable)
2941 free_space = drm_mm_search_free_in_range_color(&dev_priv->mm.gtt_space, 2953 ret = drm_mm_insert_node_in_range_generic(&dev_priv->mm.gtt_space, node,
2942 size, alignment, obj->cache_level, 2954 size, alignment, obj->cache_level,
2943 0, dev_priv->mm.gtt_mappable_end, 2955 0, dev_priv->mm.gtt_mappable_end);
2944 false);
2945 else 2956 else
2946 free_space = drm_mm_search_free_color(&dev_priv->mm.gtt_space, 2957 ret = drm_mm_insert_node_generic(&dev_priv->mm.gtt_space, node,
2947 size, alignment, obj->cache_level, 2958 size, alignment, obj->cache_level);
2948 false); 2959 if (ret) {
2949
2950 if (free_space != NULL) {
2951 if (map_and_fenceable)
2952 free_space =
2953 drm_mm_get_block_range_generic(free_space,
2954 size, alignment, obj->cache_level,
2955 0, dev_priv->mm.gtt_mappable_end,
2956 false);
2957 else
2958 free_space =
2959 drm_mm_get_block_generic(free_space,
2960 size, alignment, obj->cache_level,
2961 false);
2962 }
2963 if (free_space == NULL) {
2964 ret = i915_gem_evict_something(dev, size, alignment, 2960 ret = i915_gem_evict_something(dev, size, alignment,
2965 obj->cache_level, 2961 obj->cache_level,
2966 map_and_fenceable, 2962 map_and_fenceable,
2967 nonblocking); 2963 nonblocking);
2968 if (ret) { 2964 if (ret == 0)
2969 i915_gem_object_unpin_pages(obj); 2965 goto search_free;
2970 return ret;
2971 }
2972 2966
2973 goto search_free; 2967 i915_gem_object_unpin_pages(obj);
2968 kfree(node);
2969 return ret;
2974 } 2970 }
2975 if (WARN_ON(!i915_gem_valid_gtt_space(dev, 2971 if (WARN_ON(!i915_gem_valid_gtt_space(dev, node, obj->cache_level))) {
2976 free_space,
2977 obj->cache_level))) {
2978 i915_gem_object_unpin_pages(obj); 2972 i915_gem_object_unpin_pages(obj);
2979 drm_mm_put_block(free_space); 2973 drm_mm_put_block(node);
2980 return -EINVAL; 2974 return -EINVAL;
2981 } 2975 }
2982 2976
2983 ret = i915_gem_gtt_prepare_object(obj); 2977 ret = i915_gem_gtt_prepare_object(obj);
2984 if (ret) { 2978 if (ret) {
2985 i915_gem_object_unpin_pages(obj); 2979 i915_gem_object_unpin_pages(obj);
2986 drm_mm_put_block(free_space); 2980 drm_mm_put_block(node);
2987 return ret; 2981 return ret;
2988 } 2982 }
2989 2983
2990 list_move_tail(&obj->gtt_list, &dev_priv->mm.bound_list); 2984 list_move_tail(&obj->gtt_list, &dev_priv->mm.bound_list);
2991 list_add_tail(&obj->mm_list, &dev_priv->mm.inactive_list); 2985 list_add_tail(&obj->mm_list, &dev_priv->mm.inactive_list);
2992 2986
2993 obj->gtt_space = free_space; 2987 obj->gtt_space = node;
2994 obj->gtt_offset = free_space->start; 2988 obj->gtt_offset = node->start;
2995 2989
2996 fenceable = 2990 fenceable =
2997 free_space->size == fence_size && 2991 node->size == fence_size &&
2998 (free_space->start & (fence_alignment - 1)) == 0; 2992 (node->start & (fence_alignment - 1)) == 0;
2999 2993
3000 mappable = 2994 mappable =
3001 obj->gtt_offset + obj->base.size <= dev_priv->mm.gtt_mappable_end; 2995 obj->gtt_offset + obj->base.size <= dev_priv->mm.gtt_mappable_end;
@@ -4392,6 +4386,9 @@ i915_gem_inactive_shrink(struct shrinker *shrinker, struct shrink_control *sc)
4392 if (!mutex_is_locked_by(&dev->struct_mutex, current)) 4386 if (!mutex_is_locked_by(&dev->struct_mutex, current))
4393 return 0; 4387 return 0;
4394 4388
4389 if (dev_priv->mm.shrinker_no_lock_stealing)
4390 return 0;
4391
4395 unlock = false; 4392 unlock = false;
4396 } 4393 }
4397 4394
diff --git a/drivers/gpu/drm/i915/i915_gem_dmabuf.c b/drivers/gpu/drm/i915/i915_gem_dmabuf.c
index 773ef77b6c22..7be4241e8242 100644
--- a/drivers/gpu/drm/i915/i915_gem_dmabuf.c
+++ b/drivers/gpu/drm/i915/i915_gem_dmabuf.c
@@ -226,7 +226,7 @@ struct dma_buf *i915_gem_prime_export(struct drm_device *dev,
226{ 226{
227 struct drm_i915_gem_object *obj = to_intel_bo(gem_obj); 227 struct drm_i915_gem_object *obj = to_intel_bo(gem_obj);
228 228
229 return dma_buf_export(obj, &i915_dmabuf_ops, obj->base.size, 0600); 229 return dma_buf_export(obj, &i915_dmabuf_ops, obj->base.size, flags);
230} 230}
231 231
232static int i915_gem_object_get_pages_dmabuf(struct drm_i915_gem_object *obj) 232static int i915_gem_object_get_pages_dmabuf(struct drm_i915_gem_object *obj)
diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
index ee8f97f0539e..d6a994a07393 100644
--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
@@ -808,6 +808,8 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
808 808
809 flags |= I915_DISPATCH_SECURE; 809 flags |= I915_DISPATCH_SECURE;
810 } 810 }
811 if (args->flags & I915_EXEC_IS_PINNED)
812 flags |= I915_DISPATCH_PINNED;
811 813
812 switch (args->flags & I915_EXEC_RING_MASK) { 814 switch (args->flags & I915_EXEC_RING_MASK) {
813 case I915_EXEC_DEFAULT: 815 case I915_EXEC_DEFAULT:
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index a4dc97f8b9f0..2220dec3e5d9 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -1087,6 +1087,18 @@ i915_error_first_batchbuffer(struct drm_i915_private *dev_priv,
1087 if (!ring->get_seqno) 1087 if (!ring->get_seqno)
1088 return NULL; 1088 return NULL;
1089 1089
1090 if (HAS_BROKEN_CS_TLB(dev_priv->dev)) {
1091 u32 acthd = I915_READ(ACTHD);
1092
1093 if (WARN_ON(ring->id != RCS))
1094 return NULL;
1095
1096 obj = ring->private;
1097 if (acthd >= obj->gtt_offset &&
1098 acthd < obj->gtt_offset + obj->base.size)
1099 return i915_error_object_create(dev_priv, obj);
1100 }
1101
1090 seqno = ring->get_seqno(ring, false); 1102 seqno = ring->get_seqno(ring, false);
1091 list_for_each_entry(obj, &dev_priv->mm.active_list, mm_list) { 1103 list_for_each_entry(obj, &dev_priv->mm.active_list, mm_list) {
1092 if (obj->ring != ring) 1104 if (obj->ring != ring)
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 3f75cfaf1c3f..186ee5c85b51 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -517,6 +517,7 @@
517 * the enables for writing to the corresponding low bit. 517 * the enables for writing to the corresponding low bit.
518 */ 518 */
519#define _3D_CHICKEN 0x02084 519#define _3D_CHICKEN 0x02084
520#define _3D_CHICKEN_HIZ_PLANE_DISABLE_MSAA_4X_SNB (1 << 10)
520#define _3D_CHICKEN2 0x0208c 521#define _3D_CHICKEN2 0x0208c
521/* Disables pipelining of read flushes past the SF-WIZ interface. 522/* Disables pipelining of read flushes past the SF-WIZ interface.
522 * Required on all Ironlake steppings according to the B-Spec, but the 523 * Required on all Ironlake steppings according to the B-Spec, but the
@@ -532,7 +533,8 @@
532# define MI_FLUSH_ENABLE (1 << 12) 533# define MI_FLUSH_ENABLE (1 << 12)
533 534
534#define GEN6_GT_MODE 0x20d0 535#define GEN6_GT_MODE 0x20d0
535#define GEN6_GT_MODE_HI (1 << 9) 536#define GEN6_GT_MODE_HI (1 << 9)
537#define GEN6_TD_FOUR_ROW_DISPATCH_DISABLE (1 << 5)
536 538
537#define GFX_MODE 0x02520 539#define GFX_MODE 0x02520
538#define GFX_MODE_GEN7 0x0229c 540#define GFX_MODE_GEN7 0x0229c
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 5d127e068950..a9fb046b94a1 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -8144,10 +8144,6 @@ intel_modeset_stage_output_state(struct drm_device *dev,
8144 DRM_DEBUG_KMS("encoder changed, full mode switch\n"); 8144 DRM_DEBUG_KMS("encoder changed, full mode switch\n");
8145 config->mode_changed = true; 8145 config->mode_changed = true;
8146 } 8146 }
8147
8148 /* Disable all disconnected encoders. */
8149 if (connector->base.status == connector_status_disconnected)
8150 connector->new_encoder = NULL;
8151 } 8147 }
8152 /* connector->new_encoder is now updated for all connectors. */ 8148 /* connector->new_encoder is now updated for all connectors. */
8153 8149
@@ -9167,6 +9163,23 @@ static void intel_sanitize_encoder(struct intel_encoder *encoder)
9167 * the crtc fixup. */ 9163 * the crtc fixup. */
9168} 9164}
9169 9165
9166static void i915_redisable_vga(struct drm_device *dev)
9167{
9168 struct drm_i915_private *dev_priv = dev->dev_private;
9169 u32 vga_reg;
9170
9171 if (HAS_PCH_SPLIT(dev))
9172 vga_reg = CPU_VGACNTRL;
9173 else
9174 vga_reg = VGACNTRL;
9175
9176 if (I915_READ(vga_reg) != VGA_DISP_DISABLE) {
9177 DRM_DEBUG_KMS("Something enabled VGA plane, disabling it\n");
9178 I915_WRITE(vga_reg, VGA_DISP_DISABLE);
9179 POSTING_READ(vga_reg);
9180 }
9181}
9182
9170/* Scan out the current hw modeset state, sanitizes it and maps it into the drm 9183/* Scan out the current hw modeset state, sanitizes it and maps it into the drm
9171 * and i915 state tracking structures. */ 9184 * and i915 state tracking structures. */
9172void intel_modeset_setup_hw_state(struct drm_device *dev, 9185void intel_modeset_setup_hw_state(struct drm_device *dev,
@@ -9275,6 +9288,8 @@ void intel_modeset_setup_hw_state(struct drm_device *dev,
9275 intel_set_mode(&crtc->base, &crtc->base.mode, 9288 intel_set_mode(&crtc->base, &crtc->base.mode,
9276 crtc->base.x, crtc->base.y, crtc->base.fb); 9289 crtc->base.x, crtc->base.y, crtc->base.fb);
9277 } 9290 }
9291
9292 i915_redisable_vga(dev);
9278 } else { 9293 } else {
9279 intel_modeset_update_staged_output_state(dev); 9294 intel_modeset_update_staged_output_state(dev);
9280 } 9295 }
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 496caa73eb70..e6f54ffab3ba 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -405,7 +405,7 @@ void intel_update_fbc(struct drm_device *dev)
405 * - going to an unsupported config (interlace, pixel multiply, etc.) 405 * - going to an unsupported config (interlace, pixel multiply, etc.)
406 */ 406 */
407 list_for_each_entry(tmp_crtc, &dev->mode_config.crtc_list, head) { 407 list_for_each_entry(tmp_crtc, &dev->mode_config.crtc_list, head) {
408 if (tmp_crtc->enabled && 408 if (to_intel_crtc(tmp_crtc)->active &&
409 !to_intel_crtc(tmp_crtc)->primary_disabled && 409 !to_intel_crtc(tmp_crtc)->primary_disabled &&
410 tmp_crtc->fb) { 410 tmp_crtc->fb) {
411 if (crtc) { 411 if (crtc) {
@@ -992,7 +992,7 @@ static struct drm_crtc *single_enabled_crtc(struct drm_device *dev)
992 struct drm_crtc *crtc, *enabled = NULL; 992 struct drm_crtc *crtc, *enabled = NULL;
993 993
994 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { 994 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
995 if (crtc->enabled && crtc->fb) { 995 if (to_intel_crtc(crtc)->active && crtc->fb) {
996 if (enabled) 996 if (enabled)
997 return NULL; 997 return NULL;
998 enabled = crtc; 998 enabled = crtc;
@@ -1086,7 +1086,7 @@ static bool g4x_compute_wm0(struct drm_device *dev,
1086 int entries, tlb_miss; 1086 int entries, tlb_miss;
1087 1087
1088 crtc = intel_get_crtc_for_plane(dev, plane); 1088 crtc = intel_get_crtc_for_plane(dev, plane);
1089 if (crtc->fb == NULL || !crtc->enabled) { 1089 if (crtc->fb == NULL || !to_intel_crtc(crtc)->active) {
1090 *cursor_wm = cursor->guard_size; 1090 *cursor_wm = cursor->guard_size;
1091 *plane_wm = display->guard_size; 1091 *plane_wm = display->guard_size;
1092 return false; 1092 return false;
@@ -1215,7 +1215,7 @@ static bool vlv_compute_drain_latency(struct drm_device *dev,
1215 int entries; 1215 int entries;
1216 1216
1217 crtc = intel_get_crtc_for_plane(dev, plane); 1217 crtc = intel_get_crtc_for_plane(dev, plane);
1218 if (crtc->fb == NULL || !crtc->enabled) 1218 if (crtc->fb == NULL || !to_intel_crtc(crtc)->active)
1219 return false; 1219 return false;
1220 1220
1221 clock = crtc->mode.clock; /* VESA DOT Clock */ 1221 clock = crtc->mode.clock; /* VESA DOT Clock */
@@ -1286,6 +1286,7 @@ static void valleyview_update_wm(struct drm_device *dev)
1286 struct drm_i915_private *dev_priv = dev->dev_private; 1286 struct drm_i915_private *dev_priv = dev->dev_private;
1287 int planea_wm, planeb_wm, cursora_wm, cursorb_wm; 1287 int planea_wm, planeb_wm, cursora_wm, cursorb_wm;
1288 int plane_sr, cursor_sr; 1288 int plane_sr, cursor_sr;
1289 int ignore_plane_sr, ignore_cursor_sr;
1289 unsigned int enabled = 0; 1290 unsigned int enabled = 0;
1290 1291
1291 vlv_update_drain_latency(dev); 1292 vlv_update_drain_latency(dev);
@@ -1302,17 +1303,23 @@ static void valleyview_update_wm(struct drm_device *dev)
1302 &planeb_wm, &cursorb_wm)) 1303 &planeb_wm, &cursorb_wm))
1303 enabled |= 2; 1304 enabled |= 2;
1304 1305
1305 plane_sr = cursor_sr = 0;
1306 if (single_plane_enabled(enabled) && 1306 if (single_plane_enabled(enabled) &&
1307 g4x_compute_srwm(dev, ffs(enabled) - 1, 1307 g4x_compute_srwm(dev, ffs(enabled) - 1,
1308 sr_latency_ns, 1308 sr_latency_ns,
1309 &valleyview_wm_info, 1309 &valleyview_wm_info,
1310 &valleyview_cursor_wm_info, 1310 &valleyview_cursor_wm_info,
1311 &plane_sr, &cursor_sr)) 1311 &plane_sr, &ignore_cursor_sr) &&
1312 g4x_compute_srwm(dev, ffs(enabled) - 1,
1313 2*sr_latency_ns,
1314 &valleyview_wm_info,
1315 &valleyview_cursor_wm_info,
1316 &ignore_plane_sr, &cursor_sr)) {
1312 I915_WRITE(FW_BLC_SELF_VLV, FW_CSPWRDWNEN); 1317 I915_WRITE(FW_BLC_SELF_VLV, FW_CSPWRDWNEN);
1313 else 1318 } else {
1314 I915_WRITE(FW_BLC_SELF_VLV, 1319 I915_WRITE(FW_BLC_SELF_VLV,
1315 I915_READ(FW_BLC_SELF_VLV) & ~FW_CSPWRDWNEN); 1320 I915_READ(FW_BLC_SELF_VLV) & ~FW_CSPWRDWNEN);
1321 plane_sr = cursor_sr = 0;
1322 }
1316 1323
1317 DRM_DEBUG_KMS("Setting FIFO watermarks - A: plane=%d, cursor=%d, B: plane=%d, cursor=%d, SR: plane=%d, cursor=%d\n", 1324 DRM_DEBUG_KMS("Setting FIFO watermarks - A: plane=%d, cursor=%d, B: plane=%d, cursor=%d, SR: plane=%d, cursor=%d\n",
1318 planea_wm, cursora_wm, 1325 planea_wm, cursora_wm,
@@ -1352,17 +1359,18 @@ static void g4x_update_wm(struct drm_device *dev)
1352 &planeb_wm, &cursorb_wm)) 1359 &planeb_wm, &cursorb_wm))
1353 enabled |= 2; 1360 enabled |= 2;
1354 1361
1355 plane_sr = cursor_sr = 0;
1356 if (single_plane_enabled(enabled) && 1362 if (single_plane_enabled(enabled) &&
1357 g4x_compute_srwm(dev, ffs(enabled) - 1, 1363 g4x_compute_srwm(dev, ffs(enabled) - 1,
1358 sr_latency_ns, 1364 sr_latency_ns,
1359 &g4x_wm_info, 1365 &g4x_wm_info,
1360 &g4x_cursor_wm_info, 1366 &g4x_cursor_wm_info,
1361 &plane_sr, &cursor_sr)) 1367 &plane_sr, &cursor_sr)) {
1362 I915_WRITE(FW_BLC_SELF, FW_BLC_SELF_EN); 1368 I915_WRITE(FW_BLC_SELF, FW_BLC_SELF_EN);
1363 else 1369 } else {
1364 I915_WRITE(FW_BLC_SELF, 1370 I915_WRITE(FW_BLC_SELF,
1365 I915_READ(FW_BLC_SELF) & ~FW_BLC_SELF_EN); 1371 I915_READ(FW_BLC_SELF) & ~FW_BLC_SELF_EN);
1372 plane_sr = cursor_sr = 0;
1373 }
1366 1374
1367 DRM_DEBUG_KMS("Setting FIFO watermarks - A: plane=%d, cursor=%d, B: plane=%d, cursor=%d, SR: plane=%d, cursor=%d\n", 1375 DRM_DEBUG_KMS("Setting FIFO watermarks - A: plane=%d, cursor=%d, B: plane=%d, cursor=%d, SR: plane=%d, cursor=%d\n",
1368 planea_wm, cursora_wm, 1376 planea_wm, cursora_wm,
@@ -1468,7 +1476,7 @@ static void i9xx_update_wm(struct drm_device *dev)
1468 1476
1469 fifo_size = dev_priv->display.get_fifo_size(dev, 0); 1477 fifo_size = dev_priv->display.get_fifo_size(dev, 0);
1470 crtc = intel_get_crtc_for_plane(dev, 0); 1478 crtc = intel_get_crtc_for_plane(dev, 0);
1471 if (crtc->enabled && crtc->fb) { 1479 if (to_intel_crtc(crtc)->active && crtc->fb) {
1472 int cpp = crtc->fb->bits_per_pixel / 8; 1480 int cpp = crtc->fb->bits_per_pixel / 8;
1473 if (IS_GEN2(dev)) 1481 if (IS_GEN2(dev))
1474 cpp = 4; 1482 cpp = 4;
@@ -1482,7 +1490,7 @@ static void i9xx_update_wm(struct drm_device *dev)
1482 1490
1483 fifo_size = dev_priv->display.get_fifo_size(dev, 1); 1491 fifo_size = dev_priv->display.get_fifo_size(dev, 1);
1484 crtc = intel_get_crtc_for_plane(dev, 1); 1492 crtc = intel_get_crtc_for_plane(dev, 1);
1485 if (crtc->enabled && crtc->fb) { 1493 if (to_intel_crtc(crtc)->active && crtc->fb) {
1486 int cpp = crtc->fb->bits_per_pixel / 8; 1494 int cpp = crtc->fb->bits_per_pixel / 8;
1487 if (IS_GEN2(dev)) 1495 if (IS_GEN2(dev))
1488 cpp = 4; 1496 cpp = 4;
@@ -1811,8 +1819,110 @@ static void sandybridge_update_wm(struct drm_device *dev)
1811 enabled |= 2; 1819 enabled |= 2;
1812 } 1820 }
1813 1821
1814 if ((dev_priv->num_pipe == 3) && 1822 /*
1815 g4x_compute_wm0(dev, 2, 1823 * Calculate and update the self-refresh watermark only when one
1824 * display plane is used.
1825 *
1826 * SNB support 3 levels of watermark.
1827 *
1828 * WM1/WM2/WM2 watermarks have to be enabled in the ascending order,
1829 * and disabled in the descending order
1830 *
1831 */
1832 I915_WRITE(WM3_LP_ILK, 0);
1833 I915_WRITE(WM2_LP_ILK, 0);
1834 I915_WRITE(WM1_LP_ILK, 0);
1835
1836 if (!single_plane_enabled(enabled) ||
1837 dev_priv->sprite_scaling_enabled)
1838 return;
1839 enabled = ffs(enabled) - 1;
1840
1841 /* WM1 */
1842 if (!ironlake_compute_srwm(dev, 1, enabled,
1843 SNB_READ_WM1_LATENCY() * 500,
1844 &sandybridge_display_srwm_info,
1845 &sandybridge_cursor_srwm_info,
1846 &fbc_wm, &plane_wm, &cursor_wm))
1847 return;
1848
1849 I915_WRITE(WM1_LP_ILK,
1850 WM1_LP_SR_EN |
1851 (SNB_READ_WM1_LATENCY() << WM1_LP_LATENCY_SHIFT) |
1852 (fbc_wm << WM1_LP_FBC_SHIFT) |
1853 (plane_wm << WM1_LP_SR_SHIFT) |
1854 cursor_wm);
1855
1856 /* WM2 */
1857 if (!ironlake_compute_srwm(dev, 2, enabled,
1858 SNB_READ_WM2_LATENCY() * 500,
1859 &sandybridge_display_srwm_info,
1860 &sandybridge_cursor_srwm_info,
1861 &fbc_wm, &plane_wm, &cursor_wm))
1862 return;
1863
1864 I915_WRITE(WM2_LP_ILK,
1865 WM2_LP_EN |
1866 (SNB_READ_WM2_LATENCY() << WM1_LP_LATENCY_SHIFT) |
1867 (fbc_wm << WM1_LP_FBC_SHIFT) |
1868 (plane_wm << WM1_LP_SR_SHIFT) |
1869 cursor_wm);
1870
1871 /* WM3 */
1872 if (!ironlake_compute_srwm(dev, 3, enabled,
1873 SNB_READ_WM3_LATENCY() * 500,
1874 &sandybridge_display_srwm_info,
1875 &sandybridge_cursor_srwm_info,
1876 &fbc_wm, &plane_wm, &cursor_wm))
1877 return;
1878
1879 I915_WRITE(WM3_LP_ILK,
1880 WM3_LP_EN |
1881 (SNB_READ_WM3_LATENCY() << WM1_LP_LATENCY_SHIFT) |
1882 (fbc_wm << WM1_LP_FBC_SHIFT) |
1883 (plane_wm << WM1_LP_SR_SHIFT) |
1884 cursor_wm);
1885}
1886
1887static void ivybridge_update_wm(struct drm_device *dev)
1888{
1889 struct drm_i915_private *dev_priv = dev->dev_private;
1890 int latency = SNB_READ_WM0_LATENCY() * 100; /* In unit 0.1us */
1891 u32 val;
1892 int fbc_wm, plane_wm, cursor_wm;
1893 int ignore_fbc_wm, ignore_plane_wm, ignore_cursor_wm;
1894 unsigned int enabled;
1895
1896 enabled = 0;
1897 if (g4x_compute_wm0(dev, 0,
1898 &sandybridge_display_wm_info, latency,
1899 &sandybridge_cursor_wm_info, latency,
1900 &plane_wm, &cursor_wm)) {
1901 val = I915_READ(WM0_PIPEA_ILK);
1902 val &= ~(WM0_PIPE_PLANE_MASK | WM0_PIPE_CURSOR_MASK);
1903 I915_WRITE(WM0_PIPEA_ILK, val |
1904 ((plane_wm << WM0_PIPE_PLANE_SHIFT) | cursor_wm));
1905 DRM_DEBUG_KMS("FIFO watermarks For pipe A -"
1906 " plane %d, " "cursor: %d\n",
1907 plane_wm, cursor_wm);
1908 enabled |= 1;
1909 }
1910
1911 if (g4x_compute_wm0(dev, 1,
1912 &sandybridge_display_wm_info, latency,
1913 &sandybridge_cursor_wm_info, latency,
1914 &plane_wm, &cursor_wm)) {
1915 val = I915_READ(WM0_PIPEB_ILK);
1916 val &= ~(WM0_PIPE_PLANE_MASK | WM0_PIPE_CURSOR_MASK);
1917 I915_WRITE(WM0_PIPEB_ILK, val |
1918 ((plane_wm << WM0_PIPE_PLANE_SHIFT) | cursor_wm));
1919 DRM_DEBUG_KMS("FIFO watermarks For pipe B -"
1920 " plane %d, cursor: %d\n",
1921 plane_wm, cursor_wm);
1922 enabled |= 2;
1923 }
1924
1925 if (g4x_compute_wm0(dev, 2,
1816 &sandybridge_display_wm_info, latency, 1926 &sandybridge_display_wm_info, latency,
1817 &sandybridge_cursor_wm_info, latency, 1927 &sandybridge_cursor_wm_info, latency,
1818 &plane_wm, &cursor_wm)) { 1928 &plane_wm, &cursor_wm)) {
@@ -1875,12 +1985,17 @@ static void sandybridge_update_wm(struct drm_device *dev)
1875 (plane_wm << WM1_LP_SR_SHIFT) | 1985 (plane_wm << WM1_LP_SR_SHIFT) |
1876 cursor_wm); 1986 cursor_wm);
1877 1987
1878 /* WM3 */ 1988 /* WM3, note we have to correct the cursor latency */
1879 if (!ironlake_compute_srwm(dev, 3, enabled, 1989 if (!ironlake_compute_srwm(dev, 3, enabled,
1880 SNB_READ_WM3_LATENCY() * 500, 1990 SNB_READ_WM3_LATENCY() * 500,
1881 &sandybridge_display_srwm_info, 1991 &sandybridge_display_srwm_info,
1882 &sandybridge_cursor_srwm_info, 1992 &sandybridge_cursor_srwm_info,
1883 &fbc_wm, &plane_wm, &cursor_wm)) 1993 &fbc_wm, &plane_wm, &ignore_cursor_wm) ||
1994 !ironlake_compute_srwm(dev, 3, enabled,
1995 2 * SNB_READ_WM3_LATENCY() * 500,
1996 &sandybridge_display_srwm_info,
1997 &sandybridge_cursor_srwm_info,
1998 &ignore_fbc_wm, &ignore_plane_wm, &cursor_wm))
1884 return; 1999 return;
1885 2000
1886 I915_WRITE(WM3_LP_ILK, 2001 I915_WRITE(WM3_LP_ILK,
@@ -1929,7 +2044,7 @@ sandybridge_compute_sprite_wm(struct drm_device *dev, int plane,
1929 int entries, tlb_miss; 2044 int entries, tlb_miss;
1930 2045
1931 crtc = intel_get_crtc_for_plane(dev, plane); 2046 crtc = intel_get_crtc_for_plane(dev, plane);
1932 if (crtc->fb == NULL || !crtc->enabled) { 2047 if (crtc->fb == NULL || !to_intel_crtc(crtc)->active) {
1933 *sprite_wm = display->guard_size; 2048 *sprite_wm = display->guard_size;
1934 return false; 2049 return false;
1935 } 2050 }
@@ -3471,6 +3586,15 @@ static void gen6_init_clock_gating(struct drm_device *dev)
3471 I915_READ(ILK_DISPLAY_CHICKEN2) | 3586 I915_READ(ILK_DISPLAY_CHICKEN2) |
3472 ILK_ELPIN_409_SELECT); 3587 ILK_ELPIN_409_SELECT);
3473 3588
3589 /* WaDisableHiZPlanesWhenMSAAEnabled */
3590 I915_WRITE(_3D_CHICKEN,
3591 _MASKED_BIT_ENABLE(_3D_CHICKEN_HIZ_PLANE_DISABLE_MSAA_4X_SNB));
3592
3593 /* WaSetupGtModeTdRowDispatch */
3594 if (IS_SNB_GT1(dev))
3595 I915_WRITE(GEN6_GT_MODE,
3596 _MASKED_BIT_ENABLE(GEN6_TD_FOUR_ROW_DISPATCH_DISABLE));
3597
3474 I915_WRITE(WM3_LP_ILK, 0); 3598 I915_WRITE(WM3_LP_ILK, 0);
3475 I915_WRITE(WM2_LP_ILK, 0); 3599 I915_WRITE(WM2_LP_ILK, 0);
3476 I915_WRITE(WM1_LP_ILK, 0); 3600 I915_WRITE(WM1_LP_ILK, 0);
@@ -3999,7 +4123,7 @@ void intel_init_pm(struct drm_device *dev)
3999 } else if (IS_IVYBRIDGE(dev)) { 4123 } else if (IS_IVYBRIDGE(dev)) {
4000 /* FIXME: detect B0+ stepping and use auto training */ 4124 /* FIXME: detect B0+ stepping and use auto training */
4001 if (SNB_READ_WM0_LATENCY()) { 4125 if (SNB_READ_WM0_LATENCY()) {
4002 dev_priv->display.update_wm = sandybridge_update_wm; 4126 dev_priv->display.update_wm = ivybridge_update_wm;
4003 dev_priv->display.update_sprite_wm = sandybridge_update_sprite_wm; 4127 dev_priv->display.update_sprite_wm = sandybridge_update_sprite_wm;
4004 } else { 4128 } else {
4005 DRM_DEBUG_KMS("Failed to read display plane latency. " 4129 DRM_DEBUG_KMS("Failed to read display plane latency. "
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
index 2346b920bd86..ae253e04c391 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -547,9 +547,14 @@ static int init_render_ring(struct intel_ring_buffer *ring)
547 547
548static void render_ring_cleanup(struct intel_ring_buffer *ring) 548static void render_ring_cleanup(struct intel_ring_buffer *ring)
549{ 549{
550 struct drm_device *dev = ring->dev;
551
550 if (!ring->private) 552 if (!ring->private)
551 return; 553 return;
552 554
555 if (HAS_BROKEN_CS_TLB(dev))
556 drm_gem_object_unreference(to_gem_object(ring->private));
557
553 cleanup_pipe_control(ring); 558 cleanup_pipe_control(ring);
554} 559}
555 560
@@ -969,6 +974,8 @@ i965_dispatch_execbuffer(struct intel_ring_buffer *ring,
969 return 0; 974 return 0;
970} 975}
971 976
977/* Just userspace ABI convention to limit the wa batch bo to a resonable size */
978#define I830_BATCH_LIMIT (256*1024)
972static int 979static int
973i830_dispatch_execbuffer(struct intel_ring_buffer *ring, 980i830_dispatch_execbuffer(struct intel_ring_buffer *ring,
974 u32 offset, u32 len, 981 u32 offset, u32 len,
@@ -976,15 +983,47 @@ i830_dispatch_execbuffer(struct intel_ring_buffer *ring,
976{ 983{
977 int ret; 984 int ret;
978 985
979 ret = intel_ring_begin(ring, 4); 986 if (flags & I915_DISPATCH_PINNED) {
980 if (ret) 987 ret = intel_ring_begin(ring, 4);
981 return ret; 988 if (ret)
989 return ret;
982 990
983 intel_ring_emit(ring, MI_BATCH_BUFFER); 991 intel_ring_emit(ring, MI_BATCH_BUFFER);
984 intel_ring_emit(ring, offset | (flags & I915_DISPATCH_SECURE ? 0 : MI_BATCH_NON_SECURE)); 992 intel_ring_emit(ring, offset | (flags & I915_DISPATCH_SECURE ? 0 : MI_BATCH_NON_SECURE));
985 intel_ring_emit(ring, offset + len - 8); 993 intel_ring_emit(ring, offset + len - 8);
986 intel_ring_emit(ring, 0); 994 intel_ring_emit(ring, MI_NOOP);
987 intel_ring_advance(ring); 995 intel_ring_advance(ring);
996 } else {
997 struct drm_i915_gem_object *obj = ring->private;
998 u32 cs_offset = obj->gtt_offset;
999
1000 if (len > I830_BATCH_LIMIT)
1001 return -ENOSPC;
1002
1003 ret = intel_ring_begin(ring, 9+3);
1004 if (ret)
1005 return ret;
1006 /* Blit the batch (which has now all relocs applied) to the stable batch
1007 * scratch bo area (so that the CS never stumbles over its tlb
1008 * invalidation bug) ... */
1009 intel_ring_emit(ring, XY_SRC_COPY_BLT_CMD |
1010 XY_SRC_COPY_BLT_WRITE_ALPHA |
1011 XY_SRC_COPY_BLT_WRITE_RGB);
1012 intel_ring_emit(ring, BLT_DEPTH_32 | BLT_ROP_GXCOPY | 4096);
1013 intel_ring_emit(ring, 0);
1014 intel_ring_emit(ring, (DIV_ROUND_UP(len, 4096) << 16) | 1024);
1015 intel_ring_emit(ring, cs_offset);
1016 intel_ring_emit(ring, 0);
1017 intel_ring_emit(ring, 4096);
1018 intel_ring_emit(ring, offset);
1019 intel_ring_emit(ring, MI_FLUSH);
1020
1021 /* ... and execute it. */
1022 intel_ring_emit(ring, MI_BATCH_BUFFER);
1023 intel_ring_emit(ring, cs_offset | (flags & I915_DISPATCH_SECURE ? 0 : MI_BATCH_NON_SECURE));
1024 intel_ring_emit(ring, cs_offset + len - 8);
1025 intel_ring_advance(ring);
1026 }
988 1027
989 return 0; 1028 return 0;
990} 1029}
@@ -1596,6 +1635,27 @@ int intel_init_render_ring_buffer(struct drm_device *dev)
1596 ring->init = init_render_ring; 1635 ring->init = init_render_ring;
1597 ring->cleanup = render_ring_cleanup; 1636 ring->cleanup = render_ring_cleanup;
1598 1637
1638 /* Workaround batchbuffer to combat CS tlb bug. */
1639 if (HAS_BROKEN_CS_TLB(dev)) {
1640 struct drm_i915_gem_object *obj;
1641 int ret;
1642
1643 obj = i915_gem_alloc_object(dev, I830_BATCH_LIMIT);
1644 if (obj == NULL) {
1645 DRM_ERROR("Failed to allocate batch bo\n");
1646 return -ENOMEM;
1647 }
1648
1649 ret = i915_gem_object_pin(obj, 0, true, false);
1650 if (ret != 0) {
1651 drm_gem_object_unreference(&obj->base);
1652 DRM_ERROR("Failed to ping batch bo\n");
1653 return ret;
1654 }
1655
1656 ring->private = obj;
1657 }
1658
1599 return intel_init_ring_buffer(dev, ring); 1659 return intel_init_ring_buffer(dev, ring);
1600} 1660}
1601 1661
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h
index 526182ed0c6d..6af87cd05725 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.h
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.h
@@ -94,6 +94,7 @@ struct intel_ring_buffer {
94 u32 offset, u32 length, 94 u32 offset, u32 length,
95 unsigned flags); 95 unsigned flags);
96#define I915_DISPATCH_SECURE 0x1 96#define I915_DISPATCH_SECURE 0x1
97#define I915_DISPATCH_PINNED 0x2
97 void (*cleanup)(struct intel_ring_buffer *ring); 98 void (*cleanup)(struct intel_ring_buffer *ring);
98 int (*sync_to)(struct intel_ring_buffer *ring, 99 int (*sync_to)(struct intel_ring_buffer *ring,
99 struct intel_ring_buffer *to, 100 struct intel_ring_buffer *to,
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnve0.fuc b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnve0.fuc
index 7b715fda2763..62ab231cd6b6 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnve0.fuc
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnve0.fuc
@@ -57,6 +57,11 @@ chipsets:
57.b16 #nve4_gpc_mmio_tail 57.b16 #nve4_gpc_mmio_tail
58.b16 #nve4_tpc_mmio_head 58.b16 #nve4_tpc_mmio_head
59.b16 #nve4_tpc_mmio_tail 59.b16 #nve4_tpc_mmio_tail
60.b8 0xe6 0 0 0
61.b16 #nve4_gpc_mmio_head
62.b16 #nve4_gpc_mmio_tail
63.b16 #nve4_tpc_mmio_head
64.b16 #nve4_tpc_mmio_tail
60.b8 0 0 0 0 65.b8 0 0 0 0
61 66
62// GPC mmio lists 67// GPC mmio lists
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnve0.fuc.h b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnve0.fuc.h
index 26c2165bad0f..09ee4702c8b2 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnve0.fuc.h
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnve0.fuc.h
@@ -34,13 +34,16 @@ uint32_t nve0_grgpc_data[] = {
34 0x00000000, 34 0x00000000,
35/* 0x0064: chipsets */ 35/* 0x0064: chipsets */
36 0x000000e4, 36 0x000000e4,
37 0x01040080, 37 0x0110008c,
38 0x014c0104, 38 0x01580110,
39 0x000000e7, 39 0x000000e7,
40 0x01040080, 40 0x0110008c,
41 0x014c0104, 41 0x01580110,
42 0x000000e6,
43 0x0110008c,
44 0x01580110,
42 0x00000000, 45 0x00000000,
43/* 0x0080: nve4_gpc_mmio_head */ 46/* 0x008c: nve4_gpc_mmio_head */
44 0x00000380, 47 0x00000380,
45 0x04000400, 48 0x04000400,
46 0x0800040c, 49 0x0800040c,
@@ -74,8 +77,8 @@ uint32_t nve0_grgpc_data[] = {
74 0x14003100, 77 0x14003100,
75 0x000031d0, 78 0x000031d0,
76 0x040031e0, 79 0x040031e0,
77/* 0x0104: nve4_gpc_mmio_tail */ 80/* 0x0110: nve4_gpc_mmio_tail */
78/* 0x0104: nve4_tpc_mmio_head */ 81/* 0x0110: nve4_tpc_mmio_head */
79 0x00000048, 82 0x00000048,
80 0x00000064, 83 0x00000064,
81 0x00000088, 84 0x00000088,
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvc0.fuc b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvc0.fuc
index acfc457654bd..0bcfa4d447e5 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvc0.fuc
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvc0.fuc
@@ -754,6 +754,16 @@ ctx_mmio_exec:
754// on load it means: "a save preceeded this load" 754// on load it means: "a save preceeded this load"
755// 755//
756ctx_xfer: 756ctx_xfer:
757 // according to mwk, some kind of wait for idle
758 mov $r15 0xc00
759 shl b32 $r15 6
760 mov $r14 4
761 iowr I[$r15 + 0x200] $r14
762 ctx_xfer_idle:
763 iord $r14 I[$r15 + 0x000]
764 and $r14 0x2000
765 bra ne #ctx_xfer_idle
766
757 bra not $p1 #ctx_xfer_pre 767 bra not $p1 #ctx_xfer_pre
758 bra $p2 #ctx_xfer_pre_load 768 bra $p2 #ctx_xfer_pre_load
759 ctx_xfer_pre: 769 ctx_xfer_pre:
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvc0.fuc.h b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvc0.fuc.h
index 85a8d556f484..bb03d2a1d57b 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvc0.fuc.h
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvc0.fuc.h
@@ -799,79 +799,80 @@ uint32_t nvc0_grhub_code[] = {
799 0x01fa0613, 799 0x01fa0613,
800 0xf803f806, 800 0xf803f806,
801/* 0x0829: ctx_xfer */ 801/* 0x0829: ctx_xfer */
802 0x0611f400, 802 0x00f7f100,
803/* 0x082f: ctx_xfer_pre */ 803 0x06f4b60c,
804 0xf01102f4, 804 0xd004e7f0,
805 0x21f510f7, 805/* 0x0836: ctx_xfer_idle */
806 0x21f50698, 806 0xfecf80fe,
807 0x11f40631, 807 0x00e4f100,
808/* 0x083d: ctx_xfer_pre_load */ 808 0xf91bf420,
809 0x02f7f01c, 809 0xf40611f4,
810 0x065721f5, 810/* 0x0846: ctx_xfer_pre */
811 0x066621f5, 811 0xf7f01102,
812 0x067821f5, 812 0x9821f510,
813 0x21f5f4bd, 813 0x3121f506,
814 0x21f50657, 814 0x1c11f406,
815/* 0x0856: ctx_xfer_exec */ 815/* 0x0854: ctx_xfer_pre_load */
816 0x019806b8, 816 0xf502f7f0,
817 0x1427f116, 817 0xf5065721,
818 0x0624b604, 818 0xf5066621,
819 0xf10020d0, 819 0xbd067821,
820 0xf0a500e7, 820 0x5721f5f4,
821 0x1fb941e3, 821 0xb821f506,
822 0x8d21f402, 822/* 0x086d: ctx_xfer_exec */
823 0xf004e0b6, 823 0x16019806,
824 0x2cf001fc, 824 0x041427f1,
825 0x0124b602, 825 0xd00624b6,
826 0xf405f2fd, 826 0xe7f10020,
827 0x17f18d21, 827 0xe3f0a500,
828 0x13f04afc, 828 0x021fb941,
829 0x0c27f002, 829 0xb68d21f4,
830 0xf50012d0, 830 0xfcf004e0,
831 0xf1020721, 831 0x022cf001,
832 0xf047fc27, 832 0xfd0124b6,
833 0x20d00223, 833 0x21f405f2,
834 0x012cf000, 834 0xfc17f18d,
835 0xd00320b6, 835 0x0213f04a,
836 0xacf00012, 836 0xd00c27f0,
837 0x06a5f001, 837 0x21f50012,
838 0x9800b7f0, 838 0x27f10207,
839 0x0d98140c, 839 0x23f047fc,
840 0x00e7f015, 840 0x0020d002,
841 0x015c21f5, 841 0xb6012cf0,
842 0xf508a7f0, 842 0x12d00320,
843 0xf5010321, 843 0x01acf000,
844 0xf4020721, 844 0xf006a5f0,
845 0xa7f02201, 845 0x0c9800b7,
846 0xc921f40c, 846 0x150d9814,
847 0x0a1017f1, 847 0xf500e7f0,
848 0xf00614b6, 848 0xf0015c21,
849 0x12d00527, 849 0x21f508a7,
850/* 0x08dd: ctx_xfer_post_save_wait */ 850 0x21f50103,
851 0x0012cf00, 851 0x01f40207,
852 0xf40522fd, 852 0x0ca7f022,
853 0x02f4fa1b, 853 0xf1c921f4,
854/* 0x08e9: ctx_xfer_post */ 854 0xb60a1017,
855 0x02f7f032, 855 0x27f00614,
856 0x065721f5, 856 0x0012d005,
857 0x21f5f4bd, 857/* 0x08f4: ctx_xfer_post_save_wait */
858 0x21f50698, 858 0xfd0012cf,
859 0x21f50226, 859 0x1bf40522,
860 0xf4bd0666, 860 0x3202f4fa,
861 0x065721f5, 861/* 0x0900: ctx_xfer_post */
862 0x981011f4, 862 0xf502f7f0,
863 0x11fd8001, 863 0xbd065721,
864 0x070bf405, 864 0x9821f5f4,
865 0x07df21f5, 865 0x2621f506,
866/* 0x0914: ctx_xfer_no_post_mmio */ 866 0x6621f502,
867 0x064921f5, 867 0xf5f4bd06,
868/* 0x0918: ctx_xfer_done */ 868 0xf4065721,
869 0x000000f8, 869 0x01981011,
870 0x00000000, 870 0x0511fd80,
871 0x00000000, 871 0xf5070bf4,
872 0x00000000, 872/* 0x092b: ctx_xfer_no_post_mmio */
873 0x00000000, 873 0xf507df21,
874 0x00000000, 874/* 0x092f: ctx_xfer_done */
875 0xf8064921,
875 0x00000000, 876 0x00000000,
876 0x00000000, 877 0x00000000,
877 0x00000000, 878 0x00000000,
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnve0.fuc b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnve0.fuc
index 138eeaa28665..7fe9d7cf486b 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnve0.fuc
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnve0.fuc
@@ -44,6 +44,9 @@ chipsets:
44.b8 0xe7 0 0 0 44.b8 0xe7 0 0 0
45.b16 #nve4_hub_mmio_head 45.b16 #nve4_hub_mmio_head
46.b16 #nve4_hub_mmio_tail 46.b16 #nve4_hub_mmio_tail
47.b8 0xe6 0 0 0
48.b16 #nve4_hub_mmio_head
49.b16 #nve4_hub_mmio_tail
47.b8 0 0 0 0 50.b8 0 0 0 0
48 51
49nve4_hub_mmio_head: 52nve4_hub_mmio_head:
@@ -680,6 +683,16 @@ ctx_mmio_exec:
680// on load it means: "a save preceeded this load" 683// on load it means: "a save preceeded this load"
681// 684//
682ctx_xfer: 685ctx_xfer:
686 // according to mwk, some kind of wait for idle
687 mov $r15 0xc00
688 shl b32 $r15 6
689 mov $r14 4
690 iowr I[$r15 + 0x200] $r14
691 ctx_xfer_idle:
692 iord $r14 I[$r15 + 0x000]
693 and $r14 0x2000
694 bra ne #ctx_xfer_idle
695
683 bra not $p1 #ctx_xfer_pre 696 bra not $p1 #ctx_xfer_pre
684 bra $p2 #ctx_xfer_pre_load 697 bra $p2 #ctx_xfer_pre_load
685 ctx_xfer_pre: 698 ctx_xfer_pre:
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnve0.fuc.h b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnve0.fuc.h
index decf0c60ca3b..e3421af68ab9 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnve0.fuc.h
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnve0.fuc.h
@@ -30,11 +30,13 @@ uint32_t nve0_grhub_data[] = {
30 0x00000000, 30 0x00000000,
31/* 0x005c: chipsets */ 31/* 0x005c: chipsets */
32 0x000000e4, 32 0x000000e4,
33 0x013c0070, 33 0x01440078,
34 0x000000e7, 34 0x000000e7,
35 0x013c0070, 35 0x01440078,
36 0x000000e6,
37 0x01440078,
36 0x00000000, 38 0x00000000,
37/* 0x0070: nve4_hub_mmio_head */ 39/* 0x0078: nve4_hub_mmio_head */
38 0x0417e91c, 40 0x0417e91c,
39 0x04400204, 41 0x04400204,
40 0x18404010, 42 0x18404010,
@@ -86,9 +88,7 @@ uint32_t nve0_grhub_data[] = {
86 0x00408840, 88 0x00408840,
87 0x08408900, 89 0x08408900,
88 0x00408980, 90 0x00408980,
89/* 0x013c: nve4_hub_mmio_tail */ 91/* 0x0144: nve4_hub_mmio_tail */
90 0x00000000,
91 0x00000000,
92 0x00000000, 92 0x00000000,
93 0x00000000, 93 0x00000000,
94 0x00000000, 94 0x00000000,
@@ -781,77 +781,78 @@ uint32_t nve0_grhub_code[] = {
781 0x0613f002, 781 0x0613f002,
782 0xf80601fa, 782 0xf80601fa,
783/* 0x07fb: ctx_xfer */ 783/* 0x07fb: ctx_xfer */
784 0xf400f803, 784 0xf100f803,
785 0x02f40611, 785 0xb60c00f7,
786/* 0x0801: ctx_xfer_pre */ 786 0xe7f006f4,
787 0x10f7f00d, 787 0x80fed004,
788 0x067221f5, 788/* 0x0808: ctx_xfer_idle */
789/* 0x080b: ctx_xfer_pre_load */ 789 0xf100fecf,
790 0xf01c11f4, 790 0xf42000e4,
791 0x21f502f7, 791 0x11f4f91b,
792 0x21f50631, 792 0x0d02f406,
793 0x21f50640, 793/* 0x0818: ctx_xfer_pre */
794 0xf4bd0652, 794 0xf510f7f0,
795 0x063121f5, 795 0xf4067221,
796 0x069221f5, 796/* 0x0822: ctx_xfer_pre_load */
797/* 0x0824: ctx_xfer_exec */ 797 0xf7f01c11,
798 0xf1160198, 798 0x3121f502,
799 0xb6041427, 799 0x4021f506,
800 0x20d00624, 800 0x5221f506,
801 0x00e7f100, 801 0xf5f4bd06,
802 0x41e3f0a5, 802 0xf5063121,
803 0xf4021fb9, 803/* 0x083b: ctx_xfer_exec */
804 0xe0b68d21, 804 0x98069221,
805 0x01fcf004, 805 0x27f11601,
806 0xb6022cf0, 806 0x24b60414,
807 0xf2fd0124, 807 0x0020d006,
808 0x8d21f405, 808 0xa500e7f1,
809 0x4afc17f1, 809 0xb941e3f0,
810 0xf00213f0, 810 0x21f4021f,
811 0x12d00c27, 811 0x04e0b68d,
812 0x0721f500, 812 0xf001fcf0,
813 0xfc27f102, 813 0x24b6022c,
814 0x0223f047, 814 0x05f2fd01,
815 0xf00020d0, 815 0xf18d21f4,
816 0x20b6012c, 816 0xf04afc17,
817 0x0012d003, 817 0x27f00213,
818 0xf001acf0, 818 0x0012d00c,
819 0xb7f006a5, 819 0x020721f5,
820 0x140c9800, 820 0x47fc27f1,
821 0xf0150d98, 821 0xd00223f0,
822 0x21f500e7, 822 0x2cf00020,
823 0xa7f0015c, 823 0x0320b601,
824 0x0321f508, 824 0xf00012d0,
825 0x0721f501, 825 0xa5f001ac,
826 0x2201f402, 826 0x00b7f006,
827 0xf40ca7f0, 827 0x98140c98,
828 0x17f1c921, 828 0xe7f0150d,
829 0x14b60a10, 829 0x5c21f500,
830 0x0527f006, 830 0x08a7f001,
831/* 0x08ab: ctx_xfer_post_save_wait */ 831 0x010321f5,
832 0xcf0012d0, 832 0x020721f5,
833 0x22fd0012, 833 0xf02201f4,
834 0xfa1bf405, 834 0x21f40ca7,
835/* 0x08b7: ctx_xfer_post */ 835 0x1017f1c9,
836 0xf02e02f4, 836 0x0614b60a,
837 0x21f502f7, 837 0xd00527f0,
838 0xf4bd0631, 838/* 0x08c2: ctx_xfer_post_save_wait */
839 0x067221f5, 839 0x12cf0012,
840 0x022621f5, 840 0x0522fd00,
841 0x064021f5, 841 0xf4fa1bf4,
842 0x21f5f4bd, 842/* 0x08ce: ctx_xfer_post */
843 0x11f40631, 843 0xf7f02e02,
844 0x80019810, 844 0x3121f502,
845 0xf40511fd, 845 0xf5f4bd06,
846 0x21f5070b, 846 0xf5067221,
847/* 0x08e2: ctx_xfer_no_post_mmio */ 847 0xf5022621,
848/* 0x08e2: ctx_xfer_done */ 848 0xbd064021,
849 0x00f807b1, 849 0x3121f5f4,
850 0x00000000, 850 0x1011f406,
851 0x00000000, 851 0xfd800198,
852 0x00000000, 852 0x0bf40511,
853 0x00000000, 853 0xb121f507,
854 0x00000000, 854/* 0x08f9: ctx_xfer_no_post_mmio */
855 0x00000000, 855/* 0x08f9: ctx_xfer_done */
856 0x0000f807,
856 0x00000000, 857 0x00000000,
857}; 858};
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c b/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c
index 47a02081d708..45aff5f5085a 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c
@@ -516,18 +516,9 @@ nvc0_graph_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
516{ 516{
517 struct nouveau_device *device = nv_device(parent); 517 struct nouveau_device *device = nv_device(parent);
518 struct nvc0_graph_priv *priv; 518 struct nvc0_graph_priv *priv;
519 bool enable = true;
520 int ret, i; 519 int ret, i;
521 520
522 switch (device->chipset) { 521 ret = nouveau_graph_create(parent, engine, oclass, true, &priv);
523 case 0xd9: /* known broken without binary driver firmware */
524 enable = false;
525 break;
526 default:
527 break;
528 }
529
530 ret = nouveau_graph_create(parent, engine, oclass, enable, &priv);
531 *pobject = nv_object(priv); 522 *pobject = nv_object(priv);
532 if (ret) 523 if (ret)
533 return ret; 524 return ret;
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.h b/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.h
index 18d2210e12eb..a1e78de46456 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.h
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.h
@@ -121,6 +121,7 @@ nvc0_graph_class(void *obj)
121 return 0x9297; 121 return 0x9297;
122 case 0xe4: 122 case 0xe4:
123 case 0xe7: 123 case 0xe7:
124 case 0xe6:
124 return 0xa097; 125 return 0xa097;
125 default: 126 default:
126 return 0; 127 return 0;
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/nve0.c b/drivers/gpu/drm/nouveau/core/engine/graph/nve0.c
index 539d4c72f192..9f82e9702b46 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/nve0.c
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/nve0.c
@@ -203,7 +203,7 @@ nve0_graph_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
203 struct nvc0_graph_priv *priv; 203 struct nvc0_graph_priv *priv;
204 int ret, i; 204 int ret, i;
205 205
206 ret = nouveau_graph_create(parent, engine, oclass, false, &priv); 206 ret = nouveau_graph_create(parent, engine, oclass, true, &priv);
207 *pobject = nv_object(priv); 207 *pobject = nv_object(priv);
208 if (ret) 208 if (ret)
209 return ret; 209 return ret;
@@ -252,6 +252,7 @@ nve0_graph_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
252 priv->magic_not_rop_nr = 1; 252 priv->magic_not_rop_nr = 1;
253 break; 253 break;
254 case 0xe7: 254 case 0xe7:
255 case 0xe6:
255 priv->magic_not_rop_nr = 1; 256 priv->magic_not_rop_nr = 1;
256 break; 257 break;
257 default: 258 default:
diff --git a/drivers/gpu/drm/nouveau/core/include/subdev/bios.h b/drivers/gpu/drm/nouveau/core/include/subdev/bios.h
index d145b25e6be4..5bd1ca8cd20d 100644
--- a/drivers/gpu/drm/nouveau/core/include/subdev/bios.h
+++ b/drivers/gpu/drm/nouveau/core/include/subdev/bios.h
@@ -17,6 +17,7 @@ struct nouveau_bios {
17 u8 chip; 17 u8 chip;
18 u8 minor; 18 u8 minor;
19 u8 micro; 19 u8 micro;
20 u8 patch;
20 } version; 21 } version;
21}; 22};
22 23
diff --git a/drivers/gpu/drm/nouveau/core/include/subdev/bios/gpio.h b/drivers/gpu/drm/nouveau/core/include/subdev/bios/gpio.h
index 2bf178082a36..e6563b5cb08e 100644
--- a/drivers/gpu/drm/nouveau/core/include/subdev/bios/gpio.h
+++ b/drivers/gpu/drm/nouveau/core/include/subdev/bios/gpio.h
@@ -25,9 +25,11 @@ struct dcb_gpio_func {
25 u8 param; 25 u8 param;
26}; 26};
27 27
28u16 dcb_gpio_table(struct nouveau_bios *); 28u16 dcb_gpio_table(struct nouveau_bios *, u8 *ver, u8 *hdr, u8 *cnt, u8 *len);
29u16 dcb_gpio_entry(struct nouveau_bios *, int idx, int ent, u8 *ver); 29u16 dcb_gpio_entry(struct nouveau_bios *, int idx, int ent, u8 *ver, u8 *len);
30int dcb_gpio_parse(struct nouveau_bios *, int idx, u8 func, u8 line, 30u16 dcb_gpio_parse(struct nouveau_bios *, int idx, int ent, u8 *ver, u8 *len,
31 struct dcb_gpio_func *); 31 struct dcb_gpio_func *);
32u16 dcb_gpio_match(struct nouveau_bios *, int idx, u8 func, u8 line,
33 u8 *ver, u8 *len, struct dcb_gpio_func *);
32 34
33#endif 35#endif
diff --git a/drivers/gpu/drm/nouveau/core/include/subdev/bios/init.h b/drivers/gpu/drm/nouveau/core/include/subdev/bios/init.h
index e69a8bdc6e97..ca2f6bf37f46 100644
--- a/drivers/gpu/drm/nouveau/core/include/subdev/bios/init.h
+++ b/drivers/gpu/drm/nouveau/core/include/subdev/bios/init.h
@@ -13,6 +13,7 @@ struct nvbios_init {
13 u32 nested; 13 u32 nested;
14 u16 repeat; 14 u16 repeat;
15 u16 repend; 15 u16 repend;
16 u32 ramcfg;
16}; 17};
17 18
18int nvbios_exec(struct nvbios_init *); 19int nvbios_exec(struct nvbios_init *);
diff --git a/drivers/gpu/drm/nouveau/core/include/subdev/gpio.h b/drivers/gpu/drm/nouveau/core/include/subdev/gpio.h
index 9ea2b12cc15d..b75e8f18e52c 100644
--- a/drivers/gpu/drm/nouveau/core/include/subdev/gpio.h
+++ b/drivers/gpu/drm/nouveau/core/include/subdev/gpio.h
@@ -11,7 +11,7 @@ struct nouveau_gpio {
11 struct nouveau_subdev base; 11 struct nouveau_subdev base;
12 12
13 /* hardware interfaces */ 13 /* hardware interfaces */
14 void (*reset)(struct nouveau_gpio *); 14 void (*reset)(struct nouveau_gpio *, u8 func);
15 int (*drive)(struct nouveau_gpio *, int line, int dir, int out); 15 int (*drive)(struct nouveau_gpio *, int line, int dir, int out);
16 int (*sense)(struct nouveau_gpio *, int line); 16 int (*sense)(struct nouveau_gpio *, int line);
17 void (*irq_enable)(struct nouveau_gpio *, int line, bool); 17 void (*irq_enable)(struct nouveau_gpio *, int line, bool);
diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
index dd111947eb86..f621f69fa1a2 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c
@@ -447,6 +447,7 @@ nouveau_bios_ctor(struct nouveau_object *parent,
447 bios->version.chip = nv_ro08(bios, bit_i.offset + 2); 447 bios->version.chip = nv_ro08(bios, bit_i.offset + 2);
448 bios->version.minor = nv_ro08(bios, bit_i.offset + 1); 448 bios->version.minor = nv_ro08(bios, bit_i.offset + 1);
449 bios->version.micro = nv_ro08(bios, bit_i.offset + 0); 449 bios->version.micro = nv_ro08(bios, bit_i.offset + 0);
450 bios->version.patch = nv_ro08(bios, bit_i.offset + 4);
450 } else 451 } else
451 if (bmp_version(bios)) { 452 if (bmp_version(bios)) {
452 bios->version.major = nv_ro08(bios, bios->bmp_offset + 13); 453 bios->version.major = nv_ro08(bios, bios->bmp_offset + 13);
@@ -455,9 +456,9 @@ nouveau_bios_ctor(struct nouveau_object *parent,
455 bios->version.micro = nv_ro08(bios, bios->bmp_offset + 10); 456 bios->version.micro = nv_ro08(bios, bios->bmp_offset + 10);
456 } 457 }
457 458
458 nv_info(bios, "version %02x.%02x.%02x.%02x\n", 459 nv_info(bios, "version %02x.%02x.%02x.%02x.%02x\n",
459 bios->version.major, bios->version.chip, 460 bios->version.major, bios->version.chip,
460 bios->version.minor, bios->version.micro); 461 bios->version.minor, bios->version.micro, bios->version.patch);
461 462
462 return 0; 463 return 0;
463} 464}
diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/gpio.c b/drivers/gpu/drm/nouveau/core/subdev/bios/gpio.c
index c90d4aa3ae4f..c84e93fa6d95 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/bios/gpio.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/bios/gpio.c
@@ -27,84 +27,105 @@
27#include <subdev/bios/gpio.h> 27#include <subdev/bios/gpio.h>
28 28
29u16 29u16
30dcb_gpio_table(struct nouveau_bios *bios) 30dcb_gpio_table(struct nouveau_bios *bios, u8 *ver, u8 *hdr, u8 *cnt, u8 *len)
31{ 31{
32 u8 ver, hdr, cnt, len; 32 u16 data = 0x0000;
33 u16 dcb = dcb_table(bios, &ver, &hdr, &cnt, &len); 33 u16 dcb = dcb_table(bios, ver, hdr, cnt, len);
34 if (dcb) { 34 if (dcb) {
35 if (ver >= 0x30 && hdr >= 0x0c) 35 if (*ver >= 0x30 && *hdr >= 0x0c)
36 return nv_ro16(bios, dcb + 0x0a); 36 data = nv_ro16(bios, dcb + 0x0a);
37 if (ver >= 0x22 && nv_ro08(bios, dcb - 1) >= 0x13) 37 else
38 return nv_ro16(bios, dcb - 0x0f); 38 if (*ver >= 0x22 && nv_ro08(bios, dcb - 1) >= 0x13)
39 data = nv_ro16(bios, dcb - 0x0f);
40
41 if (data) {
42 *ver = nv_ro08(bios, data + 0x00);
43 if (*ver < 0x30) {
44 *hdr = 3;
45 *cnt = nv_ro08(bios, data + 0x02);
46 *len = nv_ro08(bios, data + 0x01);
47 } else
48 if (*ver <= 0x41) {
49 *hdr = nv_ro08(bios, data + 0x01);
50 *cnt = nv_ro08(bios, data + 0x02);
51 *len = nv_ro08(bios, data + 0x03);
52 } else {
53 data = 0x0000;
54 }
55 }
39 } 56 }
40 return 0x0000; 57 return data;
41} 58}
42 59
43u16 60u16
44dcb_gpio_entry(struct nouveau_bios *bios, int idx, int ent, u8 *ver) 61dcb_gpio_entry(struct nouveau_bios *bios, int idx, int ent, u8 *ver, u8 *len)
45{ 62{
46 u16 gpio = dcb_gpio_table(bios); 63 u8 hdr, cnt;
47 if (gpio) { 64 u16 gpio = !idx ? dcb_gpio_table(bios, ver, &hdr, &cnt, len) : 0x0000;
48 *ver = nv_ro08(bios, gpio); 65 if (gpio && ent < cnt)
49 if (*ver < 0x30 && ent < nv_ro08(bios, gpio + 2)) 66 return gpio + hdr + (ent * *len);
50 return gpio + 3 + (ent * nv_ro08(bios, gpio + 1));
51 else if (ent < nv_ro08(bios, gpio + 2))
52 return gpio + nv_ro08(bios, gpio + 1) +
53 (ent * nv_ro08(bios, gpio + 3));
54 }
55 return 0x0000; 67 return 0x0000;
56} 68}
57 69
58int 70u16
59dcb_gpio_parse(struct nouveau_bios *bios, int idx, u8 func, u8 line, 71dcb_gpio_parse(struct nouveau_bios *bios, int idx, int ent, u8 *ver, u8 *len,
60 struct dcb_gpio_func *gpio) 72 struct dcb_gpio_func *gpio)
61{ 73{
62 u8 ver, hdr, cnt, len; 74 u16 data = dcb_gpio_entry(bios, idx, ent, ver, len);
63 u16 entry; 75 if (data) {
64 int i = -1; 76 if (*ver < 0x40) {
65 77 u16 info = nv_ro16(bios, data);
66 while ((entry = dcb_gpio_entry(bios, idx, ++i, &ver))) {
67 if (ver < 0x40) {
68 u16 data = nv_ro16(bios, entry);
69 *gpio = (struct dcb_gpio_func) { 78 *gpio = (struct dcb_gpio_func) {
70 .line = (data & 0x001f) >> 0, 79 .line = (info & 0x001f) >> 0,
71 .func = (data & 0x07e0) >> 5, 80 .func = (info & 0x07e0) >> 5,
72 .log[0] = (data & 0x1800) >> 11, 81 .log[0] = (info & 0x1800) >> 11,
73 .log[1] = (data & 0x6000) >> 13, 82 .log[1] = (info & 0x6000) >> 13,
74 .param = !!(data & 0x8000), 83 .param = !!(info & 0x8000),
75 }; 84 };
76 } else 85 } else
77 if (ver < 0x41) { 86 if (*ver < 0x41) {
78 u32 data = nv_ro32(bios, entry); 87 u32 info = nv_ro32(bios, data);
79 *gpio = (struct dcb_gpio_func) { 88 *gpio = (struct dcb_gpio_func) {
80 .line = (data & 0x0000001f) >> 0, 89 .line = (info & 0x0000001f) >> 0,
81 .func = (data & 0x0000ff00) >> 8, 90 .func = (info & 0x0000ff00) >> 8,
82 .log[0] = (data & 0x18000000) >> 27, 91 .log[0] = (info & 0x18000000) >> 27,
83 .log[1] = (data & 0x60000000) >> 29, 92 .log[1] = (info & 0x60000000) >> 29,
84 .param = !!(data & 0x80000000), 93 .param = !!(info & 0x80000000),
85 }; 94 };
86 } else { 95 } else {
87 u32 data = nv_ro32(bios, entry + 0); 96 u32 info = nv_ro32(bios, data + 0);
88 u8 data1 = nv_ro32(bios, entry + 4); 97 u8 info1 = nv_ro32(bios, data + 4);
89 *gpio = (struct dcb_gpio_func) { 98 *gpio = (struct dcb_gpio_func) {
90 .line = (data & 0x0000003f) >> 0, 99 .line = (info & 0x0000003f) >> 0,
91 .func = (data & 0x0000ff00) >> 8, 100 .func = (info & 0x0000ff00) >> 8,
92 .log[0] = (data1 & 0x30) >> 4, 101 .log[0] = (info1 & 0x30) >> 4,
93 .log[1] = (data1 & 0xc0) >> 6, 102 .log[1] = (info1 & 0xc0) >> 6,
94 .param = !!(data & 0x80000000), 103 .param = !!(info & 0x80000000),
95 }; 104 };
96 } 105 }
106 }
107
108 return data;
109}
97 110
111u16
112dcb_gpio_match(struct nouveau_bios *bios, int idx, u8 func, u8 line,
113 u8 *ver, u8 *len, struct dcb_gpio_func *gpio)
114{
115 u8 hdr, cnt, i = 0;
116 u16 data;
117
118 while ((data = dcb_gpio_parse(bios, idx, i++, ver, len, gpio))) {
98 if ((line == 0xff || line == gpio->line) && 119 if ((line == 0xff || line == gpio->line) &&
99 (func == 0xff || func == gpio->func)) 120 (func == 0xff || func == gpio->func))
100 return 0; 121 return data;
101 } 122 }
102 123
103 /* DCB 2.2, fixed TVDAC GPIO data */ 124 /* DCB 2.2, fixed TVDAC GPIO data */
104 if ((entry = dcb_table(bios, &ver, &hdr, &cnt, &len))) { 125 if ((data = dcb_table(bios, ver, &hdr, &cnt, len))) {
105 if (ver >= 0x22 && ver < 0x30 && func == DCB_GPIO_TVDAC0) { 126 if (*ver >= 0x22 && *ver < 0x30 && func == DCB_GPIO_TVDAC0) {
106 u8 conf = nv_ro08(bios, entry - 5); 127 u8 conf = nv_ro08(bios, data - 5);
107 u8 addr = nv_ro08(bios, entry - 4); 128 u8 addr = nv_ro08(bios, data - 4);
108 if (conf & 0x01) { 129 if (conf & 0x01) {
109 *gpio = (struct dcb_gpio_func) { 130 *gpio = (struct dcb_gpio_func) {
110 .func = DCB_GPIO_TVDAC0, 131 .func = DCB_GPIO_TVDAC0,
@@ -112,10 +133,11 @@ dcb_gpio_parse(struct nouveau_bios *bios, int idx, u8 func, u8 line,
112 .log[0] = !!(conf & 0x02), 133 .log[0] = !!(conf & 0x02),
113 .log[1] = !(conf & 0x02), 134 .log[1] = !(conf & 0x02),
114 }; 135 };
115 return 0; 136 *ver = 0x00;
137 return data;
116 } 138 }
117 } 139 }
118 } 140 }
119 141
120 return -EINVAL; 142 return 0x0000;
121} 143}
diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/init.c b/drivers/gpu/drm/nouveau/core/subdev/bios/init.c
index ae168bbb86d8..2917d552689b 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/bios/init.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/bios/init.c
@@ -2,11 +2,12 @@
2#include <core/device.h> 2#include <core/device.h>
3 3
4#include <subdev/bios.h> 4#include <subdev/bios.h>
5#include <subdev/bios/conn.h>
6#include <subdev/bios/bmp.h> 5#include <subdev/bios/bmp.h>
7#include <subdev/bios/bit.h> 6#include <subdev/bios/bit.h>
7#include <subdev/bios/conn.h>
8#include <subdev/bios/dcb.h> 8#include <subdev/bios/dcb.h>
9#include <subdev/bios/dp.h> 9#include <subdev/bios/dp.h>
10#include <subdev/bios/gpio.h>
10#include <subdev/bios/init.h> 11#include <subdev/bios/init.h>
11#include <subdev/devinit.h> 12#include <subdev/devinit.h>
12#include <subdev/clock.h> 13#include <subdev/clock.h>
@@ -410,9 +411,25 @@ init_ram_restrict_group_count(struct nvbios_init *init)
410} 411}
411 412
412static u8 413static u8
414init_ram_restrict_strap(struct nvbios_init *init)
415{
416 /* This appears to be the behaviour of the VBIOS parser, and *is*
417 * important to cache the NV_PEXTDEV_BOOT0 on later chipsets to
418 * avoid fucking up the memory controller (somehow) by reading it
419 * on every INIT_RAM_RESTRICT_ZM_GROUP opcode.
420 *
421 * Preserving the non-caching behaviour on earlier chipsets just
422 * in case *not* re-reading the strap causes similar breakage.
423 */
424 if (!init->ramcfg || init->bios->version.major < 0x70)
425 init->ramcfg = init_rd32(init, 0x101000);
426 return (init->ramcfg & 0x00000003c) >> 2;
427}
428
429static u8
413init_ram_restrict(struct nvbios_init *init) 430init_ram_restrict(struct nvbios_init *init)
414{ 431{
415 u32 strap = (init_rd32(init, 0x101000) & 0x0000003c) >> 2; 432 u8 strap = init_ram_restrict_strap(init);
416 u16 table = init_ram_restrict_table(init); 433 u16 table = init_ram_restrict_table(init);
417 if (table) 434 if (table)
418 return nv_ro08(init->bios, table + strap); 435 return nv_ro08(init->bios, table + strap);
@@ -1781,7 +1798,7 @@ init_gpio(struct nvbios_init *init)
1781 init->offset += 1; 1798 init->offset += 1;
1782 1799
1783 if (init_exec(init) && gpio && gpio->reset) 1800 if (init_exec(init) && gpio && gpio->reset)
1784 gpio->reset(gpio); 1801 gpio->reset(gpio, DCB_GPIO_UNUSED);
1785} 1802}
1786 1803
1787/** 1804/**
@@ -1995,6 +2012,47 @@ init_i2c_long_if(struct nvbios_init *init)
1995 init_exec_set(init, false); 2012 init_exec_set(init, false);
1996} 2013}
1997 2014
2015/**
2016 * INIT_GPIO_NE - opcode 0xa9
2017 *
2018 */
2019static void
2020init_gpio_ne(struct nvbios_init *init)
2021{
2022 struct nouveau_bios *bios = init->bios;
2023 struct nouveau_gpio *gpio = nouveau_gpio(bios);
2024 struct dcb_gpio_func func;
2025 u8 count = nv_ro08(bios, init->offset + 1);
2026 u8 idx = 0, ver, len;
2027 u16 data, i;
2028
2029 trace("GPIO_NE\t");
2030 init->offset += 2;
2031
2032 for (i = init->offset; i < init->offset + count; i++)
2033 cont("0x%02x ", nv_ro08(bios, i));
2034 cont("\n");
2035
2036 while ((data = dcb_gpio_parse(bios, 0, idx++, &ver, &len, &func))) {
2037 if (func.func != DCB_GPIO_UNUSED) {
2038 for (i = init->offset; i < init->offset + count; i++) {
2039 if (func.func == nv_ro08(bios, i))
2040 break;
2041 }
2042
2043 trace("\tFUNC[0x%02x]", func.func);
2044 if (i == (init->offset + count)) {
2045 cont(" *");
2046 if (init_exec(init) && gpio && gpio->reset)
2047 gpio->reset(gpio, func.func);
2048 }
2049 cont("\n");
2050 }
2051 }
2052
2053 init->offset += count;
2054}
2055
1998static struct nvbios_init_opcode { 2056static struct nvbios_init_opcode {
1999 void (*exec)(struct nvbios_init *); 2057 void (*exec)(struct nvbios_init *);
2000} init_opcode[] = { 2058} init_opcode[] = {
@@ -2059,6 +2117,7 @@ static struct nvbios_init_opcode {
2059 [0x98] = { init_auxch }, 2117 [0x98] = { init_auxch },
2060 [0x99] = { init_zm_auxch }, 2118 [0x99] = { init_zm_auxch },
2061 [0x9a] = { init_i2c_long_if }, 2119 [0x9a] = { init_i2c_long_if },
2120 [0xa9] = { init_gpio_ne },
2062}; 2121};
2063 2122
2064#define init_opcode_nr (sizeof(init_opcode) / sizeof(init_opcode[0])) 2123#define init_opcode_nr (sizeof(init_opcode) / sizeof(init_opcode[0]))
diff --git a/drivers/gpu/drm/nouveau/core/subdev/device/nve0.c b/drivers/gpu/drm/nouveau/core/subdev/device/nve0.c
index 9b7881e76634..03a652876e73 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/device/nve0.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/device/nve0.c
@@ -109,6 +109,34 @@ nve0_identify(struct nouveau_device *device)
109 device->oclass[NVDEV_ENGINE_VP ] = &nve0_vp_oclass; 109 device->oclass[NVDEV_ENGINE_VP ] = &nve0_vp_oclass;
110 device->oclass[NVDEV_ENGINE_PPP ] = &nvc0_ppp_oclass; 110 device->oclass[NVDEV_ENGINE_PPP ] = &nvc0_ppp_oclass;
111 break; 111 break;
112 case 0xe6:
113 device->cname = "GK106";
114 device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass;
115 device->oclass[NVDEV_SUBDEV_GPIO ] = &nvd0_gpio_oclass;
116 device->oclass[NVDEV_SUBDEV_I2C ] = &nouveau_i2c_oclass;
117 device->oclass[NVDEV_SUBDEV_CLOCK ] = &nvc0_clock_oclass;
118 device->oclass[NVDEV_SUBDEV_THERM ] = &nv50_therm_oclass;
119 device->oclass[NVDEV_SUBDEV_MXM ] = &nv50_mxm_oclass;
120 device->oclass[NVDEV_SUBDEV_DEVINIT] = &nv50_devinit_oclass;
121 device->oclass[NVDEV_SUBDEV_MC ] = &nvc0_mc_oclass;
122 device->oclass[NVDEV_SUBDEV_TIMER ] = &nv04_timer_oclass;
123 device->oclass[NVDEV_SUBDEV_FB ] = &nvc0_fb_oclass;
124 device->oclass[NVDEV_SUBDEV_LTCG ] = &nvc0_ltcg_oclass;
125 device->oclass[NVDEV_SUBDEV_IBUS ] = &nve0_ibus_oclass;
126 device->oclass[NVDEV_SUBDEV_INSTMEM] = &nv50_instmem_oclass;
127 device->oclass[NVDEV_SUBDEV_VM ] = &nvc0_vmmgr_oclass;
128 device->oclass[NVDEV_SUBDEV_BAR ] = &nvc0_bar_oclass;
129 device->oclass[NVDEV_ENGINE_DMAOBJ ] = &nvd0_dmaeng_oclass;
130 device->oclass[NVDEV_ENGINE_FIFO ] = &nve0_fifo_oclass;
131 device->oclass[NVDEV_ENGINE_SW ] = &nvc0_software_oclass;
132 device->oclass[NVDEV_ENGINE_GR ] = &nve0_graph_oclass;
133 device->oclass[NVDEV_ENGINE_DISP ] = &nve0_disp_oclass;
134 device->oclass[NVDEV_ENGINE_COPY0 ] = &nve0_copy0_oclass;
135 device->oclass[NVDEV_ENGINE_COPY1 ] = &nve0_copy1_oclass;
136 device->oclass[NVDEV_ENGINE_BSP ] = &nve0_bsp_oclass;
137 device->oclass[NVDEV_ENGINE_VP ] = &nve0_vp_oclass;
138 device->oclass[NVDEV_ENGINE_PPP ] = &nvc0_ppp_oclass;
139 break;
112 default: 140 default:
113 nv_fatal(device, "unknown Kepler chipset\n"); 141 nv_fatal(device, "unknown Kepler chipset\n");
114 return -EINVAL; 142 return -EINVAL;
diff --git a/drivers/gpu/drm/nouveau/core/subdev/gpio/base.c b/drivers/gpu/drm/nouveau/core/subdev/gpio/base.c
index acf818c58bf0..9fb0f9b92d49 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/gpio/base.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/gpio/base.c
@@ -43,10 +43,15 @@ static int
43nouveau_gpio_find(struct nouveau_gpio *gpio, int idx, u8 tag, u8 line, 43nouveau_gpio_find(struct nouveau_gpio *gpio, int idx, u8 tag, u8 line,
44 struct dcb_gpio_func *func) 44 struct dcb_gpio_func *func)
45{ 45{
46 struct nouveau_bios *bios = nouveau_bios(gpio);
47 u8 ver, len;
48 u16 data;
49
46 if (line == 0xff && tag == 0xff) 50 if (line == 0xff && tag == 0xff)
47 return -EINVAL; 51 return -EINVAL;
48 52
49 if (!dcb_gpio_parse(nouveau_bios(gpio), idx, tag, line, func)) 53 data = dcb_gpio_match(bios, idx, tag, line, &ver, &len, func);
54 if (data)
50 return 0; 55 return 0;
51 56
52 /* Apple iMac G4 NV18 */ 57 /* Apple iMac G4 NV18 */
@@ -265,7 +270,7 @@ nouveau_gpio_init(struct nouveau_gpio *gpio)
265 int ret = nouveau_subdev_init(&gpio->base); 270 int ret = nouveau_subdev_init(&gpio->base);
266 if (ret == 0 && gpio->reset) { 271 if (ret == 0 && gpio->reset) {
267 if (dmi_check_system(gpio_reset_ids)) 272 if (dmi_check_system(gpio_reset_ids))
268 gpio->reset(gpio); 273 gpio->reset(gpio, DCB_GPIO_UNUSED);
269 } 274 }
270 return ret; 275 return ret;
271} 276}
diff --git a/drivers/gpu/drm/nouveau/core/subdev/gpio/nv50.c b/drivers/gpu/drm/nouveau/core/subdev/gpio/nv50.c
index f3502c961cd9..bf13a1200f26 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/gpio/nv50.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/gpio/nv50.c
@@ -29,15 +29,15 @@ struct nv50_gpio_priv {
29}; 29};
30 30
31static void 31static void
32nv50_gpio_reset(struct nouveau_gpio *gpio) 32nv50_gpio_reset(struct nouveau_gpio *gpio, u8 match)
33{ 33{
34 struct nouveau_bios *bios = nouveau_bios(gpio); 34 struct nouveau_bios *bios = nouveau_bios(gpio);
35 struct nv50_gpio_priv *priv = (void *)gpio; 35 struct nv50_gpio_priv *priv = (void *)gpio;
36 u8 ver, len;
36 u16 entry; 37 u16 entry;
37 u8 ver;
38 int ent = -1; 38 int ent = -1;
39 39
40 while ((entry = dcb_gpio_entry(bios, 0, ++ent, &ver))) { 40 while ((entry = dcb_gpio_entry(bios, 0, ++ent, &ver, &len))) {
41 static const u32 regs[] = { 0xe100, 0xe28c }; 41 static const u32 regs[] = { 0xe100, 0xe28c };
42 u32 data = nv_ro32(bios, entry); 42 u32 data = nv_ro32(bios, entry);
43 u8 line = (data & 0x0000001f); 43 u8 line = (data & 0x0000001f);
@@ -48,7 +48,8 @@ nv50_gpio_reset(struct nouveau_gpio *gpio)
48 u32 val = (unk1 << 16) | unk0; 48 u32 val = (unk1 << 16) | unk0;
49 u32 reg = regs[line >> 4]; line &= 0x0f; 49 u32 reg = regs[line >> 4]; line &= 0x0f;
50 50
51 if (func == 0xff) 51 if ( func == DCB_GPIO_UNUSED ||
52 (match != DCB_GPIO_UNUSED && match != func))
52 continue; 53 continue;
53 54
54 gpio->set(gpio, 0, func, line, defs); 55 gpio->set(gpio, 0, func, line, defs);
diff --git a/drivers/gpu/drm/nouveau/core/subdev/gpio/nvd0.c b/drivers/gpu/drm/nouveau/core/subdev/gpio/nvd0.c
index 8d18fcad26e0..83e8b8f16e6a 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/gpio/nvd0.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/gpio/nvd0.c
@@ -29,15 +29,15 @@ struct nvd0_gpio_priv {
29}; 29};
30 30
31static void 31static void
32nvd0_gpio_reset(struct nouveau_gpio *gpio) 32nvd0_gpio_reset(struct nouveau_gpio *gpio, u8 match)
33{ 33{
34 struct nouveau_bios *bios = nouveau_bios(gpio); 34 struct nouveau_bios *bios = nouveau_bios(gpio);
35 struct nvd0_gpio_priv *priv = (void *)gpio; 35 struct nvd0_gpio_priv *priv = (void *)gpio;
36 u8 ver, len;
36 u16 entry; 37 u16 entry;
37 u8 ver;
38 int ent = -1; 38 int ent = -1;
39 39
40 while ((entry = dcb_gpio_entry(bios, 0, ++ent, &ver))) { 40 while ((entry = dcb_gpio_entry(bios, 0, ++ent, &ver, &len))) {
41 u32 data = nv_ro32(bios, entry); 41 u32 data = nv_ro32(bios, entry);
42 u8 line = (data & 0x0000003f); 42 u8 line = (data & 0x0000003f);
43 u8 defs = !!(data & 0x00000080); 43 u8 defs = !!(data & 0x00000080);
@@ -45,7 +45,8 @@ nvd0_gpio_reset(struct nouveau_gpio *gpio)
45 u8 unk0 = (data & 0x00ff0000) >> 16; 45 u8 unk0 = (data & 0x00ff0000) >> 16;
46 u8 unk1 = (data & 0x1f000000) >> 24; 46 u8 unk1 = (data & 0x1f000000) >> 24;
47 47
48 if (func == 0xff) 48 if ( func == DCB_GPIO_UNUSED ||
49 (match != DCB_GPIO_UNUSED && match != func))
49 continue; 50 continue;
50 51
51 gpio->set(gpio, 0, func, line, defs); 52 gpio->set(gpio, 0, func, line, defs);
diff --git a/drivers/gpu/drm/nouveau/core/subdev/mxm/base.c b/drivers/gpu/drm/nouveau/core/subdev/mxm/base.c
index 93e3ddf7303a..e286e132c7e7 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/mxm/base.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/mxm/base.c
@@ -260,7 +260,7 @@ nouveau_mxm_create_(struct nouveau_object *parent,
260 260
261 data = mxm_table(bios, &ver, &len); 261 data = mxm_table(bios, &ver, &len);
262 if (!data || !(ver = nv_ro08(bios, data))) { 262 if (!data || !(ver = nv_ro08(bios, data))) {
263 nv_info(mxm, "no VBIOS data, nothing to do\n"); 263 nv_debug(mxm, "no VBIOS data, nothing to do\n");
264 return 0; 264 return 0;
265 } 265 }
266 266
diff --git a/drivers/gpu/drm/radeon/evergreen_cs.c b/drivers/gpu/drm/radeon/evergreen_cs.c
index 74c6b42d2597..7a445666e71f 100644
--- a/drivers/gpu/drm/radeon/evergreen_cs.c
+++ b/drivers/gpu/drm/radeon/evergreen_cs.c
@@ -2654,6 +2654,35 @@ static int evergreen_packet3_check(struct radeon_cs_parser *p,
2654 ib[idx+4] = upper_32_bits(offset) & 0xff; 2654 ib[idx+4] = upper_32_bits(offset) & 0xff;
2655 } 2655 }
2656 break; 2656 break;
2657 case PACKET3_MEM_WRITE:
2658 {
2659 u64 offset;
2660
2661 if (pkt->count != 3) {
2662 DRM_ERROR("bad MEM_WRITE (invalid count)\n");
2663 return -EINVAL;
2664 }
2665 r = evergreen_cs_packet_next_reloc(p, &reloc);
2666 if (r) {
2667 DRM_ERROR("bad MEM_WRITE (missing reloc)\n");
2668 return -EINVAL;
2669 }
2670 offset = radeon_get_ib_value(p, idx+0);
2671 offset += ((u64)(radeon_get_ib_value(p, idx+1) & 0xff)) << 32UL;
2672 if (offset & 0x7) {
2673 DRM_ERROR("bad MEM_WRITE (address not qwords aligned)\n");
2674 return -EINVAL;
2675 }
2676 if ((offset + 8) > radeon_bo_size(reloc->robj)) {
2677 DRM_ERROR("bad MEM_WRITE bo too small: 0x%llx, 0x%lx\n",
2678 offset + 8, radeon_bo_size(reloc->robj));
2679 return -EINVAL;
2680 }
2681 offset += reloc->lobj.gpu_offset;
2682 ib[idx+0] = offset;
2683 ib[idx+1] = upper_32_bits(offset) & 0xff;
2684 break;
2685 }
2657 case PACKET3_COPY_DW: 2686 case PACKET3_COPY_DW:
2658 if (pkt->count != 4) { 2687 if (pkt->count != 4) {
2659 DRM_ERROR("bad COPY_DW (invalid count)\n"); 2688 DRM_ERROR("bad COPY_DW (invalid count)\n");
@@ -3287,6 +3316,7 @@ static bool evergreen_vm_reg_valid(u32 reg)
3287 3316
3288 /* check config regs */ 3317 /* check config regs */
3289 switch (reg) { 3318 switch (reg) {
3319 case WAIT_UNTIL:
3290 case GRBM_GFX_INDEX: 3320 case GRBM_GFX_INDEX:
3291 case CP_STRMOUT_CNTL: 3321 case CP_STRMOUT_CNTL:
3292 case CP_COHER_CNTL: 3322 case CP_COHER_CNTL:
diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600_cs.c
index 0be768be530c..9ea13d07cc55 100644
--- a/drivers/gpu/drm/radeon/r600_cs.c
+++ b/drivers/gpu/drm/radeon/r600_cs.c
@@ -2294,6 +2294,35 @@ static int r600_packet3_check(struct radeon_cs_parser *p,
2294 ib[idx+4] = upper_32_bits(offset) & 0xff; 2294 ib[idx+4] = upper_32_bits(offset) & 0xff;
2295 } 2295 }
2296 break; 2296 break;
2297 case PACKET3_MEM_WRITE:
2298 {
2299 u64 offset;
2300
2301 if (pkt->count != 3) {
2302 DRM_ERROR("bad MEM_WRITE (invalid count)\n");
2303 return -EINVAL;
2304 }
2305 r = r600_cs_packet_next_reloc(p, &reloc);
2306 if (r) {
2307 DRM_ERROR("bad MEM_WRITE (missing reloc)\n");
2308 return -EINVAL;
2309 }
2310 offset = radeon_get_ib_value(p, idx+0);
2311 offset += ((u64)(radeon_get_ib_value(p, idx+1) & 0xff)) << 32UL;
2312 if (offset & 0x7) {
2313 DRM_ERROR("bad MEM_WRITE (address not qwords aligned)\n");
2314 return -EINVAL;
2315 }
2316 if ((offset + 8) > radeon_bo_size(reloc->robj)) {
2317 DRM_ERROR("bad MEM_WRITE bo too small: 0x%llx, 0x%lx\n",
2318 offset + 8, radeon_bo_size(reloc->robj));
2319 return -EINVAL;
2320 }
2321 offset += reloc->lobj.gpu_offset;
2322 ib[idx+0] = offset;
2323 ib[idx+1] = upper_32_bits(offset) & 0xff;
2324 break;
2325 }
2297 case PACKET3_COPY_DW: 2326 case PACKET3_COPY_DW:
2298 if (pkt->count != 4) { 2327 if (pkt->count != 4) {
2299 DRM_ERROR("bad COPY_DW (invalid count)\n"); 2328 DRM_ERROR("bad COPY_DW (invalid count)\n");
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index 5dc744d43d12..9b9422c4403a 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -225,12 +225,13 @@ struct radeon_fence {
225int radeon_fence_driver_start_ring(struct radeon_device *rdev, int ring); 225int radeon_fence_driver_start_ring(struct radeon_device *rdev, int ring);
226int radeon_fence_driver_init(struct radeon_device *rdev); 226int radeon_fence_driver_init(struct radeon_device *rdev);
227void radeon_fence_driver_fini(struct radeon_device *rdev); 227void radeon_fence_driver_fini(struct radeon_device *rdev);
228void radeon_fence_driver_force_completion(struct radeon_device *rdev);
228int radeon_fence_emit(struct radeon_device *rdev, struct radeon_fence **fence, int ring); 229int radeon_fence_emit(struct radeon_device *rdev, struct radeon_fence **fence, int ring);
229void radeon_fence_process(struct radeon_device *rdev, int ring); 230void radeon_fence_process(struct radeon_device *rdev, int ring);
230bool radeon_fence_signaled(struct radeon_fence *fence); 231bool radeon_fence_signaled(struct radeon_fence *fence);
231int radeon_fence_wait(struct radeon_fence *fence, bool interruptible); 232int radeon_fence_wait(struct radeon_fence *fence, bool interruptible);
232int radeon_fence_wait_next_locked(struct radeon_device *rdev, int ring); 233int radeon_fence_wait_next_locked(struct radeon_device *rdev, int ring);
233void radeon_fence_wait_empty_locked(struct radeon_device *rdev, int ring); 234int radeon_fence_wait_empty_locked(struct radeon_device *rdev, int ring);
234int radeon_fence_wait_any(struct radeon_device *rdev, 235int radeon_fence_wait_any(struct radeon_device *rdev,
235 struct radeon_fence **fences, 236 struct radeon_fence **fences,
236 bool intr); 237 bool intr);
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
index 49b06590001e..cd756262924d 100644
--- a/drivers/gpu/drm/radeon/radeon_device.c
+++ b/drivers/gpu/drm/radeon/radeon_device.c
@@ -1164,6 +1164,7 @@ int radeon_suspend_kms(struct drm_device *dev, pm_message_t state)
1164 struct drm_crtc *crtc; 1164 struct drm_crtc *crtc;
1165 struct drm_connector *connector; 1165 struct drm_connector *connector;
1166 int i, r; 1166 int i, r;
1167 bool force_completion = false;
1167 1168
1168 if (dev == NULL || dev->dev_private == NULL) { 1169 if (dev == NULL || dev->dev_private == NULL) {
1169 return -ENODEV; 1170 return -ENODEV;
@@ -1206,8 +1207,16 @@ int radeon_suspend_kms(struct drm_device *dev, pm_message_t state)
1206 1207
1207 mutex_lock(&rdev->ring_lock); 1208 mutex_lock(&rdev->ring_lock);
1208 /* wait for gpu to finish processing current batch */ 1209 /* wait for gpu to finish processing current batch */
1209 for (i = 0; i < RADEON_NUM_RINGS; i++) 1210 for (i = 0; i < RADEON_NUM_RINGS; i++) {
1210 radeon_fence_wait_empty_locked(rdev, i); 1211 r = radeon_fence_wait_empty_locked(rdev, i);
1212 if (r) {
1213 /* delay GPU reset to resume */
1214 force_completion = true;
1215 }
1216 }
1217 if (force_completion) {
1218 radeon_fence_driver_force_completion(rdev);
1219 }
1211 mutex_unlock(&rdev->ring_lock); 1220 mutex_unlock(&rdev->ring_lock);
1212 1221
1213 radeon_save_bios_scratch_regs(rdev); 1222 radeon_save_bios_scratch_regs(rdev);
@@ -1338,7 +1347,6 @@ retry:
1338 } 1347 }
1339 1348
1340 radeon_restore_bios_scratch_regs(rdev); 1349 radeon_restore_bios_scratch_regs(rdev);
1341 drm_helper_resume_force_mode(rdev->ddev);
1342 1350
1343 if (!r) { 1351 if (!r) {
1344 for (i = 0; i < RADEON_NUM_RINGS; ++i) { 1352 for (i = 0; i < RADEON_NUM_RINGS; ++i) {
@@ -1358,11 +1366,14 @@ retry:
1358 } 1366 }
1359 } 1367 }
1360 } else { 1368 } else {
1369 radeon_fence_driver_force_completion(rdev);
1361 for (i = 0; i < RADEON_NUM_RINGS; ++i) { 1370 for (i = 0; i < RADEON_NUM_RINGS; ++i) {
1362 kfree(ring_data[i]); 1371 kfree(ring_data[i]);
1363 } 1372 }
1364 } 1373 }
1365 1374
1375 drm_helper_resume_force_mode(rdev->ddev);
1376
1366 ttm_bo_unlock_delayed_workqueue(&rdev->mman.bdev, resched); 1377 ttm_bo_unlock_delayed_workqueue(&rdev->mman.bdev, resched);
1367 if (r) { 1378 if (r) {
1368 /* bad news, how to tell it to userspace ? */ 1379 /* bad news, how to tell it to userspace ? */
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
index 9b1a727d3c9e..ff7593498a74 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -68,9 +68,10 @@
68 * 2.25.0 - eg+: new info request for num SE and num SH 68 * 2.25.0 - eg+: new info request for num SE and num SH
69 * 2.26.0 - r600-eg: fix htile size computation 69 * 2.26.0 - r600-eg: fix htile size computation
70 * 2.27.0 - r600-SI: Add CS ioctl support for async DMA 70 * 2.27.0 - r600-SI: Add CS ioctl support for async DMA
71 * 2.28.0 - r600-eg: Add MEM_WRITE packet support
71 */ 72 */
72#define KMS_DRIVER_MAJOR 2 73#define KMS_DRIVER_MAJOR 2
73#define KMS_DRIVER_MINOR 27 74#define KMS_DRIVER_MINOR 28
74#define KMS_DRIVER_PATCHLEVEL 0 75#define KMS_DRIVER_PATCHLEVEL 0
75int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags); 76int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags);
76int radeon_driver_unload_kms(struct drm_device *dev); 77int radeon_driver_unload_kms(struct drm_device *dev);
diff --git a/drivers/gpu/drm/radeon/radeon_fence.c b/drivers/gpu/drm/radeon/radeon_fence.c
index 410a975a8eec..34356252567a 100644
--- a/drivers/gpu/drm/radeon/radeon_fence.c
+++ b/drivers/gpu/drm/radeon/radeon_fence.c
@@ -609,26 +609,20 @@ int radeon_fence_wait_next_locked(struct radeon_device *rdev, int ring)
609 * Returns 0 if the fences have passed, error for all other cases. 609 * Returns 0 if the fences have passed, error for all other cases.
610 * Caller must hold ring lock. 610 * Caller must hold ring lock.
611 */ 611 */
612void radeon_fence_wait_empty_locked(struct radeon_device *rdev, int ring) 612int radeon_fence_wait_empty_locked(struct radeon_device *rdev, int ring)
613{ 613{
614 uint64_t seq = rdev->fence_drv[ring].sync_seq[ring]; 614 uint64_t seq = rdev->fence_drv[ring].sync_seq[ring];
615 int r;
615 616
616 while(1) { 617 r = radeon_fence_wait_seq(rdev, seq, ring, false, false);
617 int r; 618 if (r) {
618 r = radeon_fence_wait_seq(rdev, seq, ring, false, false);
619 if (r == -EDEADLK) { 619 if (r == -EDEADLK) {
620 mutex_unlock(&rdev->ring_lock); 620 return -EDEADLK;
621 r = radeon_gpu_reset(rdev);
622 mutex_lock(&rdev->ring_lock);
623 if (!r)
624 continue;
625 }
626 if (r) {
627 dev_err(rdev->dev, "error waiting for ring to become"
628 " idle (%d)\n", r);
629 } 621 }
630 return; 622 dev_err(rdev->dev, "error waiting for ring[%d] to become idle (%d)\n",
623 ring, r);
631 } 624 }
625 return 0;
632} 626}
633 627
634/** 628/**
@@ -854,13 +848,17 @@ int radeon_fence_driver_init(struct radeon_device *rdev)
854 */ 848 */
855void radeon_fence_driver_fini(struct radeon_device *rdev) 849void radeon_fence_driver_fini(struct radeon_device *rdev)
856{ 850{
857 int ring; 851 int ring, r;
858 852
859 mutex_lock(&rdev->ring_lock); 853 mutex_lock(&rdev->ring_lock);
860 for (ring = 0; ring < RADEON_NUM_RINGS; ring++) { 854 for (ring = 0; ring < RADEON_NUM_RINGS; ring++) {
861 if (!rdev->fence_drv[ring].initialized) 855 if (!rdev->fence_drv[ring].initialized)
862 continue; 856 continue;
863 radeon_fence_wait_empty_locked(rdev, ring); 857 r = radeon_fence_wait_empty_locked(rdev, ring);
858 if (r) {
859 /* no need to trigger GPU reset as we are unloading */
860 radeon_fence_driver_force_completion(rdev);
861 }
864 wake_up_all(&rdev->fence_queue); 862 wake_up_all(&rdev->fence_queue);
865 radeon_scratch_free(rdev, rdev->fence_drv[ring].scratch_reg); 863 radeon_scratch_free(rdev, rdev->fence_drv[ring].scratch_reg);
866 rdev->fence_drv[ring].initialized = false; 864 rdev->fence_drv[ring].initialized = false;
@@ -868,6 +866,25 @@ void radeon_fence_driver_fini(struct radeon_device *rdev)
868 mutex_unlock(&rdev->ring_lock); 866 mutex_unlock(&rdev->ring_lock);
869} 867}
870 868
869/**
870 * radeon_fence_driver_force_completion - force all fence waiter to complete
871 *
872 * @rdev: radeon device pointer
873 *
874 * In case of GPU reset failure make sure no process keep waiting on fence
875 * that will never complete.
876 */
877void radeon_fence_driver_force_completion(struct radeon_device *rdev)
878{
879 int ring;
880
881 for (ring = 0; ring < RADEON_NUM_RINGS; ring++) {
882 if (!rdev->fence_drv[ring].initialized)
883 continue;
884 radeon_fence_write(rdev, rdev->fence_drv[ring].sync_seq[ring], ring);
885 }
886}
887
871 888
872/* 889/*
873 * Fence debugfs 890 * Fence debugfs
diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c
index aa14dbb7e4fb..0bfa656aa87d 100644
--- a/drivers/gpu/drm/radeon/radeon_pm.c
+++ b/drivers/gpu/drm/radeon/radeon_pm.c
@@ -234,7 +234,7 @@ static void radeon_set_power_state(struct radeon_device *rdev)
234 234
235static void radeon_pm_set_clocks(struct radeon_device *rdev) 235static void radeon_pm_set_clocks(struct radeon_device *rdev)
236{ 236{
237 int i; 237 int i, r;
238 238
239 /* no need to take locks, etc. if nothing's going to change */ 239 /* no need to take locks, etc. if nothing's going to change */
240 if ((rdev->pm.requested_clock_mode_index == rdev->pm.current_clock_mode_index) && 240 if ((rdev->pm.requested_clock_mode_index == rdev->pm.current_clock_mode_index) &&
@@ -248,8 +248,17 @@ static void radeon_pm_set_clocks(struct radeon_device *rdev)
248 /* wait for the rings to drain */ 248 /* wait for the rings to drain */
249 for (i = 0; i < RADEON_NUM_RINGS; i++) { 249 for (i = 0; i < RADEON_NUM_RINGS; i++) {
250 struct radeon_ring *ring = &rdev->ring[i]; 250 struct radeon_ring *ring = &rdev->ring[i];
251 if (ring->ready) 251 if (!ring->ready) {
252 radeon_fence_wait_empty_locked(rdev, i); 252 continue;
253 }
254 r = radeon_fence_wait_empty_locked(rdev, i);
255 if (r) {
256 /* needs a GPU reset dont reset here */
257 mutex_unlock(&rdev->ring_lock);
258 up_write(&rdev->pm.mclk_lock);
259 mutex_unlock(&rdev->ddev->struct_mutex);
260 return;
261 }
253 } 262 }
254 263
255 radeon_unmap_vram_bos(rdev); 264 radeon_unmap_vram_bos(rdev);
diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c
index 074410371e2a..656b2e3334a6 100644
--- a/drivers/gpu/drm/tegra/dc.c
+++ b/drivers/gpu/drm/tegra/dc.c
@@ -102,12 +102,12 @@ static int tegra_dc_set_timings(struct tegra_dc *dc,
102 ((mode->hsync_end - mode->hsync_start) << 0); 102 ((mode->hsync_end - mode->hsync_start) << 0);
103 tegra_dc_writel(dc, value, DC_DISP_SYNC_WIDTH); 103 tegra_dc_writel(dc, value, DC_DISP_SYNC_WIDTH);
104 104
105 value = ((mode->vsync_start - mode->vdisplay) << 16) |
106 ((mode->hsync_start - mode->hdisplay) << 0);
107 tegra_dc_writel(dc, value, DC_DISP_BACK_PORCH);
108
109 value = ((mode->vtotal - mode->vsync_end) << 16) | 105 value = ((mode->vtotal - mode->vsync_end) << 16) |
110 ((mode->htotal - mode->hsync_end) << 0); 106 ((mode->htotal - mode->hsync_end) << 0);
107 tegra_dc_writel(dc, value, DC_DISP_BACK_PORCH);
108
109 value = ((mode->vsync_start - mode->vdisplay) << 16) |
110 ((mode->hsync_start - mode->hdisplay) << 0);
111 tegra_dc_writel(dc, value, DC_DISP_FRONT_PORCH); 111 tegra_dc_writel(dc, value, DC_DISP_FRONT_PORCH);
112 112
113 value = (mode->vdisplay << 16) | mode->hdisplay; 113 value = (mode->vdisplay << 16) | mode->hdisplay;
@@ -221,8 +221,7 @@ static int tegra_crtc_mode_set(struct drm_crtc *crtc,
221 win.stride = crtc->fb->pitches[0]; 221 win.stride = crtc->fb->pitches[0];
222 222
223 /* program window registers */ 223 /* program window registers */
224 value = tegra_dc_readl(dc, DC_CMD_DISPLAY_WINDOW_HEADER); 224 value = WINDOW_A_SELECT;
225 value |= WINDOW_A_SELECT;
226 tegra_dc_writel(dc, value, DC_CMD_DISPLAY_WINDOW_HEADER); 225 tegra_dc_writel(dc, value, DC_CMD_DISPLAY_WINDOW_HEADER);
227 226
228 tegra_dc_writel(dc, win.fmt, DC_WIN_COLOR_DEPTH); 227 tegra_dc_writel(dc, win.fmt, DC_WIN_COLOR_DEPTH);
diff --git a/drivers/gpu/drm/tegra/drm.h b/drivers/gpu/drm/tegra/drm.h
index 3a843a77ddc7..741b5dc2742c 100644
--- a/drivers/gpu/drm/tegra/drm.h
+++ b/drivers/gpu/drm/tegra/drm.h
@@ -204,24 +204,6 @@ extern int tegra_output_parse_dt(struct tegra_output *output);
204extern int tegra_output_init(struct drm_device *drm, struct tegra_output *output); 204extern int tegra_output_init(struct drm_device *drm, struct tegra_output *output);
205extern int tegra_output_exit(struct tegra_output *output); 205extern int tegra_output_exit(struct tegra_output *output);
206 206
207/* from gem.c */
208extern struct tegra_gem_object *tegra_gem_alloc(struct drm_device *drm,
209 size_t size);
210extern int tegra_gem_handle_create(struct drm_device *drm,
211 struct drm_file *file, size_t size,
212 unsigned long flags, uint32_t *handle);
213extern int tegra_gem_dumb_create(struct drm_file *file, struct drm_device *drm,
214 struct drm_mode_create_dumb *args);
215extern int tegra_gem_dumb_map_offset(struct drm_file *file,
216 struct drm_device *drm, uint32_t handle,
217 uint64_t *offset);
218extern int tegra_gem_dumb_destroy(struct drm_file *file,
219 struct drm_device *drm, uint32_t handle);
220extern int tegra_drm_gem_mmap(struct file *filp, struct vm_area_struct *vma);
221extern int tegra_gem_init_object(struct drm_gem_object *obj);
222extern void tegra_gem_free_object(struct drm_gem_object *obj);
223extern struct vm_operations_struct tegra_gem_vm_ops;
224
225/* from fb.c */ 207/* from fb.c */
226extern int tegra_drm_fb_init(struct drm_device *drm); 208extern int tegra_drm_fb_init(struct drm_device *drm);
227extern void tegra_drm_fb_exit(struct drm_device *drm); 209extern void tegra_drm_fb_exit(struct drm_device *drm);
diff --git a/drivers/gpu/drm/tegra/hdmi.c b/drivers/gpu/drm/tegra/hdmi.c
index ab4016412bbf..e060c7e6434d 100644
--- a/drivers/gpu/drm/tegra/hdmi.c
+++ b/drivers/gpu/drm/tegra/hdmi.c
@@ -149,7 +149,7 @@ struct tmds_config {
149}; 149};
150 150
151static const struct tmds_config tegra2_tmds_config[] = { 151static const struct tmds_config tegra2_tmds_config[] = {
152 { /* 480p modes */ 152 { /* slow pixel clock modes */
153 .pclk = 27000000, 153 .pclk = 27000000,
154 .pll0 = SOR_PLL_BG_V17_S(3) | SOR_PLL_ICHPMP(1) | 154 .pll0 = SOR_PLL_BG_V17_S(3) | SOR_PLL_ICHPMP(1) |
155 SOR_PLL_RESISTORSEL | SOR_PLL_VCOCAP(0) | 155 SOR_PLL_RESISTORSEL | SOR_PLL_VCOCAP(0) |
@@ -163,21 +163,8 @@ static const struct tmds_config tegra2_tmds_config[] = {
163 DRIVE_CURRENT_LANE1(DRIVE_CURRENT_7_125_mA) | 163 DRIVE_CURRENT_LANE1(DRIVE_CURRENT_7_125_mA) |
164 DRIVE_CURRENT_LANE2(DRIVE_CURRENT_7_125_mA) | 164 DRIVE_CURRENT_LANE2(DRIVE_CURRENT_7_125_mA) |
165 DRIVE_CURRENT_LANE3(DRIVE_CURRENT_7_125_mA), 165 DRIVE_CURRENT_LANE3(DRIVE_CURRENT_7_125_mA),
166 }, { /* 720p modes */ 166 },
167 .pclk = 74250000, 167 { /* high pixel clock modes */
168 .pll0 = SOR_PLL_BG_V17_S(3) | SOR_PLL_ICHPMP(1) |
169 SOR_PLL_RESISTORSEL | SOR_PLL_VCOCAP(1) |
170 SOR_PLL_TX_REG_LOAD(3),
171 .pll1 = SOR_PLL_TMDS_TERM_ENABLE | SOR_PLL_PE_EN,
172 .pe_current = PE_CURRENT0(PE_CURRENT_6_0_mA) |
173 PE_CURRENT1(PE_CURRENT_6_0_mA) |
174 PE_CURRENT2(PE_CURRENT_6_0_mA) |
175 PE_CURRENT3(PE_CURRENT_6_0_mA),
176 .drive_current = DRIVE_CURRENT_LANE0(DRIVE_CURRENT_7_125_mA) |
177 DRIVE_CURRENT_LANE1(DRIVE_CURRENT_7_125_mA) |
178 DRIVE_CURRENT_LANE2(DRIVE_CURRENT_7_125_mA) |
179 DRIVE_CURRENT_LANE3(DRIVE_CURRENT_7_125_mA),
180 }, { /* 1080p modes */
181 .pclk = UINT_MAX, 168 .pclk = UINT_MAX,
182 .pll0 = SOR_PLL_BG_V17_S(3) | SOR_PLL_ICHPMP(1) | 169 .pll0 = SOR_PLL_BG_V17_S(3) | SOR_PLL_ICHPMP(1) |
183 SOR_PLL_RESISTORSEL | SOR_PLL_VCOCAP(1) | 170 SOR_PLL_RESISTORSEL | SOR_PLL_VCOCAP(1) |
@@ -479,7 +466,7 @@ static void tegra_hdmi_setup_avi_infoframe(struct tegra_hdmi *hdmi,
479 return; 466 return;
480 } 467 }
481 468
482 h_front_porch = mode->htotal - mode->hsync_end; 469 h_front_porch = mode->hsync_start - mode->hdisplay;
483 memset(&frame, 0, sizeof(frame)); 470 memset(&frame, 0, sizeof(frame));
484 frame.r = HDMI_AVI_R_SAME; 471 frame.r = HDMI_AVI_R_SAME;
485 472
@@ -634,8 +621,8 @@ static int tegra_output_hdmi_enable(struct tegra_output *output)
634 621
635 pclk = mode->clock * 1000; 622 pclk = mode->clock * 1000;
636 h_sync_width = mode->hsync_end - mode->hsync_start; 623 h_sync_width = mode->hsync_end - mode->hsync_start;
637 h_front_porch = mode->htotal - mode->hsync_end; 624 h_back_porch = mode->htotal - mode->hsync_end;
638 h_back_porch = mode->hsync_start - mode->hdisplay; 625 h_front_porch = mode->hsync_start - mode->hdisplay;
639 626
640 err = regulator_enable(hdmi->vdd); 627 err = regulator_enable(hdmi->vdd);
641 if (err < 0) { 628 if (err < 0) {
diff --git a/drivers/gpu/drm/tegra/host1x.c b/drivers/gpu/drm/tegra/host1x.c
index bdb97a564d82..5d17b113a6fc 100644
--- a/drivers/gpu/drm/tegra/host1x.c
+++ b/drivers/gpu/drm/tegra/host1x.c
@@ -239,6 +239,8 @@ int host1x_register_client(struct host1x *host1x, struct host1x_client *client)
239 } 239 }
240 } 240 }
241 241
242 client->host1x = host1x;
243
242 return 0; 244 return 0;
243} 245}
244 246
diff --git a/drivers/hwmon/emc6w201.c b/drivers/hwmon/emc6w201.c
index a98c917b5888..789bd4fb329b 100644
--- a/drivers/hwmon/emc6w201.c
+++ b/drivers/hwmon/emc6w201.c
@@ -187,7 +187,7 @@ static struct emc6w201_data *emc6w201_update_device(struct device *dev)
187 * Sysfs callback functions 187 * Sysfs callback functions
188 */ 188 */
189 189
190static const u16 nominal_mv[6] = { 2500, 1500, 3300, 5000, 1500, 1500 }; 190static const s16 nominal_mv[6] = { 2500, 1500, 3300, 5000, 1500, 1500 };
191 191
192static ssize_t show_in(struct device *dev, struct device_attribute *devattr, 192static ssize_t show_in(struct device *dev, struct device_attribute *devattr,
193 char *buf) 193 char *buf)
diff --git a/drivers/hwmon/lm73.c b/drivers/hwmon/lm73.c
index 8fa2632cbbaf..7272176a9ec7 100644
--- a/drivers/hwmon/lm73.c
+++ b/drivers/hwmon/lm73.c
@@ -49,6 +49,7 @@ static ssize_t set_temp(struct device *dev, struct device_attribute *da,
49 struct i2c_client *client = to_i2c_client(dev); 49 struct i2c_client *client = to_i2c_client(dev);
50 long temp; 50 long temp;
51 short value; 51 short value;
52 s32 err;
52 53
53 int status = kstrtol(buf, 10, &temp); 54 int status = kstrtol(buf, 10, &temp);
54 if (status < 0) 55 if (status < 0)
@@ -57,8 +58,8 @@ static ssize_t set_temp(struct device *dev, struct device_attribute *da,
57 /* Write value */ 58 /* Write value */
58 value = (short) SENSORS_LIMIT(temp/250, (LM73_TEMP_MIN*4), 59 value = (short) SENSORS_LIMIT(temp/250, (LM73_TEMP_MIN*4),
59 (LM73_TEMP_MAX*4)) << 5; 60 (LM73_TEMP_MAX*4)) << 5;
60 i2c_smbus_write_word_swapped(client, attr->index, value); 61 err = i2c_smbus_write_word_swapped(client, attr->index, value);
61 return count; 62 return (err < 0) ? err : count;
62} 63}
63 64
64static ssize_t show_temp(struct device *dev, struct device_attribute *da, 65static ssize_t show_temp(struct device *dev, struct device_attribute *da,
@@ -66,11 +67,16 @@ static ssize_t show_temp(struct device *dev, struct device_attribute *da,
66{ 67{
67 struct sensor_device_attribute *attr = to_sensor_dev_attr(da); 68 struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
68 struct i2c_client *client = to_i2c_client(dev); 69 struct i2c_client *client = to_i2c_client(dev);
70 int temp;
71
72 s32 err = i2c_smbus_read_word_swapped(client, attr->index);
73 if (err < 0)
74 return err;
75
69 /* use integer division instead of equivalent right shift to 76 /* use integer division instead of equivalent right shift to
70 guarantee arithmetic shift and preserve the sign */ 77 guarantee arithmetic shift and preserve the sign */
71 int temp = ((s16) (i2c_smbus_read_word_swapped(client, 78 temp = (((s16) err) * 250) / 32;
72 attr->index))*250) / 32; 79 return scnprintf(buf, PAGE_SIZE, "%d\n", temp);
73 return sprintf(buf, "%d\n", temp);
74} 80}
75 81
76 82
diff --git a/drivers/i2c/busses/i2c-ali1535.c b/drivers/i2c/busses/i2c-ali1535.c
index 125cd8e0ad25..3f491815e2c4 100644
--- a/drivers/i2c/busses/i2c-ali1535.c
+++ b/drivers/i2c/busses/i2c-ali1535.c
@@ -139,7 +139,7 @@ static unsigned short ali1535_offset;
139 Note the differences between kernels with the old PCI BIOS interface and 139 Note the differences between kernels with the old PCI BIOS interface and
140 newer kernels with the real PCI interface. In compat.h some things are 140 newer kernels with the real PCI interface. In compat.h some things are
141 defined to make the transition easier. */ 141 defined to make the transition easier. */
142static int __devinit ali1535_setup(struct pci_dev *dev) 142static int ali1535_setup(struct pci_dev *dev)
143{ 143{
144 int retval; 144 int retval;
145 unsigned char temp; 145 unsigned char temp;
@@ -502,7 +502,7 @@ static DEFINE_PCI_DEVICE_TABLE(ali1535_ids) = {
502 502
503MODULE_DEVICE_TABLE(pci, ali1535_ids); 503MODULE_DEVICE_TABLE(pci, ali1535_ids);
504 504
505static int __devinit ali1535_probe(struct pci_dev *dev, const struct pci_device_id *id) 505static int ali1535_probe(struct pci_dev *dev, const struct pci_device_id *id)
506{ 506{
507 if (ali1535_setup(dev)) { 507 if (ali1535_setup(dev)) {
508 dev_warn(&dev->dev, 508 dev_warn(&dev->dev,
@@ -518,7 +518,7 @@ static int __devinit ali1535_probe(struct pci_dev *dev, const struct pci_device_
518 return i2c_add_adapter(&ali1535_adapter); 518 return i2c_add_adapter(&ali1535_adapter);
519} 519}
520 520
521static void __devexit ali1535_remove(struct pci_dev *dev) 521static void ali1535_remove(struct pci_dev *dev)
522{ 522{
523 i2c_del_adapter(&ali1535_adapter); 523 i2c_del_adapter(&ali1535_adapter);
524 release_region(ali1535_smba, ALI1535_SMB_IOSIZE); 524 release_region(ali1535_smba, ALI1535_SMB_IOSIZE);
@@ -528,7 +528,7 @@ static struct pci_driver ali1535_driver = {
528 .name = "ali1535_smbus", 528 .name = "ali1535_smbus",
529 .id_table = ali1535_ids, 529 .id_table = ali1535_ids,
530 .probe = ali1535_probe, 530 .probe = ali1535_probe,
531 .remove = __devexit_p(ali1535_remove), 531 .remove = ali1535_remove,
532}; 532};
533 533
534module_pci_driver(ali1535_driver); 534module_pci_driver(ali1535_driver);
diff --git a/drivers/i2c/busses/i2c-ali1563.c b/drivers/i2c/busses/i2c-ali1563.c
index e02d9f86c6a0..84ccd9496a5e 100644
--- a/drivers/i2c/busses/i2c-ali1563.c
+++ b/drivers/i2c/busses/i2c-ali1563.c
@@ -326,7 +326,7 @@ static u32 ali1563_func(struct i2c_adapter * a)
326} 326}
327 327
328 328
329static int __devinit ali1563_setup(struct pci_dev * dev) 329static int ali1563_setup(struct pci_dev *dev)
330{ 330{
331 u16 ctrl; 331 u16 ctrl;
332 332
@@ -390,8 +390,8 @@ static struct i2c_adapter ali1563_adapter = {
390 .algo = &ali1563_algorithm, 390 .algo = &ali1563_algorithm,
391}; 391};
392 392
393static int __devinit ali1563_probe(struct pci_dev * dev, 393static int ali1563_probe(struct pci_dev *dev,
394 const struct pci_device_id * id_table) 394 const struct pci_device_id *id_table)
395{ 395{
396 int error; 396 int error;
397 397
@@ -411,7 +411,7 @@ exit:
411 return error; 411 return error;
412} 412}
413 413
414static void __devexit ali1563_remove(struct pci_dev * dev) 414static void ali1563_remove(struct pci_dev *dev)
415{ 415{
416 i2c_del_adapter(&ali1563_adapter); 416 i2c_del_adapter(&ali1563_adapter);
417 ali1563_shutdown(dev); 417 ali1563_shutdown(dev);
@@ -428,7 +428,7 @@ static struct pci_driver ali1563_pci_driver = {
428 .name = "ali1563_smbus", 428 .name = "ali1563_smbus",
429 .id_table = ali1563_id_table, 429 .id_table = ali1563_id_table,
430 .probe = ali1563_probe, 430 .probe = ali1563_probe,
431 .remove = __devexit_p(ali1563_remove), 431 .remove = ali1563_remove,
432}; 432};
433 433
434module_pci_driver(ali1563_pci_driver); 434module_pci_driver(ali1563_pci_driver);
diff --git a/drivers/i2c/busses/i2c-ali15x3.c b/drivers/i2c/busses/i2c-ali15x3.c
index ce8d26d053a5..26bcc6127cee 100644
--- a/drivers/i2c/busses/i2c-ali15x3.c
+++ b/drivers/i2c/busses/i2c-ali15x3.c
@@ -131,7 +131,7 @@ MODULE_PARM_DESC(force_addr,
131static struct pci_driver ali15x3_driver; 131static struct pci_driver ali15x3_driver;
132static unsigned short ali15x3_smba; 132static unsigned short ali15x3_smba;
133 133
134static int __devinit ali15x3_setup(struct pci_dev *ALI15X3_dev) 134static int ali15x3_setup(struct pci_dev *ALI15X3_dev)
135{ 135{
136 u16 a; 136 u16 a;
137 unsigned char temp; 137 unsigned char temp;
@@ -484,7 +484,7 @@ static DEFINE_PCI_DEVICE_TABLE(ali15x3_ids) = {
484 484
485MODULE_DEVICE_TABLE (pci, ali15x3_ids); 485MODULE_DEVICE_TABLE (pci, ali15x3_ids);
486 486
487static int __devinit ali15x3_probe(struct pci_dev *dev, const struct pci_device_id *id) 487static int ali15x3_probe(struct pci_dev *dev, const struct pci_device_id *id)
488{ 488{
489 if (ali15x3_setup(dev)) { 489 if (ali15x3_setup(dev)) {
490 dev_err(&dev->dev, 490 dev_err(&dev->dev,
@@ -500,7 +500,7 @@ static int __devinit ali15x3_probe(struct pci_dev *dev, const struct pci_device_
500 return i2c_add_adapter(&ali15x3_adapter); 500 return i2c_add_adapter(&ali15x3_adapter);
501} 501}
502 502
503static void __devexit ali15x3_remove(struct pci_dev *dev) 503static void ali15x3_remove(struct pci_dev *dev)
504{ 504{
505 i2c_del_adapter(&ali15x3_adapter); 505 i2c_del_adapter(&ali15x3_adapter);
506 release_region(ali15x3_smba, ALI15X3_SMB_IOSIZE); 506 release_region(ali15x3_smba, ALI15X3_SMB_IOSIZE);
@@ -510,7 +510,7 @@ static struct pci_driver ali15x3_driver = {
510 .name = "ali15x3_smbus", 510 .name = "ali15x3_smbus",
511 .id_table = ali15x3_ids, 511 .id_table = ali15x3_ids,
512 .probe = ali15x3_probe, 512 .probe = ali15x3_probe,
513 .remove = __devexit_p(ali15x3_remove), 513 .remove = ali15x3_remove,
514}; 514};
515 515
516module_pci_driver(ali15x3_driver); 516module_pci_driver(ali15x3_driver);
diff --git a/drivers/i2c/busses/i2c-amd756.c b/drivers/i2c/busses/i2c-amd756.c
index 304aa03b57b2..e13e2aa2d05d 100644
--- a/drivers/i2c/busses/i2c-amd756.c
+++ b/drivers/i2c/busses/i2c-amd756.c
@@ -324,8 +324,7 @@ static DEFINE_PCI_DEVICE_TABLE(amd756_ids) = {
324 324
325MODULE_DEVICE_TABLE (pci, amd756_ids); 325MODULE_DEVICE_TABLE (pci, amd756_ids);
326 326
327static int __devinit amd756_probe(struct pci_dev *pdev, 327static int amd756_probe(struct pci_dev *pdev, const struct pci_device_id *id)
328 const struct pci_device_id *id)
329{ 328{
330 int nforce = (id->driver_data == NFORCE); 329 int nforce = (id->driver_data == NFORCE);
331 int error; 330 int error;
@@ -397,7 +396,7 @@ static int __devinit amd756_probe(struct pci_dev *pdev,
397 return error; 396 return error;
398} 397}
399 398
400static void __devexit amd756_remove(struct pci_dev *dev) 399static void amd756_remove(struct pci_dev *dev)
401{ 400{
402 i2c_del_adapter(&amd756_smbus); 401 i2c_del_adapter(&amd756_smbus);
403 release_region(amd756_ioport, SMB_IOSIZE); 402 release_region(amd756_ioport, SMB_IOSIZE);
@@ -407,7 +406,7 @@ static struct pci_driver amd756_driver = {
407 .name = "amd756_smbus", 406 .name = "amd756_smbus",
408 .id_table = amd756_ids, 407 .id_table = amd756_ids,
409 .probe = amd756_probe, 408 .probe = amd756_probe,
410 .remove = __devexit_p(amd756_remove), 409 .remove = amd756_remove,
411}; 410};
412 411
413module_pci_driver(amd756_driver); 412module_pci_driver(amd756_driver);
diff --git a/drivers/i2c/busses/i2c-amd8111.c b/drivers/i2c/busses/i2c-amd8111.c
index 0919ac1d99aa..a44e6e77c5a1 100644
--- a/drivers/i2c/busses/i2c-amd8111.c
+++ b/drivers/i2c/busses/i2c-amd8111.c
@@ -422,8 +422,7 @@ static DEFINE_PCI_DEVICE_TABLE(amd8111_ids) = {
422 422
423MODULE_DEVICE_TABLE (pci, amd8111_ids); 423MODULE_DEVICE_TABLE (pci, amd8111_ids);
424 424
425static int __devinit amd8111_probe(struct pci_dev *dev, 425static int amd8111_probe(struct pci_dev *dev, const struct pci_device_id *id)
426 const struct pci_device_id *id)
427{ 426{
428 struct amd_smbus *smbus; 427 struct amd_smbus *smbus;
429 int error; 428 int error;
@@ -475,7 +474,7 @@ static int __devinit amd8111_probe(struct pci_dev *dev,
475 return error; 474 return error;
476} 475}
477 476
478static void __devexit amd8111_remove(struct pci_dev *dev) 477static void amd8111_remove(struct pci_dev *dev)
479{ 478{
480 struct amd_smbus *smbus = pci_get_drvdata(dev); 479 struct amd_smbus *smbus = pci_get_drvdata(dev);
481 480
@@ -488,7 +487,7 @@ static struct pci_driver amd8111_driver = {
488 .name = "amd8111_smbus2", 487 .name = "amd8111_smbus2",
489 .id_table = amd8111_ids, 488 .id_table = amd8111_ids,
490 .probe = amd8111_probe, 489 .probe = amd8111_probe,
491 .remove = __devexit_p(amd8111_remove), 490 .remove = amd8111_remove,
492}; 491};
493 492
494module_pci_driver(amd8111_driver); 493module_pci_driver(amd8111_driver);
diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c
index b4575ee4bdf3..2bfc04d0a1b1 100644
--- a/drivers/i2c/busses/i2c-at91.c
+++ b/drivers/i2c/busses/i2c-at91.c
@@ -145,7 +145,7 @@ static void at91_init_twi_bus(struct at91_twi_dev *dev)
145 * Calculate symmetric clock as stated in datasheet: 145 * Calculate symmetric clock as stated in datasheet:
146 * twi_clk = F_MAIN / (2 * (cdiv * (1 << ckdiv) + offset)) 146 * twi_clk = F_MAIN / (2 * (cdiv * (1 << ckdiv) + offset))
147 */ 147 */
148static void __devinit at91_calc_twi_clock(struct at91_twi_dev *dev, int twi_clk) 148static void at91_calc_twi_clock(struct at91_twi_dev *dev, int twi_clk)
149{ 149{
150 int ckdiv, cdiv, div; 150 int ckdiv, cdiv, div;
151 struct at91_twi_pdata *pdata = dev->pdata; 151 struct at91_twi_pdata *pdata = dev->pdata;
@@ -604,7 +604,7 @@ MODULE_DEVICE_TABLE(of, atmel_twi_dt_ids);
604#define atmel_twi_dt_ids NULL 604#define atmel_twi_dt_ids NULL
605#endif 605#endif
606 606
607static bool __devinit filter(struct dma_chan *chan, void *slave) 607static bool filter(struct dma_chan *chan, void *slave)
608{ 608{
609 struct at_dma_slave *sl = slave; 609 struct at_dma_slave *sl = slave;
610 610
@@ -616,7 +616,7 @@ static bool __devinit filter(struct dma_chan *chan, void *slave)
616 } 616 }
617} 617}
618 618
619static int __devinit at91_twi_configure_dma(struct at91_twi_dev *dev, u32 phy_addr) 619static int at91_twi_configure_dma(struct at91_twi_dev *dev, u32 phy_addr)
620{ 620{
621 int ret = 0; 621 int ret = 0;
622 struct at_dma_slave *sdata; 622 struct at_dma_slave *sdata;
@@ -688,7 +688,7 @@ error:
688 return ret; 688 return ret;
689} 689}
690 690
691static struct at91_twi_pdata * __devinit at91_twi_get_driver_data( 691static struct at91_twi_pdata *at91_twi_get_driver_data(
692 struct platform_device *pdev) 692 struct platform_device *pdev)
693{ 693{
694 if (pdev->dev.of_node) { 694 if (pdev->dev.of_node) {
@@ -701,7 +701,7 @@ static struct at91_twi_pdata * __devinit at91_twi_get_driver_data(
701 return (struct at91_twi_pdata *) platform_get_device_id(pdev)->driver_data; 701 return (struct at91_twi_pdata *) platform_get_device_id(pdev)->driver_data;
702} 702}
703 703
704static int __devinit at91_twi_probe(struct platform_device *pdev) 704static int at91_twi_probe(struct platform_device *pdev)
705{ 705{
706 struct at91_twi_dev *dev; 706 struct at91_twi_dev *dev;
707 struct resource *mem; 707 struct resource *mem;
@@ -779,7 +779,7 @@ static int __devinit at91_twi_probe(struct platform_device *pdev)
779 return 0; 779 return 0;
780} 780}
781 781
782static int __devexit at91_twi_remove(struct platform_device *pdev) 782static int at91_twi_remove(struct platform_device *pdev)
783{ 783{
784 struct at91_twi_dev *dev = platform_get_drvdata(pdev); 784 struct at91_twi_dev *dev = platform_get_drvdata(pdev);
785 int rc; 785 int rc;
@@ -820,7 +820,7 @@ static const struct dev_pm_ops at91_twi_pm = {
820 820
821static struct platform_driver at91_twi_driver = { 821static struct platform_driver at91_twi_driver = {
822 .probe = at91_twi_probe, 822 .probe = at91_twi_probe,
823 .remove = __devexit_p(at91_twi_remove), 823 .remove = at91_twi_remove,
824 .id_table = at91_twi_devtypes, 824 .id_table = at91_twi_devtypes,
825 .driver = { 825 .driver = {
826 .name = "at91_i2c", 826 .name = "at91_i2c",
diff --git a/drivers/i2c/busses/i2c-au1550.c b/drivers/i2c/busses/i2c-au1550.c
index 582d616db346..b278298787d7 100644
--- a/drivers/i2c/busses/i2c-au1550.c
+++ b/drivers/i2c/busses/i2c-au1550.c
@@ -313,7 +313,7 @@ static void i2c_au1550_disable(struct i2c_au1550_data *priv)
313 * Prior to calling us, the 50MHz clock frequency and routing 313 * Prior to calling us, the 50MHz clock frequency and routing
314 * must have been set up for the PSC indicated by the adapter. 314 * must have been set up for the PSC indicated by the adapter.
315 */ 315 */
316static int __devinit 316static int
317i2c_au1550_probe(struct platform_device *pdev) 317i2c_au1550_probe(struct platform_device *pdev)
318{ 318{
319 struct i2c_au1550_data *priv; 319 struct i2c_au1550_data *priv;
@@ -372,7 +372,7 @@ out:
372 return ret; 372 return ret;
373} 373}
374 374
375static int __devexit i2c_au1550_remove(struct platform_device *pdev) 375static int i2c_au1550_remove(struct platform_device *pdev)
376{ 376{
377 struct i2c_au1550_data *priv = platform_get_drvdata(pdev); 377 struct i2c_au1550_data *priv = platform_get_drvdata(pdev);
378 378
@@ -423,7 +423,7 @@ static struct platform_driver au1xpsc_smbus_driver = {
423 .pm = AU1XPSC_SMBUS_PMOPS, 423 .pm = AU1XPSC_SMBUS_PMOPS,
424 }, 424 },
425 .probe = i2c_au1550_probe, 425 .probe = i2c_au1550_probe,
426 .remove = __devexit_p(i2c_au1550_remove), 426 .remove = i2c_au1550_remove,
427}; 427};
428 428
429module_platform_driver(au1xpsc_smbus_driver); 429module_platform_driver(au1xpsc_smbus_driver);
diff --git a/drivers/i2c/busses/i2c-cpm.c b/drivers/i2c/busses/i2c-cpm.c
index c1e1096ba069..2e79c1024191 100644
--- a/drivers/i2c/busses/i2c-cpm.c
+++ b/drivers/i2c/busses/i2c-cpm.c
@@ -426,7 +426,7 @@ static const struct i2c_adapter cpm_ops = {
426 .algo = &cpm_i2c_algo, 426 .algo = &cpm_i2c_algo,
427}; 427};
428 428
429static int __devinit cpm_i2c_setup(struct cpm_i2c *cpm) 429static int cpm_i2c_setup(struct cpm_i2c *cpm)
430{ 430{
431 struct platform_device *ofdev = cpm->ofdev; 431 struct platform_device *ofdev = cpm->ofdev;
432 const u32 *data; 432 const u32 *data;
@@ -634,7 +634,7 @@ static void cpm_i2c_shutdown(struct cpm_i2c *cpm)
634 cpm_muram_free(cpm->i2c_addr); 634 cpm_muram_free(cpm->i2c_addr);
635} 635}
636 636
637static int __devinit cpm_i2c_probe(struct platform_device *ofdev) 637static int cpm_i2c_probe(struct platform_device *ofdev)
638{ 638{
639 int result, len; 639 int result, len;
640 struct cpm_i2c *cpm; 640 struct cpm_i2c *cpm;
@@ -688,7 +688,7 @@ out_free:
688 return result; 688 return result;
689} 689}
690 690
691static int __devexit cpm_i2c_remove(struct platform_device *ofdev) 691static int cpm_i2c_remove(struct platform_device *ofdev)
692{ 692{
693 struct cpm_i2c *cpm = dev_get_drvdata(&ofdev->dev); 693 struct cpm_i2c *cpm = dev_get_drvdata(&ofdev->dev);
694 694
@@ -716,7 +716,7 @@ MODULE_DEVICE_TABLE(of, cpm_i2c_match);
716 716
717static struct platform_driver cpm_i2c_driver = { 717static struct platform_driver cpm_i2c_driver = {
718 .probe = cpm_i2c_probe, 718 .probe = cpm_i2c_probe,
719 .remove = __devexit_p(cpm_i2c_remove), 719 .remove = cpm_i2c_remove,
720 .driver = { 720 .driver = {
721 .name = "fsl-i2c-cpm", 721 .name = "fsl-i2c-cpm",
722 .owner = THIS_MODULE, 722 .owner = THIS_MODULE,
diff --git a/drivers/i2c/busses/i2c-designware-pcidrv.c b/drivers/i2c/busses/i2c-designware-pcidrv.c
index 92a1e2c15baa..6add851e9dee 100644
--- a/drivers/i2c/busses/i2c-designware-pcidrv.c
+++ b/drivers/i2c/busses/i2c-designware-pcidrv.c
@@ -207,7 +207,7 @@ static u32 i2c_dw_get_clk_rate_khz(struct dw_i2c_dev *dev)
207 return dev->controller->clk_khz; 207 return dev->controller->clk_khz;
208} 208}
209 209
210static int __devinit i2c_dw_pci_probe(struct pci_dev *pdev, 210static int i2c_dw_pci_probe(struct pci_dev *pdev,
211const struct pci_device_id *id) 211const struct pci_device_id *id)
212{ 212{
213 struct dw_i2c_dev *dev; 213 struct dw_i2c_dev *dev;
@@ -328,7 +328,7 @@ exit:
328 return r; 328 return r;
329} 329}
330 330
331static void __devexit i2c_dw_pci_remove(struct pci_dev *pdev) 331static void i2c_dw_pci_remove(struct pci_dev *pdev)
332{ 332{
333 struct dw_i2c_dev *dev = pci_get_drvdata(pdev); 333 struct dw_i2c_dev *dev = pci_get_drvdata(pdev);
334 334
@@ -368,7 +368,7 @@ static struct pci_driver dw_i2c_driver = {
368 .name = DRIVER_NAME, 368 .name = DRIVER_NAME,
369 .id_table = i2_designware_pci_ids, 369 .id_table = i2_designware_pci_ids,
370 .probe = i2c_dw_pci_probe, 370 .probe = i2c_dw_pci_probe,
371 .remove = __devexit_p(i2c_dw_pci_remove), 371 .remove = i2c_dw_pci_remove,
372 .driver = { 372 .driver = {
373 .pm = &i2c_dw_pm_ops, 373 .pm = &i2c_dw_pm_ops,
374 }, 374 },
diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index 0506fef8dc00..343357a2b5b4 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -50,7 +50,7 @@ static u32 i2c_dw_get_clk_rate_khz(struct dw_i2c_dev *dev)
50 return clk_get_rate(dev->clk)/1000; 50 return clk_get_rate(dev->clk)/1000;
51} 51}
52 52
53static int __devinit dw_i2c_probe(struct platform_device *pdev) 53static int dw_i2c_probe(struct platform_device *pdev)
54{ 54{
55 struct dw_i2c_dev *dev; 55 struct dw_i2c_dev *dev;
56 struct i2c_adapter *adap; 56 struct i2c_adapter *adap;
@@ -169,7 +169,7 @@ err_release_region:
169 return r; 169 return r;
170} 170}
171 171
172static int __devexit dw_i2c_remove(struct platform_device *pdev) 172static int dw_i2c_remove(struct platform_device *pdev)
173{ 173{
174 struct dw_i2c_dev *dev = platform_get_drvdata(pdev); 174 struct dw_i2c_dev *dev = platform_get_drvdata(pdev);
175 struct resource *mem; 175 struct resource *mem;
@@ -228,7 +228,7 @@ static SIMPLE_DEV_PM_OPS(dw_i2c_dev_pm_ops, dw_i2c_suspend, dw_i2c_resume);
228MODULE_ALIAS("platform:i2c_designware"); 228MODULE_ALIAS("platform:i2c_designware");
229 229
230static struct platform_driver dw_i2c_driver = { 230static struct platform_driver dw_i2c_driver = {
231 .remove = __devexit_p(dw_i2c_remove), 231 .remove = dw_i2c_remove,
232 .driver = { 232 .driver = {
233 .name = "i2c_designware", 233 .name = "i2c_designware",
234 .owner = THIS_MODULE, 234 .owner = THIS_MODULE,
diff --git a/drivers/i2c/busses/i2c-eg20t.c b/drivers/i2c/busses/i2c-eg20t.c
index 259f7697bf25..5e7886e7136e 100644
--- a/drivers/i2c/busses/i2c-eg20t.c
+++ b/drivers/i2c/busses/i2c-eg20t.c
@@ -758,7 +758,7 @@ static void pch_i2c_disbl_int(struct i2c_algo_pch_data *adap)
758 iowrite32(BUFFER_MODE_INTR_DISBL, p + PCH_I2CBUFMSK); 758 iowrite32(BUFFER_MODE_INTR_DISBL, p + PCH_I2CBUFMSK);
759} 759}
760 760
761static int __devinit pch_i2c_probe(struct pci_dev *pdev, 761static int pch_i2c_probe(struct pci_dev *pdev,
762 const struct pci_device_id *id) 762 const struct pci_device_id *id)
763{ 763{
764 void __iomem *base_addr; 764 void __iomem *base_addr;
@@ -851,7 +851,7 @@ err_pci_enable:
851 return ret; 851 return ret;
852} 852}
853 853
854static void __devexit pch_i2c_remove(struct pci_dev *pdev) 854static void pch_i2c_remove(struct pci_dev *pdev)
855{ 855{
856 int i; 856 int i;
857 struct adapter_info *adap_info = pci_get_drvdata(pdev); 857 struct adapter_info *adap_info = pci_get_drvdata(pdev);
@@ -948,7 +948,7 @@ static struct pci_driver pch_pcidriver = {
948 .name = KBUILD_MODNAME, 948 .name = KBUILD_MODNAME,
949 .id_table = pch_pcidev_id, 949 .id_table = pch_pcidev_id,
950 .probe = pch_i2c_probe, 950 .probe = pch_i2c_probe,
951 .remove = __devexit_p(pch_i2c_remove), 951 .remove = pch_i2c_remove,
952 .suspend = pch_i2c_suspend, 952 .suspend = pch_i2c_suspend,
953 .resume = pch_i2c_resume 953 .resume = pch_i2c_resume
954}; 954};
diff --git a/drivers/i2c/busses/i2c-elektor.c b/drivers/i2c/busses/i2c-elektor.c
index 37e2e82a9c88..485497066ed7 100644
--- a/drivers/i2c/busses/i2c-elektor.c
+++ b/drivers/i2c/busses/i2c-elektor.c
@@ -205,7 +205,7 @@ static struct i2c_adapter pcf_isa_ops = {
205 .name = "i2c-elektor", 205 .name = "i2c-elektor",
206}; 206};
207 207
208static int __devinit elektor_match(struct device *dev, unsigned int id) 208static int elektor_match(struct device *dev, unsigned int id)
209{ 209{
210#ifdef __alpha__ 210#ifdef __alpha__
211 /* check to see we have memory mapped PCF8584 connected to the 211 /* check to see we have memory mapped PCF8584 connected to the
@@ -264,7 +264,7 @@ static int __devinit elektor_match(struct device *dev, unsigned int id)
264 return 1; 264 return 1;
265} 265}
266 266
267static int __devinit elektor_probe(struct device *dev, unsigned int id) 267static int elektor_probe(struct device *dev, unsigned int id)
268{ 268{
269 init_waitqueue_head(&pcf_wait); 269 init_waitqueue_head(&pcf_wait);
270 if (pcf_isa_init()) 270 if (pcf_isa_init())
@@ -293,7 +293,7 @@ static int __devinit elektor_probe(struct device *dev, unsigned int id)
293 return -ENODEV; 293 return -ENODEV;
294} 294}
295 295
296static int __devexit elektor_remove(struct device *dev, unsigned int id) 296static int elektor_remove(struct device *dev, unsigned int id)
297{ 297{
298 i2c_del_adapter(&pcf_isa_ops); 298 i2c_del_adapter(&pcf_isa_ops);
299 299
@@ -316,7 +316,7 @@ static int __devexit elektor_remove(struct device *dev, unsigned int id)
316static struct isa_driver i2c_elektor_driver = { 316static struct isa_driver i2c_elektor_driver = {
317 .match = elektor_match, 317 .match = elektor_match,
318 .probe = elektor_probe, 318 .probe = elektor_probe,
319 .remove = __devexit_p(elektor_remove), 319 .remove = elektor_remove,
320 .driver = { 320 .driver = {
321 .owner = THIS_MODULE, 321 .owner = THIS_MODULE,
322 .name = "i2c-elektor", 322 .name = "i2c-elektor",
diff --git a/drivers/i2c/busses/i2c-gpio.c b/drivers/i2c/busses/i2c-gpio.c
index 257299a92df3..f3fa4332bbdf 100644
--- a/drivers/i2c/busses/i2c-gpio.c
+++ b/drivers/i2c/busses/i2c-gpio.c
@@ -85,7 +85,7 @@ static int i2c_gpio_getscl(void *data)
85 return gpio_get_value(pdata->scl_pin); 85 return gpio_get_value(pdata->scl_pin);
86} 86}
87 87
88static int __devinit of_i2c_gpio_probe(struct device_node *np, 88static int of_i2c_gpio_probe(struct device_node *np,
89 struct i2c_gpio_platform_data *pdata) 89 struct i2c_gpio_platform_data *pdata)
90{ 90{
91 u32 reg; 91 u32 reg;
@@ -117,7 +117,7 @@ static int __devinit of_i2c_gpio_probe(struct device_node *np,
117 return 0; 117 return 0;
118} 118}
119 119
120static int __devinit i2c_gpio_probe(struct platform_device *pdev) 120static int i2c_gpio_probe(struct platform_device *pdev)
121{ 121{
122 struct i2c_gpio_private_data *priv; 122 struct i2c_gpio_private_data *priv;
123 struct i2c_gpio_platform_data *pdata; 123 struct i2c_gpio_platform_data *pdata;
@@ -218,7 +218,7 @@ err_request_sda:
218 return ret; 218 return ret;
219} 219}
220 220
221static int __devexit i2c_gpio_remove(struct platform_device *pdev) 221static int i2c_gpio_remove(struct platform_device *pdev)
222{ 222{
223 struct i2c_gpio_private_data *priv; 223 struct i2c_gpio_private_data *priv;
224 struct i2c_gpio_platform_data *pdata; 224 struct i2c_gpio_platform_data *pdata;
@@ -251,7 +251,7 @@ static struct platform_driver i2c_gpio_driver = {
251 .of_match_table = of_match_ptr(i2c_gpio_dt_ids), 251 .of_match_table = of_match_ptr(i2c_gpio_dt_ids),
252 }, 252 },
253 .probe = i2c_gpio_probe, 253 .probe = i2c_gpio_probe,
254 .remove = __devexit_p(i2c_gpio_remove), 254 .remove = i2c_gpio_remove,
255}; 255};
256 256
257static int __init i2c_gpio_init(void) 257static int __init i2c_gpio_init(void)
diff --git a/drivers/i2c/busses/i2c-highlander.c b/drivers/i2c/busses/i2c-highlander.c
index 19515df61021..3351cc7ed11f 100644
--- a/drivers/i2c/busses/i2c-highlander.c
+++ b/drivers/i2c/busses/i2c-highlander.c
@@ -356,7 +356,7 @@ static const struct i2c_algorithm highlander_i2c_algo = {
356 .functionality = highlander_i2c_func, 356 .functionality = highlander_i2c_func,
357}; 357};
358 358
359static int __devinit highlander_i2c_probe(struct platform_device *pdev) 359static int highlander_i2c_probe(struct platform_device *pdev)
360{ 360{
361 struct highlander_i2c_dev *dev; 361 struct highlander_i2c_dev *dev;
362 struct i2c_adapter *adap; 362 struct i2c_adapter *adap;
@@ -441,7 +441,7 @@ err:
441 return ret; 441 return ret;
442} 442}
443 443
444static int __devexit highlander_i2c_remove(struct platform_device *pdev) 444static int highlander_i2c_remove(struct platform_device *pdev)
445{ 445{
446 struct highlander_i2c_dev *dev = platform_get_drvdata(pdev); 446 struct highlander_i2c_dev *dev = platform_get_drvdata(pdev);
447 447
@@ -465,7 +465,7 @@ static struct platform_driver highlander_i2c_driver = {
465 }, 465 },
466 466
467 .probe = highlander_i2c_probe, 467 .probe = highlander_i2c_probe,
468 .remove = __devexit_p(highlander_i2c_remove), 468 .remove = highlander_i2c_remove,
469}; 469};
470 470
471module_platform_driver(highlander_i2c_driver); 471module_platform_driver(highlander_i2c_driver);
diff --git a/drivers/i2c/busses/i2c-hydra.c b/drivers/i2c/busses/i2c-hydra.c
index c9f95e1666a8..79c3d9069a48 100644
--- a/drivers/i2c/busses/i2c-hydra.c
+++ b/drivers/i2c/busses/i2c-hydra.c
@@ -112,7 +112,7 @@ static DEFINE_PCI_DEVICE_TABLE(hydra_ids) = {
112 112
113MODULE_DEVICE_TABLE (pci, hydra_ids); 113MODULE_DEVICE_TABLE (pci, hydra_ids);
114 114
115static int __devinit hydra_probe(struct pci_dev *dev, 115static int hydra_probe(struct pci_dev *dev,
116 const struct pci_device_id *id) 116 const struct pci_device_id *id)
117{ 117{
118 unsigned long base = pci_resource_start(dev, 0); 118 unsigned long base = pci_resource_start(dev, 0);
@@ -139,7 +139,7 @@ static int __devinit hydra_probe(struct pci_dev *dev,
139 return 0; 139 return 0;
140} 140}
141 141
142static void __devexit hydra_remove(struct pci_dev *dev) 142static void hydra_remove(struct pci_dev *dev)
143{ 143{
144 pdregw(hydra_bit_data.data, 0); /* clear SCLK_OE and SDAT_OE */ 144 pdregw(hydra_bit_data.data, 0); /* clear SCLK_OE and SDAT_OE */
145 i2c_del_adapter(&hydra_adap); 145 i2c_del_adapter(&hydra_adap);
@@ -153,7 +153,7 @@ static struct pci_driver hydra_driver = {
153 .name = "hydra_smbus", 153 .name = "hydra_smbus",
154 .id_table = hydra_ids, 154 .id_table = hydra_ids,
155 .probe = hydra_probe, 155 .probe = hydra_probe,
156 .remove = __devexit_p(hydra_remove), 156 .remove = hydra_remove,
157}; 157};
158 158
159module_pci_driver(hydra_driver); 159module_pci_driver(hydra_driver);
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
index 1e73638225e1..3092387f6ef4 100644
--- a/drivers/i2c/busses/i2c-i801.c
+++ b/drivers/i2c/busses/i2c-i801.c
@@ -841,14 +841,14 @@ struct dmi_onboard_device_info {
841 const char *i2c_type; 841 const char *i2c_type;
842}; 842};
843 843
844static struct dmi_onboard_device_info __devinitdata dmi_devices[] = { 844static const struct dmi_onboard_device_info dmi_devices[] = {
845 { "Syleus", DMI_DEV_TYPE_OTHER, 0x73, "fscsyl" }, 845 { "Syleus", DMI_DEV_TYPE_OTHER, 0x73, "fscsyl" },
846 { "Hermes", DMI_DEV_TYPE_OTHER, 0x73, "fscher" }, 846 { "Hermes", DMI_DEV_TYPE_OTHER, 0x73, "fscher" },
847 { "Hades", DMI_DEV_TYPE_OTHER, 0x73, "fschds" }, 847 { "Hades", DMI_DEV_TYPE_OTHER, 0x73, "fschds" },
848}; 848};
849 849
850static void __devinit dmi_check_onboard_device(u8 type, const char *name, 850static void dmi_check_onboard_device(u8 type, const char *name,
851 struct i2c_adapter *adap) 851 struct i2c_adapter *adap)
852{ 852{
853 int i; 853 int i;
854 struct i2c_board_info info; 854 struct i2c_board_info info;
@@ -871,8 +871,7 @@ static void __devinit dmi_check_onboard_device(u8 type, const char *name,
871/* We use our own function to check for onboard devices instead of 871/* We use our own function to check for onboard devices instead of
872 dmi_find_device() as some buggy BIOS's have the devices we are interested 872 dmi_find_device() as some buggy BIOS's have the devices we are interested
873 in marked as disabled */ 873 in marked as disabled */
874static void __devinit dmi_check_onboard_devices(const struct dmi_header *dm, 874static void dmi_check_onboard_devices(const struct dmi_header *dm, void *adap)
875 void *adap)
876{ 875{
877 int i, count; 876 int i, count;
878 877
@@ -901,7 +900,7 @@ static void __devinit dmi_check_onboard_devices(const struct dmi_header *dm,
901} 900}
902 901
903/* Register optional slaves */ 902/* Register optional slaves */
904static void __devinit i801_probe_optional_slaves(struct i801_priv *priv) 903static void i801_probe_optional_slaves(struct i801_priv *priv)
905{ 904{
906 /* Only register slaves on main SMBus channel */ 905 /* Only register slaves on main SMBus channel */
907 if (priv->features & FEATURE_IDF) 906 if (priv->features & FEATURE_IDF)
@@ -921,7 +920,7 @@ static void __devinit i801_probe_optional_slaves(struct i801_priv *priv)
921} 920}
922#else 921#else
923static void __init input_apanel_init(void) {} 922static void __init input_apanel_init(void) {}
924static void __devinit i801_probe_optional_slaves(struct i801_priv *priv) {} 923static void i801_probe_optional_slaves(struct i801_priv *priv) {}
925#endif /* CONFIG_X86 && CONFIG_DMI */ 924#endif /* CONFIG_X86 && CONFIG_DMI */
926 925
927#if (defined CONFIG_I2C_MUX_GPIO || defined CONFIG_I2C_MUX_GPIO_MODULE) && \ 926#if (defined CONFIG_I2C_MUX_GPIO || defined CONFIG_I2C_MUX_GPIO_MODULE) && \
@@ -944,7 +943,7 @@ static struct i801_mux_config i801_mux_config_asus_z8_d18 = {
944 .n_gpios = 2, 943 .n_gpios = 2,
945}; 944};
946 945
947static struct dmi_system_id __devinitdata mux_dmi_table[] = { 946static const struct dmi_system_id mux_dmi_table[] = {
948 { 947 {
949 .matches = { 948 .matches = {
950 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."), 949 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
@@ -1012,7 +1011,7 @@ static struct dmi_system_id __devinitdata mux_dmi_table[] = {
1012}; 1011};
1013 1012
1014/* Setup multiplexing if needed */ 1013/* Setup multiplexing if needed */
1015static int __devinit i801_add_mux(struct i801_priv *priv) 1014static int i801_add_mux(struct i801_priv *priv)
1016{ 1015{
1017 struct device *dev = &priv->adapter.dev; 1016 struct device *dev = &priv->adapter.dev;
1018 const struct i801_mux_config *mux_config; 1017 const struct i801_mux_config *mux_config;
@@ -1048,13 +1047,13 @@ static int __devinit i801_add_mux(struct i801_priv *priv)
1048 return 0; 1047 return 0;
1049} 1048}
1050 1049
1051static void __devexit i801_del_mux(struct i801_priv *priv) 1050static void i801_del_mux(struct i801_priv *priv)
1052{ 1051{
1053 if (priv->mux_pdev) 1052 if (priv->mux_pdev)
1054 platform_device_unregister(priv->mux_pdev); 1053 platform_device_unregister(priv->mux_pdev);
1055} 1054}
1056 1055
1057static unsigned int __devinit i801_get_adapter_class(struct i801_priv *priv) 1056static unsigned int i801_get_adapter_class(struct i801_priv *priv)
1058{ 1057{
1059 const struct dmi_system_id *id; 1058 const struct dmi_system_id *id;
1060 const struct i801_mux_config *mux_config; 1059 const struct i801_mux_config *mux_config;
@@ -1084,8 +1083,7 @@ static inline unsigned int i801_get_adapter_class(struct i801_priv *priv)
1084} 1083}
1085#endif 1084#endif
1086 1085
1087static int __devinit i801_probe(struct pci_dev *dev, 1086static int i801_probe(struct pci_dev *dev, const struct pci_device_id *id)
1088 const struct pci_device_id *id)
1089{ 1087{
1090 unsigned char temp; 1088 unsigned char temp;
1091 int err, i; 1089 int err, i;
@@ -1226,7 +1224,7 @@ exit:
1226 return err; 1224 return err;
1227} 1225}
1228 1226
1229static void __devexit i801_remove(struct pci_dev *dev) 1227static void i801_remove(struct pci_dev *dev)
1230{ 1228{
1231 struct i801_priv *priv = pci_get_drvdata(dev); 1229 struct i801_priv *priv = pci_get_drvdata(dev);
1232 1230
@@ -1272,7 +1270,7 @@ static struct pci_driver i801_driver = {
1272 .name = "i801_smbus", 1270 .name = "i801_smbus",
1273 .id_table = i801_ids, 1271 .id_table = i801_ids,
1274 .probe = i801_probe, 1272 .probe = i801_probe,
1275 .remove = __devexit_p(i801_remove), 1273 .remove = i801_remove,
1276 .suspend = i801_suspend, 1274 .suspend = i801_suspend,
1277 .resume = i801_resume, 1275 .resume = i801_resume,
1278}; 1276};
diff --git a/drivers/i2c/busses/i2c-ibm_iic.c b/drivers/i2c/busses/i2c-ibm_iic.c
index 806e225f3de7..33a2abb6c063 100644
--- a/drivers/i2c/busses/i2c-ibm_iic.c
+++ b/drivers/i2c/busses/i2c-ibm_iic.c
@@ -660,7 +660,7 @@ static inline u8 iic_clckdiv(unsigned int opb)
660 return (u8)((opb + 9) / 10 - 1); 660 return (u8)((opb + 9) / 10 - 1);
661} 661}
662 662
663static int __devinit iic_request_irq(struct platform_device *ofdev, 663static int iic_request_irq(struct platform_device *ofdev,
664 struct ibm_iic_private *dev) 664 struct ibm_iic_private *dev)
665{ 665{
666 struct device_node *np = ofdev->dev.of_node; 666 struct device_node *np = ofdev->dev.of_node;
@@ -691,7 +691,7 @@ static int __devinit iic_request_irq(struct platform_device *ofdev,
691/* 691/*
692 * Register single IIC interface 692 * Register single IIC interface
693 */ 693 */
694static int __devinit iic_probe(struct platform_device *ofdev) 694static int iic_probe(struct platform_device *ofdev)
695{ 695{
696 struct device_node *np = ofdev->dev.of_node; 696 struct device_node *np = ofdev->dev.of_node;
697 struct ibm_iic_private *dev; 697 struct ibm_iic_private *dev;
@@ -781,7 +781,7 @@ error_cleanup:
781/* 781/*
782 * Cleanup initialized IIC interface 782 * Cleanup initialized IIC interface
783 */ 783 */
784static int __devexit iic_remove(struct platform_device *ofdev) 784static int iic_remove(struct platform_device *ofdev)
785{ 785{
786 struct ibm_iic_private *dev = dev_get_drvdata(&ofdev->dev); 786 struct ibm_iic_private *dev = dev_get_drvdata(&ofdev->dev);
787 787
@@ -812,7 +812,7 @@ static struct platform_driver ibm_iic_driver = {
812 .of_match_table = ibm_iic_match, 812 .of_match_table = ibm_iic_match,
813 }, 813 },
814 .probe = iic_probe, 814 .probe = iic_probe,
815 .remove = __devexit_p(iic_remove), 815 .remove = iic_remove,
816}; 816};
817 817
818module_platform_driver(ibm_iic_driver); 818module_platform_driver(ibm_iic_driver);
diff --git a/drivers/i2c/busses/i2c-intel-mid.c b/drivers/i2c/busses/i2c-intel-mid.c
index 7c28f10f95ca..de3736bf6465 100644
--- a/drivers/i2c/busses/i2c-intel-mid.c
+++ b/drivers/i2c/busses/i2c-intel-mid.c
@@ -947,7 +947,7 @@ static const struct dev_pm_ops intel_mid_i2c_pm_ops = {
947 * 5. Call intel_mid_i2c_hwinit() for hardware initialization 947 * 5. Call intel_mid_i2c_hwinit() for hardware initialization
948 * 6. Register I2C adapter in i2c-core 948 * 6. Register I2C adapter in i2c-core
949 */ 949 */
950static int __devinit intel_mid_i2c_probe(struct pci_dev *dev, 950static int intel_mid_i2c_probe(struct pci_dev *dev,
951 const struct pci_device_id *id) 951 const struct pci_device_id *id)
952{ 952{
953 struct intel_mid_i2c_private *mrst; 953 struct intel_mid_i2c_private *mrst;
@@ -1079,7 +1079,7 @@ exit:
1079 return err; 1079 return err;
1080} 1080}
1081 1081
1082static void __devexit intel_mid_i2c_remove(struct pci_dev *dev) 1082static void intel_mid_i2c_remove(struct pci_dev *dev)
1083{ 1083{
1084 struct intel_mid_i2c_private *mrst = pci_get_drvdata(dev); 1084 struct intel_mid_i2c_private *mrst = pci_get_drvdata(dev);
1085 intel_mid_i2c_disable(&mrst->adap); 1085 intel_mid_i2c_disable(&mrst->adap);
@@ -1113,7 +1113,7 @@ static struct pci_driver intel_mid_i2c_driver = {
1113 .name = DRIVER_NAME, 1113 .name = DRIVER_NAME,
1114 .id_table = intel_mid_i2c_ids, 1114 .id_table = intel_mid_i2c_ids,
1115 .probe = intel_mid_i2c_probe, 1115 .probe = intel_mid_i2c_probe,
1116 .remove = __devexit_p(intel_mid_i2c_remove), 1116 .remove = intel_mid_i2c_remove,
1117}; 1117};
1118 1118
1119module_pci_driver(intel_mid_i2c_driver); 1119module_pci_driver(intel_mid_i2c_driver);
diff --git a/drivers/i2c/busses/i2c-isch.c b/drivers/i2c/busses/i2c-isch.c
index f90a6057508d..4099f79c2280 100644
--- a/drivers/i2c/busses/i2c-isch.c
+++ b/drivers/i2c/busses/i2c-isch.c
@@ -249,7 +249,7 @@ static struct i2c_adapter sch_adapter = {
249 .algo = &smbus_algorithm, 249 .algo = &smbus_algorithm,
250}; 250};
251 251
252static int __devinit smbus_sch_probe(struct platform_device *dev) 252static int smbus_sch_probe(struct platform_device *dev)
253{ 253{
254 struct resource *res; 254 struct resource *res;
255 int retval; 255 int retval;
@@ -284,7 +284,7 @@ static int __devinit smbus_sch_probe(struct platform_device *dev)
284 return retval; 284 return retval;
285} 285}
286 286
287static int __devexit smbus_sch_remove(struct platform_device *pdev) 287static int smbus_sch_remove(struct platform_device *pdev)
288{ 288{
289 struct resource *res; 289 struct resource *res;
290 if (sch_smba) { 290 if (sch_smba) {
@@ -303,7 +303,7 @@ static struct platform_driver smbus_sch_driver = {
303 .owner = THIS_MODULE, 303 .owner = THIS_MODULE,
304 }, 304 },
305 .probe = smbus_sch_probe, 305 .probe = smbus_sch_probe,
306 .remove = __devexit_p(smbus_sch_remove), 306 .remove = smbus_sch_remove,
307}; 307};
308 308
309module_platform_driver(smbus_sch_driver); 309module_platform_driver(smbus_sch_driver);
diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
index ca86430cb4a2..a69459e5c3f3 100644
--- a/drivers/i2c/busses/i2c-mpc.c
+++ b/drivers/i2c/busses/i2c-mpc.c
@@ -175,7 +175,7 @@ static int i2c_wait(struct mpc_i2c *i2c, unsigned timeout, int writing)
175} 175}
176 176
177#if defined(CONFIG_PPC_MPC52xx) || defined(CONFIG_PPC_MPC512x) 177#if defined(CONFIG_PPC_MPC52xx) || defined(CONFIG_PPC_MPC512x)
178static const struct mpc_i2c_divider mpc_i2c_dividers_52xx[] __devinitconst = { 178static const struct mpc_i2c_divider mpc_i2c_dividers_52xx[] = {
179 {20, 0x20}, {22, 0x21}, {24, 0x22}, {26, 0x23}, 179 {20, 0x20}, {22, 0x21}, {24, 0x22}, {26, 0x23},
180 {28, 0x24}, {30, 0x01}, {32, 0x25}, {34, 0x02}, 180 {28, 0x24}, {30, 0x01}, {32, 0x25}, {34, 0x02},
181 {36, 0x26}, {40, 0x27}, {44, 0x04}, {48, 0x28}, 181 {36, 0x26}, {40, 0x27}, {44, 0x04}, {48, 0x28},
@@ -196,7 +196,7 @@ static const struct mpc_i2c_divider mpc_i2c_dividers_52xx[] __devinitconst = {
196 {10240, 0x9d}, {12288, 0x9e}, {15360, 0x9f} 196 {10240, 0x9d}, {12288, 0x9e}, {15360, 0x9f}
197}; 197};
198 198
199static int __devinit mpc_i2c_get_fdr_52xx(struct device_node *node, u32 clock, 199static int mpc_i2c_get_fdr_52xx(struct device_node *node, u32 clock,
200 int prescaler, u32 *real_clk) 200 int prescaler, u32 *real_clk)
201{ 201{
202 const struct mpc_i2c_divider *div = NULL; 202 const struct mpc_i2c_divider *div = NULL;
@@ -230,7 +230,7 @@ static int __devinit mpc_i2c_get_fdr_52xx(struct device_node *node, u32 clock,
230 return (int)div->fdr; 230 return (int)div->fdr;
231} 231}
232 232
233static void __devinit mpc_i2c_setup_52xx(struct device_node *node, 233static void mpc_i2c_setup_52xx(struct device_node *node,
234 struct mpc_i2c *i2c, 234 struct mpc_i2c *i2c,
235 u32 clock, u32 prescaler) 235 u32 clock, u32 prescaler)
236{ 236{
@@ -252,7 +252,7 @@ static void __devinit mpc_i2c_setup_52xx(struct device_node *node,
252 fdr); 252 fdr);
253} 253}
254#else /* !(CONFIG_PPC_MPC52xx || CONFIG_PPC_MPC512x) */ 254#else /* !(CONFIG_PPC_MPC52xx || CONFIG_PPC_MPC512x) */
255static void __devinit mpc_i2c_setup_52xx(struct device_node *node, 255static void mpc_i2c_setup_52xx(struct device_node *node,
256 struct mpc_i2c *i2c, 256 struct mpc_i2c *i2c,
257 u32 clock, u32 prescaler) 257 u32 clock, u32 prescaler)
258{ 258{
@@ -260,7 +260,7 @@ static void __devinit mpc_i2c_setup_52xx(struct device_node *node,
260#endif /* CONFIG_PPC_MPC52xx || CONFIG_PPC_MPC512x */ 260#endif /* CONFIG_PPC_MPC52xx || CONFIG_PPC_MPC512x */
261 261
262#ifdef CONFIG_PPC_MPC512x 262#ifdef CONFIG_PPC_MPC512x
263static void __devinit mpc_i2c_setup_512x(struct device_node *node, 263static void mpc_i2c_setup_512x(struct device_node *node,
264 struct mpc_i2c *i2c, 264 struct mpc_i2c *i2c,
265 u32 clock, u32 prescaler) 265 u32 clock, u32 prescaler)
266{ 266{
@@ -288,7 +288,7 @@ static void __devinit mpc_i2c_setup_512x(struct device_node *node,
288 mpc_i2c_setup_52xx(node, i2c, clock, prescaler); 288 mpc_i2c_setup_52xx(node, i2c, clock, prescaler);
289} 289}
290#else /* CONFIG_PPC_MPC512x */ 290#else /* CONFIG_PPC_MPC512x */
291static void __devinit mpc_i2c_setup_512x(struct device_node *node, 291static void mpc_i2c_setup_512x(struct device_node *node,
292 struct mpc_i2c *i2c, 292 struct mpc_i2c *i2c,
293 u32 clock, u32 prescaler) 293 u32 clock, u32 prescaler)
294{ 294{
@@ -296,7 +296,7 @@ static void __devinit mpc_i2c_setup_512x(struct device_node *node,
296#endif /* CONFIG_PPC_MPC512x */ 296#endif /* CONFIG_PPC_MPC512x */
297 297
298#ifdef CONFIG_FSL_SOC 298#ifdef CONFIG_FSL_SOC
299static const struct mpc_i2c_divider mpc_i2c_dividers_8xxx[] __devinitconst = { 299static const struct mpc_i2c_divider mpc_i2c_dividers_8xxx[] = {
300 {160, 0x0120}, {192, 0x0121}, {224, 0x0122}, {256, 0x0123}, 300 {160, 0x0120}, {192, 0x0121}, {224, 0x0122}, {256, 0x0123},
301 {288, 0x0100}, {320, 0x0101}, {352, 0x0601}, {384, 0x0102}, 301 {288, 0x0100}, {320, 0x0101}, {352, 0x0601}, {384, 0x0102},
302 {416, 0x0602}, {448, 0x0126}, {480, 0x0103}, {512, 0x0127}, 302 {416, 0x0602}, {448, 0x0126}, {480, 0x0103}, {512, 0x0127},
@@ -316,7 +316,7 @@ static const struct mpc_i2c_divider mpc_i2c_dividers_8xxx[] __devinitconst = {
316 {49152, 0x011e}, {61440, 0x011f} 316 {49152, 0x011e}, {61440, 0x011f}
317}; 317};
318 318
319static u32 __devinit mpc_i2c_get_sec_cfg_8xxx(void) 319static u32 mpc_i2c_get_sec_cfg_8xxx(void)
320{ 320{
321 struct device_node *node = NULL; 321 struct device_node *node = NULL;
322 u32 __iomem *reg; 322 u32 __iomem *reg;
@@ -345,7 +345,7 @@ static u32 __devinit mpc_i2c_get_sec_cfg_8xxx(void)
345 return val; 345 return val;
346} 346}
347 347
348static int __devinit mpc_i2c_get_fdr_8xxx(struct device_node *node, u32 clock, 348static int mpc_i2c_get_fdr_8xxx(struct device_node *node, u32 clock,
349 u32 prescaler, u32 *real_clk) 349 u32 prescaler, u32 *real_clk)
350{ 350{
351 const struct mpc_i2c_divider *div = NULL; 351 const struct mpc_i2c_divider *div = NULL;
@@ -383,7 +383,7 @@ static int __devinit mpc_i2c_get_fdr_8xxx(struct device_node *node, u32 clock,
383 return div ? (int)div->fdr : -EINVAL; 383 return div ? (int)div->fdr : -EINVAL;
384} 384}
385 385
386static void __devinit mpc_i2c_setup_8xxx(struct device_node *node, 386static void mpc_i2c_setup_8xxx(struct device_node *node,
387 struct mpc_i2c *i2c, 387 struct mpc_i2c *i2c,
388 u32 clock, u32 prescaler) 388 u32 clock, u32 prescaler)
389{ 389{
@@ -408,7 +408,7 @@ static void __devinit mpc_i2c_setup_8xxx(struct device_node *node,
408} 408}
409 409
410#else /* !CONFIG_FSL_SOC */ 410#else /* !CONFIG_FSL_SOC */
411static void __devinit mpc_i2c_setup_8xxx(struct device_node *node, 411static void mpc_i2c_setup_8xxx(struct device_node *node,
412 struct mpc_i2c *i2c, 412 struct mpc_i2c *i2c,
413 u32 clock, u32 prescaler) 413 u32 clock, u32 prescaler)
414{ 414{
@@ -615,7 +615,7 @@ static struct i2c_adapter mpc_ops = {
615}; 615};
616 616
617static const struct of_device_id mpc_i2c_of_match[]; 617static const struct of_device_id mpc_i2c_of_match[];
618static int __devinit fsl_i2c_probe(struct platform_device *op) 618static int fsl_i2c_probe(struct platform_device *op)
619{ 619{
620 const struct of_device_id *match; 620 const struct of_device_id *match;
621 struct mpc_i2c *i2c; 621 struct mpc_i2c *i2c;
@@ -706,7 +706,7 @@ static int __devinit fsl_i2c_probe(struct platform_device *op)
706 return result; 706 return result;
707}; 707};
708 708
709static int __devexit fsl_i2c_remove(struct platform_device *op) 709static int fsl_i2c_remove(struct platform_device *op)
710{ 710{
711 struct mpc_i2c *i2c = dev_get_drvdata(&op->dev); 711 struct mpc_i2c *i2c = dev_get_drvdata(&op->dev);
712 712
@@ -746,24 +746,24 @@ static int mpc_i2c_resume(struct device *dev)
746SIMPLE_DEV_PM_OPS(mpc_i2c_pm_ops, mpc_i2c_suspend, mpc_i2c_resume); 746SIMPLE_DEV_PM_OPS(mpc_i2c_pm_ops, mpc_i2c_suspend, mpc_i2c_resume);
747#endif 747#endif
748 748
749static const struct mpc_i2c_data mpc_i2c_data_512x __devinitdata = { 749static const struct mpc_i2c_data mpc_i2c_data_512x = {
750 .setup = mpc_i2c_setup_512x, 750 .setup = mpc_i2c_setup_512x,
751}; 751};
752 752
753static const struct mpc_i2c_data mpc_i2c_data_52xx __devinitdata = { 753static const struct mpc_i2c_data mpc_i2c_data_52xx = {
754 .setup = mpc_i2c_setup_52xx, 754 .setup = mpc_i2c_setup_52xx,
755}; 755};
756 756
757static const struct mpc_i2c_data mpc_i2c_data_8313 __devinitdata = { 757static const struct mpc_i2c_data mpc_i2c_data_8313 = {
758 .setup = mpc_i2c_setup_8xxx, 758 .setup = mpc_i2c_setup_8xxx,
759}; 759};
760 760
761static const struct mpc_i2c_data mpc_i2c_data_8543 __devinitdata = { 761static const struct mpc_i2c_data mpc_i2c_data_8543 = {
762 .setup = mpc_i2c_setup_8xxx, 762 .setup = mpc_i2c_setup_8xxx,
763 .prescaler = 2, 763 .prescaler = 2,
764}; 764};
765 765
766static const struct mpc_i2c_data mpc_i2c_data_8544 __devinitdata = { 766static const struct mpc_i2c_data mpc_i2c_data_8544 = {
767 .setup = mpc_i2c_setup_8xxx, 767 .setup = mpc_i2c_setup_8xxx,
768 .prescaler = 3, 768 .prescaler = 3,
769}; 769};
@@ -785,7 +785,7 @@ MODULE_DEVICE_TABLE(of, mpc_i2c_of_match);
785/* Structure for a device driver */ 785/* Structure for a device driver */
786static struct platform_driver mpc_i2c_driver = { 786static struct platform_driver mpc_i2c_driver = {
787 .probe = fsl_i2c_probe, 787 .probe = fsl_i2c_probe,
788 .remove = __devexit_p(fsl_i2c_remove), 788 .remove = fsl_i2c_remove,
789 .driver = { 789 .driver = {
790 .owner = THIS_MODULE, 790 .owner = THIS_MODULE,
791 .name = DRV_NAME, 791 .name = DRV_NAME,
diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c
index 2e9d56719e99..8b20ef8524ac 100644
--- a/drivers/i2c/busses/i2c-mv64xxx.c
+++ b/drivers/i2c/busses/i2c-mv64xxx.c
@@ -495,7 +495,7 @@ static const struct i2c_algorithm mv64xxx_i2c_algo = {
495 * 495 *
496 ***************************************************************************** 496 *****************************************************************************
497 */ 497 */
498static int __devinit 498static int
499mv64xxx_i2c_map_regs(struct platform_device *pd, 499mv64xxx_i2c_map_regs(struct platform_device *pd,
500 struct mv64xxx_i2c_data *drv_data) 500 struct mv64xxx_i2c_data *drv_data)
501{ 501{
@@ -530,13 +530,13 @@ mv64xxx_i2c_unmap_regs(struct mv64xxx_i2c_data *drv_data)
530} 530}
531 531
532#ifdef CONFIG_OF 532#ifdef CONFIG_OF
533static int __devinit 533static int
534mv64xxx_calc_freq(const int tclk, const int n, const int m) 534mv64xxx_calc_freq(const int tclk, const int n, const int m)
535{ 535{
536 return tclk / (10 * (m + 1) * (2 << n)); 536 return tclk / (10 * (m + 1) * (2 << n));
537} 537}
538 538
539static bool __devinit 539static bool
540mv64xxx_find_baud_factors(const u32 req_freq, const u32 tclk, u32 *best_n, 540mv64xxx_find_baud_factors(const u32 req_freq, const u32 tclk, u32 *best_n,
541 u32 *best_m) 541 u32 *best_m)
542{ 542{
@@ -560,7 +560,7 @@ mv64xxx_find_baud_factors(const u32 req_freq, const u32 tclk, u32 *best_n,
560 return true; 560 return true;
561} 561}
562 562
563static int __devinit 563static int
564mv64xxx_of_config(struct mv64xxx_i2c_data *drv_data, 564mv64xxx_of_config(struct mv64xxx_i2c_data *drv_data,
565 struct device_node *np) 565 struct device_node *np)
566{ 566{
@@ -597,7 +597,7 @@ out:
597#endif 597#endif
598} 598}
599#else /* CONFIG_OF */ 599#else /* CONFIG_OF */
600static int __devinit 600static int
601mv64xxx_of_config(struct mv64xxx_i2c_data *drv_data, 601mv64xxx_of_config(struct mv64xxx_i2c_data *drv_data,
602 struct device_node *np) 602 struct device_node *np)
603{ 603{
@@ -605,7 +605,7 @@ mv64xxx_of_config(struct mv64xxx_i2c_data *drv_data,
605} 605}
606#endif /* CONFIG_OF */ 606#endif /* CONFIG_OF */
607 607
608static int __devinit 608static int
609mv64xxx_i2c_probe(struct platform_device *pd) 609mv64xxx_i2c_probe(struct platform_device *pd)
610{ 610{
611 struct mv64xxx_i2c_data *drv_data; 611 struct mv64xxx_i2c_data *drv_data;
@@ -697,7 +697,7 @@ mv64xxx_i2c_probe(struct platform_device *pd)
697 return rc; 697 return rc;
698} 698}
699 699
700static int __devexit 700static int
701mv64xxx_i2c_remove(struct platform_device *dev) 701mv64xxx_i2c_remove(struct platform_device *dev)
702{ 702{
703 struct mv64xxx_i2c_data *drv_data = platform_get_drvdata(dev); 703 struct mv64xxx_i2c_data *drv_data = platform_get_drvdata(dev);
@@ -718,7 +718,7 @@ mv64xxx_i2c_remove(struct platform_device *dev)
718 return rc; 718 return rc;
719} 719}
720 720
721static const struct of_device_id mv64xxx_i2c_of_match_table[] __devinitdata = { 721static const struct of_device_id mv64xxx_i2c_of_match_table[] = {
722 { .compatible = "marvell,mv64xxx-i2c", }, 722 { .compatible = "marvell,mv64xxx-i2c", },
723 {} 723 {}
724}; 724};
@@ -726,7 +726,7 @@ MODULE_DEVICE_TABLE(of, mv64xxx_i2c_of_match_table);
726 726
727static struct platform_driver mv64xxx_i2c_driver = { 727static struct platform_driver mv64xxx_i2c_driver = {
728 .probe = mv64xxx_i2c_probe, 728 .probe = mv64xxx_i2c_probe,
729 .remove = __devexit_p(mv64xxx_i2c_remove), 729 .remove = mv64xxx_i2c_remove,
730 .driver = { 730 .driver = {
731 .owner = THIS_MODULE, 731 .owner = THIS_MODULE,
732 .name = MV64XXX_I2C_CTLR_NAME, 732 .name = MV64XXX_I2C_CTLR_NAME,
diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c
index 6ed53da9e1f4..1b1a936eccc9 100644
--- a/drivers/i2c/busses/i2c-mxs.c
+++ b/drivers/i2c/busses/i2c-mxs.c
@@ -432,7 +432,7 @@ static int mxs_i2c_get_ofdata(struct mxs_i2c_dev *i2c)
432 return 0; 432 return 0;
433} 433}
434 434
435static int __devinit mxs_i2c_probe(struct platform_device *pdev) 435static int mxs_i2c_probe(struct platform_device *pdev)
436{ 436{
437 struct device *dev = &pdev->dev; 437 struct device *dev = &pdev->dev;
438 struct mxs_i2c_dev *i2c; 438 struct mxs_i2c_dev *i2c;
@@ -515,7 +515,7 @@ static int __devinit mxs_i2c_probe(struct platform_device *pdev)
515 return 0; 515 return 0;
516} 516}
517 517
518static int __devexit mxs_i2c_remove(struct platform_device *pdev) 518static int mxs_i2c_remove(struct platform_device *pdev)
519{ 519{
520 struct mxs_i2c_dev *i2c = platform_get_drvdata(pdev); 520 struct mxs_i2c_dev *i2c = platform_get_drvdata(pdev);
521 int ret; 521 int ret;
@@ -546,7 +546,7 @@ static struct platform_driver mxs_i2c_driver = {
546 .owner = THIS_MODULE, 546 .owner = THIS_MODULE,
547 .of_match_table = mxs_i2c_dt_ids, 547 .of_match_table = mxs_i2c_dt_ids,
548 }, 548 },
549 .remove = __devexit_p(mxs_i2c_remove), 549 .remove = mxs_i2c_remove,
550}; 550};
551 551
552static int __init mxs_i2c_init(void) 552static int __init mxs_i2c_init(void)
diff --git a/drivers/i2c/busses/i2c-nforce2.c b/drivers/i2c/busses/i2c-nforce2.c
index 392303b4be07..adac8542771d 100644
--- a/drivers/i2c/busses/i2c-nforce2.c
+++ b/drivers/i2c/busses/i2c-nforce2.c
@@ -117,7 +117,7 @@ struct nforce2_smbus {
117#define MAX_TIMEOUT 100 117#define MAX_TIMEOUT 100
118 118
119/* We disable the second SMBus channel on these boards */ 119/* We disable the second SMBus channel on these boards */
120static struct dmi_system_id __devinitdata nforce2_dmi_blacklist2[] = { 120static const struct dmi_system_id nforce2_dmi_blacklist2[] = {
121 { 121 {
122 .ident = "DFI Lanparty NF4 Expert", 122 .ident = "DFI Lanparty NF4 Expert",
123 .matches = { 123 .matches = {
@@ -330,8 +330,8 @@ static DEFINE_PCI_DEVICE_TABLE(nforce2_ids) = {
330MODULE_DEVICE_TABLE (pci, nforce2_ids); 330MODULE_DEVICE_TABLE (pci, nforce2_ids);
331 331
332 332
333static int __devinit nforce2_probe_smb (struct pci_dev *dev, int bar, 333static int nforce2_probe_smb(struct pci_dev *dev, int bar, int alt_reg,
334 int alt_reg, struct nforce2_smbus *smbus, const char *name) 334 struct nforce2_smbus *smbus, const char *name)
335{ 335{
336 int error; 336 int error;
337 337
@@ -382,7 +382,7 @@ static int __devinit nforce2_probe_smb (struct pci_dev *dev, int bar,
382} 382}
383 383
384 384
385static int __devinit nforce2_probe(struct pci_dev *dev, const struct pci_device_id *id) 385static int nforce2_probe(struct pci_dev *dev, const struct pci_device_id *id)
386{ 386{
387 struct nforce2_smbus *smbuses; 387 struct nforce2_smbus *smbuses;
388 int res1, res2; 388 int res1, res2;
@@ -430,7 +430,7 @@ static int __devinit nforce2_probe(struct pci_dev *dev, const struct pci_device_
430} 430}
431 431
432 432
433static void __devexit nforce2_remove(struct pci_dev *dev) 433static void nforce2_remove(struct pci_dev *dev)
434{ 434{
435 struct nforce2_smbus *smbuses = pci_get_drvdata(dev); 435 struct nforce2_smbus *smbuses = pci_get_drvdata(dev);
436 436
@@ -450,7 +450,7 @@ static struct pci_driver nforce2_driver = {
450 .name = "nForce2_smbus", 450 .name = "nForce2_smbus",
451 .id_table = nforce2_ids, 451 .id_table = nforce2_ids,
452 .probe = nforce2_probe, 452 .probe = nforce2_probe,
453 .remove = __devexit_p(nforce2_remove), 453 .remove = nforce2_remove,
454}; 454};
455 455
456module_pci_driver(nforce2_driver); 456module_pci_driver(nforce2_driver);
diff --git a/drivers/i2c/busses/i2c-nuc900.c b/drivers/i2c/busses/i2c-nuc900.c
index a23b91b0b738..865ee350adb3 100644
--- a/drivers/i2c/busses/i2c-nuc900.c
+++ b/drivers/i2c/busses/i2c-nuc900.c
@@ -518,7 +518,7 @@ static const struct i2c_algorithm nuc900_i2c_algorithm = {
518 * called by the bus driver when a suitable device is found 518 * called by the bus driver when a suitable device is found
519*/ 519*/
520 520
521static int __devinit nuc900_i2c_probe(struct platform_device *pdev) 521static int nuc900_i2c_probe(struct platform_device *pdev)
522{ 522{
523 struct nuc900_i2c *i2c; 523 struct nuc900_i2c *i2c;
524 struct nuc900_platform_i2c *pdata; 524 struct nuc900_platform_i2c *pdata;
@@ -663,7 +663,7 @@ static int __devinit nuc900_i2c_probe(struct platform_device *pdev)
663 * called when device is removed from the bus 663 * called when device is removed from the bus
664*/ 664*/
665 665
666static int __devexit nuc900_i2c_remove(struct platform_device *pdev) 666static int nuc900_i2c_remove(struct platform_device *pdev)
667{ 667{
668 struct nuc900_i2c *i2c = platform_get_drvdata(pdev); 668 struct nuc900_i2c *i2c = platform_get_drvdata(pdev);
669 669
@@ -684,7 +684,7 @@ static int __devexit nuc900_i2c_remove(struct platform_device *pdev)
684 684
685static struct platform_driver nuc900_i2c_driver = { 685static struct platform_driver nuc900_i2c_driver = {
686 .probe = nuc900_i2c_probe, 686 .probe = nuc900_i2c_probe,
687 .remove = __devexit_p(nuc900_i2c_remove), 687 .remove = nuc900_i2c_remove,
688 .driver = { 688 .driver = {
689 .owner = THIS_MODULE, 689 .owner = THIS_MODULE,
690 .name = "nuc900-i2c0", 690 .name = "nuc900-i2c0",
diff --git a/drivers/i2c/busses/i2c-ocores.c b/drivers/i2c/busses/i2c-ocores.c
index 9b35c9fbb2fe..a873d0ad1acb 100644
--- a/drivers/i2c/busses/i2c-ocores.c
+++ b/drivers/i2c/busses/i2c-ocores.c
@@ -343,7 +343,7 @@ static int ocores_i2c_of_probe(struct platform_device *pdev,
343#define ocores_i2c_of_probe(pdev,i2c) -ENODEV 343#define ocores_i2c_of_probe(pdev,i2c) -ENODEV
344#endif 344#endif
345 345
346static int __devinit ocores_i2c_probe(struct platform_device *pdev) 346static int ocores_i2c_probe(struct platform_device *pdev)
347{ 347{
348 struct ocores_i2c *i2c; 348 struct ocores_i2c *i2c;
349 struct ocores_i2c_platform_data *pdata; 349 struct ocores_i2c_platform_data *pdata;
@@ -441,7 +441,7 @@ static int __devinit ocores_i2c_probe(struct platform_device *pdev)
441 return 0; 441 return 0;
442} 442}
443 443
444static int __devexit ocores_i2c_remove(struct platform_device *pdev) 444static int ocores_i2c_remove(struct platform_device *pdev)
445{ 445{
446 struct ocores_i2c *i2c = platform_get_drvdata(pdev); 446 struct ocores_i2c *i2c = platform_get_drvdata(pdev);
447 447
@@ -485,7 +485,7 @@ static SIMPLE_DEV_PM_OPS(ocores_i2c_pm, ocores_i2c_suspend, ocores_i2c_resume);
485 485
486static struct platform_driver ocores_i2c_driver = { 486static struct platform_driver ocores_i2c_driver = {
487 .probe = ocores_i2c_probe, 487 .probe = ocores_i2c_probe,
488 .remove = __devexit_p(ocores_i2c_remove), 488 .remove = ocores_i2c_remove,
489 .driver = { 489 .driver = {
490 .owner = THIS_MODULE, 490 .owner = THIS_MODULE,
491 .name = "ocores-i2c", 491 .name = "ocores-i2c",
diff --git a/drivers/i2c/busses/i2c-octeon.c b/drivers/i2c/busses/i2c-octeon.c
index f44c83549fe5..484ca771fdff 100644
--- a/drivers/i2c/busses/i2c-octeon.c
+++ b/drivers/i2c/busses/i2c-octeon.c
@@ -446,7 +446,7 @@ static struct i2c_adapter octeon_i2c_ops = {
446/** 446/**
447 * octeon_i2c_setclock - Calculate and set clock divisors. 447 * octeon_i2c_setclock - Calculate and set clock divisors.
448 */ 448 */
449static int __devinit octeon_i2c_setclock(struct octeon_i2c *i2c) 449static int octeon_i2c_setclock(struct octeon_i2c *i2c)
450{ 450{
451 int tclk, thp_base, inc, thp_idx, mdiv_idx, ndiv_idx, foscl, diff; 451 int tclk, thp_base, inc, thp_idx, mdiv_idx, ndiv_idx, foscl, diff;
452 int thp = 0x18, mdiv = 2, ndiv = 0, delta_hz = 1000000; 452 int thp = 0x18, mdiv = 2, ndiv = 0, delta_hz = 1000000;
@@ -489,7 +489,7 @@ static int __devinit octeon_i2c_setclock(struct octeon_i2c *i2c)
489 return 0; 489 return 0;
490} 490}
491 491
492static int __devinit octeon_i2c_initlowlevel(struct octeon_i2c *i2c) 492static int octeon_i2c_initlowlevel(struct octeon_i2c *i2c)
493{ 493{
494 u8 status; 494 u8 status;
495 int tries; 495 int tries;
@@ -510,7 +510,7 @@ static int __devinit octeon_i2c_initlowlevel(struct octeon_i2c *i2c)
510 return -EIO; 510 return -EIO;
511} 511}
512 512
513static int __devinit octeon_i2c_probe(struct platform_device *pdev) 513static int octeon_i2c_probe(struct platform_device *pdev)
514{ 514{
515 int irq, result = 0; 515 int irq, result = 0;
516 struct octeon_i2c *i2c; 516 struct octeon_i2c *i2c;
@@ -609,7 +609,7 @@ out:
609 return result; 609 return result;
610}; 610};
611 611
612static int __devexit octeon_i2c_remove(struct platform_device *pdev) 612static int octeon_i2c_remove(struct platform_device *pdev)
613{ 613{
614 struct octeon_i2c *i2c = platform_get_drvdata(pdev); 614 struct octeon_i2c *i2c = platform_get_drvdata(pdev);
615 615
@@ -628,7 +628,7 @@ MODULE_DEVICE_TABLE(of, octeon_i2c_match);
628 628
629static struct platform_driver octeon_i2c_driver = { 629static struct platform_driver octeon_i2c_driver = {
630 .probe = octeon_i2c_probe, 630 .probe = octeon_i2c_probe,
631 .remove = __devexit_p(octeon_i2c_remove), 631 .remove = octeon_i2c_remove,
632 .driver = { 632 .driver = {
633 .owner = THIS_MODULE, 633 .owner = THIS_MODULE,
634 .name = DRV_NAME, 634 .name = DRV_NAME,
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 7a62acb7d262..20d41bfa7c19 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -1069,7 +1069,7 @@ MODULE_DEVICE_TABLE(of, omap_i2c_of_match);
1069#define OMAP_I2C_SCHEME_0 0 1069#define OMAP_I2C_SCHEME_0 0
1070#define OMAP_I2C_SCHEME_1 1 1070#define OMAP_I2C_SCHEME_1 1
1071 1071
1072static int __devinit 1072static int
1073omap_i2c_probe(struct platform_device *pdev) 1073omap_i2c_probe(struct platform_device *pdev)
1074{ 1074{
1075 struct omap_i2c_dev *dev; 1075 struct omap_i2c_dev *dev;
@@ -1267,7 +1267,7 @@ err_free_mem:
1267 return r; 1267 return r;
1268} 1268}
1269 1269
1270static int __devexit omap_i2c_remove(struct platform_device *pdev) 1270static int omap_i2c_remove(struct platform_device *pdev)
1271{ 1271{
1272 struct omap_i2c_dev *dev = platform_get_drvdata(pdev); 1272 struct omap_i2c_dev *dev = platform_get_drvdata(pdev);
1273 int ret; 1273 int ret;
@@ -1333,7 +1333,7 @@ static struct dev_pm_ops omap_i2c_pm_ops = {
1333 1333
1334static struct platform_driver omap_i2c_driver = { 1334static struct platform_driver omap_i2c_driver = {
1335 .probe = omap_i2c_probe, 1335 .probe = omap_i2c_probe,
1336 .remove = __devexit_p(omap_i2c_remove), 1336 .remove = omap_i2c_remove,
1337 .driver = { 1337 .driver = {
1338 .name = "omap_i2c", 1338 .name = "omap_i2c",
1339 .owner = THIS_MODULE, 1339 .owner = THIS_MODULE,
diff --git a/drivers/i2c/busses/i2c-parport-light.c b/drivers/i2c/busses/i2c-parport-light.c
index 4b95f7a63a3b..aa9577881925 100644
--- a/drivers/i2c/busses/i2c-parport-light.c
+++ b/drivers/i2c/busses/i2c-parport-light.c
@@ -135,7 +135,7 @@ static struct lineop parport_ctrl_irq = {
135 .port = PORT_CTRL, 135 .port = PORT_CTRL,
136}; 136};
137 137
138static int __devinit i2c_parport_probe(struct platform_device *pdev) 138static int i2c_parport_probe(struct platform_device *pdev)
139{ 139{
140 int err; 140 int err;
141 141
@@ -169,7 +169,7 @@ static int __devinit i2c_parport_probe(struct platform_device *pdev)
169 return 0; 169 return 0;
170} 170}
171 171
172static int __devexit i2c_parport_remove(struct platform_device *pdev) 172static int i2c_parport_remove(struct platform_device *pdev)
173{ 173{
174 if (ara) { 174 if (ara) {
175 line_set(0, &parport_ctrl_irq); 175 line_set(0, &parport_ctrl_irq);
@@ -191,7 +191,7 @@ static struct platform_driver i2c_parport_driver = {
191 .name = DRVNAME, 191 .name = DRVNAME,
192 }, 192 },
193 .probe = i2c_parport_probe, 193 .probe = i2c_parport_probe,
194 .remove = __devexit_p(i2c_parport_remove), 194 .remove = i2c_parport_remove,
195}; 195};
196 196
197static int __init i2c_parport_device_add(u16 address) 197static int __init i2c_parport_device_add(u16 address)
diff --git a/drivers/i2c/busses/i2c-pasemi.c b/drivers/i2c/busses/i2c-pasemi.c
index 12edefd4183a..615f632c846f 100644
--- a/drivers/i2c/busses/i2c-pasemi.c
+++ b/drivers/i2c/busses/i2c-pasemi.c
@@ -340,7 +340,7 @@ static const struct i2c_algorithm smbus_algorithm = {
340 .functionality = pasemi_smb_func, 340 .functionality = pasemi_smb_func,
341}; 341};
342 342
343static int __devinit pasemi_smb_probe(struct pci_dev *dev, 343static int pasemi_smb_probe(struct pci_dev *dev,
344 const struct pci_device_id *id) 344 const struct pci_device_id *id)
345{ 345{
346 struct pasemi_smbus *smbus; 346 struct pasemi_smbus *smbus;
@@ -392,7 +392,7 @@ static int __devinit pasemi_smb_probe(struct pci_dev *dev,
392 return error; 392 return error;
393} 393}
394 394
395static void __devexit pasemi_smb_remove(struct pci_dev *dev) 395static void pasemi_smb_remove(struct pci_dev *dev)
396{ 396{
397 struct pasemi_smbus *smbus = pci_get_drvdata(dev); 397 struct pasemi_smbus *smbus = pci_get_drvdata(dev);
398 398
@@ -412,7 +412,7 @@ static struct pci_driver pasemi_smb_driver = {
412 .name = "i2c-pasemi", 412 .name = "i2c-pasemi",
413 .id_table = pasemi_smb_ids, 413 .id_table = pasemi_smb_ids,
414 .probe = pasemi_smb_probe, 414 .probe = pasemi_smb_probe,
415 .remove = __devexit_p(pasemi_smb_remove), 415 .remove = pasemi_smb_remove,
416}; 416};
417 417
418module_pci_driver(pasemi_smb_driver); 418module_pci_driver(pasemi_smb_driver);
diff --git a/drivers/i2c/busses/i2c-pca-isa.c b/drivers/i2c/busses/i2c-pca-isa.c
index 29933f87d8fa..323f061a3163 100644
--- a/drivers/i2c/busses/i2c-pca-isa.c
+++ b/drivers/i2c/busses/i2c-pca-isa.c
@@ -119,7 +119,7 @@ static struct i2c_adapter pca_isa_ops = {
119 .timeout = HZ, 119 .timeout = HZ,
120}; 120};
121 121
122static int __devinit pca_isa_match(struct device *dev, unsigned int id) 122static int pca_isa_match(struct device *dev, unsigned int id)
123{ 123{
124 int match = base != 0; 124 int match = base != 0;
125 125
@@ -132,7 +132,7 @@ static int __devinit pca_isa_match(struct device *dev, unsigned int id)
132 return match; 132 return match;
133} 133}
134 134
135static int __devinit pca_isa_probe(struct device *dev, unsigned int id) 135static int pca_isa_probe(struct device *dev, unsigned int id)
136{ 136{
137 init_waitqueue_head(&pca_wait); 137 init_waitqueue_head(&pca_wait);
138 138
@@ -174,7 +174,7 @@ static int __devinit pca_isa_probe(struct device *dev, unsigned int id)
174 return -ENODEV; 174 return -ENODEV;
175} 175}
176 176
177static int __devexit pca_isa_remove(struct device *dev, unsigned int id) 177static int pca_isa_remove(struct device *dev, unsigned int id)
178{ 178{
179 i2c_del_adapter(&pca_isa_ops); 179 i2c_del_adapter(&pca_isa_ops);
180 180
@@ -190,7 +190,7 @@ static int __devexit pca_isa_remove(struct device *dev, unsigned int id)
190static struct isa_driver pca_isa_driver = { 190static struct isa_driver pca_isa_driver = {
191 .match = pca_isa_match, 191 .match = pca_isa_match,
192 .probe = pca_isa_probe, 192 .probe = pca_isa_probe,
193 .remove = __devexit_p(pca_isa_remove), 193 .remove = pca_isa_remove,
194 .driver = { 194 .driver = {
195 .owner = THIS_MODULE, 195 .owner = THIS_MODULE,
196 .name = DRIVER, 196 .name = DRIVER,
diff --git a/drivers/i2c/busses/i2c-pca-platform.c b/drivers/i2c/busses/i2c-pca-platform.c
index 675878f49f76..a30d2f613c03 100644
--- a/drivers/i2c/busses/i2c-pca-platform.c
+++ b/drivers/i2c/busses/i2c-pca-platform.c
@@ -131,7 +131,7 @@ static irqreturn_t i2c_pca_pf_handler(int this_irq, void *dev_id)
131} 131}
132 132
133 133
134static int __devinit i2c_pca_pf_probe(struct platform_device *pdev) 134static int i2c_pca_pf_probe(struct platform_device *pdev)
135{ 135{
136 struct i2c_pca_pf_data *i2c; 136 struct i2c_pca_pf_data *i2c;
137 struct resource *res; 137 struct resource *res;
@@ -257,7 +257,7 @@ e_print:
257 return ret; 257 return ret;
258} 258}
259 259
260static int __devexit i2c_pca_pf_remove(struct platform_device *pdev) 260static int i2c_pca_pf_remove(struct platform_device *pdev)
261{ 261{
262 struct i2c_pca_pf_data *i2c = platform_get_drvdata(pdev); 262 struct i2c_pca_pf_data *i2c = platform_get_drvdata(pdev);
263 platform_set_drvdata(pdev, NULL); 263 platform_set_drvdata(pdev, NULL);
@@ -279,7 +279,7 @@ static int __devexit i2c_pca_pf_remove(struct platform_device *pdev)
279 279
280static struct platform_driver i2c_pca_pf_driver = { 280static struct platform_driver i2c_pca_pf_driver = {
281 .probe = i2c_pca_pf_probe, 281 .probe = i2c_pca_pf_probe,
282 .remove = __devexit_p(i2c_pca_pf_remove), 282 .remove = i2c_pca_pf_remove,
283 .driver = { 283 .driver = {
284 .name = "i2c-pca-platform", 284 .name = "i2c-pca-platform",
285 .owner = THIS_MODULE, 285 .owner = THIS_MODULE,
diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c
index f7216ed2f3a9..39ab78c1a02c 100644
--- a/drivers/i2c/busses/i2c-piix4.c
+++ b/drivers/i2c/busses/i2c-piix4.c
@@ -99,7 +99,7 @@ MODULE_PARM_DESC(force_addr,
99static int srvrworks_csb5_delay; 99static int srvrworks_csb5_delay;
100static struct pci_driver piix4_driver; 100static struct pci_driver piix4_driver;
101 101
102static struct dmi_system_id __devinitdata piix4_dmi_blacklist[] = { 102static const struct dmi_system_id piix4_dmi_blacklist[] = {
103 { 103 {
104 .ident = "Sapphire AM2RD790", 104 .ident = "Sapphire AM2RD790",
105 .matches = { 105 .matches = {
@@ -119,7 +119,7 @@ static struct dmi_system_id __devinitdata piix4_dmi_blacklist[] = {
119 119
120/* The IBM entry is in a separate table because we only check it 120/* The IBM entry is in a separate table because we only check it
121 on Intel-based systems */ 121 on Intel-based systems */
122static struct dmi_system_id __devinitdata piix4_dmi_ibm[] = { 122static const struct dmi_system_id piix4_dmi_ibm[] = {
123 { 123 {
124 .ident = "IBM", 124 .ident = "IBM",
125 .matches = { DMI_MATCH(DMI_SYS_VENDOR, "IBM"), }, 125 .matches = { DMI_MATCH(DMI_SYS_VENDOR, "IBM"), },
@@ -131,8 +131,8 @@ struct i2c_piix4_adapdata {
131 unsigned short smba; 131 unsigned short smba;
132}; 132};
133 133
134static int __devinit piix4_setup(struct pci_dev *PIIX4_dev, 134static int piix4_setup(struct pci_dev *PIIX4_dev,
135 const struct pci_device_id *id) 135 const struct pci_device_id *id)
136{ 136{
137 unsigned char temp; 137 unsigned char temp;
138 unsigned short piix4_smba; 138 unsigned short piix4_smba;
@@ -230,8 +230,8 @@ static int __devinit piix4_setup(struct pci_dev *PIIX4_dev,
230 return piix4_smba; 230 return piix4_smba;
231} 231}
232 232
233static int __devinit piix4_setup_sb800(struct pci_dev *PIIX4_dev, 233static int piix4_setup_sb800(struct pci_dev *PIIX4_dev,
234 const struct pci_device_id *id) 234 const struct pci_device_id *id)
235{ 235{
236 unsigned short piix4_smba; 236 unsigned short piix4_smba;
237 unsigned short smba_idx = 0xcd6; 237 unsigned short smba_idx = 0xcd6;
@@ -294,9 +294,9 @@ static int __devinit piix4_setup_sb800(struct pci_dev *PIIX4_dev,
294 return piix4_smba; 294 return piix4_smba;
295} 295}
296 296
297static int __devinit piix4_setup_aux(struct pci_dev *PIIX4_dev, 297static int piix4_setup_aux(struct pci_dev *PIIX4_dev,
298 const struct pci_device_id *id, 298 const struct pci_device_id *id,
299 unsigned short base_reg_addr) 299 unsigned short base_reg_addr)
300{ 300{
301 /* Set up auxiliary SMBus controllers found on some 301 /* Set up auxiliary SMBus controllers found on some
302 * AMD chipsets e.g. SP5100 (SB700 derivative) */ 302 * AMD chipsets e.g. SP5100 (SB700 derivative) */
@@ -540,9 +540,8 @@ MODULE_DEVICE_TABLE (pci, piix4_ids);
540static struct i2c_adapter *piix4_main_adapter; 540static struct i2c_adapter *piix4_main_adapter;
541static struct i2c_adapter *piix4_aux_adapter; 541static struct i2c_adapter *piix4_aux_adapter;
542 542
543static int __devinit piix4_add_adapter(struct pci_dev *dev, 543static int piix4_add_adapter(struct pci_dev *dev, unsigned short smba,
544 unsigned short smba, 544 struct i2c_adapter **padap)
545 struct i2c_adapter **padap)
546{ 545{
547 struct i2c_adapter *adap; 546 struct i2c_adapter *adap;
548 struct i2c_piix4_adapdata *adapdata; 547 struct i2c_piix4_adapdata *adapdata;
@@ -588,8 +587,7 @@ static int __devinit piix4_add_adapter(struct pci_dev *dev,
588 return 0; 587 return 0;
589} 588}
590 589
591static int __devinit piix4_probe(struct pci_dev *dev, 590static int piix4_probe(struct pci_dev *dev, const struct pci_device_id *id)
592 const struct pci_device_id *id)
593{ 591{
594 int retval; 592 int retval;
595 593
@@ -626,7 +624,7 @@ static int __devinit piix4_probe(struct pci_dev *dev,
626 return 0; 624 return 0;
627} 625}
628 626
629static void __devexit piix4_adap_remove(struct i2c_adapter *adap) 627static void piix4_adap_remove(struct i2c_adapter *adap)
630{ 628{
631 struct i2c_piix4_adapdata *adapdata = i2c_get_adapdata(adap); 629 struct i2c_piix4_adapdata *adapdata = i2c_get_adapdata(adap);
632 630
@@ -638,7 +636,7 @@ static void __devexit piix4_adap_remove(struct i2c_adapter *adap)
638 } 636 }
639} 637}
640 638
641static void __devexit piix4_remove(struct pci_dev *dev) 639static void piix4_remove(struct pci_dev *dev)
642{ 640{
643 if (piix4_main_adapter) { 641 if (piix4_main_adapter) {
644 piix4_adap_remove(piix4_main_adapter); 642 piix4_adap_remove(piix4_main_adapter);
@@ -655,7 +653,7 @@ static struct pci_driver piix4_driver = {
655 .name = "piix4_smbus", 653 .name = "piix4_smbus",
656 .id_table = piix4_ids, 654 .id_table = piix4_ids,
657 .probe = piix4_probe, 655 .probe = piix4_probe,
658 .remove = __devexit_p(piix4_remove), 656 .remove = piix4_remove,
659}; 657};
660 658
661module_pci_driver(piix4_driver); 659module_pci_driver(piix4_driver);
diff --git a/drivers/i2c/busses/i2c-pmcmsp.c b/drivers/i2c/busses/i2c-pmcmsp.c
index 3d71395ae1f7..083d68cfaf0b 100644
--- a/drivers/i2c/busses/i2c-pmcmsp.c
+++ b/drivers/i2c/busses/i2c-pmcmsp.c
@@ -270,7 +270,7 @@ static irqreturn_t pmcmsptwi_interrupt(int irq, void *ptr)
270/* 270/*
271 * Probe for and register the device and return 0 if there is one. 271 * Probe for and register the device and return 0 if there is one.
272 */ 272 */
273static int __devinit pmcmsptwi_probe(struct platform_device *pldev) 273static int pmcmsptwi_probe(struct platform_device *pldev)
274{ 274{
275 struct resource *res; 275 struct resource *res;
276 int rc = -ENODEV; 276 int rc = -ENODEV;
@@ -368,7 +368,7 @@ ret_err:
368/* 368/*
369 * Release the device and return 0 if there is one. 369 * Release the device and return 0 if there is one.
370 */ 370 */
371static int __devexit pmcmsptwi_remove(struct platform_device *pldev) 371static int pmcmsptwi_remove(struct platform_device *pldev)
372{ 372{
373 struct resource *res; 373 struct resource *res;
374 374
@@ -628,7 +628,7 @@ static struct i2c_adapter pmcmsptwi_adapter = {
628 628
629static struct platform_driver pmcmsptwi_driver = { 629static struct platform_driver pmcmsptwi_driver = {
630 .probe = pmcmsptwi_probe, 630 .probe = pmcmsptwi_probe,
631 .remove = __devexit_p(pmcmsptwi_remove), 631 .remove = pmcmsptwi_remove,
632 .driver = { 632 .driver = {
633 .name = DRV_NAME, 633 .name = DRV_NAME,
634 .owner = THIS_MODULE, 634 .owner = THIS_MODULE,
diff --git a/drivers/i2c/busses/i2c-pnx.c b/drivers/i2c/busses/i2c-pnx.c
index 8488bddfe465..ce4097012e97 100644
--- a/drivers/i2c/busses/i2c-pnx.c
+++ b/drivers/i2c/busses/i2c-pnx.c
@@ -619,7 +619,7 @@ static SIMPLE_DEV_PM_OPS(i2c_pnx_pm,
619#define PNX_I2C_PM NULL 619#define PNX_I2C_PM NULL
620#endif 620#endif
621 621
622static int __devinit i2c_pnx_probe(struct platform_device *pdev) 622static int i2c_pnx_probe(struct platform_device *pdev)
623{ 623{
624 unsigned long tmp; 624 unsigned long tmp;
625 int ret = 0; 625 int ret = 0;
@@ -765,7 +765,7 @@ err_kzalloc:
765 return ret; 765 return ret;
766} 766}
767 767
768static int __devexit i2c_pnx_remove(struct platform_device *pdev) 768static int i2c_pnx_remove(struct platform_device *pdev)
769{ 769{
770 struct i2c_pnx_algo_data *alg_data = platform_get_drvdata(pdev); 770 struct i2c_pnx_algo_data *alg_data = platform_get_drvdata(pdev);
771 771
@@ -797,7 +797,7 @@ static struct platform_driver i2c_pnx_driver = {
797 .pm = PNX_I2C_PM, 797 .pm = PNX_I2C_PM,
798 }, 798 },
799 .probe = i2c_pnx_probe, 799 .probe = i2c_pnx_probe,
800 .remove = __devexit_p(i2c_pnx_remove), 800 .remove = i2c_pnx_remove,
801}; 801};
802 802
803static int __init i2c_adap_pnx_init(void) 803static int __init i2c_adap_pnx_init(void)
diff --git a/drivers/i2c/busses/i2c-powermac.c b/drivers/i2c/busses/i2c-powermac.c
index 5285f8565de4..0dd5b334d090 100644
--- a/drivers/i2c/busses/i2c-powermac.c
+++ b/drivers/i2c/busses/i2c-powermac.c
@@ -210,7 +210,7 @@ static const struct i2c_algorithm i2c_powermac_algorithm = {
210}; 210};
211 211
212 212
213static int __devexit i2c_powermac_remove(struct platform_device *dev) 213static int i2c_powermac_remove(struct platform_device *dev)
214{ 214{
215 struct i2c_adapter *adapter = platform_get_drvdata(dev); 215 struct i2c_adapter *adapter = platform_get_drvdata(dev);
216 int rc; 216 int rc;
@@ -227,7 +227,7 @@ static int __devexit i2c_powermac_remove(struct platform_device *dev)
227 return 0; 227 return 0;
228} 228}
229 229
230static u32 __devinit i2c_powermac_get_addr(struct i2c_adapter *adap, 230static u32 i2c_powermac_get_addr(struct i2c_adapter *adap,
231 struct pmac_i2c_bus *bus, 231 struct pmac_i2c_bus *bus,
232 struct device_node *node) 232 struct device_node *node)
233{ 233{
@@ -255,7 +255,7 @@ static u32 __devinit i2c_powermac_get_addr(struct i2c_adapter *adap,
255 return 0xffffffff; 255 return 0xffffffff;
256} 256}
257 257
258static void __devinit i2c_powermac_create_one(struct i2c_adapter *adap, 258static void i2c_powermac_create_one(struct i2c_adapter *adap,
259 const char *type, 259 const char *type,
260 u32 addr) 260 u32 addr)
261{ 261{
@@ -271,7 +271,7 @@ static void __devinit i2c_powermac_create_one(struct i2c_adapter *adap,
271 type); 271 type);
272} 272}
273 273
274static void __devinit i2c_powermac_add_missing(struct i2c_adapter *adap, 274static void i2c_powermac_add_missing(struct i2c_adapter *adap,
275 struct pmac_i2c_bus *bus, 275 struct pmac_i2c_bus *bus,
276 bool found_onyx) 276 bool found_onyx)
277{ 277{
@@ -297,7 +297,7 @@ static void __devinit i2c_powermac_add_missing(struct i2c_adapter *adap,
297 } 297 }
298} 298}
299 299
300static bool __devinit i2c_powermac_get_type(struct i2c_adapter *adap, 300static bool i2c_powermac_get_type(struct i2c_adapter *adap,
301 struct device_node *node, 301 struct device_node *node,
302 u32 addr, char *type, int type_size) 302 u32 addr, char *type, int type_size)
303{ 303{
@@ -336,7 +336,7 @@ static bool __devinit i2c_powermac_get_type(struct i2c_adapter *adap,
336 return false; 336 return false;
337} 337}
338 338
339static void __devinit i2c_powermac_register_devices(struct i2c_adapter *adap, 339static void i2c_powermac_register_devices(struct i2c_adapter *adap,
340 struct pmac_i2c_bus *bus) 340 struct pmac_i2c_bus *bus)
341{ 341{
342 struct i2c_client *newdev; 342 struct i2c_client *newdev;
@@ -403,7 +403,7 @@ static void __devinit i2c_powermac_register_devices(struct i2c_adapter *adap,
403 i2c_powermac_add_missing(adap, bus, found_onyx); 403 i2c_powermac_add_missing(adap, bus, found_onyx);
404} 404}
405 405
406static int __devinit i2c_powermac_probe(struct platform_device *dev) 406static int i2c_powermac_probe(struct platform_device *dev)
407{ 407{
408 struct pmac_i2c_bus *bus = dev->dev.platform_data; 408 struct pmac_i2c_bus *bus = dev->dev.platform_data;
409 struct device_node *parent = NULL; 409 struct device_node *parent = NULL;
@@ -467,7 +467,7 @@ static int __devinit i2c_powermac_probe(struct platform_device *dev)
467 467
468static struct platform_driver i2c_powermac_driver = { 468static struct platform_driver i2c_powermac_driver = {
469 .probe = i2c_powermac_probe, 469 .probe = i2c_powermac_probe,
470 .remove = __devexit_p(i2c_powermac_remove), 470 .remove = i2c_powermac_remove,
471 .driver = { 471 .driver = {
472 .name = "i2c-powermac", 472 .name = "i2c-powermac",
473 .bus = &platform_bus_type, 473 .bus = &platform_bus_type,
diff --git a/drivers/i2c/busses/i2c-puv3.c b/drivers/i2c/busses/i2c-puv3.c
index d8515be00b98..d7c512d717a7 100644
--- a/drivers/i2c/busses/i2c-puv3.c
+++ b/drivers/i2c/busses/i2c-puv3.c
@@ -184,7 +184,7 @@ static struct i2c_algorithm puv3_i2c_algorithm = {
184/* 184/*
185 * Main initialization routine. 185 * Main initialization routine.
186 */ 186 */
187static int __devinit puv3_i2c_probe(struct platform_device *pdev) 187static int puv3_i2c_probe(struct platform_device *pdev)
188{ 188{
189 struct i2c_adapter *adapter; 189 struct i2c_adapter *adapter;
190 struct resource *mem; 190 struct resource *mem;
@@ -231,7 +231,7 @@ fail_nomem:
231 return rc; 231 return rc;
232} 232}
233 233
234static int __devexit puv3_i2c_remove(struct platform_device *pdev) 234static int puv3_i2c_remove(struct platform_device *pdev)
235{ 235{
236 struct i2c_adapter *adapter = platform_get_drvdata(pdev); 236 struct i2c_adapter *adapter = platform_get_drvdata(pdev);
237 struct resource *mem; 237 struct resource *mem;
@@ -276,7 +276,7 @@ static SIMPLE_DEV_PM_OPS(puv3_i2c_pm, puv3_i2c_suspend, NULL);
276 276
277static struct platform_driver puv3_i2c_driver = { 277static struct platform_driver puv3_i2c_driver = {
278 .probe = puv3_i2c_probe, 278 .probe = puv3_i2c_probe,
279 .remove = __devexit_p(puv3_i2c_remove), 279 .remove = puv3_i2c_remove,
280 .driver = { 280 .driver = {
281 .name = "PKUnity-v3-I2C", 281 .name = "PKUnity-v3-I2C",
282 .owner = THIS_MODULE, 282 .owner = THIS_MODULE,
diff --git a/drivers/i2c/busses/i2c-pxa-pci.c b/drivers/i2c/busses/i2c-pxa-pci.c
index 4dc9bef17d77..3d4985695aed 100644
--- a/drivers/i2c/busses/i2c-pxa-pci.c
+++ b/drivers/i2c/busses/i2c-pxa-pci.c
@@ -94,7 +94,7 @@ out:
94 return ERR_PTR(ret); 94 return ERR_PTR(ret);
95} 95}
96 96
97static int __devinit ce4100_i2c_probe(struct pci_dev *dev, 97static int ce4100_i2c_probe(struct pci_dev *dev,
98 const struct pci_device_id *ent) 98 const struct pci_device_id *ent)
99{ 99{
100 int ret; 100 int ret;
@@ -135,7 +135,7 @@ err_mem:
135 return ret; 135 return ret;
136} 136}
137 137
138static void __devexit ce4100_i2c_remove(struct pci_dev *dev) 138static void ce4100_i2c_remove(struct pci_dev *dev)
139{ 139{
140 struct ce4100_devices *sds; 140 struct ce4100_devices *sds;
141 unsigned int i; 141 unsigned int i;
@@ -160,7 +160,7 @@ static struct pci_driver ce4100_i2c_driver = {
160 .name = "ce4100_i2c", 160 .name = "ce4100_i2c",
161 .id_table = ce4100_i2c_devices, 161 .id_table = ce4100_i2c_devices,
162 .probe = ce4100_i2c_probe, 162 .probe = ce4100_i2c_probe,
163 .remove = __devexit_p(ce4100_i2c_remove), 163 .remove = ce4100_i2c_remove,
164}; 164};
165 165
166module_pci_driver(ce4100_i2c_driver); 166module_pci_driver(ce4100_i2c_driver);
diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
index 72a8071a5556..9bd4d73d29e3 100644
--- a/drivers/i2c/busses/i2c-rcar.c
+++ b/drivers/i2c/busses/i2c-rcar.c
@@ -613,7 +613,7 @@ static const struct i2c_algorithm rcar_i2c_algo = {
613 .functionality = rcar_i2c_func, 613 .functionality = rcar_i2c_func,
614}; 614};
615 615
616static int __devinit rcar_i2c_probe(struct platform_device *pdev) 616static int rcar_i2c_probe(struct platform_device *pdev)
617{ 617{
618 struct i2c_rcar_platform_data *pdata = pdev->dev.platform_data; 618 struct i2c_rcar_platform_data *pdata = pdev->dev.platform_data;
619 struct rcar_i2c_priv *priv; 619 struct rcar_i2c_priv *priv;
@@ -682,7 +682,7 @@ static int __devinit rcar_i2c_probe(struct platform_device *pdev)
682 return 0; 682 return 0;
683} 683}
684 684
685static int __devexit rcar_i2c_remove(struct platform_device *pdev) 685static int rcar_i2c_remove(struct platform_device *pdev)
686{ 686{
687 struct rcar_i2c_priv *priv = platform_get_drvdata(pdev); 687 struct rcar_i2c_priv *priv = platform_get_drvdata(pdev);
688 struct device *dev = &pdev->dev; 688 struct device *dev = &pdev->dev;
@@ -699,7 +699,7 @@ static struct platform_driver rcar_i2c_driver = {
699 .owner = THIS_MODULE, 699 .owner = THIS_MODULE,
700 }, 700 },
701 .probe = rcar_i2c_probe, 701 .probe = rcar_i2c_probe,
702 .remove = __devexit_p(rcar_i2c_remove), 702 .remove = rcar_i2c_remove,
703}; 703};
704 704
705module_platform_driver(rcar_i2c_driver); 705module_platform_driver(rcar_i2c_driver);
diff --git a/drivers/i2c/busses/i2c-s6000.c b/drivers/i2c/busses/i2c-s6000.c
index b76a29d1f8e4..008836409efe 100644
--- a/drivers/i2c/busses/i2c-s6000.c
+++ b/drivers/i2c/busses/i2c-s6000.c
@@ -248,7 +248,7 @@ static struct i2c_algorithm s6i2c_algorithm = {
248 .functionality = s6i2c_functionality, 248 .functionality = s6i2c_functionality,
249}; 249};
250 250
251static u16 __devinit nanoseconds_on_clk(struct s6i2c_if *iface, u32 ns) 251static u16 nanoseconds_on_clk(struct s6i2c_if *iface, u32 ns)
252{ 252{
253 u32 dividend = ((clk_get_rate(iface->clk) / 1000) * ns) / 1000000; 253 u32 dividend = ((clk_get_rate(iface->clk) / 1000) * ns) / 1000000;
254 if (dividend > 0xffff) 254 if (dividend > 0xffff)
@@ -256,7 +256,7 @@ static u16 __devinit nanoseconds_on_clk(struct s6i2c_if *iface, u32 ns)
256 return dividend; 256 return dividend;
257} 257}
258 258
259static int __devinit s6i2c_probe(struct platform_device *dev) 259static int s6i2c_probe(struct platform_device *dev)
260{ 260{
261 struct s6i2c_if *iface = &s6i2c_if; 261 struct s6i2c_if *iface = &s6i2c_if;
262 struct i2c_adapter *p_adap; 262 struct i2c_adapter *p_adap;
@@ -361,7 +361,7 @@ err_out:
361 return rc; 361 return rc;
362} 362}
363 363
364static int __devexit s6i2c_remove(struct platform_device *pdev) 364static int s6i2c_remove(struct platform_device *pdev)
365{ 365{
366 struct s6i2c_if *iface = platform_get_drvdata(pdev); 366 struct s6i2c_if *iface = platform_get_drvdata(pdev);
367 i2c_wr16(iface, S6_I2C_ENABLE, 0); 367 i2c_wr16(iface, S6_I2C_ENABLE, 0);
@@ -378,7 +378,7 @@ static int __devexit s6i2c_remove(struct platform_device *pdev)
378 378
379static struct platform_driver s6i2c_driver = { 379static struct platform_driver s6i2c_driver = {
380 .probe = s6i2c_probe, 380 .probe = s6i2c_probe,
381 .remove = __devexit_p(s6i2c_remove), 381 .remove = s6i2c_remove,
382 .driver = { 382 .driver = {
383 .name = DRV_NAME, 383 .name = DRV_NAME,
384 .owner = THIS_MODULE, 384 .owner = THIS_MODULE,
diff --git a/drivers/i2c/busses/i2c-sh7760.c b/drivers/i2c/busses/i2c-sh7760.c
index c0c9dffbdb12..3a2253e1bf59 100644
--- a/drivers/i2c/busses/i2c-sh7760.c
+++ b/drivers/i2c/busses/i2c-sh7760.c
@@ -390,7 +390,7 @@ static const struct i2c_algorithm sh7760_i2c_algo = {
390 * iclk = mclk/(CDF + 1). iclk must be < 20MHz. 390 * iclk = mclk/(CDF + 1). iclk must be < 20MHz.
391 * scl = iclk/(SCGD*8 + 20). 391 * scl = iclk/(SCGD*8 + 20).
392 */ 392 */
393static int __devinit calc_CCR(unsigned long scl_hz) 393static int calc_CCR(unsigned long scl_hz)
394{ 394{
395 struct clk *mclk; 395 struct clk *mclk;
396 unsigned long mck, m1, dff, odff, iclk; 396 unsigned long mck, m1, dff, odff, iclk;
@@ -430,7 +430,7 @@ static int __devinit calc_CCR(unsigned long scl_hz)
430 return ((scgdm << 2) | cdfm); 430 return ((scgdm << 2) | cdfm);
431} 431}
432 432
433static int __devinit sh7760_i2c_probe(struct platform_device *pdev) 433static int sh7760_i2c_probe(struct platform_device *pdev)
434{ 434{
435 struct sh7760_i2c_platdata *pd; 435 struct sh7760_i2c_platdata *pd;
436 struct resource *res; 436 struct resource *res;
@@ -536,7 +536,7 @@ out0:
536 return ret; 536 return ret;
537} 537}
538 538
539static int __devexit sh7760_i2c_remove(struct platform_device *pdev) 539static int sh7760_i2c_remove(struct platform_device *pdev)
540{ 540{
541 struct cami2c *id = platform_get_drvdata(pdev); 541 struct cami2c *id = platform_get_drvdata(pdev);
542 542
@@ -557,7 +557,7 @@ static struct platform_driver sh7760_i2c_drv = {
557 .owner = THIS_MODULE, 557 .owner = THIS_MODULE,
558 }, 558 },
559 .probe = sh7760_i2c_probe, 559 .probe = sh7760_i2c_probe,
560 .remove = __devexit_p(sh7760_i2c_remove), 560 .remove = sh7760_i2c_remove,
561}; 561};
562 562
563module_platform_driver(sh7760_i2c_drv); 563module_platform_driver(sh7760_i2c_drv);
diff --git a/drivers/i2c/busses/i2c-sh_mobile.c b/drivers/i2c/busses/i2c-sh_mobile.c
index 9411c1b892c0..b6e7a83a8296 100644
--- a/drivers/i2c/busses/i2c-sh_mobile.c
+++ b/drivers/i2c/busses/i2c-sh_mobile.c
@@ -758,7 +758,7 @@ static const struct dev_pm_ops sh_mobile_i2c_dev_pm_ops = {
758 .runtime_resume = sh_mobile_i2c_runtime_nop, 758 .runtime_resume = sh_mobile_i2c_runtime_nop,
759}; 759};
760 760
761static const struct of_device_id sh_mobile_i2c_dt_ids[] __devinitconst = { 761static const struct of_device_id sh_mobile_i2c_dt_ids[] = {
762 { .compatible = "renesas,rmobile-iic", }, 762 { .compatible = "renesas,rmobile-iic", },
763 {}, 763 {},
764}; 764};
diff --git a/drivers/i2c/busses/i2c-sirf.c b/drivers/i2c/busses/i2c-sirf.c
index 5574a47792fb..3f1818b87974 100644
--- a/drivers/i2c/busses/i2c-sirf.c
+++ b/drivers/i2c/busses/i2c-sirf.c
@@ -258,7 +258,7 @@ static const struct i2c_algorithm i2c_sirfsoc_algo = {
258 .functionality = i2c_sirfsoc_func, 258 .functionality = i2c_sirfsoc_func,
259}; 259};
260 260
261static int __devinit i2c_sirfsoc_probe(struct platform_device *pdev) 261static int i2c_sirfsoc_probe(struct platform_device *pdev)
262{ 262{
263 struct sirfsoc_i2c *siic; 263 struct sirfsoc_i2c *siic;
264 struct i2c_adapter *adap; 264 struct i2c_adapter *adap;
@@ -385,7 +385,7 @@ err_get_clk:
385 return err; 385 return err;
386} 386}
387 387
388static int __devexit i2c_sirfsoc_remove(struct platform_device *pdev) 388static int i2c_sirfsoc_remove(struct platform_device *pdev)
389{ 389{
390 struct i2c_adapter *adapter = platform_get_drvdata(pdev); 390 struct i2c_adapter *adapter = platform_get_drvdata(pdev);
391 struct sirfsoc_i2c *siic = adapter->algo_data; 391 struct sirfsoc_i2c *siic = adapter->algo_data;
@@ -433,7 +433,7 @@ static const struct dev_pm_ops i2c_sirfsoc_pm_ops = {
433}; 433};
434#endif 434#endif
435 435
436static const struct of_device_id sirfsoc_i2c_of_match[] __devinitconst = { 436static const struct of_device_id sirfsoc_i2c_of_match[] = {
437 { .compatible = "sirf,prima2-i2c", }, 437 { .compatible = "sirf,prima2-i2c", },
438 {}, 438 {},
439}; 439};
@@ -449,7 +449,7 @@ static struct platform_driver i2c_sirfsoc_driver = {
449 .of_match_table = sirfsoc_i2c_of_match, 449 .of_match_table = sirfsoc_i2c_of_match,
450 }, 450 },
451 .probe = i2c_sirfsoc_probe, 451 .probe = i2c_sirfsoc_probe,
452 .remove = __devexit_p(i2c_sirfsoc_remove), 452 .remove = i2c_sirfsoc_remove,
453}; 453};
454module_platform_driver(i2c_sirfsoc_driver); 454module_platform_driver(i2c_sirfsoc_driver);
455 455
diff --git a/drivers/i2c/busses/i2c-sis5595.c b/drivers/i2c/busses/i2c-sis5595.c
index 87e5126d449c..79fd96a04386 100644
--- a/drivers/i2c/busses/i2c-sis5595.c
+++ b/drivers/i2c/busses/i2c-sis5595.c
@@ -142,7 +142,7 @@ static void sis5595_write(u8 reg, u8 data)
142 outb(data, sis5595_base + SMB_DAT); 142 outb(data, sis5595_base + SMB_DAT);
143} 143}
144 144
145static int __devinit sis5595_setup(struct pci_dev *SIS5595_dev) 145static int sis5595_setup(struct pci_dev *SIS5595_dev)
146{ 146{
147 u16 a; 147 u16 a;
148 u8 val; 148 u8 val;
@@ -376,7 +376,7 @@ static DEFINE_PCI_DEVICE_TABLE(sis5595_ids) = {
376 376
377MODULE_DEVICE_TABLE (pci, sis5595_ids); 377MODULE_DEVICE_TABLE (pci, sis5595_ids);
378 378
379static int __devinit sis5595_probe(struct pci_dev *dev, const struct pci_device_id *id) 379static int sis5595_probe(struct pci_dev *dev, const struct pci_device_id *id)
380{ 380{
381 int err; 381 int err;
382 382
diff --git a/drivers/i2c/busses/i2c-sis630.c b/drivers/i2c/busses/i2c-sis630.c
index 5d6723b7525e..de6dddb9f865 100644
--- a/drivers/i2c/busses/i2c-sis630.c
+++ b/drivers/i2c/busses/i2c-sis630.c
@@ -389,7 +389,7 @@ static u32 sis630_func(struct i2c_adapter *adapter)
389 I2C_FUNC_SMBUS_BLOCK_DATA; 389 I2C_FUNC_SMBUS_BLOCK_DATA;
390} 390}
391 391
392static int __devinit sis630_setup(struct pci_dev *sis630_dev) 392static int sis630_setup(struct pci_dev *sis630_dev)
393{ 393{
394 unsigned char b; 394 unsigned char b;
395 struct pci_dev *dummy = NULL; 395 struct pci_dev *dummy = NULL;
@@ -480,7 +480,7 @@ static DEFINE_PCI_DEVICE_TABLE(sis630_ids) = {
480 480
481MODULE_DEVICE_TABLE (pci, sis630_ids); 481MODULE_DEVICE_TABLE (pci, sis630_ids);
482 482
483static int __devinit sis630_probe(struct pci_dev *dev, const struct pci_device_id *id) 483static int sis630_probe(struct pci_dev *dev, const struct pci_device_id *id)
484{ 484{
485 if (sis630_setup(dev)) { 485 if (sis630_setup(dev)) {
486 dev_err(&dev->dev, "SIS630 comp. bus not detected, module not inserted.\n"); 486 dev_err(&dev->dev, "SIS630 comp. bus not detected, module not inserted.\n");
@@ -496,7 +496,7 @@ static int __devinit sis630_probe(struct pci_dev *dev, const struct pci_device_i
496 return i2c_add_adapter(&sis630_adapter); 496 return i2c_add_adapter(&sis630_adapter);
497} 497}
498 498
499static void __devexit sis630_remove(struct pci_dev *dev) 499static void sis630_remove(struct pci_dev *dev)
500{ 500{
501 if (acpi_base) { 501 if (acpi_base) {
502 i2c_del_adapter(&sis630_adapter); 502 i2c_del_adapter(&sis630_adapter);
@@ -510,7 +510,7 @@ static struct pci_driver sis630_driver = {
510 .name = "sis630_smbus", 510 .name = "sis630_smbus",
511 .id_table = sis630_ids, 511 .id_table = sis630_ids,
512 .probe = sis630_probe, 512 .probe = sis630_probe,
513 .remove = __devexit_p(sis630_remove), 513 .remove = sis630_remove,
514}; 514};
515 515
516module_pci_driver(sis630_driver); 516module_pci_driver(sis630_driver);
diff --git a/drivers/i2c/busses/i2c-sis96x.c b/drivers/i2c/busses/i2c-sis96x.c
index 7b72614a9bc0..b9faf9b6002b 100644
--- a/drivers/i2c/busses/i2c-sis96x.c
+++ b/drivers/i2c/busses/i2c-sis96x.c
@@ -252,7 +252,7 @@ static DEFINE_PCI_DEVICE_TABLE(sis96x_ids) = {
252 252
253MODULE_DEVICE_TABLE (pci, sis96x_ids); 253MODULE_DEVICE_TABLE (pci, sis96x_ids);
254 254
255static int __devinit sis96x_probe(struct pci_dev *dev, 255static int sis96x_probe(struct pci_dev *dev,
256 const struct pci_device_id *id) 256 const struct pci_device_id *id)
257{ 257{
258 u16 ww = 0; 258 u16 ww = 0;
@@ -308,7 +308,7 @@ static int __devinit sis96x_probe(struct pci_dev *dev,
308 return retval; 308 return retval;
309} 309}
310 310
311static void __devexit sis96x_remove(struct pci_dev *dev) 311static void sis96x_remove(struct pci_dev *dev)
312{ 312{
313 if (sis96x_smbus_base) { 313 if (sis96x_smbus_base) {
314 i2c_del_adapter(&sis96x_adapter); 314 i2c_del_adapter(&sis96x_adapter);
@@ -321,7 +321,7 @@ static struct pci_driver sis96x_driver = {
321 .name = "sis96x_smbus", 321 .name = "sis96x_smbus",
322 .id_table = sis96x_ids, 322 .id_table = sis96x_ids,
323 .probe = sis96x_probe, 323 .probe = sis96x_probe,
324 .remove = __devexit_p(sis96x_remove), 324 .remove = sis96x_remove,
325}; 325};
326 326
327module_pci_driver(sis96x_driver); 327module_pci_driver(sis96x_driver);
diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
index dcea77bf6f50..7b38877ffec1 100644
--- a/drivers/i2c/busses/i2c-tegra.c
+++ b/drivers/i2c/busses/i2c-tegra.c
@@ -642,7 +642,7 @@ static const struct tegra_i2c_hw_feature tegra30_i2c_hw = {
642 642
643#if defined(CONFIG_OF) 643#if defined(CONFIG_OF)
644/* Match table for of_platform binding */ 644/* Match table for of_platform binding */
645static const struct of_device_id tegra_i2c_of_match[] __devinitconst = { 645static const struct of_device_id tegra_i2c_of_match[] = {
646 { .compatible = "nvidia,tegra30-i2c", .data = &tegra30_i2c_hw, }, 646 { .compatible = "nvidia,tegra30-i2c", .data = &tegra30_i2c_hw, },
647 { .compatible = "nvidia,tegra20-i2c", .data = &tegra20_i2c_hw, }, 647 { .compatible = "nvidia,tegra20-i2c", .data = &tegra20_i2c_hw, },
648 { .compatible = "nvidia,tegra20-i2c-dvc", .data = &tegra20_i2c_hw, }, 648 { .compatible = "nvidia,tegra20-i2c-dvc", .data = &tegra20_i2c_hw, },
@@ -651,7 +651,7 @@ static const struct of_device_id tegra_i2c_of_match[] __devinitconst = {
651MODULE_DEVICE_TABLE(of, tegra_i2c_of_match); 651MODULE_DEVICE_TABLE(of, tegra_i2c_of_match);
652#endif 652#endif
653 653
654static int __devinit tegra_i2c_probe(struct platform_device *pdev) 654static int tegra_i2c_probe(struct platform_device *pdev)
655{ 655{
656 struct tegra_i2c_dev *i2c_dev; 656 struct tegra_i2c_dev *i2c_dev;
657 struct tegra_i2c_platform_data *pdata = pdev->dev.platform_data; 657 struct tegra_i2c_platform_data *pdata = pdev->dev.platform_data;
@@ -769,7 +769,7 @@ static int __devinit tegra_i2c_probe(struct platform_device *pdev)
769 return 0; 769 return 0;
770} 770}
771 771
772static int __devexit tegra_i2c_remove(struct platform_device *pdev) 772static int tegra_i2c_remove(struct platform_device *pdev)
773{ 773{
774 struct tegra_i2c_dev *i2c_dev = platform_get_drvdata(pdev); 774 struct tegra_i2c_dev *i2c_dev = platform_get_drvdata(pdev);
775 i2c_del_adapter(&i2c_dev->adapter); 775 i2c_del_adapter(&i2c_dev->adapter);
@@ -817,7 +817,7 @@ static SIMPLE_DEV_PM_OPS(tegra_i2c_pm, tegra_i2c_suspend, tegra_i2c_resume);
817 817
818static struct platform_driver tegra_i2c_driver = { 818static struct platform_driver tegra_i2c_driver = {
819 .probe = tegra_i2c_probe, 819 .probe = tegra_i2c_probe,
820 .remove = __devexit_p(tegra_i2c_remove), 820 .remove = tegra_i2c_remove,
821 .driver = { 821 .driver = {
822 .name = "tegra-i2c", 822 .name = "tegra-i2c",
823 .owner = THIS_MODULE, 823 .owner = THIS_MODULE,
diff --git a/drivers/i2c/busses/i2c-via.c b/drivers/i2c/busses/i2c-via.c
index 7ffee71ca190..be662511c58b 100644
--- a/drivers/i2c/busses/i2c-via.c
+++ b/drivers/i2c/busses/i2c-via.c
@@ -96,7 +96,7 @@ static DEFINE_PCI_DEVICE_TABLE(vt586b_ids) = {
96 96
97MODULE_DEVICE_TABLE (pci, vt586b_ids); 97MODULE_DEVICE_TABLE (pci, vt586b_ids);
98 98
99static int __devinit vt586b_probe(struct pci_dev *dev, const struct pci_device_id *id) 99static int vt586b_probe(struct pci_dev *dev, const struct pci_device_id *id)
100{ 100{
101 u16 base; 101 u16 base;
102 u8 rev; 102 u8 rev;
@@ -146,7 +146,7 @@ static int __devinit vt586b_probe(struct pci_dev *dev, const struct pci_device_i
146 return 0; 146 return 0;
147} 147}
148 148
149static void __devexit vt586b_remove(struct pci_dev *dev) 149static void vt586b_remove(struct pci_dev *dev)
150{ 150{
151 i2c_del_adapter(&vt586b_adapter); 151 i2c_del_adapter(&vt586b_adapter);
152 release_region(I2C_DIR, IOSPACE); 152 release_region(I2C_DIR, IOSPACE);
@@ -158,7 +158,7 @@ static struct pci_driver vt586b_driver = {
158 .name = "vt586b_smbus", 158 .name = "vt586b_smbus",
159 .id_table = vt586b_ids, 159 .id_table = vt586b_ids,
160 .probe = vt586b_probe, 160 .probe = vt586b_probe,
161 .remove = __devexit_p(vt586b_remove), 161 .remove = vt586b_remove,
162}; 162};
163 163
164module_pci_driver(vt586b_driver); 164module_pci_driver(vt586b_driver);
diff --git a/drivers/i2c/busses/i2c-viapro.c b/drivers/i2c/busses/i2c-viapro.c
index 271c9a2b0fd7..b2d90e105f41 100644
--- a/drivers/i2c/busses/i2c-viapro.c
+++ b/drivers/i2c/busses/i2c-viapro.c
@@ -320,8 +320,8 @@ static struct i2c_adapter vt596_adapter = {
320 .algo = &smbus_algorithm, 320 .algo = &smbus_algorithm,
321}; 321};
322 322
323static int __devinit vt596_probe(struct pci_dev *pdev, 323static int vt596_probe(struct pci_dev *pdev,
324 const struct pci_device_id *id) 324 const struct pci_device_id *id)
325{ 325{
326 unsigned char temp; 326 unsigned char temp;
327 int error; 327 int error;
diff --git a/drivers/i2c/busses/i2c-viperboard.c b/drivers/i2c/busses/i2c-viperboard.c
index f5fa20dea906..f45c32c1ace6 100644
--- a/drivers/i2c/busses/i2c-viperboard.c
+++ b/drivers/i2c/busses/i2c-viperboard.c
@@ -360,7 +360,7 @@ static const struct i2c_algorithm vprbrd_algorithm = {
360 .functionality = vprbrd_i2c_func, 360 .functionality = vprbrd_i2c_func,
361}; 361};
362 362
363static int __devinit vprbrd_i2c_probe(struct platform_device *pdev) 363static int vprbrd_i2c_probe(struct platform_device *pdev)
364{ 364{
365 struct vprbrd *vb = dev_get_drvdata(pdev->dev.parent); 365 struct vprbrd *vb = dev_get_drvdata(pdev->dev.parent);
366 struct vprbrd_i2c *vb_i2c; 366 struct vprbrd_i2c *vb_i2c;
@@ -418,7 +418,7 @@ error:
418 return ret; 418 return ret;
419} 419}
420 420
421static int __devexit vprbrd_i2c_remove(struct platform_device *pdev) 421static int vprbrd_i2c_remove(struct platform_device *pdev)
422{ 422{
423 struct vprbrd_i2c *vb_i2c = platform_get_drvdata(pdev); 423 struct vprbrd_i2c *vb_i2c = platform_get_drvdata(pdev);
424 int ret; 424 int ret;
@@ -432,7 +432,7 @@ static struct platform_driver vprbrd_i2c_driver = {
432 .driver.name = "viperboard-i2c", 432 .driver.name = "viperboard-i2c",
433 .driver.owner = THIS_MODULE, 433 .driver.owner = THIS_MODULE,
434 .probe = vprbrd_i2c_probe, 434 .probe = vprbrd_i2c_probe,
435 .remove = __devexit_p(vprbrd_i2c_remove), 435 .remove = vprbrd_i2c_remove,
436}; 436};
437 437
438static int __init vprbrd_i2c_init(void) 438static int __init vprbrd_i2c_init(void)
diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c
index 641d0e5e3303..f042f6da0ace 100644
--- a/drivers/i2c/busses/i2c-xiic.c
+++ b/drivers/i2c/busses/i2c-xiic.c
@@ -689,7 +689,7 @@ static struct i2c_adapter xiic_adapter = {
689}; 689};
690 690
691 691
692static int __devinit xiic_i2c_probe(struct platform_device *pdev) 692static int xiic_i2c_probe(struct platform_device *pdev)
693{ 693{
694 struct xiic_i2c *i2c; 694 struct xiic_i2c *i2c;
695 struct xiic_i2c_platform_data *pdata; 695 struct xiic_i2c_platform_data *pdata;
@@ -774,7 +774,7 @@ resource_missing:
774 return -ENOENT; 774 return -ENOENT;
775} 775}
776 776
777static int __devexit xiic_i2c_remove(struct platform_device* pdev) 777static int xiic_i2c_remove(struct platform_device *pdev)
778{ 778{
779 struct xiic_i2c *i2c = platform_get_drvdata(pdev); 779 struct xiic_i2c *i2c = platform_get_drvdata(pdev);
780 struct resource *res; 780 struct resource *res;
@@ -800,7 +800,7 @@ static int __devexit xiic_i2c_remove(struct platform_device* pdev)
800} 800}
801 801
802#if defined(CONFIG_OF) 802#if defined(CONFIG_OF)
803static const struct of_device_id xiic_of_match[] __devinitconst = { 803static const struct of_device_id xiic_of_match[] = {
804 { .compatible = "xlnx,xps-iic-2.00.a", }, 804 { .compatible = "xlnx,xps-iic-2.00.a", },
805 {}, 805 {},
806}; 806};
@@ -809,7 +809,7 @@ MODULE_DEVICE_TABLE(of, xiic_of_match);
809 809
810static struct platform_driver xiic_i2c_driver = { 810static struct platform_driver xiic_i2c_driver = {
811 .probe = xiic_i2c_probe, 811 .probe = xiic_i2c_probe,
812 .remove = __devexit_p(xiic_i2c_remove), 812 .remove = xiic_i2c_remove,
813 .driver = { 813 .driver = {
814 .owner = THIS_MODULE, 814 .owner = THIS_MODULE,
815 .name = DRIVER_NAME, 815 .name = DRIVER_NAME,
diff --git a/drivers/i2c/busses/i2c-xlr.c b/drivers/i2c/busses/i2c-xlr.c
index 96d3fabd8883..a005265461da 100644
--- a/drivers/i2c/busses/i2c-xlr.c
+++ b/drivers/i2c/busses/i2c-xlr.c
@@ -214,7 +214,7 @@ static struct i2c_algorithm xlr_i2c_algo = {
214 .functionality = xlr_func, 214 .functionality = xlr_func,
215}; 215};
216 216
217static int __devinit xlr_i2c_probe(struct platform_device *pdev) 217static int xlr_i2c_probe(struct platform_device *pdev)
218{ 218{
219 struct xlr_i2c_private *priv; 219 struct xlr_i2c_private *priv;
220 struct resource *res; 220 struct resource *res;
@@ -251,7 +251,7 @@ static int __devinit xlr_i2c_probe(struct platform_device *pdev)
251 return 0; 251 return 0;
252} 252}
253 253
254static int __devexit xlr_i2c_remove(struct platform_device *pdev) 254static int xlr_i2c_remove(struct platform_device *pdev)
255{ 255{
256 struct xlr_i2c_private *priv; 256 struct xlr_i2c_private *priv;
257 257
@@ -263,7 +263,7 @@ static int __devexit xlr_i2c_remove(struct platform_device *pdev)
263 263
264static struct platform_driver xlr_i2c_driver = { 264static struct platform_driver xlr_i2c_driver = {
265 .probe = xlr_i2c_probe, 265 .probe = xlr_i2c_probe,
266 .remove = __devexit_p(xlr_i2c_remove), 266 .remove = xlr_i2c_remove,
267 .driver = { 267 .driver = {
268 .name = "xlr-i2cbus", 268 .name = "xlr-i2cbus",
269 .owner = THIS_MODULE, 269 .owner = THIS_MODULE,
diff --git a/drivers/i2c/busses/scx200_acb.c b/drivers/i2c/busses/scx200_acb.c
index 08aab57337dd..3862a953239c 100644
--- a/drivers/i2c/busses/scx200_acb.c
+++ b/drivers/i2c/busses/scx200_acb.c
@@ -389,7 +389,7 @@ static const struct i2c_algorithm scx200_acb_algorithm = {
389static struct scx200_acb_iface *scx200_acb_list; 389static struct scx200_acb_iface *scx200_acb_list;
390static DEFINE_MUTEX(scx200_acb_list_mutex); 390static DEFINE_MUTEX(scx200_acb_list_mutex);
391 391
392static __devinit int scx200_acb_probe(struct scx200_acb_iface *iface) 392static int scx200_acb_probe(struct scx200_acb_iface *iface)
393{ 393{
394 u8 val; 394 u8 val;
395 395
@@ -424,7 +424,7 @@ static __devinit int scx200_acb_probe(struct scx200_acb_iface *iface)
424 return 0; 424 return 0;
425} 425}
426 426
427static __devinit struct scx200_acb_iface *scx200_create_iface(const char *text, 427static struct scx200_acb_iface *scx200_create_iface(const char *text,
428 struct device *dev, int index) 428 struct device *dev, int index)
429{ 429{
430 struct scx200_acb_iface *iface; 430 struct scx200_acb_iface *iface;
@@ -449,7 +449,7 @@ static __devinit struct scx200_acb_iface *scx200_create_iface(const char *text,
449 return iface; 449 return iface;
450} 450}
451 451
452static int __devinit scx200_acb_create(struct scx200_acb_iface *iface) 452static int scx200_acb_create(struct scx200_acb_iface *iface)
453{ 453{
454 struct i2c_adapter *adapter; 454 struct i2c_adapter *adapter;
455 int rc; 455 int rc;
@@ -480,7 +480,7 @@ static int __devinit scx200_acb_create(struct scx200_acb_iface *iface)
480 return 0; 480 return 0;
481} 481}
482 482
483static struct scx200_acb_iface * __devinit scx200_create_dev(const char *text, 483static struct scx200_acb_iface *scx200_create_dev(const char *text,
484 unsigned long base, int index, struct device *dev) 484 unsigned long base, int index, struct device *dev)
485{ 485{
486 struct scx200_acb_iface *iface; 486 struct scx200_acb_iface *iface;
@@ -508,7 +508,7 @@ static struct scx200_acb_iface * __devinit scx200_create_dev(const char *text,
508 return NULL; 508 return NULL;
509} 509}
510 510
511static int __devinit scx200_probe(struct platform_device *pdev) 511static int scx200_probe(struct platform_device *pdev)
512{ 512{
513 struct scx200_acb_iface *iface; 513 struct scx200_acb_iface *iface;
514 struct resource *res; 514 struct resource *res;
@@ -530,14 +530,14 @@ static int __devinit scx200_probe(struct platform_device *pdev)
530 return 0; 530 return 0;
531} 531}
532 532
533static void __devexit scx200_cleanup_iface(struct scx200_acb_iface *iface) 533static void scx200_cleanup_iface(struct scx200_acb_iface *iface)
534{ 534{
535 i2c_del_adapter(&iface->adapter); 535 i2c_del_adapter(&iface->adapter);
536 release_region(iface->base, 8); 536 release_region(iface->base, 8);
537 kfree(iface); 537 kfree(iface);
538} 538}
539 539
540static int __devexit scx200_remove(struct platform_device *pdev) 540static int scx200_remove(struct platform_device *pdev)
541{ 541{
542 struct scx200_acb_iface *iface; 542 struct scx200_acb_iface *iface;
543 543
@@ -554,7 +554,7 @@ static struct platform_driver scx200_pci_driver = {
554 .owner = THIS_MODULE, 554 .owner = THIS_MODULE,
555 }, 555 },
556 .probe = scx200_probe, 556 .probe = scx200_probe,
557 .remove = __devexit_p(scx200_remove), 557 .remove = scx200_remove,
558}; 558};
559 559
560static DEFINE_PCI_DEVICE_TABLE(scx200_isa) = { 560static DEFINE_PCI_DEVICE_TABLE(scx200_isa) = {
diff --git a/drivers/i2c/muxes/i2c-mux-gpio.c b/drivers/i2c/muxes/i2c-mux-gpio.c
index 3b7bc06fe8a6..9f50ef04a4bd 100644
--- a/drivers/i2c/muxes/i2c-mux-gpio.c
+++ b/drivers/i2c/muxes/i2c-mux-gpio.c
@@ -53,14 +53,14 @@ static int i2c_mux_gpio_deselect(struct i2c_adapter *adap, void *data, u32 chan)
53 return 0; 53 return 0;
54} 54}
55 55
56static int __devinit match_gpio_chip_by_label(struct gpio_chip *chip, 56static int match_gpio_chip_by_label(struct gpio_chip *chip,
57 void *data) 57 void *data)
58{ 58{
59 return !strcmp(chip->label, data); 59 return !strcmp(chip->label, data);
60} 60}
61 61
62#ifdef CONFIG_OF 62#ifdef CONFIG_OF
63static int __devinit i2c_mux_gpio_probe_dt(struct gpiomux *mux, 63static int i2c_mux_gpio_probe_dt(struct gpiomux *mux,
64 struct platform_device *pdev) 64 struct platform_device *pdev)
65{ 65{
66 struct device_node *np = pdev->dev.of_node; 66 struct device_node *np = pdev->dev.of_node;
@@ -125,14 +125,14 @@ static int __devinit i2c_mux_gpio_probe_dt(struct gpiomux *mux,
125 return 0; 125 return 0;
126} 126}
127#else 127#else
128static int __devinit i2c_mux_gpio_probe_dt(struct gpiomux *mux, 128static int i2c_mux_gpio_probe_dt(struct gpiomux *mux,
129 struct platform_device *pdev) 129 struct platform_device *pdev)
130{ 130{
131 return 0; 131 return 0;
132} 132}
133#endif 133#endif
134 134
135static int __devinit i2c_mux_gpio_probe(struct platform_device *pdev) 135static int i2c_mux_gpio_probe(struct platform_device *pdev)
136{ 136{
137 struct gpiomux *mux; 137 struct gpiomux *mux;
138 struct i2c_adapter *parent; 138 struct i2c_adapter *parent;
@@ -239,7 +239,7 @@ alloc_failed:
239 return ret; 239 return ret;
240} 240}
241 241
242static int __devexit i2c_mux_gpio_remove(struct platform_device *pdev) 242static int i2c_mux_gpio_remove(struct platform_device *pdev)
243{ 243{
244 struct gpiomux *mux = platform_get_drvdata(pdev); 244 struct gpiomux *mux = platform_get_drvdata(pdev);
245 int i; 245 int i;
@@ -256,7 +256,7 @@ static int __devexit i2c_mux_gpio_remove(struct platform_device *pdev)
256 return 0; 256 return 0;
257} 257}
258 258
259static const struct of_device_id i2c_mux_gpio_of_match[] __devinitconst = { 259static const struct of_device_id i2c_mux_gpio_of_match[] = {
260 { .compatible = "i2c-mux-gpio", }, 260 { .compatible = "i2c-mux-gpio", },
261 {}, 261 {},
262}; 262};
@@ -264,7 +264,7 @@ MODULE_DEVICE_TABLE(of, i2c_mux_gpio_of_match);
264 264
265static struct platform_driver i2c_mux_gpio_driver = { 265static struct platform_driver i2c_mux_gpio_driver = {
266 .probe = i2c_mux_gpio_probe, 266 .probe = i2c_mux_gpio_probe,
267 .remove = __devexit_p(i2c_mux_gpio_remove), 267 .remove = i2c_mux_gpio_remove,
268 .driver = { 268 .driver = {
269 .owner = THIS_MODULE, 269 .owner = THIS_MODULE,
270 .name = "i2c-mux-gpio", 270 .name = "i2c-mux-gpio",
diff --git a/drivers/i2c/muxes/i2c-mux-pinctrl.c b/drivers/i2c/muxes/i2c-mux-pinctrl.c
index 7fa5b24b16db..1e44d04d1b22 100644
--- a/drivers/i2c/muxes/i2c-mux-pinctrl.c
+++ b/drivers/i2c/muxes/i2c-mux-pinctrl.c
@@ -129,7 +129,7 @@ static inline int i2c_mux_pinctrl_parse_dt(struct i2c_mux_pinctrl *mux,
129} 129}
130#endif 130#endif
131 131
132static int __devinit i2c_mux_pinctrl_probe(struct platform_device *pdev) 132static int i2c_mux_pinctrl_probe(struct platform_device *pdev)
133{ 133{
134 struct i2c_mux_pinctrl *mux; 134 struct i2c_mux_pinctrl *mux;
135 int (*deselect)(struct i2c_adapter *, void *, u32); 135 int (*deselect)(struct i2c_adapter *, void *, u32);
@@ -241,7 +241,7 @@ err:
241 return ret; 241 return ret;
242} 242}
243 243
244static int __devexit i2c_mux_pinctrl_remove(struct platform_device *pdev) 244static int i2c_mux_pinctrl_remove(struct platform_device *pdev)
245{ 245{
246 struct i2c_mux_pinctrl *mux = platform_get_drvdata(pdev); 246 struct i2c_mux_pinctrl *mux = platform_get_drvdata(pdev);
247 int i; 247 int i;
@@ -255,7 +255,7 @@ static int __devexit i2c_mux_pinctrl_remove(struct platform_device *pdev)
255} 255}
256 256
257#ifdef CONFIG_OF 257#ifdef CONFIG_OF
258static const struct of_device_id i2c_mux_pinctrl_of_match[] __devinitconst = { 258static const struct of_device_id i2c_mux_pinctrl_of_match[] = {
259 { .compatible = "i2c-mux-pinctrl", }, 259 { .compatible = "i2c-mux-pinctrl", },
260 {}, 260 {},
261}; 261};
@@ -269,7 +269,7 @@ static struct platform_driver i2c_mux_pinctrl_driver = {
269 .of_match_table = of_match_ptr(i2c_mux_pinctrl_of_match), 269 .of_match_table = of_match_ptr(i2c_mux_pinctrl_of_match),
270 }, 270 },
271 .probe = i2c_mux_pinctrl_probe, 271 .probe = i2c_mux_pinctrl_probe,
272 .remove = __devexit_p(i2c_mux_pinctrl_remove), 272 .remove = i2c_mux_pinctrl_remove,
273}; 273};
274module_platform_driver(i2c_mux_pinctrl_driver); 274module_platform_driver(i2c_mux_pinctrl_driver);
275 275
diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
index 1885a26776b1..a0d931bcb37c 100644
--- a/drivers/leds/leds-gpio.c
+++ b/drivers/leds/leds-gpio.c
@@ -127,8 +127,9 @@ static int create_gpio_led(const struct gpio_led *template,
127 led_dat->cdev.flags |= LED_CORE_SUSPENDRESUME; 127 led_dat->cdev.flags |= LED_CORE_SUSPENDRESUME;
128 128
129 ret = devm_gpio_request_one(parent, template->gpio, 129 ret = devm_gpio_request_one(parent, template->gpio,
130 GPIOF_DIR_OUT | (led_dat->active_low ^ state), 130 (led_dat->active_low ^ state) ?
131 template->name); 131 GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW,
132 template->name);
132 if (ret < 0) 133 if (ret < 0)
133 return ret; 134 return ret;
134 135
diff --git a/drivers/media/platform/omap3isp/isp.c b/drivers/media/platform/omap3isp/isp.c
index a9f6de5b69d8..2e8c0cb79c3d 100644
--- a/drivers/media/platform/omap3isp/isp.c
+++ b/drivers/media/platform/omap3isp/isp.c
@@ -71,8 +71,6 @@
71#include <media/v4l2-common.h> 71#include <media/v4l2-common.h>
72#include <media/v4l2-device.h> 72#include <media/v4l2-device.h>
73 73
74#include <plat/cpu.h>
75
76#include "isp.h" 74#include "isp.h"
77#include "ispreg.h" 75#include "ispreg.h"
78#include "ispccdc.h" 76#include "ispccdc.h"
diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c
index 516a5b188ea5..2bb7613ddebb 100644
--- a/drivers/media/usb/uvc/uvc_ctrl.c
+++ b/drivers/media/usb/uvc/uvc_ctrl.c
@@ -1061,7 +1061,7 @@ int uvc_query_v4l2_ctrl(struct uvc_video_chain *chain,
1061 1061
1062 ctrl = uvc_find_control(chain, v4l2_ctrl->id, &mapping); 1062 ctrl = uvc_find_control(chain, v4l2_ctrl->id, &mapping);
1063 if (ctrl == NULL) { 1063 if (ctrl == NULL) {
1064 ret = -ENOENT; 1064 ret = -EINVAL;
1065 goto done; 1065 goto done;
1066 } 1066 }
1067 1067
@@ -1099,13 +1099,12 @@ int uvc_query_v4l2_menu(struct uvc_video_chain *chain,
1099 return -ERESTARTSYS; 1099 return -ERESTARTSYS;
1100 1100
1101 ctrl = uvc_find_control(chain, query_menu->id, &mapping); 1101 ctrl = uvc_find_control(chain, query_menu->id, &mapping);
1102 if (ctrl == NULL) { 1102 if (ctrl == NULL || mapping->v4l2_type != V4L2_CTRL_TYPE_MENU) {
1103 ret = -ENOENT; 1103 ret = -EINVAL;
1104 goto done; 1104 goto done;
1105 } 1105 }
1106 1106
1107 if (mapping->v4l2_type != V4L2_CTRL_TYPE_MENU || 1107 if (query_menu->index >= mapping->menu_count) {
1108 query_menu->index >= mapping->menu_count) {
1109 ret = -EINVAL; 1108 ret = -EINVAL;
1110 goto done; 1109 goto done;
1111 } 1110 }
@@ -1264,7 +1263,7 @@ static int uvc_ctrl_add_event(struct v4l2_subscribed_event *sev, unsigned elems)
1264 1263
1265 ctrl = uvc_find_control(handle->chain, sev->id, &mapping); 1264 ctrl = uvc_find_control(handle->chain, sev->id, &mapping);
1266 if (ctrl == NULL) { 1265 if (ctrl == NULL) {
1267 ret = -ENOENT; 1266 ret = -EINVAL;
1268 goto done; 1267 goto done;
1269 } 1268 }
1270 1269
@@ -1415,7 +1414,7 @@ int uvc_ctrl_get(struct uvc_video_chain *chain,
1415 1414
1416 ctrl = uvc_find_control(chain, xctrl->id, &mapping); 1415 ctrl = uvc_find_control(chain, xctrl->id, &mapping);
1417 if (ctrl == NULL) 1416 if (ctrl == NULL)
1418 return -ENOENT; 1417 return -EINVAL;
1419 1418
1420 return __uvc_ctrl_get(chain, ctrl, mapping, &xctrl->value); 1419 return __uvc_ctrl_get(chain, ctrl, mapping, &xctrl->value);
1421} 1420}
@@ -1432,10 +1431,8 @@ int uvc_ctrl_set(struct uvc_video_chain *chain,
1432 int ret; 1431 int ret;
1433 1432
1434 ctrl = uvc_find_control(chain, xctrl->id, &mapping); 1433 ctrl = uvc_find_control(chain, xctrl->id, &mapping);
1435 if (ctrl == NULL) 1434 if (ctrl == NULL || (ctrl->info.flags & UVC_CTRL_FLAG_SET_CUR) == 0)
1436 return -ENOENT; 1435 return -EINVAL;
1437 if (!(ctrl->info.flags & UVC_CTRL_FLAG_SET_CUR))
1438 return -EACCES;
1439 1436
1440 /* Clamp out of range values. */ 1437 /* Clamp out of range values. */
1441 switch (mapping->v4l2_type) { 1438 switch (mapping->v4l2_type) {
diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c
index 8e056046bc20..f2ee8c6b0d8d 100644
--- a/drivers/media/usb/uvc/uvc_v4l2.c
+++ b/drivers/media/usb/uvc/uvc_v4l2.c
@@ -607,10 +607,8 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
607 607
608 ret = uvc_ctrl_get(chain, &xctrl); 608 ret = uvc_ctrl_get(chain, &xctrl);
609 uvc_ctrl_rollback(handle); 609 uvc_ctrl_rollback(handle);
610 if (ret < 0) 610 if (ret >= 0)
611 return ret == -ENOENT ? -EINVAL : ret; 611 ctrl->value = xctrl.value;
612
613 ctrl->value = xctrl.value;
614 break; 612 break;
615 } 613 }
616 614
@@ -634,7 +632,7 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
634 ret = uvc_ctrl_set(chain, &xctrl); 632 ret = uvc_ctrl_set(chain, &xctrl);
635 if (ret < 0) { 633 if (ret < 0) {
636 uvc_ctrl_rollback(handle); 634 uvc_ctrl_rollback(handle);
637 return ret == -ENOENT ? -EINVAL : ret; 635 return ret;
638 } 636 }
639 ret = uvc_ctrl_commit(handle, &xctrl, 1); 637 ret = uvc_ctrl_commit(handle, &xctrl, 1);
640 if (ret == 0) 638 if (ret == 0)
@@ -661,7 +659,7 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
661 uvc_ctrl_rollback(handle); 659 uvc_ctrl_rollback(handle);
662 ctrls->error_idx = ret == -ENOENT 660 ctrls->error_idx = ret == -ENOENT
663 ? ctrls->count : i; 661 ? ctrls->count : i;
664 return ret == -ENOENT ? -EINVAL : ret; 662 return ret;
665 } 663 }
666 } 664 }
667 ctrls->error_idx = 0; 665 ctrls->error_idx = 0;
@@ -691,7 +689,7 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
691 ctrls->error_idx = (ret == -ENOENT && 689 ctrls->error_idx = (ret == -ENOENT &&
692 cmd == VIDIOC_S_EXT_CTRLS) 690 cmd == VIDIOC_S_EXT_CTRLS)
693 ? ctrls->count : i; 691 ? ctrls->count : i;
694 return ret == -ENOENT ? -EINVAL : ret; 692 return ret;
695 } 693 }
696 } 694 }
697 695
diff --git a/drivers/net/ethernet/marvell/mvmdio.c b/drivers/net/ethernet/marvell/mvmdio.c
index 6d6002bab060..74f1c157a480 100644
--- a/drivers/net/ethernet/marvell/mvmdio.c
+++ b/drivers/net/ethernet/marvell/mvmdio.c
@@ -141,7 +141,7 @@ static int orion_mdio_reset(struct mii_bus *bus)
141 return 0; 141 return 0;
142} 142}
143 143
144static int __devinit orion_mdio_probe(struct platform_device *pdev) 144static int orion_mdio_probe(struct platform_device *pdev)
145{ 145{
146 struct device_node *np = pdev->dev.of_node; 146 struct device_node *np = pdev->dev.of_node;
147 struct mii_bus *bus; 147 struct mii_bus *bus;
@@ -197,7 +197,7 @@ static int __devinit orion_mdio_probe(struct platform_device *pdev)
197 return 0; 197 return 0;
198} 198}
199 199
200static int __devexit orion_mdio_remove(struct platform_device *pdev) 200static int orion_mdio_remove(struct platform_device *pdev)
201{ 201{
202 struct mii_bus *bus = platform_get_drvdata(pdev); 202 struct mii_bus *bus = platform_get_drvdata(pdev);
203 mdiobus_unregister(bus); 203 mdiobus_unregister(bus);
@@ -214,7 +214,7 @@ MODULE_DEVICE_TABLE(of, orion_mdio_match);
214 214
215static struct platform_driver orion_mdio_driver = { 215static struct platform_driver orion_mdio_driver = {
216 .probe = orion_mdio_probe, 216 .probe = orion_mdio_probe,
217 .remove = __devexit_p(orion_mdio_remove), 217 .remove = orion_mdio_remove,
218 .driver = { 218 .driver = {
219 .name = "orion-mdio", 219 .name = "orion-mdio",
220 .of_match_table = orion_mdio_match, 220 .of_match_table = orion_mdio_match,
diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
index 3f8086b9f5e5..b6025c305e10 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -635,7 +635,7 @@ static void mvneta_rxq_bm_disable(struct mvneta_port *pp,
635 635
636 636
637/* Sets the RGMII Enable bit (RGMIIEn) in port MAC control register */ 637/* Sets the RGMII Enable bit (RGMIIEn) in port MAC control register */
638static void __devinit mvneta_gmac_rgmii_set(struct mvneta_port *pp, int enable) 638static void mvneta_gmac_rgmii_set(struct mvneta_port *pp, int enable)
639{ 639{
640 u32 val; 640 u32 val;
641 641
@@ -650,7 +650,7 @@ static void __devinit mvneta_gmac_rgmii_set(struct mvneta_port *pp, int enable)
650} 650}
651 651
652/* Config SGMII port */ 652/* Config SGMII port */
653static void __devinit mvneta_port_sgmii_config(struct mvneta_port *pp) 653static void mvneta_port_sgmii_config(struct mvneta_port *pp)
654{ 654{
655 u32 val; 655 u32 val;
656 656
@@ -2564,7 +2564,7 @@ const struct ethtool_ops mvneta_eth_tool_ops = {
2564}; 2564};
2565 2565
2566/* Initialize hw */ 2566/* Initialize hw */
2567static int __devinit mvneta_init(struct mvneta_port *pp, int phy_addr) 2567static int mvneta_init(struct mvneta_port *pp, int phy_addr)
2568{ 2568{
2569 int queue; 2569 int queue;
2570 2570
@@ -2613,9 +2613,8 @@ static void mvneta_deinit(struct mvneta_port *pp)
2613} 2613}
2614 2614
2615/* platform glue : initialize decoding windows */ 2615/* platform glue : initialize decoding windows */
2616static void __devinit 2616static void mvneta_conf_mbus_windows(struct mvneta_port *pp,
2617mvneta_conf_mbus_windows(struct mvneta_port *pp, 2617 const struct mbus_dram_target_info *dram)
2618 const struct mbus_dram_target_info *dram)
2619{ 2618{
2620 u32 win_enable; 2619 u32 win_enable;
2621 u32 win_protect; 2620 u32 win_protect;
@@ -2648,7 +2647,7 @@ mvneta_conf_mbus_windows(struct mvneta_port *pp,
2648} 2647}
2649 2648
2650/* Power up the port */ 2649/* Power up the port */
2651static void __devinit mvneta_port_power_up(struct mvneta_port *pp, int phy_mode) 2650static void mvneta_port_power_up(struct mvneta_port *pp, int phy_mode)
2652{ 2651{
2653 u32 val; 2652 u32 val;
2654 2653
@@ -2671,7 +2670,7 @@ static void __devinit mvneta_port_power_up(struct mvneta_port *pp, int phy_mode)
2671} 2670}
2672 2671
2673/* Device initialization routine */ 2672/* Device initialization routine */
2674static int __devinit mvneta_probe(struct platform_device *pdev) 2673static int mvneta_probe(struct platform_device *pdev)
2675{ 2674{
2676 const struct mbus_dram_target_info *dram_target_info; 2675 const struct mbus_dram_target_info *dram_target_info;
2677 struct device_node *dn = pdev->dev.of_node; 2676 struct device_node *dn = pdev->dev.of_node;
@@ -2803,7 +2802,7 @@ err_free_netdev:
2803} 2802}
2804 2803
2805/* Device removal routine */ 2804/* Device removal routine */
2806static int __devexit mvneta_remove(struct platform_device *pdev) 2805static int mvneta_remove(struct platform_device *pdev)
2807{ 2806{
2808 struct net_device *dev = platform_get_drvdata(pdev); 2807 struct net_device *dev = platform_get_drvdata(pdev);
2809 struct mvneta_port *pp = netdev_priv(dev); 2808 struct mvneta_port *pp = netdev_priv(dev);
@@ -2828,7 +2827,7 @@ MODULE_DEVICE_TABLE(of, mvneta_match);
2828 2827
2829static struct platform_driver mvneta_driver = { 2828static struct platform_driver mvneta_driver = {
2830 .probe = mvneta_probe, 2829 .probe = mvneta_probe,
2831 .remove = __devexit_p(mvneta_remove), 2830 .remove = mvneta_remove,
2832 .driver = { 2831 .driver = {
2833 .name = MVNETA_DRIVER_NAME, 2832 .name = MVNETA_DRIVER_NAME,
2834 .of_match_table = mvneta_match, 2833 .of_match_table = mvneta_match,
diff --git a/drivers/net/ethernet/ti/cpts.c b/drivers/net/ethernet/ti/cpts.c
index 5e62c1aeeffb..463597f919f1 100644
--- a/drivers/net/ethernet/ti/cpts.c
+++ b/drivers/net/ethernet/ti/cpts.c
@@ -247,8 +247,7 @@ static void cpts_clk_init(struct cpts *cpts)
247 cpts->refclk = NULL; 247 cpts->refclk = NULL;
248 return; 248 return;
249 } 249 }
250 clk_enable(cpts->refclk); 250 clk_prepare_enable(cpts->refclk);
251 cpts->freq = cpts->refclk->recalc(cpts->refclk);
252} 251}
253 252
254static void cpts_clk_release(struct cpts *cpts) 253static void cpts_clk_release(struct cpts *cpts)
diff --git a/drivers/net/ethernet/ti/cpts.h b/drivers/net/ethernet/ti/cpts.h
index e1bba3a496b2..fe993cdd7e23 100644
--- a/drivers/net/ethernet/ti/cpts.h
+++ b/drivers/net/ethernet/ti/cpts.h
@@ -120,7 +120,6 @@ struct cpts {
120 struct delayed_work overflow_work; 120 struct delayed_work overflow_work;
121 int phc_index; 121 int phc_index;
122 struct clk *refclk; 122 struct clk *refclk;
123 unsigned long freq;
124 struct list_head events; 123 struct list_head events;
125 struct list_head pool; 124 struct list_head pool;
126 struct cpts_event pool_data[CPTS_MAX_EVENTS]; 125 struct cpts_event pool_data[CPTS_MAX_EVENTS];
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 504f7f1cad94..fbd106edbe59 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -180,7 +180,6 @@ struct tun_struct {
180 int debug; 180 int debug;
181#endif 181#endif
182 spinlock_t lock; 182 spinlock_t lock;
183 struct kmem_cache *flow_cache;
184 struct hlist_head flows[TUN_NUM_FLOW_ENTRIES]; 183 struct hlist_head flows[TUN_NUM_FLOW_ENTRIES];
185 struct timer_list flow_gc_timer; 184 struct timer_list flow_gc_timer;
186 unsigned long ageing_time; 185 unsigned long ageing_time;
@@ -209,8 +208,8 @@ static struct tun_flow_entry *tun_flow_create(struct tun_struct *tun,
209 struct hlist_head *head, 208 struct hlist_head *head,
210 u32 rxhash, u16 queue_index) 209 u32 rxhash, u16 queue_index)
211{ 210{
212 struct tun_flow_entry *e = kmem_cache_alloc(tun->flow_cache, 211 struct tun_flow_entry *e = kmalloc(sizeof(*e), GFP_ATOMIC);
213 GFP_ATOMIC); 212
214 if (e) { 213 if (e) {
215 tun_debug(KERN_INFO, tun, "create flow: hash %u index %u\n", 214 tun_debug(KERN_INFO, tun, "create flow: hash %u index %u\n",
216 rxhash, queue_index); 215 rxhash, queue_index);
@@ -223,19 +222,12 @@ static struct tun_flow_entry *tun_flow_create(struct tun_struct *tun,
223 return e; 222 return e;
224} 223}
225 224
226static void tun_flow_free(struct rcu_head *head)
227{
228 struct tun_flow_entry *e
229 = container_of(head, struct tun_flow_entry, rcu);
230 kmem_cache_free(e->tun->flow_cache, e);
231}
232
233static void tun_flow_delete(struct tun_struct *tun, struct tun_flow_entry *e) 225static void tun_flow_delete(struct tun_struct *tun, struct tun_flow_entry *e)
234{ 226{
235 tun_debug(KERN_INFO, tun, "delete flow: hash %u index %u\n", 227 tun_debug(KERN_INFO, tun, "delete flow: hash %u index %u\n",
236 e->rxhash, e->queue_index); 228 e->rxhash, e->queue_index);
237 hlist_del_rcu(&e->hash_link); 229 hlist_del_rcu(&e->hash_link);
238 call_rcu(&e->rcu, tun_flow_free); 230 kfree_rcu(e, rcu);
239} 231}
240 232
241static void tun_flow_flush(struct tun_struct *tun) 233static void tun_flow_flush(struct tun_struct *tun)
@@ -833,12 +825,6 @@ static int tun_flow_init(struct tun_struct *tun)
833{ 825{
834 int i; 826 int i;
835 827
836 tun->flow_cache = kmem_cache_create("tun_flow_cache",
837 sizeof(struct tun_flow_entry), 0, 0,
838 NULL);
839 if (!tun->flow_cache)
840 return -ENOMEM;
841
842 for (i = 0; i < TUN_NUM_FLOW_ENTRIES; i++) 828 for (i = 0; i < TUN_NUM_FLOW_ENTRIES; i++)
843 INIT_HLIST_HEAD(&tun->flows[i]); 829 INIT_HLIST_HEAD(&tun->flows[i]);
844 830
@@ -854,10 +840,6 @@ static void tun_flow_uninit(struct tun_struct *tun)
854{ 840{
855 del_timer_sync(&tun->flow_gc_timer); 841 del_timer_sync(&tun->flow_gc_timer);
856 tun_flow_flush(tun); 842 tun_flow_flush(tun);
857
858 /* Wait for completion of call_rcu()'s */
859 rcu_barrier();
860 kmem_cache_destroy(tun->flow_cache);
861} 843}
862 844
863/* Initialize net device. */ 845/* Initialize net device. */
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 3b3fdf648ea7..40f2cc135a49 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -505,7 +505,8 @@ static int vxlan_join_group(struct net_device *dev)
505 struct vxlan_net *vn = net_generic(dev_net(dev), vxlan_net_id); 505 struct vxlan_net *vn = net_generic(dev_net(dev), vxlan_net_id);
506 struct sock *sk = vn->sock->sk; 506 struct sock *sk = vn->sock->sk;
507 struct ip_mreqn mreq = { 507 struct ip_mreqn mreq = {
508 .imr_multiaddr.s_addr = vxlan->gaddr, 508 .imr_multiaddr.s_addr = vxlan->gaddr,
509 .imr_ifindex = vxlan->link,
509 }; 510 };
510 int err; 511 int err;
511 512
@@ -532,7 +533,8 @@ static int vxlan_leave_group(struct net_device *dev)
532 int err = 0; 533 int err = 0;
533 struct sock *sk = vn->sock->sk; 534 struct sock *sk = vn->sock->sk;
534 struct ip_mreqn mreq = { 535 struct ip_mreqn mreq = {
535 .imr_multiaddr.s_addr = vxlan->gaddr, 536 .imr_multiaddr.s_addr = vxlan->gaddr,
537 .imr_ifindex = vxlan->link,
536 }; 538 };
537 539
538 /* Only leave group when last vxlan is done. */ 540 /* Only leave group when last vxlan is done. */
diff --git a/drivers/net/wireless/rtlwifi/rtl8723ae/sw.c b/drivers/net/wireless/rtlwifi/rtl8723ae/sw.c
index 18b0bc51766b..bb7cc90bafb2 100644
--- a/drivers/net/wireless/rtlwifi/rtl8723ae/sw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8723ae/sw.c
@@ -341,7 +341,7 @@ static struct rtl_hal_cfg rtl8723ae_hal_cfg = {
341 .maps[RTL_RC_HT_RATEMCS15] = DESC92_RATEMCS15, 341 .maps[RTL_RC_HT_RATEMCS15] = DESC92_RATEMCS15,
342}; 342};
343 343
344static struct pci_device_id rtl8723ae_pci_ids[] __devinitdata = { 344static struct pci_device_id rtl8723ae_pci_ids[] = {
345 {RTL_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8723, rtl8723ae_hal_cfg)}, 345 {RTL_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8723, rtl8723ae_hal_cfg)},
346 {}, 346 {},
347}; 347};
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index 05b78b16d20b..9c6e9bb674ec 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -422,77 +422,60 @@ static ssize_t sriov_numvfs_show(struct device *dev,
422} 422}
423 423
424/* 424/*
425 * num_vfs > 0; number of vfs to enable 425 * num_vfs > 0; number of VFs to enable
426 * num_vfs = 0; disable all vfs 426 * num_vfs = 0; disable all VFs
427 * 427 *
428 * Note: SRIOV spec doesn't allow partial VF 428 * Note: SRIOV spec doesn't allow partial VF
429 * disable, so its all or none. 429 * disable, so it's all or none.
430 */ 430 */
431static ssize_t sriov_numvfs_store(struct device *dev, 431static ssize_t sriov_numvfs_store(struct device *dev,
432 struct device_attribute *attr, 432 struct device_attribute *attr,
433 const char *buf, size_t count) 433 const char *buf, size_t count)
434{ 434{
435 struct pci_dev *pdev = to_pci_dev(dev); 435 struct pci_dev *pdev = to_pci_dev(dev);
436 int num_vfs_enabled = 0; 436 int ret;
437 int num_vfs; 437 u16 num_vfs;
438 int ret = 0;
439 u16 total;
440 438
441 if (kstrtoint(buf, 0, &num_vfs) < 0) 439 ret = kstrtou16(buf, 0, &num_vfs);
442 return -EINVAL; 440 if (ret < 0)
441 return ret;
442
443 if (num_vfs > pci_sriov_get_totalvfs(pdev))
444 return -ERANGE;
445
446 if (num_vfs == pdev->sriov->num_VFs)
447 return count; /* no change */
443 448
444 /* is PF driver loaded w/callback */ 449 /* is PF driver loaded w/callback */
445 if (!pdev->driver || !pdev->driver->sriov_configure) { 450 if (!pdev->driver || !pdev->driver->sriov_configure) {
446 dev_info(&pdev->dev, 451 dev_info(&pdev->dev, "Driver doesn't support SRIOV configuration via sysfs\n");
447 "Driver doesn't support SRIOV configuration via sysfs\n");
448 return -ENOSYS; 452 return -ENOSYS;
449 } 453 }
450 454
451 /* if enabling vf's ... */ 455 if (num_vfs == 0) {
452 total = pci_sriov_get_totalvfs(pdev); 456 /* disable VFs */
453 /* Requested VFs to enable < totalvfs and none enabled already */ 457 ret = pdev->driver->sriov_configure(pdev, 0);
454 if ((num_vfs > 0) && (num_vfs <= total)) { 458 if (ret < 0)
455 if (pdev->sriov->num_VFs == 0) { 459 return ret;
456 num_vfs_enabled = 460 return count;
457 pdev->driver->sriov_configure(pdev, num_vfs);
458 if ((num_vfs_enabled >= 0) &&
459 (num_vfs_enabled != num_vfs)) {
460 dev_warn(&pdev->dev,
461 "Only %d VFs enabled\n",
462 num_vfs_enabled);
463 return count;
464 } else if (num_vfs_enabled < 0)
465 /* error code from driver callback */
466 return num_vfs_enabled;
467 } else if (num_vfs == pdev->sriov->num_VFs) {
468 dev_warn(&pdev->dev,
469 "%d VFs already enabled; no enable action taken\n",
470 num_vfs);
471 return count;
472 } else {
473 dev_warn(&pdev->dev,
474 "%d VFs already enabled. Disable before enabling %d VFs\n",
475 pdev->sriov->num_VFs, num_vfs);
476 return -EINVAL;
477 }
478 } 461 }
479 462
480 /* disable vfs */ 463 /* enable VFs */
481 if (num_vfs == 0) { 464 if (pdev->sriov->num_VFs) {
482 if (pdev->sriov->num_VFs != 0) { 465 dev_warn(&pdev->dev, "%d VFs already enabled. Disable before enabling %d VFs\n",
483 ret = pdev->driver->sriov_configure(pdev, 0); 466 pdev->sriov->num_VFs, num_vfs);
484 return ret ? ret : count; 467 return -EBUSY;
485 } else {
486 dev_warn(&pdev->dev,
487 "All VFs disabled; no disable action taken\n");
488 return count;
489 }
490 } 468 }
491 469
492 dev_err(&pdev->dev, 470 ret = pdev->driver->sriov_configure(pdev, num_vfs);
493 "Invalid value for number of VFs to enable: %d\n", num_vfs); 471 if (ret < 0)
472 return ret;
494 473
495 return -EINVAL; 474 if (ret != num_vfs)
475 dev_warn(&pdev->dev, "%d VFs requested; only %d enabled\n",
476 num_vfs, ret);
477
478 return count;
496} 479}
497 480
498static struct device_attribute sriov_totalvfs_attr = __ATTR_RO(sriov_totalvfs); 481static struct device_attribute sriov_totalvfs_attr = __ATTR_RO(sriov_totalvfs);
diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c
index d4824cb78b49..08c243ab034e 100644
--- a/drivers/pci/pcie/portdrv_pci.c
+++ b/drivers/pci/pcie/portdrv_pci.c
@@ -134,10 +134,28 @@ static int pcie_port_runtime_resume(struct device *dev)
134 return 0; 134 return 0;
135} 135}
136 136
137static int pci_dev_pme_poll(struct pci_dev *pdev, void *data)
138{
139 bool *pme_poll = data;
140
141 if (pdev->pme_poll)
142 *pme_poll = true;
143 return 0;
144}
145
137static int pcie_port_runtime_idle(struct device *dev) 146static int pcie_port_runtime_idle(struct device *dev)
138{ 147{
148 struct pci_dev *pdev = to_pci_dev(dev);
149 bool pme_poll = false;
150
151 /*
152 * If any subordinate device needs pme poll, we should keep
153 * the port in D0, because we need port in D0 to poll it.
154 */
155 pci_walk_bus(pdev->subordinate, pci_dev_pme_poll, &pme_poll);
139 /* Delay for a short while to prevent too frequent suspend/resume */ 156 /* Delay for a short while to prevent too frequent suspend/resume */
140 pm_schedule_suspend(dev, 10); 157 if (!pme_poll)
158 pm_schedule_suspend(dev, 10);
141 return -EBUSY; 159 return -EBUSY;
142} 160}
143#else 161#else
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 8f7a6344e79e..0369fb6fc1da 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -2725,7 +2725,7 @@ static void ricoh_mmc_fixup_r5c832(struct pci_dev *dev)
2725 if (PCI_FUNC(dev->devfn)) 2725 if (PCI_FUNC(dev->devfn))
2726 return; 2726 return;
2727 /* 2727 /*
2728 * RICOH 0xe823 SD/MMC card reader fails to recognize 2728 * RICOH 0xe822 and 0xe823 SD/MMC card readers fail to recognize
2729 * certain types of SD/MMC cards. Lowering the SD base 2729 * certain types of SD/MMC cards. Lowering the SD base
2730 * clock frequency from 200Mhz to 50Mhz fixes this issue. 2730 * clock frequency from 200Mhz to 50Mhz fixes this issue.
2731 * 2731 *
@@ -2736,7 +2736,8 @@ static void ricoh_mmc_fixup_r5c832(struct pci_dev *dev)
2736 * 0xf9 - Key register for 0x150 2736 * 0xf9 - Key register for 0x150
2737 * 0xfc - key register for 0xe1 2737 * 0xfc - key register for 0xe1
2738 */ 2738 */
2739 if (dev->device == PCI_DEVICE_ID_RICOH_R5CE823) { 2739 if (dev->device == PCI_DEVICE_ID_RICOH_R5CE822 ||
2740 dev->device == PCI_DEVICE_ID_RICOH_R5CE823) {
2740 pci_write_config_byte(dev, 0xf9, 0xfc); 2741 pci_write_config_byte(dev, 0xf9, 0xfc);
2741 pci_write_config_byte(dev, 0x150, 0x10); 2742 pci_write_config_byte(dev, 0x150, 0x10);
2742 pci_write_config_byte(dev, 0xf9, 0x00); 2743 pci_write_config_byte(dev, 0xf9, 0x00);
@@ -2763,6 +2764,8 @@ static void ricoh_mmc_fixup_r5c832(struct pci_dev *dev)
2763} 2764}
2764DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5C832, ricoh_mmc_fixup_r5c832); 2765DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5C832, ricoh_mmc_fixup_r5c832);
2765DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5C832, ricoh_mmc_fixup_r5c832); 2766DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5C832, ricoh_mmc_fixup_r5c832);
2767DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5CE822, ricoh_mmc_fixup_r5c832);
2768DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5CE822, ricoh_mmc_fixup_r5c832);
2766DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5CE823, ricoh_mmc_fixup_r5c832); 2769DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5CE823, ricoh_mmc_fixup_r5c832);
2767DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5CE823, ricoh_mmc_fixup_r5c832); 2770DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5CE823, ricoh_mmc_fixup_r5c832);
2768#endif /*CONFIG_MMC_RICOH_MMC*/ 2771#endif /*CONFIG_MMC_RICOH_MMC*/
diff --git a/drivers/power/avs/smartreflex.c b/drivers/power/avs/smartreflex.c
index a17d08411723..6b2238bb6a81 100644
--- a/drivers/power/avs/smartreflex.c
+++ b/drivers/power/avs/smartreflex.c
@@ -27,8 +27,6 @@
27#include <linux/pm_runtime.h> 27#include <linux/pm_runtime.h>
28#include <linux/power/smartreflex.h> 28#include <linux/power/smartreflex.h>
29 29
30#include <plat/cpu.h>
31
32#define SMARTREFLEX_NAME_LEN 16 30#define SMARTREFLEX_NAME_LEN 16
33#define NVALUE_NAME_LEN 40 31#define NVALUE_NAME_LEN 40
34#define SR_DISABLE_TIMEOUT 200 32#define SR_DISABLE_TIMEOUT 200
diff --git a/drivers/watchdog/da9055_wdt.c b/drivers/watchdog/da9055_wdt.c
index 709ea1aefebb..f5ad10546fc9 100644
--- a/drivers/watchdog/da9055_wdt.c
+++ b/drivers/watchdog/da9055_wdt.c
@@ -72,20 +72,21 @@ static int da9055_wdt_set_timeout(struct watchdog_device *wdt_dev,
72 DA9055_TWDSCALE_MASK, 72 DA9055_TWDSCALE_MASK,
73 da9055_wdt_maps[i].reg_val << 73 da9055_wdt_maps[i].reg_val <<
74 DA9055_TWDSCALE_SHIFT); 74 DA9055_TWDSCALE_SHIFT);
75 if (ret < 0) 75 if (ret < 0) {
76 dev_err(da9055->dev, 76 dev_err(da9055->dev,
77 "Failed to update timescale bit, %d\n", ret); 77 "Failed to update timescale bit, %d\n", ret);
78 return ret;
79 }
78 80
79 wdt_dev->timeout = timeout; 81 wdt_dev->timeout = timeout;
80 82
81 return ret; 83 return 0;
82} 84}
83 85
84static int da9055_wdt_ping(struct watchdog_device *wdt_dev) 86static int da9055_wdt_ping(struct watchdog_device *wdt_dev)
85{ 87{
86 struct da9055_wdt_data *driver_data = watchdog_get_drvdata(wdt_dev); 88 struct da9055_wdt_data *driver_data = watchdog_get_drvdata(wdt_dev);
87 struct da9055 *da9055 = driver_data->da9055; 89 struct da9055 *da9055 = driver_data->da9055;
88 int ret;
89 90
90 /* 91 /*
91 * We have a minimum time for watchdog window called TWDMIN. A write 92 * We have a minimum time for watchdog window called TWDMIN. A write
@@ -94,18 +95,12 @@ static int da9055_wdt_ping(struct watchdog_device *wdt_dev)
94 mdelay(DA9055_TWDMIN); 95 mdelay(DA9055_TWDMIN);
95 96
96 /* Reset the watchdog timer */ 97 /* Reset the watchdog timer */
97 ret = da9055_reg_update(da9055, DA9055_REG_CONTROL_E, 98 return da9055_reg_update(da9055, DA9055_REG_CONTROL_E,
98 DA9055_WATCHDOG_MASK, 1); 99 DA9055_WATCHDOG_MASK, 1);
99
100 return ret;
101} 100}
102 101
103static void da9055_wdt_release_resources(struct kref *r) 102static void da9055_wdt_release_resources(struct kref *r)
104{ 103{
105 struct da9055_wdt_data *driver_data =
106 container_of(r, struct da9055_wdt_data, kref);
107
108 kfree(driver_data);
109} 104}
110 105
111static void da9055_wdt_ref(struct watchdog_device *wdt_dev) 106static void da9055_wdt_ref(struct watchdog_device *wdt_dev)
diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c
index 34ed61ea02b4..b0e541d022e6 100644
--- a/drivers/watchdog/omap_wdt.c
+++ b/drivers/watchdog/omap_wdt.c
@@ -296,7 +296,6 @@ static int omap_wdt_remove(struct platform_device *pdev)
296{ 296{
297 struct watchdog_device *wdog = platform_get_drvdata(pdev); 297 struct watchdog_device *wdog = platform_get_drvdata(pdev);
298 struct omap_wdt_dev *wdev = watchdog_get_drvdata(wdog); 298 struct omap_wdt_dev *wdev = watchdog_get_drvdata(wdog);
299 struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
300 299
301 pm_runtime_disable(wdev->dev); 300 pm_runtime_disable(wdev->dev);
302 watchdog_unregister_device(wdog); 301 watchdog_unregister_device(wdog);
diff --git a/drivers/watchdog/twl4030_wdt.c b/drivers/watchdog/twl4030_wdt.c
index 81918cf8993b..0f03106f7516 100644
--- a/drivers/watchdog/twl4030_wdt.c
+++ b/drivers/watchdog/twl4030_wdt.c
@@ -131,14 +131,21 @@ static int twl4030_wdt_resume(struct platform_device *pdev)
131#define twl4030_wdt_resume NULL 131#define twl4030_wdt_resume NULL
132#endif 132#endif
133 133
134static const struct of_device_id twl_wdt_of_match[] = {
135 { .compatible = "ti,twl4030-wdt", },
136 { },
137};
138MODULE_DEVICE_TABLE(of, twl_wdt_of_match);
139
134static struct platform_driver twl4030_wdt_driver = { 140static struct platform_driver twl4030_wdt_driver = {
135 .probe = twl4030_wdt_probe, 141 .probe = twl4030_wdt_probe,
136 .remove = twl4030_wdt_remove, 142 .remove = twl4030_wdt_remove,
137 .suspend = twl4030_wdt_suspend, 143 .suspend = twl4030_wdt_suspend,
138 .resume = twl4030_wdt_resume, 144 .resume = twl4030_wdt_resume,
139 .driver = { 145 .driver = {
140 .owner = THIS_MODULE, 146 .owner = THIS_MODULE,
141 .name = "twl4030_wdt", 147 .name = "twl4030_wdt",
148 .of_match_table = twl_wdt_of_match,
142 }, 149 },
143}; 150};
144 151
diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c
index ea9931281557..a7b0c2dfb3db 100644
--- a/fs/ecryptfs/crypto.c
+++ b/fs/ecryptfs/crypto.c
@@ -1935,7 +1935,7 @@ static const unsigned char filename_rev_map[256] = {
1935 * @src: Source location for the filename to encode 1935 * @src: Source location for the filename to encode
1936 * @src_size: Size of the source in bytes 1936 * @src_size: Size of the source in bytes
1937 */ 1937 */
1938void ecryptfs_encode_for_filename(unsigned char *dst, size_t *dst_size, 1938static void ecryptfs_encode_for_filename(unsigned char *dst, size_t *dst_size,
1939 unsigned char *src, size_t src_size) 1939 unsigned char *src, size_t src_size)
1940{ 1940{
1941 size_t num_blocks; 1941 size_t num_blocks;
diff --git a/fs/ecryptfs/kthread.c b/fs/ecryptfs/kthread.c
index 809e67d05ca3..f1ea610362c6 100644
--- a/fs/ecryptfs/kthread.c
+++ b/fs/ecryptfs/kthread.c
@@ -102,12 +102,12 @@ int __init ecryptfs_init_kthread(void)
102 102
103void ecryptfs_destroy_kthread(void) 103void ecryptfs_destroy_kthread(void)
104{ 104{
105 struct ecryptfs_open_req *req; 105 struct ecryptfs_open_req *req, *tmp;
106 106
107 mutex_lock(&ecryptfs_kthread_ctl.mux); 107 mutex_lock(&ecryptfs_kthread_ctl.mux);
108 ecryptfs_kthread_ctl.flags |= ECRYPTFS_KTHREAD_ZOMBIE; 108 ecryptfs_kthread_ctl.flags |= ECRYPTFS_KTHREAD_ZOMBIE;
109 list_for_each_entry(req, &ecryptfs_kthread_ctl.req_list, 109 list_for_each_entry_safe(req, tmp, &ecryptfs_kthread_ctl.req_list,
110 kthread_ctl_list) { 110 kthread_ctl_list) {
111 list_del(&req->kthread_ctl_list); 111 list_del(&req->kthread_ctl_list);
112 *req->lower_file = ERR_PTR(-EIO); 112 *req->lower_file = ERR_PTR(-EIO);
113 complete(&req->done); 113 complete(&req->done);
diff --git a/fs/ecryptfs/mmap.c b/fs/ecryptfs/mmap.c
index bd1d57f98f74..564a1fa34b99 100644
--- a/fs/ecryptfs/mmap.c
+++ b/fs/ecryptfs/mmap.c
@@ -338,7 +338,8 @@ static int ecryptfs_write_begin(struct file *file,
338 if (prev_page_end_size 338 if (prev_page_end_size
339 >= i_size_read(page->mapping->host)) { 339 >= i_size_read(page->mapping->host)) {
340 zero_user(page, 0, PAGE_CACHE_SIZE); 340 zero_user(page, 0, PAGE_CACHE_SIZE);
341 } else { 341 SetPageUptodate(page);
342 } else if (len < PAGE_CACHE_SIZE) {
342 rc = ecryptfs_decrypt_page(page); 343 rc = ecryptfs_decrypt_page(page);
343 if (rc) { 344 if (rc) {
344 printk(KERN_ERR "%s: Error decrypting " 345 printk(KERN_ERR "%s: Error decrypting "
@@ -348,8 +349,8 @@ static int ecryptfs_write_begin(struct file *file,
348 ClearPageUptodate(page); 349 ClearPageUptodate(page);
349 goto out; 350 goto out;
350 } 351 }
352 SetPageUptodate(page);
351 } 353 }
352 SetPageUptodate(page);
353 } 354 }
354 } 355 }
355 /* If creating a page or more of holes, zero them out via truncate. 356 /* If creating a page or more of holes, zero them out via truncate.
@@ -499,6 +500,13 @@ static int ecryptfs_write_end(struct file *file,
499 } 500 }
500 goto out; 501 goto out;
501 } 502 }
503 if (!PageUptodate(page)) {
504 if (copied < PAGE_CACHE_SIZE) {
505 rc = 0;
506 goto out;
507 }
508 SetPageUptodate(page);
509 }
502 /* Fills in zeros if 'to' goes beyond inode size */ 510 /* Fills in zeros if 'to' goes beyond inode size */
503 rc = fill_zeros_to_end_of_page(page, to); 511 rc = fill_zeros_to_end_of_page(page, to);
504 if (rc) { 512 if (rc) {
diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index be56b21435f8..9fec1836057a 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -1313,7 +1313,7 @@ static int ep_modify(struct eventpoll *ep, struct epitem *epi, struct epoll_even
1313 * otherwise we might miss an event that happens between the 1313 * otherwise we might miss an event that happens between the
1314 * f_op->poll() call and the new event set registering. 1314 * f_op->poll() call and the new event set registering.
1315 */ 1315 */
1316 epi->event.events = event->events; 1316 epi->event.events = event->events; /* need barrier below */
1317 pt._key = event->events; 1317 pt._key = event->events;
1318 epi->event.data = event->data; /* protected by mtx */ 1318 epi->event.data = event->data; /* protected by mtx */
1319 if (epi->event.events & EPOLLWAKEUP) { 1319 if (epi->event.events & EPOLLWAKEUP) {
@@ -1324,6 +1324,26 @@ static int ep_modify(struct eventpoll *ep, struct epitem *epi, struct epoll_even
1324 } 1324 }
1325 1325
1326 /* 1326 /*
1327 * The following barrier has two effects:
1328 *
1329 * 1) Flush epi changes above to other CPUs. This ensures
1330 * we do not miss events from ep_poll_callback if an
1331 * event occurs immediately after we call f_op->poll().
1332 * We need this because we did not take ep->lock while
1333 * changing epi above (but ep_poll_callback does take
1334 * ep->lock).
1335 *
1336 * 2) We also need to ensure we do not miss _past_ events
1337 * when calling f_op->poll(). This barrier also
1338 * pairs with the barrier in wq_has_sleeper (see
1339 * comments for wq_has_sleeper).
1340 *
1341 * This barrier will now guarantee ep_poll_callback or f_op->poll
1342 * (or both) will notice the readiness of an item.
1343 */
1344 smp_mb();
1345
1346 /*
1327 * Get current event bits. We can safely use the file* here because 1347 * Get current event bits. We can safely use the file* here because
1328 * its usage count has been increased by the caller of this function. 1348 * its usage count has been increased by the caller of this function.
1329 */ 1349 */
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 26af22832a84..5ae1674ec12f 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -2226,13 +2226,14 @@ errout:
2226 * removes index from the index block. 2226 * removes index from the index block.
2227 */ 2227 */
2228static int ext4_ext_rm_idx(handle_t *handle, struct inode *inode, 2228static int ext4_ext_rm_idx(handle_t *handle, struct inode *inode,
2229 struct ext4_ext_path *path) 2229 struct ext4_ext_path *path, int depth)
2230{ 2230{
2231 int err; 2231 int err;
2232 ext4_fsblk_t leaf; 2232 ext4_fsblk_t leaf;
2233 2233
2234 /* free index block */ 2234 /* free index block */
2235 path--; 2235 depth--;
2236 path = path + depth;
2236 leaf = ext4_idx_pblock(path->p_idx); 2237 leaf = ext4_idx_pblock(path->p_idx);
2237 if (unlikely(path->p_hdr->eh_entries == 0)) { 2238 if (unlikely(path->p_hdr->eh_entries == 0)) {
2238 EXT4_ERROR_INODE(inode, "path->p_hdr->eh_entries == 0"); 2239 EXT4_ERROR_INODE(inode, "path->p_hdr->eh_entries == 0");
@@ -2257,6 +2258,19 @@ static int ext4_ext_rm_idx(handle_t *handle, struct inode *inode,
2257 2258
2258 ext4_free_blocks(handle, inode, NULL, leaf, 1, 2259 ext4_free_blocks(handle, inode, NULL, leaf, 1,
2259 EXT4_FREE_BLOCKS_METADATA | EXT4_FREE_BLOCKS_FORGET); 2260 EXT4_FREE_BLOCKS_METADATA | EXT4_FREE_BLOCKS_FORGET);
2261
2262 while (--depth >= 0) {
2263 if (path->p_idx != EXT_FIRST_INDEX(path->p_hdr))
2264 break;
2265 path--;
2266 err = ext4_ext_get_access(handle, inode, path);
2267 if (err)
2268 break;
2269 path->p_idx->ei_block = (path+1)->p_idx->ei_block;
2270 err = ext4_ext_dirty(handle, inode, path);
2271 if (err)
2272 break;
2273 }
2260 return err; 2274 return err;
2261} 2275}
2262 2276
@@ -2599,7 +2613,7 @@ ext4_ext_rm_leaf(handle_t *handle, struct inode *inode,
2599 /* if this leaf is free, then we should 2613 /* if this leaf is free, then we should
2600 * remove it from index block above */ 2614 * remove it from index block above */
2601 if (err == 0 && eh->eh_entries == 0 && path[depth].p_bh != NULL) 2615 if (err == 0 && eh->eh_entries == 0 && path[depth].p_bh != NULL)
2602 err = ext4_ext_rm_idx(handle, inode, path + depth); 2616 err = ext4_ext_rm_idx(handle, inode, path, depth);
2603 2617
2604out: 2618out:
2605 return err; 2619 return err;
@@ -2802,7 +2816,7 @@ again:
2802 /* index is empty, remove it; 2816 /* index is empty, remove it;
2803 * handle must be already prepared by the 2817 * handle must be already prepared by the
2804 * truncatei_leaf() */ 2818 * truncatei_leaf() */
2805 err = ext4_ext_rm_idx(handle, inode, path + i); 2819 err = ext4_ext_rm_idx(handle, inode, path, i);
2806 } 2820 }
2807 /* root level has p_bh == NULL, brelse() eats this */ 2821 /* root level has p_bh == NULL, brelse() eats this */
2808 brelse(path[i].p_bh); 2822 brelse(path[i].p_bh);
diff --git a/fs/ext4/file.c b/fs/ext4/file.c
index d07c27ca594a..405565a62277 100644
--- a/fs/ext4/file.c
+++ b/fs/ext4/file.c
@@ -108,14 +108,6 @@ ext4_file_dio_write(struct kiocb *iocb, const struct iovec *iov,
108 108
109 /* Unaligned direct AIO must be serialized; see comment above */ 109 /* Unaligned direct AIO must be serialized; see comment above */
110 if (unaligned_aio) { 110 if (unaligned_aio) {
111 static unsigned long unaligned_warn_time;
112
113 /* Warn about this once per day */
114 if (printk_timed_ratelimit(&unaligned_warn_time, 60*60*24*HZ))
115 ext4_msg(inode->i_sb, KERN_WARNING,
116 "Unaligned AIO/DIO on inode %ld by %s; "
117 "performance will be poor.",
118 inode->i_ino, current->comm);
119 mutex_lock(ext4_aio_mutex(inode)); 111 mutex_lock(ext4_aio_mutex(inode));
120 ext4_unwritten_wait(inode); 112 ext4_unwritten_wait(inode);
121 } 113 }
diff --git a/fs/ext4/fsync.c b/fs/ext4/fsync.c
index dfbc1fe96674..3278e64e57b6 100644
--- a/fs/ext4/fsync.c
+++ b/fs/ext4/fsync.c
@@ -109,8 +109,6 @@ static int __sync_inode(struct inode *inode, int datasync)
109 * 109 *
110 * What we do is just kick off a commit and wait on it. This will snapshot the 110 * What we do is just kick off a commit and wait on it. This will snapshot the
111 * inode to disk. 111 * inode to disk.
112 *
113 * i_mutex lock is held when entering and exiting this function
114 */ 112 */
115 113
116int ext4_sync_file(struct file *file, loff_t start, loff_t end, int datasync) 114int ext4_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index cb1c1ab2720b..cbfe13bf5b2a 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -2880,8 +2880,6 @@ static void ext4_invalidatepage_free_endio(struct page *page, unsigned long offs
2880 2880
2881static void ext4_invalidatepage(struct page *page, unsigned long offset) 2881static void ext4_invalidatepage(struct page *page, unsigned long offset)
2882{ 2882{
2883 journal_t *journal = EXT4_JOURNAL(page->mapping->host);
2884
2885 trace_ext4_invalidatepage(page, offset); 2883 trace_ext4_invalidatepage(page, offset);
2886 2884
2887 /* 2885 /*
@@ -2889,16 +2887,34 @@ static void ext4_invalidatepage(struct page *page, unsigned long offset)
2889 */ 2887 */
2890 if (ext4_should_dioread_nolock(page->mapping->host)) 2888 if (ext4_should_dioread_nolock(page->mapping->host))
2891 ext4_invalidatepage_free_endio(page, offset); 2889 ext4_invalidatepage_free_endio(page, offset);
2890
2891 /* No journalling happens on data buffers when this function is used */
2892 WARN_ON(page_has_buffers(page) && buffer_jbd(page_buffers(page)));
2893
2894 block_invalidatepage(page, offset);
2895}
2896
2897static int __ext4_journalled_invalidatepage(struct page *page,
2898 unsigned long offset)
2899{
2900 journal_t *journal = EXT4_JOURNAL(page->mapping->host);
2901
2902 trace_ext4_journalled_invalidatepage(page, offset);
2903
2892 /* 2904 /*
2893 * If it's a full truncate we just forget about the pending dirtying 2905 * If it's a full truncate we just forget about the pending dirtying
2894 */ 2906 */
2895 if (offset == 0) 2907 if (offset == 0)
2896 ClearPageChecked(page); 2908 ClearPageChecked(page);
2897 2909
2898 if (journal) 2910 return jbd2_journal_invalidatepage(journal, page, offset);
2899 jbd2_journal_invalidatepage(journal, page, offset); 2911}
2900 else 2912
2901 block_invalidatepage(page, offset); 2913/* Wrapper for aops... */
2914static void ext4_journalled_invalidatepage(struct page *page,
2915 unsigned long offset)
2916{
2917 WARN_ON(__ext4_journalled_invalidatepage(page, offset) < 0);
2902} 2918}
2903 2919
2904static int ext4_releasepage(struct page *page, gfp_t wait) 2920static int ext4_releasepage(struct page *page, gfp_t wait)
@@ -3264,7 +3280,7 @@ static const struct address_space_operations ext4_journalled_aops = {
3264 .write_end = ext4_journalled_write_end, 3280 .write_end = ext4_journalled_write_end,
3265 .set_page_dirty = ext4_journalled_set_page_dirty, 3281 .set_page_dirty = ext4_journalled_set_page_dirty,
3266 .bmap = ext4_bmap, 3282 .bmap = ext4_bmap,
3267 .invalidatepage = ext4_invalidatepage, 3283 .invalidatepage = ext4_journalled_invalidatepage,
3268 .releasepage = ext4_releasepage, 3284 .releasepage = ext4_releasepage,
3269 .direct_IO = ext4_direct_IO, 3285 .direct_IO = ext4_direct_IO,
3270 .is_partially_uptodate = block_is_partially_uptodate, 3286 .is_partially_uptodate = block_is_partially_uptodate,
@@ -4305,6 +4321,47 @@ int ext4_write_inode(struct inode *inode, struct writeback_control *wbc)
4305} 4321}
4306 4322
4307/* 4323/*
4324 * In data=journal mode ext4_journalled_invalidatepage() may fail to invalidate
4325 * buffers that are attached to a page stradding i_size and are undergoing
4326 * commit. In that case we have to wait for commit to finish and try again.
4327 */
4328static void ext4_wait_for_tail_page_commit(struct inode *inode)
4329{
4330 struct page *page;
4331 unsigned offset;
4332 journal_t *journal = EXT4_SB(inode->i_sb)->s_journal;
4333 tid_t commit_tid = 0;
4334 int ret;
4335
4336 offset = inode->i_size & (PAGE_CACHE_SIZE - 1);
4337 /*
4338 * All buffers in the last page remain valid? Then there's nothing to
4339 * do. We do the check mainly to optimize the common PAGE_CACHE_SIZE ==
4340 * blocksize case
4341 */
4342 if (offset > PAGE_CACHE_SIZE - (1 << inode->i_blkbits))
4343 return;
4344 while (1) {
4345 page = find_lock_page(inode->i_mapping,
4346 inode->i_size >> PAGE_CACHE_SHIFT);
4347 if (!page)
4348 return;
4349 ret = __ext4_journalled_invalidatepage(page, offset);
4350 unlock_page(page);
4351 page_cache_release(page);
4352 if (ret != -EBUSY)
4353 return;
4354 commit_tid = 0;
4355 read_lock(&journal->j_state_lock);
4356 if (journal->j_committing_transaction)
4357 commit_tid = journal->j_committing_transaction->t_tid;
4358 read_unlock(&journal->j_state_lock);
4359 if (commit_tid)
4360 jbd2_log_wait_commit(journal, commit_tid);
4361 }
4362}
4363
4364/*
4308 * ext4_setattr() 4365 * ext4_setattr()
4309 * 4366 *
4310 * Called from notify_change. 4367 * Called from notify_change.
@@ -4417,16 +4474,28 @@ int ext4_setattr(struct dentry *dentry, struct iattr *attr)
4417 } 4474 }
4418 4475
4419 if (attr->ia_valid & ATTR_SIZE) { 4476 if (attr->ia_valid & ATTR_SIZE) {
4420 if (attr->ia_size != i_size_read(inode)) { 4477 if (attr->ia_size != inode->i_size) {
4421 truncate_setsize(inode, attr->ia_size); 4478 loff_t oldsize = inode->i_size;
4422 /* Inode size will be reduced, wait for dio in flight. 4479
4423 * Temporarily disable dioread_nolock to prevent 4480 i_size_write(inode, attr->ia_size);
4424 * livelock. */ 4481 /*
4482 * Blocks are going to be removed from the inode. Wait
4483 * for dio in flight. Temporarily disable
4484 * dioread_nolock to prevent livelock.
4485 */
4425 if (orphan) { 4486 if (orphan) {
4426 ext4_inode_block_unlocked_dio(inode); 4487 if (!ext4_should_journal_data(inode)) {
4427 inode_dio_wait(inode); 4488 ext4_inode_block_unlocked_dio(inode);
4428 ext4_inode_resume_unlocked_dio(inode); 4489 inode_dio_wait(inode);
4490 ext4_inode_resume_unlocked_dio(inode);
4491 } else
4492 ext4_wait_for_tail_page_commit(inode);
4429 } 4493 }
4494 /*
4495 * Truncate pagecache after we've waited for commit
4496 * in data=journal mode to make pages freeable.
4497 */
4498 truncate_pagecache(inode, oldsize, inode->i_size);
4430 } 4499 }
4431 ext4_truncate(inode); 4500 ext4_truncate(inode);
4432 } 4501 }
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index cac448282331..8990165346ee 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -2648,7 +2648,8 @@ int ext4_orphan_del(handle_t *handle, struct inode *inode)
2648 struct ext4_iloc iloc; 2648 struct ext4_iloc iloc;
2649 int err = 0; 2649 int err = 0;
2650 2650
2651 if (!EXT4_SB(inode->i_sb)->s_journal) 2651 if ((!EXT4_SB(inode->i_sb)->s_journal) &&
2652 !(EXT4_SB(inode->i_sb)->s_mount_state & EXT4_ORPHAN_FS))
2652 return 0; 2653 return 0;
2653 2654
2654 mutex_lock(&EXT4_SB(inode->i_sb)->s_orphan_lock); 2655 mutex_lock(&EXT4_SB(inode->i_sb)->s_orphan_lock);
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 3cdb0a2fc648..3d4fb81bacd5 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1645,9 +1645,7 @@ static int parse_options(char *options, struct super_block *sb,
1645 unsigned int *journal_ioprio, 1645 unsigned int *journal_ioprio,
1646 int is_remount) 1646 int is_remount)
1647{ 1647{
1648#ifdef CONFIG_QUOTA
1649 struct ext4_sb_info *sbi = EXT4_SB(sb); 1648 struct ext4_sb_info *sbi = EXT4_SB(sb);
1650#endif
1651 char *p; 1649 char *p;
1652 substring_t args[MAX_OPT_ARGS]; 1650 substring_t args[MAX_OPT_ARGS];
1653 int token; 1651 int token;
@@ -1696,6 +1694,16 @@ static int parse_options(char *options, struct super_block *sb,
1696 } 1694 }
1697 } 1695 }
1698#endif 1696#endif
1697 if (test_opt(sb, DIOREAD_NOLOCK)) {
1698 int blocksize =
1699 BLOCK_SIZE << le32_to_cpu(sbi->s_es->s_log_block_size);
1700
1701 if (blocksize < PAGE_CACHE_SIZE) {
1702 ext4_msg(sb, KERN_ERR, "can't mount with "
1703 "dioread_nolock if block size != PAGE_SIZE");
1704 return 0;
1705 }
1706 }
1699 return 1; 1707 return 1;
1700} 1708}
1701 1709
@@ -2212,7 +2220,9 @@ static void ext4_orphan_cleanup(struct super_block *sb,
2212 __func__, inode->i_ino, inode->i_size); 2220 __func__, inode->i_ino, inode->i_size);
2213 jbd_debug(2, "truncating inode %lu to %lld bytes\n", 2221 jbd_debug(2, "truncating inode %lu to %lld bytes\n",
2214 inode->i_ino, inode->i_size); 2222 inode->i_ino, inode->i_size);
2223 mutex_lock(&inode->i_mutex);
2215 ext4_truncate(inode); 2224 ext4_truncate(inode);
2225 mutex_unlock(&inode->i_mutex);
2216 nr_truncates++; 2226 nr_truncates++;
2217 } else { 2227 } else {
2218 ext4_msg(sb, KERN_DEBUG, 2228 ext4_msg(sb, KERN_DEBUG,
@@ -3223,6 +3233,10 @@ int ext4_calculate_overhead(struct super_block *sb)
3223 memset(buf, 0, PAGE_SIZE); 3233 memset(buf, 0, PAGE_SIZE);
3224 cond_resched(); 3234 cond_resched();
3225 } 3235 }
3236 /* Add the journal blocks as well */
3237 if (sbi->s_journal)
3238 overhead += EXT4_B2C(sbi, sbi->s_journal->j_maxlen);
3239
3226 sbi->s_overhead = overhead; 3240 sbi->s_overhead = overhead;
3227 smp_wmb(); 3241 smp_wmb();
3228 free_page((unsigned long) buf); 3242 free_page((unsigned long) buf);
@@ -3436,15 +3450,6 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
3436 clear_opt(sb, DELALLOC); 3450 clear_opt(sb, DELALLOC);
3437 } 3451 }
3438 3452
3439 blocksize = BLOCK_SIZE << le32_to_cpu(es->s_log_block_size);
3440 if (test_opt(sb, DIOREAD_NOLOCK)) {
3441 if (blocksize < PAGE_SIZE) {
3442 ext4_msg(sb, KERN_ERR, "can't mount with "
3443 "dioread_nolock if block size != PAGE_SIZE");
3444 goto failed_mount;
3445 }
3446 }
3447
3448 sb->s_flags = (sb->s_flags & ~MS_POSIXACL) | 3453 sb->s_flags = (sb->s_flags & ~MS_POSIXACL) |
3449 (test_opt(sb, POSIX_ACL) ? MS_POSIXACL : 0); 3454 (test_opt(sb, POSIX_ACL) ? MS_POSIXACL : 0);
3450 3455
@@ -3486,6 +3491,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
3486 if (!ext4_feature_set_ok(sb, (sb->s_flags & MS_RDONLY))) 3491 if (!ext4_feature_set_ok(sb, (sb->s_flags & MS_RDONLY)))
3487 goto failed_mount; 3492 goto failed_mount;
3488 3493
3494 blocksize = BLOCK_SIZE << le32_to_cpu(es->s_log_block_size);
3489 if (blocksize < EXT4_MIN_BLOCK_SIZE || 3495 if (blocksize < EXT4_MIN_BLOCK_SIZE ||
3490 blocksize > EXT4_MAX_BLOCK_SIZE) { 3496 blocksize > EXT4_MAX_BLOCK_SIZE) {
3491 ext4_msg(sb, KERN_ERR, 3497 ext4_msg(sb, KERN_ERR,
@@ -4725,7 +4731,7 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
4725 } 4731 }
4726 4732
4727 ext4_setup_system_zone(sb); 4733 ext4_setup_system_zone(sb);
4728 if (sbi->s_journal == NULL) 4734 if (sbi->s_journal == NULL && !(old_sb_flags & MS_RDONLY))
4729 ext4_commit_super(sb, 1); 4735 ext4_commit_super(sb, 1);
4730 4736
4731#ifdef CONFIG_QUOTA 4737#ifdef CONFIG_QUOTA
diff --git a/fs/f2fs/acl.c b/fs/f2fs/acl.c
index fed74d193ffb..e95b94945d5f 100644
--- a/fs/f2fs/acl.c
+++ b/fs/f2fs/acl.c
@@ -82,7 +82,6 @@ static struct posix_acl *f2fs_acl_from_disk(const char *value, size_t size)
82 case ACL_GROUP_OBJ: 82 case ACL_GROUP_OBJ:
83 case ACL_MASK: 83 case ACL_MASK:
84 case ACL_OTHER: 84 case ACL_OTHER:
85 acl->a_entries[i].e_id = ACL_UNDEFINED_ID;
86 entry = (struct f2fs_acl_entry *)((char *)entry + 85 entry = (struct f2fs_acl_entry *)((char *)entry +
87 sizeof(struct f2fs_acl_entry_short)); 86 sizeof(struct f2fs_acl_entry_short));
88 break; 87 break;
diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c
index 42f6615af0ac..df9f29760efa 100644
--- a/fs/jbd2/transaction.c
+++ b/fs/jbd2/transaction.c
@@ -209,7 +209,8 @@ repeat:
209 if (!new_transaction) 209 if (!new_transaction)
210 goto alloc_transaction; 210 goto alloc_transaction;
211 write_lock(&journal->j_state_lock); 211 write_lock(&journal->j_state_lock);
212 if (!journal->j_running_transaction) { 212 if (!journal->j_running_transaction &&
213 !journal->j_barrier_count) {
213 jbd2_get_transaction(journal, new_transaction); 214 jbd2_get_transaction(journal, new_transaction);
214 new_transaction = NULL; 215 new_transaction = NULL;
215 } 216 }
@@ -1839,7 +1840,6 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh,
1839 1840
1840 BUFFER_TRACE(bh, "entry"); 1841 BUFFER_TRACE(bh, "entry");
1841 1842
1842retry:
1843 /* 1843 /*
1844 * It is safe to proceed here without the j_list_lock because the 1844 * It is safe to proceed here without the j_list_lock because the
1845 * buffers cannot be stolen by try_to_free_buffers as long as we are 1845 * buffers cannot be stolen by try_to_free_buffers as long as we are
@@ -1934,14 +1934,11 @@ retry:
1934 * for commit and try again. 1934 * for commit and try again.
1935 */ 1935 */
1936 if (partial_page) { 1936 if (partial_page) {
1937 tid_t tid = journal->j_committing_transaction->t_tid;
1938
1939 jbd2_journal_put_journal_head(jh); 1937 jbd2_journal_put_journal_head(jh);
1940 spin_unlock(&journal->j_list_lock); 1938 spin_unlock(&journal->j_list_lock);
1941 jbd_unlock_bh_state(bh); 1939 jbd_unlock_bh_state(bh);
1942 write_unlock(&journal->j_state_lock); 1940 write_unlock(&journal->j_state_lock);
1943 jbd2_log_wait_commit(journal, tid); 1941 return -EBUSY;
1944 goto retry;
1945 } 1942 }
1946 /* 1943 /*
1947 * OK, buffer won't be reachable after truncate. We just set 1944 * OK, buffer won't be reachable after truncate. We just set
@@ -2002,21 +1999,23 @@ zap_buffer_unlocked:
2002 * @page: page to flush 1999 * @page: page to flush
2003 * @offset: length of page to invalidate. 2000 * @offset: length of page to invalidate.
2004 * 2001 *
2005 * Reap page buffers containing data after offset in page. 2002 * Reap page buffers containing data after offset in page. Can return -EBUSY
2006 * 2003 * if buffers are part of the committing transaction and the page is straddling
2004 * i_size. Caller then has to wait for current commit and try again.
2007 */ 2005 */
2008void jbd2_journal_invalidatepage(journal_t *journal, 2006int jbd2_journal_invalidatepage(journal_t *journal,
2009 struct page *page, 2007 struct page *page,
2010 unsigned long offset) 2008 unsigned long offset)
2011{ 2009{
2012 struct buffer_head *head, *bh, *next; 2010 struct buffer_head *head, *bh, *next;
2013 unsigned int curr_off = 0; 2011 unsigned int curr_off = 0;
2014 int may_free = 1; 2012 int may_free = 1;
2013 int ret = 0;
2015 2014
2016 if (!PageLocked(page)) 2015 if (!PageLocked(page))
2017 BUG(); 2016 BUG();
2018 if (!page_has_buffers(page)) 2017 if (!page_has_buffers(page))
2019 return; 2018 return 0;
2020 2019
2021 /* We will potentially be playing with lists other than just the 2020 /* We will potentially be playing with lists other than just the
2022 * data lists (especially for journaled data mode), so be 2021 * data lists (especially for journaled data mode), so be
@@ -2030,9 +2029,11 @@ void jbd2_journal_invalidatepage(journal_t *journal,
2030 if (offset <= curr_off) { 2029 if (offset <= curr_off) {
2031 /* This block is wholly outside the truncation point */ 2030 /* This block is wholly outside the truncation point */
2032 lock_buffer(bh); 2031 lock_buffer(bh);
2033 may_free &= journal_unmap_buffer(journal, bh, 2032 ret = journal_unmap_buffer(journal, bh, offset > 0);
2034 offset > 0);
2035 unlock_buffer(bh); 2033 unlock_buffer(bh);
2034 if (ret < 0)
2035 return ret;
2036 may_free &= ret;
2036 } 2037 }
2037 curr_off = next_off; 2038 curr_off = next_off;
2038 bh = next; 2039 bh = next;
@@ -2043,6 +2044,7 @@ void jbd2_journal_invalidatepage(journal_t *journal,
2043 if (may_free && try_to_free_buffers(page)) 2044 if (may_free && try_to_free_buffers(page))
2044 J_ASSERT(!page_has_buffers(page)); 2045 J_ASSERT(!page_has_buffers(page));
2045 } 2046 }
2047 return 0;
2046} 2048}
2047 2049
2048/* 2050/*
diff --git a/fs/proc/generic.c b/fs/proc/generic.c
index e064f562b1f7..76ddae83daa5 100644
--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -352,18 +352,18 @@ retry:
352 if (!ida_pre_get(&proc_inum_ida, GFP_KERNEL)) 352 if (!ida_pre_get(&proc_inum_ida, GFP_KERNEL))
353 return -ENOMEM; 353 return -ENOMEM;
354 354
355 spin_lock_bh(&proc_inum_lock); 355 spin_lock_irq(&proc_inum_lock);
356 error = ida_get_new(&proc_inum_ida, &i); 356 error = ida_get_new(&proc_inum_ida, &i);
357 spin_unlock_bh(&proc_inum_lock); 357 spin_unlock_irq(&proc_inum_lock);
358 if (error == -EAGAIN) 358 if (error == -EAGAIN)
359 goto retry; 359 goto retry;
360 else if (error) 360 else if (error)
361 return error; 361 return error;
362 362
363 if (i > UINT_MAX - PROC_DYNAMIC_FIRST) { 363 if (i > UINT_MAX - PROC_DYNAMIC_FIRST) {
364 spin_lock_bh(&proc_inum_lock); 364 spin_lock_irq(&proc_inum_lock);
365 ida_remove(&proc_inum_ida, i); 365 ida_remove(&proc_inum_ida, i);
366 spin_unlock_bh(&proc_inum_lock); 366 spin_unlock_irq(&proc_inum_lock);
367 return -ENOSPC; 367 return -ENOSPC;
368 } 368 }
369 *inum = PROC_DYNAMIC_FIRST + i; 369 *inum = PROC_DYNAMIC_FIRST + i;
@@ -372,9 +372,10 @@ retry:
372 372
373void proc_free_inum(unsigned int inum) 373void proc_free_inum(unsigned int inum)
374{ 374{
375 spin_lock_bh(&proc_inum_lock); 375 unsigned long flags;
376 spin_lock_irqsave(&proc_inum_lock, flags);
376 ida_remove(&proc_inum_ida, inum - PROC_DYNAMIC_FIRST); 377 ida_remove(&proc_inum_ida, inum - PROC_DYNAMIC_FIRST);
377 spin_unlock_bh(&proc_inum_lock); 378 spin_unlock_irqrestore(&proc_inum_lock, flags);
378} 379}
379 380
380static void *proc_follow_link(struct dentry *dentry, struct nameidata *nd) 381static void *proc_follow_link(struct dentry *dentry, struct nameidata *nd)
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index 448455b7fd91..ca5ce7f9f800 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -1278,7 +1278,7 @@ static int show_numa_map(struct seq_file *m, void *v, int is_pid)
1278 walk.mm = mm; 1278 walk.mm = mm;
1279 1279
1280 pol = get_vma_policy(task, vma, vma->vm_start); 1280 pol = get_vma_policy(task, vma, vma->vm_start);
1281 mpol_to_str(buffer, sizeof(buffer), pol, 0); 1281 mpol_to_str(buffer, sizeof(buffer), pol);
1282 mpol_cond_put(pol); 1282 mpol_cond_put(pol);
1283 1283
1284 seq_printf(m, "%08lx %s", vma->vm_start, buffer); 1284 seq_printf(m, "%08lx %s", vma->vm_start, buffer);
diff --git a/include/Kbuild b/include/Kbuild
index 83256b64166a..1dfd33e8d43b 100644
--- a/include/Kbuild
+++ b/include/Kbuild
@@ -1,8 +1,5 @@
1# Top-level Makefile calls into asm-$(ARCH) 1# Top-level Makefile calls into asm-$(ARCH)
2# List only non-arch directories below 2# List only non-arch directories below
3 3
4header-y += linux/
5header-y += sound/
6header-y += rdma/
7header-y += video/ 4header-y += video/
8header-y += scsi/ 5header-y += scsi/
diff --git a/include/drm/drm_mm.h b/include/drm/drm_mm.h
index 06d7f798a08c..0f4a366f6fa6 100644
--- a/include/drm/drm_mm.h
+++ b/include/drm/drm_mm.h
@@ -158,12 +158,29 @@ static inline struct drm_mm_node *drm_mm_get_block_atomic_range(
158 return drm_mm_get_block_range_generic(parent, size, alignment, 0, 158 return drm_mm_get_block_range_generic(parent, size, alignment, 0,
159 start, end, 1); 159 start, end, 1);
160} 160}
161extern int drm_mm_insert_node(struct drm_mm *mm, struct drm_mm_node *node, 161
162 unsigned long size, unsigned alignment); 162extern int drm_mm_insert_node(struct drm_mm *mm,
163 struct drm_mm_node *node,
164 unsigned long size,
165 unsigned alignment);
163extern int drm_mm_insert_node_in_range(struct drm_mm *mm, 166extern int drm_mm_insert_node_in_range(struct drm_mm *mm,
164 struct drm_mm_node *node, 167 struct drm_mm_node *node,
165 unsigned long size, unsigned alignment, 168 unsigned long size,
166 unsigned long start, unsigned long end); 169 unsigned alignment,
170 unsigned long start,
171 unsigned long end);
172extern int drm_mm_insert_node_generic(struct drm_mm *mm,
173 struct drm_mm_node *node,
174 unsigned long size,
175 unsigned alignment,
176 unsigned long color);
177extern int drm_mm_insert_node_in_range_generic(struct drm_mm *mm,
178 struct drm_mm_node *node,
179 unsigned long size,
180 unsigned alignment,
181 unsigned long color,
182 unsigned long start,
183 unsigned long end);
167extern void drm_mm_put_block(struct drm_mm_node *cur); 184extern void drm_mm_put_block(struct drm_mm_node *cur);
168extern void drm_mm_remove_node(struct drm_mm_node *node); 185extern void drm_mm_remove_node(struct drm_mm_node *node);
169extern void drm_mm_replace_node(struct drm_mm_node *old, struct drm_mm_node *new); 186extern void drm_mm_replace_node(struct drm_mm_node *old, struct drm_mm_node *new);
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
deleted file mode 100644
index 7fe2dae251e5..000000000000
--- a/include/linux/Kbuild
+++ /dev/null
@@ -1,5 +0,0 @@
1header-y += dvb/
2header-y += hdlc/
3header-y += hsi/
4header-y += raid/
5header-y += usb/
diff --git a/include/linux/hdlc/Kbuild b/include/linux/hdlc/Kbuild
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/include/linux/hdlc/Kbuild
+++ /dev/null
diff --git a/include/linux/hsi/Kbuild b/include/linux/hsi/Kbuild
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/include/linux/hsi/Kbuild
+++ /dev/null
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index 1be23d9fdacb..e30b66346942 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -1098,7 +1098,7 @@ void jbd2_journal_set_triggers(struct buffer_head *,
1098extern int jbd2_journal_dirty_metadata (handle_t *, struct buffer_head *); 1098extern int jbd2_journal_dirty_metadata (handle_t *, struct buffer_head *);
1099extern int jbd2_journal_forget (handle_t *, struct buffer_head *); 1099extern int jbd2_journal_forget (handle_t *, struct buffer_head *);
1100extern void journal_sync_buffer (struct buffer_head *); 1100extern void journal_sync_buffer (struct buffer_head *);
1101extern void jbd2_journal_invalidatepage(journal_t *, 1101extern int jbd2_journal_invalidatepage(journal_t *,
1102 struct page *, unsigned long); 1102 struct page *, unsigned long);
1103extern int jbd2_journal_try_to_free_buffers(journal_t *, struct page *, gfp_t); 1103extern int jbd2_journal_try_to_free_buffers(journal_t *, struct page *, gfp_t);
1104extern int jbd2_journal_stop(handle_t *); 1104extern int jbd2_journal_stop(handle_t *);
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h
index 9adc270de7ef..0d7df39a5885 100644
--- a/include/linux/mempolicy.h
+++ b/include/linux/mempolicy.h
@@ -123,7 +123,7 @@ struct sp_node {
123 123
124struct shared_policy { 124struct shared_policy {
125 struct rb_root root; 125 struct rb_root root;
126 struct mutex mutex; 126 spinlock_t lock;
127}; 127};
128 128
129void mpol_shared_policy_init(struct shared_policy *sp, struct mempolicy *mpol); 129void mpol_shared_policy_init(struct shared_policy *sp, struct mempolicy *mpol);
@@ -165,11 +165,10 @@ int do_migrate_pages(struct mm_struct *mm, const nodemask_t *from,
165 165
166 166
167#ifdef CONFIG_TMPFS 167#ifdef CONFIG_TMPFS
168extern int mpol_parse_str(char *str, struct mempolicy **mpol, int no_context); 168extern int mpol_parse_str(char *str, struct mempolicy **mpol);
169#endif 169#endif
170 170
171extern int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol, 171extern int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol);
172 int no_context);
173 172
174/* Check if a vma is migratable */ 173/* Check if a vma is migratable */
175static inline int vma_migratable(struct vm_area_struct *vma) 174static inline int vma_migratable(struct vm_area_struct *vma)
@@ -296,15 +295,13 @@ static inline void check_highest_zone(int k)
296} 295}
297 296
298#ifdef CONFIG_TMPFS 297#ifdef CONFIG_TMPFS
299static inline int mpol_parse_str(char *str, struct mempolicy **mpol, 298static inline int mpol_parse_str(char *str, struct mempolicy **mpol)
300 int no_context)
301{ 299{
302 return 1; /* error */ 300 return 1; /* error */
303} 301}
304#endif 302#endif
305 303
306static inline int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol, 304static inline int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol)
307 int no_context)
308{ 305{
309 return 0; 306 return 0;
310} 307}
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 02e0f6b156c3..c599e4782d45 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1576,7 +1576,7 @@ extern int call_netdevice_notifiers(unsigned long val, struct net_device *dev);
1576 1576
1577extern rwlock_t dev_base_lock; /* Device list lock */ 1577extern rwlock_t dev_base_lock; /* Device list lock */
1578 1578
1579extern seqlock_t devnet_rename_seq; /* Device rename lock */ 1579extern seqcount_t devnet_rename_seq; /* Device rename seq */
1580 1580
1581 1581
1582#define for_each_netdev(net, d) \ 1582#define for_each_netdev(net, d) \
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index b5d13841604e..70473da47b3f 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -362,7 +362,7 @@ static inline void ClearPageCompound(struct page *page)
362 * pages on the LRU and/or pagecache. 362 * pages on the LRU and/or pagecache.
363 */ 363 */
364TESTPAGEFLAG(Compound, compound) 364TESTPAGEFLAG(Compound, compound)
365__PAGEFLAG(Head, compound) 365__SETPAGEFLAG(Head, compound) __CLEARPAGEFLAG(Head, compound)
366 366
367/* 367/*
368 * PG_reclaim is used in combination with PG_compound to mark the 368 * PG_reclaim is used in combination with PG_compound to mark the
@@ -374,8 +374,14 @@ __PAGEFLAG(Head, compound)
374 * PG_compound & PG_reclaim => Tail page 374 * PG_compound & PG_reclaim => Tail page
375 * PG_compound & ~PG_reclaim => Head page 375 * PG_compound & ~PG_reclaim => Head page
376 */ 376 */
377#define PG_head_mask ((1L << PG_compound))
377#define PG_head_tail_mask ((1L << PG_compound) | (1L << PG_reclaim)) 378#define PG_head_tail_mask ((1L << PG_compound) | (1L << PG_reclaim))
378 379
380static inline int PageHead(struct page *page)
381{
382 return ((page->flags & PG_head_tail_mask) == PG_head_mask);
383}
384
379static inline int PageTail(struct page *page) 385static inline int PageTail(struct page *page)
380{ 386{
381 return ((page->flags & PG_head_tail_mask) == PG_head_tail_mask); 387 return ((page->flags & PG_head_tail_mask) == PG_head_tail_mask);
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 0f8447376ddb..0eb65796bcb9 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -1568,6 +1568,7 @@
1568#define PCI_DEVICE_ID_RICOH_RL5C476 0x0476 1568#define PCI_DEVICE_ID_RICOH_RL5C476 0x0476
1569#define PCI_DEVICE_ID_RICOH_RL5C478 0x0478 1569#define PCI_DEVICE_ID_RICOH_RL5C478 0x0478
1570#define PCI_DEVICE_ID_RICOH_R5C822 0x0822 1570#define PCI_DEVICE_ID_RICOH_R5C822 0x0822
1571#define PCI_DEVICE_ID_RICOH_R5CE822 0xe822
1571#define PCI_DEVICE_ID_RICOH_R5CE823 0xe823 1572#define PCI_DEVICE_ID_RICOH_R5CE823 0xe823
1572#define PCI_DEVICE_ID_RICOH_R5C832 0x0832 1573#define PCI_DEVICE_ID_RICOH_R5C832 0x0832
1573#define PCI_DEVICE_ID_RICOH_R5C843 0x0843 1574#define PCI_DEVICE_ID_RICOH_R5C843 0x0843
diff --git a/include/linux/pid.h b/include/linux/pid.h
index b152d44fb181..2381c973d897 100644
--- a/include/linux/pid.h
+++ b/include/linux/pid.h
@@ -121,6 +121,7 @@ int next_pidmap(struct pid_namespace *pid_ns, unsigned int last);
121 121
122extern struct pid *alloc_pid(struct pid_namespace *ns); 122extern struct pid *alloc_pid(struct pid_namespace *ns);
123extern void free_pid(struct pid *pid); 123extern void free_pid(struct pid *pid);
124extern void disable_pid_allocation(struct pid_namespace *ns);
124 125
125/* 126/*
126 * ns_of_pid() returns the pid namespace in which the specified pid was 127 * ns_of_pid() returns the pid namespace in which the specified pid was
diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h
index bf285999273a..215e5e3dda10 100644
--- a/include/linux/pid_namespace.h
+++ b/include/linux/pid_namespace.h
@@ -21,7 +21,7 @@ struct pid_namespace {
21 struct kref kref; 21 struct kref kref;
22 struct pidmap pidmap[PIDMAP_ENTRIES]; 22 struct pidmap pidmap[PIDMAP_ENTRIES];
23 int last_pid; 23 int last_pid;
24 int nr_hashed; 24 unsigned int nr_hashed;
25 struct task_struct *child_reaper; 25 struct task_struct *child_reaper;
26 struct kmem_cache *pid_cachep; 26 struct kmem_cache *pid_cachep;
27 unsigned int level; 27 unsigned int level;
@@ -42,6 +42,8 @@ struct pid_namespace {
42 42
43extern struct pid_namespace init_pid_ns; 43extern struct pid_namespace init_pid_ns;
44 44
45#define PIDNS_HASH_ADDING (1U << 31)
46
45#ifdef CONFIG_PID_NS 47#ifdef CONFIG_PID_NS
46static inline struct pid_namespace *get_pid_ns(struct pid_namespace *ns) 48static inline struct pid_namespace *get_pid_ns(struct pid_namespace *ns)
47{ 49{
diff --git a/include/linux/raid/Kbuild b/include/linux/raid/Kbuild
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/include/linux/raid/Kbuild
+++ /dev/null
diff --git a/include/linux/usb/Kbuild b/include/linux/usb/Kbuild
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/include/linux/usb/Kbuild
+++ /dev/null
diff --git a/include/net/sock.h b/include/net/sock.h
index 93a6745bfdb2..182ca99405ad 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -367,7 +367,7 @@ struct sock {
367 unsigned short sk_ack_backlog; 367 unsigned short sk_ack_backlog;
368 unsigned short sk_max_ack_backlog; 368 unsigned short sk_max_ack_backlog;
369 __u32 sk_priority; 369 __u32 sk_priority;
370#ifdef CONFIG_CGROUPS 370#if IS_ENABLED(CONFIG_NETPRIO_CGROUP)
371 __u32 sk_cgrp_prioidx; 371 __u32 sk_cgrp_prioidx;
372#endif 372#endif
373 struct pid *sk_peer_pid; 373 struct pid *sk_peer_pid;
diff --git a/include/rdma/Kbuild b/include/rdma/Kbuild
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/include/rdma/Kbuild
+++ /dev/null
diff --git a/include/sound/Kbuild b/include/sound/Kbuild
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/include/sound/Kbuild
+++ /dev/null
diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h
index f6372b011366..7e8c36bc7082 100644
--- a/include/trace/events/ext4.h
+++ b/include/trace/events/ext4.h
@@ -451,7 +451,7 @@ DEFINE_EVENT(ext4__page_op, ext4_releasepage,
451 TP_ARGS(page) 451 TP_ARGS(page)
452); 452);
453 453
454TRACE_EVENT(ext4_invalidatepage, 454DECLARE_EVENT_CLASS(ext4_invalidatepage_op,
455 TP_PROTO(struct page *page, unsigned long offset), 455 TP_PROTO(struct page *page, unsigned long offset),
456 456
457 TP_ARGS(page, offset), 457 TP_ARGS(page, offset),
@@ -477,6 +477,18 @@ TRACE_EVENT(ext4_invalidatepage,
477 (unsigned long) __entry->index, __entry->offset) 477 (unsigned long) __entry->index, __entry->offset)
478); 478);
479 479
480DEFINE_EVENT(ext4_invalidatepage_op, ext4_invalidatepage,
481 TP_PROTO(struct page *page, unsigned long offset),
482
483 TP_ARGS(page, offset)
484);
485
486DEFINE_EVENT(ext4_invalidatepage_op, ext4_journalled_invalidatepage,
487 TP_PROTO(struct page *page, unsigned long offset),
488
489 TP_ARGS(page, offset)
490);
491
480TRACE_EVENT(ext4_discard_blocks, 492TRACE_EVENT(ext4_discard_blocks,
481 TP_PROTO(struct super_block *sb, unsigned long long blk, 493 TP_PROTO(struct super_block *sb, unsigned long long blk,
482 unsigned long long count), 494 unsigned long long count),
diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h
index b746a3cf5fa9..c4d2e9c74002 100644
--- a/include/uapi/drm/i915_drm.h
+++ b/include/uapi/drm/i915_drm.h
@@ -307,6 +307,7 @@ typedef struct drm_i915_irq_wait {
307#define I915_PARAM_HAS_PRIME_VMAP_FLUSH 21 307#define I915_PARAM_HAS_PRIME_VMAP_FLUSH 21
308#define I915_PARAM_RSVD_FOR_FUTURE_USE 22 308#define I915_PARAM_RSVD_FOR_FUTURE_USE 22
309#define I915_PARAM_HAS_SECURE_BATCHES 23 309#define I915_PARAM_HAS_SECURE_BATCHES 23
310#define I915_PARAM_HAS_PINNED_BATCHES 24
310 311
311typedef struct drm_i915_getparam { 312typedef struct drm_i915_getparam {
312 int param; 313 int param;
@@ -677,6 +678,15 @@ struct drm_i915_gem_execbuffer2 {
677 */ 678 */
678#define I915_EXEC_SECURE (1<<9) 679#define I915_EXEC_SECURE (1<<9)
679 680
681/** Inform the kernel that the batch is and will always be pinned. This
682 * negates the requirement for a workaround to be performed to avoid
683 * an incoherent CS (such as can be found on 830/845). If this flag is
684 * not passed, the kernel will endeavour to make sure the batch is
685 * coherent with the CS before execution. If this flag is passed,
686 * userspace assumes the responsibility for ensuring the same.
687 */
688#define I915_EXEC_IS_PINNED (1<<10)
689
680#define I915_EXEC_CONTEXT_ID_MASK (0xffffffff) 690#define I915_EXEC_CONTEXT_ID_MASK (0xffffffff)
681#define i915_execbuffer2_set_context_id(eb2, context) \ 691#define i915_execbuffer2_set_context_id(eb2, context) \
682 (eb2).rsvd1 = context & I915_EXEC_CONTEXT_ID_MASK 692 (eb2).rsvd1 = context & I915_EXEC_CONTEXT_ID_MASK
diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h
index 6b7b6f1e2fd6..ebfadc56d1b4 100644
--- a/include/uapi/linux/pci_regs.h
+++ b/include/uapi/linux/pci_regs.h
@@ -458,6 +458,8 @@
458#define PCI_EXP_DEVSTA_TRPND 0x20 /* Transactions Pending */ 458#define PCI_EXP_DEVSTA_TRPND 0x20 /* Transactions Pending */
459#define PCI_EXP_LNKCAP 12 /* Link Capabilities */ 459#define PCI_EXP_LNKCAP 12 /* Link Capabilities */
460#define PCI_EXP_LNKCAP_SLS 0x0000000f /* Supported Link Speeds */ 460#define PCI_EXP_LNKCAP_SLS 0x0000000f /* Supported Link Speeds */
461#define PCI_EXP_LNKCAP_SLS_2_5GB 0x1 /* LNKCAP2 SLS Vector bit 0 (2.5GT/s) */
462#define PCI_EXP_LNKCAP_SLS_5_0GB 0x2 /* LNKCAP2 SLS Vector bit 1 (5.0GT/s) */
461#define PCI_EXP_LNKCAP_MLW 0x000003f0 /* Maximum Link Width */ 463#define PCI_EXP_LNKCAP_MLW 0x000003f0 /* Maximum Link Width */
462#define PCI_EXP_LNKCAP_ASPMS 0x00000c00 /* ASPM Support */ 464#define PCI_EXP_LNKCAP_ASPMS 0x00000c00 /* ASPM Support */
463#define PCI_EXP_LNKCAP_L0SEL 0x00007000 /* L0s Exit Latency */ 465#define PCI_EXP_LNKCAP_L0SEL 0x00007000 /* L0s Exit Latency */
diff --git a/kernel/fork.c b/kernel/fork.c
index a31b823b3c2d..65ca6d27f24e 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1166,6 +1166,14 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1166 current->signal->flags & SIGNAL_UNKILLABLE) 1166 current->signal->flags & SIGNAL_UNKILLABLE)
1167 return ERR_PTR(-EINVAL); 1167 return ERR_PTR(-EINVAL);
1168 1168
1169 /*
1170 * If the new process will be in a different pid namespace
1171 * don't allow the creation of threads.
1172 */
1173 if ((clone_flags & (CLONE_VM|CLONE_NEWPID)) &&
1174 (task_active_pid_ns(current) != current->nsproxy->pid_ns))
1175 return ERR_PTR(-EINVAL);
1176
1169 retval = security_task_create(clone_flags); 1177 retval = security_task_create(clone_flags);
1170 if (retval) 1178 if (retval)
1171 goto fork_out; 1179 goto fork_out;
diff --git a/kernel/pid.c b/kernel/pid.c
index 36aa02ff17d6..de9af600006f 100644
--- a/kernel/pid.c
+++ b/kernel/pid.c
@@ -270,7 +270,6 @@ void free_pid(struct pid *pid)
270 wake_up_process(ns->child_reaper); 270 wake_up_process(ns->child_reaper);
271 break; 271 break;
272 case 0: 272 case 0:
273 ns->nr_hashed = -1;
274 schedule_work(&ns->proc_work); 273 schedule_work(&ns->proc_work);
275 break; 274 break;
276 } 275 }
@@ -319,7 +318,7 @@ struct pid *alloc_pid(struct pid_namespace *ns)
319 318
320 upid = pid->numbers + ns->level; 319 upid = pid->numbers + ns->level;
321 spin_lock_irq(&pidmap_lock); 320 spin_lock_irq(&pidmap_lock);
322 if (ns->nr_hashed < 0) 321 if (!(ns->nr_hashed & PIDNS_HASH_ADDING))
323 goto out_unlock; 322 goto out_unlock;
324 for ( ; upid >= pid->numbers; --upid) { 323 for ( ; upid >= pid->numbers; --upid) {
325 hlist_add_head_rcu(&upid->pid_chain, 324 hlist_add_head_rcu(&upid->pid_chain,
@@ -342,6 +341,13 @@ out_free:
342 goto out; 341 goto out;
343} 342}
344 343
344void disable_pid_allocation(struct pid_namespace *ns)
345{
346 spin_lock_irq(&pidmap_lock);
347 ns->nr_hashed &= ~PIDNS_HASH_ADDING;
348 spin_unlock_irq(&pidmap_lock);
349}
350
345struct pid *find_pid_ns(int nr, struct pid_namespace *ns) 351struct pid *find_pid_ns(int nr, struct pid_namespace *ns)
346{ 352{
347 struct hlist_node *elem; 353 struct hlist_node *elem;
@@ -573,6 +579,9 @@ void __init pidhash_init(void)
573 579
574void __init pidmap_init(void) 580void __init pidmap_init(void)
575{ 581{
582 /* Veryify no one has done anything silly */
583 BUILD_BUG_ON(PID_MAX_LIMIT >= PIDNS_HASH_ADDING);
584
576 /* bump default and minimum pid_max based on number of cpus */ 585 /* bump default and minimum pid_max based on number of cpus */
577 pid_max = min(pid_max_max, max_t(int, pid_max, 586 pid_max = min(pid_max_max, max_t(int, pid_max,
578 PIDS_PER_CPU_DEFAULT * num_possible_cpus())); 587 PIDS_PER_CPU_DEFAULT * num_possible_cpus()));
@@ -584,7 +593,7 @@ void __init pidmap_init(void)
584 /* Reserve PID 0. We never call free_pidmap(0) */ 593 /* Reserve PID 0. We never call free_pidmap(0) */
585 set_bit(0, init_pid_ns.pidmap[0].page); 594 set_bit(0, init_pid_ns.pidmap[0].page);
586 atomic_dec(&init_pid_ns.pidmap[0].nr_free); 595 atomic_dec(&init_pid_ns.pidmap[0].nr_free);
587 init_pid_ns.nr_hashed = 1; 596 init_pid_ns.nr_hashed = PIDNS_HASH_ADDING;
588 597
589 init_pid_ns.pid_cachep = KMEM_CACHE(pid, 598 init_pid_ns.pid_cachep = KMEM_CACHE(pid,
590 SLAB_HWCACHE_ALIGN | SLAB_PANIC); 599 SLAB_HWCACHE_ALIGN | SLAB_PANIC);
diff --git a/kernel/pid_namespace.c b/kernel/pid_namespace.c
index fdbd0cdf271a..c1c3dc1c6023 100644
--- a/kernel/pid_namespace.c
+++ b/kernel/pid_namespace.c
@@ -115,6 +115,7 @@ static struct pid_namespace *create_pid_namespace(struct user_namespace *user_ns
115 ns->level = level; 115 ns->level = level;
116 ns->parent = get_pid_ns(parent_pid_ns); 116 ns->parent = get_pid_ns(parent_pid_ns);
117 ns->user_ns = get_user_ns(user_ns); 117 ns->user_ns = get_user_ns(user_ns);
118 ns->nr_hashed = PIDNS_HASH_ADDING;
118 INIT_WORK(&ns->proc_work, proc_cleanup_work); 119 INIT_WORK(&ns->proc_work, proc_cleanup_work);
119 120
120 set_bit(0, ns->pidmap[0].page); 121 set_bit(0, ns->pidmap[0].page);
@@ -181,6 +182,9 @@ void zap_pid_ns_processes(struct pid_namespace *pid_ns)
181 int rc; 182 int rc;
182 struct task_struct *task, *me = current; 183 struct task_struct *task, *me = current;
183 184
185 /* Don't allow any more processes into the pid namespace */
186 disable_pid_allocation(pid_ns);
187
184 /* Ignore SIGCHLD causing any terminated children to autoreap */ 188 /* Ignore SIGCHLD causing any terminated children to autoreap */
185 spin_lock_irq(&me->sighand->siglock); 189 spin_lock_irq(&me->sighand->siglock);
186 me->sighand->action[SIGCHLD - 1].sa.sa_handler = SIG_IGN; 190 me->sighand->action[SIGCHLD - 1].sa.sa_handler = SIG_IGN;
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index d1b315e98627..e2df1c1fb41f 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -2132,7 +2132,7 @@ bool __mpol_equal(struct mempolicy *a, struct mempolicy *b)
2132 */ 2132 */
2133 2133
2134/* lookup first element intersecting start-end */ 2134/* lookup first element intersecting start-end */
2135/* Caller holds sp->mutex */ 2135/* Caller holds sp->lock */
2136static struct sp_node * 2136static struct sp_node *
2137sp_lookup(struct shared_policy *sp, unsigned long start, unsigned long end) 2137sp_lookup(struct shared_policy *sp, unsigned long start, unsigned long end)
2138{ 2138{
@@ -2196,13 +2196,13 @@ mpol_shared_policy_lookup(struct shared_policy *sp, unsigned long idx)
2196 2196
2197 if (!sp->root.rb_node) 2197 if (!sp->root.rb_node)
2198 return NULL; 2198 return NULL;
2199 mutex_lock(&sp->mutex); 2199 spin_lock(&sp->lock);
2200 sn = sp_lookup(sp, idx, idx+1); 2200 sn = sp_lookup(sp, idx, idx+1);
2201 if (sn) { 2201 if (sn) {
2202 mpol_get(sn->policy); 2202 mpol_get(sn->policy);
2203 pol = sn->policy; 2203 pol = sn->policy;
2204 } 2204 }
2205 mutex_unlock(&sp->mutex); 2205 spin_unlock(&sp->lock);
2206 return pol; 2206 return pol;
2207} 2207}
2208 2208
@@ -2328,6 +2328,14 @@ static void sp_delete(struct shared_policy *sp, struct sp_node *n)
2328 sp_free(n); 2328 sp_free(n);
2329} 2329}
2330 2330
2331static void sp_node_init(struct sp_node *node, unsigned long start,
2332 unsigned long end, struct mempolicy *pol)
2333{
2334 node->start = start;
2335 node->end = end;
2336 node->policy = pol;
2337}
2338
2331static struct sp_node *sp_alloc(unsigned long start, unsigned long end, 2339static struct sp_node *sp_alloc(unsigned long start, unsigned long end,
2332 struct mempolicy *pol) 2340 struct mempolicy *pol)
2333{ 2341{
@@ -2344,10 +2352,7 @@ static struct sp_node *sp_alloc(unsigned long start, unsigned long end,
2344 return NULL; 2352 return NULL;
2345 } 2353 }
2346 newpol->flags |= MPOL_F_SHARED; 2354 newpol->flags |= MPOL_F_SHARED;
2347 2355 sp_node_init(n, start, end, newpol);
2348 n->start = start;
2349 n->end = end;
2350 n->policy = newpol;
2351 2356
2352 return n; 2357 return n;
2353} 2358}
@@ -2357,9 +2362,12 @@ static int shared_policy_replace(struct shared_policy *sp, unsigned long start,
2357 unsigned long end, struct sp_node *new) 2362 unsigned long end, struct sp_node *new)
2358{ 2363{
2359 struct sp_node *n; 2364 struct sp_node *n;
2365 struct sp_node *n_new = NULL;
2366 struct mempolicy *mpol_new = NULL;
2360 int ret = 0; 2367 int ret = 0;
2361 2368
2362 mutex_lock(&sp->mutex); 2369restart:
2370 spin_lock(&sp->lock);
2363 n = sp_lookup(sp, start, end); 2371 n = sp_lookup(sp, start, end);
2364 /* Take care of old policies in the same range. */ 2372 /* Take care of old policies in the same range. */
2365 while (n && n->start < end) { 2373 while (n && n->start < end) {
@@ -2372,14 +2380,16 @@ static int shared_policy_replace(struct shared_policy *sp, unsigned long start,
2372 } else { 2380 } else {
2373 /* Old policy spanning whole new range. */ 2381 /* Old policy spanning whole new range. */
2374 if (n->end > end) { 2382 if (n->end > end) {
2375 struct sp_node *new2; 2383 if (!n_new)
2376 new2 = sp_alloc(end, n->end, n->policy); 2384 goto alloc_new;
2377 if (!new2) { 2385
2378 ret = -ENOMEM; 2386 *mpol_new = *n->policy;
2379 goto out; 2387 atomic_set(&mpol_new->refcnt, 1);
2380 } 2388 sp_node_init(n_new, n->end, end, mpol_new);
2389 sp_insert(sp, n_new);
2381 n->end = start; 2390 n->end = start;
2382 sp_insert(sp, new2); 2391 n_new = NULL;
2392 mpol_new = NULL;
2383 break; 2393 break;
2384 } else 2394 } else
2385 n->end = start; 2395 n->end = start;
@@ -2390,9 +2400,27 @@ static int shared_policy_replace(struct shared_policy *sp, unsigned long start,
2390 } 2400 }
2391 if (new) 2401 if (new)
2392 sp_insert(sp, new); 2402 sp_insert(sp, new);
2393out: 2403 spin_unlock(&sp->lock);
2394 mutex_unlock(&sp->mutex); 2404 ret = 0;
2405
2406err_out:
2407 if (mpol_new)
2408 mpol_put(mpol_new);
2409 if (n_new)
2410 kmem_cache_free(sn_cache, n_new);
2411
2395 return ret; 2412 return ret;
2413
2414alloc_new:
2415 spin_unlock(&sp->lock);
2416 ret = -ENOMEM;
2417 n_new = kmem_cache_alloc(sn_cache, GFP_KERNEL);
2418 if (!n_new)
2419 goto err_out;
2420 mpol_new = kmem_cache_alloc(policy_cache, GFP_KERNEL);
2421 if (!mpol_new)
2422 goto err_out;
2423 goto restart;
2396} 2424}
2397 2425
2398/** 2426/**
@@ -2410,7 +2438,7 @@ void mpol_shared_policy_init(struct shared_policy *sp, struct mempolicy *mpol)
2410 int ret; 2438 int ret;
2411 2439
2412 sp->root = RB_ROOT; /* empty tree == default mempolicy */ 2440 sp->root = RB_ROOT; /* empty tree == default mempolicy */
2413 mutex_init(&sp->mutex); 2441 spin_lock_init(&sp->lock);
2414 2442
2415 if (mpol) { 2443 if (mpol) {
2416 struct vm_area_struct pvma; 2444 struct vm_area_struct pvma;
@@ -2476,14 +2504,14 @@ void mpol_free_shared_policy(struct shared_policy *p)
2476 2504
2477 if (!p->root.rb_node) 2505 if (!p->root.rb_node)
2478 return; 2506 return;
2479 mutex_lock(&p->mutex); 2507 spin_lock(&p->lock);
2480 next = rb_first(&p->root); 2508 next = rb_first(&p->root);
2481 while (next) { 2509 while (next) {
2482 n = rb_entry(next, struct sp_node, nd); 2510 n = rb_entry(next, struct sp_node, nd);
2483 next = rb_next(&n->nd); 2511 next = rb_next(&n->nd);
2484 sp_delete(p, n); 2512 sp_delete(p, n);
2485 } 2513 }
2486 mutex_unlock(&p->mutex); 2514 spin_unlock(&p->lock);
2487} 2515}
2488 2516
2489#ifdef CONFIG_NUMA_BALANCING 2517#ifdef CONFIG_NUMA_BALANCING
@@ -2595,8 +2623,7 @@ void numa_default_policy(void)
2595 */ 2623 */
2596 2624
2597/* 2625/*
2598 * "local" is pseudo-policy: MPOL_PREFERRED with MPOL_F_LOCAL flag 2626 * "local" is implemented internally by MPOL_PREFERRED with MPOL_F_LOCAL flag.
2599 * Used only for mpol_parse_str() and mpol_to_str()
2600 */ 2627 */
2601static const char * const policy_modes[] = 2628static const char * const policy_modes[] =
2602{ 2629{
@@ -2610,28 +2637,20 @@ static const char * const policy_modes[] =
2610 2637
2611#ifdef CONFIG_TMPFS 2638#ifdef CONFIG_TMPFS
2612/** 2639/**
2613 * mpol_parse_str - parse string to mempolicy 2640 * mpol_parse_str - parse string to mempolicy, for tmpfs mpol mount option.
2614 * @str: string containing mempolicy to parse 2641 * @str: string containing mempolicy to parse
2615 * @mpol: pointer to struct mempolicy pointer, returned on success. 2642 * @mpol: pointer to struct mempolicy pointer, returned on success.
2616 * @no_context: flag whether to "contextualize" the mempolicy
2617 * 2643 *
2618 * Format of input: 2644 * Format of input:
2619 * <mode>[=<flags>][:<nodelist>] 2645 * <mode>[=<flags>][:<nodelist>]
2620 * 2646 *
2621 * if @no_context is true, save the input nodemask in w.user_nodemask in
2622 * the returned mempolicy. This will be used to "clone" the mempolicy in
2623 * a specific context [cpuset] at a later time. Used to parse tmpfs mpol
2624 * mount option. Note that if 'static' or 'relative' mode flags were
2625 * specified, the input nodemask will already have been saved. Saving
2626 * it again is redundant, but safe.
2627 *
2628 * On success, returns 0, else 1 2647 * On success, returns 0, else 1
2629 */ 2648 */
2630int mpol_parse_str(char *str, struct mempolicy **mpol, int no_context) 2649int mpol_parse_str(char *str, struct mempolicy **mpol)
2631{ 2650{
2632 struct mempolicy *new = NULL; 2651 struct mempolicy *new = NULL;
2633 unsigned short mode; 2652 unsigned short mode;
2634 unsigned short uninitialized_var(mode_flags); 2653 unsigned short mode_flags;
2635 nodemask_t nodes; 2654 nodemask_t nodes;
2636 char *nodelist = strchr(str, ':'); 2655 char *nodelist = strchr(str, ':');
2637 char *flags = strchr(str, '='); 2656 char *flags = strchr(str, '=');
@@ -2719,24 +2738,23 @@ int mpol_parse_str(char *str, struct mempolicy **mpol, int no_context)
2719 if (IS_ERR(new)) 2738 if (IS_ERR(new))
2720 goto out; 2739 goto out;
2721 2740
2722 if (no_context) { 2741 /*
2723 /* save for contextualization */ 2742 * Save nodes for mpol_to_str() to show the tmpfs mount options
2724 new->w.user_nodemask = nodes; 2743 * for /proc/mounts, /proc/pid/mounts and /proc/pid/mountinfo.
2725 } else { 2744 */
2726 int ret; 2745 if (mode != MPOL_PREFERRED)
2727 NODEMASK_SCRATCH(scratch); 2746 new->v.nodes = nodes;
2728 if (scratch) { 2747 else if (nodelist)
2729 task_lock(current); 2748 new->v.preferred_node = first_node(nodes);
2730 ret = mpol_set_nodemask(new, &nodes, scratch); 2749 else
2731 task_unlock(current); 2750 new->flags |= MPOL_F_LOCAL;
2732 } else 2751
2733 ret = -ENOMEM; 2752 /*
2734 NODEMASK_SCRATCH_FREE(scratch); 2753 * Save nodes for contextualization: this will be used to "clone"
2735 if (ret) { 2754 * the mempolicy in a specific context [cpuset] at a later time.
2736 mpol_put(new); 2755 */
2737 goto out; 2756 new->w.user_nodemask = nodes;
2738 } 2757
2739 }
2740 err = 0; 2758 err = 0;
2741 2759
2742out: 2760out:
@@ -2756,13 +2774,12 @@ out:
2756 * @buffer: to contain formatted mempolicy string 2774 * @buffer: to contain formatted mempolicy string
2757 * @maxlen: length of @buffer 2775 * @maxlen: length of @buffer
2758 * @pol: pointer to mempolicy to be formatted 2776 * @pol: pointer to mempolicy to be formatted
2759 * @no_context: "context free" mempolicy - use nodemask in w.user_nodemask
2760 * 2777 *
2761 * Convert a mempolicy into a string. 2778 * Convert a mempolicy into a string.
2762 * Returns the number of characters in buffer (if positive) 2779 * Returns the number of characters in buffer (if positive)
2763 * or an error (negative) 2780 * or an error (negative)
2764 */ 2781 */
2765int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol, int no_context) 2782int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol)
2766{ 2783{
2767 char *p = buffer; 2784 char *p = buffer;
2768 int l; 2785 int l;
@@ -2788,7 +2805,7 @@ int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol, int no_context)
2788 case MPOL_PREFERRED: 2805 case MPOL_PREFERRED:
2789 nodes_clear(nodes); 2806 nodes_clear(nodes);
2790 if (flags & MPOL_F_LOCAL) 2807 if (flags & MPOL_F_LOCAL)
2791 mode = MPOL_LOCAL; /* pseudo-policy */ 2808 mode = MPOL_LOCAL;
2792 else 2809 else
2793 node_set(pol->v.preferred_node, nodes); 2810 node_set(pol->v.preferred_node, nodes);
2794 break; 2811 break;
@@ -2796,10 +2813,7 @@ int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol, int no_context)
2796 case MPOL_BIND: 2813 case MPOL_BIND:
2797 /* Fall through */ 2814 /* Fall through */
2798 case MPOL_INTERLEAVE: 2815 case MPOL_INTERLEAVE:
2799 if (no_context) 2816 nodes = pol->v.nodes;
2800 nodes = pol->w.user_nodemask;
2801 else
2802 nodes = pol->v.nodes;
2803 break; 2817 break;
2804 2818
2805 default: 2819 default:
diff --git a/mm/shmem.c b/mm/shmem.c
index 5c90d84c2b02..5dd56f6efdbd 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -889,7 +889,7 @@ static void shmem_show_mpol(struct seq_file *seq, struct mempolicy *mpol)
889 if (!mpol || mpol->mode == MPOL_DEFAULT) 889 if (!mpol || mpol->mode == MPOL_DEFAULT)
890 return; /* show nothing */ 890 return; /* show nothing */
891 891
892 mpol_to_str(buffer, sizeof(buffer), mpol, 1); 892 mpol_to_str(buffer, sizeof(buffer), mpol);
893 893
894 seq_printf(seq, ",mpol=%s", buffer); 894 seq_printf(seq, ",mpol=%s", buffer);
895} 895}
@@ -2463,7 +2463,7 @@ static int shmem_parse_options(char *options, struct shmem_sb_info *sbinfo,
2463 if (!gid_valid(sbinfo->gid)) 2463 if (!gid_valid(sbinfo->gid))
2464 goto bad_val; 2464 goto bad_val;
2465 } else if (!strcmp(this_char,"mpol")) { 2465 } else if (!strcmp(this_char,"mpol")) {
2466 if (mpol_parse_str(value, &sbinfo->mpol, 1)) 2466 if (mpol_parse_str(value, &sbinfo->mpol))
2467 goto bad_val; 2467 goto bad_val;
2468 } else { 2468 } else {
2469 printk(KERN_ERR "tmpfs: Bad mount option %s\n", 2469 printk(KERN_ERR "tmpfs: Bad mount option %s\n",
diff --git a/mm/vmscan.c b/mm/vmscan.c
index adc7e9058181..16b42af393ac 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2452,12 +2452,16 @@ static bool zone_balanced(struct zone *zone, int order,
2452} 2452}
2453 2453
2454/* 2454/*
2455 * pgdat_balanced is used when checking if a node is balanced for high-order 2455 * pgdat_balanced() is used when checking if a node is balanced.
2456 * allocations. Only zones that meet watermarks and are in a zone allowed 2456 *
2457 * by the callers classzone_idx are added to balanced_pages. The total of 2457 * For order-0, all zones must be balanced!
2458 * balanced pages must be at least 25% of the zones allowed by classzone_idx 2458 *
2459 * for the node to be considered balanced. Forcing all zones to be balanced 2459 * For high-order allocations only zones that meet watermarks and are in a
2460 * for high orders can cause excessive reclaim when there are imbalanced zones. 2460 * zone allowed by the callers classzone_idx are added to balanced_pages. The
2461 * total of balanced pages must be at least 25% of the zones allowed by
2462 * classzone_idx for the node to be considered balanced. Forcing all zones to
2463 * be balanced for high orders can cause excessive reclaim when there are
2464 * imbalanced zones.
2461 * The choice of 25% is due to 2465 * The choice of 25% is due to
2462 * o a 16M DMA zone that is balanced will not balance a zone on any 2466 * o a 16M DMA zone that is balanced will not balance a zone on any
2463 * reasonable sized machine 2467 * reasonable sized machine
@@ -2467,17 +2471,43 @@ static bool zone_balanced(struct zone *zone, int order,
2467 * Similarly, on x86-64 the Normal zone would need to be at least 1G 2471 * Similarly, on x86-64 the Normal zone would need to be at least 1G
2468 * to balance a node on its own. These seemed like reasonable ratios. 2472 * to balance a node on its own. These seemed like reasonable ratios.
2469 */ 2473 */
2470static bool pgdat_balanced(pg_data_t *pgdat, unsigned long balanced_pages, 2474static bool pgdat_balanced(pg_data_t *pgdat, int order, int classzone_idx)
2471 int classzone_idx)
2472{ 2475{
2473 unsigned long present_pages = 0; 2476 unsigned long present_pages = 0;
2477 unsigned long balanced_pages = 0;
2474 int i; 2478 int i;
2475 2479
2476 for (i = 0; i <= classzone_idx; i++) 2480 /* Check the watermark levels */
2477 present_pages += pgdat->node_zones[i].present_pages; 2481 for (i = 0; i <= classzone_idx; i++) {
2482 struct zone *zone = pgdat->node_zones + i;
2478 2483
2479 /* A special case here: if zone has no page, we think it's balanced */ 2484 if (!populated_zone(zone))
2480 return balanced_pages >= (present_pages >> 2); 2485 continue;
2486
2487 present_pages += zone->present_pages;
2488
2489 /*
2490 * A special case here:
2491 *
2492 * balance_pgdat() skips over all_unreclaimable after
2493 * DEF_PRIORITY. Effectively, it considers them balanced so
2494 * they must be considered balanced here as well!
2495 */
2496 if (zone->all_unreclaimable) {
2497 balanced_pages += zone->present_pages;
2498 continue;
2499 }
2500
2501 if (zone_balanced(zone, order, 0, i))
2502 balanced_pages += zone->present_pages;
2503 else if (!order)
2504 return false;
2505 }
2506
2507 if (order)
2508 return balanced_pages >= (present_pages >> 2);
2509 else
2510 return true;
2481} 2511}
2482 2512
2483/* 2513/*
@@ -2489,10 +2519,6 @@ static bool pgdat_balanced(pg_data_t *pgdat, unsigned long balanced_pages,
2489static bool prepare_kswapd_sleep(pg_data_t *pgdat, int order, long remaining, 2519static bool prepare_kswapd_sleep(pg_data_t *pgdat, int order, long remaining,
2490 int classzone_idx) 2520 int classzone_idx)
2491{ 2521{
2492 int i;
2493 unsigned long balanced = 0;
2494 bool all_zones_ok = true;
2495
2496 /* If a direct reclaimer woke kswapd within HZ/10, it's premature */ 2522 /* If a direct reclaimer woke kswapd within HZ/10, it's premature */
2497 if (remaining) 2523 if (remaining)
2498 return false; 2524 return false;
@@ -2511,39 +2537,7 @@ static bool prepare_kswapd_sleep(pg_data_t *pgdat, int order, long remaining,
2511 return false; 2537 return false;
2512 } 2538 }
2513 2539
2514 /* Check the watermark levels */ 2540 return pgdat_balanced(pgdat, order, classzone_idx);
2515 for (i = 0; i <= classzone_idx; i++) {
2516 struct zone *zone = pgdat->node_zones + i;
2517
2518 if (!populated_zone(zone))
2519 continue;
2520
2521 /*
2522 * balance_pgdat() skips over all_unreclaimable after
2523 * DEF_PRIORITY. Effectively, it considers them balanced so
2524 * they must be considered balanced here as well if kswapd
2525 * is to sleep
2526 */
2527 if (zone->all_unreclaimable) {
2528 balanced += zone->present_pages;
2529 continue;
2530 }
2531
2532 if (!zone_balanced(zone, order, 0, i))
2533 all_zones_ok = false;
2534 else
2535 balanced += zone->present_pages;
2536 }
2537
2538 /*
2539 * For high-order requests, the balanced zones must contain at least
2540 * 25% of the nodes pages for kswapd to sleep. For order-0, all zones
2541 * must be balanced
2542 */
2543 if (order)
2544 return pgdat_balanced(pgdat, balanced, classzone_idx);
2545 else
2546 return all_zones_ok;
2547} 2541}
2548 2542
2549/* 2543/*
@@ -2571,7 +2565,6 @@ static unsigned long balance_pgdat(pg_data_t *pgdat, int order,
2571 int *classzone_idx) 2565 int *classzone_idx)
2572{ 2566{
2573 struct zone *unbalanced_zone; 2567 struct zone *unbalanced_zone;
2574 unsigned long balanced;
2575 int i; 2568 int i;
2576 int end_zone = 0; /* Inclusive. 0 = ZONE_DMA */ 2569 int end_zone = 0; /* Inclusive. 0 = ZONE_DMA */
2577 unsigned long total_scanned; 2570 unsigned long total_scanned;
@@ -2605,7 +2598,6 @@ loop_again:
2605 int has_under_min_watermark_zone = 0; 2598 int has_under_min_watermark_zone = 0;
2606 2599
2607 unbalanced_zone = NULL; 2600 unbalanced_zone = NULL;
2608 balanced = 0;
2609 2601
2610 /* 2602 /*
2611 * Scan in the highmem->dma direction for the highest 2603 * Scan in the highmem->dma direction for the highest
@@ -2761,8 +2753,6 @@ loop_again:
2761 * speculatively avoid congestion waits 2753 * speculatively avoid congestion waits
2762 */ 2754 */
2763 zone_clear_flag(zone, ZONE_CONGESTED); 2755 zone_clear_flag(zone, ZONE_CONGESTED);
2764 if (i <= *classzone_idx)
2765 balanced += zone->present_pages;
2766 } 2756 }
2767 2757
2768 } 2758 }
@@ -2776,7 +2766,7 @@ loop_again:
2776 pfmemalloc_watermark_ok(pgdat)) 2766 pfmemalloc_watermark_ok(pgdat))
2777 wake_up(&pgdat->pfmemalloc_wait); 2767 wake_up(&pgdat->pfmemalloc_wait);
2778 2768
2779 if (!unbalanced_zone || (order && pgdat_balanced(pgdat, balanced, *classzone_idx))) 2769 if (pgdat_balanced(pgdat, order, *classzone_idx))
2780 break; /* kswapd: all done */ 2770 break; /* kswapd: all done */
2781 /* 2771 /*
2782 * OK, kswapd is getting into trouble. Take a nap, then take 2772 * OK, kswapd is getting into trouble. Take a nap, then take
@@ -2785,7 +2775,7 @@ loop_again:
2785 if (total_scanned && (sc.priority < DEF_PRIORITY - 2)) { 2775 if (total_scanned && (sc.priority < DEF_PRIORITY - 2)) {
2786 if (has_under_min_watermark_zone) 2776 if (has_under_min_watermark_zone)
2787 count_vm_event(KSWAPD_SKIP_CONGESTION_WAIT); 2777 count_vm_event(KSWAPD_SKIP_CONGESTION_WAIT);
2788 else 2778 else if (unbalanced_zone)
2789 wait_iff_congested(unbalanced_zone, BLK_RW_ASYNC, HZ/10); 2779 wait_iff_congested(unbalanced_zone, BLK_RW_ASYNC, HZ/10);
2790 } 2780 }
2791 2781
@@ -2800,12 +2790,7 @@ loop_again:
2800 } while (--sc.priority >= 0); 2790 } while (--sc.priority >= 0);
2801out: 2791out:
2802 2792
2803 /* 2793 if (!pgdat_balanced(pgdat, order, *classzone_idx)) {
2804 * order-0: All zones must meet high watermark for a balanced node
2805 * high-order: Balanced zones must make up at least 25% of the node
2806 * for the node to be balanced
2807 */
2808 if (unbalanced_zone && (!order || !pgdat_balanced(pgdat, balanced, *classzone_idx))) {
2809 cond_resched(); 2794 cond_resched();
2810 2795
2811 try_to_freeze(); 2796 try_to_freeze();
diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
index 9f3925a85aab..7d02ebd11a7f 100644
--- a/net/batman-adv/bat_iv_ogm.c
+++ b/net/batman-adv/bat_iv_ogm.c
@@ -123,7 +123,7 @@ batadv_iv_ogm_emit_send_time(const struct batadv_priv *bat_priv)
123 unsigned int msecs; 123 unsigned int msecs;
124 124
125 msecs = atomic_read(&bat_priv->orig_interval) - BATADV_JITTER; 125 msecs = atomic_read(&bat_priv->orig_interval) - BATADV_JITTER;
126 msecs += (random32() % 2 * BATADV_JITTER); 126 msecs += random32() % (2 * BATADV_JITTER);
127 127
128 return jiffies + msecs_to_jiffies(msecs); 128 return jiffies + msecs_to_jiffies(msecs);
129} 129}
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index 1c8fdc3558cd..37fe693471a8 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -366,11 +366,11 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
366 366
367 err = netdev_set_master(dev, br->dev); 367 err = netdev_set_master(dev, br->dev);
368 if (err) 368 if (err)
369 goto err3; 369 goto err4;
370 370
371 err = netdev_rx_handler_register(dev, br_handle_frame, p); 371 err = netdev_rx_handler_register(dev, br_handle_frame, p);
372 if (err) 372 if (err)
373 goto err4; 373 goto err5;
374 374
375 dev->priv_flags |= IFF_BRIDGE_PORT; 375 dev->priv_flags |= IFF_BRIDGE_PORT;
376 376
@@ -402,8 +402,10 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
402 402
403 return 0; 403 return 0;
404 404
405err4: 405err5:
406 netdev_set_master(dev, NULL); 406 netdev_set_master(dev, NULL);
407err4:
408 br_netpoll_disable(p);
407err3: 409err3:
408 sysfs_remove_link(br->ifobj, p->dev->name); 410 sysfs_remove_link(br->ifobj, p->dev->name);
409err2: 411err2:
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
index 4d111fd2b492..5ccf87ed8d68 100644
--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -506,6 +506,7 @@ static void reset_connection(struct ceph_connection *con)
506{ 506{
507 /* reset connection, out_queue, msg_ and connect_seq */ 507 /* reset connection, out_queue, msg_ and connect_seq */
508 /* discard existing out_queue and msg_seq */ 508 /* discard existing out_queue and msg_seq */
509 dout("reset_connection %p\n", con);
509 ceph_msg_remove_list(&con->out_queue); 510 ceph_msg_remove_list(&con->out_queue);
510 ceph_msg_remove_list(&con->out_sent); 511 ceph_msg_remove_list(&con->out_sent);
511 512
@@ -561,7 +562,7 @@ void ceph_con_open(struct ceph_connection *con,
561 mutex_lock(&con->mutex); 562 mutex_lock(&con->mutex);
562 dout("con_open %p %s\n", con, ceph_pr_addr(&addr->in_addr)); 563 dout("con_open %p %s\n", con, ceph_pr_addr(&addr->in_addr));
563 564
564 BUG_ON(con->state != CON_STATE_CLOSED); 565 WARN_ON(con->state != CON_STATE_CLOSED);
565 con->state = CON_STATE_PREOPEN; 566 con->state = CON_STATE_PREOPEN;
566 567
567 con->peer_name.type = (__u8) entity_type; 568 con->peer_name.type = (__u8) entity_type;
@@ -1506,13 +1507,6 @@ static int process_banner(struct ceph_connection *con)
1506 return 0; 1507 return 0;
1507} 1508}
1508 1509
1509static void fail_protocol(struct ceph_connection *con)
1510{
1511 reset_connection(con);
1512 BUG_ON(con->state != CON_STATE_NEGOTIATING);
1513 con->state = CON_STATE_CLOSED;
1514}
1515
1516static int process_connect(struct ceph_connection *con) 1510static int process_connect(struct ceph_connection *con)
1517{ 1511{
1518 u64 sup_feat = con->msgr->supported_features; 1512 u64 sup_feat = con->msgr->supported_features;
@@ -1530,7 +1524,7 @@ static int process_connect(struct ceph_connection *con)
1530 ceph_pr_addr(&con->peer_addr.in_addr), 1524 ceph_pr_addr(&con->peer_addr.in_addr),
1531 sup_feat, server_feat, server_feat & ~sup_feat); 1525 sup_feat, server_feat, server_feat & ~sup_feat);
1532 con->error_msg = "missing required protocol features"; 1526 con->error_msg = "missing required protocol features";
1533 fail_protocol(con); 1527 reset_connection(con);
1534 return -1; 1528 return -1;
1535 1529
1536 case CEPH_MSGR_TAG_BADPROTOVER: 1530 case CEPH_MSGR_TAG_BADPROTOVER:
@@ -1541,7 +1535,7 @@ static int process_connect(struct ceph_connection *con)
1541 le32_to_cpu(con->out_connect.protocol_version), 1535 le32_to_cpu(con->out_connect.protocol_version),
1542 le32_to_cpu(con->in_reply.protocol_version)); 1536 le32_to_cpu(con->in_reply.protocol_version));
1543 con->error_msg = "protocol version mismatch"; 1537 con->error_msg = "protocol version mismatch";
1544 fail_protocol(con); 1538 reset_connection(con);
1545 return -1; 1539 return -1;
1546 1540
1547 case CEPH_MSGR_TAG_BADAUTHORIZER: 1541 case CEPH_MSGR_TAG_BADAUTHORIZER:
@@ -1631,11 +1625,11 @@ static int process_connect(struct ceph_connection *con)
1631 ceph_pr_addr(&con->peer_addr.in_addr), 1625 ceph_pr_addr(&con->peer_addr.in_addr),
1632 req_feat, server_feat, req_feat & ~server_feat); 1626 req_feat, server_feat, req_feat & ~server_feat);
1633 con->error_msg = "missing required protocol features"; 1627 con->error_msg = "missing required protocol features";
1634 fail_protocol(con); 1628 reset_connection(con);
1635 return -1; 1629 return -1;
1636 } 1630 }
1637 1631
1638 BUG_ON(con->state != CON_STATE_NEGOTIATING); 1632 WARN_ON(con->state != CON_STATE_NEGOTIATING);
1639 con->state = CON_STATE_OPEN; 1633 con->state = CON_STATE_OPEN;
1640 1634
1641 con->peer_global_seq = le32_to_cpu(con->in_reply.global_seq); 1635 con->peer_global_seq = le32_to_cpu(con->in_reply.global_seq);
@@ -2132,7 +2126,6 @@ more:
2132 if (ret < 0) 2126 if (ret < 0)
2133 goto out; 2127 goto out;
2134 2128
2135 BUG_ON(con->state != CON_STATE_CONNECTING);
2136 con->state = CON_STATE_NEGOTIATING; 2129 con->state = CON_STATE_NEGOTIATING;
2137 2130
2138 /* 2131 /*
@@ -2160,7 +2153,7 @@ more:
2160 goto more; 2153 goto more;
2161 } 2154 }
2162 2155
2163 BUG_ON(con->state != CON_STATE_OPEN); 2156 WARN_ON(con->state != CON_STATE_OPEN);
2164 2157
2165 if (con->in_base_pos < 0) { 2158 if (con->in_base_pos < 0) {
2166 /* 2159 /*
@@ -2382,7 +2375,7 @@ static void ceph_fault(struct ceph_connection *con)
2382 dout("fault %p state %lu to peer %s\n", 2375 dout("fault %p state %lu to peer %s\n",
2383 con, con->state, ceph_pr_addr(&con->peer_addr.in_addr)); 2376 con, con->state, ceph_pr_addr(&con->peer_addr.in_addr));
2384 2377
2385 BUG_ON(con->state != CON_STATE_CONNECTING && 2378 WARN_ON(con->state != CON_STATE_CONNECTING &&
2386 con->state != CON_STATE_NEGOTIATING && 2379 con->state != CON_STATE_NEGOTIATING &&
2387 con->state != CON_STATE_OPEN); 2380 con->state != CON_STATE_OPEN);
2388 2381
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index 780caf6b0491..eb9a44478764 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -1270,7 +1270,7 @@ static void reset_changed_osds(struct ceph_osd_client *osdc)
1270 * Requeue requests whose mapping to an OSD has changed. If requests map to 1270 * Requeue requests whose mapping to an OSD has changed. If requests map to
1271 * no osd, request a new map. 1271 * no osd, request a new map.
1272 * 1272 *
1273 * Caller should hold map_sem for read and request_mutex. 1273 * Caller should hold map_sem for read.
1274 */ 1274 */
1275static void kick_requests(struct ceph_osd_client *osdc, int force_resend) 1275static void kick_requests(struct ceph_osd_client *osdc, int force_resend)
1276{ 1276{
@@ -1284,6 +1284,24 @@ static void kick_requests(struct ceph_osd_client *osdc, int force_resend)
1284 for (p = rb_first(&osdc->requests); p; ) { 1284 for (p = rb_first(&osdc->requests); p; ) {
1285 req = rb_entry(p, struct ceph_osd_request, r_node); 1285 req = rb_entry(p, struct ceph_osd_request, r_node);
1286 p = rb_next(p); 1286 p = rb_next(p);
1287
1288 /*
1289 * For linger requests that have not yet been
1290 * registered, move them to the linger list; they'll
1291 * be sent to the osd in the loop below. Unregister
1292 * the request before re-registering it as a linger
1293 * request to ensure the __map_request() below
1294 * will decide it needs to be sent.
1295 */
1296 if (req->r_linger && list_empty(&req->r_linger_item)) {
1297 dout("%p tid %llu restart on osd%d\n",
1298 req, req->r_tid,
1299 req->r_osd ? req->r_osd->o_osd : -1);
1300 __unregister_request(osdc, req);
1301 __register_linger_request(osdc, req);
1302 continue;
1303 }
1304
1287 err = __map_request(osdc, req, force_resend); 1305 err = __map_request(osdc, req, force_resend);
1288 if (err < 0) 1306 if (err < 0)
1289 continue; /* error */ 1307 continue; /* error */
@@ -1298,17 +1316,6 @@ static void kick_requests(struct ceph_osd_client *osdc, int force_resend)
1298 req->r_flags |= CEPH_OSD_FLAG_RETRY; 1316 req->r_flags |= CEPH_OSD_FLAG_RETRY;
1299 } 1317 }
1300 } 1318 }
1301 if (req->r_linger && list_empty(&req->r_linger_item)) {
1302 /*
1303 * register as a linger so that we will
1304 * re-submit below and get a new tid
1305 */
1306 dout("%p tid %llu restart on osd%d\n",
1307 req, req->r_tid,
1308 req->r_osd ? req->r_osd->o_osd : -1);
1309 __register_linger_request(osdc, req);
1310 __unregister_request(osdc, req);
1311 }
1312 } 1319 }
1313 1320
1314 list_for_each_entry_safe(req, nreq, &osdc->req_linger, 1321 list_for_each_entry_safe(req, nreq, &osdc->req_linger,
@@ -1316,6 +1323,7 @@ static void kick_requests(struct ceph_osd_client *osdc, int force_resend)
1316 dout("linger req=%p req->r_osd=%p\n", req, req->r_osd); 1323 dout("linger req=%p req->r_osd=%p\n", req, req->r_osd);
1317 1324
1318 err = __map_request(osdc, req, force_resend); 1325 err = __map_request(osdc, req, force_resend);
1326 dout("__map_request returned %d\n", err);
1319 if (err == 0) 1327 if (err == 0)
1320 continue; /* no change and no osd was specified */ 1328 continue; /* no change and no osd was specified */
1321 if (err < 0) 1329 if (err < 0)
@@ -1337,6 +1345,7 @@ static void kick_requests(struct ceph_osd_client *osdc, int force_resend)
1337 dout("%d requests for down osds, need new map\n", needmap); 1345 dout("%d requests for down osds, need new map\n", needmap);
1338 ceph_monc_request_next_osdmap(&osdc->client->monc); 1346 ceph_monc_request_next_osdmap(&osdc->client->monc);
1339 } 1347 }
1348 reset_changed_osds(osdc);
1340} 1349}
1341 1350
1342 1351
@@ -1393,7 +1402,6 @@ void ceph_osdc_handle_map(struct ceph_osd_client *osdc, struct ceph_msg *msg)
1393 osdc->osdmap = newmap; 1402 osdc->osdmap = newmap;
1394 } 1403 }
1395 kick_requests(osdc, 0); 1404 kick_requests(osdc, 0);
1396 reset_changed_osds(osdc);
1397 } else { 1405 } else {
1398 dout("ignoring incremental map %u len %d\n", 1406 dout("ignoring incremental map %u len %d\n",
1399 epoch, maplen); 1407 epoch, maplen);
diff --git a/net/core/dev.c b/net/core/dev.c
index d0cbc93fcf32..515473ee52cb 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -203,7 +203,7 @@ static struct list_head offload_base __read_mostly;
203DEFINE_RWLOCK(dev_base_lock); 203DEFINE_RWLOCK(dev_base_lock);
204EXPORT_SYMBOL(dev_base_lock); 204EXPORT_SYMBOL(dev_base_lock);
205 205
206DEFINE_SEQLOCK(devnet_rename_seq); 206seqcount_t devnet_rename_seq;
207 207
208static inline void dev_base_seq_inc(struct net *net) 208static inline void dev_base_seq_inc(struct net *net)
209{ 209{
@@ -1093,10 +1093,10 @@ int dev_change_name(struct net_device *dev, const char *newname)
1093 if (dev->flags & IFF_UP) 1093 if (dev->flags & IFF_UP)
1094 return -EBUSY; 1094 return -EBUSY;
1095 1095
1096 write_seqlock(&devnet_rename_seq); 1096 write_seqcount_begin(&devnet_rename_seq);
1097 1097
1098 if (strncmp(newname, dev->name, IFNAMSIZ) == 0) { 1098 if (strncmp(newname, dev->name, IFNAMSIZ) == 0) {
1099 write_sequnlock(&devnet_rename_seq); 1099 write_seqcount_end(&devnet_rename_seq);
1100 return 0; 1100 return 0;
1101 } 1101 }
1102 1102
@@ -1104,7 +1104,7 @@ int dev_change_name(struct net_device *dev, const char *newname)
1104 1104
1105 err = dev_get_valid_name(net, dev, newname); 1105 err = dev_get_valid_name(net, dev, newname);
1106 if (err < 0) { 1106 if (err < 0) {
1107 write_sequnlock(&devnet_rename_seq); 1107 write_seqcount_end(&devnet_rename_seq);
1108 return err; 1108 return err;
1109 } 1109 }
1110 1110
@@ -1112,11 +1112,11 @@ rollback:
1112 ret = device_rename(&dev->dev, dev->name); 1112 ret = device_rename(&dev->dev, dev->name);
1113 if (ret) { 1113 if (ret) {
1114 memcpy(dev->name, oldname, IFNAMSIZ); 1114 memcpy(dev->name, oldname, IFNAMSIZ);
1115 write_sequnlock(&devnet_rename_seq); 1115 write_seqcount_end(&devnet_rename_seq);
1116 return ret; 1116 return ret;
1117 } 1117 }
1118 1118
1119 write_sequnlock(&devnet_rename_seq); 1119 write_seqcount_end(&devnet_rename_seq);
1120 1120
1121 write_lock_bh(&dev_base_lock); 1121 write_lock_bh(&dev_base_lock);
1122 hlist_del_rcu(&dev->name_hlist); 1122 hlist_del_rcu(&dev->name_hlist);
@@ -1135,7 +1135,7 @@ rollback:
1135 /* err >= 0 after dev_alloc_name() or stores the first errno */ 1135 /* err >= 0 after dev_alloc_name() or stores the first errno */
1136 if (err >= 0) { 1136 if (err >= 0) {
1137 err = ret; 1137 err = ret;
1138 write_seqlock(&devnet_rename_seq); 1138 write_seqcount_begin(&devnet_rename_seq);
1139 memcpy(dev->name, oldname, IFNAMSIZ); 1139 memcpy(dev->name, oldname, IFNAMSIZ);
1140 goto rollback; 1140 goto rollback;
1141 } else { 1141 } else {
@@ -4180,7 +4180,7 @@ static int dev_ifname(struct net *net, struct ifreq __user *arg)
4180 return -EFAULT; 4180 return -EFAULT;
4181 4181
4182retry: 4182retry:
4183 seq = read_seqbegin(&devnet_rename_seq); 4183 seq = read_seqcount_begin(&devnet_rename_seq);
4184 rcu_read_lock(); 4184 rcu_read_lock();
4185 dev = dev_get_by_index_rcu(net, ifr.ifr_ifindex); 4185 dev = dev_get_by_index_rcu(net, ifr.ifr_ifindex);
4186 if (!dev) { 4186 if (!dev) {
@@ -4190,7 +4190,7 @@ retry:
4190 4190
4191 strcpy(ifr.ifr_name, dev->name); 4191 strcpy(ifr.ifr_name, dev->name);
4192 rcu_read_unlock(); 4192 rcu_read_unlock();
4193 if (read_seqretry(&devnet_rename_seq, seq)) 4193 if (read_seqcount_retry(&devnet_rename_seq, seq))
4194 goto retry; 4194 goto retry;
4195 4195
4196 if (copy_to_user(arg, &ifr, sizeof(struct ifreq))) 4196 if (copy_to_user(arg, &ifr, sizeof(struct ifreq)))
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index 334efd5d67a9..28c5f5aa7ca7 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -1334,7 +1334,6 @@ struct kobj_ns_type_operations net_ns_type_operations = {
1334}; 1334};
1335EXPORT_SYMBOL_GPL(net_ns_type_operations); 1335EXPORT_SYMBOL_GPL(net_ns_type_operations);
1336 1336
1337#ifdef CONFIG_HOTPLUG
1338static int netdev_uevent(struct device *d, struct kobj_uevent_env *env) 1337static int netdev_uevent(struct device *d, struct kobj_uevent_env *env)
1339{ 1338{
1340 struct net_device *dev = to_net_dev(d); 1339 struct net_device *dev = to_net_dev(d);
@@ -1353,7 +1352,6 @@ static int netdev_uevent(struct device *d, struct kobj_uevent_env *env)
1353exit: 1352exit:
1354 return retval; 1353 return retval;
1355} 1354}
1356#endif
1357 1355
1358/* 1356/*
1359 * netdev_release -- destroy and free a dead device. 1357 * netdev_release -- destroy and free a dead device.
@@ -1382,9 +1380,7 @@ static struct class net_class = {
1382#ifdef CONFIG_SYSFS 1380#ifdef CONFIG_SYSFS
1383 .dev_attrs = net_class_attributes, 1381 .dev_attrs = net_class_attributes,
1384#endif /* CONFIG_SYSFS */ 1382#endif /* CONFIG_SYSFS */
1385#ifdef CONFIG_HOTPLUG
1386 .dev_uevent = netdev_uevent, 1383 .dev_uevent = netdev_uevent,
1387#endif
1388 .ns_type = &net_ns_type_operations, 1384 .ns_type = &net_ns_type_operations,
1389 .namespace = net_namespace, 1385 .namespace = net_namespace,
1390}; 1386};
diff --git a/net/core/sock.c b/net/core/sock.c
index a692ef49c9bb..bc131d419683 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -583,7 +583,7 @@ static int sock_getbindtodevice(struct sock *sk, char __user *optval,
583 goto out; 583 goto out;
584 584
585retry: 585retry:
586 seq = read_seqbegin(&devnet_rename_seq); 586 seq = read_seqcount_begin(&devnet_rename_seq);
587 rcu_read_lock(); 587 rcu_read_lock();
588 dev = dev_get_by_index_rcu(net, sk->sk_bound_dev_if); 588 dev = dev_get_by_index_rcu(net, sk->sk_bound_dev_if);
589 ret = -ENODEV; 589 ret = -ENODEV;
@@ -594,7 +594,7 @@ retry:
594 594
595 strcpy(devname, dev->name); 595 strcpy(devname, dev->name);
596 rcu_read_unlock(); 596 rcu_read_unlock();
597 if (read_seqretry(&devnet_rename_seq, seq)) 597 if (read_seqcount_retry(&devnet_rename_seq, seq))
598 goto retry; 598 goto retry;
599 599
600 len = strlen(devname) + 1; 600 len = strlen(devname) + 1;
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index ce6fbdfd40b8..9547a273b9e9 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -321,7 +321,7 @@ static void arp_error_report(struct neighbour *neigh, struct sk_buff *skb)
321static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb) 321static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb)
322{ 322{
323 __be32 saddr = 0; 323 __be32 saddr = 0;
324 u8 *dst_ha = NULL; 324 u8 dst_ha[MAX_ADDR_LEN], *dst_hw = NULL;
325 struct net_device *dev = neigh->dev; 325 struct net_device *dev = neigh->dev;
326 __be32 target = *(__be32 *)neigh->primary_key; 326 __be32 target = *(__be32 *)neigh->primary_key;
327 int probes = atomic_read(&neigh->probes); 327 int probes = atomic_read(&neigh->probes);
@@ -363,8 +363,8 @@ static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb)
363 if (probes < 0) { 363 if (probes < 0) {
364 if (!(neigh->nud_state & NUD_VALID)) 364 if (!(neigh->nud_state & NUD_VALID))
365 pr_debug("trying to ucast probe in NUD_INVALID\n"); 365 pr_debug("trying to ucast probe in NUD_INVALID\n");
366 dst_ha = neigh->ha; 366 neigh_ha_snapshot(dst_ha, neigh, dev);
367 read_lock_bh(&neigh->lock); 367 dst_hw = dst_ha;
368 } else { 368 } else {
369 probes -= neigh->parms->app_probes; 369 probes -= neigh->parms->app_probes;
370 if (probes < 0) { 370 if (probes < 0) {
@@ -376,9 +376,7 @@ static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb)
376 } 376 }
377 377
378 arp_send(ARPOP_REQUEST, ETH_P_ARP, target, dev, saddr, 378 arp_send(ARPOP_REQUEST, ETH_P_ARP, target, dev, saddr,
379 dst_ha, dev->dev_addr, NULL); 379 dst_hw, dev->dev_addr, NULL);
380 if (dst_ha)
381 read_unlock_bh(&neigh->lock);
382} 380}
383 381
384static int arp_ignore(struct in_device *in_dev, __be32 sip, __be32 tip) 382static int arp_ignore(struct in_device *in_dev, __be32 sip, __be32 tip)
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index a85ae2f7a21c..303012adf9e6 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -750,6 +750,7 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev
750 int gre_hlen; 750 int gre_hlen;
751 __be32 dst; 751 __be32 dst;
752 int mtu; 752 int mtu;
753 u8 ttl;
753 754
754 if (skb->ip_summed == CHECKSUM_PARTIAL && 755 if (skb->ip_summed == CHECKSUM_PARTIAL &&
755 skb_checksum_help(skb)) 756 skb_checksum_help(skb))
@@ -760,7 +761,10 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev
760 761
761 if (dev->header_ops && dev->type == ARPHRD_IPGRE) { 762 if (dev->header_ops && dev->type == ARPHRD_IPGRE) {
762 gre_hlen = 0; 763 gre_hlen = 0;
763 tiph = (const struct iphdr *)skb->data; 764 if (skb->protocol == htons(ETH_P_IP))
765 tiph = (const struct iphdr *)skb->data;
766 else
767 tiph = &tunnel->parms.iph;
764 } else { 768 } else {
765 gre_hlen = tunnel->hlen; 769 gre_hlen = tunnel->hlen;
766 tiph = &tunnel->parms.iph; 770 tiph = &tunnel->parms.iph;
@@ -812,6 +816,7 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev
812 goto tx_error; 816 goto tx_error;
813 } 817 }
814 818
819 ttl = tiph->ttl;
815 tos = tiph->tos; 820 tos = tiph->tos;
816 if (tos == 1) { 821 if (tos == 1) {
817 tos = 0; 822 tos = 0;
@@ -904,11 +909,12 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev
904 dev_kfree_skb(skb); 909 dev_kfree_skb(skb);
905 skb = new_skb; 910 skb = new_skb;
906 old_iph = ip_hdr(skb); 911 old_iph = ip_hdr(skb);
912 /* Warning : tiph value might point to freed memory */
907 } 913 }
908 914
909 skb_reset_transport_header(skb);
910 skb_push(skb, gre_hlen); 915 skb_push(skb, gre_hlen);
911 skb_reset_network_header(skb); 916 skb_reset_network_header(skb);
917 skb_set_transport_header(skb, sizeof(*iph));
912 memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt)); 918 memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt));
913 IPCB(skb)->flags &= ~(IPSKB_XFRM_TUNNEL_SIZE | IPSKB_XFRM_TRANSFORMED | 919 IPCB(skb)->flags &= ~(IPSKB_XFRM_TUNNEL_SIZE | IPSKB_XFRM_TRANSFORMED |
914 IPSKB_REROUTED); 920 IPSKB_REROUTED);
@@ -927,8 +933,9 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev
927 iph->tos = ipgre_ecn_encapsulate(tos, old_iph, skb); 933 iph->tos = ipgre_ecn_encapsulate(tos, old_iph, skb);
928 iph->daddr = fl4.daddr; 934 iph->daddr = fl4.daddr;
929 iph->saddr = fl4.saddr; 935 iph->saddr = fl4.saddr;
936 iph->ttl = ttl;
930 937
931 if ((iph->ttl = tiph->ttl) == 0) { 938 if (ttl == 0) {
932 if (skb->protocol == htons(ETH_P_IP)) 939 if (skb->protocol == htons(ETH_P_IP))
933 iph->ttl = old_iph->ttl; 940 iph->ttl = old_iph->ttl;
934#if IS_ENABLED(CONFIG_IPV6) 941#if IS_ENABLED(CONFIG_IPV6)
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index a13692560e63..a28e4db8a952 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -5543,6 +5543,9 @@ slow_path:
5543 if (len < (th->doff << 2) || tcp_checksum_complete_user(sk, skb)) 5543 if (len < (th->doff << 2) || tcp_checksum_complete_user(sk, skb))
5544 goto csum_error; 5544 goto csum_error;
5545 5545
5546 if (!th->ack)
5547 goto discard;
5548
5546 /* 5549 /*
5547 * Standard slow path. 5550 * Standard slow path.
5548 */ 5551 */
@@ -5551,7 +5554,7 @@ slow_path:
5551 return 0; 5554 return 0;
5552 5555
5553step5: 5556step5:
5554 if (th->ack && tcp_ack(sk, skb, FLAG_SLOWPATH) < 0) 5557 if (tcp_ack(sk, skb, FLAG_SLOWPATH) < 0)
5555 goto discard; 5558 goto discard;
5556 5559
5557 /* ts_recent update must be made after we are sure that the packet 5560 /* ts_recent update must be made after we are sure that the packet
@@ -5984,11 +5987,15 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
5984 if (tcp_check_req(sk, skb, req, NULL, true) == NULL) 5987 if (tcp_check_req(sk, skb, req, NULL, true) == NULL)
5985 goto discard; 5988 goto discard;
5986 } 5989 }
5990
5991 if (!th->ack)
5992 goto discard;
5993
5987 if (!tcp_validate_incoming(sk, skb, th, 0)) 5994 if (!tcp_validate_incoming(sk, skb, th, 0))
5988 return 0; 5995 return 0;
5989 5996
5990 /* step 5: check the ACK field */ 5997 /* step 5: check the ACK field */
5991 if (th->ack) { 5998 if (true) {
5992 int acceptable = tcp_ack(sk, skb, FLAG_SLOWPATH) > 0; 5999 int acceptable = tcp_ack(sk, skb, FLAG_SLOWPATH) > 0;
5993 6000
5994 switch (sk->sk_state) { 6001 switch (sk->sk_state) {
@@ -6138,8 +6145,7 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
6138 } 6145 }
6139 break; 6146 break;
6140 } 6147 }
6141 } else 6148 }
6142 goto discard;
6143 6149
6144 /* ts_recent update must be made after we are sure that the packet 6150 /* ts_recent update must be made after we are sure that the packet
6145 * is in window. 6151 * is in window.
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
index 867466c96aac..c727e4712751 100644
--- a/net/ipv6/ip6_gre.c
+++ b/net/ipv6/ip6_gre.c
@@ -758,8 +758,6 @@ static netdev_tx_t ip6gre_xmit2(struct sk_buff *skb,
758 skb_dst_set_noref(skb, dst); 758 skb_dst_set_noref(skb, dst);
759 } 759 }
760 760
761 skb->transport_header = skb->network_header;
762
763 proto = NEXTHDR_GRE; 761 proto = NEXTHDR_GRE;
764 if (encap_limit >= 0) { 762 if (encap_limit >= 0) {
765 init_tel_txopt(&opt, encap_limit); 763 init_tel_txopt(&opt, encap_limit);
@@ -768,6 +766,7 @@ static netdev_tx_t ip6gre_xmit2(struct sk_buff *skb,
768 766
769 skb_push(skb, gre_hlen); 767 skb_push(skb, gre_hlen);
770 skb_reset_network_header(skb); 768 skb_reset_network_header(skb);
769 skb_set_transport_header(skb, sizeof(*ipv6h));
771 770
772 /* 771 /*
773 * Push down and install the IP header. 772 * Push down and install the IP header.
diff --git a/net/rds/ib_cm.c b/net/rds/ib_cm.c
index a1e116277477..31b74f5e61ad 100644
--- a/net/rds/ib_cm.c
+++ b/net/rds/ib_cm.c
@@ -434,12 +434,11 @@ static u32 rds_ib_protocol_compatible(struct rdma_cm_event *event)
434 version = RDS_PROTOCOL_3_0; 434 version = RDS_PROTOCOL_3_0;
435 while ((common >>= 1) != 0) 435 while ((common >>= 1) != 0)
436 version++; 436 version++;
437 } 437 } else
438 printk_ratelimited(KERN_NOTICE "RDS: Connection from %pI4 using " 438 printk_ratelimited(KERN_NOTICE "RDS: Connection from %pI4 using incompatible protocol version %u.%u\n",
439 "incompatible protocol version %u.%u\n", 439 &dp->dp_saddr,
440 &dp->dp_saddr, 440 dp->dp_protocol_major,
441 dp->dp_protocol_major, 441 dp->dp_protocol_minor);
442 dp->dp_protocol_minor);
443 return version; 442 return version;
444} 443}
445 444
diff --git a/net/rds/ib_recv.c b/net/rds/ib_recv.c
index 8c5bc857f04d..8eb9501e3d60 100644
--- a/net/rds/ib_recv.c
+++ b/net/rds/ib_recv.c
@@ -339,8 +339,8 @@ static int rds_ib_recv_refill_one(struct rds_connection *conn,
339 sge->length = sizeof(struct rds_header); 339 sge->length = sizeof(struct rds_header);
340 340
341 sge = &recv->r_sge[1]; 341 sge = &recv->r_sge[1];
342 sge->addr = sg_dma_address(&recv->r_frag->f_sg); 342 sge->addr = ib_sg_dma_address(ic->i_cm_id->device, &recv->r_frag->f_sg);
343 sge->length = sg_dma_len(&recv->r_frag->f_sg); 343 sge->length = ib_sg_dma_len(ic->i_cm_id->device, &recv->r_frag->f_sg);
344 344
345 ret = 0; 345 ret = 0;
346out: 346out:
@@ -381,7 +381,10 @@ void rds_ib_recv_refill(struct rds_connection *conn, int prefill)
381 ret = ib_post_recv(ic->i_cm_id->qp, &recv->r_wr, &failed_wr); 381 ret = ib_post_recv(ic->i_cm_id->qp, &recv->r_wr, &failed_wr);
382 rdsdebug("recv %p ibinc %p page %p addr %lu ret %d\n", recv, 382 rdsdebug("recv %p ibinc %p page %p addr %lu ret %d\n", recv,
383 recv->r_ibinc, sg_page(&recv->r_frag->f_sg), 383 recv->r_ibinc, sg_page(&recv->r_frag->f_sg),
384 (long) sg_dma_address(&recv->r_frag->f_sg), ret); 384 (long) ib_sg_dma_address(
385 ic->i_cm_id->device,
386 &recv->r_frag->f_sg),
387 ret);
385 if (ret) { 388 if (ret) {
386 rds_ib_conn_error(conn, "recv post on " 389 rds_ib_conn_error(conn, "recv post on "
387 "%pI4 returned %d, disconnecting and " 390 "%pI4 returned %d, disconnecting and "
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index d2922c0ef57a..51561eafcb72 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -919,7 +919,7 @@ ok:
919 q->now = ktime_to_ns(ktime_get()); 919 q->now = ktime_to_ns(ktime_get());
920 start_at = jiffies; 920 start_at = jiffies;
921 921
922 next_event = q->now + 5 * NSEC_PER_SEC; 922 next_event = q->now + 5LLU * NSEC_PER_SEC;
923 923
924 for (level = 0; level < TC_HTB_MAXDEPTH; level++) { 924 for (level = 0; level < TC_HTB_MAXDEPTH; level++) {
925 /* common case optimization - skip event handler quickly */ 925 /* common case optimization - skip event handler quickly */
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 6e5308998e30..82c4fc7c994c 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -2365,7 +2365,6 @@ int set_regdom(const struct ieee80211_regdomain *rd)
2365 return r; 2365 return r;
2366} 2366}
2367 2367
2368#ifdef CONFIG_HOTPLUG
2369int reg_device_uevent(struct device *dev, struct kobj_uevent_env *env) 2368int reg_device_uevent(struct device *dev, struct kobj_uevent_env *env)
2370{ 2369{
2371 if (last_request && !last_request->processed) { 2370 if (last_request && !last_request->processed) {
@@ -2377,12 +2376,6 @@ int reg_device_uevent(struct device *dev, struct kobj_uevent_env *env)
2377 2376
2378 return 0; 2377 return 0;
2379} 2378}
2380#else
2381int reg_device_uevent(struct device *dev, struct kobj_uevent_env *env)
2382{
2383 return -ENODEV;
2384}
2385#endif /* CONFIG_HOTPLUG */
2386 2379
2387void wiphy_regulatory_register(struct wiphy *wiphy) 2380void wiphy_regulatory_register(struct wiphy *wiphy)
2388{ 2381{
diff --git a/net/wireless/sysfs.c b/net/wireless/sysfs.c
index 9bf6d5e32166..1f6f01e2dc4c 100644
--- a/net/wireless/sysfs.c
+++ b/net/wireless/sysfs.c
@@ -77,13 +77,11 @@ static void wiphy_dev_release(struct device *dev)
77 cfg80211_dev_free(rdev); 77 cfg80211_dev_free(rdev);
78} 78}
79 79
80#ifdef CONFIG_HOTPLUG
81static int wiphy_uevent(struct device *dev, struct kobj_uevent_env *env) 80static int wiphy_uevent(struct device *dev, struct kobj_uevent_env *env)
82{ 81{
83 /* TODO, we probably need stuff here */ 82 /* TODO, we probably need stuff here */
84 return 0; 83 return 0;
85} 84}
86#endif
87 85
88static int wiphy_suspend(struct device *dev, pm_message_t state) 86static int wiphy_suspend(struct device *dev, pm_message_t state)
89{ 87{
@@ -134,9 +132,7 @@ struct class ieee80211_class = {
134 .owner = THIS_MODULE, 132 .owner = THIS_MODULE,
135 .dev_release = wiphy_dev_release, 133 .dev_release = wiphy_dev_release,
136 .dev_attrs = ieee80211_dev_attrs, 134 .dev_attrs = ieee80211_dev_attrs,
137#ifdef CONFIG_HOTPLUG
138 .dev_uevent = wiphy_uevent, 135 .dev_uevent = wiphy_uevent,
139#endif
140 .suspend = wiphy_suspend, 136 .suspend = wiphy_suspend,
141 .resume = wiphy_resume, 137 .resume = wiphy_resume,
142 .ns_type = &net_ns_type_operations, 138 .ns_type = &net_ns_type_operations,
diff --git a/scripts/headers_install.pl b/scripts/headers_install.pl
index 6c353ae8a451..581ca99c96f2 100644
--- a/scripts/headers_install.pl
+++ b/scripts/headers_install.pl
@@ -42,9 +42,9 @@ foreach my $filename (@files) {
42 $line =~ s/(^|\s)(inline)\b/$1__$2__/g; 42 $line =~ s/(^|\s)(inline)\b/$1__$2__/g;
43 $line =~ s/(^|\s)(asm)\b(\s|[(]|$)/$1__$2__$3/g; 43 $line =~ s/(^|\s)(asm)\b(\s|[(]|$)/$1__$2__$3/g;
44 $line =~ s/(^|\s|[(])(volatile)\b(\s|[(]|$)/$1__$2__$3/g; 44 $line =~ s/(^|\s|[(])(volatile)\b(\s|[(]|$)/$1__$2__$3/g;
45 $line =~ s/#ifndef _UAPI/#ifndef /; 45 $line =~ s/#ifndef\s+_UAPI/#ifndef /;
46 $line =~ s/#define _UAPI/#define /; 46 $line =~ s/#define\s+_UAPI/#define /;
47 $line =~ s!#endif /[*] _UAPI!#endif /* !; 47 $line =~ s!#endif\s+/[*]\s*_UAPI!#endif /* !;
48 printf {$out} "%s", $line; 48 printf {$out} "%s", $line;
49 } 49 }
50 close $out; 50 close $out;
diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c
index ffc89fab96fb..1f8e8e2a1a6a 100644
--- a/sound/soc/codecs/wm_adsp.c
+++ b/sound/soc/codecs/wm_adsp.c
@@ -143,6 +143,71 @@
143#define ADSP2_RAM_RDY_SHIFT 0 143#define ADSP2_RAM_RDY_SHIFT 0
144#define ADSP2_RAM_RDY_WIDTH 1 144#define ADSP2_RAM_RDY_WIDTH 1
145 145
146#define WM_ADSP_NUM_FW 3
147
148static const char *wm_adsp_fw_text[WM_ADSP_NUM_FW] = {
149 "MBC/VSS", "Tx", "Rx ANC"
150};
151
152static struct {
153 const char *file;
154} wm_adsp_fw[WM_ADSP_NUM_FW] = {
155 { .file = "mbc-vss" },
156 { .file = "tx" },
157 { .file = "rx-anc" },
158};
159
160static int wm_adsp_fw_get(struct snd_kcontrol *kcontrol,
161 struct snd_ctl_elem_value *ucontrol)
162{
163 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
164 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
165 struct wm_adsp *adsp = snd_soc_codec_get_drvdata(codec);
166
167 ucontrol->value.integer.value[0] = adsp[e->shift_l].fw;
168
169 return 0;
170}
171
172static int wm_adsp_fw_put(struct snd_kcontrol *kcontrol,
173 struct snd_ctl_elem_value *ucontrol)
174{
175 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
176 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
177 struct wm_adsp *adsp = snd_soc_codec_get_drvdata(codec);
178
179 if (ucontrol->value.integer.value[0] == adsp[e->shift_l].fw)
180 return 0;
181
182 if (ucontrol->value.integer.value[0] >= WM_ADSP_NUM_FW)
183 return -EINVAL;
184
185 if (adsp[e->shift_l].running)
186 return -EBUSY;
187
188 adsp->fw = ucontrol->value.integer.value[0];
189
190 return 0;
191}
192
193static const struct soc_enum wm_adsp_fw_enum[] = {
194 SOC_ENUM_SINGLE(0, 0, ARRAY_SIZE(wm_adsp_fw_text), wm_adsp_fw_text),
195 SOC_ENUM_SINGLE(0, 1, ARRAY_SIZE(wm_adsp_fw_text), wm_adsp_fw_text),
196 SOC_ENUM_SINGLE(0, 2, ARRAY_SIZE(wm_adsp_fw_text), wm_adsp_fw_text),
197 SOC_ENUM_SINGLE(0, 3, ARRAY_SIZE(wm_adsp_fw_text), wm_adsp_fw_text),
198};
199
200const struct snd_kcontrol_new wm_adsp_fw_controls[] = {
201 SOC_ENUM_EXT("DSP1 Firmware", wm_adsp_fw_enum[0],
202 wm_adsp_fw_get, wm_adsp_fw_put),
203 SOC_ENUM_EXT("DSP2 Firmware", wm_adsp_fw_enum[1],
204 wm_adsp_fw_get, wm_adsp_fw_put),
205 SOC_ENUM_EXT("DSP3 Firmware", wm_adsp_fw_enum[2],
206 wm_adsp_fw_get, wm_adsp_fw_put),
207 SOC_ENUM_EXT("DSP4 Firmware", wm_adsp_fw_enum[3],
208 wm_adsp_fw_get, wm_adsp_fw_put),
209};
210EXPORT_SYMBOL_GPL(wm_adsp_fw_controls);
146 211
147static struct wm_adsp_region const *wm_adsp_find_region(struct wm_adsp *dsp, 212static struct wm_adsp_region const *wm_adsp_find_region(struct wm_adsp *dsp,
148 int type) 213 int type)
@@ -156,6 +221,26 @@ static struct wm_adsp_region const *wm_adsp_find_region(struct wm_adsp *dsp,
156 return NULL; 221 return NULL;
157} 222}
158 223
224static unsigned int wm_adsp_region_to_reg(struct wm_adsp_region const *region,
225 unsigned int offset)
226{
227 switch (region->type) {
228 case WMFW_ADSP1_PM:
229 return region->base + (offset * 3);
230 case WMFW_ADSP1_DM:
231 return region->base + (offset * 2);
232 case WMFW_ADSP2_XM:
233 return region->base + (offset * 2);
234 case WMFW_ADSP2_YM:
235 return region->base + (offset * 2);
236 case WMFW_ADSP1_ZM:
237 return region->base + (offset * 2);
238 default:
239 WARN_ON(NULL != "Unknown memory region type");
240 return offset;
241 }
242}
243
159static int wm_adsp_load(struct wm_adsp *dsp) 244static int wm_adsp_load(struct wm_adsp *dsp)
160{ 245{
161 const struct firmware *firmware; 246 const struct firmware *firmware;
@@ -177,7 +262,8 @@ static int wm_adsp_load(struct wm_adsp *dsp)
177 if (file == NULL) 262 if (file == NULL)
178 return -ENOMEM; 263 return -ENOMEM;
179 264
180 snprintf(file, PAGE_SIZE, "%s-dsp%d.wmfw", dsp->part, dsp->num); 265 snprintf(file, PAGE_SIZE, "%s-dsp%d-%s.wmfw", dsp->part, dsp->num,
266 wm_adsp_fw[dsp->fw].file);
181 file[PAGE_SIZE - 1] = '\0'; 267 file[PAGE_SIZE - 1] = '\0';
182 268
183 ret = request_firmware(&firmware, file, dsp->dev); 269 ret = request_firmware(&firmware, file, dsp->dev);
@@ -282,27 +368,27 @@ static int wm_adsp_load(struct wm_adsp *dsp)
282 case WMFW_ADSP1_PM: 368 case WMFW_ADSP1_PM:
283 BUG_ON(!mem); 369 BUG_ON(!mem);
284 region_name = "PM"; 370 region_name = "PM";
285 reg = mem->base + (offset * 3); 371 reg = wm_adsp_region_to_reg(mem, offset);
286 break; 372 break;
287 case WMFW_ADSP1_DM: 373 case WMFW_ADSP1_DM:
288 BUG_ON(!mem); 374 BUG_ON(!mem);
289 region_name = "DM"; 375 region_name = "DM";
290 reg = mem->base + (offset * 2); 376 reg = wm_adsp_region_to_reg(mem, offset);
291 break; 377 break;
292 case WMFW_ADSP2_XM: 378 case WMFW_ADSP2_XM:
293 BUG_ON(!mem); 379 BUG_ON(!mem);
294 region_name = "XM"; 380 region_name = "XM";
295 reg = mem->base + (offset * 2); 381 reg = wm_adsp_region_to_reg(mem, offset);
296 break; 382 break;
297 case WMFW_ADSP2_YM: 383 case WMFW_ADSP2_YM:
298 BUG_ON(!mem); 384 BUG_ON(!mem);
299 region_name = "YM"; 385 region_name = "YM";
300 reg = mem->base + (offset * 2); 386 reg = wm_adsp_region_to_reg(mem, offset);
301 break; 387 break;
302 case WMFW_ADSP1_ZM: 388 case WMFW_ADSP1_ZM:
303 BUG_ON(!mem); 389 BUG_ON(!mem);
304 region_name = "ZM"; 390 region_name = "ZM";
305 reg = mem->base + (offset * 2); 391 reg = wm_adsp_region_to_reg(mem, offset);
306 break; 392 break;
307 default: 393 default:
308 adsp_warn(dsp, 394 adsp_warn(dsp,
@@ -350,12 +436,224 @@ out:
350 return ret; 436 return ret;
351} 437}
352 438
439static int wm_adsp_setup_algs(struct wm_adsp *dsp)
440{
441 struct regmap *regmap = dsp->regmap;
442 struct wmfw_adsp1_id_hdr adsp1_id;
443 struct wmfw_adsp2_id_hdr adsp2_id;
444 struct wmfw_adsp1_alg_hdr *adsp1_alg;
445 struct wmfw_adsp2_alg_hdr *adsp2_alg;
446 void *alg, *buf;
447 struct wm_adsp_alg_region *region;
448 const struct wm_adsp_region *mem;
449 unsigned int pos, term;
450 size_t algs, buf_size;
451 __be32 val;
452 int i, ret;
453
454 switch (dsp->type) {
455 case WMFW_ADSP1:
456 mem = wm_adsp_find_region(dsp, WMFW_ADSP1_DM);
457 break;
458 case WMFW_ADSP2:
459 mem = wm_adsp_find_region(dsp, WMFW_ADSP2_XM);
460 break;
461 default:
462 mem = NULL;
463 break;
464 }
465
466 if (mem == NULL) {
467 BUG_ON(mem != NULL);
468 return -EINVAL;
469 }
470
471 switch (dsp->type) {
472 case WMFW_ADSP1:
473 ret = regmap_raw_read(regmap, mem->base, &adsp1_id,
474 sizeof(adsp1_id));
475 if (ret != 0) {
476 adsp_err(dsp, "Failed to read algorithm info: %d\n",
477 ret);
478 return ret;
479 }
480
481 buf = &adsp1_id;
482 buf_size = sizeof(adsp1_id);
483
484 algs = be32_to_cpu(adsp1_id.algs);
485 adsp_info(dsp, "Firmware: %x v%d.%d.%d, %zu algorithms\n",
486 be32_to_cpu(adsp1_id.fw.id),
487 (be32_to_cpu(adsp1_id.fw.ver) & 0xff0000) >> 16,
488 (be32_to_cpu(adsp1_id.fw.ver) & 0xff00) >> 8,
489 be32_to_cpu(adsp1_id.fw.ver) & 0xff,
490 algs);
491
492 pos = sizeof(adsp1_id) / 2;
493 term = pos + ((sizeof(*adsp1_alg) * algs) / 2);
494 break;
495
496 case WMFW_ADSP2:
497 ret = regmap_raw_read(regmap, mem->base, &adsp2_id,
498 sizeof(adsp2_id));
499 if (ret != 0) {
500 adsp_err(dsp, "Failed to read algorithm info: %d\n",
501 ret);
502 return ret;
503 }
504
505 buf = &adsp2_id;
506 buf_size = sizeof(adsp2_id);
507
508 algs = be32_to_cpu(adsp2_id.algs);
509 adsp_info(dsp, "Firmware: %x v%d.%d.%d, %zu algorithms\n",
510 be32_to_cpu(adsp2_id.fw.id),
511 (be32_to_cpu(adsp2_id.fw.ver) & 0xff0000) >> 16,
512 (be32_to_cpu(adsp2_id.fw.ver) & 0xff00) >> 8,
513 be32_to_cpu(adsp2_id.fw.ver) & 0xff,
514 algs);
515
516 pos = sizeof(adsp2_id) / 2;
517 term = pos + ((sizeof(*adsp2_alg) * algs) / 2);
518 break;
519
520 default:
521 BUG_ON(NULL == "Unknown DSP type");
522 return -EINVAL;
523 }
524
525 if (algs == 0) {
526 adsp_err(dsp, "No algorithms\n");
527 return -EINVAL;
528 }
529
530 if (algs > 1024) {
531 adsp_err(dsp, "Algorithm count %zx excessive\n", algs);
532 print_hex_dump_bytes(dev_name(dsp->dev), DUMP_PREFIX_OFFSET,
533 buf, buf_size);
534 return -EINVAL;
535 }
536
537 /* Read the terminator first to validate the length */
538 ret = regmap_raw_read(regmap, mem->base + term, &val, sizeof(val));
539 if (ret != 0) {
540 adsp_err(dsp, "Failed to read algorithm list end: %d\n",
541 ret);
542 return ret;
543 }
544
545 if (be32_to_cpu(val) != 0xbedead)
546 adsp_warn(dsp, "Algorithm list end %x 0x%x != 0xbeadead\n",
547 term, be32_to_cpu(val));
548
549 alg = kzalloc((term - pos) * 2, GFP_KERNEL);
550 if (!alg)
551 return -ENOMEM;
552
553 ret = regmap_raw_read(regmap, mem->base + pos, alg, (term - pos) * 2);
554 if (ret != 0) {
555 adsp_err(dsp, "Failed to read algorithm list: %d\n",
556 ret);
557 goto out;
558 }
559
560 adsp1_alg = alg;
561 adsp2_alg = alg;
562
563 for (i = 0; i < algs; i++) {
564 switch (dsp->type) {
565 case WMFW_ADSP1:
566 adsp_info(dsp, "%d: ID %x v%d.%d.%d DM@%x ZM@%x\n",
567 i, be32_to_cpu(adsp1_alg[i].alg.id),
568 (be32_to_cpu(adsp1_alg[i].alg.ver) & 0xff0000) >> 16,
569 (be32_to_cpu(adsp1_alg[i].alg.ver) & 0xff00) >> 8,
570 be32_to_cpu(adsp1_alg[i].alg.ver) & 0xff,
571 be32_to_cpu(adsp1_alg[i].dm),
572 be32_to_cpu(adsp1_alg[i].zm));
573
574 if (adsp1_alg[i].dm) {
575 region = kzalloc(sizeof(*region), GFP_KERNEL);
576 if (!region)
577 return -ENOMEM;
578 region->type = WMFW_ADSP1_DM;
579 region->alg = be32_to_cpu(adsp1_alg[i].alg.id);
580 region->base = be32_to_cpu(adsp1_alg[i].dm);
581 list_add_tail(&region->list,
582 &dsp->alg_regions);
583 }
584
585 if (adsp1_alg[i].zm) {
586 region = kzalloc(sizeof(*region), GFP_KERNEL);
587 if (!region)
588 return -ENOMEM;
589 region->type = WMFW_ADSP1_ZM;
590 region->alg = be32_to_cpu(adsp1_alg[i].alg.id);
591 region->base = be32_to_cpu(adsp1_alg[i].zm);
592 list_add_tail(&region->list,
593 &dsp->alg_regions);
594 }
595 break;
596
597 case WMFW_ADSP2:
598 adsp_info(dsp,
599 "%d: ID %x v%d.%d.%d XM@%x YM@%x ZM@%x\n",
600 i, be32_to_cpu(adsp2_alg[i].alg.id),
601 (be32_to_cpu(adsp2_alg[i].alg.ver) & 0xff0000) >> 16,
602 (be32_to_cpu(adsp2_alg[i].alg.ver) & 0xff00) >> 8,
603 be32_to_cpu(adsp2_alg[i].alg.ver) & 0xff,
604 be32_to_cpu(adsp2_alg[i].xm),
605 be32_to_cpu(adsp2_alg[i].ym),
606 be32_to_cpu(adsp2_alg[i].zm));
607
608 if (adsp2_alg[i].xm) {
609 region = kzalloc(sizeof(*region), GFP_KERNEL);
610 if (!region)
611 return -ENOMEM;
612 region->type = WMFW_ADSP2_XM;
613 region->alg = be32_to_cpu(adsp2_alg[i].alg.id);
614 region->base = be32_to_cpu(adsp2_alg[i].xm);
615 list_add_tail(&region->list,
616 &dsp->alg_regions);
617 }
618
619 if (adsp2_alg[i].ym) {
620 region = kzalloc(sizeof(*region), GFP_KERNEL);
621 if (!region)
622 return -ENOMEM;
623 region->type = WMFW_ADSP2_YM;
624 region->alg = be32_to_cpu(adsp2_alg[i].alg.id);
625 region->base = be32_to_cpu(adsp2_alg[i].ym);
626 list_add_tail(&region->list,
627 &dsp->alg_regions);
628 }
629
630 if (adsp2_alg[i].zm) {
631 region = kzalloc(sizeof(*region), GFP_KERNEL);
632 if (!region)
633 return -ENOMEM;
634 region->type = WMFW_ADSP2_ZM;
635 region->alg = be32_to_cpu(adsp2_alg[i].alg.id);
636 region->base = be32_to_cpu(adsp2_alg[i].zm);
637 list_add_tail(&region->list,
638 &dsp->alg_regions);
639 }
640 break;
641 }
642 }
643
644out:
645 kfree(alg);
646 return ret;
647}
648
353static int wm_adsp_load_coeff(struct wm_adsp *dsp) 649static int wm_adsp_load_coeff(struct wm_adsp *dsp)
354{ 650{
355 struct regmap *regmap = dsp->regmap; 651 struct regmap *regmap = dsp->regmap;
356 struct wmfw_coeff_hdr *hdr; 652 struct wmfw_coeff_hdr *hdr;
357 struct wmfw_coeff_item *blk; 653 struct wmfw_coeff_item *blk;
358 const struct firmware *firmware; 654 const struct firmware *firmware;
655 const struct wm_adsp_region *mem;
656 struct wm_adsp_alg_region *alg_region;
359 const char *region_name; 657 const char *region_name;
360 int ret, pos, blocks, type, offset, reg; 658 int ret, pos, blocks, type, offset, reg;
361 char *file; 659 char *file;
@@ -364,7 +662,8 @@ static int wm_adsp_load_coeff(struct wm_adsp *dsp)
364 if (file == NULL) 662 if (file == NULL)
365 return -ENOMEM; 663 return -ENOMEM;
366 664
367 snprintf(file, PAGE_SIZE, "%s-dsp%d.bin", dsp->part, dsp->num); 665 snprintf(file, PAGE_SIZE, "%s-dsp%d-%s.bin", dsp->part, dsp->num,
666 wm_adsp_fw[dsp->fw].file);
368 file[PAGE_SIZE - 1] = '\0'; 667 file[PAGE_SIZE - 1] = '\0';
369 668
370 ret = request_firmware(&firmware, file, dsp->dev); 669 ret = request_firmware(&firmware, file, dsp->dev);
@@ -420,6 +719,37 @@ static int wm_adsp_load_coeff(struct wm_adsp *dsp)
420 region_name = "register"; 719 region_name = "register";
421 reg = offset; 720 reg = offset;
422 break; 721 break;
722
723 case WMFW_ADSP1_DM:
724 case WMFW_ADSP1_ZM:
725 case WMFW_ADSP2_XM:
726 case WMFW_ADSP2_YM:
727 adsp_dbg(dsp, "%s.%d: %d bytes in %x for %x\n",
728 file, blocks, le32_to_cpu(blk->len),
729 type, le32_to_cpu(blk->id));
730
731 mem = wm_adsp_find_region(dsp, type);
732 if (!mem) {
733 adsp_err(dsp, "No base for region %x\n", type);
734 break;
735 }
736
737 reg = 0;
738 list_for_each_entry(alg_region,
739 &dsp->alg_regions, list) {
740 if (le32_to_cpu(blk->id) == alg_region->alg &&
741 type == alg_region->type) {
742 reg = alg_region->base + offset;
743 reg = wm_adsp_region_to_reg(mem,
744 reg);
745 }
746 }
747
748 if (reg == 0)
749 adsp_err(dsp, "No %x for algorithm %x\n",
750 type, le32_to_cpu(blk->id));
751 break;
752
423 default: 753 default:
424 adsp_err(dsp, "Unknown region type %x\n", type); 754 adsp_err(dsp, "Unknown region type %x\n", type);
425 break; 755 break;
@@ -468,6 +798,10 @@ int wm_adsp1_event(struct snd_soc_dapm_widget *w,
468 if (ret != 0) 798 if (ret != 0)
469 goto err; 799 goto err;
470 800
801 ret = wm_adsp_setup_algs(dsp);
802 if (ret != 0)
803 goto err;
804
471 ret = wm_adsp_load_coeff(dsp); 805 ret = wm_adsp_load_coeff(dsp);
472 if (ret != 0) 806 if (ret != 0)
473 goto err; 807 goto err;
@@ -539,6 +873,7 @@ int wm_adsp2_event(struct snd_soc_dapm_widget *w,
539 struct snd_soc_codec *codec = w->codec; 873 struct snd_soc_codec *codec = w->codec;
540 struct wm_adsp *dsps = snd_soc_codec_get_drvdata(codec); 874 struct wm_adsp *dsps = snd_soc_codec_get_drvdata(codec);
541 struct wm_adsp *dsp = &dsps[w->shift]; 875 struct wm_adsp *dsp = &dsps[w->shift];
876 struct wm_adsp_alg_region *alg_region;
542 unsigned int val; 877 unsigned int val;
543 int ret; 878 int ret;
544 879
@@ -604,6 +939,10 @@ int wm_adsp2_event(struct snd_soc_dapm_widget *w,
604 if (ret != 0) 939 if (ret != 0)
605 goto err; 940 goto err;
606 941
942 ret = wm_adsp_setup_algs(dsp);
943 if (ret != 0)
944 goto err;
945
607 ret = wm_adsp_load_coeff(dsp); 946 ret = wm_adsp_load_coeff(dsp);
608 if (ret != 0) 947 if (ret != 0)
609 goto err; 948 goto err;
@@ -614,9 +953,13 @@ int wm_adsp2_event(struct snd_soc_dapm_widget *w,
614 ADSP2_CORE_ENA | ADSP2_START); 953 ADSP2_CORE_ENA | ADSP2_START);
615 if (ret != 0) 954 if (ret != 0)
616 goto err; 955 goto err;
956
957 dsp->running = true;
617 break; 958 break;
618 959
619 case SND_SOC_DAPM_PRE_PMD: 960 case SND_SOC_DAPM_PRE_PMD:
961 dsp->running = false;
962
620 regmap_update_bits(dsp->regmap, dsp->base + ADSP2_CONTROL, 963 regmap_update_bits(dsp->regmap, dsp->base + ADSP2_CONTROL,
621 ADSP2_SYS_ENA | ADSP2_CORE_ENA | 964 ADSP2_SYS_ENA | ADSP2_CORE_ENA |
622 ADSP2_START, 0); 965 ADSP2_START, 0);
@@ -635,6 +978,14 @@ int wm_adsp2_event(struct snd_soc_dapm_widget *w,
635 "Failed to enable supply: %d\n", 978 "Failed to enable supply: %d\n",
636 ret); 979 ret);
637 } 980 }
981
982 while (!list_empty(&dsp->alg_regions)) {
983 alg_region = list_first_entry(&dsp->alg_regions,
984 struct wm_adsp_alg_region,
985 list);
986 list_del(&alg_region->list);
987 kfree(alg_region);
988 }
638 break; 989 break;
639 990
640 default: 991 default:
@@ -664,6 +1015,8 @@ int wm_adsp2_init(struct wm_adsp *adsp, bool dvfs)
664 return ret; 1015 return ret;
665 } 1016 }
666 1017
1018 INIT_LIST_HEAD(&adsp->alg_regions);
1019
667 if (dvfs) { 1020 if (dvfs) {
668 adsp->dvfs = devm_regulator_get(adsp->dev, "DCVDD"); 1021 adsp->dvfs = devm_regulator_get(adsp->dev, "DCVDD");
669 if (IS_ERR(adsp->dvfs)) { 1022 if (IS_ERR(adsp->dvfs)) {
diff --git a/sound/soc/codecs/wm_adsp.h b/sound/soc/codecs/wm_adsp.h
index ffd29a4609e2..5e71410f8b05 100644
--- a/sound/soc/codecs/wm_adsp.h
+++ b/sound/soc/codecs/wm_adsp.h
@@ -25,6 +25,13 @@ struct wm_adsp_region {
25 unsigned int base; 25 unsigned int base;
26}; 26};
27 27
28struct wm_adsp_alg_region {
29 struct list_head list;
30 unsigned int alg;
31 int type;
32 unsigned int base;
33};
34
28struct wm_adsp { 35struct wm_adsp {
29 const char *part; 36 const char *part;
30 int num; 37 int num;
@@ -34,9 +41,14 @@ struct wm_adsp {
34 41
35 int base; 42 int base;
36 43
44 struct list_head alg_regions;
45
37 const struct wm_adsp_region *mem; 46 const struct wm_adsp_region *mem;
38 int num_mems; 47 int num_mems;
39 48
49 int fw;
50 bool running;
51
40 struct regulator *dvfs; 52 struct regulator *dvfs;
41}; 53};
42 54
@@ -50,6 +62,8 @@ struct wm_adsp {
50 .shift = num, .event = wm_adsp2_event, \ 62 .shift = num, .event = wm_adsp2_event, \
51 .event_flags = SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD } 63 .event_flags = SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD }
52 64
65extern const struct snd_kcontrol_new wm_adsp_fw_controls[];
66
53int wm_adsp2_init(struct wm_adsp *adsp, bool dvfs); 67int wm_adsp2_init(struct wm_adsp *adsp, bool dvfs);
54int wm_adsp1_event(struct snd_soc_dapm_widget *w, 68int wm_adsp1_event(struct snd_soc_dapm_widget *w,
55 struct snd_kcontrol *kcontrol, int event); 69 struct snd_kcontrol *kcontrol, int event);