aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/DocBook/media/v4l/pixfmt-nv12m.xml2
-rw-r--r--Documentation/DocBook/media/v4l/pixfmt-yuv420m.xml2
-rw-r--r--MAINTAINERS4
-rw-r--r--Makefile2
-rw-r--r--arch/arm/configs/imx_v4_v5_defconfig1
-rw-r--r--arch/arm/configs/u8500_defconfig9
-rw-r--r--arch/arm/mach-at91/at91rm9200_devices.c1
-rw-r--r--arch/arm/mach-at91/at91rm9200_time.c2
-rw-r--r--arch/arm/mach-at91/board-rm9200ek.c2
-rw-r--r--arch/arm/mach-at91/board-sam9261ek.c5
-rw-r--r--arch/arm/mach-at91/clock.c1
-rw-r--r--arch/arm/mach-at91/include/mach/at91_pmc.h2
-rw-r--r--arch/arm/mach-at91/setup.c2
-rw-r--r--arch/arm/mach-bcmring/core.c4
-rw-r--r--arch/arm/mach-imx/imx27-dt.c6
-rw-r--r--arch/arm/mach-imx/mm-imx5.c2
-rw-r--r--arch/arm/mach-omap1/mux.c1
-rw-r--r--arch/arm/mach-omap1/timer.c4
-rw-r--r--arch/arm/mach-omap2/board-4430sdp.c12
-rw-r--r--arch/arm/mach-omap2/board-generic.c2
-rw-r--r--arch/arm/mach-omap2/board-omap4panda.c13
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.c17
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2420_data.c1
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2430_data.c1
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_3xxx_data.c1
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_44xx_data.c9
-rw-r--r--arch/arm/mach-omap2/serial.c124
-rw-r--r--arch/arm/mach-omap2/twl-common.c37
-rw-r--r--arch/arm/mach-omap2/twl-common.h10
-rw-r--r--arch/arm/mach-ux500/Kconfig1
-rw-r--r--arch/arm/mach-ux500/platsmp.c2
-rw-r--r--arch/arm/plat-omap/include/plat/omap_hwmod.h4
-rw-r--r--arch/arm/plat-omap/sram.c12
-rw-r--r--arch/ia64/include/asm/futex.h9
-rw-r--r--arch/ia64/kernel/perfmon.c18
-rw-r--r--arch/m68k/configs/m5275evb_defconfig1
-rw-r--r--arch/m68k/platform/527x/config.c2
-rw-r--r--arch/m68k/platform/68EZ328/Makefile6
-rw-r--r--arch/m68k/platform/68VZ328/Makefile9
-rw-r--r--arch/m68k/platform/68VZ328/bootlogo.h (renamed from arch/m68k/platform/68EZ328/bootlogo.h)2
-rw-r--r--arch/m68k/platform/coldfire/device.c2
-rw-r--r--arch/s390/Kconfig1
-rw-r--r--arch/s390/defconfig37
-rw-r--r--arch/s390/include/asm/facility.h3
-rw-r--r--arch/s390/include/asm/pgalloc.h3
-rw-r--r--arch/s390/include/asm/swab.h2
-rw-r--r--arch/s390/include/asm/tlb.h22
-rw-r--r--arch/s390/kernel/head.S2
-rw-r--r--arch/s390/kernel/irq.c9
-rw-r--r--arch/s390/kernel/perf_cpum_cf.c4
-rw-r--r--arch/s390/mm/maccess.c27
-rw-r--r--arch/s390/mm/pgtable.c63
-rw-r--r--arch/sparc/kernel/leon_smp.c3
-rw-r--r--arch/sparc/kernel/sys_sparc_64.c7
-rw-r--r--arch/tile/kernel/single_step.c4
-rw-r--r--arch/x86/ia32/ia32_aout.c32
-rw-r--r--arch/x86/kvm/pmu.c18
-rw-r--r--arch/x86/kvm/vmx.c5
-rw-r--r--arch/x86/kvm/x86.c8
-rw-r--r--arch/x86/lib/insn.c53
-rw-r--r--crypto/sha512_generic.c2
-rw-r--r--drivers/acpi/acpica/hwxface.c3
-rw-r--r--drivers/acpi/osl.c3
-rw-r--r--drivers/acpi/reboot.c3
-rw-r--r--drivers/ata/ata_piix.c2
-rw-r--r--drivers/ata/libata-core.c4
-rw-r--r--drivers/ata/libata-scsi.c4
-rw-r--r--drivers/ata/libata-transport.c1
-rw-r--r--drivers/ata/libata.h2
-rw-r--r--drivers/ata/sata_mv.c3
-rw-r--r--drivers/block/virtio_blk.c41
-rw-r--r--drivers/block/xen-blkback/xenbus.c2
-rw-r--r--drivers/crypto/ixp4xx_crypto.c1
-rw-r--r--drivers/crypto/talitos.c20
-rw-r--r--drivers/dma/Kconfig5
-rw-r--r--drivers/gpu/drm/drm_bufs.c12
-rw-r--r--drivers/gpu/drm/drm_crtc.c10
-rw-r--r--drivers/gpu/drm/drm_fops.c6
-rw-r--r--drivers/gpu/drm/drm_usb.c6
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_gem.c4
-rw-r--r--drivers/gpu/drm/gma500/mdfld_dsi_output.h1
-rw-r--r--drivers/gpu/drm/i810/i810_dma.c6
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c4
-rw-r--r--drivers/gpu/drm/i915/intel_display.c15
-rw-r--r--drivers/gpu/drm/i915/intel_drv.h4
-rw-r--r--drivers/gpu/drm/i915/intel_fb.c4
-rw-r--r--drivers/gpu/drm/i915/intel_lvds.c6
-rw-r--r--drivers/gpu/drm/i915/intel_panel.c2
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_pm.c1
-rw-r--r--drivers/gpu/drm/nouveau/nv50_sor.c2
-rw-r--r--drivers/gpu/drm/radeon/r600.c4
-rw-r--r--drivers/gpu/drm/radeon/radeon_connectors.c4
-rw-r--r--drivers/gpu/drm/radeon/radeon_irq_kms.c6
-rw-r--r--drivers/gpu/drm/radeon/rv770.c4
-rw-r--r--drivers/gpu/drm/radeon/si.c5
-rw-r--r--drivers/hid/Kconfig2
-rw-r--r--drivers/hid/hid-tivo.c2
-rw-r--r--drivers/hwmon/ads1015.c33
-rw-r--r--drivers/hwmon/fam15h_power.c39
-rw-r--r--drivers/input/misc/Kconfig3
-rw-r--r--drivers/input/misc/twl6040-vibra.c4
-rw-r--r--drivers/leds/leds-atmel-pwm.c2
-rw-r--r--drivers/media/common/tuners/xc5000.c39
-rw-r--r--drivers/media/common/tuners/xc5000.h1
-rw-r--r--drivers/media/dvb/dvb-core/dvb_frontend.c25
-rw-r--r--drivers/media/dvb/frontends/drxk_hard.c6
-rw-r--r--drivers/media/rc/winbond-cir.c1
-rw-r--r--drivers/media/video/Kconfig2
-rw-r--r--drivers/media/video/mt9m032.c5
-rw-r--r--drivers/mfd/Kconfig11
-rw-r--r--drivers/mfd/asic3.c4
-rw-r--r--drivers/mfd/omap-usb-host.c44
-rw-r--r--drivers/mfd/rc5t583.c39
-rw-r--r--drivers/mfd/twl6040-core.c114
-rw-r--r--drivers/mmc/card/block.c56
-rw-r--r--drivers/mmc/card/queue.c2
-rw-r--r--drivers/mmc/core/bus.c24
-rw-r--r--drivers/mmc/core/cd-gpio.c1
-rw-r--r--drivers/mmc/core/core.c64
-rw-r--r--drivers/mmc/host/dw_mmc.c7
-rw-r--r--drivers/mmc/host/omap_hsmmc.c6
-rw-r--r--drivers/mmc/host/sdhci-esdhc-imx.c3
-rw-r--r--drivers/mmc/host/sdhci.c2
-rw-r--r--drivers/pci/pci.c24
-rw-r--r--drivers/pinctrl/core.c25
-rw-r--r--drivers/s390/block/dasd_eckd.c24
-rw-r--r--drivers/s390/char/vmur.c2
-rw-r--r--drivers/tty/amiserial.c4
-rw-r--r--drivers/tty/serial/clps711x.c14
-rw-r--r--drivers/tty/serial/pch_uart.c4
-rw-r--r--drivers/usb/core/hub.c3
-rw-r--r--drivers/usb/core/message.c6
-rw-r--r--drivers/usb/dwc3/core.c6
-rw-r--r--drivers/usb/dwc3/ep0.c12
-rw-r--r--drivers/usb/gadget/at91_udc.c8
-rw-r--r--drivers/usb/gadget/f_fs.c3
-rw-r--r--drivers/usb/gadget/f_rndis.c1
-rw-r--r--drivers/usb/gadget/fsl_udc_core.c25
-rw-r--r--drivers/usb/gadget/g_ffs.c4
-rw-r--r--drivers/usb/gadget/s3c-hsotg.c17
-rw-r--r--drivers/usb/gadget/udc-core.c6
-rw-r--r--drivers/usb/gadget/uvc_queue.c4
-rw-r--r--drivers/usb/host/ehci-fsl.c7
-rw-r--r--drivers/usb/host/ehci-hcd.c9
-rw-r--r--drivers/usb/host/ehci-omap.c39
-rw-r--r--drivers/usb/host/ehci-tegra.c1
-rw-r--r--drivers/usb/host/ohci-at91.c12
-rw-r--r--drivers/usb/misc/usbtest.c9
-rw-r--r--drivers/usb/misc/yurex.c10
-rw-r--r--drivers/usb/musb/musb_core.c40
-rw-r--r--drivers/usb/musb/musb_host.c2
-rw-r--r--drivers/usb/musb/omap2430.c31
-rw-r--r--drivers/usb/serial/cp210x.c9
-rw-r--r--drivers/usb/serial/sierra.c6
-rw-r--r--drivers/uwb/hwa-rc.c3
-rw-r--r--drivers/uwb/neh.c12
-rw-r--r--drivers/vhost/test.c2
-rw-r--r--drivers/virtio/virtio_balloon.c58
-rw-r--r--drivers/xen/gntdev.c2
-rw-r--r--drivers/xen/grant-table.c13
-rw-r--r--drivers/xen/manage.c1
-rw-r--r--drivers/xen/xenbus/xenbus_probe_frontend.c69
-rw-r--r--fs/aio.c16
-rw-r--r--fs/binfmt_aout.c32
-rw-r--r--fs/binfmt_elf.c23
-rw-r--r--fs/binfmt_elf_fdpic.c18
-rw-r--r--fs/binfmt_flat.c12
-rw-r--r--fs/binfmt_som.c12
-rw-r--r--fs/btrfs/ctree.h2
-rw-r--r--fs/cifs/connect.c82
-rw-r--r--fs/ext4/ext4.h3
-rw-r--r--fs/ext4/extents.c6
-rw-r--r--fs/ext4/super.c48
-rw-r--r--fs/fuse/dir.c25
-rw-r--r--fs/fuse/file.c129
-rw-r--r--fs/fuse/inode.c1
-rw-r--r--fs/lockd/clnt4xdr.c2
-rw-r--r--fs/lockd/clntxdr.c2
-rw-r--r--fs/nfsd/nfs3xdr.c22
-rw-r--r--fs/nfsd/nfs4proc.c15
-rw-r--r--fs/nfsd/nfs4state.c23
-rw-r--r--fs/nfsd/nfs4xdr.c4
-rw-r--r--fs/nfsd/vfs.c2
-rw-r--r--fs/ocfs2/alloc.c2
-rw-r--r--fs/ocfs2/refcounttree.c12
-rw-r--r--fs/ocfs2/suballoc.c4
-rw-r--r--include/linux/fuse.h2
-rw-r--r--include/linux/i2c/twl.h12
-rw-r--r--include/linux/kvm_host.h6
-rw-r--r--include/linux/mfd/db5500-prcmu.h88
-rw-r--r--include/linux/mfd/rc5t583.h47
-rw-r--r--include/linux/mfd/twl6040.h27
-rw-r--r--include/linux/mm.h27
-rw-r--r--include/linux/mmc/card.h2
-rw-r--r--include/linux/nfsd/Kbuild1
-rw-r--r--include/linux/pinctrl/machine.h4
-rw-r--r--include/linux/usb/otg.h1
-rw-r--r--lib/mpi/mpi-bit.c5
-rw-r--r--mm/memblock.c7
-rw-r--r--mm/memcontrol.c1
-rw-r--r--mm/mmap.c59
-rw-r--r--mm/nommu.c41
-rwxr-xr-xscripts/checkpatch.pl6
-rw-r--r--scripts/xz_wrap.sh4
-rw-r--r--security/commoncap.c6
-rw-r--r--security/smack/smack_lsm.c44
-rw-r--r--security/smack/smackfs.c14
-rw-r--r--sound/core/vmaster.c1
-rw-r--r--sound/last.c2
-rw-r--r--sound/pci/hda/patch_conexant.c35
-rw-r--r--sound/pci/hda/patch_realtek.c49
-rw-r--r--sound/pci/hda/patch_sigmatel.c5
-rw-r--r--sound/soc/codecs/Kconfig3
-rw-r--r--sound/soc/codecs/twl6040.c3
-rw-r--r--sound/soc/omap/Kconfig2
-rw-r--r--tools/perf/.gitignore2
-rw-r--r--tools/perf/Makefile21
-rw-r--r--tools/perf/perf-archive.sh3
-rw-r--r--tools/perf/util/session.c4
-rw-r--r--virt/kvm/iommu.c30
-rw-r--r--virt/kvm/kvm_main.c5
221 files changed, 1731 insertions, 1255 deletions
diff --git a/Documentation/DocBook/media/v4l/pixfmt-nv12m.xml b/Documentation/DocBook/media/v4l/pixfmt-nv12m.xml
index 3fd3ce5df270..5274c24d11e0 100644
--- a/Documentation/DocBook/media/v4l/pixfmt-nv12m.xml
+++ b/Documentation/DocBook/media/v4l/pixfmt-nv12m.xml
@@ -1,6 +1,6 @@
1 <refentry id="V4L2-PIX-FMT-NV12M"> 1 <refentry id="V4L2-PIX-FMT-NV12M">
2 <refmeta> 2 <refmeta>
3 <refentrytitle>V4L2_PIX_FMT_NV12M ('NV12M')</refentrytitle> 3 <refentrytitle>V4L2_PIX_FMT_NV12M ('NM12')</refentrytitle>
4 &manvol; 4 &manvol;
5 </refmeta> 5 </refmeta>
6 <refnamediv> 6 <refnamediv>
diff --git a/Documentation/DocBook/media/v4l/pixfmt-yuv420m.xml b/Documentation/DocBook/media/v4l/pixfmt-yuv420m.xml
index 9957863daf18..60308f1eefdf 100644
--- a/Documentation/DocBook/media/v4l/pixfmt-yuv420m.xml
+++ b/Documentation/DocBook/media/v4l/pixfmt-yuv420m.xml
@@ -1,6 +1,6 @@
1 <refentry id="V4L2-PIX-FMT-YUV420M"> 1 <refentry id="V4L2-PIX-FMT-YUV420M">
2 <refmeta> 2 <refmeta>
3 <refentrytitle>V4L2_PIX_FMT_YUV420M ('YU12M')</refentrytitle> 3 <refentrytitle>V4L2_PIX_FMT_YUV420M ('YM12')</refentrytitle>
4 &manvol; 4 &manvol;
5 </refmeta> 5 </refmeta>
6 <refnamediv> 6 <refnamediv>
diff --git a/MAINTAINERS b/MAINTAINERS
index b0f1073c40b0..1a2f8f5823e0 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2321,9 +2321,9 @@ S: Supported
2321F: drivers/acpi/dock.c 2321F: drivers/acpi/dock.c
2322 2322
2323DOCUMENTATION 2323DOCUMENTATION
2324M: Randy Dunlap <rdunlap@xenotime.net> 2324M: Rob Landley <rob@landley.net>
2325L: linux-doc@vger.kernel.org 2325L: linux-doc@vger.kernel.org
2326T: quilt http://xenotime.net/kernel-doc-patches/current/ 2326T: TBD
2327S: Maintained 2327S: Maintained
2328F: Documentation/ 2328F: Documentation/
2329 2329
diff --git a/Makefile b/Makefile
index f6578f47e21e..afc868e6c75d 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 3 1VERSION = 3
2PATCHLEVEL = 4 2PATCHLEVEL = 4
3SUBLEVEL = 0 3SUBLEVEL = 0
4EXTRAVERSION = -rc3 4EXTRAVERSION = -rc4
5NAME = Saber-toothed Squirrel 5NAME = Saber-toothed Squirrel
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
diff --git a/arch/arm/configs/imx_v4_v5_defconfig b/arch/arm/configs/imx_v4_v5_defconfig
index b5ac644e12af..6b31cb60daab 100644
--- a/arch/arm/configs/imx_v4_v5_defconfig
+++ b/arch/arm/configs/imx_v4_v5_defconfig
@@ -112,6 +112,7 @@ CONFIG_WATCHDOG=y
112CONFIG_IMX2_WDT=y 112CONFIG_IMX2_WDT=y
113CONFIG_MFD_MC13XXX=y 113CONFIG_MFD_MC13XXX=y
114CONFIG_REGULATOR=y 114CONFIG_REGULATOR=y
115CONFIG_REGULATOR_FIXED_VOLTAGE=y
115CONFIG_REGULATOR_MC13783=y 116CONFIG_REGULATOR_MC13783=y
116CONFIG_REGULATOR_MC13892=y 117CONFIG_REGULATOR_MC13892=y
117CONFIG_FB=y 118CONFIG_FB=y
diff --git a/arch/arm/configs/u8500_defconfig b/arch/arm/configs/u8500_defconfig
index 889d73ac1ae1..7e84f453e8a6 100644
--- a/arch/arm/configs/u8500_defconfig
+++ b/arch/arm/configs/u8500_defconfig
@@ -8,8 +8,6 @@ CONFIG_MODULE_UNLOAD=y
8# CONFIG_LBDAF is not set 8# CONFIG_LBDAF is not set
9# CONFIG_BLK_DEV_BSG is not set 9# CONFIG_BLK_DEV_BSG is not set
10CONFIG_ARCH_U8500=y 10CONFIG_ARCH_U8500=y
11CONFIG_UX500_SOC_DB5500=y
12CONFIG_UX500_SOC_DB8500=y
13CONFIG_MACH_HREFV60=y 11CONFIG_MACH_HREFV60=y
14CONFIG_MACH_SNOWBALL=y 12CONFIG_MACH_SNOWBALL=y
15CONFIG_MACH_U5500=y 13CONFIG_MACH_U5500=y
@@ -39,7 +37,6 @@ CONFIG_CAIF=y
39CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 37CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
40CONFIG_BLK_DEV_RAM=y 38CONFIG_BLK_DEV_RAM=y
41CONFIG_BLK_DEV_RAM_SIZE=65536 39CONFIG_BLK_DEV_RAM_SIZE=65536
42CONFIG_MISC_DEVICES=y
43CONFIG_AB8500_PWM=y 40CONFIG_AB8500_PWM=y
44CONFIG_SENSORS_BH1780=y 41CONFIG_SENSORS_BH1780=y
45CONFIG_NETDEVICES=y 42CONFIG_NETDEVICES=y
@@ -65,16 +62,18 @@ CONFIG_SERIAL_AMBA_PL011=y
65CONFIG_SERIAL_AMBA_PL011_CONSOLE=y 62CONFIG_SERIAL_AMBA_PL011_CONSOLE=y
66CONFIG_HW_RANDOM=y 63CONFIG_HW_RANDOM=y
67CONFIG_HW_RANDOM_NOMADIK=y 64CONFIG_HW_RANDOM_NOMADIK=y
68CONFIG_I2C=y
69CONFIG_I2C_NOMADIK=y
70CONFIG_SPI=y 65CONFIG_SPI=y
71CONFIG_SPI_PL022=y 66CONFIG_SPI_PL022=y
72CONFIG_GPIO_STMPE=y 67CONFIG_GPIO_STMPE=y
73CONFIG_GPIO_TC3589X=y 68CONFIG_GPIO_TC3589X=y
69CONFIG_POWER_SUPPLY=y
70CONFIG_AB8500_BM=y
71CONFIG_AB8500_BATTERY_THERM_ON_BATCTRL=y
74CONFIG_MFD_STMPE=y 72CONFIG_MFD_STMPE=y
75CONFIG_MFD_TC3589X=y 73CONFIG_MFD_TC3589X=y
76CONFIG_AB5500_CORE=y 74CONFIG_AB5500_CORE=y
77CONFIG_AB8500_CORE=y 75CONFIG_AB8500_CORE=y
76CONFIG_REGULATOR=y
78CONFIG_REGULATOR_AB8500=y 77CONFIG_REGULATOR_AB8500=y
79# CONFIG_HID_SUPPORT is not set 78# CONFIG_HID_SUPPORT is not set
80CONFIG_USB_GADGET=y 79CONFIG_USB_GADGET=y
diff --git a/arch/arm/mach-at91/at91rm9200_devices.c b/arch/arm/mach-at91/at91rm9200_devices.c
index 99ce5c955e39..05774e5b1cba 100644
--- a/arch/arm/mach-at91/at91rm9200_devices.c
+++ b/arch/arm/mach-at91/at91rm9200_devices.c
@@ -1173,7 +1173,6 @@ void __init at91_add_device_serial(void)
1173 printk(KERN_INFO "AT91: No default serial console defined.\n"); 1173 printk(KERN_INFO "AT91: No default serial console defined.\n");
1174} 1174}
1175#else 1175#else
1176void __init __deprecated at91_init_serial(struct at91_uart_config *config) {}
1177void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) {} 1176void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) {}
1178void __init at91_set_serial_console(unsigned portnr) {} 1177void __init at91_set_serial_console(unsigned portnr) {}
1179void __init at91_add_device_serial(void) {} 1178void __init at91_add_device_serial(void) {}
diff --git a/arch/arm/mach-at91/at91rm9200_time.c b/arch/arm/mach-at91/at91rm9200_time.c
index dd7f782b0b91..104ca40d8d18 100644
--- a/arch/arm/mach-at91/at91rm9200_time.c
+++ b/arch/arm/mach-at91/at91rm9200_time.c
@@ -23,6 +23,7 @@
23#include <linux/interrupt.h> 23#include <linux/interrupt.h>
24#include <linux/irq.h> 24#include <linux/irq.h>
25#include <linux/clockchips.h> 25#include <linux/clockchips.h>
26#include <linux/export.h>
26 27
27#include <asm/mach/time.h> 28#include <asm/mach/time.h>
28 29
@@ -176,6 +177,7 @@ static struct clock_event_device clkevt = {
176}; 177};
177 178
178void __iomem *at91_st_base; 179void __iomem *at91_st_base;
180EXPORT_SYMBOL_GPL(at91_st_base);
179 181
180void __init at91rm9200_ioremap_st(u32 addr) 182void __init at91rm9200_ioremap_st(u32 addr)
181{ 183{
diff --git a/arch/arm/mach-at91/board-rm9200ek.c b/arch/arm/mach-at91/board-rm9200ek.c
index 11cbaa8946fe..b2e4fe21f346 100644
--- a/arch/arm/mach-at91/board-rm9200ek.c
+++ b/arch/arm/mach-at91/board-rm9200ek.c
@@ -117,7 +117,7 @@ static struct i2c_board_info __initdata ek_i2c_devices[] = {
117}; 117};
118 118
119#define EK_FLASH_BASE AT91_CHIPSELECT_0 119#define EK_FLASH_BASE AT91_CHIPSELECT_0
120#define EK_FLASH_SIZE SZ_2M 120#define EK_FLASH_SIZE SZ_8M
121 121
122static struct physmap_flash_data ek_flash_data = { 122static struct physmap_flash_data ek_flash_data = {
123 .width = 2, 123 .width = 2,
diff --git a/arch/arm/mach-at91/board-sam9261ek.c b/arch/arm/mach-at91/board-sam9261ek.c
index c3f994462864..065fed342424 100644
--- a/arch/arm/mach-at91/board-sam9261ek.c
+++ b/arch/arm/mach-at91/board-sam9261ek.c
@@ -85,8 +85,6 @@ static struct resource dm9000_resource[] = {
85 .flags = IORESOURCE_MEM 85 .flags = IORESOURCE_MEM
86 }, 86 },
87 [2] = { 87 [2] = {
88 .start = AT91_PIN_PC11,
89 .end = AT91_PIN_PC11,
90 .flags = IORESOURCE_IRQ 88 .flags = IORESOURCE_IRQ
91 | IORESOURCE_IRQ_LOWEDGE | IORESOURCE_IRQ_HIGHEDGE, 89 | IORESOURCE_IRQ_LOWEDGE | IORESOURCE_IRQ_HIGHEDGE,
92 } 90 }
@@ -130,6 +128,8 @@ static struct sam9_smc_config __initdata dm9000_smc_config = {
130 128
131static void __init ek_add_device_dm9000(void) 129static void __init ek_add_device_dm9000(void)
132{ 130{
131 struct resource *r = &dm9000_resource[2];
132
133 /* Configure chip-select 2 (DM9000) */ 133 /* Configure chip-select 2 (DM9000) */
134 sam9_smc_configure(0, 2, &dm9000_smc_config); 134 sam9_smc_configure(0, 2, &dm9000_smc_config);
135 135
@@ -139,6 +139,7 @@ static void __init ek_add_device_dm9000(void)
139 /* Configure Interrupt pin as input, no pull-up */ 139 /* Configure Interrupt pin as input, no pull-up */
140 at91_set_gpio_input(AT91_PIN_PC11, 0); 140 at91_set_gpio_input(AT91_PIN_PC11, 0);
141 141
142 r->start = r->end = gpio_to_irq(AT91_PIN_PC11);
142 platform_device_register(&dm9000_device); 143 platform_device_register(&dm9000_device);
143} 144}
144#else 145#else
diff --git a/arch/arm/mach-at91/clock.c b/arch/arm/mach-at91/clock.c
index a0f4d7424cdc..6b692824c988 100644
--- a/arch/arm/mach-at91/clock.c
+++ b/arch/arm/mach-at91/clock.c
@@ -35,6 +35,7 @@
35#include "generic.h" 35#include "generic.h"
36 36
37void __iomem *at91_pmc_base; 37void __iomem *at91_pmc_base;
38EXPORT_SYMBOL_GPL(at91_pmc_base);
38 39
39/* 40/*
40 * There's a lot more which can be done with clocks, including cpufreq 41 * There's a lot more which can be done with clocks, including cpufreq
diff --git a/arch/arm/mach-at91/include/mach/at91_pmc.h b/arch/arm/mach-at91/include/mach/at91_pmc.h
index 36604782a78f..ea2c57a86ca6 100644
--- a/arch/arm/mach-at91/include/mach/at91_pmc.h
+++ b/arch/arm/mach-at91/include/mach/at91_pmc.h
@@ -25,7 +25,7 @@ extern void __iomem *at91_pmc_base;
25#define at91_pmc_write(field, value) \ 25#define at91_pmc_write(field, value) \
26 __raw_writel(value, at91_pmc_base + field) 26 __raw_writel(value, at91_pmc_base + field)
27#else 27#else
28.extern at91_aic_base 28.extern at91_pmc_base
29#endif 29#endif
30 30
31#define AT91_PMC_SCER 0x00 /* System Clock Enable Register */ 31#define AT91_PMC_SCER 0x00 /* System Clock Enable Register */
diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c
index 97cc04dc8073..f44a2e7272e3 100644
--- a/arch/arm/mach-at91/setup.c
+++ b/arch/arm/mach-at91/setup.c
@@ -54,6 +54,7 @@ void __init at91_init_interrupts(unsigned int *priority)
54} 54}
55 55
56void __iomem *at91_ramc_base[2]; 56void __iomem *at91_ramc_base[2];
57EXPORT_SYMBOL_GPL(at91_ramc_base);
57 58
58void __init at91_ioremap_ramc(int id, u32 addr, u32 size) 59void __init at91_ioremap_ramc(int id, u32 addr, u32 size)
59{ 60{
@@ -292,6 +293,7 @@ void __init at91_ioremap_rstc(u32 base_addr)
292} 293}
293 294
294void __iomem *at91_matrix_base; 295void __iomem *at91_matrix_base;
296EXPORT_SYMBOL_GPL(at91_matrix_base);
295 297
296void __init at91_ioremap_matrix(u32 base_addr) 298void __init at91_ioremap_matrix(u32 base_addr)
297{ 299{
diff --git a/arch/arm/mach-bcmring/core.c b/arch/arm/mach-bcmring/core.c
index 22e4e0a28ad1..adbfb1994582 100644
--- a/arch/arm/mach-bcmring/core.c
+++ b/arch/arm/mach-bcmring/core.c
@@ -52,8 +52,8 @@
52#include <mach/csp/chipcHw_inline.h> 52#include <mach/csp/chipcHw_inline.h>
53#include <mach/csp/tmrHw_reg.h> 53#include <mach/csp/tmrHw_reg.h>
54 54
55static AMBA_APB_DEVICE(uartA, "uarta", MM_ADDR_IO_UARTA, { IRQ_UARTA }, NULL); 55static AMBA_APB_DEVICE(uartA, "uartA", 0, MM_ADDR_IO_UARTA, {IRQ_UARTA}, NULL);
56static AMBA_APB_DEVICE(uartB, "uartb", MM_ADDR_IO_UARTB, { IRQ_UARTB }, NULL); 56static AMBA_APB_DEVICE(uartB, "uartB", 0, MM_ADDR_IO_UARTB, {IRQ_UARTB}, NULL);
57 57
58static struct clk pll1_clk = { 58static struct clk pll1_clk = {
59 .name = "PLL1", 59 .name = "PLL1",
diff --git a/arch/arm/mach-imx/imx27-dt.c b/arch/arm/mach-imx/imx27-dt.c
index 861ceb8232d6..ed38d03c61f2 100644
--- a/arch/arm/mach-imx/imx27-dt.c
+++ b/arch/arm/mach-imx/imx27-dt.c
@@ -35,7 +35,7 @@ static const struct of_dev_auxdata imx27_auxdata_lookup[] __initconst = {
35static int __init imx27_avic_add_irq_domain(struct device_node *np, 35static int __init imx27_avic_add_irq_domain(struct device_node *np,
36 struct device_node *interrupt_parent) 36 struct device_node *interrupt_parent)
37{ 37{
38 irq_domain_add_simple(np, 0); 38 irq_domain_add_legacy(np, 64, 0, 0, &irq_domain_simple_ops, NULL);
39 return 0; 39 return 0;
40} 40}
41 41
@@ -44,7 +44,9 @@ static int __init imx27_gpio_add_irq_domain(struct device_node *np,
44{ 44{
45 static int gpio_irq_base = MXC_GPIO_IRQ_START + ARCH_NR_GPIOS; 45 static int gpio_irq_base = MXC_GPIO_IRQ_START + ARCH_NR_GPIOS;
46 46
47 irq_domain_add_simple(np, gpio_irq_base); 47 gpio_irq_base -= 32;
48 irq_domain_add_legacy(np, 32, gpio_irq_base, 0, &irq_domain_simple_ops,
49 NULL);
48 50
49 return 0; 51 return 0;
50} 52}
diff --git a/arch/arm/mach-imx/mm-imx5.c b/arch/arm/mach-imx/mm-imx5.c
index 05250aed61fb..e10f3914fcfe 100644
--- a/arch/arm/mach-imx/mm-imx5.c
+++ b/arch/arm/mach-imx/mm-imx5.c
@@ -35,7 +35,7 @@ static void imx5_idle(void)
35 } 35 }
36 clk_enable(gpc_dvfs_clk); 36 clk_enable(gpc_dvfs_clk);
37 mx5_cpu_lp_set(WAIT_UNCLOCKED_POWER_OFF); 37 mx5_cpu_lp_set(WAIT_UNCLOCKED_POWER_OFF);
38 if (tzic_enable_wake() != 0) 38 if (!tzic_enable_wake())
39 cpu_do_idle(); 39 cpu_do_idle();
40 clk_disable(gpc_dvfs_clk); 40 clk_disable(gpc_dvfs_clk);
41} 41}
diff --git a/arch/arm/mach-omap1/mux.c b/arch/arm/mach-omap1/mux.c
index 087dba0df47e..e9cc52d4cb28 100644
--- a/arch/arm/mach-omap1/mux.c
+++ b/arch/arm/mach-omap1/mux.c
@@ -27,6 +27,7 @@
27#include <linux/io.h> 27#include <linux/io.h>
28#include <linux/spinlock.h> 28#include <linux/spinlock.h>
29 29
30#include <mach/hardware.h>
30 31
31#include <plat/mux.h> 32#include <plat/mux.h>
32 33
diff --git a/arch/arm/mach-omap1/timer.c b/arch/arm/mach-omap1/timer.c
index 6e90665a7c47..fb202af01d0d 100644
--- a/arch/arm/mach-omap1/timer.c
+++ b/arch/arm/mach-omap1/timer.c
@@ -47,9 +47,9 @@ static int omap1_dm_timer_set_src(struct platform_device *pdev,
47 int n = (pdev->id - 1) << 1; 47 int n = (pdev->id - 1) << 1;
48 u32 l; 48 u32 l;
49 49
50 l = __raw_readl(MOD_CONF_CTRL_1) & ~(0x03 << n); 50 l = omap_readl(MOD_CONF_CTRL_1) & ~(0x03 << n);
51 l |= source << n; 51 l |= source << n;
52 __raw_writel(l, MOD_CONF_CTRL_1); 52 omap_writel(l, MOD_CONF_CTRL_1);
53 53
54 return 0; 54 return 0;
55} 55}
diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
index a39fc4bbd2b8..130ab00c09a2 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -20,6 +20,7 @@
20#include <linux/usb/otg.h> 20#include <linux/usb/otg.h>
21#include <linux/spi/spi.h> 21#include <linux/spi/spi.h>
22#include <linux/i2c/twl.h> 22#include <linux/i2c/twl.h>
23#include <linux/mfd/twl6040.h>
23#include <linux/gpio_keys.h> 24#include <linux/gpio_keys.h>
24#include <linux/regulator/machine.h> 25#include <linux/regulator/machine.h>
25#include <linux/regulator/fixed.h> 26#include <linux/regulator/fixed.h>
@@ -560,7 +561,7 @@ static struct regulator_init_data sdp4430_vusim = {
560 }, 561 },
561}; 562};
562 563
563static struct twl4030_codec_data twl6040_codec = { 564static struct twl6040_codec_data twl6040_codec = {
564 /* single-step ramp for headset and handsfree */ 565 /* single-step ramp for headset and handsfree */
565 .hs_left_step = 0x0f, 566 .hs_left_step = 0x0f,
566 .hs_right_step = 0x0f, 567 .hs_right_step = 0x0f,
@@ -568,7 +569,7 @@ static struct twl4030_codec_data twl6040_codec = {
568 .hf_right_step = 0x1d, 569 .hf_right_step = 0x1d,
569}; 570};
570 571
571static struct twl4030_vibra_data twl6040_vibra = { 572static struct twl6040_vibra_data twl6040_vibra = {
572 .vibldrv_res = 8, 573 .vibldrv_res = 8,
573 .vibrdrv_res = 3, 574 .vibrdrv_res = 3,
574 .viblmotor_res = 10, 575 .viblmotor_res = 10,
@@ -577,16 +578,14 @@ static struct twl4030_vibra_data twl6040_vibra = {
577 .vddvibr_uV = 0, /* fixed volt supply - VBAT */ 578 .vddvibr_uV = 0, /* fixed volt supply - VBAT */
578}; 579};
579 580
580static struct twl4030_audio_data twl6040_audio = { 581static struct twl6040_platform_data twl6040_data = {
581 .codec = &twl6040_codec, 582 .codec = &twl6040_codec,
582 .vibra = &twl6040_vibra, 583 .vibra = &twl6040_vibra,
583 .audpwron_gpio = 127, 584 .audpwron_gpio = 127,
584 .naudint_irq = OMAP44XX_IRQ_SYS_2N,
585 .irq_base = TWL6040_CODEC_IRQ_BASE, 585 .irq_base = TWL6040_CODEC_IRQ_BASE,
586}; 586};
587 587
588static struct twl4030_platform_data sdp4430_twldata = { 588static struct twl4030_platform_data sdp4430_twldata = {
589 .audio = &twl6040_audio,
590 /* Regulators */ 589 /* Regulators */
591 .vusim = &sdp4430_vusim, 590 .vusim = &sdp4430_vusim,
592 .vaux1 = &sdp4430_vaux1, 591 .vaux1 = &sdp4430_vaux1,
@@ -617,7 +616,8 @@ static int __init omap4_i2c_init(void)
617 TWL_COMMON_REGULATOR_VCXIO | 616 TWL_COMMON_REGULATOR_VCXIO |
618 TWL_COMMON_REGULATOR_VUSB | 617 TWL_COMMON_REGULATOR_VUSB |
619 TWL_COMMON_REGULATOR_CLK32KG); 618 TWL_COMMON_REGULATOR_CLK32KG);
620 omap4_pmic_init("twl6030", &sdp4430_twldata); 619 omap4_pmic_init("twl6030", &sdp4430_twldata,
620 &twl6040_data, OMAP44XX_IRQ_SYS_2N);
621 omap_register_i2c_bus(2, 400, NULL, 0); 621 omap_register_i2c_bus(2, 400, NULL, 0);
622 omap_register_i2c_bus(3, 400, sdp4430_i2c_3_boardinfo, 622 omap_register_i2c_bus(3, 400, sdp4430_i2c_3_boardinfo,
623 ARRAY_SIZE(sdp4430_i2c_3_boardinfo)); 623 ARRAY_SIZE(sdp4430_i2c_3_boardinfo));
diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c
index 74e1687b5170..098d183a0086 100644
--- a/arch/arm/mach-omap2/board-generic.c
+++ b/arch/arm/mach-omap2/board-generic.c
@@ -137,7 +137,7 @@ static struct twl4030_platform_data sdp4430_twldata = {
137 137
138static void __init omap4_i2c_init(void) 138static void __init omap4_i2c_init(void)
139{ 139{
140 omap4_pmic_init("twl6030", &sdp4430_twldata); 140 omap4_pmic_init("twl6030", &sdp4430_twldata, NULL, 0);
141} 141}
142 142
143static void __init omap4_init(void) 143static void __init omap4_init(void)
diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c
index d8c0e89f0126..1b782ba53433 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -25,6 +25,7 @@
25#include <linux/gpio.h> 25#include <linux/gpio.h>
26#include <linux/usb/otg.h> 26#include <linux/usb/otg.h>
27#include <linux/i2c/twl.h> 27#include <linux/i2c/twl.h>
28#include <linux/mfd/twl6040.h>
28#include <linux/regulator/machine.h> 29#include <linux/regulator/machine.h>
29#include <linux/regulator/fixed.h> 30#include <linux/regulator/fixed.h>
30#include <linux/wl12xx.h> 31#include <linux/wl12xx.h>
@@ -284,7 +285,7 @@ static int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers)
284 return 0; 285 return 0;
285} 286}
286 287
287static struct twl4030_codec_data twl6040_codec = { 288static struct twl6040_codec_data twl6040_codec = {
288 /* single-step ramp for headset and handsfree */ 289 /* single-step ramp for headset and handsfree */
289 .hs_left_step = 0x0f, 290 .hs_left_step = 0x0f,
290 .hs_right_step = 0x0f, 291 .hs_right_step = 0x0f,
@@ -292,17 +293,14 @@ static struct twl4030_codec_data twl6040_codec = {
292 .hf_right_step = 0x1d, 293 .hf_right_step = 0x1d,
293}; 294};
294 295
295static struct twl4030_audio_data twl6040_audio = { 296static struct twl6040_platform_data twl6040_data = {
296 .codec = &twl6040_codec, 297 .codec = &twl6040_codec,
297 .audpwron_gpio = 127, 298 .audpwron_gpio = 127,
298 .naudint_irq = OMAP44XX_IRQ_SYS_2N,
299 .irq_base = TWL6040_CODEC_IRQ_BASE, 299 .irq_base = TWL6040_CODEC_IRQ_BASE,
300}; 300};
301 301
302/* Panda board uses the common PMIC configuration */ 302/* Panda board uses the common PMIC configuration */
303static struct twl4030_platform_data omap4_panda_twldata = { 303static struct twl4030_platform_data omap4_panda_twldata;
304 .audio = &twl6040_audio,
305};
306 304
307/* 305/*
308 * Display monitor features are burnt in their EEPROM as EDID data. The EEPROM 306 * Display monitor features are burnt in their EEPROM as EDID data. The EEPROM
@@ -326,7 +324,8 @@ static int __init omap4_panda_i2c_init(void)
326 TWL_COMMON_REGULATOR_VCXIO | 324 TWL_COMMON_REGULATOR_VCXIO |
327 TWL_COMMON_REGULATOR_VUSB | 325 TWL_COMMON_REGULATOR_VUSB |
328 TWL_COMMON_REGULATOR_CLK32KG); 326 TWL_COMMON_REGULATOR_CLK32KG);
329 omap4_pmic_init("twl6030", &omap4_panda_twldata); 327 omap4_pmic_init("twl6030", &omap4_panda_twldata,
328 &twl6040_data, OMAP44XX_IRQ_SYS_2N);
330 omap_register_i2c_bus(2, 400, NULL, 0); 329 omap_register_i2c_bus(2, 400, NULL, 0);
331 /* 330 /*
332 * Bus 3 is attached to the DVI port where devices like the pico DLP 331 * Bus 3 is attached to the DVI port where devices like the pico DLP
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 2c27fdb61e66..7144ae651d3d 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -1422,6 +1422,9 @@ static int _ocp_softreset(struct omap_hwmod *oh)
1422 goto dis_opt_clks; 1422 goto dis_opt_clks;
1423 _write_sysconfig(v, oh); 1423 _write_sysconfig(v, oh);
1424 1424
1425 if (oh->class->sysc->srst_udelay)
1426 udelay(oh->class->sysc->srst_udelay);
1427
1425 if (oh->class->sysc->sysc_flags & SYSS_HAS_RESET_STATUS) 1428 if (oh->class->sysc->sysc_flags & SYSS_HAS_RESET_STATUS)
1426 omap_test_timeout((omap_hwmod_read(oh, 1429 omap_test_timeout((omap_hwmod_read(oh,
1427 oh->class->sysc->syss_offs) 1430 oh->class->sysc->syss_offs)
@@ -1903,10 +1906,20 @@ void omap_hwmod_write(u32 v, struct omap_hwmod *oh, u16 reg_offs)
1903 */ 1906 */
1904int omap_hwmod_softreset(struct omap_hwmod *oh) 1907int omap_hwmod_softreset(struct omap_hwmod *oh)
1905{ 1908{
1906 if (!oh) 1909 u32 v;
1910 int ret;
1911
1912 if (!oh || !(oh->_sysc_cache))
1907 return -EINVAL; 1913 return -EINVAL;
1908 1914
1909 return _ocp_softreset(oh); 1915 v = oh->_sysc_cache;
1916 ret = _set_softreset(oh, &v);
1917 if (ret)
1918 goto error;
1919 _write_sysconfig(v, oh);
1920
1921error:
1922 return ret;
1910} 1923}
1911 1924
1912/** 1925/**
diff --git a/arch/arm/mach-omap2/omap_hwmod_2420_data.c b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
index a5409ce3f323..a6bde34e443a 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2420_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
@@ -1000,7 +1000,6 @@ static struct omap_hwmod_ocp_if omap2420_l4_core__dss_venc = {
1000 .flags = OMAP_FIREWALL_L4, 1000 .flags = OMAP_FIREWALL_L4,
1001 } 1001 }
1002 }, 1002 },
1003 .flags = OCPIF_SWSUP_IDLE,
1004 .user = OCP_USER_MPU | OCP_USER_SDMA, 1003 .user = OCP_USER_MPU | OCP_USER_SDMA,
1005}; 1004};
1006 1005
diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
index c4f56cb60d7d..04a3885f4475 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
@@ -1049,7 +1049,6 @@ static struct omap_hwmod_ocp_if omap2430_l4_core__dss_venc = {
1049 .slave = &omap2430_dss_venc_hwmod, 1049 .slave = &omap2430_dss_venc_hwmod,
1050 .clk = "dss_ick", 1050 .clk = "dss_ick",
1051 .addr = omap2_dss_venc_addrs, 1051 .addr = omap2_dss_venc_addrs,
1052 .flags = OCPIF_SWSUP_IDLE,
1053 .user = OCP_USER_MPU | OCP_USER_SDMA, 1052 .user = OCP_USER_MPU | OCP_USER_SDMA,
1054}; 1053};
1055 1054
diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
index 34b9766d1d23..db86ce90c69f 100644
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -1676,7 +1676,6 @@ static struct omap_hwmod_ocp_if omap3xxx_l4_core__dss_venc = {
1676 .flags = OMAP_FIREWALL_L4, 1676 .flags = OMAP_FIREWALL_L4,
1677 } 1677 }
1678 }, 1678 },
1679 .flags = OCPIF_SWSUP_IDLE,
1680 .user = OCP_USER_MPU | OCP_USER_SDMA, 1679 .user = OCP_USER_MPU | OCP_USER_SDMA,
1681}; 1680};
1682 1681
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index cc9bd106a854..6abc75753e42 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -2594,6 +2594,15 @@ static struct omap_hwmod omap44xx_ipu_hwmod = {
2594static struct omap_hwmod_class_sysconfig omap44xx_iss_sysc = { 2594static struct omap_hwmod_class_sysconfig omap44xx_iss_sysc = {
2595 .rev_offs = 0x0000, 2595 .rev_offs = 0x0000,
2596 .sysc_offs = 0x0010, 2596 .sysc_offs = 0x0010,
2597 /*
2598 * ISS needs 100 OCP clk cycles delay after a softreset before
2599 * accessing sysconfig again.
2600 * The lowest frequency at the moment for L3 bus is 100 MHz, so
2601 * 1usec delay is needed. Add an x2 margin to be safe (2 usecs).
2602 *
2603 * TODO: Indicate errata when available.
2604 */
2605 .srst_udelay = 2,
2597 .sysc_flags = (SYSC_HAS_MIDLEMODE | SYSC_HAS_RESET_STATUS | 2606 .sysc_flags = (SYSC_HAS_MIDLEMODE | SYSC_HAS_RESET_STATUS |
2598 SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET), 2607 SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET),
2599 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART | 2608 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
index 6affdd4bee62..de74e05dd929 100644
--- a/arch/arm/mach-omap2/serial.c
+++ b/arch/arm/mach-omap2/serial.c
@@ -108,8 +108,14 @@ static void omap_uart_set_noidle(struct platform_device *pdev)
108static void omap_uart_set_smartidle(struct platform_device *pdev) 108static void omap_uart_set_smartidle(struct platform_device *pdev)
109{ 109{
110 struct omap_device *od = to_omap_device(pdev); 110 struct omap_device *od = to_omap_device(pdev);
111 u8 idlemode;
111 112
112 omap_hwmod_set_slave_idlemode(od->hwmods[0], HWMOD_IDLEMODE_SMART); 113 if (od->hwmods[0]->class->sysc->idlemodes & SIDLE_SMART_WKUP)
114 idlemode = HWMOD_IDLEMODE_SMART_WKUP;
115 else
116 idlemode = HWMOD_IDLEMODE_SMART;
117
118 omap_hwmod_set_slave_idlemode(od->hwmods[0], idlemode);
113} 119}
114 120
115#else 121#else
@@ -120,124 +126,8 @@ static void omap_uart_set_smartidle(struct platform_device *pdev) {}
120#endif /* CONFIG_PM */ 126#endif /* CONFIG_PM */
121 127
122#ifdef CONFIG_OMAP_MUX 128#ifdef CONFIG_OMAP_MUX
123static struct omap_device_pad default_uart1_pads[] __initdata = {
124 {
125 .name = "uart1_cts.uart1_cts",
126 .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0,
127 },
128 {
129 .name = "uart1_rts.uart1_rts",
130 .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0,
131 },
132 {
133 .name = "uart1_tx.uart1_tx",
134 .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0,
135 },
136 {
137 .name = "uart1_rx.uart1_rx",
138 .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP,
139 .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0,
140 .idle = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0,
141 },
142};
143
144static struct omap_device_pad default_uart2_pads[] __initdata = {
145 {
146 .name = "uart2_cts.uart2_cts",
147 .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0,
148 },
149 {
150 .name = "uart2_rts.uart2_rts",
151 .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0,
152 },
153 {
154 .name = "uart2_tx.uart2_tx",
155 .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0,
156 },
157 {
158 .name = "uart2_rx.uart2_rx",
159 .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP,
160 .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0,
161 .idle = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0,
162 },
163};
164
165static struct omap_device_pad default_uart3_pads[] __initdata = {
166 {
167 .name = "uart3_cts_rctx.uart3_cts_rctx",
168 .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0,
169 },
170 {
171 .name = "uart3_rts_sd.uart3_rts_sd",
172 .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0,
173 },
174 {
175 .name = "uart3_tx_irtx.uart3_tx_irtx",
176 .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0,
177 },
178 {
179 .name = "uart3_rx_irrx.uart3_rx_irrx",
180 .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP,
181 .enable = OMAP_PIN_INPUT | OMAP_MUX_MODE0,
182 .idle = OMAP_PIN_INPUT | OMAP_MUX_MODE0,
183 },
184};
185
186static struct omap_device_pad default_omap36xx_uart4_pads[] __initdata = {
187 {
188 .name = "gpmc_wait2.uart4_tx",
189 .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0,
190 },
191 {
192 .name = "gpmc_wait3.uart4_rx",
193 .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP,
194 .enable = OMAP_PIN_INPUT | OMAP_MUX_MODE2,
195 .idle = OMAP_PIN_INPUT | OMAP_MUX_MODE2,
196 },
197};
198
199static struct omap_device_pad default_omap4_uart4_pads[] __initdata = {
200 {
201 .name = "uart4_tx.uart4_tx",
202 .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0,
203 },
204 {
205 .name = "uart4_rx.uart4_rx",
206 .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP,
207 .enable = OMAP_PIN_INPUT | OMAP_MUX_MODE0,
208 .idle = OMAP_PIN_INPUT | OMAP_MUX_MODE0,
209 },
210};
211
212static void omap_serial_fill_default_pads(struct omap_board_data *bdata) 129static void omap_serial_fill_default_pads(struct omap_board_data *bdata)
213{ 130{
214 switch (bdata->id) {
215 case 0:
216 bdata->pads = default_uart1_pads;
217 bdata->pads_cnt = ARRAY_SIZE(default_uart1_pads);
218 break;
219 case 1:
220 bdata->pads = default_uart2_pads;
221 bdata->pads_cnt = ARRAY_SIZE(default_uart2_pads);
222 break;
223 case 2:
224 bdata->pads = default_uart3_pads;
225 bdata->pads_cnt = ARRAY_SIZE(default_uart3_pads);
226 break;
227 case 3:
228 if (cpu_is_omap44xx()) {
229 bdata->pads = default_omap4_uart4_pads;
230 bdata->pads_cnt =
231 ARRAY_SIZE(default_omap4_uart4_pads);
232 } else if (cpu_is_omap3630()) {
233 bdata->pads = default_omap36xx_uart4_pads;
234 bdata->pads_cnt =
235 ARRAY_SIZE(default_omap36xx_uart4_pads);
236 }
237 break;
238 default:
239 break;
240 }
241} 131}
242#else 132#else
243static void omap_serial_fill_default_pads(struct omap_board_data *bdata) {} 133static void omap_serial_fill_default_pads(struct omap_board_data *bdata) {}
diff --git a/arch/arm/mach-omap2/twl-common.c b/arch/arm/mach-omap2/twl-common.c
index 4b57757bf9d1..7a7b89304c48 100644
--- a/arch/arm/mach-omap2/twl-common.c
+++ b/arch/arm/mach-omap2/twl-common.c
@@ -37,6 +37,16 @@ static struct i2c_board_info __initdata pmic_i2c_board_info = {
37 .flags = I2C_CLIENT_WAKE, 37 .flags = I2C_CLIENT_WAKE,
38}; 38};
39 39
40static struct i2c_board_info __initdata omap4_i2c1_board_info[] = {
41 {
42 .addr = 0x48,
43 .flags = I2C_CLIENT_WAKE,
44 },
45 {
46 I2C_BOARD_INFO("twl6040", 0x4b),
47 },
48};
49
40void __init omap_pmic_init(int bus, u32 clkrate, 50void __init omap_pmic_init(int bus, u32 clkrate,
41 const char *pmic_type, int pmic_irq, 51 const char *pmic_type, int pmic_irq,
42 struct twl4030_platform_data *pmic_data) 52 struct twl4030_platform_data *pmic_data)
@@ -49,14 +59,31 @@ void __init omap_pmic_init(int bus, u32 clkrate,
49 omap_register_i2c_bus(bus, clkrate, &pmic_i2c_board_info, 1); 59 omap_register_i2c_bus(bus, clkrate, &pmic_i2c_board_info, 1);
50} 60}
51 61
62void __init omap4_pmic_init(const char *pmic_type,
63 struct twl4030_platform_data *pmic_data,
64 struct twl6040_platform_data *twl6040_data, int twl6040_irq)
65{
66 /* PMIC part*/
67 strncpy(omap4_i2c1_board_info[0].type, pmic_type,
68 sizeof(omap4_i2c1_board_info[0].type));
69 omap4_i2c1_board_info[0].irq = OMAP44XX_IRQ_SYS_1N;
70 omap4_i2c1_board_info[0].platform_data = pmic_data;
71
72 /* TWL6040 audio IC part */
73 omap4_i2c1_board_info[1].irq = twl6040_irq;
74 omap4_i2c1_board_info[1].platform_data = twl6040_data;
75
76 omap_register_i2c_bus(1, 400, omap4_i2c1_board_info, 2);
77
78}
79
52void __init omap_pmic_late_init(void) 80void __init omap_pmic_late_init(void)
53{ 81{
54 /* Init the OMAP TWL parameters (if PMIC has been registerd) */ 82 /* Init the OMAP TWL parameters (if PMIC has been registerd) */
55 if (!pmic_i2c_board_info.irq) 83 if (pmic_i2c_board_info.irq)
56 return; 84 omap3_twl_init();
57 85 if (omap4_i2c1_board_info[0].irq)
58 omap3_twl_init(); 86 omap4_twl_init();
59 omap4_twl_init();
60} 87}
61 88
62#if defined(CONFIG_ARCH_OMAP3) 89#if defined(CONFIG_ARCH_OMAP3)
diff --git a/arch/arm/mach-omap2/twl-common.h b/arch/arm/mach-omap2/twl-common.h
index 275dde8cb27a..09627483a57f 100644
--- a/arch/arm/mach-omap2/twl-common.h
+++ b/arch/arm/mach-omap2/twl-common.h
@@ -29,6 +29,7 @@
29 29
30 30
31struct twl4030_platform_data; 31struct twl4030_platform_data;
32struct twl6040_platform_data;
32 33
33void omap_pmic_init(int bus, u32 clkrate, const char *pmic_type, int pmic_irq, 34void omap_pmic_init(int bus, u32 clkrate, const char *pmic_type, int pmic_irq,
34 struct twl4030_platform_data *pmic_data); 35 struct twl4030_platform_data *pmic_data);
@@ -46,12 +47,9 @@ static inline void omap3_pmic_init(const char *pmic_type,
46 omap_pmic_init(1, 2600, pmic_type, INT_34XX_SYS_NIRQ, pmic_data); 47 omap_pmic_init(1, 2600, pmic_type, INT_34XX_SYS_NIRQ, pmic_data);
47} 48}
48 49
49static inline void omap4_pmic_init(const char *pmic_type, 50void omap4_pmic_init(const char *pmic_type,
50 struct twl4030_platform_data *pmic_data) 51 struct twl4030_platform_data *pmic_data,
51{ 52 struct twl6040_platform_data *audio_data, int twl6040_irq);
52 /* Phoenix Audio IC needs I2C1 to start with 400 KHz or less */
53 omap_pmic_init(1, 400, pmic_type, OMAP44XX_IRQ_SYS_1N, pmic_data);
54}
55 53
56void omap3_pmic_get_config(struct twl4030_platform_data *pmic_data, 54void omap3_pmic_get_config(struct twl4030_platform_data *pmic_data,
57 u32 pdata_flags, u32 regulators_flags); 55 u32 pdata_flags, u32 regulators_flags);
diff --git a/arch/arm/mach-ux500/Kconfig b/arch/arm/mach-ux500/Kconfig
index 880d02ec89d4..ef7099eea0f2 100644
--- a/arch/arm/mach-ux500/Kconfig
+++ b/arch/arm/mach-ux500/Kconfig
@@ -17,6 +17,7 @@ config UX500_SOC_DB5500
17config UX500_SOC_DB8500 17config UX500_SOC_DB8500
18 bool 18 bool
19 select MFD_DB8500_PRCMU 19 select MFD_DB8500_PRCMU
20 select REGULATOR
20 select REGULATOR_DB8500_PRCMU 21 select REGULATOR_DB8500_PRCMU
21 select CPU_FREQ_TABLE if CPU_FREQ 22 select CPU_FREQ_TABLE if CPU_FREQ
22 23
diff --git a/arch/arm/mach-ux500/platsmp.c b/arch/arm/mach-ux500/platsmp.c
index d2058ef8345f..eff5842f6232 100644
--- a/arch/arm/mach-ux500/platsmp.c
+++ b/arch/arm/mach-ux500/platsmp.c
@@ -99,7 +99,7 @@ int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
99 */ 99 */
100 write_pen_release(cpu_logical_map(cpu)); 100 write_pen_release(cpu_logical_map(cpu));
101 101
102 gic_raise_softirq(cpumask_of(cpu), 1); 102 smp_send_reschedule(cpu);
103 103
104 timeout = jiffies + (1 * HZ); 104 timeout = jiffies + (1 * HZ);
105 while (time_before(jiffies, timeout)) { 105 while (time_before(jiffies, timeout)) {
diff --git a/arch/arm/plat-omap/include/plat/omap_hwmod.h b/arch/arm/plat-omap/include/plat/omap_hwmod.h
index 8070145ccb98..3f26db4ee8e6 100644
--- a/arch/arm/plat-omap/include/plat/omap_hwmod.h
+++ b/arch/arm/plat-omap/include/plat/omap_hwmod.h
@@ -305,6 +305,7 @@ struct omap_hwmod_sysc_fields {
305 * @rev_offs: IP block revision register offset (from module base addr) 305 * @rev_offs: IP block revision register offset (from module base addr)
306 * @sysc_offs: OCP_SYSCONFIG register offset (from module base addr) 306 * @sysc_offs: OCP_SYSCONFIG register offset (from module base addr)
307 * @syss_offs: OCP_SYSSTATUS register offset (from module base addr) 307 * @syss_offs: OCP_SYSSTATUS register offset (from module base addr)
308 * @srst_udelay: Delay needed after doing a softreset in usecs
308 * @idlemodes: One or more of {SIDLE,MSTANDBY}_{OFF,FORCE,SMART} 309 * @idlemodes: One or more of {SIDLE,MSTANDBY}_{OFF,FORCE,SMART}
309 * @sysc_flags: SYS{C,S}_HAS* flags indicating SYSCONFIG bits supported 310 * @sysc_flags: SYS{C,S}_HAS* flags indicating SYSCONFIG bits supported
310 * @clockact: the default value of the module CLOCKACTIVITY bits 311 * @clockact: the default value of the module CLOCKACTIVITY bits
@@ -330,9 +331,10 @@ struct omap_hwmod_class_sysconfig {
330 u16 sysc_offs; 331 u16 sysc_offs;
331 u16 syss_offs; 332 u16 syss_offs;
332 u16 sysc_flags; 333 u16 sysc_flags;
334 struct omap_hwmod_sysc_fields *sysc_fields;
335 u8 srst_udelay;
333 u8 idlemodes; 336 u8 idlemodes;
334 u8 clockact; 337 u8 clockact;
335 struct omap_hwmod_sysc_fields *sysc_fields;
336}; 338};
337 339
338/** 340/**
diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c
index eec98afa0f83..f9a8c5341ee9 100644
--- a/arch/arm/plat-omap/sram.c
+++ b/arch/arm/plat-omap/sram.c
@@ -348,7 +348,6 @@ u32 omap3_configure_core_dpll(u32 m2, u32 unlock_dll, u32 f, u32 inc,
348 sdrc_actim_ctrl_b_1, sdrc_mr_1); 348 sdrc_actim_ctrl_b_1, sdrc_mr_1);
349} 349}
350 350
351#ifdef CONFIG_PM
352void omap3_sram_restore_context(void) 351void omap3_sram_restore_context(void)
353{ 352{
354 omap_sram_ceil = omap_sram_base + omap_sram_size; 353 omap_sram_ceil = omap_sram_base + omap_sram_size;
@@ -358,17 +357,18 @@ void omap3_sram_restore_context(void)
358 omap3_sram_configure_core_dpll_sz); 357 omap3_sram_configure_core_dpll_sz);
359 omap_push_sram_idle(); 358 omap_push_sram_idle();
360} 359}
361#endif /* CONFIG_PM */
362
363#endif /* CONFIG_ARCH_OMAP3 */
364 360
365static inline int omap34xx_sram_init(void) 361static inline int omap34xx_sram_init(void)
366{ 362{
367#if defined(CONFIG_ARCH_OMAP3) && defined(CONFIG_PM)
368 omap3_sram_restore_context(); 363 omap3_sram_restore_context();
369#endif
370 return 0; 364 return 0;
371} 365}
366#else
367static inline int omap34xx_sram_init(void)
368{
369 return 0;
370}
371#endif /* CONFIG_ARCH_OMAP3 */
372 372
373static inline int am33xx_sram_init(void) 373static inline int am33xx_sram_init(void)
374{ 374{
diff --git a/arch/ia64/include/asm/futex.h b/arch/ia64/include/asm/futex.h
index 0ab82cc2dc8f..d2bf1fd5e44f 100644
--- a/arch/ia64/include/asm/futex.h
+++ b/arch/ia64/include/asm/futex.h
@@ -106,15 +106,16 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr,
106 return -EFAULT; 106 return -EFAULT;
107 107
108 { 108 {
109 register unsigned long r8 __asm ("r8") = 0; 109 register unsigned long r8 __asm ("r8");
110 unsigned long prev; 110 unsigned long prev;
111 __asm__ __volatile__( 111 __asm__ __volatile__(
112 " mf;; \n" 112 " mf;; \n"
113 " mov ar.ccv=%3;; \n" 113 " mov %0=r0 \n"
114 "[1:] cmpxchg4.acq %0=[%1],%2,ar.ccv \n" 114 " mov ar.ccv=%4;; \n"
115 "[1:] cmpxchg4.acq %1=[%2],%3,ar.ccv \n"
115 " .xdata4 \"__ex_table\", 1b-., 2f-. \n" 116 " .xdata4 \"__ex_table\", 1b-., 2f-. \n"
116 "[2:]" 117 "[2:]"
117 : "=r" (prev) 118 : "=r" (r8), "=r" (prev)
118 : "r" (uaddr), "r" (newval), 119 : "r" (uaddr), "r" (newval),
119 "rO" ((long) (unsigned) oldval) 120 "rO" ((long) (unsigned) oldval)
120 : "memory"); 121 : "memory");
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c
index 9d0fd7d5bb82..f00ba025375d 100644
--- a/arch/ia64/kernel/perfmon.c
+++ b/arch/ia64/kernel/perfmon.c
@@ -604,12 +604,6 @@ pfm_unprotect_ctx_ctxsw(pfm_context_t *x, unsigned long f)
604 spin_unlock(&(x)->ctx_lock); 604 spin_unlock(&(x)->ctx_lock);
605} 605}
606 606
607static inline unsigned int
608pfm_do_munmap(struct mm_struct *mm, unsigned long addr, size_t len, int acct)
609{
610 return do_munmap(mm, addr, len);
611}
612
613static inline unsigned long 607static inline unsigned long
614pfm_get_unmapped_area(struct file *file, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags, unsigned long exec) 608pfm_get_unmapped_area(struct file *file, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags, unsigned long exec)
615{ 609{
@@ -1458,8 +1452,9 @@ pfm_unreserve_session(pfm_context_t *ctx, int is_syswide, unsigned int cpu)
1458 * a PROTECT_CTX() section. 1452 * a PROTECT_CTX() section.
1459 */ 1453 */
1460static int 1454static int
1461pfm_remove_smpl_mapping(struct task_struct *task, void *vaddr, unsigned long size) 1455pfm_remove_smpl_mapping(void *vaddr, unsigned long size)
1462{ 1456{
1457 struct task_struct *task = current;
1463 int r; 1458 int r;
1464 1459
1465 /* sanity checks */ 1460 /* sanity checks */
@@ -1473,13 +1468,8 @@ pfm_remove_smpl_mapping(struct task_struct *task, void *vaddr, unsigned long siz
1473 /* 1468 /*
1474 * does the actual unmapping 1469 * does the actual unmapping
1475 */ 1470 */
1476 down_write(&task->mm->mmap_sem); 1471 r = vm_munmap((unsigned long)vaddr, size);
1477 1472
1478 DPRINT(("down_write done smpl_vaddr=%p size=%lu\n", vaddr, size));
1479
1480 r = pfm_do_munmap(task->mm, (unsigned long)vaddr, size, 0);
1481
1482 up_write(&task->mm->mmap_sem);
1483 if (r !=0) { 1473 if (r !=0) {
1484 printk(KERN_ERR "perfmon: [%d] unable to unmap sampling buffer @%p size=%lu\n", task_pid_nr(task), vaddr, size); 1474 printk(KERN_ERR "perfmon: [%d] unable to unmap sampling buffer @%p size=%lu\n", task_pid_nr(task), vaddr, size);
1485 } 1475 }
@@ -1945,7 +1935,7 @@ pfm_flush(struct file *filp, fl_owner_t id)
1945 * because some VM function reenables interrupts. 1935 * because some VM function reenables interrupts.
1946 * 1936 *
1947 */ 1937 */
1948 if (smpl_buf_vaddr) pfm_remove_smpl_mapping(current, smpl_buf_vaddr, smpl_buf_size); 1938 if (smpl_buf_vaddr) pfm_remove_smpl_mapping(smpl_buf_vaddr, smpl_buf_size);
1949 1939
1950 return 0; 1940 return 0;
1951} 1941}
diff --git a/arch/m68k/configs/m5275evb_defconfig b/arch/m68k/configs/m5275evb_defconfig
index 33c32aeca12b..a1230e82bb1e 100644
--- a/arch/m68k/configs/m5275evb_defconfig
+++ b/arch/m68k/configs/m5275evb_defconfig
@@ -49,7 +49,6 @@ CONFIG_BLK_DEV_RAM=y
49CONFIG_NETDEVICES=y 49CONFIG_NETDEVICES=y
50CONFIG_NET_ETHERNET=y 50CONFIG_NET_ETHERNET=y
51CONFIG_FEC=y 51CONFIG_FEC=y
52CONFIG_FEC2=y
53# CONFIG_NETDEV_1000 is not set 52# CONFIG_NETDEV_1000 is not set
54# CONFIG_NETDEV_10000 is not set 53# CONFIG_NETDEV_10000 is not set
55CONFIG_PPP=y 54CONFIG_PPP=y
diff --git a/arch/m68k/platform/527x/config.c b/arch/m68k/platform/527x/config.c
index 7ed848c3b848..f91a53294c35 100644
--- a/arch/m68k/platform/527x/config.c
+++ b/arch/m68k/platform/527x/config.c
@@ -74,9 +74,7 @@ static void __init m527x_fec_init(void)
74 writew(par | 0xf00, MCF_IPSBAR + 0x100082); 74 writew(par | 0xf00, MCF_IPSBAR + 0x100082);
75 v = readb(MCF_IPSBAR + 0x100078); 75 v = readb(MCF_IPSBAR + 0x100078);
76 writeb(v | 0xc0, MCF_IPSBAR + 0x100078); 76 writeb(v | 0xc0, MCF_IPSBAR + 0x100078);
77#endif
78 77
79#ifdef CONFIG_FEC2
80 /* Set multi-function pins to ethernet mode for fec1 */ 78 /* Set multi-function pins to ethernet mode for fec1 */
81 par = readw(MCF_IPSBAR + 0x100082); 79 par = readw(MCF_IPSBAR + 0x100082);
82 writew(par | 0xa0, MCF_IPSBAR + 0x100082); 80 writew(par | 0xa0, MCF_IPSBAR + 0x100082);
diff --git a/arch/m68k/platform/68EZ328/Makefile b/arch/m68k/platform/68EZ328/Makefile
index ee97735a242c..b44d799b1115 100644
--- a/arch/m68k/platform/68EZ328/Makefile
+++ b/arch/m68k/platform/68EZ328/Makefile
@@ -3,9 +3,3 @@
3# 3#
4 4
5obj-y := config.o 5obj-y := config.o
6
7extra-y := bootlogo.rh
8
9$(obj)/bootlogo.rh: $(src)/bootlogo.h
10 perl $(src)/../68328/bootlogo.pl < $(src)/bootlogo.h \
11 > $(obj)/bootlogo.rh
diff --git a/arch/m68k/platform/68VZ328/Makefile b/arch/m68k/platform/68VZ328/Makefile
index 447ffa0fd7c7..a49d75e65489 100644
--- a/arch/m68k/platform/68VZ328/Makefile
+++ b/arch/m68k/platform/68VZ328/Makefile
@@ -3,14 +3,9 @@
3# 3#
4 4
5obj-y := config.o 5obj-y := config.o
6logo-$(UCDIMM) := bootlogo.rh 6extra-$(DRAGEN2):= screen.h
7logo-$(DRAGEN2) := screen.h
8extra-y := $(logo-y)
9
10$(obj)/bootlogo.rh: $(src)/../68EZ328/bootlogo.h
11 perl $(src)/bootlogo.pl < $(src)/../68328/bootlogo.h > $(obj)/bootlogo.rh
12 7
13$(obj)/screen.h: $(src)/screen.xbm $(src)/xbm2lcd.pl 8$(obj)/screen.h: $(src)/screen.xbm $(src)/xbm2lcd.pl
14 perl $(src)/xbm2lcd.pl < $(src)/screen.xbm > $(obj)/screen.h 9 perl $(src)/xbm2lcd.pl < $(src)/screen.xbm > $(obj)/screen.h
15 10
16clean-files := $(obj)/screen.h $(obj)/bootlogo.rh 11clean-files := $(obj)/screen.h
diff --git a/arch/m68k/platform/68EZ328/bootlogo.h b/arch/m68k/platform/68VZ328/bootlogo.h
index e842bdae5839..b38e2b255142 100644
--- a/arch/m68k/platform/68EZ328/bootlogo.h
+++ b/arch/m68k/platform/68VZ328/bootlogo.h
@@ -1,6 +1,6 @@
1#define splash_width 640 1#define splash_width 640
2#define splash_height 480 2#define splash_height 480
3static unsigned char splash_bits[] = { 3unsigned char __attribute__ ((aligned(16))) bootlogo_bits[] = {
4 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 4 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
5 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 5 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
6 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 6 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
diff --git a/arch/m68k/platform/coldfire/device.c b/arch/m68k/platform/coldfire/device.c
index fa50c48292ff..7af97362b95c 100644
--- a/arch/m68k/platform/coldfire/device.c
+++ b/arch/m68k/platform/coldfire/device.c
@@ -114,7 +114,7 @@ static struct resource mcf_fec1_resources[] = {
114 114
115static struct platform_device mcf_fec1 = { 115static struct platform_device mcf_fec1 = {
116 .name = "fec", 116 .name = "fec",
117 .id = 0, 117 .id = 1,
118 .num_resources = ARRAY_SIZE(mcf_fec1_resources), 118 .num_resources = ARRAY_SIZE(mcf_fec1_resources),
119 .resource = mcf_fec1_resources, 119 .resource = mcf_fec1_resources,
120}; 120};
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index 2b7c0fbe578e..9015060919a0 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -90,7 +90,6 @@ config S390
90 select HAVE_KERNEL_XZ 90 select HAVE_KERNEL_XZ
91 select HAVE_ARCH_MUTEX_CPU_RELAX 91 select HAVE_ARCH_MUTEX_CPU_RELAX
92 select HAVE_ARCH_JUMP_LABEL if !MARCH_G5 92 select HAVE_ARCH_JUMP_LABEL if !MARCH_G5
93 select HAVE_RCU_TABLE_FREE if SMP
94 select ARCH_SAVE_PAGE_KEYS if HIBERNATION 93 select ARCH_SAVE_PAGE_KEYS if HIBERNATION
95 select HAVE_MEMBLOCK 94 select HAVE_MEMBLOCK
96 select HAVE_MEMBLOCK_NODE_MAP 95 select HAVE_MEMBLOCK_NODE_MAP
diff --git a/arch/s390/defconfig b/arch/s390/defconfig
index 6cf8e26b3137..1957a9dd256d 100644
--- a/arch/s390/defconfig
+++ b/arch/s390/defconfig
@@ -1,8 +1,12 @@
1CONFIG_EXPERIMENTAL=y 1CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y 2CONFIG_SYSVIPC=y
3CONFIG_POSIX_MQUEUE=y 3CONFIG_POSIX_MQUEUE=y
4CONFIG_FHANDLE=y
5CONFIG_TASKSTATS=y
6CONFIG_TASK_DELAY_ACCT=y
7CONFIG_TASK_XACCT=y
8CONFIG_TASK_IO_ACCOUNTING=y
4CONFIG_AUDIT=y 9CONFIG_AUDIT=y
5CONFIG_RCU_TRACE=y
6CONFIG_IKCONFIG=y 10CONFIG_IKCONFIG=y
7CONFIG_IKCONFIG_PROC=y 11CONFIG_IKCONFIG_PROC=y
8CONFIG_CGROUPS=y 12CONFIG_CGROUPS=y
@@ -14,16 +18,22 @@ CONFIG_CGROUP_MEM_RES_CTLR_SWAP=y
14CONFIG_CGROUP_SCHED=y 18CONFIG_CGROUP_SCHED=y
15CONFIG_RT_GROUP_SCHED=y 19CONFIG_RT_GROUP_SCHED=y
16CONFIG_BLK_CGROUP=y 20CONFIG_BLK_CGROUP=y
21CONFIG_NAMESPACES=y
17CONFIG_BLK_DEV_INITRD=y 22CONFIG_BLK_DEV_INITRD=y
18# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 23CONFIG_RD_BZIP2=y
24CONFIG_RD_LZMA=y
25CONFIG_RD_XZ=y
26CONFIG_RD_LZO=y
27CONFIG_EXPERT=y
19# CONFIG_COMPAT_BRK is not set 28# CONFIG_COMPAT_BRK is not set
20CONFIG_SLAB=y
21CONFIG_PROFILING=y 29CONFIG_PROFILING=y
22CONFIG_OPROFILE=y 30CONFIG_OPROFILE=y
23CONFIG_KPROBES=y 31CONFIG_KPROBES=y
24CONFIG_MODULES=y 32CONFIG_MODULES=y
25CONFIG_MODULE_UNLOAD=y 33CONFIG_MODULE_UNLOAD=y
26CONFIG_MODVERSIONS=y 34CONFIG_MODVERSIONS=y
35CONFIG_PARTITION_ADVANCED=y
36CONFIG_IBM_PARTITION=y
27CONFIG_DEFAULT_DEADLINE=y 37CONFIG_DEFAULT_DEADLINE=y
28CONFIG_NO_HZ=y 38CONFIG_NO_HZ=y
29CONFIG_HIGH_RES_TIMERS=y 39CONFIG_HIGH_RES_TIMERS=y
@@ -34,18 +44,15 @@ CONFIG_KSM=y
34CONFIG_BINFMT_MISC=m 44CONFIG_BINFMT_MISC=m
35CONFIG_CMM=m 45CONFIG_CMM=m
36CONFIG_HZ_100=y 46CONFIG_HZ_100=y
37CONFIG_KEXEC=y 47CONFIG_CRASH_DUMP=y
38CONFIG_PM=y
39CONFIG_HIBERNATION=y 48CONFIG_HIBERNATION=y
40CONFIG_PACKET=y 49CONFIG_PACKET=y
41CONFIG_UNIX=y 50CONFIG_UNIX=y
42CONFIG_NET_KEY=y 51CONFIG_NET_KEY=y
43CONFIG_AFIUCV=m
44CONFIG_INET=y 52CONFIG_INET=y
45CONFIG_IP_MULTICAST=y 53CONFIG_IP_MULTICAST=y
46# CONFIG_INET_LRO is not set 54# CONFIG_INET_LRO is not set
47CONFIG_IPV6=y 55CONFIG_IPV6=y
48CONFIG_NET_SCTPPROBE=m
49CONFIG_L2TP=m 56CONFIG_L2TP=m
50CONFIG_L2TP_DEBUGFS=m 57CONFIG_L2TP_DEBUGFS=m
51CONFIG_VLAN_8021Q=y 58CONFIG_VLAN_8021Q=y
@@ -84,15 +91,14 @@ CONFIG_SCSI_CONSTANTS=y
84CONFIG_SCSI_LOGGING=y 91CONFIG_SCSI_LOGGING=y
85CONFIG_SCSI_SCAN_ASYNC=y 92CONFIG_SCSI_SCAN_ASYNC=y
86CONFIG_ZFCP=y 93CONFIG_ZFCP=y
87CONFIG_ZFCP_DIF=y
88CONFIG_NETDEVICES=y 94CONFIG_NETDEVICES=y
89CONFIG_DUMMY=m
90CONFIG_BONDING=m 95CONFIG_BONDING=m
96CONFIG_DUMMY=m
91CONFIG_EQUALIZER=m 97CONFIG_EQUALIZER=m
92CONFIG_TUN=m 98CONFIG_TUN=m
93CONFIG_NET_ETHERNET=y
94CONFIG_VIRTIO_NET=y 99CONFIG_VIRTIO_NET=y
95CONFIG_RAW_DRIVER=m 100CONFIG_RAW_DRIVER=m
101CONFIG_VIRTIO_BALLOON=y
96CONFIG_EXT2_FS=y 102CONFIG_EXT2_FS=y
97CONFIG_EXT3_FS=y 103CONFIG_EXT3_FS=y
98# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set 104# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
@@ -103,27 +109,21 @@ CONFIG_PROC_KCORE=y
103CONFIG_TMPFS=y 109CONFIG_TMPFS=y
104CONFIG_TMPFS_POSIX_ACL=y 110CONFIG_TMPFS_POSIX_ACL=y
105# CONFIG_NETWORK_FILESYSTEMS is not set 111# CONFIG_NETWORK_FILESYSTEMS is not set
106CONFIG_PARTITION_ADVANCED=y
107CONFIG_IBM_PARTITION=y
108CONFIG_DLM=m
109CONFIG_MAGIC_SYSRQ=y 112CONFIG_MAGIC_SYSRQ=y
110CONFIG_DEBUG_KERNEL=y
111CONFIG_TIMER_STATS=y 113CONFIG_TIMER_STATS=y
112CONFIG_PROVE_LOCKING=y 114CONFIG_PROVE_LOCKING=y
113CONFIG_PROVE_RCU=y 115CONFIG_PROVE_RCU=y
114CONFIG_LOCK_STAT=y 116CONFIG_LOCK_STAT=y
115CONFIG_DEBUG_LOCKDEP=y 117CONFIG_DEBUG_LOCKDEP=y
116CONFIG_DEBUG_SPINLOCK_SLEEP=y
117CONFIG_DEBUG_LIST=y 118CONFIG_DEBUG_LIST=y
118CONFIG_DEBUG_NOTIFIERS=y 119CONFIG_DEBUG_NOTIFIERS=y
119# CONFIG_RCU_CPU_STALL_DETECTOR is not set 120CONFIG_RCU_TRACE=y
120CONFIG_KPROBES_SANITY_TEST=y 121CONFIG_KPROBES_SANITY_TEST=y
121CONFIG_DEBUG_FORCE_WEAK_PER_CPU=y 122CONFIG_DEBUG_FORCE_WEAK_PER_CPU=y
122CONFIG_CPU_NOTIFIER_ERROR_INJECT=m 123CONFIG_CPU_NOTIFIER_ERROR_INJECT=m
123CONFIG_LATENCYTOP=y 124CONFIG_LATENCYTOP=y
124CONFIG_SYSCTL_SYSCALL_CHECK=y
125CONFIG_DEBUG_PAGEALLOC=y 125CONFIG_DEBUG_PAGEALLOC=y
126# CONFIG_FTRACE is not set 126CONFIG_BLK_DEV_IO_TRACE=y
127# CONFIG_STRICT_DEVMEM is not set 127# CONFIG_STRICT_DEVMEM is not set
128CONFIG_CRYPTO_NULL=m 128CONFIG_CRYPTO_NULL=m
129CONFIG_CRYPTO_CRYPTD=m 129CONFIG_CRYPTO_CRYPTD=m
@@ -173,4 +173,3 @@ CONFIG_CRYPTO_SHA512_S390=m
173CONFIG_CRYPTO_DES_S390=m 173CONFIG_CRYPTO_DES_S390=m
174CONFIG_CRYPTO_AES_S390=m 174CONFIG_CRYPTO_AES_S390=m
175CONFIG_CRC7=m 175CONFIG_CRC7=m
176CONFIG_VIRTIO_BALLOON=y
diff --git a/arch/s390/include/asm/facility.h b/arch/s390/include/asm/facility.h
index 1e5b27edc0c9..2ee66a65f2d4 100644
--- a/arch/s390/include/asm/facility.h
+++ b/arch/s390/include/asm/facility.h
@@ -38,12 +38,11 @@ static inline void stfle(u64 *stfle_fac_list, int size)
38 unsigned long nr; 38 unsigned long nr;
39 39
40 preempt_disable(); 40 preempt_disable();
41 S390_lowcore.stfl_fac_list = 0;
42 asm volatile( 41 asm volatile(
43 " .insn s,0xb2b10000,0(0)\n" /* stfl */ 42 " .insn s,0xb2b10000,0(0)\n" /* stfl */
44 "0:\n" 43 "0:\n"
45 EX_TABLE(0b, 0b) 44 EX_TABLE(0b, 0b)
46 : "=m" (S390_lowcore.stfl_fac_list)); 45 : "+m" (S390_lowcore.stfl_fac_list));
47 nr = 4; /* bytes stored by stfl */ 46 nr = 4; /* bytes stored by stfl */
48 memcpy(stfle_fac_list, &S390_lowcore.stfl_fac_list, 4); 47 memcpy(stfle_fac_list, &S390_lowcore.stfl_fac_list, 4);
49 if (S390_lowcore.stfl_fac_list & 0x01000000) { 48 if (S390_lowcore.stfl_fac_list & 0x01000000) {
diff --git a/arch/s390/include/asm/pgalloc.h b/arch/s390/include/asm/pgalloc.h
index 8eef9b5b3cf4..78e3041919de 100644
--- a/arch/s390/include/asm/pgalloc.h
+++ b/arch/s390/include/asm/pgalloc.h
@@ -22,10 +22,7 @@ void crst_table_free(struct mm_struct *, unsigned long *);
22 22
23unsigned long *page_table_alloc(struct mm_struct *, unsigned long); 23unsigned long *page_table_alloc(struct mm_struct *, unsigned long);
24void page_table_free(struct mm_struct *, unsigned long *); 24void page_table_free(struct mm_struct *, unsigned long *);
25#ifdef CONFIG_HAVE_RCU_TABLE_FREE
26void page_table_free_rcu(struct mmu_gather *, unsigned long *); 25void page_table_free_rcu(struct mmu_gather *, unsigned long *);
27void __tlb_remove_table(void *_table);
28#endif
29 26
30static inline void clear_table(unsigned long *s, unsigned long val, size_t n) 27static inline void clear_table(unsigned long *s, unsigned long val, size_t n)
31{ 28{
diff --git a/arch/s390/include/asm/swab.h b/arch/s390/include/asm/swab.h
index 6bdee21c077e..a3e4ebb32090 100644
--- a/arch/s390/include/asm/swab.h
+++ b/arch/s390/include/asm/swab.h
@@ -77,7 +77,7 @@ static inline __u16 __arch_swab16p(const __u16 *x)
77 77
78 asm volatile( 78 asm volatile(
79#ifndef __s390x__ 79#ifndef __s390x__
80 " icm %0,2,%O+1(%R1)\n" 80 " icm %0,2,%O1+1(%R1)\n"
81 " ic %0,%1\n" 81 " ic %0,%1\n"
82 : "=&d" (result) : "Q" (*x) : "cc"); 82 : "=&d" (result) : "Q" (*x) : "cc");
83#else /* __s390x__ */ 83#else /* __s390x__ */
diff --git a/arch/s390/include/asm/tlb.h b/arch/s390/include/asm/tlb.h
index c687a2c83462..775a5eea8f9e 100644
--- a/arch/s390/include/asm/tlb.h
+++ b/arch/s390/include/asm/tlb.h
@@ -30,14 +30,10 @@
30 30
31struct mmu_gather { 31struct mmu_gather {
32 struct mm_struct *mm; 32 struct mm_struct *mm;
33#ifdef CONFIG_HAVE_RCU_TABLE_FREE
34 struct mmu_table_batch *batch; 33 struct mmu_table_batch *batch;
35#endif
36 unsigned int fullmm; 34 unsigned int fullmm;
37 unsigned int need_flush;
38}; 35};
39 36
40#ifdef CONFIG_HAVE_RCU_TABLE_FREE
41struct mmu_table_batch { 37struct mmu_table_batch {
42 struct rcu_head rcu; 38 struct rcu_head rcu;
43 unsigned int nr; 39 unsigned int nr;
@@ -49,7 +45,6 @@ struct mmu_table_batch {
49 45
50extern void tlb_table_flush(struct mmu_gather *tlb); 46extern void tlb_table_flush(struct mmu_gather *tlb);
51extern void tlb_remove_table(struct mmu_gather *tlb, void *table); 47extern void tlb_remove_table(struct mmu_gather *tlb, void *table);
52#endif
53 48
54static inline void tlb_gather_mmu(struct mmu_gather *tlb, 49static inline void tlb_gather_mmu(struct mmu_gather *tlb,
55 struct mm_struct *mm, 50 struct mm_struct *mm,
@@ -57,29 +52,20 @@ static inline void tlb_gather_mmu(struct mmu_gather *tlb,
57{ 52{
58 tlb->mm = mm; 53 tlb->mm = mm;
59 tlb->fullmm = full_mm_flush; 54 tlb->fullmm = full_mm_flush;
60 tlb->need_flush = 0;
61#ifdef CONFIG_HAVE_RCU_TABLE_FREE
62 tlb->batch = NULL; 55 tlb->batch = NULL;
63#endif
64 if (tlb->fullmm) 56 if (tlb->fullmm)
65 __tlb_flush_mm(mm); 57 __tlb_flush_mm(mm);
66} 58}
67 59
68static inline void tlb_flush_mmu(struct mmu_gather *tlb) 60static inline void tlb_flush_mmu(struct mmu_gather *tlb)
69{ 61{
70 if (!tlb->need_flush)
71 return;
72 tlb->need_flush = 0;
73 __tlb_flush_mm(tlb->mm);
74#ifdef CONFIG_HAVE_RCU_TABLE_FREE
75 tlb_table_flush(tlb); 62 tlb_table_flush(tlb);
76#endif
77} 63}
78 64
79static inline void tlb_finish_mmu(struct mmu_gather *tlb, 65static inline void tlb_finish_mmu(struct mmu_gather *tlb,
80 unsigned long start, unsigned long end) 66 unsigned long start, unsigned long end)
81{ 67{
82 tlb_flush_mmu(tlb); 68 tlb_table_flush(tlb);
83} 69}
84 70
85/* 71/*
@@ -105,10 +91,8 @@ static inline void tlb_remove_page(struct mmu_gather *tlb, struct page *page)
105static inline void pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte, 91static inline void pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte,
106 unsigned long address) 92 unsigned long address)
107{ 93{
108#ifdef CONFIG_HAVE_RCU_TABLE_FREE
109 if (!tlb->fullmm) 94 if (!tlb->fullmm)
110 return page_table_free_rcu(tlb, (unsigned long *) pte); 95 return page_table_free_rcu(tlb, (unsigned long *) pte);
111#endif
112 page_table_free(tlb->mm, (unsigned long *) pte); 96 page_table_free(tlb->mm, (unsigned long *) pte);
113} 97}
114 98
@@ -125,10 +109,8 @@ static inline void pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd,
125#ifdef __s390x__ 109#ifdef __s390x__
126 if (tlb->mm->context.asce_limit <= (1UL << 31)) 110 if (tlb->mm->context.asce_limit <= (1UL << 31))
127 return; 111 return;
128#ifdef CONFIG_HAVE_RCU_TABLE_FREE
129 if (!tlb->fullmm) 112 if (!tlb->fullmm)
130 return tlb_remove_table(tlb, pmd); 113 return tlb_remove_table(tlb, pmd);
131#endif
132 crst_table_free(tlb->mm, (unsigned long *) pmd); 114 crst_table_free(tlb->mm, (unsigned long *) pmd);
133#endif 115#endif
134} 116}
@@ -146,10 +128,8 @@ static inline void pud_free_tlb(struct mmu_gather *tlb, pud_t *pud,
146#ifdef __s390x__ 128#ifdef __s390x__
147 if (tlb->mm->context.asce_limit <= (1UL << 42)) 129 if (tlb->mm->context.asce_limit <= (1UL << 42))
148 return; 130 return;
149#ifdef CONFIG_HAVE_RCU_TABLE_FREE
150 if (!tlb->fullmm) 131 if (!tlb->fullmm)
151 return tlb_remove_table(tlb, pud); 132 return tlb_remove_table(tlb, pud);
152#endif
153 crst_table_free(tlb->mm, (unsigned long *) pud); 133 crst_table_free(tlb->mm, (unsigned long *) pud);
154#endif 134#endif
155} 135}
diff --git a/arch/s390/kernel/head.S b/arch/s390/kernel/head.S
index c27a0727f930..adccd908ebc7 100644
--- a/arch/s390/kernel/head.S
+++ b/arch/s390/kernel/head.S
@@ -474,9 +474,9 @@ ENTRY(startup_kdump)
474 stck __LC_LAST_UPDATE_CLOCK 474 stck __LC_LAST_UPDATE_CLOCK
475 spt 5f-.LPG0(%r13) 475 spt 5f-.LPG0(%r13)
476 mvc __LC_LAST_UPDATE_TIMER(8),5f-.LPG0(%r13) 476 mvc __LC_LAST_UPDATE_TIMER(8),5f-.LPG0(%r13)
477 xc __LC_STFL_FAC_LIST(8),__LC_STFL_FAC_LIST
477#ifndef CONFIG_MARCH_G5 478#ifndef CONFIG_MARCH_G5
478 # check capabilities against MARCH_{G5,Z900,Z990,Z9_109,Z10} 479 # check capabilities against MARCH_{G5,Z900,Z990,Z9_109,Z10}
479 xc __LC_STFL_FAC_LIST(8),__LC_STFL_FAC_LIST
480 .insn s,0xb2b10000,__LC_STFL_FAC_LIST # store facility list 480 .insn s,0xb2b10000,__LC_STFL_FAC_LIST # store facility list
481 tm __LC_STFL_FAC_LIST,0x01 # stfle available ? 481 tm __LC_STFL_FAC_LIST,0x01 # stfle available ?
482 jz 0f 482 jz 0f
diff --git a/arch/s390/kernel/irq.c b/arch/s390/kernel/irq.c
index 1c2cdd59ccd0..8a22c27219dd 100644
--- a/arch/s390/kernel/irq.c
+++ b/arch/s390/kernel/irq.c
@@ -118,9 +118,10 @@ asmlinkage void do_softirq(void)
118 "a" (__do_softirq) 118 "a" (__do_softirq)
119 : "0", "1", "2", "3", "4", "5", "14", 119 : "0", "1", "2", "3", "4", "5", "14",
120 "cc", "memory" ); 120 "cc", "memory" );
121 } else 121 } else {
122 /* We are already on the async stack. */ 122 /* We are already on the async stack. */
123 __do_softirq(); 123 __do_softirq();
124 }
124 } 125 }
125 126
126 local_irq_restore(flags); 127 local_irq_restore(flags);
@@ -192,11 +193,12 @@ int unregister_external_interrupt(u16 code, ext_int_handler_t handler)
192 int index = ext_hash(code); 193 int index = ext_hash(code);
193 194
194 spin_lock_irqsave(&ext_int_hash_lock, flags); 195 spin_lock_irqsave(&ext_int_hash_lock, flags);
195 list_for_each_entry_rcu(p, &ext_int_hash[index], entry) 196 list_for_each_entry_rcu(p, &ext_int_hash[index], entry) {
196 if (p->code == code && p->handler == handler) { 197 if (p->code == code && p->handler == handler) {
197 list_del_rcu(&p->entry); 198 list_del_rcu(&p->entry);
198 kfree_rcu(p, rcu); 199 kfree_rcu(p, rcu);
199 } 200 }
201 }
200 spin_unlock_irqrestore(&ext_int_hash_lock, flags); 202 spin_unlock_irqrestore(&ext_int_hash_lock, flags);
201 return 0; 203 return 0;
202} 204}
@@ -211,9 +213,10 @@ void __irq_entry do_extint(struct pt_regs *regs, struct ext_code ext_code,
211 213
212 old_regs = set_irq_regs(regs); 214 old_regs = set_irq_regs(regs);
213 irq_enter(); 215 irq_enter();
214 if (S390_lowcore.int_clock >= S390_lowcore.clock_comparator) 216 if (S390_lowcore.int_clock >= S390_lowcore.clock_comparator) {
215 /* Serve timer interrupts first. */ 217 /* Serve timer interrupts first. */
216 clock_comparator_work(); 218 clock_comparator_work();
219 }
217 kstat_cpu(smp_processor_id()).irqs[EXTERNAL_INTERRUPT]++; 220 kstat_cpu(smp_processor_id()).irqs[EXTERNAL_INTERRUPT]++;
218 if (ext_code.code != 0x1004) 221 if (ext_code.code != 0x1004)
219 __get_cpu_var(s390_idle).nohz_delay = 1; 222 __get_cpu_var(s390_idle).nohz_delay = 1;
diff --git a/arch/s390/kernel/perf_cpum_cf.c b/arch/s390/kernel/perf_cpum_cf.c
index 46405086479c..cb019f429e88 100644
--- a/arch/s390/kernel/perf_cpum_cf.c
+++ b/arch/s390/kernel/perf_cpum_cf.c
@@ -178,7 +178,7 @@ static void cpumf_pmu_enable(struct pmu *pmu)
178 err = lcctl(cpuhw->state); 178 err = lcctl(cpuhw->state);
179 if (err) { 179 if (err) {
180 pr_err("Enabling the performance measuring unit " 180 pr_err("Enabling the performance measuring unit "
181 "failed with rc=%lx\n", err); 181 "failed with rc=%x\n", err);
182 return; 182 return;
183 } 183 }
184 184
@@ -203,7 +203,7 @@ static void cpumf_pmu_disable(struct pmu *pmu)
203 err = lcctl(inactive); 203 err = lcctl(inactive);
204 if (err) { 204 if (err) {
205 pr_err("Disabling the performance measuring unit " 205 pr_err("Disabling the performance measuring unit "
206 "failed with rc=%lx\n", err); 206 "failed with rc=%x\n", err);
207 return; 207 return;
208 } 208 }
209 209
diff --git a/arch/s390/mm/maccess.c b/arch/s390/mm/maccess.c
index 7bb15fcca75e..e1335dc2b1b7 100644
--- a/arch/s390/mm/maccess.c
+++ b/arch/s390/mm/maccess.c
@@ -61,21 +61,14 @@ long probe_kernel_write(void *dst, const void *src, size_t size)
61 return copied < 0 ? -EFAULT : 0; 61 return copied < 0 ? -EFAULT : 0;
62} 62}
63 63
64/* 64static int __memcpy_real(void *dest, void *src, size_t count)
65 * Copy memory in real mode (kernel to kernel)
66 */
67int memcpy_real(void *dest, void *src, size_t count)
68{ 65{
69 register unsigned long _dest asm("2") = (unsigned long) dest; 66 register unsigned long _dest asm("2") = (unsigned long) dest;
70 register unsigned long _len1 asm("3") = (unsigned long) count; 67 register unsigned long _len1 asm("3") = (unsigned long) count;
71 register unsigned long _src asm("4") = (unsigned long) src; 68 register unsigned long _src asm("4") = (unsigned long) src;
72 register unsigned long _len2 asm("5") = (unsigned long) count; 69 register unsigned long _len2 asm("5") = (unsigned long) count;
73 unsigned long flags;
74 int rc = -EFAULT; 70 int rc = -EFAULT;
75 71
76 if (!count)
77 return 0;
78 flags = __arch_local_irq_stnsm(0xf8UL);
79 asm volatile ( 72 asm volatile (
80 "0: mvcle %1,%2,0x0\n" 73 "0: mvcle %1,%2,0x0\n"
81 "1: jo 0b\n" 74 "1: jo 0b\n"
@@ -86,7 +79,23 @@ int memcpy_real(void *dest, void *src, size_t count)
86 "+d" (_len2), "=m" (*((long *) dest)) 79 "+d" (_len2), "=m" (*((long *) dest))
87 : "m" (*((long *) src)) 80 : "m" (*((long *) src))
88 : "cc", "memory"); 81 : "cc", "memory");
89 arch_local_irq_restore(flags); 82 return rc;
83}
84
85/*
86 * Copy memory in real mode (kernel to kernel)
87 */
88int memcpy_real(void *dest, void *src, size_t count)
89{
90 unsigned long flags;
91 int rc;
92
93 if (!count)
94 return 0;
95 local_irq_save(flags);
96 __arch_local_irq_stnsm(0xfbUL);
97 rc = __memcpy_real(dest, src, count);
98 local_irq_restore(flags);
90 return rc; 99 return rc;
91} 100}
92 101
diff --git a/arch/s390/mm/pgtable.c b/arch/s390/mm/pgtable.c
index 373adf69b01c..6e765bf00670 100644
--- a/arch/s390/mm/pgtable.c
+++ b/arch/s390/mm/pgtable.c
@@ -678,8 +678,6 @@ void page_table_free(struct mm_struct *mm, unsigned long *table)
678 } 678 }
679} 679}
680 680
681#ifdef CONFIG_HAVE_RCU_TABLE_FREE
682
683static void __page_table_free_rcu(void *table, unsigned bit) 681static void __page_table_free_rcu(void *table, unsigned bit)
684{ 682{
685 struct page *page; 683 struct page *page;
@@ -733,7 +731,66 @@ void __tlb_remove_table(void *_table)
733 free_pages((unsigned long) table, ALLOC_ORDER); 731 free_pages((unsigned long) table, ALLOC_ORDER);
734} 732}
735 733
736#endif 734static void tlb_remove_table_smp_sync(void *arg)
735{
736 /* Simply deliver the interrupt */
737}
738
739static void tlb_remove_table_one(void *table)
740{
741 /*
742 * This isn't an RCU grace period and hence the page-tables cannot be
743 * assumed to be actually RCU-freed.
744 *
745 * It is however sufficient for software page-table walkers that rely
746 * on IRQ disabling. See the comment near struct mmu_table_batch.
747 */
748 smp_call_function(tlb_remove_table_smp_sync, NULL, 1);
749 __tlb_remove_table(table);
750}
751
752static void tlb_remove_table_rcu(struct rcu_head *head)
753{
754 struct mmu_table_batch *batch;
755 int i;
756
757 batch = container_of(head, struct mmu_table_batch, rcu);
758
759 for (i = 0; i < batch->nr; i++)
760 __tlb_remove_table(batch->tables[i]);
761
762 free_page((unsigned long)batch);
763}
764
765void tlb_table_flush(struct mmu_gather *tlb)
766{
767 struct mmu_table_batch **batch = &tlb->batch;
768
769 if (*batch) {
770 __tlb_flush_mm(tlb->mm);
771 call_rcu_sched(&(*batch)->rcu, tlb_remove_table_rcu);
772 *batch = NULL;
773 }
774}
775
776void tlb_remove_table(struct mmu_gather *tlb, void *table)
777{
778 struct mmu_table_batch **batch = &tlb->batch;
779
780 if (*batch == NULL) {
781 *batch = (struct mmu_table_batch *)
782 __get_free_page(GFP_NOWAIT | __GFP_NOWARN);
783 if (*batch == NULL) {
784 __tlb_flush_mm(tlb->mm);
785 tlb_remove_table_one(table);
786 return;
787 }
788 (*batch)->nr = 0;
789 }
790 (*batch)->tables[(*batch)->nr++] = table;
791 if ((*batch)->nr == MAX_TABLE_BATCH)
792 tlb_table_flush(tlb);
793}
737 794
738/* 795/*
739 * switch on pgstes for its userspace process (for kvm) 796 * switch on pgstes for its userspace process (for kvm)
diff --git a/arch/sparc/kernel/leon_smp.c b/arch/sparc/kernel/leon_smp.c
index 1210fde18740..160cac9c4036 100644
--- a/arch/sparc/kernel/leon_smp.c
+++ b/arch/sparc/kernel/leon_smp.c
@@ -23,6 +23,7 @@
23#include <linux/pm.h> 23#include <linux/pm.h>
24#include <linux/delay.h> 24#include <linux/delay.h>
25#include <linux/gfp.h> 25#include <linux/gfp.h>
26#include <linux/cpu.h>
26 27
27#include <asm/cacheflush.h> 28#include <asm/cacheflush.h>
28#include <asm/tlbflush.h> 29#include <asm/tlbflush.h>
@@ -78,6 +79,8 @@ void __cpuinit leon_callin(void)
78 local_flush_tlb_all(); 79 local_flush_tlb_all();
79 leon_configure_cache_smp(); 80 leon_configure_cache_smp();
80 81
82 notify_cpu_starting(cpuid);
83
81 /* Get our local ticker going. */ 84 /* Get our local ticker going. */
82 smp_setup_percpu_timer(); 85 smp_setup_percpu_timer();
83 86
diff --git a/arch/sparc/kernel/sys_sparc_64.c b/arch/sparc/kernel/sys_sparc_64.c
index 232df9949530..3ee51f189a55 100644
--- a/arch/sparc/kernel/sys_sparc_64.c
+++ b/arch/sparc/kernel/sys_sparc_64.c
@@ -566,15 +566,10 @@ out:
566 566
567SYSCALL_DEFINE2(64_munmap, unsigned long, addr, size_t, len) 567SYSCALL_DEFINE2(64_munmap, unsigned long, addr, size_t, len)
568{ 568{
569 long ret;
570
571 if (invalid_64bit_range(addr, len)) 569 if (invalid_64bit_range(addr, len))
572 return -EINVAL; 570 return -EINVAL;
573 571
574 down_write(&current->mm->mmap_sem); 572 return vm_munmap(addr, len);
575 ret = do_munmap(current->mm, addr, len);
576 up_write(&current->mm->mmap_sem);
577 return ret;
578} 573}
579 574
580extern unsigned long do_mremap(unsigned long addr, 575extern unsigned long do_mremap(unsigned long addr,
diff --git a/arch/tile/kernel/single_step.c b/arch/tile/kernel/single_step.c
index 9efbc1391b3c..89529c9f0605 100644
--- a/arch/tile/kernel/single_step.c
+++ b/arch/tile/kernel/single_step.c
@@ -346,12 +346,10 @@ void single_step_once(struct pt_regs *regs)
346 } 346 }
347 347
348 /* allocate a cache line of writable, executable memory */ 348 /* allocate a cache line of writable, executable memory */
349 down_write(&current->mm->mmap_sem); 349 buffer = (void __user *) vm_mmap(NULL, 0, 64,
350 buffer = (void __user *) do_mmap(NULL, 0, 64,
351 PROT_EXEC | PROT_READ | PROT_WRITE, 350 PROT_EXEC | PROT_READ | PROT_WRITE,
352 MAP_PRIVATE | MAP_ANONYMOUS, 351 MAP_PRIVATE | MAP_ANONYMOUS,
353 0); 352 0);
354 up_write(&current->mm->mmap_sem);
355 353
356 if (IS_ERR((void __force *)buffer)) { 354 if (IS_ERR((void __force *)buffer)) {
357 kfree(state); 355 kfree(state);
diff --git a/arch/x86/ia32/ia32_aout.c b/arch/x86/ia32/ia32_aout.c
index d511d951a052..4824fb45560f 100644
--- a/arch/x86/ia32/ia32_aout.c
+++ b/arch/x86/ia32/ia32_aout.c
@@ -119,9 +119,7 @@ static void set_brk(unsigned long start, unsigned long end)
119 end = PAGE_ALIGN(end); 119 end = PAGE_ALIGN(end);
120 if (end <= start) 120 if (end <= start)
121 return; 121 return;
122 down_write(&current->mm->mmap_sem); 122 vm_brk(start, end - start);
123 do_brk(start, end - start);
124 up_write(&current->mm->mmap_sem);
125} 123}
126 124
127#ifdef CORE_DUMP 125#ifdef CORE_DUMP
@@ -332,9 +330,7 @@ static int load_aout_binary(struct linux_binprm *bprm, struct pt_regs *regs)
332 pos = 32; 330 pos = 32;
333 map_size = ex.a_text+ex.a_data; 331 map_size = ex.a_text+ex.a_data;
334 332
335 down_write(&current->mm->mmap_sem); 333 error = vm_brk(text_addr & PAGE_MASK, map_size);
336 error = do_brk(text_addr & PAGE_MASK, map_size);
337 up_write(&current->mm->mmap_sem);
338 334
339 if (error != (text_addr & PAGE_MASK)) { 335 if (error != (text_addr & PAGE_MASK)) {
340 send_sig(SIGKILL, current, 0); 336 send_sig(SIGKILL, current, 0);
@@ -373,9 +369,7 @@ static int load_aout_binary(struct linux_binprm *bprm, struct pt_regs *regs)
373 if (!bprm->file->f_op->mmap || (fd_offset & ~PAGE_MASK) != 0) { 369 if (!bprm->file->f_op->mmap || (fd_offset & ~PAGE_MASK) != 0) {
374 loff_t pos = fd_offset; 370 loff_t pos = fd_offset;
375 371
376 down_write(&current->mm->mmap_sem); 372 vm_brk(N_TXTADDR(ex), ex.a_text+ex.a_data);
377 do_brk(N_TXTADDR(ex), ex.a_text+ex.a_data);
378 up_write(&current->mm->mmap_sem);
379 bprm->file->f_op->read(bprm->file, 373 bprm->file->f_op->read(bprm->file,
380 (char __user *)N_TXTADDR(ex), 374 (char __user *)N_TXTADDR(ex),
381 ex.a_text+ex.a_data, &pos); 375 ex.a_text+ex.a_data, &pos);
@@ -385,26 +379,22 @@ static int load_aout_binary(struct linux_binprm *bprm, struct pt_regs *regs)
385 goto beyond_if; 379 goto beyond_if;
386 } 380 }
387 381
388 down_write(&current->mm->mmap_sem); 382 error = vm_mmap(bprm->file, N_TXTADDR(ex), ex.a_text,
389 error = do_mmap(bprm->file, N_TXTADDR(ex), ex.a_text,
390 PROT_READ | PROT_EXEC, 383 PROT_READ | PROT_EXEC,
391 MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | 384 MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE |
392 MAP_EXECUTABLE | MAP_32BIT, 385 MAP_EXECUTABLE | MAP_32BIT,
393 fd_offset); 386 fd_offset);
394 up_write(&current->mm->mmap_sem);
395 387
396 if (error != N_TXTADDR(ex)) { 388 if (error != N_TXTADDR(ex)) {
397 send_sig(SIGKILL, current, 0); 389 send_sig(SIGKILL, current, 0);
398 return error; 390 return error;
399 } 391 }
400 392
401 down_write(&current->mm->mmap_sem); 393 error = vm_mmap(bprm->file, N_DATADDR(ex), ex.a_data,
402 error = do_mmap(bprm->file, N_DATADDR(ex), ex.a_data,
403 PROT_READ | PROT_WRITE | PROT_EXEC, 394 PROT_READ | PROT_WRITE | PROT_EXEC,
404 MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | 395 MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE |
405 MAP_EXECUTABLE | MAP_32BIT, 396 MAP_EXECUTABLE | MAP_32BIT,
406 fd_offset + ex.a_text); 397 fd_offset + ex.a_text);
407 up_write(&current->mm->mmap_sem);
408 if (error != N_DATADDR(ex)) { 398 if (error != N_DATADDR(ex)) {
409 send_sig(SIGKILL, current, 0); 399 send_sig(SIGKILL, current, 0);
410 return error; 400 return error;
@@ -476,9 +466,7 @@ static int load_aout_library(struct file *file)
476 error_time = jiffies; 466 error_time = jiffies;
477 } 467 }
478#endif 468#endif
479 down_write(&current->mm->mmap_sem); 469 vm_brk(start_addr, ex.a_text + ex.a_data + ex.a_bss);
480 do_brk(start_addr, ex.a_text + ex.a_data + ex.a_bss);
481 up_write(&current->mm->mmap_sem);
482 470
483 file->f_op->read(file, (char __user *)start_addr, 471 file->f_op->read(file, (char __user *)start_addr,
484 ex.a_text + ex.a_data, &pos); 472 ex.a_text + ex.a_data, &pos);
@@ -490,12 +478,10 @@ static int load_aout_library(struct file *file)
490 goto out; 478 goto out;
491 } 479 }
492 /* Now use mmap to map the library into memory. */ 480 /* Now use mmap to map the library into memory. */
493 down_write(&current->mm->mmap_sem); 481 error = vm_mmap(file, start_addr, ex.a_text + ex.a_data,
494 error = do_mmap(file, start_addr, ex.a_text + ex.a_data,
495 PROT_READ | PROT_WRITE | PROT_EXEC, 482 PROT_READ | PROT_WRITE | PROT_EXEC,
496 MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | MAP_32BIT, 483 MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | MAP_32BIT,
497 N_TXTOFF(ex)); 484 N_TXTOFF(ex));
498 up_write(&current->mm->mmap_sem);
499 retval = error; 485 retval = error;
500 if (error != start_addr) 486 if (error != start_addr)
501 goto out; 487 goto out;
@@ -503,9 +489,7 @@ static int load_aout_library(struct file *file)
503 len = PAGE_ALIGN(ex.a_text + ex.a_data); 489 len = PAGE_ALIGN(ex.a_text + ex.a_data);
504 bss = ex.a_text + ex.a_data + ex.a_bss; 490 bss = ex.a_text + ex.a_data + ex.a_bss;
505 if (bss > len) { 491 if (bss > len) {
506 down_write(&current->mm->mmap_sem); 492 error = vm_brk(start_addr + len, bss - len);
507 error = do_brk(start_addr + len, bss - len);
508 up_write(&current->mm->mmap_sem);
509 retval = error; 493 retval = error;
510 if (error != start_addr + len) 494 if (error != start_addr + len)
511 goto out; 495 goto out;
diff --git a/arch/x86/kvm/pmu.c b/arch/x86/kvm/pmu.c
index 173df38dbda5..2e88438ffd83 100644
--- a/arch/x86/kvm/pmu.c
+++ b/arch/x86/kvm/pmu.c
@@ -459,17 +459,17 @@ void kvm_pmu_cpuid_update(struct kvm_vcpu *vcpu)
459 pmu->available_event_types = ~entry->ebx & ((1ull << bitmap_len) - 1); 459 pmu->available_event_types = ~entry->ebx & ((1ull << bitmap_len) - 1);
460 460
461 if (pmu->version == 1) { 461 if (pmu->version == 1) {
462 pmu->global_ctrl = (1 << pmu->nr_arch_gp_counters) - 1; 462 pmu->nr_arch_fixed_counters = 0;
463 return; 463 } else {
464 pmu->nr_arch_fixed_counters = min((int)(entry->edx & 0x1f),
465 X86_PMC_MAX_FIXED);
466 pmu->counter_bitmask[KVM_PMC_FIXED] =
467 ((u64)1 << ((entry->edx >> 5) & 0xff)) - 1;
464 } 468 }
465 469
466 pmu->nr_arch_fixed_counters = min((int)(entry->edx & 0x1f), 470 pmu->global_ctrl = ((1 << pmu->nr_arch_gp_counters) - 1) |
467 X86_PMC_MAX_FIXED); 471 (((1ull << pmu->nr_arch_fixed_counters) - 1) << X86_PMC_IDX_FIXED);
468 pmu->counter_bitmask[KVM_PMC_FIXED] = 472 pmu->global_ctrl_mask = ~pmu->global_ctrl;
469 ((u64)1 << ((entry->edx >> 5) & 0xff)) - 1;
470 pmu->global_ctrl_mask = ~(((1 << pmu->nr_arch_gp_counters) - 1)
471 | (((1ull << pmu->nr_arch_fixed_counters) - 1)
472 << X86_PMC_IDX_FIXED));
473} 473}
474 474
475void kvm_pmu_init(struct kvm_vcpu *vcpu) 475void kvm_pmu_init(struct kvm_vcpu *vcpu)
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index ad85adfef843..4ff0ab9bc3c8 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -2210,9 +2210,12 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 data)
2210 msr = find_msr_entry(vmx, msr_index); 2210 msr = find_msr_entry(vmx, msr_index);
2211 if (msr) { 2211 if (msr) {
2212 msr->data = data; 2212 msr->data = data;
2213 if (msr - vmx->guest_msrs < vmx->save_nmsrs) 2213 if (msr - vmx->guest_msrs < vmx->save_nmsrs) {
2214 preempt_disable();
2214 kvm_set_shared_msr(msr->index, msr->data, 2215 kvm_set_shared_msr(msr->index, msr->data,
2215 msr->mask); 2216 msr->mask);
2217 preempt_enable();
2218 }
2216 break; 2219 break;
2217 } 2220 }
2218 ret = kvm_set_msr_common(vcpu, msr_index, data); 2221 ret = kvm_set_msr_common(vcpu, msr_index, data);
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 4044ce0bf7c1..91a5e989abcf 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -6336,13 +6336,11 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm,
6336 if (npages && !old.rmap) { 6336 if (npages && !old.rmap) {
6337 unsigned long userspace_addr; 6337 unsigned long userspace_addr;
6338 6338
6339 down_write(&current->mm->mmap_sem); 6339 userspace_addr = vm_mmap(NULL, 0,
6340 userspace_addr = do_mmap(NULL, 0,
6341 npages * PAGE_SIZE, 6340 npages * PAGE_SIZE,
6342 PROT_READ | PROT_WRITE, 6341 PROT_READ | PROT_WRITE,
6343 map_flags, 6342 map_flags,
6344 0); 6343 0);
6345 up_write(&current->mm->mmap_sem);
6346 6344
6347 if (IS_ERR((void *)userspace_addr)) 6345 if (IS_ERR((void *)userspace_addr))
6348 return PTR_ERR((void *)userspace_addr); 6346 return PTR_ERR((void *)userspace_addr);
@@ -6366,10 +6364,8 @@ void kvm_arch_commit_memory_region(struct kvm *kvm,
6366 if (!user_alloc && !old.user_alloc && old.rmap && !npages) { 6364 if (!user_alloc && !old.user_alloc && old.rmap && !npages) {
6367 int ret; 6365 int ret;
6368 6366
6369 down_write(&current->mm->mmap_sem); 6367 ret = vm_munmap(old.userspace_addr,
6370 ret = do_munmap(current->mm, old.userspace_addr,
6371 old.npages * PAGE_SIZE); 6368 old.npages * PAGE_SIZE);
6372 up_write(&current->mm->mmap_sem);
6373 if (ret < 0) 6369 if (ret < 0)
6374 printk(KERN_WARNING 6370 printk(KERN_WARNING
6375 "kvm_vm_ioctl_set_memory_region: " 6371 "kvm_vm_ioctl_set_memory_region: "
diff --git a/arch/x86/lib/insn.c b/arch/x86/lib/insn.c
index 25feb1ae71c5..b1e6c4b2e8eb 100644
--- a/arch/x86/lib/insn.c
+++ b/arch/x86/lib/insn.c
@@ -379,8 +379,8 @@ err_out:
379 return; 379 return;
380} 380}
381 381
382/* Decode moffset16/32/64 */ 382/* Decode moffset16/32/64. Return 0 if failed */
383static void __get_moffset(struct insn *insn) 383static int __get_moffset(struct insn *insn)
384{ 384{
385 switch (insn->addr_bytes) { 385 switch (insn->addr_bytes) {
386 case 2: 386 case 2:
@@ -397,15 +397,19 @@ static void __get_moffset(struct insn *insn)
397 insn->moffset2.value = get_next(int, insn); 397 insn->moffset2.value = get_next(int, insn);
398 insn->moffset2.nbytes = 4; 398 insn->moffset2.nbytes = 4;
399 break; 399 break;
400 default: /* opnd_bytes must be modified manually */
401 goto err_out;
400 } 402 }
401 insn->moffset1.got = insn->moffset2.got = 1; 403 insn->moffset1.got = insn->moffset2.got = 1;
402 404
405 return 1;
406
403err_out: 407err_out:
404 return; 408 return 0;
405} 409}
406 410
407/* Decode imm v32(Iz) */ 411/* Decode imm v32(Iz). Return 0 if failed */
408static void __get_immv32(struct insn *insn) 412static int __get_immv32(struct insn *insn)
409{ 413{
410 switch (insn->opnd_bytes) { 414 switch (insn->opnd_bytes) {
411 case 2: 415 case 2:
@@ -417,14 +421,18 @@ static void __get_immv32(struct insn *insn)
417 insn->immediate.value = get_next(int, insn); 421 insn->immediate.value = get_next(int, insn);
418 insn->immediate.nbytes = 4; 422 insn->immediate.nbytes = 4;
419 break; 423 break;
424 default: /* opnd_bytes must be modified manually */
425 goto err_out;
420 } 426 }
421 427
428 return 1;
429
422err_out: 430err_out:
423 return; 431 return 0;
424} 432}
425 433
426/* Decode imm v64(Iv/Ov) */ 434/* Decode imm v64(Iv/Ov), Return 0 if failed */
427static void __get_immv(struct insn *insn) 435static int __get_immv(struct insn *insn)
428{ 436{
429 switch (insn->opnd_bytes) { 437 switch (insn->opnd_bytes) {
430 case 2: 438 case 2:
@@ -441,15 +449,18 @@ static void __get_immv(struct insn *insn)
441 insn->immediate2.value = get_next(int, insn); 449 insn->immediate2.value = get_next(int, insn);
442 insn->immediate2.nbytes = 4; 450 insn->immediate2.nbytes = 4;
443 break; 451 break;
452 default: /* opnd_bytes must be modified manually */
453 goto err_out;
444 } 454 }
445 insn->immediate1.got = insn->immediate2.got = 1; 455 insn->immediate1.got = insn->immediate2.got = 1;
446 456
457 return 1;
447err_out: 458err_out:
448 return; 459 return 0;
449} 460}
450 461
451/* Decode ptr16:16/32(Ap) */ 462/* Decode ptr16:16/32(Ap) */
452static void __get_immptr(struct insn *insn) 463static int __get_immptr(struct insn *insn)
453{ 464{
454 switch (insn->opnd_bytes) { 465 switch (insn->opnd_bytes) {
455 case 2: 466 case 2:
@@ -462,14 +473,17 @@ static void __get_immptr(struct insn *insn)
462 break; 473 break;
463 case 8: 474 case 8:
464 /* ptr16:64 is not exist (no segment) */ 475 /* ptr16:64 is not exist (no segment) */
465 return; 476 return 0;
477 default: /* opnd_bytes must be modified manually */
478 goto err_out;
466 } 479 }
467 insn->immediate2.value = get_next(unsigned short, insn); 480 insn->immediate2.value = get_next(unsigned short, insn);
468 insn->immediate2.nbytes = 2; 481 insn->immediate2.nbytes = 2;
469 insn->immediate1.got = insn->immediate2.got = 1; 482 insn->immediate1.got = insn->immediate2.got = 1;
470 483
484 return 1;
471err_out: 485err_out:
472 return; 486 return 0;
473} 487}
474 488
475/** 489/**
@@ -489,7 +503,8 @@ void insn_get_immediate(struct insn *insn)
489 insn_get_displacement(insn); 503 insn_get_displacement(insn);
490 504
491 if (inat_has_moffset(insn->attr)) { 505 if (inat_has_moffset(insn->attr)) {
492 __get_moffset(insn); 506 if (!__get_moffset(insn))
507 goto err_out;
493 goto done; 508 goto done;
494 } 509 }
495 510
@@ -517,16 +532,20 @@ void insn_get_immediate(struct insn *insn)
517 insn->immediate2.nbytes = 4; 532 insn->immediate2.nbytes = 4;
518 break; 533 break;
519 case INAT_IMM_PTR: 534 case INAT_IMM_PTR:
520 __get_immptr(insn); 535 if (!__get_immptr(insn))
536 goto err_out;
521 break; 537 break;
522 case INAT_IMM_VWORD32: 538 case INAT_IMM_VWORD32:
523 __get_immv32(insn); 539 if (!__get_immv32(insn))
540 goto err_out;
524 break; 541 break;
525 case INAT_IMM_VWORD: 542 case INAT_IMM_VWORD:
526 __get_immv(insn); 543 if (!__get_immv(insn))
544 goto err_out;
527 break; 545 break;
528 default: 546 default:
529 break; 547 /* Here, insn must have an immediate, but failed */
548 goto err_out;
530 } 549 }
531 if (inat_has_second_immediate(insn->attr)) { 550 if (inat_has_second_immediate(insn->attr)) {
532 insn->immediate2.value = get_next(char, insn); 551 insn->immediate2.value = get_next(char, insn);
diff --git a/crypto/sha512_generic.c b/crypto/sha512_generic.c
index 107f6f7be5e1..dd30f40af9f5 100644
--- a/crypto/sha512_generic.c
+++ b/crypto/sha512_generic.c
@@ -174,7 +174,7 @@ sha512_update(struct shash_desc *desc, const u8 *data, unsigned int len)
174 index = sctx->count[0] & 0x7f; 174 index = sctx->count[0] & 0x7f;
175 175
176 /* Update number of bytes */ 176 /* Update number of bytes */
177 if (!(sctx->count[0] += len)) 177 if ((sctx->count[0] += len) < len)
178 sctx->count[1]++; 178 sctx->count[1]++;
179 179
180 part_len = 128 - index; 180 part_len = 128 - index;
diff --git a/drivers/acpi/acpica/hwxface.c b/drivers/acpi/acpica/hwxface.c
index ab513a972c95..a716fede4f25 100644
--- a/drivers/acpi/acpica/hwxface.c
+++ b/drivers/acpi/acpica/hwxface.c
@@ -74,7 +74,8 @@ acpi_status acpi_reset(void)
74 74
75 /* Check if the reset register is supported */ 75 /* Check if the reset register is supported */
76 76
77 if (!reset_reg->address) { 77 if (!(acpi_gbl_FADT.flags & ACPI_FADT_RESET_REGISTER) ||
78 !reset_reg->address) {
78 return_ACPI_STATUS(AE_NOT_EXIST); 79 return_ACPI_STATUS(AE_NOT_EXIST);
79 } 80 }
80 81
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index ba14fb93c929..c3881b2eb8b2 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -607,8 +607,7 @@ acpi_os_install_interrupt_handler(u32 gsi, acpi_osd_handler handler,
607 607
608 acpi_irq_handler = handler; 608 acpi_irq_handler = handler;
609 acpi_irq_context = context; 609 acpi_irq_context = context;
610 if (request_threaded_irq(irq, NULL, acpi_irq, IRQF_SHARED, "acpi", 610 if (request_irq(irq, acpi_irq, IRQF_SHARED, "acpi", acpi_irq)) {
611 acpi_irq)) {
612 printk(KERN_ERR PREFIX "SCI (IRQ%d) allocation failed\n", irq); 611 printk(KERN_ERR PREFIX "SCI (IRQ%d) allocation failed\n", irq);
613 acpi_irq_handler = NULL; 612 acpi_irq_handler = NULL;
614 return AE_NOT_ACQUIRED; 613 return AE_NOT_ACQUIRED;
diff --git a/drivers/acpi/reboot.c b/drivers/acpi/reboot.c
index c1d612435939..a6c77e8b37bd 100644
--- a/drivers/acpi/reboot.c
+++ b/drivers/acpi/reboot.c
@@ -23,7 +23,8 @@ void acpi_reboot(void)
23 /* Is the reset register supported? The spec says we should be 23 /* Is the reset register supported? The spec says we should be
24 * checking the bit width and bit offset, but Windows ignores 24 * checking the bit width and bit offset, but Windows ignores
25 * these fields */ 25 * these fields */
26 /* Ignore also acpi_gbl_FADT.flags.ACPI_FADT_RESET_REGISTER */ 26 if (!(acpi_gbl_FADT.flags & ACPI_FADT_RESET_REGISTER))
27 return;
27 28
28 reset_value = acpi_gbl_FADT.reset_value; 29 reset_value = acpi_gbl_FADT.reset_value;
29 30
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
index 68013f96729f..7857e8fd0a3e 100644
--- a/drivers/ata/ata_piix.c
+++ b/drivers/ata/ata_piix.c
@@ -329,6 +329,8 @@ static const struct pci_device_id piix_pci_tbl[] = {
329 { 0x8086, 0x8c08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, 329 { 0x8086, 0x8c08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata },
330 /* SATA Controller IDE (Lynx Point) */ 330 /* SATA Controller IDE (Lynx Point) */
331 { 0x8086, 0x8c09, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, 331 { 0x8086, 0x8c09, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata },
332 /* SATA Controller IDE (DH89xxCC) */
333 { 0x8086, 0x2326, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata },
332 { } /* terminate list */ 334 { } /* terminate list */
333}; 335};
334 336
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index e0bda9ff89cd..28db50b57b91 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -95,7 +95,7 @@ static unsigned int ata_dev_set_xfermode(struct ata_device *dev);
95static void ata_dev_xfermask(struct ata_device *dev); 95static void ata_dev_xfermask(struct ata_device *dev);
96static unsigned long ata_dev_blacklisted(const struct ata_device *dev); 96static unsigned long ata_dev_blacklisted(const struct ata_device *dev);
97 97
98unsigned int ata_print_id = 1; 98atomic_t ata_print_id = ATOMIC_INIT(1);
99 99
100struct ata_force_param { 100struct ata_force_param {
101 const char *name; 101 const char *name;
@@ -6029,7 +6029,7 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht)
6029 6029
6030 /* give ports names and add SCSI hosts */ 6030 /* give ports names and add SCSI hosts */
6031 for (i = 0; i < host->n_ports; i++) 6031 for (i = 0; i < host->n_ports; i++)
6032 host->ports[i]->print_id = ata_print_id++; 6032 host->ports[i]->print_id = atomic_inc_return(&ata_print_id);
6033 6033
6034 6034
6035 /* Create associated sysfs transport objects */ 6035 /* Create associated sysfs transport objects */
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 1ee00c8b5b04..93dabdcd2cbe 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -3843,7 +3843,7 @@ int ata_sas_async_port_init(struct ata_port *ap)
3843 int rc = ap->ops->port_start(ap); 3843 int rc = ap->ops->port_start(ap);
3844 3844
3845 if (!rc) { 3845 if (!rc) {
3846 ap->print_id = ata_print_id++; 3846 ap->print_id = atomic_inc_return(&ata_print_id);
3847 __ata_port_probe(ap); 3847 __ata_port_probe(ap);
3848 } 3848 }
3849 3849
@@ -3867,7 +3867,7 @@ int ata_sas_port_init(struct ata_port *ap)
3867 int rc = ap->ops->port_start(ap); 3867 int rc = ap->ops->port_start(ap);
3868 3868
3869 if (!rc) { 3869 if (!rc) {
3870 ap->print_id = ata_print_id++; 3870 ap->print_id = atomic_inc_return(&ata_print_id);
3871 rc = ata_port_probe(ap); 3871 rc = ata_port_probe(ap);
3872 } 3872 }
3873 3873
diff --git a/drivers/ata/libata-transport.c b/drivers/ata/libata-transport.c
index 74aaee30e264..c34190485377 100644
--- a/drivers/ata/libata-transport.c
+++ b/drivers/ata/libata-transport.c
@@ -294,6 +294,7 @@ int ata_tport_add(struct device *parent,
294 device_enable_async_suspend(dev); 294 device_enable_async_suspend(dev);
295 pm_runtime_set_active(dev); 295 pm_runtime_set_active(dev);
296 pm_runtime_enable(dev); 296 pm_runtime_enable(dev);
297 pm_runtime_forbid(dev);
297 298
298 transport_add_device(dev); 299 transport_add_device(dev);
299 transport_configure_device(dev); 300 transport_configure_device(dev);
diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h
index 2e26fcaf635b..9d0fd0b71852 100644
--- a/drivers/ata/libata.h
+++ b/drivers/ata/libata.h
@@ -53,7 +53,7 @@ enum {
53 ATA_DNXFER_QUIET = (1 << 31), 53 ATA_DNXFER_QUIET = (1 << 31),
54}; 54};
55 55
56extern unsigned int ata_print_id; 56extern atomic_t ata_print_id;
57extern int atapi_passthru16; 57extern int atapi_passthru16;
58extern int libata_fua; 58extern int libata_fua;
59extern int libata_noacpi; 59extern int libata_noacpi;
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index 38950ea8398a..7336d4a7ab31 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -4025,7 +4025,8 @@ static int mv_platform_probe(struct platform_device *pdev)
4025 struct ata_host *host; 4025 struct ata_host *host;
4026 struct mv_host_priv *hpriv; 4026 struct mv_host_priv *hpriv;
4027 struct resource *res; 4027 struct resource *res;
4028 int n_ports, rc; 4028 int n_ports = 0;
4029 int rc;
4029 4030
4030 ata_print_version_once(&pdev->dev, DRV_VERSION); 4031 ata_print_version_once(&pdev->dev, DRV_VERSION);
4031 4032
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index 0e4ef3de9d5d..0d39f2f4294a 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -375,6 +375,34 @@ static int init_vq(struct virtio_blk *vblk)
375 return err; 375 return err;
376} 376}
377 377
378/*
379 * Legacy naming scheme used for virtio devices. We are stuck with it for
380 * virtio blk but don't ever use it for any new driver.
381 */
382static int virtblk_name_format(char *prefix, int index, char *buf, int buflen)
383{
384 const int base = 'z' - 'a' + 1;
385 char *begin = buf + strlen(prefix);
386 char *end = buf + buflen;
387 char *p;
388 int unit;
389
390 p = end - 1;
391 *p = '\0';
392 unit = base;
393 do {
394 if (p == begin)
395 return -EINVAL;
396 *--p = 'a' + (index % unit);
397 index = (index / unit) - 1;
398 } while (index >= 0);
399
400 memmove(begin, p, end - p);
401 memcpy(buf, prefix, strlen(prefix));
402
403 return 0;
404}
405
378static int __devinit virtblk_probe(struct virtio_device *vdev) 406static int __devinit virtblk_probe(struct virtio_device *vdev)
379{ 407{
380 struct virtio_blk *vblk; 408 struct virtio_blk *vblk;
@@ -443,18 +471,7 @@ static int __devinit virtblk_probe(struct virtio_device *vdev)
443 471
444 q->queuedata = vblk; 472 q->queuedata = vblk;
445 473
446 if (index < 26) { 474 virtblk_name_format("vd", index, vblk->disk->disk_name, DISK_NAME_LEN);
447 sprintf(vblk->disk->disk_name, "vd%c", 'a' + index % 26);
448 } else if (index < (26 + 1) * 26) {
449 sprintf(vblk->disk->disk_name, "vd%c%c",
450 'a' + index / 26 - 1, 'a' + index % 26);
451 } else {
452 const unsigned int m1 = (index / 26 - 1) / 26 - 1;
453 const unsigned int m2 = (index / 26 - 1) % 26;
454 const unsigned int m3 = index % 26;
455 sprintf(vblk->disk->disk_name, "vd%c%c%c",
456 'a' + m1, 'a' + m2, 'a' + m3);
457 }
458 475
459 vblk->disk->major = major; 476 vblk->disk->major = major;
460 vblk->disk->first_minor = index_to_minor(index); 477 vblk->disk->first_minor = index_to_minor(index);
diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c
index 89860f34a7ec..4f66171c6683 100644
--- a/drivers/block/xen-blkback/xenbus.c
+++ b/drivers/block/xen-blkback/xenbus.c
@@ -416,7 +416,7 @@ static void xen_blkbk_discard(struct xenbus_transaction xbt, struct backend_info
416 "discard-secure", "%d", 416 "discard-secure", "%d",
417 blkif->vbd.discard_secure); 417 blkif->vbd.discard_secure);
418 if (err) { 418 if (err) {
419 dev_warn(dev-dev, "writing discard-secure (%d)", err); 419 dev_warn(&dev->dev, "writing discard-secure (%d)", err);
420 return; 420 return;
421 } 421 }
422 } 422 }
diff --git a/drivers/crypto/ixp4xx_crypto.c b/drivers/crypto/ixp4xx_crypto.c
index 0053d7ebb5ca..8f3f74ce8c7f 100644
--- a/drivers/crypto/ixp4xx_crypto.c
+++ b/drivers/crypto/ixp4xx_crypto.c
@@ -18,6 +18,7 @@
18#include <linux/interrupt.h> 18#include <linux/interrupt.h>
19#include <linux/spinlock.h> 19#include <linux/spinlock.h>
20#include <linux/gfp.h> 20#include <linux/gfp.h>
21#include <linux/module.h>
21 22
22#include <crypto/ctr.h> 23#include <crypto/ctr.h>
23#include <crypto/des.h> 24#include <crypto/des.h>
diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c
index dc641c796526..921039e56f87 100644
--- a/drivers/crypto/talitos.c
+++ b/drivers/crypto/talitos.c
@@ -124,6 +124,9 @@ struct talitos_private {
124 void __iomem *reg; 124 void __iomem *reg;
125 int irq[2]; 125 int irq[2];
126 126
127 /* SEC global registers lock */
128 spinlock_t reg_lock ____cacheline_aligned;
129
127 /* SEC version geometry (from device tree node) */ 130 /* SEC version geometry (from device tree node) */
128 unsigned int num_channels; 131 unsigned int num_channels;
129 unsigned int chfifo_len; 132 unsigned int chfifo_len;
@@ -412,6 +415,7 @@ static void talitos_done_##name(unsigned long data) \
412{ \ 415{ \
413 struct device *dev = (struct device *)data; \ 416 struct device *dev = (struct device *)data; \
414 struct talitos_private *priv = dev_get_drvdata(dev); \ 417 struct talitos_private *priv = dev_get_drvdata(dev); \
418 unsigned long flags; \
415 \ 419 \
416 if (ch_done_mask & 1) \ 420 if (ch_done_mask & 1) \
417 flush_channel(dev, 0, 0, 0); \ 421 flush_channel(dev, 0, 0, 0); \
@@ -427,8 +431,10 @@ static void talitos_done_##name(unsigned long data) \
427out: \ 431out: \
428 /* At this point, all completed channels have been processed */ \ 432 /* At this point, all completed channels have been processed */ \
429 /* Unmask done interrupts for channels completed later on. */ \ 433 /* Unmask done interrupts for channels completed later on. */ \
434 spin_lock_irqsave(&priv->reg_lock, flags); \
430 setbits32(priv->reg + TALITOS_IMR, ch_done_mask); \ 435 setbits32(priv->reg + TALITOS_IMR, ch_done_mask); \
431 setbits32(priv->reg + TALITOS_IMR_LO, TALITOS_IMR_LO_INIT); \ 436 setbits32(priv->reg + TALITOS_IMR_LO, TALITOS_IMR_LO_INIT); \
437 spin_unlock_irqrestore(&priv->reg_lock, flags); \
432} 438}
433DEF_TALITOS_DONE(4ch, TALITOS_ISR_4CHDONE) 439DEF_TALITOS_DONE(4ch, TALITOS_ISR_4CHDONE)
434DEF_TALITOS_DONE(ch0_2, TALITOS_ISR_CH_0_2_DONE) 440DEF_TALITOS_DONE(ch0_2, TALITOS_ISR_CH_0_2_DONE)
@@ -619,22 +625,28 @@ static irqreturn_t talitos_interrupt_##name(int irq, void *data) \
619 struct device *dev = data; \ 625 struct device *dev = data; \
620 struct talitos_private *priv = dev_get_drvdata(dev); \ 626 struct talitos_private *priv = dev_get_drvdata(dev); \
621 u32 isr, isr_lo; \ 627 u32 isr, isr_lo; \
628 unsigned long flags; \
622 \ 629 \
630 spin_lock_irqsave(&priv->reg_lock, flags); \
623 isr = in_be32(priv->reg + TALITOS_ISR); \ 631 isr = in_be32(priv->reg + TALITOS_ISR); \
624 isr_lo = in_be32(priv->reg + TALITOS_ISR_LO); \ 632 isr_lo = in_be32(priv->reg + TALITOS_ISR_LO); \
625 /* Acknowledge interrupt */ \ 633 /* Acknowledge interrupt */ \
626 out_be32(priv->reg + TALITOS_ICR, isr & (ch_done_mask | ch_err_mask)); \ 634 out_be32(priv->reg + TALITOS_ICR, isr & (ch_done_mask | ch_err_mask)); \
627 out_be32(priv->reg + TALITOS_ICR_LO, isr_lo); \ 635 out_be32(priv->reg + TALITOS_ICR_LO, isr_lo); \
628 \ 636 \
629 if (unlikely((isr & ~TALITOS_ISR_4CHDONE) & ch_err_mask || isr_lo)) \ 637 if (unlikely(isr & ch_err_mask || isr_lo)) { \
630 talitos_error(dev, isr, isr_lo); \ 638 spin_unlock_irqrestore(&priv->reg_lock, flags); \
631 else \ 639 talitos_error(dev, isr & ch_err_mask, isr_lo); \
640 } \
641 else { \
632 if (likely(isr & ch_done_mask)) { \ 642 if (likely(isr & ch_done_mask)) { \
633 /* mask further done interrupts. */ \ 643 /* mask further done interrupts. */ \
634 clrbits32(priv->reg + TALITOS_IMR, ch_done_mask); \ 644 clrbits32(priv->reg + TALITOS_IMR, ch_done_mask); \
635 /* done_task will unmask done interrupts at exit */ \ 645 /* done_task will unmask done interrupts at exit */ \
636 tasklet_schedule(&priv->done_task[tlet]); \ 646 tasklet_schedule(&priv->done_task[tlet]); \
637 } \ 647 } \
648 spin_unlock_irqrestore(&priv->reg_lock, flags); \
649 } \
638 \ 650 \
639 return (isr & (ch_done_mask | ch_err_mask) || isr_lo) ? IRQ_HANDLED : \ 651 return (isr & (ch_done_mask | ch_err_mask) || isr_lo) ? IRQ_HANDLED : \
640 IRQ_NONE; \ 652 IRQ_NONE; \
@@ -2719,6 +2731,8 @@ static int talitos_probe(struct platform_device *ofdev)
2719 2731
2720 priv->ofdev = ofdev; 2732 priv->ofdev = ofdev;
2721 2733
2734 spin_lock_init(&priv->reg_lock);
2735
2722 err = talitos_probe_irq(ofdev); 2736 err = talitos_probe_irq(ofdev);
2723 if (err) 2737 if (err)
2724 goto err_out; 2738 goto err_out;
diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig
index cf9da362d64f..ef378b5b17e4 100644
--- a/drivers/dma/Kconfig
+++ b/drivers/dma/Kconfig
@@ -91,11 +91,10 @@ config DW_DMAC
91 91
92config AT_HDMAC 92config AT_HDMAC
93 tristate "Atmel AHB DMA support" 93 tristate "Atmel AHB DMA support"
94 depends on ARCH_AT91SAM9RL || ARCH_AT91SAM9G45 94 depends on ARCH_AT91
95 select DMA_ENGINE 95 select DMA_ENGINE
96 help 96 help
97 Support the Atmel AHB DMA controller. This can be integrated in 97 Support the Atmel AHB DMA controller.
98 chips such as the Atmel AT91SAM9RL.
99 98
100config FSL_DMA 99config FSL_DMA
101 tristate "Freescale Elo and Elo Plus DMA support" 100 tristate "Freescale Elo and Elo Plus DMA support"
diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c
index 30372f7b2d45..348b367debeb 100644
--- a/drivers/gpu/drm/drm_bufs.c
+++ b/drivers/gpu/drm/drm_bufs.c
@@ -1510,8 +1510,8 @@ int drm_freebufs(struct drm_device *dev, void *data,
1510 * \param arg pointer to a drm_buf_map structure. 1510 * \param arg pointer to a drm_buf_map structure.
1511 * \return zero on success or a negative number on failure. 1511 * \return zero on success or a negative number on failure.
1512 * 1512 *
1513 * Maps the AGP, SG or PCI buffer region with do_mmap(), and copies information 1513 * Maps the AGP, SG or PCI buffer region with vm_mmap(), and copies information
1514 * about each buffer into user space. For PCI buffers, it calls do_mmap() with 1514 * about each buffer into user space. For PCI buffers, it calls vm_mmap() with
1515 * offset equal to 0, which drm_mmap() interpretes as PCI buffers and calls 1515 * offset equal to 0, which drm_mmap() interpretes as PCI buffers and calls
1516 * drm_mmap_dma(). 1516 * drm_mmap_dma().
1517 */ 1517 */
@@ -1553,18 +1553,14 @@ int drm_mapbufs(struct drm_device *dev, void *data,
1553 retcode = -EINVAL; 1553 retcode = -EINVAL;
1554 goto done; 1554 goto done;
1555 } 1555 }
1556 down_write(&current->mm->mmap_sem); 1556 virtual = vm_mmap(file_priv->filp, 0, map->size,
1557 virtual = do_mmap(file_priv->filp, 0, map->size,
1558 PROT_READ | PROT_WRITE, 1557 PROT_READ | PROT_WRITE,
1559 MAP_SHARED, 1558 MAP_SHARED,
1560 token); 1559 token);
1561 up_write(&current->mm->mmap_sem);
1562 } else { 1560 } else {
1563 down_write(&current->mm->mmap_sem); 1561 virtual = vm_mmap(file_priv->filp, 0, dma->byte_count,
1564 virtual = do_mmap(file_priv->filp, 0, dma->byte_count,
1565 PROT_READ | PROT_WRITE, 1562 PROT_READ | PROT_WRITE,
1566 MAP_SHARED, 0); 1563 MAP_SHARED, 0);
1567 up_write(&current->mm->mmap_sem);
1568 } 1564 }
1569 if (virtual > -1024UL) { 1565 if (virtual > -1024UL) {
1570 /* Real error */ 1566 /* Real error */
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index d3aaeb6ae236..c79870a75c2f 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -3335,10 +3335,12 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
3335 3335
3336 ret = crtc->funcs->page_flip(crtc, fb, e); 3336 ret = crtc->funcs->page_flip(crtc, fb, e);
3337 if (ret) { 3337 if (ret) {
3338 spin_lock_irqsave(&dev->event_lock, flags); 3338 if (page_flip->flags & DRM_MODE_PAGE_FLIP_EVENT) {
3339 file_priv->event_space += sizeof e->event; 3339 spin_lock_irqsave(&dev->event_lock, flags);
3340 spin_unlock_irqrestore(&dev->event_lock, flags); 3340 file_priv->event_space += sizeof e->event;
3341 kfree(e); 3341 spin_unlock_irqrestore(&dev->event_lock, flags);
3342 kfree(e);
3343 }
3342 } 3344 }
3343 3345
3344out: 3346out:
diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c
index cdfbf27b2b3c..123de28f94ef 100644
--- a/drivers/gpu/drm/drm_fops.c
+++ b/drivers/gpu/drm/drm_fops.c
@@ -507,12 +507,12 @@ int drm_release(struct inode *inode, struct file *filp)
507 507
508 drm_events_release(file_priv); 508 drm_events_release(file_priv);
509 509
510 if (dev->driver->driver_features & DRIVER_GEM)
511 drm_gem_release(dev, file_priv);
512
513 if (dev->driver->driver_features & DRIVER_MODESET) 510 if (dev->driver->driver_features & DRIVER_MODESET)
514 drm_fb_release(file_priv); 511 drm_fb_release(file_priv);
515 512
513 if (dev->driver->driver_features & DRIVER_GEM)
514 drm_gem_release(dev, file_priv);
515
516 mutex_lock(&dev->ctxlist_mutex); 516 mutex_lock(&dev->ctxlist_mutex);
517 if (!list_empty(&dev->ctxlist)) { 517 if (!list_empty(&dev->ctxlist)) {
518 struct drm_ctx_list *pos, *n; 518 struct drm_ctx_list *pos, *n;
diff --git a/drivers/gpu/drm/drm_usb.c b/drivers/gpu/drm/drm_usb.c
index c8c83dad2ce1..37c9a523dd1c 100644
--- a/drivers/gpu/drm/drm_usb.c
+++ b/drivers/gpu/drm/drm_usb.c
@@ -1,6 +1,6 @@
1#include "drmP.h" 1#include "drmP.h"
2#include <linux/usb.h> 2#include <linux/usb.h>
3#include <linux/export.h> 3#include <linux/module.h>
4 4
5int drm_get_usb_dev(struct usb_interface *interface, 5int drm_get_usb_dev(struct usb_interface *interface,
6 const struct usb_device_id *id, 6 const struct usb_device_id *id,
@@ -114,3 +114,7 @@ void drm_usb_exit(struct drm_driver *driver,
114 usb_deregister(udriver); 114 usb_deregister(udriver);
115} 115}
116EXPORT_SYMBOL(drm_usb_exit); 116EXPORT_SYMBOL(drm_usb_exit);
117
118MODULE_AUTHOR("David Airlie");
119MODULE_DESCRIPTION("USB DRM support");
120MODULE_LICENSE("GPL and additional rights");
diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.c b/drivers/gpu/drm/exynos/exynos_drm_gem.c
index 26d51979116b..392ce71ed6a1 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_gem.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_gem.c
@@ -581,10 +581,8 @@ int exynos_drm_gem_mmap_ioctl(struct drm_device *dev, void *data,
581 obj->filp->f_op = &exynos_drm_gem_fops; 581 obj->filp->f_op = &exynos_drm_gem_fops;
582 obj->filp->private_data = obj; 582 obj->filp->private_data = obj;
583 583
584 down_write(&current->mm->mmap_sem); 584 addr = vm_mmap(obj->filp, 0, args->size,
585 addr = do_mmap(obj->filp, 0, args->size,
586 PROT_READ | PROT_WRITE, MAP_SHARED, 0); 585 PROT_READ | PROT_WRITE, MAP_SHARED, 0);
587 up_write(&current->mm->mmap_sem);
588 586
589 drm_gem_object_unreference_unlocked(obj); 587 drm_gem_object_unreference_unlocked(obj);
590 588
diff --git a/drivers/gpu/drm/gma500/mdfld_dsi_output.h b/drivers/gpu/drm/gma500/mdfld_dsi_output.h
index 21071cef92a4..36eb0744841c 100644
--- a/drivers/gpu/drm/gma500/mdfld_dsi_output.h
+++ b/drivers/gpu/drm/gma500/mdfld_dsi_output.h
@@ -29,7 +29,6 @@
29#define __MDFLD_DSI_OUTPUT_H__ 29#define __MDFLD_DSI_OUTPUT_H__
30 30
31#include <linux/backlight.h> 31#include <linux/backlight.h>
32#include <linux/version.h>
33#include <drm/drmP.h> 32#include <drm/drmP.h>
34#include <drm/drm.h> 33#include <drm/drm.h>
35#include <drm/drm_crtc.h> 34#include <drm/drm_crtc.h>
diff --git a/drivers/gpu/drm/i810/i810_dma.c b/drivers/gpu/drm/i810/i810_dma.c
index 2c8a60c3b98e..f920fb5e42b6 100644
--- a/drivers/gpu/drm/i810/i810_dma.c
+++ b/drivers/gpu/drm/i810/i810_dma.c
@@ -129,6 +129,7 @@ static int i810_map_buffer(struct drm_buf *buf, struct drm_file *file_priv)
129 if (buf_priv->currently_mapped == I810_BUF_MAPPED) 129 if (buf_priv->currently_mapped == I810_BUF_MAPPED)
130 return -EINVAL; 130 return -EINVAL;
131 131
132 /* This is all entirely broken */
132 down_write(&current->mm->mmap_sem); 133 down_write(&current->mm->mmap_sem);
133 old_fops = file_priv->filp->f_op; 134 old_fops = file_priv->filp->f_op;
134 file_priv->filp->f_op = &i810_buffer_fops; 135 file_priv->filp->f_op = &i810_buffer_fops;
@@ -157,11 +158,8 @@ static int i810_unmap_buffer(struct drm_buf *buf)
157 if (buf_priv->currently_mapped != I810_BUF_MAPPED) 158 if (buf_priv->currently_mapped != I810_BUF_MAPPED)
158 return -EINVAL; 159 return -EINVAL;
159 160
160 down_write(&current->mm->mmap_sem); 161 retcode = vm_munmap((unsigned long)buf_priv->virtual,
161 retcode = do_munmap(current->mm,
162 (unsigned long)buf_priv->virtual,
163 (size_t) buf->total); 162 (size_t) buf->total);
164 up_write(&current->mm->mmap_sem);
165 163
166 buf_priv->currently_mapped = I810_BUF_UNMAPPED; 164 buf_priv->currently_mapped = I810_BUF_UNMAPPED;
167 buf_priv->virtual = NULL; 165 buf_priv->virtual = NULL;
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 0e3c6acde955..0d1e4b7b4b99 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1087,11 +1087,9 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data,
1087 if (obj == NULL) 1087 if (obj == NULL)
1088 return -ENOENT; 1088 return -ENOENT;
1089 1089
1090 down_write(&current->mm->mmap_sem); 1090 addr = vm_mmap(obj->filp, 0, args->size,
1091 addr = do_mmap(obj->filp, 0, args->size,
1092 PROT_READ | PROT_WRITE, MAP_SHARED, 1091 PROT_READ | PROT_WRITE, MAP_SHARED,
1093 args->offset); 1092 args->offset);
1094 up_write(&current->mm->mmap_sem);
1095 drm_gem_object_unreference_unlocked(obj); 1093 drm_gem_object_unreference_unlocked(obj);
1096 if (IS_ERR((void *)addr)) 1094 if (IS_ERR((void *)addr))
1097 return addr; 1095 return addr;
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index bae38acf44dc..5908cd563400 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -3478,8 +3478,11 @@ static bool intel_crtc_mode_fixup(struct drm_crtc *crtc,
3478 return false; 3478 return false;
3479 } 3479 }
3480 3480
3481 /* All interlaced capable intel hw wants timings in frames. */ 3481 /* All interlaced capable intel hw wants timings in frames. Note though
3482 drm_mode_set_crtcinfo(adjusted_mode, 0); 3482 * that intel_lvds_mode_fixup does some funny tricks with the crtc
3483 * timings, so we need to be careful not to clobber these.*/
3484 if (!(adjusted_mode->private_flags & INTEL_MODE_CRTC_TIMINGS_SET))
3485 drm_mode_set_crtcinfo(adjusted_mode, 0);
3483 3486
3484 return true; 3487 return true;
3485} 3488}
@@ -7465,7 +7468,13 @@ static int intel_gen6_queue_flip(struct drm_device *dev,
7465 OUT_RING(fb->pitches[0] | obj->tiling_mode); 7468 OUT_RING(fb->pitches[0] | obj->tiling_mode);
7466 OUT_RING(obj->gtt_offset); 7469 OUT_RING(obj->gtt_offset);
7467 7470
7468 pf = I915_READ(PF_CTL(intel_crtc->pipe)) & PF_ENABLE; 7471 /* Contrary to the suggestions in the documentation,
7472 * "Enable Panel Fitter" does not seem to be required when page
7473 * flipping with a non-native mode, and worse causes a normal
7474 * modeset to fail.
7475 * pf = I915_READ(PF_CTL(intel_crtc->pipe)) & PF_ENABLE;
7476 */
7477 pf = 0;
7469 pipesrc = I915_READ(PIPESRC(intel_crtc->pipe)) & 0x0fff0fff; 7478 pipesrc = I915_READ(PIPESRC(intel_crtc->pipe)) & 0x0fff0fff;
7470 OUT_RING(pf | pipesrc); 7479 OUT_RING(pf | pipesrc);
7471 ADVANCE_LP_RING(); 7480 ADVANCE_LP_RING();
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 5a14149b3794..715afa153025 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -105,6 +105,10 @@
105#define INTEL_MODE_PIXEL_MULTIPLIER_SHIFT (0x0) 105#define INTEL_MODE_PIXEL_MULTIPLIER_SHIFT (0x0)
106#define INTEL_MODE_PIXEL_MULTIPLIER_MASK (0xf << INTEL_MODE_PIXEL_MULTIPLIER_SHIFT) 106#define INTEL_MODE_PIXEL_MULTIPLIER_MASK (0xf << INTEL_MODE_PIXEL_MULTIPLIER_SHIFT)
107#define INTEL_MODE_DP_FORCE_6BPC (0x10) 107#define INTEL_MODE_DP_FORCE_6BPC (0x10)
108/* This flag must be set by the encoder's mode_fixup if it changes the crtc
109 * timings in the mode to prevent the crtc fixup from overwriting them.
110 * Currently only lvds needs that. */
111#define INTEL_MODE_CRTC_TIMINGS_SET (0x20)
108 112
109static inline void 113static inline void
110intel_mode_set_pixel_multiplier(struct drm_display_mode *mode, 114intel_mode_set_pixel_multiplier(struct drm_display_mode *mode,
diff --git a/drivers/gpu/drm/i915/intel_fb.c b/drivers/gpu/drm/i915/intel_fb.c
index 19ecd78b8a2c..6e9ee33fd412 100644
--- a/drivers/gpu/drm/i915/intel_fb.c
+++ b/drivers/gpu/drm/i915/intel_fb.c
@@ -279,6 +279,8 @@ void intel_fb_restore_mode(struct drm_device *dev)
279 struct drm_mode_config *config = &dev->mode_config; 279 struct drm_mode_config *config = &dev->mode_config;
280 struct drm_plane *plane; 280 struct drm_plane *plane;
281 281
282 mutex_lock(&dev->mode_config.mutex);
283
282 ret = drm_fb_helper_restore_fbdev_mode(&dev_priv->fbdev->helper); 284 ret = drm_fb_helper_restore_fbdev_mode(&dev_priv->fbdev->helper);
283 if (ret) 285 if (ret)
284 DRM_DEBUG("failed to restore crtc mode\n"); 286 DRM_DEBUG("failed to restore crtc mode\n");
@@ -286,4 +288,6 @@ void intel_fb_restore_mode(struct drm_device *dev)
286 /* Be sure to shut off any planes that may be active */ 288 /* Be sure to shut off any planes that may be active */
287 list_for_each_entry(plane, &config->plane_list, head) 289 list_for_each_entry(plane, &config->plane_list, head)
288 plane->funcs->disable_plane(plane); 290 plane->funcs->disable_plane(plane);
291
292 mutex_unlock(&dev->mode_config.mutex);
289} 293}
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index 95db2e988227..30e2c82101de 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -187,6 +187,8 @@ centre_horizontally(struct drm_display_mode *mode,
187 187
188 mode->crtc_hsync_start = mode->crtc_hblank_start + sync_pos; 188 mode->crtc_hsync_start = mode->crtc_hblank_start + sync_pos;
189 mode->crtc_hsync_end = mode->crtc_hsync_start + sync_width; 189 mode->crtc_hsync_end = mode->crtc_hsync_start + sync_width;
190
191 mode->private_flags |= INTEL_MODE_CRTC_TIMINGS_SET;
190} 192}
191 193
192static void 194static void
@@ -208,6 +210,8 @@ centre_vertically(struct drm_display_mode *mode,
208 210
209 mode->crtc_vsync_start = mode->crtc_vblank_start + sync_pos; 211 mode->crtc_vsync_start = mode->crtc_vblank_start + sync_pos;
210 mode->crtc_vsync_end = mode->crtc_vsync_start + sync_width; 212 mode->crtc_vsync_end = mode->crtc_vsync_start + sync_width;
213
214 mode->private_flags |= INTEL_MODE_CRTC_TIMINGS_SET;
211} 215}
212 216
213static inline u32 panel_fitter_scaling(u32 source, u32 target) 217static inline u32 panel_fitter_scaling(u32 source, u32 target)
@@ -283,6 +287,8 @@ static bool intel_lvds_mode_fixup(struct drm_encoder *encoder,
283 for_each_pipe(pipe) 287 for_each_pipe(pipe)
284 I915_WRITE(BCLRPAT(pipe), 0); 288 I915_WRITE(BCLRPAT(pipe), 0);
285 289
290 drm_mode_set_crtcinfo(adjusted_mode, 0);
291
286 switch (intel_lvds->fitting_mode) { 292 switch (intel_lvds->fitting_mode) {
287 case DRM_MODE_SCALE_CENTER: 293 case DRM_MODE_SCALE_CENTER:
288 /* 294 /*
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
index 230a141dbea3..48177ec4720e 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -47,8 +47,6 @@ intel_fixed_panel_mode(struct drm_display_mode *fixed_mode,
47 adjusted_mode->vtotal = fixed_mode->vtotal; 47 adjusted_mode->vtotal = fixed_mode->vtotal;
48 48
49 adjusted_mode->clock = fixed_mode->clock; 49 adjusted_mode->clock = fixed_mode->clock;
50
51 drm_mode_set_crtcinfo(adjusted_mode, 0);
52} 50}
53 51
54/* adjusted_mode has been preset to be the panel's fixed mode */ 52/* adjusted_mode has been preset to be the panel's fixed mode */
diff --git a/drivers/gpu/drm/nouveau/nouveau_pm.c b/drivers/gpu/drm/nouveau/nouveau_pm.c
index 34d591b7d4ef..da3e7c3abab7 100644
--- a/drivers/gpu/drm/nouveau/nouveau_pm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_pm.c
@@ -235,6 +235,7 @@ nouveau_pm_profile_set(struct drm_device *dev, const char *profile)
235 return -EPERM; 235 return -EPERM;
236 236
237 strncpy(string, profile, sizeof(string)); 237 strncpy(string, profile, sizeof(string));
238 string[sizeof(string) - 1] = 0;
238 if ((ptr = strchr(string, '\n'))) 239 if ((ptr = strchr(string, '\n')))
239 *ptr = '\0'; 240 *ptr = '\0';
240 241
diff --git a/drivers/gpu/drm/nouveau/nv50_sor.c b/drivers/gpu/drm/nouveau/nv50_sor.c
index a7844ab6a50c..274640212475 100644
--- a/drivers/gpu/drm/nouveau/nv50_sor.c
+++ b/drivers/gpu/drm/nouveau/nv50_sor.c
@@ -42,7 +42,7 @@ nv50_sor_dp_lane_map(struct drm_device *dev, struct dcb_entry *dcb, u8 lane)
42 struct drm_nouveau_private *dev_priv = dev->dev_private; 42 struct drm_nouveau_private *dev_priv = dev->dev_private;
43 static const u8 nvaf[] = { 24, 16, 8, 0 }; /* thanks, apple.. */ 43 static const u8 nvaf[] = { 24, 16, 8, 0 }; /* thanks, apple.. */
44 static const u8 nv50[] = { 16, 8, 0, 24 }; 44 static const u8 nv50[] = { 16, 8, 0, 24 };
45 if (dev_priv->card_type == 0xaf) 45 if (dev_priv->chipset == 0xaf)
46 return nvaf[lane]; 46 return nvaf[lane];
47 return nv50[lane]; 47 return nv50[lane];
48} 48}
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
index de71243b591f..c8187c4b6ae8 100644
--- a/drivers/gpu/drm/radeon/r600.c
+++ b/drivers/gpu/drm/radeon/r600.c
@@ -1135,7 +1135,7 @@ static void r600_vram_gtt_location(struct radeon_device *rdev, struct radeon_mc
1135 } 1135 }
1136 if (rdev->flags & RADEON_IS_AGP) { 1136 if (rdev->flags & RADEON_IS_AGP) {
1137 size_bf = mc->gtt_start; 1137 size_bf = mc->gtt_start;
1138 size_af = 0xFFFFFFFF - mc->gtt_end + 1; 1138 size_af = 0xFFFFFFFF - mc->gtt_end;
1139 if (size_bf > size_af) { 1139 if (size_bf > size_af) {
1140 if (mc->mc_vram_size > size_bf) { 1140 if (mc->mc_vram_size > size_bf) {
1141 dev_warn(rdev->dev, "limiting VRAM\n"); 1141 dev_warn(rdev->dev, "limiting VRAM\n");
@@ -1149,7 +1149,7 @@ static void r600_vram_gtt_location(struct radeon_device *rdev, struct radeon_mc
1149 mc->real_vram_size = size_af; 1149 mc->real_vram_size = size_af;
1150 mc->mc_vram_size = size_af; 1150 mc->mc_vram_size = size_af;
1151 } 1151 }
1152 mc->vram_start = mc->gtt_end; 1152 mc->vram_start = mc->gtt_end + 1;
1153 } 1153 }
1154 mc->vram_end = mc->vram_start + mc->mc_vram_size - 1; 1154 mc->vram_end = mc->vram_start + mc->mc_vram_size - 1;
1155 dev_info(rdev->dev, "VRAM: %lluM 0x%08llX - 0x%08llX (%lluM used)\n", 1155 dev_info(rdev->dev, "VRAM: %lluM 0x%08llX - 0x%08llX (%lluM used)\n",
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c
index bd05156edbdb..3c2e7a000a2a 100644
--- a/drivers/gpu/drm/radeon/radeon_connectors.c
+++ b/drivers/gpu/drm/radeon/radeon_connectors.c
@@ -970,7 +970,7 @@ radeon_dvi_detect(struct drm_connector *connector, bool force)
970 970
971 encoder = obj_to_encoder(obj); 971 encoder = obj_to_encoder(obj);
972 972
973 if (encoder->encoder_type != DRM_MODE_ENCODER_DAC || 973 if (encoder->encoder_type != DRM_MODE_ENCODER_DAC &&
974 encoder->encoder_type != DRM_MODE_ENCODER_TVDAC) 974 encoder->encoder_type != DRM_MODE_ENCODER_TVDAC)
975 continue; 975 continue;
976 976
@@ -1000,6 +1000,7 @@ radeon_dvi_detect(struct drm_connector *connector, bool force)
1000 * cases the DVI port is actually a virtual KVM port connected to the service 1000 * cases the DVI port is actually a virtual KVM port connected to the service
1001 * processor. 1001 * processor.
1002 */ 1002 */
1003out:
1003 if ((!rdev->is_atom_bios) && 1004 if ((!rdev->is_atom_bios) &&
1004 (ret == connector_status_disconnected) && 1005 (ret == connector_status_disconnected) &&
1005 rdev->mode_info.bios_hardcoded_edid_size) { 1006 rdev->mode_info.bios_hardcoded_edid_size) {
@@ -1007,7 +1008,6 @@ radeon_dvi_detect(struct drm_connector *connector, bool force)
1007 ret = connector_status_connected; 1008 ret = connector_status_connected;
1008 } 1009 }
1009 1010
1010out:
1011 /* updated in get modes as well since we need to know if it's analog or digital */ 1011 /* updated in get modes as well since we need to know if it's analog or digital */
1012 radeon_connector_update_scratch_regs(connector, ret); 1012 radeon_connector_update_scratch_regs(connector, ret);
1013 return ret; 1013 return ret;
diff --git a/drivers/gpu/drm/radeon/radeon_irq_kms.c b/drivers/gpu/drm/radeon/radeon_irq_kms.c
index 66d5fe1c8174..65060b77c805 100644
--- a/drivers/gpu/drm/radeon/radeon_irq_kms.c
+++ b/drivers/gpu/drm/radeon/radeon_irq_kms.c
@@ -147,6 +147,12 @@ static bool radeon_msi_ok(struct radeon_device *rdev)
147 (rdev->pdev->subsystem_device == 0x01fd)) 147 (rdev->pdev->subsystem_device == 0x01fd))
148 return true; 148 return true;
149 149
150 /* RV515 seems to have MSI issues where it loses
151 * MSI rearms occasionally. This leads to lockups and freezes.
152 * disable it by default.
153 */
154 if (rdev->family == CHIP_RV515)
155 return false;
150 if (rdev->flags & RADEON_IS_IGP) { 156 if (rdev->flags & RADEON_IS_IGP) {
151 /* APUs work fine with MSIs */ 157 /* APUs work fine with MSIs */
152 if (rdev->family >= CHIP_PALM) 158 if (rdev->family >= CHIP_PALM)
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c
index c62ae4be3845..cdab1aeaed6e 100644
--- a/drivers/gpu/drm/radeon/rv770.c
+++ b/drivers/gpu/drm/radeon/rv770.c
@@ -969,7 +969,7 @@ void r700_vram_gtt_location(struct radeon_device *rdev, struct radeon_mc *mc)
969 } 969 }
970 if (rdev->flags & RADEON_IS_AGP) { 970 if (rdev->flags & RADEON_IS_AGP) {
971 size_bf = mc->gtt_start; 971 size_bf = mc->gtt_start;
972 size_af = 0xFFFFFFFF - mc->gtt_end + 1; 972 size_af = 0xFFFFFFFF - mc->gtt_end;
973 if (size_bf > size_af) { 973 if (size_bf > size_af) {
974 if (mc->mc_vram_size > size_bf) { 974 if (mc->mc_vram_size > size_bf) {
975 dev_warn(rdev->dev, "limiting VRAM\n"); 975 dev_warn(rdev->dev, "limiting VRAM\n");
@@ -983,7 +983,7 @@ void r700_vram_gtt_location(struct radeon_device *rdev, struct radeon_mc *mc)
983 mc->real_vram_size = size_af; 983 mc->real_vram_size = size_af;
984 mc->mc_vram_size = size_af; 984 mc->mc_vram_size = size_af;
985 } 985 }
986 mc->vram_start = mc->gtt_end; 986 mc->vram_start = mc->gtt_end + 1;
987 } 987 }
988 mc->vram_end = mc->vram_start + mc->mc_vram_size - 1; 988 mc->vram_end = mc->vram_start + mc->mc_vram_size - 1;
989 dev_info(rdev->dev, "VRAM: %lluM 0x%08llX - 0x%08llX (%lluM used)\n", 989 dev_info(rdev->dev, "VRAM: %lluM 0x%08llX - 0x%08llX (%lluM used)\n",
diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c
index ac7a199ffece..27bda986fc2b 100644
--- a/drivers/gpu/drm/radeon/si.c
+++ b/drivers/gpu/drm/radeon/si.c
@@ -2999,8 +2999,8 @@ int si_rlc_init(struct radeon_device *rdev)
2999 } 2999 }
3000 r = radeon_bo_pin(rdev->rlc.save_restore_obj, RADEON_GEM_DOMAIN_VRAM, 3000 r = radeon_bo_pin(rdev->rlc.save_restore_obj, RADEON_GEM_DOMAIN_VRAM,
3001 &rdev->rlc.save_restore_gpu_addr); 3001 &rdev->rlc.save_restore_gpu_addr);
3002 radeon_bo_unreserve(rdev->rlc.save_restore_obj);
3002 if (r) { 3003 if (r) {
3003 radeon_bo_unreserve(rdev->rlc.save_restore_obj);
3004 dev_warn(rdev->dev, "(%d) pin RLC sr bo failed\n", r); 3004 dev_warn(rdev->dev, "(%d) pin RLC sr bo failed\n", r);
3005 si_rlc_fini(rdev); 3005 si_rlc_fini(rdev);
3006 return r; 3006 return r;
@@ -3023,9 +3023,8 @@ int si_rlc_init(struct radeon_device *rdev)
3023 } 3023 }
3024 r = radeon_bo_pin(rdev->rlc.clear_state_obj, RADEON_GEM_DOMAIN_VRAM, 3024 r = radeon_bo_pin(rdev->rlc.clear_state_obj, RADEON_GEM_DOMAIN_VRAM,
3025 &rdev->rlc.clear_state_gpu_addr); 3025 &rdev->rlc.clear_state_gpu_addr);
3026 radeon_bo_unreserve(rdev->rlc.clear_state_obj);
3026 if (r) { 3027 if (r) {
3027
3028 radeon_bo_unreserve(rdev->rlc.clear_state_obj);
3029 dev_warn(rdev->dev, "(%d) pin RLC c bo failed\n", r); 3028 dev_warn(rdev->dev, "(%d) pin RLC c bo failed\n", r);
3030 si_rlc_fini(rdev); 3029 si_rlc_fini(rdev);
3031 return r; 3030 return r;
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index a3d033252995..ffddcba32af6 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -34,7 +34,7 @@ config HID
34config HID_BATTERY_STRENGTH 34config HID_BATTERY_STRENGTH
35 bool 35 bool
36 depends on HID && POWER_SUPPLY && HID = POWER_SUPPLY 36 depends on HID && POWER_SUPPLY && HID = POWER_SUPPLY
37 default y 37 default n
38 38
39config HIDRAW 39config HIDRAW
40 bool "/dev/hidraw raw HID device support" 40 bool "/dev/hidraw raw HID device support"
diff --git a/drivers/hid/hid-tivo.c b/drivers/hid/hid-tivo.c
index de47039c708c..9f85f827607f 100644
--- a/drivers/hid/hid-tivo.c
+++ b/drivers/hid/hid-tivo.c
@@ -62,7 +62,7 @@ static int tivo_input_mapping(struct hid_device *hdev, struct hid_input *hi,
62 62
63static const struct hid_device_id tivo_devices[] = { 63static const struct hid_device_id tivo_devices[] = {
64 /* TiVo Slide Bluetooth remote, pairs with a Broadcom dongle */ 64 /* TiVo Slide Bluetooth remote, pairs with a Broadcom dongle */
65 { HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE_BT) }, 65 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE_BT) },
66 { HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE) }, 66 { HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE) },
67 { } 67 { }
68}; 68};
diff --git a/drivers/hwmon/ads1015.c b/drivers/hwmon/ads1015.c
index 7765e4f74ec5..1958f03efd7a 100644
--- a/drivers/hwmon/ads1015.c
+++ b/drivers/hwmon/ads1015.c
@@ -59,14 +59,11 @@ struct ads1015_data {
59 struct ads1015_channel_data channel_data[ADS1015_CHANNELS]; 59 struct ads1015_channel_data channel_data[ADS1015_CHANNELS];
60}; 60};
61 61
62static int ads1015_read_value(struct i2c_client *client, unsigned int channel, 62static int ads1015_read_adc(struct i2c_client *client, unsigned int channel)
63 int *value)
64{ 63{
65 u16 config; 64 u16 config;
66 s16 conversion;
67 struct ads1015_data *data = i2c_get_clientdata(client); 65 struct ads1015_data *data = i2c_get_clientdata(client);
68 unsigned int pga = data->channel_data[channel].pga; 66 unsigned int pga = data->channel_data[channel].pga;
69 int fullscale;
70 unsigned int data_rate = data->channel_data[channel].data_rate; 67 unsigned int data_rate = data->channel_data[channel].data_rate;
71 unsigned int conversion_time_ms; 68 unsigned int conversion_time_ms;
72 int res; 69 int res;
@@ -78,7 +75,6 @@ static int ads1015_read_value(struct i2c_client *client, unsigned int channel,
78 if (res < 0) 75 if (res < 0)
79 goto err_unlock; 76 goto err_unlock;
80 config = res; 77 config = res;
81 fullscale = fullscale_table[pga];
82 conversion_time_ms = DIV_ROUND_UP(1000, data_rate_table[data_rate]); 78 conversion_time_ms = DIV_ROUND_UP(1000, data_rate_table[data_rate]);
83 79
84 /* setup and start single conversion */ 80 /* setup and start single conversion */
@@ -105,33 +101,36 @@ static int ads1015_read_value(struct i2c_client *client, unsigned int channel,
105 } 101 }
106 102
107 res = i2c_smbus_read_word_swapped(client, ADS1015_CONVERSION); 103 res = i2c_smbus_read_word_swapped(client, ADS1015_CONVERSION);
108 if (res < 0)
109 goto err_unlock;
110 conversion = res;
111
112 mutex_unlock(&data->update_lock);
113
114 *value = DIV_ROUND_CLOSEST(conversion * fullscale, 0x7ff0);
115
116 return 0;
117 104
118err_unlock: 105err_unlock:
119 mutex_unlock(&data->update_lock); 106 mutex_unlock(&data->update_lock);
120 return res; 107 return res;
121} 108}
122 109
110static int ads1015_reg_to_mv(struct i2c_client *client, unsigned int channel,
111 s16 reg)
112{
113 struct ads1015_data *data = i2c_get_clientdata(client);
114 unsigned int pga = data->channel_data[channel].pga;
115 int fullscale = fullscale_table[pga];
116
117 return DIV_ROUND_CLOSEST(reg * fullscale, 0x7ff0);
118}
119
123/* sysfs callback function */ 120/* sysfs callback function */
124static ssize_t show_in(struct device *dev, struct device_attribute *da, 121static ssize_t show_in(struct device *dev, struct device_attribute *da,
125 char *buf) 122 char *buf)
126{ 123{
127 struct sensor_device_attribute *attr = to_sensor_dev_attr(da); 124 struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
128 struct i2c_client *client = to_i2c_client(dev); 125 struct i2c_client *client = to_i2c_client(dev);
129 int in;
130 int res; 126 int res;
127 int index = attr->index;
131 128
132 res = ads1015_read_value(client, attr->index, &in); 129 res = ads1015_read_adc(client, index);
130 if (res < 0)
131 return res;
133 132
134 return (res < 0) ? res : sprintf(buf, "%d\n", in); 133 return sprintf(buf, "%d\n", ads1015_reg_to_mv(client, index, res));
135} 134}
136 135
137static const struct sensor_device_attribute ads1015_in[] = { 136static const struct sensor_device_attribute ads1015_in[] = {
diff --git a/drivers/hwmon/fam15h_power.c b/drivers/hwmon/fam15h_power.c
index b7494af1e4a9..37a8fc92b44a 100644
--- a/drivers/hwmon/fam15h_power.c
+++ b/drivers/hwmon/fam15h_power.c
@@ -122,6 +122,38 @@ static bool __devinit fam15h_power_is_internal_node0(struct pci_dev *f4)
122 return true; 122 return true;
123} 123}
124 124
125/*
126 * Newer BKDG versions have an updated recommendation on how to properly
127 * initialize the running average range (was: 0xE, now: 0x9). This avoids
128 * counter saturations resulting in bogus power readings.
129 * We correct this value ourselves to cope with older BIOSes.
130 */
131static void __devinit tweak_runavg_range(struct pci_dev *pdev)
132{
133 u32 val;
134 const struct pci_device_id affected_device = {
135 PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_NB_F4) };
136
137 /*
138 * let this quirk apply only to the current version of the
139 * northbridge, since future versions may change the behavior
140 */
141 if (!pci_match_id(&affected_device, pdev))
142 return;
143
144 pci_bus_read_config_dword(pdev->bus,
145 PCI_DEVFN(PCI_SLOT(pdev->devfn), 5),
146 REG_TDP_RUNNING_AVERAGE, &val);
147 if ((val & 0xf) != 0xe)
148 return;
149
150 val &= ~0xf;
151 val |= 0x9;
152 pci_bus_write_config_dword(pdev->bus,
153 PCI_DEVFN(PCI_SLOT(pdev->devfn), 5),
154 REG_TDP_RUNNING_AVERAGE, val);
155}
156
125static void __devinit fam15h_power_init_data(struct pci_dev *f4, 157static void __devinit fam15h_power_init_data(struct pci_dev *f4,
126 struct fam15h_power_data *data) 158 struct fam15h_power_data *data)
127{ 159{
@@ -155,6 +187,13 @@ static int __devinit fam15h_power_probe(struct pci_dev *pdev,
155 struct device *dev; 187 struct device *dev;
156 int err; 188 int err;
157 189
190 /*
191 * though we ignore every other northbridge, we still have to
192 * do the tweaking on _each_ node in MCM processors as the counters
193 * are working hand-in-hand
194 */
195 tweak_runavg_range(pdev);
196
158 if (!fam15h_power_is_internal_node0(pdev)) { 197 if (!fam15h_power_is_internal_node0(pdev)) {
159 err = -ENODEV; 198 err = -ENODEV;
160 goto exit; 199 goto exit;
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index 2d787796bf50..7faf4a7fcaa9 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -380,8 +380,7 @@ config INPUT_TWL4030_VIBRA
380 380
381config INPUT_TWL6040_VIBRA 381config INPUT_TWL6040_VIBRA
382 tristate "Support for TWL6040 Vibrator" 382 tristate "Support for TWL6040 Vibrator"
383 depends on TWL4030_CORE 383 depends on TWL6040_CORE
384 select TWL6040_CORE
385 select INPUT_FF_MEMLESS 384 select INPUT_FF_MEMLESS
386 help 385 help
387 This option enables support for TWL6040 Vibrator Driver. 386 This option enables support for TWL6040 Vibrator Driver.
diff --git a/drivers/input/misc/twl6040-vibra.c b/drivers/input/misc/twl6040-vibra.c
index 45874fed523a..14e94f56cb7d 100644
--- a/drivers/input/misc/twl6040-vibra.c
+++ b/drivers/input/misc/twl6040-vibra.c
@@ -28,7 +28,7 @@
28#include <linux/module.h> 28#include <linux/module.h>
29#include <linux/platform_device.h> 29#include <linux/platform_device.h>
30#include <linux/workqueue.h> 30#include <linux/workqueue.h>
31#include <linux/i2c/twl.h> 31#include <linux/input.h>
32#include <linux/mfd/twl6040.h> 32#include <linux/mfd/twl6040.h>
33#include <linux/slab.h> 33#include <linux/slab.h>
34#include <linux/delay.h> 34#include <linux/delay.h>
@@ -257,7 +257,7 @@ static SIMPLE_DEV_PM_OPS(twl6040_vibra_pm_ops, twl6040_vibra_suspend, NULL);
257 257
258static int __devinit twl6040_vibra_probe(struct platform_device *pdev) 258static int __devinit twl6040_vibra_probe(struct platform_device *pdev)
259{ 259{
260 struct twl4030_vibra_data *pdata = pdev->dev.platform_data; 260 struct twl6040_vibra_data *pdata = pdev->dev.platform_data;
261 struct vibra_info *info; 261 struct vibra_info *info;
262 int ret; 262 int ret;
263 263
diff --git a/drivers/leds/leds-atmel-pwm.c b/drivers/leds/leds-atmel-pwm.c
index 800243b6037e..64ad702a2ecc 100644
--- a/drivers/leds/leds-atmel-pwm.c
+++ b/drivers/leds/leds-atmel-pwm.c
@@ -35,7 +35,7 @@ static void pwmled_brightness(struct led_classdev *cdev, enum led_brightness b)
35 * NOTE: we reuse the platform_data structure of GPIO leds, 35 * NOTE: we reuse the platform_data structure of GPIO leds,
36 * but repurpose its "gpio" number as a PWM channel number. 36 * but repurpose its "gpio" number as a PWM channel number.
37 */ 37 */
38static int __init pwmled_probe(struct platform_device *pdev) 38static int __devinit pwmled_probe(struct platform_device *pdev)
39{ 39{
40 const struct gpio_led_platform_data *pdata; 40 const struct gpio_led_platform_data *pdata;
41 struct pwmled *leds; 41 struct pwmled *leds;
diff --git a/drivers/media/common/tuners/xc5000.c b/drivers/media/common/tuners/xc5000.c
index 7f98984e4fad..eab2ea424200 100644
--- a/drivers/media/common/tuners/xc5000.c
+++ b/drivers/media/common/tuners/xc5000.c
@@ -54,6 +54,7 @@ struct xc5000_priv {
54 struct list_head hybrid_tuner_instance_list; 54 struct list_head hybrid_tuner_instance_list;
55 55
56 u32 if_khz; 56 u32 if_khz;
57 u32 xtal_khz;
57 u32 freq_hz; 58 u32 freq_hz;
58 u32 bandwidth; 59 u32 bandwidth;
59 u8 video_standard; 60 u8 video_standard;
@@ -214,9 +215,9 @@ static const struct xc5000_fw_cfg xc5000a_1_6_114 = {
214 .size = 12401, 215 .size = 12401,
215}; 216};
216 217
217static const struct xc5000_fw_cfg xc5000c_41_024_5_31875 = { 218static const struct xc5000_fw_cfg xc5000c_41_024_5 = {
218 .name = "dvb-fe-xc5000c-41.024.5-31875.fw", 219 .name = "dvb-fe-xc5000c-41.024.5.fw",
219 .size = 16503, 220 .size = 16497,
220}; 221};
221 222
222static inline const struct xc5000_fw_cfg *xc5000_assign_firmware(int chip_id) 223static inline const struct xc5000_fw_cfg *xc5000_assign_firmware(int chip_id)
@@ -226,7 +227,7 @@ static inline const struct xc5000_fw_cfg *xc5000_assign_firmware(int chip_id)
226 case XC5000A: 227 case XC5000A:
227 return &xc5000a_1_6_114; 228 return &xc5000a_1_6_114;
228 case XC5000C: 229 case XC5000C:
229 return &xc5000c_41_024_5_31875; 230 return &xc5000c_41_024_5;
230 } 231 }
231} 232}
232 233
@@ -572,6 +573,31 @@ static int xc_tune_channel(struct xc5000_priv *priv, u32 freq_hz, int mode)
572 return found; 573 return found;
573} 574}
574 575
576static int xc_set_xtal(struct dvb_frontend *fe)
577{
578 struct xc5000_priv *priv = fe->tuner_priv;
579 int ret = XC_RESULT_SUCCESS;
580
581 switch (priv->chip_id) {
582 default:
583 case XC5000A:
584 /* 32.000 MHz xtal is default */
585 break;
586 case XC5000C:
587 switch (priv->xtal_khz) {
588 default:
589 case 32000:
590 /* 32.000 MHz xtal is default */
591 break;
592 case 31875:
593 /* 31.875 MHz xtal configuration */
594 ret = xc_write_reg(priv, 0x000f, 0x8081);
595 break;
596 }
597 break;
598 }
599 return ret;
600}
575 601
576static int xc5000_fwupload(struct dvb_frontend *fe) 602static int xc5000_fwupload(struct dvb_frontend *fe)
577{ 603{
@@ -603,6 +629,8 @@ static int xc5000_fwupload(struct dvb_frontend *fe)
603 } else { 629 } else {
604 printk(KERN_INFO "xc5000: firmware uploading...\n"); 630 printk(KERN_INFO "xc5000: firmware uploading...\n");
605 ret = xc_load_i2c_sequence(fe, fw->data); 631 ret = xc_load_i2c_sequence(fe, fw->data);
632 if (XC_RESULT_SUCCESS == ret)
633 ret = xc_set_xtal(fe);
606 printk(KERN_INFO "xc5000: firmware upload complete...\n"); 634 printk(KERN_INFO "xc5000: firmware upload complete...\n");
607 } 635 }
608 636
@@ -1164,6 +1192,9 @@ struct dvb_frontend *xc5000_attach(struct dvb_frontend *fe,
1164 priv->if_khz = cfg->if_khz; 1192 priv->if_khz = cfg->if_khz;
1165 } 1193 }
1166 1194
1195 if (priv->xtal_khz == 0)
1196 priv->xtal_khz = cfg->xtal_khz;
1197
1167 if (priv->radio_input == 0) 1198 if (priv->radio_input == 0)
1168 priv->radio_input = cfg->radio_input; 1199 priv->radio_input = cfg->radio_input;
1169 1200
diff --git a/drivers/media/common/tuners/xc5000.h b/drivers/media/common/tuners/xc5000.h
index 3396f8e02b40..39a73bf01406 100644
--- a/drivers/media/common/tuners/xc5000.h
+++ b/drivers/media/common/tuners/xc5000.h
@@ -34,6 +34,7 @@ struct xc5000_config {
34 u8 i2c_address; 34 u8 i2c_address;
35 u32 if_khz; 35 u32 if_khz;
36 u8 radio_input; 36 u8 radio_input;
37 u32 xtal_khz;
37 38
38 int chip_id; 39 int chip_id;
39}; 40};
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c
index 39696c6a4ed7..0f64d7182657 100644
--- a/drivers/media/dvb/dvb-core/dvb_frontend.c
+++ b/drivers/media/dvb/dvb-core/dvb_frontend.c
@@ -1446,6 +1446,28 @@ static int set_delivery_system(struct dvb_frontend *fe, u32 desired_system)
1446 __func__); 1446 __func__);
1447 return -EINVAL; 1447 return -EINVAL;
1448 } 1448 }
1449 /*
1450 * Get a delivery system that is compatible with DVBv3
1451 * NOTE: in order for this to work with softwares like Kaffeine that
1452 * uses a DVBv5 call for DVB-S2 and a DVBv3 call to go back to
1453 * DVB-S, drivers that support both should put the SYS_DVBS entry
1454 * before the SYS_DVBS2, otherwise it won't switch back to DVB-S.
1455 * The real fix is that userspace applications should not use DVBv3
1456 * and not trust on calling FE_SET_FRONTEND to switch the delivery
1457 * system.
1458 */
1459 ncaps = 0;
1460 while (fe->ops.delsys[ncaps] && ncaps < MAX_DELSYS) {
1461 if (fe->ops.delsys[ncaps] == desired_system) {
1462 delsys = desired_system;
1463 break;
1464 }
1465 ncaps++;
1466 }
1467 if (delsys == SYS_UNDEFINED) {
1468 dprintk("%s() Couldn't find a delivery system that matches %d\n",
1469 __func__, desired_system);
1470 }
1449 } else { 1471 } else {
1450 /* 1472 /*
1451 * This is a DVBv5 call. So, it likely knows the supported 1473 * This is a DVBv5 call. So, it likely knows the supported
@@ -1494,9 +1516,10 @@ static int set_delivery_system(struct dvb_frontend *fe, u32 desired_system)
1494 __func__); 1516 __func__);
1495 return -EINVAL; 1517 return -EINVAL;
1496 } 1518 }
1497 c->delivery_system = delsys;
1498 } 1519 }
1499 1520
1521 c->delivery_system = delsys;
1522
1500 /* 1523 /*
1501 * The DVBv3 or DVBv5 call is requesting a different system. So, 1524 * The DVBv3 or DVBv5 call is requesting a different system. So,
1502 * emulation is needed. 1525 * emulation is needed.
diff --git a/drivers/media/dvb/frontends/drxk_hard.c b/drivers/media/dvb/frontends/drxk_hard.c
index 36d11756492f..a414b1f2b6a5 100644
--- a/drivers/media/dvb/frontends/drxk_hard.c
+++ b/drivers/media/dvb/frontends/drxk_hard.c
@@ -1520,8 +1520,10 @@ static int scu_command(struct drxk_state *state,
1520 dprintk(1, "\n"); 1520 dprintk(1, "\n");
1521 1521
1522 if ((cmd == 0) || ((parameterLen > 0) && (parameter == NULL)) || 1522 if ((cmd == 0) || ((parameterLen > 0) && (parameter == NULL)) ||
1523 ((resultLen > 0) && (result == NULL))) 1523 ((resultLen > 0) && (result == NULL))) {
1524 goto error; 1524 printk(KERN_ERR "drxk: Error %d on %s\n", status, __func__);
1525 return status;
1526 }
1525 1527
1526 mutex_lock(&state->mutex); 1528 mutex_lock(&state->mutex);
1527 1529
diff --git a/drivers/media/rc/winbond-cir.c b/drivers/media/rc/winbond-cir.c
index b09c5fae489b..af526586fa26 100644
--- a/drivers/media/rc/winbond-cir.c
+++ b/drivers/media/rc/winbond-cir.c
@@ -1046,6 +1046,7 @@ wbcir_probe(struct pnp_dev *device, const struct pnp_device_id *dev_id)
1046 goto exit_unregister_led; 1046 goto exit_unregister_led;
1047 } 1047 }
1048 1048
1049 data->dev->driver_type = RC_DRIVER_IR_RAW;
1049 data->dev->driver_name = WBCIR_NAME; 1050 data->dev->driver_name = WBCIR_NAME;
1050 data->dev->input_name = WBCIR_NAME; 1051 data->dev->input_name = WBCIR_NAME;
1051 data->dev->input_phys = "wbcir/cir0"; 1052 data->dev->input_phys = "wbcir/cir0";
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig
index f2479c5c0eb2..ce1e7ba940f6 100644
--- a/drivers/media/video/Kconfig
+++ b/drivers/media/video/Kconfig
@@ -492,7 +492,7 @@ config VIDEO_VS6624
492 492
493config VIDEO_MT9M032 493config VIDEO_MT9M032
494 tristate "MT9M032 camera sensor support" 494 tristate "MT9M032 camera sensor support"
495 depends on I2C && VIDEO_V4L2 495 depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
496 select VIDEO_APTINA_PLL 496 select VIDEO_APTINA_PLL
497 ---help--- 497 ---help---
498 This driver supports MT9M032 camera sensors from Aptina, monochrome 498 This driver supports MT9M032 camera sensors from Aptina, monochrome
diff --git a/drivers/media/video/mt9m032.c b/drivers/media/video/mt9m032.c
index 7636672c3548..645973c5feb0 100644
--- a/drivers/media/video/mt9m032.c
+++ b/drivers/media/video/mt9m032.c
@@ -392,10 +392,11 @@ static int mt9m032_set_pad_format(struct v4l2_subdev *subdev,
392 } 392 }
393 393
394 /* Scaling is not supported, the format is thus fixed. */ 394 /* Scaling is not supported, the format is thus fixed. */
395 ret = mt9m032_get_pad_format(subdev, fh, fmt); 395 fmt->format = *__mt9m032_get_pad_format(sensor, fh, fmt->which);
396 ret = 0;
396 397
397done: 398done:
398 mutex_lock(&sensor->lock); 399 mutex_unlock(&sensor->lock);
399 return ret; 400 return ret;
400} 401}
401 402
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 29f463cc09cb..11e44386fa9b 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -268,10 +268,17 @@ config TWL6030_PWM
268 This is used to control charging LED brightness. 268 This is used to control charging LED brightness.
269 269
270config TWL6040_CORE 270config TWL6040_CORE
271 bool 271 bool "Support for TWL6040 audio codec"
272 depends on TWL4030_CORE && GENERIC_HARDIRQS 272 depends on I2C=y && GENERIC_HARDIRQS
273 select MFD_CORE 273 select MFD_CORE
274 select REGMAP_I2C
274 default n 275 default n
276 help
277 Say yes here if you want support for Texas Instruments TWL6040 audio
278 codec.
279 This driver provides common support for accessing the device,
280 additional drivers must be enabled in order to use the
281 functionality of the device (audio, vibra).
275 282
276config MFD_STMPE 283config MFD_STMPE
277 bool "Support STMicroelectronics STMPE" 284 bool "Support STMicroelectronics STMPE"
diff --git a/drivers/mfd/asic3.c b/drivers/mfd/asic3.c
index 1895cf9fab8c..1582c3d95257 100644
--- a/drivers/mfd/asic3.c
+++ b/drivers/mfd/asic3.c
@@ -527,7 +527,9 @@ static void asic3_gpio_set(struct gpio_chip *chip,
527 527
528static int asic3_gpio_to_irq(struct gpio_chip *chip, unsigned offset) 528static int asic3_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
529{ 529{
530 return (offset < ASIC3_NUM_GPIOS) ? IRQ_BOARD_START + offset : -ENXIO; 530 struct asic3 *asic = container_of(chip, struct asic3, gpio);
531
532 return (offset < ASIC3_NUM_GPIOS) ? asic->irq_base + offset : -ENXIO;
531} 533}
532 534
533static __init int asic3_gpio_probe(struct platform_device *pdev, 535static __init int asic3_gpio_probe(struct platform_device *pdev,
diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
index 95a2e546a489..c8aae6640e64 100644
--- a/drivers/mfd/omap-usb-host.c
+++ b/drivers/mfd/omap-usb-host.c
@@ -25,7 +25,6 @@
25#include <linux/clk.h> 25#include <linux/clk.h>
26#include <linux/dma-mapping.h> 26#include <linux/dma-mapping.h>
27#include <linux/spinlock.h> 27#include <linux/spinlock.h>
28#include <linux/gpio.h>
29#include <plat/usb.h> 28#include <plat/usb.h>
30#include <linux/pm_runtime.h> 29#include <linux/pm_runtime.h>
31 30
@@ -502,19 +501,6 @@ static void omap_usbhs_init(struct device *dev)
502 pm_runtime_get_sync(dev); 501 pm_runtime_get_sync(dev);
503 spin_lock_irqsave(&omap->lock, flags); 502 spin_lock_irqsave(&omap->lock, flags);
504 503
505 if (pdata->ehci_data->phy_reset) {
506 if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[0]))
507 gpio_request_one(pdata->ehci_data->reset_gpio_port[0],
508 GPIOF_OUT_INIT_LOW, "USB1 PHY reset");
509
510 if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[1]))
511 gpio_request_one(pdata->ehci_data->reset_gpio_port[1],
512 GPIOF_OUT_INIT_LOW, "USB2 PHY reset");
513
514 /* Hold the PHY in RESET for enough time till DIR is high */
515 udelay(10);
516 }
517
518 omap->usbhs_rev = usbhs_read(omap->uhh_base, OMAP_UHH_REVISION); 504 omap->usbhs_rev = usbhs_read(omap->uhh_base, OMAP_UHH_REVISION);
519 dev_dbg(dev, "OMAP UHH_REVISION 0x%x\n", omap->usbhs_rev); 505 dev_dbg(dev, "OMAP UHH_REVISION 0x%x\n", omap->usbhs_rev);
520 506
@@ -593,39 +579,10 @@ static void omap_usbhs_init(struct device *dev)
593 usbhs_omap_tll_init(dev, OMAP_TLL_CHANNEL_COUNT); 579 usbhs_omap_tll_init(dev, OMAP_TLL_CHANNEL_COUNT);
594 } 580 }
595 581
596 if (pdata->ehci_data->phy_reset) {
597 /* Hold the PHY in RESET for enough time till
598 * PHY is settled and ready
599 */
600 udelay(10);
601
602 if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[0]))
603 gpio_set_value
604 (pdata->ehci_data->reset_gpio_port[0], 1);
605
606 if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[1]))
607 gpio_set_value
608 (pdata->ehci_data->reset_gpio_port[1], 1);
609 }
610
611 spin_unlock_irqrestore(&omap->lock, flags); 582 spin_unlock_irqrestore(&omap->lock, flags);
612 pm_runtime_put_sync(dev); 583 pm_runtime_put_sync(dev);
613} 584}
614 585
615static void omap_usbhs_deinit(struct device *dev)
616{
617 struct usbhs_hcd_omap *omap = dev_get_drvdata(dev);
618 struct usbhs_omap_platform_data *pdata = &omap->platdata;
619
620 if (pdata->ehci_data->phy_reset) {
621 if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[0]))
622 gpio_free(pdata->ehci_data->reset_gpio_port[0]);
623
624 if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[1]))
625 gpio_free(pdata->ehci_data->reset_gpio_port[1]);
626 }
627}
628
629 586
630/** 587/**
631 * usbhs_omap_probe - initialize TI-based HCDs 588 * usbhs_omap_probe - initialize TI-based HCDs
@@ -860,7 +817,6 @@ static int __devexit usbhs_omap_remove(struct platform_device *pdev)
860{ 817{
861 struct usbhs_hcd_omap *omap = platform_get_drvdata(pdev); 818 struct usbhs_hcd_omap *omap = platform_get_drvdata(pdev);
862 819
863 omap_usbhs_deinit(&pdev->dev);
864 iounmap(omap->tll_base); 820 iounmap(omap->tll_base);
865 iounmap(omap->uhh_base); 821 iounmap(omap->uhh_base);
866 clk_put(omap->init_60m_fclk); 822 clk_put(omap->init_60m_fclk);
diff --git a/drivers/mfd/rc5t583.c b/drivers/mfd/rc5t583.c
index 99ef944c621d..44afae0a69ce 100644
--- a/drivers/mfd/rc5t583.c
+++ b/drivers/mfd/rc5t583.c
@@ -80,44 +80,6 @@ static struct mfd_cell rc5t583_subdevs[] = {
80 {.name = "rc5t583-key", } 80 {.name = "rc5t583-key", }
81}; 81};
82 82
83int rc5t583_write(struct device *dev, uint8_t reg, uint8_t val)
84{
85 struct rc5t583 *rc5t583 = dev_get_drvdata(dev);
86 return regmap_write(rc5t583->regmap, reg, val);
87}
88
89int rc5t583_read(struct device *dev, uint8_t reg, uint8_t *val)
90{
91 struct rc5t583 *rc5t583 = dev_get_drvdata(dev);
92 unsigned int ival;
93 int ret;
94 ret = regmap_read(rc5t583->regmap, reg, &ival);
95 if (!ret)
96 *val = (uint8_t)ival;
97 return ret;
98}
99
100int rc5t583_set_bits(struct device *dev, unsigned int reg,
101 unsigned int bit_mask)
102{
103 struct rc5t583 *rc5t583 = dev_get_drvdata(dev);
104 return regmap_update_bits(rc5t583->regmap, reg, bit_mask, bit_mask);
105}
106
107int rc5t583_clear_bits(struct device *dev, unsigned int reg,
108 unsigned int bit_mask)
109{
110 struct rc5t583 *rc5t583 = dev_get_drvdata(dev);
111 return regmap_update_bits(rc5t583->regmap, reg, bit_mask, 0);
112}
113
114int rc5t583_update(struct device *dev, unsigned int reg,
115 unsigned int val, unsigned int mask)
116{
117 struct rc5t583 *rc5t583 = dev_get_drvdata(dev);
118 return regmap_update_bits(rc5t583->regmap, reg, mask, val);
119}
120
121static int __rc5t583_set_ext_pwrreq1_control(struct device *dev, 83static int __rc5t583_set_ext_pwrreq1_control(struct device *dev,
122 int id, int ext_pwr, int slots) 84 int id, int ext_pwr, int slots)
123{ 85{
@@ -197,6 +159,7 @@ int rc5t583_ext_power_req_config(struct device *dev, int ds_id,
197 ds_id, ext_pwr_req); 159 ds_id, ext_pwr_req);
198 return 0; 160 return 0;
199} 161}
162EXPORT_SYMBOL(rc5t583_ext_power_req_config);
200 163
201static int rc5t583_clear_ext_power_req(struct rc5t583 *rc5t583, 164static int rc5t583_clear_ext_power_req(struct rc5t583 *rc5t583,
202 struct rc5t583_platform_data *pdata) 165 struct rc5t583_platform_data *pdata)
diff --git a/drivers/mfd/twl6040-core.c b/drivers/mfd/twl6040-core.c
index b2d8e512d3cb..2d6bedadca09 100644
--- a/drivers/mfd/twl6040-core.c
+++ b/drivers/mfd/twl6040-core.c
@@ -30,7 +30,9 @@
30#include <linux/platform_device.h> 30#include <linux/platform_device.h>
31#include <linux/gpio.h> 31#include <linux/gpio.h>
32#include <linux/delay.h> 32#include <linux/delay.h>
33#include <linux/i2c/twl.h> 33#include <linux/i2c.h>
34#include <linux/regmap.h>
35#include <linux/err.h>
34#include <linux/mfd/core.h> 36#include <linux/mfd/core.h>
35#include <linux/mfd/twl6040.h> 37#include <linux/mfd/twl6040.h>
36 38
@@ -39,7 +41,7 @@
39int twl6040_reg_read(struct twl6040 *twl6040, unsigned int reg) 41int twl6040_reg_read(struct twl6040 *twl6040, unsigned int reg)
40{ 42{
41 int ret; 43 int ret;
42 u8 val = 0; 44 unsigned int val;
43 45
44 mutex_lock(&twl6040->io_mutex); 46 mutex_lock(&twl6040->io_mutex);
45 /* Vibra control registers from cache */ 47 /* Vibra control registers from cache */
@@ -47,7 +49,7 @@ int twl6040_reg_read(struct twl6040 *twl6040, unsigned int reg)
47 reg == TWL6040_REG_VIBCTLR)) { 49 reg == TWL6040_REG_VIBCTLR)) {
48 val = twl6040->vibra_ctrl_cache[VIBRACTRL_MEMBER(reg)]; 50 val = twl6040->vibra_ctrl_cache[VIBRACTRL_MEMBER(reg)];
49 } else { 51 } else {
50 ret = twl_i2c_read_u8(TWL_MODULE_AUDIO_VOICE, &val, reg); 52 ret = regmap_read(twl6040->regmap, reg, &val);
51 if (ret < 0) { 53 if (ret < 0) {
52 mutex_unlock(&twl6040->io_mutex); 54 mutex_unlock(&twl6040->io_mutex);
53 return ret; 55 return ret;
@@ -64,7 +66,7 @@ int twl6040_reg_write(struct twl6040 *twl6040, unsigned int reg, u8 val)
64 int ret; 66 int ret;
65 67
66 mutex_lock(&twl6040->io_mutex); 68 mutex_lock(&twl6040->io_mutex);
67 ret = twl_i2c_write_u8(TWL_MODULE_AUDIO_VOICE, val, reg); 69 ret = regmap_write(twl6040->regmap, reg, val);
68 /* Cache the vibra control registers */ 70 /* Cache the vibra control registers */
69 if (reg == TWL6040_REG_VIBCTLL || reg == TWL6040_REG_VIBCTLR) 71 if (reg == TWL6040_REG_VIBCTLL || reg == TWL6040_REG_VIBCTLR)
70 twl6040->vibra_ctrl_cache[VIBRACTRL_MEMBER(reg)] = val; 72 twl6040->vibra_ctrl_cache[VIBRACTRL_MEMBER(reg)] = val;
@@ -77,16 +79,9 @@ EXPORT_SYMBOL(twl6040_reg_write);
77int twl6040_set_bits(struct twl6040 *twl6040, unsigned int reg, u8 mask) 79int twl6040_set_bits(struct twl6040 *twl6040, unsigned int reg, u8 mask)
78{ 80{
79 int ret; 81 int ret;
80 u8 val;
81 82
82 mutex_lock(&twl6040->io_mutex); 83 mutex_lock(&twl6040->io_mutex);
83 ret = twl_i2c_read_u8(TWL_MODULE_AUDIO_VOICE, &val, reg); 84 ret = regmap_update_bits(twl6040->regmap, reg, mask, mask);
84 if (ret)
85 goto out;
86
87 val |= mask;
88 ret = twl_i2c_write_u8(TWL_MODULE_AUDIO_VOICE, val, reg);
89out:
90 mutex_unlock(&twl6040->io_mutex); 85 mutex_unlock(&twl6040->io_mutex);
91 return ret; 86 return ret;
92} 87}
@@ -95,16 +90,9 @@ EXPORT_SYMBOL(twl6040_set_bits);
95int twl6040_clear_bits(struct twl6040 *twl6040, unsigned int reg, u8 mask) 90int twl6040_clear_bits(struct twl6040 *twl6040, unsigned int reg, u8 mask)
96{ 91{
97 int ret; 92 int ret;
98 u8 val;
99 93
100 mutex_lock(&twl6040->io_mutex); 94 mutex_lock(&twl6040->io_mutex);
101 ret = twl_i2c_read_u8(TWL_MODULE_AUDIO_VOICE, &val, reg); 95 ret = regmap_update_bits(twl6040->regmap, reg, mask, 0);
102 if (ret)
103 goto out;
104
105 val &= ~mask;
106 ret = twl_i2c_write_u8(TWL_MODULE_AUDIO_VOICE, val, reg);
107out:
108 mutex_unlock(&twl6040->io_mutex); 96 mutex_unlock(&twl6040->io_mutex);
109 return ret; 97 return ret;
110} 98}
@@ -494,32 +482,58 @@ static struct resource twl6040_codec_rsrc[] = {
494 }, 482 },
495}; 483};
496 484
497static int __devinit twl6040_probe(struct platform_device *pdev) 485static bool twl6040_readable_reg(struct device *dev, unsigned int reg)
498{ 486{
499 struct twl4030_audio_data *pdata = pdev->dev.platform_data; 487 /* Register 0 is not readable */
488 if (!reg)
489 return false;
490 return true;
491}
492
493static struct regmap_config twl6040_regmap_config = {
494 .reg_bits = 8,
495 .val_bits = 8,
496 .max_register = TWL6040_REG_STATUS, /* 0x2e */
497
498 .readable_reg = twl6040_readable_reg,
499};
500
501static int __devinit twl6040_probe(struct i2c_client *client,
502 const struct i2c_device_id *id)
503{
504 struct twl6040_platform_data *pdata = client->dev.platform_data;
500 struct twl6040 *twl6040; 505 struct twl6040 *twl6040;
501 struct mfd_cell *cell = NULL; 506 struct mfd_cell *cell = NULL;
502 int ret, children = 0; 507 int ret, children = 0;
503 508
504 if (!pdata) { 509 if (!pdata) {
505 dev_err(&pdev->dev, "Platform data is missing\n"); 510 dev_err(&client->dev, "Platform data is missing\n");
506 return -EINVAL; 511 return -EINVAL;
507 } 512 }
508 513
509 /* In order to operate correctly we need valid interrupt config */ 514 /* In order to operate correctly we need valid interrupt config */
510 if (!pdata->naudint_irq || !pdata->irq_base) { 515 if (!client->irq || !pdata->irq_base) {
511 dev_err(&pdev->dev, "Invalid IRQ configuration\n"); 516 dev_err(&client->dev, "Invalid IRQ configuration\n");
512 return -EINVAL; 517 return -EINVAL;
513 } 518 }
514 519
515 twl6040 = kzalloc(sizeof(struct twl6040), GFP_KERNEL); 520 twl6040 = devm_kzalloc(&client->dev, sizeof(struct twl6040),
516 if (!twl6040) 521 GFP_KERNEL);
517 return -ENOMEM; 522 if (!twl6040) {
523 ret = -ENOMEM;
524 goto err;
525 }
526
527 twl6040->regmap = regmap_init_i2c(client, &twl6040_regmap_config);
528 if (IS_ERR(twl6040->regmap)) {
529 ret = PTR_ERR(twl6040->regmap);
530 goto err;
531 }
518 532
519 platform_set_drvdata(pdev, twl6040); 533 i2c_set_clientdata(client, twl6040);
520 534
521 twl6040->dev = &pdev->dev; 535 twl6040->dev = &client->dev;
522 twl6040->irq = pdata->naudint_irq; 536 twl6040->irq = client->irq;
523 twl6040->irq_base = pdata->irq_base; 537 twl6040->irq_base = pdata->irq_base;
524 538
525 mutex_init(&twl6040->mutex); 539 mutex_init(&twl6040->mutex);
@@ -588,12 +602,12 @@ static int __devinit twl6040_probe(struct platform_device *pdev)
588 } 602 }
589 603
590 if (children) { 604 if (children) {
591 ret = mfd_add_devices(&pdev->dev, pdev->id, twl6040->cells, 605 ret = mfd_add_devices(&client->dev, -1, twl6040->cells,
592 children, NULL, 0); 606 children, NULL, 0);
593 if (ret) 607 if (ret)
594 goto mfd_err; 608 goto mfd_err;
595 } else { 609 } else {
596 dev_err(&pdev->dev, "No platform data found for children\n"); 610 dev_err(&client->dev, "No platform data found for children\n");
597 ret = -ENODEV; 611 ret = -ENODEV;
598 goto mfd_err; 612 goto mfd_err;
599 } 613 }
@@ -608,14 +622,15 @@ gpio2_err:
608 if (gpio_is_valid(twl6040->audpwron)) 622 if (gpio_is_valid(twl6040->audpwron))
609 gpio_free(twl6040->audpwron); 623 gpio_free(twl6040->audpwron);
610gpio1_err: 624gpio1_err:
611 platform_set_drvdata(pdev, NULL); 625 i2c_set_clientdata(client, NULL);
612 kfree(twl6040); 626 regmap_exit(twl6040->regmap);
627err:
613 return ret; 628 return ret;
614} 629}
615 630
616static int __devexit twl6040_remove(struct platform_device *pdev) 631static int __devexit twl6040_remove(struct i2c_client *client)
617{ 632{
618 struct twl6040 *twl6040 = platform_get_drvdata(pdev); 633 struct twl6040 *twl6040 = i2c_get_clientdata(client);
619 634
620 if (twl6040->power_count) 635 if (twl6040->power_count)
621 twl6040_power(twl6040, 0); 636 twl6040_power(twl6040, 0);
@@ -626,23 +641,30 @@ static int __devexit twl6040_remove(struct platform_device *pdev)
626 free_irq(twl6040->irq_base + TWL6040_IRQ_READY, twl6040); 641 free_irq(twl6040->irq_base + TWL6040_IRQ_READY, twl6040);
627 twl6040_irq_exit(twl6040); 642 twl6040_irq_exit(twl6040);
628 643
629 mfd_remove_devices(&pdev->dev); 644 mfd_remove_devices(&client->dev);
630 platform_set_drvdata(pdev, NULL); 645 i2c_set_clientdata(client, NULL);
631 kfree(twl6040); 646 regmap_exit(twl6040->regmap);
632 647
633 return 0; 648 return 0;
634} 649}
635 650
636static struct platform_driver twl6040_driver = { 651static const struct i2c_device_id twl6040_i2c_id[] = {
652 { "twl6040", 0, },
653 { },
654};
655MODULE_DEVICE_TABLE(i2c, twl6040_i2c_id);
656
657static struct i2c_driver twl6040_driver = {
658 .driver = {
659 .name = "twl6040",
660 .owner = THIS_MODULE,
661 },
637 .probe = twl6040_probe, 662 .probe = twl6040_probe,
638 .remove = __devexit_p(twl6040_remove), 663 .remove = __devexit_p(twl6040_remove),
639 .driver = { 664 .id_table = twl6040_i2c_id,
640 .owner = THIS_MODULE,
641 .name = "twl6040",
642 },
643}; 665};
644 666
645module_platform_driver(twl6040_driver); 667module_i2c_driver(twl6040_driver);
646 668
647MODULE_DESCRIPTION("TWL6040 MFD"); 669MODULE_DESCRIPTION("TWL6040 MFD");
648MODULE_AUTHOR("Misael Lopez Cruz <misael.lopez@ti.com>"); 670MODULE_AUTHOR("Misael Lopez Cruz <misael.lopez@ti.com>");
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index b1809650b7aa..dabec556ebb8 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -873,7 +873,7 @@ static int mmc_blk_issue_secdiscard_rq(struct mmc_queue *mq,
873{ 873{
874 struct mmc_blk_data *md = mq->data; 874 struct mmc_blk_data *md = mq->data;
875 struct mmc_card *card = md->queue.card; 875 struct mmc_card *card = md->queue.card;
876 unsigned int from, nr, arg; 876 unsigned int from, nr, arg, trim_arg, erase_arg;
877 int err = 0, type = MMC_BLK_SECDISCARD; 877 int err = 0, type = MMC_BLK_SECDISCARD;
878 878
879 if (!(mmc_can_secure_erase_trim(card) || mmc_can_sanitize(card))) { 879 if (!(mmc_can_secure_erase_trim(card) || mmc_can_sanitize(card))) {
@@ -881,20 +881,26 @@ static int mmc_blk_issue_secdiscard_rq(struct mmc_queue *mq,
881 goto out; 881 goto out;
882 } 882 }
883 883
884 from = blk_rq_pos(req);
885 nr = blk_rq_sectors(req);
886
884 /* The sanitize operation is supported at v4.5 only */ 887 /* The sanitize operation is supported at v4.5 only */
885 if (mmc_can_sanitize(card)) { 888 if (mmc_can_sanitize(card)) {
886 err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, 889 erase_arg = MMC_ERASE_ARG;
887 EXT_CSD_SANITIZE_START, 1, 0); 890 trim_arg = MMC_TRIM_ARG;
888 goto out; 891 } else {
892 erase_arg = MMC_SECURE_ERASE_ARG;
893 trim_arg = MMC_SECURE_TRIM1_ARG;
889 } 894 }
890 895
891 from = blk_rq_pos(req); 896 if (mmc_erase_group_aligned(card, from, nr))
892 nr = blk_rq_sectors(req); 897 arg = erase_arg;
893 898 else if (mmc_can_trim(card))
894 if (mmc_can_trim(card) && !mmc_erase_group_aligned(card, from, nr)) 899 arg = trim_arg;
895 arg = MMC_SECURE_TRIM1_ARG; 900 else {
896 else 901 err = -EINVAL;
897 arg = MMC_SECURE_ERASE_ARG; 902 goto out;
903 }
898retry: 904retry:
899 if (card->quirks & MMC_QUIRK_INAND_CMD38) { 905 if (card->quirks & MMC_QUIRK_INAND_CMD38) {
900 err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, 906 err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
@@ -904,25 +910,41 @@ retry:
904 INAND_CMD38_ARG_SECERASE, 910 INAND_CMD38_ARG_SECERASE,
905 0); 911 0);
906 if (err) 912 if (err)
907 goto out; 913 goto out_retry;
908 } 914 }
915
909 err = mmc_erase(card, from, nr, arg); 916 err = mmc_erase(card, from, nr, arg);
910 if (!err && arg == MMC_SECURE_TRIM1_ARG) { 917 if (err == -EIO)
918 goto out_retry;
919 if (err)
920 goto out;
921
922 if (arg == MMC_SECURE_TRIM1_ARG) {
911 if (card->quirks & MMC_QUIRK_INAND_CMD38) { 923 if (card->quirks & MMC_QUIRK_INAND_CMD38) {
912 err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, 924 err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
913 INAND_CMD38_ARG_EXT_CSD, 925 INAND_CMD38_ARG_EXT_CSD,
914 INAND_CMD38_ARG_SECTRIM2, 926 INAND_CMD38_ARG_SECTRIM2,
915 0); 927 0);
916 if (err) 928 if (err)
917 goto out; 929 goto out_retry;
918 } 930 }
931
919 err = mmc_erase(card, from, nr, MMC_SECURE_TRIM2_ARG); 932 err = mmc_erase(card, from, nr, MMC_SECURE_TRIM2_ARG);
933 if (err == -EIO)
934 goto out_retry;
935 if (err)
936 goto out;
920 } 937 }
921out: 938
922 if (err == -EIO && !mmc_blk_reset(md, card->host, type)) 939 if (mmc_can_sanitize(card))
940 err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
941 EXT_CSD_SANITIZE_START, 1, 0);
942out_retry:
943 if (err && !mmc_blk_reset(md, card->host, type))
923 goto retry; 944 goto retry;
924 if (!err) 945 if (!err)
925 mmc_blk_reset_success(md, type); 946 mmc_blk_reset_success(md, type);
947out:
926 spin_lock_irq(&md->lock); 948 spin_lock_irq(&md->lock);
927 __blk_end_request(req, err, blk_rq_bytes(req)); 949 __blk_end_request(req, err, blk_rq_bytes(req));
928 spin_unlock_irq(&md->lock); 950 spin_unlock_irq(&md->lock);
@@ -1802,7 +1824,7 @@ static void mmc_blk_remove(struct mmc_card *card)
1802} 1824}
1803 1825
1804#ifdef CONFIG_PM 1826#ifdef CONFIG_PM
1805static int mmc_blk_suspend(struct mmc_card *card, pm_message_t state) 1827static int mmc_blk_suspend(struct mmc_card *card)
1806{ 1828{
1807 struct mmc_blk_data *part_md; 1829 struct mmc_blk_data *part_md;
1808 struct mmc_blk_data *md = mmc_get_drvdata(card); 1830 struct mmc_blk_data *md = mmc_get_drvdata(card);
diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c
index 2517547b4366..996f8e36e23d 100644
--- a/drivers/mmc/card/queue.c
+++ b/drivers/mmc/card/queue.c
@@ -139,7 +139,7 @@ static void mmc_queue_setup_discard(struct request_queue *q,
139 139
140 queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, q); 140 queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, q);
141 q->limits.max_discard_sectors = max_discard; 141 q->limits.max_discard_sectors = max_discard;
142 if (card->erased_byte == 0) 142 if (card->erased_byte == 0 && !mmc_can_discard(card))
143 q->limits.discard_zeroes_data = 1; 143 q->limits.discard_zeroes_data = 1;
144 q->limits.discard_granularity = card->pref_erase << 9; 144 q->limits.discard_granularity = card->pref_erase << 9;
145 /* granularity must not be greater than max. discard */ 145 /* granularity must not be greater than max. discard */
diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c
index 3f606068d552..c60cee92a2b2 100644
--- a/drivers/mmc/core/bus.c
+++ b/drivers/mmc/core/bus.c
@@ -122,14 +122,14 @@ static int mmc_bus_remove(struct device *dev)
122 return 0; 122 return 0;
123} 123}
124 124
125static int mmc_bus_suspend(struct device *dev, pm_message_t state) 125static int mmc_bus_suspend(struct device *dev)
126{ 126{
127 struct mmc_driver *drv = to_mmc_driver(dev->driver); 127 struct mmc_driver *drv = to_mmc_driver(dev->driver);
128 struct mmc_card *card = mmc_dev_to_card(dev); 128 struct mmc_card *card = mmc_dev_to_card(dev);
129 int ret = 0; 129 int ret = 0;
130 130
131 if (dev->driver && drv->suspend) 131 if (dev->driver && drv->suspend)
132 ret = drv->suspend(card, state); 132 ret = drv->suspend(card);
133 return ret; 133 return ret;
134} 134}
135 135
@@ -165,20 +165,14 @@ static int mmc_runtime_idle(struct device *dev)
165 return pm_runtime_suspend(dev); 165 return pm_runtime_suspend(dev);
166} 166}
167 167
168#endif /* !CONFIG_PM_RUNTIME */
169
168static const struct dev_pm_ops mmc_bus_pm_ops = { 170static const struct dev_pm_ops mmc_bus_pm_ops = {
169 .runtime_suspend = mmc_runtime_suspend, 171 SET_RUNTIME_PM_OPS(mmc_runtime_suspend, mmc_runtime_resume,
170 .runtime_resume = mmc_runtime_resume, 172 mmc_runtime_idle)
171 .runtime_idle = mmc_runtime_idle, 173 SET_SYSTEM_SLEEP_PM_OPS(mmc_bus_suspend, mmc_bus_resume)
172}; 174};
173 175
174#define MMC_PM_OPS_PTR (&mmc_bus_pm_ops)
175
176#else /* !CONFIG_PM_RUNTIME */
177
178#define MMC_PM_OPS_PTR NULL
179
180#endif /* !CONFIG_PM_RUNTIME */
181
182static struct bus_type mmc_bus_type = { 176static struct bus_type mmc_bus_type = {
183 .name = "mmc", 177 .name = "mmc",
184 .dev_attrs = mmc_dev_attrs, 178 .dev_attrs = mmc_dev_attrs,
@@ -186,9 +180,7 @@ static struct bus_type mmc_bus_type = {
186 .uevent = mmc_bus_uevent, 180 .uevent = mmc_bus_uevent,
187 .probe = mmc_bus_probe, 181 .probe = mmc_bus_probe,
188 .remove = mmc_bus_remove, 182 .remove = mmc_bus_remove,
189 .suspend = mmc_bus_suspend, 183 .pm = &mmc_bus_pm_ops,
190 .resume = mmc_bus_resume,
191 .pm = MMC_PM_OPS_PTR,
192}; 184};
193 185
194int mmc_register_bus(void) 186int mmc_register_bus(void)
diff --git a/drivers/mmc/core/cd-gpio.c b/drivers/mmc/core/cd-gpio.c
index 29de31e260dd..2c14be73254c 100644
--- a/drivers/mmc/core/cd-gpio.c
+++ b/drivers/mmc/core/cd-gpio.c
@@ -12,6 +12,7 @@
12#include <linux/gpio.h> 12#include <linux/gpio.h>
13#include <linux/interrupt.h> 13#include <linux/interrupt.h>
14#include <linux/jiffies.h> 14#include <linux/jiffies.h>
15#include <linux/mmc/cd-gpio.h>
15#include <linux/mmc/host.h> 16#include <linux/mmc/host.h>
16#include <linux/module.h> 17#include <linux/module.h>
17#include <linux/slab.h> 18#include <linux/slab.h>
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 7474c47b9c08..ba821fe70bca 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -1409,7 +1409,10 @@ static unsigned int mmc_mmc_erase_timeout(struct mmc_card *card,
1409{ 1409{
1410 unsigned int erase_timeout; 1410 unsigned int erase_timeout;
1411 1411
1412 if (card->ext_csd.erase_group_def & 1) { 1412 if (arg == MMC_DISCARD_ARG ||
1413 (arg == MMC_TRIM_ARG && card->ext_csd.rev >= 6)) {
1414 erase_timeout = card->ext_csd.trim_timeout;
1415 } else if (card->ext_csd.erase_group_def & 1) {
1413 /* High Capacity Erase Group Size uses HC timeouts */ 1416 /* High Capacity Erase Group Size uses HC timeouts */
1414 if (arg == MMC_TRIM_ARG) 1417 if (arg == MMC_TRIM_ARG)
1415 erase_timeout = card->ext_csd.trim_timeout; 1418 erase_timeout = card->ext_csd.trim_timeout;
@@ -1681,8 +1684,6 @@ int mmc_can_trim(struct mmc_card *card)
1681{ 1684{
1682 if (card->ext_csd.sec_feature_support & EXT_CSD_SEC_GB_CL_EN) 1685 if (card->ext_csd.sec_feature_support & EXT_CSD_SEC_GB_CL_EN)
1683 return 1; 1686 return 1;
1684 if (mmc_can_discard(card))
1685 return 1;
1686 return 0; 1687 return 0;
1687} 1688}
1688EXPORT_SYMBOL(mmc_can_trim); 1689EXPORT_SYMBOL(mmc_can_trim);
@@ -1701,6 +1702,8 @@ EXPORT_SYMBOL(mmc_can_discard);
1701 1702
1702int mmc_can_sanitize(struct mmc_card *card) 1703int mmc_can_sanitize(struct mmc_card *card)
1703{ 1704{
1705 if (!mmc_can_trim(card) && !mmc_can_erase(card))
1706 return 0;
1704 if (card->ext_csd.sec_feature_support & EXT_CSD_SEC_SANITIZE) 1707 if (card->ext_csd.sec_feature_support & EXT_CSD_SEC_SANITIZE)
1705 return 1; 1708 return 1;
1706 return 0; 1709 return 0;
@@ -2235,6 +2238,7 @@ int mmc_cache_ctrl(struct mmc_host *host, u8 enable)
2235 mmc_card_is_removable(host)) 2238 mmc_card_is_removable(host))
2236 return err; 2239 return err;
2237 2240
2241 mmc_claim_host(host);
2238 if (card && mmc_card_mmc(card) && 2242 if (card && mmc_card_mmc(card) &&
2239 (card->ext_csd.cache_size > 0)) { 2243 (card->ext_csd.cache_size > 0)) {
2240 enable = !!enable; 2244 enable = !!enable;
@@ -2252,6 +2256,7 @@ int mmc_cache_ctrl(struct mmc_host *host, u8 enable)
2252 card->ext_csd.cache_ctrl = enable; 2256 card->ext_csd.cache_ctrl = enable;
2253 } 2257 }
2254 } 2258 }
2259 mmc_release_host(host);
2255 2260
2256 return err; 2261 return err;
2257} 2262}
@@ -2269,49 +2274,32 @@ int mmc_suspend_host(struct mmc_host *host)
2269 2274
2270 cancel_delayed_work(&host->detect); 2275 cancel_delayed_work(&host->detect);
2271 mmc_flush_scheduled_work(); 2276 mmc_flush_scheduled_work();
2272 if (mmc_try_claim_host(host)) {
2273 err = mmc_cache_ctrl(host, 0);
2274 mmc_release_host(host);
2275 } else {
2276 err = -EBUSY;
2277 }
2278 2277
2278 err = mmc_cache_ctrl(host, 0);
2279 if (err) 2279 if (err)
2280 goto out; 2280 goto out;
2281 2281
2282 mmc_bus_get(host); 2282 mmc_bus_get(host);
2283 if (host->bus_ops && !host->bus_dead) { 2283 if (host->bus_ops && !host->bus_dead) {
2284 2284
2285 /* 2285 if (host->bus_ops->suspend)
2286 * A long response time is not acceptable for device drivers 2286 err = host->bus_ops->suspend(host);
2287 * when doing suspend. Prevent mmc_claim_host in the suspend
2288 * sequence, to potentially wait "forever" by trying to
2289 * pre-claim the host.
2290 */
2291 if (mmc_try_claim_host(host)) {
2292 if (host->bus_ops->suspend) {
2293 err = host->bus_ops->suspend(host);
2294 }
2295 mmc_release_host(host);
2296 2287
2297 if (err == -ENOSYS || !host->bus_ops->resume) { 2288 if (err == -ENOSYS || !host->bus_ops->resume) {
2298 /* 2289 /*
2299 * We simply "remove" the card in this case. 2290 * We simply "remove" the card in this case.
2300 * It will be redetected on resume. (Calling 2291 * It will be redetected on resume. (Calling
2301 * bus_ops->remove() with a claimed host can 2292 * bus_ops->remove() with a claimed host can
2302 * deadlock.) 2293 * deadlock.)
2303 */ 2294 */
2304 if (host->bus_ops->remove) 2295 if (host->bus_ops->remove)
2305 host->bus_ops->remove(host); 2296 host->bus_ops->remove(host);
2306 mmc_claim_host(host); 2297 mmc_claim_host(host);
2307 mmc_detach_bus(host); 2298 mmc_detach_bus(host);
2308 mmc_power_off(host); 2299 mmc_power_off(host);
2309 mmc_release_host(host); 2300 mmc_release_host(host);
2310 host->pm_flags = 0; 2301 host->pm_flags = 0;
2311 err = 0; 2302 err = 0;
2312 }
2313 } else {
2314 err = -EBUSY;
2315 } 2303 }
2316 } 2304 }
2317 mmc_bus_put(host); 2305 mmc_bus_put(host);
diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index bf3c9b456aaf..ab3fc4617107 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -526,8 +526,10 @@ static int dw_mci_submit_data_dma(struct dw_mci *host, struct mmc_data *data)
526 return -ENODEV; 526 return -ENODEV;
527 527
528 sg_len = dw_mci_pre_dma_transfer(host, data, 0); 528 sg_len = dw_mci_pre_dma_transfer(host, data, 0);
529 if (sg_len < 0) 529 if (sg_len < 0) {
530 host->dma_ops->stop(host);
530 return sg_len; 531 return sg_len;
532 }
531 533
532 host->using_dma = 1; 534 host->using_dma = 1;
533 535
@@ -1879,7 +1881,8 @@ static void dw_mci_init_dma(struct dw_mci *host)
1879 if (!host->dma_ops) 1881 if (!host->dma_ops)
1880 goto no_dma; 1882 goto no_dma;
1881 1883
1882 if (host->dma_ops->init) { 1884 if (host->dma_ops->init && host->dma_ops->start &&
1885 host->dma_ops->stop && host->dma_ops->cleanup) {
1883 if (host->dma_ops->init(host)) { 1886 if (host->dma_ops->init(host)) {
1884 dev_err(&host->dev, "%s: Unable to initialize " 1887 dev_err(&host->dev, "%s: Unable to initialize "
1885 "DMA Controller.\n", __func__); 1888 "DMA Controller.\n", __func__);
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 5c2b1c10af9c..56d4499d4388 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -249,7 +249,7 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on,
249 * the pbias cell programming support is still missing when 249 * the pbias cell programming support is still missing when
250 * booting with Device tree 250 * booting with Device tree
251 */ 251 */
252 if (of_have_populated_dt() && !vdd) 252 if (dev->of_node && !vdd)
253 return 0; 253 return 0;
254 254
255 if (mmc_slot(host).before_set_reg) 255 if (mmc_slot(host).before_set_reg)
@@ -1549,7 +1549,7 @@ static void omap_hsmmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
1549 * can't be allowed when booting with device 1549 * can't be allowed when booting with device
1550 * tree. 1550 * tree.
1551 */ 1551 */
1552 (!of_have_populated_dt())) { 1552 !host->dev->of_node) {
1553 /* 1553 /*
1554 * The mmc_select_voltage fn of the core does 1554 * The mmc_select_voltage fn of the core does
1555 * not seem to set the power_mode to 1555 * not seem to set the power_mode to
@@ -1741,7 +1741,7 @@ static const struct of_device_id omap_mmc_of_match[] = {
1741 .data = &omap4_reg_offset, 1741 .data = &omap4_reg_offset,
1742 }, 1742 },
1743 {}, 1743 {},
1744} 1744};
1745MODULE_DEVICE_TABLE(of, omap_mmc_of_match); 1745MODULE_DEVICE_TABLE(of, omap_mmc_of_match);
1746 1746
1747static struct omap_mmc_platform_data *of_get_hsmmc_pdata(struct device *dev) 1747static struct omap_mmc_platform_data *of_get_hsmmc_pdata(struct device *dev)
diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index 6193a0d7bde5..8abdaf6697a8 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -467,8 +467,7 @@ static int __devinit sdhci_esdhc_imx_probe(struct platform_device *pdev)
467 clk_prepare_enable(clk); 467 clk_prepare_enable(clk);
468 pltfm_host->clk = clk; 468 pltfm_host->clk = clk;
469 469
470 if (!is_imx25_esdhc(imx_data)) 470 host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL;
471 host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL;
472 471
473 if (is_imx25_esdhc(imx_data) || is_imx35_esdhc(imx_data)) 472 if (is_imx25_esdhc(imx_data) || is_imx35_esdhc(imx_data))
474 /* Fix errata ENGcm07207 present on i.MX25 and i.MX35 */ 473 /* Fix errata ENGcm07207 present on i.MX25 and i.MX35 */
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 9aa77f3f04a8..ccefdebeff14 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -147,7 +147,7 @@ static void sdhci_set_card_detection(struct sdhci_host *host, bool enable)
147 u32 present, irqs; 147 u32 present, irqs;
148 148
149 if ((host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION) || 149 if ((host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION) ||
150 !mmc_card_is_removable(host->mmc)) 150 (host->mmc->caps & MMC_CAP_NONREMOVABLE))
151 return; 151 return;
152 152
153 present = sdhci_readl(host, SDHCI_PRESENT_STATE) & 153 present = sdhci_readl(host, SDHCI_PRESENT_STATE) &
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index d20f1334792b..111569ccab43 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -991,8 +991,8 @@ static void pci_restore_config_dword(struct pci_dev *pdev, int offset,
991 } 991 }
992} 992}
993 993
994static void pci_restore_config_space(struct pci_dev *pdev, int start, int end, 994static void pci_restore_config_space_range(struct pci_dev *pdev,
995 int retry) 995 int start, int end, int retry)
996{ 996{
997 int index; 997 int index;
998 998
@@ -1002,6 +1002,18 @@ static void pci_restore_config_space(struct pci_dev *pdev, int start, int end,
1002 retry); 1002 retry);
1003} 1003}
1004 1004
1005static void pci_restore_config_space(struct pci_dev *pdev)
1006{
1007 if (pdev->hdr_type == PCI_HEADER_TYPE_NORMAL) {
1008 pci_restore_config_space_range(pdev, 10, 15, 0);
1009 /* Restore BARs before the command register. */
1010 pci_restore_config_space_range(pdev, 4, 9, 10);
1011 pci_restore_config_space_range(pdev, 0, 3, 0);
1012 } else {
1013 pci_restore_config_space_range(pdev, 0, 15, 0);
1014 }
1015}
1016
1005/** 1017/**
1006 * pci_restore_state - Restore the saved state of a PCI device 1018 * pci_restore_state - Restore the saved state of a PCI device
1007 * @dev: - PCI device that we're dealing with 1019 * @dev: - PCI device that we're dealing with
@@ -1015,13 +1027,7 @@ void pci_restore_state(struct pci_dev *dev)
1015 pci_restore_pcie_state(dev); 1027 pci_restore_pcie_state(dev);
1016 pci_restore_ats_state(dev); 1028 pci_restore_ats_state(dev);
1017 1029
1018 pci_restore_config_space(dev, 10, 15, 0); 1030 pci_restore_config_space(dev);
1019 /*
1020 * The Base Address register should be programmed before the command
1021 * register(s)
1022 */
1023 pci_restore_config_space(dev, 4, 9, 10);
1024 pci_restore_config_space(dev, 0, 3, 0);
1025 1031
1026 pci_restore_pcix_state(dev); 1032 pci_restore_pcix_state(dev);
1027 pci_restore_msi_state(dev); 1033 pci_restore_msi_state(dev);
diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index ec3b8cc188af..df6296c5f47b 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -908,10 +908,6 @@ static int pinctrl_groups_show(struct seq_file *s, void *what)
908 const struct pinctrl_ops *ops = pctldev->desc->pctlops; 908 const struct pinctrl_ops *ops = pctldev->desc->pctlops;
909 unsigned selector = 0; 909 unsigned selector = 0;
910 910
911 /* No grouping */
912 if (!ops)
913 return 0;
914
915 mutex_lock(&pinctrl_mutex); 911 mutex_lock(&pinctrl_mutex);
916 912
917 seq_puts(s, "registered pin groups:\n"); 913 seq_puts(s, "registered pin groups:\n");
@@ -1225,6 +1221,19 @@ static void pinctrl_remove_device_debugfs(struct pinctrl_dev *pctldev)
1225 1221
1226#endif 1222#endif
1227 1223
1224static int pinctrl_check_ops(struct pinctrl_dev *pctldev)
1225{
1226 const struct pinctrl_ops *ops = pctldev->desc->pctlops;
1227
1228 if (!ops ||
1229 !ops->list_groups ||
1230 !ops->get_group_name ||
1231 !ops->get_group_pins)
1232 return -EINVAL;
1233
1234 return 0;
1235}
1236
1228/** 1237/**
1229 * pinctrl_register() - register a pin controller device 1238 * pinctrl_register() - register a pin controller device
1230 * @pctldesc: descriptor for this pin controller 1239 * @pctldesc: descriptor for this pin controller
@@ -1256,6 +1265,14 @@ struct pinctrl_dev *pinctrl_register(struct pinctrl_desc *pctldesc,
1256 INIT_LIST_HEAD(&pctldev->gpio_ranges); 1265 INIT_LIST_HEAD(&pctldev->gpio_ranges);
1257 pctldev->dev = dev; 1266 pctldev->dev = dev;
1258 1267
1268 /* check core ops for sanity */
1269 ret = pinctrl_check_ops(pctldev);
1270 if (ret) {
1271 pr_err("%s pinctrl ops lacks necessary functions\n",
1272 pctldesc->name);
1273 goto out_err;
1274 }
1275
1259 /* If we're implementing pinmuxing, check the ops for sanity */ 1276 /* If we're implementing pinmuxing, check the ops for sanity */
1260 if (pctldesc->pmxops) { 1277 if (pctldesc->pmxops) {
1261 ret = pinmux_check_ops(pctldev); 1278 ret = pinmux_check_ops(pctldev);
diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c
index c21871a4e73d..bc2e8a7c265b 100644
--- a/drivers/s390/block/dasd_eckd.c
+++ b/drivers/s390/block/dasd_eckd.c
@@ -2844,6 +2844,7 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_tpm_track(
2844 sector_t recid, trkid; 2844 sector_t recid, trkid;
2845 unsigned int offs; 2845 unsigned int offs;
2846 unsigned int count, count_to_trk_end; 2846 unsigned int count, count_to_trk_end;
2847 int ret;
2847 2848
2848 basedev = block->base; 2849 basedev = block->base;
2849 if (rq_data_dir(req) == READ) { 2850 if (rq_data_dir(req) == READ) {
@@ -2884,8 +2885,8 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_tpm_track(
2884 2885
2885 itcw = itcw_init(cqr->data, itcw_size, itcw_op, 0, ctidaw, 0); 2886 itcw = itcw_init(cqr->data, itcw_size, itcw_op, 0, ctidaw, 0);
2886 if (IS_ERR(itcw)) { 2887 if (IS_ERR(itcw)) {
2887 dasd_sfree_request(cqr, startdev); 2888 ret = -EINVAL;
2888 return ERR_PTR(-EINVAL); 2889 goto out_error;
2889 } 2890 }
2890 cqr->cpaddr = itcw_get_tcw(itcw); 2891 cqr->cpaddr = itcw_get_tcw(itcw);
2891 if (prepare_itcw(itcw, first_trk, last_trk, 2892 if (prepare_itcw(itcw, first_trk, last_trk,
@@ -2897,8 +2898,8 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_tpm_track(
2897 /* Clock not in sync and XRC is enabled. 2898 /* Clock not in sync and XRC is enabled.
2898 * Try again later. 2899 * Try again later.
2899 */ 2900 */
2900 dasd_sfree_request(cqr, startdev); 2901 ret = -EAGAIN;
2901 return ERR_PTR(-EAGAIN); 2902 goto out_error;
2902 } 2903 }
2903 len_to_track_end = 0; 2904 len_to_track_end = 0;
2904 /* 2905 /*
@@ -2937,8 +2938,10 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_tpm_track(
2937 tidaw_flags = 0; 2938 tidaw_flags = 0;
2938 last_tidaw = itcw_add_tidaw(itcw, tidaw_flags, 2939 last_tidaw = itcw_add_tidaw(itcw, tidaw_flags,
2939 dst, part_len); 2940 dst, part_len);
2940 if (IS_ERR(last_tidaw)) 2941 if (IS_ERR(last_tidaw)) {
2941 return ERR_PTR(-EINVAL); 2942 ret = -EINVAL;
2943 goto out_error;
2944 }
2942 dst += part_len; 2945 dst += part_len;
2943 } 2946 }
2944 } 2947 }
@@ -2947,8 +2950,10 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_tpm_track(
2947 dst = page_address(bv->bv_page) + bv->bv_offset; 2950 dst = page_address(bv->bv_page) + bv->bv_offset;
2948 last_tidaw = itcw_add_tidaw(itcw, 0x00, 2951 last_tidaw = itcw_add_tidaw(itcw, 0x00,
2949 dst, bv->bv_len); 2952 dst, bv->bv_len);
2950 if (IS_ERR(last_tidaw)) 2953 if (IS_ERR(last_tidaw)) {
2951 return ERR_PTR(-EINVAL); 2954 ret = -EINVAL;
2955 goto out_error;
2956 }
2952 } 2957 }
2953 } 2958 }
2954 last_tidaw->flags |= TIDAW_FLAGS_LAST; 2959 last_tidaw->flags |= TIDAW_FLAGS_LAST;
@@ -2968,6 +2973,9 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_tpm_track(
2968 cqr->buildclk = get_clock(); 2973 cqr->buildclk = get_clock();
2969 cqr->status = DASD_CQR_FILLED; 2974 cqr->status = DASD_CQR_FILLED;
2970 return cqr; 2975 return cqr;
2976out_error:
2977 dasd_sfree_request(cqr, startdev);
2978 return ERR_PTR(ret);
2971} 2979}
2972 2980
2973static struct dasd_ccw_req *dasd_eckd_build_cp(struct dasd_device *startdev, 2981static struct dasd_ccw_req *dasd_eckd_build_cp(struct dasd_device *startdev,
diff --git a/drivers/s390/char/vmur.c b/drivers/s390/char/vmur.c
index 85f4a9a5d12e..73bef0bd394c 100644
--- a/drivers/s390/char/vmur.c
+++ b/drivers/s390/char/vmur.c
@@ -903,7 +903,7 @@ static int ur_set_online(struct ccw_device *cdev)
903 goto fail_urdev_put; 903 goto fail_urdev_put;
904 } 904 }
905 905
906 cdev_init(urd->char_device, &ur_fops); 906 urd->char_device->ops = &ur_fops;
907 urd->char_device->dev = MKDEV(major, minor); 907 urd->char_device->dev = MKDEV(major, minor);
908 urd->char_device->owner = ur_fops.owner; 908 urd->char_device->owner = ur_fops.owner;
909 909
diff --git a/drivers/tty/amiserial.c b/drivers/tty/amiserial.c
index 24145c30c9b0..6cc4358f68c1 100644
--- a/drivers/tty/amiserial.c
+++ b/drivers/tty/amiserial.c
@@ -1073,8 +1073,10 @@ static int set_serial_info(struct tty_struct *tty, struct serial_state *state,
1073 (new_serial.close_delay != port->close_delay) || 1073 (new_serial.close_delay != port->close_delay) ||
1074 (new_serial.xmit_fifo_size != state->xmit_fifo_size) || 1074 (new_serial.xmit_fifo_size != state->xmit_fifo_size) ||
1075 ((new_serial.flags & ~ASYNC_USR_MASK) != 1075 ((new_serial.flags & ~ASYNC_USR_MASK) !=
1076 (port->flags & ~ASYNC_USR_MASK))) 1076 (port->flags & ~ASYNC_USR_MASK))) {
1077 tty_unlock();
1077 return -EPERM; 1078 return -EPERM;
1079 }
1078 port->flags = ((port->flags & ~ASYNC_USR_MASK) | 1080 port->flags = ((port->flags & ~ASYNC_USR_MASK) |
1079 (new_serial.flags & ASYNC_USR_MASK)); 1081 (new_serial.flags & ASYNC_USR_MASK));
1080 state->custom_divisor = new_serial.custom_divisor; 1082 state->custom_divisor = new_serial.custom_divisor;
diff --git a/drivers/tty/serial/clps711x.c b/drivers/tty/serial/clps711x.c
index e6c3dbd781d6..836fe2731234 100644
--- a/drivers/tty/serial/clps711x.c
+++ b/drivers/tty/serial/clps711x.c
@@ -154,10 +154,9 @@ static irqreturn_t clps711xuart_int_tx(int irq, void *dev_id)
154 port->x_char = 0; 154 port->x_char = 0;
155 return IRQ_HANDLED; 155 return IRQ_HANDLED;
156 } 156 }
157 if (uart_circ_empty(xmit) || uart_tx_stopped(port)) { 157
158 clps711xuart_stop_tx(port); 158 if (uart_circ_empty(xmit) || uart_tx_stopped(port))
159 return IRQ_HANDLED; 159 goto disable_tx_irq;
160 }
161 160
162 count = port->fifosize >> 1; 161 count = port->fifosize >> 1;
163 do { 162 do {
@@ -171,8 +170,11 @@ static irqreturn_t clps711xuart_int_tx(int irq, void *dev_id)
171 if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) 170 if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
172 uart_write_wakeup(port); 171 uart_write_wakeup(port);
173 172
174 if (uart_circ_empty(xmit)) 173 if (uart_circ_empty(xmit)) {
175 clps711xuart_stop_tx(port); 174 disable_tx_irq:
175 disable_irq_nosync(TX_IRQ(port));
176 tx_enabled(port) = 0;
177 }
176 178
177 return IRQ_HANDLED; 179 return IRQ_HANDLED;
178} 180}
diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c
index a5e63438584f..4fdec6a6b758 100644
--- a/drivers/tty/serial/pch_uart.c
+++ b/drivers/tty/serial/pch_uart.c
@@ -1455,8 +1455,10 @@ static int pch_uart_verify_port(struct uart_port *port,
1455 __func__); 1455 __func__);
1456 return -EOPNOTSUPP; 1456 return -EOPNOTSUPP;
1457#endif 1457#endif
1458 priv->use_dma = 1;
1459 dev_info(priv->port.dev, "PCH UART : Use DMA Mode\n"); 1458 dev_info(priv->port.dev, "PCH UART : Use DMA Mode\n");
1459 if (!priv->use_dma)
1460 pch_request_dma(port);
1461 priv->use_dma = 1;
1460 } 1462 }
1461 1463
1462 return 0; 1464 return 0;
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index a2aa9d652c67..ec6c97dadbe4 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -1667,7 +1667,6 @@ void usb_disconnect(struct usb_device **pdev)
1667{ 1667{
1668 struct usb_device *udev = *pdev; 1668 struct usb_device *udev = *pdev;
1669 int i; 1669 int i;
1670 struct usb_hcd *hcd = bus_to_hcd(udev->bus);
1671 1670
1672 /* mark the device as inactive, so any further urb submissions for 1671 /* mark the device as inactive, so any further urb submissions for
1673 * this device (and any of its children) will fail immediately. 1672 * this device (and any of its children) will fail immediately.
@@ -1690,9 +1689,7 @@ void usb_disconnect(struct usb_device **pdev)
1690 * so that the hardware is now fully quiesced. 1689 * so that the hardware is now fully quiesced.
1691 */ 1690 */
1692 dev_dbg (&udev->dev, "unregistering device\n"); 1691 dev_dbg (&udev->dev, "unregistering device\n");
1693 mutex_lock(hcd->bandwidth_mutex);
1694 usb_disable_device(udev, 0); 1692 usb_disable_device(udev, 0);
1695 mutex_unlock(hcd->bandwidth_mutex);
1696 usb_hcd_synchronize_unlinks(udev); 1693 usb_hcd_synchronize_unlinks(udev);
1697 1694
1698 usb_remove_ep_devs(&udev->ep0); 1695 usb_remove_ep_devs(&udev->ep0);
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index aed3e07942d4..ca717da3be95 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -1136,8 +1136,6 @@ void usb_disable_interface(struct usb_device *dev, struct usb_interface *intf,
1136 * Deallocates hcd/hardware state for the endpoints (nuking all or most 1136 * Deallocates hcd/hardware state for the endpoints (nuking all or most
1137 * pending urbs) and usbcore state for the interfaces, so that usbcore 1137 * pending urbs) and usbcore state for the interfaces, so that usbcore
1138 * must usb_set_configuration() before any interfaces could be used. 1138 * must usb_set_configuration() before any interfaces could be used.
1139 *
1140 * Must be called with hcd->bandwidth_mutex held.
1141 */ 1139 */
1142void usb_disable_device(struct usb_device *dev, int skip_ep0) 1140void usb_disable_device(struct usb_device *dev, int skip_ep0)
1143{ 1141{
@@ -1190,7 +1188,9 @@ void usb_disable_device(struct usb_device *dev, int skip_ep0)
1190 usb_disable_endpoint(dev, i + USB_DIR_IN, false); 1188 usb_disable_endpoint(dev, i + USB_DIR_IN, false);
1191 } 1189 }
1192 /* Remove endpoints from the host controller internal state */ 1190 /* Remove endpoints from the host controller internal state */
1191 mutex_lock(hcd->bandwidth_mutex);
1193 usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL); 1192 usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL);
1193 mutex_unlock(hcd->bandwidth_mutex);
1194 /* Second pass: remove endpoint pointers */ 1194 /* Second pass: remove endpoint pointers */
1195 } 1195 }
1196 for (i = skip_ep0; i < 16; ++i) { 1196 for (i = skip_ep0; i < 16; ++i) {
@@ -1750,7 +1750,6 @@ free_interfaces:
1750 /* if it's already configured, clear out old state first. 1750 /* if it's already configured, clear out old state first.
1751 * getting rid of old interfaces means unbinding their drivers. 1751 * getting rid of old interfaces means unbinding their drivers.
1752 */ 1752 */
1753 mutex_lock(hcd->bandwidth_mutex);
1754 if (dev->state != USB_STATE_ADDRESS) 1753 if (dev->state != USB_STATE_ADDRESS)
1755 usb_disable_device(dev, 1); /* Skip ep0 */ 1754 usb_disable_device(dev, 1); /* Skip ep0 */
1756 1755
@@ -1763,6 +1762,7 @@ free_interfaces:
1763 * host controller will not allow submissions to dropped endpoints. If 1762 * host controller will not allow submissions to dropped endpoints. If
1764 * this call fails, the device state is unchanged. 1763 * this call fails, the device state is unchanged.
1765 */ 1764 */
1765 mutex_lock(hcd->bandwidth_mutex);
1766 ret = usb_hcd_alloc_bandwidth(dev, cp, NULL, NULL); 1766 ret = usb_hcd_alloc_bandwidth(dev, cp, NULL, NULL);
1767 if (ret < 0) { 1767 if (ret < 0) {
1768 mutex_unlock(hcd->bandwidth_mutex); 1768 mutex_unlock(hcd->bandwidth_mutex);
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 7bd815a507e8..99b58d84553a 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -206,11 +206,11 @@ static void dwc3_free_event_buffers(struct dwc3 *dwc)
206 206
207 for (i = 0; i < dwc->num_event_buffers; i++) { 207 for (i = 0; i < dwc->num_event_buffers; i++) {
208 evt = dwc->ev_buffs[i]; 208 evt = dwc->ev_buffs[i];
209 if (evt) { 209 if (evt)
210 dwc3_free_one_event_buffer(dwc, evt); 210 dwc3_free_one_event_buffer(dwc, evt);
211 dwc->ev_buffs[i] = NULL;
212 }
213 } 211 }
212
213 kfree(dwc->ev_buffs);
214} 214}
215 215
216/** 216/**
diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c
index 25910e251c04..3584a169886f 100644
--- a/drivers/usb/dwc3/ep0.c
+++ b/drivers/usb/dwc3/ep0.c
@@ -353,6 +353,9 @@ static int dwc3_ep0_handle_feature(struct dwc3 *dwc,
353 353
354 dwc->test_mode_nr = wIndex >> 8; 354 dwc->test_mode_nr = wIndex >> 8;
355 dwc->test_mode = true; 355 dwc->test_mode = true;
356 break;
357 default:
358 return -EINVAL;
356 } 359 }
357 break; 360 break;
358 361
@@ -559,15 +562,20 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc,
559 length = trb->size & DWC3_TRB_SIZE_MASK; 562 length = trb->size & DWC3_TRB_SIZE_MASK;
560 563
561 if (dwc->ep0_bounced) { 564 if (dwc->ep0_bounced) {
565 unsigned transfer_size = ur->length;
566 unsigned maxp = ep0->endpoint.maxpacket;
567
568 transfer_size += (maxp - (transfer_size % maxp));
562 transferred = min_t(u32, ur->length, 569 transferred = min_t(u32, ur->length,
563 ep0->endpoint.maxpacket - length); 570 transfer_size - length);
564 memcpy(ur->buf, dwc->ep0_bounce, transferred); 571 memcpy(ur->buf, dwc->ep0_bounce, transferred);
565 dwc->ep0_bounced = false; 572 dwc->ep0_bounced = false;
566 } else { 573 } else {
567 transferred = ur->length - length; 574 transferred = ur->length - length;
568 ur->actual += transferred;
569 } 575 }
570 576
577 ur->actual += transferred;
578
571 if ((epnum & 1) && ur->actual < ur->length) { 579 if ((epnum & 1) && ur->actual < ur->length) {
572 /* for some reason we did not get everything out */ 580 /* for some reason we did not get everything out */
573 581
diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c
index 0c935d7c65bd..9d7bcd910074 100644
--- a/drivers/usb/gadget/at91_udc.c
+++ b/drivers/usb/gadget/at91_udc.c
@@ -1863,8 +1863,8 @@ static int __devinit at91udc_probe(struct platform_device *pdev)
1863 mod_timer(&udc->vbus_timer, 1863 mod_timer(&udc->vbus_timer,
1864 jiffies + VBUS_POLL_TIMEOUT); 1864 jiffies + VBUS_POLL_TIMEOUT);
1865 } else { 1865 } else {
1866 if (request_irq(udc->board.vbus_pin, at91_vbus_irq, 1866 if (request_irq(gpio_to_irq(udc->board.vbus_pin),
1867 0, driver_name, udc)) { 1867 at91_vbus_irq, 0, driver_name, udc)) {
1868 DBG("request vbus irq %d failed\n", 1868 DBG("request vbus irq %d failed\n",
1869 udc->board.vbus_pin); 1869 udc->board.vbus_pin);
1870 retval = -EBUSY; 1870 retval = -EBUSY;
@@ -1886,7 +1886,7 @@ static int __devinit at91udc_probe(struct platform_device *pdev)
1886 return 0; 1886 return 0;
1887fail4: 1887fail4:
1888 if (gpio_is_valid(udc->board.vbus_pin) && !udc->board.vbus_polled) 1888 if (gpio_is_valid(udc->board.vbus_pin) && !udc->board.vbus_polled)
1889 free_irq(udc->board.vbus_pin, udc); 1889 free_irq(gpio_to_irq(udc->board.vbus_pin), udc);
1890fail3: 1890fail3:
1891 if (gpio_is_valid(udc->board.vbus_pin)) 1891 if (gpio_is_valid(udc->board.vbus_pin))
1892 gpio_free(udc->board.vbus_pin); 1892 gpio_free(udc->board.vbus_pin);
@@ -1924,7 +1924,7 @@ static int __exit at91udc_remove(struct platform_device *pdev)
1924 device_init_wakeup(&pdev->dev, 0); 1924 device_init_wakeup(&pdev->dev, 0);
1925 remove_debug_file(udc); 1925 remove_debug_file(udc);
1926 if (gpio_is_valid(udc->board.vbus_pin)) { 1926 if (gpio_is_valid(udc->board.vbus_pin)) {
1927 free_irq(udc->board.vbus_pin, udc); 1927 free_irq(gpio_to_irq(udc->board.vbus_pin), udc);
1928 gpio_free(udc->board.vbus_pin); 1928 gpio_free(udc->board.vbus_pin);
1929 } 1929 }
1930 free_irq(udc->udp_irq, udc); 1930 free_irq(udc->udp_irq, udc);
diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c
index 1cbba70836bc..f52cb1ae45d9 100644
--- a/drivers/usb/gadget/f_fs.c
+++ b/drivers/usb/gadget/f_fs.c
@@ -712,7 +712,7 @@ static long ffs_ep0_ioctl(struct file *file, unsigned code, unsigned long value)
712 if (code == FUNCTIONFS_INTERFACE_REVMAP) { 712 if (code == FUNCTIONFS_INTERFACE_REVMAP) {
713 struct ffs_function *func = ffs->func; 713 struct ffs_function *func = ffs->func;
714 ret = func ? ffs_func_revmap_intf(func, value) : -ENODEV; 714 ret = func ? ffs_func_revmap_intf(func, value) : -ENODEV;
715 } else if (gadget->ops->ioctl) { 715 } else if (gadget && gadget->ops->ioctl) {
716 ret = gadget->ops->ioctl(gadget, code, value); 716 ret = gadget->ops->ioctl(gadget, code, value);
717 } else { 717 } else {
718 ret = -ENOTTY; 718 ret = -ENOTTY;
@@ -1382,6 +1382,7 @@ static void functionfs_unbind(struct ffs_data *ffs)
1382 ffs->ep0req = NULL; 1382 ffs->ep0req = NULL;
1383 ffs->gadget = NULL; 1383 ffs->gadget = NULL;
1384 ffs_data_put(ffs); 1384 ffs_data_put(ffs);
1385 clear_bit(FFS_FL_BOUND, &ffs->flags);
1385 } 1386 }
1386} 1387}
1387 1388
diff --git a/drivers/usb/gadget/f_rndis.c b/drivers/usb/gadget/f_rndis.c
index 7b1cf18df5e3..52343654f5df 100644
--- a/drivers/usb/gadget/f_rndis.c
+++ b/drivers/usb/gadget/f_rndis.c
@@ -500,6 +500,7 @@ rndis_setup(struct usb_function *f, const struct usb_ctrlrequest *ctrl)
500 if (buf) { 500 if (buf) {
501 memcpy(req->buf, buf, n); 501 memcpy(req->buf, buf, n);
502 req->complete = rndis_response_complete; 502 req->complete = rndis_response_complete;
503 req->context = rndis;
503 rndis_free_response(rndis->config, buf); 504 rndis_free_response(rndis->config, buf);
504 value = n; 505 value = n;
505 } 506 }
diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c
index 5f94e79cd6b9..55abfb6bd612 100644
--- a/drivers/usb/gadget/fsl_udc_core.c
+++ b/drivers/usb/gadget/fsl_udc_core.c
@@ -730,7 +730,7 @@ static void fsl_queue_td(struct fsl_ep *ep, struct fsl_req *req)
730 : (1 << (ep_index(ep))); 730 : (1 << (ep_index(ep)));
731 731
732 /* check if the pipe is empty */ 732 /* check if the pipe is empty */
733 if (!(list_empty(&ep->queue))) { 733 if (!(list_empty(&ep->queue)) && !(ep_index(ep) == 0)) {
734 /* Add td to the end */ 734 /* Add td to the end */
735 struct fsl_req *lastreq; 735 struct fsl_req *lastreq;
736 lastreq = list_entry(ep->queue.prev, struct fsl_req, queue); 736 lastreq = list_entry(ep->queue.prev, struct fsl_req, queue);
@@ -918,10 +918,6 @@ fsl_ep_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags)
918 return -ENOMEM; 918 return -ENOMEM;
919 } 919 }
920 920
921 /* Update ep0 state */
922 if ((ep_index(ep) == 0))
923 udc->ep0_state = DATA_STATE_XMIT;
924
925 /* irq handler advances the queue */ 921 /* irq handler advances the queue */
926 if (req != NULL) 922 if (req != NULL)
927 list_add_tail(&req->queue, &ep->queue); 923 list_add_tail(&req->queue, &ep->queue);
@@ -1279,7 +1275,8 @@ static int ep0_prime_status(struct fsl_udc *udc, int direction)
1279 udc->ep0_dir = USB_DIR_OUT; 1275 udc->ep0_dir = USB_DIR_OUT;
1280 1276
1281 ep = &udc->eps[0]; 1277 ep = &udc->eps[0];
1282 udc->ep0_state = WAIT_FOR_OUT_STATUS; 1278 if (udc->ep0_state != DATA_STATE_XMIT)
1279 udc->ep0_state = WAIT_FOR_OUT_STATUS;
1283 1280
1284 req->ep = ep; 1281 req->ep = ep;
1285 req->req.length = 0; 1282 req->req.length = 0;
@@ -1384,6 +1381,9 @@ static void ch9getstatus(struct fsl_udc *udc, u8 request_type, u16 value,
1384 1381
1385 list_add_tail(&req->queue, &ep->queue); 1382 list_add_tail(&req->queue, &ep->queue);
1386 udc->ep0_state = DATA_STATE_XMIT; 1383 udc->ep0_state = DATA_STATE_XMIT;
1384 if (ep0_prime_status(udc, EP_DIR_OUT))
1385 ep0stall(udc);
1386
1387 return; 1387 return;
1388stall: 1388stall:
1389 ep0stall(udc); 1389 ep0stall(udc);
@@ -1492,6 +1492,14 @@ static void setup_received_irq(struct fsl_udc *udc,
1492 spin_lock(&udc->lock); 1492 spin_lock(&udc->lock);
1493 udc->ep0_state = (setup->bRequestType & USB_DIR_IN) 1493 udc->ep0_state = (setup->bRequestType & USB_DIR_IN)
1494 ? DATA_STATE_XMIT : DATA_STATE_RECV; 1494 ? DATA_STATE_XMIT : DATA_STATE_RECV;
1495 /*
1496 * If the data stage is IN, send status prime immediately.
1497 * See 2.0 Spec chapter 8.5.3.3 for detail.
1498 */
1499 if (udc->ep0_state == DATA_STATE_XMIT)
1500 if (ep0_prime_status(udc, EP_DIR_OUT))
1501 ep0stall(udc);
1502
1495 } else { 1503 } else {
1496 /* No data phase, IN status from gadget */ 1504 /* No data phase, IN status from gadget */
1497 udc->ep0_dir = USB_DIR_IN; 1505 udc->ep0_dir = USB_DIR_IN;
@@ -1520,9 +1528,8 @@ static void ep0_req_complete(struct fsl_udc *udc, struct fsl_ep *ep0,
1520 1528
1521 switch (udc->ep0_state) { 1529 switch (udc->ep0_state) {
1522 case DATA_STATE_XMIT: 1530 case DATA_STATE_XMIT:
1523 /* receive status phase */ 1531 /* already primed at setup_received_irq */
1524 if (ep0_prime_status(udc, EP_DIR_OUT)) 1532 udc->ep0_state = WAIT_FOR_OUT_STATUS;
1525 ep0stall(udc);
1526 break; 1533 break;
1527 case DATA_STATE_RECV: 1534 case DATA_STATE_RECV:
1528 /* send status phase */ 1535 /* send status phase */
diff --git a/drivers/usb/gadget/g_ffs.c b/drivers/usb/gadget/g_ffs.c
index 331cd6729d3c..a85eaf40b948 100644
--- a/drivers/usb/gadget/g_ffs.c
+++ b/drivers/usb/gadget/g_ffs.c
@@ -161,7 +161,7 @@ static struct usb_composite_driver gfs_driver = {
161static struct ffs_data *gfs_ffs_data; 161static struct ffs_data *gfs_ffs_data;
162static unsigned long gfs_registered; 162static unsigned long gfs_registered;
163 163
164static int gfs_init(void) 164static int __init gfs_init(void)
165{ 165{
166 ENTER(); 166 ENTER();
167 167
@@ -169,7 +169,7 @@ static int gfs_init(void)
169} 169}
170module_init(gfs_init); 170module_init(gfs_init);
171 171
172static void gfs_exit(void) 172static void __exit gfs_exit(void)
173{ 173{
174 ENTER(); 174 ENTER();
175 175
diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c
index 69295ba9d99a..105b206cd844 100644
--- a/drivers/usb/gadget/s3c-hsotg.c
+++ b/drivers/usb/gadget/s3c-hsotg.c
@@ -340,7 +340,7 @@ static void s3c_hsotg_init_fifo(struct s3c_hsotg *hsotg)
340 /* currently we allocate TX FIFOs for all possible endpoints, 340 /* currently we allocate TX FIFOs for all possible endpoints,
341 * and assume that they are all the same size. */ 341 * and assume that they are all the same size. */
342 342
343 for (ep = 0; ep <= 15; ep++) { 343 for (ep = 1; ep <= 15; ep++) {
344 val = addr; 344 val = addr;
345 val |= size << S3C_DPTXFSIZn_DPTxFSize_SHIFT; 345 val |= size << S3C_DPTXFSIZn_DPTxFSize_SHIFT;
346 addr += size; 346 addr += size;
@@ -741,7 +741,7 @@ static void s3c_hsotg_start_req(struct s3c_hsotg *hsotg,
741 /* write size / packets */ 741 /* write size / packets */
742 writel(epsize, hsotg->regs + epsize_reg); 742 writel(epsize, hsotg->regs + epsize_reg);
743 743
744 if (using_dma(hsotg)) { 744 if (using_dma(hsotg) && !continuing) {
745 unsigned int dma_reg; 745 unsigned int dma_reg;
746 746
747 /* write DMA address to control register, buffer already 747 /* write DMA address to control register, buffer already
@@ -1696,10 +1696,12 @@ static void s3c_hsotg_set_ep_maxpacket(struct s3c_hsotg *hsotg,
1696 reg |= mpsval; 1696 reg |= mpsval;
1697 writel(reg, regs + S3C_DIEPCTL(ep)); 1697 writel(reg, regs + S3C_DIEPCTL(ep));
1698 1698
1699 reg = readl(regs + S3C_DOEPCTL(ep)); 1699 if (ep) {
1700 reg &= ~S3C_DxEPCTL_MPS_MASK; 1700 reg = readl(regs + S3C_DOEPCTL(ep));
1701 reg |= mpsval; 1701 reg &= ~S3C_DxEPCTL_MPS_MASK;
1702 writel(reg, regs + S3C_DOEPCTL(ep)); 1702 reg |= mpsval;
1703 writel(reg, regs + S3C_DOEPCTL(ep));
1704 }
1703 1705
1704 return; 1706 return;
1705 1707
@@ -1919,7 +1921,8 @@ static void s3c_hsotg_epint(struct s3c_hsotg *hsotg, unsigned int idx,
1919 ints & S3C_DIEPMSK_TxFIFOEmpty) { 1921 ints & S3C_DIEPMSK_TxFIFOEmpty) {
1920 dev_dbg(hsotg->dev, "%s: ep%d: TxFIFOEmpty\n", 1922 dev_dbg(hsotg->dev, "%s: ep%d: TxFIFOEmpty\n",
1921 __func__, idx); 1923 __func__, idx);
1922 s3c_hsotg_trytx(hsotg, hs_ep); 1924 if (!using_dma(hsotg))
1925 s3c_hsotg_trytx(hsotg, hs_ep);
1923 } 1926 }
1924 } 1927 }
1925} 1928}
diff --git a/drivers/usb/gadget/udc-core.c b/drivers/usb/gadget/udc-core.c
index 56da49f31d6c..2fa9865babed 100644
--- a/drivers/usb/gadget/udc-core.c
+++ b/drivers/usb/gadget/udc-core.c
@@ -264,8 +264,8 @@ static void usb_gadget_remove_driver(struct usb_udc *udc)
264 if (udc_is_newstyle(udc)) { 264 if (udc_is_newstyle(udc)) {
265 udc->driver->disconnect(udc->gadget); 265 udc->driver->disconnect(udc->gadget);
266 udc->driver->unbind(udc->gadget); 266 udc->driver->unbind(udc->gadget);
267 usb_gadget_udc_stop(udc->gadget, udc->driver);
268 usb_gadget_disconnect(udc->gadget); 267 usb_gadget_disconnect(udc->gadget);
268 usb_gadget_udc_stop(udc->gadget, udc->driver);
269 } else { 269 } else {
270 usb_gadget_stop(udc->gadget, udc->driver); 270 usb_gadget_stop(udc->gadget, udc->driver);
271 } 271 }
@@ -411,8 +411,12 @@ static ssize_t usb_udc_softconn_store(struct device *dev,
411 struct usb_udc *udc = container_of(dev, struct usb_udc, dev); 411 struct usb_udc *udc = container_of(dev, struct usb_udc, dev);
412 412
413 if (sysfs_streq(buf, "connect")) { 413 if (sysfs_streq(buf, "connect")) {
414 if (udc_is_newstyle(udc))
415 usb_gadget_udc_start(udc->gadget, udc->driver);
414 usb_gadget_connect(udc->gadget); 416 usb_gadget_connect(udc->gadget);
415 } else if (sysfs_streq(buf, "disconnect")) { 417 } else if (sysfs_streq(buf, "disconnect")) {
418 if (udc_is_newstyle(udc))
419 usb_gadget_udc_stop(udc->gadget, udc->driver);
416 usb_gadget_disconnect(udc->gadget); 420 usb_gadget_disconnect(udc->gadget);
417 } else { 421 } else {
418 dev_err(dev, "unsupported command '%s'\n", buf); 422 dev_err(dev, "unsupported command '%s'\n", buf);
diff --git a/drivers/usb/gadget/uvc_queue.c b/drivers/usb/gadget/uvc_queue.c
index d776adb2da67..0cdf89d32a15 100644
--- a/drivers/usb/gadget/uvc_queue.c
+++ b/drivers/usb/gadget/uvc_queue.c
@@ -543,11 +543,11 @@ done:
543 return ret; 543 return ret;
544} 544}
545 545
546/* called with queue->irqlock held.. */
546static struct uvc_buffer * 547static struct uvc_buffer *
547uvc_queue_next_buffer(struct uvc_video_queue *queue, struct uvc_buffer *buf) 548uvc_queue_next_buffer(struct uvc_video_queue *queue, struct uvc_buffer *buf)
548{ 549{
549 struct uvc_buffer *nextbuf; 550 struct uvc_buffer *nextbuf;
550 unsigned long flags;
551 551
552 if ((queue->flags & UVC_QUEUE_DROP_INCOMPLETE) && 552 if ((queue->flags & UVC_QUEUE_DROP_INCOMPLETE) &&
553 buf->buf.length != buf->buf.bytesused) { 553 buf->buf.length != buf->buf.bytesused) {
@@ -556,14 +556,12 @@ uvc_queue_next_buffer(struct uvc_video_queue *queue, struct uvc_buffer *buf)
556 return buf; 556 return buf;
557 } 557 }
558 558
559 spin_lock_irqsave(&queue->irqlock, flags);
560 list_del(&buf->queue); 559 list_del(&buf->queue);
561 if (!list_empty(&queue->irqqueue)) 560 if (!list_empty(&queue->irqqueue))
562 nextbuf = list_first_entry(&queue->irqqueue, struct uvc_buffer, 561 nextbuf = list_first_entry(&queue->irqqueue, struct uvc_buffer,
563 queue); 562 queue);
564 else 563 else
565 nextbuf = NULL; 564 nextbuf = NULL;
566 spin_unlock_irqrestore(&queue->irqlock, flags);
567 565
568 buf->buf.sequence = queue->sequence++; 566 buf->buf.sequence = queue->sequence++;
569 do_gettimeofday(&buf->buf.timestamp); 567 do_gettimeofday(&buf->buf.timestamp);
diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c
index 3e7345172e03..d0a84bd3f3eb 100644
--- a/drivers/usb/host/ehci-fsl.c
+++ b/drivers/usb/host/ehci-fsl.c
@@ -218,6 +218,9 @@ static void ehci_fsl_setup_phy(struct ehci_hcd *ehci,
218 u32 portsc; 218 u32 portsc;
219 struct usb_hcd *hcd = ehci_to_hcd(ehci); 219 struct usb_hcd *hcd = ehci_to_hcd(ehci);
220 void __iomem *non_ehci = hcd->regs; 220 void __iomem *non_ehci = hcd->regs;
221 struct fsl_usb2_platform_data *pdata;
222
223 pdata = hcd->self.controller->platform_data;
221 224
222 portsc = ehci_readl(ehci, &ehci->regs->port_status[port_offset]); 225 portsc = ehci_readl(ehci, &ehci->regs->port_status[port_offset]);
223 portsc &= ~(PORT_PTS_MSK | PORT_PTS_PTW); 226 portsc &= ~(PORT_PTS_MSK | PORT_PTS_PTW);
@@ -234,7 +237,9 @@ static void ehci_fsl_setup_phy(struct ehci_hcd *ehci,
234 /* fall through */ 237 /* fall through */
235 case FSL_USB2_PHY_UTMI: 238 case FSL_USB2_PHY_UTMI:
236 /* enable UTMI PHY */ 239 /* enable UTMI PHY */
237 setbits32(non_ehci + FSL_SOC_USB_CTRL, CTRL_UTMI_PHY_EN); 240 if (pdata->have_sysif_regs)
241 setbits32(non_ehci + FSL_SOC_USB_CTRL,
242 CTRL_UTMI_PHY_EN);
238 portsc |= PORT_PTS_UTMI; 243 portsc |= PORT_PTS_UTMI;
239 break; 244 break;
240 case FSL_USB2_PHY_NONE: 245 case FSL_USB2_PHY_NONE:
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 806cc95317aa..4a3bc5b7a06f 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -858,8 +858,13 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd)
858 goto dead; 858 goto dead;
859 } 859 }
860 860
861 /*
862 * We don't use STS_FLR, but some controllers don't like it to
863 * remain on, so mask it out along with the other status bits.
864 */
865 masked_status = status & (INTR_MASK | STS_FLR);
866
861 /* Shared IRQ? */ 867 /* Shared IRQ? */
862 masked_status = status & INTR_MASK;
863 if (!masked_status || unlikely(ehci->rh_state == EHCI_RH_HALTED)) { 868 if (!masked_status || unlikely(ehci->rh_state == EHCI_RH_HALTED)) {
864 spin_unlock(&ehci->lock); 869 spin_unlock(&ehci->lock);
865 return IRQ_NONE; 870 return IRQ_NONE;
@@ -910,7 +915,7 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd)
910 pcd_status = status; 915 pcd_status = status;
911 916
912 /* resume root hub? */ 917 /* resume root hub? */
913 if (!(cmd & CMD_RUN)) 918 if (ehci->rh_state == EHCI_RH_SUSPENDED)
914 usb_hcd_resume_root_hub(hcd); 919 usb_hcd_resume_root_hub(hcd);
915 920
916 /* get per-port change detect bits */ 921 /* get per-port change detect bits */
diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
index bba9850f32f0..5c78f9e71466 100644
--- a/drivers/usb/host/ehci-omap.c
+++ b/drivers/usb/host/ehci-omap.c
@@ -42,6 +42,7 @@
42#include <plat/usb.h> 42#include <plat/usb.h>
43#include <linux/regulator/consumer.h> 43#include <linux/regulator/consumer.h>
44#include <linux/pm_runtime.h> 44#include <linux/pm_runtime.h>
45#include <linux/gpio.h>
45 46
46/* EHCI Register Set */ 47/* EHCI Register Set */
47#define EHCI_INSNREG04 (0xA0) 48#define EHCI_INSNREG04 (0xA0)
@@ -191,6 +192,19 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
191 } 192 }
192 } 193 }
193 194
195 if (pdata->phy_reset) {
196 if (gpio_is_valid(pdata->reset_gpio_port[0]))
197 gpio_request_one(pdata->reset_gpio_port[0],
198 GPIOF_OUT_INIT_LOW, "USB1 PHY reset");
199
200 if (gpio_is_valid(pdata->reset_gpio_port[1]))
201 gpio_request_one(pdata->reset_gpio_port[1],
202 GPIOF_OUT_INIT_LOW, "USB2 PHY reset");
203
204 /* Hold the PHY in RESET for enough time till DIR is high */
205 udelay(10);
206 }
207
194 pm_runtime_enable(dev); 208 pm_runtime_enable(dev);
195 pm_runtime_get_sync(dev); 209 pm_runtime_get_sync(dev);
196 210
@@ -237,6 +251,19 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
237 /* root ports should always stay powered */ 251 /* root ports should always stay powered */
238 ehci_port_power(omap_ehci, 1); 252 ehci_port_power(omap_ehci, 1);
239 253
254 if (pdata->phy_reset) {
255 /* Hold the PHY in RESET for enough time till
256 * PHY is settled and ready
257 */
258 udelay(10);
259
260 if (gpio_is_valid(pdata->reset_gpio_port[0]))
261 gpio_set_value(pdata->reset_gpio_port[0], 1);
262
263 if (gpio_is_valid(pdata->reset_gpio_port[1]))
264 gpio_set_value(pdata->reset_gpio_port[1], 1);
265 }
266
240 return 0; 267 return 0;
241 268
242err_add_hcd: 269err_add_hcd:
@@ -259,8 +286,9 @@ err_io:
259 */ 286 */
260static int ehci_hcd_omap_remove(struct platform_device *pdev) 287static int ehci_hcd_omap_remove(struct platform_device *pdev)
261{ 288{
262 struct device *dev = &pdev->dev; 289 struct device *dev = &pdev->dev;
263 struct usb_hcd *hcd = dev_get_drvdata(dev); 290 struct usb_hcd *hcd = dev_get_drvdata(dev);
291 struct ehci_hcd_omap_platform_data *pdata = dev->platform_data;
264 292
265 usb_remove_hcd(hcd); 293 usb_remove_hcd(hcd);
266 disable_put_regulator(dev->platform_data); 294 disable_put_regulator(dev->platform_data);
@@ -269,6 +297,13 @@ static int ehci_hcd_omap_remove(struct platform_device *pdev)
269 pm_runtime_put_sync(dev); 297 pm_runtime_put_sync(dev);
270 pm_runtime_disable(dev); 298 pm_runtime_disable(dev);
271 299
300 if (pdata->phy_reset) {
301 if (gpio_is_valid(pdata->reset_gpio_port[0]))
302 gpio_free(pdata->reset_gpio_port[0]);
303
304 if (gpio_is_valid(pdata->reset_gpio_port[1]))
305 gpio_free(pdata->reset_gpio_port[1]);
306 }
272 return 0; 307 return 0;
273} 308}
274 309
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
index 73544bd440bd..86183366647f 100644
--- a/drivers/usb/host/ehci-tegra.c
+++ b/drivers/usb/host/ehci-tegra.c
@@ -731,7 +731,6 @@ static int tegra_ehci_probe(struct platform_device *pdev)
731 err = -ENODEV; 731 err = -ENODEV;
732 goto fail; 732 goto fail;
733 } 733 }
734 set_irq_flags(irq, IRQF_VALID);
735 734
736#ifdef CONFIG_USB_OTG_UTILS 735#ifdef CONFIG_USB_OTG_UTILS
737 if (pdata->operating_mode == TEGRA_USB_OTG) { 736 if (pdata->operating_mode == TEGRA_USB_OTG) {
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index 09f597ad6e00..13ebeca8e73e 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -94,7 +94,7 @@ static void at91_stop_hc(struct platform_device *pdev)
94 94
95/*-------------------------------------------------------------------------*/ 95/*-------------------------------------------------------------------------*/
96 96
97static void usb_hcd_at91_remove (struct usb_hcd *, struct platform_device *); 97static void __devexit usb_hcd_at91_remove (struct usb_hcd *, struct platform_device *);
98 98
99/* configure so an HC device and id are always provided */ 99/* configure so an HC device and id are always provided */
100/* always called with process context; sleeping is OK */ 100/* always called with process context; sleeping is OK */
@@ -108,7 +108,7 @@ static void usb_hcd_at91_remove (struct usb_hcd *, struct platform_device *);
108 * then invokes the start() method for the HCD associated with it 108 * then invokes the start() method for the HCD associated with it
109 * through the hotplug entry's driver_data. 109 * through the hotplug entry's driver_data.
110 */ 110 */
111static int usb_hcd_at91_probe(const struct hc_driver *driver, 111static int __devinit usb_hcd_at91_probe(const struct hc_driver *driver,
112 struct platform_device *pdev) 112 struct platform_device *pdev)
113{ 113{
114 int retval; 114 int retval;
@@ -203,7 +203,7 @@ static int usb_hcd_at91_probe(const struct hc_driver *driver,
203 * context, "rmmod" or something similar. 203 * context, "rmmod" or something similar.
204 * 204 *
205 */ 205 */
206static void usb_hcd_at91_remove(struct usb_hcd *hcd, 206static void __devexit usb_hcd_at91_remove(struct usb_hcd *hcd,
207 struct platform_device *pdev) 207 struct platform_device *pdev)
208{ 208{
209 usb_remove_hcd(hcd); 209 usb_remove_hcd(hcd);
@@ -545,7 +545,7 @@ static int __devinit ohci_at91_of_init(struct platform_device *pdev)
545 545
546/*-------------------------------------------------------------------------*/ 546/*-------------------------------------------------------------------------*/
547 547
548static int ohci_hcd_at91_drv_probe(struct platform_device *pdev) 548static int __devinit ohci_hcd_at91_drv_probe(struct platform_device *pdev)
549{ 549{
550 struct at91_usbh_data *pdata; 550 struct at91_usbh_data *pdata;
551 int i; 551 int i;
@@ -620,7 +620,7 @@ static int ohci_hcd_at91_drv_probe(struct platform_device *pdev)
620 return usb_hcd_at91_probe(&ohci_at91_hc_driver, pdev); 620 return usb_hcd_at91_probe(&ohci_at91_hc_driver, pdev);
621} 621}
622 622
623static int ohci_hcd_at91_drv_remove(struct platform_device *pdev) 623static int __devexit ohci_hcd_at91_drv_remove(struct platform_device *pdev)
624{ 624{
625 struct at91_usbh_data *pdata = pdev->dev.platform_data; 625 struct at91_usbh_data *pdata = pdev->dev.platform_data;
626 int i; 626 int i;
@@ -696,7 +696,7 @@ MODULE_ALIAS("platform:at91_ohci");
696 696
697static struct platform_driver ohci_hcd_at91_driver = { 697static struct platform_driver ohci_hcd_at91_driver = {
698 .probe = ohci_hcd_at91_drv_probe, 698 .probe = ohci_hcd_at91_drv_probe,
699 .remove = ohci_hcd_at91_drv_remove, 699 .remove = __devexit_p(ohci_hcd_at91_drv_remove),
700 .shutdown = usb_hcd_platform_shutdown, 700 .shutdown = usb_hcd_platform_shutdown,
701 .suspend = ohci_hcd_at91_drv_suspend, 701 .suspend = ohci_hcd_at91_drv_suspend,
702 .resume = ohci_hcd_at91_drv_resume, 702 .resume = ohci_hcd_at91_drv_resume,
diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c
index 959145baf3cf..9dcb68f04f03 100644
--- a/drivers/usb/misc/usbtest.c
+++ b/drivers/usb/misc/usbtest.c
@@ -423,7 +423,7 @@ alloc_sglist(int nents, int max, int vary)
423 unsigned i; 423 unsigned i;
424 unsigned size = max; 424 unsigned size = max;
425 425
426 sg = kmalloc(nents * sizeof *sg, GFP_KERNEL); 426 sg = kmalloc_array(nents, sizeof *sg, GFP_KERNEL);
427 if (!sg) 427 if (!sg)
428 return NULL; 428 return NULL;
429 sg_init_table(sg, nents); 429 sg_init_table(sg, nents);
@@ -904,6 +904,9 @@ test_ctrl_queue(struct usbtest_dev *dev, struct usbtest_param *param)
904 struct ctrl_ctx context; 904 struct ctrl_ctx context;
905 int i; 905 int i;
906 906
907 if (param->sglen == 0 || param->iterations > UINT_MAX / param->sglen)
908 return -EOPNOTSUPP;
909
907 spin_lock_init(&context.lock); 910 spin_lock_init(&context.lock);
908 context.dev = dev; 911 context.dev = dev;
909 init_completion(&context.complete); 912 init_completion(&context.complete);
@@ -1981,8 +1984,6 @@ usbtest_ioctl(struct usb_interface *intf, unsigned int code, void *buf)
1981 1984
1982 /* queued control messaging */ 1985 /* queued control messaging */
1983 case 10: 1986 case 10:
1984 if (param->sglen == 0)
1985 break;
1986 retval = 0; 1987 retval = 0;
1987 dev_info(&intf->dev, 1988 dev_info(&intf->dev,
1988 "TEST 10: queue %d control calls, %d times\n", 1989 "TEST 10: queue %d control calls, %d times\n",
@@ -2276,6 +2277,8 @@ usbtest_probe(struct usb_interface *intf, const struct usb_device_id *id)
2276 if (status < 0) { 2277 if (status < 0) {
2277 WARNING(dev, "couldn't get endpoints, %d\n", 2278 WARNING(dev, "couldn't get endpoints, %d\n",
2278 status); 2279 status);
2280 kfree(dev->buf);
2281 kfree(dev);
2279 return status; 2282 return status;
2280 } 2283 }
2281 /* may find bulk or ISO pipes */ 2284 /* may find bulk or ISO pipes */
diff --git a/drivers/usb/misc/yurex.c b/drivers/usb/misc/yurex.c
index 897edda42270..70201462e19c 100644
--- a/drivers/usb/misc/yurex.c
+++ b/drivers/usb/misc/yurex.c
@@ -99,9 +99,7 @@ static void yurex_delete(struct kref *kref)
99 usb_put_dev(dev->udev); 99 usb_put_dev(dev->udev);
100 if (dev->cntl_urb) { 100 if (dev->cntl_urb) {
101 usb_kill_urb(dev->cntl_urb); 101 usb_kill_urb(dev->cntl_urb);
102 if (dev->cntl_req) 102 kfree(dev->cntl_req);
103 usb_free_coherent(dev->udev, YUREX_BUF_SIZE,
104 dev->cntl_req, dev->cntl_urb->setup_dma);
105 if (dev->cntl_buffer) 103 if (dev->cntl_buffer)
106 usb_free_coherent(dev->udev, YUREX_BUF_SIZE, 104 usb_free_coherent(dev->udev, YUREX_BUF_SIZE,
107 dev->cntl_buffer, dev->cntl_urb->transfer_dma); 105 dev->cntl_buffer, dev->cntl_urb->transfer_dma);
@@ -234,9 +232,7 @@ static int yurex_probe(struct usb_interface *interface, const struct usb_device_
234 } 232 }
235 233
236 /* allocate buffer for control req */ 234 /* allocate buffer for control req */
237 dev->cntl_req = usb_alloc_coherent(dev->udev, YUREX_BUF_SIZE, 235 dev->cntl_req = kmalloc(YUREX_BUF_SIZE, GFP_KERNEL);
238 GFP_KERNEL,
239 &dev->cntl_urb->setup_dma);
240 if (!dev->cntl_req) { 236 if (!dev->cntl_req) {
241 err("Could not allocate cntl_req"); 237 err("Could not allocate cntl_req");
242 goto error; 238 goto error;
@@ -286,7 +282,7 @@ static int yurex_probe(struct usb_interface *interface, const struct usb_device_
286 usb_rcvintpipe(dev->udev, dev->int_in_endpointAddr), 282 usb_rcvintpipe(dev->udev, dev->int_in_endpointAddr),
287 dev->int_buffer, YUREX_BUF_SIZE, yurex_interrupt, 283 dev->int_buffer, YUREX_BUF_SIZE, yurex_interrupt,
288 dev, 1); 284 dev, 1);
289 dev->cntl_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; 285 dev->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
290 if (usb_submit_urb(dev->urb, GFP_KERNEL)) { 286 if (usb_submit_urb(dev->urb, GFP_KERNEL)) {
291 retval = -EIO; 287 retval = -EIO;
292 err("Could not submitting URB"); 288 err("Could not submitting URB");
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 0f8b82918a40..66aaccf04490 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -137,6 +137,9 @@ static int musb_ulpi_read(struct usb_phy *phy, u32 offset)
137 int i = 0; 137 int i = 0;
138 u8 r; 138 u8 r;
139 u8 power; 139 u8 power;
140 int ret;
141
142 pm_runtime_get_sync(phy->io_dev);
140 143
141 /* Make sure the transceiver is not in low power mode */ 144 /* Make sure the transceiver is not in low power mode */
142 power = musb_readb(addr, MUSB_POWER); 145 power = musb_readb(addr, MUSB_POWER);
@@ -154,15 +157,22 @@ static int musb_ulpi_read(struct usb_phy *phy, u32 offset)
154 while (!(musb_readb(addr, MUSB_ULPI_REG_CONTROL) 157 while (!(musb_readb(addr, MUSB_ULPI_REG_CONTROL)
155 & MUSB_ULPI_REG_CMPLT)) { 158 & MUSB_ULPI_REG_CMPLT)) {
156 i++; 159 i++;
157 if (i == 10000) 160 if (i == 10000) {
158 return -ETIMEDOUT; 161 ret = -ETIMEDOUT;
162 goto out;
163 }
159 164
160 } 165 }
161 r = musb_readb(addr, MUSB_ULPI_REG_CONTROL); 166 r = musb_readb(addr, MUSB_ULPI_REG_CONTROL);
162 r &= ~MUSB_ULPI_REG_CMPLT; 167 r &= ~MUSB_ULPI_REG_CMPLT;
163 musb_writeb(addr, MUSB_ULPI_REG_CONTROL, r); 168 musb_writeb(addr, MUSB_ULPI_REG_CONTROL, r);
164 169
165 return musb_readb(addr, MUSB_ULPI_REG_DATA); 170 ret = musb_readb(addr, MUSB_ULPI_REG_DATA);
171
172out:
173 pm_runtime_put(phy->io_dev);
174
175 return ret;
166} 176}
167 177
168static int musb_ulpi_write(struct usb_phy *phy, u32 offset, u32 data) 178static int musb_ulpi_write(struct usb_phy *phy, u32 offset, u32 data)
@@ -171,6 +181,9 @@ static int musb_ulpi_write(struct usb_phy *phy, u32 offset, u32 data)
171 int i = 0; 181 int i = 0;
172 u8 r = 0; 182 u8 r = 0;
173 u8 power; 183 u8 power;
184 int ret = 0;
185
186 pm_runtime_get_sync(phy->io_dev);
174 187
175 /* Make sure the transceiver is not in low power mode */ 188 /* Make sure the transceiver is not in low power mode */
176 power = musb_readb(addr, MUSB_POWER); 189 power = musb_readb(addr, MUSB_POWER);
@@ -184,15 +197,20 @@ static int musb_ulpi_write(struct usb_phy *phy, u32 offset, u32 data)
184 while (!(musb_readb(addr, MUSB_ULPI_REG_CONTROL) 197 while (!(musb_readb(addr, MUSB_ULPI_REG_CONTROL)
185 & MUSB_ULPI_REG_CMPLT)) { 198 & MUSB_ULPI_REG_CMPLT)) {
186 i++; 199 i++;
187 if (i == 10000) 200 if (i == 10000) {
188 return -ETIMEDOUT; 201 ret = -ETIMEDOUT;
202 goto out;
203 }
189 } 204 }
190 205
191 r = musb_readb(addr, MUSB_ULPI_REG_CONTROL); 206 r = musb_readb(addr, MUSB_ULPI_REG_CONTROL);
192 r &= ~MUSB_ULPI_REG_CMPLT; 207 r &= ~MUSB_ULPI_REG_CMPLT;
193 musb_writeb(addr, MUSB_ULPI_REG_CONTROL, r); 208 musb_writeb(addr, MUSB_ULPI_REG_CONTROL, r);
194 209
195 return 0; 210out:
211 pm_runtime_put(phy->io_dev);
212
213 return ret;
196} 214}
197#else 215#else
198#define musb_ulpi_read NULL 216#define musb_ulpi_read NULL
@@ -1904,14 +1922,17 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
1904 1922
1905 if (!musb->isr) { 1923 if (!musb->isr) {
1906 status = -ENODEV; 1924 status = -ENODEV;
1907 goto fail3; 1925 goto fail2;
1908 } 1926 }
1909 1927
1910 if (!musb->xceiv->io_ops) { 1928 if (!musb->xceiv->io_ops) {
1929 musb->xceiv->io_dev = musb->controller;
1911 musb->xceiv->io_priv = musb->mregs; 1930 musb->xceiv->io_priv = musb->mregs;
1912 musb->xceiv->io_ops = &musb_ulpi_access; 1931 musb->xceiv->io_ops = &musb_ulpi_access;
1913 } 1932 }
1914 1933
1934 pm_runtime_get_sync(musb->controller);
1935
1915#ifndef CONFIG_MUSB_PIO_ONLY 1936#ifndef CONFIG_MUSB_PIO_ONLY
1916 if (use_dma && dev->dma_mask) { 1937 if (use_dma && dev->dma_mask) {
1917 struct dma_controller *c; 1938 struct dma_controller *c;
@@ -2023,6 +2044,8 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
2023 goto fail5; 2044 goto fail5;
2024#endif 2045#endif
2025 2046
2047 pm_runtime_put(musb->controller);
2048
2026 dev_info(dev, "USB %s mode controller at %p using %s, IRQ %d\n", 2049 dev_info(dev, "USB %s mode controller at %p using %s, IRQ %d\n",
2027 ({char *s; 2050 ({char *s;
2028 switch (musb->board_mode) { 2051 switch (musb->board_mode) {
@@ -2047,6 +2070,9 @@ fail4:
2047 musb_gadget_cleanup(musb); 2070 musb_gadget_cleanup(musb);
2048 2071
2049fail3: 2072fail3:
2073 pm_runtime_put_sync(musb->controller);
2074
2075fail2:
2050 if (musb->irq_wake) 2076 if (musb->irq_wake)
2051 device_init_wakeup(dev, 0); 2077 device_init_wakeup(dev, 0);
2052 musb_platform_exit(musb); 2078 musb_platform_exit(musb);
diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c
index 79cb0af779fa..ef8d744800ac 100644
--- a/drivers/usb/musb/musb_host.c
+++ b/drivers/usb/musb/musb_host.c
@@ -2098,7 +2098,7 @@ static int musb_cleanup_urb(struct urb *urb, struct musb_qh *qh)
2098 } 2098 }
2099 2099
2100 /* turn off DMA requests, discard state, stop polling ... */ 2100 /* turn off DMA requests, discard state, stop polling ... */
2101 if (is_in) { 2101 if (ep->epnum && is_in) {
2102 /* giveback saves bulk toggle */ 2102 /* giveback saves bulk toggle */
2103 csr = musb_h_flush_rxfifo(ep, 0); 2103 csr = musb_h_flush_rxfifo(ep, 0);
2104 2104
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index 2ae0bb309994..c7785e81254c 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -282,7 +282,8 @@ static void musb_otg_notifier_work(struct work_struct *data_notifier_work)
282 282
283static int omap2430_musb_init(struct musb *musb) 283static int omap2430_musb_init(struct musb *musb)
284{ 284{
285 u32 l, status = 0; 285 u32 l;
286 int status = 0;
286 struct device *dev = musb->controller; 287 struct device *dev = musb->controller;
287 struct musb_hdrc_platform_data *plat = dev->platform_data; 288 struct musb_hdrc_platform_data *plat = dev->platform_data;
288 struct omap_musb_board_data *data = plat->board_data; 289 struct omap_musb_board_data *data = plat->board_data;
@@ -301,7 +302,7 @@ static int omap2430_musb_init(struct musb *musb)
301 302
302 status = pm_runtime_get_sync(dev); 303 status = pm_runtime_get_sync(dev);
303 if (status < 0) { 304 if (status < 0) {
304 dev_err(dev, "pm_runtime_get_sync FAILED"); 305 dev_err(dev, "pm_runtime_get_sync FAILED %d\n", status);
305 goto err1; 306 goto err1;
306 } 307 }
307 308
@@ -333,6 +334,7 @@ static int omap2430_musb_init(struct musb *musb)
333 334
334 setup_timer(&musb_idle_timer, musb_do_idle, (unsigned long) musb); 335 setup_timer(&musb_idle_timer, musb_do_idle, (unsigned long) musb);
335 336
337 pm_runtime_put_noidle(musb->controller);
336 return 0; 338 return 0;
337 339
338err1: 340err1:
@@ -452,14 +454,14 @@ static int __devinit omap2430_probe(struct platform_device *pdev)
452 goto err2; 454 goto err2;
453 } 455 }
454 456
457 pm_runtime_enable(&pdev->dev);
458
455 ret = platform_device_add(musb); 459 ret = platform_device_add(musb);
456 if (ret) { 460 if (ret) {
457 dev_err(&pdev->dev, "failed to register musb device\n"); 461 dev_err(&pdev->dev, "failed to register musb device\n");
458 goto err2; 462 goto err2;
459 } 463 }
460 464
461 pm_runtime_enable(&pdev->dev);
462
463 return 0; 465 return 0;
464 466
465err2: 467err2:
@@ -478,7 +480,6 @@ static int __devexit omap2430_remove(struct platform_device *pdev)
478 480
479 platform_device_del(glue->musb); 481 platform_device_del(glue->musb);
480 platform_device_put(glue->musb); 482 platform_device_put(glue->musb);
481 pm_runtime_put(&pdev->dev);
482 kfree(glue); 483 kfree(glue);
483 484
484 return 0; 485 return 0;
@@ -491,11 +492,13 @@ static int omap2430_runtime_suspend(struct device *dev)
491 struct omap2430_glue *glue = dev_get_drvdata(dev); 492 struct omap2430_glue *glue = dev_get_drvdata(dev);
492 struct musb *musb = glue_to_musb(glue); 493 struct musb *musb = glue_to_musb(glue);
493 494
494 musb->context.otg_interfsel = musb_readl(musb->mregs, 495 if (musb) {
495 OTG_INTERFSEL); 496 musb->context.otg_interfsel = musb_readl(musb->mregs,
497 OTG_INTERFSEL);
496 498
497 omap2430_low_level_exit(musb); 499 omap2430_low_level_exit(musb);
498 usb_phy_set_suspend(musb->xceiv, 1); 500 usb_phy_set_suspend(musb->xceiv, 1);
501 }
499 502
500 return 0; 503 return 0;
501} 504}
@@ -505,11 +508,13 @@ static int omap2430_runtime_resume(struct device *dev)
505 struct omap2430_glue *glue = dev_get_drvdata(dev); 508 struct omap2430_glue *glue = dev_get_drvdata(dev);
506 struct musb *musb = glue_to_musb(glue); 509 struct musb *musb = glue_to_musb(glue);
507 510
508 omap2430_low_level_init(musb); 511 if (musb) {
509 musb_writel(musb->mregs, OTG_INTERFSEL, 512 omap2430_low_level_init(musb);
510 musb->context.otg_interfsel); 513 musb_writel(musb->mregs, OTG_INTERFSEL,
514 musb->context.otg_interfsel);
511 515
512 usb_phy_set_suspend(musb->xceiv, 0); 516 usb_phy_set_suspend(musb->xceiv, 0);
517 }
513 518
514 return 0; 519 return 0;
515} 520}
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
index 0310e2df59f5..ec30f95ef399 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -287,7 +287,8 @@ static int cp210x_get_config(struct usb_serial_port *port, u8 request,
287 /* Issue the request, attempting to read 'size' bytes */ 287 /* Issue the request, attempting to read 'size' bytes */
288 result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), 288 result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
289 request, REQTYPE_DEVICE_TO_HOST, 0x0000, 289 request, REQTYPE_DEVICE_TO_HOST, 0x0000,
290 port_priv->bInterfaceNumber, buf, size, 300); 290 port_priv->bInterfaceNumber, buf, size,
291 USB_CTRL_GET_TIMEOUT);
291 292
292 /* Convert data into an array of integers */ 293 /* Convert data into an array of integers */
293 for (i = 0; i < length; i++) 294 for (i = 0; i < length; i++)
@@ -340,12 +341,14 @@ static int cp210x_set_config(struct usb_serial_port *port, u8 request,
340 result = usb_control_msg(serial->dev, 341 result = usb_control_msg(serial->dev,
341 usb_sndctrlpipe(serial->dev, 0), 342 usb_sndctrlpipe(serial->dev, 0),
342 request, REQTYPE_HOST_TO_DEVICE, 0x0000, 343 request, REQTYPE_HOST_TO_DEVICE, 0x0000,
343 port_priv->bInterfaceNumber, buf, size, 300); 344 port_priv->bInterfaceNumber, buf, size,
345 USB_CTRL_SET_TIMEOUT);
344 } else { 346 } else {
345 result = usb_control_msg(serial->dev, 347 result = usb_control_msg(serial->dev,
346 usb_sndctrlpipe(serial->dev, 0), 348 usb_sndctrlpipe(serial->dev, 0),
347 request, REQTYPE_HOST_TO_DEVICE, data[0], 349 request, REQTYPE_HOST_TO_DEVICE, data[0],
348 port_priv->bInterfaceNumber, NULL, 0, 300); 350 port_priv->bInterfaceNumber, NULL, 0,
351 USB_CTRL_SET_TIMEOUT);
349 } 352 }
350 353
351 kfree(buf); 354 kfree(buf);
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c
index fdd5aa2c8d82..8c8bf806f6fa 100644
--- a/drivers/usb/serial/sierra.c
+++ b/drivers/usb/serial/sierra.c
@@ -221,7 +221,7 @@ static const struct sierra_iface_info typeB_interface_list = {
221}; 221};
222 222
223/* 'blacklist' of interfaces not served by this driver */ 223/* 'blacklist' of interfaces not served by this driver */
224static const u8 direct_ip_non_serial_ifaces[] = { 7, 8, 9, 10, 11 }; 224static const u8 direct_ip_non_serial_ifaces[] = { 7, 8, 9, 10, 11, 19, 20 };
225static const struct sierra_iface_info direct_ip_interface_blacklist = { 225static const struct sierra_iface_info direct_ip_interface_blacklist = {
226 .infolen = ARRAY_SIZE(direct_ip_non_serial_ifaces), 226 .infolen = ARRAY_SIZE(direct_ip_non_serial_ifaces),
227 .ifaceinfo = direct_ip_non_serial_ifaces, 227 .ifaceinfo = direct_ip_non_serial_ifaces,
@@ -289,7 +289,6 @@ static const struct usb_device_id id_table[] = {
289 { USB_DEVICE(0x1199, 0x6856) }, /* Sierra Wireless AirCard 881 U */ 289 { USB_DEVICE(0x1199, 0x6856) }, /* Sierra Wireless AirCard 881 U */
290 { USB_DEVICE(0x1199, 0x6859) }, /* Sierra Wireless AirCard 885 E */ 290 { USB_DEVICE(0x1199, 0x6859) }, /* Sierra Wireless AirCard 885 E */
291 { USB_DEVICE(0x1199, 0x685A) }, /* Sierra Wireless AirCard 885 E */ 291 { USB_DEVICE(0x1199, 0x685A) }, /* Sierra Wireless AirCard 885 E */
292 { USB_DEVICE(0x1199, 0x68A2) }, /* Sierra Wireless MC7710 */
293 /* Sierra Wireless C885 */ 292 /* Sierra Wireless C885 */
294 { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6880, 0xFF, 0xFF, 0xFF)}, 293 { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6880, 0xFF, 0xFF, 0xFF)},
295 /* Sierra Wireless C888, Air Card 501, USB 303, USB 304 */ 294 /* Sierra Wireless C888, Air Card 501, USB 303, USB 304 */
@@ -299,6 +298,9 @@ static const struct usb_device_id id_table[] = {
299 /* Sierra Wireless HSPA Non-Composite Device */ 298 /* Sierra Wireless HSPA Non-Composite Device */
300 { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6892, 0xFF, 0xFF, 0xFF)}, 299 { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6892, 0xFF, 0xFF, 0xFF)},
301 { USB_DEVICE(0x1199, 0x6893) }, /* Sierra Wireless Device */ 300 { USB_DEVICE(0x1199, 0x6893) }, /* Sierra Wireless Device */
301 { USB_DEVICE(0x1199, 0x68A2), /* Sierra Wireless MC77xx in QMI mode */
302 .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist
303 },
302 { USB_DEVICE(0x1199, 0x68A3), /* Sierra Wireless Direct IP modems */ 304 { USB_DEVICE(0x1199, 0x68A3), /* Sierra Wireless Direct IP modems */
303 .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist 305 .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist
304 }, 306 },
diff --git a/drivers/uwb/hwa-rc.c b/drivers/uwb/hwa-rc.c
index 66797e9c5010..810c90ae2c55 100644
--- a/drivers/uwb/hwa-rc.c
+++ b/drivers/uwb/hwa-rc.c
@@ -645,7 +645,8 @@ void hwarc_neep_cb(struct urb *urb)
645 dev_err(dev, "NEEP: URB error %d\n", urb->status); 645 dev_err(dev, "NEEP: URB error %d\n", urb->status);
646 } 646 }
647 result = usb_submit_urb(urb, GFP_ATOMIC); 647 result = usb_submit_urb(urb, GFP_ATOMIC);
648 if (result < 0) { 648 if (result < 0 && result != -ENODEV && result != -EPERM) {
649 /* ignoring unrecoverable errors */
649 dev_err(dev, "NEEP: Can't resubmit URB (%d) resetting device\n", 650 dev_err(dev, "NEEP: Can't resubmit URB (%d) resetting device\n",
650 result); 651 result);
651 goto error; 652 goto error;
diff --git a/drivers/uwb/neh.c b/drivers/uwb/neh.c
index a269937be1b8..8cb71bb333c2 100644
--- a/drivers/uwb/neh.c
+++ b/drivers/uwb/neh.c
@@ -107,6 +107,7 @@ struct uwb_rc_neh {
107 u8 evt_type; 107 u8 evt_type;
108 __le16 evt; 108 __le16 evt;
109 u8 context; 109 u8 context;
110 u8 completed;
110 uwb_rc_cmd_cb_f cb; 111 uwb_rc_cmd_cb_f cb;
111 void *arg; 112 void *arg;
112 113
@@ -409,6 +410,7 @@ static void uwb_rc_neh_grok_event(struct uwb_rc *rc, struct uwb_rceb *rceb, size
409 struct device *dev = &rc->uwb_dev.dev; 410 struct device *dev = &rc->uwb_dev.dev;
410 struct uwb_rc_neh *neh; 411 struct uwb_rc_neh *neh;
411 struct uwb_rceb *notif; 412 struct uwb_rceb *notif;
413 unsigned long flags;
412 414
413 if (rceb->bEventContext == 0) { 415 if (rceb->bEventContext == 0) {
414 notif = kmalloc(size, GFP_ATOMIC); 416 notif = kmalloc(size, GFP_ATOMIC);
@@ -422,7 +424,11 @@ static void uwb_rc_neh_grok_event(struct uwb_rc *rc, struct uwb_rceb *rceb, size
422 } else { 424 } else {
423 neh = uwb_rc_neh_lookup(rc, rceb); 425 neh = uwb_rc_neh_lookup(rc, rceb);
424 if (neh) { 426 if (neh) {
425 del_timer_sync(&neh->timer); 427 spin_lock_irqsave(&rc->neh_lock, flags);
428 /* to guard against a timeout */
429 neh->completed = 1;
430 del_timer(&neh->timer);
431 spin_unlock_irqrestore(&rc->neh_lock, flags);
426 uwb_rc_neh_cb(neh, rceb, size); 432 uwb_rc_neh_cb(neh, rceb, size);
427 } else 433 } else
428 dev_warn(dev, "event 0x%02x/%04x/%02x (%zu bytes): nobody cared\n", 434 dev_warn(dev, "event 0x%02x/%04x/%02x (%zu bytes): nobody cared\n",
@@ -568,6 +574,10 @@ static void uwb_rc_neh_timer(unsigned long arg)
568 unsigned long flags; 574 unsigned long flags;
569 575
570 spin_lock_irqsave(&rc->neh_lock, flags); 576 spin_lock_irqsave(&rc->neh_lock, flags);
577 if (neh->completed) {
578 spin_unlock_irqrestore(&rc->neh_lock, flags);
579 return;
580 }
571 if (neh->context) 581 if (neh->context)
572 __uwb_rc_neh_rm(rc, neh); 582 __uwb_rc_neh_rm(rc, neh);
573 else 583 else
diff --git a/drivers/vhost/test.c b/drivers/vhost/test.c
index fc9a1d75281f..3de00d9fae2e 100644
--- a/drivers/vhost/test.c
+++ b/drivers/vhost/test.c
@@ -155,7 +155,7 @@ static int vhost_test_release(struct inode *inode, struct file *f)
155 155
156 vhost_test_stop(n, &private); 156 vhost_test_stop(n, &private);
157 vhost_test_flush(n); 157 vhost_test_flush(n);
158 vhost_dev_cleanup(&n->dev); 158 vhost_dev_cleanup(&n->dev, false);
159 /* We do an extra flush before freeing memory, 159 /* We do an extra flush before freeing memory,
160 * since jobs can re-queue themselves. */ 160 * since jobs can re-queue themselves. */
161 vhost_test_flush(n); 161 vhost_test_flush(n);
diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
index 05f0a80818a2..c2d05a8279fd 100644
--- a/drivers/virtio/virtio_balloon.c
+++ b/drivers/virtio/virtio_balloon.c
@@ -28,6 +28,13 @@
28#include <linux/slab.h> 28#include <linux/slab.h>
29#include <linux/module.h> 29#include <linux/module.h>
30 30
31/*
32 * Balloon device works in 4K page units. So each page is pointed to by
33 * multiple balloon pages. All memory counters in this driver are in balloon
34 * page units.
35 */
36#define VIRTIO_BALLOON_PAGES_PER_PAGE (PAGE_SIZE >> VIRTIO_BALLOON_PFN_SHIFT)
37
31struct virtio_balloon 38struct virtio_balloon
32{ 39{
33 struct virtio_device *vdev; 40 struct virtio_device *vdev;
@@ -42,8 +49,13 @@ struct virtio_balloon
42 /* Waiting for host to ack the pages we released. */ 49 /* Waiting for host to ack the pages we released. */
43 struct completion acked; 50 struct completion acked;
44 51
45 /* The pages we've told the Host we're not using. */ 52 /* Number of balloon pages we've told the Host we're not using. */
46 unsigned int num_pages; 53 unsigned int num_pages;
54 /*
55 * The pages we've told the Host we're not using.
56 * Each page on this list adds VIRTIO_BALLOON_PAGES_PER_PAGE
57 * to num_pages above.
58 */
47 struct list_head pages; 59 struct list_head pages;
48 60
49 /* The array of pfns we tell the Host about. */ 61 /* The array of pfns we tell the Host about. */
@@ -66,7 +78,13 @@ static u32 page_to_balloon_pfn(struct page *page)
66 78
67 BUILD_BUG_ON(PAGE_SHIFT < VIRTIO_BALLOON_PFN_SHIFT); 79 BUILD_BUG_ON(PAGE_SHIFT < VIRTIO_BALLOON_PFN_SHIFT);
68 /* Convert pfn from Linux page size to balloon page size. */ 80 /* Convert pfn from Linux page size to balloon page size. */
69 return pfn >> (PAGE_SHIFT - VIRTIO_BALLOON_PFN_SHIFT); 81 return pfn * VIRTIO_BALLOON_PAGES_PER_PAGE;
82}
83
84static struct page *balloon_pfn_to_page(u32 pfn)
85{
86 BUG_ON(pfn % VIRTIO_BALLOON_PAGES_PER_PAGE);
87 return pfn_to_page(pfn / VIRTIO_BALLOON_PAGES_PER_PAGE);
70} 88}
71 89
72static void balloon_ack(struct virtqueue *vq) 90static void balloon_ack(struct virtqueue *vq)
@@ -96,12 +114,23 @@ static void tell_host(struct virtio_balloon *vb, struct virtqueue *vq)
96 wait_for_completion(&vb->acked); 114 wait_for_completion(&vb->acked);
97} 115}
98 116
117static void set_page_pfns(u32 pfns[], struct page *page)
118{
119 unsigned int i;
120
121 /* Set balloon pfns pointing at this page.
122 * Note that the first pfn points at start of the page. */
123 for (i = 0; i < VIRTIO_BALLOON_PAGES_PER_PAGE; i++)
124 pfns[i] = page_to_balloon_pfn(page) + i;
125}
126
99static void fill_balloon(struct virtio_balloon *vb, size_t num) 127static void fill_balloon(struct virtio_balloon *vb, size_t num)
100{ 128{
101 /* We can only do one array worth at a time. */ 129 /* We can only do one array worth at a time. */
102 num = min(num, ARRAY_SIZE(vb->pfns)); 130 num = min(num, ARRAY_SIZE(vb->pfns));
103 131
104 for (vb->num_pfns = 0; vb->num_pfns < num; vb->num_pfns++) { 132 for (vb->num_pfns = 0; vb->num_pfns < num;
133 vb->num_pfns += VIRTIO_BALLOON_PAGES_PER_PAGE) {
105 struct page *page = alloc_page(GFP_HIGHUSER | __GFP_NORETRY | 134 struct page *page = alloc_page(GFP_HIGHUSER | __GFP_NORETRY |
106 __GFP_NOMEMALLOC | __GFP_NOWARN); 135 __GFP_NOMEMALLOC | __GFP_NOWARN);
107 if (!page) { 136 if (!page) {
@@ -113,9 +142,9 @@ static void fill_balloon(struct virtio_balloon *vb, size_t num)
113 msleep(200); 142 msleep(200);
114 break; 143 break;
115 } 144 }
116 vb->pfns[vb->num_pfns] = page_to_balloon_pfn(page); 145 set_page_pfns(vb->pfns + vb->num_pfns, page);
146 vb->num_pages += VIRTIO_BALLOON_PAGES_PER_PAGE;
117 totalram_pages--; 147 totalram_pages--;
118 vb->num_pages++;
119 list_add(&page->lru, &vb->pages); 148 list_add(&page->lru, &vb->pages);
120 } 149 }
121 150
@@ -130,8 +159,9 @@ static void release_pages_by_pfn(const u32 pfns[], unsigned int num)
130{ 159{
131 unsigned int i; 160 unsigned int i;
132 161
133 for (i = 0; i < num; i++) { 162 /* Find pfns pointing at start of each page, get pages and free them. */
134 __free_page(pfn_to_page(pfns[i])); 163 for (i = 0; i < num; i += VIRTIO_BALLOON_PAGES_PER_PAGE) {
164 __free_page(balloon_pfn_to_page(pfns[i]));
135 totalram_pages++; 165 totalram_pages++;
136 } 166 }
137} 167}
@@ -143,11 +173,12 @@ static void leak_balloon(struct virtio_balloon *vb, size_t num)
143 /* We can only do one array worth at a time. */ 173 /* We can only do one array worth at a time. */
144 num = min(num, ARRAY_SIZE(vb->pfns)); 174 num = min(num, ARRAY_SIZE(vb->pfns));
145 175
146 for (vb->num_pfns = 0; vb->num_pfns < num; vb->num_pfns++) { 176 for (vb->num_pfns = 0; vb->num_pfns < num;
177 vb->num_pfns += VIRTIO_BALLOON_PAGES_PER_PAGE) {
147 page = list_first_entry(&vb->pages, struct page, lru); 178 page = list_first_entry(&vb->pages, struct page, lru);
148 list_del(&page->lru); 179 list_del(&page->lru);
149 vb->pfns[vb->num_pfns] = page_to_balloon_pfn(page); 180 set_page_pfns(vb->pfns + vb->num_pfns, page);
150 vb->num_pages--; 181 vb->num_pages -= VIRTIO_BALLOON_PAGES_PER_PAGE;
151 } 182 }
152 183
153 /* 184 /*
@@ -234,11 +265,14 @@ static void virtballoon_changed(struct virtio_device *vdev)
234 265
235static inline s64 towards_target(struct virtio_balloon *vb) 266static inline s64 towards_target(struct virtio_balloon *vb)
236{ 267{
237 u32 v; 268 __le32 v;
269 s64 target;
270
238 vb->vdev->config->get(vb->vdev, 271 vb->vdev->config->get(vb->vdev,
239 offsetof(struct virtio_balloon_config, num_pages), 272 offsetof(struct virtio_balloon_config, num_pages),
240 &v, sizeof(v)); 273 &v, sizeof(v));
241 return (s64)v - vb->num_pages; 274 target = le32_to_cpu(v);
275 return target - vb->num_pages;
242} 276}
243 277
244static void update_balloon_size(struct virtio_balloon *vb) 278static void update_balloon_size(struct virtio_balloon *vb)
diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c
index 99d8151c824a..1ffd03bf8e10 100644
--- a/drivers/xen/gntdev.c
+++ b/drivers/xen/gntdev.c
@@ -722,7 +722,7 @@ static int gntdev_mmap(struct file *flip, struct vm_area_struct *vma)
722 vma->vm_flags |= VM_RESERVED|VM_DONTEXPAND; 722 vma->vm_flags |= VM_RESERVED|VM_DONTEXPAND;
723 723
724 if (use_ptemod) 724 if (use_ptemod)
725 vma->vm_flags |= VM_DONTCOPY|VM_PFNMAP; 725 vma->vm_flags |= VM_DONTCOPY;
726 726
727 vma->vm_private_data = map; 727 vma->vm_private_data = map;
728 728
diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c
index b4d4eac761db..f100ce20b16b 100644
--- a/drivers/xen/grant-table.c
+++ b/drivers/xen/grant-table.c
@@ -1029,6 +1029,7 @@ int gnttab_init(void)
1029 int i; 1029 int i;
1030 unsigned int max_nr_glist_frames, nr_glist_frames; 1030 unsigned int max_nr_glist_frames, nr_glist_frames;
1031 unsigned int nr_init_grefs; 1031 unsigned int nr_init_grefs;
1032 int ret;
1032 1033
1033 nr_grant_frames = 1; 1034 nr_grant_frames = 1;
1034 boot_max_nr_grant_frames = __max_nr_grant_frames(); 1035 boot_max_nr_grant_frames = __max_nr_grant_frames();
@@ -1047,12 +1048,16 @@ int gnttab_init(void)
1047 nr_glist_frames = (nr_grant_frames * GREFS_PER_GRANT_FRAME + RPP - 1) / RPP; 1048 nr_glist_frames = (nr_grant_frames * GREFS_PER_GRANT_FRAME + RPP - 1) / RPP;
1048 for (i = 0; i < nr_glist_frames; i++) { 1049 for (i = 0; i < nr_glist_frames; i++) {
1049 gnttab_list[i] = (grant_ref_t *)__get_free_page(GFP_KERNEL); 1050 gnttab_list[i] = (grant_ref_t *)__get_free_page(GFP_KERNEL);
1050 if (gnttab_list[i] == NULL) 1051 if (gnttab_list[i] == NULL) {
1052 ret = -ENOMEM;
1051 goto ini_nomem; 1053 goto ini_nomem;
1054 }
1052 } 1055 }
1053 1056
1054 if (gnttab_resume() < 0) 1057 if (gnttab_resume() < 0) {
1055 return -ENODEV; 1058 ret = -ENODEV;
1059 goto ini_nomem;
1060 }
1056 1061
1057 nr_init_grefs = nr_grant_frames * GREFS_PER_GRANT_FRAME; 1062 nr_init_grefs = nr_grant_frames * GREFS_PER_GRANT_FRAME;
1058 1063
@@ -1070,7 +1075,7 @@ int gnttab_init(void)
1070 for (i--; i >= 0; i--) 1075 for (i--; i >= 0; i--)
1071 free_page((unsigned long)gnttab_list[i]); 1076 free_page((unsigned long)gnttab_list[i]);
1072 kfree(gnttab_list); 1077 kfree(gnttab_list);
1073 return -ENOMEM; 1078 return ret;
1074} 1079}
1075EXPORT_SYMBOL_GPL(gnttab_init); 1080EXPORT_SYMBOL_GPL(gnttab_init);
1076 1081
diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c
index 9e14ae6cd49c..412b96cc5305 100644
--- a/drivers/xen/manage.c
+++ b/drivers/xen/manage.c
@@ -132,6 +132,7 @@ static void do_suspend(void)
132 err = dpm_suspend_end(PMSG_FREEZE); 132 err = dpm_suspend_end(PMSG_FREEZE);
133 if (err) { 133 if (err) {
134 printk(KERN_ERR "dpm_suspend_end failed: %d\n", err); 134 printk(KERN_ERR "dpm_suspend_end failed: %d\n", err);
135 si.cancelled = 0;
135 goto out_resume; 136 goto out_resume;
136 } 137 }
137 138
diff --git a/drivers/xen/xenbus/xenbus_probe_frontend.c b/drivers/xen/xenbus/xenbus_probe_frontend.c
index f20c5f178b40..a31b54d48839 100644
--- a/drivers/xen/xenbus/xenbus_probe_frontend.c
+++ b/drivers/xen/xenbus/xenbus_probe_frontend.c
@@ -135,7 +135,7 @@ static int read_backend_details(struct xenbus_device *xendev)
135 return xenbus_read_otherend_details(xendev, "backend-id", "backend"); 135 return xenbus_read_otherend_details(xendev, "backend-id", "backend");
136} 136}
137 137
138static int is_device_connecting(struct device *dev, void *data) 138static int is_device_connecting(struct device *dev, void *data, bool ignore_nonessential)
139{ 139{
140 struct xenbus_device *xendev = to_xenbus_device(dev); 140 struct xenbus_device *xendev = to_xenbus_device(dev);
141 struct device_driver *drv = data; 141 struct device_driver *drv = data;
@@ -152,16 +152,41 @@ static int is_device_connecting(struct device *dev, void *data)
152 if (drv && (dev->driver != drv)) 152 if (drv && (dev->driver != drv))
153 return 0; 153 return 0;
154 154
155 if (ignore_nonessential) {
156 /* With older QEMU, for PVonHVM guests the guest config files
157 * could contain: vfb = [ 'vnc=1, vnclisten=0.0.0.0']
158 * which is nonsensical as there is no PV FB (there can be
159 * a PVKB) running as HVM guest. */
160
161 if ((strncmp(xendev->nodename, "device/vkbd", 11) == 0))
162 return 0;
163
164 if ((strncmp(xendev->nodename, "device/vfb", 10) == 0))
165 return 0;
166 }
155 xendrv = to_xenbus_driver(dev->driver); 167 xendrv = to_xenbus_driver(dev->driver);
156 return (xendev->state < XenbusStateConnected || 168 return (xendev->state < XenbusStateConnected ||
157 (xendev->state == XenbusStateConnected && 169 (xendev->state == XenbusStateConnected &&
158 xendrv->is_ready && !xendrv->is_ready(xendev))); 170 xendrv->is_ready && !xendrv->is_ready(xendev)));
159} 171}
172static int essential_device_connecting(struct device *dev, void *data)
173{
174 return is_device_connecting(dev, data, true /* ignore PV[KBB+FB] */);
175}
176static int non_essential_device_connecting(struct device *dev, void *data)
177{
178 return is_device_connecting(dev, data, false);
179}
160 180
161static int exists_connecting_device(struct device_driver *drv) 181static int exists_essential_connecting_device(struct device_driver *drv)
162{ 182{
163 return bus_for_each_dev(&xenbus_frontend.bus, NULL, drv, 183 return bus_for_each_dev(&xenbus_frontend.bus, NULL, drv,
164 is_device_connecting); 184 essential_device_connecting);
185}
186static int exists_non_essential_connecting_device(struct device_driver *drv)
187{
188 return bus_for_each_dev(&xenbus_frontend.bus, NULL, drv,
189 non_essential_device_connecting);
165} 190}
166 191
167static int print_device_status(struct device *dev, void *data) 192static int print_device_status(struct device *dev, void *data)
@@ -192,6 +217,23 @@ static int print_device_status(struct device *dev, void *data)
192/* We only wait for device setup after most initcalls have run. */ 217/* We only wait for device setup after most initcalls have run. */
193static int ready_to_wait_for_devices; 218static int ready_to_wait_for_devices;
194 219
220static bool wait_loop(unsigned long start, unsigned int max_delay,
221 unsigned int *seconds_waited)
222{
223 if (time_after(jiffies, start + (*seconds_waited+5)*HZ)) {
224 if (!*seconds_waited)
225 printk(KERN_WARNING "XENBUS: Waiting for "
226 "devices to initialise: ");
227 *seconds_waited += 5;
228 printk("%us...", max_delay - *seconds_waited);
229 if (*seconds_waited == max_delay)
230 return true;
231 }
232
233 schedule_timeout_interruptible(HZ/10);
234
235 return false;
236}
195/* 237/*
196 * On a 5-minute timeout, wait for all devices currently configured. We need 238 * On a 5-minute timeout, wait for all devices currently configured. We need
197 * to do this to guarantee that the filesystems and / or network devices 239 * to do this to guarantee that the filesystems and / or network devices
@@ -215,19 +257,14 @@ static void wait_for_devices(struct xenbus_driver *xendrv)
215 if (!ready_to_wait_for_devices || !xen_domain()) 257 if (!ready_to_wait_for_devices || !xen_domain())
216 return; 258 return;
217 259
218 while (exists_connecting_device(drv)) { 260 while (exists_non_essential_connecting_device(drv))
219 if (time_after(jiffies, start + (seconds_waited+5)*HZ)) { 261 if (wait_loop(start, 30, &seconds_waited))
220 if (!seconds_waited) 262 break;
221 printk(KERN_WARNING "XENBUS: Waiting for " 263
222 "devices to initialise: "); 264 /* Skips PVKB and PVFB check.*/
223 seconds_waited += 5; 265 while (exists_essential_connecting_device(drv))
224 printk("%us...", 300 - seconds_waited); 266 if (wait_loop(start, 270, &seconds_waited))
225 if (seconds_waited == 300) 267 break;
226 break;
227 }
228
229 schedule_timeout_interruptible(HZ/10);
230 }
231 268
232 if (seconds_waited) 269 if (seconds_waited)
233 printk("\n"); 270 printk("\n");
diff --git a/fs/aio.c b/fs/aio.c
index da887604dfc5..67a6db3e1b6f 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -93,9 +93,8 @@ static void aio_free_ring(struct kioctx *ctx)
93 put_page(info->ring_pages[i]); 93 put_page(info->ring_pages[i]);
94 94
95 if (info->mmap_size) { 95 if (info->mmap_size) {
96 down_write(&ctx->mm->mmap_sem); 96 BUG_ON(ctx->mm != current->mm);
97 do_munmap(ctx->mm, info->mmap_base, info->mmap_size); 97 vm_munmap(info->mmap_base, info->mmap_size);
98 up_write(&ctx->mm->mmap_sem);
99 } 98 }
100 99
101 if (info->ring_pages && info->ring_pages != info->internal_pages) 100 if (info->ring_pages && info->ring_pages != info->internal_pages)
@@ -389,6 +388,17 @@ void exit_aio(struct mm_struct *mm)
389 "exit_aio:ioctx still alive: %d %d %d\n", 388 "exit_aio:ioctx still alive: %d %d %d\n",
390 atomic_read(&ctx->users), ctx->dead, 389 atomic_read(&ctx->users), ctx->dead,
391 ctx->reqs_active); 390 ctx->reqs_active);
391 /*
392 * We don't need to bother with munmap() here -
393 * exit_mmap(mm) is coming and it'll unmap everything.
394 * Since aio_free_ring() uses non-zero ->mmap_size
395 * as indicator that it needs to unmap the area,
396 * just set it to 0; aio_free_ring() is the only
397 * place that uses ->mmap_size, so it's safe.
398 * That way we get all munmap done to current->mm -
399 * all other callers have ctx->mm == current->mm.
400 */
401 ctx->ring_info.mmap_size = 0;
392 put_ioctx(ctx); 402 put_ioctx(ctx);
393 } 403 }
394} 404}
diff --git a/fs/binfmt_aout.c b/fs/binfmt_aout.c
index 2eb12f13593d..d146e181d10d 100644
--- a/fs/binfmt_aout.c
+++ b/fs/binfmt_aout.c
@@ -50,9 +50,7 @@ static int set_brk(unsigned long start, unsigned long end)
50 end = PAGE_ALIGN(end); 50 end = PAGE_ALIGN(end);
51 if (end > start) { 51 if (end > start) {
52 unsigned long addr; 52 unsigned long addr;
53 down_write(&current->mm->mmap_sem); 53 addr = vm_brk(start, end - start);
54 addr = do_brk(start, end - start);
55 up_write(&current->mm->mmap_sem);
56 if (BAD_ADDR(addr)) 54 if (BAD_ADDR(addr))
57 return addr; 55 return addr;
58 } 56 }
@@ -280,9 +278,7 @@ static int load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs)
280 pos = 32; 278 pos = 32;
281 map_size = ex.a_text+ex.a_data; 279 map_size = ex.a_text+ex.a_data;
282#endif 280#endif
283 down_write(&current->mm->mmap_sem); 281 error = vm_brk(text_addr & PAGE_MASK, map_size);
284 error = do_brk(text_addr & PAGE_MASK, map_size);
285 up_write(&current->mm->mmap_sem);
286 if (error != (text_addr & PAGE_MASK)) { 282 if (error != (text_addr & PAGE_MASK)) {
287 send_sig(SIGKILL, current, 0); 283 send_sig(SIGKILL, current, 0);
288 return error; 284 return error;
@@ -313,9 +309,7 @@ static int load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs)
313 309
314 if (!bprm->file->f_op->mmap||((fd_offset & ~PAGE_MASK) != 0)) { 310 if (!bprm->file->f_op->mmap||((fd_offset & ~PAGE_MASK) != 0)) {
315 loff_t pos = fd_offset; 311 loff_t pos = fd_offset;
316 down_write(&current->mm->mmap_sem); 312 vm_brk(N_TXTADDR(ex), ex.a_text+ex.a_data);
317 do_brk(N_TXTADDR(ex), ex.a_text+ex.a_data);
318 up_write(&current->mm->mmap_sem);
319 bprm->file->f_op->read(bprm->file, 313 bprm->file->f_op->read(bprm->file,
320 (char __user *)N_TXTADDR(ex), 314 (char __user *)N_TXTADDR(ex),
321 ex.a_text+ex.a_data, &pos); 315 ex.a_text+ex.a_data, &pos);
@@ -325,24 +319,20 @@ static int load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs)
325 goto beyond_if; 319 goto beyond_if;
326 } 320 }
327 321
328 down_write(&current->mm->mmap_sem); 322 error = vm_mmap(bprm->file, N_TXTADDR(ex), ex.a_text,
329 error = do_mmap(bprm->file, N_TXTADDR(ex), ex.a_text,
330 PROT_READ | PROT_EXEC, 323 PROT_READ | PROT_EXEC,
331 MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | MAP_EXECUTABLE, 324 MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | MAP_EXECUTABLE,
332 fd_offset); 325 fd_offset);
333 up_write(&current->mm->mmap_sem);
334 326
335 if (error != N_TXTADDR(ex)) { 327 if (error != N_TXTADDR(ex)) {
336 send_sig(SIGKILL, current, 0); 328 send_sig(SIGKILL, current, 0);
337 return error; 329 return error;
338 } 330 }
339 331
340 down_write(&current->mm->mmap_sem); 332 error = vm_mmap(bprm->file, N_DATADDR(ex), ex.a_data,
341 error = do_mmap(bprm->file, N_DATADDR(ex), ex.a_data,
342 PROT_READ | PROT_WRITE | PROT_EXEC, 333 PROT_READ | PROT_WRITE | PROT_EXEC,
343 MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | MAP_EXECUTABLE, 334 MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | MAP_EXECUTABLE,
344 fd_offset + ex.a_text); 335 fd_offset + ex.a_text);
345 up_write(&current->mm->mmap_sem);
346 if (error != N_DATADDR(ex)) { 336 if (error != N_DATADDR(ex)) {
347 send_sig(SIGKILL, current, 0); 337 send_sig(SIGKILL, current, 0);
348 return error; 338 return error;
@@ -412,9 +402,7 @@ static int load_aout_library(struct file *file)
412 "N_TXTOFF is not page aligned. Please convert library: %s\n", 402 "N_TXTOFF is not page aligned. Please convert library: %s\n",
413 file->f_path.dentry->d_name.name); 403 file->f_path.dentry->d_name.name);
414 } 404 }
415 down_write(&current->mm->mmap_sem); 405 vm_brk(start_addr, ex.a_text + ex.a_data + ex.a_bss);
416 do_brk(start_addr, ex.a_text + ex.a_data + ex.a_bss);
417 up_write(&current->mm->mmap_sem);
418 406
419 file->f_op->read(file, (char __user *)start_addr, 407 file->f_op->read(file, (char __user *)start_addr,
420 ex.a_text + ex.a_data, &pos); 408 ex.a_text + ex.a_data, &pos);
@@ -425,12 +413,10 @@ static int load_aout_library(struct file *file)
425 goto out; 413 goto out;
426 } 414 }
427 /* Now use mmap to map the library into memory. */ 415 /* Now use mmap to map the library into memory. */
428 down_write(&current->mm->mmap_sem); 416 error = vm_mmap(file, start_addr, ex.a_text + ex.a_data,
429 error = do_mmap(file, start_addr, ex.a_text + ex.a_data,
430 PROT_READ | PROT_WRITE | PROT_EXEC, 417 PROT_READ | PROT_WRITE | PROT_EXEC,
431 MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE, 418 MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE,
432 N_TXTOFF(ex)); 419 N_TXTOFF(ex));
433 up_write(&current->mm->mmap_sem);
434 retval = error; 420 retval = error;
435 if (error != start_addr) 421 if (error != start_addr)
436 goto out; 422 goto out;
@@ -438,9 +424,7 @@ static int load_aout_library(struct file *file)
438 len = PAGE_ALIGN(ex.a_text + ex.a_data); 424 len = PAGE_ALIGN(ex.a_text + ex.a_data);
439 bss = ex.a_text + ex.a_data + ex.a_bss; 425 bss = ex.a_text + ex.a_data + ex.a_bss;
440 if (bss > len) { 426 if (bss > len) {
441 down_write(&current->mm->mmap_sem); 427 error = vm_brk(start_addr + len, bss - len);
442 error = do_brk(start_addr + len, bss - len);
443 up_write(&current->mm->mmap_sem);
444 retval = error; 428 retval = error;
445 if (error != start_addr + len) 429 if (error != start_addr + len)
446 goto out; 430 goto out;
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index 48ffb3dc610a..16f735417072 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -82,9 +82,7 @@ static int set_brk(unsigned long start, unsigned long end)
82 end = ELF_PAGEALIGN(end); 82 end = ELF_PAGEALIGN(end);
83 if (end > start) { 83 if (end > start) {
84 unsigned long addr; 84 unsigned long addr;
85 down_write(&current->mm->mmap_sem); 85 addr = vm_brk(start, end - start);
86 addr = do_brk(start, end - start);
87 up_write(&current->mm->mmap_sem);
88 if (BAD_ADDR(addr)) 86 if (BAD_ADDR(addr))
89 return addr; 87 return addr;
90 } 88 }
@@ -514,9 +512,7 @@ static unsigned long load_elf_interp(struct elfhdr *interp_elf_ex,
514 elf_bss = ELF_PAGESTART(elf_bss + ELF_MIN_ALIGN - 1); 512 elf_bss = ELF_PAGESTART(elf_bss + ELF_MIN_ALIGN - 1);
515 513
516 /* Map the last of the bss segment */ 514 /* Map the last of the bss segment */
517 down_write(&current->mm->mmap_sem); 515 error = vm_brk(elf_bss, last_bss - elf_bss);
518 error = do_brk(elf_bss, last_bss - elf_bss);
519 up_write(&current->mm->mmap_sem);
520 if (BAD_ADDR(error)) 516 if (BAD_ADDR(error))
521 goto out_close; 517 goto out_close;
522 } 518 }
@@ -962,10 +958,8 @@ static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs)
962 and some applications "depend" upon this behavior. 958 and some applications "depend" upon this behavior.
963 Since we do not have the power to recompile these, we 959 Since we do not have the power to recompile these, we
964 emulate the SVr4 behavior. Sigh. */ 960 emulate the SVr4 behavior. Sigh. */
965 down_write(&current->mm->mmap_sem); 961 error = vm_mmap(NULL, 0, PAGE_SIZE, PROT_READ | PROT_EXEC,
966 error = do_mmap(NULL, 0, PAGE_SIZE, PROT_READ | PROT_EXEC,
967 MAP_FIXED | MAP_PRIVATE, 0); 962 MAP_FIXED | MAP_PRIVATE, 0);
968 up_write(&current->mm->mmap_sem);
969 } 963 }
970 964
971#ifdef ELF_PLAT_INIT 965#ifdef ELF_PLAT_INIT
@@ -1050,8 +1044,7 @@ static int load_elf_library(struct file *file)
1050 eppnt++; 1044 eppnt++;
1051 1045
1052 /* Now use mmap to map the library into memory. */ 1046 /* Now use mmap to map the library into memory. */
1053 down_write(&current->mm->mmap_sem); 1047 error = vm_mmap(file,
1054 error = do_mmap(file,
1055 ELF_PAGESTART(eppnt->p_vaddr), 1048 ELF_PAGESTART(eppnt->p_vaddr),
1056 (eppnt->p_filesz + 1049 (eppnt->p_filesz +
1057 ELF_PAGEOFFSET(eppnt->p_vaddr)), 1050 ELF_PAGEOFFSET(eppnt->p_vaddr)),
@@ -1059,7 +1052,6 @@ static int load_elf_library(struct file *file)
1059 MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE, 1052 MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE,
1060 (eppnt->p_offset - 1053 (eppnt->p_offset -
1061 ELF_PAGEOFFSET(eppnt->p_vaddr))); 1054 ELF_PAGEOFFSET(eppnt->p_vaddr)));
1062 up_write(&current->mm->mmap_sem);
1063 if (error != ELF_PAGESTART(eppnt->p_vaddr)) 1055 if (error != ELF_PAGESTART(eppnt->p_vaddr))
1064 goto out_free_ph; 1056 goto out_free_ph;
1065 1057
@@ -1072,11 +1064,8 @@ static int load_elf_library(struct file *file)
1072 len = ELF_PAGESTART(eppnt->p_filesz + eppnt->p_vaddr + 1064 len = ELF_PAGESTART(eppnt->p_filesz + eppnt->p_vaddr +
1073 ELF_MIN_ALIGN - 1); 1065 ELF_MIN_ALIGN - 1);
1074 bss = eppnt->p_memsz + eppnt->p_vaddr; 1066 bss = eppnt->p_memsz + eppnt->p_vaddr;
1075 if (bss > len) { 1067 if (bss > len)
1076 down_write(&current->mm->mmap_sem); 1068 vm_brk(len, bss - len);
1077 do_brk(len, bss - len);
1078 up_write(&current->mm->mmap_sem);
1079 }
1080 error = 0; 1069 error = 0;
1081 1070
1082out_free_ph: 1071out_free_ph:
diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c
index 9bd5612a8224..d390a0fffc65 100644
--- a/fs/binfmt_elf_fdpic.c
+++ b/fs/binfmt_elf_fdpic.c
@@ -390,21 +390,17 @@ static int load_elf_fdpic_binary(struct linux_binprm *bprm,
390 (executable_stack == EXSTACK_DEFAULT && VM_STACK_FLAGS & VM_EXEC)) 390 (executable_stack == EXSTACK_DEFAULT && VM_STACK_FLAGS & VM_EXEC))
391 stack_prot |= PROT_EXEC; 391 stack_prot |= PROT_EXEC;
392 392
393 down_write(&current->mm->mmap_sem); 393 current->mm->start_brk = vm_mmap(NULL, 0, stack_size, stack_prot,
394 current->mm->start_brk = do_mmap(NULL, 0, stack_size, stack_prot,
395 MAP_PRIVATE | MAP_ANONYMOUS | 394 MAP_PRIVATE | MAP_ANONYMOUS |
396 MAP_UNINITIALIZED | MAP_GROWSDOWN, 395 MAP_UNINITIALIZED | MAP_GROWSDOWN,
397 0); 396 0);
398 397
399 if (IS_ERR_VALUE(current->mm->start_brk)) { 398 if (IS_ERR_VALUE(current->mm->start_brk)) {
400 up_write(&current->mm->mmap_sem);
401 retval = current->mm->start_brk; 399 retval = current->mm->start_brk;
402 current->mm->start_brk = 0; 400 current->mm->start_brk = 0;
403 goto error_kill; 401 goto error_kill;
404 } 402 }
405 403
406 up_write(&current->mm->mmap_sem);
407
408 current->mm->brk = current->mm->start_brk; 404 current->mm->brk = current->mm->start_brk;
409 current->mm->context.end_brk = current->mm->start_brk; 405 current->mm->context.end_brk = current->mm->start_brk;
410 current->mm->context.end_brk += 406 current->mm->context.end_brk +=
@@ -955,10 +951,8 @@ static int elf_fdpic_map_file_constdisp_on_uclinux(
955 if (params->flags & ELF_FDPIC_FLAG_EXECUTABLE) 951 if (params->flags & ELF_FDPIC_FLAG_EXECUTABLE)
956 mflags |= MAP_EXECUTABLE; 952 mflags |= MAP_EXECUTABLE;
957 953
958 down_write(&mm->mmap_sem); 954 maddr = vm_mmap(NULL, load_addr, top - base,
959 maddr = do_mmap(NULL, load_addr, top - base,
960 PROT_READ | PROT_WRITE | PROT_EXEC, mflags, 0); 955 PROT_READ | PROT_WRITE | PROT_EXEC, mflags, 0);
961 up_write(&mm->mmap_sem);
962 if (IS_ERR_VALUE(maddr)) 956 if (IS_ERR_VALUE(maddr))
963 return (int) maddr; 957 return (int) maddr;
964 958
@@ -1096,10 +1090,8 @@ static int elf_fdpic_map_file_by_direct_mmap(struct elf_fdpic_params *params,
1096 1090
1097 /* create the mapping */ 1091 /* create the mapping */
1098 disp = phdr->p_vaddr & ~PAGE_MASK; 1092 disp = phdr->p_vaddr & ~PAGE_MASK;
1099 down_write(&mm->mmap_sem); 1093 maddr = vm_mmap(file, maddr, phdr->p_memsz + disp, prot, flags,
1100 maddr = do_mmap(file, maddr, phdr->p_memsz + disp, prot, flags,
1101 phdr->p_offset - disp); 1094 phdr->p_offset - disp);
1102 up_write(&mm->mmap_sem);
1103 1095
1104 kdebug("mmap[%d] <file> sz=%lx pr=%x fl=%x of=%lx --> %08lx", 1096 kdebug("mmap[%d] <file> sz=%lx pr=%x fl=%x of=%lx --> %08lx",
1105 loop, phdr->p_memsz + disp, prot, flags, 1097 loop, phdr->p_memsz + disp, prot, flags,
@@ -1143,10 +1135,8 @@ static int elf_fdpic_map_file_by_direct_mmap(struct elf_fdpic_params *params,
1143 unsigned long xmaddr; 1135 unsigned long xmaddr;
1144 1136
1145 flags |= MAP_FIXED | MAP_ANONYMOUS; 1137 flags |= MAP_FIXED | MAP_ANONYMOUS;
1146 down_write(&mm->mmap_sem); 1138 xmaddr = vm_mmap(NULL, xaddr, excess - excess1,
1147 xmaddr = do_mmap(NULL, xaddr, excess - excess1,
1148 prot, flags, 0); 1139 prot, flags, 0);
1149 up_write(&mm->mmap_sem);
1150 1140
1151 kdebug("mmap[%d] <anon>" 1141 kdebug("mmap[%d] <anon>"
1152 " ad=%lx sz=%lx pr=%x fl=%x of=0 --> %08lx", 1142 " ad=%lx sz=%lx pr=%x fl=%x of=0 --> %08lx",
diff --git a/fs/binfmt_flat.c b/fs/binfmt_flat.c
index 024d20ee3ca3..6b2daf99fab8 100644
--- a/fs/binfmt_flat.c
+++ b/fs/binfmt_flat.c
@@ -542,10 +542,8 @@ static int load_flat_file(struct linux_binprm * bprm,
542 */ 542 */
543 DBG_FLT("BINFMT_FLAT: ROM mapping of file (we hope)\n"); 543 DBG_FLT("BINFMT_FLAT: ROM mapping of file (we hope)\n");
544 544
545 down_write(&current->mm->mmap_sem); 545 textpos = vm_mmap(bprm->file, 0, text_len, PROT_READ|PROT_EXEC,
546 textpos = do_mmap(bprm->file, 0, text_len, PROT_READ|PROT_EXEC,
547 MAP_PRIVATE|MAP_EXECUTABLE, 0); 546 MAP_PRIVATE|MAP_EXECUTABLE, 0);
548 up_write(&current->mm->mmap_sem);
549 if (!textpos || IS_ERR_VALUE(textpos)) { 547 if (!textpos || IS_ERR_VALUE(textpos)) {
550 if (!textpos) 548 if (!textpos)
551 textpos = (unsigned long) -ENOMEM; 549 textpos = (unsigned long) -ENOMEM;
@@ -556,10 +554,8 @@ static int load_flat_file(struct linux_binprm * bprm,
556 554
557 len = data_len + extra + MAX_SHARED_LIBS * sizeof(unsigned long); 555 len = data_len + extra + MAX_SHARED_LIBS * sizeof(unsigned long);
558 len = PAGE_ALIGN(len); 556 len = PAGE_ALIGN(len);
559 down_write(&current->mm->mmap_sem); 557 realdatastart = vm_mmap(0, 0, len,
560 realdatastart = do_mmap(0, 0, len,
561 PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE, 0); 558 PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE, 0);
562 up_write(&current->mm->mmap_sem);
563 559
564 if (realdatastart == 0 || IS_ERR_VALUE(realdatastart)) { 560 if (realdatastart == 0 || IS_ERR_VALUE(realdatastart)) {
565 if (!realdatastart) 561 if (!realdatastart)
@@ -603,10 +599,8 @@ static int load_flat_file(struct linux_binprm * bprm,
603 599
604 len = text_len + data_len + extra + MAX_SHARED_LIBS * sizeof(unsigned long); 600 len = text_len + data_len + extra + MAX_SHARED_LIBS * sizeof(unsigned long);
605 len = PAGE_ALIGN(len); 601 len = PAGE_ALIGN(len);
606 down_write(&current->mm->mmap_sem); 602 textpos = vm_mmap(0, 0, len,
607 textpos = do_mmap(0, 0, len,
608 PROT_READ | PROT_EXEC | PROT_WRITE, MAP_PRIVATE, 0); 603 PROT_READ | PROT_EXEC | PROT_WRITE, MAP_PRIVATE, 0);
609 up_write(&current->mm->mmap_sem);
610 604
611 if (!textpos || IS_ERR_VALUE(textpos)) { 605 if (!textpos || IS_ERR_VALUE(textpos)) {
612 if (!textpos) 606 if (!textpos)
diff --git a/fs/binfmt_som.c b/fs/binfmt_som.c
index e4fc746629a7..4517aaff61b4 100644
--- a/fs/binfmt_som.c
+++ b/fs/binfmt_som.c
@@ -147,10 +147,8 @@ static int map_som_binary(struct file *file,
147 code_size = SOM_PAGEALIGN(hpuxhdr->exec_tsize); 147 code_size = SOM_PAGEALIGN(hpuxhdr->exec_tsize);
148 current->mm->start_code = code_start; 148 current->mm->start_code = code_start;
149 current->mm->end_code = code_start + code_size; 149 current->mm->end_code = code_start + code_size;
150 down_write(&current->mm->mmap_sem); 150 retval = vm_mmap(file, code_start, code_size, prot,
151 retval = do_mmap(file, code_start, code_size, prot,
152 flags, SOM_PAGESTART(hpuxhdr->exec_tfile)); 151 flags, SOM_PAGESTART(hpuxhdr->exec_tfile));
153 up_write(&current->mm->mmap_sem);
154 if (retval < 0 && retval > -1024) 152 if (retval < 0 && retval > -1024)
155 goto out; 153 goto out;
156 154
@@ -158,20 +156,16 @@ static int map_som_binary(struct file *file,
158 data_size = SOM_PAGEALIGN(hpuxhdr->exec_dsize); 156 data_size = SOM_PAGEALIGN(hpuxhdr->exec_dsize);
159 current->mm->start_data = data_start; 157 current->mm->start_data = data_start;
160 current->mm->end_data = bss_start = data_start + data_size; 158 current->mm->end_data = bss_start = data_start + data_size;
161 down_write(&current->mm->mmap_sem); 159 retval = vm_mmap(file, data_start, data_size,
162 retval = do_mmap(file, data_start, data_size,
163 prot | PROT_WRITE, flags, 160 prot | PROT_WRITE, flags,
164 SOM_PAGESTART(hpuxhdr->exec_dfile)); 161 SOM_PAGESTART(hpuxhdr->exec_dfile));
165 up_write(&current->mm->mmap_sem);
166 if (retval < 0 && retval > -1024) 162 if (retval < 0 && retval > -1024)
167 goto out; 163 goto out;
168 164
169 som_brk = bss_start + SOM_PAGEALIGN(hpuxhdr->exec_bsize); 165 som_brk = bss_start + SOM_PAGEALIGN(hpuxhdr->exec_bsize);
170 current->mm->start_brk = current->mm->brk = som_brk; 166 current->mm->start_brk = current->mm->brk = som_brk;
171 down_write(&current->mm->mmap_sem); 167 retval = vm_mmap(NULL, bss_start, som_brk - bss_start,
172 retval = do_mmap(NULL, bss_start, som_brk - bss_start,
173 prot | PROT_WRITE, MAP_FIXED | MAP_PRIVATE, 0); 168 prot | PROT_WRITE, MAP_FIXED | MAP_PRIVATE, 0);
174 up_write(&current->mm->mmap_sem);
175 if (retval > 0 || retval < -1024) 169 if (retval > 0 || retval < -1024)
176 retval = 0; 170 retval = 0;
177out: 171out:
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 5b8ef8eb3521..3f65a812e282 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -2166,7 +2166,7 @@ BTRFS_SETGET_STACK_FUNCS(root_last_snapshot, struct btrfs_root_item,
2166 2166
2167static inline bool btrfs_root_readonly(struct btrfs_root *root) 2167static inline bool btrfs_root_readonly(struct btrfs_root *root)
2168{ 2168{
2169 return root->root_item.flags & BTRFS_ROOT_SUBVOL_RDONLY; 2169 return (root->root_item.flags & cpu_to_le64(BTRFS_ROOT_SUBVOL_RDONLY)) != 0;
2170} 2170}
2171 2171
2172/* struct btrfs_root_backup */ 2172/* struct btrfs_root_backup */
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index d81e933a796b..f31dc9ac37b7 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -109,6 +109,8 @@ enum {
109 109
110 /* Options which could be blank */ 110 /* Options which could be blank */
111 Opt_blank_pass, 111 Opt_blank_pass,
112 Opt_blank_user,
113 Opt_blank_ip,
112 114
113 Opt_err 115 Opt_err
114}; 116};
@@ -183,11 +185,15 @@ static const match_table_t cifs_mount_option_tokens = {
183 { Opt_wsize, "wsize=%s" }, 185 { Opt_wsize, "wsize=%s" },
184 { Opt_actimeo, "actimeo=%s" }, 186 { Opt_actimeo, "actimeo=%s" },
185 187
188 { Opt_blank_user, "user=" },
189 { Opt_blank_user, "username=" },
186 { Opt_user, "user=%s" }, 190 { Opt_user, "user=%s" },
187 { Opt_user, "username=%s" }, 191 { Opt_user, "username=%s" },
188 { Opt_blank_pass, "pass=" }, 192 { Opt_blank_pass, "pass=" },
189 { Opt_pass, "pass=%s" }, 193 { Opt_pass, "pass=%s" },
190 { Opt_pass, "password=%s" }, 194 { Opt_pass, "password=%s" },
195 { Opt_blank_ip, "ip=" },
196 { Opt_blank_ip, "addr=" },
191 { Opt_ip, "ip=%s" }, 197 { Opt_ip, "ip=%s" },
192 { Opt_ip, "addr=%s" }, 198 { Opt_ip, "addr=%s" },
193 { Opt_unc, "unc=%s" }, 199 { Opt_unc, "unc=%s" },
@@ -1117,7 +1123,7 @@ static int get_option_ul(substring_t args[], unsigned long *option)
1117 string = match_strdup(args); 1123 string = match_strdup(args);
1118 if (string == NULL) 1124 if (string == NULL)
1119 return -ENOMEM; 1125 return -ENOMEM;
1120 rc = kstrtoul(string, 10, option); 1126 rc = kstrtoul(string, 0, option);
1121 kfree(string); 1127 kfree(string);
1122 1128
1123 return rc; 1129 return rc;
@@ -1534,15 +1540,17 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1534 1540
1535 /* String Arguments */ 1541 /* String Arguments */
1536 1542
1543 case Opt_blank_user:
1544 /* null user, ie. anonymous authentication */
1545 vol->nullauth = 1;
1546 vol->username = NULL;
1547 break;
1537 case Opt_user: 1548 case Opt_user:
1538 string = match_strdup(args); 1549 string = match_strdup(args);
1539 if (string == NULL) 1550 if (string == NULL)
1540 goto out_nomem; 1551 goto out_nomem;
1541 1552
1542 if (!*string) { 1553 if (strnlen(string, MAX_USERNAME_SIZE) >
1543 /* null user, ie. anonymous authentication */
1544 vol->nullauth = 1;
1545 } else if (strnlen(string, MAX_USERNAME_SIZE) >
1546 MAX_USERNAME_SIZE) { 1554 MAX_USERNAME_SIZE) {
1547 printk(KERN_WARNING "CIFS: username too long\n"); 1555 printk(KERN_WARNING "CIFS: username too long\n");
1548 goto cifs_parse_mount_err; 1556 goto cifs_parse_mount_err;
@@ -1611,14 +1619,15 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1611 } 1619 }
1612 vol->password[j] = '\0'; 1620 vol->password[j] = '\0';
1613 break; 1621 break;
1622 case Opt_blank_ip:
1623 vol->UNCip = NULL;
1624 break;
1614 case Opt_ip: 1625 case Opt_ip:
1615 string = match_strdup(args); 1626 string = match_strdup(args);
1616 if (string == NULL) 1627 if (string == NULL)
1617 goto out_nomem; 1628 goto out_nomem;
1618 1629
1619 if (!*string) { 1630 if (strnlen(string, INET6_ADDRSTRLEN) >
1620 vol->UNCip = NULL;
1621 } else if (strnlen(string, INET6_ADDRSTRLEN) >
1622 INET6_ADDRSTRLEN) { 1631 INET6_ADDRSTRLEN) {
1623 printk(KERN_WARNING "CIFS: ip address " 1632 printk(KERN_WARNING "CIFS: ip address "
1624 "too long\n"); 1633 "too long\n");
@@ -1636,12 +1645,6 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1636 if (string == NULL) 1645 if (string == NULL)
1637 goto out_nomem; 1646 goto out_nomem;
1638 1647
1639 if (!*string) {
1640 printk(KERN_WARNING "CIFS: invalid path to "
1641 "network resource\n");
1642 goto cifs_parse_mount_err;
1643 }
1644
1645 temp_len = strnlen(string, 300); 1648 temp_len = strnlen(string, 300);
1646 if (temp_len == 300) { 1649 if (temp_len == 300) {
1647 printk(KERN_WARNING "CIFS: UNC name too long\n"); 1650 printk(KERN_WARNING "CIFS: UNC name too long\n");
@@ -1670,11 +1673,7 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1670 if (string == NULL) 1673 if (string == NULL)
1671 goto out_nomem; 1674 goto out_nomem;
1672 1675
1673 if (!*string) { 1676 if (strnlen(string, 256) == 256) {
1674 printk(KERN_WARNING "CIFS: invalid domain"
1675 " name\n");
1676 goto cifs_parse_mount_err;
1677 } else if (strnlen(string, 256) == 256) {
1678 printk(KERN_WARNING "CIFS: domain name too" 1677 printk(KERN_WARNING "CIFS: domain name too"
1679 " long\n"); 1678 " long\n");
1680 goto cifs_parse_mount_err; 1679 goto cifs_parse_mount_err;
@@ -1693,11 +1692,7 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1693 if (string == NULL) 1692 if (string == NULL)
1694 goto out_nomem; 1693 goto out_nomem;
1695 1694
1696 if (!*string) { 1695 if (!cifs_convert_address(
1697 printk(KERN_WARNING "CIFS: srcaddr value not"
1698 " specified\n");
1699 goto cifs_parse_mount_err;
1700 } else if (!cifs_convert_address(
1701 (struct sockaddr *)&vol->srcaddr, 1696 (struct sockaddr *)&vol->srcaddr,
1702 string, strlen(string))) { 1697 string, strlen(string))) {
1703 printk(KERN_WARNING "CIFS: Could not parse" 1698 printk(KERN_WARNING "CIFS: Could not parse"
@@ -1710,11 +1705,6 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1710 if (string == NULL) 1705 if (string == NULL)
1711 goto out_nomem; 1706 goto out_nomem;
1712 1707
1713 if (!*string) {
1714 printk(KERN_WARNING "CIFS: Invalid path"
1715 " prefix\n");
1716 goto cifs_parse_mount_err;
1717 }
1718 temp_len = strnlen(string, 1024); 1708 temp_len = strnlen(string, 1024);
1719 if (string[0] != '/') 1709 if (string[0] != '/')
1720 temp_len++; /* missing leading slash */ 1710 temp_len++; /* missing leading slash */
@@ -1742,11 +1732,7 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1742 if (string == NULL) 1732 if (string == NULL)
1743 goto out_nomem; 1733 goto out_nomem;
1744 1734
1745 if (!*string) { 1735 if (strnlen(string, 1024) >= 65) {
1746 printk(KERN_WARNING "CIFS: Invalid iocharset"
1747 " specified\n");
1748 goto cifs_parse_mount_err;
1749 } else if (strnlen(string, 1024) >= 65) {
1750 printk(KERN_WARNING "CIFS: iocharset name " 1736 printk(KERN_WARNING "CIFS: iocharset name "
1751 "too long.\n"); 1737 "too long.\n");
1752 goto cifs_parse_mount_err; 1738 goto cifs_parse_mount_err;
@@ -1771,11 +1757,6 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1771 if (string == NULL) 1757 if (string == NULL)
1772 goto out_nomem; 1758 goto out_nomem;
1773 1759
1774 if (!*string) {
1775 printk(KERN_WARNING "CIFS: No socket option"
1776 " specified\n");
1777 goto cifs_parse_mount_err;
1778 }
1779 if (strnicmp(string, "TCP_NODELAY", 11) == 0) 1760 if (strnicmp(string, "TCP_NODELAY", 11) == 0)
1780 vol->sockopt_tcp_nodelay = 1; 1761 vol->sockopt_tcp_nodelay = 1;
1781 break; 1762 break;
@@ -1784,12 +1765,6 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1784 if (string == NULL) 1765 if (string == NULL)
1785 goto out_nomem; 1766 goto out_nomem;
1786 1767
1787 if (!*string) {
1788 printk(KERN_WARNING "CIFS: Invalid (empty)"
1789 " netbiosname\n");
1790 break;
1791 }
1792
1793 memset(vol->source_rfc1001_name, 0x20, 1768 memset(vol->source_rfc1001_name, 0x20,
1794 RFC1001_NAME_LEN); 1769 RFC1001_NAME_LEN);
1795 /* 1770 /*
@@ -1817,11 +1792,6 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1817 if (string == NULL) 1792 if (string == NULL)
1818 goto out_nomem; 1793 goto out_nomem;
1819 1794
1820 if (!*string) {
1821 printk(KERN_WARNING "CIFS: Empty server"
1822 " netbiosname specified\n");
1823 break;
1824 }
1825 /* last byte, type, is 0x20 for servr type */ 1795 /* last byte, type, is 0x20 for servr type */
1826 memset(vol->target_rfc1001_name, 0x20, 1796 memset(vol->target_rfc1001_name, 0x20,
1827 RFC1001_NAME_LEN_WITH_NULL); 1797 RFC1001_NAME_LEN_WITH_NULL);
@@ -1848,12 +1818,6 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1848 if (string == NULL) 1818 if (string == NULL)
1849 goto out_nomem; 1819 goto out_nomem;
1850 1820
1851 if (!*string) {
1852 cERROR(1, "no protocol version specified"
1853 " after vers= mount option");
1854 goto cifs_parse_mount_err;
1855 }
1856
1857 if (strnicmp(string, "cifs", 4) == 0 || 1821 if (strnicmp(string, "cifs", 4) == 0 ||
1858 strnicmp(string, "1", 1) == 0) { 1822 strnicmp(string, "1", 1) == 0) {
1859 /* This is the default */ 1823 /* This is the default */
@@ -1868,12 +1832,6 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1868 if (string == NULL) 1832 if (string == NULL)
1869 goto out_nomem; 1833 goto out_nomem;
1870 1834
1871 if (!*string) {
1872 printk(KERN_WARNING "CIFS: no security flavor"
1873 " specified\n");
1874 break;
1875 }
1876
1877 if (cifs_parse_security_flavors(string, vol) != 0) 1835 if (cifs_parse_security_flavors(string, vol) != 0)
1878 goto cifs_parse_mount_err; 1836 goto cifs_parse_mount_err;
1879 break; 1837 break;
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index ab2594a30f86..0e01e90add8b 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -1203,9 +1203,6 @@ struct ext4_sb_info {
1203 unsigned long s_ext_blocks; 1203 unsigned long s_ext_blocks;
1204 unsigned long s_ext_extents; 1204 unsigned long s_ext_extents;
1205#endif 1205#endif
1206 /* ext4 extent cache stats */
1207 unsigned long extent_cache_hits;
1208 unsigned long extent_cache_misses;
1209 1206
1210 /* for buddy allocator */ 1207 /* for buddy allocator */
1211 struct ext4_group_info ***s_group_info; 1208 struct ext4_group_info ***s_group_info;
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 1421938e6792..abcdeab67f52 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -2066,10 +2066,6 @@ static int ext4_ext_check_cache(struct inode *inode, ext4_lblk_t block,
2066 ret = 1; 2066 ret = 1;
2067 } 2067 }
2068errout: 2068errout:
2069 if (!ret)
2070 sbi->extent_cache_misses++;
2071 else
2072 sbi->extent_cache_hits++;
2073 trace_ext4_ext_in_cache(inode, block, ret); 2069 trace_ext4_ext_in_cache(inode, block, ret);
2074 spin_unlock(&EXT4_I(inode)->i_block_reservation_lock); 2070 spin_unlock(&EXT4_I(inode)->i_block_reservation_lock);
2075 return ret; 2071 return ret;
@@ -2882,7 +2878,7 @@ static int ext4_split_extent_at(handle_t *handle,
2882 if (err) 2878 if (err)
2883 goto fix_extent_len; 2879 goto fix_extent_len;
2884 /* update the extent length and mark as initialized */ 2880 /* update the extent length and mark as initialized */
2885 ex->ee_len = cpu_to_le32(ee_len); 2881 ex->ee_len = cpu_to_le16(ee_len);
2886 ext4_ext_try_to_merge(inode, path, ex); 2882 ext4_ext_try_to_merge(inode, path, ex);
2887 err = ext4_ext_dirty(handle, inode, path + depth); 2883 err = ext4_ext_dirty(handle, inode, path + depth);
2888 goto out; 2884 goto out;
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index ceebaf853beb..6da193564e43 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1305,20 +1305,20 @@ static int set_qf_name(struct super_block *sb, int qtype, substring_t *args)
1305 ext4_msg(sb, KERN_ERR, 1305 ext4_msg(sb, KERN_ERR,
1306 "Cannot change journaled " 1306 "Cannot change journaled "
1307 "quota options when quota turned on"); 1307 "quota options when quota turned on");
1308 return 0; 1308 return -1;
1309 } 1309 }
1310 qname = match_strdup(args); 1310 qname = match_strdup(args);
1311 if (!qname) { 1311 if (!qname) {
1312 ext4_msg(sb, KERN_ERR, 1312 ext4_msg(sb, KERN_ERR,
1313 "Not enough memory for storing quotafile name"); 1313 "Not enough memory for storing quotafile name");
1314 return 0; 1314 return -1;
1315 } 1315 }
1316 if (sbi->s_qf_names[qtype] && 1316 if (sbi->s_qf_names[qtype] &&
1317 strcmp(sbi->s_qf_names[qtype], qname)) { 1317 strcmp(sbi->s_qf_names[qtype], qname)) {
1318 ext4_msg(sb, KERN_ERR, 1318 ext4_msg(sb, KERN_ERR,
1319 "%s quota file already specified", QTYPE2NAME(qtype)); 1319 "%s quota file already specified", QTYPE2NAME(qtype));
1320 kfree(qname); 1320 kfree(qname);
1321 return 0; 1321 return -1;
1322 } 1322 }
1323 sbi->s_qf_names[qtype] = qname; 1323 sbi->s_qf_names[qtype] = qname;
1324 if (strchr(sbi->s_qf_names[qtype], '/')) { 1324 if (strchr(sbi->s_qf_names[qtype], '/')) {
@@ -1326,7 +1326,7 @@ static int set_qf_name(struct super_block *sb, int qtype, substring_t *args)
1326 "quotafile must be on filesystem root"); 1326 "quotafile must be on filesystem root");
1327 kfree(sbi->s_qf_names[qtype]); 1327 kfree(sbi->s_qf_names[qtype]);
1328 sbi->s_qf_names[qtype] = NULL; 1328 sbi->s_qf_names[qtype] = NULL;
1329 return 0; 1329 return -1;
1330 } 1330 }
1331 set_opt(sb, QUOTA); 1331 set_opt(sb, QUOTA);
1332 return 1; 1332 return 1;
@@ -1341,7 +1341,7 @@ static int clear_qf_name(struct super_block *sb, int qtype)
1341 sbi->s_qf_names[qtype]) { 1341 sbi->s_qf_names[qtype]) {
1342 ext4_msg(sb, KERN_ERR, "Cannot change journaled quota options" 1342 ext4_msg(sb, KERN_ERR, "Cannot change journaled quota options"
1343 " when quota turned on"); 1343 " when quota turned on");
1344 return 0; 1344 return -1;
1345 } 1345 }
1346 /* 1346 /*
1347 * The space will be released later when all options are confirmed 1347 * The space will be released later when all options are confirmed
@@ -1450,6 +1450,16 @@ static int handle_mount_opt(struct super_block *sb, char *opt, int token,
1450 const struct mount_opts *m; 1450 const struct mount_opts *m;
1451 int arg = 0; 1451 int arg = 0;
1452 1452
1453#ifdef CONFIG_QUOTA
1454 if (token == Opt_usrjquota)
1455 return set_qf_name(sb, USRQUOTA, &args[0]);
1456 else if (token == Opt_grpjquota)
1457 return set_qf_name(sb, GRPQUOTA, &args[0]);
1458 else if (token == Opt_offusrjquota)
1459 return clear_qf_name(sb, USRQUOTA);
1460 else if (token == Opt_offgrpjquota)
1461 return clear_qf_name(sb, GRPQUOTA);
1462#endif
1453 if (args->from && match_int(args, &arg)) 1463 if (args->from && match_int(args, &arg))
1454 return -1; 1464 return -1;
1455 switch (token) { 1465 switch (token) {
@@ -1549,18 +1559,6 @@ static int handle_mount_opt(struct super_block *sb, char *opt, int token,
1549 sbi->s_mount_opt |= m->mount_opt; 1559 sbi->s_mount_opt |= m->mount_opt;
1550 } 1560 }
1551#ifdef CONFIG_QUOTA 1561#ifdef CONFIG_QUOTA
1552 } else if (token == Opt_usrjquota) {
1553 if (!set_qf_name(sb, USRQUOTA, &args[0]))
1554 return -1;
1555 } else if (token == Opt_grpjquota) {
1556 if (!set_qf_name(sb, GRPQUOTA, &args[0]))
1557 return -1;
1558 } else if (token == Opt_offusrjquota) {
1559 if (!clear_qf_name(sb, USRQUOTA))
1560 return -1;
1561 } else if (token == Opt_offgrpjquota) {
1562 if (!clear_qf_name(sb, GRPQUOTA))
1563 return -1;
1564 } else if (m->flags & MOPT_QFMT) { 1562 } else if (m->flags & MOPT_QFMT) {
1565 if (sb_any_quota_loaded(sb) && 1563 if (sb_any_quota_loaded(sb) &&
1566 sbi->s_jquota_fmt != m->mount_opt) { 1564 sbi->s_jquota_fmt != m->mount_opt) {
@@ -2366,18 +2364,6 @@ static ssize_t lifetime_write_kbytes_show(struct ext4_attr *a,
2366 EXT4_SB(sb)->s_sectors_written_start) >> 1))); 2364 EXT4_SB(sb)->s_sectors_written_start) >> 1)));
2367} 2365}
2368 2366
2369static ssize_t extent_cache_hits_show(struct ext4_attr *a,
2370 struct ext4_sb_info *sbi, char *buf)
2371{
2372 return snprintf(buf, PAGE_SIZE, "%lu\n", sbi->extent_cache_hits);
2373}
2374
2375static ssize_t extent_cache_misses_show(struct ext4_attr *a,
2376 struct ext4_sb_info *sbi, char *buf)
2377{
2378 return snprintf(buf, PAGE_SIZE, "%lu\n", sbi->extent_cache_misses);
2379}
2380
2381static ssize_t inode_readahead_blks_store(struct ext4_attr *a, 2367static ssize_t inode_readahead_blks_store(struct ext4_attr *a,
2382 struct ext4_sb_info *sbi, 2368 struct ext4_sb_info *sbi,
2383 const char *buf, size_t count) 2369 const char *buf, size_t count)
@@ -2435,8 +2421,6 @@ static struct ext4_attr ext4_attr_##name = __ATTR(name, mode, show, store)
2435EXT4_RO_ATTR(delayed_allocation_blocks); 2421EXT4_RO_ATTR(delayed_allocation_blocks);
2436EXT4_RO_ATTR(session_write_kbytes); 2422EXT4_RO_ATTR(session_write_kbytes);
2437EXT4_RO_ATTR(lifetime_write_kbytes); 2423EXT4_RO_ATTR(lifetime_write_kbytes);
2438EXT4_RO_ATTR(extent_cache_hits);
2439EXT4_RO_ATTR(extent_cache_misses);
2440EXT4_ATTR_OFFSET(inode_readahead_blks, 0644, sbi_ui_show, 2424EXT4_ATTR_OFFSET(inode_readahead_blks, 0644, sbi_ui_show,
2441 inode_readahead_blks_store, s_inode_readahead_blks); 2425 inode_readahead_blks_store, s_inode_readahead_blks);
2442EXT4_RW_ATTR_SBI_UI(inode_goal, s_inode_goal); 2426EXT4_RW_ATTR_SBI_UI(inode_goal, s_inode_goal);
@@ -2452,8 +2436,6 @@ static struct attribute *ext4_attrs[] = {
2452 ATTR_LIST(delayed_allocation_blocks), 2436 ATTR_LIST(delayed_allocation_blocks),
2453 ATTR_LIST(session_write_kbytes), 2437 ATTR_LIST(session_write_kbytes),
2454 ATTR_LIST(lifetime_write_kbytes), 2438 ATTR_LIST(lifetime_write_kbytes),
2455 ATTR_LIST(extent_cache_hits),
2456 ATTR_LIST(extent_cache_misses),
2457 ATTR_LIST(inode_readahead_blks), 2439 ATTR_LIST(inode_readahead_blks),
2458 ATTR_LIST(inode_goal), 2440 ATTR_LIST(inode_goal),
2459 ATTR_LIST(mb_stats), 2441 ATTR_LIST(mb_stats),
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index 206632887bb4..df5ac048dc74 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -387,9 +387,6 @@ static int fuse_create_open(struct inode *dir, struct dentry *entry,
387 if (fc->no_create) 387 if (fc->no_create)
388 return -ENOSYS; 388 return -ENOSYS;
389 389
390 if (flags & O_DIRECT)
391 return -EINVAL;
392
393 forget = fuse_alloc_forget(); 390 forget = fuse_alloc_forget();
394 if (!forget) 391 if (!forget)
395 return -ENOMEM; 392 return -ENOMEM;
@@ -644,13 +641,12 @@ static int fuse_unlink(struct inode *dir, struct dentry *entry)
644 fuse_put_request(fc, req); 641 fuse_put_request(fc, req);
645 if (!err) { 642 if (!err) {
646 struct inode *inode = entry->d_inode; 643 struct inode *inode = entry->d_inode;
644 struct fuse_inode *fi = get_fuse_inode(inode);
647 645
648 /* 646 spin_lock(&fc->lock);
649 * Set nlink to zero so the inode can be cleared, if the inode 647 fi->attr_version = ++fc->attr_version;
650 * does have more links this will be discovered at the next 648 drop_nlink(inode);
651 * lookup/getattr. 649 spin_unlock(&fc->lock);
652 */
653 clear_nlink(inode);
654 fuse_invalidate_attr(inode); 650 fuse_invalidate_attr(inode);
655 fuse_invalidate_attr(dir); 651 fuse_invalidate_attr(dir);
656 fuse_invalidate_entry_cache(entry); 652 fuse_invalidate_entry_cache(entry);
@@ -762,8 +758,17 @@ static int fuse_link(struct dentry *entry, struct inode *newdir,
762 will reflect changes in the backing inode (link count, 758 will reflect changes in the backing inode (link count,
763 etc.) 759 etc.)
764 */ 760 */
765 if (!err || err == -EINTR) 761 if (!err) {
762 struct fuse_inode *fi = get_fuse_inode(inode);
763
764 spin_lock(&fc->lock);
765 fi->attr_version = ++fc->attr_version;
766 inc_nlink(inode);
767 spin_unlock(&fc->lock);
768 fuse_invalidate_attr(inode);
769 } else if (err == -EINTR) {
766 fuse_invalidate_attr(inode); 770 fuse_invalidate_attr(inode);
771 }
767 return err; 772 return err;
768} 773}
769 774
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index a841868bf9ce..504e61b7fd75 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -194,10 +194,6 @@ int fuse_open_common(struct inode *inode, struct file *file, bool isdir)
194 struct fuse_conn *fc = get_fuse_conn(inode); 194 struct fuse_conn *fc = get_fuse_conn(inode);
195 int err; 195 int err;
196 196
197 /* VFS checks this, but only _after_ ->open() */
198 if (file->f_flags & O_DIRECT)
199 return -EINVAL;
200
201 err = generic_file_open(inode, file); 197 err = generic_file_open(inode, file);
202 if (err) 198 if (err)
203 return err; 199 return err;
@@ -932,17 +928,23 @@ static ssize_t fuse_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
932 struct file *file = iocb->ki_filp; 928 struct file *file = iocb->ki_filp;
933 struct address_space *mapping = file->f_mapping; 929 struct address_space *mapping = file->f_mapping;
934 size_t count = 0; 930 size_t count = 0;
931 size_t ocount = 0;
935 ssize_t written = 0; 932 ssize_t written = 0;
933 ssize_t written_buffered = 0;
936 struct inode *inode = mapping->host; 934 struct inode *inode = mapping->host;
937 ssize_t err; 935 ssize_t err;
938 struct iov_iter i; 936 struct iov_iter i;
937 loff_t endbyte = 0;
939 938
940 WARN_ON(iocb->ki_pos != pos); 939 WARN_ON(iocb->ki_pos != pos);
941 940
942 err = generic_segment_checks(iov, &nr_segs, &count, VERIFY_READ); 941 ocount = 0;
942 err = generic_segment_checks(iov, &nr_segs, &ocount, VERIFY_READ);
943 if (err) 943 if (err)
944 return err; 944 return err;
945 945
946 count = ocount;
947
946 mutex_lock(&inode->i_mutex); 948 mutex_lock(&inode->i_mutex);
947 vfs_check_frozen(inode->i_sb, SB_FREEZE_WRITE); 949 vfs_check_frozen(inode->i_sb, SB_FREEZE_WRITE);
948 950
@@ -962,11 +964,41 @@ static ssize_t fuse_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
962 964
963 file_update_time(file); 965 file_update_time(file);
964 966
965 iov_iter_init(&i, iov, nr_segs, count, 0); 967 if (file->f_flags & O_DIRECT) {
966 written = fuse_perform_write(file, mapping, &i, pos); 968 written = generic_file_direct_write(iocb, iov, &nr_segs,
967 if (written >= 0) 969 pos, &iocb->ki_pos,
968 iocb->ki_pos = pos + written; 970 count, ocount);
971 if (written < 0 || written == count)
972 goto out;
973
974 pos += written;
975 count -= written;
969 976
977 iov_iter_init(&i, iov, nr_segs, count, written);
978 written_buffered = fuse_perform_write(file, mapping, &i, pos);
979 if (written_buffered < 0) {
980 err = written_buffered;
981 goto out;
982 }
983 endbyte = pos + written_buffered - 1;
984
985 err = filemap_write_and_wait_range(file->f_mapping, pos,
986 endbyte);
987 if (err)
988 goto out;
989
990 invalidate_mapping_pages(file->f_mapping,
991 pos >> PAGE_CACHE_SHIFT,
992 endbyte >> PAGE_CACHE_SHIFT);
993
994 written += written_buffered;
995 iocb->ki_pos = pos + written_buffered;
996 } else {
997 iov_iter_init(&i, iov, nr_segs, count, 0);
998 written = fuse_perform_write(file, mapping, &i, pos);
999 if (written >= 0)
1000 iocb->ki_pos = pos + written;
1001 }
970out: 1002out:
971 current->backing_dev_info = NULL; 1003 current->backing_dev_info = NULL;
972 mutex_unlock(&inode->i_mutex); 1004 mutex_unlock(&inode->i_mutex);
@@ -1101,30 +1133,41 @@ static ssize_t fuse_direct_read(struct file *file, char __user *buf,
1101 return res; 1133 return res;
1102} 1134}
1103 1135
1104static ssize_t fuse_direct_write(struct file *file, const char __user *buf, 1136static ssize_t __fuse_direct_write(struct file *file, const char __user *buf,
1105 size_t count, loff_t *ppos) 1137 size_t count, loff_t *ppos)
1106{ 1138{
1107 struct inode *inode = file->f_path.dentry->d_inode; 1139 struct inode *inode = file->f_path.dentry->d_inode;
1108 ssize_t res; 1140 ssize_t res;
1109 1141
1110 if (is_bad_inode(inode))
1111 return -EIO;
1112
1113 /* Don't allow parallel writes to the same file */
1114 mutex_lock(&inode->i_mutex);
1115 res = generic_write_checks(file, ppos, &count, 0); 1142 res = generic_write_checks(file, ppos, &count, 0);
1116 if (!res) { 1143 if (!res) {
1117 res = fuse_direct_io(file, buf, count, ppos, 1); 1144 res = fuse_direct_io(file, buf, count, ppos, 1);
1118 if (res > 0) 1145 if (res > 0)
1119 fuse_write_update_size(inode, *ppos); 1146 fuse_write_update_size(inode, *ppos);
1120 } 1147 }
1121 mutex_unlock(&inode->i_mutex);
1122 1148
1123 fuse_invalidate_attr(inode); 1149 fuse_invalidate_attr(inode);
1124 1150
1125 return res; 1151 return res;
1126} 1152}
1127 1153
1154static ssize_t fuse_direct_write(struct file *file, const char __user *buf,
1155 size_t count, loff_t *ppos)
1156{
1157 struct inode *inode = file->f_path.dentry->d_inode;
1158 ssize_t res;
1159
1160 if (is_bad_inode(inode))
1161 return -EIO;
1162
1163 /* Don't allow parallel writes to the same file */
1164 mutex_lock(&inode->i_mutex);
1165 res = __fuse_direct_write(file, buf, count, ppos);
1166 mutex_unlock(&inode->i_mutex);
1167
1168 return res;
1169}
1170
1128static void fuse_writepage_free(struct fuse_conn *fc, struct fuse_req *req) 1171static void fuse_writepage_free(struct fuse_conn *fc, struct fuse_req *req)
1129{ 1172{
1130 __free_page(req->pages[0]); 1173 __free_page(req->pages[0]);
@@ -2077,6 +2120,57 @@ int fuse_notify_poll_wakeup(struct fuse_conn *fc,
2077 return 0; 2120 return 0;
2078} 2121}
2079 2122
2123static ssize_t fuse_loop_dio(struct file *filp, const struct iovec *iov,
2124 unsigned long nr_segs, loff_t *ppos, int rw)
2125{
2126 const struct iovec *vector = iov;
2127 ssize_t ret = 0;
2128
2129 while (nr_segs > 0) {
2130 void __user *base;
2131 size_t len;
2132 ssize_t nr;
2133
2134 base = vector->iov_base;
2135 len = vector->iov_len;
2136 vector++;
2137 nr_segs--;
2138
2139 if (rw == WRITE)
2140 nr = __fuse_direct_write(filp, base, len, ppos);
2141 else
2142 nr = fuse_direct_read(filp, base, len, ppos);
2143
2144 if (nr < 0) {
2145 if (!ret)
2146 ret = nr;
2147 break;
2148 }
2149 ret += nr;
2150 if (nr != len)
2151 break;
2152 }
2153
2154 return ret;
2155}
2156
2157
2158static ssize_t
2159fuse_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov,
2160 loff_t offset, unsigned long nr_segs)
2161{
2162 ssize_t ret = 0;
2163 struct file *file = NULL;
2164 loff_t pos = 0;
2165
2166 file = iocb->ki_filp;
2167 pos = offset;
2168
2169 ret = fuse_loop_dio(file, iov, nr_segs, &pos, rw);
2170
2171 return ret;
2172}
2173
2080static const struct file_operations fuse_file_operations = { 2174static const struct file_operations fuse_file_operations = {
2081 .llseek = fuse_file_llseek, 2175 .llseek = fuse_file_llseek,
2082 .read = do_sync_read, 2176 .read = do_sync_read,
@@ -2120,6 +2214,7 @@ static const struct address_space_operations fuse_file_aops = {
2120 .readpages = fuse_readpages, 2214 .readpages = fuse_readpages,
2121 .set_page_dirty = __set_page_dirty_nobuffers, 2215 .set_page_dirty = __set_page_dirty_nobuffers,
2122 .bmap = fuse_bmap, 2216 .bmap = fuse_bmap,
2217 .direct_IO = fuse_direct_IO,
2123}; 2218};
2124 2219
2125void fuse_init_file_inode(struct inode *inode) 2220void fuse_init_file_inode(struct inode *inode)
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 4aec5995867e..26783eb2b1fc 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -947,6 +947,7 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent)
947 sb->s_magic = FUSE_SUPER_MAGIC; 947 sb->s_magic = FUSE_SUPER_MAGIC;
948 sb->s_op = &fuse_super_operations; 948 sb->s_op = &fuse_super_operations;
949 sb->s_maxbytes = MAX_LFS_FILESIZE; 949 sb->s_maxbytes = MAX_LFS_FILESIZE;
950 sb->s_time_gran = 1;
950 sb->s_export_op = &fuse_export_operations; 951 sb->s_export_op = &fuse_export_operations;
951 952
952 file = fget(d.fd); 953 file = fget(d.fd);
diff --git a/fs/lockd/clnt4xdr.c b/fs/lockd/clnt4xdr.c
index 3ddcbb1c0a43..13ad1539fbf2 100644
--- a/fs/lockd/clnt4xdr.c
+++ b/fs/lockd/clnt4xdr.c
@@ -241,7 +241,7 @@ static int decode_nlm4_stat(struct xdr_stream *xdr, __be32 *stat)
241 p = xdr_inline_decode(xdr, 4); 241 p = xdr_inline_decode(xdr, 4);
242 if (unlikely(p == NULL)) 242 if (unlikely(p == NULL))
243 goto out_overflow; 243 goto out_overflow;
244 if (unlikely(*p > nlm4_failed)) 244 if (unlikely(ntohl(*p) > ntohl(nlm4_failed)))
245 goto out_bad_xdr; 245 goto out_bad_xdr;
246 *stat = *p; 246 *stat = *p;
247 return 0; 247 return 0;
diff --git a/fs/lockd/clntxdr.c b/fs/lockd/clntxdr.c
index 3d35e3e80c1c..d269ada7670e 100644
--- a/fs/lockd/clntxdr.c
+++ b/fs/lockd/clntxdr.c
@@ -236,7 +236,7 @@ static int decode_nlm_stat(struct xdr_stream *xdr,
236 p = xdr_inline_decode(xdr, 4); 236 p = xdr_inline_decode(xdr, 4);
237 if (unlikely(p == NULL)) 237 if (unlikely(p == NULL))
238 goto out_overflow; 238 goto out_overflow;
239 if (unlikely(*p > nlm_lck_denied_grace_period)) 239 if (unlikely(ntohl(*p) > ntohl(nlm_lck_denied_grace_period)))
240 goto out_enum; 240 goto out_enum;
241 *stat = *p; 241 *stat = *p;
242 return 0; 242 return 0;
diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c
index 08c6e36ab2eb..43f46cd9edea 100644
--- a/fs/nfsd/nfs3xdr.c
+++ b/fs/nfsd/nfs3xdr.c
@@ -803,13 +803,13 @@ encode_entry_baggage(struct nfsd3_readdirres *cd, __be32 *p, const char *name,
803 return p; 803 return p;
804} 804}
805 805
806static int 806static __be32
807compose_entry_fh(struct nfsd3_readdirres *cd, struct svc_fh *fhp, 807compose_entry_fh(struct nfsd3_readdirres *cd, struct svc_fh *fhp,
808 const char *name, int namlen) 808 const char *name, int namlen)
809{ 809{
810 struct svc_export *exp; 810 struct svc_export *exp;
811 struct dentry *dparent, *dchild; 811 struct dentry *dparent, *dchild;
812 int rv = 0; 812 __be32 rv = nfserr_noent;
813 813
814 dparent = cd->fh.fh_dentry; 814 dparent = cd->fh.fh_dentry;
815 exp = cd->fh.fh_export; 815 exp = cd->fh.fh_export;
@@ -817,26 +817,20 @@ compose_entry_fh(struct nfsd3_readdirres *cd, struct svc_fh *fhp,
817 if (isdotent(name, namlen)) { 817 if (isdotent(name, namlen)) {
818 if (namlen == 2) { 818 if (namlen == 2) {
819 dchild = dget_parent(dparent); 819 dchild = dget_parent(dparent);
820 if (dchild == dparent) { 820 /* filesystem root - cannot return filehandle for ".." */
821 /* filesystem root - cannot return filehandle for ".." */ 821 if (dchild == dparent)
822 dput(dchild); 822 goto out;
823 return -ENOENT;
824 }
825 } else 823 } else
826 dchild = dget(dparent); 824 dchild = dget(dparent);
827 } else 825 } else
828 dchild = lookup_one_len(name, dparent, namlen); 826 dchild = lookup_one_len(name, dparent, namlen);
829 if (IS_ERR(dchild)) 827 if (IS_ERR(dchild))
830 return -ENOENT; 828 return rv;
831 rv = -ENOENT;
832 if (d_mountpoint(dchild)) 829 if (d_mountpoint(dchild))
833 goto out; 830 goto out;
834 rv = fh_compose(fhp, exp, dchild, &cd->fh);
835 if (rv)
836 goto out;
837 if (!dchild->d_inode) 831 if (!dchild->d_inode)
838 goto out; 832 goto out;
839 rv = 0; 833 rv = fh_compose(fhp, exp, dchild, &cd->fh);
840out: 834out:
841 dput(dchild); 835 dput(dchild);
842 return rv; 836 return rv;
@@ -845,7 +839,7 @@ out:
845static __be32 *encode_entryplus_baggage(struct nfsd3_readdirres *cd, __be32 *p, const char *name, int namlen) 839static __be32 *encode_entryplus_baggage(struct nfsd3_readdirres *cd, __be32 *p, const char *name, int namlen)
846{ 840{
847 struct svc_fh fh; 841 struct svc_fh fh;
848 int err; 842 __be32 err;
849 843
850 fh_init(&fh, NFS3_FHSIZE); 844 fh_init(&fh, NFS3_FHSIZE);
851 err = compose_entry_fh(cd, &fh, name, namlen); 845 err = compose_entry_fh(cd, &fh, name, namlen);
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index 2ed14dfd00a2..987e719fbae8 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -235,17 +235,17 @@ do_open_lookup(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_o
235 */ 235 */
236 if (open->op_createmode == NFS4_CREATE_EXCLUSIVE && status == 0) 236 if (open->op_createmode == NFS4_CREATE_EXCLUSIVE && status == 0)
237 open->op_bmval[1] = (FATTR4_WORD1_TIME_ACCESS | 237 open->op_bmval[1] = (FATTR4_WORD1_TIME_ACCESS |
238 FATTR4_WORD1_TIME_MODIFY); 238 FATTR4_WORD1_TIME_MODIFY);
239 } else { 239 } else {
240 status = nfsd_lookup(rqstp, current_fh, 240 status = nfsd_lookup(rqstp, current_fh,
241 open->op_fname.data, open->op_fname.len, resfh); 241 open->op_fname.data, open->op_fname.len, resfh);
242 fh_unlock(current_fh); 242 fh_unlock(current_fh);
243 if (status)
244 goto out;
245 status = nfsd_check_obj_isreg(resfh);
246 } 243 }
247 if (status) 244 if (status)
248 goto out; 245 goto out;
246 status = nfsd_check_obj_isreg(resfh);
247 if (status)
248 goto out;
249 249
250 if (is_create_with_attrs(open) && open->op_acl != NULL) 250 if (is_create_with_attrs(open) && open->op_acl != NULL)
251 do_set_nfs4_acl(rqstp, resfh, open->op_acl, open->op_bmval); 251 do_set_nfs4_acl(rqstp, resfh, open->op_acl, open->op_bmval);
@@ -841,6 +841,7 @@ nfsd4_setattr(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
841 struct nfsd4_setattr *setattr) 841 struct nfsd4_setattr *setattr)
842{ 842{
843 __be32 status = nfs_ok; 843 __be32 status = nfs_ok;
844 int err;
844 845
845 if (setattr->sa_iattr.ia_valid & ATTR_SIZE) { 846 if (setattr->sa_iattr.ia_valid & ATTR_SIZE) {
846 nfs4_lock_state(); 847 nfs4_lock_state();
@@ -852,9 +853,9 @@ nfsd4_setattr(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
852 return status; 853 return status;
853 } 854 }
854 } 855 }
855 status = fh_want_write(&cstate->current_fh); 856 err = fh_want_write(&cstate->current_fh);
856 if (status) 857 if (err)
857 return status; 858 return nfserrno(err);
858 status = nfs_ok; 859 status = nfs_ok;
859 860
860 status = check_attr_support(rqstp, cstate, setattr->sa_bmval, 861 status = check_attr_support(rqstp, cstate, setattr->sa_bmval,
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 1841f8bf845e..7f71c69cdcdf 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -4211,16 +4211,14 @@ out:
4211 * vfs_test_lock. (Arguably perhaps test_lock should be done with an 4211 * vfs_test_lock. (Arguably perhaps test_lock should be done with an
4212 * inode operation.) 4212 * inode operation.)
4213 */ 4213 */
4214static int nfsd_test_lock(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file_lock *lock) 4214static __be32 nfsd_test_lock(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file_lock *lock)
4215{ 4215{
4216 struct file *file; 4216 struct file *file;
4217 int err; 4217 __be32 err = nfsd_open(rqstp, fhp, S_IFREG, NFSD_MAY_READ, &file);
4218 4218 if (!err) {
4219 err = nfsd_open(rqstp, fhp, S_IFREG, NFSD_MAY_READ, &file); 4219 err = nfserrno(vfs_test_lock(file, lock));
4220 if (err) 4220 nfsd_close(file);
4221 return err; 4221 }
4222 err = vfs_test_lock(file, lock);
4223 nfsd_close(file);
4224 return err; 4222 return err;
4225} 4223}
4226 4224
@@ -4234,7 +4232,6 @@ nfsd4_lockt(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
4234 struct inode *inode; 4232 struct inode *inode;
4235 struct file_lock file_lock; 4233 struct file_lock file_lock;
4236 struct nfs4_lockowner *lo; 4234 struct nfs4_lockowner *lo;
4237 int error;
4238 __be32 status; 4235 __be32 status;
4239 4236
4240 if (locks_in_grace()) 4237 if (locks_in_grace())
@@ -4280,12 +4277,10 @@ nfsd4_lockt(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
4280 4277
4281 nfs4_transform_lock_offset(&file_lock); 4278 nfs4_transform_lock_offset(&file_lock);
4282 4279
4283 status = nfs_ok; 4280 status = nfsd_test_lock(rqstp, &cstate->current_fh, &file_lock);
4284 error = nfsd_test_lock(rqstp, &cstate->current_fh, &file_lock); 4281 if (status)
4285 if (error) {
4286 status = nfserrno(error);
4287 goto out; 4282 goto out;
4288 } 4283
4289 if (file_lock.fl_type != F_UNLCK) { 4284 if (file_lock.fl_type != F_UNLCK) {
4290 status = nfserr_denied; 4285 status = nfserr_denied;
4291 nfs4_set_lock_denied(&file_lock, &lockt->lt_denied); 4286 nfs4_set_lock_denied(&file_lock, &lockt->lt_denied);
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index bcd8904ab1e3..74c00bc92b9a 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -1392,7 +1392,7 @@ nfsd4_decode_test_stateid(struct nfsd4_compoundargs *argp, struct nfsd4_test_sta
1392 for (i = 0; i < test_stateid->ts_num_ids; i++) { 1392 for (i = 0; i < test_stateid->ts_num_ids; i++) {
1393 stateid = kmalloc(sizeof(struct nfsd4_test_stateid_id), GFP_KERNEL); 1393 stateid = kmalloc(sizeof(struct nfsd4_test_stateid_id), GFP_KERNEL);
1394 if (!stateid) { 1394 if (!stateid) {
1395 status = PTR_ERR(stateid); 1395 status = nfserrno(-ENOMEM);
1396 goto out; 1396 goto out;
1397 } 1397 }
1398 1398
@@ -3410,7 +3410,7 @@ nfsd4_encode_test_stateid(struct nfsd4_compoundres *resp, int nfserr,
3410 *p++ = htonl(test_stateid->ts_num_ids); 3410 *p++ = htonl(test_stateid->ts_num_ids);
3411 3411
3412 list_for_each_entry_safe(stateid, next, &test_stateid->ts_stateid_list, ts_id_list) { 3412 list_for_each_entry_safe(stateid, next, &test_stateid->ts_stateid_list, ts_id_list) {
3413 *p++ = htonl(stateid->ts_id_status); 3413 *p++ = stateid->ts_id_status;
3414 } 3414 }
3415 3415
3416 ADJUST_ARGS(); 3416 ADJUST_ARGS();
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 296d671654d6..568666156ea4 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -1458,7 +1458,7 @@ do_nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp,
1458 switch (createmode) { 1458 switch (createmode) {
1459 case NFS3_CREATE_UNCHECKED: 1459 case NFS3_CREATE_UNCHECKED:
1460 if (! S_ISREG(dchild->d_inode->i_mode)) 1460 if (! S_ISREG(dchild->d_inode->i_mode))
1461 err = nfserr_exist; 1461 goto out;
1462 else if (truncp) { 1462 else if (truncp) {
1463 /* in nfsv4, we need to treat this case a little 1463 /* in nfsv4, we need to treat this case a little
1464 * differently. we don't want to truncate the 1464 * differently. we don't want to truncate the
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c
index 3165aebb43c8..31b9463fba1f 100644
--- a/fs/ocfs2/alloc.c
+++ b/fs/ocfs2/alloc.c
@@ -1134,7 +1134,7 @@ static int ocfs2_adjust_rightmost_branch(handle_t *handle,
1134 } 1134 }
1135 1135
1136 el = path_leaf_el(path); 1136 el = path_leaf_el(path);
1137 rec = &el->l_recs[le32_to_cpu(el->l_next_free_rec) - 1]; 1137 rec = &el->l_recs[le16_to_cpu(el->l_next_free_rec) - 1];
1138 1138
1139 ocfs2_adjust_rightmost_records(handle, et, path, rec); 1139 ocfs2_adjust_rightmost_records(handle, et, path, rec);
1140 1140
diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c
index cf7823382664..9f32d7cbb7a3 100644
--- a/fs/ocfs2/refcounttree.c
+++ b/fs/ocfs2/refcounttree.c
@@ -1036,14 +1036,14 @@ static int ocfs2_get_refcount_cpos_end(struct ocfs2_caching_info *ci,
1036 1036
1037 tmp_el = left_path->p_node[subtree_root].el; 1037 tmp_el = left_path->p_node[subtree_root].el;
1038 blkno = left_path->p_node[subtree_root+1].bh->b_blocknr; 1038 blkno = left_path->p_node[subtree_root+1].bh->b_blocknr;
1039 for (i = 0; i < le32_to_cpu(tmp_el->l_next_free_rec); i++) { 1039 for (i = 0; i < le16_to_cpu(tmp_el->l_next_free_rec); i++) {
1040 if (le64_to_cpu(tmp_el->l_recs[i].e_blkno) == blkno) { 1040 if (le64_to_cpu(tmp_el->l_recs[i].e_blkno) == blkno) {
1041 *cpos_end = le32_to_cpu(tmp_el->l_recs[i+1].e_cpos); 1041 *cpos_end = le32_to_cpu(tmp_el->l_recs[i+1].e_cpos);
1042 break; 1042 break;
1043 } 1043 }
1044 } 1044 }
1045 1045
1046 BUG_ON(i == le32_to_cpu(tmp_el->l_next_free_rec)); 1046 BUG_ON(i == le16_to_cpu(tmp_el->l_next_free_rec));
1047 1047
1048out: 1048out:
1049 ocfs2_free_path(left_path); 1049 ocfs2_free_path(left_path);
@@ -1468,7 +1468,7 @@ static int ocfs2_divide_leaf_refcount_block(struct buffer_head *ref_leaf_bh,
1468 1468
1469 trace_ocfs2_divide_leaf_refcount_block( 1469 trace_ocfs2_divide_leaf_refcount_block(
1470 (unsigned long long)ref_leaf_bh->b_blocknr, 1470 (unsigned long long)ref_leaf_bh->b_blocknr,
1471 le32_to_cpu(rl->rl_count), le32_to_cpu(rl->rl_used)); 1471 le16_to_cpu(rl->rl_count), le16_to_cpu(rl->rl_used));
1472 1472
1473 /* 1473 /*
1474 * XXX: Improvement later. 1474 * XXX: Improvement later.
@@ -2411,7 +2411,7 @@ static int ocfs2_calc_refcount_meta_credits(struct super_block *sb,
2411 rb = (struct ocfs2_refcount_block *) 2411 rb = (struct ocfs2_refcount_block *)
2412 prev_bh->b_data; 2412 prev_bh->b_data;
2413 2413
2414 if (le64_to_cpu(rb->rf_records.rl_used) + 2414 if (le16_to_cpu(rb->rf_records.rl_used) +
2415 recs_add > 2415 recs_add >
2416 le16_to_cpu(rb->rf_records.rl_count)) 2416 le16_to_cpu(rb->rf_records.rl_count))
2417 ref_blocks++; 2417 ref_blocks++;
@@ -2476,7 +2476,7 @@ static int ocfs2_calc_refcount_meta_credits(struct super_block *sb,
2476 if (prev_bh) { 2476 if (prev_bh) {
2477 rb = (struct ocfs2_refcount_block *)prev_bh->b_data; 2477 rb = (struct ocfs2_refcount_block *)prev_bh->b_data;
2478 2478
2479 if (le64_to_cpu(rb->rf_records.rl_used) + recs_add > 2479 if (le16_to_cpu(rb->rf_records.rl_used) + recs_add >
2480 le16_to_cpu(rb->rf_records.rl_count)) 2480 le16_to_cpu(rb->rf_records.rl_count))
2481 ref_blocks++; 2481 ref_blocks++;
2482 2482
@@ -3629,7 +3629,7 @@ int ocfs2_refcounted_xattr_delete_need(struct inode *inode,
3629 * one will split a refcount rec, so totally we need 3629 * one will split a refcount rec, so totally we need
3630 * clusters * 2 new refcount rec. 3630 * clusters * 2 new refcount rec.
3631 */ 3631 */
3632 if (le64_to_cpu(rb->rf_records.rl_used) + clusters * 2 > 3632 if (le16_to_cpu(rb->rf_records.rl_used) + clusters * 2 >
3633 le16_to_cpu(rb->rf_records.rl_count)) 3633 le16_to_cpu(rb->rf_records.rl_count))
3634 ref_blocks++; 3634 ref_blocks++;
3635 3635
diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c
index ba5d97e4a73e..f169da4624fd 100644
--- a/fs/ocfs2/suballoc.c
+++ b/fs/ocfs2/suballoc.c
@@ -600,7 +600,7 @@ static void ocfs2_bg_alloc_cleanup(handle_t *handle,
600 ret = ocfs2_free_clusters(handle, cluster_ac->ac_inode, 600 ret = ocfs2_free_clusters(handle, cluster_ac->ac_inode,
601 cluster_ac->ac_bh, 601 cluster_ac->ac_bh,
602 le64_to_cpu(rec->e_blkno), 602 le64_to_cpu(rec->e_blkno),
603 le32_to_cpu(rec->e_leaf_clusters)); 603 le16_to_cpu(rec->e_leaf_clusters));
604 if (ret) 604 if (ret)
605 mlog_errno(ret); 605 mlog_errno(ret);
606 /* Try all the clusters to free */ 606 /* Try all the clusters to free */
@@ -1628,7 +1628,7 @@ static int ocfs2_bg_discontig_fix_by_rec(struct ocfs2_suballoc_result *res,
1628{ 1628{
1629 unsigned int bpc = le16_to_cpu(cl->cl_bpc); 1629 unsigned int bpc = le16_to_cpu(cl->cl_bpc);
1630 unsigned int bitoff = le32_to_cpu(rec->e_cpos) * bpc; 1630 unsigned int bitoff = le32_to_cpu(rec->e_cpos) * bpc;
1631 unsigned int bitcount = le32_to_cpu(rec->e_leaf_clusters) * bpc; 1631 unsigned int bitcount = le16_to_cpu(rec->e_leaf_clusters) * bpc;
1632 1632
1633 if (res->sr_bit_offset < bitoff) 1633 if (res->sr_bit_offset < bitoff)
1634 return 0; 1634 return 0;
diff --git a/include/linux/fuse.h b/include/linux/fuse.h
index 8ba2c9460b28..8f2ab8fef929 100644
--- a/include/linux/fuse.h
+++ b/include/linux/fuse.h
@@ -593,7 +593,7 @@ struct fuse_dirent {
593 __u64 off; 593 __u64 off;
594 __u32 namelen; 594 __u32 namelen;
595 __u32 type; 595 __u32 type;
596 char name[0]; 596 char name[];
597}; 597};
598 598
599#define FUSE_NAME_OFFSET offsetof(struct fuse_dirent, name) 599#define FUSE_NAME_OFFSET offsetof(struct fuse_dirent, name)
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
index 2463b6100333..1f90de0cfdbe 100644
--- a/include/linux/i2c/twl.h
+++ b/include/linux/i2c/twl.h
@@ -666,23 +666,11 @@ struct twl4030_codec_data {
666 unsigned int check_defaults:1; 666 unsigned int check_defaults:1;
667 unsigned int reset_registers:1; 667 unsigned int reset_registers:1;
668 unsigned int hs_extmute:1; 668 unsigned int hs_extmute:1;
669 u16 hs_left_step;
670 u16 hs_right_step;
671 u16 hf_left_step;
672 u16 hf_right_step;
673 void (*set_hs_extmute)(int mute); 669 void (*set_hs_extmute)(int mute);
674}; 670};
675 671
676struct twl4030_vibra_data { 672struct twl4030_vibra_data {
677 unsigned int coexist; 673 unsigned int coexist;
678
679 /* twl6040 */
680 unsigned int vibldrv_res; /* left driver resistance */
681 unsigned int vibrdrv_res; /* right driver resistance */
682 unsigned int viblmotor_res; /* left motor resistance */
683 unsigned int vibrmotor_res; /* right motor resistance */
684 int vddvibl_uV; /* VDDVIBL volt, set 0 for fixed reg */
685 int vddvibr_uV; /* VDDVIBR volt, set 0 for fixed reg */
686}; 674};
687 675
688struct twl4030_audio_data { 676struct twl4030_audio_data {
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 665a260c7e09..72cbf08d45fb 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -596,6 +596,7 @@ void kvm_free_irq_source_id(struct kvm *kvm, int irq_source_id);
596 596
597#ifdef CONFIG_IOMMU_API 597#ifdef CONFIG_IOMMU_API
598int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot); 598int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot);
599void kvm_iommu_unmap_pages(struct kvm *kvm, struct kvm_memory_slot *slot);
599int kvm_iommu_map_guest(struct kvm *kvm); 600int kvm_iommu_map_guest(struct kvm *kvm);
600int kvm_iommu_unmap_guest(struct kvm *kvm); 601int kvm_iommu_unmap_guest(struct kvm *kvm);
601int kvm_assign_device(struct kvm *kvm, 602int kvm_assign_device(struct kvm *kvm,
@@ -609,6 +610,11 @@ static inline int kvm_iommu_map_pages(struct kvm *kvm,
609 return 0; 610 return 0;
610} 611}
611 612
613static inline void kvm_iommu_unmap_pages(struct kvm *kvm,
614 struct kvm_memory_slot *slot)
615{
616}
617
612static inline int kvm_iommu_map_guest(struct kvm *kvm) 618static inline int kvm_iommu_map_guest(struct kvm *kvm)
613{ 619{
614 return -ENODEV; 620 return -ENODEV;
diff --git a/include/linux/mfd/db5500-prcmu.h b/include/linux/mfd/db5500-prcmu.h
index 9890687f582d..5a049dfaf153 100644
--- a/include/linux/mfd/db5500-prcmu.h
+++ b/include/linux/mfd/db5500-prcmu.h
@@ -8,41 +8,14 @@
8#ifndef __MFD_DB5500_PRCMU_H 8#ifndef __MFD_DB5500_PRCMU_H
9#define __MFD_DB5500_PRCMU_H 9#define __MFD_DB5500_PRCMU_H
10 10
11#ifdef CONFIG_MFD_DB5500_PRCMU 11static inline int prcmu_resetout(u8 resoutn, u8 state)
12
13void db5500_prcmu_early_init(void);
14int db5500_prcmu_set_epod(u16 epod_id, u8 epod_state);
15int db5500_prcmu_set_display_clocks(void);
16int db5500_prcmu_disable_dsipll(void);
17int db5500_prcmu_enable_dsipll(void);
18int db5500_prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size);
19int db5500_prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size);
20void db5500_prcmu_enable_wakeups(u32 wakeups);
21int db5500_prcmu_request_clock(u8 clock, bool enable);
22void db5500_prcmu_config_abb_event_readout(u32 abb_events);
23void db5500_prcmu_get_abb_event_buffer(void __iomem **buf);
24int prcmu_resetout(u8 resoutn, u8 state);
25int db5500_prcmu_set_power_state(u8 state, bool keep_ulp_clk,
26 bool keep_ap_pll);
27int db5500_prcmu_config_esram0_deep_sleep(u8 state);
28void db5500_prcmu_system_reset(u16 reset_code);
29u16 db5500_prcmu_get_reset_code(void);
30bool db5500_prcmu_is_ac_wake_requested(void);
31int db5500_prcmu_set_arm_opp(u8 opp);
32int db5500_prcmu_get_arm_opp(void);
33
34#else /* !CONFIG_UX500_SOC_DB5500 */
35
36static inline void db5500_prcmu_early_init(void) {}
37
38static inline int db5500_prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size)
39{ 12{
40 return -ENOSYS; 13 return 0;
41} 14}
42 15
43static inline int db5500_prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size) 16static inline int db5500_prcmu_set_epod(u16 epod_id, u8 epod_state)
44{ 17{
45 return -ENOSYS; 18 return 0;
46} 19}
47 20
48static inline int db5500_prcmu_request_clock(u8 clock, bool enable) 21static inline int db5500_prcmu_request_clock(u8 clock, bool enable)
@@ -50,69 +23,82 @@ static inline int db5500_prcmu_request_clock(u8 clock, bool enable)
50 return 0; 23 return 0;
51} 24}
52 25
53static inline int db5500_prcmu_set_display_clocks(void) 26static inline int db5500_prcmu_set_power_state(u8 state, bool keep_ulp_clk,
27 bool keep_ap_pll)
54{ 28{
55 return 0; 29 return 0;
56} 30}
57 31
58static inline int db5500_prcmu_disable_dsipll(void) 32static inline int db5500_prcmu_config_esram0_deep_sleep(u8 state)
59{ 33{
60 return 0; 34 return 0;
61} 35}
62 36
63static inline int db5500_prcmu_enable_dsipll(void) 37static inline u16 db5500_prcmu_get_reset_code(void)
64{ 38{
65 return 0; 39 return 0;
66} 40}
67 41
68static inline int db5500_prcmu_config_esram0_deep_sleep(u8 state) 42static inline bool db5500_prcmu_is_ac_wake_requested(void)
69{ 43{
70 return 0; 44 return 0;
71} 45}
72 46
73static inline void db5500_prcmu_enable_wakeups(u32 wakeups) {} 47static inline int db5500_prcmu_set_arm_opp(u8 opp)
74
75static inline int prcmu_resetout(u8 resoutn, u8 state)
76{ 48{
77 return 0; 49 return 0;
78} 50}
79 51
80static inline int db5500_prcmu_set_epod(u16 epod_id, u8 epod_state) 52static inline int db5500_prcmu_get_arm_opp(void)
81{ 53{
82 return 0; 54 return 0;
83} 55}
84 56
85static inline void db5500_prcmu_get_abb_event_buffer(void __iomem **buf) {}
86static inline void db5500_prcmu_config_abb_event_readout(u32 abb_events) {} 57static inline void db5500_prcmu_config_abb_event_readout(u32 abb_events) {}
87 58
88static inline int db5500_prcmu_set_power_state(u8 state, bool keep_ulp_clk, 59static inline void db5500_prcmu_get_abb_event_buffer(void __iomem **buf) {}
89 bool keep_ap_pll)
90{
91 return 0;
92}
93 60
94static inline void db5500_prcmu_system_reset(u16 reset_code) {} 61static inline void db5500_prcmu_system_reset(u16 reset_code) {}
95 62
96static inline u16 db5500_prcmu_get_reset_code(void) 63static inline void db5500_prcmu_enable_wakeups(u32 wakeups) {}
64
65#ifdef CONFIG_MFD_DB5500_PRCMU
66
67void db5500_prcmu_early_init(void);
68int db5500_prcmu_set_display_clocks(void);
69int db5500_prcmu_disable_dsipll(void);
70int db5500_prcmu_enable_dsipll(void);
71int db5500_prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size);
72int db5500_prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size);
73
74#else /* !CONFIG_UX500_SOC_DB5500 */
75
76static inline void db5500_prcmu_early_init(void) {}
77
78static inline int db5500_prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size)
97{ 79{
98 return 0; 80 return -ENOSYS;
99} 81}
100 82
101static inline bool db5500_prcmu_is_ac_wake_requested(void) 83static inline int db5500_prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size)
102{ 84{
103 return 0; 85 return -ENOSYS;
104} 86}
105 87
106static inline int db5500_prcmu_set_arm_opp(u8 opp) 88static inline int db5500_prcmu_set_display_clocks(void)
107{ 89{
108 return 0; 90 return 0;
109} 91}
110 92
111static inline int db5500_prcmu_get_arm_opp(void) 93static inline int db5500_prcmu_disable_dsipll(void)
112{ 94{
113 return 0; 95 return 0;
114} 96}
115 97
98static inline int db5500_prcmu_enable_dsipll(void)
99{
100 return 0;
101}
116 102
117#endif /* CONFIG_MFD_DB5500_PRCMU */ 103#endif /* CONFIG_MFD_DB5500_PRCMU */
118 104
diff --git a/include/linux/mfd/rc5t583.h b/include/linux/mfd/rc5t583.h
index a2c61609d21d..0b64b19d81ab 100644
--- a/include/linux/mfd/rc5t583.h
+++ b/include/linux/mfd/rc5t583.h
@@ -26,6 +26,7 @@
26 26
27#include <linux/mutex.h> 27#include <linux/mutex.h>
28#include <linux/types.h> 28#include <linux/types.h>
29#include <linux/regmap.h>
29 30
30#define RC5T583_MAX_REGS 0xF8 31#define RC5T583_MAX_REGS 0xF8
31 32
@@ -279,14 +280,44 @@ struct rc5t583_platform_data {
279 bool enable_shutdown; 280 bool enable_shutdown;
280}; 281};
281 282
282int rc5t583_write(struct device *dev, u8 reg, uint8_t val); 283static inline int rc5t583_write(struct device *dev, uint8_t reg, uint8_t val)
283int rc5t583_read(struct device *dev, uint8_t reg, uint8_t *val); 284{
284int rc5t583_set_bits(struct device *dev, unsigned int reg, 285 struct rc5t583 *rc5t583 = dev_get_drvdata(dev);
285 unsigned int bit_mask); 286 return regmap_write(rc5t583->regmap, reg, val);
286int rc5t583_clear_bits(struct device *dev, unsigned int reg, 287}
287 unsigned int bit_mask); 288
288int rc5t583_update(struct device *dev, unsigned int reg, 289static inline int rc5t583_read(struct device *dev, uint8_t reg, uint8_t *val)
289 unsigned int val, unsigned int mask); 290{
291 struct rc5t583 *rc5t583 = dev_get_drvdata(dev);
292 unsigned int ival;
293 int ret;
294 ret = regmap_read(rc5t583->regmap, reg, &ival);
295 if (!ret)
296 *val = (uint8_t)ival;
297 return ret;
298}
299
300static inline int rc5t583_set_bits(struct device *dev, unsigned int reg,
301 unsigned int bit_mask)
302{
303 struct rc5t583 *rc5t583 = dev_get_drvdata(dev);
304 return regmap_update_bits(rc5t583->regmap, reg, bit_mask, bit_mask);
305}
306
307static inline int rc5t583_clear_bits(struct device *dev, unsigned int reg,
308 unsigned int bit_mask)
309{
310 struct rc5t583 *rc5t583 = dev_get_drvdata(dev);
311 return regmap_update_bits(rc5t583->regmap, reg, bit_mask, 0);
312}
313
314static inline int rc5t583_update(struct device *dev, unsigned int reg,
315 unsigned int val, unsigned int mask)
316{
317 struct rc5t583 *rc5t583 = dev_get_drvdata(dev);
318 return regmap_update_bits(rc5t583->regmap, reg, mask, val);
319}
320
290int rc5t583_ext_power_req_config(struct device *dev, int deepsleep_id, 321int rc5t583_ext_power_req_config(struct device *dev, int deepsleep_id,
291 int ext_pwr_req, int deepsleep_slot_nr); 322 int ext_pwr_req, int deepsleep_slot_nr);
292int rc5t583_irq_init(struct rc5t583 *rc5t583, int irq, int irq_base); 323int rc5t583_irq_init(struct rc5t583 *rc5t583, int irq, int irq_base);
diff --git a/include/linux/mfd/twl6040.h b/include/linux/mfd/twl6040.h
index 9bc9ac651dad..b15b5f03f5c4 100644
--- a/include/linux/mfd/twl6040.h
+++ b/include/linux/mfd/twl6040.h
@@ -174,8 +174,35 @@
174#define TWL6040_SYSCLK_SEL_LPPLL 0 174#define TWL6040_SYSCLK_SEL_LPPLL 0
175#define TWL6040_SYSCLK_SEL_HPPLL 1 175#define TWL6040_SYSCLK_SEL_HPPLL 1
176 176
177struct twl6040_codec_data {
178 u16 hs_left_step;
179 u16 hs_right_step;
180 u16 hf_left_step;
181 u16 hf_right_step;
182};
183
184struct twl6040_vibra_data {
185 unsigned int vibldrv_res; /* left driver resistance */
186 unsigned int vibrdrv_res; /* right driver resistance */
187 unsigned int viblmotor_res; /* left motor resistance */
188 unsigned int vibrmotor_res; /* right motor resistance */
189 int vddvibl_uV; /* VDDVIBL volt, set 0 for fixed reg */
190 int vddvibr_uV; /* VDDVIBR volt, set 0 for fixed reg */
191};
192
193struct twl6040_platform_data {
194 int audpwron_gpio; /* audio power-on gpio */
195 unsigned int irq_base;
196
197 struct twl6040_codec_data *codec;
198 struct twl6040_vibra_data *vibra;
199};
200
201struct regmap;
202
177struct twl6040 { 203struct twl6040 {
178 struct device *dev; 204 struct device *dev;
205 struct regmap *regmap;
179 struct mutex mutex; 206 struct mutex mutex;
180 struct mutex io_mutex; 207 struct mutex io_mutex;
181 struct mutex irq_mutex; 208 struct mutex irq_mutex;
diff --git a/include/linux/mm.h b/include/linux/mm.h
index d8738a464b94..74aa71bea1e4 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1393,29 +1393,20 @@ extern int install_special_mapping(struct mm_struct *mm,
1393 1393
1394extern unsigned long get_unmapped_area(struct file *, unsigned long, unsigned long, unsigned long, unsigned long); 1394extern unsigned long get_unmapped_area(struct file *, unsigned long, unsigned long, unsigned long, unsigned long);
1395 1395
1396extern unsigned long do_mmap_pgoff(struct file *file, unsigned long addr,
1397 unsigned long len, unsigned long prot,
1398 unsigned long flag, unsigned long pgoff);
1399extern unsigned long mmap_region(struct file *file, unsigned long addr, 1396extern unsigned long mmap_region(struct file *file, unsigned long addr,
1400 unsigned long len, unsigned long flags, 1397 unsigned long len, unsigned long flags,
1401 vm_flags_t vm_flags, unsigned long pgoff); 1398 vm_flags_t vm_flags, unsigned long pgoff);
1402 1399extern unsigned long do_mmap(struct file *, unsigned long,
1403static inline unsigned long do_mmap(struct file *file, unsigned long addr, 1400 unsigned long, unsigned long,
1404 unsigned long len, unsigned long prot, 1401 unsigned long, unsigned long);
1405 unsigned long flag, unsigned long offset)
1406{
1407 unsigned long ret = -EINVAL;
1408 if ((offset + PAGE_ALIGN(len)) < offset)
1409 goto out;
1410 if (!(offset & ~PAGE_MASK))
1411 ret = do_mmap_pgoff(file, addr, len, prot, flag, offset >> PAGE_SHIFT);
1412out:
1413 return ret;
1414}
1415
1416extern int do_munmap(struct mm_struct *, unsigned long, size_t); 1402extern int do_munmap(struct mm_struct *, unsigned long, size_t);
1417 1403
1418extern unsigned long do_brk(unsigned long, unsigned long); 1404/* These take the mm semaphore themselves */
1405extern unsigned long vm_brk(unsigned long, unsigned long);
1406extern int vm_munmap(unsigned long, size_t);
1407extern unsigned long vm_mmap(struct file *, unsigned long,
1408 unsigned long, unsigned long,
1409 unsigned long, unsigned long);
1419 1410
1420/* truncate.c */ 1411/* truncate.c */
1421extern void truncate_inode_pages(struct address_space *, loff_t); 1412extern void truncate_inode_pages(struct address_space *, loff_t);
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index 01beae78f079..629b823f8836 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -481,7 +481,7 @@ struct mmc_driver {
481 struct device_driver drv; 481 struct device_driver drv;
482 int (*probe)(struct mmc_card *); 482 int (*probe)(struct mmc_card *);
483 void (*remove)(struct mmc_card *); 483 void (*remove)(struct mmc_card *);
484 int (*suspend)(struct mmc_card *, pm_message_t); 484 int (*suspend)(struct mmc_card *);
485 int (*resume)(struct mmc_card *); 485 int (*resume)(struct mmc_card *);
486}; 486};
487 487
diff --git a/include/linux/nfsd/Kbuild b/include/linux/nfsd/Kbuild
index b8d4001212b3..5b7d84ac954a 100644
--- a/include/linux/nfsd/Kbuild
+++ b/include/linux/nfsd/Kbuild
@@ -1,3 +1,4 @@
1header-y += cld.h
1header-y += debug.h 2header-y += debug.h
2header-y += export.h 3header-y += export.h
3header-y += nfsfh.h 4header-y += nfsfh.h
diff --git a/include/linux/pinctrl/machine.h b/include/linux/pinctrl/machine.h
index fee4349364f7..e4d1de742502 100644
--- a/include/linux/pinctrl/machine.h
+++ b/include/linux/pinctrl/machine.h
@@ -12,6 +12,8 @@
12#ifndef __LINUX_PINCTRL_MACHINE_H 12#ifndef __LINUX_PINCTRL_MACHINE_H
13#define __LINUX_PINCTRL_MACHINE_H 13#define __LINUX_PINCTRL_MACHINE_H
14 14
15#include <linux/bug.h>
16
15#include "pinctrl-state.h" 17#include "pinctrl-state.h"
16 18
17enum pinctrl_map_type { 19enum pinctrl_map_type {
@@ -148,7 +150,7 @@ struct pinctrl_map {
148#define PIN_MAP_CONFIGS_GROUP_HOG_DEFAULT(dev, grp, cfgs) \ 150#define PIN_MAP_CONFIGS_GROUP_HOG_DEFAULT(dev, grp, cfgs) \
149 PIN_MAP_CONFIGS_GROUP(dev, PINCTRL_STATE_DEFAULT, dev, grp, cfgs) 151 PIN_MAP_CONFIGS_GROUP(dev, PINCTRL_STATE_DEFAULT, dev, grp, cfgs)
150 152
151#ifdef CONFIG_PINMUX 153#ifdef CONFIG_PINCTRL
152 154
153extern int pinctrl_register_mappings(struct pinctrl_map const *map, 155extern int pinctrl_register_mappings(struct pinctrl_map const *map,
154 unsigned num_maps); 156 unsigned num_maps);
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index f67810f8f21b..38ab3f46346f 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -94,6 +94,7 @@ struct usb_phy {
94 94
95 struct usb_otg *otg; 95 struct usb_otg *otg;
96 96
97 struct device *io_dev;
97 struct usb_phy_io_ops *io_ops; 98 struct usb_phy_io_ops *io_ops;
98 void __iomem *io_priv; 99 void __iomem *io_priv;
99 100
diff --git a/lib/mpi/mpi-bit.c b/lib/mpi/mpi-bit.c
index 2f526627e4f5..0c505361da19 100644
--- a/lib/mpi/mpi-bit.c
+++ b/lib/mpi/mpi-bit.c
@@ -177,8 +177,8 @@ int mpi_rshift(MPI x, MPI a, unsigned n)
177 */ 177 */
178int mpi_lshift_limbs(MPI a, unsigned int count) 178int mpi_lshift_limbs(MPI a, unsigned int count)
179{ 179{
180 mpi_ptr_t ap = a->d; 180 const int n = a->nlimbs;
181 int n = a->nlimbs; 181 mpi_ptr_t ap;
182 int i; 182 int i;
183 183
184 if (!count || !n) 184 if (!count || !n)
@@ -187,6 +187,7 @@ int mpi_lshift_limbs(MPI a, unsigned int count)
187 if (RESIZE_IF_NEEDED(a, n + count) < 0) 187 if (RESIZE_IF_NEEDED(a, n + count) < 0)
188 return -ENOMEM; 188 return -ENOMEM;
189 189
190 ap = a->d;
190 for (i = n - 1; i >= 0; i--) 191 for (i = n - 1; i >= 0; i--)
191 ap[i + count] = ap[i]; 192 ap[i + count] = ap[i];
192 for (i = 0; i < count; i++) 193 for (i = 0; i < count; i++)
diff --git a/mm/memblock.c b/mm/memblock.c
index 99f285599501..a44eab3157f8 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -330,6 +330,9 @@ static int __init_memblock memblock_add_region(struct memblock_type *type,
330 phys_addr_t end = base + memblock_cap_size(base, &size); 330 phys_addr_t end = base + memblock_cap_size(base, &size);
331 int i, nr_new; 331 int i, nr_new;
332 332
333 if (!size)
334 return 0;
335
333 /* special case for empty array */ 336 /* special case for empty array */
334 if (type->regions[0].size == 0) { 337 if (type->regions[0].size == 0) {
335 WARN_ON(type->cnt != 1 || type->total_size); 338 WARN_ON(type->cnt != 1 || type->total_size);
@@ -430,6 +433,9 @@ static int __init_memblock memblock_isolate_range(struct memblock_type *type,
430 433
431 *start_rgn = *end_rgn = 0; 434 *start_rgn = *end_rgn = 0;
432 435
436 if (!size)
437 return 0;
438
433 /* we'll create at most two more regions */ 439 /* we'll create at most two more regions */
434 while (type->cnt + 2 > type->max) 440 while (type->cnt + 2 > type->max)
435 if (memblock_double_array(type) < 0) 441 if (memblock_double_array(type) < 0)
@@ -514,7 +520,6 @@ int __init_memblock memblock_reserve(phys_addr_t base, phys_addr_t size)
514 (unsigned long long)base, 520 (unsigned long long)base,
515 (unsigned long long)base + size, 521 (unsigned long long)base + size,
516 (void *)_RET_IP_); 522 (void *)_RET_IP_);
517 BUG_ON(0 == size);
518 523
519 return memblock_add_region(_rgn, base, size, MAX_NUMNODES); 524 return memblock_add_region(_rgn, base, size, MAX_NUMNODES);
520} 525}
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index a7165a60d0a7..b868def9bcc1 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -3392,6 +3392,7 @@ void mem_cgroup_replace_page_cache(struct page *oldpage,
3392 * the newpage may be on LRU(or pagevec for LRU) already. We lock 3392 * the newpage may be on LRU(or pagevec for LRU) already. We lock
3393 * LRU while we overwrite pc->mem_cgroup. 3393 * LRU while we overwrite pc->mem_cgroup.
3394 */ 3394 */
3395 pc = lookup_page_cgroup(newpage);
3395 __mem_cgroup_commit_charge(memcg, newpage, 1, pc, type, true); 3396 __mem_cgroup_commit_charge(memcg, newpage, 1, pc, type, true);
3396} 3397}
3397 3398
diff --git a/mm/mmap.c b/mm/mmap.c
index a7bf6a31c9f6..848ef52d9603 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -240,6 +240,8 @@ static struct vm_area_struct *remove_vma(struct vm_area_struct *vma)
240 return next; 240 return next;
241} 241}
242 242
243static unsigned long do_brk(unsigned long addr, unsigned long len);
244
243SYSCALL_DEFINE1(brk, unsigned long, brk) 245SYSCALL_DEFINE1(brk, unsigned long, brk)
244{ 246{
245 unsigned long rlim, retval; 247 unsigned long rlim, retval;
@@ -951,7 +953,7 @@ static inline unsigned long round_hint_to_min(unsigned long hint)
951 * The caller must hold down_write(&current->mm->mmap_sem). 953 * The caller must hold down_write(&current->mm->mmap_sem).
952 */ 954 */
953 955
954unsigned long do_mmap_pgoff(struct file *file, unsigned long addr, 956static unsigned long do_mmap_pgoff(struct file *file, unsigned long addr,
955 unsigned long len, unsigned long prot, 957 unsigned long len, unsigned long prot,
956 unsigned long flags, unsigned long pgoff) 958 unsigned long flags, unsigned long pgoff)
957{ 959{
@@ -1087,7 +1089,32 @@ unsigned long do_mmap_pgoff(struct file *file, unsigned long addr,
1087 1089
1088 return mmap_region(file, addr, len, flags, vm_flags, pgoff); 1090 return mmap_region(file, addr, len, flags, vm_flags, pgoff);
1089} 1091}
1090EXPORT_SYMBOL(do_mmap_pgoff); 1092
1093unsigned long do_mmap(struct file *file, unsigned long addr,
1094 unsigned long len, unsigned long prot,
1095 unsigned long flag, unsigned long offset)
1096{
1097 if (unlikely(offset + PAGE_ALIGN(len) < offset))
1098 return -EINVAL;
1099 if (unlikely(offset & ~PAGE_MASK))
1100 return -EINVAL;
1101 return do_mmap_pgoff(file, addr, len, prot, flag, offset >> PAGE_SHIFT);
1102}
1103EXPORT_SYMBOL(do_mmap);
1104
1105unsigned long vm_mmap(struct file *file, unsigned long addr,
1106 unsigned long len, unsigned long prot,
1107 unsigned long flag, unsigned long offset)
1108{
1109 unsigned long ret;
1110 struct mm_struct *mm = current->mm;
1111
1112 down_write(&mm->mmap_sem);
1113 ret = do_mmap(file, addr, len, prot, flag, offset);
1114 up_write(&mm->mmap_sem);
1115 return ret;
1116}
1117EXPORT_SYMBOL(vm_mmap);
1091 1118
1092SYSCALL_DEFINE6(mmap_pgoff, unsigned long, addr, unsigned long, len, 1119SYSCALL_DEFINE6(mmap_pgoff, unsigned long, addr, unsigned long, len,
1093 unsigned long, prot, unsigned long, flags, 1120 unsigned long, prot, unsigned long, flags,
@@ -2105,21 +2132,25 @@ int do_munmap(struct mm_struct *mm, unsigned long start, size_t len)
2105 2132
2106 return 0; 2133 return 0;
2107} 2134}
2108
2109EXPORT_SYMBOL(do_munmap); 2135EXPORT_SYMBOL(do_munmap);
2110 2136
2111SYSCALL_DEFINE2(munmap, unsigned long, addr, size_t, len) 2137int vm_munmap(unsigned long start, size_t len)
2112{ 2138{
2113 int ret; 2139 int ret;
2114 struct mm_struct *mm = current->mm; 2140 struct mm_struct *mm = current->mm;
2115 2141
2116 profile_munmap(addr);
2117
2118 down_write(&mm->mmap_sem); 2142 down_write(&mm->mmap_sem);
2119 ret = do_munmap(mm, addr, len); 2143 ret = do_munmap(mm, start, len);
2120 up_write(&mm->mmap_sem); 2144 up_write(&mm->mmap_sem);
2121 return ret; 2145 return ret;
2122} 2146}
2147EXPORT_SYMBOL(vm_munmap);
2148
2149SYSCALL_DEFINE2(munmap, unsigned long, addr, size_t, len)
2150{
2151 profile_munmap(addr);
2152 return vm_munmap(addr, len);
2153}
2123 2154
2124static inline void verify_mm_writelocked(struct mm_struct *mm) 2155static inline void verify_mm_writelocked(struct mm_struct *mm)
2125{ 2156{
@@ -2136,7 +2167,7 @@ static inline void verify_mm_writelocked(struct mm_struct *mm)
2136 * anonymous maps. eventually we may be able to do some 2167 * anonymous maps. eventually we may be able to do some
2137 * brk-specific accounting here. 2168 * brk-specific accounting here.
2138 */ 2169 */
2139unsigned long do_brk(unsigned long addr, unsigned long len) 2170static unsigned long do_brk(unsigned long addr, unsigned long len)
2140{ 2171{
2141 struct mm_struct * mm = current->mm; 2172 struct mm_struct * mm = current->mm;
2142 struct vm_area_struct * vma, * prev; 2173 struct vm_area_struct * vma, * prev;
@@ -2232,7 +2263,17 @@ out:
2232 return addr; 2263 return addr;
2233} 2264}
2234 2265
2235EXPORT_SYMBOL(do_brk); 2266unsigned long vm_brk(unsigned long addr, unsigned long len)
2267{
2268 struct mm_struct *mm = current->mm;
2269 unsigned long ret;
2270
2271 down_write(&mm->mmap_sem);
2272 ret = do_brk(addr, len);
2273 up_write(&mm->mmap_sem);
2274 return ret;
2275}
2276EXPORT_SYMBOL(vm_brk);
2236 2277
2237/* Release all mmaps. */ 2278/* Release all mmaps. */
2238void exit_mmap(struct mm_struct *mm) 2279void exit_mmap(struct mm_struct *mm)
diff --git a/mm/nommu.c b/mm/nommu.c
index f59e170fceb4..bb8f4f004a82 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -1233,7 +1233,7 @@ enomem:
1233/* 1233/*
1234 * handle mapping creation for uClinux 1234 * handle mapping creation for uClinux
1235 */ 1235 */
1236unsigned long do_mmap_pgoff(struct file *file, 1236static unsigned long do_mmap_pgoff(struct file *file,
1237 unsigned long addr, 1237 unsigned long addr,
1238 unsigned long len, 1238 unsigned long len,
1239 unsigned long prot, 1239 unsigned long prot,
@@ -1470,7 +1470,32 @@ error_getting_region:
1470 show_free_areas(0); 1470 show_free_areas(0);
1471 return -ENOMEM; 1471 return -ENOMEM;
1472} 1472}
1473EXPORT_SYMBOL(do_mmap_pgoff); 1473
1474unsigned long do_mmap(struct file *file, unsigned long addr,
1475 unsigned long len, unsigned long prot,
1476 unsigned long flag, unsigned long offset)
1477{
1478 if (unlikely(offset + PAGE_ALIGN(len) < offset))
1479 return -EINVAL;
1480 if (unlikely(offset & ~PAGE_MASK))
1481 return -EINVAL;
1482 return do_mmap_pgoff(file, addr, len, prot, flag, offset >> PAGE_SHIFT);
1483}
1484EXPORT_SYMBOL(do_mmap);
1485
1486unsigned long vm_mmap(struct file *file, unsigned long addr,
1487 unsigned long len, unsigned long prot,
1488 unsigned long flag, unsigned long offset)
1489{
1490 unsigned long ret;
1491 struct mm_struct *mm = current->mm;
1492
1493 down_write(&mm->mmap_sem);
1494 ret = do_mmap(file, addr, len, prot, flag, offset);
1495 up_write(&mm->mmap_sem);
1496 return ret;
1497}
1498EXPORT_SYMBOL(vm_mmap);
1474 1499
1475SYSCALL_DEFINE6(mmap_pgoff, unsigned long, addr, unsigned long, len, 1500SYSCALL_DEFINE6(mmap_pgoff, unsigned long, addr, unsigned long, len,
1476 unsigned long, prot, unsigned long, flags, 1501 unsigned long, prot, unsigned long, flags,
@@ -1709,16 +1734,22 @@ erase_whole_vma:
1709} 1734}
1710EXPORT_SYMBOL(do_munmap); 1735EXPORT_SYMBOL(do_munmap);
1711 1736
1712SYSCALL_DEFINE2(munmap, unsigned long, addr, size_t, len) 1737int vm_munmap(unsigned long addr, size_t len)
1713{ 1738{
1714 int ret;
1715 struct mm_struct *mm = current->mm; 1739 struct mm_struct *mm = current->mm;
1740 int ret;
1716 1741
1717 down_write(&mm->mmap_sem); 1742 down_write(&mm->mmap_sem);
1718 ret = do_munmap(mm, addr, len); 1743 ret = do_munmap(mm, addr, len);
1719 up_write(&mm->mmap_sem); 1744 up_write(&mm->mmap_sem);
1720 return ret; 1745 return ret;
1721} 1746}
1747EXPORT_SYMBOL(vm_munmap);
1748
1749SYSCALL_DEFINE2(munmap, unsigned long, addr, size_t, len)
1750{
1751 return vm_munmap(addr, len);
1752}
1722 1753
1723/* 1754/*
1724 * release all the mappings made in a process's VM space 1755 * release all the mappings made in a process's VM space
@@ -1744,7 +1775,7 @@ void exit_mmap(struct mm_struct *mm)
1744 kleave(""); 1775 kleave("");
1745} 1776}
1746 1777
1747unsigned long do_brk(unsigned long addr, unsigned long len) 1778unsigned long vm_brk(unsigned long addr, unsigned long len)
1748{ 1779{
1749 return -ENOMEM; 1780 return -ENOMEM;
1750} 1781}
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index de639eeeed50..faea0ec612bf 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1869,12 +1869,6 @@ sub process {
1869 "No space is necessary after a cast\n" . $hereprev); 1869 "No space is necessary after a cast\n" . $hereprev);
1870 } 1870 }
1871 1871
1872 if ($rawline =~ /^\+[ \t]*\/\*[ \t]*$/ &&
1873 $prevrawline =~ /^\+[ \t]*$/) {
1874 CHK("BLOCK_COMMENT_STYLE",
1875 "Don't begin block comments with only a /* line, use /* comment...\n" . $hereprev);
1876 }
1877
1878# check for spaces at the beginning of a line. 1872# check for spaces at the beginning of a line.
1879# Exceptions: 1873# Exceptions:
1880# 1) within comments 1874# 1) within comments
diff --git a/scripts/xz_wrap.sh b/scripts/xz_wrap.sh
index 17a5798c29da..7a2d372f4885 100644
--- a/scripts/xz_wrap.sh
+++ b/scripts/xz_wrap.sh
@@ -12,8 +12,8 @@
12BCJ= 12BCJ=
13LZMA2OPTS= 13LZMA2OPTS=
14 14
15case $ARCH in 15case $SRCARCH in
16 x86|x86_64) BCJ=--x86 ;; 16 x86) BCJ=--x86 ;;
17 powerpc) BCJ=--powerpc ;; 17 powerpc) BCJ=--powerpc ;;
18 ia64) BCJ=--ia64; LZMA2OPTS=pb=4 ;; 18 ia64) BCJ=--ia64; LZMA2OPTS=pb=4 ;;
19 arm) BCJ=--arm ;; 19 arm) BCJ=--arm ;;
diff --git a/security/commoncap.c b/security/commoncap.c
index 0cf4b53480a7..71a166a05975 100644
--- a/security/commoncap.c
+++ b/security/commoncap.c
@@ -29,6 +29,7 @@
29#include <linux/securebits.h> 29#include <linux/securebits.h>
30#include <linux/user_namespace.h> 30#include <linux/user_namespace.h>
31#include <linux/binfmts.h> 31#include <linux/binfmts.h>
32#include <linux/personality.h>
32 33
33/* 34/*
34 * If a non-root user executes a setuid-root binary in 35 * If a non-root user executes a setuid-root binary in
@@ -505,6 +506,11 @@ int cap_bprm_set_creds(struct linux_binprm *bprm)
505 } 506 }
506skip: 507skip:
507 508
509 /* if we have fs caps, clear dangerous personality flags */
510 if (!cap_issubset(new->cap_permitted, old->cap_permitted))
511 bprm->per_clear |= PER_CLEAR_ON_SETID;
512
513
508 /* Don't let someone trace a set[ug]id/setpcap binary with the revised 514 /* Don't let someone trace a set[ug]id/setpcap binary with the revised
509 * credentials unless they have the appropriate permit 515 * credentials unless they have the appropriate permit
510 */ 516 */
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
index 10056f2f6df3..45c32f074166 100644
--- a/security/smack/smack_lsm.c
+++ b/security/smack/smack_lsm.c
@@ -3640,8 +3640,38 @@ struct security_operations smack_ops = {
3640}; 3640};
3641 3641
3642 3642
3643static __init void init_smack_know_list(void) 3643static __init void init_smack_known_list(void)
3644{ 3644{
3645 /*
3646 * Initialize CIPSO locks
3647 */
3648 spin_lock_init(&smack_known_huh.smk_cipsolock);
3649 spin_lock_init(&smack_known_hat.smk_cipsolock);
3650 spin_lock_init(&smack_known_star.smk_cipsolock);
3651 spin_lock_init(&smack_known_floor.smk_cipsolock);
3652 spin_lock_init(&smack_known_invalid.smk_cipsolock);
3653 spin_lock_init(&smack_known_web.smk_cipsolock);
3654 /*
3655 * Initialize rule list locks
3656 */
3657 mutex_init(&smack_known_huh.smk_rules_lock);
3658 mutex_init(&smack_known_hat.smk_rules_lock);
3659 mutex_init(&smack_known_floor.smk_rules_lock);
3660 mutex_init(&smack_known_star.smk_rules_lock);
3661 mutex_init(&smack_known_invalid.smk_rules_lock);
3662 mutex_init(&smack_known_web.smk_rules_lock);
3663 /*
3664 * Initialize rule lists
3665 */
3666 INIT_LIST_HEAD(&smack_known_huh.smk_rules);
3667 INIT_LIST_HEAD(&smack_known_hat.smk_rules);
3668 INIT_LIST_HEAD(&smack_known_star.smk_rules);
3669 INIT_LIST_HEAD(&smack_known_floor.smk_rules);
3670 INIT_LIST_HEAD(&smack_known_invalid.smk_rules);
3671 INIT_LIST_HEAD(&smack_known_web.smk_rules);
3672 /*
3673 * Create the known labels list
3674 */
3645 list_add(&smack_known_huh.list, &smack_known_list); 3675 list_add(&smack_known_huh.list, &smack_known_list);
3646 list_add(&smack_known_hat.list, &smack_known_list); 3676 list_add(&smack_known_hat.list, &smack_known_list);
3647 list_add(&smack_known_star.list, &smack_known_list); 3677 list_add(&smack_known_star.list, &smack_known_list);
@@ -3676,16 +3706,8 @@ static __init int smack_init(void)
3676 cred = (struct cred *) current->cred; 3706 cred = (struct cred *) current->cred;
3677 cred->security = tsp; 3707 cred->security = tsp;
3678 3708
3679 /* initialize the smack_know_list */ 3709 /* initialize the smack_known_list */
3680 init_smack_know_list(); 3710 init_smack_known_list();
3681 /*
3682 * Initialize locks
3683 */
3684 spin_lock_init(&smack_known_huh.smk_cipsolock);
3685 spin_lock_init(&smack_known_hat.smk_cipsolock);
3686 spin_lock_init(&smack_known_star.smk_cipsolock);
3687 spin_lock_init(&smack_known_floor.smk_cipsolock);
3688 spin_lock_init(&smack_known_invalid.smk_cipsolock);
3689 3711
3690 /* 3712 /*
3691 * Register with LSM 3713 * Register with LSM
diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c
index 5c32f36ff706..038811cb7e62 100644
--- a/security/smack/smackfs.c
+++ b/security/smack/smackfs.c
@@ -1614,20 +1614,6 @@ static int __init init_smk_fs(void)
1614 smk_cipso_doi(); 1614 smk_cipso_doi();
1615 smk_unlbl_ambient(NULL); 1615 smk_unlbl_ambient(NULL);
1616 1616
1617 mutex_init(&smack_known_floor.smk_rules_lock);
1618 mutex_init(&smack_known_hat.smk_rules_lock);
1619 mutex_init(&smack_known_huh.smk_rules_lock);
1620 mutex_init(&smack_known_invalid.smk_rules_lock);
1621 mutex_init(&smack_known_star.smk_rules_lock);
1622 mutex_init(&smack_known_web.smk_rules_lock);
1623
1624 INIT_LIST_HEAD(&smack_known_floor.smk_rules);
1625 INIT_LIST_HEAD(&smack_known_hat.smk_rules);
1626 INIT_LIST_HEAD(&smack_known_huh.smk_rules);
1627 INIT_LIST_HEAD(&smack_known_invalid.smk_rules);
1628 INIT_LIST_HEAD(&smack_known_star.smk_rules);
1629 INIT_LIST_HEAD(&smack_known_web.smk_rules);
1630
1631 return err; 1617 return err;
1632} 1618}
1633 1619
diff --git a/sound/core/vmaster.c b/sound/core/vmaster.c
index 14a286a7bf2b..857586135d18 100644
--- a/sound/core/vmaster.c
+++ b/sound/core/vmaster.c
@@ -419,6 +419,7 @@ EXPORT_SYMBOL(snd_ctl_make_virtual_master);
419 * snd_ctl_add_vmaster_hook - Add a hook to a vmaster control 419 * snd_ctl_add_vmaster_hook - Add a hook to a vmaster control
420 * @kcontrol: vmaster kctl element 420 * @kcontrol: vmaster kctl element
421 * @hook: the hook function 421 * @hook: the hook function
422 * @private_data: the private_data pointer to be saved
422 * 423 *
423 * Adds the given hook to the vmaster control element so that it's called 424 * Adds the given hook to the vmaster control element so that it's called
424 * at each time when the value is changed. 425 * at each time when the value is changed.
diff --git a/sound/last.c b/sound/last.c
index bdd0857b8871..7ffc182e0844 100644
--- a/sound/last.c
+++ b/sound/last.c
@@ -38,4 +38,4 @@ static int __init alsa_sound_last_init(void)
38 return 0; 38 return 0;
39} 39}
40 40
41__initcall(alsa_sound_last_init); 41late_initcall_sync(alsa_sound_last_init);
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index a36488d94aaa..d906c5b74cf0 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -3971,9 +3971,14 @@ static void cx_auto_init_output(struct hda_codec *codec)
3971 int i; 3971 int i;
3972 3972
3973 mute_outputs(codec, spec->multiout.num_dacs, spec->multiout.dac_nids); 3973 mute_outputs(codec, spec->multiout.num_dacs, spec->multiout.dac_nids);
3974 for (i = 0; i < cfg->hp_outs; i++) 3974 for (i = 0; i < cfg->hp_outs; i++) {
3975 unsigned int val = PIN_OUT;
3976 if (snd_hda_query_pin_caps(codec, cfg->hp_pins[i]) &
3977 AC_PINCAP_HP_DRV)
3978 val |= AC_PINCTL_HP_EN;
3975 snd_hda_codec_write(codec, cfg->hp_pins[i], 0, 3979 snd_hda_codec_write(codec, cfg->hp_pins[i], 0,
3976 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP); 3980 AC_VERB_SET_PIN_WIDGET_CONTROL, val);
3981 }
3977 mute_outputs(codec, cfg->hp_outs, cfg->hp_pins); 3982 mute_outputs(codec, cfg->hp_outs, cfg->hp_pins);
3978 mute_outputs(codec, cfg->line_outs, cfg->line_out_pins); 3983 mute_outputs(codec, cfg->line_outs, cfg->line_out_pins);
3979 mute_outputs(codec, cfg->speaker_outs, cfg->speaker_pins); 3984 mute_outputs(codec, cfg->speaker_outs, cfg->speaker_pins);
@@ -4391,8 +4396,10 @@ static void apply_pin_fixup(struct hda_codec *codec,
4391 4396
4392enum { 4397enum {
4393 CXT_PINCFG_LENOVO_X200, 4398 CXT_PINCFG_LENOVO_X200,
4399 CXT_PINCFG_LENOVO_TP410,
4394}; 4400};
4395 4401
4402/* ThinkPad X200 & co with cxt5051 */
4396static const struct cxt_pincfg cxt_pincfg_lenovo_x200[] = { 4403static const struct cxt_pincfg cxt_pincfg_lenovo_x200[] = {
4397 { 0x16, 0x042140ff }, /* HP (seq# overridden) */ 4404 { 0x16, 0x042140ff }, /* HP (seq# overridden) */
4398 { 0x17, 0x21a11000 }, /* dock-mic */ 4405 { 0x17, 0x21a11000 }, /* dock-mic */
@@ -4401,15 +4408,33 @@ static const struct cxt_pincfg cxt_pincfg_lenovo_x200[] = {
4401 {} 4408 {}
4402}; 4409};
4403 4410
4411/* ThinkPad 410/420/510/520, X201 & co with cxt5066 */
4412static const struct cxt_pincfg cxt_pincfg_lenovo_tp410[] = {
4413 { 0x19, 0x042110ff }, /* HP (seq# overridden) */
4414 { 0x1a, 0x21a190f0 }, /* dock-mic */
4415 { 0x1c, 0x212140ff }, /* dock-HP */
4416 {}
4417};
4418
4404static const struct cxt_pincfg *cxt_pincfg_tbl[] = { 4419static const struct cxt_pincfg *cxt_pincfg_tbl[] = {
4405 [CXT_PINCFG_LENOVO_X200] = cxt_pincfg_lenovo_x200, 4420 [CXT_PINCFG_LENOVO_X200] = cxt_pincfg_lenovo_x200,
4421 [CXT_PINCFG_LENOVO_TP410] = cxt_pincfg_lenovo_tp410,
4406}; 4422};
4407 4423
4408static const struct snd_pci_quirk cxt_fixups[] = { 4424static const struct snd_pci_quirk cxt5051_fixups[] = {
4409 SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo X200", CXT_PINCFG_LENOVO_X200), 4425 SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo X200", CXT_PINCFG_LENOVO_X200),
4410 {} 4426 {}
4411}; 4427};
4412 4428
4429static const struct snd_pci_quirk cxt5066_fixups[] = {
4430 SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo T400", CXT_PINCFG_LENOVO_TP410),
4431 SND_PCI_QUIRK(0x17aa, 0x215e, "Lenovo T410", CXT_PINCFG_LENOVO_TP410),
4432 SND_PCI_QUIRK(0x17aa, 0x215f, "Lenovo T510", CXT_PINCFG_LENOVO_TP410),
4433 SND_PCI_QUIRK(0x17aa, 0x21ce, "Lenovo T420", CXT_PINCFG_LENOVO_TP410),
4434 SND_PCI_QUIRK(0x17aa, 0x21cf, "Lenovo T520", CXT_PINCFG_LENOVO_TP410),
4435 {}
4436};
4437
4413/* add "fake" mute amp-caps to DACs on cx5051 so that mixer mute switches 4438/* add "fake" mute amp-caps to DACs on cx5051 so that mixer mute switches
4414 * can be created (bko#42825) 4439 * can be created (bko#42825)
4415 */ 4440 */
@@ -4446,13 +4471,13 @@ static int patch_conexant_auto(struct hda_codec *codec)
4446 case 0x14f15051: 4471 case 0x14f15051:
4447 add_cx5051_fake_mutes(codec); 4472 add_cx5051_fake_mutes(codec);
4448 codec->pin_amp_workaround = 1; 4473 codec->pin_amp_workaround = 1;
4474 apply_pin_fixup(codec, cxt5051_fixups, cxt_pincfg_tbl);
4449 break; 4475 break;
4450 default: 4476 default:
4451 codec->pin_amp_workaround = 1; 4477 codec->pin_amp_workaround = 1;
4478 apply_pin_fixup(codec, cxt5066_fixups, cxt_pincfg_tbl);
4452 } 4479 }
4453 4480
4454 apply_pin_fixup(codec, cxt_fixups, cxt_pincfg_tbl);
4455
4456 /* Show mute-led control only on HP laptops 4481 /* Show mute-led control only on HP laptops
4457 * This is a sort of white-list: on HP laptops, EAPD corresponds 4482 * This is a sort of white-list: on HP laptops, EAPD corresponds
4458 * only to the mute-LED without actualy amp function. Meanwhile, 4483 * only to the mute-LED without actualy amp function. Meanwhile,
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 2508f8109f11..e65e35433055 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -1445,6 +1445,13 @@ enum {
1445 ALC_FIXUP_ACT_BUILD, 1445 ALC_FIXUP_ACT_BUILD,
1446}; 1446};
1447 1447
1448static void alc_apply_pincfgs(struct hda_codec *codec,
1449 const struct alc_pincfg *cfg)
1450{
1451 for (; cfg->nid; cfg++)
1452 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
1453}
1454
1448static void alc_apply_fixup(struct hda_codec *codec, int action) 1455static void alc_apply_fixup(struct hda_codec *codec, int action)
1449{ 1456{
1450 struct alc_spec *spec = codec->spec; 1457 struct alc_spec *spec = codec->spec;
@@ -1478,9 +1485,7 @@ static void alc_apply_fixup(struct hda_codec *codec, int action)
1478 snd_printdd(KERN_INFO "hda_codec: %s: " 1485 snd_printdd(KERN_INFO "hda_codec: %s: "
1479 "Apply pincfg for %s\n", 1486 "Apply pincfg for %s\n",
1480 codec->chip_name, modelname); 1487 codec->chip_name, modelname);
1481 for (; cfg->nid; cfg++) 1488 alc_apply_pincfgs(codec, cfg);
1482 snd_hda_codec_set_pincfg(codec, cfg->nid,
1483 cfg->val);
1484 break; 1489 break;
1485 case ALC_FIXUP_VERBS: 1490 case ALC_FIXUP_VERBS:
1486 if (action != ALC_FIXUP_ACT_PROBE || !fix->v.verbs) 1491 if (action != ALC_FIXUP_ACT_PROBE || !fix->v.verbs)
@@ -4861,6 +4866,7 @@ enum {
4861 ALC260_FIXUP_GPIO1_TOGGLE, 4866 ALC260_FIXUP_GPIO1_TOGGLE,
4862 ALC260_FIXUP_REPLACER, 4867 ALC260_FIXUP_REPLACER,
4863 ALC260_FIXUP_HP_B1900, 4868 ALC260_FIXUP_HP_B1900,
4869 ALC260_FIXUP_KN1,
4864}; 4870};
4865 4871
4866static void alc260_gpio1_automute(struct hda_codec *codec) 4872static void alc260_gpio1_automute(struct hda_codec *codec)
@@ -4888,6 +4894,36 @@ static void alc260_fixup_gpio1_toggle(struct hda_codec *codec,
4888 } 4894 }
4889} 4895}
4890 4896
4897static void alc260_fixup_kn1(struct hda_codec *codec,
4898 const struct alc_fixup *fix, int action)
4899{
4900 struct alc_spec *spec = codec->spec;
4901 static const struct alc_pincfg pincfgs[] = {
4902 { 0x0f, 0x02214000 }, /* HP/speaker */
4903 { 0x12, 0x90a60160 }, /* int mic */
4904 { 0x13, 0x02a19000 }, /* ext mic */
4905 { 0x18, 0x01446000 }, /* SPDIF out */
4906 /* disable bogus I/O pins */
4907 { 0x10, 0x411111f0 },
4908 { 0x11, 0x411111f0 },
4909 { 0x14, 0x411111f0 },
4910 { 0x15, 0x411111f0 },
4911 { 0x16, 0x411111f0 },
4912 { 0x17, 0x411111f0 },
4913 { 0x19, 0x411111f0 },
4914 { }
4915 };
4916
4917 switch (action) {
4918 case ALC_FIXUP_ACT_PRE_PROBE:
4919 alc_apply_pincfgs(codec, pincfgs);
4920 break;
4921 case ALC_FIXUP_ACT_PROBE:
4922 spec->init_amp = ALC_INIT_NONE;
4923 break;
4924 }
4925}
4926
4891static const struct alc_fixup alc260_fixups[] = { 4927static const struct alc_fixup alc260_fixups[] = {
4892 [ALC260_FIXUP_HP_DC5750] = { 4928 [ALC260_FIXUP_HP_DC5750] = {
4893 .type = ALC_FIXUP_PINS, 4929 .type = ALC_FIXUP_PINS,
@@ -4938,7 +4974,11 @@ static const struct alc_fixup alc260_fixups[] = {
4938 .v.func = alc260_fixup_gpio1_toggle, 4974 .v.func = alc260_fixup_gpio1_toggle,
4939 .chained = true, 4975 .chained = true,
4940 .chain_id = ALC260_FIXUP_COEF, 4976 .chain_id = ALC260_FIXUP_COEF,
4941 } 4977 },
4978 [ALC260_FIXUP_KN1] = {
4979 .type = ALC_FIXUP_FUNC,
4980 .v.func = alc260_fixup_kn1,
4981 },
4942}; 4982};
4943 4983
4944static const struct snd_pci_quirk alc260_fixup_tbl[] = { 4984static const struct snd_pci_quirk alc260_fixup_tbl[] = {
@@ -4948,6 +4988,7 @@ static const struct snd_pci_quirk alc260_fixup_tbl[] = {
4948 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750), 4988 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750),
4949 SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900), 4989 SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900),
4950 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1), 4990 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1),
4991 SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1),
4951 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER), 4992 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER),
4952 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF), 4993 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF),
4953 {} 4994 {}
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 33a9946b492c..4742cac26aa9 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -5063,12 +5063,11 @@ static void stac92xx_update_led_status(struct hda_codec *codec, int enabled)
5063 if (spec->gpio_led_polarity) 5063 if (spec->gpio_led_polarity)
5064 muted = !muted; 5064 muted = !muted;
5065 5065
5066 /*polarity defines *not* muted state level*/
5067 if (!spec->vref_mute_led_nid) { 5066 if (!spec->vref_mute_led_nid) {
5068 if (muted) 5067 if (muted)
5069 spec->gpio_data &= ~spec->gpio_led; /* orange */ 5068 spec->gpio_data |= spec->gpio_led;
5070 else 5069 else
5071 spec->gpio_data |= spec->gpio_led; /* white */ 5070 spec->gpio_data &= ~spec->gpio_led;
5072 stac_gpio_set(codec, spec->gpio_mask, 5071 stac_gpio_set(codec, spec->gpio_mask,
5073 spec->gpio_dir, spec->gpio_data); 5072 spec->gpio_dir, spec->gpio_data);
5074 } else { 5073 } else {
diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
index 6508e8b790bb..59d8efaa17e9 100644
--- a/sound/soc/codecs/Kconfig
+++ b/sound/soc/codecs/Kconfig
@@ -57,7 +57,7 @@ config SND_SOC_ALL_CODECS
57 select SND_SOC_TPA6130A2 if I2C 57 select SND_SOC_TPA6130A2 if I2C
58 select SND_SOC_TLV320DAC33 if I2C 58 select SND_SOC_TLV320DAC33 if I2C
59 select SND_SOC_TWL4030 if TWL4030_CORE 59 select SND_SOC_TWL4030 if TWL4030_CORE
60 select SND_SOC_TWL6040 if TWL4030_CORE 60 select SND_SOC_TWL6040 if TWL6040_CORE
61 select SND_SOC_UDA134X 61 select SND_SOC_UDA134X
62 select SND_SOC_UDA1380 if I2C 62 select SND_SOC_UDA1380 if I2C
63 select SND_SOC_WL1273 if MFD_WL1273_CORE 63 select SND_SOC_WL1273 if MFD_WL1273_CORE
@@ -276,7 +276,6 @@ config SND_SOC_TWL4030
276 tristate 276 tristate
277 277
278config SND_SOC_TWL6040 278config SND_SOC_TWL6040
279 select TWL6040_CORE
280 tristate 279 tristate
281 280
282config SND_SOC_UDA134X 281config SND_SOC_UDA134X
diff --git a/sound/soc/codecs/twl6040.c b/sound/soc/codecs/twl6040.c
index 2d8c6b825e57..dc7509b9d53a 100644
--- a/sound/soc/codecs/twl6040.c
+++ b/sound/soc/codecs/twl6040.c
@@ -26,7 +26,6 @@
26#include <linux/pm.h> 26#include <linux/pm.h>
27#include <linux/platform_device.h> 27#include <linux/platform_device.h>
28#include <linux/slab.h> 28#include <linux/slab.h>
29#include <linux/i2c/twl.h>
30#include <linux/mfd/twl6040.h> 29#include <linux/mfd/twl6040.h>
31 30
32#include <sound/core.h> 31#include <sound/core.h>
@@ -1528,7 +1527,7 @@ static int twl6040_resume(struct snd_soc_codec *codec)
1528static int twl6040_probe(struct snd_soc_codec *codec) 1527static int twl6040_probe(struct snd_soc_codec *codec)
1529{ 1528{
1530 struct twl6040_data *priv; 1529 struct twl6040_data *priv;
1531 struct twl4030_codec_data *pdata = dev_get_platdata(codec->dev); 1530 struct twl6040_codec_data *pdata = dev_get_platdata(codec->dev);
1532 struct platform_device *pdev = container_of(codec->dev, 1531 struct platform_device *pdev = container_of(codec->dev,
1533 struct platform_device, dev); 1532 struct platform_device, dev);
1534 int ret = 0; 1533 int ret = 0;
diff --git a/sound/soc/omap/Kconfig b/sound/soc/omap/Kconfig
index e00dd0b1139c..deafbfaacdbf 100644
--- a/sound/soc/omap/Kconfig
+++ b/sound/soc/omap/Kconfig
@@ -97,7 +97,7 @@ config SND_OMAP_SOC_SDP3430
97 97
98config SND_OMAP_SOC_OMAP_ABE_TWL6040 98config SND_OMAP_SOC_OMAP_ABE_TWL6040
99 tristate "SoC Audio support for OMAP boards using ABE and twl6040 codec" 99 tristate "SoC Audio support for OMAP boards using ABE and twl6040 codec"
100 depends on TWL4030_CORE && SND_OMAP_SOC && ARCH_OMAP4 100 depends on TWL6040_CORE && SND_OMAP_SOC && ARCH_OMAP4
101 select SND_OMAP_SOC_DMIC 101 select SND_OMAP_SOC_DMIC
102 select SND_OMAP_SOC_MCPDM 102 select SND_OMAP_SOC_MCPDM
103 select SND_SOC_TWL6040 103 select SND_SOC_TWL6040
diff --git a/tools/perf/.gitignore b/tools/perf/.gitignore
index 416684be0ad3..26b823b61aa1 100644
--- a/tools/perf/.gitignore
+++ b/tools/perf/.gitignore
@@ -19,3 +19,5 @@ TAGS
19cscope* 19cscope*
20config.mak 20config.mak
21config.mak.autogen 21config.mak.autogen
22*-bison.*
23*-flex.*
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 820371f10d1b..03059e75665a 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -237,21 +237,20 @@ export PERL_PATH
237FLEX = $(CROSS_COMPILE)flex 237FLEX = $(CROSS_COMPILE)flex
238BISON= $(CROSS_COMPILE)bison 238BISON= $(CROSS_COMPILE)bison
239 239
240event-parser: 240$(OUTPUT)util/parse-events-flex.c: util/parse-events.l
241 $(QUIET_BISON)$(BISON) -v util/parse-events.y -d -o $(OUTPUT)util/parse-events-bison.c
242 $(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/parse-events-flex.h -t util/parse-events.l > $(OUTPUT)util/parse-events-flex.c 241 $(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/parse-events-flex.h -t util/parse-events.l > $(OUTPUT)util/parse-events-flex.c
243 242
244$(OUTPUT)util/parse-events-flex.c: event-parser 243$(OUTPUT)util/parse-events-bison.c: util/parse-events.y
245$(OUTPUT)util/parse-events-bison.c: event-parser 244 $(QUIET_BISON)$(BISON) -v util/parse-events.y -d -o $(OUTPUT)util/parse-events-bison.c
246 245
247pmu-parser: 246$(OUTPUT)util/pmu-flex.c: util/pmu.l
248 $(QUIET_BISON)$(BISON) -v util/pmu.y -d -o $(OUTPUT)util/pmu-bison.c
249 $(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/pmu-flex.h -t util/pmu.l > $(OUTPUT)util/pmu-flex.c 247 $(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/pmu-flex.h -t util/pmu.l > $(OUTPUT)util/pmu-flex.c
250 248
251$(OUTPUT)util/pmu-flex.c: pmu-parser 249$(OUTPUT)util/pmu-bison.c: util/pmu.y
252$(OUTPUT)util/pmu-bison.c: pmu-parser 250 $(QUIET_BISON)$(BISON) -v util/pmu.y -d -o $(OUTPUT)util/pmu-bison.c
253 251
254$(OUTPUT)util/parse-events.o: event-parser pmu-parser 252$(OUTPUT)util/parse-events.o: $(OUTPUT)util/parse-events-flex.c $(OUTPUT)util/parse-events-bison.c
253$(OUTPUT)util/pmu.o: $(OUTPUT)util/pmu-flex.c $(OUTPUT)util/pmu-bison.c
255 254
256LIB_FILE=$(OUTPUT)libperf.a 255LIB_FILE=$(OUTPUT)libperf.a
257 256
@@ -527,7 +526,7 @@ else
527endif 526endif
528 527
529ifdef NO_GTK2 528ifdef NO_GTK2
530 BASIC_CFLAGS += -DNO_GTK2 529 BASIC_CFLAGS += -DNO_GTK2_SUPPORT
531else 530else
532 FLAGS_GTK2=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(shell pkg-config --libs --cflags gtk+-2.0) 531 FLAGS_GTK2=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(shell pkg-config --libs --cflags gtk+-2.0)
533 ifneq ($(call try-cc,$(SOURCE_GTK2),$(FLAGS_GTK2)),y) 532 ifneq ($(call try-cc,$(SOURCE_GTK2),$(FLAGS_GTK2)),y)
@@ -852,8 +851,6 @@ help:
852 @echo ' html - make html documentation' 851 @echo ' html - make html documentation'
853 @echo ' info - make GNU info documentation (access with info <foo>)' 852 @echo ' info - make GNU info documentation (access with info <foo>)'
854 @echo ' pdf - make pdf documentation' 853 @echo ' pdf - make pdf documentation'
855 @echo ' event-parser - make event parser code'
856 @echo ' pmu-parser - make pmu format parser code'
857 @echo ' TAGS - use etags to make tag information for source browsing' 854 @echo ' TAGS - use etags to make tag information for source browsing'
858 @echo ' tags - use ctags to make tag information for source browsing' 855 @echo ' tags - use ctags to make tag information for source browsing'
859 @echo ' cscope - use cscope to make interactive browsing database' 856 @echo ' cscope - use cscope to make interactive browsing database'
diff --git a/tools/perf/perf-archive.sh b/tools/perf/perf-archive.sh
index 677e59d62a8d..95b6f8b6177a 100644
--- a/tools/perf/perf-archive.sh
+++ b/tools/perf/perf-archive.sh
@@ -29,13 +29,14 @@ if [ ! -s $BUILDIDS ] ; then
29fi 29fi
30 30
31MANIFEST=$(mktemp /tmp/perf-archive-manifest.XXXXXX) 31MANIFEST=$(mktemp /tmp/perf-archive-manifest.XXXXXX)
32PERF_BUILDID_LINKDIR=$(readlink -f $PERF_BUILDID_DIR)/
32 33
33cut -d ' ' -f 1 $BUILDIDS | \ 34cut -d ' ' -f 1 $BUILDIDS | \
34while read build_id ; do 35while read build_id ; do
35 linkname=$PERF_BUILDID_DIR.build-id/${build_id:0:2}/${build_id:2} 36 linkname=$PERF_BUILDID_DIR.build-id/${build_id:0:2}/${build_id:2}
36 filename=$(readlink -f $linkname) 37 filename=$(readlink -f $linkname)
37 echo ${linkname#$PERF_BUILDID_DIR} >> $MANIFEST 38 echo ${linkname#$PERF_BUILDID_DIR} >> $MANIFEST
38 echo ${filename#$PERF_BUILDID_DIR} >> $MANIFEST 39 echo ${filename#$PERF_BUILDID_LINKDIR} >> $MANIFEST
39done 40done
40 41
41tar cfj $PERF_DATA.tar.bz2 -C $PERF_BUILDID_DIR -T $MANIFEST 42tar cfj $PERF_DATA.tar.bz2 -C $PERF_BUILDID_DIR -T $MANIFEST
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 00923cda4d9c..1efd3bee6336 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -876,11 +876,11 @@ static int perf_session_deliver_event(struct perf_session *session,
876 dump_sample(session, event, sample); 876 dump_sample(session, event, sample);
877 if (evsel == NULL) { 877 if (evsel == NULL) {
878 ++session->hists.stats.nr_unknown_id; 878 ++session->hists.stats.nr_unknown_id;
879 return -1; 879 return 0;
880 } 880 }
881 if (machine == NULL) { 881 if (machine == NULL) {
882 ++session->hists.stats.nr_unprocessable_samples; 882 ++session->hists.stats.nr_unprocessable_samples;
883 return -1; 883 return 0;
884 } 884 }
885 return tool->sample(tool, event, sample, evsel, machine); 885 return tool->sample(tool, event, sample, evsel, machine);
886 case PERF_RECORD_MMAP: 886 case PERF_RECORD_MMAP:
diff --git a/virt/kvm/iommu.c b/virt/kvm/iommu.c
index a457d2138f49..e9fff9830bf0 100644
--- a/virt/kvm/iommu.c
+++ b/virt/kvm/iommu.c
@@ -240,9 +240,13 @@ int kvm_iommu_map_guest(struct kvm *kvm)
240 return -ENODEV; 240 return -ENODEV;
241 } 241 }
242 242
243 mutex_lock(&kvm->slots_lock);
244
243 kvm->arch.iommu_domain = iommu_domain_alloc(&pci_bus_type); 245 kvm->arch.iommu_domain = iommu_domain_alloc(&pci_bus_type);
244 if (!kvm->arch.iommu_domain) 246 if (!kvm->arch.iommu_domain) {
245 return -ENOMEM; 247 r = -ENOMEM;
248 goto out_unlock;
249 }
246 250
247 if (!allow_unsafe_assigned_interrupts && 251 if (!allow_unsafe_assigned_interrupts &&
248 !iommu_domain_has_cap(kvm->arch.iommu_domain, 252 !iommu_domain_has_cap(kvm->arch.iommu_domain,
@@ -253,17 +257,16 @@ int kvm_iommu_map_guest(struct kvm *kvm)
253 " module option.\n", __func__); 257 " module option.\n", __func__);
254 iommu_domain_free(kvm->arch.iommu_domain); 258 iommu_domain_free(kvm->arch.iommu_domain);
255 kvm->arch.iommu_domain = NULL; 259 kvm->arch.iommu_domain = NULL;
256 return -EPERM; 260 r = -EPERM;
261 goto out_unlock;
257 } 262 }
258 263
259 r = kvm_iommu_map_memslots(kvm); 264 r = kvm_iommu_map_memslots(kvm);
260 if (r) 265 if (r)
261 goto out_unmap; 266 kvm_iommu_unmap_memslots(kvm);
262
263 return 0;
264 267
265out_unmap: 268out_unlock:
266 kvm_iommu_unmap_memslots(kvm); 269 mutex_unlock(&kvm->slots_lock);
267 return r; 270 return r;
268} 271}
269 272
@@ -310,6 +313,11 @@ static void kvm_iommu_put_pages(struct kvm *kvm,
310 } 313 }
311} 314}
312 315
316void kvm_iommu_unmap_pages(struct kvm *kvm, struct kvm_memory_slot *slot)
317{
318 kvm_iommu_put_pages(kvm, slot->base_gfn, slot->npages);
319}
320
313static int kvm_iommu_unmap_memslots(struct kvm *kvm) 321static int kvm_iommu_unmap_memslots(struct kvm *kvm)
314{ 322{
315 int idx; 323 int idx;
@@ -320,7 +328,7 @@ static int kvm_iommu_unmap_memslots(struct kvm *kvm)
320 slots = kvm_memslots(kvm); 328 slots = kvm_memslots(kvm);
321 329
322 kvm_for_each_memslot(memslot, slots) 330 kvm_for_each_memslot(memslot, slots)
323 kvm_iommu_put_pages(kvm, memslot->base_gfn, memslot->npages); 331 kvm_iommu_unmap_pages(kvm, memslot);
324 332
325 srcu_read_unlock(&kvm->srcu, idx); 333 srcu_read_unlock(&kvm->srcu, idx);
326 334
@@ -335,7 +343,11 @@ int kvm_iommu_unmap_guest(struct kvm *kvm)
335 if (!domain) 343 if (!domain)
336 return 0; 344 return 0;
337 345
346 mutex_lock(&kvm->slots_lock);
338 kvm_iommu_unmap_memslots(kvm); 347 kvm_iommu_unmap_memslots(kvm);
348 kvm->arch.iommu_domain = NULL;
349 mutex_unlock(&kvm->slots_lock);
350
339 iommu_domain_free(domain); 351 iommu_domain_free(domain);
340 return 0; 352 return 0;
341} 353}
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 42b73930a6de..9739b533ca2e 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -808,12 +808,13 @@ int __kvm_set_memory_region(struct kvm *kvm,
808 if (r) 808 if (r)
809 goto out_free; 809 goto out_free;
810 810
811 /* map the pages in iommu page table */ 811 /* map/unmap the pages in iommu page table */
812 if (npages) { 812 if (npages) {
813 r = kvm_iommu_map_pages(kvm, &new); 813 r = kvm_iommu_map_pages(kvm, &new);
814 if (r) 814 if (r)
815 goto out_free; 815 goto out_free;
816 } 816 } else
817 kvm_iommu_unmap_pages(kvm, &old);
817 818
818 r = -ENOMEM; 819 r = -ENOMEM;
819 slots = kmemdup(kvm->memslots, sizeof(struct kvm_memslots), 820 slots = kmemdup(kvm->memslots, sizeof(struct kvm_memslots),