From baab6587a50fbc75c7b593110db50796166d9648 Mon Sep 17 00:00:00 2001 From: zador-blood-stained Date: Fri, 9 Dec 2016 21:09:15 +0300 Subject: [PATCH] Refactor Marvell kernel sources Rename LINUXFAMILY: marvell to mvebu Replace default kernel with 4.4.x branch from dev configuration --- config/boards/clearfogbase.conf | 4 +- config/boards/clearfogpro.conf | 4 +- config/kernel/linux-marvell-default.config | 3944 ----- ...-dev.config => linux-mvebu-default.config} | 0 ...ll-next.config => linux-mvebu-next.config} | 0 config/sources/{marvell.conf => mvebu.conf} | 12 +- .../0-overlayfs.v18-3.10-rc7.patch | 3283 ----- .../marvell-default/1-patch-3.10.70-71.patch | 1503 -- .../marvell-default/1-patch-3.10.71-72.patch | 2207 --- .../marvell-default/1-patch-3.10.72-73.patch | 1772 --- .../marvell-default/1-patch-3.10.73-74.patch | 599 - .../marvell-default/1-patch-3.10.74-75.patch | 748 - .../marvell-default/1-patch-3.10.75-76.patch | 2030 --- .../marvell-default/1-patch-3.10.76-77.patch | 1848 --- .../marvell-default/1-patch-3.10.77-78.patch | 1032 -- .../marvell-default/1-patch-3.10.78-79.patch | 728 - .../marvell-default/1-patch-3.10.79-80.patch | 1148 -- .../marvell-default/1-patch-3.10.80-81.patch | 698 - .../marvell-default/1-patch-3.10.81-82.patch | 263 - .../marvell-default/1-patch-3.10.82-83.patch | 1627 --- .../1-patch-3.10.82-83.patch.original | 1734 --- .../marvell-default/1-patch-3.10.83-84.patch | 369 - .../marvell-default/1-patch-3.10.84-85.patch | 2832 ---- .../1-patch-3.10.84-85.patch.original | 2941 ---- .../marvell-default/1-patch-3.10.85-86.patch | 578 - .../1-patch-3.10.85-86.patch.original | 579 - .../marvell-default/1-patch-3.10.86-87.patch | 1317 -- .../marvell-default/1-patch-3.10.87-88.patch | 285 - .../marvell-default/1-patch-3.10.88-89.patch | 661 - .../marvell-default/1-patch-3.10.89-90.patch | 2146 --- .../marvell-default/1-patch-3.10.90-91.patch | 1875 --- .../marvell-default/1-patch-3.10.91-92.patch | 413 - .../marvell-default/1-patch-3.10.92-93.patch | 645 - .../marvell-default/1-patch-3.10.93-94.patch | 724 - .../marvell-default/1-patch-3.10.94-95.patch | 1222 -- .../marvell-default/1-patch-3.10.95-96.patch | 1497 -- .../marvell-default/1-patch-3.10.96-97.patch | 2341 --- .../marvell-default/1-patch-3.10.97-98.patch | 1792 --- .../marvell-default/1-patch-3.10.98-99.patch | 2573 ---- .../marvell-default/1-patch-3.10.99-100.patch | 1156 -- .../2-patch-3.10.100-101.patch | 1493 -- .../2-patch-3.10.101-102.patch | 4381 ------ .../2-patch-3.10.102-103.patch | 6785 --------- .../2-patch-3.10.103-104.patch | 478 - .../marvell-default/3-overlay-fix.patch | 28 - .../403-ath_regd_optional.patch | 58 - .../add-clearfog-base-dts.patch | 190 - .../marvell-default/fbtft_drivers.patch | 12012 ---------------- ....10-DEFAULT-with-postinstall-scripts.patch | 375 - .../marvell-next/bash_to_afterinstall.patch | 11 - ...lock_atheros_regulatory_restrictions.patch | 70 - ...onfig-build-bits-for-BFQ-v7r11-4.4.0.patch | 0 ...ce-the-BFQ-v7r11-I-O-sched-for-4.4.0.patch | 0 ...rly-Queue-Merge-EQM-to-BFQ-v7r11-for.patch | 0 ...dtb-file-for-backwards-compatibility.patch | 0 .../add-spi-flash.patch | 0 .../bash_to_afterinstall.patch | 0 ...ing-4.x-DEV-with-postinstall-scripts.patch | 0 .../patch-4.4.30-31.patch | 0 .../patch-4.4.31-32.patch | 0 .../patch-4.4.32-33.patch | 0 .../patch-4.4.33-34.patch | 0 .../patch-4.4.34-35.patch | 0 .../patch-4.4.35-36.patch | 0 .../patch-4.4.36-37.patch | 0 ...lock_atheros_regulatory_restrictions.patch | 0 ...dicate-failure-to-enter-deeper-sleep.patch | 0 ...-a-hook-for-link-up-link-down-events.patch | 0 ...ell-88E1512-add-flow-control-support.patch | 0 ...export-phy_start_machine-for-phylink.patch | 0 ...-export-phy_speed_to_str-for-phylink.patch | 0 .../0011-phy-add-I2C-mdio-bus.patch | 0 ...2-phylink-add-phylink-infrastructure.patch | 0 ...13-phylink-add-hooks-for-SFP-support.patch | 0 ...add-phylink-based-SFP-module-support.patch | 0 ...5-sfp-display-SFP-module-information.patch | 0 ...ylink-add-ethtool-nway_reset-support.patch | 0 ...020-phylink-add-flow-control-support.patch | 0 .../0023-phylink-add-EEE-support.patch | 0 ...25-phylink-add-module-EEPROM-support.patch | 0 ...sfp-phylink-hook-up-eeprom-functions.patch | 0 ...-add-SFP-module-support-for-Clearfog.patch | 0 ...-dts-Add-Clearfog-A1-rev-2.0-DT-file.patch | 0 .../0040-updates.patch | 0 ...041-implement-slot-capabilities-SSPL.patch | 0 .../0043-sfp-removal-of-defs.patch | 0 ...044-gpio-report-all-gpios-in-debugfs.patch | 0 ...-allow-sub-architectures-to-override.patch | 0 .../0088-add-clearfogbase.patch | 0 .../bash_to_afterinstall.patch | 0 ...hy-MII-register-generation-to-a-libr.patch | 0 ...y-register-generation-to-tabular-for.patch | 0 ...hy-state-validation-from-register-ge.patch | 0 ...-generate-swphy-registers-on-the-fly.patch | 0 ...ty-of-fixed-phy-MII-register-reading.patch | 0 .../0016-net-mvneta-convert-to-phylink.patch | 0 ...ed-phy-remove-fixed_phy_update_state.patch | 0 ...19-net-mvneta-add-nway_reset-support.patch | 0 ...add-flow-control-support-via-phylink.patch | 0 ...ble-flow-control-for-PHY-connections.patch | 0 .../0024-net-mvneta-add-EEE-support.patch | 0 ...ta-add-module-EEPROM-reading-support.patch | 0 ...idRun-Armada-388-Clearfog-A1-DT-file.patch | 0 ...ng-4.x-NEXT-with-postinstall-scripts.patch | 0 ...lock_atheros_regulatory_restrictions.patch | 0 105 files changed, 7 insertions(+), 77004 deletions(-) delete mode 100644 config/kernel/linux-marvell-default.config rename config/kernel/{linux-marvell-dev.config => linux-mvebu-default.config} (100%) rename config/kernel/{linux-marvell-next.config => linux-mvebu-next.config} (100%) rename config/sources/{marvell.conf => mvebu.conf} (87%) delete mode 100644 patch/kernel/marvell-default/0-overlayfs.v18-3.10-rc7.patch delete mode 100644 patch/kernel/marvell-default/1-patch-3.10.70-71.patch delete mode 100644 patch/kernel/marvell-default/1-patch-3.10.71-72.patch delete mode 100644 patch/kernel/marvell-default/1-patch-3.10.72-73.patch delete mode 100644 patch/kernel/marvell-default/1-patch-3.10.73-74.patch delete mode 100644 patch/kernel/marvell-default/1-patch-3.10.74-75.patch delete mode 100644 patch/kernel/marvell-default/1-patch-3.10.75-76.patch delete mode 100644 patch/kernel/marvell-default/1-patch-3.10.76-77.patch delete mode 100644 patch/kernel/marvell-default/1-patch-3.10.77-78.patch delete mode 100644 patch/kernel/marvell-default/1-patch-3.10.78-79.patch delete mode 100644 patch/kernel/marvell-default/1-patch-3.10.79-80.patch delete mode 100644 patch/kernel/marvell-default/1-patch-3.10.80-81.patch delete mode 100644 patch/kernel/marvell-default/1-patch-3.10.81-82.patch delete mode 100644 patch/kernel/marvell-default/1-patch-3.10.82-83.patch delete mode 100644 patch/kernel/marvell-default/1-patch-3.10.82-83.patch.original delete mode 100644 patch/kernel/marvell-default/1-patch-3.10.83-84.patch delete mode 100644 patch/kernel/marvell-default/1-patch-3.10.84-85.patch delete mode 100644 patch/kernel/marvell-default/1-patch-3.10.84-85.patch.original delete mode 100644 patch/kernel/marvell-default/1-patch-3.10.85-86.patch delete mode 100644 patch/kernel/marvell-default/1-patch-3.10.85-86.patch.original delete mode 100644 patch/kernel/marvell-default/1-patch-3.10.86-87.patch delete mode 100644 patch/kernel/marvell-default/1-patch-3.10.87-88.patch delete mode 100644 patch/kernel/marvell-default/1-patch-3.10.88-89.patch delete mode 100644 patch/kernel/marvell-default/1-patch-3.10.89-90.patch delete mode 100644 patch/kernel/marvell-default/1-patch-3.10.90-91.patch delete mode 100644 patch/kernel/marvell-default/1-patch-3.10.91-92.patch delete mode 100644 patch/kernel/marvell-default/1-patch-3.10.92-93.patch delete mode 100644 patch/kernel/marvell-default/1-patch-3.10.93-94.patch delete mode 100644 patch/kernel/marvell-default/1-patch-3.10.94-95.patch delete mode 100644 patch/kernel/marvell-default/1-patch-3.10.95-96.patch delete mode 100644 patch/kernel/marvell-default/1-patch-3.10.96-97.patch delete mode 100644 patch/kernel/marvell-default/1-patch-3.10.97-98.patch delete mode 100644 patch/kernel/marvell-default/1-patch-3.10.98-99.patch delete mode 100644 patch/kernel/marvell-default/1-patch-3.10.99-100.patch delete mode 100644 patch/kernel/marvell-default/2-patch-3.10.100-101.patch delete mode 100644 patch/kernel/marvell-default/2-patch-3.10.101-102.patch delete mode 100644 patch/kernel/marvell-default/2-patch-3.10.102-103.patch delete mode 100644 patch/kernel/marvell-default/2-patch-3.10.103-104.patch delete mode 100644 patch/kernel/marvell-default/3-overlay-fix.patch delete mode 100644 patch/kernel/marvell-default/403-ath_regd_optional.patch delete mode 100644 patch/kernel/marvell-default/add-clearfog-base-dts.patch delete mode 100644 patch/kernel/marvell-default/fbtft_drivers.patch delete mode 100644 patch/kernel/marvell-default/packaging-3.10-DEFAULT-with-postinstall-scripts.patch delete mode 100644 patch/kernel/marvell-next/bash_to_afterinstall.patch delete mode 100644 patch/kernel/marvell-next/unlock_atheros_regulatory_restrictions.patch rename patch/kernel/{marvell-dev => mvebu-default}/0001-block-cgroups-kconfig-build-bits-for-BFQ-v7r11-4.4.0.patch (100%) rename patch/kernel/{marvell-dev => mvebu-default}/0002-block-introduce-the-BFQ-v7r11-I-O-sched-for-4.4.0.patch (100%) rename patch/kernel/{marvell-dev => mvebu-default}/0003-block-bfq-add-Early-Queue-Merge-EQM-to-BFQ-v7r11-for.patch (100%) rename patch/kernel/{marvell-dev => mvebu-default}/add-dtb-file-for-backwards-compatibility.patch (100%) rename patch/kernel/{marvell-dev => mvebu-default}/add-spi-flash.patch (100%) rename patch/kernel/{marvell-default => mvebu-default}/bash_to_afterinstall.patch (100%) rename patch/kernel/{marvell-dev => mvebu-default}/packaging-4.x-DEV-with-postinstall-scripts.patch (100%) rename patch/kernel/{marvell-dev => mvebu-default}/patch-4.4.30-31.patch (100%) rename patch/kernel/{marvell-dev => mvebu-default}/patch-4.4.31-32.patch (100%) rename patch/kernel/{marvell-dev => mvebu-default}/patch-4.4.32-33.patch (100%) rename patch/kernel/{marvell-dev => mvebu-default}/patch-4.4.33-34.patch (100%) rename patch/kernel/{marvell-dev => mvebu-default}/patch-4.4.34-35.patch (100%) rename patch/kernel/{marvell-dev => mvebu-default}/patch-4.4.35-36.patch (100%) rename patch/kernel/{marvell-dev => mvebu-default}/patch-4.4.36-37.patch (100%) rename patch/kernel/{marvell-default => mvebu-default}/unlock_atheros_regulatory_restrictions.patch (100%) rename patch/kernel/{marvell-next => mvebu-next}/0001-cpuidle-mvebu-indicate-failure-to-enter-deeper-sleep.patch (100%) rename patch/kernel/{marvell-next => mvebu-next}/0007-phy-provide-a-hook-for-link-up-link-down-events.patch (100%) rename patch/kernel/{marvell-next => mvebu-next}/0008-phy-marvell-88E1512-add-flow-control-support.patch (100%) rename patch/kernel/{marvell-next => mvebu-next}/0009-phy-export-phy_start_machine-for-phylink.patch (100%) rename patch/kernel/{marvell-next => mvebu-next}/0010-phy-export-phy_speed_to_str-for-phylink.patch (100%) rename patch/kernel/{marvell-next => mvebu-next}/0011-phy-add-I2C-mdio-bus.patch (100%) rename patch/kernel/{marvell-next => mvebu-next}/0012-phylink-add-phylink-infrastructure.patch (100%) rename patch/kernel/{marvell-next => mvebu-next}/0013-phylink-add-hooks-for-SFP-support.patch (100%) rename patch/kernel/{marvell-next => mvebu-next}/0014-sfp-add-phylink-based-SFP-module-support.patch (100%) rename patch/kernel/{marvell-next => mvebu-next}/0015-sfp-display-SFP-module-information.patch (100%) rename patch/kernel/{marvell-next => mvebu-next}/0018-phylink-add-ethtool-nway_reset-support.patch (100%) rename patch/kernel/{marvell-next => mvebu-next}/0020-phylink-add-flow-control-support.patch (100%) rename patch/kernel/{marvell-next => mvebu-next}/0023-phylink-add-EEE-support.patch (100%) rename patch/kernel/{marvell-next => mvebu-next}/0025-phylink-add-module-EEPROM-support.patch (100%) rename patch/kernel/{marvell-next => mvebu-next}/0027-sfp-phylink-hook-up-eeprom-functions.patch (100%) rename patch/kernel/{marvell-next => mvebu-next}/0029-ARM-dts-add-SFP-module-support-for-Clearfog.patch (100%) rename patch/kernel/{marvell-next => mvebu-next}/0030-ARM-dts-Add-Clearfog-A1-rev-2.0-DT-file.patch (100%) rename patch/kernel/{marvell-next => mvebu-next}/0040-updates.patch (100%) rename patch/kernel/{marvell-next => mvebu-next}/0041-implement-slot-capabilities-SSPL.patch (100%) rename patch/kernel/{marvell-next => mvebu-next}/0043-sfp-removal-of-defs.patch (100%) rename patch/kernel/{marvell-next => mvebu-next}/0044-gpio-report-all-gpios-in-debugfs.patch (100%) rename patch/kernel/{marvell-next => mvebu-next}/0053-ARM-8060-mm-allow-sub-architectures-to-override.patch (100%) rename patch/kernel/{marvell-next => mvebu-next}/0088-add-clearfogbase.patch (100%) rename patch/kernel/{marvell-dev => mvebu-next}/bash_to_afterinstall.patch (100%) rename patch/kernel/{marvell-next => mvebu-next}/deprecated/0002-phy-move-fixed_phy-MII-register-generation-to-a-libr.patch (100%) rename patch/kernel/{marvell-next => mvebu-next}/deprecated/0003-phy-convert-swphy-register-generation-to-tabular-for.patch (100%) rename patch/kernel/{marvell-next => mvebu-next}/deprecated/0004-phy-separate-swphy-state-validation-from-register-ge.patch (100%) rename patch/kernel/{marvell-next => mvebu-next}/deprecated/0005-phy-generate-swphy-registers-on-the-fly.patch (100%) rename patch/kernel/{marvell-next => mvebu-next}/deprecated/0006-phy-improve-safety-of-fixed-phy-MII-register-reading.patch (100%) rename patch/kernel/{marvell-next => mvebu-next}/deprecated/0016-net-mvneta-convert-to-phylink.patch (100%) rename patch/kernel/{marvell-next => mvebu-next}/deprecated/0017-phy-fixed-phy-remove-fixed_phy_update_state.patch (100%) rename patch/kernel/{marvell-next => mvebu-next}/deprecated/0019-net-mvneta-add-nway_reset-support.patch (100%) rename patch/kernel/{marvell-next => mvebu-next}/deprecated/0021-net-mvneta-add-flow-control-support-via-phylink.patch (100%) rename patch/kernel/{marvell-next => mvebu-next}/deprecated/0022-net-mvneta-enable-flow-control-for-PHY-connections.patch (100%) rename patch/kernel/{marvell-next => mvebu-next}/deprecated/0024-net-mvneta-add-EEE-support.patch (100%) rename patch/kernel/{marvell-next => mvebu-next}/deprecated/0026-net-mvneta-add-module-EEPROM-reading-support.patch (100%) rename patch/kernel/{marvell-next => mvebu-next}/deprecated/0028-ARM-dts-Add-SolidRun-Armada-388-Clearfog-A1-DT-file.patch (100%) rename patch/kernel/{marvell-next => mvebu-next}/packaging-4.x-NEXT-with-postinstall-scripts.patch (100%) rename patch/kernel/{marvell-dev => mvebu-next}/unlock_atheros_regulatory_restrictions.patch (100%) diff --git a/config/boards/clearfogbase.conf b/config/boards/clearfogbase.conf index 5a7a15dc52..b26a27c0af 100644 --- a/config/boards/clearfogbase.conf +++ b/config/boards/clearfogbase.conf @@ -1,12 +1,12 @@ # Marvell Armada 38x 1x mPCIe M.2 2xGBE SFP BOARD_NAME="Clearfog Base" -LINUXFAMILY="marvell" +LINUXFAMILY="mvebu" BOOTCONFIG="armada_38x_clearfog_config" MODULES="" MODULES_NEXT="mv_cesa" MODULES_DEV="mv_cesa" CLI_TARGET="jessie,xenial:default,next" -KERNEL_TARGET="default,next,dev" +KERNEL_TARGET="default,next" # BOARDRATING="" CHIP="http://docs.armbian.com/Hardware_Other/#marvel-armada-clearfog" diff --git a/config/boards/clearfogpro.conf b/config/boards/clearfogpro.conf index 91ad6bc897..8b2838d590 100644 --- a/config/boards/clearfogpro.conf +++ b/config/boards/clearfogpro.conf @@ -1,12 +1,12 @@ # Marvell Armada 38x 2x mPCIe M.2 BBE Switch SFP BOARD_NAME="Clearfog Pro" -LINUXFAMILY="marvell" +LINUXFAMILY="mvebu" BOOTCONFIG="armada_38x_clearfog_config" MODULES="" MODULES_NEXT="#mv88e6xxx_drv mv_cesa" MODULES_DEV="mv_cesa" CLI_TARGET="jessie,xenial:default,next" -KERNEL_TARGET="default,next,dev" +KERNEL_TARGET="default,next" # BOARDRATING="" CHIP="http://docs.armbian.com/Hardware_Other/#marvel-armada-clearfog" diff --git a/config/kernel/linux-marvell-default.config b/config/kernel/linux-marvell-default.config deleted file mode 100644 index 3e318562e6..0000000000 --- a/config/kernel/linux-marvell-default.config +++ /dev/null @@ -1,3944 +0,0 @@ -# -# Automatically generated file; DO NOT EDIT. -# Linux/arm 3.10.104 Kernel Configuration -# -CONFIG_ARM=y -CONFIG_MIGHT_HAVE_PCI=y -CONFIG_SYS_SUPPORTS_APM_EMULATION=y -CONFIG_HAVE_PROC_CPU=y -CONFIG_STACKTRACE_SUPPORT=y -CONFIG_LOCKDEP_SUPPORT=y -CONFIG_TRACE_IRQFLAGS_SUPPORT=y -CONFIG_RWSEM_GENERIC_SPINLOCK=y -CONFIG_GENERIC_HWEIGHT=y -CONFIG_GENERIC_CALIBRATE_DELAY=y -CONFIG_NEED_DMA_MAP_STATE=y -CONFIG_VECTORS_BASE=0xffff0000 -CONFIG_ARM_PATCH_PHYS_VIRT=y -CONFIG_GENERIC_BUG=y -CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" -CONFIG_IRQ_WORK=y -CONFIG_BUILDTIME_EXTABLE_SORT=y - -# -# General setup -# -CONFIG_INIT_ENV_ARG_LIMIT=32 -CONFIG_CROSS_COMPILE="" -CONFIG_LOCALVERSION="" -# CONFIG_LOCALVERSION_AUTO is not set -CONFIG_HAVE_KERNEL_GZIP=y -CONFIG_HAVE_KERNEL_LZMA=y -CONFIG_HAVE_KERNEL_XZ=y -CONFIG_HAVE_KERNEL_LZO=y -CONFIG_KERNEL_GZIP=y -# CONFIG_KERNEL_LZMA is not set -# CONFIG_KERNEL_XZ is not set -# CONFIG_KERNEL_LZO is not set -CONFIG_DEFAULT_HOSTNAME="(none)" -CONFIG_SWAP=y -CONFIG_SYSVIPC=y -CONFIG_SYSVIPC_SYSCTL=y -CONFIG_POSIX_MQUEUE=y -CONFIG_POSIX_MQUEUE_SYSCTL=y -CONFIG_FHANDLE=y -# CONFIG_AUDIT is not set -CONFIG_HAVE_GENERIC_HARDIRQS=y - -# -# IRQ subsystem -# -CONFIG_GENERIC_HARDIRQS=y -CONFIG_GENERIC_IRQ_PROBE=y -CONFIG_GENERIC_IRQ_SHOW=y -CONFIG_HARDIRQS_SW_RESEND=y -CONFIG_GENERIC_IRQ_CHIP=y -CONFIG_IRQ_DOMAIN=y -CONFIG_IRQ_DOMAIN_DEBUG=y -CONFIG_SPARSE_IRQ=y -CONFIG_KTIME_SCALAR=y -CONFIG_GENERIC_CLOCKEVENTS=y -CONFIG_GENERIC_CLOCKEVENTS_BUILD=y -CONFIG_ARCH_HAS_TICK_BROADCAST=y -CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y - -# -# Timers subsystem -# -CONFIG_TICK_ONESHOT=y -CONFIG_HZ_PERIODIC=y -# CONFIG_NO_HZ_IDLE is not set -# CONFIG_NO_HZ is not set -CONFIG_HIGH_RES_TIMERS=y - -# -# CPU/Task time and stats accounting -# -CONFIG_TICK_CPU_ACCOUNTING=y -# CONFIG_IRQ_TIME_ACCOUNTING is not set -# CONFIG_BSD_PROCESS_ACCT is not set -# CONFIG_TASKSTATS is not set - -# -# RCU Subsystem -# -CONFIG_TREE_RCU=y -# CONFIG_PREEMPT_RCU is not set -CONFIG_RCU_STALL_COMMON=y -# CONFIG_RCU_USER_QS is not set -CONFIG_RCU_FANOUT=32 -CONFIG_RCU_FANOUT_LEAF=16 -# CONFIG_RCU_FANOUT_EXACT is not set -# CONFIG_TREE_RCU_TRACE is not set -# CONFIG_RCU_NOCB_CPU is not set -CONFIG_IKCONFIG=y -CONFIG_IKCONFIG_PROC=y -CONFIG_LOG_BUF_SHIFT=16 -CONFIG_CGROUPS=y -# CONFIG_CGROUP_DEBUG is not set -CONFIG_CGROUP_FREEZER=y -CONFIG_CGROUP_DEVICE=y -CONFIG_CPUSETS=y -CONFIG_PROC_PID_CPUSET=y -CONFIG_CGROUP_CPUACCT=y -CONFIG_RESOURCE_COUNTERS=y -CONFIG_MEMCG=y -CONFIG_MEMCG_SWAP=y -CONFIG_MEMCG_SWAP_ENABLED=y -CONFIG_MEMCG_KMEM=y -CONFIG_CGROUP_PERF=y -CONFIG_CGROUP_SCHED=y -CONFIG_FAIR_GROUP_SCHED=y -CONFIG_CFS_BANDWIDTH=y -CONFIG_RT_GROUP_SCHED=y -CONFIG_BLK_CGROUP=y -# CONFIG_DEBUG_BLK_CGROUP is not set -# CONFIG_CHECKPOINT_RESTORE is not set -CONFIG_NAMESPACES=y -CONFIG_UTS_NS=y -CONFIG_IPC_NS=y -CONFIG_USER_NS=y -CONFIG_PID_NS=y -CONFIG_NET_NS=y -CONFIG_UIDGID_CONVERTED=y -CONFIG_UIDGID_STRICT_TYPE_CHECKS=y -# CONFIG_SCHED_AUTOGROUP is not set -CONFIG_MM_OWNER=y -# CONFIG_SYSFS_DEPRECATED is not set -# CONFIG_RELAY is not set -CONFIG_BLK_DEV_INITRD=y -CONFIG_INITRAMFS_SOURCE="" -CONFIG_RD_GZIP=y -# CONFIG_RD_BZIP2 is not set -# CONFIG_RD_LZMA is not set -# CONFIG_RD_XZ is not set -# CONFIG_RD_LZO is not set -# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set -CONFIG_SYSCTL=y -CONFIG_ANON_INODES=y -CONFIG_HAVE_UID16=y -CONFIG_HOTPLUG=y -CONFIG_EXPERT=y -CONFIG_UID16=y -# CONFIG_SYSCTL_SYSCALL is not set -CONFIG_KALLSYMS=y -# CONFIG_KALLSYMS_ALL is not set -CONFIG_PRINTK=y -CONFIG_BUG=y -CONFIG_ELF_CORE=y -CONFIG_BASE_FULL=y -CONFIG_FUTEX=y -CONFIG_EPOLL=y -CONFIG_SIGNALFD=y -CONFIG_TIMERFD=y -CONFIG_EVENTFD=y -CONFIG_SHMEM=y -CONFIG_AIO=y -CONFIG_PCI_QUIRKS=y -# CONFIG_EMBEDDED is not set -CONFIG_HAVE_PERF_EVENTS=y -CONFIG_PERF_USE_VMALLOC=y - -# -# Kernel Performance Events And Counters -# -CONFIG_PERF_EVENTS=y -# CONFIG_DEBUG_PERF_USE_VMALLOC is not set -CONFIG_VM_EVENT_COUNTERS=y -CONFIG_COMPAT_BRK=y -CONFIG_SLAB=y -# CONFIG_SLUB is not set -# CONFIG_SLOB is not set -# CONFIG_PROFILING is not set -CONFIG_HAVE_OPROFILE=y -# CONFIG_KPROBES is not set -# CONFIG_JUMP_LABEL is not set -# CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set -CONFIG_HAVE_KPROBES=y -CONFIG_HAVE_KRETPROBES=y -CONFIG_HAVE_ARCH_TRACEHOOK=y -CONFIG_HAVE_DMA_ATTRS=y -CONFIG_HAVE_DMA_CONTIGUOUS=y -CONFIG_USE_GENERIC_SMP_HELPERS=y -CONFIG_GENERIC_SMP_IDLE_THREAD=y -CONFIG_GENERIC_IDLE_POLL_SETUP=y -CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y -CONFIG_HAVE_CLK=y -CONFIG_HAVE_DMA_API_DEBUG=y -CONFIG_HAVE_HW_BREAKPOINT=y -CONFIG_HAVE_ARCH_JUMP_LABEL=y -CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y -CONFIG_HAVE_ARCH_SECCOMP_FILTER=y -CONFIG_SECCOMP_FILTER=y -CONFIG_HAVE_CONTEXT_TRACKING=y -CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y -CONFIG_HAVE_MOD_ARCH_SPECIFIC=y -CONFIG_MODULES_USE_ELF_REL=y -CONFIG_CLONE_BACKWARDS=y -CONFIG_OLD_SIGSUSPEND3=y -CONFIG_OLD_SIGACTION=y - -# -# GCOV-based kernel profiling -# -# CONFIG_GCOV_KERNEL is not set -CONFIG_HAVE_GENERIC_DMA_COHERENT=y -CONFIG_SLABINFO=y -CONFIG_RT_MUTEXES=y -CONFIG_BASE_SMALL=0 -CONFIG_MODULES=y -# CONFIG_MODULE_FORCE_LOAD is not set -CONFIG_MODULE_UNLOAD=y -# CONFIG_MODULE_FORCE_UNLOAD is not set -# CONFIG_MODVERSIONS is not set -# CONFIG_MODULE_SRCVERSION_ALL is not set -# CONFIG_MODULE_SIG is not set -CONFIG_STOP_MACHINE=y -CONFIG_BLOCK=y -CONFIG_LBDAF=y -CONFIG_BLK_DEV_BSG=y -# CONFIG_BLK_DEV_BSGLIB is not set -# CONFIG_BLK_DEV_INTEGRITY is not set -CONFIG_BLK_DEV_THROTTLING=y - -# -# Partition Types -# -# CONFIG_PARTITION_ADVANCED is not set -CONFIG_MSDOS_PARTITION=y -CONFIG_EFI_PARTITION=y - -# -# IO Schedulers -# -CONFIG_IOSCHED_NOOP=y -CONFIG_IOSCHED_DEADLINE=y -CONFIG_IOSCHED_CFQ=y -# CONFIG_CFQ_GROUP_IOSCHED is not set -# CONFIG_DEFAULT_DEADLINE is not set -CONFIG_DEFAULT_CFQ=y -# CONFIG_DEFAULT_NOOP is not set -CONFIG_DEFAULT_IOSCHED="cfq" -CONFIG_PADATA=y -CONFIG_INLINE_SPIN_UNLOCK_IRQ=y -CONFIG_INLINE_READ_UNLOCK=y -CONFIG_INLINE_READ_UNLOCK_IRQ=y -CONFIG_INLINE_WRITE_UNLOCK=y -CONFIG_INLINE_WRITE_UNLOCK_IRQ=y -CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y -CONFIG_MUTEX_SPIN_ON_OWNER=y -CONFIG_FREEZER=y - -# -# System Type -# -CONFIG_MMU=y -CONFIG_ARCH_MULTIPLATFORM=y -# CONFIG_ARCH_INTEGRATOR is not set -# CONFIG_ARCH_REALVIEW is not set -# CONFIG_ARCH_VERSATILE is not set -# CONFIG_ARCH_AT91 is not set -# CONFIG_ARCH_CLPS711X is not set -# CONFIG_ARCH_GEMINI is not set -# CONFIG_ARCH_EBSA110 is not set -# CONFIG_ARCH_EP93XX is not set -# CONFIG_ARCH_FOOTBRIDGE is not set -# CONFIG_ARCH_NETX is not set -# CONFIG_ARCH_IOP13XX is not set -# CONFIG_ARCH_IOP32X is not set -# CONFIG_ARCH_IOP33X is not set -# CONFIG_ARCH_IXP4XX is not set -# CONFIG_ARCH_DOVE is not set -# CONFIG_ARCH_KIRKWOOD is not set -# CONFIG_ARCH_MV78XX0 is not set -# CONFIG_ARCH_ORION5X is not set -# CONFIG_ARCH_MMP is not set -# CONFIG_ARCH_KS8695 is not set -# CONFIG_ARCH_W90X900 is not set -# CONFIG_ARCH_LPC32XX is not set -# CONFIG_ARCH_PXA is not set -# CONFIG_ARCH_MSM is not set -# CONFIG_ARCH_SHMOBILE is not set -# CONFIG_ARCH_RPC is not set -# CONFIG_ARCH_SA1100 is not set -# CONFIG_ARCH_S3C24XX is not set -# CONFIG_ARCH_S3C64XX is not set -# CONFIG_ARCH_S5P64X0 is not set -# CONFIG_ARCH_S5PC100 is not set -# CONFIG_ARCH_S5PV210 is not set -# CONFIG_ARCH_EXYNOS is not set -# CONFIG_ARCH_SHARK is not set -# CONFIG_ARCH_U300 is not set -# CONFIG_ARCH_DAVINCI is not set -# CONFIG_ARCH_OMAP1 is not set - -# -# Multiple platform selection -# - -# -# CPU Core family selection -# -# CONFIG_ARCH_MULTI_V6 is not set -CONFIG_ARCH_MULTI_V7=y -CONFIG_ARCH_MULTI_V6_V7=y -# CONFIG_ARCH_MULTI_CPU_AUTO is not set -CONFIG_ARCH_MVEBU=y -CONFIG_MVEBU_SOFT_POWEROFF=y - -# -# Marvell SOC with device tree -# -CONFIG_MACH_ARMADA_370_XP=y -CONFIG_MACH_ARMADA_370=y -CONFIG_MACH_ARMADA_375=y -CONFIG_MACH_ARMADA_380=y -CONFIG_MACH_ARMADA_XP=y -# CONFIG_ARCH_BCM is not set -CONFIG_GPIO_PCA953X=y -# CONFIG_KEYBOARD_GPIO_POLLED is not set -# CONFIG_ARCH_HIGHBANK is not set -# CONFIG_ARCH_MXC is not set -# CONFIG_ARCH_OMAP2PLUS is not set -# CONFIG_ARCH_SOCFPGA is not set -# CONFIG_PLAT_SPEAR is not set -# CONFIG_ARCH_SUNXI is not set -# CONFIG_ARCH_SIRF is not set -# CONFIG_ARCH_TEGRA is not set -# CONFIG_ARCH_U8500 is not set -# CONFIG_ARCH_VEXPRESS is not set -# CONFIG_ARCH_VIRT is not set -# CONFIG_ARCH_WM8850 is not set -# CONFIG_ARCH_ZYNQ is not set -CONFIG_PLAT_ORION=y - -# -# Processor Type -# -CONFIG_CPU_PJ4B=y -CONFIG_CPU_V7=y -CONFIG_CPU_32v6K=y -CONFIG_CPU_32v7=y -CONFIG_CPU_ABRT_EV7=y -CONFIG_CPU_PABRT_V7=y -CONFIG_CPU_CACHE_V7=y -CONFIG_CPU_CACHE_VIPT=y -CONFIG_CPU_COPY_V6=y -CONFIG_CPU_TLB_V7=y -CONFIG_CPU_HAS_ASID=y -CONFIG_CPU_CP15=y -CONFIG_CPU_CP15_MMU=y - -# -# Processor Features -# -# CONFIG_ARM_LPAE is not set -# CONFIG_ARCH_PHYS_ADDR_T_64BIT is not set -CONFIG_ARM_THUMB=y -# CONFIG_ARM_THUMBEE is not set -CONFIG_ARM_VIRT_EXT=y -# CONFIG_SWP_EMULATE is not set -# CONFIG_CPU_BIG_ENDIAN is not set -# CONFIG_CPU_ICACHE_DISABLE is not set -# CONFIG_CPU_DCACHE_DISABLE is not set -# CONFIG_CPU_BPREDICT_DISABLE is not set -CONFIG_KUSER_HELPERS=y -CONFIG_OUTER_CACHE=y -CONFIG_OUTER_CACHE_SYNC=y -CONFIG_CPU_DYNAMIC_CLOCK_GATING_ENABLE=y -CONFIG_CPU_L1_CACHE_PREF_ENABLE=y -CONFIG_CACHE_L2X0=y -CONFIG_CACHE_PL310=y -CONFIG_ARM_L1_CACHE_SHIFT_6=y -CONFIG_ARM_L1_CACHE_SHIFT=6 -CONFIG_ARM_DMA_MEM_BUFFERABLE=y -CONFIG_ARCH_SUPPORTS_BIG_ENDIAN=y -CONFIG_ARM_NR_BANKS=8 -CONFIG_MULTI_IRQ_HANDLER=y -CONFIG_PJ4B_ERRATA_4742=y -# CONFIG_ARM_ERRATA_430973 is not set -# CONFIG_PL310_ERRATA_588369 is not set -# CONFIG_ARM_ERRATA_643719 is not set -CONFIG_ARM_ERRATA_720789=y -# CONFIG_PL310_ERRATA_727915 is not set -# CONFIG_PL310_ERRATA_753970 is not set -# CONFIG_ARM_ERRATA_754322 is not set -# CONFIG_ARM_ERRATA_754327 is not set -# CONFIG_ARM_ERRATA_764369 is not set -# CONFIG_PL310_ERRATA_769419 is not set -# CONFIG_ARM_ERRATA_775420 is not set -# CONFIG_ARM_ERRATA_798181 is not set - -# -# Bus support -# -CONFIG_PCI=y -CONFIG_PCI_SYSCALL=y -# CONFIG_PCI_MSI is not set -# CONFIG_PCI_DEBUG is not set -# CONFIG_PCI_REALLOC_ENABLE_AUTO is not set -# CONFIG_PCI_STUB is not set -# CONFIG_PCI_IOV is not set -# CONFIG_PCI_PRI is not set -# CONFIG_PCI_PASID is not set - -# -# PCI host controller drivers -# -CONFIG_PCI_MVEBU=y -# CONFIG_PCCARD is not set - -# -# Kernel Features -# -CONFIG_HAVE_SMP=y -CONFIG_SMP=y -CONFIG_SMP_ON_UP=y -CONFIG_ARM_CPU_TOPOLOGY=y -CONFIG_SCHED_MC=y -# CONFIG_SCHED_SMT is not set -CONFIG_HAVE_ARM_SCU=y -# CONFIG_HAVE_ARM_ARCH_TIMER is not set -CONFIG_HAVE_ARM_TWD=y -# CONFIG_MCPM is not set -CONFIG_VMSPLIT_3G=y -# CONFIG_VMSPLIT_2G is not set -# CONFIG_VMSPLIT_1G is not set -CONFIG_PAGE_OFFSET=0xC0000000 -CONFIG_NR_CPUS=4 -CONFIG_HOTPLUG_CPU=y -# CONFIG_ARM_PSCI is not set -CONFIG_LOCAL_TIMERS=y -CONFIG_ARCH_NR_GPIO=0 -CONFIG_PREEMPT_NONE=y -# CONFIG_PREEMPT_VOLUNTARY is not set -# CONFIG_PREEMPT is not set -CONFIG_HZ=100 -CONFIG_SCHED_HRTICK=y -# CONFIG_THUMB2_KERNEL is not set -CONFIG_AEABI=y -CONFIG_OABI_COMPAT=y -# CONFIG_ARCH_SPARSEMEM_DEFAULT is not set -# CONFIG_ARCH_SELECT_MEMORY_MODEL is not set -CONFIG_HAVE_ARCH_PFN_VALID=y -CONFIG_HIGHMEM=y -# CONFIG_HIGHPTE is not set -CONFIG_HW_PERF_EVENTS=y -CONFIG_FLATMEM=y -CONFIG_FLAT_NODE_MEM_MAP=y -CONFIG_HAVE_MEMBLOCK=y -# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set -CONFIG_PAGEFLAGS_EXTENDED=y -CONFIG_SPLIT_PTLOCK_CPUS=4 -# CONFIG_COMPACTION is not set -# CONFIG_PHYS_ADDR_T_64BIT is not set -CONFIG_ZONE_DMA_FLAG=0 -CONFIG_BOUNCE=y -# CONFIG_KSM is not set -CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 -CONFIG_CROSS_MEMORY_ATTACH=y -# CONFIG_CLEANCACHE is not set -# CONFIG_FRONTSWAP is not set -CONFIG_FORCE_MAX_ZONEORDER=11 -CONFIG_ALIGNMENT_TRAP=y -# CONFIG_UACCESS_WITH_MEMCPY is not set -CONFIG_SECCOMP=y -# CONFIG_CC_STACKPROTECTOR is not set -# CONFIG_XEN is not set - -# -# Boot options -# -CONFIG_USE_OF=y -CONFIG_ATAGS=y -# CONFIG_DEPRECATED_PARAM_STRUCT is not set -CONFIG_ZBOOT_ROM_TEXT=0x0 -CONFIG_ZBOOT_ROM_BSS=0x0 -CONFIG_ARM_APPENDED_DTB=y -CONFIG_ARM_ATAG_DTB_COMPAT=y -CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_FROM_BOOTLOADER=y -# CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_EXTEND is not set -CONFIG_CMDLINE="" -# CONFIG_KEXEC is not set -# CONFIG_CRASH_DUMP is not set -CONFIG_AUTO_ZRELADDR=y - -# -# CPU Power Management -# - -# -# CPU Frequency scaling -# -CONFIG_CPU_FREQ=y -CONFIG_CPU_FREQ_GOV_COMMON=y -CONFIG_CPU_FREQ_STAT=y -# CONFIG_CPU_FREQ_STAT_DETAILS is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set -# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set -CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y -# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set -CONFIG_CPU_FREQ_GOV_PERFORMANCE=y -CONFIG_CPU_FREQ_GOV_POWERSAVE=y -CONFIG_CPU_FREQ_GOV_USERSPACE=y -CONFIG_CPU_FREQ_GOV_ONDEMAND=y -CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y -CONFIG_CPUFREQ_DT=y - -# -# ARM CPU frequency scaling drivers -# -# CONFIG_ARM_BIG_LITTLE_CPUFREQ is not set -# CONFIG_ARM_EXYNOS4210_CPUFREQ is not set -# CONFIG_ARM_EXYNOS4X12_CPUFREQ is not set -# CONFIG_ARM_EXYNOS5250_CPUFREQ is not set -# CONFIG_ARM_KIRKWOOD_CPUFREQ is not set -CONFIG_CPU_IDLE=y -# CONFIG_CPU_IDLE_MULTIPLE_DRIVERS is not set -CONFIG_CPU_IDLE_GOV_LADDER=y -# CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED is not set -# CONFIG_ARM_MVEBU_V7_CPUIDLE is not set - -# -# Floating point emulation -# - -# -# At least one emulation must be selected -# -# CONFIG_FPE_NWFPE is not set -# CONFIG_FPE_FASTFPE is not set -CONFIG_VFP=y -CONFIG_VFPv3=y -CONFIG_NEON=y - -# -# Userspace binary formats -# -CONFIG_BINFMT_ELF=y -CONFIG_ARCH_BINFMT_ELF_RANDOMIZE_PIE=y -CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y -CONFIG_BINFMT_SCRIPT=y -# CONFIG_HAVE_AOUT is not set -# CONFIG_BINFMT_MISC is not set -CONFIG_COREDUMP=y - -# -# Power management options -# -CONFIG_SUSPEND=y -CONFIG_SUSPEND_FREEZER=y -CONFIG_PM_SLEEP=y -CONFIG_PM_SLEEP_SMP=y -# CONFIG_PM_AUTOSLEEP is not set -# CONFIG_PM_WAKELOCKS is not set -# CONFIG_PM_RUNTIME is not set -CONFIG_PM=y -# CONFIG_PM_DEBUG is not set -# CONFIG_APM_EMULATION is not set -CONFIG_PM_OPP=y -CONFIG_PM_CLK=y -CONFIG_CPU_PM=y -CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_ARM_CPU_SUSPEND=y -CONFIG_NET=y - -# -# Networking options -# -CONFIG_PACKET=y -# CONFIG_PACKET_DIAG is not set -CONFIG_UNIX=y -CONFIG_UNIX_DIAG=m -CONFIG_XFRM=y -CONFIG_XFRM_ALGO=y -# CONFIG_XFRM_USER is not set -# CONFIG_XFRM_SUB_POLICY is not set -# CONFIG_XFRM_MIGRATE is not set -# CONFIG_XFRM_STATISTICS is not set -CONFIG_NET_KEY=y -# CONFIG_NET_KEY_MIGRATE is not set -CONFIG_INET=y -CONFIG_IP_MULTICAST=y -CONFIG_IP_ADVANCED_ROUTER=y -# CONFIG_IP_FIB_TRIE_STATS is not set -# CONFIG_IP_MULTIPLE_TABLES is not set -# CONFIG_IP_ROUTE_MULTIPATH is not set -# CONFIG_IP_ROUTE_VERBOSE is not set -CONFIG_IP_ROUTE_CLASSID=y -CONFIG_IP_PNP=y -CONFIG_IP_PNP_DHCP=y -CONFIG_IP_PNP_BOOTP=y -CONFIG_IP_PNP_RARP=y -CONFIG_NET_IPIP=m -CONFIG_NET_IPGRE_DEMUX=m -CONFIG_NET_IP_TUNNEL=y -CONFIG_NET_IPGRE=m -# CONFIG_NET_IPGRE_BROADCAST is not set -CONFIG_IP_MROUTE=y -# CONFIG_IP_MROUTE_MULTIPLE_TABLES is not set -# CONFIG_IP_PIMSM_V1 is not set -# CONFIG_IP_PIMSM_V2 is not set -# CONFIG_ARPD is not set -# CONFIG_SYN_COOKIES is not set -CONFIG_NET_IPVTI=m -# CONFIG_INET_AH is not set -# CONFIG_INET_ESP is not set -# CONFIG_INET_IPCOMP is not set -# CONFIG_INET_XFRM_TUNNEL is not set -CONFIG_INET_TUNNEL=y -CONFIG_INET_XFRM_MODE_TRANSPORT=y -CONFIG_INET_XFRM_MODE_TUNNEL=y -CONFIG_INET_XFRM_MODE_BEET=y -CONFIG_INET_LRO=y -CONFIG_INET_DIAG=y -CONFIG_INET_TCP_DIAG=y -CONFIG_INET_UDP_DIAG=y -# CONFIG_TCP_CONG_ADVANCED is not set -CONFIG_TCP_CONG_CUBIC=y -CONFIG_DEFAULT_TCP_CONG="cubic" -# CONFIG_TCP_MD5SIG is not set -CONFIG_IPV6=y -CONFIG_IPV6_PRIVACY=y -# CONFIG_IPV6_ROUTER_PREF is not set -# CONFIG_IPV6_OPTIMISTIC_DAD is not set -# CONFIG_INET6_AH is not set -# CONFIG_INET6_ESP is not set -# CONFIG_INET6_IPCOMP is not set -# CONFIG_IPV6_MIP6 is not set -# CONFIG_INET6_XFRM_TUNNEL is not set -# CONFIG_INET6_TUNNEL is not set -CONFIG_INET6_XFRM_MODE_TRANSPORT=y -CONFIG_INET6_XFRM_MODE_TUNNEL=y -CONFIG_INET6_XFRM_MODE_BEET=y -# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set -CONFIG_IPV6_SIT=y -# CONFIG_IPV6_SIT_6RD is not set -CONFIG_IPV6_NDISC_NODETYPE=y -# CONFIG_IPV6_TUNNEL is not set -# CONFIG_IPV6_GRE is not set -# CONFIG_IPV6_MULTIPLE_TABLES is not set -# CONFIG_IPV6_MROUTE is not set -# CONFIG_NETLABEL is not set -# CONFIG_NETWORK_SECMARK is not set -# CONFIG_NETWORK_PHY_TIMESTAMPING is not set -CONFIG_NETFILTER=y -# CONFIG_NETFILTER_DEBUG is not set -CONFIG_NETFILTER_ADVANCED=y -CONFIG_BRIDGE_NETFILTER=y - -# -# Core Netfilter Configuration -# -CONFIG_NETFILTER_NETLINK=m -CONFIG_NETFILTER_NETLINK_ACCT=m -CONFIG_NETFILTER_NETLINK_QUEUE=m -CONFIG_NETFILTER_NETLINK_LOG=m -CONFIG_NF_CONNTRACK=m -CONFIG_NF_CONNTRACK_MARK=y -# CONFIG_NF_CONNTRACK_ZONES is not set -CONFIG_NF_CONNTRACK_PROCFS=y -CONFIG_NF_CONNTRACK_EVENTS=y -CONFIG_NF_CONNTRACK_TIMEOUT=y -CONFIG_NF_CONNTRACK_TIMESTAMP=y -CONFIG_NF_CONNTRACK_LABELS=y -CONFIG_NF_CT_PROTO_DCCP=m -CONFIG_NF_CT_PROTO_GRE=m -CONFIG_NF_CT_PROTO_SCTP=m -CONFIG_NF_CT_PROTO_UDPLITE=m -CONFIG_NF_CONNTRACK_AMANDA=m -CONFIG_NF_CONNTRACK_FTP=m -CONFIG_NF_CONNTRACK_H323=m -CONFIG_NF_CONNTRACK_IRC=m -CONFIG_NF_CONNTRACK_BROADCAST=m -CONFIG_NF_CONNTRACK_NETBIOS_NS=m -CONFIG_NF_CONNTRACK_SNMP=m -CONFIG_NF_CONNTRACK_PPTP=m -CONFIG_NF_CONNTRACK_SANE=m -CONFIG_NF_CONNTRACK_SIP=m -CONFIG_NF_CONNTRACK_TFTP=m -CONFIG_NF_CT_NETLINK=m -CONFIG_NF_CT_NETLINK_TIMEOUT=m -CONFIG_NF_CT_NETLINK_HELPER=m -CONFIG_NETFILTER_NETLINK_QUEUE_CT=y -CONFIG_NF_NAT=m -CONFIG_NF_NAT_NEEDED=y -CONFIG_NF_NAT_PROTO_DCCP=m -CONFIG_NF_NAT_PROTO_UDPLITE=m -CONFIG_NF_NAT_PROTO_SCTP=m -CONFIG_NF_NAT_AMANDA=m -CONFIG_NF_NAT_FTP=m -CONFIG_NF_NAT_IRC=m -CONFIG_NF_NAT_SIP=m -CONFIG_NF_NAT_TFTP=m -CONFIG_NETFILTER_TPROXY=m -CONFIG_NETFILTER_XTABLES=m - -# -# Xtables combined modules -# -CONFIG_NETFILTER_XT_MARK=m -CONFIG_NETFILTER_XT_CONNMARK=m -# CONFIG_NETFILTER_XT_SET is not set - -# -# Xtables targets -# -CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m -CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m -CONFIG_NETFILTER_XT_TARGET_CONNMARK=m -CONFIG_NETFILTER_XT_TARGET_CT=m -CONFIG_NETFILTER_XT_TARGET_DSCP=m -CONFIG_NETFILTER_XT_TARGET_HL=m -CONFIG_NETFILTER_XT_TARGET_HMARK=m -CONFIG_NETFILTER_XT_TARGET_IDLETIMER=m -CONFIG_NETFILTER_XT_TARGET_LED=m -CONFIG_NETFILTER_XT_TARGET_LOG=m -CONFIG_NETFILTER_XT_TARGET_MARK=m -CONFIG_NETFILTER_XT_TARGET_NETMAP=m -CONFIG_NETFILTER_XT_TARGET_NFLOG=m -CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m -CONFIG_NETFILTER_XT_TARGET_NOTRACK=m -CONFIG_NETFILTER_XT_TARGET_RATEEST=m -CONFIG_NETFILTER_XT_TARGET_REDIRECT=m -CONFIG_NETFILTER_XT_TARGET_TEE=m -CONFIG_NETFILTER_XT_TARGET_TPROXY=m -CONFIG_NETFILTER_XT_TARGET_TRACE=m -CONFIG_NETFILTER_XT_TARGET_TCPMSS=m -CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m - -# -# Xtables matches -# -CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m -CONFIG_NETFILTER_XT_MATCH_BPF=m -CONFIG_NETFILTER_XT_MATCH_CLUSTER=m -CONFIG_NETFILTER_XT_MATCH_COMMENT=m -CONFIG_NETFILTER_XT_MATCH_CONNBYTES=m -CONFIG_NETFILTER_XT_MATCH_CONNLABEL=m -CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=m -CONFIG_NETFILTER_XT_MATCH_CONNMARK=m -CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m -CONFIG_NETFILTER_XT_MATCH_CPU=m -CONFIG_NETFILTER_XT_MATCH_DCCP=m -CONFIG_NETFILTER_XT_MATCH_DEVGROUP=m -CONFIG_NETFILTER_XT_MATCH_DSCP=m -CONFIG_NETFILTER_XT_MATCH_ECN=m -CONFIG_NETFILTER_XT_MATCH_ESP=m -CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m -CONFIG_NETFILTER_XT_MATCH_HELPER=m -CONFIG_NETFILTER_XT_MATCH_HL=m -CONFIG_NETFILTER_XT_MATCH_IPRANGE=m -# CONFIG_NETFILTER_XT_MATCH_IPVS is not set -CONFIG_NETFILTER_XT_MATCH_LENGTH=m -CONFIG_NETFILTER_XT_MATCH_LIMIT=m -CONFIG_NETFILTER_XT_MATCH_MAC=m -CONFIG_NETFILTER_XT_MATCH_MARK=m -CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m -CONFIG_NETFILTER_XT_MATCH_NFACCT=m -CONFIG_NETFILTER_XT_MATCH_OSF=m -CONFIG_NETFILTER_XT_MATCH_OWNER=m -CONFIG_NETFILTER_XT_MATCH_POLICY=m -CONFIG_NETFILTER_XT_MATCH_PHYSDEV=m -CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m -CONFIG_NETFILTER_XT_MATCH_QUOTA=m -CONFIG_NETFILTER_XT_MATCH_RATEEST=m -CONFIG_NETFILTER_XT_MATCH_REALM=m -CONFIG_NETFILTER_XT_MATCH_RECENT=m -CONFIG_NETFILTER_XT_MATCH_SCTP=m -CONFIG_NETFILTER_XT_MATCH_SOCKET=m -CONFIG_NETFILTER_XT_MATCH_STATE=m -CONFIG_NETFILTER_XT_MATCH_STATISTIC=m -CONFIG_NETFILTER_XT_MATCH_STRING=m -CONFIG_NETFILTER_XT_MATCH_TCPMSS=m -CONFIG_NETFILTER_XT_MATCH_TIME=m -CONFIG_NETFILTER_XT_MATCH_U32=m -CONFIG_IP_SET=m -CONFIG_IP_SET_MAX=256 -CONFIG_IP_SET_BITMAP_IP=m -CONFIG_IP_SET_BITMAP_IPMAC=m -CONFIG_IP_SET_BITMAP_PORT=m -CONFIG_IP_SET_HASH_IP=m -CONFIG_IP_SET_HASH_IPPORT=m -CONFIG_IP_SET_HASH_IPPORTIP=m -CONFIG_IP_SET_HASH_IPPORTNET=m -CONFIG_IP_SET_HASH_NET=m -CONFIG_IP_SET_HASH_NETPORT=m -CONFIG_IP_SET_HASH_NETIFACE=m -CONFIG_IP_SET_LIST_SET=m -CONFIG_IP_VS=m -# CONFIG_IP_VS_IPV6 is not set -# CONFIG_IP_VS_DEBUG is not set -CONFIG_IP_VS_TAB_BITS=12 - -# -# IPVS transport protocol load balancing support -# -# CONFIG_IP_VS_PROTO_TCP is not set -# CONFIG_IP_VS_PROTO_UDP is not set -# CONFIG_IP_VS_PROTO_AH_ESP is not set -# CONFIG_IP_VS_PROTO_ESP is not set -# CONFIG_IP_VS_PROTO_AH is not set -# CONFIG_IP_VS_PROTO_SCTP is not set - -# -# IPVS scheduler -# -# CONFIG_IP_VS_RR is not set -# CONFIG_IP_VS_WRR is not set -# CONFIG_IP_VS_LC is not set -# CONFIG_IP_VS_WLC is not set -# CONFIG_IP_VS_LBLC is not set -# CONFIG_IP_VS_LBLCR is not set -# CONFIG_IP_VS_DH is not set -# CONFIG_IP_VS_SH is not set -# CONFIG_IP_VS_SED is not set -# CONFIG_IP_VS_NQ is not set - -# -# IPVS SH scheduler -# -CONFIG_IP_VS_SH_TAB_BITS=8 - -# -# IPVS application helper -# -# CONFIG_IP_VS_NFCT is not set - -# -# IP: Netfilter Configuration -# -CONFIG_NF_DEFRAG_IPV4=m -CONFIG_NF_CONNTRACK_IPV4=m -CONFIG_NF_CONNTRACK_PROC_COMPAT=y -CONFIG_IP_NF_IPTABLES=m -CONFIG_IP_NF_MATCH_AH=m -CONFIG_IP_NF_MATCH_ECN=m -CONFIG_IP_NF_MATCH_RPFILTER=m -CONFIG_IP_NF_MATCH_TTL=m -CONFIG_IP_NF_FILTER=m -CONFIG_IP_NF_TARGET_REJECT=m -CONFIG_IP_NF_TARGET_ULOG=m -CONFIG_NF_NAT_IPV4=m -CONFIG_IP_NF_TARGET_MASQUERADE=m -CONFIG_IP_NF_TARGET_NETMAP=m -CONFIG_IP_NF_TARGET_REDIRECT=m -CONFIG_NF_NAT_SNMP_BASIC=m -CONFIG_NF_NAT_PROTO_GRE=m -CONFIG_NF_NAT_PPTP=m -CONFIG_NF_NAT_H323=m -CONFIG_IP_NF_MANGLE=m -CONFIG_IP_NF_TARGET_CLUSTERIP=m -CONFIG_IP_NF_TARGET_ECN=m -CONFIG_IP_NF_TARGET_TTL=m -CONFIG_IP_NF_RAW=m -CONFIG_IP_NF_SECURITY=m -CONFIG_IP_NF_ARPTABLES=m -CONFIG_IP_NF_ARPFILTER=m -CONFIG_IP_NF_ARP_MANGLE=m - -# -# IPv6: Netfilter Configuration -# -CONFIG_NF_DEFRAG_IPV6=m -CONFIG_NF_CONNTRACK_IPV6=m -CONFIG_IP6_NF_IPTABLES=m -CONFIG_IP6_NF_MATCH_AH=m -CONFIG_IP6_NF_MATCH_EUI64=m -CONFIG_IP6_NF_MATCH_FRAG=m -CONFIG_IP6_NF_MATCH_OPTS=m -CONFIG_IP6_NF_MATCH_HL=m -CONFIG_IP6_NF_MATCH_IPV6HEADER=m -CONFIG_IP6_NF_MATCH_MH=m -CONFIG_IP6_NF_MATCH_RPFILTER=m -CONFIG_IP6_NF_MATCH_RT=m -CONFIG_IP6_NF_TARGET_HL=m -CONFIG_IP6_NF_FILTER=m -CONFIG_IP6_NF_TARGET_REJECT=m -CONFIG_IP6_NF_MANGLE=m -CONFIG_IP6_NF_RAW=m -CONFIG_IP6_NF_SECURITY=m -CONFIG_NF_NAT_IPV6=m -CONFIG_IP6_NF_TARGET_MASQUERADE=m -CONFIG_IP6_NF_TARGET_NPT=m -CONFIG_BRIDGE_NF_EBTABLES=m -CONFIG_BRIDGE_EBT_BROUTE=m -CONFIG_BRIDGE_EBT_T_FILTER=m -CONFIG_BRIDGE_EBT_T_NAT=m -CONFIG_BRIDGE_EBT_802_3=m -CONFIG_BRIDGE_EBT_AMONG=m -CONFIG_BRIDGE_EBT_ARP=m -CONFIG_BRIDGE_EBT_IP=m -CONFIG_BRIDGE_EBT_IP6=m -CONFIG_BRIDGE_EBT_LIMIT=m -CONFIG_BRIDGE_EBT_MARK=m -CONFIG_BRIDGE_EBT_PKTTYPE=m -CONFIG_BRIDGE_EBT_STP=m -CONFIG_BRIDGE_EBT_VLAN=m -CONFIG_BRIDGE_EBT_ARPREPLY=m -CONFIG_BRIDGE_EBT_DNAT=m -CONFIG_BRIDGE_EBT_MARK_T=m -CONFIG_BRIDGE_EBT_REDIRECT=m -CONFIG_BRIDGE_EBT_SNAT=m -CONFIG_BRIDGE_EBT_LOG=m -CONFIG_BRIDGE_EBT_ULOG=m -CONFIG_BRIDGE_EBT_NFLOG=m -# CONFIG_IP_DCCP is not set -# CONFIG_IP_SCTP is not set -# CONFIG_RDS is not set -# CONFIG_TIPC is not set -# CONFIG_ATM is not set -CONFIG_L2TP=m -# CONFIG_L2TP_DEBUGFS is not set -CONFIG_L2TP_V3=y -CONFIG_L2TP_IP=m -CONFIG_L2TP_ETH=m -CONFIG_STP=y -CONFIG_BRIDGE=y -CONFIG_BRIDGE_IGMP_SNOOPING=y -# CONFIG_BRIDGE_VLAN_FILTERING is not set -CONFIG_HAVE_NET_DSA=y -CONFIG_VLAN_8021Q=y -# CONFIG_VLAN_8021Q_GVRP is not set -# CONFIG_VLAN_8021Q_MVRP is not set -# CONFIG_DECNET is not set -CONFIG_LLC=y -# CONFIG_LLC2 is not set -# CONFIG_IPX is not set -# CONFIG_ATALK is not set -# CONFIG_X25 is not set -# CONFIG_LAPB is not set -# CONFIG_PHONET is not set -# CONFIG_IEEE802154 is not set -CONFIG_NET_SCHED=y - -# -# Queueing/Scheduling -# -CONFIG_NET_SCH_CBQ=m -CONFIG_NET_SCH_HTB=m -CONFIG_NET_SCH_HFSC=m -CONFIG_NET_SCH_PRIO=m -CONFIG_NET_SCH_MULTIQ=m -CONFIG_NET_SCH_RED=m -CONFIG_NET_SCH_SFB=m -CONFIG_NET_SCH_SFQ=m -CONFIG_NET_SCH_TEQL=m -CONFIG_NET_SCH_TBF=m -CONFIG_NET_SCH_GRED=m -CONFIG_NET_SCH_DSMARK=m -CONFIG_NET_SCH_NETEM=m -CONFIG_NET_SCH_DRR=m -CONFIG_NET_SCH_MQPRIO=m -CONFIG_NET_SCH_CHOKE=m -CONFIG_NET_SCH_QFQ=m -CONFIG_NET_SCH_CODEL=m -CONFIG_NET_SCH_FQ_CODEL=m -CONFIG_NET_SCH_PLUG=m - -# -# Classification -# -CONFIG_NET_CLS=y -CONFIG_NET_CLS_BASIC=m -CONFIG_NET_CLS_TCINDEX=m -CONFIG_NET_CLS_ROUTE4=m -CONFIG_NET_CLS_FW=m -CONFIG_NET_CLS_U32=m -# CONFIG_CLS_U32_PERF is not set -# CONFIG_CLS_U32_MARK is not set -CONFIG_NET_CLS_RSVP=m -CONFIG_NET_CLS_RSVP6=m -CONFIG_NET_CLS_FLOW=m -CONFIG_NET_CLS_CGROUP=m -# CONFIG_NET_EMATCH is not set -# CONFIG_NET_CLS_ACT is not set -# CONFIG_NET_CLS_IND is not set -CONFIG_NET_SCH_FIFO=y -# CONFIG_DCB is not set -CONFIG_DNS_RESOLVER=y -# CONFIG_BATMAN_ADV is not set -# CONFIG_OPENVSWITCH is not set -# CONFIG_VSOCKETS is not set -# CONFIG_NETLINK_MMAP is not set -# CONFIG_NETLINK_DIAG is not set -CONFIG_RPS=y -CONFIG_RFS_ACCEL=y -CONFIG_XPS=y -CONFIG_NETPRIO_CGROUP=y -CONFIG_BQL=y -# CONFIG_BPF_JIT is not set - -# -# Network testing -# -# CONFIG_NET_PKTGEN is not set -# CONFIG_HAMRADIO is not set -CONFIG_CAN=m -CONFIG_CAN_RAW=m -CONFIG_CAN_BCM=m -CONFIG_CAN_GW=m - -# -# CAN Device Drivers -# -# CONFIG_CAN_VCAN is not set -# CONFIG_CAN_SLCAN is not set -CONFIG_CAN_DEV=m -CONFIG_CAN_CALC_BITTIMING=y -# CONFIG_CAN_LEDS is not set -# CONFIG_CAN_AT91 is not set -# CONFIG_CAN_MCP251X is not set -# CONFIG_PCH_CAN is not set -# CONFIG_CAN_GRCAN is not set -# CONFIG_CAN_SJA1000 is not set -# CONFIG_CAN_C_CAN is not set -# CONFIG_CAN_CC770 is not set - -# -# CAN USB interfaces -# -# CONFIG_CAN_EMS_USB is not set -# CONFIG_CAN_ESD_USB2 is not set -# CONFIG_CAN_KVASER_USB is not set -# CONFIG_CAN_PEAK_USB is not set -# CONFIG_CAN_8DEV_USB is not set -# CONFIG_CAN_SOFTING is not set -# CONFIG_CAN_DEBUG_DEVICES is not set -# CONFIG_IRDA is not set -CONFIG_BT=m -CONFIG_BT_RFCOMM=m -CONFIG_BT_RFCOMM_TTY=y -CONFIG_BT_BNEP=m -CONFIG_BT_BNEP_MC_FILTER=y -CONFIG_BT_BNEP_PROTO_FILTER=y -CONFIG_BT_HIDP=m - -# -# Bluetooth device drivers -# -CONFIG_BT_HCIBTUSB=m -CONFIG_BT_HCIBTSDIO=m -# CONFIG_BT_HCIUART is not set -# CONFIG_BT_HCIBCM203X is not set -# CONFIG_BT_HCIBPA10X is not set -# CONFIG_BT_HCIBFUSB is not set -# CONFIG_BT_HCIVHCI is not set -# CONFIG_BT_MRVL is not set -CONFIG_BT_ATH3K=m -# CONFIG_AF_RXRPC is not set -CONFIG_WIRELESS=y -CONFIG_WIRELESS_EXT=y -CONFIG_WEXT_CORE=y -CONFIG_WEXT_PROC=y -CONFIG_WEXT_SPY=y -CONFIG_WEXT_PRIV=y -CONFIG_CFG80211=m -# CONFIG_NL80211_TESTMODE is not set -# CONFIG_CFG80211_DEVELOPER_WARNINGS is not set -# CONFIG_CFG80211_REG_DEBUG is not set -# CONFIG_CFG80211_CERTIFICATION_ONUS is not set -CONFIG_CFG80211_DEFAULT_PS=y -# CONFIG_CFG80211_DEBUGFS is not set -# CONFIG_CFG80211_INTERNAL_REGDB is not set -CONFIG_CFG80211_WEXT=y -# CONFIG_LIB80211 is not set -CONFIG_MAC80211=m -CONFIG_MAC80211_HAS_RC=y -CONFIG_MAC80211_RC_PID=y -CONFIG_MAC80211_RC_MINSTREL=y -CONFIG_MAC80211_RC_MINSTREL_HT=y -# CONFIG_MAC80211_RC_DEFAULT_PID is not set -CONFIG_MAC80211_RC_DEFAULT_MINSTREL=y -CONFIG_MAC80211_RC_DEFAULT="minstrel_ht" -# CONFIG_MAC80211_MESH is not set -CONFIG_MAC80211_LEDS=y -# CONFIG_MAC80211_DEBUGFS is not set -# CONFIG_MAC80211_MESSAGE_TRACING is not set -# CONFIG_MAC80211_DEBUG_MENU is not set -# CONFIG_WIMAX is not set -CONFIG_RFKILL=m -CONFIG_RFKILL_LEDS=y -CONFIG_RFKILL_INPUT=y -CONFIG_RFKILL_REGULATOR=m -CONFIG_RFKILL_GPIO=m -# CONFIG_NET_9P is not set -# CONFIG_CAIF is not set -# CONFIG_CEPH_LIB is not set -# CONFIG_NFC is not set -CONFIG_HAVE_BPF_JIT=y - -# -# Device Drivers -# - -# -# Generic Driver Options -# -CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" -CONFIG_DEVTMPFS=y -CONFIG_DEVTMPFS_MOUNT=y -CONFIG_STANDALONE=y -# CONFIG_PREVENT_FIRMWARE_BUILD is not set -CONFIG_FW_LOADER=y -# CONFIG_FIRMWARE_IN_KERNEL is not set -CONFIG_EXTRA_FIRMWARE="" -CONFIG_FW_LOADER_USER_HELPER=y -# CONFIG_DEBUG_DRIVER is not set -# CONFIG_DEBUG_DEVRES is not set -# CONFIG_SYS_HYPERVISOR is not set -# CONFIG_GENERIC_CPU_DEVICES is not set -CONFIG_REGMAP=y -CONFIG_REGMAP_I2C=y -CONFIG_REGMAP_SPI=y -# CONFIG_DMA_SHARED_BUFFER is not set -# CONFIG_CMA is not set - -# -# Bus devices -# -CONFIG_MVEBU_MBUS=y -# CONFIG_CONNECTOR is not set -CONFIG_MTD=y -# CONFIG_MTD_TESTS is not set -# CONFIG_MTD_REDBOOT_PARTS is not set -CONFIG_MTD_CMDLINE_PARTS=y -# CONFIG_MTD_AFS_PARTS is not set -CONFIG_MTD_OF_PARTS=y -# CONFIG_MTD_AR7_PARTS is not set - -# -# User Modules And Translation Layers -# -CONFIG_MTD_BLKDEVS=y -CONFIG_MTD_BLOCK=y -# CONFIG_FTL is not set -# CONFIG_NFTL is not set -# CONFIG_INFTL is not set -# CONFIG_RFD_FTL is not set -# CONFIG_SSFDC is not set -# CONFIG_SM_FTL is not set -# CONFIG_MTD_OOPS is not set -# CONFIG_MTD_SWAP is not set - -# -# RAM/ROM/Flash chip drivers -# -CONFIG_MTD_CFI=y -# CONFIG_MTD_JEDECPROBE is not set -CONFIG_MTD_GEN_PROBE=y -# CONFIG_MTD_CFI_ADV_OPTIONS is not set -CONFIG_MTD_MAP_BANK_WIDTH_1=y -CONFIG_MTD_MAP_BANK_WIDTH_2=y -CONFIG_MTD_MAP_BANK_WIDTH_4=y -# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set -# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set -# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set -CONFIG_MTD_CFI_I1=y -CONFIG_MTD_CFI_I2=y -# CONFIG_MTD_CFI_I4 is not set -# CONFIG_MTD_CFI_I8 is not set -CONFIG_MTD_CFI_INTELEXT=y -CONFIG_MTD_CFI_AMDSTD=y -CONFIG_MTD_CFI_STAA=y -CONFIG_MTD_CFI_UTIL=y -# CONFIG_MTD_RAM is not set -# CONFIG_MTD_ROM is not set -# CONFIG_MTD_ABSENT is not set - -# -# Mapping drivers for chip access -# -# CONFIG_MTD_COMPLEX_MAPPINGS is not set -# CONFIG_MTD_PHYSMAP is not set -CONFIG_MTD_PHYSMAP_OF=y -# CONFIG_MTD_INTEL_VR_NOR is not set -# CONFIG_MTD_PLATRAM is not set - -# -# Self-contained MTD device drivers -# -# CONFIG_MTD_PMC551 is not set -# CONFIG_MTD_DATAFLASH is not set -CONFIG_MTD_M25P80=y -CONFIG_M25PXX_USE_FAST_READ=y -# CONFIG_MTD_SST25L is not set -# CONFIG_MTD_SLRAM is not set -# CONFIG_MTD_PHRAM is not set -# CONFIG_MTD_MTDRAM is not set -# CONFIG_MTD_BLOCK2MTD is not set - -# -# Disk-On-Chip Device Drivers -# -# CONFIG_MTD_DOCG3 is not set -CONFIG_MTD_NAND_ECC=y -# CONFIG_MTD_NAND_ECC_SMC is not set -CONFIG_MTD_NAND=y -# CONFIG_MTD_NAND_ECC_BCH is not set -# CONFIG_MTD_SM_COMMON is not set -# CONFIG_MTD_NAND_DENALI is not set -# CONFIG_MTD_NAND_GPIO is not set -CONFIG_MTD_NAND_IDS=y -# CONFIG_MTD_NAND_RICOH is not set -# CONFIG_MTD_NAND_DISKONCHIP is not set -# CONFIG_MTD_NAND_DOCG4 is not set -# CONFIG_MTD_NAND_CAFE is not set -CONFIG_MTD_NAND_PXA3xx=y -# CONFIG_MTD_NAND_NANDSIM is not set -CONFIG_MTD_NAND_MVEBU_NFC=y -CONFIG_MTD_NAND_MARVELL=y -CONFIG_MTD_NAND_NFC=y -# CONFIG_MTD_NAND_NFC_GANG_SUPPORT is not set -CONFIG_MTD_NAND_NFC_MLC_SUPPORT=y -CONFIG_MTD_NAND_NFC_INIT_RESET=y -# CONFIG_MTD_NAND_NFC_NEGLECT_RNB is not set -# CONFIG_MTD_NAND_PLATFORM is not set -# CONFIG_MTD_ALAUDA is not set -# CONFIG_MTD_NAND_ORION is not set -# CONFIG_MTD_ONENAND is not set - -# -# LPDDR flash memory drivers -# -# CONFIG_MTD_LPDDR is not set -CONFIG_MTD_UBI=y -CONFIG_MTD_UBI_WL_THRESHOLD=4096 -CONFIG_MTD_UBI_BEB_LIMIT=20 -# CONFIG_MTD_UBI_FASTMAP is not set -# CONFIG_MTD_UBI_GLUEBI is not set -CONFIG_DTC=y -CONFIG_OF=y - -# -# Device Tree and Open Firmware support -# -# CONFIG_PROC_DEVICETREE is not set -# CONFIG_OF_SELFTEST is not set -CONFIG_OF_FLATTREE=y -CONFIG_OF_EARLY_FLATTREE=y -CONFIG_OF_ADDRESS=y -CONFIG_OF_IRQ=y -CONFIG_OF_DEVICE=y -CONFIG_OF_I2C=y -CONFIG_OF_NET=y -CONFIG_OF_MDIO=y -CONFIG_OF_PCI=y -CONFIG_OF_PCI_IRQ=y -CONFIG_OF_MTD=y -# CONFIG_PARPORT is not set -CONFIG_BLK_DEV=y -# CONFIG_BLK_DEV_PCIESSD_MTIP32XX is not set -# CONFIG_BLK_CPQ_CISS_DA is not set -# CONFIG_BLK_DEV_DAC960 is not set -# CONFIG_BLK_DEV_UMEM is not set -# CONFIG_BLK_DEV_COW_COMMON is not set -CONFIG_BLK_DEV_LOOP=y -CONFIG_BLK_DEV_LOOP_MIN_COUNT=8 -# CONFIG_BLK_DEV_CRYPTOLOOP is not set -# CONFIG_BLK_DEV_DRBD is not set -# CONFIG_BLK_DEV_NBD is not set -# CONFIG_BLK_DEV_NVME is not set -# CONFIG_BLK_DEV_SX8 is not set -# CONFIG_BLK_DEV_RAM is not set -# CONFIG_CDROM_PKTCDVD is not set -# CONFIG_ATA_OVER_ETH is not set -# CONFIG_MG_DISK is not set -# CONFIG_BLK_DEV_RBD is not set -# CONFIG_BLK_DEV_RSXX is not set - -# -# Misc devices -# -# CONFIG_SENSORS_LIS3LV02D is not set -# CONFIG_AD525X_DPOT is not set -# CONFIG_ATMEL_PWM is not set -# CONFIG_DUMMY_IRQ is not set -# CONFIG_PHANTOM is not set -# CONFIG_INTEL_MID_PTI is not set -# CONFIG_SGI_IOC4 is not set -# CONFIG_TIFM_CORE is not set -# CONFIG_ICS932S401 is not set -# CONFIG_ATMEL_SSC is not set -# CONFIG_ENCLOSURE_SERVICES is not set -# CONFIG_HP_ILO is not set -# CONFIG_APDS9802ALS is not set -# CONFIG_ISL29003 is not set -# CONFIG_ISL29020 is not set -# CONFIG_SENSORS_TSL2550 is not set -# CONFIG_SENSORS_BH1780 is not set -# CONFIG_SENSORS_BH1770 is not set -# CONFIG_SENSORS_APDS990X is not set -# CONFIG_HMC6352 is not set -# CONFIG_DS1682 is not set -# CONFIG_TI_DAC7512 is not set -# CONFIG_BMP085_I2C is not set -# CONFIG_BMP085_SPI is not set -# CONFIG_PCH_PHUB is not set -# CONFIG_USB_SWITCH_FSA9480 is not set -# CONFIG_LATTICE_ECP3_CONFIG is not set -# CONFIG_SRAM is not set -# CONFIG_C2PORT is not set - -# -# EEPROM support -# -# CONFIG_EEPROM_AT24 is not set -# CONFIG_EEPROM_AT25 is not set -# CONFIG_EEPROM_LEGACY is not set -# CONFIG_EEPROM_MAX6875 is not set -# CONFIG_EEPROM_93CX6 is not set -# CONFIG_EEPROM_93XX46 is not set -# CONFIG_CB710_CORE is not set - -# -# Texas Instruments shared transport line discipline -# -# CONFIG_TI_ST is not set -# CONFIG_SENSORS_LIS3_SPI is not set -# CONFIG_SENSORS_LIS3_I2C is not set - -# -# Altera FPGA firmware download module -# -# CONFIG_ALTERA_STAPL is not set -CONFIG_HAVE_IDE=y -# CONFIG_IDE is not set - -# -# SCSI device support -# -CONFIG_SCSI_MOD=y -# CONFIG_RAID_ATTRS is not set -CONFIG_SCSI=y -CONFIG_SCSI_DMA=y -# CONFIG_SCSI_TGT is not set -# CONFIG_SCSI_NETLINK is not set -CONFIG_SCSI_PROC_FS=y - -# -# SCSI support type (disk, tape, CD-ROM) -# -CONFIG_BLK_DEV_SD=y -# CONFIG_CHR_DEV_ST is not set -# CONFIG_CHR_DEV_OSST is not set -# CONFIG_BLK_DEV_SR is not set -# CONFIG_CHR_DEV_SG is not set -# CONFIG_CHR_DEV_SCH is not set -# CONFIG_SCSI_MULTI_LUN is not set -# CONFIG_SCSI_CONSTANTS is not set -# CONFIG_SCSI_LOGGING is not set -# CONFIG_SCSI_SCAN_ASYNC is not set - -# -# SCSI Transports -# -# CONFIG_SCSI_SPI_ATTRS is not set -# CONFIG_SCSI_FC_ATTRS is not set -# CONFIG_SCSI_ISCSI_ATTRS is not set -# CONFIG_SCSI_SAS_ATTRS is not set -# CONFIG_SCSI_SAS_LIBSAS is not set -# CONFIG_SCSI_SRP_ATTRS is not set -CONFIG_SCSI_LOWLEVEL=y -# CONFIG_ISCSI_TCP is not set -# CONFIG_ISCSI_BOOT_SYSFS is not set -# CONFIG_SCSI_CXGB3_ISCSI is not set -# CONFIG_SCSI_CXGB4_ISCSI is not set -# CONFIG_SCSI_BNX2_ISCSI is not set -# CONFIG_SCSI_BNX2X_FCOE is not set -# CONFIG_BE2ISCSI is not set -# CONFIG_BLK_DEV_3W_XXXX_RAID is not set -# CONFIG_SCSI_HPSA is not set -# CONFIG_SCSI_3W_9XXX is not set -# CONFIG_SCSI_3W_SAS is not set -# CONFIG_SCSI_ACARD is not set -# CONFIG_SCSI_AACRAID is not set -# CONFIG_SCSI_AIC7XXX is not set -# CONFIG_SCSI_AIC7XXX_OLD is not set -# CONFIG_SCSI_AIC79XX is not set -# CONFIG_SCSI_AIC94XX is not set -# CONFIG_SCSI_MVSAS is not set -# CONFIG_SCSI_MVUMI is not set -# CONFIG_SCSI_ARCMSR is not set -# CONFIG_MEGARAID_NEWGEN is not set -# CONFIG_MEGARAID_LEGACY is not set -# CONFIG_MEGARAID_SAS is not set -# CONFIG_SCSI_MPT2SAS is not set -# CONFIG_SCSI_MPT3SAS is not set -# CONFIG_SCSI_UFSHCD is not set -# CONFIG_SCSI_HPTIOP is not set -# CONFIG_LIBFC is not set -# CONFIG_LIBFCOE is not set -# CONFIG_FCOE is not set -# CONFIG_SCSI_DMX3191D is not set -# CONFIG_SCSI_FUTURE_DOMAIN is not set -# CONFIG_SCSI_IPS is not set -# CONFIG_SCSI_INITIO is not set -# CONFIG_SCSI_INIA100 is not set -# CONFIG_SCSI_STEX is not set -# CONFIG_SCSI_SYM53C8XX_2 is not set -# CONFIG_SCSI_IPR is not set -# CONFIG_SCSI_QLOGIC_1280 is not set -# CONFIG_SCSI_QLA_FC is not set -# CONFIG_SCSI_QLA_ISCSI is not set -# CONFIG_SCSI_LPFC is not set -# CONFIG_SCSI_DC395x is not set -# CONFIG_SCSI_DC390T is not set -# CONFIG_SCSI_NSP32 is not set -# CONFIG_SCSI_DEBUG is not set -# CONFIG_SCSI_PMCRAID is not set -# CONFIG_SCSI_PM8001 is not set -# CONFIG_SCSI_SRP is not set -# CONFIG_SCSI_BFA_FC is not set -# CONFIG_SCSI_CHELSIO_FCOE is not set -# CONFIG_SCSI_DH is not set -# CONFIG_SCSI_OSD_INITIATOR is not set -CONFIG_ATA=y -# CONFIG_ATA_NONSTANDARD is not set -CONFIG_ATA_VERBOSE_ERROR=y -CONFIG_SATA_PMP=y - -# -# Controllers with non-SFF native interface -# -CONFIG_SATA_AHCI=y -CONFIG_SATA_AHCI_MV=y -# CONFIG_SATA_AHCI_PLATFORM is not set -# CONFIG_SATA_INIC162X is not set -# CONFIG_SATA_ACARD_AHCI is not set -# CONFIG_SATA_SIL24 is not set -CONFIG_ATA_SFF=y - -# -# SFF controllers with custom DMA interface -# -# CONFIG_PDC_ADMA is not set -# CONFIG_SATA_QSTOR is not set -# CONFIG_SATA_SX4 is not set -CONFIG_ATA_BMDMA=y - -# -# SATA SFF controllers with BMDMA -# -# CONFIG_ATA_PIIX is not set -# CONFIG_SATA_HIGHBANK is not set -CONFIG_SATA_MV=y -# CONFIG_SATA_NV is not set -# CONFIG_SATA_PROMISE is not set -# CONFIG_SATA_SIL is not set -# CONFIG_SATA_SIS is not set -# CONFIG_SATA_SVW is not set -# CONFIG_SATA_ULI is not set -# CONFIG_SATA_VIA is not set -# CONFIG_SATA_VITESSE is not set - -# -# PATA SFF controllers with BMDMA -# -# CONFIG_PATA_ALI is not set -# CONFIG_PATA_AMD is not set -# CONFIG_PATA_ARASAN_CF is not set -# CONFIG_PATA_ARTOP is not set -# CONFIG_PATA_ATIIXP is not set -# CONFIG_PATA_ATP867X is not set -# CONFIG_PATA_CMD64X is not set -# CONFIG_PATA_CS5520 is not set -# CONFIG_PATA_CS5530 is not set -# CONFIG_PATA_CS5536 is not set -# CONFIG_PATA_CYPRESS is not set -# CONFIG_PATA_EFAR is not set -# CONFIG_PATA_HPT366 is not set -# CONFIG_PATA_HPT37X is not set -# CONFIG_PATA_HPT3X2N is not set -# CONFIG_PATA_HPT3X3 is not set -# CONFIG_PATA_IT8213 is not set -# CONFIG_PATA_IT821X is not set -# CONFIG_PATA_JMICRON is not set -# CONFIG_PATA_MARVELL is not set -# CONFIG_PATA_NETCELL is not set -# CONFIG_PATA_NINJA32 is not set -# CONFIG_PATA_NS87415 is not set -# CONFIG_PATA_OLDPIIX is not set -# CONFIG_PATA_OPTIDMA is not set -# CONFIG_PATA_PDC2027X is not set -# CONFIG_PATA_PDC_OLD is not set -# CONFIG_PATA_RADISYS is not set -# CONFIG_PATA_RDC is not set -# CONFIG_PATA_SC1200 is not set -# CONFIG_PATA_SCH is not set -# CONFIG_PATA_SERVERWORKS is not set -# CONFIG_PATA_SIL680 is not set -# CONFIG_PATA_SIS is not set -# CONFIG_PATA_TOSHIBA is not set -# CONFIG_PATA_TRIFLEX is not set -# CONFIG_PATA_VIA is not set -# CONFIG_PATA_WINBOND is not set - -# -# PIO-only SFF controllers -# -# CONFIG_PATA_CMD640_PCI is not set -# CONFIG_PATA_MPIIX is not set -# CONFIG_PATA_NS87410 is not set -# CONFIG_PATA_OPTI is not set -# CONFIG_PATA_PLATFORM is not set -# CONFIG_PATA_RZ1000 is not set - -# -# Generic fallback / legacy drivers -# -# CONFIG_ATA_GENERIC is not set -# CONFIG_PATA_LEGACY is not set -CONFIG_MD=y -CONFIG_BLK_DEV_MD=y -CONFIG_MD_AUTODETECT=y -# CONFIG_MD_LINEAR is not set -CONFIG_MD_RAID0=y -CONFIG_MD_RAID1=y -# CONFIG_MD_RAID10 is not set -CONFIG_MD_RAID456=y -# CONFIG_MD_MULTIPATH is not set -# CONFIG_MD_FAULTY is not set -# CONFIG_BCACHE is not set -CONFIG_BLK_DEV_DM_BUILTIN=y -CONFIG_BLK_DEV_DM=y -# CONFIG_DM_DEBUG is not set -CONFIG_DM_CRYPT=y -# CONFIG_DM_SNAPSHOT is not set -# CONFIG_DM_THIN_PROVISIONING is not set -# CONFIG_DM_CACHE is not set -# CONFIG_DM_MIRROR is not set -# CONFIG_DM_RAID is not set -# CONFIG_DM_ZERO is not set -# CONFIG_DM_MULTIPATH is not set -# CONFIG_DM_DELAY is not set -# CONFIG_DM_UEVENT is not set -# CONFIG_DM_FLAKEY is not set -# CONFIG_DM_VERITY is not set -# CONFIG_TARGET_CORE is not set -# CONFIG_FUSION is not set - -# -# IEEE 1394 (FireWire) support -# -# CONFIG_FIREWIRE is not set -# CONFIG_FIREWIRE_NOSY is not set -# CONFIG_I2O is not set -CONFIG_NETDEVICES=y -CONFIG_NET_CORE=y -CONFIG_BONDING=y -# CONFIG_DUMMY is not set -# CONFIG_EQUALIZER is not set -# CONFIG_NET_FC is not set -CONFIG_MII=m -CONFIG_NET_TEAM=m -# CONFIG_NET_TEAM_MODE_BROADCAST is not set -# CONFIG_NET_TEAM_MODE_ROUNDROBIN is not set -# CONFIG_NET_TEAM_MODE_RANDOM is not set -# CONFIG_NET_TEAM_MODE_ACTIVEBACKUP is not set -# CONFIG_NET_TEAM_MODE_LOADBALANCE is not set -CONFIG_MACVLAN=y -CONFIG_MACVTAP=y -CONFIG_VXLAN=y -# CONFIG_NETCONSOLE is not set -# CONFIG_NETPOLL is not set -# CONFIG_NET_POLL_CONTROLLER is not set -CONFIG_TUN=m -CONFIG_VETH=y -# CONFIG_ARCNET is not set - -# -# CAIF transport drivers -# - -# -# Distributed Switch Architecture drivers -# -# CONFIG_NET_DSA_MV88E6XXX is not set -# CONFIG_NET_DSA_MV88E6060 is not set -# CONFIG_NET_DSA_MV88E6XXX_NEED_PPU is not set -# CONFIG_NET_DSA_MV88E6131 is not set -# CONFIG_NET_DSA_MV88E6123_61_65 is not set -CONFIG_ETHERNET=y -CONFIG_NET_VENDOR_3COM=y -# CONFIG_VORTEX is not set -# CONFIG_TYPHOON is not set -CONFIG_NET_VENDOR_ADAPTEC=y -# CONFIG_ADAPTEC_STARFIRE is not set -CONFIG_NET_VENDOR_ALTEON=y -# CONFIG_ACENIC is not set -CONFIG_NET_VENDOR_AMD=y -# CONFIG_AMD8111_ETH is not set -# CONFIG_PCNET32 is not set -CONFIG_NET_VENDOR_ATHEROS=y -# CONFIG_ATL2 is not set -# CONFIG_ATL1 is not set -# CONFIG_ATL1E is not set -# CONFIG_ATL1C is not set -# CONFIG_ALX is not set -CONFIG_NET_CADENCE=y -# CONFIG_ARM_AT91_ETHER is not set -# CONFIG_MACB is not set -CONFIG_NET_VENDOR_BROADCOM=y -# CONFIG_B44 is not set -# CONFIG_BNX2 is not set -# CONFIG_CNIC is not set -# CONFIG_TIGON3 is not set -# CONFIG_BNX2X is not set -CONFIG_NET_VENDOR_BROCADE=y -# CONFIG_BNA is not set -# CONFIG_NET_CALXEDA_XGMAC is not set -CONFIG_NET_VENDOR_CHELSIO=y -# CONFIG_CHELSIO_T1 is not set -# CONFIG_CHELSIO_T3 is not set -# CONFIG_CHELSIO_T4 is not set -# CONFIG_CHELSIO_T4VF is not set -CONFIG_NET_VENDOR_CIRRUS=y -# CONFIG_CS89x0 is not set -CONFIG_NET_VENDOR_CISCO=y -# CONFIG_ENIC is not set -# CONFIG_DM9000 is not set -# CONFIG_DNET is not set -CONFIG_NET_VENDOR_DEC=y -# CONFIG_NET_TULIP is not set -CONFIG_NET_VENDOR_DLINK=y -# CONFIG_DL2K is not set -# CONFIG_SUNDANCE is not set -CONFIG_NET_VENDOR_EMULEX=y -# CONFIG_BE2NET is not set -CONFIG_NET_VENDOR_EXAR=y -# CONFIG_S2IO is not set -# CONFIG_VXGE is not set -CONFIG_NET_VENDOR_FARADAY=y -# CONFIG_FTMAC100 is not set -# CONFIG_FTGMAC100 is not set -CONFIG_NET_VENDOR_HP=y -# CONFIG_HP100 is not set -CONFIG_NET_VENDOR_INTEL=y -# CONFIG_E100 is not set -CONFIG_E1000=y -CONFIG_E1000E=y -# CONFIG_IGB is not set -# CONFIG_IGBVF is not set -# CONFIG_IXGB is not set -# CONFIG_IXGBE is not set -CONFIG_NET_VENDOR_I825XX=y -# CONFIG_IP1000 is not set -# CONFIG_JME is not set -CONFIG_NET_VENDOR_MARVELL=y -# CONFIG_MV643XX_ETH is not set -CONFIG_MVMDIO=y -CONFIG_MVNETA=y -CONFIG_MVPP2=y -# CONFIG_SKGE is not set -# CONFIG_SKY2 is not set -CONFIG_NET_VENDOR_MVEBU=y - -# -# Marvell Network SKB Features -# -CONFIG_NET_SKB_HEADROOM=64 -CONFIG_NET_SKB_RECYCLE=y - -# -# Marvell DSOHO SDT Features -# -# CONFIG_MV_INCLUDE_SWITCH is not set - -# -# Marvell Network PON Support -# -# CONFIG_MV_INCLUDE_PON is not set - -# -# Marvell Network Debug Control -# -CONFIG_MV_ETH_DEBUG_CODE=y -CONFIG_MV_ETH_INCLUDE_PHY=y -CONFIG_MV_ETH_INCLUDE_NETMUX=y -CONFIG_MV_ETH_NETA=y -CONFIG_MV_ETH_PORTS_NUM=4 - -# -# BM configuration -# -CONFIG_MV_ETH_BM=y -CONFIG_MV_ETH_BM_CPU=y -CONFIG_MV_ETH_BM_0_PKT_SIZE=0 -CONFIG_MV_ETH_BM_1_PKT_SIZE=0 -CONFIG_MV_ETH_BM_2_PKT_SIZE=0 -CONFIG_MV_ETH_BM_3_PKT_SIZE=0 -CONFIG_MV_ETH_BM_PORT_0=y -CONFIG_MV_ETH_BM_PORT_0_LONG_POOL=0 -CONFIG_MV_ETH_BM_PORT_0_SHORT_POOL=0 -CONFIG_MV_ETH_BM_PORT_0_LONG_BUF_NUM=2048 -CONFIG_MV_ETH_BM_PORT_1=y -CONFIG_MV_ETH_BM_PORT_1_LONG_POOL=1 -CONFIG_MV_ETH_BM_PORT_1_SHORT_POOL=1 -CONFIG_MV_ETH_BM_PORT_1_LONG_BUF_NUM=2048 -CONFIG_MV_ETH_BM_PORT_2=y -CONFIG_MV_ETH_BM_PORT_2_LONG_POOL=2 -CONFIG_MV_ETH_BM_PORT_2_SHORT_POOL=2 -CONFIG_MV_ETH_BM_PORT_2_LONG_BUF_NUM=2048 -CONFIG_MV_ETH_BM_PORT_3=y -CONFIG_MV_ETH_BM_PORT_3_LONG_POOL=3 -CONFIG_MV_ETH_BM_PORT_3_SHORT_POOL=3 -CONFIG_MV_ETH_BM_PORT_3_LONG_BUF_NUM=2048 -CONFIG_MV_ETH_PNC=y -CONFIG_MV_ETH_PNC_MCAST_NUM=8 -CONFIG_MV_ETH_PNC_VLAN_PRIO=7 -CONFIG_MV_ETH_PNC_ETYPE=0 -CONFIG_MV_ETH_PNC_DSCP_PRIO=16 -# CONFIG_MV_ETH_PNC_L3_FLOW is not set -CONFIG_MV_ETH_PNC_WOL=y -# CONFIG_MV_ETH_HWF is not set - -# -# Network Interface configuration -# -CONFIG_MV_ETH_0_MTU=1500 -CONFIG_MV_ETH_0_MACADDR="00:00:00:00:00:80" -CONFIG_MV_ETH_1_MTU=1500 -CONFIG_MV_ETH_1_MACADDR="00:00:00:00:00:81" -CONFIG_MV_ETH_2_MTU=1500 -CONFIG_MV_ETH_2_MACADDR="00:00:00:00:00:82" -CONFIG_MV_ETH_3_MTU=1500 -CONFIG_MV_ETH_3_MACADDR="00:00:00:00:00:83" - -# -# Rx/Tx Queue configuration -# -CONFIG_MV_ETH_RXQ=8 -CONFIG_MV_ETH_TXQ=8 -CONFIG_MV_ETH_RXQ_DESC=256 -CONFIG_MV_ETH_RXQ_DEF=0 -CONFIG_MV_ETH_TXQ_DESC=532 -CONFIG_MV_ETH_TXQ_DEF=0 - -# -# IP/TCP/UDP Offloading -# -CONFIG_MV_ETH_TX_CSUM_OFFLOAD=y -CONFIG_MV_ETH_TX_CSUM_OFFLOAD_DEF=y -CONFIG_MV_ETH_RX_CSUM_OFFLOAD=y -CONFIG_MV_ETH_RX_CSUM_OFFLOAD_DEF=y -CONFIG_MV_ETH_GRO=y -CONFIG_MV_ETH_GRO_DEF=y -CONFIG_MV_ETH_TSO=y -CONFIG_MV_ETH_TSO_DEF=y - -# -# Control and Statistics -# -CONFIG_MV_NETA_DEBUG_CODE=y -CONFIG_MV_ETH_STAT_ERR=y -CONFIG_MV_ETH_STAT_INF=y -CONFIG_MV_ETH_STAT_DBG=y -# CONFIG_MV_ETH_STAT_DIST is not set -# CONFIG_MV_LINUX_COUNTERS_DISABLE is not set - -# -# Advanced Features -# -CONFIG_MV_NETA_SKB_RECYCLE=y -CONFIG_MV_NETA_SKB_RECYCLE_DEF=0 -CONFIG_MV_NETA_TXDONE_PROCESS_METHOD=y -# CONFIG_MV_NETA_TXDONE_ISR is not set -# CONFIG_MV_NETA_TXDONE_IN_TIMER is not set -CONFIG_MV_NETA_TXDONE_IN_HRTIMER=y -CONFIG_MV_NETA_TX_DONE_HIGH_RES_TIMER_PERIOD=1000 -CONFIG_MV_ETH_TXDONE_COAL_PKTS=16 -CONFIG_MV_ETH_RX_COAL_PKTS=32 -CONFIG_MV_ETH_RX_COAL_USEC=100 -# CONFIG_MV_ETH_RX_DESC_PREFETCH is not set -# CONFIG_MV_ETH_RX_PKT_PREFETCH is not set -# CONFIG_MV_ETH_RX_SPECIAL is not set -# CONFIG_MV_ETH_TX_SPECIAL is not set -# CONFIG_MV_ETH_L2FW is not set -CONFIG_MV_ETH_RX_POLL_WEIGHT=64 -CONFIG_MV_ETH_EXTRA_BUF_SIZE=120 -CONFIG_MV_ETH_EXTRA_BUF_NUM=532 -CONFIG_MV_ETH_NAPI=y -CONFIG_MV_ETH_NAPI_GROUPS=4 - -# -# NAPI group #0 configuration -# -CONFIG_MV_ETH_GROUP0_CPU=0xf -CONFIG_MV_ETH_GROUP0_RXQ=0xff - -# -# NAPI group #1 configuration -# -CONFIG_MV_ETH_GROUP1_CPU=0x0 -CONFIG_MV_ETH_GROUP1_RXQ=0x0 - -# -# NAPI group #2 configuration -# -CONFIG_MV_ETH_GROUP2_CPU=0x0 -CONFIG_MV_ETH_GROUP2_RXQ=0x0 - -# -# NAPI group #3 configuration -# -CONFIG_MV_ETH_GROUP3_CPU=0x0 -CONFIG_MV_ETH_GROUP3_RXQ=0x0 - -# -# PON support for Network driver -# - -# -# ERRATA / WA -# -CONFIG_MV_ETH_PP2=y -CONFIG_MV_PP2_HWF=y -CONFIG_MV_ETH_PP2_CLS2=y -CONFIG_MV_ETH_PP2_CLS3=y -CONFIG_MV_ETH_PP2_CLS4=y -CONFIG_MV_ETH_PP2_CLS_MC=y - -# -# PP2 BM configuration -# -CONFIG_MV_PP2_BM_SWF_HWF_MODE=y -# CONFIG_MV_PP2_BM_PER_PORT_MODE is not set -CONFIG_MV_PP2_BM_LONG_BUF_NUM=1024 -CONFIG_MV_PP2_BM_SHORT_BUF_NUM=2048 - -# -# PP2 Rx/Tx Queue configuration -# -CONFIG_MV_PP2_RXQ=8 -CONFIG_MV_PP2_TXQ=8 -CONFIG_MV_PP2_RXQ_DESC=256 -CONFIG_MV_PP2_RXQ_DEF=0 -CONFIG_MV_PP2_TXQ_DESC=1024 -CONFIG_MV_PP2_TXQ_DEF=0 -CONFIG_MV_PP2_TXQ_CPU_CHUNK=64 -CONFIG_MV_PP2_AGGR_TXQ_SIZE=256 -CONFIG_MV_PP2_TEMP_TXQ_SIZE=512 -CONFIG_MV_PP2_TEMP_TXQ_HWF_SIZE=256 - -# -# PP2 IP/TCP/UDP Offloading -# -CONFIG_MV_PP2_TSO=y - -# -# PP2 Control and Statistics -# -CONFIG_MV_PP2_DEBUG_CODE=y -CONFIG_MV_PP2_STAT_ERR=y -CONFIG_MV_PP2_STAT_INF=y -CONFIG_MV_PP2_STAT_DBG=y -# CONFIG_MV_PP2_STAT_DIST is not set - -# -# PP2 Advanced Features -# -CONFIG_MV_PP2_SKB_RECYCLE=y -CONFIG_MV_PP2_SKB_RECYCLE_DEF=0 -CONFIG_MV_PP2_TXDONE_PROCESS_METHOD=y -# CONFIG_MV_PP2_TXDONE_ISR is not set -# CONFIG_MV_PP2_TXDONE_IN_TIMER is not set -CONFIG_MV_PP2_TXDONE_IN_HRTIMER=y -CONFIG_MV_PP2_TX_DONE_HIGH_RES_TIMER_PERIOD=1000 -CONFIG_MV_PP2_TXDONE_COAL_PKTS=16 -CONFIG_MV_PP2_RX_COAL_PKTS=32 -CONFIG_MV_PP2_RX_COAL_USEC=100 -# CONFIG_MV_PP2_RX_DESC_PREFETCH is not set -# CONFIG_MV_PP2_RX_PKT_PREFETCH is not set -# CONFIG_MV_PP2_RX_SPECIAL is not set -# CONFIG_MV_PP2_TX_SPECIAL is not set -# CONFIG_MV_PP2_L2FW is not set -CONFIG_MV_PP2_RX_POLL_WEIGHT=64 -CONFIG_MV_PP2_EXTRA_BUF_SIZE=120 -CONFIG_MV_PP2_EXTRA_BUF_NUM=1024 - -# -# PP2 PON support -# - -# -# PP2 ERRATA / WA -# -CONFIG_MV_PP2_SWF_HWF_CORRUPTION_WA=y - -# -# PP2 CPH support -# - -# -# CPH Driver Options -# -CONFIG_MV_INCLUDE_PRESTERA=y -CONFIG_MV_INCLUDE_PRESTERA_PCI=y -CONFIG_MV_INCLUDE_PRESTERA_KERNELEXT=y -CONFIG_NET_VENDOR_MELLANOX=y -# CONFIG_MLX4_EN is not set -# CONFIG_MLX4_CORE is not set -CONFIG_NET_VENDOR_MICREL=y -# CONFIG_KS8842 is not set -# CONFIG_KS8851 is not set -# CONFIG_KS8851_MLL is not set -# CONFIG_KSZ884X_PCI is not set -CONFIG_NET_VENDOR_MICROCHIP=y -# CONFIG_ENC28J60 is not set -CONFIG_NET_VENDOR_MYRI=y -# CONFIG_MYRI10GE is not set -# CONFIG_FEALNX is not set -CONFIG_NET_VENDOR_NATSEMI=y -# CONFIG_NATSEMI is not set -# CONFIG_NS83820 is not set -CONFIG_NET_VENDOR_8390=y -# CONFIG_AX88796 is not set -# CONFIG_NE2K_PCI is not set -CONFIG_NET_VENDOR_NVIDIA=y -# CONFIG_FORCEDETH is not set -CONFIG_NET_VENDOR_OKI=y -# CONFIG_PCH_GBE is not set -# CONFIG_ETHOC is not set -CONFIG_NET_PACKET_ENGINE=y -# CONFIG_HAMACHI is not set -# CONFIG_YELLOWFIN is not set -CONFIG_NET_VENDOR_QLOGIC=y -# CONFIG_QLA3XXX is not set -# CONFIG_QLCNIC is not set -# CONFIG_QLGE is not set -# CONFIG_NETXEN_NIC is not set -CONFIG_NET_VENDOR_REALTEK=y -# CONFIG_8139CP is not set -# CONFIG_8139TOO is not set -# CONFIG_R8169 is not set -CONFIG_NET_VENDOR_RDC=y -# CONFIG_R6040 is not set -CONFIG_NET_VENDOR_SEEQ=y -CONFIG_NET_VENDOR_SILAN=y -# CONFIG_SC92031 is not set -CONFIG_NET_VENDOR_SIS=y -# CONFIG_SIS900 is not set -# CONFIG_SIS190 is not set -# CONFIG_SFC is not set -CONFIG_NET_VENDOR_SMSC=y -# CONFIG_SMC91X is not set -# CONFIG_EPIC100 is not set -# CONFIG_SMC911X is not set -# CONFIG_SMSC911X is not set -# CONFIG_SMSC9420 is not set -CONFIG_NET_VENDOR_STMICRO=y -# CONFIG_STMMAC_ETH is not set -CONFIG_NET_VENDOR_SUN=y -# CONFIG_HAPPYMEAL is not set -# CONFIG_SUNGEM is not set -# CONFIG_CASSINI is not set -# CONFIG_NIU is not set -CONFIG_NET_VENDOR_TEHUTI=y -# CONFIG_TEHUTI is not set -CONFIG_NET_VENDOR_TI=y -# CONFIG_TLAN is not set -CONFIG_NET_VENDOR_VIA=y -# CONFIG_VIA_RHINE is not set -# CONFIG_VIA_VELOCITY is not set -CONFIG_NET_VENDOR_WIZNET=y -# CONFIG_WIZNET_W5100 is not set -# CONFIG_WIZNET_W5300 is not set -# CONFIG_FDDI is not set -# CONFIG_HIPPI is not set -CONFIG_PHYLIB=y - -# -# MII PHY device drivers -# -# CONFIG_AT803X_PHY is not set -# CONFIG_AMD_PHY is not set -CONFIG_MARVELL_PHY=y -# CONFIG_DAVICOM_PHY is not set -# CONFIG_QSEMI_PHY is not set -# CONFIG_LXT_PHY is not set -# CONFIG_CICADA_PHY is not set -# CONFIG_VITESSE_PHY is not set -# CONFIG_SMSC_PHY is not set -# CONFIG_BROADCOM_PHY is not set -# CONFIG_BCM87XX_PHY is not set -# CONFIG_ICPLUS_PHY is not set -# CONFIG_REALTEK_PHY is not set -# CONFIG_NATIONAL_PHY is not set -# CONFIG_STE10XP is not set -# CONFIG_LSI_ET1011C_PHY is not set -# CONFIG_MICREL_PHY is not set -# CONFIG_FIXED_PHY is not set -# CONFIG_MDIO_BITBANG is not set -# CONFIG_MDIO_BUS_MUX_GPIO is not set -# CONFIG_MDIO_BUS_MUX_MMIOREG is not set -# CONFIG_MICREL_KS8995MA is not set -CONFIG_PPP=m -CONFIG_PPP_BSDCOMP=m -CONFIG_PPP_DEFLATE=m -CONFIG_PPP_FILTER=y -CONFIG_PPP_MPPE=m -CONFIG_PPP_MULTILINK=y -CONFIG_PPPOE=m -CONFIG_PPTP=m -CONFIG_PPPOL2TP=m -# CONFIG_PPP_ASYNC is not set -# CONFIG_PPP_SYNC_TTY is not set -# CONFIG_SLIP is not set -CONFIG_SLHC=m - -# -# USB Network Adapters -# -# CONFIG_USB_CATC is not set -# CONFIG_USB_KAWETH is not set -# CONFIG_USB_PEGASUS is not set -# CONFIG_USB_RTL8150 is not set -# CONFIG_USB_RTL8152 is not set -# CONFIG_USB_USBNET is not set -# CONFIG_USB_HSO is not set -# CONFIG_USB_IPHETH is not set -CONFIG_WLAN=y -# CONFIG_LIBERTAS_THINFIRM is not set -# CONFIG_ATMEL is not set -# CONFIG_AT76C50X_USB is not set -# CONFIG_PRISM54 is not set -# CONFIG_USB_ZD1201 is not set -# CONFIG_USB_NET_RNDIS_WLAN is not set -# CONFIG_RTL8180 is not set -# CONFIG_RTL8187 is not set -# CONFIG_ADM8211 is not set -# CONFIG_MAC80211_HWSIM is not set -# CONFIG_MWL8K is not set -CONFIG_ATH_COMMON=m -CONFIG_ATH_CARDS=m -CONFIG_ATH_USER_REGD=y -# CONFIG_ATH_DEBUG is not set -# CONFIG_ATH5K is not set -# CONFIG_ATH5K_PCI is not set -CONFIG_ATH9K_HW=m -CONFIG_ATH9K_COMMON=m -CONFIG_ATH9K_BTCOEX_SUPPORT=y -CONFIG_ATH9K=m -CONFIG_ATH9K_PCI=y -# CONFIG_ATH9K_AHB is not set -# CONFIG_ATH9K_DEBUGFS is not set -CONFIG_ATH9K_LEGACY_RATE_CONTROL=y -# CONFIG_ATH9K_HTC is not set -# CONFIG_CARL9170 is not set -# CONFIG_ATH6KL is not set -# CONFIG_AR5523 is not set -# CONFIG_WIL6210 is not set -CONFIG_B43=m -CONFIG_B43_SSB=y -CONFIG_B43_PCI_AUTOSELECT=y -CONFIG_B43_PCICORE_AUTOSELECT=y -# CONFIG_B43_SDIO is not set -CONFIG_B43_PIO=y -# CONFIG_B43_PHY_N is not set -CONFIG_B43_PHY_LP=y -CONFIG_B43_LEDS=y -CONFIG_B43_HWRNG=y -# CONFIG_B43_DEBUG is not set -CONFIG_B43LEGACY=m -CONFIG_B43LEGACY_PCI_AUTOSELECT=y -CONFIG_B43LEGACY_PCICORE_AUTOSELECT=y -CONFIG_B43LEGACY_LEDS=y -CONFIG_B43LEGACY_HWRNG=y -CONFIG_B43LEGACY_DEBUG=y -CONFIG_B43LEGACY_DMA=y -CONFIG_B43LEGACY_PIO=y -CONFIG_B43LEGACY_DMA_AND_PIO_MODE=y -# CONFIG_B43LEGACY_DMA_MODE is not set -# CONFIG_B43LEGACY_PIO_MODE is not set -# CONFIG_BRCMFMAC is not set -# CONFIG_HOSTAP is not set -# CONFIG_IPW2100 is not set -# CONFIG_IPW2200 is not set -CONFIG_IWLWIFI=m -CONFIG_IWLDVM=m -CONFIG_IWLMVM=m -CONFIG_IWLWIFI_OPMODE_MODULAR=y - -# -# Debugging Options -# -# CONFIG_IWLWIFI_DEBUG is not set -CONFIG_IWLWIFI_P2P=y -# CONFIG_IWL4965 is not set -# CONFIG_IWL3945 is not set -# CONFIG_LIBERTAS is not set -# CONFIG_HERMES is not set -# CONFIG_P54_COMMON is not set -# CONFIG_RT2X00 is not set -# CONFIG_RTLWIFI is not set -# CONFIG_WL_TI is not set -# CONFIG_ZD1211RW is not set -CONFIG_MWIFIEX=m -CONFIG_MWIFIEX_SDIO=m -# CONFIG_MWIFIEX_PCIE is not set -# CONFIG_MWIFIEX_USB is not set - -# -# Enable WiMAX (Networking options) to see the WiMAX drivers -# -# CONFIG_WAN is not set -# CONFIG_VMXNET3 is not set -# CONFIG_ISDN is not set - -# -# Input device support -# -CONFIG_INPUT=y -# CONFIG_INPUT_FF_MEMLESS is not set -# CONFIG_INPUT_POLLDEV is not set -# CONFIG_INPUT_SPARSEKMAP is not set -# CONFIG_INPUT_MATRIXKMAP is not set - -# -# Userland interfaces -# -CONFIG_INPUT_MOUSEDEV=y -CONFIG_INPUT_MOUSEDEV_PSAUX=y -CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 -CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 -# CONFIG_INPUT_JOYDEV is not set -# CONFIG_INPUT_EVDEV is not set -# CONFIG_INPUT_EVBUG is not set - -# -# Input Device Drivers -# -CONFIG_INPUT_KEYBOARD=y -# CONFIG_KEYBOARD_ADP5588 is not set -# CONFIG_KEYBOARD_ADP5589 is not set -CONFIG_KEYBOARD_ATKBD=y -# CONFIG_KEYBOARD_QT1070 is not set -# CONFIG_KEYBOARD_QT2160 is not set -# CONFIG_KEYBOARD_LKKBD is not set -# CONFIG_KEYBOARD_GPIO is not set -# CONFIG_KEYBOARD_TCA6416 is not set -# CONFIG_KEYBOARD_TCA8418 is not set -# CONFIG_KEYBOARD_MATRIX is not set -# CONFIG_KEYBOARD_LM8323 is not set -# CONFIG_KEYBOARD_LM8333 is not set -# CONFIG_KEYBOARD_MAX7359 is not set -# CONFIG_KEYBOARD_MCS is not set -# CONFIG_KEYBOARD_MPR121 is not set -# CONFIG_KEYBOARD_NEWTON is not set -# CONFIG_KEYBOARD_OPENCORES is not set -# CONFIG_KEYBOARD_SAMSUNG is not set -# CONFIG_KEYBOARD_STOWAWAY is not set -# CONFIG_KEYBOARD_SUNKBD is not set -# CONFIG_KEYBOARD_XTKBD is not set -CONFIG_INPUT_MOUSE=y -CONFIG_MOUSE_PS2=y -CONFIG_MOUSE_PS2_ALPS=y -CONFIG_MOUSE_PS2_LOGIPS2PP=y -CONFIG_MOUSE_PS2_SYNAPTICS=y -CONFIG_MOUSE_PS2_CYPRESS=y -CONFIG_MOUSE_PS2_TRACKPOINT=y -# CONFIG_MOUSE_PS2_ELANTECH is not set -# CONFIG_MOUSE_PS2_SENTELIC is not set -# CONFIG_MOUSE_PS2_TOUCHKIT is not set -# CONFIG_MOUSE_SERIAL is not set -# CONFIG_MOUSE_APPLETOUCH is not set -# CONFIG_MOUSE_BCM5974 is not set -# CONFIG_MOUSE_CYAPA is not set -# CONFIG_MOUSE_VSXXXAA is not set -# CONFIG_MOUSE_GPIO is not set -# CONFIG_MOUSE_SYNAPTICS_I2C is not set -# CONFIG_MOUSE_SYNAPTICS_USB is not set -# CONFIG_INPUT_JOYSTICK is not set -# CONFIG_INPUT_TABLET is not set -# CONFIG_INPUT_TOUCHSCREEN is not set -# CONFIG_INPUT_MISC is not set - -# -# Hardware I/O ports -# -CONFIG_SERIO=y -CONFIG_SERIO_SERPORT=y -# CONFIG_SERIO_PCIPS2 is not set -CONFIG_SERIO_LIBPS2=y -# CONFIG_SERIO_RAW is not set -# CONFIG_SERIO_ALTERA_PS2 is not set -# CONFIG_SERIO_PS2MULT is not set -# CONFIG_SERIO_ARC_PS2 is not set -# CONFIG_SERIO_APBPS2 is not set -# CONFIG_GAMEPORT is not set - -# -# Character devices -# -CONFIG_TTY=y -CONFIG_VT=y -CONFIG_CONSOLE_TRANSLATIONS=y -CONFIG_VT_CONSOLE=y -CONFIG_VT_CONSOLE_SLEEP=y -CONFIG_HW_CONSOLE=y -# CONFIG_VT_HW_CONSOLE_BINDING is not set -CONFIG_UNIX98_PTYS=y -CONFIG_DEVPTS_MULTIPLE_INSTANCES=y -CONFIG_LEGACY_PTYS=y -CONFIG_LEGACY_PTY_COUNT=256 -# CONFIG_SERIAL_NONSTANDARD is not set -# CONFIG_NOZOMI is not set -# CONFIG_N_GSM is not set -# CONFIG_TRACE_SINK is not set -CONFIG_DEVKMEM=y - -# -# Serial drivers -# -CONFIG_SERIAL_8250=y -CONFIG_SERIAL_8250_DEPRECATED_OPTIONS=y -CONFIG_SERIAL_8250_CONSOLE=y -CONFIG_SERIAL_8250_DMA=y -CONFIG_SERIAL_8250_PCI=y -CONFIG_SERIAL_8250_NR_UARTS=4 -CONFIG_SERIAL_8250_RUNTIME_UARTS=4 -# CONFIG_SERIAL_8250_EXTENDED is not set -CONFIG_SERIAL_8250_DW=y -# CONFIG_SERIAL_8250_EM is not set - -# -# Non-8250 serial port support -# -# CONFIG_SERIAL_MAX3100 is not set -# CONFIG_SERIAL_MAX310X is not set -# CONFIG_SERIAL_MFD_HSU is not set -CONFIG_SERIAL_CORE=y -CONFIG_SERIAL_CORE_CONSOLE=y -# CONFIG_SERIAL_JSM is not set -# CONFIG_SERIAL_OF_PLATFORM is not set -# CONFIG_SERIAL_SCCNXP is not set -# CONFIG_SERIAL_TIMBERDALE is not set -# CONFIG_SERIAL_ALTERA_JTAGUART is not set -# CONFIG_SERIAL_ALTERA_UART is not set -# CONFIG_SERIAL_IFX6X60 is not set -# CONFIG_SERIAL_PCH_UART is not set -# CONFIG_SERIAL_XILINX_PS_UART is not set -# CONFIG_SERIAL_ARC is not set -# CONFIG_SERIAL_RP2 is not set -# CONFIG_TTY_PRINTK is not set -# CONFIG_HVC_DCC is not set -# CONFIG_IPMI_HANDLER is not set -CONFIG_HW_RANDOM=m -# CONFIG_HW_RANDOM_TIMERIOMEM is not set -# CONFIG_HW_RANDOM_ATMEL is not set -# CONFIG_HW_RANDOM_EXYNOS is not set -# CONFIG_R3964 is not set -# CONFIG_APPLICOM is not set -# CONFIG_RAW_DRIVER is not set -# CONFIG_TCG_TPM is not set -CONFIG_DEVPORT=y -CONFIG_I2C=y -CONFIG_I2C_BOARDINFO=y -CONFIG_I2C_COMPAT=y -CONFIG_I2C_CHARDEV=y -# CONFIG_I2C_MUX is not set -CONFIG_I2C_HELPER_AUTO=y - -# -# I2C Hardware Bus support -# - -# -# PC SMBus host controller drivers -# -# CONFIG_I2C_ALI1535 is not set -# CONFIG_I2C_ALI1563 is not set -# CONFIG_I2C_ALI15X3 is not set -# CONFIG_I2C_AMD756 is not set -# CONFIG_I2C_AMD8111 is not set -# CONFIG_I2C_I801 is not set -# CONFIG_I2C_ISCH is not set -# CONFIG_I2C_PIIX4 is not set -# CONFIG_I2C_NFORCE2 is not set -# CONFIG_I2C_SIS5595 is not set -# CONFIG_I2C_SIS630 is not set -# CONFIG_I2C_SIS96X is not set -# CONFIG_I2C_VIA is not set -# CONFIG_I2C_VIAPRO is not set - -# -# I2C system bus drivers (mostly embedded / system-on-chip) -# -# CONFIG_I2C_CBUS_GPIO is not set -# CONFIG_I2C_DESIGNWARE_PLATFORM is not set -# CONFIG_I2C_DESIGNWARE_PCI is not set -# CONFIG_I2C_EG20T is not set -# CONFIG_I2C_GPIO is not set -# CONFIG_I2C_INTEL_MID is not set -CONFIG_I2C_MV64XXX=y -# CONFIG_I2C_OCORES is not set -# CONFIG_I2C_PCA_PLATFORM is not set -# CONFIG_I2C_PXA_PCI is not set -# CONFIG_I2C_SIMTEC is not set -# CONFIG_I2C_XILINX is not set - -# -# External I2C/SMBus adapter drivers -# -# CONFIG_I2C_DIOLAN_U2C is not set -# CONFIG_I2C_PARPORT_LIGHT is not set -# CONFIG_I2C_TAOS_EVM is not set -# CONFIG_I2C_TINY_USB is not set - -# -# Other I2C/SMBus bus drivers -# -# CONFIG_I2C_STUB is not set -# CONFIG_I2C_DEBUG_CORE is not set -# CONFIG_I2C_DEBUG_ALGO is not set -# CONFIG_I2C_DEBUG_BUS is not set -CONFIG_SPI=y -# CONFIG_SPI_DEBUG is not set -CONFIG_SPI_MASTER=y - -# -# SPI Master Controller Drivers -# -# CONFIG_SPI_ALTERA is not set -# CONFIG_SPI_BITBANG is not set -# CONFIG_SPI_GPIO is not set -# CONFIG_SPI_FSL_SPI is not set -# CONFIG_SPI_OC_TINY is not set -CONFIG_SPI_ORION=y -# CONFIG_SPI_PXA2XX is not set -# CONFIG_SPI_PXA2XX_PCI is not set -# CONFIG_SPI_SC18IS602 is not set -# CONFIG_SPI_TOPCLIFF_PCH is not set -# CONFIG_SPI_XCOMM is not set -# CONFIG_SPI_XILINX is not set -# CONFIG_SPI_DESIGNWARE is not set - -# -# SPI Protocol Masters -# -# CONFIG_SPI_SPIDEV is not set -# CONFIG_SPI_TLE62X0 is not set - -# -# Qualcomm MSM SSBI bus support -# -# CONFIG_SSBI is not set -# CONFIG_HSI is not set - -# -# PPS support -# -CONFIG_PPS=y -# CONFIG_PPS_DEBUG is not set -# CONFIG_NTP_PPS is not set - -# -# PPS clients support -# -# CONFIG_PPS_CLIENT_KTIMER is not set -# CONFIG_PPS_CLIENT_LDISC is not set -# CONFIG_PPS_CLIENT_GPIO is not set - -# -# PPS generators support -# - -# -# PTP clock support -# -CONFIG_PTP_1588_CLOCK=y - -# -# Enable PHYLIB and NETWORK_PHY_TIMESTAMPING to see the additional clocks. -# -# CONFIG_PTP_1588_CLOCK_PCH is not set -CONFIG_PINCTRL=y - -# -# Pin controllers -# -CONFIG_PINMUX=y -CONFIG_PINCONF=y -# CONFIG_DEBUG_PINCTRL is not set -# CONFIG_PINCTRL_SINGLE is not set -# CONFIG_PINCTRL_EXYNOS is not set -# CONFIG_PINCTRL_EXYNOS5440 is not set -CONFIG_PINCTRL_MVEBU=y -CONFIG_PINCTRL_ARMADA_370=y -CONFIG_PINCTRL_ARMADA_375=y -CONFIG_PINCTRL_ARMADA_38X=y -CONFIG_PINCTRL_ARMADA_XP=y -CONFIG_ARCH_HAVE_CUSTOM_GPIO_H=y -CONFIG_ARCH_REQUIRE_GPIOLIB=y -CONFIG_GPIO_DEVRES=y -CONFIG_GPIOLIB=y -CONFIG_OF_GPIO=y -# CONFIG_DEBUG_GPIO is not set -CONFIG_GPIO_SYSFS=y -CONFIG_GPIO_GENERIC=y - -# -# Memory mapped GPIO drivers: -# -# CONFIG_GPIO_GENERIC_PLATFORM is not set -# CONFIG_GPIO_EM is not set -CONFIG_GPIO_MVEBU=y -# CONFIG_GPIO_RCAR is not set -# CONFIG_GPIO_TS5500 is not set -# CONFIG_GPIO_VX855 is not set -# CONFIG_GPIO_GRGPIO is not set - -# -# I2C GPIO expanders: -# -# CONFIG_GPIO_MAX7300 is not set -# CONFIG_GPIO_MAX732X is not set -# CONFIG_GPIO_PCA953X_IRQ is not set -# CONFIG_GPIO_PCF857X is not set -# CONFIG_GPIO_SX150X is not set -# CONFIG_GPIO_ADP5588 is not set -# CONFIG_GPIO_ADNP is not set - -# -# PCI GPIO expanders: -# -# CONFIG_GPIO_BT8XX is not set -# CONFIG_GPIO_AMD8111 is not set -# CONFIG_GPIO_ML_IOH is not set -# CONFIG_GPIO_RDC321X is not set - -# -# SPI GPIO expanders: -# -# CONFIG_GPIO_MAX7301 is not set -# CONFIG_GPIO_MCP23S08 is not set -# CONFIG_GPIO_MC33880 is not set -# CONFIG_GPIO_74X164 is not set - -# -# AC97 GPIO expanders: -# - -# -# MODULbus GPIO expanders: -# - -# -# USB GPIO expanders: -# -CONFIG_W1=m - -# -# 1-wire Bus Masters -# -# CONFIG_W1_MASTER_MATROX is not set -# CONFIG_W1_MASTER_DS2490 is not set -# CONFIG_W1_MASTER_DS2482 is not set -# CONFIG_W1_MASTER_DS1WM is not set -# CONFIG_W1_MASTER_GPIO is not set - -# -# 1-wire Slaves -# -# CONFIG_W1_SLAVE_THERM is not set -# CONFIG_W1_SLAVE_SMEM is not set -# CONFIG_W1_SLAVE_DS2408 is not set -# CONFIG_W1_SLAVE_DS2413 is not set -# CONFIG_W1_SLAVE_DS2423 is not set -# CONFIG_W1_SLAVE_DS2431 is not set -# CONFIG_W1_SLAVE_DS2433 is not set -# CONFIG_W1_SLAVE_DS2760 is not set -# CONFIG_W1_SLAVE_DS2780 is not set -# CONFIG_W1_SLAVE_DS2781 is not set -# CONFIG_W1_SLAVE_DS28E04 is not set -# CONFIG_W1_SLAVE_BQ27000 is not set -# CONFIG_POWER_SUPPLY is not set -# CONFIG_POWER_AVS is not set -CONFIG_HWMON=y -# CONFIG_HWMON_VID is not set -# CONFIG_HWMON_DEBUG_CHIP is not set - -# -# Native drivers -# -# CONFIG_SENSORS_AD7314 is not set -# CONFIG_SENSORS_AD7414 is not set -# CONFIG_SENSORS_AD7418 is not set -# CONFIG_SENSORS_ADCXX is not set -# CONFIG_SENSORS_ADM1021 is not set -# CONFIG_SENSORS_ADM1025 is not set -# CONFIG_SENSORS_ADM1026 is not set -# CONFIG_SENSORS_ADM1029 is not set -# CONFIG_SENSORS_ADM1031 is not set -# CONFIG_SENSORS_ADM9240 is not set -# CONFIG_SENSORS_ADT7310 is not set -# CONFIG_SENSORS_ADT7410 is not set -# CONFIG_SENSORS_ADT7411 is not set -# CONFIG_SENSORS_ADT7462 is not set -# CONFIG_SENSORS_ADT7470 is not set -# CONFIG_SENSORS_ADT7475 is not set -# CONFIG_SENSORS_ASC7621 is not set -# CONFIG_SENSORS_ATXP1 is not set -# CONFIG_SENSORS_DS620 is not set -# CONFIG_SENSORS_DS1621 is not set -# CONFIG_SENSORS_I5K_AMB is not set -# CONFIG_SENSORS_F71805F is not set -# CONFIG_SENSORS_F71882FG is not set -# CONFIG_SENSORS_F75375S is not set -# CONFIG_SENSORS_G760A is not set -# CONFIG_SENSORS_GL518SM is not set -# CONFIG_SENSORS_GL520SM is not set -# CONFIG_SENSORS_GPIO_FAN is not set -# CONFIG_SENSORS_HIH6130 is not set -# CONFIG_SENSORS_IT87 is not set -# CONFIG_SENSORS_JC42 is not set -# CONFIG_SENSORS_LINEAGE is not set -# CONFIG_SENSORS_LM63 is not set -# CONFIG_SENSORS_LM70 is not set -# CONFIG_SENSORS_LM73 is not set -# CONFIG_SENSORS_LM75 is not set -# CONFIG_SENSORS_LM77 is not set -# CONFIG_SENSORS_LM78 is not set -# CONFIG_SENSORS_LM80 is not set -# CONFIG_SENSORS_LM83 is not set -# CONFIG_SENSORS_LM85 is not set -# CONFIG_SENSORS_LM87 is not set -# CONFIG_SENSORS_LM90 is not set -# CONFIG_SENSORS_LM92 is not set -# CONFIG_SENSORS_LM93 is not set -# CONFIG_SENSORS_LTC4151 is not set -# CONFIG_SENSORS_LTC4215 is not set -# CONFIG_SENSORS_LTC4245 is not set -# CONFIG_SENSORS_LTC4261 is not set -# CONFIG_SENSORS_LM95234 is not set -# CONFIG_SENSORS_LM95241 is not set -# CONFIG_SENSORS_LM95245 is not set -# CONFIG_SENSORS_MAX1111 is not set -# CONFIG_SENSORS_MAX16065 is not set -# CONFIG_SENSORS_MAX1619 is not set -# CONFIG_SENSORS_MAX1668 is not set -# CONFIG_SENSORS_MAX197 is not set -# CONFIG_SENSORS_MAX6639 is not set -# CONFIG_SENSORS_MAX6642 is not set -# CONFIG_SENSORS_MAX6650 is not set -# CONFIG_SENSORS_MAX6697 is not set -# CONFIG_SENSORS_MCP3021 is not set -# CONFIG_SENSORS_NCT6775 is not set -# CONFIG_SENSORS_NTC_THERMISTOR is not set -# CONFIG_SENSORS_PC87360 is not set -# CONFIG_SENSORS_PC87427 is not set -# CONFIG_SENSORS_PCF8591 is not set -# CONFIG_PMBUS is not set -# CONFIG_SENSORS_SHT15 is not set -# CONFIG_SENSORS_SHT21 is not set -# CONFIG_SENSORS_SIS5595 is not set -# CONFIG_SENSORS_SMM665 is not set -# CONFIG_SENSORS_DME1737 is not set -# CONFIG_SENSORS_EMC1403 is not set -# CONFIG_SENSORS_EMC2103 is not set -# CONFIG_SENSORS_EMC6W201 is not set -# CONFIG_SENSORS_SMSC47M1 is not set -# CONFIG_SENSORS_SMSC47M192 is not set -# CONFIG_SENSORS_SMSC47B397 is not set -# CONFIG_SENSORS_SCH56XX_COMMON is not set -# CONFIG_SENSORS_SCH5627 is not set -# CONFIG_SENSORS_SCH5636 is not set -# CONFIG_SENSORS_ADS1015 is not set -# CONFIG_SENSORS_ADS7828 is not set -# CONFIG_SENSORS_ADS7871 is not set -# CONFIG_SENSORS_AMC6821 is not set -# CONFIG_SENSORS_INA209 is not set -# CONFIG_SENSORS_INA2XX is not set -# CONFIG_SENSORS_THMC50 is not set -# CONFIG_SENSORS_TMP102 is not set -# CONFIG_SENSORS_TMP401 is not set -# CONFIG_SENSORS_TMP421 is not set -# CONFIG_SENSORS_VIA686A is not set -# CONFIG_SENSORS_VT1211 is not set -# CONFIG_SENSORS_VT8231 is not set -# CONFIG_SENSORS_W83781D is not set -# CONFIG_SENSORS_W83791D is not set -# CONFIG_SENSORS_W83792D is not set -# CONFIG_SENSORS_W83793 is not set -# CONFIG_SENSORS_W83795 is not set -# CONFIG_SENSORS_W83L785TS is not set -# CONFIG_SENSORS_W83L786NG is not set -# CONFIG_SENSORS_W83627HF is not set -# CONFIG_SENSORS_W83627EHF is not set -CONFIG_THERMAL=y -CONFIG_THERMAL_HWMON=y -CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y -# CONFIG_THERMAL_DEFAULT_GOV_FAIR_SHARE is not set -# CONFIG_THERMAL_DEFAULT_GOV_USER_SPACE is not set -# CONFIG_THERMAL_GOV_FAIR_SHARE is not set -CONFIG_THERMAL_GOV_STEP_WISE=y -# CONFIG_THERMAL_GOV_USER_SPACE is not set -# CONFIG_THERMAL_EMULATION is not set -CONFIG_ARMADA_THERMAL=y -CONFIG_WATCHDOG=y -CONFIG_WATCHDOG_CORE=y -# CONFIG_WATCHDOG_NOWAYOUT is not set - -# -# Watchdog Device Drivers -# -# CONFIG_SOFT_WATCHDOG is not set -# CONFIG_DW_WATCHDOG is not set -# CONFIG_MPCORE_WATCHDOG is not set -CONFIG_ORION_WATCHDOG=y -# CONFIG_MAX63XX_WATCHDOG is not set -# CONFIG_ALIM7101_WDT is not set -# CONFIG_I6300ESB_WDT is not set - -# -# PCI-based Watchdog Cards -# -# CONFIG_PCIPCWATCHDOG is not set -# CONFIG_WDTPCI is not set - -# -# USB-based Watchdog Cards -# -# CONFIG_USBPCWATCHDOG is not set -CONFIG_SSB_POSSIBLE=y - -# -# Sonics Silicon Backplane -# -CONFIG_SSB=m -CONFIG_SSB_SPROM=y -CONFIG_SSB_BLOCKIO=y -CONFIG_SSB_PCIHOST_POSSIBLE=y -CONFIG_SSB_PCIHOST=y -CONFIG_SSB_B43_PCI_BRIDGE=y -CONFIG_SSB_SDIOHOST_POSSIBLE=y -# CONFIG_SSB_SDIOHOST is not set -# CONFIG_SSB_SILENT is not set -# CONFIG_SSB_DEBUG is not set -CONFIG_SSB_DRIVER_PCICORE_POSSIBLE=y -CONFIG_SSB_DRIVER_PCICORE=y -# CONFIG_SSB_DRIVER_GPIO is not set -CONFIG_BCMA_POSSIBLE=y - -# -# Broadcom specific AMBA -# -# CONFIG_BCMA is not set - -# -# Multifunction device drivers -# -# CONFIG_MFD_CORE is not set -# CONFIG_MFD_AS3711 is not set -# CONFIG_PMIC_ADP5520 is not set -# CONFIG_MFD_AAT2870_CORE is not set -# CONFIG_MFD_CROS_EC is not set -# CONFIG_MFD_ASIC3 is not set -# CONFIG_PMIC_DA903X is not set -# CONFIG_MFD_DA9052_SPI is not set -# CONFIG_MFD_DA9052_I2C is not set -# CONFIG_MFD_DA9055 is not set -# CONFIG_MFD_MC13XXX_SPI is not set -# CONFIG_MFD_MC13XXX_I2C is not set -# CONFIG_HTC_EGPIO is not set -# CONFIG_HTC_PASIC3 is not set -# CONFIG_HTC_I2CPLD is not set -# CONFIG_LPC_ICH is not set -# CONFIG_LPC_SCH is not set -# CONFIG_MFD_JANZ_CMODIO is not set -# CONFIG_MFD_88PM800 is not set -# CONFIG_MFD_88PM805 is not set -# CONFIG_MFD_88PM860X is not set -# CONFIG_MFD_MAX77686 is not set -# CONFIG_MFD_MAX77693 is not set -# CONFIG_MFD_MAX8907 is not set -# CONFIG_MFD_MAX8925 is not set -# CONFIG_MFD_MAX8997 is not set -# CONFIG_MFD_MAX8998 is not set -# CONFIG_EZX_PCAP is not set -# CONFIG_MFD_VIPERBOARD is not set -# CONFIG_MFD_RETU is not set -# CONFIG_MFD_PCF50633 is not set -# CONFIG_MFD_RDC321X is not set -# CONFIG_MFD_RTSX_PCI is not set -# CONFIG_MFD_RC5T583 is not set -# CONFIG_MFD_SEC_CORE is not set -# CONFIG_MFD_SI476X_CORE is not set -# CONFIG_MFD_SM501 is not set -# CONFIG_MFD_SMSC is not set -# CONFIG_ABX500_CORE is not set -# CONFIG_MFD_STMPE is not set -# CONFIG_MFD_SYSCON is not set -# CONFIG_MFD_TI_AM335X_TSCADC is not set -# CONFIG_MFD_LP8788 is not set -# CONFIG_MFD_PALMAS is not set -# CONFIG_TPS6105X is not set -# CONFIG_TPS65010 is not set -# CONFIG_TPS6507X is not set -# CONFIG_MFD_TPS65090 is not set -# CONFIG_MFD_TPS65217 is not set -# CONFIG_MFD_TPS6586X is not set -# CONFIG_MFD_TPS65910 is not set -# CONFIG_MFD_TPS65912 is not set -# CONFIG_MFD_TPS65912_I2C is not set -# CONFIG_MFD_TPS65912_SPI is not set -# CONFIG_MFD_TPS80031 is not set -# CONFIG_TWL4030_CORE is not set -# CONFIG_TWL6040_CORE is not set -# CONFIG_MFD_WL1273_CORE is not set -# CONFIG_MFD_LM3533 is not set -# CONFIG_MFD_TIMBERDALE is not set -# CONFIG_MFD_TC3589X is not set -# CONFIG_MFD_TMIO is not set -# CONFIG_MFD_T7L66XB is not set -# CONFIG_MFD_TC6387XB is not set -# CONFIG_MFD_TC6393XB is not set -# CONFIG_MFD_VX855 is not set -# CONFIG_MFD_ARIZONA_I2C is not set -# CONFIG_MFD_ARIZONA_SPI is not set -# CONFIG_MFD_WM8400 is not set -# CONFIG_MFD_WM831X_I2C is not set -# CONFIG_MFD_WM831X_SPI is not set -# CONFIG_MFD_WM8350_I2C is not set -# CONFIG_MFD_WM8994 is not set -CONFIG_REGULATOR=y -# CONFIG_REGULATOR_DEBUG is not set -# CONFIG_REGULATOR_DUMMY is not set -CONFIG_REGULATOR_FIXED_VOLTAGE=y -# CONFIG_REGULATOR_VIRTUAL_CONSUMER is not set -# CONFIG_REGULATOR_USERSPACE_CONSUMER is not set -# CONFIG_REGULATOR_GPIO is not set -# CONFIG_REGULATOR_AD5398 is not set -# CONFIG_REGULATOR_FAN53555 is not set -# CONFIG_REGULATOR_ISL6271A is not set -# CONFIG_REGULATOR_MAX1586 is not set -# CONFIG_REGULATOR_MAX8649 is not set -# CONFIG_REGULATOR_MAX8660 is not set -# CONFIG_REGULATOR_MAX8952 is not set -# CONFIG_REGULATOR_MAX8973 is not set -# CONFIG_REGULATOR_LP3971 is not set -# CONFIG_REGULATOR_LP3972 is not set -# CONFIG_REGULATOR_LP872X is not set -# CONFIG_REGULATOR_LP8755 is not set -# CONFIG_REGULATOR_TPS51632 is not set -# CONFIG_REGULATOR_TPS62360 is not set -# CONFIG_REGULATOR_TPS65023 is not set -# CONFIG_REGULATOR_TPS6507X is not set -# CONFIG_REGULATOR_TPS6524X is not set -# CONFIG_MEDIA_SUPPORT is not set - -# -# Graphics support -# -CONFIG_FB_TFT=m -CONFIG_FB_TFT_AGM1264K_FL=m -CONFIG_FB_TFT_BD663474=m -CONFIG_FB_TFT_HX8340BN=m -CONFIG_FB_TFT_HX8347D=m -CONFIG_FB_TFT_HX8353D=m -CONFIG_FB_TFT_ILI9320=m -CONFIG_FB_TFT_ILI9325=m -CONFIG_FB_TFT_ILI9340=m -CONFIG_FB_TFT_ILI9341=m -CONFIG_FB_TFT_ILI9481=m -CONFIG_FB_TFT_ILI9486=m -CONFIG_FB_TFT_PCD8544=m -CONFIG_FB_TFT_RA8875=m -CONFIG_FB_TFT_S6D02A1=m -CONFIG_FB_TFT_S6D1121=m -CONFIG_FB_TFT_SSD1289=m -CONFIG_FB_TFT_SSD1306=m -CONFIG_FB_TFT_SSD1331=m -CONFIG_FB_TFT_SSD1351=m -CONFIG_FB_TFT_ST7735R=m -CONFIG_FB_TFT_TINYLCD=m -CONFIG_FB_TFT_TLS8204=m -CONFIG_FB_TFT_UC1701=m -CONFIG_FB_TFT_UPD161704=m -CONFIG_FB_TFT_WATTEROTT=m -CONFIG_FB_FLEX=m -CONFIG_FB_TFT_FBTFT_DEVICE=m -CONFIG_VGA_ARB=y -CONFIG_VGA_ARB_MAX_GPUS=16 -# CONFIG_DRM is not set -# CONFIG_TEGRA_HOST1X is not set -# CONFIG_VGASTATE is not set -# CONFIG_VIDEO_OUTPUT_CONTROL is not set -CONFIG_FB=m -# CONFIG_FIRMWARE_EDID is not set -# CONFIG_FB_DDC is not set -# CONFIG_FB_BOOT_VESA_SUPPORT is not set -# CONFIG_FB_CFB_FILLRECT is not set -# CONFIG_FB_CFB_COPYAREA is not set -# CONFIG_FB_CFB_IMAGEBLIT is not set -# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set -CONFIG_FB_SYS_FILLRECT=m -CONFIG_FB_SYS_COPYAREA=m -CONFIG_FB_SYS_IMAGEBLIT=m -# CONFIG_FB_FOREIGN_ENDIAN is not set -CONFIG_FB_SYS_FOPS=m -CONFIG_FB_DEFERRED_IO=y -# CONFIG_FB_SVGALIB is not set -# CONFIG_FB_MACMODES is not set -CONFIG_FB_BACKLIGHT=y -# CONFIG_FB_MODE_HELPERS is not set -# CONFIG_FB_TILEBLITTING is not set - -# -# Frame buffer hardware drivers -# -# CONFIG_FB_CIRRUS is not set -# CONFIG_FB_PM2 is not set -# CONFIG_FB_CYBER2000 is not set -# CONFIG_FB_S1D13XXX is not set -# CONFIG_FB_NVIDIA is not set -# CONFIG_FB_RIVA is not set -# CONFIG_FB_I740 is not set -# CONFIG_FB_MATROX is not set -# CONFIG_FB_RADEON is not set -# CONFIG_FB_ATY128 is not set -# CONFIG_FB_ATY is not set -# CONFIG_FB_S3 is not set -# CONFIG_FB_SAVAGE is not set -# CONFIG_FB_SIS is not set -# CONFIG_FB_NEOMAGIC is not set -# CONFIG_FB_KYRO is not set -# CONFIG_FB_3DFX is not set -# CONFIG_FB_VOODOO1 is not set -# CONFIG_FB_VT8623 is not set -# CONFIG_FB_TRIDENT is not set -# CONFIG_FB_ARK is not set -# CONFIG_FB_PM3 is not set -# CONFIG_FB_CARMINE is not set -# CONFIG_FB_SMSCUFX is not set -# CONFIG_FB_UDL is not set -# CONFIG_FB_GOLDFISH is not set -# CONFIG_FB_VIRTUAL is not set -# CONFIG_FB_METRONOME is not set -# CONFIG_FB_MB862XX is not set -# CONFIG_FB_BROADSHEET is not set -# CONFIG_FB_AUO_K190X is not set -# CONFIG_EXYNOS_VIDEO is not set -CONFIG_BACKLIGHT_LCD_SUPPORT=y -CONFIG_LCD_CLASS_DEVICE=m -# CONFIG_LCD_L4F00242T03 is not set -# CONFIG_LCD_LMS283GF05 is not set -# CONFIG_LCD_LTV350QV is not set -# CONFIG_LCD_ILI922X is not set -# CONFIG_LCD_ILI9320 is not set -# CONFIG_LCD_TDO24M is not set -# CONFIG_LCD_VGG2432A4 is not set -# CONFIG_LCD_PLATFORM is not set -# CONFIG_LCD_S6E63M0 is not set -# CONFIG_LCD_LD9040 is not set -# CONFIG_LCD_AMS369FG06 is not set -# CONFIG_LCD_LMS501KF03 is not set -# CONFIG_LCD_HX8357 is not set -CONFIG_BACKLIGHT_CLASS_DEVICE=m -CONFIG_BACKLIGHT_GENERIC=m -# CONFIG_BACKLIGHT_ADP8860 is not set -# CONFIG_BACKLIGHT_ADP8870 is not set -# CONFIG_BACKLIGHT_LM3630 is not set -# CONFIG_BACKLIGHT_LM3639 is not set -# CONFIG_BACKLIGHT_LP855X is not set - -# -# Console display driver support -# -CONFIG_DUMMY_CONSOLE=y -# CONFIG_FRAMEBUFFER_CONSOLE is not set -# CONFIG_LOGO is not set -# CONFIG_FB_SSD1307 is not set -CONFIG_SOUND=y -# CONFIG_SOUND_OSS_CORE is not set -CONFIG_SND=y -CONFIG_SND_TIMER=y -CONFIG_SND_PCM=y -CONFIG_SND_COMPRESS_OFFLOAD=y -CONFIG_SND_JACK=y -# CONFIG_SND_SEQUENCER is not set -# CONFIG_SND_MIXER_OSS is not set -# CONFIG_SND_PCM_OSS is not set -# CONFIG_SND_HRTIMER is not set -# CONFIG_SND_DYNAMIC_MINORS is not set -CONFIG_SND_SUPPORT_OLD_API=y -CONFIG_SND_VERBOSE_PROCFS=y -# CONFIG_SND_VERBOSE_PRINTK is not set -# CONFIG_SND_DEBUG is not set -# CONFIG_SND_RAWMIDI_SEQ is not set -# CONFIG_SND_OPL3_LIB_SEQ is not set -# CONFIG_SND_OPL4_LIB_SEQ is not set -# CONFIG_SND_SBAWE_SEQ is not set -# CONFIG_SND_EMU10K1_SEQ is not set -CONFIG_SND_DRIVERS=y -# CONFIG_SND_DUMMY is not set -# CONFIG_SND_ALOOP is not set -# CONFIG_SND_MTPAV is not set -# CONFIG_SND_SERIAL_U16550 is not set -# CONFIG_SND_MPU401 is not set -CONFIG_SND_PCI=y -# CONFIG_SND_AD1889 is not set -# CONFIG_SND_ALS300 is not set -# CONFIG_SND_ALI5451 is not set -# CONFIG_SND_ATIIXP is not set -# CONFIG_SND_ATIIXP_MODEM is not set -# CONFIG_SND_AU8810 is not set -# CONFIG_SND_AU8820 is not set -# CONFIG_SND_AU8830 is not set -# CONFIG_SND_AW2 is not set -# CONFIG_SND_AZT3328 is not set -# CONFIG_SND_BT87X is not set -# CONFIG_SND_CA0106 is not set -# CONFIG_SND_CMIPCI is not set -# CONFIG_SND_OXYGEN is not set -# CONFIG_SND_CS4281 is not set -# CONFIG_SND_CS46XX is not set -# CONFIG_SND_CS5535AUDIO is not set -# CONFIG_SND_CTXFI is not set -# CONFIG_SND_DARLA20 is not set -# CONFIG_SND_GINA20 is not set -# CONFIG_SND_LAYLA20 is not set -# CONFIG_SND_DARLA24 is not set -# CONFIG_SND_GINA24 is not set -# CONFIG_SND_LAYLA24 is not set -# CONFIG_SND_MONA is not set -# CONFIG_SND_MIA is not set -# CONFIG_SND_ECHO3G is not set -# CONFIG_SND_INDIGO is not set -# CONFIG_SND_INDIGOIO is not set -# CONFIG_SND_INDIGODJ is not set -# CONFIG_SND_INDIGOIOX is not set -# CONFIG_SND_INDIGODJX is not set -# CONFIG_SND_EMU10K1 is not set -# CONFIG_SND_EMU10K1X is not set -# CONFIG_SND_ENS1370 is not set -# CONFIG_SND_ENS1371 is not set -# CONFIG_SND_ES1938 is not set -# CONFIG_SND_ES1968 is not set -# CONFIG_SND_FM801 is not set -# CONFIG_SND_HDA_INTEL is not set -# CONFIG_SND_HDSP is not set -# CONFIG_SND_HDSPM is not set -# CONFIG_SND_ICE1712 is not set -# CONFIG_SND_ICE1724 is not set -# CONFIG_SND_INTEL8X0 is not set -# CONFIG_SND_INTEL8X0M is not set -# CONFIG_SND_KORG1212 is not set -# CONFIG_SND_LOLA is not set -# CONFIG_SND_LX6464ES is not set -# CONFIG_SND_MAESTRO3 is not set -# CONFIG_SND_MIXART is not set -# CONFIG_SND_NM256 is not set -# CONFIG_SND_PCXHR is not set -# CONFIG_SND_RIPTIDE is not set -# CONFIG_SND_RME32 is not set -# CONFIG_SND_RME96 is not set -# CONFIG_SND_RME9652 is not set -# CONFIG_SND_SONICVIBES is not set -# CONFIG_SND_TRIDENT is not set -# CONFIG_SND_VIA82XX is not set -# CONFIG_SND_VIA82XX_MODEM is not set -# CONFIG_SND_VIRTUOSO is not set -# CONFIG_SND_VX222 is not set -# CONFIG_SND_YMFPCI is not set -CONFIG_SND_ARM=y -CONFIG_SND_SPI=y -CONFIG_SND_USB=y -# CONFIG_SND_USB_AUDIO is not set -# CONFIG_SND_USB_UA101 is not set -# CONFIG_SND_USB_CAIAQ is not set -# CONFIG_SND_USB_6FIRE is not set -CONFIG_SND_SOC=y -# CONFIG_SND_ATMEL_SOC is not set -# CONFIG_SND_DESIGNWARE_I2S is not set -CONFIG_SND_KIRKWOOD_SOC=y -CONFIG_SND_KIRKWOOD_SOC_ARMADA370_DB=y -CONFIG_SND_SOC_I2C_AND_SPI=y -# CONFIG_SND_SOC_ALL_CODECS is not set -CONFIG_SND_SOC_CS42L51=y -CONFIG_SND_SOC_SPDIF=y -# CONFIG_SND_SIMPLE_CARD is not set -# CONFIG_SOUND_PRIME is not set - -# -# HID support -# -CONFIG_HID=y -# CONFIG_HIDRAW is not set -# CONFIG_UHID is not set -CONFIG_HID_GENERIC=y - -# -# Special HID drivers -# -# CONFIG_HID_A4TECH is not set -# CONFIG_HID_ACRUX is not set -# CONFIG_HID_APPLE is not set -# CONFIG_HID_APPLEIR is not set -# CONFIG_HID_AUREAL is not set -# CONFIG_HID_BELKIN is not set -# CONFIG_HID_CHERRY is not set -# CONFIG_HID_CHICONY is not set -# CONFIG_HID_PRODIKEYS is not set -# CONFIG_HID_CYPRESS is not set -# CONFIG_HID_DRAGONRISE is not set -# CONFIG_HID_EMS_FF is not set -# CONFIG_HID_ELECOM is not set -# CONFIG_HID_EZKEY is not set -# CONFIG_HID_HOLTEK is not set -# CONFIG_HID_KEYTOUCH is not set -# CONFIG_HID_KYE is not set -# CONFIG_HID_UCLOGIC is not set -# CONFIG_HID_WALTOP is not set -# CONFIG_HID_GYRATION is not set -# CONFIG_HID_ICADE is not set -# CONFIG_HID_TWINHAN is not set -# CONFIG_HID_KENSINGTON is not set -# CONFIG_HID_LCPOWER is not set -# CONFIG_HID_LENOVO_TPKBD is not set -# CONFIG_HID_LOGITECH is not set -# CONFIG_HID_MAGICMOUSE is not set -# CONFIG_HID_MICROSOFT is not set -# CONFIG_HID_MONTEREY is not set -# CONFIG_HID_MULTITOUCH is not set -# CONFIG_HID_NTRIG is not set -# CONFIG_HID_ORTEK is not set -# CONFIG_HID_PANTHERLORD is not set -# CONFIG_HID_PETALYNX is not set -# CONFIG_HID_PICOLCD is not set -# CONFIG_HID_PRIMAX is not set -# CONFIG_HID_PS3REMOTE is not set -# CONFIG_HID_ROCCAT is not set -# CONFIG_HID_SAITEK is not set -# CONFIG_HID_SAMSUNG is not set -# CONFIG_HID_SONY is not set -# CONFIG_HID_SPEEDLINK is not set -# CONFIG_HID_STEELSERIES is not set -# CONFIG_HID_SUNPLUS is not set -# CONFIG_HID_GREENASIA is not set -# CONFIG_HID_SMARTJOYPLUS is not set -# CONFIG_HID_TIVO is not set -# CONFIG_HID_TOPSEED is not set -# CONFIG_HID_THINGM is not set -# CONFIG_HID_THRUSTMASTER is not set -# CONFIG_HID_WACOM is not set -# CONFIG_HID_WIIMOTE is not set -# CONFIG_HID_ZEROPLUS is not set -# CONFIG_HID_ZYDACRON is not set -# CONFIG_HID_SENSOR_HUB is not set - -# -# USB HID support -# -CONFIG_USB_HID=y -# CONFIG_HID_PID is not set -# CONFIG_USB_HIDDEV is not set - -# -# I2C HID support -# -# CONFIG_I2C_HID is not set -CONFIG_USB_ARCH_HAS_OHCI=y -CONFIG_USB_ARCH_HAS_EHCI=y -CONFIG_USB_ARCH_HAS_XHCI=y -CONFIG_USB_SUPPORT=y -CONFIG_USB_COMMON=y -CONFIG_USB_ARCH_HAS_HCD=y -CONFIG_USB=y -# CONFIG_USB_DEBUG is not set -# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set - -# -# Miscellaneous USB options -# -CONFIG_USB_DEFAULT_PERSIST=y -# CONFIG_USB_DYNAMIC_MINORS is not set -# CONFIG_USB_OTG_WHITELIST is not set -# CONFIG_USB_OTG_BLACKLIST_HUB is not set -# CONFIG_USB_MON is not set -# CONFIG_USB_WUSB_CBAF is not set - -# -# USB Host Controller Drivers -# -# CONFIG_USB_C67X00_HCD is not set -CONFIG_USB_XHCI_HCD=y -CONFIG_USB_XHCI_PLATFORM=y -CONFIG_USB_XHCI_MVEBU=y -# CONFIG_USB_XHCI_HCD_DEBUGGING is not set -CONFIG_USB_EHCI_HCD=y -CONFIG_USB_EHCI_ROOT_HUB_TT=y -CONFIG_USB_EHCI_TT_NEWSCHED=y -CONFIG_USB_EHCI_PCI=y -CONFIG_USB_EHCI_HCD_ORION=y -# CONFIG_USB_EHCI_HCD_PLATFORM is not set -# CONFIG_USB_OXU210HP_HCD is not set -# CONFIG_USB_ISP116X_HCD is not set -# CONFIG_USB_ISP1760_HCD is not set -# CONFIG_USB_ISP1362_HCD is not set -# CONFIG_USB_OHCI_HCD is not set -# CONFIG_USB_UHCI_HCD is not set -# CONFIG_USB_SL811_HCD is not set -# CONFIG_USB_R8A66597_HCD is not set -# CONFIG_USB_HCD_SSB is not set - -# -# USB Device Class drivers -# -# CONFIG_USB_ACM is not set -# CONFIG_USB_PRINTER is not set -# CONFIG_USB_WDM is not set -# CONFIG_USB_TMC is not set - -# -# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may -# - -# -# also be needed; see USB_STORAGE Help for more info -# -CONFIG_USB_STORAGE=y -# CONFIG_USB_STORAGE_DEBUG is not set -# CONFIG_USB_STORAGE_REALTEK is not set -# CONFIG_USB_STORAGE_DATAFAB is not set -# CONFIG_USB_STORAGE_FREECOM is not set -# CONFIG_USB_STORAGE_ISD200 is not set -# CONFIG_USB_STORAGE_USBAT is not set -# CONFIG_USB_STORAGE_SDDR09 is not set -# CONFIG_USB_STORAGE_SDDR55 is not set -# CONFIG_USB_STORAGE_JUMPSHOT is not set -# CONFIG_USB_STORAGE_ALAUDA is not set -# CONFIG_USB_STORAGE_ONETOUCH is not set -# CONFIG_USB_STORAGE_KARMA is not set -# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set -# CONFIG_USB_STORAGE_ENE_UB6250 is not set - -# -# USB Imaging devices -# -# CONFIG_USB_MDC800 is not set -# CONFIG_USB_MICROTEK is not set -# CONFIG_USB_DWC3 is not set -# CONFIG_USB_CHIPIDEA is not set - -# -# USB port drivers -# -# CONFIG_USB_SERIAL is not set - -# -# USB Miscellaneous drivers -# -# CONFIG_USB_EMI62 is not set -# CONFIG_USB_EMI26 is not set -# CONFIG_USB_ADUTUX is not set -# CONFIG_USB_SEVSEG is not set -# CONFIG_USB_RIO500 is not set -# CONFIG_USB_LEGOTOWER is not set -# CONFIG_USB_LCD is not set -# CONFIG_USB_LED is not set -# CONFIG_USB_CYPRESS_CY7C63 is not set -# CONFIG_USB_CYTHERM is not set -# CONFIG_USB_IDMOUSE is not set -# CONFIG_USB_FTDI_ELAN is not set -# CONFIG_USB_APPLEDISPLAY is not set -# CONFIG_USB_SISUSBVGA is not set -# CONFIG_USB_LD is not set -# CONFIG_USB_TRANCEVIBRATOR is not set -# CONFIG_USB_IOWARRIOR is not set -# CONFIG_USB_TEST is not set -# CONFIG_USB_ISIGHTFW is not set -# CONFIG_USB_YUREX is not set -# CONFIG_USB_EZUSB_FX2 is not set -# CONFIG_USB_HSIC_USB3503 is not set -CONFIG_USB_PHY=y -CONFIG_NOP_USB_XCEIV=y -# CONFIG_OMAP_CONTROL_USB is not set -# CONFIG_OMAP_USB3 is not set -# CONFIG_SAMSUNG_USBPHY is not set -# CONFIG_SAMSUNG_USB2PHY is not set -# CONFIG_SAMSUNG_USB3PHY is not set -# CONFIG_USB_GPIO_VBUS is not set -# CONFIG_USB_ISP1301 is not set -# CONFIG_USB_RCAR_PHY is not set -# CONFIG_USB_ULPI is not set -# CONFIG_USB_GADGET is not set -# CONFIG_UWB is not set -CONFIG_MMC=y -# CONFIG_MMC_DEBUG is not set -# CONFIG_MMC_UNSAFE_RESUME is not set -# CONFIG_MMC_CLKGATE is not set - -# -# MMC/SD/SDIO Card Drivers -# -CONFIG_MMC_BLOCK=y -CONFIG_MMC_BLOCK_MINORS=8 -CONFIG_MMC_BLOCK_BOUNCE=y -# CONFIG_SDIO_UART is not set -# CONFIG_MMC_TEST is not set - -# -# MMC/SD/SDIO Host Controller Drivers -# -CONFIG_MMC_SDHCI=y -# CONFIG_MMC_SDHCI_PCI is not set -CONFIG_MMC_SDHCI_PLTFM=y -CONFIG_MMC_SDHCI_PXAV3=y -# CONFIG_MMC_SDHCI_PXAV2 is not set -# CONFIG_MMC_TIFM_SD is not set -CONFIG_MMC_MVSDIO=y -# CONFIG_MMC_CB710 is not set -# CONFIG_MMC_VIA_SDMMC is not set -# CONFIG_MMC_DW is not set -# CONFIG_MMC_VUB300 is not set -# CONFIG_MMC_USHC is not set -# CONFIG_MEMSTICK is not set -CONFIG_NEW_LEDS=y -CONFIG_LEDS_CLASS=m - -# -# LED drivers -# -# CONFIG_LEDS_LM3530 is not set -# CONFIG_LEDS_LM3642 is not set -# CONFIG_LEDS_PCA9532 is not set -# CONFIG_LEDS_GPIO is not set -# CONFIG_LEDS_LP3944 is not set -# CONFIG_LEDS_LP5521 is not set -# CONFIG_LEDS_LP5523 is not set -# CONFIG_LEDS_LP5562 is not set -# CONFIG_LEDS_PCA955X is not set -# CONFIG_LEDS_PCA9633 is not set -# CONFIG_LEDS_DAC124S085 is not set -# CONFIG_LEDS_REGULATOR is not set -# CONFIG_LEDS_BD2802 is not set -# CONFIG_LEDS_LT3593 is not set -# CONFIG_LEDS_TCA6507 is not set -# CONFIG_LEDS_LM355x is not set -# CONFIG_LEDS_OT200 is not set -# CONFIG_LEDS_BLINKM is not set - -# -# LED Triggers -# -CONFIG_LEDS_TRIGGERS=y -CONFIG_LEDS_TRIGGER_TIMER=y -# CONFIG_LEDS_TRIGGER_ONESHOT is not set -CONFIG_LEDS_TRIGGER_HEARTBEAT=y -# CONFIG_LEDS_TRIGGER_BACKLIGHT is not set -# CONFIG_LEDS_TRIGGER_CPU is not set -# CONFIG_LEDS_TRIGGER_GPIO is not set -# CONFIG_LEDS_TRIGGER_DEFAULT_ON is not set - -# -# iptables trigger is under Netfilter config (LED target) -# -# CONFIG_LEDS_TRIGGER_TRANSIENT is not set -# CONFIG_LEDS_TRIGGER_CAMERA is not set -# CONFIG_ACCESSIBILITY is not set -# CONFIG_INFINIBAND is not set -# CONFIG_EDAC is not set -CONFIG_RTC_LIB=y -CONFIG_RTC_CLASS=y -CONFIG_RTC_HCTOSYS=y -CONFIG_RTC_SYSTOHC=y -CONFIG_RTC_HCTOSYS_DEVICE="rtc0" -# CONFIG_RTC_DEBUG is not set - -# -# RTC interfaces -# -CONFIG_RTC_INTF_SYSFS=y -CONFIG_RTC_INTF_PROC=y -CONFIG_RTC_INTF_DEV=y -# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set -# CONFIG_RTC_DRV_TEST is not set - -# -# I2C RTC drivers -# -# CONFIG_RTC_DRV_DS1307 is not set -# CONFIG_RTC_DRV_DS1374 is not set -# CONFIG_RTC_DRV_DS1672 is not set -# CONFIG_RTC_DRV_DS3232 is not set -# CONFIG_RTC_DRV_MAX6900 is not set -# CONFIG_RTC_DRV_RS5C372 is not set -# CONFIG_RTC_DRV_ISL1208 is not set -# CONFIG_RTC_DRV_ISL12022 is not set -# CONFIG_RTC_DRV_X1205 is not set -# CONFIG_RTC_DRV_PCF8523 is not set -# CONFIG_RTC_DRV_PCF8563 is not set -# CONFIG_RTC_DRV_PCF8583 is not set -# CONFIG_RTC_DRV_M41T80 is not set -# CONFIG_RTC_DRV_BQ32K is not set -CONFIG_RTC_DRV_S35390A=y -# CONFIG_RTC_DRV_FM3130 is not set -# CONFIG_RTC_DRV_RX8581 is not set -# CONFIG_RTC_DRV_RX8025 is not set -# CONFIG_RTC_DRV_EM3027 is not set -# CONFIG_RTC_DRV_RV3029C2 is not set - -# -# SPI RTC drivers -# -# CONFIG_RTC_DRV_M41T93 is not set -# CONFIG_RTC_DRV_M41T94 is not set -# CONFIG_RTC_DRV_DS1305 is not set -# CONFIG_RTC_DRV_DS1390 is not set -# CONFIG_RTC_DRV_MAX6902 is not set -# CONFIG_RTC_DRV_R9701 is not set -# CONFIG_RTC_DRV_RS5C348 is not set -# CONFIG_RTC_DRV_DS3234 is not set -# CONFIG_RTC_DRV_PCF2123 is not set -# CONFIG_RTC_DRV_RX4581 is not set - -# -# Platform RTC drivers -# -# CONFIG_RTC_DRV_CMOS is not set -# CONFIG_RTC_DRV_DS1286 is not set -# CONFIG_RTC_DRV_DS1511 is not set -# CONFIG_RTC_DRV_DS1553 is not set -# CONFIG_RTC_DRV_DS1742 is not set -# CONFIG_RTC_DRV_STK17TA8 is not set -# CONFIG_RTC_DRV_M48T86 is not set -# CONFIG_RTC_DRV_M48T35 is not set -# CONFIG_RTC_DRV_M48T59 is not set -# CONFIG_RTC_DRV_MSM6242 is not set -# CONFIG_RTC_DRV_BQ4802 is not set -# CONFIG_RTC_DRV_RP5C01 is not set -# CONFIG_RTC_DRV_V3020 is not set -# CONFIG_RTC_DRV_DS2404 is not set - -# -# on-CPU RTC drivers -# -CONFIG_RTC_DRV_MV=y -# CONFIG_RTC_DRV_SNVS is not set - -# -# HID Sensor RTC drivers -# -# CONFIG_RTC_DRV_HID_SENSOR_TIME is not set -CONFIG_DMADEVICES=y -# CONFIG_DMADEVICES_DEBUG is not set - -# -# DMA Devices -# -CONFIG_ASYNC_TX_ENABLE_CHANNEL_SWITCH=y -# CONFIG_DW_DMAC is not set -CONFIG_MV_XOR=y -# CONFIG_MV_MEMCPY is not set -# CONFIG_TIMB_DMA is not set -CONFIG_DMA_ENGINE=y -CONFIG_DMA_OF=y - -# -# DMA Clients -# -CONFIG_ASYNC_TX_DMA=y -# CONFIG_DMATEST is not set -# CONFIG_AUXDISPLAY is not set -# CONFIG_UIO is not set -# CONFIG_VIRT_DRIVERS is not set - -# -# Virtio drivers -# -# CONFIG_VIRTIO_PCI is not set -# CONFIG_VIRTIO_MMIO is not set - -# -# Microsoft Hyper-V guest support -# -# CONFIG_STAGING is not set -CONFIG_CLKDEV_LOOKUP=y -CONFIG_HAVE_CLK_PREPARE=y -CONFIG_COMMON_CLK=y - -# -# Common Clock Framework -# -# CONFIG_COMMON_CLK_DEBUG is not set -# CONFIG_COMMON_CLK_SI5351 is not set -CONFIG_MVEBU_CLK_CORE=y -CONFIG_MVEBU_CLK_CPU=y -CONFIG_MVEBU_CLK_GATING=y -CONFIG_MVEBU_CLK_COREDIV=y - -# -# Hardware Spinlock drivers -# -CONFIG_CLKSRC_OF=y -CONFIG_CLKSRC_MMIO=y -CONFIG_ARMADA_370_XP_TIMER=y -# CONFIG_MAILBOX is not set -# CONFIG_IOMMU_SUPPORT is not set - -# -# Remoteproc drivers -# -# CONFIG_STE_MODEM_RPROC is not set - -# -# Rpmsg drivers -# -# CONFIG_PM_DEVFREQ is not set -# CONFIG_EXTCON is not set -CONFIG_MEMORY=y -CONFIG_MVEBU_DEVBUS=y -# CONFIG_IIO is not set -# CONFIG_VME_BUS is not set -# CONFIG_PWM is not set -CONFIG_IRQCHIP=y -CONFIG_ARM_GIC=y -# CONFIG_IPACK_BUS is not set -CONFIG_RESET_CONTROLLER=y -CONFIG_PHONE=y -CONFIG_MV_INCLUDE_TDM=y - -# -# Marvell Telephony options -# -CONFIG_MV_TDM2C_SUPPORT=y -CONFIG_MV_TDM_EXT_STATS=y - -# -# File systems -# -CONFIG_DCACHE_WORD_ACCESS=y -CONFIG_EXT2_FS=y -# CONFIG_EXT2_FS_XATTR is not set -# CONFIG_EXT2_FS_XIP is not set -CONFIG_EXT3_FS=y -CONFIG_EXT3_DEFAULTS_TO_ORDERED=y -CONFIG_EXT3_FS_XATTR=y -CONFIG_EXT3_FS_POSIX_ACL=y -CONFIG_EXT3_FS_SECURITY=y -CONFIG_EXT4_FS=y -CONFIG_EXT4_FS_POSIX_ACL=y -CONFIG_EXT4_FS_SECURITY=y -# CONFIG_EXT4_DEBUG is not set -CONFIG_JBD=y -# CONFIG_JBD_DEBUG is not set -CONFIG_JBD2=y -# CONFIG_JBD2_DEBUG is not set -CONFIG_FS_MBCACHE=y -# CONFIG_REISERFS_FS is not set -# CONFIG_JFS_FS is not set -# CONFIG_XFS_FS is not set -# CONFIG_GFS2_FS is not set -CONFIG_BTRFS_FS=y -# CONFIG_BTRFS_FS_POSIX_ACL is not set -# CONFIG_BTRFS_FS_CHECK_INTEGRITY is not set -# CONFIG_BTRFS_FS_RUN_SANITY_TESTS is not set -# CONFIG_BTRFS_DEBUG is not set -# CONFIG_NILFS2_FS is not set -CONFIG_FS_POSIX_ACL=y -CONFIG_EXPORTFS=y -CONFIG_FILE_LOCKING=y -CONFIG_FSNOTIFY=y -CONFIG_DNOTIFY=y -CONFIG_INOTIFY_USER=y -# CONFIG_FANOTIFY is not set -# CONFIG_QUOTA is not set -# CONFIG_QUOTACTL is not set -CONFIG_AUTOFS4_FS=y -CONFIG_FUSE_FS=m -CONFIG_CUSE=m -CONFIG_OVERLAYFS_FS=m - -# -# Caches -# -# CONFIG_FSCACHE is not set - -# -# CD-ROM/DVD Filesystems -# -CONFIG_ISO9660_FS=y -CONFIG_JOLIET=y -# CONFIG_ZISOFS is not set -CONFIG_UDF_FS=m -CONFIG_UDF_NLS=y - -# -# DOS/FAT/NT Filesystems -# -CONFIG_FAT_FS=y -CONFIG_MSDOS_FS=y -CONFIG_VFAT_FS=y -CONFIG_FAT_DEFAULT_CODEPAGE=437 -CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" -CONFIG_NTFS_FS=y -# CONFIG_NTFS_DEBUG is not set -# CONFIG_NTFS_RW is not set - -# -# Pseudo filesystems -# -CONFIG_PROC_FS=y -CONFIG_PROC_SYSCTL=y -CONFIG_PROC_PAGE_MONITOR=y -CONFIG_SYSFS=y -CONFIG_TMPFS=y -# CONFIG_TMPFS_POSIX_ACL is not set -# CONFIG_TMPFS_XATTR is not set -# CONFIG_HUGETLB_PAGE is not set -# CONFIG_CONFIGFS_FS is not set -CONFIG_MISC_FILESYSTEMS=y -# CONFIG_ADFS_FS is not set -# CONFIG_AFFS_FS is not set -# CONFIG_ECRYPT_FS is not set -# CONFIG_HFS_FS is not set -# CONFIG_HFSPLUS_FS is not set -# CONFIG_BEFS_FS is not set -# CONFIG_BFS_FS is not set -# CONFIG_EFS_FS is not set -CONFIG_JFFS2_FS=y -CONFIG_JFFS2_FS_DEBUG=0 -CONFIG_JFFS2_FS_WRITEBUFFER=y -# CONFIG_JFFS2_FS_WBUF_VERIFY is not set -# CONFIG_JFFS2_SUMMARY is not set -# CONFIG_JFFS2_FS_XATTR is not set -# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set -CONFIG_JFFS2_ZLIB=y -# CONFIG_JFFS2_LZO is not set -CONFIG_JFFS2_RTIME=y -# CONFIG_JFFS2_RUBIN is not set -CONFIG_UBIFS_FS=y -CONFIG_UBIFS_FS_ADVANCED_COMPR=y -CONFIG_UBIFS_FS_LZO=y -CONFIG_UBIFS_FS_ZLIB=y -# CONFIG_LOGFS is not set -# CONFIG_CRAMFS is not set -CONFIG_SQUASHFS=y -# CONFIG_SQUASHFS_XATTR is not set -CONFIG_SQUASHFS_ZLIB=y -# CONFIG_SQUASHFS_LZO is not set -# CONFIG_SQUASHFS_XZ is not set -# CONFIG_SQUASHFS_4K_DEVBLK_SIZE is not set -# CONFIG_SQUASHFS_EMBEDDED is not set -CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3 -# CONFIG_VXFS_FS is not set -# CONFIG_MINIX_FS is not set -# CONFIG_OMFS_FS is not set -# CONFIG_HPFS_FS is not set -# CONFIG_QNX4FS_FS is not set -# CONFIG_QNX6FS_FS is not set -# CONFIG_ROMFS_FS is not set -# CONFIG_PSTORE is not set -# CONFIG_SYSV_FS is not set -# CONFIG_UFS_FS is not set -# CONFIG_F2FS_FS is not set -CONFIG_NETWORK_FILESYSTEMS=y -CONFIG_NFS_FS=y -CONFIG_NFS_V2=y -CONFIG_NFS_V3=y -# CONFIG_NFS_V3_ACL is not set -CONFIG_NFS_V4=y -# CONFIG_NFS_SWAP is not set -# CONFIG_NFS_V4_1 is not set -CONFIG_ROOT_NFS=y -# CONFIG_NFS_USE_LEGACY_DNS is not set -CONFIG_NFS_USE_KERNEL_DNS=y -CONFIG_NFSD=y -CONFIG_NFSD_V3=y -# CONFIG_NFSD_V3_ACL is not set -CONFIG_NFSD_V4=y -# CONFIG_NFSD_FAULT_INJECTION is not set -CONFIG_LOCKD=y -CONFIG_LOCKD_V4=y -CONFIG_NFS_COMMON=y -CONFIG_SUNRPC=y -CONFIG_SUNRPC_GSS=y -CONFIG_RPCSEC_GSS_KRB5=m -# CONFIG_SUNRPC_DEBUG is not set -# CONFIG_CEPH_FS is not set -# CONFIG_CIFS is not set -# CONFIG_NCP_FS is not set -# CONFIG_CODA_FS is not set -# CONFIG_AFS_FS is not set -CONFIG_NLS=y -CONFIG_NLS_DEFAULT="iso8859-1" -CONFIG_NLS_CODEPAGE_437=y -# CONFIG_NLS_CODEPAGE_737 is not set -# CONFIG_NLS_CODEPAGE_775 is not set -CONFIG_NLS_CODEPAGE_850=y -# CONFIG_NLS_CODEPAGE_852 is not set -# CONFIG_NLS_CODEPAGE_855 is not set -# CONFIG_NLS_CODEPAGE_857 is not set -# CONFIG_NLS_CODEPAGE_860 is not set -# CONFIG_NLS_CODEPAGE_861 is not set -# CONFIG_NLS_CODEPAGE_862 is not set -# CONFIG_NLS_CODEPAGE_863 is not set -# CONFIG_NLS_CODEPAGE_864 is not set -# CONFIG_NLS_CODEPAGE_865 is not set -# CONFIG_NLS_CODEPAGE_866 is not set -# CONFIG_NLS_CODEPAGE_869 is not set -# CONFIG_NLS_CODEPAGE_936 is not set -# CONFIG_NLS_CODEPAGE_950 is not set -# CONFIG_NLS_CODEPAGE_932 is not set -# CONFIG_NLS_CODEPAGE_949 is not set -# CONFIG_NLS_CODEPAGE_874 is not set -# CONFIG_NLS_ISO8859_8 is not set -# CONFIG_NLS_CODEPAGE_1250 is not set -# CONFIG_NLS_CODEPAGE_1251 is not set -# CONFIG_NLS_ASCII is not set -CONFIG_NLS_ISO8859_1=y -CONFIG_NLS_ISO8859_2=y -# CONFIG_NLS_ISO8859_3 is not set -# CONFIG_NLS_ISO8859_4 is not set -# CONFIG_NLS_ISO8859_5 is not set -# CONFIG_NLS_ISO8859_6 is not set -# CONFIG_NLS_ISO8859_7 is not set -# CONFIG_NLS_ISO8859_9 is not set -# CONFIG_NLS_ISO8859_13 is not set -# CONFIG_NLS_ISO8859_14 is not set -# CONFIG_NLS_ISO8859_15 is not set -# CONFIG_NLS_KOI8_R is not set -# CONFIG_NLS_KOI8_U is not set -# CONFIG_NLS_MAC_ROMAN is not set -# CONFIG_NLS_MAC_CELTIC is not set -# CONFIG_NLS_MAC_CENTEURO is not set -# CONFIG_NLS_MAC_CROATIAN is not set -# CONFIG_NLS_MAC_CYRILLIC is not set -# CONFIG_NLS_MAC_GAELIC is not set -# CONFIG_NLS_MAC_GREEK is not set -# CONFIG_NLS_MAC_ICELAND is not set -# CONFIG_NLS_MAC_INUIT is not set -# CONFIG_NLS_MAC_ROMANIAN is not set -# CONFIG_NLS_MAC_TURKISH is not set -CONFIG_NLS_UTF8=y - -# -# Kernel hacking -# -# CONFIG_PRINTK_TIME is not set -CONFIG_DEFAULT_MESSAGE_LOGLEVEL=4 -CONFIG_ENABLE_WARN_DEPRECATED=y -CONFIG_ENABLE_MUST_CHECK=y -CONFIG_FRAME_WARN=1024 -CONFIG_MAGIC_SYSRQ=y -# CONFIG_STRIP_ASM_SYMS is not set -# CONFIG_READABLE_ASM is not set -# CONFIG_UNUSED_SYMBOLS is not set -CONFIG_DEBUG_FS=y -# CONFIG_HEADERS_CHECK is not set -# CONFIG_DEBUG_SECTION_MISMATCH is not set -CONFIG_DEBUG_KERNEL=y -# CONFIG_DEBUG_SHIRQ is not set -# CONFIG_LOCKUP_DETECTOR is not set -# CONFIG_PANIC_ON_OOPS is not set -CONFIG_PANIC_ON_OOPS_VALUE=0 -# CONFIG_DETECT_HUNG_TASK is not set -# CONFIG_SCHED_DEBUG is not set -# CONFIG_SCHEDSTATS is not set -CONFIG_TIMER_STATS=y -# CONFIG_DEBUG_OBJECTS is not set -# CONFIG_DEBUG_SLAB is not set -CONFIG_HAVE_DEBUG_KMEMLEAK=y -# CONFIG_DEBUG_KMEMLEAK is not set -# CONFIG_DEBUG_RT_MUTEXES is not set -# CONFIG_RT_MUTEX_TESTER is not set -# CONFIG_DEBUG_SPINLOCK is not set -# CONFIG_DEBUG_MUTEXES is not set -# CONFIG_DEBUG_LOCK_ALLOC is not set -# CONFIG_PROVE_LOCKING is not set -# CONFIG_LOCK_STAT is not set -# CONFIG_DEBUG_ATOMIC_SLEEP is not set -# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set -# CONFIG_DEBUG_STACK_USAGE is not set -# CONFIG_DEBUG_KOBJECT is not set -# CONFIG_DEBUG_HIGHMEM is not set -# CONFIG_DEBUG_BUGVERBOSE is not set -# CONFIG_DEBUG_INFO is not set -# CONFIG_DEBUG_VM is not set -# CONFIG_DEBUG_WRITECOUNT is not set -# CONFIG_DEBUG_MEMORY_INIT is not set -# CONFIG_DEBUG_LIST is not set -# CONFIG_TEST_LIST_SORT is not set -# CONFIG_DEBUG_SG is not set -# CONFIG_DEBUG_NOTIFIERS is not set -# CONFIG_DEBUG_CREDENTIALS is not set -# CONFIG_BOOT_PRINTK_DELAY is not set - -# -# RCU Debugging -# -# CONFIG_SPARSE_RCU_POINTER is not set -# CONFIG_RCU_TORTURE_TEST is not set -CONFIG_RCU_CPU_STALL_TIMEOUT=21 -# CONFIG_RCU_CPU_STALL_INFO is not set -# CONFIG_RCU_TRACE is not set -# CONFIG_BACKTRACE_SELF_TEST is not set -# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set -# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set -# CONFIG_DEBUG_PER_CPU_MAPS is not set -# CONFIG_LKDTM is not set -# CONFIG_NOTIFIER_ERROR_INJECTION is not set -# CONFIG_FAULT_INJECTION is not set -# CONFIG_DEBUG_PAGEALLOC is not set -CONFIG_HAVE_FUNCTION_TRACER=y -CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y -CONFIG_HAVE_DYNAMIC_FTRACE=y -CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y -CONFIG_HAVE_SYSCALL_TRACEPOINTS=y -CONFIG_HAVE_C_RECORDMCOUNT=y -CONFIG_TRACING_SUPPORT=y -CONFIG_FTRACE=y -# CONFIG_FUNCTION_TRACER is not set -# CONFIG_IRQSOFF_TRACER is not set -# CONFIG_SCHED_TRACER is not set -# CONFIG_ENABLE_DEFAULT_TRACERS is not set -# CONFIG_FTRACE_SYSCALLS is not set -# CONFIG_TRACER_SNAPSHOT is not set -CONFIG_BRANCH_PROFILE_NONE=y -# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set -# CONFIG_PROFILE_ALL_BRANCHES is not set -# CONFIG_STACK_TRACER is not set -# CONFIG_BLK_DEV_IO_TRACE is not set -# CONFIG_PROBE_EVENTS is not set -# CONFIG_RBTREE_TEST is not set -# CONFIG_INTERVAL_TREE_TEST is not set -# CONFIG_DYNAMIC_DEBUG is not set -# CONFIG_DMA_API_DEBUG is not set -# CONFIG_ATOMIC64_SELFTEST is not set -# CONFIG_ASYNC_RAID6_TEST is not set -# CONFIG_SAMPLES is not set -CONFIG_HAVE_ARCH_KGDB=y -# CONFIG_KGDB is not set -# CONFIG_TEST_STRING_HELPERS is not set -# CONFIG_TEST_KSTRTOX is not set -# CONFIG_STRICT_DEVMEM is not set -CONFIG_ARM_UNWIND=y -CONFIG_DEBUG_USER=y -CONFIG_DEBUG_LL=y -# CONFIG_DEBUG_MVEBU_UART is not set -CONFIG_DEBUG_MVEBU_UART_ALTERNATE=y -# CONFIG_DEBUG_ICEDCC is not set -# CONFIG_DEBUG_SEMIHOSTING is not set -CONFIG_DEBUG_LL_INCLUDE="debug/mvebu.S" -CONFIG_DEBUG_UNCOMPRESS=y -CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h" -CONFIG_EARLY_PRINTK=y -# CONFIG_PID_IN_CONTEXTIDR is not set - -# -# Security options -# -CONFIG_KEYS=y -CONFIG_ENCRYPTED_KEYS=y -# CONFIG_KEYS_DEBUG_PROC_KEYS is not set -# CONFIG_SECURITY_DMESG_RESTRICT is not set -CONFIG_SECURITY=y -CONFIG_SECURITYFS=y -# CONFIG_SECURITY_NETWORK is not set -# CONFIG_SECURITY_PATH is not set -# CONFIG_SECURITY_SMACK is not set -# CONFIG_SECURITY_TOMOYO is not set -# CONFIG_SECURITY_APPARMOR is not set -# CONFIG_SECURITY_YAMA is not set -# CONFIG_IMA is not set -# CONFIG_EVM is not set -CONFIG_DEFAULT_SECURITY_DAC=y -CONFIG_DEFAULT_SECURITY="" -CONFIG_XOR_BLOCKS=y -CONFIG_ASYNC_CORE=y -CONFIG_ASYNC_MEMCPY=y -CONFIG_ASYNC_XOR=y -CONFIG_ASYNC_PQ=y -CONFIG_ASYNC_RAID6_RECOV=y -CONFIG_CRYPTO=y - -# -# Crypto core or helper -# -CONFIG_CRYPTO_ALGAPI=y -CONFIG_CRYPTO_ALGAPI2=y -CONFIG_CRYPTO_AEAD=m -CONFIG_CRYPTO_AEAD2=y -CONFIG_CRYPTO_BLKCIPHER=y -CONFIG_CRYPTO_BLKCIPHER2=y -CONFIG_CRYPTO_HASH=y -CONFIG_CRYPTO_HASH2=y -CONFIG_CRYPTO_RNG=y -CONFIG_CRYPTO_RNG2=y -CONFIG_CRYPTO_PCOMP=m -CONFIG_CRYPTO_PCOMP2=y -CONFIG_CRYPTO_MANAGER=y -CONFIG_CRYPTO_MANAGER2=y -# CONFIG_CRYPTO_USER is not set -CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y -CONFIG_CRYPTO_GF128MUL=m -CONFIG_CRYPTO_NULL=m -CONFIG_CRYPTO_PCRYPT=m -CONFIG_CRYPTO_WORKQUEUE=y -CONFIG_CRYPTO_CRYPTD=m -CONFIG_CRYPTO_AUTHENC=m -# CONFIG_CRYPTO_TEST is not set - -# -# Authenticated Encryption with Associated Data -# -CONFIG_CRYPTO_CCM=m -CONFIG_CRYPTO_GCM=m -CONFIG_CRYPTO_SEQIV=m - -# -# Block modes -# -CONFIG_CRYPTO_CBC=y -CONFIG_CRYPTO_CTR=m -CONFIG_CRYPTO_CTS=m -CONFIG_CRYPTO_ECB=y -CONFIG_CRYPTO_LRW=m -CONFIG_CRYPTO_PCBC=y -CONFIG_CRYPTO_XTS=m - -# -# Hash modes -# -CONFIG_CRYPTO_CMAC=m -CONFIG_CRYPTO_HMAC=y -CONFIG_CRYPTO_XCBC=m -# CONFIG_CRYPTO_VMAC is not set - -# -# Digest -# -CONFIG_CRYPTO_CRC32C=y -CONFIG_CRYPTO_CRC32=m -CONFIG_CRYPTO_GHASH=m -CONFIG_CRYPTO_MD4=m -CONFIG_CRYPTO_MD5=y -# CONFIG_CRYPTO_MICHAEL_MIC is not set -CONFIG_CRYPTO_RMD128=m -CONFIG_CRYPTO_RMD160=m -CONFIG_CRYPTO_RMD256=m -CONFIG_CRYPTO_RMD320=m -CONFIG_CRYPTO_SHA1=y -# CONFIG_CRYPTO_SHA1_ARM is not set -CONFIG_CRYPTO_SHA256=y -# CONFIG_CRYPTO_SHA512 is not set -# CONFIG_CRYPTO_TGR192 is not set -# CONFIG_CRYPTO_WP512 is not set - -# -# Ciphers -# -CONFIG_CRYPTO_AES=y -# CONFIG_CRYPTO_AES_ARM is not set -CONFIG_CRYPTO_ANUBIS=m -CONFIG_CRYPTO_ARC4=y -CONFIG_CRYPTO_BLOWFISH=m -CONFIG_CRYPTO_BLOWFISH_COMMON=m -CONFIG_CRYPTO_CAMELLIA=m -CONFIG_CRYPTO_CAST_COMMON=m -CONFIG_CRYPTO_CAST5=m -CONFIG_CRYPTO_CAST6=m -CONFIG_CRYPTO_DES=y -CONFIG_CRYPTO_FCRYPT=m -# CONFIG_CRYPTO_KHAZAD is not set -# CONFIG_CRYPTO_SALSA20 is not set -# CONFIG_CRYPTO_SEED is not set -CONFIG_CRYPTO_SERPENT=m -# CONFIG_CRYPTO_TEA is not set -# CONFIG_CRYPTO_TWOFISH is not set - -# -# Compression -# -CONFIG_CRYPTO_DEFLATE=y -CONFIG_CRYPTO_ZLIB=m -CONFIG_CRYPTO_LZO=y - -# -# Random Number Generation -# -CONFIG_CRYPTO_ANSI_CPRNG=m -CONFIG_CRYPTO_USER_API=m -CONFIG_CRYPTO_USER_API_HASH=m -CONFIG_CRYPTO_USER_API_SKCIPHER=m -CONFIG_CRYPTO_HW=y -CONFIG_CRYPTO_DEV_MV_CESA=m -# CONFIG_MV_INCLUDE_CESA is not set -# CONFIG_CRYPTO_DEV_HIFN_795X is not set -CONFIG_ASYMMETRIC_KEY_TYPE=m -# CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE is not set - -# -# OCF Configuration -# -# CONFIG_OCF_OCF is not set -# CONFIG_BINARY_PRINTF is not set - -# -# Library routines -# -CONFIG_RAID6_PQ=y -CONFIG_BITREVERSE=y -CONFIG_GENERIC_STRNCPY_FROM_USER=y -CONFIG_GENERIC_STRNLEN_USER=y -CONFIG_GENERIC_PCI_IOMAP=y -CONFIG_GENERIC_IO=y -# CONFIG_CRC_CCITT is not set -CONFIG_CRC16=y -# CONFIG_CRC_T10DIF is not set -CONFIG_CRC_ITU_T=m -CONFIG_CRC32=y -# CONFIG_CRC32_SELFTEST is not set -CONFIG_CRC32_SLICEBY8=y -# CONFIG_CRC32_SLICEBY4 is not set -# CONFIG_CRC32_SARWATE is not set -# CONFIG_CRC32_BIT is not set -# CONFIG_CRC7 is not set -CONFIG_LIBCRC32C=y -# CONFIG_CRC8 is not set -CONFIG_ZLIB_INFLATE=y -CONFIG_ZLIB_DEFLATE=y -CONFIG_LZO_COMPRESS=y -CONFIG_LZO_DECOMPRESS=y -# CONFIG_XZ_DEC is not set -# CONFIG_XZ_DEC_BCJ is not set -CONFIG_DECOMPRESS_GZIP=y -CONFIG_TEXTSEARCH=y -CONFIG_TEXTSEARCH_KMP=m -CONFIG_TEXTSEARCH_BM=m -CONFIG_TEXTSEARCH_FSM=m -CONFIG_HAS_IOMEM=y -CONFIG_HAS_IOPORT=y -CONFIG_HAS_DMA=y -CONFIG_CPU_RMAP=y -CONFIG_DQL=y -CONFIG_NLATTR=y -CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y -CONFIG_AVERAGE=y -# CONFIG_CORDIC is not set -# CONFIG_DDR is not set -CONFIG_OID_REGISTRY=y -# CONFIG_VIRTUALIZATION is not set diff --git a/config/kernel/linux-marvell-dev.config b/config/kernel/linux-mvebu-default.config similarity index 100% rename from config/kernel/linux-marvell-dev.config rename to config/kernel/linux-mvebu-default.config diff --git a/config/kernel/linux-marvell-next.config b/config/kernel/linux-mvebu-next.config similarity index 100% rename from config/kernel/linux-marvell-next.config rename to config/kernel/linux-mvebu-next.config diff --git a/config/sources/marvell.conf b/config/sources/mvebu.conf similarity index 87% rename from config/sources/marvell.conf rename to config/sources/mvebu.conf index cb53943ebb..f3b76ee06a 100644 --- a/config/sources/marvell.conf +++ b/config/sources/mvebu.conf @@ -16,9 +16,9 @@ HAS_UUID_SUPPORT=yes case $BRANCH in default) - KERNELSOURCE='https://github.com/SolidRun/linux-armada38x' - KERNELBRANCH='branch:linux-3.10.70-15t1-clearfog' - KERNELDIR='linux-armada' + KERNELSOURCE='https://github.com/moonman/linux-stable' + KERNELBRANCH='branch:linux-4.4.y-marvell' + KERNELDIR='linux-armada-lts' ;; next) @@ -26,12 +26,6 @@ case $BRANCH in KERNELBRANCH=$MAINLINE_KERNEL_BRANCH KERNELDIR=$MAINLINE_KERNEL_DIR ;; - - dev) - KERNELSOURCE='https://github.com/moonman/linux-stable' - KERNELBRANCH='branch:linux-4.4.y-marvell' - KERNELDIR='linux-armada-lts' - ;; esac CPUMIN=800000 diff --git a/patch/kernel/marvell-default/0-overlayfs.v18-3.10-rc7.patch b/patch/kernel/marvell-default/0-overlayfs.v18-3.10-rc7.patch deleted file mode 100644 index 54c3da044a..0000000000 --- a/patch/kernel/marvell-default/0-overlayfs.v18-3.10-rc7.patch +++ /dev/null @@ -1,3283 +0,0 @@ -diff --git a/Documentation/filesystems/Locking b/Documentation/filesystems/Locking -index 0706d32..4331290 100644 ---- a/Documentation/filesystems/Locking -+++ b/Documentation/filesystems/Locking -@@ -66,6 +66,7 @@ prototypes: - int (*atomic_open)(struct inode *, struct dentry *, - struct file *, unsigned open_flag, - umode_t create_mode, int *opened); -+ int (*dentry_open)(struct dentry *, struct file *, const struct cred *); - - locking rules: - all may block -@@ -93,6 +94,7 @@ removexattr: yes - fiemap: no - update_time: no - atomic_open: yes -+dentry_open: no - - Additionally, ->rmdir(), ->unlink() and ->rename() have ->i_mutex on - victim. -diff --git a/Documentation/filesystems/overlayfs.txt b/Documentation/filesystems/overlayfs.txt -new file mode 100644 -index 0000000..00dbab0 ---- /dev/null -+++ b/Documentation/filesystems/overlayfs.txt -@@ -0,0 +1,199 @@ -+Written by: Neil Brown -+ -+Overlay Filesystem -+================== -+ -+This document describes a prototype for a new approach to providing -+overlay-filesystem functionality in Linux (sometimes referred to as -+union-filesystems). An overlay-filesystem tries to present a -+filesystem which is the result over overlaying one filesystem on top -+of the other. -+ -+The result will inevitably fail to look exactly like a normal -+filesystem for various technical reasons. The expectation is that -+many use cases will be able to ignore these differences. -+ -+This approach is 'hybrid' because the objects that appear in the -+filesystem do not all appear to belong to that filesystem. In many -+cases an object accessed in the union will be indistinguishable -+from accessing the corresponding object from the original filesystem. -+This is most obvious from the 'st_dev' field returned by stat(2). -+ -+While directories will report an st_dev from the overlay-filesystem, -+all non-directory objects will report an st_dev from the lower or -+upper filesystem that is providing the object. Similarly st_ino will -+only be unique when combined with st_dev, and both of these can change -+over the lifetime of a non-directory object. Many applications and -+tools ignore these values and will not be affected. -+ -+Upper and Lower -+--------------- -+ -+An overlay filesystem combines two filesystems - an 'upper' filesystem -+and a 'lower' filesystem. When a name exists in both filesystems, the -+object in the 'upper' filesystem is visible while the object in the -+'lower' filesystem is either hidden or, in the case of directories, -+merged with the 'upper' object. -+ -+It would be more correct to refer to an upper and lower 'directory -+tree' rather than 'filesystem' as it is quite possible for both -+directory trees to be in the same filesystem and there is no -+requirement that the root of a filesystem be given for either upper or -+lower. -+ -+The lower filesystem can be any filesystem supported by Linux and does -+not need to be writable. The lower filesystem can even be another -+overlayfs. The upper filesystem will normally be writable and if it -+is it must support the creation of trusted.* extended attributes, and -+must provide valid d_type in readdir responses, at least for symbolic -+links - so NFS is not suitable. -+ -+A read-only overlay of two read-only filesystems may use any -+filesystem type. -+ -+Directories -+----------- -+ -+Overlaying mainly involves directories. If a given name appears in both -+upper and lower filesystems and refers to a non-directory in either, -+then the lower object is hidden - the name refers only to the upper -+object. -+ -+Where both upper and lower objects are directories, a merged directory -+is formed. -+ -+At mount time, the two directories given as mount options are combined -+into a merged directory: -+ -+ mount -t overlayfs overlayfs -olowerdir=/lower,upperdir=/upper /overlay -+ -+Then whenever a lookup is requested in such a merged directory, the -+lookup is performed in each actual directory and the combined result -+is cached in the dentry belonging to the overlay filesystem. If both -+actual lookups find directories, both are stored and a merged -+directory is created, otherwise only one is stored: the upper if it -+exists, else the lower. -+ -+Only the lists of names from directories are merged. Other content -+such as metadata and extended attributes are reported for the upper -+directory only. These attributes of the lower directory are hidden. -+ -+whiteouts and opaque directories -+-------------------------------- -+ -+In order to support rm and rmdir without changing the lower -+filesystem, an overlay filesystem needs to record in the upper filesystem -+that files have been removed. This is done using whiteouts and opaque -+directories (non-directories are always opaque). -+ -+The overlay filesystem uses extended attributes with a -+"trusted.overlay." prefix to record these details. -+ -+A whiteout is created as a symbolic link with target -+"(overlay-whiteout)" and with xattr "trusted.overlay.whiteout" set to "y". -+When a whiteout is found in the upper level of a merged directory, any -+matching name in the lower level is ignored, and the whiteout itself -+is also hidden. -+ -+A directory is made opaque by setting the xattr "trusted.overlay.opaque" -+to "y". Where the upper filesystem contains an opaque directory, any -+directory in the lower filesystem with the same name is ignored. -+ -+readdir -+------- -+ -+When a 'readdir' request is made on a merged directory, the upper and -+lower directories are each read and the name lists merged in the -+obvious way (upper is read first, then lower - entries that already -+exist are not re-added). This merged name list is cached in the -+'struct file' and so remains as long as the file is kept open. If the -+directory is opened and read by two processes at the same time, they -+will each have separate caches. A seekdir to the start of the -+directory (offset 0) followed by a readdir will cause the cache to be -+discarded and rebuilt. -+ -+This means that changes to the merged directory do not appear while a -+directory is being read. This is unlikely to be noticed by many -+programs. -+ -+seek offsets are assigned sequentially when the directories are read. -+Thus if -+ - read part of a directory -+ - remember an offset, and close the directory -+ - re-open the directory some time later -+ - seek to the remembered offset -+ -+there may be little correlation between the old and new locations in -+the list of filenames, particularly if anything has changed in the -+directory. -+ -+Readdir on directories that are not merged is simply handled by the -+underlying directory (upper or lower). -+ -+ -+Non-directories -+--------------- -+ -+Objects that are not directories (files, symlinks, device-special -+files etc.) are presented either from the upper or lower filesystem as -+appropriate. When a file in the lower filesystem is accessed in a way -+the requires write-access, such as opening for write access, changing -+some metadata etc., the file is first copied from the lower filesystem -+to the upper filesystem (copy_up). Note that creating a hard-link -+also requires copy_up, though of course creation of a symlink does -+not. -+ -+The copy_up may turn out to be unnecessary, for example if the file is -+opened for read-write but the data is not modified. -+ -+The copy_up process first makes sure that the containing directory -+exists in the upper filesystem - creating it and any parents as -+necessary. It then creates the object with the same metadata (owner, -+mode, mtime, symlink-target etc.) and then if the object is a file, the -+data is copied from the lower to the upper filesystem. Finally any -+extended attributes are copied up. -+ -+Once the copy_up is complete, the overlay filesystem simply -+provides direct access to the newly created file in the upper -+filesystem - future operations on the file are barely noticed by the -+overlay filesystem (though an operation on the name of the file such as -+rename or unlink will of course be noticed and handled). -+ -+ -+Non-standard behavior -+--------------------- -+ -+The copy_up operation essentially creates a new, identical file and -+moves it over to the old name. The new file may be on a different -+filesystem, so both st_dev and st_ino of the file may change. -+ -+Any open files referring to this inode will access the old data and -+metadata. Similarly any file locks obtained before copy_up will not -+apply to the copied up file. -+ -+On a file opened with O_RDONLY fchmod(2), fchown(2), futimesat(2) and -+fsetxattr(2) will fail with EROFS. -+ -+If a file with multiple hard links is copied up, then this will -+"break" the link. Changes will not be propagated to other names -+referring to the same inode. -+ -+Symlinks in /proc/PID/ and /proc/PID/fd which point to a non-directory -+object in overlayfs will not contain valid absolute paths, only -+relative paths leading up to the filesystem's root. This will be -+fixed in the future. -+ -+Some operations are not atomic, for example a crash during copy_up or -+rename will leave the filesystem in an inconsistent state. This will -+be addressed in the future. -+ -+Changes to underlying filesystems -+--------------------------------- -+ -+Offline changes, when the overlay is not mounted, are allowed to either -+the upper or the lower trees. -+ -+Changes to the underlying filesystems while part of a mounted overlay -+filesystem are not allowed. If the underlying filesystem is changed, -+the behavior of the overlay is undefined, though it will not result in -+a crash or deadlock. -diff --git a/Documentation/filesystems/vfs.txt b/Documentation/filesystems/vfs.txt -index bc4b06b..f64a4d1 100644 ---- a/Documentation/filesystems/vfs.txt -+++ b/Documentation/filesystems/vfs.txt -@@ -362,6 +362,7 @@ struct inode_operations { - int (*atomic_open)(struct inode *, struct dentry *, - struct file *, unsigned open_flag, - umode_t create_mode, int *opened); -+ int (*dentry_open)(struct dentry *, struct file *, const struct cred *); - }; - - Again, all methods are called without any locks being held, unless -@@ -681,6 +682,12 @@ struct address_space_operations { - but instead uses bmap to find out where the blocks in the file - are and uses those addresses directly. - -+ dentry_open: this is an alternative to f_op->open(), the difference is that -+ this method may open a file not necessarily originating from the same -+ filesystem as the one i_op->open() was called on. It may be -+ useful for stacking filesystems which want to allow native I/O directly -+ on underlying files. -+ - - invalidatepage: If a page has PagePrivate set, then invalidatepage - will be called when part or all of the page is to be removed -diff --git a/MAINTAINERS b/MAINTAINERS -index 5be702c..8911997 100644 ---- a/MAINTAINERS -+++ b/MAINTAINERS -@@ -6019,6 +6019,13 @@ F: drivers/scsi/osd/ - F: include/scsi/osd_* - F: fs/exofs/ - -+OVERLAYFS FILESYSTEM -+M: Miklos Szeredi -+L: linux-fsdevel@vger.kernel.org -+S: Supported -+F: fs/overlayfs/* -+F: Documentation/filesystems/overlayfs.txt -+ - P54 WIRELESS DRIVER - M: Christian Lamparter - L: linux-wireless@vger.kernel.org -diff --git a/fs/Kconfig b/fs/Kconfig -index c229f82..60291d5 100644 ---- a/fs/Kconfig -+++ b/fs/Kconfig -@@ -67,6 +67,7 @@ source "fs/quota/Kconfig" - - source "fs/autofs4/Kconfig" - source "fs/fuse/Kconfig" -+source "fs/overlayfs/Kconfig" - - config GENERIC_ACL - bool -diff --git a/fs/Makefile b/fs/Makefile -index 4fe6df3..9506dd7 100644 ---- a/fs/Makefile -+++ b/fs/Makefile -@@ -105,6 +105,7 @@ obj-$(CONFIG_QNX6FS_FS) += qnx6/ - obj-$(CONFIG_AUTOFS4_FS) += autofs4/ - obj-$(CONFIG_ADFS_FS) += adfs/ - obj-$(CONFIG_FUSE_FS) += fuse/ -+obj-$(CONFIG_OVERLAYFS_FS) += overlayfs/ - obj-$(CONFIG_UDF_FS) += udf/ - obj-$(CONFIG_SUN_OPENPROMFS) += openpromfs/ - obj-$(CONFIG_OMFS_FS) += omfs/ -diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c -index e924cf4..8b0957e 100644 ---- a/fs/ecryptfs/main.c -+++ b/fs/ecryptfs/main.c -@@ -567,6 +567,13 @@ static struct dentry *ecryptfs_mount(struct file_system_type *fs_type, int flags - s->s_maxbytes = path.dentry->d_sb->s_maxbytes; - s->s_blocksize = path.dentry->d_sb->s_blocksize; - s->s_magic = ECRYPTFS_SUPER_MAGIC; -+ s->s_stack_depth = path.dentry->d_sb->s_stack_depth + 1; -+ -+ rc = -EINVAL; -+ if (s->s_stack_depth > FILESYSTEM_MAX_STACK_DEPTH) { -+ pr_err("eCryptfs: maximum fs stacking depth exceeded\n"); -+ goto out_free; -+ } - - inode = ecryptfs_get_inode(path.dentry->d_inode, s); - rc = PTR_ERR(inode); -diff --git a/fs/internal.h b/fs/internal.h -index 6812158..6c9ec69 100644 ---- a/fs/internal.h -+++ b/fs/internal.h -@@ -42,11 +42,6 @@ static inline int __sync_blockdev(struct block_device *bdev, int wait) - extern void __init chrdev_init(void); - - /* -- * namei.c -- */ --extern int __inode_permission(struct inode *, int); -- --/* - * namespace.c - */ - extern int copy_mount_options(const void __user *, unsigned long *); -@@ -132,12 +127,6 @@ extern struct dentry *__d_alloc(struct super_block *, const struct qstr *); - extern ssize_t __kernel_write(struct file *, const char *, size_t, loff_t *); - - /* -- * splice.c -- */ --extern long do_splice_direct(struct file *in, loff_t *ppos, struct file *out, -- loff_t *opos, size_t len, unsigned int flags); -- --/* - * pipe.c - */ - extern const struct file_operations pipefifo_fops; -diff --git a/fs/namei.c b/fs/namei.c -index 9ed9361..df058f5 100644 ---- a/fs/namei.c -+++ b/fs/namei.c -@@ -402,6 +402,7 @@ int __inode_permission(struct inode *inode, int mask) - - return security_inode_permission(inode, mask); - } -+EXPORT_SYMBOL(__inode_permission); - - /** - * sb_permission - Check superblock-level permissions -@@ -2867,9 +2868,12 @@ finish_open_created: - error = may_open(&nd->path, acc_mode, open_flag); - if (error) - goto out; -- file->f_path.mnt = nd->path.mnt; -- error = finish_open(file, nd->path.dentry, NULL, opened); -- if (error) { -+ -+ BUG_ON(*opened & FILE_OPENED); /* once it's opened, it's opened */ -+ error = vfs_open(&nd->path, file, current_cred()); -+ if (!error) { -+ *opened |= FILE_OPENED; -+ } else { - if (error == -EOPENSTALE) - goto stale_open; - goto out; -diff --git a/fs/namespace.c b/fs/namespace.c -index 7b1ca9b..455e6ea 100644 ---- a/fs/namespace.c -+++ b/fs/namespace.c -@@ -1442,6 +1442,33 @@ void drop_collected_mounts(struct vfsmount *mnt) - namespace_unlock(); - } - -+/** -+ * clone_private_mount - create a private clone of a path -+ * -+ * This creates a new vfsmount, which will be the clone of @path. The new will -+ * not be attached anywhere in the namespace and will be private (i.e. changes -+ * to the originating mount won't be propagated into this). -+ * -+ * Release with mntput(). -+ */ -+struct vfsmount *clone_private_mount(struct path *path) -+{ -+ struct mount *old_mnt = real_mount(path->mnt); -+ struct mount *new_mnt; -+ -+ if (IS_MNT_UNBINDABLE(old_mnt)) -+ return ERR_PTR(-EINVAL); -+ -+ down_read(&namespace_sem); -+ new_mnt = clone_mnt(old_mnt, path->dentry, CL_PRIVATE); -+ up_read(&namespace_sem); -+ if (IS_ERR(new_mnt)) -+ return ERR_CAST(new_mnt); -+ -+ return &new_mnt->mnt; -+} -+EXPORT_SYMBOL_GPL(clone_private_mount); -+ - int iterate_mounts(int (*f)(struct vfsmount *, void *), void *arg, - struct vfsmount *root) - { -diff --git a/fs/open.c b/fs/open.c -index 8c74100..ab07bc9 100644 ---- a/fs/open.c -+++ b/fs/open.c -@@ -800,8 +800,7 @@ struct file *dentry_open(const struct path *path, int flags, - f = get_empty_filp(); - if (!IS_ERR(f)) { - f->f_flags = flags; -- f->f_path = *path; -- error = do_dentry_open(f, NULL, cred); -+ error = vfs_open(path, f, cred); - if (!error) { - /* from now on we need fput() to dispose of f */ - error = open_check_o_direct(f); -@@ -818,6 +817,26 @@ struct file *dentry_open(const struct path *path, int flags, - } - EXPORT_SYMBOL(dentry_open); - -+/** -+ * vfs_open - open the file at the given path -+ * @path: path to open -+ * @filp: newly allocated file with f_flag initialized -+ * @cred: credentials to use -+ */ -+int vfs_open(const struct path *path, struct file *filp, -+ const struct cred *cred) -+{ -+ struct inode *inode = path->dentry->d_inode; -+ -+ if (inode->i_op->dentry_open) -+ return inode->i_op->dentry_open(path->dentry, filp, cred); -+ else { -+ filp->f_path = *path; -+ return do_dentry_open(filp, NULL, cred); -+ } -+} -+EXPORT_SYMBOL(vfs_open); -+ - static inline int build_open_flags(int flags, umode_t mode, struct open_flags *op) - { - int lookup_flags = 0; -diff --git a/fs/overlayfs/Kconfig b/fs/overlayfs/Kconfig -new file mode 100644 -index 0000000..e601259 ---- /dev/null -+++ b/fs/overlayfs/Kconfig -@@ -0,0 +1,10 @@ -+config OVERLAYFS_FS -+ tristate "Overlay filesystem support" -+ help -+ An overlay filesystem combines two filesystems - an 'upper' filesystem -+ and a 'lower' filesystem. When a name exists in both filesystems, the -+ object in the 'upper' filesystem is visible while the object in the -+ 'lower' filesystem is either hidden or, in the case of directories, -+ merged with the 'upper' object. -+ -+ For more information see Documentation/filesystems/overlayfs.txt -diff --git a/fs/overlayfs/Makefile b/fs/overlayfs/Makefile -new file mode 100644 -index 0000000..8f91889 ---- /dev/null -+++ b/fs/overlayfs/Makefile -@@ -0,0 +1,7 @@ -+# -+# Makefile for the overlay filesystem. -+# -+ -+obj-$(CONFIG_OVERLAYFS_FS) += overlayfs.o -+ -+overlayfs-objs := super.o inode.o dir.o readdir.o copy_up.o -diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c -new file mode 100644 -index 0000000..7b9fb6d ---- /dev/null -+++ b/fs/overlayfs/copy_up.c -@@ -0,0 +1,387 @@ -+/* -+ * -+ * Copyright (C) 2011 Novell Inc. -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 as published by -+ * the Free Software Foundation. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include "overlayfs.h" -+ -+#define OVL_COPY_UP_CHUNK_SIZE (1 << 20) -+ -+static int ovl_copy_up_xattr(struct dentry *old, struct dentry *new) -+{ -+ ssize_t list_size, size; -+ char *buf, *name, *value; -+ int error; -+ -+ if (!old->d_inode->i_op->getxattr || -+ !new->d_inode->i_op->getxattr) -+ return 0; -+ -+ list_size = vfs_listxattr(old, NULL, 0); -+ if (list_size <= 0) { -+ if (list_size == -EOPNOTSUPP) -+ return 0; -+ return list_size; -+ } -+ -+ buf = kzalloc(list_size, GFP_KERNEL); -+ if (!buf) -+ return -ENOMEM; -+ -+ error = -ENOMEM; -+ value = kmalloc(XATTR_SIZE_MAX, GFP_KERNEL); -+ if (!value) -+ goto out; -+ -+ list_size = vfs_listxattr(old, buf, list_size); -+ if (list_size <= 0) { -+ error = list_size; -+ goto out_free_value; -+ } -+ -+ for (name = buf; name < (buf + list_size); name += strlen(name) + 1) { -+ size = vfs_getxattr(old, name, value, XATTR_SIZE_MAX); -+ if (size <= 0) { -+ error = size; -+ goto out_free_value; -+ } -+ error = vfs_setxattr(new, name, value, size, 0); -+ if (error) -+ goto out_free_value; -+ } -+ -+out_free_value: -+ kfree(value); -+out: -+ kfree(buf); -+ return error; -+} -+ -+static int ovl_copy_up_data(struct path *old, struct path *new, loff_t len) -+{ -+ struct file *old_file; -+ struct file *new_file; -+ loff_t old_pos = 0; -+ loff_t new_pos = 0; -+ int error = 0; -+ -+ if (len == 0) -+ return 0; -+ -+ old_file = ovl_path_open(old, O_RDONLY); -+ if (IS_ERR(old_file)) -+ return PTR_ERR(old_file); -+ -+ new_file = ovl_path_open(new, O_WRONLY); -+ if (IS_ERR(new_file)) { -+ error = PTR_ERR(new_file); -+ goto out_fput; -+ } -+ -+ /* FIXME: copy up sparse files efficiently */ -+ while (len) { -+ size_t this_len = OVL_COPY_UP_CHUNK_SIZE; -+ long bytes; -+ -+ if (len < this_len) -+ this_len = len; -+ -+ if (signal_pending_state(TASK_KILLABLE, current)) { -+ error = -EINTR; -+ break; -+ } -+ -+ bytes = do_splice_direct(old_file, &old_pos, -+ new_file, &new_pos, -+ this_len, SPLICE_F_MOVE); -+ if (bytes <= 0) { -+ error = bytes; -+ break; -+ } -+ -+ len -= bytes; -+ } -+ -+ fput(new_file); -+out_fput: -+ fput(old_file); -+ return error; -+} -+ -+static char *ovl_read_symlink(struct dentry *realdentry) -+{ -+ int res; -+ char *buf; -+ struct inode *inode = realdentry->d_inode; -+ mm_segment_t old_fs; -+ -+ res = -EINVAL; -+ if (!inode->i_op->readlink) -+ goto err; -+ -+ res = -ENOMEM; -+ buf = (char *) __get_free_page(GFP_KERNEL); -+ if (!buf) -+ goto err; -+ -+ old_fs = get_fs(); -+ set_fs(get_ds()); -+ /* The cast to a user pointer is valid due to the set_fs() */ -+ res = inode->i_op->readlink(realdentry, -+ (char __user *)buf, PAGE_SIZE - 1); -+ set_fs(old_fs); -+ if (res < 0) { -+ free_page((unsigned long) buf); -+ goto err; -+ } -+ buf[res] = '\0'; -+ -+ return buf; -+ -+err: -+ return ERR_PTR(res); -+} -+ -+static int ovl_set_timestamps(struct dentry *upperdentry, struct kstat *stat) -+{ -+ struct iattr attr = { -+ .ia_valid = -+ ATTR_ATIME | ATTR_MTIME | ATTR_ATIME_SET | ATTR_MTIME_SET, -+ .ia_atime = stat->atime, -+ .ia_mtime = stat->mtime, -+ }; -+ -+ return notify_change(upperdentry, &attr); -+} -+ -+static int ovl_set_mode(struct dentry *upperdentry, umode_t mode) -+{ -+ struct iattr attr = { -+ .ia_valid = ATTR_MODE, -+ .ia_mode = mode, -+ }; -+ -+ return notify_change(upperdentry, &attr); -+} -+ -+static int ovl_copy_up_locked(struct dentry *upperdir, struct dentry *dentry, -+ struct path *lowerpath, struct kstat *stat, -+ const char *link) -+{ -+ int err; -+ struct path newpath; -+ umode_t mode = stat->mode; -+ -+ /* Can't properly set mode on creation because of the umask */ -+ stat->mode &= S_IFMT; -+ -+ ovl_path_upper(dentry, &newpath); -+ WARN_ON(newpath.dentry); -+ newpath.dentry = ovl_upper_create(upperdir, dentry, stat, link); -+ if (IS_ERR(newpath.dentry)) -+ return PTR_ERR(newpath.dentry); -+ -+ if (S_ISREG(stat->mode)) { -+ err = ovl_copy_up_data(lowerpath, &newpath, stat->size); -+ if (err) -+ goto err_remove; -+ } -+ -+ err = ovl_copy_up_xattr(lowerpath->dentry, newpath.dentry); -+ if (err) -+ goto err_remove; -+ -+ mutex_lock(&newpath.dentry->d_inode->i_mutex); -+ if (!S_ISLNK(stat->mode)) -+ err = ovl_set_mode(newpath.dentry, mode); -+ if (!err) -+ err = ovl_set_timestamps(newpath.dentry, stat); -+ mutex_unlock(&newpath.dentry->d_inode->i_mutex); -+ if (err) -+ goto err_remove; -+ -+ ovl_dentry_update(dentry, newpath.dentry); -+ -+ /* -+ * Easiest way to get rid of the lower dentry reference is to -+ * drop this dentry. This is neither needed nor possible for -+ * directories. -+ */ -+ if (!S_ISDIR(stat->mode)) -+ d_drop(dentry); -+ -+ return 0; -+ -+err_remove: -+ if (S_ISDIR(stat->mode)) -+ vfs_rmdir(upperdir->d_inode, newpath.dentry); -+ else -+ vfs_unlink(upperdir->d_inode, newpath.dentry); -+ -+ dput(newpath.dentry); -+ -+ return err; -+} -+ -+/* -+ * Copy up a single dentry -+ * -+ * Directory renames only allowed on "pure upper" (already created on -+ * upper filesystem, never copied up). Directories which are on lower or -+ * are merged may not be renamed. For these -EXDEV is returned and -+ * userspace has to deal with it. This means, when copying up a -+ * directory we can rely on it and ancestors being stable. -+ * -+ * Non-directory renames start with copy up of source if necessary. The -+ * actual rename will only proceed once the copy up was successful. Copy -+ * up uses upper parent i_mutex for exclusion. Since rename can change -+ * d_parent it is possible that the copy up will lock the old parent. At -+ * that point the file will have already been copied up anyway. -+ */ -+static int ovl_copy_up_one(struct dentry *parent, struct dentry *dentry, -+ struct path *lowerpath, struct kstat *stat) -+{ -+ int err; -+ struct kstat pstat; -+ struct path parentpath; -+ struct dentry *upperdir; -+ const struct cred *old_cred; -+ struct cred *override_cred; -+ char *link = NULL; -+ -+ ovl_path_upper(parent, &parentpath); -+ upperdir = parentpath.dentry; -+ -+ err = vfs_getattr(&parentpath, &pstat); -+ if (err) -+ return err; -+ -+ if (S_ISLNK(stat->mode)) { -+ link = ovl_read_symlink(lowerpath->dentry); -+ if (IS_ERR(link)) -+ return PTR_ERR(link); -+ } -+ -+ err = -ENOMEM; -+ override_cred = prepare_creds(); -+ if (!override_cred) -+ goto out_free_link; -+ -+ override_cred->fsuid = stat->uid; -+ override_cred->fsgid = stat->gid; -+ /* -+ * CAP_SYS_ADMIN for copying up extended attributes -+ * CAP_DAC_OVERRIDE for create -+ * CAP_FOWNER for chmod, timestamp update -+ * CAP_FSETID for chmod -+ * CAP_MKNOD for mknod -+ */ -+ cap_raise(override_cred->cap_effective, CAP_SYS_ADMIN); -+ cap_raise(override_cred->cap_effective, CAP_DAC_OVERRIDE); -+ cap_raise(override_cred->cap_effective, CAP_FOWNER); -+ cap_raise(override_cred->cap_effective, CAP_FSETID); -+ cap_raise(override_cred->cap_effective, CAP_MKNOD); -+ old_cred = override_creds(override_cred); -+ -+ mutex_lock_nested(&upperdir->d_inode->i_mutex, I_MUTEX_PARENT); -+ if (ovl_path_type(dentry) != OVL_PATH_LOWER) { -+ err = 0; -+ } else { -+ err = ovl_copy_up_locked(upperdir, dentry, lowerpath, -+ stat, link); -+ if (!err) { -+ /* Restore timestamps on parent (best effort) */ -+ ovl_set_timestamps(upperdir, &pstat); -+ } -+ } -+ -+ mutex_unlock(&upperdir->d_inode->i_mutex); -+ -+ revert_creds(old_cred); -+ put_cred(override_cred); -+ -+out_free_link: -+ if (link) -+ free_page((unsigned long) link); -+ -+ return err; -+} -+ -+int ovl_copy_up(struct dentry *dentry) -+{ -+ int err; -+ -+ err = 0; -+ while (!err) { -+ struct dentry *next; -+ struct dentry *parent; -+ struct path lowerpath; -+ struct kstat stat; -+ enum ovl_path_type type = ovl_path_type(dentry); -+ -+ if (type != OVL_PATH_LOWER) -+ break; -+ -+ next = dget(dentry); -+ /* find the topmost dentry not yet copied up */ -+ for (;;) { -+ parent = dget_parent(next); -+ -+ type = ovl_path_type(parent); -+ if (type != OVL_PATH_LOWER) -+ break; -+ -+ dput(next); -+ next = parent; -+ } -+ -+ ovl_path_lower(next, &lowerpath); -+ err = vfs_getattr(&lowerpath, &stat); -+ if (!err) -+ err = ovl_copy_up_one(parent, next, &lowerpath, &stat); -+ -+ dput(parent); -+ dput(next); -+ } -+ -+ return err; -+} -+ -+/* Optimize by not copying up the file first and truncating later */ -+int ovl_copy_up_truncate(struct dentry *dentry, loff_t size) -+{ -+ int err; -+ struct kstat stat; -+ struct path lowerpath; -+ struct dentry *parent = dget_parent(dentry); -+ -+ err = ovl_copy_up(parent); -+ if (err) -+ goto out_dput_parent; -+ -+ ovl_path_lower(dentry, &lowerpath); -+ err = vfs_getattr(&lowerpath, &stat); -+ if (err) -+ goto out_dput_parent; -+ -+ if (size < stat.size) -+ stat.size = size; -+ -+ err = ovl_copy_up_one(parent, dentry, &lowerpath, &stat); -+ -+out_dput_parent: -+ dput(parent); -+ return err; -+} -diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c -new file mode 100644 -index 0000000..f4969c1 ---- /dev/null -+++ b/fs/overlayfs/dir.c -@@ -0,0 +1,605 @@ -+/* -+ * -+ * Copyright (C) 2011 Novell Inc. -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 as published by -+ * the Free Software Foundation. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include "overlayfs.h" -+ -+static const char *ovl_whiteout_symlink = "(overlay-whiteout)"; -+ -+static int ovl_whiteout(struct dentry *upperdir, struct dentry *dentry) -+{ -+ int err; -+ struct dentry *newdentry; -+ const struct cred *old_cred; -+ struct cred *override_cred; -+ -+ /* FIXME: recheck lower dentry to see if whiteout is really needed */ -+ -+ err = -ENOMEM; -+ override_cred = prepare_creds(); -+ if (!override_cred) -+ goto out; -+ -+ /* -+ * CAP_SYS_ADMIN for setxattr -+ * CAP_DAC_OVERRIDE for symlink creation -+ * CAP_FOWNER for unlink in sticky directory -+ */ -+ cap_raise(override_cred->cap_effective, CAP_SYS_ADMIN); -+ cap_raise(override_cred->cap_effective, CAP_DAC_OVERRIDE); -+ cap_raise(override_cred->cap_effective, CAP_FOWNER); -+ override_cred->fsuid = GLOBAL_ROOT_UID; -+ override_cred->fsgid = GLOBAL_ROOT_GID; -+ old_cred = override_creds(override_cred); -+ -+ newdentry = lookup_one_len(dentry->d_name.name, upperdir, -+ dentry->d_name.len); -+ err = PTR_ERR(newdentry); -+ if (IS_ERR(newdentry)) -+ goto out_put_cred; -+ -+ /* Just been removed within the same locked region */ -+ WARN_ON(newdentry->d_inode); -+ -+ err = vfs_symlink(upperdir->d_inode, newdentry, ovl_whiteout_symlink); -+ if (err) -+ goto out_dput; -+ -+ ovl_dentry_version_inc(dentry->d_parent); -+ -+ err = vfs_setxattr(newdentry, ovl_whiteout_xattr, "y", 1, 0); -+ if (err) -+ vfs_unlink(upperdir->d_inode, newdentry); -+ -+out_dput: -+ dput(newdentry); -+out_put_cred: -+ revert_creds(old_cred); -+ put_cred(override_cred); -+out: -+ if (err) { -+ /* -+ * There's no way to recover from failure to whiteout. -+ * What should we do? Log a big fat error and... ? -+ */ -+ pr_err("overlayfs: ERROR - failed to whiteout '%s'\n", -+ dentry->d_name.name); -+ } -+ -+ return err; -+} -+ -+static struct dentry *ovl_lookup_create(struct dentry *upperdir, -+ struct dentry *template) -+{ -+ int err; -+ struct dentry *newdentry; -+ struct qstr *name = &template->d_name; -+ -+ newdentry = lookup_one_len(name->name, upperdir, name->len); -+ if (IS_ERR(newdentry)) -+ return newdentry; -+ -+ if (newdentry->d_inode) { -+ const struct cred *old_cred; -+ struct cred *override_cred; -+ -+ /* No need to check whiteout if lower parent is non-existent */ -+ err = -EEXIST; -+ if (!ovl_dentry_lower(template->d_parent)) -+ goto out_dput; -+ -+ if (!S_ISLNK(newdentry->d_inode->i_mode)) -+ goto out_dput; -+ -+ err = -ENOMEM; -+ override_cred = prepare_creds(); -+ if (!override_cred) -+ goto out_dput; -+ -+ /* -+ * CAP_SYS_ADMIN for getxattr -+ * CAP_FOWNER for unlink in sticky directory -+ */ -+ cap_raise(override_cred->cap_effective, CAP_SYS_ADMIN); -+ cap_raise(override_cred->cap_effective, CAP_FOWNER); -+ old_cred = override_creds(override_cred); -+ -+ err = -EEXIST; -+ if (ovl_is_whiteout(newdentry)) -+ err = vfs_unlink(upperdir->d_inode, newdentry); -+ -+ revert_creds(old_cred); -+ put_cred(override_cred); -+ if (err) -+ goto out_dput; -+ -+ dput(newdentry); -+ newdentry = lookup_one_len(name->name, upperdir, name->len); -+ if (IS_ERR(newdentry)) { -+ ovl_whiteout(upperdir, template); -+ return newdentry; -+ } -+ -+ /* -+ * Whiteout just been successfully removed, parent -+ * i_mutex is still held, there's no way the lookup -+ * could return positive. -+ */ -+ WARN_ON(newdentry->d_inode); -+ } -+ -+ return newdentry; -+ -+out_dput: -+ dput(newdentry); -+ return ERR_PTR(err); -+} -+ -+struct dentry *ovl_upper_create(struct dentry *upperdir, struct dentry *dentry, -+ struct kstat *stat, const char *link) -+{ -+ int err; -+ struct dentry *newdentry; -+ struct inode *dir = upperdir->d_inode; -+ -+ newdentry = ovl_lookup_create(upperdir, dentry); -+ if (IS_ERR(newdentry)) -+ goto out; -+ -+ switch (stat->mode & S_IFMT) { -+ case S_IFREG: -+ err = vfs_create(dir, newdentry, stat->mode, NULL); -+ break; -+ -+ case S_IFDIR: -+ err = vfs_mkdir(dir, newdentry, stat->mode); -+ break; -+ -+ case S_IFCHR: -+ case S_IFBLK: -+ case S_IFIFO: -+ case S_IFSOCK: -+ err = vfs_mknod(dir, newdentry, stat->mode, stat->rdev); -+ break; -+ -+ case S_IFLNK: -+ err = vfs_symlink(dir, newdentry, link); -+ break; -+ -+ default: -+ err = -EPERM; -+ } -+ if (err) { -+ if (ovl_dentry_is_opaque(dentry)) -+ ovl_whiteout(upperdir, dentry); -+ dput(newdentry); -+ newdentry = ERR_PTR(err); -+ } else if (WARN_ON(!newdentry->d_inode)) { -+ /* -+ * Not quite sure if non-instantiated dentry is legal or not. -+ * VFS doesn't seem to care so check and warn here. -+ */ -+ dput(newdentry); -+ newdentry = ERR_PTR(-ENOENT); -+ } -+ -+out: -+ return newdentry; -+ -+} -+ -+static int ovl_set_opaque(struct dentry *upperdentry) -+{ -+ int err; -+ const struct cred *old_cred; -+ struct cred *override_cred; -+ -+ override_cred = prepare_creds(); -+ if (!override_cred) -+ return -ENOMEM; -+ -+ /* CAP_SYS_ADMIN for setxattr of "trusted" namespace */ -+ cap_raise(override_cred->cap_effective, CAP_SYS_ADMIN); -+ old_cred = override_creds(override_cred); -+ err = vfs_setxattr(upperdentry, ovl_opaque_xattr, "y", 1, 0); -+ revert_creds(old_cred); -+ put_cred(override_cred); -+ -+ return err; -+} -+ -+static int ovl_remove_opaque(struct dentry *upperdentry) -+{ -+ int err; -+ const struct cred *old_cred; -+ struct cred *override_cred; -+ -+ override_cred = prepare_creds(); -+ if (!override_cred) -+ return -ENOMEM; -+ -+ /* CAP_SYS_ADMIN for removexattr of "trusted" namespace */ -+ cap_raise(override_cred->cap_effective, CAP_SYS_ADMIN); -+ old_cred = override_creds(override_cred); -+ err = vfs_removexattr(upperdentry, ovl_opaque_xattr); -+ revert_creds(old_cred); -+ put_cred(override_cred); -+ -+ return err; -+} -+ -+static int ovl_dir_getattr(struct vfsmount *mnt, struct dentry *dentry, -+ struct kstat *stat) -+{ -+ int err; -+ enum ovl_path_type type; -+ struct path realpath; -+ -+ type = ovl_path_real(dentry, &realpath); -+ err = vfs_getattr(&realpath, stat); -+ if (err) -+ return err; -+ -+ stat->dev = dentry->d_sb->s_dev; -+ stat->ino = dentry->d_inode->i_ino; -+ -+ /* -+ * It's probably not worth it to count subdirs to get the -+ * correct link count. nlink=1 seems to pacify 'find' and -+ * other utilities. -+ */ -+ if (type == OVL_PATH_MERGE) -+ stat->nlink = 1; -+ -+ return 0; -+} -+ -+static int ovl_create_object(struct dentry *dentry, int mode, dev_t rdev, -+ const char *link) -+{ -+ int err; -+ struct dentry *newdentry; -+ struct dentry *upperdir; -+ struct inode *inode; -+ struct kstat stat = { -+ .mode = mode, -+ .rdev = rdev, -+ }; -+ -+ err = -ENOMEM; -+ inode = ovl_new_inode(dentry->d_sb, mode, dentry->d_fsdata); -+ if (!inode) -+ goto out; -+ -+ err = ovl_copy_up(dentry->d_parent); -+ if (err) -+ goto out_iput; -+ -+ upperdir = ovl_dentry_upper(dentry->d_parent); -+ mutex_lock_nested(&upperdir->d_inode->i_mutex, I_MUTEX_PARENT); -+ -+ newdentry = ovl_upper_create(upperdir, dentry, &stat, link); -+ err = PTR_ERR(newdentry); -+ if (IS_ERR(newdentry)) -+ goto out_unlock; -+ -+ ovl_dentry_version_inc(dentry->d_parent); -+ if (ovl_dentry_is_opaque(dentry) && S_ISDIR(mode)) { -+ err = ovl_set_opaque(newdentry); -+ if (err) { -+ vfs_rmdir(upperdir->d_inode, newdentry); -+ ovl_whiteout(upperdir, dentry); -+ goto out_dput; -+ } -+ } -+ ovl_dentry_update(dentry, newdentry); -+ ovl_copyattr(newdentry->d_inode, inode); -+ d_instantiate(dentry, inode); -+ inode = NULL; -+ newdentry = NULL; -+ err = 0; -+ -+out_dput: -+ dput(newdentry); -+out_unlock: -+ mutex_unlock(&upperdir->d_inode->i_mutex); -+out_iput: -+ iput(inode); -+out: -+ return err; -+} -+ -+static int ovl_create(struct inode *dir, struct dentry *dentry, umode_t mode, -+ bool excl) -+{ -+ return ovl_create_object(dentry, (mode & 07777) | S_IFREG, 0, NULL); -+} -+ -+static int ovl_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) -+{ -+ return ovl_create_object(dentry, (mode & 07777) | S_IFDIR, 0, NULL); -+} -+ -+static int ovl_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, -+ dev_t rdev) -+{ -+ return ovl_create_object(dentry, mode, rdev, NULL); -+} -+ -+static int ovl_symlink(struct inode *dir, struct dentry *dentry, -+ const char *link) -+{ -+ return ovl_create_object(dentry, S_IFLNK, 0, link); -+} -+ -+static int ovl_do_remove(struct dentry *dentry, bool is_dir) -+{ -+ int err; -+ enum ovl_path_type type; -+ struct path realpath; -+ struct dentry *upperdir; -+ -+ err = ovl_copy_up(dentry->d_parent); -+ if (err) -+ return err; -+ -+ upperdir = ovl_dentry_upper(dentry->d_parent); -+ mutex_lock_nested(&upperdir->d_inode->i_mutex, I_MUTEX_PARENT); -+ type = ovl_path_real(dentry, &realpath); -+ if (type != OVL_PATH_LOWER) { -+ err = -ESTALE; -+ if (realpath.dentry->d_parent != upperdir) -+ goto out_d_drop; -+ -+ /* FIXME: create whiteout up front and rename to target */ -+ -+ if (is_dir) -+ err = vfs_rmdir(upperdir->d_inode, realpath.dentry); -+ else -+ err = vfs_unlink(upperdir->d_inode, realpath.dentry); -+ if (err) -+ goto out_d_drop; -+ -+ ovl_dentry_version_inc(dentry->d_parent); -+ } -+ -+ if (type != OVL_PATH_UPPER || ovl_dentry_is_opaque(dentry)) -+ err = ovl_whiteout(upperdir, dentry); -+ -+ /* -+ * Keeping this dentry hashed would mean having to release -+ * upperpath/lowerpath, which could only be done if we are the -+ * sole user of this dentry. Too tricky... Just unhash for -+ * now. -+ */ -+out_d_drop: -+ d_drop(dentry); -+ mutex_unlock(&upperdir->d_inode->i_mutex); -+ -+ return err; -+} -+ -+static int ovl_unlink(struct inode *dir, struct dentry *dentry) -+{ -+ return ovl_do_remove(dentry, false); -+} -+ -+ -+static int ovl_rmdir(struct inode *dir, struct dentry *dentry) -+{ -+ int err; -+ enum ovl_path_type type; -+ -+ type = ovl_path_type(dentry); -+ if (type != OVL_PATH_UPPER) { -+ err = ovl_check_empty_and_clear(dentry, type); -+ if (err) -+ return err; -+ } -+ -+ return ovl_do_remove(dentry, true); -+} -+ -+static int ovl_link(struct dentry *old, struct inode *newdir, -+ struct dentry *new) -+{ -+ int err; -+ struct dentry *olddentry; -+ struct dentry *newdentry; -+ struct dentry *upperdir; -+ struct inode *newinode; -+ -+ err = ovl_copy_up(old); -+ if (err) -+ goto out; -+ -+ err = ovl_copy_up(new->d_parent); -+ if (err) -+ goto out; -+ -+ upperdir = ovl_dentry_upper(new->d_parent); -+ mutex_lock_nested(&upperdir->d_inode->i_mutex, I_MUTEX_PARENT); -+ newdentry = ovl_lookup_create(upperdir, new); -+ err = PTR_ERR(newdentry); -+ if (IS_ERR(newdentry)) -+ goto out_unlock; -+ -+ olddentry = ovl_dentry_upper(old); -+ err = vfs_link(olddentry, upperdir->d_inode, newdentry); -+ if (!err) { -+ if (WARN_ON(!newdentry->d_inode)) { -+ dput(newdentry); -+ err = -ENOENT; -+ goto out_unlock; -+ } -+ newinode = ovl_new_inode(old->d_sb, newdentry->d_inode->i_mode, -+ new->d_fsdata); -+ if (!newinode) { -+ err = -ENOMEM; -+ goto link_fail; -+ } -+ ovl_copyattr(upperdir->d_inode, newinode); -+ -+ ovl_dentry_version_inc(new->d_parent); -+ ovl_dentry_update(new, newdentry); -+ -+ d_instantiate(new, newinode); -+ } else { -+link_fail: -+ if (ovl_dentry_is_opaque(new)) -+ ovl_whiteout(upperdir, new); -+ dput(newdentry); -+ } -+out_unlock: -+ mutex_unlock(&upperdir->d_inode->i_mutex); -+out: -+ return err; -+} -+ -+static int ovl_rename(struct inode *olddir, struct dentry *old, -+ struct inode *newdir, struct dentry *new) -+{ -+ int err; -+ enum ovl_path_type old_type; -+ enum ovl_path_type new_type; -+ struct dentry *old_upperdir; -+ struct dentry *new_upperdir; -+ struct dentry *olddentry; -+ struct dentry *newdentry; -+ struct dentry *trap; -+ bool old_opaque; -+ bool new_opaque; -+ bool new_create = false; -+ bool is_dir = S_ISDIR(old->d_inode->i_mode); -+ -+ /* Don't copy up directory trees */ -+ old_type = ovl_path_type(old); -+ if (old_type != OVL_PATH_UPPER && is_dir) -+ return -EXDEV; -+ -+ if (new->d_inode) { -+ new_type = ovl_path_type(new); -+ -+ if (new_type == OVL_PATH_LOWER && old_type == OVL_PATH_LOWER) { -+ if (ovl_dentry_lower(old)->d_inode == -+ ovl_dentry_lower(new)->d_inode) -+ return 0; -+ } -+ if (new_type != OVL_PATH_LOWER && old_type != OVL_PATH_LOWER) { -+ if (ovl_dentry_upper(old)->d_inode == -+ ovl_dentry_upper(new)->d_inode) -+ return 0; -+ } -+ -+ if (new_type != OVL_PATH_UPPER && -+ S_ISDIR(new->d_inode->i_mode)) { -+ err = ovl_check_empty_and_clear(new, new_type); -+ if (err) -+ return err; -+ } -+ } else { -+ new_type = OVL_PATH_UPPER; -+ } -+ -+ err = ovl_copy_up(old); -+ if (err) -+ return err; -+ -+ err = ovl_copy_up(new->d_parent); -+ if (err) -+ return err; -+ -+ old_upperdir = ovl_dentry_upper(old->d_parent); -+ new_upperdir = ovl_dentry_upper(new->d_parent); -+ -+ trap = lock_rename(new_upperdir, old_upperdir); -+ -+ olddentry = ovl_dentry_upper(old); -+ newdentry = ovl_dentry_upper(new); -+ if (newdentry) { -+ dget(newdentry); -+ } else { -+ new_create = true; -+ newdentry = ovl_lookup_create(new_upperdir, new); -+ err = PTR_ERR(newdentry); -+ if (IS_ERR(newdentry)) -+ goto out_unlock; -+ } -+ -+ err = -ESTALE; -+ if (olddentry->d_parent != old_upperdir) -+ goto out_dput; -+ if (newdentry->d_parent != new_upperdir) -+ goto out_dput; -+ if (olddentry == trap) -+ goto out_dput; -+ if (newdentry == trap) -+ goto out_dput; -+ -+ old_opaque = ovl_dentry_is_opaque(old); -+ new_opaque = ovl_dentry_is_opaque(new) || new_type != OVL_PATH_UPPER; -+ -+ if (is_dir && !old_opaque && new_opaque) { -+ err = ovl_set_opaque(olddentry); -+ if (err) -+ goto out_dput; -+ } -+ -+ err = vfs_rename(old_upperdir->d_inode, olddentry, -+ new_upperdir->d_inode, newdentry); -+ -+ if (err) { -+ if (new_create && ovl_dentry_is_opaque(new)) -+ ovl_whiteout(new_upperdir, new); -+ if (is_dir && !old_opaque && new_opaque) -+ ovl_remove_opaque(olddentry); -+ goto out_dput; -+ } -+ -+ if (old_type != OVL_PATH_UPPER || old_opaque) -+ err = ovl_whiteout(old_upperdir, old); -+ if (is_dir && old_opaque && !new_opaque) -+ ovl_remove_opaque(olddentry); -+ -+ if (old_opaque != new_opaque) -+ ovl_dentry_set_opaque(old, new_opaque); -+ -+ ovl_dentry_version_inc(old->d_parent); -+ ovl_dentry_version_inc(new->d_parent); -+ -+out_dput: -+ dput(newdentry); -+out_unlock: -+ unlock_rename(new_upperdir, old_upperdir); -+ return err; -+} -+ -+const struct inode_operations ovl_dir_inode_operations = { -+ .lookup = ovl_lookup, -+ .mkdir = ovl_mkdir, -+ .symlink = ovl_symlink, -+ .unlink = ovl_unlink, -+ .rmdir = ovl_rmdir, -+ .rename = ovl_rename, -+ .link = ovl_link, -+ .setattr = ovl_setattr, -+ .create = ovl_create, -+ .mknod = ovl_mknod, -+ .permission = ovl_permission, -+ .getattr = ovl_dir_getattr, -+ .setxattr = ovl_setxattr, -+ .getxattr = ovl_getxattr, -+ .listxattr = ovl_listxattr, -+ .removexattr = ovl_removexattr, -+}; -diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c -new file mode 100644 -index 0000000..ee37e92 ---- /dev/null -+++ b/fs/overlayfs/inode.c -@@ -0,0 +1,372 @@ -+/* -+ * -+ * Copyright (C) 2011 Novell Inc. -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 as published by -+ * the Free Software Foundation. -+ */ -+ -+#include -+#include -+#include -+#include "overlayfs.h" -+ -+int ovl_setattr(struct dentry *dentry, struct iattr *attr) -+{ -+ struct dentry *upperdentry; -+ int err; -+ -+ if ((attr->ia_valid & ATTR_SIZE) && !ovl_dentry_upper(dentry)) -+ err = ovl_copy_up_truncate(dentry, attr->ia_size); -+ else -+ err = ovl_copy_up(dentry); -+ if (err) -+ return err; -+ -+ upperdentry = ovl_dentry_upper(dentry); -+ -+ if (attr->ia_valid & (ATTR_KILL_SUID|ATTR_KILL_SGID)) -+ attr->ia_valid &= ~ATTR_MODE; -+ -+ mutex_lock(&upperdentry->d_inode->i_mutex); -+ err = notify_change(upperdentry, attr); -+ if (!err) -+ ovl_copyattr(upperdentry->d_inode, dentry->d_inode); -+ mutex_unlock(&upperdentry->d_inode->i_mutex); -+ -+ return err; -+} -+ -+static int ovl_getattr(struct vfsmount *mnt, struct dentry *dentry, -+ struct kstat *stat) -+{ -+ struct path realpath; -+ -+ ovl_path_real(dentry, &realpath); -+ return vfs_getattr(&realpath, stat); -+} -+ -+int ovl_permission(struct inode *inode, int mask) -+{ -+ struct ovl_entry *oe; -+ struct dentry *alias = NULL; -+ struct inode *realinode; -+ struct dentry *realdentry; -+ bool is_upper; -+ int err; -+ -+ if (S_ISDIR(inode->i_mode)) { -+ oe = inode->i_private; -+ } else if (mask & MAY_NOT_BLOCK) { -+ return -ECHILD; -+ } else { -+ /* -+ * For non-directories find an alias and get the info -+ * from there. -+ */ -+ alias = d_find_any_alias(inode); -+ if (WARN_ON(!alias)) -+ return -ENOENT; -+ -+ oe = alias->d_fsdata; -+ } -+ -+ realdentry = ovl_entry_real(oe, &is_upper); -+ -+ /* Careful in RCU walk mode */ -+ realinode = ACCESS_ONCE(realdentry->d_inode); -+ if (!realinode) { -+ WARN_ON(!(mask & MAY_NOT_BLOCK)); -+ err = -ENOENT; -+ goto out_dput; -+ } -+ -+ if (mask & MAY_WRITE) { -+ umode_t mode = realinode->i_mode; -+ -+ /* -+ * Writes will always be redirected to upper layer, so -+ * ignore lower layer being read-only. -+ * -+ * If the overlay itself is read-only then proceed -+ * with the permission check, don't return EROFS. -+ * This will only happen if this is the lower layer of -+ * another overlayfs. -+ * -+ * If upper fs becomes read-only after the overlay was -+ * constructed return EROFS to prevent modification of -+ * upper layer. -+ */ -+ err = -EROFS; -+ if (is_upper && !IS_RDONLY(inode) && IS_RDONLY(realinode) && -+ (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode))) -+ goto out_dput; -+ } -+ -+ err = __inode_permission(realinode, mask); -+out_dput: -+ dput(alias); -+ return err; -+} -+ -+ -+struct ovl_link_data { -+ struct dentry *realdentry; -+ void *cookie; -+}; -+ -+static void *ovl_follow_link(struct dentry *dentry, struct nameidata *nd) -+{ -+ void *ret; -+ struct dentry *realdentry; -+ struct inode *realinode; -+ -+ realdentry = ovl_dentry_real(dentry); -+ realinode = realdentry->d_inode; -+ -+ if (WARN_ON(!realinode->i_op->follow_link)) -+ return ERR_PTR(-EPERM); -+ -+ ret = realinode->i_op->follow_link(realdentry, nd); -+ if (IS_ERR(ret)) -+ return ret; -+ -+ if (realinode->i_op->put_link) { -+ struct ovl_link_data *data; -+ -+ data = kmalloc(sizeof(struct ovl_link_data), GFP_KERNEL); -+ if (!data) { -+ realinode->i_op->put_link(realdentry, nd, ret); -+ return ERR_PTR(-ENOMEM); -+ } -+ data->realdentry = realdentry; -+ data->cookie = ret; -+ -+ return data; -+ } else { -+ return NULL; -+ } -+} -+ -+static void ovl_put_link(struct dentry *dentry, struct nameidata *nd, void *c) -+{ -+ struct inode *realinode; -+ struct ovl_link_data *data = c; -+ -+ if (!data) -+ return; -+ -+ realinode = data->realdentry->d_inode; -+ realinode->i_op->put_link(data->realdentry, nd, data->cookie); -+ kfree(data); -+} -+ -+static int ovl_readlink(struct dentry *dentry, char __user *buf, int bufsiz) -+{ -+ struct path realpath; -+ struct inode *realinode; -+ -+ ovl_path_real(dentry, &realpath); -+ realinode = realpath.dentry->d_inode; -+ -+ if (!realinode->i_op->readlink) -+ return -EINVAL; -+ -+ touch_atime(&realpath); -+ -+ return realinode->i_op->readlink(realpath.dentry, buf, bufsiz); -+} -+ -+ -+static bool ovl_is_private_xattr(const char *name) -+{ -+ return strncmp(name, "trusted.overlay.", 14) == 0; -+} -+ -+int ovl_setxattr(struct dentry *dentry, const char *name, -+ const void *value, size_t size, int flags) -+{ -+ int err; -+ struct dentry *upperdentry; -+ -+ if (ovl_is_private_xattr(name)) -+ return -EPERM; -+ -+ err = ovl_copy_up(dentry); -+ if (err) -+ return err; -+ -+ upperdentry = ovl_dentry_upper(dentry); -+ return vfs_setxattr(upperdentry, name, value, size, flags); -+} -+ -+ssize_t ovl_getxattr(struct dentry *dentry, const char *name, -+ void *value, size_t size) -+{ -+ if (ovl_path_type(dentry->d_parent) == OVL_PATH_MERGE && -+ ovl_is_private_xattr(name)) -+ return -ENODATA; -+ -+ return vfs_getxattr(ovl_dentry_real(dentry), name, value, size); -+} -+ -+ssize_t ovl_listxattr(struct dentry *dentry, char *list, size_t size) -+{ -+ ssize_t res; -+ int off; -+ -+ res = vfs_listxattr(ovl_dentry_real(dentry), list, size); -+ if (res <= 0 || size == 0) -+ return res; -+ -+ if (ovl_path_type(dentry->d_parent) != OVL_PATH_MERGE) -+ return res; -+ -+ /* filter out private xattrs */ -+ for (off = 0; off < res;) { -+ char *s = list + off; -+ size_t slen = strlen(s) + 1; -+ -+ BUG_ON(off + slen > res); -+ -+ if (ovl_is_private_xattr(s)) { -+ res -= slen; -+ memmove(s, s + slen, res - off); -+ } else { -+ off += slen; -+ } -+ } -+ -+ return res; -+} -+ -+int ovl_removexattr(struct dentry *dentry, const char *name) -+{ -+ int err; -+ struct path realpath; -+ enum ovl_path_type type; -+ -+ if (ovl_path_type(dentry->d_parent) == OVL_PATH_MERGE && -+ ovl_is_private_xattr(name)) -+ return -ENODATA; -+ -+ type = ovl_path_real(dentry, &realpath); -+ if (type == OVL_PATH_LOWER) { -+ err = vfs_getxattr(realpath.dentry, name, NULL, 0); -+ if (err < 0) -+ return err; -+ -+ err = ovl_copy_up(dentry); -+ if (err) -+ return err; -+ -+ ovl_path_upper(dentry, &realpath); -+ } -+ -+ return vfs_removexattr(realpath.dentry, name); -+} -+ -+static bool ovl_open_need_copy_up(int flags, enum ovl_path_type type, -+ struct dentry *realdentry) -+{ -+ if (type != OVL_PATH_LOWER) -+ return false; -+ -+ if (special_file(realdentry->d_inode->i_mode)) -+ return false; -+ -+ if (!(OPEN_FMODE(flags) & FMODE_WRITE) && !(flags & O_TRUNC)) -+ return false; -+ -+ return true; -+} -+ -+static int ovl_dentry_open(struct dentry *dentry, struct file *file, -+ const struct cred *cred) -+{ -+ int err; -+ struct path realpath; -+ enum ovl_path_type type; -+ -+ type = ovl_path_real(dentry, &realpath); -+ if (ovl_open_need_copy_up(file->f_flags, type, realpath.dentry)) { -+ if (file->f_flags & O_TRUNC) -+ err = ovl_copy_up_truncate(dentry, 0); -+ else -+ err = ovl_copy_up(dentry); -+ if (err) -+ return err; -+ -+ ovl_path_upper(dentry, &realpath); -+ } -+ -+ return vfs_open(&realpath, file, cred); -+} -+ -+static const struct inode_operations ovl_file_inode_operations = { -+ .setattr = ovl_setattr, -+ .permission = ovl_permission, -+ .getattr = ovl_getattr, -+ .setxattr = ovl_setxattr, -+ .getxattr = ovl_getxattr, -+ .listxattr = ovl_listxattr, -+ .removexattr = ovl_removexattr, -+ .dentry_open = ovl_dentry_open, -+}; -+ -+static const struct inode_operations ovl_symlink_inode_operations = { -+ .setattr = ovl_setattr, -+ .follow_link = ovl_follow_link, -+ .put_link = ovl_put_link, -+ .readlink = ovl_readlink, -+ .getattr = ovl_getattr, -+ .setxattr = ovl_setxattr, -+ .getxattr = ovl_getxattr, -+ .listxattr = ovl_listxattr, -+ .removexattr = ovl_removexattr, -+}; -+ -+struct inode *ovl_new_inode(struct super_block *sb, umode_t mode, -+ struct ovl_entry *oe) -+{ -+ struct inode *inode; -+ -+ inode = new_inode(sb); -+ if (!inode) -+ return NULL; -+ -+ mode &= S_IFMT; -+ -+ inode->i_ino = get_next_ino(); -+ inode->i_mode = mode; -+ inode->i_flags |= S_NOATIME | S_NOCMTIME; -+ -+ switch (mode) { -+ case S_IFDIR: -+ inode->i_private = oe; -+ inode->i_op = &ovl_dir_inode_operations; -+ inode->i_fop = &ovl_dir_operations; -+ break; -+ -+ case S_IFLNK: -+ inode->i_op = &ovl_symlink_inode_operations; -+ break; -+ -+ case S_IFREG: -+ case S_IFSOCK: -+ case S_IFBLK: -+ case S_IFCHR: -+ case S_IFIFO: -+ inode->i_op = &ovl_file_inode_operations; -+ break; -+ -+ default: -+ WARN(1, "illegal file type: %i\n", mode); -+ iput(inode); -+ inode = NULL; -+ } -+ -+ return inode; -+ -+} -diff --git a/fs/overlayfs/overlayfs.h b/fs/overlayfs/overlayfs.h -new file mode 100644 -index 0000000..1cba38f ---- /dev/null -+++ b/fs/overlayfs/overlayfs.h -@@ -0,0 +1,70 @@ -+/* -+ * -+ * Copyright (C) 2011 Novell Inc. -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 as published by -+ * the Free Software Foundation. -+ */ -+ -+struct ovl_entry; -+ -+enum ovl_path_type { -+ OVL_PATH_UPPER, -+ OVL_PATH_MERGE, -+ OVL_PATH_LOWER, -+}; -+ -+extern const char *ovl_opaque_xattr; -+extern const char *ovl_whiteout_xattr; -+extern const struct dentry_operations ovl_dentry_operations; -+ -+enum ovl_path_type ovl_path_type(struct dentry *dentry); -+u64 ovl_dentry_version_get(struct dentry *dentry); -+void ovl_dentry_version_inc(struct dentry *dentry); -+void ovl_path_upper(struct dentry *dentry, struct path *path); -+void ovl_path_lower(struct dentry *dentry, struct path *path); -+enum ovl_path_type ovl_path_real(struct dentry *dentry, struct path *path); -+struct dentry *ovl_dentry_upper(struct dentry *dentry); -+struct dentry *ovl_dentry_lower(struct dentry *dentry); -+struct dentry *ovl_dentry_real(struct dentry *dentry); -+struct dentry *ovl_entry_real(struct ovl_entry *oe, bool *is_upper); -+bool ovl_dentry_is_opaque(struct dentry *dentry); -+void ovl_dentry_set_opaque(struct dentry *dentry, bool opaque); -+bool ovl_is_whiteout(struct dentry *dentry); -+void ovl_dentry_update(struct dentry *dentry, struct dentry *upperdentry); -+struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry, -+ unsigned int flags); -+struct file *ovl_path_open(struct path *path, int flags); -+ -+struct dentry *ovl_upper_create(struct dentry *upperdir, struct dentry *dentry, -+ struct kstat *stat, const char *link); -+ -+/* readdir.c */ -+extern const struct file_operations ovl_dir_operations; -+int ovl_check_empty_and_clear(struct dentry *dentry, enum ovl_path_type type); -+ -+/* inode.c */ -+int ovl_setattr(struct dentry *dentry, struct iattr *attr); -+int ovl_permission(struct inode *inode, int mask); -+int ovl_setxattr(struct dentry *dentry, const char *name, -+ const void *value, size_t size, int flags); -+ssize_t ovl_getxattr(struct dentry *dentry, const char *name, -+ void *value, size_t size); -+ssize_t ovl_listxattr(struct dentry *dentry, char *list, size_t size); -+int ovl_removexattr(struct dentry *dentry, const char *name); -+ -+struct inode *ovl_new_inode(struct super_block *sb, umode_t mode, -+ struct ovl_entry *oe); -+static inline void ovl_copyattr(struct inode *from, struct inode *to) -+{ -+ to->i_uid = from->i_uid; -+ to->i_gid = from->i_gid; -+} -+ -+/* dir.c */ -+extern const struct inode_operations ovl_dir_inode_operations; -+ -+/* copy_up.c */ -+int ovl_copy_up(struct dentry *dentry); -+int ovl_copy_up_truncate(struct dentry *dentry, loff_t size); -diff --git a/fs/overlayfs/readdir.c b/fs/overlayfs/readdir.c -new file mode 100644 -index 0000000..4c18abf ---- /dev/null -+++ b/fs/overlayfs/readdir.c -@@ -0,0 +1,566 @@ -+/* -+ * -+ * Copyright (C) 2011 Novell Inc. -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 as published by -+ * the Free Software Foundation. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include "overlayfs.h" -+ -+struct ovl_cache_entry { -+ const char *name; -+ unsigned int len; -+ unsigned int type; -+ u64 ino; -+ bool is_whiteout; -+ struct list_head l_node; -+ struct rb_node node; -+}; -+ -+struct ovl_readdir_data { -+ struct rb_root *root; -+ struct list_head *list; -+ struct list_head *middle; -+ struct dentry *dir; -+ int count; -+ int err; -+}; -+ -+struct ovl_dir_file { -+ bool is_real; -+ bool is_cached; -+ struct list_head cursor; -+ u64 cache_version; -+ struct list_head cache; -+ struct file *realfile; -+}; -+ -+static struct ovl_cache_entry *ovl_cache_entry_from_node(struct rb_node *n) -+{ -+ return container_of(n, struct ovl_cache_entry, node); -+} -+ -+static struct ovl_cache_entry *ovl_cache_entry_find(struct rb_root *root, -+ const char *name, int len) -+{ -+ struct rb_node *node = root->rb_node; -+ int cmp; -+ -+ while (node) { -+ struct ovl_cache_entry *p = ovl_cache_entry_from_node(node); -+ -+ cmp = strncmp(name, p->name, len); -+ if (cmp > 0) -+ node = p->node.rb_right; -+ else if (cmp < 0 || len < p->len) -+ node = p->node.rb_left; -+ else -+ return p; -+ } -+ -+ return NULL; -+} -+ -+static struct ovl_cache_entry *ovl_cache_entry_new(const char *name, int len, -+ u64 ino, unsigned int d_type) -+{ -+ struct ovl_cache_entry *p; -+ -+ p = kmalloc(sizeof(*p) + len + 1, GFP_KERNEL); -+ if (p) { -+ char *name_copy = (char *) (p + 1); -+ memcpy(name_copy, name, len); -+ name_copy[len] = '\0'; -+ p->name = name_copy; -+ p->len = len; -+ p->type = d_type; -+ p->ino = ino; -+ p->is_whiteout = false; -+ } -+ -+ return p; -+} -+ -+static int ovl_cache_entry_add_rb(struct ovl_readdir_data *rdd, -+ const char *name, int len, u64 ino, -+ unsigned int d_type) -+{ -+ struct rb_node **newp = &rdd->root->rb_node; -+ struct rb_node *parent = NULL; -+ struct ovl_cache_entry *p; -+ -+ while (*newp) { -+ int cmp; -+ struct ovl_cache_entry *tmp; -+ -+ parent = *newp; -+ tmp = ovl_cache_entry_from_node(*newp); -+ cmp = strncmp(name, tmp->name, len); -+ if (cmp > 0) -+ newp = &tmp->node.rb_right; -+ else if (cmp < 0 || len < tmp->len) -+ newp = &tmp->node.rb_left; -+ else -+ return 0; -+ } -+ -+ p = ovl_cache_entry_new(name, len, ino, d_type); -+ if (p == NULL) -+ return -ENOMEM; -+ -+ list_add_tail(&p->l_node, rdd->list); -+ rb_link_node(&p->node, parent, newp); -+ rb_insert_color(&p->node, rdd->root); -+ -+ return 0; -+} -+ -+static int ovl_fill_lower(void *buf, const char *name, int namelen, -+ loff_t offset, u64 ino, unsigned int d_type) -+{ -+ struct ovl_readdir_data *rdd = buf; -+ struct ovl_cache_entry *p; -+ -+ rdd->count++; -+ p = ovl_cache_entry_find(rdd->root, name, namelen); -+ if (p) { -+ list_move_tail(&p->l_node, rdd->middle); -+ } else { -+ p = ovl_cache_entry_new(name, namelen, ino, d_type); -+ if (p == NULL) -+ rdd->err = -ENOMEM; -+ else -+ list_add_tail(&p->l_node, rdd->middle); -+ } -+ -+ return rdd->err; -+} -+ -+static void ovl_cache_free(struct list_head *list) -+{ -+ struct ovl_cache_entry *p; -+ struct ovl_cache_entry *n; -+ -+ list_for_each_entry_safe(p, n, list, l_node) -+ kfree(p); -+ -+ INIT_LIST_HEAD(list); -+} -+ -+static int ovl_fill_upper(void *buf, const char *name, int namelen, -+ loff_t offset, u64 ino, unsigned int d_type) -+{ -+ struct ovl_readdir_data *rdd = buf; -+ -+ rdd->count++; -+ return ovl_cache_entry_add_rb(rdd, name, namelen, ino, d_type); -+} -+ -+static inline int ovl_dir_read(struct path *realpath, -+ struct ovl_readdir_data *rdd, filldir_t filler) -+{ -+ struct file *realfile; -+ int err; -+ -+ realfile = ovl_path_open(realpath, O_RDONLY | O_DIRECTORY); -+ if (IS_ERR(realfile)) -+ return PTR_ERR(realfile); -+ -+ do { -+ rdd->count = 0; -+ rdd->err = 0; -+ err = vfs_readdir(realfile, filler, rdd); -+ if (err >= 0) -+ err = rdd->err; -+ } while (!err && rdd->count); -+ fput(realfile); -+ -+ return 0; -+} -+ -+static void ovl_dir_reset(struct file *file) -+{ -+ struct ovl_dir_file *od = file->private_data; -+ enum ovl_path_type type = ovl_path_type(file->f_path.dentry); -+ -+ if (ovl_dentry_version_get(file->f_path.dentry) != od->cache_version) { -+ list_del_init(&od->cursor); -+ ovl_cache_free(&od->cache); -+ od->is_cached = false; -+ } -+ WARN_ON(!od->is_real && type != OVL_PATH_MERGE); -+ if (od->is_real && type == OVL_PATH_MERGE) { -+ fput(od->realfile); -+ od->realfile = NULL; -+ od->is_real = false; -+ } -+} -+ -+static int ovl_dir_mark_whiteouts(struct ovl_readdir_data *rdd) -+{ -+ struct ovl_cache_entry *p; -+ struct dentry *dentry; -+ const struct cred *old_cred; -+ struct cred *override_cred; -+ -+ override_cred = prepare_creds(); -+ if (!override_cred) { -+ ovl_cache_free(rdd->list); -+ return -ENOMEM; -+ } -+ -+ /* -+ * CAP_SYS_ADMIN for getxattr -+ * CAP_DAC_OVERRIDE for lookup -+ */ -+ cap_raise(override_cred->cap_effective, CAP_SYS_ADMIN); -+ cap_raise(override_cred->cap_effective, CAP_DAC_OVERRIDE); -+ old_cred = override_creds(override_cred); -+ -+ mutex_lock(&rdd->dir->d_inode->i_mutex); -+ list_for_each_entry(p, rdd->list, l_node) { -+ if (p->type != DT_LNK) -+ continue; -+ -+ dentry = lookup_one_len(p->name, rdd->dir, p->len); -+ if (IS_ERR(dentry)) -+ continue; -+ -+ p->is_whiteout = ovl_is_whiteout(dentry); -+ dput(dentry); -+ } -+ mutex_unlock(&rdd->dir->d_inode->i_mutex); -+ -+ revert_creds(old_cred); -+ put_cred(override_cred); -+ -+ return 0; -+} -+ -+static inline int ovl_dir_read_merged(struct path *upperpath, -+ struct path *lowerpath, -+ struct ovl_readdir_data *rdd) -+{ -+ int err; -+ struct rb_root root = RB_ROOT; -+ struct list_head middle; -+ -+ rdd->root = &root; -+ if (upperpath->dentry) { -+ rdd->dir = upperpath->dentry; -+ err = ovl_dir_read(upperpath, rdd, ovl_fill_upper); -+ if (err) -+ goto out; -+ -+ err = ovl_dir_mark_whiteouts(rdd); -+ if (err) -+ goto out; -+ } -+ /* -+ * Insert lowerpath entries before upperpath ones, this allows -+ * offsets to be reasonably constant -+ */ -+ list_add(&middle, rdd->list); -+ rdd->middle = &middle; -+ err = ovl_dir_read(lowerpath, rdd, ovl_fill_lower); -+ list_del(&middle); -+out: -+ rdd->root = NULL; -+ -+ return err; -+} -+ -+static void ovl_seek_cursor(struct ovl_dir_file *od, loff_t pos) -+{ -+ struct list_head *l; -+ loff_t off; -+ -+ l = od->cache.next; -+ for (off = 0; off < pos; off++) { -+ if (l == &od->cache) -+ break; -+ l = l->next; -+ } -+ list_move_tail(&od->cursor, l); -+} -+ -+static int ovl_readdir(struct file *file, void *buf, filldir_t filler) -+{ -+ struct ovl_dir_file *od = file->private_data; -+ int res; -+ -+ if (!file->f_pos) -+ ovl_dir_reset(file); -+ -+ if (od->is_real) { -+ res = vfs_readdir(od->realfile, filler, buf); -+ file->f_pos = od->realfile->f_pos; -+ -+ return res; -+ } -+ -+ if (!od->is_cached) { -+ struct path lowerpath; -+ struct path upperpath; -+ struct ovl_readdir_data rdd = { .list = &od->cache }; -+ -+ ovl_path_lower(file->f_path.dentry, &lowerpath); -+ ovl_path_upper(file->f_path.dentry, &upperpath); -+ -+ res = ovl_dir_read_merged(&upperpath, &lowerpath, &rdd); -+ if (res) { -+ ovl_cache_free(rdd.list); -+ return res; -+ } -+ -+ od->cache_version = ovl_dentry_version_get(file->f_path.dentry); -+ od->is_cached = true; -+ -+ ovl_seek_cursor(od, file->f_pos); -+ } -+ -+ while (od->cursor.next != &od->cache) { -+ int over; -+ loff_t off; -+ struct ovl_cache_entry *p; -+ -+ p = list_entry(od->cursor.next, struct ovl_cache_entry, l_node); -+ off = file->f_pos; -+ if (!p->is_whiteout) { -+ over = filler(buf, p->name, p->len, off, p->ino, -+ p->type); -+ if (over) -+ break; -+ } -+ file->f_pos++; -+ list_move(&od->cursor, &p->l_node); -+ } -+ -+ return 0; -+} -+ -+static loff_t ovl_dir_llseek(struct file *file, loff_t offset, int origin) -+{ -+ loff_t res; -+ struct ovl_dir_file *od = file->private_data; -+ -+ mutex_lock(&file_inode(file)->i_mutex); -+ if (!file->f_pos) -+ ovl_dir_reset(file); -+ -+ if (od->is_real) { -+ res = vfs_llseek(od->realfile, offset, origin); -+ file->f_pos = od->realfile->f_pos; -+ } else { -+ res = -EINVAL; -+ -+ switch (origin) { -+ case SEEK_CUR: -+ offset += file->f_pos; -+ break; -+ case SEEK_SET: -+ break; -+ default: -+ goto out_unlock; -+ } -+ if (offset < 0) -+ goto out_unlock; -+ -+ if (offset != file->f_pos) { -+ file->f_pos = offset; -+ if (od->is_cached) -+ ovl_seek_cursor(od, offset); -+ } -+ res = offset; -+ } -+out_unlock: -+ mutex_unlock(&file_inode(file)->i_mutex); -+ -+ return res; -+} -+ -+static int ovl_dir_fsync(struct file *file, loff_t start, loff_t end, -+ int datasync) -+{ -+ struct ovl_dir_file *od = file->private_data; -+ -+ /* May need to reopen directory if it got copied up */ -+ if (!od->realfile) { -+ struct path upperpath; -+ -+ ovl_path_upper(file->f_path.dentry, &upperpath); -+ od->realfile = ovl_path_open(&upperpath, O_RDONLY); -+ if (IS_ERR(od->realfile)) -+ return PTR_ERR(od->realfile); -+ } -+ -+ return vfs_fsync_range(od->realfile, start, end, datasync); -+} -+ -+static int ovl_dir_release(struct inode *inode, struct file *file) -+{ -+ struct ovl_dir_file *od = file->private_data; -+ -+ list_del(&od->cursor); -+ ovl_cache_free(&od->cache); -+ if (od->realfile) -+ fput(od->realfile); -+ kfree(od); -+ -+ return 0; -+} -+ -+static int ovl_dir_open(struct inode *inode, struct file *file) -+{ -+ struct path realpath; -+ struct file *realfile; -+ struct ovl_dir_file *od; -+ enum ovl_path_type type; -+ -+ od = kzalloc(sizeof(struct ovl_dir_file), GFP_KERNEL); -+ if (!od) -+ return -ENOMEM; -+ -+ type = ovl_path_real(file->f_path.dentry, &realpath); -+ realfile = ovl_path_open(&realpath, file->f_flags); -+ if (IS_ERR(realfile)) { -+ kfree(od); -+ return PTR_ERR(realfile); -+ } -+ INIT_LIST_HEAD(&od->cache); -+ INIT_LIST_HEAD(&od->cursor); -+ od->is_cached = false; -+ od->realfile = realfile; -+ od->is_real = (type != OVL_PATH_MERGE); -+ file->private_data = od; -+ -+ return 0; -+} -+ -+const struct file_operations ovl_dir_operations = { -+ .read = generic_read_dir, -+ .open = ovl_dir_open, -+ .readdir = ovl_readdir, -+ .llseek = ovl_dir_llseek, -+ .fsync = ovl_dir_fsync, -+ .release = ovl_dir_release, -+}; -+ -+static int ovl_check_empty_dir(struct dentry *dentry, struct list_head *list) -+{ -+ int err; -+ struct path lowerpath; -+ struct path upperpath; -+ struct ovl_cache_entry *p; -+ struct ovl_readdir_data rdd = { .list = list }; -+ -+ ovl_path_upper(dentry, &upperpath); -+ ovl_path_lower(dentry, &lowerpath); -+ -+ err = ovl_dir_read_merged(&upperpath, &lowerpath, &rdd); -+ if (err) -+ return err; -+ -+ err = 0; -+ -+ list_for_each_entry(p, list, l_node) { -+ if (p->is_whiteout) -+ continue; -+ -+ if (p->name[0] == '.') { -+ if (p->len == 1) -+ continue; -+ if (p->len == 2 && p->name[1] == '.') -+ continue; -+ } -+ err = -ENOTEMPTY; -+ break; -+ } -+ -+ return err; -+} -+ -+static int ovl_remove_whiteouts(struct dentry *dir, struct list_head *list) -+{ -+ struct path upperpath; -+ struct dentry *upperdir; -+ struct ovl_cache_entry *p; -+ const struct cred *old_cred; -+ struct cred *override_cred; -+ int err; -+ -+ ovl_path_upper(dir, &upperpath); -+ upperdir = upperpath.dentry; -+ -+ override_cred = prepare_creds(); -+ if (!override_cred) -+ return -ENOMEM; -+ -+ /* -+ * CAP_DAC_OVERRIDE for lookup and unlink -+ * CAP_SYS_ADMIN for setxattr of "trusted" namespace -+ * CAP_FOWNER for unlink in sticky directory -+ */ -+ cap_raise(override_cred->cap_effective, CAP_DAC_OVERRIDE); -+ cap_raise(override_cred->cap_effective, CAP_SYS_ADMIN); -+ cap_raise(override_cred->cap_effective, CAP_FOWNER); -+ old_cred = override_creds(override_cred); -+ -+ err = vfs_setxattr(upperdir, ovl_opaque_xattr, "y", 1, 0); -+ if (err) -+ goto out_revert_creds; -+ -+ mutex_lock_nested(&upperdir->d_inode->i_mutex, I_MUTEX_PARENT); -+ list_for_each_entry(p, list, l_node) { -+ struct dentry *dentry; -+ int ret; -+ -+ if (!p->is_whiteout) -+ continue; -+ -+ dentry = lookup_one_len(p->name, upperdir, p->len); -+ if (IS_ERR(dentry)) { -+ pr_warn( -+ "overlayfs: failed to lookup whiteout %.*s: %li\n", -+ p->len, p->name, PTR_ERR(dentry)); -+ continue; -+ } -+ ret = vfs_unlink(upperdir->d_inode, dentry); -+ dput(dentry); -+ if (ret) -+ pr_warn( -+ "overlayfs: failed to unlink whiteout %.*s: %i\n", -+ p->len, p->name, ret); -+ } -+ mutex_unlock(&upperdir->d_inode->i_mutex); -+ -+out_revert_creds: -+ revert_creds(old_cred); -+ put_cred(override_cred); -+ -+ return err; -+} -+ -+int ovl_check_empty_and_clear(struct dentry *dentry, enum ovl_path_type type) -+{ -+ int err; -+ LIST_HEAD(list); -+ -+ err = ovl_check_empty_dir(dentry, &list); -+ if (!err && type == OVL_PATH_MERGE) -+ err = ovl_remove_whiteouts(dentry, &list); -+ -+ ovl_cache_free(&list); -+ -+ return err; -+} -diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c -new file mode 100644 -index 0000000..9473e79 ---- /dev/null -+++ b/fs/overlayfs/super.c -@@ -0,0 +1,685 @@ -+/* -+ * -+ * Copyright (C) 2011 Novell Inc. -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 as published by -+ * the Free Software Foundation. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include "overlayfs.h" -+ -+MODULE_AUTHOR("Miklos Szeredi "); -+MODULE_DESCRIPTION("Overlay filesystem"); -+MODULE_LICENSE("GPL"); -+ -+#define OVERLAYFS_SUPER_MAGIC 0x794c764f -+ -+struct ovl_config { -+ char *lowerdir; -+ char *upperdir; -+}; -+ -+/* private information held for overlayfs's superblock */ -+struct ovl_fs { -+ struct vfsmount *upper_mnt; -+ struct vfsmount *lower_mnt; -+ long lower_namelen; -+ /* pathnames of lower and upper dirs, for show_options */ -+ struct ovl_config config; -+}; -+ -+/* private information held for every overlayfs dentry */ -+struct ovl_entry { -+ /* -+ * Keep "double reference" on upper dentries, so that -+ * d_delete() doesn't think it's OK to reset d_inode to NULL. -+ */ -+ struct dentry *__upperdentry; -+ struct dentry *lowerdentry; -+ union { -+ struct { -+ u64 version; -+ bool opaque; -+ }; -+ struct rcu_head rcu; -+ }; -+}; -+ -+const char *ovl_whiteout_xattr = "trusted.overlay.whiteout"; -+const char *ovl_opaque_xattr = "trusted.overlay.opaque"; -+ -+ -+enum ovl_path_type ovl_path_type(struct dentry *dentry) -+{ -+ struct ovl_entry *oe = dentry->d_fsdata; -+ -+ if (oe->__upperdentry) { -+ if (oe->lowerdentry && S_ISDIR(dentry->d_inode->i_mode)) -+ return OVL_PATH_MERGE; -+ else -+ return OVL_PATH_UPPER; -+ } else { -+ return OVL_PATH_LOWER; -+ } -+} -+ -+static struct dentry *ovl_upperdentry_dereference(struct ovl_entry *oe) -+{ -+ struct dentry *upperdentry = ACCESS_ONCE(oe->__upperdentry); -+ smp_read_barrier_depends(); -+ return upperdentry; -+} -+ -+void ovl_path_upper(struct dentry *dentry, struct path *path) -+{ -+ struct ovl_fs *ofs = dentry->d_sb->s_fs_info; -+ struct ovl_entry *oe = dentry->d_fsdata; -+ -+ path->mnt = ofs->upper_mnt; -+ path->dentry = ovl_upperdentry_dereference(oe); -+} -+ -+void ovl_path_lower(struct dentry *dentry, struct path *path) -+{ -+ struct ovl_fs *ofs = dentry->d_sb->s_fs_info; -+ struct ovl_entry *oe = dentry->d_fsdata; -+ -+ path->mnt = ofs->lower_mnt; -+ path->dentry = oe->lowerdentry; -+} -+ -+enum ovl_path_type ovl_path_real(struct dentry *dentry, struct path *path) -+{ -+ -+ enum ovl_path_type type = ovl_path_type(dentry); -+ -+ if (type == OVL_PATH_LOWER) -+ ovl_path_lower(dentry, path); -+ else -+ ovl_path_upper(dentry, path); -+ -+ return type; -+} -+ -+struct dentry *ovl_dentry_upper(struct dentry *dentry) -+{ -+ struct ovl_entry *oe = dentry->d_fsdata; -+ -+ return ovl_upperdentry_dereference(oe); -+} -+ -+struct dentry *ovl_dentry_lower(struct dentry *dentry) -+{ -+ struct ovl_entry *oe = dentry->d_fsdata; -+ -+ return oe->lowerdentry; -+} -+ -+struct dentry *ovl_dentry_real(struct dentry *dentry) -+{ -+ struct ovl_entry *oe = dentry->d_fsdata; -+ struct dentry *realdentry; -+ -+ realdentry = ovl_upperdentry_dereference(oe); -+ if (!realdentry) -+ realdentry = oe->lowerdentry; -+ -+ return realdentry; -+} -+ -+struct dentry *ovl_entry_real(struct ovl_entry *oe, bool *is_upper) -+{ -+ struct dentry *realdentry; -+ -+ realdentry = ovl_upperdentry_dereference(oe); -+ if (realdentry) { -+ *is_upper = true; -+ } else { -+ realdentry = oe->lowerdentry; -+ *is_upper = false; -+ } -+ return realdentry; -+} -+ -+bool ovl_dentry_is_opaque(struct dentry *dentry) -+{ -+ struct ovl_entry *oe = dentry->d_fsdata; -+ return oe->opaque; -+} -+ -+void ovl_dentry_set_opaque(struct dentry *dentry, bool opaque) -+{ -+ struct ovl_entry *oe = dentry->d_fsdata; -+ oe->opaque = opaque; -+} -+ -+void ovl_dentry_update(struct dentry *dentry, struct dentry *upperdentry) -+{ -+ struct ovl_entry *oe = dentry->d_fsdata; -+ -+ WARN_ON(!mutex_is_locked(&upperdentry->d_parent->d_inode->i_mutex)); -+ WARN_ON(oe->__upperdentry); -+ BUG_ON(!upperdentry->d_inode); -+ smp_wmb(); -+ oe->__upperdentry = dget(upperdentry); -+} -+ -+void ovl_dentry_version_inc(struct dentry *dentry) -+{ -+ struct ovl_entry *oe = dentry->d_fsdata; -+ -+ WARN_ON(!mutex_is_locked(&dentry->d_inode->i_mutex)); -+ oe->version++; -+} -+ -+u64 ovl_dentry_version_get(struct dentry *dentry) -+{ -+ struct ovl_entry *oe = dentry->d_fsdata; -+ -+ WARN_ON(!mutex_is_locked(&dentry->d_inode->i_mutex)); -+ return oe->version; -+} -+ -+bool ovl_is_whiteout(struct dentry *dentry) -+{ -+ int res; -+ char val; -+ -+ if (!dentry) -+ return false; -+ if (!dentry->d_inode) -+ return false; -+ if (!S_ISLNK(dentry->d_inode->i_mode)) -+ return false; -+ -+ res = vfs_getxattr(dentry, ovl_whiteout_xattr, &val, 1); -+ if (res == 1 && val == 'y') -+ return true; -+ -+ return false; -+} -+ -+static bool ovl_is_opaquedir(struct dentry *dentry) -+{ -+ int res; -+ char val; -+ -+ if (!S_ISDIR(dentry->d_inode->i_mode)) -+ return false; -+ -+ res = vfs_getxattr(dentry, ovl_opaque_xattr, &val, 1); -+ if (res == 1 && val == 'y') -+ return true; -+ -+ return false; -+} -+ -+static void ovl_entry_free(struct rcu_head *head) -+{ -+ struct ovl_entry *oe = container_of(head, struct ovl_entry, rcu); -+ kfree(oe); -+} -+ -+static void ovl_dentry_release(struct dentry *dentry) -+{ -+ struct ovl_entry *oe = dentry->d_fsdata; -+ -+ if (oe) { -+ dput(oe->__upperdentry); -+ dput(oe->__upperdentry); -+ dput(oe->lowerdentry); -+ call_rcu(&oe->rcu, ovl_entry_free); -+ } -+} -+ -+const struct dentry_operations ovl_dentry_operations = { -+ .d_release = ovl_dentry_release, -+}; -+ -+static struct ovl_entry *ovl_alloc_entry(void) -+{ -+ return kzalloc(sizeof(struct ovl_entry), GFP_KERNEL); -+} -+ -+static inline struct dentry *ovl_lookup_real(struct dentry *dir, -+ struct qstr *name) -+{ -+ struct dentry *dentry; -+ -+ mutex_lock(&dir->d_inode->i_mutex); -+ dentry = lookup_one_len(name->name, dir, name->len); -+ mutex_unlock(&dir->d_inode->i_mutex); -+ -+ if (IS_ERR(dentry)) { -+ if (PTR_ERR(dentry) == -ENOENT) -+ dentry = NULL; -+ } else if (!dentry->d_inode) { -+ dput(dentry); -+ dentry = NULL; -+ } -+ return dentry; -+} -+ -+static int ovl_do_lookup(struct dentry *dentry) -+{ -+ struct ovl_entry *oe; -+ struct dentry *upperdir; -+ struct dentry *lowerdir; -+ struct dentry *upperdentry = NULL; -+ struct dentry *lowerdentry = NULL; -+ struct inode *inode = NULL; -+ int err; -+ -+ err = -ENOMEM; -+ oe = ovl_alloc_entry(); -+ if (!oe) -+ goto out; -+ -+ upperdir = ovl_dentry_upper(dentry->d_parent); -+ lowerdir = ovl_dentry_lower(dentry->d_parent); -+ -+ if (upperdir) { -+ upperdentry = ovl_lookup_real(upperdir, &dentry->d_name); -+ err = PTR_ERR(upperdentry); -+ if (IS_ERR(upperdentry)) -+ goto out_put_dir; -+ -+ if (lowerdir && upperdentry && -+ (S_ISLNK(upperdentry->d_inode->i_mode) || -+ S_ISDIR(upperdentry->d_inode->i_mode))) { -+ const struct cred *old_cred; -+ struct cred *override_cred; -+ -+ err = -ENOMEM; -+ override_cred = prepare_creds(); -+ if (!override_cred) -+ goto out_dput_upper; -+ -+ /* CAP_SYS_ADMIN needed for getxattr */ -+ cap_raise(override_cred->cap_effective, CAP_SYS_ADMIN); -+ old_cred = override_creds(override_cred); -+ -+ if (ovl_is_opaquedir(upperdentry)) { -+ oe->opaque = true; -+ } else if (ovl_is_whiteout(upperdentry)) { -+ dput(upperdentry); -+ upperdentry = NULL; -+ oe->opaque = true; -+ } -+ revert_creds(old_cred); -+ put_cred(override_cred); -+ } -+ } -+ if (lowerdir && !oe->opaque) { -+ lowerdentry = ovl_lookup_real(lowerdir, &dentry->d_name); -+ err = PTR_ERR(lowerdentry); -+ if (IS_ERR(lowerdentry)) -+ goto out_dput_upper; -+ } -+ -+ if (lowerdentry && upperdentry && -+ (!S_ISDIR(upperdentry->d_inode->i_mode) || -+ !S_ISDIR(lowerdentry->d_inode->i_mode))) { -+ dput(lowerdentry); -+ lowerdentry = NULL; -+ oe->opaque = true; -+ } -+ -+ if (lowerdentry || upperdentry) { -+ struct dentry *realdentry; -+ -+ realdentry = upperdentry ? upperdentry : lowerdentry; -+ err = -ENOMEM; -+ inode = ovl_new_inode(dentry->d_sb, realdentry->d_inode->i_mode, -+ oe); -+ if (!inode) -+ goto out_dput; -+ ovl_copyattr(realdentry->d_inode, inode); -+ } -+ -+ if (upperdentry) -+ oe->__upperdentry = dget(upperdentry); -+ -+ if (lowerdentry) -+ oe->lowerdentry = lowerdentry; -+ -+ dentry->d_fsdata = oe; -+ dentry->d_op = &ovl_dentry_operations; -+ d_add(dentry, inode); -+ -+ return 0; -+ -+out_dput: -+ dput(lowerdentry); -+out_dput_upper: -+ dput(upperdentry); -+out_put_dir: -+ kfree(oe); -+out: -+ return err; -+} -+ -+struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry, -+ unsigned int flags) -+{ -+ int err = ovl_do_lookup(dentry); -+ -+ if (err) -+ return ERR_PTR(err); -+ -+ return NULL; -+} -+ -+struct file *ovl_path_open(struct path *path, int flags) -+{ -+ return dentry_open(path, flags, current_cred()); -+} -+ -+static void ovl_put_super(struct super_block *sb) -+{ -+ struct ovl_fs *ufs = sb->s_fs_info; -+ -+ if (!(sb->s_flags & MS_RDONLY)) -+ mnt_drop_write(ufs->upper_mnt); -+ -+ mntput(ufs->upper_mnt); -+ mntput(ufs->lower_mnt); -+ -+ kfree(ufs->config.lowerdir); -+ kfree(ufs->config.upperdir); -+ kfree(ufs); -+} -+ -+static int ovl_remount_fs(struct super_block *sb, int *flagsp, char *data) -+{ -+ int flags = *flagsp; -+ struct ovl_fs *ufs = sb->s_fs_info; -+ -+ /* When remounting rw or ro, we need to adjust the write access to the -+ * upper fs. -+ */ -+ if (((flags ^ sb->s_flags) & MS_RDONLY) == 0) -+ /* No change to readonly status */ -+ return 0; -+ -+ if (flags & MS_RDONLY) { -+ mnt_drop_write(ufs->upper_mnt); -+ return 0; -+ } else -+ return mnt_want_write(ufs->upper_mnt); -+} -+ -+/** -+ * ovl_statfs -+ * @sb: The overlayfs super block -+ * @buf: The struct kstatfs to fill in with stats -+ * -+ * Get the filesystem statistics. As writes always target the upper layer -+ * filesystem pass the statfs to the same filesystem. -+ */ -+static int ovl_statfs(struct dentry *dentry, struct kstatfs *buf) -+{ -+ struct ovl_fs *ofs = dentry->d_sb->s_fs_info; -+ struct dentry *root_dentry = dentry->d_sb->s_root; -+ struct path path; -+ int err; -+ -+ ovl_path_upper(root_dentry, &path); -+ -+ err = vfs_statfs(&path, buf); -+ if (!err) { -+ buf->f_namelen = max(buf->f_namelen, ofs->lower_namelen); -+ buf->f_type = OVERLAYFS_SUPER_MAGIC; -+ } -+ -+ return err; -+} -+ -+/** -+ * ovl_show_options -+ * -+ * Prints the mount options for a given superblock. -+ * Returns zero; does not fail. -+ */ -+static int ovl_show_options(struct seq_file *m, struct dentry *dentry) -+{ -+ struct super_block *sb = dentry->d_sb; -+ struct ovl_fs *ufs = sb->s_fs_info; -+ -+ seq_printf(m, ",lowerdir=%s", ufs->config.lowerdir); -+ seq_printf(m, ",upperdir=%s", ufs->config.upperdir); -+ return 0; -+} -+ -+static const struct super_operations ovl_super_operations = { -+ .put_super = ovl_put_super, -+ .remount_fs = ovl_remount_fs, -+ .statfs = ovl_statfs, -+ .show_options = ovl_show_options, -+}; -+ -+enum { -+ OPT_LOWERDIR, -+ OPT_UPPERDIR, -+ OPT_ERR, -+}; -+ -+static const match_table_t ovl_tokens = { -+ {OPT_LOWERDIR, "lowerdir=%s"}, -+ {OPT_UPPERDIR, "upperdir=%s"}, -+ {OPT_ERR, NULL} -+}; -+ -+static int ovl_parse_opt(char *opt, struct ovl_config *config) -+{ -+ char *p; -+ -+ config->upperdir = NULL; -+ config->lowerdir = NULL; -+ -+ while ((p = strsep(&opt, ",")) != NULL) { -+ int token; -+ substring_t args[MAX_OPT_ARGS]; -+ -+ if (!*p) -+ continue; -+ -+ token = match_token(p, ovl_tokens, args); -+ switch (token) { -+ case OPT_UPPERDIR: -+ kfree(config->upperdir); -+ config->upperdir = match_strdup(&args[0]); -+ if (!config->upperdir) -+ return -ENOMEM; -+ break; -+ -+ case OPT_LOWERDIR: -+ kfree(config->lowerdir); -+ config->lowerdir = match_strdup(&args[0]); -+ if (!config->lowerdir) -+ return -ENOMEM; -+ break; -+ -+ default: -+ return -EINVAL; -+ } -+ } -+ return 0; -+} -+ -+static int ovl_fill_super(struct super_block *sb, void *data, int silent) -+{ -+ struct path lowerpath; -+ struct path upperpath; -+ struct inode *root_inode; -+ struct dentry *root_dentry; -+ struct ovl_entry *oe; -+ struct ovl_fs *ufs; -+ struct kstatfs statfs; -+ int err; -+ -+ err = -ENOMEM; -+ ufs = kmalloc(sizeof(struct ovl_fs), GFP_KERNEL); -+ if (!ufs) -+ goto out; -+ -+ err = ovl_parse_opt((char *) data, &ufs->config); -+ if (err) -+ goto out_free_ufs; -+ -+ err = -EINVAL; -+ if (!ufs->config.upperdir || !ufs->config.lowerdir) { -+ pr_err("overlayfs: missing upperdir or lowerdir\n"); -+ goto out_free_config; -+ } -+ -+ oe = ovl_alloc_entry(); -+ if (oe == NULL) -+ goto out_free_config; -+ -+ err = kern_path(ufs->config.upperdir, LOOKUP_FOLLOW, &upperpath); -+ if (err) -+ goto out_free_oe; -+ -+ err = kern_path(ufs->config.lowerdir, LOOKUP_FOLLOW, &lowerpath); -+ if (err) -+ goto out_put_upperpath; -+ -+ err = -ENOTDIR; -+ if (!S_ISDIR(upperpath.dentry->d_inode->i_mode) || -+ !S_ISDIR(lowerpath.dentry->d_inode->i_mode)) -+ goto out_put_lowerpath; -+ -+ err = vfs_statfs(&lowerpath, &statfs); -+ if (err) { -+ pr_err("overlayfs: statfs failed on lowerpath\n"); -+ goto out_put_lowerpath; -+ } -+ ufs->lower_namelen = statfs.f_namelen; -+ -+ sb->s_stack_depth = max(upperpath.mnt->mnt_sb->s_stack_depth, -+ lowerpath.mnt->mnt_sb->s_stack_depth) + 1; -+ -+ err = -EINVAL; -+ if (sb->s_stack_depth > FILESYSTEM_MAX_STACK_DEPTH) { -+ pr_err("overlayfs: maximum fs stacking depth exceeded\n"); -+ goto out_put_lowerpath; -+ } -+ -+ -+ ufs->upper_mnt = clone_private_mount(&upperpath); -+ err = PTR_ERR(ufs->upper_mnt); -+ if (IS_ERR(ufs->upper_mnt)) { -+ pr_err("overlayfs: failed to clone upperpath\n"); -+ goto out_put_lowerpath; -+ } -+ -+ ufs->lower_mnt = clone_private_mount(&lowerpath); -+ err = PTR_ERR(ufs->lower_mnt); -+ if (IS_ERR(ufs->lower_mnt)) { -+ pr_err("overlayfs: failed to clone lowerpath\n"); -+ goto out_put_upper_mnt; -+ } -+ -+ /* -+ * Make lower_mnt R/O. That way fchmod/fchown on lower file -+ * will fail instead of modifying lower fs. -+ */ -+ ufs->lower_mnt->mnt_flags |= MNT_READONLY; -+ -+ /* If the upper fs is r/o, we mark overlayfs r/o too */ -+ if (ufs->upper_mnt->mnt_sb->s_flags & MS_RDONLY) -+ sb->s_flags |= MS_RDONLY; -+ -+ if (!(sb->s_flags & MS_RDONLY)) { -+ err = mnt_want_write(ufs->upper_mnt); -+ if (err) -+ goto out_put_lower_mnt; -+ } -+ -+ err = -ENOMEM; -+ root_inode = ovl_new_inode(sb, S_IFDIR, oe); -+ if (!root_inode) -+ goto out_drop_write; -+ -+ root_dentry = d_make_root(root_inode); -+ if (!root_dentry) -+ goto out_drop_write; -+ -+ mntput(upperpath.mnt); -+ mntput(lowerpath.mnt); -+ -+ oe->__upperdentry = dget(upperpath.dentry); -+ oe->lowerdentry = lowerpath.dentry; -+ -+ root_dentry->d_fsdata = oe; -+ root_dentry->d_op = &ovl_dentry_operations; -+ -+ sb->s_magic = OVERLAYFS_SUPER_MAGIC; -+ sb->s_op = &ovl_super_operations; -+ sb->s_root = root_dentry; -+ sb->s_fs_info = ufs; -+ -+ return 0; -+ -+out_drop_write: -+ if (!(sb->s_flags & MS_RDONLY)) -+ mnt_drop_write(ufs->upper_mnt); -+out_put_lower_mnt: -+ mntput(ufs->lower_mnt); -+out_put_upper_mnt: -+ mntput(ufs->upper_mnt); -+out_put_lowerpath: -+ path_put(&lowerpath); -+out_put_upperpath: -+ path_put(&upperpath); -+out_free_oe: -+ kfree(oe); -+out_free_config: -+ kfree(ufs->config.lowerdir); -+ kfree(ufs->config.upperdir); -+out_free_ufs: -+ kfree(ufs); -+out: -+ return err; -+} -+ -+static struct dentry *ovl_mount(struct file_system_type *fs_type, int flags, -+ const char *dev_name, void *raw_data) -+{ -+ return mount_nodev(fs_type, flags, raw_data, ovl_fill_super); -+} -+ -+static struct file_system_type ovl_fs_type = { -+ .owner = THIS_MODULE, -+ .name = "overlayfs", -+ .mount = ovl_mount, -+ .kill_sb = kill_anon_super, -+}; -+MODULE_ALIAS_FS("overlayfs"); -+ -+static int __init ovl_init(void) -+{ -+ return register_filesystem(&ovl_fs_type); -+} -+ -+static void __exit ovl_exit(void) -+{ -+ unregister_filesystem(&ovl_fs_type); -+} -+ -+module_init(ovl_init); -+module_exit(ovl_exit); -diff --git a/fs/splice.c b/fs/splice.c -index 9eca476..8d415fc 100644 ---- a/fs/splice.c -+++ b/fs/splice.c -@@ -1312,6 +1312,7 @@ long do_splice_direct(struct file *in, loff_t *ppos, struct file *out, - - return ret; - } -+EXPORT_SYMBOL(do_splice_direct); - - static int splice_pipe_to_pipe(struct pipe_inode_info *ipipe, - struct pipe_inode_info *opipe, -diff --git a/include/linux/fs.h b/include/linux/fs.h -index 65c2be2..72d04f8 100644 ---- a/include/linux/fs.h -+++ b/include/linux/fs.h -@@ -244,6 +244,12 @@ struct iattr { - */ - #include - -+/* -+ * Maximum number of layers of fs stack. Needs to be limited to -+ * prevent kernel stack overflow -+ */ -+#define FILESYSTEM_MAX_STACK_DEPTH 2 -+ - /** - * enum positive_aop_returns - aop return codes with specific semantics - * -@@ -1322,6 +1328,11 @@ struct super_block { - - /* Being remounted read-only */ - int s_readonly_remount; -+ -+ /* -+ * Indicates how deep in a filesystem stack this SB is -+ */ -+ int s_stack_depth; - }; - - /* superblock cache pruning functions */ -@@ -1575,6 +1586,7 @@ struct inode_operations { - int (*atomic_open)(struct inode *, struct dentry *, - struct file *, unsigned open_flag, - umode_t create_mode, int *opened); -+ int (*dentry_open)(struct dentry *, struct file *, const struct cred *); - } ____cacheline_aligned; - - ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector, -@@ -2008,6 +2020,7 @@ extern struct file *file_open_name(struct filename *, int, umode_t); - extern struct file *filp_open(const char *, int, umode_t); - extern struct file *file_open_root(struct dentry *, struct vfsmount *, - const char *, int); -+extern int vfs_open(const struct path *, struct file *, const struct cred *); - extern struct file * dentry_open(const struct path *, int, const struct cred *); - extern int filp_close(struct file *, fl_owner_t id); - -@@ -2208,6 +2221,7 @@ extern sector_t bmap(struct inode *, sector_t); - #endif - extern int notify_change(struct dentry *, struct iattr *); - extern int inode_permission(struct inode *, int); -+extern int __inode_permission(struct inode *, int); - extern int generic_permission(struct inode *, int); - - static inline bool execute_ok(struct inode *inode) -@@ -2420,6 +2417,7 @@ extern ssize_t generic_file_splice_write(struct pipe_inode_info *, - struct file *, loff_t *, size_t, unsigned int); - extern ssize_t generic_splice_sendpage(struct pipe_inode_info *pipe, - struct file *out, loff_t *, size_t len, unsigned int flags); -+extern long do_splice_direct(struct file *in, loff_t *ppos, struct file *out, loff_t *opos, size_t len, unsigned int flags); - extern ssize_t generic_splice_from_socket(struct file *file, struct socket *sock, - loff_t __user *ppos, size_t count); - -diff --git a/include/linux/mount.h b/include/linux/mount.h -index 73005f9..435f281 100644 ---- a/include/linux/mount.h -+++ b/include/linux/mount.h -@@ -68,6 +68,9 @@ extern void mnt_pin(struct vfsmount *mnt); - extern void mnt_unpin(struct vfsmount *mnt); - extern int __mnt_is_readonly(struct vfsmount *mnt); - -+struct path; -+extern struct vfsmount *clone_private_mount(struct path *path); -+ - struct file_system_type; - extern struct vfsmount *vfs_kern_mount(struct file_system_type *type, - int flags, const char *name, diff --git a/patch/kernel/marvell-default/1-patch-3.10.70-71.patch b/patch/kernel/marvell-default/1-patch-3.10.70-71.patch deleted file mode 100644 index 3465e29d56..0000000000 --- a/patch/kernel/marvell-default/1-patch-3.10.70-71.patch +++ /dev/null @@ -1,1503 +0,0 @@ -diff --git a/Makefile b/Makefile -index 402cbb7c27f1..d8b42f71ea5a 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,6 +1,6 @@ - VERSION = 3 - PATCHLEVEL = 10 --SUBLEVEL = 70 -+SUBLEVEL = 71 - EXTRAVERSION = - NAME = TOSSUG Baby Fish - -diff --git a/arch/arc/include/asm/pgtable.h b/arch/arc/include/asm/pgtable.h -index 95b1522212a7..ecf23eaa20c1 100644 ---- a/arch/arc/include/asm/pgtable.h -+++ b/arch/arc/include/asm/pgtable.h -@@ -270,7 +270,8 @@ static inline void pmd_set(pmd_t *pmdp, pte_t *ptep) - #define pmd_clear(xp) do { pmd_val(*(xp)) = 0; } while (0) - - #define pte_page(x) (mem_map + \ -- (unsigned long)(((pte_val(x) - PAGE_OFFSET) >> PAGE_SHIFT))) -+ (unsigned long)(((pte_val(x) - CONFIG_LINUX_LINK_BASE) >> \ -+ PAGE_SHIFT))) - - #define mk_pte(page, pgprot) \ - ({ \ -diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c -index a5b8fead7d61..9cb7ea776ecd 100644 ---- a/arch/arm/mach-pxa/corgi.c -+++ b/arch/arm/mach-pxa/corgi.c -@@ -26,6 +26,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -711,6 +712,8 @@ static void __init corgi_init(void) - sharpsl_nand_partitions[1].size = 53 * 1024 * 1024; - - platform_add_devices(devices, ARRAY_SIZE(devices)); -+ -+ regulator_has_full_constraints(); - } - - static void __init fixup_corgi(struct tag *tags, char **cmdline, -diff --git a/arch/arm/mach-pxa/hx4700.c b/arch/arm/mach-pxa/hx4700.c -index 133109ec7332..a07accfb3aec 100644 ---- a/arch/arm/mach-pxa/hx4700.c -+++ b/arch/arm/mach-pxa/hx4700.c -@@ -891,6 +891,8 @@ static void __init hx4700_init(void) - mdelay(10); - gpio_set_value(GPIO71_HX4700_ASIC3_nRESET, 1); - mdelay(10); -+ -+ regulator_has_full_constraints(); - } - - MACHINE_START(H4700, "HP iPAQ HX4700") -diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c -index 50ccd5f1d560..362c05fffc28 100644 ---- a/arch/arm/mach-pxa/poodle.c -+++ b/arch/arm/mach-pxa/poodle.c -@@ -25,6 +25,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -452,6 +453,7 @@ static void __init poodle_init(void) - pxa_set_i2c_info(NULL); - i2c_register_board_info(0, ARRAY_AND_SIZE(poodle_i2c_devices)); - poodle_init_spi(); -+ regulator_has_full_constraints(); - } - - static void __init fixup_poodle(struct tag *tags, char **cmdline, -diff --git a/arch/arm/mach-sa1100/pm.c b/arch/arm/mach-sa1100/pm.c -index 6645d1e31f14..34853d5dfda2 100644 ---- a/arch/arm/mach-sa1100/pm.c -+++ b/arch/arm/mach-sa1100/pm.c -@@ -81,6 +81,7 @@ static int sa11x0_pm_enter(suspend_state_t state) - /* - * Ensure not to come back here if it wasn't intended - */ -+ RCSR = RCSR_SMR; - PSPR = 0; - - /* -diff --git a/arch/arm64/kernel/signal32.c b/arch/arm64/kernel/signal32.c -index e393174fe859..3d478102b1c0 100644 ---- a/arch/arm64/kernel/signal32.c -+++ b/arch/arm64/kernel/signal32.c -@@ -179,8 +179,7 @@ int copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from) - case __SI_TIMER: - err |= __put_user(from->si_tid, &to->si_tid); - err |= __put_user(from->si_overrun, &to->si_overrun); -- err |= __put_user((compat_uptr_t)(unsigned long)from->si_ptr, -- &to->si_ptr); -+ err |= __put_user(from->si_int, &to->si_int); - break; - case __SI_POLL: - err |= __put_user(from->si_band, &to->si_band); -@@ -209,7 +208,7 @@ int copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from) - case __SI_MESGQ: /* But this is */ - err |= __put_user(from->si_pid, &to->si_pid); - err |= __put_user(from->si_uid, &to->si_uid); -- err |= __put_user((compat_uptr_t)(unsigned long)from->si_ptr, &to->si_ptr); -+ err |= __put_user(from->si_int, &to->si_int); - break; - default: /* this is just in case for now ... */ - err |= __put_user(from->si_pid, &to->si_pid); -diff --git a/arch/metag/include/asm/processor.h b/arch/metag/include/asm/processor.h -index 579e3d93a5ca..b88e9cbdc64b 100644 ---- a/arch/metag/include/asm/processor.h -+++ b/arch/metag/include/asm/processor.h -@@ -149,8 +149,8 @@ extern void exit_thread(void); - - unsigned long get_wchan(struct task_struct *p); - --#define KSTK_EIP(tsk) ((tsk)->thread.kernel_context->CurrPC) --#define KSTK_ESP(tsk) ((tsk)->thread.kernel_context->AX[0].U0) -+#define KSTK_EIP(tsk) (task_pt_regs(tsk)->ctx.CurrPC) -+#define KSTK_ESP(tsk) (task_pt_regs(tsk)->ctx.AX[0].U0) - - #define user_stack_pointer(regs) ((regs)->ctx.AX[0].U0) - -diff --git a/arch/mips/kernel/mips_ksyms.c b/arch/mips/kernel/mips_ksyms.c -index 6e58e97fcd39..cedeb5686eb5 100644 ---- a/arch/mips/kernel/mips_ksyms.c -+++ b/arch/mips/kernel/mips_ksyms.c -@@ -14,6 +14,7 @@ - #include - #include - #include -+#include - - extern void *__bzero(void *__s, size_t __count); - extern long __strncpy_from_user_nocheck_asm(char *__to, -@@ -26,6 +27,13 @@ extern long __strnlen_user_nocheck_asm(const char *s); - extern long __strnlen_user_asm(const char *s); - - /* -+ * Core architecture code -+ */ -+#ifdef CONFIG_CPU_R4K_FPU -+EXPORT_SYMBOL_GPL(_save_fp); -+#endif -+ -+/* - * String functions - */ - EXPORT_SYMBOL(memset); -diff --git a/arch/mips/kvm/kvm_locore.S b/arch/mips/kvm/kvm_locore.S -index dca2aa665993..920b63210806 100644 ---- a/arch/mips/kvm/kvm_locore.S -+++ b/arch/mips/kvm/kvm_locore.S -@@ -431,7 +431,7 @@ __kvm_mips_return_to_guest: - /* Setup status register for running guest in UM */ - .set at - or v1, v1, (ST0_EXL | KSU_USER | ST0_IE) -- and v1, v1, ~ST0_CU0 -+ and v1, v1, ~(ST0_CU0 | ST0_MX) - .set noat - mtc0 v1, CP0_STATUS - ehb -diff --git a/arch/mips/kvm/kvm_mips.c b/arch/mips/kvm/kvm_mips.c -index 2c7b3ade8ec0..843ec38fec7b 100644 ---- a/arch/mips/kvm/kvm_mips.c -+++ b/arch/mips/kvm/kvm_mips.c -@@ -15,6 +15,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -413,11 +414,13 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run) - vcpu->mmio_needed = 0; - } - -+ lose_fpu(1); -+ -+ local_irq_disable(); - /* Check if we have any exceptions/interrupts pending */ - kvm_mips_deliver_interrupts(vcpu, - kvm_read_c0_guest_cause(vcpu->arch.cop0)); - -- local_irq_disable(); - kvm_guest_enter(); - - r = __kvm_mips_vcpu_run(run, vcpu); -@@ -1017,9 +1020,6 @@ void kvm_mips_set_c0_status(void) - { - uint32_t status = read_c0_status(); - -- if (cpu_has_fpu) -- status |= (ST0_CU1); -- - if (cpu_has_dsp) - status |= (ST0_MX); - -diff --git a/arch/powerpc/sysdev/axonram.c b/arch/powerpc/sysdev/axonram.c -index 1c16141c031c..1fea24944ff4 100644 ---- a/arch/powerpc/sysdev/axonram.c -+++ b/arch/powerpc/sysdev/axonram.c -@@ -155,7 +155,7 @@ axon_ram_direct_access(struct block_device *device, sector_t sector, - } - - *kaddr = (void *)(bank->ph_addr + offset); -- *pfn = virt_to_phys(kaddr) >> PAGE_SHIFT; -+ *pfn = virt_to_phys(*kaddr) >> PAGE_SHIFT; - - return 0; - } -diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c -index adfc30d9f9f4..41ba726c1ce2 100644 ---- a/arch/x86/kvm/x86.c -+++ b/arch/x86/kvm/x86.c -@@ -1182,21 +1182,22 @@ void kvm_track_tsc_matching(struct kvm_vcpu *vcpu) - { - #ifdef CONFIG_X86_64 - bool vcpus_matched; -- bool do_request = false; - struct kvm_arch *ka = &vcpu->kvm->arch; - struct pvclock_gtod_data *gtod = &pvclock_gtod_data; - - vcpus_matched = (ka->nr_vcpus_matched_tsc + 1 == - atomic_read(&vcpu->kvm->online_vcpus)); - -- if (vcpus_matched && gtod->clock.vclock_mode == VCLOCK_TSC) -- if (!ka->use_master_clock) -- do_request = 1; -- -- if (!vcpus_matched && ka->use_master_clock) -- do_request = 1; -- -- if (do_request) -+ /* -+ * Once the masterclock is enabled, always perform request in -+ * order to update it. -+ * -+ * In order to enable masterclock, the host clocksource must be TSC -+ * and the vcpus need to have matched TSCs. When that happens, -+ * perform request to enable masterclock. -+ */ -+ if (ka->use_master_clock || -+ (gtod->clock.vclock_mode == VCLOCK_TSC && vcpus_matched)) - kvm_make_request(KVM_REQ_MASTERCLOCK_UPDATE, vcpu); - - trace_kvm_track_tsc(vcpu->vcpu_id, ka->nr_vcpus_matched_tsc, -diff --git a/arch/x86/mm/mmap.c b/arch/x86/mm/mmap.c -index 5c1ae28825cd..75f9e5d80d02 100644 ---- a/arch/x86/mm/mmap.c -+++ b/arch/x86/mm/mmap.c -@@ -35,12 +35,12 @@ struct __read_mostly va_alignment va_align = { - .flags = -1, - }; - --static unsigned int stack_maxrandom_size(void) -+static unsigned long stack_maxrandom_size(void) - { -- unsigned int max = 0; -+ unsigned long max = 0; - if ((current->flags & PF_RANDOMIZE) && - !(current->personality & ADDR_NO_RANDOMIZE)) { -- max = ((-1U) & STACK_RND_MASK) << PAGE_SHIFT; -+ max = ((-1UL) & STACK_RND_MASK) << PAGE_SHIFT; - } - - return max; -diff --git a/block/blk-throttle.c b/block/blk-throttle.c -index 31146225f3d0..7cddfe6baf66 100644 ---- a/block/blk-throttle.c -+++ b/block/blk-throttle.c -@@ -942,6 +942,9 @@ static u64 tg_prfill_cpu_rwstat(struct seq_file *sf, - struct blkg_rwstat rwstat = { }, tmp; - int i, cpu; - -+ if (tg->stats_cpu == NULL) -+ return 0; -+ - for_each_possible_cpu(cpu) { - struct tg_stats_cpu *sc = per_cpu_ptr(tg->stats_cpu, cpu); - -diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c -index c981097dd634..69111c5c352c 100644 ---- a/block/cfq-iosched.c -+++ b/block/cfq-iosched.c -@@ -3575,6 +3575,11 @@ retry: - - blkcg = bio_blkcg(bio); - cfqg = cfq_lookup_create_cfqg(cfqd, blkcg); -+ if (!cfqg) { -+ cfqq = &cfqd->oom_cfqq; -+ goto out; -+ } -+ - cfqq = cic_to_cfqq(cic, is_sync); - - /* -@@ -3611,7 +3616,7 @@ retry: - } else - cfqq = &cfqd->oom_cfqq; - } -- -+out: - if (new_cfqq) - kmem_cache_free(cfq_pool, new_cfqq); - -@@ -3641,12 +3646,17 @@ static struct cfq_queue * - cfq_get_queue(struct cfq_data *cfqd, bool is_sync, struct cfq_io_cq *cic, - struct bio *bio, gfp_t gfp_mask) - { -- const int ioprio_class = IOPRIO_PRIO_CLASS(cic->ioprio); -- const int ioprio = IOPRIO_PRIO_DATA(cic->ioprio); -+ int ioprio_class = IOPRIO_PRIO_CLASS(cic->ioprio); -+ int ioprio = IOPRIO_PRIO_DATA(cic->ioprio); - struct cfq_queue **async_cfqq = NULL; - struct cfq_queue *cfqq = NULL; - - if (!is_sync) { -+ if (!ioprio_valid(cic->ioprio)) { -+ struct task_struct *tsk = current; -+ ioprio = task_nice_ioprio(tsk); -+ ioprio_class = task_nice_ioclass(tsk); -+ } - async_cfqq = cfq_async_queue_prio(cfqd, ioprio_class, ioprio); - cfqq = *async_cfqq; - } -diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c -index 2acabdaecec8..dad8891ecbfa 100644 ---- a/drivers/bluetooth/ath3k.c -+++ b/drivers/bluetooth/ath3k.c -@@ -151,6 +151,8 @@ static struct usb_device_id ath3k_blist_tbl[] = { - #define USB_REQ_DFU_DNLOAD 1 - #define BULK_SIZE 4096 - #define FW_HDR_SIZE 20 -+#define TIMEGAP_USEC_MIN 50 -+#define TIMEGAP_USEC_MAX 100 - - static int ath3k_load_firmware(struct usb_device *udev, - const struct firmware *firmware) -@@ -181,6 +183,9 @@ static int ath3k_load_firmware(struct usb_device *udev, - count -= 20; - - while (count) { -+ /* workaround the compatibility issue with xHCI controller*/ -+ usleep_range(TIMEGAP_USEC_MIN, TIMEGAP_USEC_MAX); -+ - size = min_t(uint, count, BULK_SIZE); - pipe = usb_sndbulkpipe(udev, 0x02); - memcpy(send_buf, firmware->data + sent, size); -@@ -277,6 +282,9 @@ static int ath3k_load_fwfile(struct usb_device *udev, - count -= size; - - while (count) { -+ /* workaround the compatibility issue with xHCI controller*/ -+ usleep_range(TIMEGAP_USEC_MIN, TIMEGAP_USEC_MAX); -+ - size = min_t(uint, count, BULK_SIZE); - pipe = usb_sndbulkpipe(udev, 0x02); - -diff --git a/drivers/char/tpm/tpm_i2c_stm_st33.c b/drivers/char/tpm/tpm_i2c_stm_st33.c -index 156bd3c72770..3925f7b86841 100644 ---- a/drivers/char/tpm/tpm_i2c_stm_st33.c -+++ b/drivers/char/tpm/tpm_i2c_stm_st33.c -@@ -488,7 +488,7 @@ static int tpm_stm_i2c_send(struct tpm_chip *chip, unsigned char *buf, - if (burstcnt < 0) - return burstcnt; - size = min_t(int, len - i - 1, burstcnt); -- ret = I2C_WRITE_DATA(client, TPM_DATA_FIFO, buf, size); -+ ret = I2C_WRITE_DATA(client, TPM_DATA_FIFO, buf + i, size); - if (ret < 0) - goto out_err; - -diff --git a/drivers/char/tpm/tpm_ibmvtpm.c b/drivers/char/tpm/tpm_ibmvtpm.c -index 56b07c35a13e..538856f3e68a 100644 ---- a/drivers/char/tpm/tpm_ibmvtpm.c -+++ b/drivers/char/tpm/tpm_ibmvtpm.c -@@ -148,7 +148,8 @@ static int tpm_ibmvtpm_send(struct tpm_chip *chip, u8 *buf, size_t count) - crq.len = (u16)count; - crq.data = ibmvtpm->rtce_dma_handle; - -- rc = ibmvtpm_send_crq(ibmvtpm->vdev, word[0], word[1]); -+ rc = ibmvtpm_send_crq(ibmvtpm->vdev, cpu_to_be64(word[0]), -+ cpu_to_be64(word[1])); - if (rc != H_SUCCESS) { - dev_err(ibmvtpm->dev, "tpm_ibmvtpm_send failed rc=%d\n", rc); - rc = 0; -@@ -186,7 +187,8 @@ static int ibmvtpm_crq_get_rtce_size(struct ibmvtpm_dev *ibmvtpm) - crq.valid = (u8)IBMVTPM_VALID_CMD; - crq.msg = (u8)VTPM_GET_RTCE_BUFFER_SIZE; - -- rc = ibmvtpm_send_crq(ibmvtpm->vdev, buf[0], buf[1]); -+ rc = ibmvtpm_send_crq(ibmvtpm->vdev, cpu_to_be64(buf[0]), -+ cpu_to_be64(buf[1])); - if (rc != H_SUCCESS) - dev_err(ibmvtpm->dev, - "ibmvtpm_crq_get_rtce_size failed rc=%d\n", rc); -@@ -212,7 +214,8 @@ static int ibmvtpm_crq_get_version(struct ibmvtpm_dev *ibmvtpm) - crq.valid = (u8)IBMVTPM_VALID_CMD; - crq.msg = (u8)VTPM_GET_VERSION; - -- rc = ibmvtpm_send_crq(ibmvtpm->vdev, buf[0], buf[1]); -+ rc = ibmvtpm_send_crq(ibmvtpm->vdev, cpu_to_be64(buf[0]), -+ cpu_to_be64(buf[1])); - if (rc != H_SUCCESS) - dev_err(ibmvtpm->dev, - "ibmvtpm_crq_get_version failed rc=%d\n", rc); -@@ -307,6 +310,14 @@ static int tpm_ibmvtpm_remove(struct vio_dev *vdev) - static unsigned long tpm_ibmvtpm_get_desired_dma(struct vio_dev *vdev) - { - struct ibmvtpm_dev *ibmvtpm = ibmvtpm_get_data(&vdev->dev); -+ -+ /* ibmvtpm initializes at probe time, so the data we are -+ * asking for may not be set yet. Estimate that 4K required -+ * for TCE-mapped buffer in addition to CRQ. -+ */ -+ if (!ibmvtpm) -+ return CRQ_RES_BUF_SIZE + PAGE_SIZE; -+ - return CRQ_RES_BUF_SIZE + ibmvtpm->rtce_size; - } - -@@ -327,7 +338,8 @@ static int tpm_ibmvtpm_suspend(struct device *dev) - crq.valid = (u8)IBMVTPM_VALID_CMD; - crq.msg = (u8)VTPM_PREPARE_TO_SUSPEND; - -- rc = ibmvtpm_send_crq(ibmvtpm->vdev, buf[0], buf[1]); -+ rc = ibmvtpm_send_crq(ibmvtpm->vdev, cpu_to_be64(buf[0]), -+ cpu_to_be64(buf[1])); - if (rc != H_SUCCESS) - dev_err(ibmvtpm->dev, - "tpm_ibmvtpm_suspend failed rc=%d\n", rc); -@@ -511,11 +523,11 @@ static void ibmvtpm_crq_process(struct ibmvtpm_crq *crq, - case IBMVTPM_VALID_CMD: - switch (crq->msg) { - case VTPM_GET_RTCE_BUFFER_SIZE_RES: -- if (crq->len <= 0) { -+ if (be16_to_cpu(crq->len) <= 0) { - dev_err(ibmvtpm->dev, "Invalid rtce size\n"); - return; - } -- ibmvtpm->rtce_size = crq->len; -+ ibmvtpm->rtce_size = be16_to_cpu(crq->len); - ibmvtpm->rtce_buf = kmalloc(ibmvtpm->rtce_size, - GFP_KERNEL); - if (!ibmvtpm->rtce_buf) { -@@ -536,11 +548,11 @@ static void ibmvtpm_crq_process(struct ibmvtpm_crq *crq, - - return; - case VTPM_GET_VERSION_RES: -- ibmvtpm->vtpm_version = crq->data; -+ ibmvtpm->vtpm_version = be32_to_cpu(crq->data); - return; - case VTPM_TPM_COMMAND_RES: - /* len of the data in rtce buffer */ -- ibmvtpm->res_len = crq->len; -+ ibmvtpm->res_len = be16_to_cpu(crq->len); - wake_up_interruptible(&ibmvtpm->wq); - return; - default: -diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c -index 72f21377fa02..323d02d33c70 100644 ---- a/drivers/char/tpm/tpm_tis.c -+++ b/drivers/char/tpm/tpm_tis.c -@@ -75,6 +75,10 @@ enum tis_defaults { - #define TPM_DID_VID(l) (0x0F00 | ((l) << 12)) - #define TPM_RID(l) (0x0F04 | ((l) << 12)) - -+struct priv_data { -+ bool irq_tested; -+}; -+ - static LIST_HEAD(tis_chips); - static DEFINE_MUTEX(tis_lock); - -@@ -338,12 +342,27 @@ out_err: - return rc; - } - -+static void disable_interrupts(struct tpm_chip *chip) -+{ -+ u32 intmask; -+ -+ intmask = -+ ioread32(chip->vendor.iobase + -+ TPM_INT_ENABLE(chip->vendor.locality)); -+ intmask &= ~TPM_GLOBAL_INT_ENABLE; -+ iowrite32(intmask, -+ chip->vendor.iobase + -+ TPM_INT_ENABLE(chip->vendor.locality)); -+ free_irq(chip->vendor.irq, chip); -+ chip->vendor.irq = 0; -+} -+ - /* - * If interrupts are used (signaled by an irq set in the vendor structure) - * tpm.c can skip polling for the data to be available as the interrupt is - * waited for here - */ --static int tpm_tis_send(struct tpm_chip *chip, u8 *buf, size_t len) -+static int tpm_tis_send_main(struct tpm_chip *chip, u8 *buf, size_t len) - { - int rc; - u32 ordinal; -@@ -373,6 +392,30 @@ out_err: - return rc; - } - -+static int tpm_tis_send(struct tpm_chip *chip, u8 *buf, size_t len) -+{ -+ int rc, irq; -+ struct priv_data *priv = chip->vendor.priv; -+ -+ if (!chip->vendor.irq || priv->irq_tested) -+ return tpm_tis_send_main(chip, buf, len); -+ -+ /* Verify receipt of the expected IRQ */ -+ irq = chip->vendor.irq; -+ chip->vendor.irq = 0; -+ rc = tpm_tis_send_main(chip, buf, len); -+ chip->vendor.irq = irq; -+ if (!priv->irq_tested) -+ msleep(1); -+ if (!priv->irq_tested) { -+ disable_interrupts(chip); -+ dev_err(chip->dev, -+ FW_BUG "TPM interrupt not working, polling instead\n"); -+ } -+ priv->irq_tested = true; -+ return rc; -+} -+ - struct tis_vendor_timeout_override { - u32 did_vid; - unsigned long timeout_us[4]; -@@ -546,6 +589,7 @@ static irqreturn_t tis_int_handler(int dummy, void *dev_id) - if (interrupt == 0) - return IRQ_NONE; - -+ ((struct priv_data *)chip->vendor.priv)->irq_tested = true; - if (interrupt & TPM_INTF_DATA_AVAIL_INT) - wake_up_interruptible(&chip->vendor.read_queue); - if (interrupt & TPM_INTF_LOCALITY_CHANGE_INT) -@@ -575,9 +619,14 @@ static int tpm_tis_init(struct device *dev, resource_size_t start, - u32 vendor, intfcaps, intmask; - int rc, i, irq_s, irq_e, probe; - struct tpm_chip *chip; -+ struct priv_data *priv; - -+ priv = devm_kzalloc(dev, sizeof(struct priv_data), GFP_KERNEL); -+ if (priv == NULL) -+ return -ENOMEM; - if (!(chip = tpm_register_hardware(dev, &tpm_tis))) - return -ENODEV; -+ chip->vendor.priv = priv; - - chip->vendor.iobase = ioremap(start, len); - if (!chip->vendor.iobase) { -@@ -646,19 +695,6 @@ static int tpm_tis_init(struct device *dev, resource_size_t start, - if (intfcaps & TPM_INTF_DATA_AVAIL_INT) - dev_dbg(dev, "\tData Avail Int Support\n"); - -- /* get the timeouts before testing for irqs */ -- if (tpm_get_timeouts(chip)) { -- dev_err(dev, "Could not get TPM timeouts and durations\n"); -- rc = -ENODEV; -- goto out_err; -- } -- -- if (tpm_do_selftest(chip)) { -- dev_err(dev, "TPM self test failed\n"); -- rc = -ENODEV; -- goto out_err; -- } -- - /* INTERRUPT Setup */ - init_waitqueue_head(&chip->vendor.read_queue); - init_waitqueue_head(&chip->vendor.int_queue); -@@ -760,6 +796,18 @@ static int tpm_tis_init(struct device *dev, resource_size_t start, - } - } - -+ if (tpm_get_timeouts(chip)) { -+ dev_err(dev, "Could not get TPM timeouts and durations\n"); -+ rc = -ENODEV; -+ goto out_err; -+ } -+ -+ if (tpm_do_selftest(chip)) { -+ dev_err(dev, "TPM self test failed\n"); -+ rc = -ENODEV; -+ goto out_err; -+ } -+ - INIT_LIST_HEAD(&chip->vendor.list); - mutex_lock(&tis_lock); - list_add(&chip->vendor.list, &tis_chips); -diff --git a/drivers/cpufreq/speedstep-lib.c b/drivers/cpufreq/speedstep-lib.c -index 7047821a7f8a..4ab7a2156672 100644 ---- a/drivers/cpufreq/speedstep-lib.c -+++ b/drivers/cpufreq/speedstep-lib.c -@@ -400,6 +400,7 @@ unsigned int speedstep_get_freqs(enum speedstep_processor processor, - - pr_debug("previous speed is %u\n", prev_speed); - -+ preempt_disable(); - local_irq_save(flags); - - /* switch to low state */ -@@ -464,6 +465,8 @@ unsigned int speedstep_get_freqs(enum speedstep_processor processor, - - out: - local_irq_restore(flags); -+ preempt_enable(); -+ - return ret; - } - EXPORT_SYMBOL_GPL(speedstep_get_freqs); -diff --git a/drivers/cpufreq/speedstep-smi.c b/drivers/cpufreq/speedstep-smi.c -index f5a6b70ee6c0..2844009135f8 100644 ---- a/drivers/cpufreq/speedstep-smi.c -+++ b/drivers/cpufreq/speedstep-smi.c -@@ -188,6 +188,7 @@ static void speedstep_set_state(unsigned int state) - return; - - /* Disable IRQs */ -+ preempt_disable(); - local_irq_save(flags); - - command = (smi_sig & 0xffffff00) | (smi_cmd & 0xff); -@@ -198,9 +199,19 @@ static void speedstep_set_state(unsigned int state) - - do { - if (retry) { -+ /* -+ * We need to enable interrupts, otherwise the blockage -+ * won't resolve. -+ * -+ * We disable preemption so that other processes don't -+ * run. If other processes were running, they could -+ * submit more DMA requests, making the blockage worse. -+ */ - pr_debug("retry %u, previous result %u, waiting...\n", - retry, result); -+ local_irq_enable(); - mdelay(retry * 50); -+ local_irq_disable(); - } - retry++; - __asm__ __volatile__( -@@ -217,6 +228,7 @@ static void speedstep_set_state(unsigned int state) - - /* enable IRQs */ - local_irq_restore(flags); -+ preempt_enable(); - - if (new_state == state) - pr_debug("change to %u MHz succeeded after %u tries " -diff --git a/drivers/gpio/gpio-tps65912.c b/drivers/gpio/gpio-tps65912.c -index 30a5844a7dca..845730469945 100644 ---- a/drivers/gpio/gpio-tps65912.c -+++ b/drivers/gpio/gpio-tps65912.c -@@ -26,9 +26,12 @@ struct tps65912_gpio_data { - struct gpio_chip gpio_chip; - }; - -+#define to_tgd(gc) container_of(gc, struct tps65912_gpio_data, gpio_chip) -+ - static int tps65912_gpio_get(struct gpio_chip *gc, unsigned offset) - { -- struct tps65912 *tps65912 = container_of(gc, struct tps65912, gpio); -+ struct tps65912_gpio_data *tps65912_gpio = to_tgd(gc); -+ struct tps65912 *tps65912 = tps65912_gpio->tps65912; - int val; - - val = tps65912_reg_read(tps65912, TPS65912_GPIO1 + offset); -@@ -42,7 +45,8 @@ static int tps65912_gpio_get(struct gpio_chip *gc, unsigned offset) - static void tps65912_gpio_set(struct gpio_chip *gc, unsigned offset, - int value) - { -- struct tps65912 *tps65912 = container_of(gc, struct tps65912, gpio); -+ struct tps65912_gpio_data *tps65912_gpio = to_tgd(gc); -+ struct tps65912 *tps65912 = tps65912_gpio->tps65912; - - if (value) - tps65912_set_bits(tps65912, TPS65912_GPIO1 + offset, -@@ -55,7 +59,8 @@ static void tps65912_gpio_set(struct gpio_chip *gc, unsigned offset, - static int tps65912_gpio_output(struct gpio_chip *gc, unsigned offset, - int value) - { -- struct tps65912 *tps65912 = container_of(gc, struct tps65912, gpio); -+ struct tps65912_gpio_data *tps65912_gpio = to_tgd(gc); -+ struct tps65912 *tps65912 = tps65912_gpio->tps65912; - - /* Set the initial value */ - tps65912_gpio_set(gc, offset, value); -@@ -66,7 +71,8 @@ static int tps65912_gpio_output(struct gpio_chip *gc, unsigned offset, - - static int tps65912_gpio_input(struct gpio_chip *gc, unsigned offset) - { -- struct tps65912 *tps65912 = container_of(gc, struct tps65912, gpio); -+ struct tps65912_gpio_data *tps65912_gpio = to_tgd(gc); -+ struct tps65912 *tps65912 = tps65912_gpio->tps65912; - - return tps65912_clear_bits(tps65912, TPS65912_GPIO1 + offset, - GPIO_CFG_MASK); -diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c -index 469daa04dadb..ccc2f36bb334 100644 ---- a/drivers/hid/i2c-hid/i2c-hid.c -+++ b/drivers/hid/i2c-hid/i2c-hid.c -@@ -341,7 +341,10 @@ static int i2c_hid_hwreset(struct i2c_client *client) - static void i2c_hid_get_input(struct i2c_hid *ihid) - { - int ret, ret_size; -- int size = ihid->bufsize; -+ int size = le16_to_cpu(ihid->hdesc.wMaxInputLength); -+ -+ if (size > ihid->bufsize) -+ size = ihid->bufsize; - - ret = i2c_master_recv(ihid->client, ihid->inbuf, size); - if (ret != size) { -diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c -index e885dbf08c40..86ac4a4ccc01 100644 ---- a/drivers/md/raid1.c -+++ b/drivers/md/raid1.c -@@ -557,7 +557,7 @@ static int read_balance(struct r1conf *conf, struct r1bio *r1_bio, int *max_sect - if (test_bit(WriteMostly, &rdev->flags)) { - /* Don't balance among write-mostly, just - * use the first as a last resort */ -- if (best_disk < 0) { -+ if (best_dist_disk < 0) { - if (is_badblock(rdev, this_sector, sectors, - &first_bad, &bad_sectors)) { - if (first_bad < this_sector) -@@ -566,7 +566,8 @@ static int read_balance(struct r1conf *conf, struct r1bio *r1_bio, int *max_sect - best_good_sectors = first_bad - this_sector; - } else - best_good_sectors = sectors; -- best_disk = disk; -+ best_dist_disk = disk; -+ best_pending_disk = disk; - } - continue; - } -diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c -index 4daf5c03b33b..1b6986ce5da9 100644 ---- a/drivers/md/raid5.c -+++ b/drivers/md/raid5.c -@@ -2853,7 +2853,8 @@ static void handle_stripe_dirtying(struct r5conf *conf, - * generate correct data from the parity. - */ - if (conf->max_degraded == 2 || -- (recovery_cp < MaxSector && sh->sector >= recovery_cp)) { -+ (recovery_cp < MaxSector && sh->sector >= recovery_cp && -+ s->failed == 0)) { - /* Calculate the real rcw later - for now make it - * look like rcw is cheaper - */ -diff --git a/drivers/media/usb/dvb-usb-v2/lmedm04.c b/drivers/media/usb/dvb-usb-v2/lmedm04.c -index b3fd0ffa3c3f..fc28d514bff0 100644 ---- a/drivers/media/usb/dvb-usb-v2/lmedm04.c -+++ b/drivers/media/usb/dvb-usb-v2/lmedm04.c -@@ -350,6 +350,7 @@ static int lme2510_int_read(struct dvb_usb_adapter *adap) - { - struct dvb_usb_device *d = adap_to_d(adap); - struct lme2510_state *lme_int = adap_to_priv(adap); -+ struct usb_host_endpoint *ep; - - lme_int->lme_urb = usb_alloc_urb(0, GFP_ATOMIC); - -@@ -371,6 +372,12 @@ static int lme2510_int_read(struct dvb_usb_adapter *adap) - adap, - 8); - -+ /* Quirk of pipe reporting PIPE_BULK but behaves as interrupt */ -+ ep = usb_pipe_endpoint(d->udev, lme_int->lme_urb->pipe); -+ -+ if (usb_endpoint_type(&ep->desc) == USB_ENDPOINT_XFER_BULK) -+ lme_int->lme_urb->pipe = usb_rcvbulkpipe(d->udev, 0xa), -+ - lme_int->lme_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; - - usb_submit_urb(lme_int->lme_urb, GFP_ATOMIC); -diff --git a/drivers/mmc/host/sdhci-pxav3.c b/drivers/mmc/host/sdhci-pxav3.c -index 1ae358e0662d..4edb24bf56f8 100644 ---- a/drivers/mmc/host/sdhci-pxav3.c -+++ b/drivers/mmc/host/sdhci-pxav3.c -@@ -201,8 +201,8 @@ static struct sdhci_pxa_platdata *pxav3_get_mmc_pdata(struct device *dev) - if (!pdata) - return NULL; - -- of_property_read_u32(np, "mrvl,clk-delay-cycles", &clk_delay_cycles); -- if (clk_delay_cycles > 0) -+ if (!of_property_read_u32(np, "mrvl,clk-delay-cycles", -+ &clk_delay_cycles)) - pdata->clk_delay_cycles = clk_delay_cycles; - - return pdata; -diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c -index 88b9c0964696..e6660d692008 100644 ---- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c -+++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c -@@ -360,9 +360,6 @@ static void iwl_mvm_cleanup_iterator(void *data, u8 *mac, - mvmvif->uploaded = false; - mvmvif->ap_sta_id = IWL_MVM_STATION_COUNT; - -- /* does this make sense at all? */ -- mvmvif->color++; -- - spin_lock_bh(&mvm->time_event_lock); - iwl_mvm_te_clear_data(mvm, &mvmvif->time_event_data); - spin_unlock_bh(&mvm->time_event_lock); -@@ -544,7 +541,7 @@ static int iwl_mvm_mac_add_interface(struct ieee80211_hw *hw, - - ret = iwl_mvm_mac_ctxt_add(mvm, vif); - if (ret) -- goto out_release; -+ goto out_remove_mac; - - /* - * Update power state on the new interface. Admittedly, based on -diff --git a/drivers/net/wireless/iwlwifi/mvm/tx.c b/drivers/net/wireless/iwlwifi/mvm/tx.c -index 4ec8385e4307..3dd0e5bfa0fc 100644 ---- a/drivers/net/wireless/iwlwifi/mvm/tx.c -+++ b/drivers/net/wireless/iwlwifi/mvm/tx.c -@@ -832,6 +832,11 @@ int iwl_mvm_rx_ba_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb, - sta_id = ba_notif->sta_id; - tid = ba_notif->tid; - -+ if (WARN_ONCE(sta_id >= IWL_MVM_STATION_COUNT || -+ tid >= IWL_MAX_TID_COUNT, -+ "sta_id %d tid %d", sta_id, tid)) -+ return 0; -+ - rcu_read_lock(); - - sta = rcu_dereference(mvm->fw_id_to_mac_id[sta_id]); -diff --git a/drivers/net/wireless/iwlwifi/pcie/tx.c b/drivers/net/wireless/iwlwifi/pcie/tx.c -index 48acfc620191..f05962c32497 100644 ---- a/drivers/net/wireless/iwlwifi/pcie/tx.c -+++ b/drivers/net/wireless/iwlwifi/pcie/tx.c -@@ -720,7 +720,12 @@ void iwl_trans_pcie_tx_reset(struct iwl_trans *trans) - iwl_write_direct32(trans, FH_KW_MEM_ADDR_REG, - trans_pcie->kw.dma >> 4); - -- iwl_pcie_tx_start(trans, trans_pcie->scd_base_addr); -+ /* -+ * Send 0 as the scd_base_addr since the device may have be reset -+ * while we were in WoWLAN in which case SCD_SRAM_BASE_ADDR will -+ * contain garbage. -+ */ -+ iwl_pcie_tx_start(trans, 0); - } - - /* -diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c -index 66aabde82727..5548a13617ab 100644 ---- a/drivers/pci/pci-driver.c -+++ b/drivers/pci/pci-driver.c -@@ -1267,7 +1267,7 @@ static int pci_uevent(struct device *dev, struct kobj_uevent_env *env) - if (add_uevent_var(env, "PCI_SLOT_NAME=%s", pci_name(pdev))) - return -ENOMEM; - -- if (add_uevent_var(env, "MODALIAS=pci:v%08Xd%08Xsv%08Xsd%08Xbc%02Xsc%02Xi%02x", -+ if (add_uevent_var(env, "MODALIAS=pci:v%08Xd%08Xsv%08Xsd%08Xbc%02Xsc%02Xi%02X", - pdev->vendor, pdev->device, - pdev->subsystem_vendor, pdev->subsystem_device, - (u8)(pdev->class >> 16), (u8)(pdev->class >> 8), -diff --git a/drivers/pci/rom.c b/drivers/pci/rom.c -index c5d0a08a8747..d6d499782fb4 100644 ---- a/drivers/pci/rom.c -+++ b/drivers/pci/rom.c -@@ -69,6 +69,7 @@ size_t pci_get_rom_size(struct pci_dev *pdev, void __iomem *rom, size_t size) - { - void __iomem *image; - int last_image; -+ unsigned length; - - image = rom; - do { -@@ -91,9 +92,9 @@ size_t pci_get_rom_size(struct pci_dev *pdev, void __iomem *rom, size_t size) - if (readb(pds + 3) != 'R') - break; - last_image = readb(pds + 21) & 0x80; -- /* this length is reliable */ -- image += readw(pds + 16) * 512; -- } while (!last_image); -+ length = readw(pds + 16); -+ image += length * 512; -+ } while (length && !last_image); - - /* never return a size larger than the PCI resource window */ - /* there are known ROMs that get the size wrong */ -diff --git a/drivers/power/88pm860x_charger.c b/drivers/power/88pm860x_charger.c -index 36fb4b5a4b0d..1ef35ab79d0f 100644 ---- a/drivers/power/88pm860x_charger.c -+++ b/drivers/power/88pm860x_charger.c -@@ -711,6 +711,7 @@ static int pm860x_charger_probe(struct platform_device *pdev) - return 0; - - out_irq: -+ power_supply_unregister(&info->usb); - while (--i >= 0) - free_irq(info->irq[i], info); - out: -diff --git a/drivers/target/iscsi/iscsi_target_tq.c b/drivers/target/iscsi/iscsi_target_tq.c -index 81289520f96b..bd53364b75e8 100644 ---- a/drivers/target/iscsi/iscsi_target_tq.c -+++ b/drivers/target/iscsi/iscsi_target_tq.c -@@ -26,36 +26,22 @@ - #include "iscsi_target_tq.h" - #include "iscsi_target.h" - --static LIST_HEAD(active_ts_list); - static LIST_HEAD(inactive_ts_list); --static DEFINE_SPINLOCK(active_ts_lock); - static DEFINE_SPINLOCK(inactive_ts_lock); - static DEFINE_SPINLOCK(ts_bitmap_lock); - --static void iscsi_add_ts_to_active_list(struct iscsi_thread_set *ts) --{ -- spin_lock(&active_ts_lock); -- list_add_tail(&ts->ts_list, &active_ts_list); -- iscsit_global->active_ts++; -- spin_unlock(&active_ts_lock); --} -- - static void iscsi_add_ts_to_inactive_list(struct iscsi_thread_set *ts) - { -+ if (!list_empty(&ts->ts_list)) { -+ WARN_ON(1); -+ return; -+ } - spin_lock(&inactive_ts_lock); - list_add_tail(&ts->ts_list, &inactive_ts_list); - iscsit_global->inactive_ts++; - spin_unlock(&inactive_ts_lock); - } - --static void iscsi_del_ts_from_active_list(struct iscsi_thread_set *ts) --{ -- spin_lock(&active_ts_lock); -- list_del(&ts->ts_list); -- iscsit_global->active_ts--; -- spin_unlock(&active_ts_lock); --} -- - static struct iscsi_thread_set *iscsi_get_ts_from_inactive_list(void) - { - struct iscsi_thread_set *ts; -@@ -68,7 +54,7 @@ static struct iscsi_thread_set *iscsi_get_ts_from_inactive_list(void) - - ts = list_first_entry(&inactive_ts_list, struct iscsi_thread_set, ts_list); - -- list_del(&ts->ts_list); -+ list_del_init(&ts->ts_list); - iscsit_global->inactive_ts--; - spin_unlock(&inactive_ts_lock); - -@@ -219,8 +205,6 @@ static void iscsi_deallocate_extra_thread_sets(void) - - void iscsi_activate_thread_set(struct iscsi_conn *conn, struct iscsi_thread_set *ts) - { -- iscsi_add_ts_to_active_list(ts); -- - spin_lock_bh(&ts->ts_state_lock); - conn->thread_set = ts; - ts->conn = conn; -@@ -423,7 +407,6 @@ struct iscsi_conn *iscsi_rx_thread_pre_handler(struct iscsi_thread_set *ts) - - if (ts->delay_inactive && (--ts->thread_count == 0)) { - spin_unlock_bh(&ts->ts_state_lock); -- iscsi_del_ts_from_active_list(ts); - - if (!iscsit_global->in_shutdown) - iscsi_deallocate_extra_thread_sets(); -@@ -476,7 +459,6 @@ struct iscsi_conn *iscsi_tx_thread_pre_handler(struct iscsi_thread_set *ts) - - if (ts->delay_inactive && (--ts->thread_count == 0)) { - spin_unlock_bh(&ts->ts_state_lock); -- iscsi_del_ts_from_active_list(ts); - - if (!iscsit_global->in_shutdown) - iscsi_deallocate_extra_thread_sets(); -diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c -index abfd99089781..7cb36813aac2 100644 ---- a/drivers/tty/pty.c -+++ b/drivers/tty/pty.c -@@ -215,6 +215,9 @@ static int pty_signal(struct tty_struct *tty, int sig) - unsigned long flags; - struct pid *pgrp; - -+ if (sig != SIGINT && sig != SIGQUIT && sig != SIGTSTP) -+ return -EINVAL; -+ - if (tty->link) { - spin_lock_irqsave(&tty->link->ctrl_lock, flags); - pgrp = get_pid(tty->link->pgrp); -diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c -index 0d1b3757cfb6..db9d69fa1085 100644 ---- a/drivers/tty/vt/vt.c -+++ b/drivers/tty/vt/vt.c -@@ -498,6 +498,7 @@ void invert_screen(struct vc_data *vc, int offset, int count, int viewed) - #endif - if (DO_UPDATE(vc)) - do_update_region(vc, (unsigned long) p, count); -+ notify_update(vc); - } - - /* used by selection: complement pointer position */ -@@ -514,6 +515,7 @@ void complement_pos(struct vc_data *vc, int offset) - scr_writew(old, screenpos(vc, old_offset, 1)); - if (DO_UPDATE(vc)) - vc->vc_sw->con_putc(vc, old, oldy, oldx); -+ notify_update(vc); - } - - old_offset = offset; -@@ -531,8 +533,8 @@ void complement_pos(struct vc_data *vc, int offset) - oldy = (offset >> 1) / vc->vc_cols; - vc->vc_sw->con_putc(vc, new, oldy, oldx); - } -+ notify_update(vc); - } -- - } - - static void insert_char(struct vc_data *vc, unsigned int nr) -diff --git a/drivers/usb/core/buffer.c b/drivers/usb/core/buffer.c -index b0585e623ba9..19fa68a732f3 100644 ---- a/drivers/usb/core/buffer.c -+++ b/drivers/usb/core/buffer.c -@@ -22,17 +22,25 @@ - */ - - /* FIXME tune these based on pool statistics ... */ --static const size_t pool_max[HCD_BUFFER_POOLS] = { -- /* platforms without dma-friendly caches might need to -- * prevent cacheline sharing... -- */ -- 32, -- 128, -- 512, -- PAGE_SIZE / 2 -- /* bigger --> allocate pages */ -+static size_t pool_max[HCD_BUFFER_POOLS] = { -+ 32, 128, 512, 2048, - }; - -+void __init usb_init_pool_max(void) -+{ -+ /* -+ * The pool_max values must never be smaller than -+ * ARCH_KMALLOC_MINALIGN. -+ */ -+ if (ARCH_KMALLOC_MINALIGN <= 32) -+ ; /* Original value is okay */ -+ else if (ARCH_KMALLOC_MINALIGN <= 64) -+ pool_max[0] = 64; -+ else if (ARCH_KMALLOC_MINALIGN <= 128) -+ pool_max[0] = 0; /* Don't use this pool */ -+ else -+ BUILD_BUG(); /* We don't allow this */ -+} - - /* SETUP primitives */ - -diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c -index f6e5ceb03afb..cbfd3d14fa5a 100644 ---- a/drivers/usb/core/hcd.c -+++ b/drivers/usb/core/hcd.c -@@ -1593,6 +1593,7 @@ static int unlink1(struct usb_hcd *hcd, struct urb *urb, int status) - int usb_hcd_unlink_urb (struct urb *urb, int status) - { - struct usb_hcd *hcd; -+ struct usb_device *udev = urb->dev; - int retval = -EIDRM; - unsigned long flags; - -@@ -1604,20 +1605,19 @@ int usb_hcd_unlink_urb (struct urb *urb, int status) - spin_lock_irqsave(&hcd_urb_unlink_lock, flags); - if (atomic_read(&urb->use_count) > 0) { - retval = 0; -- usb_get_dev(urb->dev); -+ usb_get_dev(udev); - } - spin_unlock_irqrestore(&hcd_urb_unlink_lock, flags); - if (retval == 0) { - hcd = bus_to_hcd(urb->dev->bus); - retval = unlink1(hcd, urb, status); -- usb_put_dev(urb->dev); -+ if (retval == 0) -+ retval = -EINPROGRESS; -+ else if (retval != -EIDRM && retval != -EBUSY) -+ dev_dbg(&udev->dev, "hcd_unlink_urb %p fail %d\n", -+ urb, retval); -+ usb_put_dev(udev); - } -- -- if (retval == 0) -- retval = -EINPROGRESS; -- else if (retval != -EIDRM && retval != -EBUSY) -- dev_dbg(&urb->dev->dev, "hcd_unlink_urb %p fail %d\n", -- urb, retval); - return retval; - } - -diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c -index b10da720f2b4..e54b1bdcd66e 100644 ---- a/drivers/usb/core/usb.c -+++ b/drivers/usb/core/usb.c -@@ -1003,6 +1003,7 @@ static int __init usb_init(void) - pr_info("%s: USB support disabled\n", usbcore_name); - return 0; - } -+ usb_init_pool_max(); - - retval = usb_debugfs_init(); - if (retval) -diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c -index 8e15acd204ef..f48f5dfab245 100644 ---- a/drivers/usb/serial/cp210x.c -+++ b/drivers/usb/serial/cp210x.c -@@ -56,6 +56,7 @@ static const struct usb_device_id id_table[] = { - { USB_DEVICE(0x0846, 0x1100) }, /* NetGear Managed Switch M4100 series, M5300 series, M7100 series */ - { USB_DEVICE(0x08e6, 0x5501) }, /* Gemalto Prox-PU/CU contactless smartcard reader */ - { USB_DEVICE(0x08FD, 0x000A) }, /* Digianswer A/S , ZigBee/802.15.4 MAC Device */ -+ { USB_DEVICE(0x0908, 0x01FF) }, /* Siemens RUGGEDCOM USB Serial Console */ - { USB_DEVICE(0x0BED, 0x1100) }, /* MEI (TM) Cashflow-SC Bill/Voucher Acceptor */ - { USB_DEVICE(0x0BED, 0x1101) }, /* MEI series 2000 Combo Acceptor */ - { USB_DEVICE(0x0FCF, 0x1003) }, /* Dynastream ANT development board */ -diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c -index 3aac8e9edac3..3c4d8797ea9a 100644 ---- a/fs/binfmt_elf.c -+++ b/fs/binfmt_elf.c -@@ -552,11 +552,12 @@ out: - - static unsigned long randomize_stack_top(unsigned long stack_top) - { -- unsigned int random_variable = 0; -+ unsigned long random_variable = 0; - - if ((current->flags & PF_RANDOMIZE) && - !(current->personality & ADDR_NO_RANDOMIZE)) { -- random_variable = get_random_int() & STACK_RND_MASK; -+ random_variable = (unsigned long) get_random_int(); -+ random_variable &= STACK_RND_MASK; - random_variable <<= PAGE_SHIFT; - } - #ifdef CONFIG_STACK_GROWSUP -diff --git a/fs/jffs2/scan.c b/fs/jffs2/scan.c -index 7654e87b0428..9ad5ba4b299b 100644 ---- a/fs/jffs2/scan.c -+++ b/fs/jffs2/scan.c -@@ -510,6 +510,10 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo - sumlen = c->sector_size - je32_to_cpu(sm->offset); - sumptr = buf + buf_size - sumlen; - -+ /* sm->offset maybe wrong but MAGIC maybe right */ -+ if (sumlen > c->sector_size) -+ goto full_scan; -+ - /* Now, make sure the summary itself is available */ - if (sumlen > buf_size) { - /* Need to kmalloc for this. */ -@@ -544,6 +548,7 @@ static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblo - } - } - -+full_scan: - buf_ofs = jeb->offset; - - if (!buf_size) { -diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c -index cff089a412c7..e05c96ebb27d 100644 ---- a/fs/nfs/callback.c -+++ b/fs/nfs/callback.c -@@ -128,22 +128,24 @@ nfs41_callback_svc(void *vrqstp) - if (try_to_freeze()) - continue; - -- prepare_to_wait(&serv->sv_cb_waitq, &wq, TASK_INTERRUPTIBLE); -+ prepare_to_wait(&serv->sv_cb_waitq, &wq, TASK_UNINTERRUPTIBLE); - spin_lock_bh(&serv->sv_cb_lock); - if (!list_empty(&serv->sv_cb_list)) { - req = list_first_entry(&serv->sv_cb_list, - struct rpc_rqst, rq_bc_list); - list_del(&req->rq_bc_list); - spin_unlock_bh(&serv->sv_cb_lock); -+ finish_wait(&serv->sv_cb_waitq, &wq); - dprintk("Invoking bc_svc_process()\n"); - error = bc_svc_process(serv, req, rqstp); - dprintk("bc_svc_process() returned w/ error code= %d\n", - error); - } else { - spin_unlock_bh(&serv->sv_cb_lock); -- schedule(); -+ /* schedule_timeout to game the hung task watchdog */ -+ schedule_timeout(60 * HZ); -+ finish_wait(&serv->sv_cb_waitq, &wq); - } -- finish_wait(&serv->sv_cb_waitq, &wq); - } - return 0; - } -diff --git a/fs/nfs/callback_xdr.c b/fs/nfs/callback_xdr.c -index a35582c9d444..e98ecf8d2588 100644 ---- a/fs/nfs/callback_xdr.c -+++ b/fs/nfs/callback_xdr.c -@@ -464,8 +464,10 @@ static __be32 decode_cb_sequence_args(struct svc_rqst *rqstp, - - for (i = 0; i < args->csa_nrclists; i++) { - status = decode_rc_list(xdr, &args->csa_rclists[i]); -- if (status) -+ if (status) { -+ args->csa_nrclists = i; - goto out_free; -+ } - } - } - status = 0; -diff --git a/fs/xfs/xfs_buf_item.c b/fs/xfs/xfs_buf_item.c -index 4ec431777048..e0451f4201cf 100644 ---- a/fs/xfs/xfs_buf_item.c -+++ b/fs/xfs/xfs_buf_item.c -@@ -296,6 +296,10 @@ xfs_buf_item_format( - ASSERT(atomic_read(&bip->bli_refcount) > 0); - ASSERT((bip->bli_flags & XFS_BLI_LOGGED) || - (bip->bli_flags & XFS_BLI_STALE)); -+ ASSERT((bip->bli_flags & XFS_BLI_STALE) || -+ (xfs_blft_from_flags(&bip->__bli_format) > XFS_BLFT_UNKNOWN_BUF -+ && xfs_blft_from_flags(&bip->__bli_format) < XFS_BLFT_MAX_BUF)); -+ - - /* - * If it is an inode buffer, transfer the in-memory state to the -diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c -index 7f7be5f98f52..f010ab4594f1 100644 ---- a/fs/xfs/xfs_inode.c -+++ b/fs/xfs/xfs_inode.c -@@ -1655,6 +1655,7 @@ xfs_iunlink( - agi->agi_unlinked[bucket_index] = cpu_to_be32(agino); - offset = offsetof(xfs_agi_t, agi_unlinked) + - (sizeof(xfs_agino_t) * bucket_index); -+ xfs_trans_buf_set_type(tp, agibp, XFS_BLFT_AGI_BUF); - xfs_trans_log_buf(tp, agibp, offset, - (offset + sizeof(xfs_agino_t) - 1)); - return 0; -@@ -1746,6 +1747,7 @@ xfs_iunlink_remove( - agi->agi_unlinked[bucket_index] = cpu_to_be32(next_agino); - offset = offsetof(xfs_agi_t, agi_unlinked) + - (sizeof(xfs_agino_t) * bucket_index); -+ xfs_trans_buf_set_type(tp, agibp, XFS_BLFT_AGI_BUF); - xfs_trans_log_buf(tp, agibp, offset, - (offset + sizeof(xfs_agino_t) - 1)); - } else { -diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c -index 2fd7c1ff1d21..b5d5beb7df3a 100644 ---- a/fs/xfs/xfs_trans.c -+++ b/fs/xfs/xfs_trans.c -@@ -1100,6 +1100,7 @@ xfs_trans_apply_sb_deltas( - whole = 1; - } - -+ xfs_trans_buf_set_type(tp, bp, XFS_BLFT_SB_BUF); - if (whole) - /* - * Log the whole thing, the fields are noncontiguous. -diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h -index a78680a92dba..661c0aeef1c4 100644 ---- a/include/linux/fsnotify.h -+++ b/include/linux/fsnotify.h -@@ -101,8 +101,10 @@ static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir, - new_dir_mask |= FS_ISDIR; - } - -- fsnotify(old_dir, old_dir_mask, old_dir, FSNOTIFY_EVENT_INODE, old_name, fs_cookie); -- fsnotify(new_dir, new_dir_mask, new_dir, FSNOTIFY_EVENT_INODE, new_name, fs_cookie); -+ fsnotify(old_dir, old_dir_mask, source, FSNOTIFY_EVENT_INODE, old_name, -+ fs_cookie); -+ fsnotify(new_dir, new_dir_mask, source, FSNOTIFY_EVENT_INODE, new_name, -+ fs_cookie); - - if (target) - fsnotify_link_count(target); -diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h -index 0fdff28d5015..287b906f5d59 100644 ---- a/include/linux/usb/hcd.h -+++ b/include/linux/usb/hcd.h -@@ -416,6 +416,7 @@ extern const struct dev_pm_ops usb_hcd_pci_pm_ops; - #endif /* CONFIG_PCI */ - - /* pci-ish (pdev null is ok) buffer alloc/mapping support */ -+void usb_init_pool_max(void); - int hcd_buffer_create(struct usb_hcd *hcd); - void hcd_buffer_destroy(struct usb_hcd *hcd); - -diff --git a/kernel/debug/kdb/kdb_main.c b/kernel/debug/kdb/kdb_main.c -index 00eb8f7fbf41..545241de23bf 100644 ---- a/kernel/debug/kdb/kdb_main.c -+++ b/kernel/debug/kdb/kdb_main.c -@@ -2532,7 +2532,7 @@ static int kdb_summary(int argc, const char **argv) - #define K(x) ((x) << (PAGE_SHIFT - 10)) - kdb_printf("\nMemTotal: %8lu kB\nMemFree: %8lu kB\n" - "Buffers: %8lu kB\n", -- val.totalram, val.freeram, val.bufferram); -+ K(val.totalram), K(val.freeram), K(val.bufferram)); - return 0; - } - -diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c -index 28db9bedc857..6211d5d6d465 100644 ---- a/kernel/time/ntp.c -+++ b/kernel/time/ntp.c -@@ -631,10 +631,14 @@ int ntp_validate_timex(struct timex *txc) - if ((txc->modes & ADJ_SETOFFSET) && (!capable(CAP_SYS_TIME))) - return -EPERM; - -- if (txc->modes & ADJ_FREQUENCY) { -- if (LONG_MIN / PPM_SCALE > txc->freq) -+ /* -+ * Check for potential multiplication overflows that can -+ * only happen on 64-bit systems: -+ */ -+ if ((txc->modes & ADJ_FREQUENCY) && (BITS_PER_LONG == 64)) { -+ if (LLONG_MIN / PPM_SCALE > txc->freq) - return -EINVAL; -- if (LONG_MAX / PPM_SCALE < txc->freq) -+ if (LLONG_MAX / PPM_SCALE < txc->freq) - return -EINVAL; - } - -diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c -index 18cdf91b2f85..8d7e8098e768 100644 ---- a/kernel/trace/trace.c -+++ b/kernel/trace/trace.c -@@ -4588,7 +4588,7 @@ tracing_mark_write(struct file *filp, const char __user *ubuf, - *fpos += written; - - out_unlock: -- for (i = 0; i < nr_pages; i++){ -+ for (i = nr_pages - 1; i >= 0; i--) { - kunmap_atomic(map_page[i]); - put_page(pages[i]); - } -diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c -index 3663a305daf7..1b51d9216e7e 100644 ---- a/net/ceph/osd_client.c -+++ b/net/ceph/osd_client.c -@@ -967,12 +967,24 @@ static void put_osd(struct ceph_osd *osd) - */ - static void __remove_osd(struct ceph_osd_client *osdc, struct ceph_osd *osd) - { -- dout("__remove_osd %p\n", osd); -- BUG_ON(!list_empty(&osd->o_requests)); -- rb_erase(&osd->o_node, &osdc->osds); -+ dout("%s %p osd%d\n", __func__, osd, osd->o_osd); -+ WARN_ON(!list_empty(&osd->o_requests)); -+ WARN_ON(!list_empty(&osd->o_linger_requests)); -+ - list_del_init(&osd->o_osd_lru); -- ceph_con_close(&osd->o_con); -- put_osd(osd); -+ rb_erase(&osd->o_node, &osdc->osds); -+ RB_CLEAR_NODE(&osd->o_node); -+} -+ -+static void remove_osd(struct ceph_osd_client *osdc, struct ceph_osd *osd) -+{ -+ dout("%s %p osd%d\n", __func__, osd, osd->o_osd); -+ -+ if (!RB_EMPTY_NODE(&osd->o_node)) { -+ ceph_con_close(&osd->o_con); -+ __remove_osd(osdc, osd); -+ put_osd(osd); -+ } - } - - static void remove_all_osds(struct ceph_osd_client *osdc) -@@ -982,7 +994,7 @@ static void remove_all_osds(struct ceph_osd_client *osdc) - while (!RB_EMPTY_ROOT(&osdc->osds)) { - struct ceph_osd *osd = rb_entry(rb_first(&osdc->osds), - struct ceph_osd, o_node); -- __remove_osd(osdc, osd); -+ remove_osd(osdc, osd); - } - mutex_unlock(&osdc->request_mutex); - } -@@ -1012,7 +1024,7 @@ static void remove_old_osds(struct ceph_osd_client *osdc) - list_for_each_entry_safe(osd, nosd, &osdc->osd_lru, o_osd_lru) { - if (time_before(jiffies, osd->lru_ttl)) - break; -- __remove_osd(osdc, osd); -+ remove_osd(osdc, osd); - } - mutex_unlock(&osdc->request_mutex); - } -@@ -1027,8 +1039,7 @@ static int __reset_osd(struct ceph_osd_client *osdc, struct ceph_osd *osd) - dout("__reset_osd %p osd%d\n", osd, osd->o_osd); - if (list_empty(&osd->o_requests) && - list_empty(&osd->o_linger_requests)) { -- __remove_osd(osdc, osd); -- -+ remove_osd(osdc, osd); - return -ENODEV; - } - -@@ -1610,6 +1621,7 @@ static void reset_changed_osds(struct ceph_osd_client *osdc) - { - struct rb_node *p, *n; - -+ dout("%s %p\n", __func__, osdc); - for (p = rb_first(&osdc->osds); p; p = n) { - struct ceph_osd *osd = rb_entry(p, struct ceph_osd, o_node); - -diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c -index 63c1c8041554..fa66ba30470e 100644 ---- a/sound/pci/riptide/riptide.c -+++ b/sound/pci/riptide/riptide.c -@@ -2032,32 +2032,43 @@ snd_riptide_joystick_probe(struct pci_dev *pci, const struct pci_device_id *id) - { - static int dev; - struct gameport *gameport; -+ int ret; - - if (dev >= SNDRV_CARDS) - return -ENODEV; -+ - if (!enable[dev]) { -- dev++; -- return -ENOENT; -+ ret = -ENOENT; -+ goto inc_dev; - } - -- if (!joystick_port[dev++]) -- return 0; -+ if (!joystick_port[dev]) { -+ ret = 0; -+ goto inc_dev; -+ } - - gameport = gameport_allocate_port(); -- if (!gameport) -- return -ENOMEM; -+ if (!gameport) { -+ ret = -ENOMEM; -+ goto inc_dev; -+ } - if (!request_region(joystick_port[dev], 8, "Riptide gameport")) { - snd_printk(KERN_WARNING - "Riptide: cannot grab gameport 0x%x\n", - joystick_port[dev]); - gameport_free_port(gameport); -- return -EBUSY; -+ ret = -EBUSY; -+ goto inc_dev; - } - - gameport->io = joystick_port[dev]; - gameport_register_port(gameport); - pci_set_drvdata(pci, gameport); -- return 0; -+ -+ ret = 0; -+inc_dev: -+ dev++; -+ return ret; - } - - static void snd_riptide_joystick_remove(struct pci_dev *pci) -diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c -index 9ea05e956474..dd910d249987 100644 ---- a/sound/pci/rme9652/hdspm.c -+++ b/sound/pci/rme9652/hdspm.c -@@ -5789,6 +5789,9 @@ static int snd_hdspm_playback_open(struct snd_pcm_substream *substream) - snd_pcm_hw_constraint_minmax(runtime, - SNDRV_PCM_HW_PARAM_PERIOD_SIZE, - 64, 8192); -+ snd_pcm_hw_constraint_minmax(runtime, -+ SNDRV_PCM_HW_PARAM_PERIODS, -+ 2, 2); - break; - } - -@@ -5863,6 +5866,9 @@ static int snd_hdspm_capture_open(struct snd_pcm_substream *substream) - snd_pcm_hw_constraint_minmax(runtime, - SNDRV_PCM_HW_PARAM_PERIOD_SIZE, - 64, 8192); -+ snd_pcm_hw_constraint_minmax(runtime, -+ SNDRV_PCM_HW_PARAM_PERIODS, -+ 2, 2); - break; - } - diff --git a/patch/kernel/marvell-default/1-patch-3.10.71-72.patch b/patch/kernel/marvell-default/1-patch-3.10.71-72.patch deleted file mode 100644 index 430142d3f3..0000000000 --- a/patch/kernel/marvell-default/1-patch-3.10.71-72.patch +++ /dev/null @@ -1,2207 +0,0 @@ -diff --git a/Makefile b/Makefile -index d8b42f71ea5a..211bb34102bf 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,6 +1,6 @@ - VERSION = 3 - PATCHLEVEL = 10 --SUBLEVEL = 71 -+SUBLEVEL = 72 - EXTRAVERSION = - NAME = TOSSUG Baby Fish - -diff --git a/arch/mips/kvm/trace.h b/arch/mips/kvm/trace.h -index bc9e0f406c08..e51621e36152 100644 ---- a/arch/mips/kvm/trace.h -+++ b/arch/mips/kvm/trace.h -@@ -26,18 +26,18 @@ TRACE_EVENT(kvm_exit, - TP_PROTO(struct kvm_vcpu *vcpu, unsigned int reason), - TP_ARGS(vcpu, reason), - TP_STRUCT__entry( -- __field(struct kvm_vcpu *, vcpu) -+ __field(unsigned long, pc) - __field(unsigned int, reason) - ), - - TP_fast_assign( -- __entry->vcpu = vcpu; -+ __entry->pc = vcpu->arch.pc; - __entry->reason = reason; - ), - - TP_printk("[%s]PC: 0x%08lx", - kvm_mips_exit_types_str[__entry->reason], -- __entry->vcpu->arch.pc) -+ __entry->pc) - ); - - #endif /* _TRACE_KVM_H */ -diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S -index 948b2e14df8c..6ed8f16fd61b 100644 ---- a/arch/x86/kernel/entry_64.S -+++ b/arch/x86/kernel/entry_64.S -@@ -557,11 +557,14 @@ ENTRY(ret_from_fork) - testl $3, CS-ARGOFFSET(%rsp) # from kernel_thread? - jz 1f - -- testl $_TIF_IA32, TI_flags(%rcx) # 32-bit compat task needs IRET -- jnz int_ret_from_sys_call -- -- RESTORE_TOP_OF_STACK %rdi, -ARGOFFSET -- jmp ret_from_sys_call # go to the SYSRET fastpath -+ /* -+ * By the time we get here, we have no idea whether our pt_regs, -+ * ti flags, and ti status came from the 64-bit SYSCALL fast path, -+ * the slow path, or one of the ia32entry paths. -+ * Use int_ret_from_sys_call to return, since it can safely handle -+ * all of the above. -+ */ -+ jmp int_ret_from_sys_call - - 1: - subq $REST_SKIP, %rsp # leave space for volatiles -diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c -index 4c01f022c6ac..af88fa20dbe8 100644 ---- a/arch/x86/kvm/emulate.c -+++ b/arch/x86/kvm/emulate.c -@@ -4732,7 +4732,8 @@ int x86_emulate_insn(struct x86_emulate_ctxt *ctxt) - if (rc != X86EMUL_CONTINUE) - goto done; - } -- ctxt->dst.orig_val = ctxt->dst.val; -+ /* Copy full 64-bit value for CMPXCHG8B. */ -+ ctxt->dst.orig_val64 = ctxt->dst.val64; - - special_insn: - -diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c -index 82a01cc45f9c..0dc9ff61d7c2 100644 ---- a/drivers/acpi/video.c -+++ b/drivers/acpi/video.c -@@ -1953,6 +1953,17 @@ EXPORT_SYMBOL(acpi_video_unregister); - - static int __init acpi_video_init(void) - { -+ /* -+ * Let the module load even if ACPI is disabled (e.g. due to -+ * a broken BIOS) so that i915.ko can still be loaded on such -+ * old systems without an AcpiOpRegion. -+ * -+ * acpi_video_register() will report -ENODEV later as well due -+ * to acpi_disabled when i915.ko tries to register itself afterwards. -+ */ -+ if (acpi_disabled) -+ return 0; -+ - dmi_check_system(video_dmi_table); - - if (intel_opregion_present()) -diff --git a/drivers/clk/sunxi/clk-factors.c b/drivers/clk/sunxi/clk-factors.c -index 88523f91d9b7..7555793097f2 100644 ---- a/drivers/clk/sunxi/clk-factors.c -+++ b/drivers/clk/sunxi/clk-factors.c -@@ -70,7 +70,7 @@ static unsigned long clk_factors_recalc_rate(struct clk_hw *hw, - p = FACTOR_GET(config->pshift, config->pwidth, reg); - - /* Calculate the rate */ -- rate = (parent_rate * n * (k + 1) >> p) / (m + 1); -+ rate = (parent_rate * (n + config->n_start) * (k + 1) >> p) / (m + 1); - - return rate; - } -diff --git a/drivers/clk/sunxi/clk-factors.h b/drivers/clk/sunxi/clk-factors.h -index f49851cc4380..441fdc3f5717 100644 ---- a/drivers/clk/sunxi/clk-factors.h -+++ b/drivers/clk/sunxi/clk-factors.h -@@ -15,6 +15,7 @@ struct clk_factors_config { - u8 mwidth; - u8 pshift; - u8 pwidth; -+ u8 n_start; - }; - - struct clk *clk_register_factors(struct device *dev, const char *name, -diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c -index 451d7886644c..c254e467ac62 100644 ---- a/drivers/gpu/drm/radeon/ni.c -+++ b/drivers/gpu/drm/radeon/ni.c -@@ -930,12 +930,12 @@ static void cayman_gpu_init(struct radeon_device *rdev) - - if ((rdev->config.cayman.max_backends_per_se == 1) && - (rdev->flags & RADEON_IS_IGP)) { -- if ((disabled_rb_mask & 3) == 1) { -- /* RB0 disabled, RB1 enabled */ -- tmp = 0x11111111; -- } else { -+ if ((disabled_rb_mask & 3) == 2) { - /* RB1 disabled, RB0 enabled */ - tmp = 0x00000000; -+ } else { -+ /* RB0 disabled, RB1 enabled */ -+ tmp = 0x11111111; - } - } else { - tmp = gb_addr_config & NUM_PIPES_MASK; -diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c -index 03a6acffed5d..a3915d12e746 100644 ---- a/drivers/hid/hid-input.c -+++ b/drivers/hid/hid-input.c -@@ -1066,6 +1066,23 @@ void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, struct - return; - } - -+ /* -+ * Ignore reports for absolute data if the data didn't change. This is -+ * not only an optimization but also fixes 'dead' key reports. Some -+ * RollOver implementations for localized keys (like BACKSLASH/PIPE; HID -+ * 0x31 and 0x32) report multiple keys, even though a localized keyboard -+ * can only have one of them physically available. The 'dead' keys -+ * report constant 0. As all map to the same keycode, they'd confuse -+ * the input layer. If we filter the 'dead' keys on the HID level, we -+ * skip the keycode translation and only forward real events. -+ */ -+ if (!(field->flags & (HID_MAIN_ITEM_RELATIVE | -+ HID_MAIN_ITEM_BUFFERED_BYTE)) && -+ (field->flags & HID_MAIN_ITEM_VARIABLE) && -+ usage->usage_index < field->maxusage && -+ value == field->value[usage->usage_index]) -+ return; -+ - /* report the usage code as scancode if the key status has changed */ - if (usage->type == EV_KEY && !!test_bit(usage->code, input->key) != value) - input_event(input, EV_MSC, MSC_SCAN, usage->hid); -diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c -index 4004e54ef05d..f445b0840d33 100644 ---- a/drivers/hv/vmbus_drv.c -+++ b/drivers/hv/vmbus_drv.c -@@ -686,7 +686,7 @@ int vmbus_device_register(struct hv_device *child_device_obj) - if (ret) - pr_err("Unable to register child device\n"); - else -- pr_info("child device %s registered\n", -+ pr_debug("child device %s registered\n", - dev_name(&child_device_obj->device)); - - return ret; -@@ -698,14 +698,14 @@ int vmbus_device_register(struct hv_device *child_device_obj) - */ - void vmbus_device_unregister(struct hv_device *device_obj) - { -+ pr_debug("child device %s unregistered\n", -+ dev_name(&device_obj->device)); -+ - /* - * Kick off the process of unregistering the device. - * This will call vmbus_remove() and eventually vmbus_device_release() - */ - device_unregister(&device_obj->device); -- -- pr_info("child device %s unregistered\n", -- dev_name(&device_obj->device)); - } - - -diff --git a/drivers/iio/imu/adis16400_core.c b/drivers/iio/imu/adis16400_core.c -index d6ece2d17dec..7d60c85cc16d 100644 ---- a/drivers/iio/imu/adis16400_core.c -+++ b/drivers/iio/imu/adis16400_core.c -@@ -26,6 +26,7 @@ - #include - #include - #include -+#include - - #include - #include -@@ -447,7 +448,7 @@ static int adis16400_read_raw(struct iio_dev *indio_dev, - mutex_unlock(&indio_dev->mlock); - if (ret) - return ret; -- val16 = ((val16 & 0xFFF) << 4) >> 4; -+ val16 = sign_extend32(val16, 11); - *val = val16; - return IIO_VAL_INT; - case IIO_CHAN_INFO_OFFSET: -diff --git a/drivers/infiniband/hw/qib/qib.h b/drivers/infiniband/hw/qib/qib.h -index 4d11575c2010..d1b30c66d604 100644 ---- a/drivers/infiniband/hw/qib/qib.h -+++ b/drivers/infiniband/hw/qib/qib.h -@@ -1055,12 +1055,6 @@ struct qib_devdata { - /* control high-level access to EEPROM */ - struct mutex eep_lock; - uint64_t traffic_wds; -- /* active time is kept in seconds, but logged in hours */ -- atomic_t active_time; -- /* Below are nominal shadow of EEPROM, new since last EEPROM update */ -- uint8_t eep_st_errs[QIB_EEP_LOG_CNT]; -- uint8_t eep_st_new_errs[QIB_EEP_LOG_CNT]; -- uint16_t eep_hrs; - /* - * masks for which bits of errs, hwerrs that cause - * each of the counters to increment. -@@ -1278,8 +1272,7 @@ int qib_twsi_blk_rd(struct qib_devdata *dd, int dev, int addr, void *buffer, - int qib_twsi_blk_wr(struct qib_devdata *dd, int dev, int addr, - const void *buffer, int len); - void qib_get_eeprom_info(struct qib_devdata *); --int qib_update_eeprom_log(struct qib_devdata *dd); --void qib_inc_eeprom_err(struct qib_devdata *dd, u32 eidx, u32 incr); -+#define qib_inc_eeprom_err(dd, eidx, incr) - void qib_dump_lookup_output_queue(struct qib_devdata *); - void qib_force_pio_avail_update(struct qib_devdata *); - void qib_clear_symerror_on_linkup(unsigned long opaque); -diff --git a/drivers/infiniband/hw/qib/qib_eeprom.c b/drivers/infiniband/hw/qib/qib_eeprom.c -index 4d5d71aaa2b4..e2280b07df02 100644 ---- a/drivers/infiniband/hw/qib/qib_eeprom.c -+++ b/drivers/infiniband/hw/qib/qib_eeprom.c -@@ -267,190 +267,9 @@ void qib_get_eeprom_info(struct qib_devdata *dd) - "Board SN %s did not pass functional test: %s\n", - dd->serial, ifp->if_comment); - -- memcpy(&dd->eep_st_errs, &ifp->if_errcntp, QIB_EEP_LOG_CNT); -- /* -- * Power-on (actually "active") hours are kept as little-endian value -- * in EEPROM, but as seconds in a (possibly as small as 24-bit) -- * atomic_t while running. -- */ -- atomic_set(&dd->active_time, 0); -- dd->eep_hrs = ifp->if_powerhour[0] | (ifp->if_powerhour[1] << 8); -- - done: - vfree(buf); - - bail:; - } - --/** -- * qib_update_eeprom_log - copy active-time and error counters to eeprom -- * @dd: the qlogic_ib device -- * -- * Although the time is kept as seconds in the qib_devdata struct, it is -- * rounded to hours for re-write, as we have only 16 bits in EEPROM. -- * First-cut code reads whole (expected) struct qib_flash, modifies, -- * re-writes. Future direction: read/write only what we need, assuming -- * that the EEPROM had to have been "good enough" for driver init, and -- * if not, we aren't making it worse. -- * -- */ --int qib_update_eeprom_log(struct qib_devdata *dd) --{ -- void *buf; -- struct qib_flash *ifp; -- int len, hi_water; -- uint32_t new_time, new_hrs; -- u8 csum; -- int ret, idx; -- unsigned long flags; -- -- /* first, check if we actually need to do anything. */ -- ret = 0; -- for (idx = 0; idx < QIB_EEP_LOG_CNT; ++idx) { -- if (dd->eep_st_new_errs[idx]) { -- ret = 1; -- break; -- } -- } -- new_time = atomic_read(&dd->active_time); -- -- if (ret == 0 && new_time < 3600) -- goto bail; -- -- /* -- * The quick-check above determined that there is something worthy -- * of logging, so get current contents and do a more detailed idea. -- * read full flash, not just currently used part, since it may have -- * been written with a newer definition -- */ -- len = sizeof(struct qib_flash); -- buf = vmalloc(len); -- ret = 1; -- if (!buf) { -- qib_dev_err(dd, -- "Couldn't allocate memory to read %u bytes from eeprom for logging\n", -- len); -- goto bail; -- } -- -- /* Grab semaphore and read current EEPROM. If we get an -- * error, let go, but if not, keep it until we finish write. -- */ -- ret = mutex_lock_interruptible(&dd->eep_lock); -- if (ret) { -- qib_dev_err(dd, "Unable to acquire EEPROM for logging\n"); -- goto free_bail; -- } -- ret = qib_twsi_blk_rd(dd, dd->twsi_eeprom_dev, 0, buf, len); -- if (ret) { -- mutex_unlock(&dd->eep_lock); -- qib_dev_err(dd, "Unable read EEPROM for logging\n"); -- goto free_bail; -- } -- ifp = (struct qib_flash *)buf; -- -- csum = flash_csum(ifp, 0); -- if (csum != ifp->if_csum) { -- mutex_unlock(&dd->eep_lock); -- qib_dev_err(dd, "EEPROM cks err (0x%02X, S/B 0x%02X)\n", -- csum, ifp->if_csum); -- ret = 1; -- goto free_bail; -- } -- hi_water = 0; -- spin_lock_irqsave(&dd->eep_st_lock, flags); -- for (idx = 0; idx < QIB_EEP_LOG_CNT; ++idx) { -- int new_val = dd->eep_st_new_errs[idx]; -- if (new_val) { -- /* -- * If we have seen any errors, add to EEPROM values -- * We need to saturate at 0xFF (255) and we also -- * would need to adjust the checksum if we were -- * trying to minimize EEPROM traffic -- * Note that we add to actual current count in EEPROM, -- * in case it was altered while we were running. -- */ -- new_val += ifp->if_errcntp[idx]; -- if (new_val > 0xFF) -- new_val = 0xFF; -- if (ifp->if_errcntp[idx] != new_val) { -- ifp->if_errcntp[idx] = new_val; -- hi_water = offsetof(struct qib_flash, -- if_errcntp) + idx; -- } -- /* -- * update our shadow (used to minimize EEPROM -- * traffic), to match what we are about to write. -- */ -- dd->eep_st_errs[idx] = new_val; -- dd->eep_st_new_errs[idx] = 0; -- } -- } -- /* -- * Now update active-time. We would like to round to the nearest hour -- * but unless atomic_t are sure to be proper signed ints we cannot, -- * because we need to account for what we "transfer" to EEPROM and -- * if we log an hour at 31 minutes, then we would need to set -- * active_time to -29 to accurately count the _next_ hour. -- */ -- if (new_time >= 3600) { -- new_hrs = new_time / 3600; -- atomic_sub((new_hrs * 3600), &dd->active_time); -- new_hrs += dd->eep_hrs; -- if (new_hrs > 0xFFFF) -- new_hrs = 0xFFFF; -- dd->eep_hrs = new_hrs; -- if ((new_hrs & 0xFF) != ifp->if_powerhour[0]) { -- ifp->if_powerhour[0] = new_hrs & 0xFF; -- hi_water = offsetof(struct qib_flash, if_powerhour); -- } -- if ((new_hrs >> 8) != ifp->if_powerhour[1]) { -- ifp->if_powerhour[1] = new_hrs >> 8; -- hi_water = offsetof(struct qib_flash, if_powerhour) + 1; -- } -- } -- /* -- * There is a tiny possibility that we could somehow fail to write -- * the EEPROM after updating our shadows, but problems from holding -- * the spinlock too long are a much bigger issue. -- */ -- spin_unlock_irqrestore(&dd->eep_st_lock, flags); -- if (hi_water) { -- /* we made some change to the data, uopdate cksum and write */ -- csum = flash_csum(ifp, 1); -- ret = eeprom_write_with_enable(dd, 0, buf, hi_water + 1); -- } -- mutex_unlock(&dd->eep_lock); -- if (ret) -- qib_dev_err(dd, "Failed updating EEPROM\n"); -- --free_bail: -- vfree(buf); --bail: -- return ret; --} -- --/** -- * qib_inc_eeprom_err - increment one of the four error counters -- * that are logged to EEPROM. -- * @dd: the qlogic_ib device -- * @eidx: 0..3, the counter to increment -- * @incr: how much to add -- * -- * Each counter is 8-bits, and saturates at 255 (0xFF). They -- * are copied to the EEPROM (aka flash) whenever qib_update_eeprom_log() -- * is called, but it can only be called in a context that allows sleep. -- * This function can be called even at interrupt level. -- */ --void qib_inc_eeprom_err(struct qib_devdata *dd, u32 eidx, u32 incr) --{ -- uint new_val; -- unsigned long flags; -- -- spin_lock_irqsave(&dd->eep_st_lock, flags); -- new_val = dd->eep_st_new_errs[eidx] + incr; -- if (new_val > 255) -- new_val = 255; -- dd->eep_st_new_errs[eidx] = new_val; -- spin_unlock_irqrestore(&dd->eep_st_lock, flags); --} -diff --git a/drivers/infiniband/hw/qib/qib_iba6120.c b/drivers/infiniband/hw/qib/qib_iba6120.c -index 0232ae56b1fa..4e2613325183 100644 ---- a/drivers/infiniband/hw/qib/qib_iba6120.c -+++ b/drivers/infiniband/hw/qib/qib_iba6120.c -@@ -2682,8 +2682,6 @@ static void qib_get_6120_faststats(unsigned long opaque) - spin_lock_irqsave(&dd->eep_st_lock, flags); - traffic_wds -= dd->traffic_wds; - dd->traffic_wds += traffic_wds; -- if (traffic_wds >= QIB_TRAFFIC_ACTIVE_THRESHOLD) -- atomic_add(5, &dd->active_time); /* S/B #define */ - spin_unlock_irqrestore(&dd->eep_st_lock, flags); - - qib_chk_6120_errormask(dd); -diff --git a/drivers/infiniband/hw/qib/qib_iba7220.c b/drivers/infiniband/hw/qib/qib_iba7220.c -index 64d0ecb90cdc..3dbabf3a5d6d 100644 ---- a/drivers/infiniband/hw/qib/qib_iba7220.c -+++ b/drivers/infiniband/hw/qib/qib_iba7220.c -@@ -3299,8 +3299,6 @@ static void qib_get_7220_faststats(unsigned long opaque) - spin_lock_irqsave(&dd->eep_st_lock, flags); - traffic_wds -= dd->traffic_wds; - dd->traffic_wds += traffic_wds; -- if (traffic_wds >= QIB_TRAFFIC_ACTIVE_THRESHOLD) -- atomic_add(5, &dd->active_time); /* S/B #define */ - spin_unlock_irqrestore(&dd->eep_st_lock, flags); - done: - mod_timer(&dd->stats_timer, jiffies + HZ * ACTIVITY_TIMER); -diff --git a/drivers/infiniband/hw/qib/qib_iba7322.c b/drivers/infiniband/hw/qib/qib_iba7322.c -index 14103ffb4839..5f5f20f42231 100644 ---- a/drivers/infiniband/hw/qib/qib_iba7322.c -+++ b/drivers/infiniband/hw/qib/qib_iba7322.c -@@ -4854,8 +4854,6 @@ static void qib_get_7322_faststats(unsigned long opaque) - spin_lock_irqsave(&ppd->dd->eep_st_lock, flags); - traffic_wds -= ppd->dd->traffic_wds; - ppd->dd->traffic_wds += traffic_wds; -- if (traffic_wds >= QIB_TRAFFIC_ACTIVE_THRESHOLD) -- atomic_add(ACTIVITY_TIMER, &ppd->dd->active_time); - spin_unlock_irqrestore(&ppd->dd->eep_st_lock, flags); - if (ppd->cpspec->qdr_dfe_on && (ppd->link_speed_active & - QIB_IB_QDR) && -diff --git a/drivers/infiniband/hw/qib/qib_init.c b/drivers/infiniband/hw/qib/qib_init.c -index 173f805790da..8f936e36dd53 100644 ---- a/drivers/infiniband/hw/qib/qib_init.c -+++ b/drivers/infiniband/hw/qib/qib_init.c -@@ -892,7 +892,6 @@ static void qib_shutdown_device(struct qib_devdata *dd) - } - } - -- qib_update_eeprom_log(dd); - } - - /** -diff --git a/drivers/infiniband/hw/qib/qib_sysfs.c b/drivers/infiniband/hw/qib/qib_sysfs.c -index 3c8e4e3caca6..b9ccbda7817d 100644 ---- a/drivers/infiniband/hw/qib/qib_sysfs.c -+++ b/drivers/infiniband/hw/qib/qib_sysfs.c -@@ -611,28 +611,6 @@ bail: - return ret < 0 ? ret : count; - } - --static ssize_t show_logged_errs(struct device *device, -- struct device_attribute *attr, char *buf) --{ -- struct qib_ibdev *dev = -- container_of(device, struct qib_ibdev, ibdev.dev); -- struct qib_devdata *dd = dd_from_dev(dev); -- int idx, count; -- -- /* force consistency with actual EEPROM */ -- if (qib_update_eeprom_log(dd) != 0) -- return -ENXIO; -- -- count = 0; -- for (idx = 0; idx < QIB_EEP_LOG_CNT; ++idx) { -- count += scnprintf(buf + count, PAGE_SIZE - count, "%d%c", -- dd->eep_st_errs[idx], -- idx == (QIB_EEP_LOG_CNT - 1) ? '\n' : ' '); -- } -- -- return count; --} -- - /* - * Dump tempsense regs. in decimal, to ease shell-scripts. - */ -@@ -679,7 +657,6 @@ static DEVICE_ATTR(nctxts, S_IRUGO, show_nctxts, NULL); - static DEVICE_ATTR(nfreectxts, S_IRUGO, show_nfreectxts, NULL); - static DEVICE_ATTR(serial, S_IRUGO, show_serial, NULL); - static DEVICE_ATTR(boardversion, S_IRUGO, show_boardversion, NULL); --static DEVICE_ATTR(logged_errors, S_IRUGO, show_logged_errs, NULL); - static DEVICE_ATTR(tempsense, S_IRUGO, show_tempsense, NULL); - static DEVICE_ATTR(localbus_info, S_IRUGO, show_localbus_info, NULL); - static DEVICE_ATTR(chip_reset, S_IWUSR, NULL, store_chip_reset); -@@ -693,7 +670,6 @@ static struct device_attribute *qib_attributes[] = { - &dev_attr_nfreectxts, - &dev_attr_serial, - &dev_attr_boardversion, -- &dev_attr_logged_errors, - &dev_attr_tempsense, - &dev_attr_localbus_info, - &dev_attr_chip_reset, -diff --git a/drivers/md/dm-io.c b/drivers/md/dm-io.c -index d1de1626a9d2..17cb2170e9d8 100644 ---- a/drivers/md/dm-io.c -+++ b/drivers/md/dm-io.c -@@ -291,6 +291,12 @@ static void do_region(int rw, unsigned region, struct dm_io_region *where, - unsigned short logical_block_size = queue_logical_block_size(q); - sector_t num_sectors; - -+ /* Reject unsupported discard requests */ -+ if ((rw & REQ_DISCARD) && !blk_queue_discard(q)) { -+ dec_count(io, region, -EOPNOTSUPP); -+ return; -+ } -+ - /* - * where->count may be zero if rw holds a flush and we need to - * send a zero-sized flush. -diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c -index 699b5be68d31..678556b8ee4d 100644 ---- a/drivers/md/dm-raid1.c -+++ b/drivers/md/dm-raid1.c -@@ -604,6 +604,15 @@ static void write_callback(unsigned long error, void *context) - return; - } - -+ /* -+ * If the bio is discard, return an error, but do not -+ * degrade the array. -+ */ -+ if (bio->bi_rw & REQ_DISCARD) { -+ bio_endio(bio, -EOPNOTSUPP); -+ return; -+ } -+ - for (i = 0; i < ms->nr_mirrors; i++) - if (test_bit(i, &error)) - fail_mirror(ms->mirror + i, DM_RAID1_WRITE_ERROR); -diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c -index 944690bafd93..d892a05c84f4 100644 ---- a/drivers/md/dm-snap.c -+++ b/drivers/md/dm-snap.c -@@ -1439,8 +1439,6 @@ out: - full_bio->bi_end_io = pe->full_bio_end_io; - full_bio->bi_private = pe->full_bio_private; - } -- free_pending_exception(pe); -- - increment_pending_exceptions_done_count(); - - up_write(&s->lock); -@@ -1457,6 +1455,8 @@ out: - } - - retry_origin_bios(s, origin_bios); -+ -+ free_pending_exception(pe); - } - - static void commit_callback(void *context, int success) -diff --git a/drivers/md/dm.c b/drivers/md/dm.c -index 204a59fd872f..a87f0c42cb8b 100644 ---- a/drivers/md/dm.c -+++ b/drivers/md/dm.c -@@ -2270,7 +2270,7 @@ int dm_setup_md_queue(struct mapped_device *md) - return 0; - } - --static struct mapped_device *dm_find_md(dev_t dev) -+struct mapped_device *dm_get_md(dev_t dev) - { - struct mapped_device *md; - unsigned minor = MINOR(dev); -@@ -2281,12 +2281,15 @@ static struct mapped_device *dm_find_md(dev_t dev) - spin_lock(&_minor_lock); - - md = idr_find(&_minor_idr, minor); -- if (md && (md == MINOR_ALLOCED || -- (MINOR(disk_devt(dm_disk(md))) != minor) || -- dm_deleting_md(md) || -- test_bit(DMF_FREEING, &md->flags))) { -- md = NULL; -- goto out; -+ if (md) { -+ if ((md == MINOR_ALLOCED || -+ (MINOR(disk_devt(dm_disk(md))) != minor) || -+ dm_deleting_md(md) || -+ test_bit(DMF_FREEING, &md->flags))) { -+ md = NULL; -+ goto out; -+ } -+ dm_get(md); - } - - out: -@@ -2294,16 +2297,6 @@ out: - - return md; - } -- --struct mapped_device *dm_get_md(dev_t dev) --{ -- struct mapped_device *md = dm_find_md(dev); -- -- if (md) -- dm_get(md); -- -- return md; --} - EXPORT_SYMBOL_GPL(dm_get_md); - - void *dm_get_mdptr(struct mapped_device *md) -diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c -index 2d255ba911d5..8fc46fcaee54 100644 ---- a/drivers/net/macvtap.c -+++ b/drivers/net/macvtap.c -@@ -658,12 +658,15 @@ static unsigned long iov_pages(const struct iovec *iv, int offset, - return pages; - } - -+/* Neighbour code has some assumptions on HH_DATA_MOD alignment */ -+#define MACVTAP_RESERVE HH_DATA_OFF(ETH_HLEN) -+ - /* Get packet from user space buffer */ - static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m, - const struct iovec *iv, unsigned long total_len, - size_t count, int noblock) - { -- int good_linear = SKB_MAX_HEAD(NET_IP_ALIGN); -+ int good_linear = SKB_MAX_HEAD(MACVTAP_RESERVE); - struct sk_buff *skb; - struct macvlan_dev *vlan; - unsigned long len = total_len; -@@ -722,7 +725,7 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m, - linear = vnet_hdr.hdr_len; - } - -- skb = macvtap_alloc_skb(&q->sk, NET_IP_ALIGN, copylen, -+ skb = macvtap_alloc_skb(&q->sk, MACVTAP_RESERVE, copylen, - linear, noblock, &err); - if (!skb) - goto err; -diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c -index 38f0b312ff85..427e48a80efa 100644 ---- a/drivers/net/phy/phy.c -+++ b/drivers/net/phy/phy.c -@@ -203,6 +203,25 @@ static inline int phy_find_valid(int idx, u32 features) - } - - /** -+ * phy_check_valid - check if there is a valid PHY setting which matches -+ * speed, duplex, and feature mask -+ * @speed: speed to match -+ * @duplex: duplex to match -+ * @features: A mask of the valid settings -+ * -+ * Description: Returns true if there is a valid setting, false otherwise. -+ */ -+static inline bool phy_check_valid(int speed, int duplex, u32 features) -+{ -+ unsigned int idx; -+ -+ idx = phy_find_valid(phy_find_setting(speed, duplex), features); -+ -+ return settings[idx].speed == speed && settings[idx].duplex == duplex && -+ (settings[idx].setting & features); -+} -+ -+/** - * phy_sanitize_settings - make sure the PHY is set to supported speed and duplex - * @phydev: the target phy_device struct - * -@@ -1011,7 +1030,7 @@ int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable) - (phydev->interface == PHY_INTERFACE_MODE_RGMII))) { - int eee_lp, eee_cap, eee_adv; - u32 lp, cap, adv; -- int idx, status; -+ int status; - - /* Read phy status to properly get the right settings */ - status = phy_read_status(phydev); -@@ -1043,8 +1062,7 @@ int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable) - - adv = mmd_eee_adv_to_ethtool_adv_t(eee_adv); - lp = mmd_eee_adv_to_ethtool_adv_t(eee_lp); -- idx = phy_find_setting(phydev->speed, phydev->duplex); -- if (!(lp & adv & settings[idx].setting)) -+ if (!phy_check_valid(phydev->speed, phydev->duplex, lp & adv)) - goto eee_exit; - - if (clk_stop_enable) { -diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c -index 12222290c802..14179a6593ef 100644 ---- a/drivers/net/team/team.c -+++ b/drivers/net/team/team.c -@@ -42,9 +42,7 @@ - - static struct team_port *team_port_get_rcu(const struct net_device *dev) - { -- struct team_port *port = rcu_dereference(dev->rx_handler_data); -- -- return team_port_exists(dev) ? port : NULL; -+ return rcu_dereference(dev->rx_handler_data); - } - - static struct team_port *team_port_get_rtnl(const struct net_device *dev) -@@ -1523,11 +1521,11 @@ static int team_set_mac_address(struct net_device *dev, void *p) - if (dev->type == ARPHRD_ETHER && !is_valid_ether_addr(addr->sa_data)) - return -EADDRNOTAVAIL; - memcpy(dev->dev_addr, addr->sa_data, dev->addr_len); -- rcu_read_lock(); -- list_for_each_entry_rcu(port, &team->port_list, list) -+ mutex_lock(&team->lock); -+ list_for_each_entry(port, &team->port_list, list) - if (team->ops.port_change_dev_addr) - team->ops.port_change_dev_addr(team, port); -- rcu_read_unlock(); -+ mutex_unlock(&team->lock); - return 0; - } - -diff --git a/drivers/net/usb/plusb.c b/drivers/net/usb/plusb.c -index 0fcc8e65a068..74323e9d9004 100644 ---- a/drivers/net/usb/plusb.c -+++ b/drivers/net/usb/plusb.c -@@ -136,6 +136,11 @@ static const struct usb_device_id products [] = { - }, { - USB_DEVICE(0x050d, 0x258a), /* Belkin F5U258/F5U279 (PL-25A1) */ - .driver_info = (unsigned long) &prolific_info, -+}, { -+ USB_DEVICE(0x3923, 0x7825), /* National Instruments USB -+ * Host-to-Host Cable -+ */ -+ .driver_info = (unsigned long) &prolific_info, - }, - - { }, // END -diff --git a/drivers/net/wireless/ath/ath5k/reset.c b/drivers/net/wireless/ath/ath5k/reset.c -index a3399c4f13a9..b9b651ea9851 100644 ---- a/drivers/net/wireless/ath/ath5k/reset.c -+++ b/drivers/net/wireless/ath/ath5k/reset.c -@@ -478,7 +478,7 @@ ath5k_hw_wisoc_reset(struct ath5k_hw *ah, u32 flags) - regval = ioread32(reg); - iowrite32(regval | val, reg); - regval = ioread32(reg); -- usleep_range(100, 150); -+ udelay(100); /* NB: should be atomic */ - - /* Bring BB/MAC out of reset */ - iowrite32(regval & ~val, reg); -diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c -index d24a2867bc21..1ad39c799c74 100644 ---- a/drivers/scsi/be2iscsi/be_main.c -+++ b/drivers/scsi/be2iscsi/be_main.c -@@ -564,7 +564,6 @@ static struct beiscsi_hba *beiscsi_hba_alloc(struct pci_dev *pcidev) - "beiscsi_hba_alloc - iscsi_host_alloc failed\n"); - return NULL; - } -- shost->dma_boundary = pcidev->dma_mask; - shost->max_id = BE2_MAX_SESSIONS; - shost->max_channel = 0; - shost->max_cmd_len = BEISCSI_MAX_CMD_LEN; -diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c -index df5e961484e1..eb81c98386b9 100644 ---- a/drivers/scsi/sg.c -+++ b/drivers/scsi/sg.c -@@ -522,7 +522,7 @@ static ssize_t - sg_new_read(Sg_fd * sfp, char __user *buf, size_t count, Sg_request * srp) - { - sg_io_hdr_t *hp = &srp->header; -- int err = 0; -+ int err = 0, err2; - int len; - - if (count < SZ_SG_IO_HDR) { -@@ -551,8 +551,8 @@ sg_new_read(Sg_fd * sfp, char __user *buf, size_t count, Sg_request * srp) - goto err_out; - } - err_out: -- err = sg_finish_rem_req(srp); -- return (0 == err) ? count : err; -+ err2 = sg_finish_rem_req(srp); -+ return err ? : err2 ? : count; - } - - static ssize_t -diff --git a/drivers/staging/comedi/comedi_compat32.c b/drivers/staging/comedi/comedi_compat32.c -index ad208cdd53d4..83bcf968ac63 100644 ---- a/drivers/staging/comedi/comedi_compat32.c -+++ b/drivers/staging/comedi/comedi_compat32.c -@@ -270,7 +270,7 @@ static int compat_cmd(struct file *file, unsigned long arg) - { - struct comedi_cmd __user *cmd; - struct comedi32_cmd_struct __user *cmd32; -- int rc; -+ int rc, err; - - cmd32 = compat_ptr(arg); - cmd = compat_alloc_user_space(sizeof(*cmd)); -@@ -279,7 +279,15 @@ static int compat_cmd(struct file *file, unsigned long arg) - if (rc) - return rc; - -- return translated_ioctl(file, COMEDI_CMD, (unsigned long)cmd); -+ rc = translated_ioctl(file, COMEDI_CMD, (unsigned long)cmd); -+ if (rc == -EAGAIN) { -+ /* Special case: copy cmd back to user. */ -+ err = put_compat_cmd(cmd32, cmd); -+ if (err) -+ rc = err; -+ } -+ -+ return rc; - } - - /* Handle 32-bit COMEDI_CMDTEST ioctl. */ -diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c b/drivers/staging/comedi/drivers/cb_pcidas64.c -index c3e5495b4f06..4220a44186c4 100644 ---- a/drivers/staging/comedi/drivers/cb_pcidas64.c -+++ b/drivers/staging/comedi/drivers/cb_pcidas64.c -@@ -455,6 +455,29 @@ static const struct comedi_lrange ai_ranges_64xx = { - } - }; - -+static const uint8_t ai_range_code_64xx[8] = { -+ 0x0, 0x1, 0x2, 0x3, /* bipolar 10, 5, 2,5, 1.25 */ -+ 0x8, 0x9, 0xa, 0xb /* unipolar 10, 5, 2.5, 1.25 */ -+}; -+ -+/* analog input ranges for 64-Mx boards */ -+static const struct comedi_lrange ai_ranges_64_mx = { -+ 7, { -+ BIP_RANGE(5), -+ BIP_RANGE(2.5), -+ BIP_RANGE(1.25), -+ BIP_RANGE(0.625), -+ UNI_RANGE(5), -+ UNI_RANGE(2.5), -+ UNI_RANGE(1.25) -+ } -+}; -+ -+static const uint8_t ai_range_code_64_mx[7] = { -+ 0x0, 0x1, 0x2, 0x3, /* bipolar 5, 2.5, 1.25, 0.625 */ -+ 0x9, 0xa, 0xb /* unipolar 5, 2.5, 1.25 */ -+}; -+ - /* analog input ranges for 60xx boards */ - static const struct comedi_lrange ai_ranges_60xx = { - 4, -@@ -466,6 +489,10 @@ static const struct comedi_lrange ai_ranges_60xx = { - } - }; - -+static const uint8_t ai_range_code_60xx[4] = { -+ 0x0, 0x1, 0x4, 0x7 /* bipolar 10, 5, 0.5, 0.05 */ -+}; -+ - /* analog input ranges for 6030, etc boards */ - static const struct comedi_lrange ai_ranges_6030 = { - 14, -@@ -487,6 +514,11 @@ static const struct comedi_lrange ai_ranges_6030 = { - } - }; - -+static const uint8_t ai_range_code_6030[14] = { -+ 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, /* bip 10, 5, 2, 1, 0.5, 0.2, 0.1 */ -+ 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf /* uni 10, 5, 2, 1, 0.5, 0.2, 0.1 */ -+}; -+ - /* analog input ranges for 6052, etc boards */ - static const struct comedi_lrange ai_ranges_6052 = { - 15, -@@ -509,6 +541,11 @@ static const struct comedi_lrange ai_ranges_6052 = { - } - }; - -+static const uint8_t ai_range_code_6052[15] = { -+ 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, /* bipolar 10 ... 0.05 */ -+ 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf /* unipolar 10 ... 0.1 */ -+}; -+ - /* analog input ranges for 4020 board */ - static const struct comedi_lrange ai_ranges_4020 = { - 2, -@@ -616,6 +653,7 @@ struct pcidas64_board { - int ai_bits; /* analog input resolution */ - int ai_speed; /* fastest conversion period in ns */ - const struct comedi_lrange *ai_range_table; -+ const uint8_t *ai_range_code; - int ao_nchan; /* number of analog out channels */ - int ao_bits; /* analog output resolution */ - int ao_scan_speed; /* analog output scan speed */ -@@ -674,6 +712,7 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_scan_speed = 10000, - .layout = LAYOUT_64XX, - .ai_range_table = &ai_ranges_64xx, -+ .ai_range_code = ai_range_code_64xx, - .ao_range_table = &ao_ranges_64xx, - .ao_range_code = ao_range_code_64xx, - .ai_fifo = &ai_fifo_64xx, -@@ -689,6 +728,7 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_scan_speed = 10000, - .layout = LAYOUT_64XX, - .ai_range_table = &ai_ranges_64xx, -+ .ai_range_code = ai_range_code_64xx, - .ao_range_table = &ao_ranges_64xx, - .ao_range_code = ao_range_code_64xx, - .ai_fifo = &ai_fifo_64xx, -@@ -703,7 +743,8 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_bits = 16, - .ao_scan_speed = 10000, - .layout = LAYOUT_64XX, -- .ai_range_table = &ai_ranges_64xx, -+ .ai_range_table = &ai_ranges_64_mx, -+ .ai_range_code = ai_range_code_64_mx, - .ao_range_table = &ao_ranges_64xx, - .ao_range_code = ao_range_code_64xx, - .ai_fifo = &ai_fifo_64xx, -@@ -718,7 +759,8 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_bits = 16, - .ao_scan_speed = 10000, - .layout = LAYOUT_64XX, -- .ai_range_table = &ai_ranges_64xx, -+ .ai_range_table = &ai_ranges_64_mx, -+ .ai_range_code = ai_range_code_64_mx, - .ao_range_table = &ao_ranges_64xx, - .ao_range_code = ao_range_code_64xx, - .ai_fifo = &ai_fifo_64xx, -@@ -733,7 +775,8 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_bits = 16, - .ao_scan_speed = 10000, - .layout = LAYOUT_64XX, -- .ai_range_table = &ai_ranges_64xx, -+ .ai_range_table = &ai_ranges_64_mx, -+ .ai_range_code = ai_range_code_64_mx, - .ao_range_table = &ao_ranges_64xx, - .ao_range_code = ao_range_code_64xx, - .ai_fifo = &ai_fifo_64xx, -@@ -748,6 +791,7 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_bits = 16, - .layout = LAYOUT_60XX, - .ai_range_table = &ai_ranges_60xx, -+ .ai_range_code = ai_range_code_60xx, - .ao_range_table = &range_bipolar10, - .ao_range_code = ao_range_code_60xx, - .ai_fifo = &ai_fifo_60xx, -@@ -763,6 +807,7 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_scan_speed = 100000, - .layout = LAYOUT_60XX, - .ai_range_table = &ai_ranges_60xx, -+ .ai_range_code = ai_range_code_60xx, - .ao_range_table = &range_bipolar10, - .ao_range_code = ao_range_code_60xx, - .ai_fifo = &ai_fifo_60xx, -@@ -777,6 +822,7 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_scan_speed = 100000, - .layout = LAYOUT_60XX, - .ai_range_table = &ai_ranges_60xx, -+ .ai_range_code = ai_range_code_60xx, - .ao_range_table = &range_bipolar10, - .ao_range_code = ao_range_code_60xx, - .ai_fifo = &ai_fifo_60xx, -@@ -792,6 +838,7 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_scan_speed = 100000, - .layout = LAYOUT_60XX, - .ai_range_table = &ai_ranges_60xx, -+ .ai_range_code = ai_range_code_60xx, - .ao_range_table = &range_bipolar10, - .ao_range_code = ao_range_code_60xx, - .ai_fifo = &ai_fifo_60xx, -@@ -807,6 +854,7 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_scan_speed = 10000, - .layout = LAYOUT_60XX, - .ai_range_table = &ai_ranges_6030, -+ .ai_range_code = ai_range_code_6030, - .ao_range_table = &ao_ranges_6030, - .ao_range_code = ao_range_code_6030, - .ai_fifo = &ai_fifo_60xx, -@@ -822,6 +870,7 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_scan_speed = 10000, - .layout = LAYOUT_60XX, - .ai_range_table = &ai_ranges_6030, -+ .ai_range_code = ai_range_code_6030, - .ao_range_table = &ao_ranges_6030, - .ao_range_code = ao_range_code_6030, - .ai_fifo = &ai_fifo_60xx, -@@ -835,6 +884,7 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_nchan = 0, - .layout = LAYOUT_60XX, - .ai_range_table = &ai_ranges_6030, -+ .ai_range_code = ai_range_code_6030, - .ai_fifo = &ai_fifo_60xx, - .has_8255 = 0, - }, -@@ -846,6 +896,7 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_nchan = 0, - .layout = LAYOUT_60XX, - .ai_range_table = &ai_ranges_6030, -+ .ai_range_code = ai_range_code_6030, - .ai_fifo = &ai_fifo_60xx, - .has_8255 = 0, - }, -@@ -858,6 +909,7 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_scan_speed = 0, - .layout = LAYOUT_60XX, - .ai_range_table = &ai_ranges_60xx, -+ .ai_range_code = ai_range_code_60xx, - .ai_fifo = &ai_fifo_60xx, - .has_8255 = 0, - }, -@@ -871,6 +923,7 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_scan_speed = 100000, - .layout = LAYOUT_60XX, - .ai_range_table = &ai_ranges_60xx, -+ .ai_range_code = ai_range_code_60xx, - .ao_range_table = &range_bipolar10, - .ao_range_code = ao_range_code_60xx, - .ai_fifo = &ai_fifo_60xx, -@@ -886,6 +939,7 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_scan_speed = 100000, - .layout = LAYOUT_60XX, - .ai_range_table = &ai_ranges_60xx, -+ .ai_range_code = ai_range_code_60xx, - .ao_range_table = &range_bipolar10, - .ao_range_code = ao_range_code_60xx, - .ai_fifo = &ai_fifo_60xx, -@@ -901,6 +955,7 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_scan_speed = 1000, - .layout = LAYOUT_60XX, - .ai_range_table = &ai_ranges_6052, -+ .ai_range_code = ai_range_code_6052, - .ao_range_table = &ao_ranges_6030, - .ao_range_code = ao_range_code_6030, - .ai_fifo = &ai_fifo_60xx, -@@ -916,6 +971,7 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_scan_speed = 3333, - .layout = LAYOUT_60XX, - .ai_range_table = &ai_ranges_6052, -+ .ai_range_code = ai_range_code_6052, - .ao_range_table = &ao_ranges_6030, - .ao_range_code = ao_range_code_6030, - .ai_fifo = &ai_fifo_60xx, -@@ -931,6 +987,7 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_scan_speed = 1000, - .layout = LAYOUT_60XX, - .ai_range_table = &ai_ranges_6052, -+ .ai_range_code = ai_range_code_6052, - .ao_range_table = &ao_ranges_6030, - .ao_range_code = ao_range_code_6030, - .ai_fifo = &ai_fifo_60xx, -@@ -946,6 +1003,7 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_scan_speed = 1000, - .layout = LAYOUT_60XX, - .ai_range_table = &ai_ranges_6052, -+ .ai_range_code = ai_range_code_6052, - .ao_range_table = &ao_ranges_6030, - .ao_range_code = ao_range_code_6030, - .ai_fifo = &ai_fifo_60xx, -@@ -980,6 +1038,7 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_scan_speed = 10000, - .layout = LAYOUT_64XX, - .ai_range_table = &ai_ranges_64xx, -+ .ai_range_code = ai_range_code_64xx, - .ai_fifo = ai_fifo_64xx, - .has_8255 = 1, - }, -@@ -991,7 +1050,8 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_nchan = 0, - .ao_scan_speed = 10000, - .layout = LAYOUT_64XX, -- .ai_range_table = &ai_ranges_64xx, -+ .ai_range_table = &ai_ranges_64_mx, -+ .ai_range_code = ai_range_code_64_mx, - .ai_fifo = ai_fifo_64xx, - .has_8255 = 1, - }, -@@ -1003,7 +1063,8 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_nchan = 0, - .ao_scan_speed = 10000, - .layout = LAYOUT_64XX, -- .ai_range_table = &ai_ranges_64xx, -+ .ai_range_table = &ai_ranges_64_mx, -+ .ai_range_code = ai_range_code_64_mx, - .ai_fifo = ai_fifo_64xx, - .has_8255 = 1, - }, -@@ -1015,7 +1076,8 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_nchan = 0, - .ao_scan_speed = 10000, - .layout = LAYOUT_64XX, -- .ai_range_table = &ai_ranges_64xx, -+ .ai_range_table = &ai_ranges_64_mx, -+ .ai_range_code = ai_range_code_64_mx, - .ai_fifo = ai_fifo_64xx, - .has_8255 = 1, - }, -@@ -1027,7 +1089,8 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_nchan = 2, - .ao_scan_speed = 10000, - .layout = LAYOUT_64XX, -- .ai_range_table = &ai_ranges_64xx, -+ .ai_range_table = &ai_ranges_64_mx, -+ .ai_range_code = ai_range_code_64_mx, - .ai_fifo = ai_fifo_64xx, - .has_8255 = 1, - }, -@@ -1039,7 +1102,8 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_nchan = 2, - .ao_scan_speed = 10000, - .layout = LAYOUT_64XX, -- .ai_range_table = &ai_ranges_64xx, -+ .ai_range_table = &ai_ranges_64_mx, -+ .ai_range_code = ai_range_code_64_mx, - .ai_fifo = ai_fifo_64xx, - .has_8255 = 1, - }, -@@ -1051,7 +1115,8 @@ static const struct pcidas64_board pcidas64_boards[] = { - .ao_nchan = 2, - .ao_scan_speed = 10000, - .layout = LAYOUT_64XX, -- .ai_range_table = &ai_ranges_64xx, -+ .ai_range_table = &ai_ranges_64_mx, -+ .ai_range_code = ai_range_code_64_mx, - .ai_fifo = ai_fifo_64xx, - .has_8255 = 1, - }, -@@ -1148,45 +1213,8 @@ static unsigned int ai_range_bits_6xxx(const struct comedi_device *dev, - unsigned int range_index) - { - const struct pcidas64_board *thisboard = comedi_board(dev); -- const struct comedi_krange *range = -- &thisboard->ai_range_table->range[range_index]; -- unsigned int bits = 0; - -- switch (range->max) { -- case 10000000: -- bits = 0x000; -- break; -- case 5000000: -- bits = 0x100; -- break; -- case 2000000: -- case 2500000: -- bits = 0x200; -- break; -- case 1000000: -- case 1250000: -- bits = 0x300; -- break; -- case 500000: -- bits = 0x400; -- break; -- case 200000: -- case 250000: -- bits = 0x500; -- break; -- case 100000: -- bits = 0x600; -- break; -- case 50000: -- bits = 0x700; -- break; -- default: -- comedi_error(dev, "bug! in ai_range_bits_6xxx"); -- break; -- } -- if (range->min == 0) -- bits += 0x900; -- return bits; -+ return thisboard->ai_range_code[range_index] << 8; - } - - static unsigned int hw_revision(const struct comedi_device *dev, -diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c -index 92e6c510e5d0..70b0d265c37d 100644 ---- a/drivers/target/target_core_sbc.c -+++ b/drivers/target/target_core_sbc.c -@@ -562,7 +562,8 @@ sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops) - unsigned long long end_lba; - - end_lba = dev->transport->get_blocks(dev) + 1; -- if (cmd->t_task_lba + sectors > end_lba) { -+ if (((cmd->t_task_lba + sectors) < cmd->t_task_lba) || -+ ((cmd->t_task_lba + sectors) > end_lba)) { - pr_err("cmd exceeds last lba %llu " - "(lba %llu, sectors %u)\n", - end_lba, cmd->t_task_lba, sectors); -diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c -index d35afccdb6c9..2967b6eb4c70 100644 ---- a/drivers/tty/tty_io.c -+++ b/drivers/tty/tty_io.c -@@ -992,8 +992,8 @@ EXPORT_SYMBOL(start_tty); - /* We limit tty time update visibility to every 8 seconds or so. */ - static void tty_update_time(struct timespec *time) - { -- unsigned long sec = get_seconds() & ~7; -- if ((long)(sec - time->tv_sec) > 0) -+ unsigned long sec = get_seconds(); -+ if (abs(sec - time->tv_sec) & ~7) - time->tv_sec = sec; - } - -diff --git a/drivers/tty/tty_ioctl.c b/drivers/tty/tty_ioctl.c -index 088b4ca7d805..b46aca5cc23c 100644 ---- a/drivers/tty/tty_ioctl.c -+++ b/drivers/tty/tty_ioctl.c -@@ -217,11 +217,17 @@ void tty_wait_until_sent(struct tty_struct *tty, long timeout) - #endif - if (!timeout) - timeout = MAX_SCHEDULE_TIMEOUT; -+ - if (wait_event_interruptible_timeout(tty->write_wait, -- !tty_chars_in_buffer(tty), timeout) >= 0) { -- if (tty->ops->wait_until_sent) -- tty->ops->wait_until_sent(tty, timeout); -+ !tty_chars_in_buffer(tty), timeout) < 0) { -+ return; - } -+ -+ if (timeout == MAX_SCHEDULE_TIMEOUT) -+ timeout = 0; -+ -+ if (tty->ops->wait_until_sent) -+ tty->ops->wait_until_sent(tty, timeout); - } - EXPORT_SYMBOL(tty_wait_until_sent); - -diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c -index ce773cca2bf5..78ddfb43750a 100644 ---- a/drivers/usb/core/devio.c -+++ b/drivers/usb/core/devio.c -@@ -501,6 +501,7 @@ static void async_completed(struct urb *urb) - as->status = urb->status; - signr = as->signr; - if (signr) { -+ memset(&sinfo, 0, sizeof(sinfo)); - sinfo.si_signo = as->signr; - sinfo.si_errno = as->status; - sinfo.si_code = SI_ASYNCIO; -@@ -2228,6 +2229,7 @@ static void usbdev_remove(struct usb_device *udev) - wake_up_all(&ps->wait); - list_del_init(&ps->list); - if (ps->discsignr) { -+ memset(&sinfo, 0, sizeof(sinfo)); - sinfo.si_signo = ps->discsignr; - sinfo.si_errno = EPIPE; - sinfo.si_code = SI_ASYNCIO; -diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c -index eb45ac843712..9948890ef93e 100644 ---- a/drivers/usb/host/xhci-ring.c -+++ b/drivers/usb/host/xhci-ring.c -@@ -2064,7 +2064,7 @@ static int process_ctrl_td(struct xhci_hcd *xhci, struct xhci_td *td, - if (event_trb != ep_ring->dequeue) { - /* The event was for the status stage */ - if (event_trb == td->last_trb) { -- if (td->urb->actual_length != 0) { -+ if (td->urb_length_set) { - /* Don't overwrite a previously set error code - */ - if ((*status == -EINPROGRESS || *status == 0) && -@@ -2078,7 +2078,13 @@ static int process_ctrl_td(struct xhci_hcd *xhci, struct xhci_td *td, - td->urb->transfer_buffer_length; - } - } else { -- /* Maybe the event was for the data stage? */ -+ /* -+ * Maybe the event was for the data stage? If so, update -+ * already the actual_length of the URB and flag it as -+ * set, so that it is not overwritten in the event for -+ * the last TRB. -+ */ -+ td->urb_length_set = true; - td->urb->actual_length = - td->urb->transfer_buffer_length - - EVENT_TRB_LEN(le32_to_cpu(event->transfer_len)); -diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h -index 627fcd9388ca..373d4dada565 100644 ---- a/drivers/usb/host/xhci.h -+++ b/drivers/usb/host/xhci.h -@@ -1,3 +1,4 @@ -+ - /* - * xHCI host controller driver - * -@@ -88,9 +89,10 @@ struct xhci_cap_regs { - #define HCS_IST(p) (((p) >> 0) & 0xf) - /* bits 4:7, max number of Event Ring segments */ - #define HCS_ERST_MAX(p) (((p) >> 4) & 0xf) -+/* bits 21:25 Hi 5 bits of Scratchpad buffers SW must allocate for the HW */ - /* bit 26 Scratchpad restore - for save/restore HW state - not used yet */ --/* bits 27:31 number of Scratchpad buffers SW must allocate for the HW */ --#define HCS_MAX_SCRATCHPAD(p) (((p) >> 27) & 0x1f) -+/* bits 27:31 Lo 5 bits of Scratchpad buffers SW must allocate for the HW */ -+#define HCS_MAX_SCRATCHPAD(p) ((((p) >> 16) & 0x3e0) | (((p) >> 27) & 0x1f)) - - /* HCSPARAMS3 - hcs_params3 - bitmasks */ - /* bits 0:7, Max U1 to U0 latency for the roothub ports */ -@@ -1258,6 +1260,8 @@ struct xhci_td { - struct xhci_segment *start_seg; - union xhci_trb *first_trb; - union xhci_trb *last_trb; -+ /* actual_length of the URB has already been set */ -+ bool urb_length_set; - }; - - /* xHCI command default timeout value */ -diff --git a/drivers/usb/serial/bus.c b/drivers/usb/serial/bus.c -index 7229b265870a..5c56efeaf202 100644 ---- a/drivers/usb/serial/bus.c -+++ b/drivers/usb/serial/bus.c -@@ -76,7 +76,7 @@ static int usb_serial_device_probe(struct device *dev) - retval = device_create_file(dev, &dev_attr_port_number); - if (retval) { - if (driver->port_remove) -- retval = driver->port_remove(port); -+ driver->port_remove(port); - goto exit_with_autopm; - } - -diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c -index f48f5dfab245..79e9ea005c63 100644 ---- a/drivers/usb/serial/cp210x.c -+++ b/drivers/usb/serial/cp210x.c -@@ -147,6 +147,8 @@ static const struct usb_device_id id_table[] = { - { USB_DEVICE(0x166A, 0x0305) }, /* Clipsal C-5000CT2 C-Bus Spectrum Colour Touchscreen */ - { USB_DEVICE(0x166A, 0x0401) }, /* Clipsal L51xx C-Bus Architectural Dimmer */ - { USB_DEVICE(0x166A, 0x0101) }, /* Clipsal 5560884 C-Bus Multi-room Audio Matrix Switcher */ -+ { USB_DEVICE(0x16C0, 0x09B0) }, /* Lunatico Seletek */ -+ { USB_DEVICE(0x16C0, 0x09B1) }, /* Lunatico Seletek */ - { USB_DEVICE(0x16D6, 0x0001) }, /* Jablotron serial interface */ - { USB_DEVICE(0x16DC, 0x0010) }, /* W-IE-NE-R Plein & Baus GmbH PL512 Power Supply */ - { USB_DEVICE(0x16DC, 0x0011) }, /* W-IE-NE-R Plein & Baus GmbH RCM Remote Control for MARATON Power Supply */ -diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c -index c625f55667f1..cf127a080644 100644 ---- a/drivers/usb/serial/ftdi_sio.c -+++ b/drivers/usb/serial/ftdi_sio.c -@@ -815,6 +815,8 @@ static struct usb_device_id id_table_combined [] = { - { USB_DEVICE(FTDI_VID, FTDI_ELSTER_UNICOM_PID) }, - { USB_DEVICE(FTDI_VID, FTDI_PROPOX_JTAGCABLEII_PID) }, - { USB_DEVICE(FTDI_VID, FTDI_PROPOX_ISPCABLEIII_PID) }, -+ { USB_DEVICE(FTDI_VID, CYBER_CORTEX_AV_PID), -+ .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, - { USB_DEVICE(OLIMEX_VID, OLIMEX_ARM_USB_OCD_PID), - .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, - { USB_DEVICE(OLIMEX_VID, OLIMEX_ARM_USB_OCD_H_PID), -diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h -index ac703a6e2115..e8d352615297 100644 ---- a/drivers/usb/serial/ftdi_sio_ids.h -+++ b/drivers/usb/serial/ftdi_sio_ids.h -@@ -38,6 +38,9 @@ - - #define FTDI_LUMEL_PD12_PID 0x6002 - -+/* Cyber Cortex AV by Fabulous Silicon (http://fabuloussilicon.com) */ -+#define CYBER_CORTEX_AV_PID 0x8698 -+ - /* - * Marvell OpenRD Base, Client - * http://www.open-rd.org -diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c -index 8335b484f14e..a10648d2596b 100644 ---- a/drivers/usb/serial/generic.c -+++ b/drivers/usb/serial/generic.c -@@ -261,7 +261,8 @@ void usb_serial_generic_wait_until_sent(struct tty_struct *tty, long timeout) - * character or at least one jiffy. - */ - period = max_t(unsigned long, (10 * HZ / bps), 1); -- period = min_t(unsigned long, period, timeout); -+ if (timeout) -+ period = min_t(unsigned long, period, timeout); - - dev_dbg(&port->dev, "%s - timeout = %u ms, period = %u ms\n", - __func__, jiffies_to_msecs(timeout), -@@ -271,7 +272,7 @@ void usb_serial_generic_wait_until_sent(struct tty_struct *tty, long timeout) - schedule_timeout_interruptible(period); - if (signal_pending(current)) - break; -- if (time_after(jiffies, expire)) -+ if (timeout && time_after(jiffies, expire)) - break; - } - } -diff --git a/fs/autofs4/dev-ioctl.c b/fs/autofs4/dev-ioctl.c -index 743c7c2c949d..6aa8312ad89f 100644 ---- a/fs/autofs4/dev-ioctl.c -+++ b/fs/autofs4/dev-ioctl.c -@@ -95,7 +95,7 @@ static int check_dev_ioctl_version(int cmd, struct autofs_dev_ioctl *param) - */ - static struct autofs_dev_ioctl *copy_dev_ioctl(struct autofs_dev_ioctl __user *in) - { -- struct autofs_dev_ioctl tmp; -+ struct autofs_dev_ioctl tmp, *res; - - if (copy_from_user(&tmp, in, sizeof(tmp))) - return ERR_PTR(-EFAULT); -@@ -103,7 +103,11 @@ static struct autofs_dev_ioctl *copy_dev_ioctl(struct autofs_dev_ioctl __user *i - if (tmp.size < sizeof(tmp)) - return ERR_PTR(-EINVAL); - -- return memdup_user(in, tmp.size); -+ res = memdup_user(in, tmp.size); -+ if (!IS_ERR(res)) -+ res->size = tmp.size; -+ -+ return res; - } - - static inline void free_dev_ioctl(struct autofs_dev_ioctl *param) -diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c -index 4205ba752d40..caaf30f9f27f 100644 ---- a/fs/btrfs/file.c -+++ b/fs/btrfs/file.c -@@ -1593,22 +1593,10 @@ static ssize_t btrfs_file_aio_write(struct kiocb *iocb, - mutex_unlock(&inode->i_mutex); - - /* -- * we want to make sure fsync finds this change -- * but we haven't joined a transaction running right now. -- * -- * Later on, someone is sure to update the inode and get the -- * real transid recorded. -- * -- * We set last_trans now to the fs_info generation + 1, -- * this will either be one more than the running transaction -- * or the generation used for the next transaction if there isn't -- * one running right now. -- * - * We also have to set last_sub_trans to the current log transid, - * otherwise subsequent syncs to a file that's been synced in this - * transaction will appear to have already occured. - */ -- BTRFS_I(inode)->last_trans = root->fs_info->generation + 1; - BTRFS_I(inode)->last_sub_trans = root->log_transid; - if (num_written > 0 || num_written == -EIOCBQUEUED) { - err = generic_write_sync(file, pos, num_written); -@@ -1706,25 +1694,37 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) - atomic_inc(&root->log_batch); - - /* -- * check the transaction that last modified this inode -- * and see if its already been committed -- */ -- if (!BTRFS_I(inode)->last_trans) { -- mutex_unlock(&inode->i_mutex); -- goto out; -- } -- -- /* -- * if the last transaction that changed this file was before -- * the current transaction, we can bail out now without any -- * syncing -+ * If the last transaction that changed this file was before the current -+ * transaction and we have the full sync flag set in our inode, we can -+ * bail out now without any syncing. -+ * -+ * Note that we can't bail out if the full sync flag isn't set. This is -+ * because when the full sync flag is set we start all ordered extents -+ * and wait for them to fully complete - when they complete they update -+ * the inode's last_trans field through: -+ * -+ * btrfs_finish_ordered_io() -> -+ * btrfs_update_inode_fallback() -> -+ * btrfs_update_inode() -> -+ * btrfs_set_inode_last_trans() -+ * -+ * So we are sure that last_trans is up to date and can do this check to -+ * bail out safely. For the fast path, when the full sync flag is not -+ * set in our inode, we can not do it because we start only our ordered -+ * extents and don't wait for them to complete (that is when -+ * btrfs_finish_ordered_io runs), so here at this point their last_trans -+ * value might be less than or equals to fs_info->last_trans_committed, -+ * and setting a speculative last_trans for an inode when a buffered -+ * write is made (such as fs_info->generation + 1 for example) would not -+ * be reliable since after setting the value and before fsync is called -+ * any number of transactions can start and commit (transaction kthread -+ * commits the current transaction periodically), and a transaction -+ * commit does not start nor waits for ordered extents to complete. - */ - smp_mb(); - if (btrfs_inode_in_log(inode, root->fs_info->generation) || -- BTRFS_I(inode)->last_trans <= -- root->fs_info->last_trans_committed) { -- BTRFS_I(inode)->last_trans = 0; -- -+ (full_sync && BTRFS_I(inode)->last_trans <= -+ root->fs_info->last_trans_committed)) { - /* - * We'v had everything committed since the last time we were - * modified so clear this flag in case it was set for whatever -diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c -index 187911fbabce..d20db6437723 100644 ---- a/fs/btrfs/inode.c -+++ b/fs/btrfs/inode.c -@@ -6825,7 +6825,6 @@ static int btrfs_get_blocks_direct(struct inode *inode, sector_t iblock, - ((BTRFS_I(inode)->flags & BTRFS_INODE_NODATACOW) && - em->block_start != EXTENT_MAP_HOLE)) { - int type; -- int ret; - u64 block_start, orig_start, orig_block_len, ram_bytes; - - if (test_bit(EXTENT_FLAG_PREALLOC, &em->flags)) -diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c -index bca436330681..7d3331cbccba 100644 ---- a/fs/btrfs/tree-log.c -+++ b/fs/btrfs/tree-log.c -@@ -943,7 +943,7 @@ again: - base = btrfs_item_ptr_offset(leaf, path->slots[0]); - - while (cur_offset < item_size) { -- extref = (struct btrfs_inode_extref *)base + cur_offset; -+ extref = (struct btrfs_inode_extref *)(base + cur_offset); - - victim_name_len = btrfs_inode_extref_name_len(leaf, extref); - -diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c -index c7c83ff0f752..7269ec329c01 100644 ---- a/fs/debugfs/inode.c -+++ b/fs/debugfs/inode.c -@@ -245,10 +245,19 @@ static int debugfs_show_options(struct seq_file *m, struct dentry *root) - return 0; - } - -+static void debugfs_evict_inode(struct inode *inode) -+{ -+ truncate_inode_pages(&inode->i_data, 0); -+ clear_inode(inode); -+ if (S_ISLNK(inode->i_mode)) -+ kfree(inode->i_private); -+} -+ - static const struct super_operations debugfs_super_operations = { - .statfs = simple_statfs, - .remount_fs = debugfs_remount, - .show_options = debugfs_show_options, -+ .evict_inode = debugfs_evict_inode, - }; - - static int debug_fill_super(struct super_block *sb, void *data, int silent) -@@ -465,23 +474,14 @@ static int __debugfs_remove(struct dentry *dentry, struct dentry *parent) - int ret = 0; - - if (debugfs_positive(dentry)) { -- if (dentry->d_inode) { -- dget(dentry); -- switch (dentry->d_inode->i_mode & S_IFMT) { -- case S_IFDIR: -- ret = simple_rmdir(parent->d_inode, dentry); -- break; -- case S_IFLNK: -- kfree(dentry->d_inode->i_private); -- /* fall through */ -- default: -- simple_unlink(parent->d_inode, dentry); -- break; -- } -- if (!ret) -- d_delete(dentry); -- dput(dentry); -- } -+ dget(dentry); -+ if (S_ISDIR(dentry->d_inode->i_mode)) -+ ret = simple_rmdir(parent->d_inode, dentry); -+ else -+ simple_unlink(parent->d_inode, dentry); -+ if (!ret) -+ d_delete(dentry); -+ dput(dentry); - } - return ret; - } -diff --git a/fs/nilfs2/btree.c b/fs/nilfs2/btree.c -index b2e3ff347620..ecdbae19a766 100644 ---- a/fs/nilfs2/btree.c -+++ b/fs/nilfs2/btree.c -@@ -31,6 +31,8 @@ - #include "alloc.h" - #include "dat.h" - -+static void __nilfs_btree_init(struct nilfs_bmap *bmap); -+ - static struct nilfs_btree_path *nilfs_btree_alloc_path(void) - { - struct nilfs_btree_path *path; -@@ -368,6 +370,34 @@ static int nilfs_btree_node_broken(const struct nilfs_btree_node *node, - return ret; - } - -+/** -+ * nilfs_btree_root_broken - verify consistency of btree root node -+ * @node: btree root node to be examined -+ * @ino: inode number -+ * -+ * Return Value: If node is broken, 1 is returned. Otherwise, 0 is returned. -+ */ -+static int nilfs_btree_root_broken(const struct nilfs_btree_node *node, -+ unsigned long ino) -+{ -+ int level, flags, nchildren; -+ int ret = 0; -+ -+ level = nilfs_btree_node_get_level(node); -+ flags = nilfs_btree_node_get_flags(node); -+ nchildren = nilfs_btree_node_get_nchildren(node); -+ -+ if (unlikely(level < NILFS_BTREE_LEVEL_NODE_MIN || -+ level > NILFS_BTREE_LEVEL_MAX || -+ nchildren < 0 || -+ nchildren > NILFS_BTREE_ROOT_NCHILDREN_MAX)) { -+ pr_crit("NILFS: bad btree root (inode number=%lu): level = %d, flags = 0x%x, nchildren = %d\n", -+ ino, level, flags, nchildren); -+ ret = 1; -+ } -+ return ret; -+} -+ - int nilfs_btree_broken_node_block(struct buffer_head *bh) - { - int ret; -@@ -1713,7 +1743,7 @@ nilfs_btree_commit_convert_and_insert(struct nilfs_bmap *btree, - - /* convert and insert */ - dat = NILFS_BMAP_USE_VBN(btree) ? nilfs_bmap_get_dat(btree) : NULL; -- nilfs_btree_init(btree); -+ __nilfs_btree_init(btree); - if (nreq != NULL) { - nilfs_bmap_commit_alloc_ptr(btree, dreq, dat); - nilfs_bmap_commit_alloc_ptr(btree, nreq, dat); -@@ -2294,12 +2324,23 @@ static const struct nilfs_bmap_operations nilfs_btree_ops_gc = { - .bop_gather_data = NULL, - }; - --int nilfs_btree_init(struct nilfs_bmap *bmap) -+static void __nilfs_btree_init(struct nilfs_bmap *bmap) - { - bmap->b_ops = &nilfs_btree_ops; - bmap->b_nchildren_per_block = - NILFS_BTREE_NODE_NCHILDREN_MAX(nilfs_btree_node_size(bmap)); -- return 0; -+} -+ -+int nilfs_btree_init(struct nilfs_bmap *bmap) -+{ -+ int ret = 0; -+ -+ __nilfs_btree_init(bmap); -+ -+ if (nilfs_btree_root_broken(nilfs_btree_get_root(bmap), -+ bmap->b_inode->i_ino)) -+ ret = -EIO; -+ return ret; - } - - void nilfs_btree_init_gc(struct nilfs_bmap *bmap) -diff --git a/fs/proc/generic.c b/fs/proc/generic.c -index a2596afffae6..846b1d7852ed 100644 ---- a/fs/proc/generic.c -+++ b/fs/proc/generic.c -@@ -19,7 +19,6 @@ - #include - #include - #include --#include - #include - #include - #include -@@ -163,17 +162,6 @@ void proc_free_inum(unsigned int inum) - spin_unlock_irqrestore(&proc_inum_lock, flags); - } - --static void *proc_follow_link(struct dentry *dentry, struct nameidata *nd) --{ -- nd_set_link(nd, __PDE_DATA(dentry->d_inode)); -- return NULL; --} -- --static const struct inode_operations proc_link_inode_operations = { -- .readlink = generic_readlink, -- .follow_link = proc_follow_link, --}; -- - /* - * As some entries in /proc are volatile, we want to - * get rid of unused dentries. This could be made -diff --git a/fs/proc/inode.c b/fs/proc/inode.c -index 073aea60cf8f..843b8ef04e84 100644 ---- a/fs/proc/inode.c -+++ b/fs/proc/inode.c -@@ -23,6 +23,7 @@ - #include - #include - #include -+#include - - #include - -@@ -373,6 +374,26 @@ static const struct file_operations proc_reg_file_ops_no_compat = { - }; - #endif - -+static void *proc_follow_link(struct dentry *dentry, struct nameidata *nd) -+{ -+ struct proc_dir_entry *pde = PDE(dentry->d_inode); -+ if (unlikely(!use_pde(pde))) -+ return ERR_PTR(-EINVAL); -+ nd_set_link(nd, pde->data); -+ return pde; -+} -+ -+static void proc_put_link(struct dentry *dentry, struct nameidata *nd, void *p) -+{ -+ unuse_pde(p); -+} -+ -+const struct inode_operations proc_link_inode_operations = { -+ .readlink = generic_readlink, -+ .follow_link = proc_follow_link, -+ .put_link = proc_put_link, -+}; -+ - struct inode *proc_get_inode(struct super_block *sb, struct proc_dir_entry *de) - { - struct inode *inode = new_inode_pseudo(sb); -diff --git a/fs/proc/internal.h b/fs/proc/internal.h -index d600fb098b6a..ec335ef62533 100644 ---- a/fs/proc/internal.h -+++ b/fs/proc/internal.h -@@ -202,6 +202,7 @@ struct pde_opener { - int closing; - struct completion *c; - }; -+extern const struct inode_operations proc_link_inode_operations; - - extern const struct inode_operations proc_pid_link_inode_operations; - -diff --git a/kernel/power/qos.c b/kernel/power/qos.c -index 25cf89bc659e..8703fc729fb4 100644 ---- a/kernel/power/qos.c -+++ b/kernel/power/qos.c -@@ -369,12 +369,6 @@ void pm_qos_update_request(struct pm_qos_request *req, - } - - cancel_delayed_work_sync(&req->work); -- -- if (new_value != req->node.prio) -- pm_qos_update_target( -- pm_qos_array[req->pm_qos_class]->constraints, -- &req->node, PM_QOS_UPDATE_REQ, new_value); -- - __pm_qos_update_request(req, new_value); - } - EXPORT_SYMBOL_GPL(pm_qos_update_request); -diff --git a/mm/compaction.c b/mm/compaction.c -index fb797a32362f..eeaaa929d1de 100644 ---- a/mm/compaction.c -+++ b/mm/compaction.c -@@ -881,7 +881,7 @@ static int compact_finished(struct zone *zone, - return COMPACT_PARTIAL; - - /* Job done if allocation would set block type */ -- if (cc->order >= pageblock_order && area->nr_free) -+ if (order >= pageblock_order && area->nr_free) - return COMPACT_PARTIAL; - } - -diff --git a/mm/hugetlb.c b/mm/hugetlb.c -index 7de4f67c81fe..d9bc87ca062b 100644 ---- a/mm/hugetlb.c -+++ b/mm/hugetlb.c -@@ -2451,9 +2451,10 @@ again: - continue; - - /* -- * HWPoisoned hugepage is already unmapped and dropped reference -+ * Migrating hugepage or HWPoisoned hugepage is already -+ * unmapped and its refcount is dropped, so just clear pte here. - */ -- if (unlikely(is_hugetlb_entry_hwpoisoned(pte))) { -+ if (unlikely(!pte_present(pte))) { - huge_pte_clear(mm, address, ptep); - continue; - } -diff --git a/mm/memory.c b/mm/memory.c -index 8b2d75f61b32..04232bb173f0 100644 ---- a/mm/memory.c -+++ b/mm/memory.c -@@ -4088,7 +4088,7 @@ int generic_access_phys(struct vm_area_struct *vma, unsigned long addr, - if (follow_phys(vma, addr, write, &prot, &phys_addr)) - return -EINVAL; - -- maddr = ioremap_prot(phys_addr, PAGE_SIZE, prot); -+ maddr = ioremap_prot(phys_addr, PAGE_ALIGN(len + offset), prot); - if (write) - memcpy_toio(maddr + offset, buf, len); - else -diff --git a/mm/mmap.c b/mm/mmap.c -index 43a7089c6a7c..70ff9b41c970 100644 ---- a/mm/mmap.c -+++ b/mm/mmap.c -@@ -127,7 +127,7 @@ EXPORT_SYMBOL_GPL(vm_memory_committed); - */ - int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin) - { -- unsigned long free, allowed, reserve; -+ long free, allowed, reserve; - - vm_acct_memory(pages); - -@@ -193,7 +193,7 @@ int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin) - */ - if (mm) { - reserve = sysctl_user_reserve_kbytes >> (PAGE_SHIFT - 10); -- allowed -= min(mm->total_vm / 32, reserve); -+ allowed -= min_t(long, mm->total_vm / 32, reserve); - } - - if (percpu_counter_read_positive(&vm_committed_as) < allowed) -diff --git a/mm/nommu.c b/mm/nommu.c -index 298884dcd6e7..d9d07a5d2318 100644 ---- a/mm/nommu.c -+++ b/mm/nommu.c -@@ -1898,7 +1898,7 @@ EXPORT_SYMBOL(unmap_mapping_range); - */ - int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin) - { -- unsigned long free, allowed, reserve; -+ long free, allowed, reserve; - - vm_acct_memory(pages); - -@@ -1963,7 +1963,7 @@ int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin) - */ - if (mm) { - reserve = sysctl_user_reserve_kbytes >> (PAGE_SHIFT - 10); -- allowed -= min(mm->total_vm / 32, reserve); -+ allowed -= min_t(long, mm->total_vm / 32, reserve); - } - - if (percpu_counter_read_positive(&vm_committed_as) < allowed) -diff --git a/net/compat.c b/net/compat.c -index cbc1a2a26587..275af79c131b 100644 ---- a/net/compat.c -+++ b/net/compat.c -@@ -738,24 +738,18 @@ static unsigned char nas[21] = { - - asmlinkage long compat_sys_sendmsg(int fd, struct compat_msghdr __user *msg, unsigned int flags) - { -- if (flags & MSG_CMSG_COMPAT) -- return -EINVAL; - return __sys_sendmsg(fd, (struct msghdr __user *)msg, flags | MSG_CMSG_COMPAT); - } - - asmlinkage long compat_sys_sendmmsg(int fd, struct compat_mmsghdr __user *mmsg, - unsigned int vlen, unsigned int flags) - { -- if (flags & MSG_CMSG_COMPAT) -- return -EINVAL; - return __sys_sendmmsg(fd, (struct mmsghdr __user *)mmsg, vlen, - flags | MSG_CMSG_COMPAT); - } - - asmlinkage long compat_sys_recvmsg(int fd, struct compat_msghdr __user *msg, unsigned int flags) - { -- if (flags & MSG_CMSG_COMPAT) -- return -EINVAL; - return __sys_recvmsg(fd, (struct msghdr __user *)msg, flags | MSG_CMSG_COMPAT); - } - -@@ -778,9 +772,6 @@ asmlinkage long compat_sys_recvmmsg(int fd, struct compat_mmsghdr __user *mmsg, - int datagrams; - struct timespec ktspec; - -- if (flags & MSG_CMSG_COMPAT) -- return -EINVAL; -- - if (timeout == NULL) - return __sys_recvmmsg(fd, (struct mmsghdr __user *)mmsg, vlen, - flags | MSG_CMSG_COMPAT, NULL); -diff --git a/net/core/dev.c b/net/core/dev.c -index c310440309bb..aeca8dd88b2a 100644 ---- a/net/core/dev.c -+++ b/net/core/dev.c -@@ -927,7 +927,7 @@ bool dev_valid_name(const char *name) - return false; - - while (*name) { -- if (*name == '/' || isspace(*name)) -+ if (*name == '/' || *name == ':' || isspace(*name)) - return false; - name++; - } -diff --git a/net/core/gen_stats.c b/net/core/gen_stats.c -index ddedf211e588..b96437b6e82b 100644 ---- a/net/core/gen_stats.c -+++ b/net/core/gen_stats.c -@@ -32,6 +32,9 @@ gnet_stats_copy(struct gnet_dump *d, int type, void *buf, int size) - return 0; - - nla_put_failure: -+ kfree(d->xstats); -+ d->xstats = NULL; -+ d->xstats_len = 0; - spin_unlock_bh(d->lock); - return -1; - } -@@ -205,7 +208,9 @@ int - gnet_stats_copy_app(struct gnet_dump *d, void *st, int len) - { - if (d->compat_xstats) { -- d->xstats = st; -+ d->xstats = kmemdup(st, len, GFP_ATOMIC); -+ if (!d->xstats) -+ goto err_out; - d->xstats_len = len; - } - -@@ -213,6 +218,11 @@ gnet_stats_copy_app(struct gnet_dump *d, void *st, int len) - return gnet_stats_copy(d, TCA_STATS_APP, st, len); - - return 0; -+ -+err_out: -+ d->xstats_len = 0; -+ spin_unlock_bh(d->lock); -+ return -1; - } - EXPORT_SYMBOL(gnet_stats_copy_app); - -@@ -245,6 +255,9 @@ gnet_stats_finish_copy(struct gnet_dump *d) - return -1; - } - -+ kfree(d->xstats); -+ d->xstats = NULL; -+ d->xstats_len = 0; - spin_unlock_bh(d->lock); - return 0; - } -diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c -index 279b5dcf09ae..a67310e00b3f 100644 ---- a/net/core/rtnetlink.c -+++ b/net/core/rtnetlink.c -@@ -1138,14 +1138,10 @@ static const struct nla_policy ifla_vfinfo_policy[IFLA_VF_INFO_MAX+1] = { - }; - - static const struct nla_policy ifla_vf_policy[IFLA_VF_MAX+1] = { -- [IFLA_VF_MAC] = { .type = NLA_BINARY, -- .len = sizeof(struct ifla_vf_mac) }, -- [IFLA_VF_VLAN] = { .type = NLA_BINARY, -- .len = sizeof(struct ifla_vf_vlan) }, -- [IFLA_VF_TX_RATE] = { .type = NLA_BINARY, -- .len = sizeof(struct ifla_vf_tx_rate) }, -- [IFLA_VF_SPOOFCHK] = { .type = NLA_BINARY, -- .len = sizeof(struct ifla_vf_spoofchk) }, -+ [IFLA_VF_MAC] = { .len = sizeof(struct ifla_vf_mac) }, -+ [IFLA_VF_VLAN] = { .len = sizeof(struct ifla_vf_vlan) }, -+ [IFLA_VF_TX_RATE] = { .len = sizeof(struct ifla_vf_tx_rate) }, -+ [IFLA_VF_SPOOFCHK] = { .len = sizeof(struct ifla_vf_spoofchk) }, - }; - - static const struct nla_policy ifla_port_policy[IFLA_PORT_MAX+1] = { -@@ -1855,8 +1851,16 @@ replay: - goto out; - - err = rtnl_configure_link(dev, ifm); -- if (err < 0) -- unregister_netdevice(dev); -+ if (err < 0) { -+ if (ops->newlink) { -+ LIST_HEAD(list_kill); -+ -+ ops->dellink(dev, &list_kill); -+ unregister_netdevice_many(&list_kill); -+ } else { -+ unregister_netdevice(dev); -+ } -+ } - out: - put_net(dest_net); - return err; -diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c -index b66910aaef4d..4c1884fed548 100644 ---- a/net/ipv4/ip_fragment.c -+++ b/net/ipv4/ip_fragment.c -@@ -678,27 +678,30 @@ EXPORT_SYMBOL(ip_defrag); - struct sk_buff *ip_check_defrag(struct sk_buff *skb, u32 user) - { - struct iphdr iph; -+ int netoff; - u32 len; - - if (skb->protocol != htons(ETH_P_IP)) - return skb; - -- if (!skb_copy_bits(skb, 0, &iph, sizeof(iph))) -+ netoff = skb_network_offset(skb); -+ -+ if (skb_copy_bits(skb, netoff, &iph, sizeof(iph)) < 0) - return skb; - - if (iph.ihl < 5 || iph.version != 4) - return skb; - - len = ntohs(iph.tot_len); -- if (skb->len < len || len < (iph.ihl * 4)) -+ if (skb->len < netoff + len || len < (iph.ihl * 4)) - return skb; - - if (ip_is_fragment(&iph)) { - skb = skb_share_check(skb, GFP_ATOMIC); - if (skb) { -- if (!pskb_may_pull(skb, iph.ihl*4)) -+ if (!pskb_may_pull(skb, netoff + iph.ihl * 4)) - return skb; -- if (pskb_trim_rcsum(skb, len)) -+ if (pskb_trim_rcsum(skb, netoff + len)) - return skb; - memset(IPCB(skb), 0, sizeof(struct inet_skb_parm)); - if (ip_defrag(skb, user)) -diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c -index def18547748e..57e745086302 100644 ---- a/net/ipv4/ip_output.c -+++ b/net/ipv4/ip_output.c -@@ -845,7 +845,8 @@ static int __ip_append_data(struct sock *sk, - cork->length += length; - if (((length > mtu) || (skb && skb_has_frags(skb))) && - (sk->sk_protocol == IPPROTO_UDP) && -- (rt->dst.dev->features & NETIF_F_UFO) && !rt->dst.header_len) { -+ (rt->dst.dev->features & NETIF_F_UFO) && !rt->dst.header_len && -+ (sk->sk_type == SOCK_DGRAM)) { - err = ip_ufo_append_data(sk, queue, getfrag, from, length, - hh_len, fragheaderlen, transhdrlen, - maxfraglen, flags); -diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c -index 071edcba4158..1ce7ea1f40b7 100644 ---- a/net/ipv6/ip6_output.c -+++ b/net/ipv6/ip6_output.c -@@ -1286,7 +1286,8 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to, - if (((length > mtu) || - (skb && skb_has_frags(skb))) && - (sk->sk_protocol == IPPROTO_UDP) && -- (rt->dst.dev->features & NETIF_F_UFO)) { -+ (rt->dst.dev->features & NETIF_F_UFO) && -+ (sk->sk_type == SOCK_DGRAM)) { - err = ip6_ufo_append_data(sk, getfrag, from, length, - hh_len, fragheaderlen, - transhdrlen, mtu, flags, rt); -diff --git a/net/ipv6/route.c b/net/ipv6/route.c -index 92274796eb71..d94d224f7e68 100644 ---- a/net/ipv6/route.c -+++ b/net/ipv6/route.c -@@ -109,7 +109,7 @@ static u32 *ipv6_cow_metrics(struct dst_entry *dst, unsigned long old) - u32 *p = NULL; - - if (!(rt->dst.flags & DST_HOST)) -- return NULL; -+ return dst_cow_metrics_generic(dst, old); - - peer = rt6_get_peer_create(rt); - if (peer) { -diff --git a/net/irda/ircomm/ircomm_tty.c b/net/irda/ircomm/ircomm_tty.c -index 41ac7938268b..2ee29ed13bd4 100644 ---- a/net/irda/ircomm/ircomm_tty.c -+++ b/net/irda/ircomm/ircomm_tty.c -@@ -820,7 +820,9 @@ static void ircomm_tty_wait_until_sent(struct tty_struct *tty, int timeout) - orig_jiffies = jiffies; - - /* Set poll time to 200 ms */ -- poll_time = IRDA_MIN(timeout, msecs_to_jiffies(200)); -+ poll_time = msecs_to_jiffies(200); -+ if (timeout) -+ poll_time = min_t(unsigned long, timeout, poll_time); - - spin_lock_irqsave(&self->spinlock, flags); - while (self->tx_skb && self->tx_skb->len) { -diff --git a/net/sched/ematch.c b/net/sched/ematch.c -index 3a633debb6df..a2abc449ce8f 100644 ---- a/net/sched/ematch.c -+++ b/net/sched/ematch.c -@@ -227,6 +227,7 @@ static int tcf_em_validate(struct tcf_proto *tp, - * to replay the request. - */ - module_put(em->ops->owner); -+ em->ops = NULL; - err = -EAGAIN; - } - #endif -diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c -index 80fe5c86efd1..231b71944c52 100644 ---- a/net/sunrpc/cache.c -+++ b/net/sunrpc/cache.c -@@ -930,7 +930,7 @@ static unsigned int cache_poll(struct file *filp, poll_table *wait, - poll_wait(filp, &queue_wait, wait); - - /* alway allow write */ -- mask = POLL_OUT | POLLWRNORM; -+ mask = POLLOUT | POLLWRNORM; - - if (!rp) - return mask; -diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c -index 175dca44c97e..707405cbc5c9 100644 ---- a/sound/core/pcm_native.c -+++ b/sound/core/pcm_native.c -@@ -1404,6 +1404,8 @@ static int snd_pcm_do_drain_init(struct snd_pcm_substream *substream, int state) - if (! snd_pcm_playback_empty(substream)) { - snd_pcm_do_start(substream, SNDRV_PCM_STATE_DRAINING); - snd_pcm_post_start(substream, SNDRV_PCM_STATE_DRAINING); -+ } else { -+ runtime->status->state = SNDRV_PCM_STATE_SETUP; - } - break; - case SNDRV_PCM_STATE_RUNNING: -diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c -index 4ae5767a2cf5..44d3fb95ebba 100644 ---- a/sound/pci/hda/patch_sigmatel.c -+++ b/sound/pci/hda/patch_sigmatel.c -@@ -85,6 +85,7 @@ enum { - STAC_ALIENWARE_M17X, - STAC_92HD89XX_HP_FRONT_JACK, - STAC_92HD89XX_HP_Z1_G2_RIGHT_MIC_JACK, -+ STAC_92HD73XX_ASUS_MOBO, - STAC_92HD73XX_MODELS - }; - -@@ -1915,7 +1916,18 @@ static const struct hda_fixup stac92hd73xx_fixups[] = { - [STAC_92HD89XX_HP_Z1_G2_RIGHT_MIC_JACK] = { - .type = HDA_FIXUP_PINS, - .v.pins = stac92hd89xx_hp_z1_g2_right_mic_jack_pin_configs, -- } -+ }, -+ [STAC_92HD73XX_ASUS_MOBO] = { -+ .type = HDA_FIXUP_PINS, -+ .v.pins = (const struct hda_pintbl[]) { -+ /* enable 5.1 and SPDIF out */ -+ { 0x0c, 0x01014411 }, -+ { 0x0d, 0x01014410 }, -+ { 0x0e, 0x01014412 }, -+ { 0x22, 0x014b1180 }, -+ { } -+ } -+ }, - }; - - static const struct hda_model_fixup stac92hd73xx_models[] = { -@@ -1927,6 +1939,7 @@ static const struct hda_model_fixup stac92hd73xx_models[] = { - { .id = STAC_DELL_M6_BOTH, .name = "dell-m6" }, - { .id = STAC_DELL_EQ, .name = "dell-eq" }, - { .id = STAC_ALIENWARE_M17X, .name = "alienware" }, -+ { .id = STAC_92HD73XX_ASUS_MOBO, .name = "asus-mobo" }, - {} - }; - -@@ -1979,6 +1992,8 @@ static const struct snd_pci_quirk stac92hd73xx_fixup_tbl[] = { - "HP Z1 G2", STAC_92HD89XX_HP_Z1_G2_RIGHT_MIC_JACK), - SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2b17, - "unknown HP", STAC_92HD89XX_HP_FRONT_JACK), -+ SND_PCI_QUIRK(PCI_VENDOR_ID_ASUSTEK, 0x83f8, "ASUS AT4NM10", -+ STAC_92HD73XX_ASUS_MOBO), - {} /* terminator */ - }; - diff --git a/patch/kernel/marvell-default/1-patch-3.10.72-73.patch b/patch/kernel/marvell-default/1-patch-3.10.72-73.patch deleted file mode 100644 index ec1cc88667..0000000000 --- a/patch/kernel/marvell-default/1-patch-3.10.72-73.patch +++ /dev/null @@ -1,1772 +0,0 @@ -diff --git a/Makefile b/Makefile -index 211bb34102bf..b1129094ebfd 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,6 +1,6 @@ - VERSION = 3 - PATCHLEVEL = 10 --SUBLEVEL = 72 -+SUBLEVEL = 73 - EXTRAVERSION = - NAME = TOSSUG Baby Fish - -diff --git a/arch/arm/mach-at91/pm.h b/arch/arm/mach-at91/pm.h -index 2f5908f0b8c5..d8af0755bddc 100644 ---- a/arch/arm/mach-at91/pm.h -+++ b/arch/arm/mach-at91/pm.h -@@ -37,7 +37,7 @@ static inline void at91rm9200_standby(void) - " mcr p15, 0, %0, c7, c0, 4\n\t" - " str %5, [%1, %2]" - : -- : "r" (0), "r" (AT91_BASE_SYS), "r" (AT91RM9200_SDRAMC_LPR), -+ : "r" (0), "r" (at91_ramc_base[0]), "r" (AT91RM9200_SDRAMC_LPR), - "r" (1), "r" (AT91RM9200_SDRAMC_SRR), - "r" (lpr)); - } -diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c -index ee7ac5e6e28a..c5c640779549 100644 ---- a/arch/powerpc/kernel/smp.c -+++ b/arch/powerpc/kernel/smp.c -@@ -544,8 +544,8 @@ int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *tidle) - if (smp_ops->give_timebase) - smp_ops->give_timebase(); - -- /* Wait until cpu puts itself in the online map */ -- while (!cpu_online(cpu)) -+ /* Wait until cpu puts itself in the online & active maps */ -+ while (!cpu_online(cpu) || !cpu_active(cpu)) - cpu_relax(); - - return 0; -diff --git a/arch/sparc/kernel/perf_event.c b/arch/sparc/kernel/perf_event.c -index b5c38faa4ead..d461b7ddf30e 100644 ---- a/arch/sparc/kernel/perf_event.c -+++ b/arch/sparc/kernel/perf_event.c -@@ -960,6 +960,8 @@ out: - cpuc->pcr[0] |= cpuc->event[0]->hw.config_base; - } - -+static void sparc_pmu_start(struct perf_event *event, int flags); -+ - /* On this PMU each PIC has it's own PCR control register. */ - static void calculate_multiple_pcrs(struct cpu_hw_events *cpuc) - { -@@ -972,20 +974,13 @@ static void calculate_multiple_pcrs(struct cpu_hw_events *cpuc) - struct perf_event *cp = cpuc->event[i]; - struct hw_perf_event *hwc = &cp->hw; - int idx = hwc->idx; -- u64 enc; - - if (cpuc->current_idx[i] != PIC_NO_INDEX) - continue; - -- sparc_perf_event_set_period(cp, hwc, idx); - cpuc->current_idx[i] = idx; - -- enc = perf_event_get_enc(cpuc->events[i]); -- cpuc->pcr[idx] &= ~mask_for_index(idx); -- if (hwc->state & PERF_HES_STOPPED) -- cpuc->pcr[idx] |= nop_for_index(idx); -- else -- cpuc->pcr[idx] |= event_encoding(enc, idx); -+ sparc_pmu_start(cp, PERF_EF_RELOAD); - } - out: - for (i = 0; i < cpuc->n_events; i++) { -@@ -1101,7 +1096,6 @@ static void sparc_pmu_del(struct perf_event *event, int _flags) - int i; - - local_irq_save(flags); -- perf_pmu_disable(event->pmu); - - for (i = 0; i < cpuc->n_events; i++) { - if (event == cpuc->event[i]) { -@@ -1127,7 +1121,6 @@ static void sparc_pmu_del(struct perf_event *event, int _flags) - } - } - -- perf_pmu_enable(event->pmu); - local_irq_restore(flags); - } - -@@ -1361,7 +1354,6 @@ static int sparc_pmu_add(struct perf_event *event, int ef_flags) - unsigned long flags; - - local_irq_save(flags); -- perf_pmu_disable(event->pmu); - - n0 = cpuc->n_events; - if (n0 >= sparc_pmu->max_hw_events) -@@ -1394,7 +1386,6 @@ nocheck: - - ret = 0; - out: -- perf_pmu_enable(event->pmu); - local_irq_restore(flags); - return ret; - } -diff --git a/arch/sparc/kernel/process_64.c b/arch/sparc/kernel/process_64.c -index b9cc9763faf4..036e43cef6fb 100644 ---- a/arch/sparc/kernel/process_64.c -+++ b/arch/sparc/kernel/process_64.c -@@ -280,6 +280,8 @@ void arch_trigger_all_cpu_backtrace(void) - printk(" TPC[%lx] O7[%lx] I7[%lx] RPC[%lx]\n", - gp->tpc, gp->o7, gp->i7, gp->rpc); - } -+ -+ touch_nmi_watchdog(); - } - - memset(global_cpu_snapshot, 0, sizeof(global_cpu_snapshot)); -@@ -352,6 +354,8 @@ static void pmu_snapshot_all_cpus(void) - (cpu == this_cpu ? '*' : ' '), cpu, - pp->pcr[0], pp->pcr[1], pp->pcr[2], pp->pcr[3], - pp->pic[0], pp->pic[1], pp->pic[2], pp->pic[3]); -+ -+ touch_nmi_watchdog(); - } - - memset(global_cpu_snapshot, 0, sizeof(global_cpu_snapshot)); -diff --git a/arch/sparc/kernel/sys_sparc_64.c b/arch/sparc/kernel/sys_sparc_64.c -index 2daaaa6eda23..be8db9bb7878 100644 ---- a/arch/sparc/kernel/sys_sparc_64.c -+++ b/arch/sparc/kernel/sys_sparc_64.c -@@ -336,7 +336,7 @@ SYSCALL_DEFINE6(sparc_ipc, unsigned int, call, int, first, unsigned long, second - long err; - - /* No need for backward compatibility. We can start fresh... */ -- if (call <= SEMCTL) { -+ if (call <= SEMTIMEDOP) { - switch (call) { - case SEMOP: - err = sys_semtimedop(first, ptr, -diff --git a/arch/sparc/lib/memmove.S b/arch/sparc/lib/memmove.S -index b7f6334e159f..857ad4f8905f 100644 ---- a/arch/sparc/lib/memmove.S -+++ b/arch/sparc/lib/memmove.S -@@ -8,9 +8,11 @@ - - .text - ENTRY(memmove) /* o0=dst o1=src o2=len */ -- mov %o0, %g1 -+ brz,pn %o2, 99f -+ mov %o0, %g1 -+ - cmp %o0, %o1 -- bleu,pt %xcc, memcpy -+ bleu,pt %xcc, 2f - add %o1, %o2, %g7 - cmp %g7, %o0 - bleu,pt %xcc, memcpy -@@ -24,7 +26,34 @@ ENTRY(memmove) /* o0=dst o1=src o2=len */ - stb %g7, [%o0] - bne,pt %icc, 1b - sub %o0, 1, %o0 -- -+99: - retl - mov %g1, %o0 -+ -+ /* We can't just call memcpy for these memmove cases. On some -+ * chips the memcpy uses cache initializing stores and when dst -+ * and src are close enough, those can clobber the source data -+ * before we've loaded it in. -+ */ -+2: or %o0, %o1, %g7 -+ or %o2, %g7, %g7 -+ andcc %g7, 0x7, %g0 -+ bne,pn %xcc, 4f -+ nop -+ -+3: ldx [%o1], %g7 -+ add %o1, 8, %o1 -+ subcc %o2, 8, %o2 -+ add %o0, 8, %o0 -+ bne,pt %icc, 3b -+ stx %g7, [%o0 - 0x8] -+ ba,a,pt %xcc, 99b -+ -+4: ldub [%o1], %g7 -+ add %o1, 1, %o1 -+ subcc %o2, 1, %o2 -+ add %o0, 1, %o0 -+ bne,pt %icc, 4b -+ stb %g7, [%o0 - 0x1] -+ ba,a,pt %xcc, 99b - ENDPROC(memmove) -diff --git a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c -index 036c2797dece..f58cb540ff94 100644 ---- a/arch/sparc/mm/srmmu.c -+++ b/arch/sparc/mm/srmmu.c -@@ -455,10 +455,12 @@ static void __init sparc_context_init(int numctx) - void switch_mm(struct mm_struct *old_mm, struct mm_struct *mm, - struct task_struct *tsk) - { -+ unsigned long flags; -+ - if (mm->context == NO_CONTEXT) { -- spin_lock(&srmmu_context_spinlock); -+ spin_lock_irqsave(&srmmu_context_spinlock, flags); - alloc_context(old_mm, mm); -- spin_unlock(&srmmu_context_spinlock); -+ spin_unlock_irqrestore(&srmmu_context_spinlock, flags); - srmmu_ctxd_set(&srmmu_context_table[mm->context], mm->pgd); - } - -@@ -983,14 +985,15 @@ int init_new_context(struct task_struct *tsk, struct mm_struct *mm) - - void destroy_context(struct mm_struct *mm) - { -+ unsigned long flags; - - if (mm->context != NO_CONTEXT) { - flush_cache_mm(mm); - srmmu_ctxd_set(&srmmu_context_table[mm->context], srmmu_swapper_pg_dir); - flush_tlb_mm(mm); -- spin_lock(&srmmu_context_spinlock); -+ spin_lock_irqsave(&srmmu_context_spinlock, flags); - free_context(mm->context); -- spin_unlock(&srmmu_context_spinlock); -+ spin_unlock_irqrestore(&srmmu_context_spinlock, flags); - mm->context = NO_CONTEXT; - } - } -diff --git a/arch/x86/crypto/aesni-intel_glue.c b/arch/x86/crypto/aesni-intel_glue.c -index f89e7490d303..990c9699b662 100644 ---- a/arch/x86/crypto/aesni-intel_glue.c -+++ b/arch/x86/crypto/aesni-intel_glue.c -@@ -989,7 +989,7 @@ static int __driver_rfc4106_decrypt(struct aead_request *req) - src = kmalloc(req->cryptlen + req->assoclen, GFP_ATOMIC); - if (!src) - return -ENOMEM; -- assoc = (src + req->cryptlen + auth_tag_len); -+ assoc = (src + req->cryptlen); - scatterwalk_map_and_copy(src, req->src, 0, req->cryptlen, 0); - scatterwalk_map_and_copy(assoc, req->assoc, 0, - req->assoclen, 0); -@@ -1014,7 +1014,7 @@ static int __driver_rfc4106_decrypt(struct aead_request *req) - scatterwalk_done(&src_sg_walk, 0, 0); - scatterwalk_done(&assoc_sg_walk, 0, 0); - } else { -- scatterwalk_map_and_copy(dst, req->dst, 0, req->cryptlen, 1); -+ scatterwalk_map_and_copy(dst, req->dst, 0, tempCipherLen, 1); - kfree(src); - } - return retval; -diff --git a/arch/x86/include/asm/fpu-internal.h b/arch/x86/include/asm/fpu-internal.h -index e72b2e41499e..1b2fc5cf1963 100644 ---- a/arch/x86/include/asm/fpu-internal.h -+++ b/arch/x86/include/asm/fpu-internal.h -@@ -370,7 +370,7 @@ static inline void drop_fpu(struct task_struct *tsk) - preempt_disable(); - tsk->fpu_counter = 0; - __drop_fpu(tsk); -- clear_used_math(); -+ clear_stopped_child_used_math(tsk); - preempt_enable(); - } - -diff --git a/arch/x86/kernel/xsave.c b/arch/x86/kernel/xsave.c -index 1ee723298e90..92f37e7683c5 100644 ---- a/arch/x86/kernel/xsave.c -+++ b/arch/x86/kernel/xsave.c -@@ -376,7 +376,7 @@ int __restore_xstate_sig(void __user *buf, void __user *buf_fx, int size) - * thread's fpu state, reconstruct fxstate from the fsave - * header. Sanitize the copied state etc. - */ -- struct xsave_struct *xsave = &tsk->thread.fpu.state->xsave; -+ struct fpu *fpu = &tsk->thread.fpu; - struct user_i387_ia32_struct env; - int err = 0; - -@@ -390,14 +390,15 @@ int __restore_xstate_sig(void __user *buf, void __user *buf_fx, int size) - */ - drop_fpu(tsk); - -- if (__copy_from_user(xsave, buf_fx, state_size) || -+ if (__copy_from_user(&fpu->state->xsave, buf_fx, state_size) || - __copy_from_user(&env, buf, sizeof(env))) { -+ fpu_finit(fpu); - err = -1; - } else { - sanitize_restored_xstate(tsk, &env, xstate_bv, fx_only); -- set_used_math(); - } - -+ set_used_math(); - if (use_eager_fpu()) { - preempt_disable(); - math_state_restore(); -diff --git a/arch/x86/vdso/vdso32/sigreturn.S b/arch/x86/vdso/vdso32/sigreturn.S -index 31776d0efc8c..d7ec4e251c0a 100644 ---- a/arch/x86/vdso/vdso32/sigreturn.S -+++ b/arch/x86/vdso/vdso32/sigreturn.S -@@ -17,6 +17,7 @@ - .text - .globl __kernel_sigreturn - .type __kernel_sigreturn,@function -+ nop /* this guy is needed for .LSTARTFDEDLSI1 below (watch for HACK) */ - ALIGN - __kernel_sigreturn: - .LSTART_sigreturn: -diff --git a/drivers/char/tpm/tpm_ibmvtpm.c b/drivers/char/tpm/tpm_ibmvtpm.c -index 538856f3e68a..09df26f9621d 100644 ---- a/drivers/char/tpm/tpm_ibmvtpm.c -+++ b/drivers/char/tpm/tpm_ibmvtpm.c -@@ -124,7 +124,7 @@ static int tpm_ibmvtpm_send(struct tpm_chip *chip, u8 *buf, size_t count) - { - struct ibmvtpm_dev *ibmvtpm; - struct ibmvtpm_crq crq; -- u64 *word = (u64 *) &crq; -+ __be64 *word = (__be64 *)&crq; - int rc; - - ibmvtpm = (struct ibmvtpm_dev *)TPM_VPRIV(chip); -@@ -145,11 +145,11 @@ static int tpm_ibmvtpm_send(struct tpm_chip *chip, u8 *buf, size_t count) - memcpy((void *)ibmvtpm->rtce_buf, (void *)buf, count); - crq.valid = (u8)IBMVTPM_VALID_CMD; - crq.msg = (u8)VTPM_TPM_COMMAND; -- crq.len = (u16)count; -- crq.data = ibmvtpm->rtce_dma_handle; -+ crq.len = cpu_to_be16(count); -+ crq.data = cpu_to_be32(ibmvtpm->rtce_dma_handle); - -- rc = ibmvtpm_send_crq(ibmvtpm->vdev, cpu_to_be64(word[0]), -- cpu_to_be64(word[1])); -+ rc = ibmvtpm_send_crq(ibmvtpm->vdev, be64_to_cpu(word[0]), -+ be64_to_cpu(word[1])); - if (rc != H_SUCCESS) { - dev_err(ibmvtpm->dev, "tpm_ibmvtpm_send failed rc=%d\n", rc); - rc = 0; -diff --git a/drivers/char/tpm/tpm_ibmvtpm.h b/drivers/char/tpm/tpm_ibmvtpm.h -index bd82a791f995..b2c231b1beec 100644 ---- a/drivers/char/tpm/tpm_ibmvtpm.h -+++ b/drivers/char/tpm/tpm_ibmvtpm.h -@@ -22,9 +22,9 @@ - struct ibmvtpm_crq { - u8 valid; - u8 msg; -- u16 len; -- u32 data; -- u64 reserved; -+ __be16 len; -+ __be32 data; -+ __be64 reserved; - } __attribute__((packed, aligned(8))); - - struct ibmvtpm_crq_queue { -diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c -index fc45567ad3ac..ec3bd62eeaf6 100644 ---- a/drivers/char/virtio_console.c -+++ b/drivers/char/virtio_console.c -@@ -2023,12 +2023,13 @@ static int virtcons_probe(struct virtio_device *vdev) - spin_lock_init(&portdev->ports_lock); - INIT_LIST_HEAD(&portdev->ports); - -+ INIT_WORK(&portdev->control_work, &control_work_handler); -+ - if (multiport) { - unsigned int nr_added_bufs; - - spin_lock_init(&portdev->c_ivq_lock); - spin_lock_init(&portdev->c_ovq_lock); -- INIT_WORK(&portdev->control_work, &control_work_handler); - - nr_added_bufs = fill_queue(portdev->c_ivq, - &portdev->c_ivq_lock); -diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c -index ead08a49bec0..59ea6547306b 100644 ---- a/drivers/gpu/drm/radeon/evergreen.c -+++ b/drivers/gpu/drm/radeon/evergreen.c -@@ -4016,6 +4016,9 @@ int evergreen_irq_set(struct radeon_device *rdev) - WREG32(AFMT_AUDIO_PACKET_CONTROL + EVERGREEN_CRTC4_REGISTER_OFFSET, afmt5); - WREG32(AFMT_AUDIO_PACKET_CONTROL + EVERGREEN_CRTC5_REGISTER_OFFSET, afmt6); - -+ /* posting read */ -+ RREG32(SRBM_STATUS); -+ - return 0; - } - -diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c -index 46470dd7c710..f9f0e3680d76 100644 ---- a/drivers/gpu/drm/radeon/r100.c -+++ b/drivers/gpu/drm/radeon/r100.c -@@ -743,6 +743,10 @@ int r100_irq_set(struct radeon_device *rdev) - tmp |= RADEON_FP2_DETECT_MASK; - } - WREG32(RADEON_GEN_INT_CNTL, tmp); -+ -+ /* read back to post the write */ -+ RREG32(RADEON_GEN_INT_CNTL); -+ - return 0; - } - -diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c -index 4cf21ec1abe3..90b007594e32 100644 ---- a/drivers/gpu/drm/radeon/r600.c -+++ b/drivers/gpu/drm/radeon/r600.c -@@ -3459,6 +3459,9 @@ int r600_init(struct radeon_device *rdev) - rdev->accel_working = false; - } - -+ /* posting read */ -+ RREG32(R_000E50_SRBM_STATUS); -+ - return 0; - } - -diff --git a/drivers/gpu/drm/radeon/radeon_cs.c b/drivers/gpu/drm/radeon/radeon_cs.c -index 60af3cda587b..6627585da1e5 100644 ---- a/drivers/gpu/drm/radeon/radeon_cs.c -+++ b/drivers/gpu/drm/radeon/radeon_cs.c -@@ -177,11 +177,13 @@ int radeon_cs_parser_init(struct radeon_cs_parser *p, void *data) - u32 ring = RADEON_CS_RING_GFX; - s32 priority = 0; - -+ INIT_LIST_HEAD(&p->validated); -+ - if (!cs->num_chunks) { - return 0; - } -+ - /* get chunks */ -- INIT_LIST_HEAD(&p->validated); - p->idx = 0; - p->ib.sa_bo = NULL; - p->ib.semaphore = NULL; -diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c -index ae813fef0818..971d55f73e0c 100644 ---- a/drivers/gpu/drm/radeon/rs600.c -+++ b/drivers/gpu/drm/radeon/rs600.c -@@ -636,6 +636,10 @@ int rs600_irq_set(struct radeon_device *rdev) - WREG32(R_007D18_DC_HOT_PLUG_DETECT2_INT_CONTROL, hpd2); - if (ASIC_IS_DCE2(rdev)) - WREG32(R_007408_HDMI0_AUDIO_PACKET_CONTROL, hdmi0); -+ -+ /* posting read */ -+ RREG32(R_000040_GEN_INT_CNTL); -+ - return 0; - } - -diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c -index 03add5d5542e..2410c38ff037 100644 ---- a/drivers/gpu/drm/radeon/si.c -+++ b/drivers/gpu/drm/radeon/si.c -@@ -5704,8 +5704,7 @@ int si_set_uvd_clocks(struct radeon_device *rdev, u32 vclk, u32 dclk) - WREG32_P(CG_UPLL_FUNC_CNTL, UPLL_BYPASS_EN_MASK, ~UPLL_BYPASS_EN_MASK); - - if (!vclk || !dclk) { -- /* keep the Bypass mode, put PLL to sleep */ -- WREG32_P(CG_UPLL_FUNC_CNTL, UPLL_SLEEP_MASK, ~UPLL_SLEEP_MASK); -+ /* keep the Bypass mode */ - return 0; - } - -@@ -5721,8 +5720,7 @@ int si_set_uvd_clocks(struct radeon_device *rdev, u32 vclk, u32 dclk) - /* set VCO_MODE to 1 */ - WREG32_P(CG_UPLL_FUNC_CNTL, UPLL_VCO_MODE_MASK, ~UPLL_VCO_MODE_MASK); - -- /* toggle UPLL_SLEEP to 1 then back to 0 */ -- WREG32_P(CG_UPLL_FUNC_CNTL, UPLL_SLEEP_MASK, ~UPLL_SLEEP_MASK); -+ /* disable sleep mode */ - WREG32_P(CG_UPLL_FUNC_CNTL, 0, ~UPLL_SLEEP_MASK); - - /* deassert UPLL_RESET */ -@@ -5778,5 +5776,8 @@ int si_set_uvd_clocks(struct radeon_device *rdev, u32 vclk, u32 dclk) - - mdelay(100); - -+ /* posting read */ -+ RREG32(SRBM_STATUS); -+ - return 0; - } -diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c -index a4694aa20a3e..f66aeb79abdf 100644 ---- a/drivers/net/can/dev.c -+++ b/drivers/net/can/dev.c -@@ -503,6 +503,14 @@ struct sk_buff *alloc_can_skb(struct net_device *dev, struct can_frame **cf) - skb->pkt_type = PACKET_BROADCAST; - skb->ip_summed = CHECKSUM_UNNECESSARY; - -+ skb_reset_mac_header(skb); -+ skb_reset_network_header(skb); -+ skb_reset_transport_header(skb); -+ -+ skb_reset_mac_header(skb); -+ skb_reset_network_header(skb); -+ skb_reset_transport_header(skb); -+ - can_skb_reserve(skb); - can_skb_prv(skb)->ifindex = dev->ifindex; - -diff --git a/drivers/net/usb/cx82310_eth.c b/drivers/net/usb/cx82310_eth.c -index 1e207f086b75..49ab45e17fe8 100644 ---- a/drivers/net/usb/cx82310_eth.c -+++ b/drivers/net/usb/cx82310_eth.c -@@ -302,9 +302,18 @@ static const struct driver_info cx82310_info = { - .tx_fixup = cx82310_tx_fixup, - }; - -+#define USB_DEVICE_CLASS(vend, prod, cl, sc, pr) \ -+ .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \ -+ USB_DEVICE_ID_MATCH_DEV_INFO, \ -+ .idVendor = (vend), \ -+ .idProduct = (prod), \ -+ .bDeviceClass = (cl), \ -+ .bDeviceSubClass = (sc), \ -+ .bDeviceProtocol = (pr) -+ - static const struct usb_device_id products[] = { - { -- USB_DEVICE_AND_INTERFACE_INFO(0x0572, 0xcb01, 0xff, 0, 0), -+ USB_DEVICE_CLASS(0x0572, 0xcb01, 0xff, 0, 0), - .driver_info = (unsigned long) &cx82310_info - }, - { }, -diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c -index e873e8f0070d..283212aa103c 100644 ---- a/drivers/regulator/core.c -+++ b/drivers/regulator/core.c -@@ -1596,10 +1596,12 @@ static int _regulator_do_enable(struct regulator_dev *rdev) - trace_regulator_enable(rdev_get_name(rdev)); - - if (rdev->ena_pin) { -- ret = regulator_ena_gpio_ctrl(rdev, true); -- if (ret < 0) -- return ret; -- rdev->ena_gpio_state = 1; -+ if (!rdev->ena_gpio_state) { -+ ret = regulator_ena_gpio_ctrl(rdev, true); -+ if (ret < 0) -+ return ret; -+ rdev->ena_gpio_state = 1; -+ } - } else if (rdev->desc->ops->enable) { - ret = rdev->desc->ops->enable(rdev); - if (ret < 0) -@@ -1701,10 +1703,12 @@ static int _regulator_do_disable(struct regulator_dev *rdev) - trace_regulator_disable(rdev_get_name(rdev)); - - if (rdev->ena_pin) { -- ret = regulator_ena_gpio_ctrl(rdev, false); -- if (ret < 0) -- return ret; -- rdev->ena_gpio_state = 0; -+ if (rdev->ena_gpio_state) { -+ ret = regulator_ena_gpio_ctrl(rdev, false); -+ if (ret < 0) -+ return ret; -+ rdev->ena_gpio_state = 0; -+ } - - } else if (rdev->desc->ops->disable) { - ret = rdev->desc->ops->disable(rdev); -@@ -3614,12 +3618,6 @@ regulator_register(const struct regulator_desc *regulator_desc, - config->ena_gpio, ret); - goto wash; - } -- -- if (config->ena_gpio_flags & GPIOF_OUT_INIT_HIGH) -- rdev->ena_gpio_state = 1; -- -- if (config->ena_gpio_invert) -- rdev->ena_gpio_state = !rdev->ena_gpio_state; - } - - /* set regulator constraints */ -@@ -3788,9 +3786,11 @@ int regulator_suspend_finish(void) - list_for_each_entry(rdev, ®ulator_list, list) { - mutex_lock(&rdev->mutex); - if (rdev->use_count > 0 || rdev->constraints->always_on) { -- error = _regulator_do_enable(rdev); -- if (error) -- ret = error; -+ if (!_regulator_is_enabled(rdev)) { -+ error = _regulator_do_enable(rdev); -+ if (error) -+ ret = error; -+ } - } else { - if (!has_full_constraints) - goto unlock; -diff --git a/drivers/scsi/libsas/sas_discover.c b/drivers/scsi/libsas/sas_discover.c -index 62b58d38ce2e..60de66252fa2 100644 ---- a/drivers/scsi/libsas/sas_discover.c -+++ b/drivers/scsi/libsas/sas_discover.c -@@ -500,6 +500,7 @@ static void sas_revalidate_domain(struct work_struct *work) - struct sas_discovery_event *ev = to_sas_discovery_event(work); - struct asd_sas_port *port = ev->port; - struct sas_ha_struct *ha = port->ha; -+ struct domain_device *ddev = port->port_dev; - - /* prevent revalidation from finding sata links in recovery */ - mutex_lock(&ha->disco_mutex); -@@ -514,8 +515,9 @@ static void sas_revalidate_domain(struct work_struct *work) - SAS_DPRINTK("REVALIDATING DOMAIN on port %d, pid:%d\n", port->id, - task_pid_nr(current)); - -- if (port->port_dev) -- res = sas_ex_revalidate_domain(port->port_dev); -+ if (ddev && (ddev->dev_type == SAS_FANOUT_EXPANDER_DEVICE || -+ ddev->dev_type == SAS_EDGE_EXPANDER_DEVICE)) -+ res = sas_ex_revalidate_domain(ddev); - - SAS_DPRINTK("done REVALIDATING DOMAIN on port %d, pid:%d, res 0x%x\n", - port->id, task_pid_nr(current), res); -diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c -index 5266c89fc989..a6f0878d9bf1 100644 ---- a/drivers/spi/spi-pl022.c -+++ b/drivers/spi/spi-pl022.c -@@ -508,12 +508,12 @@ static void giveback(struct pl022 *pl022) - pl022->cur_msg = NULL; - pl022->cur_transfer = NULL; - pl022->cur_chip = NULL; -- spi_finalize_current_message(pl022->master); - - /* disable the SPI/SSP operation */ - writew((readw(SSP_CR1(pl022->virtbase)) & - (~SSP_CR1_MASK_SSE)), SSP_CR1(pl022->virtbase)); - -+ spi_finalize_current_message(pl022->master); - } - - /** -diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c -index 651b5768862f..9559ea749d83 100644 ---- a/drivers/target/iscsi/iscsi_target.c -+++ b/drivers/target/iscsi/iscsi_target.c -@@ -4136,11 +4136,17 @@ int iscsit_close_connection( - pr_debug("Closing iSCSI connection CID %hu on SID:" - " %u\n", conn->cid, sess->sid); - /* -- * Always up conn_logout_comp just in case the RX Thread is sleeping -- * and the logout response never got sent because the connection -- * failed. -+ * Always up conn_logout_comp for the traditional TCP case just in case -+ * the RX Thread in iscsi_target_rx_opcode() is sleeping and the logout -+ * response never got sent because the connection failed. -+ * -+ * However for iser-target, isert_wait4logout() is using conn_logout_comp -+ * to signal logout response TX interrupt completion. Go ahead and skip -+ * this for iser since isert_rx_opcode() does not wait on logout failure, -+ * and to avoid iscsi_conn pointer dereference in iser-target code. - */ -- complete(&conn->conn_logout_comp); -+ if (conn->conn_transport->transport_type == ISCSI_TCP) -+ complete(&conn->conn_logout_comp); - - iscsi_release_thread_set(conn); - -diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c -index 27ec6e4d1c7c..7f85f4a6d73a 100644 ---- a/drivers/target/target_core_pr.c -+++ b/drivers/target/target_core_pr.c -@@ -518,6 +518,18 @@ static int core_scsi3_pr_seq_non_holder( - - return 0; - } -+ } else if (we && registered_nexus) { -+ /* -+ * Reads are allowed for Write Exclusive locks -+ * from all registrants. -+ */ -+ if (cmd->data_direction == DMA_FROM_DEVICE) { -+ pr_debug("Allowing READ CDB: 0x%02x for %s" -+ " reservation\n", cdb[0], -+ core_scsi3_pr_dump_type(pr_reg_type)); -+ -+ return 0; -+ } - } - pr_debug("%s Conflict for %sregistered nexus %s CDB: 0x%2x" - " for %s reservation\n", transport_dump_cmd_direction(cmd), -@@ -2397,6 +2409,7 @@ core_scsi3_pro_reserve(struct se_cmd *cmd, int type, int scope, u64 res_key) - spin_lock(&dev->dev_reservation_lock); - pr_res_holder = dev->dev_pr_res_holder; - if (pr_res_holder) { -+ int pr_res_type = pr_res_holder->pr_res_type; - /* - * From spc4r17 Section 5.7.9: Reserving: - * -@@ -2407,7 +2420,9 @@ core_scsi3_pro_reserve(struct se_cmd *cmd, int type, int scope, u64 res_key) - * the logical unit, then the command shall be completed with - * RESERVATION CONFLICT status. - */ -- if (pr_res_holder != pr_reg) { -+ if ((pr_res_holder != pr_reg) && -+ (pr_res_type != PR_TYPE_WRITE_EXCLUSIVE_ALLREG) && -+ (pr_res_type != PR_TYPE_EXCLUSIVE_ACCESS_ALLREG)) { - struct se_node_acl *pr_res_nacl = pr_res_holder->pr_reg_nacl; - pr_err("SPC-3 PR: Attempted RESERVE from" - " [%s]: %s while reservation already held by" -@@ -4012,7 +4027,8 @@ core_scsi3_pri_read_full_status(struct se_cmd *cmd) - unsigned char *buf; - u32 add_desc_len = 0, add_len = 0, desc_len, exp_desc_len; - u32 off = 8; /* off into first Full Status descriptor */ -- int format_code = 0; -+ int format_code = 0, pr_res_type = 0, pr_res_scope = 0; -+ bool all_reg = false; - - if (cmd->data_length < 8) { - pr_err("PRIN SA READ_FULL_STATUS SCSI Data Length: %u" -@@ -4029,6 +4045,19 @@ core_scsi3_pri_read_full_status(struct se_cmd *cmd) - buf[2] = ((dev->t10_pr.pr_generation >> 8) & 0xff); - buf[3] = (dev->t10_pr.pr_generation & 0xff); - -+ spin_lock(&dev->dev_reservation_lock); -+ if (dev->dev_pr_res_holder) { -+ struct t10_pr_registration *pr_holder = dev->dev_pr_res_holder; -+ -+ if (pr_holder->pr_res_type == PR_TYPE_WRITE_EXCLUSIVE_ALLREG || -+ pr_holder->pr_res_type == PR_TYPE_EXCLUSIVE_ACCESS_ALLREG) { -+ all_reg = true; -+ pr_res_type = pr_holder->pr_res_type; -+ pr_res_scope = pr_holder->pr_res_scope; -+ } -+ } -+ spin_unlock(&dev->dev_reservation_lock); -+ - spin_lock(&pr_tmpl->registration_lock); - list_for_each_entry_safe(pr_reg, pr_reg_tmp, - &pr_tmpl->registration_list, pr_reg_list) { -@@ -4078,14 +4107,20 @@ core_scsi3_pri_read_full_status(struct se_cmd *cmd) - * reservation holder for PR_HOLDER bit. - * - * Also, if this registration is the reservation -- * holder, fill in SCOPE and TYPE in the next byte. -+ * holder or there is an All Registrants reservation -+ * active, fill in SCOPE and TYPE in the next byte. - */ - if (pr_reg->pr_res_holder) { - buf[off++] |= 0x01; - buf[off++] = (pr_reg->pr_res_scope & 0xf0) | - (pr_reg->pr_res_type & 0x0f); -- } else -+ } else if (all_reg) { -+ buf[off++] |= 0x01; -+ buf[off++] = (pr_res_scope & 0xf0) | -+ (pr_res_type & 0x0f); -+ } else { - off += 2; -+ } - - off += 4; /* Skip over reserved area */ - /* -diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c -index 3250ba2594e0..b1e77ff9a636 100644 ---- a/drivers/target/target_core_pscsi.c -+++ b/drivers/target/target_core_pscsi.c -@@ -1112,7 +1112,7 @@ static u32 pscsi_get_device_type(struct se_device *dev) - struct pscsi_dev_virt *pdv = PSCSI_DEV(dev); - struct scsi_device *sd = pdv->pdv_sd; - -- return sd->type; -+ return (sd) ? sd->type : TYPE_NO_LUN; - } - - static sector_t pscsi_get_blocks(struct se_device *dev) -diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c -index dcc5daa0ff1c..daf0f6357bb3 100644 ---- a/drivers/target/target_core_transport.c -+++ b/drivers/target/target_core_transport.c -@@ -2222,6 +2222,10 @@ int target_get_sess_cmd(struct se_session *se_sess, struct se_cmd *se_cmd, - - out: - spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags); -+ -+ if (ret && ack_kref) -+ target_put_sess_cmd(se_sess, se_cmd); -+ - return ret; - } - EXPORT_SYMBOL(target_get_sess_cmd); -diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c -index 8d3c0b5e2878..98b8423793fd 100644 ---- a/drivers/tty/serial/8250/8250_pci.c -+++ b/drivers/tty/serial/8250/8250_pci.c -@@ -68,7 +68,7 @@ static void moan_device(const char *str, struct pci_dev *dev) - "Please send the output of lspci -vv, this\n" - "message (0x%04x,0x%04x,0x%04x,0x%04x), the\n" - "manufacturer and name of serial board or\n" -- "modem board to rmk+serial@arm.linux.org.uk.\n", -+ "modem board to .\n", - pci_name(dev), str, dev->vendor, dev->device, - dev->subsystem_vendor, dev->subsystem_device); - } -diff --git a/drivers/xen/xen-pciback/conf_space.c b/drivers/xen/xen-pciback/conf_space.c -index 46ae0f9f02ad..75fe3d466515 100644 ---- a/drivers/xen/xen-pciback/conf_space.c -+++ b/drivers/xen/xen-pciback/conf_space.c -@@ -16,7 +16,7 @@ - #include "conf_space.h" - #include "conf_space_quirks.h" - --static bool permissive; -+bool permissive; - module_param(permissive, bool, 0644); - - /* This is where xen_pcibk_read_config_byte, xen_pcibk_read_config_word, -diff --git a/drivers/xen/xen-pciback/conf_space.h b/drivers/xen/xen-pciback/conf_space.h -index e56c934ad137..2e1d73d1d5d0 100644 ---- a/drivers/xen/xen-pciback/conf_space.h -+++ b/drivers/xen/xen-pciback/conf_space.h -@@ -64,6 +64,8 @@ struct config_field_entry { - void *data; - }; - -+extern bool permissive; -+ - #define OFFSET(cfg_entry) ((cfg_entry)->base_offset+(cfg_entry)->field->offset) - - /* Add fields to a device - the add_fields macro expects to get a pointer to -diff --git a/drivers/xen/xen-pciback/conf_space_header.c b/drivers/xen/xen-pciback/conf_space_header.c -index 3daf862d739d..a5bb81a600f7 100644 ---- a/drivers/xen/xen-pciback/conf_space_header.c -+++ b/drivers/xen/xen-pciback/conf_space_header.c -@@ -9,6 +9,10 @@ - #include "pciback.h" - #include "conf_space.h" - -+struct pci_cmd_info { -+ u16 val; -+}; -+ - struct pci_bar_info { - u32 val; - u32 len_val; -@@ -18,22 +22,36 @@ struct pci_bar_info { - #define is_enable_cmd(value) ((value)&(PCI_COMMAND_MEMORY|PCI_COMMAND_IO)) - #define is_master_cmd(value) ((value)&PCI_COMMAND_MASTER) - --static int command_read(struct pci_dev *dev, int offset, u16 *value, void *data) -+/* Bits guests are allowed to control in permissive mode. */ -+#define PCI_COMMAND_GUEST (PCI_COMMAND_MASTER|PCI_COMMAND_SPECIAL| \ -+ PCI_COMMAND_INVALIDATE|PCI_COMMAND_VGA_PALETTE| \ -+ PCI_COMMAND_WAIT|PCI_COMMAND_FAST_BACK) -+ -+static void *command_init(struct pci_dev *dev, int offset) - { -- int i; -- int ret; -- -- ret = xen_pcibk_read_config_word(dev, offset, value, data); -- if (!pci_is_enabled(dev)) -- return ret; -- -- for (i = 0; i < PCI_ROM_RESOURCE; i++) { -- if (dev->resource[i].flags & IORESOURCE_IO) -- *value |= PCI_COMMAND_IO; -- if (dev->resource[i].flags & IORESOURCE_MEM) -- *value |= PCI_COMMAND_MEMORY; -+ struct pci_cmd_info *cmd = kmalloc(sizeof(*cmd), GFP_KERNEL); -+ int err; -+ -+ if (!cmd) -+ return ERR_PTR(-ENOMEM); -+ -+ err = pci_read_config_word(dev, PCI_COMMAND, &cmd->val); -+ if (err) { -+ kfree(cmd); -+ return ERR_PTR(err); - } - -+ return cmd; -+} -+ -+static int command_read(struct pci_dev *dev, int offset, u16 *value, void *data) -+{ -+ int ret = pci_read_config_word(dev, offset, value); -+ const struct pci_cmd_info *cmd = data; -+ -+ *value &= PCI_COMMAND_GUEST; -+ *value |= cmd->val & ~PCI_COMMAND_GUEST; -+ - return ret; - } - -@@ -41,6 +59,8 @@ static int command_write(struct pci_dev *dev, int offset, u16 value, void *data) - { - struct xen_pcibk_dev_data *dev_data; - int err; -+ u16 val; -+ struct pci_cmd_info *cmd = data; - - dev_data = pci_get_drvdata(dev); - if (!pci_is_enabled(dev) && is_enable_cmd(value)) { -@@ -83,6 +103,19 @@ static int command_write(struct pci_dev *dev, int offset, u16 value, void *data) - } - } - -+ cmd->val = value; -+ -+ if (!permissive && (!dev_data || !dev_data->permissive)) -+ return 0; -+ -+ /* Only allow the guest to control certain bits. */ -+ err = pci_read_config_word(dev, offset, &val); -+ if (err || val == value) -+ return err; -+ -+ value &= PCI_COMMAND_GUEST; -+ value |= val & ~PCI_COMMAND_GUEST; -+ - return pci_write_config_word(dev, offset, value); - } - -@@ -282,6 +315,8 @@ static const struct config_field header_common[] = { - { - .offset = PCI_COMMAND, - .size = 2, -+ .init = command_init, -+ .release = bar_release, - .u.w.read = command_read, - .u.w.write = command_write, - }, -diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c -index 23bf1a52a5da..b535008b6c4c 100644 ---- a/fs/fuse/dev.c -+++ b/fs/fuse/dev.c -@@ -819,8 +819,8 @@ static int fuse_try_move_page(struct fuse_copy_state *cs, struct page **pagep) - - newpage = buf->page; - -- if (WARN_ON(!PageUptodate(newpage))) -- return -EIO; -+ if (!PageUptodate(newpage)) -+ SetPageUptodate(newpage); - - ClearPageMappedToDisk(newpage); - -@@ -1725,6 +1725,9 @@ copy_finish: - static int fuse_notify(struct fuse_conn *fc, enum fuse_notify_code code, - unsigned int size, struct fuse_copy_state *cs) - { -+ /* Don't try to move pages (yet) */ -+ cs->move_pages = 0; -+ - switch (code) { - case FUSE_NOTIFY_POLL: - return fuse_notify_poll(fc, size, cs); -diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c -index b3c95c1a4700..99294a286e66 100644 ---- a/fs/nilfs2/segment.c -+++ b/fs/nilfs2/segment.c -@@ -1906,6 +1906,7 @@ static void nilfs_segctor_drop_written_files(struct nilfs_sc_info *sci, - struct the_nilfs *nilfs) - { - struct nilfs_inode_info *ii, *n; -+ int during_mount = !(sci->sc_super->s_flags & MS_ACTIVE); - int defer_iput = false; - - spin_lock(&nilfs->ns_inode_lock); -@@ -1918,10 +1919,10 @@ static void nilfs_segctor_drop_written_files(struct nilfs_sc_info *sci, - brelse(ii->i_bh); - ii->i_bh = NULL; - list_del_init(&ii->i_dirty); -- if (!ii->vfs_inode.i_nlink) { -+ if (!ii->vfs_inode.i_nlink || during_mount) { - /* -- * Defer calling iput() to avoid a deadlock -- * over I_SYNC flag for inodes with i_nlink == 0 -+ * Defer calling iput() to avoid deadlocks if -+ * i_nlink == 0 or mount is not yet finished. - */ - list_add_tail(&ii->i_dirty, &sci->sc_iput_queue); - defer_iput = true; -diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h -index ff28cf578d01..120dd354849d 100644 ---- a/include/linux/workqueue.h -+++ b/include/linux/workqueue.h -@@ -71,7 +71,8 @@ enum { - /* data contains off-queue information when !WORK_STRUCT_PWQ */ - WORK_OFFQ_FLAG_BASE = WORK_STRUCT_COLOR_SHIFT, - -- WORK_OFFQ_CANCELING = (1 << WORK_OFFQ_FLAG_BASE), -+ __WORK_OFFQ_CANCELING = WORK_OFFQ_FLAG_BASE, -+ WORK_OFFQ_CANCELING = (1 << __WORK_OFFQ_CANCELING), - - /* - * When a work item is off queue, its high bits point to the last -diff --git a/kernel/workqueue.c b/kernel/workqueue.c -index 16730a9c8cac..fe7c4b91d2e7 100644 ---- a/kernel/workqueue.c -+++ b/kernel/workqueue.c -@@ -2861,19 +2861,57 @@ bool flush_work(struct work_struct *work) - } - EXPORT_SYMBOL_GPL(flush_work); - -+struct cwt_wait { -+ wait_queue_t wait; -+ struct work_struct *work; -+}; -+ -+static int cwt_wakefn(wait_queue_t *wait, unsigned mode, int sync, void *key) -+{ -+ struct cwt_wait *cwait = container_of(wait, struct cwt_wait, wait); -+ -+ if (cwait->work != key) -+ return 0; -+ return autoremove_wake_function(wait, mode, sync, key); -+} -+ - static bool __cancel_work_timer(struct work_struct *work, bool is_dwork) - { -+ static DECLARE_WAIT_QUEUE_HEAD(cancel_waitq); - unsigned long flags; - int ret; - - do { - ret = try_to_grab_pending(work, is_dwork, &flags); - /* -- * If someone else is canceling, wait for the same event it -- * would be waiting for before retrying. -+ * If someone else is already canceling, wait for it to -+ * finish. flush_work() doesn't work for PREEMPT_NONE -+ * because we may get scheduled between @work's completion -+ * and the other canceling task resuming and clearing -+ * CANCELING - flush_work() will return false immediately -+ * as @work is no longer busy, try_to_grab_pending() will -+ * return -ENOENT as @work is still being canceled and the -+ * other canceling task won't be able to clear CANCELING as -+ * we're hogging the CPU. -+ * -+ * Let's wait for completion using a waitqueue. As this -+ * may lead to the thundering herd problem, use a custom -+ * wake function which matches @work along with exclusive -+ * wait and wakeup. - */ -- if (unlikely(ret == -ENOENT)) -- flush_work(work); -+ if (unlikely(ret == -ENOENT)) { -+ struct cwt_wait cwait; -+ -+ init_wait(&cwait.wait); -+ cwait.wait.func = cwt_wakefn; -+ cwait.work = work; -+ -+ prepare_to_wait_exclusive(&cancel_waitq, &cwait.wait, -+ TASK_UNINTERRUPTIBLE); -+ if (work_is_canceling(work)) -+ schedule(); -+ finish_wait(&cancel_waitq, &cwait.wait); -+ } - } while (unlikely(ret < 0)); - - /* tell other tasks trying to grab @work to back off */ -@@ -2882,6 +2920,16 @@ static bool __cancel_work_timer(struct work_struct *work, bool is_dwork) - - flush_work(work); - clear_work_data(work); -+ -+ /* -+ * Paired with prepare_to_wait() above so that either -+ * waitqueue_active() is visible here or !work_is_canceling() is -+ * visible there. -+ */ -+ smp_mb(); -+ if (waitqueue_active(&cancel_waitq)) -+ __wake_up(&cancel_waitq, TASK_NORMAL, 1, work); -+ - return ret; - } - -diff --git a/net/caif/caif_socket.c b/net/caif/caif_socket.c -index d6be3edb7a43..526bf56f4d31 100644 ---- a/net/caif/caif_socket.c -+++ b/net/caif/caif_socket.c -@@ -283,7 +283,7 @@ static int caif_seqpkt_recvmsg(struct kiocb *iocb, struct socket *sock, - int copylen; - - ret = -EOPNOTSUPP; -- if (m->msg_flags&MSG_OOB) -+ if (flags & MSG_OOB) - goto read_error; - - skb = skb_recv_datagram(sk, flags, 0 , &ret); -diff --git a/net/can/af_can.c b/net/can/af_can.c -index f59859a3f562..d3668c55b088 100644 ---- a/net/can/af_can.c -+++ b/net/can/af_can.c -@@ -262,6 +262,9 @@ int can_send(struct sk_buff *skb, int loop) - goto inval_skb; - } - -+ skb->ip_summed = CHECKSUM_UNNECESSARY; -+ -+ skb_reset_mac_header(skb); - skb_reset_network_header(skb); - skb_reset_transport_header(skb); - -diff --git a/net/compat.c b/net/compat.c -index 275af79c131b..d12529050b29 100644 ---- a/net/compat.c -+++ b/net/compat.c -@@ -71,6 +71,13 @@ int get_compat_msghdr(struct msghdr *kmsg, struct compat_msghdr __user *umsg) - __get_user(kmsg->msg_controllen, &umsg->msg_controllen) || - __get_user(kmsg->msg_flags, &umsg->msg_flags)) - return -EFAULT; -+ -+ if (!tmp1) -+ kmsg->msg_namelen = 0; -+ -+ if (kmsg->msg_namelen < 0) -+ return -EINVAL; -+ - if (kmsg->msg_namelen > sizeof(struct sockaddr_storage)) - kmsg->msg_namelen = sizeof(struct sockaddr_storage); - kmsg->msg_name = compat_ptr(tmp1); -diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c -index 2ff093b7c45e..0a327b66a344 100644 ---- a/net/core/sysctl_net_core.c -+++ b/net/core/sysctl_net_core.c -@@ -23,6 +23,8 @@ - static int zero = 0; - static int one = 1; - static int ushort_max = USHRT_MAX; -+static int min_sndbuf = SOCK_MIN_SNDBUF; -+static int min_rcvbuf = SOCK_MIN_RCVBUF; - - #ifdef CONFIG_RPS - static int rps_sock_flow_sysctl(ctl_table *table, int write, -@@ -97,7 +99,7 @@ static struct ctl_table net_core_table[] = { - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = proc_dointvec_minmax, -- .extra1 = &one, -+ .extra1 = &min_sndbuf, - }, - { - .procname = "rmem_max", -@@ -105,7 +107,7 @@ static struct ctl_table net_core_table[] = { - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = proc_dointvec_minmax, -- .extra1 = &one, -+ .extra1 = &min_rcvbuf, - }, - { - .procname = "wmem_default", -@@ -113,7 +115,7 @@ static struct ctl_table net_core_table[] = { - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = proc_dointvec_minmax, -- .extra1 = &one, -+ .extra1 = &min_sndbuf, - }, - { - .procname = "rmem_default", -@@ -121,7 +123,7 @@ static struct ctl_table net_core_table[] = { - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = proc_dointvec_minmax, -- .extra1 = &one, -+ .extra1 = &min_rcvbuf, - }, - { - .procname = "dev_weight", -diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c -index 45dbdab915e2..14a1ed611b05 100644 ---- a/net/ipv4/inet_diag.c -+++ b/net/ipv4/inet_diag.c -@@ -71,6 +71,20 @@ static inline void inet_diag_unlock_handler( - mutex_unlock(&inet_diag_table_mutex); - } - -+static size_t inet_sk_attr_size(void) -+{ -+ return nla_total_size(sizeof(struct tcp_info)) -+ + nla_total_size(1) /* INET_DIAG_SHUTDOWN */ -+ + nla_total_size(1) /* INET_DIAG_TOS */ -+ + nla_total_size(1) /* INET_DIAG_TCLASS */ -+ + nla_total_size(sizeof(struct inet_diag_meminfo)) -+ + nla_total_size(sizeof(struct inet_diag_msg)) -+ + nla_total_size(SK_MEMINFO_VARS * sizeof(u32)) -+ + nla_total_size(TCP_CA_NAME_MAX) -+ + nla_total_size(sizeof(struct tcpvegas_info)) -+ + 64; -+} -+ - int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk, - struct sk_buff *skb, struct inet_diag_req_v2 *req, - struct user_namespace *user_ns, -@@ -326,9 +340,7 @@ int inet_diag_dump_one_icsk(struct inet_hashinfo *hashinfo, struct sk_buff *in_s - if (err) - goto out; - -- rep = nlmsg_new(sizeof(struct inet_diag_msg) + -- sizeof(struct inet_diag_meminfo) + -- sizeof(struct tcp_info) + 64, GFP_KERNEL); -+ rep = nlmsg_new(inet_sk_attr_size(), GFP_KERNEL); - if (!rep) { - err = -ENOMEM; - goto out; -diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c -index 923146c4f007..913dc4f49b10 100644 ---- a/net/ipv4/tcp_output.c -+++ b/net/ipv4/tcp_output.c -@@ -2593,15 +2593,11 @@ void tcp_send_fin(struct sock *sk) - } else { - /* Socket is locked, keep trying until memory is available. */ - for (;;) { -- skb = alloc_skb_fclone(MAX_TCP_HEADER, -- sk->sk_allocation); -+ skb = sk_stream_alloc_skb(sk, 0, sk->sk_allocation); - if (skb) - break; - yield(); - } -- -- /* Reserve space for headers and prepare control bits. */ -- skb_reserve(skb, MAX_TCP_HEADER); - /* FIN eats a sequence byte, write_seq advanced by tcp_queue_skb(). */ - tcp_init_nondata_skb(skb, tp->write_seq, - TCPHDR_ACK | TCPHDR_FIN); -@@ -2875,9 +2871,9 @@ static int tcp_send_syn_data(struct sock *sk, struct sk_buff *syn) - { - struct tcp_sock *tp = tcp_sk(sk); - struct tcp_fastopen_request *fo = tp->fastopen_req; -- int syn_loss = 0, space, i, err = 0, iovlen = fo->data->msg_iovlen; -- struct sk_buff *syn_data = NULL, *data; -+ int syn_loss = 0, space, err = 0; - unsigned long last_syn_loss = 0; -+ struct sk_buff *syn_data; - - tp->rx_opt.mss_clamp = tp->advmss; /* If MSS is not cached */ - tcp_fastopen_cache_get(sk, &tp->rx_opt.mss_clamp, &fo->cookie, -@@ -2908,42 +2904,38 @@ static int tcp_send_syn_data(struct sock *sk, struct sk_buff *syn) - /* limit to order-0 allocations */ - space = min_t(size_t, space, SKB_MAX_HEAD(MAX_TCP_HEADER)); - -- syn_data = skb_copy_expand(syn, MAX_TCP_HEADER, space, -- sk->sk_allocation); -- if (syn_data == NULL) -+ syn_data = sk_stream_alloc_skb(sk, space, sk->sk_allocation); -+ if (!syn_data) - goto fallback; -+ syn_data->ip_summed = CHECKSUM_PARTIAL; -+ memcpy(syn_data->cb, syn->cb, sizeof(syn->cb)); -+ if (unlikely(memcpy_fromiovecend(skb_put(syn_data, space), -+ fo->data->msg_iov, 0, space))) { -+ kfree_skb(syn_data); -+ goto fallback; -+ } - -- for (i = 0; i < iovlen && syn_data->len < space; ++i) { -- struct iovec *iov = &fo->data->msg_iov[i]; -- unsigned char __user *from = iov->iov_base; -- int len = iov->iov_len; -- -- if (syn_data->len + len > space) -- len = space - syn_data->len; -- else if (i + 1 == iovlen) -- /* No more data pending in inet_wait_for_connect() */ -- fo->data = NULL; -+ /* No more data pending in inet_wait_for_connect() */ -+ if (space == fo->size) -+ fo->data = NULL; -+ fo->copied = space; - -- if (skb_add_data(syn_data, from, len)) -- goto fallback; -- } -+ tcp_connect_queue_skb(sk, syn_data); - -- /* Queue a data-only packet after the regular SYN for retransmission */ -- data = pskb_copy(syn_data, sk->sk_allocation); -- if (data == NULL) -- goto fallback; -- TCP_SKB_CB(data)->seq++; -- TCP_SKB_CB(data)->tcp_flags &= ~TCPHDR_SYN; -- TCP_SKB_CB(data)->tcp_flags = (TCPHDR_ACK|TCPHDR_PSH); -- tcp_connect_queue_skb(sk, data); -- fo->copied = data->len; -+ err = tcp_transmit_skb(sk, syn_data, 1, sk->sk_allocation); - -- if (tcp_transmit_skb(sk, syn_data, 0, sk->sk_allocation) == 0) { -+ /* Now full SYN+DATA was cloned and sent (or not), -+ * remove the SYN from the original skb (syn_data) -+ * we keep in write queue in case of a retransmit, as we -+ * also have the SYN packet (with no data) in the same queue. -+ */ -+ TCP_SKB_CB(syn_data)->seq++; -+ TCP_SKB_CB(syn_data)->tcp_flags = TCPHDR_ACK | TCPHDR_PSH; -+ if (!err) { - tp->syn_data = (fo->copied > 0); - NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPFASTOPENACTIVE); - goto done; - } -- syn_data = NULL; - - fallback: - /* Send a regular SYN with Fast Open cookie request option */ -@@ -2952,7 +2944,6 @@ fallback: - err = tcp_transmit_skb(sk, syn, 1, sk->sk_allocation); - if (err) - tp->syn_fastopen = 0; -- kfree_skb(syn_data); - done: - fo->cookie.len = -1; /* Exclude Fast Open option for SYN retries */ - return err; -@@ -2972,13 +2963,10 @@ int tcp_connect(struct sock *sk) - return 0; - } - -- buff = alloc_skb_fclone(MAX_TCP_HEADER + 15, sk->sk_allocation); -- if (unlikely(buff == NULL)) -+ buff = sk_stream_alloc_skb(sk, 0, sk->sk_allocation); -+ if (unlikely(!buff)) - return -ENOBUFS; - -- /* Reserve space for headers. */ -- skb_reserve(buff, MAX_TCP_HEADER); -- - tcp_init_nondata_skb(buff, tp->write_seq++, TCPHDR_SYN); - tp->retrans_stamp = TCP_SKB_CB(buff)->when = tcp_time_stamp; - tcp_connect_queue_skb(sk, buff); -diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c -index 26b9a986a87f..1c6a71c41e62 100644 ---- a/net/netfilter/ipvs/ip_vs_core.c -+++ b/net/netfilter/ipvs/ip_vs_core.c -@@ -650,16 +650,24 @@ static inline int ip_vs_gather_frags(struct sk_buff *skb, u_int32_t user) - return err; - } - --static int ip_vs_route_me_harder(int af, struct sk_buff *skb) -+static int ip_vs_route_me_harder(int af, struct sk_buff *skb, -+ unsigned int hooknum) - { -+ if (!sysctl_snat_reroute(skb)) -+ return 0; -+ /* Reroute replies only to remote clients (FORWARD and LOCAL_OUT) */ -+ if (NF_INET_LOCAL_IN == hooknum) -+ return 0; - #ifdef CONFIG_IP_VS_IPV6 - if (af == AF_INET6) { -- if (sysctl_snat_reroute(skb) && ip6_route_me_harder(skb) != 0) -+ struct dst_entry *dst = skb_dst(skb); -+ -+ if (dst->dev && !(dst->dev->flags & IFF_LOOPBACK) && -+ ip6_route_me_harder(skb) != 0) - return 1; - } else - #endif -- if ((sysctl_snat_reroute(skb) || -- skb_rtable(skb)->rt_flags & RTCF_LOCAL) && -+ if (!(skb_rtable(skb)->rt_flags & RTCF_LOCAL) && - ip_route_me_harder(skb, RTN_LOCAL) != 0) - return 1; - -@@ -782,7 +790,8 @@ static int handle_response_icmp(int af, struct sk_buff *skb, - union nf_inet_addr *snet, - __u8 protocol, struct ip_vs_conn *cp, - struct ip_vs_protocol *pp, -- unsigned int offset, unsigned int ihl) -+ unsigned int offset, unsigned int ihl, -+ unsigned int hooknum) - { - unsigned int verdict = NF_DROP; - -@@ -812,7 +821,7 @@ static int handle_response_icmp(int af, struct sk_buff *skb, - #endif - ip_vs_nat_icmp(skb, pp, cp, 1); - -- if (ip_vs_route_me_harder(af, skb)) -+ if (ip_vs_route_me_harder(af, skb, hooknum)) - goto out; - - /* do the statistics and put it back */ -@@ -907,7 +916,7 @@ static int ip_vs_out_icmp(struct sk_buff *skb, int *related, - - snet.ip = iph->saddr; - return handle_response_icmp(AF_INET, skb, &snet, cih->protocol, cp, -- pp, ciph.len, ihl); -+ pp, ciph.len, ihl, hooknum); - } - - #ifdef CONFIG_IP_VS_IPV6 -@@ -972,7 +981,8 @@ static int ip_vs_out_icmp_v6(struct sk_buff *skb, int *related, - snet.in6 = ciph.saddr.in6; - writable = ciph.len; - return handle_response_icmp(AF_INET6, skb, &snet, ciph.protocol, cp, -- pp, writable, sizeof(struct ipv6hdr)); -+ pp, writable, sizeof(struct ipv6hdr), -+ hooknum); - } - #endif - -@@ -1031,7 +1041,8 @@ static inline bool is_new_conn(const struct sk_buff *skb, - */ - static unsigned int - handle_response(int af, struct sk_buff *skb, struct ip_vs_proto_data *pd, -- struct ip_vs_conn *cp, struct ip_vs_iphdr *iph) -+ struct ip_vs_conn *cp, struct ip_vs_iphdr *iph, -+ unsigned int hooknum) - { - struct ip_vs_protocol *pp = pd->pp; - -@@ -1069,7 +1080,7 @@ handle_response(int af, struct sk_buff *skb, struct ip_vs_proto_data *pd, - * if it came from this machine itself. So re-compute - * the routing information. - */ -- if (ip_vs_route_me_harder(af, skb)) -+ if (ip_vs_route_me_harder(af, skb, hooknum)) - goto drop; - - IP_VS_DBG_PKT(10, af, pp, skb, 0, "After SNAT"); -@@ -1172,7 +1183,7 @@ ip_vs_out(unsigned int hooknum, struct sk_buff *skb, int af) - cp = pp->conn_out_get(af, skb, &iph, 0); - - if (likely(cp)) -- return handle_response(af, skb, pd, cp, &iph); -+ return handle_response(af, skb, pd, cp, &iph, hooknum); - if (sysctl_nat_icmp_send(net) && - (pp->protocol == IPPROTO_TCP || - pp->protocol == IPPROTO_UDP || -diff --git a/net/netfilter/ipvs/ip_vs_sync.c b/net/netfilter/ipvs/ip_vs_sync.c -index f6046d9af8d3..e476cc7dc801 100644 ---- a/net/netfilter/ipvs/ip_vs_sync.c -+++ b/net/netfilter/ipvs/ip_vs_sync.c -@@ -878,6 +878,8 @@ static void ip_vs_proc_conn(struct net *net, struct ip_vs_conn_param *param, - IP_VS_DBG(2, "BACKUP, add new conn. failed\n"); - return; - } -+ if (!(flags & IP_VS_CONN_F_TEMPLATE)) -+ kfree(param->pe_data); - } - - if (opt) -@@ -1151,6 +1153,7 @@ static inline int ip_vs_proc_sync_conn(struct net *net, __u8 *p, __u8 *msg_end) - (opt_flags & IPVS_OPT_F_SEQ_DATA ? &opt : NULL) - ); - #endif -+ ip_vs_pe_put(param.pe); - return 0; - /* Error exit */ - out: -diff --git a/net/rds/iw_rdma.c b/net/rds/iw_rdma.c -index a817705ce2d0..dba8d0864f18 100644 ---- a/net/rds/iw_rdma.c -+++ b/net/rds/iw_rdma.c -@@ -88,7 +88,9 @@ static unsigned int rds_iw_unmap_fastreg_list(struct rds_iw_mr_pool *pool, - int *unpinned); - static void rds_iw_destroy_fastreg(struct rds_iw_mr_pool *pool, struct rds_iw_mr *ibmr); - --static int rds_iw_get_device(struct rds_sock *rs, struct rds_iw_device **rds_iwdev, struct rdma_cm_id **cm_id) -+static int rds_iw_get_device(struct sockaddr_in *src, struct sockaddr_in *dst, -+ struct rds_iw_device **rds_iwdev, -+ struct rdma_cm_id **cm_id) - { - struct rds_iw_device *iwdev; - struct rds_iw_cm_id *i_cm_id; -@@ -112,15 +114,15 @@ static int rds_iw_get_device(struct rds_sock *rs, struct rds_iw_device **rds_iwd - src_addr->sin_port, - dst_addr->sin_addr.s_addr, - dst_addr->sin_port, -- rs->rs_bound_addr, -- rs->rs_bound_port, -- rs->rs_conn_addr, -- rs->rs_conn_port); -+ src->sin_addr.s_addr, -+ src->sin_port, -+ dst->sin_addr.s_addr, -+ dst->sin_port); - #ifdef WORKING_TUPLE_DETECTION -- if (src_addr->sin_addr.s_addr == rs->rs_bound_addr && -- src_addr->sin_port == rs->rs_bound_port && -- dst_addr->sin_addr.s_addr == rs->rs_conn_addr && -- dst_addr->sin_port == rs->rs_conn_port) { -+ if (src_addr->sin_addr.s_addr == src->sin_addr.s_addr && -+ src_addr->sin_port == src->sin_port && -+ dst_addr->sin_addr.s_addr == dst->sin_addr.s_addr && -+ dst_addr->sin_port == dst->sin_port) { - #else - /* FIXME - needs to compare the local and remote - * ipaddr/port tuple, but the ipaddr is the only -@@ -128,7 +130,7 @@ static int rds_iw_get_device(struct rds_sock *rs, struct rds_iw_device **rds_iwd - * zero'ed. It doesn't appear to be properly populated - * during connection setup... - */ -- if (src_addr->sin_addr.s_addr == rs->rs_bound_addr) { -+ if (src_addr->sin_addr.s_addr == src->sin_addr.s_addr) { - #endif - spin_unlock_irq(&iwdev->spinlock); - *rds_iwdev = iwdev; -@@ -180,19 +182,13 @@ int rds_iw_update_cm_id(struct rds_iw_device *rds_iwdev, struct rdma_cm_id *cm_i - { - struct sockaddr_in *src_addr, *dst_addr; - struct rds_iw_device *rds_iwdev_old; -- struct rds_sock rs; - struct rdma_cm_id *pcm_id; - int rc; - - src_addr = (struct sockaddr_in *)&cm_id->route.addr.src_addr; - dst_addr = (struct sockaddr_in *)&cm_id->route.addr.dst_addr; - -- rs.rs_bound_addr = src_addr->sin_addr.s_addr; -- rs.rs_bound_port = src_addr->sin_port; -- rs.rs_conn_addr = dst_addr->sin_addr.s_addr; -- rs.rs_conn_port = dst_addr->sin_port; -- -- rc = rds_iw_get_device(&rs, &rds_iwdev_old, &pcm_id); -+ rc = rds_iw_get_device(src_addr, dst_addr, &rds_iwdev_old, &pcm_id); - if (rc) - rds_iw_remove_cm_id(rds_iwdev, cm_id); - -@@ -598,9 +594,17 @@ void *rds_iw_get_mr(struct scatterlist *sg, unsigned long nents, - struct rds_iw_device *rds_iwdev; - struct rds_iw_mr *ibmr = NULL; - struct rdma_cm_id *cm_id; -+ struct sockaddr_in src = { -+ .sin_addr.s_addr = rs->rs_bound_addr, -+ .sin_port = rs->rs_bound_port, -+ }; -+ struct sockaddr_in dst = { -+ .sin_addr.s_addr = rs->rs_conn_addr, -+ .sin_port = rs->rs_conn_port, -+ }; - int ret; - -- ret = rds_iw_get_device(rs, &rds_iwdev, &cm_id); -+ ret = rds_iw_get_device(&src, &dst, &rds_iwdev, &cm_id); - if (ret || !cm_id) { - ret = -ENODEV; - goto out; -diff --git a/net/rxrpc/ar-recvmsg.c b/net/rxrpc/ar-recvmsg.c -index 898492a8d61b..5cc2da5d295d 100644 ---- a/net/rxrpc/ar-recvmsg.c -+++ b/net/rxrpc/ar-recvmsg.c -@@ -87,7 +87,7 @@ int rxrpc_recvmsg(struct kiocb *iocb, struct socket *sock, - if (!skb) { - /* nothing remains on the queue */ - if (copied && -- (msg->msg_flags & MSG_PEEK || timeo == 0)) -+ (flags & MSG_PEEK || timeo == 0)) - goto out; - - /* wait for a message to turn up */ -diff --git a/sound/core/control.c b/sound/core/control.c -index 98a29b26c5f4..f2082a35b890 100644 ---- a/sound/core/control.c -+++ b/sound/core/control.c -@@ -1168,6 +1168,10 @@ static int snd_ctl_elem_add(struct snd_ctl_file *file, - - if (info->count < 1) - return -EINVAL; -+ if (!*info->id.name) -+ return -EINVAL; -+ if (strnlen(info->id.name, sizeof(info->id.name)) >= sizeof(info->id.name)) -+ return -EINVAL; - access = info->access == 0 ? SNDRV_CTL_ELEM_ACCESS_READWRITE : - (info->access & (SNDRV_CTL_ELEM_ACCESS_READWRITE| - SNDRV_CTL_ELEM_ACCESS_INACTIVE| -diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c -index cb4d3700f330..db67e5b596d3 100644 ---- a/sound/pci/hda/hda_generic.c -+++ b/sound/pci/hda/hda_generic.c -@@ -642,12 +642,45 @@ static int get_amp_val_to_activate(struct hda_codec *codec, hda_nid_t nid, - return val; - } - -+/* is this a stereo widget or a stereo-to-mono mix? */ -+static bool is_stereo_amps(struct hda_codec *codec, hda_nid_t nid, int dir) -+{ -+ unsigned int wcaps = get_wcaps(codec, nid); -+ hda_nid_t conn; -+ -+ if (wcaps & AC_WCAP_STEREO) -+ return true; -+ if (dir != HDA_INPUT || get_wcaps_type(wcaps) != AC_WID_AUD_MIX) -+ return false; -+ if (snd_hda_get_num_conns(codec, nid) != 1) -+ return false; -+ if (snd_hda_get_connections(codec, nid, &conn, 1) < 0) -+ return false; -+ return !!(get_wcaps(codec, conn) & AC_WCAP_STEREO); -+} -+ - /* initialize the amp value (only at the first time) */ - static void init_amp(struct hda_codec *codec, hda_nid_t nid, int dir, int idx) - { - unsigned int caps = query_amp_caps(codec, nid, dir); - int val = get_amp_val_to_activate(codec, nid, dir, caps, false); -- snd_hda_codec_amp_init_stereo(codec, nid, dir, idx, 0xff, val); -+ -+ if (is_stereo_amps(codec, nid, dir)) -+ snd_hda_codec_amp_init_stereo(codec, nid, dir, idx, 0xff, val); -+ else -+ snd_hda_codec_amp_init(codec, nid, 0, dir, idx, 0xff, val); -+} -+ -+/* update the amp, doing in stereo or mono depending on NID */ -+static int update_amp(struct hda_codec *codec, hda_nid_t nid, int dir, int idx, -+ unsigned int mask, unsigned int val) -+{ -+ if (is_stereo_amps(codec, nid, dir)) -+ return snd_hda_codec_amp_stereo(codec, nid, dir, idx, -+ mask, val); -+ else -+ return snd_hda_codec_amp_update(codec, nid, 0, dir, idx, -+ mask, val); - } - - /* calculate amp value mask we can modify; -@@ -687,7 +720,7 @@ static void activate_amp(struct hda_codec *codec, hda_nid_t nid, int dir, - return; - - val &= mask; -- snd_hda_codec_amp_stereo(codec, nid, dir, idx, mask, val); -+ update_amp(codec, nid, dir, idx, mask, val); - } - - static void activate_amp_out(struct hda_codec *codec, struct nid_path *path, -@@ -4235,13 +4268,11 @@ static void mute_all_mixer_nid(struct hda_codec *codec, hda_nid_t mix) - has_amp = nid_has_mute(codec, mix, HDA_INPUT); - for (i = 0; i < nums; i++) { - if (has_amp) -- snd_hda_codec_amp_stereo(codec, mix, -- HDA_INPUT, i, -- 0xff, HDA_AMP_MUTE); -+ update_amp(codec, mix, HDA_INPUT, i, -+ 0xff, HDA_AMP_MUTE); - else if (nid_has_volume(codec, conn[i], HDA_OUTPUT)) -- snd_hda_codec_amp_stereo(codec, conn[i], -- HDA_OUTPUT, 0, -- 0xff, HDA_AMP_MUTE); -+ update_amp(codec, conn[i], HDA_OUTPUT, 0, -+ 0xff, HDA_AMP_MUTE); - } - } - -diff --git a/sound/pci/hda/hda_proc.c b/sound/pci/hda/hda_proc.c -index 0fee8fae590a..eb94e495c754 100644 ---- a/sound/pci/hda/hda_proc.c -+++ b/sound/pci/hda/hda_proc.c -@@ -129,13 +129,38 @@ static void print_amp_caps(struct snd_info_buffer *buffer, - (caps & AC_AMPCAP_MUTE) >> AC_AMPCAP_MUTE_SHIFT); - } - -+/* is this a stereo widget or a stereo-to-mono mix? */ -+static bool is_stereo_amps(struct hda_codec *codec, hda_nid_t nid, -+ int dir, unsigned int wcaps, int indices) -+{ -+ hda_nid_t conn; -+ -+ if (wcaps & AC_WCAP_STEREO) -+ return true; -+ /* check for a stereo-to-mono mix; it must be: -+ * only a single connection, only for input, and only a mixer widget -+ */ -+ if (indices != 1 || dir != HDA_INPUT || -+ get_wcaps_type(wcaps) != AC_WID_AUD_MIX) -+ return false; -+ -+ if (snd_hda_get_raw_connections(codec, nid, &conn, 1) < 0) -+ return false; -+ /* the connection source is a stereo? */ -+ wcaps = snd_hda_param_read(codec, conn, AC_PAR_AUDIO_WIDGET_CAP); -+ return !!(wcaps & AC_WCAP_STEREO); -+} -+ - static void print_amp_vals(struct snd_info_buffer *buffer, - struct hda_codec *codec, hda_nid_t nid, -- int dir, int stereo, int indices) -+ int dir, unsigned int wcaps, int indices) - { - unsigned int val; -+ bool stereo; - int i; - -+ stereo = is_stereo_amps(codec, nid, dir, wcaps, indices); -+ - dir = dir == HDA_OUTPUT ? AC_AMP_GET_OUTPUT : AC_AMP_GET_INPUT; - for (i = 0; i < indices; i++) { - snd_iprintf(buffer, " ["); -@@ -682,12 +707,10 @@ static void print_codec_info(struct snd_info_entry *entry, - (codec->single_adc_amp && - wid_type == AC_WID_AUD_IN)) - print_amp_vals(buffer, codec, nid, HDA_INPUT, -- wid_caps & AC_WCAP_STEREO, -- 1); -+ wid_caps, 1); - else - print_amp_vals(buffer, codec, nid, HDA_INPUT, -- wid_caps & AC_WCAP_STEREO, -- conn_len); -+ wid_caps, conn_len); - } - if (wid_caps & AC_WCAP_OUT_AMP) { - snd_iprintf(buffer, " Amp-Out caps: "); -@@ -696,11 +719,10 @@ static void print_codec_info(struct snd_info_entry *entry, - if (wid_type == AC_WID_PIN && - codec->pin_amp_workaround) - print_amp_vals(buffer, codec, nid, HDA_OUTPUT, -- wid_caps & AC_WCAP_STEREO, -- conn_len); -+ wid_caps, conn_len); - else - print_amp_vals(buffer, codec, nid, HDA_OUTPUT, -- wid_caps & AC_WCAP_STEREO, 1); -+ wid_caps, 1); - } - - switch (wid_type) { -diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c -index cccaf9c7a7bb..e2642ba88b2d 100644 ---- a/sound/pci/hda/patch_cirrus.c -+++ b/sound/pci/hda/patch_cirrus.c -@@ -363,6 +363,7 @@ static const struct snd_pci_quirk cs420x_fixup_tbl[] = { - SND_PCI_QUIRK(0x106b, 0x1c00, "MacBookPro 8,1", CS420X_MBP81), - SND_PCI_QUIRK(0x106b, 0x2000, "iMac 12,2", CS420X_IMAC27_122), - SND_PCI_QUIRK(0x106b, 0x2800, "MacBookPro 10,1", CS420X_MBP101), -+ SND_PCI_QUIRK(0x106b, 0x5600, "MacBookAir 5,2", CS420X_MBP81), - SND_PCI_QUIRK(0x106b, 0x5b00, "MacBookAir 4,2", CS420X_MBA42), - SND_PCI_QUIRK_VENDOR(0x106b, "Apple", CS420X_APPLE), - {} /* terminator */ -@@ -531,6 +532,7 @@ static int patch_cs420x(struct hda_codec *codec) - return -ENOMEM; - - spec->gen.automute_hook = cs_automute; -+ codec->single_adc_amp = 1; - - snd_hda_pick_fixup(codec, cs420x_models, cs420x_fixup_tbl, - cs420x_fixups); -diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c -index 1868d3a6e310..fab909908a42 100644 ---- a/sound/pci/hda/patch_conexant.c -+++ b/sound/pci/hda/patch_conexant.c -@@ -3223,6 +3223,7 @@ enum { - CXT_PINCFG_LENOVO_TP410, - CXT_PINCFG_LEMOTE_A1004, - CXT_PINCFG_LEMOTE_A1205, -+ CXT_PINCFG_COMPAQ_CQ60, - CXT_FIXUP_STEREO_DMIC, - CXT_FIXUP_INC_MIC_BOOST, - CXT_FIXUP_GPIO1, -@@ -3296,6 +3297,15 @@ static const struct hda_fixup cxt_fixups[] = { - .type = HDA_FIXUP_PINS, - .v.pins = cxt_pincfg_lemote, - }, -+ [CXT_PINCFG_COMPAQ_CQ60] = { -+ .type = HDA_FIXUP_PINS, -+ .v.pins = (const struct hda_pintbl[]) { -+ /* 0x17 was falsely set up as a mic, it should 0x1d */ -+ { 0x17, 0x400001f0 }, -+ { 0x1d, 0x97a70120 }, -+ { } -+ } -+ }, - [CXT_FIXUP_STEREO_DMIC] = { - .type = HDA_FIXUP_FUNC, - .v.func = cxt_fixup_stereo_dmic, -@@ -3316,6 +3326,7 @@ static const struct hda_fixup cxt_fixups[] = { - }; - - static const struct snd_pci_quirk cxt5051_fixups[] = { -+ SND_PCI_QUIRK(0x103c, 0x360b, "Compaq CQ60", CXT_PINCFG_COMPAQ_CQ60), - SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo X200", CXT_PINCFG_LENOVO_X200), - {} - }; diff --git a/patch/kernel/marvell-default/1-patch-3.10.73-74.patch b/patch/kernel/marvell-default/1-patch-3.10.73-74.patch deleted file mode 100644 index 7dc6831a01..0000000000 --- a/patch/kernel/marvell-default/1-patch-3.10.73-74.patch +++ /dev/null @@ -1,599 +0,0 @@ -diff --git a/Makefile b/Makefile -index b1129094ebfd..d2a3930159ea 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,6 +1,6 @@ - VERSION = 3 - PATCHLEVEL = 10 --SUBLEVEL = 73 -+SUBLEVEL = 74 - EXTRAVERSION = - NAME = TOSSUG Baby Fish - -diff --git a/arch/powerpc/boot/dts/fsl/pq3-etsec2-0.dtsi b/arch/powerpc/boot/dts/fsl/pq3-etsec2-0.dtsi -index 1382fec9e8c5..7fcb1ac0f232 100644 ---- a/arch/powerpc/boot/dts/fsl/pq3-etsec2-0.dtsi -+++ b/arch/powerpc/boot/dts/fsl/pq3-etsec2-0.dtsi -@@ -50,6 +50,7 @@ ethernet@b0000 { - fsl,num_tx_queues = <0x8>; - fsl,magic-packet; - local-mac-address = [ 00 00 00 00 00 00 ]; -+ ranges; - - queue-group@b0000 { - #address-cells = <1>; -diff --git a/arch/powerpc/boot/dts/fsl/pq3-etsec2-1.dtsi b/arch/powerpc/boot/dts/fsl/pq3-etsec2-1.dtsi -index 221cd2ea5b31..9f25427c1527 100644 ---- a/arch/powerpc/boot/dts/fsl/pq3-etsec2-1.dtsi -+++ b/arch/powerpc/boot/dts/fsl/pq3-etsec2-1.dtsi -@@ -50,6 +50,7 @@ ethernet@b1000 { - fsl,num_tx_queues = <0x8>; - fsl,magic-packet; - local-mac-address = [ 00 00 00 00 00 00 ]; -+ ranges; - - queue-group@b1000 { - #address-cells = <1>; -diff --git a/arch/powerpc/boot/dts/fsl/pq3-etsec2-2.dtsi b/arch/powerpc/boot/dts/fsl/pq3-etsec2-2.dtsi -index 61456c317609..cd7c318ab131 100644 ---- a/arch/powerpc/boot/dts/fsl/pq3-etsec2-2.dtsi -+++ b/arch/powerpc/boot/dts/fsl/pq3-etsec2-2.dtsi -@@ -49,6 +49,7 @@ ethernet@b2000 { - fsl,num_tx_queues = <0x8>; - fsl,magic-packet; - local-mac-address = [ 00 00 00 00 00 00 ]; -+ ranges; - - queue-group@b2000 { - #address-cells = <1>; -diff --git a/drivers/md/dm.c b/drivers/md/dm.c -index a87f0c42cb8b..f69fed826a56 100644 ---- a/drivers/md/dm.c -+++ b/drivers/md/dm.c -@@ -2333,10 +2333,16 @@ static void __dm_destroy(struct mapped_device *md, bool wait) - set_bit(DMF_FREEING, &md->flags); - spin_unlock(&_minor_lock); - -+ /* -+ * Take suspend_lock so that presuspend and postsuspend methods -+ * do not race with internal suspend. -+ */ -+ mutex_lock(&md->suspend_lock); - if (!dm_suspended_md(md)) { - dm_table_presuspend_targets(map); - dm_table_postsuspend_targets(map); - } -+ mutex_unlock(&md->suspend_lock); - - /* - * Rare, but there may be I/O requests still going to complete, -diff --git a/drivers/net/ethernet/amd/pcnet32.c b/drivers/net/ethernet/amd/pcnet32.c -index ed2130727643..f6415fda103b 100644 ---- a/drivers/net/ethernet/amd/pcnet32.c -+++ b/drivers/net/ethernet/amd/pcnet32.c -@@ -1516,7 +1516,7 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev) - { - struct pcnet32_private *lp; - int i, media; -- int fdx, mii, fset, dxsuflo; -+ int fdx, mii, fset, dxsuflo, sram; - int chip_version; - char *chipname; - struct net_device *dev; -@@ -1553,7 +1553,7 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev) - } - - /* initialize variables */ -- fdx = mii = fset = dxsuflo = 0; -+ fdx = mii = fset = dxsuflo = sram = 0; - chip_version = (chip_version >> 12) & 0xffff; - - switch (chip_version) { -@@ -1586,6 +1586,7 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev) - chipname = "PCnet/FAST III 79C973"; /* PCI */ - fdx = 1; - mii = 1; -+ sram = 1; - break; - case 0x2626: - chipname = "PCnet/Home 79C978"; /* PCI */ -@@ -1609,6 +1610,7 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev) - chipname = "PCnet/FAST III 79C975"; /* PCI */ - fdx = 1; - mii = 1; -+ sram = 1; - break; - case 0x2628: - chipname = "PCnet/PRO 79C976"; -@@ -1637,6 +1639,31 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev) - dxsuflo = 1; - } - -+ /* -+ * The Am79C973/Am79C975 controllers come with 12K of SRAM -+ * which we can use for the Tx/Rx buffers but most importantly, -+ * the use of SRAM allow us to use the BCR18:NOUFLO bit to avoid -+ * Tx fifo underflows. -+ */ -+ if (sram) { -+ /* -+ * The SRAM is being configured in two steps. First we -+ * set the SRAM size in the BCR25:SRAM_SIZE bits. According -+ * to the datasheet, each bit corresponds to a 512-byte -+ * page so we can have at most 24 pages. The SRAM_SIZE -+ * holds the value of the upper 8 bits of the 16-bit SRAM size. -+ * The low 8-bits start at 0x00 and end at 0xff. So the -+ * address range is from 0x0000 up to 0x17ff. Therefore, -+ * the SRAM_SIZE is set to 0x17. The next step is to set -+ * the BCR26:SRAM_BND midway through so the Tx and Rx -+ * buffers can share the SRAM equally. -+ */ -+ a->write_bcr(ioaddr, 25, 0x17); -+ a->write_bcr(ioaddr, 26, 0xc); -+ /* And finally enable the NOUFLO bit */ -+ a->write_bcr(ioaddr, 18, a->read_bcr(ioaddr, 18) | (1 << 11)); -+ } -+ - dev = alloc_etherdev(sizeof(*lp)); - if (!dev) { - ret = -ENOMEM; -diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c -index e6660d692008..ec0d32ad7592 100644 ---- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c -+++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c -@@ -541,7 +541,7 @@ static int iwl_mvm_mac_add_interface(struct ieee80211_hw *hw, - - ret = iwl_mvm_mac_ctxt_add(mvm, vif); - if (ret) -- goto out_remove_mac; -+ goto out_release; - - /* - * Update power state on the new interface. Admittedly, based on -diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c -index cfd49eca67aa..c81716042073 100644 ---- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c -+++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c -@@ -1465,7 +1465,7 @@ static int tcm_qla2xxx_check_initiator_node_acl( - /* - * Finally register the new FC Nexus with TCM - */ -- __transport_register_session(se_nacl->se_tpg, se_nacl, se_sess, sess); -+ transport_register_session(se_nacl->se_tpg, se_nacl, se_sess, sess); - - return 0; - } -diff --git a/drivers/staging/vt6655/rf.c b/drivers/staging/vt6655/rf.c -index 6948984a25ab..c2d602825422 100644 ---- a/drivers/staging/vt6655/rf.c -+++ b/drivers/staging/vt6655/rf.c -@@ -966,6 +966,7 @@ bool RFbSetPower( - break; - case RATE_6M: - case RATE_9M: -+ case RATE_12M: - case RATE_18M: - byPwr = pDevice->abyOFDMPwrTbl[uCH]; - if (pDevice->byRFType == RF_UW2452) { -diff --git a/drivers/target/tcm_fc/tfc_io.c b/drivers/target/tcm_fc/tfc_io.c -index e415af32115a..c67d3795db4a 100644 ---- a/drivers/target/tcm_fc/tfc_io.c -+++ b/drivers/target/tcm_fc/tfc_io.c -@@ -346,7 +346,7 @@ void ft_invl_hw_context(struct ft_cmd *cmd) - ep = fc_seq_exch(seq); - if (ep) { - lport = ep->lp; -- if (lport && (ep->xid <= lport->lro_xid)) -+ if (lport && (ep->xid <= lport->lro_xid)) { - /* - * "ddp_done" trigger invalidation of HW - * specific DDP context -@@ -361,6 +361,7 @@ void ft_invl_hw_context(struct ft_cmd *cmd) - * identified using ep->xid) - */ - cmd->was_ddp_setup = 0; -+ } - } - } - } -diff --git a/fs/hfsplus/brec.c b/fs/hfsplus/brec.c -index 6e560d56094b..754fdf8c6356 100644 ---- a/fs/hfsplus/brec.c -+++ b/fs/hfsplus/brec.c -@@ -131,13 +131,16 @@ skip: - hfs_bnode_write(node, entry, data_off + key_len, entry_len); - hfs_bnode_dump(node); - -- if (new_node) { -- /* update parent key if we inserted a key -- * at the start of the first node -- */ -- if (!rec && new_node != node) -- hfs_brec_update_parent(fd); -+ /* -+ * update parent key if we inserted a key -+ * at the start of the node and it is not the new node -+ */ -+ if (!rec && new_node != node) { -+ hfs_bnode_read_key(node, fd->search_key, data_off + size); -+ hfs_brec_update_parent(fd); -+ } - -+ if (new_node) { - hfs_bnode_put(fd->bnode); - if (!new_node->parent) { - hfs_btree_inc_height(tree); -@@ -168,9 +171,6 @@ skip: - goto again; - } - -- if (!rec) -- hfs_brec_update_parent(fd); -- - return 0; - } - -@@ -370,6 +370,8 @@ again: - if (IS_ERR(parent)) - return PTR_ERR(parent); - __hfs_brec_find(parent, fd, hfs_find_rec_by_key); -+ if (fd->record < 0) -+ return -ENOENT; - hfs_bnode_dump(parent); - rec = fd->record; - -diff --git a/kernel/events/core.c b/kernel/events/core.c -index 7bf4d519c20f..7daf52c340cd 100644 ---- a/kernel/events/core.c -+++ b/kernel/events/core.c -@@ -4007,6 +4007,13 @@ static void perf_pending_event(struct irq_work *entry) - { - struct perf_event *event = container_of(entry, - struct perf_event, pending); -+ int rctx; -+ -+ rctx = perf_swevent_get_recursion_context(); -+ /* -+ * If we 'fail' here, that's OK, it means recursion is already disabled -+ * and we won't recurse 'further'. -+ */ - - if (event->pending_disable) { - event->pending_disable = 0; -@@ -4017,6 +4024,9 @@ static void perf_pending_event(struct irq_work *entry) - event->pending_wakeup = 0; - perf_event_wakeup(event); - } -+ -+ if (rctx >= 0) -+ perf_swevent_put_recursion_context(rctx); - } - - /* -diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h -index 845563b81a0f..9f0ea9d8be73 100644 ---- a/net/mac80211/ieee80211_i.h -+++ b/net/mac80211/ieee80211_i.h -@@ -60,13 +60,24 @@ struct ieee80211_local; - #define IEEE80211_UNSET_POWER_LEVEL INT_MIN - - /* -- * Some APs experience problems when working with U-APSD. Decrease the -- * probability of that happening by using legacy mode for all ACs but VO. -- * The AP that caused us trouble was a Cisco 4410N. It ignores our -- * setting, and always treats non-VO ACs as legacy. -+ * Some APs experience problems when working with U-APSD. Decreasing the -+ * probability of that happening by using legacy mode for all ACs but VO isn't -+ * enough. -+ * -+ * Cisco 4410N originally forced us to enable VO by default only because it -+ * treated non-VO ACs as legacy. -+ * -+ * However some APs (notably Netgear R7000) silently reclassify packets to -+ * different ACs. Since u-APSD ACs require trigger frames for frame retrieval -+ * clients would never see some frames (e.g. ARP responses) or would fetch them -+ * accidentally after a long time. -+ * -+ * It makes little sense to enable u-APSD queues by default because it needs -+ * userspace applications to be aware of it to actually take advantage of the -+ * possible additional powersavings. Implicitly depending on driver autotrigger -+ * frame support doesn't make much sense. - */ --#define IEEE80211_DEFAULT_UAPSD_QUEUES \ -- IEEE80211_WMM_IE_STA_QOSINFO_AC_VO -+#define IEEE80211_DEFAULT_UAPSD_QUEUES 0 - - #define IEEE80211_DEFAULT_MAX_SP_LEN \ - IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL -diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c -index 9299a38c372e..cd60be8d9aba 100644 ---- a/net/mac80211/rx.c -+++ b/net/mac80211/rx.c -@@ -2023,6 +2023,9 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx) - hdr = (struct ieee80211_hdr *) skb->data; - mesh_hdr = (struct ieee80211s_hdr *) (skb->data + hdrlen); - -+ if (ieee80211_drop_unencrypted(rx, hdr->frame_control)) -+ return RX_DROP_MONITOR; -+ - /* frame is in RMC, don't forward */ - if (ieee80211_is_data(hdr->frame_control) && - is_multicast_ether_addr(hdr->addr1) && -diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c -index dc200bf831ae..90a0e552cb32 100644 ---- a/net/wireless/nl80211.c -+++ b/net/wireless/nl80211.c -@@ -4032,6 +4032,16 @@ static int nl80211_new_station(struct sk_buff *skb, struct genl_info *info) - if (parse_station_flags(info, dev->ieee80211_ptr->iftype, ¶ms)) - return -EINVAL; - -+ /* HT/VHT requires QoS, but if we don't have that just ignore HT/VHT -+ * as userspace might just pass through the capabilities from the IEs -+ * directly, rather than enforcing this restriction and returning an -+ * error in this case. -+ */ -+ if (!(params.sta_flags_set & BIT(NL80211_STA_FLAG_WME))) { -+ params.ht_capa = NULL; -+ params.vht_capa = NULL; -+ } -+ - /* When you run into this, adjust the code below for the new flag */ - BUILD_BUG_ON(NL80211_STA_FLAG_MAX != 7); - -diff --git a/sound/soc/codecs/adav80x.c b/sound/soc/codecs/adav80x.c -index 3c839cc4e00e..0ef2b2a33ee5 100644 ---- a/sound/soc/codecs/adav80x.c -+++ b/sound/soc/codecs/adav80x.c -@@ -307,7 +307,7 @@ static int adav80x_put_deemph(struct snd_kcontrol *kcontrol, - { - struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); - struct adav80x *adav80x = snd_soc_codec_get_drvdata(codec); -- unsigned int deemph = ucontrol->value.enumerated.item[0]; -+ unsigned int deemph = ucontrol->value.integer.value[0]; - - if (deemph > 1) - return -EINVAL; -@@ -323,7 +323,7 @@ static int adav80x_get_deemph(struct snd_kcontrol *kcontrol, - struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); - struct adav80x *adav80x = snd_soc_codec_get_drvdata(codec); - -- ucontrol->value.enumerated.item[0] = adav80x->deemph; -+ ucontrol->value.integer.value[0] = adav80x->deemph; - return 0; - }; - -diff --git a/sound/soc/codecs/ak4641.c b/sound/soc/codecs/ak4641.c -index 5f9af1fb76e8..68379c14720b 100644 ---- a/sound/soc/codecs/ak4641.c -+++ b/sound/soc/codecs/ak4641.c -@@ -74,7 +74,7 @@ static int ak4641_put_deemph(struct snd_kcontrol *kcontrol, - { - struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); - struct ak4641_priv *ak4641 = snd_soc_codec_get_drvdata(codec); -- int deemph = ucontrol->value.enumerated.item[0]; -+ int deemph = ucontrol->value.integer.value[0]; - - if (deemph > 1) - return -EINVAL; -@@ -90,7 +90,7 @@ static int ak4641_get_deemph(struct snd_kcontrol *kcontrol, - struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); - struct ak4641_priv *ak4641 = snd_soc_codec_get_drvdata(codec); - -- ucontrol->value.enumerated.item[0] = ak4641->deemph; -+ ucontrol->value.integer.value[0] = ak4641->deemph; - return 0; - }; - -diff --git a/sound/soc/codecs/cs4271.c b/sound/soc/codecs/cs4271.c -index 03036b326732..ffa4a2d8a4bc 100644 ---- a/sound/soc/codecs/cs4271.c -+++ b/sound/soc/codecs/cs4271.c -@@ -267,7 +267,7 @@ static int cs4271_get_deemph(struct snd_kcontrol *kcontrol, - struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); - struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec); - -- ucontrol->value.enumerated.item[0] = cs4271->deemph; -+ ucontrol->value.integer.value[0] = cs4271->deemph; - return 0; - } - -@@ -277,7 +277,7 @@ static int cs4271_put_deemph(struct snd_kcontrol *kcontrol, - struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); - struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec); - -- cs4271->deemph = ucontrol->value.enumerated.item[0]; -+ cs4271->deemph = ucontrol->value.integer.value[0]; - return cs4271_set_deemph(codec); - } - -diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c -index 3b5f565a23a5..665e0ddc2ef0 100644 ---- a/sound/soc/codecs/sgtl5000.c -+++ b/sound/soc/codecs/sgtl5000.c -@@ -1111,13 +1111,7 @@ static int sgtl5000_set_power_regs(struct snd_soc_codec *codec) - /* Enable VDDC charge pump */ - ana_pwr |= SGTL5000_VDDC_CHRGPMP_POWERUP; - } else if (vddio >= 3100 && vdda >= 3100) { -- /* -- * if vddio and vddd > 3.1v, -- * charge pump should be clean before set ana_pwr -- */ -- snd_soc_update_bits(codec, SGTL5000_CHIP_ANA_POWER, -- SGTL5000_VDDC_CHRGPMP_POWERUP, 0); -- -+ ana_pwr &= ~SGTL5000_VDDC_CHRGPMP_POWERUP; - /* VDDC use VDDIO rail */ - lreg_ctrl |= SGTL5000_VDDC_ASSN_OVRD; - lreg_ctrl |= SGTL5000_VDDC_MAN_ASSN_VDDIO << -diff --git a/sound/soc/codecs/tas5086.c b/sound/soc/codecs/tas5086.c -index d447c4aa1d5e..675a8fd0deed 100644 ---- a/sound/soc/codecs/tas5086.c -+++ b/sound/soc/codecs/tas5086.c -@@ -173,7 +173,7 @@ static int tas5086_get_deemph(struct snd_kcontrol *kcontrol, - struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); - struct tas5086_private *priv = snd_soc_codec_get_drvdata(codec); - -- ucontrol->value.enumerated.item[0] = priv->deemph; -+ ucontrol->value.integer.value[0] = priv->deemph; - - return 0; - } -@@ -184,7 +184,7 @@ static int tas5086_put_deemph(struct snd_kcontrol *kcontrol, - struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); - struct tas5086_private *priv = snd_soc_codec_get_drvdata(codec); - -- priv->deemph = ucontrol->value.enumerated.item[0]; -+ priv->deemph = ucontrol->value.integer.value[0]; - - return tas5086_set_deemph(codec); - } -diff --git a/sound/soc/codecs/wm2000.c b/sound/soc/codecs/wm2000.c -index 7fefd766b582..124fb538dfa9 100644 ---- a/sound/soc/codecs/wm2000.c -+++ b/sound/soc/codecs/wm2000.c -@@ -605,7 +605,7 @@ static int wm2000_anc_mode_get(struct snd_kcontrol *kcontrol, - struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); - struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev); - -- ucontrol->value.enumerated.item[0] = wm2000->anc_active; -+ ucontrol->value.integer.value[0] = wm2000->anc_active; - - return 0; - } -@@ -615,7 +615,7 @@ static int wm2000_anc_mode_put(struct snd_kcontrol *kcontrol, - { - struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); - struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev); -- int anc_active = ucontrol->value.enumerated.item[0]; -+ int anc_active = ucontrol->value.integer.value[0]; - int ret; - - if (anc_active > 1) -@@ -638,7 +638,7 @@ static int wm2000_speaker_get(struct snd_kcontrol *kcontrol, - struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); - struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev); - -- ucontrol->value.enumerated.item[0] = wm2000->spk_ena; -+ ucontrol->value.integer.value[0] = wm2000->spk_ena; - - return 0; - } -@@ -648,7 +648,7 @@ static int wm2000_speaker_put(struct snd_kcontrol *kcontrol, - { - struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); - struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev); -- int val = ucontrol->value.enumerated.item[0]; -+ int val = ucontrol->value.integer.value[0]; - int ret; - - if (val > 1) -diff --git a/sound/soc/codecs/wm8731.c b/sound/soc/codecs/wm8731.c -index 10d492b6a5b4..944b09b1f481 100644 ---- a/sound/soc/codecs/wm8731.c -+++ b/sound/soc/codecs/wm8731.c -@@ -121,7 +121,7 @@ static int wm8731_get_deemph(struct snd_kcontrol *kcontrol, - struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); - struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(codec); - -- ucontrol->value.enumerated.item[0] = wm8731->deemph; -+ ucontrol->value.integer.value[0] = wm8731->deemph; - - return 0; - } -@@ -131,7 +131,7 @@ static int wm8731_put_deemph(struct snd_kcontrol *kcontrol, - { - struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); - struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(codec); -- int deemph = ucontrol->value.enumerated.item[0]; -+ int deemph = ucontrol->value.integer.value[0]; - int ret = 0; - - if (deemph > 1) -diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c -index 9d88437cdcd1..79f4a217b5d5 100644 ---- a/sound/soc/codecs/wm8903.c -+++ b/sound/soc/codecs/wm8903.c -@@ -446,7 +446,7 @@ static int wm8903_get_deemph(struct snd_kcontrol *kcontrol, - struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); - struct wm8903_priv *wm8903 = snd_soc_codec_get_drvdata(codec); - -- ucontrol->value.enumerated.item[0] = wm8903->deemph; -+ ucontrol->value.integer.value[0] = wm8903->deemph; - - return 0; - } -@@ -456,7 +456,7 @@ static int wm8903_put_deemph(struct snd_kcontrol *kcontrol, - { - struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); - struct wm8903_priv *wm8903 = snd_soc_codec_get_drvdata(codec); -- int deemph = ucontrol->value.enumerated.item[0]; -+ int deemph = ucontrol->value.integer.value[0]; - int ret = 0; - - if (deemph > 1) -diff --git a/sound/soc/codecs/wm8904.c b/sound/soc/codecs/wm8904.c -index af62f843a691..c68d541cd350 100644 ---- a/sound/soc/codecs/wm8904.c -+++ b/sound/soc/codecs/wm8904.c -@@ -523,7 +523,7 @@ static int wm8904_get_deemph(struct snd_kcontrol *kcontrol, - struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); - struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); - -- ucontrol->value.enumerated.item[0] = wm8904->deemph; -+ ucontrol->value.integer.value[0] = wm8904->deemph; - return 0; - } - -@@ -532,7 +532,7 @@ static int wm8904_put_deemph(struct snd_kcontrol *kcontrol, - { - struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); - struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); -- int deemph = ucontrol->value.enumerated.item[0]; -+ int deemph = ucontrol->value.integer.value[0]; - - if (deemph > 1) - return -EINVAL; -diff --git a/sound/soc/codecs/wm8955.c b/sound/soc/codecs/wm8955.c -index 82c8ba975720..1c1fc6119758 100644 ---- a/sound/soc/codecs/wm8955.c -+++ b/sound/soc/codecs/wm8955.c -@@ -393,7 +393,7 @@ static int wm8955_get_deemph(struct snd_kcontrol *kcontrol, - struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); - struct wm8955_priv *wm8955 = snd_soc_codec_get_drvdata(codec); - -- ucontrol->value.enumerated.item[0] = wm8955->deemph; -+ ucontrol->value.integer.value[0] = wm8955->deemph; - return 0; - } - -@@ -402,7 +402,7 @@ static int wm8955_put_deemph(struct snd_kcontrol *kcontrol, - { - struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); - struct wm8955_priv *wm8955 = snd_soc_codec_get_drvdata(codec); -- int deemph = ucontrol->value.enumerated.item[0]; -+ int deemph = ucontrol->value.integer.value[0]; - - if (deemph > 1) - return -EINVAL; -diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c -index 412d90f7b256..4a8decf85a4a 100644 ---- a/sound/soc/codecs/wm8960.c -+++ b/sound/soc/codecs/wm8960.c -@@ -181,7 +181,7 @@ static int wm8960_get_deemph(struct snd_kcontrol *kcontrol, - struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); - struct wm8960_priv *wm8960 = snd_soc_codec_get_drvdata(codec); - -- ucontrol->value.enumerated.item[0] = wm8960->deemph; -+ ucontrol->value.integer.value[0] = wm8960->deemph; - return 0; - } - -@@ -190,7 +190,7 @@ static int wm8960_put_deemph(struct snd_kcontrol *kcontrol, - { - struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); - struct wm8960_priv *wm8960 = snd_soc_codec_get_drvdata(codec); -- int deemph = ucontrol->value.enumerated.item[0]; -+ int deemph = ucontrol->value.integer.value[0]; - - if (deemph > 1) - return -EINVAL; diff --git a/patch/kernel/marvell-default/1-patch-3.10.74-75.patch b/patch/kernel/marvell-default/1-patch-3.10.74-75.patch deleted file mode 100644 index 01ac0ff0be..0000000000 --- a/patch/kernel/marvell-default/1-patch-3.10.74-75.patch +++ /dev/null @@ -1,748 +0,0 @@ -diff --git a/Makefile b/Makefile -index d2a3930159ea..87909d8302ad 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,6 +1,6 @@ - VERSION = 3 - PATCHLEVEL = 10 --SUBLEVEL = 74 -+SUBLEVEL = 75 - EXTRAVERSION = - NAME = TOSSUG Baby Fish - -diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c -index a88894190e41..c991fe680e58 100644 ---- a/drivers/acpi/processor_idle.c -+++ b/drivers/acpi/processor_idle.c -@@ -978,7 +978,7 @@ static int acpi_processor_setup_cpuidle_states(struct acpi_processor *pr) - return -EINVAL; - - drv->safe_state_index = -1; -- for (i = 0; i < CPUIDLE_STATE_MAX; i++) { -+ for (i = CPUIDLE_DRIVER_STATE_START; i < CPUIDLE_STATE_MAX; i++) { - drv->states[i].name[0] = '\0'; - drv->states[i].desc[0] = '\0'; - } -diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c -index cf1576d54363..a5c987ae665d 100644 ---- a/drivers/block/nbd.c -+++ b/drivers/block/nbd.c -@@ -815,10 +815,6 @@ static int __init nbd_init(void) - return -EINVAL; - } - -- nbd_dev = kcalloc(nbds_max, sizeof(*nbd_dev), GFP_KERNEL); -- if (!nbd_dev) -- return -ENOMEM; -- - part_shift = 0; - if (max_part > 0) { - part_shift = fls(max_part); -@@ -840,6 +836,10 @@ static int __init nbd_init(void) - if (nbds_max > 1UL << (MINORBITS - part_shift)) - return -EINVAL; - -+ nbd_dev = kcalloc(nbds_max, sizeof(*nbd_dev), GFP_KERNEL); -+ if (!nbd_dev) -+ return -ENOMEM; -+ - for (i = 0; i < nbds_max; i++) { - struct gendisk *disk = alloc_disk(1 << part_shift); - if (!disk) -diff --git a/drivers/dma/omap-dma.c b/drivers/dma/omap-dma.c -index ec3fc4fd9160..b94a37630e36 100644 ---- a/drivers/dma/omap-dma.c -+++ b/drivers/dma/omap-dma.c -@@ -487,6 +487,7 @@ static int omap_dma_terminate_all(struct omap_chan *c) - * c->desc is NULL and exit.) - */ - if (c->desc) { -+ omap_dma_desc_free(&c->desc->vd); - c->desc = NULL; - /* Avoid stopping the dma twice */ - if (!c->paused) -diff --git a/drivers/gpu/drm/radeon/radeon_bios.c b/drivers/gpu/drm/radeon/radeon_bios.c -index b131520521e4..72b02483ff03 100644 ---- a/drivers/gpu/drm/radeon/radeon_bios.c -+++ b/drivers/gpu/drm/radeon/radeon_bios.c -@@ -76,7 +76,7 @@ static bool igp_read_bios_from_vram(struct radeon_device *rdev) - - static bool radeon_read_bios(struct radeon_device *rdev) - { -- uint8_t __iomem *bios; -+ uint8_t __iomem *bios, val1, val2; - size_t size; - - rdev->bios = NULL; -@@ -86,15 +86,19 @@ static bool radeon_read_bios(struct radeon_device *rdev) - return false; - } - -- if (size == 0 || bios[0] != 0x55 || bios[1] != 0xaa) { -+ val1 = readb(&bios[0]); -+ val2 = readb(&bios[1]); -+ -+ if (size == 0 || val1 != 0x55 || val2 != 0xaa) { - pci_unmap_rom(rdev->pdev, bios); - return false; - } -- rdev->bios = kmemdup(bios, size, GFP_KERNEL); -+ rdev->bios = kzalloc(size, GFP_KERNEL); - if (rdev->bios == NULL) { - pci_unmap_rom(rdev->pdev, bios); - return false; - } -+ memcpy_fromio(rdev->bios, bios, size); - pci_unmap_rom(rdev->pdev, bios); - return true; - } -diff --git a/drivers/iio/imu/adis_trigger.c b/drivers/iio/imu/adis_trigger.c -index e0017c22bb9c..f53e9a803a0e 100644 ---- a/drivers/iio/imu/adis_trigger.c -+++ b/drivers/iio/imu/adis_trigger.c -@@ -60,7 +60,7 @@ int adis_probe_trigger(struct adis *adis, struct iio_dev *indio_dev) - iio_trigger_set_drvdata(adis->trig, adis); - ret = iio_trigger_register(adis->trig); - -- indio_dev->trig = adis->trig; -+ indio_dev->trig = iio_trigger_get(adis->trig); - if (ret) - goto error_free_irq; - -diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c -index 7da0832f187b..01d661e0fa6c 100644 ---- a/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c -+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c -@@ -25,6 +25,16 @@ - #include - #include "inv_mpu_iio.h" - -+static void inv_clear_kfifo(struct inv_mpu6050_state *st) -+{ -+ unsigned long flags; -+ -+ /* take the spin lock sem to avoid interrupt kick in */ -+ spin_lock_irqsave(&st->time_stamp_lock, flags); -+ kfifo_reset(&st->timestamps); -+ spin_unlock_irqrestore(&st->time_stamp_lock, flags); -+} -+ - int inv_reset_fifo(struct iio_dev *indio_dev) - { - int result; -@@ -51,6 +61,10 @@ int inv_reset_fifo(struct iio_dev *indio_dev) - INV_MPU6050_BIT_FIFO_RST); - if (result) - goto reset_fifo_fail; -+ -+ /* clear timestamps fifo */ -+ inv_clear_kfifo(st); -+ - /* enable interrupt */ - if (st->chip_config.accl_fifo_enable || - st->chip_config.gyro_fifo_enable) { -@@ -84,16 +98,6 @@ reset_fifo_fail: - return result; - } - --static void inv_clear_kfifo(struct inv_mpu6050_state *st) --{ -- unsigned long flags; -- -- /* take the spin lock sem to avoid interrupt kick in */ -- spin_lock_irqsave(&st->time_stamp_lock, flags); -- kfifo_reset(&st->timestamps); -- spin_unlock_irqrestore(&st->time_stamp_lock, flags); --} -- - /** - * inv_mpu6050_irq_handler() - Cache a timestamp at each data ready interrupt. - */ -@@ -187,7 +191,6 @@ end_session: - flush_fifo: - /* Flush HW and SW FIFOs. */ - inv_reset_fifo(indio_dev); -- inv_clear_kfifo(st); - mutex_unlock(&indio_dev->mlock); - iio_trigger_notify_done(indio_dev->trig); - -diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c -index a84112322071..055ebebc07dd 100644 ---- a/drivers/infiniband/core/umem.c -+++ b/drivers/infiniband/core/umem.c -@@ -94,6 +94,14 @@ struct ib_umem *ib_umem_get(struct ib_ucontext *context, unsigned long addr, - if (dmasync) - dma_set_attr(DMA_ATTR_WRITE_BARRIER, &attrs); - -+ /* -+ * If the combination of the addr and size requested for this memory -+ * region causes an integer overflow, return error. -+ */ -+ if ((PAGE_ALIGN(addr + size) <= size) || -+ (PAGE_ALIGN(addr + size) <= addr)) -+ return ERR_PTR(-EINVAL); -+ - if (!can_do_mlock()) - return ERR_PTR(-EPERM); - -diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c -index 2c6f0f2ecd9d..949b38633496 100644 ---- a/drivers/infiniband/core/uverbs_main.c -+++ b/drivers/infiniband/core/uverbs_main.c -@@ -460,6 +460,7 @@ static void ib_uverbs_async_handler(struct ib_uverbs_file *file, - - entry->desc.async.element = element; - entry->desc.async.event_type = event; -+ entry->desc.async.reserved = 0; - entry->counter = counter; - - list_add_tail(&entry->list, &file->async_file->event_list); -diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c -index 4d599cedbb0b..6ee534874535 100644 ---- a/drivers/infiniband/hw/mlx4/mad.c -+++ b/drivers/infiniband/hw/mlx4/mad.c -@@ -64,6 +64,14 @@ enum { - #define GUID_TBL_BLK_NUM_ENTRIES 8 - #define GUID_TBL_BLK_SIZE (GUID_TBL_ENTRY_SIZE * GUID_TBL_BLK_NUM_ENTRIES) - -+/* Counters should be saturate once they reach their maximum value */ -+#define ASSIGN_32BIT_COUNTER(counter, value) do {\ -+ if ((value) > U32_MAX) \ -+ counter = cpu_to_be32(U32_MAX); \ -+ else \ -+ counter = cpu_to_be32(value); \ -+} while (0) -+ - struct mlx4_mad_rcv_buf { - struct ib_grh grh; - u8 payload[256]; -@@ -730,10 +738,14 @@ static int ib_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num, - static void edit_counter(struct mlx4_counter *cnt, - struct ib_pma_portcounters *pma_cnt) - { -- pma_cnt->port_xmit_data = cpu_to_be32((be64_to_cpu(cnt->tx_bytes)>>2)); -- pma_cnt->port_rcv_data = cpu_to_be32((be64_to_cpu(cnt->rx_bytes)>>2)); -- pma_cnt->port_xmit_packets = cpu_to_be32(be64_to_cpu(cnt->tx_frames)); -- pma_cnt->port_rcv_packets = cpu_to_be32(be64_to_cpu(cnt->rx_frames)); -+ ASSIGN_32BIT_COUNTER(pma_cnt->port_xmit_data, -+ (be64_to_cpu(cnt->tx_bytes) >> 2)); -+ ASSIGN_32BIT_COUNTER(pma_cnt->port_rcv_data, -+ (be64_to_cpu(cnt->rx_bytes) >> 2)); -+ ASSIGN_32BIT_COUNTER(pma_cnt->port_xmit_packets, -+ be64_to_cpu(cnt->tx_frames)); -+ ASSIGN_32BIT_COUNTER(pma_cnt->port_rcv_packets, -+ be64_to_cpu(cnt->rx_frames)); - } - - static int iboe_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num, -diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h -index f804c1faa7ff..d3b54f7b849f 100644 ---- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h -+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h -@@ -29,7 +29,7 @@ - - /* Offset base used to differentiate between CAPTURE and OUTPUT - * while mmaping */ --#define DST_QUEUE_OFF_BASE (TASK_SIZE / 2) -+#define DST_QUEUE_OFF_BASE (1 << 30) - - #define MFC_BANK1_ALLOC_CTX 0 - #define MFC_BANK2_ALLOC_CTX 1 -diff --git a/drivers/net/wireless/iwlwifi/dvm/dev.h b/drivers/net/wireless/iwlwifi/dvm/dev.h -index 71ea77576d22..e783ea0e3837 100644 ---- a/drivers/net/wireless/iwlwifi/dvm/dev.h -+++ b/drivers/net/wireless/iwlwifi/dvm/dev.h -@@ -670,7 +670,6 @@ struct iwl_priv { - unsigned long reload_jiffies; - int reload_count; - bool ucode_loaded; -- bool init_ucode_run; /* Don't run init uCode again */ - - u8 plcp_delta_threshold; - -diff --git a/drivers/net/wireless/iwlwifi/dvm/ucode.c b/drivers/net/wireless/iwlwifi/dvm/ucode.c -index 0a1cdc5e856b..5ad94a8080b8 100644 ---- a/drivers/net/wireless/iwlwifi/dvm/ucode.c -+++ b/drivers/net/wireless/iwlwifi/dvm/ucode.c -@@ -425,9 +425,6 @@ int iwl_run_init_ucode(struct iwl_priv *priv) - if (!priv->fw->img[IWL_UCODE_INIT].sec[0].len) - return 0; - -- if (priv->init_ucode_run) -- return 0; -- - iwl_init_notification_wait(&priv->notif_wait, &calib_wait, - calib_complete, ARRAY_SIZE(calib_complete), - iwlagn_wait_calib, priv); -@@ -447,8 +444,6 @@ int iwl_run_init_ucode(struct iwl_priv *priv) - */ - ret = iwl_wait_notification(&priv->notif_wait, &calib_wait, - UCODE_CALIB_TIMEOUT); -- if (!ret) -- priv->init_ucode_run = true; - - goto out; - -diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c -index 1ad39c799c74..bfe812fcce34 100644 ---- a/drivers/scsi/be2iscsi/be_main.c -+++ b/drivers/scsi/be2iscsi/be_main.c -@@ -5080,9 +5080,9 @@ free_port: - hba_free: - if (phba->msix_enabled) - pci_disable_msix(phba->pcidev); -- iscsi_host_remove(phba->shost); - pci_dev_put(phba->pcidev); - iscsi_host_free(phba->shost); -+ pci_set_drvdata(pcidev, NULL); - disable_pci: - pci_disable_device(pcidev); - return ret; -diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c -index e5953c8018c5..9f3168e8e5a8 100644 ---- a/drivers/scsi/scsi_lib.c -+++ b/drivers/scsi/scsi_lib.c -@@ -1242,9 +1242,11 @@ int scsi_prep_state_check(struct scsi_device *sdev, struct request *req) - "rejecting I/O to dead device\n"); - ret = BLKPREP_KILL; - break; -- case SDEV_QUIESCE: - case SDEV_BLOCK: - case SDEV_CREATED_BLOCK: -+ ret = BLKPREP_DEFER; -+ break; -+ case SDEV_QUIESCE: - /* - * If the devices is blocked we defer normal commands. - */ -diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c -index 9559ea749d83..5a3ea20e9cb5 100644 ---- a/drivers/target/iscsi/iscsi_target.c -+++ b/drivers/target/iscsi/iscsi_target.c -@@ -1179,7 +1179,7 @@ iscsit_handle_scsi_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, - * traditional iSCSI block I/O. - */ - if (iscsit_allocate_iovecs(cmd) < 0) { -- return iscsit_add_reject_cmd(cmd, -+ return iscsit_reject_cmd(cmd, - ISCSI_REASON_BOOKMARK_NO_RESOURCES, buf); - } - immed_data = cmd->immediate_data; -diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c -index 0e57bcb8e3f7..2320e20d5be7 100644 ---- a/drivers/usb/host/xhci-pci.c -+++ b/drivers/usb/host/xhci-pci.c -@@ -94,6 +94,7 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) - if (pdev->vendor == PCI_VENDOR_ID_INTEL) { - xhci->quirks |= XHCI_LPM_SUPPORT; - xhci->quirks |= XHCI_INTEL_HOST; -+ xhci->quirks |= XHCI_AVOID_BEI; - } - if (pdev->vendor == PCI_VENDOR_ID_INTEL && - pdev->device == PCI_DEVICE_ID_INTEL_PANTHERPOINT_XHCI) { -@@ -109,7 +110,6 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) - * PPT chipsets. - */ - xhci->quirks |= XHCI_SPURIOUS_REBOOT; -- xhci->quirks |= XHCI_AVOID_BEI; - } - if (pdev->vendor == PCI_VENDOR_ID_ETRON && - pdev->device == PCI_DEVICE_ID_ASROCK_P67) { -diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c -index cf127a080644..4d918d5f945a 100644 ---- a/drivers/usb/serial/ftdi_sio.c -+++ b/drivers/usb/serial/ftdi_sio.c -@@ -620,6 +620,7 @@ static struct usb_device_id id_table_combined [] = { - .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, - { USB_DEVICE(FTDI_VID, FTDI_NT_ORIONLXM_PID), - .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, -+ { USB_DEVICE(FTDI_VID, FTDI_SYNAPSE_SS200_PID) }, - /* - * ELV devices: - */ -@@ -1899,8 +1900,12 @@ static int ftdi_8u2232c_probe(struct usb_serial *serial) - { - struct usb_device *udev = serial->dev; - -- if ((udev->manufacturer && !strcmp(udev->manufacturer, "CALAO Systems")) || -- (udev->product && !strcmp(udev->product, "BeagleBone/XDS100V2"))) -+ if (udev->manufacturer && !strcmp(udev->manufacturer, "CALAO Systems")) -+ return ftdi_jtag_probe(serial); -+ -+ if (udev->product && -+ (!strcmp(udev->product, "BeagleBone/XDS100V2") || -+ !strcmp(udev->product, "SNAP Connect E10"))) - return ftdi_jtag_probe(serial); - - return 0; -diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h -index e8d352615297..e906b6aa2424 100644 ---- a/drivers/usb/serial/ftdi_sio_ids.h -+++ b/drivers/usb/serial/ftdi_sio_ids.h -@@ -561,6 +561,12 @@ - */ - #define FTDI_NT_ORIONLXM_PID 0x7c90 /* OrionLXm Substation Automation Platform */ - -+/* -+ * Synapse Wireless product ids (FTDI_VID) -+ * http://www.synapse-wireless.com -+ */ -+#define FTDI_SYNAPSE_SS200_PID 0x9090 /* SS200 - SNAP Stick 200 */ -+ - - /********************************/ - /** third-party VID/PID combos **/ -diff --git a/fs/cifs/file.c b/fs/cifs/file.c -index 5fcc10fa62bd..f4a8577c3e91 100644 ---- a/fs/cifs/file.c -+++ b/fs/cifs/file.c -@@ -1789,6 +1789,7 @@ refind_writable: - cifsFileInfo_put(inv_file); - spin_lock(&cifs_file_list_lock); - ++refind; -+ inv_file = NULL; - goto refind_writable; - } - } -diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c -index 46387e49aa46..8cd6474e248f 100644 ---- a/fs/ocfs2/file.c -+++ b/fs/ocfs2/file.c -@@ -2372,10 +2372,14 @@ out_dio: - /* buffered aio wouldn't have proper lock coverage today */ - BUG_ON(ret == -EIOCBQUEUED && !(file->f_flags & O_DIRECT)); - -+ if (unlikely(written <= 0)) -+ goto no_sync; -+ - if (((file->f_flags & O_DSYNC) && !direct_io) || IS_SYNC(inode) || - ((file->f_flags & O_DIRECT) && !direct_io)) { -- ret = filemap_fdatawrite_range(file->f_mapping, *ppos, -- *ppos + count - 1); -+ ret = filemap_fdatawrite_range(file->f_mapping, -+ iocb->ki_pos - written, -+ iocb->ki_pos - 1); - if (ret < 0) - written = ret; - -@@ -2388,10 +2392,12 @@ out_dio: - } - - if (!ret) -- ret = filemap_fdatawait_range(file->f_mapping, *ppos, -- *ppos + count - 1); -+ ret = filemap_fdatawait_range(file->f_mapping, -+ iocb->ki_pos - written, -+ iocb->ki_pos - 1); - } - -+no_sync: - /* - * deep in g_f_a_w_n()->ocfs2_direct_IO we pass in a ocfs2_dio_end_io - * function pointer which is called when o_direct io completes so that -diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c -index 65fc60a07c47..9f285fb9bab3 100644 ---- a/fs/proc/task_mmu.c -+++ b/fs/proc/task_mmu.c -@@ -1110,9 +1110,19 @@ out: - return ret; - } - -+static int pagemap_open(struct inode *inode, struct file *file) -+{ -+ /* do not disclose physical addresses to unprivileged -+ userspace (closes a rowhammer attack vector) */ -+ if (!capable(CAP_SYS_ADMIN)) -+ return -EPERM; -+ return 0; -+} -+ - const struct file_operations proc_pagemap_operations = { - .llseek = mem_lseek, /* borrow this */ - .read = pagemap_read, -+ .open = pagemap_open, - }; - #endif /* CONFIG_PROC_PAGE_MONITOR */ - -diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h -index fa1abeb45b76..49c48dda162d 100644 ---- a/include/linux/blk_types.h -+++ b/include/linux/blk_types.h -@@ -170,7 +170,9 @@ enum rq_flag_bits { - __REQ_ELVPRIV, /* elevator private data attached */ - __REQ_FAILED, /* set if the request failed */ - __REQ_QUIET, /* don't worry about errors */ -- __REQ_PREEMPT, /* set for "ide_preempt" requests */ -+ __REQ_PREEMPT, /* set for "ide_preempt" requests and also -+ for requests for which the SCSI "quiesce" -+ state must be ignored. */ - __REQ_ALLOCED, /* request came from our alloc pool */ - __REQ_COPY_USER, /* contains copies of user pages */ - __REQ_FLUSH_SEQ, /* request for flush sequence */ -diff --git a/include/linux/kernel.h b/include/linux/kernel.h -index e9ef6d6b51d5..341551c7b4c8 100644 ---- a/include/linux/kernel.h -+++ b/include/linux/kernel.h -@@ -29,6 +29,19 @@ - #define ULLONG_MAX (~0ULL) - #define SIZE_MAX (~(size_t)0) - -+#define U8_MAX ((u8)~0U) -+#define S8_MAX ((s8)(U8_MAX>>1)) -+#define S8_MIN ((s8)(-S8_MAX - 1)) -+#define U16_MAX ((u16)~0U) -+#define S16_MAX ((s16)(U16_MAX>>1)) -+#define S16_MIN ((s16)(-S16_MAX - 1)) -+#define U32_MAX ((u32)~0U) -+#define S32_MAX ((s32)(U32_MAX>>1)) -+#define S32_MIN ((s32)(-S32_MAX - 1)) -+#define U64_MAX ((u64)~0ULL) -+#define S64_MAX ((s64)(U64_MAX>>1)) -+#define S64_MIN ((s64)(-S64_MAX - 1)) -+ - #define STACK_MAGIC 0xdeadbeef - - #define REPEAT_BYTE(x) ((~0ul / 0xff) * (x)) -diff --git a/ipc/compat.c b/ipc/compat.c -index 892f6585dd60..d3b376025e9b 100644 ---- a/ipc/compat.c -+++ b/ipc/compat.c -@@ -381,7 +381,7 @@ COMPAT_SYSCALL_DEFINE6(ipc, u32, call, int, first, int, second, - uptr = compat_ptr(ipck.msgp); - fifth = ipck.msgtyp; - } -- return do_msgrcv(first, uptr, second, fifth, third, -+ return do_msgrcv(first, uptr, second, (s32)fifth, third, - compat_do_msg_fill); - } - case MSGGET: -diff --git a/kernel/printk.c b/kernel/printk.c -index f7aff4bd5454..fd0154a57d6e 100644 ---- a/kernel/printk.c -+++ b/kernel/printk.c -@@ -107,7 +107,7 @@ static struct console *exclusive_console; - */ - struct console_cmdline - { -- char name[8]; /* Name of the driver */ -+ char name[16]; /* Name of the driver */ - int index; /* Minor dev. to use */ - char *options; /* Options for the driver */ - #ifdef CONFIG_A11Y_BRAILLE_CONSOLE -@@ -2290,6 +2290,8 @@ void register_console(struct console *newcon) - */ - for (i = 0; i < MAX_CMDLINECONSOLES && console_cmdline[i].name[0]; - i++) { -+ BUILD_BUG_ON(sizeof(console_cmdline[i].name) != -+ sizeof(newcon->name)); - if (strcmp(console_cmdline[i].name, newcon->name) != 0) - continue; - if (newcon->index >= 0 && -diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c -index 1ad92b46753e..2298237db142 100644 ---- a/mm/memory_hotplug.c -+++ b/mm/memory_hotplug.c -@@ -1039,6 +1039,10 @@ static pg_data_t __ref *hotadd_new_pgdat(int nid, u64 start) - return NULL; - - arch_refresh_nodedata(nid, pgdat); -+ } else { -+ /* Reset the nr_zones and classzone_idx to 0 before reuse */ -+ pgdat->nr_zones = 0; -+ pgdat->classzone_idx = 0; - } - - /* we can use NODE_DATA(nid) from here */ -@@ -1802,15 +1806,6 @@ void try_offline_node(int nid) - if (is_vmalloc_addr(zone->wait_table)) - vfree(zone->wait_table); - } -- -- /* -- * Since there is no way to guarentee the address of pgdat/zone is not -- * on stack of any kernel threads or used by other kernel objects -- * without reference counting or other symchronizing method, do not -- * reset node_data and free pgdat here. Just reset it to 0 and reuse -- * the memory when the node is online again. -- */ -- memset(pgdat, 0, sizeof(*pgdat)); - } - EXPORT_SYMBOL(try_offline_node); - -diff --git a/mm/page-writeback.c b/mm/page-writeback.c -index 73cbc5dc150b..b034f79deb0e 100644 ---- a/mm/page-writeback.c -+++ b/mm/page-writeback.c -@@ -793,8 +793,11 @@ static void bdi_update_write_bandwidth(struct backing_dev_info *bdi, - * bw * elapsed + write_bandwidth * (period - elapsed) - * write_bandwidth = --------------------------------------------------- - * period -+ * -+ * @written may have decreased due to account_page_redirty(). -+ * Avoid underflowing @bw calculation. - */ -- bw = written - bdi->written_stamp; -+ bw = written - min(written, bdi->written_stamp); - bw *= HZ; - if (unlikely(elapsed > period)) { - do_div(bw, elapsed); -@@ -858,7 +861,7 @@ static void global_update_bandwidth(unsigned long thresh, - unsigned long now) - { - static DEFINE_SPINLOCK(dirty_lock); -- static unsigned long update_time; -+ static unsigned long update_time = INITIAL_JIFFIES; - - /* - * check locklessly first to optimize away locking for the most time -diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c -index 913dc4f49b10..92b5e1f7d3b0 100644 ---- a/net/ipv4/tcp_output.c -+++ b/net/ipv4/tcp_output.c -@@ -2909,6 +2909,7 @@ static int tcp_send_syn_data(struct sock *sk, struct sk_buff *syn) - goto fallback; - syn_data->ip_summed = CHECKSUM_PARTIAL; - memcpy(syn_data->cb, syn->cb, sizeof(syn->cb)); -+ skb_shinfo(syn_data)->gso_segs = 1; - if (unlikely(memcpy_fromiovecend(skb_put(syn_data, space), - fo->data->msg_iov, 0, space))) { - kfree_skb(syn_data); -diff --git a/net/llc/sysctl_net_llc.c b/net/llc/sysctl_net_llc.c -index 612a5ddaf93b..799bafc2af39 100644 ---- a/net/llc/sysctl_net_llc.c -+++ b/net/llc/sysctl_net_llc.c -@@ -18,28 +18,28 @@ static struct ctl_table llc2_timeout_table[] = { - { - .procname = "ack", - .data = &sysctl_llc2_ack_timeout, -- .maxlen = sizeof(long), -+ .maxlen = sizeof(sysctl_llc2_ack_timeout), - .mode = 0644, - .proc_handler = proc_dointvec_jiffies, - }, - { - .procname = "busy", - .data = &sysctl_llc2_busy_timeout, -- .maxlen = sizeof(long), -+ .maxlen = sizeof(sysctl_llc2_busy_timeout), - .mode = 0644, - .proc_handler = proc_dointvec_jiffies, - }, - { - .procname = "p", - .data = &sysctl_llc2_p_timeout, -- .maxlen = sizeof(long), -+ .maxlen = sizeof(sysctl_llc2_p_timeout), - .mode = 0644, - .proc_handler = proc_dointvec_jiffies, - }, - { - .procname = "rej", - .data = &sysctl_llc2_rej_timeout, -- .maxlen = sizeof(long), -+ .maxlen = sizeof(sysctl_llc2_rej_timeout), - .mode = 0644, - .proc_handler = proc_dointvec_jiffies, - }, -diff --git a/net/netfilter/nfnetlink_queue_core.c b/net/netfilter/nfnetlink_queue_core.c -index 2b8199f68785..5497f50af2f0 100644 ---- a/net/netfilter/nfnetlink_queue_core.c -+++ b/net/netfilter/nfnetlink_queue_core.c -@@ -228,7 +228,7 @@ nfqnl_flush(struct nfqnl_instance *queue, nfqnl_cmpfn cmpfn, unsigned long data) - } - - static int --nfqnl_zcopy(struct sk_buff *to, const struct sk_buff *from, int len, int hlen) -+nfqnl_zcopy(struct sk_buff *to, struct sk_buff *from, int len, int hlen) - { - int i, j = 0; - int plen = 0; /* length of skb->head fragment */ -diff --git a/net/rds/sysctl.c b/net/rds/sysctl.c -index 907214b4c4d0..fc6cbe827856 100644 ---- a/net/rds/sysctl.c -+++ b/net/rds/sysctl.c -@@ -71,14 +71,14 @@ static ctl_table rds_sysctl_rds_table[] = { - { - .procname = "max_unacked_packets", - .data = &rds_sysctl_max_unacked_packets, -- .maxlen = sizeof(unsigned long), -+ .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = proc_dointvec, - }, - { - .procname = "max_unacked_bytes", - .data = &rds_sysctl_max_unacked_bytes, -- .maxlen = sizeof(unsigned long), -+ .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = proc_dointvec, - }, -diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c -index ff427733c290..464be51025f6 100644 ---- a/security/selinux/selinuxfs.c -+++ b/security/selinux/selinuxfs.c -@@ -150,7 +150,7 @@ static ssize_t sel_write_enforce(struct file *file, const char __user *buf, - goto out; - - /* No partial writes. */ -- length = EINVAL; -+ length = -EINVAL; - if (*ppos != 0) - goto out; - -diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c -index 4008034b6ebe..a8eb7fe2766e 100644 ---- a/sound/pci/hda/patch_realtek.c -+++ b/sound/pci/hda/patch_realtek.c -@@ -266,7 +266,7 @@ static void alc_auto_setup_eapd(struct hda_codec *codec, bool on) - { - /* We currently only handle front, HP */ - static hda_nid_t pins[] = { -- 0x0f, 0x10, 0x14, 0x15, 0 -+ 0x0f, 0x10, 0x14, 0x15, 0x17, 0 - }; - hda_nid_t *p; - for (p = pins; *p; p++) -@@ -3363,6 +3363,7 @@ enum { - ALC269_FIXUP_QUANTA_MUTE, - ALC269_FIXUP_LIFEBOOK, - ALC269_FIXUP_LIFEBOOK_EXTMIC, -+ ALC269_FIXUP_LIFEBOOK_HP_PIN, - ALC269_FIXUP_AMIC, - ALC269_FIXUP_DMIC, - ALC269VB_FIXUP_AMIC, -@@ -3477,6 +3478,13 @@ static const struct hda_fixup alc269_fixups[] = { - { } - }, - }, -+ [ALC269_FIXUP_LIFEBOOK_HP_PIN] = { -+ .type = HDA_FIXUP_PINS, -+ .v.pins = (const struct hda_pintbl[]) { -+ { 0x21, 0x0221102f }, /* HP out */ -+ { } -+ }, -+ }, - [ALC269_FIXUP_AMIC] = { - .type = HDA_FIXUP_PINS, - .v.pins = (const struct hda_pintbl[]) { -@@ -3727,6 +3735,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { - SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK), - SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC), - SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK), -+ SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN), - SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC), - SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE), - SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE), -diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c -index c89a5bf5c00e..c311681bd390 100644 ---- a/sound/usb/mixer_quirks.c -+++ b/sound/usb/mixer_quirks.c -@@ -175,6 +175,7 @@ static const struct rc_config { - { USB_ID(0x041e, 0x3040), 2, 2, 6, 6, 2, 0x6e91 }, /* Live! 24-bit */ - { USB_ID(0x041e, 0x3042), 0, 1, 1, 1, 1, 0x000d }, /* Usb X-Fi S51 */ - { USB_ID(0x041e, 0x30df), 0, 1, 1, 1, 1, 0x000d }, /* Usb X-Fi S51 Pro */ -+ { USB_ID(0x041e, 0x3237), 0, 1, 1, 1, 1, 0x000d }, /* Usb X-Fi S51 Pro */ - { USB_ID(0x041e, 0x3048), 2, 2, 6, 6, 2, 0x6e91 }, /* Toshiba SB0500 */ - }; - diff --git a/patch/kernel/marvell-default/1-patch-3.10.75-76.patch b/patch/kernel/marvell-default/1-patch-3.10.75-76.patch deleted file mode 100644 index 6293ff455a..0000000000 --- a/patch/kernel/marvell-default/1-patch-3.10.75-76.patch +++ /dev/null @@ -1,2030 +0,0 @@ -diff --git a/Makefile b/Makefile -index 87909d8302ad..019a6a4b386d 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,6 +1,6 @@ - VERSION = 3 - PATCHLEVEL = 10 --SUBLEVEL = 75 -+SUBLEVEL = 76 - EXTRAVERSION = - NAME = TOSSUG Baby Fish - -diff --git a/arch/alpha/mm/fault.c b/arch/alpha/mm/fault.c -index 98838a05ba6d..9d0ac091a52a 100644 ---- a/arch/alpha/mm/fault.c -+++ b/arch/alpha/mm/fault.c -@@ -156,6 +156,8 @@ retry: - if (unlikely(fault & VM_FAULT_ERROR)) { - if (fault & VM_FAULT_OOM) - goto out_of_memory; -+ else if (fault & VM_FAULT_SIGSEGV) -+ goto bad_area; - else if (fault & VM_FAULT_SIGBUS) - goto do_sigbus; - BUG(); -diff --git a/arch/arc/mm/fault.c b/arch/arc/mm/fault.c -index 50533b750a99..08f65bcf9130 100644 ---- a/arch/arc/mm/fault.c -+++ b/arch/arc/mm/fault.c -@@ -160,6 +160,8 @@ good_area: - /* TBD: switch to pagefault_out_of_memory() */ - if (fault & VM_FAULT_OOM) - goto out_of_memory; -+ else if (fault & VM_FAULT_SIGSEGV) -+ goto bad_area; - else if (fault & VM_FAULT_SIGBUS) - goto do_sigbus; - -diff --git a/arch/avr32/mm/fault.c b/arch/avr32/mm/fault.c -index 0eca93327195..d223a8b57c1e 100644 ---- a/arch/avr32/mm/fault.c -+++ b/arch/avr32/mm/fault.c -@@ -142,6 +142,8 @@ good_area: - if (unlikely(fault & VM_FAULT_ERROR)) { - if (fault & VM_FAULT_OOM) - goto out_of_memory; -+ else if (fault & VM_FAULT_SIGSEGV) -+ goto bad_area; - else if (fault & VM_FAULT_SIGBUS) - goto do_sigbus; - BUG(); -diff --git a/arch/cris/mm/fault.c b/arch/cris/mm/fault.c -index 1790f22e71a2..2686a7aa8ec8 100644 ---- a/arch/cris/mm/fault.c -+++ b/arch/cris/mm/fault.c -@@ -176,6 +176,8 @@ retry: - if (unlikely(fault & VM_FAULT_ERROR)) { - if (fault & VM_FAULT_OOM) - goto out_of_memory; -+ else if (fault & VM_FAULT_SIGSEGV) -+ goto bad_area; - else if (fault & VM_FAULT_SIGBUS) - goto do_sigbus; - BUG(); -diff --git a/arch/frv/mm/fault.c b/arch/frv/mm/fault.c -index 9a66372fc7c7..ec4917ddf678 100644 ---- a/arch/frv/mm/fault.c -+++ b/arch/frv/mm/fault.c -@@ -168,6 +168,8 @@ asmlinkage void do_page_fault(int datammu, unsigned long esr0, unsigned long ear - if (unlikely(fault & VM_FAULT_ERROR)) { - if (fault & VM_FAULT_OOM) - goto out_of_memory; -+ else if (fault & VM_FAULT_SIGSEGV) -+ goto bad_area; - else if (fault & VM_FAULT_SIGBUS) - goto do_sigbus; - BUG(); -diff --git a/arch/ia64/mm/fault.c b/arch/ia64/mm/fault.c -index 7225dad87094..ba5ba7accd0d 100644 ---- a/arch/ia64/mm/fault.c -+++ b/arch/ia64/mm/fault.c -@@ -172,6 +172,8 @@ retry: - */ - if (fault & VM_FAULT_OOM) { - goto out_of_memory; -+ } else if (fault & VM_FAULT_SIGSEGV) { -+ goto bad_area; - } else if (fault & VM_FAULT_SIGBUS) { - signal = SIGBUS; - goto bad_area; -diff --git a/arch/m32r/mm/fault.c b/arch/m32r/mm/fault.c -index e9c6a8014bd6..e3d4d4890104 100644 ---- a/arch/m32r/mm/fault.c -+++ b/arch/m32r/mm/fault.c -@@ -200,6 +200,8 @@ good_area: - if (unlikely(fault & VM_FAULT_ERROR)) { - if (fault & VM_FAULT_OOM) - goto out_of_memory; -+ else if (fault & VM_FAULT_SIGSEGV) -+ goto bad_area; - else if (fault & VM_FAULT_SIGBUS) - goto do_sigbus; - BUG(); -diff --git a/arch/m68k/mm/fault.c b/arch/m68k/mm/fault.c -index eb1d61f68725..f0eef0491f77 100644 ---- a/arch/m68k/mm/fault.c -+++ b/arch/m68k/mm/fault.c -@@ -153,6 +153,8 @@ good_area: - if (unlikely(fault & VM_FAULT_ERROR)) { - if (fault & VM_FAULT_OOM) - goto out_of_memory; -+ else if (fault & VM_FAULT_SIGSEGV) -+ goto map_err; - else if (fault & VM_FAULT_SIGBUS) - goto bus_err; - BUG(); -diff --git a/arch/metag/mm/fault.c b/arch/metag/mm/fault.c -index 332680e5ebf2..2de5dc695a87 100644 ---- a/arch/metag/mm/fault.c -+++ b/arch/metag/mm/fault.c -@@ -141,6 +141,8 @@ good_area: - if (unlikely(fault & VM_FAULT_ERROR)) { - if (fault & VM_FAULT_OOM) - goto out_of_memory; -+ else if (fault & VM_FAULT_SIGSEGV) -+ goto bad_area; - else if (fault & VM_FAULT_SIGBUS) - goto do_sigbus; - BUG(); -diff --git a/arch/microblaze/mm/fault.c b/arch/microblaze/mm/fault.c -index fa4cf52aa7a6..d46a5ebb7570 100644 ---- a/arch/microblaze/mm/fault.c -+++ b/arch/microblaze/mm/fault.c -@@ -224,6 +224,8 @@ good_area: - if (unlikely(fault & VM_FAULT_ERROR)) { - if (fault & VM_FAULT_OOM) - goto out_of_memory; -+ else if (fault & VM_FAULT_SIGSEGV) -+ goto bad_area; - else if (fault & VM_FAULT_SIGBUS) - goto do_sigbus; - BUG(); -diff --git a/arch/mips/mm/fault.c b/arch/mips/mm/fault.c -index 0214a43b9911..c40a8d1c43ba 100644 ---- a/arch/mips/mm/fault.c -+++ b/arch/mips/mm/fault.c -@@ -157,6 +157,8 @@ good_area: - if (unlikely(fault & VM_FAULT_ERROR)) { - if (fault & VM_FAULT_OOM) - goto out_of_memory; -+ else if (fault & VM_FAULT_SIGSEGV) -+ goto bad_area; - else if (fault & VM_FAULT_SIGBUS) - goto do_sigbus; - BUG(); -diff --git a/arch/mn10300/mm/fault.c b/arch/mn10300/mm/fault.c -index 3516cbdf1ee9..0c2cc5d39c8e 100644 ---- a/arch/mn10300/mm/fault.c -+++ b/arch/mn10300/mm/fault.c -@@ -262,6 +262,8 @@ good_area: - if (unlikely(fault & VM_FAULT_ERROR)) { - if (fault & VM_FAULT_OOM) - goto out_of_memory; -+ else if (fault & VM_FAULT_SIGSEGV) -+ goto bad_area; - else if (fault & VM_FAULT_SIGBUS) - goto do_sigbus; - BUG(); -diff --git a/arch/openrisc/mm/fault.c b/arch/openrisc/mm/fault.c -index 0703acf7d327..230ac20ae794 100644 ---- a/arch/openrisc/mm/fault.c -+++ b/arch/openrisc/mm/fault.c -@@ -171,6 +171,8 @@ good_area: - if (unlikely(fault & VM_FAULT_ERROR)) { - if (fault & VM_FAULT_OOM) - goto out_of_memory; -+ else if (fault & VM_FAULT_SIGSEGV) -+ goto bad_area; - else if (fault & VM_FAULT_SIGBUS) - goto do_sigbus; - BUG(); -diff --git a/arch/parisc/mm/fault.c b/arch/parisc/mm/fault.c -index d10d27a720c0..c45130f56a93 100644 ---- a/arch/parisc/mm/fault.c -+++ b/arch/parisc/mm/fault.c -@@ -220,6 +220,8 @@ good_area: - */ - if (fault & VM_FAULT_OOM) - goto out_of_memory; -+ else if (fault & VM_FAULT_SIGSEGV) -+ goto bad_area; - else if (fault & VM_FAULT_SIGBUS) - goto bad_area; - BUG(); -diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c -index d9196c9f93d9..d51a0c110eb4 100644 ---- a/arch/powerpc/mm/fault.c -+++ b/arch/powerpc/mm/fault.c -@@ -425,6 +425,8 @@ good_area: - */ - fault = handle_mm_fault(mm, vma, address, flags); - if (unlikely(fault & (VM_FAULT_RETRY|VM_FAULT_ERROR))) { -+ if (fault & VM_FAULT_SIGSEGV) -+ goto bad_area; - rc = mm_fault_error(regs, address, fault); - if (rc >= MM_FAULT_RETURN) - goto bail; -diff --git a/arch/powerpc/platforms/cell/spu_fault.c b/arch/powerpc/platforms/cell/spu_fault.c -index 641e7273d75a..62f3e4e48a0b 100644 ---- a/arch/powerpc/platforms/cell/spu_fault.c -+++ b/arch/powerpc/platforms/cell/spu_fault.c -@@ -75,7 +75,7 @@ int spu_handle_mm_fault(struct mm_struct *mm, unsigned long ea, - if (*flt & VM_FAULT_OOM) { - ret = -ENOMEM; - goto out_unlock; -- } else if (*flt & VM_FAULT_SIGBUS) { -+ } else if (*flt & (VM_FAULT_SIGBUS | VM_FAULT_SIGSEGV)) { - ret = -EFAULT; - goto out_unlock; - } -diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c -index 35f77a42bedf..c5c5788e8a13 100644 ---- a/arch/powerpc/platforms/cell/spufs/inode.c -+++ b/arch/powerpc/platforms/cell/spufs/inode.c -@@ -164,7 +164,7 @@ static void spufs_prune_dir(struct dentry *dir) - struct dentry *dentry, *tmp; - - mutex_lock(&dir->d_inode->i_mutex); -- list_for_each_entry_safe(dentry, tmp, &dir->d_subdirs, d_u.d_child) { -+ list_for_each_entry_safe(dentry, tmp, &dir->d_subdirs, d_child) { - spin_lock(&dentry->d_lock); - if (!(d_unhashed(dentry)) && dentry->d_inode) { - dget_dlock(dentry); -diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c -index 416facec4a33..d214321db727 100644 ---- a/arch/s390/mm/fault.c -+++ b/arch/s390/mm/fault.c -@@ -244,6 +244,12 @@ static noinline void do_fault_error(struct pt_regs *regs, int fault) - do_no_context(regs); - else - pagefault_out_of_memory(); -+ } else if (fault & VM_FAULT_SIGSEGV) { -+ /* Kernel mode? Handle exceptions or die */ -+ if (!user_mode(regs)) -+ do_no_context(regs); -+ else -+ do_sigsegv(regs, SEGV_MAPERR); - } else if (fault & VM_FAULT_SIGBUS) { - /* Kernel mode? Handle exceptions or die */ - if (!user_mode(regs)) -diff --git a/arch/score/mm/fault.c b/arch/score/mm/fault.c -index 52238983527d..6860beb2a280 100644 ---- a/arch/score/mm/fault.c -+++ b/arch/score/mm/fault.c -@@ -114,6 +114,8 @@ good_area: - if (unlikely(fault & VM_FAULT_ERROR)) { - if (fault & VM_FAULT_OOM) - goto out_of_memory; -+ else if (fault & VM_FAULT_SIGSEGV) -+ goto bad_area; - else if (fault & VM_FAULT_SIGBUS) - goto do_sigbus; - BUG(); -diff --git a/arch/sh/mm/fault.c b/arch/sh/mm/fault.c -index 541dc6101508..a58fec9b55e0 100644 ---- a/arch/sh/mm/fault.c -+++ b/arch/sh/mm/fault.c -@@ -353,6 +353,8 @@ mm_fault_error(struct pt_regs *regs, unsigned long error_code, - } else { - if (fault & VM_FAULT_SIGBUS) - do_sigbus(regs, error_code, address); -+ else if (fault & VM_FAULT_SIGSEGV) -+ bad_area(regs, error_code, address); - else - BUG(); - } -diff --git a/arch/sparc/mm/fault_32.c b/arch/sparc/mm/fault_32.c -index 59dbd4645725..163c78712110 100644 ---- a/arch/sparc/mm/fault_32.c -+++ b/arch/sparc/mm/fault_32.c -@@ -252,6 +252,8 @@ good_area: - if (unlikely(fault & VM_FAULT_ERROR)) { - if (fault & VM_FAULT_OOM) - goto out_of_memory; -+ else if (fault & VM_FAULT_SIGSEGV) -+ goto bad_area; - else if (fault & VM_FAULT_SIGBUS) - goto do_sigbus; - BUG(); -diff --git a/arch/sparc/mm/fault_64.c b/arch/sparc/mm/fault_64.c -index 3841a081beb3..ac2db923e51a 100644 ---- a/arch/sparc/mm/fault_64.c -+++ b/arch/sparc/mm/fault_64.c -@@ -443,6 +443,8 @@ good_area: - if (unlikely(fault & VM_FAULT_ERROR)) { - if (fault & VM_FAULT_OOM) - goto out_of_memory; -+ else if (fault & VM_FAULT_SIGSEGV) -+ goto bad_area; - else if (fault & VM_FAULT_SIGBUS) - goto do_sigbus; - BUG(); -diff --git a/arch/tile/mm/fault.c b/arch/tile/mm/fault.c -index 3ff289f422e6..12b732f593bb 100644 ---- a/arch/tile/mm/fault.c -+++ b/arch/tile/mm/fault.c -@@ -446,6 +446,8 @@ good_area: - if (unlikely(fault & VM_FAULT_ERROR)) { - if (fault & VM_FAULT_OOM) - goto out_of_memory; -+ else if (fault & VM_FAULT_SIGSEGV) -+ goto bad_area; - else if (fault & VM_FAULT_SIGBUS) - goto do_sigbus; - BUG(); -diff --git a/arch/um/kernel/trap.c b/arch/um/kernel/trap.c -index 5c3aef74237f..06ab0ebe0a0f 100644 ---- a/arch/um/kernel/trap.c -+++ b/arch/um/kernel/trap.c -@@ -80,6 +80,8 @@ good_area: - if (unlikely(fault & VM_FAULT_ERROR)) { - if (fault & VM_FAULT_OOM) { - goto out_of_memory; -+ } else if (fault & VM_FAULT_SIGSEGV) { -+ goto out; - } else if (fault & VM_FAULT_SIGBUS) { - err = -EACCES; - goto out; -diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c -index af88fa20dbe8..ddad189e596e 100644 ---- a/arch/x86/kvm/emulate.c -+++ b/arch/x86/kvm/emulate.c -@@ -2450,7 +2450,7 @@ static int em_sysenter(struct x86_emulate_ctxt *ctxt) - * Not recognized on AMD in compat mode (but is recognized in legacy - * mode). - */ -- if ((ctxt->mode == X86EMUL_MODE_PROT32) && (efer & EFER_LMA) -+ if ((ctxt->mode != X86EMUL_MODE_PROT64) && (efer & EFER_LMA) - && !vendor_intel(ctxt)) - return emulate_ud(ctxt); - -@@ -2463,25 +2463,13 @@ static int em_sysenter(struct x86_emulate_ctxt *ctxt) - setup_syscalls_segments(ctxt, &cs, &ss); - - ops->get_msr(ctxt, MSR_IA32_SYSENTER_CS, &msr_data); -- switch (ctxt->mode) { -- case X86EMUL_MODE_PROT32: -- if ((msr_data & 0xfffc) == 0x0) -- return emulate_gp(ctxt, 0); -- break; -- case X86EMUL_MODE_PROT64: -- if (msr_data == 0x0) -- return emulate_gp(ctxt, 0); -- break; -- default: -- break; -- } -+ if ((msr_data & 0xfffc) == 0x0) -+ return emulate_gp(ctxt, 0); - - ctxt->eflags &= ~(EFLG_VM | EFLG_IF | EFLG_RF); -- cs_sel = (u16)msr_data; -- cs_sel &= ~SELECTOR_RPL_MASK; -+ cs_sel = (u16)msr_data & ~SELECTOR_RPL_MASK; - ss_sel = cs_sel + 8; -- ss_sel &= ~SELECTOR_RPL_MASK; -- if (ctxt->mode == X86EMUL_MODE_PROT64 || (efer & EFER_LMA)) { -+ if (efer & EFER_LMA) { - cs.d = 0; - cs.l = 1; - } -@@ -2490,10 +2478,11 @@ static int em_sysenter(struct x86_emulate_ctxt *ctxt) - ops->set_segment(ctxt, ss_sel, &ss, 0, VCPU_SREG_SS); - - ops->get_msr(ctxt, MSR_IA32_SYSENTER_EIP, &msr_data); -- ctxt->_eip = msr_data; -+ ctxt->_eip = (efer & EFER_LMA) ? msr_data : (u32)msr_data; - - ops->get_msr(ctxt, MSR_IA32_SYSENTER_ESP, &msr_data); -- *reg_write(ctxt, VCPU_REGS_RSP) = msr_data; -+ *reg_write(ctxt, VCPU_REGS_RSP) = (efer & EFER_LMA) ? msr_data : -+ (u32)msr_data; - - return X86EMUL_CONTINUE; - } -diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c -index d8b1ff68dbb9..e4780b052531 100644 ---- a/arch/x86/mm/fault.c -+++ b/arch/x86/mm/fault.c -@@ -812,11 +812,8 @@ do_sigbus(struct pt_regs *regs, unsigned long error_code, unsigned long address, - unsigned int fault) - { - struct task_struct *tsk = current; -- struct mm_struct *mm = tsk->mm; - int code = BUS_ADRERR; - -- up_read(&mm->mmap_sem); -- - /* Kernel mode? Handle exceptions or die: */ - if (!(error_code & PF_USER)) { - no_context(regs, error_code, address, SIGBUS, BUS_ADRERR); -@@ -847,7 +844,6 @@ mm_fault_error(struct pt_regs *regs, unsigned long error_code, - unsigned long address, unsigned int fault) - { - if (fatal_signal_pending(current) && !(error_code & PF_USER)) { -- up_read(¤t->mm->mmap_sem); - no_context(regs, error_code, address, 0, 0); - return; - } -@@ -855,14 +851,11 @@ mm_fault_error(struct pt_regs *regs, unsigned long error_code, - if (fault & VM_FAULT_OOM) { - /* Kernel mode? Handle exceptions or die: */ - if (!(error_code & PF_USER)) { -- up_read(¤t->mm->mmap_sem); - no_context(regs, error_code, address, - SIGSEGV, SEGV_MAPERR); - return; - } - -- up_read(¤t->mm->mmap_sem); -- - /* - * We ran out of memory, call the OOM killer, and return the - * userspace (which will retry the fault, or kill us if we got -@@ -873,6 +866,8 @@ mm_fault_error(struct pt_regs *regs, unsigned long error_code, - if (fault & (VM_FAULT_SIGBUS|VM_FAULT_HWPOISON| - VM_FAULT_HWPOISON_LARGE)) - do_sigbus(regs, error_code, address, fault); -+ else if (fault & VM_FAULT_SIGSEGV) -+ bad_area_nosemaphore(regs, error_code, address); - else - BUG(); - } -@@ -1193,6 +1188,7 @@ good_area: - return; - - if (unlikely(fault & VM_FAULT_ERROR)) { -+ up_read(&mm->mmap_sem); - mm_fault_error(regs, error_code, address, fault); - return; - } -diff --git a/arch/xtensa/mm/fault.c b/arch/xtensa/mm/fault.c -index 70fa7bc42b4a..38278337d85e 100644 ---- a/arch/xtensa/mm/fault.c -+++ b/arch/xtensa/mm/fault.c -@@ -117,6 +117,8 @@ good_area: - if (unlikely(fault & VM_FAULT_ERROR)) { - if (fault & VM_FAULT_OOM) - goto out_of_memory; -+ else if (fault & VM_FAULT_SIGSEGV) -+ goto bad_area; - else if (fault & VM_FAULT_SIGBUS) - goto do_sigbus; - BUG(); -diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c -index dad8891ecbfa..9c2c4eca52e3 100644 ---- a/drivers/bluetooth/ath3k.c -+++ b/drivers/bluetooth/ath3k.c -@@ -77,6 +77,8 @@ static struct usb_device_id ath3k_table[] = { - { USB_DEVICE(0x0CF3, 0x3004) }, - { USB_DEVICE(0x0CF3, 0x3008) }, - { USB_DEVICE(0x0CF3, 0x311D) }, -+ { USB_DEVICE(0x0CF3, 0x311E) }, -+ { USB_DEVICE(0x0CF3, 0x311F) }, - { USB_DEVICE(0x0CF3, 0x817a) }, - { USB_DEVICE(0x13d3, 0x3375) }, - { USB_DEVICE(0x04CA, 0x3004) }, -@@ -120,6 +122,8 @@ static struct usb_device_id ath3k_blist_tbl[] = { - { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 }, - { USB_DEVICE(0x0cf3, 0x3008), .driver_info = BTUSB_ATH3012 }, - { USB_DEVICE(0x0cf3, 0x311D), .driver_info = BTUSB_ATH3012 }, -+ { USB_DEVICE(0x0cf3, 0x311E), .driver_info = BTUSB_ATH3012 }, -+ { USB_DEVICE(0x0cf3, 0x311F), .driver_info = BTUSB_ATH3012 }, - { USB_DEVICE(0x0CF3, 0x817a), .driver_info = BTUSB_ATH3012 }, - { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, - { USB_DEVICE(0x04ca, 0x3004), .driver_info = BTUSB_ATH3012 }, -diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c -index 61a8ec4e5f4d..92b985317770 100644 ---- a/drivers/bluetooth/btusb.c -+++ b/drivers/bluetooth/btusb.c -@@ -49,6 +49,7 @@ static struct usb_driver btusb_driver; - #define BTUSB_WRONG_SCO_MTU 0x40 - #define BTUSB_ATH3012 0x80 - #define BTUSB_INTEL 0x100 -+#define BTUSB_INTEL_BOOT 0x200 - - static struct usb_device_id btusb_table[] = { - /* Generic Bluetooth USB device */ -@@ -113,6 +114,13 @@ static struct usb_device_id btusb_table[] = { - /*Broadcom devices with vendor specific id */ - { USB_VENDOR_AND_INTERFACE_INFO(0x0a5c, 0xff, 0x01, 0x01) }, - -+ /* IMC Networks - Broadcom based */ -+ { USB_VENDOR_AND_INTERFACE_INFO(0x13d3, 0xff, 0x01, 0x01) }, -+ -+ /* Intel Bluetooth USB Bootloader (RAM module) */ -+ { USB_DEVICE(0x8087, 0x0a5a), -+ .driver_info = BTUSB_INTEL_BOOT | BTUSB_BROKEN_ISOC }, -+ - { } /* Terminating entry */ - }; - -@@ -141,6 +149,8 @@ static struct usb_device_id blacklist_table[] = { - { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 }, - { USB_DEVICE(0x0cf3, 0x3008), .driver_info = BTUSB_ATH3012 }, - { USB_DEVICE(0x0cf3, 0x311d), .driver_info = BTUSB_ATH3012 }, -+ { USB_DEVICE(0x0cf3, 0x311e), .driver_info = BTUSB_ATH3012 }, -+ { USB_DEVICE(0x0cf3, 0x311f), .driver_info = BTUSB_ATH3012 }, - { USB_DEVICE(0x0cf3, 0x817a), .driver_info = BTUSB_ATH3012 }, - { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, - { USB_DEVICE(0x04ca, 0x3004), .driver_info = BTUSB_ATH3012 }, -@@ -1444,6 +1454,9 @@ static int btusb_probe(struct usb_interface *intf, - if (id->driver_info & BTUSB_INTEL) - hdev->setup = btusb_setup_intel; - -+ if (id->driver_info & BTUSB_INTEL_BOOT) -+ set_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks); -+ - /* Interface numbers are hardcoded in the specification */ - data->isoc = usb_ifnum_to_if(data->udev, 1); - -diff --git a/drivers/edac/sb_edac.c b/drivers/edac/sb_edac.c -index e04462b60756..f505e4ca6d58 100644 ---- a/drivers/edac/sb_edac.c -+++ b/drivers/edac/sb_edac.c -@@ -270,8 +270,9 @@ static const u32 correrrthrsld[] = { - * sbridge structs - */ - --#define NUM_CHANNELS 4 --#define MAX_DIMMS 3 /* Max DIMMS per channel */ -+#define NUM_CHANNELS 4 -+#define MAX_DIMMS 3 /* Max DIMMS per channel */ -+#define CHANNEL_UNSPECIFIED 0xf /* Intel IA32 SDM 15-14 */ - - struct sbridge_info { - u32 mcmtr; -@@ -1451,6 +1452,9 @@ static void sbridge_mce_output_error(struct mem_ctl_info *mci, - - /* FIXME: need support for channel mask */ - -+ if (channel == CHANNEL_UNSPECIFIED) -+ channel = -1; -+ - /* Call the helper to output message */ - edac_mc_handle_error(tp_event, mci, core_err_cnt, - m->addr >> PAGE_SHIFT, m->addr & ~PAGE_MASK, 0, -diff --git a/drivers/net/ethernet/broadcom/bnx2.c b/drivers/net/ethernet/broadcom/bnx2.c -index 5d204492c603..161dcba13c47 100644 ---- a/drivers/net/ethernet/broadcom/bnx2.c -+++ b/drivers/net/ethernet/broadcom/bnx2.c -@@ -2869,7 +2869,7 @@ bnx2_tx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget) - sw_cons = BNX2_NEXT_TX_BD(sw_cons); - - tx_bytes += skb->len; -- dev_kfree_skb(skb); -+ dev_kfree_skb_any(skb); - tx_pkt++; - if (tx_pkt == budget) - break; -@@ -6610,7 +6610,7 @@ bnx2_start_xmit(struct sk_buff *skb, struct net_device *dev) - - mapping = dma_map_single(&bp->pdev->dev, skb->data, len, PCI_DMA_TODEVICE); - if (dma_mapping_error(&bp->pdev->dev, mapping)) { -- dev_kfree_skb(skb); -+ dev_kfree_skb_any(skb); - return NETDEV_TX_OK; - } - -@@ -6703,7 +6703,7 @@ dma_error: - PCI_DMA_TODEVICE); - } - -- dev_kfree_skb(skb); -+ dev_kfree_skb_any(skb); - return NETDEV_TX_OK; - } - -diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c -index 8c1eab1151b8..680d26d6d2c3 100644 ---- a/drivers/net/ethernet/broadcom/tg3.c -+++ b/drivers/net/ethernet/broadcom/tg3.c -@@ -6437,7 +6437,7 @@ static void tg3_tx(struct tg3_napi *tnapi) - pkts_compl++; - bytes_compl += skb->len; - -- dev_kfree_skb(skb); -+ dev_kfree_skb_any(skb); - - if (unlikely(tx_bug)) { - tg3_tx_recover(tp); -@@ -6769,7 +6769,7 @@ static int tg3_rx(struct tg3_napi *tnapi, int budget) - if (len > (tp->dev->mtu + ETH_HLEN) && - skb->protocol != htons(ETH_P_8021Q) && - skb->protocol != htons(ETH_P_8021AD)) { -- dev_kfree_skb(skb); -+ dev_kfree_skb_any(skb); - goto drop_it_no_recycle; - } - -@@ -7652,7 +7652,7 @@ static int tigon3_dma_hwbug_workaround(struct tg3_napi *tnapi, - PCI_DMA_TODEVICE); - /* Make sure the mapping succeeded */ - if (pci_dma_mapping_error(tp->pdev, new_addr)) { -- dev_kfree_skb(new_skb); -+ dev_kfree_skb_any(new_skb); - ret = -1; - } else { - u32 save_entry = *entry; -@@ -7667,13 +7667,13 @@ static int tigon3_dma_hwbug_workaround(struct tg3_napi *tnapi, - new_skb->len, base_flags, - mss, vlan)) { - tg3_tx_skb_unmap(tnapi, save_entry, -1); -- dev_kfree_skb(new_skb); -+ dev_kfree_skb_any(new_skb); - ret = -1; - } - } - } - -- dev_kfree_skb(skb); -+ dev_kfree_skb_any(skb); - *pskb = new_skb; - return ret; - } -@@ -7716,7 +7716,7 @@ static int tg3_tso_bug(struct tg3 *tp, struct sk_buff *skb) - } while (segs); - - tg3_tso_bug_end: -- dev_kfree_skb(skb); -+ dev_kfree_skb_any(skb); - - return NETDEV_TX_OK; - } -@@ -7954,7 +7954,7 @@ dma_error: - tg3_tx_skb_unmap(tnapi, tnapi->tx_prod, --i); - tnapi->tx_buffers[tnapi->tx_prod].skb = NULL; - drop: -- dev_kfree_skb(skb); -+ dev_kfree_skb_any(skb); - drop_nofree: - tp->tx_dropped++; - return NETDEV_TX_OK; -diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c -index d81a7dbfeef6..88e85cb88342 100644 ---- a/drivers/net/ethernet/emulex/benet/be_main.c -+++ b/drivers/net/ethernet/emulex/benet/be_main.c -@@ -1767,7 +1767,7 @@ static u16 be_tx_compl_process(struct be_adapter *adapter, - queue_tail_inc(txq); - } while (cur_index != last_index); - -- kfree_skb(sent_skb); -+ dev_kfree_skb_any(sent_skb); - return num_wrbs; - } - -diff --git a/drivers/net/ethernet/intel/ixgb/ixgb_main.c b/drivers/net/ethernet/intel/ixgb/ixgb_main.c -index fce3e92f9d11..c5a9dcc01ca8 100644 ---- a/drivers/net/ethernet/intel/ixgb/ixgb_main.c -+++ b/drivers/net/ethernet/intel/ixgb/ixgb_main.c -@@ -1527,12 +1527,12 @@ ixgb_xmit_frame(struct sk_buff *skb, struct net_device *netdev) - int tso; - - if (test_bit(__IXGB_DOWN, &adapter->flags)) { -- dev_kfree_skb(skb); -+ dev_kfree_skb_any(skb); - return NETDEV_TX_OK; - } - - if (skb->len <= 0) { -- dev_kfree_skb(skb); -+ dev_kfree_skb_any(skb); - return NETDEV_TX_OK; - } - -@@ -1549,7 +1549,7 @@ ixgb_xmit_frame(struct sk_buff *skb, struct net_device *netdev) - - tso = ixgb_tso(adapter, skb); - if (tso < 0) { -- dev_kfree_skb(skb); -+ dev_kfree_skb_any(skb); - return NETDEV_TX_OK; - } - -diff --git a/drivers/net/ethernet/realtek/8139cp.c b/drivers/net/ethernet/realtek/8139cp.c -index 064425d3178d..437d4cfd42cc 100644 ---- a/drivers/net/ethernet/realtek/8139cp.c -+++ b/drivers/net/ethernet/realtek/8139cp.c -@@ -899,7 +899,7 @@ out_unlock: - - return NETDEV_TX_OK; - out_dma_error: -- kfree_skb(skb); -+ dev_kfree_skb_any(skb); - cp->dev->stats.tx_dropped++; - goto out_unlock; - } -diff --git a/drivers/net/ethernet/realtek/8139too.c b/drivers/net/ethernet/realtek/8139too.c -index 3ccedeb8aba0..942673fcb391 100644 ---- a/drivers/net/ethernet/realtek/8139too.c -+++ b/drivers/net/ethernet/realtek/8139too.c -@@ -1715,9 +1715,9 @@ static netdev_tx_t rtl8139_start_xmit (struct sk_buff *skb, - if (len < ETH_ZLEN) - memset(tp->tx_buf[entry], 0, ETH_ZLEN); - skb_copy_and_csum_dev(skb, tp->tx_buf[entry]); -- dev_kfree_skb(skb); -+ dev_kfree_skb_any(skb); - } else { -- dev_kfree_skb(skb); -+ dev_kfree_skb_any(skb); - dev->stats.tx_dropped++; - return NETDEV_TX_OK; - } -diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c -index e9b5d77a90db..2183c6189148 100644 ---- a/drivers/net/ethernet/realtek/r8169.c -+++ b/drivers/net/ethernet/realtek/r8169.c -@@ -5768,7 +5768,7 @@ static void rtl8169_tx_clear_range(struct rtl8169_private *tp, u32 start, - tp->TxDescArray + entry); - if (skb) { - tp->dev->stats.tx_dropped++; -- dev_kfree_skb(skb); -+ dev_kfree_skb_any(skb); - tx_skb->skb = NULL; - } - } -@@ -5993,7 +5993,7 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb, - err_dma_1: - rtl8169_unmap_tx_skb(d, tp->tx_skb + entry, txd); - err_dma_0: -- dev_kfree_skb(skb); -+ dev_kfree_skb_any(skb); - err_update_stats: - dev->stats.tx_dropped++; - return NETDEV_TX_OK; -@@ -6076,7 +6076,7 @@ static void rtl_tx(struct net_device *dev, struct rtl8169_private *tp) - tp->tx_stats.packets++; - tp->tx_stats.bytes += tx_skb->skb->len; - u64_stats_update_end(&tp->tx_stats.syncp); -- dev_kfree_skb(tx_skb->skb); -+ dev_kfree_skb_any(tx_skb->skb); - tx_skb->skb = NULL; - } - dirty_tx++; -diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c -index 345b5ddcb1a0..86281fa5dcc3 100644 ---- a/drivers/tty/serial/8250/8250_dw.c -+++ b/drivers/tty/serial/8250/8250_dw.c -@@ -98,7 +98,10 @@ static void dw8250_serial_out(struct uart_port *p, int offset, int value) - dw8250_force_idle(p); - writeb(value, p->membase + (UART_LCR << p->regshift)); - } -- dev_err(p->dev, "Couldn't set LCR to %d\n", value); -+ /* -+ * FIXME: this deadlocks if port->lock is already held -+ * dev_err(p->dev, "Couldn't set LCR to %d\n", value); -+ */ - } - } - -@@ -128,7 +131,10 @@ static void dw8250_serial_out32(struct uart_port *p, int offset, int value) - dw8250_force_idle(p); - writel(value, p->membase + (UART_LCR << p->regshift)); - } -- dev_err(p->dev, "Couldn't set LCR to %d\n", value); -+ /* -+ * FIXME: this deadlocks if port->lock is already held -+ * dev_err(p->dev, "Couldn't set LCR to %d\n", value); -+ */ - } - } - -diff --git a/fs/affs/amigaffs.c b/fs/affs/amigaffs.c -index d9a43674cb94..9cca0ea4e479 100644 ---- a/fs/affs/amigaffs.c -+++ b/fs/affs/amigaffs.c -@@ -126,7 +126,7 @@ affs_fix_dcache(struct inode *inode, u32 entry_ino) - { - struct dentry *dentry; - spin_lock(&inode->i_lock); -- hlist_for_each_entry(dentry, &inode->i_dentry, d_alias) { -+ hlist_for_each_entry(dentry, &inode->i_dentry, d_u.d_alias) { - if (entry_ino == (u32)(long)dentry->d_fsdata) { - dentry->d_fsdata = (void *)inode->i_ino; - break; -diff --git a/fs/autofs4/expire.c b/fs/autofs4/expire.c -index 13ddec92341c..8ad277990eac 100644 ---- a/fs/autofs4/expire.c -+++ b/fs/autofs4/expire.c -@@ -91,7 +91,7 @@ static struct dentry *get_next_positive_subdir(struct dentry *prev, - spin_lock(&root->d_lock); - - if (prev) -- next = prev->d_u.d_child.next; -+ next = prev->d_child.next; - else { - prev = dget_dlock(root); - next = prev->d_subdirs.next; -@@ -105,13 +105,13 @@ cont: - return NULL; - } - -- q = list_entry(next, struct dentry, d_u.d_child); -+ q = list_entry(next, struct dentry, d_child); - - spin_lock_nested(&q->d_lock, DENTRY_D_LOCK_NESTED); - /* Already gone or negative dentry (under construction) - try next */ - if (q->d_count == 0 || !simple_positive(q)) { - spin_unlock(&q->d_lock); -- next = q->d_u.d_child.next; -+ next = q->d_child.next; - goto cont; - } - dget_dlock(q); -@@ -161,13 +161,13 @@ again: - goto relock; - } - spin_unlock(&p->d_lock); -- next = p->d_u.d_child.next; -+ next = p->d_child.next; - p = parent; - if (next != &parent->d_subdirs) - break; - } - } -- ret = list_entry(next, struct dentry, d_u.d_child); -+ ret = list_entry(next, struct dentry, d_child); - - spin_lock_nested(&ret->d_lock, DENTRY_D_LOCK_NESTED); - /* Negative dentry - try next */ -@@ -447,7 +447,7 @@ found: - spin_lock(&sbi->lookup_lock); - spin_lock(&expired->d_parent->d_lock); - spin_lock_nested(&expired->d_lock, DENTRY_D_LOCK_NESTED); -- list_move(&expired->d_parent->d_subdirs, &expired->d_u.d_child); -+ list_move(&expired->d_parent->d_subdirs, &expired->d_child); - spin_unlock(&expired->d_lock); - spin_unlock(&expired->d_parent->d_lock); - spin_unlock(&sbi->lookup_lock); -diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c -index 085da86e07c2..79ab4cb3590a 100644 ---- a/fs/autofs4/root.c -+++ b/fs/autofs4/root.c -@@ -655,7 +655,7 @@ static void autofs_clear_leaf_automount_flags(struct dentry *dentry) - /* only consider parents below dentrys in the root */ - if (IS_ROOT(parent->d_parent)) - return; -- d_child = &dentry->d_u.d_child; -+ d_child = &dentry->d_child; - /* Set parent managed if it's becoming empty */ - if (d_child->next == &parent->d_subdirs && - d_child->prev == &parent->d_subdirs) -diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c -index f02d82b7933e..ccb43298e272 100644 ---- a/fs/ceph/dir.c -+++ b/fs/ceph/dir.c -@@ -103,7 +103,7 @@ static unsigned fpos_off(loff_t p) - /* - * When possible, we try to satisfy a readdir by peeking at the - * dcache. We make this work by carefully ordering dentries on -- * d_u.d_child when we initially get results back from the MDS, and -+ * d_child when we initially get results back from the MDS, and - * falling back to a "normal" sync readdir if any dentries in the dir - * are dropped. - * -@@ -139,11 +139,11 @@ static int __dcache_readdir(struct file *filp, - p = parent->d_subdirs.prev; - dout(" initial p %p/%p\n", p->prev, p->next); - } else { -- p = last->d_u.d_child.prev; -+ p = last->d_child.prev; - } - - more: -- dentry = list_entry(p, struct dentry, d_u.d_child); -+ dentry = list_entry(p, struct dentry, d_child); - di = ceph_dentry(dentry); - while (1) { - dout(" p %p/%p %s d_subdirs %p/%p\n", p->prev, p->next, -@@ -165,7 +165,7 @@ more: - !dentry->d_inode ? " null" : ""); - spin_unlock(&dentry->d_lock); - p = p->prev; -- dentry = list_entry(p, struct dentry, d_u.d_child); -+ dentry = list_entry(p, struct dentry, d_child); - di = ceph_dentry(dentry); - } - -diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c -index be0f7e20d62e..0cf23a7b88c2 100644 ---- a/fs/ceph/inode.c -+++ b/fs/ceph/inode.c -@@ -867,9 +867,9 @@ static void ceph_set_dentry_offset(struct dentry *dn) - - spin_lock(&dir->d_lock); - spin_lock_nested(&dn->d_lock, DENTRY_D_LOCK_NESTED); -- list_move(&dn->d_u.d_child, &dir->d_subdirs); -+ list_move(&dn->d_child, &dir->d_subdirs); - dout("set_dentry_offset %p %lld (%p %p)\n", dn, di->offset, -- dn->d_u.d_child.prev, dn->d_u.d_child.next); -+ dn->d_child.prev, dn->d_child.next); - spin_unlock(&dn->d_lock); - spin_unlock(&dir->d_lock); - } -@@ -1296,7 +1296,7 @@ retry_lookup: - /* reorder parent's d_subdirs */ - spin_lock(&parent->d_lock); - spin_lock_nested(&dn->d_lock, DENTRY_D_LOCK_NESTED); -- list_move(&dn->d_u.d_child, &parent->d_subdirs); -+ list_move(&dn->d_child, &parent->d_subdirs); - spin_unlock(&dn->d_lock); - spin_unlock(&parent->d_lock); - } -diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c -index 0dee93706c98..54304ccae7e7 100644 ---- a/fs/cifs/inode.c -+++ b/fs/cifs/inode.c -@@ -832,7 +832,7 @@ inode_has_hashed_dentries(struct inode *inode) - struct dentry *dentry; - - spin_lock(&inode->i_lock); -- hlist_for_each_entry(dentry, &inode->i_dentry, d_alias) { -+ hlist_for_each_entry(dentry, &inode->i_dentry, d_u.d_alias) { - if (!d_unhashed(dentry) || IS_ROOT(dentry)) { - spin_unlock(&inode->i_lock); - return true; -diff --git a/fs/coda/cache.c b/fs/coda/cache.c -index 1da168c61d35..9bc1147a6c5d 100644 ---- a/fs/coda/cache.c -+++ b/fs/coda/cache.c -@@ -92,7 +92,7 @@ static void coda_flag_children(struct dentry *parent, int flag) - struct dentry *de; - - spin_lock(&parent->d_lock); -- list_for_each_entry(de, &parent->d_subdirs, d_u.d_child) { -+ list_for_each_entry(de, &parent->d_subdirs, d_child) { - /* don't know what to do with negative dentries */ - if (de->d_inode ) - coda_flag_inode(de->d_inode, flag); -diff --git a/fs/dcache.c b/fs/dcache.c -index 25c0a1b5f6c0..efa4602e064f 100644 ---- a/fs/dcache.c -+++ b/fs/dcache.c -@@ -43,7 +43,7 @@ - /* - * Usage: - * dcache->d_inode->i_lock protects: -- * - i_dentry, d_alias, d_inode of aliases -+ * - i_dentry, d_u.d_alias, d_inode of aliases - * dcache_hash_bucket lock protects: - * - the dcache hash table - * s_anon bl list spinlock protects: -@@ -58,7 +58,7 @@ - * - d_unhashed() - * - d_parent and d_subdirs - * - childrens' d_child and d_parent -- * - d_alias, d_inode -+ * - d_u.d_alias, d_inode - * - * Ordering: - * dentry->d_inode->i_lock -@@ -215,7 +215,6 @@ static void __d_free(struct rcu_head *head) - { - struct dentry *dentry = container_of(head, struct dentry, d_u.d_rcu); - -- WARN_ON(!hlist_unhashed(&dentry->d_alias)); - if (dname_external(dentry)) - kfree(dentry->d_name.name); - kmem_cache_free(dentry_cache, dentry); -@@ -226,6 +225,7 @@ static void __d_free(struct rcu_head *head) - */ - static void d_free(struct dentry *dentry) - { -+ WARN_ON(!hlist_unhashed(&dentry->d_u.d_alias)); - BUG_ON(dentry->d_count); - this_cpu_dec(nr_dentry); - if (dentry->d_op && dentry->d_op->d_release) -@@ -264,7 +264,7 @@ static void dentry_iput(struct dentry * dentry) - struct inode *inode = dentry->d_inode; - if (inode) { - dentry->d_inode = NULL; -- hlist_del_init(&dentry->d_alias); -+ hlist_del_init(&dentry->d_u.d_alias); - spin_unlock(&dentry->d_lock); - spin_unlock(&inode->i_lock); - if (!inode->i_nlink) -@@ -288,7 +288,7 @@ static void dentry_unlink_inode(struct dentry * dentry) - { - struct inode *inode = dentry->d_inode; - dentry->d_inode = NULL; -- hlist_del_init(&dentry->d_alias); -+ hlist_del_init(&dentry->d_u.d_alias); - dentry_rcuwalk_barrier(dentry); - spin_unlock(&dentry->d_lock); - spin_unlock(&inode->i_lock); -@@ -364,9 +364,9 @@ static struct dentry *d_kill(struct dentry *dentry, struct dentry *parent) - __releases(parent->d_lock) - __releases(dentry->d_inode->i_lock) - { -- list_del(&dentry->d_u.d_child); -+ __list_del_entry(&dentry->d_child); - /* -- * Inform try_to_ascend() that we are no longer attached to the -+ * Inform ascending readers that we are no longer attached to the - * dentry tree - */ - dentry->d_flags |= DCACHE_DENTRY_KILLED; -@@ -660,7 +660,7 @@ static struct dentry *__d_find_alias(struct inode *inode, int want_discon) - - again: - discon_alias = NULL; -- hlist_for_each_entry(alias, &inode->i_dentry, d_alias) { -+ hlist_for_each_entry(alias, &inode->i_dentry, d_u.d_alias) { - spin_lock(&alias->d_lock); - if (S_ISDIR(inode->i_mode) || !d_unhashed(alias)) { - if (IS_ROOT(alias) && -@@ -713,7 +713,7 @@ void d_prune_aliases(struct inode *inode) - struct dentry *dentry; - restart: - spin_lock(&inode->i_lock); -- hlist_for_each_entry(dentry, &inode->i_dentry, d_alias) { -+ hlist_for_each_entry(dentry, &inode->i_dentry, d_u.d_alias) { - spin_lock(&dentry->d_lock); - if (!dentry->d_count) { - __dget_dlock(dentry); -@@ -893,7 +893,7 @@ static void shrink_dcache_for_umount_subtree(struct dentry *dentry) - /* descend to the first leaf in the current subtree */ - while (!list_empty(&dentry->d_subdirs)) - dentry = list_entry(dentry->d_subdirs.next, -- struct dentry, d_u.d_child); -+ struct dentry, d_child); - - /* consume the dentries from this leaf up through its parents - * until we find one with children or run out altogether */ -@@ -927,17 +927,17 @@ static void shrink_dcache_for_umount_subtree(struct dentry *dentry) - - if (IS_ROOT(dentry)) { - parent = NULL; -- list_del(&dentry->d_u.d_child); -+ list_del(&dentry->d_child); - } else { - parent = dentry->d_parent; - parent->d_count--; -- list_del(&dentry->d_u.d_child); -+ list_del(&dentry->d_child); - } - - inode = dentry->d_inode; - if (inode) { - dentry->d_inode = NULL; -- hlist_del_init(&dentry->d_alias); -+ hlist_del_init(&dentry->d_u.d_alias); - if (dentry->d_op && dentry->d_op->d_iput) - dentry->d_op->d_iput(dentry, inode); - else -@@ -955,7 +955,7 @@ static void shrink_dcache_for_umount_subtree(struct dentry *dentry) - } while (list_empty(&dentry->d_subdirs)); - - dentry = list_entry(dentry->d_subdirs.next, -- struct dentry, d_u.d_child); -+ struct dentry, d_child); - } - } - -@@ -988,35 +988,6 @@ void shrink_dcache_for_umount(struct super_block *sb) - } - - /* -- * This tries to ascend one level of parenthood, but -- * we can race with renaming, so we need to re-check -- * the parenthood after dropping the lock and check -- * that the sequence number still matches. -- */ --static struct dentry *try_to_ascend(struct dentry *old, int locked, unsigned seq) --{ -- struct dentry *new = old->d_parent; -- -- rcu_read_lock(); -- spin_unlock(&old->d_lock); -- spin_lock(&new->d_lock); -- -- /* -- * might go back up the wrong parent if we have had a rename -- * or deletion -- */ -- if (new != old->d_parent || -- (old->d_flags & DCACHE_DENTRY_KILLED) || -- (!locked && read_seqretry(&rename_lock, seq))) { -- spin_unlock(&new->d_lock); -- new = NULL; -- } -- rcu_read_unlock(); -- return new; --} -- -- --/* - * Search for at least 1 mount point in the dentry's subdirs. - * We descend to the next level whenever the d_subdirs - * list is non-empty and continue searching. -@@ -1048,7 +1019,7 @@ repeat: - resume: - while (next != &this_parent->d_subdirs) { - struct list_head *tmp = next; -- struct dentry *dentry = list_entry(tmp, struct dentry, d_u.d_child); -+ struct dentry *dentry = list_entry(tmp, struct dentry, d_child); - next = tmp->next; - - spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED); -@@ -1070,30 +1041,48 @@ resume: - /* - * All done at this level ... ascend and resume the search. - */ -+ rcu_read_lock(); -+ascend: - if (this_parent != parent) { - struct dentry *child = this_parent; -- this_parent = try_to_ascend(this_parent, locked, seq); -- if (!this_parent) -+ this_parent = child->d_parent; -+ -+ spin_unlock(&child->d_lock); -+ spin_lock(&this_parent->d_lock); -+ -+ /* might go back up the wrong parent if we have had a rename. */ -+ if (!locked && read_seqretry(&rename_lock, seq)) - goto rename_retry; -- next = child->d_u.d_child.next; -+ next = child->d_child.next; -+ while (unlikely(child->d_flags & DCACHE_DENTRY_KILLED)) { -+ if (next == &this_parent->d_subdirs) -+ goto ascend; -+ child = list_entry(next, struct dentry, d_child); -+ next = next->next; -+ } -+ rcu_read_unlock(); - goto resume; - } -- spin_unlock(&this_parent->d_lock); - if (!locked && read_seqretry(&rename_lock, seq)) - goto rename_retry; -+ spin_unlock(&this_parent->d_lock); -+ rcu_read_unlock(); - if (locked) - write_sequnlock(&rename_lock); - return 0; /* No mount points found in tree */ - positive: - if (!locked && read_seqretry(&rename_lock, seq)) -- goto rename_retry; -+ goto rename_retry_unlocked; - if (locked) - write_sequnlock(&rename_lock); - return 1; - - rename_retry: -+ spin_unlock(&this_parent->d_lock); -+ rcu_read_unlock(); - if (locked) - goto again; -+rename_retry_unlocked: - locked = 1; - write_seqlock(&rename_lock); - goto again; -@@ -1131,7 +1120,7 @@ repeat: - resume: - while (next != &this_parent->d_subdirs) { - struct list_head *tmp = next; -- struct dentry *dentry = list_entry(tmp, struct dentry, d_u.d_child); -+ struct dentry *dentry = list_entry(tmp, struct dentry, d_child); - next = tmp->next; - - spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED); -@@ -1158,6 +1147,7 @@ resume: - */ - if (found && need_resched()) { - spin_unlock(&dentry->d_lock); -+ rcu_read_lock(); - goto out; - } - -@@ -1177,23 +1167,40 @@ resume: - /* - * All done at this level ... ascend and resume the search. - */ -+ rcu_read_lock(); -+ascend: - if (this_parent != parent) { - struct dentry *child = this_parent; -- this_parent = try_to_ascend(this_parent, locked, seq); -- if (!this_parent) -+ this_parent = child->d_parent; -+ -+ spin_unlock(&child->d_lock); -+ spin_lock(&this_parent->d_lock); -+ -+ /* might go back up the wrong parent if we have had a rename. */ -+ if (!locked && read_seqretry(&rename_lock, seq)) - goto rename_retry; -- next = child->d_u.d_child.next; -+ next = child->d_child.next; -+ while (unlikely(child->d_flags & DCACHE_DENTRY_KILLED)) { -+ if (next == &this_parent->d_subdirs) -+ goto ascend; -+ child = list_entry(next, struct dentry, d_child); -+ next = next->next; -+ } -+ rcu_read_unlock(); - goto resume; - } - out: -- spin_unlock(&this_parent->d_lock); - if (!locked && read_seqretry(&rename_lock, seq)) - goto rename_retry; -+ spin_unlock(&this_parent->d_lock); -+ rcu_read_unlock(); - if (locked) - write_sequnlock(&rename_lock); - return found; - - rename_retry: -+ spin_unlock(&this_parent->d_lock); -+ rcu_read_unlock(); - if (found) - return found; - if (locked) -@@ -1278,8 +1285,8 @@ struct dentry *__d_alloc(struct super_block *sb, const struct qstr *name) - INIT_HLIST_BL_NODE(&dentry->d_hash); - INIT_LIST_HEAD(&dentry->d_lru); - INIT_LIST_HEAD(&dentry->d_subdirs); -- INIT_HLIST_NODE(&dentry->d_alias); -- INIT_LIST_HEAD(&dentry->d_u.d_child); -+ INIT_HLIST_NODE(&dentry->d_u.d_alias); -+ INIT_LIST_HEAD(&dentry->d_child); - d_set_d_op(dentry, dentry->d_sb->s_d_op); - - this_cpu_inc(nr_dentry); -@@ -1309,7 +1316,7 @@ struct dentry *d_alloc(struct dentry * parent, const struct qstr *name) - */ - __dget_dlock(parent); - dentry->d_parent = parent; -- list_add(&dentry->d_u.d_child, &parent->d_subdirs); -+ list_add(&dentry->d_child, &parent->d_subdirs); - spin_unlock(&parent->d_lock); - - return dentry; -@@ -1369,7 +1376,7 @@ static void __d_instantiate(struct dentry *dentry, struct inode *inode) - if (inode) { - if (unlikely(IS_AUTOMOUNT(inode))) - dentry->d_flags |= DCACHE_NEED_AUTOMOUNT; -- hlist_add_head(&dentry->d_alias, &inode->i_dentry); -+ hlist_add_head(&dentry->d_u.d_alias, &inode->i_dentry); - } - dentry->d_inode = inode; - dentry_rcuwalk_barrier(dentry); -@@ -1394,7 +1401,7 @@ static void __d_instantiate(struct dentry *dentry, struct inode *inode) - - void d_instantiate(struct dentry *entry, struct inode * inode) - { -- BUG_ON(!hlist_unhashed(&entry->d_alias)); -+ BUG_ON(!hlist_unhashed(&entry->d_u.d_alias)); - if (inode) - spin_lock(&inode->i_lock); - __d_instantiate(entry, inode); -@@ -1433,7 +1440,7 @@ static struct dentry *__d_instantiate_unique(struct dentry *entry, - return NULL; - } - -- hlist_for_each_entry(alias, &inode->i_dentry, d_alias) { -+ hlist_for_each_entry(alias, &inode->i_dentry, d_u.d_alias) { - /* - * Don't need alias->d_lock here, because aliases with - * d_parent == entry->d_parent are not subject to name or -@@ -1459,7 +1466,7 @@ struct dentry *d_instantiate_unique(struct dentry *entry, struct inode *inode) - { - struct dentry *result; - -- BUG_ON(!hlist_unhashed(&entry->d_alias)); -+ BUG_ON(!hlist_unhashed(&entry->d_u.d_alias)); - - if (inode) - spin_lock(&inode->i_lock); -@@ -1502,7 +1509,7 @@ static struct dentry * __d_find_any_alias(struct inode *inode) - - if (hlist_empty(&inode->i_dentry)) - return NULL; -- alias = hlist_entry(inode->i_dentry.first, struct dentry, d_alias); -+ alias = hlist_entry(inode->i_dentry.first, struct dentry, d_u.d_alias); - __dget(alias); - return alias; - } -@@ -1576,7 +1583,7 @@ struct dentry *d_obtain_alias(struct inode *inode) - spin_lock(&tmp->d_lock); - tmp->d_inode = inode; - tmp->d_flags |= DCACHE_DISCONNECTED; -- hlist_add_head(&tmp->d_alias, &inode->i_dentry); -+ hlist_add_head(&tmp->d_u.d_alias, &inode->i_dentry); - hlist_bl_lock(&tmp->d_sb->s_anon); - hlist_bl_add_head(&tmp->d_hash, &tmp->d_sb->s_anon); - hlist_bl_unlock(&tmp->d_sb->s_anon); -@@ -2019,7 +2026,7 @@ int d_validate(struct dentry *dentry, struct dentry *dparent) - struct dentry *child; - - spin_lock(&dparent->d_lock); -- list_for_each_entry(child, &dparent->d_subdirs, d_u.d_child) { -+ list_for_each_entry(child, &dparent->d_subdirs, d_child) { - if (dentry == child) { - spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED); - __dget_dlock(dentry); -@@ -2266,8 +2273,8 @@ static void __d_move(struct dentry * dentry, struct dentry * target) - /* Unhash the target: dput() will then get rid of it */ - __d_drop(target); - -- list_del(&dentry->d_u.d_child); -- list_del(&target->d_u.d_child); -+ list_del(&dentry->d_child); -+ list_del(&target->d_child); - - /* Switch the names.. */ - switch_names(dentry, target); -@@ -2277,15 +2284,15 @@ static void __d_move(struct dentry * dentry, struct dentry * target) - if (IS_ROOT(dentry)) { - dentry->d_parent = target->d_parent; - target->d_parent = target; -- INIT_LIST_HEAD(&target->d_u.d_child); -+ INIT_LIST_HEAD(&target->d_child); - } else { - swap(dentry->d_parent, target->d_parent); - - /* And add them back to the (new) parent lists */ -- list_add(&target->d_u.d_child, &target->d_parent->d_subdirs); -+ list_add(&target->d_child, &target->d_parent->d_subdirs); - } - -- list_add(&dentry->d_u.d_child, &dentry->d_parent->d_subdirs); -+ list_add(&dentry->d_child, &dentry->d_parent->d_subdirs); - - write_seqcount_end(&target->d_seq); - write_seqcount_end(&dentry->d_seq); -@@ -2392,9 +2399,9 @@ static void __d_materialise_dentry(struct dentry *dentry, struct dentry *anon) - swap(dentry->d_name.hash, anon->d_name.hash); - - dentry->d_parent = dentry; -- list_del_init(&dentry->d_u.d_child); -+ list_del_init(&dentry->d_child); - anon->d_parent = dparent; -- list_move(&anon->d_u.d_child, &dparent->d_subdirs); -+ list_move(&anon->d_child, &dparent->d_subdirs); - - write_seqcount_end(&dentry->d_seq); - write_seqcount_end(&anon->d_seq); -@@ -2933,7 +2940,7 @@ repeat: - resume: - while (next != &this_parent->d_subdirs) { - struct list_head *tmp = next; -- struct dentry *dentry = list_entry(tmp, struct dentry, d_u.d_child); -+ struct dentry *dentry = list_entry(tmp, struct dentry, d_child); - next = tmp->next; - - spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED); -@@ -2954,26 +2961,43 @@ resume: - } - spin_unlock(&dentry->d_lock); - } -+ rcu_read_lock(); -+ascend: - if (this_parent != root) { - struct dentry *child = this_parent; - if (!(this_parent->d_flags & DCACHE_GENOCIDE)) { - this_parent->d_flags |= DCACHE_GENOCIDE; - this_parent->d_count--; - } -- this_parent = try_to_ascend(this_parent, locked, seq); -- if (!this_parent) -+ this_parent = child->d_parent; -+ -+ spin_unlock(&child->d_lock); -+ spin_lock(&this_parent->d_lock); -+ -+ /* might go back up the wrong parent if we have had a rename. */ -+ if (!locked && read_seqretry(&rename_lock, seq)) - goto rename_retry; -- next = child->d_u.d_child.next; -+ next = child->d_child.next; -+ while (unlikely(child->d_flags & DCACHE_DENTRY_KILLED)) { -+ if (next == &this_parent->d_subdirs) -+ goto ascend; -+ child = list_entry(next, struct dentry, d_child); -+ next = next->next; -+ } -+ rcu_read_unlock(); - goto resume; - } -- spin_unlock(&this_parent->d_lock); - if (!locked && read_seqretry(&rename_lock, seq)) - goto rename_retry; -+ spin_unlock(&this_parent->d_lock); -+ rcu_read_unlock(); - if (locked) - write_sequnlock(&rename_lock); - return; - - rename_retry: -+ spin_unlock(&this_parent->d_lock); -+ rcu_read_unlock(); - if (locked) - goto again; - locked = 1; -diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c -index 7269ec329c01..26d7fff8d78e 100644 ---- a/fs/debugfs/inode.c -+++ b/fs/debugfs/inode.c -@@ -545,7 +545,7 @@ void debugfs_remove_recursive(struct dentry *dentry) - parent = dentry; - down: - mutex_lock(&parent->d_inode->i_mutex); -- list_for_each_entry_safe(child, next, &parent->d_subdirs, d_u.d_child) { -+ list_for_each_entry_safe(child, next, &parent->d_subdirs, d_child) { - if (!debugfs_positive(child)) - continue; - -@@ -566,8 +566,8 @@ void debugfs_remove_recursive(struct dentry *dentry) - mutex_lock(&parent->d_inode->i_mutex); - - if (child != dentry) { -- next = list_entry(child->d_u.d_child.next, struct dentry, -- d_u.d_child); -+ next = list_entry(child->d_child.next, struct dentry, -+ d_child); - goto up; - } - -diff --git a/fs/exportfs/expfs.c b/fs/exportfs/expfs.c -index 262fc9940982..b4eec4c9a790 100644 ---- a/fs/exportfs/expfs.c -+++ b/fs/exportfs/expfs.c -@@ -50,7 +50,7 @@ find_acceptable_alias(struct dentry *result, - - inode = result->d_inode; - spin_lock(&inode->i_lock); -- hlist_for_each_entry(dentry, &inode->i_dentry, d_alias) { -+ hlist_for_each_entry(dentry, &inode->i_dentry, d_u.d_alias) { - dget(dentry); - spin_unlock(&inode->i_lock); - if (toput) -diff --git a/fs/jfs/jfs_dtree.c b/fs/jfs/jfs_dtree.c -index c450fdb3d78d..5d876b1c9ea4 100644 ---- a/fs/jfs/jfs_dtree.c -+++ b/fs/jfs/jfs_dtree.c -@@ -3103,7 +3103,7 @@ int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir) - * self "." - */ - filp->f_pos = 1; -- if (filldir(dirent, ".", 1, 0, ip->i_ino, -+ if (filldir(dirent, ".", 1, 1, ip->i_ino, - DT_DIR)) - return 0; - } -@@ -3111,7 +3111,7 @@ int jfs_readdir(struct file *filp, void *dirent, filldir_t filldir) - * parent ".." - */ - filp->f_pos = 2; -- if (filldir(dirent, "..", 2, 1, PARENT(ip), DT_DIR)) -+ if (filldir(dirent, "..", 2, 2, PARENT(ip), DT_DIR)) - return 0; - - /* -diff --git a/fs/libfs.c b/fs/libfs.c -index 916da8c4158b..1299bd5e07b7 100644 ---- a/fs/libfs.c -+++ b/fs/libfs.c -@@ -104,18 +104,18 @@ loff_t dcache_dir_lseek(struct file *file, loff_t offset, int whence) - - spin_lock(&dentry->d_lock); - /* d_lock not required for cursor */ -- list_del(&cursor->d_u.d_child); -+ list_del(&cursor->d_child); - p = dentry->d_subdirs.next; - while (n && p != &dentry->d_subdirs) { - struct dentry *next; -- next = list_entry(p, struct dentry, d_u.d_child); -+ next = list_entry(p, struct dentry, d_child); - spin_lock_nested(&next->d_lock, DENTRY_D_LOCK_NESTED); - if (simple_positive(next)) - n--; - spin_unlock(&next->d_lock); - p = p->next; - } -- list_add_tail(&cursor->d_u.d_child, p); -+ list_add_tail(&cursor->d_child, p); - spin_unlock(&dentry->d_lock); - } - } -@@ -139,7 +139,7 @@ int dcache_readdir(struct file * filp, void * dirent, filldir_t filldir) - { - struct dentry *dentry = filp->f_path.dentry; - struct dentry *cursor = filp->private_data; -- struct list_head *p, *q = &cursor->d_u.d_child; -+ struct list_head *p, *q = &cursor->d_child; - ino_t ino; - int i = filp->f_pos; - -@@ -165,7 +165,7 @@ int dcache_readdir(struct file * filp, void * dirent, filldir_t filldir) - - for (p=q->next; p != &dentry->d_subdirs; p=p->next) { - struct dentry *next; -- next = list_entry(p, struct dentry, d_u.d_child); -+ next = list_entry(p, struct dentry, d_child); - spin_lock_nested(&next->d_lock, DENTRY_D_LOCK_NESTED); - if (!simple_positive(next)) { - spin_unlock(&next->d_lock); -@@ -289,7 +289,7 @@ int simple_empty(struct dentry *dentry) - int ret = 0; - - spin_lock(&dentry->d_lock); -- list_for_each_entry(child, &dentry->d_subdirs, d_u.d_child) { -+ list_for_each_entry(child, &dentry->d_subdirs, d_child) { - spin_lock_nested(&child->d_lock, DENTRY_D_LOCK_NESTED); - if (simple_positive(child)) { - spin_unlock(&child->d_lock); -diff --git a/fs/ncpfs/dir.c b/fs/ncpfs/dir.c -index 6792ce11f2bf..c578ba9949e6 100644 ---- a/fs/ncpfs/dir.c -+++ b/fs/ncpfs/dir.c -@@ -391,7 +391,7 @@ ncp_dget_fpos(struct dentry *dentry, struct dentry *parent, unsigned long fpos) - spin_lock(&parent->d_lock); - next = parent->d_subdirs.next; - while (next != &parent->d_subdirs) { -- dent = list_entry(next, struct dentry, d_u.d_child); -+ dent = list_entry(next, struct dentry, d_child); - if ((unsigned long)dent->d_fsdata == fpos) { - if (dent->d_inode) - dget(dent); -diff --git a/fs/ncpfs/ncplib_kernel.h b/fs/ncpfs/ncplib_kernel.h -index 32c06587351a..6d5e7c56c79d 100644 ---- a/fs/ncpfs/ncplib_kernel.h -+++ b/fs/ncpfs/ncplib_kernel.h -@@ -194,7 +194,7 @@ ncp_renew_dentries(struct dentry *parent) - spin_lock(&parent->d_lock); - next = parent->d_subdirs.next; - while (next != &parent->d_subdirs) { -- dentry = list_entry(next, struct dentry, d_u.d_child); -+ dentry = list_entry(next, struct dentry, d_child); - - if (dentry->d_fsdata == NULL) - ncp_age_dentry(server, dentry); -@@ -216,7 +216,7 @@ ncp_invalidate_dircache_entries(struct dentry *parent) - spin_lock(&parent->d_lock); - next = parent->d_subdirs.next; - while (next != &parent->d_subdirs) { -- dentry = list_entry(next, struct dentry, d_u.d_child); -+ dentry = list_entry(next, struct dentry, d_child); - dentry->d_fsdata = NULL; - ncp_age_dentry(server, dentry); - next = next->next; -diff --git a/fs/nfs/getroot.c b/fs/nfs/getroot.c -index 44efaa8c5f78..0fe3ced6438c 100644 ---- a/fs/nfs/getroot.c -+++ b/fs/nfs/getroot.c -@@ -58,7 +58,7 @@ static int nfs_superblock_set_dummy_root(struct super_block *sb, struct inode *i - */ - spin_lock(&sb->s_root->d_inode->i_lock); - spin_lock(&sb->s_root->d_lock); -- hlist_del_init(&sb->s_root->d_alias); -+ hlist_del_init(&sb->s_root->d_u.d_alias); - spin_unlock(&sb->s_root->d_lock); - spin_unlock(&sb->s_root->d_inode->i_lock); - } -diff --git a/fs/notify/fsnotify.c b/fs/notify/fsnotify.c -index 4bb21d67d9b1..a3153e2d0f1f 100644 ---- a/fs/notify/fsnotify.c -+++ b/fs/notify/fsnotify.c -@@ -63,14 +63,14 @@ void __fsnotify_update_child_dentry_flags(struct inode *inode) - spin_lock(&inode->i_lock); - /* run all of the dentries associated with this inode. Since this is a - * directory, there damn well better only be one item on this list */ -- hlist_for_each_entry(alias, &inode->i_dentry, d_alias) { -+ hlist_for_each_entry(alias, &inode->i_dentry, d_u.d_alias) { - struct dentry *child; - - /* run all of the children of the original inode and fix their - * d_flags to indicate parental interest (their parent is the - * original inode) */ - spin_lock(&alias->d_lock); -- list_for_each_entry(child, &alias->d_subdirs, d_u.d_child) { -+ list_for_each_entry(child, &alias->d_subdirs, d_child) { - if (!child->d_inode) - continue; - -diff --git a/fs/ocfs2/dcache.c b/fs/ocfs2/dcache.c -index ef999729e274..ce37013b4a59 100644 ---- a/fs/ocfs2/dcache.c -+++ b/fs/ocfs2/dcache.c -@@ -172,7 +172,7 @@ struct dentry *ocfs2_find_local_alias(struct inode *inode, - struct dentry *dentry; - - spin_lock(&inode->i_lock); -- hlist_for_each_entry(dentry, &inode->i_dentry, d_alias) { -+ hlist_for_each_entry(dentry, &inode->i_dentry, d_u.d_alias) { - spin_lock(&dentry->d_lock); - if (ocfs2_match_dentry(dentry, parent_blkno, skip_unhashed)) { - trace_ocfs2_find_local_alias(dentry->d_name.len, -diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c -index 8cd6474e248f..d0e8c0b1767f 100644 ---- a/fs/ocfs2/file.c -+++ b/fs/ocfs2/file.c -@@ -2459,12 +2459,14 @@ static ssize_t ocfs2_file_splice_write(struct pipe_inode_info *pipe, - struct address_space *mapping = out->f_mapping; - struct inode *inode = mapping->host; - struct splice_desc sd = { -- .total_len = len, - .flags = flags, -- .pos = *ppos, - .u.file = out, - }; -- -+ ret = generic_write_checks(out, ppos, &len, 0); -+ if(ret) -+ return ret; -+ sd.total_len = len; -+ sd.pos = *ppos; - - trace_ocfs2_file_splice_write(inode, out, out->f_path.dentry, - (unsigned long long)OCFS2_I(inode)->ip_blkno, -diff --git a/fs/reiserfs/reiserfs.h b/fs/reiserfs/reiserfs.h -index 157e474ab303..635a1425d370 100644 ---- a/fs/reiserfs/reiserfs.h -+++ b/fs/reiserfs/reiserfs.h -@@ -1954,8 +1954,6 @@ struct treepath var = {.path_length = ILLEGAL_PATH_ELEMENT_OFFSET, .reada = 0,} - #define MAX_US_INT 0xffff - - // reiserfs version 2 has max offset 60 bits. Version 1 - 32 bit offset --#define U32_MAX (~(__u32)0) -- - static inline loff_t max_reiserfs_offset(struct inode *inode) - { - if (get_inode_item_key_version(inode) == KEY_FORMAT_3_5) -diff --git a/fs/splice.c b/fs/splice.c -index 4b5a5fac3383..f183f1342c01 100644 ---- a/fs/splice.c -+++ b/fs/splice.c -@@ -1012,13 +1012,17 @@ generic_file_splice_write(struct pipe_inode_info *pipe, struct file *out, - struct address_space *mapping = out->f_mapping; - struct inode *inode = mapping->host; - struct splice_desc sd = { -- .total_len = len, - .flags = flags, -- .pos = *ppos, - .u.file = out, - }; - ssize_t ret; - -+ ret = generic_write_checks(out, ppos, &len, S_ISBLK(inode->i_mode)); -+ if (ret) -+ return ret; -+ sd.total_len = len; -+ sd.pos = *ppos; -+ - pipe_lock(pipe); - - splice_from_pipe_begin(&sd); -diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h -index 17bccd3a4b03..dd6d9b89d338 100644 ---- a/include/asm-generic/pgtable.h -+++ b/include/asm-generic/pgtable.h -@@ -550,11 +550,10 @@ static inline int pmd_none_or_trans_huge_or_clear_bad(pmd_t *pmd) - #ifdef CONFIG_TRANSPARENT_HUGEPAGE - barrier(); - #endif -- if (pmd_none(pmdval)) -+ if (pmd_none(pmdval) || pmd_trans_huge(pmdval)) - return 1; - if (unlikely(pmd_bad(pmdval))) { -- if (!pmd_trans_huge(pmdval)) -- pmd_clear_bad(pmd); -+ pmd_clear_bad(pmd); - return 1; - } - return 0; -diff --git a/include/linux/ceph/decode.h b/include/linux/ceph/decode.h -index 0442c3d800f0..a6ef9cc267ec 100644 ---- a/include/linux/ceph/decode.h -+++ b/include/linux/ceph/decode.h -@@ -8,23 +8,6 @@ - - #include - --/* This seemed to be the easiest place to define these */ -- --#define U8_MAX ((u8)(~0U)) --#define U16_MAX ((u16)(~0U)) --#define U32_MAX ((u32)(~0U)) --#define U64_MAX ((u64)(~0ULL)) -- --#define S8_MAX ((s8)(U8_MAX >> 1)) --#define S16_MAX ((s16)(U16_MAX >> 1)) --#define S32_MAX ((s32)(U32_MAX >> 1)) --#define S64_MAX ((s64)(U64_MAX >> 1LL)) -- --#define S8_MIN ((s8)(-S8_MAX - 1)) --#define S16_MIN ((s16)(-S16_MAX - 1)) --#define S32_MIN ((s32)(-S32_MAX - 1)) --#define S64_MIN ((s64)(-S64_MAX - 1LL)) -- - /* - * in all cases, - * void **p pointer to position pointer -diff --git a/include/linux/dcache.h b/include/linux/dcache.h -index 9be5ac960fd8..c1999d1fe6f8 100644 ---- a/include/linux/dcache.h -+++ b/include/linux/dcache.h -@@ -120,15 +120,15 @@ struct dentry { - void *d_fsdata; /* fs-specific data */ - - struct list_head d_lru; /* LRU list */ -+ struct list_head d_child; /* child of parent list */ -+ struct list_head d_subdirs; /* our children */ - /* -- * d_child and d_rcu can share memory -+ * d_alias and d_rcu can share memory - */ - union { -- struct list_head d_child; /* child of parent list */ -+ struct hlist_node d_alias; /* inode alias list */ - struct rcu_head d_rcu; - } d_u; -- struct list_head d_subdirs; /* our children */ -- struct hlist_node d_alias; /* inode alias list */ - }; - - /* -diff --git a/include/linux/mm.h b/include/linux/mm.h -index c4085192c2b6..53b0d70120a1 100644 ---- a/include/linux/mm.h -+++ b/include/linux/mm.h -@@ -891,6 +891,7 @@ static inline int page_mapped(struct page *page) - #define VM_FAULT_WRITE 0x0008 /* Special case for get_user_pages */ - #define VM_FAULT_HWPOISON 0x0010 /* Hit poisoned small page */ - #define VM_FAULT_HWPOISON_LARGE 0x0020 /* Hit poisoned large page. Index encoded in upper bits */ -+#define VM_FAULT_SIGSEGV 0x0040 - - #define VM_FAULT_NOPAGE 0x0100 /* ->fault installed the pte, not return page */ - #define VM_FAULT_LOCKED 0x0200 /* ->fault locked the returned page */ -@@ -898,8 +899,8 @@ static inline int page_mapped(struct page *page) - - #define VM_FAULT_HWPOISON_LARGE_MASK 0xf000 /* encodes hpage index for large hwpoison */ - --#define VM_FAULT_ERROR (VM_FAULT_OOM | VM_FAULT_SIGBUS | VM_FAULT_HWPOISON | \ -- VM_FAULT_HWPOISON_LARGE) -+#define VM_FAULT_ERROR (VM_FAULT_OOM | VM_FAULT_SIGBUS | VM_FAULT_SIGSEGV | \ -+ VM_FAULT_HWPOISON | VM_FAULT_HWPOISON_LARGE) - - /* Encode hstate index for a hwpoisoned large page */ - #define VM_FAULT_SET_HINDEX(x) ((x) << 12) -diff --git a/kernel/cgroup.c b/kernel/cgroup.c -index d0def7fc2848..ef130605ac43 100644 ---- a/kernel/cgroup.c -+++ b/kernel/cgroup.c -@@ -984,7 +984,7 @@ static void cgroup_d_remove_dir(struct dentry *dentry) - parent = dentry->d_parent; - spin_lock(&parent->d_lock); - spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED); -- list_del_init(&dentry->d_u.d_child); -+ list_del_init(&dentry->d_child); - spin_unlock(&dentry->d_lock); - spin_unlock(&parent->d_lock); - remove_dir(dentry); -diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c -index 8d7e8098e768..640e4c44b170 100644 ---- a/kernel/trace/trace.c -+++ b/kernel/trace/trace.c -@@ -6063,7 +6063,7 @@ static int instance_mkdir (struct inode *inode, struct dentry *dentry, umode_t m - int ret; - - /* Paranoid: Make sure the parent is the "instances" directory */ -- parent = hlist_entry(inode->i_dentry.first, struct dentry, d_alias); -+ parent = hlist_entry(inode->i_dentry.first, struct dentry, d_u.d_alias); - if (WARN_ON_ONCE(parent != trace_instance_dir)) - return -ENOENT; - -@@ -6090,7 +6090,7 @@ static int instance_rmdir(struct inode *inode, struct dentry *dentry) - int ret; - - /* Paranoid: Make sure the parent is the "instances" directory */ -- parent = hlist_entry(inode->i_dentry.first, struct dentry, d_alias); -+ parent = hlist_entry(inode->i_dentry.first, struct dentry, d_u.d_alias); - if (WARN_ON_ONCE(parent != trace_instance_dir)) - return -ENOENT; - -diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c -index 001b349af939..5a898f15bfc6 100644 ---- a/kernel/trace/trace_events.c -+++ b/kernel/trace/trace_events.c -@@ -425,7 +425,7 @@ static void remove_event_file_dir(struct ftrace_event_file *file) - - if (dir) { - spin_lock(&dir->d_lock); /* probably unneeded */ -- list_for_each_entry(child, &dir->d_subdirs, d_u.d_child) { -+ list_for_each_entry(child, &dir->d_subdirs, d_child) { - if (child->d_inode) /* probably unneeded */ - child->d_inode->i_private = NULL; - } -diff --git a/mm/ksm.c b/mm/ksm.c -index 784d1e4bc385..7bf748f30aab 100644 ---- a/mm/ksm.c -+++ b/mm/ksm.c -@@ -376,7 +376,7 @@ static int break_ksm(struct vm_area_struct *vma, unsigned long addr) - else - ret = VM_FAULT_WRITE; - put_page(page); -- } while (!(ret & (VM_FAULT_WRITE | VM_FAULT_SIGBUS | VM_FAULT_OOM))); -+ } while (!(ret & (VM_FAULT_WRITE | VM_FAULT_SIGBUS | VM_FAULT_SIGSEGV | VM_FAULT_OOM))); - /* - * We must loop because handle_mm_fault() may back out if there's - * any difficulty e.g. if pte accessed bit gets updated concurrently. -diff --git a/mm/memory.c b/mm/memory.c -index 04232bb173f0..e6b1da3a8924 100644 ---- a/mm/memory.c -+++ b/mm/memory.c -@@ -1844,7 +1844,8 @@ long __get_user_pages(struct task_struct *tsk, struct mm_struct *mm, - else - return -EFAULT; - } -- if (ret & VM_FAULT_SIGBUS) -+ if (ret & (VM_FAULT_SIGBUS | -+ VM_FAULT_SIGSEGV)) - return i ? i : -EFAULT; - BUG(); - } -@@ -1954,7 +1955,7 @@ int fixup_user_fault(struct task_struct *tsk, struct mm_struct *mm, - return -ENOMEM; - if (ret & (VM_FAULT_HWPOISON | VM_FAULT_HWPOISON_LARGE)) - return -EHWPOISON; -- if (ret & VM_FAULT_SIGBUS) -+ if (ret & (VM_FAULT_SIGBUS | VM_FAULT_SIGSEGV)) - return -EFAULT; - BUG(); - } -@@ -3231,7 +3232,7 @@ static int do_anonymous_page(struct mm_struct *mm, struct vm_area_struct *vma, - - /* Check if we need to add a guard page to the stack */ - if (check_stack_guard_page(vma, address) < 0) -- return VM_FAULT_SIGBUS; -+ return VM_FAULT_SIGSEGV; - - /* Use the zero-page for reads */ - if (!(flags & FAULT_FLAG_WRITE)) { -diff --git a/net/ipv4/tcp_illinois.c b/net/ipv4/tcp_illinois.c -index 834857f3c871..86183c4e4fd5 100644 ---- a/net/ipv4/tcp_illinois.c -+++ b/net/ipv4/tcp_illinois.c -@@ -23,7 +23,6 @@ - #define ALPHA_MIN ((3*ALPHA_SCALE)/10) /* ~0.3 */ - #define ALPHA_MAX (10*ALPHA_SCALE) /* 10.0 */ - #define ALPHA_BASE ALPHA_SCALE /* 1.0 */ --#define U32_MAX ((u32)~0U) - #define RTT_MAX (U32_MAX / ALPHA_MAX) /* 3.3 secs */ - - #define BETA_SHIFT 6 -diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c -index ea7f52f3062d..a8be45e4d34f 100644 ---- a/net/ipv4/tcp_input.c -+++ b/net/ipv4/tcp_input.c -@@ -3076,10 +3076,11 @@ static int tcp_clean_rtx_queue(struct sock *sk, int prior_fackets, - if (seq_rtt < 0) { - seq_rtt = ca_seq_rtt; - } -- if (!(sacked & TCPCB_SACKED_ACKED)) -+ if (!(sacked & TCPCB_SACKED_ACKED)) { - reord = min(pkts_acked, reord); -- if (!after(scb->end_seq, tp->high_seq)) -- flag |= FLAG_ORIG_SACK_ACKED; -+ if (!after(scb->end_seq, tp->high_seq)) -+ flag |= FLAG_ORIG_SACK_ACKED; -+ } - } - - if (sacked & TCPCB_SACKED_ACKED) -diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c -index cce35e5a7ee6..7c3eec386a4b 100644 ---- a/net/ipv4/tcp_ipv4.c -+++ b/net/ipv4/tcp_ipv4.c -@@ -1901,7 +1901,7 @@ void tcp_v4_early_demux(struct sk_buff *skb) - skb->sk = sk; - skb->destructor = sock_edemux; - if (sk->sk_state != TCP_TIME_WAIT) { -- struct dst_entry *dst = sk->sk_rx_dst; -+ struct dst_entry *dst = ACCESS_ONCE(sk->sk_rx_dst); - - if (dst) - dst = dst_check(dst, 0); -diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c -index 92b5e1f7d3b0..7681a1bbd97f 100644 ---- a/net/ipv4/tcp_output.c -+++ b/net/ipv4/tcp_output.c -@@ -2772,6 +2772,8 @@ struct sk_buff *tcp_make_synack(struct sock *sk, struct dst_entry *dst, - } - #endif - -+ /* Do not fool tcpdump (if any), clean our debris */ -+ skb->tstamp.tv64 = 0; - return skb; - } - EXPORT_SYMBOL(tcp_make_synack); -diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c -index 060a0449acaa..05f361338c2e 100644 ---- a/net/ipv6/ndisc.c -+++ b/net/ipv6/ndisc.c -@@ -1193,7 +1193,14 @@ static void ndisc_router_discovery(struct sk_buff *skb) - if (rt) - rt6_set_expires(rt, jiffies + (HZ * lifetime)); - if (ra_msg->icmph.icmp6_hop_limit) { -- in6_dev->cnf.hop_limit = ra_msg->icmph.icmp6_hop_limit; -+ /* Only set hop_limit on the interface if it is higher than -+ * the current hop_limit. -+ */ -+ if (in6_dev->cnf.hop_limit < ra_msg->icmph.icmp6_hop_limit) { -+ in6_dev->cnf.hop_limit = ra_msg->icmph.icmp6_hop_limit; -+ } else { -+ ND_PRINTK(2, warn, "RA: Got route advertisement with lower hop_limit than current\n"); -+ } - if (rt) - dst_metric_set(&rt->dst, RTAX_HOPLIMIT, - ra_msg->icmph.icmp6_hop_limit); -diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c -index 1a87659a6139..4659b8ab55d9 100644 ---- a/net/ipv6/tcp_ipv6.c -+++ b/net/ipv6/tcp_ipv6.c -@@ -1616,7 +1616,7 @@ static void tcp_v6_early_demux(struct sk_buff *skb) - skb->sk = sk; - skb->destructor = sock_edemux; - if (sk->sk_state != TCP_TIME_WAIT) { -- struct dst_entry *dst = sk->sk_rx_dst; -+ struct dst_entry *dst = ACCESS_ONCE(sk->sk_rx_dst); - - if (dst) - dst = dst_check(dst, inet6_sk(sk)->rx_dst_cookie); -diff --git a/net/netfilter/nf_conntrack_proto_generic.c b/net/netfilter/nf_conntrack_proto_generic.c -index d25f29377648..957c1db66652 100644 ---- a/net/netfilter/nf_conntrack_proto_generic.c -+++ b/net/netfilter/nf_conntrack_proto_generic.c -@@ -14,6 +14,30 @@ - - static unsigned int nf_ct_generic_timeout __read_mostly = 600*HZ; - -+static bool nf_generic_should_process(u8 proto) -+{ -+ switch (proto) { -+#ifdef CONFIG_NF_CT_PROTO_SCTP_MODULE -+ case IPPROTO_SCTP: -+ return false; -+#endif -+#ifdef CONFIG_NF_CT_PROTO_DCCP_MODULE -+ case IPPROTO_DCCP: -+ return false; -+#endif -+#ifdef CONFIG_NF_CT_PROTO_GRE_MODULE -+ case IPPROTO_GRE: -+ return false; -+#endif -+#ifdef CONFIG_NF_CT_PROTO_UDPLITE_MODULE -+ case IPPROTO_UDPLITE: -+ return false; -+#endif -+ default: -+ return true; -+ } -+} -+ - static inline struct nf_generic_net *generic_pernet(struct net *net) - { - return &net->ct.nf_ct_proto.generic; -@@ -67,7 +91,7 @@ static int generic_packet(struct nf_conn *ct, - static bool generic_new(struct nf_conn *ct, const struct sk_buff *skb, - unsigned int dataoff, unsigned int *timeouts) - { -- return true; -+ return nf_generic_should_process(nf_ct_protonum(ct)); - } - - #if IS_ENABLED(CONFIG_NF_CT_NETLINK_TIMEOUT) -diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c -index fd3f0180e08f..6af1c42a9cf3 100644 ---- a/scripts/kconfig/menu.c -+++ b/scripts/kconfig/menu.c -@@ -525,7 +525,7 @@ static void get_prompt_str(struct gstr *r, struct property *prop, - { - int i, j; - struct menu *submenu[8], *menu, *location = NULL; -- struct jump_key *jump; -+ struct jump_key *jump = NULL; - - str_printf(r, _("Prompt: %s\n"), _(prop->text)); - menu = prop->menu->parent; -@@ -563,7 +563,7 @@ static void get_prompt_str(struct gstr *r, struct property *prop, - str_printf(r, _(" Location:\n")); - for (j = 4; --i >= 0; j += 2) { - menu = submenu[i]; -- if (head && location && menu == location) -+ if (jump && menu == location) - jump->offset = r->len - 1; - str_printf(r, "%*c-> %s", j, ' ', - _(menu_get_prompt(menu))); -diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c -index 464be51025f6..a96bed4db3e8 100644 ---- a/security/selinux/selinuxfs.c -+++ b/security/selinux/selinuxfs.c -@@ -1190,7 +1190,7 @@ static void sel_remove_entries(struct dentry *de) - spin_lock(&de->d_lock); - node = de->d_subdirs.next; - while (node != &de->d_subdirs) { -- struct dentry *d = list_entry(node, struct dentry, d_u.d_child); -+ struct dentry *d = list_entry(node, struct dentry, d_child); - - spin_lock_nested(&d->d_lock, DENTRY_D_LOCK_NESTED); - list_del_init(node); -@@ -1664,12 +1664,12 @@ static void sel_remove_classes(void) - - list_for_each(class_node, &class_dir->d_subdirs) { - struct dentry *class_subdir = list_entry(class_node, -- struct dentry, d_u.d_child); -+ struct dentry, d_child); - struct list_head *class_subdir_node; - - list_for_each(class_subdir_node, &class_subdir->d_subdirs) { - struct dentry *d = list_entry(class_subdir_node, -- struct dentry, d_u.d_child); -+ struct dentry, d_child); - - if (d->d_inode) - if (d->d_inode->i_mode & S_IFDIR) diff --git a/patch/kernel/marvell-default/1-patch-3.10.76-77.patch b/patch/kernel/marvell-default/1-patch-3.10.76-77.patch deleted file mode 100644 index c09c0a9772..0000000000 --- a/patch/kernel/marvell-default/1-patch-3.10.76-77.patch +++ /dev/null @@ -1,1848 +0,0 @@ -diff --git a/Makefile b/Makefile -index 019a6a4b386d..923ad8a64e3b 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,6 +1,6 @@ - VERSION = 3 - PATCHLEVEL = 10 --SUBLEVEL = 76 -+SUBLEVEL = 77 - EXTRAVERSION = - NAME = TOSSUG Baby Fish - -diff --git a/arch/arm/include/asm/elf.h b/arch/arm/include/asm/elf.h -index 56211f2084ef..ce6e30628cc1 100644 ---- a/arch/arm/include/asm/elf.h -+++ b/arch/arm/include/asm/elf.h -@@ -116,7 +116,7 @@ int dump_task_regs(struct task_struct *t, elf_gregset_t *elfregs); - the loader. We need to make sure that it is out of the way of the program - that it will "exec", and that there is sufficient room for the brk. */ - --#define ELF_ET_DYN_BASE (2 * TASK_SIZE / 3) -+#define ELF_ET_DYN_BASE (TASK_SIZE / 3 * 2) - - /* When the program starts, a1 contains a pointer to a function to be - registered with atexit, as per the SVR4 ABI. A value of 0 means we -diff --git a/arch/arm/mach-s3c64xx/crag6410.h b/arch/arm/mach-s3c64xx/crag6410.h -index 4c3c9994fc2c..81dc722ced57 100644 ---- a/arch/arm/mach-s3c64xx/crag6410.h -+++ b/arch/arm/mach-s3c64xx/crag6410.h -@@ -14,6 +14,7 @@ - #include - - #define GLENFARCLAS_PMIC_IRQ_BASE IRQ_BOARD_START -+#define BANFF_PMIC_IRQ_BASE (IRQ_BOARD_START + 64) - - #define PCA935X_GPIO_BASE GPIO_BOARD_START - #define CODEC_GPIO_BASE (GPIO_BOARD_START + 8) -diff --git a/arch/arm/mach-s3c64xx/mach-crag6410.c b/arch/arm/mach-s3c64xx/mach-crag6410.c -index 8ad88ace795a..5fa9ac9104e1 100644 ---- a/arch/arm/mach-s3c64xx/mach-crag6410.c -+++ b/arch/arm/mach-s3c64xx/mach-crag6410.c -@@ -558,6 +558,7 @@ static struct wm831x_touch_pdata touch_pdata = { - - static struct wm831x_pdata crag_pmic_pdata = { - .wm831x_num = 1, -+ .irq_base = BANFF_PMIC_IRQ_BASE, - .gpio_base = BANFF_PMIC_GPIO_BASE, - .soft_shutdown = true, - -diff --git a/arch/arm64/include/asm/timex.h b/arch/arm64/include/asm/timex.h -index b24a31a7e2c9..81a076eb37fa 100644 ---- a/arch/arm64/include/asm/timex.h -+++ b/arch/arm64/include/asm/timex.h -@@ -16,14 +16,14 @@ - #ifndef __ASM_TIMEX_H - #define __ASM_TIMEX_H - -+#include -+ - /* - * Use the current timer as a cycle counter since this is what we use for - * the delay loop. - */ --#define get_cycles() ({ cycles_t c; read_current_timer(&c); c; }) -+#define get_cycles() arch_counter_get_cntvct() - - #include - --#define ARCH_HAS_READ_CURRENT_TIMER -- - #endif -diff --git a/arch/arm64/kernel/time.c b/arch/arm64/kernel/time.c -index a551f88ae2c1..03dc3718eb13 100644 ---- a/arch/arm64/kernel/time.c -+++ b/arch/arm64/kernel/time.c -@@ -68,12 +68,6 @@ unsigned long long notrace sched_clock(void) - return arch_timer_read_counter() * sched_clock_mult; - } - --int read_current_timer(unsigned long *timer_value) --{ -- *timer_value = arch_timer_read_counter(); -- return 0; --} -- - void __init time_init(void) - { - u32 arch_timer_rate; -diff --git a/arch/c6x/kernel/time.c b/arch/c6x/kernel/time.c -index 356ee84cad95..04845aaf5985 100644 ---- a/arch/c6x/kernel/time.c -+++ b/arch/c6x/kernel/time.c -@@ -49,7 +49,7 @@ u64 sched_clock(void) - return (tsc * sched_clock_multiplier) >> SCHED_CLOCK_SHIFT; - } - --void time_init(void) -+void __init time_init(void) - { - u64 tmp = (u64)NSEC_PER_SEC << SCHED_CLOCK_SHIFT; - -diff --git a/arch/mips/include/asm/suspend.h b/arch/mips/include/asm/suspend.h -deleted file mode 100644 -index 3adac3b53d19..000000000000 ---- a/arch/mips/include/asm/suspend.h -+++ /dev/null -@@ -1,7 +0,0 @@ --#ifndef __ASM_SUSPEND_H --#define __ASM_SUSPEND_H -- --/* References to section boundaries */ --extern const void __nosave_begin, __nosave_end; -- --#endif /* __ASM_SUSPEND_H */ -diff --git a/arch/mips/power/cpu.c b/arch/mips/power/cpu.c -index 521e5963df05..2129e67723ff 100644 ---- a/arch/mips/power/cpu.c -+++ b/arch/mips/power/cpu.c -@@ -7,7 +7,7 @@ - * Author: Hu Hongbing - * Wu Zhangjin - */ --#include -+#include - #include - #include - -diff --git a/arch/mips/power/hibernate.S b/arch/mips/power/hibernate.S -index 32a7c828f073..e7567c8a9e79 100644 ---- a/arch/mips/power/hibernate.S -+++ b/arch/mips/power/hibernate.S -@@ -30,6 +30,8 @@ LEAF(swsusp_arch_suspend) - END(swsusp_arch_suspend) - - LEAF(swsusp_arch_resume) -+ /* Avoid TLB mismatch during and after kernel resume */ -+ jal local_flush_tlb_all - PTR_L t0, restore_pblist - 0: - PTR_L t1, PBE_ADDRESS(t0) /* source */ -@@ -43,7 +45,6 @@ LEAF(swsusp_arch_resume) - bne t1, t3, 1b - PTR_L t0, PBE_NEXT(t0) - bnez t0, 0b -- jal local_flush_tlb_all /* Avoid TLB mismatch after kernel resume */ - PTR_LA t0, saved_regs - PTR_L ra, PT_R31(t0) - PTR_L sp, PT_R29(t0) -diff --git a/arch/powerpc/kernel/suspend.c b/arch/powerpc/kernel/suspend.c -index 0167d53da30c..a531154cc0f3 100644 ---- a/arch/powerpc/kernel/suspend.c -+++ b/arch/powerpc/kernel/suspend.c -@@ -9,9 +9,7 @@ - - #include - #include -- --/* References to section boundaries */ --extern const void __nosave_begin, __nosave_end; -+#include - - /* - * pfn_is_nosave - check if given pfn is in the 'nosave' section -diff --git a/arch/powerpc/perf/callchain.c b/arch/powerpc/perf/callchain.c -index 2396dda282cd..ead55351b254 100644 ---- a/arch/powerpc/perf/callchain.c -+++ b/arch/powerpc/perf/callchain.c -@@ -243,7 +243,7 @@ static void perf_callchain_user_64(struct perf_callchain_entry *entry, - sp = regs->gpr[1]; - perf_callchain_store(entry, next_ip); - -- for (;;) { -+ while (entry->nr < PERF_MAX_STACK_DEPTH) { - fp = (unsigned long __user *) sp; - if (!valid_user_sp(sp, 1) || read_user_stack_64(fp, &next_sp)) - return; -diff --git a/arch/s390/kernel/suspend.c b/arch/s390/kernel/suspend.c -index c479d2f9605b..58cbb75e89e9 100644 ---- a/arch/s390/kernel/suspend.c -+++ b/arch/s390/kernel/suspend.c -@@ -9,12 +9,9 @@ - #include - #include - #include -+#include - #include -- --/* -- * References to section boundaries -- */ --extern const void __nosave_begin, __nosave_end; -+#include - - /* - * The restore of the saved pages in an hibernation image will set -@@ -138,6 +135,8 @@ int pfn_is_nosave(unsigned long pfn) - { - unsigned long nosave_begin_pfn = PFN_DOWN(__pa(&__nosave_begin)); - unsigned long nosave_end_pfn = PFN_DOWN(__pa(&__nosave_end)); -+ unsigned long eshared_pfn = PFN_DOWN(__pa(&_eshared)) - 1; -+ unsigned long stext_pfn = PFN_DOWN(__pa(&_stext)); - - /* Always save lowcore pages (LC protection might be enabled). */ - if (pfn <= LC_PAGES) -@@ -145,6 +144,8 @@ int pfn_is_nosave(unsigned long pfn) - if (pfn >= nosave_begin_pfn && pfn < nosave_end_pfn) - return 1; - /* Skip memory holes and read-only pages (NSS, DCSS, ...). */ -+ if (pfn >= stext_pfn && pfn <= eshared_pfn) -+ return ipl_info.type == IPL_TYPE_NSS ? 1 : 0; - if (tprot(PFN_PHYS(pfn))) - return 1; - return 0; -diff --git a/arch/s390/kvm/priv.c b/arch/s390/kvm/priv.c -index 6bbd7b5a0bbe..0220c2ba7590 100644 ---- a/arch/s390/kvm/priv.c -+++ b/arch/s390/kvm/priv.c -@@ -328,6 +328,7 @@ static void handle_stsi_3_2_2(struct kvm_vcpu *vcpu, struct sysinfo_3_2_2 *mem) - for (n = mem->count - 1; n > 0 ; n--) - memcpy(&mem->vm[n], &mem->vm[n - 1], sizeof(mem->vm[0])); - -+ memset(&mem->vm[0], 0, sizeof(mem->vm[0])); - mem->vm[0].cpus_total = cpus; - mem->vm[0].cpus_configured = cpus; - mem->vm[0].cpus_standby = 0; -diff --git a/arch/sh/include/asm/sections.h b/arch/sh/include/asm/sections.h -index 1b6199740e98..7a99e6af6372 100644 ---- a/arch/sh/include/asm/sections.h -+++ b/arch/sh/include/asm/sections.h -@@ -3,7 +3,6 @@ - - #include - --extern long __nosave_begin, __nosave_end; - extern long __machvec_start, __machvec_end; - extern char __uncached_start, __uncached_end; - extern char __start_eh_frame[], __stop_eh_frame[]; -diff --git a/arch/sparc/power/hibernate.c b/arch/sparc/power/hibernate.c -index 42b0b8ce699a..17bd2e167e07 100644 ---- a/arch/sparc/power/hibernate.c -+++ b/arch/sparc/power/hibernate.c -@@ -9,11 +9,9 @@ - #include - #include - #include -+#include - #include - --/* References to section boundaries */ --extern const void __nosave_begin, __nosave_end; -- - struct saved_context saved_context; - - /* -diff --git a/arch/unicore32/include/mach/pm.h b/arch/unicore32/include/mach/pm.h -index 4dcd34ae194c..77b522694e74 100644 ---- a/arch/unicore32/include/mach/pm.h -+++ b/arch/unicore32/include/mach/pm.h -@@ -36,8 +36,5 @@ extern int puv3_pm_enter(suspend_state_t state); - /* Defined in hibernate_asm.S */ - extern int restore_image(pgd_t *resume_pg_dir, struct pbe *restore_pblist); - --/* References to section boundaries */ --extern const void __nosave_begin, __nosave_end; -- - extern struct pbe *restore_pblist; - #endif -diff --git a/arch/unicore32/kernel/hibernate.c b/arch/unicore32/kernel/hibernate.c -index d75ef8b6cb56..9969ec374abb 100644 ---- a/arch/unicore32/kernel/hibernate.c -+++ b/arch/unicore32/kernel/hibernate.c -@@ -18,6 +18,7 @@ - #include - #include - #include -+#include - #include - - #include "mach/pm.h" -diff --git a/arch/x86/power/hibernate_32.c b/arch/x86/power/hibernate_32.c -index 7d28c885d238..291226b952a9 100644 ---- a/arch/x86/power/hibernate_32.c -+++ b/arch/x86/power/hibernate_32.c -@@ -13,13 +13,11 @@ - #include - #include - #include -+#include - - /* Defined in hibernate_asm_32.S */ - extern int restore_image(void); - --/* References to section boundaries */ --extern const void __nosave_begin, __nosave_end; -- - /* Pointer to the temporary resume page tables */ - pgd_t *resume_pg_dir; - -diff --git a/arch/x86/power/hibernate_64.c b/arch/x86/power/hibernate_64.c -index a0fde91c16cf..8ecaed127634 100644 ---- a/arch/x86/power/hibernate_64.c -+++ b/arch/x86/power/hibernate_64.c -@@ -17,11 +17,9 @@ - #include - #include - #include -+#include - #include - --/* References to section boundaries */ --extern const void __nosave_begin, __nosave_end; -- - /* Defined in hibernate_asm_64.S */ - extern int restore_image(void); - -diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig -index 0a1b95f81a32..2b086a6ae6c7 100644 ---- a/arch/xtensa/Kconfig -+++ b/arch/xtensa/Kconfig -@@ -287,6 +287,36 @@ menu "Executable file formats" - - source "fs/Kconfig.binfmt" - -+config XTFPGA_LCD -+ bool "Enable XTFPGA LCD driver" -+ depends on XTENSA_PLATFORM_XTFPGA -+ default n -+ help -+ There's a 2x16 LCD on most of XTFPGA boards, kernel may output -+ progress messages there during bootup/shutdown. It may be useful -+ during board bringup. -+ -+ If unsure, say N. -+ -+config XTFPGA_LCD_BASE_ADDR -+ hex "XTFPGA LCD base address" -+ depends on XTFPGA_LCD -+ default "0x0d0c0000" -+ help -+ Base address of the LCD controller inside KIO region. -+ Different boards from XTFPGA family have LCD controller at different -+ addresses. Please consult prototyping user guide for your board for -+ the correct address. Wrong address here may lead to hardware lockup. -+ -+config XTFPGA_LCD_8BIT_ACCESS -+ bool "Use 8-bit access to XTFPGA LCD" -+ depends on XTFPGA_LCD -+ default n -+ help -+ LCD may be connected with 4- or 8-bit interface, 8-bit access may -+ only be used with 8-bit interface. Please consult prototyping user -+ guide for your board for the correct interface width. -+ - endmenu - - source "net/Kconfig" -diff --git a/arch/xtensa/include/uapi/asm/unistd.h b/arch/xtensa/include/uapi/asm/unistd.h -index 513effd48060..d07c1886bc8f 100644 ---- a/arch/xtensa/include/uapi/asm/unistd.h -+++ b/arch/xtensa/include/uapi/asm/unistd.h -@@ -715,7 +715,7 @@ __SYSCALL(323, sys_process_vm_writev, 6) - __SYSCALL(324, sys_name_to_handle_at, 5) - #define __NR_open_by_handle_at 325 - __SYSCALL(325, sys_open_by_handle_at, 3) --#define __NR_sync_file_range 326 -+#define __NR_sync_file_range2 326 - __SYSCALL(326, sys_sync_file_range2, 6) - #define __NR_perf_event_open 327 - __SYSCALL(327, sys_perf_event_open, 5) -diff --git a/arch/xtensa/platforms/xtfpga/Makefile b/arch/xtensa/platforms/xtfpga/Makefile -index b9ae206340cd..7839d38b2337 100644 ---- a/arch/xtensa/platforms/xtfpga/Makefile -+++ b/arch/xtensa/platforms/xtfpga/Makefile -@@ -6,4 +6,5 @@ - # - # Note 2! The CFLAGS definitions are in the main makefile... - --obj-y = setup.o lcd.o -+obj-y += setup.o -+obj-$(CONFIG_XTFPGA_LCD) += lcd.o -diff --git a/arch/xtensa/platforms/xtfpga/include/platform/hardware.h b/arch/xtensa/platforms/xtfpga/include/platform/hardware.h -index 4416773cbde5..b39fbcf5c611 100644 ---- a/arch/xtensa/platforms/xtfpga/include/platform/hardware.h -+++ b/arch/xtensa/platforms/xtfpga/include/platform/hardware.h -@@ -44,9 +44,6 @@ - - /* UART */ - #define DUART16552_PADDR (XCHAL_KIO_PADDR + 0x0D050020) --/* LCD instruction and data addresses. */ --#define LCD_INSTR_ADDR ((char *)IOADDR(0x0D040000)) --#define LCD_DATA_ADDR ((char *)IOADDR(0x0D040004)) - - /* Misc. */ - #define XTFPGA_FPGAREGS_VADDR IOADDR(0x0D020000) -diff --git a/arch/xtensa/platforms/xtfpga/include/platform/lcd.h b/arch/xtensa/platforms/xtfpga/include/platform/lcd.h -index 0e435645af5a..4c8541ed1139 100644 ---- a/arch/xtensa/platforms/xtfpga/include/platform/lcd.h -+++ b/arch/xtensa/platforms/xtfpga/include/platform/lcd.h -@@ -11,10 +11,25 @@ - #ifndef __XTENSA_XTAVNET_LCD_H - #define __XTENSA_XTAVNET_LCD_H - -+#ifdef CONFIG_XTFPGA_LCD - /* Display string STR at position POS on the LCD. */ - void lcd_disp_at_pos(char *str, unsigned char pos); - - /* Shift the contents of the LCD display left or right. */ - void lcd_shiftleft(void); - void lcd_shiftright(void); -+#else -+static inline void lcd_disp_at_pos(char *str, unsigned char pos) -+{ -+} -+ -+static inline void lcd_shiftleft(void) -+{ -+} -+ -+static inline void lcd_shiftright(void) -+{ -+} -+#endif -+ - #endif -diff --git a/arch/xtensa/platforms/xtfpga/lcd.c b/arch/xtensa/platforms/xtfpga/lcd.c -index 2872301598df..4dc0c1b43f4b 100644 ---- a/arch/xtensa/platforms/xtfpga/lcd.c -+++ b/arch/xtensa/platforms/xtfpga/lcd.c -@@ -1,50 +1,63 @@ - /* -- * Driver for the LCD display on the Tensilica LX60 Board. -+ * Driver for the LCD display on the Tensilica XTFPGA board family. -+ * http://www.mytechcorp.com/cfdata/productFile/File1/MOC-16216B-B-A0A04.pdf - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. - * - * Copyright (C) 2001, 2006 Tensilica Inc. -+ * Copyright (C) 2015 Cadence Design Systems Inc. - */ - --/* -- * -- * FIXME: this code is from the examples from the LX60 user guide. -- * -- * The lcd_pause function does busy waiting, which is probably not -- * great. Maybe the code could be changed to use kernel timers, or -- * change the hardware to not need to wait. -- */ -- -+#include - #include - #include - - #include - #include --#include - --#define LCD_PAUSE_ITERATIONS 4000 -+/* LCD instruction and data addresses. */ -+#define LCD_INSTR_ADDR ((char *)IOADDR(CONFIG_XTFPGA_LCD_BASE_ADDR)) -+#define LCD_DATA_ADDR (LCD_INSTR_ADDR + 4) -+ - #define LCD_CLEAR 0x1 - #define LCD_DISPLAY_ON 0xc - - /* 8bit and 2 lines display */ - #define LCD_DISPLAY_MODE8BIT 0x38 -+#define LCD_DISPLAY_MODE4BIT 0x28 - #define LCD_DISPLAY_POS 0x80 - #define LCD_SHIFT_LEFT 0x18 - #define LCD_SHIFT_RIGHT 0x1c - -+static void lcd_put_byte(u8 *addr, u8 data) -+{ -+#ifdef CONFIG_XTFPGA_LCD_8BIT_ACCESS -+ ACCESS_ONCE(*addr) = data; -+#else -+ ACCESS_ONCE(*addr) = data & 0xf0; -+ ACCESS_ONCE(*addr) = (data << 4) & 0xf0; -+#endif -+} -+ - static int __init lcd_init(void) - { -- *LCD_INSTR_ADDR = LCD_DISPLAY_MODE8BIT; -+ ACCESS_ONCE(*LCD_INSTR_ADDR) = LCD_DISPLAY_MODE8BIT; - mdelay(5); -- *LCD_INSTR_ADDR = LCD_DISPLAY_MODE8BIT; -+ ACCESS_ONCE(*LCD_INSTR_ADDR) = LCD_DISPLAY_MODE8BIT; - udelay(200); -- *LCD_INSTR_ADDR = LCD_DISPLAY_MODE8BIT; -+ ACCESS_ONCE(*LCD_INSTR_ADDR) = LCD_DISPLAY_MODE8BIT; -+ udelay(50); -+#ifndef CONFIG_XTFPGA_LCD_8BIT_ACCESS -+ ACCESS_ONCE(*LCD_INSTR_ADDR) = LCD_DISPLAY_MODE4BIT; -+ udelay(50); -+ lcd_put_byte(LCD_INSTR_ADDR, LCD_DISPLAY_MODE4BIT); - udelay(50); -- *LCD_INSTR_ADDR = LCD_DISPLAY_ON; -+#endif -+ lcd_put_byte(LCD_INSTR_ADDR, LCD_DISPLAY_ON); - udelay(50); -- *LCD_INSTR_ADDR = LCD_CLEAR; -+ lcd_put_byte(LCD_INSTR_ADDR, LCD_CLEAR); - mdelay(10); - lcd_disp_at_pos("XTENSA LINUX", 0); - return 0; -@@ -52,10 +65,10 @@ static int __init lcd_init(void) - - void lcd_disp_at_pos(char *str, unsigned char pos) - { -- *LCD_INSTR_ADDR = LCD_DISPLAY_POS | pos; -+ lcd_put_byte(LCD_INSTR_ADDR, LCD_DISPLAY_POS | pos); - udelay(100); - while (*str != 0) { -- *LCD_DATA_ADDR = *str; -+ lcd_put_byte(LCD_DATA_ADDR, *str); - udelay(200); - str++; - } -@@ -63,13 +76,13 @@ void lcd_disp_at_pos(char *str, unsigned char pos) - - void lcd_shiftleft(void) - { -- *LCD_INSTR_ADDR = LCD_SHIFT_LEFT; -+ lcd_put_byte(LCD_INSTR_ADDR, LCD_SHIFT_LEFT); - udelay(50); - } - - void lcd_shiftright(void) - { -- *LCD_INSTR_ADDR = LCD_SHIFT_RIGHT; -+ lcd_put_byte(LCD_INSTR_ADDR, LCD_SHIFT_RIGHT); - udelay(50); - } - -diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h -index 7695b5dd9d2d..35287ab445cd 100644 ---- a/drivers/gpu/drm/i915/i915_reg.h -+++ b/drivers/gpu/drm/i915/i915_reg.h -@@ -909,6 +909,7 @@ - #define GMBUS_CYCLE_INDEX (2<<25) - #define GMBUS_CYCLE_STOP (4<<25) - #define GMBUS_BYTE_COUNT_SHIFT 16 -+#define GMBUS_BYTE_COUNT_MAX 256U - #define GMBUS_SLAVE_INDEX_SHIFT 8 - #define GMBUS_SLAVE_ADDR_SHIFT 1 - #define GMBUS_SLAVE_READ (1<<0) -diff --git a/drivers/gpu/drm/i915/intel_i2c.c b/drivers/gpu/drm/i915/intel_i2c.c -index 639fe192997c..4a21e13cc58c 100644 ---- a/drivers/gpu/drm/i915/intel_i2c.c -+++ b/drivers/gpu/drm/i915/intel_i2c.c -@@ -276,18 +276,17 @@ gmbus_wait_idle(struct drm_i915_private *dev_priv) - } - - static int --gmbus_xfer_read(struct drm_i915_private *dev_priv, struct i2c_msg *msg, -- u32 gmbus1_index) -+gmbus_xfer_read_chunk(struct drm_i915_private *dev_priv, -+ unsigned short addr, u8 *buf, unsigned int len, -+ u32 gmbus1_index) - { - int reg_offset = dev_priv->gpio_mmio_base; -- u16 len = msg->len; -- u8 *buf = msg->buf; - - I915_WRITE(GMBUS1 + reg_offset, - gmbus1_index | - GMBUS_CYCLE_WAIT | - (len << GMBUS_BYTE_COUNT_SHIFT) | -- (msg->addr << GMBUS_SLAVE_ADDR_SHIFT) | -+ (addr << GMBUS_SLAVE_ADDR_SHIFT) | - GMBUS_SLAVE_READ | GMBUS_SW_RDY); - while (len) { - int ret; -@@ -309,11 +308,35 @@ gmbus_xfer_read(struct drm_i915_private *dev_priv, struct i2c_msg *msg, - } - - static int --gmbus_xfer_write(struct drm_i915_private *dev_priv, struct i2c_msg *msg) -+gmbus_xfer_read(struct drm_i915_private *dev_priv, struct i2c_msg *msg, -+ u32 gmbus1_index) - { -- int reg_offset = dev_priv->gpio_mmio_base; -- u16 len = msg->len; - u8 *buf = msg->buf; -+ unsigned int rx_size = msg->len; -+ unsigned int len; -+ int ret; -+ -+ do { -+ len = min(rx_size, GMBUS_BYTE_COUNT_MAX); -+ -+ ret = gmbus_xfer_read_chunk(dev_priv, msg->addr, -+ buf, len, gmbus1_index); -+ if (ret) -+ return ret; -+ -+ rx_size -= len; -+ buf += len; -+ } while (rx_size != 0); -+ -+ return 0; -+} -+ -+static int -+gmbus_xfer_write_chunk(struct drm_i915_private *dev_priv, -+ unsigned short addr, u8 *buf, unsigned int len) -+{ -+ int reg_offset = dev_priv->gpio_mmio_base; -+ unsigned int chunk_size = len; - u32 val, loop; - - val = loop = 0; -@@ -325,8 +348,8 @@ gmbus_xfer_write(struct drm_i915_private *dev_priv, struct i2c_msg *msg) - I915_WRITE(GMBUS3 + reg_offset, val); - I915_WRITE(GMBUS1 + reg_offset, - GMBUS_CYCLE_WAIT | -- (msg->len << GMBUS_BYTE_COUNT_SHIFT) | -- (msg->addr << GMBUS_SLAVE_ADDR_SHIFT) | -+ (chunk_size << GMBUS_BYTE_COUNT_SHIFT) | -+ (addr << GMBUS_SLAVE_ADDR_SHIFT) | - GMBUS_SLAVE_WRITE | GMBUS_SW_RDY); - while (len) { - int ret; -@@ -343,6 +366,29 @@ gmbus_xfer_write(struct drm_i915_private *dev_priv, struct i2c_msg *msg) - if (ret) - return ret; - } -+ -+ return 0; -+} -+ -+static int -+gmbus_xfer_write(struct drm_i915_private *dev_priv, struct i2c_msg *msg) -+{ -+ u8 *buf = msg->buf; -+ unsigned int tx_size = msg->len; -+ unsigned int len; -+ int ret; -+ -+ do { -+ len = min(tx_size, GMBUS_BYTE_COUNT_MAX); -+ -+ ret = gmbus_xfer_write_chunk(dev_priv, msg->addr, buf, len); -+ if (ret) -+ return ret; -+ -+ buf += len; -+ tx_size -= len; -+ } while (tx_size != 0); -+ - return 0; - } - -diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c -index 971dd8795b68..8ac333094991 100644 ---- a/drivers/gpu/drm/radeon/atombios_crtc.c -+++ b/drivers/gpu/drm/radeon/atombios_crtc.c -@@ -312,8 +312,10 @@ atombios_set_crtc_dtd_timing(struct drm_crtc *crtc, - misc |= ATOM_COMPOSITESYNC; - if (mode->flags & DRM_MODE_FLAG_INTERLACE) - misc |= ATOM_INTERLACE; -- if (mode->flags & DRM_MODE_FLAG_DBLSCAN) -+ if (mode->flags & DRM_MODE_FLAG_DBLCLK) - misc |= ATOM_DOUBLE_CLOCK_MODE; -+ if (mode->flags & DRM_MODE_FLAG_DBLSCAN) -+ misc |= ATOM_H_REPLICATIONBY2 | ATOM_V_REPLICATIONBY2; - - args.susModeMiscInfo.usAccess = cpu_to_le16(misc); - args.ucCRTC = radeon_crtc->crtc_id; -@@ -356,8 +358,10 @@ static void atombios_crtc_set_timing(struct drm_crtc *crtc, - misc |= ATOM_COMPOSITESYNC; - if (mode->flags & DRM_MODE_FLAG_INTERLACE) - misc |= ATOM_INTERLACE; -- if (mode->flags & DRM_MODE_FLAG_DBLSCAN) -+ if (mode->flags & DRM_MODE_FLAG_DBLCLK) - misc |= ATOM_DOUBLE_CLOCK_MODE; -+ if (mode->flags & DRM_MODE_FLAG_DBLSCAN) -+ misc |= ATOM_H_REPLICATIONBY2 | ATOM_V_REPLICATIONBY2; - - args.susModeMiscInfo.usAccess = cpu_to_le16(misc); - args.ucCRTC = radeon_crtc->crtc_id; -diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c -index 92f34de7aee9..05e6a7d13d4e 100644 ---- a/drivers/hv/channel.c -+++ b/drivers/hv/channel.c -@@ -169,7 +169,7 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, - GFP_KERNEL); - if (!open_info) { - err = -ENOMEM; -- goto error0; -+ goto error_gpadl; - } - - init_completion(&open_info->waitevent); -@@ -185,7 +185,7 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, - - if (userdatalen > MAX_USER_DEFINED_BYTES) { - err = -EINVAL; -- goto error0; -+ goto error_gpadl; - } - - if (userdatalen) -@@ -226,6 +226,9 @@ error1: - list_del(&open_info->msglistentry); - spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags); - -+error_gpadl: -+ vmbus_teardown_gpadl(newchannel, newchannel->ringbuffer_gpadlhandle); -+ - error0: - free_pages((unsigned long)out, - get_order(send_ringbuffer_size + recv_ringbuffer_size)); -diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c -index 48e31ed69dbf..9d539cbfc833 100644 ---- a/drivers/i2c/i2c-core.c -+++ b/drivers/i2c/i2c-core.c -@@ -206,6 +206,7 @@ int i2c_generic_scl_recovery(struct i2c_adapter *adap) - adap->bus_recovery_info->set_scl(adap, 1); - return i2c_generic_recovery(adap); - } -+EXPORT_SYMBOL_GPL(i2c_generic_scl_recovery); - - int i2c_generic_gpio_recovery(struct i2c_adapter *adap) - { -@@ -220,6 +221,7 @@ int i2c_generic_gpio_recovery(struct i2c_adapter *adap) - - return ret; - } -+EXPORT_SYMBOL_GPL(i2c_generic_gpio_recovery); - - int i2c_recover_bus(struct i2c_adapter *adap) - { -@@ -229,6 +231,7 @@ int i2c_recover_bus(struct i2c_adapter *adap) - dev_dbg(&adap->dev, "Trying i2c bus recovery\n"); - return adap->bus_recovery_info->recover_bus(adap); - } -+EXPORT_SYMBOL_GPL(i2c_recover_bus); - - static int i2c_device_probe(struct device *dev) - { -diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c -index 055ebebc07dd..c1fef27010d4 100644 ---- a/drivers/infiniband/core/umem.c -+++ b/drivers/infiniband/core/umem.c -@@ -94,12 +94,15 @@ struct ib_umem *ib_umem_get(struct ib_ucontext *context, unsigned long addr, - if (dmasync) - dma_set_attr(DMA_ATTR_WRITE_BARRIER, &attrs); - -+ if (!size) -+ return ERR_PTR(-EINVAL); -+ - /* - * If the combination of the addr and size requested for this memory - * region causes an integer overflow, return error. - */ -- if ((PAGE_ALIGN(addr + size) <= size) || -- (PAGE_ALIGN(addr + size) <= addr)) -+ if (((addr + size) < addr) || -+ PAGE_ALIGN(addr + size) < (addr + size)) - return ERR_PTR(-EINVAL); - - if (!can_do_mlock()) -diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c -index 4f10af2905b5..262a18437ceb 100644 ---- a/drivers/infiniband/hw/mlx4/qp.c -+++ b/drivers/infiniband/hw/mlx4/qp.c -@@ -2174,8 +2174,7 @@ static int build_lso_seg(struct mlx4_wqe_lso_seg *wqe, struct ib_send_wr *wr, - - memcpy(wqe->header, wr->wr.ud.header, wr->wr.ud.hlen); - -- *lso_hdr_sz = cpu_to_be32((wr->wr.ud.mss - wr->wr.ud.hlen) << 16 | -- wr->wr.ud.hlen); -+ *lso_hdr_sz = cpu_to_be32(wr->wr.ud.mss << 16 | wr->wr.ud.hlen); - *lso_seg_len = halign; - return 0; - } -diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c -index 85e75239c814..1af7df263368 100644 ---- a/drivers/input/mouse/elantech.c -+++ b/drivers/input/mouse/elantech.c -@@ -784,6 +784,21 @@ static psmouse_ret_t elantech_process_byte(struct psmouse *psmouse) - } - - /* -+ * This writes the reg_07 value again to the hardware at the end of every -+ * set_rate call because the register loses its value. reg_07 allows setting -+ * absolute mode on v4 hardware -+ */ -+static void elantech_set_rate_restore_reg_07(struct psmouse *psmouse, -+ unsigned int rate) -+{ -+ struct elantech_data *etd = psmouse->private; -+ -+ etd->original_set_rate(psmouse, rate); -+ if (elantech_write_reg(psmouse, 0x07, etd->reg_07)) -+ psmouse_err(psmouse, "restoring reg_07 failed\n"); -+} -+ -+/* - * Put the touchpad into absolute mode - */ - static int elantech_set_absolute_mode(struct psmouse *psmouse) -@@ -985,6 +1000,8 @@ static int elantech_get_resolution_v4(struct psmouse *psmouse, - * Asus K53SV 0x450f01 78, 15, 0c 2 hw buttons - * Asus G46VW 0x460f02 00, 18, 0c 2 hw buttons - * Asus G750JX 0x360f00 00, 16, 0c 2 hw buttons -+ * Asus TP500LN 0x381f17 10, 14, 0e clickpad -+ * Asus X750JN 0x381f17 10, 14, 0e clickpad - * Asus UX31 0x361f00 20, 15, 0e clickpad - * Asus UX32VD 0x361f02 00, 15, 0e clickpad - * Avatar AVIU-145A2 0x361f00 ? clickpad -@@ -1452,6 +1469,11 @@ int elantech_init(struct psmouse *psmouse) - goto init_fail; - } - -+ if (etd->fw_version == 0x381f17) { -+ etd->original_set_rate = psmouse->set_rate; -+ psmouse->set_rate = elantech_set_rate_restore_reg_07; -+ } -+ - if (elantech_set_input_params(psmouse)) { - psmouse_err(psmouse, "failed to query touchpad range.\n"); - goto init_fail; -diff --git a/drivers/input/mouse/elantech.h b/drivers/input/mouse/elantech.h -index c1c15ab6872d..13a12ccbff51 100644 ---- a/drivers/input/mouse/elantech.h -+++ b/drivers/input/mouse/elantech.h -@@ -138,6 +138,7 @@ struct elantech_data { - struct finger_pos mt[ETP_MAX_FINGERS]; - unsigned char parity[256]; - int (*send_cmd)(struct psmouse *psmouse, unsigned char c, unsigned char *param); -+ void (*original_set_rate)(struct psmouse *psmouse, unsigned int rate); - }; - - #ifdef CONFIG_MOUSE_PS2_ELANTECH -diff --git a/drivers/media/usb/stk1160/stk1160-v4l.c b/drivers/media/usb/stk1160/stk1160-v4l.c -index a59153d2f8bf..518a5299ff0b 100644 ---- a/drivers/media/usb/stk1160/stk1160-v4l.c -+++ b/drivers/media/usb/stk1160/stk1160-v4l.c -@@ -245,6 +245,11 @@ static int stk1160_stop_streaming(struct stk1160 *dev) - if (mutex_lock_interruptible(&dev->v4l_lock)) - return -ERESTARTSYS; - -+ /* -+ * Once URBs are cancelled, the URB complete handler -+ * won't be running. This is required to safely release the -+ * current buffer (dev->isoc_ctl.buf). -+ */ - stk1160_cancel_isoc(dev); - - /* -@@ -665,8 +670,16 @@ void stk1160_clear_queue(struct stk1160 *dev) - stk1160_info("buffer [%p/%d] aborted\n", - buf, buf->vb.v4l2_buf.index); - } -- /* It's important to clear current buffer */ -- dev->isoc_ctl.buf = NULL; -+ -+ /* It's important to release the current buffer */ -+ if (dev->isoc_ctl.buf) { -+ buf = dev->isoc_ctl.buf; -+ dev->isoc_ctl.buf = NULL; -+ -+ vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR); -+ stk1160_info("buffer [%p/%d] aborted\n", -+ buf, buf->vb.v4l2_buf.index); -+ } - spin_unlock_irqrestore(&dev->buf_lock, flags); - } - -diff --git a/drivers/memstick/core/mspro_block.c b/drivers/memstick/core/mspro_block.c -index f4176ca3a794..cdd61ab5c2b5 100644 ---- a/drivers/memstick/core/mspro_block.c -+++ b/drivers/memstick/core/mspro_block.c -@@ -758,7 +758,7 @@ static int mspro_block_complete_req(struct memstick_dev *card, int error) - - if (error || (card->current_mrq.tpc == MSPRO_CMD_STOP)) { - if (msb->data_dir == READ) { -- for (cnt = 0; cnt < msb->current_seg; cnt++) -+ for (cnt = 0; cnt < msb->current_seg; cnt++) { - t_len += msb->req_sg[cnt].length - / msb->page_size; - -@@ -766,6 +766,7 @@ static int mspro_block_complete_req(struct memstick_dev *card, int error) - t_len += msb->current_page - 1; - - t_len *= msb->page_size; -+ } - } - } else - t_len = blk_rq_bytes(msb->block_req); -diff --git a/drivers/mtd/ubi/attach.c b/drivers/mtd/ubi/attach.c -index c071d410488f..79d69bd26dd2 100644 ---- a/drivers/mtd/ubi/attach.c -+++ b/drivers/mtd/ubi/attach.c -@@ -408,7 +408,7 @@ int ubi_compare_lebs(struct ubi_device *ubi, const struct ubi_ainf_peb *aeb, - second_is_newer = !second_is_newer; - } else { - dbg_bld("PEB %d CRC is OK", pnum); -- bitflips = !!err; -+ bitflips |= !!err; - } - mutex_unlock(&ubi->buf_mutex); - -diff --git a/drivers/mtd/ubi/cdev.c b/drivers/mtd/ubi/cdev.c -index 4f02848bb2bc..fc764e7976bd 100644 ---- a/drivers/mtd/ubi/cdev.c -+++ b/drivers/mtd/ubi/cdev.c -@@ -475,7 +475,7 @@ static long vol_cdev_ioctl(struct file *file, unsigned int cmd, - /* Validate the request */ - err = -EINVAL; - if (req.lnum < 0 || req.lnum >= vol->reserved_pebs || -- req.bytes < 0 || req.lnum >= vol->usable_leb_size) -+ req.bytes < 0 || req.bytes > vol->usable_leb_size) - break; - - err = get_exclusive(desc); -diff --git a/drivers/mtd/ubi/eba.c b/drivers/mtd/ubi/eba.c -index 0e11671dadc4..930cf2c77abb 100644 ---- a/drivers/mtd/ubi/eba.c -+++ b/drivers/mtd/ubi/eba.c -@@ -1362,7 +1362,8 @@ int ubi_eba_init(struct ubi_device *ubi, struct ubi_attach_info *ai) - * during re-size. - */ - ubi_move_aeb_to_list(av, aeb, &ai->erase); -- vol->eba_tbl[aeb->lnum] = aeb->pnum; -+ else -+ vol->eba_tbl[aeb->lnum] = aeb->pnum; - } - } - -diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c -index 49e570abe58b..c08254016fe8 100644 ---- a/drivers/mtd/ubi/wl.c -+++ b/drivers/mtd/ubi/wl.c -@@ -999,7 +999,7 @@ static int wear_leveling_worker(struct ubi_device *ubi, struct ubi_work *wrk, - int cancel) - { - int err, scrubbing = 0, torture = 0, protect = 0, erroneous = 0; -- int vol_id = -1, uninitialized_var(lnum); -+ int vol_id = -1, lnum = -1; - #ifdef CONFIG_MTD_UBI_FASTMAP - int anchor = wrk->anchor; - #endif -diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c b/drivers/net/ethernet/intel/e1000/e1000_main.c -index 59ad007dd5aa..a978fc82ceb5 100644 ---- a/drivers/net/ethernet/intel/e1000/e1000_main.c -+++ b/drivers/net/ethernet/intel/e1000/e1000_main.c -@@ -144,6 +144,11 @@ static bool e1000_clean_rx_irq(struct e1000_adapter *adapter, - static bool e1000_clean_jumbo_rx_irq(struct e1000_adapter *adapter, - struct e1000_rx_ring *rx_ring, - int *work_done, int work_to_do); -+static void e1000_alloc_dummy_rx_buffers(struct e1000_adapter *adapter, -+ struct e1000_rx_ring *rx_ring, -+ int cleaned_count) -+{ -+} - static void e1000_alloc_rx_buffers(struct e1000_adapter *adapter, - struct e1000_rx_ring *rx_ring, - int cleaned_count); -@@ -3555,8 +3560,11 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu) - msleep(1); - /* e1000_down has a dependency on max_frame_size */ - hw->max_frame_size = max_frame; -- if (netif_running(netdev)) -+ if (netif_running(netdev)) { -+ /* prevent buffers from being reallocated */ -+ adapter->alloc_rx_buf = e1000_alloc_dummy_rx_buffers; - e1000_down(adapter); -+ } - - /* NOTE: netdev_alloc_skb reserves 16 bytes, and typically NET_IP_ALIGN - * means we reserve 2 more, this pushes us to allocate from the next -diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c -index e7a2af3ad05a..7555095e0b74 100644 ---- a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c -+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c -@@ -313,6 +313,7 @@ static struct usb_device_id rtl8192c_usb_ids[] = { - {RTL_USB_DEVICE(0x07b8, 0x8188, rtl92cu_hal_cfg)}, /*Abocom - Abocom*/ - {RTL_USB_DEVICE(0x07b8, 0x8189, rtl92cu_hal_cfg)}, /*Funai - Abocom*/ - {RTL_USB_DEVICE(0x0846, 0x9041, rtl92cu_hal_cfg)}, /*NetGear WNA1000M*/ -+ {RTL_USB_DEVICE(0x0b05, 0x17ba, rtl92cu_hal_cfg)}, /*ASUS-Edimax*/ - {RTL_USB_DEVICE(0x0bda, 0x5088, rtl92cu_hal_cfg)}, /*Thinkware-CC&C*/ - {RTL_USB_DEVICE(0x0df6, 0x0052, rtl92cu_hal_cfg)}, /*Sitecom - Edimax*/ - {RTL_USB_DEVICE(0x0df6, 0x005c, rtl92cu_hal_cfg)}, /*Sitecom - Edimax*/ -@@ -369,6 +370,7 @@ static struct usb_device_id rtl8192c_usb_ids[] = { - {RTL_USB_DEVICE(0x2001, 0x3307, rtl92cu_hal_cfg)}, /*D-Link-Cameo*/ - {RTL_USB_DEVICE(0x2001, 0x3309, rtl92cu_hal_cfg)}, /*D-Link-Alpha*/ - {RTL_USB_DEVICE(0x2001, 0x330a, rtl92cu_hal_cfg)}, /*D-Link-Alpha*/ -+ {RTL_USB_DEVICE(0x2001, 0x330d, rtl92cu_hal_cfg)}, /*D-Link DWA-131 */ - {RTL_USB_DEVICE(0x2019, 0xab2b, rtl92cu_hal_cfg)}, /*Planex -Abocom*/ - {RTL_USB_DEVICE(0x20f4, 0x624d, rtl92cu_hal_cfg)}, /*TRENDNet*/ - {RTL_USB_DEVICE(0x2357, 0x0100, rtl92cu_hal_cfg)}, /*TP-Link WN8200ND*/ -diff --git a/drivers/net/wireless/ti/wl18xx/debugfs.c b/drivers/net/wireless/ti/wl18xx/debugfs.c -index 7f1669cdea09..779dc2b2ca75 100644 ---- a/drivers/net/wireless/ti/wl18xx/debugfs.c -+++ b/drivers/net/wireless/ti/wl18xx/debugfs.c -@@ -136,7 +136,7 @@ WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, protection_filter, "%u"); - WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, accum_arp_pend_requests, "%u"); - WL18XX_DEBUGFS_FWSTATS_FILE(rx_filter, max_arp_queue_dep, "%u"); - --WL18XX_DEBUGFS_FWSTATS_FILE(rx_rate, rx_frames_per_rates, "%u"); -+WL18XX_DEBUGFS_FWSTATS_FILE_ARRAY(rx_rate, rx_frames_per_rates, 50); - - WL18XX_DEBUGFS_FWSTATS_FILE_ARRAY(aggr_size, tx_agg_vs_rate, - AGGR_STATS_TX_AGG*AGGR_STATS_TX_RATE); -diff --git a/drivers/net/wireless/ti/wlcore/debugfs.h b/drivers/net/wireless/ti/wlcore/debugfs.h -index f7381dd69009..1bce4325e86b 100644 ---- a/drivers/net/wireless/ti/wlcore/debugfs.h -+++ b/drivers/net/wireless/ti/wlcore/debugfs.h -@@ -26,8 +26,8 @@ - - #include "wlcore.h" - --int wl1271_format_buffer(char __user *userbuf, size_t count, -- loff_t *ppos, char *fmt, ...); -+__printf(4, 5) int wl1271_format_buffer(char __user *userbuf, size_t count, -+ loff_t *ppos, char *fmt, ...); - - int wl1271_debugfs_init(struct wl1271 *wl); - void wl1271_debugfs_exit(struct wl1271 *wl); -diff --git a/drivers/parport/Kconfig b/drivers/parport/Kconfig -index a50576081b34..46d2de24bf3e 100644 ---- a/drivers/parport/Kconfig -+++ b/drivers/parport/Kconfig -@@ -36,7 +36,9 @@ if PARPORT - config PARPORT_PC - tristate "PC-style hardware" - depends on (!SPARC64 || PCI) && !SPARC32 && !M32R && !FRV && !S390 && \ -- (!M68K || ISA) && !MN10300 && !AVR32 && !BLACKFIN && !XTENSA -+ (!M68K || ISA) && !MN10300 && !AVR32 && !BLACKFIN && \ -+ !XTENSA && !CRIS && !H8300 && !ARM64 -+ - ---help--- - You should say Y here if you have a PC-style parallel port. All - IBM PC compatible computers and some Alphas have PC-style -diff --git a/drivers/power/lp8788-charger.c b/drivers/power/lp8788-charger.c -index ed49b50b220b..72da2a6c22db 100644 ---- a/drivers/power/lp8788-charger.c -+++ b/drivers/power/lp8788-charger.c -@@ -417,8 +417,10 @@ static int lp8788_psy_register(struct platform_device *pdev, - pchg->battery.num_properties = ARRAY_SIZE(lp8788_battery_prop); - pchg->battery.get_property = lp8788_battery_get_property; - -- if (power_supply_register(&pdev->dev, &pchg->battery)) -+ if (power_supply_register(&pdev->dev, &pchg->battery)) { -+ power_supply_unregister(&pchg->charger); - return -EPERM; -+ } - - return 0; - } -diff --git a/drivers/scsi/mvsas/mv_sas.c b/drivers/scsi/mvsas/mv_sas.c -index c9e244984e30..fa50c7dc3d3e 100644 ---- a/drivers/scsi/mvsas/mv_sas.c -+++ b/drivers/scsi/mvsas/mv_sas.c -@@ -441,14 +441,11 @@ static u32 mvs_get_ncq_tag(struct sas_task *task, u32 *tag) - static int mvs_task_prep_ata(struct mvs_info *mvi, - struct mvs_task_exec_info *tei) - { -- struct sas_ha_struct *sha = mvi->sas; - struct sas_task *task = tei->task; - struct domain_device *dev = task->dev; - struct mvs_device *mvi_dev = dev->lldd_dev; - struct mvs_cmd_hdr *hdr = tei->hdr; - struct asd_sas_port *sas_port = dev->port; -- struct sas_phy *sphy = dev->phy; -- struct asd_sas_phy *sas_phy = sha->sas_phy[sphy->number]; - struct mvs_slot_info *slot; - void *buf_prd; - u32 tag = tei->tag, hdr_tag; -@@ -468,7 +465,7 @@ static int mvs_task_prep_ata(struct mvs_info *mvi, - slot->tx = mvi->tx_prod; - del_q = TXQ_MODE_I | tag | - (TXQ_CMD_STP << TXQ_CMD_SHIFT) | -- (MVS_PHY_ID << TXQ_PHY_SHIFT) | -+ ((sas_port->phy_mask & TXQ_PHY_MASK) << TXQ_PHY_SHIFT) | - (mvi_dev->taskfileset << TXQ_SRS_SHIFT); - mvi->tx[mvi->tx_prod] = cpu_to_le32(del_q); - -diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c -index a8990783ba66..913b91c78a22 100644 ---- a/drivers/scsi/storvsc_drv.c -+++ b/drivers/scsi/storvsc_drv.c -@@ -631,21 +631,22 @@ static unsigned int copy_to_bounce_buffer(struct scatterlist *orig_sgl, - if (bounce_sgl[j].length == PAGE_SIZE) { - /* full..move to next entry */ - sg_kunmap_atomic(bounce_addr); -+ bounce_addr = 0; - j++; -+ } - -- /* if we need to use another bounce buffer */ -- if (srclen || i != orig_sgl_count - 1) -- bounce_addr = sg_kmap_atomic(bounce_sgl,j); -+ /* if we need to use another bounce buffer */ -+ if (srclen && bounce_addr == 0) -+ bounce_addr = sg_kmap_atomic(bounce_sgl, j); - -- } else if (srclen == 0 && i == orig_sgl_count - 1) { -- /* unmap the last bounce that is < PAGE_SIZE */ -- sg_kunmap_atomic(bounce_addr); -- } - } - - sg_kunmap_atomic(src_addr - orig_sgl[i].offset); - } - -+ if (bounce_addr) -+ sg_kunmap_atomic(bounce_addr); -+ - local_irq_restore(flags); - - return total_copied; -diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c -index 911e9e0711d2..a08f923b9925 100644 ---- a/drivers/spi/spidev.c -+++ b/drivers/spi/spidev.c -@@ -243,7 +243,10 @@ static int spidev_message(struct spidev_data *spidev, - k_tmp->len = u_tmp->len; - - total += k_tmp->len; -- if (total > bufsiz) { -+ /* Check total length of transfers. Also check each -+ * transfer length to avoid arithmetic overflow. -+ */ -+ if (total > bufsiz || k_tmp->len > bufsiz) { - status = -EMSGSIZE; - goto done; - } -diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c -index 6463ca3bcfba..07133d0c971b 100644 ---- a/drivers/usb/class/cdc-wdm.c -+++ b/drivers/usb/class/cdc-wdm.c -@@ -244,7 +244,7 @@ static void wdm_int_callback(struct urb *urb) - case USB_CDC_NOTIFY_RESPONSE_AVAILABLE: - dev_dbg(&desc->intf->dev, - "NOTIFY_RESPONSE_AVAILABLE received: index %d len %d", -- dr->wIndex, dr->wLength); -+ le16_to_cpu(dr->wIndex), le16_to_cpu(dr->wLength)); - break; - - case USB_CDC_NOTIFY_NETWORK_CONNECTION: -@@ -257,7 +257,9 @@ static void wdm_int_callback(struct urb *urb) - clear_bit(WDM_POLL_RUNNING, &desc->flags); - dev_err(&desc->intf->dev, - "unknown notification %d received: index %d len %d\n", -- dr->bNotificationType, dr->wIndex, dr->wLength); -+ dr->bNotificationType, -+ le16_to_cpu(dr->wIndex), -+ le16_to_cpu(dr->wLength)); - goto exit; - } - -@@ -403,7 +405,7 @@ static ssize_t wdm_write - USB_RECIP_INTERFACE); - req->bRequest = USB_CDC_SEND_ENCAPSULATED_COMMAND; - req->wValue = 0; -- req->wIndex = desc->inum; -+ req->wIndex = desc->inum; /* already converted */ - req->wLength = cpu_to_le16(count); - set_bit(WDM_IN_USE, &desc->flags); - desc->outbuf = buf; -@@ -417,7 +419,7 @@ static ssize_t wdm_write - rv = usb_translate_errors(rv); - } else { - dev_dbg(&desc->intf->dev, "Tx URB has been submitted index=%d", -- req->wIndex); -+ le16_to_cpu(req->wIndex)); - } - out: - usb_autopm_put_interface(desc->intf); -@@ -780,7 +782,7 @@ static int wdm_create(struct usb_interface *intf, struct usb_endpoint_descriptor - desc->irq->bRequestType = (USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE); - desc->irq->bRequest = USB_CDC_GET_ENCAPSULATED_RESPONSE; - desc->irq->wValue = 0; -- desc->irq->wIndex = desc->inum; -+ desc->irq->wIndex = desc->inum; /* already converted */ - desc->irq->wLength = cpu_to_le16(desc->wMaxCommand); - - usb_fill_control_urb( -diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c -index c9f56ffdba9a..11a073cda1d6 100644 ---- a/drivers/usb/core/hub.c -+++ b/drivers/usb/core/hub.c -@@ -3282,10 +3282,10 @@ int usb_port_resume(struct usb_device *udev, pm_message_t msg) - dev_dbg(hub->intfdev, "can't resume port %d, status %d\n", - port1, status); - } else { -- /* drive resume for at least 20 msec */ -+ /* drive resume for USB_RESUME_TIMEOUT msec */ - dev_dbg(&udev->dev, "usb %sresume\n", - (PMSG_IS_AUTO(msg) ? "auto-" : "")); -- msleep(25); -+ msleep(USB_RESUME_TIMEOUT); - - /* Virtual root hubs can trigger on GET_PORT_STATUS to - * stop resume signaling. Then finish the resume -diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c -index 44a292b75012..a660716f9331 100644 ---- a/drivers/usb/gadget/composite.c -+++ b/drivers/usb/gadget/composite.c -@@ -528,7 +528,7 @@ static int bos_desc(struct usb_composite_dev *cdev) - usb_ext->bLength = USB_DT_USB_EXT_CAP_SIZE; - usb_ext->bDescriptorType = USB_DT_DEVICE_CAPABILITY; - usb_ext->bDevCapabilityType = USB_CAP_TYPE_EXT; -- usb_ext->bmAttributes = cpu_to_le32(USB_LPM_SUPPORT); -+ usb_ext->bmAttributes = cpu_to_le32(USB_LPM_SUPPORT | USB_BESL_SUPPORT); - - /* - * The Superspeed USB Capability descriptor shall be implemented by all -diff --git a/drivers/usb/host/isp116x-hcd.c b/drivers/usb/host/isp116x-hcd.c -index b64e661618bb..baf2807934c1 100644 ---- a/drivers/usb/host/isp116x-hcd.c -+++ b/drivers/usb/host/isp116x-hcd.c -@@ -1488,7 +1488,7 @@ static int isp116x_bus_resume(struct usb_hcd *hcd) - spin_unlock_irq(&isp116x->lock); - - hcd->state = HC_STATE_RESUMING; -- msleep(20); -+ msleep(USB_RESUME_TIMEOUT); - - /* Go operational */ - spin_lock_irq(&isp116x->lock); -diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c -index a6fd8f5371df..6656dfda5665 100644 ---- a/drivers/usb/host/r8a66597-hcd.c -+++ b/drivers/usb/host/r8a66597-hcd.c -@@ -2301,7 +2301,7 @@ static int r8a66597_bus_resume(struct usb_hcd *hcd) - rh->port &= ~USB_PORT_STAT_SUSPEND; - rh->port |= USB_PORT_STAT_C_SUSPEND << 16; - r8a66597_mdfy(r8a66597, RESUME, RESUME | UACT, dvstctr_reg); -- msleep(50); -+ msleep(USB_RESUME_TIMEOUT); - r8a66597_mdfy(r8a66597, UACT, RESUME | UACT, dvstctr_reg); - } - -diff --git a/drivers/usb/host/sl811-hcd.c b/drivers/usb/host/sl811-hcd.c -index b2ec7fe758dd..b4cad9346035 100644 ---- a/drivers/usb/host/sl811-hcd.c -+++ b/drivers/usb/host/sl811-hcd.c -@@ -1251,7 +1251,7 @@ sl811h_hub_control( - sl811_write(sl811, SL11H_CTLREG1, sl811->ctrl1); - - mod_timer(&sl811->timer, jiffies -- + msecs_to_jiffies(20)); -+ + msecs_to_jiffies(USB_RESUME_TIMEOUT)); - break; - case USB_PORT_FEAT_POWER: - port_power(sl811, 0); -diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c -index 9948890ef93e..bc7a886e3c36 100644 ---- a/drivers/usb/host/xhci-ring.c -+++ b/drivers/usb/host/xhci-ring.c -@@ -1697,7 +1697,7 @@ static void handle_port_status(struct xhci_hcd *xhci, - } else { - xhci_dbg(xhci, "resume HS port %d\n", port_id); - bus_state->resume_done[faked_port_index] = jiffies + -- msecs_to_jiffies(20); -+ msecs_to_jiffies(USB_RESUME_TIMEOUT); - set_bit(faked_port_index, &bus_state->resuming_ports); - mod_timer(&hcd->rh_timer, - bus_state->resume_done[faked_port_index]); -diff --git a/drivers/usb/phy/phy.c b/drivers/usb/phy/phy.c -index a9984c700d2c..5f79d8e2caab 100644 ---- a/drivers/usb/phy/phy.c -+++ b/drivers/usb/phy/phy.c -@@ -78,7 +78,9 @@ static void devm_usb_phy_release(struct device *dev, void *res) - - static int devm_usb_phy_match(struct device *dev, void *res, void *match_data) - { -- return res == match_data; -+ struct usb_phy **phy = res; -+ -+ return *phy == match_data; - } - - /** -diff --git a/drivers/video/console/Kconfig b/drivers/video/console/Kconfig -index bc922c47d046..37e62c7b3273 100644 ---- a/drivers/video/console/Kconfig -+++ b/drivers/video/console/Kconfig -@@ -6,7 +6,10 @@ menu "Console display driver support" - - config VGA_CONSOLE - bool "VGA text console" if EXPERT || !X86 -- depends on !4xx && !8xx && !SPARC && !M68K && !PARISC && !FRV && !SUPERH && !BLACKFIN && !AVR32 && !MN10300 && (!ARM || ARCH_FOOTBRIDGE || ARCH_INTEGRATOR || ARCH_NETWINDER) -+ depends on !4xx && !8xx && !SPARC && !M68K && !PARISC && !FRV && \ -+ !SUPERH && !BLACKFIN && !AVR32 && !MN10300 && !CRIS && \ -+ (!ARM || ARCH_FOOTBRIDGE || ARCH_INTEGRATOR || ARCH_NETWINDER) && \ -+ !ARM64 - default y - help - Saying Y here will allow you to use Linux in text mode through a -diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c -index 3c4d8797ea9a..53f620a4350e 100644 ---- a/fs/binfmt_elf.c -+++ b/fs/binfmt_elf.c -@@ -756,6 +756,7 @@ static int load_elf_binary(struct linux_binprm *bprm) - i < loc->elf_ex.e_phnum; i++, elf_ppnt++) { - int elf_prot = 0, elf_flags; - unsigned long k, vaddr; -+ unsigned long total_size = 0; - - if (elf_ppnt->p_type != PT_LOAD) - continue; -@@ -820,10 +821,16 @@ static int load_elf_binary(struct linux_binprm *bprm) - #else - load_bias = ELF_PAGESTART(ELF_ET_DYN_BASE - vaddr); - #endif -+ total_size = total_mapping_size(elf_phdata, -+ loc->elf_ex.e_phnum); -+ if (!total_size) { -+ error = -EINVAL; -+ goto out_free_dentry; -+ } - } - - error = elf_map(bprm->file, load_bias + vaddr, elf_ppnt, -- elf_prot, elf_flags, 0); -+ elf_prot, elf_flags, total_size); - if (BAD_ADDR(error)) { - send_sig(SIGKILL, current, 0); - retval = IS_ERR((void *)error) ? -diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c -index f99c71e40f8b..07f167a1d271 100644 ---- a/fs/btrfs/extent-tree.c -+++ b/fs/btrfs/extent-tree.c -@@ -6363,12 +6363,11 @@ static int __btrfs_free_reserved_extent(struct btrfs_root *root, - return -ENOSPC; - } - -- if (btrfs_test_opt(root, DISCARD)) -- ret = btrfs_discard_extent(root, start, len, NULL); -- - if (pin) - pin_down_extent(root, cache, start, len, 1); - else { -+ if (btrfs_test_opt(root, DISCARD)) -+ ret = btrfs_discard_extent(root, start, len, NULL); - btrfs_add_free_space(cache, start, len); - btrfs_update_reserved_bytes(cache, len, RESERVE_FREE); - } -diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c -index 783906c687b5..dbefa6c609f4 100644 ---- a/fs/btrfs/ioctl.c -+++ b/fs/btrfs/ioctl.c -@@ -2572,6 +2572,11 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd, - if (off + len == src->i_size) - len = ALIGN(src->i_size, bs) - off; - -+ if (len == 0) { -+ ret = 0; -+ goto out_unlock; -+ } -+ - /* verify the end result is block aligned */ - if (!IS_ALIGNED(off, bs) || !IS_ALIGNED(off + len, bs) || - !IS_ALIGNED(destoff, bs)) -diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c -index f1312173fa90..facf8590b714 100644 ---- a/fs/ext4/namei.c -+++ b/fs/ext4/namei.c -@@ -1880,7 +1880,7 @@ static int ext4_add_entry(handle_t *handle, struct dentry *dentry, - struct inode *inode) - { - struct inode *dir = dentry->d_parent->d_inode; -- struct buffer_head *bh; -+ struct buffer_head *bh = NULL; - struct ext4_dir_entry_2 *de; - struct ext4_dir_entry_tail *t; - struct super_block *sb; -@@ -1905,14 +1905,14 @@ static int ext4_add_entry(handle_t *handle, struct dentry *dentry, - return retval; - if (retval == 1) { - retval = 0; -- return retval; -+ goto out; - } - } - - if (is_dx(dir)) { - retval = ext4_dx_add_entry(handle, dentry, inode); - if (!retval || (retval != ERR_BAD_DX_DIR)) -- return retval; -+ goto out; - ext4_clear_inode_flag(dir, EXT4_INODE_INDEX); - dx_fallback++; - ext4_mark_inode_dirty(handle, dir); -@@ -1924,14 +1924,15 @@ static int ext4_add_entry(handle_t *handle, struct dentry *dentry, - return PTR_ERR(bh); - - retval = add_dirent_to_buf(handle, dentry, inode, NULL, bh); -- if (retval != -ENOSPC) { -- brelse(bh); -- return retval; -- } -+ if (retval != -ENOSPC) -+ goto out; - - if (blocks == 1 && !dx_fallback && -- EXT4_HAS_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_DIR_INDEX)) -- return make_indexed_dir(handle, dentry, inode, bh); -+ EXT4_HAS_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_DIR_INDEX)) { -+ retval = make_indexed_dir(handle, dentry, inode, bh); -+ bh = NULL; /* make_indexed_dir releases bh */ -+ goto out; -+ } - brelse(bh); - } - bh = ext4_append(handle, dir, &block); -@@ -1947,6 +1948,7 @@ static int ext4_add_entry(handle_t *handle, struct dentry *dentry, - } - - retval = add_dirent_to_buf(handle, dentry, inode, de, bh); -+out: - brelse(bh); - if (retval == 0) - ext4_set_inode_state(inode, EXT4_STATE_NEWENTRY); -diff --git a/fs/namei.c b/fs/namei.c -index f7c4393f8535..036c21246d6a 100644 ---- a/fs/namei.c -+++ b/fs/namei.c -@@ -1542,7 +1542,8 @@ static inline int walk_component(struct nameidata *nd, struct path *path, - - if (should_follow_link(inode, follow)) { - if (nd->flags & LOOKUP_RCU) { -- if (unlikely(unlazy_walk(nd, path->dentry))) { -+ if (unlikely(nd->path.mnt != path->mnt || -+ unlazy_walk(nd, path->dentry))) { - err = -ECHILD; - goto out_err; - } -@@ -2824,7 +2825,8 @@ finish_lookup: - - if (should_follow_link(inode, !symlink_ok)) { - if (nd->flags & LOOKUP_RCU) { -- if (unlikely(unlazy_walk(nd, path->dentry))) { -+ if (unlikely(nd->path.mnt != path->mnt || -+ unlazy_walk(nd, path->dentry))) { - error = -ECHILD; - goto out; - } -diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h -index a64adcc29ae5..f819e813c8ac 100644 ---- a/include/acpi/actypes.h -+++ b/include/acpi/actypes.h -@@ -198,9 +198,29 @@ typedef int INT32; - typedef s32 acpi_native_int; - - typedef u32 acpi_size; -+ -+#ifdef ACPI_32BIT_PHYSICAL_ADDRESS -+ -+/* -+ * OSPMs can define this to shrink the size of the structures for 32-bit -+ * none PAE environment. ASL compiler may always define this to generate -+ * 32-bit OSPM compliant tables. -+ */ - typedef u32 acpi_io_address; - typedef u32 acpi_physical_address; - -+#else /* ACPI_32BIT_PHYSICAL_ADDRESS */ -+ -+/* -+ * It is reported that, after some calculations, the physical addresses can -+ * wrap over the 32-bit boundary on 32-bit PAE environment. -+ * https://bugzilla.kernel.org/show_bug.cgi?id=87971 -+ */ -+typedef u64 acpi_io_address; -+typedef u64 acpi_physical_address; -+ -+#endif /* ACPI_32BIT_PHYSICAL_ADDRESS */ -+ - #define ACPI_MAX_PTR ACPI_UINT32_MAX - #define ACPI_SIZE_MAX ACPI_UINT32_MAX - -diff --git a/include/acpi/platform/acenv.h b/include/acpi/platform/acenv.h -index ef04b36ca6ed..f7db107abb04 100644 ---- a/include/acpi/platform/acenv.h -+++ b/include/acpi/platform/acenv.h -@@ -76,6 +76,7 @@ - #define ACPI_LARGE_NAMESPACE_NODE - #define ACPI_DATA_TABLE_DISASSEMBLY - #define ACPI_SINGLE_THREADED -+#define ACPI_32BIT_PHYSICAL_ADDRESS - #endif - - /* acpi_exec configuration. Multithreaded with full AML debugger */ -diff --git a/include/asm-generic/sections.h b/include/asm-generic/sections.h -index c1a1216e29ce..87b27263f5e2 100644 ---- a/include/asm-generic/sections.h -+++ b/include/asm-generic/sections.h -@@ -3,6 +3,8 @@ - - /* References to section boundaries */ - -+#include -+ - extern char _text[], _stext[], _etext[]; - extern char _data[], _sdata[], _edata[]; - extern char __bss_start[], __bss_stop[]; -@@ -18,6 +20,8 @@ extern char __start_rodata[], __end_rodata[]; - /* Start and end of .ctors section - used for constructor calls. */ - extern char __ctors_start[], __ctors_end[]; - -+extern __visible const void __nosave_begin, __nosave_end; -+ - /* function descriptor handling (if any). Override - * in asm/sections.h */ - #ifndef dereference_function_descriptor -diff --git a/include/linux/usb.h b/include/linux/usb.h -index a0bee5a28d1a..28bd3a898cba 100644 ---- a/include/linux/usb.h -+++ b/include/linux/usb.h -@@ -206,6 +206,32 @@ void usb_put_intf(struct usb_interface *intf); - #define USB_MAXINTERFACES 32 - #define USB_MAXIADS (USB_MAXINTERFACES/2) - -+/* -+ * USB Resume Timer: Every Host controller driver should drive the resume -+ * signalling on the bus for the amount of time defined by this macro. -+ * -+ * That way we will have a 'stable' behavior among all HCDs supported by Linux. -+ * -+ * Note that the USB Specification states we should drive resume for *at least* -+ * 20 ms, but it doesn't give an upper bound. This creates two possible -+ * situations which we want to avoid: -+ * -+ * (a) sometimes an msleep(20) might expire slightly before 20 ms, which causes -+ * us to fail USB Electrical Tests, thus failing Certification -+ * -+ * (b) Some (many) devices actually need more than 20 ms of resume signalling, -+ * and while we can argue that's against the USB Specification, we don't have -+ * control over which devices a certification laboratory will be using for -+ * certification. If CertLab uses a device which was tested against Windows and -+ * that happens to have relaxed resume signalling rules, we might fall into -+ * situations where we fail interoperability and electrical tests. -+ * -+ * In order to avoid both conditions, we're using a 40 ms resume timeout, which -+ * should cope with both LPJ calibration errors and devices not following every -+ * detail of the USB Specification. -+ */ -+#define USB_RESUME_TIMEOUT 40 /* ms */ -+ - /** - * struct usb_interface_cache - long-term representation of a device interface - * @num_altsetting: number of altsettings defined. -diff --git a/kernel/ptrace.c b/kernel/ptrace.c -index afadcf7b4a22..118323bc8529 100644 ---- a/kernel/ptrace.c -+++ b/kernel/ptrace.c -@@ -720,6 +720,8 @@ static int ptrace_peek_siginfo(struct task_struct *child, - static int ptrace_resume(struct task_struct *child, long request, - unsigned long data) - { -+ bool need_siglock; -+ - if (!valid_signal(data)) - return -EIO; - -@@ -747,8 +749,26 @@ static int ptrace_resume(struct task_struct *child, long request, - user_disable_single_step(child); - } - -+ /* -+ * Change ->exit_code and ->state under siglock to avoid the race -+ * with wait_task_stopped() in between; a non-zero ->exit_code will -+ * wrongly look like another report from tracee. -+ * -+ * Note that we need siglock even if ->exit_code == data and/or this -+ * status was not reported yet, the new status must not be cleared by -+ * wait_task_stopped() after resume. -+ * -+ * If data == 0 we do not care if wait_task_stopped() reports the old -+ * status and clears the code too; this can't race with the tracee, it -+ * takes siglock after resume. -+ */ -+ need_siglock = data && !thread_group_empty(current); -+ if (need_siglock) -+ spin_lock_irq(&child->sighand->siglock); - child->exit_code = data; - wake_up_state(child, __TASK_TRACED); -+ if (need_siglock) -+ spin_unlock_irq(&child->sighand->siglock); - - return 0; - } -diff --git a/kernel/softirq.c b/kernel/softirq.c -index 787b3a032429..21956f00cb51 100644 ---- a/kernel/softirq.c -+++ b/kernel/softirq.c -@@ -774,9 +774,13 @@ static void run_ksoftirqd(unsigned int cpu) - local_irq_disable(); - if (local_softirq_pending()) { - __do_softirq(); -- rcu_note_context_switch(cpu); - local_irq_enable(); - cond_resched(); -+ -+ preempt_disable(); -+ rcu_note_context_switch(cpu); -+ preempt_enable(); -+ - return; - } - local_irq_enable(); -diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c -index 3d9fee3a80b3..ab21b8c66535 100644 ---- a/kernel/trace/ring_buffer.c -+++ b/kernel/trace/ring_buffer.c -@@ -2650,7 +2650,7 @@ static DEFINE_PER_CPU(unsigned int, current_context); - - static __always_inline int trace_recursive_lock(void) - { -- unsigned int val = this_cpu_read(current_context); -+ unsigned int val = __this_cpu_read(current_context); - int bit; - - if (in_interrupt()) { -@@ -2667,18 +2667,17 @@ static __always_inline int trace_recursive_lock(void) - return 1; - - val |= (1 << bit); -- this_cpu_write(current_context, val); -+ __this_cpu_write(current_context, val); - - return 0; - } - - static __always_inline void trace_recursive_unlock(void) - { -- unsigned int val = this_cpu_read(current_context); -+ unsigned int val = __this_cpu_read(current_context); - -- val--; -- val &= this_cpu_read(current_context); -- this_cpu_write(current_context, val); -+ val &= val & (val - 1); -+ __this_cpu_write(current_context, val); - } - - #else -diff --git a/lib/string.c b/lib/string.c -index 43d0781daf47..cb9ea2181557 100644 ---- a/lib/string.c -+++ b/lib/string.c -@@ -598,7 +598,7 @@ EXPORT_SYMBOL(memset); - void memzero_explicit(void *s, size_t count) - { - memset(s, 0, count); -- OPTIMIZER_HIDE_VAR(s); -+ barrier(); - } - EXPORT_SYMBOL(memzero_explicit); - -diff --git a/net/ipv4/ip_forward.c b/net/ipv4/ip_forward.c -index 31ee5c6033df..479e8a63125a 100644 ---- a/net/ipv4/ip_forward.c -+++ b/net/ipv4/ip_forward.c -@@ -126,6 +126,9 @@ int ip_forward(struct sk_buff *skb) - struct rtable *rt; /* Route we use */ - struct ip_options *opt = &(IPCB(skb)->opt); - -+ if (unlikely(skb->sk)) -+ goto drop; -+ - if (skb_warn_if_lro(skb)) - goto drop; - -diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c -index 7681a1bbd97f..76c80b59e80f 100644 ---- a/net/ipv4/tcp_output.c -+++ b/net/ipv4/tcp_output.c -@@ -2571,39 +2571,65 @@ begin_fwd: - } - } - --/* Send a fin. The caller locks the socket for us. This cannot be -- * allowed to fail queueing a FIN frame under any circumstances. -+/* We allow to exceed memory limits for FIN packets to expedite -+ * connection tear down and (memory) recovery. -+ * Otherwise tcp_send_fin() could be tempted to either delay FIN -+ * or even be forced to close flow without any FIN. -+ */ -+static void sk_forced_wmem_schedule(struct sock *sk, int size) -+{ -+ int amt, status; -+ -+ if (size <= sk->sk_forward_alloc) -+ return; -+ amt = sk_mem_pages(size); -+ sk->sk_forward_alloc += amt * SK_MEM_QUANTUM; -+ sk_memory_allocated_add(sk, amt, &status); -+} -+ -+/* Send a FIN. The caller locks the socket for us. -+ * We should try to send a FIN packet really hard, but eventually give up. - */ - void tcp_send_fin(struct sock *sk) - { -+ struct sk_buff *skb, *tskb = tcp_write_queue_tail(sk); - struct tcp_sock *tp = tcp_sk(sk); -- struct sk_buff *skb = tcp_write_queue_tail(sk); -- int mss_now; - -- /* Optimization, tack on the FIN if we have a queue of -- * unsent frames. But be careful about outgoing SACKS -- * and IP options. -+ /* Optimization, tack on the FIN if we have one skb in write queue and -+ * this skb was not yet sent, or we are under memory pressure. -+ * Note: in the latter case, FIN packet will be sent after a timeout, -+ * as TCP stack thinks it has already been transmitted. - */ -- mss_now = tcp_current_mss(sk); -- -- if (tcp_send_head(sk) != NULL) { -- TCP_SKB_CB(skb)->tcp_flags |= TCPHDR_FIN; -- TCP_SKB_CB(skb)->end_seq++; -+ if (tskb && (tcp_send_head(sk) || sk_under_memory_pressure(sk))) { -+coalesce: -+ TCP_SKB_CB(tskb)->tcp_flags |= TCPHDR_FIN; -+ TCP_SKB_CB(tskb)->end_seq++; - tp->write_seq++; -+ if (!tcp_send_head(sk)) { -+ /* This means tskb was already sent. -+ * Pretend we included the FIN on previous transmit. -+ * We need to set tp->snd_nxt to the value it would have -+ * if FIN had been sent. This is because retransmit path -+ * does not change tp->snd_nxt. -+ */ -+ tp->snd_nxt++; -+ return; -+ } - } else { -- /* Socket is locked, keep trying until memory is available. */ -- for (;;) { -- skb = sk_stream_alloc_skb(sk, 0, sk->sk_allocation); -- if (skb) -- break; -- yield(); -+ skb = alloc_skb_fclone(MAX_TCP_HEADER, sk->sk_allocation); -+ if (unlikely(!skb)) { -+ if (tskb) -+ goto coalesce; -+ return; - } -+ skb_reserve(skb, MAX_TCP_HEADER); -+ sk_forced_wmem_schedule(sk, skb->truesize); - /* FIN eats a sequence byte, write_seq advanced by tcp_queue_skb(). */ - tcp_init_nondata_skb(skb, tp->write_seq, - TCPHDR_ACK | TCPHDR_FIN); - tcp_queue_skb(sk, skb); - } -- __tcp_push_pending_frames(sk, mss_now, TCP_NAGLE_OFF); -+ __tcp_push_pending_frames(sk, tcp_current_mss(sk), TCP_NAGLE_OFF); - } - - /* We get here when a process closes a file descriptor (either due to -diff --git a/sound/pci/emu10k1/emuproc.c b/sound/pci/emu10k1/emuproc.c -index 2ca9f2e93139..53745f4c2bf5 100644 ---- a/sound/pci/emu10k1/emuproc.c -+++ b/sound/pci/emu10k1/emuproc.c -@@ -241,31 +241,22 @@ static void snd_emu10k1_proc_spdif_read(struct snd_info_entry *entry, - struct snd_emu10k1 *emu = entry->private_data; - u32 value; - u32 value2; -- unsigned long flags; - u32 rate; - - if (emu->card_capabilities->emu_model) { -- spin_lock_irqsave(&emu->emu_lock, flags); - snd_emu1010_fpga_read(emu, 0x38, &value); -- spin_unlock_irqrestore(&emu->emu_lock, flags); - if ((value & 0x1) == 0) { -- spin_lock_irqsave(&emu->emu_lock, flags); - snd_emu1010_fpga_read(emu, 0x2a, &value); - snd_emu1010_fpga_read(emu, 0x2b, &value2); -- spin_unlock_irqrestore(&emu->emu_lock, flags); - rate = 0x1770000 / (((value << 5) | value2)+1); - snd_iprintf(buffer, "ADAT Locked : %u\n", rate); - } else { - snd_iprintf(buffer, "ADAT Unlocked\n"); - } -- spin_lock_irqsave(&emu->emu_lock, flags); - snd_emu1010_fpga_read(emu, 0x20, &value); -- spin_unlock_irqrestore(&emu->emu_lock, flags); - if ((value & 0x4) == 0) { -- spin_lock_irqsave(&emu->emu_lock, flags); - snd_emu1010_fpga_read(emu, 0x28, &value); - snd_emu1010_fpga_read(emu, 0x29, &value2); -- spin_unlock_irqrestore(&emu->emu_lock, flags); - rate = 0x1770000 / (((value << 5) | value2)+1); - snd_iprintf(buffer, "SPDIF Locked : %d\n", rate); - } else { -@@ -410,14 +401,11 @@ static void snd_emu_proc_emu1010_reg_read(struct snd_info_entry *entry, - { - struct snd_emu10k1 *emu = entry->private_data; - u32 value; -- unsigned long flags; - int i; - snd_iprintf(buffer, "EMU1010 Registers:\n\n"); - - for(i = 0; i < 0x40; i+=1) { -- spin_lock_irqsave(&emu->emu_lock, flags); - snd_emu1010_fpga_read(emu, i, &value); -- spin_unlock_irqrestore(&emu->emu_lock, flags); - snd_iprintf(buffer, "%02X: %08X, %02X\n", i, value, (value >> 8) & 0x7f); - } - } -diff --git a/tools/power/x86/turbostat/Makefile b/tools/power/x86/turbostat/Makefile -index d1b3a361e526..4039854560d0 100644 ---- a/tools/power/x86/turbostat/Makefile -+++ b/tools/power/x86/turbostat/Makefile -@@ -1,8 +1,12 @@ - CC = $(CROSS_COMPILE)gcc --BUILD_OUTPUT := $(PWD) -+BUILD_OUTPUT := $(CURDIR) - PREFIX := /usr - DESTDIR := - -+ifeq ("$(origin O)", "command line") -+ BUILD_OUTPUT := $(O) -+endif -+ - turbostat : turbostat.c - CFLAGS += -Wall - CFLAGS += -DMSRHEADER='"../../../../arch/x86/include/uapi/asm/msr-index.h"' -diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c -index a17f190be58e..1d4b8bed4e48 100644 ---- a/virt/kvm/kvm_main.c -+++ b/virt/kvm/kvm_main.c -@@ -1549,8 +1549,8 @@ int kvm_gfn_to_hva_cache_init(struct kvm *kvm, struct gfn_to_hva_cache *ghc, - ghc->generation = slots->generation; - ghc->len = len; - ghc->memslot = gfn_to_memslot(kvm, start_gfn); -- ghc->hva = gfn_to_hva_many(ghc->memslot, start_gfn, &nr_pages_avail); -- if (!kvm_is_error_hva(ghc->hva) && nr_pages_avail >= nr_pages_needed) { -+ ghc->hva = gfn_to_hva_many(ghc->memslot, start_gfn, NULL); -+ if (!kvm_is_error_hva(ghc->hva) && nr_pages_needed <= 1) { - ghc->hva += offset; - } else { - /* diff --git a/patch/kernel/marvell-default/1-patch-3.10.77-78.patch b/patch/kernel/marvell-default/1-patch-3.10.77-78.patch deleted file mode 100644 index 9646397697..0000000000 --- a/patch/kernel/marvell-default/1-patch-3.10.77-78.patch +++ /dev/null @@ -1,1032 +0,0 @@ -diff --git a/Makefile b/Makefile -index 923ad8a64e3b..cf99a9b53c6f 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,6 +1,6 @@ - VERSION = 3 - PATCHLEVEL = 10 --SUBLEVEL = 77 -+SUBLEVEL = 78 - EXTRAVERSION = - NAME = TOSSUG Baby Fish - -diff --git a/arch/arc/kernel/signal.c b/arch/arc/kernel/signal.c -index 7e95e1a86510..6763654239a2 100644 ---- a/arch/arc/kernel/signal.c -+++ b/arch/arc/kernel/signal.c -@@ -131,6 +131,15 @@ SYSCALL_DEFINE0(rt_sigreturn) - /* Don't restart from sigreturn */ - syscall_wont_restart(regs); - -+ /* -+ * Ensure that sigreturn always returns to user mode (in case the -+ * regs saved on user stack got fudged between save and sigreturn) -+ * Otherwise it is easy to panic the kernel with a custom -+ * signal handler and/or restorer which clobberes the status32/ret -+ * to return to a bogus location in kernel mode. -+ */ -+ regs->status32 |= STATUS_U_MASK; -+ - return regs->r0; - - badframe: -@@ -234,8 +243,11 @@ setup_rt_frame(int signo, struct k_sigaction *ka, siginfo_t *info, - - /* - * handler returns using sigreturn stub provided already by userpsace -+ * If not, nuke the process right away - */ -- BUG_ON(!(ka->sa.sa_flags & SA_RESTORER)); -+ if(!(ka->sa.sa_flags & SA_RESTORER)) -+ return 1; -+ - regs->blink = (unsigned long)ka->sa.sa_restorer; - - /* User Stack for signal handler will be above the frame just carved */ -@@ -302,12 +314,12 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info, - struct pt_regs *regs) - { - sigset_t *oldset = sigmask_to_save(); -- int ret; -+ int failed; - - /* Set up the stack frame */ -- ret = setup_rt_frame(sig, ka, info, oldset, regs); -+ failed = setup_rt_frame(sig, ka, info, oldset, regs); - -- if (ret) -+ if (failed) - force_sigsegv(sig, current); - else - signal_delivered(sig, info, ka, regs, 0); -diff --git a/arch/arm/boot/dts/dove.dtsi b/arch/arm/boot/dts/dove.dtsi -index 6cab46849cdb..d1e47092d21a 100644 ---- a/arch/arm/boot/dts/dove.dtsi -+++ b/arch/arm/boot/dts/dove.dtsi -@@ -75,7 +75,7 @@ - - uart2: serial@12200 { - compatible = "ns16550a"; -- reg = <0x12000 0x100>; -+ reg = <0x12200 0x100>; - reg-shift = <2>; - interrupts = <9>; - clocks = <&core_clk 0>; -@@ -84,7 +84,7 @@ - - uart3: serial@12300 { - compatible = "ns16550a"; -- reg = <0x12100 0x100>; -+ reg = <0x12300 0x100>; - reg-shift = <2>; - interrupts = <10>; - clocks = <&core_clk 0>; -diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c -index 7e3f45105f11..dd297099c99d 100644 ---- a/drivers/block/rbd.c -+++ b/drivers/block/rbd.c -@@ -2115,6 +2115,11 @@ static bool rbd_img_obj_end_request(struct rbd_obj_request *obj_request) - result, xferred); - if (!img_request->result) - img_request->result = result; -+ /* -+ * Need to end I/O on the entire obj_request worth of -+ * bytes in case of error. -+ */ -+ xferred = obj_request->length; - } - - /* Image object requests don't own their page array */ -diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c -index 21ef68934a20..edf8995cb3b3 100644 ---- a/drivers/hv/channel_mgmt.c -+++ b/drivers/hv/channel_mgmt.c -@@ -648,7 +648,7 @@ int vmbus_request_offers(void) - { - struct vmbus_channel_message_header *msg; - struct vmbus_channel_msginfo *msginfo; -- int ret, t; -+ int ret; - - msginfo = kmalloc(sizeof(*msginfo) + - sizeof(struct vmbus_channel_message_header), -@@ -656,8 +656,6 @@ int vmbus_request_offers(void) - if (!msginfo) - return -ENOMEM; - -- init_completion(&msginfo->waitevent); -- - msg = (struct vmbus_channel_message_header *)msginfo->msg; - - msg->msgtype = CHANNELMSG_REQUESTOFFERS; -@@ -671,14 +669,6 @@ int vmbus_request_offers(void) - goto cleanup; - } - -- t = wait_for_completion_timeout(&msginfo->waitevent, 5*HZ); -- if (t == 0) { -- ret = -ETIMEDOUT; -- goto cleanup; -- } -- -- -- - cleanup: - kfree(msginfo); - -diff --git a/drivers/mtd/ubi/misc.c b/drivers/mtd/ubi/misc.c -index f913d701a5b3..c4b1af07a121 100644 ---- a/drivers/mtd/ubi/misc.c -+++ b/drivers/mtd/ubi/misc.c -@@ -74,6 +74,8 @@ int ubi_check_volume(struct ubi_device *ubi, int vol_id) - for (i = 0; i < vol->used_ebs; i++) { - int size; - -+ cond_resched(); -+ - if (i == vol->used_ebs - 1) - size = vol->last_eb_bytes; - else -diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c -index 0a7325361d29..5f57e3d35e26 100644 ---- a/drivers/scsi/3w-9xxx.c -+++ b/drivers/scsi/3w-9xxx.c -@@ -149,7 +149,6 @@ static int twa_reset_sequence(TW_Device_Extension *tw_dev, int soft_reset); - static int twa_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id, char *cdb, int use_sg, TW_SG_Entry *sglistarg); - static void twa_scsiop_execute_scsi_complete(TW_Device_Extension *tw_dev, int request_id); - static char *twa_string_lookup(twa_message_type *table, unsigned int aen_code); --static void twa_unmap_scsi_data(TW_Device_Extension *tw_dev, int request_id); - - /* Functions */ - -@@ -1352,11 +1351,11 @@ static irqreturn_t twa_interrupt(int irq, void *dev_instance) - } - - /* Now complete the io */ -+ scsi_dma_unmap(cmd); -+ cmd->scsi_done(cmd); - tw_dev->state[request_id] = TW_S_COMPLETED; - twa_free_request_id(tw_dev, request_id); - tw_dev->posted_request_count--; -- tw_dev->srb[request_id]->scsi_done(tw_dev->srb[request_id]); -- twa_unmap_scsi_data(tw_dev, request_id); - } - - /* Check for valid status after each drain */ -@@ -1414,26 +1413,6 @@ static void twa_load_sgl(TW_Device_Extension *tw_dev, TW_Command_Full *full_comm - } - } /* End twa_load_sgl() */ - --/* This function will perform a pci-dma mapping for a scatter gather list */ --static int twa_map_scsi_sg_data(TW_Device_Extension *tw_dev, int request_id) --{ -- int use_sg; -- struct scsi_cmnd *cmd = tw_dev->srb[request_id]; -- -- use_sg = scsi_dma_map(cmd); -- if (!use_sg) -- return 0; -- else if (use_sg < 0) { -- TW_PRINTK(tw_dev->host, TW_DRIVER, 0x1c, "Failed to map scatter gather list"); -- return 0; -- } -- -- cmd->SCp.phase = TW_PHASE_SGLIST; -- cmd->SCp.have_data_in = use_sg; -- -- return use_sg; --} /* End twa_map_scsi_sg_data() */ -- - /* This function will poll for a response interrupt of a request */ - static int twa_poll_response(TW_Device_Extension *tw_dev, int request_id, int seconds) - { -@@ -1612,9 +1591,11 @@ static int twa_reset_device_extension(TW_Device_Extension *tw_dev) - (tw_dev->state[i] != TW_S_INITIAL) && - (tw_dev->state[i] != TW_S_COMPLETED)) { - if (tw_dev->srb[i]) { -- tw_dev->srb[i]->result = (DID_RESET << 16); -- tw_dev->srb[i]->scsi_done(tw_dev->srb[i]); -- twa_unmap_scsi_data(tw_dev, i); -+ struct scsi_cmnd *cmd = tw_dev->srb[i]; -+ -+ cmd->result = (DID_RESET << 16); -+ scsi_dma_unmap(cmd); -+ cmd->scsi_done(cmd); - } - } - } -@@ -1793,21 +1774,18 @@ static int twa_scsi_queue_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_ - /* Save the scsi command for use by the ISR */ - tw_dev->srb[request_id] = SCpnt; - -- /* Initialize phase to zero */ -- SCpnt->SCp.phase = TW_PHASE_INITIAL; -- - retval = twa_scsiop_execute_scsi(tw_dev, request_id, NULL, 0, NULL); - switch (retval) { - case SCSI_MLQUEUE_HOST_BUSY: -+ scsi_dma_unmap(SCpnt); - twa_free_request_id(tw_dev, request_id); -- twa_unmap_scsi_data(tw_dev, request_id); - break; - case 1: -- tw_dev->state[request_id] = TW_S_COMPLETED; -- twa_free_request_id(tw_dev, request_id); -- twa_unmap_scsi_data(tw_dev, request_id); - SCpnt->result = (DID_ERROR << 16); -+ scsi_dma_unmap(SCpnt); - done(SCpnt); -+ tw_dev->state[request_id] = TW_S_COMPLETED; -+ twa_free_request_id(tw_dev, request_id); - retval = 0; - } - out: -@@ -1875,8 +1853,8 @@ static int twa_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id, - command_packet->sg_list[0].address = TW_CPU_TO_SGL(tw_dev->generic_buffer_phys[request_id]); - command_packet->sg_list[0].length = cpu_to_le32(TW_MIN_SGL_LENGTH); - } else { -- sg_count = twa_map_scsi_sg_data(tw_dev, request_id); -- if (sg_count == 0) -+ sg_count = scsi_dma_map(srb); -+ if (sg_count < 0) - goto out; - - scsi_for_each_sg(srb, sg, sg_count, i) { -@@ -1991,15 +1969,6 @@ static char *twa_string_lookup(twa_message_type *table, unsigned int code) - return(table[index].text); - } /* End twa_string_lookup() */ - --/* This function will perform a pci-dma unmap */ --static void twa_unmap_scsi_data(TW_Device_Extension *tw_dev, int request_id) --{ -- struct scsi_cmnd *cmd = tw_dev->srb[request_id]; -- -- if (cmd->SCp.phase == TW_PHASE_SGLIST) -- scsi_dma_unmap(cmd); --} /* End twa_unmap_scsi_data() */ -- - /* This function gets called when a disk is coming on-line */ - static int twa_slave_configure(struct scsi_device *sdev) - { -diff --git a/drivers/scsi/3w-9xxx.h b/drivers/scsi/3w-9xxx.h -index 040f7214e5b7..0fdc83cfa0e1 100644 ---- a/drivers/scsi/3w-9xxx.h -+++ b/drivers/scsi/3w-9xxx.h -@@ -324,11 +324,6 @@ static twa_message_type twa_error_table[] = { - #define TW_CURRENT_DRIVER_BUILD 0 - #define TW_CURRENT_DRIVER_BRANCH 0 - --/* Phase defines */ --#define TW_PHASE_INITIAL 0 --#define TW_PHASE_SINGLE 1 --#define TW_PHASE_SGLIST 2 -- - /* Misc defines */ - #define TW_9550SX_DRAIN_COMPLETED 0xFFFF - #define TW_SECTOR_SIZE 512 -diff --git a/drivers/scsi/3w-sas.c b/drivers/scsi/3w-sas.c -index 4de346017e9f..61702ac00d42 100644 ---- a/drivers/scsi/3w-sas.c -+++ b/drivers/scsi/3w-sas.c -@@ -303,26 +303,6 @@ static int twl_post_command_packet(TW_Device_Extension *tw_dev, int request_id) - return 0; - } /* End twl_post_command_packet() */ - --/* This function will perform a pci-dma mapping for a scatter gather list */ --static int twl_map_scsi_sg_data(TW_Device_Extension *tw_dev, int request_id) --{ -- int use_sg; -- struct scsi_cmnd *cmd = tw_dev->srb[request_id]; -- -- use_sg = scsi_dma_map(cmd); -- if (!use_sg) -- return 0; -- else if (use_sg < 0) { -- TW_PRINTK(tw_dev->host, TW_DRIVER, 0x1, "Failed to map scatter gather list"); -- return 0; -- } -- -- cmd->SCp.phase = TW_PHASE_SGLIST; -- cmd->SCp.have_data_in = use_sg; -- -- return use_sg; --} /* End twl_map_scsi_sg_data() */ -- - /* This function hands scsi cdb's to the firmware */ - static int twl_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id, char *cdb, int use_sg, TW_SG_Entry_ISO *sglistarg) - { -@@ -370,8 +350,8 @@ static int twl_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id, - if (!sglistarg) { - /* Map sglist from scsi layer to cmd packet */ - if (scsi_sg_count(srb)) { -- sg_count = twl_map_scsi_sg_data(tw_dev, request_id); -- if (sg_count == 0) -+ sg_count = scsi_dma_map(srb); -+ if (sg_count <= 0) - goto out; - - scsi_for_each_sg(srb, sg, sg_count, i) { -@@ -1116,15 +1096,6 @@ out: - return retval; - } /* End twl_initialize_device_extension() */ - --/* This function will perform a pci-dma unmap */ --static void twl_unmap_scsi_data(TW_Device_Extension *tw_dev, int request_id) --{ -- struct scsi_cmnd *cmd = tw_dev->srb[request_id]; -- -- if (cmd->SCp.phase == TW_PHASE_SGLIST) -- scsi_dma_unmap(cmd); --} /* End twl_unmap_scsi_data() */ -- - /* This function will handle attention interrupts */ - static int twl_handle_attention_interrupt(TW_Device_Extension *tw_dev) - { -@@ -1265,11 +1236,11 @@ static irqreturn_t twl_interrupt(int irq, void *dev_instance) - } - - /* Now complete the io */ -+ scsi_dma_unmap(cmd); -+ cmd->scsi_done(cmd); - tw_dev->state[request_id] = TW_S_COMPLETED; - twl_free_request_id(tw_dev, request_id); - tw_dev->posted_request_count--; -- tw_dev->srb[request_id]->scsi_done(tw_dev->srb[request_id]); -- twl_unmap_scsi_data(tw_dev, request_id); - } - - /* Check for another response interrupt */ -@@ -1414,10 +1385,12 @@ static int twl_reset_device_extension(TW_Device_Extension *tw_dev, int ioctl_res - if ((tw_dev->state[i] != TW_S_FINISHED) && - (tw_dev->state[i] != TW_S_INITIAL) && - (tw_dev->state[i] != TW_S_COMPLETED)) { -- if (tw_dev->srb[i]) { -- tw_dev->srb[i]->result = (DID_RESET << 16); -- tw_dev->srb[i]->scsi_done(tw_dev->srb[i]); -- twl_unmap_scsi_data(tw_dev, i); -+ struct scsi_cmnd *cmd = tw_dev->srb[i]; -+ -+ if (cmd) { -+ cmd->result = (DID_RESET << 16); -+ scsi_dma_unmap(cmd); -+ cmd->scsi_done(cmd); - } - } - } -@@ -1521,9 +1494,6 @@ static int twl_scsi_queue_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_ - /* Save the scsi command for use by the ISR */ - tw_dev->srb[request_id] = SCpnt; - -- /* Initialize phase to zero */ -- SCpnt->SCp.phase = TW_PHASE_INITIAL; -- - retval = twl_scsiop_execute_scsi(tw_dev, request_id, NULL, 0, NULL); - if (retval) { - tw_dev->state[request_id] = TW_S_COMPLETED; -diff --git a/drivers/scsi/3w-sas.h b/drivers/scsi/3w-sas.h -index d474892701d4..fec6449c7595 100644 ---- a/drivers/scsi/3w-sas.h -+++ b/drivers/scsi/3w-sas.h -@@ -103,10 +103,6 @@ static char *twl_aen_severity_table[] = - #define TW_CURRENT_DRIVER_BUILD 0 - #define TW_CURRENT_DRIVER_BRANCH 0 - --/* Phase defines */ --#define TW_PHASE_INITIAL 0 --#define TW_PHASE_SGLIST 2 -- - /* Misc defines */ - #define TW_SECTOR_SIZE 512 - #define TW_MAX_UNITS 32 -diff --git a/drivers/scsi/3w-xxxx.c b/drivers/scsi/3w-xxxx.c -index 430ee3774c3b..8843ad783b41 100644 ---- a/drivers/scsi/3w-xxxx.c -+++ b/drivers/scsi/3w-xxxx.c -@@ -1283,32 +1283,6 @@ static int tw_initialize_device_extension(TW_Device_Extension *tw_dev) - return 0; - } /* End tw_initialize_device_extension() */ - --static int tw_map_scsi_sg_data(struct pci_dev *pdev, struct scsi_cmnd *cmd) --{ -- int use_sg; -- -- dprintk(KERN_WARNING "3w-xxxx: tw_map_scsi_sg_data()\n"); -- -- use_sg = scsi_dma_map(cmd); -- if (use_sg < 0) { -- printk(KERN_WARNING "3w-xxxx: tw_map_scsi_sg_data(): pci_map_sg() failed.\n"); -- return 0; -- } -- -- cmd->SCp.phase = TW_PHASE_SGLIST; -- cmd->SCp.have_data_in = use_sg; -- -- return use_sg; --} /* End tw_map_scsi_sg_data() */ -- --static void tw_unmap_scsi_data(struct pci_dev *pdev, struct scsi_cmnd *cmd) --{ -- dprintk(KERN_WARNING "3w-xxxx: tw_unmap_scsi_data()\n"); -- -- if (cmd->SCp.phase == TW_PHASE_SGLIST) -- scsi_dma_unmap(cmd); --} /* End tw_unmap_scsi_data() */ -- - /* This function will reset a device extension */ - static int tw_reset_device_extension(TW_Device_Extension *tw_dev) - { -@@ -1331,8 +1305,8 @@ static int tw_reset_device_extension(TW_Device_Extension *tw_dev) - srb = tw_dev->srb[i]; - if (srb != NULL) { - srb->result = (DID_RESET << 16); -- tw_dev->srb[i]->scsi_done(tw_dev->srb[i]); -- tw_unmap_scsi_data(tw_dev->tw_pci_dev, tw_dev->srb[i]); -+ scsi_dma_unmap(srb); -+ srb->scsi_done(srb); - } - } - } -@@ -1779,8 +1753,8 @@ static int tw_scsiop_read_write(TW_Device_Extension *tw_dev, int request_id) - command_packet->byte8.io.lba = lba; - command_packet->byte6.block_count = num_sectors; - -- use_sg = tw_map_scsi_sg_data(tw_dev->tw_pci_dev, tw_dev->srb[request_id]); -- if (!use_sg) -+ use_sg = scsi_dma_map(srb); -+ if (use_sg <= 0) - return 1; - - scsi_for_each_sg(tw_dev->srb[request_id], sg, use_sg, i) { -@@ -1967,9 +1941,6 @@ static int tw_scsi_queue_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_c - /* Save the scsi command for use by the ISR */ - tw_dev->srb[request_id] = SCpnt; - -- /* Initialize phase to zero */ -- SCpnt->SCp.phase = TW_PHASE_INITIAL; -- - switch (*command) { - case READ_10: - case READ_6: -@@ -2196,12 +2167,11 @@ static irqreturn_t tw_interrupt(int irq, void *dev_instance) - - /* Now complete the io */ - if ((error != TW_ISR_DONT_COMPLETE)) { -+ scsi_dma_unmap(tw_dev->srb[request_id]); -+ tw_dev->srb[request_id]->scsi_done(tw_dev->srb[request_id]); - tw_dev->state[request_id] = TW_S_COMPLETED; - tw_state_request_finish(tw_dev, request_id); - tw_dev->posted_request_count--; -- tw_dev->srb[request_id]->scsi_done(tw_dev->srb[request_id]); -- -- tw_unmap_scsi_data(tw_dev->tw_pci_dev, tw_dev->srb[request_id]); - } - } - -diff --git a/drivers/scsi/3w-xxxx.h b/drivers/scsi/3w-xxxx.h -index 49dcf03c631a..1d31858766ce 100644 ---- a/drivers/scsi/3w-xxxx.h -+++ b/drivers/scsi/3w-xxxx.h -@@ -195,11 +195,6 @@ static unsigned char tw_sense_table[][4] = - #define TW_AEN_SMART_FAIL 0x000F - #define TW_AEN_SBUF_FAIL 0x0024 - --/* Phase defines */ --#define TW_PHASE_INITIAL 0 --#define TW_PHASE_SINGLE 1 --#define TW_PHASE_SGLIST 2 -- - /* Misc defines */ - #define TW_ALIGNMENT_6000 64 /* 64 bytes */ - #define TW_ALIGNMENT_7000 4 /* 4 bytes */ -diff --git a/drivers/staging/panel/panel.c b/drivers/staging/panel/panel.c -index c54df3948e20..4d0a87b93b96 100644 ---- a/drivers/staging/panel/panel.c -+++ b/drivers/staging/panel/panel.c -@@ -275,11 +275,11 @@ static unsigned char lcd_bits[LCD_PORTS][LCD_BITS][BIT_STATES]; - * LCD types - */ - #define LCD_TYPE_NONE 0 --#define LCD_TYPE_OLD 1 --#define LCD_TYPE_KS0074 2 --#define LCD_TYPE_HANTRONIX 3 --#define LCD_TYPE_NEXCOM 4 --#define LCD_TYPE_CUSTOM 5 -+#define LCD_TYPE_CUSTOM 1 -+#define LCD_TYPE_OLD 2 -+#define LCD_TYPE_KS0074 3 -+#define LCD_TYPE_HANTRONIX 4 -+#define LCD_TYPE_NEXCOM 5 - - /* - * keypad types -@@ -457,8 +457,7 @@ MODULE_PARM_DESC(keypad_enabled, "Deprecated option, use keypad_type instead"); - static int lcd_type = -1; - module_param(lcd_type, int, 0000); - MODULE_PARM_DESC(lcd_type, -- "LCD type: 0=none, 1=old //, 2=serial ks0074, " -- "3=hantronix //, 4=nexcom //, 5=compiled-in"); -+ "LCD type: 0=none, 1=compiled-in, 2=old, 3=serial ks0074, 4=hantronix, 5=nexcom"); - - static int lcd_proto = -1; - module_param(lcd_proto, int, 0000); -diff --git a/drivers/tty/serial/of_serial.c b/drivers/tty/serial/of_serial.c -index 39c7ea4cb14f..2225f83f4c04 100644 ---- a/drivers/tty/serial/of_serial.c -+++ b/drivers/tty/serial/of_serial.c -@@ -262,7 +262,6 @@ static struct of_device_id of_platform_serial_table[] = { - { .compatible = "ibm,qpace-nwp-serial", - .data = (void *)PORT_NWPSERIAL, }, - #endif -- { .type = "serial", .data = (void *)PORT_UNKNOWN, }, - { /* end of list */ }, - }; - -diff --git a/drivers/usb/gadget/printer.c b/drivers/usb/gadget/printer.c -index bf7a56b6d48a..a0dfdbddbf08 100644 ---- a/drivers/usb/gadget/printer.c -+++ b/drivers/usb/gadget/printer.c -@@ -975,6 +975,15 @@ unknown: - break; - } - /* host either stalls (value < 0) or reports success */ -+ if (value >= 0) { -+ req->length = value; -+ req->zero = value < wLength; -+ value = usb_ep_queue(cdev->gadget->ep0, req, GFP_ATOMIC); -+ if (value < 0) { -+ ERROR(dev, "%s:%d Error!\n", __func__, __LINE__); -+ req->status = 0; -+ } -+ } - return value; - } - -diff --git a/drivers/usb/host/oxu210hp-hcd.c b/drivers/usb/host/oxu210hp-hcd.c -index 0f401dbfaf07..b5c4f4d81a38 100644 ---- a/drivers/usb/host/oxu210hp-hcd.c -+++ b/drivers/usb/host/oxu210hp-hcd.c -@@ -2497,11 +2497,12 @@ static irqreturn_t oxu210_hcd_irq(struct usb_hcd *hcd) - || oxu->reset_done[i] != 0) - continue; - -- /* start 20 msec resume signaling from this port, -- * and make khubd collect PORT_STAT_C_SUSPEND to -+ /* start USB_RESUME_TIMEOUT resume signaling from this -+ * port, and make hub_wq collect PORT_STAT_C_SUSPEND to - * stop that signaling. - */ -- oxu->reset_done[i] = jiffies + msecs_to_jiffies(20); -+ oxu->reset_done[i] = jiffies + -+ msecs_to_jiffies(USB_RESUME_TIMEOUT); - oxu_dbg(oxu, "port %d remote wakeup\n", i + 1); - mod_timer(&hcd->rh_timer, oxu->reset_done[i]); - } -diff --git a/fs/ext4/extents_status.c b/fs/ext4/extents_status.c -index e6941e622d31..1fefeb7d14db 100644 ---- a/fs/ext4/extents_status.c -+++ b/fs/ext4/extents_status.c -@@ -655,6 +655,14 @@ int ext4_es_insert_extent(struct inode *inode, ext4_lblk_t lblk, - - BUG_ON(end < lblk); - -+ if ((status & EXTENT_STATUS_DELAYED) && -+ (status & EXTENT_STATUS_WRITTEN)) { -+ ext4_warning(inode->i_sb, "Inserting extent [%u/%u] as " -+ " delayed and written which can potentially " -+ " cause data loss.\n", lblk, len); -+ WARN_ON(1); -+ } -+ - newes.es_lblk = lblk; - newes.es_len = len; - ext4_es_store_pblock(&newes, pblk); -diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c -index e48bd5a1814b..9e3d8dd6c40a 100644 ---- a/fs/ext4/inode.c -+++ b/fs/ext4/inode.c -@@ -626,6 +626,7 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode, - status = map->m_flags & EXT4_MAP_UNWRITTEN ? - EXTENT_STATUS_UNWRITTEN : EXTENT_STATUS_WRITTEN; - if (!(flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE) && -+ !(status & EXTENT_STATUS_WRITTEN) && - ext4_find_delalloc_range(inode, map->m_lblk, - map->m_lblk + map->m_len - 1)) - status |= EXTENT_STATUS_DELAYED; -@@ -736,6 +737,7 @@ found: - status = map->m_flags & EXT4_MAP_UNWRITTEN ? - EXTENT_STATUS_UNWRITTEN : EXTENT_STATUS_WRITTEN; - if (!(flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE) && -+ !(status & EXTENT_STATUS_WRITTEN) && - ext4_find_delalloc_range(inode, map->m_lblk, - map->m_lblk + map->m_len - 1)) - status |= EXTENT_STATUS_DELAYED; -diff --git a/include/sound/emu10k1.h b/include/sound/emu10k1.h -index dfb42ca6d043..8898cdeb42a4 100644 ---- a/include/sound/emu10k1.h -+++ b/include/sound/emu10k1.h -@@ -41,7 +41,8 @@ - - #define EMUPAGESIZE 4096 - #define MAXREQVOICES 8 --#define MAXPAGES 8192 -+#define MAXPAGES0 4096 /* 32 bit mode */ -+#define MAXPAGES1 8192 /* 31 bit mode */ - #define RESERVED 0 - #define NUM_MIDI 16 - #define NUM_G 64 /* use all channels */ -@@ -50,8 +51,7 @@ - - /* FIXME? - according to the OSS driver the EMU10K1 needs a 29 bit DMA mask */ - #define EMU10K1_DMA_MASK 0x7fffffffUL /* 31bit */ --#define AUDIGY_DMA_MASK 0x7fffffffUL /* 31bit FIXME - 32 should work? */ -- /* See ALSA bug #1276 - rlrevell */ -+#define AUDIGY_DMA_MASK 0xffffffffUL /* 32bit mode */ - - #define TMEMSIZE 256*1024 - #define TMEMSIZEREG 4 -@@ -468,8 +468,11 @@ - - #define MAPB 0x0d /* Cache map B */ - --#define MAP_PTE_MASK 0xffffe000 /* The 19 MSBs of the PTE indexed by the PTI */ --#define MAP_PTI_MASK 0x00001fff /* The 13 bit index to one of the 8192 PTE dwords */ -+#define MAP_PTE_MASK0 0xfffff000 /* The 20 MSBs of the PTE indexed by the PTI */ -+#define MAP_PTI_MASK0 0x00000fff /* The 12 bit index to one of the 4096 PTE dwords */ -+ -+#define MAP_PTE_MASK1 0xffffe000 /* The 19 MSBs of the PTE indexed by the PTI */ -+#define MAP_PTI_MASK1 0x00001fff /* The 13 bit index to one of the 8192 PTE dwords */ - - /* 0x0e, 0x0f: Not used */ - -@@ -1706,6 +1709,7 @@ struct snd_emu10k1 { - unsigned short model; /* subsystem id */ - unsigned int card_type; /* EMU10K1_CARD_* */ - unsigned int ecard_ctrl; /* ecard control bits */ -+ unsigned int address_mode; /* address mode */ - unsigned long dma_mask; /* PCI DMA mask */ - unsigned int delay_pcm_irq; /* in samples */ - int max_cache_pages; /* max memory size / PAGE_SIZE */ -diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c -index 698f3a2ac5ae..459b957104a8 100644 ---- a/net/ipv4/ping.c -+++ b/net/ipv4/ping.c -@@ -139,6 +139,7 @@ static void ping_v4_unhash(struct sock *sk) - if (sk_hashed(sk)) { - write_lock_bh(&ping_table.lock); - hlist_nulls_del(&sk->sk_nulls_node); -+ sk_nulls_node_init(&sk->sk_nulls_node); - sock_put(sk); - isk->inet_num = 0; - isk->inet_sport = 0; -diff --git a/sound/pci/emu10k1/emu10k1.c b/sound/pci/emu10k1/emu10k1.c -index 8c5010f7889c..70e6fe186d34 100644 ---- a/sound/pci/emu10k1/emu10k1.c -+++ b/sound/pci/emu10k1/emu10k1.c -@@ -181,8 +181,10 @@ static int snd_card_emu10k1_probe(struct pci_dev *pci, - } - #endif - -- strcpy(card->driver, emu->card_capabilities->driver); -- strcpy(card->shortname, emu->card_capabilities->name); -+ strlcpy(card->driver, emu->card_capabilities->driver, -+ sizeof(card->driver)); -+ strlcpy(card->shortname, emu->card_capabilities->name, -+ sizeof(card->shortname)); - snprintf(card->longname, sizeof(card->longname), - "%s (rev.%d, serial:0x%x) at 0x%lx, irq %i", - card->shortname, emu->revision, emu->serial, emu->port, emu->irq); -diff --git a/sound/pci/emu10k1/emu10k1_callback.c b/sound/pci/emu10k1/emu10k1_callback.c -index 0a34b5f1c475..f8a6549f00e5 100644 ---- a/sound/pci/emu10k1/emu10k1_callback.c -+++ b/sound/pci/emu10k1/emu10k1_callback.c -@@ -415,7 +415,7 @@ start_voice(struct snd_emux_voice *vp) - snd_emu10k1_ptr_write(hw, Z2, ch, 0); - - /* invalidate maps */ -- temp = (hw->silent_page.addr << 1) | MAP_PTI_MASK; -+ temp = (hw->silent_page.addr << hw->address_mode) | (hw->address_mode ? MAP_PTI_MASK1 : MAP_PTI_MASK0); - snd_emu10k1_ptr_write(hw, MAPA, ch, temp); - snd_emu10k1_ptr_write(hw, MAPB, ch, temp); - #if 0 -@@ -436,7 +436,7 @@ start_voice(struct snd_emux_voice *vp) - snd_emu10k1_ptr_write(hw, CDF, ch, sample); - - /* invalidate maps */ -- temp = ((unsigned int)hw->silent_page.addr << 1) | MAP_PTI_MASK; -+ temp = ((unsigned int)hw->silent_page.addr << hw_address_mode) | (hw->address_mode ? MAP_PTI_MASK1 : MAP_PTI_MASK0); - snd_emu10k1_ptr_write(hw, MAPA, ch, temp); - snd_emu10k1_ptr_write(hw, MAPB, ch, temp); - -diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c -index bdd888ec9a84..a131092572e6 100644 ---- a/sound/pci/emu10k1/emu10k1_main.c -+++ b/sound/pci/emu10k1/emu10k1_main.c -@@ -282,7 +282,7 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume) - snd_emu10k1_ptr_write(emu, TCB, 0, 0); /* taken from original driver */ - snd_emu10k1_ptr_write(emu, TCBS, 0, 4); /* taken from original driver */ - -- silent_page = (emu->silent_page.addr << 1) | MAP_PTI_MASK; -+ silent_page = (emu->silent_page.addr << emu->address_mode) | (emu->address_mode ? MAP_PTI_MASK1 : MAP_PTI_MASK0); - for (ch = 0; ch < NUM_G; ch++) { - snd_emu10k1_ptr_write(emu, MAPA, ch, silent_page); - snd_emu10k1_ptr_write(emu, MAPB, ch, silent_page); -@@ -348,6 +348,11 @@ static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume) - outl(reg | A_IOCFG_GPOUT0, emu->port + A_IOCFG); - } - -+ if (emu->address_mode == 0) { -+ /* use 16M in 4G */ -+ outl(inl(emu->port + HCFG) | HCFG_EXPANDED_MEM, emu->port + HCFG); -+ } -+ - return 0; - } - -@@ -1411,7 +1416,7 @@ static struct snd_emu_chip_details emu_chip_details[] = { - * - */ - {.vendor = 0x1102, .device = 0x0008, .subsystem = 0x20011102, -- .driver = "Audigy2", .name = "SB Audigy 2 ZS Notebook [SB0530]", -+ .driver = "Audigy2", .name = "Audigy 2 ZS Notebook [SB0530]", - .id = "Audigy2", - .emu10k2_chip = 1, - .ca0108_chip = 1, -@@ -1561,7 +1566,7 @@ static struct snd_emu_chip_details emu_chip_details[] = { - .adc_1361t = 1, /* 24 bit capture instead of 16bit */ - .ac97_chip = 1} , - {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x10051102, -- .driver = "Audigy2", .name = "SB Audigy 2 Platinum EX [SB0280]", -+ .driver = "Audigy2", .name = "Audigy 2 Platinum EX [SB0280]", - .id = "Audigy2", - .emu10k2_chip = 1, - .ca0102_chip = 1, -@@ -1865,8 +1870,10 @@ int snd_emu10k1_create(struct snd_card *card, - - is_audigy = emu->audigy = c->emu10k2_chip; - -+ /* set addressing mode */ -+ emu->address_mode = is_audigy ? 0 : 1; - /* set the DMA transfer mask */ -- emu->dma_mask = is_audigy ? AUDIGY_DMA_MASK : EMU10K1_DMA_MASK; -+ emu->dma_mask = emu->address_mode ? EMU10K1_DMA_MASK : AUDIGY_DMA_MASK; - if (pci_set_dma_mask(pci, emu->dma_mask) < 0 || - pci_set_consistent_dma_mask(pci, emu->dma_mask) < 0) { - snd_printk(KERN_ERR "architecture does not support PCI busmaster DMA with mask 0x%lx\n", emu->dma_mask); -@@ -1889,7 +1896,7 @@ int snd_emu10k1_create(struct snd_card *card, - - emu->max_cache_pages = max_cache_bytes >> PAGE_SHIFT; - if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci), -- 32 * 1024, &emu->ptb_pages) < 0) { -+ (emu->address_mode ? 32 : 16) * 1024, &emu->ptb_pages) < 0) { - err = -ENOMEM; - goto error; - } -@@ -1988,8 +1995,8 @@ int snd_emu10k1_create(struct snd_card *card, - - /* Clear silent pages and set up pointers */ - memset(emu->silent_page.area, 0, PAGE_SIZE); -- silent_page = emu->silent_page.addr << 1; -- for (idx = 0; idx < MAXPAGES; idx++) -+ silent_page = emu->silent_page.addr << emu->address_mode; -+ for (idx = 0; idx < (emu->address_mode ? MAXPAGES1 : MAXPAGES0); idx++) - ((u32 *)emu->ptb_pages.area)[idx] = cpu_to_le32(silent_page | idx); - - /* set up voice indices */ -diff --git a/sound/pci/emu10k1/emupcm.c b/sound/pci/emu10k1/emupcm.c -index 5ae1d045bdcb..7581019d7c84 100644 ---- a/sound/pci/emu10k1/emupcm.c -+++ b/sound/pci/emu10k1/emupcm.c -@@ -379,7 +379,7 @@ static void snd_emu10k1_pcm_init_voice(struct snd_emu10k1 *emu, - snd_emu10k1_ptr_write(emu, Z1, voice, 0); - snd_emu10k1_ptr_write(emu, Z2, voice, 0); - /* invalidate maps */ -- silent_page = ((unsigned int)emu->silent_page.addr << 1) | MAP_PTI_MASK; -+ silent_page = ((unsigned int)emu->silent_page.addr << emu->address_mode) | (emu->address_mode ? MAP_PTI_MASK1 : MAP_PTI_MASK0); - snd_emu10k1_ptr_write(emu, MAPA, voice, silent_page); - snd_emu10k1_ptr_write(emu, MAPB, voice, silent_page); - /* modulation envelope */ -diff --git a/sound/pci/emu10k1/memory.c b/sound/pci/emu10k1/memory.c -index ae709c1ab3a8..d514458efe3d 100644 ---- a/sound/pci/emu10k1/memory.c -+++ b/sound/pci/emu10k1/memory.c -@@ -34,10 +34,11 @@ - * aligned pages in others - */ - #define __set_ptb_entry(emu,page,addr) \ -- (((u32 *)(emu)->ptb_pages.area)[page] = cpu_to_le32(((addr) << 1) | (page))) -+ (((u32 *)(emu)->ptb_pages.area)[page] = cpu_to_le32(((addr) << (emu->address_mode)) | (page))) - - #define UNIT_PAGES (PAGE_SIZE / EMUPAGESIZE) --#define MAX_ALIGN_PAGES (MAXPAGES / UNIT_PAGES) -+#define MAX_ALIGN_PAGES0 (MAXPAGES0 / UNIT_PAGES) -+#define MAX_ALIGN_PAGES1 (MAXPAGES1 / UNIT_PAGES) - /* get aligned page from offset address */ - #define get_aligned_page(offset) ((offset) >> PAGE_SHIFT) - /* get offset address from aligned page */ -@@ -124,7 +125,7 @@ static int search_empty_map_area(struct snd_emu10k1 *emu, int npages, struct lis - } - page = blk->mapped_page + blk->pages; - } -- size = MAX_ALIGN_PAGES - page; -+ size = (emu->address_mode ? MAX_ALIGN_PAGES1 : MAX_ALIGN_PAGES0) - page; - if (size >= max_size) { - *nextp = pos; - return page; -@@ -181,7 +182,7 @@ static int unmap_memblk(struct snd_emu10k1 *emu, struct snd_emu10k1_memblk *blk) - q = get_emu10k1_memblk(p, mapped_link); - end_page = q->mapped_page; - } else -- end_page = MAX_ALIGN_PAGES; -+ end_page = (emu->address_mode ? MAX_ALIGN_PAGES1 : MAX_ALIGN_PAGES0); - - /* remove links */ - list_del(&blk->mapped_link); -@@ -305,7 +306,7 @@ snd_emu10k1_alloc_pages(struct snd_emu10k1 *emu, struct snd_pcm_substream *subst - if (snd_BUG_ON(!emu)) - return NULL; - if (snd_BUG_ON(runtime->dma_bytes <= 0 || -- runtime->dma_bytes >= MAXPAGES * EMUPAGESIZE)) -+ runtime->dma_bytes >= (emu->address_mode ? MAXPAGES1 : MAXPAGES0) * EMUPAGESIZE)) - return NULL; - hdr = emu->memhdr; - if (snd_BUG_ON(!hdr)) -diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c -index 83a0f9b4452b..68261a778ee5 100644 ---- a/sound/pci/hda/hda_codec.c -+++ b/sound/pci/hda/hda_codec.c -@@ -2078,6 +2078,16 @@ int snd_hda_codec_amp_init_stereo(struct hda_codec *codec, hda_nid_t nid, - } - EXPORT_SYMBOL_HDA(snd_hda_codec_amp_init_stereo); - -+/* meta hook to call each driver's vmaster hook */ -+static void vmaster_hook(void *private_data, int enabled) -+{ -+ struct hda_vmaster_mute_hook *hook = private_data; -+ -+ if (hook->mute_mode != HDA_VMUTE_FOLLOW_MASTER) -+ enabled = hook->mute_mode; -+ hook->hook(hook->codec, enabled); -+} -+ - /** - * snd_hda_codec_resume_amp - Resume all AMP commands from the cache - * @codec: HD-audio codec -@@ -2772,9 +2782,9 @@ int snd_hda_add_vmaster_hook(struct hda_codec *codec, - - if (!hook->hook || !hook->sw_kctl) - return 0; -- snd_ctl_add_vmaster_hook(hook->sw_kctl, hook->hook, codec); - hook->codec = codec; - hook->mute_mode = HDA_VMUTE_FOLLOW_MASTER; -+ snd_ctl_add_vmaster_hook(hook->sw_kctl, vmaster_hook, hook); - if (!expose_enum_ctl) - return 0; - kctl = snd_ctl_new1(&vmaster_mute_mode, hook); -@@ -2797,14 +2807,7 @@ void snd_hda_sync_vmaster_hook(struct hda_vmaster_mute_hook *hook) - */ - if (hook->codec->bus->shutdown) - return; -- switch (hook->mute_mode) { -- case HDA_VMUTE_FOLLOW_MASTER: -- snd_ctl_sync_vmaster_hook(hook->sw_kctl); -- break; -- default: -- hook->hook(hook->codec, hook->mute_mode); -- break; -- } -+ snd_ctl_sync_vmaster_hook(hook->sw_kctl); - } - EXPORT_SYMBOL_HDA(snd_hda_sync_vmaster_hook); - -diff --git a/sound/synth/emux/emux_oss.c b/sound/synth/emux/emux_oss.c -index 319754cf6208..daf61abc3670 100644 ---- a/sound/synth/emux/emux_oss.c -+++ b/sound/synth/emux/emux_oss.c -@@ -118,12 +118,8 @@ snd_emux_open_seq_oss(struct snd_seq_oss_arg *arg, void *closure) - if (snd_BUG_ON(!arg || !emu)) - return -ENXIO; - -- mutex_lock(&emu->register_mutex); -- -- if (!snd_emux_inc_count(emu)) { -- mutex_unlock(&emu->register_mutex); -+ if (!snd_emux_inc_count(emu)) - return -EFAULT; -- } - - memset(&callback, 0, sizeof(callback)); - callback.owner = THIS_MODULE; -@@ -135,7 +131,6 @@ snd_emux_open_seq_oss(struct snd_seq_oss_arg *arg, void *closure) - if (p == NULL) { - snd_printk(KERN_ERR "can't create port\n"); - snd_emux_dec_count(emu); -- mutex_unlock(&emu->register_mutex); - return -ENOMEM; - } - -@@ -148,8 +143,6 @@ snd_emux_open_seq_oss(struct snd_seq_oss_arg *arg, void *closure) - reset_port_mode(p, arg->seq_mode); - - snd_emux_reset_port(p); -- -- mutex_unlock(&emu->register_mutex); - return 0; - } - -@@ -195,13 +188,11 @@ snd_emux_close_seq_oss(struct snd_seq_oss_arg *arg) - if (snd_BUG_ON(!emu)) - return -ENXIO; - -- mutex_lock(&emu->register_mutex); - snd_emux_sounds_off_all(p); - snd_soundfont_close_check(emu->sflist, SF_CLIENT_NO(p->chset.port)); - snd_seq_event_port_detach(p->chset.client, p->chset.port); - snd_emux_dec_count(emu); - -- mutex_unlock(&emu->register_mutex); - return 0; - } - -diff --git a/sound/synth/emux/emux_seq.c b/sound/synth/emux/emux_seq.c -index 7778b8e19782..a0209204ae48 100644 ---- a/sound/synth/emux/emux_seq.c -+++ b/sound/synth/emux/emux_seq.c -@@ -124,12 +124,10 @@ snd_emux_detach_seq(struct snd_emux *emu) - if (emu->voices) - snd_emux_terminate_all(emu); - -- mutex_lock(&emu->register_mutex); - if (emu->client >= 0) { - snd_seq_delete_kernel_client(emu->client); - emu->client = -1; - } -- mutex_unlock(&emu->register_mutex); - } - - -@@ -269,8 +267,8 @@ snd_emux_event_input(struct snd_seq_event *ev, int direct, void *private_data, - /* - * increment usage count - */ --int --snd_emux_inc_count(struct snd_emux *emu) -+static int -+__snd_emux_inc_count(struct snd_emux *emu) - { - emu->used++; - if (!try_module_get(emu->ops.owner)) -@@ -284,12 +282,21 @@ snd_emux_inc_count(struct snd_emux *emu) - return 1; - } - -+int snd_emux_inc_count(struct snd_emux *emu) -+{ -+ int ret; -+ -+ mutex_lock(&emu->register_mutex); -+ ret = __snd_emux_inc_count(emu); -+ mutex_unlock(&emu->register_mutex); -+ return ret; -+} - - /* - * decrease usage count - */ --void --snd_emux_dec_count(struct snd_emux *emu) -+static void -+__snd_emux_dec_count(struct snd_emux *emu) - { - module_put(emu->card->module); - emu->used--; -@@ -298,6 +305,12 @@ snd_emux_dec_count(struct snd_emux *emu) - module_put(emu->ops.owner); - } - -+void snd_emux_dec_count(struct snd_emux *emu) -+{ -+ mutex_lock(&emu->register_mutex); -+ __snd_emux_dec_count(emu); -+ mutex_unlock(&emu->register_mutex); -+} - - /* - * Routine that is called upon a first use of a particular port -@@ -317,7 +330,7 @@ snd_emux_use(void *private_data, struct snd_seq_port_subscribe *info) - - mutex_lock(&emu->register_mutex); - snd_emux_init_port(p); -- snd_emux_inc_count(emu); -+ __snd_emux_inc_count(emu); - mutex_unlock(&emu->register_mutex); - return 0; - } -@@ -340,7 +353,7 @@ snd_emux_unuse(void *private_data, struct snd_seq_port_subscribe *info) - - mutex_lock(&emu->register_mutex); - snd_emux_sounds_off_all(p); -- snd_emux_dec_count(emu); -+ __snd_emux_dec_count(emu); - mutex_unlock(&emu->register_mutex); - return 0; - } diff --git a/patch/kernel/marvell-default/1-patch-3.10.78-79.patch b/patch/kernel/marvell-default/1-patch-3.10.78-79.patch deleted file mode 100644 index 7e07569ee6..0000000000 --- a/patch/kernel/marvell-default/1-patch-3.10.78-79.patch +++ /dev/null @@ -1,728 +0,0 @@ -diff --git a/Documentation/devicetree/bindings/dma/fsl-mxs-dma.txt b/Documentation/devicetree/bindings/dma/fsl-mxs-dma.txt -index a4873e5e3e36..e30e184f50c7 100644 ---- a/Documentation/devicetree/bindings/dma/fsl-mxs-dma.txt -+++ b/Documentation/devicetree/bindings/dma/fsl-mxs-dma.txt -@@ -38,7 +38,7 @@ dma_apbx: dma-apbx@80024000 { - 80 81 68 69 - 70 71 72 73 - 74 75 76 77>; -- interrupt-names = "auart4-rx", "aurat4-tx", "spdif-tx", "empty", -+ interrupt-names = "auart4-rx", "auart4-tx", "spdif-tx", "empty", - "saif0", "saif1", "i2c0", "i2c1", - "auart0-rx", "auart0-tx", "auart1-rx", "auart1-tx", - "auart2-rx", "auart2-tx", "auart3-rx", "auart3-tx"; -diff --git a/Makefile b/Makefile -index cf99a9b53c6f..e26cb1e56266 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,6 +1,6 @@ - VERSION = 3 - PATCHLEVEL = 10 --SUBLEVEL = 78 -+SUBLEVEL = 79 - EXTRAVERSION = - NAME = TOSSUG Baby Fish - -diff --git a/arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts b/arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts -index 9746d0e7fcb4..5dfb3d354470 100644 ---- a/arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts -+++ b/arch/arm/boot/dts/armada-xp-openblocks-ax3-4.dts -@@ -32,6 +32,10 @@ - 0xf0000000 0 0xf0000000 0x8000000 /* Device Bus, NOR 128MiB */>; - - internal-regs { -+ rtc@10300 { -+ /* No crystal connected to the internal RTC */ -+ status = "disabled"; -+ }; - serial@12000 { - clock-frequency = <250000000>; - status = "okay"; -diff --git a/arch/arm/boot/dts/imx23-olinuxino.dts b/arch/arm/boot/dts/imx23-olinuxino.dts -index d107c4af321f..6fef54416cbf 100644 ---- a/arch/arm/boot/dts/imx23-olinuxino.dts -+++ b/arch/arm/boot/dts/imx23-olinuxino.dts -@@ -89,6 +89,7 @@ - - ahb@80080000 { - usb0: usb@80080000 { -+ dr_mode = "host"; - vbus-supply = <®_usb0_vbus>; - status = "okay"; - }; -diff --git a/arch/arm/boot/dts/imx25.dtsi b/arch/arm/boot/dts/imx25.dtsi -index 97d1a550eb98..2a571bcacaf4 100644 ---- a/arch/arm/boot/dts/imx25.dtsi -+++ b/arch/arm/boot/dts/imx25.dtsi -@@ -393,6 +393,7 @@ - - pwm4: pwm@53fc8000 { - compatible = "fsl,imx25-pwm", "fsl,imx27-pwm"; -+ #pwm-cells = <2>; - reg = <0x53fc8000 0x4000>; - clocks = <&clks 108>, <&clks 52>; - clock-names = "ipg", "per"; -diff --git a/arch/arm/boot/dts/imx28.dtsi b/arch/arm/boot/dts/imx28.dtsi -index 4c10a1968c0e..2e76b84c6bad 100644 ---- a/arch/arm/boot/dts/imx28.dtsi -+++ b/arch/arm/boot/dts/imx28.dtsi -@@ -691,7 +691,7 @@ - 80 81 68 69 - 70 71 72 73 - 74 75 76 77>; -- interrupt-names = "auart4-rx", "aurat4-tx", "spdif-tx", "empty", -+ interrupt-names = "auart4-rx", "auart4-tx", "spdif-tx", "empty", - "saif0", "saif1", "i2c0", "i2c1", - "auart0-rx", "auart0-tx", "auart1-rx", "auart1-tx", - "auart2-rx", "auart2-tx", "auart3-rx", "auart3-tx"; -diff --git a/drivers/acpi/acpica/dsopcode.c b/drivers/acpi/acpica/dsopcode.c -index ee6367b8eaf7..e9b13b92ba1e 100644 ---- a/drivers/acpi/acpica/dsopcode.c -+++ b/drivers/acpi/acpica/dsopcode.c -@@ -539,8 +539,7 @@ acpi_ds_eval_table_region_operands(struct acpi_walk_state *walk_state, - return_ACPI_STATUS(AE_NOT_EXIST); - } - -- obj_desc->region.address = -- (acpi_physical_address) ACPI_TO_INTEGER(table); -+ obj_desc->region.address = ACPI_PTR_TO_PHYSADDR(table); - obj_desc->region.length = table->length; - - ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n", -diff --git a/drivers/acpi/acpica/tbinstal.c b/drivers/acpi/acpica/tbinstal.c -index e57cd38004e3..0d2351596a3c 100644 ---- a/drivers/acpi/acpica/tbinstal.c -+++ b/drivers/acpi/acpica/tbinstal.c -@@ -301,8 +301,7 @@ struct acpi_table_header *acpi_tb_table_override(struct acpi_table_header - ACPI_EXCEPTION((AE_INFO, AE_NO_MEMORY, - "%4.4s %p Attempted physical table override failed", - table_header->signature, -- ACPI_CAST_PTR(void, -- table_desc->address))); -+ ACPI_PHYSADDR_TO_PTR(table_desc->address))); - return (NULL); - } - -@@ -318,7 +317,7 @@ struct acpi_table_header *acpi_tb_table_override(struct acpi_table_header - ACPI_INFO((AE_INFO, - "%4.4s %p %s table override, new table: %p", - table_header->signature, -- ACPI_CAST_PTR(void, table_desc->address), -+ ACPI_PHYSADDR_TO_PTR(table_desc->address), - override_type, new_table)); - - /* We can now unmap/delete the original table (if fully mapped) */ -diff --git a/drivers/acpi/acpica/tbxfroot.c b/drivers/acpi/acpica/tbxfroot.c -index 7c2ecfb7c2c3..e12486031d97 100644 ---- a/drivers/acpi/acpica/tbxfroot.c -+++ b/drivers/acpi/acpica/tbxfroot.c -@@ -118,7 +118,7 @@ static acpi_status acpi_tb_validate_rsdp(struct acpi_table_rsdp *rsdp) - * - ******************************************************************************/ - --acpi_status acpi_find_root_pointer(acpi_size *table_address) -+acpi_status acpi_find_root_pointer(acpi_physical_address * table_address) - { - u8 *table_ptr; - u8 *mem_rover; -@@ -176,7 +176,8 @@ acpi_status acpi_find_root_pointer(acpi_size *table_address) - physical_address += - (u32) ACPI_PTR_DIFF(mem_rover, table_ptr); - -- *table_address = physical_address; -+ *table_address = -+ (acpi_physical_address) physical_address; - return_ACPI_STATUS(AE_OK); - } - } -@@ -209,7 +210,7 @@ acpi_status acpi_find_root_pointer(acpi_size *table_address) - (ACPI_HI_RSDP_WINDOW_BASE + - ACPI_PTR_DIFF(mem_rover, table_ptr)); - -- *table_address = physical_address; -+ *table_address = (acpi_physical_address) physical_address; - return_ACPI_STATUS(AE_OK); - } - -diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c -index ca1cb2d756c2..c3768fafff45 100644 ---- a/drivers/gpio/gpiolib.c -+++ b/drivers/gpio/gpiolib.c -@@ -752,6 +752,7 @@ static struct class gpio_class = { - */ - static int gpiod_export(struct gpio_desc *desc, bool direction_may_change) - { -+ struct gpio_chip *chip; - unsigned long flags; - int status; - const char *ioname = NULL; -@@ -769,8 +770,16 @@ static int gpiod_export(struct gpio_desc *desc, bool direction_may_change) - return -EINVAL; - } - -+ chip = desc->chip; -+ - mutex_lock(&sysfs_lock); - -+ /* check if chip is being removed */ -+ if (!chip || !chip->exported) { -+ status = -ENODEV; -+ goto fail_unlock; -+ } -+ - spin_lock_irqsave(&gpio_lock, flags); - if (!test_bit(FLAG_REQUESTED, &desc->flags) || - test_bit(FLAG_EXPORT, &desc->flags)) { -@@ -1040,6 +1049,8 @@ static void gpiochip_unexport(struct gpio_chip *chip) - { - int status; - struct device *dev; -+ struct gpio_desc *desc; -+ unsigned int i; - - mutex_lock(&sysfs_lock); - dev = class_find_device(&gpio_class, NULL, chip, match_export); -@@ -1047,6 +1058,7 @@ static void gpiochip_unexport(struct gpio_chip *chip) - sysfs_remove_group(&dev->kobj, &gpiochip_attr_group); - put_device(dev); - device_unregister(dev); -+ /* prevent further gpiod exports */ - chip->exported = 0; - status = 0; - } else -@@ -1056,6 +1068,13 @@ static void gpiochip_unexport(struct gpio_chip *chip) - if (status) - pr_debug("%s: chip %s status %d\n", __func__, - chip->label, status); -+ -+ /* unregister gpiod class devices owned by sysfs */ -+ for (i = 0; i < chip->ngpio; i++) { -+ desc = &chip->desc[i]; -+ if (test_and_clear_bit(FLAG_SYSFS, &desc->flags)) -+ gpiod_free(desc); -+ } - } - - static int __init gpiolib_sysfs_init(void) -@@ -1265,6 +1284,8 @@ int gpiochip_remove(struct gpio_chip *chip) - int status = 0; - unsigned id; - -+ gpiochip_unexport(chip); -+ - spin_lock_irqsave(&gpio_lock, flags); - - gpiochip_remove_pin_ranges(chip); -@@ -1285,9 +1306,6 @@ int gpiochip_remove(struct gpio_chip *chip) - - spin_unlock_irqrestore(&gpio_lock, flags); - -- if (status == 0) -- gpiochip_unexport(chip); -- - return status; - } - EXPORT_SYMBOL_GPL(gpiochip_remove); -diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c -index f5d1dc5b5563..54ebfbe370c6 100644 ---- a/drivers/gpu/drm/i915/intel_lvds.c -+++ b/drivers/gpu/drm/i915/intel_lvds.c -@@ -1007,12 +1007,28 @@ static int intel_dual_link_lvds_callback(const struct dmi_system_id *id) - static const struct dmi_system_id intel_dual_link_lvds[] = { - { - .callback = intel_dual_link_lvds_callback, -- .ident = "Apple MacBook Pro (Core i5/i7 Series)", -+ .ident = "Apple MacBook Pro 15\" (2010)", -+ .matches = { -+ DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."), -+ DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro6,2"), -+ }, -+ }, -+ { -+ .callback = intel_dual_link_lvds_callback, -+ .ident = "Apple MacBook Pro 15\" (2011)", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."), - DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro8,2"), - }, - }, -+ { -+ .callback = intel_dual_link_lvds_callback, -+ .ident = "Apple MacBook Pro 15\" (2012)", -+ .matches = { -+ DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."), -+ DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro9,1"), -+ }, -+ }, - { } /* terminating entry */ - }; - -diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c -index 7ad66823d022..56998eca1a8d 100644 ---- a/drivers/mmc/card/block.c -+++ b/drivers/mmc/card/block.c -@@ -908,6 +908,18 @@ static inline void mmc_blk_reset_success(struct mmc_blk_data *md, int type) - md->reset_done &= ~type; - } - -+int mmc_access_rpmb(struct mmc_queue *mq) -+{ -+ struct mmc_blk_data *md = mq->data; -+ /* -+ * If this is a RPMB partition access, return ture -+ */ -+ if (md && md->part_type == EXT_CSD_PART_CONFIG_ACC_RPMB) -+ return true; -+ -+ return false; -+} -+ - static int mmc_blk_issue_discard_rq(struct mmc_queue *mq, struct request *req) - { - struct mmc_blk_data *md = mq->data; -diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c -index 9447a0e970d1..645519fe3acd 100644 ---- a/drivers/mmc/card/queue.c -+++ b/drivers/mmc/card/queue.c -@@ -37,7 +37,7 @@ static int mmc_prep_request(struct request_queue *q, struct request *req) - return BLKPREP_KILL; - } - -- if (mq && mmc_card_removed(mq->card)) -+ if (mq && (mmc_card_removed(mq->card) || mmc_access_rpmb(mq))) - return BLKPREP_KILL; - - req->cmd_flags |= REQ_DONTPREP; -diff --git a/drivers/mmc/card/queue.h b/drivers/mmc/card/queue.h -index 5752d50049a3..99e6521e6169 100644 ---- a/drivers/mmc/card/queue.h -+++ b/drivers/mmc/card/queue.h -@@ -73,4 +73,6 @@ extern void mmc_queue_bounce_post(struct mmc_queue_req *); - extern int mmc_packed_init(struct mmc_queue *, struct mmc_card *); - extern void mmc_packed_clean(struct mmc_queue *); - -+extern int mmc_access_rpmb(struct mmc_queue *); -+ - #endif -diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c -index 9c9fc69a01b3..ea40c5139766 100644 ---- a/drivers/pinctrl/core.c -+++ b/drivers/pinctrl/core.c -@@ -1077,7 +1077,7 @@ void devm_pinctrl_put(struct pinctrl *p) - EXPORT_SYMBOL_GPL(devm_pinctrl_put); - - int pinctrl_register_map(struct pinctrl_map const *maps, unsigned num_maps, -- bool dup, bool locked) -+ bool dup) - { - int i, ret; - struct pinctrl_maps *maps_node; -@@ -1145,11 +1145,9 @@ int pinctrl_register_map(struct pinctrl_map const *maps, unsigned num_maps, - maps_node->maps = maps; - } - -- if (!locked) -- mutex_lock(&pinctrl_maps_mutex); -+ mutex_lock(&pinctrl_maps_mutex); - list_add_tail(&maps_node->node, &pinctrl_maps); -- if (!locked) -- mutex_unlock(&pinctrl_maps_mutex); -+ mutex_unlock(&pinctrl_maps_mutex); - - return 0; - } -@@ -1164,7 +1162,7 @@ int pinctrl_register_map(struct pinctrl_map const *maps, unsigned num_maps, - int pinctrl_register_mappings(struct pinctrl_map const *maps, - unsigned num_maps) - { -- return pinctrl_register_map(maps, num_maps, true, false); -+ return pinctrl_register_map(maps, num_maps, true); - } - - void pinctrl_unregister_map(struct pinctrl_map const *map) -diff --git a/drivers/pinctrl/core.h b/drivers/pinctrl/core.h -index 75476b3d87da..b24ea846c867 100644 ---- a/drivers/pinctrl/core.h -+++ b/drivers/pinctrl/core.h -@@ -183,7 +183,7 @@ static inline struct pin_desc *pin_desc_get(struct pinctrl_dev *pctldev, - } - - int pinctrl_register_map(struct pinctrl_map const *maps, unsigned num_maps, -- bool dup, bool locked); -+ bool dup); - void pinctrl_unregister_map(struct pinctrl_map const *map); - - extern int pinctrl_force_sleep(struct pinctrl_dev *pctldev); -diff --git a/drivers/pinctrl/devicetree.c b/drivers/pinctrl/devicetree.c -index 340fb4e6c600..fd91c4c31f6b 100644 ---- a/drivers/pinctrl/devicetree.c -+++ b/drivers/pinctrl/devicetree.c -@@ -92,7 +92,7 @@ static int dt_remember_or_free_map(struct pinctrl *p, const char *statename, - dt_map->num_maps = num_maps; - list_add_tail(&dt_map->node, &p->dt_maps); - -- return pinctrl_register_map(map, num_maps, false, true); -+ return pinctrl_register_map(map, num_maps, false); - } - - struct pinctrl_dev *of_pinctrl_get(struct device_node *np) -diff --git a/drivers/tty/hvc/hvc_xen.c b/drivers/tty/hvc/hvc_xen.c -index 4fc32c8091e9..ff92155dbc88 100644 ---- a/drivers/tty/hvc/hvc_xen.c -+++ b/drivers/tty/hvc/hvc_xen.c -@@ -299,11 +299,27 @@ static int xen_initial_domain_console_init(void) - return 0; - } - -+static void xen_console_update_evtchn(struct xencons_info *info) -+{ -+ if (xen_hvm_domain()) { -+ uint64_t v; -+ int err; -+ -+ err = hvm_get_parameter(HVM_PARAM_CONSOLE_EVTCHN, &v); -+ if (!err && v) -+ info->evtchn = v; -+ } else -+ info->evtchn = xen_start_info->console.domU.evtchn; -+} -+ - void xen_console_resume(void) - { - struct xencons_info *info = vtermno_to_xencons(HVC_COOKIE); -- if (info != NULL && info->irq) -+ if (info != NULL && info->irq) { -+ if (!xen_initial_domain()) -+ xen_console_update_evtchn(info); - rebind_evtchn_irq(info->evtchn, info->irq); -+ } - } - - static void xencons_disconnect_backend(struct xencons_info *info) -diff --git a/fs/nilfs2/btree.c b/fs/nilfs2/btree.c -index ecdbae19a766..090d8ce25bd1 100644 ---- a/fs/nilfs2/btree.c -+++ b/fs/nilfs2/btree.c -@@ -388,7 +388,7 @@ static int nilfs_btree_root_broken(const struct nilfs_btree_node *node, - nchildren = nilfs_btree_node_get_nchildren(node); - - if (unlikely(level < NILFS_BTREE_LEVEL_NODE_MIN || -- level > NILFS_BTREE_LEVEL_MAX || -+ level >= NILFS_BTREE_LEVEL_MAX || - nchildren < 0 || - nchildren > NILFS_BTREE_ROOT_NCHILDREN_MAX)) { - pr_crit("NILFS: bad btree root (inode number=%lu): level = %d, flags = 0x%x, nchildren = %d\n", -diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c -index 2b941113e423..2c119d5d04c9 100644 ---- a/fs/ocfs2/dlm/dlmmaster.c -+++ b/fs/ocfs2/dlm/dlmmaster.c -@@ -729,6 +729,19 @@ lookup: - if (tmpres) { - spin_unlock(&dlm->spinlock); - spin_lock(&tmpres->spinlock); -+ -+ /* -+ * Right after dlm spinlock was released, dlm_thread could have -+ * purged the lockres. Check if lockres got unhashed. If so -+ * start over. -+ */ -+ if (hlist_unhashed(&tmpres->hash_node)) { -+ spin_unlock(&tmpres->spinlock); -+ dlm_lockres_put(tmpres); -+ tmpres = NULL; -+ goto lookup; -+ } -+ - /* Wait on the thread that is mastering the resource */ - if (tmpres->owner == DLM_LOCK_RES_OWNER_UNKNOWN) { - __dlm_wait_on_lockres(tmpres); -diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h -index 454881e6450a..fcabb1597d5b 100644 ---- a/include/acpi/acpixf.h -+++ b/include/acpi/acpixf.h -@@ -177,7 +177,7 @@ acpi_status acpi_load_tables(void); - */ - acpi_status acpi_reallocate_root_table(void); - --acpi_status acpi_find_root_pointer(acpi_size *rsdp_address); -+acpi_status acpi_find_root_pointer(acpi_physical_address *rsdp_address); - - acpi_status acpi_unload_table_id(acpi_owner_id id); - -diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h -index 6de0f2c14ec0..f05efb1160fb 100644 ---- a/include/linux/interrupt.h -+++ b/include/linux/interrupt.h -@@ -11,8 +11,6 @@ - #include - #include - #include --#include --#include - #include - #include - #include -@@ -488,15 +486,6 @@ extern void __raise_softirq_irqoff(unsigned int nr); - extern void raise_softirq_irqoff(unsigned int nr); - extern void raise_softirq(unsigned int nr); - --/* This is the worklist that queues up per-cpu softirq work. -- * -- * send_remote_sendirq() adds work to these lists, and -- * the softirq handler itself dequeues from them. The queues -- * are protected by disabling local cpu interrupts and they must -- * only be accessed by the local cpu that they are for. -- */ --DECLARE_PER_CPU(struct list_head [NR_SOFTIRQS], softirq_work_list); -- - DECLARE_PER_CPU(struct task_struct *, ksoftirqd); - - static inline struct task_struct *this_cpu_ksoftirqd(void) -@@ -504,17 +493,6 @@ static inline struct task_struct *this_cpu_ksoftirqd(void) - return this_cpu_read(ksoftirqd); - } - --/* Try to send a softirq to a remote cpu. If this cannot be done, the -- * work will be queued to the local cpu. -- */ --extern void send_remote_softirq(struct call_single_data *cp, int cpu, int softirq); -- --/* Like send_remote_softirq(), but the caller must disable local cpu interrupts -- * and compute the current cpu, passed in as 'this_cpu'. -- */ --extern void __send_remote_softirq(struct call_single_data *cp, int cpu, -- int this_cpu, int softirq); -- - /* Tasklets --- multithreaded analogue of BHs. - - Main feature differing them of generic softirqs: tasklet -diff --git a/include/linux/nilfs2_fs.h b/include/linux/nilfs2_fs.h -index 98755767c7b0..1108acaacfc6 100644 ---- a/include/linux/nilfs2_fs.h -+++ b/include/linux/nilfs2_fs.h -@@ -458,7 +458,7 @@ struct nilfs_btree_node { - /* level */ - #define NILFS_BTREE_LEVEL_DATA 0 - #define NILFS_BTREE_LEVEL_NODE_MIN (NILFS_BTREE_LEVEL_DATA + 1) --#define NILFS_BTREE_LEVEL_MAX 14 -+#define NILFS_BTREE_LEVEL_MAX 14 /* Max level (exclusive) */ - - /** - * struct nilfs_palloc_group_desc - block group descriptor -diff --git a/kernel/softirq.c b/kernel/softirq.c -index 21956f00cb51..b538df367de3 100644 ---- a/kernel/softirq.c -+++ b/kernel/softirq.c -@@ -6,8 +6,6 @@ - * Distribute under GPLv2. - * - * Rewritten. Old one was good in 2.2, but in 2.3 it was immoral. --ANK (990903) -- * -- * Remote softirq infrastructure is by Jens Axboe. - */ - - #include -@@ -620,146 +618,17 @@ void tasklet_hrtimer_init(struct tasklet_hrtimer *ttimer, - } - EXPORT_SYMBOL_GPL(tasklet_hrtimer_init); - --/* -- * Remote softirq bits -- */ -- --DEFINE_PER_CPU(struct list_head [NR_SOFTIRQS], softirq_work_list); --EXPORT_PER_CPU_SYMBOL(softirq_work_list); -- --static void __local_trigger(struct call_single_data *cp, int softirq) --{ -- struct list_head *head = &__get_cpu_var(softirq_work_list[softirq]); -- -- list_add_tail(&cp->list, head); -- -- /* Trigger the softirq only if the list was previously empty. */ -- if (head->next == &cp->list) -- raise_softirq_irqoff(softirq); --} -- --#ifdef CONFIG_USE_GENERIC_SMP_HELPERS --static void remote_softirq_receive(void *data) --{ -- struct call_single_data *cp = data; -- unsigned long flags; -- int softirq; -- -- softirq = *(int *)cp->info; -- local_irq_save(flags); -- __local_trigger(cp, softirq); -- local_irq_restore(flags); --} -- --static int __try_remote_softirq(struct call_single_data *cp, int cpu, int softirq) --{ -- if (cpu_online(cpu)) { -- cp->func = remote_softirq_receive; -- cp->info = &softirq; -- cp->flags = 0; -- -- __smp_call_function_single(cpu, cp, 0); -- return 0; -- } -- return 1; --} --#else /* CONFIG_USE_GENERIC_SMP_HELPERS */ --static int __try_remote_softirq(struct call_single_data *cp, int cpu, int softirq) --{ -- return 1; --} --#endif -- --/** -- * __send_remote_softirq - try to schedule softirq work on a remote cpu -- * @cp: private SMP call function data area -- * @cpu: the remote cpu -- * @this_cpu: the currently executing cpu -- * @softirq: the softirq for the work -- * -- * Attempt to schedule softirq work on a remote cpu. If this cannot be -- * done, the work is instead queued up on the local cpu. -- * -- * Interrupts must be disabled. -- */ --void __send_remote_softirq(struct call_single_data *cp, int cpu, int this_cpu, int softirq) --{ -- if (cpu == this_cpu || __try_remote_softirq(cp, cpu, softirq)) -- __local_trigger(cp, softirq); --} --EXPORT_SYMBOL(__send_remote_softirq); -- --/** -- * send_remote_softirq - try to schedule softirq work on a remote cpu -- * @cp: private SMP call function data area -- * @cpu: the remote cpu -- * @softirq: the softirq for the work -- * -- * Like __send_remote_softirq except that disabling interrupts and -- * computing the current cpu is done for the caller. -- */ --void send_remote_softirq(struct call_single_data *cp, int cpu, int softirq) --{ -- unsigned long flags; -- int this_cpu; -- -- local_irq_save(flags); -- this_cpu = smp_processor_id(); -- __send_remote_softirq(cp, cpu, this_cpu, softirq); -- local_irq_restore(flags); --} --EXPORT_SYMBOL(send_remote_softirq); -- --static int __cpuinit remote_softirq_cpu_notify(struct notifier_block *self, -- unsigned long action, void *hcpu) --{ -- /* -- * If a CPU goes away, splice its entries to the current CPU -- * and trigger a run of the softirq -- */ -- if (action == CPU_DEAD || action == CPU_DEAD_FROZEN) { -- int cpu = (unsigned long) hcpu; -- int i; -- -- local_irq_disable(); -- for (i = 0; i < NR_SOFTIRQS; i++) { -- struct list_head *head = &per_cpu(softirq_work_list[i], cpu); -- struct list_head *local_head; -- -- if (list_empty(head)) -- continue; -- -- local_head = &__get_cpu_var(softirq_work_list[i]); -- list_splice_init(head, local_head); -- raise_softirq_irqoff(i); -- } -- local_irq_enable(); -- } -- -- return NOTIFY_OK; --} -- --static struct notifier_block __cpuinitdata remote_softirq_cpu_notifier = { -- .notifier_call = remote_softirq_cpu_notify, --}; -- - void __init softirq_init(void) - { - int cpu; - - for_each_possible_cpu(cpu) { -- int i; -- - per_cpu(tasklet_vec, cpu).tail = - &per_cpu(tasklet_vec, cpu).head; - per_cpu(tasklet_hi_vec, cpu).tail = - &per_cpu(tasklet_hi_vec, cpu).head; -- for (i = 0; i < NR_SOFTIRQS; i++) -- INIT_LIST_HEAD(&per_cpu(softirq_work_list[i], cpu)); - } - -- register_hotcpu_notifier(&remote_softirq_cpu_notifier); -- - open_softirq(TASKLET_SOFTIRQ, tasklet_action); - open_softirq(HI_SOFTIRQ, tasklet_hi_action); - } -diff --git a/mm/memory-failure.c b/mm/memory-failure.c -index 603f1fa1b7a3..ca96f411b034 100644 ---- a/mm/memory-failure.c -+++ b/mm/memory-failure.c -@@ -1117,10 +1117,10 @@ int memory_failure(unsigned long pfn, int trapno, int flags) - * The check (unnecessarily) ignores LRU pages being isolated and - * walked by the page reclaim code, however that's not a big loss. - */ -- if (!PageHuge(p) && !PageTransTail(p)) { -- if (!PageLRU(p)) -- shake_page(p, 0); -- if (!PageLRU(p)) { -+ if (!PageHuge(p)) { -+ if (!PageLRU(hpage)) -+ shake_page(hpage, 0); -+ if (!PageLRU(hpage)) { - /* - * shake_page could have turned it free. - */ -diff --git a/sound/oss/sequencer.c b/sound/oss/sequencer.c -index 4ff60a6427d9..2e67dd590be5 100644 ---- a/sound/oss/sequencer.c -+++ b/sound/oss/sequencer.c -@@ -683,13 +683,8 @@ static int seq_timing_event(unsigned char *event_rec) - break; - - case TMR_ECHO: -- if (seq_mode == SEQ_2) -- seq_copy_to_input(event_rec, 8); -- else -- { -- parm = (parm << 8 | SEQ_ECHO); -- seq_copy_to_input((unsigned char *) &parm, 4); -- } -+ parm = (parm << 8 | SEQ_ECHO); -+ seq_copy_to_input((unsigned char *) &parm, 4); - break; - - default:; -@@ -1332,7 +1327,6 @@ int sequencer_ioctl(int dev, struct file *file, unsigned int cmd, void __user *a - int mode = translate_mode(file); - struct synth_info inf; - struct seq_event_rec event_rec; -- unsigned long flags; - int __user *p = arg; - - orig_dev = dev = dev >> 4; -@@ -1487,9 +1481,7 @@ int sequencer_ioctl(int dev, struct file *file, unsigned int cmd, void __user *a - case SNDCTL_SEQ_OUTOFBAND: - if (copy_from_user(&event_rec, arg, sizeof(event_rec))) - return -EFAULT; -- spin_lock_irqsave(&lock,flags); - play_event(event_rec.arr); -- spin_unlock_irqrestore(&lock,flags); - return 0; - - case SNDCTL_MIDI_INFO: diff --git a/patch/kernel/marvell-default/1-patch-3.10.79-80.patch b/patch/kernel/marvell-default/1-patch-3.10.79-80.patch deleted file mode 100644 index 737e5c474e..0000000000 --- a/patch/kernel/marvell-default/1-patch-3.10.79-80.patch +++ /dev/null @@ -1,1148 +0,0 @@ -diff --git a/Makefile b/Makefile -index e26cb1e56266..067433219984 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,6 +1,6 @@ - VERSION = 3 - PATCHLEVEL = 10 --SUBLEVEL = 79 -+SUBLEVEL = 80 - EXTRAVERSION = - NAME = TOSSUG Baby Fish - -@@ -241,7 +241,7 @@ CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \ - - HOSTCC = gcc - HOSTCXX = g++ --HOSTCFLAGS = -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -+HOSTCFLAGS = -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89 - HOSTCXXFLAGS = -O2 - - # Decide whether to build built-in, modular, or both. -@@ -373,7 +373,9 @@ KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ - -fno-strict-aliasing -fno-common \ - -Werror-implicit-function-declaration \ - -Wno-format-security \ -- -fno-delete-null-pointer-checks -+ -fno-delete-null-pointer-checks \ -+ -std=gnu89 -+ - KBUILD_AFLAGS_KERNEL := - KBUILD_CFLAGS_KERNEL := - KBUILD_AFLAGS := -D__ASSEMBLY__ -diff --git a/arch/arm/boot/dts/imx27.dtsi b/arch/arm/boot/dts/imx27.dtsi -index 75bd11386516..77730a37344e 100644 ---- a/arch/arm/boot/dts/imx27.dtsi -+++ b/arch/arm/boot/dts/imx27.dtsi -@@ -290,7 +290,7 @@ - - fec: ethernet@1002b000 { - compatible = "fsl,imx27-fec"; -- reg = <0x1002b000 0x4000>; -+ reg = <0x1002b000 0x1000>; - interrupts = <50>; - clocks = <&clks 48>, <&clks 67>, <&clks 0>; - clock-names = "ipg", "ahb", "ptp"; -diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S -index 4bc816a74a2e..f2646934c714 100644 ---- a/arch/arm/kernel/entry-common.S -+++ b/arch/arm/kernel/entry-common.S -@@ -32,7 +32,9 @@ ret_fast_syscall: - UNWIND(.fnstart ) - UNWIND(.cantunwind ) - disable_irq @ disable interrupts -- ldr r1, [tsk, #TI_FLAGS] -+ ldr r1, [tsk, #TI_FLAGS] @ re-check for syscall tracing -+ tst r1, #_TIF_SYSCALL_WORK -+ bne __sys_trace_return - tst r1, #_TIF_WORK_MASK - bne fast_work_pending - asm_trace_hardirqs_on -diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S -index f096e72262f4..1db685104ffc 100644 ---- a/arch/powerpc/kernel/vmlinux.lds.S -+++ b/arch/powerpc/kernel/vmlinux.lds.S -@@ -213,6 +213,7 @@ SECTIONS - *(.opd) - } - -+ . = ALIGN(256); - .got : AT(ADDR(.got) - LOAD_OFFSET) { - __toc_start = .; - #ifndef CONFIG_RELOCATABLE -diff --git a/arch/s390/crypto/ghash_s390.c b/arch/s390/crypto/ghash_s390.c -index 7940dc90e80b..b258110da952 100644 ---- a/arch/s390/crypto/ghash_s390.c -+++ b/arch/s390/crypto/ghash_s390.c -@@ -16,11 +16,12 @@ - #define GHASH_DIGEST_SIZE 16 - - struct ghash_ctx { -- u8 icv[16]; -- u8 key[16]; -+ u8 key[GHASH_BLOCK_SIZE]; - }; - - struct ghash_desc_ctx { -+ u8 icv[GHASH_BLOCK_SIZE]; -+ u8 key[GHASH_BLOCK_SIZE]; - u8 buffer[GHASH_BLOCK_SIZE]; - u32 bytes; - }; -@@ -28,8 +29,10 @@ struct ghash_desc_ctx { - static int ghash_init(struct shash_desc *desc) - { - struct ghash_desc_ctx *dctx = shash_desc_ctx(desc); -+ struct ghash_ctx *ctx = crypto_shash_ctx(desc->tfm); - - memset(dctx, 0, sizeof(*dctx)); -+ memcpy(dctx->key, ctx->key, GHASH_BLOCK_SIZE); - - return 0; - } -@@ -45,7 +48,6 @@ static int ghash_setkey(struct crypto_shash *tfm, - } - - memcpy(ctx->key, key, GHASH_BLOCK_SIZE); -- memset(ctx->icv, 0, GHASH_BLOCK_SIZE); - - return 0; - } -@@ -54,7 +56,6 @@ static int ghash_update(struct shash_desc *desc, - const u8 *src, unsigned int srclen) - { - struct ghash_desc_ctx *dctx = shash_desc_ctx(desc); -- struct ghash_ctx *ctx = crypto_shash_ctx(desc->tfm); - unsigned int n; - u8 *buf = dctx->buffer; - int ret; -@@ -70,7 +71,7 @@ static int ghash_update(struct shash_desc *desc, - src += n; - - if (!dctx->bytes) { -- ret = crypt_s390_kimd(KIMD_GHASH, ctx, buf, -+ ret = crypt_s390_kimd(KIMD_GHASH, dctx, buf, - GHASH_BLOCK_SIZE); - if (ret != GHASH_BLOCK_SIZE) - return -EIO; -@@ -79,7 +80,7 @@ static int ghash_update(struct shash_desc *desc, - - n = srclen & ~(GHASH_BLOCK_SIZE - 1); - if (n) { -- ret = crypt_s390_kimd(KIMD_GHASH, ctx, src, n); -+ ret = crypt_s390_kimd(KIMD_GHASH, dctx, src, n); - if (ret != n) - return -EIO; - src += n; -@@ -94,7 +95,7 @@ static int ghash_update(struct shash_desc *desc, - return 0; - } - --static int ghash_flush(struct ghash_ctx *ctx, struct ghash_desc_ctx *dctx) -+static int ghash_flush(struct ghash_desc_ctx *dctx) - { - u8 *buf = dctx->buffer; - int ret; -@@ -104,24 +105,24 @@ static int ghash_flush(struct ghash_ctx *ctx, struct ghash_desc_ctx *dctx) - - memset(pos, 0, dctx->bytes); - -- ret = crypt_s390_kimd(KIMD_GHASH, ctx, buf, GHASH_BLOCK_SIZE); -+ ret = crypt_s390_kimd(KIMD_GHASH, dctx, buf, GHASH_BLOCK_SIZE); - if (ret != GHASH_BLOCK_SIZE) - return -EIO; -+ -+ dctx->bytes = 0; - } - -- dctx->bytes = 0; - return 0; - } - - static int ghash_final(struct shash_desc *desc, u8 *dst) - { - struct ghash_desc_ctx *dctx = shash_desc_ctx(desc); -- struct ghash_ctx *ctx = crypto_shash_ctx(desc->tfm); - int ret; - -- ret = ghash_flush(ctx, dctx); -+ ret = ghash_flush(dctx); - if (!ret) -- memcpy(dst, ctx->icv, GHASH_BLOCK_SIZE); -+ memcpy(dst, dctx->icv, GHASH_BLOCK_SIZE); - return ret; - } - -diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c -index e14b1f8667bb..5a75ebf3d69f 100644 ---- a/arch/x86/kvm/mmu.c -+++ b/arch/x86/kvm/mmu.c -@@ -3975,7 +3975,7 @@ void kvm_mmu_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa, - ++vcpu->kvm->stat.mmu_pte_write; - kvm_mmu_audit(vcpu, AUDIT_PRE_PTE_WRITE); - -- mask.cr0_wp = mask.cr4_pae = mask.nxe = 1; -+ mask.cr0_wp = mask.cr4_pae = mask.nxe = mask.smep_andnot_wp = 1; - for_each_gfn_indirect_valid_sp(vcpu->kvm, sp, gfn) { - if (detect_write_misaligned(sp, gpa, bytes) || - detect_write_flooding(sp)) { -diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c -index e72186340fec..11441ad69de3 100644 ---- a/drivers/acpi/osl.c -+++ b/drivers/acpi/osl.c -@@ -173,7 +173,7 @@ static void __init acpi_request_region (struct acpi_generic_address *gas, - request_mem_region(addr, length, desc); - } - --static int __init acpi_reserve_resources(void) -+static void __init acpi_reserve_resources(void) - { - acpi_request_region(&acpi_gbl_FADT.xpm1a_event_block, acpi_gbl_FADT.pm1_event_length, - "ACPI PM1a_EVT_BLK"); -@@ -202,10 +202,7 @@ static int __init acpi_reserve_resources(void) - if (!(acpi_gbl_FADT.gpe1_block_length & 0x1)) - acpi_request_region(&acpi_gbl_FADT.xgpe1_block, - acpi_gbl_FADT.gpe1_block_length, "ACPI GPE1_BLK"); -- -- return 0; - } --device_initcall(acpi_reserve_resources); - - void acpi_os_printf(const char *fmt, ...) - { -@@ -1727,6 +1724,7 @@ acpi_status __init acpi_os_initialize(void) - - acpi_status __init acpi_os_initialize1(void) - { -+ acpi_reserve_resources(); - kacpid_wq = alloc_workqueue("kacpid", 0, 1); - kacpi_notify_wq = alloc_workqueue("kacpi_notify", 0, 1); - kacpi_hotplug_wq = alloc_workqueue("kacpi_hotplug", 0, 1); -diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c -index 8905e03a53a2..cf5f35877559 100644 ---- a/drivers/ata/libahci.c -+++ b/drivers/ata/libahci.c -@@ -1684,8 +1684,7 @@ static void ahci_handle_port_interrupt(struct ata_port *ap, - if (unlikely(resetting)) - status &= ~PORT_IRQ_BAD_PMP; - -- /* if LPM is enabled, PHYRDY doesn't mean anything */ -- if (ap->link.lpm_policy > ATA_LPM_MAX_POWER) { -+ if (sata_lpm_ignore_phy_events(&ap->link)) { - status &= ~PORT_IRQ_PHYRDY; - ahci_scr_write(&ap->link, SCR_ERROR, SERR_PHYRDY_CHG); - } -diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c -index ca7c23d58a03..5d47a040129a 100644 ---- a/drivers/ata/libata-core.c -+++ b/drivers/ata/libata-core.c -@@ -6800,6 +6800,38 @@ u32 ata_wait_register(struct ata_port *ap, void __iomem *reg, u32 mask, u32 val, - return tmp; - } - -+/** -+ * sata_lpm_ignore_phy_events - test if PHY event should be ignored -+ * @link: Link receiving the event -+ * -+ * Test whether the received PHY event has to be ignored or not. -+ * -+ * LOCKING: -+ * None: -+ * -+ * RETURNS: -+ * True if the event has to be ignored. -+ */ -+bool sata_lpm_ignore_phy_events(struct ata_link *link) -+{ -+ unsigned long lpm_timeout = link->last_lpm_change + -+ msecs_to_jiffies(ATA_TMOUT_SPURIOUS_PHY); -+ -+ /* if LPM is enabled, PHYRDY doesn't mean anything */ -+ if (link->lpm_policy > ATA_LPM_MAX_POWER) -+ return true; -+ -+ /* ignore the first PHY event after the LPM policy changed -+ * as it is might be spurious -+ */ -+ if ((link->flags & ATA_LFLAG_CHANGED) && -+ time_before(jiffies, lpm_timeout)) -+ return true; -+ -+ return false; -+} -+EXPORT_SYMBOL_GPL(sata_lpm_ignore_phy_events); -+ - /* - * Dummy port_ops - */ -diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c -index 370462fa8e01..063036d876b0 100644 ---- a/drivers/ata/libata-eh.c -+++ b/drivers/ata/libata-eh.c -@@ -3481,6 +3481,9 @@ static int ata_eh_set_lpm(struct ata_link *link, enum ata_lpm_policy policy, - } - } - -+ link->last_lpm_change = jiffies; -+ link->flags |= ATA_LFLAG_CHANGED; -+ - return 0; - - fail: -diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h -index 47d8b68c5004..0ebe0c3f5074 100644 ---- a/drivers/gpu/drm/i915/i915_drv.h -+++ b/drivers/gpu/drm/i915/i915_drv.h -@@ -1804,7 +1804,7 @@ void i915_teardown_sysfs(struct drm_device *dev_priv); - /* intel_i2c.c */ - extern int intel_setup_gmbus(struct drm_device *dev); - extern void intel_teardown_gmbus(struct drm_device *dev); --extern inline bool intel_gmbus_is_port_valid(unsigned port) -+static inline bool intel_gmbus_is_port_valid(unsigned port) - { - return (port >= GMBUS_PORT_SSC && port <= GMBUS_PORT_DPD); - } -@@ -1813,7 +1813,7 @@ extern struct i2c_adapter *intel_gmbus_get_adapter( - struct drm_i915_private *dev_priv, unsigned port); - extern void intel_gmbus_set_speed(struct i2c_adapter *adapter, int speed); - extern void intel_gmbus_force_bit(struct i2c_adapter *adapter, bool force_bit); --extern inline bool intel_gmbus_is_forced_bit(struct i2c_adapter *adapter) -+static inline bool intel_gmbus_is_forced_bit(struct i2c_adapter *adapter) - { - return container_of(adapter, struct intel_gmbus, adapter)->force_bit; - } -diff --git a/drivers/hwmon/ntc_thermistor.c b/drivers/hwmon/ntc_thermistor.c -index c64d3d497c50..d7bb12ad4945 100644 ---- a/drivers/hwmon/ntc_thermistor.c -+++ b/drivers/hwmon/ntc_thermistor.c -@@ -181,8 +181,10 @@ static struct ntc_thermistor_platform_data * - ntc_thermistor_parse_dt(struct platform_device *pdev) - { - struct iio_channel *chan; -+ enum iio_chan_type type; - struct device_node *np = pdev->dev.of_node; - struct ntc_thermistor_platform_data *pdata; -+ int ret; - - if (!np) - return NULL; -@@ -195,6 +197,13 @@ ntc_thermistor_parse_dt(struct platform_device *pdev) - if (IS_ERR(chan)) - return ERR_CAST(chan); - -+ ret = iio_get_channel_type(chan, &type); -+ if (ret < 0) -+ return ERR_PTR(ret); -+ -+ if (type != IIO_VOLTAGE) -+ return ERR_PTR(-EINVAL); -+ - if (of_property_read_u32(np, "pullup-uv", &pdata->pullup_uv)) - return ERR_PTR(-ENODEV); - if (of_property_read_u32(np, "pullup-ohm", &pdata->pullup_ohm)) -diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c -index 1af7df263368..dbd4f5ad3343 100644 ---- a/drivers/input/mouse/elantech.c -+++ b/drivers/input/mouse/elantech.c -@@ -314,7 +314,7 @@ static void elantech_report_semi_mt_data(struct input_dev *dev, - unsigned int x2, unsigned int y2) - { - elantech_set_slot(dev, 0, num_fingers != 0, x1, y1); -- elantech_set_slot(dev, 1, num_fingers == 2, x2, y2); -+ elantech_set_slot(dev, 1, num_fingers >= 2, x2, y2); - } - - /* -diff --git a/drivers/lguest/core.c b/drivers/lguest/core.c -index 0bf1e4edf04d..19da22249bd8 100644 ---- a/drivers/lguest/core.c -+++ b/drivers/lguest/core.c -@@ -176,7 +176,7 @@ static void unmap_switcher(void) - bool lguest_address_ok(const struct lguest *lg, - unsigned long addr, unsigned long len) - { -- return (addr+len) / PAGE_SIZE < lg->pfn_limit && (addr+len >= addr); -+ return addr+len <= lg->pfn_limit * PAGE_SIZE && (addr+len >= addr); - } - - /* -diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c -index 1b6986ce5da9..ef18ca745b1e 100644 ---- a/drivers/md/raid5.c -+++ b/drivers/md/raid5.c -@@ -1701,7 +1701,8 @@ static int resize_stripes(struct r5conf *conf, int newsize) - - conf->slab_cache = sc; - conf->active_name = 1-conf->active_name; -- conf->pool_size = newsize; -+ if (!err) -+ conf->pool_size = newsize; - return err; - } - -diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c -index 84b054b08462..e742761679fa 100644 ---- a/drivers/mmc/host/atmel-mci.c -+++ b/drivers/mmc/host/atmel-mci.c -@@ -1295,7 +1295,7 @@ static void atmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) - - if (ios->clock) { - unsigned int clock_min = ~0U; -- u32 clkdiv; -+ int clkdiv; - - spin_lock_bh(&host->lock); - if (!host->mode_reg) { -@@ -1320,7 +1320,12 @@ static void atmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) - /* Calculate clock divider */ - if (host->caps.has_odd_clk_div) { - clkdiv = DIV_ROUND_UP(host->bus_hz, clock_min) - 2; -- if (clkdiv > 511) { -+ if (clkdiv < 0) { -+ dev_warn(&mmc->class_dev, -+ "clock %u too fast; using %lu\n", -+ clock_min, host->bus_hz / 2); -+ clkdiv = 0; -+ } else if (clkdiv > 511) { - dev_warn(&mmc->class_dev, - "clock %u too slow; using %lu\n", - clock_min, host->bus_hz / (511 + 2)); -diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c -index 400b8679796a..44b6715ccfb1 100644 ---- a/drivers/net/wireless/rt2x00/rt2800usb.c -+++ b/drivers/net/wireless/rt2x00/rt2800usb.c -@@ -1020,6 +1020,7 @@ static struct usb_device_id rt2800usb_device_table[] = { - { USB_DEVICE(0x07d1, 0x3c16) }, - { USB_DEVICE(0x07d1, 0x3c17) }, - { USB_DEVICE(0x2001, 0x3c1b) }, -+ { USB_DEVICE(0x2001, 0x3c25) }, - /* Draytek */ - { USB_DEVICE(0x07fa, 0x7712) }, - /* DVICO */ -diff --git a/drivers/net/wireless/rtlwifi/usb.c b/drivers/net/wireless/rtlwifi/usb.c -index 57b12a5883a0..3ad79736b255 100644 ---- a/drivers/net/wireless/rtlwifi/usb.c -+++ b/drivers/net/wireless/rtlwifi/usb.c -@@ -119,7 +119,7 @@ static int _usbctrl_vendorreq_sync_read(struct usb_device *udev, u8 request, - - do { - status = usb_control_msg(udev, pipe, request, reqtype, value, -- index, pdata, len, 0); /*max. timeout*/ -+ index, pdata, len, 1000); - if (status < 0) { - /* firmware download is checksumed, don't retry */ - if ((value >= FW_8192C_START_ADDRESS && -diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211.h b/drivers/staging/rtl8187se/ieee80211/ieee80211.h -index 8fc9f588b056..9fdd566e8d4a 100644 ---- a/drivers/staging/rtl8187se/ieee80211/ieee80211.h -+++ b/drivers/staging/rtl8187se/ieee80211/ieee80211.h -@@ -1447,12 +1447,12 @@ extern void ieee80211_sta_ps_send_null_frame(struct ieee80211_device *ieee, shor - - extern const long ieee80211_wlan_frequencies[]; - --extern inline void ieee80211_increment_scans(struct ieee80211_device *ieee) -+static inline void ieee80211_increment_scans(struct ieee80211_device *ieee) - { - ieee->scans++; - } - --extern inline int ieee80211_get_scans(struct ieee80211_device *ieee) -+static inline int ieee80211_get_scans(struct ieee80211_device *ieee) - { - return ieee->scans; - } -diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h -index 3485ef1dfab1..f35948ec5ebf 100644 ---- a/drivers/staging/rtl8192e/rtllib.h -+++ b/drivers/staging/rtl8192e/rtllib.h -@@ -2761,7 +2761,6 @@ extern void rtllib_stop_scan(struct rtllib_device *ieee); - extern bool rtllib_act_scanning(struct rtllib_device *ieee, bool sync_scan); - extern void rtllib_stop_scan_syncro(struct rtllib_device *ieee); - extern void rtllib_start_scan_syncro(struct rtllib_device *ieee, u8 is_mesh); --extern inline struct sk_buff *rtllib_probe_req(struct rtllib_device *ieee); - extern u8 MgntQuery_MgntFrameTxRate(struct rtllib_device *ieee); - extern void rtllib_sta_ps_send_null_frame(struct rtllib_device *ieee, - short pwr); -@@ -2943,12 +2942,12 @@ void rtllib_softmac_scan_syncro(struct rtllib_device *ieee, u8 is_mesh); - - extern const long rtllib_wlan_frequencies[]; - --extern inline void rtllib_increment_scans(struct rtllib_device *ieee) -+static inline void rtllib_increment_scans(struct rtllib_device *ieee) - { - ieee->scans++; - } - --extern inline int rtllib_get_scans(struct rtllib_device *ieee) -+static inline int rtllib_get_scans(struct rtllib_device *ieee) - { - return ieee->scans; - } -diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c -index 4feecec8609c..0e4e83758d6a 100644 ---- a/drivers/staging/rtl8192e/rtllib_softmac.c -+++ b/drivers/staging/rtl8192e/rtllib_softmac.c -@@ -341,7 +341,7 @@ inline void softmac_ps_mgmt_xmit(struct sk_buff *skb, - } - } - --inline struct sk_buff *rtllib_probe_req(struct rtllib_device *ieee) -+static inline struct sk_buff *rtllib_probe_req(struct rtllib_device *ieee) - { - unsigned int len, rate_len; - u8 *tag; -diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211.h b/drivers/staging/rtl8192u/ieee80211/ieee80211.h -index 210898c8e66c..e1339c33888f 100644 ---- a/drivers/staging/rtl8192u/ieee80211/ieee80211.h -+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211.h -@@ -2250,7 +2250,7 @@ static inline void *ieee80211_priv(struct net_device *dev) - return ((struct ieee80211_device *)netdev_priv(dev))->priv; - } - --extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len) -+static inline int ieee80211_is_empty_essid(const char *essid, int essid_len) - { - /* Single white space is for Linksys APs */ - if (essid_len == 1 && essid[0] == ' ') -@@ -2266,7 +2266,7 @@ extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len) - return 1; - } - --extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mode) -+static inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mode) - { - /* - * It is possible for both access points and our device to support -@@ -2292,7 +2292,7 @@ extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mod - return 0; - } - --extern inline int ieee80211_get_hdrlen(u16 fc) -+static inline int ieee80211_get_hdrlen(u16 fc) - { - int hdrlen = IEEE80211_3ADDR_LEN; - -@@ -2578,12 +2578,12 @@ void ieee80211_softmac_scan_syncro(struct ieee80211_device *ieee); - - extern const long ieee80211_wlan_frequencies[]; - --extern inline void ieee80211_increment_scans(struct ieee80211_device *ieee) -+static inline void ieee80211_increment_scans(struct ieee80211_device *ieee) - { - ieee->scans++; - } - --extern inline int ieee80211_get_scans(struct ieee80211_device *ieee) -+static inline int ieee80211_get_scans(struct ieee80211_device *ieee) - { - return ieee->scans; - } -diff --git a/drivers/staging/rtl8712/ieee80211.h b/drivers/staging/rtl8712/ieee80211.h -index da4000e49da6..8269be80437a 100644 ---- a/drivers/staging/rtl8712/ieee80211.h -+++ b/drivers/staging/rtl8712/ieee80211.h -@@ -734,7 +734,7 @@ enum ieee80211_state { - #define IEEE_G (1<<2) - #define IEEE_MODE_MASK (IEEE_A|IEEE_B|IEEE_G) - --extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len) -+static inline int ieee80211_is_empty_essid(const char *essid, int essid_len) - { - /* Single white space is for Linksys APs */ - if (essid_len == 1 && essid[0] == ' ') -@@ -748,7 +748,7 @@ extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len) - return 1; - } - --extern inline int ieee80211_get_hdrlen(u16 fc) -+static inline int ieee80211_get_hdrlen(u16 fc) - { - int hdrlen = 24; - -diff --git a/drivers/staging/wlags49_h2/wl_internal.h b/drivers/staging/wlags49_h2/wl_internal.h -index b23078164149..11b00c39a98c 100644 ---- a/drivers/staging/wlags49_h2/wl_internal.h -+++ b/drivers/staging/wlags49_h2/wl_internal.h -@@ -1014,7 +1014,7 @@ static inline void wl_unlock(struct wl_private *lp, - /* Interrupt enable disable functions */ - /********************************************************************/ - --extern inline void wl_act_int_on(struct wl_private *lp) -+static inline void wl_act_int_on(struct wl_private *lp) - { - /* - * Only do something when the driver is handling -@@ -1026,7 +1026,7 @@ extern inline void wl_act_int_on(struct wl_private *lp) - } - } - --extern inline void wl_act_int_off(struct wl_private *lp) -+static inline void wl_act_int_off(struct wl_private *lp) - { - /* - * Only do something when the driver is handling -diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c -index b1e77ff9a636..244776bec1c7 100644 ---- a/drivers/target/target_core_pscsi.c -+++ b/drivers/target/target_core_pscsi.c -@@ -520,6 +520,7 @@ static int pscsi_configure_device(struct se_device *dev) - " pdv_host_id: %d\n", pdv->pdv_host_id); - return -EINVAL; - } -+ pdv->pdv_lld_host = sh; - } - } else { - if (phv->phv_mode == PHV_VIRTUAL_HOST_ID) { -@@ -602,6 +603,8 @@ static void pscsi_free_device(struct se_device *dev) - if ((phv->phv_mode == PHV_LLD_SCSI_HOST_NO) && - (phv->phv_lld_host != NULL)) - scsi_host_put(phv->phv_lld_host); -+ else if (pdv->pdv_lld_host) -+ scsi_host_put(pdv->pdv_lld_host); - - if ((sd->type == TYPE_DISK) || (sd->type == TYPE_ROM)) - scsi_device_put(sd); -diff --git a/drivers/target/target_core_pscsi.h b/drivers/target/target_core_pscsi.h -index 1bd757dff8ee..820d3052b775 100644 ---- a/drivers/target/target_core_pscsi.h -+++ b/drivers/target/target_core_pscsi.h -@@ -45,6 +45,7 @@ struct pscsi_dev_virt { - int pdv_lun_id; - struct block_device *pdv_bd; - struct scsi_device *pdv_sd; -+ struct Scsi_Host *pdv_lld_host; - } ____cacheline_aligned; - - typedef enum phv_modes { -diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c -index 80e7f75a56c7..3dab424515ef 100644 ---- a/drivers/usb/gadget/configfs.c -+++ b/drivers/usb/gadget/configfs.c -@@ -757,6 +757,7 @@ static void purge_configs_funcs(struct gadget_info *gi) - } - } - c->next_interface_id = 0; -+ memset(c->interface, 0, sizeof(c->interface)); - c->superspeed = 0; - c->highspeed = 0; - c->fullspeed = 0; -diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c -index bc7a886e3c36..30533952b4a3 100644 ---- a/drivers/usb/host/xhci-ring.c -+++ b/drivers/usb/host/xhci-ring.c -@@ -2144,8 +2144,13 @@ static int process_isoc_td(struct xhci_hcd *xhci, struct xhci_td *td, - break; - case COMP_DEV_ERR: - case COMP_STALL: -+ frame->status = -EPROTO; -+ skip_td = true; -+ break; - case COMP_TX_ERR: - frame->status = -EPROTO; -+ if (event_trb != td->last_trb) -+ return 0; - skip_td = true; - break; - case COMP_STOP: -@@ -2762,7 +2767,7 @@ irqreturn_t xhci_irq(struct usb_hcd *hcd) - xhci_halt(xhci); - hw_died: - spin_unlock(&xhci->lock); -- return -ESHUTDOWN; -+ return IRQ_HANDLED; - } - - /* -diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h -index 373d4dada565..ed8de724b285 100644 ---- a/drivers/usb/host/xhci.h -+++ b/drivers/usb/host/xhci.h -@@ -1237,7 +1237,7 @@ union xhci_trb { - * since the command ring is 64-byte aligned. - * It must also be greater than 16. - */ --#define TRBS_PER_SEGMENT 64 -+#define TRBS_PER_SEGMENT 256 - /* Allow two commands + a link TRB, along with any reserved command TRBs */ - #define MAX_RSVD_CMD_TRBS (TRBS_PER_SEGMENT - 3) - #define TRB_SEGMENT_SIZE (TRBS_PER_SEGMENT*16) -diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c -index 79e9ea005c63..691a82105180 100644 ---- a/drivers/usb/serial/cp210x.c -+++ b/drivers/usb/serial/cp210x.c -@@ -127,6 +127,7 @@ static const struct usb_device_id id_table[] = { - { USB_DEVICE(0x10C4, 0x88A5) }, /* Planet Innovation Ingeni ZigBee USB Device */ - { USB_DEVICE(0x10C4, 0x8946) }, /* Ketra N1 Wireless Interface */ - { USB_DEVICE(0x10C4, 0x8977) }, /* CEL MeshWorks DevKit Device */ -+ { USB_DEVICE(0x10C4, 0x8998) }, /* KCF Technologies PRN */ - { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */ - { USB_DEVICE(0x10C4, 0xEA61) }, /* Silicon Labs factory default */ - { USB_DEVICE(0x10C4, 0xEA70) }, /* Silicon Labs factory default */ -diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c -index de3e15d8eb10..33313caed504 100644 ---- a/drivers/usb/serial/pl2303.c -+++ b/drivers/usb/serial/pl2303.c -@@ -63,7 +63,6 @@ static const struct usb_device_id id_table[] = { - { USB_DEVICE(DCU10_VENDOR_ID, DCU10_PRODUCT_ID) }, - { USB_DEVICE(SITECOM_VENDOR_ID, SITECOM_PRODUCT_ID) }, - { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_ID) }, -- { USB_DEVICE(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_ID) }, - { USB_DEVICE(SIEMENS_VENDOR_ID, SIEMENS_PRODUCT_ID_SX1) }, - { USB_DEVICE(SIEMENS_VENDOR_ID, SIEMENS_PRODUCT_ID_X65) }, - { USB_DEVICE(SIEMENS_VENDOR_ID, SIEMENS_PRODUCT_ID_X75) }, -diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h -index 71fd9da1d6e7..e3b7af8adfb7 100644 ---- a/drivers/usb/serial/pl2303.h -+++ b/drivers/usb/serial/pl2303.h -@@ -62,10 +62,6 @@ - #define ALCATEL_VENDOR_ID 0x11f7 - #define ALCATEL_PRODUCT_ID 0x02df - --/* Samsung I330 phone cradle */ --#define SAMSUNG_VENDOR_ID 0x04e8 --#define SAMSUNG_PRODUCT_ID 0x8001 -- - #define SIEMENS_VENDOR_ID 0x11f5 - #define SIEMENS_PRODUCT_ID_SX1 0x0001 - #define SIEMENS_PRODUCT_ID_X65 0x0003 -diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c -index 9910aa2edf4b..727905de0ba4 100644 ---- a/drivers/usb/serial/visor.c -+++ b/drivers/usb/serial/visor.c -@@ -96,7 +96,7 @@ static struct usb_device_id id_table [] = { - .driver_info = (kernel_ulong_t)&palm_os_4_probe }, - { USB_DEVICE(ACER_VENDOR_ID, ACER_S10_ID), - .driver_info = (kernel_ulong_t)&palm_os_4_probe }, -- { USB_DEVICE(SAMSUNG_VENDOR_ID, SAMSUNG_SCH_I330_ID), -+ { USB_DEVICE_INTERFACE_CLASS(SAMSUNG_VENDOR_ID, SAMSUNG_SCH_I330_ID, 0xff), - .driver_info = (kernel_ulong_t)&palm_os_4_probe }, - { USB_DEVICE(SAMSUNG_VENDOR_ID, SAMSUNG_SPH_I500_ID), - .driver_info = (kernel_ulong_t)&palm_os_4_probe }, -diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h -index 7f625306ea80..821e1e2f70f6 100644 ---- a/drivers/usb/storage/unusual_devs.h -+++ b/drivers/usb/storage/unusual_devs.h -@@ -760,6 +760,13 @@ UNUSUAL_DEV( 0x059f, 0x0643, 0x0000, 0x0000, - USB_SC_DEVICE, USB_PR_DEVICE, NULL, - US_FL_GO_SLOW ), - -+/* Reported by Christian Schaller */ -+UNUSUAL_DEV( 0x059f, 0x0651, 0x0000, 0x0000, -+ "LaCie", -+ "External HDD", -+ USB_SC_DEVICE, USB_PR_DEVICE, NULL, -+ US_FL_NO_WP_DETECT ), -+ - /* Submitted by Joel Bourquard - * Some versions of this device need the SubClass and Protocol overrides - * while others don't. -diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c -index 53f620a4350e..618bcc84a09e 100644 ---- a/fs/binfmt_elf.c -+++ b/fs/binfmt_elf.c -@@ -824,7 +824,7 @@ static int load_elf_binary(struct linux_binprm *bprm) - total_size = total_mapping_size(elf_phdata, - loc->elf_ex.e_phnum); - if (!total_size) { -- error = -EINVAL; -+ retval = -EINVAL; - goto out_free_dentry; - } - } -diff --git a/fs/dcache.c b/fs/dcache.c -index efa4602e064f..e2800926ae05 100644 ---- a/fs/dcache.c -+++ b/fs/dcache.c -@@ -1179,13 +1179,13 @@ ascend: - /* might go back up the wrong parent if we have had a rename. */ - if (!locked && read_seqretry(&rename_lock, seq)) - goto rename_retry; -- next = child->d_child.next; -- while (unlikely(child->d_flags & DCACHE_DENTRY_KILLED)) { -+ /* go into the first sibling still alive */ -+ do { -+ next = child->d_child.next; - if (next == &this_parent->d_subdirs) - goto ascend; - child = list_entry(next, struct dentry, d_child); -- next = next->next; -- } -+ } while (unlikely(child->d_flags & DCACHE_DENTRY_KILLED)); - rcu_read_unlock(); - goto resume; - } -diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c -index 7fbd1c5b74af..df633bb25909 100644 ---- a/fs/ext4/extents.c -+++ b/fs/ext4/extents.c -@@ -363,7 +363,7 @@ static int ext4_valid_extent(struct inode *inode, struct ext4_extent *ext) - ext4_lblk_t lblock = le32_to_cpu(ext->ee_block); - ext4_lblk_t last = lblock + len - 1; - -- if (lblock > last) -+ if (len == 0 || lblock > last) - return 0; - return ext4_data_block_valid(EXT4_SB(inode->i_sb), block, len); - } -diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c -index 9e3d8dd6c40a..8a277505a3be 100644 ---- a/fs/ext4/inode.c -+++ b/fs/ext4/inode.c -@@ -1032,7 +1032,8 @@ retry_journal: - ext4_journal_stop(handle); - goto retry_grab; - } -- wait_on_page_writeback(page); -+ /* In case writeback began while the page was unlocked */ -+ wait_for_stable_page(page); - - if (ext4_should_dioread_nolock(inode)) - ret = __block_write_begin(page, pos, len, ext4_get_block_write); -@@ -2729,7 +2730,7 @@ retry_journal: - goto retry_grab; - } - /* In case writeback began while the page was unlocked */ -- wait_on_page_writeback(page); -+ wait_for_stable_page(page); - - ret = __block_write_begin(page, pos, len, ext4_da_get_block_prep); - if (ret < 0) { -diff --git a/fs/fhandle.c b/fs/fhandle.c -index 999ff5c3cab0..d59712dfa3e7 100644 ---- a/fs/fhandle.c -+++ b/fs/fhandle.c -@@ -195,8 +195,9 @@ static int handle_to_path(int mountdirfd, struct file_handle __user *ufh, - goto out_err; - } - /* copy the full handle */ -- if (copy_from_user(handle, ufh, -- sizeof(struct file_handle) + -+ *handle = f_handle; -+ if (copy_from_user(&handle->f_handle, -+ &ufh->f_handle, - f_handle.handle_bytes)) { - retval = -EFAULT; - goto out_handle; -diff --git a/fs/omfs/inode.c b/fs/omfs/inode.c -index d8b0afde2179..2dba0caf1f4a 100644 ---- a/fs/omfs/inode.c -+++ b/fs/omfs/inode.c -@@ -361,7 +361,7 @@ nomem: - } - - enum { -- Opt_uid, Opt_gid, Opt_umask, Opt_dmask, Opt_fmask -+ Opt_uid, Opt_gid, Opt_umask, Opt_dmask, Opt_fmask, Opt_err - }; - - static const match_table_t tokens = { -@@ -370,6 +370,7 @@ static const match_table_t tokens = { - {Opt_umask, "umask=%o"}, - {Opt_dmask, "dmask=%o"}, - {Opt_fmask, "fmask=%o"}, -+ {Opt_err, NULL}, - }; - - static int parse_options(char *options, struct omfs_sb_info *sbi) -diff --git a/include/linux/libata.h b/include/linux/libata.h -index cc82cfb66259..8e5d45fa83cf 100644 ---- a/include/linux/libata.h -+++ b/include/linux/libata.h -@@ -187,6 +187,7 @@ enum { - ATA_LFLAG_SW_ACTIVITY = (1 << 7), /* keep activity stats */ - ATA_LFLAG_NO_LPM = (1 << 8), /* disable LPM on this link */ - ATA_LFLAG_RST_ONCE = (1 << 9), /* limit recovery to one reset */ -+ ATA_LFLAG_CHANGED = (1 << 10), /* LPM state changed on this link */ - - /* struct ata_port flags */ - ATA_FLAG_SLAVE_POSS = (1 << 0), /* host supports slave dev */ -@@ -289,6 +290,12 @@ enum { - */ - ATA_TMOUT_PMP_SRST_WAIT = 5000, - -+ /* When the LPM policy is set to ATA_LPM_MAX_POWER, there might -+ * be a spurious PHY event, so ignore the first PHY event that -+ * occurs within 10s after the policy change. -+ */ -+ ATA_TMOUT_SPURIOUS_PHY = 10000, -+ - /* ATA bus states */ - BUS_UNKNOWN = 0, - BUS_DMA = 1, -@@ -736,6 +743,8 @@ struct ata_link { - struct ata_eh_context eh_context; - - struct ata_device device[ATA_MAX_DEVICES]; -+ -+ unsigned long last_lpm_change; /* when last LPM change happened */ - }; - #define ATA_LINK_CLEAR_BEGIN offsetof(struct ata_link, active_tag) - #define ATA_LINK_CLEAR_END offsetof(struct ata_link, device[0]) -@@ -1085,6 +1094,7 @@ extern struct ata_device *ata_dev_pair(struct ata_device *adev); - extern int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev); - extern void ata_scsi_port_error_handler(struct Scsi_Host *host, struct ata_port *ap); - extern void ata_scsi_cmd_error_handler(struct Scsi_Host *host, struct ata_port *ap, struct list_head *eh_q); -+extern bool sata_lpm_ignore_phy_events(struct ata_link *link); - - extern int ata_cable_40wire(struct ata_port *ap); - extern int ata_cable_80wire(struct ata_port *ap); -diff --git a/lib/strnlen_user.c b/lib/strnlen_user.c -index a28df5206d95..11649615c505 100644 ---- a/lib/strnlen_user.c -+++ b/lib/strnlen_user.c -@@ -57,7 +57,8 @@ static inline long do_strnlen_user(const char __user *src, unsigned long count, - return res + find_zero(data) + 1 - align; - } - res += sizeof(unsigned long); -- if (unlikely(max < sizeof(unsigned long))) -+ /* We already handled 'unsigned long' bytes. Did we do it all ? */ -+ if (unlikely(max <= sizeof(unsigned long))) - break; - max -= sizeof(unsigned long); - if (unlikely(__get_user(c,(unsigned long __user *)(src+res)))) -diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c -index 1b51d9216e7e..7665ce336e2b 100644 ---- a/net/ceph/osd_client.c -+++ b/net/ceph/osd_client.c -@@ -1702,20 +1702,29 @@ static void kick_requests(struct ceph_osd_client *osdc, bool force_resend, - err = __map_request(osdc, req, - force_resend || force_resend_writes); - dout("__map_request returned %d\n", err); -- if (err == 0) -- continue; /* no change and no osd was specified */ - if (err < 0) - continue; /* hrm! */ -- if (req->r_osd == NULL) { -- dout("tid %llu maps to no valid osd\n", req->r_tid); -- needmap++; /* request a newer map */ -- continue; -- } -+ if (req->r_osd == NULL || err > 0) { -+ if (req->r_osd == NULL) { -+ dout("lingering %p tid %llu maps to no osd\n", -+ req, req->r_tid); -+ /* -+ * A homeless lingering request makes -+ * no sense, as it's job is to keep -+ * a particular OSD connection open. -+ * Request a newer map and kick the -+ * request, knowing that it won't be -+ * resent until we actually get a map -+ * that can tell us where to send it. -+ */ -+ needmap++; -+ } - -- dout("kicking lingering %p tid %llu osd%d\n", req, req->r_tid, -- req->r_osd ? req->r_osd->o_osd : -1); -- __register_request(osdc, req); -- __unregister_linger_request(osdc, req); -+ dout("kicking lingering %p tid %llu osd%d\n", req, -+ req->r_tid, req->r_osd ? req->r_osd->o_osd : -1); -+ __register_request(osdc, req); -+ __unregister_linger_request(osdc, req); -+ } - } - reset_changed_osds(osdc); - mutex_unlock(&osdc->request_mutex); -diff --git a/net/socket.c b/net/socket.c -index fc90b4f0da3c..53b6e411f7a4 100644 ---- a/net/socket.c -+++ b/net/socket.c -@@ -1988,14 +1988,12 @@ static int ___sys_sendmsg(struct socket *sock, struct msghdr __user *msg, - int err, ctl_len, total_len; - - err = -EFAULT; -- if (MSG_CMSG_COMPAT & flags) { -- if (get_compat_msghdr(msg_sys, msg_compat)) -- return -EFAULT; -- } else { -+ if (MSG_CMSG_COMPAT & flags) -+ err = get_compat_msghdr(msg_sys, msg_compat); -+ else - err = copy_msghdr_from_user(msg_sys, msg); -- if (err) -- return err; -- } -+ if (err) -+ return err; - - if (msg_sys->msg_iovlen > UIO_FASTIOV) { - err = -EMSGSIZE; -@@ -2200,14 +2198,12 @@ static int ___sys_recvmsg(struct socket *sock, struct msghdr __user *msg, - struct sockaddr __user *uaddr; - int __user *uaddr_len; - -- if (MSG_CMSG_COMPAT & flags) { -- if (get_compat_msghdr(msg_sys, msg_compat)) -- return -EFAULT; -- } else { -+ if (MSG_CMSG_COMPAT & flags) -+ err = get_compat_msghdr(msg_sys, msg_compat); -+ else - err = copy_msghdr_from_user(msg_sys, msg); -- if (err) -- return err; -- } -+ if (err) -+ return err; - - if (msg_sys->msg_iovlen > UIO_FASTIOV) { - err = -EMSGSIZE; -diff --git a/net/sunrpc/auth_gss/gss_rpc_xdr.c b/net/sunrpc/auth_gss/gss_rpc_xdr.c -index f0f78c5f1c7d..e0062c544ac8 100644 ---- a/net/sunrpc/auth_gss/gss_rpc_xdr.c -+++ b/net/sunrpc/auth_gss/gss_rpc_xdr.c -@@ -794,20 +794,26 @@ int gssx_dec_accept_sec_context(struct rpc_rqst *rqstp, - { - u32 value_follows; - int err; -+ struct page *scratch; -+ -+ scratch = alloc_page(GFP_KERNEL); -+ if (!scratch) -+ return -ENOMEM; -+ xdr_set_scratch_buffer(xdr, page_address(scratch), PAGE_SIZE); - - /* res->status */ - err = gssx_dec_status(xdr, &res->status); - if (err) -- return err; -+ goto out_free; - - /* res->context_handle */ - err = gssx_dec_bool(xdr, &value_follows); - if (err) -- return err; -+ goto out_free; - if (value_follows) { - err = gssx_dec_ctx(xdr, res->context_handle); - if (err) -- return err; -+ goto out_free; - } else { - res->context_handle = NULL; - } -@@ -815,11 +821,11 @@ int gssx_dec_accept_sec_context(struct rpc_rqst *rqstp, - /* res->output_token */ - err = gssx_dec_bool(xdr, &value_follows); - if (err) -- return err; -+ goto out_free; - if (value_follows) { - err = gssx_dec_buffer(xdr, res->output_token); - if (err) -- return err; -+ goto out_free; - } else { - res->output_token = NULL; - } -@@ -827,14 +833,17 @@ int gssx_dec_accept_sec_context(struct rpc_rqst *rqstp, - /* res->delegated_cred_handle */ - err = gssx_dec_bool(xdr, &value_follows); - if (err) -- return err; -+ goto out_free; - if (value_follows) { - /* we do not support upcall servers sending this data. */ -- return -EINVAL; -+ err = -EINVAL; -+ goto out_free; - } - - /* res->options */ - err = gssx_dec_option_array(xdr, &res->options); - -+out_free: -+ __free_page(scratch); - return err; - } -diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c -index fab909908a42..3cda292f74e4 100644 ---- a/sound/pci/hda/patch_conexant.c -+++ b/sound/pci/hda/patch_conexant.c -@@ -3490,6 +3490,14 @@ static const struct hda_codec_preset snd_hda_preset_conexant[] = { - .patch = patch_conexant_auto }, - { .id = 0x14f150b9, .name = "CX20665", - .patch = patch_conexant_auto }, -+ { .id = 0x14f150f1, .name = "CX20721", -+ .patch = patch_conexant_auto }, -+ { .id = 0x14f150f2, .name = "CX20722", -+ .patch = patch_conexant_auto }, -+ { .id = 0x14f150f3, .name = "CX20723", -+ .patch = patch_conexant_auto }, -+ { .id = 0x14f150f4, .name = "CX20724", -+ .patch = patch_conexant_auto }, - { .id = 0x14f1510f, .name = "CX20751/2", - .patch = patch_conexant_auto }, - { .id = 0x14f15110, .name = "CX20751/2", -@@ -3524,6 +3532,10 @@ MODULE_ALIAS("snd-hda-codec-id:14f150ab"); - MODULE_ALIAS("snd-hda-codec-id:14f150ac"); - MODULE_ALIAS("snd-hda-codec-id:14f150b8"); - MODULE_ALIAS("snd-hda-codec-id:14f150b9"); -+MODULE_ALIAS("snd-hda-codec-id:14f150f1"); -+MODULE_ALIAS("snd-hda-codec-id:14f150f2"); -+MODULE_ALIAS("snd-hda-codec-id:14f150f3"); -+MODULE_ALIAS("snd-hda-codec-id:14f150f4"); - MODULE_ALIAS("snd-hda-codec-id:14f1510f"); - MODULE_ALIAS("snd-hda-codec-id:14f15110"); - MODULE_ALIAS("snd-hda-codec-id:14f15111"); -diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c -index a8eb7fe2766e..444019696f85 100644 ---- a/sound/pci/hda/patch_realtek.c -+++ b/sound/pci/hda/patch_realtek.c -@@ -3736,6 +3736,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { - SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC), - SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK), - SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN), -+ SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN), - SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC), - SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE), - SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE), -diff --git a/sound/soc/codecs/mc13783.c b/sound/soc/codecs/mc13783.c -index 8a8d9364e87f..d0fc21559a85 100644 ---- a/sound/soc/codecs/mc13783.c -+++ b/sound/soc/codecs/mc13783.c -@@ -604,14 +604,14 @@ static int mc13783_probe(struct snd_soc_codec *codec) - AUDIO_SSI_SEL, 0); - else - mc13xxx_reg_rmw(priv->mc13xxx, MC13783_AUDIO_CODEC, -- 0, AUDIO_SSI_SEL); -+ AUDIO_SSI_SEL, AUDIO_SSI_SEL); - - if (priv->dac_ssi_port == MC13783_SSI1_PORT) - mc13xxx_reg_rmw(priv->mc13xxx, MC13783_AUDIO_DAC, - AUDIO_SSI_SEL, 0); - else - mc13xxx_reg_rmw(priv->mc13xxx, MC13783_AUDIO_DAC, -- 0, AUDIO_SSI_SEL); -+ AUDIO_SSI_SEL, AUDIO_SSI_SEL); - - mc13xxx_unlock(priv->mc13xxx); - -diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c -index 4a8decf85a4a..39f65bc9de56 100644 ---- a/sound/soc/codecs/wm8960.c -+++ b/sound/soc/codecs/wm8960.c -@@ -392,7 +392,7 @@ static const struct snd_soc_dapm_route audio_paths[] = { - { "Right Input Mixer", "Boost Switch", "Right Boost Mixer", }, - { "Right Input Mixer", NULL, "RINPUT1", }, /* Really Boost Switch */ - { "Right Input Mixer", NULL, "RINPUT2" }, -- { "Right Input Mixer", NULL, "LINPUT3" }, -+ { "Right Input Mixer", NULL, "RINPUT3" }, - - { "Left ADC", NULL, "Left Input Mixer" }, - { "Right ADC", NULL, "Right Input Mixer" }, -diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c -index 29e95f93d482..6e746c7474bf 100644 ---- a/sound/soc/codecs/wm8994.c -+++ b/sound/soc/codecs/wm8994.c -@@ -2679,7 +2679,7 @@ static struct { - }; - - static int fs_ratios[] = { -- 64, 128, 192, 256, 348, 512, 768, 1024, 1408, 1536 -+ 64, 128, 192, 256, 384, 512, 768, 1024, 1408, 1536 - }; - - static int bclk_divs[] = { diff --git a/patch/kernel/marvell-default/1-patch-3.10.80-81.patch b/patch/kernel/marvell-default/1-patch-3.10.80-81.patch deleted file mode 100644 index 20d93920ba..0000000000 --- a/patch/kernel/marvell-default/1-patch-3.10.80-81.patch +++ /dev/null @@ -1,698 +0,0 @@ -diff --git a/Makefile b/Makefile -index 067433219984..6d19e37d36d5 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,6 +1,6 @@ - VERSION = 3 - PATCHLEVEL = 10 --SUBLEVEL = 80 -+SUBLEVEL = 81 - EXTRAVERSION = - NAME = TOSSUG Baby Fish - -diff --git a/arch/mips/kernel/irq.c b/arch/mips/kernel/irq.c -index d1fea7a054be..7479d8d847a6 100644 ---- a/arch/mips/kernel/irq.c -+++ b/arch/mips/kernel/irq.c -@@ -110,7 +110,7 @@ void __init init_IRQ(void) - #endif - } - --#ifdef DEBUG_STACKOVERFLOW -+#ifdef CONFIG_DEBUG_STACKOVERFLOW - static inline void check_stack_overflow(void) - { - unsigned long sp; -diff --git a/block/genhd.c b/block/genhd.c -index 7694dffe9f0e..b09f5fc94dee 100644 ---- a/block/genhd.c -+++ b/block/genhd.c -@@ -422,9 +422,9 @@ int blk_alloc_devt(struct hd_struct *part, dev_t *devt) - /* allocate ext devt */ - idr_preload(GFP_KERNEL); - -- spin_lock(&ext_devt_lock); -+ spin_lock_bh(&ext_devt_lock); - idx = idr_alloc(&ext_devt_idr, part, 0, NR_EXT_DEVT, GFP_NOWAIT); -- spin_unlock(&ext_devt_lock); -+ spin_unlock_bh(&ext_devt_lock); - - idr_preload_end(); - if (idx < 0) -@@ -449,9 +449,9 @@ void blk_free_devt(dev_t devt) - return; - - if (MAJOR(devt) == BLOCK_EXT_MAJOR) { -- spin_lock(&ext_devt_lock); -+ spin_lock_bh(&ext_devt_lock); - idr_remove(&ext_devt_idr, blk_mangle_minor(MINOR(devt))); -- spin_unlock(&ext_devt_lock); -+ spin_unlock_bh(&ext_devt_lock); - } - } - -@@ -691,13 +691,13 @@ struct gendisk *get_gendisk(dev_t devt, int *partno) - } else { - struct hd_struct *part; - -- spin_lock(&ext_devt_lock); -+ spin_lock_bh(&ext_devt_lock); - part = idr_find(&ext_devt_idr, blk_mangle_minor(MINOR(devt))); - if (part && get_disk(part_to_disk(part))) { - *partno = part->partno; - disk = part_to_disk(part); - } -- spin_unlock(&ext_devt_lock); -+ spin_unlock_bh(&ext_devt_lock); - } - - return disk; -diff --git a/drivers/ata/pata_octeon_cf.c b/drivers/ata/pata_octeon_cf.c -index e73bef3093d2..5507f36a06b4 100644 ---- a/drivers/ata/pata_octeon_cf.c -+++ b/drivers/ata/pata_octeon_cf.c -@@ -1068,7 +1068,7 @@ static struct of_device_id octeon_cf_match[] = { - }, - {}, - }; --MODULE_DEVICE_TABLE(of, octeon_i2c_match); -+MODULE_DEVICE_TABLE(of, octeon_cf_match); - - static struct platform_driver octeon_cf_driver = { - .probe = octeon_cf_probe, -diff --git a/drivers/gpu/drm/i915/intel_i2c.c b/drivers/gpu/drm/i915/intel_i2c.c -index 4a21e13cc58c..d5e666fb459c 100644 ---- a/drivers/gpu/drm/i915/intel_i2c.c -+++ b/drivers/gpu/drm/i915/intel_i2c.c -@@ -441,7 +441,7 @@ gmbus_xfer(struct i2c_adapter *adapter, - struct intel_gmbus, - adapter); - struct drm_i915_private *dev_priv = bus->dev_priv; -- int i, reg_offset; -+ int i = 0, inc, try = 0, reg_offset; - int ret = 0; - - mutex_lock(&dev_priv->gmbus_mutex); -@@ -453,12 +453,14 @@ gmbus_xfer(struct i2c_adapter *adapter, - - reg_offset = dev_priv->gpio_mmio_base; - -+retry: - I915_WRITE(GMBUS0 + reg_offset, bus->reg0); - -- for (i = 0; i < num; i++) { -+ for (; i < num; i += inc) { -+ inc = 1; - if (gmbus_is_index_read(msgs, i, num)) { - ret = gmbus_xfer_index_read(dev_priv, &msgs[i]); -- i += 1; /* set i to the index of the read xfer */ -+ inc = 2; /* an index read is two msgs */ - } else if (msgs[i].flags & I2C_M_RD) { - ret = gmbus_xfer_read(dev_priv, &msgs[i], 0); - } else { -@@ -530,6 +532,18 @@ clear_err: - adapter->name, msgs[i].addr, - (msgs[i].flags & I2C_M_RD) ? 'r' : 'w', msgs[i].len); - -+ /* -+ * Passive adapters sometimes NAK the first probe. Retry the first -+ * message once on -ENXIO for GMBUS transfers; the bit banging algorithm -+ * has retries internally. See also the retry loop in -+ * drm_do_probe_ddc_edid, which bails out on the first -ENXIO. -+ */ -+ if (ret == -ENXIO && i == 0 && try++ == 0) { -+ DRM_DEBUG_KMS("GMBUS [%s] NAK on first message, retry\n", -+ adapter->name); -+ goto retry; -+ } -+ - goto out; - - timeout: -diff --git a/drivers/iio/imu/adis16400.h b/drivers/iio/imu/adis16400.h -index 0916bf6b6c31..1e8fd2e81d45 100644 ---- a/drivers/iio/imu/adis16400.h -+++ b/drivers/iio/imu/adis16400.h -@@ -165,6 +165,7 @@ struct adis16400_state { - int filt_int; - - struct adis adis; -+ unsigned long avail_scan_mask[2]; - }; - - /* At the moment triggers are only used for ring buffer -diff --git a/drivers/iio/imu/adis16400_core.c b/drivers/iio/imu/adis16400_core.c -index 7d60c85cc16d..9721c58ed847 100644 ---- a/drivers/iio/imu/adis16400_core.c -+++ b/drivers/iio/imu/adis16400_core.c -@@ -438,6 +438,11 @@ static int adis16400_read_raw(struct iio_dev *indio_dev, - *val = st->variant->temp_scale_nano / 1000000; - *val2 = (st->variant->temp_scale_nano % 1000000); - return IIO_VAL_INT_PLUS_MICRO; -+ case IIO_PRESSURE: -+ /* 20 uBar = 0.002kPascal */ -+ *val = 0; -+ *val2 = 2000; -+ return IIO_VAL_INT_PLUS_MICRO; - default: - return -EINVAL; - } -@@ -480,10 +485,10 @@ static int adis16400_read_raw(struct iio_dev *indio_dev, - } - } - --#define ADIS16400_VOLTAGE_CHAN(addr, bits, name, si) { \ -+#define ADIS16400_VOLTAGE_CHAN(addr, bits, name, si, chn) { \ - .type = IIO_VOLTAGE, \ - .indexed = 1, \ -- .channel = 0, \ -+ .channel = chn, \ - .extend_name = name, \ - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \ - BIT(IIO_CHAN_INFO_SCALE), \ -@@ -499,10 +504,10 @@ static int adis16400_read_raw(struct iio_dev *indio_dev, - } - - #define ADIS16400_SUPPLY_CHAN(addr, bits) \ -- ADIS16400_VOLTAGE_CHAN(addr, bits, "supply", ADIS16400_SCAN_SUPPLY) -+ ADIS16400_VOLTAGE_CHAN(addr, bits, "supply", ADIS16400_SCAN_SUPPLY, 0) - - #define ADIS16400_AUX_ADC_CHAN(addr, bits) \ -- ADIS16400_VOLTAGE_CHAN(addr, bits, NULL, ADIS16400_SCAN_ADC) -+ ADIS16400_VOLTAGE_CHAN(addr, bits, NULL, ADIS16400_SCAN_ADC, 1) - - #define ADIS16400_GYRO_CHAN(mod, addr, bits) { \ - .type = IIO_ANGL_VEL, \ -@@ -819,11 +824,6 @@ static const struct iio_info adis16400_info = { - .debugfs_reg_access = adis_debugfs_reg_access, - }; - --static const unsigned long adis16400_burst_scan_mask[] = { -- ~0UL, -- 0, --}; -- - static const char * const adis16400_status_error_msgs[] = { - [ADIS16400_DIAG_STAT_ZACCL_FAIL] = "Z-axis accelerometer self-test failure", - [ADIS16400_DIAG_STAT_YACCL_FAIL] = "Y-axis accelerometer self-test failure", -@@ -871,6 +871,20 @@ static const struct adis_data adis16400_data = { - BIT(ADIS16400_DIAG_STAT_POWER_LOW), - }; - -+static void adis16400_setup_chan_mask(struct adis16400_state *st) -+{ -+ const struct adis16400_chip_info *chip_info = st->variant; -+ unsigned i; -+ -+ for (i = 0; i < chip_info->num_channels; i++) { -+ const struct iio_chan_spec *ch = &chip_info->channels[i]; -+ -+ if (ch->scan_index >= 0 && -+ ch->scan_index != ADIS16400_SCAN_TIMESTAMP) -+ st->avail_scan_mask[0] |= BIT(ch->scan_index); -+ } -+} -+ - static int adis16400_probe(struct spi_device *spi) - { - struct adis16400_state *st; -@@ -894,8 +908,10 @@ static int adis16400_probe(struct spi_device *spi) - indio_dev->info = &adis16400_info; - indio_dev->modes = INDIO_DIRECT_MODE; - -- if (!(st->variant->flags & ADIS16400_NO_BURST)) -- indio_dev->available_scan_masks = adis16400_burst_scan_mask; -+ if (!(st->variant->flags & ADIS16400_NO_BURST)) { -+ adis16400_setup_chan_mask(st); -+ indio_dev->available_scan_masks = st->avail_scan_mask; -+ } - - ret = adis_init(&st->adis, indio_dev, spi, &adis16400_data); - if (ret) -diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c -index dbd4f5ad3343..02099afb6c79 100644 ---- a/drivers/input/mouse/elantech.c -+++ b/drivers/input/mouse/elantech.c -@@ -1241,10 +1241,11 @@ static bool elantech_is_signature_valid(const unsigned char *param) - return true; - - /* -- * Some models have a revision higher then 20. Meaning param[2] may -- * be 10 or 20, skip the rates check for these. -+ * Some hw_version >= 4 models have a revision higher then 20. Meaning -+ * that param[2] may be 10 or 20, skip the rates check for these. - */ -- if (param[0] == 0x46 && (param[1] & 0xef) == 0x0f && param[2] < 40) -+ if ((param[0] & 0x0f) >= 0x06 && (param[1] & 0xaf) == 0x0f && -+ param[2] < 40) - return true; - - for (i = 0; i < ARRAY_SIZE(rates); i++) -diff --git a/drivers/net/phy/dp83640.c b/drivers/net/phy/dp83640.c -index 7490b6c866e6..d2907a6e3dab 100644 ---- a/drivers/net/phy/dp83640.c -+++ b/drivers/net/phy/dp83640.c -@@ -45,7 +45,7 @@ - #define PSF_TX 0x1000 - #define EXT_EVENT 1 - #define CAL_EVENT 7 --#define CAL_TRIGGER 7 -+#define CAL_TRIGGER 1 - #define PER_TRIGGER 6 - - #define MII_DP83640_MICR 0x11 -diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c -index 427e48a80efa..299d35552a3e 100644 ---- a/drivers/net/phy/phy.c -+++ b/drivers/net/phy/phy.c -@@ -1022,12 +1022,14 @@ int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable) - - /* According to 802.3az,the EEE is supported only in full duplex-mode. - * Also EEE feature is active when core is operating with MII, GMII -- * or RGMII. -+ * or RGMII (all kinds). Internal PHYs are also allowed to proceed and -+ * should return an error if they do not support EEE. - */ - if ((phydev->duplex == DUPLEX_FULL) && - ((phydev->interface == PHY_INTERFACE_MODE_MII) || - (phydev->interface == PHY_INTERFACE_MODE_GMII) || -- (phydev->interface == PHY_INTERFACE_MODE_RGMII))) { -+ (phydev->interface >= PHY_INTERFACE_MODE_RGMII && -+ phydev->interface <= PHY_INTERFACE_MODE_RGMII_TXID))) { - int eee_lp, eee_cap, eee_adv; - u32 lp, cap, adv; - int status; -diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c -index 8a9e8750703f..e0cf18c6cf11 100644 ---- a/drivers/net/xen-netback/xenbus.c -+++ b/drivers/net/xen-netback/xenbus.c -@@ -33,6 +33,8 @@ struct backend_info { - enum xenbus_state frontend_state; - struct xenbus_watch hotplug_status_watch; - u8 have_hotplug_status_watch:1; -+ -+ const char *hotplug_script; - }; - - static int connect_rings(struct backend_info *); -@@ -55,6 +57,7 @@ static int netback_remove(struct xenbus_device *dev) - xenvif_free(be->vif); - be->vif = NULL; - } -+ kfree(be->hotplug_script); - kfree(be); - dev_set_drvdata(&dev->dev, NULL); - return 0; -@@ -72,6 +75,7 @@ static int netback_probe(struct xenbus_device *dev, - struct xenbus_transaction xbt; - int err; - int sg; -+ const char *script; - struct backend_info *be = kzalloc(sizeof(struct backend_info), - GFP_KERNEL); - if (!be) { -@@ -132,6 +136,15 @@ static int netback_probe(struct xenbus_device *dev, - goto fail; - } - -+ script = xenbus_read(XBT_NIL, dev->nodename, "script", NULL); -+ if (IS_ERR(script)) { -+ err = PTR_ERR(script); -+ xenbus_dev_fatal(dev, err, "reading script"); -+ goto fail; -+ } -+ -+ be->hotplug_script = script; -+ - err = xenbus_switch_state(dev, XenbusStateInitWait); - if (err) - goto fail; -@@ -162,22 +175,14 @@ static int netback_uevent(struct xenbus_device *xdev, - struct kobj_uevent_env *env) - { - struct backend_info *be = dev_get_drvdata(&xdev->dev); -- char *val; - -- val = xenbus_read(XBT_NIL, xdev->nodename, "script", NULL); -- if (IS_ERR(val)) { -- int err = PTR_ERR(val); -- xenbus_dev_fatal(xdev, err, "reading script"); -- return err; -- } else { -- if (add_uevent_var(env, "script=%s", val)) { -- kfree(val); -- return -ENOMEM; -- } -- kfree(val); -- } -+ if (!be) -+ return 0; -+ -+ if (add_uevent_var(env, "script=%s", be->hotplug_script)) -+ return -ENOMEM; - -- if (!be || !be->vif) -+ if (!be->vif) - return 0; - - return add_uevent_var(env, "vif=%s", be->vif->dev->name); -diff --git a/drivers/staging/ozwpan/ozusbsvc1.c b/drivers/staging/ozwpan/ozusbsvc1.c -index 4e4b650fee3f..d4f55b08ef78 100644 ---- a/drivers/staging/ozwpan/ozusbsvc1.c -+++ b/drivers/staging/ozwpan/ozusbsvc1.c -@@ -314,7 +314,11 @@ static void oz_usb_handle_ep_data(struct oz_usb_ctx *usb_ctx, - struct oz_multiple_fixed *body = - (struct oz_multiple_fixed *)data_hdr; - u8 *data = body->data; -- int n = (len - sizeof(struct oz_multiple_fixed)+1) -+ unsigned int n; -+ if (!body->unit_size || -+ len < sizeof(struct oz_multiple_fixed) - 1) -+ break; -+ n = (len - (sizeof(struct oz_multiple_fixed) - 1)) - / body->unit_size; - while (n--) { - oz_hcd_data_ind(usb_ctx->hport, body->endpoint, -@@ -376,10 +380,15 @@ void oz_usb_rx(struct oz_pd *pd, struct oz_elt *elt) - case OZ_GET_DESC_RSP: { - struct oz_get_desc_rsp *body = - (struct oz_get_desc_rsp *)usb_hdr; -- int data_len = elt->length - -- sizeof(struct oz_get_desc_rsp) + 1; -- u16 offs = le16_to_cpu(get_unaligned(&body->offset)); -- u16 total_size = -+ u16 offs, total_size; -+ u8 data_len; -+ -+ if (elt->length < sizeof(struct oz_get_desc_rsp) - 1) -+ break; -+ data_len = elt->length - -+ (sizeof(struct oz_get_desc_rsp) - 1); -+ offs = le16_to_cpu(get_unaligned(&body->offset)); -+ total_size = - le16_to_cpu(get_unaligned(&body->total_size)); - oz_trace("USB_REQ_GET_DESCRIPTOR - cnf\n"); - oz_hcd_get_desc_cnf(usb_ctx->hport, body->req_id, -diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c -index 691a82105180..ab1c5e8ac27f 100644 ---- a/drivers/usb/serial/cp210x.c -+++ b/drivers/usb/serial/cp210x.c -@@ -128,6 +128,7 @@ static const struct usb_device_id id_table[] = { - { USB_DEVICE(0x10C4, 0x8946) }, /* Ketra N1 Wireless Interface */ - { USB_DEVICE(0x10C4, 0x8977) }, /* CEL MeshWorks DevKit Device */ - { USB_DEVICE(0x10C4, 0x8998) }, /* KCF Technologies PRN */ -+ { USB_DEVICE(0x10C4, 0x8A2A) }, /* HubZ dual ZigBee and Z-Wave dongle */ - { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */ - { USB_DEVICE(0x10C4, 0xEA61) }, /* Silicon Labs factory default */ - { USB_DEVICE(0x10C4, 0xEA70) }, /* Silicon Labs factory default */ -diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c -index 4d918d5f945a..b55e5f3a311d 100644 ---- a/drivers/usb/serial/ftdi_sio.c -+++ b/drivers/usb/serial/ftdi_sio.c -@@ -715,6 +715,7 @@ static struct usb_device_id id_table_combined [] = { - { USB_DEVICE(XSENS_VID, XSENS_AWINDA_DONGLE_PID) }, - { USB_DEVICE(XSENS_VID, XSENS_AWINDA_STATION_PID) }, - { USB_DEVICE(XSENS_VID, XSENS_CONVERTER_PID) }, -+ { USB_DEVICE(XSENS_VID, XSENS_MTDEVBOARD_PID) }, - { USB_DEVICE(XSENS_VID, XSENS_MTW_PID) }, - { USB_DEVICE(FTDI_VID, FTDI_OMNI1509) }, - { USB_DEVICE(MOBILITY_VID, MOBILITY_USB_SERIAL_PID) }, -diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h -index e906b6aa2424..99316d7cfc03 100644 ---- a/drivers/usb/serial/ftdi_sio_ids.h -+++ b/drivers/usb/serial/ftdi_sio_ids.h -@@ -155,6 +155,7 @@ - #define XSENS_AWINDA_STATION_PID 0x0101 - #define XSENS_AWINDA_DONGLE_PID 0x0102 - #define XSENS_MTW_PID 0x0200 /* Xsens MTw */ -+#define XSENS_MTDEVBOARD_PID 0x0300 /* Motion Tracker Development Board */ - #define XSENS_CONVERTER_PID 0xD00D /* Xsens USB-serial converter */ - - /* Xsens devices using FTDI VID */ -diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c -index 84ceff6abbc1..be7e31a933e5 100644 ---- a/fs/btrfs/extent_io.c -+++ b/fs/btrfs/extent_io.c -@@ -4080,8 +4080,11 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, - } - ret = fiemap_fill_next_extent(fieinfo, em_start, disko, - em_len, flags); -- if (ret) -+ if (ret) { -+ if (ret == 1) -+ ret = 0; - goto out_free; -+ } - } - out_free: - free_extent_map(em); -diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c -index f0857e092a3c..68891ff7e5d4 100644 ---- a/fs/btrfs/super.c -+++ b/fs/btrfs/super.c -@@ -779,6 +779,15 @@ find_root: - if (btrfs_root_refs(&new_root->root_item) == 0) - return ERR_PTR(-ENOENT); - -+ if (!(sb->s_flags & MS_RDONLY)) { -+ int ret; -+ down_read(&fs_info->cleanup_work_sem); -+ ret = btrfs_orphan_cleanup(new_root); -+ up_read(&fs_info->cleanup_work_sem); -+ if (ret) -+ return ERR_PTR(ret); -+ } -+ - dir_id = btrfs_root_dirid(&new_root->root_item); - setup_root: - location.objectid = dir_id; -diff --git a/kernel/trace/ring_buffer_benchmark.c b/kernel/trace/ring_buffer_benchmark.c -index a5457d577b98..6ad2e2d320fe 100644 ---- a/kernel/trace/ring_buffer_benchmark.c -+++ b/kernel/trace/ring_buffer_benchmark.c -@@ -455,7 +455,7 @@ static int __init ring_buffer_benchmark_init(void) - - if (producer_fifo >= 0) { - struct sched_param param = { -- .sched_priority = consumer_fifo -+ .sched_priority = producer_fifo - }; - sched_setscheduler(producer, SCHED_FIFO, ¶m); - } else -diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c -index 2298237db142..d85d3a0e06ce 100644 ---- a/mm/memory_hotplug.c -+++ b/mm/memory_hotplug.c -@@ -1803,8 +1803,10 @@ void try_offline_node(int nid) - * wait_table may be allocated from boot memory, - * here only free if it's allocated by vmalloc. - */ -- if (is_vmalloc_addr(zone->wait_table)) -+ if (is_vmalloc_addr(zone->wait_table)) { - vfree(zone->wait_table); -+ zone->wait_table = NULL; -+ } - } - } - EXPORT_SYMBOL(try_offline_node); -diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c -index 81de0106528b..49b4a82d3f86 100644 ---- a/net/bridge/br_multicast.c -+++ b/net/bridge/br_multicast.c -@@ -1007,7 +1007,7 @@ static int br_ip6_multicast_mld2_report(struct net_bridge *br, - - err = br_ip6_multicast_add_group(br, port, &grec->grec_mca, - vid); -- if (!err) -+ if (err) - break; - } - -diff --git a/net/caif/caif_socket.c b/net/caif/caif_socket.c -index 526bf56f4d31..afeb8e07ee41 100644 ---- a/net/caif/caif_socket.c -+++ b/net/caif/caif_socket.c -@@ -332,6 +332,10 @@ static long caif_stream_data_wait(struct sock *sk, long timeo) - release_sock(sk); - timeo = schedule_timeout(timeo); - lock_sock(sk); -+ -+ if (sock_flag(sk, SOCK_DEAD)) -+ break; -+ - clear_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags); - } - -@@ -376,6 +380,10 @@ static int caif_stream_recvmsg(struct kiocb *iocb, struct socket *sock, - struct sk_buff *skb; - - lock_sock(sk); -+ if (sock_flag(sk, SOCK_DEAD)) { -+ err = -ECONNRESET; -+ goto unlock; -+ } - skb = skb_dequeue(&sk->sk_receive_queue); - caif_check_flow_release(sk); - -diff --git a/net/ipv4/route.c b/net/ipv4/route.c -index e23c5f64286b..222e1b6141d3 100644 ---- a/net/ipv4/route.c -+++ b/net/ipv4/route.c -@@ -871,6 +871,10 @@ static int ip_error(struct sk_buff *skb) - bool send; - int code; - -+ /* IP on this device is disabled. */ -+ if (!in_dev) -+ goto out; -+ - net = dev_net(rt->dst.dev); - if (!IN_DEV_FORWARD(in_dev)) { - switch (rt->dst.error) { -diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c -index c3075b552248..63b536bbf0b0 100644 ---- a/net/ipv4/udp.c -+++ b/net/ipv4/udp.c -@@ -1293,10 +1293,8 @@ csum_copy_err: - } - unlock_sock_fast(sk, slow); - -- if (noblock) -- return -EAGAIN; -- -- /* starting over for a new packet */ -+ /* starting over for a new packet, but check if we need to yield */ -+ cond_resched(); - msg->msg_flags &= ~MSG_TRUNC; - goto try_again; - } -diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c -index 6b298dc614e3..7e3901893413 100644 ---- a/net/ipv6/udp.c -+++ b/net/ipv6/udp.c -@@ -494,10 +494,8 @@ csum_copy_err: - } - unlock_sock_fast(sk, slow); - -- if (noblock) -- return -EAGAIN; -- -- /* starting over for a new packet */ -+ /* starting over for a new packet, but check if we need to yield */ -+ cond_resched(); - msg->msg_flags &= ~MSG_TRUNC; - goto try_again; - } -diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c -index 2d2f07945c85..e87b27c7bffd 100644 ---- a/net/sched/sch_api.c -+++ b/net/sched/sch_api.c -@@ -752,10 +752,8 @@ static int qdisc_graft(struct net_device *dev, struct Qdisc *parent, - if (dev->flags & IFF_UP) - dev_deactivate(dev); - -- if (new && new->ops->attach) { -- new->ops->attach(new); -- num_q = 0; -- } -+ if (new && new->ops->attach) -+ goto skip; - - for (i = 0; i < num_q; i++) { - struct netdev_queue *dev_queue = dev_ingress_queue(dev); -@@ -771,12 +769,16 @@ static int qdisc_graft(struct net_device *dev, struct Qdisc *parent, - qdisc_destroy(old); - } - -+skip: - if (!ingress) { - notify_and_destroy(net, skb, n, classid, - dev->qdisc, new); - if (new && !new->ops->attach) - atomic_inc(&new->refcnt); - dev->qdisc = new ? : &noop_qdisc; -+ -+ if (new && new->ops->attach) -+ new->ops->attach(new); - } else { - notify_and_destroy(net, skb, n, classid, old, new); - } -diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c -index 75e198d029d2..123c16419cbe 100644 ---- a/net/unix/af_unix.c -+++ b/net/unix/af_unix.c -@@ -1898,6 +1898,10 @@ static long unix_stream_data_wait(struct sock *sk, long timeo, - unix_state_unlock(sk); - timeo = schedule_timeout(timeo); - unix_state_lock(sk); -+ -+ if (sock_flag(sk, SOCK_DEAD)) -+ break; -+ - clear_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags); - } - -@@ -1957,6 +1961,10 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock, - struct sk_buff *skb, *last; - - unix_state_lock(sk); -+ if (sock_flag(sk, SOCK_DEAD)) { -+ err = -ECONNRESET; -+ goto unlock; -+ } - last = skb = skb_peek(&sk->sk_receive_queue); - again: - if (skb == NULL) { -diff --git a/net/wireless/wext-compat.c b/net/wireless/wext-compat.c -index d997d0f0c54a..18a7a7b112ef 100644 ---- a/net/wireless/wext-compat.c -+++ b/net/wireless/wext-compat.c -@@ -1345,6 +1345,8 @@ static struct iw_statistics *cfg80211_wireless_stats(struct net_device *dev) - memcpy(bssid, wdev->current_bss->pub.bssid, ETH_ALEN); - wdev_unlock(wdev); - -+ memset(&sinfo, 0, sizeof(sinfo)); -+ - if (rdev_get_station(rdev, dev, bssid, &sinfo)) - return NULL; - -diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c -index 444019696f85..ca2094c914a1 100644 ---- a/sound/pci/hda/patch_realtek.c -+++ b/sound/pci/hda/patch_realtek.c -@@ -2148,6 +2148,7 @@ static const struct hda_fixup alc882_fixups[] = { - static const struct snd_pci_quirk alc882_fixup_tbl[] = { - SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD), - SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD), -+ SND_PCI_QUIRK(0x1025, 0x0107, "Acer Aspire", ALC883_FIXUP_ACER_EAPD), - SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD), - SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD), - SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD), -diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c -index 061be0e5fa5a..5ea5a18f3f58 100644 ---- a/sound/usb/mixer.c -+++ b/sound/usb/mixer.c -@@ -891,6 +891,7 @@ static void volume_control_quirks(struct usb_mixer_elem_info *cval, - case USB_ID(0x046d, 0x081d): /* HD Webcam c510 */ - case USB_ID(0x046d, 0x0825): /* HD Webcam c270 */ - case USB_ID(0x046d, 0x0826): /* HD Webcam c525 */ -+ case USB_ID(0x046d, 0x08ca): /* Logitech Quickcam Fusion */ - case USB_ID(0x046d, 0x0991): - /* Most audio usb devices lie about volume resolution. - * Most Logitech webcams have res = 384. -diff --git a/sound/usb/mixer_maps.c b/sound/usb/mixer_maps.c -index 4df31b0f94a3..d06fbd9f7cbe 100644 ---- a/sound/usb/mixer_maps.c -+++ b/sound/usb/mixer_maps.c -@@ -418,6 +418,11 @@ static struct usbmix_ctl_map usbmix_ctl_maps[] = { - .map = ebox44_map, - }, - { -+ /* MAYA44 USB+ */ -+ .id = USB_ID(0x2573, 0x0008), -+ .map = maya44_map, -+ }, -+ { - /* KEF X300A */ - .id = USB_ID(0x27ac, 0x1000), - .map = scms_usb3318_map, diff --git a/patch/kernel/marvell-default/1-patch-3.10.81-82.patch b/patch/kernel/marvell-default/1-patch-3.10.81-82.patch deleted file mode 100644 index b14a1fe53c..0000000000 --- a/patch/kernel/marvell-default/1-patch-3.10.81-82.patch +++ /dev/null @@ -1,263 +0,0 @@ -diff --git a/Makefile b/Makefile -index 6d19e37d36d5..5e3e665a10b7 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,6 +1,6 @@ - VERSION = 3 - PATCHLEVEL = 10 --SUBLEVEL = 81 -+SUBLEVEL = 82 - EXTRAVERSION = - NAME = TOSSUG Baby Fish - -diff --git a/drivers/crypto/caam/caamrng.c b/drivers/crypto/caam/caamrng.c -index d1939a9539c0..04aefffb4dd9 100644 ---- a/drivers/crypto/caam/caamrng.c -+++ b/drivers/crypto/caam/caamrng.c -@@ -56,7 +56,7 @@ - - /* Buffer, its dma address and lock */ - struct buf_data { -- u8 buf[RN_BUF_SIZE]; -+ u8 buf[RN_BUF_SIZE] ____cacheline_aligned; - dma_addr_t addr; - struct completion filled; - u32 hw_desc[DESC_JOB_O_LEN]; -diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c b/drivers/gpu/drm/mgag200/mgag200_mode.c -index f6341e8622ee..7bd2acce9f81 100644 ---- a/drivers/gpu/drm/mgag200/mgag200_mode.c -+++ b/drivers/gpu/drm/mgag200/mgag200_mode.c -@@ -1487,6 +1487,11 @@ static int mga_vga_mode_valid(struct drm_connector *connector, - return MODE_BANDWIDTH; - } - -+ if ((mode->hdisplay % 8) != 0 || (mode->hsync_start % 8) != 0 || -+ (mode->hsync_end % 8) != 0 || (mode->htotal % 8) != 0) { -+ return MODE_H_ILLEGAL; -+ } -+ - if (mode->crtc_hdisplay > 2048 || mode->crtc_hsync_start > 4096 || - mode->crtc_hsync_end > 4096 || mode->crtc_htotal > 4096 || - mode->crtc_vdisplay > 2048 || mode->crtc_vsync_start > 4096 || -diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c -index 572579f87de4..90861416b9e9 100644 ---- a/drivers/scsi/lpfc/lpfc_sli.c -+++ b/drivers/scsi/lpfc/lpfc_sli.c -@@ -263,6 +263,16 @@ lpfc_sli4_eq_get(struct lpfc_queue *q) - return NULL; - - q->hba_index = idx; -+ -+ /* -+ * insert barrier for instruction interlock : data from the hardware -+ * must have the valid bit checked before it can be copied and acted -+ * upon. Given what was seen in lpfc_sli4_cq_get() of speculative -+ * instructions allowing action on content before valid bit checked, -+ * add barrier here as well. May not be needed as "content" is a -+ * single 32-bit entity here (vs multi word structure for cq's). -+ */ -+ mb(); - return eqe; - } - -@@ -368,6 +378,17 @@ lpfc_sli4_cq_get(struct lpfc_queue *q) - - cqe = q->qe[q->hba_index].cqe; - q->hba_index = idx; -+ -+ /* -+ * insert barrier for instruction interlock : data from the hardware -+ * must have the valid bit checked before it can be copied and acted -+ * upon. Speculative instructions were allowing a bcopy at the start -+ * of lpfc_sli4_fp_handle_wcqe(), which is called immediately -+ * after our return, to copy data before the valid bit check above -+ * was done. As such, some of the copied data was stale. The barrier -+ * ensures the check is before any data is copied. -+ */ -+ mb(); - return cqe; - } - -diff --git a/fs/pipe.c b/fs/pipe.c -index 0e0752ef2715..3e7ab278bb0c 100644 ---- a/fs/pipe.c -+++ b/fs/pipe.c -@@ -117,25 +117,27 @@ void pipe_wait(struct pipe_inode_info *pipe) - } - - static int --pipe_iov_copy_from_user(void *to, struct iovec *iov, unsigned long len, -- int atomic) -+pipe_iov_copy_from_user(void *addr, int *offset, struct iovec *iov, -+ size_t *remaining, int atomic) - { - unsigned long copy; - -- while (len > 0) { -+ while (*remaining > 0) { - while (!iov->iov_len) - iov++; -- copy = min_t(unsigned long, len, iov->iov_len); -+ copy = min_t(unsigned long, *remaining, iov->iov_len); - - if (atomic) { -- if (__copy_from_user_inatomic(to, iov->iov_base, copy)) -+ if (__copy_from_user_inatomic(addr + *offset, -+ iov->iov_base, copy)) - return -EFAULT; - } else { -- if (copy_from_user(to, iov->iov_base, copy)) -+ if (copy_from_user(addr + *offset, -+ iov->iov_base, copy)) - return -EFAULT; - } -- to += copy; -- len -= copy; -+ *offset += copy; -+ *remaining -= copy; - iov->iov_base += copy; - iov->iov_len -= copy; - } -@@ -143,25 +145,27 @@ pipe_iov_copy_from_user(void *to, struct iovec *iov, unsigned long len, - } - - static int --pipe_iov_copy_to_user(struct iovec *iov, const void *from, unsigned long len, -- int atomic) -+pipe_iov_copy_to_user(struct iovec *iov, void *addr, int *offset, -+ size_t *remaining, int atomic) - { - unsigned long copy; - -- while (len > 0) { -+ while (*remaining > 0) { - while (!iov->iov_len) - iov++; -- copy = min_t(unsigned long, len, iov->iov_len); -+ copy = min_t(unsigned long, *remaining, iov->iov_len); - - if (atomic) { -- if (__copy_to_user_inatomic(iov->iov_base, from, copy)) -+ if (__copy_to_user_inatomic(iov->iov_base, -+ addr + *offset, copy)) - return -EFAULT; - } else { -- if (copy_to_user(iov->iov_base, from, copy)) -+ if (copy_to_user(iov->iov_base, -+ addr + *offset, copy)) - return -EFAULT; - } -- from += copy; -- len -= copy; -+ *offset += copy; -+ *remaining -= copy; - iov->iov_base += copy; - iov->iov_len -= copy; - } -@@ -395,7 +399,7 @@ pipe_read(struct kiocb *iocb, const struct iovec *_iov, - struct pipe_buffer *buf = pipe->bufs + curbuf; - const struct pipe_buf_operations *ops = buf->ops; - void *addr; -- size_t chars = buf->len; -+ size_t chars = buf->len, remaining; - int error, atomic; - - if (chars > total_len) -@@ -409,9 +413,11 @@ pipe_read(struct kiocb *iocb, const struct iovec *_iov, - } - - atomic = !iov_fault_in_pages_write(iov, chars); -+ remaining = chars; - redo: - addr = ops->map(pipe, buf, atomic); -- error = pipe_iov_copy_to_user(iov, addr + buf->offset, chars, atomic); -+ error = pipe_iov_copy_to_user(iov, addr, &buf->offset, -+ &remaining, atomic); - ops->unmap(pipe, buf, addr); - if (unlikely(error)) { - /* -@@ -426,7 +432,6 @@ redo: - break; - } - ret += chars; -- buf->offset += chars; - buf->len -= chars; - - /* Was it a packet buffer? Clean up and exit */ -@@ -531,6 +536,7 @@ pipe_write(struct kiocb *iocb, const struct iovec *_iov, - if (ops->can_merge && offset + chars <= PAGE_SIZE) { - int error, atomic = 1; - void *addr; -+ size_t remaining = chars; - - error = ops->confirm(pipe, buf); - if (error) -@@ -539,8 +545,8 @@ pipe_write(struct kiocb *iocb, const struct iovec *_iov, - iov_fault_in_pages_read(iov, chars); - redo1: - addr = ops->map(pipe, buf, atomic); -- error = pipe_iov_copy_from_user(offset + addr, iov, -- chars, atomic); -+ error = pipe_iov_copy_from_user(addr, &offset, iov, -+ &remaining, atomic); - ops->unmap(pipe, buf, addr); - ret = error; - do_wakeup = 1; -@@ -575,6 +581,8 @@ redo1: - struct page *page = pipe->tmp_page; - char *src; - int error, atomic = 1; -+ int offset = 0; -+ size_t remaining; - - if (!page) { - page = alloc_page(GFP_HIGHUSER); -@@ -595,14 +603,15 @@ redo1: - chars = total_len; - - iov_fault_in_pages_read(iov, chars); -+ remaining = chars; - redo2: - if (atomic) - src = kmap_atomic(page); - else - src = kmap(page); - -- error = pipe_iov_copy_from_user(src, iov, chars, -- atomic); -+ error = pipe_iov_copy_from_user(src, &offset, iov, -+ &remaining, atomic); - if (atomic) - kunmap_atomic(src); - else -diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c -index 0a1edc694d67..fe3e086d38e9 100644 ---- a/kernel/trace/trace_events_filter.c -+++ b/kernel/trace/trace_events_filter.c -@@ -1328,19 +1328,24 @@ static int check_preds(struct filter_parse_state *ps) - { - int n_normal_preds = 0, n_logical_preds = 0; - struct postfix_elt *elt; -+ int cnt = 0; - - list_for_each_entry(elt, &ps->postfix, list) { -- if (elt->op == OP_NONE) -+ if (elt->op == OP_NONE) { -+ cnt++; - continue; -+ } - -+ cnt--; - if (elt->op == OP_AND || elt->op == OP_OR) { - n_logical_preds++; - continue; - } - n_normal_preds++; -+ WARN_ON_ONCE(cnt < 0); - } - -- if (!n_normal_preds || n_logical_preds >= n_normal_preds) { -+ if (cnt != 1 || !n_normal_preds || n_logical_preds >= n_normal_preds) { - parse_error(ps, FILT_ERR_INVALID_FILTER, 0); - return -EINVAL; - } diff --git a/patch/kernel/marvell-default/1-patch-3.10.82-83.patch b/patch/kernel/marvell-default/1-patch-3.10.82-83.patch deleted file mode 100644 index f18dad6c18..0000000000 --- a/patch/kernel/marvell-default/1-patch-3.10.82-83.patch +++ /dev/null @@ -1,1627 +0,0 @@ -diff --git a/Makefile b/Makefile -index 5e3e665a10b7..21529dbcc11d 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,6 +1,6 @@ - VERSION = 3 - PATCHLEVEL = 10 --SUBLEVEL = 82 -+SUBLEVEL = 83 - EXTRAVERSION = - NAME = TOSSUG Baby Fish - -diff --git a/arch/arm/mach-dove/common.c b/arch/arm/mach-dove/common.c -index e2b5da031f96..8d4f5dc56910 100644 ---- a/arch/arm/mach-dove/common.c -+++ b/arch/arm/mach-dove/common.c -@@ -226,7 +226,7 @@ void __init dove_init_early(void) - orion_time_set_base(TIMER_VIRT_BASE); - mvebu_mbus_init("marvell,dove-mbus", - BRIDGE_WINS_BASE, BRIDGE_WINS_SZ, -- DOVE_MC_WINS_BASE, DOVE_MC_WINS_SZ); -+ DOVE_MC_WINS_BASE, DOVE_MC_WINS_SZ, 0); - } - - static int __init dove_find_tclk(void) -diff --git a/arch/arm/mach-imx/clk-imx6q.c b/arch/arm/mach-imx/clk-imx6q.c -index 2acaded8025d..ed00c9e3bfc6 100644 ---- a/arch/arm/mach-imx/clk-imx6q.c -+++ b/arch/arm/mach-imx/clk-imx6q.c -@@ -515,7 +515,7 @@ int __init mx6q_clocks_init(void) - clk[gpmi_io] = imx_clk_gate2("gpmi_io", "enfc", base + 0x78, 28); - clk[gpmi_apb] = imx_clk_gate2("gpmi_apb", "usdhc3", base + 0x78, 30); - clk[rom] = imx_clk_gate2("rom", "ahb", base + 0x7c, 0); -- clk[sata] = imx_clk_gate2("sata", "ipg", base + 0x7c, 4); -+ clk[sata] = imx_clk_gate2("sata", "ahb", base + 0x7c, 4); - clk[sdma] = imx_clk_gate2("sdma", "ahb", base + 0x7c, 6); - clk[spba] = imx_clk_gate2("spba", "ipg", base + 0x7c, 12); - clk[ssi1_ipg] = imx_clk_gate2("ssi1_ipg", "ipg", base + 0x7c, 18); -diff --git a/arch/arm/mach-mv78xx0/common.c b/arch/arm/mach-mv78xx0/common.c -index 749a7f8c4992..4722c98dc1bb 100644 ---- a/arch/arm/mach-mv78xx0/common.c -+++ b/arch/arm/mach-mv78xx0/common.c -@@ -337,11 +337,11 @@ void __init mv78xx0_init_early(void) - if (mv78xx0_core_index() == 0) - mvebu_mbus_init("marvell,mv78xx0-mbus", - BRIDGE_WINS_CPU0_BASE, BRIDGE_WINS_SZ, -- DDR_WINDOW_CPU0_BASE, DDR_WINDOW_CPU_SZ); -+ DDR_WINDOW_CPU0_BASE, DDR_WINDOW_CPU_SZ, 0); - else - mvebu_mbus_init("marvell,mv78xx0-mbus", - BRIDGE_WINS_CPU1_BASE, BRIDGE_WINS_SZ, -- DDR_WINDOW_CPU1_BASE, DDR_WINDOW_CPU_SZ); -+ DDR_WINDOW_CPU1_BASE, DDR_WINDOW_CPU_SZ, 0); - } - - void __init_refok mv78xx0_timer_init(void) -diff --git a/arch/arm/mach-orion5x/common.c b/arch/arm/mach-orion5x/common.c -index f8a6db9239bf..048773926ad4 100644 ---- a/arch/arm/mach-orion5x/common.c -+++ b/arch/arm/mach-orion5x/common.c -@@ -213,7 +213,7 @@ void __init orion5x_init_early(void) - mbus_soc_name = NULL; - mvebu_mbus_init(mbus_soc_name, ORION5X_BRIDGE_WINS_BASE, - ORION5X_BRIDGE_WINS_SZ, -- ORION5X_DDR_WINS_BASE, ORION5X_DDR_WINS_SZ); -+ ORION5X_DDR_WINS_BASE, ORION5X_DDR_WINS_SZ, 0); - } - - void orion5x_setup_wins(void) -diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig -index 4e5b80d883c8..105ae30a176b 100644 ---- a/arch/x86/Kconfig -+++ b/arch/x86/Kconfig -@@ -154,7 +154,7 @@ config SBUS - - config NEED_DMA_MAP_STATE - def_bool y -- depends on X86_64 || INTEL_IOMMU || DMA_API_DEBUG -+ depends on X86_64 || INTEL_IOMMU || DMA_API_DEBUG || SWIOTLB - - config NEED_SG_DMA_LENGTH - def_bool y -diff --git a/arch/x86/kernel/microcode_intel_early.c b/arch/x86/kernel/microcode_intel_early.c -index 2e9e12871c2b..a883942aee44 100644 ---- a/arch/x86/kernel/microcode_intel_early.c -+++ b/arch/x86/kernel/microcode_intel_early.c -@@ -321,7 +321,7 @@ get_matching_model_microcode(int cpu, unsigned long start, - unsigned int mc_saved_count = mc_saved_data->mc_saved_count; - int i; - -- while (leftover) { -+ while (leftover && mc_saved_count < ARRAY_SIZE(mc_saved_tmp)) { - mc_header = (struct microcode_header_intel *)ucode_ptr; - - mc_size = get_totalsize(mc_header); -diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c -index 8bf40a243d75..224d2ef754cc 100644 ---- a/arch/x86/kvm/svm.c -+++ b/arch/x86/kvm/svm.c -@@ -495,8 +495,10 @@ static void skip_emulated_instruction(struct kvm_vcpu *vcpu) - { - struct vcpu_svm *svm = to_svm(vcpu); - -- if (svm->vmcb->control.next_rip != 0) -+ if (svm->vmcb->control.next_rip != 0) { -+ WARN_ON(!static_cpu_has(X86_FEATURE_NRIPS)); - svm->next_rip = svm->vmcb->control.next_rip; -+ } - - if (!svm->next_rip) { - if (emulate_instruction(vcpu, EMULTYPE_SKIP) != -@@ -4229,7 +4231,9 @@ static int svm_check_intercept(struct kvm_vcpu *vcpu, - break; - } - -- vmcb->control.next_rip = info->next_rip; -+ /* TODO: Advertise NRIPS to guest hypervisor unconditionally */ -+ if (static_cpu_has(X86_FEATURE_NRIPS)) -+ vmcb->control.next_rip = info->next_rip; - vmcb->control.exit_code = icpt_info.exit_code; - vmexit = nested_svm_exit_handled(svm); - -diff --git a/drivers/acpi/acpica/acmacros.h b/drivers/acpi/acpica/acmacros.h -index 53666bd9193d..32b0bf32364a 100644 ---- a/drivers/acpi/acpica/acmacros.h -+++ b/drivers/acpi/acpica/acmacros.h -@@ -63,19 +63,15 @@ - #define ACPI_SET64(ptr, val) (*ACPI_CAST64 (ptr) = (u64) (val)) - - /* -- * printf() format helpers -+ * printf() format helper. This macros is a workaround for the difficulties -+ * with emitting 64-bit integers and 64-bit pointers with the same code -+ * for both 32-bit and 64-bit hosts. - */ - - /* Split 64-bit integer into two 32-bit values. Use with %8.8X%8.8X */ - - #define ACPI_FORMAT_UINT64(i) ACPI_HIDWORD(i), ACPI_LODWORD(i) - --#if ACPI_MACHINE_WIDTH == 64 --#define ACPI_FORMAT_NATIVE_UINT(i) ACPI_FORMAT_UINT64(i) --#else --#define ACPI_FORMAT_NATIVE_UINT(i) 0, (i) --#endif -- - /* - * Macros for moving data around to/from buffers that are possibly unaligned. - * If the hardware supports the transfer of unaligned data, just do the store. -diff --git a/drivers/acpi/acpica/dsopcode.c b/drivers/acpi/acpica/dsopcode.c -index e9b13b92ba1e..46a37aeaedae 100644 ---- a/drivers/acpi/acpica/dsopcode.c -+++ b/drivers/acpi/acpica/dsopcode.c -@@ -446,7 +446,7 @@ acpi_ds_eval_region_operands(struct acpi_walk_state *walk_state, - - ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n", - obj_desc, -- ACPI_FORMAT_NATIVE_UINT(obj_desc->region.address), -+ ACPI_FORMAT_UINT64(obj_desc->region.address), - obj_desc->region.length)); - - /* Now the address and length are valid for this opregion */ -@@ -544,7 +544,7 @@ acpi_ds_eval_table_region_operands(struct acpi_walk_state *walk_state, - - ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n", - obj_desc, -- ACPI_FORMAT_NATIVE_UINT(obj_desc->region.address), -+ ACPI_FORMAT_UINT64(obj_desc->region.address), - obj_desc->region.length)); - - /* Now the address and length are valid for this opregion */ -diff --git a/drivers/acpi/acpica/evregion.c b/drivers/acpi/acpica/evregion.c -index 8fab9262d98a..ad698893e829 100644 ---- a/drivers/acpi/acpica/evregion.c -+++ b/drivers/acpi/acpica/evregion.c -@@ -276,7 +276,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, - ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, - "Handler %p (@%p) Address %8.8X%8.8X [%s]\n", - ®ion_obj->region.handler->address_space, handler, -- ACPI_FORMAT_NATIVE_UINT(address), -+ ACPI_FORMAT_UINT64(address), - acpi_ut_get_region_name(region_obj->region. - space_id))); - -diff --git a/drivers/acpi/acpica/exdump.c b/drivers/acpi/acpica/exdump.c -index e5a3c249f7fa..7e6a56fe1d6e 100644 ---- a/drivers/acpi/acpica/exdump.c -+++ b/drivers/acpi/acpica/exdump.c -@@ -621,8 +621,8 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) - acpi_os_printf("\n"); - } else { - acpi_os_printf(" base %8.8X%8.8X Length %X\n", -- ACPI_FORMAT_NATIVE_UINT(obj_desc->region. -- address), -+ ACPI_FORMAT_UINT64(obj_desc->region. -+ address), - obj_desc->region.length); - } - break; -diff --git a/drivers/acpi/acpica/exfldio.c b/drivers/acpi/acpica/exfldio.c -index c84ee956fa4c..dc210c379277 100644 ---- a/drivers/acpi/acpica/exfldio.c -+++ b/drivers/acpi/acpica/exfldio.c -@@ -269,17 +269,15 @@ acpi_ex_access_region(union acpi_operand_object *obj_desc, - } - - ACPI_DEBUG_PRINT_RAW((ACPI_DB_BFIELD, -- " Region [%s:%X], Width %X, ByteBase %X, Offset %X at %p\n", -+ " Region [%s:%X], Width %X, ByteBase %X, Offset %X at %8.8X%8.8X\n", - acpi_ut_get_region_name(rgn_desc->region. - space_id), - rgn_desc->region.space_id, - obj_desc->common_field.access_byte_width, - obj_desc->common_field.base_byte_offset, -- field_datum_byte_offset, ACPI_CAST_PTR(void, -- (rgn_desc-> -- region. -- address + -- region_offset)))); -+ field_datum_byte_offset, -+ ACPI_FORMAT_UINT64(rgn_desc->region.address + -+ region_offset))); - - /* Invoke the appropriate address_space/op_region handler */ - -diff --git a/drivers/acpi/acpica/exregion.c b/drivers/acpi/acpica/exregion.c -index 182abaf045e1..e90c59d35a16 100644 ---- a/drivers/acpi/acpica/exregion.c -+++ b/drivers/acpi/acpica/exregion.c -@@ -176,7 +176,7 @@ acpi_ex_system_memory_space_handler(u32 function, - if (!mem_info->mapped_logical_address) { - ACPI_ERROR((AE_INFO, - "Could not map memory at 0x%8.8X%8.8X, size %u", -- ACPI_FORMAT_NATIVE_UINT(address), -+ ACPI_FORMAT_UINT64(address), - (u32) map_length)); - mem_info->mapped_length = 0; - return_ACPI_STATUS(AE_NO_MEMORY); -@@ -197,8 +197,7 @@ acpi_ex_system_memory_space_handler(u32 function, - - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "System-Memory (width %u) R/W %u Address=%8.8X%8.8X\n", -- bit_width, function, -- ACPI_FORMAT_NATIVE_UINT(address))); -+ bit_width, function, ACPI_FORMAT_UINT64(address))); - - /* - * Perform the memory read or write -@@ -300,8 +299,7 @@ acpi_ex_system_io_space_handler(u32 function, - - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "System-IO (width %u) R/W %u Address=%8.8X%8.8X\n", -- bit_width, function, -- ACPI_FORMAT_NATIVE_UINT(address))); -+ bit_width, function, ACPI_FORMAT_UINT64(address))); - - /* Decode the function parameter */ - -diff --git a/drivers/acpi/acpica/hwvalid.c b/drivers/acpi/acpica/hwvalid.c -index eab70d58852a..fae57584a182 100644 ---- a/drivers/acpi/acpica/hwvalid.c -+++ b/drivers/acpi/acpica/hwvalid.c -@@ -142,17 +142,17 @@ acpi_hw_validate_io_request(acpi_io_address address, u32 bit_width) - byte_width = ACPI_DIV_8(bit_width); - last_address = address + byte_width - 1; - -- ACPI_DEBUG_PRINT((ACPI_DB_IO, "Address %p LastAddress %p Length %X", -- ACPI_CAST_PTR(void, address), ACPI_CAST_PTR(void, -- last_address), -- byte_width)); -+ ACPI_DEBUG_PRINT((ACPI_DB_IO, -+ "Address %8.8X%8.8X LastAddress %8.8X%8.8X Length %X", -+ ACPI_FORMAT_UINT64(address), -+ ACPI_FORMAT_UINT64(last_address), byte_width)); - - /* Maximum 16-bit address in I/O space */ - - if (last_address > ACPI_UINT16_MAX) { - ACPI_ERROR((AE_INFO, -- "Illegal I/O port address/length above 64K: %p/0x%X", -- ACPI_CAST_PTR(void, address), byte_width)); -+ "Illegal I/O port address/length above 64K: %8.8X%8.8X/0x%X", -+ ACPI_FORMAT_UINT64(address), byte_width)); - return_ACPI_STATUS(AE_LIMIT); - } - -@@ -181,8 +181,8 @@ acpi_hw_validate_io_request(acpi_io_address address, u32 bit_width) - - if (acpi_gbl_osi_data >= port_info->osi_dependency) { - ACPI_DEBUG_PRINT((ACPI_DB_IO, -- "Denied AML access to port 0x%p/%X (%s 0x%.4X-0x%.4X)", -- ACPI_CAST_PTR(void, address), -+ "Denied AML access to port 0x%8.8X%8.8X/%X (%s 0x%.4X-0x%.4X)", -+ ACPI_FORMAT_UINT64(address), - byte_width, port_info->name, - port_info->start, - port_info->end)); -diff --git a/drivers/acpi/acpica/nsdump.c b/drivers/acpi/acpica/nsdump.c -index ce6e97326205..20ae5b9bb9f2 100644 ---- a/drivers/acpi/acpica/nsdump.c -+++ b/drivers/acpi/acpica/nsdump.c -@@ -258,12 +258,11 @@ acpi_ns_dump_one_object(acpi_handle obj_handle, - switch (type) { - case ACPI_TYPE_PROCESSOR: - -- acpi_os_printf("ID %02X Len %02X Addr %p\n", -+ acpi_os_printf("ID %02X Len %02X Addr %8.8X%8.8X\n", - obj_desc->processor.proc_id, - obj_desc->processor.length, -- ACPI_CAST_PTR(void, -- obj_desc->processor. -- address)); -+ ACPI_FORMAT_UINT64(obj_desc->processor. -+ address)); - break; - - case ACPI_TYPE_DEVICE: -@@ -334,8 +333,9 @@ acpi_ns_dump_one_object(acpi_handle obj_handle, - space_id)); - if (obj_desc->region.flags & AOPOBJ_DATA_VALID) { - acpi_os_printf(" Addr %8.8X%8.8X Len %.4X\n", -- ACPI_FORMAT_NATIVE_UINT -- (obj_desc->region.address), -+ ACPI_FORMAT_UINT64(obj_desc-> -+ region. -+ address), - obj_desc->region.length); - } else { - acpi_os_printf -diff --git a/drivers/acpi/acpica/tbutils.c b/drivers/acpi/acpica/tbutils.c -index ce3d5db39a9c..5c67b2840c58 100644 ---- a/drivers/acpi/acpica/tbutils.c -+++ b/drivers/acpi/acpica/tbutils.c -@@ -246,16 +246,12 @@ acpi_tb_print_table_header(acpi_physical_address address, - { - struct acpi_table_header local_header; - -- /* -- * The reason that the Address is cast to a void pointer is so that we -- * can use %p which will work properly on both 32-bit and 64-bit hosts. -- */ - if (ACPI_COMPARE_NAME(header->signature, ACPI_SIG_FACS)) { - - /* FACS only has signature and length fields */ - -- ACPI_INFO((AE_INFO, "%4.4s %p %05X", -- header->signature, ACPI_CAST_PTR(void, address), -+ ACPI_INFO((AE_INFO, "%4.4s 0x%8.8X%8.8X %05X", -+ header->signature, ACPI_FORMAT_UINT64(address), - header->length)); - } else if (ACPI_COMPARE_NAME(header->signature, ACPI_SIG_RSDP)) { - -@@ -266,8 +262,8 @@ acpi_tb_print_table_header(acpi_physical_address address, - header)->oem_id, ACPI_OEM_ID_SIZE); - acpi_tb_fix_string(local_header.oem_id, ACPI_OEM_ID_SIZE); - -- ACPI_INFO((AE_INFO, "RSDP %p %05X (v%.2d %6.6s)", -- ACPI_CAST_PTR (void, address), -+ ACPI_INFO((AE_INFO, "RSDP 0x%8.8X%8.8X %05X (v%.2d %6.6s)", -+ ACPI_FORMAT_UINT64(address), - (ACPI_CAST_PTR(struct acpi_table_rsdp, header)-> - revision > - 0) ? ACPI_CAST_PTR(struct acpi_table_rsdp, -@@ -281,8 +277,8 @@ acpi_tb_print_table_header(acpi_physical_address address, - acpi_tb_cleanup_table_header(&local_header, header); - - ACPI_INFO((AE_INFO, -- "%4.4s %p %05X (v%.2d %6.6s %8.8s %08X %4.4s %08X)", -- local_header.signature, ACPI_CAST_PTR(void, address), -+ "%-4.4s 0x%8.8X%8.8X %05X (v%.2d %-6.6s %-8.8s %08X %-4.4s %08X)", -+ local_header.signature, ACPI_FORMAT_UINT64(address), - local_header.length, local_header.revision, - local_header.oem_id, local_header.oem_table_id, - local_header.oem_revision, -@@ -474,8 +470,8 @@ acpi_tb_install_table(acpi_physical_address address, - table = acpi_os_map_memory(address, sizeof(struct acpi_table_header)); - if (!table) { - ACPI_ERROR((AE_INFO, -- "Could not map memory for table [%s] at %p", -- signature, ACPI_CAST_PTR(void, address))); -+ "Could not map memory for table [%s] at %8.8X%8.8X", -+ signature, ACPI_FORMAT_UINT64(address))); - return; - } - -diff --git a/drivers/acpi/acpica/utaddress.c b/drivers/acpi/acpica/utaddress.c -index e0a2e2779c2e..3c7770d75773 100644 ---- a/drivers/acpi/acpica/utaddress.c -+++ b/drivers/acpi/acpica/utaddress.c -@@ -107,10 +107,10 @@ acpi_ut_add_address_range(acpi_adr_space_type space_id, - acpi_gbl_address_range_list[space_id] = range_info; - - ACPI_DEBUG_PRINT((ACPI_DB_NAMES, -- "\nAdded [%4.4s] address range: 0x%p-0x%p\n", -+ "\nAdded [%4.4s] address range: 0x%8.8X%8.8X-0x%8.8X%8.8X\n", - acpi_ut_get_node_name(range_info->region_node), -- ACPI_CAST_PTR(void, address), -- ACPI_CAST_PTR(void, range_info->end_address))); -+ ACPI_FORMAT_UINT64(address), -+ ACPI_FORMAT_UINT64(range_info->end_address))); - - (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); - return_ACPI_STATUS(AE_OK); -@@ -160,15 +160,13 @@ acpi_ut_remove_address_range(acpi_adr_space_type space_id, - } - - ACPI_DEBUG_PRINT((ACPI_DB_NAMES, -- "\nRemoved [%4.4s] address range: 0x%p-0x%p\n", -+ "\nRemoved [%4.4s] address range: 0x%8.8X%8.8X-0x%8.8X%8.8X\n", - acpi_ut_get_node_name(range_info-> - region_node), -- ACPI_CAST_PTR(void, -- range_info-> -- start_address), -- ACPI_CAST_PTR(void, -- range_info-> -- end_address))); -+ ACPI_FORMAT_UINT64(range_info-> -+ start_address), -+ ACPI_FORMAT_UINT64(range_info-> -+ end_address))); - - ACPI_FREE(range_info); - return_VOID; -@@ -244,9 +242,9 @@ acpi_ut_check_address_range(acpi_adr_space_type space_id, - region_node); - - ACPI_WARNING((AE_INFO, -- "0x%p-0x%p %s conflicts with Region %s %d", -- ACPI_CAST_PTR(void, address), -- ACPI_CAST_PTR(void, end_address), -+ "0x%8.8X%8.8X-0x%8.8X%8.8X %s conflicts with Region %s %d", -+ ACPI_FORMAT_UINT64(address), -+ ACPI_FORMAT_UINT64(end_address), - acpi_ut_get_region_name(space_id), - pathname, overlap_count)); - ACPI_FREE(pathname); -diff --git a/drivers/edac/sb_edac.c b/drivers/edac/sb_edac.c -index f505e4ca6d58..3bdefbfb4377 100644 ---- a/drivers/edac/sb_edac.c -+++ b/drivers/edac/sb_edac.c -@@ -623,7 +623,7 @@ static void get_memory_layout(const struct mem_ctl_info *mci) - u32 reg; - u64 limit, prv = 0; - u64 tmp_mb; -- u32 mb, kb; -+ u32 gb, mb; - u32 rir_way; - - /* -@@ -636,8 +636,9 @@ static void get_memory_layout(const struct mem_ctl_info *mci) - pvt->tolm = GET_TOLM(reg); - tmp_mb = (1 + pvt->tolm) >> 20; - -- mb = div_u64_rem(tmp_mb, 1000, &kb); -- edac_dbg(0, "TOLM: %u.%03u GB (0x%016Lx)\n", mb, kb, (u64)pvt->tolm); -+ gb = div_u64_rem(tmp_mb, 1024, &mb); -+ edac_dbg(0, "TOLM: %u.%03u GB (0x%016Lx)\n", -+ gb, (mb*1000)/1024, (u64)pvt->tolm); - - /* Address range is already 45:25 */ - pci_read_config_dword(pvt->pci_sad1, TOHM, -@@ -645,8 +646,9 @@ static void get_memory_layout(const struct mem_ctl_info *mci) - pvt->tohm = GET_TOHM(reg); - tmp_mb = (1 + pvt->tohm) >> 20; - -- mb = div_u64_rem(tmp_mb, 1000, &kb); -- edac_dbg(0, "TOHM: %u.%03u GB (0x%016Lx)\n", mb, kb, (u64)pvt->tohm); -+ gb = div_u64_rem(tmp_mb, 1024, &mb); -+ edac_dbg(0, "TOHM: %u.%03u GB (0x%016Lx)\n", -+ gb, (mb*1000)/1024, (u64)pvt->tohm); - - /* - * Step 2) Get SAD range and SAD Interleave list -@@ -668,11 +670,11 @@ static void get_memory_layout(const struct mem_ctl_info *mci) - break; - - tmp_mb = (limit + 1) >> 20; -- mb = div_u64_rem(tmp_mb, 1000, &kb); -+ gb = div_u64_rem(tmp_mb, 1024, &mb); - edac_dbg(0, "SAD#%d %s up to %u.%03u GB (0x%016Lx) Interleave: %s reg=0x%08x\n", - n_sads, - get_dram_attr(reg), -- mb, kb, -+ gb, (mb*1000)/1024, - ((u64)tmp_mb) << 20L, - INTERLEAVE_MODE(reg) ? "8:6" : "[8:6]XOR[18:16]", - reg); -@@ -702,9 +704,9 @@ static void get_memory_layout(const struct mem_ctl_info *mci) - break; - tmp_mb = (limit + 1) >> 20; - -- mb = div_u64_rem(tmp_mb, 1000, &kb); -+ gb = div_u64_rem(tmp_mb, 1024, &mb); - edac_dbg(0, "TAD#%d: up to %u.%03u GB (0x%016Lx), socket interleave %d, memory interleave %d, TGT: %d, %d, %d, %d, reg=0x%08x\n", -- n_tads, mb, kb, -+ n_tads, gb, (mb*1000)/1024, - ((u64)tmp_mb) << 20L, - (u32)TAD_SOCK(reg), - (u32)TAD_CH(reg), -@@ -727,10 +729,10 @@ static void get_memory_layout(const struct mem_ctl_info *mci) - tad_ch_nilv_offset[j], - ®); - tmp_mb = TAD_OFFSET(reg) >> 20; -- mb = div_u64_rem(tmp_mb, 1000, &kb); -+ gb = div_u64_rem(tmp_mb, 1024, &mb); - edac_dbg(0, "TAD CH#%d, offset #%d: %u.%03u GB (0x%016Lx), reg=0x%08x\n", - i, j, -- mb, kb, -+ gb, (mb*1000)/1024, - ((u64)tmp_mb) << 20L, - reg); - } -@@ -752,10 +754,10 @@ static void get_memory_layout(const struct mem_ctl_info *mci) - - tmp_mb = RIR_LIMIT(reg) >> 20; - rir_way = 1 << RIR_WAY(reg); -- mb = div_u64_rem(tmp_mb, 1000, &kb); -+ gb = div_u64_rem(tmp_mb, 1024, &mb); - edac_dbg(0, "CH#%d RIR#%d, limit: %u.%03u GB (0x%016Lx), way: %d, reg=0x%08x\n", - i, j, -- mb, kb, -+ gb, (mb*1000)/1024, - ((u64)tmp_mb) << 20L, - rir_way, - reg); -@@ -766,10 +768,10 @@ static void get_memory_layout(const struct mem_ctl_info *mci) - ®); - tmp_mb = RIR_OFFSET(reg) << 6; - -- mb = div_u64_rem(tmp_mb, 1000, &kb); -+ gb = div_u64_rem(tmp_mb, 1024, &mb); - edac_dbg(0, "CH#%d RIR#%d INTL#%d, offset %u.%03u GB (0x%016Lx), tgt: %d, reg=0x%08x\n", - i, j, k, -- mb, kb, -+ gb, (mb*1000)/1024, - ((u64)tmp_mb) << 20L, - (u32)RIR_RNK_TGT(reg), - reg); -@@ -806,7 +808,7 @@ static int get_memory_error_data(struct mem_ctl_info *mci, - u8 ch_way,sck_way; - u32 tad_offset; - u32 rir_way; -- u32 mb, kb; -+ u32 mb, gb; - u64 ch_addr, offset, limit, prv = 0; - - -@@ -1022,10 +1024,10 @@ static int get_memory_error_data(struct mem_ctl_info *mci, - continue; - - limit = RIR_LIMIT(reg); -- mb = div_u64_rem(limit >> 20, 1000, &kb); -+ gb = div_u64_rem(limit >> 20, 1024, &mb); - edac_dbg(0, "RIR#%d, limit: %u.%03u GB (0x%016Lx), way: %d\n", - n_rir, -- mb, kb, -+ gb, (mb*1000)/1024, - limit, - 1 << RIR_WAY(reg)); - if (ch_addr <= limit) -diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c -index 62ed744bbe06..a6cdf17e27dc 100644 ---- a/drivers/scsi/hpsa.c -+++ b/drivers/scsi/hpsa.c -@@ -3898,10 +3898,6 @@ static int hpsa_kdump_hard_reset_controller(struct pci_dev *pdev) - - /* Save the PCI command register */ - pci_read_config_word(pdev, 4, &command_register); -- /* Turn the board off. This is so that later pci_restore_state() -- * won't turn the board on before the rest of config space is ready. -- */ -- pci_disable_device(pdev); - pci_save_state(pdev); - - /* find the first memory BAR, so we can find the cfg table */ -@@ -3949,11 +3945,6 @@ static int hpsa_kdump_hard_reset_controller(struct pci_dev *pdev) - goto unmap_cfgtable; - - pci_restore_state(pdev); -- rc = pci_enable_device(pdev); -- if (rc) { -- dev_warn(&pdev->dev, "failed to enable device.\n"); -- goto unmap_cfgtable; -- } - pci_write_config_word(pdev, 4, command_register); - - /* Some devices (notably the HP Smart Array 5i Controller) -@@ -4448,6 +4439,23 @@ static int hpsa_init_reset_devices(struct pci_dev *pdev) - if (!reset_devices) - return 0; - -+ /* kdump kernel is loading, we don't know in which state is -+ * the pci interface. The dev->enable_cnt is equal zero -+ * so we call enable+disable, wait a while and switch it on. -+ */ -+ rc = pci_enable_device(pdev); -+ if (rc) { -+ dev_warn(&pdev->dev, "Failed to enable PCI device\n"); -+ return -ENODEV; -+ } -+ pci_disable_device(pdev); -+ msleep(260); /* a randomly chosen number */ -+ rc = pci_enable_device(pdev); -+ if (rc) { -+ dev_warn(&pdev->dev, "failed to enable device.\n"); -+ return -ENODEV; -+ } -+ pci_set_master(pdev); - /* Reset the controller with a PCI power-cycle or via doorbell */ - rc = hpsa_kdump_hard_reset_controller(pdev); - -@@ -4456,10 +4464,11 @@ static int hpsa_init_reset_devices(struct pci_dev *pdev) - * "performant mode". Or, it might be 640x, which can't reset - * due to concerns about shared bbwc between 6402/6404 pair. - */ -- if (rc == -ENOTSUPP) -- return rc; /* just try to do the kdump anyhow. */ -- if (rc) -- return -ENODEV; -+ if (rc) { -+ if (rc != -ENOTSUPP) /* just try to do the kdump anyhow. */ -+ rc = -ENODEV; -+ goto out_disable; -+ } - - /* Now try to get the controller to respond to a no-op */ - dev_warn(&pdev->dev, "Waiting for controller to respond to no-op\n"); -@@ -4470,7 +4479,11 @@ static int hpsa_init_reset_devices(struct pci_dev *pdev) - dev_warn(&pdev->dev, "no-op failed%s\n", - (i < 11 ? "; re-trying" : "")); - } -- return 0; -+ -+out_disable: -+ -+ pci_disable_device(pdev); -+ return rc; - } - - static int hpsa_allocate_cmd_pool(struct ctlr_info *h) -@@ -4613,6 +4626,7 @@ static void hpsa_undo_allocations_after_kdump_soft_reset(struct ctlr_info *h) - iounmap(h->transtable); - if (h->cfgtable) - iounmap(h->cfgtable); -+ pci_disable_device(h->pdev); - pci_release_regions(h->pdev); - kfree(h); - } -diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c -index 7fb054ba1b60..82f14a1da542 100644 ---- a/fs/btrfs/ctree.c -+++ b/fs/btrfs/ctree.c -@@ -2769,7 +2769,7 @@ done: - */ - if (!p->leave_spinning) - btrfs_set_path_blocking(p); -- if (ret < 0) -+ if (ret < 0 && !p->skip_release_on_error) - btrfs_release_path(p); - return ret; - } -diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h -index d6dd49b51ba8..c19444e412be 100644 ---- a/fs/btrfs/ctree.h -+++ b/fs/btrfs/ctree.h -@@ -586,6 +586,7 @@ struct btrfs_path { - unsigned int skip_locking:1; - unsigned int leave_spinning:1; - unsigned int search_commit_root:1; -+ unsigned int skip_release_on_error:1; - }; - - /* -@@ -3406,6 +3407,10 @@ struct btrfs_dir_item *btrfs_lookup_xattr(struct btrfs_trans_handle *trans, - int verify_dir_item(struct btrfs_root *root, - struct extent_buffer *leaf, - struct btrfs_dir_item *dir_item); -+struct btrfs_dir_item *btrfs_match_dir_item_name(struct btrfs_root *root, -+ struct btrfs_path *path, -+ const char *name, -+ int name_len); - - /* orphan.c */ - int btrfs_insert_orphan_item(struct btrfs_trans_handle *trans, -diff --git a/fs/btrfs/dir-item.c b/fs/btrfs/dir-item.c -index 79e594e341c7..6f61b9b1526f 100644 ---- a/fs/btrfs/dir-item.c -+++ b/fs/btrfs/dir-item.c -@@ -21,10 +21,6 @@ - #include "hash.h" - #include "transaction.h" - --static struct btrfs_dir_item *btrfs_match_dir_item_name(struct btrfs_root *root, -- struct btrfs_path *path, -- const char *name, int name_len); -- - /* - * insert a name into a directory, doing overflow properly if there is a hash - * collision. data_size indicates how big the item inserted should be. On -@@ -383,9 +379,9 @@ struct btrfs_dir_item *btrfs_lookup_xattr(struct btrfs_trans_handle *trans, - * this walks through all the entries in a dir item and finds one - * for a specific name. - */ --static struct btrfs_dir_item *btrfs_match_dir_item_name(struct btrfs_root *root, -- struct btrfs_path *path, -- const char *name, int name_len) -+struct btrfs_dir_item *btrfs_match_dir_item_name(struct btrfs_root *root, -+ struct btrfs_path *path, -+ const char *name, int name_len) - { - struct btrfs_dir_item *dir_item; - unsigned long name_ptr; -diff --git a/fs/btrfs/xattr.c b/fs/btrfs/xattr.c -index 05740b9789e4..9cf20d63cc99 100644 ---- a/fs/btrfs/xattr.c -+++ b/fs/btrfs/xattr.c -@@ -27,6 +27,7 @@ - #include "transaction.h" - #include "xattr.h" - #include "disk-io.h" -+#include "locking.h" - - - ssize_t __btrfs_getxattr(struct inode *inode, const char *name, -@@ -89,7 +90,7 @@ static int do_setxattr(struct btrfs_trans_handle *trans, - struct inode *inode, const char *name, - const void *value, size_t size, int flags) - { -- struct btrfs_dir_item *di; -+ struct btrfs_dir_item *di = NULL; - struct btrfs_root *root = BTRFS_I(inode)->root; - struct btrfs_path *path; - size_t name_len = strlen(name); -@@ -101,84 +102,128 @@ static int do_setxattr(struct btrfs_trans_handle *trans, - path = btrfs_alloc_path(); - if (!path) - return -ENOMEM; -+ path->skip_release_on_error = 1; -+ -+ if (!value) { -+ di = btrfs_lookup_xattr(trans, root, path, btrfs_ino(inode), -+ name, name_len, -1); -+ if (!di && (flags & XATTR_REPLACE)) -+ ret = -ENODATA; -+ else if (di) -+ ret = btrfs_delete_one_dir_name(trans, root, path, di); -+ goto out; -+ } - -+ /* -+ * For a replace we can't just do the insert blindly. -+ * Do a lookup first (read-only btrfs_search_slot), and return if xattr -+ * doesn't exist. If it exists, fall down below to the insert/replace -+ * path - we can't race with a concurrent xattr delete, because the VFS -+ * locks the inode's i_mutex before calling setxattr or removexattr. -+ */ - if (flags & XATTR_REPLACE) { -- di = btrfs_lookup_xattr(trans, root, path, btrfs_ino(inode), name, -- name_len, -1); -- if (IS_ERR(di)) { -- ret = PTR_ERR(di); -- goto out; -- } else if (!di) { -+ if(!mutex_is_locked(&inode->i_mutex)) { -+ pr_err("BTRFS: assertion failed: %s, file: %s, line: %d", -+ "mutex_is_locked(&inode->i_mutex)", __FILE__, -+ __LINE__); -+ BUG(); -+ } -+ di = btrfs_lookup_xattr(NULL, root, path, btrfs_ino(inode), -+ name, name_len, 0); -+ if (!di) { - ret = -ENODATA; - goto out; - } -- ret = btrfs_delete_one_dir_name(trans, root, path, di); -- if (ret) -- goto out; - btrfs_release_path(path); -+ di = NULL; -+ } - -+ ret = btrfs_insert_xattr_item(trans, root, path, btrfs_ino(inode), -+ name, name_len, value, size); -+ if (ret == -EOVERFLOW) { - /* -- * remove the attribute -+ * We have an existing item in a leaf, split_leaf couldn't -+ * expand it. That item might have or not a dir_item that -+ * matches our target xattr, so lets check. - */ -- if (!value) -- goto out; -- } else { -- di = btrfs_lookup_xattr(NULL, root, path, btrfs_ino(inode), -- name, name_len, 0); -- if (IS_ERR(di)) { -- ret = PTR_ERR(di); -+ ret = 0; -+ btrfs_assert_tree_locked(path->nodes[0]); -+ di = btrfs_match_dir_item_name(root, path, name, name_len); -+ if (!di && !(flags & XATTR_REPLACE)) { -+ ret = -ENOSPC; - goto out; - } -- if (!di && !value) -- goto out; -- btrfs_release_path(path); -+ } else if (ret == -EEXIST) { -+ ret = 0; -+ di = btrfs_match_dir_item_name(root, path, name, name_len); -+ if(!di) { /* logic error */ -+ pr_err("BTRFS: assertion failed: %s, file: %s, line: %d", -+ "di", __FILE__, __LINE__); -+ BUG(); -+ } -+ } else if (ret) { -+ goto out; - } - --again: -- ret = btrfs_insert_xattr_item(trans, root, path, btrfs_ino(inode), -- name, name_len, value, size); -- /* -- * If we're setting an xattr to a new value but the new value is say -- * exactly BTRFS_MAX_XATTR_SIZE, we could end up with EOVERFLOW getting -- * back from split_leaf. This is because it thinks we'll be extending -- * the existing item size, but we're asking for enough space to add the -- * item itself. So if we get EOVERFLOW just set ret to EEXIST and let -- * the rest of the function figure it out. -- */ -- if (ret == -EOVERFLOW) -+ if (di && (flags & XATTR_CREATE)) { - ret = -EEXIST; -+ goto out; -+ } - -- if (ret == -EEXIST) { -- if (flags & XATTR_CREATE) -- goto out; -+ if (di) { - /* -- * We can't use the path we already have since we won't have the -- * proper locking for a delete, so release the path and -- * re-lookup to delete the thing. -+ * We're doing a replace, and it must be atomic, that is, at -+ * any point in time we have either the old or the new xattr -+ * value in the tree. We don't want readers (getxattr and -+ * listxattrs) to miss a value, this is specially important -+ * for ACLs. - */ -- btrfs_release_path(path); -- di = btrfs_lookup_xattr(trans, root, path, btrfs_ino(inode), -- name, name_len, -1); -- if (IS_ERR(di)) { -- ret = PTR_ERR(di); -- goto out; -- } else if (!di) { -- /* Shouldn't happen but just in case... */ -- btrfs_release_path(path); -- goto again; -+ const int slot = path->slots[0]; -+ struct extent_buffer *leaf = path->nodes[0]; -+ const u16 old_data_len = btrfs_dir_data_len(leaf, di); -+ const u32 item_size = btrfs_item_size_nr(leaf, slot); -+ const u32 data_size = sizeof(*di) + name_len + size; -+ struct btrfs_item *item; -+ unsigned long data_ptr; -+ char *ptr; -+ -+ if (size > old_data_len) { -+ if (btrfs_leaf_free_space(root, leaf) < -+ (size - old_data_len)) { -+ ret = -ENOSPC; -+ goto out; -+ } - } - -- ret = btrfs_delete_one_dir_name(trans, root, path, di); -- if (ret) -- goto out; -+ if (old_data_len + name_len + sizeof(*di) == item_size) { -+ /* No other xattrs packed in the same leaf item. */ -+ if (size > old_data_len) -+ btrfs_extend_item(root, path, -+ size - old_data_len); -+ else if (size < old_data_len) -+ btrfs_truncate_item(root, path, data_size, 1); -+ } else { -+ /* There are other xattrs packed in the same item. */ -+ ret = btrfs_delete_one_dir_name(trans, root, path, di); -+ if (ret) -+ goto out; -+ btrfs_extend_item(root, path, data_size); -+ } - -+ item = btrfs_item_nr(NULL, slot); -+ ptr = btrfs_item_ptr(leaf, slot, char); -+ ptr += btrfs_item_size(leaf, item) - data_size; -+ di = (struct btrfs_dir_item *)ptr; -+ btrfs_set_dir_data_len(leaf, di, size); -+ data_ptr = ((unsigned long)(di + 1)) + name_len; -+ write_extent_buffer(leaf, value, data_ptr, size); -+ btrfs_mark_buffer_dirty(leaf); -+ } else { - /* -- * We have a value to set, so go back and try to insert it now. -+ * Insert, and we had space for the xattr, so path->slots[0] is -+ * where our xattr dir_item is and btrfs_insert_xattr_item() -+ * filled it. - */ -- if (value) { -- btrfs_release_path(path); -- goto again; -- } - } - out: - btrfs_free_path(path); -diff --git a/fs/dcache.c b/fs/dcache.c -index e2800926ae05..38c4a302fab4 100644 ---- a/fs/dcache.c -+++ b/fs/dcache.c -@@ -1053,13 +1053,13 @@ ascend: - /* might go back up the wrong parent if we have had a rename. */ - if (!locked && read_seqretry(&rename_lock, seq)) - goto rename_retry; -- next = child->d_child.next; -- while (unlikely(child->d_flags & DCACHE_DENTRY_KILLED)) { -+ /* go into the first sibling still alive */ -+ do { -+ next = child->d_child.next; - if (next == &this_parent->d_subdirs) - goto ascend; - child = list_entry(next, struct dentry, d_child); -- next = next->next; -- } -+ } while (unlikely(child->d_flags & DCACHE_DENTRY_KILLED)); - rcu_read_unlock(); - goto resume; - } -@@ -2977,13 +2977,13 @@ ascend: - /* might go back up the wrong parent if we have had a rename. */ - if (!locked && read_seqretry(&rename_lock, seq)) - goto rename_retry; -- next = child->d_child.next; -- while (unlikely(child->d_flags & DCACHE_DENTRY_KILLED)) { -+ /* go into the first sibling still alive */ -+ do { -+ next = child->d_child.next; - if (next == &this_parent->d_subdirs) - goto ascend; - child = list_entry(next, struct dentry, d_child); -- next = next->next; -- } -+ } while (unlikely(child->d_flags & DCACHE_DENTRY_KILLED)); - rcu_read_unlock(); - goto resume; - } -diff --git a/fs/exec.c b/fs/exec.c -index dd6aa61c8548..acbd7ac2deda 100644 ---- a/fs/exec.c -+++ b/fs/exec.c -@@ -1265,6 +1265,53 @@ static int check_unsafe_exec(struct linux_binprm *bprm) - return res; - } - -+static void bprm_fill_uid(struct linux_binprm *bprm) -+{ -+ struct inode *inode; -+ unsigned int mode; -+ kuid_t uid; -+ kgid_t gid; -+ -+ /* clear any previous set[ug]id data from a previous binary */ -+ bprm->cred->euid = current_euid(); -+ bprm->cred->egid = current_egid(); -+ -+ if (bprm->file->f_path.mnt->mnt_flags & MNT_NOSUID) -+ return; -+ -+ if (current->no_new_privs) -+ return; -+ -+ inode = file_inode(bprm->file); -+ mode = ACCESS_ONCE(inode->i_mode); -+ if (!(mode & (S_ISUID|S_ISGID))) -+ return; -+ -+ /* Be careful if suid/sgid is set */ -+ mutex_lock(&inode->i_mutex); -+ -+ /* reload atomically mode/uid/gid now that lock held */ -+ mode = inode->i_mode; -+ uid = inode->i_uid; -+ gid = inode->i_gid; -+ mutex_unlock(&inode->i_mutex); -+ -+ /* We ignore suid/sgid if there are no mappings for them in the ns */ -+ if (!kuid_has_mapping(bprm->cred->user_ns, uid) || -+ !kgid_has_mapping(bprm->cred->user_ns, gid)) -+ return; -+ -+ if (mode & S_ISUID) { -+ bprm->per_clear |= PER_CLEAR_ON_SETID; -+ bprm->cred->euid = uid; -+ } -+ -+ if ((mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP)) { -+ bprm->per_clear |= PER_CLEAR_ON_SETID; -+ bprm->cred->egid = gid; -+ } -+} -+ - /* - * Fill the binprm structure from the inode. - * Check permissions, then read the first 128 (BINPRM_BUF_SIZE) bytes -@@ -1273,39 +1320,12 @@ static int check_unsafe_exec(struct linux_binprm *bprm) - */ - int prepare_binprm(struct linux_binprm *bprm) - { -- umode_t mode; -- struct inode * inode = file_inode(bprm->file); - int retval; - -- mode = inode->i_mode; - if (bprm->file->f_op == NULL) - return -EACCES; - -- /* clear any previous set[ug]id data from a previous binary */ -- bprm->cred->euid = current_euid(); -- bprm->cred->egid = current_egid(); -- -- if (!(bprm->file->f_path.mnt->mnt_flags & MNT_NOSUID) && -- !current->no_new_privs && -- kuid_has_mapping(bprm->cred->user_ns, inode->i_uid) && -- kgid_has_mapping(bprm->cred->user_ns, inode->i_gid)) { -- /* Set-uid? */ -- if (mode & S_ISUID) { -- bprm->per_clear |= PER_CLEAR_ON_SETID; -- bprm->cred->euid = inode->i_uid; -- } -- -- /* Set-gid? */ -- /* -- * If setgid is set but no group execute bit then this -- * is a candidate for mandatory locking, not a setgid -- * executable. -- */ -- if ((mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP)) { -- bprm->per_clear |= PER_CLEAR_ON_SETID; -- bprm->cred->egid = inode->i_gid; -- } -- } -+ bprm_fill_uid(bprm); - - /* fill in binprm security blob */ - retval = security_bprm_set_creds(bprm); -diff --git a/fs/file_table.c b/fs/file_table.c -index 54a34be444f9..28f02a7cbba1 100644 ---- a/fs/file_table.c -+++ b/fs/file_table.c -@@ -36,8 +36,6 @@ struct files_stat_struct files_stat = { - .max_files = NR_FILE - }; - --DEFINE_STATIC_LGLOCK(files_lglock); -- - /* SLAB cache for file structures */ - static struct kmem_cache *filp_cachep __read_mostly; - -@@ -134,7 +132,6 @@ struct file *get_empty_filp(void) - return ERR_PTR(error); - } - -- INIT_LIST_HEAD(&f->f_u.fu_list); - atomic_long_set(&f->f_count, 1); - rwlock_init(&f->f_owner.lock); - spin_lock_init(&f->f_lock); -@@ -265,18 +262,15 @@ static void __fput(struct file *file) - mntput(mnt); - } - --static DEFINE_SPINLOCK(delayed_fput_lock); --static LIST_HEAD(delayed_fput_list); -+static LLIST_HEAD(delayed_fput_list); - static void delayed_fput(struct work_struct *unused) - { -- LIST_HEAD(head); -- spin_lock_irq(&delayed_fput_lock); -- list_splice_init(&delayed_fput_list, &head); -- spin_unlock_irq(&delayed_fput_lock); -- while (!list_empty(&head)) { -- struct file *f = list_first_entry(&head, struct file, f_u.fu_list); -- list_del_init(&f->f_u.fu_list); -- __fput(f); -+ struct llist_node *node = llist_del_all(&delayed_fput_list); -+ struct llist_node *next; -+ -+ for (; node; node = next) { -+ next = llist_next(node); -+ __fput(llist_entry(node, struct file, f_u.fu_llist)); - } - } - -@@ -306,18 +300,15 @@ void fput(struct file *file) - { - if (atomic_long_dec_and_test(&file->f_count)) { - struct task_struct *task = current; -- unsigned long flags; - -- file_sb_list_del(file); - if (likely(!in_interrupt() && !(task->flags & PF_KTHREAD))) { - init_task_work(&file->f_u.fu_rcuhead, ____fput); - if (!task_work_add(task, &file->f_u.fu_rcuhead, true)) - return; - } -- spin_lock_irqsave(&delayed_fput_lock, flags); -- list_add(&file->f_u.fu_list, &delayed_fput_list); -- schedule_work(&delayed_fput_work); -- spin_unlock_irqrestore(&delayed_fput_lock, flags); -+ -+ if (llist_add(&file->f_u.fu_llist, &delayed_fput_list)) -+ schedule_work(&delayed_fput_work); - } - } - -@@ -333,7 +324,6 @@ void __fput_sync(struct file *file) - { - if (atomic_long_dec_and_test(&file->f_count)) { - struct task_struct *task = current; -- file_sb_list_del(file); - BUG_ON(!(task->flags & PF_KTHREAD)); - __fput(file); - } -@@ -345,127 +335,10 @@ void put_filp(struct file *file) - { - if (atomic_long_dec_and_test(&file->f_count)) { - security_file_free(file); -- file_sb_list_del(file); - file_free(file); - } - } - --static inline int file_list_cpu(struct file *file) --{ --#ifdef CONFIG_SMP -- return file->f_sb_list_cpu; --#else -- return smp_processor_id(); --#endif --} -- --/* helper for file_sb_list_add to reduce ifdefs */ --static inline void __file_sb_list_add(struct file *file, struct super_block *sb) --{ -- struct list_head *list; --#ifdef CONFIG_SMP -- int cpu; -- cpu = smp_processor_id(); -- file->f_sb_list_cpu = cpu; -- list = per_cpu_ptr(sb->s_files, cpu); --#else -- list = &sb->s_files; --#endif -- list_add(&file->f_u.fu_list, list); --} -- --/** -- * file_sb_list_add - add a file to the sb's file list -- * @file: file to add -- * @sb: sb to add it to -- * -- * Use this function to associate a file with the superblock of the inode it -- * refers to. -- */ --void file_sb_list_add(struct file *file, struct super_block *sb) --{ -- lg_local_lock(&files_lglock); -- __file_sb_list_add(file, sb); -- lg_local_unlock(&files_lglock); --} -- --/** -- * file_sb_list_del - remove a file from the sb's file list -- * @file: file to remove -- * @sb: sb to remove it from -- * -- * Use this function to remove a file from its superblock. -- */ --void file_sb_list_del(struct file *file) --{ -- if (!list_empty(&file->f_u.fu_list)) { -- lg_local_lock_cpu(&files_lglock, file_list_cpu(file)); -- list_del_init(&file->f_u.fu_list); -- lg_local_unlock_cpu(&files_lglock, file_list_cpu(file)); -- } --} -- --#ifdef CONFIG_SMP -- --/* -- * These macros iterate all files on all CPUs for a given superblock. -- * files_lglock must be held globally. -- */ --#define do_file_list_for_each_entry(__sb, __file) \ --{ \ -- int i; \ -- for_each_possible_cpu(i) { \ -- struct list_head *list; \ -- list = per_cpu_ptr((__sb)->s_files, i); \ -- list_for_each_entry((__file), list, f_u.fu_list) -- --#define while_file_list_for_each_entry \ -- } \ --} -- --#else -- --#define do_file_list_for_each_entry(__sb, __file) \ --{ \ -- struct list_head *list; \ -- list = &(sb)->s_files; \ -- list_for_each_entry((__file), list, f_u.fu_list) -- --#define while_file_list_for_each_entry \ --} -- --#endif -- --/** -- * mark_files_ro - mark all files read-only -- * @sb: superblock in question -- * -- * All files are marked read-only. We don't care about pending -- * delete files so this should be used in 'force' mode only. -- */ --void mark_files_ro(struct super_block *sb) --{ -- struct file *f; -- -- lg_global_lock(&files_lglock); -- do_file_list_for_each_entry(sb, f) { -- if (!S_ISREG(file_inode(f)->i_mode)) -- continue; -- if (!file_count(f)) -- continue; -- if (!(f->f_mode & FMODE_WRITE)) -- continue; -- spin_lock(&f->f_lock); -- f->f_mode &= ~FMODE_WRITE; -- spin_unlock(&f->f_lock); -- if (file_check_writeable(f) != 0) -- continue; -- __mnt_drop_write(f->f_path.mnt); -- file_release_write(f); -- } while_file_list_for_each_entry; -- lg_global_unlock(&files_lglock); --} -- - void __init files_init(unsigned long mempages) - { - unsigned long n; -@@ -481,6 +354,5 @@ void __init files_init(unsigned long mempages) - n = (mempages * (PAGE_SIZE / 1024)) / 10; - files_stat.max_files = max_t(unsigned long, n, NR_FILE); - files_defer_init(); -- lg_lock_init(&files_lglock, "files_lglock"); - percpu_counter_init(&nr_files, 0); - } -diff --git a/fs/internal.h b/fs/internal.h -index 68121584ae37..2ffa65a36ca0 100644 ---- a/fs/internal.h -+++ b/fs/internal.h -@@ -74,9 +74,6 @@ extern void chroot_fs_refs(const struct path *, const struct path *); - /* - * file_table.c - */ --extern void file_sb_list_add(struct file *f, struct super_block *sb); --extern void file_sb_list_del(struct file *f); --extern void mark_files_ro(struct super_block *); - extern struct file *get_empty_filp(void); - - /* -diff --git a/fs/open.c b/fs/open.c -index 86092bde31f4..5f129683b7d7 100644 ---- a/fs/open.c -+++ b/fs/open.c -@@ -674,7 +674,6 @@ static int do_dentry_open(struct file *f, - } - - f->f_mapping = inode->i_mapping; -- file_sb_list_add(f, inode->i_sb); - - if (unlikely(f->f_mode & FMODE_PATH)) { - f->f_op = &empty_fops; -@@ -709,7 +708,6 @@ static int do_dentry_open(struct file *f, - - cleanup_all: - fops_put(f->f_op); -- file_sb_list_del(f); - if (f->f_mode & FMODE_WRITE) { - if (!special_file(inode->i_mode)) { - /* -diff --git a/fs/super.c b/fs/super.c -index e028b508db25..97280e76179c 100644 ---- a/fs/super.c -+++ b/fs/super.c -@@ -163,19 +163,6 @@ static struct super_block *alloc_super(struct file_system_type *type, int flags) - s = NULL; - goto out; - } --#ifdef CONFIG_SMP -- s->s_files = alloc_percpu(struct list_head); -- if (!s->s_files) -- goto err_out; -- else { -- int i; -- -- for_each_possible_cpu(i) -- INIT_LIST_HEAD(per_cpu_ptr(s->s_files, i)); -- } --#else -- INIT_LIST_HEAD(&s->s_files); --#endif - if (init_sb_writers(s, type)) - goto err_out; - s->s_flags = flags; -@@ -225,10 +212,6 @@ out: - return s; - err_out: - security_sb_free(s); --#ifdef CONFIG_SMP -- if (s->s_files) -- free_percpu(s->s_files); --#endif - destroy_sb_writers(s); - kfree(s); - s = NULL; -@@ -243,9 +226,6 @@ err_out: - */ - static inline void destroy_super(struct super_block *s) - { --#ifdef CONFIG_SMP -- free_percpu(s->s_files); --#endif - destroy_sb_writers(s); - security_sb_free(s); - WARN_ON(!list_empty(&s->s_mounts)); -@@ -727,7 +707,8 @@ int do_remount_sb(struct super_block *sb, int flags, void *data, int force) - make sure there are no rw files opened */ - if (remount_ro) { - if (force) { -- mark_files_ro(sb); -+ sb->s_readonly_remount = 1; -+ smp_wmb(); - } else { - retval = sb_prepare_remount_readonly(sb); - if (retval) -diff --git a/include/linux/fs.h b/include/linux/fs.h -index d57bc5df7225..5c9dc8471da5 100644 ---- a/include/linux/fs.h -+++ b/include/linux/fs.h -@@ -10,6 +10,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -761,12 +762,8 @@ static inline int ra_has_index(struct file_ra_state *ra, pgoff_t index) - #define FILE_MNT_WRITE_RELEASED 2 - - struct file { -- /* -- * fu_list becomes invalid after file_free is called and queued via -- * fu_rcuhead for RCU freeing -- */ - union { -- struct list_head fu_list; -+ struct llist_node fu_llist; - struct rcu_head fu_rcuhead; - } f_u; - struct path f_path; -@@ -779,9 +776,6 @@ struct file { - * Must not be taken from IRQ context. - */ - spinlock_t f_lock; --#ifdef CONFIG_SMP -- int f_sb_list_cpu; --#endif - atomic_long_t f_count; - unsigned int f_flags; - fmode_t f_mode; -@@ -1257,11 +1251,6 @@ struct super_block { - - struct list_head s_inodes; /* all inodes */ - struct hlist_bl_head s_anon; /* anonymous dentries for (nfs) exporting */ --#ifdef CONFIG_SMP -- struct list_head __percpu *s_files; --#else -- struct list_head s_files; --#endif - struct list_head s_mounts; /* list of mounts; _not_ for fs use */ - /* s_dentry_lru, s_nr_dentry_unused protected by dcache.c lru locks */ - struct list_head s_dentry_lru; /* unused dentry lru */ -diff --git a/include/linux/sched.h b/include/linux/sched.h -index 00c1d4f45072..7cf305d036db 100644 ---- a/include/linux/sched.h -+++ b/include/linux/sched.h -@@ -2203,15 +2203,15 @@ static inline bool thread_group_leader(struct task_struct *p) - * all we care about is that we have a task with the appropriate - * pid, we don't actually care if we have the right task. - */ --static inline int has_group_leader_pid(struct task_struct *p) -+static inline bool has_group_leader_pid(struct task_struct *p) - { -- return p->pid == p->tgid; -+ return task_pid(p) == p->signal->leader_pid; - } - - static inline --int same_thread_group(struct task_struct *p1, struct task_struct *p2) -+bool same_thread_group(struct task_struct *p1, struct task_struct *p2) - { -- return p1->tgid == p2->tgid; -+ return p1->signal == p2->signal; - } - - static inline struct task_struct *next_thread(const struct task_struct *p) -diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h -index 665e0cee59bd..5e661a979694 100644 ---- a/include/net/ip6_fib.h -+++ b/include/net/ip6_fib.h -@@ -301,7 +301,7 @@ extern void inet6_rt_notify(int event, struct rt6_info *rt, - struct nl_info *info); - - extern void fib6_run_gc(unsigned long expires, -- struct net *net); -+ struct net *net, bool force); - - extern void fib6_gc_cleanup(void); - -diff --git a/kernel/ptrace.c b/kernel/ptrace.c -index 118323bc8529..30ab20623bca 100644 ---- a/kernel/ptrace.c -+++ b/kernel/ptrace.c -@@ -236,7 +236,7 @@ static int __ptrace_may_access(struct task_struct *task, unsigned int mode) - */ - int dumpable = 0; - /* Don't let security modules deny introspection */ -- if (task == current) -+ if (same_thread_group(task, current)) - return 0; - rcu_read_lock(); - tcred = __task_cred(task); -diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c -index 9a459be24af7..9b5b5ddf8cd4 100644 ---- a/net/ipv4/xfrm4_policy.c -+++ b/net/ipv4/xfrm4_policy.c -@@ -235,7 +235,7 @@ static struct dst_ops xfrm4_dst_ops = { - .destroy = xfrm4_dst_destroy, - .ifdown = xfrm4_dst_ifdown, - .local_out = __ip_local_out, -- .gc_thresh = 1024, -+ .gc_thresh = 32768, - }; - - static struct xfrm_policy_afinfo xfrm4_policy_afinfo = { -diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c -index ceeb9458bb60..46458ee31939 100644 ---- a/net/ipv6/ip6_fib.c -+++ b/net/ipv6/ip6_fib.c -@@ -1648,27 +1648,28 @@ static int fib6_age(struct rt6_info *rt, void *arg) - - static DEFINE_SPINLOCK(fib6_gc_lock); - --void fib6_run_gc(unsigned long expires, struct net *net) -+void fib6_run_gc(unsigned long expires, struct net *net, bool force) - { -- if (expires != ~0UL) { -+ unsigned long now; -+ -+ if (force) { - spin_lock_bh(&fib6_gc_lock); -- gc_args.timeout = expires ? (int)expires : -- net->ipv6.sysctl.ip6_rt_gc_interval; -- } else { -- if (!spin_trylock_bh(&fib6_gc_lock)) { -- mod_timer(&net->ipv6.ip6_fib_timer, jiffies + HZ); -- return; -- } -- gc_args.timeout = net->ipv6.sysctl.ip6_rt_gc_interval; -+ } else if (!spin_trylock_bh(&fib6_gc_lock)) { -+ mod_timer(&net->ipv6.ip6_fib_timer, jiffies + HZ); -+ return; - } -+ gc_args.timeout = expires ? (int)expires : -+ net->ipv6.sysctl.ip6_rt_gc_interval; - - gc_args.more = icmp6_dst_gc(); - - fib6_clean_all(net, fib6_age, 0, NULL); -+ now = jiffies; -+ net->ipv6.ip6_rt_last_gc = now; - - if (gc_args.more) - mod_timer(&net->ipv6.ip6_fib_timer, -- round_jiffies(jiffies -+ round_jiffies(now - + net->ipv6.sysctl.ip6_rt_gc_interval)); - else - del_timer(&net->ipv6.ip6_fib_timer); -@@ -1677,7 +1678,7 @@ void fib6_run_gc(unsigned long expires, struct net *net) - - static void fib6_gc_timer_cb(unsigned long arg) - { -- fib6_run_gc(0, (struct net *)arg); -+ fib6_run_gc(0, (struct net *)arg, true); - } - - static int __net_init fib6_net_init(struct net *net) -diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c -index 05f361338c2e..deedf7ddbc6e 100644 ---- a/net/ipv6/ndisc.c -+++ b/net/ipv6/ndisc.c -@@ -1584,7 +1584,7 @@ static int ndisc_netdev_event(struct notifier_block *this, unsigned long event, - switch (event) { - case NETDEV_CHANGEADDR: - neigh_changeaddr(&nd_tbl, dev); -- fib6_run_gc(~0UL, net); -+ fib6_run_gc(0, net, false); - idev = in6_dev_get(dev); - if (!idev) - break; -@@ -1594,7 +1594,7 @@ static int ndisc_netdev_event(struct notifier_block *this, unsigned long event, - break; - case NETDEV_DOWN: - neigh_ifdown(&nd_tbl, dev); -- fib6_run_gc(~0UL, net); -+ fib6_run_gc(0, net, false); - break; - case NETDEV_NOTIFY_PEERS: - ndisc_send_unsol_na(dev); -diff --git a/net/ipv6/route.c b/net/ipv6/route.c -index d94d224f7e68..6ebefd46f718 100644 ---- a/net/ipv6/route.c -+++ b/net/ipv6/route.c -@@ -1334,7 +1334,6 @@ static void icmp6_clean_all(int (*func)(struct rt6_info *rt, void *arg), - - static int ip6_dst_gc(struct dst_ops *ops) - { -- unsigned long now = jiffies; - struct net *net = container_of(ops, struct net, ipv6.ip6_dst_ops); - int rt_min_interval = net->ipv6.sysctl.ip6_rt_gc_min_interval; - int rt_max_size = net->ipv6.sysctl.ip6_rt_max_size; -@@ -1344,13 +1343,12 @@ static int ip6_dst_gc(struct dst_ops *ops) - int entries; - - entries = dst_entries_get_fast(ops); -- if (time_after(rt_last_gc + rt_min_interval, now) && -+ if (time_after(rt_last_gc + rt_min_interval, jiffies) && - entries <= rt_max_size) - goto out; - - net->ipv6.ip6_rt_gc_expire++; -- fib6_run_gc(net->ipv6.ip6_rt_gc_expire, net); -- net->ipv6.ip6_rt_last_gc = now; -+ fib6_run_gc(net->ipv6.ip6_rt_gc_expire, net, entries > rt_max_size); - entries = dst_entries_get_slow(ops); - if (entries < ops->gc_thresh) - net->ipv6.ip6_rt_gc_expire = rt_gc_timeout>>1; -@@ -2849,7 +2847,7 @@ int ipv6_sysctl_rtcache_flush(ctl_table *ctl, int write, - net = (struct net *)ctl->extra1; - delay = net->ipv6.sysctl.flush_delay; - proc_dointvec(ctl, write, buffer, lenp, ppos); -- fib6_run_gc(delay <= 0 ? ~0UL : (unsigned long)delay, net); -+ fib6_run_gc(delay <= 0 ? 0 : (unsigned long)delay, net, delay > 0); - return 0; - } - -diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c -index 23ed03d786c8..1c2e0c9ba8a1 100644 ---- a/net/ipv6/xfrm6_policy.c -+++ b/net/ipv6/xfrm6_policy.c -@@ -284,7 +284,7 @@ static struct dst_ops xfrm6_dst_ops = { - .destroy = xfrm6_dst_destroy, - .ifdown = xfrm6_dst_ifdown, - .local_out = __ip6_local_out, -- .gc_thresh = 1024, -+ .gc_thresh = 32768, - }; - - static struct xfrm_policy_afinfo xfrm6_policy_afinfo = { -diff --git a/net/netfilter/nfnetlink_cthelper.c b/net/netfilter/nfnetlink_cthelper.c -index a191b6db657e..3b283edec027 100644 ---- a/net/netfilter/nfnetlink_cthelper.c -+++ b/net/netfilter/nfnetlink_cthelper.c -@@ -74,6 +74,9 @@ nfnl_cthelper_parse_tuple(struct nf_conntrack_tuple *tuple, - if (!tb[NFCTH_TUPLE_L3PROTONUM] || !tb[NFCTH_TUPLE_L4PROTONUM]) - return -EINVAL; - -+ /* Not all fields are initialized so first zero the tuple */ -+ memset(tuple, 0, sizeof(struct nf_conntrack_tuple)); -+ - tuple->src.l3num = ntohs(nla_get_be16(tb[NFCTH_TUPLE_L3PROTONUM])); - tuple->dst.protonum = nla_get_u8(tb[NFCTH_TUPLE_L4PROTONUM]); - -@@ -83,7 +86,7 @@ nfnl_cthelper_parse_tuple(struct nf_conntrack_tuple *tuple, - static int - nfnl_cthelper_from_nlattr(struct nlattr *attr, struct nf_conn *ct) - { -- const struct nf_conn_help *help = nfct_help(ct); -+ struct nf_conn_help *help = nfct_help(ct); - - if (attr == NULL) - return -EINVAL; -@@ -91,7 +94,7 @@ nfnl_cthelper_from_nlattr(struct nlattr *attr, struct nf_conn *ct) - if (help->helper->data_len == 0) - return -EINVAL; - -- memcpy(&help->data, nla_data(attr), help->helper->data_len); -+ memcpy(help->data, nla_data(attr), help->helper->data_len); - return 0; - } - diff --git a/patch/kernel/marvell-default/1-patch-3.10.82-83.patch.original b/patch/kernel/marvell-default/1-patch-3.10.82-83.patch.original deleted file mode 100644 index 187a86e5da..0000000000 --- a/patch/kernel/marvell-default/1-patch-3.10.82-83.patch.original +++ /dev/null @@ -1,1734 +0,0 @@ -diff --git a/Makefile b/Makefile -index 5e3e665a10b7..21529dbcc11d 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,6 +1,6 @@ - VERSION = 3 - PATCHLEVEL = 10 --SUBLEVEL = 82 -+SUBLEVEL = 83 - EXTRAVERSION = - NAME = TOSSUG Baby Fish - -diff --git a/arch/arm/mach-dove/common.c b/arch/arm/mach-dove/common.c -index e2b5da031f96..8d4f5dc56910 100644 ---- a/arch/arm/mach-dove/common.c -+++ b/arch/arm/mach-dove/common.c -@@ -226,7 +226,7 @@ void __init dove_init_early(void) - orion_time_set_base(TIMER_VIRT_BASE); - mvebu_mbus_init("marvell,dove-mbus", - BRIDGE_WINS_BASE, BRIDGE_WINS_SZ, -- DOVE_MC_WINS_BASE, DOVE_MC_WINS_SZ); -+ DOVE_MC_WINS_BASE, DOVE_MC_WINS_SZ, 0); - } - - static int __init dove_find_tclk(void) -diff --git a/arch/arm/mach-imx/clk-imx6q.c b/arch/arm/mach-imx/clk-imx6q.c -index 2acaded8025d..ed00c9e3bfc6 100644 ---- a/arch/arm/mach-imx/clk-imx6q.c -+++ b/arch/arm/mach-imx/clk-imx6q.c -@@ -515,7 +515,7 @@ int __init mx6q_clocks_init(void) - clk[gpmi_io] = imx_clk_gate2("gpmi_io", "enfc", base + 0x78, 28); - clk[gpmi_apb] = imx_clk_gate2("gpmi_apb", "usdhc3", base + 0x78, 30); - clk[rom] = imx_clk_gate2("rom", "ahb", base + 0x7c, 0); -- clk[sata] = imx_clk_gate2("sata", "ipg", base + 0x7c, 4); -+ clk[sata] = imx_clk_gate2("sata", "ahb", base + 0x7c, 4); - clk[sdma] = imx_clk_gate2("sdma", "ahb", base + 0x7c, 6); - clk[spba] = imx_clk_gate2("spba", "ipg", base + 0x7c, 12); - clk[ssi1_ipg] = imx_clk_gate2("ssi1_ipg", "ipg", base + 0x7c, 18); -diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c -index f38922897563..4f6831ea88c5 100644 ---- a/arch/arm/mach-kirkwood/common.c -+++ b/arch/arm/mach-kirkwood/common.c -@@ -530,7 +530,7 @@ void __init kirkwood_init_early(void) - - mvebu_mbus_init("marvell,kirkwood-mbus", - BRIDGE_WINS_BASE, BRIDGE_WINS_SZ, -- DDR_WINDOW_CPU_BASE, DDR_WINDOW_CPU_SZ); -+ DDR_WINDOW_CPU_BASE, DDR_WINDOW_CPU_SZ, 0); - } - - int kirkwood_tclk; -diff --git a/arch/arm/mach-mv78xx0/common.c b/arch/arm/mach-mv78xx0/common.c -index 749a7f8c4992..4722c98dc1bb 100644 ---- a/arch/arm/mach-mv78xx0/common.c -+++ b/arch/arm/mach-mv78xx0/common.c -@@ -337,11 +337,11 @@ void __init mv78xx0_init_early(void) - if (mv78xx0_core_index() == 0) - mvebu_mbus_init("marvell,mv78xx0-mbus", - BRIDGE_WINS_CPU0_BASE, BRIDGE_WINS_SZ, -- DDR_WINDOW_CPU0_BASE, DDR_WINDOW_CPU_SZ); -+ DDR_WINDOW_CPU0_BASE, DDR_WINDOW_CPU_SZ, 0); - else - mvebu_mbus_init("marvell,mv78xx0-mbus", - BRIDGE_WINS_CPU1_BASE, BRIDGE_WINS_SZ, -- DDR_WINDOW_CPU1_BASE, DDR_WINDOW_CPU_SZ); -+ DDR_WINDOW_CPU1_BASE, DDR_WINDOW_CPU_SZ, 0); - } - - void __init_refok mv78xx0_timer_init(void) -diff --git a/arch/arm/mach-mvebu/armada-370-xp.c b/arch/arm/mach-mvebu/armada-370-xp.c -index 1c48890bb72b..4377c3484a62 100644 ---- a/arch/arm/mach-mvebu/armada-370-xp.c -+++ b/arch/arm/mach-mvebu/armada-370-xp.c -@@ -66,7 +66,8 @@ void __init armada_370_xp_init_early(void) - ARMADA_370_XP_MBUS_WINS_BASE, - ARMADA_370_XP_MBUS_WINS_SIZE, - ARMADA_370_XP_SDRAM_WINS_BASE, -- ARMADA_370_XP_SDRAM_WINS_SIZE); -+ ARMADA_370_XP_SDRAM_WINS_SIZE, -+ coherency_available()); - - #ifdef CONFIG_CACHE_L2X0 - l2x0_of_init(0, ~0UL); -diff --git a/arch/arm/mach-mvebu/coherency.c b/arch/arm/mach-mvebu/coherency.c -index 3ee701f1d38e..ea26ebb5bb5a 100644 ---- a/arch/arm/mach-mvebu/coherency.c -+++ b/arch/arm/mach-mvebu/coherency.c -@@ -137,6 +137,20 @@ static struct notifier_block mvebu_hwcc_platform_nb = { - .notifier_call = mvebu_hwcc_platform_notifier, - }; - -+/* -+ * Keep track of whether we have IO hardware coherency enabled or not. -+ * On Armada 370's we will not be using it for example. We need to make -+ * that available [through coherency_available()] so the mbus controller -+ * doesn't enable the IO coherency bit in the attribute bits of the -+ * chip selects. -+ */ -+static int coherency_enabled; -+ -+int coherency_available(void) -+{ -+ return coherency_enabled; -+} -+ - int __init coherency_init(void) - { - struct device_node *np; -@@ -170,6 +184,7 @@ int __init coherency_init(void) - coherency_base = of_iomap(np, 0); - coherency_cpu_base = of_iomap(np, 1); - set_cpu_coherent(cpu_logical_map(smp_processor_id()), 0); -+ coherency_enabled = 1; - bus_register_notifier(&platform_bus_type, - &mvebu_hwcc_platform_nb); - } -diff --git a/arch/arm/mach-mvebu/coherency.h b/arch/arm/mach-mvebu/coherency.h -index 2f428137f6fe..1501a4e5eea0 100644 ---- a/arch/arm/mach-mvebu/coherency.h -+++ b/arch/arm/mach-mvebu/coherency.h -@@ -19,6 +19,7 @@ int coherency_get_cpu_count(void); - #endif - - int set_cpu_coherent(int cpu_id, int smp_group_id); -+int coherency_available(void); - int coherency_init(void); - - #endif /* __MACH_370_XP_COHERENCY_H */ -diff --git a/arch/arm/mach-orion5x/common.c b/arch/arm/mach-orion5x/common.c -index f8a6db9239bf..048773926ad4 100644 ---- a/arch/arm/mach-orion5x/common.c -+++ b/arch/arm/mach-orion5x/common.c -@@ -213,7 +213,7 @@ void __init orion5x_init_early(void) - mbus_soc_name = NULL; - mvebu_mbus_init(mbus_soc_name, ORION5X_BRIDGE_WINS_BASE, - ORION5X_BRIDGE_WINS_SZ, -- ORION5X_DDR_WINS_BASE, ORION5X_DDR_WINS_SZ); -+ ORION5X_DDR_WINS_BASE, ORION5X_DDR_WINS_SZ, 0); - } - - void orion5x_setup_wins(void) -diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig -index 4e5b80d883c8..105ae30a176b 100644 ---- a/arch/x86/Kconfig -+++ b/arch/x86/Kconfig -@@ -154,7 +154,7 @@ config SBUS - - config NEED_DMA_MAP_STATE - def_bool y -- depends on X86_64 || INTEL_IOMMU || DMA_API_DEBUG -+ depends on X86_64 || INTEL_IOMMU || DMA_API_DEBUG || SWIOTLB - - config NEED_SG_DMA_LENGTH - def_bool y -diff --git a/arch/x86/kernel/microcode_intel_early.c b/arch/x86/kernel/microcode_intel_early.c -index 2e9e12871c2b..a883942aee44 100644 ---- a/arch/x86/kernel/microcode_intel_early.c -+++ b/arch/x86/kernel/microcode_intel_early.c -@@ -321,7 +321,7 @@ get_matching_model_microcode(int cpu, unsigned long start, - unsigned int mc_saved_count = mc_saved_data->mc_saved_count; - int i; - -- while (leftover) { -+ while (leftover && mc_saved_count < ARRAY_SIZE(mc_saved_tmp)) { - mc_header = (struct microcode_header_intel *)ucode_ptr; - - mc_size = get_totalsize(mc_header); -diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c -index 8bf40a243d75..224d2ef754cc 100644 ---- a/arch/x86/kvm/svm.c -+++ b/arch/x86/kvm/svm.c -@@ -495,8 +495,10 @@ static void skip_emulated_instruction(struct kvm_vcpu *vcpu) - { - struct vcpu_svm *svm = to_svm(vcpu); - -- if (svm->vmcb->control.next_rip != 0) -+ if (svm->vmcb->control.next_rip != 0) { -+ WARN_ON(!static_cpu_has(X86_FEATURE_NRIPS)); - svm->next_rip = svm->vmcb->control.next_rip; -+ } - - if (!svm->next_rip) { - if (emulate_instruction(vcpu, EMULTYPE_SKIP) != -@@ -4229,7 +4231,9 @@ static int svm_check_intercept(struct kvm_vcpu *vcpu, - break; - } - -- vmcb->control.next_rip = info->next_rip; -+ /* TODO: Advertise NRIPS to guest hypervisor unconditionally */ -+ if (static_cpu_has(X86_FEATURE_NRIPS)) -+ vmcb->control.next_rip = info->next_rip; - vmcb->control.exit_code = icpt_info.exit_code; - vmexit = nested_svm_exit_handled(svm); - -diff --git a/drivers/acpi/acpica/acmacros.h b/drivers/acpi/acpica/acmacros.h -index 53666bd9193d..32b0bf32364a 100644 ---- a/drivers/acpi/acpica/acmacros.h -+++ b/drivers/acpi/acpica/acmacros.h -@@ -63,19 +63,15 @@ - #define ACPI_SET64(ptr, val) (*ACPI_CAST64 (ptr) = (u64) (val)) - - /* -- * printf() format helpers -+ * printf() format helper. This macros is a workaround for the difficulties -+ * with emitting 64-bit integers and 64-bit pointers with the same code -+ * for both 32-bit and 64-bit hosts. - */ - - /* Split 64-bit integer into two 32-bit values. Use with %8.8X%8.8X */ - - #define ACPI_FORMAT_UINT64(i) ACPI_HIDWORD(i), ACPI_LODWORD(i) - --#if ACPI_MACHINE_WIDTH == 64 --#define ACPI_FORMAT_NATIVE_UINT(i) ACPI_FORMAT_UINT64(i) --#else --#define ACPI_FORMAT_NATIVE_UINT(i) 0, (i) --#endif -- - /* - * Macros for moving data around to/from buffers that are possibly unaligned. - * If the hardware supports the transfer of unaligned data, just do the store. -diff --git a/drivers/acpi/acpica/dsopcode.c b/drivers/acpi/acpica/dsopcode.c -index e9b13b92ba1e..46a37aeaedae 100644 ---- a/drivers/acpi/acpica/dsopcode.c -+++ b/drivers/acpi/acpica/dsopcode.c -@@ -446,7 +446,7 @@ acpi_ds_eval_region_operands(struct acpi_walk_state *walk_state, - - ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n", - obj_desc, -- ACPI_FORMAT_NATIVE_UINT(obj_desc->region.address), -+ ACPI_FORMAT_UINT64(obj_desc->region.address), - obj_desc->region.length)); - - /* Now the address and length are valid for this opregion */ -@@ -544,7 +544,7 @@ acpi_ds_eval_table_region_operands(struct acpi_walk_state *walk_state, - - ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n", - obj_desc, -- ACPI_FORMAT_NATIVE_UINT(obj_desc->region.address), -+ ACPI_FORMAT_UINT64(obj_desc->region.address), - obj_desc->region.length)); - - /* Now the address and length are valid for this opregion */ -diff --git a/drivers/acpi/acpica/evregion.c b/drivers/acpi/acpica/evregion.c -index 8fab9262d98a..ad698893e829 100644 ---- a/drivers/acpi/acpica/evregion.c -+++ b/drivers/acpi/acpica/evregion.c -@@ -276,7 +276,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, - ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, - "Handler %p (@%p) Address %8.8X%8.8X [%s]\n", - ®ion_obj->region.handler->address_space, handler, -- ACPI_FORMAT_NATIVE_UINT(address), -+ ACPI_FORMAT_UINT64(address), - acpi_ut_get_region_name(region_obj->region. - space_id))); - -diff --git a/drivers/acpi/acpica/exdump.c b/drivers/acpi/acpica/exdump.c -index e5a3c249f7fa..7e6a56fe1d6e 100644 ---- a/drivers/acpi/acpica/exdump.c -+++ b/drivers/acpi/acpica/exdump.c -@@ -621,8 +621,8 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) - acpi_os_printf("\n"); - } else { - acpi_os_printf(" base %8.8X%8.8X Length %X\n", -- ACPI_FORMAT_NATIVE_UINT(obj_desc->region. -- address), -+ ACPI_FORMAT_UINT64(obj_desc->region. -+ address), - obj_desc->region.length); - } - break; -diff --git a/drivers/acpi/acpica/exfldio.c b/drivers/acpi/acpica/exfldio.c -index c84ee956fa4c..dc210c379277 100644 ---- a/drivers/acpi/acpica/exfldio.c -+++ b/drivers/acpi/acpica/exfldio.c -@@ -269,17 +269,15 @@ acpi_ex_access_region(union acpi_operand_object *obj_desc, - } - - ACPI_DEBUG_PRINT_RAW((ACPI_DB_BFIELD, -- " Region [%s:%X], Width %X, ByteBase %X, Offset %X at %p\n", -+ " Region [%s:%X], Width %X, ByteBase %X, Offset %X at %8.8X%8.8X\n", - acpi_ut_get_region_name(rgn_desc->region. - space_id), - rgn_desc->region.space_id, - obj_desc->common_field.access_byte_width, - obj_desc->common_field.base_byte_offset, -- field_datum_byte_offset, ACPI_CAST_PTR(void, -- (rgn_desc-> -- region. -- address + -- region_offset)))); -+ field_datum_byte_offset, -+ ACPI_FORMAT_UINT64(rgn_desc->region.address + -+ region_offset))); - - /* Invoke the appropriate address_space/op_region handler */ - -diff --git a/drivers/acpi/acpica/exregion.c b/drivers/acpi/acpica/exregion.c -index 182abaf045e1..e90c59d35a16 100644 ---- a/drivers/acpi/acpica/exregion.c -+++ b/drivers/acpi/acpica/exregion.c -@@ -176,7 +176,7 @@ acpi_ex_system_memory_space_handler(u32 function, - if (!mem_info->mapped_logical_address) { - ACPI_ERROR((AE_INFO, - "Could not map memory at 0x%8.8X%8.8X, size %u", -- ACPI_FORMAT_NATIVE_UINT(address), -+ ACPI_FORMAT_UINT64(address), - (u32) map_length)); - mem_info->mapped_length = 0; - return_ACPI_STATUS(AE_NO_MEMORY); -@@ -197,8 +197,7 @@ acpi_ex_system_memory_space_handler(u32 function, - - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "System-Memory (width %u) R/W %u Address=%8.8X%8.8X\n", -- bit_width, function, -- ACPI_FORMAT_NATIVE_UINT(address))); -+ bit_width, function, ACPI_FORMAT_UINT64(address))); - - /* - * Perform the memory read or write -@@ -300,8 +299,7 @@ acpi_ex_system_io_space_handler(u32 function, - - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "System-IO (width %u) R/W %u Address=%8.8X%8.8X\n", -- bit_width, function, -- ACPI_FORMAT_NATIVE_UINT(address))); -+ bit_width, function, ACPI_FORMAT_UINT64(address))); - - /* Decode the function parameter */ - -diff --git a/drivers/acpi/acpica/hwvalid.c b/drivers/acpi/acpica/hwvalid.c -index eab70d58852a..fae57584a182 100644 ---- a/drivers/acpi/acpica/hwvalid.c -+++ b/drivers/acpi/acpica/hwvalid.c -@@ -142,17 +142,17 @@ acpi_hw_validate_io_request(acpi_io_address address, u32 bit_width) - byte_width = ACPI_DIV_8(bit_width); - last_address = address + byte_width - 1; - -- ACPI_DEBUG_PRINT((ACPI_DB_IO, "Address %p LastAddress %p Length %X", -- ACPI_CAST_PTR(void, address), ACPI_CAST_PTR(void, -- last_address), -- byte_width)); -+ ACPI_DEBUG_PRINT((ACPI_DB_IO, -+ "Address %8.8X%8.8X LastAddress %8.8X%8.8X Length %X", -+ ACPI_FORMAT_UINT64(address), -+ ACPI_FORMAT_UINT64(last_address), byte_width)); - - /* Maximum 16-bit address in I/O space */ - - if (last_address > ACPI_UINT16_MAX) { - ACPI_ERROR((AE_INFO, -- "Illegal I/O port address/length above 64K: %p/0x%X", -- ACPI_CAST_PTR(void, address), byte_width)); -+ "Illegal I/O port address/length above 64K: %8.8X%8.8X/0x%X", -+ ACPI_FORMAT_UINT64(address), byte_width)); - return_ACPI_STATUS(AE_LIMIT); - } - -@@ -181,8 +181,8 @@ acpi_hw_validate_io_request(acpi_io_address address, u32 bit_width) - - if (acpi_gbl_osi_data >= port_info->osi_dependency) { - ACPI_DEBUG_PRINT((ACPI_DB_IO, -- "Denied AML access to port 0x%p/%X (%s 0x%.4X-0x%.4X)", -- ACPI_CAST_PTR(void, address), -+ "Denied AML access to port 0x%8.8X%8.8X/%X (%s 0x%.4X-0x%.4X)", -+ ACPI_FORMAT_UINT64(address), - byte_width, port_info->name, - port_info->start, - port_info->end)); -diff --git a/drivers/acpi/acpica/nsdump.c b/drivers/acpi/acpica/nsdump.c -index ce6e97326205..20ae5b9bb9f2 100644 ---- a/drivers/acpi/acpica/nsdump.c -+++ b/drivers/acpi/acpica/nsdump.c -@@ -258,12 +258,11 @@ acpi_ns_dump_one_object(acpi_handle obj_handle, - switch (type) { - case ACPI_TYPE_PROCESSOR: - -- acpi_os_printf("ID %02X Len %02X Addr %p\n", -+ acpi_os_printf("ID %02X Len %02X Addr %8.8X%8.8X\n", - obj_desc->processor.proc_id, - obj_desc->processor.length, -- ACPI_CAST_PTR(void, -- obj_desc->processor. -- address)); -+ ACPI_FORMAT_UINT64(obj_desc->processor. -+ address)); - break; - - case ACPI_TYPE_DEVICE: -@@ -334,8 +333,9 @@ acpi_ns_dump_one_object(acpi_handle obj_handle, - space_id)); - if (obj_desc->region.flags & AOPOBJ_DATA_VALID) { - acpi_os_printf(" Addr %8.8X%8.8X Len %.4X\n", -- ACPI_FORMAT_NATIVE_UINT -- (obj_desc->region.address), -+ ACPI_FORMAT_UINT64(obj_desc-> -+ region. -+ address), - obj_desc->region.length); - } else { - acpi_os_printf -diff --git a/drivers/acpi/acpica/tbutils.c b/drivers/acpi/acpica/tbutils.c -index ce3d5db39a9c..5c67b2840c58 100644 ---- a/drivers/acpi/acpica/tbutils.c -+++ b/drivers/acpi/acpica/tbutils.c -@@ -246,16 +246,12 @@ acpi_tb_print_table_header(acpi_physical_address address, - { - struct acpi_table_header local_header; - -- /* -- * The reason that the Address is cast to a void pointer is so that we -- * can use %p which will work properly on both 32-bit and 64-bit hosts. -- */ - if (ACPI_COMPARE_NAME(header->signature, ACPI_SIG_FACS)) { - - /* FACS only has signature and length fields */ - -- ACPI_INFO((AE_INFO, "%4.4s %p %05X", -- header->signature, ACPI_CAST_PTR(void, address), -+ ACPI_INFO((AE_INFO, "%4.4s 0x%8.8X%8.8X %05X", -+ header->signature, ACPI_FORMAT_UINT64(address), - header->length)); - } else if (ACPI_COMPARE_NAME(header->signature, ACPI_SIG_RSDP)) { - -@@ -266,8 +262,8 @@ acpi_tb_print_table_header(acpi_physical_address address, - header)->oem_id, ACPI_OEM_ID_SIZE); - acpi_tb_fix_string(local_header.oem_id, ACPI_OEM_ID_SIZE); - -- ACPI_INFO((AE_INFO, "RSDP %p %05X (v%.2d %6.6s)", -- ACPI_CAST_PTR (void, address), -+ ACPI_INFO((AE_INFO, "RSDP 0x%8.8X%8.8X %05X (v%.2d %6.6s)", -+ ACPI_FORMAT_UINT64(address), - (ACPI_CAST_PTR(struct acpi_table_rsdp, header)-> - revision > - 0) ? ACPI_CAST_PTR(struct acpi_table_rsdp, -@@ -281,8 +277,8 @@ acpi_tb_print_table_header(acpi_physical_address address, - acpi_tb_cleanup_table_header(&local_header, header); - - ACPI_INFO((AE_INFO, -- "%4.4s %p %05X (v%.2d %6.6s %8.8s %08X %4.4s %08X)", -- local_header.signature, ACPI_CAST_PTR(void, address), -+ "%-4.4s 0x%8.8X%8.8X %05X (v%.2d %-6.6s %-8.8s %08X %-4.4s %08X)", -+ local_header.signature, ACPI_FORMAT_UINT64(address), - local_header.length, local_header.revision, - local_header.oem_id, local_header.oem_table_id, - local_header.oem_revision, -@@ -474,8 +470,8 @@ acpi_tb_install_table(acpi_physical_address address, - table = acpi_os_map_memory(address, sizeof(struct acpi_table_header)); - if (!table) { - ACPI_ERROR((AE_INFO, -- "Could not map memory for table [%s] at %p", -- signature, ACPI_CAST_PTR(void, address))); -+ "Could not map memory for table [%s] at %8.8X%8.8X", -+ signature, ACPI_FORMAT_UINT64(address))); - return; - } - -diff --git a/drivers/acpi/acpica/utaddress.c b/drivers/acpi/acpica/utaddress.c -index e0a2e2779c2e..3c7770d75773 100644 ---- a/drivers/acpi/acpica/utaddress.c -+++ b/drivers/acpi/acpica/utaddress.c -@@ -107,10 +107,10 @@ acpi_ut_add_address_range(acpi_adr_space_type space_id, - acpi_gbl_address_range_list[space_id] = range_info; - - ACPI_DEBUG_PRINT((ACPI_DB_NAMES, -- "\nAdded [%4.4s] address range: 0x%p-0x%p\n", -+ "\nAdded [%4.4s] address range: 0x%8.8X%8.8X-0x%8.8X%8.8X\n", - acpi_ut_get_node_name(range_info->region_node), -- ACPI_CAST_PTR(void, address), -- ACPI_CAST_PTR(void, range_info->end_address))); -+ ACPI_FORMAT_UINT64(address), -+ ACPI_FORMAT_UINT64(range_info->end_address))); - - (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); - return_ACPI_STATUS(AE_OK); -@@ -160,15 +160,13 @@ acpi_ut_remove_address_range(acpi_adr_space_type space_id, - } - - ACPI_DEBUG_PRINT((ACPI_DB_NAMES, -- "\nRemoved [%4.4s] address range: 0x%p-0x%p\n", -+ "\nRemoved [%4.4s] address range: 0x%8.8X%8.8X-0x%8.8X%8.8X\n", - acpi_ut_get_node_name(range_info-> - region_node), -- ACPI_CAST_PTR(void, -- range_info-> -- start_address), -- ACPI_CAST_PTR(void, -- range_info-> -- end_address))); -+ ACPI_FORMAT_UINT64(range_info-> -+ start_address), -+ ACPI_FORMAT_UINT64(range_info-> -+ end_address))); - - ACPI_FREE(range_info); - return_VOID; -@@ -244,9 +242,9 @@ acpi_ut_check_address_range(acpi_adr_space_type space_id, - region_node); - - ACPI_WARNING((AE_INFO, -- "0x%p-0x%p %s conflicts with Region %s %d", -- ACPI_CAST_PTR(void, address), -- ACPI_CAST_PTR(void, end_address), -+ "0x%8.8X%8.8X-0x%8.8X%8.8X %s conflicts with Region %s %d", -+ ACPI_FORMAT_UINT64(address), -+ ACPI_FORMAT_UINT64(end_address), - acpi_ut_get_region_name(space_id), - pathname, overlap_count)); - ACPI_FREE(pathname); -diff --git a/drivers/bus/mvebu-mbus.c b/drivers/bus/mvebu-mbus.c -index 711dcf4a0313..7c437826c2f9 100644 ---- a/drivers/bus/mvebu-mbus.c -+++ b/drivers/bus/mvebu-mbus.c -@@ -838,7 +838,7 @@ fs_initcall(mvebu_mbus_debugfs_init); - int __init mvebu_mbus_init(const char *soc, phys_addr_t mbuswins_phys_base, - size_t mbuswins_size, - phys_addr_t sdramwins_phys_base, -- size_t sdramwins_size) -+ size_t sdramwins_size, int is_coherent) - { - struct mvebu_mbus_state *mbus = &mbus_state; - const struct of_device_id *of_id; -@@ -865,8 +865,7 @@ int __init mvebu_mbus_init(const char *soc, phys_addr_t mbuswins_phys_base, - return -ENOMEM; - } - -- if (of_find_compatible_node(NULL, NULL, "marvell,coherency-fabric")) -- mbus->hw_io_coherency = 1; -+ mbus->hw_io_coherency = is_coherent; - - for (win = 0; win < mbus->soc->num_wins; win++) - mvebu_mbus_disable_window(mbus, win); -diff --git a/drivers/edac/sb_edac.c b/drivers/edac/sb_edac.c -index f505e4ca6d58..3bdefbfb4377 100644 ---- a/drivers/edac/sb_edac.c -+++ b/drivers/edac/sb_edac.c -@@ -623,7 +623,7 @@ static void get_memory_layout(const struct mem_ctl_info *mci) - u32 reg; - u64 limit, prv = 0; - u64 tmp_mb; -- u32 mb, kb; -+ u32 gb, mb; - u32 rir_way; - - /* -@@ -636,8 +636,9 @@ static void get_memory_layout(const struct mem_ctl_info *mci) - pvt->tolm = GET_TOLM(reg); - tmp_mb = (1 + pvt->tolm) >> 20; - -- mb = div_u64_rem(tmp_mb, 1000, &kb); -- edac_dbg(0, "TOLM: %u.%03u GB (0x%016Lx)\n", mb, kb, (u64)pvt->tolm); -+ gb = div_u64_rem(tmp_mb, 1024, &mb); -+ edac_dbg(0, "TOLM: %u.%03u GB (0x%016Lx)\n", -+ gb, (mb*1000)/1024, (u64)pvt->tolm); - - /* Address range is already 45:25 */ - pci_read_config_dword(pvt->pci_sad1, TOHM, -@@ -645,8 +646,9 @@ static void get_memory_layout(const struct mem_ctl_info *mci) - pvt->tohm = GET_TOHM(reg); - tmp_mb = (1 + pvt->tohm) >> 20; - -- mb = div_u64_rem(tmp_mb, 1000, &kb); -- edac_dbg(0, "TOHM: %u.%03u GB (0x%016Lx)\n", mb, kb, (u64)pvt->tohm); -+ gb = div_u64_rem(tmp_mb, 1024, &mb); -+ edac_dbg(0, "TOHM: %u.%03u GB (0x%016Lx)\n", -+ gb, (mb*1000)/1024, (u64)pvt->tohm); - - /* - * Step 2) Get SAD range and SAD Interleave list -@@ -668,11 +670,11 @@ static void get_memory_layout(const struct mem_ctl_info *mci) - break; - - tmp_mb = (limit + 1) >> 20; -- mb = div_u64_rem(tmp_mb, 1000, &kb); -+ gb = div_u64_rem(tmp_mb, 1024, &mb); - edac_dbg(0, "SAD#%d %s up to %u.%03u GB (0x%016Lx) Interleave: %s reg=0x%08x\n", - n_sads, - get_dram_attr(reg), -- mb, kb, -+ gb, (mb*1000)/1024, - ((u64)tmp_mb) << 20L, - INTERLEAVE_MODE(reg) ? "8:6" : "[8:6]XOR[18:16]", - reg); -@@ -702,9 +704,9 @@ static void get_memory_layout(const struct mem_ctl_info *mci) - break; - tmp_mb = (limit + 1) >> 20; - -- mb = div_u64_rem(tmp_mb, 1000, &kb); -+ gb = div_u64_rem(tmp_mb, 1024, &mb); - edac_dbg(0, "TAD#%d: up to %u.%03u GB (0x%016Lx), socket interleave %d, memory interleave %d, TGT: %d, %d, %d, %d, reg=0x%08x\n", -- n_tads, mb, kb, -+ n_tads, gb, (mb*1000)/1024, - ((u64)tmp_mb) << 20L, - (u32)TAD_SOCK(reg), - (u32)TAD_CH(reg), -@@ -727,10 +729,10 @@ static void get_memory_layout(const struct mem_ctl_info *mci) - tad_ch_nilv_offset[j], - ®); - tmp_mb = TAD_OFFSET(reg) >> 20; -- mb = div_u64_rem(tmp_mb, 1000, &kb); -+ gb = div_u64_rem(tmp_mb, 1024, &mb); - edac_dbg(0, "TAD CH#%d, offset #%d: %u.%03u GB (0x%016Lx), reg=0x%08x\n", - i, j, -- mb, kb, -+ gb, (mb*1000)/1024, - ((u64)tmp_mb) << 20L, - reg); - } -@@ -752,10 +754,10 @@ static void get_memory_layout(const struct mem_ctl_info *mci) - - tmp_mb = RIR_LIMIT(reg) >> 20; - rir_way = 1 << RIR_WAY(reg); -- mb = div_u64_rem(tmp_mb, 1000, &kb); -+ gb = div_u64_rem(tmp_mb, 1024, &mb); - edac_dbg(0, "CH#%d RIR#%d, limit: %u.%03u GB (0x%016Lx), way: %d, reg=0x%08x\n", - i, j, -- mb, kb, -+ gb, (mb*1000)/1024, - ((u64)tmp_mb) << 20L, - rir_way, - reg); -@@ -766,10 +768,10 @@ static void get_memory_layout(const struct mem_ctl_info *mci) - ®); - tmp_mb = RIR_OFFSET(reg) << 6; - -- mb = div_u64_rem(tmp_mb, 1000, &kb); -+ gb = div_u64_rem(tmp_mb, 1024, &mb); - edac_dbg(0, "CH#%d RIR#%d INTL#%d, offset %u.%03u GB (0x%016Lx), tgt: %d, reg=0x%08x\n", - i, j, k, -- mb, kb, -+ gb, (mb*1000)/1024, - ((u64)tmp_mb) << 20L, - (u32)RIR_RNK_TGT(reg), - reg); -@@ -806,7 +808,7 @@ static int get_memory_error_data(struct mem_ctl_info *mci, - u8 ch_way,sck_way; - u32 tad_offset; - u32 rir_way; -- u32 mb, kb; -+ u32 mb, gb; - u64 ch_addr, offset, limit, prv = 0; - - -@@ -1022,10 +1024,10 @@ static int get_memory_error_data(struct mem_ctl_info *mci, - continue; - - limit = RIR_LIMIT(reg); -- mb = div_u64_rem(limit >> 20, 1000, &kb); -+ gb = div_u64_rem(limit >> 20, 1024, &mb); - edac_dbg(0, "RIR#%d, limit: %u.%03u GB (0x%016Lx), way: %d\n", - n_rir, -- mb, kb, -+ gb, (mb*1000)/1024, - limit, - 1 << RIR_WAY(reg)); - if (ch_addr <= limit) -diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c -index 62ed744bbe06..a6cdf17e27dc 100644 ---- a/drivers/scsi/hpsa.c -+++ b/drivers/scsi/hpsa.c -@@ -3898,10 +3898,6 @@ static int hpsa_kdump_hard_reset_controller(struct pci_dev *pdev) - - /* Save the PCI command register */ - pci_read_config_word(pdev, 4, &command_register); -- /* Turn the board off. This is so that later pci_restore_state() -- * won't turn the board on before the rest of config space is ready. -- */ -- pci_disable_device(pdev); - pci_save_state(pdev); - - /* find the first memory BAR, so we can find the cfg table */ -@@ -3949,11 +3945,6 @@ static int hpsa_kdump_hard_reset_controller(struct pci_dev *pdev) - goto unmap_cfgtable; - - pci_restore_state(pdev); -- rc = pci_enable_device(pdev); -- if (rc) { -- dev_warn(&pdev->dev, "failed to enable device.\n"); -- goto unmap_cfgtable; -- } - pci_write_config_word(pdev, 4, command_register); - - /* Some devices (notably the HP Smart Array 5i Controller) -@@ -4448,6 +4439,23 @@ static int hpsa_init_reset_devices(struct pci_dev *pdev) - if (!reset_devices) - return 0; - -+ /* kdump kernel is loading, we don't know in which state is -+ * the pci interface. The dev->enable_cnt is equal zero -+ * so we call enable+disable, wait a while and switch it on. -+ */ -+ rc = pci_enable_device(pdev); -+ if (rc) { -+ dev_warn(&pdev->dev, "Failed to enable PCI device\n"); -+ return -ENODEV; -+ } -+ pci_disable_device(pdev); -+ msleep(260); /* a randomly chosen number */ -+ rc = pci_enable_device(pdev); -+ if (rc) { -+ dev_warn(&pdev->dev, "failed to enable device.\n"); -+ return -ENODEV; -+ } -+ pci_set_master(pdev); - /* Reset the controller with a PCI power-cycle or via doorbell */ - rc = hpsa_kdump_hard_reset_controller(pdev); - -@@ -4456,10 +4464,11 @@ static int hpsa_init_reset_devices(struct pci_dev *pdev) - * "performant mode". Or, it might be 640x, which can't reset - * due to concerns about shared bbwc between 6402/6404 pair. - */ -- if (rc == -ENOTSUPP) -- return rc; /* just try to do the kdump anyhow. */ -- if (rc) -- return -ENODEV; -+ if (rc) { -+ if (rc != -ENOTSUPP) /* just try to do the kdump anyhow. */ -+ rc = -ENODEV; -+ goto out_disable; -+ } - - /* Now try to get the controller to respond to a no-op */ - dev_warn(&pdev->dev, "Waiting for controller to respond to no-op\n"); -@@ -4470,7 +4479,11 @@ static int hpsa_init_reset_devices(struct pci_dev *pdev) - dev_warn(&pdev->dev, "no-op failed%s\n", - (i < 11 ? "; re-trying" : "")); - } -- return 0; -+ -+out_disable: -+ -+ pci_disable_device(pdev); -+ return rc; - } - - static int hpsa_allocate_cmd_pool(struct ctlr_info *h) -@@ -4613,6 +4626,7 @@ static void hpsa_undo_allocations_after_kdump_soft_reset(struct ctlr_info *h) - iounmap(h->transtable); - if (h->cfgtable) - iounmap(h->cfgtable); -+ pci_disable_device(h->pdev); - pci_release_regions(h->pdev); - kfree(h); - } -diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c -index 7fb054ba1b60..82f14a1da542 100644 ---- a/fs/btrfs/ctree.c -+++ b/fs/btrfs/ctree.c -@@ -2769,7 +2769,7 @@ done: - */ - if (!p->leave_spinning) - btrfs_set_path_blocking(p); -- if (ret < 0) -+ if (ret < 0 && !p->skip_release_on_error) - btrfs_release_path(p); - return ret; - } -diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h -index d6dd49b51ba8..c19444e412be 100644 ---- a/fs/btrfs/ctree.h -+++ b/fs/btrfs/ctree.h -@@ -586,6 +586,7 @@ struct btrfs_path { - unsigned int skip_locking:1; - unsigned int leave_spinning:1; - unsigned int search_commit_root:1; -+ unsigned int skip_release_on_error:1; - }; - - /* -@@ -3406,6 +3407,10 @@ struct btrfs_dir_item *btrfs_lookup_xattr(struct btrfs_trans_handle *trans, - int verify_dir_item(struct btrfs_root *root, - struct extent_buffer *leaf, - struct btrfs_dir_item *dir_item); -+struct btrfs_dir_item *btrfs_match_dir_item_name(struct btrfs_root *root, -+ struct btrfs_path *path, -+ const char *name, -+ int name_len); - - /* orphan.c */ - int btrfs_insert_orphan_item(struct btrfs_trans_handle *trans, -diff --git a/fs/btrfs/dir-item.c b/fs/btrfs/dir-item.c -index 79e594e341c7..6f61b9b1526f 100644 ---- a/fs/btrfs/dir-item.c -+++ b/fs/btrfs/dir-item.c -@@ -21,10 +21,6 @@ - #include "hash.h" - #include "transaction.h" - --static struct btrfs_dir_item *btrfs_match_dir_item_name(struct btrfs_root *root, -- struct btrfs_path *path, -- const char *name, int name_len); -- - /* - * insert a name into a directory, doing overflow properly if there is a hash - * collision. data_size indicates how big the item inserted should be. On -@@ -383,9 +379,9 @@ struct btrfs_dir_item *btrfs_lookup_xattr(struct btrfs_trans_handle *trans, - * this walks through all the entries in a dir item and finds one - * for a specific name. - */ --static struct btrfs_dir_item *btrfs_match_dir_item_name(struct btrfs_root *root, -- struct btrfs_path *path, -- const char *name, int name_len) -+struct btrfs_dir_item *btrfs_match_dir_item_name(struct btrfs_root *root, -+ struct btrfs_path *path, -+ const char *name, int name_len) - { - struct btrfs_dir_item *dir_item; - unsigned long name_ptr; -diff --git a/fs/btrfs/xattr.c b/fs/btrfs/xattr.c -index 05740b9789e4..9cf20d63cc99 100644 ---- a/fs/btrfs/xattr.c -+++ b/fs/btrfs/xattr.c -@@ -27,6 +27,7 @@ - #include "transaction.h" - #include "xattr.h" - #include "disk-io.h" -+#include "locking.h" - - - ssize_t __btrfs_getxattr(struct inode *inode, const char *name, -@@ -89,7 +90,7 @@ static int do_setxattr(struct btrfs_trans_handle *trans, - struct inode *inode, const char *name, - const void *value, size_t size, int flags) - { -- struct btrfs_dir_item *di; -+ struct btrfs_dir_item *di = NULL; - struct btrfs_root *root = BTRFS_I(inode)->root; - struct btrfs_path *path; - size_t name_len = strlen(name); -@@ -101,84 +102,128 @@ static int do_setxattr(struct btrfs_trans_handle *trans, - path = btrfs_alloc_path(); - if (!path) - return -ENOMEM; -+ path->skip_release_on_error = 1; -+ -+ if (!value) { -+ di = btrfs_lookup_xattr(trans, root, path, btrfs_ino(inode), -+ name, name_len, -1); -+ if (!di && (flags & XATTR_REPLACE)) -+ ret = -ENODATA; -+ else if (di) -+ ret = btrfs_delete_one_dir_name(trans, root, path, di); -+ goto out; -+ } - -+ /* -+ * For a replace we can't just do the insert blindly. -+ * Do a lookup first (read-only btrfs_search_slot), and return if xattr -+ * doesn't exist. If it exists, fall down below to the insert/replace -+ * path - we can't race with a concurrent xattr delete, because the VFS -+ * locks the inode's i_mutex before calling setxattr or removexattr. -+ */ - if (flags & XATTR_REPLACE) { -- di = btrfs_lookup_xattr(trans, root, path, btrfs_ino(inode), name, -- name_len, -1); -- if (IS_ERR(di)) { -- ret = PTR_ERR(di); -- goto out; -- } else if (!di) { -+ if(!mutex_is_locked(&inode->i_mutex)) { -+ pr_err("BTRFS: assertion failed: %s, file: %s, line: %d", -+ "mutex_is_locked(&inode->i_mutex)", __FILE__, -+ __LINE__); -+ BUG(); -+ } -+ di = btrfs_lookup_xattr(NULL, root, path, btrfs_ino(inode), -+ name, name_len, 0); -+ if (!di) { - ret = -ENODATA; - goto out; - } -- ret = btrfs_delete_one_dir_name(trans, root, path, di); -- if (ret) -- goto out; - btrfs_release_path(path); -+ di = NULL; -+ } - -+ ret = btrfs_insert_xattr_item(trans, root, path, btrfs_ino(inode), -+ name, name_len, value, size); -+ if (ret == -EOVERFLOW) { - /* -- * remove the attribute -+ * We have an existing item in a leaf, split_leaf couldn't -+ * expand it. That item might have or not a dir_item that -+ * matches our target xattr, so lets check. - */ -- if (!value) -- goto out; -- } else { -- di = btrfs_lookup_xattr(NULL, root, path, btrfs_ino(inode), -- name, name_len, 0); -- if (IS_ERR(di)) { -- ret = PTR_ERR(di); -+ ret = 0; -+ btrfs_assert_tree_locked(path->nodes[0]); -+ di = btrfs_match_dir_item_name(root, path, name, name_len); -+ if (!di && !(flags & XATTR_REPLACE)) { -+ ret = -ENOSPC; - goto out; - } -- if (!di && !value) -- goto out; -- btrfs_release_path(path); -+ } else if (ret == -EEXIST) { -+ ret = 0; -+ di = btrfs_match_dir_item_name(root, path, name, name_len); -+ if(!di) { /* logic error */ -+ pr_err("BTRFS: assertion failed: %s, file: %s, line: %d", -+ "di", __FILE__, __LINE__); -+ BUG(); -+ } -+ } else if (ret) { -+ goto out; - } - --again: -- ret = btrfs_insert_xattr_item(trans, root, path, btrfs_ino(inode), -- name, name_len, value, size); -- /* -- * If we're setting an xattr to a new value but the new value is say -- * exactly BTRFS_MAX_XATTR_SIZE, we could end up with EOVERFLOW getting -- * back from split_leaf. This is because it thinks we'll be extending -- * the existing item size, but we're asking for enough space to add the -- * item itself. So if we get EOVERFLOW just set ret to EEXIST and let -- * the rest of the function figure it out. -- */ -- if (ret == -EOVERFLOW) -+ if (di && (flags & XATTR_CREATE)) { - ret = -EEXIST; -+ goto out; -+ } - -- if (ret == -EEXIST) { -- if (flags & XATTR_CREATE) -- goto out; -+ if (di) { - /* -- * We can't use the path we already have since we won't have the -- * proper locking for a delete, so release the path and -- * re-lookup to delete the thing. -+ * We're doing a replace, and it must be atomic, that is, at -+ * any point in time we have either the old or the new xattr -+ * value in the tree. We don't want readers (getxattr and -+ * listxattrs) to miss a value, this is specially important -+ * for ACLs. - */ -- btrfs_release_path(path); -- di = btrfs_lookup_xattr(trans, root, path, btrfs_ino(inode), -- name, name_len, -1); -- if (IS_ERR(di)) { -- ret = PTR_ERR(di); -- goto out; -- } else if (!di) { -- /* Shouldn't happen but just in case... */ -- btrfs_release_path(path); -- goto again; -+ const int slot = path->slots[0]; -+ struct extent_buffer *leaf = path->nodes[0]; -+ const u16 old_data_len = btrfs_dir_data_len(leaf, di); -+ const u32 item_size = btrfs_item_size_nr(leaf, slot); -+ const u32 data_size = sizeof(*di) + name_len + size; -+ struct btrfs_item *item; -+ unsigned long data_ptr; -+ char *ptr; -+ -+ if (size > old_data_len) { -+ if (btrfs_leaf_free_space(root, leaf) < -+ (size - old_data_len)) { -+ ret = -ENOSPC; -+ goto out; -+ } - } - -- ret = btrfs_delete_one_dir_name(trans, root, path, di); -- if (ret) -- goto out; -+ if (old_data_len + name_len + sizeof(*di) == item_size) { -+ /* No other xattrs packed in the same leaf item. */ -+ if (size > old_data_len) -+ btrfs_extend_item(root, path, -+ size - old_data_len); -+ else if (size < old_data_len) -+ btrfs_truncate_item(root, path, data_size, 1); -+ } else { -+ /* There are other xattrs packed in the same item. */ -+ ret = btrfs_delete_one_dir_name(trans, root, path, di); -+ if (ret) -+ goto out; -+ btrfs_extend_item(root, path, data_size); -+ } - -+ item = btrfs_item_nr(NULL, slot); -+ ptr = btrfs_item_ptr(leaf, slot, char); -+ ptr += btrfs_item_size(leaf, item) - data_size; -+ di = (struct btrfs_dir_item *)ptr; -+ btrfs_set_dir_data_len(leaf, di, size); -+ data_ptr = ((unsigned long)(di + 1)) + name_len; -+ write_extent_buffer(leaf, value, data_ptr, size); -+ btrfs_mark_buffer_dirty(leaf); -+ } else { - /* -- * We have a value to set, so go back and try to insert it now. -+ * Insert, and we had space for the xattr, so path->slots[0] is -+ * where our xattr dir_item is and btrfs_insert_xattr_item() -+ * filled it. - */ -- if (value) { -- btrfs_release_path(path); -- goto again; -- } - } - out: - btrfs_free_path(path); -diff --git a/fs/dcache.c b/fs/dcache.c -index e2800926ae05..38c4a302fab4 100644 ---- a/fs/dcache.c -+++ b/fs/dcache.c -@@ -1053,13 +1053,13 @@ ascend: - /* might go back up the wrong parent if we have had a rename. */ - if (!locked && read_seqretry(&rename_lock, seq)) - goto rename_retry; -- next = child->d_child.next; -- while (unlikely(child->d_flags & DCACHE_DENTRY_KILLED)) { -+ /* go into the first sibling still alive */ -+ do { -+ next = child->d_child.next; - if (next == &this_parent->d_subdirs) - goto ascend; - child = list_entry(next, struct dentry, d_child); -- next = next->next; -- } -+ } while (unlikely(child->d_flags & DCACHE_DENTRY_KILLED)); - rcu_read_unlock(); - goto resume; - } -@@ -2977,13 +2977,13 @@ ascend: - /* might go back up the wrong parent if we have had a rename. */ - if (!locked && read_seqretry(&rename_lock, seq)) - goto rename_retry; -- next = child->d_child.next; -- while (unlikely(child->d_flags & DCACHE_DENTRY_KILLED)) { -+ /* go into the first sibling still alive */ -+ do { -+ next = child->d_child.next; - if (next == &this_parent->d_subdirs) - goto ascend; - child = list_entry(next, struct dentry, d_child); -- next = next->next; -- } -+ } while (unlikely(child->d_flags & DCACHE_DENTRY_KILLED)); - rcu_read_unlock(); - goto resume; - } -diff --git a/fs/exec.c b/fs/exec.c -index dd6aa61c8548..acbd7ac2deda 100644 ---- a/fs/exec.c -+++ b/fs/exec.c -@@ -1265,6 +1265,53 @@ static int check_unsafe_exec(struct linux_binprm *bprm) - return res; - } - -+static void bprm_fill_uid(struct linux_binprm *bprm) -+{ -+ struct inode *inode; -+ unsigned int mode; -+ kuid_t uid; -+ kgid_t gid; -+ -+ /* clear any previous set[ug]id data from a previous binary */ -+ bprm->cred->euid = current_euid(); -+ bprm->cred->egid = current_egid(); -+ -+ if (bprm->file->f_path.mnt->mnt_flags & MNT_NOSUID) -+ return; -+ -+ if (current->no_new_privs) -+ return; -+ -+ inode = file_inode(bprm->file); -+ mode = ACCESS_ONCE(inode->i_mode); -+ if (!(mode & (S_ISUID|S_ISGID))) -+ return; -+ -+ /* Be careful if suid/sgid is set */ -+ mutex_lock(&inode->i_mutex); -+ -+ /* reload atomically mode/uid/gid now that lock held */ -+ mode = inode->i_mode; -+ uid = inode->i_uid; -+ gid = inode->i_gid; -+ mutex_unlock(&inode->i_mutex); -+ -+ /* We ignore suid/sgid if there are no mappings for them in the ns */ -+ if (!kuid_has_mapping(bprm->cred->user_ns, uid) || -+ !kgid_has_mapping(bprm->cred->user_ns, gid)) -+ return; -+ -+ if (mode & S_ISUID) { -+ bprm->per_clear |= PER_CLEAR_ON_SETID; -+ bprm->cred->euid = uid; -+ } -+ -+ if ((mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP)) { -+ bprm->per_clear |= PER_CLEAR_ON_SETID; -+ bprm->cred->egid = gid; -+ } -+} -+ - /* - * Fill the binprm structure from the inode. - * Check permissions, then read the first 128 (BINPRM_BUF_SIZE) bytes -@@ -1273,39 +1320,12 @@ static int check_unsafe_exec(struct linux_binprm *bprm) - */ - int prepare_binprm(struct linux_binprm *bprm) - { -- umode_t mode; -- struct inode * inode = file_inode(bprm->file); - int retval; - -- mode = inode->i_mode; - if (bprm->file->f_op == NULL) - return -EACCES; - -- /* clear any previous set[ug]id data from a previous binary */ -- bprm->cred->euid = current_euid(); -- bprm->cred->egid = current_egid(); -- -- if (!(bprm->file->f_path.mnt->mnt_flags & MNT_NOSUID) && -- !current->no_new_privs && -- kuid_has_mapping(bprm->cred->user_ns, inode->i_uid) && -- kgid_has_mapping(bprm->cred->user_ns, inode->i_gid)) { -- /* Set-uid? */ -- if (mode & S_ISUID) { -- bprm->per_clear |= PER_CLEAR_ON_SETID; -- bprm->cred->euid = inode->i_uid; -- } -- -- /* Set-gid? */ -- /* -- * If setgid is set but no group execute bit then this -- * is a candidate for mandatory locking, not a setgid -- * executable. -- */ -- if ((mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP)) { -- bprm->per_clear |= PER_CLEAR_ON_SETID; -- bprm->cred->egid = inode->i_gid; -- } -- } -+ bprm_fill_uid(bprm); - - /* fill in binprm security blob */ - retval = security_bprm_set_creds(bprm); -diff --git a/fs/file_table.c b/fs/file_table.c -index 54a34be444f9..28f02a7cbba1 100644 ---- a/fs/file_table.c -+++ b/fs/file_table.c -@@ -36,8 +36,6 @@ struct files_stat_struct files_stat = { - .max_files = NR_FILE - }; - --DEFINE_STATIC_LGLOCK(files_lglock); -- - /* SLAB cache for file structures */ - static struct kmem_cache *filp_cachep __read_mostly; - -@@ -134,7 +132,6 @@ struct file *get_empty_filp(void) - return ERR_PTR(error); - } - -- INIT_LIST_HEAD(&f->f_u.fu_list); - atomic_long_set(&f->f_count, 1); - rwlock_init(&f->f_owner.lock); - spin_lock_init(&f->f_lock); -@@ -265,18 +262,15 @@ static void __fput(struct file *file) - mntput(mnt); - } - --static DEFINE_SPINLOCK(delayed_fput_lock); --static LIST_HEAD(delayed_fput_list); -+static LLIST_HEAD(delayed_fput_list); - static void delayed_fput(struct work_struct *unused) - { -- LIST_HEAD(head); -- spin_lock_irq(&delayed_fput_lock); -- list_splice_init(&delayed_fput_list, &head); -- spin_unlock_irq(&delayed_fput_lock); -- while (!list_empty(&head)) { -- struct file *f = list_first_entry(&head, struct file, f_u.fu_list); -- list_del_init(&f->f_u.fu_list); -- __fput(f); -+ struct llist_node *node = llist_del_all(&delayed_fput_list); -+ struct llist_node *next; -+ -+ for (; node; node = next) { -+ next = llist_next(node); -+ __fput(llist_entry(node, struct file, f_u.fu_llist)); - } - } - -@@ -306,18 +300,15 @@ void fput(struct file *file) - { - if (atomic_long_dec_and_test(&file->f_count)) { - struct task_struct *task = current; -- unsigned long flags; - -- file_sb_list_del(file); - if (likely(!in_interrupt() && !(task->flags & PF_KTHREAD))) { - init_task_work(&file->f_u.fu_rcuhead, ____fput); - if (!task_work_add(task, &file->f_u.fu_rcuhead, true)) - return; - } -- spin_lock_irqsave(&delayed_fput_lock, flags); -- list_add(&file->f_u.fu_list, &delayed_fput_list); -- schedule_work(&delayed_fput_work); -- spin_unlock_irqrestore(&delayed_fput_lock, flags); -+ -+ if (llist_add(&file->f_u.fu_llist, &delayed_fput_list)) -+ schedule_work(&delayed_fput_work); - } - } - -@@ -333,7 +324,6 @@ void __fput_sync(struct file *file) - { - if (atomic_long_dec_and_test(&file->f_count)) { - struct task_struct *task = current; -- file_sb_list_del(file); - BUG_ON(!(task->flags & PF_KTHREAD)); - __fput(file); - } -@@ -345,127 +335,10 @@ void put_filp(struct file *file) - { - if (atomic_long_dec_and_test(&file->f_count)) { - security_file_free(file); -- file_sb_list_del(file); - file_free(file); - } - } - --static inline int file_list_cpu(struct file *file) --{ --#ifdef CONFIG_SMP -- return file->f_sb_list_cpu; --#else -- return smp_processor_id(); --#endif --} -- --/* helper for file_sb_list_add to reduce ifdefs */ --static inline void __file_sb_list_add(struct file *file, struct super_block *sb) --{ -- struct list_head *list; --#ifdef CONFIG_SMP -- int cpu; -- cpu = smp_processor_id(); -- file->f_sb_list_cpu = cpu; -- list = per_cpu_ptr(sb->s_files, cpu); --#else -- list = &sb->s_files; --#endif -- list_add(&file->f_u.fu_list, list); --} -- --/** -- * file_sb_list_add - add a file to the sb's file list -- * @file: file to add -- * @sb: sb to add it to -- * -- * Use this function to associate a file with the superblock of the inode it -- * refers to. -- */ --void file_sb_list_add(struct file *file, struct super_block *sb) --{ -- lg_local_lock(&files_lglock); -- __file_sb_list_add(file, sb); -- lg_local_unlock(&files_lglock); --} -- --/** -- * file_sb_list_del - remove a file from the sb's file list -- * @file: file to remove -- * @sb: sb to remove it from -- * -- * Use this function to remove a file from its superblock. -- */ --void file_sb_list_del(struct file *file) --{ -- if (!list_empty(&file->f_u.fu_list)) { -- lg_local_lock_cpu(&files_lglock, file_list_cpu(file)); -- list_del_init(&file->f_u.fu_list); -- lg_local_unlock_cpu(&files_lglock, file_list_cpu(file)); -- } --} -- --#ifdef CONFIG_SMP -- --/* -- * These macros iterate all files on all CPUs for a given superblock. -- * files_lglock must be held globally. -- */ --#define do_file_list_for_each_entry(__sb, __file) \ --{ \ -- int i; \ -- for_each_possible_cpu(i) { \ -- struct list_head *list; \ -- list = per_cpu_ptr((__sb)->s_files, i); \ -- list_for_each_entry((__file), list, f_u.fu_list) -- --#define while_file_list_for_each_entry \ -- } \ --} -- --#else -- --#define do_file_list_for_each_entry(__sb, __file) \ --{ \ -- struct list_head *list; \ -- list = &(sb)->s_files; \ -- list_for_each_entry((__file), list, f_u.fu_list) -- --#define while_file_list_for_each_entry \ --} -- --#endif -- --/** -- * mark_files_ro - mark all files read-only -- * @sb: superblock in question -- * -- * All files are marked read-only. We don't care about pending -- * delete files so this should be used in 'force' mode only. -- */ --void mark_files_ro(struct super_block *sb) --{ -- struct file *f; -- -- lg_global_lock(&files_lglock); -- do_file_list_for_each_entry(sb, f) { -- if (!S_ISREG(file_inode(f)->i_mode)) -- continue; -- if (!file_count(f)) -- continue; -- if (!(f->f_mode & FMODE_WRITE)) -- continue; -- spin_lock(&f->f_lock); -- f->f_mode &= ~FMODE_WRITE; -- spin_unlock(&f->f_lock); -- if (file_check_writeable(f) != 0) -- continue; -- __mnt_drop_write(f->f_path.mnt); -- file_release_write(f); -- } while_file_list_for_each_entry; -- lg_global_unlock(&files_lglock); --} -- - void __init files_init(unsigned long mempages) - { - unsigned long n; -@@ -481,6 +354,5 @@ void __init files_init(unsigned long mempages) - n = (mempages * (PAGE_SIZE / 1024)) / 10; - files_stat.max_files = max_t(unsigned long, n, NR_FILE); - files_defer_init(); -- lg_lock_init(&files_lglock, "files_lglock"); - percpu_counter_init(&nr_files, 0); - } -diff --git a/fs/internal.h b/fs/internal.h -index 68121584ae37..2ffa65a36ca0 100644 ---- a/fs/internal.h -+++ b/fs/internal.h -@@ -74,9 +74,6 @@ extern void chroot_fs_refs(const struct path *, const struct path *); - /* - * file_table.c - */ --extern void file_sb_list_add(struct file *f, struct super_block *sb); --extern void file_sb_list_del(struct file *f); --extern void mark_files_ro(struct super_block *); - extern struct file *get_empty_filp(void); - - /* -diff --git a/fs/open.c b/fs/open.c -index 86092bde31f4..5f129683b7d7 100644 ---- a/fs/open.c -+++ b/fs/open.c -@@ -674,7 +674,6 @@ static int do_dentry_open(struct file *f, - } - - f->f_mapping = inode->i_mapping; -- file_sb_list_add(f, inode->i_sb); - - if (unlikely(f->f_mode & FMODE_PATH)) { - f->f_op = &empty_fops; -@@ -709,7 +708,6 @@ static int do_dentry_open(struct file *f, - - cleanup_all: - fops_put(f->f_op); -- file_sb_list_del(f); - if (f->f_mode & FMODE_WRITE) { - if (!special_file(inode->i_mode)) { - /* -diff --git a/fs/super.c b/fs/super.c -index e028b508db25..97280e76179c 100644 ---- a/fs/super.c -+++ b/fs/super.c -@@ -163,19 +163,6 @@ static struct super_block *alloc_super(struct file_system_type *type, int flags) - s = NULL; - goto out; - } --#ifdef CONFIG_SMP -- s->s_files = alloc_percpu(struct list_head); -- if (!s->s_files) -- goto err_out; -- else { -- int i; -- -- for_each_possible_cpu(i) -- INIT_LIST_HEAD(per_cpu_ptr(s->s_files, i)); -- } --#else -- INIT_LIST_HEAD(&s->s_files); --#endif - if (init_sb_writers(s, type)) - goto err_out; - s->s_flags = flags; -@@ -225,10 +212,6 @@ out: - return s; - err_out: - security_sb_free(s); --#ifdef CONFIG_SMP -- if (s->s_files) -- free_percpu(s->s_files); --#endif - destroy_sb_writers(s); - kfree(s); - s = NULL; -@@ -243,9 +226,6 @@ err_out: - */ - static inline void destroy_super(struct super_block *s) - { --#ifdef CONFIG_SMP -- free_percpu(s->s_files); --#endif - destroy_sb_writers(s); - security_sb_free(s); - WARN_ON(!list_empty(&s->s_mounts)); -@@ -727,7 +707,8 @@ int do_remount_sb(struct super_block *sb, int flags, void *data, int force) - make sure there are no rw files opened */ - if (remount_ro) { - if (force) { -- mark_files_ro(sb); -+ sb->s_readonly_remount = 1; -+ smp_wmb(); - } else { - retval = sb_prepare_remount_readonly(sb); - if (retval) -diff --git a/include/linux/fs.h b/include/linux/fs.h -index d57bc5df7225..5c9dc8471da5 100644 ---- a/include/linux/fs.h -+++ b/include/linux/fs.h -@@ -10,6 +10,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -761,12 +762,8 @@ static inline int ra_has_index(struct file_ra_state *ra, pgoff_t index) - #define FILE_MNT_WRITE_RELEASED 2 - - struct file { -- /* -- * fu_list becomes invalid after file_free is called and queued via -- * fu_rcuhead for RCU freeing -- */ - union { -- struct list_head fu_list; -+ struct llist_node fu_llist; - struct rcu_head fu_rcuhead; - } f_u; - struct path f_path; -@@ -779,9 +776,6 @@ struct file { - * Must not be taken from IRQ context. - */ - spinlock_t f_lock; --#ifdef CONFIG_SMP -- int f_sb_list_cpu; --#endif - atomic_long_t f_count; - unsigned int f_flags; - fmode_t f_mode; -@@ -1257,11 +1251,6 @@ struct super_block { - - struct list_head s_inodes; /* all inodes */ - struct hlist_bl_head s_anon; /* anonymous dentries for (nfs) exporting */ --#ifdef CONFIG_SMP -- struct list_head __percpu *s_files; --#else -- struct list_head s_files; --#endif - struct list_head s_mounts; /* list of mounts; _not_ for fs use */ - /* s_dentry_lru, s_nr_dentry_unused protected by dcache.c lru locks */ - struct list_head s_dentry_lru; /* unused dentry lru */ -diff --git a/include/linux/mbus.h b/include/linux/mbus.h -index dba482e31a13..e80b9c7ec8da 100644 ---- a/include/linux/mbus.h -+++ b/include/linux/mbus.h -@@ -67,6 +67,6 @@ int mvebu_mbus_add_window(const char *devname, phys_addr_t base, - int mvebu_mbus_del_window(phys_addr_t base, size_t size); - int mvebu_mbus_init(const char *soc, phys_addr_t mbus_phys_base, - size_t mbus_size, phys_addr_t sdram_phys_base, -- size_t sdram_size); -+ size_t sdram_size, int is_coherent); - - #endif /* __LINUX_MBUS_H */ -diff --git a/include/linux/sched.h b/include/linux/sched.h -index 00c1d4f45072..7cf305d036db 100644 ---- a/include/linux/sched.h -+++ b/include/linux/sched.h -@@ -2203,15 +2203,15 @@ static inline bool thread_group_leader(struct task_struct *p) - * all we care about is that we have a task with the appropriate - * pid, we don't actually care if we have the right task. - */ --static inline int has_group_leader_pid(struct task_struct *p) -+static inline bool has_group_leader_pid(struct task_struct *p) - { -- return p->pid == p->tgid; -+ return task_pid(p) == p->signal->leader_pid; - } - - static inline --int same_thread_group(struct task_struct *p1, struct task_struct *p2) -+bool same_thread_group(struct task_struct *p1, struct task_struct *p2) - { -- return p1->tgid == p2->tgid; -+ return p1->signal == p2->signal; - } - - static inline struct task_struct *next_thread(const struct task_struct *p) -diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h -index 665e0cee59bd..5e661a979694 100644 ---- a/include/net/ip6_fib.h -+++ b/include/net/ip6_fib.h -@@ -301,7 +301,7 @@ extern void inet6_rt_notify(int event, struct rt6_info *rt, - struct nl_info *info); - - extern void fib6_run_gc(unsigned long expires, -- struct net *net); -+ struct net *net, bool force); - - extern void fib6_gc_cleanup(void); - -diff --git a/kernel/ptrace.c b/kernel/ptrace.c -index 118323bc8529..30ab20623bca 100644 ---- a/kernel/ptrace.c -+++ b/kernel/ptrace.c -@@ -236,7 +236,7 @@ static int __ptrace_may_access(struct task_struct *task, unsigned int mode) - */ - int dumpable = 0; - /* Don't let security modules deny introspection */ -- if (task == current) -+ if (same_thread_group(task, current)) - return 0; - rcu_read_lock(); - tcred = __task_cred(task); -diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c -index 9a459be24af7..9b5b5ddf8cd4 100644 ---- a/net/ipv4/xfrm4_policy.c -+++ b/net/ipv4/xfrm4_policy.c -@@ -235,7 +235,7 @@ static struct dst_ops xfrm4_dst_ops = { - .destroy = xfrm4_dst_destroy, - .ifdown = xfrm4_dst_ifdown, - .local_out = __ip_local_out, -- .gc_thresh = 1024, -+ .gc_thresh = 32768, - }; - - static struct xfrm_policy_afinfo xfrm4_policy_afinfo = { -diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c -index ceeb9458bb60..46458ee31939 100644 ---- a/net/ipv6/ip6_fib.c -+++ b/net/ipv6/ip6_fib.c -@@ -1648,27 +1648,28 @@ static int fib6_age(struct rt6_info *rt, void *arg) - - static DEFINE_SPINLOCK(fib6_gc_lock); - --void fib6_run_gc(unsigned long expires, struct net *net) -+void fib6_run_gc(unsigned long expires, struct net *net, bool force) - { -- if (expires != ~0UL) { -+ unsigned long now; -+ -+ if (force) { - spin_lock_bh(&fib6_gc_lock); -- gc_args.timeout = expires ? (int)expires : -- net->ipv6.sysctl.ip6_rt_gc_interval; -- } else { -- if (!spin_trylock_bh(&fib6_gc_lock)) { -- mod_timer(&net->ipv6.ip6_fib_timer, jiffies + HZ); -- return; -- } -- gc_args.timeout = net->ipv6.sysctl.ip6_rt_gc_interval; -+ } else if (!spin_trylock_bh(&fib6_gc_lock)) { -+ mod_timer(&net->ipv6.ip6_fib_timer, jiffies + HZ); -+ return; - } -+ gc_args.timeout = expires ? (int)expires : -+ net->ipv6.sysctl.ip6_rt_gc_interval; - - gc_args.more = icmp6_dst_gc(); - - fib6_clean_all(net, fib6_age, 0, NULL); -+ now = jiffies; -+ net->ipv6.ip6_rt_last_gc = now; - - if (gc_args.more) - mod_timer(&net->ipv6.ip6_fib_timer, -- round_jiffies(jiffies -+ round_jiffies(now - + net->ipv6.sysctl.ip6_rt_gc_interval)); - else - del_timer(&net->ipv6.ip6_fib_timer); -@@ -1677,7 +1678,7 @@ void fib6_run_gc(unsigned long expires, struct net *net) - - static void fib6_gc_timer_cb(unsigned long arg) - { -- fib6_run_gc(0, (struct net *)arg); -+ fib6_run_gc(0, (struct net *)arg, true); - } - - static int __net_init fib6_net_init(struct net *net) -diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c -index 05f361338c2e..deedf7ddbc6e 100644 ---- a/net/ipv6/ndisc.c -+++ b/net/ipv6/ndisc.c -@@ -1584,7 +1584,7 @@ static int ndisc_netdev_event(struct notifier_block *this, unsigned long event, - switch (event) { - case NETDEV_CHANGEADDR: - neigh_changeaddr(&nd_tbl, dev); -- fib6_run_gc(~0UL, net); -+ fib6_run_gc(0, net, false); - idev = in6_dev_get(dev); - if (!idev) - break; -@@ -1594,7 +1594,7 @@ static int ndisc_netdev_event(struct notifier_block *this, unsigned long event, - break; - case NETDEV_DOWN: - neigh_ifdown(&nd_tbl, dev); -- fib6_run_gc(~0UL, net); -+ fib6_run_gc(0, net, false); - break; - case NETDEV_NOTIFY_PEERS: - ndisc_send_unsol_na(dev); -diff --git a/net/ipv6/route.c b/net/ipv6/route.c -index d94d224f7e68..6ebefd46f718 100644 ---- a/net/ipv6/route.c -+++ b/net/ipv6/route.c -@@ -1334,7 +1334,6 @@ static void icmp6_clean_all(int (*func)(struct rt6_info *rt, void *arg), - - static int ip6_dst_gc(struct dst_ops *ops) - { -- unsigned long now = jiffies; - struct net *net = container_of(ops, struct net, ipv6.ip6_dst_ops); - int rt_min_interval = net->ipv6.sysctl.ip6_rt_gc_min_interval; - int rt_max_size = net->ipv6.sysctl.ip6_rt_max_size; -@@ -1344,13 +1343,12 @@ static int ip6_dst_gc(struct dst_ops *ops) - int entries; - - entries = dst_entries_get_fast(ops); -- if (time_after(rt_last_gc + rt_min_interval, now) && -+ if (time_after(rt_last_gc + rt_min_interval, jiffies) && - entries <= rt_max_size) - goto out; - - net->ipv6.ip6_rt_gc_expire++; -- fib6_run_gc(net->ipv6.ip6_rt_gc_expire, net); -- net->ipv6.ip6_rt_last_gc = now; -+ fib6_run_gc(net->ipv6.ip6_rt_gc_expire, net, entries > rt_max_size); - entries = dst_entries_get_slow(ops); - if (entries < ops->gc_thresh) - net->ipv6.ip6_rt_gc_expire = rt_gc_timeout>>1; -@@ -2849,7 +2847,7 @@ int ipv6_sysctl_rtcache_flush(ctl_table *ctl, int write, - net = (struct net *)ctl->extra1; - delay = net->ipv6.sysctl.flush_delay; - proc_dointvec(ctl, write, buffer, lenp, ppos); -- fib6_run_gc(delay <= 0 ? ~0UL : (unsigned long)delay, net); -+ fib6_run_gc(delay <= 0 ? 0 : (unsigned long)delay, net, delay > 0); - return 0; - } - -diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c -index 23ed03d786c8..1c2e0c9ba8a1 100644 ---- a/net/ipv6/xfrm6_policy.c -+++ b/net/ipv6/xfrm6_policy.c -@@ -284,7 +284,7 @@ static struct dst_ops xfrm6_dst_ops = { - .destroy = xfrm6_dst_destroy, - .ifdown = xfrm6_dst_ifdown, - .local_out = __ip6_local_out, -- .gc_thresh = 1024, -+ .gc_thresh = 32768, - }; - - static struct xfrm_policy_afinfo xfrm6_policy_afinfo = { -diff --git a/net/netfilter/nfnetlink_cthelper.c b/net/netfilter/nfnetlink_cthelper.c -index a191b6db657e..3b283edec027 100644 ---- a/net/netfilter/nfnetlink_cthelper.c -+++ b/net/netfilter/nfnetlink_cthelper.c -@@ -74,6 +74,9 @@ nfnl_cthelper_parse_tuple(struct nf_conntrack_tuple *tuple, - if (!tb[NFCTH_TUPLE_L3PROTONUM] || !tb[NFCTH_TUPLE_L4PROTONUM]) - return -EINVAL; - -+ /* Not all fields are initialized so first zero the tuple */ -+ memset(tuple, 0, sizeof(struct nf_conntrack_tuple)); -+ - tuple->src.l3num = ntohs(nla_get_be16(tb[NFCTH_TUPLE_L3PROTONUM])); - tuple->dst.protonum = nla_get_u8(tb[NFCTH_TUPLE_L4PROTONUM]); - -@@ -83,7 +86,7 @@ nfnl_cthelper_parse_tuple(struct nf_conntrack_tuple *tuple, - static int - nfnl_cthelper_from_nlattr(struct nlattr *attr, struct nf_conn *ct) - { -- const struct nf_conn_help *help = nfct_help(ct); -+ struct nf_conn_help *help = nfct_help(ct); - - if (attr == NULL) - return -EINVAL; -@@ -91,7 +94,7 @@ nfnl_cthelper_from_nlattr(struct nlattr *attr, struct nf_conn *ct) - if (help->helper->data_len == 0) - return -EINVAL; - -- memcpy(&help->data, nla_data(attr), help->helper->data_len); -+ memcpy(help->data, nla_data(attr), help->helper->data_len); - return 0; - } - diff --git a/patch/kernel/marvell-default/1-patch-3.10.83-84.patch b/patch/kernel/marvell-default/1-patch-3.10.83-84.patch deleted file mode 100644 index 285159643c..0000000000 --- a/patch/kernel/marvell-default/1-patch-3.10.83-84.patch +++ /dev/null @@ -1,369 +0,0 @@ -diff --git a/Makefile b/Makefile -index 21529dbcc11d..f7b10bb56737 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,6 +1,6 @@ - VERSION = 3 - PATCHLEVEL = 10 --SUBLEVEL = 83 -+SUBLEVEL = 84 - EXTRAVERSION = - NAME = TOSSUG Baby Fish - -diff --git a/arch/arm/kvm/interrupts.S b/arch/arm/kvm/interrupts.S -index 16cd4ba5d7fd..bb117abb1b3b 100644 ---- a/arch/arm/kvm/interrupts.S -+++ b/arch/arm/kvm/interrupts.S -@@ -159,13 +159,9 @@ __kvm_vcpu_return: - @ Don't trap coprocessor accesses for host kernel - set_hstr vmexit - set_hdcr vmexit -- set_hcptr vmexit, (HCPTR_TTA | HCPTR_TCP(10) | HCPTR_TCP(11)) -+ set_hcptr vmexit, (HCPTR_TTA | HCPTR_TCP(10) | HCPTR_TCP(11)), after_vfp_restore - - #ifdef CONFIG_VFPv3 -- @ Save floating point registers we if let guest use them. -- tst r2, #(HCPTR_TCP(10) | HCPTR_TCP(11)) -- bne after_vfp_restore -- - @ Switch VFP/NEON hardware state to the host's - add r7, vcpu, #VCPU_VFP_GUEST - store_vfp_state r7 -@@ -177,6 +173,8 @@ after_vfp_restore: - @ Restore FPEXC_EN which we clobbered on entry - pop {r2} - VFPFMXR FPEXC, r2 -+#else -+after_vfp_restore: - #endif - - @ Reset Hyp-role -@@ -458,7 +456,7 @@ switch_to_guest_vfp: - push {r3-r7} - - @ NEON/VFP used. Turn on VFP access. -- set_hcptr vmexit, (HCPTR_TCP(10) | HCPTR_TCP(11)) -+ set_hcptr vmtrap, (HCPTR_TCP(10) | HCPTR_TCP(11)) - - @ Switch VFP/NEON hardware state to the guest's - add r7, r0, #VCPU_VFP_HOST -diff --git a/arch/arm/kvm/interrupts_head.S b/arch/arm/kvm/interrupts_head.S -index 6f18695a09cb..b6f6137f5984 100644 ---- a/arch/arm/kvm/interrupts_head.S -+++ b/arch/arm/kvm/interrupts_head.S -@@ -570,8 +570,13 @@ vcpu .req r0 @ vcpu pointer always in r0 - .endm - - /* Configures the HCPTR (Hyp Coprocessor Trap Register) on entry/return -- * (hardware reset value is 0). Keep previous value in r2. */ --.macro set_hcptr operation, mask -+ * (hardware reset value is 0). Keep previous value in r2. -+ * An ISB is emited on vmexit/vmtrap, but executed on vmexit only if -+ * VFP wasn't already enabled (always executed on vmtrap). -+ * If a label is specified with vmexit, it is branched to if VFP wasn't -+ * enabled. -+ */ -+.macro set_hcptr operation, mask, label = none - mrc p15, 4, r2, c1, c1, 2 - ldr r3, =\mask - .if \operation == vmentry -@@ -580,6 +585,17 @@ vcpu .req r0 @ vcpu pointer always in r0 - bic r3, r2, r3 @ Don't trap defined coproc-accesses - .endif - mcr p15, 4, r3, c1, c1, 2 -+ .if \operation != vmentry -+ .if \operation == vmexit -+ tst r2, #(HCPTR_TCP(10) | HCPTR_TCP(11)) -+ beq 1f -+ .endif -+ isb -+ .if \label != none -+ b \label -+ .endif -+1: -+ .endif - .endm - - /* Configures the HDCR (Hyp Debug Configuration Register) on entry/return -diff --git a/arch/mips/include/asm/mach-generic/spaces.h b/arch/mips/include/asm/mach-generic/spaces.h -index 5b2f2e68e57f..503eb6ca5802 100644 ---- a/arch/mips/include/asm/mach-generic/spaces.h -+++ b/arch/mips/include/asm/mach-generic/spaces.h -@@ -90,7 +90,11 @@ - #endif - - #ifndef FIXADDR_TOP -+#ifdef CONFIG_KVM_GUEST -+#define FIXADDR_TOP ((unsigned long)(long)(int)0x7ffe0000) -+#else - #define FIXADDR_TOP ((unsigned long)(long)(int)0xfffe0000) - #endif -+#endif - - #endif /* __ASM_MACH_GENERIC_SPACES_H */ -diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c -index 846861a20b07..b63dc809596d 100644 ---- a/arch/powerpc/perf/core-book3s.c -+++ b/arch/powerpc/perf/core-book3s.c -@@ -112,7 +112,16 @@ static inline void power_pmu_bhrb_read(struct cpu_hw_events *cpuhw) {} - - static bool regs_use_siar(struct pt_regs *regs) - { -- return !!regs->result; -+ /* -+ * When we take a performance monitor exception the regs are setup -+ * using perf_read_regs() which overloads some fields, in particular -+ * regs->result to tell us whether to use SIAR. -+ * -+ * However if the regs are from another exception, eg. a syscall, then -+ * they have not been setup using perf_read_regs() and so regs->result -+ * is something random. -+ */ -+ return ((TRAP(regs) == 0xf00) && regs->result); - } - - /* -diff --git a/arch/sparc/kernel/ldc.c b/arch/sparc/kernel/ldc.c -index fa4c900a0d1f..62983d77455e 100644 ---- a/arch/sparc/kernel/ldc.c -+++ b/arch/sparc/kernel/ldc.c -@@ -2306,7 +2306,7 @@ void *ldc_alloc_exp_dring(struct ldc_channel *lp, unsigned int len, - if (len & (8UL - 1)) - return ERR_PTR(-EINVAL); - -- buf = kzalloc(len, GFP_KERNEL); -+ buf = kzalloc(len, GFP_ATOMIC); - if (!buf) - return ERR_PTR(-ENOMEM); - -diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h -index 4c481e751e8e..98b68c2f1a1c 100644 ---- a/arch/x86/include/asm/kvm_host.h -+++ b/arch/x86/include/asm/kvm_host.h -@@ -541,7 +541,7 @@ struct kvm_arch { - struct kvm_pic *vpic; - struct kvm_ioapic *vioapic; - struct kvm_pit *vpit; -- int vapics_in_nmi_mode; -+ atomic_t vapics_in_nmi_mode; - struct mutex apic_map_lock; - struct kvm_apic_map *apic_map; - -diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c -index 298781d4cfb4..1406ffde3e35 100644 ---- a/arch/x86/kvm/i8254.c -+++ b/arch/x86/kvm/i8254.c -@@ -305,7 +305,7 @@ static void pit_do_work(struct kthread_work *work) - * LVT0 to NMI delivery. Other PIC interrupts are just sent to - * VCPU0, and only if its LVT0 is in EXTINT mode. - */ -- if (kvm->arch.vapics_in_nmi_mode > 0) -+ if (atomic_read(&kvm->arch.vapics_in_nmi_mode) > 0) - kvm_for_each_vcpu(i, vcpu, kvm) - kvm_apic_nmi_wd_deliver(vcpu); - } -diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c -index 681e4e251f00..ff280209d7de 100644 ---- a/arch/x86/kvm/lapic.c -+++ b/arch/x86/kvm/lapic.c -@@ -1123,10 +1123,10 @@ static void apic_manage_nmi_watchdog(struct kvm_lapic *apic, u32 lvt0_val) - if (!nmi_wd_enabled) { - apic_debug("Receive NMI setting on APIC_LVT0 " - "for cpu %d\n", apic->vcpu->vcpu_id); -- apic->vcpu->kvm->arch.vapics_in_nmi_mode++; -+ atomic_inc(&apic->vcpu->kvm->arch.vapics_in_nmi_mode); - } - } else if (nmi_wd_enabled) -- apic->vcpu->kvm->arch.vapics_in_nmi_mode--; -+ atomic_dec(&apic->vcpu->kvm->arch.vapics_in_nmi_mode); - } - - static int apic_reg_write(struct kvm_lapic *apic, u32 reg, u32 val) -diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c -index 3e724256dbee..a3b0265c2ca7 100644 ---- a/arch/x86/pci/acpi.c -+++ b/arch/x86/pci/acpi.c -@@ -84,6 +84,17 @@ static const struct dmi_system_id pci_crs_quirks[] __initconst = { - DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies, LTD"), - }, - }, -+ /* https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/931368 */ -+ /* https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/1033299 */ -+ { -+ .callback = set_use_crs, -+ .ident = "Foxconn K8M890-8237A", -+ .matches = { -+ DMI_MATCH(DMI_BOARD_VENDOR, "Foxconn"), -+ DMI_MATCH(DMI_BOARD_NAME, "K8M890-8237A"), -+ DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies, LTD"), -+ }, -+ }, - - /* Now for the blacklist.. */ - -diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c -index 5b2b5e61e4f9..057d894eee66 100644 ---- a/drivers/crypto/talitos.c -+++ b/drivers/crypto/talitos.c -@@ -935,7 +935,8 @@ static int sg_to_link_tbl(struct scatterlist *sg, int sg_count, - sg_count--; - link_tbl_ptr--; - } -- be16_add_cpu(&link_tbl_ptr->len, cryptlen); -+ link_tbl_ptr->len = cpu_to_be16(be16_to_cpu(link_tbl_ptr->len) -+ + cryptlen); - - /* tag end of link table */ - link_tbl_ptr->j_extent = DESC_PTR_LNKTBL_RETURN; -@@ -2621,6 +2622,7 @@ static struct talitos_crypto_alg *talitos_alg_alloc(struct device *dev, - break; - default: - dev_err(dev, "unknown algorithm type %d\n", t_alg->algt.type); -+ kfree(t_alg); - return ERR_PTR(-EINVAL); - } - -diff --git a/fs/inode.c b/fs/inode.c -index 1b300a06b8be..17f95b417955 100644 ---- a/fs/inode.c -+++ b/fs/inode.c -@@ -1628,8 +1628,8 @@ int file_remove_suid(struct file *file) - error = security_inode_killpriv(dentry); - if (!error && killsuid) - error = __remove_suid(dentry, killsuid); -- if (!error && (inode->i_sb->s_flags & MS_NOSEC)) -- inode->i_flags |= S_NOSEC; -+ if (!error) -+ inode_has_no_xattr(inode); - - return error; - } -diff --git a/net/bridge/br_ioctl.c b/net/bridge/br_ioctl.c -index cd8c3a44ab7d..b73eaba85667 100644 ---- a/net/bridge/br_ioctl.c -+++ b/net/bridge/br_ioctl.c -@@ -247,9 +247,7 @@ static int old_dev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) - if (!ns_capable(dev_net(dev)->user_ns, CAP_NET_ADMIN)) - return -EPERM; - -- spin_lock_bh(&br->lock); - br_stp_set_bridge_priority(br, args[1]); -- spin_unlock_bh(&br->lock); - return 0; - - case BRCTL_SET_PORT_PRIORITY: -diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c -index 49b4a82d3f86..a09ea178348c 100644 ---- a/net/bridge/br_multicast.c -+++ b/net/bridge/br_multicast.c -@@ -1026,6 +1026,9 @@ static void br_multicast_add_router(struct net_bridge *br, - struct net_bridge_port *p; - struct hlist_node *slot = NULL; - -+ if (!hlist_unhashed(&port->rlist)) -+ return; -+ - hlist_for_each_entry(p, &br->router_list, rlist) { - if ((unsigned long) port >= (unsigned long) p) - break; -@@ -1053,12 +1056,8 @@ static void br_multicast_mark_router(struct net_bridge *br, - if (port->multicast_router != 1) - return; - -- if (!hlist_unhashed(&port->rlist)) -- goto timer; -- - br_multicast_add_router(br, port); - --timer: - mod_timer(&port->multicast_router_timer, - now + br->multicast_querier_interval); - } -diff --git a/net/bridge/br_stp_if.c b/net/bridge/br_stp_if.c -index 656a6f3e40de..886f6d6dc48a 100644 ---- a/net/bridge/br_stp_if.c -+++ b/net/bridge/br_stp_if.c -@@ -241,12 +241,13 @@ bool br_stp_recalculate_bridge_id(struct net_bridge *br) - return true; - } - --/* called under bridge lock */ -+/* Acquires and releases bridge lock */ - void br_stp_set_bridge_priority(struct net_bridge *br, u16 newprio) - { - struct net_bridge_port *p; - int wasroot; - -+ spin_lock_bh(&br->lock); - wasroot = br_is_root_bridge(br); - - list_for_each_entry(p, &br->port_list, list) { -@@ -264,6 +265,7 @@ void br_stp_set_bridge_priority(struct net_bridge *br, u16 newprio) - br_port_state_selection(br); - if (br_is_root_bridge(br) && !wasroot) - br_become_root_bridge(br); -+ spin_unlock_bh(&br->lock); - } - - /* called under bridge lock */ -diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c -index 81b4b816f131..39fa33969b09 100644 ---- a/net/packet/af_packet.c -+++ b/net/packet/af_packet.c -@@ -1150,16 +1150,6 @@ static void packet_sock_destruct(struct sock *sk) - sk_refcnt_debug_dec(sk); - } - --static int fanout_rr_next(struct packet_fanout *f, unsigned int num) --{ -- int x = atomic_read(&f->rr_cur) + 1; -- -- if (x >= num) -- x = 0; -- -- return x; --} -- - static unsigned int fanout_demux_hash(struct packet_fanout *f, - struct sk_buff *skb, - unsigned int num) -@@ -1171,13 +1161,9 @@ static unsigned int fanout_demux_lb(struct packet_fanout *f, - struct sk_buff *skb, - unsigned int num) - { -- int cur, old; -+ unsigned int val = atomic_inc_return(&f->rr_cur); - -- cur = atomic_read(&f->rr_cur); -- while ((old = atomic_cmpxchg(&f->rr_cur, cur, -- fanout_rr_next(f, num))) != cur) -- cur = old; -- return cur; -+ return val % num; - } - - static unsigned int fanout_demux_cpu(struct packet_fanout *f, -@@ -1217,7 +1203,7 @@ static int packet_rcv_fanout(struct sk_buff *skb, struct net_device *dev, - struct packet_type *pt, struct net_device *orig_dev) - { - struct packet_fanout *f = pt->af_packet_priv; -- unsigned int num = f->num_members; -+ unsigned int num = ACCESS_ONCE(f->num_members); - struct packet_sock *po; - unsigned int idx; - -diff --git a/net/sctp/output.c b/net/sctp/output.c -index 73b8ca51ba14..2d9689333fe4 100644 ---- a/net/sctp/output.c -+++ b/net/sctp/output.c -@@ -618,7 +618,9 @@ out: - return err; - no_route: - kfree_skb(nskb); -- IP_INC_STATS(sock_net(asoc->base.sk), IPSTATS_MIB_OUTNOROUTES); -+ -+ if (asoc) -+ IP_INC_STATS(sock_net(asoc->base.sk), IPSTATS_MIB_OUTNOROUTES); - - /* FIXME: Returning the 'err' will effect all the associations - * associated with a socket, although only one of the paths of the diff --git a/patch/kernel/marvell-default/1-patch-3.10.84-85.patch b/patch/kernel/marvell-default/1-patch-3.10.84-85.patch deleted file mode 100644 index 6a340db404..0000000000 --- a/patch/kernel/marvell-default/1-patch-3.10.84-85.patch +++ /dev/null @@ -1,2832 +0,0 @@ -diff --git a/Documentation/devicetree/bindings/pinctrl/marvell,armada-370-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/marvell,armada-370-pinctrl.txt -index 01ef408e205f..8faff12e7014 100644 ---- a/Documentation/devicetree/bindings/pinctrl/marvell,armada-370-pinctrl.txt -+++ b/Documentation/devicetree/bindings/pinctrl/marvell,armada-370-pinctrl.txt -@@ -91,5 +91,5 @@ mpp61 61 gpo, dev(wen1), uart1(txd), audio(rclk) - mpp62 62 gpio, dev(a2), uart1(cts), tdm(drx), pcie(clkreq0), - audio(mclk), uart0(cts) - mpp63 63 gpo, spi0(sck), tclk --mpp64 64 gpio, spi0(miso), spi0-1(cs1) --mpp65 65 gpio, spi0(mosi), spi0-1(cs2) -+mpp64 64 gpio, spi0(miso), spi0(cs1) -+mpp65 65 gpio, spi0(mosi), spi0(cs2) -diff --git a/Documentation/devicetree/bindings/pinctrl/marvell,armada-xp-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/marvell,armada-xp-pinctrl.txt -index bfa0a2e5e0cb..86dec67e5450 100644 ---- a/Documentation/devicetree/bindings/pinctrl/marvell,armada-xp-pinctrl.txt -+++ b/Documentation/devicetree/bindings/pinctrl/marvell,armada-xp-pinctrl.txt -@@ -41,15 +41,15 @@ mpp20 20 gpio, ge0(rxd4), ge1(rxd2), lcd(d20), ptp(clk) - mpp21 21 gpio, ge0(rxd5), ge1(rxd3), lcd(d21), mem(bat) - mpp22 22 gpio, ge0(rxd6), ge1(rxctl), lcd(d22), sata0(prsnt) - mpp23 23 gpio, ge0(rxd7), ge1(rxclk), lcd(d23), sata1(prsnt) --mpp24 24 gpio, lcd(hsync), sata1(prsnt), nf(bootcs-re), tdm(rst) --mpp25 25 gpio, lcd(vsync), sata0(prsnt), nf(bootcs-we), tdm(pclk) --mpp26 26 gpio, lcd(clk), tdm(fsync), vdd(cpu1-pd) -+mpp24 24 gpio, lcd(hsync), sata1(prsnt), tdm(rst) -+mpp25 25 gpio, lcd(vsync), sata0(prsnt), tdm(pclk) -+mpp26 26 gpio, lcd(clk), tdm(fsync) - mpp27 27 gpio, lcd(e), tdm(dtx), ptp(trig) - mpp28 28 gpio, lcd(pwm), tdm(drx), ptp(evreq) --mpp29 29 gpio, lcd(ref-clk), tdm(int0), ptp(clk), vdd(cpu0-pd) -+mpp29 29 gpio, lcd(ref-clk), tdm(int0), ptp(clk) - mpp30 30 gpio, tdm(int1), sd0(clk) --mpp31 31 gpio, tdm(int2), sd0(cmd), vdd(cpu0-pd) --mpp32 32 gpio, tdm(int3), sd0(d0), vdd(cpu1-pd) -+mpp31 31 gpio, tdm(int2), sd0(cmd) -+mpp32 32 gpio, tdm(int3), sd0(d0) - mpp33 33 gpio, tdm(int4), sd0(d1), mem(bat) - mpp34 34 gpio, tdm(int5), sd0(d2), sata0(prsnt) - mpp35 35 gpio, tdm(int6), sd0(d3), sata1(prsnt) -@@ -57,21 +57,18 @@ mpp36 36 gpio, spi(mosi) - mpp37 37 gpio, spi(miso) - mpp38 38 gpio, spi(sck) - mpp39 39 gpio, spi(cs0) --mpp40 40 gpio, spi(cs1), uart2(cts), lcd(vga-hsync), vdd(cpu1-pd), -- pcie(clkreq0) -+mpp40 40 gpio, spi(cs1), uart2(cts), lcd(vga-hsync), pcie(clkreq0) - mpp41 41 gpio, spi(cs2), uart2(rts), lcd(vga-vsync), sata1(prsnt), - pcie(clkreq1) --mpp42 42 gpio, uart2(rxd), uart0(cts), tdm(int7), tdm-1(timer), -- vdd(cpu0-pd) --mpp43 43 gpio, uart2(txd), uart0(rts), spi(cs3), pcie(rstout), -- vdd(cpu2-3-pd){1} -+mpp42 42 gpio, uart2(rxd), uart0(cts), tdm(int7), tdm-1(timer) -+mpp43 43 gpio, uart2(txd), uart0(rts), spi(cs3), pcie(rstout) - mpp44 44 gpio, uart2(cts), uart3(rxd), spi(cs4), pcie(clkreq2), - mem(bat) - mpp45 45 gpio, uart2(rts), uart3(txd), spi(cs5), sata1(prsnt) - mpp46 46 gpio, uart3(rts), uart1(rts), spi(cs6), sata0(prsnt) - mpp47 47 gpio, uart3(cts), uart1(cts), spi(cs7), pcie(clkreq3), - ref(clkout) --mpp48 48 gpio, tclk, dev(burst/last) -+mpp48 48 gpio, dev(clkout), dev(burst/last) - - * Marvell Armada XP (mv78260 and mv78460 only) - -@@ -83,9 +80,9 @@ mpp51 51 gpio, dev(ad16) - mpp52 52 gpio, dev(ad17) - mpp53 53 gpio, dev(ad18) - mpp54 54 gpio, dev(ad19) --mpp55 55 gpio, dev(ad20), vdd(cpu0-pd) --mpp56 56 gpio, dev(ad21), vdd(cpu1-pd) --mpp57 57 gpio, dev(ad22), vdd(cpu2-3-pd){1} -+mpp55 55 gpio, dev(ad20) -+mpp56 56 gpio, dev(ad21) -+mpp57 57 gpio, dev(ad22) - mpp58 58 gpio, dev(ad23) - mpp59 59 gpio, dev(ad24) - mpp60 60 gpio, dev(ad25) -@@ -95,6 +92,3 @@ mpp63 63 gpio, dev(ad28) - mpp64 64 gpio, dev(ad29) - mpp65 65 gpio, dev(ad30) - mpp66 66 gpio, dev(ad31) -- --Notes: --* {1} vdd(cpu2-3-pd) only available on mv78460. -diff --git a/Documentation/devicetree/bindings/spi/spi_pl022.txt b/Documentation/devicetree/bindings/spi/spi_pl022.txt -index 22ed6797216d..4d1673ca8cf8 100644 ---- a/Documentation/devicetree/bindings/spi/spi_pl022.txt -+++ b/Documentation/devicetree/bindings/spi/spi_pl022.txt -@@ -4,9 +4,9 @@ Required properties: - - compatible : "arm,pl022", "arm,primecell" - - reg : Offset and length of the register set for the device - - interrupts : Should contain SPI controller interrupt -+- num-cs : total number of chipselects - - Optional properties: --- num-cs : total number of chipselects - - cs-gpios : should specify GPIOs used for chipselects. - The gpios will be referred to as reg = in the SPI child nodes. - If unspecified, a single SPI device without a chip select can be used. -diff --git a/Makefile b/Makefile -index f7b10bb56737..11a7e7bc31f2 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,6 +1,6 @@ - VERSION = 3 - PATCHLEVEL = 10 --SUBLEVEL = 84 -+SUBLEVEL = 85 - EXTRAVERSION = - NAME = TOSSUG Baby Fish - -diff --git a/arch/arc/include/asm/cmpxchg.h b/arch/arc/include/asm/cmpxchg.h -index 03cd6894855d..90de5c528da2 100644 ---- a/arch/arc/include/asm/cmpxchg.h -+++ b/arch/arc/include/asm/cmpxchg.h -@@ -25,10 +25,11 @@ __cmpxchg(volatile void *ptr, unsigned long expected, unsigned long new) - " scond %3, [%1] \n" - " bnz 1b \n" - "2: \n" -- : "=&r"(prev) -- : "r"(ptr), "ir"(expected), -- "r"(new) /* can't be "ir". scond can't take limm for "b" */ -- : "cc"); -+ : "=&r"(prev) /* Early clobber, to prevent reg reuse */ -+ : "r"(ptr), /* Not "m": llock only supports reg direct addr mode */ -+ "ir"(expected), -+ "r"(new) /* can't be "ir". scond can't take LIMM for "b" */ -+ : "cc", "memory"); /* so that gcc knows memory is being written here */ - - return prev; - } -diff --git a/arch/arm64/kernel/vdso/Makefile b/arch/arm64/kernel/vdso/Makefile -index 6d20b7d162d8..fdda6dd71ac6 100644 ---- a/arch/arm64/kernel/vdso/Makefile -+++ b/arch/arm64/kernel/vdso/Makefile -@@ -15,6 +15,10 @@ ccflags-y := -shared -fno-common -fno-builtin - ccflags-y += -nostdlib -Wl,-soname=linux-vdso.so.1 \ - $(call cc-ldoption, -Wl$(comma)--hash-style=sysv) - -+# Workaround for bare-metal (ELF) toolchains that neglect to pass -shared -+# down to collect2, resulting in silent corruption of the vDSO image. -+ccflags-y += -Wl,-shared -+ - obj-y += vdso.o - extra-y += vdso.lds vdso-offsets.h - CPPFLAGS_vdso.lds += -P -C -U$(ARCH) -diff --git a/arch/arm64/mm/context.c b/arch/arm64/mm/context.c -index baa758d37021..76c1e6cd36fc 100644 ---- a/arch/arm64/mm/context.c -+++ b/arch/arm64/mm/context.c -@@ -92,6 +92,14 @@ static void reset_context(void *info) - unsigned int cpu = smp_processor_id(); - struct mm_struct *mm = current->active_mm; - -+ /* -+ * current->active_mm could be init_mm for the idle thread immediately -+ * after secondary CPU boot or hotplug. TTBR0_EL1 is already set to -+ * the reserved value, so no need to reset any context. -+ */ -+ if (mm == &init_mm) -+ return; -+ - smp_rmb(); - asid = cpu_last_asid + cpu; - -diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c -index f497ca77925a..5c5516611b5e 100644 ---- a/arch/arm64/mm/init.c -+++ b/arch/arm64/mm/init.c -@@ -262,7 +262,7 @@ static void __init free_unused_memmap(void) - * memmap entries are valid from the bank end aligned to - * MAX_ORDER_NR_PAGES. - */ -- prev_end = ALIGN(start + __phys_to_pfn(reg->size), -+ prev_end = ALIGN(__phys_to_pfn(reg->base + reg->size), - MAX_ORDER_NR_PAGES); - } - -diff --git a/arch/mips/kvm/kvm_mips_emul.c b/arch/mips/kvm/kvm_mips_emul.c -index e75ef8219caf..c76f297b7149 100644 ---- a/arch/mips/kvm/kvm_mips_emul.c -+++ b/arch/mips/kvm/kvm_mips_emul.c -@@ -1626,7 +1626,7 @@ kvm_mips_complete_mmio_load(struct kvm_vcpu *vcpu, struct kvm_run *run) - if (vcpu->mmio_needed == 2) - *gpr = *(int16_t *) run->mmio.data; - else -- *gpr = *(int16_t *) run->mmio.data; -+ *gpr = *(uint16_t *)run->mmio.data; - - break; - case 1: -diff --git a/drivers/acpi/acpica/utxfinit.c b/drivers/acpi/acpica/utxfinit.c -index 41ebaaf8bb1a..ee58a62443bd 100644 ---- a/drivers/acpi/acpica/utxfinit.c -+++ b/drivers/acpi/acpica/utxfinit.c -@@ -165,10 +165,12 @@ acpi_status acpi_enable_subsystem(u32 flags) - * Obtain a permanent mapping for the FACS. This is required for the - * Global Lock and the Firmware Waking Vector - */ -- status = acpi_tb_initialize_facs(); -- if (ACPI_FAILURE(status)) { -- ACPI_WARNING((AE_INFO, "Could not map the FACS table")); -- return_ACPI_STATUS(status); -+ if (!(flags & ACPI_NO_FACS_INIT)) { -+ status = acpi_tb_initialize_facs(); -+ if (ACPI_FAILURE(status)) { -+ ACPI_WARNING((AE_INFO, "Could not map the FACS table")); -+ return_ACPI_STATUS(status); -+ } - } - #endif /* !ACPI_REDUCED_HARDWARE */ - -diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c -index 5d47a040129a..53d35b6fd8bb 100644 ---- a/drivers/ata/libata-core.c -+++ b/drivers/ata/libata-core.c -@@ -4150,9 +4150,10 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { - { "ST3320[68]13AS", "SD1[5-9]", ATA_HORKAGE_NONCQ | - ATA_HORKAGE_FIRMWARE_WARN }, - -- /* Seagate Momentus SpinPoint M8 seem to have FPMDA_AA issues */ -+ /* drives which fail FPDMA_AA activation (some may freeze afterwards) */ - { "ST1000LM024 HN-M101MBB", "2AR10001", ATA_HORKAGE_BROKEN_FPDMA_AA }, - { "ST1000LM024 HN-M101MBB", "2BA30001", ATA_HORKAGE_BROKEN_FPDMA_AA }, -+ { "VB0250EAVER", "HPG7", ATA_HORKAGE_BROKEN_FPDMA_AA }, - - /* Blacklist entries taken from Silicon Image 3124/3132 - Windows driver .inf file - also several Linux problem reports */ -@@ -4200,6 +4201,9 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { - { "PIONEER DVD-RW DVR-212D", NULL, ATA_HORKAGE_NOSETXFER }, - { "PIONEER DVD-RW DVR-216D", NULL, ATA_HORKAGE_NOSETXFER }, - -+ /* devices that don't properly handle TRIM commands */ -+ { "SuperSSpeed S238*", NULL, ATA_HORKAGE_NOTRIM, }, -+ - /* - * Some WD SATA-I drives spin up and down erratically when the link - * is put into the slumber mode. We don't have full list of the -@@ -4504,7 +4508,8 @@ static unsigned int ata_dev_set_xfermode(struct ata_device *dev) - else /* In the ancient relic department - skip all of this */ - return 0; - -- err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 0); -+ /* On some disks, this command causes spin-up, so we need longer timeout */ -+ err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 15000); - - DPRINTK("EXIT, err_mask=%x\n", err_mask); - return err_mask; -diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c -index 9933b4db7caf..04e7db668362 100644 ---- a/drivers/ata/libata-scsi.c -+++ b/drivers/ata/libata-scsi.c -@@ -2512,7 +2512,8 @@ static unsigned int ata_scsiop_read_cap(struct ata_scsi_args *args, u8 *rbuf) - rbuf[14] = (lowest_aligned >> 8) & 0x3f; - rbuf[15] = lowest_aligned; - -- if (ata_id_has_trim(args->id)) { -+ if (ata_id_has_trim(args->id) && -+ !(dev->horkage & ATA_HORKAGE_NOTRIM)) { - rbuf[14] |= 0x80; /* TPE */ - - if (ata_id_has_zero_after_trim(args->id)) -diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c -index 00a565676583..8e08fab0ed2e 100644 ---- a/drivers/base/firmware_class.c -+++ b/drivers/base/firmware_class.c -@@ -513,10 +513,8 @@ static void fw_dev_release(struct device *dev) - module_put(THIS_MODULE); - } - --static int firmware_uevent(struct device *dev, struct kobj_uevent_env *env) -+static int do_firmware_uevent(struct firmware_priv *fw_priv, struct kobj_uevent_env *env) - { -- struct firmware_priv *fw_priv = to_firmware_priv(dev); -- - if (add_uevent_var(env, "FIRMWARE=%s", fw_priv->buf->fw_id)) - return -ENOMEM; - if (add_uevent_var(env, "TIMEOUT=%i", loading_timeout)) -@@ -527,6 +525,18 @@ static int firmware_uevent(struct device *dev, struct kobj_uevent_env *env) - return 0; - } - -+static int firmware_uevent(struct device *dev, struct kobj_uevent_env *env) -+{ -+ struct firmware_priv *fw_priv = to_firmware_priv(dev); -+ int err = 0; -+ -+ mutex_lock(&fw_lock); -+ if (fw_priv->buf) -+ err = do_firmware_uevent(fw_priv, env); -+ mutex_unlock(&fw_lock); -+ return err; -+} -+ - static struct class firmware_class = { - .name = "firmware", - .class_attrs = firmware_class_attrs, -diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c -index 6a66f0b7d3d4..4f3d70a9d721 100644 ---- a/drivers/base/regmap/regmap.c -+++ b/drivers/base/regmap/regmap.c -@@ -1586,7 +1586,7 @@ int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val, - &ival); - if (ret != 0) - return ret; -- memcpy(val + (i * val_bytes), &ival, val_bytes); -+ map->format.format_val(val + (i * val_bytes), ival, 0); - } - } - -diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c -index dd297099c99d..f78cbbb88bd4 100644 ---- a/drivers/block/rbd.c -+++ b/drivers/block/rbd.c -@@ -1851,11 +1851,11 @@ static struct rbd_obj_request *rbd_obj_request_create(const char *object_name, - rbd_assert(obj_request_type_valid(type)); - - size = strlen(object_name) + 1; -- name = kmalloc(size, GFP_KERNEL); -+ name = kmalloc(size, GFP_NOIO); - if (!name) - return NULL; - -- obj_request = kmem_cache_zalloc(rbd_obj_request_cache, GFP_KERNEL); -+ obj_request = kmem_cache_zalloc(rbd_obj_request_cache, GFP_NOIO); - if (!obj_request) { - kfree(name); - return NULL; -diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c -index 92b985317770..537ad6897784 100644 ---- a/drivers/bluetooth/btusb.c -+++ b/drivers/bluetooth/btusb.c -@@ -1234,6 +1234,8 @@ static int btusb_setup_intel(struct hci_dev *hdev) - } - fw_ptr = fw->data; - -+ kfree_skb(skb); -+ - /* This Intel specific command enables the manufacturer mode of the - * controller. - * -diff --git a/drivers/char/agp/intel-gtt.c b/drivers/char/agp/intel-gtt.c -index b8e2014cb9cb..051aadb75e2c 100644 ---- a/drivers/char/agp/intel-gtt.c -+++ b/drivers/char/agp/intel-gtt.c -@@ -583,7 +583,7 @@ static inline int needs_ilk_vtd_wa(void) - /* Query intel_iommu to see if we need the workaround. Presumably that - * was loaded first. - */ -- if ((gpu_devid == PCI_DEVICE_ID_INTEL_IRONLAKE_M_HB || -+ if ((gpu_devid == PCI_DEVICE_ID_INTEL_IRONLAKE_D_IG || - gpu_devid == PCI_DEVICE_ID_INTEL_IRONLAKE_M_IG) && - intel_iommu_gfx_mapped) - return 1; -diff --git a/drivers/char/tpm/tpm_ibmvtpm.c b/drivers/char/tpm/tpm_ibmvtpm.c -index 09df26f9621d..a6524c3efdf7 100644 ---- a/drivers/char/tpm/tpm_ibmvtpm.c -+++ b/drivers/char/tpm/tpm_ibmvtpm.c -@@ -618,6 +618,9 @@ static int tpm_ibmvtpm_probe(struct vio_dev *vio_dev, - goto cleanup; - } - -+ ibmvtpm->dev = dev; -+ ibmvtpm->vdev = vio_dev; -+ - crq_q = &ibmvtpm->crq_queue; - crq_q->crq_addr = (struct ibmvtpm_crq *)get_zeroed_page(GFP_KERNEL); - if (!crq_q->crq_addr) { -@@ -662,8 +665,6 @@ static int tpm_ibmvtpm_probe(struct vio_dev *vio_dev, - - crq_q->index = 0; - -- ibmvtpm->dev = dev; -- ibmvtpm->vdev = vio_dev; - TPM_VPRIV(chip) = (void *)ibmvtpm; - - spin_lock_init(&ibmvtpm->rtce_lock); -diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c -index c3a93fece819..5b11022d7745 100644 ---- a/drivers/cpuidle/cpuidle.c -+++ b/drivers/cpuidle/cpuidle.c -@@ -135,6 +135,9 @@ int cpuidle_idle_call(void) - - /* ask the governor for the next state */ - next_state = cpuidle_curr_governor->select(drv, dev); -+ if (next_state < 0) -+ return -EBUSY; -+ - if (need_resched()) { - dev->last_residency = 0; - /* give the governor an opportunity to reflect on the outcome */ -diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c -index bc580b67a652..67fd901f6fc9 100644 ---- a/drivers/cpuidle/governors/menu.c -+++ b/drivers/cpuidle/governors/menu.c -@@ -269,7 +269,7 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) - data->needs_update = 0; - } - -- data->last_state_idx = 0; -+ data->last_state_idx = CPUIDLE_DRIVER_STATE_START - 1; - data->exit_us = 0; - - /* Special case when user has set very strict latency requirement */ -diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c -index 8759d699bd8e..c24c35606836 100644 ---- a/drivers/gpu/drm/drm_crtc.c -+++ b/drivers/gpu/drm/drm_crtc.c -@@ -1955,8 +1955,11 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data, - if (!drm_core_check_feature(dev, DRIVER_MODESET)) - return -EINVAL; - -- /* For some reason crtc x/y offsets are signed internally. */ -- if (crtc_req->x > INT_MAX || crtc_req->y > INT_MAX) -+ /* -+ * Universal plane src offsets are only 16.16, prevent havoc for -+ * drivers using universal plane code internally. -+ */ -+ if (crtc_req->x & 0xffff0000 || crtc_req->y & 0xffff0000) - return -ERANGE; - - drm_modeset_lock_all(dev); -diff --git a/drivers/gpu/drm/qxl/qxl_cmd.c b/drivers/gpu/drm/qxl/qxl_cmd.c -index f86771481317..5a48d7419baf 100644 ---- a/drivers/gpu/drm/qxl/qxl_cmd.c -+++ b/drivers/gpu/drm/qxl/qxl_cmd.c -@@ -500,6 +500,7 @@ int qxl_hw_surface_alloc(struct qxl_device *qdev, - - cmd = (struct qxl_surface_cmd *)qxl_release_map(qdev, release); - cmd->type = QXL_SURFACE_CMD_CREATE; -+ cmd->flags = QXL_SURF_FLAG_KEEP_DATA; - cmd->u.surface_create.format = surf->surf.format; - cmd->u.surface_create.width = surf->surf.width; - cmd->u.surface_create.height = surf->surf.height; -diff --git a/drivers/gpu/drm/radeon/radeon_gart.c b/drivers/gpu/drm/radeon/radeon_gart.c -index 2915a1c56934..c4bb0bc2a1d9 100644 ---- a/drivers/gpu/drm/radeon/radeon_gart.c -+++ b/drivers/gpu/drm/radeon/radeon_gart.c -@@ -251,8 +251,10 @@ void radeon_gart_unbind(struct radeon_device *rdev, unsigned offset, - } - } - } -- mb(); -- radeon_gart_tlb_flush(rdev); -+ if (rdev->gart.ptr) { -+ mb(); -+ radeon_gart_tlb_flush(rdev); -+ } - } - - /** -@@ -294,8 +296,10 @@ int radeon_gart_bind(struct radeon_device *rdev, unsigned offset, - } - } - } -- mb(); -- radeon_gart_tlb_flush(rdev); -+ if (rdev->gart.ptr) { -+ mb(); -+ radeon_gart_tlb_flush(rdev); -+ } - return 0; - } - -diff --git a/drivers/gpu/drm/radeon/radeon_irq_kms.c b/drivers/gpu/drm/radeon/radeon_irq_kms.c -index 1fe12ab5c5ea..db83d075606e 100644 ---- a/drivers/gpu/drm/radeon/radeon_irq_kms.c -+++ b/drivers/gpu/drm/radeon/radeon_irq_kms.c -@@ -73,10 +73,12 @@ static void radeon_hotplug_work_func(struct work_struct *work) - struct drm_mode_config *mode_config = &dev->mode_config; - struct drm_connector *connector; - -+ mutex_lock(&mode_config->mutex); - if (mode_config->num_connector) { - list_for_each_entry(connector, &mode_config->connector_list, head) - radeon_connector_hotplug(connector); - } -+ mutex_unlock(&mode_config->mutex); - /* Just fire off a uevent and let userspace tell us what to do */ - drm_helper_hpd_irq_event(dev); - } -diff --git a/drivers/hwmon/mcp3021.c b/drivers/hwmon/mcp3021.c -index eedb32292d6d..f712cc785ef2 100644 ---- a/drivers/hwmon/mcp3021.c -+++ b/drivers/hwmon/mcp3021.c -@@ -31,14 +31,11 @@ - /* output format */ - #define MCP3021_SAR_SHIFT 2 - #define MCP3021_SAR_MASK 0x3ff -- - #define MCP3021_OUTPUT_RES 10 /* 10-bit resolution */ --#define MCP3021_OUTPUT_SCALE 4 - - #define MCP3221_SAR_SHIFT 0 - #define MCP3221_SAR_MASK 0xfff - #define MCP3221_OUTPUT_RES 12 /* 12-bit resolution */ --#define MCP3221_OUTPUT_SCALE 1 - - enum chips { - mcp3021, -@@ -54,7 +51,6 @@ struct mcp3021_data { - u16 sar_shift; - u16 sar_mask; - u8 output_res; -- u8 output_scale; - }; - - static int mcp3021_read16(struct i2c_client *client) -@@ -84,13 +80,7 @@ static int mcp3021_read16(struct i2c_client *client) - - static inline u16 volts_from_reg(struct mcp3021_data *data, u16 val) - { -- if (val == 0) -- return 0; -- -- val = val * data->output_scale - data->output_scale / 2; -- -- return val * DIV_ROUND_CLOSEST(data->vdd, -- (1 << data->output_res) * data->output_scale); -+ return DIV_ROUND_CLOSEST(data->vdd * val, 1 << data->output_res); - } - - static ssize_t show_in_input(struct device *dev, struct device_attribute *attr, -@@ -132,14 +122,12 @@ static int mcp3021_probe(struct i2c_client *client, - data->sar_shift = MCP3021_SAR_SHIFT; - data->sar_mask = MCP3021_SAR_MASK; - data->output_res = MCP3021_OUTPUT_RES; -- data->output_scale = MCP3021_OUTPUT_SCALE; - break; - - case mcp3221: - data->sar_shift = MCP3221_SAR_SHIFT; - data->sar_mask = MCP3221_SAR_MASK; - data->output_res = MCP3221_OUTPUT_RES; -- data->output_scale = MCP3221_OUTPUT_SCALE; - break; - } - -diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c -index 09324d0178d5..ceabcfeb587c 100644 ---- a/drivers/i2c/busses/i2c-at91.c -+++ b/drivers/i2c/busses/i2c-at91.c -@@ -63,6 +63,9 @@ - #define AT91_TWI_UNRE 0x0080 /* Underrun Error */ - #define AT91_TWI_NACK 0x0100 /* Not Acknowledged */ - -+#define AT91_TWI_INT_MASK \ -+ (AT91_TWI_TXCOMP | AT91_TWI_RXRDY | AT91_TWI_TXRDY | AT91_TWI_NACK) -+ - #define AT91_TWI_IER 0x0024 /* Interrupt Enable Register */ - #define AT91_TWI_IDR 0x0028 /* Interrupt Disable Register */ - #define AT91_TWI_IMR 0x002c /* Interrupt Mask Register */ -@@ -118,13 +121,12 @@ static void at91_twi_write(struct at91_twi_dev *dev, unsigned reg, unsigned val) - - static void at91_disable_twi_interrupts(struct at91_twi_dev *dev) - { -- at91_twi_write(dev, AT91_TWI_IDR, -- AT91_TWI_TXCOMP | AT91_TWI_RXRDY | AT91_TWI_TXRDY); -+ at91_twi_write(dev, AT91_TWI_IDR, AT91_TWI_INT_MASK); - } - - static void at91_twi_irq_save(struct at91_twi_dev *dev) - { -- dev->imr = at91_twi_read(dev, AT91_TWI_IMR) & 0x7; -+ dev->imr = at91_twi_read(dev, AT91_TWI_IMR) & AT91_TWI_INT_MASK; - at91_disable_twi_interrupts(dev); - } - -@@ -214,6 +216,14 @@ static void at91_twi_write_data_dma_callback(void *data) - dma_unmap_single(dev->dev, sg_dma_address(&dev->dma.sg), - dev->buf_len, DMA_TO_DEVICE); - -+ /* -+ * When this callback is called, THR/TX FIFO is likely not to be empty -+ * yet. So we have to wait for TXCOMP or NACK bits to be set into the -+ * Status Register to be sure that the STOP bit has been sent and the -+ * transfer is completed. The NACK interrupt has already been enabled, -+ * we just have to enable TXCOMP one. -+ */ -+ at91_twi_write(dev, AT91_TWI_IER, AT91_TWI_TXCOMP); - at91_twi_write(dev, AT91_TWI_CR, AT91_TWI_STOP); - } - -@@ -308,7 +318,7 @@ static void at91_twi_read_data_dma_callback(void *data) - /* The last two bytes have to be read without using dma */ - dev->buf += dev->buf_len - 2; - dev->buf_len = 2; -- at91_twi_write(dev, AT91_TWI_IER, AT91_TWI_RXRDY); -+ at91_twi_write(dev, AT91_TWI_IER, AT91_TWI_RXRDY | AT91_TWI_TXCOMP); - } - - static void at91_twi_read_data_dma(struct at91_twi_dev *dev) -@@ -369,7 +379,7 @@ static irqreturn_t atmel_twi_interrupt(int irq, void *dev_id) - /* catch error flags */ - dev->transfer_status |= status; - -- if (irqstatus & AT91_TWI_TXCOMP) { -+ if (irqstatus & (AT91_TWI_TXCOMP | AT91_TWI_NACK)) { - at91_disable_twi_interrupts(dev); - complete(&dev->cmd_complete); - } -@@ -382,6 +392,34 @@ static int at91_do_twi_transfer(struct at91_twi_dev *dev) - int ret; - bool has_unre_flag = dev->pdata->has_unre_flag; - -+ /* -+ * WARNING: the TXCOMP bit in the Status Register is NOT a clear on -+ * read flag but shows the state of the transmission at the time the -+ * Status Register is read. According to the programmer datasheet, -+ * TXCOMP is set when both holding register and internal shifter are -+ * empty and STOP condition has been sent. -+ * Consequently, we should enable NACK interrupt rather than TXCOMP to -+ * detect transmission failure. -+ * -+ * Besides, the TXCOMP bit is already set before the i2c transaction -+ * has been started. For read transactions, this bit is cleared when -+ * writing the START bit into the Control Register. So the -+ * corresponding interrupt can safely be enabled just after. -+ * However for write transactions managed by the CPU, we first write -+ * into THR, so TXCOMP is cleared. Then we can safely enable TXCOMP -+ * interrupt. If TXCOMP interrupt were enabled before writing into THR, -+ * the interrupt handler would be called immediately and the i2c command -+ * would be reported as completed. -+ * Also when a write transaction is managed by the DMA controller, -+ * enabling the TXCOMP interrupt in this function may lead to a race -+ * condition since we don't know whether the TXCOMP interrupt is enabled -+ * before or after the DMA has started to write into THR. So the TXCOMP -+ * interrupt is enabled later by at91_twi_write_data_dma_callback(). -+ * Immediately after in that DMA callback, we still need to send the -+ * STOP condition manually writing the corresponding bit into the -+ * Control Register. -+ */ -+ - dev_dbg(dev->dev, "transfer: %s %d bytes.\n", - (dev->msg->flags & I2C_M_RD) ? "read" : "write", dev->buf_len); - -@@ -412,26 +450,24 @@ static int at91_do_twi_transfer(struct at91_twi_dev *dev) - * seems to be the best solution. - */ - if (dev->use_dma && (dev->buf_len > AT91_I2C_DMA_THRESHOLD)) { -+ at91_twi_write(dev, AT91_TWI_IER, AT91_TWI_NACK); - at91_twi_read_data_dma(dev); -- /* -- * It is important to enable TXCOMP irq here because -- * doing it only when transferring the last two bytes -- * will mask NACK errors since TXCOMP is set when a -- * NACK occurs. -- */ -- at91_twi_write(dev, AT91_TWI_IER, -- AT91_TWI_TXCOMP); -- } else -+ } else { - at91_twi_write(dev, AT91_TWI_IER, -- AT91_TWI_TXCOMP | AT91_TWI_RXRDY); -+ AT91_TWI_TXCOMP | -+ AT91_TWI_NACK | -+ AT91_TWI_RXRDY); -+ } - } else { - if (dev->use_dma && (dev->buf_len > AT91_I2C_DMA_THRESHOLD)) { -+ at91_twi_write(dev, AT91_TWI_IER, AT91_TWI_NACK); - at91_twi_write_data_dma(dev); -- at91_twi_write(dev, AT91_TWI_IER, AT91_TWI_TXCOMP); - } else { - at91_twi_write_next_byte(dev); - at91_twi_write(dev, AT91_TWI_IER, -- AT91_TWI_TXCOMP | AT91_TWI_TXRDY); -+ AT91_TWI_TXCOMP | -+ AT91_TWI_NACK | -+ AT91_TWI_TXRDY); - } - } - -diff --git a/drivers/iio/dac/ad5624r_spi.c b/drivers/iio/dac/ad5624r_spi.c -index bb298aaff321..6deac5af1cfd 100644 ---- a/drivers/iio/dac/ad5624r_spi.c -+++ b/drivers/iio/dac/ad5624r_spi.c -@@ -22,7 +22,7 @@ - #include "ad5624r.h" - - static int ad5624r_spi_write(struct spi_device *spi, -- u8 cmd, u8 addr, u16 val, u8 len) -+ u8 cmd, u8 addr, u16 val, u8 shift) - { - u32 data; - u8 msg[3]; -@@ -35,7 +35,7 @@ static int ad5624r_spi_write(struct spi_device *spi, - * 14-, 12-bit input code followed by 0, 2, or 4 don't care bits, - * for the AD5664R, AD5644R, and AD5624R, respectively. - */ -- data = (0 << 22) | (cmd << 19) | (addr << 16) | (val << (16 - len)); -+ data = (0 << 22) | (cmd << 19) | (addr << 16) | (val << shift); - msg[0] = data >> 16; - msg[1] = data >> 8; - msg[2] = data; -diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c -index 8019e642d2f5..43aa807d78bd 100644 ---- a/drivers/infiniband/ulp/isert/ib_isert.c -+++ b/drivers/infiniband/ulp/isert/ib_isert.c -@@ -49,6 +49,8 @@ static int - isert_rdma_accept(struct isert_conn *isert_conn); - struct rdma_cm_id *isert_setup_id(struct isert_np *isert_np); - -+static void isert_release_work(struct work_struct *work); -+ - static void - isert_qp_event_callback(struct ib_event *e, void *context) - { -@@ -202,7 +204,7 @@ fail: - static void - isert_free_rx_descriptors(struct isert_conn *isert_conn) - { -- struct ib_device *ib_dev = isert_conn->conn_cm_id->device; -+ struct ib_device *ib_dev = isert_conn->conn_device->ib_device; - struct iser_rx_desc *rx_desc; - int i; - -@@ -432,6 +434,7 @@ isert_connect_request(struct rdma_cm_id *cma_id, struct rdma_cm_event *event) - init_completion(&isert_conn->conn_wait_comp_err); - kref_init(&isert_conn->conn_kref); - mutex_init(&isert_conn->conn_mutex); -+ INIT_WORK(&isert_conn->release_work, isert_release_work); - - isert_conn->conn_cm_id = cma_id; - isert_conn->responder_resources = event->param.conn.responder_resources; -@@ -527,14 +530,15 @@ out: - static void - isert_connect_release(struct isert_conn *isert_conn) - { -- struct ib_device *ib_dev = isert_conn->conn_cm_id->device; - struct isert_device *device = isert_conn->conn_device; - int cq_index; -+ struct ib_device *ib_dev = device->ib_device; - - pr_debug("Entering isert_connect_release(): >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n"); - - isert_free_rx_descriptors(isert_conn); -- rdma_destroy_id(isert_conn->conn_cm_id); -+ if (isert_conn->conn_cm_id) -+ rdma_destroy_id(isert_conn->conn_cm_id); - - if (isert_conn->conn_qp) { - cq_index = ((struct isert_cq_desc *) -@@ -673,6 +677,7 @@ isert_disconnected_handler(struct rdma_cm_id *cma_id, - { - struct isert_np *isert_np = cma_id->context; - struct isert_conn *isert_conn; -+ bool terminating = false; - - if (isert_np->np_cm_id == cma_id) - return isert_np_cma_handler(cma_id->context, event); -@@ -680,21 +685,37 @@ isert_disconnected_handler(struct rdma_cm_id *cma_id, - isert_conn = cma_id->qp->qp_context; - - mutex_lock(&isert_conn->conn_mutex); -+ terminating = (isert_conn->state == ISER_CONN_TERMINATING); - isert_conn_terminate(isert_conn); - mutex_unlock(&isert_conn->conn_mutex); - - pr_info("conn %p completing conn_wait\n", isert_conn); - complete(&isert_conn->conn_wait); - -+ if (terminating) -+ goto out; -+ -+ mutex_lock(&isert_np->np_accept_mutex); -+ if (!list_empty(&isert_conn->conn_accept_node)) { -+ list_del_init(&isert_conn->conn_accept_node); -+ isert_put_conn(isert_conn); -+ queue_work(isert_release_wq, &isert_conn->release_work); -+ } -+ mutex_unlock(&isert_np->np_accept_mutex); -+ -+out: - return 0; - } - --static void -+static int - isert_connect_error(struct rdma_cm_id *cma_id) - { - struct isert_conn *isert_conn = cma_id->qp->qp_context; - -+ isert_conn->conn_cm_id = NULL; - isert_put_conn(isert_conn); -+ -+ return -1; - } - - static int -@@ -724,7 +745,7 @@ isert_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *event) - case RDMA_CM_EVENT_REJECTED: /* FALLTHRU */ - case RDMA_CM_EVENT_UNREACHABLE: /* FALLTHRU */ - case RDMA_CM_EVENT_CONNECT_ERROR: -- isert_connect_error(cma_id); -+ ret = isert_connect_error(cma_id); - break; - default: - pr_err("Unhandled RDMA CMA event: %d\n", event->event); -@@ -2418,7 +2439,6 @@ static void isert_wait_conn(struct iscsi_conn *conn) - - wait_for_completion(&isert_conn->conn_wait_comp_err); - -- INIT_WORK(&isert_conn->release_work, isert_release_work); - queue_work(isert_release_wq, &isert_conn->release_work); - } - -diff --git a/drivers/md/md.c b/drivers/md/md.c -index aaf77b07bb72..631fe3e9c6e5 100644 ---- a/drivers/md/md.c -+++ b/drivers/md/md.c -@@ -6221,7 +6221,7 @@ static int update_array_info(struct mddev *mddev, mdu_array_info_t *info) - mddev->ctime != info->ctime || - mddev->level != info->level || - /* mddev->layout != info->layout || */ -- !mddev->persistent != info->not_persistent|| -+ mddev->persistent != !info->not_persistent || - mddev->chunk_sectors != info->chunk_size >> 9 || - /* ignore bottom 8 bits of state, and allow SB_BITMAP_PRESENT to change */ - ((state^info->state) & 0xfffffe00) -diff --git a/drivers/md/persistent-data/dm-btree-remove.c b/drivers/md/persistent-data/dm-btree-remove.c -index b88757cd0d1d..a03178e91a79 100644 ---- a/drivers/md/persistent-data/dm-btree-remove.c -+++ b/drivers/md/persistent-data/dm-btree-remove.c -@@ -309,8 +309,8 @@ static void redistribute3(struct dm_btree_info *info, struct btree_node *parent, - - if (s < 0 && nr_center < -s) { - /* not enough in central node */ -- shift(left, center, nr_center); -- s = nr_center - target; -+ shift(left, center, -nr_center); -+ s += nr_center; - shift(left, right, s); - nr_right += s; - } else -@@ -323,7 +323,7 @@ static void redistribute3(struct dm_btree_info *info, struct btree_node *parent, - if (s > 0 && nr_center < s) { - /* not enough in central node */ - shift(center, right, nr_center); -- s = target - nr_center; -+ s -= nr_center; - shift(left, right, s); - nr_left -= s; - } else -diff --git a/drivers/md/persistent-data/dm-btree.c b/drivers/md/persistent-data/dm-btree.c -index 0a7592e88811..e3ecb0b824b5 100644 ---- a/drivers/md/persistent-data/dm-btree.c -+++ b/drivers/md/persistent-data/dm-btree.c -@@ -240,7 +240,7 @@ int dm_btree_del(struct dm_btree_info *info, dm_block_t root) - int r; - struct del_stack *s; - -- s = kmalloc(sizeof(*s), GFP_KERNEL); -+ s = kmalloc(sizeof(*s), GFP_NOIO); - if (!s) - return -ENOMEM; - s->tm = info->tm; -diff --git a/drivers/media/dvb-frontends/af9013.c b/drivers/media/dvb-frontends/af9013.c -index fb504f1e9125..5930aee6b5d0 100644 ---- a/drivers/media/dvb-frontends/af9013.c -+++ b/drivers/media/dvb-frontends/af9013.c -@@ -606,6 +606,10 @@ static int af9013_set_frontend(struct dvb_frontend *fe) - } - } - -+ /* Return an error if can't find bandwidth or the right clock */ -+ if (i == ARRAY_SIZE(coeff_lut)) -+ return -EINVAL; -+ - ret = af9013_wr_regs(state, 0xae00, coeff_lut[i].val, - sizeof(coeff_lut[i].val)); - } -diff --git a/drivers/media/dvb-frontends/cx24116.c b/drivers/media/dvb-frontends/cx24116.c -index 2916d7c74a1d..7bc68b355c0b 100644 ---- a/drivers/media/dvb-frontends/cx24116.c -+++ b/drivers/media/dvb-frontends/cx24116.c -@@ -963,6 +963,10 @@ static int cx24116_send_diseqc_msg(struct dvb_frontend *fe, - struct cx24116_state *state = fe->demodulator_priv; - int i, ret; - -+ /* Validate length */ -+ if (d->msg_len > sizeof(d->msg)) -+ return -EINVAL; -+ - /* Dump DiSEqC message */ - if (debug) { - printk(KERN_INFO "cx24116: %s(", __func__); -@@ -974,10 +978,6 @@ static int cx24116_send_diseqc_msg(struct dvb_frontend *fe, - printk(") toneburst=%d\n", toneburst); - } - -- /* Validate length */ -- if (d->msg_len > (CX24116_ARGLEN - CX24116_DISEQC_MSGOFS)) -- return -EINVAL; -- - /* DiSEqC message */ - for (i = 0; i < d->msg_len; i++) - state->dsec_cmd.args[CX24116_DISEQC_MSGOFS + i] = d->msg[i]; -diff --git a/drivers/media/dvb-frontends/s5h1420.c b/drivers/media/dvb-frontends/s5h1420.c -index 93eeaf7118fd..0b4f8fe6bf99 100644 ---- a/drivers/media/dvb-frontends/s5h1420.c -+++ b/drivers/media/dvb-frontends/s5h1420.c -@@ -180,7 +180,7 @@ static int s5h1420_send_master_cmd (struct dvb_frontend* fe, - int result = 0; - - dprintk("enter %s\n", __func__); -- if (cmd->msg_len > 8) -+ if (cmd->msg_len > sizeof(cmd->msg)) - return -EINVAL; - - /* setup for DISEQC */ -diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c -index 56998eca1a8d..885ba4a19a6c 100644 ---- a/drivers/mmc/card/block.c -+++ b/drivers/mmc/card/block.c -@@ -202,6 +202,8 @@ static ssize_t power_ro_lock_show(struct device *dev, - - ret = snprintf(buf, PAGE_SIZE, "%d\n", locked); - -+ mmc_blk_put(md); -+ - return ret; - } - -@@ -1833,9 +1835,11 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *rqc) - break; - case MMC_BLK_CMD_ERR: - ret = mmc_blk_cmd_err(md, card, brq, req, ret); -- if (!mmc_blk_reset(md, card->host, type)) -- break; -- goto cmd_abort; -+ if (mmc_blk_reset(md, card->host, type)) -+ goto cmd_abort; -+ if (!ret) -+ goto start_new_req; -+ break; - case MMC_BLK_RETRY: - if (retry++ < 5) - break; -diff --git a/drivers/mtd/maps/dc21285.c b/drivers/mtd/maps/dc21285.c -index f8a7dd14cee0..70a3db3ab856 100644 ---- a/drivers/mtd/maps/dc21285.c -+++ b/drivers/mtd/maps/dc21285.c -@@ -38,9 +38,9 @@ static void nw_en_write(void) - * we want to write a bit pattern XXX1 to Xilinx to enable - * the write gate, which will be open for about the next 2ms. - */ -- spin_lock_irqsave(&nw_gpio_lock, flags); -+ raw_spin_lock_irqsave(&nw_gpio_lock, flags); - nw_cpld_modify(CPLD_FLASH_WR_ENABLE, CPLD_FLASH_WR_ENABLE); -- spin_unlock_irqrestore(&nw_gpio_lock, flags); -+ raw_spin_unlock_irqrestore(&nw_gpio_lock, flags); - - /* - * let the ISA bus to catch on... -diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c -index 5073cbc796d8..32d5e40c6863 100644 ---- a/drivers/mtd/mtd_blkdevs.c -+++ b/drivers/mtd/mtd_blkdevs.c -@@ -199,6 +199,7 @@ static int blktrans_open(struct block_device *bdev, fmode_t mode) - return -ERESTARTSYS; /* FIXME: busy loop! -arnd*/ - - mutex_lock(&dev->lock); -+ mutex_lock(&mtd_table_mutex); - - if (dev->open) - goto unlock; -@@ -222,6 +223,7 @@ static int blktrans_open(struct block_device *bdev, fmode_t mode) - - unlock: - dev->open++; -+ mutex_unlock(&mtd_table_mutex); - mutex_unlock(&dev->lock); - blktrans_dev_put(dev); - return ret; -@@ -232,6 +234,7 @@ error_release: - error_put: - module_put(dev->tr->owner); - kref_put(&dev->ref, blktrans_dev_release); -+ mutex_unlock(&mtd_table_mutex); - mutex_unlock(&dev->lock); - blktrans_dev_put(dev); - return ret; -@@ -245,6 +248,7 @@ static void blktrans_release(struct gendisk *disk, fmode_t mode) - return; - - mutex_lock(&dev->lock); -+ mutex_lock(&mtd_table_mutex); - - if (--dev->open) - goto unlock; -@@ -258,6 +262,7 @@ static void blktrans_release(struct gendisk *disk, fmode_t mode) - __put_mtd_device(dev->mtd); - } - unlock: -+ mutex_unlock(&mtd_table_mutex); - mutex_unlock(&dev->lock); - blktrans_dev_put(dev); - } -diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c -index 82a1b5b16b62..c7f23d271058 100644 ---- a/drivers/net/wireless/ath/ath9k/main.c -+++ b/drivers/net/wireless/ath/ath9k/main.c -@@ -195,11 +195,13 @@ static bool ath_prepare_reset(struct ath_softc *sc) - ath9k_debug_samp_bb_mac(sc); - ath9k_hw_disable_interrupts(ah); - -- if (!ath_drain_all_txq(sc)) -- ret = false; -- -- if (!ath_stoprecv(sc)) -- ret = false; -+ if (AR_SREV_9300_20_OR_LATER(ah)) { -+ ret &= ath_stoprecv(sc); -+ ret &= ath_drain_all_txq(sc); -+ } else { -+ ret &= ath_drain_all_txq(sc); -+ ret &= ath_stoprecv(sc); -+ } - - return ret; - } -diff --git a/drivers/pcmcia/topic.h b/drivers/pcmcia/topic.h -index 615a45a8fe86..582688fe7505 100644 ---- a/drivers/pcmcia/topic.h -+++ b/drivers/pcmcia/topic.h -@@ -104,6 +104,9 @@ - #define TOPIC_EXCA_IF_CONTROL 0x3e /* 8 bit */ - #define TOPIC_EXCA_IFC_33V_ENA 0x01 - -+#define TOPIC_PCI_CFG_PPBCN 0x3e /* 16-bit */ -+#define TOPIC_PCI_CFG_PPBCN_WBEN 0x0400 -+ - static void topic97_zoom_video(struct pcmcia_socket *sock, int onoff) - { - struct yenta_socket *socket = container_of(sock, struct yenta_socket, socket); -@@ -138,6 +141,7 @@ static int topic97_override(struct yenta_socket *socket) - static int topic95_override(struct yenta_socket *socket) - { - u8 fctrl; -+ u16 ppbcn; - - /* enable 3.3V support for 16bit cards */ - fctrl = exca_readb(socket, TOPIC_EXCA_IF_CONTROL); -@@ -146,6 +150,18 @@ static int topic95_override(struct yenta_socket *socket) - /* tell yenta to use exca registers to power 16bit cards */ - socket->flags |= YENTA_16BIT_POWER_EXCA | YENTA_16BIT_POWER_DF; - -+ /* Disable write buffers to prevent lockups under load with numerous -+ Cardbus cards, observed on Tecra 500CDT and reported elsewhere on the -+ net. This is not a power-on default according to the datasheet -+ but some BIOSes seem to set it. */ -+ if (pci_read_config_word(socket->dev, TOPIC_PCI_CFG_PPBCN, &ppbcn) == 0 -+ && socket->dev->revision <= 7 -+ && (ppbcn & TOPIC_PCI_CFG_PPBCN_WBEN)) { -+ ppbcn &= ~TOPIC_PCI_CFG_PPBCN_WBEN; -+ pci_write_config_word(socket->dev, TOPIC_PCI_CFG_PPBCN, ppbcn); -+ dev_info(&socket->dev->dev, "Disabled ToPIC95 Cardbus write buffers.\n"); -+ } -+ - return 0; - } - -diff --git a/drivers/pinctrl/mvebu/pinctrl-armada-370.c b/drivers/pinctrl/mvebu/pinctrl-armada-370.c -index 48e21a229483..c99e64ac8e08 100644 ---- a/drivers/pinctrl/mvebu/pinctrl-armada-370.c -+++ b/drivers/pinctrl/mvebu/pinctrl-armada-370.c -@@ -358,11 +358,11 @@ static struct mvebu_mpp_mode mv88f6710_mpp_modes[] = { - MPP_MODE(64, - MPP_FUNCTION(0x0, "gpio", NULL), - MPP_FUNCTION(0x1, "spi0", "miso"), -- MPP_FUNCTION(0x2, "spi0-1", "cs1")), -+ MPP_FUNCTION(0x2, "spi0", "cs1")), - MPP_MODE(65, - MPP_FUNCTION(0x0, "gpio", NULL), - MPP_FUNCTION(0x1, "spi0", "mosi"), -- MPP_FUNCTION(0x2, "spi0-1", "cs2")), -+ MPP_FUNCTION(0x2, "spi0", "cs2")), - }; - - static struct mvebu_pinctrl_soc_info armada_370_pinctrl_info; -diff --git a/drivers/pinctrl/mvebu/pinctrl-armada-xp.c b/drivers/pinctrl/mvebu/pinctrl-armada-xp.c -index ab5dc04b3e8a..5923a9ef70cc 100644 ---- a/drivers/pinctrl/mvebu/pinctrl-armada-xp.c -+++ b/drivers/pinctrl/mvebu/pinctrl-armada-xp.c -@@ -14,10 +14,7 @@ - * available: mv78230, mv78260 and mv78460. From a pin muxing - * perspective, the mv78230 has 49 MPP pins. The mv78260 and mv78460 - * both have 67 MPP pins (more GPIOs and address lines for the memory -- * bus mainly). The only difference between the mv78260 and the -- * mv78460 in terms of pin muxing is the addition of two functions on -- * pins 43 and 56 to access the VDD of the CPU2 and 3 (mv78260 has two -- * cores, mv78460 has four cores). -+ * bus mainly). - */ - - #include -@@ -159,20 +156,17 @@ static struct mvebu_mpp_mode armada_xp_mpp_modes[] = { - MPP_MODE(24, - MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), - MPP_VAR_FUNCTION(0x1, "sata1", "prsnt", V_MV78230_PLUS), -- MPP_VAR_FUNCTION(0x2, "nf", "bootcs-re", V_MV78230_PLUS), - MPP_VAR_FUNCTION(0x3, "tdm", "rst", V_MV78230_PLUS), - MPP_VAR_FUNCTION(0x4, "lcd", "hsync", V_MV78230_PLUS)), - MPP_MODE(25, - MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), - MPP_VAR_FUNCTION(0x1, "sata0", "prsnt", V_MV78230_PLUS), -- MPP_VAR_FUNCTION(0x2, "nf", "bootcs-we", V_MV78230_PLUS), - MPP_VAR_FUNCTION(0x3, "tdm", "pclk", V_MV78230_PLUS), - MPP_VAR_FUNCTION(0x4, "lcd", "vsync", V_MV78230_PLUS)), - MPP_MODE(26, - MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), - MPP_VAR_FUNCTION(0x3, "tdm", "fsync", V_MV78230_PLUS), -- MPP_VAR_FUNCTION(0x4, "lcd", "clk", V_MV78230_PLUS), -- MPP_VAR_FUNCTION(0x5, "vdd", "cpu1-pd", V_MV78230_PLUS)), -+ MPP_VAR_FUNCTION(0x4, "lcd", "clk", V_MV78230_PLUS)), - MPP_MODE(27, - MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), - MPP_VAR_FUNCTION(0x1, "ptp", "trig", V_MV78230_PLUS), -@@ -187,8 +181,7 @@ static struct mvebu_mpp_mode armada_xp_mpp_modes[] = { - MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), - MPP_VAR_FUNCTION(0x1, "ptp", "clk", V_MV78230_PLUS), - MPP_VAR_FUNCTION(0x3, "tdm", "int0", V_MV78230_PLUS), -- MPP_VAR_FUNCTION(0x4, "lcd", "ref-clk", V_MV78230_PLUS), -- MPP_VAR_FUNCTION(0x5, "vdd", "cpu0-pd", V_MV78230_PLUS)), -+ MPP_VAR_FUNCTION(0x4, "lcd", "ref-clk", V_MV78230_PLUS)), - MPP_MODE(30, - MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), - MPP_VAR_FUNCTION(0x1, "sd0", "clk", V_MV78230_PLUS), -@@ -196,13 +189,11 @@ static struct mvebu_mpp_mode armada_xp_mpp_modes[] = { - MPP_MODE(31, - MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), - MPP_VAR_FUNCTION(0x1, "sd0", "cmd", V_MV78230_PLUS), -- MPP_VAR_FUNCTION(0x3, "tdm", "int2", V_MV78230_PLUS), -- MPP_VAR_FUNCTION(0x5, "vdd", "cpu0-pd", V_MV78230_PLUS)), -+ MPP_VAR_FUNCTION(0x3, "tdm", "int2", V_MV78230_PLUS)), - MPP_MODE(32, - MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), - MPP_VAR_FUNCTION(0x1, "sd0", "d0", V_MV78230_PLUS), -- MPP_VAR_FUNCTION(0x3, "tdm", "int3", V_MV78230_PLUS), -- MPP_VAR_FUNCTION(0x5, "vdd", "cpu1-pd", V_MV78230_PLUS)), -+ MPP_VAR_FUNCTION(0x3, "tdm", "int3", V_MV78230_PLUS)), - MPP_MODE(33, - MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), - MPP_VAR_FUNCTION(0x1, "sd0", "d1", V_MV78230_PLUS), -@@ -234,7 +225,6 @@ static struct mvebu_mpp_mode armada_xp_mpp_modes[] = { - MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), - MPP_VAR_FUNCTION(0x1, "spi", "cs1", V_MV78230_PLUS), - MPP_VAR_FUNCTION(0x2, "uart2", "cts", V_MV78230_PLUS), -- MPP_VAR_FUNCTION(0x3, "vdd", "cpu1-pd", V_MV78230_PLUS), - MPP_VAR_FUNCTION(0x4, "lcd", "vga-hsync", V_MV78230_PLUS), - MPP_VAR_FUNCTION(0x5, "pcie", "clkreq0", V_MV78230_PLUS)), - MPP_MODE(41, -@@ -249,15 +239,13 @@ static struct mvebu_mpp_mode armada_xp_mpp_modes[] = { - MPP_VAR_FUNCTION(0x1, "uart2", "rxd", V_MV78230_PLUS), - MPP_VAR_FUNCTION(0x2, "uart0", "cts", V_MV78230_PLUS), - MPP_VAR_FUNCTION(0x3, "tdm", "int7", V_MV78230_PLUS), -- MPP_VAR_FUNCTION(0x4, "tdm-1", "timer", V_MV78230_PLUS), -- MPP_VAR_FUNCTION(0x5, "vdd", "cpu0-pd", V_MV78230_PLUS)), -+ MPP_VAR_FUNCTION(0x4, "tdm-1", "timer", V_MV78230_PLUS)), - MPP_MODE(43, - MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), - MPP_VAR_FUNCTION(0x1, "uart2", "txd", V_MV78230_PLUS), - MPP_VAR_FUNCTION(0x2, "uart0", "rts", V_MV78230_PLUS), - MPP_VAR_FUNCTION(0x3, "spi", "cs3", V_MV78230_PLUS), -- MPP_VAR_FUNCTION(0x4, "pcie", "rstout", V_MV78230_PLUS), -- MPP_VAR_FUNCTION(0x5, "vdd", "cpu2-3-pd", V_MV78460)), -+ MPP_VAR_FUNCTION(0x4, "pcie", "rstout", V_MV78230_PLUS)), - MPP_MODE(44, - MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), - MPP_VAR_FUNCTION(0x1, "uart2", "cts", V_MV78230_PLUS), -@@ -286,7 +274,7 @@ static struct mvebu_mpp_mode armada_xp_mpp_modes[] = { - MPP_VAR_FUNCTION(0x5, "pcie", "clkreq3", V_MV78230_PLUS)), - MPP_MODE(48, - MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), -- MPP_VAR_FUNCTION(0x1, "tclk", NULL, V_MV78230_PLUS), -+ MPP_VAR_FUNCTION(0x1, "dev", "clkout", V_MV78230_PLUS), - MPP_VAR_FUNCTION(0x2, "dev", "burst/last", V_MV78230_PLUS)), - MPP_MODE(49, - MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), -@@ -308,16 +296,13 @@ static struct mvebu_mpp_mode armada_xp_mpp_modes[] = { - MPP_VAR_FUNCTION(0x1, "dev", "ad19", V_MV78260_PLUS)), - MPP_MODE(55, - MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), -- MPP_VAR_FUNCTION(0x1, "dev", "ad20", V_MV78260_PLUS), -- MPP_VAR_FUNCTION(0x2, "vdd", "cpu0-pd", V_MV78260_PLUS)), -+ MPP_VAR_FUNCTION(0x1, "dev", "ad20", V_MV78260_PLUS)), - MPP_MODE(56, - MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), -- MPP_VAR_FUNCTION(0x1, "dev", "ad21", V_MV78260_PLUS), -- MPP_VAR_FUNCTION(0x2, "vdd", "cpu1-pd", V_MV78260_PLUS)), -+ MPP_VAR_FUNCTION(0x1, "dev", "ad21", V_MV78260_PLUS)), - MPP_MODE(57, - MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), -- MPP_VAR_FUNCTION(0x1, "dev", "ad22", V_MV78260_PLUS), -- MPP_VAR_FUNCTION(0x2, "vdd", "cpu2-3-pd", V_MV78460)), -+ MPP_VAR_FUNCTION(0x1, "dev", "ad22", V_MV78260_PLUS)), - MPP_MODE(58, - MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), - MPP_VAR_FUNCTION(0x1, "dev", "ad23", V_MV78260_PLUS)), -diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c -index 283212aa103c..70ccc2010054 100644 ---- a/drivers/regulator/core.c -+++ b/drivers/regulator/core.c -@@ -769,7 +769,7 @@ static int suspend_prepare(struct regulator_dev *rdev, suspend_state_t state) - static void print_constraints(struct regulator_dev *rdev) - { - struct regulation_constraints *constraints = rdev->constraints; -- char buf[80] = ""; -+ char buf[160] = ""; - int count = 0; - int ret; - -diff --git a/drivers/scsi/ipr.h b/drivers/scsi/ipr.h -index 535f57328a72..c19911554036 100644 ---- a/drivers/scsi/ipr.h -+++ b/drivers/scsi/ipr.h -@@ -257,7 +257,7 @@ - #define IPR_RUNTIME_RESET 0x40000000 - - #define IPR_IPL_INIT_MIN_STAGE_TIME 5 --#define IPR_IPL_INIT_DEFAULT_STAGE_TIME 15 -+#define IPR_IPL_INIT_DEFAULT_STAGE_TIME 30 - #define IPR_IPL_INIT_STAGE_UNKNOWN 0x0 - #define IPR_IPL_INIT_STAGE_TRANSOP 0xB0000000 - #define IPR_IPL_INIT_STAGE_MASK 0xff000000 -diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c -index d2a4c75e5b8f..813e9d8ba351 100644 ---- a/drivers/scsi/qla2xxx/qla_isr.c -+++ b/drivers/scsi/qla2xxx/qla_isr.c -@@ -523,8 +523,9 @@ qla2x00_async_event(scsi_qla_host_t *vha, struct rsp_que *rsp, uint16_t *mb) - struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; - struct device_reg_24xx __iomem *reg24 = &ha->iobase->isp24; - struct device_reg_82xx __iomem *reg82 = &ha->iobase->isp82; -- uint32_t rscn_entry, host_pid; -+ uint32_t rscn_entry, host_pid, tmp_pid; - unsigned long flags; -+ fc_port_t *fcport = NULL; - - /* Setup to process RIO completion. */ - handle_cnt = 0; -@@ -918,6 +919,20 @@ skip_rio: - if (qla2x00_is_a_vp_did(vha, rscn_entry)) - break; - -+ /* -+ * Search for the rport related to this RSCN entry and mark it -+ * as lost. -+ */ -+ list_for_each_entry(fcport, &vha->vp_fcports, list) { -+ if (atomic_read(&fcport->state) != FCS_ONLINE) -+ continue; -+ tmp_pid = fcport->d_id.b24; -+ if (fcport->d_id.b24 == rscn_entry) { -+ qla2x00_mark_device_lost(vha, fcport, 0, 0); -+ break; -+ } -+ } -+ - atomic_set(&vha->loop_down_timer, 0); - vha->flags.management_server_logged_in = 0; - -diff --git a/drivers/staging/rtl8712/rtl8712_recv.c b/drivers/staging/rtl8712/rtl8712_recv.c -index d59a74aa3048..4b25f3afb8dc 100644 ---- a/drivers/staging/rtl8712/rtl8712_recv.c -+++ b/drivers/staging/rtl8712/rtl8712_recv.c -@@ -1075,7 +1075,8 @@ static int recvbuf2recvframe(struct _adapter *padapter, struct sk_buff *pskb) - /* for first fragment packet, driver need allocate 1536 + - * drvinfo_sz + RXDESC_SIZE to defrag packet. */ - if ((mf == 1) && (frag == 0)) -- alloc_sz = 1658;/*1658+6=1664, 1664 is 128 alignment.*/ -+ /*1658+6=1664, 1664 is 128 alignment.*/ -+ alloc_sz = max_t(u16, tmp_len, 1658); - else - alloc_sz = tmp_len; - /* 2 is for IP header 4 bytes alignment in QoS packet case. -diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c -index 5a3ea20e9cb5..3c293ad6ae70 100644 ---- a/drivers/target/iscsi/iscsi_target.c -+++ b/drivers/target/iscsi/iscsi_target.c -@@ -518,7 +518,7 @@ static struct iscsit_transport iscsi_target_transport = { - - static int __init iscsi_target_init_module(void) - { -- int ret = 0; -+ int ret = 0, size; - - pr_debug("iSCSI-Target "ISCSIT_VERSION"\n"); - -@@ -527,6 +527,7 @@ static int __init iscsi_target_init_module(void) - pr_err("Unable to allocate memory for iscsit_global\n"); - return -1; - } -+ spin_lock_init(&iscsit_global->ts_bitmap_lock); - mutex_init(&auth_id_lock); - spin_lock_init(&sess_idr_lock); - idr_init(&tiqn_idr); -@@ -536,15 +537,11 @@ static int __init iscsi_target_init_module(void) - if (ret < 0) - goto out; - -- ret = iscsi_thread_set_init(); -- if (ret < 0) -+ size = BITS_TO_LONGS(ISCSIT_BITMAP_BITS) * sizeof(long); -+ iscsit_global->ts_bitmap = vzalloc(size); -+ if (!iscsit_global->ts_bitmap) { -+ pr_err("Unable to allocate iscsit_global->ts_bitmap\n"); - goto configfs_out; -- -- if (iscsi_allocate_thread_sets(TARGET_THREAD_SET_COUNT) != -- TARGET_THREAD_SET_COUNT) { -- pr_err("iscsi_allocate_thread_sets() returned" -- " unexpected value!\n"); -- goto ts_out1; - } - - lio_cmd_cache = kmem_cache_create("lio_cmd_cache", -@@ -553,7 +550,7 @@ static int __init iscsi_target_init_module(void) - if (!lio_cmd_cache) { - pr_err("Unable to kmem_cache_create() for" - " lio_cmd_cache\n"); -- goto ts_out2; -+ goto bitmap_out; - } - - lio_qr_cache = kmem_cache_create("lio_qr_cache", -@@ -608,10 +605,8 @@ qr_out: - kmem_cache_destroy(lio_qr_cache); - cmd_out: - kmem_cache_destroy(lio_cmd_cache); --ts_out2: -- iscsi_deallocate_thread_sets(); --ts_out1: -- iscsi_thread_set_free(); -+bitmap_out: -+ vfree(iscsit_global->ts_bitmap); - configfs_out: - iscsi_target_deregister_configfs(); - out: -@@ -621,8 +616,6 @@ out: - - static void __exit iscsi_target_cleanup_module(void) - { -- iscsi_deallocate_thread_sets(); -- iscsi_thread_set_free(); - iscsit_release_discovery_tpg(); - iscsit_unregister_transport(&iscsi_target_transport); - kmem_cache_destroy(lio_cmd_cache); -@@ -633,6 +626,7 @@ static void __exit iscsi_target_cleanup_module(void) - - iscsi_target_deregister_configfs(); - -+ vfree(iscsit_global->ts_bitmap); - kfree(iscsit_global); - } - -@@ -3590,17 +3584,16 @@ static int iscsit_send_reject( - - void iscsit_thread_get_cpumask(struct iscsi_conn *conn) - { -- struct iscsi_thread_set *ts = conn->thread_set; - int ord, cpu; - /* -- * thread_id is assigned from iscsit_global->ts_bitmap from -- * within iscsi_thread_set.c:iscsi_allocate_thread_sets() -+ * bitmap_id is assigned from iscsit_global->ts_bitmap from -+ * within iscsit_start_kthreads() - * -- * Here we use thread_id to determine which CPU that this -- * iSCSI connection's iscsi_thread_set will be scheduled to -+ * Here we use bitmap_id to determine which CPU that this -+ * iSCSI connection's RX/TX threads will be scheduled to - * execute upon. - */ -- ord = ts->thread_id % cpumask_weight(cpu_online_mask); -+ ord = conn->bitmap_id % cpumask_weight(cpu_online_mask); - for_each_online_cpu(cpu) { - if (ord-- == 0) { - cpumask_set_cpu(cpu, conn->conn_cpumask); -@@ -3792,7 +3785,7 @@ check_rsp_state: - switch (state) { - case ISTATE_SEND_LOGOUTRSP: - if (!iscsit_logout_post_handler(cmd, conn)) -- goto restart; -+ return -ECONNRESET; - /* fall through */ - case ISTATE_SEND_STATUS: - case ISTATE_SEND_ASYNCMSG: -@@ -3820,8 +3813,6 @@ check_rsp_state: - - err: - return -1; --restart: -- return -EAGAIN; - } - - static int iscsit_handle_response_queue(struct iscsi_conn *conn) -@@ -3848,21 +3839,13 @@ static int iscsit_handle_response_queue(struct iscsi_conn *conn) - int iscsi_target_tx_thread(void *arg) - { - int ret = 0; -- struct iscsi_conn *conn; -- struct iscsi_thread_set *ts = arg; -+ struct iscsi_conn *conn = arg; - /* - * Allow ourselves to be interrupted by SIGINT so that a - * connection recovery / failure event can be triggered externally. - */ - allow_signal(SIGINT); - --restart: -- conn = iscsi_tx_thread_pre_handler(ts); -- if (!conn) -- goto out; -- -- ret = 0; -- - while (!kthread_should_stop()) { - /* - * Ensure that both TX and RX per connection kthreads -@@ -3871,11 +3854,9 @@ restart: - iscsit_thread_check_cpumask(conn, current, 1); - - wait_event_interruptible(conn->queues_wq, -- !iscsit_conn_all_queues_empty(conn) || -- ts->status == ISCSI_THREAD_SET_RESET); -+ !iscsit_conn_all_queues_empty(conn)); - -- if ((ts->status == ISCSI_THREAD_SET_RESET) || -- signal_pending(current)) -+ if (signal_pending(current)) - goto transport_err; - - get_immediate: -@@ -3886,15 +3867,14 @@ get_immediate: - ret = iscsit_handle_response_queue(conn); - if (ret == 1) - goto get_immediate; -- else if (ret == -EAGAIN) -- goto restart; -+ else if (ret == -ECONNRESET) -+ goto out; - else if (ret < 0) - goto transport_err; - } - - transport_err: - iscsit_take_action_for_connection_exit(conn); -- goto restart; - out: - return 0; - } -@@ -3979,8 +3959,7 @@ int iscsi_target_rx_thread(void *arg) - int ret; - u8 buffer[ISCSI_HDR_LEN], opcode; - u32 checksum = 0, digest = 0; -- struct iscsi_conn *conn = NULL; -- struct iscsi_thread_set *ts = arg; -+ struct iscsi_conn *conn = arg; - struct kvec iov; - /* - * Allow ourselves to be interrupted by SIGINT so that a -@@ -3988,11 +3967,6 @@ int iscsi_target_rx_thread(void *arg) - */ - allow_signal(SIGINT); - --restart: -- conn = iscsi_rx_thread_pre_handler(ts); -- if (!conn) -- goto out; -- - if (conn->conn_transport->transport_type == ISCSI_INFINIBAND) { - struct completion comp; - int rc; -@@ -4002,7 +3976,7 @@ restart: - if (rc < 0) - goto transport_err; - -- goto out; -+ goto transport_err; - } - - while (!kthread_should_stop()) { -@@ -4085,8 +4059,6 @@ transport_err: - if (!signal_pending(current)) - atomic_set(&conn->transport_failed, 1); - iscsit_take_action_for_connection_exit(conn); -- goto restart; --out: - return 0; - } - -@@ -4148,7 +4120,24 @@ int iscsit_close_connection( - if (conn->conn_transport->transport_type == ISCSI_TCP) - complete(&conn->conn_logout_comp); - -- iscsi_release_thread_set(conn); -+ if (!strcmp(current->comm, ISCSI_RX_THREAD_NAME)) { -+ if (conn->tx_thread && -+ cmpxchg(&conn->tx_thread_active, true, false)) { -+ send_sig(SIGINT, conn->tx_thread, 1); -+ kthread_stop(conn->tx_thread); -+ } -+ } else if (!strcmp(current->comm, ISCSI_TX_THREAD_NAME)) { -+ if (conn->rx_thread && -+ cmpxchg(&conn->rx_thread_active, true, false)) { -+ send_sig(SIGINT, conn->rx_thread, 1); -+ kthread_stop(conn->rx_thread); -+ } -+ } -+ -+ spin_lock(&iscsit_global->ts_bitmap_lock); -+ bitmap_release_region(iscsit_global->ts_bitmap, conn->bitmap_id, -+ get_order(1)); -+ spin_unlock(&iscsit_global->ts_bitmap_lock); - - iscsit_stop_timers_for_cmds(conn); - iscsit_stop_nopin_response_timer(conn); -@@ -4427,15 +4416,13 @@ static void iscsit_logout_post_handler_closesession( - struct iscsi_conn *conn) - { - struct iscsi_session *sess = conn->sess; -- -- iscsi_set_thread_clear(conn, ISCSI_CLEAR_TX_THREAD); -- iscsi_set_thread_set_signal(conn, ISCSI_SIGNAL_TX_THREAD); -+ int sleep = cmpxchg(&conn->tx_thread_active, true, false); - - atomic_set(&conn->conn_logout_remove, 0); - complete(&conn->conn_logout_comp); - - iscsit_dec_conn_usage_count(conn); -- iscsit_stop_session(sess, 1, 1); -+ iscsit_stop_session(sess, sleep, sleep); - iscsit_dec_session_usage_count(sess); - target_put_session(sess->se_sess); - } -@@ -4443,13 +4430,12 @@ static void iscsit_logout_post_handler_closesession( - static void iscsit_logout_post_handler_samecid( - struct iscsi_conn *conn) - { -- iscsi_set_thread_clear(conn, ISCSI_CLEAR_TX_THREAD); -- iscsi_set_thread_set_signal(conn, ISCSI_SIGNAL_TX_THREAD); -+ int sleep = cmpxchg(&conn->tx_thread_active, true, false); - - atomic_set(&conn->conn_logout_remove, 0); - complete(&conn->conn_logout_comp); - -- iscsit_cause_connection_reinstatement(conn, 1); -+ iscsit_cause_connection_reinstatement(conn, sleep); - iscsit_dec_conn_usage_count(conn); - } - -diff --git a/drivers/target/iscsi/iscsi_target_core.h b/drivers/target/iscsi/iscsi_target_core.h -index e117870eb445..815bf5b1a4ae 100644 ---- a/drivers/target/iscsi/iscsi_target_core.h -+++ b/drivers/target/iscsi/iscsi_target_core.h -@@ -586,6 +586,11 @@ struct iscsi_conn { - struct iscsi_session *sess; - /* Pointer to thread_set in use for this conn's threads */ - struct iscsi_thread_set *thread_set; -+ int bitmap_id; -+ int rx_thread_active; -+ struct task_struct *rx_thread; -+ int tx_thread_active; -+ struct task_struct *tx_thread; - /* list_head for session connection list */ - struct list_head conn_list; - } ____cacheline_aligned; -@@ -862,10 +867,12 @@ struct iscsit_global { - /* Unique identifier used for the authentication daemon */ - u32 auth_id; - u32 inactive_ts; -+#define ISCSIT_BITMAP_BITS 262144 - /* Thread Set bitmap count */ - int ts_bitmap_count; - /* Thread Set bitmap pointer */ - unsigned long *ts_bitmap; -+ spinlock_t ts_bitmap_lock; - /* Used for iSCSI discovery session authentication */ - struct iscsi_node_acl discovery_acl; - struct iscsi_portal_group *discovery_tpg; -diff --git a/drivers/target/iscsi/iscsi_target_erl0.c b/drivers/target/iscsi/iscsi_target_erl0.c -index 08bd87833321..fab67eea54c0 100644 ---- a/drivers/target/iscsi/iscsi_target_erl0.c -+++ b/drivers/target/iscsi/iscsi_target_erl0.c -@@ -866,7 +866,10 @@ void iscsit_connection_reinstatement_rcfr(struct iscsi_conn *conn) - } - spin_unlock_bh(&conn->state_lock); - -- iscsi_thread_set_force_reinstatement(conn); -+ if (conn->tx_thread && conn->tx_thread_active) -+ send_sig(SIGINT, conn->tx_thread, 1); -+ if (conn->rx_thread && conn->rx_thread_active) -+ send_sig(SIGINT, conn->rx_thread, 1); - - sleep: - wait_for_completion(&conn->conn_wait_rcfr_comp); -@@ -891,10 +894,10 @@ void iscsit_cause_connection_reinstatement(struct iscsi_conn *conn, int sleep) - return; - } - -- if (iscsi_thread_set_force_reinstatement(conn) < 0) { -- spin_unlock_bh(&conn->state_lock); -- return; -- } -+ if (conn->tx_thread && conn->tx_thread_active) -+ send_sig(SIGINT, conn->tx_thread, 1); -+ if (conn->rx_thread && conn->rx_thread_active) -+ send_sig(SIGINT, conn->rx_thread, 1); - - atomic_set(&conn->connection_reinstatement, 1); - if (!sleep) { -diff --git a/drivers/target/iscsi/iscsi_target_login.c b/drivers/target/iscsi/iscsi_target_login.c -index 0493e8b1ba8f..797b2e2acc35 100644 ---- a/drivers/target/iscsi/iscsi_target_login.c -+++ b/drivers/target/iscsi/iscsi_target_login.c -@@ -683,7 +683,52 @@ static void iscsi_post_login_start_timers(struct iscsi_conn *conn) - iscsit_start_nopin_timer(conn); - } - --static int iscsi_post_login_handler( -+int iscsit_start_kthreads(struct iscsi_conn *conn) -+{ -+ int ret = 0; -+ -+ spin_lock(&iscsit_global->ts_bitmap_lock); -+ conn->bitmap_id = bitmap_find_free_region(iscsit_global->ts_bitmap, -+ ISCSIT_BITMAP_BITS, get_order(1)); -+ spin_unlock(&iscsit_global->ts_bitmap_lock); -+ -+ if (conn->bitmap_id < 0) { -+ pr_err("bitmap_find_free_region() failed for" -+ " iscsit_start_kthreads()\n"); -+ return -ENOMEM; -+ } -+ -+ conn->tx_thread = kthread_run(iscsi_target_tx_thread, conn, -+ "%s", ISCSI_TX_THREAD_NAME); -+ if (IS_ERR(conn->tx_thread)) { -+ pr_err("Unable to start iscsi_target_tx_thread\n"); -+ ret = PTR_ERR(conn->tx_thread); -+ goto out_bitmap; -+ } -+ conn->tx_thread_active = true; -+ -+ conn->rx_thread = kthread_run(iscsi_target_rx_thread, conn, -+ "%s", ISCSI_RX_THREAD_NAME); -+ if (IS_ERR(conn->rx_thread)) { -+ pr_err("Unable to start iscsi_target_rx_thread\n"); -+ ret = PTR_ERR(conn->rx_thread); -+ goto out_tx; -+ } -+ conn->rx_thread_active = true; -+ -+ return 0; -+out_tx: -+ kthread_stop(conn->tx_thread); -+ conn->tx_thread_active = false; -+out_bitmap: -+ spin_lock(&iscsit_global->ts_bitmap_lock); -+ bitmap_release_region(iscsit_global->ts_bitmap, conn->bitmap_id, -+ get_order(1)); -+ spin_unlock(&iscsit_global->ts_bitmap_lock); -+ return ret; -+} -+ -+int iscsi_post_login_handler( - struct iscsi_np *np, - struct iscsi_conn *conn, - u8 zero_tsih) -@@ -693,7 +738,7 @@ static int iscsi_post_login_handler( - struct se_session *se_sess = sess->se_sess; - struct iscsi_portal_group *tpg = ISCSI_TPG_S(sess); - struct se_portal_group *se_tpg = &tpg->tpg_se_tpg; -- struct iscsi_thread_set *ts; -+ int rc; - - iscsit_inc_conn_usage_count(conn); - -@@ -708,7 +753,6 @@ static int iscsi_post_login_handler( - /* - * SCSI Initiator -> SCSI Target Port Mapping - */ -- ts = iscsi_get_thread_set(); - if (!zero_tsih) { - iscsi_set_session_parameters(sess->sess_ops, - conn->param_list, 0); -@@ -735,9 +779,11 @@ static int iscsi_post_login_handler( - sess->sess_ops->InitiatorName); - spin_unlock_bh(&sess->conn_lock); - -- iscsi_post_login_start_timers(conn); -+ rc = iscsit_start_kthreads(conn); -+ if (rc) -+ return rc; - -- iscsi_activate_thread_set(conn, ts); -+ iscsi_post_login_start_timers(conn); - /* - * Determine CPU mask to ensure connection's RX and TX kthreads - * are scheduled on the same CPU. -@@ -794,8 +840,11 @@ static int iscsi_post_login_handler( - " iSCSI Target Portal Group: %hu\n", tpg->nsessions, tpg->tpgt); - spin_unlock_bh(&se_tpg->session_lock); - -+ rc = iscsit_start_kthreads(conn); -+ if (rc) -+ return rc; -+ - iscsi_post_login_start_timers(conn); -- iscsi_activate_thread_set(conn, ts); - /* - * Determine CPU mask to ensure connection's RX and TX kthreads - * are scheduled on the same CPU. -diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c -index 78ddfb43750a..62e532fb82ad 100644 ---- a/drivers/usb/core/devio.c -+++ b/drivers/usb/core/devio.c -@@ -513,7 +513,7 @@ static void async_completed(struct urb *urb) - snoop(&urb->dev->dev, "urb complete\n"); - snoop_urb(urb->dev, as->userurb, urb->pipe, urb->actual_length, - as->status, COMPLETE, NULL, 0); -- if ((urb->transfer_flags & URB_DIR_MASK) == USB_DIR_IN) -+ if ((urb->transfer_flags & URB_DIR_MASK) == URB_DIR_IN) - snoop_urb_data(urb, urb->actual_length); - - if (as->status < 0 && as->bulk_addr && as->status != -ECONNRESET && -@@ -1593,7 +1593,7 @@ static struct async *reap_as(struct dev_state *ps) - for (;;) { - __set_current_state(TASK_INTERRUPTIBLE); - as = async_getcompleted(ps); -- if (as) -+ if (as || !connected(ps)) - break; - if (signal_pending(current)) - break; -@@ -1616,7 +1616,7 @@ static int proc_reapurb(struct dev_state *ps, void __user *arg) - } - if (signal_pending(current)) - return -EINTR; -- return -EIO; -+ return -ENODEV; - } - - static int proc_reapurbnonblock(struct dev_state *ps, void __user *arg) -@@ -1625,10 +1625,11 @@ static int proc_reapurbnonblock(struct dev_state *ps, void __user *arg) - struct async *as; - - as = async_getcompleted(ps); -- retval = -EAGAIN; - if (as) { - retval = processcompl(as, (void __user * __user *)arg); - free_async(as); -+ } else { -+ retval = (connected(ps) ? -EAGAIN : -ENODEV); - } - return retval; - } -@@ -1758,7 +1759,7 @@ static int proc_reapurb_compat(struct dev_state *ps, void __user *arg) - } - if (signal_pending(current)) - return -EINTR; -- return -EIO; -+ return -ENODEV; - } - - static int proc_reapurbnonblock_compat(struct dev_state *ps, void __user *arg) -@@ -1766,11 +1767,12 @@ static int proc_reapurbnonblock_compat(struct dev_state *ps, void __user *arg) - int retval; - struct async *as; - -- retval = -EAGAIN; - as = async_getcompleted(ps); - if (as) { - retval = processcompl_compat(as, (void __user * __user *)arg); - free_async(as); -+ } else { -+ retval = (connected(ps) ? -EAGAIN : -ENODEV); - } - return retval; - } -@@ -1941,7 +1943,8 @@ static int proc_get_capabilities(struct dev_state *ps, void __user *arg) - { - __u32 caps; - -- caps = USBDEVFS_CAP_ZERO_PACKET | USBDEVFS_CAP_NO_PACKET_SIZE_LIM; -+ caps = USBDEVFS_CAP_ZERO_PACKET | USBDEVFS_CAP_NO_PACKET_SIZE_LIM | -+ USBDEVFS_CAP_REAP_AFTER_DISCONNECT; - if (!ps->dev->bus->no_stop_on_short) - caps |= USBDEVFS_CAP_BULK_CONTINUATION; - if (ps->dev->bus->sg_tablesize) -@@ -2002,6 +2005,32 @@ static long usbdev_do_ioctl(struct file *file, unsigned int cmd, - return -EPERM; - - usb_lock_device(dev); -+ -+ /* Reap operations are allowed even after disconnection */ -+ switch (cmd) { -+ case USBDEVFS_REAPURB: -+ snoop(&dev->dev, "%s: REAPURB\n", __func__); -+ ret = proc_reapurb(ps, p); -+ goto done; -+ -+ case USBDEVFS_REAPURBNDELAY: -+ snoop(&dev->dev, "%s: REAPURBNDELAY\n", __func__); -+ ret = proc_reapurbnonblock(ps, p); -+ goto done; -+ -+#ifdef CONFIG_COMPAT -+ case USBDEVFS_REAPURB32: -+ snoop(&dev->dev, "%s: REAPURB32\n", __func__); -+ ret = proc_reapurb_compat(ps, p); -+ goto done; -+ -+ case USBDEVFS_REAPURBNDELAY32: -+ snoop(&dev->dev, "%s: REAPURBNDELAY32\n", __func__); -+ ret = proc_reapurbnonblock_compat(ps, p); -+ goto done; -+#endif -+ } -+ - if (!connected(ps)) { - usb_unlock_device(dev); - return -ENODEV; -@@ -2095,16 +2124,6 @@ static long usbdev_do_ioctl(struct file *file, unsigned int cmd, - inode->i_mtime = CURRENT_TIME; - break; - -- case USBDEVFS_REAPURB32: -- snoop(&dev->dev, "%s: REAPURB32\n", __func__); -- ret = proc_reapurb_compat(ps, p); -- break; -- -- case USBDEVFS_REAPURBNDELAY32: -- snoop(&dev->dev, "%s: REAPURBNDELAY32\n", __func__); -- ret = proc_reapurbnonblock_compat(ps, p); -- break; -- - case USBDEVFS_IOCTL32: - snoop(&dev->dev, "%s: IOCTL32\n", __func__); - ret = proc_ioctl_compat(ps, ptr_to_compat(p)); -@@ -2116,16 +2135,6 @@ static long usbdev_do_ioctl(struct file *file, unsigned int cmd, - ret = proc_unlinkurb(ps, p); - break; - -- case USBDEVFS_REAPURB: -- snoop(&dev->dev, "%s: REAPURB\n", __func__); -- ret = proc_reapurb(ps, p); -- break; -- -- case USBDEVFS_REAPURBNDELAY: -- snoop(&dev->dev, "%s: REAPURBNDELAY\n", __func__); -- ret = proc_reapurbnonblock(ps, p); -- break; -- - case USBDEVFS_DISCSIGNAL: - snoop(&dev->dev, "%s: DISCSIGNAL\n", __func__); - ret = proc_disconnectsignal(ps, p); -@@ -2162,6 +2171,8 @@ static long usbdev_do_ioctl(struct file *file, unsigned int cmd, - ret = proc_disconnect_claim(ps, p); - break; - } -+ -+ done: - usb_unlock_device(dev); - if (ret >= 0) - inode->i_atime = CURRENT_TIME; -diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c -index 6cd418f6ac07..57d7ec6c8090 100644 ---- a/drivers/usb/dwc3/ep0.c -+++ b/drivers/usb/dwc3/ep0.c -@@ -718,6 +718,10 @@ static int dwc3_ep0_std_request(struct dwc3 *dwc, struct usb_ctrlrequest *ctrl) - dev_vdbg(dwc->dev, "USB_REQ_SET_ISOCH_DELAY\n"); - ret = dwc3_ep0_set_isoch_delay(dwc, ctrl); - break; -+ case USB_REQ_SET_INTERFACE: -+ dev_vdbg(dwc->dev, "USB_REQ_SET_INTERFACE\n"); -+ dwc->start_config_issued = false; -+ /* Fall through */ - default: - dev_vdbg(dwc->dev, "Forwarding to gadget driver\n"); - ret = dwc3_ep0_delegate_req(dwc, ctrl); -diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c -index 87f8fc63b3e1..6e70c88b25fb 100644 ---- a/drivers/usb/dwc3/gadget.c -+++ b/drivers/usb/dwc3/gadget.c -@@ -319,6 +319,8 @@ int dwc3_send_gadget_generic_command(struct dwc3 *dwc, int cmd, u32 param) - if (!(reg & DWC3_DGCMD_CMDACT)) { - dev_vdbg(dwc->dev, "Command Complete --> %d\n", - DWC3_DGCMD_STATUS(reg)); -+ if (DWC3_DGCMD_STATUS(reg)) -+ return -EINVAL; - return 0; - } - -@@ -355,6 +357,8 @@ int dwc3_send_gadget_ep_cmd(struct dwc3 *dwc, unsigned ep, - if (!(reg & DWC3_DEPCMD_CMDACT)) { - dev_vdbg(dwc->dev, "Command Complete --> %d\n", - DWC3_DEPCMD_STATUS(reg)); -+ if (DWC3_DEPCMD_STATUS(reg)) -+ return -EINVAL; - return 0; - } - -diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c -index 677f032482f7..31bed5f7d0eb 100644 ---- a/drivers/usb/host/xhci-mem.c -+++ b/drivers/usb/host/xhci-mem.c -@@ -1400,10 +1400,10 @@ int xhci_endpoint_init(struct xhci_hcd *xhci, - /* Attempt to use the ring cache */ - if (virt_dev->num_rings_cached == 0) - return -ENOMEM; -+ virt_dev->num_rings_cached--; - virt_dev->eps[ep_index].new_ring = - virt_dev->ring_cache[virt_dev->num_rings_cached]; - virt_dev->ring_cache[virt_dev->num_rings_cached] = NULL; -- virt_dev->num_rings_cached--; - xhci_reinit_cached_ring(xhci, virt_dev->eps[ep_index].new_ring, - 1, type); - } -diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c -index ab1c5e8ac27f..dd84416a23cd 100644 ---- a/drivers/usb/serial/cp210x.c -+++ b/drivers/usb/serial/cp210x.c -@@ -187,6 +187,7 @@ static const struct usb_device_id id_table[] = { - { USB_DEVICE(0x1FB9, 0x0602) }, /* Lake Shore Model 648 Magnet Power Supply */ - { USB_DEVICE(0x1FB9, 0x0700) }, /* Lake Shore Model 737 VSM Controller */ - { USB_DEVICE(0x1FB9, 0x0701) }, /* Lake Shore Model 776 Hall Matrix */ -+ { USB_DEVICE(0x2626, 0xEA60) }, /* Aruba Networks 7xxx USB Serial Console */ - { USB_DEVICE(0x3195, 0xF190) }, /* Link Instruments MSO-19 */ - { USB_DEVICE(0x3195, 0xF280) }, /* Link Instruments MSO-28 */ - { USB_DEVICE(0x3195, 0xF281) }, /* Link Instruments MSO-28 */ -diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c -index 8b3484134ab0..096438e4fb0c 100644 ---- a/drivers/usb/serial/option.c -+++ b/drivers/usb/serial/option.c -@@ -1755,6 +1755,7 @@ static const struct usb_device_id option_ids[] = { - { USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x7d03, 0xff, 0x00, 0x00) }, - { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e01, 0xff, 0xff, 0xff) }, /* D-Link DWM-152/C1 */ - { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e02, 0xff, 0xff, 0xff) }, /* D-Link DWM-156/C1 */ -+ { USB_DEVICE_INTERFACE_CLASS(0x2020, 0x4000, 0xff) }, /* OLICARD300 - MT6225 */ - { USB_DEVICE(INOVIA_VENDOR_ID, INOVIA_SEW858) }, - { USB_DEVICE(VIATELECOM_VENDOR_ID, VIATELECOM_PRODUCT_CDS7) }, - { } /* Terminating entry */ -diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c -index af88ffd1068f..2b7e073f5e36 100644 ---- a/drivers/watchdog/omap_wdt.c -+++ b/drivers/watchdog/omap_wdt.c -@@ -134,6 +134,13 @@ static int omap_wdt_start(struct watchdog_device *wdog) - - pm_runtime_get_sync(wdev->dev); - -+ /* -+ * Make sure the watchdog is disabled. This is unfortunately required -+ * because writing to various registers with the watchdog running has no -+ * effect. -+ */ -+ omap_wdt_disable(wdev); -+ - /* initialize prescaler */ - while (__raw_readl(base + OMAP_WATCHDOG_WPS) & 0x01) - cpu_relax(); -diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c -index d86edc8d3fd0..4c7d309e4aa6 100644 ---- a/fs/9p/vfs_inode.c -+++ b/fs/9p/vfs_inode.c -@@ -537,8 +537,7 @@ static struct inode *v9fs_qid_iget(struct super_block *sb, - unlock_new_inode(inode); - return inode; - error: -- unlock_new_inode(inode); -- iput(inode); -+ iget_failed(inode); - return ERR_PTR(retval); - - } -diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c -index 53687bbf2296..65b21a24841e 100644 ---- a/fs/9p/vfs_inode_dotl.c -+++ b/fs/9p/vfs_inode_dotl.c -@@ -151,8 +151,7 @@ static struct inode *v9fs_qid_iget_dotl(struct super_block *sb, - unlock_new_inode(inode); - return inode; - error: -- unlock_new_inode(inode); -- iput(inode); -+ iget_failed(inode); - return ERR_PTR(retval); - - } -diff --git a/fs/btrfs/inode-map.c b/fs/btrfs/inode-map.c -index 2c66ddbbe670..0389e90eec33 100644 ---- a/fs/btrfs/inode-map.c -+++ b/fs/btrfs/inode-map.c -@@ -283,7 +283,7 @@ void btrfs_unpin_free_ino(struct btrfs_root *root) - __btrfs_add_free_space(ctl, info->offset, count); - free: - rb_erase(&info->offset_index, rbroot); -- kfree(info); -+ kmem_cache_free(btrfs_free_space_cachep, info); - } - } - -diff --git a/fs/ext4/indirect.c b/fs/ext4/indirect.c -index 589061469687..b07a221c3138 100644 ---- a/fs/ext4/indirect.c -+++ b/fs/ext4/indirect.c -@@ -577,7 +577,7 @@ int ext4_ind_map_blocks(handle_t *handle, struct inode *inode, - EXT4_FEATURE_RO_COMPAT_BIGALLOC)) { - EXT4_ERROR_INODE(inode, "Can't allocate blocks for " - "non-extent mapped inodes with bigalloc"); -- return -ENOSPC; -+ return -EUCLEAN; - } - - goal = ext4_find_goal(inode, map->m_lblk, partial); -diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c -index 8a277505a3be..10b71e4029a0 100644 ---- a/fs/ext4/inode.c -+++ b/fs/ext4/inode.c -@@ -1412,7 +1412,7 @@ static void ext4_da_release_space(struct inode *inode, int to_free) - static void ext4_da_page_release_reservation(struct page *page, - unsigned long offset) - { -- int to_release = 0; -+ int to_release = 0, contiguous_blks = 0; - struct buffer_head *head, *bh; - unsigned int curr_off = 0; - struct inode *inode = page->mapping->host; -@@ -1427,14 +1427,23 @@ static void ext4_da_page_release_reservation(struct page *page, - - if ((offset <= curr_off) && (buffer_delay(bh))) { - to_release++; -+ contiguous_blks++; - clear_buffer_delay(bh); -+ } else if (contiguous_blks) { -+ lblk = page->index << -+ (PAGE_CACHE_SHIFT - inode->i_blkbits); -+ lblk += (curr_off >> inode->i_blkbits) - -+ contiguous_blks; -+ ext4_es_remove_extent(inode, lblk, contiguous_blks); -+ contiguous_blks = 0; - } - curr_off = next_off; - } while ((bh = bh->b_this_page) != head); - -- if (to_release) { -+ if (contiguous_blks) { - lblk = page->index << (PAGE_CACHE_SHIFT - inode->i_blkbits); -- ext4_es_remove_extent(inode, lblk, to_release); -+ lblk += (curr_off >> inode->i_blkbits) - contiguous_blks; -+ ext4_es_remove_extent(inode, lblk, contiguous_blks); - } - - /* If we have released all the blocks belonging to a cluster, then we -@@ -2099,19 +2108,32 @@ static int __ext4_journalled_writepage(struct page *page, - ext4_walk_page_buffers(handle, page_bufs, 0, len, - NULL, bget_one); - } -- /* As soon as we unlock the page, it can go away, but we have -- * references to buffers so we are safe */ -+ /* -+ * We need to release the page lock before we start the -+ * journal, so grab a reference so the page won't disappear -+ * out from under us. -+ */ -+ get_page(page); - unlock_page(page); - - handle = ext4_journal_start(inode, EXT4_HT_WRITE_PAGE, - ext4_writepage_trans_blocks(inode)); - if (IS_ERR(handle)) { - ret = PTR_ERR(handle); -- goto out; -+ put_page(page); -+ goto out_no_pagelock; - } -- - BUG_ON(!ext4_handle_valid(handle)); - -+ lock_page(page); -+ put_page(page); -+ if (page->mapping != mapping) { -+ /* The page got truncated from under us */ -+ ext4_journal_stop(handle); -+ ret = 0; -+ goto out; -+ } -+ - if (inline_data) { - ret = ext4_journal_get_write_access(handle, inode_bh); - -@@ -2136,6 +2158,8 @@ static int __ext4_journalled_writepage(struct page *page, - NULL, bput_one); - ext4_set_inode_state(inode, EXT4_STATE_JDATA); - out: -+ unlock_page(page); -+out_no_pagelock: - brelse(inode_bh); - return ret; - } -diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c -index df5050f9080b..61ee01603940 100644 ---- a/fs/ext4/mballoc.c -+++ b/fs/ext4/mballoc.c -@@ -4764,18 +4764,12 @@ do_more: - /* - * blocks being freed are metadata. these blocks shouldn't - * be used until this transaction is committed -+ * -+ * We use __GFP_NOFAIL because ext4_free_blocks() is not allowed -+ * to fail. - */ -- retry: -- new_entry = kmem_cache_alloc(ext4_free_data_cachep, GFP_NOFS); -- if (!new_entry) { -- /* -- * We use a retry loop because -- * ext4_free_blocks() is not allowed to fail. -- */ -- cond_resched(); -- congestion_wait(BLK_RW_ASYNC, HZ/50); -- goto retry; -- } -+ new_entry = kmem_cache_alloc(ext4_free_data_cachep, -+ GFP_NOFS|__GFP_NOFAIL); - new_entry->efd_start_cluster = bit; - new_entry->efd_group = block_group; - new_entry->efd_count = count_clusters; -diff --git a/fs/ext4/migrate.c b/fs/ext4/migrate.c -index 49e8bdff9163..d19efab66cb6 100644 ---- a/fs/ext4/migrate.c -+++ b/fs/ext4/migrate.c -@@ -616,6 +616,7 @@ int ext4_ind_migrate(struct inode *inode) - struct ext4_inode_info *ei = EXT4_I(inode); - struct ext4_extent *ex; - unsigned int i, len; -+ ext4_lblk_t start, end; - ext4_fsblk_t blk; - handle_t *handle; - int ret; -@@ -629,6 +630,14 @@ int ext4_ind_migrate(struct inode *inode) - EXT4_FEATURE_RO_COMPAT_BIGALLOC)) - return -EOPNOTSUPP; - -+ /* -+ * In order to get correct extent info, force all delayed allocation -+ * blocks to be allocated, otherwise delayed allocation blocks may not -+ * be reflected and bypass the checks on extent header. -+ */ -+ if (test_opt(inode->i_sb, DELALLOC)) -+ ext4_alloc_da_blocks(inode); -+ - handle = ext4_journal_start(inode, EXT4_HT_MIGRATE, 1); - if (IS_ERR(handle)) - return PTR_ERR(handle); -@@ -646,11 +655,13 @@ int ext4_ind_migrate(struct inode *inode) - goto errout; - } - if (eh->eh_entries == 0) -- blk = len = 0; -+ blk = len = start = end = 0; - else { - len = le16_to_cpu(ex->ee_len); - blk = ext4_ext_pblock(ex); -- if (len > EXT4_NDIR_BLOCKS) { -+ start = le32_to_cpu(ex->ee_block); -+ end = start + len - 1; -+ if (end >= EXT4_NDIR_BLOCKS) { - ret = -EOPNOTSUPP; - goto errout; - } -@@ -658,7 +669,7 @@ int ext4_ind_migrate(struct inode *inode) - - ext4_clear_inode_flag(inode, EXT4_INODE_EXTENTS); - memset(ei->i_data, 0, sizeof(ei->i_data)); -- for (i=0; i < len; i++) -+ for (i = start; i <= end; i++) - ei->i_data[i] = cpu_to_le32(blk++); - ext4_mark_inode_dirty(handle, inode); - errout: -diff --git a/fs/ext4/super.c b/fs/ext4/super.c -index 21a0b43a7d31..af1eaed96a91 100644 ---- a/fs/ext4/super.c -+++ b/fs/ext4/super.c -@@ -803,6 +803,7 @@ static void ext4_put_super(struct super_block *sb) - dump_orphan_list(sb, sbi); - J_ASSERT(list_empty(&sbi->s_orphan)); - -+ sync_blockdev(sb->s_bdev); - invalidate_bdev(sb->s_bdev); - if (sbi->journal_bdev && sbi->journal_bdev != sb->s_bdev) { - /* -diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c -index 39a986e1da9e..4d371f3b9a45 100644 ---- a/fs/fuse/inode.c -+++ b/fs/fuse/inode.c -@@ -1028,6 +1028,7 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent) - goto err_fput; - - fuse_conn_init(fc); -+ fc->release = fuse_free_conn; - - fc->dev = sb->s_dev; - fc->sb = sb; -@@ -1042,7 +1043,6 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent) - fc->dont_mask = 1; - sb->s_flags |= MS_POSIXACL; - -- fc->release = fuse_free_conn; - fc->flags = d.flags; - fc->user_id = d.user_id; - fc->group_id = d.group_id; -diff --git a/fs/hpfs/super.c b/fs/hpfs/super.c -index 962e90c37aec..2c1ce192af8b 100644 ---- a/fs/hpfs/super.c -+++ b/fs/hpfs/super.c -@@ -52,17 +52,20 @@ static void unmark_dirty(struct super_block *s) - } - - /* Filesystem error... */ --static char err_buf[1024]; -- - void hpfs_error(struct super_block *s, const char *fmt, ...) - { -+ struct va_format vaf; - va_list args; - - va_start(args, fmt); -- vsnprintf(err_buf, sizeof(err_buf), fmt, args); -+ -+ vaf.fmt = fmt; -+ vaf.va = &args; -+ -+ pr_err("filesystem error: %pV", &vaf); -+ - va_end(args); - -- printk("HPFS: filesystem error: %s", err_buf); - if (!hpfs_sb(s)->sb_was_error) { - if (hpfs_sb(s)->sb_err == 2) { - printk("; crashing the system because you wanted it\n"); -diff --git a/fs/jbd2/checkpoint.c b/fs/jbd2/checkpoint.c -index c78841ee81cf..6bb52859cb86 100644 ---- a/fs/jbd2/checkpoint.c -+++ b/fs/jbd2/checkpoint.c -@@ -440,7 +440,7 @@ int jbd2_cleanup_journal_tail(journal_t *journal) - unsigned long blocknr; - - if (is_journal_aborted(journal)) -- return 1; -+ return -EIO; - - if (!jbd2_journal_get_log_tail(journal, &first_tid, &blocknr)) - return 1; -@@ -455,10 +455,9 @@ int jbd2_cleanup_journal_tail(journal_t *journal) - * jbd2_cleanup_journal_tail() doesn't get called all that often. - */ - if (journal->j_flags & JBD2_BARRIER) -- blkdev_issue_flush(journal->j_fs_dev, GFP_KERNEL, NULL); -+ blkdev_issue_flush(journal->j_fs_dev, GFP_NOFS, NULL); - -- __jbd2_update_log_tail(journal, first_tid, blocknr); -- return 0; -+ return __jbd2_update_log_tail(journal, first_tid, blocknr); - } - - -diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c -index aaa1a3f33b0e..3e7ef8874ffb 100644 ---- a/fs/jbd2/journal.c -+++ b/fs/jbd2/journal.c -@@ -869,9 +869,10 @@ int jbd2_journal_get_log_tail(journal_t *journal, tid_t *tid, - * - * Requires j_checkpoint_mutex - */ --void __jbd2_update_log_tail(journal_t *journal, tid_t tid, unsigned long block) -+int __jbd2_update_log_tail(journal_t *journal, tid_t tid, unsigned long block) - { - unsigned long freed; -+ int ret; - - BUG_ON(!mutex_is_locked(&journal->j_checkpoint_mutex)); - -@@ -881,7 +882,10 @@ void __jbd2_update_log_tail(journal_t *journal, tid_t tid, unsigned long block) - * space and if we lose sb update during power failure we'd replay - * old transaction with possibly newly overwritten data. - */ -- jbd2_journal_update_sb_log_tail(journal, tid, block, WRITE_FUA); -+ ret = jbd2_journal_update_sb_log_tail(journal, tid, block, WRITE_FUA); -+ if (ret) -+ goto out; -+ - write_lock(&journal->j_state_lock); - freed = block - journal->j_tail; - if (block < journal->j_tail) -@@ -897,6 +901,9 @@ void __jbd2_update_log_tail(journal_t *journal, tid_t tid, unsigned long block) - journal->j_tail_sequence = tid; - journal->j_tail = block; - write_unlock(&journal->j_state_lock); -+ -+out: -+ return ret; - } - - /* -@@ -1315,7 +1322,7 @@ static int journal_reset(journal_t *journal) - return jbd2_journal_start_thread(journal); - } - --static void jbd2_write_superblock(journal_t *journal, int write_op) -+static int jbd2_write_superblock(journal_t *journal, int write_op) - { - struct buffer_head *bh = journal->j_sb_buffer; - journal_superblock_t *sb = journal->j_superblock; -@@ -1354,7 +1361,10 @@ static void jbd2_write_superblock(journal_t *journal, int write_op) - printk(KERN_ERR "JBD2: Error %d detected when updating " - "journal superblock for %s.\n", ret, - journal->j_devname); -+ jbd2_journal_abort(journal, ret); - } -+ -+ return ret; - } - - /** -@@ -1367,10 +1377,11 @@ static void jbd2_write_superblock(journal_t *journal, int write_op) - * Update a journal's superblock information about log tail and write it to - * disk, waiting for the IO to complete. - */ --void jbd2_journal_update_sb_log_tail(journal_t *journal, tid_t tail_tid, -+int jbd2_journal_update_sb_log_tail(journal_t *journal, tid_t tail_tid, - unsigned long tail_block, int write_op) - { - journal_superblock_t *sb = journal->j_superblock; -+ int ret; - - BUG_ON(!mutex_is_locked(&journal->j_checkpoint_mutex)); - jbd_debug(1, "JBD2: updating superblock (start %lu, seq %u)\n", -@@ -1379,13 +1390,18 @@ void jbd2_journal_update_sb_log_tail(journal_t *journal, tid_t tail_tid, - sb->s_sequence = cpu_to_be32(tail_tid); - sb->s_start = cpu_to_be32(tail_block); - -- jbd2_write_superblock(journal, write_op); -+ ret = jbd2_write_superblock(journal, write_op); -+ if (ret) -+ goto out; - - /* Log is no longer empty */ - write_lock(&journal->j_state_lock); - WARN_ON(!sb->s_sequence); - journal->j_flags &= ~JBD2_FLUSHED; - write_unlock(&journal->j_state_lock); -+ -+out: -+ return ret; - } - - /** -@@ -1922,7 +1938,14 @@ int jbd2_journal_flush(journal_t *journal) - return -EIO; - - mutex_lock(&journal->j_checkpoint_mutex); -- jbd2_cleanup_journal_tail(journal); -+ if (!err) { -+ err = jbd2_cleanup_journal_tail(journal); -+ if (err < 0) { -+ mutex_unlock(&journal->j_checkpoint_mutex); -+ goto out; -+ } -+ err = 0; -+ } - - /* Finally, mark the journal as really needing no recovery. - * This sets s_start==0 in the underlying superblock, which is -@@ -1938,7 +1961,8 @@ int jbd2_journal_flush(journal_t *journal) - J_ASSERT(journal->j_head == journal->j_tail); - J_ASSERT(journal->j_tail_sequence == journal->j_transaction_sequence); - write_unlock(&journal->j_state_lock); -- return 0; -+out: -+ return err; - } - - /** -diff --git a/fs/nfs/nfs3xdr.c b/fs/nfs/nfs3xdr.c -index fa6d72131c19..4495cad189c3 100644 ---- a/fs/nfs/nfs3xdr.c -+++ b/fs/nfs/nfs3xdr.c -@@ -1342,7 +1342,7 @@ static void nfs3_xdr_enc_setacl3args(struct rpc_rqst *req, - if (args->npages != 0) - xdr_write_pages(xdr, args->pages, 0, args->len); - else -- xdr_reserve_space(xdr, NFS_ACL_INLINE_BUFSIZE); -+ xdr_reserve_space(xdr, args->len); - - error = nfsacl_encode(xdr->buf, base, args->inode, - (args->mask & NFS_ACL) ? -diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c -index d482b86d0e0b..cfa9163b3bb7 100644 ---- a/fs/nfs/nfs4state.c -+++ b/fs/nfs/nfs4state.c -@@ -1452,6 +1452,8 @@ restart: - } - spin_unlock(&state->state_lock); - nfs4_put_open_state(state); -+ clear_bit(NFS4CLNT_RECLAIM_NOGRACE, -+ &state->flags); - spin_lock(&sp->so_lock); - goto restart; - } -diff --git a/fs/xfs/xfs_symlink.c b/fs/xfs/xfs_symlink.c -index 195a403e1522..61dbe1958a30 100644 ---- a/fs/xfs/xfs_symlink.c -+++ b/fs/xfs/xfs_symlink.c -@@ -272,7 +272,7 @@ xfs_readlink_bmap( - cur_chunk += sizeof(struct xfs_dsymlink_hdr); - } - -- memcpy(link + offset, bp->b_addr, byte_cnt); -+ memcpy(link + offset, cur_chunk, byte_cnt); - - pathlen -= byte_cnt; - offset += byte_cnt; -diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h -index f819e813c8ac..4407354c7d6a 100644 ---- a/include/acpi/actypes.h -+++ b/include/acpi/actypes.h -@@ -511,6 +511,7 @@ typedef u64 acpi_integer; - #define ACPI_NO_ACPI_ENABLE 0x10 - #define ACPI_NO_DEVICE_INIT 0x20 - #define ACPI_NO_OBJECT_INIT 0x40 -+#define ACPI_NO_FACS_INIT 0x80 - - /* - * Initialization state -diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h -index 6e051f472edb..0c67c1f2a890 100644 ---- a/include/linux/jbd2.h -+++ b/include/linux/jbd2.h -@@ -997,7 +997,7 @@ extern struct journal_head * jbd2_journal_get_descriptor_buffer(journal_t *); - int jbd2_journal_next_log_block(journal_t *, unsigned long long *); - int jbd2_journal_get_log_tail(journal_t *journal, tid_t *tid, - unsigned long *block); --void __jbd2_update_log_tail(journal_t *journal, tid_t tid, unsigned long block); -+int __jbd2_update_log_tail(journal_t *journal, tid_t tid, unsigned long block); - void jbd2_update_log_tail(journal_t *journal, tid_t tid, unsigned long block); - - /* Commit management */ -@@ -1116,7 +1116,7 @@ extern int jbd2_journal_recover (journal_t *journal); - extern int jbd2_journal_wipe (journal_t *, int); - extern int jbd2_journal_skip_recovery (journal_t *); - extern void jbd2_journal_update_sb_errno(journal_t *); --extern void jbd2_journal_update_sb_log_tail (journal_t *, tid_t, -+extern int jbd2_journal_update_sb_log_tail (journal_t *, tid_t, - unsigned long, int); - extern void __jbd2_journal_abort_hard (journal_t *); - extern void jbd2_journal_abort (journal_t *, int); -diff --git a/include/linux/libata.h b/include/linux/libata.h -index 8e5d45fa83cf..8ad0771b88ab 100644 ---- a/include/linux/libata.h -+++ b/include/linux/libata.h -@@ -409,6 +409,7 @@ enum { - ATA_HORKAGE_ATAPI_DMADIR = (1 << 18), /* device requires dmadir */ - ATA_HORKAGE_NOLPM = (1 << 20), /* don't use LPM */ - ATA_HORKAGE_WD_BROKEN_LPM = (1 << 21), /* some WDs have broken LPM */ -+ ATA_HORKAGE_NOTRIM = (1 << 24), /* don't use TRIM */ - - /* DMA mask for user DMA control: User visible values; DO NOT - renumber */ -diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h -index 54e351aa4d2e..a9e5134c2936 100644 ---- a/include/linux/nfs_xdr.h -+++ b/include/linux/nfs_xdr.h -@@ -1094,7 +1094,7 @@ struct pnfs_ds_commit_info { - struct pnfs_commit_bucket *buckets; - }; - --#define NFS4_EXCHANGE_ID_LEN (48) -+#define NFS4_EXCHANGE_ID_LEN (127) - struct nfs41_exchange_id_args { - struct nfs_client *client; - nfs4_verifier *verifier; -diff --git a/include/uapi/linux/usbdevice_fs.h b/include/uapi/linux/usbdevice_fs.h -index 0c65e4b12617..ef29266ef77a 100644 ---- a/include/uapi/linux/usbdevice_fs.h -+++ b/include/uapi/linux/usbdevice_fs.h -@@ -125,11 +125,12 @@ struct usbdevfs_hub_portinfo { - char port [127]; /* e.g. port 3 connects to device 27 */ - }; - --/* Device capability flags */ -+/* System and bus capability flags */ - #define USBDEVFS_CAP_ZERO_PACKET 0x01 - #define USBDEVFS_CAP_BULK_CONTINUATION 0x02 - #define USBDEVFS_CAP_NO_PACKET_SIZE_LIM 0x04 - #define USBDEVFS_CAP_BULK_SCATTER_GATHER 0x08 -+#define USBDEVFS_CAP_REAP_AFTER_DISCONNECT 0x10 - - /* USBDEVFS_DISCONNECT_CLAIM flags & struct */ - -diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h -index aa0e736b72ac..fe576073580a 100644 ---- a/kernel/trace/trace.h -+++ b/kernel/trace/trace.h -@@ -428,6 +428,7 @@ enum { - - TRACE_CONTROL_BIT, - -+ TRACE_BRANCH_BIT, - /* - * Abuse of the trace_recursion. - * As we need a way to maintain state if we are tracing the function -diff --git a/kernel/trace/trace_branch.c b/kernel/trace/trace_branch.c -index d594da0dc03c..cb89197adf5c 100644 ---- a/kernel/trace/trace_branch.c -+++ b/kernel/trace/trace_branch.c -@@ -37,9 +37,12 @@ probe_likely_condition(struct ftrace_branch_data *f, int val, int expect) - struct trace_branch *entry; - struct ring_buffer *buffer; - unsigned long flags; -- int cpu, pc; -+ int pc; - const char *p; - -+ if (current->trace_recursion & TRACE_BRANCH_BIT) -+ return; -+ - /* - * I would love to save just the ftrace_likely_data pointer, but - * this code can also be used by modules. Ugly things can happen -@@ -50,10 +53,10 @@ probe_likely_condition(struct ftrace_branch_data *f, int val, int expect) - if (unlikely(!tr)) - return; - -- local_irq_save(flags); -- cpu = raw_smp_processor_id(); -- data = per_cpu_ptr(tr->trace_buffer.data, cpu); -- if (atomic_inc_return(&data->disabled) != 1) -+ raw_local_irq_save(flags); -+ current->trace_recursion |= TRACE_BRANCH_BIT; -+ data = this_cpu_ptr(tr->trace_buffer.data); -+ if (atomic_read(&data->disabled)) - goto out; - - pc = preempt_count(); -@@ -82,8 +85,8 @@ probe_likely_condition(struct ftrace_branch_data *f, int val, int expect) - __buffer_unlock_commit(buffer, event); - - out: -- atomic_dec(&data->disabled); -- local_irq_restore(flags); -+ current->trace_recursion &= ~TRACE_BRANCH_BIT; -+ raw_local_irq_restore(flags); - } - - static inline -diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c -index fe3e086d38e9..67654bb5bc2f 100644 ---- a/kernel/trace/trace_events_filter.c -+++ b/kernel/trace/trace_events_filter.c -@@ -1015,6 +1015,9 @@ static void parse_init(struct filter_parse_state *ps, - - static char infix_next(struct filter_parse_state *ps) - { -+ if (!ps->infix.cnt) -+ return 0; -+ - ps->infix.cnt--; - - return ps->infix.string[ps->infix.tail++]; -@@ -1030,6 +1033,9 @@ static char infix_peek(struct filter_parse_state *ps) - - static void infix_advance(struct filter_parse_state *ps) - { -+ if (!ps->infix.cnt) -+ return; -+ - ps->infix.cnt--; - ps->infix.tail++; - } -@@ -1342,7 +1348,9 @@ static int check_preds(struct filter_parse_state *ps) - continue; - } - n_normal_preds++; -- WARN_ON_ONCE(cnt < 0); -+ /* all ops should have operands */ -+ if (cnt < 0) -+ break; - } - - if (cnt != 1 || !n_normal_preds || n_logical_preds >= n_normal_preds) { -diff --git a/lib/bitmap.c b/lib/bitmap.c -index e5c4ebe586ba..c0634aa923a6 100644 ---- a/lib/bitmap.c -+++ b/lib/bitmap.c -@@ -603,12 +603,12 @@ static int __bitmap_parselist(const char *buf, unsigned int buflen, - unsigned a, b; - int c, old_c, totaldigits; - const char __user __force *ubuf = (const char __user __force *)buf; -- int exp_digit, in_range; -+ int at_start, in_range; - - totaldigits = c = 0; - bitmap_zero(maskp, nmaskbits); - do { -- exp_digit = 1; -+ at_start = 1; - in_range = 0; - a = b = 0; - -@@ -637,11 +637,10 @@ static int __bitmap_parselist(const char *buf, unsigned int buflen, - break; - - if (c == '-') { -- if (exp_digit || in_range) -+ if (at_start || in_range) - return -EINVAL; - b = 0; - in_range = 1; -- exp_digit = 1; - continue; - } - -@@ -651,16 +650,18 @@ static int __bitmap_parselist(const char *buf, unsigned int buflen, - b = b * 10 + (c - '0'); - if (!in_range) - a = b; -- exp_digit = 0; -+ at_start = 0; - totaldigits++; - } - if (!(a <= b)) - return -EINVAL; - if (b >= nmaskbits) - return -ERANGE; -- while (a <= b) { -- set_bit(a, maskp); -- a++; -+ if (!at_start) { -+ while (a <= b) { -+ set_bit(a, maskp); -+ a++; -+ } - } - } while (buflen && c == ','); - return 0; -diff --git a/net/9p/client.c b/net/9p/client.c -index addc116cecf0..853d62327a58 100644 ---- a/net/9p/client.c -+++ b/net/9p/client.c -@@ -828,7 +828,8 @@ static struct p9_req_t *p9_client_zc_rpc(struct p9_client *c, int8_t type, - if (err < 0) { - if (err == -EIO) - c->status = Disconnected; -- goto reterr; -+ if (err != -ERESTARTSYS) -+ goto reterr; - } - if (req->status == REQ_STATUS_ERROR) { - p9_debug(P9_DEBUG_ERROR, "req_status error %d\n", req->t_err); -diff --git a/net/ceph/osdmap.c b/net/ceph/osdmap.c -index dbd9a4792427..7ec4e0522215 100644 ---- a/net/ceph/osdmap.c -+++ b/net/ceph/osdmap.c -@@ -89,7 +89,7 @@ static int crush_decode_tree_bucket(void **p, void *end, - { - int j; - dout("crush_decode_tree_bucket %p to %p\n", *p, end); -- ceph_decode_32_safe(p, end, b->num_nodes, bad); -+ ceph_decode_8_safe(p, end, b->num_nodes, bad); - b->node_weights = kcalloc(b->num_nodes, sizeof(u32), GFP_NOFS); - if (b->node_weights == NULL) - return -ENOMEM; -diff --git a/net/mac80211/main.c b/net/mac80211/main.c -index 6658c5809353..dd6ca36c34c1 100644 ---- a/net/mac80211/main.c -+++ b/net/mac80211/main.c -@@ -257,6 +257,7 @@ static void ieee80211_restart_work(struct work_struct *work) - { - struct ieee80211_local *local = - container_of(work, struct ieee80211_local, restart_work); -+ struct ieee80211_sub_if_data *sdata; - - /* wait for scan work complete */ - flush_workqueue(local->workqueue); -@@ -269,6 +270,8 @@ static void ieee80211_restart_work(struct work_struct *work) - mutex_unlock(&local->mtx); - - rtnl_lock(); -+ list_for_each_entry(sdata, &local->interfaces, list) -+ flush_delayed_work(&sdata->dec_tailroom_needed_wk); - ieee80211_scan_cancel(local); - ieee80211_reconfig(local); - rtnl_unlock(); -diff --git a/net/sunrpc/backchannel_rqst.c b/net/sunrpc/backchannel_rqst.c -index 890a29912d5a..d29c119ecd9c 100644 ---- a/net/sunrpc/backchannel_rqst.c -+++ b/net/sunrpc/backchannel_rqst.c -@@ -60,7 +60,7 @@ static void xprt_free_allocation(struct rpc_rqst *req) - - dprintk("RPC: free allocations for req= %p\n", req); - WARN_ON_ONCE(test_bit(RPC_BC_PA_IN_USE, &req->rq_bc_pa_state)); -- xbufp = &req->rq_private_buf; -+ xbufp = &req->rq_rcv_buf; - free_page((unsigned long)xbufp->head[0].iov_base); - xbufp = &req->rq_snd_buf; - free_page((unsigned long)xbufp->head[0].iov_base); -diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c -index ca2094c914a1..a82d6576fe0f 100644 ---- a/sound/pci/hda/patch_realtek.c -+++ b/sound/pci/hda/patch_realtek.c -@@ -3365,6 +3365,7 @@ enum { - ALC269_FIXUP_LIFEBOOK, - ALC269_FIXUP_LIFEBOOK_EXTMIC, - ALC269_FIXUP_LIFEBOOK_HP_PIN, -+ ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT, - ALC269_FIXUP_AMIC, - ALC269_FIXUP_DMIC, - ALC269VB_FIXUP_AMIC, -@@ -3383,6 +3384,7 @@ enum { - ALC290_FIXUP_MONO_SPEAKERS, - ALC269_FIXUP_HEADSET_MODE, - ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, -+ ALC269_FIXUP_ASPIRE_HEADSET_MIC, - ALC269_FIXUP_ASUS_X101_FUNC, - ALC269_FIXUP_ASUS_X101_VERB, - ALC269_FIXUP_ASUS_X101, -@@ -3486,6 +3488,10 @@ static const struct hda_fixup alc269_fixups[] = { - { } - }, - }, -+ [ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT] = { -+ .type = HDA_FIXUP_FUNC, -+ .v.func = alc269_fixup_pincfg_no_hp_to_lineout, -+ }, - [ALC269_FIXUP_AMIC] = { - .type = HDA_FIXUP_PINS, - .v.pins = (const struct hda_pintbl[]) { -@@ -3598,6 +3604,15 @@ static const struct hda_fixup alc269_fixups[] = { - .type = HDA_FIXUP_FUNC, - .v.func = alc_fixup_headset_mode_no_hp_mic, - }, -+ [ALC269_FIXUP_ASPIRE_HEADSET_MIC] = { -+ .type = HDA_FIXUP_PINS, -+ .v.pins = (const struct hda_pintbl[]) { -+ { 0x19, 0x01a1913c }, /* headset mic w/o jack detect */ -+ { } -+ }, -+ .chained = true, -+ .chain_id = ALC269_FIXUP_HEADSET_MODE, -+ }, - [ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = { - .type = HDA_FIXUP_PINS, - .v.pins = (const struct hda_pintbl[]) { -@@ -3732,10 +3747,13 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { - SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), - SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), - SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700), -+ SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC), -+ SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC), - SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK), - SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK), - SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC), - SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK), -+ SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT), - SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN), - SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN), - SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC), -diff --git a/sound/soc/codecs/wm8737.c b/sound/soc/codecs/wm8737.c -index 2f167a8ca01b..62bacb8536e6 100644 ---- a/sound/soc/codecs/wm8737.c -+++ b/sound/soc/codecs/wm8737.c -@@ -494,7 +494,8 @@ static int wm8737_set_bias_level(struct snd_soc_codec *codec, - - /* Fast VMID ramp at 2*2.5k */ - snd_soc_update_bits(codec, WM8737_MISC_BIAS_CONTROL, -- WM8737_VMIDSEL_MASK, 0x4); -+ WM8737_VMIDSEL_MASK, -+ 2 << WM8737_VMIDSEL_SHIFT); - - /* Bring VMID up */ - snd_soc_update_bits(codec, WM8737_POWER_MANAGEMENT, -@@ -508,7 +509,8 @@ static int wm8737_set_bias_level(struct snd_soc_codec *codec, - - /* VMID at 2*300k */ - snd_soc_update_bits(codec, WM8737_MISC_BIAS_CONTROL, -- WM8737_VMIDSEL_MASK, 2); -+ WM8737_VMIDSEL_MASK, -+ 1 << WM8737_VMIDSEL_SHIFT); - - break; - -diff --git a/sound/soc/codecs/wm8903.h b/sound/soc/codecs/wm8903.h -index db949311c0f2..0bb4a647755d 100644 ---- a/sound/soc/codecs/wm8903.h -+++ b/sound/soc/codecs/wm8903.h -@@ -172,7 +172,7 @@ extern int wm8903_mic_detect(struct snd_soc_codec *codec, - #define WM8903_VMID_BUF_ENA_WIDTH 1 /* VMID_BUF_ENA */ - - #define WM8903_VMID_RES_50K 2 --#define WM8903_VMID_RES_250K 3 -+#define WM8903_VMID_RES_250K 4 - #define WM8903_VMID_RES_5K 6 - - /* -diff --git a/sound/soc/codecs/wm8955.c b/sound/soc/codecs/wm8955.c -index 1c1fc6119758..475fc24c8ff6 100644 ---- a/sound/soc/codecs/wm8955.c -+++ b/sound/soc/codecs/wm8955.c -@@ -298,7 +298,7 @@ static int wm8955_configure_clocking(struct snd_soc_codec *codec) - snd_soc_update_bits(codec, WM8955_PLL_CONTROL_2, - WM8955_K_17_9_MASK, - (pll.k >> 9) & WM8955_K_17_9_MASK); -- snd_soc_update_bits(codec, WM8955_PLL_CONTROL_2, -+ snd_soc_update_bits(codec, WM8955_PLL_CONTROL_3, - WM8955_K_8_0_MASK, - pll.k & WM8955_K_8_0_MASK); - if (pll.k) -diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c -index 39f65bc9de56..ae5bb95df862 100644 ---- a/sound/soc/codecs/wm8960.c -+++ b/sound/soc/codecs/wm8960.c -@@ -242,7 +242,7 @@ SOC_SINGLE("PCM Playback -6dB Switch", WM8960_DACCTL1, 7, 1, 0), - SOC_ENUM("ADC Polarity", wm8960_enum[0]), - SOC_SINGLE("ADC High Pass Filter Switch", WM8960_DACCTL1, 0, 1, 0), - --SOC_ENUM("DAC Polarity", wm8960_enum[2]), -+SOC_ENUM("DAC Polarity", wm8960_enum[1]), - SOC_SINGLE_BOOL_EXT("DAC Deemphasis Switch", 0, - wm8960_get_deemph, wm8960_put_deemph), - diff --git a/patch/kernel/marvell-default/1-patch-3.10.84-85.patch.original b/patch/kernel/marvell-default/1-patch-3.10.84-85.patch.original deleted file mode 100644 index fcc7952084..0000000000 --- a/patch/kernel/marvell-default/1-patch-3.10.84-85.patch.original +++ /dev/null @@ -1,2941 +0,0 @@ -diff --git a/Documentation/devicetree/bindings/pinctrl/marvell,armada-370-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/marvell,armada-370-pinctrl.txt -index 01ef408e205f..8faff12e7014 100644 ---- a/Documentation/devicetree/bindings/pinctrl/marvell,armada-370-pinctrl.txt -+++ b/Documentation/devicetree/bindings/pinctrl/marvell,armada-370-pinctrl.txt -@@ -91,5 +91,5 @@ mpp61 61 gpo, dev(wen1), uart1(txd), audio(rclk) - mpp62 62 gpio, dev(a2), uart1(cts), tdm(drx), pcie(clkreq0), - audio(mclk), uart0(cts) - mpp63 63 gpo, spi0(sck), tclk --mpp64 64 gpio, spi0(miso), spi0-1(cs1) --mpp65 65 gpio, spi0(mosi), spi0-1(cs2) -+mpp64 64 gpio, spi0(miso), spi0(cs1) -+mpp65 65 gpio, spi0(mosi), spi0(cs2) -diff --git a/Documentation/devicetree/bindings/pinctrl/marvell,armada-xp-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/marvell,armada-xp-pinctrl.txt -index bfa0a2e5e0cb..86dec67e5450 100644 ---- a/Documentation/devicetree/bindings/pinctrl/marvell,armada-xp-pinctrl.txt -+++ b/Documentation/devicetree/bindings/pinctrl/marvell,armada-xp-pinctrl.txt -@@ -41,15 +41,15 @@ mpp20 20 gpio, ge0(rxd4), ge1(rxd2), lcd(d20), ptp(clk) - mpp21 21 gpio, ge0(rxd5), ge1(rxd3), lcd(d21), mem(bat) - mpp22 22 gpio, ge0(rxd6), ge1(rxctl), lcd(d22), sata0(prsnt) - mpp23 23 gpio, ge0(rxd7), ge1(rxclk), lcd(d23), sata1(prsnt) --mpp24 24 gpio, lcd(hsync), sata1(prsnt), nf(bootcs-re), tdm(rst) --mpp25 25 gpio, lcd(vsync), sata0(prsnt), nf(bootcs-we), tdm(pclk) --mpp26 26 gpio, lcd(clk), tdm(fsync), vdd(cpu1-pd) -+mpp24 24 gpio, lcd(hsync), sata1(prsnt), tdm(rst) -+mpp25 25 gpio, lcd(vsync), sata0(prsnt), tdm(pclk) -+mpp26 26 gpio, lcd(clk), tdm(fsync) - mpp27 27 gpio, lcd(e), tdm(dtx), ptp(trig) - mpp28 28 gpio, lcd(pwm), tdm(drx), ptp(evreq) --mpp29 29 gpio, lcd(ref-clk), tdm(int0), ptp(clk), vdd(cpu0-pd) -+mpp29 29 gpio, lcd(ref-clk), tdm(int0), ptp(clk) - mpp30 30 gpio, tdm(int1), sd0(clk) --mpp31 31 gpio, tdm(int2), sd0(cmd), vdd(cpu0-pd) --mpp32 32 gpio, tdm(int3), sd0(d0), vdd(cpu1-pd) -+mpp31 31 gpio, tdm(int2), sd0(cmd) -+mpp32 32 gpio, tdm(int3), sd0(d0) - mpp33 33 gpio, tdm(int4), sd0(d1), mem(bat) - mpp34 34 gpio, tdm(int5), sd0(d2), sata0(prsnt) - mpp35 35 gpio, tdm(int6), sd0(d3), sata1(prsnt) -@@ -57,21 +57,18 @@ mpp36 36 gpio, spi(mosi) - mpp37 37 gpio, spi(miso) - mpp38 38 gpio, spi(sck) - mpp39 39 gpio, spi(cs0) --mpp40 40 gpio, spi(cs1), uart2(cts), lcd(vga-hsync), vdd(cpu1-pd), -- pcie(clkreq0) -+mpp40 40 gpio, spi(cs1), uart2(cts), lcd(vga-hsync), pcie(clkreq0) - mpp41 41 gpio, spi(cs2), uart2(rts), lcd(vga-vsync), sata1(prsnt), - pcie(clkreq1) --mpp42 42 gpio, uart2(rxd), uart0(cts), tdm(int7), tdm-1(timer), -- vdd(cpu0-pd) --mpp43 43 gpio, uart2(txd), uart0(rts), spi(cs3), pcie(rstout), -- vdd(cpu2-3-pd){1} -+mpp42 42 gpio, uart2(rxd), uart0(cts), tdm(int7), tdm-1(timer) -+mpp43 43 gpio, uart2(txd), uart0(rts), spi(cs3), pcie(rstout) - mpp44 44 gpio, uart2(cts), uart3(rxd), spi(cs4), pcie(clkreq2), - mem(bat) - mpp45 45 gpio, uart2(rts), uart3(txd), spi(cs5), sata1(prsnt) - mpp46 46 gpio, uart3(rts), uart1(rts), spi(cs6), sata0(prsnt) - mpp47 47 gpio, uart3(cts), uart1(cts), spi(cs7), pcie(clkreq3), - ref(clkout) --mpp48 48 gpio, tclk, dev(burst/last) -+mpp48 48 gpio, dev(clkout), dev(burst/last) - - * Marvell Armada XP (mv78260 and mv78460 only) - -@@ -83,9 +80,9 @@ mpp51 51 gpio, dev(ad16) - mpp52 52 gpio, dev(ad17) - mpp53 53 gpio, dev(ad18) - mpp54 54 gpio, dev(ad19) --mpp55 55 gpio, dev(ad20), vdd(cpu0-pd) --mpp56 56 gpio, dev(ad21), vdd(cpu1-pd) --mpp57 57 gpio, dev(ad22), vdd(cpu2-3-pd){1} -+mpp55 55 gpio, dev(ad20) -+mpp56 56 gpio, dev(ad21) -+mpp57 57 gpio, dev(ad22) - mpp58 58 gpio, dev(ad23) - mpp59 59 gpio, dev(ad24) - mpp60 60 gpio, dev(ad25) -@@ -95,6 +92,3 @@ mpp63 63 gpio, dev(ad28) - mpp64 64 gpio, dev(ad29) - mpp65 65 gpio, dev(ad30) - mpp66 66 gpio, dev(ad31) -- --Notes: --* {1} vdd(cpu2-3-pd) only available on mv78460. -diff --git a/Documentation/devicetree/bindings/spi/spi_pl022.txt b/Documentation/devicetree/bindings/spi/spi_pl022.txt -index 22ed6797216d..4d1673ca8cf8 100644 ---- a/Documentation/devicetree/bindings/spi/spi_pl022.txt -+++ b/Documentation/devicetree/bindings/spi/spi_pl022.txt -@@ -4,9 +4,9 @@ Required properties: - - compatible : "arm,pl022", "arm,primecell" - - reg : Offset and length of the register set for the device - - interrupts : Should contain SPI controller interrupt -+- num-cs : total number of chipselects - - Optional properties: --- num-cs : total number of chipselects - - cs-gpios : should specify GPIOs used for chipselects. - The gpios will be referred to as reg = in the SPI child nodes. - If unspecified, a single SPI device without a chip select can be used. -diff --git a/Makefile b/Makefile -index f7b10bb56737..11a7e7bc31f2 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,6 +1,6 @@ - VERSION = 3 - PATCHLEVEL = 10 --SUBLEVEL = 84 -+SUBLEVEL = 85 - EXTRAVERSION = - NAME = TOSSUG Baby Fish - -diff --git a/arch/arc/include/asm/cmpxchg.h b/arch/arc/include/asm/cmpxchg.h -index 03cd6894855d..90de5c528da2 100644 ---- a/arch/arc/include/asm/cmpxchg.h -+++ b/arch/arc/include/asm/cmpxchg.h -@@ -25,10 +25,11 @@ __cmpxchg(volatile void *ptr, unsigned long expected, unsigned long new) - " scond %3, [%1] \n" - " bnz 1b \n" - "2: \n" -- : "=&r"(prev) -- : "r"(ptr), "ir"(expected), -- "r"(new) /* can't be "ir". scond can't take limm for "b" */ -- : "cc"); -+ : "=&r"(prev) /* Early clobber, to prevent reg reuse */ -+ : "r"(ptr), /* Not "m": llock only supports reg direct addr mode */ -+ "ir"(expected), -+ "r"(new) /* can't be "ir". scond can't take LIMM for "b" */ -+ : "cc", "memory"); /* so that gcc knows memory is being written here */ - - return prev; - } -diff --git a/arch/arm64/kernel/vdso/Makefile b/arch/arm64/kernel/vdso/Makefile -index 6d20b7d162d8..fdda6dd71ac6 100644 ---- a/arch/arm64/kernel/vdso/Makefile -+++ b/arch/arm64/kernel/vdso/Makefile -@@ -15,6 +15,10 @@ ccflags-y := -shared -fno-common -fno-builtin - ccflags-y += -nostdlib -Wl,-soname=linux-vdso.so.1 \ - $(call cc-ldoption, -Wl$(comma)--hash-style=sysv) - -+# Workaround for bare-metal (ELF) toolchains that neglect to pass -shared -+# down to collect2, resulting in silent corruption of the vDSO image. -+ccflags-y += -Wl,-shared -+ - obj-y += vdso.o - extra-y += vdso.lds vdso-offsets.h - CPPFLAGS_vdso.lds += -P -C -U$(ARCH) -diff --git a/arch/arm64/mm/context.c b/arch/arm64/mm/context.c -index baa758d37021..76c1e6cd36fc 100644 ---- a/arch/arm64/mm/context.c -+++ b/arch/arm64/mm/context.c -@@ -92,6 +92,14 @@ static void reset_context(void *info) - unsigned int cpu = smp_processor_id(); - struct mm_struct *mm = current->active_mm; - -+ /* -+ * current->active_mm could be init_mm for the idle thread immediately -+ * after secondary CPU boot or hotplug. TTBR0_EL1 is already set to -+ * the reserved value, so no need to reset any context. -+ */ -+ if (mm == &init_mm) -+ return; -+ - smp_rmb(); - asid = cpu_last_asid + cpu; - -diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c -index f497ca77925a..5c5516611b5e 100644 ---- a/arch/arm64/mm/init.c -+++ b/arch/arm64/mm/init.c -@@ -262,7 +262,7 @@ static void __init free_unused_memmap(void) - * memmap entries are valid from the bank end aligned to - * MAX_ORDER_NR_PAGES. - */ -- prev_end = ALIGN(start + __phys_to_pfn(reg->size), -+ prev_end = ALIGN(__phys_to_pfn(reg->base + reg->size), - MAX_ORDER_NR_PAGES); - } - -diff --git a/arch/mips/kvm/kvm_mips_emul.c b/arch/mips/kvm/kvm_mips_emul.c -index e75ef8219caf..c76f297b7149 100644 ---- a/arch/mips/kvm/kvm_mips_emul.c -+++ b/arch/mips/kvm/kvm_mips_emul.c -@@ -1626,7 +1626,7 @@ kvm_mips_complete_mmio_load(struct kvm_vcpu *vcpu, struct kvm_run *run) - if (vcpu->mmio_needed == 2) - *gpr = *(int16_t *) run->mmio.data; - else -- *gpr = *(int16_t *) run->mmio.data; -+ *gpr = *(uint16_t *)run->mmio.data; - - break; - case 1: -diff --git a/drivers/acpi/acpica/utxfinit.c b/drivers/acpi/acpica/utxfinit.c -index 41ebaaf8bb1a..ee58a62443bd 100644 ---- a/drivers/acpi/acpica/utxfinit.c -+++ b/drivers/acpi/acpica/utxfinit.c -@@ -165,10 +165,12 @@ acpi_status acpi_enable_subsystem(u32 flags) - * Obtain a permanent mapping for the FACS. This is required for the - * Global Lock and the Firmware Waking Vector - */ -- status = acpi_tb_initialize_facs(); -- if (ACPI_FAILURE(status)) { -- ACPI_WARNING((AE_INFO, "Could not map the FACS table")); -- return_ACPI_STATUS(status); -+ if (!(flags & ACPI_NO_FACS_INIT)) { -+ status = acpi_tb_initialize_facs(); -+ if (ACPI_FAILURE(status)) { -+ ACPI_WARNING((AE_INFO, "Could not map the FACS table")); -+ return_ACPI_STATUS(status); -+ } - } - #endif /* !ACPI_REDUCED_HARDWARE */ - -diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c -index 5d47a040129a..53d35b6fd8bb 100644 ---- a/drivers/ata/libata-core.c -+++ b/drivers/ata/libata-core.c -@@ -4150,9 +4150,10 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { - { "ST3320[68]13AS", "SD1[5-9]", ATA_HORKAGE_NONCQ | - ATA_HORKAGE_FIRMWARE_WARN }, - -- /* Seagate Momentus SpinPoint M8 seem to have FPMDA_AA issues */ -+ /* drives which fail FPDMA_AA activation (some may freeze afterwards) */ - { "ST1000LM024 HN-M101MBB", "2AR10001", ATA_HORKAGE_BROKEN_FPDMA_AA }, - { "ST1000LM024 HN-M101MBB", "2BA30001", ATA_HORKAGE_BROKEN_FPDMA_AA }, -+ { "VB0250EAVER", "HPG7", ATA_HORKAGE_BROKEN_FPDMA_AA }, - - /* Blacklist entries taken from Silicon Image 3124/3132 - Windows driver .inf file - also several Linux problem reports */ -@@ -4200,6 +4201,9 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { - { "PIONEER DVD-RW DVR-212D", NULL, ATA_HORKAGE_NOSETXFER }, - { "PIONEER DVD-RW DVR-216D", NULL, ATA_HORKAGE_NOSETXFER }, - -+ /* devices that don't properly handle TRIM commands */ -+ { "SuperSSpeed S238*", NULL, ATA_HORKAGE_NOTRIM, }, -+ - /* - * Some WD SATA-I drives spin up and down erratically when the link - * is put into the slumber mode. We don't have full list of the -@@ -4504,7 +4508,8 @@ static unsigned int ata_dev_set_xfermode(struct ata_device *dev) - else /* In the ancient relic department - skip all of this */ - return 0; - -- err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 0); -+ /* On some disks, this command causes spin-up, so we need longer timeout */ -+ err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 15000); - - DPRINTK("EXIT, err_mask=%x\n", err_mask); - return err_mask; -diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c -index 9933b4db7caf..04e7db668362 100644 ---- a/drivers/ata/libata-scsi.c -+++ b/drivers/ata/libata-scsi.c -@@ -2512,7 +2512,8 @@ static unsigned int ata_scsiop_read_cap(struct ata_scsi_args *args, u8 *rbuf) - rbuf[14] = (lowest_aligned >> 8) & 0x3f; - rbuf[15] = lowest_aligned; - -- if (ata_id_has_trim(args->id)) { -+ if (ata_id_has_trim(args->id) && -+ !(dev->horkage & ATA_HORKAGE_NOTRIM)) { - rbuf[14] |= 0x80; /* TPE */ - - if (ata_id_has_zero_after_trim(args->id)) -diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c -index 00a565676583..8e08fab0ed2e 100644 ---- a/drivers/base/firmware_class.c -+++ b/drivers/base/firmware_class.c -@@ -513,10 +513,8 @@ static void fw_dev_release(struct device *dev) - module_put(THIS_MODULE); - } - --static int firmware_uevent(struct device *dev, struct kobj_uevent_env *env) -+static int do_firmware_uevent(struct firmware_priv *fw_priv, struct kobj_uevent_env *env) - { -- struct firmware_priv *fw_priv = to_firmware_priv(dev); -- - if (add_uevent_var(env, "FIRMWARE=%s", fw_priv->buf->fw_id)) - return -ENOMEM; - if (add_uevent_var(env, "TIMEOUT=%i", loading_timeout)) -@@ -527,6 +525,18 @@ static int firmware_uevent(struct device *dev, struct kobj_uevent_env *env) - return 0; - } - -+static int firmware_uevent(struct device *dev, struct kobj_uevent_env *env) -+{ -+ struct firmware_priv *fw_priv = to_firmware_priv(dev); -+ int err = 0; -+ -+ mutex_lock(&fw_lock); -+ if (fw_priv->buf) -+ err = do_firmware_uevent(fw_priv, env); -+ mutex_unlock(&fw_lock); -+ return err; -+} -+ - static struct class firmware_class = { - .name = "firmware", - .class_attrs = firmware_class_attrs, -diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c -index 6a66f0b7d3d4..4f3d70a9d721 100644 ---- a/drivers/base/regmap/regmap.c -+++ b/drivers/base/regmap/regmap.c -@@ -1586,7 +1586,7 @@ int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val, - &ival); - if (ret != 0) - return ret; -- memcpy(val + (i * val_bytes), &ival, val_bytes); -+ map->format.format_val(val + (i * val_bytes), ival, 0); - } - } - -diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c -index dd297099c99d..f78cbbb88bd4 100644 ---- a/drivers/block/rbd.c -+++ b/drivers/block/rbd.c -@@ -1851,11 +1851,11 @@ static struct rbd_obj_request *rbd_obj_request_create(const char *object_name, - rbd_assert(obj_request_type_valid(type)); - - size = strlen(object_name) + 1; -- name = kmalloc(size, GFP_KERNEL); -+ name = kmalloc(size, GFP_NOIO); - if (!name) - return NULL; - -- obj_request = kmem_cache_zalloc(rbd_obj_request_cache, GFP_KERNEL); -+ obj_request = kmem_cache_zalloc(rbd_obj_request_cache, GFP_NOIO); - if (!obj_request) { - kfree(name); - return NULL; -diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c -index 92b985317770..537ad6897784 100644 ---- a/drivers/bluetooth/btusb.c -+++ b/drivers/bluetooth/btusb.c -@@ -1234,6 +1234,8 @@ static int btusb_setup_intel(struct hci_dev *hdev) - } - fw_ptr = fw->data; - -+ kfree_skb(skb); -+ - /* This Intel specific command enables the manufacturer mode of the - * controller. - * -diff --git a/drivers/char/agp/intel-gtt.c b/drivers/char/agp/intel-gtt.c -index b8e2014cb9cb..051aadb75e2c 100644 ---- a/drivers/char/agp/intel-gtt.c -+++ b/drivers/char/agp/intel-gtt.c -@@ -583,7 +583,7 @@ static inline int needs_ilk_vtd_wa(void) - /* Query intel_iommu to see if we need the workaround. Presumably that - * was loaded first. - */ -- if ((gpu_devid == PCI_DEVICE_ID_INTEL_IRONLAKE_M_HB || -+ if ((gpu_devid == PCI_DEVICE_ID_INTEL_IRONLAKE_D_IG || - gpu_devid == PCI_DEVICE_ID_INTEL_IRONLAKE_M_IG) && - intel_iommu_gfx_mapped) - return 1; -diff --git a/drivers/char/tpm/tpm_ibmvtpm.c b/drivers/char/tpm/tpm_ibmvtpm.c -index 09df26f9621d..a6524c3efdf7 100644 ---- a/drivers/char/tpm/tpm_ibmvtpm.c -+++ b/drivers/char/tpm/tpm_ibmvtpm.c -@@ -618,6 +618,9 @@ static int tpm_ibmvtpm_probe(struct vio_dev *vio_dev, - goto cleanup; - } - -+ ibmvtpm->dev = dev; -+ ibmvtpm->vdev = vio_dev; -+ - crq_q = &ibmvtpm->crq_queue; - crq_q->crq_addr = (struct ibmvtpm_crq *)get_zeroed_page(GFP_KERNEL); - if (!crq_q->crq_addr) { -@@ -662,8 +665,6 @@ static int tpm_ibmvtpm_probe(struct vio_dev *vio_dev, - - crq_q->index = 0; - -- ibmvtpm->dev = dev; -- ibmvtpm->vdev = vio_dev; - TPM_VPRIV(chip) = (void *)ibmvtpm; - - spin_lock_init(&ibmvtpm->rtce_lock); -diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c -index c3a93fece819..5b11022d7745 100644 ---- a/drivers/cpuidle/cpuidle.c -+++ b/drivers/cpuidle/cpuidle.c -@@ -135,6 +135,9 @@ int cpuidle_idle_call(void) - - /* ask the governor for the next state */ - next_state = cpuidle_curr_governor->select(drv, dev); -+ if (next_state < 0) -+ return -EBUSY; -+ - if (need_resched()) { - dev->last_residency = 0; - /* give the governor an opportunity to reflect on the outcome */ -diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c -index bc580b67a652..67fd901f6fc9 100644 ---- a/drivers/cpuidle/governors/menu.c -+++ b/drivers/cpuidle/governors/menu.c -@@ -269,7 +269,7 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) - data->needs_update = 0; - } - -- data->last_state_idx = 0; -+ data->last_state_idx = CPUIDLE_DRIVER_STATE_START - 1; - data->exit_us = 0; - - /* Special case when user has set very strict latency requirement */ -diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c -index d64ae14f2706..43092c317897 100644 ---- a/drivers/dma/mv_xor.c -+++ b/drivers/dma/mv_xor.c -@@ -393,7 +393,8 @@ static void __mv_xor_slot_cleanup(struct mv_xor_chan *mv_chan) - dma_cookie_t cookie = 0; - int busy = mv_chan_is_busy(mv_chan); - u32 current_desc = mv_chan_get_current_desc(mv_chan); -- int seen_current = 0; -+ int current_cleaned = 0; -+ struct mv_xor_desc *hw_desc; - - dev_dbg(mv_chan_to_devp(mv_chan), "%s %d\n", __func__, __LINE__); - dev_dbg(mv_chan_to_devp(mv_chan), "current_desc %x\n", current_desc); -@@ -405,38 +406,57 @@ static void __mv_xor_slot_cleanup(struct mv_xor_chan *mv_chan) - - list_for_each_entry_safe(iter, _iter, &mv_chan->chain, - chain_node) { -- prefetch(_iter); -- prefetch(&_iter->async_tx); - -- /* do not advance past the current descriptor loaded into the -- * hardware channel, subsequent descriptors are either in -- * process or have not been submitted -- */ -- if (seen_current) -- break; -+ /* clean finished descriptors */ -+ hw_desc = iter->hw_desc; -+ if (hw_desc->status & XOR_DESC_SUCCESS) { -+ cookie = mv_xor_run_tx_complete_actions(iter, mv_chan, -+ cookie); - -- /* stop the search if we reach the current descriptor and the -- * channel is busy -- */ -- if (iter->async_tx.phys == current_desc) { -- seen_current = 1; -- if (busy) -+ /* done processing desc, clean slot */ -+ mv_xor_clean_slot(iter, mv_chan); -+ -+ /* break if we did cleaned the current */ -+ if (iter->async_tx.phys == current_desc) { -+ current_cleaned = 1; -+ break; -+ } -+ } else { -+ if (iter->async_tx.phys == current_desc) { -+ current_cleaned = 0; - break; -+ } - } -- -- cookie = mv_xor_run_tx_complete_actions(iter, mv_chan, cookie); -- -- if (mv_xor_clean_slot(iter, mv_chan)) -- break; - } - - if ((busy == 0) && !list_empty(&mv_chan->chain)) { -- struct mv_xor_desc_slot *chain_head; -- chain_head = list_entry(mv_chan->chain.next, -- struct mv_xor_desc_slot, -- chain_node); -- -- mv_xor_start_new_chain(mv_chan, chain_head); -+ if (current_cleaned) { -+ /* -+ * current descriptor cleaned and removed, run -+ * from list head -+ */ -+ iter = list_entry(mv_chan->chain.next, -+ struct mv_xor_desc_slot, -+ chain_node); -+ mv_xor_start_new_chain(mv_chan, iter); -+ } else { -+ if (!list_is_last(&iter->chain_node, &mv_chan->chain)) { -+ /* -+ * descriptors are still waiting after -+ * current, trigger them -+ */ -+ iter = list_entry(iter->chain_node.next, -+ struct mv_xor_desc_slot, -+ chain_node); -+ mv_xor_start_new_chain(mv_chan, iter); -+ } else { -+ /* -+ * some descriptors are still waiting -+ * to be cleaned -+ */ -+ tasklet_schedule(&mv_chan->irq_tasklet); -+ } -+ } - } - - if (cookie > 0) -diff --git a/drivers/dma/mv_xor.h b/drivers/dma/mv_xor.h -index c632a4761fcf..e003851cd4e5 100644 ---- a/drivers/dma/mv_xor.h -+++ b/drivers/dma/mv_xor.h -@@ -32,6 +32,7 @@ - #define XOR_OPERATION_MODE_XOR 0 - #define XOR_OPERATION_MODE_MEMCPY 2 - #define XOR_OPERATION_MODE_MEMSET 4 -+#define XOR_DESC_SUCCESS 0x40000000 - - #define XOR_CURR_DESC(chan) (chan->mmr_base + 0x210 + (chan->idx * 4)) - #define XOR_NEXT_DESC(chan) (chan->mmr_base + 0x200 + (chan->idx * 4)) -diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c -index 8759d699bd8e..c24c35606836 100644 ---- a/drivers/gpu/drm/drm_crtc.c -+++ b/drivers/gpu/drm/drm_crtc.c -@@ -1955,8 +1955,11 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data, - if (!drm_core_check_feature(dev, DRIVER_MODESET)) - return -EINVAL; - -- /* For some reason crtc x/y offsets are signed internally. */ -- if (crtc_req->x > INT_MAX || crtc_req->y > INT_MAX) -+ /* -+ * Universal plane src offsets are only 16.16, prevent havoc for -+ * drivers using universal plane code internally. -+ */ -+ if (crtc_req->x & 0xffff0000 || crtc_req->y & 0xffff0000) - return -ERANGE; - - drm_modeset_lock_all(dev); -diff --git a/drivers/gpu/drm/qxl/qxl_cmd.c b/drivers/gpu/drm/qxl/qxl_cmd.c -index f86771481317..5a48d7419baf 100644 ---- a/drivers/gpu/drm/qxl/qxl_cmd.c -+++ b/drivers/gpu/drm/qxl/qxl_cmd.c -@@ -500,6 +500,7 @@ int qxl_hw_surface_alloc(struct qxl_device *qdev, - - cmd = (struct qxl_surface_cmd *)qxl_release_map(qdev, release); - cmd->type = QXL_SURFACE_CMD_CREATE; -+ cmd->flags = QXL_SURF_FLAG_KEEP_DATA; - cmd->u.surface_create.format = surf->surf.format; - cmd->u.surface_create.width = surf->surf.width; - cmd->u.surface_create.height = surf->surf.height; -diff --git a/drivers/gpu/drm/radeon/radeon_gart.c b/drivers/gpu/drm/radeon/radeon_gart.c -index 2915a1c56934..c4bb0bc2a1d9 100644 ---- a/drivers/gpu/drm/radeon/radeon_gart.c -+++ b/drivers/gpu/drm/radeon/radeon_gart.c -@@ -251,8 +251,10 @@ void radeon_gart_unbind(struct radeon_device *rdev, unsigned offset, - } - } - } -- mb(); -- radeon_gart_tlb_flush(rdev); -+ if (rdev->gart.ptr) { -+ mb(); -+ radeon_gart_tlb_flush(rdev); -+ } - } - - /** -@@ -294,8 +296,10 @@ int radeon_gart_bind(struct radeon_device *rdev, unsigned offset, - } - } - } -- mb(); -- radeon_gart_tlb_flush(rdev); -+ if (rdev->gart.ptr) { -+ mb(); -+ radeon_gart_tlb_flush(rdev); -+ } - return 0; - } - -diff --git a/drivers/gpu/drm/radeon/radeon_irq_kms.c b/drivers/gpu/drm/radeon/radeon_irq_kms.c -index 1fe12ab5c5ea..db83d075606e 100644 ---- a/drivers/gpu/drm/radeon/radeon_irq_kms.c -+++ b/drivers/gpu/drm/radeon/radeon_irq_kms.c -@@ -73,10 +73,12 @@ static void radeon_hotplug_work_func(struct work_struct *work) - struct drm_mode_config *mode_config = &dev->mode_config; - struct drm_connector *connector; - -+ mutex_lock(&mode_config->mutex); - if (mode_config->num_connector) { - list_for_each_entry(connector, &mode_config->connector_list, head) - radeon_connector_hotplug(connector); - } -+ mutex_unlock(&mode_config->mutex); - /* Just fire off a uevent and let userspace tell us what to do */ - drm_helper_hpd_irq_event(dev); - } -diff --git a/drivers/hwmon/mcp3021.c b/drivers/hwmon/mcp3021.c -index eedb32292d6d..f712cc785ef2 100644 ---- a/drivers/hwmon/mcp3021.c -+++ b/drivers/hwmon/mcp3021.c -@@ -31,14 +31,11 @@ - /* output format */ - #define MCP3021_SAR_SHIFT 2 - #define MCP3021_SAR_MASK 0x3ff -- - #define MCP3021_OUTPUT_RES 10 /* 10-bit resolution */ --#define MCP3021_OUTPUT_SCALE 4 - - #define MCP3221_SAR_SHIFT 0 - #define MCP3221_SAR_MASK 0xfff - #define MCP3221_OUTPUT_RES 12 /* 12-bit resolution */ --#define MCP3221_OUTPUT_SCALE 1 - - enum chips { - mcp3021, -@@ -54,7 +51,6 @@ struct mcp3021_data { - u16 sar_shift; - u16 sar_mask; - u8 output_res; -- u8 output_scale; - }; - - static int mcp3021_read16(struct i2c_client *client) -@@ -84,13 +80,7 @@ static int mcp3021_read16(struct i2c_client *client) - - static inline u16 volts_from_reg(struct mcp3021_data *data, u16 val) - { -- if (val == 0) -- return 0; -- -- val = val * data->output_scale - data->output_scale / 2; -- -- return val * DIV_ROUND_CLOSEST(data->vdd, -- (1 << data->output_res) * data->output_scale); -+ return DIV_ROUND_CLOSEST(data->vdd * val, 1 << data->output_res); - } - - static ssize_t show_in_input(struct device *dev, struct device_attribute *attr, -@@ -132,14 +122,12 @@ static int mcp3021_probe(struct i2c_client *client, - data->sar_shift = MCP3021_SAR_SHIFT; - data->sar_mask = MCP3021_SAR_MASK; - data->output_res = MCP3021_OUTPUT_RES; -- data->output_scale = MCP3021_OUTPUT_SCALE; - break; - - case mcp3221: - data->sar_shift = MCP3221_SAR_SHIFT; - data->sar_mask = MCP3221_SAR_MASK; - data->output_res = MCP3221_OUTPUT_RES; -- data->output_scale = MCP3221_OUTPUT_SCALE; - break; - } - -diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c -index 09324d0178d5..ceabcfeb587c 100644 ---- a/drivers/i2c/busses/i2c-at91.c -+++ b/drivers/i2c/busses/i2c-at91.c -@@ -63,6 +63,9 @@ - #define AT91_TWI_UNRE 0x0080 /* Underrun Error */ - #define AT91_TWI_NACK 0x0100 /* Not Acknowledged */ - -+#define AT91_TWI_INT_MASK \ -+ (AT91_TWI_TXCOMP | AT91_TWI_RXRDY | AT91_TWI_TXRDY | AT91_TWI_NACK) -+ - #define AT91_TWI_IER 0x0024 /* Interrupt Enable Register */ - #define AT91_TWI_IDR 0x0028 /* Interrupt Disable Register */ - #define AT91_TWI_IMR 0x002c /* Interrupt Mask Register */ -@@ -118,13 +121,12 @@ static void at91_twi_write(struct at91_twi_dev *dev, unsigned reg, unsigned val) - - static void at91_disable_twi_interrupts(struct at91_twi_dev *dev) - { -- at91_twi_write(dev, AT91_TWI_IDR, -- AT91_TWI_TXCOMP | AT91_TWI_RXRDY | AT91_TWI_TXRDY); -+ at91_twi_write(dev, AT91_TWI_IDR, AT91_TWI_INT_MASK); - } - - static void at91_twi_irq_save(struct at91_twi_dev *dev) - { -- dev->imr = at91_twi_read(dev, AT91_TWI_IMR) & 0x7; -+ dev->imr = at91_twi_read(dev, AT91_TWI_IMR) & AT91_TWI_INT_MASK; - at91_disable_twi_interrupts(dev); - } - -@@ -214,6 +216,14 @@ static void at91_twi_write_data_dma_callback(void *data) - dma_unmap_single(dev->dev, sg_dma_address(&dev->dma.sg), - dev->buf_len, DMA_TO_DEVICE); - -+ /* -+ * When this callback is called, THR/TX FIFO is likely not to be empty -+ * yet. So we have to wait for TXCOMP or NACK bits to be set into the -+ * Status Register to be sure that the STOP bit has been sent and the -+ * transfer is completed. The NACK interrupt has already been enabled, -+ * we just have to enable TXCOMP one. -+ */ -+ at91_twi_write(dev, AT91_TWI_IER, AT91_TWI_TXCOMP); - at91_twi_write(dev, AT91_TWI_CR, AT91_TWI_STOP); - } - -@@ -308,7 +318,7 @@ static void at91_twi_read_data_dma_callback(void *data) - /* The last two bytes have to be read without using dma */ - dev->buf += dev->buf_len - 2; - dev->buf_len = 2; -- at91_twi_write(dev, AT91_TWI_IER, AT91_TWI_RXRDY); -+ at91_twi_write(dev, AT91_TWI_IER, AT91_TWI_RXRDY | AT91_TWI_TXCOMP); - } - - static void at91_twi_read_data_dma(struct at91_twi_dev *dev) -@@ -369,7 +379,7 @@ static irqreturn_t atmel_twi_interrupt(int irq, void *dev_id) - /* catch error flags */ - dev->transfer_status |= status; - -- if (irqstatus & AT91_TWI_TXCOMP) { -+ if (irqstatus & (AT91_TWI_TXCOMP | AT91_TWI_NACK)) { - at91_disable_twi_interrupts(dev); - complete(&dev->cmd_complete); - } -@@ -382,6 +392,34 @@ static int at91_do_twi_transfer(struct at91_twi_dev *dev) - int ret; - bool has_unre_flag = dev->pdata->has_unre_flag; - -+ /* -+ * WARNING: the TXCOMP bit in the Status Register is NOT a clear on -+ * read flag but shows the state of the transmission at the time the -+ * Status Register is read. According to the programmer datasheet, -+ * TXCOMP is set when both holding register and internal shifter are -+ * empty and STOP condition has been sent. -+ * Consequently, we should enable NACK interrupt rather than TXCOMP to -+ * detect transmission failure. -+ * -+ * Besides, the TXCOMP bit is already set before the i2c transaction -+ * has been started. For read transactions, this bit is cleared when -+ * writing the START bit into the Control Register. So the -+ * corresponding interrupt can safely be enabled just after. -+ * However for write transactions managed by the CPU, we first write -+ * into THR, so TXCOMP is cleared. Then we can safely enable TXCOMP -+ * interrupt. If TXCOMP interrupt were enabled before writing into THR, -+ * the interrupt handler would be called immediately and the i2c command -+ * would be reported as completed. -+ * Also when a write transaction is managed by the DMA controller, -+ * enabling the TXCOMP interrupt in this function may lead to a race -+ * condition since we don't know whether the TXCOMP interrupt is enabled -+ * before or after the DMA has started to write into THR. So the TXCOMP -+ * interrupt is enabled later by at91_twi_write_data_dma_callback(). -+ * Immediately after in that DMA callback, we still need to send the -+ * STOP condition manually writing the corresponding bit into the -+ * Control Register. -+ */ -+ - dev_dbg(dev->dev, "transfer: %s %d bytes.\n", - (dev->msg->flags & I2C_M_RD) ? "read" : "write", dev->buf_len); - -@@ -412,26 +450,24 @@ static int at91_do_twi_transfer(struct at91_twi_dev *dev) - * seems to be the best solution. - */ - if (dev->use_dma && (dev->buf_len > AT91_I2C_DMA_THRESHOLD)) { -+ at91_twi_write(dev, AT91_TWI_IER, AT91_TWI_NACK); - at91_twi_read_data_dma(dev); -- /* -- * It is important to enable TXCOMP irq here because -- * doing it only when transferring the last two bytes -- * will mask NACK errors since TXCOMP is set when a -- * NACK occurs. -- */ -- at91_twi_write(dev, AT91_TWI_IER, -- AT91_TWI_TXCOMP); -- } else -+ } else { - at91_twi_write(dev, AT91_TWI_IER, -- AT91_TWI_TXCOMP | AT91_TWI_RXRDY); -+ AT91_TWI_TXCOMP | -+ AT91_TWI_NACK | -+ AT91_TWI_RXRDY); -+ } - } else { - if (dev->use_dma && (dev->buf_len > AT91_I2C_DMA_THRESHOLD)) { -+ at91_twi_write(dev, AT91_TWI_IER, AT91_TWI_NACK); - at91_twi_write_data_dma(dev); -- at91_twi_write(dev, AT91_TWI_IER, AT91_TWI_TXCOMP); - } else { - at91_twi_write_next_byte(dev); - at91_twi_write(dev, AT91_TWI_IER, -- AT91_TWI_TXCOMP | AT91_TWI_TXRDY); -+ AT91_TWI_TXCOMP | -+ AT91_TWI_NACK | -+ AT91_TWI_TXRDY); - } - } - -diff --git a/drivers/iio/dac/ad5624r_spi.c b/drivers/iio/dac/ad5624r_spi.c -index bb298aaff321..6deac5af1cfd 100644 ---- a/drivers/iio/dac/ad5624r_spi.c -+++ b/drivers/iio/dac/ad5624r_spi.c -@@ -22,7 +22,7 @@ - #include "ad5624r.h" - - static int ad5624r_spi_write(struct spi_device *spi, -- u8 cmd, u8 addr, u16 val, u8 len) -+ u8 cmd, u8 addr, u16 val, u8 shift) - { - u32 data; - u8 msg[3]; -@@ -35,7 +35,7 @@ static int ad5624r_spi_write(struct spi_device *spi, - * 14-, 12-bit input code followed by 0, 2, or 4 don't care bits, - * for the AD5664R, AD5644R, and AD5624R, respectively. - */ -- data = (0 << 22) | (cmd << 19) | (addr << 16) | (val << (16 - len)); -+ data = (0 << 22) | (cmd << 19) | (addr << 16) | (val << shift); - msg[0] = data >> 16; - msg[1] = data >> 8; - msg[2] = data; -diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c -index 8019e642d2f5..43aa807d78bd 100644 ---- a/drivers/infiniband/ulp/isert/ib_isert.c -+++ b/drivers/infiniband/ulp/isert/ib_isert.c -@@ -49,6 +49,8 @@ static int - isert_rdma_accept(struct isert_conn *isert_conn); - struct rdma_cm_id *isert_setup_id(struct isert_np *isert_np); - -+static void isert_release_work(struct work_struct *work); -+ - static void - isert_qp_event_callback(struct ib_event *e, void *context) - { -@@ -202,7 +204,7 @@ fail: - static void - isert_free_rx_descriptors(struct isert_conn *isert_conn) - { -- struct ib_device *ib_dev = isert_conn->conn_cm_id->device; -+ struct ib_device *ib_dev = isert_conn->conn_device->ib_device; - struct iser_rx_desc *rx_desc; - int i; - -@@ -432,6 +434,7 @@ isert_connect_request(struct rdma_cm_id *cma_id, struct rdma_cm_event *event) - init_completion(&isert_conn->conn_wait_comp_err); - kref_init(&isert_conn->conn_kref); - mutex_init(&isert_conn->conn_mutex); -+ INIT_WORK(&isert_conn->release_work, isert_release_work); - - isert_conn->conn_cm_id = cma_id; - isert_conn->responder_resources = event->param.conn.responder_resources; -@@ -527,14 +530,15 @@ out: - static void - isert_connect_release(struct isert_conn *isert_conn) - { -- struct ib_device *ib_dev = isert_conn->conn_cm_id->device; - struct isert_device *device = isert_conn->conn_device; - int cq_index; -+ struct ib_device *ib_dev = device->ib_device; - - pr_debug("Entering isert_connect_release(): >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n"); - - isert_free_rx_descriptors(isert_conn); -- rdma_destroy_id(isert_conn->conn_cm_id); -+ if (isert_conn->conn_cm_id) -+ rdma_destroy_id(isert_conn->conn_cm_id); - - if (isert_conn->conn_qp) { - cq_index = ((struct isert_cq_desc *) -@@ -673,6 +677,7 @@ isert_disconnected_handler(struct rdma_cm_id *cma_id, - { - struct isert_np *isert_np = cma_id->context; - struct isert_conn *isert_conn; -+ bool terminating = false; - - if (isert_np->np_cm_id == cma_id) - return isert_np_cma_handler(cma_id->context, event); -@@ -680,21 +685,37 @@ isert_disconnected_handler(struct rdma_cm_id *cma_id, - isert_conn = cma_id->qp->qp_context; - - mutex_lock(&isert_conn->conn_mutex); -+ terminating = (isert_conn->state == ISER_CONN_TERMINATING); - isert_conn_terminate(isert_conn); - mutex_unlock(&isert_conn->conn_mutex); - - pr_info("conn %p completing conn_wait\n", isert_conn); - complete(&isert_conn->conn_wait); - -+ if (terminating) -+ goto out; -+ -+ mutex_lock(&isert_np->np_accept_mutex); -+ if (!list_empty(&isert_conn->conn_accept_node)) { -+ list_del_init(&isert_conn->conn_accept_node); -+ isert_put_conn(isert_conn); -+ queue_work(isert_release_wq, &isert_conn->release_work); -+ } -+ mutex_unlock(&isert_np->np_accept_mutex); -+ -+out: - return 0; - } - --static void -+static int - isert_connect_error(struct rdma_cm_id *cma_id) - { - struct isert_conn *isert_conn = cma_id->qp->qp_context; - -+ isert_conn->conn_cm_id = NULL; - isert_put_conn(isert_conn); -+ -+ return -1; - } - - static int -@@ -724,7 +745,7 @@ isert_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *event) - case RDMA_CM_EVENT_REJECTED: /* FALLTHRU */ - case RDMA_CM_EVENT_UNREACHABLE: /* FALLTHRU */ - case RDMA_CM_EVENT_CONNECT_ERROR: -- isert_connect_error(cma_id); -+ ret = isert_connect_error(cma_id); - break; - default: - pr_err("Unhandled RDMA CMA event: %d\n", event->event); -@@ -2418,7 +2439,6 @@ static void isert_wait_conn(struct iscsi_conn *conn) - - wait_for_completion(&isert_conn->conn_wait_comp_err); - -- INIT_WORK(&isert_conn->release_work, isert_release_work); - queue_work(isert_release_wq, &isert_conn->release_work); - } - -diff --git a/drivers/md/md.c b/drivers/md/md.c -index aaf77b07bb72..631fe3e9c6e5 100644 ---- a/drivers/md/md.c -+++ b/drivers/md/md.c -@@ -6221,7 +6221,7 @@ static int update_array_info(struct mddev *mddev, mdu_array_info_t *info) - mddev->ctime != info->ctime || - mddev->level != info->level || - /* mddev->layout != info->layout || */ -- !mddev->persistent != info->not_persistent|| -+ mddev->persistent != !info->not_persistent || - mddev->chunk_sectors != info->chunk_size >> 9 || - /* ignore bottom 8 bits of state, and allow SB_BITMAP_PRESENT to change */ - ((state^info->state) & 0xfffffe00) -diff --git a/drivers/md/persistent-data/dm-btree-remove.c b/drivers/md/persistent-data/dm-btree-remove.c -index b88757cd0d1d..a03178e91a79 100644 ---- a/drivers/md/persistent-data/dm-btree-remove.c -+++ b/drivers/md/persistent-data/dm-btree-remove.c -@@ -309,8 +309,8 @@ static void redistribute3(struct dm_btree_info *info, struct btree_node *parent, - - if (s < 0 && nr_center < -s) { - /* not enough in central node */ -- shift(left, center, nr_center); -- s = nr_center - target; -+ shift(left, center, -nr_center); -+ s += nr_center; - shift(left, right, s); - nr_right += s; - } else -@@ -323,7 +323,7 @@ static void redistribute3(struct dm_btree_info *info, struct btree_node *parent, - if (s > 0 && nr_center < s) { - /* not enough in central node */ - shift(center, right, nr_center); -- s = target - nr_center; -+ s -= nr_center; - shift(left, right, s); - nr_left -= s; - } else -diff --git a/drivers/md/persistent-data/dm-btree.c b/drivers/md/persistent-data/dm-btree.c -index 0a7592e88811..e3ecb0b824b5 100644 ---- a/drivers/md/persistent-data/dm-btree.c -+++ b/drivers/md/persistent-data/dm-btree.c -@@ -240,7 +240,7 @@ int dm_btree_del(struct dm_btree_info *info, dm_block_t root) - int r; - struct del_stack *s; - -- s = kmalloc(sizeof(*s), GFP_KERNEL); -+ s = kmalloc(sizeof(*s), GFP_NOIO); - if (!s) - return -ENOMEM; - s->tm = info->tm; -diff --git a/drivers/media/dvb-frontends/af9013.c b/drivers/media/dvb-frontends/af9013.c -index fb504f1e9125..5930aee6b5d0 100644 ---- a/drivers/media/dvb-frontends/af9013.c -+++ b/drivers/media/dvb-frontends/af9013.c -@@ -606,6 +606,10 @@ static int af9013_set_frontend(struct dvb_frontend *fe) - } - } - -+ /* Return an error if can't find bandwidth or the right clock */ -+ if (i == ARRAY_SIZE(coeff_lut)) -+ return -EINVAL; -+ - ret = af9013_wr_regs(state, 0xae00, coeff_lut[i].val, - sizeof(coeff_lut[i].val)); - } -diff --git a/drivers/media/dvb-frontends/cx24116.c b/drivers/media/dvb-frontends/cx24116.c -index 2916d7c74a1d..7bc68b355c0b 100644 ---- a/drivers/media/dvb-frontends/cx24116.c -+++ b/drivers/media/dvb-frontends/cx24116.c -@@ -963,6 +963,10 @@ static int cx24116_send_diseqc_msg(struct dvb_frontend *fe, - struct cx24116_state *state = fe->demodulator_priv; - int i, ret; - -+ /* Validate length */ -+ if (d->msg_len > sizeof(d->msg)) -+ return -EINVAL; -+ - /* Dump DiSEqC message */ - if (debug) { - printk(KERN_INFO "cx24116: %s(", __func__); -@@ -974,10 +978,6 @@ static int cx24116_send_diseqc_msg(struct dvb_frontend *fe, - printk(") toneburst=%d\n", toneburst); - } - -- /* Validate length */ -- if (d->msg_len > (CX24116_ARGLEN - CX24116_DISEQC_MSGOFS)) -- return -EINVAL; -- - /* DiSEqC message */ - for (i = 0; i < d->msg_len; i++) - state->dsec_cmd.args[CX24116_DISEQC_MSGOFS + i] = d->msg[i]; -diff --git a/drivers/media/dvb-frontends/s5h1420.c b/drivers/media/dvb-frontends/s5h1420.c -index 93eeaf7118fd..0b4f8fe6bf99 100644 ---- a/drivers/media/dvb-frontends/s5h1420.c -+++ b/drivers/media/dvb-frontends/s5h1420.c -@@ -180,7 +180,7 @@ static int s5h1420_send_master_cmd (struct dvb_frontend* fe, - int result = 0; - - dprintk("enter %s\n", __func__); -- if (cmd->msg_len > 8) -+ if (cmd->msg_len > sizeof(cmd->msg)) - return -EINVAL; - - /* setup for DISEQC */ -diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c -index 56998eca1a8d..885ba4a19a6c 100644 ---- a/drivers/mmc/card/block.c -+++ b/drivers/mmc/card/block.c -@@ -202,6 +202,8 @@ static ssize_t power_ro_lock_show(struct device *dev, - - ret = snprintf(buf, PAGE_SIZE, "%d\n", locked); - -+ mmc_blk_put(md); -+ - return ret; - } - -@@ -1833,9 +1835,11 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *rqc) - break; - case MMC_BLK_CMD_ERR: - ret = mmc_blk_cmd_err(md, card, brq, req, ret); -- if (!mmc_blk_reset(md, card->host, type)) -- break; -- goto cmd_abort; -+ if (mmc_blk_reset(md, card->host, type)) -+ goto cmd_abort; -+ if (!ret) -+ goto start_new_req; -+ break; - case MMC_BLK_RETRY: - if (retry++ < 5) - break; -diff --git a/drivers/mtd/maps/dc21285.c b/drivers/mtd/maps/dc21285.c -index f8a7dd14cee0..70a3db3ab856 100644 ---- a/drivers/mtd/maps/dc21285.c -+++ b/drivers/mtd/maps/dc21285.c -@@ -38,9 +38,9 @@ static void nw_en_write(void) - * we want to write a bit pattern XXX1 to Xilinx to enable - * the write gate, which will be open for about the next 2ms. - */ -- spin_lock_irqsave(&nw_gpio_lock, flags); -+ raw_spin_lock_irqsave(&nw_gpio_lock, flags); - nw_cpld_modify(CPLD_FLASH_WR_ENABLE, CPLD_FLASH_WR_ENABLE); -- spin_unlock_irqrestore(&nw_gpio_lock, flags); -+ raw_spin_unlock_irqrestore(&nw_gpio_lock, flags); - - /* - * let the ISA bus to catch on... -diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c -index 5073cbc796d8..32d5e40c6863 100644 ---- a/drivers/mtd/mtd_blkdevs.c -+++ b/drivers/mtd/mtd_blkdevs.c -@@ -199,6 +199,7 @@ static int blktrans_open(struct block_device *bdev, fmode_t mode) - return -ERESTARTSYS; /* FIXME: busy loop! -arnd*/ - - mutex_lock(&dev->lock); -+ mutex_lock(&mtd_table_mutex); - - if (dev->open) - goto unlock; -@@ -222,6 +223,7 @@ static int blktrans_open(struct block_device *bdev, fmode_t mode) - - unlock: - dev->open++; -+ mutex_unlock(&mtd_table_mutex); - mutex_unlock(&dev->lock); - blktrans_dev_put(dev); - return ret; -@@ -232,6 +234,7 @@ error_release: - error_put: - module_put(dev->tr->owner); - kref_put(&dev->ref, blktrans_dev_release); -+ mutex_unlock(&mtd_table_mutex); - mutex_unlock(&dev->lock); - blktrans_dev_put(dev); - return ret; -@@ -245,6 +248,7 @@ static void blktrans_release(struct gendisk *disk, fmode_t mode) - return; - - mutex_lock(&dev->lock); -+ mutex_lock(&mtd_table_mutex); - - if (--dev->open) - goto unlock; -@@ -258,6 +262,7 @@ static void blktrans_release(struct gendisk *disk, fmode_t mode) - __put_mtd_device(dev->mtd); - } - unlock: -+ mutex_unlock(&mtd_table_mutex); - mutex_unlock(&dev->lock); - blktrans_dev_put(dev); - } -diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c -index 82a1b5b16b62..c7f23d271058 100644 ---- a/drivers/net/wireless/ath/ath9k/main.c -+++ b/drivers/net/wireless/ath/ath9k/main.c -@@ -195,11 +195,13 @@ static bool ath_prepare_reset(struct ath_softc *sc) - ath9k_debug_samp_bb_mac(sc); - ath9k_hw_disable_interrupts(ah); - -- if (!ath_drain_all_txq(sc)) -- ret = false; -- -- if (!ath_stoprecv(sc)) -- ret = false; -+ if (AR_SREV_9300_20_OR_LATER(ah)) { -+ ret &= ath_stoprecv(sc); -+ ret &= ath_drain_all_txq(sc); -+ } else { -+ ret &= ath_drain_all_txq(sc); -+ ret &= ath_stoprecv(sc); -+ } - - return ret; - } -diff --git a/drivers/pcmcia/topic.h b/drivers/pcmcia/topic.h -index 615a45a8fe86..582688fe7505 100644 ---- a/drivers/pcmcia/topic.h -+++ b/drivers/pcmcia/topic.h -@@ -104,6 +104,9 @@ - #define TOPIC_EXCA_IF_CONTROL 0x3e /* 8 bit */ - #define TOPIC_EXCA_IFC_33V_ENA 0x01 - -+#define TOPIC_PCI_CFG_PPBCN 0x3e /* 16-bit */ -+#define TOPIC_PCI_CFG_PPBCN_WBEN 0x0400 -+ - static void topic97_zoom_video(struct pcmcia_socket *sock, int onoff) - { - struct yenta_socket *socket = container_of(sock, struct yenta_socket, socket); -@@ -138,6 +141,7 @@ static int topic97_override(struct yenta_socket *socket) - static int topic95_override(struct yenta_socket *socket) - { - u8 fctrl; -+ u16 ppbcn; - - /* enable 3.3V support for 16bit cards */ - fctrl = exca_readb(socket, TOPIC_EXCA_IF_CONTROL); -@@ -146,6 +150,18 @@ static int topic95_override(struct yenta_socket *socket) - /* tell yenta to use exca registers to power 16bit cards */ - socket->flags |= YENTA_16BIT_POWER_EXCA | YENTA_16BIT_POWER_DF; - -+ /* Disable write buffers to prevent lockups under load with numerous -+ Cardbus cards, observed on Tecra 500CDT and reported elsewhere on the -+ net. This is not a power-on default according to the datasheet -+ but some BIOSes seem to set it. */ -+ if (pci_read_config_word(socket->dev, TOPIC_PCI_CFG_PPBCN, &ppbcn) == 0 -+ && socket->dev->revision <= 7 -+ && (ppbcn & TOPIC_PCI_CFG_PPBCN_WBEN)) { -+ ppbcn &= ~TOPIC_PCI_CFG_PPBCN_WBEN; -+ pci_write_config_word(socket->dev, TOPIC_PCI_CFG_PPBCN, ppbcn); -+ dev_info(&socket->dev->dev, "Disabled ToPIC95 Cardbus write buffers.\n"); -+ } -+ - return 0; - } - -diff --git a/drivers/pinctrl/mvebu/pinctrl-armada-370.c b/drivers/pinctrl/mvebu/pinctrl-armada-370.c -index 48e21a229483..c99e64ac8e08 100644 ---- a/drivers/pinctrl/mvebu/pinctrl-armada-370.c -+++ b/drivers/pinctrl/mvebu/pinctrl-armada-370.c -@@ -358,11 +358,11 @@ static struct mvebu_mpp_mode mv88f6710_mpp_modes[] = { - MPP_MODE(64, - MPP_FUNCTION(0x0, "gpio", NULL), - MPP_FUNCTION(0x1, "spi0", "miso"), -- MPP_FUNCTION(0x2, "spi0-1", "cs1")), -+ MPP_FUNCTION(0x2, "spi0", "cs1")), - MPP_MODE(65, - MPP_FUNCTION(0x0, "gpio", NULL), - MPP_FUNCTION(0x1, "spi0", "mosi"), -- MPP_FUNCTION(0x2, "spi0-1", "cs2")), -+ MPP_FUNCTION(0x2, "spi0", "cs2")), - }; - - static struct mvebu_pinctrl_soc_info armada_370_pinctrl_info; -diff --git a/drivers/pinctrl/mvebu/pinctrl-armada-xp.c b/drivers/pinctrl/mvebu/pinctrl-armada-xp.c -index ab5dc04b3e8a..5923a9ef70cc 100644 ---- a/drivers/pinctrl/mvebu/pinctrl-armada-xp.c -+++ b/drivers/pinctrl/mvebu/pinctrl-armada-xp.c -@@ -14,10 +14,7 @@ - * available: mv78230, mv78260 and mv78460. From a pin muxing - * perspective, the mv78230 has 49 MPP pins. The mv78260 and mv78460 - * both have 67 MPP pins (more GPIOs and address lines for the memory -- * bus mainly). The only difference between the mv78260 and the -- * mv78460 in terms of pin muxing is the addition of two functions on -- * pins 43 and 56 to access the VDD of the CPU2 and 3 (mv78260 has two -- * cores, mv78460 has four cores). -+ * bus mainly). - */ - - #include -@@ -159,20 +156,17 @@ static struct mvebu_mpp_mode armada_xp_mpp_modes[] = { - MPP_MODE(24, - MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), - MPP_VAR_FUNCTION(0x1, "sata1", "prsnt", V_MV78230_PLUS), -- MPP_VAR_FUNCTION(0x2, "nf", "bootcs-re", V_MV78230_PLUS), - MPP_VAR_FUNCTION(0x3, "tdm", "rst", V_MV78230_PLUS), - MPP_VAR_FUNCTION(0x4, "lcd", "hsync", V_MV78230_PLUS)), - MPP_MODE(25, - MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), - MPP_VAR_FUNCTION(0x1, "sata0", "prsnt", V_MV78230_PLUS), -- MPP_VAR_FUNCTION(0x2, "nf", "bootcs-we", V_MV78230_PLUS), - MPP_VAR_FUNCTION(0x3, "tdm", "pclk", V_MV78230_PLUS), - MPP_VAR_FUNCTION(0x4, "lcd", "vsync", V_MV78230_PLUS)), - MPP_MODE(26, - MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), - MPP_VAR_FUNCTION(0x3, "tdm", "fsync", V_MV78230_PLUS), -- MPP_VAR_FUNCTION(0x4, "lcd", "clk", V_MV78230_PLUS), -- MPP_VAR_FUNCTION(0x5, "vdd", "cpu1-pd", V_MV78230_PLUS)), -+ MPP_VAR_FUNCTION(0x4, "lcd", "clk", V_MV78230_PLUS)), - MPP_MODE(27, - MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), - MPP_VAR_FUNCTION(0x1, "ptp", "trig", V_MV78230_PLUS), -@@ -187,8 +181,7 @@ static struct mvebu_mpp_mode armada_xp_mpp_modes[] = { - MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), - MPP_VAR_FUNCTION(0x1, "ptp", "clk", V_MV78230_PLUS), - MPP_VAR_FUNCTION(0x3, "tdm", "int0", V_MV78230_PLUS), -- MPP_VAR_FUNCTION(0x4, "lcd", "ref-clk", V_MV78230_PLUS), -- MPP_VAR_FUNCTION(0x5, "vdd", "cpu0-pd", V_MV78230_PLUS)), -+ MPP_VAR_FUNCTION(0x4, "lcd", "ref-clk", V_MV78230_PLUS)), - MPP_MODE(30, - MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), - MPP_VAR_FUNCTION(0x1, "sd0", "clk", V_MV78230_PLUS), -@@ -196,13 +189,11 @@ static struct mvebu_mpp_mode armada_xp_mpp_modes[] = { - MPP_MODE(31, - MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), - MPP_VAR_FUNCTION(0x1, "sd0", "cmd", V_MV78230_PLUS), -- MPP_VAR_FUNCTION(0x3, "tdm", "int2", V_MV78230_PLUS), -- MPP_VAR_FUNCTION(0x5, "vdd", "cpu0-pd", V_MV78230_PLUS)), -+ MPP_VAR_FUNCTION(0x3, "tdm", "int2", V_MV78230_PLUS)), - MPP_MODE(32, - MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), - MPP_VAR_FUNCTION(0x1, "sd0", "d0", V_MV78230_PLUS), -- MPP_VAR_FUNCTION(0x3, "tdm", "int3", V_MV78230_PLUS), -- MPP_VAR_FUNCTION(0x5, "vdd", "cpu1-pd", V_MV78230_PLUS)), -+ MPP_VAR_FUNCTION(0x3, "tdm", "int3", V_MV78230_PLUS)), - MPP_MODE(33, - MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), - MPP_VAR_FUNCTION(0x1, "sd0", "d1", V_MV78230_PLUS), -@@ -234,7 +225,6 @@ static struct mvebu_mpp_mode armada_xp_mpp_modes[] = { - MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), - MPP_VAR_FUNCTION(0x1, "spi", "cs1", V_MV78230_PLUS), - MPP_VAR_FUNCTION(0x2, "uart2", "cts", V_MV78230_PLUS), -- MPP_VAR_FUNCTION(0x3, "vdd", "cpu1-pd", V_MV78230_PLUS), - MPP_VAR_FUNCTION(0x4, "lcd", "vga-hsync", V_MV78230_PLUS), - MPP_VAR_FUNCTION(0x5, "pcie", "clkreq0", V_MV78230_PLUS)), - MPP_MODE(41, -@@ -249,15 +239,13 @@ static struct mvebu_mpp_mode armada_xp_mpp_modes[] = { - MPP_VAR_FUNCTION(0x1, "uart2", "rxd", V_MV78230_PLUS), - MPP_VAR_FUNCTION(0x2, "uart0", "cts", V_MV78230_PLUS), - MPP_VAR_FUNCTION(0x3, "tdm", "int7", V_MV78230_PLUS), -- MPP_VAR_FUNCTION(0x4, "tdm-1", "timer", V_MV78230_PLUS), -- MPP_VAR_FUNCTION(0x5, "vdd", "cpu0-pd", V_MV78230_PLUS)), -+ MPP_VAR_FUNCTION(0x4, "tdm-1", "timer", V_MV78230_PLUS)), - MPP_MODE(43, - MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), - MPP_VAR_FUNCTION(0x1, "uart2", "txd", V_MV78230_PLUS), - MPP_VAR_FUNCTION(0x2, "uart0", "rts", V_MV78230_PLUS), - MPP_VAR_FUNCTION(0x3, "spi", "cs3", V_MV78230_PLUS), -- MPP_VAR_FUNCTION(0x4, "pcie", "rstout", V_MV78230_PLUS), -- MPP_VAR_FUNCTION(0x5, "vdd", "cpu2-3-pd", V_MV78460)), -+ MPP_VAR_FUNCTION(0x4, "pcie", "rstout", V_MV78230_PLUS)), - MPP_MODE(44, - MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), - MPP_VAR_FUNCTION(0x1, "uart2", "cts", V_MV78230_PLUS), -@@ -286,7 +274,7 @@ static struct mvebu_mpp_mode armada_xp_mpp_modes[] = { - MPP_VAR_FUNCTION(0x5, "pcie", "clkreq3", V_MV78230_PLUS)), - MPP_MODE(48, - MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78230_PLUS), -- MPP_VAR_FUNCTION(0x1, "tclk", NULL, V_MV78230_PLUS), -+ MPP_VAR_FUNCTION(0x1, "dev", "clkout", V_MV78230_PLUS), - MPP_VAR_FUNCTION(0x2, "dev", "burst/last", V_MV78230_PLUS)), - MPP_MODE(49, - MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), -@@ -308,16 +296,13 @@ static struct mvebu_mpp_mode armada_xp_mpp_modes[] = { - MPP_VAR_FUNCTION(0x1, "dev", "ad19", V_MV78260_PLUS)), - MPP_MODE(55, - MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), -- MPP_VAR_FUNCTION(0x1, "dev", "ad20", V_MV78260_PLUS), -- MPP_VAR_FUNCTION(0x2, "vdd", "cpu0-pd", V_MV78260_PLUS)), -+ MPP_VAR_FUNCTION(0x1, "dev", "ad20", V_MV78260_PLUS)), - MPP_MODE(56, - MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), -- MPP_VAR_FUNCTION(0x1, "dev", "ad21", V_MV78260_PLUS), -- MPP_VAR_FUNCTION(0x2, "vdd", "cpu1-pd", V_MV78260_PLUS)), -+ MPP_VAR_FUNCTION(0x1, "dev", "ad21", V_MV78260_PLUS)), - MPP_MODE(57, - MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), -- MPP_VAR_FUNCTION(0x1, "dev", "ad22", V_MV78260_PLUS), -- MPP_VAR_FUNCTION(0x2, "vdd", "cpu2-3-pd", V_MV78460)), -+ MPP_VAR_FUNCTION(0x1, "dev", "ad22", V_MV78260_PLUS)), - MPP_MODE(58, - MPP_VAR_FUNCTION(0x0, "gpio", NULL, V_MV78260_PLUS), - MPP_VAR_FUNCTION(0x1, "dev", "ad23", V_MV78260_PLUS)), -diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c -index 283212aa103c..70ccc2010054 100644 ---- a/drivers/regulator/core.c -+++ b/drivers/regulator/core.c -@@ -769,7 +769,7 @@ static int suspend_prepare(struct regulator_dev *rdev, suspend_state_t state) - static void print_constraints(struct regulator_dev *rdev) - { - struct regulation_constraints *constraints = rdev->constraints; -- char buf[80] = ""; -+ char buf[160] = ""; - int count = 0; - int ret; - -diff --git a/drivers/scsi/ipr.h b/drivers/scsi/ipr.h -index 535f57328a72..c19911554036 100644 ---- a/drivers/scsi/ipr.h -+++ b/drivers/scsi/ipr.h -@@ -257,7 +257,7 @@ - #define IPR_RUNTIME_RESET 0x40000000 - - #define IPR_IPL_INIT_MIN_STAGE_TIME 5 --#define IPR_IPL_INIT_DEFAULT_STAGE_TIME 15 -+#define IPR_IPL_INIT_DEFAULT_STAGE_TIME 30 - #define IPR_IPL_INIT_STAGE_UNKNOWN 0x0 - #define IPR_IPL_INIT_STAGE_TRANSOP 0xB0000000 - #define IPR_IPL_INIT_STAGE_MASK 0xff000000 -diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c -index d2a4c75e5b8f..813e9d8ba351 100644 ---- a/drivers/scsi/qla2xxx/qla_isr.c -+++ b/drivers/scsi/qla2xxx/qla_isr.c -@@ -523,8 +523,9 @@ qla2x00_async_event(scsi_qla_host_t *vha, struct rsp_que *rsp, uint16_t *mb) - struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; - struct device_reg_24xx __iomem *reg24 = &ha->iobase->isp24; - struct device_reg_82xx __iomem *reg82 = &ha->iobase->isp82; -- uint32_t rscn_entry, host_pid; -+ uint32_t rscn_entry, host_pid, tmp_pid; - unsigned long flags; -+ fc_port_t *fcport = NULL; - - /* Setup to process RIO completion. */ - handle_cnt = 0; -@@ -918,6 +919,20 @@ skip_rio: - if (qla2x00_is_a_vp_did(vha, rscn_entry)) - break; - -+ /* -+ * Search for the rport related to this RSCN entry and mark it -+ * as lost. -+ */ -+ list_for_each_entry(fcport, &vha->vp_fcports, list) { -+ if (atomic_read(&fcport->state) != FCS_ONLINE) -+ continue; -+ tmp_pid = fcport->d_id.b24; -+ if (fcport->d_id.b24 == rscn_entry) { -+ qla2x00_mark_device_lost(vha, fcport, 0, 0); -+ break; -+ } -+ } -+ - atomic_set(&vha->loop_down_timer, 0); - vha->flags.management_server_logged_in = 0; - -diff --git a/drivers/staging/rtl8712/rtl8712_recv.c b/drivers/staging/rtl8712/rtl8712_recv.c -index d59a74aa3048..4b25f3afb8dc 100644 ---- a/drivers/staging/rtl8712/rtl8712_recv.c -+++ b/drivers/staging/rtl8712/rtl8712_recv.c -@@ -1075,7 +1075,8 @@ static int recvbuf2recvframe(struct _adapter *padapter, struct sk_buff *pskb) - /* for first fragment packet, driver need allocate 1536 + - * drvinfo_sz + RXDESC_SIZE to defrag packet. */ - if ((mf == 1) && (frag == 0)) -- alloc_sz = 1658;/*1658+6=1664, 1664 is 128 alignment.*/ -+ /*1658+6=1664, 1664 is 128 alignment.*/ -+ alloc_sz = max_t(u16, tmp_len, 1658); - else - alloc_sz = tmp_len; - /* 2 is for IP header 4 bytes alignment in QoS packet case. -diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c -index 5a3ea20e9cb5..3c293ad6ae70 100644 ---- a/drivers/target/iscsi/iscsi_target.c -+++ b/drivers/target/iscsi/iscsi_target.c -@@ -518,7 +518,7 @@ static struct iscsit_transport iscsi_target_transport = { - - static int __init iscsi_target_init_module(void) - { -- int ret = 0; -+ int ret = 0, size; - - pr_debug("iSCSI-Target "ISCSIT_VERSION"\n"); - -@@ -527,6 +527,7 @@ static int __init iscsi_target_init_module(void) - pr_err("Unable to allocate memory for iscsit_global\n"); - return -1; - } -+ spin_lock_init(&iscsit_global->ts_bitmap_lock); - mutex_init(&auth_id_lock); - spin_lock_init(&sess_idr_lock); - idr_init(&tiqn_idr); -@@ -536,15 +537,11 @@ static int __init iscsi_target_init_module(void) - if (ret < 0) - goto out; - -- ret = iscsi_thread_set_init(); -- if (ret < 0) -+ size = BITS_TO_LONGS(ISCSIT_BITMAP_BITS) * sizeof(long); -+ iscsit_global->ts_bitmap = vzalloc(size); -+ if (!iscsit_global->ts_bitmap) { -+ pr_err("Unable to allocate iscsit_global->ts_bitmap\n"); - goto configfs_out; -- -- if (iscsi_allocate_thread_sets(TARGET_THREAD_SET_COUNT) != -- TARGET_THREAD_SET_COUNT) { -- pr_err("iscsi_allocate_thread_sets() returned" -- " unexpected value!\n"); -- goto ts_out1; - } - - lio_cmd_cache = kmem_cache_create("lio_cmd_cache", -@@ -553,7 +550,7 @@ static int __init iscsi_target_init_module(void) - if (!lio_cmd_cache) { - pr_err("Unable to kmem_cache_create() for" - " lio_cmd_cache\n"); -- goto ts_out2; -+ goto bitmap_out; - } - - lio_qr_cache = kmem_cache_create("lio_qr_cache", -@@ -608,10 +605,8 @@ qr_out: - kmem_cache_destroy(lio_qr_cache); - cmd_out: - kmem_cache_destroy(lio_cmd_cache); --ts_out2: -- iscsi_deallocate_thread_sets(); --ts_out1: -- iscsi_thread_set_free(); -+bitmap_out: -+ vfree(iscsit_global->ts_bitmap); - configfs_out: - iscsi_target_deregister_configfs(); - out: -@@ -621,8 +616,6 @@ out: - - static void __exit iscsi_target_cleanup_module(void) - { -- iscsi_deallocate_thread_sets(); -- iscsi_thread_set_free(); - iscsit_release_discovery_tpg(); - iscsit_unregister_transport(&iscsi_target_transport); - kmem_cache_destroy(lio_cmd_cache); -@@ -633,6 +626,7 @@ static void __exit iscsi_target_cleanup_module(void) - - iscsi_target_deregister_configfs(); - -+ vfree(iscsit_global->ts_bitmap); - kfree(iscsit_global); - } - -@@ -3590,17 +3584,16 @@ static int iscsit_send_reject( - - void iscsit_thread_get_cpumask(struct iscsi_conn *conn) - { -- struct iscsi_thread_set *ts = conn->thread_set; - int ord, cpu; - /* -- * thread_id is assigned from iscsit_global->ts_bitmap from -- * within iscsi_thread_set.c:iscsi_allocate_thread_sets() -+ * bitmap_id is assigned from iscsit_global->ts_bitmap from -+ * within iscsit_start_kthreads() - * -- * Here we use thread_id to determine which CPU that this -- * iSCSI connection's iscsi_thread_set will be scheduled to -+ * Here we use bitmap_id to determine which CPU that this -+ * iSCSI connection's RX/TX threads will be scheduled to - * execute upon. - */ -- ord = ts->thread_id % cpumask_weight(cpu_online_mask); -+ ord = conn->bitmap_id % cpumask_weight(cpu_online_mask); - for_each_online_cpu(cpu) { - if (ord-- == 0) { - cpumask_set_cpu(cpu, conn->conn_cpumask); -@@ -3792,7 +3785,7 @@ check_rsp_state: - switch (state) { - case ISTATE_SEND_LOGOUTRSP: - if (!iscsit_logout_post_handler(cmd, conn)) -- goto restart; -+ return -ECONNRESET; - /* fall through */ - case ISTATE_SEND_STATUS: - case ISTATE_SEND_ASYNCMSG: -@@ -3820,8 +3813,6 @@ check_rsp_state: - - err: - return -1; --restart: -- return -EAGAIN; - } - - static int iscsit_handle_response_queue(struct iscsi_conn *conn) -@@ -3848,21 +3839,13 @@ static int iscsit_handle_response_queue(struct iscsi_conn *conn) - int iscsi_target_tx_thread(void *arg) - { - int ret = 0; -- struct iscsi_conn *conn; -- struct iscsi_thread_set *ts = arg; -+ struct iscsi_conn *conn = arg; - /* - * Allow ourselves to be interrupted by SIGINT so that a - * connection recovery / failure event can be triggered externally. - */ - allow_signal(SIGINT); - --restart: -- conn = iscsi_tx_thread_pre_handler(ts); -- if (!conn) -- goto out; -- -- ret = 0; -- - while (!kthread_should_stop()) { - /* - * Ensure that both TX and RX per connection kthreads -@@ -3871,11 +3854,9 @@ restart: - iscsit_thread_check_cpumask(conn, current, 1); - - wait_event_interruptible(conn->queues_wq, -- !iscsit_conn_all_queues_empty(conn) || -- ts->status == ISCSI_THREAD_SET_RESET); -+ !iscsit_conn_all_queues_empty(conn)); - -- if ((ts->status == ISCSI_THREAD_SET_RESET) || -- signal_pending(current)) -+ if (signal_pending(current)) - goto transport_err; - - get_immediate: -@@ -3886,15 +3867,14 @@ get_immediate: - ret = iscsit_handle_response_queue(conn); - if (ret == 1) - goto get_immediate; -- else if (ret == -EAGAIN) -- goto restart; -+ else if (ret == -ECONNRESET) -+ goto out; - else if (ret < 0) - goto transport_err; - } - - transport_err: - iscsit_take_action_for_connection_exit(conn); -- goto restart; - out: - return 0; - } -@@ -3979,8 +3959,7 @@ int iscsi_target_rx_thread(void *arg) - int ret; - u8 buffer[ISCSI_HDR_LEN], opcode; - u32 checksum = 0, digest = 0; -- struct iscsi_conn *conn = NULL; -- struct iscsi_thread_set *ts = arg; -+ struct iscsi_conn *conn = arg; - struct kvec iov; - /* - * Allow ourselves to be interrupted by SIGINT so that a -@@ -3988,11 +3967,6 @@ int iscsi_target_rx_thread(void *arg) - */ - allow_signal(SIGINT); - --restart: -- conn = iscsi_rx_thread_pre_handler(ts); -- if (!conn) -- goto out; -- - if (conn->conn_transport->transport_type == ISCSI_INFINIBAND) { - struct completion comp; - int rc; -@@ -4002,7 +3976,7 @@ restart: - if (rc < 0) - goto transport_err; - -- goto out; -+ goto transport_err; - } - - while (!kthread_should_stop()) { -@@ -4085,8 +4059,6 @@ transport_err: - if (!signal_pending(current)) - atomic_set(&conn->transport_failed, 1); - iscsit_take_action_for_connection_exit(conn); -- goto restart; --out: - return 0; - } - -@@ -4148,7 +4120,24 @@ int iscsit_close_connection( - if (conn->conn_transport->transport_type == ISCSI_TCP) - complete(&conn->conn_logout_comp); - -- iscsi_release_thread_set(conn); -+ if (!strcmp(current->comm, ISCSI_RX_THREAD_NAME)) { -+ if (conn->tx_thread && -+ cmpxchg(&conn->tx_thread_active, true, false)) { -+ send_sig(SIGINT, conn->tx_thread, 1); -+ kthread_stop(conn->tx_thread); -+ } -+ } else if (!strcmp(current->comm, ISCSI_TX_THREAD_NAME)) { -+ if (conn->rx_thread && -+ cmpxchg(&conn->rx_thread_active, true, false)) { -+ send_sig(SIGINT, conn->rx_thread, 1); -+ kthread_stop(conn->rx_thread); -+ } -+ } -+ -+ spin_lock(&iscsit_global->ts_bitmap_lock); -+ bitmap_release_region(iscsit_global->ts_bitmap, conn->bitmap_id, -+ get_order(1)); -+ spin_unlock(&iscsit_global->ts_bitmap_lock); - - iscsit_stop_timers_for_cmds(conn); - iscsit_stop_nopin_response_timer(conn); -@@ -4427,15 +4416,13 @@ static void iscsit_logout_post_handler_closesession( - struct iscsi_conn *conn) - { - struct iscsi_session *sess = conn->sess; -- -- iscsi_set_thread_clear(conn, ISCSI_CLEAR_TX_THREAD); -- iscsi_set_thread_set_signal(conn, ISCSI_SIGNAL_TX_THREAD); -+ int sleep = cmpxchg(&conn->tx_thread_active, true, false); - - atomic_set(&conn->conn_logout_remove, 0); - complete(&conn->conn_logout_comp); - - iscsit_dec_conn_usage_count(conn); -- iscsit_stop_session(sess, 1, 1); -+ iscsit_stop_session(sess, sleep, sleep); - iscsit_dec_session_usage_count(sess); - target_put_session(sess->se_sess); - } -@@ -4443,13 +4430,12 @@ static void iscsit_logout_post_handler_closesession( - static void iscsit_logout_post_handler_samecid( - struct iscsi_conn *conn) - { -- iscsi_set_thread_clear(conn, ISCSI_CLEAR_TX_THREAD); -- iscsi_set_thread_set_signal(conn, ISCSI_SIGNAL_TX_THREAD); -+ int sleep = cmpxchg(&conn->tx_thread_active, true, false); - - atomic_set(&conn->conn_logout_remove, 0); - complete(&conn->conn_logout_comp); - -- iscsit_cause_connection_reinstatement(conn, 1); -+ iscsit_cause_connection_reinstatement(conn, sleep); - iscsit_dec_conn_usage_count(conn); - } - -diff --git a/drivers/target/iscsi/iscsi_target_core.h b/drivers/target/iscsi/iscsi_target_core.h -index e117870eb445..815bf5b1a4ae 100644 ---- a/drivers/target/iscsi/iscsi_target_core.h -+++ b/drivers/target/iscsi/iscsi_target_core.h -@@ -586,6 +586,11 @@ struct iscsi_conn { - struct iscsi_session *sess; - /* Pointer to thread_set in use for this conn's threads */ - struct iscsi_thread_set *thread_set; -+ int bitmap_id; -+ int rx_thread_active; -+ struct task_struct *rx_thread; -+ int tx_thread_active; -+ struct task_struct *tx_thread; - /* list_head for session connection list */ - struct list_head conn_list; - } ____cacheline_aligned; -@@ -862,10 +867,12 @@ struct iscsit_global { - /* Unique identifier used for the authentication daemon */ - u32 auth_id; - u32 inactive_ts; -+#define ISCSIT_BITMAP_BITS 262144 - /* Thread Set bitmap count */ - int ts_bitmap_count; - /* Thread Set bitmap pointer */ - unsigned long *ts_bitmap; -+ spinlock_t ts_bitmap_lock; - /* Used for iSCSI discovery session authentication */ - struct iscsi_node_acl discovery_acl; - struct iscsi_portal_group *discovery_tpg; -diff --git a/drivers/target/iscsi/iscsi_target_erl0.c b/drivers/target/iscsi/iscsi_target_erl0.c -index 08bd87833321..fab67eea54c0 100644 ---- a/drivers/target/iscsi/iscsi_target_erl0.c -+++ b/drivers/target/iscsi/iscsi_target_erl0.c -@@ -866,7 +866,10 @@ void iscsit_connection_reinstatement_rcfr(struct iscsi_conn *conn) - } - spin_unlock_bh(&conn->state_lock); - -- iscsi_thread_set_force_reinstatement(conn); -+ if (conn->tx_thread && conn->tx_thread_active) -+ send_sig(SIGINT, conn->tx_thread, 1); -+ if (conn->rx_thread && conn->rx_thread_active) -+ send_sig(SIGINT, conn->rx_thread, 1); - - sleep: - wait_for_completion(&conn->conn_wait_rcfr_comp); -@@ -891,10 +894,10 @@ void iscsit_cause_connection_reinstatement(struct iscsi_conn *conn, int sleep) - return; - } - -- if (iscsi_thread_set_force_reinstatement(conn) < 0) { -- spin_unlock_bh(&conn->state_lock); -- return; -- } -+ if (conn->tx_thread && conn->tx_thread_active) -+ send_sig(SIGINT, conn->tx_thread, 1); -+ if (conn->rx_thread && conn->rx_thread_active) -+ send_sig(SIGINT, conn->rx_thread, 1); - - atomic_set(&conn->connection_reinstatement, 1); - if (!sleep) { -diff --git a/drivers/target/iscsi/iscsi_target_login.c b/drivers/target/iscsi/iscsi_target_login.c -index 0493e8b1ba8f..797b2e2acc35 100644 ---- a/drivers/target/iscsi/iscsi_target_login.c -+++ b/drivers/target/iscsi/iscsi_target_login.c -@@ -683,7 +683,52 @@ static void iscsi_post_login_start_timers(struct iscsi_conn *conn) - iscsit_start_nopin_timer(conn); - } - --static int iscsi_post_login_handler( -+int iscsit_start_kthreads(struct iscsi_conn *conn) -+{ -+ int ret = 0; -+ -+ spin_lock(&iscsit_global->ts_bitmap_lock); -+ conn->bitmap_id = bitmap_find_free_region(iscsit_global->ts_bitmap, -+ ISCSIT_BITMAP_BITS, get_order(1)); -+ spin_unlock(&iscsit_global->ts_bitmap_lock); -+ -+ if (conn->bitmap_id < 0) { -+ pr_err("bitmap_find_free_region() failed for" -+ " iscsit_start_kthreads()\n"); -+ return -ENOMEM; -+ } -+ -+ conn->tx_thread = kthread_run(iscsi_target_tx_thread, conn, -+ "%s", ISCSI_TX_THREAD_NAME); -+ if (IS_ERR(conn->tx_thread)) { -+ pr_err("Unable to start iscsi_target_tx_thread\n"); -+ ret = PTR_ERR(conn->tx_thread); -+ goto out_bitmap; -+ } -+ conn->tx_thread_active = true; -+ -+ conn->rx_thread = kthread_run(iscsi_target_rx_thread, conn, -+ "%s", ISCSI_RX_THREAD_NAME); -+ if (IS_ERR(conn->rx_thread)) { -+ pr_err("Unable to start iscsi_target_rx_thread\n"); -+ ret = PTR_ERR(conn->rx_thread); -+ goto out_tx; -+ } -+ conn->rx_thread_active = true; -+ -+ return 0; -+out_tx: -+ kthread_stop(conn->tx_thread); -+ conn->tx_thread_active = false; -+out_bitmap: -+ spin_lock(&iscsit_global->ts_bitmap_lock); -+ bitmap_release_region(iscsit_global->ts_bitmap, conn->bitmap_id, -+ get_order(1)); -+ spin_unlock(&iscsit_global->ts_bitmap_lock); -+ return ret; -+} -+ -+int iscsi_post_login_handler( - struct iscsi_np *np, - struct iscsi_conn *conn, - u8 zero_tsih) -@@ -693,7 +738,7 @@ static int iscsi_post_login_handler( - struct se_session *se_sess = sess->se_sess; - struct iscsi_portal_group *tpg = ISCSI_TPG_S(sess); - struct se_portal_group *se_tpg = &tpg->tpg_se_tpg; -- struct iscsi_thread_set *ts; -+ int rc; - - iscsit_inc_conn_usage_count(conn); - -@@ -708,7 +753,6 @@ static int iscsi_post_login_handler( - /* - * SCSI Initiator -> SCSI Target Port Mapping - */ -- ts = iscsi_get_thread_set(); - if (!zero_tsih) { - iscsi_set_session_parameters(sess->sess_ops, - conn->param_list, 0); -@@ -735,9 +779,11 @@ static int iscsi_post_login_handler( - sess->sess_ops->InitiatorName); - spin_unlock_bh(&sess->conn_lock); - -- iscsi_post_login_start_timers(conn); -+ rc = iscsit_start_kthreads(conn); -+ if (rc) -+ return rc; - -- iscsi_activate_thread_set(conn, ts); -+ iscsi_post_login_start_timers(conn); - /* - * Determine CPU mask to ensure connection's RX and TX kthreads - * are scheduled on the same CPU. -@@ -794,8 +840,11 @@ static int iscsi_post_login_handler( - " iSCSI Target Portal Group: %hu\n", tpg->nsessions, tpg->tpgt); - spin_unlock_bh(&se_tpg->session_lock); - -+ rc = iscsit_start_kthreads(conn); -+ if (rc) -+ return rc; -+ - iscsi_post_login_start_timers(conn); -- iscsi_activate_thread_set(conn, ts); - /* - * Determine CPU mask to ensure connection's RX and TX kthreads - * are scheduled on the same CPU. -diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c -index 78ddfb43750a..62e532fb82ad 100644 ---- a/drivers/usb/core/devio.c -+++ b/drivers/usb/core/devio.c -@@ -513,7 +513,7 @@ static void async_completed(struct urb *urb) - snoop(&urb->dev->dev, "urb complete\n"); - snoop_urb(urb->dev, as->userurb, urb->pipe, urb->actual_length, - as->status, COMPLETE, NULL, 0); -- if ((urb->transfer_flags & URB_DIR_MASK) == USB_DIR_IN) -+ if ((urb->transfer_flags & URB_DIR_MASK) == URB_DIR_IN) - snoop_urb_data(urb, urb->actual_length); - - if (as->status < 0 && as->bulk_addr && as->status != -ECONNRESET && -@@ -1593,7 +1593,7 @@ static struct async *reap_as(struct dev_state *ps) - for (;;) { - __set_current_state(TASK_INTERRUPTIBLE); - as = async_getcompleted(ps); -- if (as) -+ if (as || !connected(ps)) - break; - if (signal_pending(current)) - break; -@@ -1616,7 +1616,7 @@ static int proc_reapurb(struct dev_state *ps, void __user *arg) - } - if (signal_pending(current)) - return -EINTR; -- return -EIO; -+ return -ENODEV; - } - - static int proc_reapurbnonblock(struct dev_state *ps, void __user *arg) -@@ -1625,10 +1625,11 @@ static int proc_reapurbnonblock(struct dev_state *ps, void __user *arg) - struct async *as; - - as = async_getcompleted(ps); -- retval = -EAGAIN; - if (as) { - retval = processcompl(as, (void __user * __user *)arg); - free_async(as); -+ } else { -+ retval = (connected(ps) ? -EAGAIN : -ENODEV); - } - return retval; - } -@@ -1758,7 +1759,7 @@ static int proc_reapurb_compat(struct dev_state *ps, void __user *arg) - } - if (signal_pending(current)) - return -EINTR; -- return -EIO; -+ return -ENODEV; - } - - static int proc_reapurbnonblock_compat(struct dev_state *ps, void __user *arg) -@@ -1766,11 +1767,12 @@ static int proc_reapurbnonblock_compat(struct dev_state *ps, void __user *arg) - int retval; - struct async *as; - -- retval = -EAGAIN; - as = async_getcompleted(ps); - if (as) { - retval = processcompl_compat(as, (void __user * __user *)arg); - free_async(as); -+ } else { -+ retval = (connected(ps) ? -EAGAIN : -ENODEV); - } - return retval; - } -@@ -1941,7 +1943,8 @@ static int proc_get_capabilities(struct dev_state *ps, void __user *arg) - { - __u32 caps; - -- caps = USBDEVFS_CAP_ZERO_PACKET | USBDEVFS_CAP_NO_PACKET_SIZE_LIM; -+ caps = USBDEVFS_CAP_ZERO_PACKET | USBDEVFS_CAP_NO_PACKET_SIZE_LIM | -+ USBDEVFS_CAP_REAP_AFTER_DISCONNECT; - if (!ps->dev->bus->no_stop_on_short) - caps |= USBDEVFS_CAP_BULK_CONTINUATION; - if (ps->dev->bus->sg_tablesize) -@@ -2002,6 +2005,32 @@ static long usbdev_do_ioctl(struct file *file, unsigned int cmd, - return -EPERM; - - usb_lock_device(dev); -+ -+ /* Reap operations are allowed even after disconnection */ -+ switch (cmd) { -+ case USBDEVFS_REAPURB: -+ snoop(&dev->dev, "%s: REAPURB\n", __func__); -+ ret = proc_reapurb(ps, p); -+ goto done; -+ -+ case USBDEVFS_REAPURBNDELAY: -+ snoop(&dev->dev, "%s: REAPURBNDELAY\n", __func__); -+ ret = proc_reapurbnonblock(ps, p); -+ goto done; -+ -+#ifdef CONFIG_COMPAT -+ case USBDEVFS_REAPURB32: -+ snoop(&dev->dev, "%s: REAPURB32\n", __func__); -+ ret = proc_reapurb_compat(ps, p); -+ goto done; -+ -+ case USBDEVFS_REAPURBNDELAY32: -+ snoop(&dev->dev, "%s: REAPURBNDELAY32\n", __func__); -+ ret = proc_reapurbnonblock_compat(ps, p); -+ goto done; -+#endif -+ } -+ - if (!connected(ps)) { - usb_unlock_device(dev); - return -ENODEV; -@@ -2095,16 +2124,6 @@ static long usbdev_do_ioctl(struct file *file, unsigned int cmd, - inode->i_mtime = CURRENT_TIME; - break; - -- case USBDEVFS_REAPURB32: -- snoop(&dev->dev, "%s: REAPURB32\n", __func__); -- ret = proc_reapurb_compat(ps, p); -- break; -- -- case USBDEVFS_REAPURBNDELAY32: -- snoop(&dev->dev, "%s: REAPURBNDELAY32\n", __func__); -- ret = proc_reapurbnonblock_compat(ps, p); -- break; -- - case USBDEVFS_IOCTL32: - snoop(&dev->dev, "%s: IOCTL32\n", __func__); - ret = proc_ioctl_compat(ps, ptr_to_compat(p)); -@@ -2116,16 +2135,6 @@ static long usbdev_do_ioctl(struct file *file, unsigned int cmd, - ret = proc_unlinkurb(ps, p); - break; - -- case USBDEVFS_REAPURB: -- snoop(&dev->dev, "%s: REAPURB\n", __func__); -- ret = proc_reapurb(ps, p); -- break; -- -- case USBDEVFS_REAPURBNDELAY: -- snoop(&dev->dev, "%s: REAPURBNDELAY\n", __func__); -- ret = proc_reapurbnonblock(ps, p); -- break; -- - case USBDEVFS_DISCSIGNAL: - snoop(&dev->dev, "%s: DISCSIGNAL\n", __func__); - ret = proc_disconnectsignal(ps, p); -@@ -2162,6 +2171,8 @@ static long usbdev_do_ioctl(struct file *file, unsigned int cmd, - ret = proc_disconnect_claim(ps, p); - break; - } -+ -+ done: - usb_unlock_device(dev); - if (ret >= 0) - inode->i_atime = CURRENT_TIME; -diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c -index 6cd418f6ac07..57d7ec6c8090 100644 ---- a/drivers/usb/dwc3/ep0.c -+++ b/drivers/usb/dwc3/ep0.c -@@ -718,6 +718,10 @@ static int dwc3_ep0_std_request(struct dwc3 *dwc, struct usb_ctrlrequest *ctrl) - dev_vdbg(dwc->dev, "USB_REQ_SET_ISOCH_DELAY\n"); - ret = dwc3_ep0_set_isoch_delay(dwc, ctrl); - break; -+ case USB_REQ_SET_INTERFACE: -+ dev_vdbg(dwc->dev, "USB_REQ_SET_INTERFACE\n"); -+ dwc->start_config_issued = false; -+ /* Fall through */ - default: - dev_vdbg(dwc->dev, "Forwarding to gadget driver\n"); - ret = dwc3_ep0_delegate_req(dwc, ctrl); -diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c -index 87f8fc63b3e1..6e70c88b25fb 100644 ---- a/drivers/usb/dwc3/gadget.c -+++ b/drivers/usb/dwc3/gadget.c -@@ -319,6 +319,8 @@ int dwc3_send_gadget_generic_command(struct dwc3 *dwc, int cmd, u32 param) - if (!(reg & DWC3_DGCMD_CMDACT)) { - dev_vdbg(dwc->dev, "Command Complete --> %d\n", - DWC3_DGCMD_STATUS(reg)); -+ if (DWC3_DGCMD_STATUS(reg)) -+ return -EINVAL; - return 0; - } - -@@ -355,6 +357,8 @@ int dwc3_send_gadget_ep_cmd(struct dwc3 *dwc, unsigned ep, - if (!(reg & DWC3_DEPCMD_CMDACT)) { - dev_vdbg(dwc->dev, "Command Complete --> %d\n", - DWC3_DEPCMD_STATUS(reg)); -+ if (DWC3_DEPCMD_STATUS(reg)) -+ return -EINVAL; - return 0; - } - -diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c -index 677f032482f7..31bed5f7d0eb 100644 ---- a/drivers/usb/host/xhci-mem.c -+++ b/drivers/usb/host/xhci-mem.c -@@ -1400,10 +1400,10 @@ int xhci_endpoint_init(struct xhci_hcd *xhci, - /* Attempt to use the ring cache */ - if (virt_dev->num_rings_cached == 0) - return -ENOMEM; -+ virt_dev->num_rings_cached--; - virt_dev->eps[ep_index].new_ring = - virt_dev->ring_cache[virt_dev->num_rings_cached]; - virt_dev->ring_cache[virt_dev->num_rings_cached] = NULL; -- virt_dev->num_rings_cached--; - xhci_reinit_cached_ring(xhci, virt_dev->eps[ep_index].new_ring, - 1, type); - } -diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c -index ab1c5e8ac27f..dd84416a23cd 100644 ---- a/drivers/usb/serial/cp210x.c -+++ b/drivers/usb/serial/cp210x.c -@@ -187,6 +187,7 @@ static const struct usb_device_id id_table[] = { - { USB_DEVICE(0x1FB9, 0x0602) }, /* Lake Shore Model 648 Magnet Power Supply */ - { USB_DEVICE(0x1FB9, 0x0700) }, /* Lake Shore Model 737 VSM Controller */ - { USB_DEVICE(0x1FB9, 0x0701) }, /* Lake Shore Model 776 Hall Matrix */ -+ { USB_DEVICE(0x2626, 0xEA60) }, /* Aruba Networks 7xxx USB Serial Console */ - { USB_DEVICE(0x3195, 0xF190) }, /* Link Instruments MSO-19 */ - { USB_DEVICE(0x3195, 0xF280) }, /* Link Instruments MSO-28 */ - { USB_DEVICE(0x3195, 0xF281) }, /* Link Instruments MSO-28 */ -diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c -index 8b3484134ab0..096438e4fb0c 100644 ---- a/drivers/usb/serial/option.c -+++ b/drivers/usb/serial/option.c -@@ -1755,6 +1755,7 @@ static const struct usb_device_id option_ids[] = { - { USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x7d03, 0xff, 0x00, 0x00) }, - { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e01, 0xff, 0xff, 0xff) }, /* D-Link DWM-152/C1 */ - { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e02, 0xff, 0xff, 0xff) }, /* D-Link DWM-156/C1 */ -+ { USB_DEVICE_INTERFACE_CLASS(0x2020, 0x4000, 0xff) }, /* OLICARD300 - MT6225 */ - { USB_DEVICE(INOVIA_VENDOR_ID, INOVIA_SEW858) }, - { USB_DEVICE(VIATELECOM_VENDOR_ID, VIATELECOM_PRODUCT_CDS7) }, - { } /* Terminating entry */ -diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c -index af88ffd1068f..2b7e073f5e36 100644 ---- a/drivers/watchdog/omap_wdt.c -+++ b/drivers/watchdog/omap_wdt.c -@@ -134,6 +134,13 @@ static int omap_wdt_start(struct watchdog_device *wdog) - - pm_runtime_get_sync(wdev->dev); - -+ /* -+ * Make sure the watchdog is disabled. This is unfortunately required -+ * because writing to various registers with the watchdog running has no -+ * effect. -+ */ -+ omap_wdt_disable(wdev); -+ - /* initialize prescaler */ - while (__raw_readl(base + OMAP_WATCHDOG_WPS) & 0x01) - cpu_relax(); -diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c -index d86edc8d3fd0..4c7d309e4aa6 100644 ---- a/fs/9p/vfs_inode.c -+++ b/fs/9p/vfs_inode.c -@@ -537,8 +537,7 @@ static struct inode *v9fs_qid_iget(struct super_block *sb, - unlock_new_inode(inode); - return inode; - error: -- unlock_new_inode(inode); -- iput(inode); -+ iget_failed(inode); - return ERR_PTR(retval); - - } -diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c -index 53687bbf2296..65b21a24841e 100644 ---- a/fs/9p/vfs_inode_dotl.c -+++ b/fs/9p/vfs_inode_dotl.c -@@ -151,8 +151,7 @@ static struct inode *v9fs_qid_iget_dotl(struct super_block *sb, - unlock_new_inode(inode); - return inode; - error: -- unlock_new_inode(inode); -- iput(inode); -+ iget_failed(inode); - return ERR_PTR(retval); - - } -diff --git a/fs/btrfs/inode-map.c b/fs/btrfs/inode-map.c -index 2c66ddbbe670..0389e90eec33 100644 ---- a/fs/btrfs/inode-map.c -+++ b/fs/btrfs/inode-map.c -@@ -283,7 +283,7 @@ void btrfs_unpin_free_ino(struct btrfs_root *root) - __btrfs_add_free_space(ctl, info->offset, count); - free: - rb_erase(&info->offset_index, rbroot); -- kfree(info); -+ kmem_cache_free(btrfs_free_space_cachep, info); - } - } - -diff --git a/fs/ext4/indirect.c b/fs/ext4/indirect.c -index 589061469687..b07a221c3138 100644 ---- a/fs/ext4/indirect.c -+++ b/fs/ext4/indirect.c -@@ -577,7 +577,7 @@ int ext4_ind_map_blocks(handle_t *handle, struct inode *inode, - EXT4_FEATURE_RO_COMPAT_BIGALLOC)) { - EXT4_ERROR_INODE(inode, "Can't allocate blocks for " - "non-extent mapped inodes with bigalloc"); -- return -ENOSPC; -+ return -EUCLEAN; - } - - goal = ext4_find_goal(inode, map->m_lblk, partial); -diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c -index 8a277505a3be..10b71e4029a0 100644 ---- a/fs/ext4/inode.c -+++ b/fs/ext4/inode.c -@@ -1412,7 +1412,7 @@ static void ext4_da_release_space(struct inode *inode, int to_free) - static void ext4_da_page_release_reservation(struct page *page, - unsigned long offset) - { -- int to_release = 0; -+ int to_release = 0, contiguous_blks = 0; - struct buffer_head *head, *bh; - unsigned int curr_off = 0; - struct inode *inode = page->mapping->host; -@@ -1427,14 +1427,23 @@ static void ext4_da_page_release_reservation(struct page *page, - - if ((offset <= curr_off) && (buffer_delay(bh))) { - to_release++; -+ contiguous_blks++; - clear_buffer_delay(bh); -+ } else if (contiguous_blks) { -+ lblk = page->index << -+ (PAGE_CACHE_SHIFT - inode->i_blkbits); -+ lblk += (curr_off >> inode->i_blkbits) - -+ contiguous_blks; -+ ext4_es_remove_extent(inode, lblk, contiguous_blks); -+ contiguous_blks = 0; - } - curr_off = next_off; - } while ((bh = bh->b_this_page) != head); - -- if (to_release) { -+ if (contiguous_blks) { - lblk = page->index << (PAGE_CACHE_SHIFT - inode->i_blkbits); -- ext4_es_remove_extent(inode, lblk, to_release); -+ lblk += (curr_off >> inode->i_blkbits) - contiguous_blks; -+ ext4_es_remove_extent(inode, lblk, contiguous_blks); - } - - /* If we have released all the blocks belonging to a cluster, then we -@@ -2099,19 +2108,32 @@ static int __ext4_journalled_writepage(struct page *page, - ext4_walk_page_buffers(handle, page_bufs, 0, len, - NULL, bget_one); - } -- /* As soon as we unlock the page, it can go away, but we have -- * references to buffers so we are safe */ -+ /* -+ * We need to release the page lock before we start the -+ * journal, so grab a reference so the page won't disappear -+ * out from under us. -+ */ -+ get_page(page); - unlock_page(page); - - handle = ext4_journal_start(inode, EXT4_HT_WRITE_PAGE, - ext4_writepage_trans_blocks(inode)); - if (IS_ERR(handle)) { - ret = PTR_ERR(handle); -- goto out; -+ put_page(page); -+ goto out_no_pagelock; - } -- - BUG_ON(!ext4_handle_valid(handle)); - -+ lock_page(page); -+ put_page(page); -+ if (page->mapping != mapping) { -+ /* The page got truncated from under us */ -+ ext4_journal_stop(handle); -+ ret = 0; -+ goto out; -+ } -+ - if (inline_data) { - ret = ext4_journal_get_write_access(handle, inode_bh); - -@@ -2136,6 +2158,8 @@ static int __ext4_journalled_writepage(struct page *page, - NULL, bput_one); - ext4_set_inode_state(inode, EXT4_STATE_JDATA); - out: -+ unlock_page(page); -+out_no_pagelock: - brelse(inode_bh); - return ret; - } -diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c -index df5050f9080b..61ee01603940 100644 ---- a/fs/ext4/mballoc.c -+++ b/fs/ext4/mballoc.c -@@ -4764,18 +4764,12 @@ do_more: - /* - * blocks being freed are metadata. these blocks shouldn't - * be used until this transaction is committed -+ * -+ * We use __GFP_NOFAIL because ext4_free_blocks() is not allowed -+ * to fail. - */ -- retry: -- new_entry = kmem_cache_alloc(ext4_free_data_cachep, GFP_NOFS); -- if (!new_entry) { -- /* -- * We use a retry loop because -- * ext4_free_blocks() is not allowed to fail. -- */ -- cond_resched(); -- congestion_wait(BLK_RW_ASYNC, HZ/50); -- goto retry; -- } -+ new_entry = kmem_cache_alloc(ext4_free_data_cachep, -+ GFP_NOFS|__GFP_NOFAIL); - new_entry->efd_start_cluster = bit; - new_entry->efd_group = block_group; - new_entry->efd_count = count_clusters; -diff --git a/fs/ext4/migrate.c b/fs/ext4/migrate.c -index 49e8bdff9163..d19efab66cb6 100644 ---- a/fs/ext4/migrate.c -+++ b/fs/ext4/migrate.c -@@ -616,6 +616,7 @@ int ext4_ind_migrate(struct inode *inode) - struct ext4_inode_info *ei = EXT4_I(inode); - struct ext4_extent *ex; - unsigned int i, len; -+ ext4_lblk_t start, end; - ext4_fsblk_t blk; - handle_t *handle; - int ret; -@@ -629,6 +630,14 @@ int ext4_ind_migrate(struct inode *inode) - EXT4_FEATURE_RO_COMPAT_BIGALLOC)) - return -EOPNOTSUPP; - -+ /* -+ * In order to get correct extent info, force all delayed allocation -+ * blocks to be allocated, otherwise delayed allocation blocks may not -+ * be reflected and bypass the checks on extent header. -+ */ -+ if (test_opt(inode->i_sb, DELALLOC)) -+ ext4_alloc_da_blocks(inode); -+ - handle = ext4_journal_start(inode, EXT4_HT_MIGRATE, 1); - if (IS_ERR(handle)) - return PTR_ERR(handle); -@@ -646,11 +655,13 @@ int ext4_ind_migrate(struct inode *inode) - goto errout; - } - if (eh->eh_entries == 0) -- blk = len = 0; -+ blk = len = start = end = 0; - else { - len = le16_to_cpu(ex->ee_len); - blk = ext4_ext_pblock(ex); -- if (len > EXT4_NDIR_BLOCKS) { -+ start = le32_to_cpu(ex->ee_block); -+ end = start + len - 1; -+ if (end >= EXT4_NDIR_BLOCKS) { - ret = -EOPNOTSUPP; - goto errout; - } -@@ -658,7 +669,7 @@ int ext4_ind_migrate(struct inode *inode) - - ext4_clear_inode_flag(inode, EXT4_INODE_EXTENTS); - memset(ei->i_data, 0, sizeof(ei->i_data)); -- for (i=0; i < len; i++) -+ for (i = start; i <= end; i++) - ei->i_data[i] = cpu_to_le32(blk++); - ext4_mark_inode_dirty(handle, inode); - errout: -diff --git a/fs/ext4/super.c b/fs/ext4/super.c -index 21a0b43a7d31..af1eaed96a91 100644 ---- a/fs/ext4/super.c -+++ b/fs/ext4/super.c -@@ -803,6 +803,7 @@ static void ext4_put_super(struct super_block *sb) - dump_orphan_list(sb, sbi); - J_ASSERT(list_empty(&sbi->s_orphan)); - -+ sync_blockdev(sb->s_bdev); - invalidate_bdev(sb->s_bdev); - if (sbi->journal_bdev && sbi->journal_bdev != sb->s_bdev) { - /* -diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c -index 39a986e1da9e..4d371f3b9a45 100644 ---- a/fs/fuse/inode.c -+++ b/fs/fuse/inode.c -@@ -1028,6 +1028,7 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent) - goto err_fput; - - fuse_conn_init(fc); -+ fc->release = fuse_free_conn; - - fc->dev = sb->s_dev; - fc->sb = sb; -@@ -1042,7 +1043,6 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent) - fc->dont_mask = 1; - sb->s_flags |= MS_POSIXACL; - -- fc->release = fuse_free_conn; - fc->flags = d.flags; - fc->user_id = d.user_id; - fc->group_id = d.group_id; -diff --git a/fs/hpfs/super.c b/fs/hpfs/super.c -index 962e90c37aec..2c1ce192af8b 100644 ---- a/fs/hpfs/super.c -+++ b/fs/hpfs/super.c -@@ -52,17 +52,20 @@ static void unmark_dirty(struct super_block *s) - } - - /* Filesystem error... */ --static char err_buf[1024]; -- - void hpfs_error(struct super_block *s, const char *fmt, ...) - { -+ struct va_format vaf; - va_list args; - - va_start(args, fmt); -- vsnprintf(err_buf, sizeof(err_buf), fmt, args); -+ -+ vaf.fmt = fmt; -+ vaf.va = &args; -+ -+ pr_err("filesystem error: %pV", &vaf); -+ - va_end(args); - -- printk("HPFS: filesystem error: %s", err_buf); - if (!hpfs_sb(s)->sb_was_error) { - if (hpfs_sb(s)->sb_err == 2) { - printk("; crashing the system because you wanted it\n"); -diff --git a/fs/jbd2/checkpoint.c b/fs/jbd2/checkpoint.c -index c78841ee81cf..6bb52859cb86 100644 ---- a/fs/jbd2/checkpoint.c -+++ b/fs/jbd2/checkpoint.c -@@ -440,7 +440,7 @@ int jbd2_cleanup_journal_tail(journal_t *journal) - unsigned long blocknr; - - if (is_journal_aborted(journal)) -- return 1; -+ return -EIO; - - if (!jbd2_journal_get_log_tail(journal, &first_tid, &blocknr)) - return 1; -@@ -455,10 +455,9 @@ int jbd2_cleanup_journal_tail(journal_t *journal) - * jbd2_cleanup_journal_tail() doesn't get called all that often. - */ - if (journal->j_flags & JBD2_BARRIER) -- blkdev_issue_flush(journal->j_fs_dev, GFP_KERNEL, NULL); -+ blkdev_issue_flush(journal->j_fs_dev, GFP_NOFS, NULL); - -- __jbd2_update_log_tail(journal, first_tid, blocknr); -- return 0; -+ return __jbd2_update_log_tail(journal, first_tid, blocknr); - } - - -diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c -index aaa1a3f33b0e..3e7ef8874ffb 100644 ---- a/fs/jbd2/journal.c -+++ b/fs/jbd2/journal.c -@@ -869,9 +869,10 @@ int jbd2_journal_get_log_tail(journal_t *journal, tid_t *tid, - * - * Requires j_checkpoint_mutex - */ --void __jbd2_update_log_tail(journal_t *journal, tid_t tid, unsigned long block) -+int __jbd2_update_log_tail(journal_t *journal, tid_t tid, unsigned long block) - { - unsigned long freed; -+ int ret; - - BUG_ON(!mutex_is_locked(&journal->j_checkpoint_mutex)); - -@@ -881,7 +882,10 @@ void __jbd2_update_log_tail(journal_t *journal, tid_t tid, unsigned long block) - * space and if we lose sb update during power failure we'd replay - * old transaction with possibly newly overwritten data. - */ -- jbd2_journal_update_sb_log_tail(journal, tid, block, WRITE_FUA); -+ ret = jbd2_journal_update_sb_log_tail(journal, tid, block, WRITE_FUA); -+ if (ret) -+ goto out; -+ - write_lock(&journal->j_state_lock); - freed = block - journal->j_tail; - if (block < journal->j_tail) -@@ -897,6 +901,9 @@ void __jbd2_update_log_tail(journal_t *journal, tid_t tid, unsigned long block) - journal->j_tail_sequence = tid; - journal->j_tail = block; - write_unlock(&journal->j_state_lock); -+ -+out: -+ return ret; - } - - /* -@@ -1315,7 +1322,7 @@ static int journal_reset(journal_t *journal) - return jbd2_journal_start_thread(journal); - } - --static void jbd2_write_superblock(journal_t *journal, int write_op) -+static int jbd2_write_superblock(journal_t *journal, int write_op) - { - struct buffer_head *bh = journal->j_sb_buffer; - journal_superblock_t *sb = journal->j_superblock; -@@ -1354,7 +1361,10 @@ static void jbd2_write_superblock(journal_t *journal, int write_op) - printk(KERN_ERR "JBD2: Error %d detected when updating " - "journal superblock for %s.\n", ret, - journal->j_devname); -+ jbd2_journal_abort(journal, ret); - } -+ -+ return ret; - } - - /** -@@ -1367,10 +1377,11 @@ static void jbd2_write_superblock(journal_t *journal, int write_op) - * Update a journal's superblock information about log tail and write it to - * disk, waiting for the IO to complete. - */ --void jbd2_journal_update_sb_log_tail(journal_t *journal, tid_t tail_tid, -+int jbd2_journal_update_sb_log_tail(journal_t *journal, tid_t tail_tid, - unsigned long tail_block, int write_op) - { - journal_superblock_t *sb = journal->j_superblock; -+ int ret; - - BUG_ON(!mutex_is_locked(&journal->j_checkpoint_mutex)); - jbd_debug(1, "JBD2: updating superblock (start %lu, seq %u)\n", -@@ -1379,13 +1390,18 @@ void jbd2_journal_update_sb_log_tail(journal_t *journal, tid_t tail_tid, - sb->s_sequence = cpu_to_be32(tail_tid); - sb->s_start = cpu_to_be32(tail_block); - -- jbd2_write_superblock(journal, write_op); -+ ret = jbd2_write_superblock(journal, write_op); -+ if (ret) -+ goto out; - - /* Log is no longer empty */ - write_lock(&journal->j_state_lock); - WARN_ON(!sb->s_sequence); - journal->j_flags &= ~JBD2_FLUSHED; - write_unlock(&journal->j_state_lock); -+ -+out: -+ return ret; - } - - /** -@@ -1922,7 +1938,14 @@ int jbd2_journal_flush(journal_t *journal) - return -EIO; - - mutex_lock(&journal->j_checkpoint_mutex); -- jbd2_cleanup_journal_tail(journal); -+ if (!err) { -+ err = jbd2_cleanup_journal_tail(journal); -+ if (err < 0) { -+ mutex_unlock(&journal->j_checkpoint_mutex); -+ goto out; -+ } -+ err = 0; -+ } - - /* Finally, mark the journal as really needing no recovery. - * This sets s_start==0 in the underlying superblock, which is -@@ -1938,7 +1961,8 @@ int jbd2_journal_flush(journal_t *journal) - J_ASSERT(journal->j_head == journal->j_tail); - J_ASSERT(journal->j_tail_sequence == journal->j_transaction_sequence); - write_unlock(&journal->j_state_lock); -- return 0; -+out: -+ return err; - } - - /** -diff --git a/fs/nfs/nfs3xdr.c b/fs/nfs/nfs3xdr.c -index fa6d72131c19..4495cad189c3 100644 ---- a/fs/nfs/nfs3xdr.c -+++ b/fs/nfs/nfs3xdr.c -@@ -1342,7 +1342,7 @@ static void nfs3_xdr_enc_setacl3args(struct rpc_rqst *req, - if (args->npages != 0) - xdr_write_pages(xdr, args->pages, 0, args->len); - else -- xdr_reserve_space(xdr, NFS_ACL_INLINE_BUFSIZE); -+ xdr_reserve_space(xdr, args->len); - - error = nfsacl_encode(xdr->buf, base, args->inode, - (args->mask & NFS_ACL) ? -diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c -index d482b86d0e0b..cfa9163b3bb7 100644 ---- a/fs/nfs/nfs4state.c -+++ b/fs/nfs/nfs4state.c -@@ -1452,6 +1452,8 @@ restart: - } - spin_unlock(&state->state_lock); - nfs4_put_open_state(state); -+ clear_bit(NFS4CLNT_RECLAIM_NOGRACE, -+ &state->flags); - spin_lock(&sp->so_lock); - goto restart; - } -diff --git a/fs/xfs/xfs_symlink.c b/fs/xfs/xfs_symlink.c -index 195a403e1522..61dbe1958a30 100644 ---- a/fs/xfs/xfs_symlink.c -+++ b/fs/xfs/xfs_symlink.c -@@ -272,7 +272,7 @@ xfs_readlink_bmap( - cur_chunk += sizeof(struct xfs_dsymlink_hdr); - } - -- memcpy(link + offset, bp->b_addr, byte_cnt); -+ memcpy(link + offset, cur_chunk, byte_cnt); - - pathlen -= byte_cnt; - offset += byte_cnt; -diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h -index f819e813c8ac..4407354c7d6a 100644 ---- a/include/acpi/actypes.h -+++ b/include/acpi/actypes.h -@@ -511,6 +511,7 @@ typedef u64 acpi_integer; - #define ACPI_NO_ACPI_ENABLE 0x10 - #define ACPI_NO_DEVICE_INIT 0x20 - #define ACPI_NO_OBJECT_INIT 0x40 -+#define ACPI_NO_FACS_INIT 0x80 - - /* - * Initialization state -diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h -index 6e051f472edb..0c67c1f2a890 100644 ---- a/include/linux/jbd2.h -+++ b/include/linux/jbd2.h -@@ -997,7 +997,7 @@ extern struct journal_head * jbd2_journal_get_descriptor_buffer(journal_t *); - int jbd2_journal_next_log_block(journal_t *, unsigned long long *); - int jbd2_journal_get_log_tail(journal_t *journal, tid_t *tid, - unsigned long *block); --void __jbd2_update_log_tail(journal_t *journal, tid_t tid, unsigned long block); -+int __jbd2_update_log_tail(journal_t *journal, tid_t tid, unsigned long block); - void jbd2_update_log_tail(journal_t *journal, tid_t tid, unsigned long block); - - /* Commit management */ -@@ -1116,7 +1116,7 @@ extern int jbd2_journal_recover (journal_t *journal); - extern int jbd2_journal_wipe (journal_t *, int); - extern int jbd2_journal_skip_recovery (journal_t *); - extern void jbd2_journal_update_sb_errno(journal_t *); --extern void jbd2_journal_update_sb_log_tail (journal_t *, tid_t, -+extern int jbd2_journal_update_sb_log_tail (journal_t *, tid_t, - unsigned long, int); - extern void __jbd2_journal_abort_hard (journal_t *); - extern void jbd2_journal_abort (journal_t *, int); -diff --git a/include/linux/libata.h b/include/linux/libata.h -index 8e5d45fa83cf..8ad0771b88ab 100644 ---- a/include/linux/libata.h -+++ b/include/linux/libata.h -@@ -409,6 +409,7 @@ enum { - ATA_HORKAGE_ATAPI_DMADIR = (1 << 18), /* device requires dmadir */ - ATA_HORKAGE_NOLPM = (1 << 20), /* don't use LPM */ - ATA_HORKAGE_WD_BROKEN_LPM = (1 << 21), /* some WDs have broken LPM */ -+ ATA_HORKAGE_NOTRIM = (1 << 24), /* don't use TRIM */ - - /* DMA mask for user DMA control: User visible values; DO NOT - renumber */ -diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h -index 54e351aa4d2e..a9e5134c2936 100644 ---- a/include/linux/nfs_xdr.h -+++ b/include/linux/nfs_xdr.h -@@ -1094,7 +1094,7 @@ struct pnfs_ds_commit_info { - struct pnfs_commit_bucket *buckets; - }; - --#define NFS4_EXCHANGE_ID_LEN (48) -+#define NFS4_EXCHANGE_ID_LEN (127) - struct nfs41_exchange_id_args { - struct nfs_client *client; - nfs4_verifier *verifier; -diff --git a/include/uapi/linux/usbdevice_fs.h b/include/uapi/linux/usbdevice_fs.h -index 0c65e4b12617..ef29266ef77a 100644 ---- a/include/uapi/linux/usbdevice_fs.h -+++ b/include/uapi/linux/usbdevice_fs.h -@@ -125,11 +125,12 @@ struct usbdevfs_hub_portinfo { - char port [127]; /* e.g. port 3 connects to device 27 */ - }; - --/* Device capability flags */ -+/* System and bus capability flags */ - #define USBDEVFS_CAP_ZERO_PACKET 0x01 - #define USBDEVFS_CAP_BULK_CONTINUATION 0x02 - #define USBDEVFS_CAP_NO_PACKET_SIZE_LIM 0x04 - #define USBDEVFS_CAP_BULK_SCATTER_GATHER 0x08 -+#define USBDEVFS_CAP_REAP_AFTER_DISCONNECT 0x10 - - /* USBDEVFS_DISCONNECT_CLAIM flags & struct */ - -diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h -index aa0e736b72ac..fe576073580a 100644 ---- a/kernel/trace/trace.h -+++ b/kernel/trace/trace.h -@@ -428,6 +428,7 @@ enum { - - TRACE_CONTROL_BIT, - -+ TRACE_BRANCH_BIT, - /* - * Abuse of the trace_recursion. - * As we need a way to maintain state if we are tracing the function -diff --git a/kernel/trace/trace_branch.c b/kernel/trace/trace_branch.c -index d594da0dc03c..cb89197adf5c 100644 ---- a/kernel/trace/trace_branch.c -+++ b/kernel/trace/trace_branch.c -@@ -37,9 +37,12 @@ probe_likely_condition(struct ftrace_branch_data *f, int val, int expect) - struct trace_branch *entry; - struct ring_buffer *buffer; - unsigned long flags; -- int cpu, pc; -+ int pc; - const char *p; - -+ if (current->trace_recursion & TRACE_BRANCH_BIT) -+ return; -+ - /* - * I would love to save just the ftrace_likely_data pointer, but - * this code can also be used by modules. Ugly things can happen -@@ -50,10 +53,10 @@ probe_likely_condition(struct ftrace_branch_data *f, int val, int expect) - if (unlikely(!tr)) - return; - -- local_irq_save(flags); -- cpu = raw_smp_processor_id(); -- data = per_cpu_ptr(tr->trace_buffer.data, cpu); -- if (atomic_inc_return(&data->disabled) != 1) -+ raw_local_irq_save(flags); -+ current->trace_recursion |= TRACE_BRANCH_BIT; -+ data = this_cpu_ptr(tr->trace_buffer.data); -+ if (atomic_read(&data->disabled)) - goto out; - - pc = preempt_count(); -@@ -82,8 +85,8 @@ probe_likely_condition(struct ftrace_branch_data *f, int val, int expect) - __buffer_unlock_commit(buffer, event); - - out: -- atomic_dec(&data->disabled); -- local_irq_restore(flags); -+ current->trace_recursion &= ~TRACE_BRANCH_BIT; -+ raw_local_irq_restore(flags); - } - - static inline -diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c -index fe3e086d38e9..67654bb5bc2f 100644 ---- a/kernel/trace/trace_events_filter.c -+++ b/kernel/trace/trace_events_filter.c -@@ -1015,6 +1015,9 @@ static void parse_init(struct filter_parse_state *ps, - - static char infix_next(struct filter_parse_state *ps) - { -+ if (!ps->infix.cnt) -+ return 0; -+ - ps->infix.cnt--; - - return ps->infix.string[ps->infix.tail++]; -@@ -1030,6 +1033,9 @@ static char infix_peek(struct filter_parse_state *ps) - - static void infix_advance(struct filter_parse_state *ps) - { -+ if (!ps->infix.cnt) -+ return; -+ - ps->infix.cnt--; - ps->infix.tail++; - } -@@ -1342,7 +1348,9 @@ static int check_preds(struct filter_parse_state *ps) - continue; - } - n_normal_preds++; -- WARN_ON_ONCE(cnt < 0); -+ /* all ops should have operands */ -+ if (cnt < 0) -+ break; - } - - if (cnt != 1 || !n_normal_preds || n_logical_preds >= n_normal_preds) { -diff --git a/lib/bitmap.c b/lib/bitmap.c -index e5c4ebe586ba..c0634aa923a6 100644 ---- a/lib/bitmap.c -+++ b/lib/bitmap.c -@@ -603,12 +603,12 @@ static int __bitmap_parselist(const char *buf, unsigned int buflen, - unsigned a, b; - int c, old_c, totaldigits; - const char __user __force *ubuf = (const char __user __force *)buf; -- int exp_digit, in_range; -+ int at_start, in_range; - - totaldigits = c = 0; - bitmap_zero(maskp, nmaskbits); - do { -- exp_digit = 1; -+ at_start = 1; - in_range = 0; - a = b = 0; - -@@ -637,11 +637,10 @@ static int __bitmap_parselist(const char *buf, unsigned int buflen, - break; - - if (c == '-') { -- if (exp_digit || in_range) -+ if (at_start || in_range) - return -EINVAL; - b = 0; - in_range = 1; -- exp_digit = 1; - continue; - } - -@@ -651,16 +650,18 @@ static int __bitmap_parselist(const char *buf, unsigned int buflen, - b = b * 10 + (c - '0'); - if (!in_range) - a = b; -- exp_digit = 0; -+ at_start = 0; - totaldigits++; - } - if (!(a <= b)) - return -EINVAL; - if (b >= nmaskbits) - return -ERANGE; -- while (a <= b) { -- set_bit(a, maskp); -- a++; -+ if (!at_start) { -+ while (a <= b) { -+ set_bit(a, maskp); -+ a++; -+ } - } - } while (buflen && c == ','); - return 0; -diff --git a/net/9p/client.c b/net/9p/client.c -index addc116cecf0..853d62327a58 100644 ---- a/net/9p/client.c -+++ b/net/9p/client.c -@@ -828,7 +828,8 @@ static struct p9_req_t *p9_client_zc_rpc(struct p9_client *c, int8_t type, - if (err < 0) { - if (err == -EIO) - c->status = Disconnected; -- goto reterr; -+ if (err != -ERESTARTSYS) -+ goto reterr; - } - if (req->status == REQ_STATUS_ERROR) { - p9_debug(P9_DEBUG_ERROR, "req_status error %d\n", req->t_err); -diff --git a/net/ceph/osdmap.c b/net/ceph/osdmap.c -index dbd9a4792427..7ec4e0522215 100644 ---- a/net/ceph/osdmap.c -+++ b/net/ceph/osdmap.c -@@ -89,7 +89,7 @@ static int crush_decode_tree_bucket(void **p, void *end, - { - int j; - dout("crush_decode_tree_bucket %p to %p\n", *p, end); -- ceph_decode_32_safe(p, end, b->num_nodes, bad); -+ ceph_decode_8_safe(p, end, b->num_nodes, bad); - b->node_weights = kcalloc(b->num_nodes, sizeof(u32), GFP_NOFS); - if (b->node_weights == NULL) - return -ENOMEM; -diff --git a/net/mac80211/main.c b/net/mac80211/main.c -index 6658c5809353..dd6ca36c34c1 100644 ---- a/net/mac80211/main.c -+++ b/net/mac80211/main.c -@@ -257,6 +257,7 @@ static void ieee80211_restart_work(struct work_struct *work) - { - struct ieee80211_local *local = - container_of(work, struct ieee80211_local, restart_work); -+ struct ieee80211_sub_if_data *sdata; - - /* wait for scan work complete */ - flush_workqueue(local->workqueue); -@@ -269,6 +270,8 @@ static void ieee80211_restart_work(struct work_struct *work) - mutex_unlock(&local->mtx); - - rtnl_lock(); -+ list_for_each_entry(sdata, &local->interfaces, list) -+ flush_delayed_work(&sdata->dec_tailroom_needed_wk); - ieee80211_scan_cancel(local); - ieee80211_reconfig(local); - rtnl_unlock(); -diff --git a/net/sunrpc/backchannel_rqst.c b/net/sunrpc/backchannel_rqst.c -index 890a29912d5a..d29c119ecd9c 100644 ---- a/net/sunrpc/backchannel_rqst.c -+++ b/net/sunrpc/backchannel_rqst.c -@@ -60,7 +60,7 @@ static void xprt_free_allocation(struct rpc_rqst *req) - - dprintk("RPC: free allocations for req= %p\n", req); - WARN_ON_ONCE(test_bit(RPC_BC_PA_IN_USE, &req->rq_bc_pa_state)); -- xbufp = &req->rq_private_buf; -+ xbufp = &req->rq_rcv_buf; - free_page((unsigned long)xbufp->head[0].iov_base); - xbufp = &req->rq_snd_buf; - free_page((unsigned long)xbufp->head[0].iov_base); -diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c -index ca2094c914a1..a82d6576fe0f 100644 ---- a/sound/pci/hda/patch_realtek.c -+++ b/sound/pci/hda/patch_realtek.c -@@ -3365,6 +3365,7 @@ enum { - ALC269_FIXUP_LIFEBOOK, - ALC269_FIXUP_LIFEBOOK_EXTMIC, - ALC269_FIXUP_LIFEBOOK_HP_PIN, -+ ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT, - ALC269_FIXUP_AMIC, - ALC269_FIXUP_DMIC, - ALC269VB_FIXUP_AMIC, -@@ -3383,6 +3384,7 @@ enum { - ALC290_FIXUP_MONO_SPEAKERS, - ALC269_FIXUP_HEADSET_MODE, - ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, -+ ALC269_FIXUP_ASPIRE_HEADSET_MIC, - ALC269_FIXUP_ASUS_X101_FUNC, - ALC269_FIXUP_ASUS_X101_VERB, - ALC269_FIXUP_ASUS_X101, -@@ -3486,6 +3488,10 @@ static const struct hda_fixup alc269_fixups[] = { - { } - }, - }, -+ [ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT] = { -+ .type = HDA_FIXUP_FUNC, -+ .v.func = alc269_fixup_pincfg_no_hp_to_lineout, -+ }, - [ALC269_FIXUP_AMIC] = { - .type = HDA_FIXUP_PINS, - .v.pins = (const struct hda_pintbl[]) { -@@ -3598,6 +3604,15 @@ static const struct hda_fixup alc269_fixups[] = { - .type = HDA_FIXUP_FUNC, - .v.func = alc_fixup_headset_mode_no_hp_mic, - }, -+ [ALC269_FIXUP_ASPIRE_HEADSET_MIC] = { -+ .type = HDA_FIXUP_PINS, -+ .v.pins = (const struct hda_pintbl[]) { -+ { 0x19, 0x01a1913c }, /* headset mic w/o jack detect */ -+ { } -+ }, -+ .chained = true, -+ .chain_id = ALC269_FIXUP_HEADSET_MODE, -+ }, - [ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = { - .type = HDA_FIXUP_PINS, - .v.pins = (const struct hda_pintbl[]) { -@@ -3732,10 +3747,13 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { - SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), - SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), - SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700), -+ SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC), -+ SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC), - SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK), - SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK), - SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC), - SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK), -+ SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT), - SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN), - SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN), - SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC), -diff --git a/sound/soc/codecs/wm8737.c b/sound/soc/codecs/wm8737.c -index 2f167a8ca01b..62bacb8536e6 100644 ---- a/sound/soc/codecs/wm8737.c -+++ b/sound/soc/codecs/wm8737.c -@@ -494,7 +494,8 @@ static int wm8737_set_bias_level(struct snd_soc_codec *codec, - - /* Fast VMID ramp at 2*2.5k */ - snd_soc_update_bits(codec, WM8737_MISC_BIAS_CONTROL, -- WM8737_VMIDSEL_MASK, 0x4); -+ WM8737_VMIDSEL_MASK, -+ 2 << WM8737_VMIDSEL_SHIFT); - - /* Bring VMID up */ - snd_soc_update_bits(codec, WM8737_POWER_MANAGEMENT, -@@ -508,7 +509,8 @@ static int wm8737_set_bias_level(struct snd_soc_codec *codec, - - /* VMID at 2*300k */ - snd_soc_update_bits(codec, WM8737_MISC_BIAS_CONTROL, -- WM8737_VMIDSEL_MASK, 2); -+ WM8737_VMIDSEL_MASK, -+ 1 << WM8737_VMIDSEL_SHIFT); - - break; - -diff --git a/sound/soc/codecs/wm8903.h b/sound/soc/codecs/wm8903.h -index db949311c0f2..0bb4a647755d 100644 ---- a/sound/soc/codecs/wm8903.h -+++ b/sound/soc/codecs/wm8903.h -@@ -172,7 +172,7 @@ extern int wm8903_mic_detect(struct snd_soc_codec *codec, - #define WM8903_VMID_BUF_ENA_WIDTH 1 /* VMID_BUF_ENA */ - - #define WM8903_VMID_RES_50K 2 --#define WM8903_VMID_RES_250K 3 -+#define WM8903_VMID_RES_250K 4 - #define WM8903_VMID_RES_5K 6 - - /* -diff --git a/sound/soc/codecs/wm8955.c b/sound/soc/codecs/wm8955.c -index 1c1fc6119758..475fc24c8ff6 100644 ---- a/sound/soc/codecs/wm8955.c -+++ b/sound/soc/codecs/wm8955.c -@@ -298,7 +298,7 @@ static int wm8955_configure_clocking(struct snd_soc_codec *codec) - snd_soc_update_bits(codec, WM8955_PLL_CONTROL_2, - WM8955_K_17_9_MASK, - (pll.k >> 9) & WM8955_K_17_9_MASK); -- snd_soc_update_bits(codec, WM8955_PLL_CONTROL_2, -+ snd_soc_update_bits(codec, WM8955_PLL_CONTROL_3, - WM8955_K_8_0_MASK, - pll.k & WM8955_K_8_0_MASK); - if (pll.k) -diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c -index 39f65bc9de56..ae5bb95df862 100644 ---- a/sound/soc/codecs/wm8960.c -+++ b/sound/soc/codecs/wm8960.c -@@ -242,7 +242,7 @@ SOC_SINGLE("PCM Playback -6dB Switch", WM8960_DACCTL1, 7, 1, 0), - SOC_ENUM("ADC Polarity", wm8960_enum[0]), - SOC_SINGLE("ADC High Pass Filter Switch", WM8960_DACCTL1, 0, 1, 0), - --SOC_ENUM("DAC Polarity", wm8960_enum[2]), -+SOC_ENUM("DAC Polarity", wm8960_enum[1]), - SOC_SINGLE_BOOL_EXT("DAC Deemphasis Switch", 0, - wm8960_get_deemph, wm8960_put_deemph), - diff --git a/patch/kernel/marvell-default/1-patch-3.10.85-86.patch b/patch/kernel/marvell-default/1-patch-3.10.85-86.patch deleted file mode 100644 index 548c9367d7..0000000000 --- a/patch/kernel/marvell-default/1-patch-3.10.85-86.patch +++ /dev/null @@ -1,578 +0,0 @@ -diff --git a/Makefile b/Makefile -index 11a7e7bc31f2..25ee724c9089 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,6 +1,6 @@ - VERSION = 3 - PATCHLEVEL = 10 --SUBLEVEL = 85 -+SUBLEVEL = 86 - EXTRAVERSION = - NAME = TOSSUG Baby Fish - -diff --git a/arch/arc/include/asm/ptrace.h b/arch/arc/include/asm/ptrace.h -index 2046a89a57cf..78485493639a 100644 ---- a/arch/arc/include/asm/ptrace.h -+++ b/arch/arc/include/asm/ptrace.h -@@ -83,7 +83,7 @@ struct callee_regs { - long r13; - }; - --#define instruction_pointer(regs) ((regs)->ret) -+#define instruction_pointer(regs) (unsigned long)((regs)->ret) - #define profile_pc(regs) instruction_pointer(regs) - - /* return 1 if user mode or 0 if kernel mode */ -diff --git a/arch/s390/kernel/sclp.S b/arch/s390/kernel/sclp.S -index 29bd7bec4176..1ecd47b5e250 100644 ---- a/arch/s390/kernel/sclp.S -+++ b/arch/s390/kernel/sclp.S -@@ -276,6 +276,8 @@ ENTRY(_sclp_print_early) - jno .Lesa2 - ahi %r15,-80 - stmh %r6,%r15,96(%r15) # store upper register halves -+ basr %r13,0 -+ lmh %r0,%r15,.Lzeroes-.(%r13) # clear upper register halves - .Lesa2: - #endif - lr %r10,%r2 # save string pointer -@@ -299,6 +301,8 @@ ENTRY(_sclp_print_early) - #endif - lm %r6,%r15,120(%r15) # restore registers - br %r14 -+.Lzeroes: -+ .fill 64,4,0 - - .LwritedataS4: - .long 0x00760005 # SCLP command for write data -diff --git a/arch/tile/kernel/setup.c b/arch/tile/kernel/setup.c -index 7a5aa1a7864e..5ebe93676201 100644 ---- a/arch/tile/kernel/setup.c -+++ b/arch/tile/kernel/setup.c -@@ -1064,7 +1064,7 @@ static void __init load_hv_initrd(void) - - void __init free_initrd_mem(unsigned long begin, unsigned long end) - { -- free_bootmem(__pa(begin), end - begin); -+ free_bootmem_late(__pa(begin), end - begin); - } - - #else -diff --git a/arch/x86/boot/compressed/head_32.S b/arch/x86/boot/compressed/head_32.S -index abb988a54c69..3b28eff9b90b 100644 ---- a/arch/x86/boot/compressed/head_32.S -+++ b/arch/x86/boot/compressed/head_32.S -@@ -54,7 +54,7 @@ ENTRY(efi_pe_entry) - call reloc - reloc: - popl %ecx -- subl reloc, %ecx -+ subl $reloc, %ecx - movl %ecx, BP_code32_start(%eax) - - sub $0x4, %esp -diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c -index 1ff8e97f853a..8c4e81ac5e75 100644 ---- a/block/blk-cgroup.c -+++ b/block/blk-cgroup.c -@@ -720,8 +720,12 @@ int blkg_conf_prep(struct blkcg *blkcg, const struct blkcg_policy *pol, - return -EINVAL; - - disk = get_gendisk(MKDEV(major, minor), &part); -- if (!disk || part) -+ if (!disk) - return -EINVAL; -+ if (part) { -+ put_disk(disk); -+ return -EINVAL; -+ } - - rcu_read_lock(); - spin_lock_irq(disk->queue->queue_lock); -diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c -index 5f87bed05467..20aef5d5a242 100644 ---- a/drivers/input/touchscreen/usbtouchscreen.c -+++ b/drivers/input/touchscreen/usbtouchscreen.c -@@ -626,6 +626,9 @@ static int dmc_tsc10_init(struct usbtouch_usb *usbtouch) - goto err_out; - } - -+ /* TSC-25 data sheet specifies a delay after the RESET command */ -+ msleep(150); -+ - /* set coordinate output rate */ - buf[0] = buf[1] = 0xFF; - ret = usb_control_msg(dev, usb_rcvctrlpipe (dev, 0), -diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c -index 86ac4a4ccc01..fa58438b298a 100644 ---- a/drivers/md/raid1.c -+++ b/drivers/md/raid1.c -@@ -327,7 +327,7 @@ static void raid1_end_read_request(struct bio *bio, int error) - spin_lock_irqsave(&conf->device_lock, flags); - if (r1_bio->mddev->degraded == conf->raid_disks || - (r1_bio->mddev->degraded == conf->raid_disks-1 && -- !test_bit(Faulty, &conf->mirrors[mirror].rdev->flags))) -+ test_bit(In_sync, &conf->mirrors[mirror].rdev->flags))) - uptodate = 1; - spin_unlock_irqrestore(&conf->device_lock, flags); - } -diff --git a/drivers/mmc/host/sdhci-esdhc.h b/drivers/mmc/host/sdhci-esdhc.h -index d25f9ab9a54d..d33bb9522416 100644 ---- a/drivers/mmc/host/sdhci-esdhc.h -+++ b/drivers/mmc/host/sdhci-esdhc.h -@@ -40,7 +40,7 @@ - #define ESDHC_DMA_SYSCTL 0x40c - #define ESDHC_DMA_SNOOP 0x00000040 - --#define ESDHC_HOST_CONTROL_RES 0x05 -+#define ESDHC_HOST_CONTROL_RES 0x01 - - static inline void esdhc_set_clock(struct sdhci_host *host, unsigned int clock) - { -diff --git a/drivers/mmc/host/sdhci-pxav3.c b/drivers/mmc/host/sdhci-pxav3.c -index 4edb24bf56f8..c24fbc574cf1 100644 ---- a/drivers/mmc/host/sdhci-pxav3.c -+++ b/drivers/mmc/host/sdhci-pxav3.c -@@ -255,5 +255,6 @@ static int sdhci_pxav3_probe(struct platform_device *pdev) - mmc_of_parse(host->mmc); - sdhci_get_of_property(pdev); - pdata = pxav3_get_mmc_pdata(dev); -+ pdev->dev.platform_data = pdata; - host->caps = sdhci_readl(host, SDHCI_CAPABILITIES); - host->caps1 = sdhci_readl(host, SDHCI_CAPABILITIES_1); -diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c -index 2a32036a9404..fa9811200c9d 100644 ---- a/drivers/scsi/st.c -+++ b/drivers/scsi/st.c -@@ -1262,9 +1262,9 @@ static int st_open(struct inode *inode, struct file *filp) - spin_lock(&st_use_lock); - STp->in_use = 0; - spin_unlock(&st_use_lock); -- scsi_tape_put(STp); - if (resumed) - scsi_autopm_put_device(STp->device); -+ scsi_tape_put(STp); - return retval; - - } -diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c -index 3c293ad6ae70..efca110342cb 100644 ---- a/drivers/target/iscsi/iscsi_target.c -+++ b/drivers/target/iscsi/iscsi_target.c -@@ -4416,7 +4416,18 @@ static void iscsit_logout_post_handler_closesession( - struct iscsi_conn *conn) - { - struct iscsi_session *sess = conn->sess; -- int sleep = cmpxchg(&conn->tx_thread_active, true, false); -+ int sleep = 1; -+ /* -+ * Traditional iscsi/tcp will invoke this logic from TX thread -+ * context during session logout, so clear tx_thread_active and -+ * sleep if iscsit_close_connection() has not already occured. -+ * -+ * Since iser-target invokes this logic from it's own workqueue, -+ * always sleep waiting for RX/TX thread shutdown to complete -+ * within iscsit_close_connection(). -+ */ -+ if (conn->conn_transport->transport_type == ISCSI_TCP) -+ sleep = cmpxchg(&conn->tx_thread_active, true, false); - - atomic_set(&conn->conn_logout_remove, 0); - complete(&conn->conn_logout_comp); -@@ -4430,7 +4441,10 @@ static void iscsit_logout_post_handler_closesession( - static void iscsit_logout_post_handler_samecid( - struct iscsi_conn *conn) - { -- int sleep = cmpxchg(&conn->tx_thread_active, true, false); -+ int sleep = 1; -+ -+ if (conn->conn_transport->transport_type == ISCSI_TCP) -+ sleep = cmpxchg(&conn->tx_thread_active, true, false); - - atomic_set(&conn->conn_logout_remove, 0); - complete(&conn->conn_logout_comp); -@@ -4649,6 +4663,7 @@ int iscsit_release_sessions_for_tpg(struct iscsi_portal_group *tpg, int force) - struct iscsi_session *sess; - struct se_portal_group *se_tpg = &tpg->tpg_se_tpg; - struct se_session *se_sess, *se_sess_tmp; -+ LIST_HEAD(free_list); - int session_count = 0; - - spin_lock_bh(&se_tpg->session_lock); -@@ -4670,14 +4685,17 @@ int iscsit_release_sessions_for_tpg(struct iscsi_portal_group *tpg, int force) - } - atomic_set(&sess->session_reinstatement, 1); - spin_unlock(&sess->conn_lock); -- spin_unlock_bh(&se_tpg->session_lock); - -- iscsit_free_session(sess); -- spin_lock_bh(&se_tpg->session_lock); -+ list_move_tail(&se_sess->sess_list, &free_list); -+ } -+ spin_unlock_bh(&se_tpg->session_lock); - -+ list_for_each_entry_safe(se_sess, se_sess_tmp, &free_list, sess_list) { -+ sess = (struct iscsi_session *)se_sess->fabric_sess_ptr; -+ -+ iscsit_free_session(sess); - session_count++; - } -- spin_unlock_bh(&se_tpg->session_lock); - - pr_debug("Released %d iSCSI Session(s) from Target Portal" - " Group: %hu\n", session_count, tpg->tpgt); -diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c -index d939376c5dee..0f71c3a22507 100644 ---- a/drivers/usb/host/xhci-hub.c -+++ b/drivers/usb/host/xhci-hub.c -@@ -468,10 +468,13 @@ static void xhci_hub_report_link_state(struct xhci_hcd *xhci, - u32 pls = status_reg & PORT_PLS_MASK; - - /* resume state is a xHCI internal state. -- * Do not report it to usb core. -+ * Do not report it to usb core, instead, pretend to be U3, -+ * thus usb core knows it's not ready for transfer - */ -- if (pls == XDEV_RESUME) -+ if (pls == XDEV_RESUME) { -+ *status |= USB_SS_PORT_LS_U3; - return; -+ } - - /* When the CAS bit is set then warm reset - * should be performed on port -@@ -1045,10 +1048,10 @@ int xhci_bus_suspend(struct usb_hcd *hcd) - spin_lock_irqsave(&xhci->lock, flags); - - if (hcd->self.root_hub->do_remote_wakeup) { -- if (bus_state->resuming_ports) { -+ if (bus_state->resuming_ports || /* USB2 */ -+ bus_state->port_remote_wakeup) { /* USB3 */ - spin_unlock_irqrestore(&xhci->lock, flags); -- xhci_dbg(xhci, "suspend failed because " -- "a port is resuming\n"); -+ xhci_dbg(xhci, "suspend failed because a port is resuming\n"); - return -EBUSY; - } - } -diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c -index 30533952b4a3..95fe1a432d29 100644 ---- a/drivers/usb/host/xhci-ring.c -+++ b/drivers/usb/host/xhci-ring.c -@@ -1669,6 +1669,9 @@ static void handle_port_status(struct xhci_hcd *xhci, - usb_hcd_resume_root_hub(hcd); - } - -+ if (hcd->speed == HCD_USB3 && (temp & PORT_PLS_MASK) == XDEV_INACTIVE) -+ bus_state->port_remote_wakeup &= ~(1 << faked_port_index); -+ - if ((temp & PORT_PLC) && (temp & PORT_PLS_MASK) == XDEV_RESUME) { - xhci_dbg(xhci, "port resume event for port %d\n", port_id); - -diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c -index 10223f2b18d2..1f901fc25590 100644 ---- a/drivers/usb/host/xhci.c -+++ b/drivers/usb/host/xhci.c -@@ -3356,6 +3356,9 @@ int xhci_discover_or_reset_device(struct usb_hcd *hcd, struct usb_device *udev) - return -EINVAL; - } - -+ if (virt_dev->tt_info) -+ old_active_eps = virt_dev->tt_info->active_eps; -+ - if (virt_dev->udev != udev) { - /* If the virt_dev and the udev does not match, this virt_dev - * may belong to another udev. -diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h -index ed8de724b285..deb2537ae75c 100644 ---- a/drivers/usb/host/xhci.h -+++ b/drivers/usb/host/xhci.h -@@ -280,6 +280,7 @@ struct xhci_op_regs { - #define XDEV_U0 (0x0 << 5) - #define XDEV_U2 (0x2 << 5) - #define XDEV_U3 (0x3 << 5) -+#define XDEV_INACTIVE (0x6 << 5) - #define XDEV_RESUME (0xf << 5) - /* true: port has power (see HCC_PPC) */ - #define PORT_POWER (1 << 9) -diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h -index 821e1e2f70f6..da380a99c6b8 100644 ---- a/drivers/usb/storage/unusual_devs.h -+++ b/drivers/usb/storage/unusual_devs.h -@@ -2032,6 +2032,18 @@ UNUSUAL_DEV( 0x1908, 0x3335, 0x0200, 0x0200, - USB_SC_DEVICE, USB_PR_DEVICE, NULL, - US_FL_NO_READ_DISC_INFO ), - -+/* Reported by Oliver Neukum -+ * This device morphes spontaneously into another device if the access -+ * pattern of Windows isn't followed. Thus writable media would be dirty -+ * if the initial instance is used. So the device is limited to its -+ * virtual CD. -+ * And yes, the concept that BCD goes up to 9 is not heeded */ -+UNUSUAL_DEV( 0x19d2, 0x1225, 0x0000, 0xffff, -+ "ZTE,Incorporated", -+ "ZTE WCDMA Technologies MSM", -+ USB_SC_DEVICE, USB_PR_DEVICE, NULL, -+ US_FL_SINGLE_LUN ), -+ - /* Reported by Sven Geggus - * This encrypted pen drive returns bogus data for the initial READ(10). - */ -diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c -index 60aa5ad09a2f..3aabc652f1b9 100644 ---- a/drivers/vhost/vhost.c -+++ b/drivers/vhost/vhost.c -@@ -855,6 +855,7 @@ long vhost_dev_ioctl(struct vhost_dev *d, unsigned int ioctl, void __user *argp) - } - if (eventfp != d->log_file) { - filep = d->log_file; -+ d->log_file = eventfp; - ctx = d->log_ctx; - d->log_ctx = eventfp ? - eventfd_ctx_fileget(eventfp) : NULL; -diff --git a/fs/dcache.c b/fs/dcache.c -index 38c4a302fab4..90be2809e15a 100644 ---- a/fs/dcache.c -+++ b/fs/dcache.c -@@ -520,6 +520,9 @@ repeat: - return; - } - -+ if (unlikely(dentry->d_flags & DCACHE_DISCONNECTED)) -+ goto kill_it; -+ - if (dentry->d_flags & DCACHE_OP_DELETE) { - if (dentry->d_op->d_delete(dentry)) - goto kill_it; -diff --git a/kernel/irq/resend.c b/kernel/irq/resend.c -index 9065107f083e..7a5237a1bce5 100644 ---- a/kernel/irq/resend.c -+++ b/kernel/irq/resend.c -@@ -75,13 +75,21 @@ void check_irq_resend(struct irq_desc *desc, unsigned int irq) - !desc->irq_data.chip->irq_retrigger(&desc->irq_data)) { - #ifdef CONFIG_HARDIRQS_SW_RESEND - /* -- * If the interrupt has a parent irq and runs -- * in the thread context of the parent irq, -- * retrigger the parent. -+ * If the interrupt is running in the thread -+ * context of the parent irq we need to be -+ * careful, because we cannot trigger it -+ * directly. - */ -- if (desc->parent_irq && -- irq_settings_is_nested_thread(desc)) -+ if (irq_settings_is_nested_thread(desc)) { -+ /* -+ * If the parent_irq is valid, we -+ * retrigger the parent, otherwise we -+ * do nothing. -+ */ -+ if (!desc->parent_irq) -+ return; - irq = desc->parent_irq; -+ } - /* Set it pending and activate the softirq: */ - set_bit(irq, irqs_resend); - tasklet_schedule(&resend_tasklet); -diff --git a/mm/memory.c b/mm/memory.c -index e6b1da3a8924..30bf9cce8c2b 100644 ---- a/mm/memory.c -+++ b/mm/memory.c -@@ -3230,6 +3230,10 @@ static int do_anonymous_page(struct mm_struct *mm, struct vm_area_struct *vma, - - pte_unmap(page_table); - -+ /* File mapping without ->vm_ops ? */ -+ if (vma->vm_flags & VM_SHARED) -+ return VM_FAULT_SIGBUS; -+ - /* Check if we need to add a guard page to the stack */ - if (check_stack_guard_page(vma, address) < 0) - return VM_FAULT_SIGSEGV; -@@ -3495,6 +3499,9 @@ static int do_linear_fault(struct mm_struct *mm, struct vm_area_struct *vma, - - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff; - - pte_unmap(page_table); -+ /* The VMA was not fully populated on mmap() or missing VM_DONTEXPAND */ -+ if (!vma->vm_ops->fault) -+ return VM_FAULT_SIGBUS; - return __do_fault(mm, vma, address, pmd, pgoff, flags, orig_pte); - } - -@@ -3706,11 +3713,9 @@ int handle_pte_fault(struct mm_struct *mm, - entry = *pte; - if (!pte_present(entry)) { - if (pte_none(entry)) { -- if (vma->vm_ops) { -- if (likely(vma->vm_ops->fault)) -- return do_linear_fault(mm, vma, address, -+ if (vma->vm_ops) -+ return do_linear_fault(mm, vma, address, - pte, pmd, flags, entry); -- } - return do_anonymous_page(mm, vma, address, - pte, pmd, flags); - } -diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c -index 2d5b4f65c519..32bafdbdfd66 100644 ---- a/net/mac80211/debugfs_netdev.c -+++ b/net/mac80211/debugfs_netdev.c -@@ -697,6 +697,7 @@ void ieee80211_debugfs_remove_netdev(struct ieee80211_sub_if_data *sdata) - - debugfs_remove_recursive(sdata->vif.debugfs_dir); - sdata->vif.debugfs_dir = NULL; -+ sdata->debugfs.subdir_stations = NULL; - } - - void ieee80211_debugfs_rename_netdev(struct ieee80211_sub_if_data *sdata) -diff --git a/net/rds/ib_rdma.c b/net/rds/ib_rdma.c -index e8fdb172adbb..a985158d95d5 100644 ---- a/net/rds/ib_rdma.c -+++ b/net/rds/ib_rdma.c -@@ -759,8 +759,10 @@ void *rds_ib_get_mr(struct scatterlist *sg, unsigned long nents, - } - - ibmr = rds_ib_alloc_fmr(rds_ibdev); -- if (IS_ERR(ibmr)) -+ if (IS_ERR(ibmr)) { -+ rds_ib_dev_put(rds_ibdev); - return ibmr; -+ } - - ret = rds_ib_map_fmr(rds_ibdev, ibmr, sg, nents); - if (ret == 0) -diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c -index a82d6576fe0f..d30252e7f3e8 100644 ---- a/sound/pci/hda/patch_realtek.c -+++ b/sound/pci/hda/patch_realtek.c -@@ -2204,7 +2204,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = { - SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF), - SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF), - SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF), -- SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_IMAC91_VREF), -+ SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF), - - SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD), - SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD), -diff --git a/sound/usb/mixer_maps.c b/sound/usb/mixer_maps.c -index d06fbd9f7cbe..2d17f40fb16d 100644 ---- a/sound/usb/mixer_maps.c -+++ b/sound/usb/mixer_maps.c -@@ -330,6 +330,20 @@ static const struct usbmix_name_map scms_usb3318_map[] = { - { 0 } - }; - -+/* Bose companion 5, the dB conversion factor is 16 instead of 256 */ -+static struct usbmix_dB_map bose_companion5_dB = {-5006, -6}; -+static struct usbmix_name_map bose_companion5_map[] = { -+ { 3, NULL, .dB = &bose_companion5_dB }, -+ { 0 } /* terminator */ -+}; -+ -+/* Dragonfly DAC 1.2, the dB conversion factor is 1 instead of 256 */ -+static struct usbmix_dB_map dragonfly_1_2_dB = {0, 5000}; -+static struct usbmix_name_map dragonfly_1_2_map[] = { -+ { 7, NULL, .dB = &dragonfly_1_2_dB }, -+ { 0 } /* terminator */ -+}; -+ - /* - * Control map entries - */ -@@ -432,6 +446,16 @@ static struct usbmix_ctl_map usbmix_ctl_maps[] = { - .id = USB_ID(0x25c4, 0x0003), - .map = scms_usb3318_map, - }, -+ { -+ /* Bose Companion 5 */ -+ .id = USB_ID(0x05a7, 0x1020), -+ .map = bose_companion5_map, -+ }, -+ { -+ /* Dragonfly DAC 1.2 */ -+ .id = USB_ID(0x21b4, 0x0081), -+ .map = dragonfly_1_2_map, -+ }, - { 0 } /* terminator */ - }; - -diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h -index d5bed1d25713..45d586b6e8b5 100644 ---- a/sound/usb/quirks-table.h -+++ b/sound/usb/quirks-table.h -@@ -2773,6 +2773,74 @@ YAMAHA_DEVICE(0x7010, "UB99"), - } - }, - -+/* Steinberg devices */ -+{ -+ /* Steinberg MI2 */ -+ USB_DEVICE_VENDOR_SPEC(0x0a4e, 0x2040), -+ .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { -+ .ifnum = QUIRK_ANY_INTERFACE, -+ .type = QUIRK_COMPOSITE, -+ .data = & (const struct snd_usb_audio_quirk[]) { -+ { -+ .ifnum = 0, -+ .type = QUIRK_AUDIO_STANDARD_INTERFACE -+ }, -+ { -+ .ifnum = 1, -+ .type = QUIRK_AUDIO_STANDARD_INTERFACE -+ }, -+ { -+ .ifnum = 2, -+ .type = QUIRK_AUDIO_STANDARD_INTERFACE -+ }, -+ { -+ .ifnum = 3, -+ .type = QUIRK_MIDI_FIXED_ENDPOINT, -+ .data = &(const struct snd_usb_midi_endpoint_info) { -+ .out_cables = 0x0001, -+ .in_cables = 0x0001 -+ } -+ }, -+ { -+ .ifnum = -1 -+ } -+ } -+ } -+}, -+{ -+ /* Steinberg MI4 */ -+ USB_DEVICE_VENDOR_SPEC(0x0a4e, 0x4040), -+ .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { -+ .ifnum = QUIRK_ANY_INTERFACE, -+ .type = QUIRK_COMPOSITE, -+ .data = & (const struct snd_usb_audio_quirk[]) { -+ { -+ .ifnum = 0, -+ .type = QUIRK_AUDIO_STANDARD_INTERFACE -+ }, -+ { -+ .ifnum = 1, -+ .type = QUIRK_AUDIO_STANDARD_INTERFACE -+ }, -+ { -+ .ifnum = 2, -+ .type = QUIRK_AUDIO_STANDARD_INTERFACE -+ }, -+ { -+ .ifnum = 3, -+ .type = QUIRK_MIDI_FIXED_ENDPOINT, -+ .data = &(const struct snd_usb_midi_endpoint_info) { -+ .out_cables = 0x0001, -+ .in_cables = 0x0001 -+ } -+ }, -+ { -+ .ifnum = -1 -+ } -+ } -+ } -+}, -+ - /* TerraTec devices */ - { - USB_DEVICE_VENDOR_SPEC(0x0ccd, 0x0012), diff --git a/patch/kernel/marvell-default/1-patch-3.10.85-86.patch.original b/patch/kernel/marvell-default/1-patch-3.10.85-86.patch.original deleted file mode 100644 index 8046fd5352..0000000000 --- a/patch/kernel/marvell-default/1-patch-3.10.85-86.patch.original +++ /dev/null @@ -1,579 +0,0 @@ -diff --git a/Makefile b/Makefile -index 11a7e7bc31f2..25ee724c9089 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,6 +1,6 @@ - VERSION = 3 - PATCHLEVEL = 10 --SUBLEVEL = 85 -+SUBLEVEL = 86 - EXTRAVERSION = - NAME = TOSSUG Baby Fish - -diff --git a/arch/arc/include/asm/ptrace.h b/arch/arc/include/asm/ptrace.h -index 2046a89a57cf..78485493639a 100644 ---- a/arch/arc/include/asm/ptrace.h -+++ b/arch/arc/include/asm/ptrace.h -@@ -83,7 +83,7 @@ struct callee_regs { - long r13; - }; - --#define instruction_pointer(regs) ((regs)->ret) -+#define instruction_pointer(regs) (unsigned long)((regs)->ret) - #define profile_pc(regs) instruction_pointer(regs) - - /* return 1 if user mode or 0 if kernel mode */ -diff --git a/arch/s390/kernel/sclp.S b/arch/s390/kernel/sclp.S -index 29bd7bec4176..1ecd47b5e250 100644 ---- a/arch/s390/kernel/sclp.S -+++ b/arch/s390/kernel/sclp.S -@@ -276,6 +276,8 @@ ENTRY(_sclp_print_early) - jno .Lesa2 - ahi %r15,-80 - stmh %r6,%r15,96(%r15) # store upper register halves -+ basr %r13,0 -+ lmh %r0,%r15,.Lzeroes-.(%r13) # clear upper register halves - .Lesa2: - #endif - lr %r10,%r2 # save string pointer -@@ -299,6 +301,8 @@ ENTRY(_sclp_print_early) - #endif - lm %r6,%r15,120(%r15) # restore registers - br %r14 -+.Lzeroes: -+ .fill 64,4,0 - - .LwritedataS4: - .long 0x00760005 # SCLP command for write data -diff --git a/arch/tile/kernel/setup.c b/arch/tile/kernel/setup.c -index 7a5aa1a7864e..5ebe93676201 100644 ---- a/arch/tile/kernel/setup.c -+++ b/arch/tile/kernel/setup.c -@@ -1064,7 +1064,7 @@ static void __init load_hv_initrd(void) - - void __init free_initrd_mem(unsigned long begin, unsigned long end) - { -- free_bootmem(__pa(begin), end - begin); -+ free_bootmem_late(__pa(begin), end - begin); - } - - #else -diff --git a/arch/x86/boot/compressed/head_32.S b/arch/x86/boot/compressed/head_32.S -index abb988a54c69..3b28eff9b90b 100644 ---- a/arch/x86/boot/compressed/head_32.S -+++ b/arch/x86/boot/compressed/head_32.S -@@ -54,7 +54,7 @@ ENTRY(efi_pe_entry) - call reloc - reloc: - popl %ecx -- subl reloc, %ecx -+ subl $reloc, %ecx - movl %ecx, BP_code32_start(%eax) - - sub $0x4, %esp -diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c -index 1ff8e97f853a..8c4e81ac5e75 100644 ---- a/block/blk-cgroup.c -+++ b/block/blk-cgroup.c -@@ -720,8 +720,12 @@ int blkg_conf_prep(struct blkcg *blkcg, const struct blkcg_policy *pol, - return -EINVAL; - - disk = get_gendisk(MKDEV(major, minor), &part); -- if (!disk || part) -+ if (!disk) - return -EINVAL; -+ if (part) { -+ put_disk(disk); -+ return -EINVAL; -+ } - - rcu_read_lock(); - spin_lock_irq(disk->queue->queue_lock); -diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c -index 5f87bed05467..20aef5d5a242 100644 ---- a/drivers/input/touchscreen/usbtouchscreen.c -+++ b/drivers/input/touchscreen/usbtouchscreen.c -@@ -626,6 +626,9 @@ static int dmc_tsc10_init(struct usbtouch_usb *usbtouch) - goto err_out; - } - -+ /* TSC-25 data sheet specifies a delay after the RESET command */ -+ msleep(150); -+ - /* set coordinate output rate */ - buf[0] = buf[1] = 0xFF; - ret = usb_control_msg(dev, usb_rcvctrlpipe (dev, 0), -diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c -index 86ac4a4ccc01..fa58438b298a 100644 ---- a/drivers/md/raid1.c -+++ b/drivers/md/raid1.c -@@ -327,7 +327,7 @@ static void raid1_end_read_request(struct bio *bio, int error) - spin_lock_irqsave(&conf->device_lock, flags); - if (r1_bio->mddev->degraded == conf->raid_disks || - (r1_bio->mddev->degraded == conf->raid_disks-1 && -- !test_bit(Faulty, &conf->mirrors[mirror].rdev->flags))) -+ test_bit(In_sync, &conf->mirrors[mirror].rdev->flags))) - uptodate = 1; - spin_unlock_irqrestore(&conf->device_lock, flags); - } -diff --git a/drivers/mmc/host/sdhci-esdhc.h b/drivers/mmc/host/sdhci-esdhc.h -index d25f9ab9a54d..d33bb9522416 100644 ---- a/drivers/mmc/host/sdhci-esdhc.h -+++ b/drivers/mmc/host/sdhci-esdhc.h -@@ -40,7 +40,7 @@ - #define ESDHC_DMA_SYSCTL 0x40c - #define ESDHC_DMA_SNOOP 0x00000040 - --#define ESDHC_HOST_CONTROL_RES 0x05 -+#define ESDHC_HOST_CONTROL_RES 0x01 - - static inline void esdhc_set_clock(struct sdhci_host *host, unsigned int clock) - { -diff --git a/drivers/mmc/host/sdhci-pxav3.c b/drivers/mmc/host/sdhci-pxav3.c -index 4edb24bf56f8..c24fbc574cf1 100644 ---- a/drivers/mmc/host/sdhci-pxav3.c -+++ b/drivers/mmc/host/sdhci-pxav3.c -@@ -255,6 +255,7 @@ static int sdhci_pxav3_probe(struct platform_device *pdev) - mmc_of_parse(host->mmc); - sdhci_get_of_property(pdev); - pdata = pxav3_get_mmc_pdata(dev); -+ pdev->dev.platform_data = pdata; - } else if (pdata) { - /* on-chip device */ - if (pdata->flags & PXA_FLAG_CARD_PERMANENT) -diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c -index 2a32036a9404..fa9811200c9d 100644 ---- a/drivers/scsi/st.c -+++ b/drivers/scsi/st.c -@@ -1262,9 +1262,9 @@ static int st_open(struct inode *inode, struct file *filp) - spin_lock(&st_use_lock); - STp->in_use = 0; - spin_unlock(&st_use_lock); -- scsi_tape_put(STp); - if (resumed) - scsi_autopm_put_device(STp->device); -+ scsi_tape_put(STp); - return retval; - - } -diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c -index 3c293ad6ae70..efca110342cb 100644 ---- a/drivers/target/iscsi/iscsi_target.c -+++ b/drivers/target/iscsi/iscsi_target.c -@@ -4416,7 +4416,18 @@ static void iscsit_logout_post_handler_closesession( - struct iscsi_conn *conn) - { - struct iscsi_session *sess = conn->sess; -- int sleep = cmpxchg(&conn->tx_thread_active, true, false); -+ int sleep = 1; -+ /* -+ * Traditional iscsi/tcp will invoke this logic from TX thread -+ * context during session logout, so clear tx_thread_active and -+ * sleep if iscsit_close_connection() has not already occured. -+ * -+ * Since iser-target invokes this logic from it's own workqueue, -+ * always sleep waiting for RX/TX thread shutdown to complete -+ * within iscsit_close_connection(). -+ */ -+ if (conn->conn_transport->transport_type == ISCSI_TCP) -+ sleep = cmpxchg(&conn->tx_thread_active, true, false); - - atomic_set(&conn->conn_logout_remove, 0); - complete(&conn->conn_logout_comp); -@@ -4430,7 +4441,10 @@ static void iscsit_logout_post_handler_closesession( - static void iscsit_logout_post_handler_samecid( - struct iscsi_conn *conn) - { -- int sleep = cmpxchg(&conn->tx_thread_active, true, false); -+ int sleep = 1; -+ -+ if (conn->conn_transport->transport_type == ISCSI_TCP) -+ sleep = cmpxchg(&conn->tx_thread_active, true, false); - - atomic_set(&conn->conn_logout_remove, 0); - complete(&conn->conn_logout_comp); -@@ -4649,6 +4663,7 @@ int iscsit_release_sessions_for_tpg(struct iscsi_portal_group *tpg, int force) - struct iscsi_session *sess; - struct se_portal_group *se_tpg = &tpg->tpg_se_tpg; - struct se_session *se_sess, *se_sess_tmp; -+ LIST_HEAD(free_list); - int session_count = 0; - - spin_lock_bh(&se_tpg->session_lock); -@@ -4670,14 +4685,17 @@ int iscsit_release_sessions_for_tpg(struct iscsi_portal_group *tpg, int force) - } - atomic_set(&sess->session_reinstatement, 1); - spin_unlock(&sess->conn_lock); -- spin_unlock_bh(&se_tpg->session_lock); - -- iscsit_free_session(sess); -- spin_lock_bh(&se_tpg->session_lock); -+ list_move_tail(&se_sess->sess_list, &free_list); -+ } -+ spin_unlock_bh(&se_tpg->session_lock); - -+ list_for_each_entry_safe(se_sess, se_sess_tmp, &free_list, sess_list) { -+ sess = (struct iscsi_session *)se_sess->fabric_sess_ptr; -+ -+ iscsit_free_session(sess); - session_count++; - } -- spin_unlock_bh(&se_tpg->session_lock); - - pr_debug("Released %d iSCSI Session(s) from Target Portal" - " Group: %hu\n", session_count, tpg->tpgt); -diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c -index d939376c5dee..0f71c3a22507 100644 ---- a/drivers/usb/host/xhci-hub.c -+++ b/drivers/usb/host/xhci-hub.c -@@ -468,10 +468,13 @@ static void xhci_hub_report_link_state(struct xhci_hcd *xhci, - u32 pls = status_reg & PORT_PLS_MASK; - - /* resume state is a xHCI internal state. -- * Do not report it to usb core. -+ * Do not report it to usb core, instead, pretend to be U3, -+ * thus usb core knows it's not ready for transfer - */ -- if (pls == XDEV_RESUME) -+ if (pls == XDEV_RESUME) { -+ *status |= USB_SS_PORT_LS_U3; - return; -+ } - - /* When the CAS bit is set then warm reset - * should be performed on port -@@ -1045,10 +1048,10 @@ int xhci_bus_suspend(struct usb_hcd *hcd) - spin_lock_irqsave(&xhci->lock, flags); - - if (hcd->self.root_hub->do_remote_wakeup) { -- if (bus_state->resuming_ports) { -+ if (bus_state->resuming_ports || /* USB2 */ -+ bus_state->port_remote_wakeup) { /* USB3 */ - spin_unlock_irqrestore(&xhci->lock, flags); -- xhci_dbg(xhci, "suspend failed because " -- "a port is resuming\n"); -+ xhci_dbg(xhci, "suspend failed because a port is resuming\n"); - return -EBUSY; - } - } -diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c -index 30533952b4a3..95fe1a432d29 100644 ---- a/drivers/usb/host/xhci-ring.c -+++ b/drivers/usb/host/xhci-ring.c -@@ -1669,6 +1669,9 @@ static void handle_port_status(struct xhci_hcd *xhci, - usb_hcd_resume_root_hub(hcd); - } - -+ if (hcd->speed == HCD_USB3 && (temp & PORT_PLS_MASK) == XDEV_INACTIVE) -+ bus_state->port_remote_wakeup &= ~(1 << faked_port_index); -+ - if ((temp & PORT_PLC) && (temp & PORT_PLS_MASK) == XDEV_RESUME) { - xhci_dbg(xhci, "port resume event for port %d\n", port_id); - -diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c -index 10223f2b18d2..1f901fc25590 100644 ---- a/drivers/usb/host/xhci.c -+++ b/drivers/usb/host/xhci.c -@@ -3356,6 +3356,9 @@ int xhci_discover_or_reset_device(struct usb_hcd *hcd, struct usb_device *udev) - return -EINVAL; - } - -+ if (virt_dev->tt_info) -+ old_active_eps = virt_dev->tt_info->active_eps; -+ - if (virt_dev->udev != udev) { - /* If the virt_dev and the udev does not match, this virt_dev - * may belong to another udev. -diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h -index ed8de724b285..deb2537ae75c 100644 ---- a/drivers/usb/host/xhci.h -+++ b/drivers/usb/host/xhci.h -@@ -280,6 +280,7 @@ struct xhci_op_regs { - #define XDEV_U0 (0x0 << 5) - #define XDEV_U2 (0x2 << 5) - #define XDEV_U3 (0x3 << 5) -+#define XDEV_INACTIVE (0x6 << 5) - #define XDEV_RESUME (0xf << 5) - /* true: port has power (see HCC_PPC) */ - #define PORT_POWER (1 << 9) -diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h -index 821e1e2f70f6..da380a99c6b8 100644 ---- a/drivers/usb/storage/unusual_devs.h -+++ b/drivers/usb/storage/unusual_devs.h -@@ -2032,6 +2032,18 @@ UNUSUAL_DEV( 0x1908, 0x3335, 0x0200, 0x0200, - USB_SC_DEVICE, USB_PR_DEVICE, NULL, - US_FL_NO_READ_DISC_INFO ), - -+/* Reported by Oliver Neukum -+ * This device morphes spontaneously into another device if the access -+ * pattern of Windows isn't followed. Thus writable media would be dirty -+ * if the initial instance is used. So the device is limited to its -+ * virtual CD. -+ * And yes, the concept that BCD goes up to 9 is not heeded */ -+UNUSUAL_DEV( 0x19d2, 0x1225, 0x0000, 0xffff, -+ "ZTE,Incorporated", -+ "ZTE WCDMA Technologies MSM", -+ USB_SC_DEVICE, USB_PR_DEVICE, NULL, -+ US_FL_SINGLE_LUN ), -+ - /* Reported by Sven Geggus - * This encrypted pen drive returns bogus data for the initial READ(10). - */ -diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c -index 60aa5ad09a2f..3aabc652f1b9 100644 ---- a/drivers/vhost/vhost.c -+++ b/drivers/vhost/vhost.c -@@ -855,6 +855,7 @@ long vhost_dev_ioctl(struct vhost_dev *d, unsigned int ioctl, void __user *argp) - } - if (eventfp != d->log_file) { - filep = d->log_file; -+ d->log_file = eventfp; - ctx = d->log_ctx; - d->log_ctx = eventfp ? - eventfd_ctx_fileget(eventfp) : NULL; -diff --git a/fs/dcache.c b/fs/dcache.c -index 38c4a302fab4..90be2809e15a 100644 ---- a/fs/dcache.c -+++ b/fs/dcache.c -@@ -520,6 +520,9 @@ repeat: - return; - } - -+ if (unlikely(dentry->d_flags & DCACHE_DISCONNECTED)) -+ goto kill_it; -+ - if (dentry->d_flags & DCACHE_OP_DELETE) { - if (dentry->d_op->d_delete(dentry)) - goto kill_it; -diff --git a/kernel/irq/resend.c b/kernel/irq/resend.c -index 9065107f083e..7a5237a1bce5 100644 ---- a/kernel/irq/resend.c -+++ b/kernel/irq/resend.c -@@ -75,13 +75,21 @@ void check_irq_resend(struct irq_desc *desc, unsigned int irq) - !desc->irq_data.chip->irq_retrigger(&desc->irq_data)) { - #ifdef CONFIG_HARDIRQS_SW_RESEND - /* -- * If the interrupt has a parent irq and runs -- * in the thread context of the parent irq, -- * retrigger the parent. -+ * If the interrupt is running in the thread -+ * context of the parent irq we need to be -+ * careful, because we cannot trigger it -+ * directly. - */ -- if (desc->parent_irq && -- irq_settings_is_nested_thread(desc)) -+ if (irq_settings_is_nested_thread(desc)) { -+ /* -+ * If the parent_irq is valid, we -+ * retrigger the parent, otherwise we -+ * do nothing. -+ */ -+ if (!desc->parent_irq) -+ return; - irq = desc->parent_irq; -+ } - /* Set it pending and activate the softirq: */ - set_bit(irq, irqs_resend); - tasklet_schedule(&resend_tasklet); -diff --git a/mm/memory.c b/mm/memory.c -index e6b1da3a8924..30bf9cce8c2b 100644 ---- a/mm/memory.c -+++ b/mm/memory.c -@@ -3230,6 +3230,10 @@ static int do_anonymous_page(struct mm_struct *mm, struct vm_area_struct *vma, - - pte_unmap(page_table); - -+ /* File mapping without ->vm_ops ? */ -+ if (vma->vm_flags & VM_SHARED) -+ return VM_FAULT_SIGBUS; -+ - /* Check if we need to add a guard page to the stack */ - if (check_stack_guard_page(vma, address) < 0) - return VM_FAULT_SIGSEGV; -@@ -3495,6 +3499,9 @@ static int do_linear_fault(struct mm_struct *mm, struct vm_area_struct *vma, - - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff; - - pte_unmap(page_table); -+ /* The VMA was not fully populated on mmap() or missing VM_DONTEXPAND */ -+ if (!vma->vm_ops->fault) -+ return VM_FAULT_SIGBUS; - return __do_fault(mm, vma, address, pmd, pgoff, flags, orig_pte); - } - -@@ -3706,11 +3713,9 @@ int handle_pte_fault(struct mm_struct *mm, - entry = *pte; - if (!pte_present(entry)) { - if (pte_none(entry)) { -- if (vma->vm_ops) { -- if (likely(vma->vm_ops->fault)) -- return do_linear_fault(mm, vma, address, -+ if (vma->vm_ops) -+ return do_linear_fault(mm, vma, address, - pte, pmd, flags, entry); -- } - return do_anonymous_page(mm, vma, address, - pte, pmd, flags); - } -diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c -index 2d5b4f65c519..32bafdbdfd66 100644 ---- a/net/mac80211/debugfs_netdev.c -+++ b/net/mac80211/debugfs_netdev.c -@@ -697,6 +697,7 @@ void ieee80211_debugfs_remove_netdev(struct ieee80211_sub_if_data *sdata) - - debugfs_remove_recursive(sdata->vif.debugfs_dir); - sdata->vif.debugfs_dir = NULL; -+ sdata->debugfs.subdir_stations = NULL; - } - - void ieee80211_debugfs_rename_netdev(struct ieee80211_sub_if_data *sdata) -diff --git a/net/rds/ib_rdma.c b/net/rds/ib_rdma.c -index e8fdb172adbb..a985158d95d5 100644 ---- a/net/rds/ib_rdma.c -+++ b/net/rds/ib_rdma.c -@@ -759,8 +759,10 @@ void *rds_ib_get_mr(struct scatterlist *sg, unsigned long nents, - } - - ibmr = rds_ib_alloc_fmr(rds_ibdev); -- if (IS_ERR(ibmr)) -+ if (IS_ERR(ibmr)) { -+ rds_ib_dev_put(rds_ibdev); - return ibmr; -+ } - - ret = rds_ib_map_fmr(rds_ibdev, ibmr, sg, nents); - if (ret == 0) -diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c -index a82d6576fe0f..d30252e7f3e8 100644 ---- a/sound/pci/hda/patch_realtek.c -+++ b/sound/pci/hda/patch_realtek.c -@@ -2204,7 +2204,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = { - SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF), - SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF), - SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF), -- SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_IMAC91_VREF), -+ SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF), - - SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD), - SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD), -diff --git a/sound/usb/mixer_maps.c b/sound/usb/mixer_maps.c -index d06fbd9f7cbe..2d17f40fb16d 100644 ---- a/sound/usb/mixer_maps.c -+++ b/sound/usb/mixer_maps.c -@@ -330,6 +330,20 @@ static const struct usbmix_name_map scms_usb3318_map[] = { - { 0 } - }; - -+/* Bose companion 5, the dB conversion factor is 16 instead of 256 */ -+static struct usbmix_dB_map bose_companion5_dB = {-5006, -6}; -+static struct usbmix_name_map bose_companion5_map[] = { -+ { 3, NULL, .dB = &bose_companion5_dB }, -+ { 0 } /* terminator */ -+}; -+ -+/* Dragonfly DAC 1.2, the dB conversion factor is 1 instead of 256 */ -+static struct usbmix_dB_map dragonfly_1_2_dB = {0, 5000}; -+static struct usbmix_name_map dragonfly_1_2_map[] = { -+ { 7, NULL, .dB = &dragonfly_1_2_dB }, -+ { 0 } /* terminator */ -+}; -+ - /* - * Control map entries - */ -@@ -432,6 +446,16 @@ static struct usbmix_ctl_map usbmix_ctl_maps[] = { - .id = USB_ID(0x25c4, 0x0003), - .map = scms_usb3318_map, - }, -+ { -+ /* Bose Companion 5 */ -+ .id = USB_ID(0x05a7, 0x1020), -+ .map = bose_companion5_map, -+ }, -+ { -+ /* Dragonfly DAC 1.2 */ -+ .id = USB_ID(0x21b4, 0x0081), -+ .map = dragonfly_1_2_map, -+ }, - { 0 } /* terminator */ - }; - -diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h -index d5bed1d25713..45d586b6e8b5 100644 ---- a/sound/usb/quirks-table.h -+++ b/sound/usb/quirks-table.h -@@ -2773,6 +2773,74 @@ YAMAHA_DEVICE(0x7010, "UB99"), - } - }, - -+/* Steinberg devices */ -+{ -+ /* Steinberg MI2 */ -+ USB_DEVICE_VENDOR_SPEC(0x0a4e, 0x2040), -+ .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { -+ .ifnum = QUIRK_ANY_INTERFACE, -+ .type = QUIRK_COMPOSITE, -+ .data = & (const struct snd_usb_audio_quirk[]) { -+ { -+ .ifnum = 0, -+ .type = QUIRK_AUDIO_STANDARD_INTERFACE -+ }, -+ { -+ .ifnum = 1, -+ .type = QUIRK_AUDIO_STANDARD_INTERFACE -+ }, -+ { -+ .ifnum = 2, -+ .type = QUIRK_AUDIO_STANDARD_INTERFACE -+ }, -+ { -+ .ifnum = 3, -+ .type = QUIRK_MIDI_FIXED_ENDPOINT, -+ .data = &(const struct snd_usb_midi_endpoint_info) { -+ .out_cables = 0x0001, -+ .in_cables = 0x0001 -+ } -+ }, -+ { -+ .ifnum = -1 -+ } -+ } -+ } -+}, -+{ -+ /* Steinberg MI4 */ -+ USB_DEVICE_VENDOR_SPEC(0x0a4e, 0x4040), -+ .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { -+ .ifnum = QUIRK_ANY_INTERFACE, -+ .type = QUIRK_COMPOSITE, -+ .data = & (const struct snd_usb_audio_quirk[]) { -+ { -+ .ifnum = 0, -+ .type = QUIRK_AUDIO_STANDARD_INTERFACE -+ }, -+ { -+ .ifnum = 1, -+ .type = QUIRK_AUDIO_STANDARD_INTERFACE -+ }, -+ { -+ .ifnum = 2, -+ .type = QUIRK_AUDIO_STANDARD_INTERFACE -+ }, -+ { -+ .ifnum = 3, -+ .type = QUIRK_MIDI_FIXED_ENDPOINT, -+ .data = &(const struct snd_usb_midi_endpoint_info) { -+ .out_cables = 0x0001, -+ .in_cables = 0x0001 -+ } -+ }, -+ { -+ .ifnum = -1 -+ } -+ } -+ } -+}, -+ - /* TerraTec devices */ - { - USB_DEVICE_VENDOR_SPEC(0x0ccd, 0x0012), diff --git a/patch/kernel/marvell-default/1-patch-3.10.86-87.patch b/patch/kernel/marvell-default/1-patch-3.10.86-87.patch deleted file mode 100644 index c17a77dd6f..0000000000 --- a/patch/kernel/marvell-default/1-patch-3.10.86-87.patch +++ /dev/null @@ -1,1317 +0,0 @@ -diff --git a/Makefile b/Makefile -index 25ee724c9089..0d4fd6427349 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,6 +1,6 @@ - VERSION = 3 - PATCHLEVEL = 10 --SUBLEVEL = 86 -+SUBLEVEL = 87 - EXTRAVERSION = - NAME = TOSSUG Baby Fish - -diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S -index 32640ae7750f..03a1e26ba3a3 100644 ---- a/arch/arm/kernel/entry-armv.S -+++ b/arch/arm/kernel/entry-armv.S -@@ -358,7 +358,8 @@ ENDPROC(__pabt_svc) - .endm - - .macro kuser_cmpxchg_check --#if !defined(CONFIG_CPU_32v6K) && !defined(CONFIG_NEEDS_SYSCALL_FOR_CMPXCHG) -+#if !defined(CONFIG_CPU_32v6K) && defined(CONFIG_KUSER_HELPERS) && \ -+ !defined(CONFIG_NEEDS_SYSCALL_FOR_CMPXCHG) - #ifndef CONFIG_MMU - #warning "NPTL on non MMU needs fixing" - #else -diff --git a/arch/arm/kernel/fiq.c b/arch/arm/kernel/fiq.c -index 25442f451148..918875d96d5d 100644 ---- a/arch/arm/kernel/fiq.c -+++ b/arch/arm/kernel/fiq.c -@@ -84,17 +84,14 @@ int show_fiq_list(struct seq_file *p, int prec) - - void set_fiq_handler(void *start, unsigned int length) - { --#if defined(CONFIG_CPU_USE_DOMAINS) -- void *base = (void *)0xffff0000; --#else - void *base = vectors_page; --#endif - unsigned offset = FIQ_OFFSET; - - memcpy(base + offset, start, length); -+ if (!cache_is_vipt_nonaliasing()) -+ flush_icache_range((unsigned long)base + offset, offset + -+ length); - flush_icache_range(0xffff0000 + offset, 0xffff0000 + offset + length); -- if (!vectors_high()) -- flush_icache_range(offset, offset + length); - } - - int claim_fiq(struct fiq_handler *f) -diff --git a/arch/arm/mach-realview/include/mach/memory.h b/arch/arm/mach-realview/include/mach/memory.h -index 2022e092f0ca..db09170e3832 100644 ---- a/arch/arm/mach-realview/include/mach/memory.h -+++ b/arch/arm/mach-realview/include/mach/memory.h -@@ -56,6 +56,8 @@ - #define PAGE_OFFSET1 (PAGE_OFFSET + 0x10000000) - #define PAGE_OFFSET2 (PAGE_OFFSET + 0x30000000) - -+#define PHYS_OFFSET PLAT_PHYS_OFFSET -+ - #define __phys_to_virt(phys) \ - ((phys) >= 0x80000000 ? (phys) - 0x80000000 + PAGE_OFFSET2 : \ - (phys) >= 0x20000000 ? (phys) - 0x20000000 + PAGE_OFFSET1 : \ -diff --git a/arch/arm64/kernel/signal32.c b/arch/arm64/kernel/signal32.c -index 3d478102b1c0..b9564b8d6bab 100644 ---- a/arch/arm64/kernel/signal32.c -+++ b/arch/arm64/kernel/signal32.c -@@ -193,7 +193,8 @@ int copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from) - * Other callers might not initialize the si_lsb field, - * so check explicitely for the right codes here. - */ -- if (from->si_code == BUS_MCEERR_AR || from->si_code == BUS_MCEERR_AO) -+ if (from->si_signo == SIGBUS && -+ (from->si_code == BUS_MCEERR_AR || from->si_code == BUS_MCEERR_AO)) - err |= __put_user(from->si_addr_lsb, &to->si_addr_lsb); - #endif - break; -@@ -220,8 +221,6 @@ int copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from) - - int copy_siginfo_from_user32(siginfo_t *to, compat_siginfo_t __user *from) - { -- memset(to, 0, sizeof *to); -- - if (copy_from_user(to, from, __ARCH_SI_PREAMBLE_SIZE) || - copy_from_user(to->_sifields._pad, - from->_sifields._pad, SI_PAD_SIZE)) -diff --git a/arch/mips/include/asm/pgtable.h b/arch/mips/include/asm/pgtable.h -index 8b8f6b393363..e821de7cb14e 100644 ---- a/arch/mips/include/asm/pgtable.h -+++ b/arch/mips/include/asm/pgtable.h -@@ -150,8 +150,39 @@ static inline void set_pte(pte_t *ptep, pte_t pteval) - * Make sure the buddy is global too (if it's !none, - * it better already be global) - */ -+#ifdef CONFIG_SMP -+ /* -+ * For SMP, multiple CPUs can race, so we need to do -+ * this atomically. -+ */ -+#ifdef CONFIG_64BIT -+#define LL_INSN "lld" -+#define SC_INSN "scd" -+#else /* CONFIG_32BIT */ -+#define LL_INSN "ll" -+#define SC_INSN "sc" -+#endif -+ unsigned long page_global = _PAGE_GLOBAL; -+ unsigned long tmp; -+ -+ __asm__ __volatile__ ( -+ " .set push\n" -+ " .set noreorder\n" -+ "1: " LL_INSN " %[tmp], %[buddy]\n" -+ " bnez %[tmp], 2f\n" -+ " or %[tmp], %[tmp], %[global]\n" -+ " " SC_INSN " %[tmp], %[buddy]\n" -+ " beqz %[tmp], 1b\n" -+ " nop\n" -+ "2:\n" -+ " .set pop" -+ : [buddy] "+m" (buddy->pte), -+ [tmp] "=&r" (tmp) -+ : [global] "r" (page_global)); -+#else /* !CONFIG_SMP */ - if (pte_none(*buddy)) - pte_val(*buddy) = pte_val(*buddy) | _PAGE_GLOBAL; -+#endif /* CONFIG_SMP */ - } - #endif - } -diff --git a/arch/mips/kernel/mips-mt-fpaff.c b/arch/mips/kernel/mips-mt-fpaff.c -index fd814e08c945..0f3e030f232b 100644 ---- a/arch/mips/kernel/mips-mt-fpaff.c -+++ b/arch/mips/kernel/mips-mt-fpaff.c -@@ -154,7 +154,7 @@ asmlinkage long mipsmt_sys_sched_getaffinity(pid_t pid, unsigned int len, - unsigned long __user *user_mask_ptr) - { - unsigned int real_len; -- cpumask_t mask; -+ cpumask_t allowed, mask; - int retval; - struct task_struct *p; - -@@ -173,7 +173,8 @@ asmlinkage long mipsmt_sys_sched_getaffinity(pid_t pid, unsigned int len, - if (retval) - goto out_unlock; - -- cpumask_and(&mask, &p->thread.user_cpus_allowed, cpu_possible_mask); -+ cpumask_or(&allowed, &p->thread.user_cpus_allowed, &p->cpus_allowed); -+ cpumask_and(&mask, &allowed, cpu_active_mask); - - out_unlock: - read_unlock(&tasklist_lock); -diff --git a/arch/mips/kernel/signal32.c b/arch/mips/kernel/signal32.c -index 57de8b751627..41f8708d21a8 100644 ---- a/arch/mips/kernel/signal32.c -+++ b/arch/mips/kernel/signal32.c -@@ -368,8 +368,6 @@ int copy_siginfo_to_user32(compat_siginfo_t __user *to, siginfo_t *from) - - int copy_siginfo_from_user32(siginfo_t *to, compat_siginfo_t __user *from) - { -- memset(to, 0, sizeof *to); -- - if (copy_from_user(to, from, 3*sizeof(int)) || - copy_from_user(to->_sifields._pad, - from->_sifields._pad, SI_PAD_SIZE32)) -diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c -index 81f929f026f2..d9b673b06757 100644 ---- a/arch/powerpc/kernel/signal_32.c -+++ b/arch/powerpc/kernel/signal_32.c -@@ -949,8 +949,6 @@ int copy_siginfo_to_user32(struct compat_siginfo __user *d, siginfo_t *s) - - int copy_siginfo_from_user32(siginfo_t *to, struct compat_siginfo __user *from) - { -- memset(to, 0, sizeof *to); -- - if (copy_from_user(to, from, 3*sizeof(int)) || - copy_from_user(to->_sifields._pad, - from->_sifields._pad, SI_PAD_SIZE32)) -diff --git a/arch/sparc/include/asm/visasm.h b/arch/sparc/include/asm/visasm.h -index 39ca301920db..50d6f16a1513 100644 ---- a/arch/sparc/include/asm/visasm.h -+++ b/arch/sparc/include/asm/visasm.h -@@ -28,18 +28,20 @@ - * Must preserve %o5 between VISEntryHalf and VISExitHalf */ - - #define VISEntryHalf \ -+ VISEntry -+ -+#define VISExitHalf \ -+ VISExit -+ -+#define VISEntryHalfFast(fail_label) \ - rd %fprs, %o5; \ - andcc %o5, FPRS_FEF, %g0; \ - be,pt %icc, 297f; \ -- sethi %hi(298f), %g7; \ -- sethi %hi(VISenterhalf), %g1; \ -- jmpl %g1 + %lo(VISenterhalf), %g0; \ -- or %g7, %lo(298f), %g7; \ -- clr %o5; \ --297: wr %o5, FPRS_FEF, %fprs; \ --298: -+ nop; \ -+ ba,a,pt %xcc, fail_label; \ -+297: wr %o5, FPRS_FEF, %fprs; - --#define VISExitHalf \ -+#define VISExitHalfFast \ - wr %o5, 0, %fprs; - - #ifndef __ASSEMBLY__ -diff --git a/arch/sparc/lib/NG4memcpy.S b/arch/sparc/lib/NG4memcpy.S -index 9cf2ee01cee3..83aeeb1dffdb 100644 ---- a/arch/sparc/lib/NG4memcpy.S -+++ b/arch/sparc/lib/NG4memcpy.S -@@ -41,6 +41,10 @@ - #endif - #endif - -+#if !defined(EX_LD) && !defined(EX_ST) -+#define NON_USER_COPY -+#endif -+ - #ifndef EX_LD - #define EX_LD(x) x - #endif -@@ -197,9 +201,13 @@ FUNC_NAME: /* %o0=dst, %o1=src, %o2=len */ - mov EX_RETVAL(%o3), %o0 - - .Llarge_src_unaligned: -+#ifdef NON_USER_COPY -+ VISEntryHalfFast(.Lmedium_vis_entry_fail) -+#else -+ VISEntryHalf -+#endif - andn %o2, 0x3f, %o4 - sub %o2, %o4, %o2 -- VISEntryHalf - alignaddr %o1, %g0, %g1 - add %o1, %o4, %o1 - EX_LD(LOAD(ldd, %g1 + 0x00, %f0)) -@@ -232,14 +240,21 @@ FUNC_NAME: /* %o0=dst, %o1=src, %o2=len */ - add %o0, 0x40, %o0 - bne,pt %icc, 1b - LOAD(prefetch, %g1 + 0x200, #n_reads_strong) -+#ifdef NON_USER_COPY -+ VISExitHalfFast -+#else - VISExitHalf -- -+#endif - brz,pn %o2, .Lexit - cmp %o2, 19 - ble,pn %icc, .Lsmall_unaligned - nop - ba,a,pt %icc, .Lmedium_unaligned - -+#ifdef NON_USER_COPY -+.Lmedium_vis_entry_fail: -+ or %o0, %o1, %g2 -+#endif - .Lmedium: - LOAD(prefetch, %o1 + 0x40, #n_reads_strong) - andcc %g2, 0x7, %g0 -diff --git a/arch/sparc/lib/VISsave.S b/arch/sparc/lib/VISsave.S -index b320ae9e2e2e..a063d84336d6 100644 ---- a/arch/sparc/lib/VISsave.S -+++ b/arch/sparc/lib/VISsave.S -@@ -44,9 +44,8 @@ vis1: ldub [%g6 + TI_FPSAVED], %g3 - - stx %g3, [%g6 + TI_GSR] - 2: add %g6, %g1, %g3 -- cmp %o5, FPRS_DU -- be,pn %icc, 6f -- sll %g1, 3, %g1 -+ mov FPRS_DU | FPRS_DL | FPRS_FEF, %o5 -+ sll %g1, 3, %g1 - stb %o5, [%g3 + TI_FPSAVED] - rd %gsr, %g2 - add %g6, %g1, %g3 -@@ -80,65 +79,3 @@ vis1: ldub [%g6 + TI_FPSAVED], %g3 - .align 32 - 80: jmpl %g7 + %g0, %g0 - nop -- --6: ldub [%g3 + TI_FPSAVED], %o5 -- or %o5, FPRS_DU, %o5 -- add %g6, TI_FPREGS+0x80, %g2 -- stb %o5, [%g3 + TI_FPSAVED] -- -- sll %g1, 5, %g1 -- add %g6, TI_FPREGS+0xc0, %g3 -- wr %g0, FPRS_FEF, %fprs -- membar #Sync -- stda %f32, [%g2 + %g1] ASI_BLK_P -- stda %f48, [%g3 + %g1] ASI_BLK_P -- membar #Sync -- ba,pt %xcc, 80f -- nop -- -- .align 32 --80: jmpl %g7 + %g0, %g0 -- nop -- -- .align 32 --VISenterhalf: -- ldub [%g6 + TI_FPDEPTH], %g1 -- brnz,a,pn %g1, 1f -- cmp %g1, 1 -- stb %g0, [%g6 + TI_FPSAVED] -- stx %fsr, [%g6 + TI_XFSR] -- clr %o5 -- jmpl %g7 + %g0, %g0 -- wr %g0, FPRS_FEF, %fprs -- --1: bne,pn %icc, 2f -- srl %g1, 1, %g1 -- ba,pt %xcc, vis1 -- sub %g7, 8, %g7 --2: addcc %g6, %g1, %g3 -- sll %g1, 3, %g1 -- andn %o5, FPRS_DU, %g2 -- stb %g2, [%g3 + TI_FPSAVED] -- -- rd %gsr, %g2 -- add %g6, %g1, %g3 -- stx %g2, [%g3 + TI_GSR] -- add %g6, %g1, %g2 -- stx %fsr, [%g2 + TI_XFSR] -- sll %g1, 5, %g1 --3: andcc %o5, FPRS_DL, %g0 -- be,pn %icc, 4f -- add %g6, TI_FPREGS, %g2 -- -- add %g6, TI_FPREGS+0x40, %g3 -- membar #Sync -- stda %f0, [%g2 + %g1] ASI_BLK_P -- stda %f16, [%g3 + %g1] ASI_BLK_P -- membar #Sync -- ba,pt %xcc, 4f -- nop -- -- .align 32 --4: and %o5, FPRS_DU, %o5 -- jmpl %g7 + %g0, %g0 -- wr %o5, FPRS_FEF, %fprs -diff --git a/arch/sparc/lib/ksyms.c b/arch/sparc/lib/ksyms.c -index 323335b9cd2b..ac094de28ccf 100644 ---- a/arch/sparc/lib/ksyms.c -+++ b/arch/sparc/lib/ksyms.c -@@ -126,10 +126,6 @@ EXPORT_SYMBOL(copy_user_page); - void VISenter(void); - EXPORT_SYMBOL(VISenter); - --/* CRYPTO code needs this */ --void VISenterhalf(void); --EXPORT_SYMBOL(VISenterhalf); -- - extern void xor_vis_2(unsigned long, unsigned long *, unsigned long *); - extern void xor_vis_3(unsigned long, unsigned long *, unsigned long *, - unsigned long *); -diff --git a/arch/x86/kernel/cpu/perf_event_amd.c b/arch/x86/kernel/cpu/perf_event_amd.c -index 7e28d9467bb4..4cbe03287b08 100644 ---- a/arch/x86/kernel/cpu/perf_event_amd.c -+++ b/arch/x86/kernel/cpu/perf_event_amd.c -@@ -648,48 +648,48 @@ static __initconst const struct x86_pmu amd_pmu = { - .cpu_dead = amd_pmu_cpu_dead, - }; - --static int setup_event_constraints(void) -+static int __init amd_core_pmu_init(void) - { -- if (boot_cpu_data.x86 == 0x15) -+ if (!cpu_has_perfctr_core) -+ return 0; -+ -+ switch (boot_cpu_data.x86) { -+ case 0x15: -+ pr_cont("Fam15h "); - x86_pmu.get_event_constraints = amd_get_event_constraints_f15h; -- return 0; --} -+ break; - --static int setup_perfctr_core(void) --{ -- if (!cpu_has_perfctr_core) { -- WARN(x86_pmu.get_event_constraints == amd_get_event_constraints_f15h, -- KERN_ERR "Odd, counter constraints enabled but no core perfctrs detected!"); -+ default: -+ pr_err("core perfctr but no constraints; unknown hardware!\n"); - return -ENODEV; - } - -- WARN(x86_pmu.get_event_constraints == amd_get_event_constraints, -- KERN_ERR "hw perf events core counters need constraints handler!"); -- - /* - * If core performance counter extensions exists, we must use - * MSR_F15H_PERF_CTL/MSR_F15H_PERF_CTR msrs. See also -- * x86_pmu_addr_offset(). -+ * amd_pmu_addr_offset(). - */ - x86_pmu.eventsel = MSR_F15H_PERF_CTL; - x86_pmu.perfctr = MSR_F15H_PERF_CTR; - x86_pmu.num_counters = AMD64_NUM_COUNTERS_CORE; - -- printk(KERN_INFO "perf: AMD core performance counters detected\n"); -- -+ pr_cont("core perfctr, "); - return 0; - } - - __init int amd_pmu_init(void) - { -+ int ret; -+ - /* Performance-monitoring supported from K7 and later: */ - if (boot_cpu_data.x86 < 6) - return -ENODEV; - - x86_pmu = amd_pmu; - -- setup_event_constraints(); -- setup_perfctr_core(); -+ ret = amd_core_pmu_init(); -+ if (ret) -+ return ret; - - /* Events are common for all AMDs */ - memcpy(hw_cache_event_ids, amd_hw_cache_event_ids, -diff --git a/arch/x86/kvm/lapic.h b/arch/x86/kvm/lapic.h -index c8b0d0d2da5c..fc87568fc409 100644 ---- a/arch/x86/kvm/lapic.h -+++ b/arch/x86/kvm/lapic.h -@@ -165,7 +165,7 @@ static inline u16 apic_logical_id(struct kvm_apic_map *map, u32 ldr) - - static inline bool kvm_apic_has_events(struct kvm_vcpu *vcpu) - { -- return vcpu->arch.apic->pending_events; -+ return kvm_vcpu_has_lapic(vcpu) && vcpu->arch.apic->pending_events; - } - - bool kvm_apic_pending_eoi(struct kvm_vcpu *vcpu, int vector); -diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c -index a492be2635ac..13d926282c89 100644 ---- a/arch/x86/xen/enlighten.c -+++ b/arch/x86/xen/enlighten.c -@@ -481,6 +481,7 @@ static void set_aliased_prot(void *v, pgprot_t prot) - pte_t pte; - unsigned long pfn; - struct page *page; -+ unsigned char dummy; - - ptep = lookup_address((unsigned long)v, &level); - BUG_ON(ptep == NULL); -@@ -490,6 +491,32 @@ static void set_aliased_prot(void *v, pgprot_t prot) - - pte = pfn_pte(pfn, prot); - -+ /* -+ * Careful: update_va_mapping() will fail if the virtual address -+ * we're poking isn't populated in the page tables. We don't -+ * need to worry about the direct map (that's always in the page -+ * tables), but we need to be careful about vmap space. In -+ * particular, the top level page table can lazily propagate -+ * entries between processes, so if we've switched mms since we -+ * vmapped the target in the first place, we might not have the -+ * top-level page table entry populated. -+ * -+ * We disable preemption because we want the same mm active when -+ * we probe the target and when we issue the hypercall. We'll -+ * have the same nominal mm, but if we're a kernel thread, lazy -+ * mm dropping could change our pgd. -+ * -+ * Out of an abundance of caution, this uses __get_user() to fault -+ * in the target address just in case there's some obscure case -+ * in which the target address isn't readable. -+ */ -+ -+ preempt_disable(); -+ -+ pagefault_disable(); /* Avoid warnings due to being atomic. */ -+ __get_user(dummy, (unsigned char __user __force *)v); -+ pagefault_enable(); -+ - if (HYPERVISOR_update_va_mapping((unsigned long)v, pte, 0)) - BUG(); - -@@ -501,6 +528,8 @@ static void set_aliased_prot(void *v, pgprot_t prot) - BUG(); - } else - kmap_flush_unused(); -+ -+ preempt_enable(); - } - - static void xen_alloc_ldt(struct desc_struct *ldt, unsigned entries) -@@ -508,6 +537,17 @@ static void xen_alloc_ldt(struct desc_struct *ldt, unsigned entries) - const unsigned entries_per_page = PAGE_SIZE / LDT_ENTRY_SIZE; - int i; - -+ /* -+ * We need to mark the all aliases of the LDT pages RO. We -+ * don't need to call vm_flush_aliases(), though, since that's -+ * only responsible for flushing aliases out the TLBs, not the -+ * page tables, and Xen will flush the TLB for us if needed. -+ * -+ * To avoid confusing future readers: none of this is necessary -+ * to load the LDT. The hypervisor only checks this when the -+ * LDT is faulted in due to subsequent descriptor access. -+ */ -+ - for(i = 0; i < entries; i += entries_per_page) - set_aliased_prot(ldt + i, PAGE_KERNEL_RO); - } -diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c -index f78cbbb88bd4..01677543248d 100644 ---- a/drivers/block/rbd.c -+++ b/drivers/block/rbd.c -@@ -457,6 +457,7 @@ void rbd_warn(struct rbd_device *rbd_dev, const char *fmt, ...) - # define rbd_assert(expr) ((void) 0) - #endif /* !RBD_DEBUG */ - -+static void rbd_osd_copyup_callback(struct rbd_obj_request *obj_request); - static int rbd_img_obj_request_submit(struct rbd_obj_request *obj_request); - static void rbd_img_parent_read(struct rbd_obj_request *obj_request); - static void rbd_dev_remove_parent(struct rbd_device *rbd_dev); -@@ -1670,6 +1671,16 @@ static void rbd_osd_stat_callback(struct rbd_obj_request *obj_request) - obj_request_done_set(obj_request); - } - -+static void rbd_osd_call_callback(struct rbd_obj_request *obj_request) -+{ -+ dout("%s: obj %p\n", __func__, obj_request); -+ -+ if (obj_request_img_data_test(obj_request)) -+ rbd_osd_copyup_callback(obj_request); -+ else -+ obj_request_done_set(obj_request); -+} -+ - static void rbd_osd_req_callback(struct ceph_osd_request *osd_req, - struct ceph_msg *msg) - { -@@ -1708,6 +1719,8 @@ static void rbd_osd_req_callback(struct ceph_osd_request *osd_req, - rbd_osd_stat_callback(obj_request); - break; - case CEPH_OSD_OP_CALL: -+ rbd_osd_call_callback(obj_request); -+ break; - case CEPH_OSD_OP_NOTIFY_ACK: - case CEPH_OSD_OP_WATCH: - rbd_osd_trivial_callback(obj_request); -@@ -2305,13 +2318,15 @@ out_unwind: - } - - static void --rbd_img_obj_copyup_callback(struct rbd_obj_request *obj_request) -+rbd_osd_copyup_callback(struct rbd_obj_request *obj_request) - { - struct rbd_img_request *img_request; - struct rbd_device *rbd_dev; - struct page **pages; - u32 page_count; - -+ dout("%s: obj %p\n", __func__, obj_request); -+ - rbd_assert(obj_request->type == OBJ_REQUEST_BIO); - rbd_assert(obj_request_img_data_test(obj_request)); - img_request = obj_request->img_request; -@@ -2337,9 +2352,7 @@ rbd_img_obj_copyup_callback(struct rbd_obj_request *obj_request) - if (!obj_request->result) - obj_request->xferred = obj_request->length; - -- /* Finish up with the normal image object callback */ -- -- rbd_img_obj_callback(obj_request); -+ obj_request_done_set(obj_request); - } - - static void -@@ -2436,7 +2449,6 @@ rbd_img_obj_parent_read_full_callback(struct rbd_img_request *img_request) - - /* All set, send it off. */ - -- orig_request->callback = rbd_img_obj_copyup_callback; - osdc = &rbd_dev->rbd_client->client->osdc; - img_result = rbd_obj_request_submit(osdc, orig_request); - if (!img_result) -diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c -index 40b3f756f904..02cc352d8bcc 100644 ---- a/drivers/char/ipmi/ipmi_si_intf.c -+++ b/drivers/char/ipmi/ipmi_si_intf.c -@@ -2717,7 +2717,7 @@ static int wait_for_msg_done(struct smi_info *smi_info) - smi_result == SI_SM_CALL_WITH_TICK_DELAY) { - schedule_timeout_uninterruptible(1); - smi_result = smi_info->handlers->event( -- smi_info->si_sm, 100); -+ smi_info->si_sm, jiffies_to_usecs(1)); - } else if (smi_result == SI_SM_CALL_WITHOUT_DELAY) { - smi_result = smi_info->handlers->event( - smi_info->si_sm, 0); -diff --git a/drivers/crypto/ixp4xx_crypto.c b/drivers/crypto/ixp4xx_crypto.c -index 21180d6cad6e..7cb51b3bb79e 100644 ---- a/drivers/crypto/ixp4xx_crypto.c -+++ b/drivers/crypto/ixp4xx_crypto.c -@@ -915,7 +915,6 @@ static int ablk_perform(struct ablkcipher_request *req, int encrypt) - crypt->mode |= NPE_OP_NOT_IN_PLACE; - /* This was never tested by Intel - * for more than one dst buffer, I think. */ -- BUG_ON(req->dst->length < nbytes); - req_ctx->dst = NULL; - if (!chainup_buffers(dev, req->dst, nbytes, &dst_hook, - flags, DMA_FROM_DEVICE)) -diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c -index 68ce36056019..8cac69819054 100644 ---- a/drivers/gpu/drm/radeon/radeon_combios.c -+++ b/drivers/gpu/drm/radeon/radeon_combios.c -@@ -1271,10 +1271,15 @@ struct radeon_encoder_lvds *radeon_combios_get_lvds_info(struct radeon_encoder - - if ((RBIOS16(tmp) == lvds->native_mode.hdisplay) && - (RBIOS16(tmp + 2) == lvds->native_mode.vdisplay)) { -+ u32 hss = (RBIOS16(tmp + 21) - RBIOS16(tmp + 19) - 1) * 8; -+ -+ if (hss > lvds->native_mode.hdisplay) -+ hss = (10 - 1) * 8; -+ - lvds->native_mode.htotal = lvds->native_mode.hdisplay + - (RBIOS16(tmp + 17) - RBIOS16(tmp + 19)) * 8; - lvds->native_mode.hsync_start = lvds->native_mode.hdisplay + -- (RBIOS16(tmp + 21) - RBIOS16(tmp + 19) - 1) * 8; -+ hss; - lvds->native_mode.hsync_end = lvds->native_mode.hsync_start + - (RBIOS8(tmp + 23) * 8); - -diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c -index a79cbd6038f6..37470ee7c850 100644 ---- a/drivers/md/bitmap.c -+++ b/drivers/md/bitmap.c -@@ -564,6 +564,8 @@ static int bitmap_read_sb(struct bitmap *bitmap) - if (err) - return err; - -+ err = -EINVAL; -+ - sb = kmap_atomic(sb_page); - - chunksize = le32_to_cpu(sb->chunksize); -diff --git a/drivers/md/md.c b/drivers/md/md.c -index 631fe3e9c6e5..37ff00d014b4 100644 ---- a/drivers/md/md.c -+++ b/drivers/md/md.c -@@ -5628,9 +5628,9 @@ static int get_bitmap_file(struct mddev * mddev, void __user * arg) - int err = -ENOMEM; - - if (md_allow_write(mddev)) -- file = kmalloc(sizeof(*file), GFP_NOIO); -+ file = kzalloc(sizeof(*file), GFP_NOIO); - else -- file = kmalloc(sizeof(*file), GFP_KERNEL); -+ file = kzalloc(sizeof(*file), GFP_KERNEL); - - if (!file) - goto out; -diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c -index fa58438b298a..72141ee60705 100644 ---- a/drivers/md/raid1.c -+++ b/drivers/md/raid1.c -@@ -1382,6 +1382,7 @@ static void error(struct mddev *mddev, struct md_rdev *rdev) - { - char b[BDEVNAME_SIZE]; - struct r1conf *conf = mddev->private; -+ unsigned long flags; - - /* - * If it is not operational, then we have already marked it as dead -@@ -1401,14 +1402,13 @@ static void error(struct mddev *mddev, struct md_rdev *rdev) - return; - } - set_bit(Blocked, &rdev->flags); -+ spin_lock_irqsave(&conf->device_lock, flags); - if (test_and_clear_bit(In_sync, &rdev->flags)) { -- unsigned long flags; -- spin_lock_irqsave(&conf->device_lock, flags); - mddev->degraded++; - set_bit(Faulty, &rdev->flags); -- spin_unlock_irqrestore(&conf->device_lock, flags); - } else - set_bit(Faulty, &rdev->flags); -+ spin_unlock_irqrestore(&conf->device_lock, flags); - /* - * if recovery is running, make sure it aborts. - */ -@@ -1466,7 +1466,10 @@ static int raid1_spare_active(struct mddev *mddev) - * Find all failed disks within the RAID1 configuration - * and mark them readable. - * Called under mddev lock, so rcu protection not needed. -+ * device_lock used to avoid races with raid1_end_read_request -+ * which expects 'In_sync' flags and ->degraded to be consistent. - */ -+ spin_lock_irqsave(&conf->device_lock, flags); - for (i = 0; i < conf->raid_disks; i++) { - struct md_rdev *rdev = conf->mirrors[i].rdev; - struct md_rdev *repl = conf->mirrors[conf->raid_disks + i].rdev; -@@ -1496,7 +1499,6 @@ static int raid1_spare_active(struct mddev *mddev) - sysfs_notify_dirent_safe(rdev->sysfs_state); - } - } -- spin_lock_irqsave(&conf->device_lock, flags); - mddev->degraded -= count; - spin_unlock_irqrestore(&conf->device_lock, flags); - -diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c -index 9816c232e583..c04e08d1d0fa 100644 ---- a/drivers/mfd/sm501.c -+++ b/drivers/mfd/sm501.c -@@ -1232,7 +1232,7 @@ static ssize_t sm501_dbg_regs(struct device *dev, - } - - --static DEVICE_ATTR(dbg_regs, 0666, sm501_dbg_regs, NULL); -+static DEVICE_ATTR(dbg_regs, 0444, sm501_dbg_regs, NULL); - - /* sm501_init_reg - * -diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c -index f7732f3b9804..4a79a5f0d95e 100644 ---- a/drivers/scsi/ipr.c -+++ b/drivers/scsi/ipr.c -@@ -554,9 +554,10 @@ static void ipr_trc_hook(struct ipr_cmnd *ipr_cmd, - { - struct ipr_trace_entry *trace_entry; - struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; -+ unsigned int trace_index; - -- trace_entry = &ioa_cfg->trace[atomic_add_return -- (1, &ioa_cfg->trace_index)%IPR_NUM_TRACE_ENTRIES]; -+ trace_index = atomic_add_return(1, &ioa_cfg->trace_index) & IPR_TRACE_INDEX_MASK; -+ trace_entry = &ioa_cfg->trace[trace_index]; - trace_entry->time = jiffies; - trace_entry->op_code = ipr_cmd->ioarcb.cmd_pkt.cdb[0]; - trace_entry->type = type; -@@ -1006,10 +1007,15 @@ static void ipr_send_blocking_cmd(struct ipr_cmnd *ipr_cmd, - - static int ipr_get_hrrq_index(struct ipr_ioa_cfg *ioa_cfg) - { -+ unsigned int hrrq; -+ - if (ioa_cfg->hrrq_num == 1) -- return 0; -- else -- return (atomic_add_return(1, &ioa_cfg->hrrq_index) % (ioa_cfg->hrrq_num - 1)) + 1; -+ hrrq = 0; -+ else { -+ hrrq = atomic_add_return(1, &ioa_cfg->hrrq_index); -+ hrrq = (hrrq % (ioa_cfg->hrrq_num - 1)) + 1; -+ } -+ return hrrq; - } - - /** -@@ -6141,21 +6147,23 @@ static void ipr_scsi_done(struct ipr_cmnd *ipr_cmd) - struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; - struct scsi_cmnd *scsi_cmd = ipr_cmd->scsi_cmd; - u32 ioasc = be32_to_cpu(ipr_cmd->s.ioasa.hdr.ioasc); -- unsigned long hrrq_flags; -+ unsigned long lock_flags; - - scsi_set_resid(scsi_cmd, be32_to_cpu(ipr_cmd->s.ioasa.hdr.residual_data_len)); - - if (likely(IPR_IOASC_SENSE_KEY(ioasc) == 0)) { - scsi_dma_unmap(scsi_cmd); - -- spin_lock_irqsave(ipr_cmd->hrrq->lock, hrrq_flags); -+ spin_lock_irqsave(ipr_cmd->hrrq->lock, lock_flags); - list_add_tail(&ipr_cmd->queue, &ipr_cmd->hrrq->hrrq_free_q); - scsi_cmd->scsi_done(scsi_cmd); -- spin_unlock_irqrestore(ipr_cmd->hrrq->lock, hrrq_flags); -+ spin_unlock_irqrestore(ipr_cmd->hrrq->lock, lock_flags); - } else { -- spin_lock_irqsave(ipr_cmd->hrrq->lock, hrrq_flags); -+ spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags); -+ spin_lock(&ipr_cmd->hrrq->_lock); - ipr_erp_start(ioa_cfg, ipr_cmd); -- spin_unlock_irqrestore(ipr_cmd->hrrq->lock, hrrq_flags); -+ spin_unlock(&ipr_cmd->hrrq->_lock); -+ spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); - } - } - -diff --git a/drivers/scsi/ipr.h b/drivers/scsi/ipr.h -index c19911554036..e045676d8325 100644 ---- a/drivers/scsi/ipr.h -+++ b/drivers/scsi/ipr.h -@@ -1452,6 +1452,7 @@ struct ipr_ioa_cfg { - - #define IPR_NUM_TRACE_INDEX_BITS 8 - #define IPR_NUM_TRACE_ENTRIES (1 << IPR_NUM_TRACE_INDEX_BITS) -+#define IPR_TRACE_INDEX_MASK (IPR_NUM_TRACE_ENTRIES - 1) - #define IPR_TRACE_SIZE (sizeof(struct ipr_trace_entry) * IPR_NUM_TRACE_ENTRIES) - char trace_start[8]; - #define IPR_TRACE_START_LABEL "trace" -diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c -index eb81c98386b9..721d839d6c54 100644 ---- a/drivers/scsi/sg.c -+++ b/drivers/scsi/sg.c -@@ -1694,6 +1694,9 @@ static int sg_start_req(Sg_request *srp, unsigned char *cmd) - md->from_user = 0; - } - -+ if (unlikely(iov_count > UIO_MAXIOV)) -+ return -EINVAL; -+ - if (iov_count) { - int len, size = sizeof(struct sg_iovec) * iov_count; - struct iovec *iov; -diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c -index efca110342cb..06cd916f91fe 100644 ---- a/drivers/target/iscsi/iscsi_target.c -+++ b/drivers/target/iscsi/iscsi_target.c -@@ -3874,7 +3874,13 @@ get_immediate: - } - - transport_err: -- iscsit_take_action_for_connection_exit(conn); -+ /* -+ * Avoid the normal connection failure code-path if this connection -+ * is still within LOGIN mode, and iscsi_np process context is -+ * responsible for cleaning up the early connection failure. -+ */ -+ if (conn->conn_state != TARG_CONN_STATE_IN_LOGIN) -+ iscsit_take_action_for_connection_exit(conn); - out: - return 0; - } -@@ -3956,7 +3962,7 @@ reject: - - int iscsi_target_rx_thread(void *arg) - { -- int ret; -+ int ret, rc; - u8 buffer[ISCSI_HDR_LEN], opcode; - u32 checksum = 0, digest = 0; - struct iscsi_conn *conn = arg; -@@ -3966,10 +3972,16 @@ int iscsi_target_rx_thread(void *arg) - * connection recovery / failure event can be triggered externally. - */ - allow_signal(SIGINT); -+ /* -+ * Wait for iscsi_post_login_handler() to complete before allowing -+ * incoming iscsi/tcp socket I/O, and/or failing the connection. -+ */ -+ rc = wait_for_completion_interruptible(&conn->rx_login_comp); -+ if (rc < 0) -+ return 0; - - if (conn->conn_transport->transport_type == ISCSI_INFINIBAND) { - struct completion comp; -- int rc; - - init_completion(&comp); - rc = wait_for_completion_interruptible(&comp); -diff --git a/drivers/target/iscsi/iscsi_target_core.h b/drivers/target/iscsi/iscsi_target_core.h -index 815bf5b1a4ae..bf93e1c1ff97 100644 ---- a/drivers/target/iscsi/iscsi_target_core.h -+++ b/drivers/target/iscsi/iscsi_target_core.h -@@ -589,6 +589,7 @@ struct iscsi_conn { - int bitmap_id; - int rx_thread_active; - struct task_struct *rx_thread; -+ struct completion rx_login_comp; - int tx_thread_active; - struct task_struct *tx_thread; - /* list_head for session connection list */ -diff --git a/drivers/target/iscsi/iscsi_target_login.c b/drivers/target/iscsi/iscsi_target_login.c -index 797b2e2acc35..2c4db62e327e 100644 ---- a/drivers/target/iscsi/iscsi_target_login.c -+++ b/drivers/target/iscsi/iscsi_target_login.c -@@ -84,6 +84,7 @@ static struct iscsi_login *iscsi_login_init_conn(struct iscsi_conn *conn) - init_completion(&conn->conn_logout_comp); - init_completion(&conn->rx_half_close_comp); - init_completion(&conn->tx_half_close_comp); -+ init_completion(&conn->rx_login_comp); - spin_lock_init(&conn->cmd_lock); - spin_lock_init(&conn->conn_usage_lock); - spin_lock_init(&conn->immed_queue_lock); -@@ -718,6 +719,7 @@ int iscsit_start_kthreads(struct iscsi_conn *conn) - - return 0; - out_tx: -+ send_sig(SIGINT, conn->tx_thread, 1); - kthread_stop(conn->tx_thread); - conn->tx_thread_active = false; - out_bitmap: -@@ -728,7 +730,7 @@ out_bitmap: - return ret; - } - --int iscsi_post_login_handler( -+void iscsi_post_login_handler( - struct iscsi_np *np, - struct iscsi_conn *conn, - u8 zero_tsih) -@@ -738,7 +740,6 @@ int iscsi_post_login_handler( - struct se_session *se_sess = sess->se_sess; - struct iscsi_portal_group *tpg = ISCSI_TPG_S(sess); - struct se_portal_group *se_tpg = &tpg->tpg_se_tpg; -- int rc; - - iscsit_inc_conn_usage_count(conn); - -@@ -779,10 +780,6 @@ int iscsi_post_login_handler( - sess->sess_ops->InitiatorName); - spin_unlock_bh(&sess->conn_lock); - -- rc = iscsit_start_kthreads(conn); -- if (rc) -- return rc; -- - iscsi_post_login_start_timers(conn); - /* - * Determine CPU mask to ensure connection's RX and TX kthreads -@@ -791,15 +788,20 @@ int iscsi_post_login_handler( - iscsit_thread_get_cpumask(conn); - conn->conn_rx_reset_cpumask = 1; - conn->conn_tx_reset_cpumask = 1; -- -+ /* -+ * Wakeup the sleeping iscsi_target_rx_thread() now that -+ * iscsi_conn is in TARG_CONN_STATE_LOGGED_IN state. -+ */ -+ complete(&conn->rx_login_comp); - iscsit_dec_conn_usage_count(conn); -+ - if (stop_timer) { - spin_lock_bh(&se_tpg->session_lock); - iscsit_stop_time2retain_timer(sess); - spin_unlock_bh(&se_tpg->session_lock); - } - iscsit_dec_session_usage_count(sess); -- return 0; -+ return; - } - - iscsi_set_session_parameters(sess->sess_ops, conn->param_list, 1); -@@ -840,10 +842,6 @@ int iscsi_post_login_handler( - " iSCSI Target Portal Group: %hu\n", tpg->nsessions, tpg->tpgt); - spin_unlock_bh(&se_tpg->session_lock); - -- rc = iscsit_start_kthreads(conn); -- if (rc) -- return rc; -- - iscsi_post_login_start_timers(conn); - /* - * Determine CPU mask to ensure connection's RX and TX kthreads -@@ -852,10 +850,12 @@ int iscsi_post_login_handler( - iscsit_thread_get_cpumask(conn); - conn->conn_rx_reset_cpumask = 1; - conn->conn_tx_reset_cpumask = 1; -- -+ /* -+ * Wakeup the sleeping iscsi_target_rx_thread() now that -+ * iscsi_conn is in TARG_CONN_STATE_LOGGED_IN state. -+ */ -+ complete(&conn->rx_login_comp); - iscsit_dec_conn_usage_count(conn); -- -- return 0; - } - - static void iscsi_handle_login_thread_timeout(unsigned long data) -@@ -1331,20 +1331,9 @@ static int __iscsi_target_login_thread(struct iscsi_np *np) - if (iscsi_target_start_negotiation(login, conn) < 0) - goto new_sess_out; - -- if (!conn->sess) { -- pr_err("struct iscsi_conn session pointer is NULL!\n"); -- goto new_sess_out; -- } -- - iscsi_stop_login_thread_timer(np); - -- if (signal_pending(current)) -- goto new_sess_out; -- -- ret = iscsi_post_login_handler(np, conn, zero_tsih); -- -- if (ret < 0) -- goto new_sess_out; -+ iscsi_post_login_handler(np, conn, zero_tsih); - - iscsit_deaccess_np(np, tpg); - tpg = NULL; -diff --git a/drivers/target/iscsi/iscsi_target_login.h b/drivers/target/iscsi/iscsi_target_login.h -index 63efd2878451..6d7eb66de94b 100644 ---- a/drivers/target/iscsi/iscsi_target_login.h -+++ b/drivers/target/iscsi/iscsi_target_login.h -@@ -12,6 +12,7 @@ extern int iscsit_accept_np(struct iscsi_np *, struct iscsi_conn *); - extern int iscsit_get_login_rx(struct iscsi_conn *, struct iscsi_login *); - extern int iscsit_put_login_tx(struct iscsi_conn *, struct iscsi_login *, u32); - extern void iscsit_free_conn(struct iscsi_np *, struct iscsi_conn *); -+extern int iscsit_start_kthreads(struct iscsi_conn *); - extern int iscsi_target_login_thread(void *); - extern int iscsi_login_disable_FIM_keys(struct iscsi_param_list *, struct iscsi_conn *); - -diff --git a/drivers/target/iscsi/iscsi_target_nego.c b/drivers/target/iscsi/iscsi_target_nego.c -index 72d9dec991c0..77c276acccb6 100644 ---- a/drivers/target/iscsi/iscsi_target_nego.c -+++ b/drivers/target/iscsi/iscsi_target_nego.c -@@ -19,6 +19,7 @@ - ******************************************************************************/ - - #include -+#include - #include - #include - #include -@@ -352,10 +353,24 @@ static int iscsi_target_do_tx_login_io(struct iscsi_conn *conn, struct iscsi_log - ntohl(login_rsp->statsn), login->rsp_length); - - padding = ((-login->rsp_length) & 3); -+ /* -+ * Before sending the last login response containing the transition -+ * bit for full-feature-phase, go ahead and start up TX/RX threads -+ * now to avoid potential resource allocation failures after the -+ * final login response has been sent. -+ */ -+ if (login->login_complete) { -+ int rc = iscsit_start_kthreads(conn); -+ if (rc) { -+ iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR, -+ ISCSI_LOGIN_STATUS_NO_RESOURCES); -+ return -1; -+ } -+ } - - if (conn->conn_transport->iscsit_put_login_tx(conn, login, - login->rsp_length + padding) < 0) -- return -1; -+ goto err; - - login->rsp_length = 0; - mutex_lock(&sess->cmdsn_mutex); -@@ -364,6 +379,23 @@ static int iscsi_target_do_tx_login_io(struct iscsi_conn *conn, struct iscsi_log - mutex_unlock(&sess->cmdsn_mutex); - - return 0; -+ -+err: -+ if (login->login_complete) { -+ if (conn->rx_thread && conn->rx_thread_active) { -+ send_sig(SIGINT, conn->rx_thread, 1); -+ kthread_stop(conn->rx_thread); -+ } -+ if (conn->tx_thread && conn->tx_thread_active) { -+ send_sig(SIGINT, conn->tx_thread, 1); -+ kthread_stop(conn->tx_thread); -+ } -+ spin_lock(&iscsit_global->ts_bitmap_lock); -+ bitmap_release_region(iscsit_global->ts_bitmap, conn->bitmap_id, -+ get_order(1)); -+ spin_unlock(&iscsit_global->ts_bitmap_lock); -+ } -+ return -1; - } - - static int iscsi_target_do_login_io(struct iscsi_conn *conn, struct iscsi_login *login) -diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c -index 95fe1a432d29..fde0277adc2c 100644 ---- a/drivers/usb/host/xhci-ring.c -+++ b/drivers/usb/host/xhci-ring.c -@@ -85,7 +85,7 @@ dma_addr_t xhci_trb_virt_to_dma(struct xhci_segment *seg, - return 0; - /* offset in TRBs */ - segment_offset = trb - seg->trbs; -- if (segment_offset > TRBS_PER_SEGMENT) -+ if (segment_offset >= TRBS_PER_SEGMENT) - return 0; - return seg->dma + (segment_offset * sizeof(*trb)); - } -diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c -index 5aaa2b675116..af9f82a1fcde 100644 ---- a/drivers/usb/serial/sierra.c -+++ b/drivers/usb/serial/sierra.c -@@ -289,6 +289,7 @@ static const struct usb_device_id id_table[] = { - { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x68AA, 0xFF, 0xFF, 0xFF), - .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist - }, -+ { USB_DEVICE(0x1199, 0x68AB) }, /* Sierra Wireless AR8550 */ - /* AT&T Direct IP LTE modems */ - { USB_DEVICE_AND_INTERFACE_INFO(0x0F3D, 0x68AA, 0xFF, 0xFF, 0xFF), - .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist -diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c -index 3c8803feba26..474d11499d0e 100644 ---- a/drivers/xen/gntdev.c -+++ b/drivers/xen/gntdev.c -@@ -534,12 +534,14 @@ static int gntdev_release(struct inode *inode, struct file *flip) - - pr_debug("priv %p\n", priv); - -+ mutex_lock(&priv->lock); - while (!list_empty(&priv->maps)) { - map = list_entry(priv->maps.next, struct grant_map, next); - list_del(&map->next); - gntdev_put_map(NULL /* already removed */, map); - } - WARN_ON(!list_empty(&priv->freeable_maps)); -+ mutex_unlock(&priv->lock); - - if (use_ptemod) - mmu_notifier_unregister(&priv->mn, priv->mm); -diff --git a/fs/notify/mark.c b/fs/notify/mark.c -index fc6b49bf7360..f08b3b729d3d 100644 ---- a/fs/notify/mark.c -+++ b/fs/notify/mark.c -@@ -299,16 +299,36 @@ void fsnotify_clear_marks_by_group_flags(struct fsnotify_group *group, - unsigned int flags) - { - struct fsnotify_mark *lmark, *mark; -+ LIST_HEAD(to_free); - -+ /* -+ * We have to be really careful here. Anytime we drop mark_mutex, e.g. -+ * fsnotify_clear_marks_by_inode() can come and free marks. Even in our -+ * to_free list so we have to use mark_mutex even when accessing that -+ * list. And freeing mark requires us to drop mark_mutex. So we can -+ * reliably free only the first mark in the list. That's why we first -+ * move marks to free to to_free list in one go and then free marks in -+ * to_free list one by one. -+ */ - mutex_lock_nested(&group->mark_mutex, SINGLE_DEPTH_NESTING); - list_for_each_entry_safe(mark, lmark, &group->marks_list, g_list) { -- if (mark->flags & flags) { -- fsnotify_get_mark(mark); -- fsnotify_destroy_mark_locked(mark, group); -- fsnotify_put_mark(mark); -- } -+ if (mark->flags & flags) -+ list_move(&mark->g_list, &to_free); - } - mutex_unlock(&group->mark_mutex); -+ -+ while (1) { -+ mutex_lock_nested(&group->mark_mutex, SINGLE_DEPTH_NESTING); -+ if (list_empty(&to_free)) { -+ mutex_unlock(&group->mark_mutex); -+ break; -+ } -+ mark = list_first_entry(&to_free, struct fsnotify_mark, g_list); -+ fsnotify_get_mark(mark); -+ fsnotify_destroy_mark_locked(mark, group); -+ mutex_unlock(&group->mark_mutex); -+ fsnotify_put_mark(mark); -+ } - } - - /* -diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c -index 3a44a648dae7..b294deb27d17 100644 ---- a/fs/ocfs2/dlmglue.c -+++ b/fs/ocfs2/dlmglue.c -@@ -3971,9 +3971,13 @@ static void ocfs2_downconvert_thread_do_work(struct ocfs2_super *osb) - osb->dc_work_sequence = osb->dc_wake_sequence; - - processed = osb->blocked_lock_count; -- while (processed) { -- BUG_ON(list_empty(&osb->blocked_lock_list)); -- -+ /* -+ * blocked lock processing in this loop might call iput which can -+ * remove items off osb->blocked_lock_list. Downconvert up to -+ * 'processed' number of locks, but stop short if we had some -+ * removed in ocfs2_mark_lockres_freeing when downconverting. -+ */ -+ while (processed && !list_empty(&osb->blocked_lock_list)) { - lockres = list_entry(osb->blocked_lock_list.next, - struct ocfs2_lock_res, l_blocked_list); - list_del_init(&lockres->l_blocked_list); -diff --git a/fs/signalfd.c b/fs/signalfd.c -index 424b7b65321f..148f8e7af882 100644 ---- a/fs/signalfd.c -+++ b/fs/signalfd.c -@@ -121,8 +121,9 @@ static int signalfd_copyinfo(struct signalfd_siginfo __user *uinfo, - * Other callers might not initialize the si_lsb field, - * so check explicitly for the right codes here. - */ -- if (kinfo->si_code == BUS_MCEERR_AR || -- kinfo->si_code == BUS_MCEERR_AO) -+ if (kinfo->si_signo == SIGBUS && -+ (kinfo->si_code == BUS_MCEERR_AR || -+ kinfo->si_code == BUS_MCEERR_AO)) - err |= __put_user((short) kinfo->si_addr_lsb, - &uinfo->ssi_addr_lsb); - #endif -diff --git a/ipc/mqueue.c b/ipc/mqueue.c -index bb0248fc5187..82bb5e81ef57 100644 ---- a/ipc/mqueue.c -+++ b/ipc/mqueue.c -@@ -143,7 +143,6 @@ static int msg_insert(struct msg_msg *msg, struct mqueue_inode_info *info) - if (!leaf) - return -ENOMEM; - INIT_LIST_HEAD(&leaf->msg_list); -- info->qsize += sizeof(*leaf); - } - leaf->priority = msg->m_type; - rb_link_node(&leaf->rb_node, parent, p); -@@ -188,7 +187,6 @@ try_again: - "lazy leaf delete!\n"); - rb_erase(&leaf->rb_node, &info->msg_tree); - if (info->node_cache) { -- info->qsize -= sizeof(*leaf); - kfree(leaf); - } else { - info->node_cache = leaf; -@@ -201,7 +199,6 @@ try_again: - if (list_empty(&leaf->msg_list)) { - rb_erase(&leaf->rb_node, &info->msg_tree); - if (info->node_cache) { -- info->qsize -= sizeof(*leaf); - kfree(leaf); - } else { - info->node_cache = leaf; -@@ -1026,7 +1023,6 @@ SYSCALL_DEFINE5(mq_timedsend, mqd_t, mqdes, const char __user *, u_msg_ptr, - /* Save our speculative allocation into the cache */ - INIT_LIST_HEAD(&new_leaf->msg_list); - info->node_cache = new_leaf; -- info->qsize += sizeof(*new_leaf); - new_leaf = NULL; - } else { - kfree(new_leaf); -@@ -1133,7 +1129,6 @@ SYSCALL_DEFINE5(mq_timedreceive, mqd_t, mqdes, char __user *, u_msg_ptr, - /* Save our speculative allocation into the cache */ - INIT_LIST_HEAD(&new_leaf->msg_list); - info->node_cache = new_leaf; -- info->qsize += sizeof(*new_leaf); - } else { - kfree(new_leaf); - } -diff --git a/kernel/signal.c b/kernel/signal.c -index 113411bfe8b1..2e51bcbea1e3 100644 ---- a/kernel/signal.c -+++ b/kernel/signal.c -@@ -2768,7 +2768,8 @@ int copy_siginfo_to_user(siginfo_t __user *to, siginfo_t *from) - * Other callers might not initialize the si_lsb field, - * so check explicitly for the right codes here. - */ -- if (from->si_code == BUS_MCEERR_AR || from->si_code == BUS_MCEERR_AO) -+ if (from->si_signo == SIGBUS && -+ (from->si_code == BUS_MCEERR_AR || from->si_code == BUS_MCEERR_AO)) - err |= __put_user(from->si_addr_lsb, &to->si_addr_lsb); - #endif - break; -@@ -3035,7 +3036,7 @@ COMPAT_SYSCALL_DEFINE3(rt_sigqueueinfo, - int, sig, - struct compat_siginfo __user *, uinfo) - { -- siginfo_t info; -+ siginfo_t info = {}; - int ret = copy_siginfo_from_user32(&info, uinfo); - if (unlikely(ret)) - return ret; -@@ -3081,7 +3082,7 @@ COMPAT_SYSCALL_DEFINE4(rt_tgsigqueueinfo, - int, sig, - struct compat_siginfo __user *, uinfo) - { -- siginfo_t info; -+ siginfo_t info = {}; - - if (copy_siginfo_from_user32(&info, uinfo)) - return -EFAULT; -diff --git a/mm/vmscan.c b/mm/vmscan.c -index a2fd7e759cb7..233f0011f768 100644 ---- a/mm/vmscan.c -+++ b/mm/vmscan.c -@@ -730,20 +730,15 @@ static unsigned long shrink_page_list(struct list_head *page_list, - * could easily OOM just because too many pages are in - * writeback and there is nothing else to reclaim. - * -- * Check __GFP_IO, certainly because a loop driver -+ * Require may_enter_fs to wait on writeback, because -+ * fs may not have submitted IO yet. And a loop driver - * thread might enter reclaim, and deadlock if it waits - * on a page for which it is needed to do the write - * (loop masks off __GFP_IO|__GFP_FS for this reason); - * but more thought would probably show more reasons. -- * -- * Don't require __GFP_FS, since we're not going into -- * the FS, just waiting on its writeback completion. -- * Worryingly, ext4 gfs2 and xfs allocate pages with -- * grab_cache_page_write_begin(,,AOP_FLAG_NOFS), so -- * testing may_enter_fs here is liable to OOM on them. - */ - if (global_reclaim(sc) || -- !PageReclaim(page) || !(sc->gfp_mask & __GFP_IO)) { -+ !PageReclaim(page) || !may_enter_fs) { - /* - * This is slightly racy - end_page_writeback() - * might have just cleared PageReclaim, then -diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c -index e2642ba88b2d..2ba07ae70879 100644 ---- a/sound/pci/hda/patch_cirrus.c -+++ b/sound/pci/hda/patch_cirrus.c -@@ -787,9 +787,7 @@ static void cs4210_spdif_automute(struct hda_codec *codec, - - spec->spdif_present = spdif_present; - /* SPDIF TX on/off */ -- if (spdif_present) -- snd_hda_set_pin_ctl(codec, spdif_pin, -- spdif_present ? PIN_OUT : 0); -+ snd_hda_set_pin_ctl(codec, spdif_pin, spdif_present ? PIN_OUT : 0); - - cs_automute(codec); - } diff --git a/patch/kernel/marvell-default/1-patch-3.10.87-88.patch b/patch/kernel/marvell-default/1-patch-3.10.87-88.patch deleted file mode 100644 index b6de808985..0000000000 --- a/patch/kernel/marvell-default/1-patch-3.10.87-88.patch +++ /dev/null @@ -1,285 +0,0 @@ -diff --git a/Makefile b/Makefile -index 0d4fd6427349..e94ce68ecf87 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,6 +1,6 @@ - VERSION = 3 - PATCHLEVEL = 10 --SUBLEVEL = 87 -+SUBLEVEL = 88 - EXTRAVERSION = - NAME = TOSSUG Baby Fish - -diff --git a/arch/arm64/mm/mmap.c b/arch/arm64/mm/mmap.c -index 7c7be7855638..8aaf073ee078 100644 ---- a/arch/arm64/mm/mmap.c -+++ b/arch/arm64/mm/mmap.c -@@ -47,22 +47,14 @@ static int mmap_is_legacy(void) - return sysctl_legacy_va_layout; - } - --/* -- * Since get_random_int() returns the same value within a 1 jiffy window, we -- * will almost always get the same randomisation for the stack and mmap -- * region. This will mean the relative distance between stack and mmap will be -- * the same. -- * -- * To avoid this we can shift the randomness by 1 bit. -- */ - static unsigned long mmap_rnd(void) - { - unsigned long rnd = 0; - - if (current->flags & PF_RANDOMIZE) -- rnd = (long)get_random_int() & (STACK_RND_MASK >> 1); -+ rnd = (long)get_random_int() & STACK_RND_MASK; - -- return rnd << (PAGE_SHIFT + 1); -+ return rnd << PAGE_SHIFT; - } - - static unsigned long mmap_base(void) -diff --git a/drivers/crypto/caam/caamhash.c b/drivers/crypto/caam/caamhash.c -index 84573b4d6f92..dda43cc4b6cd 100644 ---- a/drivers/crypto/caam/caamhash.c -+++ b/drivers/crypto/caam/caamhash.c -@@ -895,13 +895,14 @@ static int ahash_final_ctx(struct ahash_request *req) - state->buflen_1; - u32 *sh_desc = ctx->sh_desc_fin, *desc; - dma_addr_t ptr = ctx->sh_desc_fin_dma; -- int sec4_sg_bytes; -+ int sec4_sg_bytes, sec4_sg_src_index; - int digestsize = crypto_ahash_digestsize(ahash); - struct ahash_edesc *edesc; - int ret = 0; - int sh_len; - -- sec4_sg_bytes = (1 + (buflen ? 1 : 0)) * sizeof(struct sec4_sg_entry); -+ sec4_sg_src_index = 1 + (buflen ? 1 : 0); -+ sec4_sg_bytes = sec4_sg_src_index * sizeof(struct sec4_sg_entry); - - /* allocate space for base edesc and hw desc commands, link tables */ - edesc = kmalloc(sizeof(struct ahash_edesc) + DESC_JOB_IO_LEN + -@@ -928,7 +929,7 @@ static int ahash_final_ctx(struct ahash_request *req) - state->buf_dma = try_buf_map_to_sec4_sg(jrdev, edesc->sec4_sg + 1, - buf, state->buf_dma, buflen, - last_buflen); -- (edesc->sec4_sg + sec4_sg_bytes - 1)->len |= SEC4_SG_LEN_FIN; -+ (edesc->sec4_sg + sec4_sg_src_index - 1)->len |= SEC4_SG_LEN_FIN; - - append_seq_in_ptr(desc, edesc->sec4_sg_dma, ctx->ctx_len + buflen, - LDST_SGF); -diff --git a/drivers/edac/ppc4xx_edac.c b/drivers/edac/ppc4xx_edac.c -index ef6b7e08f485..5c361f3c66aa 100644 ---- a/drivers/edac/ppc4xx_edac.c -+++ b/drivers/edac/ppc4xx_edac.c -@@ -921,7 +921,7 @@ static int ppc4xx_edac_init_csrows(struct mem_ctl_info *mci, u32 mcopt1) - */ - - for (row = 0; row < mci->nr_csrows; row++) { -- struct csrow_info *csi = &mci->csrows[row]; -+ struct csrow_info *csi = mci->csrows[row]; - - /* - * Get the configuration settings for this -diff --git a/drivers/md/dm-thin-metadata.c b/drivers/md/dm-thin-metadata.c -index 3b1503dc1f13..43f6250baadd 100644 ---- a/drivers/md/dm-thin-metadata.c -+++ b/drivers/md/dm-thin-metadata.c -@@ -1281,8 +1281,8 @@ static int __release_metadata_snap(struct dm_pool_metadata *pmd) - return r; - - disk_super = dm_block_data(copy); -- dm_sm_dec_block(pmd->metadata_sm, le64_to_cpu(disk_super->data_mapping_root)); -- dm_sm_dec_block(pmd->metadata_sm, le64_to_cpu(disk_super->device_details_root)); -+ dm_btree_del(&pmd->info, le64_to_cpu(disk_super->data_mapping_root)); -+ dm_btree_del(&pmd->details_info, le64_to_cpu(disk_super->device_details_root)); - dm_sm_dec_block(pmd->metadata_sm, held_root); - - return dm_tm_unlock(pmd->tm, copy); -diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c -index 09c81b2f2169..42c46dc19537 100644 ---- a/drivers/scsi/libfc/fc_fcp.c -+++ b/drivers/scsi/libfc/fc_fcp.c -@@ -1039,11 +1039,26 @@ restart: - fc_fcp_pkt_hold(fsp); - spin_unlock_irqrestore(&si->scsi_queue_lock, flags); - -- if (!fc_fcp_lock_pkt(fsp)) { -+ spin_lock_bh(&fsp->scsi_pkt_lock); -+ if (!(fsp->state & FC_SRB_COMPL)) { -+ fsp->state |= FC_SRB_COMPL; -+ /* -+ * TODO: dropping scsi_pkt_lock and then reacquiring -+ * again around fc_fcp_cleanup_cmd() is required, -+ * since fc_fcp_cleanup_cmd() calls into -+ * fc_seq_set_resp() and that func preempts cpu using -+ * schedule. May be schedule and related code should be -+ * removed instead of unlocking here to avoid scheduling -+ * while atomic bug. -+ */ -+ spin_unlock_bh(&fsp->scsi_pkt_lock); -+ - fc_fcp_cleanup_cmd(fsp, error); -+ -+ spin_lock_bh(&fsp->scsi_pkt_lock); - fc_io_compl(fsp); -- fc_fcp_unlock_pkt(fsp); - } -+ spin_unlock_bh(&fsp->scsi_pkt_lock); - - fc_fcp_pkt_release(fsp); - spin_lock_irqsave(&si->scsi_queue_lock, flags); -diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h -index d7b717090f2f..2b5c3bc3b081 100644 ---- a/include/drm/drm_pciids.h -+++ b/include/drm/drm_pciids.h -@@ -150,6 +150,7 @@ - {0x1002, 0x6610, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \ - {0x1002, 0x6611, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \ - {0x1002, 0x6613, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_NEW_MEMMAP}, \ -+ {0x1002, 0x6617, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ - {0x1002, 0x6620, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ - {0x1002, 0x6621, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ - {0x1002, 0x6623, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_OLAND|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ -diff --git a/ipc/sem.c b/ipc/sem.c -index db9d241af133..47a15192b8b8 100644 ---- a/ipc/sem.c -+++ b/ipc/sem.c -@@ -253,6 +253,16 @@ static void sem_rcu_free(struct rcu_head *head) - } - - /* -+ * spin_unlock_wait() and !spin_is_locked() are not memory barriers, they -+ * are only control barriers. -+ * The code must pair with spin_unlock(&sem->lock) or -+ * spin_unlock(&sem_perm.lock), thus just the control barrier is insufficient. -+ * -+ * smp_rmb() is sufficient, as writes cannot pass the control barrier. -+ */ -+#define ipc_smp_acquire__after_spin_is_unlocked() smp_rmb() -+ -+/* - * Wait until all currently ongoing simple ops have completed. - * Caller must own sem_perm.lock. - * New simple ops cannot start, because simple ops first check -@@ -275,6 +285,7 @@ static void sem_wait_array(struct sem_array *sma) - sem = sma->sem_base + i; - spin_unlock_wait(&sem->lock); - } -+ ipc_smp_acquire__after_spin_is_unlocked(); - } - - /* -@@ -326,8 +337,13 @@ static inline int sem_lock(struct sem_array *sma, struct sembuf *sops, - - /* Then check that the global lock is free */ - if (!spin_is_locked(&sma->sem_perm.lock)) { -- /* spin_is_locked() is not a memory barrier */ -- smp_mb(); -+ /* -+ * We need a memory barrier with acquire semantics, -+ * otherwise we can race with another thread that does: -+ * complex_count++; -+ * spin_unlock(sem_perm.lock); -+ */ -+ ipc_smp_acquire__after_spin_is_unlocked(); - - /* Now repeat the test of complex_count: - * It can't change anymore until we drop sem->lock. -@@ -2049,17 +2065,28 @@ void exit_sem(struct task_struct *tsk) - rcu_read_lock(); - un = list_entry_rcu(ulp->list_proc.next, - struct sem_undo, list_proc); -- if (&un->list_proc == &ulp->list_proc) -- semid = -1; -- else -- semid = un->semid; -+ if (&un->list_proc == &ulp->list_proc) { -+ /* -+ * We must wait for freeary() before freeing this ulp, -+ * in case we raced with last sem_undo. There is a small -+ * possibility where we exit while freeary() didn't -+ * finish unlocking sem_undo_list. -+ */ -+ spin_unlock_wait(&ulp->lock); -+ rcu_read_unlock(); -+ break; -+ } -+ spin_lock(&ulp->lock); -+ semid = un->semid; -+ spin_unlock(&ulp->lock); - -+ /* exit_sem raced with IPC_RMID, nothing to do */ - if (semid == -1) { - rcu_read_unlock(); -- break; -+ continue; - } - -- sma = sem_obtain_object_check(tsk->nsproxy->ipc_ns, un->semid); -+ sma = sem_obtain_object_check(tsk->nsproxy->ipc_ns, semid); - /* exit_sem raced with IPC_RMID, nothing to do */ - if (IS_ERR(sma)) { - rcu_read_unlock(); -diff --git a/kernel/events/core.c b/kernel/events/core.c -index 7daf52c340cd..d9b0aad17dbf 100644 ---- a/kernel/events/core.c -+++ b/kernel/events/core.c -@@ -3993,12 +3993,20 @@ static const struct file_operations perf_fops = { - * to user-space before waking everybody up. - */ - -+static inline struct fasync_struct **perf_event_fasync(struct perf_event *event) -+{ -+ /* only the parent has fasync state */ -+ if (event->parent) -+ event = event->parent; -+ return &event->fasync; -+} -+ - void perf_event_wakeup(struct perf_event *event) - { - ring_buffer_wakeup(event); - - if (event->pending_kill) { -- kill_fasync(&event->fasync, SIGIO, event->pending_kill); -+ kill_fasync(perf_event_fasync(event), SIGIO, event->pending_kill); - event->pending_kill = 0; - } - } -@@ -5153,7 +5161,7 @@ static int __perf_event_overflow(struct perf_event *event, - else - perf_event_output(event, data, regs); - -- if (event->fasync && event->pending_kill) { -+ if (*perf_event_fasync(event) && event->pending_kill) { - event->pending_wakeup = 1; - irq_work_queue(&event->pending); - } -diff --git a/mm/memory-failure.c b/mm/memory-failure.c -index ca96f411b034..f97d709594e6 100644 ---- a/mm/memory-failure.c -+++ b/mm/memory-failure.c -@@ -1473,6 +1473,8 @@ static int get_any_page(struct page *page, unsigned long pfn, int flags) - */ - ret = __get_any_page(page, pfn, 0); - if (!PageLRU(page)) { -+ /* Drop page reference which is from __get_any_page() */ -+ put_page(page); - pr_info("soft_offline: %#lx: unknown non LRU page type %lx\n", - pfn, page->flags); - return -EIO; -diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl -index 4606cdfb859d..7dd7c391b4d8 100644 ---- a/scripts/kconfig/streamline_config.pl -+++ b/scripts/kconfig/streamline_config.pl -@@ -137,7 +137,7 @@ my $ksource = ($ARGV[0] ? $ARGV[0] : '.'); - my $kconfig = $ARGV[1]; - my $lsmod_file = $ENV{'LSMOD'}; - --my @makefiles = `find $ksource -name Makefile 2>/dev/null`; -+my @makefiles = `find $ksource -name Makefile -or -name Kbuild 2>/dev/null`; - chomp @makefiles; - - my %depends; diff --git a/patch/kernel/marvell-default/1-patch-3.10.88-89.patch b/patch/kernel/marvell-default/1-patch-3.10.88-89.patch deleted file mode 100644 index cb2dc79a64..0000000000 --- a/patch/kernel/marvell-default/1-patch-3.10.88-89.patch +++ /dev/null @@ -1,661 +0,0 @@ -diff --git a/Makefile b/Makefile -index e94ce68ecf87..ca82393e1eea 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,6 +1,6 @@ - VERSION = 3 - PATCHLEVEL = 10 --SUBLEVEL = 88 -+SUBLEVEL = 89 - EXTRAVERSION = - NAME = TOSSUG Baby Fish - -diff --git a/arch/x86/crypto/ghash-clmulni-intel_glue.c b/arch/x86/crypto/ghash-clmulni-intel_glue.c -index a8d6f69f92a3..4bcf841e4701 100644 ---- a/arch/x86/crypto/ghash-clmulni-intel_glue.c -+++ b/arch/x86/crypto/ghash-clmulni-intel_glue.c -@@ -291,6 +291,7 @@ static struct ahash_alg ghash_async_alg = { - .cra_name = "ghash", - .cra_driver_name = "ghash-clmulni", - .cra_priority = 400, -+ .cra_ctxsize = sizeof(struct ghash_async_ctx), - .cra_flags = CRYPTO_ALG_TYPE_AHASH | CRYPTO_ALG_ASYNC, - .cra_blocksize = GHASH_BLOCK_SIZE, - .cra_type = &crypto_ahash_type, -diff --git a/arch/xtensa/Makefile b/arch/xtensa/Makefile -index 136224b74d4f..81250ece3062 100644 ---- a/arch/xtensa/Makefile -+++ b/arch/xtensa/Makefile -@@ -55,10 +55,10 @@ ifneq ($(CONFIG_LD_NO_RELAX),) - LDFLAGS := --no-relax - endif - --ifeq ($(shell echo -e __XTENSA_EB__ | $(CC) -E - | grep -v "\#"),1) -+ifeq ($(shell echo __XTENSA_EB__ | $(CC) -E - | grep -v "\#"),1) - CHECKFLAGS += -D__XTENSA_EB__ - endif --ifeq ($(shell echo -e __XTENSA_EL__ | $(CC) -E - | grep -v "\#"),1) -+ifeq ($(shell echo __XTENSA_EL__ | $(CC) -E - | grep -v "\#"),1) - CHECKFLAGS += -D__XTENSA_EL__ - endif - -diff --git a/arch/xtensa/boot/Makefile b/arch/xtensa/boot/Makefile -index 64ffc4b53df6..ca20a892021b 100644 ---- a/arch/xtensa/boot/Makefile -+++ b/arch/xtensa/boot/Makefile -@@ -12,7 +12,7 @@ - KBUILD_CFLAGS += -fno-builtin -Iarch/$(ARCH)/boot/include - HOSTFLAGS += -Iarch/$(ARCH)/boot/include - --BIG_ENDIAN := $(shell echo -e __XTENSA_EB__ | $(CC) -E - | grep -v "\#") -+BIG_ENDIAN := $(shell echo __XTENSA_EB__ | $(CC) -E - | grep -v "\#") - - export ccflags-y - export BIG_ENDIAN -diff --git a/arch/xtensa/include/asm/traps.h b/arch/xtensa/include/asm/traps.h -index f2faa58f9a43..03d02df47b9a 100644 ---- a/arch/xtensa/include/asm/traps.h -+++ b/arch/xtensa/include/asm/traps.h -@@ -24,30 +24,39 @@ static inline void spill_registers(void) - { - #if XCHAL_NUM_AREGS > 16 - __asm__ __volatile__ ( -- " call12 1f\n" -+ " call8 1f\n" - " _j 2f\n" - " retw\n" - " .align 4\n" - "1:\n" -+#if XCHAL_NUM_AREGS == 32 -+ " _entry a1, 32\n" -+ " addi a8, a0, 3\n" -+ " _entry a1, 16\n" -+ " mov a12, a12\n" -+ " retw\n" -+#else - " _entry a1, 48\n" -- " addi a12, a0, 3\n" --#if XCHAL_NUM_AREGS > 32 -- " .rept (" __stringify(XCHAL_NUM_AREGS) " - 32) / 12\n" -+ " call12 1f\n" -+ " retw\n" -+ " .align 4\n" -+ "1:\n" -+ " .rept (" __stringify(XCHAL_NUM_AREGS) " - 16) / 12\n" - " _entry a1, 48\n" - " mov a12, a0\n" - " .endr\n" --#endif -- " _entry a1, 48\n" -+ " _entry a1, 16\n" - #if XCHAL_NUM_AREGS % 12 == 0 -- " mov a8, a8\n" --#elif XCHAL_NUM_AREGS % 12 == 4 - " mov a12, a12\n" --#elif XCHAL_NUM_AREGS % 12 == 8 -+#elif XCHAL_NUM_AREGS % 12 == 4 - " mov a4, a4\n" -+#elif XCHAL_NUM_AREGS % 12 == 8 -+ " mov a8, a8\n" - #endif - " retw\n" -+#endif - "2:\n" -- : : : "a12", "a13", "memory"); -+ : : : "a8", "a9", "memory"); - #else - __asm__ __volatile__ ( - " mov a12, a12\n" -diff --git a/arch/xtensa/kernel/entry.S b/arch/xtensa/kernel/entry.S -index 6e53174f8556..b268d3cc01d1 100644 ---- a/arch/xtensa/kernel/entry.S -+++ b/arch/xtensa/kernel/entry.S -@@ -549,12 +549,13 @@ user_exception_exit: - * (if we have restored WSBITS-1 frames). - */ - -+2: - #if XCHAL_HAVE_THREADPTR - l32i a3, a1, PT_THREADPTR - wur a3, threadptr - #endif - --2: j common_exception_exit -+ j common_exception_exit - - /* This is the kernel exception exit. - * We avoided to do a MOVSP when we entered the exception, but we -@@ -1933,7 +1934,7 @@ ENDPROC(system_call) - mov a12, a0 - .endr - #endif -- _entry a1, 48 -+ _entry a1, 16 - #if XCHAL_NUM_AREGS % 12 == 0 - mov a8, a8 - #elif XCHAL_NUM_AREGS % 12 == 4 -@@ -1957,7 +1958,7 @@ ENDPROC(system_call) - - ENTRY(_switch_to) - -- entry a1, 16 -+ entry a1, 48 - - mov a11, a3 # and 'next' (a3) - -diff --git a/drivers/auxdisplay/ks0108.c b/drivers/auxdisplay/ks0108.c -index 5b93852392b8..0d752851a1ee 100644 ---- a/drivers/auxdisplay/ks0108.c -+++ b/drivers/auxdisplay/ks0108.c -@@ -139,6 +139,7 @@ static int __init ks0108_init(void) - - ks0108_pardevice = parport_register_device(ks0108_parport, KS0108_NAME, - NULL, NULL, NULL, PARPORT_DEV_EXCL, NULL); -+ parport_put_port(ks0108_parport); - if (ks0108_pardevice == NULL) { - printk(KERN_ERR KS0108_NAME ": ERROR: " - "parport didn't register new device\n"); -diff --git a/drivers/base/devres.c b/drivers/base/devres.c -index 507379e7b763..4e2fb405da87 100644 ---- a/drivers/base/devres.c -+++ b/drivers/base/devres.c -@@ -296,10 +296,10 @@ void * devres_get(struct device *dev, void *new_res, - if (!dr) { - add_dr(dev, &new_dr->node); - dr = new_dr; -- new_dr = NULL; -+ new_res = NULL; - } - spin_unlock_irqrestore(&dev->devres_lock, flags); -- devres_free(new_dr); -+ devres_free(new_res); - - return dr->data; - } -diff --git a/drivers/base/platform.c b/drivers/base/platform.c -index 9eda84246ffd..8717be5093a2 100644 ---- a/drivers/base/platform.c -+++ b/drivers/base/platform.c -@@ -347,9 +347,7 @@ int platform_device_add(struct platform_device *pdev) - - while (--i >= 0) { - struct resource *r = &pdev->resource[i]; -- unsigned long type = resource_type(r); -- -- if (type == IORESOURCE_MEM || type == IORESOURCE_IO) -+ if (r->parent) - release_resource(r); - } - -@@ -380,9 +378,7 @@ void platform_device_del(struct platform_device *pdev) - - for (i = 0; i < pdev->num_resources; i++) { - struct resource *r = &pdev->resource[i]; -- unsigned long type = resource_type(r); -- -- if (type == IORESOURCE_MEM || type == IORESOURCE_IO) -+ if (r->parent) - release_resource(r); - } - } -diff --git a/drivers/clk/versatile/clk-sp810.c b/drivers/clk/versatile/clk-sp810.c -index bf9b15a585e1..b9e05bde0c06 100644 ---- a/drivers/clk/versatile/clk-sp810.c -+++ b/drivers/clk/versatile/clk-sp810.c -@@ -128,8 +128,8 @@ struct clk *clk_sp810_timerclken_of_get(struct of_phandle_args *clkspec, - { - struct clk_sp810 *sp810 = data; - -- if (WARN_ON(clkspec->args_count != 1 || clkspec->args[0] > -- ARRAY_SIZE(sp810->timerclken))) -+ if (WARN_ON(clkspec->args_count != 1 || -+ clkspec->args[0] >= ARRAY_SIZE(sp810->timerclken))) - return NULL; - - return sp810->timerclken[clkspec->args[0]].clk; -diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c -index fc604fc75797..1fbd38b371d4 100644 ---- a/drivers/gpu/drm/radeon/radeon_connectors.c -+++ b/drivers/gpu/drm/radeon/radeon_connectors.c -@@ -78,6 +78,11 @@ void radeon_connector_hotplug(struct drm_connector *connector) - if (!radeon_hpd_sense(rdev, radeon_connector->hpd.hpd)) { - drm_helper_connector_dpms(connector, DRM_MODE_DPMS_OFF); - } else if (radeon_dp_needs_link_train(radeon_connector)) { -+ /* Don't try to start link training before we -+ * have the dpcd */ -+ if (!radeon_dp_getdpcd(radeon_connector)) -+ return; -+ - /* set it to OFF so that drm_helper_connector_dpms() - * won't return immediately since the current state - * is ON at this point. -diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c -index ada164e1b3a1..de904e6a4ab7 100644 ---- a/drivers/hid/usbhid/hid-core.c -+++ b/drivers/hid/usbhid/hid-core.c -@@ -180,7 +180,7 @@ static void hid_io_error(struct hid_device *hid) - if (time_after(jiffies, usbhid->stop_retry)) { - - /* Retries failed, so do a port reset unless we lack bandwidth*/ -- if (test_bit(HID_NO_BANDWIDTH, &usbhid->iofl) -+ if (!test_bit(HID_NO_BANDWIDTH, &usbhid->iofl) - && !test_and_set_bit(HID_RESET_PENDING, &usbhid->iofl)) { - - schedule_work(&usbhid->reset_work); -diff --git a/drivers/iio/gyro/Kconfig b/drivers/iio/gyro/Kconfig -index 107cafcb89da..953a0621c6fe 100644 ---- a/drivers/iio/gyro/Kconfig -+++ b/drivers/iio/gyro/Kconfig -@@ -73,7 +73,8 @@ config IIO_ST_GYRO_SPI_3AXIS - config ITG3200 - tristate "InvenSense ITG3200 Digital 3-Axis Gyroscope I2C driver" - depends on I2C -- select IIO_TRIGGERED_BUFFER if IIO_BUFFER -+ select IIO_BUFFER -+ select IIO_TRIGGERED_BUFFER - help - Say yes here to add support for the InvenSense ITG3200 digital - 3-axis gyroscope sensor. -diff --git a/drivers/iio/imu/adis16480.c b/drivers/iio/imu/adis16480.c -index b7db38376295..b0d05e88087c 100644 ---- a/drivers/iio/imu/adis16480.c -+++ b/drivers/iio/imu/adis16480.c -@@ -110,6 +110,10 @@ - struct adis16480_chip_info { - unsigned int num_channels; - const struct iio_chan_spec *channels; -+ unsigned int gyro_max_val; -+ unsigned int gyro_max_scale; -+ unsigned int accel_max_val; -+ unsigned int accel_max_scale; - }; - - struct adis16480 { -@@ -533,19 +537,21 @@ static int adis16480_set_filter_freq(struct iio_dev *indio_dev, - static int adis16480_read_raw(struct iio_dev *indio_dev, - const struct iio_chan_spec *chan, int *val, int *val2, long info) - { -+ struct adis16480 *st = iio_priv(indio_dev); -+ - switch (info) { - case IIO_CHAN_INFO_RAW: - return adis_single_conversion(indio_dev, chan, 0, val); - case IIO_CHAN_INFO_SCALE: - switch (chan->type) { - case IIO_ANGL_VEL: -- *val = 0; -- *val2 = IIO_DEGREE_TO_RAD(20000); /* 0.02 degree/sec */ -- return IIO_VAL_INT_PLUS_MICRO; -+ *val = st->chip_info->gyro_max_scale; -+ *val2 = st->chip_info->gyro_max_val; -+ return IIO_VAL_FRACTIONAL; - case IIO_ACCEL: -- *val = 0; -- *val2 = IIO_G_TO_M_S_2(800); /* 0.8 mg */ -- return IIO_VAL_INT_PLUS_MICRO; -+ *val = st->chip_info->accel_max_scale; -+ *val2 = st->chip_info->accel_max_val; -+ return IIO_VAL_FRACTIONAL; - case IIO_MAGN: - *val = 0; - *val2 = 100; /* 0.0001 gauss */ -@@ -702,18 +708,39 @@ static const struct adis16480_chip_info adis16480_chip_info[] = { - [ADIS16375] = { - .channels = adis16485_channels, - .num_channels = ARRAY_SIZE(adis16485_channels), -+ /* -+ * storing the value in rad/degree and the scale in degree -+ * gives us the result in rad and better precession than -+ * storing the scale directly in rad. -+ */ -+ .gyro_max_val = IIO_RAD_TO_DEGREE(22887), -+ .gyro_max_scale = 300, -+ .accel_max_val = IIO_M_S_2_TO_G(21973), -+ .accel_max_scale = 18, - }, - [ADIS16480] = { - .channels = adis16480_channels, - .num_channels = ARRAY_SIZE(adis16480_channels), -+ .gyro_max_val = IIO_RAD_TO_DEGREE(22500), -+ .gyro_max_scale = 450, -+ .accel_max_val = IIO_M_S_2_TO_G(12500), -+ .accel_max_scale = 5, - }, - [ADIS16485] = { - .channels = adis16485_channels, - .num_channels = ARRAY_SIZE(adis16485_channels), -+ .gyro_max_val = IIO_RAD_TO_DEGREE(22500), -+ .gyro_max_scale = 450, -+ .accel_max_val = IIO_M_S_2_TO_G(20000), -+ .accel_max_scale = 5, - }, - [ADIS16488] = { - .channels = adis16480_channels, - .num_channels = ARRAY_SIZE(adis16480_channels), -+ .gyro_max_val = IIO_RAD_TO_DEGREE(22500), -+ .gyro_max_scale = 450, -+ .accel_max_val = IIO_M_S_2_TO_G(22500), -+ .accel_max_scale = 18, - }, - }; - -diff --git a/drivers/of/address.c b/drivers/of/address.c -index 8fb2b5769733..9ceff3c86d74 100644 ---- a/drivers/of/address.c -+++ b/drivers/of/address.c -@@ -629,10 +629,10 @@ struct device_node *of_find_matching_node_by_address(struct device_node *from, - struct resource res; - - while (dn) { -- if (of_address_to_resource(dn, 0, &res)) -- continue; -- if (res.start == base_address) -+ if (!of_address_to_resource(dn, 0, &res) && -+ res.start == base_address) - return dn; -+ - dn = of_find_matching_node(dn, matches); - } - -diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c -index 910339c0791f..390e4094e4d5 100644 ---- a/drivers/pci/quirks.c -+++ b/drivers/pci/quirks.c -@@ -2796,12 +2796,15 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x3c28, vtd_mask_spec_errors); - - static void fixup_ti816x_class(struct pci_dev *dev) - { -+ u32 class = dev->class; -+ - /* TI 816x devices do not have class code set when in PCIe boot mode */ -- dev_info(&dev->dev, "Setting PCI class for 816x PCIe device\n"); -- dev->class = PCI_CLASS_MULTIMEDIA_VIDEO; -+ dev->class = PCI_CLASS_MULTIMEDIA_VIDEO << 8; -+ dev_info(&dev->dev, "PCI class overridden (%#08x -> %#08x)\n", -+ class, dev->class); - } - DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_TI, 0xb800, -- PCI_CLASS_NOT_DEFINED, 0, fixup_ti816x_class); -+ PCI_CLASS_NOT_DEFINED, 0, fixup_ti816x_class); - - /* Some PCIe devices do not work reliably with the claimed maximum - * payload size supported. -diff --git a/drivers/tty/serial/8250/8250_pnp.c b/drivers/tty/serial/8250/8250_pnp.c -index 35d9ab95c5cb..91b14202b90b 100644 ---- a/drivers/tty/serial/8250/8250_pnp.c -+++ b/drivers/tty/serial/8250/8250_pnp.c -@@ -365,6 +365,11 @@ static const struct pnp_device_id pnp_dev_table[] = { - /* Winbond CIR port, should not be probed. We should keep track - of it to prevent the legacy serial driver from probing it */ - { "WEC1022", CIR_PORT }, -+ /* -+ * SMSC IrCC SIR/FIR port, should not be probed by serial driver -+ * as well so its own driver can bind to it. -+ */ -+ { "SMCF010", CIR_PORT }, - { "", 0 } - }; - -diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c -index 57d7ec6c8090..27040a6314d4 100644 ---- a/drivers/usb/dwc3/ep0.c -+++ b/drivers/usb/dwc3/ep0.c -@@ -804,6 +804,11 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc, - unsigned maxp = ep0->endpoint.maxpacket; - - transfer_size += (maxp - (transfer_size % maxp)); -+ -+ /* Maximum of DWC3_EP0_BOUNCE_SIZE can only be received */ -+ if (transfer_size > DWC3_EP0_BOUNCE_SIZE) -+ transfer_size = DWC3_EP0_BOUNCE_SIZE; -+ - transferred = min_t(u32, ur->length, - transfer_size - length); - memcpy(ur->buf, dwc->ep0_bounce, transferred); -@@ -916,11 +921,14 @@ static void __dwc3_ep0_do_control_data(struct dwc3 *dwc, - return; - } - -- WARN_ON(req->request.length > DWC3_EP0_BOUNCE_SIZE); -- - maxpacket = dep->endpoint.maxpacket; - transfer_size = roundup(req->request.length, maxpacket); - -+ if (transfer_size > DWC3_EP0_BOUNCE_SIZE) { -+ dev_WARN(dwc->dev, "bounce buf can't handle req len\n"); -+ transfer_size = DWC3_EP0_BOUNCE_SIZE; -+ } -+ - dwc->ep0_bounced = true; - - /* -diff --git a/drivers/usb/host/ehci-sysfs.c b/drivers/usb/host/ehci-sysfs.c -index 14ced00ba220..0659024290af 100644 ---- a/drivers/usb/host/ehci-sysfs.c -+++ b/drivers/usb/host/ehci-sysfs.c -@@ -29,7 +29,7 @@ static ssize_t show_companion(struct device *dev, - int count = PAGE_SIZE; - char *ptr = buf; - -- ehci = hcd_to_ehci(bus_to_hcd(dev_get_drvdata(dev))); -+ ehci = hcd_to_ehci(dev_get_drvdata(dev)); - nports = HCS_N_PORTS(ehci->hcs_params); - - for (index = 0; index < nports; ++index) { -@@ -54,7 +54,7 @@ static ssize_t store_companion(struct device *dev, - struct ehci_hcd *ehci; - int portnum, new_owner; - -- ehci = hcd_to_ehci(bus_to_hcd(dev_get_drvdata(dev))); -+ ehci = hcd_to_ehci(dev_get_drvdata(dev)); - new_owner = PORT_OWNER; /* Owned by companion */ - if (sscanf(buf, "%d", &portnum) != 1) - return -EINVAL; -@@ -85,7 +85,7 @@ static ssize_t show_uframe_periodic_max(struct device *dev, - struct ehci_hcd *ehci; - int n; - -- ehci = hcd_to_ehci(bus_to_hcd(dev_get_drvdata(dev))); -+ ehci = hcd_to_ehci(dev_get_drvdata(dev)); - n = scnprintf(buf, PAGE_SIZE, "%d\n", ehci->uframe_periodic_max); - return n; - } -@@ -102,7 +102,7 @@ static ssize_t store_uframe_periodic_max(struct device *dev, - unsigned long flags; - ssize_t ret; - -- ehci = hcd_to_ehci(bus_to_hcd(dev_get_drvdata(dev))); -+ ehci = hcd_to_ehci(dev_get_drvdata(dev)); - if (kstrtouint(buf, 0, &uframe_periodic_max) < 0) - return -EINVAL; - -diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c -index b55e5f3a311d..514f3117ee2b 100644 ---- a/drivers/usb/serial/ftdi_sio.c -+++ b/drivers/usb/serial/ftdi_sio.c -@@ -621,6 +621,10 @@ static struct usb_device_id id_table_combined [] = { - { USB_DEVICE(FTDI_VID, FTDI_NT_ORIONLXM_PID), - .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, - { USB_DEVICE(FTDI_VID, FTDI_SYNAPSE_SS200_PID) }, -+ { USB_DEVICE(FTDI_VID, FTDI_CUSTOMWARE_MINIPLEX_PID) }, -+ { USB_DEVICE(FTDI_VID, FTDI_CUSTOMWARE_MINIPLEX2_PID) }, -+ { USB_DEVICE(FTDI_VID, FTDI_CUSTOMWARE_MINIPLEX2WI_PID) }, -+ { USB_DEVICE(FTDI_VID, FTDI_CUSTOMWARE_MINIPLEX3_PID) }, - /* - * ELV devices: - */ -diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h -index 99316d7cfc03..bfb0ecd98808 100644 ---- a/drivers/usb/serial/ftdi_sio_ids.h -+++ b/drivers/usb/serial/ftdi_sio_ids.h -@@ -568,6 +568,14 @@ - */ - #define FTDI_SYNAPSE_SS200_PID 0x9090 /* SS200 - SNAP Stick 200 */ - -+/* -+ * CustomWare / ShipModul NMEA multiplexers product ids (FTDI_VID) -+ */ -+#define FTDI_CUSTOMWARE_MINIPLEX_PID 0xfd48 /* MiniPlex first generation NMEA Multiplexer */ -+#define FTDI_CUSTOMWARE_MINIPLEX2_PID 0xfd49 /* MiniPlex-USB and MiniPlex-2 series */ -+#define FTDI_CUSTOMWARE_MINIPLEX2WI_PID 0xfd4a /* MiniPlex-2Wi */ -+#define FTDI_CUSTOMWARE_MINIPLEX3_PID 0xfd4b /* MiniPlex-3 series */ -+ - - /********************************/ - /** third-party VID/PID combos **/ -diff --git a/drivers/usb/serial/symbolserial.c b/drivers/usb/serial/symbolserial.c -index 9b1648945e7a..1e2d86d4f539 100644 ---- a/drivers/usb/serial/symbolserial.c -+++ b/drivers/usb/serial/symbolserial.c -@@ -97,7 +97,7 @@ exit: - - static int symbol_open(struct tty_struct *tty, struct usb_serial_port *port) - { -- struct symbol_private *priv = usb_get_serial_data(port->serial); -+ struct symbol_private *priv = usb_get_serial_port_data(port); - unsigned long flags; - int result = 0; - -@@ -123,7 +123,7 @@ static void symbol_close(struct usb_serial_port *port) - static void symbol_throttle(struct tty_struct *tty) - { - struct usb_serial_port *port = tty->driver_data; -- struct symbol_private *priv = usb_get_serial_data(port->serial); -+ struct symbol_private *priv = usb_get_serial_port_data(port); - - spin_lock_irq(&priv->lock); - priv->throttled = true; -@@ -133,7 +133,7 @@ static void symbol_throttle(struct tty_struct *tty) - static void symbol_unthrottle(struct tty_struct *tty) - { - struct usb_serial_port *port = tty->driver_data; -- struct symbol_private *priv = usb_get_serial_data(port->serial); -+ struct symbol_private *priv = usb_get_serial_port_data(port); - int result; - bool was_throttled; - -diff --git a/fs/hpfs/namei.c b/fs/hpfs/namei.c -index 345713d2f8f3..6b42789ae799 100644 ---- a/fs/hpfs/namei.c -+++ b/fs/hpfs/namei.c -@@ -8,6 +8,17 @@ - #include - #include "hpfs_fn.h" - -+static void hpfs_update_directory_times(struct inode *dir) -+{ -+ time_t t = get_seconds(); -+ if (t == dir->i_mtime.tv_sec && -+ t == dir->i_ctime.tv_sec) -+ return; -+ dir->i_mtime.tv_sec = dir->i_ctime.tv_sec = t; -+ dir->i_mtime.tv_nsec = dir->i_ctime.tv_nsec = 0; -+ hpfs_write_inode_nolock(dir); -+} -+ - static int hpfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) - { - const unsigned char *name = dentry->d_name.name; -@@ -99,6 +110,7 @@ static int hpfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) - result->i_mode = mode | S_IFDIR; - hpfs_write_inode_nolock(result); - } -+ hpfs_update_directory_times(dir); - d_instantiate(dentry, result); - hpfs_unlock(dir->i_sb); - return 0; -@@ -187,6 +199,7 @@ static int hpfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, b - result->i_mode = mode | S_IFREG; - hpfs_write_inode_nolock(result); - } -+ hpfs_update_directory_times(dir); - d_instantiate(dentry, result); - hpfs_unlock(dir->i_sb); - return 0; -@@ -262,6 +275,7 @@ static int hpfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, de - insert_inode_hash(result); - - hpfs_write_inode_nolock(result); -+ hpfs_update_directory_times(dir); - d_instantiate(dentry, result); - brelse(bh); - hpfs_unlock(dir->i_sb); -@@ -340,6 +354,7 @@ static int hpfs_symlink(struct inode *dir, struct dentry *dentry, const char *sy - insert_inode_hash(result); - - hpfs_write_inode_nolock(result); -+ hpfs_update_directory_times(dir); - d_instantiate(dentry, result); - hpfs_unlock(dir->i_sb); - return 0; -@@ -423,6 +438,8 @@ again: - out1: - hpfs_brelse4(&qbh); - out: -+ if (!err) -+ hpfs_update_directory_times(dir); - hpfs_unlock(dir->i_sb); - return err; - } -@@ -477,6 +494,8 @@ static int hpfs_rmdir(struct inode *dir, struct dentry *dentry) - out1: - hpfs_brelse4(&qbh); - out: -+ if (!err) -+ hpfs_update_directory_times(dir); - hpfs_unlock(dir->i_sb); - return err; - } -@@ -595,7 +614,7 @@ static int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry, - goto end1; - } - -- end: -+end: - hpfs_i(i)->i_parent_dir = new_dir->i_ino; - if (S_ISDIR(i->i_mode)) { - inc_nlink(new_dir); -@@ -610,6 +629,10 @@ static int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry, - brelse(bh); - } - end1: -+ if (!err) { -+ hpfs_update_directory_times(old_dir); -+ hpfs_update_directory_times(new_dir); -+ } - hpfs_unlock(i->i_sb); - return err; - } -diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h -index 3d35b7023591..683911167953 100644 ---- a/include/linux/iio/iio.h -+++ b/include/linux/iio/iio.h -@@ -569,6 +569,15 @@ int iio_str_to_fixpoint(const char *str, int fract_mult, int *integer, - #define IIO_DEGREE_TO_RAD(deg) (((deg) * 314159ULL + 9000000ULL) / 18000000ULL) - - /** -+ * IIO_RAD_TO_DEGREE() - Convert rad to degree -+ * @rad: A value in rad -+ * -+ * Returns the given value converted from rad to degree -+ */ -+#define IIO_RAD_TO_DEGREE(rad) \ -+ (((rad) * 18000000ULL + 314159ULL / 2) / 314159ULL) -+ -+/** - * IIO_G_TO_M_S_2() - Convert g to meter / second**2 - * @g: A value in g - * -@@ -576,4 +585,12 @@ int iio_str_to_fixpoint(const char *str, int fract_mult, int *integer, - */ - #define IIO_G_TO_M_S_2(g) ((g) * 980665ULL / 100000ULL) - -+/** -+ * IIO_M_S_2_TO_G() - Convert meter / second**2 to g -+ * @ms2: A value in meter / second**2 -+ * -+ * Returns the given value converted from meter / second**2 to g -+ */ -+#define IIO_M_S_2_TO_G(ms2) (((ms2) * 100000ULL + 980665ULL / 2) / 980665ULL) -+ - #endif /* _INDUSTRIAL_IO_H_ */ diff --git a/patch/kernel/marvell-default/1-patch-3.10.89-90.patch b/patch/kernel/marvell-default/1-patch-3.10.89-90.patch deleted file mode 100644 index d5611b88cc..0000000000 --- a/patch/kernel/marvell-default/1-patch-3.10.89-90.patch +++ /dev/null @@ -1,2146 +0,0 @@ -diff --git a/Makefile b/Makefile -index ca82393e1eea..ce741a9f5b1c 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,6 +1,6 @@ - VERSION = 3 - PATCHLEVEL = 10 --SUBLEVEL = 89 -+SUBLEVEL = 90 - EXTRAVERSION = - NAME = TOSSUG Baby Fish - -diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig -index 0677ff4814fa..661ccf87b9ad 100644 ---- a/arch/arm64/Kconfig -+++ b/arch/arm64/Kconfig -@@ -56,6 +56,10 @@ config NO_IOPORT - config STACKTRACE_SUPPORT - def_bool y - -+config ILLEGAL_POINTER_VALUE -+ hex -+ default 0xdead000000000000 -+ - config LOCKDEP_SUPPORT - def_bool y - -diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S -index 53dcae49e729..f480e7d6e8b2 100644 ---- a/arch/arm64/kernel/head.S -+++ b/arch/arm64/kernel/head.S -@@ -184,6 +184,11 @@ ENTRY(el2_setup) - msr hstr_el2, xzr // Disable CP15 traps to EL2 - #endif - -+ /* EL2 debug */ -+ mrs x0, pmcr_el0 // Disable debug access traps -+ ubfx x0, x0, #11, #5 // to EL2 and allow access to -+ msr mdcr_el2, x0 // all PMU counters from EL1 -+ - /* Stage-2 translation */ - msr vttbr_el2, xzr - -diff --git a/arch/arm64/kernel/signal32.c b/arch/arm64/kernel/signal32.c -index b9564b8d6bab..1e60acc6a4d7 100644 ---- a/arch/arm64/kernel/signal32.c -+++ b/arch/arm64/kernel/signal32.c -@@ -231,14 +231,32 @@ int copy_siginfo_from_user32(siginfo_t *to, compat_siginfo_t __user *from) - - /* - * VFP save/restore code. -+ * -+ * We have to be careful with endianness, since the fpsimd context-switch -+ * code operates on 128-bit (Q) register values whereas the compat ABI -+ * uses an array of 64-bit (D) registers. Consequently, we need to swap -+ * the two halves of each Q register when running on a big-endian CPU. - */ -+union __fpsimd_vreg { -+ __uint128_t raw; -+ struct { -+#ifdef __AARCH64EB__ -+ u64 hi; -+ u64 lo; -+#else -+ u64 lo; -+ u64 hi; -+#endif -+ }; -+}; -+ - static int compat_preserve_vfp_context(struct compat_vfp_sigframe __user *frame) - { - struct fpsimd_state *fpsimd = ¤t->thread.fpsimd_state; - compat_ulong_t magic = VFP_MAGIC; - compat_ulong_t size = VFP_STORAGE_SIZE; - compat_ulong_t fpscr, fpexc; -- int err = 0; -+ int i, err = 0; - - /* - * Save the hardware registers to the fpsimd_state structure. -@@ -254,10 +272,15 @@ static int compat_preserve_vfp_context(struct compat_vfp_sigframe __user *frame) - /* - * Now copy the FP registers. Since the registers are packed, - * we can copy the prefix we want (V0-V15) as it is. -- * FIXME: Won't work if big endian. - */ -- err |= __copy_to_user(&frame->ufp.fpregs, fpsimd->vregs, -- sizeof(frame->ufp.fpregs)); -+ for (i = 0; i < ARRAY_SIZE(frame->ufp.fpregs); i += 2) { -+ union __fpsimd_vreg vreg = { -+ .raw = fpsimd->vregs[i >> 1], -+ }; -+ -+ __put_user_error(vreg.lo, &frame->ufp.fpregs[i], err); -+ __put_user_error(vreg.hi, &frame->ufp.fpregs[i + 1], err); -+ } - - /* Create an AArch32 fpscr from the fpsr and the fpcr. */ - fpscr = (fpsimd->fpsr & VFP_FPSCR_STAT_MASK) | -@@ -282,7 +305,7 @@ static int compat_restore_vfp_context(struct compat_vfp_sigframe __user *frame) - compat_ulong_t magic = VFP_MAGIC; - compat_ulong_t size = VFP_STORAGE_SIZE; - compat_ulong_t fpscr; -- int err = 0; -+ int i, err = 0; - - __get_user_error(magic, &frame->magic, err); - __get_user_error(size, &frame->size, err); -@@ -292,12 +315,14 @@ static int compat_restore_vfp_context(struct compat_vfp_sigframe __user *frame) - if (magic != VFP_MAGIC || size != VFP_STORAGE_SIZE) - return -EINVAL; - -- /* -- * Copy the FP registers into the start of the fpsimd_state. -- * FIXME: Won't work if big endian. -- */ -- err |= __copy_from_user(fpsimd.vregs, frame->ufp.fpregs, -- sizeof(frame->ufp.fpregs)); -+ /* Copy the FP registers into the start of the fpsimd_state. */ -+ for (i = 0; i < ARRAY_SIZE(frame->ufp.fpregs); i += 2) { -+ union __fpsimd_vreg vreg; -+ -+ __get_user_error(vreg.lo, &frame->ufp.fpregs[i], err); -+ __get_user_error(vreg.hi, &frame->ufp.fpregs[i + 1], err); -+ fpsimd.vregs[i >> 1] = vreg.raw; -+ } - - /* Extract the fpsr and the fpcr from the fpscr */ - __get_user_error(fpscr, &frame->ufp.fpscr, err); -diff --git a/arch/parisc/kernel/irq.c b/arch/parisc/kernel/irq.c -index 2e6443b1e922..c32a37e0e0d2 100644 ---- a/arch/parisc/kernel/irq.c -+++ b/arch/parisc/kernel/irq.c -@@ -524,8 +524,8 @@ void do_cpu_irq_mask(struct pt_regs *regs) - struct pt_regs *old_regs; - unsigned long eirr_val; - int irq, cpu = smp_processor_id(); --#ifdef CONFIG_SMP - struct irq_desc *desc; -+#ifdef CONFIG_SMP - cpumask_t dest; - #endif - -@@ -538,8 +538,12 @@ void do_cpu_irq_mask(struct pt_regs *regs) - goto set_out; - irq = eirr_to_irq(eirr_val); - --#ifdef CONFIG_SMP -+ /* Filter out spurious interrupts, mostly from serial port at bootup */ - desc = irq_to_desc(irq); -+ if (unlikely(!desc->action)) -+ goto set_out; -+ -+#ifdef CONFIG_SMP - cpumask_copy(&dest, desc->irq_data.affinity); - if (irqd_is_per_cpu(&desc->irq_data) && - !cpu_isset(smp_processor_id(), dest)) { -diff --git a/arch/powerpc/include/asm/pgtable-ppc64.h b/arch/powerpc/include/asm/pgtable-ppc64.h -index e3d55f6f24fe..6fbb2b46098c 100644 ---- a/arch/powerpc/include/asm/pgtable-ppc64.h -+++ b/arch/powerpc/include/asm/pgtable-ppc64.h -@@ -130,7 +130,19 @@ - #define pte_iterate_hashed_end() } while(0) - - #ifdef CONFIG_PPC_HAS_HASH_64K --#define pte_pagesize_index(mm, addr, pte) get_slice_psize(mm, addr) -+/* -+ * We expect this to be called only for user addresses or kernel virtual -+ * addresses other than the linear mapping. -+ */ -+#define pte_pagesize_index(mm, addr, pte) \ -+ ({ \ -+ unsigned int psize; \ -+ if (is_kernel_addr(addr)) \ -+ psize = MMU_PAGE_4K; \ -+ else \ -+ psize = get_slice_psize(mm, addr); \ -+ psize; \ -+ }) - #else - #define pte_pagesize_index(mm, addr, pte) MMU_PAGE_4K - #endif -diff --git a/arch/powerpc/include/asm/rtas.h b/arch/powerpc/include/asm/rtas.h -index 34fd70488d83..c5d5cb36f6c6 100644 ---- a/arch/powerpc/include/asm/rtas.h -+++ b/arch/powerpc/include/asm/rtas.h -@@ -255,6 +255,7 @@ extern void rtas_power_off(void); - extern void rtas_halt(void); - extern void rtas_os_term(char *str); - extern int rtas_get_sensor(int sensor, int index, int *state); -+extern int rtas_get_sensor_fast(int sensor, int index, int *state); - extern int rtas_get_power_level(int powerdomain, int *level); - extern int rtas_set_power_level(int powerdomain, int level, int *setlevel); - extern bool rtas_indicator_present(int token, int *maxindex); -diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c -index 52add6f3e201..f956a2f84a15 100644 ---- a/arch/powerpc/kernel/rtas.c -+++ b/arch/powerpc/kernel/rtas.c -@@ -584,6 +584,23 @@ int rtas_get_sensor(int sensor, int index, int *state) - } - EXPORT_SYMBOL(rtas_get_sensor); - -+int rtas_get_sensor_fast(int sensor, int index, int *state) -+{ -+ int token = rtas_token("get-sensor-state"); -+ int rc; -+ -+ if (token == RTAS_UNKNOWN_SERVICE) -+ return -ENOENT; -+ -+ rc = rtas_call(token, 2, 2, state, sensor, index); -+ WARN_ON(rc == RTAS_BUSY || (rc >= RTAS_EXTENDED_DELAY_MIN && -+ rc <= RTAS_EXTENDED_DELAY_MAX)); -+ -+ if (rc < 0) -+ return rtas_error_rc(rc); -+ return rc; -+} -+ - bool rtas_indicator_present(int token, int *maxindex) - { - int proplen, count, i; -diff --git a/arch/powerpc/platforms/pseries/ras.c b/arch/powerpc/platforms/pseries/ras.c -index c4dfccd3a3d9..2338e6e98483 100644 ---- a/arch/powerpc/platforms/pseries/ras.c -+++ b/arch/powerpc/platforms/pseries/ras.c -@@ -187,7 +187,8 @@ static irqreturn_t ras_epow_interrupt(int irq, void *dev_id) - int state; - int critical; - -- status = rtas_get_sensor(EPOW_SENSOR_TOKEN, EPOW_SENSOR_INDEX, &state); -+ status = rtas_get_sensor_fast(EPOW_SENSOR_TOKEN, EPOW_SENSOR_INDEX, -+ &state); - - if (state > 3) - critical = 1; /* Time Critical */ -diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c -index 3ac7e319918d..6a70f0ee4092 100644 ---- a/arch/x86/mm/init_32.c -+++ b/arch/x86/mm/init_32.c -@@ -137,6 +137,7 @@ page_table_range_init_count(unsigned long start, unsigned long end) - - vaddr = start; - pgd_idx = pgd_index(vaddr); -+ pmd_idx = pmd_index(vaddr); - - for ( ; (pgd_idx < PTRS_PER_PGD) && (vaddr != end); pgd_idx++) { - for (; (pmd_idx < PTRS_PER_PMD) && (vaddr != end); -diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c -index 0c966fecfb8c..5479d677f9be 100644 ---- a/arch/x86/net/bpf_jit_comp.c -+++ b/arch/x86/net/bpf_jit_comp.c -@@ -176,7 +176,12 @@ void bpf_jit_compile(struct sk_filter *fp) - } - cleanup_addr = proglen; /* epilogue address */ - -- for (pass = 0; pass < 10; pass++) { -+ /* JITed image shrinks with every pass and the loop iterates -+ * until the image stops shrinking. Very large bpf programs -+ * may converge on the last pass. In such case do one more -+ * pass to emit the final image -+ */ -+ for (pass = 0; pass < 10 || image; pass++) { - u8 seen_or_pass0 = (pass == 0) ? (SEEN_XREG | SEEN_DATAREF | SEEN_MEM) : seen; - /* no prologue/epilogue for trivial filters (RET something) */ - proglen = 0; -diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c -index 8cac69819054..9c64a973190e 100644 ---- a/drivers/gpu/drm/radeon/radeon_combios.c -+++ b/drivers/gpu/drm/radeon/radeon_combios.c -@@ -3403,6 +3403,14 @@ void radeon_combios_asic_init(struct drm_device *dev) - rdev->pdev->subsystem_device == 0x30ae) - return; - -+ /* quirk for rs4xx HP Compaq dc5750 Small Form Factor to make it resume -+ * - it hangs on resume inside the dynclk 1 table. -+ */ -+ if (rdev->family == CHIP_RS480 && -+ rdev->pdev->subsystem_vendor == 0x103c && -+ rdev->pdev->subsystem_device == 0x280a) -+ return; -+ - /* DYN CLK 1 */ - table = combios_get_table_offset(dev, COMBIOS_DYN_CLK_1_TABLE); - if (table) -diff --git a/drivers/iio/gyro/Kconfig b/drivers/iio/gyro/Kconfig -index 953a0621c6fe..107cafcb89da 100644 ---- a/drivers/iio/gyro/Kconfig -+++ b/drivers/iio/gyro/Kconfig -@@ -73,8 +73,7 @@ config IIO_ST_GYRO_SPI_3AXIS - config ITG3200 - tristate "InvenSense ITG3200 Digital 3-Axis Gyroscope I2C driver" - depends on I2C -- select IIO_BUFFER -- select IIO_TRIGGERED_BUFFER -+ select IIO_TRIGGERED_BUFFER if IIO_BUFFER - help - Say yes here to add support for the InvenSense ITG3200 digital - 3-axis gyroscope sensor. -diff --git a/drivers/infiniband/core/uverbs.h b/drivers/infiniband/core/uverbs.h -index 0fcd7aa26fa2..8b8de21bfdc5 100644 ---- a/drivers/infiniband/core/uverbs.h -+++ b/drivers/infiniband/core/uverbs.h -@@ -69,7 +69,7 @@ - */ - - struct ib_uverbs_device { -- struct kref ref; -+ atomic_t refcount; - int num_comp_vectors; - struct completion comp; - struct device *dev; -@@ -78,6 +78,7 @@ struct ib_uverbs_device { - struct cdev cdev; - struct rb_root xrcd_tree; - struct mutex xrcd_tree_mutex; -+ struct kobject kobj; - }; - - struct ib_uverbs_event_file { -diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c -index a7d00f6b3bc1..44c15cebd43f 100644 ---- a/drivers/infiniband/core/uverbs_cmd.c -+++ b/drivers/infiniband/core/uverbs_cmd.c -@@ -2106,6 +2106,12 @@ ssize_t ib_uverbs_post_send(struct ib_uverbs_file *file, - next->send_flags = user_wr->send_flags; - - if (is_ud) { -+ if (next->opcode != IB_WR_SEND && -+ next->opcode != IB_WR_SEND_WITH_IMM) { -+ ret = -EINVAL; -+ goto out_put; -+ } -+ - next->wr.ud.ah = idr_read_ah(user_wr->wr.ud.ah, - file->ucontext); - if (!next->wr.ud.ah) { -@@ -2142,9 +2148,11 @@ ssize_t ib_uverbs_post_send(struct ib_uverbs_file *file, - user_wr->wr.atomic.compare_add; - next->wr.atomic.swap = user_wr->wr.atomic.swap; - next->wr.atomic.rkey = user_wr->wr.atomic.rkey; -+ case IB_WR_SEND: - break; - default: -- break; -+ ret = -EINVAL; -+ goto out_put; - } - } - -diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c -index 949b38633496..b6062b9236a2 100644 ---- a/drivers/infiniband/core/uverbs_main.c -+++ b/drivers/infiniband/core/uverbs_main.c -@@ -119,14 +119,18 @@ static ssize_t (*uverbs_cmd_table[])(struct ib_uverbs_file *file, - static void ib_uverbs_add_one(struct ib_device *device); - static void ib_uverbs_remove_one(struct ib_device *device); - --static void ib_uverbs_release_dev(struct kref *ref) -+static void ib_uverbs_release_dev(struct kobject *kobj) - { - struct ib_uverbs_device *dev = -- container_of(ref, struct ib_uverbs_device, ref); -+ container_of(kobj, struct ib_uverbs_device, kobj); - -- complete(&dev->comp); -+ kfree(dev); - } - -+static struct kobj_type ib_uverbs_dev_ktype = { -+ .release = ib_uverbs_release_dev, -+}; -+ - static void ib_uverbs_release_event_file(struct kref *ref) - { - struct ib_uverbs_event_file *file = -@@ -282,13 +286,19 @@ static int ib_uverbs_cleanup_ucontext(struct ib_uverbs_file *file, - return context->device->dealloc_ucontext(context); - } - -+static void ib_uverbs_comp_dev(struct ib_uverbs_device *dev) -+{ -+ complete(&dev->comp); -+} -+ - static void ib_uverbs_release_file(struct kref *ref) - { - struct ib_uverbs_file *file = - container_of(ref, struct ib_uverbs_file, ref); - - module_put(file->device->ib_dev->owner); -- kref_put(&file->device->ref, ib_uverbs_release_dev); -+ if (atomic_dec_and_test(&file->device->refcount)) -+ ib_uverbs_comp_dev(file->device); - - kfree(file); - } -@@ -629,9 +639,7 @@ static int ib_uverbs_open(struct inode *inode, struct file *filp) - int ret; - - dev = container_of(inode->i_cdev, struct ib_uverbs_device, cdev); -- if (dev) -- kref_get(&dev->ref); -- else -+ if (!atomic_inc_not_zero(&dev->refcount)) - return -ENXIO; - - if (!try_module_get(dev->ib_dev->owner)) { -@@ -652,6 +660,7 @@ static int ib_uverbs_open(struct inode *inode, struct file *filp) - mutex_init(&file->mutex); - - filp->private_data = file; -+ kobject_get(&dev->kobj); - - return nonseekable_open(inode, filp); - -@@ -659,13 +668,16 @@ err_module: - module_put(dev->ib_dev->owner); - - err: -- kref_put(&dev->ref, ib_uverbs_release_dev); -+ if (atomic_dec_and_test(&dev->refcount)) -+ ib_uverbs_comp_dev(dev); -+ - return ret; - } - - static int ib_uverbs_close(struct inode *inode, struct file *filp) - { - struct ib_uverbs_file *file = filp->private_data; -+ struct ib_uverbs_device *dev = file->device; - - ib_uverbs_cleanup_ucontext(file, file->ucontext); - -@@ -673,6 +685,7 @@ static int ib_uverbs_close(struct inode *inode, struct file *filp) - kref_put(&file->async_file->ref, ib_uverbs_release_event_file); - - kref_put(&file->ref, ib_uverbs_release_file); -+ kobject_put(&dev->kobj); - - return 0; - } -@@ -768,10 +781,11 @@ static void ib_uverbs_add_one(struct ib_device *device) - if (!uverbs_dev) - return; - -- kref_init(&uverbs_dev->ref); -+ atomic_set(&uverbs_dev->refcount, 1); - init_completion(&uverbs_dev->comp); - uverbs_dev->xrcd_tree = RB_ROOT; - mutex_init(&uverbs_dev->xrcd_tree_mutex); -+ kobject_init(&uverbs_dev->kobj, &ib_uverbs_dev_ktype); - - spin_lock(&map_lock); - devnum = find_first_zero_bit(dev_map, IB_UVERBS_MAX_DEVICES); -@@ -798,6 +812,7 @@ static void ib_uverbs_add_one(struct ib_device *device) - cdev_init(&uverbs_dev->cdev, NULL); - uverbs_dev->cdev.owner = THIS_MODULE; - uverbs_dev->cdev.ops = device->mmap ? &uverbs_mmap_fops : &uverbs_fops; -+ uverbs_dev->cdev.kobj.parent = &uverbs_dev->kobj; - kobject_set_name(&uverbs_dev->cdev.kobj, "uverbs%d", uverbs_dev->devnum); - if (cdev_add(&uverbs_dev->cdev, base, 1)) - goto err_cdev; -@@ -828,9 +843,10 @@ err_cdev: - clear_bit(devnum, overflow_map); - - err: -- kref_put(&uverbs_dev->ref, ib_uverbs_release_dev); -+ if (atomic_dec_and_test(&uverbs_dev->refcount)) -+ ib_uverbs_comp_dev(uverbs_dev); - wait_for_completion(&uverbs_dev->comp); -- kfree(uverbs_dev); -+ kobject_put(&uverbs_dev->kobj); - return; - } - -@@ -850,9 +866,10 @@ static void ib_uverbs_remove_one(struct ib_device *device) - else - clear_bit(uverbs_dev->devnum - IB_UVERBS_MAX_DEVICES, overflow_map); - -- kref_put(&uverbs_dev->ref, ib_uverbs_release_dev); -+ if (atomic_dec_and_test(&uverbs_dev->refcount)) -+ ib_uverbs_comp_dev(uverbs_dev); - wait_for_completion(&uverbs_dev->comp); -- kfree(uverbs_dev); -+ kobject_put(&uverbs_dev->kobj); - } - - static char *uverbs_devnode(struct device *dev, umode_t *mode) -diff --git a/drivers/infiniband/hw/mlx4/ah.c b/drivers/infiniband/hw/mlx4/ah.c -index a251becdaa98..890c23b3d714 100644 ---- a/drivers/infiniband/hw/mlx4/ah.c -+++ b/drivers/infiniband/hw/mlx4/ah.c -@@ -169,9 +169,13 @@ int mlx4_ib_query_ah(struct ib_ah *ibah, struct ib_ah_attr *ah_attr) - enum rdma_link_layer ll; - - memset(ah_attr, 0, sizeof *ah_attr); -- ah_attr->sl = be32_to_cpu(ah->av.ib.sl_tclass_flowlabel) >> 28; - ah_attr->port_num = be32_to_cpu(ah->av.ib.port_pd) >> 24; - ll = rdma_port_get_link_layer(ibah->device, ah_attr->port_num); -+ if (ll == IB_LINK_LAYER_ETHERNET) -+ ah_attr->sl = be32_to_cpu(ah->av.eth.sl_tclass_flowlabel) >> 29; -+ else -+ ah_attr->sl = be32_to_cpu(ah->av.ib.sl_tclass_flowlabel) >> 28; -+ - ah_attr->dlid = ll == IB_LINK_LAYER_INFINIBAND ? be16_to_cpu(ah->av.ib.dlid) : 0; - if (ah->av.ib.stat_rate) - ah_attr->static_rate = ah->av.ib.stat_rate - MLX4_STAT_RATE_OFFSET; -diff --git a/drivers/infiniband/hw/mlx4/sysfs.c b/drivers/infiniband/hw/mlx4/sysfs.c -index 97516eb363b7..c5ce4082fdc7 100644 ---- a/drivers/infiniband/hw/mlx4/sysfs.c -+++ b/drivers/infiniband/hw/mlx4/sysfs.c -@@ -563,6 +563,8 @@ static int add_port(struct mlx4_ib_dev *dev, int port_num, int slave) - struct mlx4_port *p; - int i; - int ret; -+ int is_eth = rdma_port_get_link_layer(&dev->ib_dev, port_num) == -+ IB_LINK_LAYER_ETHERNET; - - p = kzalloc(sizeof *p, GFP_KERNEL); - if (!p) -@@ -580,7 +582,8 @@ static int add_port(struct mlx4_ib_dev *dev, int port_num, int slave) - - p->pkey_group.name = "pkey_idx"; - p->pkey_group.attrs = -- alloc_group_attrs(show_port_pkey, store_port_pkey, -+ alloc_group_attrs(show_port_pkey, -+ is_eth ? NULL : store_port_pkey, - dev->dev->caps.pkey_table_len[port_num]); - if (!p->pkey_group.attrs) - goto err_alloc; -diff --git a/drivers/isdn/gigaset/ser-gigaset.c b/drivers/isdn/gigaset/ser-gigaset.c -index 8c91fd5eb6fd..3ac9c4194814 100644 ---- a/drivers/isdn/gigaset/ser-gigaset.c -+++ b/drivers/isdn/gigaset/ser-gigaset.c -@@ -524,9 +524,18 @@ gigaset_tty_open(struct tty_struct *tty) - cs->hw.ser->tty = tty; - atomic_set(&cs->hw.ser->refcnt, 1); - init_completion(&cs->hw.ser->dead_cmp); -- - tty->disc_data = cs; - -+ /* Set the amount of data we're willing to receive per call -+ * from the hardware driver to half of the input buffer size -+ * to leave some reserve. -+ * Note: We don't do flow control towards the hardware driver. -+ * If more data is received than will fit into the input buffer, -+ * it will be dropped and an error will be logged. This should -+ * never happen as the device is slow and the buffer size ample. -+ */ -+ tty->receive_room = RBUFSIZE/2; -+ - /* OK.. Initialization of the datastructures and the HW is done.. Now - * startup system and notify the LL that we are ready to run - */ -diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c -index a1ea2a753912..5b2a1eaea34d 100644 ---- a/drivers/md/raid10.c -+++ b/drivers/md/raid10.c -@@ -3578,6 +3578,7 @@ static struct r10conf *setup_conf(struct mddev *mddev) - /* far_copies must be 1 */ - conf->prev.stride = conf->dev_sectors; - } -+ conf->reshape_safe = conf->reshape_progress; - spin_lock_init(&conf->device_lock); - INIT_LIST_HEAD(&conf->retry_list); - -@@ -3785,7 +3786,6 @@ static int run(struct mddev *mddev) - } - conf->offset_diff = min_offset_diff; - -- conf->reshape_safe = conf->reshape_progress; - clear_bit(MD_RECOVERY_SYNC, &mddev->recovery); - clear_bit(MD_RECOVERY_CHECK, &mddev->recovery); - set_bit(MD_RECOVERY_RESHAPE, &mddev->recovery); -@@ -4130,6 +4130,7 @@ static int raid10_start_reshape(struct mddev *mddev) - conf->reshape_progress = size; - } else - conf->reshape_progress = 0; -+ conf->reshape_safe = conf->reshape_progress; - spin_unlock_irq(&conf->device_lock); - - if (mddev->delta_disks && mddev->bitmap) { -@@ -4196,6 +4197,7 @@ abort: - rdev->new_data_offset = rdev->data_offset; - smp_wmb(); - conf->reshape_progress = MaxSector; -+ conf->reshape_safe = MaxSector; - mddev->reshape_position = MaxSector; - spin_unlock_irq(&conf->device_lock); - return ret; -@@ -4543,6 +4545,7 @@ static void end_reshape(struct r10conf *conf) - md_finish_reshape(conf->mddev); - smp_wmb(); - conf->reshape_progress = MaxSector; -+ conf->reshape_safe = MaxSector; - spin_unlock_irq(&conf->device_lock); - - /* read-ahead size must cover two whole stripes, which is -diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c -index 1cf382a0b277..cf7bbb6c9807 100644 ---- a/drivers/media/rc/rc-main.c -+++ b/drivers/media/rc/rc-main.c -@@ -943,9 +943,6 @@ static int rc_dev_uevent(struct device *device, struct kobj_uevent_env *env) - { - struct rc_dev *dev = to_rc_dev(device); - -- if (!dev || !dev->input_dev) -- return -ENODEV; -- - if (dev->rc_map.name) - ADD_HOTPLUG_VAR("NAME=%s", dev->rc_map.name); - if (dev->driver_name) -diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c -index c40396f23202..68ab26385d06 100644 ---- a/drivers/mmc/core/core.c -+++ b/drivers/mmc/core/core.c -@@ -327,8 +327,10 @@ EXPORT_SYMBOL(mmc_start_bkops); - */ - static void mmc_wait_data_done(struct mmc_request *mrq) - { -- mrq->host->context_info.is_done_rcv = true; -- wake_up_interruptible(&mrq->host->context_info.wait); -+ struct mmc_context_info *context_info = &mrq->host->context_info; -+ -+ context_info->is_done_rcv = true; -+ wake_up_interruptible(&context_info->wait); - } - - static void mmc_wait_done(struct mmc_request *mrq) -diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c -index b143ce91e081..6b5baf01512d 100644 ---- a/drivers/net/bonding/bond_main.c -+++ b/drivers/net/bonding/bond_main.c -@@ -2188,6 +2188,7 @@ static int bond_release_and_destroy(struct net_device *bond_dev, - bond_dev->priv_flags |= IFF_DISABLE_NETPOLL; - pr_info("%s: destroying bond %s.\n", - bond_dev->name, bond_dev->name); -+ bond_remove_proc_entry(bond); - unregister_netdevice(bond_dev); - } - return ret; -diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c -index 680d26d6d2c3..518cc4b6c7dd 100644 ---- a/drivers/net/ethernet/broadcom/tg3.c -+++ b/drivers/net/ethernet/broadcom/tg3.c -@@ -10518,7 +10518,7 @@ static ssize_t tg3_show_temp(struct device *dev, - tg3_ape_scratchpad_read(tp, &temperature, attr->index, - sizeof(temperature)); - spin_unlock_bh(&tp->lock); -- return sprintf(buf, "%u\n", temperature); -+ return sprintf(buf, "%u\n", temperature * 1000); - } - - -diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c -index 3d50e7db141e..fb068ada0c5a 100644 ---- a/drivers/net/usb/usbnet.c -+++ b/drivers/net/usb/usbnet.c -@@ -753,7 +753,7 @@ int usbnet_stop (struct net_device *net) - { - struct usbnet *dev = netdev_priv(net); - struct driver_info *info = dev->driver_info; -- int retval, pm; -+ int retval, pm, mpn; - - clear_bit(EVENT_DEV_OPEN, &dev->flags); - netif_stop_queue (net); -@@ -784,6 +784,8 @@ int usbnet_stop (struct net_device *net) - - usbnet_purge_paused_rxq(dev); - -+ mpn = !test_and_clear_bit(EVENT_NO_RUNTIME_PM, &dev->flags); -+ - /* deferred work (task, timer, softirq) must also stop. - * can't flush_scheduled_work() until we drop rtnl (later), - * else workers could deadlock; so make workers a NOP. -@@ -794,8 +796,7 @@ int usbnet_stop (struct net_device *net) - if (!pm) - usb_autopm_put_interface(dev->intf); - -- if (info->manage_power && -- !test_and_clear_bit(EVENT_NO_RUNTIME_PM, &dev->flags)) -+ if (info->manage_power && mpn) - info->manage_power(dev, 0); - else - usb_autopm_put_interface(dev->intf); -diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c -index 7555095e0b74..fa669b52fc91 100644 ---- a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c -+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c -@@ -313,6 +313,7 @@ static struct usb_device_id rtl8192c_usb_ids[] = { - {RTL_USB_DEVICE(0x07b8, 0x8188, rtl92cu_hal_cfg)}, /*Abocom - Abocom*/ - {RTL_USB_DEVICE(0x07b8, 0x8189, rtl92cu_hal_cfg)}, /*Funai - Abocom*/ - {RTL_USB_DEVICE(0x0846, 0x9041, rtl92cu_hal_cfg)}, /*NetGear WNA1000M*/ -+ {RTL_USB_DEVICE(0x0846, 0x9043, rtl92cu_hal_cfg)}, /*NG WNA1000Mv2*/ - {RTL_USB_DEVICE(0x0b05, 0x17ba, rtl92cu_hal_cfg)}, /*ASUS-Edimax*/ - {RTL_USB_DEVICE(0x0bda, 0x5088, rtl92cu_hal_cfg)}, /*Thinkware-CC&C*/ - {RTL_USB_DEVICE(0x0df6, 0x0052, rtl92cu_hal_cfg)}, /*Sitecom - Edimax*/ -diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c -index fb97bc0b80e7..2947eda522b2 100644 ---- a/drivers/vhost/scsi.c -+++ b/drivers/vhost/scsi.c -@@ -1088,7 +1088,7 @@ static void tcm_vhost_send_evt(struct vhost_scsi *vs, struct tcm_vhost_tpg *tpg, - * lun[4-7] need to be zero according to virtio-scsi spec. - */ - evt->event.lun[0] = 0x01; -- evt->event.lun[1] = tpg->tport_tpgt & 0xFF; -+ evt->event.lun[1] = tpg->tport_tpgt; - if (lun->unpacked_lun >= 256) - evt->event.lun[2] = lun->unpacked_lun >> 8 | 0x40 ; - evt->event.lun[3] = lun->unpacked_lun & 0xFF; -@@ -1894,12 +1894,12 @@ static struct se_portal_group *tcm_vhost_make_tpg(struct se_wwn *wwn, - struct tcm_vhost_tport, tport_wwn); - - struct tcm_vhost_tpg *tpg; -- unsigned long tpgt; -+ u16 tpgt; - int ret; - - if (strstr(name, "tpgt_") != name) - return ERR_PTR(-EINVAL); -- if (kstrtoul(name + 5, 10, &tpgt) || tpgt > UINT_MAX) -+ if (kstrtou16(name + 5, 10, &tpgt) || tpgt >= VHOST_SCSI_MAX_TARGET) - return ERR_PTR(-EINVAL); - - tpg = kzalloc(sizeof(struct tcm_vhost_tpg), GFP_KERNEL); -diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c -index 474d11499d0e..e68205cbc46e 100644 ---- a/drivers/xen/gntdev.c -+++ b/drivers/xen/gntdev.c -@@ -65,7 +65,7 @@ struct gntdev_priv { - * Only populated if populate_freeable_maps == 1 */ - struct list_head freeable_maps; - /* lock protects maps and freeable_maps */ -- spinlock_t lock; -+ struct mutex lock; - struct mm_struct *mm; - struct mmu_notifier mn; - }; -@@ -214,9 +214,9 @@ static void gntdev_put_map(struct gntdev_priv *priv, struct grant_map *map) - } - - if (populate_freeable_maps && priv) { -- spin_lock(&priv->lock); -+ mutex_lock(&priv->lock); - list_del(&map->next); -- spin_unlock(&priv->lock); -+ mutex_unlock(&priv->lock); - } - - if (map->pages && !use_ptemod) -@@ -392,9 +392,9 @@ static void gntdev_vma_close(struct vm_area_struct *vma) - * not do any unmapping, since that has been done prior to - * closing the vma, but it may still iterate the unmap_ops list. - */ -- spin_lock(&priv->lock); -+ mutex_lock(&priv->lock); - map->vma = NULL; -- spin_unlock(&priv->lock); -+ mutex_unlock(&priv->lock); - } - vma->vm_private_data = NULL; - gntdev_put_map(priv, map); -@@ -438,14 +438,14 @@ static void mn_invl_range_start(struct mmu_notifier *mn, - struct gntdev_priv *priv = container_of(mn, struct gntdev_priv, mn); - struct grant_map *map; - -- spin_lock(&priv->lock); -+ mutex_lock(&priv->lock); - list_for_each_entry(map, &priv->maps, next) { - unmap_if_in_range(map, start, end); - } - list_for_each_entry(map, &priv->freeable_maps, next) { - unmap_if_in_range(map, start, end); - } -- spin_unlock(&priv->lock); -+ mutex_unlock(&priv->lock); - } - - static void mn_invl_page(struct mmu_notifier *mn, -@@ -462,7 +462,7 @@ static void mn_release(struct mmu_notifier *mn, - struct grant_map *map; - int err; - -- spin_lock(&priv->lock); -+ mutex_lock(&priv->lock); - list_for_each_entry(map, &priv->maps, next) { - if (!map->vma) - continue; -@@ -481,7 +481,7 @@ static void mn_release(struct mmu_notifier *mn, - err = unmap_grant_pages(map, /* offset */ 0, map->count); - WARN_ON(err); - } -- spin_unlock(&priv->lock); -+ mutex_unlock(&priv->lock); - } - - static struct mmu_notifier_ops gntdev_mmu_ops = { -@@ -503,7 +503,7 @@ static int gntdev_open(struct inode *inode, struct file *flip) - - INIT_LIST_HEAD(&priv->maps); - INIT_LIST_HEAD(&priv->freeable_maps); -- spin_lock_init(&priv->lock); -+ mutex_init(&priv->lock); - - if (use_ptemod) { - priv->mm = get_task_mm(current); -@@ -579,10 +579,10 @@ static long gntdev_ioctl_map_grant_ref(struct gntdev_priv *priv, - return -EFAULT; - } - -- spin_lock(&priv->lock); -+ mutex_lock(&priv->lock); - gntdev_add_map(priv, map); - op.index = map->index << PAGE_SHIFT; -- spin_unlock(&priv->lock); -+ mutex_unlock(&priv->lock); - - if (copy_to_user(u, &op, sizeof(op)) != 0) - return -EFAULT; -@@ -601,7 +601,7 @@ static long gntdev_ioctl_unmap_grant_ref(struct gntdev_priv *priv, - return -EFAULT; - pr_debug("priv %p, del %d+%d\n", priv, (int)op.index, (int)op.count); - -- spin_lock(&priv->lock); -+ mutex_lock(&priv->lock); - map = gntdev_find_map_index(priv, op.index >> PAGE_SHIFT, op.count); - if (map) { - list_del(&map->next); -@@ -609,7 +609,7 @@ static long gntdev_ioctl_unmap_grant_ref(struct gntdev_priv *priv, - list_add_tail(&map->next, &priv->freeable_maps); - err = 0; - } -- spin_unlock(&priv->lock); -+ mutex_unlock(&priv->lock); - if (map) - gntdev_put_map(priv, map); - return err; -@@ -677,7 +677,7 @@ static long gntdev_ioctl_notify(struct gntdev_priv *priv, void __user *u) - out_flags = op.action; - out_event = op.event_channel_port; - -- spin_lock(&priv->lock); -+ mutex_lock(&priv->lock); - - list_for_each_entry(map, &priv->maps, next) { - uint64_t begin = map->index << PAGE_SHIFT; -@@ -705,7 +705,7 @@ static long gntdev_ioctl_notify(struct gntdev_priv *priv, void __user *u) - rc = 0; - - unlock_out: -- spin_unlock(&priv->lock); -+ mutex_unlock(&priv->lock); - - /* Drop the reference to the event channel we did not save in the map */ - if (out_flags & UNMAP_NOTIFY_SEND_EVENT) -@@ -755,7 +755,7 @@ static int gntdev_mmap(struct file *flip, struct vm_area_struct *vma) - pr_debug("map %d+%d at %lx (pgoff %lx)\n", - index, count, vma->vm_start, vma->vm_pgoff); - -- spin_lock(&priv->lock); -+ mutex_lock(&priv->lock); - map = gntdev_find_map_index(priv, index, count); - if (!map) - goto unlock_out; -@@ -790,7 +790,7 @@ static int gntdev_mmap(struct file *flip, struct vm_area_struct *vma) - map->flags |= GNTMAP_readonly; - } - -- spin_unlock(&priv->lock); -+ mutex_unlock(&priv->lock); - - if (use_ptemod) { - err = apply_to_page_range(vma->vm_mm, vma->vm_start, -@@ -818,11 +818,11 @@ static int gntdev_mmap(struct file *flip, struct vm_area_struct *vma) - return 0; - - unlock_out: -- spin_unlock(&priv->lock); -+ mutex_unlock(&priv->lock); - return err; - - out_unlock_put: -- spin_unlock(&priv->lock); -+ mutex_unlock(&priv->lock); - out_put_map: - if (use_ptemod) - map->vma = NULL; -diff --git a/fs/coredump.c b/fs/coredump.c -index 1d402ce5b72f..4f03b2b50375 100644 ---- a/fs/coredump.c -+++ b/fs/coredump.c -@@ -491,10 +491,10 @@ void do_coredump(siginfo_t *siginfo) - const struct cred *old_cred; - struct cred *cred; - int retval = 0; -- int flag = 0; - int ispipe; - struct files_struct *displaced; -- bool need_nonrelative = false; -+ /* require nonrelative corefile path and be extra careful */ -+ bool need_suid_safe = false; - bool core_dumped = false; - static atomic_t core_dump_count = ATOMIC_INIT(0); - struct coredump_params cprm = { -@@ -528,9 +528,8 @@ void do_coredump(siginfo_t *siginfo) - */ - if (__get_dumpable(cprm.mm_flags) == SUID_DUMP_ROOT) { - /* Setuid core dump mode */ -- flag = O_EXCL; /* Stop rewrite attacks */ - cred->fsuid = GLOBAL_ROOT_UID; /* Dump root private */ -- need_nonrelative = true; -+ need_suid_safe = true; - } - - retval = coredump_wait(siginfo->si_signo, &core_state); -@@ -611,7 +610,7 @@ void do_coredump(siginfo_t *siginfo) - if (cprm.limit < binfmt->min_coredump) - goto fail_unlock; - -- if (need_nonrelative && cn.corename[0] != '/') { -+ if (need_suid_safe && cn.corename[0] != '/') { - printk(KERN_WARNING "Pid %d(%s) can only dump core "\ - "to fully qualified path!\n", - task_tgid_vnr(current), current->comm); -@@ -619,8 +618,35 @@ void do_coredump(siginfo_t *siginfo) - goto fail_unlock; - } - -+ /* -+ * Unlink the file if it exists unless this is a SUID -+ * binary - in that case, we're running around with root -+ * privs and don't want to unlink another user's coredump. -+ */ -+ if (!need_suid_safe) { -+ mm_segment_t old_fs; -+ -+ old_fs = get_fs(); -+ set_fs(KERNEL_DS); -+ /* -+ * If it doesn't exist, that's fine. If there's some -+ * other problem, we'll catch it at the filp_open(). -+ */ -+ (void) sys_unlink((const char __user *)cn.corename); -+ set_fs(old_fs); -+ } -+ -+ /* -+ * There is a race between unlinking and creating the -+ * file, but if that causes an EEXIST here, that's -+ * fine - another process raced with us while creating -+ * the corefile, and the other process won. To userspace, -+ * what matters is that at least one of the two processes -+ * writes its coredump successfully, not which one. -+ */ - cprm.file = filp_open(cn.corename, -- O_CREAT | 2 | O_NOFOLLOW | O_LARGEFILE | flag, -+ O_CREAT | 2 | O_NOFOLLOW | -+ O_LARGEFILE | O_EXCL, - 0600); - if (IS_ERR(cprm.file)) - goto fail_unlock; -diff --git a/fs/dcache.c b/fs/dcache.c -index 90be2809e15a..f1e801785976 100644 ---- a/fs/dcache.c -+++ b/fs/dcache.c -@@ -2569,15 +2569,6 @@ static int prepend_path(const struct path *path, - return error; - - global_root: -- /* -- * Filesystems needing to implement special "root names" -- * should do so with ->d_dname() -- */ -- if (IS_ROOT(dentry) && -- (dentry->d_name.len != 1 || dentry->d_name.name[0] != '/')) { -- WARN(1, "Root dentry has weird name <%.*s>\n", -- (int) dentry->d_name.len, dentry->d_name.name); -- } - if (!slash) - error = prepend(buffer, buflen, "/", 1); - if (!error) -diff --git a/fs/hfs/bnode.c b/fs/hfs/bnode.c -index d3fa6bd9503e..221719eac5de 100644 ---- a/fs/hfs/bnode.c -+++ b/fs/hfs/bnode.c -@@ -288,7 +288,6 @@ static struct hfs_bnode *__hfs_bnode_create(struct hfs_btree *tree, u32 cnid) - page_cache_release(page); - goto fail; - } -- page_cache_release(page); - node->page[i] = page; - } - -@@ -398,11 +397,11 @@ node_error: - - void hfs_bnode_free(struct hfs_bnode *node) - { -- //int i; -+ int i; - -- //for (i = 0; i < node->tree->pages_per_bnode; i++) -- // if (node->page[i]) -- // page_cache_release(node->page[i]); -+ for (i = 0; i < node->tree->pages_per_bnode; i++) -+ if (node->page[i]) -+ page_cache_release(node->page[i]); - kfree(node); - } - -diff --git a/fs/hfs/brec.c b/fs/hfs/brec.c -index 9f4ee7f52026..6fc766df0461 100644 ---- a/fs/hfs/brec.c -+++ b/fs/hfs/brec.c -@@ -131,13 +131,16 @@ skip: - hfs_bnode_write(node, entry, data_off + key_len, entry_len); - hfs_bnode_dump(node); - -- if (new_node) { -- /* update parent key if we inserted a key -- * at the start of the first node -- */ -- if (!rec && new_node != node) -- hfs_brec_update_parent(fd); -+ /* -+ * update parent key if we inserted a key -+ * at the start of the node and it is not the new node -+ */ -+ if (!rec && new_node != node) { -+ hfs_bnode_read_key(node, fd->search_key, data_off + size); -+ hfs_brec_update_parent(fd); -+ } - -+ if (new_node) { - hfs_bnode_put(fd->bnode); - if (!new_node->parent) { - hfs_btree_inc_height(tree); -@@ -166,9 +169,6 @@ skip: - goto again; - } - -- if (!rec) -- hfs_brec_update_parent(fd); -- - return 0; - } - -@@ -366,6 +366,8 @@ again: - if (IS_ERR(parent)) - return PTR_ERR(parent); - __hfs_brec_find(parent, fd); -+ if (fd->record < 0) -+ return -ENOENT; - hfs_bnode_dump(parent); - rec = fd->record; - -diff --git a/fs/hfsplus/bnode.c b/fs/hfsplus/bnode.c -index 11c860204520..bedfe5f7d332 100644 ---- a/fs/hfsplus/bnode.c -+++ b/fs/hfsplus/bnode.c -@@ -456,7 +456,6 @@ static struct hfs_bnode *__hfs_bnode_create(struct hfs_btree *tree, u32 cnid) - page_cache_release(page); - goto fail; - } -- page_cache_release(page); - node->page[i] = page; - } - -@@ -568,13 +567,11 @@ node_error: - - void hfs_bnode_free(struct hfs_bnode *node) - { --#if 0 - int i; - - for (i = 0; i < node->tree->pages_per_bnode; i++) - if (node->page[i]) - page_cache_release(node->page[i]); --#endif - kfree(node); - } - -diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c -index 20ebcfa3c92e..78679b489484 100644 ---- a/fs/nfs/nfs4proc.c -+++ b/fs/nfs/nfs4proc.c -@@ -2043,7 +2043,7 @@ static int _nfs4_do_open(struct inode *dir, - if (status != 0) - goto err_opendata_put; - -- if ((opendata->o_arg.open_flags & O_EXCL) && -+ if ((opendata->o_arg.open_flags & (O_CREAT|O_EXCL)) == (O_CREAT|O_EXCL) && - (opendata->o_arg.createmode != NFS4_CREATE_GUARDED)) { - nfs4_exclusive_attrset(opendata, sattr); - -diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c -index 29cfb7ade121..d852ca281c16 100644 ---- a/fs/nfs/pagelist.c -+++ b/fs/nfs/pagelist.c -@@ -60,8 +60,8 @@ EXPORT_SYMBOL_GPL(nfs_pgheader_init); - void nfs_set_pgio_error(struct nfs_pgio_header *hdr, int error, loff_t pos) - { - spin_lock(&hdr->lock); -- if (pos < hdr->io_start + hdr->good_bytes) { -- set_bit(NFS_IOHDR_ERROR, &hdr->flags); -+ if (!test_and_set_bit(NFS_IOHDR_ERROR, &hdr->flags) -+ || pos < hdr->io_start + hdr->good_bytes) { - clear_bit(NFS_IOHDR_EOF, &hdr->flags); - hdr->good_bytes = pos - hdr->io_start; - hdr->error = error; -diff --git a/include/net/ip.h b/include/net/ip.h -index 0a62365149e2..ea9be6b407bc 100644 ---- a/include/net/ip.h -+++ b/include/net/ip.h -@@ -141,6 +141,7 @@ static inline struct sk_buff *ip_finish_skb(struct sock *sk, struct flowi4 *fl4) - } - - /* datagram.c */ -+int __ip4_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len); - extern int ip4_datagram_connect(struct sock *sk, - struct sockaddr *uaddr, int addr_len); - -diff --git a/include/net/netns/sctp.h b/include/net/netns/sctp.h -index 3573a81815ad..8ba379f9e467 100644 ---- a/include/net/netns/sctp.h -+++ b/include/net/netns/sctp.h -@@ -31,6 +31,7 @@ struct netns_sctp { - struct list_head addr_waitq; - struct timer_list addr_wq_timer; - struct list_head auto_asconf_splist; -+ /* Lock that protects both addr_waitq and auto_asconf_splist */ - spinlock_t addr_wq_lock; - - /* Lock that protects the local_addr_list writers */ -diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h -index da6b9a01ff75..b30c1d95be2c 100644 ---- a/include/net/sctp/structs.h -+++ b/include/net/sctp/structs.h -@@ -228,6 +228,10 @@ struct sctp_sock { - atomic_t pd_mode; - /* Receive to here while partial delivery is in effect. */ - struct sk_buff_head pd_lobby; -+ -+ /* These must be the last fields, as they will skipped on copies, -+ * like on accept and peeloff operations -+ */ - struct list_head auto_asconf_list; - int do_auto_asconf; - }; -diff --git a/kernel/fork.c b/kernel/fork.c -index 514dbc40f98f..2358bd4c8757 100644 ---- a/kernel/fork.c -+++ b/kernel/fork.c -@@ -1760,13 +1760,21 @@ static int check_unshare_flags(unsigned long unshare_flags) - CLONE_NEWUSER|CLONE_NEWPID)) - return -EINVAL; - /* -- * Not implemented, but pretend it works if there is nothing to -- * unshare. Note that unsharing CLONE_THREAD or CLONE_SIGHAND -- * needs to unshare vm. -+ * Not implemented, but pretend it works if there is nothing -+ * to unshare. Note that unsharing the address space or the -+ * signal handlers also need to unshare the signal queues (aka -+ * CLONE_THREAD). - */ - if (unshare_flags & (CLONE_THREAD | CLONE_SIGHAND | CLONE_VM)) { -- /* FIXME: get_task_mm() increments ->mm_users */ -- if (atomic_read(¤t->mm->mm_users) > 1) -+ if (!thread_group_empty(current)) -+ return -EINVAL; -+ } -+ if (unshare_flags & (CLONE_SIGHAND | CLONE_VM)) { -+ if (atomic_read(¤t->sighand->count) > 1) -+ return -EINVAL; -+ } -+ if (unshare_flags & CLONE_VM) { -+ if (!current_is_single_threaded()) - return -EINVAL; - } - -@@ -1840,16 +1848,16 @@ SYSCALL_DEFINE1(unshare, unsigned long, unshare_flags) - if (unshare_flags & CLONE_NEWPID) - unshare_flags |= CLONE_THREAD; - /* -- * If unsharing a thread from a thread group, must also unshare vm. -- */ -- if (unshare_flags & CLONE_THREAD) -- unshare_flags |= CLONE_VM; -- /* - * If unsharing vm, must also unshare signal handlers. - */ - if (unshare_flags & CLONE_VM) - unshare_flags |= CLONE_SIGHAND; - /* -+ * If unsharing a signal handlers, must also unshare the signal queues. -+ */ -+ if (unshare_flags & CLONE_SIGHAND) -+ unshare_flags |= CLONE_THREAD; -+ /* - * If unsharing namespace, must also unshare filesystem information. - */ - if (unshare_flags & CLONE_NEWNS) -diff --git a/mm/vmscan.c b/mm/vmscan.c -index 233f0011f768..a1e3becef05e 100644 ---- a/mm/vmscan.c -+++ b/mm/vmscan.c -@@ -925,7 +925,7 @@ cull_mlocked: - if (PageSwapCache(page)) - try_to_free_swap(page); - unlock_page(page); -- putback_lru_page(page); -+ list_add(&page->lru, &ret_pages); - continue; - - activate_locked: -diff --git a/net/bridge/br_mdb.c b/net/bridge/br_mdb.c -index 19942e38fd2d..4e76d2a11284 100644 ---- a/net/bridge/br_mdb.c -+++ b/net/bridge/br_mdb.c -@@ -345,7 +345,6 @@ static int br_mdb_add_group(struct net_bridge *br, struct net_bridge_port *port, - return -ENOMEM; - rcu_assign_pointer(*pp, p); - -- br_mdb_notify(br->dev, port, group, RTM_NEWMDB); - return 0; - } - -@@ -368,6 +367,7 @@ static int __br_mdb_add(struct net *net, struct net_bridge *br, - if (!p || p->br != br || p->state == BR_STATE_DISABLED) - return -EINVAL; - -+ memset(&ip, 0, sizeof(ip)); - ip.proto = entry->addr.proto; - if (ip.proto == htons(ETH_P_IP)) - ip.u.ip4 = entry->addr.u.ip4; -@@ -417,6 +417,7 @@ static int __br_mdb_del(struct net_bridge *br, struct br_mdb_entry *entry) - if (timer_pending(&br->multicast_querier_timer)) - return -EBUSY; - -+ memset(&ip, 0, sizeof(ip)); - ip.proto = entry->addr.proto; - if (ip.proto == htons(ETH_P_IP)) - ip.u.ip4 = entry->addr.u.ip4; -diff --git a/net/core/datagram.c b/net/core/datagram.c -index b71423db7785..052b71c5b1b4 100644 ---- a/net/core/datagram.c -+++ b/net/core/datagram.c -@@ -128,6 +128,35 @@ out_noerr: - goto out; - } - -+static struct sk_buff *skb_set_peeked(struct sk_buff *skb) -+{ -+ struct sk_buff *nskb; -+ -+ if (skb->peeked) -+ return skb; -+ -+ /* We have to unshare an skb before modifying it. */ -+ if (!skb_shared(skb)) -+ goto done; -+ -+ nskb = skb_clone(skb, GFP_ATOMIC); -+ if (!nskb) -+ return ERR_PTR(-ENOMEM); -+ -+ skb->prev->next = nskb; -+ skb->next->prev = nskb; -+ nskb->prev = skb->prev; -+ nskb->next = skb->next; -+ -+ consume_skb(skb); -+ skb = nskb; -+ -+done: -+ skb->peeked = 1; -+ -+ return skb; -+} -+ - /** - * __skb_recv_datagram - Receive a datagram skbuff - * @sk: socket -@@ -162,7 +191,9 @@ out_noerr: - struct sk_buff *__skb_recv_datagram(struct sock *sk, unsigned int flags, - int *peeked, int *off, int *err) - { -+ struct sk_buff_head *queue = &sk->sk_receive_queue; - struct sk_buff *skb, *last; -+ unsigned long cpu_flags; - long timeo; - /* - * Caller is allowed not to check sk->sk_err before skb_recv_datagram() -@@ -181,8 +212,6 @@ struct sk_buff *__skb_recv_datagram(struct sock *sk, unsigned int flags, - * Look at current nfs client by the way... - * However, this function was correct in any case. 8) - */ -- unsigned long cpu_flags; -- struct sk_buff_head *queue = &sk->sk_receive_queue; - int _off = *off; - - last = (struct sk_buff *)queue; -@@ -196,7 +225,12 @@ struct sk_buff *__skb_recv_datagram(struct sock *sk, unsigned int flags, - _off -= skb->len; - continue; - } -- skb->peeked = 1; -+ -+ skb = skb_set_peeked(skb); -+ error = PTR_ERR(skb); -+ if (IS_ERR(skb)) -+ goto unlock_err; -+ - atomic_inc(&skb->users); - } else - __skb_unlink(skb, queue); -@@ -216,6 +250,8 @@ struct sk_buff *__skb_recv_datagram(struct sock *sk, unsigned int flags, - - return NULL; - -+unlock_err: -+ spin_unlock_irqrestore(&queue->lock, cpu_flags); - no_packet: - *err = error; - return NULL; -@@ -665,7 +701,8 @@ __sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len) - if (likely(!sum)) { - if (unlikely(skb->ip_summed == CHECKSUM_COMPLETE)) - netdev_rx_csum_fault(skb->dev); -- skb->ip_summed = CHECKSUM_UNNECESSARY; -+ if (!skb_shared(skb)) -+ skb->ip_summed = CHECKSUM_UNNECESSARY; - } - return sum; - } -diff --git a/net/core/dev.c b/net/core/dev.c -index aeca8dd88b2a..1ccfc49683b3 100644 ---- a/net/core/dev.c -+++ b/net/core/dev.c -@@ -3443,8 +3443,6 @@ static int __netif_receive_skb_core(struct sk_buff *skb, bool pfmemalloc) - - pt_prev = NULL; - -- rcu_read_lock(); -- - another_round: - skb->skb_iif = skb->dev->ifindex; - -@@ -3454,7 +3452,7 @@ another_round: - skb->protocol == cpu_to_be16(ETH_P_8021AD)) { - skb = vlan_untag(skb); - if (unlikely(!skb)) -- goto unlock; -+ goto out; - } - - #ifdef CONFIG_NET_CLS_ACT -@@ -3479,7 +3477,7 @@ skip_taps: - #ifdef CONFIG_NET_CLS_ACT - skb = handle_ing(skb, &pt_prev, &ret, orig_dev); - if (!skb) -- goto unlock; -+ goto out; - ncls: - #endif - -@@ -3494,7 +3492,7 @@ ncls: - if (vlan_do_receive(&skb)) - goto another_round; - else if (unlikely(!skb)) -- goto unlock; -+ goto out; - } - - rx_handler = rcu_dereference(skb->dev->rx_handler); -@@ -3506,7 +3504,7 @@ ncls: - switch (rx_handler(&skb)) { - case RX_HANDLER_CONSUMED: - ret = NET_RX_SUCCESS; -- goto unlock; -+ goto out; - case RX_HANDLER_ANOTHER: - goto another_round; - case RX_HANDLER_EXACT: -@@ -3558,8 +3556,6 @@ drop: - ret = NET_RX_DROP; - } - --unlock: -- rcu_read_unlock(); - out: - return ret; - } -@@ -3606,29 +3602,30 @@ static int __netif_receive_skb(struct sk_buff *skb) - */ - int netif_receive_skb(struct sk_buff *skb) - { -+ int ret; -+ - net_timestamp_check(netdev_tstamp_prequeue, skb); - - if (skb_defer_rx_timestamp(skb)) - return NET_RX_SUCCESS; - -+ rcu_read_lock(); -+ - #ifdef CONFIG_RPS - if (static_key_false(&rps_needed)) { - struct rps_dev_flow voidflow, *rflow = &voidflow; -- int cpu, ret; -- -- rcu_read_lock(); -- -- cpu = get_rps_cpu(skb->dev, skb, &rflow); -+ int cpu = get_rps_cpu(skb->dev, skb, &rflow); - - if (cpu >= 0) { - ret = enqueue_to_backlog(skb, cpu, &rflow->last_qtail); - rcu_read_unlock(); - return ret; - } -- rcu_read_unlock(); - } - #endif -- return __netif_receive_skb(skb); -+ ret = __netif_receive_skb(skb); -+ rcu_read_unlock(); -+ return ret; - } - EXPORT_SYMBOL(netif_receive_skb); - -@@ -4038,8 +4035,10 @@ static int process_backlog(struct napi_struct *napi, int quota) - unsigned int qlen; - - while ((skb = __skb_dequeue(&sd->process_queue))) { -+ rcu_read_lock(); - local_irq_enable(); - __netif_receive_skb(skb); -+ rcu_read_unlock(); - local_irq_disable(); - input_queue_head_incr(sd); - if (++work >= quota) { -diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c -index 55e08e2de3a1..627e517077e4 100644 ---- a/net/core/fib_rules.c -+++ b/net/core/fib_rules.c -@@ -596,15 +596,17 @@ static int dump_rules(struct sk_buff *skb, struct netlink_callback *cb, - { - int idx = 0; - struct fib_rule *rule; -+ int err = 0; - - rcu_read_lock(); - list_for_each_entry_rcu(rule, &ops->rules_list, list) { - if (idx < cb->args[1]) - goto skip; - -- if (fib_nl_fill_rule(skb, rule, NETLINK_CB(cb->skb).portid, -- cb->nlh->nlmsg_seq, RTM_NEWRULE, -- NLM_F_MULTI, ops) < 0) -+ err = fib_nl_fill_rule(skb, rule, NETLINK_CB(cb->skb).portid, -+ cb->nlh->nlmsg_seq, RTM_NEWRULE, -+ NLM_F_MULTI, ops); -+ if (err) - break; - skip: - idx++; -@@ -613,7 +615,7 @@ skip: - cb->args[1] = idx; - rules_ops_put(ops); - -- return skb->len; -+ return err; - } - - static int fib_nl_dumprule(struct sk_buff *skb, struct netlink_callback *cb) -@@ -629,7 +631,9 @@ static int fib_nl_dumprule(struct sk_buff *skb, struct netlink_callback *cb) - if (ops == NULL) - return -EAFNOSUPPORT; - -- return dump_rules(skb, cb, ops); -+ dump_rules(skb, cb, ops); -+ -+ return skb->len; - } - - rcu_read_lock(); -diff --git a/net/core/pktgen.c b/net/core/pktgen.c -index ebbea5371967..21a23d97e99c 100644 ---- a/net/core/pktgen.c -+++ b/net/core/pktgen.c -@@ -3377,8 +3377,10 @@ static int pktgen_thread_worker(void *arg) - pktgen_rem_thread(t); - - /* Wait for kthread_stop */ -- while (!kthread_should_stop()) { -+ for (;;) { - set_current_state(TASK_INTERRUPTIBLE); -+ if (kthread_should_stop()) -+ break; - schedule(); - } - __set_current_state(TASK_RUNNING); -diff --git a/net/ipv4/datagram.c b/net/ipv4/datagram.c -index 5f3dc1df04bf..291b0821d1ac 100644 ---- a/net/ipv4/datagram.c -+++ b/net/ipv4/datagram.c -@@ -20,7 +20,7 @@ - #include - #include - --int ip4_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) -+int __ip4_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) - { - struct inet_sock *inet = inet_sk(sk); - struct sockaddr_in *usin = (struct sockaddr_in *) uaddr; -@@ -39,8 +39,6 @@ int ip4_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) - - sk_dst_reset(sk); - -- lock_sock(sk); -- - oif = sk->sk_bound_dev_if; - saddr = inet->inet_saddr; - if (ipv4_is_multicast(usin->sin_addr.s_addr)) { -@@ -81,9 +79,19 @@ int ip4_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) - sk_dst_set(sk, &rt->dst); - err = 0; - out: -- release_sock(sk); - return err; - } -+EXPORT_SYMBOL(__ip4_datagram_connect); -+ -+int ip4_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) -+{ -+ int res; -+ -+ lock_sock(sk); -+ res = __ip4_datagram_connect(sk, uaddr, addr_len); -+ release_sock(sk); -+ return res; -+} - EXPORT_SYMBOL(ip4_datagram_connect); - - /* Because UDP xmit path can manipulate sk_dst_cache without holding -diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c -index 4c1884fed548..4d98a6b80b04 100644 ---- a/net/ipv4/ip_fragment.c -+++ b/net/ipv4/ip_fragment.c -@@ -356,7 +356,7 @@ static int ip_frag_queue(struct ipq *qp, struct sk_buff *skb) - ihl = ip_hdrlen(skb); - - /* Determine the position of this fragment. */ -- end = offset + skb->len - ihl; -+ end = offset + skb->len - skb_network_offset(skb) - ihl; - err = -EINVAL; - - /* Is this the final fragment? */ -@@ -386,7 +386,7 @@ static int ip_frag_queue(struct ipq *qp, struct sk_buff *skb) - goto err; - - err = -ENOMEM; -- if (pskb_pull(skb, ihl) == NULL) -+ if (!pskb_pull(skb, skb_network_offset(skb) + ihl)) - goto err; - - err = pskb_trim_rcsum(skb, end - offset); -@@ -627,6 +627,9 @@ static int ip_frag_reasm(struct ipq *qp, struct sk_buff *prev, - iph->frag_off = qp->q.max_size ? htons(IP_DF) : 0; - iph->tot_len = htons(len); - iph->tos |= ecn; -+ -+ ip_send_check(iph); -+ - IP_INC_STATS_BH(net, IPSTATS_MIB_REASMOKS); - qp->q.fragments = NULL; - qp->q.fragments_tail = NULL; -diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c -index ce17d3da9b2b..b0d5d7eb9462 100644 ---- a/net/ipv6/datagram.c -+++ b/net/ipv6/datagram.c -@@ -40,7 +40,7 @@ static bool ipv6_mapped_addr_any(const struct in6_addr *a) - return ipv6_addr_v4mapped(a) && (a->s6_addr32[3] == 0); - } - --int ip6_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) -+static int __ip6_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) - { - struct sockaddr_in6 *usin = (struct sockaddr_in6 *) uaddr; - struct inet_sock *inet = inet_sk(sk); -@@ -56,7 +56,7 @@ int ip6_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) - if (usin->sin6_family == AF_INET) { - if (__ipv6_only_sock(sk)) - return -EAFNOSUPPORT; -- err = ip4_datagram_connect(sk, uaddr, addr_len); -+ err = __ip4_datagram_connect(sk, uaddr, addr_len); - goto ipv4_connected; - } - -@@ -99,9 +99,9 @@ int ip6_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) - sin.sin_addr.s_addr = daddr->s6_addr32[3]; - sin.sin_port = usin->sin6_port; - -- err = ip4_datagram_connect(sk, -- (struct sockaddr *) &sin, -- sizeof(sin)); -+ err = __ip4_datagram_connect(sk, -+ (struct sockaddr *) &sin, -+ sizeof(sin)); - - ipv4_connected: - if (err) -@@ -204,6 +204,16 @@ out: - fl6_sock_release(flowlabel); - return err; - } -+ -+int ip6_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) -+{ -+ int res; -+ -+ lock_sock(sk); -+ res = __ip6_datagram_connect(sk, uaddr, addr_len); -+ release_sock(sk); -+ return res; -+} - EXPORT_SYMBOL_GPL(ip6_datagram_connect); - - void ipv6_icmp_error(struct sock *sk, struct sk_buff *skb, int err, -diff --git a/net/ipv6/exthdrs_offload.c b/net/ipv6/exthdrs_offload.c -index 447a7fbd1bb6..f5e2ba1c18bf 100644 ---- a/net/ipv6/exthdrs_offload.c -+++ b/net/ipv6/exthdrs_offload.c -@@ -36,6 +36,6 @@ out: - return ret; - - out_rt: -- inet_del_offload(&rthdr_offload, IPPROTO_ROUTING); -+ inet6_del_offload(&rthdr_offload, IPPROTO_ROUTING); - goto out; - } -diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c -index 65156a73b3f3..bf6233cdb753 100644 ---- a/net/ipv6/ip6_gre.c -+++ b/net/ipv6/ip6_gre.c -@@ -359,6 +359,7 @@ static void ip6gre_tunnel_uninit(struct net_device *dev) - struct ip6gre_net *ign = net_generic(net, ip6gre_net_id); - - ip6gre_tunnel_unlink(ign, netdev_priv(dev)); -+ ip6_tnl_dst_reset(netdev_priv(dev)); - dev_put(dev); - } - -diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c -index 774b09cb2920..63264c9a15cb 100644 ---- a/net/ipv6/ip6_input.c -+++ b/net/ipv6/ip6_input.c -@@ -325,10 +325,10 @@ int ip6_mc_input(struct sk_buff *skb) - if (offset < 0) - goto out; - -- if (!ipv6_is_mld(skb, nexthdr, offset)) -- goto out; -+ if (ipv6_is_mld(skb, nexthdr, offset)) -+ deliver = true; - -- deliver = true; -+ goto out; - } - /* unknown RA - process it normally */ - } -diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c -index 2c84072b1da7..57dd3e7d86cc 100644 ---- a/net/ipv6/ip6mr.c -+++ b/net/ipv6/ip6mr.c -@@ -552,7 +552,7 @@ static void ipmr_mfc_seq_stop(struct seq_file *seq, void *v) - - if (it->cache == &mrt->mfc6_unres_queue) - spin_unlock_bh(&mfc_unres_lock); -- else if (it->cache == mrt->mfc6_cache_array) -+ else if (it->cache == &mrt->mfc6_cache_array[it->ct]) - read_unlock(&mrt_lock); - } - -diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c -index 10eea2326022..e960fbe9e271 100644 ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -281,9 +281,6 @@ ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx) - if (tx->sdata->vif.type == NL80211_IFTYPE_WDS) - return TX_CONTINUE; - -- if (tx->sdata->vif.type == NL80211_IFTYPE_MESH_POINT) -- return TX_CONTINUE; -- - if (tx->flags & IEEE80211_TX_PS_BUFFERED) - return TX_CONTINUE; - -diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c -index f7ad5c630b65..56ff3b452277 100644 ---- a/net/netlink/af_netlink.c -+++ b/net/netlink/af_netlink.c -@@ -214,25 +214,52 @@ err1: - return NULL; - } - -+ -+static void -+__netlink_set_ring(struct sock *sk, struct nl_mmap_req *req, bool tx_ring, void **pg_vec, -+ unsigned int order) -+{ -+ struct netlink_sock *nlk = nlk_sk(sk); -+ struct sk_buff_head *queue; -+ struct netlink_ring *ring; -+ -+ queue = tx_ring ? &sk->sk_write_queue : &sk->sk_receive_queue; -+ ring = tx_ring ? &nlk->tx_ring : &nlk->rx_ring; -+ -+ spin_lock_bh(&queue->lock); -+ -+ ring->frame_max = req->nm_frame_nr - 1; -+ ring->head = 0; -+ ring->frame_size = req->nm_frame_size; -+ ring->pg_vec_pages = req->nm_block_size / PAGE_SIZE; -+ -+ swap(ring->pg_vec_len, req->nm_block_nr); -+ swap(ring->pg_vec_order, order); -+ swap(ring->pg_vec, pg_vec); -+ -+ __skb_queue_purge(queue); -+ spin_unlock_bh(&queue->lock); -+ -+ WARN_ON(atomic_read(&nlk->mapped)); -+ -+ if (pg_vec) -+ free_pg_vec(pg_vec, order, req->nm_block_nr); -+} -+ - static int netlink_set_ring(struct sock *sk, struct nl_mmap_req *req, -- bool closing, bool tx_ring) -+ bool tx_ring) - { - struct netlink_sock *nlk = nlk_sk(sk); - struct netlink_ring *ring; -- struct sk_buff_head *queue; - void **pg_vec = NULL; - unsigned int order = 0; -- int err; - - ring = tx_ring ? &nlk->tx_ring : &nlk->rx_ring; -- queue = tx_ring ? &sk->sk_write_queue : &sk->sk_receive_queue; - -- if (!closing) { -- if (atomic_read(&nlk->mapped)) -- return -EBUSY; -- if (atomic_read(&ring->pending)) -- return -EBUSY; -- } -+ if (atomic_read(&nlk->mapped)) -+ return -EBUSY; -+ if (atomic_read(&ring->pending)) -+ return -EBUSY; - - if (req->nm_block_nr) { - if (ring->pg_vec != NULL) -@@ -264,31 +291,19 @@ static int netlink_set_ring(struct sock *sk, struct nl_mmap_req *req, - return -EINVAL; - } - -- err = -EBUSY; - mutex_lock(&nlk->pg_vec_lock); -- if (closing || atomic_read(&nlk->mapped) == 0) { -- err = 0; -- spin_lock_bh(&queue->lock); -- -- ring->frame_max = req->nm_frame_nr - 1; -- ring->head = 0; -- ring->frame_size = req->nm_frame_size; -- ring->pg_vec_pages = req->nm_block_size / PAGE_SIZE; -- -- swap(ring->pg_vec_len, req->nm_block_nr); -- swap(ring->pg_vec_order, order); -- swap(ring->pg_vec, pg_vec); -- -- __skb_queue_purge(queue); -- spin_unlock_bh(&queue->lock); -- -- WARN_ON(atomic_read(&nlk->mapped)); -+ if (atomic_read(&nlk->mapped) == 0) { -+ __netlink_set_ring(sk, req, tx_ring, pg_vec, order); -+ mutex_unlock(&nlk->pg_vec_lock); -+ return 0; - } -+ - mutex_unlock(&nlk->pg_vec_lock); - - if (pg_vec) - free_pg_vec(pg_vec, order, req->nm_block_nr); -- return err; -+ -+ return -EBUSY; - } - - static void netlink_mm_open(struct vm_area_struct *vma) -@@ -762,10 +777,10 @@ static void netlink_sock_destruct(struct sock *sk) - - memset(&req, 0, sizeof(req)); - if (nlk->rx_ring.pg_vec) -- netlink_set_ring(sk, &req, true, false); -+ __netlink_set_ring(sk, &req, false, NULL, 0); - memset(&req, 0, sizeof(req)); - if (nlk->tx_ring.pg_vec) -- netlink_set_ring(sk, &req, true, true); -+ __netlink_set_ring(sk, &req, true, NULL, 0); - } - #endif /* CONFIG_NETLINK_MMAP */ - -@@ -2017,7 +2032,7 @@ static int netlink_setsockopt(struct socket *sock, int level, int optname, - return -EINVAL; - if (copy_from_user(&req, optval, sizeof(req))) - return -EFAULT; -- err = netlink_set_ring(sk, &req, false, -+ err = netlink_set_ring(sk, &req, - optname == NETLINK_TX_RING); - break; - } -diff --git a/net/rds/info.c b/net/rds/info.c -index 9a6b4f66187c..140a44a5f7b7 100644 ---- a/net/rds/info.c -+++ b/net/rds/info.c -@@ -176,7 +176,7 @@ int rds_info_getsockopt(struct socket *sock, int optname, char __user *optval, - - /* check for all kinds of wrapping and the like */ - start = (unsigned long)optval; -- if (len < 0 || len + PAGE_SIZE - 1 < len || start + len < start) { -+ if (len < 0 || len > INT_MAX - PAGE_SIZE + 1 || start + len < start) { - ret = -EINVAL; - goto out; - } -diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c -index 5a3c1c0a84a1..57c2c4c0c97b 100644 ---- a/net/sctp/protocol.c -+++ b/net/sctp/protocol.c -@@ -1170,7 +1170,7 @@ static void sctp_v4_del_protocol(void) - unregister_inetaddr_notifier(&sctp_inetaddr_notifier); - } - --static int __net_init sctp_net_init(struct net *net) -+static int __net_init sctp_defaults_init(struct net *net) - { - int status; - -@@ -1263,12 +1263,6 @@ static int __net_init sctp_net_init(struct net *net) - - sctp_dbg_objcnt_init(net); - -- /* Initialize the control inode/socket for handling OOTB packets. */ -- if ((status = sctp_ctl_sock_init(net))) { -- pr_err("Failed to initialize the SCTP control sock\n"); -- goto err_ctl_sock_init; -- } -- - /* Initialize the local address list. */ - INIT_LIST_HEAD(&net->sctp.local_addr_list); - spin_lock_init(&net->sctp.local_addr_lock); -@@ -1284,9 +1278,6 @@ static int __net_init sctp_net_init(struct net *net) - - return 0; - --err_ctl_sock_init: -- sctp_dbg_objcnt_exit(net); -- sctp_proc_exit(net); - err_init_proc: - cleanup_sctp_mibs(net); - err_init_mibs: -@@ -1295,15 +1286,12 @@ err_sysctl_register: - return status; - } - --static void __net_exit sctp_net_exit(struct net *net) -+static void __net_exit sctp_defaults_exit(struct net *net) - { - /* Free the local address list */ - sctp_free_addr_wq(net); - sctp_free_local_addr_list(net); - -- /* Free the control endpoint. */ -- inet_ctl_sock_destroy(net->sctp.ctl_sock); -- - sctp_dbg_objcnt_exit(net); - - sctp_proc_exit(net); -@@ -1311,9 +1299,32 @@ static void __net_exit sctp_net_exit(struct net *net) - sctp_sysctl_net_unregister(net); - } - --static struct pernet_operations sctp_net_ops = { -- .init = sctp_net_init, -- .exit = sctp_net_exit, -+static struct pernet_operations sctp_defaults_ops = { -+ .init = sctp_defaults_init, -+ .exit = sctp_defaults_exit, -+}; -+ -+static int __net_init sctp_ctrlsock_init(struct net *net) -+{ -+ int status; -+ -+ /* Initialize the control inode/socket for handling OOTB packets. */ -+ status = sctp_ctl_sock_init(net); -+ if (status) -+ pr_err("Failed to initialize the SCTP control sock\n"); -+ -+ return status; -+} -+ -+static void __net_init sctp_ctrlsock_exit(struct net *net) -+{ -+ /* Free the control endpoint. */ -+ inet_ctl_sock_destroy(net->sctp.ctl_sock); -+} -+ -+static struct pernet_operations sctp_ctrlsock_ops = { -+ .init = sctp_ctrlsock_init, -+ .exit = sctp_ctrlsock_exit, - }; - - /* Initialize the universe into something sensible. */ -@@ -1448,8 +1459,11 @@ SCTP_STATIC __init int sctp_init(void) - sctp_v4_pf_init(); - sctp_v6_pf_init(); - -- status = sctp_v4_protosw_init(); -+ status = register_pernet_subsys(&sctp_defaults_ops); -+ if (status) -+ goto err_register_defaults; - -+ status = sctp_v4_protosw_init(); - if (status) - goto err_protosw_init; - -@@ -1457,9 +1471,9 @@ SCTP_STATIC __init int sctp_init(void) - if (status) - goto err_v6_protosw_init; - -- status = register_pernet_subsys(&sctp_net_ops); -+ status = register_pernet_subsys(&sctp_ctrlsock_ops); - if (status) -- goto err_register_pernet_subsys; -+ goto err_register_ctrlsock; - - status = sctp_v4_add_protocol(); - if (status) -@@ -1476,12 +1490,14 @@ out: - err_v6_add_protocol: - sctp_v4_del_protocol(); - err_add_protocol: -- unregister_pernet_subsys(&sctp_net_ops); --err_register_pernet_subsys: -+ unregister_pernet_subsys(&sctp_ctrlsock_ops); -+err_register_ctrlsock: - sctp_v6_protosw_exit(); - err_v6_protosw_init: - sctp_v4_protosw_exit(); - err_protosw_init: -+ unregister_pernet_subsys(&sctp_defaults_ops); -+err_register_defaults: - sctp_v4_pf_exit(); - sctp_v6_pf_exit(); - sctp_sysctl_unregister(); -@@ -1514,12 +1530,14 @@ SCTP_STATIC __exit void sctp_exit(void) - sctp_v6_del_protocol(); - sctp_v4_del_protocol(); - -- unregister_pernet_subsys(&sctp_net_ops); -+ unregister_pernet_subsys(&sctp_ctrlsock_ops); - - /* Free protosw registrations */ - sctp_v6_protosw_exit(); - sctp_v4_protosw_exit(); - -+ unregister_pernet_subsys(&sctp_defaults_ops); -+ - /* Unregister with socket layer. */ - sctp_v6_pf_exit(); - sctp_v4_pf_exit(); -diff --git a/net/sctp/socket.c b/net/sctp/socket.c -index dfb9b133e662..ec5766dc3946 100644 ---- a/net/sctp/socket.c -+++ b/net/sctp/socket.c -@@ -1548,8 +1548,10 @@ SCTP_STATIC void sctp_close(struct sock *sk, long timeout) - - /* Supposedly, no process has access to the socket, but - * the net layers still may. -+ * Also, sctp_destroy_sock() needs to be called with addr_wq_lock -+ * held and that should be grabbed before socket lock. - */ -- sctp_local_bh_disable(); -+ spin_lock_bh(&net->sctp.addr_wq_lock); - sctp_bh_lock_sock(sk); - - /* Hold the sock, since sk_common_release() will put sock_put() -@@ -1559,7 +1561,7 @@ SCTP_STATIC void sctp_close(struct sock *sk, long timeout) - sk_common_release(sk); - - sctp_bh_unlock_sock(sk); -- sctp_local_bh_enable(); -+ spin_unlock_bh(&net->sctp.addr_wq_lock); - - sock_put(sk); - -@@ -3508,6 +3510,7 @@ static int sctp_setsockopt_auto_asconf(struct sock *sk, char __user *optval, - if ((val && sp->do_auto_asconf) || (!val && !sp->do_auto_asconf)) - return 0; - -+ spin_lock_bh(&sock_net(sk)->sctp.addr_wq_lock); - if (val == 0 && sp->do_auto_asconf) { - list_del(&sp->auto_asconf_list); - sp->do_auto_asconf = 0; -@@ -3516,6 +3519,7 @@ static int sctp_setsockopt_auto_asconf(struct sock *sk, char __user *optval, - &sock_net(sk)->sctp.auto_asconf_splist); - sp->do_auto_asconf = 1; - } -+ spin_unlock_bh(&sock_net(sk)->sctp.addr_wq_lock); - return 0; - } - -@@ -4007,18 +4011,28 @@ SCTP_STATIC int sctp_init_sock(struct sock *sk) - local_bh_disable(); - percpu_counter_inc(&sctp_sockets_allocated); - sock_prot_inuse_add(net, sk->sk_prot, 1); -+ -+ /* Nothing can fail after this block, otherwise -+ * sctp_destroy_sock() will be called without addr_wq_lock held -+ */ - if (net->sctp.default_auto_asconf) { -+ spin_lock(&sock_net(sk)->sctp.addr_wq_lock); - list_add_tail(&sp->auto_asconf_list, - &net->sctp.auto_asconf_splist); - sp->do_auto_asconf = 1; -- } else -+ spin_unlock(&sock_net(sk)->sctp.addr_wq_lock); -+ } else { - sp->do_auto_asconf = 0; -+ } -+ - local_bh_enable(); - - return 0; - } - --/* Cleanup any SCTP per socket resources. */ -+/* Cleanup any SCTP per socket resources. Must be called with -+ * sock_net(sk)->sctp.addr_wq_lock held if sp->do_auto_asconf is true -+ */ - SCTP_STATIC void sctp_destroy_sock(struct sock *sk) - { - struct sctp_sock *sp; -@@ -6957,6 +6971,19 @@ void sctp_copy_sock(struct sock *newsk, struct sock *sk, - newinet->mc_list = NULL; - } - -+static inline void sctp_copy_descendant(struct sock *sk_to, -+ const struct sock *sk_from) -+{ -+ int ancestor_size = sizeof(struct inet_sock) + -+ sizeof(struct sctp_sock) - -+ offsetof(struct sctp_sock, auto_asconf_list); -+ -+ if (sk_from->sk_family == PF_INET6) -+ ancestor_size += sizeof(struct ipv6_pinfo); -+ -+ __inet_sk_copy_descendant(sk_to, sk_from, ancestor_size); -+} -+ - /* Populate the fields of the newsk from the oldsk and migrate the assoc - * and its messages to the newsk. - */ -@@ -6971,7 +6998,6 @@ static void sctp_sock_migrate(struct sock *oldsk, struct sock *newsk, - struct sk_buff *skb, *tmp; - struct sctp_ulpevent *event; - struct sctp_bind_hashbucket *head; -- struct list_head tmplist; - - /* Migrate socket buffer sizes and all the socket level options to the - * new socket. -@@ -6979,12 +7005,7 @@ static void sctp_sock_migrate(struct sock *oldsk, struct sock *newsk, - newsk->sk_sndbuf = oldsk->sk_sndbuf; - newsk->sk_rcvbuf = oldsk->sk_rcvbuf; - /* Brute force copy old sctp opt. */ -- if (oldsp->do_auto_asconf) { -- memcpy(&tmplist, &newsp->auto_asconf_list, sizeof(tmplist)); -- inet_sk_copy_descendant(newsk, oldsk); -- memcpy(&newsp->auto_asconf_list, &tmplist, sizeof(tmplist)); -- } else -- inet_sk_copy_descendant(newsk, oldsk); -+ sctp_copy_descendant(newsk, oldsk); - - /* Restore the ep value that was overwritten with the above structure - * copy. -diff --git a/net/tipc/socket.c b/net/tipc/socket.c -index 2b1d7c2d677d..e0cb5edc6d1d 100644 ---- a/net/tipc/socket.c -+++ b/net/tipc/socket.c -@@ -1528,6 +1528,7 @@ static int accept(struct socket *sock, struct socket *new_sock, int flags) - res = tipc_create(sock_net(sock->sk), new_sock, 0, 0); - if (res) - goto exit; -+ security_sk_clone(sock->sk, new_sock->sk); - - new_sk = new_sock->sk; - new_tsock = tipc_sk(new_sk); -diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c -index d30252e7f3e8..183a96ab2533 100644 ---- a/sound/pci/hda/patch_realtek.c -+++ b/sound/pci/hda/patch_realtek.c -@@ -1137,7 +1137,7 @@ static const struct hda_fixup alc880_fixups[] = { - /* override all pins as BIOS on old Amilo is broken */ - .type = HDA_FIXUP_PINS, - .v.pins = (const struct hda_pintbl[]) { -- { 0x14, 0x0121411f }, /* HP */ -+ { 0x14, 0x0121401f }, /* HP */ - { 0x15, 0x99030120 }, /* speaker */ - { 0x16, 0x99030130 }, /* bass speaker */ - { 0x17, 0x411111f0 }, /* N/A */ -@@ -1157,7 +1157,7 @@ static const struct hda_fixup alc880_fixups[] = { - /* almost compatible with FUJITSU, but no bass and SPDIF */ - .type = HDA_FIXUP_PINS, - .v.pins = (const struct hda_pintbl[]) { -- { 0x14, 0x0121411f }, /* HP */ -+ { 0x14, 0x0121401f }, /* HP */ - { 0x15, 0x99030120 }, /* speaker */ - { 0x16, 0x411111f0 }, /* N/A */ - { 0x17, 0x411111f0 }, /* N/A */ -@@ -1365,7 +1365,7 @@ static const struct snd_pci_quirk alc880_fixup_tbl[] = { - SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810), - SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM), - SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE), -- SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_FIXUP_F1734), -+ SND_PCI_QUIRK(0x1734, 0x107c, "FSC Amilo M1437", ALC880_FIXUP_FUJITSU), - SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU), - SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734), - SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU), diff --git a/patch/kernel/marvell-default/1-patch-3.10.90-91.patch b/patch/kernel/marvell-default/1-patch-3.10.90-91.patch deleted file mode 100644 index 61c930ce08..0000000000 --- a/patch/kernel/marvell-default/1-patch-3.10.90-91.patch +++ /dev/null @@ -1,1875 +0,0 @@ -diff --git a/Makefile b/Makefile -index ce741a9f5b1c..ba6a94cf354b 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,6 +1,6 @@ - VERSION = 3 - PATCHLEVEL = 10 --SUBLEVEL = 90 -+SUBLEVEL = 91 - EXTRAVERSION = - NAME = TOSSUG Baby Fish - -diff --git a/arch/arm/Makefile b/arch/arm/Makefile -index 1ba358ba16b8..7d4ce431107b 100644 ---- a/arch/arm/Makefile -+++ b/arch/arm/Makefile -@@ -55,6 +55,14 @@ endif - - comma = , - -+# -+# The Scalar Replacement of Aggregates (SRA) optimization pass in GCC 4.9 and -+# later may result in code being generated that handles signed short and signed -+# char struct members incorrectly. So disable it. -+# (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65932) -+# -+KBUILD_CFLAGS += $(call cc-option,-fno-ipa-sra) -+ - # This selects which instruction set is used. - # Note that GCC does not numerically define an architecture version - # macro, but instead defines a whole series of macros which makes -diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c -index b5d458769b65..250319040de2 100644 ---- a/arch/arm64/mm/fault.c -+++ b/arch/arm64/mm/fault.c -@@ -278,6 +278,7 @@ retry: - * starvation. - */ - mm_flags &= ~FAULT_FLAG_ALLOW_RETRY; -+ mm_flags |= FAULT_FLAG_TRIED; - goto retry; - } - } -diff --git a/arch/m68k/include/asm/linkage.h b/arch/m68k/include/asm/linkage.h -index 5a822bb790f7..066e74f666ae 100644 ---- a/arch/m68k/include/asm/linkage.h -+++ b/arch/m68k/include/asm/linkage.h -@@ -4,4 +4,34 @@ - #define __ALIGN .align 4 - #define __ALIGN_STR ".align 4" - -+/* -+ * Make sure the compiler doesn't do anything stupid with the -+ * arguments on the stack - they are owned by the *caller*, not -+ * the callee. This just fools gcc into not spilling into them, -+ * and keeps it from doing tailcall recursion and/or using the -+ * stack slots for temporaries, since they are live and "used" -+ * all the way to the end of the function. -+ */ -+#define asmlinkage_protect(n, ret, args...) \ -+ __asmlinkage_protect##n(ret, ##args) -+#define __asmlinkage_protect_n(ret, args...) \ -+ __asm__ __volatile__ ("" : "=r" (ret) : "0" (ret), ##args) -+#define __asmlinkage_protect0(ret) \ -+ __asmlinkage_protect_n(ret) -+#define __asmlinkage_protect1(ret, arg1) \ -+ __asmlinkage_protect_n(ret, "m" (arg1)) -+#define __asmlinkage_protect2(ret, arg1, arg2) \ -+ __asmlinkage_protect_n(ret, "m" (arg1), "m" (arg2)) -+#define __asmlinkage_protect3(ret, arg1, arg2, arg3) \ -+ __asmlinkage_protect_n(ret, "m" (arg1), "m" (arg2), "m" (arg3)) -+#define __asmlinkage_protect4(ret, arg1, arg2, arg3, arg4) \ -+ __asmlinkage_protect_n(ret, "m" (arg1), "m" (arg2), "m" (arg3), \ -+ "m" (arg4)) -+#define __asmlinkage_protect5(ret, arg1, arg2, arg3, arg4, arg5) \ -+ __asmlinkage_protect_n(ret, "m" (arg1), "m" (arg2), "m" (arg3), \ -+ "m" (arg4), "m" (arg5)) -+#define __asmlinkage_protect6(ret, arg1, arg2, arg3, arg4, arg5, arg6) \ -+ __asmlinkage_protect_n(ret, "m" (arg1), "m" (arg2), "m" (arg3), \ -+ "m" (arg4), "m" (arg5), "m" (arg6)) -+ - #endif -diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c -index 23129d1005db..5fa55b80b7b6 100644 ---- a/arch/mips/mm/dma-default.c -+++ b/arch/mips/mm/dma-default.c -@@ -91,7 +91,7 @@ static gfp_t massage_gfp_flags(const struct device *dev, gfp_t gfp) - else - #endif - #if defined(CONFIG_ZONE_DMA) && !defined(CONFIG_ZONE_DMA32) -- if (dev->coherent_dma_mask < DMA_BIT_MASK(64)) -+ if (dev->coherent_dma_mask < DMA_BIT_MASK(sizeof(phys_addr_t) * 8)) - dma_flag = __GFP_DMA; - else - #endif -diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c -index 8ee842ce3aba..0473d31b3a4d 100644 ---- a/arch/powerpc/platforms/powernv/pci.c -+++ b/arch/powerpc/platforms/powernv/pci.c -@@ -106,6 +106,7 @@ static void pnv_teardown_msi_irqs(struct pci_dev *pdev) - struct pci_controller *hose = pci_bus_to_host(pdev->bus); - struct pnv_phb *phb = hose->private_data; - struct msi_desc *entry; -+ irq_hw_number_t hwirq; - - if (WARN_ON(!phb)) - return; -@@ -113,10 +114,10 @@ static void pnv_teardown_msi_irqs(struct pci_dev *pdev) - list_for_each_entry(entry, &pdev->msi_list, list) { - if (entry->irq == NO_IRQ) - continue; -+ hwirq = virq_to_hw(entry->irq); - irq_set_msi_desc(entry->irq, NULL); -- msi_bitmap_free_hwirqs(&phb->msi_bmp, -- virq_to_hw(entry->irq) - phb->msi_base, 1); - irq_dispose_mapping(entry->irq); -+ msi_bitmap_free_hwirqs(&phb->msi_bmp, hwirq - phb->msi_base, 1); - } - } - #endif /* CONFIG_PCI_MSI */ -diff --git a/arch/powerpc/sysdev/fsl_msi.c b/arch/powerpc/sysdev/fsl_msi.c -index ab02db3d02d8..6616fa619945 100644 ---- a/arch/powerpc/sysdev/fsl_msi.c -+++ b/arch/powerpc/sysdev/fsl_msi.c -@@ -108,15 +108,16 @@ static void fsl_teardown_msi_irqs(struct pci_dev *pdev) - { - struct msi_desc *entry; - struct fsl_msi *msi_data; -+ irq_hw_number_t hwirq; - - list_for_each_entry(entry, &pdev->msi_list, list) { - if (entry->irq == NO_IRQ) - continue; -+ hwirq = virq_to_hw(entry->irq); - msi_data = irq_get_chip_data(entry->irq); - irq_set_msi_desc(entry->irq, NULL); -- msi_bitmap_free_hwirqs(&msi_data->bitmap, -- virq_to_hw(entry->irq), 1); - irq_dispose_mapping(entry->irq); -+ msi_bitmap_free_hwirqs(&msi_data->bitmap, hwirq, 1); - } - - return; -diff --git a/arch/powerpc/sysdev/mpic_pasemi_msi.c b/arch/powerpc/sysdev/mpic_pasemi_msi.c -index 38e62382070c..9e14d82287a1 100644 ---- a/arch/powerpc/sysdev/mpic_pasemi_msi.c -+++ b/arch/powerpc/sysdev/mpic_pasemi_msi.c -@@ -74,6 +74,7 @@ static int pasemi_msi_check_device(struct pci_dev *pdev, int nvec, int type) - static void pasemi_msi_teardown_msi_irqs(struct pci_dev *pdev) - { - struct msi_desc *entry; -+ irq_hw_number_t hwirq; - - pr_debug("pasemi_msi_teardown_msi_irqs, pdev %p\n", pdev); - -@@ -81,10 +82,11 @@ static void pasemi_msi_teardown_msi_irqs(struct pci_dev *pdev) - if (entry->irq == NO_IRQ) - continue; - -+ hwirq = virq_to_hw(entry->irq); - irq_set_msi_desc(entry->irq, NULL); -- msi_bitmap_free_hwirqs(&msi_mpic->msi_bitmap, -- virq_to_hw(entry->irq), ALLOC_CHUNK); - irq_dispose_mapping(entry->irq); -+ msi_bitmap_free_hwirqs(&msi_mpic->msi_bitmap, -+ hwirq, ALLOC_CHUNK); - } - - return; -diff --git a/arch/powerpc/sysdev/mpic_u3msi.c b/arch/powerpc/sysdev/mpic_u3msi.c -index 9a7aa0ed9c1c..dfc3486bf802 100644 ---- a/arch/powerpc/sysdev/mpic_u3msi.c -+++ b/arch/powerpc/sysdev/mpic_u3msi.c -@@ -124,15 +124,16 @@ static int u3msi_msi_check_device(struct pci_dev *pdev, int nvec, int type) - static void u3msi_teardown_msi_irqs(struct pci_dev *pdev) - { - struct msi_desc *entry; -+ irq_hw_number_t hwirq; - - list_for_each_entry(entry, &pdev->msi_list, list) { - if (entry->irq == NO_IRQ) - continue; - -+ hwirq = virq_to_hw(entry->irq); - irq_set_msi_desc(entry->irq, NULL); -- msi_bitmap_free_hwirqs(&msi_mpic->msi_bitmap, -- virq_to_hw(entry->irq), 1); - irq_dispose_mapping(entry->irq); -+ msi_bitmap_free_hwirqs(&msi_mpic->msi_bitmap, hwirq, 1); - } - - return; -diff --git a/arch/powerpc/sysdev/ppc4xx_msi.c b/arch/powerpc/sysdev/ppc4xx_msi.c -index 43948da837a7..c3e65129940b 100644 ---- a/arch/powerpc/sysdev/ppc4xx_msi.c -+++ b/arch/powerpc/sysdev/ppc4xx_msi.c -@@ -121,16 +121,17 @@ void ppc4xx_teardown_msi_irqs(struct pci_dev *dev) - { - struct msi_desc *entry; - struct ppc4xx_msi *msi_data = &ppc4xx_msi; -+ irq_hw_number_t hwirq; - - dev_dbg(&dev->dev, "PCIE-MSI: tearing down msi irqs\n"); - - list_for_each_entry(entry, &dev->msi_list, list) { - if (entry->irq == NO_IRQ) - continue; -+ hwirq = virq_to_hw(entry->irq); - irq_set_msi_desc(entry->irq, NULL); -- msi_bitmap_free_hwirqs(&msi_data->bitmap, -- virq_to_hw(entry->irq), 1); - irq_dispose_mapping(entry->irq); -+ msi_bitmap_free_hwirqs(&msi_data->bitmap, hwirq, 1); - } - } - -diff --git a/arch/x86/include/asm/uaccess_64.h b/arch/x86/include/asm/uaccess_64.h -index 142810c457dc..34df5c22df90 100644 ---- a/arch/x86/include/asm/uaccess_64.h -+++ b/arch/x86/include/asm/uaccess_64.h -@@ -77,11 +77,10 @@ int copy_to_user(void __user *dst, const void *src, unsigned size) - } - - static __always_inline __must_check --int __copy_from_user(void *dst, const void __user *src, unsigned size) -+int __copy_from_user_nocheck(void *dst, const void __user *src, unsigned size) - { - int ret = 0; - -- might_fault(); - if (!__builtin_constant_p(size)) - return copy_user_generic(dst, (__force void *)src, size); - switch (size) { -@@ -121,11 +120,17 @@ int __copy_from_user(void *dst, const void __user *src, unsigned size) - } - - static __always_inline __must_check --int __copy_to_user(void __user *dst, const void *src, unsigned size) -+int __copy_from_user(void *dst, const void __user *src, unsigned size) -+{ -+ might_fault(); -+ return __copy_from_user_nocheck(dst, src, size); -+} -+ -+static __always_inline __must_check -+int __copy_to_user_nocheck(void __user *dst, const void *src, unsigned size) - { - int ret = 0; - -- might_fault(); - if (!__builtin_constant_p(size)) - return copy_user_generic((__force void *)dst, src, size); - switch (size) { -@@ -165,6 +170,13 @@ int __copy_to_user(void __user *dst, const void *src, unsigned size) - } - - static __always_inline __must_check -+int __copy_to_user(void __user *dst, const void *src, unsigned size) -+{ -+ might_fault(); -+ return __copy_to_user_nocheck(dst, src, size); -+} -+ -+static __always_inline __must_check - int __copy_in_user(void __user *dst, const void __user *src, unsigned size) - { - int ret = 0; -@@ -220,13 +232,13 @@ int __copy_in_user(void __user *dst, const void __user *src, unsigned size) - static __must_check __always_inline int - __copy_from_user_inatomic(void *dst, const void __user *src, unsigned size) - { -- return copy_user_generic(dst, (__force const void *)src, size); -+ return __copy_from_user_nocheck(dst, (__force const void *)src, size); - } - - static __must_check __always_inline int - __copy_to_user_inatomic(void __user *dst, const void *src, unsigned size) - { -- return copy_user_generic((__force void *)dst, src, size); -+ return __copy_to_user_nocheck((__force void *)dst, src, size); - } - - extern long __copy_user_nocache(void *dst, const void __user *src, -diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c -index 033eb44dc661..9620d18cb638 100644 ---- a/arch/x86/kernel/apic/apic.c -+++ b/arch/x86/kernel/apic/apic.c -@@ -350,6 +350,13 @@ static void __setup_APIC_LVTT(unsigned int clocks, int oneshot, int irqen) - apic_write(APIC_LVTT, lvtt_value); - - if (lvtt_value & APIC_LVT_TIMER_TSCDEADLINE) { -+ /* -+ * See Intel SDM: TSC-Deadline Mode chapter. In xAPIC mode, -+ * writing to the APIC LVTT and TSC_DEADLINE MSR isn't serialized. -+ * According to Intel, MFENCE can do the serialization here. -+ */ -+ asm volatile("mfence" : : : "memory"); -+ - printk_once(KERN_DEBUG "TSC deadline timer enabled\n"); - return; - } -diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c -index 27e3a14fc917..9714a7aa32fc 100644 ---- a/arch/x86/kernel/tsc.c -+++ b/arch/x86/kernel/tsc.c -@@ -20,6 +20,7 @@ - #include - #include - #include -+#include - - unsigned int __read_mostly cpu_khz; /* TSC clocks / usec, not used here */ - EXPORT_SYMBOL(cpu_khz); -@@ -806,15 +807,17 @@ EXPORT_SYMBOL_GPL(mark_tsc_unstable); - - static void __init check_system_tsc_reliable(void) - { --#ifdef CONFIG_MGEODE_LX -- /* RTSC counts during suspend */ -+#if defined(CONFIG_MGEODEGX1) || defined(CONFIG_MGEODE_LX) || defined(CONFIG_X86_GENERIC) -+ if (is_geode_lx()) { -+ /* RTSC counts during suspend */ - #define RTSC_SUSP 0x100 -- unsigned long res_low, res_high; -+ unsigned long res_low, res_high; - -- rdmsr_safe(MSR_GEODE_BUSCONT_CONF0, &res_low, &res_high); -- /* Geode_LX - the OLPC CPU has a very reliable TSC */ -- if (res_low & RTSC_SUSP) -- tsc_clocksource_reliable = 1; -+ rdmsr_safe(MSR_GEODE_BUSCONT_CONF0, &res_low, &res_high); -+ /* Geode_LX - the OLPC CPU has a very reliable TSC */ -+ if (res_low & RTSC_SUSP) -+ tsc_clocksource_reliable = 1; -+ } - #endif - if (boot_cpu_has(X86_FEATURE_TSC_RELIABLE)) - tsc_clocksource_reliable = 1; -diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c -index 224d2ef754cc..3deddd796f76 100644 ---- a/arch/x86/kvm/svm.c -+++ b/arch/x86/kvm/svm.c -@@ -496,7 +496,7 @@ static void skip_emulated_instruction(struct kvm_vcpu *vcpu) - struct vcpu_svm *svm = to_svm(vcpu); - - if (svm->vmcb->control.next_rip != 0) { -- WARN_ON(!static_cpu_has(X86_FEATURE_NRIPS)); -+ WARN_ON_ONCE(!static_cpu_has(X86_FEATURE_NRIPS)); - svm->next_rip = svm->vmcb->control.next_rip; - } - -diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c -index 2db3f30bed75..b04e50262088 100644 ---- a/arch/x86/mm/init_64.c -+++ b/arch/x86/mm/init_64.c -@@ -1163,7 +1163,7 @@ void mark_rodata_ro(void) - * has been zapped already via cleanup_highmem(). - */ - all_end = roundup((unsigned long)_brk_end, PMD_SIZE); -- set_memory_nx(rodata_start, (all_end - rodata_start) >> PAGE_SHIFT); -+ set_memory_nx(text_end, (all_end - text_end) >> PAGE_SHIFT); - - rodata_test(); - -diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c -index 13d926282c89..511630db00a8 100644 ---- a/arch/x86/xen/enlighten.c -+++ b/arch/x86/xen/enlighten.c -@@ -33,6 +33,10 @@ - #include - #include - -+#ifdef CONFIG_KEXEC_CORE -+#include -+#endif -+ - #include - #include - #include -@@ -1744,6 +1748,21 @@ static struct notifier_block xen_hvm_cpu_notifier __cpuinitdata = { - .notifier_call = xen_hvm_cpu_notify, - }; - -+#ifdef CONFIG_KEXEC_CORE -+static void xen_hvm_shutdown(void) -+{ -+ native_machine_shutdown(); -+ if (kexec_in_progress) -+ xen_reboot(SHUTDOWN_soft_reset); -+} -+ -+static void xen_hvm_crash_shutdown(struct pt_regs *regs) -+{ -+ native_machine_crash_shutdown(regs); -+ xen_reboot(SHUTDOWN_soft_reset); -+} -+#endif -+ - static void __init xen_hvm_guest_init(void) - { - init_hvm_pv_info(); -@@ -1758,6 +1777,10 @@ static void __init xen_hvm_guest_init(void) - x86_init.irqs.intr_init = xen_init_IRQ; - xen_hvm_init_time_ops(); - xen_hvm_init_mmu_ops(); -+#ifdef CONFIG_KEXEC_CORE -+ machine_ops.shutdown = xen_hvm_shutdown; -+ machine_ops.crash_shutdown = xen_hvm_crash_shutdown; -+#endif - } - - static bool __init xen_hvm_platform(void) -diff --git a/drivers/base/regmap/regmap-debugfs.c b/drivers/base/regmap/regmap-debugfs.c -index b41994fd8460..2670bebb058b 100644 ---- a/drivers/base/regmap/regmap-debugfs.c -+++ b/drivers/base/regmap/regmap-debugfs.c -@@ -23,8 +23,7 @@ static struct dentry *regmap_debugfs_root; - /* Calculate the length of a fixed format */ - static size_t regmap_calc_reg_len(int max_val, char *buf, size_t buf_size) - { -- snprintf(buf, buf_size, "%x", max_val); -- return strlen(buf); -+ return snprintf(NULL, 0, "%x", max_val); - } - - static ssize_t regmap_name_read_file(struct file *file, -@@ -419,7 +418,7 @@ static ssize_t regmap_access_read_file(struct file *file, - /* If we're in the region the user is trying to read */ - if (p >= *ppos) { - /* ...but not beyond it */ -- if (buf_pos >= count - 1 - tot_len) -+ if (buf_pos + tot_len + 1 >= count) - break; - - /* Format the register */ -diff --git a/drivers/gpu/drm/drm_lock.c b/drivers/gpu/drm/drm_lock.c -index d752c96d6090..bdceb60998d3 100644 ---- a/drivers/gpu/drm/drm_lock.c -+++ b/drivers/gpu/drm/drm_lock.c -@@ -58,6 +58,9 @@ int drm_lock(struct drm_device *dev, void *data, struct drm_file *file_priv) - struct drm_master *master = file_priv->master; - int ret = 0; - -+ if (drm_core_check_feature(dev, DRIVER_MODESET)) -+ return -EINVAL; -+ - ++file_priv->lock_count; - - if (lock->context == DRM_KERNEL_CONTEXT) { -@@ -151,6 +154,9 @@ int drm_unlock(struct drm_device *dev, void *data, struct drm_file *file_priv) - struct drm_lock *lock = data; - struct drm_master *master = file_priv->master; - -+ if (drm_core_check_feature(dev, DRIVER_MODESET)) -+ return -EINVAL; -+ - if (lock->context == DRM_KERNEL_CONTEXT) { - DRM_ERROR("Process %d using kernel context %d\n", - task_pid_nr(current), lock->context); -diff --git a/drivers/infiniband/hw/qib/qib.h b/drivers/infiniband/hw/qib/qib.h -index d1b30c66d604..727a9dc44b94 100644 ---- a/drivers/infiniband/hw/qib/qib.h -+++ b/drivers/infiniband/hw/qib/qib.h -@@ -1467,27 +1467,22 @@ extern struct mutex qib_mutex; - * first to avoid possible serial port delays from printk. - */ - #define qib_early_err(dev, fmt, ...) \ -- do { \ -- dev_err(dev, fmt, ##__VA_ARGS__); \ -- } while (0) -+ dev_err(dev, fmt, ##__VA_ARGS__) - - #define qib_dev_err(dd, fmt, ...) \ -- do { \ -- dev_err(&(dd)->pcidev->dev, "%s: " fmt, \ -- qib_get_unit_name((dd)->unit), ##__VA_ARGS__); \ -- } while (0) -+ dev_err(&(dd)->pcidev->dev, "%s: " fmt, \ -+ qib_get_unit_name((dd)->unit), ##__VA_ARGS__) - --#define qib_dev_porterr(dd, port, fmt, ...) \ -- do { \ -- dev_err(&(dd)->pcidev->dev, "%s: IB%u:%u " fmt, \ -- qib_get_unit_name((dd)->unit), (dd)->unit, (port), \ -- ##__VA_ARGS__); \ -- } while (0) -+#define qib_dev_warn(dd, fmt, ...) \ -+ dev_warn(&(dd)->pcidev->dev, "%s: " fmt, \ -+ qib_get_unit_name((dd)->unit), ##__VA_ARGS__) - -+#define qib_dev_porterr(dd, port, fmt, ...) \ -+ dev_err(&(dd)->pcidev->dev, "%s: IB%u:%u " fmt, \ -+ qib_get_unit_name((dd)->unit), (dd)->unit, (port), \ -+ ##__VA_ARGS__) - #define qib_devinfo(pcidev, fmt, ...) \ -- do { \ -- dev_info(&(pcidev)->dev, fmt, ##__VA_ARGS__); \ -- } while (0) -+ dev_info(&(pcidev)->dev, fmt, ##__VA_ARGS__) - - /* - * this is used for formatting hw error messages... -diff --git a/drivers/infiniband/hw/qib/qib_keys.c b/drivers/infiniband/hw/qib/qib_keys.c -index 3b9afccaaade..eabe54738be6 100644 ---- a/drivers/infiniband/hw/qib/qib_keys.c -+++ b/drivers/infiniband/hw/qib/qib_keys.c -@@ -86,6 +86,10 @@ int qib_alloc_lkey(struct qib_mregion *mr, int dma_region) - * unrestricted LKEY. - */ - rkt->gen++; -+ /* -+ * bits are capped in qib_verbs.c to insure enough bits -+ * for generation number -+ */ - mr->lkey = (r << (32 - ib_qib_lkey_table_size)) | - ((((1 << (24 - ib_qib_lkey_table_size)) - 1) & rkt->gen) - << 8); -diff --git a/drivers/infiniband/hw/qib/qib_verbs.c b/drivers/infiniband/hw/qib/qib_verbs.c -index 904c384aa361..6c809bf50128 100644 ---- a/drivers/infiniband/hw/qib/qib_verbs.c -+++ b/drivers/infiniband/hw/qib/qib_verbs.c -@@ -40,6 +40,7 @@ - #include - #include - #include -+#include - - #include "qib.h" - #include "qib_common.h" -@@ -2084,10 +2085,16 @@ int qib_register_ib_device(struct qib_devdata *dd) - * the LKEY). The remaining bits act as a generation number or tag. - */ - spin_lock_init(&dev->lk_table.lock); -+ /* insure generation is at least 4 bits see keys.c */ -+ if (ib_qib_lkey_table_size > MAX_LKEY_TABLE_BITS) { -+ qib_dev_warn(dd, "lkey bits %u too large, reduced to %u\n", -+ ib_qib_lkey_table_size, MAX_LKEY_TABLE_BITS); -+ ib_qib_lkey_table_size = MAX_LKEY_TABLE_BITS; -+ } - dev->lk_table.max = 1 << ib_qib_lkey_table_size; - lk_tab_size = dev->lk_table.max * sizeof(*dev->lk_table.table); - dev->lk_table.table = (struct qib_mregion __rcu **) -- __get_free_pages(GFP_KERNEL, get_order(lk_tab_size)); -+ vmalloc(lk_tab_size); - if (dev->lk_table.table == NULL) { - ret = -ENOMEM; - goto err_lk; -@@ -2260,7 +2267,7 @@ err_tx: - sizeof(struct qib_pio_header), - dev->pio_hdrs, dev->pio_hdrs_phys); - err_hdrs: -- free_pages((unsigned long) dev->lk_table.table, get_order(lk_tab_size)); -+ vfree(dev->lk_table.table); - err_lk: - kfree(dev->qp_table); - err_qpt: -@@ -2314,8 +2321,7 @@ void qib_unregister_ib_device(struct qib_devdata *dd) - sizeof(struct qib_pio_header), - dev->pio_hdrs, dev->pio_hdrs_phys); - lk_tab_size = dev->lk_table.max * sizeof(*dev->lk_table.table); -- free_pages((unsigned long) dev->lk_table.table, -- get_order(lk_tab_size)); -+ vfree(dev->lk_table.table); - kfree(dev->qp_table); - } - -diff --git a/drivers/infiniband/hw/qib/qib_verbs.h b/drivers/infiniband/hw/qib/qib_verbs.h -index aff8b2c17886..e4f9fff51890 100644 ---- a/drivers/infiniband/hw/qib/qib_verbs.h -+++ b/drivers/infiniband/hw/qib/qib_verbs.h -@@ -645,6 +645,8 @@ struct qib_qpn_table { - struct qpn_map map[QPNMAP_ENTRIES]; - }; - -+#define MAX_LKEY_TABLE_BITS 23 -+ - struct qib_lkey_table { - spinlock_t lock; /* protect changes in this struct */ - u32 next; /* next unused index (speeds search) */ -diff --git a/drivers/macintosh/windfarm_core.c b/drivers/macintosh/windfarm_core.c -index 3ee198b65843..cc7ece1712b5 100644 ---- a/drivers/macintosh/windfarm_core.c -+++ b/drivers/macintosh/windfarm_core.c -@@ -435,7 +435,7 @@ int wf_unregister_client(struct notifier_block *nb) - { - mutex_lock(&wf_lock); - blocking_notifier_chain_unregister(&wf_client_list, nb); -- wf_client_count++; -+ wf_client_count--; - if (wf_client_count == 0) - wf_stop_thread(); - mutex_unlock(&wf_lock); -diff --git a/drivers/md/dm-cache-policy-cleaner.c b/drivers/md/dm-cache-policy-cleaner.c -index b04d1f904d07..2eca9084defe 100644 ---- a/drivers/md/dm-cache-policy-cleaner.c -+++ b/drivers/md/dm-cache-policy-cleaner.c -@@ -434,7 +434,7 @@ static struct dm_cache_policy *wb_create(dm_cblock_t cache_size, - static struct dm_cache_policy_type wb_policy_type = { - .name = "cleaner", - .version = {1, 0, 0}, -- .hint_size = 0, -+ .hint_size = 4, - .owner = THIS_MODULE, - .create = wb_create - }; -diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c -index 84cddccc0249..4805c15185c2 100644 ---- a/drivers/md/dm-raid.c -+++ b/drivers/md/dm-raid.c -@@ -325,8 +325,7 @@ static int validate_region_size(struct raid_set *rs, unsigned long region_size) - */ - if (min_region_size > (1 << 13)) { - /* If not a power of 2, make it the next power of 2 */ -- if (min_region_size & (min_region_size - 1)) -- region_size = 1 << fls(region_size); -+ region_size = roundup_pow_of_two(min_region_size); - DMINFO("Choosing default region size of %lu sectors", - region_size); - } else { -diff --git a/drivers/md/md.c b/drivers/md/md.c -index 37ff00d014b4..7c45286e2662 100644 ---- a/drivers/md/md.c -+++ b/drivers/md/md.c -@@ -5306,6 +5306,8 @@ EXPORT_SYMBOL_GPL(md_stop_writes); - static void __md_stop(struct mddev *mddev) - { - mddev->ready = 0; -+ /* Ensure ->event_work is done */ -+ flush_workqueue(md_misc_wq); - mddev->pers->stop(mddev); - if (mddev->pers->sync_request && mddev->to_remove == NULL) - mddev->to_remove = &md_redundancy_group; -diff --git a/drivers/md/persistent-data/dm-btree-internal.h b/drivers/md/persistent-data/dm-btree-internal.h -index bf2b80d5c470..8731b6ea026b 100644 ---- a/drivers/md/persistent-data/dm-btree-internal.h -+++ b/drivers/md/persistent-data/dm-btree-internal.h -@@ -138,4 +138,10 @@ int lower_bound(struct btree_node *n, uint64_t key); - - extern struct dm_block_validator btree_node_validator; - -+/* -+ * Value type for upper levels of multi-level btrees. -+ */ -+extern void init_le64_type(struct dm_transaction_manager *tm, -+ struct dm_btree_value_type *vt); -+ - #endif /* DM_BTREE_INTERNAL_H */ -diff --git a/drivers/md/persistent-data/dm-btree-remove.c b/drivers/md/persistent-data/dm-btree-remove.c -index a03178e91a79..7c0d75547ccf 100644 ---- a/drivers/md/persistent-data/dm-btree-remove.c -+++ b/drivers/md/persistent-data/dm-btree-remove.c -@@ -544,14 +544,6 @@ static int remove_raw(struct shadow_spine *s, struct dm_btree_info *info, - return r; - } - --static struct dm_btree_value_type le64_type = { -- .context = NULL, -- .size = sizeof(__le64), -- .inc = NULL, -- .dec = NULL, -- .equal = NULL --}; -- - int dm_btree_remove(struct dm_btree_info *info, dm_block_t root, - uint64_t *keys, dm_block_t *new_root) - { -@@ -559,12 +551,14 @@ int dm_btree_remove(struct dm_btree_info *info, dm_block_t root, - int index = 0, r = 0; - struct shadow_spine spine; - struct btree_node *n; -+ struct dm_btree_value_type le64_vt; - -+ init_le64_type(info->tm, &le64_vt); - init_shadow_spine(&spine, info); - for (level = 0; level < info->levels; level++) { - r = remove_raw(&spine, info, - (level == last_level ? -- &info->value_type : &le64_type), -+ &info->value_type : &le64_vt), - root, keys[level], (unsigned *)&index); - if (r < 0) - break; -diff --git a/drivers/md/persistent-data/dm-btree-spine.c b/drivers/md/persistent-data/dm-btree-spine.c -index 1b5e13ec7f96..0dee514ba4c5 100644 ---- a/drivers/md/persistent-data/dm-btree-spine.c -+++ b/drivers/md/persistent-data/dm-btree-spine.c -@@ -249,3 +249,40 @@ int shadow_root(struct shadow_spine *s) - { - return s->root; - } -+ -+static void le64_inc(void *context, const void *value_le) -+{ -+ struct dm_transaction_manager *tm = context; -+ __le64 v_le; -+ -+ memcpy(&v_le, value_le, sizeof(v_le)); -+ dm_tm_inc(tm, le64_to_cpu(v_le)); -+} -+ -+static void le64_dec(void *context, const void *value_le) -+{ -+ struct dm_transaction_manager *tm = context; -+ __le64 v_le; -+ -+ memcpy(&v_le, value_le, sizeof(v_le)); -+ dm_tm_dec(tm, le64_to_cpu(v_le)); -+} -+ -+static int le64_equal(void *context, const void *value1_le, const void *value2_le) -+{ -+ __le64 v1_le, v2_le; -+ -+ memcpy(&v1_le, value1_le, sizeof(v1_le)); -+ memcpy(&v2_le, value2_le, sizeof(v2_le)); -+ return v1_le == v2_le; -+} -+ -+void init_le64_type(struct dm_transaction_manager *tm, -+ struct dm_btree_value_type *vt) -+{ -+ vt->context = tm; -+ vt->size = sizeof(__le64); -+ vt->inc = le64_inc; -+ vt->dec = le64_dec; -+ vt->equal = le64_equal; -+} -diff --git a/drivers/md/persistent-data/dm-btree.c b/drivers/md/persistent-data/dm-btree.c -index e3ecb0b824b5..79233b051da0 100644 ---- a/drivers/md/persistent-data/dm-btree.c -+++ b/drivers/md/persistent-data/dm-btree.c -@@ -651,12 +651,7 @@ static int insert(struct dm_btree_info *info, dm_block_t root, - struct btree_node *n; - struct dm_btree_value_type le64_type; - -- le64_type.context = NULL; -- le64_type.size = sizeof(__le64); -- le64_type.inc = NULL; -- le64_type.dec = NULL; -- le64_type.equal = NULL; -- -+ init_le64_type(info->tm, &le64_type); - init_shadow_spine(&spine, info); - - for (level = 0; level < (info->levels - 1); level++) { -diff --git a/drivers/mtd/ubi/io.c b/drivers/mtd/ubi/io.c -index bf79def40126..8822e880833b 100644 ---- a/drivers/mtd/ubi/io.c -+++ b/drivers/mtd/ubi/io.c -@@ -931,6 +931,11 @@ static int validate_vid_hdr(const struct ubi_device *ubi, - goto bad; - } - -+ if (data_size > ubi->leb_size) { -+ ubi_err("bad data_size"); -+ goto bad; -+ } -+ - if (vol_type == UBI_VID_STATIC) { - /* - * Although from high-level point of view static volumes may -diff --git a/drivers/mtd/ubi/vtbl.c b/drivers/mtd/ubi/vtbl.c -index d77b1c1d7c72..bebf49e0dbe9 100644 ---- a/drivers/mtd/ubi/vtbl.c -+++ b/drivers/mtd/ubi/vtbl.c -@@ -651,6 +651,7 @@ static int init_volumes(struct ubi_device *ubi, - if (ubi->corr_peb_count) - ubi_err("%d PEBs are corrupted and not used", - ubi->corr_peb_count); -+ return -ENOSPC; - } - ubi->rsvd_pebs += reserved_pebs; - ubi->avail_pebs -= reserved_pebs; -diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c -index c08254016fe8..3375bfb1b246 100644 ---- a/drivers/mtd/ubi/wl.c -+++ b/drivers/mtd/ubi/wl.c -@@ -1978,6 +1978,7 @@ int ubi_wl_init(struct ubi_device *ubi, struct ubi_attach_info *ai) - if (ubi->corr_peb_count) - ubi_err("%d PEBs are corrupted and not used", - ubi->corr_peb_count); -+ err = -ENOSPC; - goto out_free; - } - ubi->avail_pebs -= reserved_pebs; -diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c -index 6b5baf01512d..c0ed7c802819 100644 ---- a/drivers/net/bonding/bond_main.c -+++ b/drivers/net/bonding/bond_main.c -@@ -876,6 +876,23 @@ static void bond_mc_swap(struct bonding *bond, struct slave *new_active, - } - } - -+static struct slave *bond_get_old_active(struct bonding *bond, -+ struct slave *new_active) -+{ -+ struct slave *slave; -+ int i; -+ -+ bond_for_each_slave(bond, slave, i) { -+ if (slave == new_active) -+ continue; -+ -+ if (ether_addr_equal(bond->dev->dev_addr, slave->dev->dev_addr)) -+ return slave; -+ } -+ -+ return NULL; -+} -+ - /* - * bond_do_fail_over_mac - * -@@ -919,6 +936,9 @@ static void bond_do_fail_over_mac(struct bonding *bond, - write_unlock_bh(&bond->curr_slave_lock); - read_unlock(&bond->lock); - -+ if (!old_active) -+ old_active = bond_get_old_active(bond, new_active); -+ - if (old_active) { - memcpy(tmp_mac, new_active->dev->dev_addr, ETH_ALEN); - memcpy(saddr.sa_data, old_active->dev->dev_addr, -diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c -index 5f57e3d35e26..6adf9abdf955 100644 ---- a/drivers/scsi/3w-9xxx.c -+++ b/drivers/scsi/3w-9xxx.c -@@ -225,6 +225,17 @@ static const struct file_operations twa_fops = { - .llseek = noop_llseek, - }; - -+/* -+ * The controllers use an inline buffer instead of a mapped SGL for small, -+ * single entry buffers. Note that we treat a zero-length transfer like -+ * a mapped SGL. -+ */ -+static bool twa_command_mapped(struct scsi_cmnd *cmd) -+{ -+ return scsi_sg_count(cmd) != 1 || -+ scsi_bufflen(cmd) >= TW_MIN_SGL_LENGTH; -+} -+ - /* This function will complete an aen request from the isr */ - static int twa_aen_complete(TW_Device_Extension *tw_dev, int request_id) - { -@@ -1351,7 +1362,8 @@ static irqreturn_t twa_interrupt(int irq, void *dev_instance) - } - - /* Now complete the io */ -- scsi_dma_unmap(cmd); -+ if (twa_command_mapped(cmd)) -+ scsi_dma_unmap(cmd); - cmd->scsi_done(cmd); - tw_dev->state[request_id] = TW_S_COMPLETED; - twa_free_request_id(tw_dev, request_id); -@@ -1594,7 +1606,8 @@ static int twa_reset_device_extension(TW_Device_Extension *tw_dev) - struct scsi_cmnd *cmd = tw_dev->srb[i]; - - cmd->result = (DID_RESET << 16); -- scsi_dma_unmap(cmd); -+ if (twa_command_mapped(cmd)) -+ scsi_dma_unmap(cmd); - cmd->scsi_done(cmd); - } - } -@@ -1777,12 +1790,14 @@ static int twa_scsi_queue_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_ - retval = twa_scsiop_execute_scsi(tw_dev, request_id, NULL, 0, NULL); - switch (retval) { - case SCSI_MLQUEUE_HOST_BUSY: -- scsi_dma_unmap(SCpnt); -+ if (twa_command_mapped(SCpnt)) -+ scsi_dma_unmap(SCpnt); - twa_free_request_id(tw_dev, request_id); - break; - case 1: - SCpnt->result = (DID_ERROR << 16); -- scsi_dma_unmap(SCpnt); -+ if (twa_command_mapped(SCpnt)) -+ scsi_dma_unmap(SCpnt); - done(SCpnt); - tw_dev->state[request_id] = TW_S_COMPLETED; - twa_free_request_id(tw_dev, request_id); -@@ -1843,8 +1858,7 @@ static int twa_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id, - /* Map sglist from scsi layer to cmd packet */ - - if (scsi_sg_count(srb)) { -- if ((scsi_sg_count(srb) == 1) && -- (scsi_bufflen(srb) < TW_MIN_SGL_LENGTH)) { -+ if (!twa_command_mapped(srb)) { - if (srb->sc_data_direction == DMA_TO_DEVICE || - srb->sc_data_direction == DMA_BIDIRECTIONAL) - scsi_sg_copy_to_buffer(srb, -@@ -1917,7 +1931,7 @@ static void twa_scsiop_execute_scsi_complete(TW_Device_Extension *tw_dev, int re - { - struct scsi_cmnd *cmd = tw_dev->srb[request_id]; - -- if (scsi_bufflen(cmd) < TW_MIN_SGL_LENGTH && -+ if (!twa_command_mapped(cmd) && - (cmd->sc_data_direction == DMA_FROM_DEVICE || - cmd->sc_data_direction == DMA_BIDIRECTIONAL)) { - if (scsi_sg_count(cmd) == 1) { -diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c -index 3668b1b23b5a..9acbc885239b 100644 ---- a/drivers/scsi/scsi_error.c -+++ b/drivers/scsi/scsi_error.c -@@ -1849,8 +1849,17 @@ int scsi_error_handler(void *data) - * We never actually get interrupted because kthread_run - * disables signal delivery for the created thread. - */ -- while (!kthread_should_stop()) { -+ while (true) { -+ /* -+ * The sequence in kthread_stop() sets the stop flag first -+ * then wakes the process. To avoid missed wakeups, the task -+ * should always be in a non running state before the stop -+ * flag is checked -+ */ - set_current_state(TASK_INTERRUPTIBLE); -+ if (kthread_should_stop()) -+ break; -+ - if ((shost->host_failed == 0 && shost->host_eh_scheduled == 0) || - shost->host_failed != shost->host_busy) { - SCSI_LOG_ERROR_RECOVERY(1, -diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c -index cc42ee5e19fb..787cfbaa7755 100644 ---- a/drivers/spi/spi-pxa2xx.c -+++ b/drivers/spi/spi-pxa2xx.c -@@ -546,6 +546,10 @@ static irqreturn_t ssp_int(int irq, void *dev_id) - if (!(sccr1_reg & SSCR1_TIE)) - mask &= ~SSSR_TFS; - -+ /* Ignore RX timeout interrupt if it is disabled */ -+ if (!(sccr1_reg & SSCR1_TINTE)) -+ mask &= ~SSSR_TINT; -+ - if (!(status & mask)) - return IRQ_NONE; - -diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c -index 32b7bb111eb6..7c159634aaae 100644 ---- a/drivers/spi/spi.c -+++ b/drivers/spi/spi.c -@@ -1030,8 +1030,7 @@ static struct class spi_master_class = { - * - * The caller is responsible for assigning the bus number and initializing - * the master's methods before calling spi_register_master(); and (after errors -- * adding the device) calling spi_master_put() and kfree() to prevent a memory -- * leak. -+ * adding the device) calling spi_master_put() to prevent a memory leak. - */ - struct spi_master *spi_alloc_master(struct device *dev, unsigned size) - { -diff --git a/drivers/staging/comedi/drivers/adl_pci7x3x.c b/drivers/staging/comedi/drivers/adl_pci7x3x.c -index e3960745f506..49cb69206896 100644 ---- a/drivers/staging/comedi/drivers/adl_pci7x3x.c -+++ b/drivers/staging/comedi/drivers/adl_pci7x3x.c -@@ -119,10 +119,21 @@ static int adl_pci7x3x_do_insn_bits(struct comedi_device *dev, - unsigned int bits = data[1]; - - if (mask) { -+ unsigned int val; -+ - s->state &= ~mask; - s->state |= (bits & mask); -- -- outl(s->state, dev->iobase + reg); -+ val = s->state; -+ if (s->n_chan == 16) { -+ /* -+ * It seems the PCI-7230 needs the 16-bit DO state -+ * to be shifted left by 16 bits before being written -+ * to the 32-bit register. Set the value in both -+ * halves of the register to be sure. -+ */ -+ val |= val << 16; -+ } -+ outl(val, dev->iobase + reg); - } - - /* -diff --git a/drivers/staging/speakup/fakekey.c b/drivers/staging/speakup/fakekey.c -index 4299cf45f947..5e1f16c36b49 100644 ---- a/drivers/staging/speakup/fakekey.c -+++ b/drivers/staging/speakup/fakekey.c -@@ -81,6 +81,7 @@ void speakup_fake_down_arrow(void) - __this_cpu_write(reporting_keystroke, true); - input_report_key(virt_keyboard, KEY_DOWN, PRESSED); - input_report_key(virt_keyboard, KEY_DOWN, RELEASED); -+ input_sync(virt_keyboard); - __this_cpu_write(reporting_keystroke, false); - - /* reenable preemption */ -diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c -index 652438325197..85756bd36746 100644 ---- a/drivers/usb/core/config.c -+++ b/drivers/usb/core/config.c -@@ -114,7 +114,7 @@ static void usb_parse_ss_endpoint_companion(struct device *ddev, int cfgno, - cfgno, inum, asnum, ep->desc.bEndpointAddress); - ep->ss_ep_comp.bmAttributes = 16; - } else if (usb_endpoint_xfer_isoc(&ep->desc) && -- desc->bmAttributes > 2) { -+ USB_SS_MULT(desc->bmAttributes) > 3) { - dev_warn(ddev, "Isoc endpoint has Mult of %d in " - "config %d interface %d altsetting %d ep %d: " - "setting to 3\n", desc->bmAttributes + 1, -@@ -123,7 +123,8 @@ static void usb_parse_ss_endpoint_companion(struct device *ddev, int cfgno, - } - - if (usb_endpoint_xfer_isoc(&ep->desc)) -- max_tx = (desc->bMaxBurst + 1) * (desc->bmAttributes + 1) * -+ max_tx = (desc->bMaxBurst + 1) * -+ (USB_SS_MULT(desc->bmAttributes)) * - usb_endpoint_maxp(&ep->desc); - else if (usb_endpoint_xfer_int(&ep->desc)) - max_tx = usb_endpoint_maxp(&ep->desc) * -diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c -index b73f3031a660..d4db4ea4a92d 100644 ---- a/drivers/usb/core/quirks.c -+++ b/drivers/usb/core/quirks.c -@@ -53,6 +53,13 @@ static const struct usb_device_id usb_quirk_list[] = { - { USB_DEVICE(0x046d, 0x082d), .driver_info = USB_QUIRK_DELAY_INIT }, - { USB_DEVICE(0x046d, 0x0843), .driver_info = USB_QUIRK_DELAY_INIT }, - -+ /* Logitech ConferenceCam CC3000e */ -+ { USB_DEVICE(0x046d, 0x0847), .driver_info = USB_QUIRK_DELAY_INIT }, -+ { USB_DEVICE(0x046d, 0x0848), .driver_info = USB_QUIRK_DELAY_INIT }, -+ -+ /* Logitech PTZ Pro Camera */ -+ { USB_DEVICE(0x046d, 0x0853), .driver_info = USB_QUIRK_DELAY_INIT }, -+ - /* Logitech Quickcam Fusion */ - { USB_DEVICE(0x046d, 0x08c1), .driver_info = USB_QUIRK_RESET_RESUME }, - -@@ -77,6 +84,12 @@ static const struct usb_device_id usb_quirk_list[] = { - /* Philips PSC805 audio device */ - { USB_DEVICE(0x0471, 0x0155), .driver_info = USB_QUIRK_RESET_RESUME }, - -+ /* Plantronic Audio 655 DSP */ -+ { USB_DEVICE(0x047f, 0xc008), .driver_info = USB_QUIRK_RESET_RESUME }, -+ -+ /* Plantronic Audio 648 USB */ -+ { USB_DEVICE(0x047f, 0xc013), .driver_info = USB_QUIRK_RESET_RESUME }, -+ - /* Artisman Watchdog Dongle */ - { USB_DEVICE(0x04b4, 0x0526), .driver_info = - USB_QUIRK_CONFIG_INTF_STRINGS }, -diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c -index 31bed5f7d0eb..87e82e6b0c38 100644 ---- a/drivers/usb/host/xhci-mem.c -+++ b/drivers/usb/host/xhci-mem.c -@@ -1473,10 +1473,10 @@ int xhci_endpoint_init(struct xhci_hcd *xhci, - * use Event Data TRBs, and we don't chain in a link TRB on short - * transfers, we're basically dividing by 1. - * -- * xHCI 1.0 specification indicates that the Average TRB Length should -- * be set to 8 for control endpoints. -+ * xHCI 1.0 and 1.1 specification indicates that the Average TRB Length -+ * should be set to 8 for control endpoints. - */ -- if (usb_endpoint_xfer_control(&ep->desc) && xhci->hci_version == 0x100) -+ if (usb_endpoint_xfer_control(&ep->desc) && xhci->hci_version >= 0x100) - ep_ctx->tx_info |= cpu_to_le32(AVG_TRB_LENGTH_FOR_EP(8)); - else - ep_ctx->tx_info |= -diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c -index fde0277adc2c..4ba6974dd4b6 100644 ---- a/drivers/usb/host/xhci-ring.c -+++ b/drivers/usb/host/xhci-ring.c -@@ -3167,9 +3167,11 @@ static int queue_bulk_sg_tx(struct xhci_hcd *xhci, gfp_t mem_flags, - struct xhci_td *td; - struct scatterlist *sg; - int num_sgs; -- int trb_buff_len, this_sg_len, running_total; -+ int trb_buff_len, this_sg_len, running_total, ret; - unsigned int total_packet_count; -+ bool zero_length_needed; - bool first_trb; -+ int last_trb_num; - u64 addr; - bool more_trbs_coming; - -@@ -3185,13 +3187,27 @@ static int queue_bulk_sg_tx(struct xhci_hcd *xhci, gfp_t mem_flags, - total_packet_count = DIV_ROUND_UP(urb->transfer_buffer_length, - usb_endpoint_maxp(&urb->ep->desc)); - -- trb_buff_len = prepare_transfer(xhci, xhci->devs[slot_id], -+ ret = prepare_transfer(xhci, xhci->devs[slot_id], - ep_index, urb->stream_id, - num_trbs, urb, 0, mem_flags); -- if (trb_buff_len < 0) -- return trb_buff_len; -+ if (ret < 0) -+ return ret; - - urb_priv = urb->hcpriv; -+ -+ /* Deal with URB_ZERO_PACKET - need one more td/trb */ -+ zero_length_needed = urb->transfer_flags & URB_ZERO_PACKET && -+ urb_priv->length == 2; -+ if (zero_length_needed) { -+ num_trbs++; -+ xhci_dbg(xhci, "Creating zero length td.\n"); -+ ret = prepare_transfer(xhci, xhci->devs[slot_id], -+ ep_index, urb->stream_id, -+ 1, urb, 1, mem_flags); -+ if (ret < 0) -+ return ret; -+ } -+ - td = urb_priv->td[0]; - - /* -@@ -3221,6 +3237,7 @@ static int queue_bulk_sg_tx(struct xhci_hcd *xhci, gfp_t mem_flags, - trb_buff_len = urb->transfer_buffer_length; - - first_trb = true; -+ last_trb_num = zero_length_needed ? 2 : 1; - /* Queue the first TRB, even if it's zero-length */ - do { - u32 field = 0; -@@ -3238,12 +3255,15 @@ static int queue_bulk_sg_tx(struct xhci_hcd *xhci, gfp_t mem_flags, - /* Chain all the TRBs together; clear the chain bit in the last - * TRB to indicate it's the last TRB in the chain. - */ -- if (num_trbs > 1) { -+ if (num_trbs > last_trb_num) { - field |= TRB_CHAIN; -- } else { -- /* FIXME - add check for ZERO_PACKET flag before this */ -+ } else if (num_trbs == last_trb_num) { - td->last_trb = ep_ring->enqueue; - field |= TRB_IOC; -+ } else if (zero_length_needed && num_trbs == 1) { -+ trb_buff_len = 0; -+ urb_priv->td[1]->last_trb = ep_ring->enqueue; -+ field |= TRB_IOC; - } - - /* Only set interrupt on short packet for IN endpoints */ -@@ -3305,7 +3325,7 @@ static int queue_bulk_sg_tx(struct xhci_hcd *xhci, gfp_t mem_flags, - if (running_total + trb_buff_len > urb->transfer_buffer_length) - trb_buff_len = - urb->transfer_buffer_length - running_total; -- } while (running_total < urb->transfer_buffer_length); -+ } while (num_trbs > 0); - - check_trb_math(urb, num_trbs, running_total); - giveback_first_trb(xhci, slot_id, ep_index, urb->stream_id, -@@ -3323,7 +3343,9 @@ int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags, - int num_trbs; - struct xhci_generic_trb *start_trb; - bool first_trb; -+ int last_trb_num; - bool more_trbs_coming; -+ bool zero_length_needed; - int start_cycle; - u32 field, length_field; - -@@ -3354,7 +3376,6 @@ int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags, - num_trbs++; - running_total += TRB_MAX_BUFF_SIZE; - } -- /* FIXME: this doesn't deal with URB_ZERO_PACKET - need one more */ - - ret = prepare_transfer(xhci, xhci->devs[slot_id], - ep_index, urb->stream_id, -@@ -3363,6 +3384,20 @@ int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags, - return ret; - - urb_priv = urb->hcpriv; -+ -+ /* Deal with URB_ZERO_PACKET - need one more td/trb */ -+ zero_length_needed = urb->transfer_flags & URB_ZERO_PACKET && -+ urb_priv->length == 2; -+ if (zero_length_needed) { -+ num_trbs++; -+ xhci_dbg(xhci, "Creating zero length td.\n"); -+ ret = prepare_transfer(xhci, xhci->devs[slot_id], -+ ep_index, urb->stream_id, -+ 1, urb, 1, mem_flags); -+ if (ret < 0) -+ return ret; -+ } -+ - td = urb_priv->td[0]; - - /* -@@ -3384,7 +3419,7 @@ int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags, - trb_buff_len = urb->transfer_buffer_length; - - first_trb = true; -- -+ last_trb_num = zero_length_needed ? 2 : 1; - /* Queue the first TRB, even if it's zero-length */ - do { - u32 remainder = 0; -@@ -3401,12 +3436,15 @@ int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags, - /* Chain all the TRBs together; clear the chain bit in the last - * TRB to indicate it's the last TRB in the chain. - */ -- if (num_trbs > 1) { -+ if (num_trbs > last_trb_num) { - field |= TRB_CHAIN; -- } else { -- /* FIXME - add check for ZERO_PACKET flag before this */ -+ } else if (num_trbs == last_trb_num) { - td->last_trb = ep_ring->enqueue; - field |= TRB_IOC; -+ } else if (zero_length_needed && num_trbs == 1) { -+ trb_buff_len = 0; -+ urb_priv->td[1]->last_trb = ep_ring->enqueue; -+ field |= TRB_IOC; - } - - /* Only set interrupt on short packet for IN endpoints */ -@@ -3444,7 +3482,7 @@ int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags, - trb_buff_len = urb->transfer_buffer_length - running_total; - if (trb_buff_len > TRB_MAX_BUFF_SIZE) - trb_buff_len = TRB_MAX_BUFF_SIZE; -- } while (running_total < urb->transfer_buffer_length); -+ } while (num_trbs > 0); - - check_trb_math(urb, num_trbs, running_total); - giveback_first_trb(xhci, slot_id, ep_index, urb->stream_id, -@@ -3511,8 +3549,8 @@ int xhci_queue_ctrl_tx(struct xhci_hcd *xhci, gfp_t mem_flags, - if (start_cycle == 0) - field |= 0x1; - -- /* xHCI 1.0 6.4.1.2.1: Transfer Type field */ -- if (xhci->hci_version == 0x100) { -+ /* xHCI 1.0/1.1 6.4.1.2.1: Transfer Type field */ -+ if (xhci->hci_version >= 0x100) { - if (urb->transfer_buffer_length > 0) { - if (setup->bRequestType & USB_DIR_IN) - field |= TRB_TX_TYPE(TRB_DATA_IN); -diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c -index 1f901fc25590..a3431e90345f 100644 ---- a/drivers/usb/host/xhci.c -+++ b/drivers/usb/host/xhci.c -@@ -139,7 +139,8 @@ static int xhci_start(struct xhci_hcd *xhci) - "waited %u microseconds.\n", - XHCI_MAX_HALT_USEC); - if (!ret) -- xhci->xhc_state &= ~XHCI_STATE_HALTED; -+ xhci->xhc_state &= ~(XHCI_STATE_HALTED | XHCI_STATE_DYING); -+ - return ret; - } - -@@ -1299,6 +1300,11 @@ int xhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, gfp_t mem_flags) - - if (usb_endpoint_xfer_isoc(&urb->ep->desc)) - size = urb->number_of_packets; -+ else if (usb_endpoint_is_bulk_out(&urb->ep->desc) && -+ urb->transfer_buffer_length > 0 && -+ urb->transfer_flags & URB_ZERO_PACKET && -+ !(urb->transfer_buffer_length % usb_endpoint_maxp(&urb->ep->desc))) -+ size = 2; - else - size = 1; - -diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c -index 096438e4fb0c..c918075e5eae 100644 ---- a/drivers/usb/serial/option.c -+++ b/drivers/usb/serial/option.c -@@ -276,6 +276,10 @@ static void option_instat_callback(struct urb *urb); - #define ZTE_PRODUCT_MF622 0x0001 - #define ZTE_PRODUCT_MF628 0x0015 - #define ZTE_PRODUCT_MF626 0x0031 -+#define ZTE_PRODUCT_ZM8620_X 0x0396 -+#define ZTE_PRODUCT_ME3620_MBIM 0x0426 -+#define ZTE_PRODUCT_ME3620_X 0x1432 -+#define ZTE_PRODUCT_ME3620_L 0x1433 - #define ZTE_PRODUCT_AC2726 0xfff1 - #define ZTE_PRODUCT_CDMA_TECH 0xfffe - #define ZTE_PRODUCT_AC8710T 0xffff -@@ -549,6 +553,18 @@ static const struct option_blacklist_info zte_mc2716_z_blacklist = { - .sendsetup = BIT(1) | BIT(2) | BIT(3), - }; - -+static const struct option_blacklist_info zte_me3620_mbim_blacklist = { -+ .reserved = BIT(2) | BIT(3) | BIT(4), -+}; -+ -+static const struct option_blacklist_info zte_me3620_xl_blacklist = { -+ .reserved = BIT(3) | BIT(4) | BIT(5), -+}; -+ -+static const struct option_blacklist_info zte_zm8620_x_blacklist = { -+ .reserved = BIT(3) | BIT(4) | BIT(5), -+}; -+ - static const struct option_blacklist_info huawei_cdc12_blacklist = { - .reserved = BIT(1) | BIT(2), - }; -@@ -1579,6 +1595,14 @@ static const struct usb_device_id option_ids[] = { - .driver_info = (kernel_ulong_t)&zte_ad3812_z_blacklist }, - { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MC2716, 0xff, 0xff, 0xff), - .driver_info = (kernel_ulong_t)&zte_mc2716_z_blacklist }, -+ { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_ME3620_L), -+ .driver_info = (kernel_ulong_t)&zte_me3620_xl_blacklist }, -+ { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_ME3620_MBIM), -+ .driver_info = (kernel_ulong_t)&zte_me3620_mbim_blacklist }, -+ { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_ME3620_X), -+ .driver_info = (kernel_ulong_t)&zte_me3620_xl_blacklist }, -+ { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_ZM8620_X), -+ .driver_info = (kernel_ulong_t)&zte_zm8620_x_blacklist }, - { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x02, 0x01) }, - { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x02, 0x05) }, - { USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0xff, 0x86, 0x10) }, -diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c -index 5e3dd9f87ff5..ae79c2245a73 100644 ---- a/drivers/usb/serial/whiteheat.c -+++ b/drivers/usb/serial/whiteheat.c -@@ -81,6 +81,8 @@ static int whiteheat_firmware_download(struct usb_serial *serial, - static int whiteheat_firmware_attach(struct usb_serial *serial); - - /* function prototypes for the Connect Tech WhiteHEAT serial converter */ -+static int whiteheat_probe(struct usb_serial *serial, -+ const struct usb_device_id *id); - static int whiteheat_attach(struct usb_serial *serial); - static void whiteheat_release(struct usb_serial *serial); - static int whiteheat_port_probe(struct usb_serial_port *port); -@@ -117,6 +119,7 @@ static struct usb_serial_driver whiteheat_device = { - .description = "Connect Tech - WhiteHEAT", - .id_table = id_table_std, - .num_ports = 4, -+ .probe = whiteheat_probe, - .attach = whiteheat_attach, - .release = whiteheat_release, - .port_probe = whiteheat_port_probe, -@@ -218,6 +221,34 @@ static int whiteheat_firmware_attach(struct usb_serial *serial) - /***************************************************************************** - * Connect Tech's White Heat serial driver functions - *****************************************************************************/ -+ -+static int whiteheat_probe(struct usb_serial *serial, -+ const struct usb_device_id *id) -+{ -+ struct usb_host_interface *iface_desc; -+ struct usb_endpoint_descriptor *endpoint; -+ size_t num_bulk_in = 0; -+ size_t num_bulk_out = 0; -+ size_t min_num_bulk; -+ unsigned int i; -+ -+ iface_desc = serial->interface->cur_altsetting; -+ -+ for (i = 0; i < iface_desc->desc.bNumEndpoints; i++) { -+ endpoint = &iface_desc->endpoint[i].desc; -+ if (usb_endpoint_is_bulk_in(endpoint)) -+ ++num_bulk_in; -+ if (usb_endpoint_is_bulk_out(endpoint)) -+ ++num_bulk_out; -+ } -+ -+ min_num_bulk = COMMAND_PORT + 1; -+ if (num_bulk_in < min_num_bulk || num_bulk_out < min_num_bulk) -+ return -ENODEV; -+ -+ return 0; -+} -+ - static int whiteheat_attach(struct usb_serial *serial) - { - struct usb_serial_port *command_port; -diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c -index d20db6437723..f22beda91ffc 100644 ---- a/fs/btrfs/inode.c -+++ b/fs/btrfs/inode.c -@@ -4650,7 +4650,8 @@ void btrfs_evict_inode(struct inode *inode) - goto no_delete; - } - /* do we really want it for ->i_nlink > 0 and zero btrfs_root_refs? */ -- btrfs_wait_ordered_range(inode, 0, (u64)-1); -+ if (!special_file(inode->i_mode)) -+ btrfs_wait_ordered_range(inode, 0, (u64)-1); - - if (root->fs_info->log_root_recovering) { - BUG_ON(test_bit(BTRFS_INODE_HAS_ORPHAN_ITEM, -diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c -index e12f258a5ffa..66202da4c961 100644 ---- a/fs/cifs/smb2ops.c -+++ b/fs/cifs/smb2ops.c -@@ -48,9 +48,13 @@ change_conf(struct TCP_Server_Info *server) - break; - default: - server->echoes = true; -- server->oplocks = true; -+ if (enable_oplocks) { -+ server->oplocks = true; -+ server->oplock_credits = 1; -+ } else -+ server->oplocks = false; -+ - server->echo_credits = 1; -- server->oplock_credits = 1; - } - server->credits -= server->echo_credits + server->oplock_credits; - return 0; -diff --git a/fs/dcache.c b/fs/dcache.c -index f1e801785976..17222fa5bdc6 100644 ---- a/fs/dcache.c -+++ b/fs/dcache.c -@@ -2534,6 +2534,8 @@ static int prepend_path(const struct path *path, - struct dentry *dentry = path->dentry; - struct vfsmount *vfsmnt = path->mnt; - struct mount *mnt = real_mount(vfsmnt); -+ char *orig_buffer = *buffer; -+ int orig_len = *buflen; - bool slash = false; - int error = 0; - -@@ -2541,6 +2543,14 @@ static int prepend_path(const struct path *path, - struct dentry * parent; - - if (dentry == vfsmnt->mnt_root || IS_ROOT(dentry)) { -+ /* Escaped? */ -+ if (dentry != vfsmnt->mnt_root) { -+ *buffer = orig_buffer; -+ *buflen = orig_len; -+ slash = false; -+ error = 3; -+ goto global_root; -+ } - /* Global root? */ - if (!mnt_has_parent(mnt)) - goto global_root; -diff --git a/fs/namei.c b/fs/namei.c -index 036c21246d6a..157c3dbacf6c 100644 ---- a/fs/namei.c -+++ b/fs/namei.c -@@ -473,6 +473,24 @@ void path_put(const struct path *path) - } - EXPORT_SYMBOL(path_put); - -+/** -+ * path_connected - Verify that a path->dentry is below path->mnt.mnt_root -+ * @path: nameidate to verify -+ * -+ * Rename can sometimes move a file or directory outside of a bind -+ * mount, path_connected allows those cases to be detected. -+ */ -+static bool path_connected(const struct path *path) -+{ -+ struct vfsmount *mnt = path->mnt; -+ -+ /* Only bind mounts can have disconnected paths */ -+ if (mnt->mnt_root == mnt->mnt_sb->s_root) -+ return true; -+ -+ return is_subdir(path->dentry, mnt->mnt_root); -+} -+ - /* - * Path walking has 2 modes, rcu-walk and ref-walk (see - * Documentation/filesystems/path-lookup.txt). In situations when we can't -@@ -1148,6 +1166,8 @@ static int follow_dotdot_rcu(struct nameidata *nd) - goto failed; - nd->path.dentry = parent; - nd->seq = seq; -+ if (unlikely(!path_connected(&nd->path))) -+ goto failed; - break; - } - if (!follow_up_rcu(&nd->path)) -@@ -1231,7 +1251,7 @@ static void follow_mount(struct path *path) - } - } - --static void follow_dotdot(struct nameidata *nd) -+static int follow_dotdot(struct nameidata *nd) - { - set_root(nd); - -@@ -1246,6 +1266,10 @@ static void follow_dotdot(struct nameidata *nd) - /* rare case of legitimate dget_parent()... */ - nd->path.dentry = dget_parent(nd->path.dentry); - dput(old); -+ if (unlikely(!path_connected(&nd->path))) { -+ path_put(&nd->path); -+ return -ENOENT; -+ } - break; - } - if (!follow_up(&nd->path)) -@@ -1253,6 +1277,7 @@ static void follow_dotdot(struct nameidata *nd) - } - follow_mount(&nd->path); - nd->inode = nd->path.dentry->d_inode; -+ return 0; - } - - /* -@@ -1476,7 +1501,7 @@ static inline int handle_dots(struct nameidata *nd, int type) - if (follow_dotdot_rcu(nd)) - return -ECHILD; - } else -- follow_dotdot(nd); -+ return follow_dotdot(nd); - } - return 0; - } -diff --git a/fs/udf/inode.c b/fs/udf/inode.c -index aa023283cc8a..789814f27438 100644 ---- a/fs/udf/inode.c -+++ b/fs/udf/inode.c -@@ -1495,6 +1495,16 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh) - iinfo->i_checkpoint = le32_to_cpu(efe->checkpoint); - } - -+ /* -+ * Sanity check length of allocation descriptors and extended attrs to -+ * avoid integer overflows -+ */ -+ if (iinfo->i_lenEAttr > inode->i_sb->s_blocksize || iinfo->i_lenAlloc > inode->i_sb->s_blocksize) -+ return; -+ /* Now do exact checks */ -+ if (udf_file_entry_alloc_offset(inode) + iinfo->i_lenAlloc > inode->i_sb->s_blocksize) -+ return; -+ - switch (fe->icbTag.fileType) { - case ICBTAG_FILE_TYPE_DIRECTORY: - inode->i_op = &udf_dir_inode_operations; -diff --git a/include/linux/security.h b/include/linux/security.h -index 4686491852a7..4e50307c4c6d 100644 ---- a/include/linux/security.h -+++ b/include/linux/security.h -@@ -2394,7 +2394,7 @@ static inline int security_task_prctl(int option, unsigned long arg2, - unsigned long arg4, - unsigned long arg5) - { -- return cap_task_prctl(option, arg2, arg3, arg3, arg5); -+ return cap_task_prctl(option, arg2, arg3, arg4, arg5); - } - - static inline void security_task_to_inode(struct task_struct *p, struct inode *inode) -diff --git a/include/xen/interface/sched.h b/include/xen/interface/sched.h -index 9ce083960a25..f18490985fc8 100644 ---- a/include/xen/interface/sched.h -+++ b/include/xen/interface/sched.h -@@ -107,5 +107,13 @@ struct sched_watchdog { - #define SHUTDOWN_suspend 2 /* Clean up, save suspend info, kill. */ - #define SHUTDOWN_crash 3 /* Tell controller we've crashed. */ - #define SHUTDOWN_watchdog 4 /* Restart because watchdog time expired. */ -+/* -+ * Domain asked to perform 'soft reset' for it. The expected behavior is to -+ * reset internal Xen state for the domain returning it to the point where it -+ * was created but leaving the domain's memory contents and vCPU contexts -+ * intact. This will allow the domain to start over and set up all Xen specific -+ * interfaces again. -+ */ -+#define SHUTDOWN_soft_reset 5 - - #endif /* __XEN_PUBLIC_SCHED_H__ */ -diff --git a/ipc/msg.c b/ipc/msg.c -index 52770bfde2a5..32aaaab15c5c 100644 ---- a/ipc/msg.c -+++ b/ipc/msg.c -@@ -202,13 +202,6 @@ static int newque(struct ipc_namespace *ns, struct ipc_params *params) - return retval; - } - -- /* ipc_addid() locks msq upon success. */ -- id = ipc_addid(&msg_ids(ns), &msq->q_perm, ns->msg_ctlmni); -- if (id < 0) { -- ipc_rcu_putref(msq, msg_rcu_free); -- return id; -- } -- - msq->q_stime = msq->q_rtime = 0; - msq->q_ctime = get_seconds(); - msq->q_cbytes = msq->q_qnum = 0; -@@ -218,6 +211,13 @@ static int newque(struct ipc_namespace *ns, struct ipc_params *params) - INIT_LIST_HEAD(&msq->q_receivers); - INIT_LIST_HEAD(&msq->q_senders); - -+ /* ipc_addid() locks msq upon success. */ -+ id = ipc_addid(&msg_ids(ns), &msq->q_perm, ns->msg_ctlmni); -+ if (id < 0) { -+ ipc_rcu_putref(msq, msg_rcu_free); -+ return id; -+ } -+ - ipc_unlock_object(&msq->q_perm); - rcu_read_unlock(); - -diff --git a/ipc/shm.c b/ipc/shm.c -index 6dc55af8a29b..08b14f69d6cf 100644 ---- a/ipc/shm.c -+++ b/ipc/shm.c -@@ -544,12 +544,6 @@ static int newseg(struct ipc_namespace *ns, struct ipc_params *params) - if (IS_ERR(file)) - goto no_file; - -- id = ipc_addid(&shm_ids(ns), &shp->shm_perm, ns->shm_ctlmni); -- if (id < 0) { -- error = id; -- goto no_id; -- } -- - shp->shm_cprid = task_tgid_vnr(current); - shp->shm_lprid = 0; - shp->shm_atim = shp->shm_dtim = 0; -@@ -559,6 +553,12 @@ static int newseg(struct ipc_namespace *ns, struct ipc_params *params) - shp->shm_file = file; - shp->shm_creator = current; - -+ id = ipc_addid(&shm_ids(ns), &shp->shm_perm, ns->shm_ctlmni); -+ if (id < 0) { -+ error = id; -+ goto no_id; -+ } -+ - /* - * shmid gets reported as "inode#" in /proc/pid/maps. - * proc-ps tools use this. Changing this will break them. -diff --git a/ipc/util.c b/ipc/util.c -index 7684f41bce76..735342570a87 100644 ---- a/ipc/util.c -+++ b/ipc/util.c -@@ -292,6 +292,10 @@ int ipc_addid(struct ipc_ids* ids, struct kern_ipc_perm* new, int size) - rcu_read_lock(); - spin_lock(&new->lock); - -+ current_euid_egid(&euid, &egid); -+ new->cuid = new->uid = euid; -+ new->gid = new->cgid = egid; -+ - id = idr_alloc(&ids->ipcs_idr, new, - (next_id < 0) ? 0 : ipcid_to_idx(next_id), 0, - GFP_NOWAIT); -@@ -304,10 +308,6 @@ int ipc_addid(struct ipc_ids* ids, struct kern_ipc_perm* new, int size) - - ids->in_use++; - -- current_euid_egid(&euid, &egid); -- new->cuid = new->uid = euid; -- new->gid = new->cgid = egid; -- - if (next_id < 0) { - new->seq = ids->seq++; - if (ids->seq > ids->seq_max) -diff --git a/kernel/irq/proc.c b/kernel/irq/proc.c -index 19ed5c425c3b..349e5bbdb31f 100644 ---- a/kernel/irq/proc.c -+++ b/kernel/irq/proc.c -@@ -12,6 +12,7 @@ - #include - #include - #include -+#include - - #include "internals.h" - -@@ -309,18 +310,29 @@ void register_handler_proc(unsigned int irq, struct irqaction *action) - - void register_irq_proc(unsigned int irq, struct irq_desc *desc) - { -+ static DEFINE_MUTEX(register_lock); - char name [MAX_NAMELEN]; - -- if (!root_irq_dir || (desc->irq_data.chip == &no_irq_chip) || desc->dir) -+ if (!root_irq_dir || (desc->irq_data.chip == &no_irq_chip)) - return; - -+ /* -+ * irq directories are registered only when a handler is -+ * added, not when the descriptor is created, so multiple -+ * tasks might try to register at the same time. -+ */ -+ mutex_lock(®ister_lock); -+ -+ if (desc->dir) -+ goto out_unlock; -+ - memset(name, 0, MAX_NAMELEN); - sprintf(name, "%d", irq); - - /* create /proc/irq/1234 */ - desc->dir = proc_mkdir(name, root_irq_dir); - if (!desc->dir) -- return; -+ goto out_unlock; - - #ifdef CONFIG_SMP - /* create /proc/irq//smp_affinity */ -@@ -341,6 +353,9 @@ void register_irq_proc(unsigned int irq, struct irq_desc *desc) - - proc_create_data("spurious", 0444, desc->dir, - &irq_spurious_proc_fops, (void *)(long)irq); -+ -+out_unlock: -+ mutex_unlock(®ister_lock); - } - - void unregister_irq_proc(unsigned int irq, struct irq_desc *desc) -diff --git a/mm/hugetlb.c b/mm/hugetlb.c -index d9bc87ca062b..e9fd382bf25a 100644 ---- a/mm/hugetlb.c -+++ b/mm/hugetlb.c -@@ -2573,6 +2573,14 @@ static int unmap_ref_private(struct mm_struct *mm, struct vm_area_struct *vma, - continue; - - /* -+ * Shared VMAs have their own reserves and do not affect -+ * MAP_PRIVATE accounting but it is possible that a shared -+ * VMA is using the same page so check and skip such VMAs. -+ */ -+ if (iter_vma->vm_flags & VM_MAYSHARE) -+ continue; -+ -+ /* - * Unmap the page from other VMAs without their own reserves. - * They get marked to be SIGKILLed if they fault in these - * areas. This is because a future no-page fault on this VMA -diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c -index 627e517077e4..84340a2605ed 100644 ---- a/net/core/fib_rules.c -+++ b/net/core/fib_rules.c -@@ -606,7 +606,7 @@ static int dump_rules(struct sk_buff *skb, struct netlink_callback *cb, - err = fib_nl_fill_rule(skb, rule, NETLINK_CB(cb->skb).portid, - cb->nlh->nlmsg_seq, RTM_NEWRULE, - NLM_F_MULTI, ops); -- if (err) -+ if (err < 0) - break; - skip: - idx++; -diff --git a/net/netfilter/ipvs/ip_vs_sync.c b/net/netfilter/ipvs/ip_vs_sync.c -index e476cc7dc801..19f9aa4e698a 100644 ---- a/net/netfilter/ipvs/ip_vs_sync.c -+++ b/net/netfilter/ipvs/ip_vs_sync.c -@@ -599,7 +599,7 @@ static void ip_vs_sync_conn_v0(struct net *net, struct ip_vs_conn *cp, - pkts = atomic_add_return(1, &cp->in_pkts); - else - pkts = sysctl_sync_threshold(ipvs); -- ip_vs_sync_conn(net, cp->control, pkts); -+ ip_vs_sync_conn(net, cp, pkts); - } - } - -diff --git a/net/netfilter/ipvs/ip_vs_xmit.c b/net/netfilter/ipvs/ip_vs_xmit.c -index 1692e7534759..c3d204973dbc 100644 ---- a/net/netfilter/ipvs/ip_vs_xmit.c -+++ b/net/netfilter/ipvs/ip_vs_xmit.c -@@ -129,7 +129,6 @@ static struct rtable *do_output_route4(struct net *net, __be32 daddr, - - memset(&fl4, 0, sizeof(fl4)); - fl4.daddr = daddr; -- fl4.saddr = (rt_mode & IP_VS_RT_MODE_CONNECT) ? *saddr : 0; - fl4.flowi4_flags = (rt_mode & IP_VS_RT_MODE_KNOWN_NH) ? - FLOWI_FLAG_KNOWN_NH : 0; - -diff --git a/net/netfilter/nf_conntrack_expect.c b/net/netfilter/nf_conntrack_expect.c -index c63b618cd619..95578da760d5 100644 ---- a/net/netfilter/nf_conntrack_expect.c -+++ b/net/netfilter/nf_conntrack_expect.c -@@ -202,7 +202,8 @@ static inline int expect_clash(const struct nf_conntrack_expect *a, - a->mask.src.u3.all[count] & b->mask.src.u3.all[count]; - } - -- return nf_ct_tuple_mask_cmp(&a->tuple, &b->tuple, &intersect_mask); -+ return nf_ct_tuple_mask_cmp(&a->tuple, &b->tuple, &intersect_mask) && -+ nf_ct_zone(a->master) == nf_ct_zone(b->master); - } - - static inline int expect_matches(const struct nf_conntrack_expect *a, -diff --git a/sound/arm/Kconfig b/sound/arm/Kconfig -index 885683a3b0bd..e0406211716b 100644 ---- a/sound/arm/Kconfig -+++ b/sound/arm/Kconfig -@@ -9,6 +9,14 @@ menuconfig SND_ARM - Drivers that are implemented on ASoC can be found in - "ALSA for SoC audio support" section. - -+config SND_PXA2XX_LIB -+ tristate -+ select SND_AC97_CODEC if SND_PXA2XX_LIB_AC97 -+ select SND_DMAENGINE_PCM -+ -+config SND_PXA2XX_LIB_AC97 -+ bool -+ - if SND_ARM - - config SND_ARMAACI -@@ -21,13 +29,6 @@ config SND_PXA2XX_PCM - tristate - select SND_PCM - --config SND_PXA2XX_LIB -- tristate -- select SND_AC97_CODEC if SND_PXA2XX_LIB_AC97 -- --config SND_PXA2XX_LIB_AC97 -- bool -- - config SND_PXA2XX_AC97 - tristate "AC97 driver for the Intel PXA2xx chip" - depends on ARCH_PXA -diff --git a/sound/soc/dwc/designware_i2s.c b/sound/soc/dwc/designware_i2s.c -index 489a9abf112b..6a530afbb7e9 100644 ---- a/sound/soc/dwc/designware_i2s.c -+++ b/sound/soc/dwc/designware_i2s.c -@@ -100,10 +100,10 @@ static inline void i2s_clear_irqs(struct dw_i2s_dev *dev, u32 stream) - - if (stream == SNDRV_PCM_STREAM_PLAYBACK) { - for (i = 0; i < 4; i++) -- i2s_write_reg(dev->i2s_base, TOR(i), 0); -+ i2s_read_reg(dev->i2s_base, TOR(i)); - } else { - for (i = 0; i < 4; i++) -- i2s_write_reg(dev->i2s_base, ROR(i), 0); -+ i2s_read_reg(dev->i2s_base, ROR(i)); - } - } - -diff --git a/sound/soc/pxa/Kconfig b/sound/soc/pxa/Kconfig -index 4d2e46fae77c..20a57c0060b2 100644 ---- a/sound/soc/pxa/Kconfig -+++ b/sound/soc/pxa/Kconfig -@@ -1,7 +1,6 @@ - config SND_PXA2XX_SOC - tristate "SoC Audio for the Intel PXA2xx chip" - depends on ARCH_PXA -- select SND_ARM - select SND_PXA2XX_LIB - help - Say Y or M if you want to add support for codecs attached to -@@ -24,7 +23,6 @@ config SND_PXA2XX_AC97 - config SND_PXA2XX_SOC_AC97 - tristate - select AC97_BUS -- select SND_ARM - select SND_PXA2XX_LIB_AC97 - select SND_SOC_AC97_BUS - -diff --git a/sound/synth/emux/emux_oss.c b/sound/synth/emux/emux_oss.c -index daf61abc3670..646b66703bd8 100644 ---- a/sound/synth/emux/emux_oss.c -+++ b/sound/synth/emux/emux_oss.c -@@ -69,7 +69,8 @@ snd_emux_init_seq_oss(struct snd_emux *emu) - struct snd_seq_oss_reg *arg; - struct snd_seq_device *dev; - -- if (snd_seq_device_new(emu->card, 0, SNDRV_SEQ_DEV_ID_OSS, -+ /* using device#1 here for avoiding conflicts with OPL3 */ -+ if (snd_seq_device_new(emu->card, 1, SNDRV_SEQ_DEV_ID_OSS, - sizeof(struct snd_seq_oss_reg), &dev) < 0) - return; - -diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c -index 326068a593a5..bb34199d5451 100644 ---- a/tools/perf/util/header.c -+++ b/tools/perf/util/header.c -@@ -1729,7 +1729,7 @@ static int process_nrcpus(struct perf_file_section *section __maybe_unused, - if (ph->needs_swap) - nr = bswap_32(nr); - -- ph->env.nr_cpus_online = nr; -+ ph->env.nr_cpus_avail = nr; - - ret = readn(fd, &nr, sizeof(nr)); - if (ret != sizeof(nr)) -@@ -1738,7 +1738,7 @@ static int process_nrcpus(struct perf_file_section *section __maybe_unused, - if (ph->needs_swap) - nr = bswap_32(nr); - -- ph->env.nr_cpus_avail = nr; -+ ph->env.nr_cpus_online = nr; - return 0; - } - diff --git a/patch/kernel/marvell-default/1-patch-3.10.91-92.patch b/patch/kernel/marvell-default/1-patch-3.10.91-92.patch deleted file mode 100644 index ac354e3c94..0000000000 --- a/patch/kernel/marvell-default/1-patch-3.10.91-92.patch +++ /dev/null @@ -1,413 +0,0 @@ -diff --git a/Makefile b/Makefile -index ba6a94cf354b..25701b67bb6d 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,6 +1,6 @@ - VERSION = 3 - PATCHLEVEL = 10 --SUBLEVEL = 91 -+SUBLEVEL = 92 - EXTRAVERSION = - NAME = TOSSUG Baby Fish - -diff --git a/arch/m68k/include/asm/uaccess_mm.h b/arch/m68k/include/asm/uaccess_mm.h -index 472c891a4aee..15901db435b9 100644 ---- a/arch/m68k/include/asm/uaccess_mm.h -+++ b/arch/m68k/include/asm/uaccess_mm.h -@@ -90,7 +90,7 @@ asm volatile ("\n" \ - __put_user_asm(__pu_err, __pu_val, ptr, b, d, -EFAULT); \ - break; \ - case 2: \ -- __put_user_asm(__pu_err, __pu_val, ptr, w, d, -EFAULT); \ -+ __put_user_asm(__pu_err, __pu_val, ptr, w, r, -EFAULT); \ - break; \ - case 4: \ - __put_user_asm(__pu_err, __pu_val, ptr, l, r, -EFAULT); \ -@@ -158,7 +158,7 @@ asm volatile ("\n" \ - __get_user_asm(__gu_err, x, ptr, u8, b, d, -EFAULT); \ - break; \ - case 2: \ -- __get_user_asm(__gu_err, x, ptr, u16, w, d, -EFAULT); \ -+ __get_user_asm(__gu_err, x, ptr, u16, w, r, -EFAULT); \ - break; \ - case 4: \ - __get_user_asm(__gu_err, x, ptr, u32, l, r, -EFAULT); \ -@@ -245,7 +245,7 @@ __constant_copy_from_user(void *to, const void __user *from, unsigned long n) - __get_user_asm(res, *(u8 *)to, (u8 __user *)from, u8, b, d, 1); - break; - case 2: -- __get_user_asm(res, *(u16 *)to, (u16 __user *)from, u16, w, d, 2); -+ __get_user_asm(res, *(u16 *)to, (u16 __user *)from, u16, w, r, 2); - break; - case 3: - __constant_copy_from_user_asm(res, to, from, tmp, 3, w, b,); -@@ -326,7 +326,7 @@ __constant_copy_to_user(void __user *to, const void *from, unsigned long n) - __put_user_asm(res, *(u8 *)from, (u8 __user *)to, b, d, 1); - break; - case 2: -- __put_user_asm(res, *(u16 *)from, (u16 __user *)to, w, d, 2); -+ __put_user_asm(res, *(u16 *)from, (u16 __user *)to, w, r, 2); - break; - case 3: - __constant_copy_to_user_asm(res, to, from, tmp, 3, w, b,); -diff --git a/arch/m68k/lib/uaccess.c b/arch/m68k/lib/uaccess.c -index 5e97f2ee7c11..35d1442dee89 100644 ---- a/arch/m68k/lib/uaccess.c -+++ b/arch/m68k/lib/uaccess.c -@@ -52,7 +52,7 @@ unsigned long __generic_copy_from_user(void *to, const void __user *from, - " .long 3b,30b\n" - " .long 5b,50b\n" - " .previous" -- : "=d" (res), "+a" (from), "+a" (to), "=&r" (tmp) -+ : "=d" (res), "+a" (from), "+a" (to), "=&d" (tmp) - : "0" (n / 4), "d" (n & 3)); - - return res; -@@ -96,7 +96,7 @@ unsigned long __generic_copy_to_user(void __user *to, const void *from, - " .long 7b,50b\n" - " .long 8b,50b\n" - " .previous" -- : "=d" (res), "+a" (from), "+a" (to), "=&r" (tmp) -+ : "=d" (res), "+a" (from), "+a" (to), "=&d" (tmp) - : "0" (n / 4), "d" (n & 3)); - - return res; -@@ -141,7 +141,7 @@ unsigned long __clear_user(void __user *to, unsigned long n) - " .long 7b,40b\n" - " .previous" - : "=d" (res), "+a" (to) -- : "r" (0), "0" (n / 4), "d" (n & 3)); -+ : "d" (0), "0" (n / 4), "d" (n & 3)); - - return res; - } -diff --git a/arch/sparc/crypto/aes_glue.c b/arch/sparc/crypto/aes_glue.c -index ded4cee35318..dc78cdd43e0a 100644 ---- a/arch/sparc/crypto/aes_glue.c -+++ b/arch/sparc/crypto/aes_glue.c -@@ -433,6 +433,7 @@ static struct crypto_alg algs[] = { { - .blkcipher = { - .min_keysize = AES_MIN_KEY_SIZE, - .max_keysize = AES_MAX_KEY_SIZE, -+ .ivsize = AES_BLOCK_SIZE, - .setkey = aes_set_key, - .encrypt = cbc_encrypt, - .decrypt = cbc_decrypt, -@@ -452,6 +453,7 @@ static struct crypto_alg algs[] = { { - .blkcipher = { - .min_keysize = AES_MIN_KEY_SIZE, - .max_keysize = AES_MAX_KEY_SIZE, -+ .ivsize = AES_BLOCK_SIZE, - .setkey = aes_set_key, - .encrypt = ctr_crypt, - .decrypt = ctr_crypt, -diff --git a/arch/sparc/crypto/camellia_glue.c b/arch/sparc/crypto/camellia_glue.c -index 641f55cb61c3..eb87d6dd86b1 100644 ---- a/arch/sparc/crypto/camellia_glue.c -+++ b/arch/sparc/crypto/camellia_glue.c -@@ -274,6 +274,7 @@ static struct crypto_alg algs[] = { { - .blkcipher = { - .min_keysize = CAMELLIA_MIN_KEY_SIZE, - .max_keysize = CAMELLIA_MAX_KEY_SIZE, -+ .ivsize = CAMELLIA_BLOCK_SIZE, - .setkey = camellia_set_key, - .encrypt = cbc_encrypt, - .decrypt = cbc_decrypt, -diff --git a/arch/sparc/crypto/des_glue.c b/arch/sparc/crypto/des_glue.c -index d11500972994..1359bfc544e4 100644 ---- a/arch/sparc/crypto/des_glue.c -+++ b/arch/sparc/crypto/des_glue.c -@@ -429,6 +429,7 @@ static struct crypto_alg algs[] = { { - .blkcipher = { - .min_keysize = DES_KEY_SIZE, - .max_keysize = DES_KEY_SIZE, -+ .ivsize = DES_BLOCK_SIZE, - .setkey = des_set_key, - .encrypt = cbc_encrypt, - .decrypt = cbc_decrypt, -@@ -485,6 +486,7 @@ static struct crypto_alg algs[] = { { - .blkcipher = { - .min_keysize = DES3_EDE_KEY_SIZE, - .max_keysize = DES3_EDE_KEY_SIZE, -+ .ivsize = DES3_EDE_BLOCK_SIZE, - .setkey = des3_ede_set_key, - .encrypt = cbc3_encrypt, - .decrypt = cbc3_decrypt, -diff --git a/crypto/ahash.c b/crypto/ahash.c -index 793a27f2493e..857ae2b2a2a2 100644 ---- a/crypto/ahash.c -+++ b/crypto/ahash.c -@@ -462,7 +462,8 @@ static int ahash_prepare_alg(struct ahash_alg *alg) - struct crypto_alg *base = &alg->halg.base; - - if (alg->halg.digestsize > PAGE_SIZE / 8 || -- alg->halg.statesize > PAGE_SIZE / 8) -+ alg->halg.statesize > PAGE_SIZE / 8 || -+ alg->halg.statesize == 0) - return -EINVAL; - - base->cra_type = &crypto_ahash_type; -diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c -index 01677543248d..2fa22c24fa5d 100644 ---- a/drivers/block/rbd.c -+++ b/drivers/block/rbd.c -@@ -4860,7 +4860,6 @@ static int rbd_dev_probe_parent(struct rbd_device *rbd_dev) - out_err: - if (parent) { - rbd_dev_unparent(rbd_dev); -- kfree(rbd_dev->header_name); - rbd_dev_destroy(parent); - } else { - rbd_put_client(rbdc); -diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c -index 8a806f5c40cf..3f2dbd1ce6a3 100644 ---- a/drivers/i2c/busses/i2c-rcar.c -+++ b/drivers/i2c/busses/i2c-rcar.c -@@ -673,15 +673,16 @@ static int rcar_i2c_probe(struct platform_device *pdev) - return ret; - } - -+ pm_runtime_enable(dev); -+ platform_set_drvdata(pdev, priv); -+ - ret = i2c_add_numbered_adapter(adap); - if (ret < 0) { - dev_err(dev, "reg adap failed: %d\n", ret); -+ pm_runtime_disable(dev); - return ret; - } - -- pm_runtime_enable(dev); -- platform_set_drvdata(pdev, priv); -- - dev_info(dev, "probed\n"); - - return 0; -diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c -index 39996ca58ce6..ec56072c6326 100644 ---- a/drivers/md/dm-thin.c -+++ b/drivers/md/dm-thin.c -@@ -2109,7 +2109,7 @@ static int pool_ctr(struct dm_target *ti, unsigned argc, char **argv) - metadata_low_callback, - pool); - if (r) -- goto out_free_pt; -+ goto out_flags_changed; - - pt->callbacks.congested_fn = pool_is_congested; - dm_table_add_target_callbacks(ti->table, &pt->callbacks); -diff --git a/drivers/net/ppp/pppoe.c b/drivers/net/ppp/pppoe.c -index becfa3ef7fdc..eda9f3d87746 100644 ---- a/drivers/net/ppp/pppoe.c -+++ b/drivers/net/ppp/pppoe.c -@@ -313,7 +313,6 @@ static void pppoe_flush_dev(struct net_device *dev) - if (po->pppoe_dev == dev && - sk->sk_state & (PPPOX_CONNECTED | PPPOX_BOUND | PPPOX_ZOMBIE)) { - pppox_unbind_sock(sk); -- sk->sk_state = PPPOX_ZOMBIE; - sk->sk_state_change(sk); - po->pppoe_dev = NULL; - dev_put(dev); -diff --git a/drivers/net/usb/asix_devices.c b/drivers/net/usb/asix_devices.c -index 97b5de7aebdb..05e8bd7b3e0f 100644 ---- a/drivers/net/usb/asix_devices.c -+++ b/drivers/net/usb/asix_devices.c -@@ -466,19 +466,7 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf) - return ret; - } - -- ret = asix_sw_reset(dev, AX_SWRESET_IPPD | AX_SWRESET_PRL); -- if (ret < 0) -- return ret; -- -- msleep(150); -- -- ret = asix_sw_reset(dev, AX_SWRESET_CLEAR); -- if (ret < 0) -- return ret; -- -- msleep(150); -- -- ret = asix_sw_reset(dev, embd_phy ? AX_SWRESET_IPRL : AX_SWRESET_PRTE); -+ ax88772_reset(dev); - - /* Read PHYID register *AFTER* the PHY was reset properly */ - phyid = asix_get_phyid(dev); -@@ -888,7 +876,7 @@ static const struct driver_info ax88772_info = { - .unbind = ax88772_unbind, - .status = asix_status, - .link_reset = ax88772_link_reset, -- .reset = ax88772_reset, -+ .reset = ax88772_link_reset, - .flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_LINK_INTR | FLAG_MULTI_PACKET, - .rx_fixup = asix_rx_fixup_common, - .tx_fixup = asix_tx_fixup, -diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h -index 478120ae34e5..993e34774bb1 100644 ---- a/include/linux/skbuff.h -+++ b/include/linux/skbuff.h -@@ -2363,6 +2363,9 @@ static inline void skb_postpull_rcsum(struct sk_buff *skb, - { - if (skb->ip_summed == CHECKSUM_COMPLETE) - skb->csum = csum_sub(skb->csum, csum_partial(start, len, 0)); -+ else if (skb->ip_summed == CHECKSUM_PARTIAL && -+ skb_checksum_start_offset(skb) < 0) -+ skb->ip_summed = CHECKSUM_NONE; - } - - unsigned char *skb_pull_rcsum(struct sk_buff *skb, unsigned int len); -diff --git a/include/net/af_unix.h b/include/net/af_unix.h -index dbdfd2b0f3b3..e927d3e80b61 100644 ---- a/include/net/af_unix.h -+++ b/include/net/af_unix.h -@@ -63,7 +63,11 @@ struct unix_sock { - #define UNIX_GC_MAYBE_CYCLE 1 - struct socket_wq peer_wq; - }; --#define unix_sk(__sk) ((struct unix_sock *)__sk) -+ -+static inline struct unix_sock *unix_sk(struct sock *sk) -+{ -+ return (struct unix_sock *)sk; -+} - - #define peer_wait peer_wq.wait - -diff --git a/include/net/sock.h b/include/net/sock.h -index c0aad07160ef..95dc0c8a9dac 100644 ---- a/include/net/sock.h -+++ b/include/net/sock.h -@@ -782,6 +782,14 @@ static inline __must_check int sk_add_backlog(struct sock *sk, struct sk_buff *s - if (sk_rcvqueues_full(sk, skb, limit)) - return -ENOBUFS; - -+ /* -+ * If the skb was allocated from pfmemalloc reserves, only -+ * allow SOCK_MEMALLOC sockets to use it as this socket is -+ * helping free memory -+ */ -+ if (skb_pfmemalloc(skb) && !sock_flag(sk, SOCK_MEMALLOC)) -+ return -ENOMEM; -+ - __sk_add_backlog(sk, skb); - sk->sk_backlog.len += skb->truesize; - return 0; -diff --git a/kernel/workqueue.c b/kernel/workqueue.c -index fe7c4b91d2e7..fa927fd5778d 100644 ---- a/kernel/workqueue.c -+++ b/kernel/workqueue.c -@@ -1450,13 +1450,13 @@ static void __queue_delayed_work(int cpu, struct workqueue_struct *wq, - timer_stats_timer_set_start_info(&dwork->timer); - - dwork->wq = wq; -+ /* timer isn't guaranteed to run in this cpu, record earlier */ -+ if (cpu == WORK_CPU_UNBOUND) -+ cpu = raw_smp_processor_id(); - dwork->cpu = cpu; - timer->expires = jiffies + delay; - -- if (unlikely(cpu != WORK_CPU_UNBOUND)) -- add_timer_on(timer, cpu); -- else -- add_timer(timer); -+ add_timer_on(timer, cpu); - } - - /** -diff --git a/net/core/ethtool.c b/net/core/ethtool.c -index ce91766eeca9..213b61255140 100644 ---- a/net/core/ethtool.c -+++ b/net/core/ethtool.c -@@ -1066,7 +1066,7 @@ static int ethtool_get_strings(struct net_device *dev, void __user *useraddr) - - gstrings.len = ret; - -- data = kmalloc(gstrings.len * ETH_GSTRING_LEN, GFP_USER); -+ data = kcalloc(gstrings.len, ETH_GSTRING_LEN, GFP_USER); - if (!data) - return -ENOMEM; - -diff --git a/net/core/skbuff.c b/net/core/skbuff.c -index 6148716884ae..05195b8c8718 100644 ---- a/net/core/skbuff.c -+++ b/net/core/skbuff.c -@@ -2711,11 +2711,12 @@ EXPORT_SYMBOL(skb_append_datato_frags); - */ - unsigned char *skb_pull_rcsum(struct sk_buff *skb, unsigned int len) - { -+ unsigned char *data = skb->data; -+ - BUG_ON(len > skb->len); -- skb->len -= len; -- BUG_ON(skb->len < skb->data_len); -- skb_postpull_rcsum(skb, skb->data, len); -- return skb->data += len; -+ __skb_pull(skb, len); -+ skb_postpull_rcsum(skb, data, len); -+ return skb->data; - } - EXPORT_SYMBOL_GPL(skb_pull_rcsum); - -diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c -index 8c27de2b4d5a..797ff373e486 100644 ---- a/net/l2tp/l2tp_core.c -+++ b/net/l2tp/l2tp_core.c -@@ -1381,7 +1381,7 @@ static void l2tp_tunnel_del_work(struct work_struct *work) - tunnel = container_of(work, struct l2tp_tunnel, del_work); - sk = l2tp_tunnel_sock_lookup(tunnel); - if (!sk) -- return; -+ goto out; - - sock = sk->sk_socket; - -@@ -1402,6 +1402,8 @@ static void l2tp_tunnel_del_work(struct work_struct *work) - } - - l2tp_tunnel_sock_put(sk); -+out: -+ l2tp_tunnel_dec_refcount(tunnel); - } - - /* Create a socket for the tunnel, if one isn't set up by -@@ -1731,8 +1733,13 @@ EXPORT_SYMBOL_GPL(l2tp_tunnel_create); - */ - int l2tp_tunnel_delete(struct l2tp_tunnel *tunnel) - { -+ l2tp_tunnel_inc_refcount(tunnel); - l2tp_tunnel_closeall(tunnel); -- return (false == queue_work(l2tp_wq, &tunnel->del_work)); -+ if (false == queue_work(l2tp_wq, &tunnel->del_work)) { -+ l2tp_tunnel_dec_refcount(tunnel); -+ return 1; -+ } -+ return 0; - } - EXPORT_SYMBOL_GPL(l2tp_tunnel_delete); - -diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c -index 123c16419cbe..825c029bf092 100644 ---- a/net/unix/af_unix.c -+++ b/net/unix/af_unix.c -@@ -2063,8 +2063,20 @@ again: - if (UNIXCB(skb).fp) - siocb->scm->fp = scm_fp_dup(UNIXCB(skb).fp); - -- sk_peek_offset_fwd(sk, chunk); -+ if (skip) { -+ sk_peek_offset_fwd(sk, chunk); -+ skip -= chunk; -+ } -+ -+ if (UNIXCB(skb).fp) -+ break; - -+ last = skb; -+ unix_state_lock(sk); -+ skb = skb_peek_next(skb, &sk->sk_receive_queue); -+ if (skb) -+ goto again; -+ unix_state_unlock(sk); - break; - } - } while (size); diff --git a/patch/kernel/marvell-default/1-patch-3.10.92-93.patch b/patch/kernel/marvell-default/1-patch-3.10.92-93.patch deleted file mode 100644 index b4317e6ab2..0000000000 --- a/patch/kernel/marvell-default/1-patch-3.10.92-93.patch +++ /dev/null @@ -1,645 +0,0 @@ -diff --git a/Makefile b/Makefile -index 25701b67bb6d..6944160a5631 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,6 +1,6 @@ - VERSION = 3 - PATCHLEVEL = 10 --SUBLEVEL = 92 -+SUBLEVEL = 93 - EXTRAVERSION = - NAME = TOSSUG Baby Fish - -diff --git a/arch/arm64/kernel/stacktrace.c b/arch/arm64/kernel/stacktrace.c -index 048334bb2651..d25459ff57fc 100644 ---- a/arch/arm64/kernel/stacktrace.c -+++ b/arch/arm64/kernel/stacktrace.c -@@ -48,11 +48,7 @@ int unwind_frame(struct stackframe *frame) - - frame->sp = fp + 0x10; - frame->fp = *(unsigned long *)(fp); -- /* -- * -4 here because we care about the PC at time of bl, -- * not where the return will go. -- */ -- frame->pc = *(unsigned long *)(fp + 8) - 4; -+ frame->pc = *(unsigned long *)(fp + 8); - - return 0; - } -diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c -index f956a2f84a15..8d3722af6187 100644 ---- a/arch/powerpc/kernel/rtas.c -+++ b/arch/powerpc/kernel/rtas.c -@@ -1041,6 +1041,9 @@ asmlinkage int ppc_rtas(struct rtas_args __user *uargs) - if (!capable(CAP_SYS_ADMIN)) - return -EPERM; - -+ if (!rtas.entry) -+ return -EINVAL; -+ - if (copy_from_user(&args, uargs, 3 * sizeof(u32)) != 0) - return -EFAULT; - -diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c -index 511630db00a8..91cbe75a91d5 100644 ---- a/arch/x86/xen/enlighten.c -+++ b/arch/x86/xen/enlighten.c -@@ -33,7 +33,7 @@ - #include - #include - --#ifdef CONFIG_KEXEC_CORE -+#ifdef CONFIG_KEXEC - #include - #endif - -@@ -1748,7 +1748,7 @@ static struct notifier_block xen_hvm_cpu_notifier __cpuinitdata = { - .notifier_call = xen_hvm_cpu_notify, - }; - --#ifdef CONFIG_KEXEC_CORE -+#ifdef CONFIG_KEXEC - static void xen_hvm_shutdown(void) - { - native_machine_shutdown(); -@@ -1777,7 +1777,7 @@ static void __init xen_hvm_guest_init(void) - x86_init.irqs.intr_init = xen_init_IRQ; - xen_hvm_init_time_ops(); - xen_hvm_init_mmu_ops(); --#ifdef CONFIG_KEXEC_CORE -+#ifdef CONFIG_KEXEC - machine_ops.shutdown = xen_hvm_shutdown; - machine_ops.crash_shutdown = xen_hvm_crash_shutdown; - #endif -diff --git a/crypto/ablkcipher.c b/crypto/ablkcipher.c -index 7d4a8d28277e..ebcec7439a1a 100644 ---- a/crypto/ablkcipher.c -+++ b/crypto/ablkcipher.c -@@ -700,7 +700,7 @@ struct crypto_ablkcipher *crypto_alloc_ablkcipher(const char *alg_name, - err: - if (err != -EAGAIN) - break; -- if (signal_pending(current)) { -+ if (fatal_signal_pending(current)) { - err = -EINTR; - break; - } -diff --git a/crypto/algapi.c b/crypto/algapi.c -index 00d8d939733b..daf2f653b131 100644 ---- a/crypto/algapi.c -+++ b/crypto/algapi.c -@@ -325,7 +325,7 @@ static void crypto_wait_for_test(struct crypto_larval *larval) - crypto_alg_tested(larval->alg.cra_driver_name, 0); - } - -- err = wait_for_completion_interruptible(&larval->completion); -+ err = wait_for_completion_killable(&larval->completion); - WARN_ON(err); - - out: -diff --git a/crypto/api.c b/crypto/api.c -index 335abea14f19..36a0d4602eba 100644 ---- a/crypto/api.c -+++ b/crypto/api.c -@@ -172,7 +172,7 @@ static struct crypto_alg *crypto_larval_wait(struct crypto_alg *alg) - struct crypto_larval *larval = (void *)alg; - long timeout; - -- timeout = wait_for_completion_interruptible_timeout( -+ timeout = wait_for_completion_killable_timeout( - &larval->completion, 60 * HZ); - - alg = larval->adult; -@@ -435,7 +435,7 @@ struct crypto_tfm *crypto_alloc_base(const char *alg_name, u32 type, u32 mask) - err: - if (err != -EAGAIN) - break; -- if (signal_pending(current)) { -+ if (fatal_signal_pending(current)) { - err = -EINTR; - break; - } -@@ -552,7 +552,7 @@ void *crypto_alloc_tfm(const char *alg_name, - err: - if (err != -EAGAIN) - break; -- if (signal_pending(current)) { -+ if (fatal_signal_pending(current)) { - err = -EINTR; - break; - } -diff --git a/crypto/crypto_user.c b/crypto/crypto_user.c -index 43665d0d0905..c7666f401381 100644 ---- a/crypto/crypto_user.c -+++ b/crypto/crypto_user.c -@@ -361,7 +361,7 @@ static struct crypto_alg *crypto_user_aead_alg(const char *name, u32 type, - err = PTR_ERR(alg); - if (err != -EAGAIN) - break; -- if (signal_pending(current)) { -+ if (fatal_signal_pending(current)) { - err = -EINTR; - break; - } -diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c -index 2fa22c24fa5d..85b31ba9d503 100644 ---- a/drivers/block/rbd.c -+++ b/drivers/block/rbd.c -@@ -93,6 +93,8 @@ static int atomic_dec_return_safe(atomic_t *v) - - #define RBD_MINORS_PER_MAJOR 256 /* max minors per blkdev */ - -+#define RBD_MAX_PARENT_CHAIN_LEN 16 -+ - #define RBD_SNAP_DEV_NAME_PREFIX "snap_" - #define RBD_MAX_SNAP_NAME_LEN \ - (NAME_MAX - (sizeof (RBD_SNAP_DEV_NAME_PREFIX) - 1)) -@@ -394,7 +396,7 @@ static ssize_t rbd_add(struct bus_type *bus, const char *buf, - size_t count); - static ssize_t rbd_remove(struct bus_type *bus, const char *buf, - size_t count); --static int rbd_dev_image_probe(struct rbd_device *rbd_dev, bool mapping); -+static int rbd_dev_image_probe(struct rbd_device *rbd_dev, int depth); - static void rbd_spec_put(struct rbd_spec *spec); - - static struct bus_attribute rbd_bus_attrs[] = { -@@ -3453,6 +3455,9 @@ static int rbd_init_disk(struct rbd_device *rbd_dev) - blk_queue_io_opt(q, segment_size); - - blk_queue_merge_bvec(q, rbd_merge_bvec); -+ if (!ceph_test_opt(rbd_dev->rbd_client->client, NOCRC)) -+ q->backing_dev_info.capabilities |= BDI_CAP_STABLE_WRITES; -+ - disk->queue = q; - - q->queuedata = rbd_dev; -@@ -4828,44 +4833,50 @@ out_err: - return ret; - } - --static int rbd_dev_probe_parent(struct rbd_device *rbd_dev) -+/* -+ * @depth is rbd_dev_image_probe() -> rbd_dev_probe_parent() -> -+ * rbd_dev_image_probe() recursion depth, which means it's also the -+ * length of the already discovered part of the parent chain. -+ */ -+static int rbd_dev_probe_parent(struct rbd_device *rbd_dev, int depth) - { - struct rbd_device *parent = NULL; -- struct rbd_spec *parent_spec; -- struct rbd_client *rbdc; - int ret; - - if (!rbd_dev->parent_spec) - return 0; -- /* -- * We need to pass a reference to the client and the parent -- * spec when creating the parent rbd_dev. Images related by -- * parent/child relationships always share both. -- */ -- parent_spec = rbd_spec_get(rbd_dev->parent_spec); -- rbdc = __rbd_get_client(rbd_dev->rbd_client); - -- ret = -ENOMEM; -- parent = rbd_dev_create(rbdc, parent_spec); -- if (!parent) -+ if (++depth > RBD_MAX_PARENT_CHAIN_LEN) { -+ pr_info("parent chain is too long (%d)\n", depth); -+ ret = -EINVAL; - goto out_err; -+ } - -- ret = rbd_dev_image_probe(parent, false); -+ parent = rbd_dev_create(rbd_dev->rbd_client, rbd_dev->parent_spec); -+ if (!parent) { -+ ret = -ENOMEM; -+ goto out_err; -+ } -+ -+ /* -+ * Images related by parent/child relationships always share -+ * rbd_client and spec/parent_spec, so bump their refcounts. -+ */ -+ __rbd_get_client(rbd_dev->rbd_client); -+ rbd_spec_get(rbd_dev->parent_spec); -+ -+ ret = rbd_dev_image_probe(parent, depth); - if (ret < 0) - goto out_err; -+ - rbd_dev->parent = parent; - atomic_set(&rbd_dev->parent_ref, 1); -- - return 0; -+ - out_err: -- if (parent) { -- rbd_dev_unparent(rbd_dev); -+ rbd_dev_unparent(rbd_dev); -+ if (parent) - rbd_dev_destroy(parent); -- } else { -- rbd_put_client(rbdc); -- rbd_spec_put(parent_spec); -- } -- - return ret; - } - -@@ -4971,7 +4982,7 @@ static void rbd_dev_image_release(struct rbd_device *rbd_dev) - * parent), initiate a watch on its header object before using that - * object to get detailed information about the rbd image. - */ --static int rbd_dev_image_probe(struct rbd_device *rbd_dev, bool mapping) -+static int rbd_dev_image_probe(struct rbd_device *rbd_dev, int depth) - { - int ret; - int tmp; -@@ -4992,7 +5003,7 @@ static int rbd_dev_image_probe(struct rbd_device *rbd_dev, bool mapping) - if (ret) - goto err_out_format; - -- if (mapping) { -+ if (!depth) { - ret = rbd_dev_header_watch_sync(rbd_dev, true); - if (ret) - goto out_header_name; -@@ -5009,7 +5020,7 @@ static int rbd_dev_image_probe(struct rbd_device *rbd_dev, bool mapping) - if (ret) - goto err_out_probe; - -- ret = rbd_dev_probe_parent(rbd_dev); -+ ret = rbd_dev_probe_parent(rbd_dev, depth); - if (ret) - goto err_out_probe; - -@@ -5020,7 +5031,7 @@ static int rbd_dev_image_probe(struct rbd_device *rbd_dev, bool mapping) - err_out_probe: - rbd_dev_unprobe(rbd_dev); - err_out_watch: -- if (mapping) { -+ if (!depth) { - tmp = rbd_dev_header_watch_sync(rbd_dev, false); - if (tmp) - rbd_warn(rbd_dev, "unable to tear down " -@@ -5091,7 +5102,7 @@ static ssize_t rbd_add(struct bus_type *bus, - rbdc = NULL; /* rbd_dev now owns this */ - spec = NULL; /* rbd_dev now owns this */ - -- rc = rbd_dev_image_probe(rbd_dev, true); -+ rc = rbd_dev_image_probe(rbd_dev, 0); - if (rc < 0) - goto err_out_rbd_dev; - -diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c -index ddd9a098bc67..ea7ed8600a7c 100644 ---- a/drivers/block/xen-blkfront.c -+++ b/drivers/block/xen-blkfront.c -@@ -1590,7 +1590,8 @@ static void blkback_changed(struct xenbus_device *dev, - break; - /* Missed the backend's Closing state -- fallthrough */ - case XenbusStateClosing: -- blkfront_closing(info); -+ if (info) -+ blkfront_closing(info); - break; - } - } -diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c -index 5bccf31cc974..4d41739fb50a 100644 ---- a/drivers/gpu/drm/nouveau/nouveau_gem.c -+++ b/drivers/gpu/drm/nouveau/nouveau_gem.c -@@ -177,11 +177,12 @@ nouveau_gem_info(struct drm_file *file_priv, struct drm_gem_object *gem, - struct nouveau_bo *nvbo = nouveau_gem_object(gem); - struct nouveau_vma *vma; - -- if (nvbo->bo.mem.mem_type == TTM_PL_TT) -+ if (is_power_of_2(nvbo->valid_domains)) -+ rep->domain = nvbo->valid_domains; -+ else if (nvbo->bo.mem.mem_type == TTM_PL_TT) - rep->domain = NOUVEAU_GEM_DOMAIN_GART; - else - rep->domain = NOUVEAU_GEM_DOMAIN_VRAM; -- - rep->offset = nvbo->bo.offset; - if (cli->base.vm) { - vma = nouveau_bo_vma_find(nvbo, cli->base.vm); -diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c -index 784b97cb05b0..c410217fbe89 100644 ---- a/drivers/infiniband/core/cm.c -+++ b/drivers/infiniband/core/cm.c -@@ -857,6 +857,11 @@ retest: - case IB_CM_SIDR_REQ_RCVD: - spin_unlock_irq(&cm_id_priv->lock); - cm_reject_sidr_req(cm_id_priv, IB_SIDR_REJECT); -+ spin_lock_irq(&cm.lock); -+ if (!RB_EMPTY_NODE(&cm_id_priv->sidr_id_node)) -+ rb_erase(&cm_id_priv->sidr_id_node, -+ &cm.remote_sidr_table); -+ spin_unlock_irq(&cm.lock); - break; - case IB_CM_REQ_SENT: - ib_cancel_mad(cm_id_priv->av.port->mad_agent, cm_id_priv->msg); -@@ -3093,7 +3098,10 @@ int ib_send_cm_sidr_rep(struct ib_cm_id *cm_id, - spin_unlock_irqrestore(&cm_id_priv->lock, flags); - - spin_lock_irqsave(&cm.lock, flags); -- rb_erase(&cm_id_priv->sidr_id_node, &cm.remote_sidr_table); -+ if (!RB_EMPTY_NODE(&cm_id_priv->sidr_id_node)) { -+ rb_erase(&cm_id_priv->sidr_id_node, &cm.remote_sidr_table); -+ RB_CLEAR_NODE(&cm_id_priv->sidr_id_node); -+ } - spin_unlock_irqrestore(&cm.lock, flags); - return 0; - -diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c -index dfb401cba733..6bde2a124c72 100644 ---- a/drivers/iommu/amd_iommu.c -+++ b/drivers/iommu/amd_iommu.c -@@ -2106,8 +2106,8 @@ static void set_dte_entry(u16 devid, struct protection_domain *domain, bool ats) - static void clear_dte_entry(u16 devid) - { - /* remove entry from the device table seen by the hardware */ -- amd_iommu_dev_table[devid].data[0] = IOMMU_PTE_P | IOMMU_PTE_TV; -- amd_iommu_dev_table[devid].data[1] = 0; -+ amd_iommu_dev_table[devid].data[0] = IOMMU_PTE_P | IOMMU_PTE_TV; -+ amd_iommu_dev_table[devid].data[1] &= DTE_FLAG_MASK; - - amd_iommu_apply_erratum_63(devid); - } -diff --git a/drivers/iommu/amd_iommu_types.h b/drivers/iommu/amd_iommu_types.h -index 0285a215df16..7570f45fce8d 100644 ---- a/drivers/iommu/amd_iommu_types.h -+++ b/drivers/iommu/amd_iommu_types.h -@@ -282,6 +282,7 @@ - #define IOMMU_PTE_IR (1ULL << 61) - #define IOMMU_PTE_IW (1ULL << 62) - -+#define DTE_FLAG_MASK (0x3ffULL << 32) - #define DTE_FLAG_IOTLB (0x01UL << 32) - #define DTE_FLAG_GV (0x01ULL << 55) - #define DTE_GLX_SHIFT (56) -diff --git a/drivers/md/persistent-data/dm-btree-remove.c b/drivers/md/persistent-data/dm-btree-remove.c -index 7c0d75547ccf..92cd09f3c69b 100644 ---- a/drivers/md/persistent-data/dm-btree-remove.c -+++ b/drivers/md/persistent-data/dm-btree-remove.c -@@ -301,11 +301,16 @@ static void redistribute3(struct dm_btree_info *info, struct btree_node *parent, - { - int s; - uint32_t max_entries = le32_to_cpu(left->header.max_entries); -- unsigned target = (nr_left + nr_center + nr_right) / 3; -- BUG_ON(target > max_entries); -+ unsigned total = nr_left + nr_center + nr_right; -+ unsigned target_right = total / 3; -+ unsigned remainder = (target_right * 3) != total; -+ unsigned target_left = target_right + remainder; -+ -+ BUG_ON(target_left > max_entries); -+ BUG_ON(target_right > max_entries); - - if (nr_left < nr_right) { -- s = nr_left - target; -+ s = nr_left - target_left; - - if (s < 0 && nr_center < -s) { - /* not enough in central node */ -@@ -316,10 +321,10 @@ static void redistribute3(struct dm_btree_info *info, struct btree_node *parent, - } else - shift(left, center, s); - -- shift(center, right, target - nr_right); -+ shift(center, right, target_right - nr_right); - - } else { -- s = target - nr_right; -+ s = target_right - nr_right; - if (s > 0 && nr_center < s) { - /* not enough in central node */ - shift(center, right, nr_center); -@@ -329,7 +334,7 @@ static void redistribute3(struct dm_btree_info *info, struct btree_node *parent, - } else - shift(center, right, s); - -- shift(left, center, nr_left - target); -+ shift(left, center, nr_left - target_left); - } - - *key_ptr(parent, c->index) = center->keys[0]; -diff --git a/drivers/md/persistent-data/dm-btree.c b/drivers/md/persistent-data/dm-btree.c -index 79233b051da0..b53669404cb5 100644 ---- a/drivers/md/persistent-data/dm-btree.c -+++ b/drivers/md/persistent-data/dm-btree.c -@@ -507,7 +507,7 @@ static int btree_split_beneath(struct shadow_spine *s, uint64_t key) - - r = new_block(s->info, &right); - if (r < 0) { -- /* FIXME: put left */ -+ unlock_block(s->info, left); - return r; - } - -diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c -index 72141ee60705..63d42ae56a1c 100644 ---- a/drivers/md/raid1.c -+++ b/drivers/md/raid1.c -@@ -2147,7 +2147,7 @@ static int narrow_write_error(struct r1bio *r1_bio, int i) - md_trim_bio(wbio, sector - r1_bio->sector, sectors); - wbio->bi_sector += rdev->data_offset; - wbio->bi_bdev = rdev->bdev; -- if (submit_bio_wait(WRITE, wbio) == 0) -+ if (submit_bio_wait(WRITE, wbio) < 0) - /* failure! */ - ok = rdev_set_badblocks(rdev, sector, - sectors, 0) -diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c -index 5b2a1eaea34d..f53f4f895502 100644 ---- a/drivers/md/raid10.c -+++ b/drivers/md/raid10.c -@@ -2597,7 +2597,7 @@ static int narrow_write_error(struct r10bio *r10_bio, int i) - choose_data_offset(r10_bio, rdev) + - (sector - r10_bio->sector)); - wbio->bi_bdev = rdev->bdev; -- if (submit_bio_wait(WRITE, wbio) == 0) -+ if (submit_bio_wait(WRITE, wbio) < 0) - /* Failure! */ - ok = rdev_set_badblocks(rdev, sector, - sectors, 0) -diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c -index bd126c25a727..3f37e464a599 100644 ---- a/drivers/net/wireless/ath/ath9k/init.c -+++ b/drivers/net/wireless/ath/ath9k/init.c -@@ -819,6 +819,7 @@ void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw) - hw->max_rate_tries = 10; - hw->sta_data_size = sizeof(struct ath_node); - hw->vif_data_size = sizeof(struct ath_vif); -+ hw->extra_tx_headroom = 4; - - hw->wiphy->available_antennas_rx = BIT(ah->caps.max_rxchains) - 1; - hw->wiphy->available_antennas_tx = BIT(ah->caps.max_txchains) - 1; -diff --git a/drivers/net/wireless/iwlwifi/dvm/lib.c b/drivers/net/wireless/iwlwifi/dvm/lib.c -index 54f553380aa8..54308dfde13d 100644 ---- a/drivers/net/wireless/iwlwifi/dvm/lib.c -+++ b/drivers/net/wireless/iwlwifi/dvm/lib.c -@@ -1023,7 +1023,7 @@ static void iwlagn_wowlan_program_keys(struct ieee80211_hw *hw, - u8 *pn = seq.ccmp.pn; - - ieee80211_get_key_rx_seq(key, i, &seq); -- aes_sc->pn = cpu_to_le64( -+ aes_sc[i].pn = cpu_to_le64( - (u64)pn[5] | - ((u64)pn[4] << 8) | - ((u64)pn[3] << 16) | -diff --git a/drivers/net/wireless/iwlwifi/mvm/d3.c b/drivers/net/wireless/iwlwifi/mvm/d3.c -index 16bbdcc8627a..2e95b419a109 100644 ---- a/drivers/net/wireless/iwlwifi/mvm/d3.c -+++ b/drivers/net/wireless/iwlwifi/mvm/d3.c -@@ -295,12 +295,12 @@ static void iwl_mvm_wowlan_program_keys(struct ieee80211_hw *hw, - u8 *pn = seq.ccmp.pn; - - ieee80211_get_key_rx_seq(key, i, &seq); -- aes_sc->pn = cpu_to_le64((u64)pn[5] | -- ((u64)pn[4] << 8) | -- ((u64)pn[3] << 16) | -- ((u64)pn[2] << 24) | -- ((u64)pn[1] << 32) | -- ((u64)pn[0] << 40)); -+ aes_sc[i].pn = cpu_to_le64((u64)pn[5] | -+ ((u64)pn[4] << 8) | -+ ((u64)pn[3] << 16) | -+ ((u64)pn[2] << 24) | -+ ((u64)pn[1] << 32) | -+ ((u64)pn[0] << 40)); - } - data->use_rsc_tsc = true; - break; -diff --git a/drivers/scsi/mvsas/mv_sas.c b/drivers/scsi/mvsas/mv_sas.c -index fa50c7dc3d3e..2da1959ff2f6 100644 ---- a/drivers/scsi/mvsas/mv_sas.c -+++ b/drivers/scsi/mvsas/mv_sas.c -@@ -987,6 +987,8 @@ static void mvs_slot_free(struct mvs_info *mvi, u32 rx_desc) - static void mvs_slot_task_free(struct mvs_info *mvi, struct sas_task *task, - struct mvs_slot_info *slot, u32 slot_idx) - { -+ if (!slot) -+ return; - if (!slot->task) - return; - if (!sas_protocol_ata(task->task_proto)) -diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c -index 4ba6974dd4b6..98e3b20c6058 100644 ---- a/drivers/usb/host/xhci-ring.c -+++ b/drivers/usb/host/xhci-ring.c -@@ -2348,6 +2348,7 @@ static int handle_tx_event(struct xhci_hcd *xhci, - u32 trb_comp_code; - int ret = 0; - int td_num = 0; -+ bool handling_skipped_tds = false; - - slot_id = TRB_TO_SLOT_ID(le32_to_cpu(event->flags)); - xdev = xhci->devs[slot_id]; -@@ -2481,6 +2482,10 @@ static int handle_tx_event(struct xhci_hcd *xhci, - ep->skip = true; - xhci_dbg(xhci, "Miss service interval error, set skip flag\n"); - goto cleanup; -+ case COMP_PING_ERR: -+ ep->skip = true; -+ xhci_dbg(xhci, "No Ping response error, Skip one Isoc TD\n"); -+ goto cleanup; - default: - if (xhci_is_vendor_info_code(xhci, trb_comp_code)) { - status = 0; -@@ -2612,13 +2617,18 @@ static int handle_tx_event(struct xhci_hcd *xhci, - ep, &status); - - cleanup: -+ -+ -+ handling_skipped_tds = ep->skip && -+ trb_comp_code != COMP_MISSED_INT && -+ trb_comp_code != COMP_PING_ERR; -+ - /* -- * Do not update event ring dequeue pointer if ep->skip is set. -- * Will roll back to continue process missed tds. -+ * Do not update event ring dequeue pointer if we're in a loop -+ * processing missed tds. - */ -- if (trb_comp_code == COMP_MISSED_INT || !ep->skip) { -+ if (!handling_skipped_tds) - inc_deq(xhci, xhci->event_ring); -- } - - if (ret) { - urb = td->urb; -@@ -2662,7 +2672,7 @@ cleanup: - * Process them as short transfer until reach the td pointed by - * the event. - */ -- } while (ep->skip && trb_comp_code != COMP_MISSED_INT); -+ } while (handling_skipped_tds); - - return 0; - } -diff --git a/include/sound/wm8904.h b/include/sound/wm8904.h -index 898be3a8db9a..6d8f8fba3341 100644 ---- a/include/sound/wm8904.h -+++ b/include/sound/wm8904.h -@@ -119,7 +119,7 @@ - #define WM8904_MIC_REGS 2 - #define WM8904_GPIO_REGS 4 - #define WM8904_DRC_REGS 4 --#define WM8904_EQ_REGS 25 -+#define WM8904_EQ_REGS 24 - - /** - * DRC configurations are specified with a label and a set of register -diff --git a/kernel/module.c b/kernel/module.c -index 61fb677211cb..fd2afdf48a89 100644 ---- a/kernel/module.c -+++ b/kernel/module.c -@@ -942,11 +942,15 @@ void symbol_put_addr(void *addr) - if (core_kernel_text(a)) - return; - -- /* module_text_address is safe here: we're supposed to have reference -- * to module from symbol_get, so it can't go away. */ -+ /* -+ * Even though we hold a reference on the module; we still need to -+ * disable preemption in order to safely traverse the data structure. -+ */ -+ preempt_disable(); - modaddr = __module_text_address(a); - BUG_ON(!modaddr); - module_put(modaddr); -+ preempt_enable(); - } - EXPORT_SYMBOL_GPL(symbol_put_addr); - -diff --git a/mm/filemap.c b/mm/filemap.c -index 7905fe721aa8..725a10043244 100644 ---- a/mm/filemap.c -+++ b/mm/filemap.c -@@ -2340,6 +2340,11 @@ again: - break; - } - -+ if (fatal_signal_pending(current)) { -+ status = -EINTR; -+ break; -+ } -+ - status = a_ops->write_begin(file, mapping, pos, bytes, flags, - &page, &fsdata); - if (unlikely(status)) -@@ -2380,10 +2385,6 @@ again: - written += copied; - - balance_dirty_pages_ratelimited(mapping); -- if (fatal_signal_pending(current)) { -- status = -EINTR; -- break; -- } - } while (iov_iter_count(i)); - - return written ? written : status; diff --git a/patch/kernel/marvell-default/1-patch-3.10.93-94.patch b/patch/kernel/marvell-default/1-patch-3.10.93-94.patch deleted file mode 100644 index cd9c4a977e..0000000000 --- a/patch/kernel/marvell-default/1-patch-3.10.93-94.patch +++ /dev/null @@ -1,724 +0,0 @@ -diff --git a/Makefile b/Makefile -index 6944160a5631..f73ae0748cbc 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,6 +1,6 @@ - VERSION = 3 - PATCHLEVEL = 10 --SUBLEVEL = 93 -+SUBLEVEL = 94 - EXTRAVERSION = - NAME = TOSSUG Baby Fish - -diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c -index 8ca636cf8618..1a00c33a5b7e 100644 ---- a/arch/arm/mm/dma-mapping.c -+++ b/arch/arm/mm/dma-mapping.c -@@ -1355,12 +1355,19 @@ static int arm_iommu_mmap_attrs(struct device *dev, struct vm_area_struct *vma, - unsigned long uaddr = vma->vm_start; - unsigned long usize = vma->vm_end - vma->vm_start; - struct page **pages = __iommu_get_pages(cpu_addr, attrs); -+ unsigned long nr_pages = PAGE_ALIGN(size) >> PAGE_SHIFT; -+ unsigned long off = vma->vm_pgoff; - - vma->vm_page_prot = __get_dma_pgprot(attrs, vma->vm_page_prot); - - if (!pages) - return -ENXIO; - -+ if (off >= nr_pages || (usize >> PAGE_SHIFT) > nr_pages - off) -+ return -ENXIO; -+ -+ pages += off; -+ - do { - int ret = vm_insert_page(vma, uaddr, *pages++); - if (ret) { -diff --git a/arch/arm/plat-orion/common.c b/arch/arm/plat-orion/common.c -index c019b7aaf776..553e00a432ec 100644 ---- a/arch/arm/plat-orion/common.c -+++ b/arch/arm/plat-orion/common.c -@@ -498,7 +498,7 @@ void __init orion_ge00_switch_init(struct dsa_platform_data *d, int irq) - - d->netdev = &orion_ge00.dev; - for (i = 0; i < d->nr_chips; i++) -- d->chip[i].mii_bus = &orion_ge00_shared.dev; -+ d->chip[i].mii_bus = &orion_ge_mvmdio.dev; - orion_switch_device.dev.platform_data = d; - - platform_device_register(&orion_switch_device); -diff --git a/arch/arm64/include/asm/ptrace.h b/arch/arm64/include/asm/ptrace.h -index 41a71ee4c3df..7257c364eb99 100644 ---- a/arch/arm64/include/asm/ptrace.h -+++ b/arch/arm64/include/asm/ptrace.h -@@ -70,14 +70,14 @@ - #define compat_sp regs[13] - #define compat_lr regs[14] - #define compat_sp_hyp regs[15] --#define compat_sp_irq regs[16] --#define compat_lr_irq regs[17] --#define compat_sp_svc regs[18] --#define compat_lr_svc regs[19] --#define compat_sp_abt regs[20] --#define compat_lr_abt regs[21] --#define compat_sp_und regs[22] --#define compat_lr_und regs[23] -+#define compat_lr_irq regs[16] -+#define compat_sp_irq regs[17] -+#define compat_lr_svc regs[18] -+#define compat_sp_svc regs[19] -+#define compat_lr_abt regs[20] -+#define compat_sp_abt regs[21] -+#define compat_lr_und regs[22] -+#define compat_sp_und regs[23] - #define compat_r8_fiq regs[24] - #define compat_r9_fiq regs[25] - #define compat_r10_fiq regs[26] -diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c -index 564140155c36..81e0fe48b9b0 100644 ---- a/arch/x86/kernel/cpu/common.c -+++ b/arch/x86/kernel/cpu/common.c -@@ -280,10 +280,9 @@ __setup("nosmap", setup_disable_smap); - - static __always_inline void setup_smap(struct cpuinfo_x86 *c) - { -- unsigned long eflags; -+ unsigned long eflags = native_save_fl(); - - /* This should have been cleared long ago */ -- raw_local_save_flags(eflags); - BUG_ON(eflags & X86_EFLAGS_AC); - - if (cpu_has(c, X86_FEATURE_SMAP)) { -diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S -index f2a9a2aa98f3..3280489905a8 100644 ---- a/arch/x86/kernel/head_64.S -+++ b/arch/x86/kernel/head_64.S -@@ -65,6 +65,9 @@ startup_64: - * tables and then reload them. - */ - -+ /* Sanitize CPU configuration */ -+ call verify_cpu -+ - /* - * Compute the delta between the address I am compiled to run at and the - * address I am actually running at. -@@ -174,6 +177,9 @@ ENTRY(secondary_startup_64) - * after the boot processor executes this code. - */ - -+ /* Sanitize CPU configuration */ -+ call verify_cpu -+ - movq $(init_level4_pgt - __START_KERNEL_map), %rax - 1: - -@@ -288,6 +294,8 @@ ENTRY(secondary_startup_64) - pushq %rax # target address in negative space - lretq - -+#include "verify_cpu.S" -+ - #ifdef CONFIG_HOTPLUG_CPU - /* - * Boot CPU0 entry point. It's called from play_dead(). Everything has been set -diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c -index 91964c663f0d..935aff397fcc 100644 ---- a/arch/x86/kernel/setup.c -+++ b/arch/x86/kernel/setup.c -@@ -1156,6 +1156,14 @@ void __init setup_arch(char **cmdline_p) - clone_pgd_range(initial_page_table + KERNEL_PGD_BOUNDARY, - swapper_pg_dir + KERNEL_PGD_BOUNDARY, - KERNEL_PGD_PTRS); -+ -+ /* -+ * sync back low identity map too. It is used for example -+ * in the 32-bit EFI stub. -+ */ -+ clone_pgd_range(initial_page_table, -+ swapper_pg_dir + KERNEL_PGD_BOUNDARY, -+ min(KERNEL_PGD_PTRS, KERNEL_PGD_BOUNDARY)); - #endif - - tboot_probe(); -diff --git a/arch/x86/kernel/verify_cpu.S b/arch/x86/kernel/verify_cpu.S -index b9242bacbe59..4cf401f581e7 100644 ---- a/arch/x86/kernel/verify_cpu.S -+++ b/arch/x86/kernel/verify_cpu.S -@@ -34,10 +34,11 @@ - #include - - verify_cpu: -- pushfl # Save caller passed flags -- pushl $0 # Kill any dangerous flags -- popfl -+ pushf # Save caller passed flags -+ push $0 # Kill any dangerous flags -+ popf - -+#ifndef __x86_64__ - pushfl # standard way to check for cpuid - popl %eax - movl %eax,%ebx -@@ -48,6 +49,7 @@ verify_cpu: - popl %eax - cmpl %eax,%ebx - jz verify_cpu_no_longmode # cpu has no cpuid -+#endif - - movl $0x0,%eax # See if cpuid 1 is implemented - cpuid -@@ -130,10 +132,10 @@ verify_cpu_sse_test: - jmp verify_cpu_sse_test # try again - - verify_cpu_no_longmode: -- popfl # Restore caller passed flags -+ popf # Restore caller passed flags - movl $1,%eax - ret - verify_cpu_sse_ok: -- popfl # Restore caller passed flags -+ popf # Restore caller passed flags - xorl %eax, %eax - ret -diff --git a/drivers/net/can/sja1000/sja1000.c b/drivers/net/can/sja1000/sja1000.c -index f17c3018b7c7..c2d0559115d3 100644 ---- a/drivers/net/can/sja1000/sja1000.c -+++ b/drivers/net/can/sja1000/sja1000.c -@@ -184,6 +184,9 @@ static void sja1000_start(struct net_device *dev) - priv->write_reg(priv, SJA1000_RXERR, 0x0); - priv->read_reg(priv, SJA1000_ECC); - -+ /* clear interrupt flags */ -+ priv->read_reg(priv, SJA1000_IR); -+ - /* leave reset mode */ - set_normal_mode(dev); - } -diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c -index 8b6c9237eda4..d5643c143bb8 100644 ---- a/drivers/net/ethernet/marvell/mvneta.c -+++ b/drivers/net/ethernet/marvell/mvneta.c -@@ -910,7 +910,7 @@ static void mvneta_defaults_set(struct mvneta_port *pp) - /* Set CPU queue access map - all CPUs have access to all RX - * queues and to all TX queues - */ -- for (cpu = 0; cpu < CONFIG_NR_CPUS; cpu++) -+ for_each_present_cpu(cpu) - mvreg_write(pp, MVNETA_CPU_MAP(cpu), - (MVNETA_CPU_RXQ_ACCESS_ALL_MASK | - MVNETA_CPU_TXQ_ACCESS_ALL_MASK)); -diff --git a/drivers/net/ethernet/mellanox/mlx4/cmd.c b/drivers/net/ethernet/mellanox/mlx4/cmd.c -index 28d706bd12eb..d64050fcafc3 100644 ---- a/drivers/net/ethernet/mellanox/mlx4/cmd.c -+++ b/drivers/net/ethernet/mellanox/mlx4/cmd.c -@@ -1836,7 +1836,7 @@ int mlx4_multi_func_init(struct mlx4_dev *dev) - spin_lock_init(&s_state->lock); - } - -- memset(&priv->mfunc.master.cmd_eqe, 0, dev->caps.eqe_size); -+ memset(&priv->mfunc.master.cmd_eqe, 0, sizeof(struct mlx4_eqe)); - priv->mfunc.master.cmd_eqe.type = MLX4_EVENT_TYPE_CMD; - INIT_WORK(&priv->mfunc.master.comm_work, - mlx4_master_comm_channel); -diff --git a/drivers/net/ethernet/mellanox/mlx4/eq.c b/drivers/net/ethernet/mellanox/mlx4/eq.c -index 6000342f9725..16a1ccc269f1 100644 ---- a/drivers/net/ethernet/mellanox/mlx4/eq.c -+++ b/drivers/net/ethernet/mellanox/mlx4/eq.c -@@ -183,7 +183,7 @@ static void slave_event(struct mlx4_dev *dev, u8 slave, struct mlx4_eqe *eqe) - return; - } - -- memcpy(s_eqe, eqe, dev->caps.eqe_size - 1); -+ memcpy(s_eqe, eqe, sizeof(struct mlx4_eqe) - 1); - s_eqe->slave_id = slave; - /* ensure all information is written before setting the ownersip bit */ - wmb(); -diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c -index c5f9cb85c8ef..ff08be535a4d 100644 ---- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c -+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c -@@ -731,10 +731,13 @@ static int stmmac_get_ts_info(struct net_device *dev, - { - struct stmmac_priv *priv = netdev_priv(dev); - -- if ((priv->hwts_tx_en) && (priv->hwts_rx_en)) { -+ if ((priv->dma_cap.time_stamp || priv->dma_cap.atime_stamp)) { - -- info->so_timestamping = SOF_TIMESTAMPING_TX_HARDWARE | -+ info->so_timestamping = SOF_TIMESTAMPING_TX_SOFTWARE | -+ SOF_TIMESTAMPING_TX_HARDWARE | -+ SOF_TIMESTAMPING_RX_SOFTWARE | - SOF_TIMESTAMPING_RX_HARDWARE | -+ SOF_TIMESTAMPING_SOFTWARE | - SOF_TIMESTAMPING_RAW_HARDWARE; - - if (priv->ptp_clock) -diff --git a/drivers/net/ppp/pppoe.c b/drivers/net/ppp/pppoe.c -index eda9f3d87746..2840cf608312 100644 ---- a/drivers/net/ppp/pppoe.c -+++ b/drivers/net/ppp/pppoe.c -@@ -569,7 +569,7 @@ static int pppoe_release(struct socket *sock) - - po = pppox_sk(sk); - -- if (sk->sk_state & (PPPOX_CONNECTED | PPPOX_BOUND | PPPOX_ZOMBIE)) { -+ if (po->pppoe_dev) { - dev_put(po->pppoe_dev); - po->pppoe_dev = NULL; - } -diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c -index 2835bfe151b1..b5d11529a39b 100644 ---- a/drivers/net/virtio_net.c -+++ b/drivers/net/virtio_net.c -@@ -1545,9 +1545,9 @@ static int virtnet_probe(struct virtio_device *vdev) - /* Do we support "hardware" checksums? */ - if (virtio_has_feature(vdev, VIRTIO_NET_F_CSUM)) { - /* This opens up the world of extra features. */ -- dev->hw_features |= NETIF_F_HW_CSUM|NETIF_F_SG|NETIF_F_FRAGLIST; -+ dev->hw_features |= NETIF_F_HW_CSUM | NETIF_F_SG; - if (csum) -- dev->features |= NETIF_F_HW_CSUM|NETIF_F_SG|NETIF_F_FRAGLIST; -+ dev->features |= NETIF_F_HW_CSUM | NETIF_F_SG; - - if (virtio_has_feature(vdev, VIRTIO_NET_F_GSO)) { - dev->hw_features |= NETIF_F_TSO | NETIF_F_UFO -diff --git a/drivers/net/wireless/mwifiex/debugfs.c b/drivers/net/wireless/mwifiex/debugfs.c -index a5f9875cfd6e..f84e5d7e8bbe 100644 ---- a/drivers/net/wireless/mwifiex/debugfs.c -+++ b/drivers/net/wireless/mwifiex/debugfs.c -@@ -637,7 +637,7 @@ mwifiex_rdeeprom_read(struct file *file, char __user *ubuf, - (struct mwifiex_private *) file->private_data; - unsigned long addr = get_zeroed_page(GFP_KERNEL); - char *buf = (char *) addr; -- int pos = 0, ret = 0, i; -+ int pos, ret, i; - u8 value[MAX_EEPROM_DATA]; - - if (!buf) -@@ -645,7 +645,7 @@ mwifiex_rdeeprom_read(struct file *file, char __user *ubuf, - - if (saved_offset == -1) { - /* No command has been given */ -- pos += snprintf(buf, PAGE_SIZE, "0"); -+ pos = snprintf(buf, PAGE_SIZE, "0"); - goto done; - } - -@@ -654,17 +654,17 @@ mwifiex_rdeeprom_read(struct file *file, char __user *ubuf, - (u16) saved_bytes, value); - if (ret) { - ret = -EINVAL; -- goto done; -+ goto out_free; - } - -- pos += snprintf(buf, PAGE_SIZE, "%d %d ", saved_offset, saved_bytes); -+ pos = snprintf(buf, PAGE_SIZE, "%d %d ", saved_offset, saved_bytes); - - for (i = 0; i < saved_bytes; i++) -- pos += snprintf(buf + strlen(buf), PAGE_SIZE, "%d ", value[i]); -- -- ret = simple_read_from_buffer(ubuf, count, ppos, buf, pos); -+ pos += scnprintf(buf + pos, PAGE_SIZE - pos, "%d ", value[i]); - - done: -+ ret = simple_read_from_buffer(ubuf, count, ppos, buf, pos); -+out_free: - free_page(addr); - return ret; - } -diff --git a/drivers/staging/rtl8712/usb_intf.c b/drivers/staging/rtl8712/usb_intf.c -index e3a005da776b..1d9ab22d9a25 100644 ---- a/drivers/staging/rtl8712/usb_intf.c -+++ b/drivers/staging/rtl8712/usb_intf.c -@@ -144,6 +144,7 @@ static struct usb_device_id rtl871x_usb_id_tbl[] = { - {USB_DEVICE(0x0DF6, 0x0058)}, - {USB_DEVICE(0x0DF6, 0x0049)}, - {USB_DEVICE(0x0DF6, 0x004C)}, -+ {USB_DEVICE(0x0DF6, 0x006C)}, - {USB_DEVICE(0x0DF6, 0x0064)}, - /* Skyworth */ - {USB_DEVICE(0x14b2, 0x3300)}, -diff --git a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c -index d4c47d5d7625..7ac5fac8600b 100644 ---- a/drivers/usb/class/usblp.c -+++ b/drivers/usb/class/usblp.c -@@ -870,11 +870,11 @@ static int usblp_wwait(struct usblp *usblp, int nonblock) - - add_wait_queue(&usblp->wwait, &waita); - for (;;) { -- set_current_state(TASK_INTERRUPTIBLE); - if (mutex_lock_interruptible(&usblp->mut)) { - rc = -EINTR; - break; - } -+ set_current_state(TASK_INTERRUPTIBLE); - rc = usblp_wtest(usblp, nonblock); - mutex_unlock(&usblp->mut); - if (rc <= 0) -diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c -index da0caf3f4b27..462a7d57c095 100644 ---- a/drivers/usb/musb/musb_core.c -+++ b/drivers/usb/musb/musb_core.c -@@ -133,7 +133,7 @@ static inline struct musb *dev_to_musb(struct device *dev) - /*-------------------------------------------------------------------------*/ - - #ifndef CONFIG_BLACKFIN --static int musb_ulpi_read(struct usb_phy *phy, u32 offset) -+static int musb_ulpi_read(struct usb_phy *phy, u32 reg) - { - void __iomem *addr = phy->io_priv; - int i = 0; -@@ -152,7 +152,7 @@ static int musb_ulpi_read(struct usb_phy *phy, u32 offset) - * ULPICarKitControlDisableUTMI after clearing POWER_SUSPENDM. - */ - -- musb_writeb(addr, MUSB_ULPI_REG_ADDR, (u8)offset); -+ musb_writeb(addr, MUSB_ULPI_REG_ADDR, (u8)reg); - musb_writeb(addr, MUSB_ULPI_REG_CONTROL, - MUSB_ULPI_REG_REQ | MUSB_ULPI_RDN_WR); - -@@ -177,7 +177,7 @@ out: - return ret; - } - --static int musb_ulpi_write(struct usb_phy *phy, u32 offset, u32 data) -+static int musb_ulpi_write(struct usb_phy *phy, u32 val, u32 reg) - { - void __iomem *addr = phy->io_priv; - int i = 0; -@@ -192,8 +192,8 @@ static int musb_ulpi_write(struct usb_phy *phy, u32 offset, u32 data) - power &= ~MUSB_POWER_SUSPENDM; - musb_writeb(addr, MUSB_POWER, power); - -- musb_writeb(addr, MUSB_ULPI_REG_ADDR, (u8)offset); -- musb_writeb(addr, MUSB_ULPI_REG_DATA, (u8)data); -+ musb_writeb(addr, MUSB_ULPI_REG_ADDR, (u8)reg); -+ musb_writeb(addr, MUSB_ULPI_REG_DATA, (u8)val); - musb_writeb(addr, MUSB_ULPI_REG_CONTROL, MUSB_ULPI_REG_REQ); - - while (!(musb_readb(addr, MUSB_ULPI_REG_CONTROL) -diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c -index c918075e5eae..bdbe642e6569 100644 ---- a/drivers/usb/serial/option.c -+++ b/drivers/usb/serial/option.c -@@ -162,6 +162,7 @@ static void option_instat_callback(struct urb *urb); - #define NOVATELWIRELESS_PRODUCT_HSPA_EMBEDDED_HIGHSPEED 0x9001 - #define NOVATELWIRELESS_PRODUCT_E362 0x9010 - #define NOVATELWIRELESS_PRODUCT_E371 0x9011 -+#define NOVATELWIRELESS_PRODUCT_U620L 0x9022 - #define NOVATELWIRELESS_PRODUCT_G2 0xA010 - #define NOVATELWIRELESS_PRODUCT_MC551 0xB001 - -@@ -354,6 +355,7 @@ static void option_instat_callback(struct urb *urb); - /* This is the 4G XS Stick W14 a.k.a. Mobilcom Debitel Surf-Stick * - * It seems to contain a Qualcomm QSC6240/6290 chipset */ - #define FOUR_G_SYSTEMS_PRODUCT_W14 0x9603 -+#define FOUR_G_SYSTEMS_PRODUCT_W100 0x9b01 - - /* iBall 3.5G connect wireless modem */ - #define IBALL_3_5G_CONNECT 0x9605 -@@ -527,6 +529,11 @@ static const struct option_blacklist_info four_g_w14_blacklist = { - .sendsetup = BIT(0) | BIT(1), - }; - -+static const struct option_blacklist_info four_g_w100_blacklist = { -+ .sendsetup = BIT(1) | BIT(2), -+ .reserved = BIT(3), -+}; -+ - static const struct option_blacklist_info alcatel_x200_blacklist = { - .sendsetup = BIT(0) | BIT(1), - .reserved = BIT(4), -@@ -1060,6 +1067,7 @@ static const struct usb_device_id option_ids[] = { - { USB_DEVICE_AND_INTERFACE_INFO(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_MC551, 0xff, 0xff, 0xff) }, - { USB_DEVICE_AND_INTERFACE_INFO(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_E362, 0xff, 0xff, 0xff) }, - { USB_DEVICE_AND_INTERFACE_INFO(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_E371, 0xff, 0xff, 0xff) }, -+ { USB_DEVICE_AND_INTERFACE_INFO(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_U620L, 0xff, 0x00, 0x00) }, - - { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H01) }, - { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H01A) }, -@@ -1641,6 +1649,9 @@ static const struct usb_device_id option_ids[] = { - { USB_DEVICE(LONGCHEER_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_W14), - .driver_info = (kernel_ulong_t)&four_g_w14_blacklist - }, -+ { USB_DEVICE(LONGCHEER_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_W100), -+ .driver_info = (kernel_ulong_t)&four_g_w100_blacklist -+ }, - { USB_DEVICE_INTERFACE_CLASS(LONGCHEER_VENDOR_ID, SPEEDUP_PRODUCT_SU9800, 0xff) }, - { USB_DEVICE(LONGCHEER_VENDOR_ID, ZOOM_PRODUCT_4597) }, - { USB_DEVICE(LONGCHEER_VENDOR_ID, IBALL_3_5G_CONNECT) }, -diff --git a/include/net/inet_common.h b/include/net/inet_common.h -index 234008782c8c..102fc42c7fb1 100644 ---- a/include/net/inet_common.h -+++ b/include/net/inet_common.h -@@ -40,7 +40,8 @@ extern int inet_ctl_sock_create(struct sock **sk, unsigned short family, - - static inline void inet_ctl_sock_destroy(struct sock *sk) - { -- sk_release_kernel(sk); -+ if (sk) -+ sk_release_kernel(sk); - } - - #endif -diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c -index de030f50f72b..c60563394cd1 100644 ---- a/net/bluetooth/hidp/core.c -+++ b/net/bluetooth/hidp/core.c -@@ -396,6 +396,20 @@ static void hidp_idle_timeout(unsigned long arg) - { - struct hidp_session *session = (struct hidp_session *) arg; - -+ /* The HIDP user-space API only contains calls to add and remove -+ * devices. There is no way to forward events of any kind. Therefore, -+ * we have to forcefully disconnect a device on idle-timeouts. This is -+ * unfortunate and weird API design, but it is spec-compliant and -+ * required for backwards-compatibility. Hence, on idle-timeout, we -+ * signal driver-detach events, so poll() will be woken up with an -+ * error-condition on both sockets. -+ */ -+ -+ session->intr_sock->sk->sk_err = EUNATCH; -+ session->ctrl_sock->sk->sk_err = EUNATCH; -+ wake_up_interruptible(sk_sleep(session->intr_sock->sk)); -+ wake_up_interruptible(sk_sleep(session->ctrl_sock->sk)); -+ - hidp_session_terminate(session); - } - -diff --git a/net/core/dst.c b/net/core/dst.c -index c0e021871df8..01f9980af86e 100644 ---- a/net/core/dst.c -+++ b/net/core/dst.c -@@ -283,7 +283,7 @@ void dst_release(struct dst_entry *dst) - - newrefcnt = atomic_dec_return(&dst->__refcnt); - WARN_ON(newrefcnt < 0); -- if (unlikely(dst->flags & DST_NOCACHE) && !newrefcnt) -+ if (!newrefcnt && unlikely(dst->flags & DST_NOCACHE)) - call_rcu(&dst->rcu_head, dst_destroy_rcu); - } - } -diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c -index 56d079b63ad3..6f5f943ff395 100644 ---- a/net/ipv4/ipmr.c -+++ b/net/ipv4/ipmr.c -@@ -1672,8 +1672,8 @@ static inline int ipmr_forward_finish(struct sk_buff *skb) - { - struct ip_options *opt = &(IPCB(skb)->opt); - -- IP_INC_STATS_BH(dev_net(skb_dst(skb)->dev), IPSTATS_MIB_OUTFORWDATAGRAMS); -- IP_ADD_STATS_BH(dev_net(skb_dst(skb)->dev), IPSTATS_MIB_OUTOCTETS, skb->len); -+ IP_INC_STATS(dev_net(skb_dst(skb)->dev), IPSTATS_MIB_OUTFORWDATAGRAMS); -+ IP_ADD_STATS(dev_net(skb_dst(skb)->dev), IPSTATS_MIB_OUTOCTETS, skb->len); - - if (unlikely(opt->optlen)) - ip_forward_options(skb); -@@ -1735,7 +1735,7 @@ static void ipmr_queue_xmit(struct net *net, struct mr_table *mrt, - * to blackhole. - */ - -- IP_INC_STATS_BH(dev_net(dev), IPSTATS_MIB_FRAGFAILS); -+ IP_INC_STATS(dev_net(dev), IPSTATS_MIB_FRAGFAILS); - ip_rt_put(rt); - goto out_free; - } -diff --git a/net/irda/irlmp.c b/net/irda/irlmp.c -index 98ad6ec4bd3c..8ad149478e19 100644 ---- a/net/irda/irlmp.c -+++ b/net/irda/irlmp.c -@@ -1876,7 +1876,7 @@ static void *irlmp_seq_hb_idx(struct irlmp_iter_state *iter, loff_t *off) - for (element = hashbin_get_first(iter->hashbin); - element != NULL; - element = hashbin_get_next(iter->hashbin)) { -- if (!off || *off-- == 0) { -+ if (!off || (*off)-- == 0) { - /* NB: hashbin left locked */ - return element; - } -diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c -index e606e4a113e1..952cb336d704 100644 ---- a/net/mac80211/mlme.c -+++ b/net/mac80211/mlme.c -@@ -3074,7 +3074,7 @@ ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata, - - if (ifmgd->rssi_min_thold != ifmgd->rssi_max_thold && - ifmgd->count_beacon_signal >= IEEE80211_SIGNAL_AVE_MIN_COUNT) { -- int sig = ifmgd->ave_beacon_signal; -+ int sig = ifmgd->ave_beacon_signal / 16; - int last_sig = ifmgd->last_ave_beacon_signal; - - /* -diff --git a/net/rds/connection.c b/net/rds/connection.c -index 642ad42c416b..e88bf3976e54 100644 ---- a/net/rds/connection.c -+++ b/net/rds/connection.c -@@ -177,6 +177,12 @@ static struct rds_connection *__rds_conn_create(__be32 laddr, __be32 faddr, - } - } - -+ if (trans == NULL) { -+ kmem_cache_free(rds_conn_slab, conn); -+ conn = ERR_PTR(-ENODEV); -+ goto out; -+ } -+ - conn->c_trans = trans; - - ret = trans->conn_alloc(conn, gfp); -diff --git a/net/rds/tcp_recv.c b/net/rds/tcp_recv.c -index 4fac4f2bb9dc..8b33d9967b56 100644 ---- a/net/rds/tcp_recv.c -+++ b/net/rds/tcp_recv.c -@@ -234,8 +234,15 @@ static int rds_tcp_data_recv(read_descriptor_t *desc, struct sk_buff *skb, - } - - to_copy = min(tc->t_tinc_data_rem, left); -- pskb_pull(clone, offset); -- pskb_trim(clone, to_copy); -+ if (!pskb_pull(clone, offset) || -+ pskb_trim(clone, to_copy)) { -+ pr_warn("rds_tcp_data_recv: pull/trim failed " -+ "left %zu data_rem %zu skb_len %d\n", -+ left, tc->t_tinc_data_rem, skb->len); -+ kfree_skb(clone); -+ desc->error = -ENOMEM; -+ goto out; -+ } - skb_queue_tail(&tinc->ti_skb_list, clone); - - rdsdebug("skb %p data %p len %d off %u to_copy %zu -> " -diff --git a/sound/usb/midi.c b/sound/usb/midi.c -index 93249133aeec..dabbe05d17f5 100644 ---- a/sound/usb/midi.c -+++ b/sound/usb/midi.c -@@ -174,6 +174,8 @@ struct snd_usb_midi_in_endpoint { - u8 running_status_length; - } ports[0x10]; - u8 seen_f5; -+ bool in_sysex; -+ u8 last_cin; - u8 error_resubmit; - int current_port; - }; -@@ -465,6 +467,39 @@ static void snd_usbmidi_maudio_broken_running_status_input( - } - - /* -+ * QinHeng CH345 is buggy: every second packet inside a SysEx has not CIN 4 -+ * but the previously seen CIN, but still with three data bytes. -+ */ -+static void ch345_broken_sysex_input(struct snd_usb_midi_in_endpoint *ep, -+ uint8_t *buffer, int buffer_length) -+{ -+ unsigned int i, cin, length; -+ -+ for (i = 0; i + 3 < buffer_length; i += 4) { -+ if (buffer[i] == 0 && i > 0) -+ break; -+ cin = buffer[i] & 0x0f; -+ if (ep->in_sysex && -+ cin == ep->last_cin && -+ (buffer[i + 1 + (cin == 0x6)] & 0x80) == 0) -+ cin = 0x4; -+#if 0 -+ if (buffer[i + 1] == 0x90) { -+ /* -+ * Either a corrupted running status or a real note-on -+ * message; impossible to detect reliably. -+ */ -+ } -+#endif -+ length = snd_usbmidi_cin_length[cin]; -+ snd_usbmidi_input_data(ep, 0, &buffer[i + 1], length); -+ ep->in_sysex = cin == 0x4; -+ if (!ep->in_sysex) -+ ep->last_cin = cin; -+ } -+} -+ -+/* - * CME protocol: like the standard protocol, but SysEx commands are sent as a - * single USB packet preceded by a 0x0F byte. - */ -@@ -650,6 +685,12 @@ static struct usb_protocol_ops snd_usbmidi_cme_ops = { - .output_packet = snd_usbmidi_output_standard_packet, - }; - -+static struct usb_protocol_ops snd_usbmidi_ch345_broken_sysex_ops = { -+ .input = ch345_broken_sysex_input, -+ .output = snd_usbmidi_standard_output, -+ .output_packet = snd_usbmidi_output_standard_packet, -+}; -+ - /* - * AKAI MPD16 protocol: - * -@@ -1326,6 +1367,7 @@ static int snd_usbmidi_out_endpoint_create(struct snd_usb_midi* umidi, - * Various chips declare a packet size larger than 4 bytes, but - * do not actually work with larger packets: - */ -+ case USB_ID(0x0a67, 0x5011): /* Medeli DD305 */ - case USB_ID(0x0a92, 0x1020): /* ESI M4U */ - case USB_ID(0x1430, 0x474b): /* RedOctane GH MIDI INTERFACE */ - case USB_ID(0x15ca, 0x0101): /* Textech USB Midi Cable */ -@@ -2216,6 +2258,10 @@ int snd_usbmidi_create(struct snd_card *card, - - err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints); - break; -+ case QUIRK_MIDI_CH345: -+ umidi->usb_protocol_ops = &snd_usbmidi_ch345_broken_sysex_ops; -+ err = snd_usbmidi_detect_per_port_endpoints(umidi, endpoints); -+ break; - default: - snd_printd(KERN_ERR "invalid quirk type %d\n", quirk->type); - err = -ENXIO; -diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h -index 45d586b6e8b5..9ec5ce4e35fb 100644 ---- a/sound/usb/quirks-table.h -+++ b/sound/usb/quirks-table.h -@@ -3041,6 +3041,17 @@ YAMAHA_DEVICE(0x7010, "UB99"), - .idProduct = 0x1020, - }, - -+/* QinHeng devices */ -+{ -+ USB_DEVICE(0x1a86, 0x752d), -+ .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { -+ .vendor_name = "QinHeng", -+ .product_name = "CH345", -+ .ifnum = 1, -+ .type = QUIRK_MIDI_CH345 -+ } -+}, -+ - /* KeithMcMillen Stringport */ - { - USB_DEVICE(0x1f38, 0x0001), -diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c -index 734c6579b194..94cd28c2bd8d 100644 ---- a/sound/usb/quirks.c -+++ b/sound/usb/quirks.c -@@ -313,6 +313,7 @@ int snd_usb_create_quirk(struct snd_usb_audio *chip, - [QUIRK_MIDI_CME] = create_any_midi_quirk, - [QUIRK_MIDI_AKAI] = create_any_midi_quirk, - [QUIRK_MIDI_FTDI] = create_any_midi_quirk, -+ [QUIRK_MIDI_CH345] = create_any_midi_quirk, - [QUIRK_AUDIO_STANDARD_INTERFACE] = create_standard_audio_quirk, - [QUIRK_AUDIO_FIXED_ENDPOINT] = create_fixed_stream_quirk, - [QUIRK_AUDIO_EDIROL_UAXX] = create_uaxx_quirk, -diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h -index bc43bcaddf4d..d6f3fefc882f 100644 ---- a/sound/usb/usbaudio.h -+++ b/sound/usb/usbaudio.h -@@ -83,6 +83,7 @@ enum quirk_type { - QUIRK_MIDI_AKAI, - QUIRK_MIDI_US122L, - QUIRK_MIDI_FTDI, -+ QUIRK_MIDI_CH345, - QUIRK_AUDIO_STANDARD_INTERFACE, - QUIRK_AUDIO_FIXED_ENDPOINT, - QUIRK_AUDIO_EDIROL_UAXX, diff --git a/patch/kernel/marvell-default/1-patch-3.10.94-95.patch b/patch/kernel/marvell-default/1-patch-3.10.94-95.patch deleted file mode 100644 index 199647cdc0..0000000000 --- a/patch/kernel/marvell-default/1-patch-3.10.94-95.patch +++ /dev/null @@ -1,1222 +0,0 @@ -diff --git a/Makefile b/Makefile -index f73ae0748cbc..eb120001bc12 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,6 +1,6 @@ - VERSION = 3 - PATCHLEVEL = 10 --SUBLEVEL = 94 -+SUBLEVEL = 95 - EXTRAVERSION = - NAME = TOSSUG Baby Fish - -diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c -index 0f3e3047e29c..14ca13a0698b 100644 ---- a/drivers/firewire/ohci.c -+++ b/drivers/firewire/ohci.c -@@ -3670,6 +3670,11 @@ static int pci_probe(struct pci_dev *dev, - - reg_write(ohci, OHCI1394_IsoXmitIntMaskSet, ~0); - ohci->it_context_support = reg_read(ohci, OHCI1394_IsoXmitIntMaskSet); -+ /* JMicron JMB38x often shows 0 at first read, just ignore it */ -+ if (!ohci->it_context_support) { -+ ohci_notice(ohci, "overriding IsoXmitIntMask\n"); -+ ohci->it_context_support = 0xf; -+ } - reg_write(ohci, OHCI1394_IsoXmitIntMaskClear, ~0); - ohci->it_context_mask = ohci->it_context_support; - ohci->n_it = hweight32(ohci->it_context_mask); -diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c -index 11cdf1d43041..297c3e5ec3f3 100644 ---- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c -+++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c -@@ -1016,13 +1016,12 @@ static int atl1c_setup_ring_resources(struct atl1c_adapter *adapter) - sizeof(struct atl1c_recv_ret_status) * rx_desc_count + - 8 * 4; - -- ring_header->desc = pci_alloc_consistent(pdev, ring_header->size, -- &ring_header->dma); -+ ring_header->desc = dma_zalloc_coherent(&pdev->dev, ring_header->size, -+ &ring_header->dma, GFP_KERNEL); - if (unlikely(!ring_header->desc)) { -- dev_err(&pdev->dev, "pci_alloc_consistend failed\n"); -+ dev_err(&pdev->dev, "could not get memory for DMA buffer\n"); - goto err_nomem; - } -- memset(ring_header->desc, 0, ring_header->size); - /* init TPD ring */ - - tpd_ring[0].dma = roundup(ring_header->dma, 8); -diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c -index e29fe8dbd226..b93a0fb17236 100644 ---- a/drivers/net/ethernet/renesas/sh_eth.c -+++ b/drivers/net/ethernet/renesas/sh_eth.c -@@ -1421,6 +1421,7 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status) - desc_status >>= 16; - #endif - -+ skb = mdp->rx_skbuff[entry]; - if (desc_status & (RD_RFS1 | RD_RFS2 | RD_RFS3 | RD_RFS4 | - RD_RFS5 | RD_RFS6 | RD_RFS10)) { - ndev->stats.rx_errors++; -@@ -1436,12 +1437,11 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status) - ndev->stats.rx_missed_errors++; - if (desc_status & RD_RFS10) - ndev->stats.rx_over_errors++; -- } else { -+ } else if (skb) { - if (!mdp->cd->hw_swap) - sh_eth_soft_swap( - phys_to_virt(ALIGN(rxdesc->addr, 4)), - pkt_len + 2); -- skb = mdp->rx_skbuff[entry]; - mdp->rx_skbuff[entry] = NULL; - if (mdp->cd->rpadir) - skb_reserve(skb, NET_IP_ALIGN); -diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c -index f8c90ea75108..7a1ff5797f12 100644 ---- a/drivers/net/phy/broadcom.c -+++ b/drivers/net/phy/broadcom.c -@@ -848,7 +848,7 @@ static struct mdio_device_id __maybe_unused broadcom_tbl[] = { - { PHY_ID_BCM5421, 0xfffffff0 }, - { PHY_ID_BCM5461, 0xfffffff0 }, - { PHY_ID_BCM5464, 0xfffffff0 }, -- { PHY_ID_BCM5482, 0xfffffff0 }, -+ { PHY_ID_BCM5481, 0xfffffff0 }, - { PHY_ID_BCM5482, 0xfffffff0 }, - { PHY_ID_BCM50610, 0xfffffff0 }, - { PHY_ID_BCM50610M, 0xfffffff0 }, -diff --git a/drivers/net/ppp/pptp.c b/drivers/net/ppp/pptp.c -index 0d5a5faaf83b..9a423435039a 100644 ---- a/drivers/net/ppp/pptp.c -+++ b/drivers/net/ppp/pptp.c -@@ -420,6 +420,9 @@ static int pptp_bind(struct socket *sock, struct sockaddr *uservaddr, - struct pptp_opt *opt = &po->proto.pptp; - int error = 0; - -+ if (sockaddr_len < sizeof(struct sockaddr_pppox)) -+ return -EINVAL; -+ - lock_sock(sk); - - opt->src_addr = sp->sa_addr.pptp; -@@ -441,6 +444,9 @@ static int pptp_connect(struct socket *sock, struct sockaddr *uservaddr, - struct flowi4 fl4; - int error = 0; - -+ if (sockaddr_len < sizeof(struct sockaddr_pppox)) -+ return -EINVAL; -+ - if (sp->sa_protocol != PX_PROTO_PPTP) - return -EINVAL; - -diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c -index 43204f4be2da..0244a1fb38f9 100644 ---- a/drivers/net/usb/qmi_wwan.c -+++ b/drivers/net/usb/qmi_wwan.c -@@ -742,6 +742,7 @@ static const struct usb_device_id products[] = { - {QMI_FIXED_INTF(0x2357, 0x9000, 4)}, /* TP-LINK MA260 */ - {QMI_FIXED_INTF(0x1bc7, 0x1200, 5)}, /* Telit LE920 */ - {QMI_FIXED_INTF(0x1bc7, 0x1201, 2)}, /* Telit LE920 */ -+ {QMI_FIXED_INTF(0x1c9e, 0x9b01, 3)}, /* XS Stick W100-2 from 4G Systems */ - {QMI_FIXED_INTF(0x0b3c, 0xc000, 4)}, /* Olivetti Olicard 100 */ - {QMI_FIXED_INTF(0x0b3c, 0xc001, 4)}, /* Olivetti Olicard 120 */ - {QMI_FIXED_INTF(0x0b3c, 0xc002, 4)}, /* Olivetti Olicard 140 */ -diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c -index 2800776b2e91..d2ea64de92df 100644 ---- a/drivers/usb/class/cdc-acm.c -+++ b/drivers/usb/class/cdc-acm.c -@@ -1726,6 +1726,11 @@ static const struct usb_device_id acm_ids[] = { - }, - #endif - -+ /* Exclude Infineon Flash Loader utility */ -+ { USB_DEVICE(0x058b, 0x0041), -+ .driver_info = IGNORE_DEVICE, -+ }, -+ - /* control interfaces without any protocol set */ - { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM, - USB_CDC_PROTO_NONE) }, -diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c -index 85756bd36746..9b05e88d6220 100644 ---- a/drivers/usb/core/config.c -+++ b/drivers/usb/core/config.c -@@ -117,7 +117,8 @@ static void usb_parse_ss_endpoint_companion(struct device *ddev, int cfgno, - USB_SS_MULT(desc->bmAttributes) > 3) { - dev_warn(ddev, "Isoc endpoint has Mult of %d in " - "config %d interface %d altsetting %d ep %d: " -- "setting to 3\n", desc->bmAttributes + 1, -+ "setting to 3\n", -+ USB_SS_MULT(desc->bmAttributes), - cfgno, inum, asnum, ep->desc.bEndpointAddress); - ep->ss_ep_comp.bmAttributes = 2; - } -diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c -index 11a073cda1d6..92873f2773fc 100644 ---- a/drivers/usb/core/hub.c -+++ b/drivers/usb/core/hub.c -@@ -137,6 +137,10 @@ struct usb_hub *usb_hub_to_struct_hub(struct usb_device *hdev) - - static int usb_device_supports_lpm(struct usb_device *udev) - { -+ /* Some devices have trouble with LPM */ -+ if (udev->quirks & USB_QUIRK_NO_LPM) -+ return 0; -+ - /* USB 2.1 (and greater) devices indicate LPM support through - * their USB 2.0 Extended Capabilities BOS descriptor. - */ -@@ -4289,6 +4293,8 @@ hub_port_init (struct usb_hub *hub, struct usb_device *udev, int port1, - goto fail; - } - -+ usb_detect_quirks(udev); -+ - if (udev->wusb == 0 && le16_to_cpu(udev->descriptor.bcdUSB) >= 0x0201) { - retval = usb_get_bos_descriptor(udev); - if (!retval) { -@@ -4530,7 +4536,6 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1, - if (status < 0) - goto loop; - -- usb_detect_quirks(udev); - if (udev->quirks & USB_QUIRK_DELAY_INIT) - msleep(1000); - -diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c -index d4db4ea4a92d..94e9cddc05c1 100644 ---- a/drivers/usb/core/quirks.c -+++ b/drivers/usb/core/quirks.c -@@ -182,6 +182,12 @@ static const struct usb_device_id usb_interface_quirk_list[] = { - { USB_DEVICE(0x0b05, 0x17e0), .driver_info = - USB_QUIRK_IGNORE_REMOTE_WAKEUP }, - -+ /* Blackmagic Design Intensity Shuttle */ -+ { USB_DEVICE(0x1edb, 0xbd3b), .driver_info = USB_QUIRK_NO_LPM }, -+ -+ /* Blackmagic Design UltraStudio SDI */ -+ { USB_DEVICE(0x1edb, 0xbd4f), .driver_info = USB_QUIRK_NO_LPM }, -+ - { } /* terminating entry must be last */ - }; - -diff --git a/drivers/usb/host/whci/qset.c b/drivers/usb/host/whci/qset.c -index dc31c425ce01..9f1c0538b211 100644 ---- a/drivers/usb/host/whci/qset.c -+++ b/drivers/usb/host/whci/qset.c -@@ -377,6 +377,10 @@ static int qset_fill_page_list(struct whc *whc, struct whc_std *std, gfp_t mem_f - if (std->pl_virt == NULL) - return -ENOMEM; - std->dma_addr = dma_map_single(whc->wusbhc.dev, std->pl_virt, pl_len, DMA_TO_DEVICE); -+ if (dma_mapping_error(whc->wusbhc.dev, std->dma_addr)) { -+ kfree(std->pl_virt); -+ return -EFAULT; -+ } - - for (p = 0; p < std->num_pointers; p++) { - std->pl_virt[p].buf_ptr = cpu_to_le64(dma_addr); -diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c -index dd84416a23cd..25522e98602e 100644 ---- a/drivers/usb/serial/cp210x.c -+++ b/drivers/usb/serial/cp210x.c -@@ -132,7 +132,6 @@ static const struct usb_device_id id_table[] = { - { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */ - { USB_DEVICE(0x10C4, 0xEA61) }, /* Silicon Labs factory default */ - { USB_DEVICE(0x10C4, 0xEA70) }, /* Silicon Labs factory default */ -- { USB_DEVICE(0x10C4, 0xEA80) }, /* Silicon Labs factory default */ - { USB_DEVICE(0x10C4, 0xEA71) }, /* Infinity GPS-MIC-1 Radio Monophone */ - { USB_DEVICE(0x10C4, 0xF001) }, /* Elan Digital Systems USBscope50 */ - { USB_DEVICE(0x10C4, 0xF002) }, /* Elan Digital Systems USBwave12 */ -diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c -index f22beda91ffc..ae29b403a7e2 100644 ---- a/fs/btrfs/inode.c -+++ b/fs/btrfs/inode.c -@@ -1286,8 +1286,14 @@ next_slot: - num_bytes = 0; - btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]); - -- if (found_key.objectid > ino || -- found_key.type > BTRFS_EXTENT_DATA_KEY || -+ if (found_key.objectid > ino) -+ break; -+ if (WARN_ON_ONCE(found_key.objectid < ino) || -+ found_key.type < BTRFS_EXTENT_DATA_KEY) { -+ path->slots[0]++; -+ goto next_slot; -+ } -+ if (found_key.type > BTRFS_EXTENT_DATA_KEY || - found_key.offset > end) - break; - -diff --git a/fs/ext4/super.c b/fs/ext4/super.c -index af1eaed96a91..a7e079749425 100644 ---- a/fs/ext4/super.c -+++ b/fs/ext4/super.c -@@ -400,9 +400,13 @@ static void ext4_handle_error(struct super_block *sb) - ext4_msg(sb, KERN_CRIT, "Remounting filesystem read-only"); - sb->s_flags |= MS_RDONLY; - } -- if (test_opt(sb, ERRORS_PANIC)) -+ if (test_opt(sb, ERRORS_PANIC)) { -+ if (EXT4_SB(sb)->s_journal && -+ !(EXT4_SB(sb)->s_journal->j_flags & JBD2_REC_ERR)) -+ return; - panic("EXT4-fs (device %s): panic forced after error\n", - sb->s_id); -+ } - } - - void __ext4_error(struct super_block *sb, const char *function, -@@ -576,8 +580,12 @@ void __ext4_abort(struct super_block *sb, const char *function, - jbd2_journal_abort(EXT4_SB(sb)->s_journal, -EIO); - save_error_info(sb, function, line); - } -- if (test_opt(sb, ERRORS_PANIC)) -+ if (test_opt(sb, ERRORS_PANIC)) { -+ if (EXT4_SB(sb)->s_journal && -+ !(EXT4_SB(sb)->s_journal->j_flags & JBD2_REC_ERR)) -+ return; - panic("EXT4-fs panic from previous error\n"); -+ } - } - - void ext4_msg(struct super_block *sb, const char *prefix, const char *fmt, ...) -diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c -index 3e7ef8874ffb..644f95e7208f 100644 ---- a/fs/jbd2/journal.c -+++ b/fs/jbd2/journal.c -@@ -2049,8 +2049,12 @@ static void __journal_abort_soft (journal_t *journal, int errno) - - __jbd2_journal_abort_hard(journal); - -- if (errno) -+ if (errno) { - jbd2_journal_update_sb_errno(journal); -+ write_lock(&journal->j_state_lock); -+ journal->j_flags |= JBD2_REC_ERR; -+ write_unlock(&journal->j_state_lock); -+ } - } - - /** -diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c -index e9be01b2cc5a..02c6eade0bdc 100644 ---- a/fs/nfs/inode.c -+++ b/fs/nfs/inode.c -@@ -1503,7 +1503,11 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr) - nfsi->attrtimeo_timestamp = now; - } - } -- invalid &= ~NFS_INO_INVALID_ATTR; -+ -+ /* Don't declare attrcache up to date if there were no attrs! */ -+ if (fattr->valid != 0) -+ invalid &= ~NFS_INO_INVALID_ATTR; -+ - /* Don't invalidate the data if we were to blame */ - if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) - || S_ISLNK(inode->i_mode))) -diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c -index 5f8d5ffdad8f..498811c09da7 100644 ---- a/fs/nfs/nfs4client.c -+++ b/fs/nfs/nfs4client.c -@@ -32,7 +32,7 @@ static int nfs_get_cb_ident_idr(struct nfs_client *clp, int minorversion) - return ret; - idr_preload(GFP_KERNEL); - spin_lock(&nn->nfs_client_lock); -- ret = idr_alloc(&nn->cb_ident_idr, clp, 0, 0, GFP_NOWAIT); -+ ret = idr_alloc(&nn->cb_ident_idr, clp, 1, 0, GFP_NOWAIT); - if (ret >= 0) - clp->cl_cb_ident = ret; - spin_unlock(&nn->nfs_client_lock); -diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h -index 0c67c1f2a890..7d4a932305be 100644 ---- a/include/linux/jbd2.h -+++ b/include/linux/jbd2.h -@@ -977,6 +977,7 @@ struct journal_s - #define JBD2_ABORT_ON_SYNCDATA_ERR 0x040 /* Abort the journal on file - * data write error in ordered - * mode */ -+#define JBD2_REC_ERR 0x080 /* The errno in the sb has been recorded */ - - /* - * Function declarations for the journaling transaction and buffer -diff --git a/include/linux/usb/quirks.h b/include/linux/usb/quirks.h -index 49587dc22f5d..41ea53c39389 100644 ---- a/include/linux/usb/quirks.h -+++ b/include/linux/usb/quirks.h -@@ -33,4 +33,7 @@ - /* device generates spurious wakeup, ignore remote wakeup capability */ - #define USB_QUIRK_IGNORE_REMOTE_WAKEUP 0x00000200 - -+/* device can't handle Link Power Management */ -+#define USB_QUIRK_NO_LPM BIT(10) -+ - #endif /* __LINUX_USB_QUIRKS_H */ -diff --git a/include/net/af_unix.h b/include/net/af_unix.h -index e927d3e80b61..686760024572 100644 ---- a/include/net/af_unix.h -+++ b/include/net/af_unix.h -@@ -62,6 +62,7 @@ struct unix_sock { - #define UNIX_GC_CANDIDATE 0 - #define UNIX_GC_MAYBE_CYCLE 1 - struct socket_wq peer_wq; -+ wait_queue_t peer_wake; - }; - - static inline struct unix_sock *unix_sk(struct sock *sk) -diff --git a/include/net/ipv6.h b/include/net/ipv6.h -index 087370ff05f1..413e23be60d1 100644 ---- a/include/net/ipv6.h -+++ b/include/net/ipv6.h -@@ -478,6 +478,7 @@ struct ip6_create_arg { - u32 user; - const struct in6_addr *src; - const struct in6_addr *dst; -+ int iif; - u8 ecn; - }; - -diff --git a/include/net/sock.h b/include/net/sock.h -index 95dc0c8a9dac..2317d122874e 100644 ---- a/include/net/sock.h -+++ b/include/net/sock.h -@@ -352,6 +352,7 @@ struct sock { - sk_no_check : 2, - sk_userlocks : 4, - sk_protocol : 8, -+#define SK_PROTOCOL_MAX U8_MAX - sk_type : 16; - kmemcheck_bitfield_end(flags); - int sk_wmem_queued; -@@ -672,6 +673,8 @@ enum sock_flags { - SOCK_SELECT_ERR_QUEUE, /* Wake select on error queue */ - }; - -+#define SK_FLAGS_TIMESTAMP ((1UL << SOCK_TIMESTAMP) | (1UL << SOCK_TIMESTAMPING_RX_SOFTWARE)) -+ - static inline void sock_copy_flags(struct sock *nsk, struct sock *osk) - { - nsk->sk_flags = osk->sk_flags; -diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c -index ba6db78a02b1..69940a723abd 100644 ---- a/net/ax25/af_ax25.c -+++ b/net/ax25/af_ax25.c -@@ -806,6 +806,9 @@ static int ax25_create(struct net *net, struct socket *sock, int protocol, - struct sock *sk; - ax25_cb *ax25; - -+ if (protocol < 0 || protocol > SK_PROTOCOL_MAX) -+ return -EINVAL; -+ - if (!net_eq(net, &init_net)) - return -EAFNOSUPPORT; - -diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c -index c9ae6b703c13..b586a3230247 100644 ---- a/net/bluetooth/sco.c -+++ b/net/bluetooth/sco.c -@@ -456,6 +456,9 @@ static int sco_sock_bind(struct socket *sock, struct sockaddr *addr, int addr_le - if (!addr || addr->sa_family != AF_BLUETOOTH) - return -EINVAL; - -+ if (addr_len < sizeof(struct sockaddr_sco)) -+ return -EINVAL; -+ - lock_sock(sk); - - if (sk->sk_state != BT_OPEN) { -diff --git a/net/core/scm.c b/net/core/scm.c -index b4da80b1cc07..dbc6bfcdf446 100644 ---- a/net/core/scm.c -+++ b/net/core/scm.c -@@ -306,6 +306,8 @@ void scm_detach_fds(struct msghdr *msg, struct scm_cookie *scm) - err = put_user(cmlen, &cm->cmsg_len); - if (!err) { - cmlen = CMSG_SPACE(i*sizeof(int)); -+ if (msg->msg_controllen < cmlen) -+ cmlen = msg->msg_controllen; - msg->msg_control += cmlen; - msg->msg_controllen -= cmlen; - } -diff --git a/net/core/sock.c b/net/core/sock.c -index af65d17517b8..5a954fccc7d3 100644 ---- a/net/core/sock.c -+++ b/net/core/sock.c -@@ -419,8 +419,6 @@ static void sock_warn_obsolete_bsdism(const char *name) - } - } - --#define SK_FLAGS_TIMESTAMP ((1UL << SOCK_TIMESTAMP) | (1UL << SOCK_TIMESTAMPING_RX_SOFTWARE)) -- - static void sock_disable_timestamp(struct sock *sk, unsigned long flags) - { - if (sk->sk_flags & flags) { -diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c -index c21f200eed93..ca6106562769 100644 ---- a/net/decnet/af_decnet.c -+++ b/net/decnet/af_decnet.c -@@ -677,6 +677,9 @@ static int dn_create(struct net *net, struct socket *sock, int protocol, - { - struct sock *sk; - -+ if (protocol < 0 || protocol > SK_PROTOCOL_MAX) -+ return -EINVAL; -+ - if (!net_eq(net, &init_net)) - return -EAFNOSUPPORT; - -diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c -index c4adc319cc2e..975c369d4e6d 100644 ---- a/net/ipv4/af_inet.c -+++ b/net/ipv4/af_inet.c -@@ -288,6 +288,9 @@ static int inet_create(struct net *net, struct socket *sock, int protocol, - if (sock->type != SOCK_RAW && sock->type != SOCK_DGRAM) - build_ehash_secret(); - -+ if (protocol < 0 || protocol >= IPPROTO_MAX) -+ return -EINVAL; -+ - sock->state = SS_UNCONNECTED; - - /* Look for the requested type/protocol pair. */ -diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c -index 6f5f943ff395..b31553d385bb 100644 ---- a/net/ipv4/ipmr.c -+++ b/net/ipv4/ipmr.c -@@ -136,7 +136,7 @@ static int __ipmr_fill_mroute(struct mr_table *mrt, struct sk_buff *skb, - struct mfc_cache *c, struct rtmsg *rtm); - static void mroute_netlink_event(struct mr_table *mrt, struct mfc_cache *mfc, - int cmd); --static void mroute_clean_tables(struct mr_table *mrt); -+static void mroute_clean_tables(struct mr_table *mrt, bool all); - static void ipmr_expire_process(unsigned long arg); - - #ifdef CONFIG_IP_MROUTE_MULTIPLE_TABLES -@@ -348,7 +348,7 @@ static struct mr_table *ipmr_new_table(struct net *net, u32 id) - static void ipmr_free_table(struct mr_table *mrt) - { - del_timer_sync(&mrt->ipmr_expire_timer); -- mroute_clean_tables(mrt); -+ mroute_clean_tables(mrt, true); - kfree(mrt); - } - -@@ -1199,7 +1199,7 @@ static int ipmr_mfc_add(struct net *net, struct mr_table *mrt, - * Close the multicast socket, and clear the vif tables etc - */ - --static void mroute_clean_tables(struct mr_table *mrt) -+static void mroute_clean_tables(struct mr_table *mrt, bool all) - { - int i; - LIST_HEAD(list); -@@ -1208,8 +1208,9 @@ static void mroute_clean_tables(struct mr_table *mrt) - /* Shut down all active vif entries */ - - for (i = 0; i < mrt->maxvif; i++) { -- if (!(mrt->vif_table[i].flags & VIFF_STATIC)) -- vif_delete(mrt, i, 0, &list); -+ if (!all && (mrt->vif_table[i].flags & VIFF_STATIC)) -+ continue; -+ vif_delete(mrt, i, 0, &list); - } - unregister_netdevice_many(&list); - -@@ -1217,7 +1218,7 @@ static void mroute_clean_tables(struct mr_table *mrt) - - for (i = 0; i < MFC_LINES; i++) { - list_for_each_entry_safe(c, next, &mrt->mfc_cache_array[i], list) { -- if (c->mfc_flags & MFC_STATIC) -+ if (!all && (c->mfc_flags & MFC_STATIC)) - continue; - list_del_rcu(&c->list); - mroute_netlink_event(mrt, c, RTM_DELROUTE); -@@ -1252,7 +1253,7 @@ static void mrtsock_destruct(struct sock *sk) - NETCONFA_IFINDEX_ALL, - net->ipv4.devconf_all); - RCU_INIT_POINTER(mrt->mroute_sk, NULL); -- mroute_clean_tables(mrt); -+ mroute_clean_tables(mrt, false); - } - } - rtnl_unlock(); -diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c -index a8be45e4d34f..f89087c3cfc8 100644 ---- a/net/ipv4/tcp_input.c -+++ b/net/ipv4/tcp_input.c -@@ -5575,6 +5575,7 @@ discard: - } - - tp->rcv_nxt = TCP_SKB_CB(skb)->seq + 1; -+ tp->copied_seq = tp->rcv_nxt; - tp->rcv_wup = TCP_SKB_CB(skb)->seq + 1; - - /* RFC1323: The window in SYN & SYN/ACK segments is -diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c -index 7c3eec386a4b..11f27a45b8ef 100644 ---- a/net/ipv4/tcp_ipv4.c -+++ b/net/ipv4/tcp_ipv4.c -@@ -1015,7 +1015,8 @@ int tcp_md5_do_add(struct sock *sk, const union tcp_md5_addr *addr, - } - - md5sig = rcu_dereference_protected(tp->md5sig_info, -- sock_owned_by_user(sk)); -+ sock_owned_by_user(sk) || -+ lockdep_is_held(&sk->sk_lock.slock)); - if (!md5sig) { - md5sig = kmalloc(sizeof(*md5sig), gfp); - if (!md5sig) -diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c -index ab5c7ad482cd..a944f1313c5f 100644 ---- a/net/ipv6/af_inet6.c -+++ b/net/ipv6/af_inet6.c -@@ -113,6 +113,9 @@ static int inet6_create(struct net *net, struct socket *sock, int protocol, - !inet_ehash_secret) - build_ehash_secret(); - -+ if (protocol < 0 || protocol >= IPPROTO_MAX) -+ return -EINVAL; -+ - /* Look for the requested type/protocol pair. */ - lookup_protocol: - err = -ESOCKTNOSUPPORT; -diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c -index bf6233cdb753..7eb7267861ac 100644 ---- a/net/ipv6/ip6_gre.c -+++ b/net/ipv6/ip6_gre.c -@@ -1541,13 +1541,11 @@ static int ip6gre_changelink(struct net_device *dev, struct nlattr *tb[], - return -EEXIST; - } else { - t = nt; -- -- ip6gre_tunnel_unlink(ign, t); -- ip6gre_tnl_change(t, &p, !tb[IFLA_MTU]); -- ip6gre_tunnel_link(ign, t); -- netdev_state_change(dev); - } - -+ ip6gre_tunnel_unlink(ign, t); -+ ip6gre_tnl_change(t, &p, !tb[IFLA_MTU]); -+ ip6gre_tunnel_link(ign, t); - return 0; - } - -diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c -index 57dd3e7d86cc..9ec416552cc5 100644 ---- a/net/ipv6/ip6mr.c -+++ b/net/ipv6/ip6mr.c -@@ -120,7 +120,7 @@ static void mr6_netlink_event(struct mr6_table *mrt, struct mfc6_cache *mfc, - int cmd); - static int ip6mr_rtm_dumproute(struct sk_buff *skb, - struct netlink_callback *cb); --static void mroute_clean_tables(struct mr6_table *mrt); -+static void mroute_clean_tables(struct mr6_table *mrt, bool all); - static void ipmr_expire_process(unsigned long arg); - - #ifdef CONFIG_IPV6_MROUTE_MULTIPLE_TABLES -@@ -337,7 +337,7 @@ static struct mr6_table *ip6mr_new_table(struct net *net, u32 id) - static void ip6mr_free_table(struct mr6_table *mrt) - { - del_timer(&mrt->ipmr_expire_timer); -- mroute_clean_tables(mrt); -+ mroute_clean_tables(mrt, true); - kfree(mrt); - } - -@@ -1537,7 +1537,7 @@ static int ip6mr_mfc_add(struct net *net, struct mr6_table *mrt, - * Close the multicast socket, and clear the vif tables etc - */ - --static void mroute_clean_tables(struct mr6_table *mrt) -+static void mroute_clean_tables(struct mr6_table *mrt, bool all) - { - int i; - LIST_HEAD(list); -@@ -1547,8 +1547,9 @@ static void mroute_clean_tables(struct mr6_table *mrt) - * Shut down all active vif entries - */ - for (i = 0; i < mrt->maxvif; i++) { -- if (!(mrt->vif6_table[i].flags & VIFF_STATIC)) -- mif6_delete(mrt, i, &list); -+ if (!all && (mrt->vif6_table[i].flags & VIFF_STATIC)) -+ continue; -+ mif6_delete(mrt, i, &list); - } - unregister_netdevice_many(&list); - -@@ -1557,7 +1558,7 @@ static void mroute_clean_tables(struct mr6_table *mrt) - */ - for (i = 0; i < MFC6_LINES; i++) { - list_for_each_entry_safe(c, next, &mrt->mfc6_cache_array[i], list) { -- if (c->mfc_flags & MFC_STATIC) -+ if (!all && (c->mfc_flags & MFC_STATIC)) - continue; - write_lock_bh(&mrt_lock); - list_del(&c->list); -@@ -1620,7 +1621,7 @@ int ip6mr_sk_done(struct sock *sk) - net->ipv6.devconf_all); - write_unlock_bh(&mrt_lock); - -- mroute_clean_tables(mrt); -+ mroute_clean_tables(mrt, false); - err = 0; - break; - } -diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c -index 734aec059ffd..7ba6180ff8bd 100644 ---- a/net/ipv6/mcast.c -+++ b/net/ipv6/mcast.c -@@ -1441,7 +1441,6 @@ out: - if (!err) { - ICMP6MSGOUT_INC_STATS(net, idev, ICMPV6_MLD2_REPORT); - ICMP6_INC_STATS(net, idev, ICMP6_MIB_OUTMSGS); -- IP6_UPD_PO_STATS(net, idev, IPSTATS_MIB_OUTMCAST, payload_len); - } else { - IP6_INC_STATS(net, idev, IPSTATS_MIB_OUTDISCARDS); - } -@@ -1805,7 +1804,6 @@ out: - if (!err) { - ICMP6MSGOUT_INC_STATS(net, idev, type); - ICMP6_INC_STATS(net, idev, ICMP6_MIB_OUTMSGS); -- IP6_UPD_PO_STATS(net, idev, IPSTATS_MIB_OUTMCAST, full_len); - } else - IP6_INC_STATS(net, idev, IPSTATS_MIB_OUTDISCARDS); - -diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c -index 253566a8d55b..7cd623588532 100644 ---- a/net/ipv6/netfilter/nf_conntrack_reasm.c -+++ b/net/ipv6/netfilter/nf_conntrack_reasm.c -@@ -172,7 +172,7 @@ static void nf_ct_frag6_expire(unsigned long data) - /* Creation primitives. */ - static inline struct frag_queue *fq_find(struct net *net, __be32 id, - u32 user, struct in6_addr *src, -- struct in6_addr *dst, u8 ecn) -+ struct in6_addr *dst, int iif, u8 ecn) - { - struct inet_frag_queue *q; - struct ip6_create_arg arg; -@@ -182,6 +182,7 @@ static inline struct frag_queue *fq_find(struct net *net, __be32 id, - arg.user = user; - arg.src = src; - arg.dst = dst; -+ arg.iif = iif; - arg.ecn = ecn; - - read_lock_bh(&nf_frags.lock); -@@ -590,7 +591,7 @@ struct sk_buff *nf_ct_frag6_gather(struct sk_buff *skb, u32 user) - local_bh_enable(); - - fq = fq_find(net, fhdr->identification, user, &hdr->saddr, &hdr->daddr, -- ip6_frag_ecn(hdr)); -+ skb->dev ? skb->dev->ifindex : 0, ip6_frag_ecn(hdr)); - if (fq == NULL) { - pr_debug("Can't find and can't create new queue\n"); - goto ret_orig; -diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c -index 1aeb473b2cc6..a1fb511da3b5 100644 ---- a/net/ipv6/reassembly.c -+++ b/net/ipv6/reassembly.c -@@ -111,7 +111,10 @@ bool ip6_frag_match(struct inet_frag_queue *q, void *a) - return fq->id == arg->id && - fq->user == arg->user && - ipv6_addr_equal(&fq->saddr, arg->src) && -- ipv6_addr_equal(&fq->daddr, arg->dst); -+ ipv6_addr_equal(&fq->daddr, arg->dst) && -+ (arg->iif == fq->iif || -+ !(ipv6_addr_type(arg->dst) & (IPV6_ADDR_MULTICAST | -+ IPV6_ADDR_LINKLOCAL))); - } - EXPORT_SYMBOL(ip6_frag_match); - -@@ -180,7 +183,7 @@ static void ip6_frag_expire(unsigned long data) - - static __inline__ struct frag_queue * - fq_find(struct net *net, __be32 id, const struct in6_addr *src, -- const struct in6_addr *dst, u8 ecn) -+ const struct in6_addr *dst, int iif, u8 ecn) - { - struct inet_frag_queue *q; - struct ip6_create_arg arg; -@@ -190,6 +193,7 @@ fq_find(struct net *net, __be32 id, const struct in6_addr *src, - arg.user = IP6_DEFRAG_LOCAL_DELIVER; - arg.src = src; - arg.dst = dst; -+ arg.iif = iif; - arg.ecn = ecn; - - read_lock(&ip6_frags.lock); -@@ -558,7 +562,7 @@ static int ipv6_frag_rcv(struct sk_buff *skb) - IPSTATS_MIB_REASMFAILS, evicted); - - fq = fq_find(net, fhdr->identification, &hdr->saddr, &hdr->daddr, -- ip6_frag_ecn(hdr)); -+ skb->dev ? skb->dev->ifindex : 0, ip6_frag_ecn(hdr)); - if (fq != NULL) { - int ret; - -diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c -index a5e62ef57155..f8133ff5b081 100644 ---- a/net/irda/af_irda.c -+++ b/net/irda/af_irda.c -@@ -1105,6 +1105,9 @@ static int irda_create(struct net *net, struct socket *sock, int protocol, - - IRDA_DEBUG(2, "%s()\n", __func__); - -+ if (protocol < 0 || protocol > SK_PROTOCOL_MAX) -+ return -EINVAL; -+ - if (net != &init_net) - return -EAFNOSUPPORT; - -diff --git a/net/sctp/auth.c b/net/sctp/auth.c -index bc2fae7e67be..62433f797f3f 100644 ---- a/net/sctp/auth.c -+++ b/net/sctp/auth.c -@@ -812,8 +812,8 @@ int sctp_auth_ep_set_hmacs(struct sctp_endpoint *ep, - if (!has_sha1) - return -EINVAL; - -- memcpy(ep->auth_hmacs_list->hmac_ids, &hmacs->shmac_idents[0], -- hmacs->shmac_num_idents * sizeof(__u16)); -+ for (i = 0; i < hmacs->shmac_num_idents; i++) -+ ep->auth_hmacs_list->hmac_ids[i] = htons(hmacs->shmac_idents[i]); - ep->auth_hmacs_list->param_hdr.length = htons(sizeof(sctp_paramhdr_t) + - hmacs->shmac_num_idents * sizeof(__u16)); - return 0; -diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c -index 422d8bdacc0d..bee032a7003f 100644 ---- a/net/sctp/ipv6.c -+++ b/net/sctp/ipv6.c -@@ -639,6 +639,7 @@ static struct sock *sctp_v6_create_accept_sk(struct sock *sk, - struct sock *newsk; - struct ipv6_pinfo *newnp, *np = inet6_sk(sk); - struct sctp6_sock *newsctp6sk; -+ struct ipv6_txoptions *opt; - - newsk = sk_alloc(sock_net(sk), PF_INET6, GFP_KERNEL, sk->sk_prot); - if (!newsk) -@@ -658,6 +659,13 @@ static struct sock *sctp_v6_create_accept_sk(struct sock *sk, - - memcpy(newnp, np, sizeof(struct ipv6_pinfo)); - -+ rcu_read_lock(); -+ opt = rcu_dereference(np->opt); -+ if (opt) -+ opt = ipv6_dup_options(newsk, opt); -+ RCU_INIT_POINTER(newnp->opt, opt); -+ rcu_read_unlock(); -+ - /* Initialize sk's sport, dport, rcv_saddr and daddr for getsockname() - * and getpeername(). - */ -diff --git a/net/sctp/socket.c b/net/sctp/socket.c -index ec5766dc3946..80bd61ae5945 100644 ---- a/net/sctp/socket.c -+++ b/net/sctp/socket.c -@@ -6969,6 +6969,9 @@ void sctp_copy_sock(struct sock *newsk, struct sock *sk, - newinet->mc_ttl = 1; - newinet->mc_index = 0; - newinet->mc_list = NULL; -+ -+ if (newsk->sk_flags & SK_FLAGS_TIMESTAMP) -+ net_enable_timestamp(); - } - - static inline void sctp_copy_descendant(struct sock *sk_to, -@@ -7149,6 +7152,13 @@ struct proto sctp_prot = { - - #if IS_ENABLED(CONFIG_IPV6) - -+#include -+static void sctp_v6_destroy_sock(struct sock *sk) -+{ -+ sctp_destroy_sock(sk); -+ inet6_destroy_sock(sk); -+} -+ - struct proto sctpv6_prot = { - .name = "SCTPv6", - .owner = THIS_MODULE, -@@ -7158,7 +7168,7 @@ struct proto sctpv6_prot = { - .accept = sctp_accept, - .ioctl = sctp_ioctl, - .init = sctp_init_sock, -- .destroy = sctp_destroy_sock, -+ .destroy = sctp_v6_destroy_sock, - .shutdown = sctp_shutdown, - .setsockopt = sctp_setsockopt, - .getsockopt = sctp_getsockopt, -diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c -index 825c029bf092..f934e7ba5eb8 100644 ---- a/net/unix/af_unix.c -+++ b/net/unix/af_unix.c -@@ -313,6 +313,118 @@ found: - return s; - } - -+/* Support code for asymmetrically connected dgram sockets -+ * -+ * If a datagram socket is connected to a socket not itself connected -+ * to the first socket (eg, /dev/log), clients may only enqueue more -+ * messages if the present receive queue of the server socket is not -+ * "too large". This means there's a second writeability condition -+ * poll and sendmsg need to test. The dgram recv code will do a wake -+ * up on the peer_wait wait queue of a socket upon reception of a -+ * datagram which needs to be propagated to sleeping would-be writers -+ * since these might not have sent anything so far. This can't be -+ * accomplished via poll_wait because the lifetime of the server -+ * socket might be less than that of its clients if these break their -+ * association with it or if the server socket is closed while clients -+ * are still connected to it and there's no way to inform "a polling -+ * implementation" that it should let go of a certain wait queue -+ * -+ * In order to propagate a wake up, a wait_queue_t of the client -+ * socket is enqueued on the peer_wait queue of the server socket -+ * whose wake function does a wake_up on the ordinary client socket -+ * wait queue. This connection is established whenever a write (or -+ * poll for write) hit the flow control condition and broken when the -+ * association to the server socket is dissolved or after a wake up -+ * was relayed. -+ */ -+ -+static int unix_dgram_peer_wake_relay(wait_queue_t *q, unsigned mode, int flags, -+ void *key) -+{ -+ struct unix_sock *u; -+ wait_queue_head_t *u_sleep; -+ -+ u = container_of(q, struct unix_sock, peer_wake); -+ -+ __remove_wait_queue(&unix_sk(u->peer_wake.private)->peer_wait, -+ q); -+ u->peer_wake.private = NULL; -+ -+ /* relaying can only happen while the wq still exists */ -+ u_sleep = sk_sleep(&u->sk); -+ if (u_sleep) -+ wake_up_interruptible_poll(u_sleep, key); -+ -+ return 0; -+} -+ -+static int unix_dgram_peer_wake_connect(struct sock *sk, struct sock *other) -+{ -+ struct unix_sock *u, *u_other; -+ int rc; -+ -+ u = unix_sk(sk); -+ u_other = unix_sk(other); -+ rc = 0; -+ spin_lock(&u_other->peer_wait.lock); -+ -+ if (!u->peer_wake.private) { -+ u->peer_wake.private = other; -+ __add_wait_queue(&u_other->peer_wait, &u->peer_wake); -+ -+ rc = 1; -+ } -+ -+ spin_unlock(&u_other->peer_wait.lock); -+ return rc; -+} -+ -+static void unix_dgram_peer_wake_disconnect(struct sock *sk, -+ struct sock *other) -+{ -+ struct unix_sock *u, *u_other; -+ -+ u = unix_sk(sk); -+ u_other = unix_sk(other); -+ spin_lock(&u_other->peer_wait.lock); -+ -+ if (u->peer_wake.private == other) { -+ __remove_wait_queue(&u_other->peer_wait, &u->peer_wake); -+ u->peer_wake.private = NULL; -+ } -+ -+ spin_unlock(&u_other->peer_wait.lock); -+} -+ -+static void unix_dgram_peer_wake_disconnect_wakeup(struct sock *sk, -+ struct sock *other) -+{ -+ unix_dgram_peer_wake_disconnect(sk, other); -+ wake_up_interruptible_poll(sk_sleep(sk), -+ POLLOUT | -+ POLLWRNORM | -+ POLLWRBAND); -+} -+ -+/* preconditions: -+ * - unix_peer(sk) == other -+ * - association is stable -+ */ -+static int unix_dgram_peer_wake_me(struct sock *sk, struct sock *other) -+{ -+ int connected; -+ -+ connected = unix_dgram_peer_wake_connect(sk, other); -+ -+ if (unix_recvq_full(other)) -+ return 1; -+ -+ if (connected) -+ unix_dgram_peer_wake_disconnect(sk, other); -+ -+ return 0; -+} -+ - static inline int unix_writable(struct sock *sk) - { - return (atomic_read(&sk->sk_wmem_alloc) << 2) <= sk->sk_sndbuf; -@@ -417,6 +529,8 @@ static void unix_release_sock(struct sock *sk, int embrion) - skpair->sk_state_change(skpair); - sk_wake_async(skpair, SOCK_WAKE_WAITD, POLL_HUP); - } -+ -+ unix_dgram_peer_wake_disconnect(sk, skpair); - sock_put(skpair); /* It may now die */ - unix_peer(sk) = NULL; - } -@@ -650,6 +764,7 @@ static struct sock *unix_create1(struct net *net, struct socket *sock) - INIT_LIST_HEAD(&u->link); - mutex_init(&u->readlock); /* single task reading lock */ - init_waitqueue_head(&u->peer_wait); -+ init_waitqueue_func_entry(&u->peer_wake, unix_dgram_peer_wake_relay); - unix_insert_socket(unix_sockets_unbound(sk), sk); - out: - if (sk == NULL) -@@ -1017,6 +1132,8 @@ restart: - if (unix_peer(sk)) { - struct sock *old_peer = unix_peer(sk); - unix_peer(sk) = other; -+ unix_dgram_peer_wake_disconnect_wakeup(sk, old_peer); -+ - unix_state_double_unlock(sk, other); - - if (other != old_peer) -@@ -1456,6 +1573,7 @@ static int unix_dgram_sendmsg(struct kiocb *kiocb, struct socket *sock, - struct scm_cookie tmp_scm; - int max_level; - int data_len = 0; -+ int sk_locked; - - if (NULL == siocb->scm) - siocb->scm = &tmp_scm; -@@ -1532,12 +1650,14 @@ restart: - goto out_free; - } - -+ sk_locked = 0; - unix_state_lock(other); -+restart_locked: - err = -EPERM; - if (!unix_may_send(sk, other)) - goto out_unlock; - -- if (sock_flag(other, SOCK_DEAD)) { -+ if (unlikely(sock_flag(other, SOCK_DEAD))) { - /* - * Check with 1003.1g - what should - * datagram error -@@ -1545,10 +1665,14 @@ restart: - unix_state_unlock(other); - sock_put(other); - -+ if (!sk_locked) -+ unix_state_lock(sk); -+ - err = 0; -- unix_state_lock(sk); - if (unix_peer(sk) == other) { - unix_peer(sk) = NULL; -+ unix_dgram_peer_wake_disconnect_wakeup(sk, other); -+ - unix_state_unlock(sk); - - unix_dgram_disconnected(sk, other); -@@ -1574,21 +1698,38 @@ restart: - goto out_unlock; - } - -- if (unix_peer(other) != sk && unix_recvq_full(other)) { -- if (!timeo) { -- err = -EAGAIN; -- goto out_unlock; -+ if (unlikely(unix_peer(other) != sk && unix_recvq_full(other))) { -+ if (timeo) { -+ timeo = unix_wait_for_peer(other, timeo); -+ -+ err = sock_intr_errno(timeo); -+ if (signal_pending(current)) -+ goto out_free; -+ -+ goto restart; - } - -- timeo = unix_wait_for_peer(other, timeo); -+ if (!sk_locked) { -+ unix_state_unlock(other); -+ unix_state_double_lock(sk, other); -+ } - -- err = sock_intr_errno(timeo); -- if (signal_pending(current)) -- goto out_free; -+ if (unix_peer(sk) != other || -+ unix_dgram_peer_wake_me(sk, other)) { -+ err = -EAGAIN; -+ sk_locked = 1; -+ goto out_unlock; -+ } - -- goto restart; -+ if (!sk_locked) { -+ sk_locked = 1; -+ goto restart_locked; -+ } - } - -+ if (unlikely(sk_locked)) -+ unix_state_unlock(sk); -+ - if (sock_flag(other, SOCK_RCVTSTAMP)) - __net_timestamp(skb); - maybe_add_creds(skb, sock, other); -@@ -1602,6 +1743,8 @@ restart: - return len; - - out_unlock: -+ if (sk_locked) -+ unix_state_unlock(sk); - unix_state_unlock(other); - out_free: - kfree_skb(skb); -@@ -1791,14 +1934,7 @@ static int unix_dgram_recvmsg(struct kiocb *iocb, struct socket *sock, - if (flags&MSG_OOB) - goto out; - -- err = mutex_lock_interruptible(&u->readlock); -- if (unlikely(err)) { -- /* recvmsg() in non blocking mode is supposed to return -EAGAIN -- * sk_rcvtimeo is not honored by mutex_lock_interruptible() -- */ -- err = noblock ? -EAGAIN : -ERESTARTSYS; -- goto out; -- } -+ mutex_lock(&u->readlock); - - skip = sk_peek_offset(sk, flags); - -@@ -1990,12 +2126,12 @@ again: - - timeo = unix_stream_data_wait(sk, timeo, last); - -- if (signal_pending(current) -- || mutex_lock_interruptible(&u->readlock)) { -+ if (signal_pending(current)) { - err = sock_intr_errno(timeo); - goto out; - } - -+ mutex_lock(&u->readlock); - continue; - unlock: - unix_state_unlock(sk); -@@ -2260,14 +2396,16 @@ static unsigned int unix_dgram_poll(struct file *file, struct socket *sock, - return mask; - - writable = unix_writable(sk); -- other = unix_peer_get(sk); -- if (other) { -- if (unix_peer(other) != sk) { -- sock_poll_wait(file, &unix_sk(other)->peer_wait, wait); -- if (unix_recvq_full(other)) -- writable = 0; -- } -- sock_put(other); -+ if (writable) { -+ unix_state_lock(sk); -+ -+ other = unix_peer(sk); -+ if (other && unix_peer(other) != sk && -+ unix_recvq_full(other) && -+ unix_dgram_peer_wake_me(sk, other)) -+ writable = 0; -+ -+ unix_state_unlock(sk); - } - - if (writable) -diff --git a/security/keys/gc.c b/security/keys/gc.c -index 797818695c87..de34c290bd6f 100644 ---- a/security/keys/gc.c -+++ b/security/keys/gc.c -@@ -187,6 +187,12 @@ static noinline void key_gc_unused_keys(struct list_head *keys) - kdebug("- %u", key->serial); - key_check(key); - -+ /* Throw away the key data if the key is instantiated */ -+ if (test_bit(KEY_FLAG_INSTANTIATED, &key->flags) && -+ !test_bit(KEY_FLAG_NEGATIVE, &key->flags) && -+ key->type->destroy) -+ key->type->destroy(key); -+ - security_key_free(key); - - /* deal with the user's key tracking and quota */ -@@ -201,10 +207,6 @@ static noinline void key_gc_unused_keys(struct list_head *keys) - if (test_bit(KEY_FLAG_INSTANTIATED, &key->flags)) - atomic_dec(&key->user->nikeys); - -- /* now throw away the key memory */ -- if (key->type->destroy) -- key->type->destroy(key); -- - key_user_put(key->user); - - kfree(key->description); -diff --git a/security/keys/keyctl.c b/security/keys/keyctl.c -index 33cfd27b4de2..3242195bfa95 100644 ---- a/security/keys/keyctl.c -+++ b/security/keys/keyctl.c -@@ -744,16 +744,16 @@ long keyctl_read_key(key_serial_t keyid, char __user *buffer, size_t buflen) - - /* the key is probably readable - now try to read it */ - can_read_key: -- ret = key_validate(key); -- if (ret == 0) { -- ret = -EOPNOTSUPP; -- if (key->type->read) { -- /* read the data with the semaphore held (since we -- * might sleep) */ -- down_read(&key->sem); -+ ret = -EOPNOTSUPP; -+ if (key->type->read) { -+ /* Read the data with the semaphore held (since we might sleep) -+ * to protect against the key being updated or revoked. -+ */ -+ down_read(&key->sem); -+ ret = key_validate(key); -+ if (ret == 0) - ret = key->type->read(key, buffer, buflen); -- up_read(&key->sem); -- } -+ up_read(&key->sem); - } - - error2: -diff --git a/security/keys/process_keys.c b/security/keys/process_keys.c -index 42defae1e161..cd871dc8b7c0 100644 ---- a/security/keys/process_keys.c -+++ b/security/keys/process_keys.c -@@ -792,6 +792,7 @@ long join_session_keyring(const char *name) - ret = PTR_ERR(keyring); - goto error2; - } else if (keyring == new->session_keyring) { -+ key_put(keyring); - ret = 0; - goto error2; - } diff --git a/patch/kernel/marvell-default/1-patch-3.10.95-96.patch b/patch/kernel/marvell-default/1-patch-3.10.95-96.patch deleted file mode 100644 index 6c35ece4a6..0000000000 --- a/patch/kernel/marvell-default/1-patch-3.10.95-96.patch +++ /dev/null @@ -1,1497 +0,0 @@ -diff --git a/Makefile b/Makefile -index eb120001bc12..c88ea5d8d19c 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,6 +1,6 @@ - VERSION = 3 - PATCHLEVEL = 10 --SUBLEVEL = 95 -+SUBLEVEL = 96 - EXTRAVERSION = - NAME = TOSSUG Baby Fish - -diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c -index 33a74fc45959..dfad98fda4f8 100644 ---- a/arch/arm64/kernel/ptrace.c -+++ b/arch/arm64/kernel/ptrace.c -@@ -51,6 +51,12 @@ - */ - void ptrace_disable(struct task_struct *child) - { -+ /* -+ * This would be better off in core code, but PTRACE_DETACH has -+ * grown its fair share of arch-specific worts and changing it -+ * is likely to cause regressions on obscure architectures. -+ */ -+ user_disable_single_step(child); - } - - /* -diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c -index ba7477efad5c..5b77586ef0af 100644 ---- a/arch/arm64/mm/mmu.c -+++ b/arch/arm64/mm/mmu.c -@@ -348,6 +348,9 @@ void __init paging_init(void) - - empty_zero_page = virt_to_page(zero_page); - -+ /* Ensure the zero page is visible to the page table walker */ -+ dsb(); -+ - /* - * TTBR0 is only used for the identity mapping at this stage. Make it - * point to zero page to avoid speculatively fetching new entries. -diff --git a/arch/mn10300/Kconfig b/arch/mn10300/Kconfig -index 428da175d073..31b91602f055 100644 ---- a/arch/mn10300/Kconfig -+++ b/arch/mn10300/Kconfig -@@ -2,6 +2,7 @@ config MN10300 - def_bool y - select HAVE_OPROFILE - select HAVE_GENERIC_HARDIRQS -+ select HAVE_UID16 - select GENERIC_IRQ_SHOW - select ARCH_WANT_IPC_PARSE_VERSION - select HAVE_ARCH_TRACEHOOK -@@ -37,9 +38,6 @@ config HIGHMEM - config NUMA - def_bool n - --config UID16 -- def_bool y -- - config RWSEM_GENERIC_SPINLOCK - def_bool y - -diff --git a/arch/openrisc/Kconfig b/arch/openrisc/Kconfig -index 1072bfd18c50..f4dd44a7118f 100644 ---- a/arch/openrisc/Kconfig -+++ b/arch/openrisc/Kconfig -@@ -17,6 +17,7 @@ config OPENRISC - select GENERIC_IRQ_SHOW - select GENERIC_IOMAP - select GENERIC_CPU_DEVICES -+ select HAVE_UID16 - select GENERIC_ATOMIC64 - select GENERIC_CLOCKEVENTS - select GENERIC_STRNCPY_FROM_USER -@@ -29,9 +30,6 @@ config MMU - config HAVE_DMA_ATTRS - def_bool y - --config UID16 -- def_bool y -- - config RWSEM_GENERIC_SPINLOCK - def_bool y - -diff --git a/arch/powerpc/include/asm/cmpxchg.h b/arch/powerpc/include/asm/cmpxchg.h -index e245aab7f191..95b515113186 100644 ---- a/arch/powerpc/include/asm/cmpxchg.h -+++ b/arch/powerpc/include/asm/cmpxchg.h -@@ -18,12 +18,12 @@ __xchg_u32(volatile void *p, unsigned long val) - unsigned long prev; - - __asm__ __volatile__( -- PPC_RELEASE_BARRIER -+ PPC_ATOMIC_ENTRY_BARRIER - "1: lwarx %0,0,%2 \n" - PPC405_ERR77(0,%2) - " stwcx. %3,0,%2 \n\ - bne- 1b" -- PPC_ACQUIRE_BARRIER -+ PPC_ATOMIC_EXIT_BARRIER - : "=&r" (prev), "+m" (*(volatile unsigned int *)p) - : "r" (p), "r" (val) - : "cc", "memory"); -@@ -61,12 +61,12 @@ __xchg_u64(volatile void *p, unsigned long val) - unsigned long prev; - - __asm__ __volatile__( -- PPC_RELEASE_BARRIER -+ PPC_ATOMIC_ENTRY_BARRIER - "1: ldarx %0,0,%2 \n" - PPC405_ERR77(0,%2) - " stdcx. %3,0,%2 \n\ - bne- 1b" -- PPC_ACQUIRE_BARRIER -+ PPC_ATOMIC_EXIT_BARRIER - : "=&r" (prev), "+m" (*(volatile unsigned long *)p) - : "r" (p), "r" (val) - : "cc", "memory"); -@@ -152,14 +152,14 @@ __cmpxchg_u32(volatile unsigned int *p, unsigned long old, unsigned long new) - unsigned int prev; - - __asm__ __volatile__ ( -- PPC_RELEASE_BARRIER -+ PPC_ATOMIC_ENTRY_BARRIER - "1: lwarx %0,0,%2 # __cmpxchg_u32\n\ - cmpw 0,%0,%3\n\ - bne- 2f\n" - PPC405_ERR77(0,%2) - " stwcx. %4,0,%2\n\ - bne- 1b" -- PPC_ACQUIRE_BARRIER -+ PPC_ATOMIC_EXIT_BARRIER - "\n\ - 2:" - : "=&r" (prev), "+m" (*p) -@@ -198,13 +198,13 @@ __cmpxchg_u64(volatile unsigned long *p, unsigned long old, unsigned long new) - unsigned long prev; - - __asm__ __volatile__ ( -- PPC_RELEASE_BARRIER -+ PPC_ATOMIC_ENTRY_BARRIER - "1: ldarx %0,0,%2 # __cmpxchg_u64\n\ - cmpd 0,%0,%3\n\ - bne- 2f\n\ - stdcx. %4,0,%2\n\ - bne- 1b" -- PPC_ACQUIRE_BARRIER -+ PPC_ATOMIC_EXIT_BARRIER - "\n\ - 2:" - : "=&r" (prev), "+m" (*p) -diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h -index 795f67792ea9..60c31698f7d5 100644 ---- a/arch/powerpc/include/asm/reg.h -+++ b/arch/powerpc/include/asm/reg.h -@@ -108,6 +108,7 @@ - #define MSR_TS_T __MASK(MSR_TS_T_LG) /* Transaction Transactional */ - #define MSR_TS_MASK (MSR_TS_T | MSR_TS_S) /* Transaction State bits */ - #define MSR_TM_ACTIVE(x) (((x) & MSR_TS_MASK) != 0) /* Transaction active? */ -+#define MSR_TM_RESV(x) (((x) & MSR_TS_MASK) == MSR_TS_MASK) /* Reserved */ - #define MSR_TM_TRANSACTIONAL(x) (((x) & MSR_TS_MASK) == MSR_TS_T) - #define MSR_TM_SUSPENDED(x) (((x) & MSR_TS_MASK) == MSR_TS_S) - -diff --git a/arch/powerpc/include/asm/synch.h b/arch/powerpc/include/asm/synch.h -index e682a7143edb..c50868681f9e 100644 ---- a/arch/powerpc/include/asm/synch.h -+++ b/arch/powerpc/include/asm/synch.h -@@ -44,7 +44,7 @@ static inline void isync(void) - MAKE_LWSYNC_SECTION_ENTRY(97, __lwsync_fixup); - #define PPC_ACQUIRE_BARRIER "\n" stringify_in_c(__PPC_ACQUIRE_BARRIER) - #define PPC_RELEASE_BARRIER stringify_in_c(LWSYNC) "\n" --#define PPC_ATOMIC_ENTRY_BARRIER "\n" stringify_in_c(LWSYNC) "\n" -+#define PPC_ATOMIC_ENTRY_BARRIER "\n" stringify_in_c(sync) "\n" - #define PPC_ATOMIC_EXIT_BARRIER "\n" stringify_in_c(sync) "\n" - #else - #define PPC_ACQUIRE_BARRIER -diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c -index d9b673b06757..8220ae86252c 100644 ---- a/arch/powerpc/kernel/signal_32.c -+++ b/arch/powerpc/kernel/signal_32.c -@@ -858,6 +858,15 @@ static long restore_tm_user_regs(struct pt_regs *regs, - return 1; - #endif /* CONFIG_SPE */ - -+ /* Get the top half of the MSR from the user context */ -+ if (__get_user(msr_hi, &tm_sr->mc_gregs[PT_MSR])) -+ return 1; -+ msr_hi <<= 32; -+ /* If TM bits are set to the reserved value, it's an invalid context */ -+ if (MSR_TM_RESV(msr_hi)) -+ return 1; -+ /* Pull in the MSR TM bits from the user context */ -+ regs->msr = (regs->msr & ~MSR_TS_MASK) | (msr_hi & MSR_TS_MASK); - /* Now, recheckpoint. This loads up all of the checkpointed (older) - * registers, including FP and V[S]Rs. After recheckpointing, the - * transactional versions should be loaded. -@@ -867,11 +876,6 @@ static long restore_tm_user_regs(struct pt_regs *regs, - current->thread.tm_texasr |= TEXASR_FS; - /* This loads the checkpointed FP/VEC state, if used */ - tm_recheckpoint(¤t->thread, msr); -- /* Get the top half of the MSR */ -- if (__get_user(msr_hi, &tm_sr->mc_gregs[PT_MSR])) -- return 1; -- /* Pull in MSR TM from user context */ -- regs->msr = (regs->msr & ~MSR_TS_MASK) | ((msr_hi<<32) & MSR_TS_MASK); - - /* This loads the speculative FP/VEC state, if used */ - if (msr & MSR_FP) { -diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c -index 74d9615a6bb6..2419c17538e2 100644 ---- a/arch/powerpc/kernel/signal_64.c -+++ b/arch/powerpc/kernel/signal_64.c -@@ -416,6 +416,10 @@ static long restore_tm_sigcontexts(struct pt_regs *regs, - - /* get MSR separately, transfer the LE bit if doing signal return */ - err |= __get_user(msr, &sc->gp_regs[PT_MSR]); -+ /* Don't allow reserved mode. */ -+ if (MSR_TM_RESV(msr)) -+ return -EINVAL; -+ - /* pull in MSR TM from user context */ - regs->msr = (regs->msr & ~MSR_TS_MASK) | (msr & MSR_TS_MASK); - -diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c -index 102ad8a255f3..466fbd54e7f8 100644 ---- a/arch/powerpc/kvm/book3s_hv.c -+++ b/arch/powerpc/kvm/book3s_hv.c -@@ -160,6 +160,12 @@ void kvmppc_core_vcpu_put(struct kvm_vcpu *vcpu) - - void kvmppc_set_msr(struct kvm_vcpu *vcpu, u64 msr) - { -+ /* -+ * Check for illegal transactional state bit combination -+ * and if we find it, force the TS field to a safe state. -+ */ -+ if ((msr & MSR_TS_MASK) == MSR_TS_MASK) -+ msr &= ~MSR_TS_MASK; - vcpu->arch.shregs.msr = msr; - kvmppc_end_cede(vcpu); - } -diff --git a/arch/x86/include/asm/boot.h b/arch/x86/include/asm/boot.h -index 4fa687a47a62..6b8d6e8cd449 100644 ---- a/arch/x86/include/asm/boot.h -+++ b/arch/x86/include/asm/boot.h -@@ -27,7 +27,7 @@ - #define BOOT_HEAP_SIZE 0x400000 - #else /* !CONFIG_KERNEL_BZIP2 */ - --#define BOOT_HEAP_SIZE 0x8000 -+#define BOOT_HEAP_SIZE 0x10000 - - #endif /* !CONFIG_KERNEL_BZIP2 */ - -diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c -index 90fd1195f276..abfc89b3b55a 100644 ---- a/arch/x86/kernel/reboot.c -+++ b/arch/x86/kernel/reboot.c -@@ -366,6 +366,14 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = { - DMI_MATCH(DMI_BOARD_NAME, "P4S800"), - }, - }, -+ { /* Handle problems with rebooting on the iMac10,1. */ -+ .callback = set_pci_reboot, -+ .ident = "Apple iMac10,1", -+ .matches = { -+ DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."), -+ DMI_MATCH(DMI_PRODUCT_NAME, "iMac10,1"), -+ }, -+ }, - - { /* Handle reboot issue on Acer Aspire one */ - .callback = set_kbd_reboot, -diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c -index 66deef41512f..f11fd597c5b6 100644 ---- a/arch/x86/kernel/signal.c -+++ b/arch/x86/kernel/signal.c -@@ -686,12 +686,15 @@ handle_signal(struct ksignal *ksig, struct pt_regs *regs) - signal_setup_done(failed, ksig, test_thread_flag(TIF_SINGLESTEP)); - } - --#ifdef CONFIG_X86_32 --#define NR_restart_syscall __NR_restart_syscall --#else /* !CONFIG_X86_32 */ --#define NR_restart_syscall \ -- test_thread_flag(TIF_IA32) ? __NR_ia32_restart_syscall : __NR_restart_syscall --#endif /* CONFIG_X86_32 */ -+static inline unsigned long get_nr_restart_syscall(const struct pt_regs *regs) -+{ -+#if defined(CONFIG_X86_32) || !defined(CONFIG_X86_64) -+ return __NR_restart_syscall; -+#else /* !CONFIG_X86_32 && CONFIG_X86_64 */ -+ return test_thread_flag(TIF_IA32) ? __NR_ia32_restart_syscall : -+ __NR_restart_syscall | (regs->orig_ax & __X32_SYSCALL_BIT); -+#endif /* CONFIG_X86_32 || !CONFIG_X86_64 */ -+} - - /* - * Note that 'init' is a special process: it doesn't get signals it doesn't -@@ -720,7 +723,7 @@ static void do_signal(struct pt_regs *regs) - break; - - case -ERESTART_RESTARTBLOCK: -- regs->ax = NR_restart_syscall; -+ regs->ax = get_nr_restart_syscall(regs); - regs->ip -= 2; - break; - } -diff --git a/arch/x86/xen/suspend.c b/arch/x86/xen/suspend.c -index 45329c8c226e..39e12c10b931 100644 ---- a/arch/x86/xen/suspend.c -+++ b/arch/x86/xen/suspend.c -@@ -30,7 +30,8 @@ void xen_arch_hvm_post_suspend(int suspend_cancelled) - { - #ifdef CONFIG_XEN_PVHVM - int cpu; -- xen_hvm_init_shared_info(); -+ if (!suspend_cancelled) -+ xen_hvm_init_shared_info(); - xen_callback_vector(); - xen_unplug_emulated_devices(); - if (xen_feature(XENFEAT_hvm_safe_pvclock)) { -diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c -index 02cc352d8bcc..a67ac2a71155 100644 ---- a/drivers/char/ipmi/ipmi_si_intf.c -+++ b/drivers/char/ipmi/ipmi_si_intf.c -@@ -1144,14 +1144,14 @@ static int smi_start_processing(void *send_info, - - new_smi->intf = intf; - -- /* Try to claim any interrupts. */ -- if (new_smi->irq_setup) -- new_smi->irq_setup(new_smi); -- - /* Set up the timer that drives the interface. */ - setup_timer(&new_smi->si_timer, smi_timeout, (long)new_smi); - smi_mod_timer(new_smi, jiffies + SI_TIMEOUT_JIFFIES); - -+ /* Try to claim any interrupts. */ -+ if (new_smi->irq_setup) -+ new_smi->irq_setup(new_smi); -+ - /* - * Check if the user forcefully enabled the daemon. - */ -diff --git a/drivers/connector/connector.c b/drivers/connector/connector.c -index 0daa11e418b1..bdbd80415908 100644 ---- a/drivers/connector/connector.c -+++ b/drivers/connector/connector.c -@@ -154,26 +154,21 @@ static int cn_call_callback(struct sk_buff *skb) - * - * It checks skb, netlink header and msg sizes, and calls callback helper. - */ --static void cn_rx_skb(struct sk_buff *__skb) -+static void cn_rx_skb(struct sk_buff *skb) - { - struct nlmsghdr *nlh; -- struct sk_buff *skb; - int len, err; - -- skb = skb_get(__skb); -- - if (skb->len >= NLMSG_HDRLEN) { - nlh = nlmsg_hdr(skb); - len = nlmsg_len(nlh); - - if (len < (int)sizeof(struct cn_msg) || - skb->len < nlh->nlmsg_len || -- len > CONNECTOR_MAX_MSG_SIZE) { -- kfree_skb(skb); -+ len > CONNECTOR_MAX_MSG_SIZE) - return; -- } - -- err = cn_call_callback(skb); -+ err = cn_call_callback(skb_get(skb)); - if (err < 0) - kfree_skb(skb); - } -diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c -index 2bd798a7d9aa..c1a8cf2d490b 100644 ---- a/drivers/hid/hid-core.c -+++ b/drivers/hid/hid-core.c -@@ -1462,7 +1462,7 @@ int hid_connect(struct hid_device *hdev, unsigned int connect_mask) - "Multi-Axis Controller" - }; - const char *type, *bus; -- char buf[64]; -+ char buf[64] = ""; - unsigned int i; - int len; - int ret; -diff --git a/drivers/isdn/i4l/isdn_ppp.c b/drivers/isdn/i4l/isdn_ppp.c -index 38ceac5053a0..0ed6731396ef 100644 ---- a/drivers/isdn/i4l/isdn_ppp.c -+++ b/drivers/isdn/i4l/isdn_ppp.c -@@ -301,6 +301,8 @@ isdn_ppp_open(int min, struct file *file) - is->compflags = 0; - - is->reset = isdn_ppp_ccp_reset_alloc(is); -+ if (!is->reset) -+ return -ENOMEM; - - is->lp = NULL; - is->mp_seqno = 0; /* MP sequence number */ -@@ -320,6 +322,10 @@ isdn_ppp_open(int min, struct file *file) - * VJ header compression init - */ - is->slcomp = slhc_init(16, 16); /* not necessary for 2. link in bundle */ -+ if (IS_ERR(is->slcomp)) { -+ isdn_ppp_ccp_reset_free(is); -+ return PTR_ERR(is->slcomp); -+ } - #endif - #ifdef CONFIG_IPPP_FILTER - is->pass_filter = NULL; -@@ -568,10 +574,8 @@ isdn_ppp_ioctl(int min, struct file *file, unsigned int cmd, unsigned long arg) - is->maxcid = val; - #ifdef CONFIG_ISDN_PPP_VJ - sltmp = slhc_init(16, val); -- if (!sltmp) { -- printk(KERN_ERR "ippp, can't realloc slhc struct\n"); -- return -ENOMEM; -- } -+ if (IS_ERR(sltmp)) -+ return PTR_ERR(sltmp); - if (is->slcomp) - slhc_free(is->slcomp); - is->slcomp = sltmp; -diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c -index 5a1897d86e94..a2d7d5f066f1 100644 ---- a/drivers/net/ppp/ppp_generic.c -+++ b/drivers/net/ppp/ppp_generic.c -@@ -716,10 +716,8 @@ static long ppp_ioctl(struct file *file, unsigned int cmd, unsigned long arg) - val &= 0xffff; - } - vj = slhc_init(val2+1, val+1); -- if (!vj) { -- netdev_err(ppp->dev, -- "PPP: no memory (VJ compressor)\n"); -- err = -ENOMEM; -+ if (IS_ERR(vj)) { -+ err = PTR_ERR(vj); - break; - } - ppp_lock(ppp); -diff --git a/drivers/net/slip/slhc.c b/drivers/net/slip/slhc.c -index 1252d9c726a7..b52eabc168a0 100644 ---- a/drivers/net/slip/slhc.c -+++ b/drivers/net/slip/slhc.c -@@ -84,8 +84,9 @@ static long decode(unsigned char **cpp); - static unsigned char * put16(unsigned char *cp, unsigned short x); - static unsigned short pull16(unsigned char **cpp); - --/* Initialize compression data structure -+/* Allocate compression data structure - * slots must be in range 0 to 255 (zero meaning no compression) -+ * Returns pointer to structure or ERR_PTR() on error. - */ - struct slcompress * - slhc_init(int rslots, int tslots) -@@ -94,11 +95,14 @@ slhc_init(int rslots, int tslots) - register struct cstate *ts; - struct slcompress *comp; - -+ if (rslots < 0 || rslots > 255 || tslots < 0 || tslots > 255) -+ return ERR_PTR(-EINVAL); -+ - comp = kzalloc(sizeof(struct slcompress), GFP_KERNEL); - if (! comp) - goto out_fail; - -- if ( rslots > 0 && rslots < 256 ) { -+ if (rslots > 0) { - size_t rsize = rslots * sizeof(struct cstate); - comp->rstate = kzalloc(rsize, GFP_KERNEL); - if (! comp->rstate) -@@ -106,7 +110,7 @@ slhc_init(int rslots, int tslots) - comp->rslot_limit = rslots - 1; - } - -- if ( tslots > 0 && tslots < 256 ) { -+ if (tslots > 0) { - size_t tsize = tslots * sizeof(struct cstate); - comp->tstate = kzalloc(tsize, GFP_KERNEL); - if (! comp->tstate) -@@ -141,7 +145,7 @@ out_free2: - out_free: - kfree(comp); - out_fail: -- return NULL; -+ return ERR_PTR(-ENOMEM); - } - - -diff --git a/drivers/net/slip/slip.c b/drivers/net/slip/slip.c -index a34d6bf5e43b..ca3e73753fb8 100644 ---- a/drivers/net/slip/slip.c -+++ b/drivers/net/slip/slip.c -@@ -163,7 +163,7 @@ static int sl_alloc_bufs(struct slip *sl, int mtu) - if (cbuff == NULL) - goto err_exit; - slcomp = slhc_init(16, 16); -- if (slcomp == NULL) -+ if (IS_ERR(slcomp)) - goto err_exit; - #endif - spin_lock_bh(&sl->lock); -diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c -index 14179a6593ef..5225d4321e7c 100644 ---- a/drivers/net/team/team.c -+++ b/drivers/net/team/team.c -@@ -1636,10 +1636,10 @@ static int team_vlan_rx_kill_vid(struct net_device *dev, __be16 proto, u16 vid) - struct team *team = netdev_priv(dev); - struct team_port *port; - -- rcu_read_lock(); -- list_for_each_entry_rcu(port, &team->port_list, list) -+ mutex_lock(&team->lock); -+ list_for_each_entry(port, &team->port_list, list) - vlan_vid_del(port->dev, proto, vid); -- rcu_read_unlock(); -+ mutex_unlock(&team->lock); - - return 0; - } -diff --git a/drivers/net/veth.c b/drivers/net/veth.c -index 177f911f5946..cc6d3f987436 100644 ---- a/drivers/net/veth.c -+++ b/drivers/net/veth.c -@@ -116,12 +116,6 @@ static netdev_tx_t veth_xmit(struct sk_buff *skb, struct net_device *dev) - kfree_skb(skb); - goto drop; - } -- /* don't change ip_summed == CHECKSUM_PARTIAL, as that -- * will cause bad checksum on forwarded packets -- */ -- if (skb->ip_summed == CHECKSUM_NONE && -- rcv->features & NETIF_F_RXCSUM) -- skb->ip_summed = CHECKSUM_UNNECESSARY; - - if (likely(dev_forward_skb(rcv, skb) == NET_RX_SUCCESS)) { - struct pcpu_vstats *stats = this_cpu_ptr(dev->vstats); -diff --git a/drivers/parisc/iommu-helpers.h b/drivers/parisc/iommu-helpers.h -index 8c33491b21fe..c6aa38883466 100644 ---- a/drivers/parisc/iommu-helpers.h -+++ b/drivers/parisc/iommu-helpers.h -@@ -104,7 +104,11 @@ iommu_coalesce_chunks(struct ioc *ioc, struct device *dev, - struct scatterlist *contig_sg; /* contig chunk head */ - unsigned long dma_offset, dma_len; /* start/len of DMA stream */ - unsigned int n_mappings = 0; -- unsigned int max_seg_size = dma_get_max_seg_size(dev); -+ unsigned int max_seg_size = min(dma_get_max_seg_size(dev), -+ (unsigned)DMA_CHUNK_SIZE); -+ unsigned int max_seg_boundary = dma_get_seg_boundary(dev) + 1; -+ if (max_seg_boundary) /* check if the addition above didn't overflow */ -+ max_seg_size = min(max_seg_size, max_seg_boundary); - - while (nents > 0) { - -@@ -139,14 +143,11 @@ iommu_coalesce_chunks(struct ioc *ioc, struct device *dev, - - /* - ** First make sure current dma stream won't -- ** exceed DMA_CHUNK_SIZE if we coalesce the -+ ** exceed max_seg_size if we coalesce the - ** next entry. - */ -- if(unlikely(ALIGN(dma_len + dma_offset + startsg->length, -- IOVP_SIZE) > DMA_CHUNK_SIZE)) -- break; -- -- if (startsg->length + dma_len > max_seg_size) -+ if (unlikely(ALIGN(dma_len + dma_offset + startsg->length, IOVP_SIZE) > -+ max_seg_size)) - break; - - /* -diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c -index a3431e90345f..4dc18615cd0f 100644 ---- a/drivers/usb/host/xhci.c -+++ b/drivers/usb/host/xhci.c -@@ -4615,8 +4615,16 @@ int xhci_update_hub_device(struct usb_hcd *hcd, struct usb_device *hdev, - ctrl_ctx->add_flags |= cpu_to_le32(SLOT_FLAG); - slot_ctx = xhci_get_slot_ctx(xhci, config_cmd->in_ctx); - slot_ctx->dev_info |= cpu_to_le32(DEV_HUB); -+ /* -+ * refer to section 6.2.2: MTT should be 0 for full speed hub, -+ * but it may be already set to 1 when setup an xHCI virtual -+ * device, so clear it anyway. -+ */ - if (tt->multi) - slot_ctx->dev_info |= cpu_to_le32(DEV_MTT); -+ else if (hdev->speed == USB_SPEED_FULL) -+ slot_ctx->dev_info &= cpu_to_le32(~DEV_MTT); -+ - if (xhci->hci_version > 0x95) { - xhci_dbg(xhci, "xHCI version %x needs hub " - "TT think time and number of ports\n", -@@ -4807,6 +4815,10 @@ static int __init xhci_hcd_init(void) - BUILD_BUG_ON(sizeof(struct xhci_intr_reg) != 8*32/8); - /* xhci_run_regs has eight fields and embeds 128 xhci_intr_regs */ - BUILD_BUG_ON(sizeof(struct xhci_run_regs) != (8+8*128)*32/8); -+ -+ if (usb_disabled()) -+ return -ENODEV; -+ - return 0; - unreg_pci: - xhci_unregister_pci(); -diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c -index 25522e98602e..72c14d7d604f 100644 ---- a/drivers/usb/serial/cp210x.c -+++ b/drivers/usb/serial/cp210x.c -@@ -160,6 +160,7 @@ static const struct usb_device_id id_table[] = { - { USB_DEVICE(0x17F4, 0xAAAA) }, /* Wavesense Jazz blood glucose meter */ - { USB_DEVICE(0x1843, 0x0200) }, /* Vaisala USB Instrument Cable */ - { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */ -+ { USB_DEVICE(0x18EF, 0xE025) }, /* ELV Marble Sound Board 1 */ - { USB_DEVICE(0x1ADB, 0x0001) }, /* Schweitzer Engineering C662 Cable */ - { USB_DEVICE(0x1B1C, 0x1C00) }, /* Corsair USB Dongle */ - { USB_DEVICE(0x1BA4, 0x0002) }, /* Silicon Labs 358x factory default */ -diff --git a/drivers/usb/serial/ipaq.c b/drivers/usb/serial/ipaq.c -index 76c9a847da5d..e03900e8c667 100644 ---- a/drivers/usb/serial/ipaq.c -+++ b/drivers/usb/serial/ipaq.c -@@ -532,7 +532,8 @@ static int ipaq_open(struct tty_struct *tty, - * through. Since this has a reasonably high failure rate, we retry - * several times. - */ -- while (retries--) { -+ while (retries) { -+ retries--; - result = usb_control_msg(serial->dev, - usb_sndctrlpipe(serial->dev, 0), 0x22, 0x21, - 0x1, 0, NULL, 0, 100); -diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c -index e68205cbc46e..3d8e6098cd40 100644 ---- a/drivers/xen/gntdev.c -+++ b/drivers/xen/gntdev.c -@@ -770,7 +770,7 @@ static int gntdev_mmap(struct file *flip, struct vm_area_struct *vma) - - vma->vm_ops = &gntdev_vmops; - -- vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP; -+ vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP | VM_IO; - - if (use_ptemod) - vma->vm_flags |= VM_DONTCOPY; -diff --git a/include/linux/sched.h b/include/linux/sched.h -index 7cf305d036db..4781332f2e11 100644 ---- a/include/linux/sched.h -+++ b/include/linux/sched.h -@@ -670,6 +670,7 @@ struct user_struct { - unsigned long mq_bytes; /* How many bytes can be allocated to mqueue? */ - #endif - unsigned long locked_shm; /* How many pages of mlocked shm ? */ -+ unsigned long unix_inflight; /* How many files in flight in unix sockets */ - - #ifdef CONFIG_KEYS - struct key *uid_keyring; /* UID specific keyring */ -diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h -index 84662ecc7b51..e1bc430133f4 100644 ---- a/include/linux/syscalls.h -+++ b/include/linux/syscalls.h -@@ -498,7 +498,7 @@ asmlinkage long sys_chown(const char __user *filename, - asmlinkage long sys_lchown(const char __user *filename, - uid_t user, gid_t group); - asmlinkage long sys_fchown(unsigned int fd, uid_t user, gid_t group); --#ifdef CONFIG_UID16 -+#ifdef CONFIG_HAVE_UID16 - asmlinkage long sys_chown16(const char __user *filename, - old_uid_t user, old_gid_t group); - asmlinkage long sys_lchown16(const char __user *filename, -diff --git a/include/linux/types.h b/include/linux/types.h -index 4d118ba11349..83db8e5974dc 100644 ---- a/include/linux/types.h -+++ b/include/linux/types.h -@@ -35,7 +35,7 @@ typedef __kernel_gid16_t gid16_t; - - typedef unsigned long uintptr_t; - --#ifdef CONFIG_UID16 -+#ifdef CONFIG_HAVE_UID16 - /* This is defined by include/asm-{arch}/posix_types.h */ - typedef __kernel_old_uid_t old_uid_t; - typedef __kernel_old_gid_t old_gid_t; -diff --git a/net/bridge/br_stp_if.c b/net/bridge/br_stp_if.c -index 886f6d6dc48a..3995a66c3e4e 100644 ---- a/net/bridge/br_stp_if.c -+++ b/net/bridge/br_stp_if.c -@@ -128,7 +128,10 @@ static void br_stp_start(struct net_bridge *br) - char *argv[] = { BR_STP_PROG, br->dev->name, "start", NULL }; - char *envp[] = { NULL }; - -- r = call_usermodehelper(BR_STP_PROG, argv, envp, UMH_WAIT_PROC); -+ if (net_eq(dev_net(br->dev), &init_net)) -+ r = call_usermodehelper(BR_STP_PROG, argv, envp, UMH_WAIT_PROC); -+ else -+ r = -ENOENT; - - spin_lock_bh(&br->lock); - -diff --git a/net/core/dst.c b/net/core/dst.c -index 01f9980af86e..1bf6842b89b8 100644 ---- a/net/core/dst.c -+++ b/net/core/dst.c -@@ -280,10 +280,11 @@ void dst_release(struct dst_entry *dst) - { - if (dst) { - int newrefcnt; -+ unsigned short nocache = dst->flags & DST_NOCACHE; - - newrefcnt = atomic_dec_return(&dst->__refcnt); - WARN_ON(newrefcnt < 0); -- if (!newrefcnt && unlikely(dst->flags & DST_NOCACHE)) -+ if (!newrefcnt && unlikely(nocache)) - call_rcu(&dst->rcu_head, dst_destroy_rcu); - } - } -diff --git a/net/ipv4/tcp_yeah.c b/net/ipv4/tcp_yeah.c -index 05c3b6f0e8e1..bf8321d6f2ef 100644 ---- a/net/ipv4/tcp_yeah.c -+++ b/net/ipv4/tcp_yeah.c -@@ -222,7 +222,7 @@ static u32 tcp_yeah_ssthresh(struct sock *sk) { - yeah->fast_count = 0; - yeah->reno_count = max(yeah->reno_count>>1, 2U); - -- return tp->snd_cwnd - reduction; -+ return max_t(int, tp->snd_cwnd - reduction, 2); - } - - static struct tcp_congestion_ops tcp_yeah __read_mostly = { -diff --git a/net/ipv6/addrlabel.c b/net/ipv6/addrlabel.c -index b30ad3741b46..d5c918975c8c 100644 ---- a/net/ipv6/addrlabel.c -+++ b/net/ipv6/addrlabel.c -@@ -558,7 +558,7 @@ static int ip6addrlbl_get(struct sk_buff *in_skb, struct nlmsghdr* nlh) - - rcu_read_lock(); - p = __ipv6_addr_label(net, addr, ipv6_addr_type(addr), ifal->ifal_index); -- if (p && ip6addrlbl_hold(p)) -+ if (p && !ip6addrlbl_hold(p)) - p = NULL; - lseq = ip6addrlbl_table.seq; - rcu_read_unlock(); -diff --git a/net/phonet/af_phonet.c b/net/phonet/af_phonet.c -index 5a940dbd74a3..f0229223bf91 100644 ---- a/net/phonet/af_phonet.c -+++ b/net/phonet/af_phonet.c -@@ -377,6 +377,10 @@ static int phonet_rcv(struct sk_buff *skb, struct net_device *dev, - struct sockaddr_pn sa; - u16 len; - -+ skb = skb_share_check(skb, GFP_ATOMIC); -+ if (!skb) -+ return NET_RX_DROP; -+ - /* check we have at least a full Phonet header */ - if (!pskb_pull(skb, sizeof(struct phonethdr))) - goto out; -diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c -index c52763a26297..d9cbecb62aca 100644 ---- a/net/sctp/sm_statefuns.c -+++ b/net/sctp/sm_statefuns.c -@@ -4835,7 +4835,8 @@ sctp_disposition_t sctp_sf_do_9_1_prm_abort( - - retval = SCTP_DISPOSITION_CONSUME; - -- sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(abort)); -+ if (abort) -+ sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(abort)); - - /* Even if we can't send the ABORT due to low memory delete the - * TCB. This is a departure from our typical NOMEM handling. -@@ -4972,7 +4973,8 @@ sctp_disposition_t sctp_sf_cookie_wait_prm_abort( - SCTP_TO(SCTP_EVENT_TIMEOUT_T1_INIT)); - retval = SCTP_DISPOSITION_CONSUME; - -- sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(abort)); -+ if (abort) -+ sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(abort)); - - sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE, - SCTP_STATE(SCTP_STATE_CLOSED)); -diff --git a/net/sctp/socket.c b/net/sctp/socket.c -index 80bd61ae5945..bdc3fb66717d 100644 ---- a/net/sctp/socket.c -+++ b/net/sctp/socket.c -@@ -1533,8 +1533,7 @@ SCTP_STATIC void sctp_close(struct sock *sk, long timeout) - struct sctp_chunk *chunk; - - chunk = sctp_make_abort_user(asoc, NULL, 0); -- if (chunk) -- sctp_primitive_ABORT(net, asoc, chunk); -+ sctp_primitive_ABORT(net, asoc, chunk); - } else - sctp_primitive_SHUTDOWN(net, asoc, NULL); - } -diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c -index f934e7ba5eb8..a673c1f4f638 100644 ---- a/net/unix/af_unix.c -+++ b/net/unix/af_unix.c -@@ -1483,6 +1483,21 @@ static void unix_destruct_scm(struct sk_buff *skb) - sock_wfree(skb); - } - -+/* -+ * The "user->unix_inflight" variable is protected by the garbage -+ * collection lock, and we just read it locklessly here. If you go -+ * over the limit, there might be a tiny race in actually noticing -+ * it across threads. Tough. -+ */ -+static inline bool too_many_unix_fds(struct task_struct *p) -+{ -+ struct user_struct *user = current_user(); -+ -+ if (unlikely(user->unix_inflight > task_rlimit(p, RLIMIT_NOFILE))) -+ return !capable(CAP_SYS_RESOURCE) && !capable(CAP_SYS_ADMIN); -+ return false; -+} -+ - #define MAX_RECURSION_LEVEL 4 - - static int unix_attach_fds(struct scm_cookie *scm, struct sk_buff *skb) -@@ -1491,6 +1506,9 @@ static int unix_attach_fds(struct scm_cookie *scm, struct sk_buff *skb) - unsigned char max_level = 0; - int unix_sock_count = 0; - -+ if (too_many_unix_fds(current)) -+ return -ETOOMANYREFS; -+ - for (i = scm->fp->count - 1; i >= 0; i--) { - struct sock *sk = unix_get_socket(scm->fp->fp[i]); - -@@ -1512,10 +1530,8 @@ static int unix_attach_fds(struct scm_cookie *scm, struct sk_buff *skb) - if (!UNIXCB(skb).fp) - return -ENOMEM; - -- if (unix_sock_count) { -- for (i = scm->fp->count - 1; i >= 0; i--) -- unix_inflight(scm->fp->fp[i]); -- } -+ for (i = scm->fp->count - 1; i >= 0; i--) -+ unix_inflight(scm->fp->fp[i]); - return max_level; - } - -@@ -1934,7 +1950,14 @@ static int unix_dgram_recvmsg(struct kiocb *iocb, struct socket *sock, - if (flags&MSG_OOB) - goto out; - -- mutex_lock(&u->readlock); -+ err = mutex_lock_interruptible(&u->readlock); -+ if (unlikely(err)) { -+ /* recvmsg() in non blocking mode is supposed to return -EAGAIN -+ * sk_rcvtimeo is not honored by mutex_lock_interruptible() -+ */ -+ err = noblock ? -EAGAIN : -ERESTARTSYS; -+ goto out; -+ } - - skip = sk_peek_offset(sk, flags); - -@@ -2083,14 +2106,7 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock, - memset(&tmp_scm, 0, sizeof(tmp_scm)); - } - -- err = mutex_lock_interruptible(&u->readlock); -- if (unlikely(err)) { -- /* recvmsg() in non blocking mode is supposed to return -EAGAIN -- * sk_rcvtimeo is not honored by mutex_lock_interruptible() -- */ -- err = noblock ? -EAGAIN : -ERESTARTSYS; -- goto out; -- } -+ mutex_lock(&u->readlock); - - do { - int chunk; -diff --git a/net/unix/garbage.c b/net/unix/garbage.c -index 9bc73f87f64a..06730fe6ad9d 100644 ---- a/net/unix/garbage.c -+++ b/net/unix/garbage.c -@@ -125,9 +125,12 @@ struct sock *unix_get_socket(struct file *filp) - void unix_inflight(struct file *fp) - { - struct sock *s = unix_get_socket(fp); -+ -+ spin_lock(&unix_gc_lock); -+ - if (s) { - struct unix_sock *u = unix_sk(s); -- spin_lock(&unix_gc_lock); -+ - if (atomic_long_inc_return(&u->inflight) == 1) { - BUG_ON(!list_empty(&u->link)); - list_add_tail(&u->link, &gc_inflight_list); -@@ -135,22 +138,27 @@ void unix_inflight(struct file *fp) - BUG_ON(list_empty(&u->link)); - } - unix_tot_inflight++; -- spin_unlock(&unix_gc_lock); - } -+ fp->f_cred->user->unix_inflight++; -+ spin_unlock(&unix_gc_lock); - } - - void unix_notinflight(struct file *fp) - { - struct sock *s = unix_get_socket(fp); -+ -+ spin_lock(&unix_gc_lock); -+ - if (s) { - struct unix_sock *u = unix_sk(s); -- spin_lock(&unix_gc_lock); -+ - BUG_ON(list_empty(&u->link)); - if (atomic_long_dec_and_test(&u->inflight)) - list_del_init(&u->link); - unix_tot_inflight--; -- spin_unlock(&unix_gc_lock); - } -+ fp->f_cred->user->unix_inflight--; -+ spin_unlock(&unix_gc_lock); - } - - static void scan_inflight(struct sock *x, void (*func)(struct unix_sock *), -diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl -index 679218b56ede..f94f6a2d6988 100755 ---- a/scripts/recordmcount.pl -+++ b/scripts/recordmcount.pl -@@ -265,7 +265,8 @@ if ($arch eq "x86_64") { - - } elsif ($arch eq "powerpc") { - $local_regex = "^[0-9a-fA-F]+\\s+t\\s+(\\.?\\S+)"; -- $function_regex = "^([0-9a-fA-F]+)\\s+<(\\.?.*?)>:"; -+ # See comment in the sparc64 section for why we use '\w'. -+ $function_regex = "^([0-9a-fA-F]+)\\s+<(\\.?\\w*?)>:"; - $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\s\\.?_mcount\$"; - - if ($bits == 64) { -diff --git a/sound/core/control.c b/sound/core/control.c -index f2082a35b890..3fcead61f0ef 100644 ---- a/sound/core/control.c -+++ b/sound/core/control.c -@@ -1325,6 +1325,8 @@ static int snd_ctl_tlv_ioctl(struct snd_ctl_file *file, - return -EFAULT; - if (tlv.length < sizeof(unsigned int) * 2) - return -EINVAL; -+ if (!tlv.numid) -+ return -EINVAL; - down_read(&card->controls_rwsem); - kctl = snd_ctl_find_numid(card, tlv.numid); - if (kctl == NULL) { -diff --git a/sound/core/hrtimer.c b/sound/core/hrtimer.c -index b8b31c433d64..14d483d6b3b0 100644 ---- a/sound/core/hrtimer.c -+++ b/sound/core/hrtimer.c -@@ -90,7 +90,7 @@ static int snd_hrtimer_start(struct snd_timer *t) - struct snd_hrtimer *stime = t->private_data; - - atomic_set(&stime->running, 0); -- hrtimer_cancel(&stime->hrt); -+ hrtimer_try_to_cancel(&stime->hrt); - hrtimer_start(&stime->hrt, ns_to_ktime(t->sticks * resolution), - HRTIMER_MODE_REL); - atomic_set(&stime->running, 1); -@@ -101,6 +101,7 @@ static int snd_hrtimer_stop(struct snd_timer *t) - { - struct snd_hrtimer *stime = t->private_data; - atomic_set(&stime->running, 0); -+ hrtimer_try_to_cancel(&stime->hrt); - return 0; - } - -diff --git a/sound/core/pcm_compat.c b/sound/core/pcm_compat.c -index c4ac3c1e19af..1bb1a43c7d03 100644 ---- a/sound/core/pcm_compat.c -+++ b/sound/core/pcm_compat.c -@@ -236,10 +236,15 @@ static int snd_pcm_ioctl_hw_params_compat(struct snd_pcm_substream *substream, - if (! (runtime = substream->runtime)) - return -ENOTTY; - -- /* only fifo_size is different, so just copy all */ -- data = memdup_user(data32, sizeof(*data32)); -- if (IS_ERR(data)) -- return PTR_ERR(data); -+ data = kmalloc(sizeof(*data), GFP_KERNEL); -+ if (!data) -+ return -ENOMEM; -+ -+ /* only fifo_size (RO from userspace) is different, so just copy all */ -+ if (copy_from_user(data, data32, sizeof(*data32))) { -+ err = -EFAULT; -+ goto error; -+ } - - if (refine) - err = snd_pcm_hw_refine(substream, data); -diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c -index 4dc6bae80e15..ecfbf5f39d38 100644 ---- a/sound/core/seq/seq_clientmgr.c -+++ b/sound/core/seq/seq_clientmgr.c -@@ -1950,7 +1950,7 @@ static int snd_seq_ioctl_remove_events(struct snd_seq_client *client, - * No restrictions so for a user client we can clear - * the whole fifo - */ -- if (client->type == USER_CLIENT) -+ if (client->type == USER_CLIENT && client->data.user.fifo) - snd_seq_fifo_clear(client->data.user.fifo); - } - -diff --git a/sound/core/seq/seq_compat.c b/sound/core/seq/seq_compat.c -index 81f7c109dc46..65175902a68a 100644 ---- a/sound/core/seq/seq_compat.c -+++ b/sound/core/seq/seq_compat.c -@@ -49,11 +49,12 @@ static int snd_seq_call_port_info_ioctl(struct snd_seq_client *client, unsigned - struct snd_seq_port_info *data; - mm_segment_t fs; - -- data = memdup_user(data32, sizeof(*data32)); -- if (IS_ERR(data)) -- return PTR_ERR(data); -+ data = kmalloc(sizeof(*data), GFP_KERNEL); -+ if (!data) -+ return -ENOMEM; - -- if (get_user(data->flags, &data32->flags) || -+ if (copy_from_user(data, data32, sizeof(*data32)) || -+ get_user(data->flags, &data32->flags) || - get_user(data->time_queue, &data32->time_queue)) - goto error; - data->kernel = NULL; -diff --git a/sound/core/seq/seq_queue.c b/sound/core/seq/seq_queue.c -index f9077361c119..4c9aa462de9b 100644 ---- a/sound/core/seq/seq_queue.c -+++ b/sound/core/seq/seq_queue.c -@@ -144,8 +144,10 @@ static struct snd_seq_queue *queue_new(int owner, int locked) - static void queue_delete(struct snd_seq_queue *q) - { - /* stop and release the timer */ -+ mutex_lock(&q->timer_mutex); - snd_seq_timer_stop(q->timer); - snd_seq_timer_close(q); -+ mutex_unlock(&q->timer_mutex); - /* wait until access free */ - snd_use_lock_sync(&q->use_lock); - /* release resources... */ -diff --git a/sound/core/timer.c b/sound/core/timer.c -index 6ddcf06f52f9..4e436fe53afa 100644 ---- a/sound/core/timer.c -+++ b/sound/core/timer.c -@@ -73,7 +73,7 @@ struct snd_timer_user { - struct timespec tstamp; /* trigger tstamp */ - wait_queue_head_t qchange_sleep; - struct fasync_struct *fasync; -- struct mutex tread_sem; -+ struct mutex ioctl_lock; - }; - - /* list of timers */ -@@ -215,11 +215,13 @@ static void snd_timer_check_master(struct snd_timer_instance *master) - slave->slave_id == master->slave_id) { - list_move_tail(&slave->open_list, &master->slave_list_head); - spin_lock_irq(&slave_active_lock); -+ spin_lock(&master->timer->lock); - slave->master = master; - slave->timer = master->timer; - if (slave->flags & SNDRV_TIMER_IFLG_RUNNING) - list_add_tail(&slave->active_list, - &master->slave_active_head); -+ spin_unlock(&master->timer->lock); - spin_unlock_irq(&slave_active_lock); - } - } -@@ -345,15 +347,18 @@ int snd_timer_close(struct snd_timer_instance *timeri) - timer->hw.close) - timer->hw.close(timer); - /* remove slave links */ -+ spin_lock_irq(&slave_active_lock); -+ spin_lock(&timer->lock); - list_for_each_entry_safe(slave, tmp, &timeri->slave_list_head, - open_list) { -- spin_lock_irq(&slave_active_lock); -- _snd_timer_stop(slave, 1, SNDRV_TIMER_EVENT_RESOLUTION); - list_move_tail(&slave->open_list, &snd_timer_slave_list); - slave->master = NULL; - slave->timer = NULL; -- spin_unlock_irq(&slave_active_lock); -+ list_del_init(&slave->ack_list); -+ list_del_init(&slave->active_list); - } -+ spin_unlock(&timer->lock); -+ spin_unlock_irq(&slave_active_lock); - mutex_unlock(®ister_mutex); - } - out: -@@ -440,9 +445,12 @@ static int snd_timer_start_slave(struct snd_timer_instance *timeri) - - spin_lock_irqsave(&slave_active_lock, flags); - timeri->flags |= SNDRV_TIMER_IFLG_RUNNING; -- if (timeri->master) -+ if (timeri->master && timeri->timer) { -+ spin_lock(&timeri->timer->lock); - list_add_tail(&timeri->active_list, - &timeri->master->slave_active_head); -+ spin_unlock(&timeri->timer->lock); -+ } - spin_unlock_irqrestore(&slave_active_lock, flags); - return 1; /* delayed start */ - } -@@ -488,6 +496,8 @@ static int _snd_timer_stop(struct snd_timer_instance * timeri, - if (!keep_flag) { - spin_lock_irqsave(&slave_active_lock, flags); - timeri->flags &= ~SNDRV_TIMER_IFLG_RUNNING; -+ list_del_init(&timeri->ack_list); -+ list_del_init(&timeri->active_list); - spin_unlock_irqrestore(&slave_active_lock, flags); - } - goto __end; -@@ -693,7 +703,7 @@ void snd_timer_interrupt(struct snd_timer * timer, unsigned long ticks_left) - } else { - ti->flags &= ~SNDRV_TIMER_IFLG_RUNNING; - if (--timer->running) -- list_del(&ti->active_list); -+ list_del_init(&ti->active_list); - } - if ((timer->hw.flags & SNDRV_TIMER_HW_TASKLET) || - (ti->flags & SNDRV_TIMER_IFLG_FAST)) -@@ -1256,7 +1266,7 @@ static int snd_timer_user_open(struct inode *inode, struct file *file) - return -ENOMEM; - spin_lock_init(&tu->qlock); - init_waitqueue_head(&tu->qchange_sleep); -- mutex_init(&tu->tread_sem); -+ mutex_init(&tu->ioctl_lock); - tu->ticks = 1; - tu->queue_size = 128; - tu->queue = kmalloc(tu->queue_size * sizeof(struct snd_timer_read), -@@ -1276,8 +1286,10 @@ static int snd_timer_user_release(struct inode *inode, struct file *file) - if (file->private_data) { - tu = file->private_data; - file->private_data = NULL; -+ mutex_lock(&tu->ioctl_lock); - if (tu->timeri) - snd_timer_close(tu->timeri); -+ mutex_unlock(&tu->ioctl_lock); - kfree(tu->queue); - kfree(tu->tqueue); - kfree(tu); -@@ -1515,7 +1527,6 @@ static int snd_timer_user_tselect(struct file *file, - int err = 0; - - tu = file->private_data; -- mutex_lock(&tu->tread_sem); - if (tu->timeri) { - snd_timer_close(tu->timeri); - tu->timeri = NULL; -@@ -1559,7 +1570,6 @@ static int snd_timer_user_tselect(struct file *file, - } - - __err: -- mutex_unlock(&tu->tread_sem); - return err; - } - -@@ -1772,7 +1782,7 @@ enum { - SNDRV_TIMER_IOCTL_PAUSE_OLD = _IO('T', 0x23), - }; - --static long snd_timer_user_ioctl(struct file *file, unsigned int cmd, -+static long __snd_timer_user_ioctl(struct file *file, unsigned int cmd, - unsigned long arg) - { - struct snd_timer_user *tu; -@@ -1789,17 +1799,11 @@ static long snd_timer_user_ioctl(struct file *file, unsigned int cmd, - { - int xarg; - -- mutex_lock(&tu->tread_sem); -- if (tu->timeri) { /* too late */ -- mutex_unlock(&tu->tread_sem); -+ if (tu->timeri) /* too late */ - return -EBUSY; -- } -- if (get_user(xarg, p)) { -- mutex_unlock(&tu->tread_sem); -+ if (get_user(xarg, p)) - return -EFAULT; -- } - tu->tread = xarg ? 1 : 0; -- mutex_unlock(&tu->tread_sem); - return 0; - } - case SNDRV_TIMER_IOCTL_GINFO: -@@ -1832,6 +1836,18 @@ static long snd_timer_user_ioctl(struct file *file, unsigned int cmd, - return -ENOTTY; - } - -+static long snd_timer_user_ioctl(struct file *file, unsigned int cmd, -+ unsigned long arg) -+{ -+ struct snd_timer_user *tu = file->private_data; -+ long ret; -+ -+ mutex_lock(&tu->ioctl_lock); -+ ret = __snd_timer_user_ioctl(file, cmd, arg); -+ mutex_unlock(&tu->ioctl_lock); -+ return ret; -+} -+ - static int snd_timer_user_fasync(int fd, struct file * file, int on) - { - struct snd_timer_user *tu; -diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c -index 1800db643a16..57d01f101b04 100644 ---- a/sound/pci/hda/hda_intel.c -+++ b/sound/pci/hda/hda_intel.c -@@ -1104,6 +1104,36 @@ static unsigned int azx_get_response(struct hda_bus *bus, - return azx_rirb_get_response(bus, addr); - } - -+#ifdef CONFIG_PM_SLEEP -+/* put codec down to D3 at hibernation for Intel SKL+; -+ * otherwise BIOS may still access the codec and screw up the driver -+ */ -+#define IS_SKL(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0xa170) -+#define IS_SKL_LP(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x9d70) -+#define IS_BXT(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x5a98) -+#define IS_SKL_PLUS(pci) (IS_SKL(pci) || IS_SKL_LP(pci) || IS_BXT(pci)) -+ -+static int azx_freeze_noirq(struct device *dev) -+{ -+ struct pci_dev *pci = to_pci_dev(dev); -+ -+ if (IS_SKL_PLUS(pci)) -+ pci_set_power_state(pci, PCI_D3hot); -+ -+ return 0; -+} -+ -+static int azx_thaw_noirq(struct device *dev) -+{ -+ struct pci_dev *pci = to_pci_dev(dev); -+ -+ if (IS_SKL_PLUS(pci)) -+ pci_set_power_state(pci, PCI_D0); -+ -+ return 0; -+} -+#endif /* CONFIG_PM_SLEEP */ -+ - #ifdef CONFIG_PM - static void azx_power_notify(struct hda_bus *bus, bool power_up); - #endif -@@ -2974,6 +3004,10 @@ static int azx_runtime_idle(struct device *dev) - #ifdef CONFIG_PM - static const struct dev_pm_ops azx_pm = { - SET_SYSTEM_SLEEP_PM_OPS(azx_suspend, azx_resume) -+#ifdef CONFIG_PM_SLEEP -+ .freeze_noirq = azx_freeze_noirq, -+ .thaw_noirq = azx_thaw_noirq, -+#endif - SET_RUNTIME_PM_OPS(azx_runtime_suspend, azx_runtime_resume, azx_runtime_idle) - }; - -@@ -3864,6 +3898,11 @@ static DEFINE_PCI_DEVICE_TABLE(azx_ids) = { - .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH }, - { PCI_DEVICE(0x8086, 0x8d21), - .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH }, -+ /* Lewisburg */ -+ { PCI_DEVICE(0x8086, 0xa1f0), -+ .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH }, -+ { PCI_DEVICE(0x8086, 0xa270), -+ .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH }, - /* Lynx Point-LP */ - { PCI_DEVICE(0x8086, 0x9c20), - .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH }, -diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c -index 183a96ab2533..69a2aafb0b0f 100644 ---- a/sound/pci/hda/patch_realtek.c -+++ b/sound/pci/hda/patch_realtek.c -@@ -1768,6 +1768,7 @@ enum { - ALC889_FIXUP_MBA11_VREF, - ALC889_FIXUP_MBA21_VREF, - ALC889_FIXUP_MP11_VREF, -+ ALC889_FIXUP_MP41_VREF, - ALC882_FIXUP_INV_DMIC, - ALC882_FIXUP_NO_PRIMARY_HP, - ALC887_FIXUP_ASUS_BASS, -@@ -1854,7 +1855,7 @@ static void alc889_fixup_mbp_vref(struct hda_codec *codec, - const struct hda_fixup *fix, int action) - { - struct alc_spec *spec = codec->spec; -- static hda_nid_t nids[2] = { 0x14, 0x15 }; -+ static hda_nid_t nids[3] = { 0x14, 0x15, 0x19 }; - int i; - - if (action != HDA_FIXUP_ACT_INIT) -@@ -2128,6 +2129,12 @@ static const struct hda_fixup alc882_fixups[] = { - .chained = true, - .chain_id = ALC885_FIXUP_MACPRO_GPIO, - }, -+ [ALC889_FIXUP_MP41_VREF] = { -+ .type = HDA_FIXUP_FUNC, -+ .v.func = alc889_fixup_mbp_vref, -+ .chained = true, -+ .chain_id = ALC885_FIXUP_MACPRO_GPIO, -+ }, - [ALC882_FIXUP_INV_DMIC] = { - .type = HDA_FIXUP_FUNC, - .v.func = alc_fixup_inv_dmic_0x12, -@@ -2200,7 +2207,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = { - SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF), - SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF), - SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF), -- SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 5,1", ALC885_FIXUP_MACPRO_GPIO), -+ SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 4,1/5,1", ALC889_FIXUP_MP41_VREF), - SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF), - SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF), - SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF), -@@ -4446,6 +4453,7 @@ static const struct hda_fixup alc662_fixups[] = { - static const struct snd_pci_quirk alc662_fixup_tbl[] = { - SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2), - SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC), -+ SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC), - SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE), - SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE), - SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC), -diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c -index 44d3fb95ebba..5ffe7992aaed 100644 ---- a/sound/pci/hda/patch_sigmatel.c -+++ b/sound/pci/hda/patch_sigmatel.c -@@ -703,6 +703,7 @@ static bool hp_bnb2011_with_dock(struct hda_codec *codec) - static bool hp_blike_system(u32 subsystem_id) - { - switch (subsystem_id) { -+ case 0x103c1473: /* HP ProBook 6550b */ - case 0x103c1520: - case 0x103c1521: - case 0x103c1523: -diff --git a/sound/pci/rme96.c b/sound/pci/rme96.c -index 5fb88ac82aa9..4fdb234d74b4 100644 ---- a/sound/pci/rme96.c -+++ b/sound/pci/rme96.c -@@ -703,10 +703,11 @@ snd_rme96_playback_setrate(struct rme96 *rme96, - { - /* change to/from double-speed: reset the DAC (if available) */ - snd_rme96_reset_dac(rme96); -+ return 1; /* need to restore volume */ - } else { - writel(rme96->wcreg, rme96->iobase + RME96_IO_CONTROL_REGISTER); -+ return 0; - } -- return 0; - } - - static int -@@ -944,6 +945,7 @@ snd_rme96_playback_hw_params(struct snd_pcm_substream *substream, - struct rme96 *rme96 = snd_pcm_substream_chip(substream); - struct snd_pcm_runtime *runtime = substream->runtime; - int err, rate, dummy; -+ bool apply_dac_volume = false; - - runtime->dma_area = (void __force *)(rme96->iobase + - RME96_IO_PLAY_BUFFER); -@@ -957,24 +959,26 @@ snd_rme96_playback_hw_params(struct snd_pcm_substream *substream, - { - /* slave clock */ - if ((int)params_rate(params) != rate) { -- spin_unlock_irq(&rme96->lock); -- return -EIO; -- } -- } else if ((err = snd_rme96_playback_setrate(rme96, params_rate(params))) < 0) { -- spin_unlock_irq(&rme96->lock); -- return err; -- } -- if ((err = snd_rme96_playback_setformat(rme96, params_format(params))) < 0) { -- spin_unlock_irq(&rme96->lock); -- return err; -+ err = -EIO; -+ goto error; -+ } -+ } else { -+ err = snd_rme96_playback_setrate(rme96, params_rate(params)); -+ if (err < 0) -+ goto error; -+ apply_dac_volume = err > 0; /* need to restore volume later? */ - } -+ -+ err = snd_rme96_playback_setformat(rme96, params_format(params)); -+ if (err < 0) -+ goto error; - snd_rme96_setframelog(rme96, params_channels(params), 1); - if (rme96->capture_periodsize != 0) { - if (params_period_size(params) << rme96->playback_frlog != - rme96->capture_periodsize) - { -- spin_unlock_irq(&rme96->lock); -- return -EBUSY; -+ err = -EBUSY; -+ goto error; - } - } - rme96->playback_periodsize = -@@ -985,9 +989,16 @@ snd_rme96_playback_hw_params(struct snd_pcm_substream *substream, - rme96->wcreg &= ~(RME96_WCR_PRO | RME96_WCR_DOLBY | RME96_WCR_EMP); - writel(rme96->wcreg |= rme96->wcreg_spdif_stream, rme96->iobase + RME96_IO_CONTROL_REGISTER); - } -+ -+ err = 0; -+ error: - spin_unlock_irq(&rme96->lock); -- -- return 0; -+ if (apply_dac_volume) { -+ usleep_range(3000, 10000); -+ snd_rme96_apply_dac_volume(rme96); -+ } -+ -+ return err; - } - - static int -diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c -index 663a2a748626..56815af4e00b 100644 ---- a/sound/soc/codecs/arizona.c -+++ b/sound/soc/codecs/arizona.c -@@ -1057,7 +1057,7 @@ static int arizona_hw_params(struct snd_pcm_substream *substream, - int chan_limit = arizona->pdata.max_channels_clocked[dai->id - 1]; - int bclk, lrclk, wl, frame, bclk_target; - -- if (params_rate(params) % 8000) -+ if (params_rate(params) % 4000) - rates = &arizona_44k1_bclk_rates[0]; - else - rates = &arizona_48k_bclk_rates[0]; -diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c -index 1ae1f8bd9c36..305d28dec668 100644 ---- a/sound/soc/codecs/wm8962.c -+++ b/sound/soc/codecs/wm8962.c -@@ -363,8 +363,8 @@ static struct reg_default wm8962_reg[] = { - { 16924, 0x0059 }, /* R16924 - HDBASS_PG_1 */ - { 16925, 0x999A }, /* R16925 - HDBASS_PG_0 */ - -- { 17048, 0x0083 }, /* R17408 - HPF_C_1 */ -- { 17049, 0x98AD }, /* R17409 - HPF_C_0 */ -+ { 17408, 0x0083 }, /* R17408 - HPF_C_1 */ -+ { 17409, 0x98AD }, /* R17409 - HPF_C_0 */ - - { 17920, 0x007F }, /* R17920 - ADCL_RETUNE_C1_1 */ - { 17921, 0xFFFF }, /* R17921 - ADCL_RETUNE_C1_0 */ -diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c -index 06a8000aa07b..2340554981d6 100644 ---- a/sound/soc/soc-compress.c -+++ b/sound/soc/soc-compress.c -@@ -384,17 +384,34 @@ int soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num) - struct snd_compr *compr; - char new_name[64]; - int ret = 0, direction = 0; -+ int playback = 0, capture = 0; - - /* check client and interface hw capabilities */ - snprintf(new_name, sizeof(new_name), "%s %s-%d", - rtd->dai_link->stream_name, codec_dai->name, num); - - if (codec_dai->driver->playback.channels_min) -+ playback = 1; -+ if (codec_dai->driver->capture.channels_min) -+ capture = 1; -+ -+ capture = capture && cpu_dai->driver->capture.channels_min; -+ playback = playback && cpu_dai->driver->playback.channels_min; -+ -+ /* -+ * Compress devices are unidirectional so only one of the directions -+ * should be set, check for that (xor) -+ */ -+ if (playback + capture != 1) { -+ dev_err(rtd->card->dev, "Invalid direction for compress P %d, C %d\n", -+ playback, capture); -+ return -EINVAL; -+ } -+ -+ if(playback) - direction = SND_COMPRESS_PLAYBACK; -- else if (codec_dai->driver->capture.channels_min) -- direction = SND_COMPRESS_CAPTURE; - else -- return -EINVAL; -+ direction = SND_COMPRESS_CAPTURE; - - compr = kzalloc(sizeof(*compr), GFP_KERNEL); - if (compr == NULL) { diff --git a/patch/kernel/marvell-default/1-patch-3.10.96-97.patch b/patch/kernel/marvell-default/1-patch-3.10.96-97.patch deleted file mode 100644 index 487d76eb1e..0000000000 --- a/patch/kernel/marvell-default/1-patch-3.10.96-97.patch +++ /dev/null @@ -1,2341 +0,0 @@ -diff --git a/Makefile b/Makefile -index c88ea5d8d19c..f26470169c70 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,6 +1,6 @@ - VERSION = 3 - PATCHLEVEL = 10 --SUBLEVEL = 96 -+SUBLEVEL = 97 - EXTRAVERSION = - NAME = TOSSUG Baby Fish - -diff --git a/arch/parisc/include/uapi/asm/mman.h b/arch/parisc/include/uapi/asm/mman.h -index 294d251ca7b2..2ae13ce592e8 100644 ---- a/arch/parisc/include/uapi/asm/mman.h -+++ b/arch/parisc/include/uapi/asm/mman.h -@@ -46,16 +46,6 @@ - #define MADV_DONTFORK 10 /* don't inherit across fork */ - #define MADV_DOFORK 11 /* do inherit across fork */ - --/* The range 12-64 is reserved for page size specification. */ --#define MADV_4K_PAGES 12 /* Use 4K pages */ --#define MADV_16K_PAGES 14 /* Use 16K pages */ --#define MADV_64K_PAGES 16 /* Use 64K pages */ --#define MADV_256K_PAGES 18 /* Use 256K pages */ --#define MADV_1M_PAGES 20 /* Use 1 Megabyte pages */ --#define MADV_4M_PAGES 22 /* Use 4 Megabyte pages */ --#define MADV_16M_PAGES 24 /* Use 16 Megabyte pages */ --#define MADV_64M_PAGES 26 /* Use 64 Megabyte pages */ -- - #define MADV_MERGEABLE 65 /* KSM may merge identical pages */ - #define MADV_UNMERGEABLE 66 /* KSM may not merge identical pages */ - -diff --git a/arch/parisc/include/uapi/asm/siginfo.h b/arch/parisc/include/uapi/asm/siginfo.h -index d7034728f377..1c75565d984b 100644 ---- a/arch/parisc/include/uapi/asm/siginfo.h -+++ b/arch/parisc/include/uapi/asm/siginfo.h -@@ -1,6 +1,10 @@ - #ifndef _PARISC_SIGINFO_H - #define _PARISC_SIGINFO_H - -+#if defined(__LP64__) -+#define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int)) -+#endif -+ - #include - - #undef NSIGTRAP -diff --git a/arch/parisc/kernel/signal.c b/arch/parisc/kernel/signal.c -index 940188d1942c..ae9aa83854c0 100644 ---- a/arch/parisc/kernel/signal.c -+++ b/arch/parisc/kernel/signal.c -@@ -449,6 +449,55 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, - regs->gr[28]); - } - -+/* -+ * Check how the syscall number gets loaded into %r20 within -+ * the delay branch in userspace and adjust as needed. -+ */ -+ -+static void check_syscallno_in_delay_branch(struct pt_regs *regs) -+{ -+ u32 opcode, source_reg; -+ u32 __user *uaddr; -+ int err; -+ -+ /* Usually we don't have to restore %r20 (the system call number) -+ * because it gets loaded in the delay slot of the branch external -+ * instruction via the ldi instruction. -+ * In some cases a register-to-register copy instruction might have -+ * been used instead, in which case we need to copy the syscall -+ * number into the source register before returning to userspace. -+ */ -+ -+ /* A syscall is just a branch, so all we have to do is fiddle the -+ * return pointer so that the ble instruction gets executed again. -+ */ -+ regs->gr[31] -= 8; /* delayed branching */ -+ -+ /* Get assembler opcode of code in delay branch */ -+ uaddr = (unsigned int *) ((regs->gr[31] & ~3) + 4); -+ err = get_user(opcode, uaddr); -+ if (err) -+ return; -+ -+ /* Check if delay branch uses "ldi int,%r20" */ -+ if ((opcode & 0xffff0000) == 0x34140000) -+ return; /* everything ok, just return */ -+ -+ /* Check if delay branch uses "nop" */ -+ if (opcode == INSN_NOP) -+ return; -+ -+ /* Check if delay branch uses "copy %rX,%r20" */ -+ if ((opcode & 0xffe0ffff) == 0x08000254) { -+ source_reg = (opcode >> 16) & 31; -+ regs->gr[source_reg] = regs->gr[20]; -+ return; -+ } -+ -+ pr_warn("syscall restart: %s (pid %d): unexpected opcode 0x%08x\n", -+ current->comm, task_pid_nr(current), opcode); -+} -+ - static inline void - syscall_restart(struct pt_regs *regs, struct k_sigaction *ka) - { -@@ -471,10 +520,7 @@ syscall_restart(struct pt_regs *regs, struct k_sigaction *ka) - } - /* fallthrough */ - case -ERESTARTNOINTR: -- /* A syscall is just a branch, so all -- * we have to do is fiddle the return pointer. -- */ -- regs->gr[31] -= 8; /* delayed branching */ -+ check_syscallno_in_delay_branch(regs); - break; - } - } -@@ -523,15 +569,9 @@ insert_restart_trampoline(struct pt_regs *regs) - } - case -ERESTARTNOHAND: - case -ERESTARTSYS: -- case -ERESTARTNOINTR: { -- /* Hooray for delayed branching. We don't -- * have to restore %r20 (the system call -- * number) because it gets loaded in the delay -- * slot of the branch external instruction. -- */ -- regs->gr[31] -= 8; -+ case -ERESTARTNOINTR: -+ check_syscallno_in_delay_branch(regs); - return; -- } - default: - break; - } -diff --git a/arch/sh/include/uapi/asm/unistd_64.h b/arch/sh/include/uapi/asm/unistd_64.h -index e6820c86e8c7..47ebd5b5ed55 100644 ---- a/arch/sh/include/uapi/asm/unistd_64.h -+++ b/arch/sh/include/uapi/asm/unistd_64.h -@@ -278,7 +278,7 @@ - #define __NR_fsetxattr 256 - #define __NR_getxattr 257 - #define __NR_lgetxattr 258 --#define __NR_fgetxattr 269 -+#define __NR_fgetxattr 259 - #define __NR_listxattr 260 - #define __NR_llistxattr 261 - #define __NR_flistxattr 262 -diff --git a/crypto/af_alg.c b/crypto/af_alg.c -index 6ef6e2ad344e..0ca108f3c840 100644 ---- a/crypto/af_alg.c -+++ b/crypto/af_alg.c -@@ -125,6 +125,23 @@ int af_alg_release(struct socket *sock) - } - EXPORT_SYMBOL_GPL(af_alg_release); - -+void af_alg_release_parent(struct sock *sk) -+{ -+ struct alg_sock *ask = alg_sk(sk); -+ bool last; -+ -+ sk = ask->parent; -+ ask = alg_sk(sk); -+ -+ lock_sock(sk); -+ last = !--ask->refcnt; -+ release_sock(sk); -+ -+ if (last) -+ sock_put(sk); -+} -+EXPORT_SYMBOL_GPL(af_alg_release_parent); -+ - static int alg_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) - { - struct sock *sk = sock->sk; -@@ -132,6 +149,7 @@ static int alg_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) - struct sockaddr_alg *sa = (void *)uaddr; - const struct af_alg_type *type; - void *private; -+ int err; - - if (sock->state == SS_CONNECTED) - return -EINVAL; -@@ -157,16 +175,22 @@ static int alg_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) - return PTR_ERR(private); - } - -+ err = -EBUSY; - lock_sock(sk); -+ if (ask->refcnt) -+ goto unlock; - - swap(ask->type, type); - swap(ask->private, private); - -+ err = 0; -+ -+unlock: - release_sock(sk); - - alg_do_release(type, private); - -- return 0; -+ return err; - } - - static int alg_setkey(struct sock *sk, char __user *ukey, -@@ -199,11 +223,15 @@ static int alg_setsockopt(struct socket *sock, int level, int optname, - struct sock *sk = sock->sk; - struct alg_sock *ask = alg_sk(sk); - const struct af_alg_type *type; -- int err = -ENOPROTOOPT; -+ int err = -EBUSY; - - lock_sock(sk); -+ if (ask->refcnt) -+ goto unlock; -+ - type = ask->type; - -+ err = -ENOPROTOOPT; - if (level != SOL_ALG || !type) - goto unlock; - -@@ -247,14 +275,13 @@ int af_alg_accept(struct sock *sk, struct socket *newsock) - security_sk_clone(sk, sk2); - - err = type->accept(ask->private, sk2); -- if (err) { -- sk_free(sk2); -+ if (err) - goto unlock; -- } - - sk2->sk_family = PF_ALG; - -- sock_hold(sk); -+ if (!ask->refcnt++) -+ sock_hold(sk); - alg_sk(sk2)->parent = sk; - alg_sk(sk2)->type = type; - -diff --git a/crypto/algif_hash.c b/crypto/algif_hash.c -index 850246206b12..c542c0d88afd 100644 ---- a/crypto/algif_hash.c -+++ b/crypto/algif_hash.c -@@ -51,7 +51,8 @@ static int hash_sendmsg(struct kiocb *unused, struct socket *sock, - - lock_sock(sk); - if (!ctx->more) { -- err = crypto_ahash_init(&ctx->req); -+ err = af_alg_wait_for_completion(crypto_ahash_init(&ctx->req), -+ &ctx->completion); - if (err) - goto unlock; - } -@@ -131,6 +132,7 @@ static ssize_t hash_sendpage(struct socket *sock, struct page *page, - } else { - if (!ctx->more) { - err = crypto_ahash_init(&ctx->req); -+ err = af_alg_wait_for_completion(err, &ctx->completion); - if (err) - goto unlock; - } -@@ -192,9 +194,14 @@ static int hash_accept(struct socket *sock, struct socket *newsock, int flags) - struct sock *sk2; - struct alg_sock *ask2; - struct hash_ctx *ctx2; -+ bool more; - int err; - -- err = crypto_ahash_export(req, state); -+ lock_sock(sk); -+ more = ctx->more; -+ err = more ? crypto_ahash_export(req, state) : 0; -+ release_sock(sk); -+ - if (err) - return err; - -@@ -205,7 +212,10 @@ static int hash_accept(struct socket *sock, struct socket *newsock, int flags) - sk2 = newsock->sk; - ask2 = alg_sk(sk2); - ctx2 = ask2->private; -- ctx2->more = 1; -+ ctx2->more = more; -+ -+ if (!more) -+ return err; - - err = crypto_ahash_import(&ctx2->req, state); - if (err) { -diff --git a/crypto/crypto_user.c b/crypto/crypto_user.c -index c7666f401381..a3dfc0d83107 100644 ---- a/crypto/crypto_user.c -+++ b/crypto/crypto_user.c -@@ -477,6 +477,7 @@ static int crypto_user_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) - if (link->dump == NULL) - return -EINVAL; - -+ down_read(&crypto_alg_sem); - list_for_each_entry(alg, &crypto_alg_list, cra_list) - dump_alloc += CRYPTO_REPORT_MAXSIZE; - -@@ -486,8 +487,11 @@ static int crypto_user_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) - .done = link->done, - .min_dump_alloc = dump_alloc, - }; -- return netlink_dump_start(crypto_nlsk, skb, nlh, &c); -+ err = netlink_dump_start(crypto_nlsk, skb, nlh, &c); - } -+ up_read(&crypto_alg_sem); -+ -+ return err; - } - - err = nlmsg_parse(nlh, crypto_msg_min[type], attrs, CRYPTOCFGA_MAX, -diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c -index 9064a2f2760c..cb106934bf1c 100644 ---- a/drivers/ata/ahci.c -+++ b/drivers/ata/ahci.c -@@ -247,6 +247,26 @@ static const struct pci_device_id ahci_pci_tbl[] = { - { PCI_VDEVICE(INTEL, 0x3b2b), board_ahci }, /* PCH RAID */ - { PCI_VDEVICE(INTEL, 0x3b2c), board_ahci }, /* PCH RAID */ - { PCI_VDEVICE(INTEL, 0x3b2f), board_ahci }, /* PCH AHCI */ -+ { PCI_VDEVICE(INTEL, 0x19b0), board_ahci }, /* DNV AHCI */ -+ { PCI_VDEVICE(INTEL, 0x19b1), board_ahci }, /* DNV AHCI */ -+ { PCI_VDEVICE(INTEL, 0x19b2), board_ahci }, /* DNV AHCI */ -+ { PCI_VDEVICE(INTEL, 0x19b3), board_ahci }, /* DNV AHCI */ -+ { PCI_VDEVICE(INTEL, 0x19b4), board_ahci }, /* DNV AHCI */ -+ { PCI_VDEVICE(INTEL, 0x19b5), board_ahci }, /* DNV AHCI */ -+ { PCI_VDEVICE(INTEL, 0x19b6), board_ahci }, /* DNV AHCI */ -+ { PCI_VDEVICE(INTEL, 0x19b7), board_ahci }, /* DNV AHCI */ -+ { PCI_VDEVICE(INTEL, 0x19bE), board_ahci }, /* DNV AHCI */ -+ { PCI_VDEVICE(INTEL, 0x19bF), board_ahci }, /* DNV AHCI */ -+ { PCI_VDEVICE(INTEL, 0x19c0), board_ahci }, /* DNV AHCI */ -+ { PCI_VDEVICE(INTEL, 0x19c1), board_ahci }, /* DNV AHCI */ -+ { PCI_VDEVICE(INTEL, 0x19c2), board_ahci }, /* DNV AHCI */ -+ { PCI_VDEVICE(INTEL, 0x19c3), board_ahci }, /* DNV AHCI */ -+ { PCI_VDEVICE(INTEL, 0x19c4), board_ahci }, /* DNV AHCI */ -+ { PCI_VDEVICE(INTEL, 0x19c5), board_ahci }, /* DNV AHCI */ -+ { PCI_VDEVICE(INTEL, 0x19c6), board_ahci }, /* DNV AHCI */ -+ { PCI_VDEVICE(INTEL, 0x19c7), board_ahci }, /* DNV AHCI */ -+ { PCI_VDEVICE(INTEL, 0x19cE), board_ahci }, /* DNV AHCI */ -+ { PCI_VDEVICE(INTEL, 0x19cF), board_ahci }, /* DNV AHCI */ - { PCI_VDEVICE(INTEL, 0x1c02), board_ahci }, /* CPT AHCI */ - { PCI_VDEVICE(INTEL, 0x1c03), board_ahci }, /* CPT AHCI */ - { PCI_VDEVICE(INTEL, 0x1c04), board_ahci }, /* CPT RAID */ -diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c -index cf5f35877559..d04f5c8dbbdc 100644 ---- a/drivers/ata/libahci.c -+++ b/drivers/ata/libahci.c -@@ -486,8 +486,8 @@ void ahci_save_initial_config(struct device *dev, - } - } - -- /* fabricate port_map from cap.nr_ports */ -- if (!port_map) { -+ /* fabricate port_map from cap.nr_ports for < AHCI 1.3 */ -+ if (!port_map && vers < 0x10300) { - port_map = (1 << ahci_nr_ports(cap)) - 1; - dev_warn(dev, "forcing PORTS_IMPL to 0x%x\n", port_map); - -@@ -1244,6 +1244,15 @@ static int ahci_exec_polled_cmd(struct ata_port *ap, int pmp, - ata_tf_to_fis(tf, pmp, is_cmd, fis); - ahci_fill_cmd_slot(pp, 0, cmd_fis_len | flags | (pmp << 12)); - -+ /* set port value for softreset of Port Multiplier */ -+ if (pp->fbs_enabled && pp->fbs_last_dev != pmp) { -+ tmp = readl(port_mmio + PORT_FBS); -+ tmp &= ~(PORT_FBS_DEV_MASK | PORT_FBS_DEC); -+ tmp |= pmp << PORT_FBS_DEV_OFFSET; -+ writel(tmp, port_mmio + PORT_FBS); -+ pp->fbs_last_dev = pmp; -+ } -+ - /* issue & wait */ - writel(1, port_mmio + PORT_CMD_ISSUE); - -diff --git a/drivers/char/tpm/tpm_ibmvtpm.c b/drivers/char/tpm/tpm_ibmvtpm.c -index a6524c3efdf7..ce854bbd33ef 100644 ---- a/drivers/char/tpm/tpm_ibmvtpm.c -+++ b/drivers/char/tpm/tpm_ibmvtpm.c -@@ -529,7 +529,7 @@ static void ibmvtpm_crq_process(struct ibmvtpm_crq *crq, - } - ibmvtpm->rtce_size = be16_to_cpu(crq->len); - ibmvtpm->rtce_buf = kmalloc(ibmvtpm->rtce_size, -- GFP_KERNEL); -+ GFP_ATOMIC); - if (!ibmvtpm->rtce_buf) { - dev_err(ibmvtpm->dev, "Failed to allocate memory for rtce buffer\n"); - return; -diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c -index de904e6a4ab7..5da58e3899eb 100644 ---- a/drivers/hid/usbhid/hid-core.c -+++ b/drivers/hid/usbhid/hid-core.c -@@ -490,8 +490,6 @@ static void hid_ctrl(struct urb *urb) - struct usbhid_device *usbhid = hid->driver_data; - int unplug = 0, status = urb->status; - -- spin_lock(&usbhid->lock); -- - switch (status) { - case 0: /* success */ - if (usbhid->ctrl[usbhid->ctrltail].dir == USB_DIR_IN) -@@ -511,6 +509,8 @@ static void hid_ctrl(struct urb *urb) - hid_warn(urb->dev, "ctrl urb status %d received\n", status); - } - -+ spin_lock(&usbhid->lock); -+ - if (unplug) { - usbhid->ctrltail = usbhid->ctrlhead; - } else { -diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c -index 0ba21b0f3972..eb7ddb20fd48 100644 ---- a/drivers/md/dm-mpath.c -+++ b/drivers/md/dm-mpath.c -@@ -1608,11 +1608,8 @@ static int multipath_ioctl(struct dm_target *ti, unsigned int cmd, - /* - * Only pass ioctls through if the device sizes match exactly. - */ -- if (!bdev || ti->len != i_size_read(bdev->bd_inode) >> SECTOR_SHIFT) { -- int err = scsi_verify_blk_ioctl(NULL, cmd); -- if (err) -- r = err; -- } -+ if (!r && ti->len != i_size_read(bdev->bd_inode) >> SECTOR_SHIFT) -+ r = scsi_verify_blk_ioctl(NULL, cmd); - - if (r == -ENOTCONN && !fatal_signal_pending(current)) - queue_work(kmultipathd, &m->process_queued_ios); -diff --git a/drivers/md/persistent-data/dm-btree.c b/drivers/md/persistent-data/dm-btree.c -index b53669404cb5..6d7f4d950b8f 100644 ---- a/drivers/md/persistent-data/dm-btree.c -+++ b/drivers/md/persistent-data/dm-btree.c -@@ -455,8 +455,10 @@ static int btree_split_sibling(struct shadow_spine *s, dm_block_t root, - - r = insert_at(sizeof(__le64), pn, parent_index + 1, - le64_to_cpu(rn->keys[0]), &location); -- if (r) -+ if (r) { -+ unlock_block(s->info, right); - return r; -+ } - - if (key < le64_to_cpu(rn->keys[0])) { - unlock_block(s->info, right); -diff --git a/drivers/media/pci/saa7134/saa7134-alsa.c b/drivers/media/pci/saa7134/saa7134-alsa.c -index dbcdfbf8aed0..11b0ef3a2858 100644 ---- a/drivers/media/pci/saa7134/saa7134-alsa.c -+++ b/drivers/media/pci/saa7134/saa7134-alsa.c -@@ -1145,6 +1145,8 @@ static int alsa_device_init(struct saa7134_dev *dev) - - static int alsa_device_exit(struct saa7134_dev *dev) - { -+ if (!snd_saa7134_cards[dev->nr]) -+ return 1; - - snd_card_free(snd_saa7134_cards[dev->nr]); - snd_saa7134_cards[dev->nr] = NULL; -@@ -1194,7 +1196,8 @@ static void saa7134_alsa_exit(void) - int idx; - - for (idx = 0; idx < SNDRV_CARDS; idx++) { -- snd_card_free(snd_saa7134_cards[idx]); -+ if (snd_saa7134_cards[idx]) -+ snd_card_free(snd_saa7134_cards[idx]); - } - - saa7134_dmasound_init = NULL; -diff --git a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c -index e2b0a0969ebb..35fb8f0cb539 100644 ---- a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c -+++ b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c -@@ -264,7 +264,7 @@ static int put_v4l2_create32(struct v4l2_create_buffers *kp, struct v4l2_create_ - - struct v4l2_standard32 { - __u32 index; -- __u32 id[2]; /* __u64 would get the alignment wrong */ -+ compat_u64 id; - __u8 name[24]; - struct v4l2_fract frameperiod; /* Frames, not fields */ - __u32 framelines; -@@ -284,7 +284,7 @@ static int put_v4l2_standard32(struct v4l2_standard *kp, struct v4l2_standard32 - { - if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_standard32)) || - put_user(kp->index, &up->index) || -- copy_to_user(up->id, &kp->id, sizeof(__u64)) || -+ put_user(kp->id, &up->id) || - copy_to_user(up->name, kp->name, 24) || - copy_to_user(&up->frameperiod, &kp->frameperiod, sizeof(kp->frameperiod)) || - put_user(kp->framelines, &up->framelines) || -@@ -576,10 +576,10 @@ struct v4l2_input32 { - __u32 type; /* Type of input */ - __u32 audioset; /* Associated audios (bitfield) */ - __u32 tuner; /* Associated tuner */ -- v4l2_std_id std; -+ compat_u64 std; - __u32 status; - __u32 reserved[4]; --} __attribute__ ((packed)); -+}; - - /* The 64-bit v4l2_input struct has extra padding at the end of the struct. - Otherwise it is identical to the 32-bit version. */ -@@ -719,6 +719,7 @@ static int put_v4l2_ext_controls32(struct v4l2_ext_controls *kp, struct v4l2_ext - struct v4l2_event32 { - __u32 type; - union { -+ compat_s64 value64; - __u8 data[64]; - } u; - __u32 pending; -diff --git a/drivers/media/v4l2-core/videobuf2-dma-contig.c b/drivers/media/v4l2-core/videobuf2-dma-contig.c -index fd56f2563201..297fbc59a800 100644 ---- a/drivers/media/v4l2-core/videobuf2-dma-contig.c -+++ b/drivers/media/v4l2-core/videobuf2-dma-contig.c -@@ -117,7 +117,8 @@ static void vb2_dc_prepare(void *buf_priv) - if (!sgt || buf->db_attach) - return; - -- dma_sync_sg_for_device(buf->dev, sgt->sgl, sgt->nents, buf->dma_dir); -+ dma_sync_sg_for_device(buf->dev, sgt->sgl, sgt->orig_nents, -+ buf->dma_dir); - } - - static void vb2_dc_finish(void *buf_priv) -@@ -129,7 +130,7 @@ static void vb2_dc_finish(void *buf_priv) - if (!sgt || buf->db_attach) - return; - -- dma_sync_sg_for_cpu(buf->dev, sgt->sgl, sgt->nents, buf->dma_dir); -+ dma_sync_sg_for_cpu(buf->dev, sgt->sgl, sgt->orig_nents, buf->dma_dir); - } - - /*********************************************/ -diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c -index 301493382cd0..f8013c1d8cd5 100644 ---- a/drivers/mtd/mtdpart.c -+++ b/drivers/mtd/mtdpart.c -@@ -634,8 +634,10 @@ int add_mtd_partitions(struct mtd_info *master, - - for (i = 0; i < nbparts; i++) { - slave = allocate_partition(master, parts + i, i, cur_offset); -- if (IS_ERR(slave)) -+ if (IS_ERR(slave)) { -+ del_mtd_partitions(master); - return PTR_ERR(slave); -+ } - - mutex_lock(&mtd_partitions_mutex); - list_add(&slave->list, &mtd_partitions); -diff --git a/drivers/net/wireless/ti/wlcore/io.h b/drivers/net/wireless/ti/wlcore/io.h -index af7d9f9b3b4d..beed58b0c795 100644 ---- a/drivers/net/wireless/ti/wlcore/io.h -+++ b/drivers/net/wireless/ti/wlcore/io.h -@@ -203,19 +203,23 @@ static inline int __must_check wlcore_write_reg(struct wl1271 *wl, int reg, - - static inline void wl1271_power_off(struct wl1271 *wl) - { -- int ret; -+ int ret = 0; - - if (!test_bit(WL1271_FLAG_GPIO_POWER, &wl->flags)) - return; - -- ret = wl->if_ops->power(wl->dev, false); -+ if (wl->if_ops->power) -+ ret = wl->if_ops->power(wl->dev, false); - if (!ret) - clear_bit(WL1271_FLAG_GPIO_POWER, &wl->flags); - } - - static inline int wl1271_power_on(struct wl1271 *wl) - { -- int ret = wl->if_ops->power(wl->dev, true); -+ int ret = 0; -+ -+ if (wl->if_ops->power) -+ ret = wl->if_ops->power(wl->dev, true); - if (ret == 0) - set_bit(WL1271_FLAG_GPIO_POWER, &wl->flags); - -diff --git a/drivers/net/wireless/ti/wlcore/spi.c b/drivers/net/wireless/ti/wlcore/spi.c -index e26447832683..bfb57e671034 100644 ---- a/drivers/net/wireless/ti/wlcore/spi.c -+++ b/drivers/net/wireless/ti/wlcore/spi.c -@@ -72,7 +72,10 @@ - */ - #define SPI_AGGR_BUFFER_SIZE (4 * PAGE_SIZE) - --#define WSPI_MAX_NUM_OF_CHUNKS (SPI_AGGR_BUFFER_SIZE / WSPI_MAX_CHUNK_SIZE) -+/* Maximum number of SPI write chunks */ -+#define WSPI_MAX_NUM_OF_CHUNKS \ -+ ((SPI_AGGR_BUFFER_SIZE / WSPI_MAX_CHUNK_SIZE) + 1) -+ - - struct wl12xx_spi_glue { - struct device *dev; -@@ -270,9 +273,10 @@ static int __must_check wl12xx_spi_raw_write(struct device *child, int addr, - void *buf, size_t len, bool fixed) - { - struct wl12xx_spi_glue *glue = dev_get_drvdata(child->parent); -- struct spi_transfer t[2 * (WSPI_MAX_NUM_OF_CHUNKS + 1)]; -+ /* SPI write buffers - 2 for each chunk */ -+ struct spi_transfer t[2 * WSPI_MAX_NUM_OF_CHUNKS]; - struct spi_message m; -- u32 commands[WSPI_MAX_NUM_OF_CHUNKS]; -+ u32 commands[WSPI_MAX_NUM_OF_CHUNKS]; /* 1 command per chunk */ - u32 *cmd; - u32 chunk_len; - int i; -diff --git a/drivers/remoteproc/remoteproc_debugfs.c b/drivers/remoteproc/remoteproc_debugfs.c -index 157a57309601..4ef0dbdcace1 100644 ---- a/drivers/remoteproc/remoteproc_debugfs.c -+++ b/drivers/remoteproc/remoteproc_debugfs.c -@@ -156,7 +156,7 @@ rproc_recovery_write(struct file *filp, const char __user *user_buf, - char buf[10]; - int ret; - -- if (count > sizeof(buf)) -+ if (count < 1 || count > sizeof(buf)) - return count; - - ret = copy_from_user(buf, user_buf, count); -diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c -index 380387a47b1d..462af46ceee7 100644 ---- a/drivers/spi/spi-atmel.c -+++ b/drivers/spi/spi-atmel.c -@@ -594,7 +594,8 @@ static int atmel_spi_next_xfer_dma_submit(struct spi_master *master, - - *plen = len; - -- if (atmel_spi_dma_slave_config(as, &slave_config, 8)) -+ if (atmel_spi_dma_slave_config(as, &slave_config, -+ xfer->bits_per_word)) - goto err_exit; - - /* Send both scatterlists */ -diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c -index 7c159634aaae..cc80ab14aa32 100644 ---- a/drivers/spi/spi.c -+++ b/drivers/spi/spi.c -@@ -1047,7 +1047,7 @@ struct spi_master *spi_alloc_master(struct device *dev, unsigned size) - master->bus_num = -1; - master->num_chipselect = 1; - master->dev.class = &spi_master_class; -- master->dev.parent = get_device(dev); -+ master->dev.parent = dev; - spi_master_set_devdata(master, &master[1]); - - return master; -diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c -index 2967b6eb4c70..8977eaf24d9f 100644 ---- a/drivers/tty/tty_io.c -+++ b/drivers/tty/tty_io.c -@@ -2576,6 +2576,28 @@ static int tiocsetd(struct tty_struct *tty, int __user *p) - } - - /** -+ * tiocgetd - get line discipline -+ * @tty: tty device -+ * @p: pointer to user data -+ * -+ * Retrieves the line discipline id directly from the ldisc. -+ * -+ * Locking: waits for ldisc reference (in case the line discipline -+ * is changing or the tty is being hungup) -+ */ -+ -+static int tiocgetd(struct tty_struct *tty, int __user *p) -+{ -+ struct tty_ldisc *ld; -+ int ret; -+ -+ ld = tty_ldisc_ref_wait(tty); -+ ret = put_user(ld->ops->num, p); -+ tty_ldisc_deref(ld); -+ return ret; -+} -+ -+/** - * send_break - performed time break - * @tty: device to break on - * @duration: timeout in mS -@@ -2789,7 +2811,7 @@ long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg) - case TIOCGSID: - return tiocgsid(tty, real_tty, p); - case TIOCGETD: -- return put_user(tty->ldisc->ops->num, (int __user *)p); -+ return tiocgetd(tty, p); - case TIOCSETD: - return tiocsetd(tty, p); - case TIOCVHANGUP: -diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c -index 4dc18615cd0f..9dd6fa3a1260 100644 ---- a/drivers/usb/host/xhci.c -+++ b/drivers/usb/host/xhci.c -@@ -4788,6 +4788,9 @@ static int __init xhci_hcd_init(void) - { - int retval; - -+ if (usb_disabled()) -+ return -ENODEV; -+ - retval = xhci_register_pci(); - if (retval < 0) { - printk(KERN_DEBUG "Problem registering PCI driver."); -@@ -4816,9 +4819,6 @@ static int __init xhci_hcd_init(void) - /* xhci_run_regs has eight fields and embeds 128 xhci_intr_regs */ - BUILD_BUG_ON(sizeof(struct xhci_run_regs) != (8+8*128)*32/8); - -- if (usb_disabled()) -- return -ENODEV; -- - return 0; - unreg_pci: - xhci_unregister_pci(); -diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c -index 72c14d7d604f..89ba7cfba5bc 100644 ---- a/drivers/usb/serial/cp210x.c -+++ b/drivers/usb/serial/cp210x.c -@@ -98,6 +98,7 @@ static const struct usb_device_id id_table[] = { - { USB_DEVICE(0x10C4, 0x81AC) }, /* MSD Dash Hawk */ - { USB_DEVICE(0x10C4, 0x81AD) }, /* INSYS USB Modem */ - { USB_DEVICE(0x10C4, 0x81C8) }, /* Lipowsky Industrie Elektronik GmbH, Baby-JTAG */ -+ { USB_DEVICE(0x10C4, 0x81D7) }, /* IAI Corp. RCB-CV-USB USB to RS485 Adaptor */ - { USB_DEVICE(0x10C4, 0x81E2) }, /* Lipowsky Industrie Elektronik GmbH, Baby-LIN */ - { USB_DEVICE(0x10C4, 0x81E7) }, /* Aerocomm Radio */ - { USB_DEVICE(0x10C4, 0x81E8) }, /* Zephyr Bioharness */ -diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c -index 514f3117ee2b..4e865664699b 100644 ---- a/drivers/usb/serial/ftdi_sio.c -+++ b/drivers/usb/serial/ftdi_sio.c -@@ -840,6 +840,7 @@ static struct usb_device_id id_table_combined [] = { - { USB_DEVICE(FTDI_VID, FTDI_TURTELIZER_PID), - .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, - { USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID_USB60F) }, -+ { USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID_SCU18) }, - { USB_DEVICE(FTDI_VID, FTDI_REU_TINY_PID) }, - - /* Papouch devices based on FTDI chip */ -diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h -index bfb0ecd98808..3eff1d6a2b17 100644 ---- a/drivers/usb/serial/ftdi_sio_ids.h -+++ b/drivers/usb/serial/ftdi_sio_ids.h -@@ -615,6 +615,7 @@ - */ - #define RATOC_VENDOR_ID 0x0584 - #define RATOC_PRODUCT_ID_USB60F 0xb020 -+#define RATOC_PRODUCT_ID_SCU18 0xb03a - - /* - * Infineon Technologies -diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c -index bdbe642e6569..81f6a572f016 100644 ---- a/drivers/usb/serial/option.c -+++ b/drivers/usb/serial/option.c -@@ -269,6 +269,8 @@ static void option_instat_callback(struct urb *urb); - #define TELIT_PRODUCT_CC864_SINGLE 0x1006 - #define TELIT_PRODUCT_DE910_DUAL 0x1010 - #define TELIT_PRODUCT_UE910_V2 0x1012 -+#define TELIT_PRODUCT_LE922_USBCFG0 0x1042 -+#define TELIT_PRODUCT_LE922_USBCFG3 0x1043 - #define TELIT_PRODUCT_LE920 0x1200 - #define TELIT_PRODUCT_LE910 0x1201 - -@@ -623,6 +625,16 @@ static const struct option_blacklist_info telit_le920_blacklist = { - .reserved = BIT(1) | BIT(5), - }; - -+static const struct option_blacklist_info telit_le922_blacklist_usbcfg0 = { -+ .sendsetup = BIT(2), -+ .reserved = BIT(0) | BIT(1) | BIT(3), -+}; -+ -+static const struct option_blacklist_info telit_le922_blacklist_usbcfg3 = { -+ .sendsetup = BIT(0), -+ .reserved = BIT(1) | BIT(2) | BIT(3), -+}; -+ - static const struct usb_device_id option_ids[] = { - { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) }, - { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) }, -@@ -1168,6 +1180,10 @@ static const struct usb_device_id option_ids[] = { - { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_CC864_SINGLE) }, - { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_DE910_DUAL) }, - { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_UE910_V2) }, -+ { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE922_USBCFG0), -+ .driver_info = (kernel_ulong_t)&telit_le922_blacklist_usbcfg0 }, -+ { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE922_USBCFG3), -+ .driver_info = (kernel_ulong_t)&telit_le922_blacklist_usbcfg3 }, - { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910), - .driver_info = (kernel_ulong_t)&telit_le910_blacklist }, - { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920), -@@ -1679,7 +1695,7 @@ static const struct usb_device_id option_ids[] = { - { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_P) }, - { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PH8), - .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, -- { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_AHXX) }, -+ { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_AHXX, 0xff) }, - { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PLXX), - .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, - { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDM) }, -diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c -index 4cc84c0c990d..0a7c68fa5e5e 100644 ---- a/drivers/usb/serial/ti_usb_3410_5052.c -+++ b/drivers/usb/serial/ti_usb_3410_5052.c -@@ -158,7 +158,7 @@ static unsigned int product_5052_count; - /* the array dimension is the number of default entries plus */ - /* TI_EXTRA_VID_PID_COUNT user defined entries plus 1 terminating */ - /* null entry */ --static struct usb_device_id ti_id_table_3410[15+TI_EXTRA_VID_PID_COUNT+1] = { -+static struct usb_device_id ti_id_table_3410[16+TI_EXTRA_VID_PID_COUNT+1] = { - { USB_DEVICE(TI_VENDOR_ID, TI_3410_PRODUCT_ID) }, - { USB_DEVICE(TI_VENDOR_ID, TI_3410_EZ430_ID) }, - { USB_DEVICE(MTS_VENDOR_ID, MTS_GSM_NO_FW_PRODUCT_ID) }, -@@ -184,7 +184,7 @@ static struct usb_device_id ti_id_table_5052[5+TI_EXTRA_VID_PID_COUNT+1] = { - { USB_DEVICE(TI_VENDOR_ID, TI_5052_FIRMWARE_PRODUCT_ID) }, - }; - --static struct usb_device_id ti_id_table_combined[19+2*TI_EXTRA_VID_PID_COUNT+1] = { -+static struct usb_device_id ti_id_table_combined[20+2*TI_EXTRA_VID_PID_COUNT+1] = { - { USB_DEVICE(TI_VENDOR_ID, TI_3410_PRODUCT_ID) }, - { USB_DEVICE(TI_VENDOR_ID, TI_3410_EZ430_ID) }, - { USB_DEVICE(MTS_VENDOR_ID, MTS_GSM_NO_FW_PRODUCT_ID) }, -diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c -index 727905de0ba4..605068e6acf2 100644 ---- a/drivers/usb/serial/visor.c -+++ b/drivers/usb/serial/visor.c -@@ -551,6 +551,11 @@ static int treo_attach(struct usb_serial *serial) - (serial->num_interrupt_in == 0)) - return 0; - -+ if (serial->num_bulk_in < 2 || serial->num_interrupt_in < 2) { -+ dev_err(&serial->interface->dev, "missing endpoints\n"); -+ return -ENODEV; -+ } -+ - /* - * It appears that Treos and Kyoceras want to use the - * 1st bulk in endpoint to communicate with the 2nd bulk out endpoint, -@@ -604,8 +609,10 @@ static int clie_5_attach(struct usb_serial *serial) - */ - - /* some sanity check */ -- if (serial->num_ports < 2) -- return -1; -+ if (serial->num_bulk_out < 2) { -+ dev_err(&serial->interface->dev, "missing bulk out endpoints\n"); -+ return -ENODEV; -+ } - - /* port 0 now uses the modified endpoint Address */ - port = serial->port[0]; -diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c -index 618bcc84a09e..948e6f21b594 100644 ---- a/fs/binfmt_elf.c -+++ b/fs/binfmt_elf.c -@@ -682,16 +682,16 @@ static int load_elf_binary(struct linux_binprm *bprm) - */ - would_dump(bprm, interpreter); - -- retval = kernel_read(interpreter, 0, bprm->buf, -- BINPRM_BUF_SIZE); -- if (retval != BINPRM_BUF_SIZE) { -+ /* Get the exec headers */ -+ retval = kernel_read(interpreter, 0, -+ (void *)&loc->interp_elf_ex, -+ sizeof(loc->interp_elf_ex)); -+ if (retval != sizeof(loc->interp_elf_ex)) { - if (retval >= 0) - retval = -EIO; - goto out_free_dentry; - } - -- /* Get the exec headers */ -- loc->interp_elf_ex = *((struct elfhdr *)bprm->buf); - break; - } - elf_ppnt++; -diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h -index 2a71466b0115..6f74b8919237 100644 ---- a/fs/ext4/ext4.h -+++ b/fs/ext4/ext4.h -@@ -26,6 +26,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -728,19 +729,55 @@ struct move_extent { - <= (EXT4_GOOD_OLD_INODE_SIZE + \ - (einode)->i_extra_isize)) \ - -+/* -+ * We use an encoding that preserves the times for extra epoch "00": -+ * -+ * extra msb of adjust for signed -+ * epoch 32-bit 32-bit tv_sec to -+ * bits time decoded 64-bit tv_sec 64-bit tv_sec valid time range -+ * 0 0 1 -0x80000000..-0x00000001 0x000000000 1901-12-13..1969-12-31 -+ * 0 0 0 0x000000000..0x07fffffff 0x000000000 1970-01-01..2038-01-19 -+ * 0 1 1 0x080000000..0x0ffffffff 0x100000000 2038-01-19..2106-02-07 -+ * 0 1 0 0x100000000..0x17fffffff 0x100000000 2106-02-07..2174-02-25 -+ * 1 0 1 0x180000000..0x1ffffffff 0x200000000 2174-02-25..2242-03-16 -+ * 1 0 0 0x200000000..0x27fffffff 0x200000000 2242-03-16..2310-04-04 -+ * 1 1 1 0x280000000..0x2ffffffff 0x300000000 2310-04-04..2378-04-22 -+ * 1 1 0 0x300000000..0x37fffffff 0x300000000 2378-04-22..2446-05-10 -+ * -+ * Note that previous versions of the kernel on 64-bit systems would -+ * incorrectly use extra epoch bits 1,1 for dates between 1901 and -+ * 1970. e2fsck will correct this, assuming that it is run on the -+ * affected filesystem before 2242. -+ */ -+ - static inline __le32 ext4_encode_extra_time(struct timespec *time) - { -- return cpu_to_le32((sizeof(time->tv_sec) > 4 ? -- (time->tv_sec >> 32) & EXT4_EPOCH_MASK : 0) | -- ((time->tv_nsec << EXT4_EPOCH_BITS) & EXT4_NSEC_MASK)); -+ u32 extra = sizeof(time->tv_sec) > 4 ? -+ ((time->tv_sec - (s32)time->tv_sec) >> 32) & EXT4_EPOCH_MASK : 0; -+ return cpu_to_le32(extra | (time->tv_nsec << EXT4_EPOCH_BITS)); - } - - static inline void ext4_decode_extra_time(struct timespec *time, __le32 extra) - { -- if (sizeof(time->tv_sec) > 4) -- time->tv_sec |= (__u64)(le32_to_cpu(extra) & EXT4_EPOCH_MASK) -- << 32; -- time->tv_nsec = (le32_to_cpu(extra) & EXT4_NSEC_MASK) >> EXT4_EPOCH_BITS; -+ if (unlikely(sizeof(time->tv_sec) > 4 && -+ (extra & cpu_to_le32(EXT4_EPOCH_MASK)))) { -+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,20,0) -+ /* Handle legacy encoding of pre-1970 dates with epoch -+ * bits 1,1. We assume that by kernel version 4.20, -+ * everyone will have run fsck over the affected -+ * filesystems to correct the problem. (This -+ * backwards compatibility may be removed before this -+ * time, at the discretion of the ext4 developers.) -+ */ -+ u64 extra_bits = le32_to_cpu(extra) & EXT4_EPOCH_MASK; -+ if (extra_bits == 3 && ((time->tv_sec) & 0x80000000) != 0) -+ extra_bits = 0; -+ time->tv_sec += extra_bits << 32; -+#else -+ time->tv_sec += (u64)(le32_to_cpu(extra) & EXT4_EPOCH_MASK) << 32; -+#endif -+ } -+ time->tv_nsec = (le32_to_cpu(extra) & EXT4_NSEC_MASK) >> EXT4_EPOCH_BITS; - } - - #define EXT4_INODE_SET_XTIME(xtime, inode, raw_inode) \ -diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c -index a69bd74ed390..fa7d2e668c3a 100644 ---- a/fs/ext4/resize.c -+++ b/fs/ext4/resize.c -@@ -1025,7 +1025,7 @@ exit_free: - * do not copy the full number of backups at this time. The resize - * which changed s_groups_count will backup again. - */ --static void update_backups(struct super_block *sb, int blk_off, char *data, -+static void update_backups(struct super_block *sb, sector_t blk_off, char *data, - int size, int meta_bg) - { - struct ext4_sb_info *sbi = EXT4_SB(sb); -@@ -1050,7 +1050,7 @@ static void update_backups(struct super_block *sb, int blk_off, char *data, - group = ext4_list_backups(sb, &three, &five, &seven); - last = sbi->s_groups_count; - } else { -- group = ext4_meta_bg_first_group(sb, group) + 1; -+ group = ext4_get_group_number(sb, blk_off) + 1; - last = (ext4_group_t)(group + EXT4_DESC_PER_BLOCK(sb) - 2); - } - -diff --git a/fs/fscache/netfs.c b/fs/fscache/netfs.c -index e028b8eb1c40..0912b90e05bc 100644 ---- a/fs/fscache/netfs.c -+++ b/fs/fscache/netfs.c -@@ -45,9 +45,6 @@ int __fscache_register_netfs(struct fscache_netfs *netfs) - netfs->primary_index->parent = &fscache_fsdef_index; - netfs->primary_index->netfs_data = netfs; - -- atomic_inc(&netfs->primary_index->parent->usage); -- atomic_inc(&netfs->primary_index->parent->n_children); -- - spin_lock_init(&netfs->primary_index->lock); - INIT_HLIST_HEAD(&netfs->primary_index->backing_objects); - -@@ -60,6 +57,9 @@ int __fscache_register_netfs(struct fscache_netfs *netfs) - goto already_registered; - } - -+ atomic_inc(&netfs->primary_index->parent->usage); -+ atomic_inc(&netfs->primary_index->parent->n_children); -+ - list_add(&netfs->link, &fscache_netfs_list); - ret = 0; - -@@ -70,8 +70,7 @@ already_registered: - up_write(&fscache_addremove_sem); - - if (ret < 0) { -- netfs->primary_index->parent = NULL; -- __fscache_cookie_put(netfs->primary_index); -+ kmem_cache_free(fscache_cookie_jar, netfs->primary_index); - netfs->primary_index = NULL; - } - -diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c -index ec34e11d6854..21b828c713cc 100644 ---- a/fs/jbd2/transaction.c -+++ b/fs/jbd2/transaction.c -@@ -1936,6 +1936,7 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh, - - if (!buffer_dirty(bh)) { - /* bdflush has written it. We can drop it now */ -+ __jbd2_journal_remove_checkpoint(jh); - goto zap_buffer; - } - -@@ -1965,6 +1966,7 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh, - /* The orphan record's transaction has - * committed. We can cleanse this buffer */ - clear_buffer_jbddirty(bh); -+ __jbd2_journal_remove_checkpoint(jh); - goto zap_buffer; - } - } -diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c -index 2c119d5d04c9..d084200dbc4e 100644 ---- a/fs/ocfs2/dlm/dlmmaster.c -+++ b/fs/ocfs2/dlm/dlmmaster.c -@@ -2456,6 +2456,11 @@ static int dlm_migrate_lockres(struct dlm_ctxt *dlm, - spin_lock(&dlm->master_lock); - ret = dlm_add_migration_mle(dlm, res, mle, &oldmle, name, - namelen, target, dlm->node_num); -+ /* get an extra reference on the mle. -+ * otherwise the assert_master from the new -+ * master will destroy this. -+ */ -+ dlm_get_mle_inuse(mle); - spin_unlock(&dlm->master_lock); - spin_unlock(&dlm->spinlock); - -@@ -2491,6 +2496,7 @@ fail: - if (mle_added) { - dlm_mle_detach_hb_events(dlm, mle); - dlm_put_mle(mle); -+ dlm_put_mle_inuse(mle); - } else if (mle) { - kmem_cache_free(dlm_mle_cache, mle); - mle = NULL; -@@ -2508,17 +2514,6 @@ fail: - * ensure that all assert_master work is flushed. */ - flush_workqueue(dlm->dlm_worker); - -- /* get an extra reference on the mle. -- * otherwise the assert_master from the new -- * master will destroy this. -- * also, make sure that all callers of dlm_get_mle -- * take both dlm->spinlock and dlm->master_lock */ -- spin_lock(&dlm->spinlock); -- spin_lock(&dlm->master_lock); -- dlm_get_mle_inuse(mle); -- spin_unlock(&dlm->master_lock); -- spin_unlock(&dlm->spinlock); -- - /* notify new node and send all lock state */ - /* call send_one_lockres with migration flag. - * this serves as notice to the target node that a -@@ -3246,6 +3241,15 @@ top: - mle->new_master != dead_node) - continue; - -+ if (mle->new_master == dead_node && mle->inuse) { -+ mlog(ML_NOTICE, "%s: target %u died during " -+ "migration from %u, the MLE is " -+ "still keep used, ignore it!\n", -+ dlm->name, dead_node, -+ mle->master); -+ continue; -+ } -+ - /* If we have reached this point, this mle needs to be - * removed from the list and freed. */ - dlm_clean_migration_mle(dlm, mle); -diff --git a/fs/ocfs2/dlm/dlmrecovery.c b/fs/ocfs2/dlm/dlmrecovery.c -index 9bd981cd3142..01c69f24e416 100644 ---- a/fs/ocfs2/dlm/dlmrecovery.c -+++ b/fs/ocfs2/dlm/dlmrecovery.c -@@ -2326,6 +2326,8 @@ static void dlm_do_local_recovery_cleanup(struct dlm_ctxt *dlm, u8 dead_node) - break; - } - } -+ dlm_lockres_clear_refmap_bit(dlm, res, -+ dead_node); - spin_unlock(&res->spinlock); - continue; - } -diff --git a/fs/sysv/inode.c b/fs/sysv/inode.c -index c327d4ee1235..7b3792e5844a 100644 ---- a/fs/sysv/inode.c -+++ b/fs/sysv/inode.c -@@ -161,14 +161,8 @@ void sysv_set_inode(struct inode *inode, dev_t rdev) - inode->i_fop = &sysv_dir_operations; - inode->i_mapping->a_ops = &sysv_aops; - } else if (S_ISLNK(inode->i_mode)) { -- if (inode->i_blocks) { -- inode->i_op = &sysv_symlink_inode_operations; -- inode->i_mapping->a_ops = &sysv_aops; -- } else { -- inode->i_op = &sysv_fast_symlink_inode_operations; -- nd_terminate_link(SYSV_I(inode)->i_data, inode->i_size, -- sizeof(SYSV_I(inode)->i_data) - 1); -- } -+ inode->i_op = &sysv_symlink_inode_operations; -+ inode->i_mapping->a_ops = &sysv_aops; - } else - init_special_inode(inode, inode->i_mode, rdev); - } -diff --git a/include/crypto/if_alg.h b/include/crypto/if_alg.h -index d61c11170213..2f38daaab3d7 100644 ---- a/include/crypto/if_alg.h -+++ b/include/crypto/if_alg.h -@@ -30,6 +30,8 @@ struct alg_sock { - - struct sock *parent; - -+ unsigned int refcnt; -+ - const struct af_alg_type *type; - void *private; - }; -@@ -64,6 +66,7 @@ int af_alg_register_type(const struct af_alg_type *type); - int af_alg_unregister_type(const struct af_alg_type *type); - - int af_alg_release(struct socket *sock); -+void af_alg_release_parent(struct sock *sk); - int af_alg_accept(struct sock *sk, struct socket *newsock); - - int af_alg_make_sg(struct af_alg_sgl *sgl, void __user *addr, int len, -@@ -80,11 +83,6 @@ static inline struct alg_sock *alg_sk(struct sock *sk) - return (struct alg_sock *)sk; - } - --static inline void af_alg_release_parent(struct sock *sk) --{ -- sock_put(alg_sk(sk)->parent); --} -- - static inline void af_alg_init_completion(struct af_alg_completion *completion) - { - init_completion(&completion->completion); -diff --git a/include/linux/signal.h b/include/linux/signal.h -index 2ac423bdb676..53944e50e421 100644 ---- a/include/linux/signal.h -+++ b/include/linux/signal.h -@@ -247,7 +247,6 @@ extern int sigprocmask(int, sigset_t *, sigset_t *); - extern void set_current_blocked(sigset_t *); - extern void __set_current_blocked(const sigset_t *); - extern int show_unhandled_signals; --extern int sigsuspend(sigset_t *); - - struct sigaction { - #ifndef __ARCH_HAS_IRIX_SIGACTION -diff --git a/kernel/signal.c b/kernel/signal.c -index 2e51bcbea1e3..4d1f7fa3138d 100644 ---- a/kernel/signal.c -+++ b/kernel/signal.c -@@ -3551,7 +3551,7 @@ SYSCALL_DEFINE0(pause) - - #endif - --int sigsuspend(sigset_t *set) -+static int sigsuspend(sigset_t *set) - { - current->saved_sigmask = current->blocked; - set_current_blocked(set); -diff --git a/scripts/recordmcount.h b/scripts/recordmcount.h -index 49b582a225b0..b9897e2be404 100644 ---- a/scripts/recordmcount.h -+++ b/scripts/recordmcount.h -@@ -377,7 +377,7 @@ static void nop_mcount(Elf_Shdr const *const relhdr, - - if (mcountsym == Elf_r_sym(relp) && !is_fake_mcount(relp)) { - if (make_nop) -- ret = make_nop((void *)ehdr, shdr->sh_offset + relp->r_offset); -+ ret = make_nop((void *)ehdr, _w(shdr->sh_offset) + _w(relp->r_offset)); - if (warn_on_notrace_sect && !once) { - printf("Section %s has mcount callers being ignored\n", - txtname); -diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c -index 3fdf998ad057..572f95175e97 100644 ---- a/sound/core/compress_offload.c -+++ b/sound/core/compress_offload.c -@@ -44,6 +44,13 @@ - #include - #include - -+/* struct snd_compr_codec_caps overflows the ioctl bit size for some -+ * architectures, so we need to disable the relevant ioctls. -+ */ -+#if _IOC_SIZEBITS < 14 -+#define COMPR_CODEC_CAPS_OVERFLOW -+#endif -+ - /* TODO: - * - add substream support for multiple devices in case of - * SND_DYNAMIC_MINORS is not used -@@ -427,6 +434,7 @@ out: - return retval; - } - -+#ifndef COMPR_CODEC_CAPS_OVERFLOW - static int - snd_compr_get_codec_caps(struct snd_compr_stream *stream, unsigned long arg) - { -@@ -450,6 +458,7 @@ out: - kfree(caps); - return retval; - } -+#endif /* !COMPR_CODEC_CAPS_OVERFLOW */ - - /* revisit this with snd_pcm_preallocate_xxx */ - static int snd_compr_allocate_buffer(struct snd_compr_stream *stream, -@@ -791,9 +800,11 @@ static long snd_compr_ioctl(struct file *f, unsigned int cmd, unsigned long arg) - case _IOC_NR(SNDRV_COMPRESS_GET_CAPS): - retval = snd_compr_get_caps(stream, arg); - break; -+#ifndef COMPR_CODEC_CAPS_OVERFLOW - case _IOC_NR(SNDRV_COMPRESS_GET_CODEC_CAPS): - retval = snd_compr_get_codec_caps(stream, arg); - break; -+#endif - case _IOC_NR(SNDRV_COMPRESS_SET_PARAMS): - retval = snd_compr_set_params(stream, arg); - break; -diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c -index 4c1cc51772e6..7417f96cea6e 100644 ---- a/sound/core/oss/pcm_oss.c -+++ b/sound/core/oss/pcm_oss.c -@@ -834,7 +834,8 @@ static int choose_rate(struct snd_pcm_substream *substream, - return snd_pcm_hw_param_near(substream, params, SNDRV_PCM_HW_PARAM_RATE, best_rate, NULL); - } - --static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream) -+static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream, -+ bool trylock) - { - struct snd_pcm_runtime *runtime = substream->runtime; - struct snd_pcm_hw_params *params, *sparams; -@@ -848,7 +849,10 @@ static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream) - struct snd_mask sformat_mask; - struct snd_mask mask; - -- if (mutex_lock_interruptible(&runtime->oss.params_lock)) -+ if (trylock) { -+ if (!(mutex_trylock(&runtime->oss.params_lock))) -+ return -EAGAIN; -+ } else if (mutex_lock_interruptible(&runtime->oss.params_lock)) - return -EINTR; - sw_params = kmalloc(sizeof(*sw_params), GFP_KERNEL); - params = kmalloc(sizeof(*params), GFP_KERNEL); -@@ -1091,7 +1095,7 @@ static int snd_pcm_oss_get_active_substream(struct snd_pcm_oss_file *pcm_oss_fil - if (asubstream == NULL) - asubstream = substream; - if (substream->runtime->oss.params) { -- err = snd_pcm_oss_change_params(substream); -+ err = snd_pcm_oss_change_params(substream, false); - if (err < 0) - return err; - } -@@ -1130,7 +1134,7 @@ static int snd_pcm_oss_make_ready(struct snd_pcm_substream *substream) - return 0; - runtime = substream->runtime; - if (runtime->oss.params) { -- err = snd_pcm_oss_change_params(substream); -+ err = snd_pcm_oss_change_params(substream, false); - if (err < 0) - return err; - } -@@ -2168,7 +2172,7 @@ static int snd_pcm_oss_get_space(struct snd_pcm_oss_file *pcm_oss_file, int stre - runtime = substream->runtime; - - if (runtime->oss.params && -- (err = snd_pcm_oss_change_params(substream)) < 0) -+ (err = snd_pcm_oss_change_params(substream, false)) < 0) - return err; - - info.fragsize = runtime->oss.period_bytes; -@@ -2804,7 +2808,12 @@ static int snd_pcm_oss_mmap(struct file *file, struct vm_area_struct *area) - return -EIO; - - if (runtime->oss.params) { -- if ((err = snd_pcm_oss_change_params(substream)) < 0) -+ /* use mutex_trylock() for params_lock for avoiding a deadlock -+ * between mmap_sem and params_lock taken by -+ * copy_from/to_user() in snd_pcm_oss_write/read() -+ */ -+ err = snd_pcm_oss_change_params(substream, true); -+ if (err < 0) - return err; - } - #ifdef CONFIG_SND_PCM_OSS_PLUGINS -diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c -index 7b596b5751db..500765f20843 100644 ---- a/sound/core/rawmidi.c -+++ b/sound/core/rawmidi.c -@@ -934,31 +934,36 @@ static long snd_rawmidi_kernel_read1(struct snd_rawmidi_substream *substream, - unsigned long flags; - long result = 0, count1; - struct snd_rawmidi_runtime *runtime = substream->runtime; -+ unsigned long appl_ptr; - -+ spin_lock_irqsave(&runtime->lock, flags); - while (count > 0 && runtime->avail) { - count1 = runtime->buffer_size - runtime->appl_ptr; - if (count1 > count) - count1 = count; -- spin_lock_irqsave(&runtime->lock, flags); - if (count1 > (int)runtime->avail) - count1 = runtime->avail; -+ -+ /* update runtime->appl_ptr before unlocking for userbuf */ -+ appl_ptr = runtime->appl_ptr; -+ runtime->appl_ptr += count1; -+ runtime->appl_ptr %= runtime->buffer_size; -+ runtime->avail -= count1; -+ - if (kernelbuf) -- memcpy(kernelbuf + result, runtime->buffer + runtime->appl_ptr, count1); -+ memcpy(kernelbuf + result, runtime->buffer + appl_ptr, count1); - if (userbuf) { - spin_unlock_irqrestore(&runtime->lock, flags); - if (copy_to_user(userbuf + result, -- runtime->buffer + runtime->appl_ptr, count1)) { -+ runtime->buffer + appl_ptr, count1)) { - return result > 0 ? result : -EFAULT; - } - spin_lock_irqsave(&runtime->lock, flags); - } -- runtime->appl_ptr += count1; -- runtime->appl_ptr %= runtime->buffer_size; -- runtime->avail -= count1; -- spin_unlock_irqrestore(&runtime->lock, flags); - result += count1; - count -= count1; - } -+ spin_unlock_irqrestore(&runtime->lock, flags); - return result; - } - -@@ -1161,8 +1166,9 @@ static long snd_rawmidi_kernel_write1(struct snd_rawmidi_substream *substream, - unsigned long flags; - long count1, result; - struct snd_rawmidi_runtime *runtime = substream->runtime; -+ unsigned long appl_ptr; - -- if (snd_BUG_ON(!kernelbuf && !userbuf)) -+ if (!kernelbuf && !userbuf) - return -EINVAL; - if (snd_BUG_ON(!runtime->buffer)) - return -EINVAL; -@@ -1181,12 +1187,19 @@ static long snd_rawmidi_kernel_write1(struct snd_rawmidi_substream *substream, - count1 = count; - if (count1 > (long)runtime->avail) - count1 = runtime->avail; -+ -+ /* update runtime->appl_ptr before unlocking for userbuf */ -+ appl_ptr = runtime->appl_ptr; -+ runtime->appl_ptr += count1; -+ runtime->appl_ptr %= runtime->buffer_size; -+ runtime->avail -= count1; -+ - if (kernelbuf) -- memcpy(runtime->buffer + runtime->appl_ptr, -+ memcpy(runtime->buffer + appl_ptr, - kernelbuf + result, count1); - else if (userbuf) { - spin_unlock_irqrestore(&runtime->lock, flags); -- if (copy_from_user(runtime->buffer + runtime->appl_ptr, -+ if (copy_from_user(runtime->buffer + appl_ptr, - userbuf + result, count1)) { - spin_lock_irqsave(&runtime->lock, flags); - result = result > 0 ? result : -EFAULT; -@@ -1194,9 +1207,6 @@ static long snd_rawmidi_kernel_write1(struct snd_rawmidi_substream *substream, - } - spin_lock_irqsave(&runtime->lock, flags); - } -- runtime->appl_ptr += count1; -- runtime->appl_ptr %= runtime->buffer_size; -- runtime->avail -= count1; - result += count1; - count -= count1; - } -diff --git a/sound/core/seq/oss/seq_oss_synth.c b/sound/core/seq/oss/seq_oss_synth.c -index c5b773a1eea9..4a09c3085ca4 100644 ---- a/sound/core/seq/oss/seq_oss_synth.c -+++ b/sound/core/seq/oss/seq_oss_synth.c -@@ -310,7 +310,7 @@ snd_seq_oss_synth_cleanup(struct seq_oss_devinfo *dp) - struct seq_oss_synth *rec; - struct seq_oss_synthinfo *info; - -- if (snd_BUG_ON(dp->max_synthdev >= SNDRV_SEQ_OSS_MAX_SYNTH_DEVS)) -+ if (snd_BUG_ON(dp->max_synthdev > SNDRV_SEQ_OSS_MAX_SYNTH_DEVS)) - return; - for (i = 0; i < dp->max_synthdev; i++) { - info = &dp->synths[i]; -diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c -index ecfbf5f39d38..08865dcbf5f1 100644 ---- a/sound/core/seq/seq_clientmgr.c -+++ b/sound/core/seq/seq_clientmgr.c -@@ -678,6 +678,9 @@ static int deliver_to_subscribers(struct snd_seq_client *client, - else - down_read(&grp->list_mutex); - list_for_each_entry(subs, &grp->list_head, src_list) { -+ /* both ports ready? */ -+ if (atomic_read(&subs->ref_count) != 2) -+ continue; - event->dest = subs->info.dest; - if (subs->info.flags & SNDRV_SEQ_PORT_SUBS_TIMESTAMP) - /* convert time according to flag with subscription */ -diff --git a/sound/core/seq/seq_ports.c b/sound/core/seq/seq_ports.c -index 9516e5ce3aad..67c91d226552 100644 ---- a/sound/core/seq/seq_ports.c -+++ b/sound/core/seq/seq_ports.c -@@ -175,10 +175,6 @@ struct snd_seq_client_port *snd_seq_create_port(struct snd_seq_client *client, - } - - /* */ --enum group_type { -- SRC_LIST, DEST_LIST --}; -- - static int subscribe_port(struct snd_seq_client *client, - struct snd_seq_client_port *port, - struct snd_seq_port_subs_info *grp, -@@ -205,6 +201,20 @@ static struct snd_seq_client_port *get_client_port(struct snd_seq_addr *addr, - return NULL; - } - -+static void delete_and_unsubscribe_port(struct snd_seq_client *client, -+ struct snd_seq_client_port *port, -+ struct snd_seq_subscribers *subs, -+ bool is_src, bool ack); -+ -+static inline struct snd_seq_subscribers * -+get_subscriber(struct list_head *p, bool is_src) -+{ -+ if (is_src) -+ return list_entry(p, struct snd_seq_subscribers, src_list); -+ else -+ return list_entry(p, struct snd_seq_subscribers, dest_list); -+} -+ - /* - * remove all subscribers on the list - * this is called from port_delete, for each src and dest list. -@@ -212,7 +222,7 @@ static struct snd_seq_client_port *get_client_port(struct snd_seq_addr *addr, - static void clear_subscriber_list(struct snd_seq_client *client, - struct snd_seq_client_port *port, - struct snd_seq_port_subs_info *grp, -- int grptype) -+ int is_src) - { - struct list_head *p, *n; - -@@ -221,15 +231,13 @@ static void clear_subscriber_list(struct snd_seq_client *client, - struct snd_seq_client *c; - struct snd_seq_client_port *aport; - -- if (grptype == SRC_LIST) { -- subs = list_entry(p, struct snd_seq_subscribers, src_list); -+ subs = get_subscriber(p, is_src); -+ if (is_src) - aport = get_client_port(&subs->info.dest, &c); -- } else { -- subs = list_entry(p, struct snd_seq_subscribers, dest_list); -+ else - aport = get_client_port(&subs->info.sender, &c); -- } -- list_del(p); -- unsubscribe_port(client, port, grp, &subs->info, 0); -+ delete_and_unsubscribe_port(client, port, subs, is_src, false); -+ - if (!aport) { - /* looks like the connected port is being deleted. - * we decrease the counter, and when both ports are deleted -@@ -237,21 +245,14 @@ static void clear_subscriber_list(struct snd_seq_client *client, - */ - if (atomic_dec_and_test(&subs->ref_count)) - kfree(subs); -- } else { -- /* ok we got the connected port */ -- struct snd_seq_port_subs_info *agrp; -- agrp = (grptype == SRC_LIST) ? &aport->c_dest : &aport->c_src; -- down_write(&agrp->list_mutex); -- if (grptype == SRC_LIST) -- list_del(&subs->dest_list); -- else -- list_del(&subs->src_list); -- up_write(&agrp->list_mutex); -- unsubscribe_port(c, aport, agrp, &subs->info, 1); -- kfree(subs); -- snd_seq_port_unlock(aport); -- snd_seq_client_unlock(c); -+ continue; - } -+ -+ /* ok we got the connected port */ -+ delete_and_unsubscribe_port(c, aport, subs, !is_src, true); -+ kfree(subs); -+ snd_seq_port_unlock(aport); -+ snd_seq_client_unlock(c); - } - } - -@@ -264,8 +265,8 @@ static int port_delete(struct snd_seq_client *client, - snd_use_lock_sync(&port->use_lock); - - /* clear subscribers info */ -- clear_subscriber_list(client, port, &port->c_src, SRC_LIST); -- clear_subscriber_list(client, port, &port->c_dest, DEST_LIST); -+ clear_subscriber_list(client, port, &port->c_src, true); -+ clear_subscriber_list(client, port, &port->c_dest, false); - - if (port->private_free) - port->private_free(port->private_data); -@@ -484,85 +485,120 @@ static int match_subs_info(struct snd_seq_port_subscribe *r, - return 0; - } - -- --/* connect two ports */ --int snd_seq_port_connect(struct snd_seq_client *connector, -- struct snd_seq_client *src_client, -- struct snd_seq_client_port *src_port, -- struct snd_seq_client *dest_client, -- struct snd_seq_client_port *dest_port, -- struct snd_seq_port_subscribe *info) -+static int check_and_subscribe_port(struct snd_seq_client *client, -+ struct snd_seq_client_port *port, -+ struct snd_seq_subscribers *subs, -+ bool is_src, bool exclusive, bool ack) - { -- struct snd_seq_port_subs_info *src = &src_port->c_src; -- struct snd_seq_port_subs_info *dest = &dest_port->c_dest; -- struct snd_seq_subscribers *subs, *s; -- int err, src_called = 0; -- unsigned long flags; -- int exclusive; -+ struct snd_seq_port_subs_info *grp; -+ struct list_head *p; -+ struct snd_seq_subscribers *s; -+ int err; - -- subs = kzalloc(sizeof(*subs), GFP_KERNEL); -- if (! subs) -- return -ENOMEM; -- -- subs->info = *info; -- atomic_set(&subs->ref_count, 2); -- -- down_write(&src->list_mutex); -- down_write_nested(&dest->list_mutex, SINGLE_DEPTH_NESTING); -- -- exclusive = info->flags & SNDRV_SEQ_PORT_SUBS_EXCLUSIVE ? 1 : 0; -+ grp = is_src ? &port->c_src : &port->c_dest; - err = -EBUSY; -+ down_write(&grp->list_mutex); - if (exclusive) { -- if (! list_empty(&src->list_head) || ! list_empty(&dest->list_head)) -+ if (!list_empty(&grp->list_head)) - goto __error; - } else { -- if (src->exclusive || dest->exclusive) -+ if (grp->exclusive) - goto __error; - /* check whether already exists */ -- list_for_each_entry(s, &src->list_head, src_list) { -- if (match_subs_info(info, &s->info)) -- goto __error; -- } -- list_for_each_entry(s, &dest->list_head, dest_list) { -- if (match_subs_info(info, &s->info)) -+ list_for_each(p, &grp->list_head) { -+ s = get_subscriber(p, is_src); -+ if (match_subs_info(&subs->info, &s->info)) - goto __error; - } - } - -- if ((err = subscribe_port(src_client, src_port, src, info, -- connector->number != src_client->number)) < 0) -- goto __error; -- src_called = 1; -- -- if ((err = subscribe_port(dest_client, dest_port, dest, info, -- connector->number != dest_client->number)) < 0) -+ err = subscribe_port(client, port, grp, &subs->info, ack); -+ if (err < 0) { -+ grp->exclusive = 0; - goto __error; -+ } - - /* add to list */ -- write_lock_irqsave(&src->list_lock, flags); -- // write_lock(&dest->list_lock); // no other lock yet -- list_add_tail(&subs->src_list, &src->list_head); -- list_add_tail(&subs->dest_list, &dest->list_head); -- // write_unlock(&dest->list_lock); // no other lock yet -- write_unlock_irqrestore(&src->list_lock, flags); -+ write_lock_irq(&grp->list_lock); -+ if (is_src) -+ list_add_tail(&subs->src_list, &grp->list_head); -+ else -+ list_add_tail(&subs->dest_list, &grp->list_head); -+ grp->exclusive = exclusive; -+ atomic_inc(&subs->ref_count); -+ write_unlock_irq(&grp->list_lock); -+ err = 0; -+ -+ __error: -+ up_write(&grp->list_mutex); -+ return err; -+} - -- src->exclusive = dest->exclusive = exclusive; -+static void delete_and_unsubscribe_port(struct snd_seq_client *client, -+ struct snd_seq_client_port *port, -+ struct snd_seq_subscribers *subs, -+ bool is_src, bool ack) -+{ -+ struct snd_seq_port_subs_info *grp; -+ -+ grp = is_src ? &port->c_src : &port->c_dest; -+ down_write(&grp->list_mutex); -+ write_lock_irq(&grp->list_lock); -+ if (is_src) -+ list_del(&subs->src_list); -+ else -+ list_del(&subs->dest_list); -+ grp->exclusive = 0; -+ write_unlock_irq(&grp->list_lock); -+ up_write(&grp->list_mutex); -+ -+ unsubscribe_port(client, port, grp, &subs->info, ack); -+} -+ -+/* connect two ports */ -+int snd_seq_port_connect(struct snd_seq_client *connector, -+ struct snd_seq_client *src_client, -+ struct snd_seq_client_port *src_port, -+ struct snd_seq_client *dest_client, -+ struct snd_seq_client_port *dest_port, -+ struct snd_seq_port_subscribe *info) -+{ -+ struct snd_seq_subscribers *subs; -+ bool exclusive; -+ int err; -+ -+ subs = kzalloc(sizeof(*subs), GFP_KERNEL); -+ if (!subs) -+ return -ENOMEM; -+ -+ subs->info = *info; -+ atomic_set(&subs->ref_count, 0); -+ INIT_LIST_HEAD(&subs->src_list); -+ INIT_LIST_HEAD(&subs->dest_list); -+ -+ exclusive = !!(info->flags & SNDRV_SEQ_PORT_SUBS_EXCLUSIVE); -+ -+ err = check_and_subscribe_port(src_client, src_port, subs, true, -+ exclusive, -+ connector->number != src_client->number); -+ if (err < 0) -+ goto error; -+ err = check_and_subscribe_port(dest_client, dest_port, subs, false, -+ exclusive, -+ connector->number != dest_client->number); -+ if (err < 0) -+ goto error_dest; - -- up_write(&dest->list_mutex); -- up_write(&src->list_mutex); - return 0; - -- __error: -- if (src_called) -- unsubscribe_port(src_client, src_port, src, info, -- connector->number != src_client->number); -+ error_dest: -+ delete_and_unsubscribe_port(src_client, src_port, subs, true, -+ connector->number != src_client->number); -+ error: - kfree(subs); -- up_write(&dest->list_mutex); -- up_write(&src->list_mutex); - return err; - } - -- - /* remove the connection */ - int snd_seq_port_disconnect(struct snd_seq_client *connector, - struct snd_seq_client *src_client, -@@ -572,37 +608,28 @@ int snd_seq_port_disconnect(struct snd_seq_client *connector, - struct snd_seq_port_subscribe *info) - { - struct snd_seq_port_subs_info *src = &src_port->c_src; -- struct snd_seq_port_subs_info *dest = &dest_port->c_dest; - struct snd_seq_subscribers *subs; - int err = -ENOENT; -- unsigned long flags; - - down_write(&src->list_mutex); -- down_write_nested(&dest->list_mutex, SINGLE_DEPTH_NESTING); -- - /* look for the connection */ - list_for_each_entry(subs, &src->list_head, src_list) { - if (match_subs_info(info, &subs->info)) { -- write_lock_irqsave(&src->list_lock, flags); -- // write_lock(&dest->list_lock); // no lock yet -- list_del(&subs->src_list); -- list_del(&subs->dest_list); -- // write_unlock(&dest->list_lock); -- write_unlock_irqrestore(&src->list_lock, flags); -- src->exclusive = dest->exclusive = 0; -- unsubscribe_port(src_client, src_port, src, info, -- connector->number != src_client->number); -- unsubscribe_port(dest_client, dest_port, dest, info, -- connector->number != dest_client->number); -- kfree(subs); -+ atomic_dec(&subs->ref_count); /* mark as not ready */ - err = 0; - break; - } - } -- -- up_write(&dest->list_mutex); - up_write(&src->list_mutex); -- return err; -+ if (err < 0) -+ return err; -+ -+ delete_and_unsubscribe_port(src_client, src_port, subs, true, -+ connector->number != src_client->number); -+ delete_and_unsubscribe_port(dest_client, dest_port, subs, false, -+ connector->number != dest_client->number); -+ kfree(subs); -+ return 0; - } - - -diff --git a/sound/core/seq/seq_timer.c b/sound/core/seq/seq_timer.c -index 24d44b2f61ac..6ec30a98a92a 100644 ---- a/sound/core/seq/seq_timer.c -+++ b/sound/core/seq/seq_timer.c -@@ -92,6 +92,9 @@ void snd_seq_timer_delete(struct snd_seq_timer **tmr) - - void snd_seq_timer_defaults(struct snd_seq_timer * tmr) - { -+ unsigned long flags; -+ -+ spin_lock_irqsave(&tmr->lock, flags); - /* setup defaults */ - tmr->ppq = 96; /* 96 PPQ */ - tmr->tempo = 500000; /* 120 BPM */ -@@ -107,21 +110,25 @@ void snd_seq_timer_defaults(struct snd_seq_timer * tmr) - tmr->preferred_resolution = seq_default_timer_resolution; - - tmr->skew = tmr->skew_base = SKEW_BASE; -+ spin_unlock_irqrestore(&tmr->lock, flags); - } - --void snd_seq_timer_reset(struct snd_seq_timer * tmr) -+static void seq_timer_reset(struct snd_seq_timer *tmr) - { -- unsigned long flags; -- -- spin_lock_irqsave(&tmr->lock, flags); -- - /* reset time & songposition */ - tmr->cur_time.tv_sec = 0; - tmr->cur_time.tv_nsec = 0; - - tmr->tick.cur_tick = 0; - tmr->tick.fraction = 0; -+} -+ -+void snd_seq_timer_reset(struct snd_seq_timer *tmr) -+{ -+ unsigned long flags; - -+ spin_lock_irqsave(&tmr->lock, flags); -+ seq_timer_reset(tmr); - spin_unlock_irqrestore(&tmr->lock, flags); - } - -@@ -140,8 +147,11 @@ static void snd_seq_timer_interrupt(struct snd_timer_instance *timeri, - tmr = q->timer; - if (tmr == NULL) - return; -- if (!tmr->running) -+ spin_lock_irqsave(&tmr->lock, flags); -+ if (!tmr->running) { -+ spin_unlock_irqrestore(&tmr->lock, flags); - return; -+ } - - resolution *= ticks; - if (tmr->skew != tmr->skew_base) { -@@ -150,8 +160,6 @@ static void snd_seq_timer_interrupt(struct snd_timer_instance *timeri, - (((resolution & 0xffff) * tmr->skew) >> 16); - } - -- spin_lock_irqsave(&tmr->lock, flags); -- - /* update timer */ - snd_seq_inc_time_nsec(&tmr->cur_time, resolution); - -@@ -298,26 +306,30 @@ int snd_seq_timer_open(struct snd_seq_queue *q) - t->callback = snd_seq_timer_interrupt; - t->callback_data = q; - t->flags |= SNDRV_TIMER_IFLG_AUTO; -+ spin_lock_irq(&tmr->lock); - tmr->timeri = t; -+ spin_unlock_irq(&tmr->lock); - return 0; - } - - int snd_seq_timer_close(struct snd_seq_queue *q) - { - struct snd_seq_timer *tmr; -+ struct snd_timer_instance *t; - - tmr = q->timer; - if (snd_BUG_ON(!tmr)) - return -EINVAL; -- if (tmr->timeri) { -- snd_timer_stop(tmr->timeri); -- snd_timer_close(tmr->timeri); -- tmr->timeri = NULL; -- } -+ spin_lock_irq(&tmr->lock); -+ t = tmr->timeri; -+ tmr->timeri = NULL; -+ spin_unlock_irq(&tmr->lock); -+ if (t) -+ snd_timer_close(t); - return 0; - } - --int snd_seq_timer_stop(struct snd_seq_timer * tmr) -+static int seq_timer_stop(struct snd_seq_timer *tmr) - { - if (! tmr->timeri) - return -EINVAL; -@@ -328,6 +340,17 @@ int snd_seq_timer_stop(struct snd_seq_timer * tmr) - return 0; - } - -+int snd_seq_timer_stop(struct snd_seq_timer *tmr) -+{ -+ unsigned long flags; -+ int err; -+ -+ spin_lock_irqsave(&tmr->lock, flags); -+ err = seq_timer_stop(tmr); -+ spin_unlock_irqrestore(&tmr->lock, flags); -+ return err; -+} -+ - static int initialize_timer(struct snd_seq_timer *tmr) - { - struct snd_timer *t; -@@ -360,13 +383,13 @@ static int initialize_timer(struct snd_seq_timer *tmr) - return 0; - } - --int snd_seq_timer_start(struct snd_seq_timer * tmr) -+static int seq_timer_start(struct snd_seq_timer *tmr) - { - if (! tmr->timeri) - return -EINVAL; - if (tmr->running) -- snd_seq_timer_stop(tmr); -- snd_seq_timer_reset(tmr); -+ seq_timer_stop(tmr); -+ seq_timer_reset(tmr); - if (initialize_timer(tmr) < 0) - return -EINVAL; - snd_timer_start(tmr->timeri, tmr->ticks); -@@ -375,14 +398,25 @@ int snd_seq_timer_start(struct snd_seq_timer * tmr) - return 0; - } - --int snd_seq_timer_continue(struct snd_seq_timer * tmr) -+int snd_seq_timer_start(struct snd_seq_timer *tmr) -+{ -+ unsigned long flags; -+ int err; -+ -+ spin_lock_irqsave(&tmr->lock, flags); -+ err = seq_timer_start(tmr); -+ spin_unlock_irqrestore(&tmr->lock, flags); -+ return err; -+} -+ -+static int seq_timer_continue(struct snd_seq_timer *tmr) - { - if (! tmr->timeri) - return -EINVAL; - if (tmr->running) - return -EBUSY; - if (! tmr->initialized) { -- snd_seq_timer_reset(tmr); -+ seq_timer_reset(tmr); - if (initialize_timer(tmr) < 0) - return -EINVAL; - } -@@ -392,11 +426,24 @@ int snd_seq_timer_continue(struct snd_seq_timer * tmr) - return 0; - } - -+int snd_seq_timer_continue(struct snd_seq_timer *tmr) -+{ -+ unsigned long flags; -+ int err; -+ -+ spin_lock_irqsave(&tmr->lock, flags); -+ err = seq_timer_continue(tmr); -+ spin_unlock_irqrestore(&tmr->lock, flags); -+ return err; -+} -+ - /* return current 'real' time. use timeofday() to get better granularity. */ - snd_seq_real_time_t snd_seq_timer_get_cur_time(struct snd_seq_timer *tmr) - { - snd_seq_real_time_t cur_time; -+ unsigned long flags; - -+ spin_lock_irqsave(&tmr->lock, flags); - cur_time = tmr->cur_time; - if (tmr->running) { - struct timeval tm; -@@ -412,7 +459,7 @@ snd_seq_real_time_t snd_seq_timer_get_cur_time(struct snd_seq_timer *tmr) - } - snd_seq_sanity_real_time(&cur_time); - } -- -+ spin_unlock_irqrestore(&tmr->lock, flags); - return cur_time; - } - -diff --git a/sound/core/seq/seq_virmidi.c b/sound/core/seq/seq_virmidi.c -index 4b50e604276d..0fa691e01384 100644 ---- a/sound/core/seq/seq_virmidi.c -+++ b/sound/core/seq/seq_virmidi.c -@@ -254,9 +254,13 @@ static int snd_virmidi_output_open(struct snd_rawmidi_substream *substream) - */ - static int snd_virmidi_input_close(struct snd_rawmidi_substream *substream) - { -+ struct snd_virmidi_dev *rdev = substream->rmidi->private_data; - struct snd_virmidi *vmidi = substream->runtime->private_data; -- snd_midi_event_free(vmidi->parser); -+ -+ write_lock_irq(&rdev->filelist_lock); - list_del(&vmidi->list); -+ write_unlock_irq(&rdev->filelist_lock); -+ snd_midi_event_free(vmidi->parser); - substream->runtime->private_data = NULL; - kfree(vmidi); - return 0; -diff --git a/sound/core/timer.c b/sound/core/timer.c -index 4e436fe53afa..d90d8f4b85fe 100644 ---- a/sound/core/timer.c -+++ b/sound/core/timer.c -@@ -300,8 +300,7 @@ int snd_timer_open(struct snd_timer_instance **ti, - return 0; - } - --static int _snd_timer_stop(struct snd_timer_instance *timeri, -- int keep_flag, int event); -+static int _snd_timer_stop(struct snd_timer_instance *timeri, int event); - - /* - * close a timer instance -@@ -343,7 +342,7 @@ int snd_timer_close(struct snd_timer_instance *timeri) - spin_unlock_irq(&timer->lock); - mutex_lock(®ister_mutex); - list_del(&timeri->open_list); -- if (timer && list_empty(&timer->open_list_head) && -+ if (list_empty(&timer->open_list_head) && - timer->hw.close) - timer->hw.close(timer); - /* remove slave links */ -@@ -415,7 +414,7 @@ static void snd_timer_notify1(struct snd_timer_instance *ti, int event) - spin_lock_irqsave(&timer->lock, flags); - list_for_each_entry(ts, &ti->slave_active_head, active_list) - if (ts->ccallback) -- ts->ccallback(ti, event + 100, &tstamp, resolution); -+ ts->ccallback(ts, event + 100, &tstamp, resolution); - spin_unlock_irqrestore(&timer->lock, flags); - } - -@@ -444,6 +443,10 @@ static int snd_timer_start_slave(struct snd_timer_instance *timeri) - unsigned long flags; - - spin_lock_irqsave(&slave_active_lock, flags); -+ if (timeri->flags & SNDRV_TIMER_IFLG_RUNNING) { -+ spin_unlock_irqrestore(&slave_active_lock, flags); -+ return -EBUSY; -+ } - timeri->flags |= SNDRV_TIMER_IFLG_RUNNING; - if (timeri->master && timeri->timer) { - spin_lock(&timeri->timer->lock); -@@ -468,23 +471,30 @@ int snd_timer_start(struct snd_timer_instance *timeri, unsigned int ticks) - return -EINVAL; - if (timeri->flags & SNDRV_TIMER_IFLG_SLAVE) { - result = snd_timer_start_slave(timeri); -- snd_timer_notify1(timeri, SNDRV_TIMER_EVENT_START); -+ if (result >= 0) -+ snd_timer_notify1(timeri, SNDRV_TIMER_EVENT_START); - return result; - } - timer = timeri->timer; - if (timer == NULL) - return -EINVAL; - spin_lock_irqsave(&timer->lock, flags); -+ if (timeri->flags & (SNDRV_TIMER_IFLG_RUNNING | -+ SNDRV_TIMER_IFLG_START)) { -+ result = -EBUSY; -+ goto unlock; -+ } - timeri->ticks = timeri->cticks = ticks; - timeri->pticks = 0; - result = snd_timer_start1(timer, timeri, ticks); -+ unlock: - spin_unlock_irqrestore(&timer->lock, flags); -- snd_timer_notify1(timeri, SNDRV_TIMER_EVENT_START); -+ if (result >= 0) -+ snd_timer_notify1(timeri, SNDRV_TIMER_EVENT_START); - return result; - } - --static int _snd_timer_stop(struct snd_timer_instance * timeri, -- int keep_flag, int event) -+static int _snd_timer_stop(struct snd_timer_instance *timeri, int event) - { - struct snd_timer *timer; - unsigned long flags; -@@ -493,19 +503,30 @@ static int _snd_timer_stop(struct snd_timer_instance * timeri, - return -ENXIO; - - if (timeri->flags & SNDRV_TIMER_IFLG_SLAVE) { -- if (!keep_flag) { -- spin_lock_irqsave(&slave_active_lock, flags); -- timeri->flags &= ~SNDRV_TIMER_IFLG_RUNNING; -- list_del_init(&timeri->ack_list); -- list_del_init(&timeri->active_list); -+ spin_lock_irqsave(&slave_active_lock, flags); -+ if (!(timeri->flags & SNDRV_TIMER_IFLG_RUNNING)) { - spin_unlock_irqrestore(&slave_active_lock, flags); -+ return -EBUSY; - } -+ if (timeri->timer) -+ spin_lock(&timeri->timer->lock); -+ timeri->flags &= ~SNDRV_TIMER_IFLG_RUNNING; -+ list_del_init(&timeri->ack_list); -+ list_del_init(&timeri->active_list); -+ if (timeri->timer) -+ spin_unlock(&timeri->timer->lock); -+ spin_unlock_irqrestore(&slave_active_lock, flags); - goto __end; - } - timer = timeri->timer; - if (!timer) - return -EINVAL; - spin_lock_irqsave(&timer->lock, flags); -+ if (!(timeri->flags & (SNDRV_TIMER_IFLG_RUNNING | -+ SNDRV_TIMER_IFLG_START))) { -+ spin_unlock_irqrestore(&timer->lock, flags); -+ return -EBUSY; -+ } - list_del_init(&timeri->ack_list); - list_del_init(&timeri->active_list); - if ((timeri->flags & SNDRV_TIMER_IFLG_RUNNING) && -@@ -520,9 +541,7 @@ static int _snd_timer_stop(struct snd_timer_instance * timeri, - } - } - } -- if (!keep_flag) -- timeri->flags &= -- ~(SNDRV_TIMER_IFLG_RUNNING | SNDRV_TIMER_IFLG_START); -+ timeri->flags &= ~(SNDRV_TIMER_IFLG_RUNNING | SNDRV_TIMER_IFLG_START); - spin_unlock_irqrestore(&timer->lock, flags); - __end: - if (event != SNDRV_TIMER_EVENT_RESOLUTION) -@@ -541,7 +560,7 @@ int snd_timer_stop(struct snd_timer_instance *timeri) - unsigned long flags; - int err; - -- err = _snd_timer_stop(timeri, 0, SNDRV_TIMER_EVENT_STOP); -+ err = _snd_timer_stop(timeri, SNDRV_TIMER_EVENT_STOP); - if (err < 0) - return err; - timer = timeri->timer; -@@ -571,10 +590,15 @@ int snd_timer_continue(struct snd_timer_instance *timeri) - if (! timer) - return -EINVAL; - spin_lock_irqsave(&timer->lock, flags); -+ if (timeri->flags & SNDRV_TIMER_IFLG_RUNNING) { -+ result = -EBUSY; -+ goto unlock; -+ } - if (!timeri->cticks) - timeri->cticks = 1; - timeri->pticks = 0; - result = snd_timer_start1(timer, timeri, timer->sticks); -+ unlock: - spin_unlock_irqrestore(&timer->lock, flags); - snd_timer_notify1(timeri, SNDRV_TIMER_EVENT_CONTINUE); - return result; -@@ -585,7 +609,7 @@ int snd_timer_continue(struct snd_timer_instance *timeri) - */ - int snd_timer_pause(struct snd_timer_instance * timeri) - { -- return _snd_timer_stop(timeri, 0, SNDRV_TIMER_EVENT_PAUSE); -+ return _snd_timer_stop(timeri, SNDRV_TIMER_EVENT_PAUSE); - } - - /* -@@ -702,8 +726,8 @@ void snd_timer_interrupt(struct snd_timer * timer, unsigned long ticks_left) - ti->cticks = ti->ticks; - } else { - ti->flags &= ~SNDRV_TIMER_IFLG_RUNNING; -- if (--timer->running) -- list_del_init(&ti->active_list); -+ --timer->running; -+ list_del_init(&ti->active_list); - } - if ((timer->hw.flags & SNDRV_TIMER_HW_TASKLET) || - (ti->flags & SNDRV_TIMER_IFLG_FAST)) -diff --git a/sound/drivers/dummy.c b/sound/drivers/dummy.c -index fd798f753609..982a2c2faf24 100644 ---- a/sound/drivers/dummy.c -+++ b/sound/drivers/dummy.c -@@ -109,6 +109,9 @@ struct dummy_timer_ops { - snd_pcm_uframes_t (*pointer)(struct snd_pcm_substream *); - }; - -+#define get_dummy_ops(substream) \ -+ (*(const struct dummy_timer_ops **)(substream)->runtime->private_data) -+ - struct dummy_model { - const char *name; - int (*playback_constraints)(struct snd_pcm_runtime *runtime); -@@ -137,7 +140,6 @@ struct snd_dummy { - int iobox; - struct snd_kcontrol *cd_volume_ctl; - struct snd_kcontrol *cd_switch_ctl; -- const struct dummy_timer_ops *timer_ops; - }; - - /* -@@ -231,6 +233,8 @@ struct dummy_model *dummy_models[] = { - */ - - struct dummy_systimer_pcm { -+ /* ops must be the first item */ -+ const struct dummy_timer_ops *timer_ops; - spinlock_t lock; - struct timer_list timer; - unsigned long base_time; -@@ -368,6 +372,8 @@ static struct dummy_timer_ops dummy_systimer_ops = { - */ - - struct dummy_hrtimer_pcm { -+ /* ops must be the first item */ -+ const struct dummy_timer_ops *timer_ops; - ktime_t base_time; - ktime_t period_time; - atomic_t running; -@@ -494,31 +500,25 @@ static struct dummy_timer_ops dummy_hrtimer_ops = { - - static int dummy_pcm_trigger(struct snd_pcm_substream *substream, int cmd) - { -- struct snd_dummy *dummy = snd_pcm_substream_chip(substream); -- - switch (cmd) { - case SNDRV_PCM_TRIGGER_START: - case SNDRV_PCM_TRIGGER_RESUME: -- return dummy->timer_ops->start(substream); -+ return get_dummy_ops(substream)->start(substream); - case SNDRV_PCM_TRIGGER_STOP: - case SNDRV_PCM_TRIGGER_SUSPEND: -- return dummy->timer_ops->stop(substream); -+ return get_dummy_ops(substream)->stop(substream); - } - return -EINVAL; - } - - static int dummy_pcm_prepare(struct snd_pcm_substream *substream) - { -- struct snd_dummy *dummy = snd_pcm_substream_chip(substream); -- -- return dummy->timer_ops->prepare(substream); -+ return get_dummy_ops(substream)->prepare(substream); - } - - static snd_pcm_uframes_t dummy_pcm_pointer(struct snd_pcm_substream *substream) - { -- struct snd_dummy *dummy = snd_pcm_substream_chip(substream); -- -- return dummy->timer_ops->pointer(substream); -+ return get_dummy_ops(substream)->pointer(substream); - } - - static struct snd_pcm_hardware dummy_pcm_hardware = { -@@ -564,17 +564,19 @@ static int dummy_pcm_open(struct snd_pcm_substream *substream) - struct snd_dummy *dummy = snd_pcm_substream_chip(substream); - struct dummy_model *model = dummy->model; - struct snd_pcm_runtime *runtime = substream->runtime; -+ const struct dummy_timer_ops *ops; - int err; - -- dummy->timer_ops = &dummy_systimer_ops; -+ ops = &dummy_systimer_ops; - #ifdef CONFIG_HIGH_RES_TIMERS - if (hrtimer) -- dummy->timer_ops = &dummy_hrtimer_ops; -+ ops = &dummy_hrtimer_ops; - #endif - -- err = dummy->timer_ops->create(substream); -+ err = ops->create(substream); - if (err < 0) - return err; -+ get_dummy_ops(substream) = ops; - - runtime->hw = dummy->pcm_hw; - if (substream->pcm->device & 1) { -@@ -596,7 +598,7 @@ static int dummy_pcm_open(struct snd_pcm_substream *substream) - err = model->capture_constraints(substream->runtime); - } - if (err < 0) { -- dummy->timer_ops->free(substream); -+ get_dummy_ops(substream)->free(substream); - return err; - } - return 0; -@@ -604,8 +606,7 @@ static int dummy_pcm_open(struct snd_pcm_substream *substream) - - static int dummy_pcm_close(struct snd_pcm_substream *substream) - { -- struct snd_dummy *dummy = snd_pcm_substream_chip(substream); -- dummy->timer_ops->free(substream); -+ get_dummy_ops(substream)->free(substream); - return 0; - } - -diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c -index 69a2aafb0b0f..babbf238a648 100644 ---- a/sound/pci/hda/patch_realtek.c -+++ b/sound/pci/hda/patch_realtek.c -@@ -2188,6 +2188,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = { - SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT), - SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP), - SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP), -+ SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP), - - /* All Apple entries are in codec SSIDs */ - SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF), -diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c -index 02d26915b61d..c6d408c819b1 100644 ---- a/sound/soc/soc-pcm.c -+++ b/sound/soc/soc-pcm.c -@@ -1248,7 +1248,8 @@ static int dpcm_be_dai_hw_free(struct snd_soc_pcm_runtime *fe, int stream) - (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PREPARE) && - (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE) && - (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED) && -- (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP)) -+ (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP) && -+ (be->dpcm[stream].state != SND_SOC_DPCM_STATE_SUSPEND)) - continue; - - dev_dbg(be->dev, "ASoC: hw_free BE %s\n", -diff --git a/sound/usb/midi.c b/sound/usb/midi.c -index dabbe05d17f5..37ecba340876 100644 ---- a/sound/usb/midi.c -+++ b/sound/usb/midi.c -@@ -2291,7 +2291,6 @@ int snd_usbmidi_create(struct snd_card *card, - else - err = snd_usbmidi_create_endpoints(umidi, endpoints); - if (err < 0) { -- snd_usbmidi_free(umidi); - return err; - } - -diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c -index 94cd28c2bd8d..44550a4cf893 100644 ---- a/sound/usb/quirks.c -+++ b/sound/usb/quirks.c -@@ -900,8 +900,12 @@ void snd_usb_set_interface_quirk(struct usb_device *dev) - * "Playback Design" products need a 50ms delay after setting the - * USB interface. - */ -- if (le16_to_cpu(dev->descriptor.idVendor) == 0x23ba) -+ switch (le16_to_cpu(dev->descriptor.idVendor)) { -+ case 0x23ba: /* Playback Design */ -+ case 0x0644: /* TEAC Corp. */ - mdelay(50); -+ break; -+ } - } - - void snd_usb_ctl_msg_quirk(struct usb_device *dev, unsigned int pipe, -@@ -916,6 +920,14 @@ void snd_usb_ctl_msg_quirk(struct usb_device *dev, unsigned int pipe, - (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS) - mdelay(20); - -+ /* -+ * "TEAC Corp." products need a 20ms delay after each -+ * class compliant request -+ */ -+ if ((le16_to_cpu(dev->descriptor.idVendor) == 0x0644) && -+ (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS) -+ mdelay(20); -+ - /* Marantz/Denon devices with USB DAC functionality need a delay - * after each class compliant request - */ diff --git a/patch/kernel/marvell-default/1-patch-3.10.97-98.patch b/patch/kernel/marvell-default/1-patch-3.10.97-98.patch deleted file mode 100644 index 332f8fede4..0000000000 --- a/patch/kernel/marvell-default/1-patch-3.10.97-98.patch +++ /dev/null @@ -1,1792 +0,0 @@ -diff --git a/Makefile b/Makefile -index f26470169c70..dadd1edc6f84 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,6 +1,6 @@ - VERSION = 3 - PATCHLEVEL = 10 --SUBLEVEL = 97 -+SUBLEVEL = 98 - EXTRAVERSION = - NAME = TOSSUG Baby Fish - -diff --git a/arch/arm/common/icst.c b/arch/arm/common/icst.c -index 2dc6da70ae59..d7ed252708c5 100644 ---- a/arch/arm/common/icst.c -+++ b/arch/arm/common/icst.c -@@ -16,7 +16,7 @@ - */ - #include - #include -- -+#include - #include - - /* -@@ -29,7 +29,11 @@ EXPORT_SYMBOL(icst525_s2div); - - unsigned long icst_hz(const struct icst_params *p, struct icst_vco vco) - { -- return p->ref * 2 * (vco.v + 8) / ((vco.r + 2) * p->s2div[vco.s]); -+ u64 dividend = p->ref * 2 * (u64)(vco.v + 8); -+ u32 divisor = (vco.r + 2) * p->s2div[vco.s]; -+ -+ do_div(dividend, divisor); -+ return (unsigned long)dividend; - } - - EXPORT_SYMBOL(icst_hz); -@@ -58,6 +62,7 @@ icst_hz_to_vco(const struct icst_params *p, unsigned long freq) - - if (f > p->vco_min && f <= p->vco_max) - break; -+ i++; - } while (i < 8); - - if (i >= 8) -diff --git a/arch/m32r/kernel/setup.c b/arch/m32r/kernel/setup.c -index 0392112a5d70..a5ecef7188ba 100644 ---- a/arch/m32r/kernel/setup.c -+++ b/arch/m32r/kernel/setup.c -@@ -81,7 +81,10 @@ static struct resource code_resource = { - }; - - unsigned long memory_start; -+EXPORT_SYMBOL(memory_start); -+ - unsigned long memory_end; -+EXPORT_SYMBOL(memory_end); - - void __init setup_arch(char **); - int get_cpuinfo(char *); -diff --git a/arch/x86/include/asm/segment.h b/arch/x86/include/asm/segment.h -index c48a95035a77..4dde707a6ff7 100644 ---- a/arch/x86/include/asm/segment.h -+++ b/arch/x86/include/asm/segment.h -@@ -212,8 +212,19 @@ - #define TLS_SIZE (GDT_ENTRY_TLS_ENTRIES * 8) - - #ifdef __KERNEL__ -+ -+/* -+ * early_idt_handler_array is an array of entry points referenced in the -+ * early IDT. For simplicity, it's a real array with one entry point -+ * every nine bytes. That leaves room for an optional 'push $0' if the -+ * vector has no error code (two bytes), a 'push $vector_number' (two -+ * bytes), and a jump to the common entry code (up to five bytes). -+ */ -+#define EARLY_IDT_HANDLER_SIZE 9 -+ - #ifndef __ASSEMBLY__ --extern const char early_idt_handlers[NUM_EXCEPTION_VECTORS][2+2+5]; -+ -+extern const char early_idt_handler_array[NUM_EXCEPTION_VECTORS][EARLY_IDT_HANDLER_SIZE]; - - /* - * Load a segment. Fall back on loading the zero -diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c -index 55b67614ed94..3b861b7661ee 100644 ---- a/arch/x86/kernel/head64.c -+++ b/arch/x86/kernel/head64.c -@@ -162,7 +162,7 @@ void __init x86_64_start_kernel(char * real_mode_data) - clear_bss(); - - for (i = 0; i < NUM_EXCEPTION_VECTORS; i++) -- set_intr_gate(i, &early_idt_handlers[i]); -+ set_intr_gate(i, &early_idt_handler_array[i]); - load_idt((const struct desc_ptr *)&idt_descr); - - copy_bootdata(__va(real_mode_data)); -diff --git a/arch/x86/kernel/head_32.S b/arch/x86/kernel/head_32.S -index df63cae573e0..8060c8b95b3a 100644 ---- a/arch/x86/kernel/head_32.S -+++ b/arch/x86/kernel/head_32.S -@@ -499,21 +499,22 @@ check_x87: - __INIT - setup_once: - /* -- * Set up a idt with 256 entries pointing to ignore_int, -- * interrupt gates. It doesn't actually load idt - that needs -- * to be done on each CPU. Interrupts are enabled elsewhere, -- * when we can be relatively sure everything is ok. -+ * Set up a idt with 256 interrupt gates that push zero if there -+ * is no error code and then jump to early_idt_handler_common. -+ * It doesn't actually load the idt - that needs to be done on -+ * each CPU. Interrupts are enabled elsewhere, when we can be -+ * relatively sure everything is ok. - */ - - movl $idt_table,%edi -- movl $early_idt_handlers,%eax -+ movl $early_idt_handler_array,%eax - movl $NUM_EXCEPTION_VECTORS,%ecx - 1: - movl %eax,(%edi) - movl %eax,4(%edi) - /* interrupt gate, dpl=0, present */ - movl $(0x8E000000 + __KERNEL_CS),2(%edi) -- addl $9,%eax -+ addl $EARLY_IDT_HANDLER_SIZE,%eax - addl $8,%edi - loop 1b - -@@ -545,26 +546,28 @@ setup_once: - andl $0,setup_once_ref /* Once is enough, thanks */ - ret - --ENTRY(early_idt_handlers) -+ENTRY(early_idt_handler_array) - # 36(%esp) %eflags - # 32(%esp) %cs - # 28(%esp) %eip - # 24(%rsp) error code - i = 0 - .rept NUM_EXCEPTION_VECTORS -- .if (EXCEPTION_ERRCODE_MASK >> i) & 1 -- ASM_NOP2 -- .else -+ .ifeq (EXCEPTION_ERRCODE_MASK >> i) & 1 - pushl $0 # Dummy error code, to make stack frame uniform - .endif - pushl $i # 20(%esp) Vector number -- jmp early_idt_handler -+ jmp early_idt_handler_common - i = i + 1 -+ .fill early_idt_handler_array + i*EARLY_IDT_HANDLER_SIZE - ., 1, 0xcc - .endr --ENDPROC(early_idt_handlers) -+ENDPROC(early_idt_handler_array) - -- /* This is global to keep gas from relaxing the jumps */ --ENTRY(early_idt_handler) -+early_idt_handler_common: -+ /* -+ * The stack is the hardware frame, an error code or zero, and the -+ * vector number. -+ */ - cld - - cmpl $2,(%esp) # X86_TRAP_NMI -@@ -624,7 +627,7 @@ ex_entry: - is_nmi: - addl $8,%esp /* drop vector number and error code */ - iret --ENDPROC(early_idt_handler) -+ENDPROC(early_idt_handler_common) - - /* This is the default interrupt "handler" :-) */ - ALIGN -diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S -index 3280489905a8..54bf9c2d0d13 100644 ---- a/arch/x86/kernel/head_64.S -+++ b/arch/x86/kernel/head_64.S -@@ -329,26 +329,28 @@ bad_address: - jmp bad_address - - __INIT -- .globl early_idt_handlers --early_idt_handlers: -+ENTRY(early_idt_handler_array) - # 104(%rsp) %rflags - # 96(%rsp) %cs - # 88(%rsp) %rip - # 80(%rsp) error code - i = 0 - .rept NUM_EXCEPTION_VECTORS -- .if (EXCEPTION_ERRCODE_MASK >> i) & 1 -- ASM_NOP2 -- .else -+ .ifeq (EXCEPTION_ERRCODE_MASK >> i) & 1 - pushq $0 # Dummy error code, to make stack frame uniform - .endif - pushq $i # 72(%rsp) Vector number -- jmp early_idt_handler -+ jmp early_idt_handler_common - i = i + 1 -+ .fill early_idt_handler_array + i*EARLY_IDT_HANDLER_SIZE - ., 1, 0xcc - .endr -+ENDPROC(early_idt_handler_array) - --/* This is global to keep gas from relaxing the jumps */ --ENTRY(early_idt_handler) -+early_idt_handler_common: -+ /* -+ * The stack is the hardware frame, an error code or zero, and the -+ * vector number. -+ */ - cld - - cmpl $2,(%rsp) # X86_TRAP_NMI -@@ -420,7 +422,7 @@ ENTRY(early_idt_handler) - is_nmi: - addq $16,%rsp # drop vector number and error code - INTERRUPT_RETURN --ENDPROC(early_idt_handler) -+ENDPROC(early_idt_handler_common) - - __INITDATA - -diff --git a/block/blk-core.c b/block/blk-core.c -index 5a750b18172e..9ae84ae05e6a 100644 ---- a/block/blk-core.c -+++ b/block/blk-core.c -@@ -3097,6 +3097,9 @@ int blk_pre_runtime_suspend(struct request_queue *q) - { - int ret = 0; - -+ if (!q->dev) -+ return ret; -+ - spin_lock_irq(q->queue_lock); - if (q->nr_pending) { - ret = -EBUSY; -@@ -3124,6 +3127,9 @@ EXPORT_SYMBOL(blk_pre_runtime_suspend); - */ - void blk_post_runtime_suspend(struct request_queue *q, int err) - { -+ if (!q->dev) -+ return; -+ - spin_lock_irq(q->queue_lock); - if (!err) { - q->rpm_status = RPM_SUSPENDED; -@@ -3148,6 +3154,9 @@ EXPORT_SYMBOL(blk_post_runtime_suspend); - */ - void blk_pre_runtime_resume(struct request_queue *q) - { -+ if (!q->dev) -+ return; -+ - spin_lock_irq(q->queue_lock); - q->rpm_status = RPM_RESUMING; - spin_unlock_irq(q->queue_lock); -@@ -3170,6 +3179,9 @@ EXPORT_SYMBOL(blk_pre_runtime_resume); - */ - void blk_post_runtime_resume(struct request_queue *q, int err) - { -+ if (!q->dev) -+ return; -+ - spin_lock_irq(q->queue_lock); - if (!err) { - q->rpm_status = RPM_ACTIVE; -diff --git a/drivers/iio/adc/ad7793.c b/drivers/iio/adc/ad7793.c -index 334e31ff7a4e..6bd0c1ade9f2 100644 ---- a/drivers/iio/adc/ad7793.c -+++ b/drivers/iio/adc/ad7793.c -@@ -101,7 +101,7 @@ - #define AD7795_CH_AIN1M_AIN1M 8 /* AIN1(-) - AIN1(-) */ - - /* ID Register Bit Designations (AD7793_REG_ID) */ --#define AD7785_ID 0xB -+#define AD7785_ID 0x3 - #define AD7792_ID 0xA - #define AD7793_ID 0xB - #define AD7794_ID 0xF -diff --git a/drivers/iio/dac/ad5064.c b/drivers/iio/dac/ad5064.c -index aa26d50ab638..4eda4ea037b7 100644 ---- a/drivers/iio/dac/ad5064.c -+++ b/drivers/iio/dac/ad5064.c -@@ -602,10 +602,16 @@ static int ad5064_i2c_write(struct ad5064_state *st, unsigned int cmd, - unsigned int addr, unsigned int val) - { - struct i2c_client *i2c = to_i2c_client(st->dev); -+ int ret; - - st->data.i2c[0] = (cmd << 4) | addr; - put_unaligned_be16(val, &st->data.i2c[1]); -- return i2c_master_send(i2c, st->data.i2c, 3); -+ -+ ret = i2c_master_send(i2c, st->data.i2c, 3); -+ if (ret < 0) -+ return ret; -+ -+ return 0; - } - - static int ad5064_i2c_probe(struct i2c_client *i2c, -diff --git a/drivers/iio/dac/mcp4725.c b/drivers/iio/dac/mcp4725.c -index a612ec766d96..029207bbf03d 100644 ---- a/drivers/iio/dac/mcp4725.c -+++ b/drivers/iio/dac/mcp4725.c -@@ -166,6 +166,7 @@ static int mcp4725_probe(struct i2c_client *client, - data->client = client; - - indio_dev->dev.parent = &client->dev; -+ indio_dev->name = id->name; - indio_dev->info = &mcp4725_info; - indio_dev->channels = &mcp4725_channel; - indio_dev->num_channels = 1; -diff --git a/drivers/iio/imu/adis_buffer.c b/drivers/iio/imu/adis_buffer.c -index 99d8e0b0dd34..d0538bcdc1b8 100644 ---- a/drivers/iio/imu/adis_buffer.c -+++ b/drivers/iio/imu/adis_buffer.c -@@ -43,7 +43,7 @@ int adis_update_scan_mode(struct iio_dev *indio_dev, - return -ENOMEM; - - rx = adis->buffer; -- tx = rx + indio_dev->scan_bytes; -+ tx = rx + scan_count; - - spi_message_init(&adis->msg); - -diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c -index 02099afb6c79..77f06d001a66 100644 ---- a/drivers/input/mouse/elantech.c -+++ b/drivers/input/mouse/elantech.c -@@ -1081,7 +1081,7 @@ static int elantech_set_input_params(struct psmouse *psmouse) - input_set_abs_params(dev, ABS_TOOL_WIDTH, ETP_WMIN_V2, - ETP_WMAX_V2, 0, 0); - } -- input_mt_init_slots(dev, 2, 0); -+ input_mt_init_slots(dev, 2, INPUT_MT_SEMI_MT); - input_set_abs_params(dev, ABS_MT_POSITION_X, x_min, x_max, 0, 0); - input_set_abs_params(dev, ABS_MT_POSITION_Y, y_min, y_max, 0, 0); - break; -@@ -1357,6 +1357,13 @@ static const struct dmi_system_id no_hw_res_dmi_table[] = { - DMI_MATCH(DMI_PRODUCT_NAME, "U2442"), - }, - }, -+ { -+ /* Fujitsu LIFEBOOK U745 does not work with crc_enabled == 0 */ -+ .matches = { -+ DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"), -+ DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK U745"), -+ }, -+ }, - #endif - { } - }; -diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h -index 4de2571938b8..5102b4f68f18 100644 ---- a/drivers/input/serio/i8042-x86ia64io.h -+++ b/drivers/input/serio/i8042-x86ia64io.h -@@ -258,6 +258,13 @@ static const struct dmi_system_id __initconst i8042_dmi_nomux_table[] = { - }, - }, - { -+ /* Fujitsu Lifebook U745 */ -+ .matches = { -+ DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"), -+ DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK U745"), -+ }, -+ }, -+ { - /* Fujitsu T70H */ - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"), -diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c -index a7967ceb79e6..3d4622cae2cf 100644 ---- a/drivers/iommu/dmar.c -+++ b/drivers/iommu/dmar.c -@@ -968,7 +968,7 @@ void dmar_disable_qi(struct intel_iommu *iommu) - - raw_spin_lock_irqsave(&iommu->register_lock, flags); - -- sts = dmar_readq(iommu->reg + DMAR_GSTS_REG); -+ sts = readl(iommu->reg + DMAR_GSTS_REG); - if (!(sts & DMA_GSTS_QIES)) - goto end; - -diff --git a/drivers/iommu/intel_irq_remapping.c b/drivers/iommu/intel_irq_remapping.c -index 45011f63ad16..990cc298824a 100644 ---- a/drivers/iommu/intel_irq_remapping.c -+++ b/drivers/iommu/intel_irq_remapping.c -@@ -495,7 +495,7 @@ static void iommu_disable_irq_remapping(struct intel_iommu *iommu) - - raw_spin_lock_irqsave(&iommu->register_lock, flags); - -- sts = dmar_readq(iommu->reg + DMAR_GSTS_REG); -+ sts = readl(iommu->reg + DMAR_GSTS_REG); - if (!(sts & DMA_GSTS_IRES)) - goto end; - -diff --git a/drivers/net/wan/x25_asy.c b/drivers/net/wan/x25_asy.c -index 5895f1978691..e98de425f8e0 100644 ---- a/drivers/net/wan/x25_asy.c -+++ b/drivers/net/wan/x25_asy.c -@@ -545,16 +545,12 @@ static void x25_asy_receive_buf(struct tty_struct *tty, - - static int x25_asy_open_tty(struct tty_struct *tty) - { -- struct x25_asy *sl = tty->disc_data; -+ struct x25_asy *sl; - int err; - - if (tty->ops->write == NULL) - return -EOPNOTSUPP; - -- /* First make sure we're not already connected. */ -- if (sl && sl->magic == X25_ASY_MAGIC) -- return -EEXIST; -- - /* OK. Find a free X.25 channel to use. */ - sl = x25_asy_alloc(); - if (sl == NULL) -diff --git a/drivers/platform/x86/intel_scu_ipcutil.c b/drivers/platform/x86/intel_scu_ipcutil.c -index 02bc5a6343c3..aa454241489c 100644 ---- a/drivers/platform/x86/intel_scu_ipcutil.c -+++ b/drivers/platform/x86/intel_scu_ipcutil.c -@@ -49,7 +49,7 @@ struct scu_ipc_data { - - static int scu_reg_access(u32 cmd, struct scu_ipc_data *data) - { -- int count = data->count; -+ unsigned int count = data->count; - - if (count == 0 || count == 3 || count > 4) - return -EINVAL; -diff --git a/drivers/scsi/device_handler/scsi_dh_rdac.c b/drivers/scsi/device_handler/scsi_dh_rdac.c -index 69c915aa77c2..d661fcda1932 100644 ---- a/drivers/scsi/device_handler/scsi_dh_rdac.c -+++ b/drivers/scsi/device_handler/scsi_dh_rdac.c -@@ -569,7 +569,7 @@ static int mode_select_handle_sense(struct scsi_device *sdev, - /* - * Command Lock contention - */ -- err = SCSI_DH_RETRY; -+ err = SCSI_DH_IMM_RETRY; - break; - default: - break; -@@ -619,6 +619,8 @@ retry: - err = mode_select_handle_sense(sdev, h->sense); - if (err == SCSI_DH_RETRY && retry_cnt--) - goto retry; -+ if (err == SCSI_DH_IMM_RETRY) -+ goto retry; - } - if (err == SCSI_DH_OK) { - h->state = RDAC_STATE_ACTIVE; -diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c -index 3cafe0d784b8..3020f1ff4abb 100644 ---- a/drivers/scsi/hosts.c -+++ b/drivers/scsi/hosts.c -@@ -305,6 +305,17 @@ static void scsi_host_dev_release(struct device *dev) - kfree(queuedata); - } - -+ if (shost->shost_state == SHOST_CREATED) { -+ /* -+ * Free the shost_dev device name here if scsi_host_alloc() -+ * and scsi_host_put() have been called but neither -+ * scsi_host_add() nor scsi_host_remove() has been called. -+ * This avoids that the memory allocated for the shost_dev -+ * name is leaked. -+ */ -+ kfree(dev_name(&shost->shost_dev)); -+ } -+ - scsi_destroy_command_freelist(shost); - if (shost->bqt) - blk_free_tags(shost->bqt); -diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c -index 9e2dd478dd15..135d7b56fbe6 100644 ---- a/drivers/scsi/scsi_sysfs.c -+++ b/drivers/scsi/scsi_sysfs.c -@@ -789,7 +789,7 @@ sdev_store_queue_ramp_up_period(struct device *dev, - return -EINVAL; - - sdev->queue_ramp_up_period = msecs_to_jiffies(period); -- return period; -+ return count; - } - - static struct device_attribute sdev_attr_queue_ramp_up_period = -@@ -1030,31 +1030,25 @@ static void __scsi_remove_target(struct scsi_target *starget) - void scsi_remove_target(struct device *dev) - { - struct Scsi_Host *shost = dev_to_shost(dev->parent); -- struct scsi_target *starget, *last = NULL; -+ struct scsi_target *starget, *last_target = NULL; - unsigned long flags; - -- /* remove targets being careful to lookup next entry before -- * deleting the last -- */ -+restart: - spin_lock_irqsave(shost->host_lock, flags); - list_for_each_entry(starget, &shost->__targets, siblings) { -- if (starget->state == STARGET_DEL) -+ if (starget->state == STARGET_DEL || -+ starget == last_target) - continue; - if (starget->dev.parent == dev || &starget->dev == dev) { -- /* assuming new targets arrive at the end */ - kref_get(&starget->reap_ref); -+ last_target = starget; - spin_unlock_irqrestore(shost->host_lock, flags); -- if (last) -- scsi_target_reap(last); -- last = starget; - __scsi_remove_target(starget); -- spin_lock_irqsave(shost->host_lock, flags); -+ scsi_target_reap(starget); -+ goto restart; - } - } - spin_unlock_irqrestore(shost->host_lock, flags); -- -- if (last) -- scsi_target_reap(last); - } - EXPORT_SYMBOL(scsi_remove_target); - -diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c -index 26b543bc4f53..4afce0e838a2 100644 ---- a/drivers/scsi/sd.c -+++ b/drivers/scsi/sd.c -@@ -3090,8 +3090,8 @@ static int sd_suspend(struct device *dev) - struct scsi_disk *sdkp = scsi_disk_get_from_dev(dev); - int ret = 0; - -- if (!sdkp) -- return 0; /* this can happen */ -+ if (!sdkp) /* E.g.: runtime suspend following sd_remove() */ -+ return 0; - - if (sdkp->WCE) { - sd_printk(KERN_NOTICE, sdkp, "Synchronizing SCSI cache\n"); -@@ -3115,6 +3115,9 @@ static int sd_resume(struct device *dev) - struct scsi_disk *sdkp = scsi_disk_get_from_dev(dev); - int ret = 0; - -+ if (!sdkp) /* E.g.: runtime resume at the start of sd_probe() */ -+ return 0; -+ - if (!sdkp->device->manage_start_stop) - goto done; - -diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c -index 721d839d6c54..0be16bf5f0cd 100644 ---- a/drivers/scsi/sg.c -+++ b/drivers/scsi/sg.c -@@ -1258,7 +1258,7 @@ sg_mmap(struct file *filp, struct vm_area_struct *vma) - } - - sfp->mmap_called = 1; -- vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP; -+ vma->vm_flags |= VM_IO | VM_DONTEXPAND | VM_DONTDUMP; - vma->vm_private_data = sfp; - vma->vm_ops = &sg_mmap_vm_ops; - return 0; -diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c -index 119d67f9c47e..1ac9943cbb93 100644 ---- a/drivers/scsi/sr.c -+++ b/drivers/scsi/sr.c -@@ -142,6 +142,9 @@ static int sr_runtime_suspend(struct device *dev) - { - struct scsi_cd *cd = dev_get_drvdata(dev); - -+ if (!cd) /* E.g.: runtime suspend following sr_remove() */ -+ return 0; -+ - if (cd->media_present) - return -EBUSY; - else -@@ -1006,6 +1009,7 @@ static int sr_remove(struct device *dev) - - blk_queue_prep_rq(cd->device->request_queue, scsi_prep_fn); - del_gendisk(cd->disk); -+ dev_set_drvdata(dev, NULL); - - mutex_lock(&sr_ref_mutex); - kref_put(&cd->kref, sr_kref_release); -diff --git a/drivers/staging/iio/adc/lpc32xx_adc.c b/drivers/staging/iio/adc/lpc32xx_adc.c -index 2f2f7fdd0691..9cbe2dd70499 100644 ---- a/drivers/staging/iio/adc/lpc32xx_adc.c -+++ b/drivers/staging/iio/adc/lpc32xx_adc.c -@@ -76,7 +76,7 @@ static int lpc32xx_read_raw(struct iio_dev *indio_dev, - - if (mask == IIO_CHAN_INFO_RAW) { - mutex_lock(&indio_dev->mlock); -- clk_enable(info->clk); -+ clk_prepare_enable(info->clk); - /* Measurement setup */ - __raw_writel(AD_INTERNAL | (chan->address) | AD_REFp | AD_REFm, - LPC32XX_ADC_SELECT(info->adc_base)); -@@ -84,7 +84,7 @@ static int lpc32xx_read_raw(struct iio_dev *indio_dev, - __raw_writel(AD_PDN_CTRL | AD_STROBE, - LPC32XX_ADC_CTRL(info->adc_base)); - wait_for_completion(&info->completion); /* set by ISR */ -- clk_disable(info->clk); -+ clk_disable_unprepare(info->clk); - *val = info->value; - mutex_unlock(&indio_dev->mlock); - -diff --git a/drivers/staging/speakup/selection.c b/drivers/staging/speakup/selection.c -index b9359753784e..364978e63d8d 100644 ---- a/drivers/staging/speakup/selection.c -+++ b/drivers/staging/speakup/selection.c -@@ -139,7 +139,9 @@ static void __speakup_paste_selection(struct work_struct *work) - struct tty_ldisc *ld; - DECLARE_WAITQUEUE(wait, current); - -- ld = tty_ldisc_ref_wait(tty); -+ ld = tty_ldisc_ref(tty); -+ if (!ld) -+ goto tty_unref; - - /* FIXME: this is completely unsafe */ - add_wait_queue(&vc->paste_wait, &wait); -@@ -158,6 +160,7 @@ static void __speakup_paste_selection(struct work_struct *work) - current->state = TASK_RUNNING; - - tty_ldisc_deref(ld); -+tty_unref: - tty_kref_put(tty); - } - -diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c -index 06cd916f91fe..d74da9598d58 100644 ---- a/drivers/target/iscsi/iscsi_target.c -+++ b/drivers/target/iscsi/iscsi_target.c -@@ -3960,6 +3960,17 @@ reject: - return iscsit_add_reject(conn, ISCSI_REASON_BOOKMARK_NO_RESOURCES, buf); - } - -+static bool iscsi_target_check_conn_state(struct iscsi_conn *conn) -+{ -+ bool ret; -+ -+ spin_lock_bh(&conn->state_lock); -+ ret = (conn->conn_state != TARG_CONN_STATE_LOGGED_IN); -+ spin_unlock_bh(&conn->state_lock); -+ -+ return ret; -+} -+ - int iscsi_target_rx_thread(void *arg) - { - int ret, rc; -@@ -3977,7 +3988,7 @@ int iscsi_target_rx_thread(void *arg) - * incoming iscsi/tcp socket I/O, and/or failing the connection. - */ - rc = wait_for_completion_interruptible(&conn->rx_login_comp); -- if (rc < 0) -+ if (rc < 0 || iscsi_target_check_conn_state(conn)) - return 0; - - if (conn->conn_transport->transport_type == ISCSI_INFINIBAND) { -diff --git a/drivers/target/iscsi/iscsi_target_configfs.c b/drivers/target/iscsi/iscsi_target_configfs.c -index c45b3365d63d..200d779d0c03 100644 ---- a/drivers/target/iscsi/iscsi_target_configfs.c -+++ b/drivers/target/iscsi/iscsi_target_configfs.c -@@ -1730,7 +1730,8 @@ static void lio_tpg_release_fabric_acl( - } - - /* -- * Called with spin_lock_bh(struct se_portal_group->session_lock) held.. -+ * Called with spin_lock_irq(struct se_portal_group->session_lock) held -+ * or not held. - * - * Also, this function calls iscsit_inc_session_usage_count() on the - * struct iscsi_session in question. -@@ -1738,19 +1739,32 @@ static void lio_tpg_release_fabric_acl( - static int lio_tpg_shutdown_session(struct se_session *se_sess) - { - struct iscsi_session *sess = se_sess->fabric_sess_ptr; -+ struct se_portal_group *se_tpg = se_sess->se_tpg; -+ bool local_lock = false; -+ -+ if (!spin_is_locked(&se_tpg->session_lock)) { -+ spin_lock_irq(&se_tpg->session_lock); -+ local_lock = true; -+ } - - spin_lock(&sess->conn_lock); - if (atomic_read(&sess->session_fall_back_to_erl0) || - atomic_read(&sess->session_logout) || - (sess->time2retain_timer_flags & ISCSI_TF_EXPIRED)) { - spin_unlock(&sess->conn_lock); -+ if (local_lock) -+ spin_unlock_irq(&sess->conn_lock); - return 0; - } - atomic_set(&sess->session_reinstatement, 1); - spin_unlock(&sess->conn_lock); - - iscsit_stop_time2retain_timer(sess); -+ spin_unlock_irq(&se_tpg->session_lock); -+ - iscsit_stop_session(sess, 1, 1); -+ if (!local_lock) -+ spin_lock_irq(&se_tpg->session_lock); - - return 1; - } -diff --git a/drivers/target/iscsi/iscsi_target_nego.c b/drivers/target/iscsi/iscsi_target_nego.c -index 77c276acccb6..2a61a01142e9 100644 ---- a/drivers/target/iscsi/iscsi_target_nego.c -+++ b/drivers/target/iscsi/iscsi_target_nego.c -@@ -384,6 +384,7 @@ err: - if (login->login_complete) { - if (conn->rx_thread && conn->rx_thread_active) { - send_sig(SIGINT, conn->rx_thread, 1); -+ complete(&conn->rx_login_comp); - kthread_stop(conn->rx_thread); - } - if (conn->tx_thread && conn->tx_thread_active) { -diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c -index 7cb36813aac2..deee2b81afff 100644 ---- a/drivers/tty/pty.c -+++ b/drivers/tty/pty.c -@@ -623,7 +623,14 @@ static void pty_unix98_remove(struct tty_driver *driver, struct tty_struct *tty) - /* this is called once with whichever end is closed last */ - static void pty_unix98_shutdown(struct tty_struct *tty) - { -- devpts_kill_index(tty->driver_data, tty->index); -+ struct inode *ptmx_inode; -+ -+ if (tty->driver->subtype == PTY_TYPE_MASTER) -+ ptmx_inode = tty->driver_data; -+ else -+ ptmx_inode = tty->link->driver_data; -+ devpts_kill_index(ptmx_inode, tty->index); -+ devpts_del_ref(ptmx_inode); - } - - static const struct tty_operations ptm_unix98_ops = { -@@ -714,6 +721,18 @@ static int ptmx_open(struct inode *inode, struct file *filp) - set_bit(TTY_PTY_LOCK, &tty->flags); /* LOCK THE SLAVE */ - tty->driver_data = inode; - -+ /* -+ * In the case where all references to ptmx inode are dropped and we -+ * still have /dev/tty opened pointing to the master/slave pair (ptmx -+ * is closed/released before /dev/tty), we must make sure that the inode -+ * is still valid when we call the final pty_unix98_shutdown, thus we -+ * hold an additional reference to the ptmx inode. For the same /dev/tty -+ * last close case, we also need to make sure the super_block isn't -+ * destroyed (devpts instance unmounted), before /dev/tty is closed and -+ * on its release devpts_kill_index is called. -+ */ -+ devpts_add_ref(inode); -+ - tty_add_file(tty, filp); - - slave_inode = devpts_pty_new(inode, -diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c -index 9dd6fa3a1260..507677b9bdc7 100644 ---- a/drivers/usb/host/xhci.c -+++ b/drivers/usb/host/xhci.c -@@ -1502,7 +1502,9 @@ int xhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) - if (temp == 0xffffffff || (xhci->xhc_state & XHCI_STATE_HALTED)) { - xhci_dbg(xhci, "HW died, freeing TD.\n"); - urb_priv = urb->hcpriv; -- for (i = urb_priv->td_cnt; i < urb_priv->length; i++) { -+ for (i = urb_priv->td_cnt; -+ i < urb_priv->length && xhci->devs[urb->dev->slot_id]; -+ i++) { - td = urb_priv->td[i]; - if (!list_empty(&td->td_list)) - list_del_init(&td->td_list); -diff --git a/fs/aio.c b/fs/aio.c -index ded94c4fa30d..9798d4edfd8f 100644 ---- a/fs/aio.c -+++ b/fs/aio.c -@@ -977,12 +977,17 @@ static ssize_t aio_setup_vectored_rw(int rw, struct kiocb *kiocb, bool compat) - - static ssize_t aio_setup_single_vector(int rw, struct kiocb *kiocb) - { -- if (unlikely(!access_ok(!rw, kiocb->ki_buf, kiocb->ki_nbytes))) -- return -EFAULT; -+ size_t len = kiocb->ki_nbytes; -+ -+ if (len > MAX_RW_COUNT) -+ len = MAX_RW_COUNT; -+ -+ if (unlikely(!access_ok(!rw, kiocb->ki_buf, len))) -+ return -EFAULT; - - kiocb->ki_iovec = &kiocb->ki_inline_vec; - kiocb->ki_iovec->iov_base = kiocb->ki_buf; -- kiocb->ki_iovec->iov_len = kiocb->ki_nbytes; -+ kiocb->ki_iovec->iov_len = len; - kiocb->ki_nr_segs = 1; - return 0; - } -diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c -index d85f90c92bb4..bca854b44056 100644 ---- a/fs/btrfs/backref.c -+++ b/fs/btrfs/backref.c -@@ -1228,7 +1228,8 @@ char *btrfs_ref_to_path(struct btrfs_root *fs_root, struct btrfs_path *path, - read_extent_buffer(eb, dest + bytes_left, - name_off, name_len); - if (eb != eb_in) { -- btrfs_tree_read_unlock_blocking(eb); -+ if (!path->skip_locking) -+ btrfs_tree_read_unlock_blocking(eb); - free_extent_buffer(eb); - } - ret = inode_ref_info(parent, 0, fs_root, path, &found_key); -@@ -1247,9 +1248,10 @@ char *btrfs_ref_to_path(struct btrfs_root *fs_root, struct btrfs_path *path, - eb = path->nodes[0]; - /* make sure we can use eb after releasing the path */ - if (eb != eb_in) { -- atomic_inc(&eb->refs); -- btrfs_tree_read_lock(eb); -- btrfs_set_lock_blocking_rw(eb, BTRFS_READ_LOCK); -+ if (!path->skip_locking) -+ btrfs_set_lock_blocking_rw(eb, BTRFS_READ_LOCK); -+ path->nodes[0] = NULL; -+ path->locks[0] = 0; - } - btrfs_release_path(path); - iref = btrfs_item_ptr(eb, slot, struct btrfs_inode_ref); -diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c -index 5c807b23ca67..182e82f22b3a 100644 ---- a/fs/cifs/cifsencrypt.c -+++ b/fs/cifs/cifsencrypt.c -@@ -591,7 +591,7 @@ setup_ntlmv2_rsp(struct cifs_ses *ses, const struct nls_table *nls_cp) - - ses->auth_key.response = kmalloc(baselen + tilen, GFP_KERNEL); - if (!ses->auth_key.response) { -- rc = ENOMEM; -+ rc = -ENOMEM; - ses->auth_key.len = 0; - goto setup_ntlmv2_rsp_ret; - } -diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c -index a726b9f29cb7..61af24e379ad 100644 ---- a/fs/devpts/inode.c -+++ b/fs/devpts/inode.c -@@ -564,6 +564,26 @@ void devpts_kill_index(struct inode *ptmx_inode, int idx) - mutex_unlock(&allocated_ptys_lock); - } - -+/* -+ * pty code needs to hold extra references in case of last /dev/tty close -+ */ -+ -+void devpts_add_ref(struct inode *ptmx_inode) -+{ -+ struct super_block *sb = pts_sb_from_inode(ptmx_inode); -+ -+ atomic_inc(&sb->s_active); -+ ihold(ptmx_inode); -+} -+ -+void devpts_del_ref(struct inode *ptmx_inode) -+{ -+ struct super_block *sb = pts_sb_from_inode(ptmx_inode); -+ -+ iput(ptmx_inode); -+ deactivate_super(sb); -+} -+ - /** - * devpts_pty_new -- create a new inode in /dev/pts/ - * @ptmx_inode: inode of the master -diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c -index fa7d2e668c3a..cf0a70486618 100644 ---- a/fs/ext4/resize.c -+++ b/fs/ext4/resize.c -@@ -181,7 +181,7 @@ static struct ext4_new_flex_group_data *alloc_flex_gd(unsigned long flexbg_size) - if (flex_gd == NULL) - goto out3; - -- if (flexbg_size >= UINT_MAX / sizeof(struct ext4_new_flex_group_data)) -+ if (flexbg_size >= UINT_MAX / sizeof(struct ext4_new_group_data)) - goto out2; - flex_gd->count = flexbg_size; - -diff --git a/fs/fuse/file.c b/fs/fuse/file.c -index 4fafb8484bbc..35f604b5f408 100644 ---- a/fs/fuse/file.c -+++ b/fs/fuse/file.c -@@ -993,6 +993,7 @@ static ssize_t fuse_fill_write_pages(struct fuse_req *req, - - mark_page_accessed(page); - -+ iov_iter_advance(ii, tmp); - if (!tmp) { - unlock_page(page); - page_cache_release(page); -@@ -1005,7 +1006,6 @@ static ssize_t fuse_fill_write_pages(struct fuse_req *req, - req->page_descs[req->num_pages].length = tmp; - req->num_pages++; - -- iov_iter_advance(ii, tmp); - count += tmp; - pos += tmp; - offset += tmp; -diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c -index 78679b489484..d8ac734a1e44 100644 ---- a/fs/nfs/nfs4proc.c -+++ b/fs/nfs/nfs4proc.c -@@ -1005,6 +1005,7 @@ static void __update_open_stateid(struct nfs4_state *state, nfs4_stateid *open_s - * Protect the call to nfs4_state_set_mode_locked and - * serialise the stateid update - */ -+ spin_lock(&state->owner->so_lock); - write_seqlock(&state->seqlock); - if (deleg_stateid != NULL) { - nfs4_stateid_copy(&state->stateid, deleg_stateid); -@@ -1013,7 +1014,6 @@ static void __update_open_stateid(struct nfs4_state *state, nfs4_stateid *open_s - if (open_stateid != NULL) - nfs_set_open_stateid_locked(state, open_stateid, fmode); - write_sequnlock(&state->seqlock); -- spin_lock(&state->owner->so_lock); - update_open_stateflags(state, fmode); - spin_unlock(&state->owner->so_lock); - } -diff --git a/fs/proc/array.c b/fs/proc/array.c -index 09f0d9c374a3..5c45eb5e4e0d 100644 ---- a/fs/proc/array.c -+++ b/fs/proc/array.c -@@ -398,7 +398,7 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns, - - state = *get_task_state(task); - vsize = eip = esp = 0; -- permitted = ptrace_may_access(task, PTRACE_MODE_READ | PTRACE_MODE_NOAUDIT); -+ permitted = ptrace_may_access(task, PTRACE_MODE_READ_FSCREDS | PTRACE_MODE_NOAUDIT); - mm = get_task_mm(task); - if (mm) { - vsize = task_vsize(mm); -diff --git a/fs/proc/base.c b/fs/proc/base.c -index 8fc784aef0b8..7b5d453ebf53 100644 ---- a/fs/proc/base.c -+++ b/fs/proc/base.c -@@ -239,7 +239,7 @@ out: - - static int proc_pid_auxv(struct task_struct *task, char *buffer) - { -- struct mm_struct *mm = mm_access(task, PTRACE_MODE_READ); -+ struct mm_struct *mm = mm_access(task, PTRACE_MODE_READ_FSCREDS); - int res = PTR_ERR(mm); - if (mm && !IS_ERR(mm)) { - unsigned int nwords = 0; -@@ -269,7 +269,7 @@ static int proc_pid_wchan(struct task_struct *task, char *buffer) - wchan = get_wchan(task); - - if (lookup_symbol_name(wchan, symname) < 0) -- if (!ptrace_may_access(task, PTRACE_MODE_READ)) -+ if (!ptrace_may_access(task, PTRACE_MODE_READ_FSCREDS)) - return 0; - else - return sprintf(buffer, "%lu", wchan); -@@ -283,7 +283,7 @@ static int lock_trace(struct task_struct *task) - int err = mutex_lock_killable(&task->signal->cred_guard_mutex); - if (err) - return err; -- if (!ptrace_may_access(task, PTRACE_MODE_ATTACH)) { -+ if (!ptrace_may_access(task, PTRACE_MODE_ATTACH_FSCREDS)) { - mutex_unlock(&task->signal->cred_guard_mutex); - return -EPERM; - } -@@ -557,7 +557,7 @@ static int proc_fd_access_allowed(struct inode *inode) - */ - task = get_proc_task(inode); - if (task) { -- allowed = ptrace_may_access(task, PTRACE_MODE_READ); -+ allowed = ptrace_may_access(task, PTRACE_MODE_READ_FSCREDS); - put_task_struct(task); - } - return allowed; -@@ -592,7 +592,7 @@ static bool has_pid_permissions(struct pid_namespace *pid, - return true; - if (in_group_p(pid->pid_gid)) - return true; -- return ptrace_may_access(task, PTRACE_MODE_READ); -+ return ptrace_may_access(task, PTRACE_MODE_READ_FSCREDS); - } - - -@@ -707,7 +707,7 @@ static int __mem_open(struct inode *inode, struct file *file, unsigned int mode) - if (!task) - return -ESRCH; - -- mm = mm_access(task, mode); -+ mm = mm_access(task, mode | PTRACE_MODE_FSCREDS); - put_task_struct(task); - - if (IS_ERR(mm)) -@@ -1761,7 +1761,7 @@ static int map_files_d_revalidate(struct dentry *dentry, unsigned int flags) - if (!task) - goto out_notask; - -- mm = mm_access(task, PTRACE_MODE_READ); -+ mm = mm_access(task, PTRACE_MODE_READ_FSCREDS); - if (IS_ERR_OR_NULL(mm)) - goto out; - -@@ -1896,7 +1896,7 @@ static struct dentry *proc_map_files_lookup(struct inode *dir, - goto out; - - result = ERR_PTR(-EACCES); -- if (!ptrace_may_access(task, PTRACE_MODE_READ)) -+ if (!ptrace_may_access(task, PTRACE_MODE_READ_FSCREDS)) - goto out_put_task; - - result = ERR_PTR(-ENOENT); -@@ -1952,7 +1952,7 @@ proc_map_files_readdir(struct file *filp, void *dirent, filldir_t filldir) - goto out; - - ret = -EACCES; -- if (!ptrace_may_access(task, PTRACE_MODE_READ)) -+ if (!ptrace_may_access(task, PTRACE_MODE_READ_FSCREDS)) - goto out_put_task; - - ret = 0; -@@ -2488,7 +2488,7 @@ static int do_io_accounting(struct task_struct *task, char *buffer, int whole) - if (result) - return result; - -- if (!ptrace_may_access(task, PTRACE_MODE_READ)) { -+ if (!ptrace_may_access(task, PTRACE_MODE_READ_FSCREDS)) { - result = -EACCES; - goto out_unlock; - } -diff --git a/fs/proc/namespaces.c b/fs/proc/namespaces.c -index 54bdc6701e9f..ac49a8d4aaf8 100644 ---- a/fs/proc/namespaces.c -+++ b/fs/proc/namespaces.c -@@ -125,7 +125,7 @@ static void *proc_ns_follow_link(struct dentry *dentry, struct nameidata *nd) - if (!task) - goto out; - -- if (!ptrace_may_access(task, PTRACE_MODE_READ)) -+ if (!ptrace_may_access(task, PTRACE_MODE_READ_FSCREDS)) - goto out_put_task; - - ns_path.dentry = proc_ns_get_dentry(sb, task, ei->ns.ns_ops); -@@ -158,7 +158,7 @@ static int proc_ns_readlink(struct dentry *dentry, char __user *buffer, int bufl - if (!task) - goto out; - -- if (!ptrace_may_access(task, PTRACE_MODE_READ)) -+ if (!ptrace_may_access(task, PTRACE_MODE_READ_FSCREDS)) - goto out_put_task; - - len = -ENOENT; -diff --git a/fs/udf/inode.c b/fs/udf/inode.c -index 789814f27438..5c1120a5fa42 100644 ---- a/fs/udf/inode.c -+++ b/fs/udf/inode.c -@@ -2055,14 +2055,29 @@ void udf_write_aext(struct inode *inode, struct extent_position *epos, - epos->offset += adsize; - } - -+/* -+ * Only 1 indirect extent in a row really makes sense but allow upto 16 in case -+ * someone does some weird stuff. -+ */ -+#define UDF_MAX_INDIR_EXTS 16 -+ - int8_t udf_next_aext(struct inode *inode, struct extent_position *epos, - struct kernel_lb_addr *eloc, uint32_t *elen, int inc) - { - int8_t etype; -+ unsigned int indirections = 0; - - while ((etype = udf_current_aext(inode, epos, eloc, elen, inc)) == - (EXT_NEXT_EXTENT_ALLOCDECS >> 30)) { - int block; -+ -+ if (++indirections > UDF_MAX_INDIR_EXTS) { -+ udf_err(inode->i_sb, -+ "too many indirect extents in inode %lu\n", -+ inode->i_ino); -+ return -1; -+ } -+ - epos->block = *eloc; - epos->offset = sizeof(struct allocExtDesc); - brelse(epos->bh); -diff --git a/fs/udf/unicode.c b/fs/udf/unicode.c -index 44b815e57f94..685fbd8a2937 100644 ---- a/fs/udf/unicode.c -+++ b/fs/udf/unicode.c -@@ -132,11 +132,15 @@ int udf_CS0toUTF8(struct ustr *utf_o, const struct ustr *ocu_i) - if (c < 0x80U) - utf_o->u_name[utf_o->u_len++] = (uint8_t)c; - else if (c < 0x800U) { -+ if (utf_o->u_len > (UDF_NAME_LEN - 4)) -+ break; - utf_o->u_name[utf_o->u_len++] = - (uint8_t)(0xc0 | (c >> 6)); - utf_o->u_name[utf_o->u_len++] = - (uint8_t)(0x80 | (c & 0x3f)); - } else { -+ if (utf_o->u_len > (UDF_NAME_LEN - 5)) -+ break; - utf_o->u_name[utf_o->u_len++] = - (uint8_t)(0xe0 | (c >> 12)); - utf_o->u_name[utf_o->u_len++] = -@@ -177,17 +181,22 @@ int udf_CS0toUTF8(struct ustr *utf_o, const struct ustr *ocu_i) - static int udf_UTF8toCS0(dstring *ocu, struct ustr *utf, int length) - { - unsigned c, i, max_val, utf_char; -- int utf_cnt, u_len; -+ int utf_cnt, u_len, u_ch; - - memset(ocu, 0, sizeof(dstring) * length); - ocu[0] = 8; - max_val = 0xffU; -+ u_ch = 1; - - try_again: - u_len = 0U; - utf_char = 0U; - utf_cnt = 0U; - for (i = 0U; i < utf->u_len; i++) { -+ /* Name didn't fit? */ -+ if (u_len + 1 + u_ch >= length) -+ return 0; -+ - c = (uint8_t)utf->u_name[i]; - - /* Complete a multi-byte UTF-8 character */ -@@ -229,6 +238,7 @@ try_again: - if (max_val == 0xffU) { - max_val = 0xffffU; - ocu[0] = (uint8_t)0x10U; -+ u_ch = 2; - goto try_again; - } - goto error_out; -@@ -281,7 +291,7 @@ static int udf_CS0toNLS(struct nls_table *nls, struct ustr *utf_o, - c = (c << 8) | ocu[i++]; - - len = nls->uni2char(c, &utf_o->u_name[utf_o->u_len], -- UDF_NAME_LEN - utf_o->u_len); -+ UDF_NAME_LEN - 2 - utf_o->u_len); - /* Valid character? */ - if (len >= 0) - utf_o->u_len += len; -@@ -299,15 +309,19 @@ static int udf_NLStoCS0(struct nls_table *nls, dstring *ocu, struct ustr *uni, - int len; - unsigned i, max_val; - uint16_t uni_char; -- int u_len; -+ int u_len, u_ch; - - memset(ocu, 0, sizeof(dstring) * length); - ocu[0] = 8; - max_val = 0xffU; -+ u_ch = 1; - - try_again: - u_len = 0U; - for (i = 0U; i < uni->u_len; i++) { -+ /* Name didn't fit? */ -+ if (u_len + 1 + u_ch >= length) -+ return 0; - len = nls->char2uni(&uni->u_name[i], uni->u_len - i, &uni_char); - if (!len) - continue; -@@ -320,6 +334,7 @@ try_again: - if (uni_char > max_val) { - max_val = 0xffffU; - ocu[0] = (uint8_t)0x10U; -+ u_ch = 2; - goto try_again; - } - -diff --git a/include/linux/compiler.h b/include/linux/compiler.h -index a2329c5e6206..a2ce6f8871c4 100644 ---- a/include/linux/compiler.h -+++ b/include/linux/compiler.h -@@ -131,7 +131,7 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect); - */ - #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) ) - #define __trace_if(cond) \ -- if (__builtin_constant_p((cond)) ? !!(cond) : \ -+ if (__builtin_constant_p(!!(cond)) ? !!(cond) : \ - ({ \ - int ______r; \ - static struct ftrace_branch_data \ -diff --git a/include/linux/devpts_fs.h b/include/linux/devpts_fs.h -index 251a2090a554..e0ee0b3000b2 100644 ---- a/include/linux/devpts_fs.h -+++ b/include/linux/devpts_fs.h -@@ -19,6 +19,8 @@ - - int devpts_new_index(struct inode *ptmx_inode); - void devpts_kill_index(struct inode *ptmx_inode, int idx); -+void devpts_add_ref(struct inode *ptmx_inode); -+void devpts_del_ref(struct inode *ptmx_inode); - /* mknod in devpts */ - struct inode *devpts_pty_new(struct inode *ptmx_inode, dev_t device, int index, - void *priv); -@@ -32,6 +34,8 @@ void devpts_pty_kill(struct inode *inode); - /* Dummy stubs in the no-pty case */ - static inline int devpts_new_index(struct inode *ptmx_inode) { return -EINVAL; } - static inline void devpts_kill_index(struct inode *ptmx_inode, int idx) { } -+static inline void devpts_add_ref(struct inode *ptmx_inode) { } -+static inline void devpts_del_ref(struct inode *ptmx_inode) { } - static inline struct inode *devpts_pty_new(struct inode *ptmx_inode, - dev_t device, int index, void *priv) - { -diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h -index bb980ae6d9d3..6af8988f5ddd 100644 ---- a/include/linux/ptrace.h -+++ b/include/linux/ptrace.h -@@ -56,7 +56,29 @@ extern void exit_ptrace(struct task_struct *tracer); - #define PTRACE_MODE_READ 0x01 - #define PTRACE_MODE_ATTACH 0x02 - #define PTRACE_MODE_NOAUDIT 0x04 --/* Returns true on success, false on denial. */ -+#define PTRACE_MODE_FSCREDS 0x08 -+#define PTRACE_MODE_REALCREDS 0x10 -+ -+/* shorthands for READ/ATTACH and FSCREDS/REALCREDS combinations */ -+#define PTRACE_MODE_READ_FSCREDS (PTRACE_MODE_READ | PTRACE_MODE_FSCREDS) -+#define PTRACE_MODE_READ_REALCREDS (PTRACE_MODE_READ | PTRACE_MODE_REALCREDS) -+#define PTRACE_MODE_ATTACH_FSCREDS (PTRACE_MODE_ATTACH | PTRACE_MODE_FSCREDS) -+#define PTRACE_MODE_ATTACH_REALCREDS (PTRACE_MODE_ATTACH | PTRACE_MODE_REALCREDS) -+ -+/** -+ * ptrace_may_access - check whether the caller is permitted to access -+ * a target task. -+ * @task: target task -+ * @mode: selects type of access and caller credentials -+ * -+ * Returns true on success, false on denial. -+ * -+ * One of the flags PTRACE_MODE_FSCREDS and PTRACE_MODE_REALCREDS must -+ * be set in @mode to specify whether the access was requested through -+ * a filesystem syscall (should use effective capabilities and fsuid -+ * of the caller) or through an explicit syscall such as -+ * process_vm_writev or ptrace (and should use the real credentials). -+ */ - extern bool ptrace_may_access(struct task_struct *task, unsigned int mode); - - static inline int ptrace_reparented(struct task_struct *child) -diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h -index ffc444c38b0a..e02e09f85fad 100644 ---- a/include/linux/radix-tree.h -+++ b/include/linux/radix-tree.h -@@ -322,12 +322,28 @@ void **radix_tree_next_chunk(struct radix_tree_root *root, - struct radix_tree_iter *iter, unsigned flags); - - /** -+ * radix_tree_iter_retry - retry this chunk of the iteration -+ * @iter: iterator state -+ * -+ * If we iterate over a tree protected only by the RCU lock, a race -+ * against deletion or creation may result in seeing a slot for which -+ * radix_tree_deref_retry() returns true. If so, call this function -+ * and continue the iteration. -+ */ -+static inline __must_check -+void **radix_tree_iter_retry(struct radix_tree_iter *iter) -+{ -+ iter->next_index = iter->index; -+ return NULL; -+} -+ -+/** - * radix_tree_chunk_size - get current chunk size - * - * @iter: pointer to radix tree iterator - * Returns: current chunk size - */ --static __always_inline unsigned -+static __always_inline long - radix_tree_chunk_size(struct radix_tree_iter *iter) - { - return iter->next_index - iter->index; -@@ -361,9 +377,9 @@ radix_tree_next_slot(void **slot, struct radix_tree_iter *iter, unsigned flags) - return slot + offset + 1; - } - } else { -- unsigned size = radix_tree_chunk_size(iter) - 1; -+ long size = radix_tree_chunk_size(iter); - -- while (size--) { -+ while (--size > 0) { - slot++; - iter->index++; - if (likely(*slot)) -diff --git a/kernel/events/core.c b/kernel/events/core.c -index d9b0aad17dbf..0f5207839673 100644 ---- a/kernel/events/core.c -+++ b/kernel/events/core.c -@@ -2938,7 +2938,7 @@ find_lively_task_by_vpid(pid_t vpid) - - /* Reuse ptrace permission checks for now. */ - err = -EACCES; -- if (!ptrace_may_access(task, PTRACE_MODE_READ)) -+ if (!ptrace_may_access(task, PTRACE_MODE_READ_REALCREDS)) - goto errout; - - return task; -@@ -5639,6 +5639,10 @@ static int perf_tp_filter_match(struct perf_event *event, - { - void *record = data->raw->data; - -+ /* only top level events have filters set */ -+ if (event->parent) -+ event = event->parent; -+ - if (likely(!event->filter) || filter_match_preds(event->filter, record)) - return 1; - return 0; -diff --git a/kernel/futex.c b/kernel/futex.c -index 625a4e659e7a..edc4beae4df1 100644 ---- a/kernel/futex.c -+++ b/kernel/futex.c -@@ -2494,6 +2494,11 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags, - if (q.pi_state && (q.pi_state->owner != current)) { - spin_lock(q.lock_ptr); - ret = fixup_pi_state_owner(uaddr2, &q, current); -+ /* -+ * Drop the reference to the pi state which -+ * the requeue_pi() code acquired for us. -+ */ -+ free_pi_state(q.pi_state); - spin_unlock(q.lock_ptr); - } - } else { -@@ -2620,7 +2625,7 @@ SYSCALL_DEFINE3(get_robust_list, int, pid, - } - - ret = -EPERM; -- if (!ptrace_may_access(p, PTRACE_MODE_READ)) -+ if (!ptrace_may_access(p, PTRACE_MODE_READ_REALCREDS)) - goto err_unlock; - - head = p->robust_list; -diff --git a/kernel/futex_compat.c b/kernel/futex_compat.c -index f9f44fd4d34d..3888617a1f9e 100644 ---- a/kernel/futex_compat.c -+++ b/kernel/futex_compat.c -@@ -155,7 +155,7 @@ COMPAT_SYSCALL_DEFINE3(get_robust_list, int, pid, - } - - ret = -EPERM; -- if (!ptrace_may_access(p, PTRACE_MODE_READ)) -+ if (!ptrace_may_access(p, PTRACE_MODE_READ_REALCREDS)) - goto err_unlock; - - head = p->compat_robust_list; -diff --git a/kernel/kcmp.c b/kernel/kcmp.c -index 0aa69ea1d8fd..3a47fa998fe0 100644 ---- a/kernel/kcmp.c -+++ b/kernel/kcmp.c -@@ -122,8 +122,8 @@ SYSCALL_DEFINE5(kcmp, pid_t, pid1, pid_t, pid2, int, type, - &task2->signal->cred_guard_mutex); - if (ret) - goto err; -- if (!ptrace_may_access(task1, PTRACE_MODE_READ) || -- !ptrace_may_access(task2, PTRACE_MODE_READ)) { -+ if (!ptrace_may_access(task1, PTRACE_MODE_READ_REALCREDS) || -+ !ptrace_may_access(task2, PTRACE_MODE_READ_REALCREDS)) { - ret = -EPERM; - goto err_unlock; - } -diff --git a/kernel/module.c b/kernel/module.c -index fd2afdf48a89..70a4754c001f 100644 ---- a/kernel/module.c -+++ b/kernel/module.c -@@ -3398,6 +3398,11 @@ static inline int is_arm_mapping_symbol(const char *str) - && (str[2] == '\0' || str[2] == '.'); - } - -+static const char *symname(struct module *mod, unsigned int symnum) -+{ -+ return mod->strtab + mod->symtab[symnum].st_name; -+} -+ - static const char *get_ksymbol(struct module *mod, - unsigned long addr, - unsigned long *size, -@@ -3420,15 +3425,15 @@ static const char *get_ksymbol(struct module *mod, - - /* We ignore unnamed symbols: they're uninformative - * and inserted at a whim. */ -+ if (*symname(mod, i) == '\0' -+ || is_arm_mapping_symbol(symname(mod, i))) -+ continue; -+ - if (mod->symtab[i].st_value <= addr -- && mod->symtab[i].st_value > mod->symtab[best].st_value -- && *(mod->strtab + mod->symtab[i].st_name) != '\0' -- && !is_arm_mapping_symbol(mod->strtab + mod->symtab[i].st_name)) -+ && mod->symtab[i].st_value > mod->symtab[best].st_value) - best = i; - if (mod->symtab[i].st_value > addr -- && mod->symtab[i].st_value < nextval -- && *(mod->strtab + mod->symtab[i].st_name) != '\0' -- && !is_arm_mapping_symbol(mod->strtab + mod->symtab[i].st_name)) -+ && mod->symtab[i].st_value < nextval) - nextval = mod->symtab[i].st_value; - } - -@@ -3439,7 +3444,7 @@ static const char *get_ksymbol(struct module *mod, - *size = nextval - mod->symtab[best].st_value; - if (offset) - *offset = addr - mod->symtab[best].st_value; -- return mod->strtab + mod->symtab[best].st_name; -+ return symname(mod, best); - } - - /* For kallsyms to ask for address resolution. NULL means not found. Careful -@@ -3540,8 +3545,7 @@ int module_get_kallsym(unsigned int symnum, unsigned long *value, char *type, - if (symnum < mod->num_symtab) { - *value = mod->symtab[symnum].st_value; - *type = mod->symtab[symnum].st_info; -- strlcpy(name, mod->strtab + mod->symtab[symnum].st_name, -- KSYM_NAME_LEN); -+ strlcpy(name, symname(mod, symnum), KSYM_NAME_LEN); - strlcpy(module_name, mod->name, MODULE_NAME_LEN); - *exported = is_exported(name, *value, mod); - preempt_enable(); -@@ -3558,7 +3562,7 @@ static unsigned long mod_find_symname(struct module *mod, const char *name) - unsigned int i; - - for (i = 0; i < mod->num_symtab; i++) -- if (strcmp(name, mod->strtab+mod->symtab[i].st_name) == 0 && -+ if (strcmp(name, symname(mod, i)) == 0 && - mod->symtab[i].st_info != 'U') - return mod->symtab[i].st_value; - return 0; -@@ -3602,7 +3606,7 @@ int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *, - if (mod->state == MODULE_STATE_UNFORMED) - continue; - for (i = 0; i < mod->num_symtab; i++) { -- ret = fn(data, mod->strtab + mod->symtab[i].st_name, -+ ret = fn(data, symname(mod, i), - mod, mod->symtab[i].st_value); - if (ret != 0) - return ret; -diff --git a/kernel/ptrace.c b/kernel/ptrace.c -index 30ab20623bca..72b0b3e0e065 100644 ---- a/kernel/ptrace.c -+++ b/kernel/ptrace.c -@@ -225,6 +225,14 @@ static int ptrace_has_cap(struct user_namespace *ns, unsigned int mode) - static int __ptrace_may_access(struct task_struct *task, unsigned int mode) - { - const struct cred *cred = current_cred(), *tcred; -+ int dumpable = 0; -+ kuid_t caller_uid; -+ kgid_t caller_gid; -+ -+ if (!(mode & PTRACE_MODE_FSCREDS) == !(mode & PTRACE_MODE_REALCREDS)) { -+ WARN(1, "denying ptrace access check without PTRACE_MODE_*CREDS\n"); -+ return -EPERM; -+ } - - /* May we inspect the given task? - * This check is used both for attaching with ptrace -@@ -234,18 +242,33 @@ static int __ptrace_may_access(struct task_struct *task, unsigned int mode) - * because setting up the necessary parent/child relationship - * or halting the specified task is impossible. - */ -- int dumpable = 0; -+ - /* Don't let security modules deny introspection */ - if (same_thread_group(task, current)) - return 0; - rcu_read_lock(); -+ if (mode & PTRACE_MODE_FSCREDS) { -+ caller_uid = cred->fsuid; -+ caller_gid = cred->fsgid; -+ } else { -+ /* -+ * Using the euid would make more sense here, but something -+ * in userland might rely on the old behavior, and this -+ * shouldn't be a security problem since -+ * PTRACE_MODE_REALCREDS implies that the caller explicitly -+ * used a syscall that requests access to another process -+ * (and not a filesystem syscall to procfs). -+ */ -+ caller_uid = cred->uid; -+ caller_gid = cred->gid; -+ } - tcred = __task_cred(task); -- if (uid_eq(cred->uid, tcred->euid) && -- uid_eq(cred->uid, tcred->suid) && -- uid_eq(cred->uid, tcred->uid) && -- gid_eq(cred->gid, tcred->egid) && -- gid_eq(cred->gid, tcred->sgid) && -- gid_eq(cred->gid, tcred->gid)) -+ if (uid_eq(caller_uid, tcred->euid) && -+ uid_eq(caller_uid, tcred->suid) && -+ uid_eq(caller_uid, tcred->uid) && -+ gid_eq(caller_gid, tcred->egid) && -+ gid_eq(caller_gid, tcred->sgid) && -+ gid_eq(caller_gid, tcred->gid)) - goto ok; - if (ptrace_has_cap(tcred->user_ns, mode)) - goto ok; -@@ -312,7 +335,7 @@ static int ptrace_attach(struct task_struct *task, long request, - goto out; - - task_lock(task); -- retval = __ptrace_may_access(task, PTRACE_MODE_ATTACH); -+ retval = __ptrace_may_access(task, PTRACE_MODE_ATTACH_REALCREDS); - task_unlock(task); - if (retval) - goto unlock_creds; -diff --git a/lib/dma-debug.c b/lib/dma-debug.c -index d87a17a819d0..eb43517bf261 100644 ---- a/lib/dma-debug.c -+++ b/lib/dma-debug.c -@@ -962,7 +962,7 @@ static inline bool overlap(void *addr, unsigned long len, void *start, void *end - - static void check_for_illegal_area(struct device *dev, void *addr, unsigned long len) - { -- if (overlap(addr, len, _text, _etext) || -+ if (overlap(addr, len, _stext, _etext) || - overlap(addr, len, __start_rodata, __end_rodata)) - err_printk(dev, NULL, "DMA-API: device driver maps memory from kernel text or rodata [addr=%p] [len=%lu]\n", addr, len); - } -diff --git a/lib/klist.c b/lib/klist.c -index 358a368a2947..2e59aecbec0d 100644 ---- a/lib/klist.c -+++ b/lib/klist.c -@@ -282,9 +282,9 @@ void klist_iter_init_node(struct klist *k, struct klist_iter *i, - struct klist_node *n) - { - i->i_klist = k; -- i->i_cur = n; -- if (n) -- kref_get(&n->n_ref); -+ i->i_cur = NULL; -+ if (n && kref_get_unless_zero(&n->n_ref)) -+ i->i_cur = n; - } - EXPORT_SYMBOL_GPL(klist_iter_init_node); - -diff --git a/lib/radix-tree.c b/lib/radix-tree.c -index e7964296fd50..936a02c1c77b 100644 ---- a/lib/radix-tree.c -+++ b/lib/radix-tree.c -@@ -1015,9 +1015,13 @@ radix_tree_gang_lookup(struct radix_tree_root *root, void **results, - return 0; - - radix_tree_for_each_slot(slot, root, &iter, first_index) { -- results[ret] = indirect_to_ptr(rcu_dereference_raw(*slot)); -+ results[ret] = rcu_dereference_raw(*slot); - if (!results[ret]) - continue; -+ if (radix_tree_is_indirect_ptr(results[ret])) { -+ slot = radix_tree_iter_retry(&iter); -+ continue; -+ } - if (++ret == max_items) - break; - } -@@ -1094,9 +1098,13 @@ radix_tree_gang_lookup_tag(struct radix_tree_root *root, void **results, - return 0; - - radix_tree_for_each_tagged(slot, root, &iter, first_index, tag) { -- results[ret] = indirect_to_ptr(rcu_dereference_raw(*slot)); -+ results[ret] = rcu_dereference_raw(*slot); - if (!results[ret]) - continue; -+ if (radix_tree_is_indirect_ptr(results[ret])) { -+ slot = radix_tree_iter_retry(&iter); -+ continue; -+ } - if (++ret == max_items) - break; - } -diff --git a/mm/memcontrol.c b/mm/memcontrol.c -index eaa3accb01e7..437ae2cbe102 100644 ---- a/mm/memcontrol.c -+++ b/mm/memcontrol.c -@@ -5790,16 +5790,17 @@ static void mem_cgroup_usage_unregister_event(struct cgroup *cgrp, - swap_buffers: - /* Swap primary and spare array */ - thresholds->spare = thresholds->primary; -- /* If all events are unregistered, free the spare array */ -- if (!new) { -- kfree(thresholds->spare); -- thresholds->spare = NULL; -- } - - rcu_assign_pointer(thresholds->primary, new); - - /* To be sure that nobody uses thresholds */ - synchronize_rcu(); -+ -+ /* If all events are unregistered, free the spare array */ -+ if (!new) { -+ kfree(thresholds->spare); -+ thresholds->spare = NULL; -+ } - unlock: - mutex_unlock(&memcg->thresholds_lock); - } -diff --git a/mm/memory-failure.c b/mm/memory-failure.c -index f97d709594e6..37df20faddd5 100644 ---- a/mm/memory-failure.c -+++ b/mm/memory-failure.c -@@ -1472,7 +1472,7 @@ static int get_any_page(struct page *page, unsigned long pfn, int flags) - * Did it turn free? - */ - ret = __get_any_page(page, pfn, 0); -- if (!PageLRU(page)) { -+ if (ret == 1 && !PageLRU(page)) { - /* Drop page reference which is from __get_any_page() */ - put_page(page); - pr_info("soft_offline: %#lx: unknown non LRU page type %lx\n", -diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c -index d85d3a0e06ce..7f1bf93fa87f 100644 ---- a/mm/memory_hotplug.c -+++ b/mm/memory_hotplug.c -@@ -1209,23 +1209,30 @@ int is_mem_section_removable(unsigned long start_pfn, unsigned long nr_pages) - */ - static int test_pages_in_a_zone(unsigned long start_pfn, unsigned long end_pfn) - { -- unsigned long pfn; -+ unsigned long pfn, sec_end_pfn; - struct zone *zone = NULL; - struct page *page; - int i; -- for (pfn = start_pfn; -+ for (pfn = start_pfn, sec_end_pfn = SECTION_ALIGN_UP(start_pfn); - pfn < end_pfn; -- pfn += MAX_ORDER_NR_PAGES) { -- i = 0; -- /* This is just a CONFIG_HOLES_IN_ZONE check.*/ -- while ((i < MAX_ORDER_NR_PAGES) && !pfn_valid_within(pfn + i)) -- i++; -- if (i == MAX_ORDER_NR_PAGES) -+ pfn = sec_end_pfn + 1, sec_end_pfn += PAGES_PER_SECTION) { -+ /* Make sure the memory section is present first */ -+ if (!present_section_nr(pfn_to_section_nr(pfn))) - continue; -- page = pfn_to_page(pfn + i); -- if (zone && page_zone(page) != zone) -- return 0; -- zone = page_zone(page); -+ for (; pfn < sec_end_pfn && pfn < end_pfn; -+ pfn += MAX_ORDER_NR_PAGES) { -+ i = 0; -+ /* This is just a CONFIG_HOLES_IN_ZONE check.*/ -+ while ((i < MAX_ORDER_NR_PAGES) && -+ !pfn_valid_within(pfn + i)) -+ i++; -+ if (i == MAX_ORDER_NR_PAGES) -+ continue; -+ page = pfn_to_page(pfn + i); -+ if (zone && page_zone(page) != zone) -+ return 0; -+ zone = page_zone(page); -+ } - } - return 1; - } -diff --git a/mm/process_vm_access.c b/mm/process_vm_access.c -index fd26d0433509..e739825be8b3 100644 ---- a/mm/process_vm_access.c -+++ b/mm/process_vm_access.c -@@ -298,7 +298,7 @@ static ssize_t process_vm_rw_core(pid_t pid, const struct iovec *lvec, - goto free_proc_pages; - } - -- mm = mm_access(task, PTRACE_MODE_ATTACH); -+ mm = mm_access(task, PTRACE_MODE_ATTACH_REALCREDS); - if (!mm || IS_ERR(mm)) { - rc = IS_ERR(mm) ? PTR_ERR(mm) : -ESRCH; - /* -diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c -index 9ec416552cc5..8d69df16f6a8 100644 ---- a/net/ipv6/ip6mr.c -+++ b/net/ipv6/ip6mr.c -@@ -336,7 +336,7 @@ static struct mr6_table *ip6mr_new_table(struct net *net, u32 id) - - static void ip6mr_free_table(struct mr6_table *mrt) - { -- del_timer(&mrt->ipmr_expire_timer); -+ del_timer_sync(&mrt->ipmr_expire_timer); - mroute_clean_tables(mrt, true); - kfree(mrt); - } -diff --git a/scripts/bloat-o-meter b/scripts/bloat-o-meter -index 6129020c41a9..81228a443122 100755 ---- a/scripts/bloat-o-meter -+++ b/scripts/bloat-o-meter -@@ -55,8 +55,8 @@ for name in common: - delta.sort() - delta.reverse() - --print "add/remove: %s/%s grow/shrink: %s/%s up/down: %s/%s (%s)" % \ -- (add, remove, grow, shrink, up, -down, up-down) --print "%-40s %7s %7s %+7s" % ("function", "old", "new", "delta") -+print("add/remove: %s/%s grow/shrink: %s/%s up/down: %s/%s (%s)" % \ -+ (add, remove, grow, shrink, up, -down, up-down)) -+print("%-40s %7s %7s %+7s" % ("function", "old", "new", "delta")) - for d, n in delta: -- if d: print "%-40s %7s %7s %+7d" % (n, old.get(n,"-"), new.get(n,"-"), d) -+ if d: print("%-40s %7s %7s %+7d" % (n, old.get(n,"-"), new.get(n,"-"), d)) -diff --git a/security/commoncap.c b/security/commoncap.c -index c9219a66b7c6..4fd7bf2b19e1 100644 ---- a/security/commoncap.c -+++ b/security/commoncap.c -@@ -142,12 +142,17 @@ int cap_ptrace_access_check(struct task_struct *child, unsigned int mode) - { - int ret = 0; - const struct cred *cred, *child_cred; -+ const kernel_cap_t *caller_caps; - - rcu_read_lock(); - cred = current_cred(); - child_cred = __task_cred(child); -+ if (mode & PTRACE_MODE_FSCREDS) -+ caller_caps = &cred->cap_effective; -+ else -+ caller_caps = &cred->cap_permitted; - if (cred->user_ns == child_cred->user_ns && -- cap_issubset(child_cred->cap_permitted, cred->cap_permitted)) -+ cap_issubset(child_cred->cap_permitted, *caller_caps)) - goto out; - if (ns_capable(child_cred->user_ns, CAP_SYS_PTRACE)) - goto out; -diff --git a/sound/core/seq/seq_ports.c b/sound/core/seq/seq_ports.c -index 67c91d226552..ee0522a8f730 100644 ---- a/sound/core/seq/seq_ports.c -+++ b/sound/core/seq/seq_ports.c -@@ -540,19 +540,22 @@ static void delete_and_unsubscribe_port(struct snd_seq_client *client, - bool is_src, bool ack) - { - struct snd_seq_port_subs_info *grp; -+ struct list_head *list; -+ bool empty; - - grp = is_src ? &port->c_src : &port->c_dest; -+ list = is_src ? &subs->src_list : &subs->dest_list; - down_write(&grp->list_mutex); - write_lock_irq(&grp->list_lock); -- if (is_src) -- list_del(&subs->src_list); -- else -- list_del(&subs->dest_list); -+ empty = list_empty(list); -+ if (!empty) -+ list_del_init(list); - grp->exclusive = 0; - write_unlock_irq(&grp->list_lock); - up_write(&grp->list_mutex); - -- unsubscribe_port(client, port, grp, &subs->info, ack); -+ if (!empty) -+ unsubscribe_port(client, port, grp, &subs->info, ack); - } - - /* connect two ports */ -diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c -index 82b0606dcb8a..c3efcf2f816b 100644 ---- a/tools/lib/traceevent/event-parse.c -+++ b/tools/lib/traceevent/event-parse.c -@@ -4190,13 +4190,12 @@ static void pretty_print(struct trace_seq *s, void *data, int size, struct event - sizeof(long) != 8) { - char *p; - -- ls = 2; - /* make %l into %ll */ -- p = strchr(format, 'l'); -- if (p) -+ if (ls == 1 && (p = strchr(format, 'l'))) - memmove(p+1, p, strlen(p)+1); - else if (strcmp(format, "%p") == 0) - strcpy(format, "0x%llx"); -+ ls = 2; - } - switch (ls) { - case -2: diff --git a/patch/kernel/marvell-default/1-patch-3.10.98-99.patch b/patch/kernel/marvell-default/1-patch-3.10.98-99.patch deleted file mode 100644 index e405e5ac5a..0000000000 --- a/patch/kernel/marvell-default/1-patch-3.10.98-99.patch +++ /dev/null @@ -1,2573 +0,0 @@ -diff --git a/Makefile b/Makefile -index dadd1edc6f84..f1e6491fd7d8 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,6 +1,6 @@ - VERSION = 3 - PATCHLEVEL = 10 --SUBLEVEL = 98 -+SUBLEVEL = 99 - EXTRAVERSION = - NAME = TOSSUG Baby Fish - -diff --git a/arch/arc/kernel/unwind.c b/arch/arc/kernel/unwind.c -index a8d02223da44..14558a9fa3b3 100644 ---- a/arch/arc/kernel/unwind.c -+++ b/arch/arc/kernel/unwind.c -@@ -984,42 +984,13 @@ int arc_unwind(struct unwind_frame_info *frame) - (const u8 *)(fde + - 1) + - *fde, ptrType); -- if (pc >= endLoc) -+ if (pc >= endLoc) { - fde = NULL; -- } else -- fde = NULL; -- } -- if (fde == NULL) { -- for (fde = table->address, tableSize = table->size; -- cie = NULL, tableSize > sizeof(*fde) -- && tableSize - sizeof(*fde) >= *fde; -- tableSize -= sizeof(*fde) + *fde, -- fde += 1 + *fde / sizeof(*fde)) { -- cie = cie_for_fde(fde, table); -- if (cie == &bad_cie) { - cie = NULL; -- break; - } -- if (cie == NULL -- || cie == ¬_fde -- || (ptrType = fde_pointer_type(cie)) < 0) -- continue; -- ptr = (const u8 *)(fde + 2); -- startLoc = read_pointer(&ptr, -- (const u8 *)(fde + 1) + -- *fde, ptrType); -- if (!startLoc) -- continue; -- if (!(ptrType & DW_EH_PE_indirect)) -- ptrType &= -- DW_EH_PE_FORM | DW_EH_PE_signed; -- endLoc = -- startLoc + read_pointer(&ptr, -- (const u8 *)(fde + -- 1) + -- *fde, ptrType); -- if (pc >= startLoc && pc < endLoc) -- break; -+ } else { -+ fde = NULL; -+ cie = NULL; - } - } - } -diff --git a/arch/mips/kvm/kvm_locore.S b/arch/mips/kvm/kvm_locore.S -index 920b63210806..34c35f0e3290 100644 ---- a/arch/mips/kvm/kvm_locore.S -+++ b/arch/mips/kvm/kvm_locore.S -@@ -156,9 +156,11 @@ FEXPORT(__kvm_mips_vcpu_run) - - FEXPORT(__kvm_mips_load_asid) - /* Set the ASID for the Guest Kernel */ -- sll t0, t0, 1 /* with kseg0 @ 0x40000000, kernel */ -- /* addresses shift to 0x80000000 */ -- bltz t0, 1f /* If kernel */ -+ PTR_L t0, VCPU_COP0(k1) -+ LONG_L t0, COP0_STATUS(t0) -+ andi t0, KSU_USER | ST0_ERL | ST0_EXL -+ xori t0, KSU_USER -+ bnez t0, 1f /* If kernel */ - addiu t1, k1, VCPU_GUEST_KERNEL_ASID /* (BD) */ - addiu t1, k1, VCPU_GUEST_USER_ASID /* else user */ - 1: -@@ -442,9 +444,11 @@ __kvm_mips_return_to_guest: - mtc0 t0, CP0_EPC - - /* Set the ASID for the Guest Kernel */ -- sll t0, t0, 1 /* with kseg0 @ 0x40000000, kernel */ -- /* addresses shift to 0x80000000 */ -- bltz t0, 1f /* If kernel */ -+ PTR_L t0, VCPU_COP0(k1) -+ LONG_L t0, COP0_STATUS(t0) -+ andi t0, KSU_USER | ST0_ERL | ST0_EXL -+ xori t0, KSU_USER -+ bnez t0, 1f /* If kernel */ - addiu t1, k1, VCPU_GUEST_KERNEL_ASID /* (BD) */ - addiu t1, k1, VCPU_GUEST_USER_ASID /* else user */ - 1: -diff --git a/arch/mips/kvm/kvm_mips.c b/arch/mips/kvm/kvm_mips.c -index 843ec38fec7b..8aa5f30d8579 100644 ---- a/arch/mips/kvm/kvm_mips.c -+++ b/arch/mips/kvm/kvm_mips.c -@@ -308,7 +308,7 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id) - - if (!gebase) { - err = -ENOMEM; -- goto out_free_cpu; -+ goto out_uninit_cpu; - } - kvm_info("Allocated %d bytes for KVM Exception Handlers @ %p\n", - ALIGN(size, PAGE_SIZE), gebase); -@@ -368,6 +368,9 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id) - out_free_gebase: - kfree(gebase); - -+out_uninit_cpu: -+ kvm_vcpu_uninit(vcpu); -+ - out_free_cpu: - kfree(vcpu); - -diff --git a/arch/mips/kvm/kvm_mips_emul.c b/arch/mips/kvm/kvm_mips_emul.c -index c76f297b7149..33085819cd89 100644 ---- a/arch/mips/kvm/kvm_mips_emul.c -+++ b/arch/mips/kvm/kvm_mips_emul.c -@@ -935,7 +935,7 @@ kvm_mips_emulate_cache(uint32_t inst, uint32_t *opc, uint32_t cause, - - base = (inst >> 21) & 0x1f; - op_inst = (inst >> 16) & 0x1f; -- offset = inst & 0xffff; -+ offset = (int16_t)inst; - cache = (inst >> 16) & 0x3; - op = (inst >> 18) & 0x7; - -diff --git a/arch/s390/mm/extable.c b/arch/s390/mm/extable.c -index 4d1ee88864e8..18c8b819b0aa 100644 ---- a/arch/s390/mm/extable.c -+++ b/arch/s390/mm/extable.c -@@ -52,12 +52,16 @@ void sort_extable(struct exception_table_entry *start, - int i; - - /* Normalize entries to being relative to the start of the section */ -- for (p = start, i = 0; p < finish; p++, i += 8) -+ for (p = start, i = 0; p < finish; p++, i += 8) { - p->insn += i; -+ p->fixup += i + 4; -+ } - sort(start, finish - start, sizeof(*start), cmp_ex, NULL); - /* Denormalize all entries */ -- for (p = start, i = 0; p < finish; p++, i += 8) -+ for (p = start, i = 0; p < finish; p++, i += 8) { - p->insn -= i; -+ p->fixup -= i + 4; -+ } - } - - #ifdef CONFIG_MODULES -diff --git a/arch/sparc/kernel/sys_sparc_64.c b/arch/sparc/kernel/sys_sparc_64.c -index be8db9bb7878..666510b39870 100644 ---- a/arch/sparc/kernel/sys_sparc_64.c -+++ b/arch/sparc/kernel/sys_sparc_64.c -@@ -416,7 +416,7 @@ out: - - SYSCALL_DEFINE1(sparc64_personality, unsigned long, personality) - { -- int ret; -+ long ret; - - if (personality(current->personality) == PER_LINUX32 && - personality(personality) == PER_LINUX) -diff --git a/arch/um/os-Linux/start_up.c b/arch/um/os-Linux/start_up.c -index 337518c5042a..b412c62486f0 100644 ---- a/arch/um/os-Linux/start_up.c -+++ b/arch/um/os-Linux/start_up.c -@@ -95,6 +95,8 @@ static int start_ptraced_child(void) - { - int pid, n, status; - -+ fflush(stdout); -+ - pid = fork(); - if (pid == 0) - ptrace_child(); -diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c -index 6033be9ff81a..3c8bffdc71c8 100644 ---- a/arch/x86/platform/efi/efi.c -+++ b/arch/x86/platform/efi/efi.c -@@ -250,12 +250,19 @@ static efi_status_t __init phys_efi_set_virtual_address_map( - efi_memory_desc_t *virtual_map) - { - efi_status_t status; -+ unsigned long flags; - - efi_call_phys_prelog(); -+ -+ /* Disable interrupts around EFI calls: */ -+ local_irq_save(flags); - status = efi_call_phys4(efi_phys.set_virtual_address_map, - memory_map_size, descriptor_size, - descriptor_version, virtual_map); -+ local_irq_restore(flags); -+ - efi_call_phys_epilog(); -+ - return status; - } - -diff --git a/arch/x86/platform/efi/efi_32.c b/arch/x86/platform/efi/efi_32.c -index 40e446941dd7..bebbee05e331 100644 ---- a/arch/x86/platform/efi/efi_32.c -+++ b/arch/x86/platform/efi/efi_32.c -@@ -33,19 +33,16 @@ - - /* - * To make EFI call EFI runtime service in physical addressing mode we need -- * prelog/epilog before/after the invocation to disable interrupt, to -- * claim EFI runtime service handler exclusively and to duplicate a memory in -- * low memory space say 0 - 3G. -+ * prolog/epilog before/after the invocation to claim the EFI runtime service -+ * handler exclusively and to duplicate a memory mapping in low memory space, -+ * say 0 - 3G. - */ - --static unsigned long efi_rt_eflags; - - void efi_call_phys_prelog(void) - { - struct desc_ptr gdt_descr; - -- local_irq_save(efi_rt_eflags); -- - load_cr3(initial_page_table); - __flush_tlb_all(); - -@@ -64,6 +61,4 @@ void efi_call_phys_epilog(void) - - load_cr3(swapper_pg_dir); - __flush_tlb_all(); -- -- local_irq_restore(efi_rt_eflags); - } -diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c -index 39a0e7f1f0a3..2f6c1a9734c8 100644 ---- a/arch/x86/platform/efi/efi_64.c -+++ b/arch/x86/platform/efi/efi_64.c -@@ -40,7 +40,6 @@ - #include - - static pgd_t *save_pgd __initdata; --static unsigned long efi_flags __initdata; - - static void __init early_code_mapping_set_exec(int executable) - { -@@ -66,7 +65,6 @@ void __init efi_call_phys_prelog(void) - int n_pgds; - - early_code_mapping_set_exec(1); -- local_irq_save(efi_flags); - - n_pgds = DIV_ROUND_UP((max_pfn << PAGE_SHIFT), PGDIR_SIZE); - save_pgd = kmalloc(n_pgds * sizeof(pgd_t), GFP_KERNEL); -@@ -90,7 +88,6 @@ void __init efi_call_phys_epilog(void) - set_pgd(pgd_offset_k(pgd * PGDIR_SIZE), save_pgd[pgd]); - kfree(save_pgd); - __flush_tlb_all(); -- local_irq_restore(efi_flags); - early_code_mapping_set_exec(0); - } - -diff --git a/block/partitions/mac.c b/block/partitions/mac.c -index 76d8ba6379a9..bd5b91465230 100644 ---- a/block/partitions/mac.c -+++ b/block/partitions/mac.c -@@ -32,7 +32,7 @@ int mac_partition(struct parsed_partitions *state) - Sector sect; - unsigned char *data; - int slot, blocks_in_map; -- unsigned secsize; -+ unsigned secsize, datasize, partoffset; - #ifdef CONFIG_PPC_PMAC - int found_root = 0; - int found_root_goodness = 0; -@@ -50,10 +50,14 @@ int mac_partition(struct parsed_partitions *state) - } - secsize = be16_to_cpu(md->block_size); - put_dev_sector(sect); -- data = read_part_sector(state, secsize/512, §); -+ datasize = round_down(secsize, 512); -+ data = read_part_sector(state, datasize / 512, §); - if (!data) - return -1; -- part = (struct mac_partition *) (data + secsize%512); -+ partoffset = secsize % 512; -+ if (partoffset + sizeof(*part) > datasize) -+ return -1; -+ part = (struct mac_partition *) (data + partoffset); - if (be16_to_cpu(part->signature) != MAC_PARTITION_MAGIC) { - put_dev_sector(sect); - return 0; /* not a MacOS disk */ -diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c -index 136803c47cdb..96e5ed188636 100644 ---- a/drivers/ata/libata-sff.c -+++ b/drivers/ata/libata-sff.c -@@ -997,12 +997,9 @@ static inline int ata_hsm_ok_in_wq(struct ata_port *ap, - static void ata_hsm_qc_complete(struct ata_queued_cmd *qc, int in_wq) - { - struct ata_port *ap = qc->ap; -- unsigned long flags; - - if (ap->ops->error_handler) { - if (in_wq) { -- spin_lock_irqsave(ap->lock, flags); -- - /* EH might have kicked in while host lock is - * released. - */ -@@ -1014,8 +1011,6 @@ static void ata_hsm_qc_complete(struct ata_queued_cmd *qc, int in_wq) - } else - ata_port_freeze(ap); - } -- -- spin_unlock_irqrestore(ap->lock, flags); - } else { - if (likely(!(qc->err_mask & AC_ERR_HSM))) - ata_qc_complete(qc); -@@ -1024,10 +1019,8 @@ static void ata_hsm_qc_complete(struct ata_queued_cmd *qc, int in_wq) - } - } else { - if (in_wq) { -- spin_lock_irqsave(ap->lock, flags); - ata_sff_irq_on(ap); - ata_qc_complete(qc); -- spin_unlock_irqrestore(ap->lock, flags); - } else - ata_qc_complete(qc); - } -@@ -1048,9 +1041,10 @@ int ata_sff_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc, - { - struct ata_link *link = qc->dev->link; - struct ata_eh_info *ehi = &link->eh_info; -- unsigned long flags = 0; - int poll_next; - -+ lockdep_assert_held(ap->lock); -+ - WARN_ON_ONCE((qc->flags & ATA_QCFLAG_ACTIVE) == 0); - - /* Make sure ata_sff_qc_issue() does not throw things -@@ -1112,14 +1106,6 @@ fsm_start: - } - } - -- /* Send the CDB (atapi) or the first data block (ata pio out). -- * During the state transition, interrupt handler shouldn't -- * be invoked before the data transfer is complete and -- * hsm_task_state is changed. Hence, the following locking. -- */ -- if (in_wq) -- spin_lock_irqsave(ap->lock, flags); -- - if (qc->tf.protocol == ATA_PROT_PIO) { - /* PIO data out protocol. - * send first data block. -@@ -1135,9 +1121,6 @@ fsm_start: - /* send CDB */ - atapi_send_cdb(ap, qc); - -- if (in_wq) -- spin_unlock_irqrestore(ap->lock, flags); -- - /* if polling, ata_sff_pio_task() handles the rest. - * otherwise, interrupt handler takes over from here. - */ -@@ -1361,12 +1344,14 @@ static void ata_sff_pio_task(struct work_struct *work) - u8 status; - int poll_next; - -+ spin_lock_irq(ap->lock); -+ - BUG_ON(ap->sff_pio_task_link == NULL); - /* qc can be NULL if timeout occurred */ - qc = ata_qc_from_tag(ap, link->active_tag); - if (!qc) { - ap->sff_pio_task_link = NULL; -- return; -+ goto out_unlock; - } - - fsm_start: -@@ -1381,11 +1366,14 @@ fsm_start: - */ - status = ata_sff_busy_wait(ap, ATA_BUSY, 5); - if (status & ATA_BUSY) { -+ spin_unlock_irq(ap->lock); - ata_msleep(ap, 2); -+ spin_lock_irq(ap->lock); -+ - status = ata_sff_busy_wait(ap, ATA_BUSY, 10); - if (status & ATA_BUSY) { - ata_sff_queue_pio_task(link, ATA_SHORT_PAUSE); -- return; -+ goto out_unlock; - } - } - -@@ -1402,6 +1390,8 @@ fsm_start: - */ - if (poll_next) - goto fsm_start; -+out_unlock: -+ spin_unlock_irq(ap->lock); - } - - /** -diff --git a/drivers/ata/sata_sil.c b/drivers/ata/sata_sil.c -index dd1faa564eb2..cdfb98e70cfd 100644 ---- a/drivers/ata/sata_sil.c -+++ b/drivers/ata/sata_sil.c -@@ -631,6 +631,9 @@ static void sil_dev_config(struct ata_device *dev) - unsigned int n, quirks = 0; - unsigned char model_num[ATA_ID_PROD_LEN + 1]; - -+ /* This controller doesn't support trim */ -+ dev->horkage |= ATA_HORKAGE_NOTRIM; -+ - ata_id_c_string(dev->id, model_num, ATA_ID_PROD, sizeof(model_num)); - - for (n = 0; sil_blacklist[n].product; n++) -diff --git a/drivers/clocksource/vt8500_timer.c b/drivers/clocksource/vt8500_timer.c -index 64f553f04fa4..5874ebf9dced 100644 ---- a/drivers/clocksource/vt8500_timer.c -+++ b/drivers/clocksource/vt8500_timer.c -@@ -50,6 +50,8 @@ - - #define msecs_to_loops(t) (loops_per_jiffy / 1000 * HZ * t) - -+#define MIN_OSCR_DELTA 16 -+ - static void __iomem *regbase; - - static cycle_t vt8500_timer_read(struct clocksource *cs) -@@ -80,7 +82,7 @@ static int vt8500_timer_set_next_event(unsigned long cycles, - cpu_relax(); - writel((unsigned long)alarm, regbase + TIMER_MATCH_VAL); - -- if ((signed)(alarm - clocksource.read(&clocksource)) <= 16) -+ if ((signed)(alarm - clocksource.read(&clocksource)) <= MIN_OSCR_DELTA) - return -ETIME; - - writel(1, regbase + TIMER_IER_VAL); -@@ -162,7 +164,7 @@ static void __init vt8500_timer_init(struct device_node *np) - pr_err("%s: setup_irq failed for %s\n", __func__, - clockevent.name); - clockevents_config_and_register(&clockevent, VT8500_TIMER_HZ, -- 4, 0xf0000000); -+ MIN_OSCR_DELTA * 2, 0xf0000000); - } - - CLOCKSOURCE_OF_DECLARE(vt8500, "via,vt8500-timer", vt8500_timer_init); -diff --git a/drivers/gpu/drm/ast/ast_drv.h b/drivers/gpu/drm/ast/ast_drv.h -index b6b7d70f2832..5cfc1765af74 100644 ---- a/drivers/gpu/drm/ast/ast_drv.h -+++ b/drivers/gpu/drm/ast/ast_drv.h -@@ -296,6 +296,7 @@ int ast_framebuffer_init(struct drm_device *dev, - int ast_fbdev_init(struct drm_device *dev); - void ast_fbdev_fini(struct drm_device *dev); - void ast_fbdev_set_suspend(struct drm_device *dev, int state); -+void ast_fbdev_set_base(struct ast_private *ast, unsigned long gpu_addr); - - struct ast_bo { - struct ttm_buffer_object bo; -diff --git a/drivers/gpu/drm/ast/ast_fb.c b/drivers/gpu/drm/ast/ast_fb.c -index fbc0823cfa18..a298d8f72225 100644 ---- a/drivers/gpu/drm/ast/ast_fb.c -+++ b/drivers/gpu/drm/ast/ast_fb.c -@@ -366,3 +366,10 @@ void ast_fbdev_set_suspend(struct drm_device *dev, int state) - - fb_set_suspend(ast->fbdev->helper.fbdev, state); - } -+ -+void ast_fbdev_set_base(struct ast_private *ast, unsigned long gpu_addr) -+{ -+ ast->fbdev->helper.fbdev->fix.smem_start = -+ ast->fbdev->helper.fbdev->apertures->ranges[0].base + gpu_addr; -+ ast->fbdev->helper.fbdev->fix.smem_len = ast->vram_size - gpu_addr; -+} -diff --git a/drivers/gpu/drm/ast/ast_main.c b/drivers/gpu/drm/ast/ast_main.c -index 96f874a508e2..313ccaf25f49 100644 ---- a/drivers/gpu/drm/ast/ast_main.c -+++ b/drivers/gpu/drm/ast/ast_main.c -@@ -359,6 +359,7 @@ int ast_driver_load(struct drm_device *dev, unsigned long flags) - dev->mode_config.min_height = 0; - dev->mode_config.preferred_depth = 24; - dev->mode_config.prefer_shadow = 1; -+ dev->mode_config.fb_base = pci_resource_start(ast->dev->pdev, 0); - - if (ast->chip == AST2100 || - ast->chip == AST2200 || -diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c -index e8f6418b6dec..f3a54ad77e3f 100644 ---- a/drivers/gpu/drm/ast/ast_mode.c -+++ b/drivers/gpu/drm/ast/ast_mode.c -@@ -509,6 +509,8 @@ static int ast_crtc_do_set_base(struct drm_crtc *crtc, - ret = ttm_bo_kmap(&bo->bo, 0, bo->bo.num_pages, &bo->kmap); - if (ret) - DRM_ERROR("failed to kmap fbcon\n"); -+ else -+ ast_fbdev_set_base(ast, gpu_addr); - } - ast_bo_unreserve(bo); - -diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c -index ba2ab9a9b988..f3cce23f4a62 100644 ---- a/drivers/gpu/drm/radeon/radeon_atombios.c -+++ b/drivers/gpu/drm/radeon/radeon_atombios.c -@@ -452,7 +452,9 @@ static bool radeon_atom_apply_quirks(struct drm_device *dev, - } - - /* Fujitsu D3003-S2 board lists DVI-I as DVI-D and VGA */ -- if (((dev->pdev->device == 0x9802) || (dev->pdev->device == 0x9806)) && -+ if (((dev->pdev->device == 0x9802) || -+ (dev->pdev->device == 0x9805) || -+ (dev->pdev->device == 0x9806)) && - (dev->pdev->subsystem_vendor == 0x1734) && - (dev->pdev->subsystem_device == 0x11bd)) { - if (*connector_type == DRM_MODE_CONNECTOR_VGA) { -@@ -463,14 +465,6 @@ static bool radeon_atom_apply_quirks(struct drm_device *dev, - } - } - -- /* Fujitsu D3003-S2 board lists DVI-I as DVI-I and VGA */ -- if ((dev->pdev->device == 0x9805) && -- (dev->pdev->subsystem_vendor == 0x1734) && -- (dev->pdev->subsystem_device == 0x11bd)) { -- if (*connector_type == DRM_MODE_CONNECTOR_VGA) -- return false; -- } -- - return true; - } - -diff --git a/drivers/gpu/drm/radeon/radeon_irq_kms.c b/drivers/gpu/drm/radeon/radeon_irq_kms.c -index db83d075606e..6acd3646ac08 100644 ---- a/drivers/gpu/drm/radeon/radeon_irq_kms.c -+++ b/drivers/gpu/drm/radeon/radeon_irq_kms.c -@@ -73,6 +73,11 @@ static void radeon_hotplug_work_func(struct work_struct *work) - struct drm_mode_config *mode_config = &dev->mode_config; - struct drm_connector *connector; - -+ /* we can race here at startup, some boards seem to trigger -+ * hotplug irqs when they shouldn't. */ -+ if (!rdev->mode_info.mode_config_initialized) -+ return; -+ - mutex_lock(&mode_config->mutex); - if (mode_config->num_connector) { - list_for_each_entry(connector, &mode_config->connector_list, head) -diff --git a/drivers/gpu/drm/radeon/radeon_sa.c b/drivers/gpu/drm/radeon/radeon_sa.c -index f0bac68254b7..bb166849aa6e 100644 ---- a/drivers/gpu/drm/radeon/radeon_sa.c -+++ b/drivers/gpu/drm/radeon/radeon_sa.c -@@ -349,8 +349,13 @@ int radeon_sa_bo_new(struct radeon_device *rdev, - /* see if we can skip over some allocations */ - } while (radeon_sa_bo_next_hole(sa_manager, fences, tries)); - -+ for (i = 0; i < RADEON_NUM_RINGS; ++i) -+ radeon_fence_ref(fences[i]); -+ - spin_unlock(&sa_manager->wq.lock); - r = radeon_fence_wait_any(rdev, fences, false); -+ for (i = 0; i < RADEON_NUM_RINGS; ++i) -+ radeon_fence_unref(&fences[i]); - spin_lock(&sa_manager->wq.lock); - /* if we have nothing to wait for block */ - if (r == -ENOENT && block) { -diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c -index 4a14e113369d..f7015592544f 100644 ---- a/drivers/gpu/drm/radeon/radeon_ttm.c -+++ b/drivers/gpu/drm/radeon/radeon_ttm.c -@@ -619,7 +619,7 @@ static int radeon_ttm_tt_populate(struct ttm_tt *ttm) - 0, PAGE_SIZE, - PCI_DMA_BIDIRECTIONAL); - if (pci_dma_mapping_error(rdev->pdev, gtt->ttm.dma_address[i])) { -- while (--i) { -+ while (i--) { - pci_unmap_page(rdev->pdev, gtt->ttm.dma_address[i], - PAGE_SIZE, PCI_DMA_BIDIRECTIONAL); - gtt->ttm.dma_address[i] = 0; -diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c -index 6c44c69a5ba4..94a0baac93dd 100644 ---- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c -+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c -@@ -25,6 +25,7 @@ - * - **************************************************************************/ - #include -+#include - - #include - #include "vmwgfx_drv.h" -@@ -1192,6 +1193,12 @@ static int vmw_probe(struct pci_dev *pdev, const struct pci_device_id *ent) - static int __init vmwgfx_init(void) - { - int ret; -+ -+#ifdef CONFIG_VGA_CONSOLE -+ if (vgacon_text_force()) -+ return -EINVAL; -+#endif -+ - ret = drm_pci_init(&driver, &vmw_pci_driver); - if (ret) - DRM_ERROR("Failed initializing DRM.\n"); -diff --git a/drivers/gpu/vga/vgaarb.c b/drivers/gpu/vga/vgaarb.c -index e893f6e1937d..3c84e96a485a 100644 ---- a/drivers/gpu/vga/vgaarb.c -+++ b/drivers/gpu/vga/vgaarb.c -@@ -392,8 +392,10 @@ int vga_get(struct pci_dev *pdev, unsigned int rsrc, int interruptible) - set_current_state(interruptible ? - TASK_INTERRUPTIBLE : - TASK_UNINTERRUPTIBLE); -- if (signal_pending(current)) { -- rc = -EINTR; -+ if (interruptible && signal_pending(current)) { -+ __set_current_state(TASK_RUNNING); -+ remove_wait_queue(&vga_wait_queue, &wait); -+ rc = -ERESTARTSYS; - break; - } - schedule(); -diff --git a/drivers/infiniband/hw/cxgb3/iwch_cm.c b/drivers/infiniband/hw/cxgb3/iwch_cm.c -index 3e094cd6a0e3..a9194ef626cd 100644 ---- a/drivers/infiniband/hw/cxgb3/iwch_cm.c -+++ b/drivers/infiniband/hw/cxgb3/iwch_cm.c -@@ -149,7 +149,7 @@ static int iwch_l2t_send(struct t3cdev *tdev, struct sk_buff *skb, struct l2t_en - error = l2t_send(tdev, skb, l2e); - if (error < 0) - kfree_skb(skb); -- return error; -+ return error < 0 ? error : 0; - } - - int iwch_cxgb3_ofld_send(struct t3cdev *tdev, struct sk_buff *skb) -@@ -165,7 +165,7 @@ int iwch_cxgb3_ofld_send(struct t3cdev *tdev, struct sk_buff *skb) - error = cxgb3_ofld_send(tdev, skb); - if (error < 0) - kfree_skb(skb); -- return error; -+ return error < 0 ? error : 0; - } - - static void release_tid(struct t3cdev *tdev, u32 hwtid, struct sk_buff *skb) -diff --git a/drivers/infiniband/hw/qib/qib_verbs_mcast.c b/drivers/infiniband/hw/qib/qib_verbs_mcast.c -index dabb697b1c2a..48ba1c3e945a 100644 ---- a/drivers/infiniband/hw/qib/qib_verbs_mcast.c -+++ b/drivers/infiniband/hw/qib/qib_verbs_mcast.c -@@ -286,15 +286,13 @@ int qib_multicast_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid) - struct qib_ibdev *dev = to_idev(ibqp->device); - struct qib_ibport *ibp = to_iport(ibqp->device, qp->port_num); - struct qib_mcast *mcast = NULL; -- struct qib_mcast_qp *p, *tmp; -+ struct qib_mcast_qp *p, *tmp, *delp = NULL; - struct rb_node *n; - int last = 0; - int ret; - -- if (ibqp->qp_num <= 1 || qp->state == IB_QPS_RESET) { -- ret = -EINVAL; -- goto bail; -- } -+ if (ibqp->qp_num <= 1 || qp->state == IB_QPS_RESET) -+ return -EINVAL; - - spin_lock_irq(&ibp->lock); - -@@ -303,8 +301,7 @@ int qib_multicast_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid) - while (1) { - if (n == NULL) { - spin_unlock_irq(&ibp->lock); -- ret = -EINVAL; -- goto bail; -+ return -EINVAL; - } - - mcast = rb_entry(n, struct qib_mcast, rb_node); -@@ -328,6 +325,7 @@ int qib_multicast_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid) - */ - list_del_rcu(&p->list); - mcast->n_attached--; -+ delp = p; - - /* If this was the last attached QP, remove the GID too. */ - if (list_empty(&mcast->qp_list)) { -@@ -338,15 +336,16 @@ int qib_multicast_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid) - } - - spin_unlock_irq(&ibp->lock); -+ /* QP not attached */ -+ if (!delp) -+ return -EINVAL; -+ /* -+ * Wait for any list walkers to finish before freeing the -+ * list element. -+ */ -+ wait_event(mcast->wait, atomic_read(&mcast->refcount) <= 1); -+ qib_mcast_qp_free(delp); - -- if (p) { -- /* -- * Wait for any list walkers to finish before freeing the -- * list element. -- */ -- wait_event(mcast->wait, atomic_read(&mcast->refcount) <= 1); -- qib_mcast_qp_free(p); -- } - if (last) { - atomic_dec(&mcast->refcount); - wait_event(mcast->wait, !atomic_read(&mcast->refcount)); -@@ -355,11 +354,7 @@ int qib_multicast_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid) - dev->n_mcast_grps_allocated--; - spin_unlock_irq(&dev->n_mcast_grps_lock); - } -- -- ret = 0; -- --bail: -- return ret; -+ return 0; - } - - int qib_mcast_tree_empty(struct qib_ibport *ibp) -diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c -index b4713cea1913..2d2915fdbf02 100644 ---- a/drivers/md/bcache/super.c -+++ b/drivers/md/bcache/super.c -@@ -1959,8 +1959,10 @@ static int __init bcache_init(void) - closure_debug_init(); - - bcache_major = register_blkdev(0, "bcache"); -- if (bcache_major < 0) -+ if (bcache_major < 0) { -+ unregister_reboot_notifier(&reboot); - return bcache_major; -+ } - - if (!(bcache_wq = create_workqueue("bcache")) || - !(bcache_kobj = kobject_create_and_add("bcache", fs_kobj)) || -diff --git a/drivers/md/dm-exception-store.h b/drivers/md/dm-exception-store.h -index 0b2536247cf5..84e27708ad97 100644 ---- a/drivers/md/dm-exception-store.h -+++ b/drivers/md/dm-exception-store.h -@@ -70,7 +70,7 @@ struct dm_exception_store_type { - * Update the metadata with this exception. - */ - void (*commit_exception) (struct dm_exception_store *store, -- struct dm_exception *e, -+ struct dm_exception *e, int valid, - void (*callback) (void *, int success), - void *callback_context); - -diff --git a/drivers/md/dm-snap-persistent.c b/drivers/md/dm-snap-persistent.c -index 2d2b1b7588d7..8f6d3ea55401 100644 ---- a/drivers/md/dm-snap-persistent.c -+++ b/drivers/md/dm-snap-persistent.c -@@ -646,7 +646,7 @@ static int persistent_prepare_exception(struct dm_exception_store *store, - } - - static void persistent_commit_exception(struct dm_exception_store *store, -- struct dm_exception *e, -+ struct dm_exception *e, int valid, - void (*callback) (void *, int success), - void *callback_context) - { -@@ -655,6 +655,9 @@ static void persistent_commit_exception(struct dm_exception_store *store, - struct core_exception ce; - struct commit_callback *cb; - -+ if (!valid) -+ ps->valid = 0; -+ - ce.old_chunk = e->old_chunk; - ce.new_chunk = e->new_chunk; - write_exception(ps, ps->current_committed++, &ce); -diff --git a/drivers/md/dm-snap-transient.c b/drivers/md/dm-snap-transient.c -index 1ce9a2586e41..31439d53cf7e 100644 ---- a/drivers/md/dm-snap-transient.c -+++ b/drivers/md/dm-snap-transient.c -@@ -52,12 +52,12 @@ static int transient_prepare_exception(struct dm_exception_store *store, - } - - static void transient_commit_exception(struct dm_exception_store *store, -- struct dm_exception *e, -+ struct dm_exception *e, int valid, - void (*callback) (void *, int success), - void *callback_context) - { - /* Just succeed */ -- callback(callback_context, 1); -+ callback(callback_context, valid); - } - - static void transient_usage(struct dm_exception_store *store, -diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c -index d892a05c84f4..dbd0f00f7395 100644 ---- a/drivers/md/dm-snap.c -+++ b/drivers/md/dm-snap.c -@@ -1388,8 +1388,9 @@ static void __invalidate_snapshot(struct dm_snapshot *s, int err) - dm_table_event(s->ti->table); - } - --static void pending_complete(struct dm_snap_pending_exception *pe, int success) -+static void pending_complete(void *context, int success) - { -+ struct dm_snap_pending_exception *pe = context; - struct dm_exception *e; - struct dm_snapshot *s = pe->snap; - struct bio *origin_bios = NULL; -@@ -1459,24 +1460,13 @@ out: - free_pending_exception(pe); - } - --static void commit_callback(void *context, int success) --{ -- struct dm_snap_pending_exception *pe = context; -- -- pending_complete(pe, success); --} -- - static void complete_exception(struct dm_snap_pending_exception *pe) - { - struct dm_snapshot *s = pe->snap; - -- if (unlikely(pe->copy_error)) -- pending_complete(pe, 0); -- -- else -- /* Update the metadata if we are persistent */ -- s->store->type->commit_exception(s->store, &pe->e, -- commit_callback, pe); -+ /* Update the metadata if we are persistent */ -+ s->store->type->commit_exception(s->store, &pe->e, !pe->copy_error, -+ pending_complete, pe); - } - - /* -diff --git a/drivers/md/dm-thin-metadata.c b/drivers/md/dm-thin-metadata.c -index 43f6250baadd..4bf9211b2740 100644 ---- a/drivers/md/dm-thin-metadata.c -+++ b/drivers/md/dm-thin-metadata.c -@@ -1191,6 +1191,12 @@ static int __reserve_metadata_snap(struct dm_pool_metadata *pmd) - dm_block_t held_root; - - /* -+ * We commit to ensure the btree roots which we increment in a -+ * moment are up to date. -+ */ -+ __commit_transaction(pmd); -+ -+ /* - * Copy the superblock. - */ - dm_sm_inc_block(pmd->metadata_sm, THIN_SUPERBLOCK_LOCATION); -diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c -index ec56072c6326..295f74d4f0ab 100644 ---- a/drivers/md/dm-thin.c -+++ b/drivers/md/dm-thin.c -@@ -2281,7 +2281,7 @@ static void pool_postsuspend(struct dm_target *ti) - struct pool_c *pt = ti->private; - struct pool *pool = pt->pool; - -- cancel_delayed_work(&pool->waker); -+ cancel_delayed_work_sync(&pool->waker); - flush_workqueue(pool->wq); - (void) commit_or_fallback(pool); - } -diff --git a/drivers/md/persistent-data/dm-btree.c b/drivers/md/persistent-data/dm-btree.c -index 6d7f4d950b8f..b07fcda9ca71 100644 ---- a/drivers/md/persistent-data/dm-btree.c -+++ b/drivers/md/persistent-data/dm-btree.c -@@ -235,6 +235,16 @@ static bool is_internal_level(struct dm_btree_info *info, struct frame *f) - return f->level < (info->levels - 1); - } - -+static void unlock_all_frames(struct del_stack *s) -+{ -+ struct frame *f; -+ -+ while (unprocessed_frames(s)) { -+ f = s->spine + s->top--; -+ dm_tm_unlock(s->tm, f->b); -+ } -+} -+ - int dm_btree_del(struct dm_btree_info *info, dm_block_t root) - { - int r; -@@ -290,9 +300,13 @@ int dm_btree_del(struct dm_btree_info *info, dm_block_t root) - f->current_child = f->nr_children; - } - } -- - out: -+ if (r) { -+ /* cleanup all frames of del_stack */ -+ unlock_all_frames(s); -+ } - kfree(s); -+ - return r; - } - EXPORT_SYMBOL_GPL(dm_btree_del); -diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c -index 1f925e856974..46a984291b7d 100644 ---- a/drivers/media/dvb-core/dvb_frontend.c -+++ b/drivers/media/dvb-core/dvb_frontend.c -@@ -2195,9 +2195,9 @@ static int dvb_frontend_ioctl_legacy(struct file *file, - dev_dbg(fe->dvb->device, "%s: current delivery system on cache: %d, V3 type: %d\n", - __func__, c->delivery_system, fe->ops.info.type); - -- /* Force the CAN_INVERSION_AUTO bit on. If the frontend doesn't -- * do it, it is done for it. */ -- info->caps |= FE_CAN_INVERSION_AUTO; -+ /* Set CAN_INVERSION_AUTO bit on in other than oneshot mode */ -+ if (!(fepriv->tune_mode_flags & FE_TUNE_MODE_ONESHOT)) -+ info->caps |= FE_CAN_INVERSION_AUTO; - err = 0; - break; - } -diff --git a/drivers/media/dvb-frontends/tda1004x.c b/drivers/media/dvb-frontends/tda1004x.c -index a2631be7ffac..08e0f0dd8728 100644 ---- a/drivers/media/dvb-frontends/tda1004x.c -+++ b/drivers/media/dvb-frontends/tda1004x.c -@@ -903,9 +903,18 @@ static int tda1004x_get_fe(struct dvb_frontend *fe) - { - struct dtv_frontend_properties *fe_params = &fe->dtv_property_cache; - struct tda1004x_state* state = fe->demodulator_priv; -+ int status; - - dprintk("%s\n", __func__); - -+ status = tda1004x_read_byte(state, TDA1004X_STATUS_CD); -+ if (status == -1) -+ return -EIO; -+ -+ /* Only update the properties cache if device is locked */ -+ if (!(status & 8)) -+ return 0; -+ - // inversion status - fe_params->inversion = INVERSION_OFF; - if (tda1004x_read_byte(state, TDA1004X_CONFC1) & 0x20) -diff --git a/drivers/media/usb/gspca/ov534.c b/drivers/media/usb/gspca/ov534.c -index 2e28c81a03ab..a5bee0d0d686 100644 ---- a/drivers/media/usb/gspca/ov534.c -+++ b/drivers/media/usb/gspca/ov534.c -@@ -1490,8 +1490,13 @@ static void sd_set_streamparm(struct gspca_dev *gspca_dev, - struct v4l2_fract *tpf = &cp->timeperframe; - struct sd *sd = (struct sd *) gspca_dev; - -- /* Set requested framerate */ -- sd->frame_rate = tpf->denominator / tpf->numerator; -+ if (tpf->numerator == 0 || tpf->denominator == 0) -+ /* Set default framerate */ -+ sd->frame_rate = 30; -+ else -+ /* Set requested framerate */ -+ sd->frame_rate = tpf->denominator / tpf->numerator; -+ - if (gspca_dev->streaming) - set_frame_rate(gspca_dev); - -diff --git a/drivers/media/usb/gspca/topro.c b/drivers/media/usb/gspca/topro.c -index 4cb511ccc5f6..22ea6aefd22f 100644 ---- a/drivers/media/usb/gspca/topro.c -+++ b/drivers/media/usb/gspca/topro.c -@@ -4791,7 +4791,11 @@ static void sd_set_streamparm(struct gspca_dev *gspca_dev, - struct v4l2_fract *tpf = &cp->timeperframe; - int fr, i; - -- sd->framerate = tpf->denominator / tpf->numerator; -+ if (tpf->numerator == 0 || tpf->denominator == 0) -+ sd->framerate = 30; -+ else -+ sd->framerate = tpf->denominator / tpf->numerator; -+ - if (gspca_dev->streaming) - setframerate(gspca_dev, v4l2_ctrl_g_ctrl(gspca_dev->exposure)); - -diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c -index 885ba4a19a6c..ebb40a292d67 100644 ---- a/drivers/mmc/card/block.c -+++ b/drivers/mmc/card/block.c -@@ -59,8 +59,7 @@ MODULE_ALIAS("mmc:block"); - #define INAND_CMD38_ARG_SECTRIM2 0x88 - #define MMC_BLK_TIMEOUT_MS (10 * 60 * 1000) /* 10 minute timeout */ - --#define mmc_req_rel_wr(req) (((req->cmd_flags & REQ_FUA) || \ -- (req->cmd_flags & REQ_META)) && \ -+#define mmc_req_rel_wr(req) ((req->cmd_flags & REQ_FUA) && \ - (rq_data_dir(req) == WRITE)) - #define PACKED_CMD_VER 0x01 - #define PACKED_CMD_WR 0x02 -@@ -1300,13 +1299,9 @@ static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq, - - /* - * Reliable writes are used to implement Forced Unit Access and -- * REQ_META accesses, and are supported only on MMCs. -- * -- * XXX: this really needs a good explanation of why REQ_META -- * is treated special. -+ * are supported only on MMCs. - */ -- bool do_rel_wr = ((req->cmd_flags & REQ_FUA) || -- (req->cmd_flags & REQ_META)) && -+ bool do_rel_wr = (req->cmd_flags & REQ_FUA) && - (rq_data_dir(req) == WRITE) && - (md->flags & MMC_BLK_REL_WR); - -diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c -index f4f3038c1df0..faeda85e78fa 100644 ---- a/drivers/mmc/host/mmci.c -+++ b/drivers/mmc/host/mmci.c -@@ -1740,7 +1740,7 @@ static struct amba_id mmci_ids[] = { - { - .id = 0x00280180, - .mask = 0x00ffffff, -- .data = &variant_u300, -+ .data = &variant_nomadik, - }, - { - .id = 0x00480180, -diff --git a/drivers/net/can/sja1000/sja1000.c b/drivers/net/can/sja1000/sja1000.c -index c2d0559115d3..732a8ed571c2 100644 ---- a/drivers/net/can/sja1000/sja1000.c -+++ b/drivers/net/can/sja1000/sja1000.c -@@ -187,6 +187,9 @@ static void sja1000_start(struct net_device *dev) - /* clear interrupt flags */ - priv->read_reg(priv, SJA1000_IR); - -+ /* clear interrupt flags */ -+ priv->read_reg(priv, SJA1000_IR); -+ - /* leave reset mode */ - set_normal_mode(dev); - } -diff --git a/drivers/net/can/usb/ems_usb.c b/drivers/net/can/usb/ems_usb.c -index 5f9a7ad9b964..d921416295ce 100644 ---- a/drivers/net/can/usb/ems_usb.c -+++ b/drivers/net/can/usb/ems_usb.c -@@ -118,6 +118,9 @@ MODULE_LICENSE("GPL v2"); - */ - #define EMS_USB_ARM7_CLOCK 8000000 - -+#define CPC_TX_QUEUE_TRIGGER_LOW 25 -+#define CPC_TX_QUEUE_TRIGGER_HIGH 35 -+ - /* - * CAN-Message representation in a CPC_MSG. Message object type is - * CPC_MSG_TYPE_CAN_FRAME or CPC_MSG_TYPE_RTR_FRAME or -@@ -279,6 +282,11 @@ static void ems_usb_read_interrupt_callback(struct urb *urb) - switch (urb->status) { - case 0: - dev->free_slots = dev->intr_in_buffer[1]; -+ if(dev->free_slots > CPC_TX_QUEUE_TRIGGER_HIGH){ -+ if (netif_queue_stopped(netdev)){ -+ netif_wake_queue(netdev); -+ } -+ } - break; - - case -ECONNRESET: /* unlink */ -@@ -530,8 +538,6 @@ static void ems_usb_write_bulk_callback(struct urb *urb) - /* Release context */ - context->echo_index = MAX_TX_URBS; - -- if (netif_queue_stopped(netdev)) -- netif_wake_queue(netdev); - } - - /* -@@ -591,7 +597,7 @@ static int ems_usb_start(struct ems_usb *dev) - int err, i; - - dev->intr_in_buffer[0] = 0; -- dev->free_slots = 15; /* initial size */ -+ dev->free_slots = 50; /* initial size */ - - for (i = 0; i < MAX_RX_URBS; i++) { - struct urb *urb = NULL; -@@ -841,7 +847,7 @@ static netdev_tx_t ems_usb_start_xmit(struct sk_buff *skb, struct net_device *ne - - /* Slow down tx path */ - if (atomic_read(&dev->active_tx_urbs) >= MAX_TX_URBS || -- dev->free_slots < 5) { -+ dev->free_slots < CPC_TX_QUEUE_TRIGGER_LOW) { - netif_stop_queue(netdev); - } - } -diff --git a/drivers/pci/pcie/aer/aerdrv.c b/drivers/pci/pcie/aer/aerdrv.c -index 76ef634caf6f..b84e713445d0 100644 ---- a/drivers/pci/pcie/aer/aerdrv.c -+++ b/drivers/pci/pcie/aer/aerdrv.c -@@ -262,7 +262,6 @@ static struct aer_rpc *aer_alloc_rpc(struct pcie_device *dev) - rpc->rpd = dev; - INIT_WORK(&rpc->dpc_handler, aer_isr); - mutex_init(&rpc->rpc_mutex); -- init_waitqueue_head(&rpc->wait_release); - - /* Use PCIe bus function to store rpc into PCIe device */ - set_service_data(dev, rpc); -@@ -285,8 +284,7 @@ static void aer_remove(struct pcie_device *dev) - if (rpc->isr) - free_irq(dev->irq, dev); - -- wait_event(rpc->wait_release, rpc->prod_idx == rpc->cons_idx); -- -+ flush_work(&rpc->dpc_handler); - aer_disable_rootport(rpc); - kfree(rpc); - set_service_data(dev, NULL); -diff --git a/drivers/pci/pcie/aer/aerdrv.h b/drivers/pci/pcie/aer/aerdrv.h -index d12c77cd6991..3b8766e1e51b 100644 ---- a/drivers/pci/pcie/aer/aerdrv.h -+++ b/drivers/pci/pcie/aer/aerdrv.h -@@ -76,7 +76,6 @@ struct aer_rpc { - * recovery on the same - * root port hierarchy - */ -- wait_queue_head_t wait_release; - }; - - struct aer_broadcast_data { -diff --git a/drivers/pci/pcie/aer/aerdrv_core.c b/drivers/pci/pcie/aer/aerdrv_core.c -index 0f4554e48cc5..a017aac0d7ed 100644 ---- a/drivers/pci/pcie/aer/aerdrv_core.c -+++ b/drivers/pci/pcie/aer/aerdrv_core.c -@@ -817,8 +817,6 @@ void aer_isr(struct work_struct *work) - while (get_e_source(rpc, &e_src)) - aer_isr_one_error(p_device, &e_src); - mutex_unlock(&rpc->rpc_mutex); -- -- wake_up(&rpc->wait_release); - } - - /** -diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c -index f7197a790341..eb402f4f0e2f 100644 ---- a/drivers/pci/xen-pcifront.c -+++ b/drivers/pci/xen-pcifront.c -@@ -51,7 +51,7 @@ struct pcifront_device { - }; - - struct pcifront_sd { -- int domain; -+ struct pci_sysdata sd; - struct pcifront_device *pdev; - }; - -@@ -65,7 +65,9 @@ static inline void pcifront_init_sd(struct pcifront_sd *sd, - unsigned int domain, unsigned int bus, - struct pcifront_device *pdev) - { -- sd->domain = domain; -+ /* Because we do not expose that information via XenBus. */ -+ sd->sd.node = first_online_node; -+ sd->sd.domain = domain; - sd->pdev = pdev; - } - -@@ -463,8 +465,8 @@ static int pcifront_scan_root(struct pcifront_device *pdev, - dev_info(&pdev->xdev->dev, "Creating PCI Frontend Bus %04x:%02x\n", - domain, bus); - -- bus_entry = kmalloc(sizeof(*bus_entry), GFP_KERNEL); -- sd = kmalloc(sizeof(*sd), GFP_KERNEL); -+ bus_entry = kzalloc(sizeof(*bus_entry), GFP_KERNEL); -+ sd = kzalloc(sizeof(*sd), GFP_KERNEL); - if (!bus_entry || !sd) { - err = -ENOMEM; - goto err_out; -diff --git a/drivers/power/wm831x_power.c b/drivers/power/wm831x_power.c -index 3bed2f55cf7d..3ccadf631d45 100644 ---- a/drivers/power/wm831x_power.c -+++ b/drivers/power/wm831x_power.c -@@ -567,7 +567,7 @@ static int wm831x_power_probe(struct platform_device *pdev) - - irq = wm831x_irq(wm831x, platform_get_irq_byname(pdev, "SYSLO")); - ret = request_threaded_irq(irq, NULL, wm831x_syslo_irq, -- IRQF_TRIGGER_RISING, "System power low", -+ IRQF_TRIGGER_RISING | IRQF_ONESHOT, "System power low", - power); - if (ret != 0) { - dev_err(&pdev->dev, "Failed to request SYSLO IRQ %d: %d\n", -@@ -577,7 +577,7 @@ static int wm831x_power_probe(struct platform_device *pdev) - - irq = wm831x_irq(wm831x, platform_get_irq_byname(pdev, "PWR SRC")); - ret = request_threaded_irq(irq, NULL, wm831x_pwr_src_irq, -- IRQF_TRIGGER_RISING, "Power source", -+ IRQF_TRIGGER_RISING | IRQF_ONESHOT, "Power source", - power); - if (ret != 0) { - dev_err(&pdev->dev, "Failed to request PWR SRC IRQ %d: %d\n", -@@ -590,7 +590,7 @@ static int wm831x_power_probe(struct platform_device *pdev) - platform_get_irq_byname(pdev, - wm831x_bat_irqs[i])); - ret = request_threaded_irq(irq, NULL, wm831x_bat_irq, -- IRQF_TRIGGER_RISING, -+ IRQF_TRIGGER_RISING | IRQF_ONESHOT, - wm831x_bat_irqs[i], - power); - if (ret != 0) { -diff --git a/drivers/s390/block/dasd_alias.c b/drivers/s390/block/dasd_alias.c -index a2597e683e79..6a64e86e8ccd 100644 ---- a/drivers/s390/block/dasd_alias.c -+++ b/drivers/s390/block/dasd_alias.c -@@ -264,8 +264,10 @@ void dasd_alias_disconnect_device_from_lcu(struct dasd_device *device) - spin_unlock_irqrestore(&lcu->lock, flags); - cancel_work_sync(&lcu->suc_data.worker); - spin_lock_irqsave(&lcu->lock, flags); -- if (device == lcu->suc_data.device) -+ if (device == lcu->suc_data.device) { -+ dasd_put_device(device); - lcu->suc_data.device = NULL; -+ } - } - was_pending = 0; - if (device == lcu->ruac_data.device) { -@@ -273,8 +275,10 @@ void dasd_alias_disconnect_device_from_lcu(struct dasd_device *device) - was_pending = 1; - cancel_delayed_work_sync(&lcu->ruac_data.dwork); - spin_lock_irqsave(&lcu->lock, flags); -- if (device == lcu->ruac_data.device) -+ if (device == lcu->ruac_data.device) { -+ dasd_put_device(device); - lcu->ruac_data.device = NULL; -+ } - } - private->lcu = NULL; - spin_unlock_irqrestore(&lcu->lock, flags); -@@ -549,8 +553,10 @@ static void lcu_update_work(struct work_struct *work) - if ((rc && (rc != -EOPNOTSUPP)) || (lcu->flags & NEED_UAC_UPDATE)) { - DBF_DEV_EVENT(DBF_WARNING, device, "could not update" - " alias data in lcu (rc = %d), retry later", rc); -- schedule_delayed_work(&lcu->ruac_data.dwork, 30*HZ); -+ if (!schedule_delayed_work(&lcu->ruac_data.dwork, 30*HZ)) -+ dasd_put_device(device); - } else { -+ dasd_put_device(device); - lcu->ruac_data.device = NULL; - lcu->flags &= ~UPDATE_PENDING; - } -@@ -593,8 +599,10 @@ static int _schedule_lcu_update(struct alias_lcu *lcu, - */ - if (!usedev) - return -EINVAL; -+ dasd_get_device(usedev); - lcu->ruac_data.device = usedev; -- schedule_delayed_work(&lcu->ruac_data.dwork, 0); -+ if (!schedule_delayed_work(&lcu->ruac_data.dwork, 0)) -+ dasd_put_device(usedev); - return 0; - } - -@@ -722,7 +730,7 @@ static int reset_summary_unit_check(struct alias_lcu *lcu, - ASCEBC((char *) &cqr->magic, 4); - ccw = cqr->cpaddr; - ccw->cmd_code = DASD_ECKD_CCW_RSCK; -- ccw->flags = 0 ; -+ ccw->flags = CCW_FLAG_SLI; - ccw->count = 16; - ccw->cda = (__u32)(addr_t) cqr->data; - ((char *)cqr->data)[0] = reason; -@@ -926,6 +934,7 @@ static void summary_unit_check_handling_work(struct work_struct *work) - /* 3. read new alias configuration */ - _schedule_lcu_update(lcu, device); - lcu->suc_data.device = NULL; -+ dasd_put_device(device); - spin_unlock_irqrestore(&lcu->lock, flags); - } - -@@ -985,6 +994,8 @@ void dasd_alias_handle_summary_unit_check(struct dasd_device *device, - } - lcu->suc_data.reason = reason; - lcu->suc_data.device = device; -+ dasd_get_device(device); - spin_unlock(&lcu->lock); -- schedule_work(&lcu->suc_data.worker); -+ if (!schedule_work(&lcu->suc_data.worker)) -+ dasd_put_device(device); - }; -diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h -index b52121358385..280e769a1686 100644 ---- a/drivers/scsi/megaraid/megaraid_sas.h -+++ b/drivers/scsi/megaraid/megaraid_sas.h -@@ -300,6 +300,8 @@ enum MR_EVT_ARGS { - MR_EVT_ARGS_GENERIC, - }; - -+ -+#define SGE_BUFFER_SIZE 4096 - /* - * define constants for device list query options - */ -diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c -index 78b4fe845245..e6dfa8108301 100644 ---- a/drivers/scsi/megaraid/megaraid_sas_base.c -+++ b/drivers/scsi/megaraid/megaraid_sas_base.c -@@ -3602,7 +3602,7 @@ static int megasas_init_fw(struct megasas_instance *instance) - } - - instance->max_sectors_per_req = instance->max_num_sge * -- PAGE_SIZE / 512; -+ SGE_BUFFER_SIZE / 512; - if (tmp_sectors && (instance->max_sectors_per_req > tmp_sectors)) - instance->max_sectors_per_req = tmp_sectors; - -@@ -5051,6 +5051,9 @@ static int megasas_mgmt_compat_ioctl_fw(struct file *file, unsigned long arg) - int i; - int error = 0; - compat_uptr_t ptr; -+ unsigned long local_raw_ptr; -+ u32 local_sense_off; -+ u32 local_sense_len; - - if (clear_user(ioc, sizeof(*ioc))) - return -EFAULT; -@@ -5068,9 +5071,15 @@ static int megasas_mgmt_compat_ioctl_fw(struct file *file, unsigned long arg) - * sense_len is not null, so prepare the 64bit value under - * the same condition. - */ -- if (ioc->sense_len) { -+ if (get_user(local_raw_ptr, ioc->frame.raw) || -+ get_user(local_sense_off, &ioc->sense_off) || -+ get_user(local_sense_len, &ioc->sense_len)) -+ return -EFAULT; -+ -+ -+ if (local_sense_len) { - void __user **sense_ioc_ptr = -- (void __user **)(ioc->frame.raw + ioc->sense_off); -+ (void __user **)((u8*)local_raw_ptr + local_sense_off); - compat_uptr_t *sense_cioc_ptr = - (compat_uptr_t *)(cioc->frame.raw + cioc->sense_off); - if (get_user(ptr, sense_cioc_ptr) || -diff --git a/drivers/scsi/ses.c b/drivers/scsi/ses.c -index eba183c428cf..3643bbf5456d 100644 ---- a/drivers/scsi/ses.c -+++ b/drivers/scsi/ses.c -@@ -70,6 +70,7 @@ static int ses_probe(struct device *dev) - static int ses_recv_diag(struct scsi_device *sdev, int page_code, - void *buf, int bufflen) - { -+ int ret; - unsigned char cmd[] = { - RECEIVE_DIAGNOSTIC, - 1, /* Set PCV bit */ -@@ -78,9 +79,26 @@ static int ses_recv_diag(struct scsi_device *sdev, int page_code, - bufflen & 0xff, - 0 - }; -+ unsigned char recv_page_code; - -- return scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, buf, bufflen, -+ ret = scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, buf, bufflen, - NULL, SES_TIMEOUT, SES_RETRIES, NULL); -+ if (unlikely(!ret)) -+ return ret; -+ -+ recv_page_code = ((unsigned char *)buf)[0]; -+ -+ if (likely(recv_page_code == page_code)) -+ return ret; -+ -+ /* successful diagnostic but wrong page code. This happens to some -+ * USB devices, just print a message and pretend there was an error */ -+ -+ sdev_printk(KERN_ERR, sdev, -+ "Wrong diagnostic page; asked for %d got %u\n", -+ page_code, recv_page_code); -+ -+ return -EINVAL; - } - - static int ses_send_diag(struct scsi_device *sdev, int page_code, -@@ -436,7 +454,15 @@ static void ses_enclosure_data_process(struct enclosure_device *edev, - if (desc_ptr) - desc_ptr += len; - -- if (addl_desc_ptr) -+ if (addl_desc_ptr && -+ /* only find additional descriptions for specific devices */ -+ (type_ptr[0] == ENCLOSURE_COMPONENT_DEVICE || -+ type_ptr[0] == ENCLOSURE_COMPONENT_ARRAY_DEVICE || -+ type_ptr[0] == ENCLOSURE_COMPONENT_SAS_EXPANDER || -+ /* these elements are optional */ -+ type_ptr[0] == ENCLOSURE_COMPONENT_SCSI_TARGET_PORT || -+ type_ptr[0] == ENCLOSURE_COMPONENT_SCSI_INITIATOR_PORT || -+ type_ptr[0] == ENCLOSURE_COMPONENT_CONTROLLER_ELECTRONICS)) - addl_desc_ptr += addl_desc_ptr[1] + 2; - - } -diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c -index d2ea64de92df..d6dab8adf60e 100644 ---- a/drivers/usb/class/cdc-acm.c -+++ b/drivers/usb/class/cdc-acm.c -@@ -1726,6 +1726,11 @@ static const struct usb_device_id acm_ids[] = { - }, - #endif - -+ /*Samsung phone in firmware update mode */ -+ { USB_DEVICE(0x04e8, 0x685d), -+ .driver_info = IGNORE_DEVICE, -+ }, -+ - /* Exclude Infineon Flash Loader utility */ - { USB_DEVICE(0x058b, 0x0041), - .driver_info = IGNORE_DEVICE, -diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c -index 89ba7cfba5bc..303f3b3fb65f 100644 ---- a/drivers/usb/serial/cp210x.c -+++ b/drivers/usb/serial/cp210x.c -@@ -162,6 +162,8 @@ static const struct usb_device_id id_table[] = { - { USB_DEVICE(0x1843, 0x0200) }, /* Vaisala USB Instrument Cable */ - { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */ - { USB_DEVICE(0x18EF, 0xE025) }, /* ELV Marble Sound Board 1 */ -+ { USB_DEVICE(0x1901, 0x0190) }, /* GE B850 CP2105 Recorder interface */ -+ { USB_DEVICE(0x1901, 0x0193) }, /* GE B650 CP2104 PMC interface */ - { USB_DEVICE(0x1ADB, 0x0001) }, /* Schweitzer Engineering C662 Cable */ - { USB_DEVICE(0x1B1C, 0x1C00) }, /* Corsair USB Dongle */ - { USB_DEVICE(0x1BA4, 0x0002) }, /* Silicon Labs 358x factory default */ -diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c -index 81f6a572f016..9bab34cf01d4 100644 ---- a/drivers/usb/serial/option.c -+++ b/drivers/usb/serial/option.c -@@ -315,6 +315,7 @@ static void option_instat_callback(struct urb *urb); - #define TOSHIBA_PRODUCT_G450 0x0d45 - - #define ALINK_VENDOR_ID 0x1e0e -+#define SIMCOM_PRODUCT_SIM7100E 0x9001 /* Yes, ALINK_VENDOR_ID */ - #define ALINK_PRODUCT_PH300 0x9100 - #define ALINK_PRODUCT_3GU 0x9200 - -@@ -615,6 +616,10 @@ static const struct option_blacklist_info zte_1255_blacklist = { - .reserved = BIT(3) | BIT(4), - }; - -+static const struct option_blacklist_info simcom_sim7100e_blacklist = { -+ .reserved = BIT(5) | BIT(6), -+}; -+ - static const struct option_blacklist_info telit_le910_blacklist = { - .sendsetup = BIT(0), - .reserved = BIT(1) | BIT(2), -@@ -1130,6 +1135,8 @@ static const struct usb_device_id option_ids[] = { - { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_PRODUCT_KPC650) }, - { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_PRODUCT_KPC680) }, - { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6000)}, /* ZTE AC8700 */ -+ { USB_DEVICE_AND_INTERFACE_INFO(QUALCOMM_VENDOR_ID, 0x6001, 0xff, 0xff, 0xff), /* 4G LTE usb-modem U901 */ -+ .driver_info = (kernel_ulong_t)&net_intf3_blacklist }, - { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6613)}, /* Onda H600/ZTE MF330 */ - { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x0023)}, /* ONYX 3G device */ - { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9000)}, /* SIMCom SIM5218 */ -@@ -1645,6 +1652,8 @@ static const struct usb_device_id option_ids[] = { - { USB_DEVICE(ALINK_VENDOR_ID, 0x9000) }, - { USB_DEVICE(ALINK_VENDOR_ID, ALINK_PRODUCT_PH300) }, - { USB_DEVICE_AND_INTERFACE_INFO(ALINK_VENDOR_ID, ALINK_PRODUCT_3GU, 0xff, 0xff, 0xff) }, -+ { USB_DEVICE(ALINK_VENDOR_ID, SIMCOM_PRODUCT_SIM7100E), -+ .driver_info = (kernel_ulong_t)&simcom_sim7100e_blacklist }, - { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X060S_X200), - .driver_info = (kernel_ulong_t)&alcatel_x200_blacklist - }, -diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c -index ee59b74768d9..beaa7cc4e857 100644 ---- a/drivers/virtio/virtio.c -+++ b/drivers/virtio/virtio.c -@@ -238,6 +238,7 @@ static int virtio_init(void) - static void __exit virtio_exit(void) - { - bus_unregister(&virtio_bus); -+ ida_destroy(&virtio_index_ida); - } - core_initcall(virtio_init); - module_exit(virtio_exit); -diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c -index 7360f03ddbe1..9612a01198df 100644 ---- a/fs/btrfs/disk-io.c -+++ b/fs/btrfs/disk-io.c -@@ -2437,6 +2437,7 @@ int open_ctree(struct super_block *sb, - "unsupported option features (%Lx).\n", - (unsigned long long)features); - err = -EINVAL; -+ brelse(bh); - goto fail_alloc; - } - -diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c -index ae29b403a7e2..b5d13c4eea00 100644 ---- a/fs/btrfs/inode.c -+++ b/fs/btrfs/inode.c -@@ -7477,15 +7477,28 @@ int btrfs_readpage(struct file *file, struct page *page) - static int btrfs_writepage(struct page *page, struct writeback_control *wbc) - { - struct extent_io_tree *tree; -- -+ struct inode *inode = page->mapping->host; -+ int ret; - - if (current->flags & PF_MEMALLOC) { - redirty_page_for_writepage(wbc, page); - unlock_page(page); - return 0; - } -+ -+ /* -+ * If we are under memory pressure we will call this directly from the -+ * VM, we need to make sure we have the inode referenced for the ordered -+ * extent. If not just return like we didn't do anything. -+ */ -+ if (!igrab(inode)) { -+ redirty_page_for_writepage(wbc, page); -+ return AOP_WRITEPAGE_ACTIVATE; -+ } - tree = &BTRFS_I(page->mapping->host)->io_tree; -- return extent_write_full_page(tree, page, btrfs_get_extent, wbc); -+ ret = extent_write_full_page(tree, page, btrfs_get_extent, wbc); -+ btrfs_add_delayed_iput(inode); -+ return ret; - } - - static int btrfs_writepages(struct address_space *mapping, -@@ -8474,9 +8487,11 @@ static int btrfs_symlink(struct inode *dir, struct dentry *dentry, - /* - * 2 items for inode item and ref - * 2 items for dir items -+ * 1 item for updating parent inode item -+ * 1 item for the inline extent item - * 1 item for xattr if selinux is on - */ -- trans = btrfs_start_transaction(root, 5); -+ trans = btrfs_start_transaction(root, 7); - if (IS_ERR(trans)) - return PTR_ERR(trans); - -diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c -index 414c1b9eb896..3104e0eec816 100644 ---- a/fs/btrfs/send.c -+++ b/fs/btrfs/send.c -@@ -1338,7 +1338,21 @@ static int read_symlink(struct send_ctx *sctx, - ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); - if (ret < 0) - goto out; -- BUG_ON(ret); -+ if (ret) { -+ /* -+ * An empty symlink inode. Can happen in rare error paths when -+ * creating a symlink (transaction committed before the inode -+ * eviction handler removed the symlink inode items and a crash -+ * happened in between or the subvol was snapshoted in between). -+ * Print an informative message to dmesg/syslog so that the user -+ * can delete the symlink. -+ */ -+ btrfs_err(root->fs_info, -+ "Found empty symlink inode %llu at root %llu", -+ ino, root->root_key.objectid); -+ ret = -EIO; -+ goto out; -+ } - - ei = btrfs_item_ptr(path->nodes[0], path->slots[0], - struct btrfs_file_extent_item); -diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c -index 32f35f187989..b58a9cbb9695 100644 ---- a/fs/hostfs/hostfs_kern.c -+++ b/fs/hostfs/hostfs_kern.c -@@ -720,15 +720,13 @@ static int hostfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, - - init_special_inode(inode, mode, dev); - err = do_mknod(name, mode, MAJOR(dev), MINOR(dev)); -- if (!err) -+ if (err) - goto out_free; - - err = read_name(inode, name); - __putname(name); - if (err) - goto out_put; -- if (err) -- goto out_put; - - d_instantiate(dentry, inode); - return 0; -diff --git a/fs/lockd/host.c b/fs/lockd/host.c -index 969d589c848d..b5f3c3ab0d5f 100644 ---- a/fs/lockd/host.c -+++ b/fs/lockd/host.c -@@ -116,7 +116,7 @@ static struct nlm_host *nlm_alloc_host(struct nlm_lookup_host_info *ni, - atomic_inc(&nsm->sm_count); - else { - host = NULL; -- nsm = nsm_get_handle(ni->sap, ni->salen, -+ nsm = nsm_get_handle(ni->net, ni->sap, ni->salen, - ni->hostname, ni->hostname_len); - if (unlikely(nsm == NULL)) { - dprintk("lockd: %s failed; no nsm handle\n", -@@ -534,17 +534,18 @@ static struct nlm_host *next_host_state(struct hlist_head *cache, - - /** - * nlm_host_rebooted - Release all resources held by rebooted host -+ * @net: network namespace - * @info: pointer to decoded results of NLM_SM_NOTIFY call - * - * We were notified that the specified host has rebooted. Release - * all resources held by that peer. - */ --void nlm_host_rebooted(const struct nlm_reboot *info) -+void nlm_host_rebooted(const struct net *net, const struct nlm_reboot *info) - { - struct nsm_handle *nsm; - struct nlm_host *host; - -- nsm = nsm_reboot_lookup(info); -+ nsm = nsm_reboot_lookup(net, info); - if (unlikely(nsm == NULL)) - return; - -diff --git a/fs/lockd/mon.c b/fs/lockd/mon.c -index 6ae664b489af..13fac49aff7f 100644 ---- a/fs/lockd/mon.c -+++ b/fs/lockd/mon.c -@@ -51,7 +51,6 @@ struct nsm_res { - }; - - static const struct rpc_program nsm_program; --static LIST_HEAD(nsm_handles); - static DEFINE_SPINLOCK(nsm_lock); - - /* -@@ -259,33 +258,35 @@ void nsm_unmonitor(const struct nlm_host *host) - } - } - --static struct nsm_handle *nsm_lookup_hostname(const char *hostname, -- const size_t len) -+static struct nsm_handle *nsm_lookup_hostname(const struct list_head *nsm_handles, -+ const char *hostname, const size_t len) - { - struct nsm_handle *nsm; - -- list_for_each_entry(nsm, &nsm_handles, sm_link) -+ list_for_each_entry(nsm, nsm_handles, sm_link) - if (strlen(nsm->sm_name) == len && - memcmp(nsm->sm_name, hostname, len) == 0) - return nsm; - return NULL; - } - --static struct nsm_handle *nsm_lookup_addr(const struct sockaddr *sap) -+static struct nsm_handle *nsm_lookup_addr(const struct list_head *nsm_handles, -+ const struct sockaddr *sap) - { - struct nsm_handle *nsm; - -- list_for_each_entry(nsm, &nsm_handles, sm_link) -+ list_for_each_entry(nsm, nsm_handles, sm_link) - if (rpc_cmp_addr(nsm_addr(nsm), sap)) - return nsm; - return NULL; - } - --static struct nsm_handle *nsm_lookup_priv(const struct nsm_private *priv) -+static struct nsm_handle *nsm_lookup_priv(const struct list_head *nsm_handles, -+ const struct nsm_private *priv) - { - struct nsm_handle *nsm; - -- list_for_each_entry(nsm, &nsm_handles, sm_link) -+ list_for_each_entry(nsm, nsm_handles, sm_link) - if (memcmp(nsm->sm_priv.data, priv->data, - sizeof(priv->data)) == 0) - return nsm; -@@ -350,6 +351,7 @@ static struct nsm_handle *nsm_create_handle(const struct sockaddr *sap, - - /** - * nsm_get_handle - Find or create a cached nsm_handle -+ * @net: network namespace - * @sap: pointer to socket address of handle to find - * @salen: length of socket address - * @hostname: pointer to C string containing hostname to find -@@ -362,11 +364,13 @@ static struct nsm_handle *nsm_create_handle(const struct sockaddr *sap, - * @hostname cannot be found in the handle cache. Returns NULL if - * an error occurs. - */ --struct nsm_handle *nsm_get_handle(const struct sockaddr *sap, -+struct nsm_handle *nsm_get_handle(const struct net *net, -+ const struct sockaddr *sap, - const size_t salen, const char *hostname, - const size_t hostname_len) - { - struct nsm_handle *cached, *new = NULL; -+ struct lockd_net *ln = net_generic(net, lockd_net_id); - - if (hostname && memchr(hostname, '/', hostname_len) != NULL) { - if (printk_ratelimit()) { -@@ -381,9 +385,10 @@ retry: - spin_lock(&nsm_lock); - - if (nsm_use_hostnames && hostname != NULL) -- cached = nsm_lookup_hostname(hostname, hostname_len); -+ cached = nsm_lookup_hostname(&ln->nsm_handles, -+ hostname, hostname_len); - else -- cached = nsm_lookup_addr(sap); -+ cached = nsm_lookup_addr(&ln->nsm_handles, sap); - - if (cached != NULL) { - atomic_inc(&cached->sm_count); -@@ -397,7 +402,7 @@ retry: - } - - if (new != NULL) { -- list_add(&new->sm_link, &nsm_handles); -+ list_add(&new->sm_link, &ln->nsm_handles); - spin_unlock(&nsm_lock); - dprintk("lockd: created nsm_handle for %s (%s)\n", - new->sm_name, new->sm_addrbuf); -@@ -414,19 +419,22 @@ retry: - - /** - * nsm_reboot_lookup - match NLMPROC_SM_NOTIFY arguments to an nsm_handle -+ * @net: network namespace - * @info: pointer to NLMPROC_SM_NOTIFY arguments - * - * Returns a matching nsm_handle if found in the nsm cache. The returned - * nsm_handle's reference count is bumped. Otherwise returns NULL if some - * error occurred. - */ --struct nsm_handle *nsm_reboot_lookup(const struct nlm_reboot *info) -+struct nsm_handle *nsm_reboot_lookup(const struct net *net, -+ const struct nlm_reboot *info) - { - struct nsm_handle *cached; -+ struct lockd_net *ln = net_generic(net, lockd_net_id); - - spin_lock(&nsm_lock); - -- cached = nsm_lookup_priv(&info->priv); -+ cached = nsm_lookup_priv(&ln->nsm_handles, &info->priv); - if (unlikely(cached == NULL)) { - spin_unlock(&nsm_lock); - dprintk("lockd: never saw rebooted peer '%.*s' before\n", -diff --git a/fs/lockd/netns.h b/fs/lockd/netns.h -index 5010b55628b4..414da99744e9 100644 ---- a/fs/lockd/netns.h -+++ b/fs/lockd/netns.h -@@ -16,6 +16,7 @@ struct lockd_net { - spinlock_t nsm_clnt_lock; - unsigned int nsm_users; - struct rpc_clnt *nsm_clnt; -+ struct list_head nsm_handles; - }; - - extern int lockd_net_id; -diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c -index 7a318480ab7a..ce05c60ff06d 100644 ---- a/fs/lockd/svc.c -+++ b/fs/lockd/svc.c -@@ -583,6 +583,7 @@ static int lockd_init_net(struct net *net) - INIT_DELAYED_WORK(&ln->grace_period_end, grace_ender); - INIT_LIST_HEAD(&ln->grace_list); - spin_lock_init(&ln->nsm_clnt_lock); -+ INIT_LIST_HEAD(&ln->nsm_handles); - return 0; - } - -diff --git a/fs/lockd/svc4proc.c b/fs/lockd/svc4proc.c -index b147d1ae71fd..09c576f26c7b 100644 ---- a/fs/lockd/svc4proc.c -+++ b/fs/lockd/svc4proc.c -@@ -421,7 +421,7 @@ nlm4svc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp, - return rpc_system_err; - } - -- nlm_host_rebooted(argp); -+ nlm_host_rebooted(SVC_NET(rqstp), argp); - return rpc_success; - } - -diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c -index 21171f0c6477..fb26b9f522e7 100644 ---- a/fs/lockd/svcproc.c -+++ b/fs/lockd/svcproc.c -@@ -464,7 +464,7 @@ nlmsvc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp, - return rpc_system_err; - } - -- nlm_host_rebooted(argp); -+ nlm_host_rebooted(SVC_NET(rqstp), argp); - return rpc_success; - } - -diff --git a/fs/namei.c b/fs/namei.c -index 157c3dbacf6c..c87e15ee9255 100644 ---- a/fs/namei.c -+++ b/fs/namei.c -@@ -2917,6 +2917,10 @@ opened: - goto exit_fput; - } - out: -+ if (unlikely(error > 0)) { -+ WARN_ON(1); -+ error = -EINVAL; -+ } - if (got_write) - mnt_drop_write(nd->path.mnt); - path_put(&save_parent); -diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c -index cfa9163b3bb7..2bdaf57c82d0 100644 ---- a/fs/nfs/nfs4state.c -+++ b/fs/nfs/nfs4state.c -@@ -1452,7 +1452,7 @@ restart: - } - spin_unlock(&state->state_lock); - nfs4_put_open_state(state); -- clear_bit(NFS4CLNT_RECLAIM_NOGRACE, -+ clear_bit(NFS_STATE_RECLAIM_NOGRACE, - &state->flags); - spin_lock(&sp->so_lock); - goto restart; -diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c -index 9f285fb9bab3..b86db1236c7c 100644 ---- a/fs/proc/task_mmu.c -+++ b/fs/proc/task_mmu.c -@@ -170,7 +170,7 @@ static void *m_start(struct seq_file *m, loff_t *pos) - if (!priv->task) - return ERR_PTR(-ESRCH); - -- mm = mm_access(priv->task, PTRACE_MODE_READ); -+ mm = mm_access(priv->task, PTRACE_MODE_READ_FSCREDS); - if (!mm || IS_ERR(mm)) - return mm; - down_read(&mm->mmap_sem); -@@ -1044,7 +1044,7 @@ static ssize_t pagemap_read(struct file *file, char __user *buf, - if (!pm.buffer) - goto out_task; - -- mm = mm_access(task, PTRACE_MODE_READ); -+ mm = mm_access(task, PTRACE_MODE_READ_FSCREDS); - ret = PTR_ERR(mm); - if (!mm || IS_ERR(mm)) - goto out_free; -diff --git a/fs/proc/task_nommu.c b/fs/proc/task_nommu.c -index 56123a6f462e..123c19890b14 100644 ---- a/fs/proc/task_nommu.c -+++ b/fs/proc/task_nommu.c -@@ -223,7 +223,7 @@ static void *m_start(struct seq_file *m, loff_t *pos) - if (!priv->task) - return ERR_PTR(-ESRCH); - -- mm = mm_access(priv->task, PTRACE_MODE_READ); -+ mm = mm_access(priv->task, PTRACE_MODE_READ_FSCREDS); - if (!mm || IS_ERR(mm)) { - put_task_struct(priv->task); - priv->task = NULL; -diff --git a/fs/splice.c b/fs/splice.c -index f183f1342c01..3b94a6bba29f 100644 ---- a/fs/splice.c -+++ b/fs/splice.c -@@ -949,6 +949,7 @@ ssize_t __splice_from_pipe(struct pipe_inode_info *pipe, struct splice_desc *sd, - - splice_from_pipe_begin(sd); - do { -+ cond_resched(); - ret = splice_from_pipe_next(pipe, sd); - if (ret > 0) - ret = splice_from_pipe_feed(pipe, sd, actor); -@@ -1189,7 +1190,7 @@ ssize_t splice_direct_to_actor(struct file *in, struct splice_desc *sd, - long ret, bytes; - umode_t i_mode; - size_t len; -- int i, flags; -+ int i, flags, more; - - /* - * We require the input being a regular file, as we don't want to -@@ -1232,6 +1233,7 @@ ssize_t splice_direct_to_actor(struct file *in, struct splice_desc *sd, - * Don't block on output, we have to drain the direct pipe. - */ - sd->flags &= ~SPLICE_F_NONBLOCK; -+ more = sd->flags & SPLICE_F_MORE; - - while (len) { - size_t read_len; -@@ -1245,6 +1247,15 @@ ssize_t splice_direct_to_actor(struct file *in, struct splice_desc *sd, - sd->total_len = read_len; - - /* -+ * If more data is pending, set SPLICE_F_MORE -+ * If this is the last data and SPLICE_F_MORE was not set -+ * initially, clears it. -+ */ -+ if (read_len < len) -+ sd->flags |= SPLICE_F_MORE; -+ else if (!more) -+ sd->flags &= ~SPLICE_F_MORE; -+ /* - * NOTE: nonblocking mode only applies to the input. We - * must not do the output in nonblocking mode as then we - * could get stuck data in the internal pipe: -diff --git a/include/linux/enclosure.h b/include/linux/enclosure.h -index 9a33c5f7e126..f6c229e2bffa 100644 ---- a/include/linux/enclosure.h -+++ b/include/linux/enclosure.h -@@ -29,7 +29,11 @@ - /* A few generic types ... taken from ses-2 */ - enum enclosure_component_type { - ENCLOSURE_COMPONENT_DEVICE = 0x01, -+ ENCLOSURE_COMPONENT_CONTROLLER_ELECTRONICS = 0x07, -+ ENCLOSURE_COMPONENT_SCSI_TARGET_PORT = 0x14, -+ ENCLOSURE_COMPONENT_SCSI_INITIATOR_PORT = 0x15, - ENCLOSURE_COMPONENT_ARRAY_DEVICE = 0x17, -+ ENCLOSURE_COMPONENT_SAS_EXPANDER = 0x18, - }; - - /* ses-2 common element status */ -diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h -index dcaad79f54ed..0adf073f13b3 100644 ---- a/include/linux/lockd/lockd.h -+++ b/include/linux/lockd/lockd.h -@@ -236,7 +236,8 @@ void nlm_rebind_host(struct nlm_host *); - struct nlm_host * nlm_get_host(struct nlm_host *); - void nlm_shutdown_hosts(void); - void nlm_shutdown_hosts_net(struct net *net); --void nlm_host_rebooted(const struct nlm_reboot *); -+void nlm_host_rebooted(const struct net *net, -+ const struct nlm_reboot *); - - /* - * Host monitoring -@@ -244,11 +245,13 @@ void nlm_host_rebooted(const struct nlm_reboot *); - int nsm_monitor(const struct nlm_host *host); - void nsm_unmonitor(const struct nlm_host *host); - --struct nsm_handle *nsm_get_handle(const struct sockaddr *sap, -+struct nsm_handle *nsm_get_handle(const struct net *net, -+ const struct sockaddr *sap, - const size_t salen, - const char *hostname, - const size_t hostname_len); --struct nsm_handle *nsm_reboot_lookup(const struct nlm_reboot *info); -+struct nsm_handle *nsm_reboot_lookup(const struct net *net, -+ const struct nlm_reboot *info); - void nsm_release(struct nsm_handle *nsm); - - /* -diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h -index fc01d5cb4cf1..7d2021d3ee08 100644 ---- a/include/linux/nfs_fs.h -+++ b/include/linux/nfs_fs.h -@@ -578,9 +578,7 @@ static inline void nfs3_forget_cached_acls(struct inode *inode) - - static inline loff_t nfs_size_to_loff_t(__u64 size) - { -- if (size > (__u64) OFFSET_MAX - 1) -- return OFFSET_MAX - 1; -- return (loff_t) size; -+ return min_t(u64, size, OFFSET_MAX); - } - - static inline ino_t -diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h -index ba605015c4d8..0b2d0cbe0bab 100644 ---- a/include/linux/tracepoint.h -+++ b/include/linux/tracepoint.h -@@ -14,8 +14,11 @@ - * See the file COPYING for more details. - */ - -+#include - #include - #include -+#include -+#include - #include - #include - -@@ -126,6 +129,9 @@ static inline void tracepoint_synchronize_unregister(void) - void *it_func; \ - void *__data; \ - \ -+ if (!cpu_online(raw_smp_processor_id())) \ -+ return; \ -+ \ - if (!(cond)) \ - return; \ - prercu; \ -diff --git a/include/net/af_unix.h b/include/net/af_unix.h -index 686760024572..6278e4d32612 100644 ---- a/include/net/af_unix.h -+++ b/include/net/af_unix.h -@@ -6,8 +6,8 @@ - #include - #include - --extern void unix_inflight(struct file *fp); --extern void unix_notinflight(struct file *fp); -+extern void unix_inflight(struct user_struct *user, struct file *fp); -+extern void unix_notinflight(struct user_struct *user, struct file *fp); - extern void unix_gc(void); - extern void wait_for_unix_gc(void); - extern struct sock *unix_get_socket(struct file *filp); -diff --git a/include/net/scm.h b/include/net/scm.h -index 8de2d37d2077..d00cd43a990c 100644 ---- a/include/net/scm.h -+++ b/include/net/scm.h -@@ -21,6 +21,7 @@ struct scm_creds { - struct scm_fp_list { - short count; - short max; -+ struct user_struct *user; - struct file *fp[SCM_MAX_FD]; - }; - -diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c -index a79d267b64ec..7b0d31b67f6a 100644 ---- a/kernel/irq/manage.c -+++ b/kernel/irq/manage.c -@@ -1229,6 +1229,7 @@ static struct irqaction *__free_irq(unsigned int irq, void *dev_id) - if (!desc) - return NULL; - -+ chip_bus_lock(desc); - raw_spin_lock_irqsave(&desc->lock, flags); - - /* -@@ -1242,7 +1243,7 @@ static struct irqaction *__free_irq(unsigned int irq, void *dev_id) - if (!action) { - WARN(1, "Trying to free already-free IRQ %d\n", irq); - raw_spin_unlock_irqrestore(&desc->lock, flags); -- -+ chip_bus_sync_unlock(desc); - return NULL; - } - -@@ -1265,6 +1266,7 @@ static struct irqaction *__free_irq(unsigned int irq, void *dev_id) - #endif - - raw_spin_unlock_irqrestore(&desc->lock, flags); -+ chip_bus_sync_unlock(desc); - - unregister_handler_proc(irq, action); - -@@ -1338,9 +1340,7 @@ void free_irq(unsigned int irq, void *dev_id) - desc->affinity_notify = NULL; - #endif - -- chip_bus_lock(desc); - kfree(__free_irq(irq, dev_id)); -- chip_bus_sync_unlock(desc); - } - EXPORT_SYMBOL(free_irq); - -diff --git a/kernel/resource.c b/kernel/resource.c -index d7386986e10e..b8422b135b68 100644 ---- a/kernel/resource.c -+++ b/kernel/resource.c -@@ -961,9 +961,10 @@ struct resource * __request_region(struct resource *parent, - if (!conflict) - break; - if (conflict != parent) { -- parent = conflict; -- if (!(conflict->flags & IORESOURCE_BUSY)) -+ if (!(conflict->flags & IORESOURCE_BUSY)) { -+ parent = conflict; - continue; -+ } - } - if (conflict->flags & flags & IORESOURCE_MUXED) { - add_wait_queue(&muxed_resource_wait, &wait); -diff --git a/kernel/sched/core.c b/kernel/sched/core.c -index c771f2547bef..f234c84d36c8 100644 ---- a/kernel/sched/core.c -+++ b/kernel/sched/core.c -@@ -1587,7 +1587,6 @@ out: - */ - int wake_up_process(struct task_struct *p) - { -- WARN_ON(task_is_stopped_or_traced(p)); - return try_to_wake_up(p, TASK_NORMAL, 0); - } - EXPORT_SYMBOL(wake_up_process); -diff --git a/kernel/time/posix-clock.c b/kernel/time/posix-clock.c -index ce033c7aa2e8..9cff0ab82b63 100644 ---- a/kernel/time/posix-clock.c -+++ b/kernel/time/posix-clock.c -@@ -69,10 +69,10 @@ static ssize_t posix_clock_read(struct file *fp, char __user *buf, - static unsigned int posix_clock_poll(struct file *fp, poll_table *wait) - { - struct posix_clock *clk = get_posix_clock(fp); -- int result = 0; -+ unsigned int result = 0; - - if (!clk) -- return -ENODEV; -+ return POLLERR; - - if (clk->ops.poll) - result = clk->ops.poll(clk, fp, wait); -diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c -index ab21b8c66535..cb73c4e0741e 100644 ---- a/kernel/trace/ring_buffer.c -+++ b/kernel/trace/ring_buffer.c -@@ -1948,12 +1948,6 @@ rb_set_commit_to_write(struct ring_buffer_per_cpu *cpu_buffer) - goto again; - } - --static void rb_reset_reader_page(struct ring_buffer_per_cpu *cpu_buffer) --{ -- cpu_buffer->read_stamp = cpu_buffer->reader_page->page->time_stamp; -- cpu_buffer->reader_page->read = 0; --} -- - static void rb_inc_iter(struct ring_buffer_iter *iter) - { - struct ring_buffer_per_cpu *cpu_buffer = iter->cpu_buffer; -@@ -3591,7 +3585,7 @@ rb_get_reader_page(struct ring_buffer_per_cpu *cpu_buffer) - - /* Finally update the reader page to the new head */ - cpu_buffer->reader_page = reader; -- rb_reset_reader_page(cpu_buffer); -+ cpu_buffer->reader_page->read = 0; - - if (overwrite != cpu_buffer->last_overrun) { - cpu_buffer->lost_events = overwrite - cpu_buffer->last_overrun; -@@ -3601,6 +3595,10 @@ rb_get_reader_page(struct ring_buffer_per_cpu *cpu_buffer) - goto again; - - out: -+ /* Update the read_stamp on the first event */ -+ if (reader && reader->read == 0) -+ cpu_buffer->read_stamp = reader->page->time_stamp; -+ - arch_spin_unlock(&cpu_buffer->lock); - local_irq_restore(flags); - -diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c -index 5a898f15bfc6..7d054b7671ec 100644 ---- a/kernel/trace/trace_events.c -+++ b/kernel/trace/trace_events.c -@@ -602,7 +602,8 @@ t_next(struct seq_file *m, void *v, loff_t *pos) - * The ftrace subsystem is for showing formats only. - * They can not be enabled or disabled via the event files. - */ -- if (call->class && call->class->reg) -+ if (call->class && call->class->reg && -+ !(call->flags & TRACE_EVENT_FL_IGNORE_ENABLE)) - return file; - } - -diff --git a/kernel/workqueue.c b/kernel/workqueue.c -index fa927fd5778d..fe7c4b91d2e7 100644 ---- a/kernel/workqueue.c -+++ b/kernel/workqueue.c -@@ -1450,13 +1450,13 @@ static void __queue_delayed_work(int cpu, struct workqueue_struct *wq, - timer_stats_timer_set_start_info(&dwork->timer); - - dwork->wq = wq; -- /* timer isn't guaranteed to run in this cpu, record earlier */ -- if (cpu == WORK_CPU_UNBOUND) -- cpu = raw_smp_processor_id(); - dwork->cpu = cpu; - timer->expires = jiffies + delay; - -- add_timer_on(timer, cpu); -+ if (unlikely(cpu != WORK_CPU_UNBOUND)) -+ add_timer_on(timer, cpu); -+ else -+ add_timer(timer); - } - - /** -diff --git a/lib/devres.c b/lib/devres.c -index 823533138fa0..20afaf181b27 100644 ---- a/lib/devres.c -+++ b/lib/devres.c -@@ -423,7 +423,7 @@ void pcim_iounmap_regions(struct pci_dev *pdev, int mask) - if (!iomap) - return; - -- for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) { -+ for (i = 0; i < PCIM_IOMAP_MAX; i++) { - if (!(mask & (1 << i))) - continue; - -diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c -index e3bea2e0821a..025ced8fbb57 100644 ---- a/net/ceph/messenger.c -+++ b/net/ceph/messenger.c -@@ -2277,7 +2277,7 @@ static int read_partial_message(struct ceph_connection *con) - con->in_base_pos = -front_len - middle_len - data_len - - sizeof(m->footer); - con->in_tag = CEPH_MSGR_TAG_READY; -- return 0; -+ return 1; - } else if ((s64)seq - (s64)con->in_seq > 1) { - pr_err("read_partial_message bad seq %lld expected %lld\n", - seq, con->in_seq + 1); -@@ -2310,7 +2310,7 @@ static int read_partial_message(struct ceph_connection *con) - sizeof(m->footer); - con->in_tag = CEPH_MSGR_TAG_READY; - con->in_seq++; -- return 0; -+ return 1; - } - - BUG_ON(!con->in_msg); -diff --git a/net/core/scm.c b/net/core/scm.c -index dbc6bfcdf446..7a6cf8351cde 100644 ---- a/net/core/scm.c -+++ b/net/core/scm.c -@@ -87,6 +87,7 @@ static int scm_fp_copy(struct cmsghdr *cmsg, struct scm_fp_list **fplp) - *fplp = fpl; - fpl->count = 0; - fpl->max = SCM_MAX_FD; -+ fpl->user = NULL; - } - fpp = &fpl->fp[fpl->count]; - -@@ -107,6 +108,10 @@ static int scm_fp_copy(struct cmsghdr *cmsg, struct scm_fp_list **fplp) - *fpp++ = file; - fpl->count++; - } -+ -+ if (!fpl->user) -+ fpl->user = get_uid(current_user()); -+ - return num; - } - -@@ -119,6 +124,7 @@ void __scm_destroy(struct scm_cookie *scm) - scm->fp = NULL; - for (i=fpl->count-1; i>=0; i--) - fput(fpl->fp[i]); -+ free_uid(fpl->user); - kfree(fpl); - } - } -@@ -337,6 +343,7 @@ struct scm_fp_list *scm_fp_dup(struct scm_fp_list *fpl) - for (i = 0; i < fpl->count; i++) - get_file(fpl->fp[i]); - new_fpl->max = new_fpl->count; -+ new_fpl->user = get_uid(fpl->user); - } - return new_fpl; - } -diff --git a/net/mac80211/mesh_pathtbl.c b/net/mac80211/mesh_pathtbl.c -index 89aacfd2756d..9ba6d8c7c793 100644 ---- a/net/mac80211/mesh_pathtbl.c -+++ b/net/mac80211/mesh_pathtbl.c -@@ -747,10 +747,8 @@ void mesh_plink_broken(struct sta_info *sta) - static void mesh_path_node_reclaim(struct rcu_head *rp) - { - struct mpath_node *node = container_of(rp, struct mpath_node, rcu); -- struct ieee80211_sub_if_data *sdata = node->mpath->sdata; - - del_timer_sync(&node->mpath->timer); -- atomic_dec(&sdata->u.mesh.mpaths); - kfree(node->mpath); - kfree(node); - } -@@ -758,8 +756,9 @@ static void mesh_path_node_reclaim(struct rcu_head *rp) - /* needs to be called with the corresponding hashwlock taken */ - static void __mesh_path_del(struct mesh_table *tbl, struct mpath_node *node) - { -- struct mesh_path *mpath; -- mpath = node->mpath; -+ struct mesh_path *mpath = node->mpath; -+ struct ieee80211_sub_if_data *sdata = node->mpath->sdata; -+ - spin_lock(&mpath->state_lock); - mpath->flags |= MESH_PATH_RESOLVING; - if (mpath->is_gate) -@@ -767,6 +766,7 @@ static void __mesh_path_del(struct mesh_table *tbl, struct mpath_node *node) - hlist_del_rcu(&node->list); - call_rcu(&node->rcu, mesh_path_node_reclaim); - spin_unlock(&mpath->state_lock); -+ atomic_dec(&sdata->u.mesh.mpaths); - atomic_dec(&tbl->entries); - } - -diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c -index 0283baedcdfb..9dc979abb461 100644 ---- a/net/netfilter/nf_conntrack_core.c -+++ b/net/netfilter/nf_conntrack_core.c -@@ -311,6 +311,21 @@ static void death_by_timeout(unsigned long ul_conntrack) - nf_ct_put(ct); - } - -+static inline bool -+nf_ct_key_equal(struct nf_conntrack_tuple_hash *h, -+ const struct nf_conntrack_tuple *tuple, -+ u16 zone) -+{ -+ struct nf_conn *ct = nf_ct_tuplehash_to_ctrack(h); -+ -+ /* A conntrack can be recreated with the equal tuple, -+ * so we need to check that the conntrack is confirmed -+ */ -+ return nf_ct_tuple_equal(tuple, &h->tuple) && -+ nf_ct_zone(ct) == zone && -+ nf_ct_is_confirmed(ct); -+} -+ - /* - * Warning : - * - Caller must take a reference on returned object -@@ -332,8 +347,7 @@ ____nf_conntrack_find(struct net *net, u16 zone, - local_bh_disable(); - begin: - hlist_nulls_for_each_entry_rcu(h, n, &net->ct.hash[bucket], hnnode) { -- if (nf_ct_tuple_equal(tuple, &h->tuple) && -- nf_ct_zone(nf_ct_tuplehash_to_ctrack(h)) == zone) { -+ if (nf_ct_key_equal(h, tuple, zone)) { - NF_CT_STAT_INC(net, found); - local_bh_enable(); - return h; -@@ -380,8 +394,7 @@ begin: - !atomic_inc_not_zero(&ct->ct_general.use))) - h = NULL; - else { -- if (unlikely(!nf_ct_tuple_equal(tuple, &h->tuple) || -- nf_ct_zone(ct) != zone)) { -+ if (unlikely(!nf_ct_key_equal(h, tuple, zone))) { - nf_ct_put(ct); - goto begin; - } -diff --git a/net/rds/connection.c b/net/rds/connection.c -index e88bf3976e54..642ad42c416b 100644 ---- a/net/rds/connection.c -+++ b/net/rds/connection.c -@@ -177,12 +177,6 @@ static struct rds_connection *__rds_conn_create(__be32 laddr, __be32 faddr, - } - } - -- if (trans == NULL) { -- kmem_cache_free(rds_conn_slab, conn); -- conn = ERR_PTR(-ENODEV); -- goto out; -- } -- - conn->c_trans = trans; - - ret = trans->conn_alloc(conn, gfp); -diff --git a/net/rds/send.c b/net/rds/send.c -index 88eace57dd6b..31c9fa464b11 100644 ---- a/net/rds/send.c -+++ b/net/rds/send.c -@@ -955,11 +955,13 @@ int rds_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, - release_sock(sk); - } - -- /* racing with another thread binding seems ok here */ -+ lock_sock(sk); - if (daddr == 0 || rs->rs_bound_addr == 0) { -+ release_sock(sk); - ret = -ENOTCONN; /* XXX not a great errno */ - goto out; - } -+ release_sock(sk); - - /* size of rm including all sgs */ - ret = rds_rm_size(msg, payload_len); -diff --git a/net/rfkill/core.c b/net/rfkill/core.c -index 1cec5e4f3a5e..6563cc04c578 100644 ---- a/net/rfkill/core.c -+++ b/net/rfkill/core.c -@@ -51,7 +51,6 @@ - struct rfkill { - spinlock_t lock; - -- const char *name; - enum rfkill_type type; - - unsigned long state; -@@ -75,6 +74,7 @@ struct rfkill { - struct delayed_work poll_work; - struct work_struct uevent_work; - struct work_struct sync_work; -+ char name[]; - }; - #define to_rfkill(d) container_of(d, struct rfkill, dev) - -@@ -871,14 +871,14 @@ struct rfkill * __must_check rfkill_alloc(const char *name, - if (WARN_ON(type == RFKILL_TYPE_ALL || type >= NUM_RFKILL_TYPES)) - return NULL; - -- rfkill = kzalloc(sizeof(*rfkill), GFP_KERNEL); -+ rfkill = kzalloc(sizeof(*rfkill) + strlen(name) + 1, GFP_KERNEL); - if (!rfkill) - return NULL; - - spin_lock_init(&rfkill->lock); - INIT_LIST_HEAD(&rfkill->node); - rfkill->type = type; -- rfkill->name = name; -+ strcpy(rfkill->name, name); - rfkill->ops = ops; - rfkill->data = ops_data; - -@@ -1088,17 +1088,6 @@ static unsigned int rfkill_fop_poll(struct file *file, poll_table *wait) - return res; - } - --static bool rfkill_readable(struct rfkill_data *data) --{ -- bool r; -- -- mutex_lock(&data->mtx); -- r = !list_empty(&data->events); -- mutex_unlock(&data->mtx); -- -- return r; --} -- - static ssize_t rfkill_fop_read(struct file *file, char __user *buf, - size_t count, loff_t *pos) - { -@@ -1115,8 +1104,11 @@ static ssize_t rfkill_fop_read(struct file *file, char __user *buf, - goto out; - } - mutex_unlock(&data->mtx); -+ /* since we re-check and it just compares pointers, -+ * using !list_empty() without locking isn't a problem -+ */ - ret = wait_event_interruptible(data->read_wait, -- rfkill_readable(data)); -+ !list_empty(&data->events)); - mutex_lock(&data->mtx); - - if (ret) -diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c -index 231b71944c52..a4266b9b2429 100644 ---- a/net/sunrpc/cache.c -+++ b/net/sunrpc/cache.c -@@ -1221,7 +1221,7 @@ int qword_get(char **bpp, char *dest, int bufsize) - if (bp[0] == '\\' && bp[1] == 'x') { - /* HEX STRING */ - bp += 2; -- while (len < bufsize) { -+ while (len < bufsize - 1) { - int h, l; - - h = hex_to_bin(bp[0]); -diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c -index a673c1f4f638..8f118c7c19e1 100644 ---- a/net/unix/af_unix.c -+++ b/net/unix/af_unix.c -@@ -1466,7 +1466,7 @@ static void unix_detach_fds(struct scm_cookie *scm, struct sk_buff *skb) - UNIXCB(skb).fp = NULL; - - for (i = scm->fp->count-1; i >= 0; i--) -- unix_notinflight(scm->fp->fp[i]); -+ unix_notinflight(scm->fp->user, scm->fp->fp[i]); - } - - static void unix_destruct_scm(struct sk_buff *skb) -@@ -1531,7 +1531,7 @@ static int unix_attach_fds(struct scm_cookie *scm, struct sk_buff *skb) - return -ENOMEM; - - for (i = scm->fp->count - 1; i >= 0; i--) -- unix_inflight(scm->fp->fp[i]); -+ unix_inflight(scm->fp->user, scm->fp->fp[i]); - return max_level; - } - -diff --git a/net/unix/garbage.c b/net/unix/garbage.c -index 06730fe6ad9d..a72182d6750f 100644 ---- a/net/unix/garbage.c -+++ b/net/unix/garbage.c -@@ -122,7 +122,7 @@ struct sock *unix_get_socket(struct file *filp) - * descriptor if it is for an AF_UNIX socket. - */ - --void unix_inflight(struct file *fp) -+void unix_inflight(struct user_struct *user, struct file *fp) - { - struct sock *s = unix_get_socket(fp); - -@@ -139,11 +139,11 @@ void unix_inflight(struct file *fp) - } - unix_tot_inflight++; - } -- fp->f_cred->user->unix_inflight++; -+ user->unix_inflight++; - spin_unlock(&unix_gc_lock); - } - --void unix_notinflight(struct file *fp) -+void unix_notinflight(struct user_struct *user, struct file *fp) - { - struct sock *s = unix_get_socket(fp); - -@@ -157,7 +157,7 @@ void unix_notinflight(struct file *fp) - list_del_init(&u->link); - unix_tot_inflight--; - } -- fp->f_cred->user->unix_inflight--; -+ user->unix_inflight--; - spin_unlock(&unix_gc_lock); - } - -diff --git a/scripts/recordmcount.c b/scripts/recordmcount.c -index 9c22317778eb..ee625e3a56ba 100644 ---- a/scripts/recordmcount.c -+++ b/scripts/recordmcount.c -@@ -189,6 +189,20 @@ static void *mmap_file(char const *fname) - addr = umalloc(sb.st_size); - uread(fd_map, addr, sb.st_size); - } -+ if (sb.st_nlink != 1) { -+ /* file is hard-linked, break the hard link */ -+ close(fd_map); -+ if (unlink(fname) < 0) { -+ perror(fname); -+ fail_file(); -+ } -+ fd_map = open(fname, O_RDWR | O_CREAT, sb.st_mode); -+ if (fd_map < 0) { -+ perror(fname); -+ fail_file(); -+ } -+ uwrite(fd_map, addr, sb.st_size); -+ } - return addr; - } - -diff --git a/tools/Makefile b/tools/Makefile -index 41067f304215..b82a15b92b1c 100644 ---- a/tools/Makefile -+++ b/tools/Makefile -@@ -22,6 +22,10 @@ help: - @echo ' from the kernel command line to build and install one of' - @echo ' the tools above' - @echo '' -+ @echo ' $$ make tools/all' -+ @echo '' -+ @echo ' builds all tools.' -+ @echo '' - @echo ' $$ make tools/install' - @echo '' - @echo ' installs all tools.' -@@ -50,6 +54,10 @@ selftests: FORCE - turbostat x86_energy_perf_policy: FORCE - $(call descend,power/x86/$@) - -+all: cgroup cpupower firewire lguest \ -+ perf selftests turbostat usb \ -+ virtio vm net x86_energy_perf_policy -+ - cpupower_install: - $(call descend,power/$(@:_install=),install) - -diff --git a/virt/kvm/async_pf.c b/virt/kvm/async_pf.c -index ea475cd03511..ca2d05a07b57 100644 ---- a/virt/kvm/async_pf.c -+++ b/virt/kvm/async_pf.c -@@ -158,7 +158,7 @@ int kvm_setup_async_pf(struct kvm_vcpu *vcpu, gva_t gva, gfn_t gfn, - * do alloc nowait since if we are going to sleep anyway we - * may as well sleep faulting in page - */ -- work = kmem_cache_zalloc(async_pf_cache, GFP_NOWAIT); -+ work = kmem_cache_zalloc(async_pf_cache, GFP_NOWAIT | __GFP_NOWARN); - if (!work) - return 0; - diff --git a/patch/kernel/marvell-default/1-patch-3.10.99-100.patch b/patch/kernel/marvell-default/1-patch-3.10.99-100.patch deleted file mode 100644 index da39546c5f..0000000000 --- a/patch/kernel/marvell-default/1-patch-3.10.99-100.patch +++ /dev/null @@ -1,1156 +0,0 @@ -diff --git a/Makefile b/Makefile -index f1e6491fd7d8..40d4d3bf52c3 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,6 +1,6 @@ - VERSION = 3 - PATCHLEVEL = 10 --SUBLEVEL = 99 -+SUBLEVEL = 100 - EXTRAVERSION = - NAME = TOSSUG Baby Fish - -diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S -index c9305ef1d411..e73982b93537 100644 ---- a/arch/x86/ia32/ia32entry.S -+++ b/arch/x86/ia32/ia32entry.S -@@ -422,6 +422,7 @@ ENTRY(ia32_syscall) - /*CFI_REL_OFFSET cs,CS-RIP*/ - CFI_REL_OFFSET rip,RIP-RIP - PARAVIRT_ADJUST_EXCEPTION_FRAME -+ ASM_CLAC /* Do this early to minimize exposure */ - SWAPGS - /* - * No need to follow this irqs on/off section: the syscall -diff --git a/arch/x86/kernel/acpi/sleep.c b/arch/x86/kernel/acpi/sleep.c -index ec94e11807dc..ca0805633f26 100644 ---- a/arch/x86/kernel/acpi/sleep.c -+++ b/arch/x86/kernel/acpi/sleep.c -@@ -16,6 +16,7 @@ - #include - #include - -+#include - #include "../../realmode/rm/wakeup.h" - #include "sleep.h" - -@@ -96,7 +97,13 @@ int acpi_suspend_lowlevel(void) - saved_magic = 0x123456789abcdef0L; - #endif /* CONFIG_64BIT */ - -+ /* -+ * Pause/unpause graph tracing around do_suspend_lowlevel as it has -+ * inconsistent call/return info after it jumps to the wakeup vector. -+ */ -+ pause_graph_tracing(); - do_suspend_lowlevel(); -+ unpause_graph_tracing(); - return 0; - } - -diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c -index 04e7db668362..f3f0801a0e81 100644 ---- a/drivers/ata/libata-scsi.c -+++ b/drivers/ata/libata-scsi.c -@@ -673,19 +673,18 @@ static int ata_ioc32(struct ata_port *ap) - int ata_sas_scsi_ioctl(struct ata_port *ap, struct scsi_device *scsidev, - int cmd, void __user *arg) - { -- int val = -EINVAL, rc = -EINVAL; -+ unsigned long val; -+ int rc = -EINVAL; - unsigned long flags; - - switch (cmd) { -- case ATA_IOC_GET_IO32: -+ case HDIO_GET_32BIT: - spin_lock_irqsave(ap->lock, flags); - val = ata_ioc32(ap); - spin_unlock_irqrestore(ap->lock, flags); -- if (copy_to_user(arg, &val, 1)) -- return -EFAULT; -- return 0; -+ return put_user(val, (unsigned long __user *)arg); - -- case ATA_IOC_SET_IO32: -+ case HDIO_SET_32BIT: - val = (unsigned long) arg; - rc = 0; - spin_lock_irqsave(ap->lock, flags); -diff --git a/drivers/edac/edac_mc_sysfs.c b/drivers/edac/edac_mc_sysfs.c -index 88cd940ece63..453c816b4537 100644 ---- a/drivers/edac/edac_mc_sysfs.c -+++ b/drivers/edac/edac_mc_sysfs.c -@@ -973,21 +973,26 @@ nomem: - */ - int edac_create_sysfs_mci_device(struct mem_ctl_info *mci) - { -+ char *name; - int i, err; - - /* - * The memory controller needs its own bus, in order to avoid - * namespace conflicts at /sys/bus/edac. - */ -- mci->bus->name = kasprintf(GFP_KERNEL, "mc%d", mci->mc_idx); -- if (!mci->bus->name) -+ name = kasprintf(GFP_KERNEL, "mc%d", mci->mc_idx); -+ if (!name) - return -ENOMEM; - -+ mci->bus->name = name; -+ - edac_dbg(0, "creating bus %s\n", mci->bus->name); - - err = bus_register(mci->bus); -- if (err < 0) -+ if (err < 0) { -+ kfree(name); - return err; -+ } - - /* get the /sys/devices/system/edac subsys reference */ - mci->dev.type = &mci_attr_type; -@@ -1071,7 +1076,8 @@ fail: - fail2: - device_unregister(&mci->dev); - bus_unregister(mci->bus); -- kfree(mci->bus->name); -+ kfree(name); -+ - return err; - } - -@@ -1102,10 +1108,12 @@ void edac_remove_sysfs_mci_device(struct mem_ctl_info *mci) - - void edac_unregister_sysfs(struct mem_ctl_info *mci) - { -+ const char *name = mci->bus->name; -+ - edac_dbg(1, "Unregistering device %s\n", dev_name(&mci->dev)); - device_unregister(&mci->dev); - bus_unregister(mci->bus); -- kfree(mci->bus->name); -+ kfree(name); - } - - static void mc_attr_release(struct device *dev) -diff --git a/drivers/gpu/drm/ast/ast_main.c b/drivers/gpu/drm/ast/ast_main.c -index 313ccaf25f49..62834322b337 100644 ---- a/drivers/gpu/drm/ast/ast_main.c -+++ b/drivers/gpu/drm/ast/ast_main.c -@@ -124,7 +124,7 @@ static int ast_get_dram_info(struct drm_device *dev) - } while (ast_read32(ast, 0x10000) != 0x01); - data = ast_read32(ast, 0x10004); - -- if (data & 0x400) -+ if (data & 0x40) - ast->dram_bus_width = 16; - else - ast->dram_bus_width = 32; -diff --git a/drivers/gpu/drm/radeon/radeon_sa.c b/drivers/gpu/drm/radeon/radeon_sa.c -index bb166849aa6e..f0bac68254b7 100644 ---- a/drivers/gpu/drm/radeon/radeon_sa.c -+++ b/drivers/gpu/drm/radeon/radeon_sa.c -@@ -349,13 +349,8 @@ int radeon_sa_bo_new(struct radeon_device *rdev, - /* see if we can skip over some allocations */ - } while (radeon_sa_bo_next_hole(sa_manager, fences, tries)); - -- for (i = 0; i < RADEON_NUM_RINGS; ++i) -- radeon_fence_ref(fences[i]); -- - spin_unlock(&sa_manager->wq.lock); - r = radeon_fence_wait_any(rdev, fences, false); -- for (i = 0; i < RADEON_NUM_RINGS; ++i) -- radeon_fence_unref(&fences[i]); - spin_lock(&sa_manager->wq.lock); - /* if we have nothing to wait for block */ - if (r == -ENOENT && block) { -diff --git a/drivers/mtd/ubi/upd.c b/drivers/mtd/ubi/upd.c -index 2a1b6e037e1a..0134ba32a057 100644 ---- a/drivers/mtd/ubi/upd.c -+++ b/drivers/mtd/ubi/upd.c -@@ -193,7 +193,7 @@ int ubi_start_leb_change(struct ubi_device *ubi, struct ubi_volume *vol, - vol->changing_leb = 1; - vol->ch_lnum = req->lnum; - -- vol->upd_buf = vmalloc(req->bytes); -+ vol->upd_buf = vmalloc(ALIGN((int)req->bytes, ubi->min_io_size)); - if (!vol->upd_buf) - return -ENOMEM; - -diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c -index 303f3b3fb65f..84b770461655 100644 ---- a/drivers/usb/serial/cp210x.c -+++ b/drivers/usb/serial/cp210x.c -@@ -164,6 +164,7 @@ static const struct usb_device_id id_table[] = { - { USB_DEVICE(0x18EF, 0xE025) }, /* ELV Marble Sound Board 1 */ - { USB_DEVICE(0x1901, 0x0190) }, /* GE B850 CP2105 Recorder interface */ - { USB_DEVICE(0x1901, 0x0193) }, /* GE B650 CP2104 PMC interface */ -+ { USB_DEVICE(0x19CF, 0x3000) }, /* Parrot NMEA GPS Flight Recorder */ - { USB_DEVICE(0x1ADB, 0x0001) }, /* Schweitzer Engineering C662 Cable */ - { USB_DEVICE(0x1B1C, 0x1C00) }, /* Corsair USB Dongle */ - { USB_DEVICE(0x1BA4, 0x0002) }, /* Silicon Labs 358x factory default */ -diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c -index 9bab34cf01d4..24366a2afea6 100644 ---- a/drivers/usb/serial/option.c -+++ b/drivers/usb/serial/option.c -@@ -271,6 +271,7 @@ static void option_instat_callback(struct urb *urb); - #define TELIT_PRODUCT_UE910_V2 0x1012 - #define TELIT_PRODUCT_LE922_USBCFG0 0x1042 - #define TELIT_PRODUCT_LE922_USBCFG3 0x1043 -+#define TELIT_PRODUCT_LE922_USBCFG5 0x1045 - #define TELIT_PRODUCT_LE920 0x1200 - #define TELIT_PRODUCT_LE910 0x1201 - -@@ -1140,6 +1141,8 @@ static const struct usb_device_id option_ids[] = { - { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6613)}, /* Onda H600/ZTE MF330 */ - { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x0023)}, /* ONYX 3G device */ - { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9000)}, /* SIMCom SIM5218 */ -+ { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9003), /* Quectel UC20 */ -+ .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, - { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6001) }, - { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CMU_300) }, - { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6003), -@@ -1191,6 +1194,8 @@ static const struct usb_device_id option_ids[] = { - .driver_info = (kernel_ulong_t)&telit_le922_blacklist_usbcfg0 }, - { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE922_USBCFG3), - .driver_info = (kernel_ulong_t)&telit_le922_blacklist_usbcfg3 }, -+ { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, TELIT_PRODUCT_LE922_USBCFG5, 0xff), -+ .driver_info = (kernel_ulong_t)&telit_le922_blacklist_usbcfg0 }, - { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910), - .driver_info = (kernel_ulong_t)&telit_le910_blacklist }, - { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920), -diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c -index d17c5d72cd29..4c86850bd627 100644 ---- a/fs/cifs/cifssmb.c -+++ b/fs/cifs/cifssmb.c -@@ -1389,11 +1389,10 @@ openRetry: - * current bigbuf. - */ - static int --cifs_readv_discard(struct TCP_Server_Info *server, struct mid_q_entry *mid) -+discard_remaining_data(struct TCP_Server_Info *server) - { - unsigned int rfclen = get_rfc1002_length(server->smallbuf); - int remaining = rfclen + 4 - server->total_read; -- struct cifs_readdata *rdata = mid->callback_data; - - while (remaining > 0) { - int length; -@@ -1407,10 +1406,20 @@ cifs_readv_discard(struct TCP_Server_Info *server, struct mid_q_entry *mid) - remaining -= length; - } - -- dequeue_mid(mid, rdata->result); - return 0; - } - -+static int -+cifs_readv_discard(struct TCP_Server_Info *server, struct mid_q_entry *mid) -+{ -+ int length; -+ struct cifs_readdata *rdata = mid->callback_data; -+ -+ length = discard_remaining_data(server); -+ dequeue_mid(mid, rdata->result); -+ return length; -+} -+ - int - cifs_readv_receive(struct TCP_Server_Info *server, struct mid_q_entry *mid) - { -@@ -1439,6 +1448,12 @@ cifs_readv_receive(struct TCP_Server_Info *server, struct mid_q_entry *mid) - return length; - server->total_read += length; - -+ if (server->ops->is_status_pending && -+ server->ops->is_status_pending(buf, server, 0)) { -+ discard_remaining_data(server); -+ return -1; -+ } -+ - /* Was the SMB read successful? */ - rdata->result = server->ops->map_error(buf, false); - if (rdata->result != 0) { -diff --git a/fs/jffs2/README.Locking b/fs/jffs2/README.Locking -index 3ea36554107f..8918ac905a3b 100644 ---- a/fs/jffs2/README.Locking -+++ b/fs/jffs2/README.Locking -@@ -2,10 +2,6 @@ - JFFS2 LOCKING DOCUMENTATION - --------------------------- - --At least theoretically, JFFS2 does not require the Big Kernel Lock --(BKL), which was always helpfully obtained for it by Linux 2.4 VFS --code. It has its own locking, as described below. -- - This document attempts to describe the existing locking rules for - JFFS2. It is not expected to remain perfectly up to date, but ought to - be fairly close. -@@ -69,6 +65,7 @@ Ordering constraints: - any f->sem held. - 2. Never attempt to lock two file mutexes in one thread. - No ordering rules have been made for doing so. -+ 3. Never lock a page cache page with f->sem held. - - - erase_completion_lock spinlock -diff --git a/fs/jffs2/build.c b/fs/jffs2/build.c -index a3750f902adc..c1f04947d7dc 100644 ---- a/fs/jffs2/build.c -+++ b/fs/jffs2/build.c -@@ -49,7 +49,8 @@ next_inode(int *i, struct jffs2_inode_cache *ic, struct jffs2_sb_info *c) - - - static void jffs2_build_inode_pass1(struct jffs2_sb_info *c, -- struct jffs2_inode_cache *ic) -+ struct jffs2_inode_cache *ic, -+ int *dir_hardlinks) - { - struct jffs2_full_dirent *fd; - -@@ -68,19 +69,21 @@ static void jffs2_build_inode_pass1(struct jffs2_sb_info *c, - dbg_fsbuild("child \"%s\" (ino #%u) of dir ino #%u doesn't exist!\n", - fd->name, fd->ino, ic->ino); - jffs2_mark_node_obsolete(c, fd->raw); -+ /* Clear the ic/raw union so it doesn't cause problems later. */ -+ fd->ic = NULL; - continue; - } - -+ /* From this point, fd->raw is no longer used so we can set fd->ic */ -+ fd->ic = child_ic; -+ child_ic->pino_nlink++; -+ /* If we appear (at this stage) to have hard-linked directories, -+ * set a flag to trigger a scan later */ - if (fd->type == DT_DIR) { -- if (child_ic->pino_nlink) { -- JFFS2_ERROR("child dir \"%s\" (ino #%u) of dir ino #%u appears to be a hard link\n", -- fd->name, fd->ino, ic->ino); -- /* TODO: What do we do about it? */ -- } else { -- child_ic->pino_nlink = ic->ino; -- } -- } else -- child_ic->pino_nlink++; -+ child_ic->flags |= INO_FLAGS_IS_DIR; -+ if (child_ic->pino_nlink > 1) -+ *dir_hardlinks = 1; -+ } - - dbg_fsbuild("increased nlink for child \"%s\" (ino #%u)\n", fd->name, fd->ino); - /* Can't free scan_dents so far. We might need them in pass 2 */ -@@ -94,8 +97,7 @@ static void jffs2_build_inode_pass1(struct jffs2_sb_info *c, - */ - static int jffs2_build_filesystem(struct jffs2_sb_info *c) - { -- int ret; -- int i; -+ int ret, i, dir_hardlinks = 0; - struct jffs2_inode_cache *ic; - struct jffs2_full_dirent *fd; - struct jffs2_full_dirent *dead_fds = NULL; -@@ -119,7 +121,7 @@ static int jffs2_build_filesystem(struct jffs2_sb_info *c) - /* Now scan the directory tree, increasing nlink according to every dirent found. */ - for_each_inode(i, c, ic) { - if (ic->scan_dents) { -- jffs2_build_inode_pass1(c, ic); -+ jffs2_build_inode_pass1(c, ic, &dir_hardlinks); - cond_resched(); - } - } -@@ -155,6 +157,20 @@ static int jffs2_build_filesystem(struct jffs2_sb_info *c) - } - - dbg_fsbuild("pass 2a complete\n"); -+ -+ if (dir_hardlinks) { -+ /* If we detected directory hardlinks earlier, *hopefully* -+ * they are gone now because some of the links were from -+ * dead directories which still had some old dirents lying -+ * around and not yet garbage-collected, but which have -+ * been discarded above. So clear the pino_nlink field -+ * in each directory, so that the final scan below can -+ * print appropriate warnings. */ -+ for_each_inode(i, c, ic) { -+ if (ic->flags & INO_FLAGS_IS_DIR) -+ ic->pino_nlink = 0; -+ } -+ } - dbg_fsbuild("freeing temporary data structures\n"); - - /* Finally, we can scan again and free the dirent structs */ -@@ -162,6 +178,33 @@ static int jffs2_build_filesystem(struct jffs2_sb_info *c) - while(ic->scan_dents) { - fd = ic->scan_dents; - ic->scan_dents = fd->next; -+ /* We do use the pino_nlink field to count nlink of -+ * directories during fs build, so set it to the -+ * parent ino# now. Now that there's hopefully only -+ * one. */ -+ if (fd->type == DT_DIR) { -+ if (!fd->ic) { -+ /* We'll have complained about it and marked the coresponding -+ raw node obsolete already. Just skip it. */ -+ continue; -+ } -+ -+ /* We *have* to have set this in jffs2_build_inode_pass1() */ -+ BUG_ON(!(fd->ic->flags & INO_FLAGS_IS_DIR)); -+ -+ /* We clear ic->pino_nlink ∀ directories' ic *only* if dir_hardlinks -+ * is set. Otherwise, we know this should never trigger anyway, so -+ * we don't do the check. And ic->pino_nlink still contains the nlink -+ * value (which is 1). */ -+ if (dir_hardlinks && fd->ic->pino_nlink) { -+ JFFS2_ERROR("child dir \"%s\" (ino #%u) of dir ino #%u is also hard linked from dir ino #%u\n", -+ fd->name, fd->ino, ic->ino, fd->ic->pino_nlink); -+ /* Should we unlink it from its previous parent? */ -+ } -+ -+ /* For directories, ic->pino_nlink holds that parent inode # */ -+ fd->ic->pino_nlink = ic->ino; -+ } - jffs2_free_full_dirent(fd); - } - ic->scan_dents = NULL; -@@ -240,11 +283,7 @@ static void jffs2_build_remove_unlinked_inode(struct jffs2_sb_info *c, - - /* Reduce nlink of the child. If it's now zero, stick it on the - dead_fds list to be cleaned up later. Else just free the fd */ -- -- if (fd->type == DT_DIR) -- child_ic->pino_nlink = 0; -- else -- child_ic->pino_nlink--; -+ child_ic->pino_nlink--; - - if (!child_ic->pino_nlink) { - dbg_fsbuild("inode #%u (\"%s\") now has no links; adding to dead_fds list.\n", -diff --git a/fs/jffs2/file.c b/fs/jffs2/file.c -index 1506673c087e..60ef3fb707ff 100644 ---- a/fs/jffs2/file.c -+++ b/fs/jffs2/file.c -@@ -138,39 +138,33 @@ static int jffs2_write_begin(struct file *filp, struct address_space *mapping, - struct page *pg; - struct inode *inode = mapping->host; - struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode); -- struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb); -- struct jffs2_raw_inode ri; -- uint32_t alloc_len = 0; - pgoff_t index = pos >> PAGE_CACHE_SHIFT; - uint32_t pageofs = index << PAGE_CACHE_SHIFT; - int ret = 0; - -- jffs2_dbg(1, "%s()\n", __func__); -- -- if (pageofs > inode->i_size) { -- ret = jffs2_reserve_space(c, sizeof(ri), &alloc_len, -- ALLOC_NORMAL, JFFS2_SUMMARY_INODE_SIZE); -- if (ret) -- return ret; -- } -- -- mutex_lock(&f->sem); - pg = grab_cache_page_write_begin(mapping, index, flags); -- if (!pg) { -- if (alloc_len) -- jffs2_complete_reservation(c); -- mutex_unlock(&f->sem); -+ if (!pg) - return -ENOMEM; -- } - *pagep = pg; - -- if (alloc_len) { -+ jffs2_dbg(1, "%s()\n", __func__); -+ -+ if (pageofs > inode->i_size) { - /* Make new hole frag from old EOF to new page */ -+ struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb); -+ struct jffs2_raw_inode ri; - struct jffs2_full_dnode *fn; -+ uint32_t alloc_len; - - jffs2_dbg(1, "Writing new hole frag 0x%x-0x%x between current EOF and new page\n", - (unsigned int)inode->i_size, pageofs); - -+ ret = jffs2_reserve_space(c, sizeof(ri), &alloc_len, -+ ALLOC_NORMAL, JFFS2_SUMMARY_INODE_SIZE); -+ if (ret) -+ goto out_page; -+ -+ mutex_lock(&f->sem); - memset(&ri, 0, sizeof(ri)); - - ri.magic = cpu_to_je16(JFFS2_MAGIC_BITMASK); -@@ -197,6 +191,7 @@ static int jffs2_write_begin(struct file *filp, struct address_space *mapping, - if (IS_ERR(fn)) { - ret = PTR_ERR(fn); - jffs2_complete_reservation(c); -+ mutex_unlock(&f->sem); - goto out_page; - } - ret = jffs2_add_full_dnode_to_inode(c, f, fn); -@@ -211,10 +206,12 @@ static int jffs2_write_begin(struct file *filp, struct address_space *mapping, - jffs2_mark_node_obsolete(c, fn->raw); - jffs2_free_full_dnode(fn); - jffs2_complete_reservation(c); -+ mutex_unlock(&f->sem); - goto out_page; - } - jffs2_complete_reservation(c); - inode->i_size = pageofs; -+ mutex_unlock(&f->sem); - } - - /* -@@ -223,18 +220,18 @@ static int jffs2_write_begin(struct file *filp, struct address_space *mapping, - * case of a short-copy. - */ - if (!PageUptodate(pg)) { -+ mutex_lock(&f->sem); - ret = jffs2_do_readpage_nolock(inode, pg); -+ mutex_unlock(&f->sem); - if (ret) - goto out_page; - } -- mutex_unlock(&f->sem); - jffs2_dbg(1, "end write_begin(). pg->flags %lx\n", pg->flags); - return ret; - - out_page: - unlock_page(pg); - page_cache_release(pg); -- mutex_unlock(&f->sem); - return ret; - } - -diff --git a/fs/jffs2/gc.c b/fs/jffs2/gc.c -index 5a2dec2b064c..95d5880a63ee 100644 ---- a/fs/jffs2/gc.c -+++ b/fs/jffs2/gc.c -@@ -1296,14 +1296,17 @@ static int jffs2_garbage_collect_dnode(struct jffs2_sb_info *c, struct jffs2_era - BUG_ON(start > orig_start); - } - -- /* First, use readpage() to read the appropriate page into the page cache */ -- /* Q: What happens if we actually try to GC the _same_ page for which commit_write() -- * triggered garbage collection in the first place? -- * A: I _think_ it's OK. read_cache_page shouldn't deadlock, we'll write out the -- * page OK. We'll actually write it out again in commit_write, which is a little -- * suboptimal, but at least we're correct. -- */ -+ /* The rules state that we must obtain the page lock *before* f->sem, so -+ * drop f->sem temporarily. Since we also hold c->alloc_sem, nothing's -+ * actually going to *change* so we're safe; we only allow reading. -+ * -+ * It is important to note that jffs2_write_begin() will ensure that its -+ * page is marked Uptodate before allocating space. That means that if we -+ * end up here trying to GC the *same* page that jffs2_write_begin() is -+ * trying to write out, read_cache_page() will not deadlock. */ -+ mutex_unlock(&f->sem); - pg_ptr = jffs2_gc_fetch_page(c, f, start, &pg); -+ mutex_lock(&f->sem); - - if (IS_ERR(pg_ptr)) { - pr_warn("read_cache_page() returned error: %ld\n", -diff --git a/fs/jffs2/nodelist.h b/fs/jffs2/nodelist.h -index fa35ff79ab35..0637271f3770 100644 ---- a/fs/jffs2/nodelist.h -+++ b/fs/jffs2/nodelist.h -@@ -194,6 +194,7 @@ struct jffs2_inode_cache { - #define INO_STATE_CLEARING 6 /* In clear_inode() */ - - #define INO_FLAGS_XATTR_CHECKED 0x01 /* has no duplicate xattr_ref */ -+#define INO_FLAGS_IS_DIR 0x02 /* is a directory */ - - #define RAWNODE_CLASS_INODE_CACHE 0 - #define RAWNODE_CLASS_XATTR_DATUM 1 -@@ -249,7 +250,10 @@ struct jffs2_readinode_info - - struct jffs2_full_dirent - { -- struct jffs2_raw_node_ref *raw; -+ union { -+ struct jffs2_raw_node_ref *raw; -+ struct jffs2_inode_cache *ic; /* Just during part of build */ -+ }; - struct jffs2_full_dirent *next; - uint32_t version; - uint32_t ino; /* == zero for unlink */ -diff --git a/fs/locks.c b/fs/locks.c -index 0274c953b07d..f7b1de7e6735 100644 ---- a/fs/locks.c -+++ b/fs/locks.c -@@ -1852,7 +1852,6 @@ int fcntl_setlk(unsigned int fd, struct file *filp, unsigned int cmd, - goto out; - } - --again: - error = flock_to_posix_lock(filp, file_lock, &flock); - if (error) - goto out; -@@ -1883,19 +1882,22 @@ again: - * Attempt to detect a close/fcntl race and recover by - * releasing the lock that was just acquired. - */ -- /* -- * we need that spin_lock here - it prevents reordering between -- * update of inode->i_flock and check for it done in close(). -- * rcu_read_lock() wouldn't do. -- */ -- spin_lock(¤t->files->file_lock); -- f = fcheck(fd); -- spin_unlock(¤t->files->file_lock); -- if (!error && f != filp && flock.l_type != F_UNLCK) { -- flock.l_type = F_UNLCK; -- goto again; -+ if (!error && file_lock->fl_type != F_UNLCK) { -+ /* -+ * We need that spin_lock here - it prevents reordering between -+ * update of inode->i_flock and check for it done in -+ * close(). rcu_read_lock() wouldn't do. -+ */ -+ spin_lock(¤t->files->file_lock); -+ f = fcheck(fd); -+ spin_unlock(¤t->files->file_lock); -+ if (f != filp) { -+ file_lock->fl_type = F_UNLCK; -+ error = do_lock_file_wait(filp, cmd, file_lock); -+ WARN_ON_ONCE(error); -+ error = -EBADF; -+ } - } -- - out: - locks_free_lock(file_lock); - return error; -@@ -1970,7 +1972,6 @@ int fcntl_setlk64(unsigned int fd, struct file *filp, unsigned int cmd, - goto out; - } - --again: - error = flock64_to_posix_lock(filp, file_lock, &flock); - if (error) - goto out; -@@ -2001,14 +2002,22 @@ again: - * Attempt to detect a close/fcntl race and recover by - * releasing the lock that was just acquired. - */ -- spin_lock(¤t->files->file_lock); -- f = fcheck(fd); -- spin_unlock(¤t->files->file_lock); -- if (!error && f != filp && flock.l_type != F_UNLCK) { -- flock.l_type = F_UNLCK; -- goto again; -+ if (!error && file_lock->fl_type != F_UNLCK) { -+ /* -+ * We need that spin_lock here - it prevents reordering between -+ * update of inode->i_flock and check for it done in -+ * close(). rcu_read_lock() wouldn't do. -+ */ -+ spin_lock(¤t->files->file_lock); -+ f = fcheck(fd); -+ spin_unlock(¤t->files->file_lock); -+ if (f != filp) { -+ file_lock->fl_type = F_UNLCK; -+ error = do_lock_file_wait(filp, cmd, file_lock); -+ WARN_ON_ONCE(error); -+ error = -EBADF; -+ } - } -- - out: - locks_free_lock(file_lock); - return error; -diff --git a/include/linux/ata.h b/include/linux/ata.h -index ee0bd9524055..f60ffe29b3a1 100644 ---- a/include/linux/ata.h -+++ b/include/linux/ata.h -@@ -477,8 +477,8 @@ enum ata_tf_protocols { - }; - - enum ata_ioctls { -- ATA_IOC_GET_IO32 = 0x309, -- ATA_IOC_SET_IO32 = 0x324, -+ ATA_IOC_GET_IO32 = 0x309, /* HDIO_GET_32BIT */ -+ ATA_IOC_SET_IO32 = 0x324, /* HDIO_SET_32BIT */ - }; - - /* core structures */ -diff --git a/include/linux/libata.h b/include/linux/libata.h -index 8ad0771b88ab..8017e5c459cf 100644 ---- a/include/linux/libata.h -+++ b/include/linux/libata.h -@@ -666,7 +666,7 @@ struct ata_device { - union { - u16 id[ATA_ID_WORDS]; /* IDENTIFY xxx DEVICE data */ - u32 gscr[SATA_PMP_GSCR_DWORDS]; /* PMP GSCR block */ -- }; -+ } ____cacheline_aligned; - - /* DEVSLP Timing Variables from Identify Device Data Log */ - u8 devslp_timing[ATA_LOG_DEVSLP_SIZE]; -diff --git a/sound/core/control_compat.c b/sound/core/control_compat.c -index 2bb95a7a8809..c14565bde887 100644 ---- a/sound/core/control_compat.c -+++ b/sound/core/control_compat.c -@@ -170,6 +170,19 @@ struct snd_ctl_elem_value32 { - unsigned char reserved[128]; - }; - -+#ifdef CONFIG_X86_X32 -+/* x32 has a different alignment for 64bit values from ia32 */ -+struct snd_ctl_elem_value_x32 { -+ struct snd_ctl_elem_id id; -+ unsigned int indirect; /* bit-field causes misalignment */ -+ union { -+ s32 integer[128]; -+ unsigned char data[512]; -+ s64 integer64[64]; -+ } value; -+ unsigned char reserved[128]; -+}; -+#endif /* CONFIG_X86_X32 */ - - /* get the value type and count of the control */ - static int get_ctl_type(struct snd_card *card, struct snd_ctl_elem_id *id, -@@ -219,9 +232,11 @@ static int get_elem_size(int type, int count) - - static int copy_ctl_value_from_user(struct snd_card *card, - struct snd_ctl_elem_value *data, -- struct snd_ctl_elem_value32 __user *data32, -+ void __user *userdata, -+ void __user *valuep, - int *typep, int *countp) - { -+ struct snd_ctl_elem_value32 __user *data32 = userdata; - int i, type, size; - int uninitialized_var(count); - unsigned int indirect; -@@ -239,8 +254,9 @@ static int copy_ctl_value_from_user(struct snd_card *card, - if (type == SNDRV_CTL_ELEM_TYPE_BOOLEAN || - type == SNDRV_CTL_ELEM_TYPE_INTEGER) { - for (i = 0; i < count; i++) { -+ s32 __user *intp = valuep; - int val; -- if (get_user(val, &data32->value.integer[i])) -+ if (get_user(val, &intp[i])) - return -EFAULT; - data->value.integer.value[i] = val; - } -@@ -250,8 +266,7 @@ static int copy_ctl_value_from_user(struct snd_card *card, - printk(KERN_ERR "snd_ioctl32_ctl_elem_value: unknown type %d\n", type); - return -EINVAL; - } -- if (copy_from_user(data->value.bytes.data, -- data32->value.data, size)) -+ if (copy_from_user(data->value.bytes.data, valuep, size)) - return -EFAULT; - } - -@@ -261,7 +276,8 @@ static int copy_ctl_value_from_user(struct snd_card *card, - } - - /* restore the value to 32bit */ --static int copy_ctl_value_to_user(struct snd_ctl_elem_value32 __user *data32, -+static int copy_ctl_value_to_user(void __user *userdata, -+ void __user *valuep, - struct snd_ctl_elem_value *data, - int type, int count) - { -@@ -270,22 +286,22 @@ static int copy_ctl_value_to_user(struct snd_ctl_elem_value32 __user *data32, - if (type == SNDRV_CTL_ELEM_TYPE_BOOLEAN || - type == SNDRV_CTL_ELEM_TYPE_INTEGER) { - for (i = 0; i < count; i++) { -+ s32 __user *intp = valuep; - int val; - val = data->value.integer.value[i]; -- if (put_user(val, &data32->value.integer[i])) -+ if (put_user(val, &intp[i])) - return -EFAULT; - } - } else { - size = get_elem_size(type, count); -- if (copy_to_user(data32->value.data, -- data->value.bytes.data, size)) -+ if (copy_to_user(valuep, data->value.bytes.data, size)) - return -EFAULT; - } - return 0; - } - --static int snd_ctl_elem_read_user_compat(struct snd_card *card, -- struct snd_ctl_elem_value32 __user *data32) -+static int ctl_elem_read_user(struct snd_card *card, -+ void __user *userdata, void __user *valuep) - { - struct snd_ctl_elem_value *data; - int err, type, count; -@@ -294,7 +310,9 @@ static int snd_ctl_elem_read_user_compat(struct snd_card *card, - if (data == NULL) - return -ENOMEM; - -- if ((err = copy_ctl_value_from_user(card, data, data32, &type, &count)) < 0) -+ err = copy_ctl_value_from_user(card, data, userdata, valuep, -+ &type, &count); -+ if (err < 0) - goto error; - - snd_power_lock(card); -@@ -303,14 +321,15 @@ static int snd_ctl_elem_read_user_compat(struct snd_card *card, - err = snd_ctl_elem_read(card, data); - snd_power_unlock(card); - if (err >= 0) -- err = copy_ctl_value_to_user(data32, data, type, count); -+ err = copy_ctl_value_to_user(userdata, valuep, data, -+ type, count); - error: - kfree(data); - return err; - } - --static int snd_ctl_elem_write_user_compat(struct snd_ctl_file *file, -- struct snd_ctl_elem_value32 __user *data32) -+static int ctl_elem_write_user(struct snd_ctl_file *file, -+ void __user *userdata, void __user *valuep) - { - struct snd_ctl_elem_value *data; - struct snd_card *card = file->card; -@@ -320,7 +339,9 @@ static int snd_ctl_elem_write_user_compat(struct snd_ctl_file *file, - if (data == NULL) - return -ENOMEM; - -- if ((err = copy_ctl_value_from_user(card, data, data32, &type, &count)) < 0) -+ err = copy_ctl_value_from_user(card, data, userdata, valuep, -+ &type, &count); -+ if (err < 0) - goto error; - - snd_power_lock(card); -@@ -329,12 +350,39 @@ static int snd_ctl_elem_write_user_compat(struct snd_ctl_file *file, - err = snd_ctl_elem_write(card, file, data); - snd_power_unlock(card); - if (err >= 0) -- err = copy_ctl_value_to_user(data32, data, type, count); -+ err = copy_ctl_value_to_user(userdata, valuep, data, -+ type, count); - error: - kfree(data); - return err; - } - -+static int snd_ctl_elem_read_user_compat(struct snd_card *card, -+ struct snd_ctl_elem_value32 __user *data32) -+{ -+ return ctl_elem_read_user(card, data32, &data32->value); -+} -+ -+static int snd_ctl_elem_write_user_compat(struct snd_ctl_file *file, -+ struct snd_ctl_elem_value32 __user *data32) -+{ -+ return ctl_elem_write_user(file, data32, &data32->value); -+} -+ -+#ifdef CONFIG_X86_X32 -+static int snd_ctl_elem_read_user_x32(struct snd_card *card, -+ struct snd_ctl_elem_value_x32 __user *data32) -+{ -+ return ctl_elem_read_user(card, data32, &data32->value); -+} -+ -+static int snd_ctl_elem_write_user_x32(struct snd_ctl_file *file, -+ struct snd_ctl_elem_value_x32 __user *data32) -+{ -+ return ctl_elem_write_user(file, data32, &data32->value); -+} -+#endif /* CONFIG_X86_X32 */ -+ - /* add or replace a user control */ - static int snd_ctl_elem_add_compat(struct snd_ctl_file *file, - struct snd_ctl_elem_info32 __user *data32, -@@ -393,6 +441,10 @@ enum { - SNDRV_CTL_IOCTL_ELEM_WRITE32 = _IOWR('U', 0x13, struct snd_ctl_elem_value32), - SNDRV_CTL_IOCTL_ELEM_ADD32 = _IOWR('U', 0x17, struct snd_ctl_elem_info32), - SNDRV_CTL_IOCTL_ELEM_REPLACE32 = _IOWR('U', 0x18, struct snd_ctl_elem_info32), -+#ifdef CONFIG_X86_X32 -+ SNDRV_CTL_IOCTL_ELEM_READ_X32 = _IOWR('U', 0x12, struct snd_ctl_elem_value_x32), -+ SNDRV_CTL_IOCTL_ELEM_WRITE_X32 = _IOWR('U', 0x13, struct snd_ctl_elem_value_x32), -+#endif /* CONFIG_X86_X32 */ - }; - - static inline long snd_ctl_ioctl_compat(struct file *file, unsigned int cmd, unsigned long arg) -@@ -431,6 +483,12 @@ static inline long snd_ctl_ioctl_compat(struct file *file, unsigned int cmd, uns - return snd_ctl_elem_add_compat(ctl, argp, 0); - case SNDRV_CTL_IOCTL_ELEM_REPLACE32: - return snd_ctl_elem_add_compat(ctl, argp, 1); -+#ifdef CONFIG_X86_X32 -+ case SNDRV_CTL_IOCTL_ELEM_READ_X32: -+ return snd_ctl_elem_read_user_x32(ctl->card, argp); -+ case SNDRV_CTL_IOCTL_ELEM_WRITE_X32: -+ return snd_ctl_elem_write_user_x32(ctl, argp); -+#endif /* CONFIG_X86_X32 */ - } - - down_read(&snd_ioctl_rwsem); -diff --git a/sound/core/rawmidi_compat.c b/sound/core/rawmidi_compat.c -index 5268c1f58c25..09a89094dcf7 100644 ---- a/sound/core/rawmidi_compat.c -+++ b/sound/core/rawmidi_compat.c -@@ -94,9 +94,58 @@ static int snd_rawmidi_ioctl_status_compat(struct snd_rawmidi_file *rfile, - return 0; - } - -+#ifdef CONFIG_X86_X32 -+/* X32 ABI has 64bit timespec and 64bit alignment */ -+struct snd_rawmidi_status_x32 { -+ s32 stream; -+ u32 rsvd; /* alignment */ -+ struct timespec tstamp; -+ u32 avail; -+ u32 xruns; -+ unsigned char reserved[16]; -+} __attribute__((packed)); -+ -+#define put_timespec(src, dst) copy_to_user(dst, src, sizeof(*dst)) -+ -+static int snd_rawmidi_ioctl_status_x32(struct snd_rawmidi_file *rfile, -+ struct snd_rawmidi_status_x32 __user *src) -+{ -+ int err; -+ struct snd_rawmidi_status status; -+ -+ if (rfile->output == NULL) -+ return -EINVAL; -+ if (get_user(status.stream, &src->stream)) -+ return -EFAULT; -+ -+ switch (status.stream) { -+ case SNDRV_RAWMIDI_STREAM_OUTPUT: -+ err = snd_rawmidi_output_status(rfile->output, &status); -+ break; -+ case SNDRV_RAWMIDI_STREAM_INPUT: -+ err = snd_rawmidi_input_status(rfile->input, &status); -+ break; -+ default: -+ return -EINVAL; -+ } -+ if (err < 0) -+ return err; -+ -+ if (put_timespec(&status.tstamp, &src->tstamp) || -+ put_user(status.avail, &src->avail) || -+ put_user(status.xruns, &src->xruns)) -+ return -EFAULT; -+ -+ return 0; -+} -+#endif /* CONFIG_X86_X32 */ -+ - enum { - SNDRV_RAWMIDI_IOCTL_PARAMS32 = _IOWR('W', 0x10, struct snd_rawmidi_params32), - SNDRV_RAWMIDI_IOCTL_STATUS32 = _IOWR('W', 0x20, struct snd_rawmidi_status32), -+#ifdef CONFIG_X86_X32 -+ SNDRV_RAWMIDI_IOCTL_STATUS_X32 = _IOWR('W', 0x20, struct snd_rawmidi_status_x32), -+#endif /* CONFIG_X86_X32 */ - }; - - static long snd_rawmidi_ioctl_compat(struct file *file, unsigned int cmd, unsigned long arg) -@@ -115,6 +164,10 @@ static long snd_rawmidi_ioctl_compat(struct file *file, unsigned int cmd, unsign - return snd_rawmidi_ioctl_params_compat(rfile, argp); - case SNDRV_RAWMIDI_IOCTL_STATUS32: - return snd_rawmidi_ioctl_status_compat(rfile, argp); -+#ifdef CONFIG_X86_X32 -+ case SNDRV_RAWMIDI_IOCTL_STATUS_X32: -+ return snd_rawmidi_ioctl_status_x32(rfile, argp); -+#endif /* CONFIG_X86_X32 */ - } - return -ENOIOCTLCMD; - } -diff --git a/sound/core/seq/oss/seq_oss.c b/sound/core/seq/oss/seq_oss.c -index 8d4d5e853efe..ab774954c985 100644 ---- a/sound/core/seq/oss/seq_oss.c -+++ b/sound/core/seq/oss/seq_oss.c -@@ -150,8 +150,6 @@ odev_release(struct inode *inode, struct file *file) - if ((dp = file->private_data) == NULL) - return 0; - -- snd_seq_oss_drain_write(dp); -- - mutex_lock(®ister_mutex); - snd_seq_oss_release(dp); - mutex_unlock(®ister_mutex); -diff --git a/sound/core/seq/oss/seq_oss_device.h b/sound/core/seq/oss/seq_oss_device.h -index c0154a959d55..2464112b08ad 100644 ---- a/sound/core/seq/oss/seq_oss_device.h -+++ b/sound/core/seq/oss/seq_oss_device.h -@@ -131,7 +131,6 @@ int snd_seq_oss_write(struct seq_oss_devinfo *dp, const char __user *buf, int co - unsigned int snd_seq_oss_poll(struct seq_oss_devinfo *dp, struct file *file, poll_table * wait); - - void snd_seq_oss_reset(struct seq_oss_devinfo *dp); --void snd_seq_oss_drain_write(struct seq_oss_devinfo *dp); - - /* */ - void snd_seq_oss_process_queue(struct seq_oss_devinfo *dp, abstime_t time); -diff --git a/sound/core/seq/oss/seq_oss_init.c b/sound/core/seq/oss/seq_oss_init.c -index b3f39b5ed742..f9e09e458227 100644 ---- a/sound/core/seq/oss/seq_oss_init.c -+++ b/sound/core/seq/oss/seq_oss_init.c -@@ -457,23 +457,6 @@ snd_seq_oss_release(struct seq_oss_devinfo *dp) - - - /* -- * Wait until the queue is empty (if we don't have nonblock) -- */ --void --snd_seq_oss_drain_write(struct seq_oss_devinfo *dp) --{ -- if (! dp->timer->running) -- return; -- if (is_write_mode(dp->file_mode) && !is_nonblock_mode(dp->file_mode) && -- dp->writeq) { -- debug_printk(("syncing..\n")); -- while (snd_seq_oss_writeq_sync(dp->writeq)) -- ; -- } --} -- -- --/* - * reset sequencer devices - */ - void -diff --git a/sound/core/timer_compat.c b/sound/core/timer_compat.c -index e05802ae6e1b..2e908225d754 100644 ---- a/sound/core/timer_compat.c -+++ b/sound/core/timer_compat.c -@@ -70,13 +70,14 @@ static int snd_timer_user_status_compat(struct file *file, - struct snd_timer_status32 __user *_status) - { - struct snd_timer_user *tu; -- struct snd_timer_status status; -+ struct snd_timer_status32 status; - - tu = file->private_data; - if (snd_BUG_ON(!tu->timeri)) - return -ENXIO; - memset(&status, 0, sizeof(status)); -- status.tstamp = tu->tstamp; -+ status.tstamp.tv_sec = tu->tstamp.tv_sec; -+ status.tstamp.tv_nsec = tu->tstamp.tv_nsec; - status.resolution = snd_timer_resolution(tu->timeri); - status.lost = tu->timeri->lost; - status.overrun = tu->overrun; -@@ -88,12 +89,21 @@ static int snd_timer_user_status_compat(struct file *file, - return 0; - } - -+#ifdef CONFIG_X86_X32 -+/* X32 ABI has the same struct as x86-64 */ -+#define snd_timer_user_status_x32(file, s) \ -+ snd_timer_user_status(file, s) -+#endif /* CONFIG_X86_X32 */ -+ - /* - */ - - enum { - SNDRV_TIMER_IOCTL_INFO32 = _IOR('T', 0x11, struct snd_timer_info32), - SNDRV_TIMER_IOCTL_STATUS32 = _IOW('T', 0x14, struct snd_timer_status32), -+#ifdef CONFIG_X86_X32 -+ SNDRV_TIMER_IOCTL_STATUS_X32 = _IOW('T', 0x14, struct snd_timer_status), -+#endif /* CONFIG_X86_X32 */ - }; - - static long snd_timer_user_ioctl_compat(struct file *file, unsigned int cmd, unsigned long arg) -@@ -122,6 +132,10 @@ static long snd_timer_user_ioctl_compat(struct file *file, unsigned int cmd, uns - return snd_timer_user_info_compat(file, argp); - case SNDRV_TIMER_IOCTL_STATUS32: - return snd_timer_user_status_compat(file, argp); -+#ifdef CONFIG_X86_X32 -+ case SNDRV_TIMER_IOCTL_STATUS_X32: -+ return snd_timer_user_status_x32(file, argp); -+#endif /* CONFIG_X86_X32 */ - } - return -ENOIOCTLCMD; - } -diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c -index 94084cdb130c..9a281f45eb9c 100644 ---- a/sound/pci/rme9652/hdsp.c -+++ b/sound/pci/rme9652/hdsp.c -@@ -2923,7 +2923,7 @@ static int snd_hdsp_get_dds_offset(struct snd_kcontrol *kcontrol, struct snd_ctl - { - struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); - -- ucontrol->value.enumerated.item[0] = hdsp_dds_offset(hdsp); -+ ucontrol->value.integer.value[0] = hdsp_dds_offset(hdsp); - return 0; - } - -@@ -2935,7 +2935,7 @@ static int snd_hdsp_put_dds_offset(struct snd_kcontrol *kcontrol, struct snd_ctl - - if (!snd_hdsp_use_is_exclusive(hdsp)) - return -EBUSY; -- val = ucontrol->value.enumerated.item[0]; -+ val = ucontrol->value.integer.value[0]; - spin_lock_irq(&hdsp->lock); - if (val != hdsp_dds_offset(hdsp)) - change = (hdsp_set_dds_offset(hdsp, val) == 0) ? 1 : 0; -diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c -index dd910d249987..8444098d2a8e 100644 ---- a/sound/pci/rme9652/hdspm.c -+++ b/sound/pci/rme9652/hdspm.c -@@ -1423,6 +1423,9 @@ static void hdspm_set_dds_value(struct hdspm *hdspm, int rate) - { - u64 n; - -+ if (snd_BUG_ON(rate <= 0)) -+ return; -+ - if (rate >= 112000) - rate /= 4; - else if (rate >= 56000) -@@ -2045,6 +2048,8 @@ static int hdspm_get_system_sample_rate(struct hdspm *hdspm) - } else { - /* slave mode, return external sample rate */ - rate = hdspm_external_sample_rate(hdspm); -+ if (!rate) -+ rate = hdspm->system_sample_rate; - } - } - -@@ -2090,8 +2095,11 @@ static int snd_hdspm_put_system_sample_rate(struct snd_kcontrol *kcontrol, - ucontrol) - { - struct hdspm *hdspm = snd_kcontrol_chip(kcontrol); -+ int rate = ucontrol->value.integer.value[0]; - -- hdspm_set_dds_value(hdspm, ucontrol->value.enumerated.item[0]); -+ if (rate < 27000 || rate > 207000) -+ return -EINVAL; -+ hdspm_set_dds_value(hdspm, ucontrol->value.integer.value[0]); - return 0; - } - -@@ -4199,7 +4207,7 @@ static int snd_hdspm_get_tco_word_term(struct snd_kcontrol *kcontrol, - { - struct hdspm *hdspm = snd_kcontrol_chip(kcontrol); - -- ucontrol->value.enumerated.item[0] = hdspm->tco->term; -+ ucontrol->value.integer.value[0] = hdspm->tco->term; - - return 0; - } -@@ -4210,8 +4218,8 @@ static int snd_hdspm_put_tco_word_term(struct snd_kcontrol *kcontrol, - { - struct hdspm *hdspm = snd_kcontrol_chip(kcontrol); - -- if (hdspm->tco->term != ucontrol->value.enumerated.item[0]) { -- hdspm->tco->term = ucontrol->value.enumerated.item[0]; -+ if (hdspm->tco->term != ucontrol->value.integer.value[0]) { -+ hdspm->tco->term = ucontrol->value.integer.value[0]; - - hdspm_tco_write(hdspm); - diff --git a/patch/kernel/marvell-default/2-patch-3.10.100-101.patch b/patch/kernel/marvell-default/2-patch-3.10.100-101.patch deleted file mode 100644 index d9647df43e..0000000000 --- a/patch/kernel/marvell-default/2-patch-3.10.100-101.patch +++ /dev/null @@ -1,1493 +0,0 @@ -diff --git a/Documentation/filesystems/efivarfs.txt b/Documentation/filesystems/efivarfs.txt -index c477af086e65..686a64bba775 100644 ---- a/Documentation/filesystems/efivarfs.txt -+++ b/Documentation/filesystems/efivarfs.txt -@@ -14,3 +14,10 @@ filesystem. - efivarfs is typically mounted like this, - - mount -t efivarfs none /sys/firmware/efi/efivars -+ -+Due to the presence of numerous firmware bugs where removing non-standard -+UEFI variables causes the system firmware to fail to POST, efivarfs -+files that are not well-known standardized variables are created -+as immutable files. This doesn't prevent removal - "chattr -i" will work - -+but it does prevent this kind of failure from being accomplished -+accidentally. -diff --git a/Makefile b/Makefile -index 40d4d3bf52c3..4be9e643cef0 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,6 +1,6 @@ - VERSION = 3 - PATCHLEVEL = 10 --SUBLEVEL = 100 -+SUBLEVEL = 101 - EXTRAVERSION = - NAME = TOSSUG Baby Fish - -diff --git a/arch/powerpc/kernel/module_64.c b/arch/powerpc/kernel/module_64.c -index 6ee59a0eb268..48b4cf6b2a24 100644 ---- a/arch/powerpc/kernel/module_64.c -+++ b/arch/powerpc/kernel/module_64.c -@@ -192,7 +192,7 @@ static void dedotify(Elf64_Sym *syms, unsigned int numsyms, char *strtab) - if (syms[i].st_shndx == SHN_UNDEF) { - char *name = strtab + syms[i].st_name; - if (name[0] == '.') -- memmove(name, name+1, strlen(name)); -+ syms[i].st_name++; - } - } - } -diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c -index 04cc2fa7744f..335fe70967a8 100644 ---- a/arch/x86/kvm/vmx.c -+++ b/arch/x86/kvm/vmx.c -@@ -1487,6 +1487,13 @@ static void add_atomic_switch_msr(struct vcpu_vmx *vmx, unsigned msr, - return; - } - break; -+ case MSR_IA32_PEBS_ENABLE: -+ /* PEBS needs a quiescent period after being disabled (to write -+ * a record). Disabling PEBS through VMX MSR swapping doesn't -+ * provide that period, so a CPU could write host's record into -+ * guest's memory. -+ */ -+ wrmsrl(MSR_IA32_PEBS_ENABLE, 0); - } - - for (i = 0; i < m->nr; ++i) -diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c -index 41ba726c1ce2..7f2b6dec4b2b 100644 ---- a/arch/x86/kvm/x86.c -+++ b/arch/x86/kvm/x86.c -@@ -1941,6 +1941,8 @@ static void accumulate_steal_time(struct kvm_vcpu *vcpu) - - static void record_steal_time(struct kvm_vcpu *vcpu) - { -+ accumulate_steal_time(vcpu); -+ - if (!(vcpu->arch.st.msr_val & KVM_MSR_ENABLED)) - return; - -@@ -2074,12 +2076,6 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info) - if (!(data & KVM_MSR_ENABLED)) - break; - -- vcpu->arch.st.last_steal = current->sched_info.run_delay; -- -- preempt_disable(); -- accumulate_steal_time(vcpu); -- preempt_enable(); -- - kvm_make_request(KVM_REQ_STEAL_UPDATE, vcpu); - - break; -@@ -2758,7 +2754,6 @@ void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu) - vcpu->cpu = cpu; - } - -- accumulate_steal_time(vcpu); - kvm_make_request(KVM_REQ_STEAL_UPDATE, vcpu); - } - -diff --git a/crypto/af_alg.c b/crypto/af_alg.c -index 0ca108f3c840..1aaa555fab56 100644 ---- a/crypto/af_alg.c -+++ b/crypto/af_alg.c -@@ -125,23 +125,6 @@ int af_alg_release(struct socket *sock) - } - EXPORT_SYMBOL_GPL(af_alg_release); - --void af_alg_release_parent(struct sock *sk) --{ -- struct alg_sock *ask = alg_sk(sk); -- bool last; -- -- sk = ask->parent; -- ask = alg_sk(sk); -- -- lock_sock(sk); -- last = !--ask->refcnt; -- release_sock(sk); -- -- if (last) -- sock_put(sk); --} --EXPORT_SYMBOL_GPL(af_alg_release_parent); -- - static int alg_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) - { - struct sock *sk = sock->sk; -@@ -149,7 +132,6 @@ static int alg_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) - struct sockaddr_alg *sa = (void *)uaddr; - const struct af_alg_type *type; - void *private; -- int err; - - if (sock->state == SS_CONNECTED) - return -EINVAL; -@@ -175,22 +157,16 @@ static int alg_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) - return PTR_ERR(private); - } - -- err = -EBUSY; - lock_sock(sk); -- if (ask->refcnt) -- goto unlock; - - swap(ask->type, type); - swap(ask->private, private); - -- err = 0; -- --unlock: - release_sock(sk); - - alg_do_release(type, private); - -- return err; -+ return 0; - } - - static int alg_setkey(struct sock *sk, char __user *ukey, -@@ -223,15 +199,11 @@ static int alg_setsockopt(struct socket *sock, int level, int optname, - struct sock *sk = sock->sk; - struct alg_sock *ask = alg_sk(sk); - const struct af_alg_type *type; -- int err = -EBUSY; -+ int err = -ENOPROTOOPT; - - lock_sock(sk); -- if (ask->refcnt) -- goto unlock; -- - type = ask->type; - -- err = -ENOPROTOOPT; - if (level != SOL_ALG || !type) - goto unlock; - -@@ -280,8 +252,7 @@ int af_alg_accept(struct sock *sk, struct socket *newsock) - - sk2->sk_family = PF_ALG; - -- if (!ask->refcnt++) -- sock_hold(sk); -+ sock_hold(sk); - alg_sk(sk2)->parent = sk; - alg_sk(sk2)->type = type; - -diff --git a/drivers/firmware/efi/efivars.c b/drivers/firmware/efi/efivars.c -index 8bd1bb6dbe47..24ae2a694e9b 100644 ---- a/drivers/firmware/efi/efivars.c -+++ b/drivers/firmware/efi/efivars.c -@@ -219,7 +219,8 @@ efivar_store_raw(struct efivar_entry *entry, const char *buf, size_t count) - } - - if ((new_var->Attributes & ~EFI_VARIABLE_MASK) != 0 || -- efivar_validate(new_var, new_var->Data, new_var->DataSize) == false) { -+ efivar_validate(new_var->VendorGuid, new_var->VariableName, -+ new_var->Data, new_var->DataSize) == false) { - printk(KERN_ERR "efivars: Malformed variable content\n"); - return -EINVAL; - } -@@ -334,7 +335,8 @@ static ssize_t efivar_create(struct file *filp, struct kobject *kobj, - return -EACCES; - - if ((new_var->Attributes & ~EFI_VARIABLE_MASK) != 0 || -- efivar_validate(new_var, new_var->Data, new_var->DataSize) == false) { -+ efivar_validate(new_var->VendorGuid, new_var->VariableName, -+ new_var->Data, new_var->DataSize) == false) { - printk(KERN_ERR "efivars: Malformed variable content\n"); - return -EINVAL; - } -@@ -405,35 +407,27 @@ efivar_create_sysfs_entry(struct efivar_entry *new_var) - { - int i, short_name_size; - char *short_name; -- unsigned long variable_name_size; -- efi_char16_t *variable_name; -- -- variable_name = new_var->var.VariableName; -- variable_name_size = ucs2_strlen(variable_name) * sizeof(efi_char16_t); -+ unsigned long utf8_name_size; -+ efi_char16_t *variable_name = new_var->var.VariableName; - - /* -- * Length of the variable bytes in ASCII, plus the '-' separator, -+ * Length of the variable bytes in UTF8, plus the '-' separator, - * plus the GUID, plus trailing NUL - */ -- short_name_size = variable_name_size / sizeof(efi_char16_t) -- + 1 + EFI_VARIABLE_GUID_LEN + 1; -- -- short_name = kzalloc(short_name_size, GFP_KERNEL); -+ utf8_name_size = ucs2_utf8size(variable_name); -+ short_name_size = utf8_name_size + 1 + EFI_VARIABLE_GUID_LEN + 1; - -+ short_name = kmalloc(short_name_size, GFP_KERNEL); - if (!short_name) - return 1; - -- /* Convert Unicode to normal chars (assume top bits are 0), -- ala UTF-8 */ -- for (i=0; i < (int)(variable_name_size / sizeof(efi_char16_t)); i++) { -- short_name[i] = variable_name[i] & 0xFF; -- } -+ ucs2_as_utf8(short_name, variable_name, short_name_size); -+ - /* This is ugly, but necessary to separate one vendor's - private variables from another's. */ -- -- *(short_name + strlen(short_name)) = '-'; -+ short_name[utf8_name_size] = '-'; - efi_guid_unparse(&new_var->var.VendorGuid, -- short_name + strlen(short_name)); -+ short_name + utf8_name_size + 1); - - new_var->kobj.kset = efivars_kset; - -diff --git a/drivers/firmware/efi/vars.c b/drivers/firmware/efi/vars.c -index 7dbc319e1cf5..9f82b5545edd 100644 ---- a/drivers/firmware/efi/vars.c -+++ b/drivers/firmware/efi/vars.c -@@ -42,7 +42,7 @@ DECLARE_WORK(efivar_work, NULL); - EXPORT_SYMBOL_GPL(efivar_work); - - static bool --validate_device_path(struct efi_variable *var, int match, u8 *buffer, -+validate_device_path(efi_char16_t *var_name, int match, u8 *buffer, - unsigned long len) - { - struct efi_generic_dev_path *node; -@@ -75,7 +75,7 @@ validate_device_path(struct efi_variable *var, int match, u8 *buffer, - } - - static bool --validate_boot_order(struct efi_variable *var, int match, u8 *buffer, -+validate_boot_order(efi_char16_t *var_name, int match, u8 *buffer, - unsigned long len) - { - /* An array of 16-bit integers */ -@@ -86,18 +86,18 @@ validate_boot_order(struct efi_variable *var, int match, u8 *buffer, - } - - static bool --validate_load_option(struct efi_variable *var, int match, u8 *buffer, -+validate_load_option(efi_char16_t *var_name, int match, u8 *buffer, - unsigned long len) - { - u16 filepathlength; - int i, desclength = 0, namelen; - -- namelen = ucs2_strnlen(var->VariableName, sizeof(var->VariableName)); -+ namelen = ucs2_strnlen(var_name, EFI_VAR_NAME_LEN); - - /* Either "Boot" or "Driver" followed by four digits of hex */ - for (i = match; i < match+4; i++) { -- if (var->VariableName[i] > 127 || -- hex_to_bin(var->VariableName[i] & 0xff) < 0) -+ if (var_name[i] > 127 || -+ hex_to_bin(var_name[i] & 0xff) < 0) - return true; - } - -@@ -132,12 +132,12 @@ validate_load_option(struct efi_variable *var, int match, u8 *buffer, - /* - * And, finally, check the filepath - */ -- return validate_device_path(var, match, buffer + desclength + 6, -+ return validate_device_path(var_name, match, buffer + desclength + 6, - filepathlength); - } - - static bool --validate_uint16(struct efi_variable *var, int match, u8 *buffer, -+validate_uint16(efi_char16_t *var_name, int match, u8 *buffer, - unsigned long len) - { - /* A single 16-bit integer */ -@@ -148,7 +148,7 @@ validate_uint16(struct efi_variable *var, int match, u8 *buffer, - } - - static bool --validate_ascii_string(struct efi_variable *var, int match, u8 *buffer, -+validate_ascii_string(efi_char16_t *var_name, int match, u8 *buffer, - unsigned long len) - { - int i; -@@ -165,67 +165,133 @@ validate_ascii_string(struct efi_variable *var, int match, u8 *buffer, - } - - struct variable_validate { -+ efi_guid_t vendor; - char *name; -- bool (*validate)(struct efi_variable *var, int match, u8 *data, -+ bool (*validate)(efi_char16_t *var_name, int match, u8 *data, - unsigned long len); - }; - -+/* -+ * This is the list of variables we need to validate, as well as the -+ * whitelist for what we think is safe not to default to immutable. -+ * -+ * If it has a validate() method that's not NULL, it'll go into the -+ * validation routine. If not, it is assumed valid, but still used for -+ * whitelisting. -+ * -+ * Note that it's sorted by {vendor,name}, but globbed names must come after -+ * any other name with the same prefix. -+ */ - static const struct variable_validate variable_validate[] = { -- { "BootNext", validate_uint16 }, -- { "BootOrder", validate_boot_order }, -- { "DriverOrder", validate_boot_order }, -- { "Boot*", validate_load_option }, -- { "Driver*", validate_load_option }, -- { "ConIn", validate_device_path }, -- { "ConInDev", validate_device_path }, -- { "ConOut", validate_device_path }, -- { "ConOutDev", validate_device_path }, -- { "ErrOut", validate_device_path }, -- { "ErrOutDev", validate_device_path }, -- { "Timeout", validate_uint16 }, -- { "Lang", validate_ascii_string }, -- { "PlatformLang", validate_ascii_string }, -- { "", NULL }, -+ { EFI_GLOBAL_VARIABLE_GUID, "BootNext", validate_uint16 }, -+ { EFI_GLOBAL_VARIABLE_GUID, "BootOrder", validate_boot_order }, -+ { EFI_GLOBAL_VARIABLE_GUID, "Boot*", validate_load_option }, -+ { EFI_GLOBAL_VARIABLE_GUID, "DriverOrder", validate_boot_order }, -+ { EFI_GLOBAL_VARIABLE_GUID, "Driver*", validate_load_option }, -+ { EFI_GLOBAL_VARIABLE_GUID, "ConIn", validate_device_path }, -+ { EFI_GLOBAL_VARIABLE_GUID, "ConInDev", validate_device_path }, -+ { EFI_GLOBAL_VARIABLE_GUID, "ConOut", validate_device_path }, -+ { EFI_GLOBAL_VARIABLE_GUID, "ConOutDev", validate_device_path }, -+ { EFI_GLOBAL_VARIABLE_GUID, "ErrOut", validate_device_path }, -+ { EFI_GLOBAL_VARIABLE_GUID, "ErrOutDev", validate_device_path }, -+ { EFI_GLOBAL_VARIABLE_GUID, "Lang", validate_ascii_string }, -+ { EFI_GLOBAL_VARIABLE_GUID, "OsIndications", NULL }, -+ { EFI_GLOBAL_VARIABLE_GUID, "PlatformLang", validate_ascii_string }, -+ { EFI_GLOBAL_VARIABLE_GUID, "Timeout", validate_uint16 }, -+ { LINUX_EFI_CRASH_GUID, "*", NULL }, -+ { NULL_GUID, "", NULL }, - }; - -+static bool -+variable_matches(const char *var_name, size_t len, const char *match_name, -+ int *match) -+{ -+ for (*match = 0; ; (*match)++) { -+ char c = match_name[*match]; -+ char u = var_name[*match]; -+ -+ /* Wildcard in the matching name means we've matched */ -+ if (c == '*') -+ return true; -+ -+ /* Case sensitive match */ -+ if (!c && *match == len) -+ return true; -+ -+ if (c != u) -+ return false; -+ -+ if (!c) -+ return true; -+ } -+ return true; -+} -+ - bool --efivar_validate(struct efi_variable *var, u8 *data, unsigned long len) -+efivar_validate(efi_guid_t vendor, efi_char16_t *var_name, u8 *data, -+ unsigned long data_size) - { - int i; -- u16 *unicode_name = var->VariableName; -+ unsigned long utf8_size; -+ u8 *utf8_name; - -- for (i = 0; variable_validate[i].validate != NULL; i++) { -- const char *name = variable_validate[i].name; -- int match; -+ utf8_size = ucs2_utf8size(var_name); -+ utf8_name = kmalloc(utf8_size + 1, GFP_KERNEL); -+ if (!utf8_name) -+ return false; - -- for (match = 0; ; match++) { -- char c = name[match]; -- u16 u = unicode_name[match]; -+ ucs2_as_utf8(utf8_name, var_name, utf8_size); -+ utf8_name[utf8_size] = '\0'; - -- /* All special variables are plain ascii */ -- if (u > 127) -- return true; -+ for (i = 0; variable_validate[i].name[0] != '\0'; i++) { -+ const char *name = variable_validate[i].name; -+ int match = 0; - -- /* Wildcard in the matching name means we've matched */ -- if (c == '*') -- return variable_validate[i].validate(var, -- match, data, len); -+ if (efi_guidcmp(vendor, variable_validate[i].vendor)) -+ continue; - -- /* Case sensitive match */ -- if (c != u) -+ if (variable_matches(utf8_name, utf8_size+1, name, &match)) { -+ if (variable_validate[i].validate == NULL) - break; -- -- /* Reached the end of the string while matching */ -- if (!c) -- return variable_validate[i].validate(var, -- match, data, len); -+ kfree(utf8_name); -+ return variable_validate[i].validate(var_name, match, -+ data, data_size); - } - } -- -+ kfree(utf8_name); - return true; - } - EXPORT_SYMBOL_GPL(efivar_validate); - -+bool -+efivar_variable_is_removable(efi_guid_t vendor, const char *var_name, -+ size_t len) -+{ -+ int i; -+ bool found = false; -+ int match = 0; -+ -+ /* -+ * Check if our variable is in the validated variables list -+ */ -+ for (i = 0; variable_validate[i].name[0] != '\0'; i++) { -+ if (efi_guidcmp(variable_validate[i].vendor, vendor)) -+ continue; -+ -+ if (variable_matches(var_name, len, -+ variable_validate[i].name, &match)) { -+ found = true; -+ break; -+ } -+ } -+ -+ /* -+ * If it's in our list, it is removable. -+ */ -+ return found; -+} -+EXPORT_SYMBOL_GPL(efivar_variable_is_removable); -+ - static efi_status_t - check_var_size(u32 attributes, unsigned long size) - { -@@ -797,7 +863,7 @@ int efivar_entry_set_get_size(struct efivar_entry *entry, u32 attributes, - - *set = false; - -- if (efivar_validate(&entry->var, data, *size) == false) -+ if (efivar_validate(*vendor, name, data, *size) == false) - return -EINVAL; - - /* -diff --git a/fs/efivarfs/file.c b/fs/efivarfs/file.c -index 8dd524f32284..08f105a06fbf 100644 ---- a/fs/efivarfs/file.c -+++ b/fs/efivarfs/file.c -@@ -10,6 +10,7 @@ - #include - #include - #include -+#include - - #include "internal.h" - -@@ -108,9 +109,79 @@ out_free: - return size; - } - -+static int -+efivarfs_ioc_getxflags(struct file *file, void __user *arg) -+{ -+ struct inode *inode = file->f_mapping->host; -+ unsigned int i_flags; -+ unsigned int flags = 0; -+ -+ i_flags = inode->i_flags; -+ if (i_flags & S_IMMUTABLE) -+ flags |= FS_IMMUTABLE_FL; -+ -+ if (copy_to_user(arg, &flags, sizeof(flags))) -+ return -EFAULT; -+ return 0; -+} -+ -+static int -+efivarfs_ioc_setxflags(struct file *file, void __user *arg) -+{ -+ struct inode *inode = file->f_mapping->host; -+ unsigned int flags; -+ unsigned int i_flags = 0; -+ int error; -+ -+ if (!inode_owner_or_capable(inode)) -+ return -EACCES; -+ -+ if (copy_from_user(&flags, arg, sizeof(flags))) -+ return -EFAULT; -+ -+ if (flags & ~FS_IMMUTABLE_FL) -+ return -EOPNOTSUPP; -+ -+ if (!capable(CAP_LINUX_IMMUTABLE)) -+ return -EPERM; -+ -+ if (flags & FS_IMMUTABLE_FL) -+ i_flags |= S_IMMUTABLE; -+ -+ -+ error = mnt_want_write_file(file); -+ if (error) -+ return error; -+ -+ mutex_lock(&inode->i_mutex); -+ inode->i_flags &= ~S_IMMUTABLE; -+ inode->i_flags |= i_flags; -+ mutex_unlock(&inode->i_mutex); -+ -+ mnt_drop_write_file(file); -+ -+ return 0; -+} -+ -+long -+efivarfs_file_ioctl(struct file *file, unsigned int cmd, unsigned long p) -+{ -+ void __user *arg = (void __user *)p; -+ -+ switch (cmd) { -+ case FS_IOC_GETFLAGS: -+ return efivarfs_ioc_getxflags(file, arg); -+ case FS_IOC_SETFLAGS: -+ return efivarfs_ioc_setxflags(file, arg); -+ } -+ -+ return -ENOTTY; -+} -+ - const struct file_operations efivarfs_file_operations = { - .open = simple_open, - .read = efivarfs_file_read, - .write = efivarfs_file_write, - .llseek = no_llseek, -+ .unlocked_ioctl = efivarfs_file_ioctl, - }; -diff --git a/fs/efivarfs/inode.c b/fs/efivarfs/inode.c -index 7e787fb90293..d0351bc7b533 100644 ---- a/fs/efivarfs/inode.c -+++ b/fs/efivarfs/inode.c -@@ -15,7 +15,8 @@ - #include "internal.h" - - struct inode *efivarfs_get_inode(struct super_block *sb, -- const struct inode *dir, int mode, dev_t dev) -+ const struct inode *dir, int mode, -+ dev_t dev, bool is_removable) - { - struct inode *inode = new_inode(sb); - -@@ -23,6 +24,7 @@ struct inode *efivarfs_get_inode(struct super_block *sb, - inode->i_ino = get_next_ino(); - inode->i_mode = mode; - inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; -+ inode->i_flags = is_removable ? 0 : S_IMMUTABLE; - switch (mode & S_IFMT) { - case S_IFREG: - inode->i_fop = &efivarfs_file_operations; -@@ -102,22 +104,17 @@ static void efivarfs_hex_to_guid(const char *str, efi_guid_t *guid) - static int efivarfs_create(struct inode *dir, struct dentry *dentry, - umode_t mode, bool excl) - { -- struct inode *inode; -+ struct inode *inode = NULL; - struct efivar_entry *var; - int namelen, i = 0, err = 0; -+ bool is_removable = false; - - if (!efivarfs_valid_name(dentry->d_name.name, dentry->d_name.len)) - return -EINVAL; - -- inode = efivarfs_get_inode(dir->i_sb, dir, mode, 0); -- if (!inode) -- return -ENOMEM; -- - var = kzalloc(sizeof(struct efivar_entry), GFP_KERNEL); -- if (!var) { -- err = -ENOMEM; -- goto out; -- } -+ if (!var) -+ return -ENOMEM; - - /* length of the variable name itself: remove GUID and separator */ - namelen = dentry->d_name.len - EFI_VARIABLE_GUID_LEN - 1; -@@ -125,6 +122,16 @@ static int efivarfs_create(struct inode *dir, struct dentry *dentry, - efivarfs_hex_to_guid(dentry->d_name.name + namelen + 1, - &var->var.VendorGuid); - -+ if (efivar_variable_is_removable(var->var.VendorGuid, -+ dentry->d_name.name, namelen)) -+ is_removable = true; -+ -+ inode = efivarfs_get_inode(dir->i_sb, dir, mode, 0, is_removable); -+ if (!inode) { -+ err = -ENOMEM; -+ goto out; -+ } -+ - for (i = 0; i < namelen; i++) - var->var.VariableName[i] = dentry->d_name.name[i]; - -@@ -138,7 +145,8 @@ static int efivarfs_create(struct inode *dir, struct dentry *dentry, - out: - if (err) { - kfree(var); -- iput(inode); -+ if (inode) -+ iput(inode); - } - return err; - } -diff --git a/fs/efivarfs/internal.h b/fs/efivarfs/internal.h -index b5ff16addb7c..b4505188e799 100644 ---- a/fs/efivarfs/internal.h -+++ b/fs/efivarfs/internal.h -@@ -15,7 +15,8 @@ extern const struct file_operations efivarfs_file_operations; - extern const struct inode_operations efivarfs_dir_inode_operations; - extern bool efivarfs_valid_name(const char *str, int len); - extern struct inode *efivarfs_get_inode(struct super_block *sb, -- const struct inode *dir, int mode, dev_t dev); -+ const struct inode *dir, int mode, dev_t dev, -+ bool is_removable); - - extern struct list_head efivarfs_list; - -diff --git a/fs/efivarfs/super.c b/fs/efivarfs/super.c -index 141aee31884f..5a3655f690d9 100644 ---- a/fs/efivarfs/super.c -+++ b/fs/efivarfs/super.c -@@ -128,8 +128,9 @@ static int efivarfs_callback(efi_char16_t *name16, efi_guid_t vendor, - struct dentry *dentry, *root = sb->s_root; - unsigned long size = 0; - char *name; -- int len, i; -+ int len; - int err = -ENOMEM; -+ bool is_removable = false; - - entry = kmalloc(sizeof(*entry), GFP_KERNEL); - if (!entry) -@@ -138,15 +139,17 @@ static int efivarfs_callback(efi_char16_t *name16, efi_guid_t vendor, - memcpy(entry->var.VariableName, name16, name_size); - memcpy(&(entry->var.VendorGuid), &vendor, sizeof(efi_guid_t)); - -- len = ucs2_strlen(entry->var.VariableName); -+ len = ucs2_utf8size(entry->var.VariableName); - - /* name, plus '-', plus GUID, plus NUL*/ - name = kmalloc(len + 1 + EFI_VARIABLE_GUID_LEN + 1, GFP_KERNEL); - if (!name) - goto fail; - -- for (i = 0; i < len; i++) -- name[i] = entry->var.VariableName[i] & 0xFF; -+ ucs2_as_utf8(name, entry->var.VariableName, len); -+ -+ if (efivar_variable_is_removable(entry->var.VendorGuid, name, len)) -+ is_removable = true; - - name[len] = '-'; - -@@ -154,7 +157,8 @@ static int efivarfs_callback(efi_char16_t *name16, efi_guid_t vendor, - - name[len + EFI_VARIABLE_GUID_LEN+1] = '\0'; - -- inode = efivarfs_get_inode(sb, root->d_inode, S_IFREG | 0644, 0); -+ inode = efivarfs_get_inode(sb, root->d_inode, S_IFREG | 0644, 0, -+ is_removable); - if (!inode) - goto fail_name; - -@@ -210,7 +214,7 @@ static int efivarfs_fill_super(struct super_block *sb, void *data, int silent) - sb->s_d_op = &efivarfs_d_ops; - sb->s_time_gran = 1; - -- inode = efivarfs_get_inode(sb, NULL, S_IFDIR | 0755, 0); -+ inode = efivarfs_get_inode(sb, NULL, S_IFDIR | 0755, 0, true); - if (!inode) - return -ENOMEM; - inode->i_op = &efivarfs_dir_inode_operations; -diff --git a/include/crypto/if_alg.h b/include/crypto/if_alg.h -index 2f38daaab3d7..d61c11170213 100644 ---- a/include/crypto/if_alg.h -+++ b/include/crypto/if_alg.h -@@ -30,8 +30,6 @@ struct alg_sock { - - struct sock *parent; - -- unsigned int refcnt; -- - const struct af_alg_type *type; - void *private; - }; -@@ -66,7 +64,6 @@ int af_alg_register_type(const struct af_alg_type *type); - int af_alg_unregister_type(const struct af_alg_type *type); - - int af_alg_release(struct socket *sock); --void af_alg_release_parent(struct sock *sk); - int af_alg_accept(struct sock *sk, struct socket *newsock); - - int af_alg_make_sg(struct af_alg_sgl *sgl, void __user *addr, int len, -@@ -83,6 +80,11 @@ static inline struct alg_sock *alg_sk(struct sock *sk) - return (struct alg_sock *)sk; - } - -+static inline void af_alg_release_parent(struct sock *sk) -+{ -+ sock_put(alg_sk(sk)->parent); -+} -+ - static inline void af_alg_init_completion(struct af_alg_completion *completion) - { - init_completion(&completion->completion); -diff --git a/include/linux/efi.h b/include/linux/efi.h -index 2bc0ad78d058..63fa51c864ec 100644 ---- a/include/linux/efi.h -+++ b/include/linux/efi.h -@@ -769,8 +769,10 @@ struct efivars { - * and we use a page for reading/writing. - */ - -+#define EFI_VAR_NAME_LEN 1024 -+ - struct efi_variable { -- efi_char16_t VariableName[1024/sizeof(efi_char16_t)]; -+ efi_char16_t VariableName[EFI_VAR_NAME_LEN/sizeof(efi_char16_t)]; - efi_guid_t VendorGuid; - unsigned long DataSize; - __u8 Data[1024]; -@@ -832,7 +834,10 @@ int efivar_entry_iter(int (*func)(struct efivar_entry *, void *), - struct efivar_entry *efivar_entry_find(efi_char16_t *name, efi_guid_t guid, - struct list_head *head, bool remove); - --bool efivar_validate(struct efi_variable *var, u8 *data, unsigned long len); -+bool efivar_validate(efi_guid_t vendor, efi_char16_t *var_name, u8 *data, -+ unsigned long data_size); -+bool efivar_variable_is_removable(efi_guid_t vendor, const char *name, -+ size_t len); - - extern struct work_struct efivar_work; - void efivar_run_worker(void); -diff --git a/include/linux/module.h b/include/linux/module.h -index 46f1ea01e6f6..761dc2848ffa 100644 ---- a/include/linux/module.h -+++ b/include/linux/module.h -@@ -220,6 +220,12 @@ struct module_ref { - unsigned long decs; - } __attribute((aligned(2 * sizeof(unsigned long)))); - -+struct mod_kallsyms { -+ Elf_Sym *symtab; -+ unsigned int num_symtab; -+ char *strtab; -+}; -+ - struct module - { - enum module_state state; -@@ -308,14 +314,9 @@ struct module - #endif - - #ifdef CONFIG_KALLSYMS -- /* -- * We keep the symbol and string tables for kallsyms. -- * The core_* fields below are temporary, loader-only (they -- * could really be discarded after module init). -- */ -- Elf_Sym *symtab, *core_symtab; -- unsigned int num_symtab, core_num_syms; -- char *strtab, *core_strtab; -+ /* Protected by RCU and/or module_mutex: use rcu_dereference() */ -+ struct mod_kallsyms *kallsyms; -+ struct mod_kallsyms core_kallsyms; - - /* Section attributes */ - struct module_sect_attrs *sect_attrs; -diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h -index 0b2d0cbe0bab..36e5e9998865 100644 ---- a/include/linux/tracepoint.h -+++ b/include/linux/tracepoint.h -@@ -129,9 +129,6 @@ static inline void tracepoint_synchronize_unregister(void) - void *it_func; \ - void *__data; \ - \ -- if (!cpu_online(raw_smp_processor_id())) \ -- return; \ -- \ - if (!(cond)) \ - return; \ - prercu; \ -@@ -265,15 +262,19 @@ static inline void tracepoint_synchronize_unregister(void) - * "void *__data, proto" as the callback prototype. - */ - #define DECLARE_TRACE_NOARGS(name) \ -- __DECLARE_TRACE(name, void, , 1, void *__data, __data) -+ __DECLARE_TRACE(name, void, , \ -+ cpu_online(raw_smp_processor_id()), \ -+ void *__data, __data) - - #define DECLARE_TRACE(name, proto, args) \ -- __DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), 1, \ -- PARAMS(void *__data, proto), \ -- PARAMS(__data, args)) -+ __DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), \ -+ cpu_online(raw_smp_processor_id()), \ -+ PARAMS(void *__data, proto), \ -+ PARAMS(__data, args)) - - #define DECLARE_TRACE_CONDITION(name, proto, args, cond) \ -- __DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), PARAMS(cond), \ -+ __DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), \ -+ cpu_online(raw_smp_processor_id()) && (PARAMS(cond)), \ - PARAMS(void *__data, proto), \ - PARAMS(__data, args)) - -diff --git a/include/linux/ucs2_string.h b/include/linux/ucs2_string.h -index cbb20afdbc01..bb679b48f408 100644 ---- a/include/linux/ucs2_string.h -+++ b/include/linux/ucs2_string.h -@@ -11,4 +11,8 @@ unsigned long ucs2_strlen(const ucs2_char_t *s); - unsigned long ucs2_strsize(const ucs2_char_t *data, unsigned long maxlength); - int ucs2_strncmp(const ucs2_char_t *a, const ucs2_char_t *b, size_t len); - -+unsigned long ucs2_utf8size(const ucs2_char_t *src); -+unsigned long ucs2_as_utf8(u8 *dest, const ucs2_char_t *src, -+ unsigned long maxlength); -+ - #endif /* _LINUX_UCS2_STRING_H_ */ -diff --git a/kernel/module.c b/kernel/module.c -index 70a4754c001f..f8a4f48b48a9 100644 ---- a/kernel/module.c -+++ b/kernel/module.c -@@ -179,6 +179,9 @@ struct load_info { - struct _ddebug *debug; - unsigned int num_debug; - bool sig_ok; -+#ifdef CONFIG_KALLSYMS -+ unsigned long mod_kallsyms_init_off; -+#endif - struct { - unsigned int sym, str, mod, vers, info, pcpu; - } index; -@@ -2346,8 +2349,20 @@ static void layout_symtab(struct module *mod, struct load_info *info) - strsect->sh_entsize = get_offset(mod, &mod->init_size, strsect, - info->index.str) | INIT_OFFSET_MASK; - pr_debug("\t%s\n", info->secstrings + strsect->sh_name); -+ -+ /* We'll tack temporary mod_kallsyms on the end. */ -+ mod->init_size = ALIGN(mod->init_size, -+ __alignof__(struct mod_kallsyms)); -+ info->mod_kallsyms_init_off = mod->init_size; -+ mod->init_size += sizeof(struct mod_kallsyms); -+ mod->init_size = debug_align(mod->init_size); - } - -+/* -+ * We use the full symtab and strtab which layout_symtab arranged to -+ * be appended to the init section. Later we switch to the cut-down -+ * core-only ones. -+ */ - static void add_kallsyms(struct module *mod, const struct load_info *info) - { - unsigned int i, ndst; -@@ -2356,28 +2371,33 @@ static void add_kallsyms(struct module *mod, const struct load_info *info) - char *s; - Elf_Shdr *symsec = &info->sechdrs[info->index.sym]; - -- mod->symtab = (void *)symsec->sh_addr; -- mod->num_symtab = symsec->sh_size / sizeof(Elf_Sym); -+ /* Set up to point into init section. */ -+ mod->kallsyms = mod->module_init + info->mod_kallsyms_init_off; -+ -+ mod->kallsyms->symtab = (void *)symsec->sh_addr; -+ mod->kallsyms->num_symtab = symsec->sh_size / sizeof(Elf_Sym); - /* Make sure we get permanent strtab: don't use info->strtab. */ -- mod->strtab = (void *)info->sechdrs[info->index.str].sh_addr; -+ mod->kallsyms->strtab = (void *)info->sechdrs[info->index.str].sh_addr; - - /* Set types up while we still have access to sections. */ -- for (i = 0; i < mod->num_symtab; i++) -- mod->symtab[i].st_info = elf_type(&mod->symtab[i], info); -- -- mod->core_symtab = dst = mod->module_core + info->symoffs; -- mod->core_strtab = s = mod->module_core + info->stroffs; -- src = mod->symtab; -- for (ndst = i = 0; i < mod->num_symtab; i++) { -+ for (i = 0; i < mod->kallsyms->num_symtab; i++) -+ mod->kallsyms->symtab[i].st_info -+ = elf_type(&mod->kallsyms->symtab[i], info); -+ -+ /* Now populate the cut down core kallsyms for after init. */ -+ mod->core_kallsyms.symtab = dst = mod->module_core + info->symoffs; -+ mod->core_kallsyms.strtab = s = mod->module_core + info->stroffs; -+ src = mod->kallsyms->symtab; -+ for (ndst = i = 0; i < mod->kallsyms->num_symtab; i++) { - if (i == 0 || - is_core_symbol(src+i, info->sechdrs, info->hdr->e_shnum)) { - dst[ndst] = src[i]; -- dst[ndst++].st_name = s - mod->core_strtab; -- s += strlcpy(s, &mod->strtab[src[i].st_name], -+ dst[ndst++].st_name = s - mod->core_kallsyms.strtab; -+ s += strlcpy(s, &mod->kallsyms->strtab[src[i].st_name], - KSYM_NAME_LEN) + 1; - } - } -- mod->core_num_syms = ndst; -+ mod->core_kallsyms.num_symtab = ndst; - } - #else - static inline void layout_symtab(struct module *mod, struct load_info *info) -@@ -3117,9 +3137,8 @@ static int do_init_module(struct module *mod) - module_put(mod); - trim_init_extable(mod); - #ifdef CONFIG_KALLSYMS -- mod->num_symtab = mod->core_num_syms; -- mod->symtab = mod->core_symtab; -- mod->strtab = mod->core_strtab; -+ /* Switch to core kallsyms now init is done: kallsyms may be walking! */ -+ rcu_assign_pointer(mod->kallsyms, &mod->core_kallsyms); - #endif - unset_module_init_ro_nx(mod); - module_free(mod, mod->module_init); -@@ -3398,9 +3417,9 @@ static inline int is_arm_mapping_symbol(const char *str) - && (str[2] == '\0' || str[2] == '.'); - } - --static const char *symname(struct module *mod, unsigned int symnum) -+static const char *symname(struct mod_kallsyms *kallsyms, unsigned int symnum) - { -- return mod->strtab + mod->symtab[symnum].st_name; -+ return kallsyms->strtab + kallsyms->symtab[symnum].st_name; - } - - static const char *get_ksymbol(struct module *mod, -@@ -3410,6 +3429,7 @@ static const char *get_ksymbol(struct module *mod, - { - unsigned int i, best = 0; - unsigned long nextval; -+ struct mod_kallsyms *kallsyms = rcu_dereference_sched(mod->kallsyms); - - /* At worse, next value is at end of module */ - if (within_module_init(addr, mod)) -@@ -3419,32 +3439,32 @@ static const char *get_ksymbol(struct module *mod, - - /* Scan for closest preceding symbol, and next symbol. (ELF - starts real symbols at 1). */ -- for (i = 1; i < mod->num_symtab; i++) { -- if (mod->symtab[i].st_shndx == SHN_UNDEF) -+ for (i = 1; i < kallsyms->num_symtab; i++) { -+ if (kallsyms->symtab[i].st_shndx == SHN_UNDEF) - continue; - - /* We ignore unnamed symbols: they're uninformative - * and inserted at a whim. */ -- if (*symname(mod, i) == '\0' -- || is_arm_mapping_symbol(symname(mod, i))) -+ if (*symname(kallsyms, i) == '\0' -+ || is_arm_mapping_symbol(symname(kallsyms, i))) - continue; - -- if (mod->symtab[i].st_value <= addr -- && mod->symtab[i].st_value > mod->symtab[best].st_value) -+ if (kallsyms->symtab[i].st_value <= addr -+ && kallsyms->symtab[i].st_value > kallsyms->symtab[best].st_value) - best = i; -- if (mod->symtab[i].st_value > addr -- && mod->symtab[i].st_value < nextval) -- nextval = mod->symtab[i].st_value; -+ if (kallsyms->symtab[i].st_value > addr -+ && kallsyms->symtab[i].st_value < nextval) -+ nextval = kallsyms->symtab[i].st_value; - } - - if (!best) - return NULL; - - if (size) -- *size = nextval - mod->symtab[best].st_value; -+ *size = nextval - kallsyms->symtab[best].st_value; - if (offset) -- *offset = addr - mod->symtab[best].st_value; -- return symname(mod, best); -+ *offset = addr - kallsyms->symtab[best].st_value; -+ return symname(kallsyms, best); - } - - /* For kallsyms to ask for address resolution. NULL means not found. Careful -@@ -3540,18 +3560,21 @@ int module_get_kallsym(unsigned int symnum, unsigned long *value, char *type, - - preempt_disable(); - list_for_each_entry_rcu(mod, &modules, list) { -+ struct mod_kallsyms *kallsyms; -+ - if (mod->state == MODULE_STATE_UNFORMED) - continue; -- if (symnum < mod->num_symtab) { -- *value = mod->symtab[symnum].st_value; -- *type = mod->symtab[symnum].st_info; -- strlcpy(name, symname(mod, symnum), KSYM_NAME_LEN); -+ kallsyms = rcu_dereference_sched(mod->kallsyms); -+ if (symnum < kallsyms->num_symtab) { -+ *value = kallsyms->symtab[symnum].st_value; -+ *type = kallsyms->symtab[symnum].st_info; -+ strlcpy(name, symname(kallsyms, symnum), KSYM_NAME_LEN); - strlcpy(module_name, mod->name, MODULE_NAME_LEN); - *exported = is_exported(name, *value, mod); - preempt_enable(); - return 0; - } -- symnum -= mod->num_symtab; -+ symnum -= kallsyms->num_symtab; - } - preempt_enable(); - return -ERANGE; -@@ -3560,11 +3583,12 @@ int module_get_kallsym(unsigned int symnum, unsigned long *value, char *type, - static unsigned long mod_find_symname(struct module *mod, const char *name) - { - unsigned int i; -+ struct mod_kallsyms *kallsyms = rcu_dereference_sched(mod->kallsyms); - -- for (i = 0; i < mod->num_symtab; i++) -- if (strcmp(name, symname(mod, i)) == 0 && -- mod->symtab[i].st_info != 'U') -- return mod->symtab[i].st_value; -+ for (i = 0; i < kallsyms->num_symtab; i++) -+ if (strcmp(name, symname(kallsyms, i)) == 0 && -+ kallsyms->symtab[i].st_info != 'U') -+ return kallsyms->symtab[i].st_value; - return 0; - } - -@@ -3603,11 +3627,14 @@ int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *, - int ret; - - list_for_each_entry(mod, &modules, list) { -+ /* We hold module_mutex: no need for rcu_dereference_sched */ -+ struct mod_kallsyms *kallsyms = mod->kallsyms; -+ - if (mod->state == MODULE_STATE_UNFORMED) - continue; -- for (i = 0; i < mod->num_symtab; i++) { -- ret = fn(data, symname(mod, i), -- mod, mod->symtab[i].st_value); -+ for (i = 0; i < kallsyms->num_symtab; i++) { -+ ret = fn(data, symname(kallsyms, i), -+ mod, kallsyms->symtab[i].st_value); - if (ret != 0) - return ret; - } -diff --git a/lib/ucs2_string.c b/lib/ucs2_string.c -index 6f500ef2301d..f0b323abb4c6 100644 ---- a/lib/ucs2_string.c -+++ b/lib/ucs2_string.c -@@ -49,3 +49,65 @@ ucs2_strncmp(const ucs2_char_t *a, const ucs2_char_t *b, size_t len) - } - } - EXPORT_SYMBOL(ucs2_strncmp); -+ -+unsigned long -+ucs2_utf8size(const ucs2_char_t *src) -+{ -+ unsigned long i; -+ unsigned long j = 0; -+ -+ for (i = 0; i < ucs2_strlen(src); i++) { -+ u16 c = src[i]; -+ -+ if (c >= 0x800) -+ j += 3; -+ else if (c >= 0x80) -+ j += 2; -+ else -+ j += 1; -+ } -+ -+ return j; -+} -+EXPORT_SYMBOL(ucs2_utf8size); -+ -+/* -+ * copy at most maxlength bytes of whole utf8 characters to dest from the -+ * ucs2 string src. -+ * -+ * The return value is the number of characters copied, not including the -+ * final NUL character. -+ */ -+unsigned long -+ucs2_as_utf8(u8 *dest, const ucs2_char_t *src, unsigned long maxlength) -+{ -+ unsigned int i; -+ unsigned long j = 0; -+ unsigned long limit = ucs2_strnlen(src, maxlength); -+ -+ for (i = 0; maxlength && i < limit; i++) { -+ u16 c = src[i]; -+ -+ if (c >= 0x800) { -+ if (maxlength < 3) -+ break; -+ maxlength -= 3; -+ dest[j++] = 0xe0 | (c & 0xf000) >> 12; -+ dest[j++] = 0x80 | (c & 0x0fc0) >> 6; -+ dest[j++] = 0x80 | (c & 0x003f); -+ } else if (c >= 0x80) { -+ if (maxlength < 2) -+ break; -+ maxlength -= 2; -+ dest[j++] = 0xc0 | (c & 0x7c0) >> 6; -+ dest[j++] = 0x80 | (c & 0x03f); -+ } else { -+ maxlength -= 1; -+ dest[j++] = c & 0x7f; -+ } -+ } -+ if (maxlength) -+ dest[j] = '\0'; -+ return j; -+} -+EXPORT_SYMBOL(ucs2_as_utf8); -diff --git a/net/mac80211/agg-rx.c b/net/mac80211/agg-rx.c -index 31bf2586fb84..864408026202 100644 ---- a/net/mac80211/agg-rx.c -+++ b/net/mac80211/agg-rx.c -@@ -290,7 +290,7 @@ void ieee80211_process_addba_request(struct ieee80211_local *local, - } - - /* prepare A-MPDU MLME for Rx aggregation */ -- tid_agg_rx = kmalloc(sizeof(struct tid_ampdu_rx), GFP_KERNEL); -+ tid_agg_rx = kzalloc(sizeof(*tid_agg_rx), GFP_KERNEL); - if (!tid_agg_rx) - goto end; - -diff --git a/net/mac80211/rc80211_minstrel_ht.c b/net/mac80211/rc80211_minstrel_ht.c -index f3bbea1eb9e7..13f10aab9213 100644 ---- a/net/mac80211/rc80211_minstrel_ht.c -+++ b/net/mac80211/rc80211_minstrel_ht.c -@@ -454,7 +454,7 @@ minstrel_aggr_check(struct ieee80211_sta *pubsta, struct sk_buff *skb) - if (skb_get_queue_mapping(skb) == IEEE80211_AC_VO) - return; - -- ieee80211_start_tx_ba_session(pubsta, tid, 5000); -+ ieee80211_start_tx_ba_session(pubsta, tid, 0); - } - - static void -diff --git a/net/wireless/wext-core.c b/net/wireless/wext-core.c -index c8717c1d082e..87dd619fb2e9 100644 ---- a/net/wireless/wext-core.c -+++ b/net/wireless/wext-core.c -@@ -342,6 +342,39 @@ static const int compat_event_type_size[] = { - - /* IW event code */ - -+static void wireless_nlevent_flush(void) -+{ -+ struct sk_buff *skb; -+ struct net *net; -+ -+ ASSERT_RTNL(); -+ -+ for_each_net(net) { -+ while ((skb = skb_dequeue(&net->wext_nlevents))) -+ rtnl_notify(skb, net, 0, RTNLGRP_LINK, NULL, -+ GFP_KERNEL); -+ } -+} -+ -+static int wext_netdev_notifier_call(struct notifier_block *nb, -+ unsigned long state, void *ptr) -+{ -+ /* -+ * When a netdev changes state in any way, flush all pending messages -+ * to avoid them going out in a strange order, e.g. RTM_NEWLINK after -+ * RTM_DELLINK, or with IFF_UP after without IFF_UP during dev_close() -+ * or similar - all of which could otherwise happen due to delays from -+ * schedule_work(). -+ */ -+ wireless_nlevent_flush(); -+ -+ return NOTIFY_OK; -+} -+ -+static struct notifier_block wext_netdev_notifier = { -+ .notifier_call = wext_netdev_notifier_call, -+}; -+ - static int __net_init wext_pernet_init(struct net *net) - { - skb_queue_head_init(&net->wext_nlevents); -@@ -360,7 +393,12 @@ static struct pernet_operations wext_pernet_ops = { - - static int __init wireless_nlevent_init(void) - { -- return register_pernet_subsys(&wext_pernet_ops); -+ int err = register_pernet_subsys(&wext_pernet_ops); -+ -+ if (err) -+ return err; -+ -+ return register_netdevice_notifier(&wext_netdev_notifier); - } - - subsys_initcall(wireless_nlevent_init); -@@ -368,17 +406,8 @@ subsys_initcall(wireless_nlevent_init); - /* Process events generated by the wireless layer or the driver. */ - static void wireless_nlevent_process(struct work_struct *work) - { -- struct sk_buff *skb; -- struct net *net; -- - rtnl_lock(); -- -- for_each_net(net) { -- while ((skb = skb_dequeue(&net->wext_nlevents))) -- rtnl_notify(skb, net, 0, RTNLGRP_LINK, NULL, -- GFP_KERNEL); -- } -- -+ wireless_nlevent_flush(); - rtnl_unlock(); - } - -diff --git a/sound/soc/codecs/wm8958-dsp2.c b/sound/soc/codecs/wm8958-dsp2.c -index 754f88e1fdab..4892966fc1b8 100644 ---- a/sound/soc/codecs/wm8958-dsp2.c -+++ b/sound/soc/codecs/wm8958-dsp2.c -@@ -459,7 +459,7 @@ static int wm8958_put_mbc_enum(struct snd_kcontrol *kcontrol, - struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); - struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); - struct wm8994 *control = wm8994->wm8994; -- int value = ucontrol->value.integer.value[0]; -+ int value = ucontrol->value.enumerated.item[0]; - int reg; - - /* Don't allow on the fly reconfiguration */ -@@ -549,7 +549,7 @@ static int wm8958_put_vss_enum(struct snd_kcontrol *kcontrol, - struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); - struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); - struct wm8994 *control = wm8994->wm8994; -- int value = ucontrol->value.integer.value[0]; -+ int value = ucontrol->value.enumerated.item[0]; - int reg; - - /* Don't allow on the fly reconfiguration */ -@@ -582,7 +582,7 @@ static int wm8958_put_vss_hpf_enum(struct snd_kcontrol *kcontrol, - struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); - struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); - struct wm8994 *control = wm8994->wm8994; -- int value = ucontrol->value.integer.value[0]; -+ int value = ucontrol->value.enumerated.item[0]; - int reg; - - /* Don't allow on the fly reconfiguration */ -@@ -749,7 +749,7 @@ static int wm8958_put_enh_eq_enum(struct snd_kcontrol *kcontrol, - struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); - struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); - struct wm8994 *control = wm8994->wm8994; -- int value = ucontrol->value.integer.value[0]; -+ int value = ucontrol->value.enumerated.item[0]; - int reg; - - /* Don't allow on the fly reconfiguration */ -diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c -index 6e746c7474bf..cda3cf23474b 100644 ---- a/sound/soc/codecs/wm8994.c -+++ b/sound/soc/codecs/wm8994.c -@@ -361,7 +361,7 @@ static int wm8994_put_drc_enum(struct snd_kcontrol *kcontrol, - struct wm8994 *control = wm8994->wm8994; - struct wm8994_pdata *pdata = &control->pdata; - int drc = wm8994_get_drc(kcontrol->id.name); -- int value = ucontrol->value.integer.value[0]; -+ int value = ucontrol->value.enumerated.item[0]; - - if (drc < 0) - return drc; -@@ -468,7 +468,7 @@ static int wm8994_put_retune_mobile_enum(struct snd_kcontrol *kcontrol, - struct wm8994 *control = wm8994->wm8994; - struct wm8994_pdata *pdata = &control->pdata; - int block = wm8994_get_retune_mobile_block(kcontrol->id.name); -- int value = ucontrol->value.integer.value[0]; -+ int value = ucontrol->value.enumerated.item[0]; - - if (block < 0) - return block; -diff --git a/tools/testing/selftests/efivarfs/efivarfs.sh b/tools/testing/selftests/efivarfs/efivarfs.sh -index 77edcdcc016b..057278448515 100644 ---- a/tools/testing/selftests/efivarfs/efivarfs.sh -+++ b/tools/testing/selftests/efivarfs/efivarfs.sh -@@ -88,7 +88,11 @@ test_delete() - exit 1 - fi - -- rm $file -+ rm $file 2>/dev/null -+ if [ $? -ne 0 ]; then -+ chattr -i $file -+ rm $file -+ fi - - if [ -e $file ]; then - echo "$file couldn't be deleted" >&2 -@@ -111,6 +115,7 @@ test_zero_size_delete() - exit 1 - fi - -+ chattr -i $file - printf "$attrs" > $file - - if [ -e $file ]; then -@@ -141,7 +146,11 @@ test_valid_filenames() - echo "$file could not be created" >&2 - ret=1 - else -- rm $file -+ rm $file 2>/dev/null -+ if [ $? -ne 0 ]; then -+ chattr -i $file -+ rm $file -+ fi - fi - done - -@@ -174,7 +183,11 @@ test_invalid_filenames() - - if [ -e $file ]; then - echo "Creating $file should have failed" >&2 -- rm $file -+ rm $file 2>/dev/null -+ if [ $? -ne 0 ]; then -+ chattr -i $file -+ rm $file -+ fi - ret=1 - fi - done -diff --git a/tools/testing/selftests/efivarfs/open-unlink.c b/tools/testing/selftests/efivarfs/open-unlink.c -index 8c0764407b3c..4af74f733036 100644 ---- a/tools/testing/selftests/efivarfs/open-unlink.c -+++ b/tools/testing/selftests/efivarfs/open-unlink.c -@@ -1,10 +1,68 @@ -+#include - #include - #include - #include - #include -+#include - #include - #include - #include -+#include -+ -+static int set_immutable(const char *path, int immutable) -+{ -+ unsigned int flags; -+ int fd; -+ int rc; -+ int error; -+ -+ fd = open(path, O_RDONLY); -+ if (fd < 0) -+ return fd; -+ -+ rc = ioctl(fd, FS_IOC_GETFLAGS, &flags); -+ if (rc < 0) { -+ error = errno; -+ close(fd); -+ errno = error; -+ return rc; -+ } -+ -+ if (immutable) -+ flags |= FS_IMMUTABLE_FL; -+ else -+ flags &= ~FS_IMMUTABLE_FL; -+ -+ rc = ioctl(fd, FS_IOC_SETFLAGS, &flags); -+ error = errno; -+ close(fd); -+ errno = error; -+ return rc; -+} -+ -+static int get_immutable(const char *path) -+{ -+ unsigned int flags; -+ int fd; -+ int rc; -+ int error; -+ -+ fd = open(path, O_RDONLY); -+ if (fd < 0) -+ return fd; -+ -+ rc = ioctl(fd, FS_IOC_GETFLAGS, &flags); -+ if (rc < 0) { -+ error = errno; -+ close(fd); -+ errno = error; -+ return rc; -+ } -+ close(fd); -+ if (flags & FS_IMMUTABLE_FL) -+ return 1; -+ return 0; -+} - - int main(int argc, char **argv) - { -@@ -27,7 +85,7 @@ int main(int argc, char **argv) - buf[4] = 0; - - /* create a test variable */ -- fd = open(path, O_WRONLY | O_CREAT); -+ fd = open(path, O_WRONLY | O_CREAT, 0600); - if (fd < 0) { - perror("open(O_WRONLY)"); - return EXIT_FAILURE; -@@ -41,6 +99,18 @@ int main(int argc, char **argv) - - close(fd); - -+ rc = get_immutable(path); -+ if (rc < 0) { -+ perror("ioctl(FS_IOC_GETFLAGS)"); -+ return EXIT_FAILURE; -+ } else if (rc) { -+ rc = set_immutable(path, 0); -+ if (rc < 0) { -+ perror("ioctl(FS_IOC_SETFLAGS)"); -+ return EXIT_FAILURE; -+ } -+ } -+ - fd = open(path, O_RDONLY); - if (fd < 0) { - perror("open"); diff --git a/patch/kernel/marvell-default/2-patch-3.10.101-102.patch b/patch/kernel/marvell-default/2-patch-3.10.101-102.patch deleted file mode 100644 index af1472cd20..0000000000 --- a/patch/kernel/marvell-default/2-patch-3.10.101-102.patch +++ /dev/null @@ -1,4381 +0,0 @@ -diff --git a/MAINTAINERS b/MAINTAINERS -index 48c748080c96..29d7d74a8d04 100644 ---- a/MAINTAINERS -+++ b/MAINTAINERS -@@ -3032,8 +3032,8 @@ F: Documentation/x86/efi-stub.txt - F: arch/ia64/kernel/efi.c - F: arch/x86/boot/compressed/eboot.[ch] - F: arch/x86/include/asm/efi.h --F: arch/x86/platform/efi/* --F: drivers/firmware/efi/* -+F: arch/x86/platform/efi/ -+F: drivers/firmware/efi/ - F: include/linux/efi*.h - - EFI VARIABLE FILESYSTEM -diff --git a/Makefile b/Makefile -index 4be9e643cef0..868093c16ae0 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,6 +1,6 @@ - VERSION = 3 - PATCHLEVEL = 10 --SUBLEVEL = 101 -+SUBLEVEL = 102 - EXTRAVERSION = - NAME = TOSSUG Baby Fish - -diff --git a/arch/arm/mach-omap2/cpuidle34xx.c b/arch/arm/mach-omap2/cpuidle34xx.c -index e18709d3b95d..38e1bdcaf015 100644 ---- a/arch/arm/mach-omap2/cpuidle34xx.c -+++ b/arch/arm/mach-omap2/cpuidle34xx.c -@@ -34,6 +34,7 @@ - #include "pm.h" - #include "control.h" - #include "common.h" -+#include "soc.h" - - /* Mach specific information to be recorded in the C-state driver_data */ - struct omap3_idle_statedata { -@@ -322,6 +323,69 @@ static struct cpuidle_driver omap3_idle_driver = { - .safe_state_index = 0, - }; - -+/* -+ * Numbers based on measurements made in October 2009 for PM optimized kernel -+ * with CPU freq enabled on device Nokia N900. Assumes OPP2 (main idle OPP, -+ * and worst case latencies). -+ */ -+static struct cpuidle_driver omap3430_idle_driver = { -+ .name = "omap3430_idle", -+ .owner = THIS_MODULE, -+ .states = { -+ { -+ .enter = omap3_enter_idle_bm, -+ .exit_latency = 110 + 162, -+ .target_residency = 5, -+ .name = "C1", -+ .desc = "MPU ON + CORE ON", -+ }, -+ { -+ .enter = omap3_enter_idle_bm, -+ .exit_latency = 106 + 180, -+ .target_residency = 309, -+ .name = "C2", -+ .desc = "MPU ON + CORE ON", -+ }, -+ { -+ .enter = omap3_enter_idle_bm, -+ .exit_latency = 107 + 410, -+ .target_residency = 46057, -+ .name = "C3", -+ .desc = "MPU RET + CORE ON", -+ }, -+ { -+ .enter = omap3_enter_idle_bm, -+ .exit_latency = 121 + 3374, -+ .target_residency = 46057, -+ .name = "C4", -+ .desc = "MPU OFF + CORE ON", -+ }, -+ { -+ .enter = omap3_enter_idle_bm, -+ .exit_latency = 855 + 1146, -+ .target_residency = 46057, -+ .name = "C5", -+ .desc = "MPU RET + CORE RET", -+ }, -+ { -+ .enter = omap3_enter_idle_bm, -+ .exit_latency = 7580 + 4134, -+ .target_residency = 484329, -+ .name = "C6", -+ .desc = "MPU OFF + CORE RET", -+ }, -+ { -+ .enter = omap3_enter_idle_bm, -+ .exit_latency = 7505 + 15274, -+ .target_residency = 484329, -+ .name = "C7", -+ .desc = "MPU OFF + CORE OFF", -+ }, -+ }, -+ .state_count = ARRAY_SIZE(omap3_idle_data), -+ .safe_state_index = 0, -+}; -+ - /* Public functions */ - - /** -@@ -340,5 +404,8 @@ int __init omap3_idle_init(void) - if (!mpu_pd || !core_pd || !per_pd || !cam_pd) - return -ENODEV; - -- return cpuidle_register(&omap3_idle_driver, NULL); -+ if (cpu_is_omap3430()) -+ return cpuidle_register(&omap3430_idle_driver, NULL); -+ else -+ return cpuidle_register(&omap3_idle_driver, NULL); - } -diff --git a/arch/arm/mach-omap2/sleep34xx.S b/arch/arm/mach-omap2/sleep34xx.S -index d1dedc8195ed..eafd120b53f1 100644 ---- a/arch/arm/mach-omap2/sleep34xx.S -+++ b/arch/arm/mach-omap2/sleep34xx.S -@@ -203,23 +203,8 @@ save_context_wfi: - */ - ldr r1, kernel_flush - blx r1 -- /* -- * The kernel doesn't interwork: v7_flush_dcache_all in particluar will -- * always return in Thumb state when CONFIG_THUMB2_KERNEL is enabled. -- * This sequence switches back to ARM. Note that .align may insert a -- * nop: bx pc needs to be word-aligned in order to work. -- */ -- THUMB( .thumb ) -- THUMB( .align ) -- THUMB( bx pc ) -- THUMB( nop ) -- .arm -- - b omap3_do_wfi -- --/* -- * Local variables -- */ -+ENDPROC(omap34xx_cpu_suspend) - omap3_do_wfi_sram_addr: - .word omap3_do_wfi_sram - kernel_flush: -@@ -364,10 +349,7 @@ exit_nonoff_modes: - * =================================== - */ - ldmfd sp!, {r4 - r11, pc} @ restore regs and return -- --/* -- * Local variables -- */ -+ENDPROC(omap3_do_wfi) - sdrc_power: - .word SDRC_POWER_V - cm_idlest1_core: -diff --git a/arch/arm/mach-socfpga/headsmp.S b/arch/arm/mach-socfpga/headsmp.S -index 9004bfb1756e..a6f5519072cc 100644 ---- a/arch/arm/mach-socfpga/headsmp.S -+++ b/arch/arm/mach-socfpga/headsmp.S -@@ -12,6 +12,7 @@ - - __CPUINIT - .arch armv7-a -+ .arm - - ENTRY(secondary_trampoline) - movw r2, #:lower16:cpu1start_addr -diff --git a/arch/parisc/kernel/parisc_ksyms.c b/arch/parisc/kernel/parisc_ksyms.c -index 568b2c61ea02..3cad8aadc69e 100644 ---- a/arch/parisc/kernel/parisc_ksyms.c -+++ b/arch/parisc/kernel/parisc_ksyms.c -@@ -47,11 +47,11 @@ EXPORT_SYMBOL(__cmpxchg_u64); - EXPORT_SYMBOL(lclear_user); - EXPORT_SYMBOL(lstrnlen_user); - --/* Global fixups */ --extern void fixup_get_user_skip_1(void); --extern void fixup_get_user_skip_2(void); --extern void fixup_put_user_skip_1(void); --extern void fixup_put_user_skip_2(void); -+/* Global fixups - defined as int to avoid creation of function pointers */ -+extern int fixup_get_user_skip_1; -+extern int fixup_get_user_skip_2; -+extern int fixup_put_user_skip_1; -+extern int fixup_put_user_skip_2; - EXPORT_SYMBOL(fixup_get_user_skip_1); - EXPORT_SYMBOL(fixup_get_user_skip_2); - EXPORT_SYMBOL(fixup_put_user_skip_1); -diff --git a/arch/parisc/kernel/traps.c b/arch/parisc/kernel/traps.c -index b3f87a3b4bce..0c329b2c5df4 100644 ---- a/arch/parisc/kernel/traps.c -+++ b/arch/parisc/kernel/traps.c -@@ -811,6 +811,9 @@ void notrace handle_interruption(int code, struct pt_regs *regs) - - if (fault_space == 0 && !in_atomic()) - { -+ /* Clean up and return if in exception table. */ -+ if (fixup_exception(regs)) -+ return; - pdc_chassis_send_status(PDC_CHASSIS_DIRECT_PANIC); - parisc_terminate("Kernel Fault", regs, code, fault_address); - } -diff --git a/arch/powerpc/include/uapi/asm/cputable.h b/arch/powerpc/include/uapi/asm/cputable.h -index de2c0e4ee1aa..67de80a8e178 100644 ---- a/arch/powerpc/include/uapi/asm/cputable.h -+++ b/arch/powerpc/include/uapi/asm/cputable.h -@@ -31,6 +31,7 @@ - #define PPC_FEATURE_PSERIES_PERFMON_COMPAT \ - 0x00000040 - -+/* Reserved - do not use 0x00000004 */ - #define PPC_FEATURE_TRUE_LE 0x00000002 - #define PPC_FEATURE_PPC_LE 0x00000001 - -diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c -index 8b6f7a99cce2..e8c45b7438e7 100644 ---- a/arch/powerpc/kernel/prom.c -+++ b/arch/powerpc/kernel/prom.c -@@ -159,7 +159,7 @@ static struct ibm_pa_feature { - {CPU_FTR_NOEXECUTE, 0, 0, 0, 6, 0}, - {CPU_FTR_NODSISRALIGN, 0, 0, 1, 1, 1}, - {0, MMU_FTR_CI_LARGE_PAGE, 0, 1, 2, 0}, -- {CPU_FTR_REAL_LE, PPC_FEATURE_TRUE_LE, 5, 0, 0}, -+ {CPU_FTR_REAL_LE, 0, PPC_FEATURE_TRUE_LE, 5, 0, 0}, - }; - - static void __init scan_features(unsigned long node, unsigned char *ftrs, -diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h -index 98b68c2f1a1c..b76c1bf6125d 100644 ---- a/arch/x86/include/asm/kvm_host.h -+++ b/arch/x86/include/asm/kvm_host.h -@@ -59,7 +59,7 @@ - (~(unsigned long)(X86_CR4_VME | X86_CR4_PVI | X86_CR4_TSD | X86_CR4_DE\ - | X86_CR4_PSE | X86_CR4_PAE | X86_CR4_MCE \ - | X86_CR4_PGE | X86_CR4_PCE | X86_CR4_OSFXSR | X86_CR4_PCIDE \ -- | X86_CR4_OSXSAVE | X86_CR4_SMEP | X86_CR4_RDWRGSFS \ -+ | X86_CR4_OSXSAVE | X86_CR4_SMEP | X86_CR4_FSGSBASE \ - | X86_CR4_OSXMMEXCPT | X86_CR4_VMXE)) - - #define CR8_RESERVED_BITS (~(unsigned long)X86_CR8_TPR) -diff --git a/arch/x86/include/asm/xen/hypervisor.h b/arch/x86/include/asm/xen/hypervisor.h -index 125f344f06a9..8ac93f05a8ea 100644 ---- a/arch/x86/include/asm/xen/hypervisor.h -+++ b/arch/x86/include/asm/xen/hypervisor.h -@@ -71,4 +71,6 @@ static inline bool xen_x2apic_para_available(void) - } - #endif - -+extern void xen_set_iopl_mask(unsigned mask); -+ - #endif /* _ASM_X86_XEN_HYPERVISOR_H */ -diff --git a/arch/x86/include/uapi/asm/processor-flags.h b/arch/x86/include/uapi/asm/processor-flags.h -index b16e6d28f149..180a0c3c224d 100644 ---- a/arch/x86/include/uapi/asm/processor-flags.h -+++ b/arch/x86/include/uapi/asm/processor-flags.h -@@ -2,75 +2,129 @@ - #define _UAPI_ASM_X86_PROCESSOR_FLAGS_H - /* Various flags defined: can be included from assembler. */ - -+#include -+ - /* - * EFLAGS bits - */ --#define X86_EFLAGS_CF 0x00000001 /* Carry Flag */ --#define X86_EFLAGS_FIXED 0x00000002 /* Bit 1 - always on */ --#define X86_EFLAGS_PF 0x00000004 /* Parity Flag */ --#define X86_EFLAGS_AF 0x00000010 /* Auxiliary carry Flag */ --#define X86_EFLAGS_ZF 0x00000040 /* Zero Flag */ --#define X86_EFLAGS_SF 0x00000080 /* Sign Flag */ --#define X86_EFLAGS_TF 0x00000100 /* Trap Flag */ --#define X86_EFLAGS_IF 0x00000200 /* Interrupt Flag */ --#define X86_EFLAGS_DF 0x00000400 /* Direction Flag */ --#define X86_EFLAGS_OF 0x00000800 /* Overflow Flag */ --#define X86_EFLAGS_IOPL 0x00003000 /* IOPL mask */ --#define X86_EFLAGS_NT 0x00004000 /* Nested Task */ --#define X86_EFLAGS_RF 0x00010000 /* Resume Flag */ --#define X86_EFLAGS_VM 0x00020000 /* Virtual Mode */ --#define X86_EFLAGS_AC 0x00040000 /* Alignment Check */ --#define X86_EFLAGS_VIF 0x00080000 /* Virtual Interrupt Flag */ --#define X86_EFLAGS_VIP 0x00100000 /* Virtual Interrupt Pending */ --#define X86_EFLAGS_ID 0x00200000 /* CPUID detection flag */ -+#define X86_EFLAGS_CF_BIT 0 /* Carry Flag */ -+#define X86_EFLAGS_CF _BITUL(X86_EFLAGS_CF_BIT) -+#define X86_EFLAGS_FIXED_BIT 1 /* Bit 1 - always on */ -+#define X86_EFLAGS_FIXED _BITUL(X86_EFLAGS_FIXED_BIT) -+#define X86_EFLAGS_PF_BIT 2 /* Parity Flag */ -+#define X86_EFLAGS_PF _BITUL(X86_EFLAGS_PF_BIT) -+#define X86_EFLAGS_AF_BIT 4 /* Auxiliary carry Flag */ -+#define X86_EFLAGS_AF _BITUL(X86_EFLAGS_AF_BIT) -+#define X86_EFLAGS_ZF_BIT 6 /* Zero Flag */ -+#define X86_EFLAGS_ZF _BITUL(X86_EFLAGS_ZF_BIT) -+#define X86_EFLAGS_SF_BIT 7 /* Sign Flag */ -+#define X86_EFLAGS_SF _BITUL(X86_EFLAGS_SF_BIT) -+#define X86_EFLAGS_TF_BIT 8 /* Trap Flag */ -+#define X86_EFLAGS_TF _BITUL(X86_EFLAGS_TF_BIT) -+#define X86_EFLAGS_IF_BIT 9 /* Interrupt Flag */ -+#define X86_EFLAGS_IF _BITUL(X86_EFLAGS_IF_BIT) -+#define X86_EFLAGS_DF_BIT 10 /* Direction Flag */ -+#define X86_EFLAGS_DF _BITUL(X86_EFLAGS_DF_BIT) -+#define X86_EFLAGS_OF_BIT 11 /* Overflow Flag */ -+#define X86_EFLAGS_OF _BITUL(X86_EFLAGS_OF_BIT) -+#define X86_EFLAGS_IOPL_BIT 12 /* I/O Privilege Level (2 bits) */ -+#define X86_EFLAGS_IOPL (_AC(3,UL) << X86_EFLAGS_IOPL_BIT) -+#define X86_EFLAGS_NT_BIT 14 /* Nested Task */ -+#define X86_EFLAGS_NT _BITUL(X86_EFLAGS_NT_BIT) -+#define X86_EFLAGS_RF_BIT 16 /* Resume Flag */ -+#define X86_EFLAGS_RF _BITUL(X86_EFLAGS_RF_BIT) -+#define X86_EFLAGS_VM_BIT 17 /* Virtual Mode */ -+#define X86_EFLAGS_VM _BITUL(X86_EFLAGS_VM_BIT) -+#define X86_EFLAGS_AC_BIT 18 /* Alignment Check/Access Control */ -+#define X86_EFLAGS_AC _BITUL(X86_EFLAGS_AC_BIT) -+#define X86_EFLAGS_AC_BIT 18 /* Alignment Check/Access Control */ -+#define X86_EFLAGS_AC _BITUL(X86_EFLAGS_AC_BIT) -+#define X86_EFLAGS_VIF_BIT 19 /* Virtual Interrupt Flag */ -+#define X86_EFLAGS_VIF _BITUL(X86_EFLAGS_VIF_BIT) -+#define X86_EFLAGS_VIP_BIT 20 /* Virtual Interrupt Pending */ -+#define X86_EFLAGS_VIP _BITUL(X86_EFLAGS_VIP_BIT) -+#define X86_EFLAGS_ID_BIT 21 /* CPUID detection */ -+#define X86_EFLAGS_ID _BITUL(X86_EFLAGS_ID_BIT) - - /* - * Basic CPU control in CR0 - */ --#define X86_CR0_PE 0x00000001 /* Protection Enable */ --#define X86_CR0_MP 0x00000002 /* Monitor Coprocessor */ --#define X86_CR0_EM 0x00000004 /* Emulation */ --#define X86_CR0_TS 0x00000008 /* Task Switched */ --#define X86_CR0_ET 0x00000010 /* Extension Type */ --#define X86_CR0_NE 0x00000020 /* Numeric Error */ --#define X86_CR0_WP 0x00010000 /* Write Protect */ --#define X86_CR0_AM 0x00040000 /* Alignment Mask */ --#define X86_CR0_NW 0x20000000 /* Not Write-through */ --#define X86_CR0_CD 0x40000000 /* Cache Disable */ --#define X86_CR0_PG 0x80000000 /* Paging */ -+#define X86_CR0_PE_BIT 0 /* Protection Enable */ -+#define X86_CR0_PE _BITUL(X86_CR0_PE_BIT) -+#define X86_CR0_MP_BIT 1 /* Monitor Coprocessor */ -+#define X86_CR0_MP _BITUL(X86_CR0_MP_BIT) -+#define X86_CR0_EM_BIT 2 /* Emulation */ -+#define X86_CR0_EM _BITUL(X86_CR0_EM_BIT) -+#define X86_CR0_TS_BIT 3 /* Task Switched */ -+#define X86_CR0_TS _BITUL(X86_CR0_TS_BIT) -+#define X86_CR0_ET_BIT 4 /* Extension Type */ -+#define X86_CR0_ET _BITUL(X86_CR0_ET_BIT) -+#define X86_CR0_NE_BIT 5 /* Numeric Error */ -+#define X86_CR0_NE _BITUL(X86_CR0_NE_BIT) -+#define X86_CR0_WP_BIT 16 /* Write Protect */ -+#define X86_CR0_WP _BITUL(X86_CR0_WP_BIT) -+#define X86_CR0_AM_BIT 18 /* Alignment Mask */ -+#define X86_CR0_AM _BITUL(X86_CR0_AM_BIT) -+#define X86_CR0_NW_BIT 29 /* Not Write-through */ -+#define X86_CR0_NW _BITUL(X86_CR0_NW_BIT) -+#define X86_CR0_CD_BIT 30 /* Cache Disable */ -+#define X86_CR0_CD _BITUL(X86_CR0_CD_BIT) -+#define X86_CR0_PG_BIT 31 /* Paging */ -+#define X86_CR0_PG _BITUL(X86_CR0_PG_BIT) - - /* - * Paging options in CR3 - */ --#define X86_CR3_PWT 0x00000008 /* Page Write Through */ --#define X86_CR3_PCD 0x00000010 /* Page Cache Disable */ --#define X86_CR3_PCID_MASK 0x00000fff /* PCID Mask */ -+#define X86_CR3_PWT_BIT 3 /* Page Write Through */ -+#define X86_CR3_PWT _BITUL(X86_CR3_PWT_BIT) -+#define X86_CR3_PCD_BIT 4 /* Page Cache Disable */ -+#define X86_CR3_PCD _BITUL(X86_CR3_PCD_BIT) -+#define X86_CR3_PCID_MASK _AC(0x00000fff,UL) /* PCID Mask */ - - /* - * Intel CPU features in CR4 - */ --#define X86_CR4_VME 0x00000001 /* enable vm86 extensions */ --#define X86_CR4_PVI 0x00000002 /* virtual interrupts flag enable */ --#define X86_CR4_TSD 0x00000004 /* disable time stamp at ipl 3 */ --#define X86_CR4_DE 0x00000008 /* enable debugging extensions */ --#define X86_CR4_PSE 0x00000010 /* enable page size extensions */ --#define X86_CR4_PAE 0x00000020 /* enable physical address extensions */ --#define X86_CR4_MCE 0x00000040 /* Machine check enable */ --#define X86_CR4_PGE 0x00000080 /* enable global pages */ --#define X86_CR4_PCE 0x00000100 /* enable performance counters at ipl 3 */ --#define X86_CR4_OSFXSR 0x00000200 /* enable fast FPU save and restore */ --#define X86_CR4_OSXMMEXCPT 0x00000400 /* enable unmasked SSE exceptions */ --#define X86_CR4_VMXE 0x00002000 /* enable VMX virtualization */ --#define X86_CR4_RDWRGSFS 0x00010000 /* enable RDWRGSFS support */ --#define X86_CR4_PCIDE 0x00020000 /* enable PCID support */ --#define X86_CR4_OSXSAVE 0x00040000 /* enable xsave and xrestore */ --#define X86_CR4_SMEP 0x00100000 /* enable SMEP support */ --#define X86_CR4_SMAP 0x00200000 /* enable SMAP support */ -+#define X86_CR4_VME_BIT 0 /* enable vm86 extensions */ -+#define X86_CR4_VME _BITUL(X86_CR4_VME_BIT) -+#define X86_CR4_PVI_BIT 1 /* virtual interrupts flag enable */ -+#define X86_CR4_PVI _BITUL(X86_CR4_PVI_BIT) -+#define X86_CR4_TSD_BIT 2 /* disable time stamp at ipl 3 */ -+#define X86_CR4_TSD _BITUL(X86_CR4_TSD_BIT) -+#define X86_CR4_DE_BIT 3 /* enable debugging extensions */ -+#define X86_CR4_DE _BITUL(X86_CR4_DE_BIT) -+#define X86_CR4_PSE_BIT 4 /* enable page size extensions */ -+#define X86_CR4_PSE _BITUL(X86_CR4_PSE_BIT) -+#define X86_CR4_PAE_BIT 5 /* enable physical address extensions */ -+#define X86_CR4_PAE _BITUL(X86_CR4_PAE_BIT) -+#define X86_CR4_MCE_BIT 6 /* Machine check enable */ -+#define X86_CR4_MCE _BITUL(X86_CR4_MCE_BIT) -+#define X86_CR4_PGE_BIT 7 /* enable global pages */ -+#define X86_CR4_PGE _BITUL(X86_CR4_PGE_BIT) -+#define X86_CR4_PCE_BIT 8 /* enable performance counters at ipl 3 */ -+#define X86_CR4_PCE _BITUL(X86_CR4_PCE_BIT) -+#define X86_CR4_OSFXSR_BIT 9 /* enable fast FPU save and restore */ -+#define X86_CR4_OSFXSR _BITUL(X86_CR4_OSFXSR_BIT) -+#define X86_CR4_OSXMMEXCPT_BIT 10 /* enable unmasked SSE exceptions */ -+#define X86_CR4_OSXMMEXCPT _BITUL(X86_CR4_OSXMMEXCPT_BIT) -+#define X86_CR4_VMXE_BIT 13 /* enable VMX virtualization */ -+#define X86_CR4_VMXE _BITUL(X86_CR4_VMXE_BIT) -+#define X86_CR4_SMXE_BIT 14 /* enable safer mode (TXT) */ -+#define X86_CR4_SMXE _BITUL(X86_CR4_SMXE_BIT) -+#define X86_CR4_FSGSBASE_BIT 16 /* enable RDWRFSGS support */ -+#define X86_CR4_FSGSBASE _BITUL(X86_CR4_FSGSBASE_BIT) -+#define X86_CR4_PCIDE_BIT 17 /* enable PCID support */ -+#define X86_CR4_PCIDE _BITUL(X86_CR4_PCIDE_BIT) -+#define X86_CR4_OSXSAVE_BIT 18 /* enable xsave and xrestore */ -+#define X86_CR4_OSXSAVE _BITUL(X86_CR4_OSXSAVE_BIT) -+#define X86_CR4_SMEP_BIT 20 /* enable SMEP support */ -+#define X86_CR4_SMEP _BITUL(X86_CR4_SMEP_BIT) -+#define X86_CR4_SMAP_BIT 21 /* enable SMAP support */ -+#define X86_CR4_SMAP _BITUL(X86_CR4_SMAP_BIT) - - /* - * x86-64 Task Priority Register, CR8 - */ --#define X86_CR8_TPR 0x0000000F /* task priority register */ -+#define X86_CR8_TPR _AC(0x0000000f,UL) /* task priority register */ - - /* - * AMD and Transmeta use MSRs for configuration; see -diff --git a/arch/x86/kernel/cpu/perf_event.h b/arch/x86/kernel/cpu/perf_event.h -index ba9aadfa683b..5fd0bbe1aeb0 100644 ---- a/arch/x86/kernel/cpu/perf_event.h -+++ b/arch/x86/kernel/cpu/perf_event.h -@@ -665,6 +665,8 @@ void intel_pmu_lbr_init_atom(void); - - void intel_pmu_lbr_init_snb(void); - -+void intel_pmu_pebs_data_source_nhm(void); -+ - int intel_pmu_setup_lbr_filter(struct perf_event *event); - - int p4_pmu_init(void); -diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c -index 6d6bb6f4fd43..ac057583282a 100644 ---- a/arch/x86/kernel/cpu/perf_event_intel.c -+++ b/arch/x86/kernel/cpu/perf_event_intel.c -@@ -2088,6 +2088,7 @@ __init int intel_pmu_init(void) - intel_perfmon_event_map[PERF_COUNT_HW_STALLED_CYCLES_BACKEND] = - X86_CONFIG(.event=0xb1, .umask=0x3f, .inv=1, .cmask=1); - -+ intel_pmu_pebs_data_source_nhm(); - x86_add_quirk(intel_nehalem_quirk); - - pr_cont("Nehalem events, "); -@@ -2133,6 +2134,7 @@ __init int intel_pmu_init(void) - intel_perfmon_event_map[PERF_COUNT_HW_STALLED_CYCLES_BACKEND] = - X86_CONFIG(.event=0xb1, .umask=0x3f, .inv=1, .cmask=1); - -+ intel_pmu_pebs_data_source_nhm(); - pr_cont("Westmere events, "); - break; - -diff --git a/arch/x86/kernel/cpu/perf_event_intel_ds.c b/arch/x86/kernel/cpu/perf_event_intel_ds.c -index 60250f687052..17b090a298b4 100644 ---- a/arch/x86/kernel/cpu/perf_event_intel_ds.c -+++ b/arch/x86/kernel/cpu/perf_event_intel_ds.c -@@ -50,7 +50,8 @@ union intel_x86_pebs_dse { - #define OP_LH (P(OP, LOAD) | P(LVL, HIT)) - #define SNOOP_NONE_MISS (P(SNOOP, NONE) | P(SNOOP, MISS)) - --static const u64 pebs_data_source[] = { -+/* Version for Sandy Bridge and later */ -+static u64 pebs_data_source[] = { - P(OP, LOAD) | P(LVL, MISS) | P(LVL, L3) | P(SNOOP, NA),/* 0x00:ukn L3 */ - OP_LH | P(LVL, L1) | P(SNOOP, NONE), /* 0x01: L1 local */ - OP_LH | P(LVL, LFB) | P(SNOOP, NONE), /* 0x02: LFB hit */ -@@ -69,6 +70,14 @@ static const u64 pebs_data_source[] = { - OP_LH | P(LVL, UNC) | P(SNOOP, NONE), /* 0x0f: uncached */ - }; - -+/* Patch up minor differences in the bits */ -+void __init intel_pmu_pebs_data_source_nhm(void) -+{ -+ pebs_data_source[0x05] = OP_LH | P(LVL, L3) | P(SNOOP, HIT); -+ pebs_data_source[0x06] = OP_LH | P(LVL, L3) | P(SNOOP, HITM); -+ pebs_data_source[0x07] = OP_LH | P(LVL, L3) | P(SNOOP, HITM); -+} -+ - static u64 precise_store_data(u64 status) - { - union intel_x86_pebs_dse dse; -diff --git a/arch/x86/kernel/ioport.c b/arch/x86/kernel/ioport.c -index 4ddaf66ea35f..792621a32457 100644 ---- a/arch/x86/kernel/ioport.c -+++ b/arch/x86/kernel/ioport.c -@@ -96,9 +96,14 @@ asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int turn_on) - SYSCALL_DEFINE1(iopl, unsigned int, level) - { - struct pt_regs *regs = current_pt_regs(); -- unsigned int old = (regs->flags >> 12) & 3; - struct thread_struct *t = ¤t->thread; - -+ /* -+ * Careful: the IOPL bits in regs->flags are undefined under Xen PV -+ * and changing them has no effect. -+ */ -+ unsigned int old = t->iopl >> X86_EFLAGS_IOPL_BIT; -+ - if (level > 3) - return -EINVAL; - /* Trying to gain more privileges? */ -@@ -106,8 +111,9 @@ SYSCALL_DEFINE1(iopl, unsigned int, level) - if (!capable(CAP_SYS_RAWIO)) - return -EPERM; - } -- regs->flags = (regs->flags & ~X86_EFLAGS_IOPL) | (level << 12); -- t->iopl = level << 12; -+ regs->flags = (regs->flags & ~X86_EFLAGS_IOPL) | -+ (level << X86_EFLAGS_IOPL_BIT); -+ t->iopl = level << X86_EFLAGS_IOPL_BIT; - set_iopl_mask(t->iopl); - - return 0; -diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c -index 7099ab1e075b..580001c2b69a 100644 ---- a/arch/x86/kernel/process_64.c -+++ b/arch/x86/kernel/process_64.c -@@ -49,6 +49,7 @@ - #include - #include - #include -+#include - - asmlinkage extern void ret_from_fork(void); - -@@ -412,6 +413,17 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p) - task_thread_info(prev_p)->flags & _TIF_WORK_CTXSW_PREV)) - __switch_to_xtra(prev_p, next_p, tss); - -+#ifdef CONFIG_XEN -+ /* -+ * On Xen PV, IOPL bits in pt_regs->flags have no effect, and -+ * current_pt_regs()->flags may not match the current task's -+ * intended IOPL. We need to switch it manually. -+ */ -+ if (unlikely(xen_pv_domain() && -+ prev->iopl != next->iopl)) -+ xen_set_iopl_mask(next->iopl); -+#endif -+ - return prev_p; - } - -diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c -index 1406ffde3e35..b0a706d063cb 100644 ---- a/arch/x86/kvm/i8254.c -+++ b/arch/x86/kvm/i8254.c -@@ -244,7 +244,7 @@ static void kvm_pit_ack_irq(struct kvm_irq_ack_notifier *kian) - * PIC is being reset. Handle it gracefully here - */ - atomic_inc(&ps->pending); -- else if (value > 0) -+ else if (value > 0 && ps->reinject) - /* in this case, we had multiple outstanding pit interrupts - * that we needed to inject. Reinject - */ -@@ -287,7 +287,9 @@ static void pit_do_work(struct kthread_work *work) - * last one has been acked. - */ - spin_lock(&ps->inject_lock); -- if (ps->irq_ack) { -+ if (!ps->reinject) -+ inject = 1; -+ else if (ps->irq_ack) { - ps->irq_ack = 0; - inject = 1; - } -@@ -316,10 +318,10 @@ static enum hrtimer_restart pit_timer_fn(struct hrtimer *data) - struct kvm_kpit_state *ps = container_of(data, struct kvm_kpit_state, timer); - struct kvm_pit *pt = ps->kvm->arch.vpit; - -- if (ps->reinject || !atomic_read(&ps->pending)) { -+ if (ps->reinject) - atomic_inc(&ps->pending); -- queue_kthread_work(&pt->worker, &pt->expired); -- } -+ -+ queue_kthread_work(&pt->worker, &pt->expired); - - if (ps->is_periodic) { - hrtimer_add_expires_ns(&ps->timer, ps->period); -diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c -index 7f2b6dec4b2b..3c0b085b4336 100644 ---- a/arch/x86/kvm/x86.c -+++ b/arch/x86/kvm/x86.c -@@ -626,7 +626,7 @@ int kvm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) - if (!guest_cpuid_has_smep(vcpu) && (cr4 & X86_CR4_SMEP)) - return 1; - -- if (!guest_cpuid_has_fsgsbase(vcpu) && (cr4 & X86_CR4_RDWRGSFS)) -+ if (!guest_cpuid_has_fsgsbase(vcpu) && (cr4 & X86_CR4_FSGSBASE)) - return 1; - - if (is_long_mode(vcpu)) { -diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c -index 91cbe75a91d5..34511cf6baad 100644 ---- a/arch/x86/xen/enlighten.c -+++ b/arch/x86/xen/enlighten.c -@@ -952,7 +952,7 @@ static void xen_load_sp0(struct tss_struct *tss, - xen_mc_issue(PARAVIRT_LAZY_CPU); - } - --static void xen_set_iopl_mask(unsigned mask) -+void xen_set_iopl_mask(unsigned mask) - { - struct physdev_set_iopl set_iopl; - -diff --git a/arch/xtensa/kernel/head.S b/arch/xtensa/kernel/head.S -index 7d740ebbe198..bb12d778f64f 100644 ---- a/arch/xtensa/kernel/head.S -+++ b/arch/xtensa/kernel/head.S -@@ -118,7 +118,7 @@ ENTRY(_startup) - wsr a0, icountlevel - - .set _index, 0 -- .rept XCHAL_NUM_DBREAK - 1 -+ .rept XCHAL_NUM_DBREAK - wsr a0, SREG_DBREAKC + _index - .set _index, _index + 1 - .endr -diff --git a/arch/xtensa/platforms/iss/console.c b/arch/xtensa/platforms/iss/console.c -index 70cb408bc20d..92d785fefb6d 100644 ---- a/arch/xtensa/platforms/iss/console.c -+++ b/arch/xtensa/platforms/iss/console.c -@@ -100,21 +100,23 @@ static void rs_poll(unsigned long priv) - { - struct tty_port *port = (struct tty_port *)priv; - int i = 0; -+ int rd = 1; - unsigned char c; - - spin_lock(&timer_lock); - - while (simc_poll(0)) { -- simc_read(0, &c, 1); -+ rd = simc_read(0, &c, 1); -+ if (rd <= 0) -+ break; - tty_insert_flip_char(port, c, TTY_NORMAL); - i++; - } - - if (i) - tty_flip_buffer_push(port); -- -- -- mod_timer(&serial_timer, jiffies + SERIAL_TIMER_VALUE); -+ if (rd) -+ mod_timer(&serial_timer, jiffies + SERIAL_TIMER_VALUE); - spin_unlock(&timer_lock); - } - -diff --git a/crypto/ahash.c b/crypto/ahash.c -index 857ae2b2a2a2..bcd5efc7eb4c 100644 ---- a/crypto/ahash.c -+++ b/crypto/ahash.c -@@ -64,8 +64,9 @@ static int hash_walk_new_entry(struct crypto_hash_walk *walk) - struct scatterlist *sg; - - sg = walk->sg; -- walk->pg = sg_page(sg); - walk->offset = sg->offset; -+ walk->pg = sg_page(walk->sg) + (walk->offset >> PAGE_SHIFT); -+ walk->offset = offset_in_page(walk->offset); - walk->entrylen = sg->length; - - if (walk->entrylen > walk->total) -diff --git a/crypto/gcm.c b/crypto/gcm.c -index b4c252066f7b..cd97cdd8cabe 100644 ---- a/crypto/gcm.c -+++ b/crypto/gcm.c -@@ -1173,6 +1173,9 @@ static struct aead_request *crypto_rfc4543_crypt(struct aead_request *req, - aead_request_set_tfm(subreq, ctx->child); - aead_request_set_callback(subreq, req->base.flags, crypto_rfc4543_done, - req); -+ if (!enc) -+ aead_request_set_callback(subreq, req->base.flags, -+ req->base.complete, req->base.data); - aead_request_set_crypt(subreq, cipher, cipher, enc ? 0 : authsize, iv); - aead_request_set_assoc(subreq, assoc, assoclen); - -diff --git a/drivers/acpi/acpica/dsmethod.c b/drivers/acpi/acpica/dsmethod.c -index a9ffd44c18fe..2184259c386b 100644 ---- a/drivers/acpi/acpica/dsmethod.c -+++ b/drivers/acpi/acpica/dsmethod.c -@@ -267,6 +267,9 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node, - obj_desc->method.mutex->mutex. - original_sync_level = - obj_desc->method.mutex->mutex.sync_level; -+ -+ obj_desc->method.mutex->mutex.thread_id = -+ acpi_os_get_thread_id(); - } - } - -diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c -index a5c987ae665d..d593fa5247f5 100644 ---- a/drivers/block/nbd.c -+++ b/drivers/block/nbd.c -@@ -581,8 +581,8 @@ static void do_nbd_request(struct request_queue *q) - BUG_ON(nbd->magic != NBD_MAGIC); - - if (unlikely(!nbd->sock)) { -- dev_err(disk_to_dev(nbd->disk), -- "Attempted send on closed socket\n"); -+ dev_err_ratelimited(disk_to_dev(nbd->disk), -+ "Attempted send on closed socket\n"); - req->errors++; - nbd_end_request(req); - spin_lock_irq(q->queue_lock); -diff --git a/drivers/block/paride/pd.c b/drivers/block/paride/pd.c -index 19ad8f0c83ef..897b6b9e53b1 100644 ---- a/drivers/block/paride/pd.c -+++ b/drivers/block/paride/pd.c -@@ -126,7 +126,7 @@ - */ - #include - --static bool verbose = 0; -+static int verbose = 0; - static int major = PD_MAJOR; - static char *name = PD_NAME; - static int cluster = 64; -@@ -161,7 +161,7 @@ enum {D_PRT, D_PRO, D_UNI, D_MOD, D_GEO, D_SBY, D_DLY, D_SLV}; - static DEFINE_MUTEX(pd_mutex); - static DEFINE_SPINLOCK(pd_lock); - --module_param(verbose, bool, 0); -+module_param(verbose, int, 0); - module_param(major, int, 0); - module_param(name, charp, 0); - module_param(cluster, int, 0); -diff --git a/drivers/block/paride/pt.c b/drivers/block/paride/pt.c -index 2596042eb987..ada45058e04d 100644 ---- a/drivers/block/paride/pt.c -+++ b/drivers/block/paride/pt.c -@@ -117,7 +117,7 @@ - - */ - --static bool verbose = 0; -+static int verbose = 0; - static int major = PT_MAJOR; - static char *name = PT_NAME; - static int disable = 0; -@@ -152,7 +152,7 @@ static int (*drives[4])[6] = {&drive0, &drive1, &drive2, &drive3}; - - #include - --module_param(verbose, bool, 0); -+module_param(verbose, int, 0); - module_param(major, int, 0); - module_param(name, charp, 0); - module_param_array(drive0, int, NULL, 0); -diff --git a/drivers/bluetooth/hci_vhci.c b/drivers/bluetooth/hci_vhci.c -index d8b7aed6e4a9..f3ce1c4f83e0 100644 ---- a/drivers/bluetooth/hci_vhci.c -+++ b/drivers/bluetooth/hci_vhci.c -@@ -265,6 +265,7 @@ static int vhci_release(struct inode *inode, struct file *file) - hci_unregister_dev(hdev); - hci_free_dev(hdev); - -+ skb_queue_purge(&data->readq); - file->private_data = NULL; - kfree(data); - -diff --git a/drivers/clk/versatile/clk-sp810.c b/drivers/clk/versatile/clk-sp810.c -index b9e05bde0c06..a21e2fa66a2a 100644 ---- a/drivers/clk/versatile/clk-sp810.c -+++ b/drivers/clk/versatile/clk-sp810.c -@@ -141,6 +141,7 @@ void __init clk_sp810_of_setup(struct device_node *node) - const char *parent_names[2]; - char name[12]; - struct clk_init_data init; -+ static int instance; - int i; - - if (!sp810) { -@@ -172,7 +173,7 @@ void __init clk_sp810_of_setup(struct device_node *node) - init.num_parents = ARRAY_SIZE(parent_names); - - for (i = 0; i < ARRAY_SIZE(sp810->timerclken); i++) { -- snprintf(name, ARRAY_SIZE(name), "timerclken%d", i); -+ snprintf(name, sizeof(name), "sp810_%d_%d", instance, i); - - sp810->timerclken[i].sp810 = sp810; - sp810->timerclken[i].channel = i; -@@ -184,5 +185,6 @@ void __init clk_sp810_of_setup(struct device_node *node) - } - - of_clk_add_provider(node, clk_sp810_timerclken_of_get, sp810); -+ instance++; - } - CLK_OF_DECLARE(sp810, "arm,sp810", clk_sp810_of_setup); -diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c -index 8b3d90143514..19353112cf10 100644 ---- a/drivers/edac/amd64_edac.c -+++ b/drivers/edac/amd64_edac.c -@@ -1266,7 +1266,7 @@ static u64 f1x_get_norm_dct_addr(struct amd64_pvt *pvt, u8 range, - u64 chan_off; - u64 dram_base = get_dram_base(pvt, range); - u64 hole_off = f10_dhar_offset(pvt); -- u64 dct_sel_base_off = (pvt->dct_sel_hi & 0xFFFFFC00) << 16; -+ u64 dct_sel_base_off = (u64)(pvt->dct_sel_hi & 0xFFFFFC00) << 16; - - if (hi_rng) { - /* -diff --git a/drivers/edac/i7core_edac.c b/drivers/edac/i7core_edac.c -index 271818a5a33a..c4131a7a2b46 100644 ---- a/drivers/edac/i7core_edac.c -+++ b/drivers/edac/i7core_edac.c -@@ -1878,7 +1878,7 @@ static int i7core_mce_check_error(struct notifier_block *nb, unsigned long val, - - i7_dev = get_i7core_dev(mce->socketid); - if (!i7_dev) -- return NOTIFY_BAD; -+ return NOTIFY_DONE; - - mci = i7_dev->mci; - pvt = mci->pvt_info; -diff --git a/drivers/edac/sb_edac.c b/drivers/edac/sb_edac.c -index 3bdefbfb4377..0d40f7f0c379 100644 ---- a/drivers/edac/sb_edac.c -+++ b/drivers/edac/sb_edac.c -@@ -1538,7 +1538,7 @@ static int sbridge_mce_check_error(struct notifier_block *nb, unsigned long val, - - mci = get_mci_for_node_id(mce->socketid); - if (!mci) -- return NOTIFY_BAD; -+ return NOTIFY_DONE; - pvt = mci->pvt_info; - - /* -diff --git a/drivers/firmware/efi/vars.c b/drivers/firmware/efi/vars.c -index 9f82b5545edd..61e7ec5a742c 100644 ---- a/drivers/firmware/efi/vars.c -+++ b/drivers/firmware/efi/vars.c -@@ -202,29 +202,44 @@ static const struct variable_validate variable_validate[] = { - { NULL_GUID, "", NULL }, - }; - -+/* -+ * Check if @var_name matches the pattern given in @match_name. -+ * -+ * @var_name: an array of @len non-NUL characters. -+ * @match_name: a NUL-terminated pattern string, optionally ending in "*". A -+ * final "*" character matches any trailing characters @var_name, -+ * including the case when there are none left in @var_name. -+ * @match: on output, the number of non-wildcard characters in @match_name -+ * that @var_name matches, regardless of the return value. -+ * @return: whether @var_name fully matches @match_name. -+ */ - static bool - variable_matches(const char *var_name, size_t len, const char *match_name, - int *match) - { - for (*match = 0; ; (*match)++) { - char c = match_name[*match]; -- char u = var_name[*match]; - -- /* Wildcard in the matching name means we've matched */ -- if (c == '*') -+ switch (c) { -+ case '*': -+ /* Wildcard in @match_name means we've matched. */ - return true; - -- /* Case sensitive match */ -- if (!c && *match == len) -- return true; -+ case '\0': -+ /* @match_name has ended. Has @var_name too? */ -+ return (*match == len); - -- if (c != u) -+ default: -+ /* -+ * We've reached a non-wildcard char in @match_name. -+ * Continue only if there's an identical character in -+ * @var_name. -+ */ -+ if (*match < len && c == var_name[*match]) -+ continue; - return false; -- -- if (!c) -- return true; -+ } - } -- return true; - } - - bool -diff --git a/drivers/gpu/drm/radeon/atombios_encoders.c b/drivers/gpu/drm/radeon/atombios_encoders.c -index 1b564d7e4191..5b8d868d8691 100644 ---- a/drivers/gpu/drm/radeon/atombios_encoders.c -+++ b/drivers/gpu/drm/radeon/atombios_encoders.c -@@ -870,8 +870,6 @@ atombios_dig_encoder_setup(struct drm_encoder *encoder, int action, int panel_mo - else - args.v1.ucLaneNum = 4; - -- if (ENCODER_MODE_IS_DP(args.v1.ucEncoderMode) && (dp_clock == 270000)) -- args.v1.ucConfig |= ATOM_ENCODER_CONFIG_DPLINKRATE_2_70GHZ; - switch (radeon_encoder->encoder_id) { - case ENCODER_OBJECT_ID_INTERNAL_UNIPHY: - args.v1.ucConfig = ATOM_ENCODER_CONFIG_V2_TRANSMITTER1; -@@ -888,6 +886,10 @@ atombios_dig_encoder_setup(struct drm_encoder *encoder, int action, int panel_mo - args.v1.ucConfig |= ATOM_ENCODER_CONFIG_LINKB; - else - args.v1.ucConfig |= ATOM_ENCODER_CONFIG_LINKA; -+ -+ if (ENCODER_MODE_IS_DP(args.v1.ucEncoderMode) && (dp_clock == 270000)) -+ args.v1.ucConfig |= ATOM_ENCODER_CONFIG_DPLINKRATE_2_70GHZ; -+ - break; - case 2: - case 3: -diff --git a/drivers/gpu/drm/radeon/radeon_sa.c b/drivers/gpu/drm/radeon/radeon_sa.c -index f0bac68254b7..8962411b5f2b 100644 ---- a/drivers/gpu/drm/radeon/radeon_sa.c -+++ b/drivers/gpu/drm/radeon/radeon_sa.c -@@ -349,8 +349,15 @@ int radeon_sa_bo_new(struct radeon_device *rdev, - /* see if we can skip over some allocations */ - } while (radeon_sa_bo_next_hole(sa_manager, fences, tries)); - -+ for (i = 0; i < RADEON_NUM_RINGS; ++i) { -+ if (fences[i]) -+ radeon_fence_ref(fences[i]); -+ } -+ - spin_unlock(&sa_manager->wq.lock); - r = radeon_fence_wait_any(rdev, fences, false); -+ for (i = 0; i < RADEON_NUM_RINGS; ++i) -+ radeon_fence_unref(&fences[i]); - spin_lock(&sa_manager->wq.lock); - /* if we have nothing to wait for block */ - if (r == -ENOENT && block) { -diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c -index 5da58e3899eb..92aef9824d6f 100644 ---- a/drivers/hid/usbhid/hid-core.c -+++ b/drivers/hid/usbhid/hid-core.c -@@ -988,14 +988,6 @@ static int usbhid_output_raw_report(struct hid_device *hid, __u8 *buf, size_t co - return ret; - } - --static void usbhid_restart_queues(struct usbhid_device *usbhid) --{ -- if (usbhid->urbout && !test_bit(HID_OUT_RUNNING, &usbhid->iofl)) -- usbhid_restart_out_queue(usbhid); -- if (!test_bit(HID_CTRL_RUNNING, &usbhid->iofl)) -- usbhid_restart_ctrl_queue(usbhid); --} -- - static void hid_free_buffers(struct usb_device *dev, struct hid_device *hid) - { - struct usbhid_device *usbhid = hid->driver_data; -@@ -1412,6 +1404,37 @@ static void hid_cease_io(struct usbhid_device *usbhid) - usb_kill_urb(usbhid->urbout); - } - -+static void hid_restart_io(struct hid_device *hid) -+{ -+ struct usbhid_device *usbhid = hid->driver_data; -+ int clear_halt = test_bit(HID_CLEAR_HALT, &usbhid->iofl); -+ int reset_pending = test_bit(HID_RESET_PENDING, &usbhid->iofl); -+ -+ spin_lock_irq(&usbhid->lock); -+ clear_bit(HID_SUSPENDED, &usbhid->iofl); -+ usbhid_mark_busy(usbhid); -+ -+ if (clear_halt || reset_pending) -+ schedule_work(&usbhid->reset_work); -+ usbhid->retry_delay = 0; -+ spin_unlock_irq(&usbhid->lock); -+ -+ if (reset_pending || !test_bit(HID_STARTED, &usbhid->iofl)) -+ return; -+ -+ if (!clear_halt) { -+ if (hid_start_in(hid) < 0) -+ hid_io_error(hid); -+ } -+ -+ spin_lock_irq(&usbhid->lock); -+ if (usbhid->urbout && !test_bit(HID_OUT_RUNNING, &usbhid->iofl)) -+ usbhid_restart_out_queue(usbhid); -+ if (!test_bit(HID_CTRL_RUNNING, &usbhid->iofl)) -+ usbhid_restart_ctrl_queue(usbhid); -+ spin_unlock_irq(&usbhid->lock); -+} -+ - /* Treat USB reset pretty much the same as suspend/resume */ - static int hid_pre_reset(struct usb_interface *intf) - { -@@ -1461,14 +1484,14 @@ static int hid_post_reset(struct usb_interface *intf) - return 1; - } - -+ /* No need to do another reset or clear a halted endpoint */ - spin_lock_irq(&usbhid->lock); - clear_bit(HID_RESET_PENDING, &usbhid->iofl); -+ clear_bit(HID_CLEAR_HALT, &usbhid->iofl); - spin_unlock_irq(&usbhid->lock); - hid_set_idle(dev, intf->cur_altsetting->desc.bInterfaceNumber, 0, 0); -- status = hid_start_in(hid); -- if (status < 0) -- hid_io_error(hid); -- usbhid_restart_queues(usbhid); -+ -+ hid_restart_io(hid); - - return 0; - } -@@ -1491,25 +1514,9 @@ void usbhid_put_power(struct hid_device *hid) - #ifdef CONFIG_PM - static int hid_resume_common(struct hid_device *hid, bool driver_suspended) - { -- struct usbhid_device *usbhid = hid->driver_data; -- int status; -- -- spin_lock_irq(&usbhid->lock); -- clear_bit(HID_SUSPENDED, &usbhid->iofl); -- usbhid_mark_busy(usbhid); -- -- if (test_bit(HID_CLEAR_HALT, &usbhid->iofl) || -- test_bit(HID_RESET_PENDING, &usbhid->iofl)) -- schedule_work(&usbhid->reset_work); -- usbhid->retry_delay = 0; -- -- usbhid_restart_queues(usbhid); -- spin_unlock_irq(&usbhid->lock); -- -- status = hid_start_in(hid); -- if (status < 0) -- hid_io_error(hid); -+ int status = 0; - -+ hid_restart_io(hid); - if (driver_suspended && hid->driver && hid->driver->resume) - status = hid->driver->resume(hid); - return status; -@@ -1576,12 +1583,8 @@ static int hid_suspend(struct usb_interface *intf, pm_message_t message) - static int hid_resume(struct usb_interface *intf) - { - struct hid_device *hid = usb_get_intfdata (intf); -- struct usbhid_device *usbhid = hid->driver_data; - int status; - -- if (!test_bit(HID_STARTED, &usbhid->iofl)) -- return 0; -- - status = hid_resume_common(hid, true); - dev_dbg(&intf->dev, "resume status %d\n", status); - return 0; -@@ -1590,10 +1593,8 @@ static int hid_resume(struct usb_interface *intf) - static int hid_reset_resume(struct usb_interface *intf) - { - struct hid_device *hid = usb_get_intfdata(intf); -- struct usbhid_device *usbhid = hid->driver_data; - int status; - -- clear_bit(HID_SUSPENDED, &usbhid->iofl); - status = hid_post_reset(intf); - if (status >= 0 && hid->driver && hid->driver->reset_resume) { - int ret = hid->driver->reset_resume(hid); -diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c -index f445b0840d33..80754e2d8086 100644 ---- a/drivers/hv/vmbus_drv.c -+++ b/drivers/hv/vmbus_drv.c -@@ -32,6 +32,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -517,6 +518,39 @@ static void vmbus_flow_handler(unsigned int irq, struct irq_desc *desc) - desc->action->handler(irq, desc->action->dev_id); - } - -+#ifdef CONFIG_HOTPLUG_CPU -+static int hyperv_cpu_disable(void) -+{ -+ return -ENOSYS; -+} -+ -+static void hv_cpu_hotplug_quirk(bool vmbus_loaded) -+{ -+ static void *previous_cpu_disable; -+ -+ /* -+ * Offlining a CPU when running on newer hypervisors (WS2012R2, Win8, -+ * ...) is not supported at this moment as channel interrupts are -+ * distributed across all of them. -+ */ -+ -+ if ((vmbus_proto_version == VERSION_WS2008) || -+ (vmbus_proto_version == VERSION_WIN7)) -+ return; -+ -+ if (vmbus_loaded) { -+ previous_cpu_disable = smp_ops.cpu_disable; -+ smp_ops.cpu_disable = hyperv_cpu_disable; -+ pr_notice("CPU offlining is not supported by hypervisor\n"); -+ } else if (previous_cpu_disable) -+ smp_ops.cpu_disable = previous_cpu_disable; -+} -+#else -+static void hv_cpu_hotplug_quirk(bool vmbus_loaded) -+{ -+} -+#endif -+ - /* - * vmbus_bus_init -Main vmbus driver initialization routine. - * -@@ -572,6 +606,7 @@ static int vmbus_bus_init(int irq) - if (ret) - goto err_irq; - -+ hv_cpu_hotplug_quirk(true); - vmbus_request_offers(); - - return 0; -@@ -808,6 +843,7 @@ static void __exit vmbus_exit(void) - bus_unregister(&hv_bus); - hv_cleanup(); - acpi_bus_unregister_driver(&vmbus_acpi_driver); -+ hv_cpu_hotplug_quirk(false); - } - - -diff --git a/drivers/hwmon/max1111.c b/drivers/hwmon/max1111.c -index eda077de8a9f..f787f04a0d1a 100644 ---- a/drivers/hwmon/max1111.c -+++ b/drivers/hwmon/max1111.c -@@ -85,6 +85,9 @@ static struct max1111_data *the_max1111; - - int max1111_read_channel(int channel) - { -+ if (!the_max1111 || !the_max1111->spi) -+ return -ENODEV; -+ - return max1111_read(&the_max1111->spi->dev, channel); - } - EXPORT_SYMBOL(max1111_read_channel); -@@ -260,6 +263,9 @@ static int max1111_remove(struct spi_device *spi) - { - struct max1111_data *data = spi_get_drvdata(spi); - -+#ifdef CONFIG_SHARPSL_PM -+ the_max1111 = NULL; -+#endif - hwmon_device_unregister(data->hwmon_dev); - sysfs_remove_group(&spi->dev.kobj, &max1110_attr_group); - sysfs_remove_group(&spi->dev.kobj, &max1111_attr_group); -diff --git a/drivers/i2c/busses/i2c-cpm.c b/drivers/i2c/busses/i2c-cpm.c -index 3823623baa48..693e4ceb85ce 100644 ---- a/drivers/i2c/busses/i2c-cpm.c -+++ b/drivers/i2c/busses/i2c-cpm.c -@@ -120,8 +120,8 @@ struct cpm_i2c { - cbd_t __iomem *rbase; - u_char *txbuf[CPM_MAXBD]; - u_char *rxbuf[CPM_MAXBD]; -- u32 txdma[CPM_MAXBD]; -- u32 rxdma[CPM_MAXBD]; -+ dma_addr_t txdma[CPM_MAXBD]; -+ dma_addr_t rxdma[CPM_MAXBD]; - }; - - static irqreturn_t cpm_i2c_interrupt(int irq, void *dev_id) -diff --git a/drivers/input/misc/ati_remote2.c b/drivers/input/misc/ati_remote2.c -index f63341f20b91..e8c6a4842e91 100644 ---- a/drivers/input/misc/ati_remote2.c -+++ b/drivers/input/misc/ati_remote2.c -@@ -817,26 +817,49 @@ static int ati_remote2_probe(struct usb_interface *interface, const struct usb_d - - ar2->udev = udev; - -+ /* Sanity check, first interface must have an endpoint */ -+ if (alt->desc.bNumEndpoints < 1 || !alt->endpoint) { -+ dev_err(&interface->dev, -+ "%s(): interface 0 must have an endpoint\n", __func__); -+ r = -ENODEV; -+ goto fail1; -+ } - ar2->intf[0] = interface; - ar2->ep[0] = &alt->endpoint[0].desc; - -+ /* Sanity check, the device must have two interfaces */ - ar2->intf[1] = usb_ifnum_to_if(udev, 1); -+ if ((udev->actconfig->desc.bNumInterfaces < 2) || !ar2->intf[1]) { -+ dev_err(&interface->dev, "%s(): need 2 interfaces, found %d\n", -+ __func__, udev->actconfig->desc.bNumInterfaces); -+ r = -ENODEV; -+ goto fail1; -+ } -+ - r = usb_driver_claim_interface(&ati_remote2_driver, ar2->intf[1], ar2); - if (r) - goto fail1; -+ -+ /* Sanity check, second interface must have an endpoint */ - alt = ar2->intf[1]->cur_altsetting; -+ if (alt->desc.bNumEndpoints < 1 || !alt->endpoint) { -+ dev_err(&interface->dev, -+ "%s(): interface 1 must have an endpoint\n", __func__); -+ r = -ENODEV; -+ goto fail2; -+ } - ar2->ep[1] = &alt->endpoint[0].desc; - - r = ati_remote2_urb_init(ar2); - if (r) -- goto fail2; -+ goto fail3; - - ar2->channel_mask = channel_mask; - ar2->mode_mask = mode_mask; - - r = ati_remote2_setup(ar2, ar2->channel_mask); - if (r) -- goto fail2; -+ goto fail3; - - usb_make_path(udev, ar2->phys, sizeof(ar2->phys)); - strlcat(ar2->phys, "/input0", sizeof(ar2->phys)); -@@ -845,11 +868,11 @@ static int ati_remote2_probe(struct usb_interface *interface, const struct usb_d - - r = sysfs_create_group(&udev->dev.kobj, &ati_remote2_attr_group); - if (r) -- goto fail2; -+ goto fail3; - - r = ati_remote2_input_init(ar2); - if (r) -- goto fail3; -+ goto fail4; - - usb_set_intfdata(interface, ar2); - -@@ -857,10 +880,11 @@ static int ati_remote2_probe(struct usb_interface *interface, const struct usb_d - - return 0; - -- fail3: -+ fail4: - sysfs_remove_group(&udev->dev.kobj, &ati_remote2_attr_group); -- fail2: -+ fail3: - ati_remote2_urb_cleanup(ar2); -+ fail2: - usb_driver_release_interface(&ati_remote2_driver, ar2->intf[1]); - fail1: - kfree(ar2); -diff --git a/drivers/input/misc/ims-pcu.c b/drivers/input/misc/ims-pcu.c -index e204f26b0011..77164dc1bedd 100644 ---- a/drivers/input/misc/ims-pcu.c -+++ b/drivers/input/misc/ims-pcu.c -@@ -1433,6 +1433,8 @@ static int ims_pcu_parse_cdc_data(struct usb_interface *intf, struct ims_pcu *pc - - pcu->ctrl_intf = usb_ifnum_to_if(pcu->udev, - union_desc->bMasterInterface0); -+ if (!pcu->ctrl_intf) -+ return -EINVAL; - - alt = pcu->ctrl_intf->cur_altsetting; - pcu->ep_ctrl = &alt->endpoint[0].desc; -@@ -1440,6 +1442,8 @@ static int ims_pcu_parse_cdc_data(struct usb_interface *intf, struct ims_pcu *pc - - pcu->data_intf = usb_ifnum_to_if(pcu->udev, - union_desc->bSlaveInterface0); -+ if (!pcu->data_intf) -+ return -EINVAL; - - alt = pcu->data_intf->cur_altsetting; - if (alt->desc.bNumEndpoints != 2) { -diff --git a/drivers/input/misc/max8997_haptic.c b/drivers/input/misc/max8997_haptic.c -index e973133212a5..a8c91226cd22 100644 ---- a/drivers/input/misc/max8997_haptic.c -+++ b/drivers/input/misc/max8997_haptic.c -@@ -246,12 +246,14 @@ static int max8997_haptic_probe(struct platform_device *pdev) - struct max8997_dev *iodev = dev_get_drvdata(pdev->dev.parent); - const struct max8997_platform_data *pdata = - dev_get_platdata(iodev->dev); -- const struct max8997_haptic_platform_data *haptic_pdata = -- pdata->haptic_pdata; -+ const struct max8997_haptic_platform_data *haptic_pdata = NULL; - struct max8997_haptic *chip; - struct input_dev *input_dev; - int error; - -+ if (pdata) -+ haptic_pdata = pdata->haptic_pdata; -+ - if (!haptic_pdata) { - dev_err(&pdev->dev, "no haptic platform data\n"); - return -EINVAL; -diff --git a/drivers/input/misc/powermate.c b/drivers/input/misc/powermate.c -index 49c0c3ebd321..21ce1cf757bb 100644 ---- a/drivers/input/misc/powermate.c -+++ b/drivers/input/misc/powermate.c -@@ -308,6 +308,9 @@ static int powermate_probe(struct usb_interface *intf, const struct usb_device_i - int error = -ENOMEM; - - interface = intf->cur_altsetting; -+ if (interface->desc.bNumEndpoints < 1) -+ return -EINVAL; -+ - endpoint = &interface->endpoint[0].desc; - if (!usb_endpoint_is_int_in(endpoint)) - return -EIO; -diff --git a/drivers/input/tablet/gtco.c b/drivers/input/tablet/gtco.c -index 29e01ab6859f..a9f8f925ba2b 100644 ---- a/drivers/input/tablet/gtco.c -+++ b/drivers/input/tablet/gtco.c -@@ -869,6 +869,14 @@ static int gtco_probe(struct usb_interface *usbinterface, - goto err_free_buf; - } - -+ /* Sanity check that a device has an endpoint */ -+ if (usbinterface->altsetting[0].desc.bNumEndpoints < 1) { -+ dev_err(&usbinterface->dev, -+ "Invalid number of endpoints\n"); -+ error = -EINVAL; -+ goto err_free_urb; -+ } -+ - /* - * The endpoint is always altsetting 0, we know this since we know - * this device only has one interrupt endpoint -@@ -890,7 +898,7 @@ static int gtco_probe(struct usb_interface *usbinterface, - * HID report descriptor - */ - if (usb_get_extra_descriptor(usbinterface->cur_altsetting, -- HID_DEVICE_TYPE, &hid_desc) != 0){ -+ HID_DEVICE_TYPE, &hid_desc) != 0) { - dev_err(&usbinterface->dev, - "Can't retrieve exta USB descriptor to get hid report descriptor length\n"); - error = -EIO; -diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c -index 84ccf140c1bb..9332e46b53ed 100644 ---- a/drivers/input/touchscreen/ads7846.c -+++ b/drivers/input/touchscreen/ads7846.c -@@ -697,18 +697,22 @@ static int ads7846_no_filter(void *ads, int data_idx, int *val) - - static int ads7846_get_value(struct ads7846 *ts, struct spi_message *m) - { -+ int value; - struct spi_transfer *t = - list_entry(m->transfers.prev, struct spi_transfer, transfer_list); - - if (ts->model == 7845) { -- return be16_to_cpup((__be16 *)&(((char*)t->rx_buf)[1])) >> 3; -+ value = be16_to_cpup((__be16 *)&(((char *)t->rx_buf)[1])); - } else { - /* - * adjust: on-wire is a must-ignore bit, a BE12 value, then - * padding; built from two 8 bit values written msb-first. - */ -- return be16_to_cpup((__be16 *)t->rx_buf) >> 3; -+ value = be16_to_cpup((__be16 *)t->rx_buf); - } -+ -+ /* enforce ADC output is 12 bits width */ -+ return (value >> 3) & 0xfff; - } - - static void ads7846_update_value(struct spi_message *m, int val) -diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c -index 2d2915fdbf02..2a4c13af482a 100644 ---- a/drivers/md/bcache/super.c -+++ b/drivers/md/bcache/super.c -@@ -1295,6 +1295,9 @@ static void cache_set_flush(struct closure *cl) - set_bit(CACHE_SET_STOPPING_2, &c->flags); - wake_up(&c->alloc_wait); - -+ if (!c) -+ closure_return(cl); -+ - bch_cache_accounting_destroy(&c->accounting); - - kobject_put(&c->internal); -diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c -index ef18ca745b1e..9ee3c460fa37 100644 ---- a/drivers/md/raid5.c -+++ b/drivers/md/raid5.c -@@ -5658,8 +5658,8 @@ static int run(struct mddev *mddev) - } - - if (discard_supported && -- mddev->queue->limits.max_discard_sectors >= stripe && -- mddev->queue->limits.discard_granularity >= stripe) -+ mddev->queue->limits.max_discard_sectors >= (stripe >> 9) && -+ mddev->queue->limits.discard_granularity >= stripe) - queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, - mddev->queue); - else -diff --git a/drivers/media/pci/bt8xx/bttv-driver.c b/drivers/media/pci/bt8xx/bttv-driver.c -index e2633d9270b7..aa4519e5cafa 100644 ---- a/drivers/media/pci/bt8xx/bttv-driver.c -+++ b/drivers/media/pci/bt8xx/bttv-driver.c -@@ -2376,6 +2376,19 @@ static int bttv_g_fmt_vid_overlay(struct file *file, void *priv, - return 0; - } - -+static void bttv_get_width_mask_vid_cap(const struct bttv_format *fmt, -+ unsigned int *width_mask, -+ unsigned int *width_bias) -+{ -+ if (fmt->flags & FORMAT_FLAGS_PLANAR) { -+ *width_mask = ~15; /* width must be a multiple of 16 pixels */ -+ *width_bias = 8; /* nearest */ -+ } else { -+ *width_mask = ~3; /* width must be a multiple of 4 pixels */ -+ *width_bias = 2; /* nearest */ -+ } -+} -+ - static int bttv_try_fmt_vid_cap(struct file *file, void *priv, - struct v4l2_format *f) - { -@@ -2385,6 +2398,7 @@ static int bttv_try_fmt_vid_cap(struct file *file, void *priv, - enum v4l2_field field; - __s32 width, height; - __s32 height2; -+ unsigned int width_mask, width_bias; - int rc; - - fmt = format_by_fourcc(f->fmt.pix.pixelformat); -@@ -2417,9 +2431,9 @@ static int bttv_try_fmt_vid_cap(struct file *file, void *priv, - width = f->fmt.pix.width; - height = f->fmt.pix.height; - -+ bttv_get_width_mask_vid_cap(fmt, &width_mask, &width_bias); - rc = limit_scaled_size_lock(fh, &width, &height, field, -- /* width_mask: 4 pixels */ ~3, -- /* width_bias: nearest */ 2, -+ width_mask, width_bias, - /* adjust_size */ 1, - /* adjust_crop */ 0); - if (0 != rc) -@@ -2452,6 +2466,7 @@ static int bttv_s_fmt_vid_cap(struct file *file, void *priv, - struct bttv_fh *fh = priv; - struct bttv *btv = fh->btv; - __s32 width, height; -+ unsigned int width_mask, width_bias; - enum v4l2_field field; - - retval = bttv_switch_type(fh, f->type); -@@ -2466,9 +2481,10 @@ static int bttv_s_fmt_vid_cap(struct file *file, void *priv, - height = f->fmt.pix.height; - field = f->fmt.pix.field; - -+ fmt = format_by_fourcc(f->fmt.pix.pixelformat); -+ bttv_get_width_mask_vid_cap(fmt, &width_mask, &width_bias); - retval = limit_scaled_size_lock(fh, &width, &height, f->fmt.pix.field, -- /* width_mask: 4 pixels */ ~3, -- /* width_bias: nearest */ 2, -+ width_mask, width_bias, - /* adjust_size */ 1, - /* adjust_crop */ 1); - if (0 != retval) -@@ -2476,8 +2492,6 @@ static int bttv_s_fmt_vid_cap(struct file *file, void *priv, - - f->fmt.pix.field = field; - -- fmt = format_by_fourcc(f->fmt.pix.pixelformat); -- - /* update our state informations */ - fh->fmt = fmt; - fh->cap.field = f->fmt.pix.field; -diff --git a/drivers/media/usb/pwc/pwc-if.c b/drivers/media/usb/pwc/pwc-if.c -index 77bbf7889659..db1e8ee13ded 100644 ---- a/drivers/media/usb/pwc/pwc-if.c -+++ b/drivers/media/usb/pwc/pwc-if.c -@@ -91,6 +91,7 @@ static const struct usb_device_id pwc_device_table [] = { - { USB_DEVICE(0x0471, 0x0312) }, - { USB_DEVICE(0x0471, 0x0313) }, /* the 'new' 720K */ - { USB_DEVICE(0x0471, 0x0329) }, /* Philips SPC 900NC PC Camera */ -+ { USB_DEVICE(0x0471, 0x032C) }, /* Philips SPC 880NC PC Camera */ - { USB_DEVICE(0x069A, 0x0001) }, /* Askey */ - { USB_DEVICE(0x046D, 0x08B0) }, /* Logitech QuickCam Pro 3000 */ - { USB_DEVICE(0x046D, 0x08B1) }, /* Logitech QuickCam Notebook Pro */ -@@ -799,6 +800,11 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id - name = "Philips SPC 900NC webcam"; - type_id = 740; - break; -+ case 0x032C: -+ PWC_INFO("Philips SPC 880NC USB webcam detected.\n"); -+ name = "Philips SPC 880NC webcam"; -+ type_id = 740; -+ break; - default: - return -ENODEV; - break; -diff --git a/drivers/media/usb/usbvision/usbvision-video.c b/drivers/media/usb/usbvision/usbvision-video.c -index d34c2afe2c24..bcfefe61a592 100644 ---- a/drivers/media/usb/usbvision/usbvision-video.c -+++ b/drivers/media/usb/usbvision/usbvision-video.c -@@ -1459,6 +1459,7 @@ static void usbvision_release(struct usb_usbvision *usbvision) - - usbvision_remove_sysfs(usbvision->vdev); - usbvision_unregister_video(usbvision); -+ kfree(usbvision->alt_max_pkt_size); - - usb_free_urb(usbvision->ctrl_urb); - -@@ -1520,7 +1521,7 @@ static int usbvision_probe(struct usb_interface *intf, - const struct usb_host_interface *interface; - struct usb_usbvision *usbvision = NULL; - const struct usb_endpoint_descriptor *endpoint; -- int model, i; -+ int model, i, ret; - - PDEBUG(DBG_PROBE, "VID=%#04x, PID=%#04x, ifnum=%u", - dev->descriptor.idVendor, -@@ -1529,33 +1530,51 @@ static int usbvision_probe(struct usb_interface *intf, - model = devid->driver_info; - if (model < 0 || model >= usbvision_device_data_size) { - PDEBUG(DBG_PROBE, "model out of bounds %d", model); -- return -ENODEV; -+ ret = -ENODEV; -+ goto err_usb; - } - printk(KERN_INFO "%s: %s found\n", __func__, - usbvision_device_data[model].model_string); - - if (usbvision_device_data[model].interface >= 0) - interface = &dev->actconfig->interface[usbvision_device_data[model].interface]->altsetting[0]; -- else -+ else if (ifnum < dev->actconfig->desc.bNumInterfaces) - interface = &dev->actconfig->interface[ifnum]->altsetting[0]; -+ else { -+ dev_err(&intf->dev, "interface %d is invalid, max is %d\n", -+ ifnum, dev->actconfig->desc.bNumInterfaces - 1); -+ ret = -ENODEV; -+ goto err_usb; -+ } -+ -+ if (interface->desc.bNumEndpoints < 2) { -+ dev_err(&intf->dev, "interface %d has %d endpoints, but must" -+ " have minimum 2\n", ifnum, interface->desc.bNumEndpoints); -+ ret = -ENODEV; -+ goto err_usb; -+ } - endpoint = &interface->endpoint[1].desc; -+ - if (!usb_endpoint_xfer_isoc(endpoint)) { - dev_err(&intf->dev, "%s: interface %d. has non-ISO endpoint!\n", - __func__, ifnum); - dev_err(&intf->dev, "%s: Endpoint attributes %d", - __func__, endpoint->bmAttributes); -- return -ENODEV; -+ ret = -ENODEV; -+ goto err_usb; - } - if (usb_endpoint_dir_out(endpoint)) { - dev_err(&intf->dev, "%s: interface %d. has ISO OUT endpoint!\n", - __func__, ifnum); -- return -ENODEV; -+ ret = -ENODEV; -+ goto err_usb; - } - - usbvision = usbvision_alloc(dev, intf); - if (usbvision == NULL) { - dev_err(&intf->dev, "%s: couldn't allocate USBVision struct\n", __func__); -- return -ENOMEM; -+ ret = -ENOMEM; -+ goto err_usb; - } - - if (dev->descriptor.bNumConfigurations > 1) -@@ -1574,7 +1593,8 @@ static int usbvision_probe(struct usb_interface *intf, - usbvision->alt_max_pkt_size = kmalloc(32 * usbvision->num_alt, GFP_KERNEL); - if (usbvision->alt_max_pkt_size == NULL) { - dev_err(&intf->dev, "usbvision: out of memory!\n"); -- return -ENOMEM; -+ ret = -ENOMEM; -+ goto err_pkt; - } - - for (i = 0; i < usbvision->num_alt; i++) { -@@ -1609,6 +1629,12 @@ static int usbvision_probe(struct usb_interface *intf, - - PDEBUG(DBG_PROBE, "success"); - return 0; -+ -+err_pkt: -+ usbvision_release(usbvision); -+err_usb: -+ usb_put_dev(dev); -+ return ret; - } - - -diff --git a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c -index 35fb8f0cb539..07d6ce4c9c6f 100644 ---- a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c -+++ b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c -@@ -392,7 +392,8 @@ static int get_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user - get_user(kp->index, &up->index) || - get_user(kp->type, &up->type) || - get_user(kp->flags, &up->flags) || -- get_user(kp->memory, &up->memory)) -+ get_user(kp->memory, &up->memory) || -+ get_user(kp->length, &up->length)) - return -EFAULT; - - if (V4L2_TYPE_IS_OUTPUT(kp->type)) -@@ -404,9 +405,6 @@ static int get_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user - return -EFAULT; - - if (V4L2_TYPE_IS_MULTIPLANAR(kp->type)) { -- if (get_user(kp->length, &up->length)) -- return -EFAULT; -- - num_planes = kp->length; - if (num_planes == 0) { - kp->m.planes = NULL; -@@ -439,16 +437,14 @@ static int get_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user - } else { - switch (kp->memory) { - case V4L2_MEMORY_MMAP: -- if (get_user(kp->length, &up->length) || -- get_user(kp->m.offset, &up->m.offset)) -+ if (get_user(kp->m.offset, &up->m.offset)) - return -EFAULT; - break; - case V4L2_MEMORY_USERPTR: - { - compat_long_t tmp; - -- if (get_user(kp->length, &up->length) || -- get_user(tmp, &up->m.userptr)) -+ if (get_user(tmp, &up->m.userptr)) - return -EFAULT; - - kp->m.userptr = (unsigned long)compat_ptr(tmp); -@@ -490,7 +486,8 @@ static int put_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user - copy_to_user(&up->timecode, &kp->timecode, sizeof(struct v4l2_timecode)) || - put_user(kp->sequence, &up->sequence) || - put_user(kp->reserved2, &up->reserved2) || -- put_user(kp->reserved, &up->reserved)) -+ put_user(kp->reserved, &up->reserved) || -+ put_user(kp->length, &up->length)) - return -EFAULT; - - if (V4L2_TYPE_IS_MULTIPLANAR(kp->type)) { -@@ -513,13 +510,11 @@ static int put_v4l2_buffer32(struct v4l2_buffer *kp, struct v4l2_buffer32 __user - } else { - switch (kp->memory) { - case V4L2_MEMORY_MMAP: -- if (put_user(kp->length, &up->length) || -- put_user(kp->m.offset, &up->m.offset)) -+ if (put_user(kp->m.offset, &up->m.offset)) - return -EFAULT; - break; - case V4L2_MEMORY_USERPTR: -- if (put_user(kp->length, &up->length) || -- put_user(kp->m.userptr, &up->m.userptr)) -+ if (put_user(kp->m.userptr, &up->m.userptr)) - return -EFAULT; - break; - case V4L2_MEMORY_OVERLAY: -diff --git a/drivers/mfd/omap-usb-tll.c b/drivers/mfd/omap-usb-tll.c -index e59ac4cbac96..c7576a503e5b 100644 ---- a/drivers/mfd/omap-usb-tll.c -+++ b/drivers/mfd/omap-usb-tll.c -@@ -269,6 +269,8 @@ static int usbtll_omap_probe(struct platform_device *pdev) - - if (IS_ERR(tll->ch_clk[i])) - dev_dbg(dev, "can't get clock : %s\n", clkname); -+ else -+ clk_prepare(tll->ch_clk[i]); - } - - pm_runtime_put_sync(dev); -@@ -301,9 +303,12 @@ static int usbtll_omap_remove(struct platform_device *pdev) - tll_dev = NULL; - spin_unlock(&tll_lock); - -- for (i = 0; i < tll->nch; i++) -- if (!IS_ERR(tll->ch_clk[i])) -+ for (i = 0; i < tll->nch; i++) { -+ if (!IS_ERR(tll->ch_clk[i])) { -+ clk_unprepare(tll->ch_clk[i]); - clk_put(tll->ch_clk[i]); -+ } -+ } - - pm_runtime_disable(&pdev->dev); - return 0; -diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig -index c002d8660e30..7a6818407836 100644 ---- a/drivers/misc/Kconfig -+++ b/drivers/misc/Kconfig -@@ -451,7 +451,7 @@ config ARM_CHARLCD - still useful. - - config BMP085 -- bool -+ tristate - depends on SYSFS - - config BMP085_I2C -diff --git a/drivers/misc/ad525x_dpot.c b/drivers/misc/ad525x_dpot.c -index 8f99e8e3f0ac..beb7422c3cc7 100644 ---- a/drivers/misc/ad525x_dpot.c -+++ b/drivers/misc/ad525x_dpot.c -@@ -216,7 +216,7 @@ static s32 dpot_read_i2c(struct dpot_data *dpot, u8 reg) - */ - value = swab16(value); - -- if (dpot->uid == DPOT_UID(AD5271_ID)) -+ if (dpot->uid == DPOT_UID(AD5274_ID)) - value = value >> 2; - return value; - default: -diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c -index ebb40a292d67..c6bf23599eb9 100644 ---- a/drivers/mmc/card/block.c -+++ b/drivers/mmc/card/block.c -@@ -2322,11 +2322,12 @@ static const struct mmc_fixup blk_fixups[] = - MMC_QUIRK_BLK_NO_CMD23), - - /* -- * Some Micron MMC cards needs longer data read timeout than -- * indicated in CSD. -+ * Some MMC cards need longer data read timeout than indicated in CSD. - */ - MMC_FIXUP(CID_NAME_ANY, CID_MANFID_MICRON, 0x200, add_quirk_mmc, - MMC_QUIRK_LONG_READ_TIME), -+ MMC_FIXUP("008GE0", CID_MANFID_TOSHIBA, CID_OEMID_ANY, add_quirk_mmc, -+ MMC_QUIRK_LONG_READ_TIME), - - /* - * On these Samsung MoviNAND parts, performing secure erase or -diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c -index 68ab26385d06..3ae6f1325773 100644 ---- a/drivers/mmc/core/core.c -+++ b/drivers/mmc/core/core.c -@@ -801,11 +801,11 @@ void mmc_set_data_timeout(struct mmc_data *data, const struct mmc_card *card) - /* - * Some cards require longer data read timeout than indicated in CSD. - * Address this by setting the read timeout to a "reasonably high" -- * value. For the cards tested, 300ms has proven enough. If necessary, -+ * value. For the cards tested, 600ms has proven enough. If necessary, - * this value can be increased if other problematic cards require this. - */ - if (mmc_card_long_read_time(card) && data->flags & MMC_DATA_READ) { -- data->timeout_ns = 300000000; -+ data->timeout_ns = 600000000; - data->timeout_clks = 0; - } - -diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c -index 0cbd1effe960..dda1a42ae822 100644 ---- a/drivers/mmc/core/mmc.c -+++ b/drivers/mmc/core/mmc.c -@@ -266,6 +266,9 @@ static void mmc_select_card_type(struct mmc_card *card) - card->ext_csd.card_type = card_type; - } - -+/* Minimum partition switch timeout in milliseconds */ -+#define MMC_MIN_PART_SWITCH_TIME 300 -+ - /* - * Decode extended CSD. - */ -@@ -330,6 +333,10 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd) - - /* EXT_CSD value is in units of 10ms, but we store in ms */ - card->ext_csd.part_time = 10 * ext_csd[EXT_CSD_PART_SWITCH_TIME]; -+ /* Some eMMC set the value too low so set a minimum */ -+ if (card->ext_csd.part_time && -+ card->ext_csd.part_time < MMC_MIN_PART_SWITCH_TIME) -+ card->ext_csd.part_time = MMC_MIN_PART_SWITCH_TIME; - - /* Sleep / awake timeout in 100ns units */ - if (sa_shift > 0 && sa_shift <= 0x17) -diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c -index b3f41f200622..0f13fd4748ec 100644 ---- a/drivers/mtd/onenand/onenand_base.c -+++ b/drivers/mtd/onenand/onenand_base.c -@@ -2610,6 +2610,7 @@ static int onenand_default_block_markbad(struct mtd_info *mtd, loff_t ofs) - */ - static int onenand_block_markbad(struct mtd_info *mtd, loff_t ofs) - { -+ struct onenand_chip *this = mtd->priv; - int ret; - - ret = onenand_block_isbad(mtd, ofs); -@@ -2621,7 +2622,7 @@ static int onenand_block_markbad(struct mtd_info *mtd, loff_t ofs) - } - - onenand_get_device(mtd, FL_WRITING); -- ret = mtd_block_markbad(mtd, ofs); -+ ret = this->block_markbad(mtd, ofs); - onenand_release_device(mtd); - return ret; - } -diff --git a/drivers/net/ethernet/atheros/atlx/atl2.c b/drivers/net/ethernet/atheros/atlx/atl2.c -index 265ce1b752ed..96fe542b4acb 100644 ---- a/drivers/net/ethernet/atheros/atlx/atl2.c -+++ b/drivers/net/ethernet/atheros/atlx/atl2.c -@@ -1413,7 +1413,7 @@ static int atl2_probe(struct pci_dev *pdev, const struct pci_device_id *ent) - - err = -EIO; - -- netdev->hw_features = NETIF_F_SG | NETIF_F_HW_VLAN_CTAG_RX; -+ netdev->hw_features = NETIF_F_HW_VLAN_CTAG_RX; - netdev->features |= (NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX); - - /* Init PHY as early as possible due to power saving issue */ -diff --git a/drivers/net/ethernet/jme.c b/drivers/net/ethernet/jme.c -index 070a6f1a0577..2f4cbcae9c7c 100644 ---- a/drivers/net/ethernet/jme.c -+++ b/drivers/net/ethernet/jme.c -@@ -3290,13 +3290,14 @@ jme_resume(struct device *dev) - jme_reset_phy_processor(jme); - jme_phy_calibration(jme); - jme_phy_setEA(jme); -- jme_start_irq(jme); - netif_device_attach(netdev); - - atomic_inc(&jme->link_changing); - - jme_reset_link(jme); - -+ jme_start_irq(jme); -+ - return 0; - } - -diff --git a/drivers/net/ethernet/qlogic/qlge/qlge_main.c b/drivers/net/ethernet/qlogic/qlge/qlge_main.c -index f87cc216045b..a978cc2eafe0 100644 ---- a/drivers/net/ethernet/qlogic/qlge/qlge_main.c -+++ b/drivers/net/ethernet/qlogic/qlge/qlge_main.c -@@ -1620,7 +1620,18 @@ static void ql_process_mac_rx_skb(struct ql_adapter *qdev, - return; - } - skb_reserve(new_skb, NET_IP_ALIGN); -+ -+ pci_dma_sync_single_for_cpu(qdev->pdev, -+ dma_unmap_addr(sbq_desc, mapaddr), -+ dma_unmap_len(sbq_desc, maplen), -+ PCI_DMA_FROMDEVICE); -+ - memcpy(skb_put(new_skb, length), skb->data, length); -+ -+ pci_dma_sync_single_for_device(qdev->pdev, -+ dma_unmap_addr(sbq_desc, mapaddr), -+ dma_unmap_len(sbq_desc, maplen), -+ PCI_DMA_FROMDEVICE); - skb = new_skb; - - /* Frame error, so drop the packet. */ -diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c -index b93a0fb17236..93b652516a94 100644 ---- a/drivers/net/ethernet/renesas/sh_eth.c -+++ b/drivers/net/ethernet/renesas/sh_eth.c -@@ -1161,7 +1161,8 @@ static void sh_eth_ring_format(struct net_device *ndev) - mdp->dirty_rx = (u32) (i - mdp->num_rx_ring); - - /* Mark the last entry as wrapping the ring. */ -- rxdesc->status |= cpu_to_edmac(mdp, RD_RDEL); -+ if (rxdesc) -+ rxdesc->status |= cpu_to_edmac(mdp, RD_RDEL); - - memset(mdp->tx_ring, 0, tx_ringsize); - -diff --git a/drivers/net/irda/irtty-sir.c b/drivers/net/irda/irtty-sir.c -index a41267197839..0d71fa9f0c68 100644 ---- a/drivers/net/irda/irtty-sir.c -+++ b/drivers/net/irda/irtty-sir.c -@@ -430,16 +430,6 @@ static int irtty_open(struct tty_struct *tty) - - /* Module stuff handled via irda_ldisc.owner - Jean II */ - -- /* First make sure we're not already connected. */ -- if (tty->disc_data != NULL) { -- priv = tty->disc_data; -- if (priv && priv->magic == IRTTY_MAGIC) { -- ret = -EEXIST; -- goto out; -- } -- tty->disc_data = NULL; /* ### */ -- } -- - /* stop the underlying driver */ - irtty_stop_receiver(tty, TRUE); - if (tty->ops->stop) -diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c -index a2d7d5f066f1..14a8d2958698 100644 ---- a/drivers/net/ppp/ppp_generic.c -+++ b/drivers/net/ppp/ppp_generic.c -@@ -2220,7 +2220,7 @@ int ppp_register_net_channel(struct net *net, struct ppp_channel *chan) - - pch->ppp = NULL; - pch->chan = chan; -- pch->chan_net = net; -+ pch->chan_net = get_net(net); - chan->ppp = pch; - init_ppp_file(&pch->file, CHANNEL); - pch->file.hdrlen = chan->hdrlen; -@@ -2317,6 +2317,8 @@ ppp_unregister_channel(struct ppp_channel *chan) - spin_lock_bh(&pn->all_channels_lock); - list_del(&pch->list); - spin_unlock_bh(&pn->all_channels_lock); -+ put_net(pch->chan_net); -+ pch->chan_net = NULL; - - pch->file.dead = 1; - wake_up_interruptible(&pch->file.rwait); -diff --git a/drivers/net/rionet.c b/drivers/net/rionet.c -index f433b594388e..00a8128cf927 100644 ---- a/drivers/net/rionet.c -+++ b/drivers/net/rionet.c -@@ -269,7 +269,7 @@ static void rionet_outb_msg_event(struct rio_mport *mport, void *dev_id, int mbo - struct net_device *ndev = dev_id; - struct rionet_private *rnet = netdev_priv(ndev); - -- spin_lock(&rnet->lock); -+ spin_lock(&rnet->tx_lock); - - if (netif_msg_intr(rnet)) - printk(KERN_INFO -@@ -288,7 +288,7 @@ static void rionet_outb_msg_event(struct rio_mport *mport, void *dev_id, int mbo - if (rnet->tx_cnt < RIONET_TX_RING_SIZE) - netif_wake_queue(ndev); - -- spin_unlock(&rnet->lock); -+ spin_unlock(&rnet->tx_lock); - } - - static int rionet_open(struct net_device *ndev) -diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c -index 43afde8f48d2..74581cbcafa7 100644 ---- a/drivers/net/usb/cdc_ncm.c -+++ b/drivers/net/usb/cdc_ncm.c -@@ -464,7 +464,11 @@ advance: - - iface_no = ctx->data->cur_altsetting->desc.bInterfaceNumber; - -- /* reset data interface */ -+ /* Reset data interface. Some devices will not reset properly -+ * unless they are configured first. Toggle the altsetting to -+ * force a reset -+ */ -+ usb_set_interface(dev->udev, iface_no, data_altsetting); - temp = usb_set_interface(dev->udev, iface_no, 0); - if (temp) - goto error2; -diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c -index 0244a1fb38f9..12aaf1f4f890 100644 ---- a/drivers/net/usb/qmi_wwan.c -+++ b/drivers/net/usb/qmi_wwan.c -@@ -724,6 +724,7 @@ static const struct usb_device_id products[] = { - {QMI_FIXED_INTF(0x19d2, 0x1426, 2)}, /* ZTE MF91 */ - {QMI_FIXED_INTF(0x19d2, 0x1428, 2)}, /* Telewell TW-LTE 4G v2 */ - {QMI_FIXED_INTF(0x19d2, 0x2002, 4)}, /* ZTE (Vodafone) K3765-Z */ -+ {QMI_FIXED_INTF(0x2001, 0x7e19, 4)}, /* D-Link DWM-221 B1 */ - {QMI_FIXED_INTF(0x0f3d, 0x68a2, 8)}, /* Sierra Wireless MC7700 */ - {QMI_FIXED_INTF(0x114f, 0x68a2, 8)}, /* Sierra Wireless MC7750 */ - {QMI_FIXED_INTF(0x1199, 0x68a2, 8)}, /* Sierra Wireless MC7710 in QMI mode */ -diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c -index fb068ada0c5a..2255d8965037 100644 ---- a/drivers/net/usb/usbnet.c -+++ b/drivers/net/usb/usbnet.c -@@ -1622,6 +1622,13 @@ out3: - if (info->unbind) - info->unbind (dev, udev); - out1: -+ /* subdrivers must undo all they did in bind() if they -+ * fail it, but we may fail later and a deferred kevent -+ * may trigger an error resubmitting itself and, worse, -+ * schedule a timer. So we kill it all just in case. -+ */ -+ cancel_work_sync(&dev->kevent); -+ del_timer_sync(&dev->delay); - free_netdev(net); - out: - return status; -diff --git a/drivers/net/wan/farsync.c b/drivers/net/wan/farsync.c -index bcfff0d62de4..2dfa1478d7d1 100644 ---- a/drivers/net/wan/farsync.c -+++ b/drivers/net/wan/farsync.c -@@ -2545,7 +2545,7 @@ fst_add_one(struct pci_dev *pdev, const struct pci_device_id *ent) - dev->mem_start = card->phys_mem - + BUF_OFFSET ( txBuffer[i][0][0]); - dev->mem_end = card->phys_mem -- + BUF_OFFSET ( txBuffer[i][NUM_TX_BUFFER][0]); -+ + BUF_OFFSET ( txBuffer[i][NUM_TX_BUFFER - 1][LEN_RX_BUFFER - 1]); - dev->base_addr = card->pci_conf; - dev->irq = card->irq; - -diff --git a/drivers/net/wireless/ath/ath9k/eeprom.c b/drivers/net/wireless/ath/ath9k/eeprom.c -index 971d770722cf..2ac05486424b 100644 ---- a/drivers/net/wireless/ath/ath9k/eeprom.c -+++ b/drivers/net/wireless/ath/ath9k/eeprom.c -@@ -408,10 +408,9 @@ void ath9k_hw_get_gain_boundaries_pdadcs(struct ath_hw *ah, - - if (match) { - if (AR_SREV_9287(ah)) { -- /* FIXME: array overrun? */ - for (i = 0; i < numXpdGains; i++) { - minPwrT4[i] = data_9287[idxL].pwrPdg[i][0]; -- maxPwrT4[i] = data_9287[idxL].pwrPdg[i][4]; -+ maxPwrT4[i] = data_9287[idxL].pwrPdg[i][intercepts - 1]; - ath9k_hw_fill_vpd_table(minPwrT4[i], maxPwrT4[i], - data_9287[idxL].pwrPdg[i], - data_9287[idxL].vpdPdg[i], -@@ -421,7 +420,7 @@ void ath9k_hw_get_gain_boundaries_pdadcs(struct ath_hw *ah, - } else if (eeprom_4k) { - for (i = 0; i < numXpdGains; i++) { - minPwrT4[i] = data_4k[idxL].pwrPdg[i][0]; -- maxPwrT4[i] = data_4k[idxL].pwrPdg[i][4]; -+ maxPwrT4[i] = data_4k[idxL].pwrPdg[i][intercepts - 1]; - ath9k_hw_fill_vpd_table(minPwrT4[i], maxPwrT4[i], - data_4k[idxL].pwrPdg[i], - data_4k[idxL].vpdPdg[i], -@@ -431,7 +430,7 @@ void ath9k_hw_get_gain_boundaries_pdadcs(struct ath_hw *ah, - } else { - for (i = 0; i < numXpdGains; i++) { - minPwrT4[i] = data_def[idxL].pwrPdg[i][0]; -- maxPwrT4[i] = data_def[idxL].pwrPdg[i][4]; -+ maxPwrT4[i] = data_def[idxL].pwrPdg[i][intercepts - 1]; - ath9k_hw_fill_vpd_table(minPwrT4[i], maxPwrT4[i], - data_def[idxL].pwrPdg[i], - data_def[idxL].vpdPdg[i], -diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c -index 034a4d2964d6..d332d55885f8 100644 ---- a/drivers/pci/probe.c -+++ b/drivers/pci/probe.c -@@ -173,6 +173,9 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type, - struct pci_bus_region region; - bool bar_too_big = false, bar_disabled = false; - -+ if (dev->non_compliant_bars) -+ return 0; -+ - mask = type ? PCI_ROM_ADDRESS_MASK : ~0; - - /* No printks while decoding is disabled! */ -@@ -981,6 +984,7 @@ void set_pcie_hotplug_bridge(struct pci_dev *pdev) - int pci_setup_device(struct pci_dev *dev) - { - u32 class; -+ u16 cmd; - u8 hdr_type; - struct pci_slot *slot; - int pos = 0; -@@ -1028,6 +1032,16 @@ int pci_setup_device(struct pci_dev *dev) - /* device class may be changed after fixup */ - class = dev->class >> 8; - -+ if (dev->non_compliant_bars) { -+ pci_read_config_word(dev, PCI_COMMAND, &cmd); -+ if (cmd & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) { -+ dev_info(&dev->dev, "device has non-compliant BARs; disabling IO/MEM decoding\n"); -+ cmd &= ~PCI_COMMAND_IO; -+ cmd &= ~PCI_COMMAND_MEMORY; -+ pci_write_config_word(dev, PCI_COMMAND, cmd); -+ } -+ } -+ - switch (dev->hdr_type) { /* header type */ - case PCI_HEADER_TYPE_NORMAL: /* standard header */ - if (class == PCI_CLASS_BRIDGE_PCI) -diff --git a/drivers/pnp/pnpbios/bioscalls.c b/drivers/pnp/pnpbios/bioscalls.c -index 769d265b221b..deb7f4bcdb7b 100644 ---- a/drivers/pnp/pnpbios/bioscalls.c -+++ b/drivers/pnp/pnpbios/bioscalls.c -@@ -21,7 +21,7 @@ - - #include "pnpbios.h" - --static struct { -+__visible struct { - u16 offset; - u16 segment; - } pnp_bios_callpoint; -@@ -41,6 +41,7 @@ asmlinkage void pnp_bios_callfunc(void); - - __asm__(".text \n" - __ALIGN_STR "\n" -+ ".globl pnp_bios_callfunc\n" - "pnp_bios_callfunc:\n" - " pushl %edx \n" - " pushl %ecx \n" -@@ -66,9 +67,9 @@ static struct desc_struct bad_bios_desc = GDT_ENTRY_INIT(0x4092, - * after PnP BIOS oopses. - */ - --u32 pnp_bios_fault_esp; --u32 pnp_bios_fault_eip; --u32 pnp_bios_is_utter_crap = 0; -+__visible u32 pnp_bios_fault_esp; -+__visible u32 pnp_bios_fault_eip; -+__visible u32 pnp_bios_is_utter_crap = 0; - - static spinlock_t pnp_bios_lock; - -diff --git a/drivers/rtc/rtc-vr41xx.c b/drivers/rtc/rtc-vr41xx.c -index f91be04b9050..ca0f213c06a5 100644 ---- a/drivers/rtc/rtc-vr41xx.c -+++ b/drivers/rtc/rtc-vr41xx.c -@@ -272,12 +272,13 @@ static irqreturn_t rtclong1_interrupt(int irq, void *dev_id) - } - - static const struct rtc_class_ops vr41xx_rtc_ops = { -- .release = vr41xx_rtc_release, -- .ioctl = vr41xx_rtc_ioctl, -- .read_time = vr41xx_rtc_read_time, -- .set_time = vr41xx_rtc_set_time, -- .read_alarm = vr41xx_rtc_read_alarm, -- .set_alarm = vr41xx_rtc_set_alarm, -+ .release = vr41xx_rtc_release, -+ .ioctl = vr41xx_rtc_ioctl, -+ .read_time = vr41xx_rtc_read_time, -+ .set_time = vr41xx_rtc_set_time, -+ .read_alarm = vr41xx_rtc_read_alarm, -+ .set_alarm = vr41xx_rtc_set_alarm, -+ .alarm_irq_enable = vr41xx_rtc_alarm_irq_enable, - }; - - static int rtc_probe(struct platform_device *pdev) -diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c -index 1be0776a80c4..6a0d362e2596 100644 ---- a/drivers/scsi/aacraid/commsup.c -+++ b/drivers/scsi/aacraid/commsup.c -@@ -83,9 +83,12 @@ static int fib_map_alloc(struct aac_dev *dev) - - void aac_fib_map_free(struct aac_dev *dev) - { -- pci_free_consistent(dev->pdev, -- dev->max_fib_size * (dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB), -- dev->hw_fib_va, dev->hw_fib_pa); -+ if (dev->hw_fib_va && dev->max_fib_size) { -+ pci_free_consistent(dev->pdev, -+ (dev->max_fib_size * -+ (dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB)), -+ dev->hw_fib_va, dev->hw_fib_pa); -+ } - dev->hw_fib_va = NULL; - dev->hw_fib_pa = 0; - } -diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c -index bfe812fcce34..a683a831527b 100644 ---- a/drivers/scsi/be2iscsi/be_main.c -+++ b/drivers/scsi/be2iscsi/be_main.c -@@ -4040,6 +4040,7 @@ put_shost: - scsi_host_put(phba->shost); - free_kset: - iscsi_boot_destroy_kset(phba->boot_kset); -+ phba->boot_kset = NULL; - return -ENOMEM; - } - -diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c -index 4a79a5f0d95e..25ac2c00f8b3 100644 ---- a/drivers/scsi/ipr.c -+++ b/drivers/scsi/ipr.c -@@ -3908,13 +3908,17 @@ static ssize_t ipr_store_update_fw(struct device *dev, - struct ipr_sglist *sglist; - char fname[100]; - char *src; -- int len, result, dnld_size; -+ char *endline; -+ int result, dnld_size; - - if (!capable(CAP_SYS_ADMIN)) - return -EACCES; - -- len = snprintf(fname, 99, "%s", buf); -- fname[len-1] = '\0'; -+ snprintf(fname, sizeof(fname), "%s", buf); -+ -+ endline = strchr(fname, '\n'); -+ if (endline) -+ *endline = '\0'; - - if (request_firmware(&fw_entry, fname, &ioa_cfg->pdev->dev)) { - dev_err(&ioa_cfg->pdev->dev, "Firmware file %s not found\n", fname); -diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c -index cb465b253910..e6e0679ec882 100644 ---- a/drivers/scsi/lpfc/lpfc_init.c -+++ b/drivers/scsi/lpfc/lpfc_init.c -@@ -2684,7 +2684,7 @@ lpfc_online(struct lpfc_hba *phba) - } - - vports = lpfc_create_vport_work_array(phba); -- if (vports != NULL) -+ if (vports != NULL) { - for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { - struct Scsi_Host *shost; - shost = lpfc_shost_from_vport(vports[i]); -@@ -2701,7 +2701,8 @@ lpfc_online(struct lpfc_hba *phba) - } - spin_unlock_irq(shost->host_lock); - } -- lpfc_destroy_vport_work_array(phba, vports); -+ } -+ lpfc_destroy_vport_work_array(phba, vports); - - lpfc_unblock_mgmt_io(phba); - return 0; -diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c -index 0be16bf5f0cd..1f65e32db285 100644 ---- a/drivers/scsi/sg.c -+++ b/drivers/scsi/sg.c -@@ -633,7 +633,8 @@ sg_write(struct file *filp, const char __user *buf, size_t count, loff_t * ppos) - else - hp->dxfer_direction = (mxsize > 0) ? SG_DXFER_FROM_DEV : SG_DXFER_NONE; - hp->dxfer_len = mxsize; -- if (hp->dxfer_direction == SG_DXFER_TO_DEV) -+ if ((hp->dxfer_direction == SG_DXFER_TO_DEV) || -+ (hp->dxfer_direction == SG_DXFER_TO_FROM_DEV)) - hp->dxferp = (char __user *)buf + cmd_size; - else - hp->dxferp = NULL; -diff --git a/drivers/staging/usbip/usbip_common.c b/drivers/staging/usbip/usbip_common.c -index 7b97df6f2a42..b4f237e55931 100644 ---- a/drivers/staging/usbip/usbip_common.c -+++ b/drivers/staging/usbip/usbip_common.c -@@ -784,6 +784,17 @@ int usbip_recv_xbuff(struct usbip_device *ud, struct urb *urb) - if (!(size > 0)) - return 0; - -+ if (size > urb->transfer_buffer_length) { -+ /* should not happen, probably malicious packet */ -+ if (ud->side == USBIP_STUB) { -+ usbip_event_add(ud, SDEV_EVENT_ERROR_TCP); -+ return 0; -+ } else { -+ usbip_event_add(ud, VDEV_EVENT_ERROR_TCP); -+ return -EPIPE; -+ } -+ } -+ - ret = usbip_recv(ud->tcp_socket, urb->transfer_buffer, size); - if (ret != size) { - dev_err(&urb->dev->dev, "recv xbuf, %d\n", ret); -diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c -index d8c06a3d391e..1119d533c8e2 100644 ---- a/drivers/tty/serial/8250/8250_core.c -+++ b/drivers/tty/serial/8250/8250_core.c -@@ -686,22 +686,16 @@ static int size_fifo(struct uart_8250_port *up) - */ - static unsigned int autoconfig_read_divisor_id(struct uart_8250_port *p) - { -- unsigned char old_dll, old_dlm, old_lcr; -- unsigned int id; -+ unsigned char old_lcr; -+ unsigned int id, old_dl; - - old_lcr = serial_in(p, UART_LCR); - serial_out(p, UART_LCR, UART_LCR_CONF_MODE_A); -+ old_dl = serial_dl_read(p); -+ serial_dl_write(p, 0); -+ id = serial_dl_read(p); -+ serial_dl_write(p, old_dl); - -- old_dll = serial_in(p, UART_DLL); -- old_dlm = serial_in(p, UART_DLM); -- -- serial_out(p, UART_DLL, 0); -- serial_out(p, UART_DLM, 0); -- -- id = serial_in(p, UART_DLL) | serial_in(p, UART_DLM) << 8; -- -- serial_out(p, UART_DLL, old_dll); -- serial_out(p, UART_DLM, old_dlm); - serial_out(p, UART_LCR, old_lcr); - - return id; -diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c -index b8366b154fb9..921bf90bcc6a 100644 ---- a/drivers/tty/serial/samsung.c -+++ b/drivers/tty/serial/samsung.c -@@ -724,6 +724,8 @@ static void s3c24xx_serial_set_termios(struct uart_port *port, - /* check to see if we need to change clock source */ - - if (ourport->baudclk != clk) { -+ clk_prepare_enable(clk); -+ - s3c24xx_serial_setsource(port, clk_sel); - - if (!IS_ERR(ourport->baudclk)) { -@@ -731,8 +733,6 @@ static void s3c24xx_serial_set_termios(struct uart_port *port, - ourport->baudclk = ERR_PTR(-EINVAL); - } - -- clk_prepare_enable(clk); -- - ourport->baudclk = clk; - ourport->baudclk_rate = clk ? clk_get_rate(clk) : 0; - } -diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c -index db9d69fa1085..6dff194751f1 100644 ---- a/drivers/tty/vt/vt.c -+++ b/drivers/tty/vt/vt.c -@@ -3534,9 +3534,10 @@ static int do_register_con_driver(const struct consw *csw, int first, int last) - goto err; - - desc = csw->con_startup(); -- -- if (!desc) -+ if (!desc) { -+ retval = -ENODEV; - goto err; -+ } - - retval = -EINVAL; - -diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c -index d6dab8adf60e..e7436ebbf04c 100644 ---- a/drivers/usb/class/cdc-acm.c -+++ b/drivers/usb/class/cdc-acm.c -@@ -997,6 +997,9 @@ static int acm_probe(struct usb_interface *intf, - if (quirks == NO_UNION_NORMAL) { - data_interface = usb_ifnum_to_if(usb_dev, 1); - control_interface = usb_ifnum_to_if(usb_dev, 0); -+ /* we would crash */ -+ if (!data_interface || !control_interface) -+ return -ENODEV; - goto skip_normal_probe; - } - -diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c -index 2cdd5079ae78..f7310dd107ca 100644 ---- a/drivers/usb/core/driver.c -+++ b/drivers/usb/core/driver.c -@@ -461,11 +461,15 @@ static int usb_unbind_interface(struct device *dev) - int usb_driver_claim_interface(struct usb_driver *driver, - struct usb_interface *iface, void *priv) - { -- struct device *dev = &iface->dev; -+ struct device *dev; - struct usb_device *udev; - int retval = 0; - int lpm_disable_error; - -+ if (!iface) -+ return -ENODEV; -+ -+ dev = &iface->dev; - if (dev->driver) - return -EBUSY; - -diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c -index 4676917e2b1f..1eac8ddc5556 100644 ---- a/drivers/usb/core/hcd-pci.c -+++ b/drivers/usb/core/hcd-pci.c -@@ -74,6 +74,15 @@ static void for_each_companion(struct pci_dev *pdev, struct usb_hcd *hcd, - if (companion->bus != pdev->bus || - PCI_SLOT(companion->devfn) != slot) - continue; -+ -+ /* -+ * Companion device should be either UHCI,OHCI or EHCI host -+ * controller, otherwise skip. -+ */ -+ if (companion->class != CL_UHCI && companion->class != CL_OHCI && -+ companion->class != CL_EHCI) -+ continue; -+ - companion_hcd = pci_get_drvdata(companion); - if (!companion_hcd || !companion_hcd->self.root_hub) - continue; -diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c -index 92873f2773fc..8eb2de6beee4 100644 ---- a/drivers/usb/core/hub.c -+++ b/drivers/usb/core/hub.c -@@ -4167,7 +4167,13 @@ hub_port_init (struct usb_hub *hub, struct usb_device *udev, int port1, - r = -EPROTO; - break; - } -- if (r == 0) -+ /* -+ * Some devices time out if they are powered on -+ * when already connected. They need a second -+ * reset. But only on the first attempt, -+ * lest we get into a time out/reset loop -+ */ -+ if (r == 0 || (r == -ETIMEDOUT && j == 0)) - break; - } - udev->descriptor.bMaxPacketSize0 = -diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c -index 87e82e6b0c38..af9e4e8c9064 100644 ---- a/drivers/usb/host/xhci-mem.c -+++ b/drivers/usb/host/xhci-mem.c -@@ -1861,6 +1861,11 @@ no_bw: - kfree(xhci->port_array); - kfree(xhci->rh_bw); - -+ xhci->usb2_ports = NULL; -+ xhci->usb3_ports = NULL; -+ xhci->port_array = NULL; -+ xhci->rh_bw = NULL; -+ - xhci->page_size = 0; - xhci->page_shift = 0; - xhci->bus_state[0].bus_suspended = 0; -diff --git a/drivers/usb/misc/iowarrior.c b/drivers/usb/misc/iowarrior.c -index d36f34e25bed..4c24ba0a6574 100644 ---- a/drivers/usb/misc/iowarrior.c -+++ b/drivers/usb/misc/iowarrior.c -@@ -792,6 +792,12 @@ static int iowarrior_probe(struct usb_interface *interface, - iface_desc = interface->cur_altsetting; - dev->product_id = le16_to_cpu(udev->descriptor.idProduct); - -+ if (iface_desc->desc.bNumEndpoints < 1) { -+ dev_err(&interface->dev, "Invalid number of endpoints\n"); -+ retval = -EINVAL; -+ goto error; -+ } -+ - /* set up the endpoint information */ - for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) { - endpoint = &iface_desc->endpoint[i].desc; -diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c -index 45b94019aec8..157a9f9afc2d 100644 ---- a/drivers/usb/renesas_usbhs/fifo.c -+++ b/drivers/usb/renesas_usbhs/fifo.c -@@ -166,7 +166,8 @@ static int usbhsf_pkt_handler(struct usbhs_pipe *pipe, int type) - goto __usbhs_pkt_handler_end; - } - -- ret = func(pkt, &is_done); -+ if (likely(func)) -+ ret = func(pkt, &is_done); - - if (is_done) - __usbhsf_pkt_del(pkt); -@@ -933,6 +934,7 @@ static int usbhsf_dma_try_pop(struct usbhs_pkt *pkt, int *is_done) - - pkt->trans = len; - -+ usbhsf_tx_irq_ctrl(pipe, 0); - INIT_WORK(&pkt->work, xfer_work); - schedule_work(&pkt->work); - -diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c -index 84b770461655..0093261ccc57 100644 ---- a/drivers/usb/serial/cp210x.c -+++ b/drivers/usb/serial/cp210x.c -@@ -108,6 +108,7 @@ static const struct usb_device_id id_table[] = { - { USB_DEVICE(0x10C4, 0x826B) }, /* Cygnal Integrated Products, Inc., Fasttrax GPS demonstration module */ - { USB_DEVICE(0x10C4, 0x8281) }, /* Nanotec Plug & Drive */ - { USB_DEVICE(0x10C4, 0x8293) }, /* Telegesis ETRX2USB */ -+ { USB_DEVICE(0x10C4, 0x82F4) }, /* Starizona MicroTouch */ - { USB_DEVICE(0x10C4, 0x82F9) }, /* Procyon AVS */ - { USB_DEVICE(0x10C4, 0x8341) }, /* Siemens MC35PU GPRS Modem */ - { USB_DEVICE(0x10C4, 0x8382) }, /* Cygnal Integrated Products, Inc. */ -@@ -117,6 +118,7 @@ static const struct usb_device_id id_table[] = { - { USB_DEVICE(0x10C4, 0x8418) }, /* IRZ Automation Teleport SG-10 GSM/GPRS Modem */ - { USB_DEVICE(0x10C4, 0x846E) }, /* BEI USB Sensor Interface (VCP) */ - { USB_DEVICE(0x10C4, 0x8477) }, /* Balluff RFID */ -+ { USB_DEVICE(0x10C4, 0x84B6) }, /* Starizona Hyperion */ - { USB_DEVICE(0x10C4, 0x85EA) }, /* AC-Services IBUS-IF */ - { USB_DEVICE(0x10C4, 0x85EB) }, /* AC-Services CIS-IBUS */ - { USB_DEVICE(0x10C4, 0x85F8) }, /* Virtenio Preon32 */ -@@ -140,6 +142,8 @@ static const struct usb_device_id id_table[] = { - { USB_DEVICE(0x10C4, 0xF004) }, /* Elan Digital Systems USBcount50 */ - { USB_DEVICE(0x10C5, 0xEA61) }, /* Silicon Labs MobiData GPRS USB Modem */ - { USB_DEVICE(0x10CE, 0xEA6A) }, /* Silicon Labs MobiData GPRS USB Modem 100EU */ -+ { USB_DEVICE(0x12B8, 0xEC60) }, /* Link G4 ECU */ -+ { USB_DEVICE(0x12B8, 0xEC62) }, /* Link G4+ ECU */ - { USB_DEVICE(0x13AD, 0x9999) }, /* Baltech card reader */ - { USB_DEVICE(0x1555, 0x0004) }, /* Owen AC4 USB-RS485 Converter */ - { USB_DEVICE(0x166A, 0x0201) }, /* Clipsal 5500PACA C-Bus Pascal Automation Controller */ -@@ -164,6 +168,7 @@ static const struct usb_device_id id_table[] = { - { USB_DEVICE(0x18EF, 0xE025) }, /* ELV Marble Sound Board 1 */ - { USB_DEVICE(0x1901, 0x0190) }, /* GE B850 CP2105 Recorder interface */ - { USB_DEVICE(0x1901, 0x0193) }, /* GE B650 CP2104 PMC interface */ -+ { USB_DEVICE(0x1901, 0x0194) }, /* GE Healthcare Remote Alarm Box */ - { USB_DEVICE(0x19CF, 0x3000) }, /* Parrot NMEA GPS Flight Recorder */ - { USB_DEVICE(0x1ADB, 0x0001) }, /* Schweitzer Engineering C662 Cable */ - { USB_DEVICE(0x1B1C, 0x1C00) }, /* Corsair USB Dongle */ -diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c -index 082120198f87..09f0f631389e 100644 ---- a/drivers/usb/serial/cypress_m8.c -+++ b/drivers/usb/serial/cypress_m8.c -@@ -449,6 +449,11 @@ static int cypress_generic_port_probe(struct usb_serial_port *port) - struct usb_serial *serial = port->serial; - struct cypress_private *priv; - -+ if (!port->interrupt_out_urb || !port->interrupt_in_urb) { -+ dev_err(&port->dev, "required endpoint is missing\n"); -+ return -ENODEV; -+ } -+ - priv = kzalloc(sizeof(struct cypress_private), GFP_KERNEL); - if (!priv) - return -ENOMEM; -@@ -606,12 +611,6 @@ static int cypress_open(struct tty_struct *tty, struct usb_serial_port *port) - cypress_set_termios(tty, port, &priv->tmp_termios); - - /* setup the port and start reading from the device */ -- if (!port->interrupt_in_urb) { -- dev_err(&port->dev, "%s - interrupt_in_urb is empty!\n", -- __func__); -- return -1; -- } -- - usb_fill_int_urb(port->interrupt_in_urb, serial->dev, - usb_rcvintpipe(serial->dev, port->interrupt_in_endpointAddress), - port->interrupt_in_urb->transfer_buffer, -diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c -index 7b807d389527..8c34d9cfb226 100644 ---- a/drivers/usb/serial/digi_acceleport.c -+++ b/drivers/usb/serial/digi_acceleport.c -@@ -1253,8 +1253,27 @@ static int digi_port_init(struct usb_serial_port *port, unsigned port_num) - - static int digi_startup(struct usb_serial *serial) - { -+ struct device *dev = &serial->interface->dev; - struct digi_serial *serial_priv; - int ret; -+ int i; -+ -+ /* check whether the device has the expected number of endpoints */ -+ if (serial->num_port_pointers < serial->type->num_ports + 1) { -+ dev_err(dev, "OOB endpoints missing\n"); -+ return -ENODEV; -+ } -+ -+ for (i = 0; i < serial->type->num_ports + 1 ; i++) { -+ if (!serial->port[i]->read_urb) { -+ dev_err(dev, "bulk-in endpoint missing\n"); -+ return -ENODEV; -+ } -+ if (!serial->port[i]->write_urb) { -+ dev_err(dev, "bulk-out endpoint missing\n"); -+ return -ENODEV; -+ } -+ } - - serial_priv = kzalloc(sizeof(*serial_priv), GFP_KERNEL); - if (!serial_priv) -diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c -index 1477e8593476..c574d312f1f5 100644 ---- a/drivers/usb/serial/io_edgeport.c -+++ b/drivers/usb/serial/io_edgeport.c -@@ -2988,16 +2988,9 @@ static void edge_disconnect(struct usb_serial *serial) - { - struct edgeport_serial *edge_serial = usb_get_serial_data(serial); - -- /* stop reads and writes on all ports */ -- /* free up our endpoint stuff */ - if (edge_serial->is_epic) { - usb_kill_urb(edge_serial->interrupt_read_urb); -- usb_free_urb(edge_serial->interrupt_read_urb); -- kfree(edge_serial->interrupt_in_buffer); -- - usb_kill_urb(edge_serial->read_urb); -- usb_free_urb(edge_serial->read_urb); -- kfree(edge_serial->bulk_in_buffer); - } - } - -@@ -3010,6 +3003,16 @@ static void edge_release(struct usb_serial *serial) - { - struct edgeport_serial *edge_serial = usb_get_serial_data(serial); - -+ if (edge_serial->is_epic) { -+ usb_kill_urb(edge_serial->interrupt_read_urb); -+ usb_free_urb(edge_serial->interrupt_read_urb); -+ kfree(edge_serial->interrupt_in_buffer); -+ -+ usb_kill_urb(edge_serial->read_urb); -+ usb_free_urb(edge_serial->read_urb); -+ kfree(edge_serial->bulk_in_buffer); -+ } -+ - kfree(edge_serial); - } - -diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c -index cec377b8bb8b..32a67c69eec8 100644 ---- a/drivers/usb/serial/keyspan.c -+++ b/drivers/usb/serial/keyspan.c -@@ -2392,6 +2392,10 @@ static void keyspan_release(struct usb_serial *serial) - - s_priv = usb_get_serial_data(serial); - -+ /* Make sure to unlink the URBs submitted in attach. */ -+ usb_kill_urb(s_priv->instat_urb); -+ usb_kill_urb(s_priv->indat_urb); -+ - usb_free_urb(s_priv->instat_urb); - usb_free_urb(s_priv->indat_urb); - usb_free_urb(s_priv->glocont_urb); -diff --git a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c -index 6a15adf53360..c14c29ff1151 100644 ---- a/drivers/usb/serial/mct_u232.c -+++ b/drivers/usb/serial/mct_u232.c -@@ -377,14 +377,21 @@ static void mct_u232_msr_to_state(struct usb_serial_port *port, - - static int mct_u232_port_probe(struct usb_serial_port *port) - { -+ struct usb_serial *serial = port->serial; - struct mct_u232_private *priv; - -+ /* check first to simplify error handling */ -+ if (!serial->port[1] || !serial->port[1]->interrupt_in_urb) { -+ dev_err(&port->dev, "expected endpoint missing\n"); -+ return -ENODEV; -+ } -+ - priv = kzalloc(sizeof(*priv), GFP_KERNEL); - if (!priv) - return -ENOMEM; - - /* Use second interrupt-in endpoint for reading. */ -- priv->read_urb = port->serial->port[1]->interrupt_in_urb; -+ priv->read_urb = serial->port[1]->interrupt_in_urb; - priv->read_urb->context = port; - - spin_lock_init(&priv->lock); -diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c -index 24366a2afea6..bcb6f5c2bae4 100644 ---- a/drivers/usb/serial/option.c -+++ b/drivers/usb/serial/option.c -@@ -375,18 +375,22 @@ static void option_instat_callback(struct urb *urb); - #define HAIER_PRODUCT_CE81B 0x10f8 - #define HAIER_PRODUCT_CE100 0x2009 - --/* Cinterion (formerly Siemens) products */ --#define SIEMENS_VENDOR_ID 0x0681 --#define CINTERION_VENDOR_ID 0x1e2d -+/* Gemalto's Cinterion products (formerly Siemens) */ -+#define SIEMENS_VENDOR_ID 0x0681 -+#define CINTERION_VENDOR_ID 0x1e2d -+#define CINTERION_PRODUCT_HC25_MDMNET 0x0040 - #define CINTERION_PRODUCT_HC25_MDM 0x0047 --#define CINTERION_PRODUCT_HC25_MDMNET 0x0040 -+#define CINTERION_PRODUCT_HC28_MDMNET 0x004A /* same for HC28J */ - #define CINTERION_PRODUCT_HC28_MDM 0x004C --#define CINTERION_PRODUCT_HC28_MDMNET 0x004A /* same for HC28J */ - #define CINTERION_PRODUCT_EU3_E 0x0051 - #define CINTERION_PRODUCT_EU3_P 0x0052 - #define CINTERION_PRODUCT_PH8 0x0053 - #define CINTERION_PRODUCT_AHXX 0x0055 - #define CINTERION_PRODUCT_PLXX 0x0060 -+#define CINTERION_PRODUCT_PH8_2RMNET 0x0082 -+#define CINTERION_PRODUCT_PH8_AUDIO 0x0083 -+#define CINTERION_PRODUCT_AHXX_2RMNET 0x0084 -+#define CINTERION_PRODUCT_AHXX_AUDIO 0x0085 - - /* Olivetti products */ - #define OLIVETTI_VENDOR_ID 0x0b3c -@@ -641,6 +645,10 @@ static const struct option_blacklist_info telit_le922_blacklist_usbcfg3 = { - .reserved = BIT(1) | BIT(2) | BIT(3), - }; - -+static const struct option_blacklist_info cinterion_rmnet2_blacklist = { -+ .reserved = BIT(4) | BIT(5), -+}; -+ - static const struct usb_device_id option_ids[] = { - { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) }, - { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) }, -@@ -1712,7 +1720,13 @@ static const struct usb_device_id option_ids[] = { - { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_AHXX, 0xff) }, - { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PLXX), - .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, -- { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDM) }, -+ { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PH8_2RMNET, 0xff), -+ .driver_info = (kernel_ulong_t)&cinterion_rmnet2_blacklist }, -+ { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PH8_AUDIO, 0xff), -+ .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, -+ { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_AHXX_2RMNET, 0xff) }, -+ { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_AHXX_AUDIO, 0xff) }, -+ { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDM) }, - { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDMNET) }, - { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC25_MDM) }, - { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC25_MDMNET) }, -@@ -1818,6 +1832,8 @@ static const struct usb_device_id option_ids[] = { - { USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x7d02, 0xff, 0x00, 0x00) }, - { USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x7d03, 0xff, 0x02, 0x01) }, - { USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x7d03, 0xff, 0x00, 0x00) }, -+ { USB_DEVICE_INTERFACE_CLASS(0x2001, 0x7e19, 0xff), /* D-Link DWM-221 B1 */ -+ .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, - { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e01, 0xff, 0xff, 0xff) }, /* D-Link DWM-152/C1 */ - { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e02, 0xff, 0xff, 0xff) }, /* D-Link DWM-156/C1 */ - { USB_DEVICE_INTERFACE_CLASS(0x2020, 0x4000, 0xff) }, /* OLICARD300 - MT6225 */ -diff --git a/drivers/usb/serial/quatech2.c b/drivers/usb/serial/quatech2.c -index 02b0803425c5..13824b5ca343 100644 ---- a/drivers/usb/serial/quatech2.c -+++ b/drivers/usb/serial/quatech2.c -@@ -141,6 +141,7 @@ static void qt2_release(struct usb_serial *serial) - - serial_priv = usb_get_serial_data(serial); - -+ usb_kill_urb(serial_priv->read_urb); - usb_free_urb(serial_priv->read_urb); - kfree(serial_priv); - } -diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c -index 0810939936f4..b13bfb2e52a2 100644 ---- a/drivers/video/da8xx-fb.c -+++ b/drivers/video/da8xx-fb.c -@@ -226,8 +226,7 @@ static struct fb_videomode known_lcd_panels[] = { - .lower_margin = 2, - .hsync_len = 0, - .vsync_len = 0, -- .sync = FB_SYNC_CLK_INVERT | -- FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, -+ .sync = FB_SYNC_CLK_INVERT, - }, - /* Sharp LK043T1DG01 */ - [1] = { -@@ -241,7 +240,7 @@ static struct fb_videomode known_lcd_panels[] = { - .lower_margin = 2, - .hsync_len = 41, - .vsync_len = 10, -- .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, -+ .sync = 0, - .flag = 0, - }, - [2] = { -@@ -256,7 +255,7 @@ static struct fb_videomode known_lcd_panels[] = { - .lower_margin = 10, - .hsync_len = 10, - .vsync_len = 10, -- .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, -+ .sync = 0, - .flag = 0, - }, - }; -diff --git a/drivers/watchdog/rc32434_wdt.c b/drivers/watchdog/rc32434_wdt.c -index f78bc008cbb7..ea8f58216d4d 100644 ---- a/drivers/watchdog/rc32434_wdt.c -+++ b/drivers/watchdog/rc32434_wdt.c -@@ -237,7 +237,7 @@ static long rc32434_wdt_ioctl(struct file *file, unsigned int cmd, - return -EINVAL; - /* Fall through */ - case WDIOC_GETTIMEOUT: -- return copy_to_user(argp, &timeout, sizeof(int)); -+ return copy_to_user(argp, &timeout, sizeof(int)) ? -EFAULT : 0; - default: - return -ENOTTY; - } -diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c -index 8edc9eb1ef7b..d65e16e9d1d9 100644 ---- a/fs/cifs/sess.c -+++ b/fs/cifs/sess.c -@@ -487,19 +487,27 @@ int build_ntlmssp_auth_blob(unsigned char *pbuffer, - sec_blob->LmChallengeResponse.MaximumLength = 0; - - sec_blob->NtChallengeResponse.BufferOffset = cpu_to_le32(tmp - pbuffer); -- rc = setup_ntlmv2_rsp(ses, nls_cp); -- if (rc) { -- cifs_dbg(VFS, "Error %d during NTLMSSP authentication\n", rc); -- goto setup_ntlmv2_ret; -- } -- memcpy(tmp, ses->auth_key.response + CIFS_SESS_KEY_SIZE, -- ses->auth_key.len - CIFS_SESS_KEY_SIZE); -- tmp += ses->auth_key.len - CIFS_SESS_KEY_SIZE; -+ if (ses->user_name != NULL) { -+ rc = setup_ntlmv2_rsp(ses, nls_cp); -+ if (rc) { -+ cifs_dbg(VFS, "Error %d during NTLMSSP authentication\n", rc); -+ goto setup_ntlmv2_ret; -+ } -+ memcpy(tmp, ses->auth_key.response + CIFS_SESS_KEY_SIZE, -+ ses->auth_key.len - CIFS_SESS_KEY_SIZE); -+ tmp += ses->auth_key.len - CIFS_SESS_KEY_SIZE; - -- sec_blob->NtChallengeResponse.Length = -- cpu_to_le16(ses->auth_key.len - CIFS_SESS_KEY_SIZE); -- sec_blob->NtChallengeResponse.MaximumLength = -- cpu_to_le16(ses->auth_key.len - CIFS_SESS_KEY_SIZE); -+ sec_blob->NtChallengeResponse.Length = -+ cpu_to_le16(ses->auth_key.len - CIFS_SESS_KEY_SIZE); -+ sec_blob->NtChallengeResponse.MaximumLength = -+ cpu_to_le16(ses->auth_key.len - CIFS_SESS_KEY_SIZE); -+ } else { -+ /* -+ * don't send an NT Response for anonymous access -+ */ -+ sec_blob->NtChallengeResponse.Length = 0; -+ sec_blob->NtChallengeResponse.MaximumLength = 0; -+ } - - if (ses->domainName == NULL) { - sec_blob->DomainName.BufferOffset = cpu_to_le32(tmp - pbuffer); -diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h -index 6f74b8919237..046e3e93783e 100644 ---- a/fs/ext4/ext4.h -+++ b/fs/ext4/ext4.h -@@ -851,6 +851,29 @@ do { \ - #include "extents_status.h" - - /* -+ * Lock subclasses for i_data_sem in the ext4_inode_info structure. -+ * -+ * These are needed to avoid lockdep false positives when we need to -+ * allocate blocks to the quota inode during ext4_map_blocks(), while -+ * holding i_data_sem for a normal (non-quota) inode. Since we don't -+ * do quota tracking for the quota inode, this avoids deadlock (as -+ * well as infinite recursion, since it isn't turtles all the way -+ * down...) -+ * -+ * I_DATA_SEM_NORMAL - Used for most inodes -+ * I_DATA_SEM_OTHER - Used by move_inode.c for the second normal inode -+ * where the second inode has larger inode number -+ * than the first -+ * I_DATA_SEM_QUOTA - Used for quota inodes only -+ */ -+enum { -+ I_DATA_SEM_NORMAL = 0, -+ I_DATA_SEM_OTHER, -+ I_DATA_SEM_QUOTA, -+}; -+ -+ -+/* - * fourth extended file system inode data in memory - */ - struct ext4_inode_info { -diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c -index 10b71e4029a0..fb7e576df25c 100644 ---- a/fs/ext4/inode.c -+++ b/fs/ext4/inode.c -@@ -5063,6 +5063,8 @@ int ext4_mark_inode_dirty(handle_t *handle, struct inode *inode) - might_sleep(); - trace_ext4_mark_inode_dirty(inode, _RET_IP_); - err = ext4_reserve_inode_write(handle, inode, &iloc); -+ if (err) -+ return err; - if (ext4_handle_valid(handle) && - EXT4_I(inode)->i_extra_isize < sbi->s_want_extra_isize && - !ext4_test_inode_state(inode, EXT4_STATE_NO_EXPAND)) { -@@ -5093,9 +5095,7 @@ int ext4_mark_inode_dirty(handle_t *handle, struct inode *inode) - } - } - } -- if (!err) -- err = ext4_mark_iloc_dirty(handle, inode, &iloc); -- return err; -+ return ext4_mark_iloc_dirty(handle, inode, &iloc); - } - - /* -diff --git a/fs/ext4/move_extent.c b/fs/ext4/move_extent.c -index 3dcbf364022f..ad52ace2b79a 100644 ---- a/fs/ext4/move_extent.c -+++ b/fs/ext4/move_extent.c -@@ -154,10 +154,10 @@ ext4_double_down_write_data_sem(struct inode *first, struct inode *second) - { - if (first < second) { - down_write(&EXT4_I(first)->i_data_sem); -- down_write_nested(&EXT4_I(second)->i_data_sem, SINGLE_DEPTH_NESTING); -+ down_write_nested(&EXT4_I(second)->i_data_sem, I_DATA_SEM_OTHER); - } else { - down_write(&EXT4_I(second)->i_data_sem); -- down_write_nested(&EXT4_I(first)->i_data_sem, SINGLE_DEPTH_NESTING); -+ down_write_nested(&EXT4_I(first)->i_data_sem, I_DATA_SEM_OTHER); - - } - } -@@ -1117,6 +1117,13 @@ mext_check_arguments(struct inode *orig_inode, - return -EINVAL; - } - -+ if (IS_NOQUOTA(orig_inode) || IS_NOQUOTA(donor_inode)) { -+ ext4_debug("ext4 move extent: The argument files should " -+ "not be quota files [ino:orig %lu, donor %lu]\n", -+ orig_inode->i_ino, donor_inode->i_ino); -+ return -EBUSY; -+ } -+ - /* Ext4 move extent supports only extent based file */ - if (!(ext4_test_inode_flag(orig_inode, EXT4_INODE_EXTENTS))) { - ext4_debug("ext4 move extent: orig file is not extents " -diff --git a/fs/ext4/super.c b/fs/ext4/super.c -index a7e079749425..063eb5094a63 100644 ---- a/fs/ext4/super.c -+++ b/fs/ext4/super.c -@@ -4984,6 +4984,20 @@ static int ext4_quota_on_mount(struct super_block *sb, int type) - EXT4_SB(sb)->s_jquota_fmt, type); - } - -+static void lockdep_set_quota_inode(struct inode *inode, int subclass) -+{ -+ struct ext4_inode_info *ei = EXT4_I(inode); -+ -+ /* The first argument of lockdep_set_subclass has to be -+ * *exactly* the same as the argument to init_rwsem() --- in -+ * this case, in init_once() --- or lockdep gets unhappy -+ * because the name of the lock is set using the -+ * stringification of the argument to init_rwsem(). -+ */ -+ (void) ei; /* shut up clang warning if !CONFIG_LOCKDEP */ -+ lockdep_set_subclass(&ei->i_data_sem, subclass); -+} -+ - /* - * Standard function to be called on quota_on - */ -@@ -5023,8 +5037,12 @@ static int ext4_quota_on(struct super_block *sb, int type, int format_id, - if (err) - return err; - } -- -- return dquot_quota_on(sb, type, format_id, path); -+ lockdep_set_quota_inode(path->dentry->d_inode, I_DATA_SEM_QUOTA); -+ err = dquot_quota_on(sb, type, format_id, path); -+ if (err) -+ lockdep_set_quota_inode(path->dentry->d_inode, -+ I_DATA_SEM_NORMAL); -+ return err; - } - - static int ext4_quota_enable(struct super_block *sb, int type, int format_id, -@@ -5050,8 +5068,11 @@ static int ext4_quota_enable(struct super_block *sb, int type, int format_id, - - /* Don't account quota for quota files to avoid recursion */ - qf_inode->i_flags |= S_NOQUOTA; -+ lockdep_set_quota_inode(qf_inode, I_DATA_SEM_QUOTA); - err = dquot_enable(qf_inode, type, format_id, flags); - iput(qf_inode); -+ if (err) -+ lockdep_set_quota_inode(qf_inode, I_DATA_SEM_NORMAL); - - return err; - } -diff --git a/fs/isofs/rock.c b/fs/isofs/rock.c -index 735d7522a3a9..204659a5f6db 100644 ---- a/fs/isofs/rock.c -+++ b/fs/isofs/rock.c -@@ -203,6 +203,8 @@ int get_rock_ridge_filename(struct iso_directory_record *de, - int retnamlen = 0; - int truncate = 0; - int ret = 0; -+ char *p; -+ int len; - - if (!ISOFS_SB(inode->i_sb)->s_rock) - return 0; -@@ -267,12 +269,17 @@ repeat: - rr->u.NM.flags); - break; - } -- if ((strlen(retname) + rr->len - 5) >= 254) { -+ len = rr->len - 5; -+ if (retnamlen + len >= 254) { - truncate = 1; - break; - } -- strncat(retname, rr->u.NM.name, rr->len - 5); -- retnamlen += rr->len - 5; -+ p = memchr(rr->u.NM.name, '\0', len); -+ if (unlikely(p)) -+ len = p - rr->u.NM.name; -+ memcpy(retname + retnamlen, rr->u.NM.name, len); -+ retnamlen += len; -+ retname[retnamlen] = '\0'; - break; - case SIG('R', 'E'): - kfree(rs.buffer); -diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c -index 644f95e7208f..85733dd95e14 100644 ---- a/fs/jbd2/journal.c -+++ b/fs/jbd2/journal.c -@@ -1407,11 +1407,12 @@ out: - /** - * jbd2_mark_journal_empty() - Mark on disk journal as empty. - * @journal: The journal to update. -+ * @write_op: With which operation should we write the journal sb - * - * Update a journal's dynamic superblock fields to show that journal is empty. - * Write updated superblock to disk waiting for IO to complete. - */ --static void jbd2_mark_journal_empty(journal_t *journal) -+static void jbd2_mark_journal_empty(journal_t *journal, int write_op) - { - journal_superblock_t *sb = journal->j_superblock; - -@@ -1429,7 +1430,7 @@ static void jbd2_mark_journal_empty(journal_t *journal) - sb->s_start = cpu_to_be32(0); - read_unlock(&journal->j_state_lock); - -- jbd2_write_superblock(journal, WRITE_FUA); -+ jbd2_write_superblock(journal, write_op); - - /* Log is no longer empty */ - write_lock(&journal->j_state_lock); -@@ -1697,7 +1698,13 @@ int jbd2_journal_destroy(journal_t *journal) - if (journal->j_sb_buffer) { - if (!is_journal_aborted(journal)) { - mutex_lock(&journal->j_checkpoint_mutex); -- jbd2_mark_journal_empty(journal); -+ -+ write_lock(&journal->j_state_lock); -+ journal->j_tail_sequence = -+ ++journal->j_transaction_sequence; -+ write_unlock(&journal->j_state_lock); -+ -+ jbd2_mark_journal_empty(journal, WRITE_FLUSH_FUA); - mutex_unlock(&journal->j_checkpoint_mutex); - } else - err = -EIO; -@@ -1952,7 +1959,7 @@ int jbd2_journal_flush(journal_t *journal) - * the magic code for a fully-recovered superblock. Any future - * commits of data to the journal will restore the current - * s_start value. */ -- jbd2_mark_journal_empty(journal); -+ jbd2_mark_journal_empty(journal, WRITE_FUA); - mutex_unlock(&journal->j_checkpoint_mutex); - write_lock(&journal->j_state_lock); - J_ASSERT(!journal->j_running_transaction); -@@ -1998,7 +2005,7 @@ int jbd2_journal_wipe(journal_t *journal, int write) - if (write) { - /* Lock to make assertions happy... */ - mutex_lock(&journal->j_checkpoint_mutex); -- jbd2_mark_journal_empty(journal); -+ jbd2_mark_journal_empty(journal, WRITE_FUA); - mutex_unlock(&journal->j_checkpoint_mutex); - } - -diff --git a/fs/ocfs2/dlm/dlmconvert.c b/fs/ocfs2/dlm/dlmconvert.c -index 29a886d1e82c..f65bdcf61526 100644 ---- a/fs/ocfs2/dlm/dlmconvert.c -+++ b/fs/ocfs2/dlm/dlmconvert.c -@@ -265,6 +265,7 @@ enum dlm_status dlmconvert_remote(struct dlm_ctxt *dlm, - struct dlm_lock *lock, int flags, int type) - { - enum dlm_status status; -+ u8 old_owner = res->owner; - - mlog(0, "type=%d, convert_type=%d, busy=%d\n", lock->ml.type, - lock->ml.convert_type, res->state & DLM_LOCK_RES_IN_PROGRESS); -@@ -290,6 +291,19 @@ enum dlm_status dlmconvert_remote(struct dlm_ctxt *dlm, - status = DLM_DENIED; - goto bail; - } -+ -+ if (lock->ml.type == type && lock->ml.convert_type == LKM_IVMODE) { -+ mlog(0, "last convert request returned DLM_RECOVERING, but " -+ "owner has already queued and sent ast to me. res %.*s, " -+ "(cookie=%u:%llu, type=%d, conv=%d)\n", -+ res->lockname.len, res->lockname.name, -+ dlm_get_lock_cookie_node(be64_to_cpu(lock->ml.cookie)), -+ dlm_get_lock_cookie_seq(be64_to_cpu(lock->ml.cookie)), -+ lock->ml.type, lock->ml.convert_type); -+ status = DLM_NORMAL; -+ goto bail; -+ } -+ - res->state |= DLM_LOCK_RES_IN_PROGRESS; - /* move lock to local convert queue */ - /* do not alter lock refcount. switching lists. */ -@@ -319,11 +333,19 @@ enum dlm_status dlmconvert_remote(struct dlm_ctxt *dlm, - spin_lock(&res->spinlock); - res->state &= ~DLM_LOCK_RES_IN_PROGRESS; - lock->convert_pending = 0; -- /* if it failed, move it back to granted queue */ -+ /* if it failed, move it back to granted queue. -+ * if master returns DLM_NORMAL and then down before sending ast, -+ * it may have already been moved to granted queue, reset to -+ * DLM_RECOVERING and retry convert */ - if (status != DLM_NORMAL) { - if (status != DLM_NOTQUEUED) - dlm_error(status); - dlm_revert_pending_convert(res, lock); -+ } else if ((res->state & DLM_LOCK_RES_RECOVERING) || -+ (old_owner != res->owner)) { -+ mlog(0, "res %.*s is in recovering or has been recovered.\n", -+ res->lockname.len, res->lockname.name); -+ status = DLM_RECOVERING; - } - bail: - spin_unlock(&res->spinlock); -diff --git a/fs/ocfs2/dlm/dlmrecovery.c b/fs/ocfs2/dlm/dlmrecovery.c -index 01c69f24e416..33e9d705ee8f 100644 ---- a/fs/ocfs2/dlm/dlmrecovery.c -+++ b/fs/ocfs2/dlm/dlmrecovery.c -@@ -2034,7 +2034,6 @@ void dlm_move_lockres_to_recovery_list(struct dlm_ctxt *dlm, - dlm_lock_get(lock); - if (lock->convert_pending) { - /* move converting lock back to granted */ -- BUG_ON(i != DLM_CONVERTING_LIST); - mlog(0, "node died with convert pending " - "on %.*s. move back to granted list.\n", - res->lockname.len, res->lockname.name); -diff --git a/fs/pipe.c b/fs/pipe.c -index 3e7ab278bb0c..50267e6ba688 100644 ---- a/fs/pipe.c -+++ b/fs/pipe.c -@@ -401,6 +401,7 @@ pipe_read(struct kiocb *iocb, const struct iovec *_iov, - void *addr; - size_t chars = buf->len, remaining; - int error, atomic; -+ int offset; - - if (chars > total_len) - chars = total_len; -@@ -414,9 +415,10 @@ pipe_read(struct kiocb *iocb, const struct iovec *_iov, - - atomic = !iov_fault_in_pages_write(iov, chars); - remaining = chars; -+ offset = buf->offset; - redo: - addr = ops->map(pipe, buf, atomic); -- error = pipe_iov_copy_to_user(iov, addr, &buf->offset, -+ error = pipe_iov_copy_to_user(iov, addr, &offset, - &remaining, atomic); - ops->unmap(pipe, buf, addr); - if (unlikely(error)) { -@@ -432,6 +434,7 @@ redo: - break; - } - ret += chars; -+ buf->offset += chars; - buf->len -= chars; - - /* Was it a packet buffer? Clean up and exit */ -diff --git a/fs/proc/base.c b/fs/proc/base.c -index 7b5d453ebf53..e5160b744d0b 100644 ---- a/fs/proc/base.c -+++ b/fs/proc/base.c -@@ -844,7 +844,8 @@ static ssize_t environ_read(struct file *file, char __user *buf, - int ret = 0; - struct mm_struct *mm = file->private_data; - -- if (!mm) -+ /* Ensure the process spawned far enough to have an environment. */ -+ if (!mm || !mm->env_end) - return 0; - - page = (char *)__get_free_page(GFP_TEMPORARY); -diff --git a/fs/splice.c b/fs/splice.c -index 3b94a6bba29f..2ffa7b0c62fd 100644 ---- a/fs/splice.c -+++ b/fs/splice.c -@@ -189,6 +189,9 @@ ssize_t splice_to_pipe(struct pipe_inode_info *pipe, - unsigned int spd_pages = spd->nr_pages; - int ret, do_wakeup, page_nr; - -+ if (!spd_pages) -+ return 0; -+ - ret = 0; - do_wakeup = 0; - page_nr = 0; -diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h -index 02ae99e8e6d3..953cd12175c4 100644 ---- a/include/linux/compiler-gcc.h -+++ b/include/linux/compiler-gcc.h -@@ -100,10 +100,116 @@ - #define __maybe_unused __attribute__((unused)) - #define __always_unused __attribute__((unused)) - --#define __gcc_header(x) #x --#define _gcc_header(x) __gcc_header(linux/compiler-gcc##x.h) --#define gcc_header(x) _gcc_header(x) --#include gcc_header(__GNUC__) -+/* gcc version specific checks */ -+ -+#if GCC_VERSION < 30200 -+# error Sorry, your compiler is too old - please upgrade it. -+#endif -+ -+#if GCC_VERSION < 30300 -+# define __used __attribute__((__unused__)) -+#else -+# define __used __attribute__((__used__)) -+#endif -+ -+#ifdef CONFIG_GCOV_KERNEL -+# if GCC_VERSION < 30400 -+# error "GCOV profiling support for gcc versions below 3.4 not included" -+# endif /* __GNUC_MINOR__ */ -+#endif /* CONFIG_GCOV_KERNEL */ -+ -+#if GCC_VERSION >= 30400 -+#define __must_check __attribute__((warn_unused_result)) -+#endif -+ -+#if GCC_VERSION >= 40000 -+ -+/* GCC 4.1.[01] miscompiles __weak */ -+#ifdef __KERNEL__ -+# if GCC_VERSION >= 40100 && GCC_VERSION <= 40101 -+# error Your version of gcc miscompiles the __weak directive -+# endif -+#endif -+ -+#define __used __attribute__((__used__)) -+#define __compiler_offsetof(a, b) \ -+ __builtin_offsetof(a, b) -+ -+#if GCC_VERSION >= 40100 && GCC_VERSION < 40600 -+# define __compiletime_object_size(obj) __builtin_object_size(obj, 0) -+#endif -+ -+#if GCC_VERSION >= 40300 -+/* Mark functions as cold. gcc will assume any path leading to a call -+ * to them will be unlikely. This means a lot of manual unlikely()s -+ * are unnecessary now for any paths leading to the usual suspects -+ * like BUG(), printk(), panic() etc. [but let's keep them for now for -+ * older compilers] -+ * -+ * Early snapshots of gcc 4.3 don't support this and we can't detect this -+ * in the preprocessor, but we can live with this because they're unreleased. -+ * Maketime probing would be overkill here. -+ * -+ * gcc also has a __attribute__((__hot__)) to move hot functions into -+ * a special section, but I don't see any sense in this right now in -+ * the kernel context -+ */ -+#define __cold __attribute__((__cold__)) -+ -+#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__) -+ -+#ifndef __CHECKER__ -+# define __compiletime_warning(message) __attribute__((warning(message))) -+# define __compiletime_error(message) __attribute__((error(message))) -+#endif /* __CHECKER__ */ -+#endif /* GCC_VERSION >= 40300 */ -+ -+#if GCC_VERSION >= 40500 -+/* -+ * Mark a position in code as unreachable. This can be used to -+ * suppress control flow warnings after asm blocks that transfer -+ * control elsewhere. -+ * -+ * Early snapshots of gcc 4.5 don't support this and we can't detect -+ * this in the preprocessor, but we can live with this because they're -+ * unreleased. Really, we need to have autoconf for the kernel. -+ */ -+#define unreachable() __builtin_unreachable() -+ -+/* Mark a function definition as prohibited from being cloned. */ -+#define __noclone __attribute__((__noclone__, __optimize__("no-tracer"))) -+ -+#endif /* GCC_VERSION >= 40500 */ -+ -+#if GCC_VERSION >= 40600 -+/* -+ * Tell the optimizer that something else uses this function or variable. -+ */ -+#define __visible __attribute__((externally_visible)) -+#endif -+ -+/* -+ * GCC 'asm goto' miscompiles certain code sequences: -+ * -+ * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670 -+ * -+ * Work it around via a compiler barrier quirk suggested by Jakub Jelinek. -+ * -+ * (asm goto is automatically volatile - the naming reflects this.) -+ */ -+#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0) -+ -+#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP -+#if GCC_VERSION >= 40400 -+#define __HAVE_BUILTIN_BSWAP32__ -+#define __HAVE_BUILTIN_BSWAP64__ -+#endif -+#if GCC_VERSION >= 40800 || (defined(__powerpc__) && GCC_VERSION >= 40600) -+#define __HAVE_BUILTIN_BSWAP16__ -+#endif -+#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */ -+ -+#endif /* gcc version >= 40000 specific checks */ - - #if !defined(__noclone) - #define __noclone /* not needed */ -diff --git a/include/linux/compiler-gcc3.h b/include/linux/compiler-gcc3.h -deleted file mode 100644 -index 7d89febe4d79..000000000000 ---- a/include/linux/compiler-gcc3.h -+++ /dev/null -@@ -1,23 +0,0 @@ --#ifndef __LINUX_COMPILER_H --#error "Please don't include directly, include instead." --#endif -- --#if GCC_VERSION < 30200 --# error Sorry, your compiler is too old - please upgrade it. --#endif -- --#if GCC_VERSION >= 30300 --# define __used __attribute__((__used__)) --#else --# define __used __attribute__((__unused__)) --#endif -- --#if GCC_VERSION >= 30400 --#define __must_check __attribute__((warn_unused_result)) --#endif -- --#ifdef CONFIG_GCOV_KERNEL --# if GCC_VERSION < 30400 --# error "GCOV profiling support for gcc versions below 3.4 not included" --# endif /* __GNUC_MINOR__ */ --#endif /* CONFIG_GCOV_KERNEL */ -diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h -deleted file mode 100644 -index 2507fd2a1eb4..000000000000 ---- a/include/linux/compiler-gcc4.h -+++ /dev/null -@@ -1,88 +0,0 @@ --#ifndef __LINUX_COMPILER_H --#error "Please don't include directly, include instead." --#endif -- --/* GCC 4.1.[01] miscompiles __weak */ --#ifdef __KERNEL__ --# if GCC_VERSION >= 40100 && GCC_VERSION <= 40101 --# error Your version of gcc miscompiles the __weak directive --# endif --#endif -- --#define __used __attribute__((__used__)) --#define __must_check __attribute__((warn_unused_result)) --#define __compiler_offsetof(a,b) __builtin_offsetof(a,b) -- --#if GCC_VERSION >= 40100 && GCC_VERSION < 40600 --# define __compiletime_object_size(obj) __builtin_object_size(obj, 0) --#endif -- --#if GCC_VERSION >= 40300 --/* Mark functions as cold. gcc will assume any path leading to a call -- to them will be unlikely. This means a lot of manual unlikely()s -- are unnecessary now for any paths leading to the usual suspects -- like BUG(), printk(), panic() etc. [but let's keep them for now for -- older compilers] -- -- Early snapshots of gcc 4.3 don't support this and we can't detect this -- in the preprocessor, but we can live with this because they're unreleased. -- Maketime probing would be overkill here. -- -- gcc also has a __attribute__((__hot__)) to move hot functions into -- a special section, but I don't see any sense in this right now in -- the kernel context */ --#define __cold __attribute__((__cold__)) -- --#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__) -- --#ifndef __CHECKER__ --# define __compiletime_warning(message) __attribute__((warning(message))) --# define __compiletime_error(message) __attribute__((error(message))) --#endif /* __CHECKER__ */ --#endif /* GCC_VERSION >= 40300 */ -- --#if GCC_VERSION >= 40500 --/* -- * Mark a position in code as unreachable. This can be used to -- * suppress control flow warnings after asm blocks that transfer -- * control elsewhere. -- * -- * Early snapshots of gcc 4.5 don't support this and we can't detect -- * this in the preprocessor, but we can live with this because they're -- * unreleased. Really, we need to have autoconf for the kernel. -- */ --#define unreachable() __builtin_unreachable() -- --/* Mark a function definition as prohibited from being cloned. */ --#define __noclone __attribute__((__noclone__)) -- --#endif /* GCC_VERSION >= 40500 */ -- --#if GCC_VERSION >= 40600 --/* -- * Tell the optimizer that something else uses this function or variable. -- */ --#define __visible __attribute__((externally_visible)) --#endif -- --/* -- * GCC 'asm goto' miscompiles certain code sequences: -- * -- * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670 -- * -- * Work it around via a compiler barrier quirk suggested by Jakub Jelinek. -- * Fixed in GCC 4.8.2 and later versions. -- * -- * (asm goto is automatically volatile - the naming reflects this.) -- */ --#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0) -- --#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP --#if GCC_VERSION >= 40400 --#define __HAVE_BUILTIN_BSWAP32__ --#define __HAVE_BUILTIN_BSWAP64__ --#endif --#if GCC_VERSION >= 40800 || (defined(__powerpc__) && GCC_VERSION >= 40600) --#define __HAVE_BUILTIN_BSWAP16__ --#endif --#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */ -diff --git a/include/linux/compiler-gcc5.h b/include/linux/compiler-gcc5.h -deleted file mode 100644 -index cdd1cc202d51..000000000000 ---- a/include/linux/compiler-gcc5.h -+++ /dev/null -@@ -1,66 +0,0 @@ --#ifndef __LINUX_COMPILER_H --#error "Please don't include directly, include instead." --#endif -- --#define __used __attribute__((__used__)) --#define __must_check __attribute__((warn_unused_result)) --#define __compiler_offsetof(a, b) __builtin_offsetof(a, b) -- --/* Mark functions as cold. gcc will assume any path leading to a call -- to them will be unlikely. This means a lot of manual unlikely()s -- are unnecessary now for any paths leading to the usual suspects -- like BUG(), printk(), panic() etc. [but let's keep them for now for -- older compilers] -- -- Early snapshots of gcc 4.3 don't support this and we can't detect this -- in the preprocessor, but we can live with this because they're unreleased. -- Maketime probing would be overkill here. -- -- gcc also has a __attribute__((__hot__)) to move hot functions into -- a special section, but I don't see any sense in this right now in -- the kernel context */ --#define __cold __attribute__((__cold__)) -- --#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__) -- --#ifndef __CHECKER__ --# define __compiletime_warning(message) __attribute__((warning(message))) --# define __compiletime_error(message) __attribute__((error(message))) --#endif /* __CHECKER__ */ -- --/* -- * Mark a position in code as unreachable. This can be used to -- * suppress control flow warnings after asm blocks that transfer -- * control elsewhere. -- * -- * Early snapshots of gcc 4.5 don't support this and we can't detect -- * this in the preprocessor, but we can live with this because they're -- * unreleased. Really, we need to have autoconf for the kernel. -- */ --#define unreachable() __builtin_unreachable() -- --/* Mark a function definition as prohibited from being cloned. */ --#define __noclone __attribute__((__noclone__)) -- --/* -- * Tell the optimizer that something else uses this function or variable. -- */ --#define __visible __attribute__((externally_visible)) -- --/* -- * GCC 'asm goto' miscompiles certain code sequences: -- * -- * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670 -- * -- * Work it around via a compiler barrier quirk suggested by Jakub Jelinek. -- * Fixed in GCC 4.8.2 and later versions. -- * -- * (asm goto is automatically volatile - the naming reflects this.) -- */ --#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0) -- --#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP --#define __HAVE_BUILTIN_BSWAP32__ --#define __HAVE_BUILTIN_BSWAP64__ --#define __HAVE_BUILTIN_BSWAP16__ --#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */ -diff --git a/include/linux/kernel.h b/include/linux/kernel.h -index 341551c7b4c8..5f4554b8348a 100644 ---- a/include/linux/kernel.h -+++ b/include/linux/kernel.h -@@ -557,7 +557,7 @@ do { \ - - #define do_trace_printk(fmt, args...) \ - do { \ -- static const char *trace_printk_fmt \ -+ static const char *trace_printk_fmt __used \ - __attribute__((section("__trace_printk_fmt"))) = \ - __builtin_constant_p(fmt) ? fmt : NULL; \ - \ -@@ -604,7 +604,7 @@ extern int __trace_puts(unsigned long ip, const char *str, int size); - */ - - #define trace_puts(str) ({ \ -- static const char *trace_printk_fmt \ -+ static const char *trace_printk_fmt __used \ - __attribute__((section("__trace_printk_fmt"))) = \ - __builtin_constant_p(str) ? str : NULL; \ - \ -@@ -624,7 +624,7 @@ extern void trace_dump_stack(int skip); - #define ftrace_vprintk(fmt, vargs) \ - do { \ - if (__builtin_constant_p(fmt)) { \ -- static const char *trace_printk_fmt \ -+ static const char *trace_printk_fmt __used \ - __attribute__((section("__trace_printk_fmt"))) = \ - __builtin_constant_p(fmt) ? fmt : NULL; \ - \ -diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h -index b3bd7e737e8b..d31364857aa8 100644 ---- a/include/linux/mod_devicetable.h -+++ b/include/linux/mod_devicetable.h -@@ -397,6 +397,7 @@ struct virtio_device_id { - /* - * For Hyper-V devices we use the device guid as the id. - */ -+#define vmbus_device_id hv_vmbus_device_id - struct hv_vmbus_device_id { - __u8 guid[16]; - kernel_ulong_t driver_data; /* Data private to the driver */ -@@ -547,6 +548,11 @@ struct amba_id { - * See documentation of "x86_match_cpu" for details. - */ - -+/* -+ * MODULE_DEVICE_TABLE expects this struct to be called x86cpu_device_id. -+ * Although gcc seems to ignore this error, clang fails without this define. -+ */ -+#define x86cpu_device_id x86_cpu_id - struct x86_cpu_id { - __u16 vendor; - __u16 family; -@@ -574,6 +580,7 @@ struct ipack_device_id { - #define MEI_CL_MODULE_PREFIX "mei:" - #define MEI_CL_NAME_SIZE 32 - -+#define mei_device_id mei_cl_device_id - struct mei_cl_device_id { - char name[MEI_CL_NAME_SIZE]; - kernel_ulong_t driver_info; -diff --git a/include/linux/pci.h b/include/linux/pci.h -index 102136ab1a5f..655ef37fd139 100644 ---- a/include/linux/pci.h -+++ b/include/linux/pci.h -@@ -330,6 +330,7 @@ struct pci_dev { - unsigned int __aer_firmware_first:1; - unsigned int broken_intx_masking:1; - unsigned int io_window_1k:1; /* Intel P2P bridge 1K I/O windows */ -+ unsigned int non_compliant_bars:1; /* broken BARs; ignore them */ - pci_dev_flags_t dev_flags; - atomic_t enable_cnt; /* pci_enable_device has been called */ - -diff --git a/include/linux/poison.h b/include/linux/poison.h -index 2110a81c5e2a..253c9b4198ef 100644 ---- a/include/linux/poison.h -+++ b/include/linux/poison.h -@@ -19,8 +19,8 @@ - * under normal circumstances, used to verify that nobody uses - * non-initialized list entries. - */ --#define LIST_POISON1 ((void *) 0x00100100 + POISON_POINTER_DELTA) --#define LIST_POISON2 ((void *) 0x00200200 + POISON_POINTER_DELTA) -+#define LIST_POISON1 ((void *) 0x100 + POISON_POINTER_DELTA) -+#define LIST_POISON2 ((void *) 0x200 + POISON_POINTER_DELTA) - - /********** include/linux/timer.h **********/ - /* -diff --git a/include/uapi/linux/const.h b/include/uapi/linux/const.h -index c22c707c455d..c872bfd25e13 100644 ---- a/include/uapi/linux/const.h -+++ b/include/uapi/linux/const.h -@@ -21,4 +21,7 @@ - #define _AT(T,X) ((T)(X)) - #endif - -+#define _BITUL(x) (_AC(1,UL) << (x)) -+#define _BITULL(x) (_AC(1,ULL) << (x)) -+ - #endif /* !(_LINUX_CONST_H) */ -diff --git a/kernel/sched/core.c b/kernel/sched/core.c -index f234c84d36c8..655d6110a6e1 100644 ---- a/kernel/sched/core.c -+++ b/kernel/sched/core.c -@@ -5217,6 +5217,7 @@ migration_call(struct notifier_block *nfb, unsigned long action, void *hcpu) - - case CPU_UP_PREPARE: - rq->calc_load_update = calc_load_update; -+ account_reset_rq(rq); - break; - - case CPU_ONLINE: -diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h -index dfa31d533e3f..e7f4d554fa5d 100644 ---- a/kernel/sched/sched.h -+++ b/kernel/sched/sched.h -@@ -1378,3 +1378,16 @@ static inline u64 irq_time_read(int cpu) - } - #endif /* CONFIG_64BIT */ - #endif /* CONFIG_IRQ_TIME_ACCOUNTING */ -+ -+static inline void account_reset_rq(struct rq *rq) -+{ -+#ifdef CONFIG_IRQ_TIME_ACCOUNTING -+ rq->prev_irq_time = 0; -+#endif -+#ifdef CONFIG_PARAVIRT -+ rq->prev_steal_time = 0; -+#endif -+#ifdef CONFIG_PARAVIRT_TIME_ACCOUNTING -+ rq->prev_steal_time_rq = 0; -+#endif -+} -diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c -index cb73c4e0741e..c4ce3a951a1c 100644 ---- a/kernel/trace/ring_buffer.c -+++ b/kernel/trace/ring_buffer.c -@@ -463,7 +463,7 @@ struct ring_buffer_per_cpu { - raw_spinlock_t reader_lock; /* serialize readers */ - arch_spinlock_t lock; - struct lock_class_key lock_key; -- unsigned int nr_pages; -+ unsigned long nr_pages; - struct list_head *pages; - struct buffer_page *head_page; /* read from head */ - struct buffer_page *tail_page; /* write to tail */ -@@ -483,7 +483,7 @@ struct ring_buffer_per_cpu { - u64 write_stamp; - u64 read_stamp; - /* ring buffer pages to update, > 0 to add, < 0 to remove */ -- int nr_pages_to_update; -+ long nr_pages_to_update; - struct list_head new_pages; /* new pages to add */ - struct work_struct update_pages_work; - struct completion update_done; -@@ -1120,10 +1120,10 @@ static int rb_check_pages(struct ring_buffer_per_cpu *cpu_buffer) - return 0; - } - --static int __rb_allocate_pages(int nr_pages, struct list_head *pages, int cpu) -+static int __rb_allocate_pages(long nr_pages, struct list_head *pages, int cpu) - { -- int i; - struct buffer_page *bpage, *tmp; -+ long i; - - for (i = 0; i < nr_pages; i++) { - struct page *page; -@@ -1160,7 +1160,7 @@ free_pages: - } - - static int rb_allocate_pages(struct ring_buffer_per_cpu *cpu_buffer, -- unsigned nr_pages) -+ unsigned long nr_pages) - { - LIST_HEAD(pages); - -@@ -1185,7 +1185,7 @@ static int rb_allocate_pages(struct ring_buffer_per_cpu *cpu_buffer, - } - - static struct ring_buffer_per_cpu * --rb_allocate_cpu_buffer(struct ring_buffer *buffer, int nr_pages, int cpu) -+rb_allocate_cpu_buffer(struct ring_buffer *buffer, long nr_pages, int cpu) - { - struct ring_buffer_per_cpu *cpu_buffer; - struct buffer_page *bpage; -@@ -1284,8 +1284,9 @@ struct ring_buffer *__ring_buffer_alloc(unsigned long size, unsigned flags, - struct lock_class_key *key) - { - struct ring_buffer *buffer; -+ long nr_pages; - int bsize; -- int cpu, nr_pages; -+ int cpu; - - /* keep it in its own cache line */ - buffer = kzalloc(ALIGN(sizeof(*buffer), cache_line_size()), -@@ -1408,12 +1409,12 @@ static inline unsigned long rb_page_write(struct buffer_page *bpage) - } - - static int --rb_remove_pages(struct ring_buffer_per_cpu *cpu_buffer, unsigned int nr_pages) -+rb_remove_pages(struct ring_buffer_per_cpu *cpu_buffer, unsigned long nr_pages) - { - struct list_head *tail_page, *to_remove, *next_page; - struct buffer_page *to_remove_page, *tmp_iter_page; - struct buffer_page *last_page, *first_page; -- unsigned int nr_removed; -+ unsigned long nr_removed; - unsigned long head_bit; - int page_entries; - -@@ -1629,7 +1630,7 @@ int ring_buffer_resize(struct ring_buffer *buffer, unsigned long size, - int cpu_id) - { - struct ring_buffer_per_cpu *cpu_buffer; -- unsigned nr_pages; -+ unsigned long nr_pages; - int cpu, err = 0; - - /* -@@ -1643,14 +1644,13 @@ int ring_buffer_resize(struct ring_buffer *buffer, unsigned long size, - !cpumask_test_cpu(cpu_id, buffer->cpumask)) - return size; - -- size = DIV_ROUND_UP(size, BUF_PAGE_SIZE); -- size *= BUF_PAGE_SIZE; -+ nr_pages = DIV_ROUND_UP(size, BUF_PAGE_SIZE); - - /* we need a minimum of two pages */ -- if (size < BUF_PAGE_SIZE * 2) -- size = BUF_PAGE_SIZE * 2; -+ if (nr_pages < 2) -+ nr_pages = 2; - -- nr_pages = DIV_ROUND_UP(size, BUF_PAGE_SIZE); -+ size = nr_pages * BUF_PAGE_SIZE; - - /* - * Don't succeed if resizing is disabled, as a reader might be -@@ -4607,8 +4607,9 @@ static int rb_cpu_notify(struct notifier_block *self, - struct ring_buffer *buffer = - container_of(self, struct ring_buffer, cpu_notify); - long cpu = (long)hcpu; -- int cpu_i, nr_pages_same; -- unsigned int nr_pages; -+ long nr_pages_same; -+ int cpu_i; -+ unsigned long nr_pages; - - switch (action) { - case CPU_UP_PREPARE: -diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c -index 640e4c44b170..eff26a976f02 100644 ---- a/kernel/trace/trace.c -+++ b/kernel/trace/trace.c -@@ -4351,7 +4351,10 @@ static ssize_t tracing_splice_read_pipe(struct file *filp, - - spd.nr_pages = i; - -- ret = splice_to_pipe(pipe, &spd); -+ if (i) -+ ret = splice_to_pipe(pipe, &spd); -+ else -+ ret = 0; - out: - splice_shrink_spd(&spd); - return ret; -diff --git a/kernel/trace/trace_irqsoff.c b/kernel/trace/trace_irqsoff.c -index 2aefbee93a6d..56e083e26ca9 100644 ---- a/kernel/trace/trace_irqsoff.c -+++ b/kernel/trace/trace_irqsoff.c -@@ -118,8 +118,12 @@ static int func_prolog_dec(struct trace_array *tr, - return 0; - - local_save_flags(*flags); -- /* slight chance to get a false positive on tracing_cpu */ -- if (!irqs_disabled_flags(*flags)) -+ /* -+ * Slight chance to get a false positive on tracing_cpu, -+ * although I'm starting to think there isn't a chance. -+ * Leave this for now just to be paranoid. -+ */ -+ if (!irqs_disabled_flags(*flags) && !preempt_count()) - return 0; - - *data = per_cpu_ptr(tr->trace_buffer.data, cpu); -diff --git a/kernel/trace/trace_printk.c b/kernel/trace/trace_printk.c -index a9077c1b4ad3..fdb23e84b011 100644 ---- a/kernel/trace/trace_printk.c -+++ b/kernel/trace/trace_printk.c -@@ -272,6 +272,9 @@ static int t_show(struct seq_file *m, void *v) - const char *str = *fmt; - int i; - -+ if (!*fmt) -+ return 0; -+ - seq_printf(m, "0x%lx : \"", *(unsigned long *)fmt); - - /* -diff --git a/kernel/workqueue.c b/kernel/workqueue.c -index fe7c4b91d2e7..66972ac0c6c0 100644 ---- a/kernel/workqueue.c -+++ b/kernel/workqueue.c -@@ -606,6 +606,35 @@ static void set_work_pool_and_clear_pending(struct work_struct *work, - */ - smp_wmb(); - set_work_data(work, (unsigned long)pool_id << WORK_OFFQ_POOL_SHIFT, 0); -+ /* -+ * The following mb guarantees that previous clear of a PENDING bit -+ * will not be reordered with any speculative LOADS or STORES from -+ * work->current_func, which is executed afterwards. This possible -+ * reordering can lead to a missed execution on attempt to qeueue -+ * the same @work. E.g. consider this case: -+ * -+ * CPU#0 CPU#1 -+ * ---------------------------- -------------------------------- -+ * -+ * 1 STORE event_indicated -+ * 2 queue_work_on() { -+ * 3 test_and_set_bit(PENDING) -+ * 4 } set_..._and_clear_pending() { -+ * 5 set_work_data() # clear bit -+ * 6 smp_mb() -+ * 7 work->current_func() { -+ * 8 LOAD event_indicated -+ * } -+ * -+ * Without an explicit full barrier speculative LOAD on line 8 can -+ * be executed before CPU#0 does STORE on line 1. If that happens, -+ * CPU#0 observes the PENDING bit is still set and new execution of -+ * a @work is not queued in a hope, that CPU#1 will eventually -+ * finish the queued @work. Meanwhile CPU#1 does not see -+ * event_indicated is set, because speculative LOAD was executed -+ * before actual STORE. -+ */ -+ smp_mb(); - } - - static void clear_work_data(struct work_struct *work) -diff --git a/net/batman-adv/send.c b/net/batman-adv/send.c -index 263cfd1ccee7..cf5b76661252 100644 ---- a/net/batman-adv/send.c -+++ b/net/batman-adv/send.c -@@ -353,6 +353,9 @@ batadv_purge_outstanding_packets(struct batadv_priv *bat_priv, - - if (pending) { - hlist_del(&forw_packet->list); -+ if (!forw_packet->own) -+ atomic_inc(&bat_priv->batman_queue_left); -+ - batadv_forw_packet_free(forw_packet); - } - } -@@ -379,6 +382,9 @@ batadv_purge_outstanding_packets(struct batadv_priv *bat_priv, - - if (pending) { - hlist_del(&forw_packet->list); -+ if (!forw_packet->own) -+ atomic_inc(&bat_priv->bcast_queue_left); -+ - batadv_forw_packet_free(forw_packet); - } - } -diff --git a/net/bridge/br_ioctl.c b/net/bridge/br_ioctl.c -index b73eaba85667..a882db499d33 100644 ---- a/net/bridge/br_ioctl.c -+++ b/net/bridge/br_ioctl.c -@@ -21,18 +21,19 @@ - #include - #include "br_private.h" - --/* called with RTNL */ - static int get_bridge_ifindices(struct net *net, int *indices, int num) - { - struct net_device *dev; - int i = 0; - -- for_each_netdev(net, dev) { -+ rcu_read_lock(); -+ for_each_netdev_rcu(net, dev) { - if (i >= num) - break; - if (dev->priv_flags & IFF_EBRIDGE) - indices[i++] = dev->ifindex; - } -+ rcu_read_unlock(); - - return i; - } -diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c -index a67310e00b3f..602c6d0492e2 100644 ---- a/net/core/rtnetlink.c -+++ b/net/core/rtnetlink.c -@@ -899,14 +899,16 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev, - goto nla_put_failure; - - if (1) { -- struct rtnl_link_ifmap map = { -- .mem_start = dev->mem_start, -- .mem_end = dev->mem_end, -- .base_addr = dev->base_addr, -- .irq = dev->irq, -- .dma = dev->dma, -- .port = dev->if_port, -- }; -+ struct rtnl_link_ifmap map; -+ -+ memset(&map, 0, sizeof(map)); -+ map.mem_start = dev->mem_start; -+ map.mem_end = dev->mem_end; -+ map.base_addr = dev->base_addr; -+ map.irq = dev->irq; -+ map.dma = dev->dma; -+ map.port = dev->if_port; -+ - if (nla_put(skb, IFLA_MAP, sizeof(map), &map)) - goto nla_put_failure; - } -diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c -index fe32388ea24f..b9610051f3b2 100644 ---- a/net/decnet/dn_route.c -+++ b/net/decnet/dn_route.c -@@ -1030,10 +1030,13 @@ source_ok: - if (!fld.daddr) { - fld.daddr = fld.saddr; - -- err = -EADDRNOTAVAIL; - if (dev_out) - dev_put(dev_out); -+ err = -EINVAL; - dev_out = init_net.loopback_dev; -+ if (!dev_out->dn_ptr) -+ goto out; -+ err = -EADDRNOTAVAIL; - dev_hold(dev_out); - if (!fld.daddr) { - fld.daddr = -@@ -1106,6 +1109,8 @@ source_ok: - if (dev_out == NULL) - goto out; - dn_db = rcu_dereference_raw(dev_out->dn_ptr); -+ if (!dn_db) -+ goto e_inval; - /* Possible improvement - check all devices for local addr */ - if (dn_dev_islocal(dev_out, fld.daddr)) { - dev_put(dev_out); -@@ -1147,6 +1152,8 @@ select_source: - dev_put(dev_out); - dev_out = init_net.loopback_dev; - dev_hold(dev_out); -+ if (!dev_out->dn_ptr) -+ goto e_inval; - fld.flowidn_oif = dev_out->ifindex; - if (res.fi) - dn_fib_info_put(res.fi); -diff --git a/net/ipv4/route.c b/net/ipv4/route.c -index 222e1b6141d3..624ca8ed350c 100644 ---- a/net/ipv4/route.c -+++ b/net/ipv4/route.c -@@ -1876,6 +1876,18 @@ static struct rtable *__mkroute_output(const struct fib_result *res, - */ - if (fi && res->prefixlen < 4) - fi = NULL; -+ } else if ((type == RTN_LOCAL) && (orig_oif != 0) && -+ (orig_oif != dev_out->ifindex)) { -+ /* For local routes that require a particular output interface -+ * we do not want to cache the result. Caching the result -+ * causes incorrect behaviour when there are multiple source -+ * addresses on the interface, the end result being that if the -+ * intended recipient is waiting on that interface for the -+ * packet he won't receive it because it will be delivered on -+ * the loopback interface and the IP_PKTINFO ipi_ifindex will -+ * be set to the loopback interface as well. -+ */ -+ fi = NULL; - } - - fnhe = NULL; -diff --git a/net/ipv6/exthdrs_core.c b/net/ipv6/exthdrs_core.c -index 51af9d0d019a..f66c1b629582 100644 ---- a/net/ipv6/exthdrs_core.c -+++ b/net/ipv6/exthdrs_core.c -@@ -257,7 +257,11 @@ int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset, - *fragoff = _frag_off; - return hp->nexthdr; - } -- return -ENOENT; -+ if (!found) -+ return -ENOENT; -+ if (fragoff) -+ *fragoff = _frag_off; -+ break; - } - hdrlen = 8; - } else if (nexthdr == NEXTHDR_AUTH) { -diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c -index 14f46af17704..31bab1ab007c 100644 ---- a/net/ipv6/ip6_tunnel.c -+++ b/net/ipv6/ip6_tunnel.c -@@ -266,12 +266,12 @@ static int ip6_tnl_create2(struct net_device *dev) - - t = netdev_priv(dev); - -+ dev->rtnl_link_ops = &ip6_link_ops; - err = register_netdevice(dev); - if (err < 0) - goto out; - - strcpy(t->parms.name, dev->name); -- dev->rtnl_link_ops = &ip6_link_ops; - - dev_hold(dev); - ip6_tnl_link(ip6n, t); -diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c -index 7e3901893413..3046d0244393 100644 ---- a/net/ipv6/udp.c -+++ b/net/ipv6/udp.c -@@ -839,11 +839,9 @@ int __udp6_lib_rcv(struct sk_buff *skb, struct udp_table *udptable, - int ret = udpv6_queue_rcv_skb(sk, skb); - sock_put(sk); - -- /* a return value > 0 means to resubmit the input, but -- * it wants the return to be -protocol, or 0 -- */ -+ /* a return value > 0 means to resubmit the input */ - if (ret > 0) -- return -ret; -+ return ret; - - return 0; - } -diff --git a/net/l2tp/l2tp_ip.c b/net/l2tp/l2tp_ip.c -index da1a1cee1a08..07f8b97f9ae9 100644 ---- a/net/l2tp/l2tp_ip.c -+++ b/net/l2tp/l2tp_ip.c -@@ -123,12 +123,11 @@ static int l2tp_ip_recv(struct sk_buff *skb) - struct l2tp_tunnel *tunnel = NULL; - int length; - -- /* Point to L2TP header */ -- optr = ptr = skb->data; -- - if (!pskb_may_pull(skb, 4)) - goto discard; - -+ /* Point to L2TP header */ -+ optr = ptr = skb->data; - session_id = ntohl(*((__be32 *) ptr)); - ptr += 4; - -@@ -156,6 +155,9 @@ static int l2tp_ip_recv(struct sk_buff *skb) - if (!pskb_may_pull(skb, length)) - goto discard; - -+ /* Point to L2TP header */ -+ optr = ptr = skb->data; -+ ptr += 4; - pr_debug("%s: ip recv\n", tunnel->name); - print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, ptr, length); - } -diff --git a/net/l2tp/l2tp_ip6.c b/net/l2tp/l2tp_ip6.c -index e6e8408c9e36..db96af978da5 100644 ---- a/net/l2tp/l2tp_ip6.c -+++ b/net/l2tp/l2tp_ip6.c -@@ -135,12 +135,11 @@ static int l2tp_ip6_recv(struct sk_buff *skb) - struct l2tp_tunnel *tunnel = NULL; - int length; - -- /* Point to L2TP header */ -- optr = ptr = skb->data; -- - if (!pskb_may_pull(skb, 4)) - goto discard; - -+ /* Point to L2TP header */ -+ optr = ptr = skb->data; - session_id = ntohl(*((__be32 *) ptr)); - ptr += 4; - -@@ -168,6 +167,9 @@ static int l2tp_ip6_recv(struct sk_buff *skb) - if (!pskb_may_pull(skb, length)) - goto discard; - -+ /* Point to L2TP header */ -+ optr = ptr = skb->data; -+ ptr += 4; - pr_debug("%s: ip recv\n", tunnel->name); - print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, ptr, length); - } -diff --git a/net/llc/af_llc.c b/net/llc/af_llc.c -index c3ee80547066..9d140594082c 100644 ---- a/net/llc/af_llc.c -+++ b/net/llc/af_llc.c -@@ -626,6 +626,7 @@ static void llc_cmsg_rcv(struct msghdr *msg, struct sk_buff *skb) - if (llc->cmsg_flags & LLC_CMSG_PKTINFO) { - struct llc_pktinfo info; - -+ memset(&info, 0, sizeof(info)); - info.lpi_ifindex = llc_sk(skb->sk)->dev->ifindex; - llc_pdu_decode_dsap(skb, &info.lpi_sap); - llc_pdu_decode_da(skb, info.lpi_mac); -diff --git a/net/netfilter/ipvs/ip_vs_pe_sip.c b/net/netfilter/ipvs/ip_vs_pe_sip.c -index bed5f7042529..bb318e4623a3 100644 ---- a/net/netfilter/ipvs/ip_vs_pe_sip.c -+++ b/net/netfilter/ipvs/ip_vs_pe_sip.c -@@ -88,7 +88,7 @@ ip_vs_sip_fill_param(struct ip_vs_conn_param *p, struct sk_buff *skb) - dptr = skb->data + dataoff; - datalen = skb->len - dataoff; - -- if (get_callid(dptr, dataoff, datalen, &matchoff, &matchlen)) -+ if (get_callid(dptr, 0, datalen, &matchoff, &matchlen)) - return -EINVAL; - - /* N.B: pe_data is only set on success, -diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c -index 39fa33969b09..2d454a235e84 100644 ---- a/net/packet/af_packet.c -+++ b/net/packet/af_packet.c -@@ -2997,6 +2997,7 @@ static int packet_mc_add(struct sock *sk, struct packet_mreq_max *mreq) - i->ifindex = mreq->mr_ifindex; - i->alen = mreq->mr_alen; - memcpy(i->addr, mreq->mr_address, i->alen); -+ memset(i->addr + i->alen, 0, sizeof(i->addr) - i->alen); - i->count = 1; - i->next = po->mclist; - po->mclist = i; -diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c -index bee032a7003f..10d3e2874dd1 100644 ---- a/net/sctp/ipv6.c -+++ b/net/sctp/ipv6.c -@@ -520,6 +520,8 @@ static int sctp_v6_cmp_addr(const union sctp_addr *addr1, - } - return 0; - } -+ if (addr1->v6.sin6_port != addr2->v6.sin6_port) -+ return 0; - if (!ipv6_addr_equal(&addr1->v6.sin6_addr, &addr2->v6.sin6_addr)) - return 0; - /* If this is a linklocal address, compare the scope_id. */ -diff --git a/net/socket.c b/net/socket.c -index 53b6e411f7a4..e91e8ed1b8df 100644 ---- a/net/socket.c -+++ b/net/socket.c -@@ -2381,31 +2381,31 @@ int __sys_recvmmsg(int fd, struct mmsghdr __user *mmsg, unsigned int vlen, - break; - } - --out_put: -- fput_light(sock->file, fput_needed); -- - if (err == 0) -- return datagrams; -+ goto out_put; - -- if (datagrams != 0) { -+ if (datagrams == 0) { -+ datagrams = err; -+ goto out_put; -+ } -+ -+ /* -+ * We may return less entries than requested (vlen) if the -+ * sock is non block and there aren't enough datagrams... -+ */ -+ if (err != -EAGAIN) { - /* -- * We may return less entries than requested (vlen) if the -- * sock is non block and there aren't enough datagrams... -+ * ... or if recvmsg returns an error after we -+ * received some datagrams, where we record the -+ * error to return on the next call or if the -+ * app asks about it using getsockopt(SO_ERROR). - */ -- if (err != -EAGAIN) { -- /* -- * ... or if recvmsg returns an error after we -- * received some datagrams, where we record the -- * error to return on the next call or if the -- * app asks about it using getsockopt(SO_ERROR). -- */ -- sock->sk->sk_err = -err; -- } -- -- return datagrams; -+ sock->sk->sk_err = -err; - } -+out_put: -+ fput_light(sock->file, fput_needed); - -- return err; -+ return datagrams; - } - - SYSCALL_DEFINE5(recvmmsg, int, fd, struct mmsghdr __user *, mmsg, -diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c -index 9b88693bcc99..66a9bf52fac6 100644 ---- a/net/vmw_vsock/af_vsock.c -+++ b/net/vmw_vsock/af_vsock.c -@@ -1804,27 +1804,8 @@ vsock_stream_recvmsg(struct kiocb *kiocb, - else if (sk->sk_shutdown & RCV_SHUTDOWN) - err = 0; - -- if (copied > 0) { -- /* We only do these additional bookkeeping/notification steps -- * if we actually copied something out of the queue pair -- * instead of just peeking ahead. -- */ -- -- if (!(flags & MSG_PEEK)) { -- /* If the other side has shutdown for sending and there -- * is nothing more to read, then modify the socket -- * state. -- */ -- if (vsk->peer_shutdown & SEND_SHUTDOWN) { -- if (vsock_stream_has_data(vsk) <= 0) { -- sk->sk_state = SS_UNCONNECTED; -- sock_set_flag(sk, SOCK_DONE); -- sk->sk_state_change(sk); -- } -- } -- } -+ if (copied > 0) - err = copied; -- } - - out_wait: - finish_wait(sk_sleep(sk), &wait); -diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c -index 90a0e552cb32..dd3dbed89c8f 100644 ---- a/net/wireless/nl80211.c -+++ b/net/wireless/nl80211.c -@@ -10685,7 +10685,7 @@ static int nl80211_netlink_notify(struct notifier_block * nb, - struct wireless_dev *wdev; - struct cfg80211_beacon_registration *reg, *tmp; - -- if (state != NETLINK_URELEASE) -+ if (state != NETLINK_URELEASE || notify->protocol != NETLINK_GENERIC) - return NOTIFY_DONE; - - rcu_read_lock(); -diff --git a/net/x25/x25_facilities.c b/net/x25/x25_facilities.c -index 66c638730c7a..de7552d8ee20 100644 ---- a/net/x25/x25_facilities.c -+++ b/net/x25/x25_facilities.c -@@ -271,6 +271,7 @@ int x25_negotiate_facilities(struct sk_buff *skb, struct sock *sk, - - memset(&theirs, 0, sizeof(theirs)); - memcpy(new, ours, sizeof(*new)); -+ memset(dte, 0, sizeof(*dte)); - - len = x25_parse_facilities(skb, &theirs, dte, &x25->vc_facil_mask); - if (len < 0) -diff --git a/scripts/coccinelle/iterators/use_after_iter.cocci b/scripts/coccinelle/iterators/use_after_iter.cocci -index 06284c57a951..93e37ff8b0f6 100644 ---- a/scripts/coccinelle/iterators/use_after_iter.cocci -+++ b/scripts/coccinelle/iterators/use_after_iter.cocci -@@ -123,7 +123,7 @@ list_remove_head(x,c,...) - | - sizeof(<+...c...+>) - | --&c->member -+ &c->member - | - c = E - | -diff --git a/sound/core/timer.c b/sound/core/timer.c -index d90d8f4b85fe..38742e826900 100644 ---- a/sound/core/timer.c -+++ b/sound/core/timer.c -@@ -1012,8 +1012,8 @@ static int snd_timer_s_start(struct snd_timer * timer) - njiff += timer->sticks - priv->correction; - priv->correction = 0; - } -- priv->last_expires = priv->tlist.expires = njiff; -- add_timer(&priv->tlist); -+ priv->last_expires = njiff; -+ mod_timer(&priv->tlist, njiff); - return 0; - } - -diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c -index b8fe40531b9c..7022450fb6dd 100644 ---- a/sound/pci/intel8x0.c -+++ b/sound/pci/intel8x0.c -@@ -2885,6 +2885,7 @@ static void intel8x0_measure_ac97_clock(struct intel8x0 *chip) - - static struct snd_pci_quirk intel8x0_clock_list[] = { - SND_PCI_QUIRK(0x0e11, 0x008a, "AD1885", 41000), -+ SND_PCI_QUIRK(0x1014, 0x0581, "AD1981B", 48000), - SND_PCI_QUIRK(0x1028, 0x00be, "AD1885", 44100), - SND_PCI_QUIRK(0x1028, 0x0177, "AD1980", 48000), - SND_PCI_QUIRK(0x1028, 0x01ad, "AD1981B", 48000), -diff --git a/sound/soc/samsung/s3c-i2s-v2.c b/sound/soc/samsung/s3c-i2s-v2.c -index 20e98d1dded2..38c36cdd8c77 100644 ---- a/sound/soc/samsung/s3c-i2s-v2.c -+++ b/sound/soc/samsung/s3c-i2s-v2.c -@@ -732,7 +732,7 @@ static int s3c2412_i2s_resume(struct snd_soc_dai *dai) - #endif - - int s3c_i2sv2_register_component(struct device *dev, int id, -- struct snd_soc_component_driver *cmp_drv, -+ const struct snd_soc_component_driver *cmp_drv, - struct snd_soc_dai_driver *dai_drv) - { - struct snd_soc_dai_ops *ops = drv->ops; -diff --git a/sound/soc/samsung/s3c-i2s-v2.h b/sound/soc/samsung/s3c-i2s-v2.h -index 90abab364b49..d0684145ed1f 100644 ---- a/sound/soc/samsung/s3c-i2s-v2.h -+++ b/sound/soc/samsung/s3c-i2s-v2.h -@@ -101,7 +101,7 @@ extern int s3c_i2sv2_probe(struct snd_soc_dai *dai, - * soc core. - */ - extern int s3c_i2sv2_register_component(struct device *dev, int id, -- struct snd_soc_component_driver *cmp_drv, -+ const struct snd_soc_component_driver *cmp_drv, - struct snd_soc_dai_driver *dai_drv); - - #endif /* __SND_SOC_S3C24XX_S3C_I2SV2_I2S_H */ -diff --git a/tools/perf/Documentation/perf-stat.txt b/tools/perf/Documentation/perf-stat.txt -index 2fe87fb558f0..8c9604797e87 100644 ---- a/tools/perf/Documentation/perf-stat.txt -+++ b/tools/perf/Documentation/perf-stat.txt -@@ -50,6 +50,14 @@ OPTIONS - --scale:: - scale/normalize counter values - -+-d:: -+--detailed:: -+ print more detailed statistics, can be specified up to 3 times -+ -+ -d: detailed events, L1 and LLC data cache -+ -d -d: more detailed events, dTLB and iTLB events -+ -d -d -d: very detailed events, adding prefetch events -+ - -r:: - --repeat=:: - repeat command and print average + stddev (max: 100). 0 means forever. -diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c -index 1d4b8bed4e48..4f865e122c21 100644 ---- a/virt/kvm/kvm_main.c -+++ b/virt/kvm/kvm_main.c -@@ -468,6 +468,16 @@ static struct kvm *kvm_create_vm(unsigned long type) - if (!kvm) - return ERR_PTR(-ENOMEM); - -+ spin_lock_init(&kvm->mmu_lock); -+ atomic_inc(¤t->mm->mm_count); -+ kvm->mm = current->mm; -+ kvm_eventfd_init(kvm); -+ mutex_init(&kvm->lock); -+ mutex_init(&kvm->irq_lock); -+ mutex_init(&kvm->slots_lock); -+ atomic_set(&kvm->users_count, 1); -+ INIT_LIST_HEAD(&kvm->devices); -+ - r = kvm_arch_init_vm(kvm, type); - if (r) - goto out_err_nodisable; -@@ -497,16 +507,6 @@ static struct kvm *kvm_create_vm(unsigned long type) - goto out_err; - } - -- spin_lock_init(&kvm->mmu_lock); -- kvm->mm = current->mm; -- atomic_inc(&kvm->mm->mm_count); -- kvm_eventfd_init(kvm); -- mutex_init(&kvm->lock); -- mutex_init(&kvm->irq_lock); -- mutex_init(&kvm->slots_lock); -- atomic_set(&kvm->users_count, 1); -- INIT_LIST_HEAD(&kvm->devices); -- - r = kvm_init_mmu_notifier(kvm); - if (r) - goto out_err; -@@ -526,6 +526,7 @@ out_err_nodisable: - kfree(kvm->buses[i]); - kfree(kvm->memslots); - kvm_arch_free_vm(kvm); -+ mmdrop(current->mm); - return ERR_PTR(r); - } - diff --git a/patch/kernel/marvell-default/2-patch-3.10.102-103.patch b/patch/kernel/marvell-default/2-patch-3.10.102-103.patch deleted file mode 100644 index a1db16beab..0000000000 --- a/patch/kernel/marvell-default/2-patch-3.10.102-103.patch +++ /dev/null @@ -1,6785 +0,0 @@ -diff --git a/Documentation/scsi/scsi_eh.txt b/Documentation/scsi/scsi_eh.txt -index 6ff16b620d84..c08b62d63afa 100644 ---- a/Documentation/scsi/scsi_eh.txt -+++ b/Documentation/scsi/scsi_eh.txt -@@ -255,19 +255,23 @@ scmd->allowed. - - 3. scmd recovered - ACTION: scsi_eh_finish_cmd() is invoked to EH-finish scmd -- - shost->host_failed-- - - clear scmd->eh_eflags - - scsi_setup_cmd_retry() - - move from local eh_work_q to local eh_done_q - LOCKING: none -+ CONCURRENCY: at most one thread per separate eh_work_q to -+ keep queue manipulation lockless - - 4. EH completes - ACTION: scsi_eh_flush_done_q() retries scmds or notifies upper -- layer of failure. -+ layer of failure. May be called concurrently but must have -+ a no more than one thread per separate eh_work_q to -+ manipulate the queue locklessly - - scmd is removed from eh_done_q and scmd->eh_entry is cleared - - if retry is necessary, scmd is requeued using - scsi_queue_insert() - - otherwise, scsi_finish_command() is invoked for scmd -+ - zero shost->host_failed - LOCKING: queue or finish function performs appropriate locking - - -diff --git a/Documentation/sysctl/fs.txt b/Documentation/sysctl/fs.txt -index 88152f214f48..302b5ed616a6 100644 ---- a/Documentation/sysctl/fs.txt -+++ b/Documentation/sysctl/fs.txt -@@ -32,6 +32,8 @@ Currently, these files are in /proc/sys/fs: - - nr_open - - overflowuid - - overflowgid -+- pipe-user-pages-hard -+- pipe-user-pages-soft - - protected_hardlinks - - protected_symlinks - - suid_dumpable -@@ -159,6 +161,27 @@ The default is 65534. - - ============================================================== - -+pipe-user-pages-hard: -+ -+Maximum total number of pages a non-privileged user may allocate for pipes. -+Once this limit is reached, no new pipes may be allocated until usage goes -+below the limit again. When set to 0, no limit is applied, which is the default -+setting. -+ -+============================================================== -+ -+pipe-user-pages-soft: -+ -+Maximum total number of pages a non-privileged user may allocate for pipes -+before the pipe size gets limited to a single page. Once this limit is reached, -+new pipes will be limited to a single page in size for this user in order to -+limit total memory usage, and trying to increase them using fcntl() will be -+denied until usage goes below the limit again. The default value allows to -+allocate up to 1024 pipes at their default size. When set to 0, no limit is -+applied. -+ -+============================================================== -+ - protected_hardlinks: - - A long-standing class of security issues is the hardlink-based -diff --git a/Makefile b/Makefile -index 868093c16ae0..d3cb458b295a 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,6 +1,6 @@ - VERSION = 3 - PATCHLEVEL = 10 --SUBLEVEL = 102 -+SUBLEVEL = 103 - EXTRAVERSION = - NAME = TOSSUG Baby Fish - -diff --git a/arch/arc/kernel/stacktrace.c b/arch/arc/kernel/stacktrace.c -index ca0207b9d5b6..06997ad70725 100644 ---- a/arch/arc/kernel/stacktrace.c -+++ b/arch/arc/kernel/stacktrace.c -@@ -131,7 +131,7 @@ arc_unwind_core(struct task_struct *tsk, struct pt_regs *regs, - * prelogue is setup (callee regs saved and then fp set and not other - * way around - */ -- pr_warn("CONFIG_ARC_DW2_UNWIND needs to be enabled\n"); -+ pr_warn_once("CONFIG_ARC_DW2_UNWIND needs to be enabled\n"); - return 0; - - #endif -diff --git a/arch/arc/mm/tlbex.S b/arch/arc/mm/tlbex.S -index 3357d26ffe54..74691e652a3a 100644 ---- a/arch/arc/mm/tlbex.S -+++ b/arch/arc/mm/tlbex.S -@@ -219,7 +219,7 @@ ex_saved_reg1: - #ifdef CONFIG_SMP - sr r0, [ARC_REG_SCRATCH_DATA0] ; freeup r0 to code with - GET_CPU_ID r0 ; get to per cpu scratch mem, -- lsl r0, r0, L1_CACHE_SHIFT ; cache line wide per cpu -+ asl r0, r0, L1_CACHE_SHIFT ; cache line wide per cpu - add r0, @ex_saved_reg1, r0 - #else - st r0, [@ex_saved_reg1] -@@ -239,7 +239,7 @@ ex_saved_reg1: - .macro TLBMISS_RESTORE_REGS - #ifdef CONFIG_SMP - GET_CPU_ID r0 ; get to per cpu scratch mem -- lsl r0, r0, L1_CACHE_SHIFT ; each is cache line wide -+ asl r0, r0, L1_CACHE_SHIFT ; each is cache line wide - add r0, @ex_saved_reg1, r0 - ld_s r3, [r0,12] - ld_s r2, [r0, 8] -diff --git a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c -index 03deeffd9f6d..4e2110d48c41 100644 ---- a/arch/arm/kernel/ptrace.c -+++ b/arch/arm/kernel/ptrace.c -@@ -733,8 +733,8 @@ static int vfp_set(struct task_struct *target, - if (ret) - return ret; - -- vfp_flush_hwstate(thread); - thread->vfpstate.hard = new_vfp; -+ vfp_flush_hwstate(thread); - - return 0; - } -diff --git a/arch/arm/kernel/sys_oabi-compat.c b/arch/arm/kernel/sys_oabi-compat.c -index 3e94811690ce..a0aee80b608d 100644 ---- a/arch/arm/kernel/sys_oabi-compat.c -+++ b/arch/arm/kernel/sys_oabi-compat.c -@@ -275,8 +275,12 @@ asmlinkage long sys_oabi_epoll_wait(int epfd, - mm_segment_t fs; - long ret, err, i; - -- if (maxevents <= 0 || maxevents > (INT_MAX/sizeof(struct epoll_event))) -+ if (maxevents <= 0 || -+ maxevents > (INT_MAX/sizeof(*kbuf)) || -+ maxevents > (INT_MAX/sizeof(*events))) - return -EINVAL; -+ if (!access_ok(VERIFY_WRITE, events, sizeof(*events) * maxevents)) -+ return -EFAULT; - kbuf = kmalloc(sizeof(*kbuf) * maxevents, GFP_KERNEL); - if (!kbuf) - return -ENOMEM; -@@ -313,6 +317,8 @@ asmlinkage long sys_oabi_semtimedop(int semid, - - if (nsops < 1 || nsops > SEMOPM) - return -EINVAL; -+ if (!access_ok(VERIFY_READ, tsops, sizeof(*tsops) * nsops)) -+ return -EFAULT; - sops = kmalloc(sizeof(*sops) * nsops, GFP_KERNEL); - if (!sops) - return -ENOMEM; -diff --git a/arch/metag/include/asm/cmpxchg_lnkget.h b/arch/metag/include/asm/cmpxchg_lnkget.h -index 0154e2807ebb..2369ad394876 100644 ---- a/arch/metag/include/asm/cmpxchg_lnkget.h -+++ b/arch/metag/include/asm/cmpxchg_lnkget.h -@@ -73,7 +73,7 @@ static inline unsigned long __cmpxchg_u32(volatile int *m, unsigned long old, - " DCACHE [%2], %0\n" - #endif - "2:\n" -- : "=&d" (temp), "=&da" (retval) -+ : "=&d" (temp), "=&d" (retval) - : "da" (m), "bd" (old), "da" (new) - : "cc" - ); -diff --git a/arch/mips/ath79/early_printk.c b/arch/mips/ath79/early_printk.c -index b955fafc58ba..d1adc59af5bf 100644 ---- a/arch/mips/ath79/early_printk.c -+++ b/arch/mips/ath79/early_printk.c -@@ -31,13 +31,15 @@ static inline void prom_putchar_wait(void __iomem *reg, u32 mask, u32 val) - } while (1); - } - -+#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE) -+ - static void prom_putchar_ar71xx(unsigned char ch) - { - void __iomem *base = (void __iomem *)(KSEG1ADDR(AR71XX_UART_BASE)); - -- prom_putchar_wait(base + UART_LSR * 4, UART_LSR_THRE, UART_LSR_THRE); -+ prom_putchar_wait(base + UART_LSR * 4, BOTH_EMPTY, BOTH_EMPTY); - __raw_writel(ch, base + UART_TX * 4); -- prom_putchar_wait(base + UART_LSR * 4, UART_LSR_THRE, UART_LSR_THRE); -+ prom_putchar_wait(base + UART_LSR * 4, BOTH_EMPTY, BOTH_EMPTY); - } - - static void prom_putchar_ar933x(unsigned char ch) -diff --git a/arch/mips/include/asm/kvm_host.h b/arch/mips/include/asm/kvm_host.h -index 4d6fa0bf1305..883a162083af 100644 ---- a/arch/mips/include/asm/kvm_host.h -+++ b/arch/mips/include/asm/kvm_host.h -@@ -349,6 +349,7 @@ struct kvm_mips_tlb { - #define KVM_MIPS_GUEST_TLB_SIZE 64 - struct kvm_vcpu_arch { - void *host_ebase, *guest_ebase; -+ int (*vcpu_run)(struct kvm_run *run, struct kvm_vcpu *vcpu); - unsigned long host_stack; - unsigned long host_gp; - -diff --git a/arch/mips/include/asm/processor.h b/arch/mips/include/asm/processor.h -index 1470b7b68b0e..a7e71744fe89 100644 ---- a/arch/mips/include/asm/processor.h -+++ b/arch/mips/include/asm/processor.h -@@ -51,7 +51,7 @@ extern unsigned int vced_count, vcei_count; - * User space process size: 2GB. This is hardcoded into a few places, - * so don't change it unless you know what you are doing. - */ --#define TASK_SIZE 0x7fff8000UL -+#define TASK_SIZE 0x80000000UL - #endif - - #ifdef __KERNEL__ -diff --git a/arch/mips/include/uapi/asm/siginfo.h b/arch/mips/include/uapi/asm/siginfo.h -index 6a8714193fb9..b5f77f76c899 100644 ---- a/arch/mips/include/uapi/asm/siginfo.h -+++ b/arch/mips/include/uapi/asm/siginfo.h -@@ -45,13 +45,13 @@ typedef struct siginfo { - - /* kill() */ - struct { -- pid_t _pid; /* sender's pid */ -+ __kernel_pid_t _pid; /* sender's pid */ - __ARCH_SI_UID_T _uid; /* sender's uid */ - } _kill; - - /* POSIX.1b timers */ - struct { -- timer_t _tid; /* timer id */ -+ __kernel_timer_t _tid; /* timer id */ - int _overrun; /* overrun count */ - char _pad[sizeof( __ARCH_SI_UID_T) - sizeof(int)]; - sigval_t _sigval; /* same as below */ -@@ -60,26 +60,26 @@ typedef struct siginfo { - - /* POSIX.1b signals */ - struct { -- pid_t _pid; /* sender's pid */ -+ __kernel_pid_t _pid; /* sender's pid */ - __ARCH_SI_UID_T _uid; /* sender's uid */ - sigval_t _sigval; - } _rt; - - /* SIGCHLD */ - struct { -- pid_t _pid; /* which child */ -+ __kernel_pid_t _pid; /* which child */ - __ARCH_SI_UID_T _uid; /* sender's uid */ - int _status; /* exit code */ -- clock_t _utime; -- clock_t _stime; -+ __kernel_clock_t _utime; -+ __kernel_clock_t _stime; - } _sigchld; - - /* IRIX SIGCHLD */ - struct { -- pid_t _pid; /* which child */ -- clock_t _utime; -+ __kernel_pid_t _pid; /* which child */ -+ __kernel_clock_t _utime; - int _status; /* exit code */ -- clock_t _stime; -+ __kernel_clock_t _stime; - } _irix_sigchld; - - /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ -diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S -index cab150789c8d..b657fbefc466 100644 ---- a/arch/mips/kernel/scall64-n32.S -+++ b/arch/mips/kernel/scall64-n32.S -@@ -349,7 +349,7 @@ EXPORT(sysn32_call_table) - PTR sys_ni_syscall /* available, was setaltroot */ - PTR sys_add_key - PTR sys_request_key -- PTR sys_keyctl /* 6245 */ -+ PTR compat_sys_keyctl /* 6245 */ - PTR sys_set_thread_area - PTR sys_inotify_init - PTR sys_inotify_add_watch -diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S -index 37605dc8eef7..bf56d7e271dd 100644 ---- a/arch/mips/kernel/scall64-o32.S -+++ b/arch/mips/kernel/scall64-o32.S -@@ -474,7 +474,7 @@ sys_call_table: - PTR sys_ni_syscall /* available, was setaltroot */ - PTR sys_add_key /* 4280 */ - PTR sys_request_key -- PTR sys_keyctl -+ PTR compat_sys_keyctl - PTR sys_set_thread_area - PTR sys_inotify_init - PTR sys_inotify_add_watch /* 4285 */ -diff --git a/arch/mips/kvm/kvm_locore.S b/arch/mips/kvm/kvm_locore.S -index 34c35f0e3290..73553cd98070 100644 ---- a/arch/mips/kvm/kvm_locore.S -+++ b/arch/mips/kvm/kvm_locore.S -@@ -227,6 +227,7 @@ FEXPORT(__kvm_mips_load_k0k1) - /* Jump to guest */ - eret - .set pop -+EXPORT(__kvm_mips_vcpu_run_end) - - VECTOR(MIPSX(exception), unknown) - /* -diff --git a/arch/mips/kvm/kvm_mips.c b/arch/mips/kvm/kvm_mips.c -index 8aa5f30d8579..97a181a44e53 100644 ---- a/arch/mips/kvm/kvm_mips.c -+++ b/arch/mips/kvm/kvm_mips.c -@@ -343,6 +343,15 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id) - memcpy(gebase + offset, mips32_GuestException, - mips32_GuestExceptionEnd - mips32_GuestException); - -+#ifdef MODULE -+ offset += mips32_GuestExceptionEnd - mips32_GuestException; -+ memcpy(gebase + offset, (char *)__kvm_mips_vcpu_run, -+ __kvm_mips_vcpu_run_end - (char *)__kvm_mips_vcpu_run); -+ vcpu->arch.vcpu_run = gebase + offset; -+#else -+ vcpu->arch.vcpu_run = __kvm_mips_vcpu_run; -+#endif -+ - /* Invalidate the icache for these ranges */ - mips32_SyncICache((unsigned long) gebase, ALIGN(size, PAGE_SIZE)); - -@@ -426,7 +435,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run) - - kvm_guest_enter(); - -- r = __kvm_mips_vcpu_run(run, vcpu); -+ r = vcpu->arch.vcpu_run(run, vcpu); - - kvm_guest_exit(); - local_irq_enable(); -diff --git a/arch/mips/kvm/kvm_mips_emul.c b/arch/mips/kvm/kvm_mips_emul.c -index 33085819cd89..9f7643874fba 100644 ---- a/arch/mips/kvm/kvm_mips_emul.c -+++ b/arch/mips/kvm/kvm_mips_emul.c -@@ -972,8 +972,13 @@ kvm_mips_emulate_cache(uint32_t inst, uint32_t *opc, uint32_t cause, - preempt_disable(); - if (KVM_GUEST_KSEGX(va) == KVM_GUEST_KSEG0) { - -- if (kvm_mips_host_tlb_lookup(vcpu, va) < 0) { -- kvm_mips_handle_kseg0_tlb_fault(va, vcpu); -+ if (kvm_mips_host_tlb_lookup(vcpu, va) < 0 && -+ kvm_mips_handle_kseg0_tlb_fault(va, vcpu)) { -+ kvm_err("%s: handling mapped kseg0 tlb fault for %lx, vcpu: %p, ASID: %#lx\n", -+ __func__, va, vcpu, read_c0_entryhi()); -+ er = EMULATE_FAIL; -+ preempt_enable(); -+ goto done; - } - } else if ((KVM_GUEST_KSEGX(va) < KVM_GUEST_KSEG0) || - KVM_GUEST_KSEGX(va) == KVM_GUEST_KSEG23) { -@@ -1006,11 +1011,16 @@ kvm_mips_emulate_cache(uint32_t inst, uint32_t *opc, uint32_t cause, - run, vcpu); - preempt_enable(); - goto dont_update_pc; -- } else { -- /* We fault an entry from the guest tlb to the shadow host TLB */ -- kvm_mips_handle_mapped_seg_tlb_fault(vcpu, tlb, -- NULL, -- NULL); -+ } -+ /* We fault an entry from the guest tlb to the shadow host TLB */ -+ if (kvm_mips_handle_mapped_seg_tlb_fault(vcpu, tlb, -+ NULL, NULL)) { -+ kvm_err("%s: handling mapped seg tlb fault for %lx, index: %u, vcpu: %p, ASID: %#lx\n", -+ __func__, va, index, vcpu, -+ read_c0_entryhi()); -+ er = EMULATE_FAIL; -+ preempt_enable(); -+ goto done; - } - } - } else { -@@ -1821,8 +1831,13 @@ kvm_mips_handle_tlbmiss(unsigned long cause, uint32_t *opc, - tlb->tlb_hi, tlb->tlb_lo0, tlb->tlb_lo1); - #endif - /* OK we have a Guest TLB entry, now inject it into the shadow host TLB */ -- kvm_mips_handle_mapped_seg_tlb_fault(vcpu, tlb, NULL, -- NULL); -+ if (kvm_mips_handle_mapped_seg_tlb_fault(vcpu, tlb, -+ NULL, NULL)) { -+ kvm_err("%s: handling mapped seg tlb fault for %lx, index: %u, vcpu: %p, ASID: %#lx\n", -+ __func__, va, index, vcpu, -+ read_c0_entryhi()); -+ er = EMULATE_FAIL; -+ } - } - } - -diff --git a/arch/mips/kvm/kvm_mips_int.h b/arch/mips/kvm/kvm_mips_int.h -index 20da7d29eede..bf41ea36210e 100644 ---- a/arch/mips/kvm/kvm_mips_int.h -+++ b/arch/mips/kvm/kvm_mips_int.h -@@ -27,6 +27,8 @@ - #define MIPS_EXC_MAX 12 - /* XXXSL More to follow */ - -+extern char __kvm_mips_vcpu_run_end[]; -+ - #define C_TI (_ULCAST_(1) << 30) - - #define KVM_MIPS_IRQ_DELIVER_ALL_AT_ONCE (0) -diff --git a/arch/mips/kvm/kvm_tlb.c b/arch/mips/kvm/kvm_tlb.c -index c777dd36d4a8..4bee4397dca8 100644 ---- a/arch/mips/kvm/kvm_tlb.c -+++ b/arch/mips/kvm/kvm_tlb.c -@@ -312,7 +312,7 @@ int kvm_mips_handle_kseg0_tlb_fault(unsigned long badvaddr, - } - - gfn = (KVM_GUEST_CPHYSADDR(badvaddr) >> PAGE_SHIFT); -- if (gfn >= kvm->arch.guest_pmap_npages) { -+ if ((gfn | 1) >= kvm->arch.guest_pmap_npages) { - kvm_err("%s: Invalid gfn: %#llx, BadVaddr: %#lx\n", __func__, - gfn, badvaddr); - kvm_mips_dump_host_tlbs(); -@@ -397,21 +397,38 @@ kvm_mips_handle_mapped_seg_tlb_fault(struct kvm_vcpu *vcpu, - unsigned long entryhi = 0, entrylo0 = 0, entrylo1 = 0; - struct kvm *kvm = vcpu->kvm; - pfn_t pfn0, pfn1; -+ gfn_t gfn0, gfn1; -+ long tlb_lo[2]; -+ -+ tlb_lo[0] = tlb->tlb_lo0; -+ tlb_lo[1] = tlb->tlb_lo1; -+ -+ /* -+ * The commpage address must not be mapped to anything else if the guest -+ * TLB contains entries nearby, or commpage accesses will break. -+ */ -+ if (!((tlb->tlb_hi ^ KVM_GUEST_COMMPAGE_ADDR) & -+ VPN2_MASK & (PAGE_MASK << 1))) -+ tlb_lo[(KVM_GUEST_COMMPAGE_ADDR >> PAGE_SHIFT) & 1] = 0; -+ -+ gfn0 = mips3_tlbpfn_to_paddr(tlb_lo[0]) >> PAGE_SHIFT; -+ gfn1 = mips3_tlbpfn_to_paddr(tlb_lo[1]) >> PAGE_SHIFT; -+ if (gfn0 >= kvm->arch.guest_pmap_npages || -+ gfn1 >= kvm->arch.guest_pmap_npages) { -+ kvm_err("%s: Invalid gfn: [%#llx, %#llx], EHi: %#lx\n", -+ __func__, gfn0, gfn1, tlb->tlb_hi); -+ kvm_mips_dump_guest_tlbs(vcpu); -+ return -1; -+ } - -+ if (kvm_mips_map_page(kvm, gfn0) < 0) -+ return -1; - -- if ((tlb->tlb_hi & VPN2_MASK) == 0) { -- pfn0 = 0; -- pfn1 = 0; -- } else { -- if (kvm_mips_map_page(kvm, mips3_tlbpfn_to_paddr(tlb->tlb_lo0) >> PAGE_SHIFT) < 0) -- return -1; -- -- if (kvm_mips_map_page(kvm, mips3_tlbpfn_to_paddr(tlb->tlb_lo1) >> PAGE_SHIFT) < 0) -- return -1; -+ if (kvm_mips_map_page(kvm, gfn1) < 0) -+ return -1; - -- pfn0 = kvm->arch.guest_pmap[mips3_tlbpfn_to_paddr(tlb->tlb_lo0) >> PAGE_SHIFT]; -- pfn1 = kvm->arch.guest_pmap[mips3_tlbpfn_to_paddr(tlb->tlb_lo1) >> PAGE_SHIFT]; -- } -+ pfn0 = kvm->arch.guest_pmap[gfn0]; -+ pfn1 = kvm->arch.guest_pmap[gfn1]; - - if (hpa0) - *hpa0 = pfn0 << PAGE_SHIFT; -@@ -423,9 +440,9 @@ kvm_mips_handle_mapped_seg_tlb_fault(struct kvm_vcpu *vcpu, - entryhi = (tlb->tlb_hi & VPN2_MASK) | (KVM_GUEST_KERNEL_MODE(vcpu) ? - kvm_mips_get_kernel_asid(vcpu) : kvm_mips_get_user_asid(vcpu)); - entrylo0 = mips3_paddr_to_tlbpfn(pfn0 << PAGE_SHIFT) | (0x3 << 3) | -- (tlb->tlb_lo0 & MIPS3_PG_D) | (tlb->tlb_lo0 & MIPS3_PG_V); -+ (tlb_lo[0] & MIPS3_PG_D) | (tlb_lo[0] & MIPS3_PG_V); - entrylo1 = mips3_paddr_to_tlbpfn(pfn1 << PAGE_SHIFT) | (0x3 << 3) | -- (tlb->tlb_lo1 & MIPS3_PG_D) | (tlb->tlb_lo1 & MIPS3_PG_V); -+ (tlb_lo[1] & MIPS3_PG_D) | (tlb_lo[1] & MIPS3_PG_V); - - #ifdef DEBUG - kvm_debug("@ %#lx tlb_lo0: 0x%08lx tlb_lo1: 0x%08lx\n", vcpu->arch.pc, -@@ -909,10 +926,16 @@ uint32_t kvm_get_inst(uint32_t *opc, struct kvm_vcpu *vcpu) - local_irq_restore(flags); - return KVM_INVALID_INST; - } -- kvm_mips_handle_mapped_seg_tlb_fault(vcpu, -- &vcpu->arch. -- guest_tlb[index], -- NULL, NULL); -+ if (kvm_mips_handle_mapped_seg_tlb_fault(vcpu, -+ &vcpu->arch.guest_tlb[index], -+ NULL, NULL)) { -+ kvm_err("%s: handling mapped seg tlb fault failed for %p, index: %u, vcpu: %p, ASID: %#lx\n", -+ __func__, opc, index, vcpu, -+ read_c0_entryhi()); -+ kvm_mips_dump_guest_tlbs(vcpu); -+ local_irq_restore(flags); -+ return KVM_INVALID_INST; -+ } - inst = *(opc); - } - local_irq_restore(flags); -diff --git a/arch/mips/math-emu/cp1emu.c b/arch/mips/math-emu/cp1emu.c -index f03771900813..3d492a823a55 100644 ---- a/arch/mips/math-emu/cp1emu.c -+++ b/arch/mips/math-emu/cp1emu.c -@@ -684,9 +684,11 @@ static int isBranchInstr(struct pt_regs *regs, struct mm_decoded_insn dec_insn, - case spec_op: - switch (insn.r_format.func) { - case jalr_op: -- regs->regs[insn.r_format.rd] = -- regs->cp0_epc + dec_insn.pc_inc + -- dec_insn.next_pc_inc; -+ if (insn.r_format.rd != 0) { -+ regs->regs[insn.r_format.rd] = -+ regs->cp0_epc + dec_insn.pc_inc + -+ dec_insn.next_pc_inc; -+ } - /* Fall through */ - case jr_op: - *contpc = regs->regs[insn.r_format.rs]; -diff --git a/arch/parisc/kernel/unaligned.c b/arch/parisc/kernel/unaligned.c -index d7c0acb35ec2..8d49614d600d 100644 ---- a/arch/parisc/kernel/unaligned.c -+++ b/arch/parisc/kernel/unaligned.c -@@ -666,7 +666,7 @@ void handle_unaligned(struct pt_regs *regs) - break; - } - -- if (modify && R1(regs->iir)) -+ if (ret == 0 && modify && R1(regs->iir)) - regs->gr[R1(regs->iir)] = newbase; - - -@@ -677,6 +677,14 @@ void handle_unaligned(struct pt_regs *regs) - - if (ret) - { -+ /* -+ * The unaligned handler failed. -+ * If we were called by __get_user() or __put_user() jump -+ * to it's exception fixup handler instead of crashing. -+ */ -+ if (!user_mode(regs) && fixup_exception(regs)) -+ return; -+ - printk(KERN_CRIT "Unaligned handler failed, ret = %d\n", ret); - die_if_kernel("Unaligned data reference", regs, 28); - -diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h -index 60c31698f7d5..469d7715d6aa 100644 ---- a/arch/powerpc/include/asm/reg.h -+++ b/arch/powerpc/include/asm/reg.h -@@ -643,7 +643,7 @@ - #define MMCR0_FCWAIT 0x00000002UL /* freeze counter in WAIT state */ - #define MMCR0_FCHV 0x00000001UL /* freeze conditions in hypervisor mode */ - #define SPRN_MMCR1 798 --#define SPRN_MMCR2 769 -+#define SPRN_MMCR2 785 - #define SPRN_MMCRA 0x312 - #define MMCRA_SDSYNC 0x80000000UL /* SDAR synced with SIAR */ - #define MMCRA_SDAR_DCACHE_MISS 0x40000000UL -@@ -677,13 +677,13 @@ - #define SPRN_PMC6 792 - #define SPRN_PMC7 793 - #define SPRN_PMC8 794 --#define SPRN_SIAR 780 --#define SPRN_SDAR 781 - #define SPRN_SIER 784 - #define SIER_SIPR 0x2000000 /* Sampled MSR_PR */ - #define SIER_SIHV 0x1000000 /* Sampled MSR_HV */ - #define SIER_SIAR_VALID 0x0400000 /* SIAR contents valid */ - #define SIER_SDAR_VALID 0x0200000 /* SDAR contents valid */ -+#define SPRN_SIAR 796 -+#define SPRN_SDAR 797 - - #define SPRN_PA6T_MMCR0 795 - #define PA6T_MMCR0_EN0 0x0000000000000001UL -diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S -index 902ca3c6b4b6..3ac1d3a90551 100644 ---- a/arch/powerpc/kernel/exceptions-64s.S -+++ b/arch/powerpc/kernel/exceptions-64s.S -@@ -857,11 +857,6 @@ hv_facility_unavailable_relon_trampoline: - #endif - STD_RELON_EXCEPTION_PSERIES(0x5700, 0x1700, altivec_assist) - -- /* Other future vectors */ -- .align 7 -- .globl __end_interrupts --__end_interrupts: -- - .align 7 - system_call_entry_direct: - #if defined(CONFIG_RELOCATABLE) -@@ -1191,6 +1186,17 @@ __end_handlers: - STD_RELON_EXCEPTION_PSERIES_OOL(0xf60, facility_unavailable) - STD_RELON_EXCEPTION_HV_OOL(0xf80, hv_facility_unavailable) - -+ /* -+ * The __end_interrupts marker must be past the out-of-line (OOL) -+ * handlers, so that they are copied to real address 0x100 when running -+ * a relocatable kernel. This ensures they can be reached from the short -+ * trampoline handlers (like 0x4f00, 0x4f20, etc.) which branch -+ * directly, without using LOAD_HANDLER(). -+ */ -+ .align 7 -+ .globl __end_interrupts -+__end_interrupts: -+ - #if defined(CONFIG_PPC_PSERIES) || defined(CONFIG_PPC_POWERNV) - /* - * Data area reserved for FWNMI option. -diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c -index d55357ee9028..a5e339806589 100644 ---- a/arch/powerpc/kernel/process.c -+++ b/arch/powerpc/kernel/process.c -@@ -1088,6 +1088,16 @@ void start_thread(struct pt_regs *regs, unsigned long start, unsigned long sp) - current->thread.regs = regs - 1; - } - -+#ifdef CONFIG_PPC_TRANSACTIONAL_MEM -+ /* -+ * Clear any transactional state, we're exec()ing. The cause is -+ * not important as there will never be a recheckpoint so it's not -+ * user visible. -+ */ -+ if (MSR_TM_SUSPENDED(mfmsr())) -+ tm_reclaim_current(0); -+#endif -+ - memset(regs->gpr, 0, sizeof(regs->gpr)); - regs->ctr = 0; - regs->link = 0; -diff --git a/arch/powerpc/platforms/pseries/eeh_pseries.c b/arch/powerpc/platforms/pseries/eeh_pseries.c -index 68f97d5a4679..dc0278e7fd91 100644 ---- a/arch/powerpc/platforms/pseries/eeh_pseries.c -+++ b/arch/powerpc/platforms/pseries/eeh_pseries.c -@@ -551,29 +551,50 @@ static int pseries_eeh_configure_bridge(struct eeh_pe *pe) - { - int config_addr; - int ret; -+ /* Waiting 0.2s maximum before skipping configuration */ -+ int max_wait = 200; - - /* Figure out the PE address */ - config_addr = pe->config_addr; - if (pe->addr) - config_addr = pe->addr; - -- /* Use new configure-pe function, if supported */ -- if (ibm_configure_pe != RTAS_UNKNOWN_SERVICE) { -- ret = rtas_call(ibm_configure_pe, 3, 1, NULL, -- config_addr, BUID_HI(pe->phb->buid), -- BUID_LO(pe->phb->buid)); -- } else if (ibm_configure_bridge != RTAS_UNKNOWN_SERVICE) { -- ret = rtas_call(ibm_configure_bridge, 3, 1, NULL, -- config_addr, BUID_HI(pe->phb->buid), -- BUID_LO(pe->phb->buid)); -- } else { -- return -EFAULT; -- } -+ while (max_wait > 0) { -+ /* Use new configure-pe function, if supported */ -+ if (ibm_configure_pe != RTAS_UNKNOWN_SERVICE) { -+ ret = rtas_call(ibm_configure_pe, 3, 1, NULL, -+ config_addr, BUID_HI(pe->phb->buid), -+ BUID_LO(pe->phb->buid)); -+ } else if (ibm_configure_bridge != RTAS_UNKNOWN_SERVICE) { -+ ret = rtas_call(ibm_configure_bridge, 3, 1, NULL, -+ config_addr, BUID_HI(pe->phb->buid), -+ BUID_LO(pe->phb->buid)); -+ } else { -+ return -EFAULT; -+ } - -- if (ret) -- pr_warning("%s: Unable to configure bridge PHB#%d-PE#%x (%d)\n", -- __func__, pe->phb->global_number, pe->addr, ret); -+ if (!ret) -+ return ret; -+ -+ /* -+ * If RTAS returns a delay value that's above 100ms, cut it -+ * down to 100ms in case firmware made a mistake. For more -+ * on how these delay values work see rtas_busy_delay_time -+ */ -+ if (ret > RTAS_EXTENDED_DELAY_MIN+2 && -+ ret <= RTAS_EXTENDED_DELAY_MAX) -+ ret = RTAS_EXTENDED_DELAY_MIN+2; -+ -+ max_wait -= rtas_busy_delay_time(ret); -+ -+ if (max_wait < 0) -+ break; -+ -+ rtas_busy_delay(ret); -+ } - -+ pr_warn("%s: Unable to configure bridge PHB#%d-PE#%x (%d)\n", -+ __func__, pe->phb->global_number, pe->addr, ret); - return ret; - } - -diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c -index 86ae364900d6..401369134ba3 100644 ---- a/arch/powerpc/platforms/pseries/iommu.c -+++ b/arch/powerpc/platforms/pseries/iommu.c -@@ -858,7 +858,8 @@ machine_arch_initcall(pseries, find_existing_ddw_windows); - static int query_ddw(struct pci_dev *dev, const u32 *ddw_avail, - struct ddw_query_response *query) - { -- struct eeh_dev *edev; -+ struct device_node *dn; -+ struct pci_dn *pdn; - u32 cfg_addr; - u64 buid; - int ret; -@@ -869,11 +870,10 @@ static int query_ddw(struct pci_dev *dev, const u32 *ddw_avail, - * Retrieve them from the pci device, not the node with the - * dma-window property - */ -- edev = pci_dev_to_eeh_dev(dev); -- cfg_addr = edev->config_addr; -- if (edev->pe_config_addr) -- cfg_addr = edev->pe_config_addr; -- buid = edev->phb->buid; -+ dn = pci_device_to_OF_node(dev); -+ pdn = PCI_DN(dn); -+ buid = pdn->phb->buid; -+ cfg_addr = ((pdn->busno << 16) | (pdn->devfn << 8)); - - ret = rtas_call(ddw_avail[0], 3, 5, (u32 *)query, - cfg_addr, BUID_HI(buid), BUID_LO(buid)); -@@ -887,7 +887,8 @@ static int create_ddw(struct pci_dev *dev, const u32 *ddw_avail, - struct ddw_create_response *create, int page_shift, - int window_shift) - { -- struct eeh_dev *edev; -+ struct device_node *dn; -+ struct pci_dn *pdn; - u32 cfg_addr; - u64 buid; - int ret; -@@ -898,11 +899,10 @@ static int create_ddw(struct pci_dev *dev, const u32 *ddw_avail, - * Retrieve them from the pci device, not the node with the - * dma-window property - */ -- edev = pci_dev_to_eeh_dev(dev); -- cfg_addr = edev->config_addr; -- if (edev->pe_config_addr) -- cfg_addr = edev->pe_config_addr; -- buid = edev->phb->buid; -+ dn = pci_device_to_OF_node(dev); -+ pdn = PCI_DN(dn); -+ buid = pdn->phb->buid; -+ cfg_addr = ((pdn->busno << 16) | (pdn->devfn << 8)); - - do { - /* extra outputs are LIOBN and dma-addr (hi, lo) */ -diff --git a/arch/s390/include/asm/syscall.h b/arch/s390/include/asm/syscall.h -index cd29d2f4e4f3..749313b452ae 100644 ---- a/arch/s390/include/asm/syscall.h -+++ b/arch/s390/include/asm/syscall.h -@@ -54,7 +54,7 @@ static inline void syscall_set_return_value(struct task_struct *task, - struct pt_regs *regs, - int error, long val) - { -- regs->gprs[2] = error ? -error : val; -+ regs->gprs[2] = error ? error : val; - } - - static inline void syscall_get_arguments(struct task_struct *task, -diff --git a/arch/x86/boot/Makefile b/arch/x86/boot/Makefile -index 6cf0111783d3..368f3582c93e 100644 ---- a/arch/x86/boot/Makefile -+++ b/arch/x86/boot/Makefile -@@ -168,6 +168,9 @@ isoimage: $(obj)/bzImage - for i in lib lib64 share end ; do \ - if [ -f /usr/$$i/syslinux/isolinux.bin ] ; then \ - cp /usr/$$i/syslinux/isolinux.bin $(obj)/isoimage ; \ -+ if [ -f /usr/$$i/syslinux/ldlinux.c32 ]; then \ -+ cp /usr/$$i/syslinux/ldlinux.c32 $(obj)/isoimage ; \ -+ fi ; \ - break ; \ - fi ; \ - if [ $$i = end ] ; then exit 1 ; fi ; \ -diff --git a/arch/x86/include/asm/mmu_context.h b/arch/x86/include/asm/mmu_context.h -index be12c534fd59..29a3d1b00ca9 100644 ---- a/arch/x86/include/asm/mmu_context.h -+++ b/arch/x86/include/asm/mmu_context.h -@@ -42,7 +42,34 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, - #endif - cpumask_set_cpu(cpu, mm_cpumask(next)); - -- /* Re-load page tables */ -+ /* -+ * Re-load page tables. -+ * -+ * This logic has an ordering constraint: -+ * -+ * CPU 0: Write to a PTE for 'next' -+ * CPU 0: load bit 1 in mm_cpumask. if nonzero, send IPI. -+ * CPU 1: set bit 1 in next's mm_cpumask -+ * CPU 1: load from the PTE that CPU 0 writes (implicit) -+ * -+ * We need to prevent an outcome in which CPU 1 observes -+ * the new PTE value and CPU 0 observes bit 1 clear in -+ * mm_cpumask. (If that occurs, then the IPI will never -+ * be sent, and CPU 0's TLB will contain a stale entry.) -+ * -+ * The bad outcome can occur if either CPU's load is -+ * reordered before that CPU's store, so both CPUs must -+ * execute full barriers to prevent this from happening. -+ * -+ * Thus, switch_mm needs a full barrier between the -+ * store to mm_cpumask and any operation that could load -+ * from next->pgd. TLB fills are special and can happen -+ * due to instruction fetches or for no reason at all, -+ * and neither LOCK nor MFENCE orders them. -+ * Fortunately, load_cr3() is serializing and gives the -+ * ordering guarantee we need. -+ * -+ */ - load_cr3(next->pgd); - - /* Stop flush ipis for the previous mm */ -@@ -65,10 +92,14 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, - * schedule, protecting us from simultaneous changes. - */ - cpumask_set_cpu(cpu, mm_cpumask(next)); -+ - /* - * We were in lazy tlb mode and leave_mm disabled - * tlb flush IPI delivery. We must reload CR3 - * to make sure to use no freed page tables. -+ * -+ * As above, load_cr3() is serializing and orders TLB -+ * fills with respect to the mm_cpumask write. - */ - load_cr3(next->pgd); - load_LDT_nolock(&next->context); -diff --git a/arch/x86/kernel/amd_nb.c b/arch/x86/kernel/amd_nb.c -index 59554dca96ec..e6a3b1e35fae 100644 ---- a/arch/x86/kernel/amd_nb.c -+++ b/arch/x86/kernel/amd_nb.c -@@ -67,8 +67,8 @@ int amd_cache_northbridges(void) - while ((misc = next_northbridge(misc, amd_nb_misc_ids)) != NULL) - i++; - -- if (i == 0) -- return 0; -+ if (!i) -+ return -ENODEV; - - nb = kzalloc(i * sizeof(struct amd_northbridge), GFP_KERNEL); - if (!nb) -diff --git a/arch/x86/kernel/apm_32.c b/arch/x86/kernel/apm_32.c -index 53a4e2744846..3ab03430211d 100644 ---- a/arch/x86/kernel/apm_32.c -+++ b/arch/x86/kernel/apm_32.c -@@ -392,7 +392,7 @@ static struct cpuidle_device apm_cpuidle_device; - /* - * Local variables - */ --static struct { -+__visible struct { - unsigned long offset; - unsigned short segment; - } apm_bios_entry; -diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c -index ac057583282a..a18154454e36 100644 ---- a/arch/x86/kernel/cpu/perf_event_intel.c -+++ b/arch/x86/kernel/cpu/perf_event_intel.c -@@ -2241,13 +2241,16 @@ __init int intel_pmu_init(void) - * counter, so do not extend mask to generic counters - */ - for_each_event_constraint(c, x86_pmu.event_constraints) { -- if (c->cmask != X86_RAW_EVENT_MASK -- || c->idxmsk64 == INTEL_PMC_MSK_FIXED_REF_CYCLES) { -+ if (c->cmask == X86_RAW_EVENT_MASK -+ && c->idxmsk64 == INTEL_PMC_MSK_FIXED_REF_CYCLES) { -+ c->idxmsk64 |= (1ULL << x86_pmu.num_counters) - 1; - continue; - } - -- c->idxmsk64 |= (1ULL << x86_pmu.num_counters) - 1; -- c->weight += x86_pmu.num_counters; -+ c->idxmsk64 &= -+ ~(~0ULL << (INTEL_PMC_IDX_FIXED + x86_pmu.num_counters_fixed)); -+ c->weight = hweight64(c->idxmsk64); -+ - } - } - -diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c -index 0c6c07cea3f7..766aa3bf1798 100644 ---- a/arch/x86/kernel/kprobes/core.c -+++ b/arch/x86/kernel/kprobes/core.c -@@ -908,7 +908,19 @@ int __kprobes kprobe_fault_handler(struct pt_regs *regs, int trapnr) - * normal page fault. - */ - regs->ip = (unsigned long)cur->addr; -+ /* -+ * Trap flag (TF) has been set here because this fault -+ * happened where the single stepping will be done. -+ * So clear it by resetting the current kprobe: -+ */ -+ regs->flags &= ~X86_EFLAGS_TF; -+ -+ /* -+ * If the TF flag was set before the kprobe hit, -+ * don't touch it: -+ */ - regs->flags |= kcb->kprobe_old_flags; -+ - if (kcb->kprobe_status == KPROBE_REENTER) - restore_previous_kprobe(kcb); - else -diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c -index 3c0b085b4336..8e57771d4bfd 100644 ---- a/arch/x86/kvm/x86.c -+++ b/arch/x86/kvm/x86.c -@@ -2966,6 +2966,11 @@ static int kvm_vcpu_ioctl_x86_set_debugregs(struct kvm_vcpu *vcpu, - if (dbgregs->flags) - return -EINVAL; - -+ if (dbgregs->dr6 & ~0xffffffffull) -+ return -EINVAL; -+ if (dbgregs->dr7 & ~0xffffffffull) -+ return -EINVAL; -+ - memcpy(vcpu->arch.db, dbgregs->db, sizeof(vcpu->arch.db)); - vcpu->arch.dr6 = dbgregs->dr6; - vcpu->arch.dr7 = dbgregs->dr7; -diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c -index 282375f13c7e..c26b610a604d 100644 ---- a/arch/x86/mm/tlb.c -+++ b/arch/x86/mm/tlb.c -@@ -149,7 +149,9 @@ void flush_tlb_current_task(void) - - preempt_disable(); - -+ /* This is an implicit full barrier that synchronizes with switch_mm. */ - local_flush_tlb(); -+ - if (cpumask_any_but(mm_cpumask(mm), smp_processor_id()) < nr_cpu_ids) - flush_tlb_others(mm_cpumask(mm), mm, 0UL, TLB_FLUSH_ALL); - preempt_enable(); -@@ -188,11 +190,19 @@ void flush_tlb_mm_range(struct mm_struct *mm, unsigned long start, - unsigned act_entries, tlb_entries = 0; - - preempt_disable(); -- if (current->active_mm != mm) -+ if (current->active_mm != mm) { -+ /* Synchronize with switch_mm. */ -+ smp_mb(); -+ - goto flush_all; -+ } - - if (!current->mm) { - leave_mm(smp_processor_id()); -+ -+ /* Synchronize with switch_mm. */ -+ smp_mb(); -+ - goto flush_all; - } - -@@ -242,10 +252,18 @@ void flush_tlb_page(struct vm_area_struct *vma, unsigned long start) - preempt_disable(); - - if (current->active_mm == mm) { -- if (current->mm) -+ if (current->mm) { -+ /* -+ * Implicit full barrier (INVLPG) that synchronizes -+ * with switch_mm. -+ */ - __flush_tlb_one(start); -- else -+ } else { - leave_mm(smp_processor_id()); -+ -+ /* Synchronize with switch_mm. */ -+ smp_mb(); -+ } - } - - if (cpumask_any_but(mm_cpumask(mm), smp_processor_id()) < nr_cpu_ids) -diff --git a/block/genhd.c b/block/genhd.c -index b09f5fc94dee..7af2f6a18d9b 100644 ---- a/block/genhd.c -+++ b/block/genhd.c -@@ -829,6 +829,7 @@ static void disk_seqf_stop(struct seq_file *seqf, void *v) - if (iter) { - class_dev_iter_exit(iter); - kfree(iter); -+ seqf->private = NULL; - } - } - -diff --git a/crypto/gcm.c b/crypto/gcm.c -index cd97cdd8cabe..451e420ce56c 100644 ---- a/crypto/gcm.c -+++ b/crypto/gcm.c -@@ -716,7 +716,9 @@ static struct crypto_instance *crypto_gcm_alloc_common(struct rtattr **tb, - - ghash_alg = crypto_find_alg(ghash_name, &crypto_ahash_type, - CRYPTO_ALG_TYPE_HASH, -- CRYPTO_ALG_TYPE_AHASH_MASK); -+ CRYPTO_ALG_TYPE_AHASH_MASK | -+ crypto_requires_sync(algt->type, -+ algt->mask)); - if (IS_ERR(ghash_alg)) - return ERR_CAST(ghash_alg); - -diff --git a/crypto/scatterwalk.c b/crypto/scatterwalk.c -index 7281b8a93ad3..79cbbbfffffc 100644 ---- a/crypto/scatterwalk.c -+++ b/crypto/scatterwalk.c -@@ -68,7 +68,8 @@ static void scatterwalk_pagedone(struct scatter_walk *walk, int out, - - void scatterwalk_done(struct scatter_walk *walk, int out, int more) - { -- if (!(scatterwalk_pagelen(walk) & (PAGE_SIZE - 1)) || !more) -+ if (!more || walk->offset >= walk->sg->offset + walk->sg->length || -+ !(walk->offset & (PAGE_SIZE - 1))) - scatterwalk_pagedone(walk, out, more); - } - EXPORT_SYMBOL_GPL(scatterwalk_done); -diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c -index a02a91cd1de4..c5e3dd93865a 100644 ---- a/drivers/acpi/pci_root.c -+++ b/drivers/acpi/pci_root.c -@@ -385,6 +385,7 @@ static int acpi_pci_root_add(struct acpi_device *device, - int result; - struct acpi_pci_root *root; - u32 flags, base_flags; -+ bool no_aspm = false, clear_aspm = false; - - root = kzalloc(sizeof(struct acpi_pci_root), GFP_KERNEL); - if (!root) -@@ -445,31 +446,10 @@ static int acpi_pci_root_add(struct acpi_device *device, - flags = base_flags = OSC_PCI_SEGMENT_GROUPS_SUPPORT; - acpi_pci_osc_support(root, flags); - -- /* -- * TBD: Need PCI interface for enumeration/configuration of roots. -- */ -- - mutex_lock(&acpi_pci_root_lock); - list_add_tail(&root->node, &acpi_pci_roots); - mutex_unlock(&acpi_pci_root_lock); - -- /* -- * Scan the Root Bridge -- * -------------------- -- * Must do this prior to any attempt to bind the root device, as the -- * PCI namespace does not get created until this call is made (and -- * thus the root bridge's pci_dev does not exist). -- */ -- root->bus = pci_acpi_scan_root(root); -- if (!root->bus) { -- printk(KERN_ERR PREFIX -- "Bus %04x:%02x not present in PCI namespace\n", -- root->segment, (unsigned int)root->secondary.start); -- result = -ENODEV; -- goto out_del_root; -- } -- -- /* Indicate support for various _OSC capabilities. */ - if (pci_ext_cfg_avail()) - flags |= OSC_EXT_PCI_CONFIG_SUPPORT; - if (pcie_aspm_support_enabled()) { -@@ -483,7 +463,7 @@ static int acpi_pci_root_add(struct acpi_device *device, - if (ACPI_FAILURE(status)) { - dev_info(&device->dev, "ACPI _OSC support " - "notification failed, disabling PCIe ASPM\n"); -- pcie_no_aspm(); -+ no_aspm = true; - flags = base_flags; - } - } -@@ -515,7 +495,7 @@ static int acpi_pci_root_add(struct acpi_device *device, - * We have ASPM control, but the FADT indicates - * that it's unsupported. Clear it. - */ -- pcie_clear_aspm(root->bus); -+ clear_aspm = true; - } - } else { - dev_info(&device->dev, -@@ -524,7 +504,14 @@ static int acpi_pci_root_add(struct acpi_device *device, - acpi_format_exception(status), flags); - pr_info("ACPI _OSC control for PCIe not granted, " - "disabling ASPM\n"); -- pcie_no_aspm(); -+ /* -+ * We want to disable ASPM here, but aspm_disabled -+ * needs to remain in its state from boot so that we -+ * properly handle PCIe 1.1 devices. So we set this -+ * flag here, to defer the action until after the ACPI -+ * root scan. -+ */ -+ no_aspm = true; - } - } else { - dev_info(&device->dev, -@@ -532,6 +519,33 @@ static int acpi_pci_root_add(struct acpi_device *device, - "(_OSC support mask: 0x%02x)\n", flags); - } - -+ /* -+ * TBD: Need PCI interface for enumeration/configuration of roots. -+ */ -+ -+ /* -+ * Scan the Root Bridge -+ * -------------------- -+ * Must do this prior to any attempt to bind the root device, as the -+ * PCI namespace does not get created until this call is made (and -+ * thus the root bridge's pci_dev does not exist). -+ */ -+ root->bus = pci_acpi_scan_root(root); -+ if (!root->bus) { -+ dev_err(&device->dev, -+ "Bus %04x:%02x not present in PCI namespace\n", -+ root->segment, (unsigned int)root->secondary.start); -+ result = -ENODEV; -+ goto end; -+ } -+ -+ if (clear_aspm) { -+ dev_info(&device->dev, "Disabling ASPM (FADT indicates it is unsupported)\n"); -+ pcie_clear_aspm(root->bus); -+ } -+ if (no_aspm) -+ pcie_no_aspm(); -+ - pci_acpi_add_bus_pm_notifier(device, root->bus); - if (device->wakeup.flags.run_wake) - device_set_run_wake(root->bus->bridge, true); -@@ -548,11 +562,6 @@ static int acpi_pci_root_add(struct acpi_device *device, - pci_bus_add_devices(root->bus); - return 1; - --out_del_root: -- mutex_lock(&acpi_pci_root_lock); -- list_del(&root->node); -- mutex_unlock(&acpi_pci_root_lock); -- - end: - kfree(root); - return result; -diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c -index 063036d876b0..126eb86f239f 100644 ---- a/drivers/ata/libata-eh.c -+++ b/drivers/ata/libata-eh.c -@@ -604,7 +604,7 @@ void ata_scsi_error(struct Scsi_Host *host) - ata_scsi_port_error_handler(host, ap); - - /* finish or retry handled scmd's and clean up */ -- WARN_ON(host->host_failed || !list_empty(&eh_work_q)); -+ WARN_ON(!list_empty(&eh_work_q)); - - DPRINTK("EXIT\n"); - } -diff --git a/drivers/base/module.c b/drivers/base/module.c -index db930d3ee312..2a215780eda2 100644 ---- a/drivers/base/module.c -+++ b/drivers/base/module.c -@@ -24,10 +24,12 @@ static char *make_driver_name(struct device_driver *drv) - - static void module_create_drivers_dir(struct module_kobject *mk) - { -- if (!mk || mk->drivers_dir) -- return; -+ static DEFINE_MUTEX(drivers_dir_mutex); - -- mk->drivers_dir = kobject_create_and_add("drivers", &mk->kobj); -+ mutex_lock(&drivers_dir_mutex); -+ if (mk && !mk->drivers_dir) -+ mk->drivers_dir = kobject_create_and_add("drivers", &mk->kobj); -+ mutex_unlock(&drivers_dir_mutex); - } - - void module_add_driver(struct module *mod, struct device_driver *drv) -diff --git a/drivers/crypto/ux500/hash/hash_core.c b/drivers/crypto/ux500/hash/hash_core.c -index 6789c1653913..cde4a6e0fab0 100644 ---- a/drivers/crypto/ux500/hash/hash_core.c -+++ b/drivers/crypto/ux500/hash/hash_core.c -@@ -806,7 +806,7 @@ int hash_process_data( - &device_data->state); - memmove(req_ctx->state.buffer, - device_data->state.buffer, -- HASH_BLOCK_SIZE / sizeof(u32)); -+ HASH_BLOCK_SIZE); - if (ret) { - dev_err(device_data->dev, "[%s] " - "hash_resume_state()" -@@ -858,7 +858,7 @@ int hash_process_data( - - memmove(device_data->state.buffer, - req_ctx->state.buffer, -- HASH_BLOCK_SIZE / sizeof(u32)); -+ HASH_BLOCK_SIZE); - if (ret) { - dev_err(device_data->dev, "[%s] " - "hash_save_state()" -diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c -index 426c51dd420c..ac11e455aea5 100644 ---- a/drivers/gpio/gpio-pca953x.c -+++ b/drivers/gpio/gpio-pca953x.c -@@ -75,7 +75,7 @@ MODULE_DEVICE_TABLE(i2c, pca953x_id); - #define MAX_BANK 5 - #define BANK_SZ 8 - --#define NBANK(chip) (chip->gpio_chip.ngpio / BANK_SZ) -+#define NBANK(chip) DIV_ROUND_UP(chip->gpio_chip.ngpio, BANK_SZ) - - struct pca953x_chip { - unsigned gpio_start; -diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c -index b78cbe74dadf..93b74107d20d 100644 ---- a/drivers/gpu/drm/drm_fb_helper.c -+++ b/drivers/gpu/drm/drm_fb_helper.c -@@ -1313,7 +1313,6 @@ static int drm_pick_crtcs(struct drm_fb_helper *fb_helper, - int n, int width, int height) - { - int c, o; -- struct drm_device *dev = fb_helper->dev; - struct drm_connector *connector; - struct drm_connector_helper_funcs *connector_funcs; - struct drm_encoder *encoder; -@@ -1334,7 +1333,7 @@ static int drm_pick_crtcs(struct drm_fb_helper *fb_helper, - if (modes[n] == NULL) - return best_score; - -- crtcs = kzalloc(dev->mode_config.num_connector * -+ crtcs = kzalloc(fb_helper->connector_count * - sizeof(struct drm_fb_helper_crtc *), GFP_KERNEL); - if (!crtcs) - return best_score; -@@ -1381,7 +1380,7 @@ static int drm_pick_crtcs(struct drm_fb_helper *fb_helper, - best_crtc = crtc; - best_score = score; - memcpy(best_crtcs, crtcs, -- dev->mode_config.num_connector * -+ fb_helper->connector_count * - sizeof(struct drm_fb_helper_crtc *)); - } - } -diff --git a/drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c b/drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c -index 489ffd2c66e5..a3d37e4a84ae 100644 ---- a/drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c -+++ b/drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c -@@ -85,7 +85,7 @@ static const char *const dsi_errors[] = { - "RX Prot Violation", - "HS Generic Write FIFO Full", - "LP Generic Write FIFO Full", -- "Generic Read Data Avail" -+ "Generic Read Data Avail", - "Special Packet Sent", - "Tearing Effect", - }; -diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c -index f3cce23f4a62..f4b9b1c0cae8 100644 ---- a/drivers/gpu/drm/radeon/radeon_atombios.c -+++ b/drivers/gpu/drm/radeon/radeon_atombios.c -@@ -1144,7 +1144,7 @@ bool radeon_atom_get_clock_info(struct drm_device *dev) - le16_to_cpu(firmware_info->info.usReferenceClock); - p1pll->reference_div = 0; - -- if (crev < 2) -+ if ((frev < 2) && (crev < 2)) - p1pll->pll_out_min = - le16_to_cpu(firmware_info->info.usMinPixelClockPLL_Output); - else -@@ -1153,7 +1153,7 @@ bool radeon_atom_get_clock_info(struct drm_device *dev) - p1pll->pll_out_max = - le32_to_cpu(firmware_info->info.ulMaxPixelClockPLL_Output); - -- if (crev >= 4) { -+ if (((frev < 2) && (crev >= 4)) || (frev >= 2)) { - p1pll->lcd_pll_out_min = - le16_to_cpu(firmware_info->info_14.usLcdMinPixelClockPLL_Output) * 100; - if (p1pll->lcd_pll_out_min == 0) -diff --git a/drivers/gpu/drm/radeon/radeon_atpx_handler.c b/drivers/gpu/drm/radeon/radeon_atpx_handler.c -index 8c44ef57864b..a7e1893de838 100644 ---- a/drivers/gpu/drm/radeon/radeon_atpx_handler.c -+++ b/drivers/gpu/drm/radeon/radeon_atpx_handler.c -@@ -11,6 +11,7 @@ - #include - #include - #include -+#include - - #include "radeon_acpi.h" - -@@ -252,6 +253,10 @@ static int radeon_atpx_set_discrete_state(struct radeon_atpx *atpx, u8 state) - if (!info) - return -EIO; - kfree(info); -+ -+ /* 200ms delay is required after off */ -+ if (state == 0) -+ msleep(200); - } - return 0; - } -diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c -index 1fbd38b371d4..ea62810aeda6 100644 ---- a/drivers/gpu/drm/radeon/radeon_connectors.c -+++ b/drivers/gpu/drm/radeon/radeon_connectors.c -@@ -1691,7 +1691,6 @@ radeon_add_atom_connector(struct drm_device *dev, - 1); - /* no HPD on analog connectors */ - radeon_connector->hpd.hpd = RADEON_HPD_NONE; -- connector->polled = DRM_CONNECTOR_POLL_CONNECT; - connector->interlace_allowed = true; - connector->doublescan_allowed = true; - break; -@@ -1889,8 +1888,10 @@ radeon_add_atom_connector(struct drm_device *dev, - } - - if (radeon_connector->hpd.hpd == RADEON_HPD_NONE) { -- if (i2c_bus->valid) -- connector->polled = DRM_CONNECTOR_POLL_CONNECT; -+ if (i2c_bus->valid) { -+ connector->polled = DRM_CONNECTOR_POLL_CONNECT | -+ DRM_CONNECTOR_POLL_DISCONNECT; -+ } - } else - connector->polled = DRM_CONNECTOR_POLL_HPD; - -@@ -1962,7 +1963,6 @@ radeon_add_legacy_connector(struct drm_device *dev, - 1); - /* no HPD on analog connectors */ - radeon_connector->hpd.hpd = RADEON_HPD_NONE; -- connector->polled = DRM_CONNECTOR_POLL_CONNECT; - connector->interlace_allowed = true; - connector->doublescan_allowed = true; - break; -@@ -2047,10 +2047,13 @@ radeon_add_legacy_connector(struct drm_device *dev, - } - - if (radeon_connector->hpd.hpd == RADEON_HPD_NONE) { -- if (i2c_bus->valid) -- connector->polled = DRM_CONNECTOR_POLL_CONNECT; -+ if (i2c_bus->valid) { -+ connector->polled = DRM_CONNECTOR_POLL_CONNECT | -+ DRM_CONNECTOR_POLL_DISCONNECT; -+ } - } else - connector->polled = DRM_CONNECTOR_POLL_HPD; -+ - connector->display_info.subpixel_order = subpixel_order; - drm_sysfs_connector_add(connector); - } -diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c -index 8df1525f71d2..e9db3f8125ed 100644 ---- a/drivers/gpu/drm/radeon/radeon_device.c -+++ b/drivers/gpu/drm/radeon/radeon_device.c -@@ -449,6 +449,23 @@ void radeon_gtt_location(struct radeon_device *rdev, struct radeon_mc *mc) - /* - * GPU helpers function. - */ -+ -+/** -+ * radeon_device_is_virtual - check if we are running is a virtual environment -+ * -+ * Check if the asic has been passed through to a VM (all asics). -+ * Used at driver startup. -+ * Returns true if virtual or false if not. -+ */ -+static bool radeon_device_is_virtual(void) -+{ -+#ifdef CONFIG_X86 -+ return boot_cpu_has(X86_FEATURE_HYPERVISOR); -+#else -+ return false; -+#endif -+} -+ - /** - * radeon_card_posted - check if the hw has already been initialized - * -@@ -462,6 +479,10 @@ bool radeon_card_posted(struct radeon_device *rdev) - { - uint32_t reg; - -+ /* for pass through, always force asic_init */ -+ if (radeon_device_is_virtual()) -+ return false; -+ - /* required for EFI mode on macbook2,1 which uses an r5xx asic */ - if (efi_enabled(EFI_BOOT) && - (rdev->pdev->subsystem_vendor == PCI_VENDOR_ID_APPLE) && -diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c -index a3915d12e746..eb5700e40e1a 100644 ---- a/drivers/hid/hid-input.c -+++ b/drivers/hid/hid-input.c -@@ -1084,7 +1084,7 @@ void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, struct - return; - - /* report the usage code as scancode if the key status has changed */ -- if (usage->type == EV_KEY && !!test_bit(usage->code, input->key) != value) -+ if (usage->type == EV_KEY && (!!test_bit(usage->code, input->key)) != value) - input_event(input, EV_MSC, MSC_SCAN, usage->hid); - - input_event(input, usage->type, usage->code, value); -diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c -index 2f1ddca6f2e0..700145b15088 100644 ---- a/drivers/hid/usbhid/hiddev.c -+++ b/drivers/hid/usbhid/hiddev.c -@@ -516,13 +516,13 @@ static noinline int hiddev_ioctl_usage(struct hiddev *hiddev, unsigned int cmd, - goto inval; - } else if (uref->usage_index >= field->report_count) - goto inval; -- -- else if ((cmd == HIDIOCGUSAGES || cmd == HIDIOCSUSAGES) && -- (uref_multi->num_values > HID_MAX_MULTI_USAGES || -- uref->usage_index + uref_multi->num_values > field->report_count)) -- goto inval; - } - -+ if ((cmd == HIDIOCGUSAGES || cmd == HIDIOCSUSAGES) && -+ (uref_multi->num_values > HID_MAX_MULTI_USAGES || -+ uref->usage_index + uref_multi->num_values > field->report_count)) -+ goto inval; -+ - switch (cmd) { - case HIDIOCGUSAGE: - uref->value = field->value[uref->usage_index]; -diff --git a/drivers/iio/accel/kxsd9.c b/drivers/iio/accel/kxsd9.c -index 7c9a1d97dc68..a22c427454db 100644 ---- a/drivers/iio/accel/kxsd9.c -+++ b/drivers/iio/accel/kxsd9.c -@@ -81,7 +81,7 @@ static int kxsd9_write_scale(struct iio_dev *indio_dev, int micro) - - mutex_lock(&st->buf_lock); - ret = spi_w8r8(st->us, KXSD9_READ(KXSD9_REG_CTRL_C)); -- if (ret) -+ if (ret < 0) - goto error_ret; - st->tx[0] = KXSD9_WRITE(KXSD9_REG_CTRL_C); - st->tx[1] = (ret & ~KXSD9_FS_MASK) | i; -@@ -163,7 +163,7 @@ static int kxsd9_read_raw(struct iio_dev *indio_dev, - break; - case IIO_CHAN_INFO_SCALE: - ret = spi_w8r8(st->us, KXSD9_READ(KXSD9_REG_CTRL_C)); -- if (ret) -+ if (ret < 0) - goto error_ret; - *val2 = kxsd9_micro_scales[ret & KXSD9_FS_MASK]; - ret = IIO_VAL_INT_PLUS_MICRO; -diff --git a/drivers/iio/adc/ad7266.c b/drivers/iio/adc/ad7266.c -index c2744a75c3b0..6569a4e2a436 100644 ---- a/drivers/iio/adc/ad7266.c -+++ b/drivers/iio/adc/ad7266.c -@@ -406,7 +406,7 @@ static int ad7266_probe(struct spi_device *spi) - st = iio_priv(indio_dev); - - st->reg = regulator_get(&spi->dev, "vref"); -- if (!IS_ERR_OR_NULL(st->reg)) { -+ if (!IS_ERR(st->reg)) { - ret = regulator_enable(st->reg); - if (ret) - goto error_put_reg; -@@ -417,6 +417,10 @@ static int ad7266_probe(struct spi_device *spi) - - st->vref_uv = ret; - } else { -+ /* Any other error indicates that the regulator does exist */ -+ if (PTR_ERR(st->reg) != -ENODEV) -+ return PTR_ERR(st->reg); -+ - /* Use internal reference */ - st->vref_uv = 2500000; - } -diff --git a/drivers/iio/industrialio-trigger.c b/drivers/iio/industrialio-trigger.c -index 4d6c7d84e155..301becccf5ed 100644 ---- a/drivers/iio/industrialio-trigger.c -+++ b/drivers/iio/industrialio-trigger.c -@@ -203,22 +203,35 @@ static int iio_trigger_attach_poll_func(struct iio_trigger *trig, - - /* Prevent the module from being removed whilst attached to a trigger */ - __module_get(pf->indio_dev->info->driver_module); -+ -+ /* Get irq number */ - pf->irq = iio_trigger_get_irq(trig); -+ if (pf->irq < 0) -+ goto out_put_module; -+ -+ /* Request irq */ - ret = request_threaded_irq(pf->irq, pf->h, pf->thread, - pf->type, pf->name, - pf); -- if (ret < 0) { -- module_put(pf->indio_dev->info->driver_module); -- return ret; -- } -+ if (ret < 0) -+ goto out_put_irq; - -+ /* Enable trigger in driver */ - if (trig->ops && trig->ops->set_trigger_state && notinuse) { - ret = trig->ops->set_trigger_state(trig, true); - if (ret < 0) -- module_put(pf->indio_dev->info->driver_module); -+ goto out_free_irq; - } - - return ret; -+ -+out_free_irq: -+ free_irq(pf->irq, pf); -+out_put_irq: -+ iio_trigger_put_irq(trig, pf->irq); -+out_put_module: -+ module_put(pf->indio_dev->info->driver_module); -+ return ret; - } - - static int iio_trigger_detach_poll_func(struct iio_trigger *trig, -diff --git a/drivers/infiniband/core/ucm.c b/drivers/infiniband/core/ucm.c -index f2f63933e8a9..5befec118a18 100644 ---- a/drivers/infiniband/core/ucm.c -+++ b/drivers/infiniband/core/ucm.c -@@ -48,6 +48,7 @@ - - #include - -+#include - #include - #include - #include -@@ -1104,6 +1105,9 @@ static ssize_t ib_ucm_write(struct file *filp, const char __user *buf, - struct ib_ucm_cmd_hdr hdr; - ssize_t result; - -+ if (WARN_ON_ONCE(!ib_safe_file_access(filp))) -+ return -EACCES; -+ - if (len < sizeof(hdr)) - return -EINVAL; - -diff --git a/drivers/infiniband/core/ucma.c b/drivers/infiniband/core/ucma.c -index 5ca44cd9b00c..99f1c170770f 100644 ---- a/drivers/infiniband/core/ucma.c -+++ b/drivers/infiniband/core/ucma.c -@@ -43,6 +43,7 @@ - #include - #include - -+#include - #include - #include - #include -@@ -1249,6 +1250,9 @@ static ssize_t ucma_write(struct file *filp, const char __user *buf, - struct rdma_ucm_cmd_hdr hdr; - ssize_t ret; - -+ if (WARN_ON_ONCE(!ib_safe_file_access(filp))) -+ return -EACCES; -+ - if (len < sizeof(hdr)) - return -EINVAL; - -diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c -index b6062b9236a2..f50623d07a75 100644 ---- a/drivers/infiniband/core/uverbs_main.c -+++ b/drivers/infiniband/core/uverbs_main.c -@@ -48,6 +48,8 @@ - - #include - -+#include -+ - #include "uverbs.h" - - MODULE_AUTHOR("Roland Dreier"); -@@ -588,6 +590,9 @@ static ssize_t ib_uverbs_write(struct file *filp, const char __user *buf, - struct ib_uverbs_file *file = filp->private_data; - struct ib_uverbs_cmd_hdr hdr; - -+ if (WARN_ON_ONCE(!ib_safe_file_access(filp))) -+ return -EACCES; -+ - if (count < sizeof hdr) - return -EINVAL; - -diff --git a/drivers/infiniband/hw/mlx4/ah.c b/drivers/infiniband/hw/mlx4/ah.c -index 890c23b3d714..f55d69500a5f 100644 ---- a/drivers/infiniband/hw/mlx4/ah.c -+++ b/drivers/infiniband/hw/mlx4/ah.c -@@ -65,6 +65,7 @@ static struct ib_ah *create_ib_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr, - - ah->av.ib.port_pd = cpu_to_be32(to_mpd(pd)->pdn | (ah_attr->port_num << 24)); - ah->av.ib.g_slid = ah_attr->src_path_bits; -+ ah->av.ib.sl_tclass_flowlabel = cpu_to_be32(ah_attr->sl << 28); - if (ah_attr->ah_flags & IB_AH_GRH) { - ah->av.ib.g_slid |= 0x80; - ah->av.ib.gid_index = ah_attr->grh.sgid_index; -@@ -82,7 +83,6 @@ static struct ib_ah *create_ib_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr, - !(1 << ah->av.ib.stat_rate & dev->caps.stat_rate_support)) - --ah->av.ib.stat_rate; - } -- ah->av.ib.sl_tclass_flowlabel = cpu_to_be32(ah_attr->sl << 28); - - return &ah->ibah; - } -diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c -index 262a18437ceb..1fe3bdb0da14 100644 ---- a/drivers/infiniband/hw/mlx4/qp.c -+++ b/drivers/infiniband/hw/mlx4/qp.c -@@ -346,7 +346,7 @@ static int send_wqe_overhead(enum mlx4_ib_qp_type type, u32 flags) - sizeof (struct mlx4_wqe_raddr_seg); - case MLX4_IB_QPT_RC: - return sizeof (struct mlx4_wqe_ctrl_seg) + -- sizeof (struct mlx4_wqe_atomic_seg) + -+ sizeof (struct mlx4_wqe_masked_atomic_seg) + - sizeof (struct mlx4_wqe_raddr_seg); - case MLX4_IB_QPT_SMI: - case MLX4_IB_QPT_GSI: -diff --git a/drivers/infiniband/hw/qib/qib_file_ops.c b/drivers/infiniband/hw/qib/qib_file_ops.c -index b56c9428f3c5..8cb29b36c82a 100644 ---- a/drivers/infiniband/hw/qib/qib_file_ops.c -+++ b/drivers/infiniband/hw/qib/qib_file_ops.c -@@ -45,6 +45,8 @@ - #include - #include - -+#include -+ - #include "qib.h" - #include "qib_common.h" - #include "qib_user_sdma.h" -@@ -1977,6 +1979,9 @@ static ssize_t qib_write(struct file *fp, const char __user *data, - ssize_t ret = 0; - void *dest; - -+ if (WARN_ON_ONCE(!ib_safe_file_access(fp))) -+ return -EACCES; -+ - if (count < sizeof(cmd.type)) { - ret = -EINVAL; - goto bail; -diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c -index b6e049a3c7a8..a481094af85f 100644 ---- a/drivers/infiniband/ulp/ipoib/ipoib_main.c -+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c -@@ -887,7 +887,9 @@ struct ipoib_neigh *ipoib_neigh_get(struct net_device *dev, u8 *daddr) - neigh = NULL; - goto out_unlock; - } -- neigh->alive = jiffies; -+ -+ if (likely(skb_queue_len(&neigh->queue) < IPOIB_MAX_PATH_REC_QUEUE)) -+ neigh->alive = jiffies; - goto out_unlock; - } - } -diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c -index 856c1b03e22d..685e125d6366 100644 ---- a/drivers/input/joystick/xpad.c -+++ b/drivers/input/joystick/xpad.c -@@ -843,6 +843,9 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id - struct usb_endpoint_descriptor *ep_irq_in; - int i, error; - -+ if (intf->cur_altsetting->desc.bNumEndpoints != 2) -+ return -ENODEV; -+ - for (i = 0; xpad_device[i].idVendor; i++) { - if ((le16_to_cpu(udev->descriptor.idVendor) == xpad_device[i].idVendor) && - (le16_to_cpu(udev->descriptor.idProduct) == xpad_device[i].idProduct)) -diff --git a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c -index a0a4bbaef02c..3f2f3ac96a55 100644 ---- a/drivers/input/misc/uinput.c -+++ b/drivers/input/misc/uinput.c -@@ -835,9 +835,15 @@ static long uinput_ioctl(struct file *file, unsigned int cmd, unsigned long arg) - } - - #ifdef CONFIG_COMPAT -+ -+#define UI_SET_PHYS_COMPAT _IOW(UINPUT_IOCTL_BASE, 108, compat_uptr_t) -+ - static long uinput_compat_ioctl(struct file *file, - unsigned int cmd, unsigned long arg) - { -+ if (cmd == UI_SET_PHYS_COMPAT) -+ cmd = UI_SET_PHYS; -+ - return uinput_ioctl_handler(file, cmd, arg, compat_ptr(arg)); - } - #endif -diff --git a/drivers/input/touchscreen/wacom_w8001.c b/drivers/input/touchscreen/wacom_w8001.c -index 9a83be6b6584..abba11220f29 100644 ---- a/drivers/input/touchscreen/wacom_w8001.c -+++ b/drivers/input/touchscreen/wacom_w8001.c -@@ -28,7 +28,7 @@ MODULE_AUTHOR("Jaya Kumar "); - MODULE_DESCRIPTION(DRIVER_DESC); - MODULE_LICENSE("GPL"); - --#define W8001_MAX_LENGTH 11 -+#define W8001_MAX_LENGTH 13 - #define W8001_LEAD_MASK 0x80 - #define W8001_LEAD_BYTE 0x80 - #define W8001_TAB_MASK 0x40 -diff --git a/drivers/isdn/hardware/mISDN/hfcpci.c b/drivers/isdn/hardware/mISDN/hfcpci.c -index a7e4939787c9..eab9167937e2 100644 ---- a/drivers/isdn/hardware/mISDN/hfcpci.c -+++ b/drivers/isdn/hardware/mISDN/hfcpci.c -@@ -2295,8 +2295,8 @@ _hfcpci_softirq(struct device *dev, void *arg) - static void - hfcpci_softirq(void *arg) - { -- (void) driver_for_each_device(&hfc_driver.driver, NULL, arg, -- _hfcpci_softirq); -+ WARN_ON_ONCE(driver_for_each_device(&hfc_driver.driver, NULL, arg, -+ _hfcpci_softirq) != 0); - - /* if next event would be in the past ... */ - if ((s32)(hfc_jiffies + tics - jiffies) <= 0) -diff --git a/drivers/md/dm-flakey.c b/drivers/md/dm-flakey.c -index 7fcf21cb4ff8..a9a47cd029d5 100644 ---- a/drivers/md/dm-flakey.c -+++ b/drivers/md/dm-flakey.c -@@ -286,10 +286,16 @@ static int flakey_map(struct dm_target *ti, struct bio *bio) - pb->bio_submitted = true; - - /* -- * Map reads as normal. -+ * Map reads as normal only if corrupt_bio_byte set. - */ -- if (bio_data_dir(bio) == READ) -- goto map_bio; -+ if (bio_data_dir(bio) == READ) { -+ /* If flags were specified, only corrupt those that match. */ -+ if (fc->corrupt_bio_byte && (fc->corrupt_bio_rw == READ) && -+ all_corrupt_bio_flags_match(bio, fc)) -+ goto map_bio; -+ else -+ return -EIO; -+ } - - /* - * Drop writes? -@@ -327,12 +333,13 @@ static int flakey_end_io(struct dm_target *ti, struct bio *bio, int error) - - /* - * Corrupt successful READs while in down state. -- * If flags were specified, only corrupt those that match. - */ -- if (fc->corrupt_bio_byte && !error && pb->bio_submitted && -- (bio_data_dir(bio) == READ) && (fc->corrupt_bio_rw == READ) && -- all_corrupt_bio_flags_match(bio, fc)) -- corrupt_bio_data(bio, fc); -+ if (!error && pb->bio_submitted && (bio_data_dir(bio) == READ)) { -+ if (fc->corrupt_bio_byte) -+ corrupt_bio_data(bio, fc); -+ else -+ return -EIO; -+ } - - return error; - } -diff --git a/drivers/media/dvb-frontends/stb6100.c b/drivers/media/dvb-frontends/stb6100.c -index cea175d19890..4ef8a5c7003e 100644 ---- a/drivers/media/dvb-frontends/stb6100.c -+++ b/drivers/media/dvb-frontends/stb6100.c -@@ -193,7 +193,7 @@ static int stb6100_write_reg_range(struct stb6100_state *state, u8 buf[], int st - .len = len + 1 - }; - -- if (1 + len > sizeof(buf)) { -+ if (1 + len > sizeof(cmdbuf)) { - printk(KERN_WARNING - "%s: i2c wr: len=%d is too big!\n", - KBUILD_MODNAME, len); -diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c -index 961d7ff75427..eb92027cef92 100644 ---- a/drivers/media/platform/s5p-mfc/s5p_mfc.c -+++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c -@@ -1000,6 +1000,11 @@ static int match_child(struct device *dev, void *data) - return !strcmp(dev_name(dev), (char *)data); - } - -+static void s5p_mfc_memdev_release(struct device *dev) -+{ -+ dma_release_declared_memory(dev); -+} -+ - static void *mfc_get_drv_data(struct platform_device *pdev); - - static int s5p_mfc_alloc_memdevs(struct s5p_mfc_dev *dev) -@@ -1012,6 +1017,9 @@ static int s5p_mfc_alloc_memdevs(struct s5p_mfc_dev *dev) - mfc_err("Not enough memory\n"); - return -ENOMEM; - } -+ -+ dev_set_name(dev->mem_dev_l, "%s", "s5p-mfc-l"); -+ dev->mem_dev_l->release = s5p_mfc_memdev_release; - device_initialize(dev->mem_dev_l); - of_property_read_u32_array(dev->plat_dev->dev.of_node, - "samsung,mfc-l", mem_info, 2); -@@ -1029,6 +1037,9 @@ static int s5p_mfc_alloc_memdevs(struct s5p_mfc_dev *dev) - mfc_err("Not enough memory\n"); - return -ENOMEM; - } -+ -+ dev_set_name(dev->mem_dev_r, "%s", "s5p-mfc-r"); -+ dev->mem_dev_r->release = s5p_mfc_memdev_release; - device_initialize(dev->mem_dev_r); - of_property_read_u32_array(dev->plat_dev->dev.of_node, - "samsung,mfc-r", mem_info, 2); -diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c -index c6bf23599eb9..a2863b7b9e21 100644 ---- a/drivers/mmc/card/block.c -+++ b/drivers/mmc/card/block.c -@@ -1582,8 +1582,8 @@ static void mmc_blk_packed_hdr_wrq_prep(struct mmc_queue_req *mqrq, - - packed_cmd_hdr = packed->cmd_hdr; - memset(packed_cmd_hdr, 0, sizeof(packed->cmd_hdr)); -- packed_cmd_hdr[0] = (packed->nr_entries << 16) | -- (PACKED_CMD_WR << 8) | PACKED_CMD_VER; -+ packed_cmd_hdr[0] = cpu_to_le32((packed->nr_entries << 16) | -+ (PACKED_CMD_WR << 8) | PACKED_CMD_VER); - hdr_blocks = mmc_large_sector(card) ? 8 : 1; - - /* -@@ -1597,14 +1597,14 @@ static void mmc_blk_packed_hdr_wrq_prep(struct mmc_queue_req *mqrq, - ((brq->data.blocks * brq->data.blksz) >= - card->ext_csd.data_tag_unit_size); - /* Argument of CMD23 */ -- packed_cmd_hdr[(i * 2)] = -+ packed_cmd_hdr[(i * 2)] = cpu_to_le32( - (do_rel_wr ? MMC_CMD23_ARG_REL_WR : 0) | - (do_data_tag ? MMC_CMD23_ARG_TAG_REQ : 0) | -- blk_rq_sectors(prq); -+ blk_rq_sectors(prq)); - /* Argument of CMD18 or CMD25 */ -- packed_cmd_hdr[((i * 2)) + 1] = -+ packed_cmd_hdr[((i * 2)) + 1] = cpu_to_le32( - mmc_card_blockaddr(card) ? -- blk_rq_pos(prq) : blk_rq_pos(prq) << 9; -+ blk_rq_pos(prq) : blk_rq_pos(prq) << 9); - packed->blocks += blk_rq_sectors(prq); - i++; - } -diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c -index a56133585e92..03331c173bd0 100644 ---- a/drivers/mtd/ubi/build.c -+++ b/drivers/mtd/ubi/build.c -@@ -997,6 +997,9 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num, - goto out_detach; - } - -+ /* Make device "available" before it becomes accessible via sysfs */ -+ ubi_devices[ubi_num] = ubi; -+ - err = uif_init(ubi, &ref); - if (err) - goto out_detach; -@@ -1041,7 +1044,6 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num, - wake_up_process(ubi->bgt_thread); - spin_unlock(&ubi->wl_lock); - -- ubi_devices[ubi_num] = ubi; - ubi_notify_all(ubi, UBI_VOLUME_ADDED, NULL); - return ubi_num; - -@@ -1052,6 +1054,7 @@ out_uif: - ubi_assert(ref); - uif_close(ubi); - out_detach: -+ ubi_devices[ubi_num] = NULL; - ubi_wl_close(ubi); - ubi_free_internal_volumes(ubi); - vfree(ubi->vtbl); -diff --git a/drivers/mtd/ubi/vmt.c b/drivers/mtd/ubi/vmt.c -index 8330703c098f..96131eb34c9f 100644 ---- a/drivers/mtd/ubi/vmt.c -+++ b/drivers/mtd/ubi/vmt.c -@@ -534,13 +534,6 @@ int ubi_resize_volume(struct ubi_volume_desc *desc, int reserved_pebs) - spin_unlock(&ubi->volumes_lock); - } - -- /* Change volume table record */ -- vtbl_rec = ubi->vtbl[vol_id]; -- vtbl_rec.reserved_pebs = cpu_to_be32(reserved_pebs); -- err = ubi_change_vtbl_record(ubi, vol_id, &vtbl_rec); -- if (err) -- goto out_acc; -- - if (pebs < 0) { - for (i = 0; i < -pebs; i++) { - err = ubi_eba_unmap_leb(ubi, vol, reserved_pebs + i); -@@ -558,6 +551,24 @@ int ubi_resize_volume(struct ubi_volume_desc *desc, int reserved_pebs) - spin_unlock(&ubi->volumes_lock); - } - -+ /* -+ * When we shrink a volume we have to flush all pending (erase) work. -+ * Otherwise it can happen that upon next attach UBI finds a LEB with -+ * lnum > highest_lnum and refuses to attach. -+ */ -+ if (pebs < 0) { -+ err = ubi_wl_flush(ubi, vol_id, UBI_ALL); -+ if (err) -+ goto out_acc; -+ } -+ -+ /* Change volume table record */ -+ vtbl_rec = ubi->vtbl[vol_id]; -+ vtbl_rec.reserved_pebs = cpu_to_be32(reserved_pebs); -+ err = ubi_change_vtbl_record(ubi, vol_id, &vtbl_rec); -+ if (err) -+ goto out_acc; -+ - vol->reserved_pebs = reserved_pebs; - if (vol->vol_type == UBI_DYNAMIC_VOLUME) { - vol->used_ebs = reserved_pebs; -diff --git a/drivers/net/can/at91_can.c b/drivers/net/can/at91_can.c -index 535d5dd8d816..024078c5fb16 100644 ---- a/drivers/net/can/at91_can.c -+++ b/drivers/net/can/at91_can.c -@@ -731,9 +731,10 @@ static int at91_poll_rx(struct net_device *dev, int quota) - - /* upper group completed, look again in lower */ - if (priv->rx_next > get_mb_rx_low_last(priv) && -- quota > 0 && mb > get_mb_rx_last(priv)) { -+ mb > get_mb_rx_last(priv)) { - priv->rx_next = get_mb_rx_first(priv); -- goto again; -+ if (quota > 0) -+ goto again; - } - - return received; -diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c -index f66aeb79abdf..464e5f66b66d 100644 ---- a/drivers/net/can/dev.c -+++ b/drivers/net/can/dev.c -@@ -772,6 +772,11 @@ static int can_newlink(struct net *src_net, struct net_device *dev, - return -EOPNOTSUPP; - } - -+static void can_dellink(struct net_device *dev, struct list_head *head) -+{ -+ return; -+} -+ - static struct rtnl_link_ops can_link_ops __read_mostly = { - .kind = "can", - .maxtype = IFLA_CAN_MAX, -@@ -779,6 +784,7 @@ static struct rtnl_link_ops can_link_ops __read_mostly = { - .setup = can_setup, - .newlink = can_newlink, - .changelink = can_changelink, -+ .dellink = can_dellink, - .get_size = can_get_size, - .fill_info = can_fill_info, - .get_xstats_size = can_get_xstats_size, -diff --git a/drivers/net/ethernet/atheros/alx/main.c b/drivers/net/ethernet/atheros/alx/main.c -index a85a9c2f1385..7357e54f1de9 100644 ---- a/drivers/net/ethernet/atheros/alx/main.c -+++ b/drivers/net/ethernet/atheros/alx/main.c -@@ -86,9 +86,14 @@ static int alx_refill_rx_ring(struct alx_priv *alx, gfp_t gfp) - while (!cur_buf->skb && next != rxq->read_idx) { - struct alx_rfd *rfd = &rxq->rfd[cur]; - -- skb = __netdev_alloc_skb(alx->dev, alx->rxbuf_size, gfp); -+ skb = __netdev_alloc_skb(alx->dev, alx->rxbuf_size + 64, gfp); - if (!skb) - break; -+ -+ /* Workround for the HW RX DMA overflow issue */ -+ if (((unsigned long)skb->data & 0xfff) == 0xfc0) -+ skb_reserve(skb, 64); -+ - dma = dma_map_single(&alx->hw.pdev->dev, - skb->data, alx->rxbuf_size, - DMA_FROM_DEVICE); -diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c -index d5643c143bb8..df3af299a7d2 100644 ---- a/drivers/net/ethernet/marvell/mvneta.c -+++ b/drivers/net/ethernet/marvell/mvneta.c -@@ -210,7 +210,7 @@ - /* Various constants */ - - /* Coalescing */ --#define MVNETA_TXDONE_COAL_PKTS 1 -+#define MVNETA_TXDONE_COAL_PKTS 0 /* interrupt per packet */ - #define MVNETA_RX_COAL_PKTS 32 - #define MVNETA_RX_COAL_USEC 100 - -diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c -index 74581cbcafa7..a5802419381f 100644 ---- a/drivers/net/usb/cdc_ncm.c -+++ b/drivers/net/usb/cdc_ncm.c -@@ -477,6 +477,13 @@ advance: - if (cdc_ncm_setup(ctx)) - goto error2; - -+ /* Some firmwares need a pause here or they will silently fail -+ * to set up the interface properly. This value was decided -+ * empirically on a Sierra Wireless MC7455 running 02.08.02.00 -+ * firmware. -+ */ -+ usleep_range(10000, 20000); -+ - /* configure data interface */ - temp = usb_set_interface(dev->udev, iface_no, data_altsetting); - if (temp) -@@ -598,24 +605,13 @@ EXPORT_SYMBOL_GPL(cdc_ncm_select_altsetting); - - static int cdc_ncm_bind(struct usbnet *dev, struct usb_interface *intf) - { -- int ret; -- - /* MBIM backwards compatible function? */ - cdc_ncm_select_altsetting(dev, intf); - if (cdc_ncm_comm_intf_is_mbim(intf->cur_altsetting)) - return -ENODEV; - - /* NCM data altsetting is always 1 */ -- ret = cdc_ncm_bind_common(dev, intf, 1); -- -- /* -- * We should get an event when network connection is "connected" or -- * "disconnected". Set network connection in "disconnected" state -- * (carrier is OFF) during attach, so the IP network stack does not -- * start IPv6 negotiation and more. -- */ -- usbnet_link_change(dev, 0, 0); -- return ret; -+ return cdc_ncm_bind_common(dev, intf, 1); - } - - static void cdc_ncm_align_tail(struct sk_buff *skb, size_t modulus, size_t remainder, size_t max) -@@ -1161,7 +1157,8 @@ static void cdc_ncm_disconnect(struct usb_interface *intf) - - static const struct driver_info cdc_ncm_info = { - .description = "CDC NCM", -- .flags = FLAG_POINTTOPOINT | FLAG_NO_SETINT | FLAG_MULTI_PACKET, -+ .flags = FLAG_POINTTOPOINT | FLAG_NO_SETINT | FLAG_MULTI_PACKET -+ | FLAG_LINK_INTR, - .bind = cdc_ncm_bind, - .unbind = cdc_ncm_unbind, - .check_connect = cdc_ncm_check_connect, -@@ -1175,7 +1172,7 @@ static const struct driver_info cdc_ncm_info = { - static const struct driver_info wwan_info = { - .description = "Mobile Broadband Network Device", - .flags = FLAG_POINTTOPOINT | FLAG_NO_SETINT | FLAG_MULTI_PACKET -- | FLAG_WWAN, -+ | FLAG_LINK_INTR | FLAG_WWAN, - .bind = cdc_ncm_bind, - .unbind = cdc_ncm_unbind, - .check_connect = cdc_ncm_check_connect, -@@ -1189,7 +1186,7 @@ static const struct driver_info wwan_info = { - static const struct driver_info wwan_noarp_info = { - .description = "Mobile Broadband Network Device (NO ARP)", - .flags = FLAG_POINTTOPOINT | FLAG_NO_SETINT | FLAG_MULTI_PACKET -- | FLAG_WWAN | FLAG_NOARP, -+ | FLAG_LINK_INTR | FLAG_WWAN | FLAG_NOARP, - .bind = cdc_ncm_bind, - .unbind = cdc_ncm_unbind, - .check_connect = cdc_ncm_check_connect, -diff --git a/drivers/net/wireless/ath/ath5k/led.c b/drivers/net/wireless/ath/ath5k/led.c -index f77ef36acf87..61879b1f7083 100644 ---- a/drivers/net/wireless/ath/ath5k/led.c -+++ b/drivers/net/wireless/ath/ath5k/led.c -@@ -77,7 +77,7 @@ static DEFINE_PCI_DEVICE_TABLE(ath5k_led_devices) = { - /* HP Compaq CQ60-206US (ddreggors@jumptv.com) */ - { ATH_SDEVICE(PCI_VENDOR_ID_HP, 0x0137a), ATH_LED(3, 1) }, - /* HP Compaq C700 (nitrousnrg@gmail.com) */ -- { ATH_SDEVICE(PCI_VENDOR_ID_HP, 0x0137b), ATH_LED(3, 1) }, -+ { ATH_SDEVICE(PCI_VENDOR_ID_HP, 0x0137b), ATH_LED(3, 0) }, - /* LiteOn AR5BXB63 (magooz@salug.it) */ - { ATH_SDEVICE(PCI_VENDOR_ID_ATHEROS, 0x3067), ATH_LED(3, 0) }, - /* IBM-specific AR5212 (all others) */ -diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c -index cb34c7895f2a..735c26620387 100644 ---- a/drivers/net/wireless/mac80211_hwsim.c -+++ b/drivers/net/wireless/mac80211_hwsim.c -@@ -1931,6 +1931,7 @@ static int hwsim_tx_info_frame_received_nl(struct sk_buff *skb_2, - if (!info->attrs[HWSIM_ATTR_ADDR_TRANSMITTER] || - !info->attrs[HWSIM_ATTR_FLAGS] || - !info->attrs[HWSIM_ATTR_COOKIE] || -+ !info->attrs[HWSIM_ATTR_SIGNAL] || - !info->attrs[HWSIM_ATTR_TX_INFO]) - goto out; - -diff --git a/drivers/net/wireless/rtlwifi/base.c b/drivers/net/wireless/rtlwifi/base.c -index 6fc0853fd7f9..d066f74f743a 100644 ---- a/drivers/net/wireless/rtlwifi/base.c -+++ b/drivers/net/wireless/rtlwifi/base.c -@@ -1392,9 +1392,9 @@ void rtl_watchdog_wq_callback(void *data) - if (((rtlpriv->link_info.num_rx_inperiod + - rtlpriv->link_info.num_tx_inperiod) > 8) || - (rtlpriv->link_info.num_rx_inperiod > 2)) -- rtlpriv->enter_ps = true; -- else - rtlpriv->enter_ps = false; -+ else -+ rtlpriv->enter_ps = true; - - /* LeisurePS only work in infra mode. */ - schedule_work(&rtlpriv->works.lps_change_work); -diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c -index d332d55885f8..2d7cd0c080d3 100644 ---- a/drivers/pci/probe.c -+++ b/drivers/pci/probe.c -@@ -173,9 +173,6 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type, - struct pci_bus_region region; - bool bar_too_big = false, bar_disabled = false; - -- if (dev->non_compliant_bars) -- return 0; -- - mask = type ? PCI_ROM_ADDRESS_MASK : ~0; - - /* No printks while decoding is disabled! */ -@@ -295,6 +292,9 @@ static void pci_read_bases(struct pci_dev *dev, unsigned int howmany, int rom) - { - unsigned int pos, reg; - -+ if (dev->non_compliant_bars) -+ return; -+ - for (pos = 0; pos < howmany; pos++) { - struct resource *res = &dev->resource[pos]; - reg = PCI_BASE_ADDRESS_0 + (pos << 2); -diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c -index d111c8687f9b..46497c6cbcc1 100644 ---- a/drivers/platform/x86/hp-wmi.c -+++ b/drivers/platform/x86/hp-wmi.c -@@ -640,6 +640,11 @@ static int hp_wmi_rfkill_setup(struct platform_device *device) - if (err) - return err; - -+ err = hp_wmi_perform_query(HPWMI_WIRELESS_QUERY, 1, &wireless, -+ sizeof(wireless), 0); -+ if (err) -+ return err; -+ - if (wireless & 0x1) { - wifi_rfkill = rfkill_alloc("hp-wifi", &device->dev, - RFKILL_TYPE_WLAN, -diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c -index ec8ccdae7aba..0090de46aa5e 100644 ---- a/drivers/s390/net/qeth_l2_main.c -+++ b/drivers/s390/net/qeth_l2_main.c -@@ -898,6 +898,7 @@ static void qeth_l2_remove_device(struct ccwgroup_device *cgdev) - qeth_l2_set_offline(cgdev); - - if (card->dev) { -+ netif_napi_del(&card->napi); - unregister_netdev(card->dev); - card->dev = NULL; - } -diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c -index c1b0b2761f8d..7366bef742de 100644 ---- a/drivers/s390/net/qeth_l3_main.c -+++ b/drivers/s390/net/qeth_l3_main.c -@@ -3333,6 +3333,7 @@ static void qeth_l3_remove_device(struct ccwgroup_device *cgdev) - qeth_l3_set_offline(cgdev); - - if (card->dev) { -+ netif_napi_del(&card->napi); - unregister_netdev(card->dev); - card->dev = NULL; - } -diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c -index 6a0d362e2596..284efac5f202 100644 ---- a/drivers/scsi/aacraid/commsup.c -+++ b/drivers/scsi/aacraid/commsup.c -@@ -590,10 +590,10 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size, - } - return -EFAULT; - } -- /* We used to udelay() here but that absorbed -- * a CPU when a timeout occured. Not very -- * useful. */ -- cpu_relax(); -+ /* -+ * Allow other processes / CPUS to use core -+ */ -+ schedule(); - } - } else if (down_interruptible(&fibptr->event_wait)) { - /* Do nothing ... satisfy -@@ -1920,6 +1920,10 @@ int aac_command_thread(void *data) - if (difference <= 0) - difference = 1; - set_current_state(TASK_INTERRUPTIBLE); -+ -+ if (kthread_should_stop()) -+ break; -+ - schedule_timeout(difference); - - if (kthread_should_stop()) -diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c -index a683a831527b..02278130826b 100644 ---- a/drivers/scsi/be2iscsi/be_main.c -+++ b/drivers/scsi/be2iscsi/be_main.c -@@ -2978,7 +2978,7 @@ be_sgl_create_contiguous(void *virtual_address, - { - WARN_ON(!virtual_address); - WARN_ON(!physical_address); -- WARN_ON(!length > 0); -+ WARN_ON(!length); - WARN_ON(!sgl); - - sgl->va = virtual_address; -diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c -index 25ac2c00f8b3..2891faa8e384 100644 ---- a/drivers/scsi/ipr.c -+++ b/drivers/scsi/ipr.c -@@ -9607,6 +9607,7 @@ static int ipr_probe_ioa(struct pci_dev *pdev, - ioa_cfg->intr_flag = IPR_USE_MSI; - else { - ioa_cfg->intr_flag = IPR_USE_LSI; -+ ioa_cfg->clear_isr = 1; - ioa_cfg->nvectors = 1; - dev_info(&pdev->dev, "Cannot enable MSI.\n"); - } -diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c -index 9acbc885239b..5ba69ea8eb92 100644 ---- a/drivers/scsi/scsi_error.c -+++ b/drivers/scsi/scsi_error.c -@@ -898,7 +898,6 @@ static int scsi_request_sense(struct scsi_cmnd *scmd) - */ - void scsi_eh_finish_cmd(struct scsi_cmnd *scmd, struct list_head *done_q) - { -- scmd->device->host->host_failed--; - scmd->eh_eflags = 0; - list_move_tail(&scmd->eh_entry, done_q); - } -@@ -1892,6 +1891,9 @@ int scsi_error_handler(void *data) - else - scsi_unjam_host(shost); - -+ /* All scmds have been handled */ -+ shost->host_failed = 0; -+ - /* - * Note - if the above fails completely, the action is to take - * individual devices offline and flush the queue of any -diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c -index 9f3168e8e5a8..60031e15d562 100644 ---- a/drivers/scsi/scsi_lib.c -+++ b/drivers/scsi/scsi_lib.c -@@ -546,66 +546,6 @@ void scsi_run_host_queues(struct Scsi_Host *shost) - - static void __scsi_release_buffers(struct scsi_cmnd *, int); - --/* -- * Function: scsi_end_request() -- * -- * Purpose: Post-processing of completed commands (usually invoked at end -- * of upper level post-processing and scsi_io_completion). -- * -- * Arguments: cmd - command that is complete. -- * error - 0 if I/O indicates success, < 0 for I/O error. -- * bytes - number of bytes of completed I/O -- * requeue - indicates whether we should requeue leftovers. -- * -- * Lock status: Assumed that lock is not held upon entry. -- * -- * Returns: cmd if requeue required, NULL otherwise. -- * -- * Notes: This is called for block device requests in order to -- * mark some number of sectors as complete. -- * -- * We are guaranteeing that the request queue will be goosed -- * at some point during this call. -- * Notes: If cmd was requeued, upon return it will be a stale pointer. -- */ --static struct scsi_cmnd *scsi_end_request(struct scsi_cmnd *cmd, int error, -- int bytes, int requeue) --{ -- struct request_queue *q = cmd->device->request_queue; -- struct request *req = cmd->request; -- -- /* -- * If there are blocks left over at the end, set up the command -- * to queue the remainder of them. -- */ -- if (blk_end_request(req, error, bytes)) { -- /* kill remainder if no retrys */ -- if (error && scsi_noretry_cmd(cmd)) -- blk_end_request_all(req, error); -- else { -- if (requeue) { -- /* -- * Bleah. Leftovers again. Stick the -- * leftovers in the front of the -- * queue, and goose the queue again. -- */ -- scsi_release_buffers(cmd); -- scsi_requeue_command(q, cmd); -- cmd = NULL; -- } -- return cmd; -- } -- } -- -- /* -- * This will goose the queue request function at the end, so we don't -- * need to worry about launching another command. -- */ -- __scsi_release_buffers(cmd, 0); -- scsi_next_command(cmd); -- return NULL; --} -- - static inline unsigned int scsi_sgtable_index(unsigned short nents) - { - unsigned int index; -@@ -735,16 +675,9 @@ static int __scsi_error_from_host_byte(struct scsi_cmnd *cmd, int result) - * - * Returns: Nothing - * -- * Notes: This function is matched in terms of capabilities to -- * the function that created the scatter-gather list. -- * In other words, if there are no bounce buffers -- * (the normal case for most drivers), we don't need -- * the logic to deal with cleaning up afterwards. -- * -- * We must call scsi_end_request(). This will finish off -- * the specified number of sectors. If we are done, the -- * command block will be released and the queue function -- * will be goosed. If we are not done then we have to -+ * Notes: We will finish off the specified number of sectors. If we -+ * are done, the command block will be released and the queue -+ * function will be goosed. If we are not done then we have to - * figure out what to do next: - * - * a) We can call scsi_requeue_command(). The request -@@ -753,7 +686,7 @@ static int __scsi_error_from_host_byte(struct scsi_cmnd *cmd, int result) - * be used if we made forward progress, or if we want - * to switch from READ(10) to READ(6) for example. - * -- * b) We can call scsi_queue_insert(). The request will -+ * b) We can call __scsi_queue_insert(). The request will - * be put back on the queue and retried using the same - * command as before, possibly after a delay. - * -@@ -857,12 +790,28 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) - } - - /* -- * A number of bytes were successfully read. If there -- * are leftovers and there is some kind of error -- * (result != 0), retry the rest. -+ * special case: failed zero length commands always need to -+ * drop down into the retry code. Otherwise, if we finished -+ * all bytes in the request we are done now. - */ -- if (scsi_end_request(cmd, error, good_bytes, result == 0) == NULL) -- return; -+ if (!(blk_rq_bytes(req) == 0 && error) && -+ !blk_end_request(req, error, good_bytes)) -+ goto next_command; -+ -+ /* -+ * Kill remainder if no retrys. -+ */ -+ if (error && scsi_noretry_cmd(cmd)) { -+ blk_end_request_all(req, error); -+ goto next_command; -+ } -+ -+ /* -+ * If there had been no error, but we have leftover bytes in the -+ * requeues just queue the command up again. -+ */ -+ if (result == 0) -+ goto requeue; - - error = __scsi_error_from_host_byte(cmd, result); - -@@ -984,7 +933,6 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) - switch (action) { - case ACTION_FAIL: - /* Give up and fail the remainder of the request */ -- scsi_release_buffers(cmd); - if (!(req->cmd_flags & REQ_QUIET)) { - if (description) - scmd_printk(KERN_INFO, cmd, "%s\n", -@@ -994,12 +942,11 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) - scsi_print_sense("", cmd); - scsi_print_command(cmd); - } -- if (blk_end_request_err(req, error)) -- scsi_requeue_command(q, cmd); -- else -- scsi_next_command(cmd); -- break; -+ if (!blk_end_request_err(req, error)) -+ goto next_command; -+ /*FALLTHRU*/ - case ACTION_REPREP: -+ requeue: - /* Unprep the request and put it back at the head of the queue. - * A new command will be prepared and issued. - */ -@@ -1015,6 +962,11 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) - __scsi_queue_insert(cmd, SCSI_MLQUEUE_DEVICE_BUSY, 0); - break; - } -+ return; -+ -+next_command: -+ __scsi_release_buffers(cmd, 0); -+ scsi_next_command(cmd); - } - - static int scsi_init_sgtable(struct request *req, struct scsi_data_buffer *sdb, -diff --git a/drivers/spi/spi-xilinx.c b/drivers/spi/spi-xilinx.c -index 34d18dcfa0db..109a535b639c 100644 ---- a/drivers/spi/spi-xilinx.c -+++ b/drivers/spi/spi-xilinx.c -@@ -315,7 +315,7 @@ static int xilinx_spi_txrx_bufs(struct spi_device *spi, struct spi_transfer *t) - } - - /* See if there is more data to send */ -- if (!xspi->remaining_bytes > 0) -+ if (xspi->remaining_bytes <= 0) - break; - } - -diff --git a/drivers/staging/iio/accel/sca3000_core.c b/drivers/staging/iio/accel/sca3000_core.c -index 32950ad94857..b30c41b3e0cc 100644 ---- a/drivers/staging/iio/accel/sca3000_core.c -+++ b/drivers/staging/iio/accel/sca3000_core.c -@@ -588,7 +588,7 @@ static ssize_t sca3000_read_frequency(struct device *dev, - goto error_ret_mut; - ret = sca3000_read_ctrl_reg(st, SCA3000_REG_CTRL_SEL_OUT_CTRL); - mutex_unlock(&st->lock); -- if (ret) -+ if (ret < 0) - goto error_ret; - val = ret; - if (base_freq > 0) -diff --git a/drivers/tty/vt/keyboard.c b/drivers/tty/vt/keyboard.c -index a9af1b9ae160..1f6e09649e5a 100644 ---- a/drivers/tty/vt/keyboard.c -+++ b/drivers/tty/vt/keyboard.c -@@ -371,34 +371,22 @@ static void to_utf8(struct vc_data *vc, uint c) - - static void do_compute_shiftstate(void) - { -- unsigned int i, j, k, sym, val; -+ unsigned int k, sym, val; - - shift_state = 0; - memset(shift_down, 0, sizeof(shift_down)); - -- for (i = 0; i < ARRAY_SIZE(key_down); i++) { -- -- if (!key_down[i]) -+ for_each_set_bit(k, key_down, min(NR_KEYS, KEY_CNT)) { -+ sym = U(key_maps[0][k]); -+ if (KTYP(sym) != KT_SHIFT && KTYP(sym) != KT_SLOCK) - continue; - -- k = i * BITS_PER_LONG; -- -- for (j = 0; j < BITS_PER_LONG; j++, k++) { -- -- if (!test_bit(k, key_down)) -- continue; -+ val = KVAL(sym); -+ if (val == KVAL(K_CAPSSHIFT)) -+ val = KVAL(K_SHIFT); - -- sym = U(key_maps[0][k]); -- if (KTYP(sym) != KT_SHIFT && KTYP(sym) != KT_SLOCK) -- continue; -- -- val = KVAL(sym); -- if (val == KVAL(K_CAPSSHIFT)) -- val = KVAL(K_SHIFT); -- -- shift_down[val]++; -- shift_state |= (1 << val); -- } -+ shift_down[val]++; -+ shift_state |= BIT(val); - } - } - -diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c -index 62e532fb82ad..cfce807531f6 100644 ---- a/drivers/usb/core/devio.c -+++ b/drivers/usb/core/devio.c -@@ -1106,10 +1106,11 @@ static int proc_getdriver(struct dev_state *ps, void __user *arg) - - static int proc_connectinfo(struct dev_state *ps, void __user *arg) - { -- struct usbdevfs_connectinfo ci = { -- .devnum = ps->dev->devnum, -- .slow = ps->dev->speed == USB_SPEED_LOW -- }; -+ struct usbdevfs_connectinfo ci; -+ -+ memset(&ci, 0, sizeof(ci)); -+ ci.devnum = ps->dev->devnum; -+ ci.slow = ps->dev->speed == USB_SPEED_LOW; - - if (copy_to_user(arg, &ci, sizeof(ci))) - return -EFAULT; -diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c -index 8eb2de6beee4..4e5156d212dd 100644 ---- a/drivers/usb/core/hub.c -+++ b/drivers/usb/core/hub.c -@@ -113,6 +113,7 @@ EXPORT_SYMBOL_GPL(ehci_cf_port_reset_rwsem); - #define HUB_DEBOUNCE_STEP 25 - #define HUB_DEBOUNCE_STABLE 100 - -+static void hub_release(struct kref *kref); - static int usb_reset_and_verify_device(struct usb_device *udev); - - static inline char *portspeed(struct usb_hub *hub, int portstatus) -@@ -1024,10 +1025,20 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) - unsigned delay; - - /* Continue a partial initialization */ -- if (type == HUB_INIT2) -- goto init2; -- if (type == HUB_INIT3) -+ if (type == HUB_INIT2 || type == HUB_INIT3) { -+ device_lock(hub->intfdev); -+ -+ /* Was the hub disconnected while we were waiting? */ -+ if (hub->disconnected) { -+ device_unlock(hub->intfdev); -+ kref_put(&hub->kref, hub_release); -+ return; -+ } -+ if (type == HUB_INIT2) -+ goto init2; - goto init3; -+ } -+ kref_get(&hub->kref); - - /* The superspeed hub except for root hub has to use Hub Depth - * value as an offset into the route string to locate the bits -@@ -1224,6 +1235,7 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) - PREPARE_DELAYED_WORK(&hub->init_work, hub_init_func3); - schedule_delayed_work(&hub->init_work, - msecs_to_jiffies(delay)); -+ device_unlock(hub->intfdev); - return; /* Continues at init3: below */ - } else { - msleep(delay); -@@ -1244,6 +1256,11 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) - /* Allow autosuspend if it was suppressed */ - if (type <= HUB_INIT3) - usb_autopm_put_interface_async(to_usb_interface(hub->intfdev)); -+ -+ if (type == HUB_INIT2 || type == HUB_INIT3) -+ device_unlock(hub->intfdev); -+ -+ kref_put(&hub->kref, hub_release); - } - - /* Implement the continuations for the delays above */ -diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c -index 94e9cddc05c1..aa27ec1f4813 100644 ---- a/drivers/usb/core/quirks.c -+++ b/drivers/usb/core/quirks.c -@@ -170,14 +170,6 @@ static const struct usb_device_id usb_quirk_list[] = { - /* INTEL VALUE SSD */ - { USB_DEVICE(0x8086, 0xf1a5), .driver_info = USB_QUIRK_RESET_RESUME }, - -- { } /* terminating entry must be last */ --}; -- --static const struct usb_device_id usb_interface_quirk_list[] = { -- /* Logitech UVC Cameras */ -- { USB_VENDOR_AND_INTERFACE_INFO(0x046d, USB_CLASS_VIDEO, 1, 0), -- .driver_info = USB_QUIRK_RESET_RESUME }, -- - /* ASUS Base Station(T100) */ - { USB_DEVICE(0x0b05, 0x17e0), .driver_info = - USB_QUIRK_IGNORE_REMOTE_WAKEUP }, -@@ -191,6 +183,14 @@ static const struct usb_device_id usb_interface_quirk_list[] = { - { } /* terminating entry must be last */ - }; - -+static const struct usb_device_id usb_interface_quirk_list[] = { -+ /* Logitech UVC Cameras */ -+ { USB_VENDOR_AND_INTERFACE_INFO(0x046d, USB_CLASS_VIDEO, 1, 0), -+ .driver_info = USB_QUIRK_RESET_RESUME }, -+ -+ { } /* terminating entry must be last */ -+}; -+ - static bool usb_match_any_interface(struct usb_device *udev, - const struct usb_device_id *id) - { -diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c -index 9d3044bdebe5..c6cc5201665a 100644 ---- a/drivers/usb/musb/musb_host.c -+++ b/drivers/usb/musb/musb_host.c -@@ -581,14 +581,13 @@ musb_rx_reinit(struct musb *musb, struct musb_qh *qh, struct musb_hw_ep *ep) - musb_writew(ep->regs, MUSB_TXCSR, 0); - - /* scrub all previous state, clearing toggle */ -- } else { -- csr = musb_readw(ep->regs, MUSB_RXCSR); -- if (csr & MUSB_RXCSR_RXPKTRDY) -- WARNING("rx%d, packet/%d ready?\n", ep->epnum, -- musb_readw(ep->regs, MUSB_RXCOUNT)); -- -- musb_h_flush_rxfifo(ep, MUSB_RXCSR_CLRDATATOG); - } -+ csr = musb_readw(ep->regs, MUSB_RXCSR); -+ if (csr & MUSB_RXCSR_RXPKTRDY) -+ WARNING("rx%d, packet/%d ready?\n", ep->epnum, -+ musb_readw(ep->regs, MUSB_RXCOUNT)); -+ -+ musb_h_flush_rxfifo(ep, MUSB_RXCSR_CLRDATATOG); - - /* target addr and (for multipoint) hub addr/port */ - if (musb->is_multipoint) { -@@ -948,9 +947,15 @@ static void musb_bulk_nak_timeout(struct musb *musb, struct musb_hw_ep *ep, - if (is_in) { - dma = is_dma_capable() ? ep->rx_channel : NULL; - -- /* clear nak timeout bit */ -+ /* -+ * Need to stop the transaction by clearing REQPKT first -+ * then the NAK Timeout bit ref MUSBMHDRC USB 2.0 HIGH-SPEED -+ * DUAL-ROLE CONTROLLER Programmer's Guide, section 9.2.2 -+ */ - rx_csr = musb_readw(epio, MUSB_RXCSR); - rx_csr |= MUSB_RXCSR_H_WZC_BITS; -+ rx_csr &= ~MUSB_RXCSR_H_REQPKT; -+ musb_writew(epio, MUSB_RXCSR, rx_csr); - rx_csr &= ~MUSB_RXCSR_DATAERROR; - musb_writew(epio, MUSB_RXCSR, rx_csr); - -diff --git a/drivers/usb/renesas_usbhs/mod_gadget.c b/drivers/usb/renesas_usbhs/mod_gadget.c -index ed4949faa70d..64223a923932 100644 ---- a/drivers/usb/renesas_usbhs/mod_gadget.c -+++ b/drivers/usb/renesas_usbhs/mod_gadget.c -@@ -558,6 +558,9 @@ static int usbhsg_ep_enable(struct usb_ep *ep, - struct usbhs_priv *priv = usbhsg_gpriv_to_priv(gpriv); - struct usbhs_pipe *pipe; - int ret = -EIO; -+ unsigned long flags; -+ -+ usbhs_lock(priv, flags); - - /* - * if it already have pipe, -@@ -566,7 +569,8 @@ static int usbhsg_ep_enable(struct usb_ep *ep, - if (uep->pipe) { - usbhs_pipe_clear(uep->pipe); - usbhs_pipe_sequence_data0(uep->pipe); -- return 0; -+ ret = 0; -+ goto usbhsg_ep_enable_end; - } - - pipe = usbhs_pipe_malloc(priv, -@@ -594,6 +598,9 @@ static int usbhsg_ep_enable(struct usb_ep *ep, - ret = 0; - } - -+usbhsg_ep_enable_end: -+ usbhs_unlock(priv, flags); -+ - return ret; - } - -diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c -index bcb6f5c2bae4..006a2a721edf 100644 ---- a/drivers/usb/serial/option.c -+++ b/drivers/usb/serial/option.c -@@ -274,6 +274,7 @@ static void option_instat_callback(struct urb *urb); - #define TELIT_PRODUCT_LE922_USBCFG5 0x1045 - #define TELIT_PRODUCT_LE920 0x1200 - #define TELIT_PRODUCT_LE910 0x1201 -+#define TELIT_PRODUCT_LE910_USBCFG4 0x1206 - - /* ZTE PRODUCTS */ - #define ZTE_VENDOR_ID 0x19d2 -@@ -1206,6 +1207,8 @@ static const struct usb_device_id option_ids[] = { - .driver_info = (kernel_ulong_t)&telit_le922_blacklist_usbcfg0 }, - { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910), - .driver_info = (kernel_ulong_t)&telit_le910_blacklist }, -+ { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910_USBCFG4), -+ .driver_info = (kernel_ulong_t)&telit_le922_blacklist_usbcfg3 }, - { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920), - .driver_info = (kernel_ulong_t)&telit_le920_blacklist }, - { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF622, 0xff, 0xff, 0xff) }, /* ZTE WCDMA products */ -diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c -index 7d7add5ceba4..148e8ea1bc96 100644 ---- a/drivers/virtio/virtio_balloon.c -+++ b/drivers/virtio/virtio_balloon.c -@@ -177,6 +177,8 @@ static void leak_balloon(struct virtio_balloon *vb, size_t num) - num = min(num, ARRAY_SIZE(vb->pfns)); - - mutex_lock(&vb->balloon_lock); -+ /* We can't release more pages than taken */ -+ num = min(num, (size_t)vb->num_pages); - for (vb->num_pfns = 0; vb->num_pfns < num; - vb->num_pfns += VIRTIO_BALLOON_PAGES_PER_PAGE) { - page = balloon_page_dequeue(vb_dev_info); -diff --git a/drivers/xen/xen-acpi-processor.c b/drivers/xen/xen-acpi-processor.c -index 8abd7d579037..2e4517277e80 100644 ---- a/drivers/xen/xen-acpi-processor.c -+++ b/drivers/xen/xen-acpi-processor.c -@@ -426,36 +426,7 @@ upload: - - return 0; - } --static int __init check_prereq(void) --{ -- struct cpuinfo_x86 *c = &cpu_data(0); -- -- if (!xen_initial_domain()) -- return -ENODEV; -- -- if (!acpi_gbl_FADT.smi_command) -- return -ENODEV; -- -- if (c->x86_vendor == X86_VENDOR_INTEL) { -- if (!cpu_has(c, X86_FEATURE_EST)) -- return -ENODEV; - -- return 0; -- } -- if (c->x86_vendor == X86_VENDOR_AMD) { -- /* Copied from powernow-k8.h, can't include ../cpufreq/powernow -- * as we get compile warnings for the static functions. -- */ --#define CPUID_FREQ_VOLT_CAPABILITIES 0x80000007 --#define USE_HW_PSTATE 0x00000080 -- u32 eax, ebx, ecx, edx; -- cpuid(CPUID_FREQ_VOLT_CAPABILITIES, &eax, &ebx, &ecx, &edx); -- if ((edx & USE_HW_PSTATE) != USE_HW_PSTATE) -- return -ENODEV; -- return 0; -- } -- return -ENODEV; --} - /* acpi_perf_data is a pointer to percpu data. */ - static struct acpi_processor_performance __percpu *acpi_perf_data; - -@@ -511,10 +482,10 @@ static struct syscore_ops xap_syscore_ops = { - static int __init xen_acpi_processor_init(void) - { - unsigned int i; -- int rc = check_prereq(); -+ int rc; - -- if (rc) -- return rc; -+ if (!xen_initial_domain()) -+ return -ENODEV; - - nr_acpi_bits = get_max_acpi_id() + 1; - acpi_ids_done = kcalloc(BITS_TO_LONGS(nr_acpi_bits), sizeof(unsigned long), GFP_KERNEL); -diff --git a/drivers/xen/xen-pciback/conf_space.c b/drivers/xen/xen-pciback/conf_space.c -index 75fe3d466515..ba3fac8318bb 100644 ---- a/drivers/xen/xen-pciback/conf_space.c -+++ b/drivers/xen/xen-pciback/conf_space.c -@@ -183,8 +183,7 @@ int xen_pcibk_config_read(struct pci_dev *dev, int offset, int size, - field_start = OFFSET(cfg_entry); - field_end = OFFSET(cfg_entry) + field->size; - -- if ((req_start >= field_start && req_start < field_end) -- || (req_end > field_start && req_end <= field_end)) { -+ if (req_end > field_start && field_end > req_start) { - err = conf_space_read(dev, cfg_entry, field_start, - &tmp_val); - if (err) -@@ -230,8 +229,7 @@ int xen_pcibk_config_write(struct pci_dev *dev, int offset, int size, u32 value) - field_start = OFFSET(cfg_entry); - field_end = OFFSET(cfg_entry) + field->size; - -- if ((req_start >= field_start && req_start < field_end) -- || (req_end > field_start && req_end <= field_end)) { -+ if (req_end > field_start && field_end > req_start) { - tmp_val = 0; - - err = xen_pcibk_config_read(dev, field_start, -diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c -index d05a30072023..7c33afd7d5d3 100644 ---- a/fs/cifs/connect.c -+++ b/fs/cifs/connect.c -@@ -408,7 +408,9 @@ cifs_echo_request(struct work_struct *work) - * server->ops->need_neg() == true. Also, no need to ping if - * we got a response recently. - */ -- if (!server->ops->need_neg || server->ops->need_neg(server) || -+ -+ if (server->tcpStatus == CifsNeedReconnect || -+ server->tcpStatus == CifsExiting || server->tcpStatus == CifsNew || - (server->ops->can_echo && !server->ops->can_echo(server)) || - time_before(jiffies, server->lstrp + SMB_ECHO_INTERVAL - HZ)) - goto requeue_echo; -diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c -index 0c2425b21974..a998c929286f 100644 ---- a/fs/cifs/dir.c -+++ b/fs/cifs/dir.c -@@ -227,6 +227,13 @@ cifs_do_create(struct inode *inode, struct dentry *direntry, unsigned int xid, - goto cifs_create_get_file_info; - } - -+ if (S_ISDIR(newinode->i_mode)) { -+ CIFSSMBClose(xid, tcon, fid->netfid); -+ iput(newinode); -+ rc = -EISDIR; -+ goto out; -+ } -+ - if (!S_ISREG(newinode->i_mode)) { - /* - * The server may allow us to open things like -@@ -391,10 +398,14 @@ cifs_create_set_dentry: - if (rc != 0) { - cifs_dbg(FYI, "Create worked, get_inode_info failed rc = %d\n", - rc); -- if (server->ops->close) -- server->ops->close(xid, tcon, fid); -- goto out; -+ goto out_err; - } -+ -+ if (S_ISDIR(newinode->i_mode)) { -+ rc = -EISDIR; -+ goto out_err; -+ } -+ - d_drop(direntry); - d_add(direntry, newinode); - -@@ -402,6 +413,13 @@ out: - kfree(buf); - kfree(full_path); - return rc; -+ -+out_err: -+ if (server->ops->close) -+ server->ops->close(xid, tcon, fid); -+ if (newinode) -+ iput(newinode); -+ goto out; - } - - int -diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c -index eb0de4c3ca76..9dd8c968d94e 100644 ---- a/fs/cifs/smb2pdu.c -+++ b/fs/cifs/smb2pdu.c -@@ -1250,6 +1250,33 @@ SMB2_echo(struct TCP_Server_Info *server) - - cifs_dbg(FYI, "In echo request\n"); - -+ if (server->tcpStatus == CifsNeedNegotiate) { -+ struct list_head *tmp, *tmp2; -+ struct cifs_ses *ses; -+ struct cifs_tcon *tcon; -+ -+ cifs_dbg(FYI, "Need negotiate, reconnecting tcons\n"); -+ spin_lock(&cifs_tcp_ses_lock); -+ list_for_each(tmp, &server->smb_ses_list) { -+ ses = list_entry(tmp, struct cifs_ses, smb_ses_list); -+ list_for_each(tmp2, &ses->tcon_list) { -+ tcon = list_entry(tmp2, struct cifs_tcon, -+ tcon_list); -+ /* add check for persistent handle reconnect */ -+ if (tcon && tcon->need_reconnect) { -+ spin_unlock(&cifs_tcp_ses_lock); -+ rc = smb2_reconnect(SMB2_ECHO, tcon); -+ spin_lock(&cifs_tcp_ses_lock); -+ } -+ } -+ } -+ spin_unlock(&cifs_tcp_ses_lock); -+ } -+ -+ /* if no session, renegotiate failed above */ -+ if (server->tcpStatus == CifsNeedNegotiate) -+ return -EIO; -+ - rc = small_smb2_init(SMB2_ECHO, NULL, (void **)&req); - if (rc) - return rc; -diff --git a/fs/dcache.c b/fs/dcache.c -index 17222fa5bdc6..2d0b9d2f3c43 100644 ---- a/fs/dcache.c -+++ b/fs/dcache.c -@@ -1311,7 +1311,7 @@ struct dentry *d_alloc(struct dentry * parent, const struct qstr *name) - struct dentry *dentry = __d_alloc(parent->d_sb, name); - if (!dentry) - return NULL; -- -+ dentry->d_flags |= DCACHE_RCUACCESS; - spin_lock(&parent->d_lock); - /* - * don't need child lock because it is not subject -@@ -2101,7 +2101,6 @@ static void __d_rehash(struct dentry * entry, struct hlist_bl_head *b) - { - BUG_ON(!d_unhashed(entry)); - hlist_bl_lock(b); -- entry->d_flags |= DCACHE_RCUACCESS; - hlist_bl_add_head_rcu(&entry->d_hash, b); - hlist_bl_unlock(b); - } -@@ -2285,6 +2284,7 @@ static void __d_move(struct dentry * dentry, struct dentry * target) - - /* ... and switch the parents */ - if (IS_ROOT(dentry)) { -+ dentry->d_flags |= DCACHE_RCUACCESS; - dentry->d_parent = target->d_parent; - target->d_parent = target; - INIT_LIST_HEAD(&target->d_child); -@@ -2401,6 +2401,7 @@ static void __d_materialise_dentry(struct dentry *dentry, struct dentry *anon) - switch_names(dentry, anon); - swap(dentry->d_name.hash, anon->d_name.hash); - -+ dentry->d_flags |= DCACHE_RCUACCESS; - dentry->d_parent = dentry; - list_del_init(&dentry->d_child); - anon->d_parent = dparent; -diff --git a/fs/ecryptfs/file.c b/fs/ecryptfs/file.c -index 9ff3664bb3ea..d4644cc938ba 100644 ---- a/fs/ecryptfs/file.c -+++ b/fs/ecryptfs/file.c -@@ -183,6 +183,19 @@ out: - return rc; - } - -+static int ecryptfs_mmap(struct file *file, struct vm_area_struct *vma) -+{ -+ struct file *lower_file = ecryptfs_file_to_lower(file); -+ /* -+ * Don't allow mmap on top of file systems that don't support it -+ * natively. If FILESYSTEM_MAX_STACK_DEPTH > 2 or ecryptfs -+ * allows recursive mounting, this will need to be extended. -+ */ -+ if (!lower_file->f_op->mmap) -+ return -ENODEV; -+ return generic_file_mmap(file, vma); -+} -+ - /** - * ecryptfs_open - * @inode: inode speciying file to open -@@ -358,7 +371,7 @@ const struct file_operations ecryptfs_main_fops = { - #ifdef CONFIG_COMPAT - .compat_ioctl = ecryptfs_compat_ioctl, - #endif -- .mmap = generic_file_mmap, -+ .mmap = ecryptfs_mmap, - .open = ecryptfs_open, - .flush = ecryptfs_flush, - .release = ecryptfs_release, -diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c -index df633bb25909..7eea76168d33 100644 ---- a/fs/ext4/extents.c -+++ b/fs/ext4/extents.c -@@ -361,9 +361,13 @@ static int ext4_valid_extent(struct inode *inode, struct ext4_extent *ext) - ext4_fsblk_t block = ext4_ext_pblock(ext); - int len = ext4_ext_get_actual_len(ext); - ext4_lblk_t lblock = le32_to_cpu(ext->ee_block); -- ext4_lblk_t last = lblock + len - 1; - -- if (len == 0 || lblock > last) -+ /* -+ * We allow neither: -+ * - zero length -+ * - overflow/wrap-around -+ */ -+ if (lblock + len <= lblock) - return 0; - return ext4_data_block_valid(EXT4_SB(inode->i_sb), block, len); - } -@@ -454,6 +458,10 @@ static int __ext4_ext_check(const char *function, unsigned int line, - error_msg = "invalid extent entries"; - goto corrupted; - } -+ if (unlikely(depth > 32)) { -+ error_msg = "too large eh_depth"; -+ goto corrupted; -+ } - /* Verify checksum on non-root extent tree nodes */ - if (ext_depth(inode) != depth && - !ext4_extent_block_csum_verify(inode, eh)) { -diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c -index 4d4718cf25ab..00cbc648e1dc 100644 ---- a/fs/ext4/ialloc.c -+++ b/fs/ext4/ialloc.c -@@ -1027,11 +1027,13 @@ struct inode *ext4_orphan_get(struct super_block *sb, unsigned long ino) - goto iget_failed; - - /* -- * If the orphans has i_nlinks > 0 then it should be able to be -- * truncated, otherwise it won't be removed from the orphan list -- * during processing and an infinite loop will result. -+ * If the orphans has i_nlinks > 0 then it should be able to -+ * be truncated, otherwise it won't be removed from the orphan -+ * list during processing and an infinite loop will result. -+ * Similarly, it must not be a bad inode. - */ -- if (inode->i_nlink && !ext4_can_truncate(inode)) -+ if ((inode->i_nlink && !ext4_can_truncate(inode)) || -+ is_bad_inode(inode)) - goto bad_orphan; - - if (NEXT_ORPHAN(inode) > max_ino) -diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c -index fb7e576df25c..221b58298847 100644 ---- a/fs/ext4/inode.c -+++ b/fs/ext4/inode.c -@@ -206,9 +206,9 @@ void ext4_evict_inode(struct inode *inode) - * Note that directories do not have this problem because they - * don't use page cache. - */ -- if (ext4_should_journal_data(inode) && -- (S_ISLNK(inode->i_mode) || S_ISREG(inode->i_mode)) && -- inode->i_ino != EXT4_JOURNAL_INO) { -+ if (inode->i_ino != EXT4_JOURNAL_INO && -+ ext4_should_journal_data(inode) && -+ (S_ISLNK(inode->i_mode) || S_ISREG(inode->i_mode))) { - journal_t *journal = EXT4_SB(inode->i_sb)->s_journal; - tid_t commit_tid = EXT4_I(inode)->i_datasync_tid; - -diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c -index 61ee01603940..08b4495c1b12 100644 ---- a/fs/ext4/mballoc.c -+++ b/fs/ext4/mballoc.c -@@ -1232,6 +1232,7 @@ static void ext4_mb_unload_buddy(struct ext4_buddy *e4b) - static int mb_find_order_for_block(struct ext4_buddy *e4b, int block) - { - int order = 1; -+ int bb_incr = 1 << (e4b->bd_blkbits - 1); - void *bb; - - BUG_ON(e4b->bd_bitmap == e4b->bd_buddy); -@@ -1244,7 +1245,8 @@ static int mb_find_order_for_block(struct ext4_buddy *e4b, int block) - /* this block is part of buddy of order 'order' */ - return order; - } -- bb += 1 << (e4b->bd_blkbits - order); -+ bb += bb_incr; -+ bb_incr >>= 1; - order++; - } - return 0; -@@ -2514,7 +2516,7 @@ int ext4_mb_init(struct super_block *sb) - { - struct ext4_sb_info *sbi = EXT4_SB(sb); - unsigned i, j; -- unsigned offset; -+ unsigned offset, offset_incr; - unsigned max; - int ret; - -@@ -2543,11 +2545,13 @@ int ext4_mb_init(struct super_block *sb) - - i = 1; - offset = 0; -+ offset_incr = 1 << (sb->s_blocksize_bits - 1); - max = sb->s_blocksize << 2; - do { - sbi->s_mb_offsets[i] = offset; - sbi->s_mb_maxs[i] = max; -- offset += 1 << (sb->s_blocksize_bits - i); -+ offset += offset_incr; -+ offset_incr = offset_incr >> 1; - max = max >> 1; - i++; - } while (i <= sb->s_blocksize_bits + 1); -@@ -2872,7 +2876,7 @@ ext4_mb_mark_diskspace_used(struct ext4_allocation_context *ac, - ext4_error(sb, "Allocating blocks %llu-%llu which overlap " - "fs metadata", block, block+len); - /* File system mounted not to panic on error -- * Fix the bitmap and repeat the block allocation -+ * Fix the bitmap and return EUCLEAN - * We leak some of the blocks here. - */ - ext4_lock_group(sb, ac->ac_b_ex.fe_group); -@@ -2881,7 +2885,7 @@ ext4_mb_mark_diskspace_used(struct ext4_allocation_context *ac, - ext4_unlock_group(sb, ac->ac_b_ex.fe_group); - err = ext4_handle_dirty_metadata(handle, NULL, bitmap_bh); - if (!err) -- err = -EAGAIN; -+ err = -EUCLEAN; - goto out_err; - } - -@@ -4448,18 +4452,7 @@ repeat: - } - if (likely(ac->ac_status == AC_STATUS_FOUND)) { - *errp = ext4_mb_mark_diskspace_used(ac, handle, reserv_clstrs); -- if (*errp == -EAGAIN) { -- /* -- * drop the reference that we took -- * in ext4_mb_use_best_found -- */ -- ext4_mb_release_context(ac); -- ac->ac_b_ex.fe_group = 0; -- ac->ac_b_ex.fe_start = 0; -- ac->ac_b_ex.fe_len = 0; -- ac->ac_status = AC_STATUS_CONTINUE; -- goto repeat; -- } else if (*errp) { -+ if (*errp) { - ext4_discard_allocated_blocks(ac); - goto errout; - } else { -diff --git a/fs/ext4/super.c b/fs/ext4/super.c -index 063eb5094a63..15a81897df4e 100644 ---- a/fs/ext4/super.c -+++ b/fs/ext4/super.c -@@ -2153,6 +2153,16 @@ static void ext4_orphan_cleanup(struct super_block *sb, - while (es->s_last_orphan) { - struct inode *inode; - -+ /* -+ * We may have encountered an error during cleanup; if -+ * so, skip the rest. -+ */ -+ if (EXT4_SB(sb)->s_mount_state & EXT4_ERROR_FS) { -+ jbd_debug(1, "Skipping orphan recovery on fs with errors.\n"); -+ es->s_last_orphan = 0; -+ break; -+ } -+ - inode = ext4_orphan_get(sb, le32_to_cpu(es->s_last_orphan)); - if (IS_ERR(inode)) { - es->s_last_orphan = 0; -diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c -index 4d371f3b9a45..efe802e5bb3d 100644 ---- a/fs/fuse/inode.c -+++ b/fs/fuse/inode.c -@@ -913,7 +913,7 @@ static void fuse_send_init(struct fuse_conn *fc, struct fuse_req *req) - arg->flags |= FUSE_ASYNC_READ | FUSE_POSIX_LOCKS | FUSE_ATOMIC_O_TRUNC | - FUSE_EXPORT_SUPPORT | FUSE_BIG_WRITES | FUSE_DONT_MASK | - FUSE_SPLICE_WRITE | FUSE_SPLICE_MOVE | FUSE_SPLICE_READ | -- FUSE_FLOCK_LOCKS | FUSE_IOCTL_DIR | FUSE_AUTO_INVAL_DATA | -+ FUSE_FLOCK_LOCKS | FUSE_HAS_IOCTL_DIR | FUSE_AUTO_INVAL_DATA | - FUSE_DO_READDIRPLUS | FUSE_READDIRPLUS_AUTO | FUSE_ASYNC_DIO; - req->in.h.opcode = FUSE_INIT; - req->in.numargs = 1; -diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c -index d8ac734a1e44..c2b89a1a403b 100644 ---- a/fs/nfs/nfs4proc.c -+++ b/fs/nfs/nfs4proc.c -@@ -2332,12 +2332,11 @@ static void nfs4_close_prepare(struct rpc_task *task, void *data) - call_close |= is_wronly; - else if (is_wronly) - calldata->arg.fmode |= FMODE_WRITE; -+ if (calldata->arg.fmode != (FMODE_READ|FMODE_WRITE)) -+ call_close |= is_rdwr; - } else if (is_rdwr) - calldata->arg.fmode |= FMODE_READ|FMODE_WRITE; - -- if (calldata->arg.fmode == 0) -- call_close |= is_rdwr; -- - if (!nfs4_valid_open_stateid(state)) - call_close = 0; - spin_unlock(&state->owner->so_lock); -diff --git a/fs/nilfs2/the_nilfs.c b/fs/nilfs2/the_nilfs.c -index 41e6a04a561f..0f9a5b4ad53b 100644 ---- a/fs/nilfs2/the_nilfs.c -+++ b/fs/nilfs2/the_nilfs.c -@@ -431,7 +431,7 @@ static int nilfs_valid_sb(struct nilfs_super_block *sbp) - if (!sbp || le16_to_cpu(sbp->s_magic) != NILFS_SUPER_MAGIC) - return 0; - bytes = le16_to_cpu(sbp->s_bytes); -- if (bytes > BLOCK_SIZE) -+ if (bytes < sumoff + 4 || bytes > BLOCK_SIZE) - return 0; - crc = crc32_le(le32_to_cpu(sbp->s_crc_seed), (unsigned char *)sbp, - sumoff); -diff --git a/fs/pipe.c b/fs/pipe.c -index 50267e6ba688..c281867c453e 100644 ---- a/fs/pipe.c -+++ b/fs/pipe.c -@@ -39,6 +39,12 @@ unsigned int pipe_max_size = 1048576; - */ - unsigned int pipe_min_size = PAGE_SIZE; - -+/* Maximum allocatable pages per user. Hard limit is unset by default, soft -+ * matches default values. -+ */ -+unsigned long pipe_user_pages_hard; -+unsigned long pipe_user_pages_soft = PIPE_DEF_BUFFERS * INR_OPEN_CUR; -+ - /* - * We use a start+len construction, which provides full use of the - * allocated memory. -@@ -794,20 +800,49 @@ pipe_fasync(int fd, struct file *filp, int on) - return retval; - } - -+static void account_pipe_buffers(struct pipe_inode_info *pipe, -+ unsigned long old, unsigned long new) -+{ -+ atomic_long_add(new - old, &pipe->user->pipe_bufs); -+} -+ -+static bool too_many_pipe_buffers_soft(struct user_struct *user) -+{ -+ return pipe_user_pages_soft && -+ atomic_long_read(&user->pipe_bufs) >= pipe_user_pages_soft; -+} -+ -+static bool too_many_pipe_buffers_hard(struct user_struct *user) -+{ -+ return pipe_user_pages_hard && -+ atomic_long_read(&user->pipe_bufs) >= pipe_user_pages_hard; -+} -+ - struct pipe_inode_info *alloc_pipe_info(void) - { - struct pipe_inode_info *pipe; - - pipe = kzalloc(sizeof(struct pipe_inode_info), GFP_KERNEL); - if (pipe) { -- pipe->bufs = kzalloc(sizeof(struct pipe_buffer) * PIPE_DEF_BUFFERS, GFP_KERNEL); -+ unsigned long pipe_bufs = PIPE_DEF_BUFFERS; -+ struct user_struct *user = get_current_user(); -+ -+ if (!too_many_pipe_buffers_hard(user)) { -+ if (too_many_pipe_buffers_soft(user)) -+ pipe_bufs = 1; -+ pipe->bufs = kzalloc(sizeof(struct pipe_buffer) * pipe_bufs, GFP_KERNEL); -+ } -+ - if (pipe->bufs) { - init_waitqueue_head(&pipe->wait); - pipe->r_counter = pipe->w_counter = 1; -- pipe->buffers = PIPE_DEF_BUFFERS; -+ pipe->buffers = pipe_bufs; -+ pipe->user = user; -+ account_pipe_buffers(pipe, 0, pipe_bufs); - mutex_init(&pipe->mutex); - return pipe; - } -+ free_uid(user); - kfree(pipe); - } - -@@ -818,6 +853,8 @@ void free_pipe_info(struct pipe_inode_info *pipe) - { - int i; - -+ account_pipe_buffers(pipe, pipe->buffers, 0); -+ free_uid(pipe->user); - for (i = 0; i < pipe->buffers; i++) { - struct pipe_buffer *buf = pipe->bufs + i; - if (buf->ops) -@@ -1208,6 +1245,7 @@ static long pipe_set_size(struct pipe_inode_info *pipe, unsigned long nr_pages) - memcpy(bufs + head, pipe->bufs, tail * sizeof(struct pipe_buffer)); - } - -+ account_pipe_buffers(pipe, pipe->buffers, nr_pages); - pipe->curbuf = 0; - kfree(pipe->bufs); - pipe->bufs = bufs; -@@ -1279,6 +1317,11 @@ long pipe_fcntl(struct file *file, unsigned int cmd, unsigned long arg) - if (!capable(CAP_SYS_RESOURCE) && size > pipe_max_size) { - ret = -EPERM; - goto out; -+ } else if ((too_many_pipe_buffers_hard(pipe->user) || -+ too_many_pipe_buffers_soft(pipe->user)) && -+ !capable(CAP_SYS_RESOURCE) && !capable(CAP_SYS_ADMIN)) { -+ ret = -EPERM; -+ goto out; - } - ret = pipe_set_size(pipe, nr_pages); - break; -diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c -index 881324c08430..a335e4e6aba1 100644 ---- a/fs/ubifs/file.c -+++ b/fs/ubifs/file.c -@@ -54,6 +54,7 @@ - #include - #include - #include -+#include - - static int read_block(struct inode *inode, void *addr, unsigned int block, - struct ubifs_data_node *dn) -@@ -1422,6 +1423,26 @@ static int ubifs_set_page_dirty(struct page *page) - return ret; - } - -+#ifdef CONFIG_MIGRATION -+static int ubifs_migrate_page(struct address_space *mapping, -+ struct page *newpage, struct page *page, enum migrate_mode mode) -+{ -+ int rc; -+ -+ rc = migrate_page_move_mapping(mapping, newpage, page, NULL, mode); -+ if (rc != MIGRATEPAGE_SUCCESS) -+ return rc; -+ -+ if (PagePrivate(page)) { -+ ClearPagePrivate(page); -+ SetPagePrivate(newpage); -+ } -+ -+ migrate_page_copy(newpage, page); -+ return MIGRATEPAGE_SUCCESS; -+} -+#endif -+ - static int ubifs_releasepage(struct page *page, gfp_t unused_gfp_flags) - { - /* -@@ -1558,6 +1579,9 @@ const struct address_space_operations ubifs_file_address_operations = { - .write_end = ubifs_write_end, - .invalidatepage = ubifs_invalidatepage, - .set_page_dirty = ubifs_set_page_dirty, -+#ifdef CONFIG_MIGRATION -+ .migratepage = ubifs_migrate_page, -+#endif - .releasepage = ubifs_releasepage, - }; - -diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c -index f010ab4594f1..06dec557d247 100644 ---- a/fs/xfs/xfs_inode.c -+++ b/fs/xfs/xfs_inode.c -@@ -2604,13 +2604,14 @@ xfs_iflush_cluster( - * We need to check under the i_flags_lock for a valid inode - * here. Skip it if it is not valid or the wrong inode. - */ -- spin_lock(&ip->i_flags_lock); -- if (!ip->i_ino || -+ spin_lock(&iq->i_flags_lock); -+ if (!iq->i_ino || -+ __xfs_iflags_test(iq, XFS_ISTALE) || - (XFS_INO_TO_AGINO(mp, iq->i_ino) & mask) != first_index) { -- spin_unlock(&ip->i_flags_lock); -+ spin_unlock(&iq->i_flags_lock); - continue; - } -- spin_unlock(&ip->i_flags_lock); -+ spin_unlock(&iq->i_flags_lock); - - /* - * Do an un-protected check to see if the inode is dirty and -@@ -2726,7 +2727,7 @@ xfs_iflush( - struct xfs_buf **bpp) - { - struct xfs_mount *mp = ip->i_mount; -- struct xfs_buf *bp; -+ struct xfs_buf *bp = NULL; - struct xfs_dinode *dip; - int error; - -@@ -2768,14 +2769,22 @@ xfs_iflush( - } - - /* -- * Get the buffer containing the on-disk inode. -+ * Get the buffer containing the on-disk inode. We are doing a try-lock -+ * operation here, so we may get an EAGAIN error. In that case, we -+ * simply want to return with the inode still dirty. -+ * -+ * If we get any other error, we effectively have a corruption situation -+ * and we cannot flush the inode, so we treat it the same as failing -+ * xfs_iflush_int(). - */ - error = xfs_imap_to_bp(mp, NULL, &ip->i_imap, &dip, &bp, XBF_TRYLOCK, - 0); -- if (error || !bp) { -+ if (error == EAGAIN) { - xfs_ifunlock(ip); - return error; - } -+ if (error) -+ goto corrupt_out; - - /* - * First flush out the inode that xfs_iflush was called with. -@@ -2803,7 +2812,8 @@ xfs_iflush( - return 0; - - corrupt_out: -- xfs_buf_relse(bp); -+ if (bp) -+ xfs_buf_relse(bp); - xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE); - cluster_corrupt_out: - error = XFS_ERROR(EFSCORRUPTED); -diff --git a/include/linux/console.h b/include/linux/console.h -index 73bab0f58af5..6877ffc97d8c 100644 ---- a/include/linux/console.h -+++ b/include/linux/console.h -@@ -153,6 +153,7 @@ extern int console_trylock(void); - extern void console_unlock(void); - extern void console_conditional_schedule(void); - extern void console_unblank(void); -+extern void console_flush_on_panic(void); - extern struct tty_driver *console_device(int *); - extern void console_stop(struct console *); - extern void console_start(struct console *); -diff --git a/include/linux/migrate.h b/include/linux/migrate.h -index a405d3dc0f61..e98692748066 100644 ---- a/include/linux/migrate.h -+++ b/include/linux/migrate.h -@@ -55,6 +55,9 @@ extern int migrate_vmas(struct mm_struct *mm, - extern void migrate_page_copy(struct page *newpage, struct page *page); - extern int migrate_huge_page_move_mapping(struct address_space *mapping, - struct page *newpage, struct page *page); -+extern int migrate_page_move_mapping(struct address_space *mapping, -+ struct page *newpage, struct page *page, -+ struct buffer_head *head, enum migrate_mode mode); - #else - - static inline void putback_lru_pages(struct list_head *l) {} -diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h -index dd49566315c6..547a5846e6ac 100644 ---- a/include/linux/netfilter/x_tables.h -+++ b/include/linux/netfilter/x_tables.h -@@ -239,11 +239,18 @@ extern void xt_unregister_match(struct xt_match *target); - extern int xt_register_matches(struct xt_match *match, unsigned int n); - extern void xt_unregister_matches(struct xt_match *match, unsigned int n); - -+int xt_check_entry_offsets(const void *base, const char *elems, -+ unsigned int target_offset, -+ unsigned int next_offset); -+ - extern int xt_check_match(struct xt_mtchk_param *, - unsigned int size, u_int8_t proto, bool inv_proto); - extern int xt_check_target(struct xt_tgchk_param *, - unsigned int size, u_int8_t proto, bool inv_proto); - -+void *xt_copy_counters_from_user(const void __user *user, unsigned int len, -+ struct xt_counters_info *info, bool compat); -+ - extern struct xt_table *xt_register_table(struct net *net, - const struct xt_table *table, - struct xt_table_info *bootstrap, -@@ -423,7 +430,7 @@ extern void xt_compat_init_offsets(u_int8_t af, unsigned int number); - extern int xt_compat_calc_jump(u_int8_t af, unsigned int offset); - - extern int xt_compat_match_offset(const struct xt_match *match); --extern int xt_compat_match_from_user(struct xt_entry_match *m, -+extern void xt_compat_match_from_user(struct xt_entry_match *m, - void **dstptr, unsigned int *size); - extern int xt_compat_match_to_user(const struct xt_entry_match *m, - void __user **dstptr, unsigned int *size); -@@ -433,6 +440,9 @@ extern void xt_compat_target_from_user(struct xt_entry_target *t, - void **dstptr, unsigned int *size); - extern int xt_compat_target_to_user(const struct xt_entry_target *t, - void __user **dstptr, unsigned int *size); -+int xt_compat_check_entry_offsets(const void *base, const char *elems, -+ unsigned int target_offset, -+ unsigned int next_offset); - - #endif /* CONFIG_COMPAT */ - #endif /* _X_TABLES_H */ -diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h -index ab5752692113..b3374f63bc36 100644 ---- a/include/linux/pipe_fs_i.h -+++ b/include/linux/pipe_fs_i.h -@@ -42,6 +42,7 @@ struct pipe_buffer { - * @fasync_readers: reader side fasync - * @fasync_writers: writer side fasync - * @bufs: the circular array of pipe buffers -+ * @user: the user who created this pipe - **/ - struct pipe_inode_info { - struct mutex mutex; -@@ -57,6 +58,7 @@ struct pipe_inode_info { - struct fasync_struct *fasync_readers; - struct fasync_struct *fasync_writers; - struct pipe_buffer *bufs; -+ struct user_struct *user; - }; - - /* -@@ -140,6 +142,8 @@ void pipe_unlock(struct pipe_inode_info *); - void pipe_double_lock(struct pipe_inode_info *, struct pipe_inode_info *); - - extern unsigned int pipe_max_size, pipe_min_size; -+extern unsigned long pipe_user_pages_hard; -+extern unsigned long pipe_user_pages_soft; - int pipe_proc_fn(struct ctl_table *, int, void __user *, size_t *, loff_t *); - - -diff --git a/include/linux/sched.h b/include/linux/sched.h -index 4781332f2e11..7728941e7ddc 100644 ---- a/include/linux/sched.h -+++ b/include/linux/sched.h -@@ -671,6 +671,7 @@ struct user_struct { - #endif - unsigned long locked_shm; /* How many pages of mlocked shm ? */ - unsigned long unix_inflight; /* How many files in flight in unix sockets */ -+ atomic_long_t pipe_bufs; /* how many pages are allocated in pipe buffers */ - - #ifdef CONFIG_KEYS - struct key *uid_keyring; /* UID specific keyring */ -diff --git a/include/linux/usb/ehci_def.h b/include/linux/usb/ehci_def.h -index daec99af5d54..1c88b177cb9c 100644 ---- a/include/linux/usb/ehci_def.h -+++ b/include/linux/usb/ehci_def.h -@@ -178,11 +178,11 @@ struct ehci_regs { - * PORTSCx - */ - /* HOSTPC: offset 0x84 */ -- u32 hostpc[1]; /* HOSTPC extension */ -+ u32 hostpc[0]; /* HOSTPC extension */ - #define HOSTPC_PHCD (1<<22) /* Phy clock disable */ - #define HOSTPC_PSPD (3<<25) /* Port speed detection */ - -- u32 reserved5[16]; -+ u32 reserved5[17]; - - /* USBMODE_EX: offset 0xc8 */ - u32 usbmode_ex; /* USB Device mode extension */ -diff --git a/include/rdma/ib.h b/include/rdma/ib.h -new file mode 100644 -index 000000000000..f09331ad0aba ---- /dev/null -+++ b/include/rdma/ib.h -@@ -0,0 +1,54 @@ -+/* -+ * Copyright (c) 2010 Intel Corporation. All rights reserved. -+ * -+ * This software is available to you under a choice of one of two -+ * licenses. You may choose to be licensed under the terms of the GNU -+ * General Public License (GPL) Version 2, available from the file -+ * COPYING in the main directory of this source tree, or the -+ * OpenIB.org BSD license below: -+ * -+ * Redistribution and use in source and binary forms, with or -+ * without modification, are permitted provided that the following -+ * conditions are met: -+ * -+ * - Redistributions of source code must retain the above -+ * copyright notice, this list of conditions and the following -+ * disclaimer. -+ * -+ * - Redistributions in binary form must reproduce the above -+ * copyright notice, this list of conditions and the following -+ * disclaimer in the documentation and/or other materials -+ * provided with the distribution. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS -+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -+ * SOFTWARE. -+ */ -+ -+#if !defined(_RDMA_IB_H) -+#define _RDMA_IB_H -+ -+#include -+#include -+ -+/* -+ * The IB interfaces that use write() as bi-directional ioctl() are -+ * fundamentally unsafe, since there are lots of ways to trigger "write()" -+ * calls from various contexts with elevated privileges. That includes the -+ * traditional suid executable error message writes, but also various kernel -+ * interfaces that can write to file descriptors. -+ * -+ * This function provides protection for the legacy API by restricting the -+ * calling context. -+ */ -+static inline bool ib_safe_file_access(struct file *filp) -+{ -+ return filp->f_cred == current_cred() && segment_eq(get_fs(), USER_DS); -+} -+ -+#endif /* _RDMA_IB_H */ -diff --git a/kernel/module.c b/kernel/module.c -index f8a4f48b48a9..2c87e521032b 100644 ---- a/kernel/module.c -+++ b/kernel/module.c -@@ -2475,13 +2475,18 @@ static inline void kmemleak_load_module(const struct module *mod, - #endif - - #ifdef CONFIG_MODULE_SIG --static int module_sig_check(struct load_info *info) -+static int module_sig_check(struct load_info *info, int flags) - { - int err = -ENOKEY; - const unsigned long markerlen = sizeof(MODULE_SIG_STRING) - 1; - const void *mod = info->hdr; - -- if (info->len > markerlen && -+ /* -+ * Require flags == 0, as a module with version information -+ * removed is no longer the module that was signed -+ */ -+ if (flags == 0 && -+ info->len > markerlen && - memcmp(mod + info->len - markerlen, MODULE_SIG_STRING, markerlen) == 0) { - /* We truncate the module to discard the signature */ - info->len -= markerlen; -@@ -2503,7 +2508,7 @@ static int module_sig_check(struct load_info *info) - return err; - } - #else /* !CONFIG_MODULE_SIG */ --static int module_sig_check(struct load_info *info) -+static int module_sig_check(struct load_info *info, int flags) - { - return 0; - } -@@ -3228,7 +3233,7 @@ static int load_module(struct load_info *info, const char __user *uargs, - struct module *mod; - long err; - -- err = module_sig_check(info); -+ err = module_sig_check(info, flags); - if (err) - goto free_copy; - -diff --git a/kernel/panic.c b/kernel/panic.c -index 167ec097ce8b..d3d74c4e2258 100644 ---- a/kernel/panic.c -+++ b/kernel/panic.c -@@ -22,6 +22,7 @@ - #include - #include - #include -+#include - - #define PANIC_TIMER_STEP 100 - #define PANIC_BLINK_SPD 18 -@@ -128,6 +129,8 @@ void panic(const char *fmt, ...) - - bust_spinlocks(0); - -+ console_flush_on_panic(); -+ - if (!panic_blink) - panic_blink = no_blink; - -diff --git a/kernel/printk.c b/kernel/printk.c -index fd0154a57d6e..ee8f6be7d8a9 100644 ---- a/kernel/printk.c -+++ b/kernel/printk.c -@@ -2033,13 +2033,24 @@ void console_unlock(void) - static u64 seen_seq; - unsigned long flags; - bool wake_klogd = false; -- bool retry; -+ bool do_cond_resched, retry; - - if (console_suspended) { - up(&console_sem); - return; - } - -+ /* -+ * Console drivers are called under logbuf_lock, so -+ * @console_may_schedule should be cleared before; however, we may -+ * end up dumping a lot of lines, for example, if called from -+ * console registration path, and should invoke cond_resched() -+ * between lines if allowable. Not doing so can cause a very long -+ * scheduling stall on a slow console leading to RCU stall and -+ * softlockup warnings which exacerbate the issue with more -+ * messages practically incapacitating the system. -+ */ -+ do_cond_resched = console_may_schedule; - console_may_schedule = 0; - - /* flush buffered message fragment immediately to console */ -@@ -2096,6 +2107,9 @@ skip: - call_console_drivers(level, text, len); - start_critical_timings(); - local_irq_restore(flags); -+ -+ if (do_cond_resched) -+ cond_resched(); - } - console_locked = 0; - mutex_release(&console_lock_dep_map, 1, _RET_IP_); -@@ -2164,6 +2178,25 @@ void console_unblank(void) - console_unlock(); - } - -+/** -+ * console_flush_on_panic - flush console content on panic -+ * -+ * Immediately output all pending messages no matter what. -+ */ -+void console_flush_on_panic(void) -+{ -+ /* -+ * If someone else is holding the console lock, trylock will fail -+ * and may_schedule may be set. Ignore and proceed to unlock so -+ * that messages are flushed out. As this can be called from any -+ * context and we don't want to get preempted while flushing, -+ * ensure may_schedule is cleared. -+ */ -+ console_trylock(); -+ console_may_schedule = 0; -+ console_unlock(); -+} -+ - /* - * Return the console tty driver structure and its associated index - */ -diff --git a/kernel/signal.c b/kernel/signal.c -index 4d1f7fa3138d..7b81c53b0097 100644 ---- a/kernel/signal.c -+++ b/kernel/signal.c -@@ -3004,11 +3004,9 @@ static int do_rt_sigqueueinfo(pid_t pid, int sig, siginfo_t *info) - * Nor can they impersonate a kill()/tgkill(), which adds source info. - */ - if ((info->si_code >= 0 || info->si_code == SI_TKILL) && -- (task_pid_vnr(current) != pid)) { -- /* We used to allow any < 0 si_code */ -- WARN_ON_ONCE(info->si_code < 0); -+ (task_pid_vnr(current) != pid)) - return -EPERM; -- } -+ - info->si_signo = sig; - - /* POSIX.1b doesn't mention process groups. */ -@@ -3053,12 +3051,10 @@ static int do_rt_tgsigqueueinfo(pid_t tgid, pid_t pid, int sig, siginfo_t *info) - /* Not even root can pretend to send signals from the kernel. - * Nor can they impersonate a kill()/tgkill(), which adds source info. - */ -- if (((info->si_code >= 0 || info->si_code == SI_TKILL)) && -- (task_pid_vnr(current) != pid)) { -- /* We used to allow any < 0 si_code */ -- WARN_ON_ONCE(info->si_code < 0); -+ if ((info->si_code >= 0 || info->si_code == SI_TKILL) && -+ (task_pid_vnr(current) != pid)) - return -EPERM; -- } -+ - info->si_signo = sig; - - return do_send_specific(tgid, pid, sig, info); -diff --git a/kernel/sysctl.c b/kernel/sysctl.c -index 9469f4c61a30..4fd49fe1046d 100644 ---- a/kernel/sysctl.c -+++ b/kernel/sysctl.c -@@ -1632,6 +1632,20 @@ static struct ctl_table fs_table[] = { - .proc_handler = &pipe_proc_fn, - .extra1 = &pipe_min_size, - }, -+ { -+ .procname = "pipe-user-pages-hard", -+ .data = &pipe_user_pages_hard, -+ .maxlen = sizeof(pipe_user_pages_hard), -+ .mode = 0644, -+ .proc_handler = proc_doulongvec_minmax, -+ }, -+ { -+ .procname = "pipe-user-pages-soft", -+ .data = &pipe_user_pages_soft, -+ .maxlen = sizeof(pipe_user_pages_soft), -+ .mode = 0644, -+ .proc_handler = proc_doulongvec_minmax, -+ }, - { } - }; - -diff --git a/kernel/trace/trace_printk.c b/kernel/trace/trace_printk.c -index fdb23e84b011..7be4d67cecbd 100644 ---- a/kernel/trace/trace_printk.c -+++ b/kernel/trace/trace_printk.c -@@ -38,6 +38,10 @@ struct trace_bprintk_fmt { - static inline struct trace_bprintk_fmt *lookup_format(const char *fmt) - { - struct trace_bprintk_fmt *pos; -+ -+ if (!fmt) -+ return ERR_PTR(-EINVAL); -+ - list_for_each_entry(pos, &trace_bprintk_fmt_list, list) { - if (!strcmp(pos->fmt, fmt)) - return pos; -@@ -59,7 +63,8 @@ void hold_module_trace_bprintk_format(const char **start, const char **end) - for (iter = start; iter < end; iter++) { - struct trace_bprintk_fmt *tb_fmt = lookup_format(*iter); - if (tb_fmt) { -- *iter = tb_fmt->fmt; -+ if (!IS_ERR(tb_fmt)) -+ *iter = tb_fmt->fmt; - continue; - } - -diff --git a/lib/dma-debug.c b/lib/dma-debug.c -index eb43517bf261..c32437f6be61 100644 ---- a/lib/dma-debug.c -+++ b/lib/dma-debug.c -@@ -445,9 +445,9 @@ static struct dma_debug_entry *dma_entry_alloc(void) - spin_lock_irqsave(&free_entries_lock, flags); - - if (list_empty(&free_entries)) { -- pr_err("DMA-API: debugging out of memory - disabling\n"); - global_disable = true; - spin_unlock_irqrestore(&free_entries_lock, flags); -+ pr_err("DMA-API: debugging out of memory - disabling\n"); - return NULL; - } - -diff --git a/mm/migrate.c b/mm/migrate.c -index a88c12f2235d..808f8abb1b8f 100644 ---- a/mm/migrate.c -+++ b/mm/migrate.c -@@ -30,6 +30,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -307,10 +308,12 @@ static inline bool buffer_migrate_lock_buffers(struct buffer_head *head, - * 2 for pages with a mapping - * 3 for pages with a mapping and PagePrivate/PagePrivate2 set. - */ --static int migrate_page_move_mapping(struct address_space *mapping, -+int migrate_page_move_mapping(struct address_space *mapping, - struct page *newpage, struct page *page, - struct buffer_head *head, enum migrate_mode mode) - { -+ struct zone *oldzone, *newzone; -+ int dirty; - int expected_count = 0; - void **pslot; - -@@ -321,6 +324,9 @@ static int migrate_page_move_mapping(struct address_space *mapping, - return MIGRATEPAGE_SUCCESS; - } - -+ oldzone = page_zone(page); -+ newzone = page_zone(newpage); -+ - spin_lock_irq(&mapping->tree_lock); - - pslot = radix_tree_lookup_slot(&mapping->page_tree, -@@ -361,6 +367,13 @@ static int migrate_page_move_mapping(struct address_space *mapping, - set_page_private(newpage, page_private(page)); - } - -+ /* Move dirty while page refs frozen and newpage not yet exposed */ -+ dirty = PageDirty(page); -+ if (dirty) { -+ ClearPageDirty(page); -+ SetPageDirty(newpage); -+ } -+ - radix_tree_replace_slot(pslot, newpage); - - /* -@@ -370,6 +383,9 @@ static int migrate_page_move_mapping(struct address_space *mapping, - */ - page_unfreeze_refs(page, expected_count - 1); - -+ spin_unlock(&mapping->tree_lock); -+ /* Leave irq disabled to prevent preemption while updating stats */ -+ - /* - * If moved to a different zone then also account - * the page for that zone. Other VM counters will be -@@ -380,16 +396,23 @@ static int migrate_page_move_mapping(struct address_space *mapping, - * via NR_FILE_PAGES and NR_ANON_PAGES if they - * are mapped to swap space. - */ -- __dec_zone_page_state(page, NR_FILE_PAGES); -- __inc_zone_page_state(newpage, NR_FILE_PAGES); -- if (!PageSwapCache(page) && PageSwapBacked(page)) { -- __dec_zone_page_state(page, NR_SHMEM); -- __inc_zone_page_state(newpage, NR_SHMEM); -+ if (newzone != oldzone) { -+ __dec_zone_state(oldzone, NR_FILE_PAGES); -+ __inc_zone_state(newzone, NR_FILE_PAGES); -+ if (PageSwapBacked(page) && !PageSwapCache(page)) { -+ __dec_zone_state(oldzone, NR_SHMEM); -+ __inc_zone_state(newzone, NR_SHMEM); -+ } -+ if (dirty && mapping_cap_account_dirty(mapping)) { -+ __dec_zone_state(oldzone, NR_FILE_DIRTY); -+ __inc_zone_state(newzone, NR_FILE_DIRTY); -+ } - } -- spin_unlock_irq(&mapping->tree_lock); -+ local_irq_enable(); - - return MIGRATEPAGE_SUCCESS; - } -+EXPORT_SYMBOL(migrate_page_move_mapping); - - /* - * The expected number of remaining references is the same as that -@@ -460,20 +483,9 @@ void migrate_page_copy(struct page *newpage, struct page *page) - if (PageMappedToDisk(page)) - SetPageMappedToDisk(newpage); - -- if (PageDirty(page)) { -- clear_page_dirty_for_io(page); -- /* -- * Want to mark the page and the radix tree as dirty, and -- * redo the accounting that clear_page_dirty_for_io undid, -- * but we can't use set_page_dirty because that function -- * is actually a signal that all of the page has become dirty. -- * Whereas only part of our page may be dirty. -- */ -- if (PageSwapBacked(page)) -- SetPageDirty(newpage); -- else -- __set_page_dirty_nobuffers(newpage); -- } -+ /* Move dirty on pages not done by migrate_page_move_mapping() */ -+ if (PageDirty(page)) -+ SetPageDirty(newpage); - - mlock_migrate_page(newpage, page); - ksm_migrate_page(newpage, page); -@@ -492,6 +504,7 @@ void migrate_page_copy(struct page *newpage, struct page *page) - if (PageWriteback(newpage)) - end_page_writeback(newpage); - } -+EXPORT_SYMBOL(migrate_page_copy); - - /************************************************************ - * Migration functions -diff --git a/mm/shmem.c b/mm/shmem.c -index 4e4a7349c5cd..cc02b6c6eec4 100644 ---- a/mm/shmem.c -+++ b/mm/shmem.c -@@ -1948,9 +1948,11 @@ static long shmem_fallocate(struct file *file, int mode, loff_t offset, - NULL); - if (error) { - /* Remove the !PageUptodate pages we added */ -- shmem_undo_range(inode, -- (loff_t)start << PAGE_CACHE_SHIFT, -- (loff_t)index << PAGE_CACHE_SHIFT, true); -+ if (index > start) { -+ shmem_undo_range(inode, -+ (loff_t)start << PAGE_CACHE_SHIFT, -+ ((loff_t)index << PAGE_CACHE_SHIFT) - 1, true); -+ } - goto undone; - } - -diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c -index 5f36f70ce44d..4b966c6c0145 100644 ---- a/net/bluetooth/l2cap_sock.c -+++ b/net/bluetooth/l2cap_sock.c -@@ -725,7 +725,7 @@ static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname, - break; - } - -- if (get_user(opt, (u32 __user *) optval)) { -+ if (get_user(opt, (u16 __user *) optval)) { - err = -EFAULT; - break; - } -diff --git a/net/ceph/osdmap.c b/net/ceph/osdmap.c -index 7ec4e0522215..c1de8d404c47 100644 ---- a/net/ceph/osdmap.c -+++ b/net/ceph/osdmap.c -@@ -798,6 +798,110 @@ bad: - } - - /* -+ * Encoding order is (new_up_client, new_state, new_weight). Need to -+ * apply in the (new_weight, new_state, new_up_client) order, because -+ * an incremental map may look like e.g. -+ * -+ * new_up_client: { osd=6, addr=... } # set osd_state and addr -+ * new_state: { osd=6, xorstate=EXISTS } # clear osd_state -+ */ -+static int decode_new_up_state_weight(void **p, void *end, -+ struct ceph_osdmap *map) -+{ -+ void *new_up_client; -+ void *new_state; -+ void *new_weight_end; -+ u32 len; -+ -+ new_up_client = *p; -+ ceph_decode_32_safe(p, end, len, e_inval); -+ len *= sizeof(u32) + sizeof(struct ceph_entity_addr); -+ ceph_decode_need(p, end, len, e_inval); -+ *p += len; -+ -+ new_state = *p; -+ ceph_decode_32_safe(p, end, len, e_inval); -+ len *= sizeof(u32) + sizeof(u8); -+ ceph_decode_need(p, end, len, e_inval); -+ *p += len; -+ -+ /* new_weight */ -+ ceph_decode_32_safe(p, end, len, e_inval); -+ while (len--) { -+ s32 osd; -+ u32 w; -+ -+ ceph_decode_need(p, end, 2*sizeof(u32), e_inval); -+ osd = ceph_decode_32(p); -+ w = ceph_decode_32(p); -+ BUG_ON(osd >= map->max_osd); -+ pr_info("osd%d weight 0x%x %s\n", osd, w, -+ w == CEPH_OSD_IN ? "(in)" : -+ (w == CEPH_OSD_OUT ? "(out)" : "")); -+ map->osd_weight[osd] = w; -+ -+ /* -+ * If we are marking in, set the EXISTS, and clear the -+ * AUTOOUT and NEW bits. -+ */ -+ if (w) { -+ map->osd_state[osd] |= CEPH_OSD_EXISTS; -+ map->osd_state[osd] &= ~(CEPH_OSD_AUTOOUT | -+ CEPH_OSD_NEW); -+ } -+ } -+ new_weight_end = *p; -+ -+ /* new_state (up/down) */ -+ *p = new_state; -+ len = ceph_decode_32(p); -+ while (len--) { -+ s32 osd; -+ u8 xorstate; -+ -+ osd = ceph_decode_32(p); -+ xorstate = ceph_decode_8(p); -+ if (xorstate == 0) -+ xorstate = CEPH_OSD_UP; -+ BUG_ON(osd >= map->max_osd); -+ if ((map->osd_state[osd] & CEPH_OSD_UP) && -+ (xorstate & CEPH_OSD_UP)) -+ pr_info("osd%d down\n", osd); -+ if ((map->osd_state[osd] & CEPH_OSD_EXISTS) && -+ (xorstate & CEPH_OSD_EXISTS)) { -+ pr_info("osd%d does not exist\n", osd); -+ map->osd_weight[osd] = CEPH_OSD_IN; -+ memset(map->osd_addr + osd, 0, sizeof(*map->osd_addr)); -+ map->osd_state[osd] = 0; -+ } else { -+ map->osd_state[osd] ^= xorstate; -+ } -+ } -+ -+ /* new_up_client */ -+ *p = new_up_client; -+ len = ceph_decode_32(p); -+ while (len--) { -+ s32 osd; -+ struct ceph_entity_addr addr; -+ -+ osd = ceph_decode_32(p); -+ ceph_decode_copy(p, &addr, sizeof(addr)); -+ ceph_decode_addr(&addr); -+ BUG_ON(osd >= map->max_osd); -+ pr_info("osd%d up\n", osd); -+ map->osd_state[osd] |= CEPH_OSD_EXISTS | CEPH_OSD_UP; -+ map->osd_addr[osd] = addr; -+ } -+ -+ *p = new_weight_end; -+ return 0; -+ -+e_inval: -+ return -EINVAL; -+} -+ -+/* - * decode and apply an incremental map update. - */ - struct ceph_osdmap *osdmap_apply_incremental(void **p, void *end, -@@ -912,50 +1016,10 @@ struct ceph_osdmap *osdmap_apply_incremental(void **p, void *end, - __remove_pg_pool(&map->pg_pools, pi); - } - -- /* new_up */ -- err = -EINVAL; -- ceph_decode_32_safe(p, end, len, bad); -- while (len--) { -- u32 osd; -- struct ceph_entity_addr addr; -- ceph_decode_32_safe(p, end, osd, bad); -- ceph_decode_copy_safe(p, end, &addr, sizeof(addr), bad); -- ceph_decode_addr(&addr); -- pr_info("osd%d up\n", osd); -- BUG_ON(osd >= map->max_osd); -- map->osd_state[osd] |= CEPH_OSD_UP; -- map->osd_addr[osd] = addr; -- } -- -- /* new_state */ -- ceph_decode_32_safe(p, end, len, bad); -- while (len--) { -- u32 osd; -- u8 xorstate; -- ceph_decode_32_safe(p, end, osd, bad); -- xorstate = **(u8 **)p; -- (*p)++; /* clean flag */ -- if (xorstate == 0) -- xorstate = CEPH_OSD_UP; -- if (xorstate & CEPH_OSD_UP) -- pr_info("osd%d down\n", osd); -- if (osd < map->max_osd) -- map->osd_state[osd] ^= xorstate; -- } -- -- /* new_weight */ -- ceph_decode_32_safe(p, end, len, bad); -- while (len--) { -- u32 osd, off; -- ceph_decode_need(p, end, sizeof(u32)*2, bad); -- osd = ceph_decode_32(p); -- off = ceph_decode_32(p); -- pr_info("osd%d weight 0x%x %s\n", osd, off, -- off == CEPH_OSD_IN ? "(in)" : -- (off == CEPH_OSD_OUT ? "(out)" : "")); -- if (osd < map->max_osd) -- map->osd_weight[osd] = off; -- } -+ /* new_up_client, new_state, new_weight */ -+ err = decode_new_up_state_weight(p, end, map); -+ if (err) -+ goto bad; - - /* new_pg_temp */ - ceph_decode_32_safe(p, end, len, bad); -diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c -index b31553d385bb..89570f070e0e 100644 ---- a/net/ipv4/ipmr.c -+++ b/net/ipv4/ipmr.c -@@ -881,8 +881,10 @@ static struct mfc_cache *ipmr_cache_alloc(void) - { - struct mfc_cache *c = kmem_cache_zalloc(mrt_cachep, GFP_KERNEL); - -- if (c) -+ if (c) { -+ c->mfc_un.res.last_assert = jiffies - MFC_ASSERT_THRESH - 1; - c->mfc_un.res.minvif = MAXVIFS; -+ } - return c; - } - -diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c -index c8abe31961ed..95a5f261fe8a 100644 ---- a/net/ipv4/netfilter/arp_tables.c -+++ b/net/ipv4/netfilter/arp_tables.c -@@ -350,11 +350,12 @@ unsigned int arpt_do_table(struct sk_buff *skb, - } - - /* All zeroes == unconditional rule. */ --static inline bool unconditional(const struct arpt_arp *arp) -+static inline bool unconditional(const struct arpt_entry *e) - { - static const struct arpt_arp uncond; - -- return memcmp(arp, &uncond, sizeof(uncond)) == 0; -+ return e->target_offset == sizeof(struct arpt_entry) && -+ memcmp(&e->arp, &uncond, sizeof(uncond)) == 0; - } - - /* Figures out from what hook each rule can be called: returns 0 if -@@ -393,11 +394,10 @@ static int mark_source_chains(const struct xt_table_info *newinfo, - |= ((1 << hook) | (1 << NF_ARP_NUMHOOKS)); - - /* Unconditional return/END. */ -- if ((e->target_offset == sizeof(struct arpt_entry) && -+ if ((unconditional(e) && - (strcmp(t->target.u.user.name, - XT_STANDARD_TARGET) == 0) && -- t->verdict < 0 && unconditional(&e->arp)) || -- visited) { -+ t->verdict < 0) || visited) { - unsigned int oldpos, size; - - if ((strcmp(t->target.u.user.name, -@@ -430,6 +430,8 @@ static int mark_source_chains(const struct xt_table_info *newinfo, - size = e->next_offset; - e = (struct arpt_entry *) - (entry0 + pos + size); -+ if (pos + size >= newinfo->size) -+ return 0; - e->counters.pcnt = pos; - pos += size; - } else { -@@ -452,6 +454,8 @@ static int mark_source_chains(const struct xt_table_info *newinfo, - } else { - /* ... this is a fallthru */ - newpos = pos + e->next_offset; -+ if (newpos >= newinfo->size) -+ return 0; - } - e = (struct arpt_entry *) - (entry0 + newpos); -@@ -465,25 +469,6 @@ static int mark_source_chains(const struct xt_table_info *newinfo, - return 1; - } - --static inline int check_entry(const struct arpt_entry *e, const char *name) --{ -- const struct xt_entry_target *t; -- -- if (!arp_checkentry(&e->arp)) { -- duprintf("arp_tables: arp check failed %p %s.\n", e, name); -- return -EINVAL; -- } -- -- if (e->target_offset + sizeof(struct xt_entry_target) > e->next_offset) -- return -EINVAL; -- -- t = arpt_get_target_c(e); -- if (e->target_offset + t->u.target_size > e->next_offset) -- return -EINVAL; -- -- return 0; --} -- - static inline int check_target(struct arpt_entry *e, const char *name) - { - struct xt_entry_target *t = arpt_get_target(e); -@@ -513,10 +498,6 @@ find_check_entry(struct arpt_entry *e, const char *name, unsigned int size) - struct xt_target *target; - int ret; - -- ret = check_entry(e, name); -- if (ret) -- return ret; -- - t = arpt_get_target(e); - target = xt_request_find_target(NFPROTO_ARP, t->u.user.name, - t->u.user.revision); -@@ -542,7 +523,7 @@ static bool check_underflow(const struct arpt_entry *e) - const struct xt_entry_target *t; - unsigned int verdict; - -- if (!unconditional(&e->arp)) -+ if (!unconditional(e)) - return false; - t = arpt_get_target_c(e); - if (strcmp(t->u.user.name, XT_STANDARD_TARGET) != 0) -@@ -561,9 +542,11 @@ static inline int check_entry_size_and_hooks(struct arpt_entry *e, - unsigned int valid_hooks) - { - unsigned int h; -+ int err; - - if ((unsigned long)e % __alignof__(struct arpt_entry) != 0 || -- (unsigned char *)e + sizeof(struct arpt_entry) >= limit) { -+ (unsigned char *)e + sizeof(struct arpt_entry) >= limit || -+ (unsigned char *)e + e->next_offset > limit) { - duprintf("Bad offset %p\n", e); - return -EINVAL; - } -@@ -575,6 +558,14 @@ static inline int check_entry_size_and_hooks(struct arpt_entry *e, - return -EINVAL; - } - -+ if (!arp_checkentry(&e->arp)) -+ return -EINVAL; -+ -+ err = xt_check_entry_offsets(e, e->elems, e->target_offset, -+ e->next_offset); -+ if (err) -+ return err; -+ - /* Check hooks & underflows */ - for (h = 0; h < NF_ARP_NUMHOOKS; h++) { - if (!(valid_hooks & (1 << h))) -@@ -583,9 +574,9 @@ static inline int check_entry_size_and_hooks(struct arpt_entry *e, - newinfo->hook_entry[h] = hook_entries[h]; - if ((unsigned char *)e - base == underflows[h]) { - if (!check_underflow(e)) { -- pr_err("Underflows must be unconditional and " -- "use the STANDARD target with " -- "ACCEPT/DROP\n"); -+ pr_debug("Underflows must be unconditional and " -+ "use the STANDARD target with " -+ "ACCEPT/DROP\n"); - return -EINVAL; - } - newinfo->underflow[h] = underflows[h]; -@@ -675,10 +666,8 @@ static int translate_table(struct xt_table_info *newinfo, void *entry0, - } - } - -- if (!mark_source_chains(newinfo, repl->valid_hooks, entry0)) { -- duprintf("Looping hook\n"); -+ if (!mark_source_chains(newinfo, repl->valid_hooks, entry0)) - return -ELOOP; -- } - - /* Finally, each sanity check must pass */ - i = 0; -@@ -1071,6 +1060,9 @@ static int do_replace(struct net *net, const void __user *user, - /* overflow check */ - if (tmp.num_counters >= INT_MAX / sizeof(struct xt_counters)) - return -ENOMEM; -+ if (tmp.num_counters == 0) -+ return -EINVAL; -+ - tmp.name[sizeof(tmp.name)-1] = 0; - - newinfo = xt_alloc_table_info(tmp.size); -@@ -1111,56 +1103,18 @@ static int do_add_counters(struct net *net, const void __user *user, - unsigned int i, curcpu; - struct xt_counters_info tmp; - struct xt_counters *paddc; -- unsigned int num_counters; -- const char *name; -- int size; -- void *ptmp; - struct xt_table *t; - const struct xt_table_info *private; - int ret = 0; - void *loc_cpu_entry; - struct arpt_entry *iter; - unsigned int addend; --#ifdef CONFIG_COMPAT -- struct compat_xt_counters_info compat_tmp; -- -- if (compat) { -- ptmp = &compat_tmp; -- size = sizeof(struct compat_xt_counters_info); -- } else --#endif -- { -- ptmp = &tmp; -- size = sizeof(struct xt_counters_info); -- } - -- if (copy_from_user(ptmp, user, size) != 0) -- return -EFAULT; -+ paddc = xt_copy_counters_from_user(user, len, &tmp, compat); -+ if (IS_ERR(paddc)) -+ return PTR_ERR(paddc); - --#ifdef CONFIG_COMPAT -- if (compat) { -- num_counters = compat_tmp.num_counters; -- name = compat_tmp.name; -- } else --#endif -- { -- num_counters = tmp.num_counters; -- name = tmp.name; -- } -- -- if (len != size + num_counters * sizeof(struct xt_counters)) -- return -EINVAL; -- -- paddc = vmalloc(len - size); -- if (!paddc) -- return -ENOMEM; -- -- if (copy_from_user(paddc, user + size, len - size) != 0) { -- ret = -EFAULT; -- goto free; -- } -- -- t = xt_find_table_lock(net, NFPROTO_ARP, name); -+ t = xt_find_table_lock(net, NFPROTO_ARP, tmp.name); - if (IS_ERR_OR_NULL(t)) { - ret = t ? PTR_ERR(t) : -ENOENT; - goto free; -@@ -1168,7 +1122,7 @@ static int do_add_counters(struct net *net, const void __user *user, - - local_bh_disable(); - private = t->private; -- if (private->number != num_counters) { -+ if (private->number != tmp.num_counters) { - ret = -EINVAL; - goto unlock_up_free; - } -@@ -1194,6 +1148,18 @@ static int do_add_counters(struct net *net, const void __user *user, - } - - #ifdef CONFIG_COMPAT -+struct compat_arpt_replace { -+ char name[XT_TABLE_MAXNAMELEN]; -+ u32 valid_hooks; -+ u32 num_entries; -+ u32 size; -+ u32 hook_entry[NF_ARP_NUMHOOKS]; -+ u32 underflow[NF_ARP_NUMHOOKS]; -+ u32 num_counters; -+ compat_uptr_t counters; -+ struct compat_arpt_entry entries[0]; -+}; -+ - static inline void compat_release_entry(struct compat_arpt_entry *e) - { - struct xt_entry_target *t; -@@ -1202,24 +1168,22 @@ static inline void compat_release_entry(struct compat_arpt_entry *e) - module_put(t->u.kernel.target->me); - } - --static inline int -+static int - check_compat_entry_size_and_hooks(struct compat_arpt_entry *e, - struct xt_table_info *newinfo, - unsigned int *size, - const unsigned char *base, -- const unsigned char *limit, -- const unsigned int *hook_entries, -- const unsigned int *underflows, -- const char *name) -+ const unsigned char *limit) - { - struct xt_entry_target *t; - struct xt_target *target; - unsigned int entry_offset; -- int ret, off, h; -+ int ret, off; - - duprintf("check_compat_entry_size_and_hooks %p\n", e); - if ((unsigned long)e % __alignof__(struct compat_arpt_entry) != 0 || -- (unsigned char *)e + sizeof(struct compat_arpt_entry) >= limit) { -+ (unsigned char *)e + sizeof(struct compat_arpt_entry) >= limit || -+ (unsigned char *)e + e->next_offset > limit) { - duprintf("Bad offset %p, limit = %p\n", e, limit); - return -EINVAL; - } -@@ -1231,8 +1195,11 @@ check_compat_entry_size_and_hooks(struct compat_arpt_entry *e, - return -EINVAL; - } - -- /* For purposes of check_entry casting the compat entry is fine */ -- ret = check_entry((struct arpt_entry *)e, name); -+ if (!arp_checkentry(&e->arp)) -+ return -EINVAL; -+ -+ ret = xt_compat_check_entry_offsets(e, e->elems, e->target_offset, -+ e->next_offset); - if (ret) - return ret; - -@@ -1256,17 +1223,6 @@ check_compat_entry_size_and_hooks(struct compat_arpt_entry *e, - if (ret) - goto release_target; - -- /* Check hooks & underflows */ -- for (h = 0; h < NF_ARP_NUMHOOKS; h++) { -- if ((unsigned char *)e - base == hook_entries[h]) -- newinfo->hook_entry[h] = hook_entries[h]; -- if ((unsigned char *)e - base == underflows[h]) -- newinfo->underflow[h] = underflows[h]; -- } -- -- /* Clear counters and comefrom */ -- memset(&e->counters, 0, sizeof(e->counters)); -- e->comefrom = 0; - return 0; - - release_target: -@@ -1275,18 +1231,17 @@ out: - return ret; - } - --static int -+static void - compat_copy_entry_from_user(struct compat_arpt_entry *e, void **dstptr, -- unsigned int *size, const char *name, -+ unsigned int *size, - struct xt_table_info *newinfo, unsigned char *base) - { - struct xt_entry_target *t; - struct xt_target *target; - struct arpt_entry *de; - unsigned int origsize; -- int ret, h; -+ int h; - -- ret = 0; - origsize = *size; - de = (struct arpt_entry *)*dstptr; - memcpy(de, e, sizeof(struct arpt_entry)); -@@ -1307,144 +1262,81 @@ compat_copy_entry_from_user(struct compat_arpt_entry *e, void **dstptr, - if ((unsigned char *)de - base < newinfo->underflow[h]) - newinfo->underflow[h] -= origsize - *size; - } -- return ret; - } - --static int translate_compat_table(const char *name, -- unsigned int valid_hooks, -- struct xt_table_info **pinfo, -+static int translate_compat_table(struct xt_table_info **pinfo, - void **pentry0, -- unsigned int total_size, -- unsigned int number, -- unsigned int *hook_entries, -- unsigned int *underflows) -+ const struct compat_arpt_replace *compatr) - { - unsigned int i, j; - struct xt_table_info *newinfo, *info; - void *pos, *entry0, *entry1; - struct compat_arpt_entry *iter0; -- struct arpt_entry *iter1; -+ struct arpt_replace repl; - unsigned int size; - int ret = 0; - - info = *pinfo; - entry0 = *pentry0; -- size = total_size; -- info->number = number; -- -- /* Init all hooks to impossible value. */ -- for (i = 0; i < NF_ARP_NUMHOOKS; i++) { -- info->hook_entry[i] = 0xFFFFFFFF; -- info->underflow[i] = 0xFFFFFFFF; -- } -+ size = compatr->size; -+ info->number = compatr->num_entries; - - duprintf("translate_compat_table: size %u\n", info->size); - j = 0; - xt_compat_lock(NFPROTO_ARP); -- xt_compat_init_offsets(NFPROTO_ARP, number); -+ xt_compat_init_offsets(NFPROTO_ARP, compatr->num_entries); - /* Walk through entries, checking offsets. */ -- xt_entry_foreach(iter0, entry0, total_size) { -+ xt_entry_foreach(iter0, entry0, compatr->size) { - ret = check_compat_entry_size_and_hooks(iter0, info, &size, - entry0, -- entry0 + total_size, -- hook_entries, -- underflows, -- name); -+ entry0 + compatr->size); - if (ret != 0) - goto out_unlock; - ++j; - } - - ret = -EINVAL; -- if (j != number) { -+ if (j != compatr->num_entries) { - duprintf("translate_compat_table: %u not %u entries\n", -- j, number); -+ j, compatr->num_entries); - goto out_unlock; - } - -- /* Check hooks all assigned */ -- for (i = 0; i < NF_ARP_NUMHOOKS; i++) { -- /* Only hooks which are valid */ -- if (!(valid_hooks & (1 << i))) -- continue; -- if (info->hook_entry[i] == 0xFFFFFFFF) { -- duprintf("Invalid hook entry %u %u\n", -- i, hook_entries[i]); -- goto out_unlock; -- } -- if (info->underflow[i] == 0xFFFFFFFF) { -- duprintf("Invalid underflow %u %u\n", -- i, underflows[i]); -- goto out_unlock; -- } -- } -- - ret = -ENOMEM; - newinfo = xt_alloc_table_info(size); - if (!newinfo) - goto out_unlock; - -- newinfo->number = number; -+ newinfo->number = compatr->num_entries; - for (i = 0; i < NF_ARP_NUMHOOKS; i++) { - newinfo->hook_entry[i] = info->hook_entry[i]; - newinfo->underflow[i] = info->underflow[i]; - } - entry1 = newinfo->entries[raw_smp_processor_id()]; - pos = entry1; -- size = total_size; -- xt_entry_foreach(iter0, entry0, total_size) { -- ret = compat_copy_entry_from_user(iter0, &pos, &size, -- name, newinfo, entry1); -- if (ret != 0) -- break; -- } -+ size = compatr->size; -+ xt_entry_foreach(iter0, entry0, compatr->size) -+ compat_copy_entry_from_user(iter0, &pos, &size, -+ newinfo, entry1); -+ -+ /* all module references in entry0 are now gone */ -+ - xt_compat_flush_offsets(NFPROTO_ARP); - xt_compat_unlock(NFPROTO_ARP); -- if (ret) -- goto free_newinfo; - -- ret = -ELOOP; -- if (!mark_source_chains(newinfo, valid_hooks, entry1)) -- goto free_newinfo; -+ memcpy(&repl, compatr, sizeof(*compatr)); - -- i = 0; -- xt_entry_foreach(iter1, entry1, newinfo->size) { -- ret = check_target(iter1, name); -- if (ret != 0) -- break; -- ++i; -- if (strcmp(arpt_get_target(iter1)->u.user.name, -- XT_ERROR_TARGET) == 0) -- ++newinfo->stacksize; -- } -- if (ret) { -- /* -- * The first i matches need cleanup_entry (calls ->destroy) -- * because they had called ->check already. The other j-i -- * entries need only release. -- */ -- int skip = i; -- j -= i; -- xt_entry_foreach(iter0, entry0, newinfo->size) { -- if (skip-- > 0) -- continue; -- if (j-- == 0) -- break; -- compat_release_entry(iter0); -- } -- xt_entry_foreach(iter1, entry1, newinfo->size) { -- if (i-- == 0) -- break; -- cleanup_entry(iter1); -- } -- xt_free_table_info(newinfo); -- return ret; -+ for (i = 0; i < NF_ARP_NUMHOOKS; i++) { -+ repl.hook_entry[i] = newinfo->hook_entry[i]; -+ repl.underflow[i] = newinfo->underflow[i]; - } - -- /* And one copy for every other CPU */ -- for_each_possible_cpu(i) -- if (newinfo->entries[i] && newinfo->entries[i] != entry1) -- memcpy(newinfo->entries[i], entry1, newinfo->size); -+ repl.num_counters = 0; -+ repl.counters = NULL; -+ repl.size = newinfo->size; -+ ret = translate_table(newinfo, entry1, &repl); -+ if (ret) -+ goto free_newinfo; - - *pinfo = newinfo; - *pentry0 = entry1; -@@ -1453,31 +1345,18 @@ static int translate_compat_table(const char *name, - - free_newinfo: - xt_free_table_info(newinfo); --out: -- xt_entry_foreach(iter0, entry0, total_size) { -+ return ret; -+out_unlock: -+ xt_compat_flush_offsets(NFPROTO_ARP); -+ xt_compat_unlock(NFPROTO_ARP); -+ xt_entry_foreach(iter0, entry0, compatr->size) { - if (j-- == 0) - break; - compat_release_entry(iter0); - } - return ret; --out_unlock: -- xt_compat_flush_offsets(NFPROTO_ARP); -- xt_compat_unlock(NFPROTO_ARP); -- goto out; - } - --struct compat_arpt_replace { -- char name[XT_TABLE_MAXNAMELEN]; -- u32 valid_hooks; -- u32 num_entries; -- u32 size; -- u32 hook_entry[NF_ARP_NUMHOOKS]; -- u32 underflow[NF_ARP_NUMHOOKS]; -- u32 num_counters; -- compat_uptr_t counters; -- struct compat_arpt_entry entries[0]; --}; -- - static int compat_do_replace(struct net *net, void __user *user, - unsigned int len) - { -@@ -1495,6 +1374,9 @@ static int compat_do_replace(struct net *net, void __user *user, - return -ENOMEM; - if (tmp.num_counters >= INT_MAX / sizeof(struct xt_counters)) - return -ENOMEM; -+ if (tmp.num_counters == 0) -+ return -EINVAL; -+ - tmp.name[sizeof(tmp.name)-1] = 0; - - newinfo = xt_alloc_table_info(tmp.size); -@@ -1508,10 +1390,7 @@ static int compat_do_replace(struct net *net, void __user *user, - goto free_newinfo; - } - -- ret = translate_compat_table(tmp.name, tmp.valid_hooks, -- &newinfo, &loc_cpu_entry, tmp.size, -- tmp.num_entries, tmp.hook_entry, -- tmp.underflow); -+ ret = translate_compat_table(&newinfo, &loc_cpu_entry, &tmp); - if (ret != 0) - goto free_newinfo; - -diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c -index 651c10774d58..92c8f2727ee9 100644 ---- a/net/ipv4/netfilter/ip_tables.c -+++ b/net/ipv4/netfilter/ip_tables.c -@@ -168,11 +168,12 @@ get_entry(const void *base, unsigned int offset) - - /* All zeroes == unconditional rule. */ - /* Mildly perf critical (only if packet tracing is on) */ --static inline bool unconditional(const struct ipt_ip *ip) -+static inline bool unconditional(const struct ipt_entry *e) - { - static const struct ipt_ip uncond; - -- return memcmp(ip, &uncond, sizeof(uncond)) == 0; -+ return e->target_offset == sizeof(struct ipt_entry) && -+ memcmp(&e->ip, &uncond, sizeof(uncond)) == 0; - #undef FWINV - } - -@@ -229,11 +230,10 @@ get_chainname_rulenum(const struct ipt_entry *s, const struct ipt_entry *e, - } else if (s == e) { - (*rulenum)++; - -- if (s->target_offset == sizeof(struct ipt_entry) && -+ if (unconditional(s) && - strcmp(t->target.u.kernel.target->name, - XT_STANDARD_TARGET) == 0 && -- t->verdict < 0 && -- unconditional(&s->ip)) { -+ t->verdict < 0) { - /* Tail of chains: STANDARD target (return/policy) */ - *comment = *chainname == hookname - ? comments[NF_IP_TRACE_COMMENT_POLICY] -@@ -467,11 +467,10 @@ mark_source_chains(const struct xt_table_info *newinfo, - e->comefrom |= ((1 << hook) | (1 << NF_INET_NUMHOOKS)); - - /* Unconditional return/END. */ -- if ((e->target_offset == sizeof(struct ipt_entry) && -+ if ((unconditional(e) && - (strcmp(t->target.u.user.name, - XT_STANDARD_TARGET) == 0) && -- t->verdict < 0 && unconditional(&e->ip)) || -- visited) { -+ t->verdict < 0) || visited) { - unsigned int oldpos, size; - - if ((strcmp(t->target.u.user.name, -@@ -512,6 +511,8 @@ mark_source_chains(const struct xt_table_info *newinfo, - size = e->next_offset; - e = (struct ipt_entry *) - (entry0 + pos + size); -+ if (pos + size >= newinfo->size) -+ return 0; - e->counters.pcnt = pos; - pos += size; - } else { -@@ -533,6 +534,8 @@ mark_source_chains(const struct xt_table_info *newinfo, - } else { - /* ... this is a fallthru */ - newpos = pos + e->next_offset; -+ if (newpos >= newinfo->size) -+ return 0; - } - e = (struct ipt_entry *) - (entry0 + newpos); -@@ -560,27 +563,6 @@ static void cleanup_match(struct xt_entry_match *m, struct net *net) - } - - static int --check_entry(const struct ipt_entry *e, const char *name) --{ -- const struct xt_entry_target *t; -- -- if (!ip_checkentry(&e->ip)) { -- duprintf("ip check failed %p %s.\n", e, name); -- return -EINVAL; -- } -- -- if (e->target_offset + sizeof(struct xt_entry_target) > -- e->next_offset) -- return -EINVAL; -- -- t = ipt_get_target_c(e); -- if (e->target_offset + t->u.target_size > e->next_offset) -- return -EINVAL; -- -- return 0; --} -- --static int - check_match(struct xt_entry_match *m, struct xt_mtchk_param *par) - { - const struct ipt_ip *ip = par->entryinfo; -@@ -657,10 +639,6 @@ find_check_entry(struct ipt_entry *e, struct net *net, const char *name, - struct xt_mtchk_param mtpar; - struct xt_entry_match *ematch; - -- ret = check_entry(e, name); -- if (ret) -- return ret; -- - j = 0; - mtpar.net = net; - mtpar.table = name; -@@ -704,7 +682,7 @@ static bool check_underflow(const struct ipt_entry *e) - const struct xt_entry_target *t; - unsigned int verdict; - -- if (!unconditional(&e->ip)) -+ if (!unconditional(e)) - return false; - t = ipt_get_target_c(e); - if (strcmp(t->u.user.name, XT_STANDARD_TARGET) != 0) -@@ -724,9 +702,11 @@ check_entry_size_and_hooks(struct ipt_entry *e, - unsigned int valid_hooks) - { - unsigned int h; -+ int err; - - if ((unsigned long)e % __alignof__(struct ipt_entry) != 0 || -- (unsigned char *)e + sizeof(struct ipt_entry) >= limit) { -+ (unsigned char *)e + sizeof(struct ipt_entry) >= limit || -+ (unsigned char *)e + e->next_offset > limit) { - duprintf("Bad offset %p\n", e); - return -EINVAL; - } -@@ -738,6 +718,14 @@ check_entry_size_and_hooks(struct ipt_entry *e, - return -EINVAL; - } - -+ if (!ip_checkentry(&e->ip)) -+ return -EINVAL; -+ -+ err = xt_check_entry_offsets(e, e->elems, e->target_offset, -+ e->next_offset); -+ if (err) -+ return err; -+ - /* Check hooks & underflows */ - for (h = 0; h < NF_INET_NUMHOOKS; h++) { - if (!(valid_hooks & (1 << h))) -@@ -746,9 +734,9 @@ check_entry_size_and_hooks(struct ipt_entry *e, - newinfo->hook_entry[h] = hook_entries[h]; - if ((unsigned char *)e - base == underflows[h]) { - if (!check_underflow(e)) { -- pr_err("Underflows must be unconditional and " -- "use the STANDARD target with " -- "ACCEPT/DROP\n"); -+ pr_debug("Underflows must be unconditional and " -+ "use the STANDARD target with " -+ "ACCEPT/DROP\n"); - return -EINVAL; - } - newinfo->underflow[h] = underflows[h]; -@@ -1258,6 +1246,9 @@ do_replace(struct net *net, const void __user *user, unsigned int len) - /* overflow check */ - if (tmp.num_counters >= INT_MAX / sizeof(struct xt_counters)) - return -ENOMEM; -+ if (tmp.num_counters == 0) -+ return -EINVAL; -+ - tmp.name[sizeof(tmp.name)-1] = 0; - - newinfo = xt_alloc_table_info(tmp.size); -@@ -1299,56 +1290,18 @@ do_add_counters(struct net *net, const void __user *user, - unsigned int i, curcpu; - struct xt_counters_info tmp; - struct xt_counters *paddc; -- unsigned int num_counters; -- const char *name; -- int size; -- void *ptmp; - struct xt_table *t; - const struct xt_table_info *private; - int ret = 0; - void *loc_cpu_entry; - struct ipt_entry *iter; - unsigned int addend; --#ifdef CONFIG_COMPAT -- struct compat_xt_counters_info compat_tmp; -- -- if (compat) { -- ptmp = &compat_tmp; -- size = sizeof(struct compat_xt_counters_info); -- } else --#endif -- { -- ptmp = &tmp; -- size = sizeof(struct xt_counters_info); -- } -- -- if (copy_from_user(ptmp, user, size) != 0) -- return -EFAULT; -- --#ifdef CONFIG_COMPAT -- if (compat) { -- num_counters = compat_tmp.num_counters; -- name = compat_tmp.name; -- } else --#endif -- { -- num_counters = tmp.num_counters; -- name = tmp.name; -- } - -- if (len != size + num_counters * sizeof(struct xt_counters)) -- return -EINVAL; -- -- paddc = vmalloc(len - size); -- if (!paddc) -- return -ENOMEM; -- -- if (copy_from_user(paddc, user + size, len - size) != 0) { -- ret = -EFAULT; -- goto free; -- } -+ paddc = xt_copy_counters_from_user(user, len, &tmp, compat); -+ if (IS_ERR(paddc)) -+ return PTR_ERR(paddc); - -- t = xt_find_table_lock(net, AF_INET, name); -+ t = xt_find_table_lock(net, AF_INET, tmp.name); - if (IS_ERR_OR_NULL(t)) { - ret = t ? PTR_ERR(t) : -ENOENT; - goto free; -@@ -1356,7 +1309,7 @@ do_add_counters(struct net *net, const void __user *user, - - local_bh_disable(); - private = t->private; -- if (private->number != num_counters) { -+ if (private->number != tmp.num_counters) { - ret = -EINVAL; - goto unlock_up_free; - } -@@ -1435,7 +1388,6 @@ compat_copy_entry_to_user(struct ipt_entry *e, void __user **dstptr, - - static int - compat_find_calc_match(struct xt_entry_match *m, -- const char *name, - const struct ipt_ip *ip, - unsigned int hookmask, - int *size) -@@ -1471,21 +1423,19 @@ check_compat_entry_size_and_hooks(struct compat_ipt_entry *e, - struct xt_table_info *newinfo, - unsigned int *size, - const unsigned char *base, -- const unsigned char *limit, -- const unsigned int *hook_entries, -- const unsigned int *underflows, -- const char *name) -+ const unsigned char *limit) - { - struct xt_entry_match *ematch; - struct xt_entry_target *t; - struct xt_target *target; - unsigned int entry_offset; - unsigned int j; -- int ret, off, h; -+ int ret, off; - - duprintf("check_compat_entry_size_and_hooks %p\n", e); - if ((unsigned long)e % __alignof__(struct compat_ipt_entry) != 0 || -- (unsigned char *)e + sizeof(struct compat_ipt_entry) >= limit) { -+ (unsigned char *)e + sizeof(struct compat_ipt_entry) >= limit || -+ (unsigned char *)e + e->next_offset > limit) { - duprintf("Bad offset %p, limit = %p\n", e, limit); - return -EINVAL; - } -@@ -1497,8 +1447,11 @@ check_compat_entry_size_and_hooks(struct compat_ipt_entry *e, - return -EINVAL; - } - -- /* For purposes of check_entry casting the compat entry is fine */ -- ret = check_entry((struct ipt_entry *)e, name); -+ if (!ip_checkentry(&e->ip)) -+ return -EINVAL; -+ -+ ret = xt_compat_check_entry_offsets(e, e->elems, -+ e->target_offset, e->next_offset); - if (ret) - return ret; - -@@ -1506,8 +1459,8 @@ check_compat_entry_size_and_hooks(struct compat_ipt_entry *e, - entry_offset = (void *)e - (void *)base; - j = 0; - xt_ematch_foreach(ematch, e) { -- ret = compat_find_calc_match(ematch, name, -- &e->ip, e->comefrom, &off); -+ ret = compat_find_calc_match(ematch, &e->ip, e->comefrom, -+ &off); - if (ret != 0) - goto release_matches; - ++j; -@@ -1530,17 +1483,6 @@ check_compat_entry_size_and_hooks(struct compat_ipt_entry *e, - if (ret) - goto out; - -- /* Check hooks & underflows */ -- for (h = 0; h < NF_INET_NUMHOOKS; h++) { -- if ((unsigned char *)e - base == hook_entries[h]) -- newinfo->hook_entry[h] = hook_entries[h]; -- if ((unsigned char *)e - base == underflows[h]) -- newinfo->underflow[h] = underflows[h]; -- } -- -- /* Clear counters and comefrom */ -- memset(&e->counters, 0, sizeof(e->counters)); -- e->comefrom = 0; - return 0; - - out: -@@ -1554,19 +1496,18 @@ release_matches: - return ret; - } - --static int -+static void - compat_copy_entry_from_user(struct compat_ipt_entry *e, void **dstptr, -- unsigned int *size, const char *name, -+ unsigned int *size, - struct xt_table_info *newinfo, unsigned char *base) - { - struct xt_entry_target *t; - struct xt_target *target; - struct ipt_entry *de; - unsigned int origsize; -- int ret, h; -+ int h; - struct xt_entry_match *ematch; - -- ret = 0; - origsize = *size; - de = (struct ipt_entry *)*dstptr; - memcpy(de, e, sizeof(struct ipt_entry)); -@@ -1575,198 +1516,104 @@ compat_copy_entry_from_user(struct compat_ipt_entry *e, void **dstptr, - *dstptr += sizeof(struct ipt_entry); - *size += sizeof(struct ipt_entry) - sizeof(struct compat_ipt_entry); - -- xt_ematch_foreach(ematch, e) { -- ret = xt_compat_match_from_user(ematch, dstptr, size); -- if (ret != 0) -- return ret; -- } -+ xt_ematch_foreach(ematch, e) -+ xt_compat_match_from_user(ematch, dstptr, size); -+ - de->target_offset = e->target_offset - (origsize - *size); - t = compat_ipt_get_target(e); - target = t->u.kernel.target; - xt_compat_target_from_user(t, dstptr, size); - - de->next_offset = e->next_offset - (origsize - *size); -+ - for (h = 0; h < NF_INET_NUMHOOKS; h++) { - if ((unsigned char *)de - base < newinfo->hook_entry[h]) - newinfo->hook_entry[h] -= origsize - *size; - if ((unsigned char *)de - base < newinfo->underflow[h]) - newinfo->underflow[h] -= origsize - *size; - } -- return ret; --} -- --static int --compat_check_entry(struct ipt_entry *e, struct net *net, const char *name) --{ -- struct xt_entry_match *ematch; -- struct xt_mtchk_param mtpar; -- unsigned int j; -- int ret = 0; -- -- j = 0; -- mtpar.net = net; -- mtpar.table = name; -- mtpar.entryinfo = &e->ip; -- mtpar.hook_mask = e->comefrom; -- mtpar.family = NFPROTO_IPV4; -- xt_ematch_foreach(ematch, e) { -- ret = check_match(ematch, &mtpar); -- if (ret != 0) -- goto cleanup_matches; -- ++j; -- } -- -- ret = check_target(e, net, name); -- if (ret) -- goto cleanup_matches; -- return 0; -- -- cleanup_matches: -- xt_ematch_foreach(ematch, e) { -- if (j-- == 0) -- break; -- cleanup_match(ematch, net); -- } -- return ret; - } - - static int - translate_compat_table(struct net *net, -- const char *name, -- unsigned int valid_hooks, - struct xt_table_info **pinfo, - void **pentry0, -- unsigned int total_size, -- unsigned int number, -- unsigned int *hook_entries, -- unsigned int *underflows) -+ const struct compat_ipt_replace *compatr) - { - unsigned int i, j; - struct xt_table_info *newinfo, *info; - void *pos, *entry0, *entry1; - struct compat_ipt_entry *iter0; -- struct ipt_entry *iter1; -+ struct ipt_replace repl; - unsigned int size; - int ret; - - info = *pinfo; - entry0 = *pentry0; -- size = total_size; -- info->number = number; -- -- /* Init all hooks to impossible value. */ -- for (i = 0; i < NF_INET_NUMHOOKS; i++) { -- info->hook_entry[i] = 0xFFFFFFFF; -- info->underflow[i] = 0xFFFFFFFF; -- } -+ size = compatr->size; -+ info->number = compatr->num_entries; - - duprintf("translate_compat_table: size %u\n", info->size); - j = 0; - xt_compat_lock(AF_INET); -- xt_compat_init_offsets(AF_INET, number); -+ xt_compat_init_offsets(AF_INET, compatr->num_entries); - /* Walk through entries, checking offsets. */ -- xt_entry_foreach(iter0, entry0, total_size) { -+ xt_entry_foreach(iter0, entry0, compatr->size) { - ret = check_compat_entry_size_and_hooks(iter0, info, &size, - entry0, -- entry0 + total_size, -- hook_entries, -- underflows, -- name); -+ entry0 + compatr->size); - if (ret != 0) - goto out_unlock; - ++j; - } - - ret = -EINVAL; -- if (j != number) { -+ if (j != compatr->num_entries) { - duprintf("translate_compat_table: %u not %u entries\n", -- j, number); -+ j, compatr->num_entries); - goto out_unlock; - } - -- /* Check hooks all assigned */ -- for (i = 0; i < NF_INET_NUMHOOKS; i++) { -- /* Only hooks which are valid */ -- if (!(valid_hooks & (1 << i))) -- continue; -- if (info->hook_entry[i] == 0xFFFFFFFF) { -- duprintf("Invalid hook entry %u %u\n", -- i, hook_entries[i]); -- goto out_unlock; -- } -- if (info->underflow[i] == 0xFFFFFFFF) { -- duprintf("Invalid underflow %u %u\n", -- i, underflows[i]); -- goto out_unlock; -- } -- } -- - ret = -ENOMEM; - newinfo = xt_alloc_table_info(size); - if (!newinfo) - goto out_unlock; - -- newinfo->number = number; -+ newinfo->number = compatr->num_entries; - for (i = 0; i < NF_INET_NUMHOOKS; i++) { -- newinfo->hook_entry[i] = info->hook_entry[i]; -- newinfo->underflow[i] = info->underflow[i]; -+ newinfo->hook_entry[i] = compatr->hook_entry[i]; -+ newinfo->underflow[i] = compatr->underflow[i]; - } - entry1 = newinfo->entries[raw_smp_processor_id()]; - pos = entry1; -- size = total_size; -- xt_entry_foreach(iter0, entry0, total_size) { -- ret = compat_copy_entry_from_user(iter0, &pos, &size, -- name, newinfo, entry1); -- if (ret != 0) -- break; -- } -+ size = compatr->size; -+ xt_entry_foreach(iter0, entry0, compatr->size) -+ compat_copy_entry_from_user(iter0, &pos, &size, -+ newinfo, entry1); -+ -+ /* all module references in entry0 are now gone. -+ * entry1/newinfo contains a 64bit ruleset that looks exactly as -+ * generated by 64bit userspace. -+ * -+ * Call standard translate_table() to validate all hook_entrys, -+ * underflows, check for loops, etc. -+ */ - xt_compat_flush_offsets(AF_INET); - xt_compat_unlock(AF_INET); -- if (ret) -- goto free_newinfo; - -- ret = -ELOOP; -- if (!mark_source_chains(newinfo, valid_hooks, entry1)) -- goto free_newinfo; -+ memcpy(&repl, compatr, sizeof(*compatr)); - -- i = 0; -- xt_entry_foreach(iter1, entry1, newinfo->size) { -- ret = compat_check_entry(iter1, net, name); -- if (ret != 0) -- break; -- ++i; -- if (strcmp(ipt_get_target(iter1)->u.user.name, -- XT_ERROR_TARGET) == 0) -- ++newinfo->stacksize; -- } -- if (ret) { -- /* -- * The first i matches need cleanup_entry (calls ->destroy) -- * because they had called ->check already. The other j-i -- * entries need only release. -- */ -- int skip = i; -- j -= i; -- xt_entry_foreach(iter0, entry0, newinfo->size) { -- if (skip-- > 0) -- continue; -- if (j-- == 0) -- break; -- compat_release_entry(iter0); -- } -- xt_entry_foreach(iter1, entry1, newinfo->size) { -- if (i-- == 0) -- break; -- cleanup_entry(iter1, net); -- } -- xt_free_table_info(newinfo); -- return ret; -+ for (i = 0; i < NF_INET_NUMHOOKS; i++) { -+ repl.hook_entry[i] = newinfo->hook_entry[i]; -+ repl.underflow[i] = newinfo->underflow[i]; - } - -- /* And one copy for every other CPU */ -- for_each_possible_cpu(i) -- if (newinfo->entries[i] && newinfo->entries[i] != entry1) -- memcpy(newinfo->entries[i], entry1, newinfo->size); -+ repl.num_counters = 0; -+ repl.counters = NULL; -+ repl.size = newinfo->size; -+ ret = translate_table(net, newinfo, entry1, &repl); -+ if (ret) -+ goto free_newinfo; - - *pinfo = newinfo; - *pentry0 = entry1; -@@ -1775,17 +1622,16 @@ translate_compat_table(struct net *net, - - free_newinfo: - xt_free_table_info(newinfo); --out: -- xt_entry_foreach(iter0, entry0, total_size) { -+ return ret; -+out_unlock: -+ xt_compat_flush_offsets(AF_INET); -+ xt_compat_unlock(AF_INET); -+ xt_entry_foreach(iter0, entry0, compatr->size) { - if (j-- == 0) - break; - compat_release_entry(iter0); - } - return ret; --out_unlock: -- xt_compat_flush_offsets(AF_INET); -- xt_compat_unlock(AF_INET); -- goto out; - } - - static int -@@ -1805,6 +1651,9 @@ compat_do_replace(struct net *net, void __user *user, unsigned int len) - return -ENOMEM; - if (tmp.num_counters >= INT_MAX / sizeof(struct xt_counters)) - return -ENOMEM; -+ if (tmp.num_counters == 0) -+ return -EINVAL; -+ - tmp.name[sizeof(tmp.name)-1] = 0; - - newinfo = xt_alloc_table_info(tmp.size); -@@ -1819,10 +1668,7 @@ compat_do_replace(struct net *net, void __user *user, unsigned int len) - goto free_newinfo; - } - -- ret = translate_compat_table(net, tmp.name, tmp.valid_hooks, -- &newinfo, &loc_cpu_entry, tmp.size, -- tmp.num_entries, tmp.hook_entry, -- tmp.underflow); -+ ret = translate_compat_table(net, &newinfo, &loc_cpu_entry, &tmp); - if (ret != 0) - goto free_newinfo; - -diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c -index f89087c3cfc8..f3b15bb7fbec 100644 ---- a/net/ipv4/tcp_input.c -+++ b/net/ipv4/tcp_input.c -@@ -68,6 +68,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -87,7 +88,7 @@ int sysctl_tcp_adv_win_scale __read_mostly = 1; - EXPORT_SYMBOL(sysctl_tcp_adv_win_scale); - - /* rfc5961 challenge ack rate limiting */ --int sysctl_tcp_challenge_ack_limit = 100; -+int sysctl_tcp_challenge_ack_limit = 1000; - - int sysctl_tcp_stdurg __read_mostly; - int sysctl_tcp_rfc1337 __read_mostly; -@@ -3288,12 +3289,19 @@ static void tcp_send_challenge_ack(struct sock *sk) - static u32 challenge_timestamp; - static unsigned int challenge_count; - u32 now = jiffies / HZ; -+ u32 count; - - if (now != challenge_timestamp) { -+ u32 half = (sysctl_tcp_challenge_ack_limit + 1) >> 1; -+ - challenge_timestamp = now; -- challenge_count = 0; -+ ACCESS_ONCE(challenge_count) = half + -+ reciprocal_divide(prandom_u32(), -+ sysctl_tcp_challenge_ack_limit); - } -- if (++challenge_count <= sysctl_tcp_challenge_ack_limit) { -+ count = ACCESS_ONCE(challenge_count); -+ if (count > 0) { -+ ACCESS_ONCE(challenge_count) = count - 1; - NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPCHALLENGEACK); - tcp_send_ack(sk); - } -diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c -index 76c80b59e80f..276b28301a6b 100644 ---- a/net/ipv4/tcp_output.c -+++ b/net/ipv4/tcp_output.c -@@ -222,7 +222,8 @@ void tcp_select_initial_window(int __space, __u32 mss, - /* Set window scaling on max possible window - * See RFC1323 for an explanation of the limit to 14 - */ -- space = max_t(u32, sysctl_tcp_rmem[2], sysctl_rmem_max); -+ space = max_t(u32, space, sysctl_tcp_rmem[2]); -+ space = max_t(u32, space, sysctl_rmem_max); - space = min_t(u32, space, *window_clamp); - while (space > 65535 && (*rcv_wscale) < 14) { - space >>= 1; -diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c -index 63b536bbf0b0..68174e4d88c7 100644 ---- a/net/ipv4/udp.c -+++ b/net/ipv4/udp.c -@@ -1208,6 +1208,7 @@ int udp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, - int peeked, off = 0; - int err; - int is_udplite = IS_UDPLITE(sk); -+ bool checksum_valid = false; - bool slow; - - if (flags & MSG_ERRQUEUE) -@@ -1233,11 +1234,12 @@ try_again: - */ - - if (copied < ulen || UDP_SKB_CB(skb)->partial_cov) { -- if (udp_lib_checksum_complete(skb)) -+ checksum_valid = !udp_lib_checksum_complete(skb); -+ if (!checksum_valid) - goto csum_copy_err; - } - -- if (skb_csum_unnecessary(skb)) -+ if (checksum_valid || skb_csum_unnecessary(skb)) - err = skb_copy_datagram_iovec(skb, sizeof(struct udphdr), - msg->msg_iov, copied); - else { -diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c -index 8d69df16f6a8..107f75283b1b 100644 ---- a/net/ipv6/ip6mr.c -+++ b/net/ipv6/ip6mr.c -@@ -1077,6 +1077,7 @@ static struct mfc6_cache *ip6mr_cache_alloc(void) - struct mfc6_cache *c = kmem_cache_zalloc(mrt_cachep, GFP_KERNEL); - if (c == NULL) - return NULL; -+ c->mfc_un.res.last_assert = jiffies - MFC_ASSERT_THRESH - 1; - c->mfc_un.res.minvif = MAXMIFS; - return c; - } -diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c -index 89a4e4ddd8bb..e214222cd06f 100644 ---- a/net/ipv6/netfilter/ip6_tables.c -+++ b/net/ipv6/netfilter/ip6_tables.c -@@ -195,11 +195,12 @@ get_entry(const void *base, unsigned int offset) - - /* All zeroes == unconditional rule. */ - /* Mildly perf critical (only if packet tracing is on) */ --static inline bool unconditional(const struct ip6t_ip6 *ipv6) -+static inline bool unconditional(const struct ip6t_entry *e) - { - static const struct ip6t_ip6 uncond; - -- return memcmp(ipv6, &uncond, sizeof(uncond)) == 0; -+ return e->target_offset == sizeof(struct ip6t_entry) && -+ memcmp(&e->ipv6, &uncond, sizeof(uncond)) == 0; - } - - static inline const struct xt_entry_target * -@@ -255,11 +256,10 @@ get_chainname_rulenum(const struct ip6t_entry *s, const struct ip6t_entry *e, - } else if (s == e) { - (*rulenum)++; - -- if (s->target_offset == sizeof(struct ip6t_entry) && -+ if (unconditional(s) && - strcmp(t->target.u.kernel.target->name, - XT_STANDARD_TARGET) == 0 && -- t->verdict < 0 && -- unconditional(&s->ipv6)) { -+ t->verdict < 0) { - /* Tail of chains: STANDARD target (return/policy) */ - *comment = *chainname == hookname - ? comments[NF_IP6_TRACE_COMMENT_POLICY] -@@ -477,11 +477,10 @@ mark_source_chains(const struct xt_table_info *newinfo, - e->comefrom |= ((1 << hook) | (1 << NF_INET_NUMHOOKS)); - - /* Unconditional return/END. */ -- if ((e->target_offset == sizeof(struct ip6t_entry) && -+ if ((unconditional(e) && - (strcmp(t->target.u.user.name, - XT_STANDARD_TARGET) == 0) && -- t->verdict < 0 && -- unconditional(&e->ipv6)) || visited) { -+ t->verdict < 0) || visited) { - unsigned int oldpos, size; - - if ((strcmp(t->target.u.user.name, -@@ -522,6 +521,8 @@ mark_source_chains(const struct xt_table_info *newinfo, - size = e->next_offset; - e = (struct ip6t_entry *) - (entry0 + pos + size); -+ if (pos + size >= newinfo->size) -+ return 0; - e->counters.pcnt = pos; - pos += size; - } else { -@@ -543,6 +544,8 @@ mark_source_chains(const struct xt_table_info *newinfo, - } else { - /* ... this is a fallthru */ - newpos = pos + e->next_offset; -+ if (newpos >= newinfo->size) -+ return 0; - } - e = (struct ip6t_entry *) - (entry0 + newpos); -@@ -569,27 +572,6 @@ static void cleanup_match(struct xt_entry_match *m, struct net *net) - module_put(par.match->me); - } - --static int --check_entry(const struct ip6t_entry *e, const char *name) --{ -- const struct xt_entry_target *t; -- -- if (!ip6_checkentry(&e->ipv6)) { -- duprintf("ip_tables: ip check failed %p %s.\n", e, name); -- return -EINVAL; -- } -- -- if (e->target_offset + sizeof(struct xt_entry_target) > -- e->next_offset) -- return -EINVAL; -- -- t = ip6t_get_target_c(e); -- if (e->target_offset + t->u.target_size > e->next_offset) -- return -EINVAL; -- -- return 0; --} -- - static int check_match(struct xt_entry_match *m, struct xt_mtchk_param *par) - { - const struct ip6t_ip6 *ipv6 = par->entryinfo; -@@ -668,10 +650,6 @@ find_check_entry(struct ip6t_entry *e, struct net *net, const char *name, - struct xt_mtchk_param mtpar; - struct xt_entry_match *ematch; - -- ret = check_entry(e, name); -- if (ret) -- return ret; -- - j = 0; - mtpar.net = net; - mtpar.table = name; -@@ -715,7 +693,7 @@ static bool check_underflow(const struct ip6t_entry *e) - const struct xt_entry_target *t; - unsigned int verdict; - -- if (!unconditional(&e->ipv6)) -+ if (!unconditional(e)) - return false; - t = ip6t_get_target_c(e); - if (strcmp(t->u.user.name, XT_STANDARD_TARGET) != 0) -@@ -735,9 +713,11 @@ check_entry_size_and_hooks(struct ip6t_entry *e, - unsigned int valid_hooks) - { - unsigned int h; -+ int err; - - if ((unsigned long)e % __alignof__(struct ip6t_entry) != 0 || -- (unsigned char *)e + sizeof(struct ip6t_entry) >= limit) { -+ (unsigned char *)e + sizeof(struct ip6t_entry) >= limit || -+ (unsigned char *)e + e->next_offset > limit) { - duprintf("Bad offset %p\n", e); - return -EINVAL; - } -@@ -749,6 +729,14 @@ check_entry_size_and_hooks(struct ip6t_entry *e, - return -EINVAL; - } - -+ if (!ip6_checkentry(&e->ipv6)) -+ return -EINVAL; -+ -+ err = xt_check_entry_offsets(e, e->elems, e->target_offset, -+ e->next_offset); -+ if (err) -+ return err; -+ - /* Check hooks & underflows */ - for (h = 0; h < NF_INET_NUMHOOKS; h++) { - if (!(valid_hooks & (1 << h))) -@@ -757,9 +745,9 @@ check_entry_size_and_hooks(struct ip6t_entry *e, - newinfo->hook_entry[h] = hook_entries[h]; - if ((unsigned char *)e - base == underflows[h]) { - if (!check_underflow(e)) { -- pr_err("Underflows must be unconditional and " -- "use the STANDARD target with " -- "ACCEPT/DROP\n"); -+ pr_debug("Underflows must be unconditional and " -+ "use the STANDARD target with " -+ "ACCEPT/DROP\n"); - return -EINVAL; - } - newinfo->underflow[h] = underflows[h]; -@@ -1268,6 +1256,9 @@ do_replace(struct net *net, const void __user *user, unsigned int len) - /* overflow check */ - if (tmp.num_counters >= INT_MAX / sizeof(struct xt_counters)) - return -ENOMEM; -+ if (tmp.num_counters == 0) -+ return -EINVAL; -+ - tmp.name[sizeof(tmp.name)-1] = 0; - - newinfo = xt_alloc_table_info(tmp.size); -@@ -1309,56 +1300,17 @@ do_add_counters(struct net *net, const void __user *user, unsigned int len, - unsigned int i, curcpu; - struct xt_counters_info tmp; - struct xt_counters *paddc; -- unsigned int num_counters; -- char *name; -- int size; -- void *ptmp; - struct xt_table *t; - const struct xt_table_info *private; - int ret = 0; - const void *loc_cpu_entry; - struct ip6t_entry *iter; - unsigned int addend; --#ifdef CONFIG_COMPAT -- struct compat_xt_counters_info compat_tmp; -- -- if (compat) { -- ptmp = &compat_tmp; -- size = sizeof(struct compat_xt_counters_info); -- } else --#endif -- { -- ptmp = &tmp; -- size = sizeof(struct xt_counters_info); -- } -- -- if (copy_from_user(ptmp, user, size) != 0) -- return -EFAULT; -- --#ifdef CONFIG_COMPAT -- if (compat) { -- num_counters = compat_tmp.num_counters; -- name = compat_tmp.name; -- } else --#endif -- { -- num_counters = tmp.num_counters; -- name = tmp.name; -- } - -- if (len != size + num_counters * sizeof(struct xt_counters)) -- return -EINVAL; -- -- paddc = vmalloc(len - size); -- if (!paddc) -- return -ENOMEM; -- -- if (copy_from_user(paddc, user + size, len - size) != 0) { -- ret = -EFAULT; -- goto free; -- } -- -- t = xt_find_table_lock(net, AF_INET6, name); -+ paddc = xt_copy_counters_from_user(user, len, &tmp, compat); -+ if (IS_ERR(paddc)) -+ return PTR_ERR(paddc); -+ t = xt_find_table_lock(net, AF_INET6, tmp.name); - if (IS_ERR_OR_NULL(t)) { - ret = t ? PTR_ERR(t) : -ENOENT; - goto free; -@@ -1367,7 +1319,7 @@ do_add_counters(struct net *net, const void __user *user, unsigned int len, - - local_bh_disable(); - private = t->private; -- if (private->number != num_counters) { -+ if (private->number != tmp.num_counters) { - ret = -EINVAL; - goto unlock_up_free; - } -@@ -1447,7 +1399,6 @@ compat_copy_entry_to_user(struct ip6t_entry *e, void __user **dstptr, - - static int - compat_find_calc_match(struct xt_entry_match *m, -- const char *name, - const struct ip6t_ip6 *ipv6, - unsigned int hookmask, - int *size) -@@ -1483,21 +1434,19 @@ check_compat_entry_size_and_hooks(struct compat_ip6t_entry *e, - struct xt_table_info *newinfo, - unsigned int *size, - const unsigned char *base, -- const unsigned char *limit, -- const unsigned int *hook_entries, -- const unsigned int *underflows, -- const char *name) -+ const unsigned char *limit) - { - struct xt_entry_match *ematch; - struct xt_entry_target *t; - struct xt_target *target; - unsigned int entry_offset; - unsigned int j; -- int ret, off, h; -+ int ret, off; - - duprintf("check_compat_entry_size_and_hooks %p\n", e); - if ((unsigned long)e % __alignof__(struct compat_ip6t_entry) != 0 || -- (unsigned char *)e + sizeof(struct compat_ip6t_entry) >= limit) { -+ (unsigned char *)e + sizeof(struct compat_ip6t_entry) >= limit || -+ (unsigned char *)e + e->next_offset > limit) { - duprintf("Bad offset %p, limit = %p\n", e, limit); - return -EINVAL; - } -@@ -1509,8 +1458,11 @@ check_compat_entry_size_and_hooks(struct compat_ip6t_entry *e, - return -EINVAL; - } - -- /* For purposes of check_entry casting the compat entry is fine */ -- ret = check_entry((struct ip6t_entry *)e, name); -+ if (!ip6_checkentry(&e->ipv6)) -+ return -EINVAL; -+ -+ ret = xt_compat_check_entry_offsets(e, e->elems, -+ e->target_offset, e->next_offset); - if (ret) - return ret; - -@@ -1518,8 +1470,8 @@ check_compat_entry_size_and_hooks(struct compat_ip6t_entry *e, - entry_offset = (void *)e - (void *)base; - j = 0; - xt_ematch_foreach(ematch, e) { -- ret = compat_find_calc_match(ematch, name, -- &e->ipv6, e->comefrom, &off); -+ ret = compat_find_calc_match(ematch, &e->ipv6, e->comefrom, -+ &off); - if (ret != 0) - goto release_matches; - ++j; -@@ -1542,17 +1494,6 @@ check_compat_entry_size_and_hooks(struct compat_ip6t_entry *e, - if (ret) - goto out; - -- /* Check hooks & underflows */ -- for (h = 0; h < NF_INET_NUMHOOKS; h++) { -- if ((unsigned char *)e - base == hook_entries[h]) -- newinfo->hook_entry[h] = hook_entries[h]; -- if ((unsigned char *)e - base == underflows[h]) -- newinfo->underflow[h] = underflows[h]; -- } -- -- /* Clear counters and comefrom */ -- memset(&e->counters, 0, sizeof(e->counters)); -- e->comefrom = 0; - return 0; - - out: -@@ -1566,18 +1507,17 @@ release_matches: - return ret; - } - --static int -+static void - compat_copy_entry_from_user(struct compat_ip6t_entry *e, void **dstptr, -- unsigned int *size, const char *name, -+ unsigned int *size, - struct xt_table_info *newinfo, unsigned char *base) - { - struct xt_entry_target *t; - struct ip6t_entry *de; - unsigned int origsize; -- int ret, h; -+ int h; - struct xt_entry_match *ematch; - -- ret = 0; - origsize = *size; - de = (struct ip6t_entry *)*dstptr; - memcpy(de, e, sizeof(struct ip6t_entry)); -@@ -1586,11 +1526,9 @@ compat_copy_entry_from_user(struct compat_ip6t_entry *e, void **dstptr, - *dstptr += sizeof(struct ip6t_entry); - *size += sizeof(struct ip6t_entry) - sizeof(struct compat_ip6t_entry); - -- xt_ematch_foreach(ematch, e) { -- ret = xt_compat_match_from_user(ematch, dstptr, size); -- if (ret != 0) -- return ret; -- } -+ xt_ematch_foreach(ematch, e) -+ xt_compat_match_from_user(ematch, dstptr, size); -+ - de->target_offset = e->target_offset - (origsize - *size); - t = compat_ip6t_get_target(e); - xt_compat_target_from_user(t, dstptr, size); -@@ -1602,181 +1540,82 @@ compat_copy_entry_from_user(struct compat_ip6t_entry *e, void **dstptr, - if ((unsigned char *)de - base < newinfo->underflow[h]) - newinfo->underflow[h] -= origsize - *size; - } -- return ret; --} -- --static int compat_check_entry(struct ip6t_entry *e, struct net *net, -- const char *name) --{ -- unsigned int j; -- int ret = 0; -- struct xt_mtchk_param mtpar; -- struct xt_entry_match *ematch; -- -- j = 0; -- mtpar.net = net; -- mtpar.table = name; -- mtpar.entryinfo = &e->ipv6; -- mtpar.hook_mask = e->comefrom; -- mtpar.family = NFPROTO_IPV6; -- xt_ematch_foreach(ematch, e) { -- ret = check_match(ematch, &mtpar); -- if (ret != 0) -- goto cleanup_matches; -- ++j; -- } -- -- ret = check_target(e, net, name); -- if (ret) -- goto cleanup_matches; -- return 0; -- -- cleanup_matches: -- xt_ematch_foreach(ematch, e) { -- if (j-- == 0) -- break; -- cleanup_match(ematch, net); -- } -- return ret; - } - - static int - translate_compat_table(struct net *net, -- const char *name, -- unsigned int valid_hooks, - struct xt_table_info **pinfo, - void **pentry0, -- unsigned int total_size, -- unsigned int number, -- unsigned int *hook_entries, -- unsigned int *underflows) -+ const struct compat_ip6t_replace *compatr) - { - unsigned int i, j; - struct xt_table_info *newinfo, *info; - void *pos, *entry0, *entry1; - struct compat_ip6t_entry *iter0; -- struct ip6t_entry *iter1; -+ struct ip6t_replace repl; - unsigned int size; - int ret = 0; - - info = *pinfo; - entry0 = *pentry0; -- size = total_size; -- info->number = number; -- -- /* Init all hooks to impossible value. */ -- for (i = 0; i < NF_INET_NUMHOOKS; i++) { -- info->hook_entry[i] = 0xFFFFFFFF; -- info->underflow[i] = 0xFFFFFFFF; -- } -+ size = compatr->size; -+ info->number = compatr->num_entries; - - duprintf("translate_compat_table: size %u\n", info->size); - j = 0; - xt_compat_lock(AF_INET6); -- xt_compat_init_offsets(AF_INET6, number); -+ xt_compat_init_offsets(AF_INET6, compatr->num_entries); - /* Walk through entries, checking offsets. */ -- xt_entry_foreach(iter0, entry0, total_size) { -+ xt_entry_foreach(iter0, entry0, compatr->size) { - ret = check_compat_entry_size_and_hooks(iter0, info, &size, - entry0, -- entry0 + total_size, -- hook_entries, -- underflows, -- name); -+ entry0 + compatr->size); - if (ret != 0) - goto out_unlock; - ++j; - } - - ret = -EINVAL; -- if (j != number) { -+ if (j != compatr->num_entries) { - duprintf("translate_compat_table: %u not %u entries\n", -- j, number); -+ j, compatr->num_entries); - goto out_unlock; - } - -- /* Check hooks all assigned */ -- for (i = 0; i < NF_INET_NUMHOOKS; i++) { -- /* Only hooks which are valid */ -- if (!(valid_hooks & (1 << i))) -- continue; -- if (info->hook_entry[i] == 0xFFFFFFFF) { -- duprintf("Invalid hook entry %u %u\n", -- i, hook_entries[i]); -- goto out_unlock; -- } -- if (info->underflow[i] == 0xFFFFFFFF) { -- duprintf("Invalid underflow %u %u\n", -- i, underflows[i]); -- goto out_unlock; -- } -- } -- - ret = -ENOMEM; - newinfo = xt_alloc_table_info(size); - if (!newinfo) - goto out_unlock; - -- newinfo->number = number; -+ newinfo->number = compatr->num_entries; - for (i = 0; i < NF_INET_NUMHOOKS; i++) { -- newinfo->hook_entry[i] = info->hook_entry[i]; -- newinfo->underflow[i] = info->underflow[i]; -+ newinfo->hook_entry[i] = compatr->hook_entry[i]; -+ newinfo->underflow[i] = compatr->underflow[i]; - } - entry1 = newinfo->entries[raw_smp_processor_id()]; - pos = entry1; -- size = total_size; -- xt_entry_foreach(iter0, entry0, total_size) { -- ret = compat_copy_entry_from_user(iter0, &pos, &size, -- name, newinfo, entry1); -- if (ret != 0) -- break; -- } -+ size = compatr->size; -+ xt_entry_foreach(iter0, entry0, compatr->size) -+ compat_copy_entry_from_user(iter0, &pos, &size, -+ newinfo, entry1); -+ -+ /* all module references in entry0 are now gone. */ - xt_compat_flush_offsets(AF_INET6); - xt_compat_unlock(AF_INET6); -- if (ret) -- goto free_newinfo; - -- ret = -ELOOP; -- if (!mark_source_chains(newinfo, valid_hooks, entry1)) -- goto free_newinfo; -+ memcpy(&repl, compatr, sizeof(*compatr)); - -- i = 0; -- xt_entry_foreach(iter1, entry1, newinfo->size) { -- ret = compat_check_entry(iter1, net, name); -- if (ret != 0) -- break; -- ++i; -- if (strcmp(ip6t_get_target(iter1)->u.user.name, -- XT_ERROR_TARGET) == 0) -- ++newinfo->stacksize; -- } -- if (ret) { -- /* -- * The first i matches need cleanup_entry (calls ->destroy) -- * because they had called ->check already. The other j-i -- * entries need only release. -- */ -- int skip = i; -- j -= i; -- xt_entry_foreach(iter0, entry0, newinfo->size) { -- if (skip-- > 0) -- continue; -- if (j-- == 0) -- break; -- compat_release_entry(iter0); -- } -- xt_entry_foreach(iter1, entry1, newinfo->size) { -- if (i-- == 0) -- break; -- cleanup_entry(iter1, net); -- } -- xt_free_table_info(newinfo); -- return ret; -+ for (i = 0; i < NF_INET_NUMHOOKS; i++) { -+ repl.hook_entry[i] = newinfo->hook_entry[i]; -+ repl.underflow[i] = newinfo->underflow[i]; - } - -- /* And one copy for every other CPU */ -- for_each_possible_cpu(i) -- if (newinfo->entries[i] && newinfo->entries[i] != entry1) -- memcpy(newinfo->entries[i], entry1, newinfo->size); -+ repl.num_counters = 0; -+ repl.counters = NULL; -+ repl.size = newinfo->size; -+ ret = translate_table(net, newinfo, entry1, &repl); -+ if (ret) -+ goto free_newinfo; - - *pinfo = newinfo; - *pentry0 = entry1; -@@ -1785,17 +1624,16 @@ translate_compat_table(struct net *net, - - free_newinfo: - xt_free_table_info(newinfo); --out: -- xt_entry_foreach(iter0, entry0, total_size) { -+ return ret; -+out_unlock: -+ xt_compat_flush_offsets(AF_INET6); -+ xt_compat_unlock(AF_INET6); -+ xt_entry_foreach(iter0, entry0, compatr->size) { - if (j-- == 0) - break; - compat_release_entry(iter0); - } - return ret; --out_unlock: -- xt_compat_flush_offsets(AF_INET6); -- xt_compat_unlock(AF_INET6); -- goto out; - } - - static int -@@ -1815,6 +1653,9 @@ compat_do_replace(struct net *net, void __user *user, unsigned int len) - return -ENOMEM; - if (tmp.num_counters >= INT_MAX / sizeof(struct xt_counters)) - return -ENOMEM; -+ if (tmp.num_counters == 0) -+ return -EINVAL; -+ - tmp.name[sizeof(tmp.name)-1] = 0; - - newinfo = xt_alloc_table_info(tmp.size); -@@ -1829,10 +1670,7 @@ compat_do_replace(struct net *net, void __user *user, unsigned int len) - goto free_newinfo; - } - -- ret = translate_compat_table(net, tmp.name, tmp.valid_hooks, -- &newinfo, &loc_cpu_entry, tmp.size, -- tmp.num_entries, tmp.hook_entry, -- tmp.underflow); -+ ret = translate_compat_table(net, &newinfo, &loc_cpu_entry, &tmp); - if (ret != 0) - goto free_newinfo; - -diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c -index 4ddf67c6355b..d9535bb8fe2e 100644 ---- a/net/ipv6/sit.c -+++ b/net/ipv6/sit.c -@@ -530,13 +530,13 @@ static int ipip6_err(struct sk_buff *skb, u32 info) - - if (type == ICMP_DEST_UNREACH && code == ICMP_FRAG_NEEDED) { - ipv4_update_pmtu(skb, dev_net(skb->dev), info, -- t->parms.link, 0, IPPROTO_IPV6, 0); -+ t->parms.link, 0, iph->protocol, 0); - err = 0; - goto out; - } - if (type == ICMP_REDIRECT) { - ipv4_redirect(skb, dev_net(skb->dev), t->parms.link, 0, -- IPPROTO_IPV6, 0); -+ iph->protocol, 0); - err = 0; - goto out; - } -diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c -index 4659b8ab55d9..41c026f11edc 100644 ---- a/net/ipv6/tcp_ipv6.c -+++ b/net/ipv6/tcp_ipv6.c -@@ -1767,7 +1767,9 @@ static void get_tcp6_sock(struct seq_file *seq, struct sock *sp, int i) - destp = ntohs(inet->inet_dport); - srcp = ntohs(inet->inet_sport); - -- if (icsk->icsk_pending == ICSK_TIME_RETRANS) { -+ if (icsk->icsk_pending == ICSK_TIME_RETRANS || -+ icsk->icsk_pending == ICSK_TIME_EARLY_RETRANS || -+ icsk->icsk_pending == ICSK_TIME_LOSS_PROBE) { - timer_active = 1; - timer_expires = icsk->icsk_timeout; - } else if (icsk->icsk_pending == ICSK_TIME_PROBE0) { -diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c -index 3046d0244393..d234e6f80570 100644 ---- a/net/ipv6/udp.c -+++ b/net/ipv6/udp.c -@@ -370,6 +370,7 @@ int udpv6_recvmsg(struct kiocb *iocb, struct sock *sk, - int peeked, off = 0; - int err; - int is_udplite = IS_UDPLITE(sk); -+ bool checksum_valid = false; - int is_udp4; - bool slow; - -@@ -401,11 +402,12 @@ try_again: - */ - - if (copied < ulen || UDP_SKB_CB(skb)->partial_cov) { -- if (udp_lib_checksum_complete(skb)) -+ checksum_valid = !udp_lib_checksum_complete(skb); -+ if (!checksum_valid) - goto csum_copy_err; - } - -- if (skb_csum_unnecessary(skb)) -+ if (checksum_valid || skb_csum_unnecessary(skb)) - err = skb_copy_datagram_iovec(skb, sizeof(struct udphdr), - msg->msg_iov, copied); - else { -diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c -index f8133ff5b081..c95bafa65f5b 100644 ---- a/net/irda/af_irda.c -+++ b/net/irda/af_irda.c -@@ -1039,8 +1039,11 @@ static int irda_connect(struct socket *sock, struct sockaddr *uaddr, - } - - /* Check if we have opened a local TSAP */ -- if (!self->tsap) -- irda_open_tsap(self, LSAP_ANY, addr->sir_name); -+ if (!self->tsap) { -+ err = irda_open_tsap(self, LSAP_ANY, addr->sir_name); -+ if (err) -+ goto out; -+ } - - /* Move to connecting socket, start sending Connect Requests */ - sock->state = SS_CONNECTING; -diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c -index 6952760881c8..f8765cc84e47 100644 ---- a/net/mac80211/mesh.c -+++ b/net/mac80211/mesh.c -@@ -161,6 +161,10 @@ void mesh_sta_cleanup(struct sta_info *sta) - del_timer_sync(&sta->plink_timer); - } - -+ /* make sure no readers can access nexthop sta from here on */ -+ mesh_path_flush_by_nexthop(sta); -+ synchronize_net(); -+ - if (changed) - ieee80211_mbss_info_change_notify(sdata, changed); - } -diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c -index 8b03028cca69..51c141b09dba 100644 ---- a/net/netfilter/x_tables.c -+++ b/net/netfilter/x_tables.c -@@ -435,6 +435,47 @@ int xt_check_match(struct xt_mtchk_param *par, - } - EXPORT_SYMBOL_GPL(xt_check_match); - -+/** xt_check_entry_match - check that matches end before start of target -+ * -+ * @match: beginning of xt_entry_match -+ * @target: beginning of this rules target (alleged end of matches) -+ * @alignment: alignment requirement of match structures -+ * -+ * Validates that all matches add up to the beginning of the target, -+ * and that each match covers at least the base structure size. -+ * -+ * Return: 0 on success, negative errno on failure. -+ */ -+static int xt_check_entry_match(const char *match, const char *target, -+ const size_t alignment) -+{ -+ const struct xt_entry_match *pos; -+ int length = target - match; -+ -+ if (length == 0) /* no matches */ -+ return 0; -+ -+ pos = (struct xt_entry_match *)match; -+ do { -+ if ((unsigned long)pos % alignment) -+ return -EINVAL; -+ -+ if (length < (int)sizeof(struct xt_entry_match)) -+ return -EINVAL; -+ -+ if (pos->u.match_size < sizeof(struct xt_entry_match)) -+ return -EINVAL; -+ -+ if (pos->u.match_size > length) -+ return -EINVAL; -+ -+ length -= pos->u.match_size; -+ pos = ((void *)((char *)(pos) + (pos)->u.match_size)); -+ } while (length > 0); -+ -+ return 0; -+} -+ - #ifdef CONFIG_COMPAT - int xt_compat_add_offset(u_int8_t af, unsigned int offset, int delta) - { -@@ -504,13 +545,14 @@ int xt_compat_match_offset(const struct xt_match *match) - } - EXPORT_SYMBOL_GPL(xt_compat_match_offset); - --int xt_compat_match_from_user(struct xt_entry_match *m, void **dstptr, -- unsigned int *size) -+void xt_compat_match_from_user(struct xt_entry_match *m, void **dstptr, -+ unsigned int *size) - { - const struct xt_match *match = m->u.kernel.match; - struct compat_xt_entry_match *cm = (struct compat_xt_entry_match *)m; - int pad, off = xt_compat_match_offset(match); - u_int16_t msize = cm->u.user.match_size; -+ char name[sizeof(m->u.user.name)]; - - m = *dstptr; - memcpy(m, cm, sizeof(*cm)); -@@ -524,10 +566,12 @@ int xt_compat_match_from_user(struct xt_entry_match *m, void **dstptr, - - msize += off; - m->u.user.match_size = msize; -+ strlcpy(name, match->name, sizeof(name)); -+ module_put(match->me); -+ strncpy(m->u.user.name, name, sizeof(m->u.user.name)); - - *size += off; - *dstptr += msize; -- return 0; - } - EXPORT_SYMBOL_GPL(xt_compat_match_from_user); - -@@ -558,8 +602,125 @@ int xt_compat_match_to_user(const struct xt_entry_match *m, - return 0; - } - EXPORT_SYMBOL_GPL(xt_compat_match_to_user); -+ -+/* non-compat version may have padding after verdict */ -+struct compat_xt_standard_target { -+ struct compat_xt_entry_target t; -+ compat_uint_t verdict; -+}; -+ -+int xt_compat_check_entry_offsets(const void *base, const char *elems, -+ unsigned int target_offset, -+ unsigned int next_offset) -+{ -+ long size_of_base_struct = elems - (const char *)base; -+ const struct compat_xt_entry_target *t; -+ const char *e = base; -+ -+ if (target_offset < size_of_base_struct) -+ return -EINVAL; -+ -+ if (target_offset + sizeof(*t) > next_offset) -+ return -EINVAL; -+ -+ t = (void *)(e + target_offset); -+ if (t->u.target_size < sizeof(*t)) -+ return -EINVAL; -+ -+ if (target_offset + t->u.target_size > next_offset) -+ return -EINVAL; -+ -+ if (strcmp(t->u.user.name, XT_STANDARD_TARGET) == 0 && -+ COMPAT_XT_ALIGN(target_offset + sizeof(struct compat_xt_standard_target)) != next_offset) -+ return -EINVAL; -+ -+ /* compat_xt_entry match has less strict aligment requirements, -+ * otherwise they are identical. In case of padding differences -+ * we need to add compat version of xt_check_entry_match. -+ */ -+ BUILD_BUG_ON(sizeof(struct compat_xt_entry_match) != sizeof(struct xt_entry_match)); -+ -+ return xt_check_entry_match(elems, base + target_offset, -+ __alignof__(struct compat_xt_entry_match)); -+} -+EXPORT_SYMBOL(xt_compat_check_entry_offsets); - #endif /* CONFIG_COMPAT */ - -+/** -+ * xt_check_entry_offsets - validate arp/ip/ip6t_entry -+ * -+ * @base: pointer to arp/ip/ip6t_entry -+ * @elems: pointer to first xt_entry_match, i.e. ip(6)t_entry->elems -+ * @target_offset: the arp/ip/ip6_t->target_offset -+ * @next_offset: the arp/ip/ip6_t->next_offset -+ * -+ * validates that target_offset and next_offset are sane and that all -+ * match sizes (if any) align with the target offset. -+ * -+ * This function does not validate the targets or matches themselves, it -+ * only tests that all the offsets and sizes are correct, that all -+ * match structures are aligned, and that the last structure ends where -+ * the target structure begins. -+ * -+ * Also see xt_compat_check_entry_offsets for CONFIG_COMPAT version. -+ * -+ * The arp/ip/ip6t_entry structure @base must have passed following tests: -+ * - it must point to a valid memory location -+ * - base to base + next_offset must be accessible, i.e. not exceed allocated -+ * length. -+ * -+ * A well-formed entry looks like this: -+ * -+ * ip(6)t_entry match [mtdata] match [mtdata] target [tgdata] ip(6)t_entry -+ * e->elems[]-----' | | -+ * matchsize | | -+ * matchsize | | -+ * | | -+ * target_offset---------------------------------' | -+ * next_offset---------------------------------------------------' -+ * -+ * elems[]: flexible array member at end of ip(6)/arpt_entry struct. -+ * This is where matches (if any) and the target reside. -+ * target_offset: beginning of target. -+ * next_offset: start of the next rule; also: size of this rule. -+ * Since targets have a minimum size, target_offset + minlen <= next_offset. -+ * -+ * Every match stores its size, sum of sizes must not exceed target_offset. -+ * -+ * Return: 0 on success, negative errno on failure. -+ */ -+int xt_check_entry_offsets(const void *base, -+ const char *elems, -+ unsigned int target_offset, -+ unsigned int next_offset) -+{ -+ long size_of_base_struct = elems - (const char *)base; -+ const struct xt_entry_target *t; -+ const char *e = base; -+ -+ /* target start is within the ip/ip6/arpt_entry struct */ -+ if (target_offset < size_of_base_struct) -+ return -EINVAL; -+ -+ if (target_offset + sizeof(*t) > next_offset) -+ return -EINVAL; -+ -+ t = (void *)(e + target_offset); -+ if (t->u.target_size < sizeof(*t)) -+ return -EINVAL; -+ -+ if (target_offset + t->u.target_size > next_offset) -+ return -EINVAL; -+ -+ if (strcmp(t->u.user.name, XT_STANDARD_TARGET) == 0 && -+ XT_ALIGN(target_offset + sizeof(struct xt_standard_target)) != next_offset) -+ return -EINVAL; -+ -+ return xt_check_entry_match(elems, base + target_offset, -+ __alignof__(struct xt_entry_match)); -+} -+EXPORT_SYMBOL(xt_check_entry_offsets); -+ - int xt_check_target(struct xt_tgchk_param *par, - unsigned int size, u_int8_t proto, bool inv_proto) - { -@@ -610,6 +771,80 @@ int xt_check_target(struct xt_tgchk_param *par, - } - EXPORT_SYMBOL_GPL(xt_check_target); - -+/** -+ * xt_copy_counters_from_user - copy counters and metadata from userspace -+ * -+ * @user: src pointer to userspace memory -+ * @len: alleged size of userspace memory -+ * @info: where to store the xt_counters_info metadata -+ * @compat: true if we setsockopt call is done by 32bit task on 64bit kernel -+ * -+ * Copies counter meta data from @user and stores it in @info. -+ * -+ * vmallocs memory to hold the counters, then copies the counter data -+ * from @user to the new memory and returns a pointer to it. -+ * -+ * If @compat is true, @info gets converted automatically to the 64bit -+ * representation. -+ * -+ * The metadata associated with the counters is stored in @info. -+ * -+ * Return: returns pointer that caller has to test via IS_ERR(). -+ * If IS_ERR is false, caller has to vfree the pointer. -+ */ -+void *xt_copy_counters_from_user(const void __user *user, unsigned int len, -+ struct xt_counters_info *info, bool compat) -+{ -+ void *mem; -+ u64 size; -+ -+#ifdef CONFIG_COMPAT -+ if (compat) { -+ /* structures only differ in size due to alignment */ -+ struct compat_xt_counters_info compat_tmp; -+ -+ if (len <= sizeof(compat_tmp)) -+ return ERR_PTR(-EINVAL); -+ -+ len -= sizeof(compat_tmp); -+ if (copy_from_user(&compat_tmp, user, sizeof(compat_tmp)) != 0) -+ return ERR_PTR(-EFAULT); -+ -+ strlcpy(info->name, compat_tmp.name, sizeof(info->name)); -+ info->num_counters = compat_tmp.num_counters; -+ user += sizeof(compat_tmp); -+ } else -+#endif -+ { -+ if (len <= sizeof(*info)) -+ return ERR_PTR(-EINVAL); -+ -+ len -= sizeof(*info); -+ if (copy_from_user(info, user, sizeof(*info)) != 0) -+ return ERR_PTR(-EFAULT); -+ -+ info->name[sizeof(info->name) - 1] = '\0'; -+ user += sizeof(*info); -+ } -+ -+ size = sizeof(struct xt_counters); -+ size *= info->num_counters; -+ -+ if (size != (u64)len) -+ return ERR_PTR(-EINVAL); -+ -+ mem = vmalloc(len); -+ if (!mem) -+ return ERR_PTR(-ENOMEM); -+ -+ if (copy_from_user(mem, user, len) == 0) -+ return mem; -+ -+ vfree(mem); -+ return ERR_PTR(-EFAULT); -+} -+EXPORT_SYMBOL_GPL(xt_copy_counters_from_user); -+ - #ifdef CONFIG_COMPAT - int xt_compat_target_offset(const struct xt_target *target) - { -@@ -625,6 +860,7 @@ void xt_compat_target_from_user(struct xt_entry_target *t, void **dstptr, - struct compat_xt_entry_target *ct = (struct compat_xt_entry_target *)t; - int pad, off = xt_compat_target_offset(target); - u_int16_t tsize = ct->u.user.target_size; -+ char name[sizeof(t->u.user.name)]; - - t = *dstptr; - memcpy(t, ct, sizeof(*ct)); -@@ -638,6 +874,9 @@ void xt_compat_target_from_user(struct xt_entry_target *t, void **dstptr, - - tsize += off; - t->u.user.target_size = tsize; -+ strlcpy(name, target->name, sizeof(name)); -+ module_put(target->me); -+ strncpy(t->u.user.name, name, sizeof(t->u.user.name)); - - *size += off; - *dstptr += tsize; -diff --git a/net/netlabel/netlabel_kapi.c b/net/netlabel/netlabel_kapi.c -index 7c94aedd0912..5b1fbe45ff0b 100644 ---- a/net/netlabel/netlabel_kapi.c -+++ b/net/netlabel/netlabel_kapi.c -@@ -700,7 +700,11 @@ socket_setattr_return: - */ - void netlbl_sock_delattr(struct sock *sk) - { -- cipso_v4_sock_delattr(sk); -+ switch (sk->sk_family) { -+ case AF_INET: -+ cipso_v4_sock_delattr(sk); -+ break; -+ } - } - - /** -@@ -879,7 +883,11 @@ req_setattr_return: - */ - void netlbl_req_delattr(struct request_sock *req) - { -- cipso_v4_req_delattr(req); -+ switch (req->rsk_ops->family) { -+ case AF_INET: -+ cipso_v4_req_delattr(req); -+ break; -+ } - } - - /** -diff --git a/net/rfkill/rfkill-regulator.c b/net/rfkill/rfkill-regulator.c -index d11ac79246e4..cf5b145902e5 100644 ---- a/net/rfkill/rfkill-regulator.c -+++ b/net/rfkill/rfkill-regulator.c -@@ -30,6 +30,7 @@ struct rfkill_regulator_data { - static int rfkill_regulator_set_block(void *data, bool blocked) - { - struct rfkill_regulator_data *rfkill_data = data; -+ int ret = 0; - - pr_debug("%s: blocked: %d\n", __func__, blocked); - -@@ -40,15 +41,16 @@ static int rfkill_regulator_set_block(void *data, bool blocked) - } - } else { - if (!rfkill_data->reg_enabled) { -- regulator_enable(rfkill_data->vcc); -- rfkill_data->reg_enabled = true; -+ ret = regulator_enable(rfkill_data->vcc); -+ if (!ret) -+ rfkill_data->reg_enabled = true; - } - } - - pr_debug("%s: regulator_is_enabled after set_block: %d\n", __func__, - regulator_is_enabled(rfkill_data->vcc)); - -- return 0; -+ return ret; - } - - static struct rfkill_ops rfkill_regulator_ops = { -diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c -index 8aab894aeabe..730914cdb7a1 100644 ---- a/net/sctp/sm_sideeffect.c -+++ b/net/sctp/sm_sideeffect.c -@@ -251,12 +251,13 @@ void sctp_generate_t3_rtx_event(unsigned long peer) - int error; - struct sctp_transport *transport = (struct sctp_transport *) peer; - struct sctp_association *asoc = transport->asoc; -- struct net *net = sock_net(asoc->base.sk); -+ struct sock *sk = asoc->base.sk; -+ struct net *net = sock_net(sk); - - /* Check whether a task is in the sock. */ - -- sctp_bh_lock_sock(asoc->base.sk); -- if (sock_owned_by_user(asoc->base.sk)) { -+ sctp_bh_lock_sock(sk); -+ if (sock_owned_by_user(sk)) { - SCTP_DEBUG_PRINTK("%s:Sock is busy.\n", __func__); - - /* Try again later. */ -@@ -279,10 +280,10 @@ void sctp_generate_t3_rtx_event(unsigned long peer) - transport, GFP_ATOMIC); - - if (error) -- asoc->base.sk->sk_err = -error; -+ sk->sk_err = -error; - - out_unlock: -- sctp_bh_unlock_sock(asoc->base.sk); -+ sctp_bh_unlock_sock(sk); - sctp_transport_put(transport); - } - -@@ -292,11 +293,12 @@ out_unlock: - static void sctp_generate_timeout_event(struct sctp_association *asoc, - sctp_event_timeout_t timeout_type) - { -- struct net *net = sock_net(asoc->base.sk); -+ struct sock *sk = asoc->base.sk; -+ struct net *net = sock_net(sk); - int error = 0; - -- sctp_bh_lock_sock(asoc->base.sk); -- if (sock_owned_by_user(asoc->base.sk)) { -+ sctp_bh_lock_sock(sk); -+ if (sock_owned_by_user(sk)) { - SCTP_DEBUG_PRINTK("%s:Sock is busy: timer %d\n", - __func__, - timeout_type); -@@ -320,10 +322,10 @@ static void sctp_generate_timeout_event(struct sctp_association *asoc, - (void *)timeout_type, GFP_ATOMIC); - - if (error) -- asoc->base.sk->sk_err = -error; -+ sk->sk_err = -error; - - out_unlock: -- sctp_bh_unlock_sock(asoc->base.sk); -+ sctp_bh_unlock_sock(sk); - sctp_association_put(asoc); - } - -@@ -373,10 +375,11 @@ void sctp_generate_heartbeat_event(unsigned long data) - int error = 0; - struct sctp_transport *transport = (struct sctp_transport *) data; - struct sctp_association *asoc = transport->asoc; -- struct net *net = sock_net(asoc->base.sk); -+ struct sock *sk = asoc->base.sk; -+ struct net *net = sock_net(sk); - -- sctp_bh_lock_sock(asoc->base.sk); -- if (sock_owned_by_user(asoc->base.sk)) { -+ sctp_bh_lock_sock(sk); -+ if (sock_owned_by_user(sk)) { - SCTP_DEBUG_PRINTK("%s:Sock is busy.\n", __func__); - - /* Try again later. */ -@@ -397,10 +400,10 @@ void sctp_generate_heartbeat_event(unsigned long data) - transport, GFP_ATOMIC); - - if (error) -- asoc->base.sk->sk_err = -error; -+ sk->sk_err = -error; - - out_unlock: -- sctp_bh_unlock_sock(asoc->base.sk); -+ sctp_bh_unlock_sock(sk); - sctp_transport_put(transport); - } - -@@ -411,10 +414,11 @@ void sctp_generate_proto_unreach_event(unsigned long data) - { - struct sctp_transport *transport = (struct sctp_transport *) data; - struct sctp_association *asoc = transport->asoc; -- struct net *net = sock_net(asoc->base.sk); -+ struct sock *sk = asoc->base.sk; -+ struct net *net = sock_net(sk); - -- sctp_bh_lock_sock(asoc->base.sk); -- if (sock_owned_by_user(asoc->base.sk)) { -+ sctp_bh_lock_sock(sk); -+ if (sock_owned_by_user(sk)) { - SCTP_DEBUG_PRINTK("%s:Sock is busy.\n", __func__); - - /* Try again later. */ -@@ -435,7 +439,7 @@ void sctp_generate_proto_unreach_event(unsigned long data) - asoc->state, asoc->ep, asoc, transport, GFP_ATOMIC); - - out_unlock: -- sctp_bh_unlock_sock(asoc->base.sk); -+ sctp_bh_unlock_sock(sk); - sctp_association_put(asoc); - } - -diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c -index 29b4ba93ab3c..62663a08ffbd 100644 ---- a/net/sunrpc/auth_gss/svcauth_gss.c -+++ b/net/sunrpc/auth_gss/svcauth_gss.c -@@ -859,8 +859,8 @@ unwrap_integ_data(struct svc_rqst *rqstp, struct xdr_buf *buf, u32 seq, struct g - goto out; - if (svc_getnl(&buf->head[0]) != seq) - goto out; -- /* trim off the mic at the end before returning */ -- xdr_buf_trim(buf, mic.len + 4); -+ /* trim off the mic and padding at the end before returning */ -+ xdr_buf_trim(buf, round_up_to_quad(mic.len) + 4); - stat = 0; - out: - kfree(mic.data); -diff --git a/scripts/asn1_compiler.c b/scripts/asn1_compiler.c -index db0e5cd34c70..91c4117637ae 100644 ---- a/scripts/asn1_compiler.c -+++ b/scripts/asn1_compiler.c -@@ -1353,6 +1353,8 @@ static void render_out_of_line_list(FILE *out) - render_opcode(out, "ASN1_OP_END_SET_OF%s,\n", act); - render_opcode(out, "_jump_target(%u),\n", entry); - break; -+ default: -+ break; - } - if (e->action) - render_opcode(out, "_action(ACT_%s),\n", -diff --git a/scripts/recordmcount.c b/scripts/recordmcount.c -index ee625e3a56ba..4f7d13da04a5 100644 ---- a/scripts/recordmcount.c -+++ b/scripts/recordmcount.c -@@ -33,10 +33,17 @@ - #include - #include - -+/* -+ * glibc synced up and added the metag number but didn't add the relocations. -+ * Work around this in a crude manner for now. -+ */ - #ifndef EM_METAG --/* Remove this when these make it to the standard system elf.h. */ - #define EM_METAG 174 -+#endif -+#ifndef R_METAG_ADDR32 - #define R_METAG_ADDR32 2 -+#endif -+#ifndef R_METAG_NONE - #define R_METAG_NONE 3 - #endif - -diff --git a/security/keys/key.c b/security/keys/key.c -index 8fb7c7bd4657..6595b2dd89fe 100644 ---- a/security/keys/key.c -+++ b/security/keys/key.c -@@ -580,7 +580,7 @@ int key_reject_and_link(struct key *key, - - mutex_unlock(&key_construction_mutex); - -- if (keyring) -+ if (keyring && link_ret == 0) - __key_link_end(keyring, key->type, prealloc); - - /* wake up anyone waiting for a key to be constructed */ -diff --git a/sound/core/control.c b/sound/core/control.c -index 3fcead61f0ef..251bc575f5c3 100644 ---- a/sound/core/control.c -+++ b/sound/core/control.c -@@ -150,6 +150,8 @@ void snd_ctl_notify(struct snd_card *card, unsigned int mask, - - if (snd_BUG_ON(!card || !id)) - return; -+ if (card->shutdown) -+ return; - read_lock(&card->ctl_files_rwlock); - #if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE) - card->mixer_oss_change_count++; -diff --git a/sound/core/timer.c b/sound/core/timer.c -index 38742e826900..3476895ee1fb 100644 ---- a/sound/core/timer.c -+++ b/sound/core/timer.c -@@ -1208,6 +1208,7 @@ static void snd_timer_user_ccallback(struct snd_timer_instance *timeri, - tu->tstamp = *tstamp; - if ((tu->filter & (1 << event)) == 0 || !tu->tread) - return; -+ memset(&r1, 0, sizeof(r1)); - r1.event = event; - r1.tstamp = *tstamp; - r1.val = resolution; -@@ -1242,6 +1243,7 @@ static void snd_timer_user_tinterrupt(struct snd_timer_instance *timeri, - } - if ((tu->filter & (1 << SNDRV_TIMER_EVENT_RESOLUTION)) && - tu->last_resolution != resolution) { -+ memset(&r1, 0, sizeof(r1)); - r1.event = SNDRV_TIMER_EVENT_RESOLUTION; - r1.tstamp = tstamp; - r1.val = resolution; -@@ -1707,6 +1709,7 @@ static int snd_timer_user_params(struct file *file, - if (tu->timeri->flags & SNDRV_TIMER_IFLG_EARLY_EVENT) { - if (tu->tread) { - struct snd_timer_tread tread; -+ memset(&tread, 0, sizeof(tread)); - tread.event = SNDRV_TIMER_EVENT_EARLY; - tread.tstamp.tv_sec = 0; - tread.tstamp.tv_nsec = 0; -diff --git a/sound/drivers/dummy.c b/sound/drivers/dummy.c -index 982a2c2faf24..7f400a1d42e4 100644 ---- a/sound/drivers/dummy.c -+++ b/sound/drivers/dummy.c -@@ -422,6 +422,7 @@ static int dummy_hrtimer_stop(struct snd_pcm_substream *substream) - - static inline void dummy_hrtimer_sync(struct dummy_hrtimer_pcm *dpcm) - { -+ hrtimer_cancel(&dpcm->timer); - tasklet_kill(&dpcm->tasklet); - } - -diff --git a/sound/pci/au88x0/au88x0_core.c b/sound/pci/au88x0/au88x0_core.c -index ae59dbaa53d9..42d4b13f1fa7 100644 ---- a/sound/pci/au88x0/au88x0_core.c -+++ b/sound/pci/au88x0/au88x0_core.c -@@ -1442,9 +1442,8 @@ static int vortex_wtdma_bufshift(vortex_t * vortex, int wtdma) - int page, p, pp, delta, i; - - page = -- (hwread(vortex->mmio, VORTEX_WTDMA_STAT + (wtdma << 2)) & -- WT_SUBBUF_MASK) -- >> WT_SUBBUF_SHIFT; -+ (hwread(vortex->mmio, VORTEX_WTDMA_STAT + (wtdma << 2)) -+ >> WT_SUBBUF_SHIFT) & WT_SUBBUF_MASK; - if (dma->nr_periods >= 4) - delta = (page - dma->period_real) & 3; - else { -diff --git a/sound/pci/oxygen/oxygen_mixer.c b/sound/pci/oxygen/oxygen_mixer.c -index c0dbb52d45be..1e4bcb900fc6 100644 ---- a/sound/pci/oxygen/oxygen_mixer.c -+++ b/sound/pci/oxygen/oxygen_mixer.c -@@ -88,7 +88,7 @@ static int dac_mute_put(struct snd_kcontrol *ctl, - int changed; - - mutex_lock(&chip->mutex); -- changed = !value->value.integer.value[0] != chip->dac_mute; -+ changed = (!value->value.integer.value[0]) != chip->dac_mute; - if (changed) { - chip->dac_mute = !value->value.integer.value[0]; - chip->model.update_dac_mute(chip); -diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c -index 4f865e122c21..f71c4ad425c6 100644 ---- a/virt/kvm/kvm_main.c -+++ b/virt/kvm/kvm_main.c -@@ -2447,7 +2447,7 @@ static long kvm_vm_ioctl(struct file *filp, - if (copy_from_user(&routing, argp, sizeof(routing))) - goto out; - r = -EINVAL; -- if (routing.nr >= KVM_MAX_IRQ_ROUTES) -+ if (routing.nr > KVM_MAX_IRQ_ROUTES) - goto out; - if (routing.flags) - goto out; diff --git a/patch/kernel/marvell-default/2-patch-3.10.103-104.patch b/patch/kernel/marvell-default/2-patch-3.10.103-104.patch deleted file mode 100644 index 93006a6e4d..0000000000 --- a/patch/kernel/marvell-default/2-patch-3.10.103-104.patch +++ /dev/null @@ -1,478 +0,0 @@ -diff --git a/Makefile b/Makefile -index d3cb458b295a..f6a2cbd438a1 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,6 +1,6 @@ - VERSION = 3 - PATCHLEVEL = 10 --SUBLEVEL = 103 -+SUBLEVEL = 104 - EXTRAVERSION = - NAME = TOSSUG Baby Fish - -diff --git a/arch/mips/kvm/kvm_tlb.c b/arch/mips/kvm/kvm_tlb.c -index 4bee4397dca8..8a47bd96cee3 100644 ---- a/arch/mips/kvm/kvm_tlb.c -+++ b/arch/mips/kvm/kvm_tlb.c -@@ -182,7 +182,7 @@ static int kvm_mips_map_page(struct kvm *kvm, gfn_t gfn) - srcu_idx = srcu_read_lock(&kvm->srcu); - pfn = kvm_mips_gfn_to_pfn(kvm, gfn); - -- if (kvm_mips_is_error_pfn(pfn)) { -+ if (is_error_noslot_pfn(pfn)) { - kvm_err("Couldn't get pfn for gfn %#" PRIx64 "!\n", gfn); - err = -EFAULT; - goto out; -diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c -index a5e339806589..d55357ee9028 100644 ---- a/arch/powerpc/kernel/process.c -+++ b/arch/powerpc/kernel/process.c -@@ -1088,16 +1088,6 @@ void start_thread(struct pt_regs *regs, unsigned long start, unsigned long sp) - current->thread.regs = regs - 1; - } - --#ifdef CONFIG_PPC_TRANSACTIONAL_MEM -- /* -- * Clear any transactional state, we're exec()ing. The cause is -- * not important as there will never be a recheckpoint so it's not -- * user visible. -- */ -- if (MSR_TM_SUSPENDED(mfmsr())) -- tm_reclaim_current(0); --#endif -- - memset(regs->gpr, 0, sizeof(regs->gpr)); - regs->ctr = 0; - regs->link = 0; -diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c -index fcae5fa2e1b3..95b6371e1fe7 100644 ---- a/drivers/acpi/sysfs.c -+++ b/drivers/acpi/sysfs.c -@@ -492,23 +492,22 @@ static void acpi_global_event_handler(u32 event_type, acpi_handle device, - static int get_status(u32 index, acpi_event_status *status, - acpi_handle *handle) - { -- int result = 0; -+ int result; - - if (index >= num_gpes + ACPI_NUM_FIXED_EVENTS) -- goto end; -+ return -EINVAL; - - if (index < num_gpes) { - result = acpi_get_gpe_device(index, handle); - if (result) { - ACPI_EXCEPTION((AE_INFO, AE_NOT_FOUND, - "Invalid GPE 0x%x", index)); -- goto end; -+ return result; - } - result = acpi_get_gpe_status(*handle, index, status); - } else if (index < (num_gpes + ACPI_NUM_FIXED_EVENTS)) - result = acpi_get_event_status(index - num_gpes, status); - --end: - return result; - } - -diff --git a/drivers/crypto/nx/nx.c b/drivers/crypto/nx/nx.c -index bbdab6e5ccf0..fe689643a5ad 100644 ---- a/drivers/crypto/nx/nx.c -+++ b/drivers/crypto/nx/nx.c -@@ -309,7 +309,7 @@ static void nx_of_update_msc(struct device *dev, - ((bytes_so_far + sizeof(struct msc_triplet)) <= lenp) && - i < msc->triplets; - i++) { -- if (msc->fc > NX_MAX_FC || msc->mode > NX_MAX_MODE) { -+ if (msc->fc >= NX_MAX_FC || msc->mode >= NX_MAX_MODE) { - dev_err(dev, "unknown function code/mode " - "combo: %d/%d (ignored)\n", msc->fc, - msc->mode); -diff --git a/drivers/net/xen-netback/common.h b/drivers/net/xen-netback/common.h -index f2faa779e3fe..dd6b7c362813 100644 ---- a/drivers/net/xen-netback/common.h -+++ b/drivers/net/xen-netback/common.h -@@ -66,6 +66,8 @@ struct xenvif { - /* The shared rings and indexes. */ - struct xen_netif_tx_back_ring tx; - struct xen_netif_rx_back_ring rx; -+ atomic_t ring_refcnt; -+ wait_queue_head_t waiting_to_unmap; - - /* Frontend feature information. */ - u8 can_sg:1; -@@ -120,6 +122,8 @@ void xenvif_free(struct xenvif *vif); - - void xenvif_get(struct xenvif *vif); - void xenvif_put(struct xenvif *vif); -+void xenvif_get_rings(struct xenvif *vif); -+void xenvif_put_rings(struct xenvif *vif); - - int xenvif_xenbus_init(void); - -diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c -index 540a796593a3..7e3817a55e77 100644 ---- a/drivers/net/xen-netback/interface.c -+++ b/drivers/net/xen-netback/interface.c -@@ -44,12 +44,23 @@ void xenvif_get(struct xenvif *vif) - atomic_inc(&vif->refcnt); - } - -+void xenvif_get_rings(struct xenvif *vif) -+{ -+ atomic_inc(&vif->ring_refcnt); -+} -+ - void xenvif_put(struct xenvif *vif) - { - if (atomic_dec_and_test(&vif->refcnt)) - wake_up(&vif->waiting_to_free); - } - -+void xenvif_put_rings(struct xenvif *vif) -+{ -+ if (atomic_dec_and_test(&vif->ring_refcnt)) -+ wake_up(&vif->waiting_to_unmap); -+} -+ - int xenvif_schedulable(struct xenvif *vif) - { - return netif_running(vif->dev) && netif_carrier_ok(vif->dev); -@@ -91,6 +102,7 @@ static int xenvif_start_xmit(struct sk_buff *skb, struct net_device *dev) - /* Reserve ring slots for the worst-case number of fragments. */ - vif->rx_req_cons_peek += xen_netbk_count_skb_slots(vif, skb); - xenvif_get(vif); -+ xenvif_get_rings(vif); - - if (vif->can_queue && xen_netbk_must_stop_queue(vif)) - netif_stop_queue(dev); -@@ -271,6 +283,7 @@ struct xenvif *xenvif_alloc(struct device *parent, domid_t domid, - vif->dev = dev; - INIT_LIST_HEAD(&vif->schedule_list); - INIT_LIST_HEAD(&vif->notify_list); -+ init_waitqueue_head(&vif->waiting_to_unmap); - - vif->credit_bytes = vif->remaining_credit = ~0UL; - vif->credit_usec = 0UL; -@@ -365,12 +378,12 @@ void xenvif_disconnect(struct xenvif *vif) - if (netif_carrier_ok(vif->dev)) - xenvif_carrier_off(vif); - -+ disable_irq(vif->irq); -+ xen_netbk_unmap_frontend_rings(vif); - if (vif->irq) { - unbind_from_irqhandler(vif->irq, vif); - vif->irq = 0; - } -- -- xen_netbk_unmap_frontend_rings(vif); - } - - void xenvif_free(struct xenvif *vif) -diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c -index 70b830f6c4bf..1595f818b8c0 100644 ---- a/drivers/net/xen-netback/netback.c -+++ b/drivers/net/xen-netback/netback.c -@@ -814,6 +814,7 @@ static void xen_netbk_rx_action(struct xen_netbk *netbk) - xenvif_put(vif); - npo.meta_cons += sco->meta_slots_used; - dev_kfree_skb(skb); -+ xenvif_put_rings(vif); - } - - list_for_each_entry_safe(vif, tmp, ¬ify, notify_list) { -@@ -1864,6 +1865,9 @@ static int xen_netbk_kthread(void *data) - - void xen_netbk_unmap_frontend_rings(struct xenvif *vif) - { -+ atomic_dec(&vif->ring_refcnt); -+ wait_event(vif->waiting_to_unmap, atomic_read(&vif->ring_refcnt) == 0); -+ - if (vif->tx.sring) - xenbus_unmap_ring_vfree(xenvif_to_xenbus_device(vif), - vif->tx.sring); -@@ -1882,6 +1886,8 @@ int xen_netbk_map_frontend_rings(struct xenvif *vif, - - int err = -ENOMEM; - -+ atomic_set(&vif->ring_refcnt, 1); -+ - err = xenbus_map_ring_valloc(xenvif_to_xenbus_device(vif), - tx_ring_ref, &addr); - if (err) -diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c -index 689f3c87ee5c..aee15ce8cfce 100644 ---- a/drivers/pci/pci-sysfs.c -+++ b/drivers/pci/pci-sysfs.c -@@ -1308,10 +1308,10 @@ int __must_check pci_create_sysfs_dev_files (struct pci_dev *pdev) - if (!sysfs_initialized) - return -EACCES; - -- if (pdev->cfg_size < PCI_CFG_SPACE_EXP_SIZE) -- retval = sysfs_create_bin_file(&pdev->dev.kobj, &pci_config_attr); -- else -+ if (pdev->cfg_size > PCI_CFG_SPACE_SIZE) - retval = sysfs_create_bin_file(&pdev->dev.kobj, &pcie_config_attr); -+ else -+ retval = sysfs_create_bin_file(&pdev->dev.kobj, &pci_config_attr); - if (retval) - goto err; - -@@ -1368,10 +1368,10 @@ err_rom_file: - err_resource_files: - pci_remove_resource_files(pdev); - err_config_file: -- if (pdev->cfg_size < PCI_CFG_SPACE_EXP_SIZE) -- sysfs_remove_bin_file(&pdev->dev.kobj, &pci_config_attr); -- else -+ if (pdev->cfg_size > PCI_CFG_SPACE_SIZE) - sysfs_remove_bin_file(&pdev->dev.kobj, &pcie_config_attr); -+ else -+ sysfs_remove_bin_file(&pdev->dev.kobj, &pci_config_attr); - err: - return retval; - } -@@ -1405,10 +1405,10 @@ void pci_remove_sysfs_dev_files(struct pci_dev *pdev) - - pci_remove_capabilities_sysfs(pdev); - -- if (pdev->cfg_size < PCI_CFG_SPACE_EXP_SIZE) -- sysfs_remove_bin_file(&pdev->dev.kobj, &pci_config_attr); -- else -+ if (pdev->cfg_size > PCI_CFG_SPACE_SIZE) - sysfs_remove_bin_file(&pdev->dev.kobj, &pcie_config_attr); -+ else -+ sysfs_remove_bin_file(&pdev->dev.kobj, &pci_config_attr); - - pci_remove_resource_files(pdev); - -diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c -index 390e4094e4d5..a6637158d078 100644 ---- a/drivers/pci/quirks.c -+++ b/drivers/pci/quirks.c -@@ -292,6 +292,18 @@ static void quirk_citrine(struct pci_dev *dev) - } - DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_CITRINE, quirk_citrine); - -+/* -+ * This chip can cause bus lockups if config addresses above 0x600 -+ * are read or written. -+ */ -+static void quirk_nfp6000(struct pci_dev *dev) -+{ -+ dev->cfg_size = 0x600; -+} -+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NETRONOME, PCI_DEVICE_ID_NETRONOME_NFP4000, quirk_nfp6000); -+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NETRONOME, PCI_DEVICE_ID_NETRONOME_NFP6000, quirk_nfp6000); -+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NETRONOME, PCI_DEVICE_ID_NETRONOME_NFP6000_VF, quirk_nfp6000); -+ - /* On IBM Crocodile ipr SAS adapters, expand BAR to system page size */ - static void quirk_extend_bar_to_page(struct pci_dev *dev) - { -diff --git a/drivers/scsi/aacraid/commctrl.c b/drivers/scsi/aacraid/commctrl.c -index ee6caddd978c..d6fcadd7de2c 100644 ---- a/drivers/scsi/aacraid/commctrl.c -+++ b/drivers/scsi/aacraid/commctrl.c -@@ -63,7 +63,7 @@ static int ioctl_send_fib(struct aac_dev * dev, void __user *arg) - struct fib *fibptr; - struct hw_fib * hw_fib = (struct hw_fib *)0; - dma_addr_t hw_fib_pa = (dma_addr_t)0LL; -- unsigned size; -+ unsigned int size, osize; - int retval; - - if (dev->in_reset) { -@@ -87,7 +87,8 @@ static int ioctl_send_fib(struct aac_dev * dev, void __user *arg) - * will not overrun the buffer when we copy the memory. Return - * an error if we would. - */ -- size = le16_to_cpu(kfib->header.Size) + sizeof(struct aac_fibhdr); -+ osize = size = le16_to_cpu(kfib->header.Size) + -+ sizeof(struct aac_fibhdr); - if (size < le16_to_cpu(kfib->header.SenderSize)) - size = le16_to_cpu(kfib->header.SenderSize); - if (size > dev->max_fib_size) { -@@ -118,6 +119,14 @@ static int ioctl_send_fib(struct aac_dev * dev, void __user *arg) - goto cleanup; - } - -+ /* Sanity check the second copy */ -+ if ((osize != le16_to_cpu(kfib->header.Size) + -+ sizeof(struct aac_fibhdr)) -+ || (size < le16_to_cpu(kfib->header.SenderSize))) { -+ retval = -EINVAL; -+ goto cleanup; -+ } -+ - if (kfib->header.Command == cpu_to_le16(TakeABreakPt)) { - aac_adapter_interrupt(dev); - /* -diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c -index e6dfa8108301..6ced6a398d60 100644 ---- a/drivers/scsi/megaraid/megaraid_sas_base.c -+++ b/drivers/scsi/megaraid/megaraid_sas_base.c -@@ -3470,7 +3470,7 @@ static int megasas_init_fw(struct megasas_instance *instance) - /* Find first memory bar */ - bar_list = pci_select_bars(instance->pdev, IORESOURCE_MEM); - instance->bar = find_first_bit(&bar_list, sizeof(unsigned long)); -- if (pci_request_selected_regions(instance->pdev, instance->bar, -+ if (pci_request_selected_regions(instance->pdev, 1<bar, - "megasas: LSI")) { - printk(KERN_DEBUG "megasas: IO memory region busy!\n"); - return -EBUSY; -@@ -3640,7 +3640,7 @@ fail_ready_state: - iounmap(instance->reg_set); - - fail_ioremap: -- pci_release_selected_regions(instance->pdev, instance->bar); -+ pci_release_selected_regions(instance->pdev, 1<bar); - - return -EINVAL; - } -@@ -3661,7 +3661,7 @@ static void megasas_release_mfi(struct megasas_instance *instance) - - iounmap(instance->reg_set); - -- pci_release_selected_regions(instance->pdev, instance->bar); -+ pci_release_selected_regions(instance->pdev, 1<bar); - } - - /** -diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c -index a7d56687bfca..d478088ce5cf 100644 ---- a/drivers/scsi/megaraid/megaraid_sas_fusion.c -+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c -@@ -2020,7 +2020,7 @@ megasas_release_fusion(struct megasas_instance *instance) - - iounmap(instance->reg_set); - -- pci_release_selected_regions(instance->pdev, instance->bar); -+ pci_release_selected_regions(instance->pdev, 1<bar); - } - - /** -diff --git a/drivers/staging/comedi/drivers/daqboard2000.c b/drivers/staging/comedi/drivers/daqboard2000.c -index b87f95c3e17d..1465a26b15cf 100644 ---- a/drivers/staging/comedi/drivers/daqboard2000.c -+++ b/drivers/staging/comedi/drivers/daqboard2000.c -@@ -678,7 +678,7 @@ static const void *daqboard2000_find_boardinfo(struct comedi_device *dev, - const struct daq200_boardtype *board; - int i; - -- if (pcidev->subsystem_device != PCI_VENDOR_ID_IOTECH) -+ if (pcidev->subsystem_vendor != PCI_VENDOR_ID_IOTECH) - return NULL; - - for (i = 0; i < ARRAY_SIZE(boardtypes); i++) { -diff --git a/include/linux/mm.h b/include/linux/mm.h -index 53b0d70120a1..55590f4fe110 100644 ---- a/include/linux/mm.h -+++ b/include/linux/mm.h -@@ -1715,6 +1715,7 @@ static inline struct page *follow_page(struct vm_area_struct *vma, - #define FOLL_HWPOISON 0x100 /* check page is hwpoisoned */ - #define FOLL_NUMA 0x200 /* force NUMA hinting page fault */ - #define FOLL_MIGRATION 0x400 /* wait for page to replace migration entry */ -+#define FOLL_COW 0x4000 /* internal GUP flag */ - - typedef int (*pte_fn_t)(pte_t *pte, pgtable_t token, unsigned long addr, - void *data); -diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h -index 6c7bb35ad6d1..302182a2f99d 100644 ---- a/include/linux/pci_ids.h -+++ b/include/linux/pci_ids.h -@@ -2472,6 +2472,13 @@ - #define PCI_DEVICE_ID_KORENIX_JETCARDF2 0x1700 - #define PCI_DEVICE_ID_KORENIX_JETCARDF3 0x17ff - -+#define PCI_VENDOR_ID_NETRONOME 0x19ee -+#define PCI_DEVICE_ID_NETRONOME_NFP3200 0x3200 -+#define PCI_DEVICE_ID_NETRONOME_NFP3240 0x3240 -+#define PCI_DEVICE_ID_NETRONOME_NFP4000 0x4000 -+#define PCI_DEVICE_ID_NETRONOME_NFP6000 0x6000 -+#define PCI_DEVICE_ID_NETRONOME_NFP6000_VF 0x6003 -+ - #define PCI_VENDOR_ID_QMI 0x1a32 - - #define PCI_VENDOR_ID_AZWAVE 0x1a3b -diff --git a/mm/memory.c b/mm/memory.c -index 30bf9cce8c2b..2ca2ee113ea2 100644 ---- a/mm/memory.c -+++ b/mm/memory.c -@@ -1462,6 +1462,16 @@ int zap_vma_ptes(struct vm_area_struct *vma, unsigned long address, - } - EXPORT_SYMBOL_GPL(zap_vma_ptes); - -+/* -+ * FOLL_FORCE can write to even unwritable pte's, but only -+ * after we've gone through a COW cycle and they are dirty. -+ */ -+static inline bool can_follow_write_pte(pte_t pte, unsigned int flags) -+{ -+ return pte_write(pte) || -+ ((flags & FOLL_FORCE) && (flags & FOLL_COW) && pte_dirty(pte)); -+} -+ - /** - * follow_page_mask - look up a page descriptor from a user-virtual address - * @vma: vm_area_struct mapping @address -@@ -1569,7 +1579,7 @@ split_fallthrough: - } - if ((flags & FOLL_NUMA) && pte_numa(pte)) - goto no_page; -- if ((flags & FOLL_WRITE) && !pte_write(pte)) -+ if ((flags & FOLL_WRITE) && !can_follow_write_pte(pte, flags)) - goto unlock; - - page = vm_normal_page(vma, address, pte); -@@ -1877,7 +1887,7 @@ long __get_user_pages(struct task_struct *tsk, struct mm_struct *mm, - */ - if ((ret & VM_FAULT_WRITE) && - !(vma->vm_flags & VM_WRITE)) -- foll_flags &= ~FOLL_WRITE; -+ foll_flags |= FOLL_COW; - - cond_resched(); - } -@@ -3834,8 +3844,18 @@ retry: - if (unlikely(pmd_none(*pmd)) && - unlikely(__pte_alloc(mm, vma, pmd, address))) - return VM_FAULT_OOM; -- /* if an huge pmd materialized from under us just retry later */ -- if (unlikely(pmd_trans_huge(*pmd))) -+ /* -+ * If a huge pmd materialized under us just retry later. Use -+ * pmd_trans_unstable() instead of pmd_trans_huge() to ensure the pmd -+ * didn't become pmd_trans_huge under us and then back to pmd_none, as -+ * a result of MADV_DONTNEED running immediately after a huge pmd fault -+ * in a different thread of this mm, in turn leading to a misleading -+ * pmd_trans_huge() retval. All we have to ensure is that it is a -+ * regular pmd that we can walk with pte_offset_map() and we can do that -+ * through an atomic read in C, which is what pmd_trans_unstable() -+ * provides. -+ */ -+ if (unlikely(pmd_trans_unstable(pmd))) - return 0; - /* - * A regular pmd is established and it can't morph into a huge pmd -diff --git a/security/yama/yama_lsm.c b/security/yama/yama_lsm.c -index 13c88fbcf037..0038834b558e 100644 ---- a/security/yama/yama_lsm.c -+++ b/security/yama/yama_lsm.c -@@ -292,7 +292,7 @@ int yama_ptrace_access_check(struct task_struct *child, - return rc; - - /* require ptrace target be a child of ptracer on attach */ -- if (mode == PTRACE_MODE_ATTACH) { -+ if (mode & PTRACE_MODE_ATTACH) { - switch (ptrace_scope) { - case YAMA_SCOPE_DISABLED: - /* No additional restrictions. */ -@@ -318,7 +318,7 @@ int yama_ptrace_access_check(struct task_struct *child, - } - } - -- if (rc) { -+ if (rc && (mode & PTRACE_MODE_NOAUDIT) == 0) { - printk_ratelimited(KERN_NOTICE - "ptrace of pid %d was attempted by: %s (pid %d)\n", - child->pid, current->comm, current->pid); diff --git a/patch/kernel/marvell-default/3-overlay-fix.patch b/patch/kernel/marvell-default/3-overlay-fix.patch deleted file mode 100644 index 910482925c..0000000000 --- a/patch/kernel/marvell-default/3-overlay-fix.patch +++ /dev/null @@ -1,28 +0,0 @@ -From: Sedat Dilek - -With OverlayFS v22 I get the following build error when -CONFIG_OVERLAYFS_FS=m - -ERROR: "d_ancestor" [fs/overlayfs/overlayfs.ko] undefined! - -Fix this by adding the missing export. - -Signed-off-by: Miklos Szeredi ---- - fs/dcache.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/fs/dcache.c b/fs/dcache.c -index 42ae01eefc07..b233bfc849de 100644 ---- a/fs/dcache.c -+++ b/fs/dcache.c -@@ -2559,6 +2559,7 @@ struct dentry *d_ancestor(struct dentry *p1, struct dentry *p2) - } - return NULL; - } -+EXPORT_SYMBOL(d_ancestor); - - /* - * This helper attempts to cope with remotely renamed directories --- -1.8.1.4 diff --git a/patch/kernel/marvell-default/403-ath_regd_optional.patch b/patch/kernel/marvell-default/403-ath_regd_optional.patch deleted file mode 100644 index 8c79e47e69..0000000000 --- a/patch/kernel/marvell-default/403-ath_regd_optional.patch +++ /dev/null @@ -1,58 +0,0 @@ ---- a/drivers/net/wireless/ath/regd.c -+++ b/drivers/net/wireless/ath/regd.c -@@ -341,6 +341,10 @@ ath_reg_apply_beaconing_flags(struct wip - struct ieee80211_channel *ch; - unsigned int i; - -+#ifdef CPTCFG_ATH_USER_REGD -+ return; -+#endif -+ - for (band = 0; band < IEEE80211_NUM_BANDS; band++) { - if (!wiphy->bands[band]) - continue; -@@ -374,6 +378,10 @@ ath_reg_apply_ir_flags(struct wiphy *wip - { - struct ieee80211_supported_band *sband; - -+#ifdef CPTCFG_ATH_USER_REGD -+ return; -+#endif -+ - sband = wiphy->bands[IEEE80211_BAND_2GHZ]; - if (!sband) - return; -@@ -402,6 +410,10 @@ static void ath_reg_apply_radar_flags(st - struct ieee80211_channel *ch; - unsigned int i; - -+#ifdef CPTCFG_ATH_USER_REGD -+ return; -+#endif -+ - if (!wiphy->bands[IEEE80211_BAND_5GHZ]) - return; - -@@ -631,6 +643,10 @@ ath_regd_init_wiphy(struct ath_regulator - { - const struct ieee80211_regdomain *regd; - -+#ifdef CPTCFG_ATH_USER_REGD -+ return 0; -+#endif -+ - wiphy->reg_notifier = reg_notifier; - wiphy->regulatory_flags |= REGULATORY_STRICT_REG | - REGULATORY_CUSTOM_REG; ---- a/drivers/net/wireless/ath/Kconfig -+++ b/drivers/net/wireless/ath/Kconfig -@@ -21,6 +21,9 @@ menuconfig ATH_CARDS - - if ATH_CARDS - -+config ATH_USER_REGD -+ bool "Do not enforce EEPROM regulatory restrictions" -+ - config ATH_DEBUG - bool "Atheros wireless debugging" - ---help--- \ No newline at end of file diff --git a/patch/kernel/marvell-default/add-clearfog-base-dts.patch b/patch/kernel/marvell-default/add-clearfog-base-dts.patch deleted file mode 100644 index 294a8356b8..0000000000 --- a/patch/kernel/marvell-default/add-clearfog-base-dts.patch +++ /dev/null @@ -1,190 +0,0 @@ -diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile -index 04f1729..df7fade 100644 ---- a/arch/arm/boot/dts/Makefile -+++ b/arch/arm/boot/dts/Makefile -@@ -96,7 +96,8 @@ dtb-$(CONFIG_ARCH_MVEBU) += armada-38x-modular.dtb \ - armada-385-customer1.dtb \ - armada-382-customer2.dtb \ - armada-385-customer3.dtb \ -- armada-388-clearfog.dtb -+ armada-388-clearfog.dtb \ -+ armada-388-clearfog-base.dtb - dtb-$(CONFIG_ARCH_MXC) += \ - imx25-karo-tx25.dtb \ - imx25-pdk.dtb \ -diff --git a/arch/arm/boot/dts/armada-388-clearfog-base.dts b/arch/arm/boot/dts/armada-388-clearfog-base.dts -new file mode 100644 -index 0000000..5f036ee ---- /dev/null -+++ b/arch/arm/boot/dts/armada-388-clearfog-base.dts -@@ -0,0 +1,170 @@ -+/* -+ * Device Tree file for SolidRun's ClearFog-a1 board -+ * -+ * Rabeeh Khoury -+ * -+ * This file is dual-licensed: you can use it either under the terms -+ * of the GPL or the X11 license, at your option. Note that this dual -+ * licensing only applies to this file, and not this project as a -+ * whole. -+ * -+ * a) This file is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. -+ * -+ * This file is distributed in the hope that it will be useful -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * Or, alternatively -+ * -+ * b) Permission is hereby granted, free of charge, to any person -+ * obtaining a copy of this software and associated documentation -+ * files (the "Software"), to deal in the Software without -+ * restriction, including without limitation the rights to use -+ * copy, modify, merge, publish, distribute, sublicense, and/or -+ * sell copies of the Software, and to permit persons to whom the -+ * Software is furnished to do so, subject to the following -+ * conditions: -+ * -+ * The above copyright notice and this permission notice shall be -+ * included in all copies or substantial portions of the Software. -+ * -+ * THE SOFTWARE IS PROVIDED , WITHOUT WARRANTY OF ANY KIND -+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY -+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -+ * OTHER DEALINGS IN THE SOFTWARE. -+*/ -+ -+/dts-v1/; -+#include -+#include "armada-385-388.dtsi" -+ -+/ { -+ model = "SolidRun ClearFog a1 board"; -+ compatible = "marvell,a388-db-gp", "marvell,armada388", "marvell,armada38x"; -+ -+ chosen { -+ bootargs = "console=ttyS0,115200 earlyprintk"; -+ }; -+ -+ memory { -+ device_type = "memory"; -+ reg = <0x00000000 0x10000000>; /* 256 MB */ -+ }; -+ -+ soc { -+ internal-regs { -+ ethernet@70000 { -+ status = "okay"; -+ phy = <&phy0>; -+ phy-mode = "rgmii"; -+ }; -+ -+ ethernet@30000 { -+ status = "okay"; -+ phy = <&phy1>; -+ phy-mode = "sgmii"; -+ }; -+ -+ ethernet@34000 { -+ status = "okay"; -+ phy = <&phy2>; -+ phy-mode = "sgmii"; -+ }; -+ -+ i2c0: i2c@11000 { -+ status = "okay"; -+ clock-frequency = <100000>; -+ }; -+ -+ i2c1: i2c@11100 { -+ status = "okay"; -+ clock-frequency = <100000>; -+ }; -+ -+ mdio { -+ phy0: ethernet-phy@0 { -+ reg = <0>; -+ }; -+ phy1: ethernet-phy@1 { -+ reg = <1>; -+ }; -+ phy2: ethernet-phy@2 { -+ reg = <999>; -+ }; -+ }; -+ -+ sata@a8000 { -+ status = "okay"; -+ }; -+ -+ sata@e0000 { -+ status = "okay"; -+ }; -+ -+ tdm@b0000 { -+ pinctrl-0 = <&tdm_pins>; -+ pinctrl-names = "default"; -+ pclk-freq-mhz = <8>; -+ }; -+ -+ sdhci@d8000 { -+ broken-cd; -+ wp-inverted; -+ bus-width = <4>; -+ status = "okay"; -+ no-1-8-v; -+ }; -+ -+ serial@12000 { -+ status = "okay"; -+ }; -+ -+ serial@12100 { -+ status = "okay"; -+ }; -+ -+ spi1: spi@10680 { -+ pinctrl-0 = <&spi1_pins>; -+ pinctrl-names = "default"; -+ status = "okay"; -+ -+ spi-flash@0 { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ compatible = "w25q32"; -+ reg = <0>; /* Chip select 0 */ -+ spi-max-frequency = <3000000>; -+ }; -+ slic@0 { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ compatible = "mv_slic"; -+ reg = <1>; /* Chip select 1 */ -+ spi-max-frequency = <3000000>; -+ spi-1byte-cs; -+ spi-cpol; -+ spi-cpha; -+ }; -+ }; -+ -+ crypto@9D000 { -+ status = "okay"; -+ }; -+ }; -+ -+ pcie-controller { -+ status = "okay"; -+ pcie@2,0 { -+ /* Port 1, Lane 0 */ -+ status = "okay"; -+ }; -+ }; -+ }; -+}; diff --git a/patch/kernel/marvell-default/fbtft_drivers.patch b/patch/kernel/marvell-default/fbtft_drivers.patch deleted file mode 100644 index 8ecb55230a..0000000000 --- a/patch/kernel/marvell-default/fbtft_drivers.patch +++ /dev/null @@ -1,12012 +0,0 @@ -diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig -index 03bed11..48f1f71 100644 ---- a/drivers/video/Kconfig -+++ b/drivers/video/Kconfig -@@ -17,6 +17,8 @@ config SH_LCD_MIPI_DSI - - source "drivers/char/agp/Kconfig" - -+source "drivers/video/fbtft/Kconfig" -+ - source "drivers/gpu/vga/Kconfig" - - source "drivers/gpu/host1x/Kconfig" -diff --git a/drivers/video/Makefile b/drivers/video/Makefile -index 07905d0..14810e4 100644 ---- a/drivers/video/Makefile -+++ b/drivers/video/Makefile -@@ -4,6 +4,7 @@ - - # Each configuration option enables a list of files. - -+obj-y += fbtft/ - obj-$(CONFIG_VGASTATE) += vgastate.o - obj-$(CONFIG_HDMI) += hdmi.o - obj-y += fb_notify.o -diff --git a/drivers/video/fbtft/Kconfig b/drivers/video/fbtft/Kconfig -new file mode 100644 -index 0000000..995a910 ---- /dev/null -+++ b/drivers/video/fbtft/Kconfig -@@ -0,0 +1,169 @@ -+menuconfig FB_TFT -+ tristate "Support for small TFT LCD display modules" -+ depends on FB && SPI && GPIOLIB -+ select FB_SYS_FILLRECT -+ select FB_SYS_COPYAREA -+ select FB_SYS_IMAGEBLIT -+ select FB_SYS_FOPS -+ select FB_DEFERRED_IO -+ select FB_BACKLIGHT -+ -+config FB_TFT_AGM1264K_FL -+ tristate "FB driver for the AGM1264K-FL LCD display" -+ depends on FB_TFT -+ help -+ Framebuffer support for the AGM1264K-FL LCD display (two Samsung KS0108 compatable chips) -+ -+config FB_TFT_BD663474 -+ tristate "FB driver for the BD663474 LCD Controller" -+ depends on FB_TFT -+ help -+ Generic Framebuffer support for BD663474 -+ -+config FB_TFT_HX8340BN -+ tristate "FB driver for the HX8340BN LCD Controller" -+ depends on FB_TFT -+ help -+ Generic Framebuffer support for HX8340BN -+ -+config FB_TFT_HX8347D -+ tristate "FB driver for the HX8347D LCD Controller" -+ depends on FB_TFT -+ help -+ Generic Framebuffer support for HX8347D -+ -+config FB_TFT_HX8353D -+ tristate "FB driver for the HX8353D LCD Controller" -+ depends on FB_TFT -+ help -+ Generic Framebuffer support for HX8353D -+ -+config FB_TFT_ILI9320 -+ tristate "FB driver for the ILI9320 LCD Controller" -+ depends on FB_TFT -+ help -+ Generic Framebuffer support for ILI9320 -+ -+config FB_TFT_ILI9325 -+ tristate "FB driver for the ILI9325 LCD Controller" -+ depends on FB_TFT -+ help -+ Generic Framebuffer support for ILI9325 -+ -+config FB_TFT_ILI9340 -+ tristate "FB driver for the ILI9340 LCD Controller" -+ depends on FB_TFT -+ help -+ Generic Framebuffer support for ILI9340 -+ -+config FB_TFT_ILI9341 -+ tristate "FB driver for the ILI9341 LCD Controller" -+ depends on FB_TFT -+ help -+ Generic Framebuffer support for ILI9341 -+ -+config FB_TFT_ILI9481 -+ tristate "FB driver for the ILI9481 LCD Controller" -+ depends on FB_TFT -+ help -+ Generic Framebuffer support for ILI9481 -+ -+config FB_TFT_ILI9486 -+ tristate "FB driver for the ILI9486 LCD Controller" -+ depends on FB_TFT -+ help -+ Generic Framebuffer support for ILI9486 -+ -+config FB_TFT_PCD8544 -+ tristate "FB driver for the PCD8544 LCD Controller" -+ depends on FB_TFT -+ help -+ Generic Framebuffer support for PCD8544 -+ -+config FB_TFT_RA8875 -+ tristate "FB driver for the RA8875 LCD Controller" -+ depends on FB_TFT -+ help -+ Generic Framebuffer support for RA8875 -+ -+config FB_TFT_S6D02A1 -+ tristate "FB driver for the S6D02A1 LCD Controller" -+ depends on FB_TFT -+ help -+ Generic Framebuffer support for S6D02A1 -+ -+config FB_TFT_S6D1121 -+ tristate "FB driver for the S6D1211 LCD Controller" -+ depends on FB_TFT -+ help -+ Generic Framebuffer support for S6D1121 -+ -+config FB_TFT_SSD1289 -+ tristate "FB driver for the SSD1289 LCD Controller" -+ depends on FB_TFT -+ help -+ Framebuffer support for SSD1289 -+ -+config FB_TFT_SSD1306 -+ tristate "FB driver for the SSD1306 OLED Controller" -+ depends on FB_TFT -+ help -+ Framebuffer support for SSD1306 -+ -+config FB_TFT_SSD1331 -+ tristate "FB driver for the SSD1331 LCD Controller" -+ depends on FB_TFT -+ help -+ Framebuffer support for SSD1331 -+ -+config FB_TFT_SSD1351 -+ tristate "FB driver for the SSD1351 LCD Controller" -+ depends on FB_TFT -+ help -+ Framebuffer support for SSD1351 -+ -+config FB_TFT_ST7735R -+ tristate "FB driver for the ST7735R LCD Controller" -+ depends on FB_TFT -+ help -+ Generic Framebuffer support for ST7735R -+ -+config FB_TFT_TINYLCD -+ tristate "FB driver for tinylcd.com display" -+ depends on FB_TFT -+ help -+ Custom Framebuffer support for tinylcd.com display -+ -+config FB_TFT_TLS8204 -+ tristate "FB driver for the TLS8204 LCD Controller" -+ depends on FB_TFT -+ help -+ Generic Framebuffer support for TLS8204 -+ -+config FB_TFT_UC1701 -+ tristate "FB driver for the UC1701 LCD Controller" -+ depends on FB_TFT -+ help -+ Generic Framebuffer support for UC1701 -+ -+config FB_TFT_UPD161704 -+ tristate "FB driver for the uPD161704 LCD Controller" -+ depends on FB_TFT -+ help -+ Generic Framebuffer support for uPD161704 -+ -+config FB_TFT_WATTEROTT -+ tristate "FB driver for the WATTEROTT LCD Controller" -+ depends on FB_TFT -+ help -+ Generic Framebuffer support for WATTEROTT -+ -+config FB_FLEX -+ tristate "Generic FB driver for TFT LCD displays" -+ depends on FB_TFT -+ help -+ Generic Framebuffer support for TFT LCD displays. -+ -+config FB_TFT_FBTFT_DEVICE -+ tristate "Module to for adding FBTFT devices" -+ depends on FB_TFT -diff --git a/drivers/video/fbtft/Makefile b/drivers/video/fbtft/Makefile -new file mode 100644 -index 0000000..71c755d ---- /dev/null -+++ b/drivers/video/fbtft/Makefile -@@ -0,0 +1,60 @@ -+ifneq ($(KERNELRELEASE),) -+# kbuild part of makefile -+ -+# Optionally, include config file to allow out of tree kernel modules build -+-include $(src)/.config -+ -+# Core module -+obj-$(CONFIG_FB_TFT) += fbtft.o -+fbtft-y += fbtft-core.o fbtft-sysfs.o fbtft-bus.o fbtft-io.o -+ -+# drivers -+obj-$(CONFIG_FB_TFT_AGM1264K_FL) += fb_agm1264k-fl.o -+obj-$(CONFIG_FB_TFT_BD663474) += fb_bd663474.o -+obj-$(CONFIG_FB_TFT_HX8340BN) += fb_hx8340bn.o -+obj-$(CONFIG_FB_TFT_HX8347D) += fb_hx8347d.o -+obj-$(CONFIG_FB_TFT_HX8353D) += fb_hx8353d.o -+obj-$(CONFIG_FB_TFT_ILI9320) += fb_ili9320.o -+obj-$(CONFIG_FB_TFT_ILI9325) += fb_ili9325.o -+obj-$(CONFIG_FB_TFT_ILI9340) += fb_ili9340.o -+obj-$(CONFIG_FB_TFT_ILI9341) += fb_ili9341.o -+obj-$(CONFIG_FB_TFT_ILI9481) += fb_ili9481.o -+obj-$(CONFIG_FB_TFT_ILI9486) += fb_ili9486.o -+obj-$(CONFIG_FB_TFT_PCD8544) += fb_pcd8544.o -+obj-$(CONFIG_FB_TFT_RA8875) += fb_ra8875.o -+obj-$(CONFIG_FB_TFT_S6D02A1) += fb_s6d02a1.o -+obj-$(CONFIG_FB_TFT_S6D1121) += fb_s6d1121.o -+obj-$(CONFIG_FB_TFT_SSD1289) += fb_ssd1289.o -+obj-$(CONFIG_FB_TFT_SSD1306) += fb_ssd1306.o -+obj-$(CONFIG_FB_TFT_SSD1331) += fb_ssd1331.o -+obj-$(CONFIG_FB_TFT_SSD1351) += fb_ssd1351.o -+obj-$(CONFIG_FB_TFT_ST7735R) += fb_st7735r.o -+obj-$(CONFIG_FB_TFT_TINYLCD) += fb_tinylcd.o -+obj-$(CONFIG_FB_TFT_TLS8204) += fb_tls8204.o -+obj-$(CONFIG_FB_TFT_UC1701) += fb_uc1701.o -+obj-$(CONFIG_FB_TFT_UPD161704) += fb_upd161704.o -+obj-$(CONFIG_FB_TFT_WATTEROTT) += fb_watterott.o -+obj-$(CONFIG_FB_FLEX) += flexfb.o -+ -+# Device modules -+obj-$(CONFIG_FB_TFT_FBTFT_DEVICE) += fbtft_device.o -+ -+else -+# normal makefile -+KDIR ?= /lib/modules/`uname -r`/build -+ -+default: .config -+ $(MAKE) -C $(KDIR) M=$$PWD modules -+ -+.config: -+ grep config Kconfig | cut -d' ' -f2 | sed 's@^@CONFIG_@; s@$$@=m@' > .config -+ -+install: -+ $(MAKE) -C $(KDIR) M=$$PWD modules_install -+ -+ -+clean: -+ rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions \ -+ modules.order Module.symvers -+ -+endif -diff --git a/drivers/video/fbtft/README b/drivers/video/fbtft/README -new file mode 100644 -index 0000000..9bebc98 ---- /dev/null -+++ b/drivers/video/fbtft/README -@@ -0,0 +1,37 @@ -+ FBTFT -+========= -+ -+2015-01-19 -+The FBTFT drivers are now in the Linux kernel staging tree: https://git.kernel.org/cgit/linux/kernel/git/gregkh/staging.git/tree/drivers/staging/fbtft?h=staging-testing -+Development in this github repo has ceased. -+ -+ -+Linux Framebuffer drivers for small TFT LCD display modules. -+The module 'fbtft' makes writing drivers for some of these displays very easy. -+ -+Development is done on a Raspberry Pi running the Raspbian "wheezy" distribution. -+ -+INSTALLATION -+ Download kernel sources -+ -+ From Linux 3.15 -+ cd drivers/video/fbdev -+ git clone https://github.com/notro/fbtft.git -+ -+ Add to drivers/video/fbdev/Kconfig: source "drivers/video/fbdev/fbtft/Kconfig" -+ Add to drivers/video/fbdev/Makefile: obj-y += fbtft/ -+ -+ Before Linux 3.15 -+ cd drivers/video -+ git clone https://github.com/notro/fbtft.git -+ -+ Add to drivers/video/Kconfig: source "drivers/video/fbtft/Kconfig" -+ Add to drivers/video/Makefile: obj-y += fbtft/ -+ -+ Enable driver(s) in menuconfig and build the kernel -+ -+ -+See wiki for more information: https://github.com/notro/fbtft/wiki -+ -+ -+Source: https://github.com/notro/fbtft/ -diff --git a/drivers/video/fbtft/dts/overlays/rpi/hy28a-overlay.dts b/drivers/video/fbtft/dts/overlays/rpi/hy28a-overlay.dts -new file mode 100644 -index 0000000..621497f ---- /dev/null -+++ b/drivers/video/fbtft/dts/overlays/rpi/hy28a-overlay.dts -@@ -0,0 +1,87 @@ -+/* -+ * Device Tree overlay for HY28A display shield by Texy -+ * -+ */ -+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ status = "okay"; -+ -+ spidev@0{ -+ status = "disabled"; -+ }; -+ -+ spidev@1{ -+ status = "disabled"; -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ hy28a_pins: hy28a_pins { -+ brcm,pins = <17 25 18>; -+ brcm,function = <0 1 1>; /* in out out */ -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&spi0>; -+ __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ hy28a: hy28a@0{ -+ compatible = "ilitek,ili9320"; -+ reg = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&hy28a_pins>; -+ -+ spi-max-frequency = <32000000>; -+ spi-cpol; -+ spi-cpha; -+ rotate = <270>; -+ bgr; -+ fps = <50>; -+ buswidth = <8>; -+ startbyte = <0x70>; -+ reset-gpios = <&gpio 25 0>; -+ led-gpios = <&gpio 18 1>; -+ debug = <0>; -+ }; -+ -+ hy28a_ts: hy28a-ts@1 { -+ compatible = "ti,ads7846"; -+ reg = <1>; -+ -+ spi-max-frequency = <2000000>; -+ interrupts = <17 2>; /* high-to-low edge triggered */ -+ interrupt-parent = <&gpio>; -+ pendown-gpio = <&gpio 17 0>; -+ ti,x-plate-ohms = /bits/ 16 <100>; -+ ti,pressure-max = /bits/ 16 <255>; -+ }; -+ }; -+ }; -+ __overrides__ { -+ speed = <&hy28a>,"spi-max-frequency:0"; -+ rotate = <&hy28a>,"rotate:0"; -+ fps = <&hy28a>,"fps:0"; -+ debug = <&hy28a>,"debug:0"; -+ xohms = <&hy28a_ts>,"ti,x-plate-ohms;0"; -+ resetgpio = <&hy28a>,"reset-gpios:4", -+ <&hy28a_pins>, "brcm,pins:1"; -+ ledgpio = <&hy28a>,"led-gpios:4", -+ <&hy28a_pins>, "brcm,pins:2"; -+ }; -+}; -diff --git a/drivers/video/fbtft/dts/overlays/rpi/hy28b-overlay.dts b/drivers/video/fbtft/dts/overlays/rpi/hy28b-overlay.dts -new file mode 100644 -index 0000000..f774c4a ---- /dev/null -+++ b/drivers/video/fbtft/dts/overlays/rpi/hy28b-overlay.dts -@@ -0,0 +1,142 @@ -+/* -+ * Device Tree overlay for HY28b display shield by Texy -+ * -+ */ -+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ status = "okay"; -+ -+ spidev@0{ -+ status = "disabled"; -+ }; -+ -+ spidev@1{ -+ status = "disabled"; -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ hy28b_pins: hy28b_pins { -+ brcm,pins = <17 25 18>; -+ brcm,function = <0 1 1>; /* in out out */ -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&spi0>; -+ __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ hy28b: hy28b@0{ -+ compatible = "ilitek,ili9325"; -+ reg = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&hy28b_pins>; -+ -+ spi-max-frequency = <48000000>; -+ spi-cpol; -+ spi-cpha; -+ rotate = <270>; -+ bgr; -+ fps = <50>; -+ buswidth = <8>; -+ startbyte = <0x70>; -+ reset-gpios = <&gpio 25 0>; -+ led-gpios = <&gpio 18 1>; -+ -+ gamma = "04 1F 4 7 7 0 7 7 6 0\n0F 00 1 7 4 0 0 0 6 7"; -+ -+ init = <0x10000e7 0x0010 -+ 0x1000000 0x0001 -+ 0x1000001 0x0100 -+ 0x1000002 0x0700 -+ 0x1000003 0x1030 -+ 0x1000004 0x0000 -+ 0x1000008 0x0207 -+ 0x1000009 0x0000 -+ 0x100000a 0x0000 -+ 0x100000c 0x0001 -+ 0x100000d 0x0000 -+ 0x100000f 0x0000 -+ 0x1000010 0x0000 -+ 0x1000011 0x0007 -+ 0x1000012 0x0000 -+ 0x1000013 0x0000 -+ 0x2000032 -+ 0x1000010 0x1590 -+ 0x1000011 0x0227 -+ 0x2000032 -+ 0x1000012 0x009c -+ 0x2000032 -+ 0x1000013 0x1900 -+ 0x1000029 0x0023 -+ 0x100002b 0x000e -+ 0x2000032 -+ 0x1000020 0x0000 -+ 0x1000021 0x0000 -+ 0x2000032 -+ 0x1000050 0x0000 -+ 0x1000051 0x00ef -+ 0x1000052 0x0000 -+ 0x1000053 0x013f -+ 0x1000060 0xa700 -+ 0x1000061 0x0001 -+ 0x100006a 0x0000 -+ 0x1000080 0x0000 -+ 0x1000081 0x0000 -+ 0x1000082 0x0000 -+ 0x1000083 0x0000 -+ 0x1000084 0x0000 -+ 0x1000085 0x0000 -+ 0x1000090 0x0010 -+ 0x1000092 0x0000 -+ 0x1000093 0x0003 -+ 0x1000095 0x0110 -+ 0x1000097 0x0000 -+ 0x1000098 0x0000 -+ 0x1000007 0x0133 -+ 0x1000020 0x0000 -+ 0x1000021 0x0000 -+ 0x2000064>; -+ debug = <0>; -+ }; -+ -+ hy28b_ts: hy28b-ts@1 { -+ compatible = "ti,ads7846"; -+ reg = <1>; -+ -+ spi-max-frequency = <2000000>; -+ interrupts = <17 2>; /* high-to-low edge triggered */ -+ interrupt-parent = <&gpio>; -+ pendown-gpio = <&gpio 17 0>; -+ ti,x-plate-ohms = /bits/ 16 <100>; -+ ti,pressure-max = /bits/ 16 <255>; -+ }; -+ }; -+ }; -+ __overrides__ { -+ speed = <&hy28b>,"spi-max-frequency:0"; -+ rotate = <&hy28b>,"rotate:0"; -+ fps = <&hy28b>,"fps:0"; -+ debug = <&hy28b>,"debug:0"; -+ xohms = <&hy28b_ts>,"ti,x-plate-ohms;0"; -+ resetgpio = <&hy28b>,"reset-gpios:4", -+ <&hy28b_pins>, "brcm,pins:1"; -+ ledgpio = <&hy28b>,"led-gpios:4", -+ <&hy28b_pins>, "brcm,pins:2"; -+ }; -+}; -diff --git a/drivers/video/fbtft/dts/overlays/rpi/mz61581-overlay.dts b/drivers/video/fbtft/dts/overlays/rpi/mz61581-overlay.dts -new file mode 100644 -index 0000000..c06fe12 ---- /dev/null -+++ b/drivers/video/fbtft/dts/overlays/rpi/mz61581-overlay.dts -@@ -0,0 +1,109 @@ -+/* -+ * Device Tree overlay for MZ61581-PI-EXT 2014.12.28 by Tontec -+ * -+ */ -+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ status = "okay"; -+ -+ spidev@0{ -+ status = "disabled"; -+ }; -+ -+ spidev@1{ -+ status = "disabled"; -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ mz61581_pins: mz61581_pins { -+ brcm,pins = <4 15 18 25>; -+ brcm,function = <0 1 1 1>; /* in out out out */ -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&spi0>; -+ __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ mz61581: mz61581@0{ -+ compatible = "samsung,s6d02a1"; -+ reg = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&mz61581_pins>; -+ -+ spi-max-frequency = <128000000>; -+ spi-cpol; -+ spi-cpha; -+ -+ width = <320>; -+ height = <480>; -+ rotate = <270>; -+ bgr; -+ fps = <30>; -+ buswidth = <8>; -+ -+ reset-gpios = <&gpio 15 0>; -+ dc-gpios = <&gpio 25 0>; -+ led-gpios = <&gpio 18 0>; -+ -+ init = <0x10000b0 00 -+ 0x1000011 -+ 0x20000ff -+ 0x10000b3 0x02 0x00 0x00 0x00 -+ 0x10000c0 0x13 0x3b 0x00 0x02 0x00 0x01 0x00 0x43 -+ 0x10000c1 0x08 0x16 0x08 0x08 -+ 0x10000c4 0x11 0x07 0x03 0x03 -+ 0x10000c6 0x00 -+ 0x10000c8 0x03 0x03 0x13 0x5c 0x03 0x07 0x14 0x08 0x00 0x21 0x08 0x14 0x07 0x53 0x0c 0x13 0x03 0x03 0x21 0x00 -+ 0x1000035 0x00 -+ 0x1000036 0xa0 -+ 0x100003a 0x55 -+ 0x1000044 0x00 0x01 -+ 0x10000d0 0x07 0x07 0x1d 0x03 -+ 0x10000d1 0x03 0x30 0x10 -+ 0x10000d2 0x03 0x14 0x04 -+ 0x1000029 -+ 0x100002c>; -+ -+ /* This is a workaround to make sure the init sequence slows down and doesn't fail */ -+ debug = <3>; -+ }; -+ -+ mz61581_ts: mz61581_ts@1 { -+ compatible = "ti,ads7846"; -+ reg = <1>; -+ -+ spi-max-frequency = <2000000>; -+ interrupts = <4 2>; /* high-to-low edge triggered */ -+ interrupt-parent = <&gpio>; -+ pendown-gpio = <&gpio 4 0>; -+ -+ ti,x-plate-ohms = /bits/ 16 <60>; -+ ti,pressure-max = /bits/ 16 <255>; -+ }; -+ }; -+ }; -+ __overrides__ { -+ speed = <&mz61581>, "spi-max-frequency:0"; -+ rotate = <&mz61581>, "rotate:0"; -+ fps = <&mz61581>, "fps:0"; -+ debug = <&mz61581>, "debug:0"; -+ xohms = <&mz61581_ts>,"ti,x-plate-ohms;0"; -+ }; -+}; -diff --git a/drivers/video/fbtft/dts/overlays/rpi/piscreen-overlay.dts b/drivers/video/fbtft/dts/overlays/rpi/piscreen-overlay.dts -new file mode 100644 -index 0000000..8cd6a95 ---- /dev/null -+++ b/drivers/video/fbtft/dts/overlays/rpi/piscreen-overlay.dts -@@ -0,0 +1,94 @@ -+/* -+ * Device Tree overlay for PiScreen 3.5" display shield by Ozzmaker -+ * -+ */ -+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ status = "okay"; -+ -+ spidev@0{ -+ status = "disabled"; -+ }; -+ -+ spidev@1{ -+ status = "disabled"; -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ piscreen_pins: piscreen_pins { -+ brcm,pins = <17 25 24 22>; -+ brcm,function = <0 1 1 1>; /* in out out out */ -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&spi0>; -+ __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ piscreen: piscreen@0{ -+ compatible = "ilitek,ili9486"; -+ reg = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&piscreen_pins>; -+ -+ spi-max-frequency = <32000000>; -+ rotate = <270>; -+ bgr; -+ fps = <30>; -+ buswidth = <8>; -+ regwidth = <16>; -+ reset-gpios = <&gpio 25 0>; -+ dc-gpios = <&gpio 24 0>; -+ led-gpios = <&gpio 22 1>; -+ debug = <0>; -+ -+ init = <0x10000b0 0x00 -+ 0x1000011 -+ 0x20000ff -+ 0x100003a 0x55 -+ 0x1000036 0x28 -+ 0x10000c2 0x44 -+ 0x10000c5 0x00 0x00 0x00 0x00 -+ 0x10000e0 0x0f 0x1f 0x1c 0x0c 0x0f 0x08 0x48 0x98 0x37 0x0a 0x13 0x04 0x11 0x0d 0x00 -+ 0x10000e1 0x0f 0x32 0x2e 0x0b 0x0d 0x05 0x47 0x75 0x37 0x06 0x10 0x03 0x24 0x20 0x00 -+ 0x10000e2 0x0f 0x32 0x2e 0x0b 0x0d 0x05 0x47 0x75 0x37 0x06 0x10 0x03 0x24 0x20 0x00 -+ 0x1000011 -+ 0x1000029>; -+ }; -+ -+ piscreen-ts@1 { -+ compatible = "ti,ads7846"; -+ reg = <1>; -+ -+ spi-max-frequency = <2000000>; -+ interrupts = <17 2>; /* high-to-low edge triggered */ -+ interrupt-parent = <&gpio>; -+ pendown-gpio = <&gpio 17 0>; -+ ti,x-plate-ohms = /bits/ 16 <100>; -+ ti,pressure-max = /bits/ 16 <255>; -+ }; -+ }; -+ }; -+ __overrides__ { -+ speed = <&piscreen>,"spi-max-frequency:0"; -+ rotate = <&piscreen>,"rotate:0"; -+ fps = <&piscreen>,"fps:0"; -+ debug = <&piscreen>,"debug:0"; -+ }; -+}; -diff --git a/drivers/video/fbtft/dts/overlays/rpi/pitft28-resistive-overlay.dts b/drivers/video/fbtft/dts/overlays/rpi/pitft28-resistive-overlay.dts -new file mode 100644 -index 0000000..e8a9365 ---- /dev/null -+++ b/drivers/video/fbtft/dts/overlays/rpi/pitft28-resistive-overlay.dts -@@ -0,0 +1,115 @@ -+/* -+ * Device Tree overlay for pitft resistive by Adafruit -+ * -+ */ -+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ status = "okay"; -+ -+ spidev@0{ -+ status = "disabled"; -+ }; -+ -+ spidev@1{ -+ status = "disabled"; -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ pitft_pins: pitft_pins { -+ brcm,pins = <24 25>; -+ brcm,function = <0 1>; /* in out */ -+ brcm,pull = <2 0>; /* pullup none */ -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&spi0>; -+ __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ pitft: pitft@0{ -+ compatible = "ilitek,ili9340"; -+ reg = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pitft_pins>; -+ -+ spi-max-frequency = <16000000>; -+ rotate = <90>; -+ fps = <25>; -+ bgr; -+ buswidth = <8>; -+ dc-gpios = <&gpio 25 0>; -+ debug = <0>; -+ }; -+ -+ pitft_ts@1 { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ compatible = "st,stmpe610"; -+ reg = <1>; -+ -+ spi-max-frequency = <500000>; -+ irq-gpio = <&gpio 24 0x2>; /* IRQF_TRIGGER_FALLING */ -+ interrupts = <24 2>; /* high-to-low edge triggered */ -+ interrupt-parent = <&gpio>; -+ interrupt-controller; -+ -+ stmpe_touchscreen { -+ compatible = "st,stmpe-ts"; -+ st,sample-time = <4>; -+ st,mod-12b = <1>; -+ st,ref-sel = <0>; -+ st,adc-freq = <2>; -+ st,ave-ctrl = <3>; -+ st,touch-det-delay = <4>; -+ st,settling = <2>; -+ st,fraction-z = <7>; -+ st,i-drive = <0>; -+ }; -+ -+ stmpe_gpio: stmpe_gpio { -+ #gpio-cells = <2>; -+ compatible = "st,stmpe-gpio"; -+ /* -+ * only GPIO2 is wired/available -+ * and it is wired to the backlight -+ */ -+ st,norequest-mask = <0x7b>; -+ }; -+ }; -+ }; -+ }; -+ -+ fragment@3 { -+ target-path = "/soc"; -+ __overlay__ { -+ backlight { -+ compatible = "gpio-backlight"; -+ gpios = <&stmpe_gpio 2 0>; -+ default-on; -+ }; -+ }; -+ }; -+ -+ __overrides__ { -+ speed = <&pitft>,"spi-max-frequency:0"; -+ rotate = <&pitft>,"rotate:0"; -+ fps = <&pitft>,"fps:0"; -+ debug = <&pitft>,"debug:0"; -+ }; -+}; -diff --git a/drivers/video/fbtft/dts/overlays/rpi/rpi-display-overlay.dts b/drivers/video/fbtft/dts/overlays/rpi/rpi-display-overlay.dts -new file mode 100644 -index 0000000..0578810 ---- /dev/null -+++ b/drivers/video/fbtft/dts/overlays/rpi/rpi-display-overlay.dts -@@ -0,0 +1,81 @@ -+/* -+ * Device Tree overlay for rpi-display by Watterott -+ * -+ */ -+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ status = "okay"; -+ -+ spidev@0{ -+ status = "disabled"; -+ }; -+ -+ spidev@1{ -+ status = "disabled"; -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ rpi_display_pins: rpi_display_pins { -+ brcm,pins = <18 23 24 25>; -+ brcm,function = <1 1 1 0>; /* out out out in */ -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&spi0>; -+ __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ rpidisplay: rpi-display@0{ -+ compatible = "ilitek,ili9341"; -+ reg = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&rpi_display_pins>; -+ -+ spi-max-frequency = <32000000>; -+ rotate = <270>; -+ bgr; -+ fps = <30>; -+ buswidth = <8>; -+ reset-gpios = <&gpio 23 0>; -+ dc-gpios = <&gpio 24 0>; -+ led-gpios = <&gpio 18 1>; -+ debug = <0>; -+ }; -+ -+ rpidisplay_ts: rpi-display-ts@1 { -+ compatible = "ti,ads7846"; -+ reg = <1>; -+ -+ spi-max-frequency = <2000000>; -+ interrupts = <25 2>; /* high-to-low edge triggered */ -+ interrupt-parent = <&gpio>; -+ pendown-gpio = <&gpio 25 0>; -+ ti,x-plate-ohms = /bits/ 16 <60>; -+ ti,pressure-max = /bits/ 16 <255>; -+ }; -+ }; -+ }; -+ __overrides__ { -+ speed = <&rpidisplay>,"spi-max-frequency:0"; -+ rotate = <&rpidisplay>,"rotate:0"; -+ fps = <&rpidisplay>,"fps:0"; -+ debug = <&rpidisplay>,"debug:0"; -+ xohms = <&rpidisplay_ts>,"ti,x-plate-ohms;0"; -+ }; -+}; -diff --git a/drivers/video/fbtft/dts/overlays/rpi/tinylcd35-overlay.dts b/drivers/video/fbtft/dts/overlays/rpi/tinylcd35-overlay.dts -new file mode 100644 -index 0000000..881d2eb ---- /dev/null -+++ b/drivers/video/fbtft/dts/overlays/rpi/tinylcd35-overlay.dts -@@ -0,0 +1,181 @@ -+/* -+ * tinylcd 3.5" display -+ * -+ */ -+ -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; -+ -+ fragment@0 { -+ target = <&spi0>; -+ __overlay__ { -+ status = "okay"; -+ -+ spidev@0{ -+ status = "disabled"; -+ }; -+ -+ spidev@1{ -+ status = "disabled"; -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ tinylcd35_pins: tinylcd35_pins { -+ brcm,pins = <25 24 18>; -+ brcm,function = <1>; /* out */ -+ }; -+ tinylcd35_ts_pins: tinylcd35_ts_pins { -+ brcm,pins = <5>; -+ brcm,function = <0>; /* in */ -+ }; -+ keypad_pins: keypad_pins { -+ brcm,pins = <4 17 22 23 27>; -+ brcm,function = <0>; /* in */ -+ brcm,pull = <1>; /* down */ -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&spi0>; -+ __overlay__ { -+ /* needed to avoid dtc warning */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ tinylcd35: tinylcd35@0{ -+ compatible = "neosec,tinylcd"; -+ reg = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&tinylcd35_pins>, -+ <&tinylcd35_ts_pins>; -+ -+ spi-max-frequency = <48000000>; -+ rotate = <270>; -+ fps = <20>; -+ bgr; -+ buswidth = <8>; -+ reset-gpios = <&gpio 25 0>; -+ dc-gpios = <&gpio 24 0>; -+ led-gpios = <&gpio 18 1>; -+ debug = <0>; -+ -+ init = <0x10000B0 0x80 -+ 0x10000C0 0x0A 0x0A -+ 0x10000C1 0x01 0x01 -+ 0x10000C2 0x33 -+ 0x10000C5 0x00 0x42 0x80 -+ 0x10000B1 0xD0 0x11 -+ 0x10000B4 0x02 -+ 0x10000B6 0x00 0x22 0x3B -+ 0x10000B7 0x07 -+ 0x1000036 0x58 -+ 0x10000F0 0x36 0xA5 0xD3 -+ 0x10000E5 0x80 -+ 0x10000E5 0x01 -+ 0x10000B3 0x00 -+ 0x10000E5 0x00 -+ 0x10000F0 0x36 0xA5 0x53 -+ 0x10000E0 0x00 0x35 0x33 0x00 0x00 0x00 0x00 0x35 0x33 0x00 0x00 0x00 -+ 0x100003A 0x55 -+ 0x1000011 -+ 0x2000001 -+ 0x1000029>; -+ }; -+ -+ tinylcd35_ts: tinylcd35_ts@1 { -+ compatible = "ti,ads7846"; -+ reg = <1>; -+ status = "disabled"; -+ -+ spi-max-frequency = <2000000>; -+ interrupts = <5 2>; /* high-to-low edge triggered */ -+ interrupt-parent = <&gpio>; -+ pendown-gpio = <&gpio 5 0>; -+ ti,x-plate-ohms = /bits/ 16 <100>; -+ ti,pressure-max = /bits/ 16 <255>; -+ }; -+ }; -+ }; -+ -+ fragment@3 { -+ target = <&i2c1>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ pcf8563: pcf8563@51 { -+ compatible = "nxp,pcf8563"; -+ reg = <0x51>; -+ status = "disabled"; -+ }; -+ }; -+ }; -+ -+ /* -+ * Values for input event code is found under the -+ * 'Keys and buttons' heading in include/uapi/linux/input.h -+ */ -+ fragment@4 { -+ target-path = "/soc"; -+ __overlay__ { -+ keypad: keypad { -+ compatible = "gpio-keys"; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&keypad_pins>; -+ status = "disabled"; -+ autorepeat; -+ -+ button@17 { -+ label = "GPIO KEY_UP"; -+ linux,code = <103>; -+ gpios = <&gpio 17 0>; -+ }; -+ button@22 { -+ label = "GPIO KEY_DOWN"; -+ linux,code = <108>; -+ gpios = <&gpio 22 0>; -+ }; -+ button@27 { -+ label = "GPIO KEY_LEFT"; -+ linux,code = <105>; -+ gpios = <&gpio 27 0>; -+ }; -+ button@23 { -+ label = "GPIO KEY_RIGHT"; -+ linux,code = <106>; -+ gpios = <&gpio 23 0>; -+ }; -+ button@4 { -+ label = "GPIO KEY_ENTER"; -+ linux,code = <28>; -+ gpios = <&gpio 4 0>; -+ }; -+ }; -+ }; -+ }; -+ -+ __overrides__ { -+ speed = <&tinylcd35>,"spi-max-frequency:0"; -+ rotate = <&tinylcd35>,"rotate:0"; -+ fps = <&tinylcd35>,"fps:0"; -+ debug = <&tinylcd35>,"debug:0"; -+ touch = <&tinylcd35_ts>,"status"; -+ touchgpio = <&tinylcd35_ts_pins>,"brcm,pins:0", -+ <&tinylcd35_ts>,"interrupts:0", -+ <&tinylcd35_ts>,"pendown-gpio:4"; -+ xohms = <&tinylcd35_ts>,"ti,x-plate-ohms;0"; -+ rtc = <&i2c1>,"status", -+ <&pcf8563>,"status"; -+ keypad = <&keypad>,"status"; -+ }; -+}; -diff --git a/drivers/video/fbtft/dts/rpi.dts b/drivers/video/fbtft/dts/rpi.dts -new file mode 100644 -index 0000000..6c3ab6e ---- /dev/null -+++ b/drivers/video/fbtft/dts/rpi.dts -@@ -0,0 +1,414 @@ -+ -+/* -+ * FBTFT Device Tree part for the Raspberry Pi -+ * Add this file to the end of the *rpi-b.dts file -+ * -+ * Please keep it sorted alphabetically on display name -+ * -+ * Notes: -+ * - use ads7846 instead of tsc2046 to get module autoloading -+ * - use polarity 1 to drive backlight initially low (off): -+ * led-gpios = <&gpio 18 1>; -+ */ -+ -+&spi0 { -+ /* this is provided here to make it easy to enable SPI when editing this file */ -+// status = "okay"; -+}; -+ -+ -+ -+/* -+ * Texy -+ * 2.8" TFT + Touch Shield Board (320x240) HY28A -+ * -+ */ -+&spi0 { -+ hy28a@0{ -+ compatible = "ilitek,ili9320"; -+ reg = <0>; -+ status = "disabled"; -+ -+ spi-max-frequency = <32000000>; -+ spi-cpol; -+ spi-cpha; -+ rotate = <270>; -+ bgr; -+ fps = <50>; -+ buswidth = <8>; -+ startbyte = <0x70>; -+ reset-gpios = <&gpio 25 0>; -+ led-gpios = <&gpio 18 1>; -+ debug = <0>; -+ }; -+ -+ hy28a_ts@1 { -+ compatible = "ti,ads7846"; -+ reg = <1>; -+ status = "disabled"; -+ -+ spi-max-frequency = <2000000>; -+ interrupts = <3 17>; -+ pendown-gpio = <&gpio 17 0>; -+ ti,x-plate-ohms = /bits/ 16 <100>; -+ ti,pressure-max = /bits/ 16 <255>; -+ }; -+}; -+ -+ -+ -+ -+/* -+ * Texy -+ * 2.8" TFT + Touch Shield Board (320x240) HY28B -+ * NOT TESTED -+ */ -+&spi0 { -+ hy28b@0{ -+ compatible = "ilitek,ili9325"; -+ reg = <0>; -+ status = "disabled"; -+ -+ spi-max-frequency = <48000000>; -+ rotate = <270>; -+ bgr; -+ fps = <50>; -+ buswidth = <8>; -+ startbyte = <0x70>; -+ reset-gpios = <&gpio 25 0>; -+ led-gpios = <&gpio 18 1>; -+ -+ gamma = "04 1F 4 7 7 0 7 7 6 0\n0F 00 1 7 4 0 0 0 6 7"; -+ -+ init = <0x10000e7 0x0010 -+ 0x1000000 0x0001 -+ 0x1000001 0x0100 -+ 0x1000002 0x0700 -+ 0x1000003 0x1030 -+ 0x1000004 0x0000 -+ 0x1000008 0x0207 -+ 0x1000009 0x0000 -+ 0x100000a 0x0000 -+ 0x100000c 0x0001 -+ 0x100000d 0x0000 -+ 0x100000f 0x0000 -+ 0x1000010 0x0000 -+ 0x1000011 0x0007 -+ 0x1000012 0x0000 -+ 0x1000013 0x0000 -+ 0x2000032 -+ 0x1000010 0x1590 -+ 0x1000011 0x0227 -+ 0x2000032 -+ 0x1000012 0x009c -+ 0x2000032 -+ 0x1000013 0x1900 -+ 0x1000029 0x0023 -+ 0x100002b 0x000e -+ 0x2000032 -+ 0x1000020 0x0000 -+ 0x1000021 0x0000 -+ 0x2000032 -+ 0x1000050 0x0000 -+ 0x1000051 0x00ef -+ 0x1000052 0x0000 -+ 0x1000053 0x013f -+ 0x1000060 0xa700 -+ 0x1000061 0x0001 -+ 0x100006a 0x0000 -+ 0x1000080 0x0000 -+ 0x1000081 0x0000 -+ 0x1000082 0x0000 -+ 0x1000083 0x0000 -+ 0x1000084 0x0000 -+ 0x1000085 0x0000 -+ 0x1000090 0x0010 -+ 0x1000092 0x0000 -+ 0x1000093 0x0003 -+ 0x1000095 0x0110 -+ 0x1000097 0x0000 -+ 0x1000098 0x0000 -+ 0x1000007 0x0133 -+ 0x1000020 0x0000 -+ 0x1000021 0x0000 -+ 0x2000064>; -+ debug = <0>; -+ }; -+ -+ hy28b_ts@1 { -+ compatible = "ti,ads7846"; -+ reg = <1>; -+ status = "disabled"; -+ -+ spi-max-frequency = <2000000>; -+ interrupts = <3 17>; -+ pendown-gpio = <&gpio 17 0>; -+ ti,x-plate-ohms = /bits/ 16 <100>; -+ ti,pressure-max = /bits/ 16 <255>; -+ }; -+}; -+ -+ -+ -+ -+/* -+ * ITEAD -+ * ITDB02-2.8 -+ * -+ */ -+/ { -+ itdb28 { -+ compatible = "ilitek,ili9325"; -+ status = "disabled"; -+ -+ rotate = <0>; -+ bgr; -+ buswidth = <8>; -+ reset-gpios = <&gpio 17 0>; -+ dc-gpios = <&gpio 3 0>; -+ cs-gpios = <&gpio 27 0>; -+ wr-gpios = <&gpio 2 0>; -+ db-gpios = <&gpio 9 0>, -+ <&gpio 11 0>, -+ <&gpio 18 0>, -+ <&gpio 23 0>, -+ <&gpio 24 0>, -+ <&gpio 25 0>, -+ <&gpio 8 0>, -+ <&gpio 7 0>; -+ /* LED pin drives backlight directly. Use transistor (50mA) */ -+ /* led-gpios = <&gpio 4 1>; */ -+ debug = <0>; -+ }; -+}; -+ -+ -+ -+ -+/* -+ * Watterott -+ * RPi-Display - 2.8" Touch-Display (320x240) -+ * -+ */ -+&spi0 { -+ rpi-display@0{ -+ compatible = "ilitek,ili9341"; -+ reg = <0>; -+ status = "disabled"; -+ -+ spi-max-frequency = <32000000>; -+ rotate = <270>; -+ bgr; -+ fps = <30>; -+ buswidth = <8>; -+ reset-gpios = <&gpio 23 0>; -+ dc-gpios = <&gpio 24 0>; -+ led-gpios = <&gpio 18 1>; -+ debug = <0>; -+ }; -+ -+ rpi-display_ts@1 { -+ compatible = "ti,ads7846"; -+ reg = <1>; -+ status = "disabled"; -+ -+ spi-max-frequency = <2000000>; -+ interrupts = <3 25>; -+ pendown-gpio = <&gpio 25 0>; -+ ti,x-plate-ohms = /bits/ 16 <60>; -+ ti,pressure-max = /bits/ 16 <255>; -+ }; -+}; -+ -+ -+ -+ -+/* -+ * Ozzmaker -+ * PiScreen - 3.5" TFT touchscreen (480x320) -+ * -+ */ -+&spi0 { -+ piscreen@0{ -+ compatible = "ilitek,ili9486"; -+ reg = <0>; -+ status = "disabled"; -+ -+ spi-max-frequency = <20000000>; -+ rotate = <270>; -+ bgr; -+ fps = <30>; -+ buswidth = <8>; -+ reset-gpios = <&gpio 25 0>; -+ dc-gpios = <&gpio 24 0>; -+ led-gpios = <&gpio 22 1>; -+ -+ init = <0x10000b0 0x00 -+ 0x1000011 -+ 0x20000FF -+ 0x100003A 0x55 -+ 0x1000036 0x28 -+ 0x10000C2 0x44 -+ 0x10000C5 0x00 0x00 0x00 0x00 -+ 0x10000E0 0x0F 0x1F 0x1C 0x0C 0x0F 0x08 0x48 0x98 0x37 0x0A 0x13 0x04 0x11 0x0D 0x00 -+ 0x10000E1 0x0F 0x32 0x2E 0x0B 0x0D 0x05 0x47 0x75 0x37 0x06 0x10 0x03 0x24 0x20 0x00 -+ 0x10000E2 0x0F 0x32 0x2E 0x0B 0x0D 0x05 0x47 0x75 0x37 0x06 0x10 0x03 0x24 0x20 0x00 -+ 0x1000011 -+ 0X1000029>; -+ debug = <0>; -+ }; -+ -+ piscreen_ts@1 { -+ compatible = "ti,ads7846"; -+ reg = <1>; -+ status = "disabled"; -+ -+ spi-max-frequency = <2000000>; -+ interrupts = <3 17>; -+ pendown-gpio = <&gpio 17 0>; -+ ti,x-plate-ohms = /bits/ 16 <100>; -+ ti,pressure-max = /bits/ 16 <255>; -+ }; -+}; -+ -+ -+ -+ -+/* -+ * Adafruit -+ * PiTFT Mini Kit - 320x240 2.8" TFT+Touchscreen for Raspberry Pi -+ * -+ * Couldn't get touch controller to work -+ */ -+ -+&gpio { -+ stmpets_pins: stmpets_pins { -+ brcm,pins = <24>; -+ brcm,function = <0>; /* gpio in */ -+ brcm,pull = <2>; /* pull up */ -+ }; -+}; -+ -+&spi0 { -+ pitft@0{ -+ compatible = "ilitek,ili9340"; -+ reg = <0>; -+ status = "disabled"; -+ -+ spi-max-frequency = <32000000>; -+ rotate = <90>; -+ bgr; -+ buswidth = <8>; -+ dc-gpios = <&gpio 25 0>; -+ -+ init = <0x1000001 -+ 0x2000005 -+ 0x1000028 -+ 0x10000EF 0x03 0x80 0x02 -+ 0x10000CF 0x00 0xC1 0x30 -+ 0x10000ED 0x64 0x03 0x12 0x81 -+ 0x10000E8 0x85 0x00 0x78 -+ 0x10000CB 0x39 0x2C 0x00 0x34 0x02 -+ 0x10000F7 0x20 -+ 0x10000EA 0x00 0x00 -+ 0x10000C0 0x23 -+ 0x10000C1 0x10 -+ 0x10000C5 0x3e 0x28 -+ 0x10000C7 0x86 -+ 0x100003A 0x55 -+ 0x10000B1 0x00 0x18 -+ 0x10000B6 0x08 0x82 0x27 -+ 0x10000F2 0x00 -+ 0x1000026 0x01 -+ 0x10000E0 0x0F 0x31 0x2B 0x0C 0x0E 0x08 0x4E 0xF1 0x37 0x07 0x10 0x03 0x0E 0x09 0x00 -+ 0x10000E1 0x00 0x0E 0x14 0x03 0x11 0x07 0x31 0xC1 0x48 0x08 0x0F 0x0C 0x31 0x36 0x0F -+ 0x1000011 -+ 0x2000064 -+ 0x1000029 -+ 0x2000014>; -+ debug = <0>; -+ }; -+/* -+Touchscreen didn't work. I guess it has something to do with it being an interrupt controller. -+I have never tried this before with DT and ARCH_BCM2708. -+On ARCH_BCM2835 it should be OK, since the GPIO controller acts as an interrupt controller as well. -+(stmpe_device can't be used from 3.16, because irq_base can't be set anymore) -+ -+[ 8.889056] irq: irq_create_mapping(0xc3008800, 0xc2) -+[ 8.895698] irq: -> using domain @c3008800 -+[ 8.900796] irq: -> existing mapping on virq 194 -+[ 8.925048] stmpe-spi spi0.1: stmpe610 detected, chip id: 0x811 -+[ 8.936650] irq: Added domain (null) -+[ 8.941780] irq: irq_create_mapping(0xc1dc1a20, 0x0) -+[ 8.949047] irq: -> using domain @c1dc1a20 -+[ 8.954421] irq: -> virq allocation failed -+[ 8.959926] irq: irq_create_mapping(0xc1dc1a20, 0x1) -+[ 8.967366] irq: -> using domain @c1dc1a20 -+[ 8.972870] irq: -> virq allocation failed -+*/ -+ pitft_ts@1 { -+ compatible = "st,stmpe610"; -+ #address-cells = <1>; -+ #size-cells = <0>; -+ reg = <1>; -+ status = "disabled"; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&stmpets_pins>; -+ -+ spi-max-frequency = <500000>; -+ interrupts = <3 24>; -+ interrupt-parent = <&intc>; -+ interrupt-controller; -+ -+ stmpe_touchscreen { -+ compatible = "st,stmpe-ts"; -+ st,sample-time = <4>; -+ st,mod-12b = <1>; -+ st,ref-sel = <0>; -+ st,adc-freq = <2>; -+ st,ave-ctrl = <3>; -+ st,touch-det-delay = <4>; -+ st,settling = <2>; -+ st,fraction-z = <7>; -+ st,i-drive = <0>; -+ }; -+ }; -+}; -+ -+ -+ -+ -+/* -+ * NeoSec LLC -+ * 3.5 inch TFT Display (320x480) -+ * -+ */ -+&spi0 { -+ tinylcd35@0{ -+ compatible = "neosec,tinylcd"; -+ reg = <0>; -+ status = "disabled"; -+ -+ spi-max-frequency = <48000000>; -+ rotate = <270>; -+ bgr; -+ fps = <50>; -+ buswidth = <8>; -+ reset-gpios = <&gpio 25 0>; -+ dc-gpios = <&gpio 24 0>; -+ led-gpios = <&gpio 18 1>; -+ debug = <0>; -+ }; -+ -+ tinylcd35@1 { -+ compatible = "ti,ads7846"; -+ reg = <1>; -+ status = "disabled"; -+ -+ spi-max-frequency = <2000000>; -+ interrupts = <3 3>; -+ pendown-gpio = <&gpio 3 0>; -+ ti,x-plate-ohms = /bits/ 16 <100>; -+ ti,pressure-max = /bits/ 16 <255>; -+ }; -+}; -diff --git a/drivers/video/fbtft/fb_agm1264k-fl.c b/drivers/video/fbtft/fb_agm1264k-fl.c -new file mode 100644 -index 0000000..7fe4fa0 ---- /dev/null -+++ b/drivers/video/fbtft/fb_agm1264k-fl.c -@@ -0,0 +1,462 @@ -+/* -+ * FB driver for Two KS0108 LCD controllers in AGM1264K-FL display -+ * -+ * Copyright (C) 2014 ololoshka2871 -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "fbtft.h" -+ -+/* Uncomment text line to use negative image on display */ -+/*#define NEGATIVE*/ -+ -+#define WHITE 0xff -+#define BLACK 0 -+ -+#define DRVNAME "fb_agm1264k-fl" -+#define WIDTH 64 -+#define HEIGHT 64 -+#define TOTALWIDTH (WIDTH * 2) /* because 2 x ks0108 in one display */ -+#define FPS 20 -+ -+#define EPIN gpio.wr -+#define RS gpio.dc -+#define RW gpio.aux[2] -+#define CS0 gpio.aux[0] -+#define CS1 gpio.aux[1] -+ -+ -+/* diffusing error (“Floyd-Steinberg”) */ -+#define DIFFUSING_MATRIX_WIDTH 2 -+#define DIFFUSING_MATRIX_HEIGHT 2 -+ -+static const signed char -+diffusing_matrix[DIFFUSING_MATRIX_WIDTH][DIFFUSING_MATRIX_HEIGHT] = { -+ {-1, 3}, -+ {3, 2}, -+}; -+ -+static const unsigned char gamma_correction_table[] = { -+0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, -+1, 1, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, -+6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 11, 11, 11, 12, 12, 13, -+13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, -+22, 22, 23, 23, 24, 25, 25, 26, 26, 27, 28, 28, 29, 30, 30, 31, 32, -+33, 33, 34, 35, 35, 36, 37, 38, 39, 39, 40, 41, 42, 43, 43, 44, 45, -+46, 47, 48, 49, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -+62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 73, 74, 75, 76, 77, 78, 79, 81, -+82, 83, 84, 85, 87, 88, 89, 90, 91, 93, 94, 95, 97, 98, 99, 100, 102, -+103, 105, 106, 107, 109, 110, 111, 113, 114, 116, 117, 119, 120, 121, -+123, 124, 126, 127, 129, 130, 132, 133, 135, 137, 138, 140, 141, 143, -+145, 146, 148, 149, 151, 153, 154, 156, 158, 159, 161, 163, 165, 166, -+168, 170, 172, 173, 175, 177, 179, 181, 182, 184, 186, 188, 190, 192, -+194, 196, 197, 199, 201, 203, 205, 207, 209, 211, 213, 215, 217, 219, -+221, 223, 225, 227, 229, 231, 234, 236, 238, 240, 242, 244, 246, 248, -+251, 253, 255 -+}; -+ -+static int init_display(struct fbtft_par *par) -+{ -+ u8 i; -+ -+ fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); -+ -+ par->fbtftops.reset(par); -+ -+ for (i = 0; i < 2; ++i) { -+ write_reg(par, i, 0x3f); /* display on */ -+ write_reg(par, i, 0x40); /* set x to 0 */ -+ write_reg(par, i, 0xb0); /* set page to 0 */ -+ write_reg(par, i, 0xc0); /* set start line to 0 */ -+ } -+ -+ return 0; -+} -+ -+void reset(struct fbtft_par *par) -+{ -+ if (par->gpio.reset == -1) -+ return; -+ -+ fbtft_dev_dbg(DEBUG_RESET, par, par->info->device, "%s()\n", __func__); -+ -+ gpio_set_value(par->gpio.reset, 0); -+ udelay(20); -+ gpio_set_value(par->gpio.reset, 1); -+ mdelay(120); -+} -+ -+/* Check if all necessary GPIOS defined */ -+static int verify_gpios(struct fbtft_par *par) -+{ -+ int i; -+ -+ fbtft_dev_dbg(DEBUG_VERIFY_GPIOS, par, par->info->device, -+ "%s()\n", __func__); -+ -+ if (par->EPIN < 0) { -+ dev_err(par->info->device, -+ "Missing info about 'wr' (aka E) gpio. Aborting.\n"); -+ return -EINVAL; -+ } -+ for (i = 0; i < 8; ++i) { -+ if (par->gpio.db[i] < 0) { -+ dev_err(par->info->device, -+ "Missing info about 'db[%i]' gpio. Aborting.\n", -+ i); -+ return -EINVAL; -+ } -+ } -+ if (par->CS0 < 0) { -+ dev_err(par->info->device, -+ "Missing info about 'cs0' gpio. Aborting.\n"); -+ return -EINVAL; -+ } -+ if (par->CS1 < 0) { -+ dev_err(par->info->device, -+ "Missing info about 'cs1' gpio. Aborting.\n"); -+ return -EINVAL; -+ } -+ if (par->RW < 0) { -+ dev_err(par->info->device, -+ "Missing info about 'rw' gpio. Aborting.\n"); -+ return -EINVAL; -+ } -+ -+ return 0; -+} -+ -+static unsigned long -+request_gpios_match(struct fbtft_par *par, const struct fbtft_gpio *gpio) -+{ -+ fbtft_dev_dbg(DEBUG_REQUEST_GPIOS_MATCH, par, par->info->device, -+ "%s('%s')\n", __func__, gpio->name); -+ -+ if (strcasecmp(gpio->name, "wr") == 0) { -+ /* left ks0108 E pin */ -+ par->EPIN = gpio->gpio; -+ return GPIOF_OUT_INIT_LOW; -+ } else if (strcasecmp(gpio->name, "cs0") == 0) { -+ /* left ks0108 controller pin */ -+ par->CS0 = gpio->gpio; -+ return GPIOF_OUT_INIT_HIGH; -+ } else if (strcasecmp(gpio->name, "cs1") == 0) { -+ /* right ks0108 controller pin */ -+ par->CS1 = gpio->gpio; -+ return GPIOF_OUT_INIT_HIGH; -+ } -+ -+ /* if write (rw = 0) e(1->0) perform write */ -+ /* if read (rw = 1) e(0->1) set data on D0-7*/ -+ else if (strcasecmp(gpio->name, "rw") == 0) { -+ par->RW = gpio->gpio; -+ return GPIOF_OUT_INIT_LOW; -+ } -+ -+ return FBTFT_GPIO_NO_MATCH; -+} -+ -+/* This function oses to enter commands -+ * first byte - destination controller 0 or 1 -+ * folowing - commands -+ */ -+static void write_reg8_bus8(struct fbtft_par *par, int len, ...) -+{ -+ va_list args; -+ int i, ret; -+ u8 *buf = (u8 *)par->buf; -+ -+ if (unlikely(par->debug & DEBUG_WRITE_REGISTER)) { -+ va_start(args, len); -+ for (i = 0; i < len; i++) -+ buf[i] = (u8)va_arg(args, unsigned int); -+ -+ va_end(args); -+ fbtft_par_dbg_hex(DEBUG_WRITE_REGISTER, par, -+ par->info->device, u8, buf, len, "%s: ", __func__); -+ } -+ -+ va_start(args, len); -+ -+ *buf = (u8)va_arg(args, unsigned int); -+ -+ if (*buf > 1) { -+ va_end(args); -+ dev_err(par->info->device, "%s: Incorrect chip sellect request (%d)\n", -+ __func__, *buf); -+ return; -+ } -+ -+ /* select chip */ -+ if (*buf) { -+ /* cs1 */ -+ gpio_set_value(par->CS0, 1); -+ gpio_set_value(par->CS1, 0); -+ } else { -+ /* cs0 */ -+ gpio_set_value(par->CS0, 0); -+ gpio_set_value(par->CS1, 1); -+ } -+ -+ gpio_set_value(par->RS, 0); /* RS->0 (command mode) */ -+ len--; -+ -+ if (len) { -+ i = len; -+ while (i--) -+ *buf++ = (u8)va_arg(args, unsigned int); -+ ret = par->fbtftops.write(par, par->buf, len * (sizeof(u8))); -+ if (ret < 0) { -+ va_end(args); -+ dev_err(par->info->device, "%s: write() failed and returned %d\n", -+ __func__, ret); -+ return; -+ } -+ } -+ -+ va_end(args); -+} -+ -+static struct -+{ -+ int xs, ys_page, xe, ye_page; -+} addr_win; -+ -+/* save display writing zone */ -+static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye) -+{ -+ addr_win.xs = xs; -+ addr_win.ys_page = ys / 8; -+ addr_win.xe = xe; -+ addr_win.ye_page = ye / 8; -+ -+ fbtft_par_dbg(DEBUG_SET_ADDR_WIN, par, -+ "%s(xs=%d, ys_page=%d, xe=%d, ye_page=%d)\n", __func__, -+ addr_win.xs, addr_win.ys_page, addr_win.xe, addr_win.ye_page); -+} -+ -+static void -+construct_line_bitmap(struct fbtft_par *par, u8 *dest, signed short *src, -+ int xs, int xe, int y) -+{ -+ int x, i; -+ -+ for (x = xs; x < xe; ++x) { -+ u8 res = 0; -+ -+ for (i = 0; i < 8; i++) -+ if (src[(y * 8 + i) * par->info->var.xres + x]) -+ res |= 1 << i; -+#ifdef NEGATIVE -+ *dest++ = res; -+#else -+ *dest++ = ~res; -+#endif -+ } -+} -+ -+static int write_vmem(struct fbtft_par *par, size_t offset, size_t len) -+{ -+ u16 *vmem16 = (u16 *)par->info->screen_base; -+ u8 *buf = par->txbuf.buf; -+ int x, y; -+ int ret = 0; -+ -+ /* buffer to convert RGB565 -> grayscale16 -> Ditherd image 1bpp */ -+ signed short *convert_buf = kmalloc(par->info->var.xres * -+ par->info->var.yres * sizeof(signed short), GFP_NOIO); -+ -+ fbtft_par_dbg(DEBUG_WRITE_VMEM, par, "%s()\n", __func__); -+ -+ /* converting to grayscale16 */ -+ for (x = 0; x < par->info->var.xres; ++x) -+ for (y = 0; y < par->info->var.yres; ++y) { -+ u16 pixel = vmem16[y * par->info->var.xres + x]; -+ u16 b = pixel & 0x1f; -+ u16 g = (pixel & (0x3f << 5)) >> 5; -+ u16 r = (pixel & (0x1f << (5 + 6))) >> (5 + 6); -+ -+ pixel = (299 * r + 587 * g + 114 * b) / 200; -+ if (pixel > 255) -+ pixel = 255; -+ -+ /* gamma-correction by table */ -+ convert_buf[y * par->info->var.xres + x] = -+ (signed short)gamma_correction_table[pixel]; -+ } -+ -+ /* Image Dithering */ -+ for (x = 0; x < par->info->var.xres; ++x) -+ for (y = 0; y < par->info->var.yres; ++y) { -+ signed short pixel = -+ convert_buf[y * par->info->var.xres + x]; -+ signed short error_b = pixel - BLACK; -+ signed short error_w = pixel - WHITE; -+ signed short error; -+ u16 i, j; -+ -+ /* what color close? */ -+ if (abs(error_b) >= abs(error_w)) { -+ /* white */ -+ error = error_w; -+ pixel = 0xff; -+ } else { -+ /* black */ -+ error = error_b; -+ pixel = 0; -+ } -+ -+ error /= 8; -+ -+ /* diffusion matrix row */ -+ for (i = 0; i < DIFFUSING_MATRIX_WIDTH; ++i) -+ /* diffusion matrix column */ -+ for (j = 0; j < DIFFUSING_MATRIX_HEIGHT; ++j) { -+ signed short *write_pos; -+ signed char coeff; -+ -+ /* skip pixels out of zone */ -+ if (x + i < 0 || -+ x + i >= par->info->var.xres -+ || y + j >= par->info->var.yres) -+ continue; -+ write_pos = &convert_buf[ -+ (y + j) * par->info->var.xres + -+ x + i]; -+ coeff = diffusing_matrix[i][j]; -+ if (coeff == -1) -+ /* pixel itself */ -+ *write_pos = pixel; -+ else { -+ signed short p = *write_pos + -+ error * coeff; -+ -+ if (p > WHITE) -+ p = WHITE; -+ if (p < BLACK) -+ p = BLACK; -+ *write_pos = p; -+ } -+ } -+ } -+ -+ /* 1 string = 2 pages */ -+ for (y = addr_win.ys_page; y <= addr_win.ye_page; ++y) { -+ /* left half of display */ -+ if (addr_win.xs < par->info->var.xres / 2) { -+ construct_line_bitmap(par, buf, convert_buf, -+ addr_win.xs, par->info->var.xres / 2, y); -+ -+ len = par->info->var.xres / 2 - addr_win.xs; -+ -+ /* select left side (sc0) -+ * set addr -+ */ -+ write_reg(par, 0x00, (1 << 6) | (u8)addr_win.xs); -+ write_reg(par, 0x00, (0x17 << 3) | (u8)y); -+ -+ /* write bitmap */ -+ gpio_set_value(par->RS, 1); /* RS->1 (data mode) */ -+ ret = par->fbtftops.write(par, buf, len); -+ if (ret < 0) -+ dev_err(par->info->device, -+ "%s: write failed and returned: %d\n", -+ __func__, ret); -+ } -+ /* right half of display */ -+ if (addr_win.xe >= par->info->var.xres / 2) { -+ construct_line_bitmap(par, buf, -+ convert_buf, par->info->var.xres / 2, -+ addr_win.xe + 1, y); -+ -+ len = addr_win.xe + 1 - par->info->var.xres / 2; -+ -+ /* select right side (sc1) -+ * set addr -+ */ -+ write_reg(par, 0x01, (1 << 6)); -+ write_reg(par, 0x01, (0x17 << 3) | (u8)y); -+ -+ /* write bitmap */ -+ gpio_set_value(par->RS, 1); /* RS->1 (data mode) */ -+ par->fbtftops.write(par, buf, len); -+ if (ret < 0) -+ dev_err(par->info->device, -+ "%s: write failed and returned: %d\n", -+ __func__, ret); -+ } -+ } -+ kfree(convert_buf); -+ -+ gpio_set_value(par->CS0, 1); -+ gpio_set_value(par->CS1, 1); -+ -+ return ret; -+} -+ -+static int write(struct fbtft_par *par, void *buf, size_t len) -+{ -+ fbtft_par_dbg_hex(DEBUG_WRITE, par, par->info->device, u8, buf, len, -+ "%s(len=%d): ", __func__, len); -+ -+ gpio_set_value(par->RW, 0); /* set write mode */ -+ -+ -+ while (len--) { -+ u8 i, data; -+ -+ data = *(u8 *) buf++; -+ -+ /* set data bus */ -+ for (i = 0; i < 8; ++i) -+ gpio_set_value(par->gpio.db[i], data & (1 << i)); -+ /* set E */ -+ gpio_set_value(par->EPIN, 1); -+ udelay(5); -+ /* unset E - write */ -+ gpio_set_value(par->EPIN, 0); -+ udelay(1); -+ } -+ -+ return 0; -+} -+ -+static struct fbtft_display display = { -+ .regwidth = 8, -+ .width = TOTALWIDTH, -+ .height = HEIGHT, -+ .fps = FPS, -+ .fbtftops = { -+ .init_display = init_display, -+ .set_addr_win = set_addr_win, -+ .verify_gpios = verify_gpios, -+ .request_gpios_match = request_gpios_match, -+ .reset = reset, -+ .write = write, -+ .write_register = write_reg8_bus8, -+ .write_vmem = write_vmem, -+ }, -+}; -+FBTFT_REGISTER_DRIVER(DRVNAME, "displaytronic,fb_agm1264k-fl", &display); -+ -+MODULE_ALIAS("platform:" DRVNAME); -+ -+MODULE_DESCRIPTION("Two KS0108 LCD controllers in AGM1264K-FL display"); -+MODULE_AUTHOR("ololoshka2871"); -+MODULE_LICENSE("GPL"); -diff --git a/drivers/video/fbtft/fb_bd663474.c b/drivers/video/fbtft/fb_bd663474.c -new file mode 100644 -index 0000000..7e00c60 ---- /dev/null -+++ b/drivers/video/fbtft/fb_bd663474.c -@@ -0,0 +1,193 @@ -+/* -+ * FB driver for the uPD161704 LCD Controller -+ * -+ * Copyright (C) 2014 Seong-Woo Kim -+ * -+ * Based on fb_ili9325.c by Noralf Tronnes -+ * Based on ili9325.c by Jeroen Domburg -+ * Init code from UTFT library by Henning Karlsen -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+ -+#include "fbtft.h" -+ -+#define DRVNAME "fb_bd663474" -+#define WIDTH 240 -+#define HEIGHT 320 -+#define BPP 16 -+ -+static int init_display(struct fbtft_par *par) -+{ -+ fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); -+ -+ if (par->gpio.cs != -1) -+ gpio_set_value(par->gpio.cs, 0); /* Activate chip */ -+ -+ par->fbtftops.reset(par); -+ -+ /* Initialization sequence from Lib_UTFT */ -+ -+ /* oscillator start */ -+ write_reg(par, 0x000,0x0001); /*oscillator 0: stop, 1: operation */ -+ mdelay(10); -+ -+ /* Power settings */ -+ write_reg(par, 0x100, 0x0000 ); /* power supply setup */ -+ write_reg(par, 0x101, 0x0000 ); -+ write_reg(par, 0x102, 0x3110 ); -+ write_reg(par, 0x103, 0xe200 ); -+ write_reg(par, 0x110, 0x009d ); -+ write_reg(par, 0x111, 0x0022 ); -+ write_reg(par, 0x100, 0x0120 ); -+ mdelay( 20 ); -+ -+ write_reg(par, 0x100, 0x3120 ); -+ mdelay( 80 ); -+ /* Display control */ -+ write_reg(par, 0x001, 0x0100 ); -+ write_reg(par, 0x002, 0x0000 ); -+ write_reg(par, 0x003, 0x1230 ); -+ write_reg(par, 0x006, 0x0000 ); -+ write_reg(par, 0x007, 0x0101 ); -+ write_reg(par, 0x008, 0x0808 ); -+ write_reg(par, 0x009, 0x0000 ); -+ write_reg(par, 0x00b, 0x0000 ); -+ write_reg(par, 0x00c, 0x0000 ); -+ write_reg(par, 0x00d, 0x0018 ); -+ /* LTPS control settings */ -+ write_reg(par, 0x012, 0x0000 ); -+ write_reg(par, 0x013, 0x0000 ); -+ write_reg(par, 0x018, 0x0000 ); -+ write_reg(par, 0x019, 0x0000 ); -+ -+ write_reg(par, 0x203, 0x0000 ); -+ write_reg(par, 0x204, 0x0000 ); -+ -+ write_reg(par, 0x210, 0x0000 ); -+ write_reg(par, 0x211, 0x00ef ); -+ write_reg(par, 0x212, 0x0000 ); -+ write_reg(par, 0x213, 0x013f ); -+ write_reg(par, 0x214, 0x0000 ); -+ write_reg(par, 0x215, 0x0000 ); -+ write_reg(par, 0x216, 0x0000 ); -+ write_reg(par, 0x217, 0x0000 ); -+ -+ /* Gray scale settings */ -+ write_reg(par, 0x300, 0x5343); -+ write_reg(par, 0x301, 0x1021); -+ write_reg(par, 0x302, 0x0003); -+ write_reg(par, 0x303, 0x0011); -+ write_reg(par, 0x304, 0x050a); -+ write_reg(par, 0x305, 0x4342); -+ write_reg(par, 0x306, 0x1100); -+ write_reg(par, 0x307, 0x0003); -+ write_reg(par, 0x308, 0x1201); -+ write_reg(par, 0x309, 0x050a); -+ -+ /* RAM access settings */ -+ write_reg(par, 0x400, 0x4027 ); -+ write_reg(par, 0x401, 0x0000 ); -+ write_reg(par, 0x402, 0x0000 ); /* First screen drive position (1) */ -+ write_reg(par, 0x403, 0x013f ); /* First screen drive position (2) */ -+ write_reg(par, 0x404, 0x0000 ); -+ -+ write_reg(par, 0x200, 0x0000 ); -+ write_reg(par, 0x201, 0x0000 ); -+ write_reg(par, 0x100, 0x7120 ); -+ write_reg(par, 0x007, 0x0103 ); -+ mdelay( 10 ); -+ write_reg(par, 0x007, 0x0113 ); -+ -+ return 0; -+} -+ -+static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye) -+{ -+ fbtft_par_dbg(DEBUG_SET_ADDR_WIN, par, -+ "%s(xs=%d, ys=%d, xe=%d, ye=%d)\n", __func__, xs, ys, xe, ye); -+ switch (par->info->var.rotate) { -+ /* R200h = Horizontal GRAM Start Address */ -+ /* R201h = Vertical GRAM Start Address */ -+ case 0: -+ write_reg(par, 0x0200, xs); -+ write_reg(par, 0x0201, ys); -+ break; -+ case 180: -+ write_reg(par, 0x0200, WIDTH - 1 - xs); -+ write_reg(par, 0x0201, HEIGHT - 1 - ys); -+ break; -+ case 270: -+ write_reg(par, 0x0200, WIDTH - 1 - ys); -+ write_reg(par, 0x0201, xs); -+ break; -+ case 90: -+ write_reg(par, 0x0200, ys); -+ write_reg(par, 0x0201, HEIGHT - 1 - xs); -+ break; -+ } -+ write_reg(par, 0x202); /* Write Data to GRAM */ -+} -+ -+static int set_var(struct fbtft_par *par) -+{ -+ fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); -+ -+ switch (par->info->var.rotate) { -+ /* AM: GRAM update direction */ -+ case 0: -+ write_reg(par, 0x003, 0x1230); -+ break; -+ case 180: -+ write_reg(par, 0x003, 0x1200); -+ break; -+ case 270: -+ write_reg(par, 0x003, 0x1228); -+ break; -+ case 90: -+ write_reg(par, 0x003, 0x1218); -+ break; -+ } -+ -+ return 0; -+} -+ -+static struct fbtft_display display = { -+ .regwidth = 16, -+ .width = WIDTH, -+ .height = HEIGHT, -+ .bpp = BPP, -+ .fbtftops = { -+ .init_display = init_display, -+ .set_addr_win = set_addr_win, -+ .set_var = set_var, -+ }, -+}; -+FBTFT_REGISTER_DRIVER(DRVNAME, "hitachi,bd663474", &display); -+ -+MODULE_ALIAS("spi:" DRVNAME); -+MODULE_ALIAS("platform:" DRVNAME); -+MODULE_ALIAS("spi:bd663474"); -+MODULE_ALIAS("platform:bd663474"); -+ -+MODULE_DESCRIPTION("FB driver for the uPD161704 LCD Controller"); -+MODULE_AUTHOR("Seong-Woo Kim"); -+MODULE_LICENSE("GPL"); -diff --git a/drivers/video/fbtft/fb_hx8340bn.c b/drivers/video/fbtft/fb_hx8340bn.c -new file mode 100644 -index 0000000..3939502 ---- /dev/null -+++ b/drivers/video/fbtft/fb_hx8340bn.c -@@ -0,0 +1,229 @@ -+/* -+ * FB driver for the HX8340BN LCD Controller -+ * -+ * This display uses 9-bit SPI: Data/Command bit + 8 data bits -+ * For platforms that doesn't support 9-bit, the driver is capable -+ * of emulating this using 8-bit transfer. -+ * This is done by transfering eight 9-bit words in 9 bytes. -+ * -+ * Copyright (C) 2013 Noralf Tronnes -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "fbtft.h" -+ -+#define DRVNAME "fb_hx8340bn" -+#define WIDTH 176 -+#define HEIGHT 220 -+#define TXBUFLEN (4 * PAGE_SIZE) -+#define DEFAULT_GAMMA "1 3 0E 5 0 2 09 0 6 1 7 1 0 2 2\n" \ -+ "3 3 17 8 4 7 05 7 6 0 3 1 6 0 0 " -+ -+ -+static bool emulate; -+module_param(emulate, bool, 0); -+MODULE_PARM_DESC(emulate, "Force emulation in 9-bit mode"); -+ -+ -+static int init_display(struct fbtft_par *par) -+{ -+ fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); -+ -+ par->fbtftops.reset(par); -+ -+ /* BTL221722-276L startup sequence, from datasheet */ -+ -+ /* SETEXTCOM: Set extended command set (C1h) -+ This command is used to set extended command set access enable. -+ Enable: After command (C1h), must write: ffh,83h,40h */ -+ write_reg(par, 0xC1, 0xFF, 0x83, 0x40); -+ -+ /* Sleep out -+ This command turns off sleep mode. -+ In this mode the DC/DC converter is enabled, Internal oscillator -+ is started, and panel scanning is started. */ -+ write_reg(par, 0x11); -+ mdelay(150); -+ -+ /* Undoc'd register? */ -+ write_reg(par, 0xCA, 0x70, 0x00, 0xD9); -+ -+ /* SETOSC: Set Internal Oscillator (B0h) -+ This command is used to set internal oscillator related settings */ -+ /* OSC_EN: Enable internal oscillator */ -+ /* Internal oscillator frequency: 125% x 2.52MHz */ -+ write_reg(par, 0xB0, 0x01, 0x11); -+ -+ /* Drive ability setting */ -+ write_reg(par, 0xC9, 0x90, 0x49, 0x10, 0x28, 0x28, 0x10, 0x00, 0x06); -+ mdelay(20); -+ -+ /* SETPWCTR5: Set Power Control 5(B5h) -+ This command is used to set VCOM Low and VCOM High Voltage */ -+ /* VCOMH 0110101 : 3.925 */ -+ /* VCOML 0100000 : -1.700 */ -+ /* 45h=69 VCOMH: "VMH" + 5d VCOML: "VMH" + 5d */ -+ write_reg(par, 0xB5, 0x35, 0x20, 0x45); -+ -+ /* SETPWCTR4: Set Power Control 4(B4h) -+ VRH[4:0]: Specify the VREG1 voltage adjusting. -+ VREG1 voltage is for gamma voltage setting. -+ BT[2:0]: Switch the output factor of step-up circuit 2 -+ for VGH and VGL voltage generation. */ -+ write_reg(par, 0xB4, 0x33, 0x25, 0x4C); -+ mdelay(10); -+ -+ /* Interface Pixel Format (3Ah) -+ This command is used to define the format of RGB picture data, -+ which is to be transfer via the system and RGB interface. */ -+ /* RGB interface: 16 Bit/Pixel */ -+ write_reg(par, 0x3A, 0x05); -+ -+ /* Display on (29h) -+ This command is used to recover from DISPLAY OFF mode. -+ Output from the Frame Memory is enabled. */ -+ write_reg(par, 0x29); -+ mdelay(10); -+ -+ return 0; -+} -+ -+void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye) -+{ -+ fbtft_par_dbg(DEBUG_SET_ADDR_WIN, par, -+ "%s(xs=%d, ys=%d, xe=%d, ye=%d)\n", __func__, xs, ys, xe, ye); -+ -+ write_reg(par, FBTFT_CASET, 0x00, xs, 0x00, xe); -+ write_reg(par, FBTFT_RASET, 0x00, ys, 0x00, ye); -+ write_reg(par, FBTFT_RAMWR); -+} -+ -+static int set_var(struct fbtft_par *par) -+{ -+ fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); -+ -+ /* MADCTL - Memory data access control */ -+ /* RGB/BGR can be set with H/W pin SRGB and MADCTL BGR bit */ -+#define MY (1 << 7) -+#define MX (1 << 6) -+#define MV (1 << 5) -+ switch (par->info->var.rotate) { -+ case 0: -+ write_reg(par, 0x36, (par->bgr << 3)); -+ break; -+ case 270: -+ write_reg(par, 0x36, MX | MV | (par->bgr << 3)); -+ break; -+ case 180: -+ write_reg(par, 0x36, MX | MY | (par->bgr << 3)); -+ break; -+ case 90: -+ write_reg(par, 0x36, MY | MV | (par->bgr << 3)); -+ break; -+ } -+ -+ return 0; -+} -+ -+/* -+ Gamma Curve selection, GC (only GC0 can be customized): -+ 0 = 2.2, 1 = 1.8, 2 = 2.5, 3 = 1.0 -+ Gamma string format: -+ OP0 OP1 CP0 CP1 CP2 CP3 CP4 MP0 MP1 MP2 MP3 MP4 MP5 CGM0 CGM1 -+ ON0 ON1 CN0 CN1 CN2 CN3 CN4 MN0 MN1 MN2 MN3 MN4 MN5 XXXX GC -+*/ -+#define CURVE(num, idx) curves[num*par->gamma.num_values + idx] -+static int set_gamma(struct fbtft_par *par, unsigned long *curves) -+{ -+ unsigned long mask[] = { -+ 0b1111, 0b1111, 0b11111, 0b1111, 0b1111, 0b1111, 0b11111, -+ 0b111, 0b111, 0b111, 0b111, 0b111, 0b111, 0b11, 0b11, -+ 0b1111, 0b1111, 0b11111, 0b1111, 0b1111, 0b1111, 0b11111, -+ 0b111, 0b111, 0b111, 0b111, 0b111, 0b111, 0b0, 0b0 }; -+ int i, j; -+ -+ fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); -+ -+ /* apply mask */ -+ for (i = 0; i < par->gamma.num_curves; i++) -+ for (j = 0; j < par->gamma.num_values; j++) -+ CURVE(i, j) &= mask[i * par->gamma.num_values + j]; -+ -+ write_reg(par, 0x26, 1 << CURVE(1, 14)); /* Gamma Set (26h) */ -+ -+ if (CURVE(1, 14)) -+ return 0; /* only GC0 can be customized */ -+ -+ write_reg(par, 0xC2, -+ (CURVE(0, 8) << 4) | CURVE(0, 7), -+ (CURVE(0, 10) << 4) | CURVE(0, 9), -+ (CURVE(0, 12) << 4) | CURVE(0, 11), -+ CURVE(0, 2), -+ (CURVE(0, 4) << 4) | CURVE(0, 3), -+ CURVE(0, 5), -+ CURVE(0, 6), -+ (CURVE(0, 1) << 4) | CURVE(0, 0), -+ (CURVE(0, 14) << 2) | CURVE(0, 13)); -+ -+ write_reg(par, 0xC3, -+ (CURVE(1, 8) << 4) | CURVE(1, 7), -+ (CURVE(1, 10) << 4) | CURVE(1, 9), -+ (CURVE(1, 12) << 4) | CURVE(1, 11), -+ CURVE(1, 2), -+ (CURVE(1, 4) << 4) | CURVE(1, 3), -+ CURVE(1, 5), -+ CURVE(1, 6), -+ (CURVE(1, 1) << 4) | CURVE(1, 0)); -+ -+ mdelay(10); -+ -+ return 0; -+} -+#undef CURVE -+ -+ -+static struct fbtft_display display = { -+ .regwidth = 8, -+ .width = WIDTH, -+ .height = HEIGHT, -+ .txbuflen = TXBUFLEN, -+ .gamma_num = 2, -+ .gamma_len = 15, -+ .gamma = DEFAULT_GAMMA, -+ .fbtftops = { -+ .init_display = init_display, -+ .set_addr_win = set_addr_win, -+ .set_var = set_var, -+ .set_gamma = set_gamma, -+ }, -+}; -+FBTFT_REGISTER_DRIVER(DRVNAME, "himax,hx8340bn", &display); -+ -+MODULE_ALIAS("spi:" DRVNAME); -+MODULE_ALIAS("platform:" DRVNAME); -+MODULE_ALIAS("spi:hx8340bn"); -+MODULE_ALIAS("platform:hx8340bn"); -+ -+MODULE_DESCRIPTION("FB driver for the HX8340BN LCD Controller"); -+MODULE_AUTHOR("Noralf Tronnes"); -+MODULE_LICENSE("GPL"); -diff --git a/drivers/video/fbtft/fb_hx8347d.c b/drivers/video/fbtft/fb_hx8347d.c -new file mode 100644 -index 0000000..8139a8f ---- /dev/null -+++ b/drivers/video/fbtft/fb_hx8347d.c -@@ -0,0 +1,181 @@ -+/* -+ * FB driver for the HX8347D LCD Controller -+ * -+ * Copyright (C) 2013 Christian Vogelgsang -+ * -+ * Based on driver code found here: https://github.com/watterott/r61505u-Adapter -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -+ */ -+ -+#include -+#include -+#include -+#include -+ -+#include "fbtft.h" -+ -+#define DRVNAME "fb_hx8347d" -+#define WIDTH 320 -+#define HEIGHT 240 -+#define DEFAULT_GAMMA "0 0 0 0 0 0 0 0 0 0 0 0 0 0\n" \ -+ "0 0 0 0 0 0 0 0 0 0 0 0 0 0" -+ -+ -+static int init_display(struct fbtft_par *par) -+{ -+ fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); -+ -+ par->fbtftops.reset(par); -+ -+ /* driving ability */ -+ write_reg(par, 0xEA, 0x00); -+ write_reg(par, 0xEB, 0x20); -+ write_reg(par, 0xEC, 0x0C); -+ write_reg(par, 0xED, 0xC4); -+ write_reg(par, 0xE8, 0x40); -+ write_reg(par, 0xE9, 0x38); -+ write_reg(par, 0xF1, 0x01); -+ write_reg(par, 0xF2, 0x10); -+ write_reg(par, 0x27, 0xA3); -+ -+ /* power voltage */ -+ write_reg(par, 0x1B, 0x1B); -+ write_reg(par, 0x1A, 0x01); -+ write_reg(par, 0x24, 0x2F); -+ write_reg(par, 0x25, 0x57); -+ -+ /* VCOM offset */ -+ write_reg(par, 0x23, 0x8D); /* for flicker adjust */ -+ -+ /* power on */ -+ write_reg(par, 0x18, 0x36); -+ write_reg(par, 0x19, 0x01); /* start osc */ -+ write_reg(par, 0x01, 0x00); /* wakeup */ -+ write_reg(par, 0x1F, 0x88); -+ mdelay(5); -+ write_reg(par, 0x1F, 0x80); -+ mdelay(5); -+ write_reg(par, 0x1F, 0x90); -+ mdelay(5); -+ write_reg(par, 0x1F, 0xD0); -+ mdelay(5); -+ -+ /* color selection */ -+ write_reg(par, 0x17, 0x05); /* 65k */ -+ -+ /*panel characteristic */ -+ write_reg(par, 0x36, 0x00); -+ -+ /*display on */ -+ write_reg(par, 0x28, 0x38); -+ mdelay(40); -+ write_reg(par, 0x28, 0x3C); -+ -+ /* orientation */ -+ write_reg(par, 0x16, 0x60 | (par->bgr << 3)); -+ -+ return 0; -+} -+ -+static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye) -+{ -+ fbtft_par_dbg(DEBUG_SET_ADDR_WIN, par, -+ "%s(xs=%d, ys=%d, xe=%d, ye=%d)\n", __func__, xs, ys, xe, ye); -+ -+ write_reg(par, 0x02, (xs >> 8) & 0xFF); -+ write_reg(par, 0x03, xs & 0xFF); -+ write_reg(par, 0x04, (xe >> 8) & 0xFF); -+ write_reg(par, 0x05, xe & 0xFF); -+ write_reg(par, 0x06, (ys >> 8) & 0xFF); -+ write_reg(par, 0x07, ys & 0xFF); -+ write_reg(par, 0x08, (ye >> 8) & 0xFF); -+ write_reg(par, 0x09, ye & 0xFF); -+ write_reg(par, 0x22); -+} -+ -+/* -+ Gamma string format: -+ VRP0 VRP1 VRP2 VRP3 VRP4 VRP5 PRP0 PRP1 PKP0 PKP1 PKP2 PKP3 PKP4 CGM -+ VRN0 VRN1 VRN2 VRN3 VRN4 VRN5 PRN0 PRN1 PKN0 PKN1 PKN2 PKN3 PKN4 CGM -+*/ -+#define CURVE(num, idx) curves[num*par->gamma.num_values + idx] -+static int set_gamma(struct fbtft_par *par, unsigned long *curves) -+{ -+ unsigned long mask[] = { -+ 0b111111, 0b111111, 0b111111, 0b111111, 0b111111, 0b111111, -+ 0b1111111, 0b1111111, -+ 0b11111, 0b11111, 0b11111, 0b11111, 0b11111, -+ 0b1111}; -+ int i, j; -+ int acc = 0; -+ -+ fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); -+ -+ /* apply mask */ -+ for (i = 0; i < par->gamma.num_curves; i++) -+ for (j = 0; j < par->gamma.num_values; j++) { -+ acc += CURVE(i, j); -+ CURVE(i, j) &= mask[j]; -+ } -+ -+ if (acc == 0) /* skip if all values are zero */ -+ return 0; -+ -+ for (i = 0; i < par->gamma.num_curves; i++) { -+ write_reg(par, 0x40 + (i * 0x10), CURVE(i, 0)); -+ write_reg(par, 0x41 + (i * 0x10), CURVE(i, 1)); -+ write_reg(par, 0x42 + (i * 0x10), CURVE(i, 2)); -+ write_reg(par, 0x43 + (i * 0x10), CURVE(i, 3)); -+ write_reg(par, 0x44 + (i * 0x10), CURVE(i, 4)); -+ write_reg(par, 0x45 + (i * 0x10), CURVE(i, 5)); -+ write_reg(par, 0x46 + (i * 0x10), CURVE(i, 6)); -+ write_reg(par, 0x47 + (i * 0x10), CURVE(i, 7)); -+ write_reg(par, 0x48 + (i * 0x10), CURVE(i, 8)); -+ write_reg(par, 0x49 + (i * 0x10), CURVE(i, 9)); -+ write_reg(par, 0x4A + (i * 0x10), CURVE(i, 10)); -+ write_reg(par, 0x4B + (i * 0x10), CURVE(i, 11)); -+ write_reg(par, 0x4C + (i * 0x10), CURVE(i, 12)); -+ } -+ write_reg(par, 0x5D, (CURVE(1, 0) << 4) | CURVE(0, 0)); -+ -+ return 0; -+} -+#undef CURVE -+ -+ -+static struct fbtft_display display = { -+ .regwidth = 8, -+ .width = WIDTH, -+ .height = HEIGHT, -+ .gamma_num = 2, -+ .gamma_len = 14, -+ .gamma = DEFAULT_GAMMA, -+ .fbtftops = { -+ .init_display = init_display, -+ .set_addr_win = set_addr_win, -+ .set_gamma = set_gamma, -+ }, -+}; -+FBTFT_REGISTER_DRIVER(DRVNAME, "himax,hx8347d", &display); -+ -+MODULE_ALIAS("spi:" DRVNAME); -+MODULE_ALIAS("platform:" DRVNAME); -+MODULE_ALIAS("spi:hx8347d"); -+MODULE_ALIAS("platform:hx8347d"); -+ -+MODULE_DESCRIPTION("FB driver for the HX8347D LCD Controller"); -+MODULE_AUTHOR("Christian Vogelgsang"); -+MODULE_LICENSE("GPL"); -diff --git a/drivers/video/fbtft/fb_hx8353d.c b/drivers/video/fbtft/fb_hx8353d.c -new file mode 100644 -index 0000000..c9512dc ---- /dev/null -+++ b/drivers/video/fbtft/fb_hx8353d.c -@@ -0,0 +1,166 @@ -+/* -+ * FB driver for the HX8353D LCD Controller -+ * -+ * Copyright (c) 2014 Petr Olivka -+ * Copyright (c) 2013 Noralf Tronnes -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -+ */ -+ -+#include -+#include -+#include -+#include -+ -+#include "fbtft.h" -+ -+#define DRVNAME "fb_hx8353d" -+#define DEFAULT_GAMMA "50 77 40 08 BF 00 03 0F 00 01 73 00 72 03 B0 0F 08 00 0F" -+ -+static int init_display(struct fbtft_par *par) -+{ -+ -+ fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); -+ -+ par->fbtftops.reset(par); -+ mdelay(150); -+ -+ /* SETEXTC */ -+ write_reg(par, 0xB9, 0xFF, 0x83, 0x53); -+ -+ /* RADJ */ -+ write_reg(par, 0xB0, 0x3C, 0x01); -+ -+ /* VCOM */ -+ write_reg(par, 0xB6, 0x94, 0x6C, 0x50); -+ -+ /* PWR */ -+ write_reg(par, 0xB1, 0x00, 0x01, 0x1B, 0x03, 0x01, 0x08, 0x77, 0x89); -+ -+ /* COLMOD */ -+ write_reg(par, 0x3A, 0x05); -+ -+ /* MEM ACCESS */ -+ write_reg(par, 0x36, 0xC0); -+ -+ /* SLPOUT - Sleep out & booster on */ -+ write_reg(par, 0x11); -+ mdelay(150); -+ -+ /* DISPON - Display On */ -+ write_reg(par, 0x29); -+ -+ /* RGBSET */ -+ write_reg(par, 0x2D, -+ 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, -+ 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, -+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, -+ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, -+ 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, -+ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, -+ 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, -+ 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62); -+ -+ return 0; -+}; -+ -+static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye) -+{ -+ fbtft_par_dbg(DEBUG_SET_ADDR_WIN, par, -+ "%s(xs=%d, ys=%d, xe=%d, ye=%d)\n", __func__, xs, ys, xe, ye); -+ -+ /* column address */ -+ write_reg(par, 0x2a, xs >> 8, xs & 0xff, xe >> 8, xe & 0xff); -+ -+ /* row adress */ -+ write_reg(par, 0x2b, ys >> 8, ys & 0xff, ye >> 8, ye & 0xff); -+ -+ /* memory write */ -+ write_reg(par, 0x2c); -+} -+ -+#define my (1 << 7) -+#define mx (1 << 6) -+#define mv (1 << 5) -+static int set_var(struct fbtft_par *par) -+{ -+ fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); -+ -+ /* madctl - memory data access control -+ rgb/bgr: -+ 1. mode selection pin srgb -+ rgb h/w pin for color filter setting: 0=rgb, 1=bgr -+ 2. madctl rgb bit -+ rgb-bgr order color filter panel: 0=rgb, 1=bgr */ -+ switch (par->info->var.rotate) { -+ case 0: -+ write_reg(par, 0x36, mx | my | (par->bgr << 3)); -+ break; -+ case 270: -+ write_reg(par, 0x36, my | mv | (par->bgr << 3)); -+ break; -+ case 180: -+ write_reg(par, 0x36, (par->bgr << 3)); -+ break; -+ case 90: -+ write_reg(par, 0x36, mx | mv | (par->bgr << 3)); -+ break; -+ } -+ -+ return 0; -+} -+ -+/* -+ gamma string format: -+*/ -+static int set_gamma(struct fbtft_par *par, unsigned long *curves) -+{ -+ fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); -+ -+ write_reg(par, 0xE0, -+ curves[0], curves[1], curves[2], curves[3], -+ curves[4], curves[5], curves[6], curves[7], -+ curves[8], curves[9], curves[10], curves[11], -+ curves[12], curves[13], curves[14], curves[15], -+ curves[16], curves[17], curves[18]); -+ -+ return 0; -+} -+ -+ -+static struct fbtft_display display = { -+ .regwidth = 8, -+ .width = 128, -+ .height = 160, -+ .gamma_num = 1, -+ .gamma_len = 19, -+ .gamma = DEFAULT_GAMMA, -+ .fbtftops = { -+ .init_display = init_display, -+ .set_addr_win = set_addr_win, -+ .set_var = set_var, -+ .set_gamma = set_gamma, -+ }, -+}; -+FBTFT_REGISTER_DRIVER(DRVNAME, "himax,hx8353d", &display); -+ -+MODULE_ALIAS("spi:" DRVNAME); -+MODULE_ALIAS("platform:" DRVNAME); -+MODULE_ALIAS("spi:hx8353d"); -+MODULE_ALIAS("platform:hx8353d"); -+ -+MODULE_DESCRIPTION("FB driver for the HX8353D LCD Controller"); -+MODULE_AUTHOR("Petr Olivka"); -+MODULE_LICENSE("GPL"); -diff --git a/drivers/video/fbtft/fb_ili9320.c b/drivers/video/fbtft/fb_ili9320.c -new file mode 100644 -index 0000000..b26d893 ---- /dev/null -+++ b/drivers/video/fbtft/fb_ili9320.c -@@ -0,0 +1,234 @@ -+/* -+ * FB driver for the ILI9320 LCD Controller -+ * -+ * Copyright (C) 2013 Noralf Tronnes -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "fbtft.h" -+ -+#define DRVNAME "fb_ili9320" -+#define WIDTH 240 -+#define HEIGHT 320 -+#define DEFAULT_GAMMA "07 07 6 0 0 0 5 5 4 0\n" \ -+ "07 08 4 7 5 1 2 0 7 7" -+ -+ -+static unsigned read_devicecode(struct fbtft_par *par) -+{ -+ int ret; -+ u8 rxbuf[8] = {0, }; -+ -+ write_reg(par, 0x0000); -+ ret = par->fbtftops.read(par, rxbuf, 4); -+ return (rxbuf[2] << 8) | rxbuf[3]; -+} -+ -+static int init_display(struct fbtft_par *par) -+{ -+ unsigned devcode; -+ fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); -+ -+ par->fbtftops.reset(par); -+ -+ devcode = read_devicecode(par); -+ fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "Device code: 0x%04X\n", -+ devcode); -+ if ((devcode != 0x0000) && (devcode != 0x9320)) -+ dev_warn(par->info->device, -+ "Unrecognized Device code: 0x%04X (expected 0x9320)\n", -+ devcode); -+ -+ /* Initialization sequence from ILI9320 Application Notes */ -+ -+ /* *********** Start Initial Sequence ********* */ -+ write_reg(par, 0x00E5, 0x8000); /* Set the Vcore voltage and this setting is must. */ -+ write_reg(par, 0x0000, 0x0001); /* Start internal OSC. */ -+ write_reg(par, 0x0001, 0x0100); /* set SS and SM bit */ -+ write_reg(par, 0x0002, 0x0700); /* set 1 line inversion */ -+ write_reg(par, 0x0004, 0x0000); /* Resize register */ -+ write_reg(par, 0x0008, 0x0202); /* set the back and front porch */ -+ write_reg(par, 0x0009, 0x0000); /* set non-display area refresh cycle */ -+ write_reg(par, 0x000A, 0x0000); /* FMARK function */ -+ write_reg(par, 0x000C, 0x0000); /* RGB interface setting */ -+ write_reg(par, 0x000D, 0x0000); /* Frame marker Position */ -+ write_reg(par, 0x000F, 0x0000); /* RGB interface polarity */ -+ -+ /* ***********Power On sequence *************** */ -+ write_reg(par, 0x0010, 0x0000); /* SAP, BT[3:0], AP, DSTB, SLP, STB */ -+ write_reg(par, 0x0011, 0x0007); /* DC1[2:0], DC0[2:0], VC[2:0] */ -+ write_reg(par, 0x0012, 0x0000); /* VREG1OUT voltage */ -+ write_reg(par, 0x0013, 0x0000); /* VDV[4:0] for VCOM amplitude */ -+ mdelay(200); /* Dis-charge capacitor power voltage */ -+ write_reg(par, 0x0010, 0x17B0); /* SAP, BT[3:0], AP, DSTB, SLP, STB */ -+ write_reg(par, 0x0011, 0x0031); /* R11h=0x0031 at VCI=3.3V DC1[2:0], DC0[2:0], VC[2:0] */ -+ mdelay(50); -+ write_reg(par, 0x0012, 0x0138); /* R12h=0x0138 at VCI=3.3V VREG1OUT voltage */ -+ mdelay(50); -+ write_reg(par, 0x0013, 0x1800); /* R13h=0x1800 at VCI=3.3V VDV[4:0] for VCOM amplitude */ -+ write_reg(par, 0x0029, 0x0008); /* R29h=0x0008 at VCI=3.3V VCM[4:0] for VCOMH */ -+ mdelay(50); -+ write_reg(par, 0x0020, 0x0000); /* GRAM horizontal Address */ -+ write_reg(par, 0x0021, 0x0000); /* GRAM Vertical Address */ -+ -+ /* ------------------ Set GRAM area --------------- */ -+ write_reg(par, 0x0050, 0x0000); /* Horizontal GRAM Start Address */ -+ write_reg(par, 0x0051, 0x00EF); /* Horizontal GRAM End Address */ -+ write_reg(par, 0x0052, 0x0000); /* Vertical GRAM Start Address */ -+ write_reg(par, 0x0053, 0x013F); /* Vertical GRAM Start Address */ -+ write_reg(par, 0x0060, 0x2700); /* Gate Scan Line */ -+ write_reg(par, 0x0061, 0x0001); /* NDL,VLE, REV */ -+ write_reg(par, 0x006A, 0x0000); /* set scrolling line */ -+ -+ /* -------------- Partial Display Control --------- */ -+ write_reg(par, 0x0080, 0x0000); -+ write_reg(par, 0x0081, 0x0000); -+ write_reg(par, 0x0082, 0x0000); -+ write_reg(par, 0x0083, 0x0000); -+ write_reg(par, 0x0084, 0x0000); -+ write_reg(par, 0x0085, 0x0000); -+ -+ /* -------------- Panel Control ------------------- */ -+ write_reg(par, 0x0090, 0x0010); -+ write_reg(par, 0x0092, 0x0000); -+ write_reg(par, 0x0093, 0x0003); -+ write_reg(par, 0x0095, 0x0110); -+ write_reg(par, 0x0097, 0x0000); -+ write_reg(par, 0x0098, 0x0000); -+ write_reg(par, 0x0007, 0x0173); /* 262K color and display ON */ -+ -+ return 0; -+} -+ -+static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye) -+{ -+ fbtft_par_dbg(DEBUG_SET_ADDR_WIN, par, -+ "%s(xs=%d, ys=%d, xe=%d, ye=%d)\n", __func__, xs, ys, xe, ye); -+ -+ switch (par->info->var.rotate) { -+ /* R20h = Horizontal GRAM Start Address */ -+ /* R21h = Vertical GRAM Start Address */ -+ case 0: -+ write_reg(par, 0x0020, xs); -+ write_reg(par, 0x0021, ys); -+ break; -+ case 180: -+ write_reg(par, 0x0020, WIDTH - 1 - xs); -+ write_reg(par, 0x0021, HEIGHT - 1 - ys); -+ break; -+ case 270: -+ write_reg(par, 0x0020, WIDTH - 1 - ys); -+ write_reg(par, 0x0021, xs); -+ break; -+ case 90: -+ write_reg(par, 0x0020, ys); -+ write_reg(par, 0x0021, HEIGHT - 1 - xs); -+ break; -+ } -+ write_reg(par, 0x0022); /* Write Data to GRAM */ -+} -+ -+static int set_var(struct fbtft_par *par) -+{ -+ fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); -+ -+ switch (par->info->var.rotate) { -+ case 0: -+ write_reg(par, 0x3, (par->bgr << 12) | 0x30); -+ break; -+ case 270: -+ write_reg(par, 0x3, (par->bgr << 12) | 0x28); -+ break; -+ case 180: -+ write_reg(par, 0x3, (par->bgr << 12) | 0x00); -+ break; -+ case 90: -+ write_reg(par, 0x3, (par->bgr << 12) | 0x18); -+ break; -+ } -+ return 0; -+} -+ -+/* -+ Gamma string format: -+ VRP0 VRP1 RP0 RP1 KP0 KP1 KP2 KP3 KP4 KP5 -+ VRN0 VRN1 RN0 RN1 KN0 KN1 KN2 KN3 KN4 KN5 -+*/ -+#define CURVE(num, idx) curves[num*par->gamma.num_values + idx] -+static int set_gamma(struct fbtft_par *par, unsigned long *curves) -+{ -+ unsigned long mask[] = { -+ 0b11111, 0b11111, 0b111, 0b111, 0b111, -+ 0b111, 0b111, 0b111, 0b111, 0b111, -+ 0b11111, 0b11111, 0b111, 0b111, 0b111, -+ 0b111, 0b111, 0b111, 0b111, 0b111 }; -+ int i, j; -+ -+ fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); -+ -+ /* apply mask */ -+ for (i = 0; i < 2; i++) -+ for (j = 0; j < 10; j++) -+ CURVE(i, j) &= mask[i*par->gamma.num_values + j]; -+ -+ write_reg(par, 0x0030, CURVE(0, 5) << 8 | CURVE(0, 4)); -+ write_reg(par, 0x0031, CURVE(0, 7) << 8 | CURVE(0, 6)); -+ write_reg(par, 0x0032, CURVE(0, 9) << 8 | CURVE(0, 8)); -+ write_reg(par, 0x0035, CURVE(0, 3) << 8 | CURVE(0, 2)); -+ write_reg(par, 0x0036, CURVE(0, 1) << 8 | CURVE(0, 0)); -+ -+ write_reg(par, 0x0037, CURVE(1, 5) << 8 | CURVE(1, 4)); -+ write_reg(par, 0x0038, CURVE(1, 7) << 8 | CURVE(1, 6)); -+ write_reg(par, 0x0039, CURVE(1, 9) << 8 | CURVE(1, 8)); -+ write_reg(par, 0x003C, CURVE(1, 3) << 8 | CURVE(1, 2)); -+ write_reg(par, 0x003D, CURVE(1, 1) << 8 | CURVE(1, 0)); -+ -+ return 0; -+} -+#undef CURVE -+ -+ -+static struct fbtft_display display = { -+ .regwidth = 16, -+ .width = WIDTH, -+ .height = HEIGHT, -+ .gamma_num = 2, -+ .gamma_len = 10, -+ .gamma = DEFAULT_GAMMA, -+ .fbtftops = { -+ .init_display = init_display, -+ .set_addr_win = set_addr_win, -+ .set_var = set_var, -+ .set_gamma = set_gamma, -+ }, -+}; -+FBTFT_REGISTER_DRIVER(DRVNAME, "ilitek,ili9320", &display); -+ -+MODULE_ALIAS("spi:" DRVNAME); -+MODULE_ALIAS("platform:" DRVNAME); -+MODULE_ALIAS("spi:ili9320"); -+MODULE_ALIAS("platform:ili9320"); -+ -+MODULE_DESCRIPTION("FB driver for the ILI9320 LCD Controller"); -+MODULE_AUTHOR("Noralf Tronnes"); -+MODULE_LICENSE("GPL"); -diff --git a/drivers/video/fbtft/fb_ili9325.c b/drivers/video/fbtft/fb_ili9325.c -new file mode 100644 -index 0000000..5f88145 ---- /dev/null -+++ b/drivers/video/fbtft/fb_ili9325.c -@@ -0,0 +1,291 @@ -+/* -+ * FB driver for the ILI9325 LCD Controller -+ * -+ * Copyright (C) 2013 Noralf Tronnes -+ * -+ * Based on ili9325.c by Jeroen Domburg -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+ -+#include "fbtft.h" -+ -+#define DRVNAME "fb_ili9325" -+#define WIDTH 240 -+#define HEIGHT 320 -+#define BPP 16 -+#define FPS 20 -+#define DEFAULT_GAMMA "0F 00 7 2 0 0 6 5 4 1\n" \ -+ "04 16 2 7 6 3 2 1 7 7" -+ -+ -+static unsigned bt = 6; /* VGL=Vci*4 , VGH=Vci*4 */ -+module_param(bt, uint, 0); -+MODULE_PARM_DESC(bt, "Sets the factor used in the step-up circuits"); -+ -+static unsigned vc = 0b011; /* Vci1=Vci*0.80 */ -+module_param(vc, uint, 0); -+MODULE_PARM_DESC(vc, -+"Sets the ratio factor of Vci to generate the reference voltages Vci1"); -+ -+static unsigned vrh = 0b1101; /* VREG1OUT=Vci*1.85 */ -+module_param(vrh, uint, 0); -+MODULE_PARM_DESC(vrh, -+"Set the amplifying rate (1.6 ~ 1.9) of Vci applied to output the VREG1OUT"); -+ -+static unsigned vdv = 0b10010; /* VCOMH amplitude=VREG1OUT*0.98 */ -+module_param(vdv, uint, 0); -+MODULE_PARM_DESC(vdv, -+"Select the factor of VREG1OUT to set the amplitude of Vcom"); -+ -+static unsigned vcm = 0b001010; /* VCOMH=VREG1OUT*0.735 */ -+module_param(vcm, uint, 0); -+MODULE_PARM_DESC(vcm, "Set the internal VcomH voltage"); -+ -+ -+/* -+Verify that this configuration is within the Voltage limits -+ -+Display module configuration: Vcc = IOVcc = Vci = 3.3V -+ -+ Voltages -+---------- -+Vci = 3.3 -+Vci1 = Vci * 0.80 = 2.64 -+DDVDH = Vci1 * 2 = 5.28 -+VCL = -Vci1 = -2.64 -+VREG1OUT = Vci * 1.85 = 4.88 -+VCOMH = VREG1OUT * 0.735 = 3.59 -+VCOM amplitude = VREG1OUT * 0.98 = 4.79 -+VGH = Vci * 4 = 13.2 -+VGL = -Vci * 4 = -13.2 -+ -+ Limits -+-------- -+Power supplies -+1.65 < IOVcc < 3.30 => 1.65 < 3.3 < 3.30 -+2.40 < Vcc < 3.30 => 2.40 < 3.3 < 3.30 -+2.50 < Vci < 3.30 => 2.50 < 3.3 < 3.30 -+ -+Source/VCOM power supply voltage -+ 4.50 < DDVDH < 6.0 => 4.50 < 5.28 < 6.0 -+-3.0 < VCL < -2.0 => -3.0 < -2.64 < -2.0 -+VCI - VCL < 6.0 => 5.94 < 6.0 -+ -+Gate driver output voltage -+ 10 < VGH < 20 => 10 < 13.2 < 20 -+-15 < VGL < -5 => -15 < -13.2 < -5 -+VGH - VGL < 32 => 26.4 < 32 -+ -+VCOM driver output voltage -+VCOMH - VCOML < 6.0 => 4.79 < 6.0 -+*/ -+ -+static int init_display(struct fbtft_par *par) -+{ -+ fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); -+ -+ par->fbtftops.reset(par); -+ -+ if (par->gpio.cs != -1) -+ gpio_set_value(par->gpio.cs, 0); /* Activate chip */ -+ -+ bt &= 0b111; -+ vc &= 0b111; -+ vrh &= 0b1111; -+ vdv &= 0b11111; -+ vcm &= 0b111111; -+ -+ /* Initialization sequence from ILI9325 Application Notes */ -+ -+ /* ----------- Start Initial Sequence ----------- */ -+ write_reg(par, 0x00E3, 0x3008); /* Set internal timing */ -+ write_reg(par, 0x00E7, 0x0012); /* Set internal timing */ -+ write_reg(par, 0x00EF, 0x1231); /* Set internal timing */ -+ write_reg(par, 0x0001, 0x0100); /* set SS and SM bit */ -+ write_reg(par, 0x0002, 0x0700); /* set 1 line inversion */ -+ write_reg(par, 0x0004, 0x0000); /* Resize register */ -+ write_reg(par, 0x0008, 0x0207); /* set the back porch and front porch */ -+ write_reg(par, 0x0009, 0x0000); /* set non-display area refresh cycle */ -+ write_reg(par, 0x000A, 0x0000); /* FMARK function */ -+ write_reg(par, 0x000C, 0x0000); /* RGB interface setting */ -+ write_reg(par, 0x000D, 0x0000); /* Frame marker Position */ -+ write_reg(par, 0x000F, 0x0000); /* RGB interface polarity */ -+ -+ /* ----------- Power On sequence ----------- */ -+ write_reg(par, 0x0010, 0x0000); /* SAP, BT[3:0], AP, DSTB, SLP, STB */ -+ write_reg(par, 0x0011, 0x0007); /* DC1[2:0], DC0[2:0], VC[2:0] */ -+ write_reg(par, 0x0012, 0x0000); /* VREG1OUT voltage */ -+ write_reg(par, 0x0013, 0x0000); /* VDV[4:0] for VCOM amplitude */ -+ mdelay(200); /* Dis-charge capacitor power voltage */ -+ write_reg(par, 0x0010, /* SAP, BT[3:0], AP, DSTB, SLP, STB */ -+ (1 << 12) | (bt << 8) | (1 << 7) | (0b001 << 4)); -+ write_reg(par, 0x0011, 0x220 | vc); /* DC1[2:0], DC0[2:0], VC[2:0] */ -+ mdelay(50); /* Delay 50ms */ -+ write_reg(par, 0x0012, vrh); /* Internal reference voltage= Vci; */ -+ mdelay(50); /* Delay 50ms */ -+ write_reg(par, 0x0013, vdv << 8); /* Set VDV[4:0] for VCOM amplitude */ -+ write_reg(par, 0x0029, vcm); /* Set VCM[5:0] for VCOMH */ -+ write_reg(par, 0x002B, 0x000C); /* Set Frame Rate */ -+ mdelay(50); /* Delay 50ms */ -+ write_reg(par, 0x0020, 0x0000); /* GRAM horizontal Address */ -+ write_reg(par, 0x0021, 0x0000); /* GRAM Vertical Address */ -+ -+ /*------------------ Set GRAM area --------------- */ -+ write_reg(par, 0x0050, 0x0000); /* Horizontal GRAM Start Address */ -+ write_reg(par, 0x0051, 0x00EF); /* Horizontal GRAM End Address */ -+ write_reg(par, 0x0052, 0x0000); /* Vertical GRAM Start Address */ -+ write_reg(par, 0x0053, 0x013F); /* Vertical GRAM Start Address */ -+ write_reg(par, 0x0060, 0xA700); /* Gate Scan Line */ -+ write_reg(par, 0x0061, 0x0001); /* NDL,VLE, REV */ -+ write_reg(par, 0x006A, 0x0000); /* set scrolling line */ -+ -+ /*-------------- Partial Display Control --------- */ -+ write_reg(par, 0x0080, 0x0000); -+ write_reg(par, 0x0081, 0x0000); -+ write_reg(par, 0x0082, 0x0000); -+ write_reg(par, 0x0083, 0x0000); -+ write_reg(par, 0x0084, 0x0000); -+ write_reg(par, 0x0085, 0x0000); -+ -+ /*-------------- Panel Control ------------------- */ -+ write_reg(par, 0x0090, 0x0010); -+ write_reg(par, 0x0092, 0x0600); -+ write_reg(par, 0x0007, 0x0133); /* 262K color and display ON */ -+ -+ return 0; -+} -+ -+static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye) -+{ -+ fbtft_par_dbg(DEBUG_SET_ADDR_WIN, par, -+ "%s(xs=%d, ys=%d, xe=%d, ye=%d)\n", __func__, xs, ys, xe, ye); -+ switch (par->info->var.rotate) { -+ /* R20h = Horizontal GRAM Start Address */ -+ /* R21h = Vertical GRAM Start Address */ -+ case 0: -+ write_reg(par, 0x0020, xs); -+ write_reg(par, 0x0021, ys); -+ break; -+ case 180: -+ write_reg(par, 0x0020, WIDTH - 1 - xs); -+ write_reg(par, 0x0021, HEIGHT - 1 - ys); -+ break; -+ case 270: -+ write_reg(par, 0x0020, WIDTH - 1 - ys); -+ write_reg(par, 0x0021, xs); -+ break; -+ case 90: -+ write_reg(par, 0x0020, ys); -+ write_reg(par, 0x0021, HEIGHT - 1 - xs); -+ break; -+ } -+ write_reg(par, 0x0022); /* Write Data to GRAM */ -+} -+ -+static int set_var(struct fbtft_par *par) -+{ -+ fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); -+ -+ switch (par->info->var.rotate) { -+ /* AM: GRAM update direction */ -+ case 0: -+ write_reg(par, 0x03, 0x0030 | (par->bgr << 12)); -+ break; -+ case 180: -+ write_reg(par, 0x03, 0x0000 | (par->bgr << 12)); -+ break; -+ case 270: -+ write_reg(par, 0x03, 0x0028 | (par->bgr << 12)); -+ break; -+ case 90: -+ write_reg(par, 0x03, 0x0018 | (par->bgr << 12)); -+ break; -+ } -+ -+ return 0; -+} -+ -+/* -+ Gamma string format: -+ VRP0 VRP1 RP0 RP1 KP0 KP1 KP2 KP3 KP4 KP5 -+ VRN0 VRN1 RN0 RN1 KN0 KN1 KN2 KN3 KN4 KN5 -+*/ -+#define CURVE(num, idx) curves[num*par->gamma.num_values + idx] -+static int set_gamma(struct fbtft_par *par, unsigned long *curves) -+{ -+ unsigned long mask[] = { -+ 0b11111, 0b11111, 0b111, 0b111, 0b111, -+ 0b111, 0b111, 0b111, 0b111, 0b111, -+ 0b11111, 0b11111, 0b111, 0b111, 0b111, -+ 0b111, 0b111, 0b111, 0b111, 0b111 }; -+ int i, j; -+ -+ fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); -+ -+ /* apply mask */ -+ for (i = 0; i < 2; i++) -+ for (j = 0; j < 10; j++) -+ CURVE(i, j) &= mask[i*par->gamma.num_values + j]; -+ -+ write_reg(par, 0x0030, CURVE(0, 5) << 8 | CURVE(0, 4)); -+ write_reg(par, 0x0031, CURVE(0, 7) << 8 | CURVE(0, 6)); -+ write_reg(par, 0x0032, CURVE(0, 9) << 8 | CURVE(0, 8)); -+ write_reg(par, 0x0035, CURVE(0, 3) << 8 | CURVE(0, 2)); -+ write_reg(par, 0x0036, CURVE(0, 1) << 8 | CURVE(0, 0)); -+ -+ write_reg(par, 0x0037, CURVE(1, 5) << 8 | CURVE(1, 4)); -+ write_reg(par, 0x0038, CURVE(1, 7) << 8 | CURVE(1, 6)); -+ write_reg(par, 0x0039, CURVE(1, 9) << 8 | CURVE(1, 8)); -+ write_reg(par, 0x003C, CURVE(1, 3) << 8 | CURVE(1, 2)); -+ write_reg(par, 0x003D, CURVE(1, 1) << 8 | CURVE(1, 0)); -+ -+ return 0; -+} -+#undef CURVE -+ -+ -+static struct fbtft_display display = { -+ .regwidth = 16, -+ .width = WIDTH, -+ .height = HEIGHT, -+ .bpp = BPP, -+ .fps = FPS, -+ .gamma_num = 2, -+ .gamma_len = 10, -+ .gamma = DEFAULT_GAMMA, -+ .fbtftops = { -+ .init_display = init_display, -+ .set_addr_win = set_addr_win, -+ .set_var = set_var, -+ .set_gamma = set_gamma, -+ }, -+}; -+FBTFT_REGISTER_DRIVER(DRVNAME, "ilitek,ili9325", &display); -+ -+MODULE_ALIAS("spi:" DRVNAME); -+MODULE_ALIAS("platform:" DRVNAME); -+MODULE_ALIAS("spi:ili9325"); -+MODULE_ALIAS("platform:ili9325"); -+ -+MODULE_DESCRIPTION("FB driver for the ILI9325 LCD Controller"); -+MODULE_AUTHOR("Noralf Tronnes"); -+MODULE_LICENSE("GPL"); -diff --git a/drivers/video/fbtft/fb_ili9340.c b/drivers/video/fbtft/fb_ili9340.c -new file mode 100644 -index 0000000..985687d ---- /dev/null -+++ b/drivers/video/fbtft/fb_ili9340.c -@@ -0,0 +1,163 @@ -+/* -+ * FB driver for the ILI9340 LCD Controller -+ * -+ * Copyright (C) 2013 Noralf Tronnes -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+ -+#include "fbtft.h" -+ -+#define DRVNAME "fb_ili9340" -+#define WIDTH 240 -+#define HEIGHT 320 -+ -+ -+/* Init sequence taken from: Arduino Library for the Adafruit 2.2" display */ -+static int init_display(struct fbtft_par *par) -+{ -+ fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); -+ -+ par->fbtftops.reset(par); -+ -+ write_reg(par, 0xEF, 0x03, 0x80, 0x02); -+ write_reg(par, 0xCF, 0x00 , 0XC1 , 0X30); -+ write_reg(par, 0xED, 0x64 , 0x03 , 0X12 , 0X81); -+ write_reg(par, 0xE8, 0x85 , 0x00 , 0x78); -+ write_reg(par, 0xCB, 0x39 , 0x2C , 0x00 , 0x34 , 0x02); -+ write_reg(par, 0xF7, 0x20); -+ write_reg(par, 0xEA, 0x00 , 0x00); -+ -+ /* Power Control 1 */ -+ write_reg(par, 0xC0, 0x23); -+ -+ /* Power Control 2 */ -+ write_reg(par, 0xC1, 0x10); -+ -+ /* VCOM Control 1 */ -+ write_reg(par, 0xC5, 0x3e, 0x28); -+ -+ /* VCOM Control 2 */ -+ write_reg(par, 0xC7, 0x86); -+ -+ /* COLMOD: Pixel Format Set */ -+ /* 16 bits/pixel */ -+ write_reg(par, 0x3A, 0x55); -+ -+ /* Frame Rate Control */ -+ /* Division ratio = fosc, Frame Rate = 79Hz */ -+ write_reg(par, 0xB1, 0x00, 0x18); -+ -+ /* Display Function Control */ -+ write_reg(par, 0xB6, 0x08, 0x82, 0x27); -+ -+ /* Gamma Function Disable */ -+ write_reg(par, 0xF2, 0x00); -+ -+ /* Gamma curve selected */ -+ write_reg(par, 0x26, 0x01); -+ -+ /* Positive Gamma Correction */ -+ write_reg(par, 0xE0, -+ 0x0F, 0x31, 0x2B, 0x0C, 0x0E, 0x08, 0x4E, 0xF1, -+ 0x37, 0x07, 0x10, 0x03, 0x0E, 0x09, 0x00); -+ -+ /* Negative Gamma Correction */ -+ write_reg(par, 0xE1, -+ 0x00, 0x0E, 0x14, 0x03, 0x11, 0x07, 0x31, 0xC1, -+ 0x48, 0x08, 0x0F, 0x0C, 0x31, 0x36, 0x0F); -+ -+ /* Sleep OUT */ -+ write_reg(par, 0x11); -+ -+ mdelay(120); -+ -+ /* Display ON */ -+ write_reg(par, 0x29); -+ -+ return 0; -+} -+ -+static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye) -+{ -+ fbtft_par_dbg(DEBUG_SET_ADDR_WIN, par, -+ "%s(xs=%d, ys=%d, xe=%d, ye=%d)\n", __func__, xs, ys, xe, ye); -+ -+ /* Column address */ -+ write_reg(par, 0x2A, xs >> 8, xs & 0xFF, xe >> 8, xe & 0xFF); -+ -+ /* Row adress */ -+ write_reg(par, 0x2B, ys >> 8, ys & 0xFF, ye >> 8, ye & 0xFF); -+ -+ /* Memory write */ -+ write_reg(par, 0x2C); -+} -+ -+#define ILI9340_MADCTL_MV 0x20 -+#define ILI9340_MADCTL_MX 0x40 -+#define ILI9340_MADCTL_MY 0x80 -+static int set_var(struct fbtft_par *par) -+{ -+ u8 val; -+ -+ fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); -+ -+ switch (par->info->var.rotate) { -+ case 270: -+ val = ILI9340_MADCTL_MV; -+ break; -+ case 180: -+ val = ILI9340_MADCTL_MY; -+ break; -+ case 90: -+ val = ILI9340_MADCTL_MV | ILI9340_MADCTL_MY | ILI9340_MADCTL_MX; -+ break; -+ default: -+ val = ILI9340_MADCTL_MX; -+ break; -+ } -+ /* Memory Access Control */ -+ write_reg(par, 0x36, val | (par->bgr << 3)); -+ -+ return 0; -+} -+ -+ -+static struct fbtft_display display = { -+ .regwidth = 8, -+ .width = WIDTH, -+ .height = HEIGHT, -+ .fbtftops = { -+ .init_display = init_display, -+ .set_addr_win = set_addr_win, -+ .set_var = set_var, -+ }, -+}; -+FBTFT_REGISTER_DRIVER(DRVNAME, "ilitek,ili9340", &display); -+ -+MODULE_ALIAS("spi:" DRVNAME); -+MODULE_ALIAS("platform:" DRVNAME); -+MODULE_ALIAS("spi:ili9340"); -+MODULE_ALIAS("platform:ili9340"); -+ -+MODULE_DESCRIPTION("FB driver for the ILI9340 LCD Controller"); -+MODULE_AUTHOR("Noralf Tronnes"); -+MODULE_LICENSE("GPL"); -diff --git a/drivers/video/fbtft/fb_ili9341.c b/drivers/video/fbtft/fb_ili9341.c -new file mode 100644 -index 0000000..225b2d8 ---- /dev/null -+++ b/drivers/video/fbtft/fb_ili9341.c -@@ -0,0 +1,179 @@ -+/* -+ * FB driver for the ILI9341 LCD display controller -+ * -+ * This display uses 9-bit SPI: Data/Command bit + 8 data bits -+ * For platforms that doesn't support 9-bit, the driver is capable -+ * of emulating this using 8-bit transfer. -+ * This is done by transfering eight 9-bit words in 9 bytes. -+ * -+ * Copyright (C) 2013 Christian Vogelgsang -+ * Based on adafruit22fb.c by Noralf Tronnes -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -+ */ -+ -+#include -+#include -+#include -+#include -+ -+#include "fbtft.h" -+ -+#define DRVNAME "fb_ili9341" -+#define WIDTH 240 -+#define HEIGHT 320 -+#define TXBUFLEN (4 * PAGE_SIZE) -+#define DEFAULT_GAMMA "1F 1A 18 0A 0F 06 45 87 32 0A 07 02 07 05 00\n" \ -+ "00 25 27 05 10 09 3A 78 4D 05 18 0D 38 3A 1F" -+ -+ -+static int init_display(struct fbtft_par *par) -+{ -+ fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); -+ -+ par->fbtftops.reset(par); -+ -+ /* startup sequence for MI0283QT-9A */ -+ write_reg(par, 0x01); /* software reset */ -+ mdelay(5); -+ write_reg(par, 0x28); /* display off */ -+ /* --------------------------------------------------------- */ -+ write_reg(par, 0xCF, 0x00, 0x83, 0x30); -+ write_reg(par, 0xED, 0x64, 0x03, 0x12, 0x81); -+ write_reg(par, 0xE8, 0x85, 0x01, 0x79); -+ write_reg(par, 0xCB, 0x39, 0X2C, 0x00, 0x34, 0x02); -+ write_reg(par, 0xF7, 0x20); -+ write_reg(par, 0xEA, 0x00, 0x00); -+ /* ------------power control-------------------------------- */ -+ write_reg(par, 0xC0, 0x26); -+ write_reg(par, 0xC1, 0x11); -+ /* ------------VCOM --------- */ -+ write_reg(par, 0xC5, 0x35, 0x3E); -+ write_reg(par, 0xC7, 0xBE); -+ /* ------------memory access control------------------------ */ -+ write_reg(par, 0x3A, 0x55); /* 16bit pixel */ -+ /* ------------frame rate----------------------------------- */ -+ write_reg(par, 0xB1, 0x00, 0x1B); -+ /* ------------Gamma---------------------------------------- */ -+ /* write_reg(par, 0xF2, 0x08); */ /* Gamma Function Disable */ -+ write_reg(par, 0x26, 0x01); -+ /* ------------display-------------------------------------- */ -+ write_reg(par, 0xB7, 0x07); /* entry mode set */ -+ write_reg(par, 0xB6, 0x0A, 0x82, 0x27, 0x00); -+ write_reg(par, 0x11); /* sleep out */ -+ mdelay(100); -+ write_reg(par, 0x29); /* display on */ -+ mdelay(20); -+ -+ return 0; -+} -+ -+static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye) -+{ -+ fbtft_par_dbg(DEBUG_SET_ADDR_WIN, par, -+ "%s(xs=%d, ys=%d, xe=%d, ye=%d)\n", __func__, xs, ys, xe, ye); -+ -+ /* Column address set */ -+ write_reg(par, 0x2A, -+ (xs >> 8) & 0xFF, xs & 0xFF, (xe >> 8) & 0xFF, xe & 0xFF); -+ -+ /* Row adress set */ -+ write_reg(par, 0x2B, -+ (ys >> 8) & 0xFF, ys & 0xFF, (ye >> 8) & 0xFF, ye & 0xFF); -+ -+ /* Memory write */ -+ write_reg(par, 0x2C); -+} -+ -+#define MEM_Y (7) /* MY row address order */ -+#define MEM_X (6) /* MX column address order */ -+#define MEM_V (5) /* MV row / column exchange */ -+#define MEM_L (4) /* ML vertical refresh order */ -+#define MEM_H (2) /* MH horizontal refresh order */ -+#define MEM_BGR (3) /* RGB-BGR Order */ -+static int set_var(struct fbtft_par *par) -+{ -+ fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); -+ -+ switch (par->info->var.rotate) { -+ case 0: -+ write_reg(par, 0x36, (1 << MEM_X) | (par->bgr << MEM_BGR)); -+ break; -+ case 270: -+ write_reg(par, 0x36, -+ (1<bgr << MEM_BGR)); -+ break; -+ case 180: -+ write_reg(par, 0x36, (1 << MEM_Y) | (par->bgr << MEM_BGR)); -+ break; -+ case 90: -+ write_reg(par, 0x36, (1 << MEM_Y) | (1 << MEM_X) | -+ (1 << MEM_V) | (par->bgr << MEM_BGR)); -+ break; -+ } -+ -+ return 0; -+} -+ -+/* -+ Gamma string format: -+ Positive: Par1 Par2 [...] Par15 -+ Negative: Par1 Par2 [...] Par15 -+*/ -+#define CURVE(num, idx) curves[num*par->gamma.num_values + idx] -+static int set_gamma(struct fbtft_par *par, unsigned long *curves) -+{ -+ int i; -+ -+ fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); -+ -+ for (i = 0; i < par->gamma.num_curves; i++) -+ write_reg(par, 0xE0 + i, -+ CURVE(i, 0), CURVE(i, 1), CURVE(i, 2), -+ CURVE(i, 3), CURVE(i, 4), CURVE(i, 5), -+ CURVE(i, 6), CURVE(i, 7), CURVE(i, 8), -+ CURVE(i, 9), CURVE(i, 10), CURVE(i, 11), -+ CURVE(i, 12), CURVE(i, 13), CURVE(i, 14)); -+ -+ return 0; -+} -+#undef CURVE -+ -+ -+static struct fbtft_display display = { -+ .regwidth = 8, -+ .width = WIDTH, -+ .height = HEIGHT, -+ .txbuflen = TXBUFLEN, -+ .gamma_num = 2, -+ .gamma_len = 15, -+ .gamma = DEFAULT_GAMMA, -+ .fbtftops = { -+ .init_display = init_display, -+ .set_addr_win = set_addr_win, -+ .set_var = set_var, -+ .set_gamma = set_gamma, -+ }, -+}; -+FBTFT_REGISTER_DRIVER(DRVNAME, "ilitek,ili9341", &display); -+ -+MODULE_ALIAS("spi:" DRVNAME); -+MODULE_ALIAS("platform:" DRVNAME); -+MODULE_ALIAS("spi:ili9341"); -+MODULE_ALIAS("platform:ili9341"); -+ -+MODULE_DESCRIPTION("FB driver for the ILI9341 LCD display controller"); -+MODULE_AUTHOR("Christian Vogelgsang"); -+MODULE_LICENSE("GPL"); -diff --git a/drivers/video/fbtft/fb_ili9481.c b/drivers/video/fbtft/fb_ili9481.c -new file mode 100644 -index 0000000..725157a ---- /dev/null -+++ b/drivers/video/fbtft/fb_ili9481.c -@@ -0,0 +1,117 @@ -+/* -+ * FB driver for the ILI9481 LCD Controller -+ * -+ * Copyright (c) 2014 Petr Olivka -+ * Copyright (c) 2013 Noralf Tronnes -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -+ */ -+ -+#include -+#include -+#include -+#include -+ -+#include "fbtft.h" -+ -+#define DRVNAME "fb_ili9481" -+#define WIDTH 320 -+#define HEIGHT 480 -+ -+static int default_init_sequence[] = { -+ -+ /* SLP_OUT - Sleep out */ -+ -1, 0x11, -+ -2, 50, -+ /* Power setting */ -+ -1, 0xD0, 0x07, 0x42, 0x18, -+ /* VCOM */ -+ -1, 0xD1, 0x00, 0x07, 0x10, -+ /* Power setting for norm. mode */ -+ -1, 0xD2, 0x01, 0x02, -+ /* Panel driving setting */ -+ -1, 0xC0, 0x10, 0x3B, 0x00, 0x02, 0x11, -+ /* Frame rate & inv. */ -+ -1, 0xC5, 0x03, -+ /* Pixel format */ -+ -1, 0x3A, 0x55, -+ /* Gamma */ -+ -1, 0xC8, 0x00, 0x32, 0x36, 0x45, 0x06, 0x16, -+ 0x37, 0x75, 0x77, 0x54, 0x0C, 0x00, -+ /* DISP_ON */ -+ -1, 0x29, -+ -3 -+}; -+ -+static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye) -+{ -+ fbtft_par_dbg(DEBUG_SET_ADDR_WIN, par, -+ "%s(xs=%d, ys=%d, xe=%d, ye=%d)\n", __func__, xs, ys, xe, ye); -+ -+ /* column address */ -+ write_reg(par, 0x2a, xs >> 8, xs & 0xff, xe >> 8, xe & 0xff); -+ -+ /* row adress */ -+ write_reg(par, 0x2b, ys >> 8, ys & 0xff, ye >> 8, ye & 0xff); -+ -+ /* memory write */ -+ write_reg(par, 0x2c); -+} -+ -+#define HFLIP 0x01 -+#define VFLIP 0x02 -+#define ROWxCOL 0x20 -+static int set_var(struct fbtft_par *par) -+{ -+ fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); -+ -+ switch (par->info->var.rotate) { -+ case 270: -+ write_reg(par, 0x36, ROWxCOL | HFLIP | VFLIP | (par->bgr << 3)); -+ break; -+ case 180: -+ write_reg(par, 0x36, VFLIP | (par->bgr << 3)); -+ break; -+ case 90: -+ write_reg(par, 0x36, ROWxCOL | (par->bgr << 3)); -+ break; -+ default: -+ write_reg(par, 0x36, HFLIP | (par->bgr << 3)); -+ break; -+ } -+ -+ return 0; -+} -+ -+static struct fbtft_display display = { -+ .regwidth = 8, -+ .width = WIDTH, -+ .height = HEIGHT, -+ .init_sequence = default_init_sequence, -+ .fbtftops = { -+ .set_addr_win = set_addr_win, -+ .set_var = set_var, -+ }, -+}; -+FBTFT_REGISTER_DRIVER(DRVNAME, "ilitek,ili9481", &display); -+ -+MODULE_ALIAS("spi:" DRVNAME); -+MODULE_ALIAS("platform:" DRVNAME); -+MODULE_ALIAS("spi:ili9481"); -+MODULE_ALIAS("platform:ili9481"); -+ -+MODULE_DESCRIPTION("FB driver for the ILI9481 LCD Controller"); -+MODULE_AUTHOR("Petr Olivka"); -+MODULE_LICENSE("GPL"); -diff --git a/drivers/video/fbtft/fb_ili9486.c b/drivers/video/fbtft/fb_ili9486.c -new file mode 100644 -index 0000000..95b8999 ---- /dev/null -+++ b/drivers/video/fbtft/fb_ili9486.c -@@ -0,0 +1,121 @@ -+/* -+ * FB driver for the ILI9486 LCD Controller -+ * -+ * Copyright (C) 2014 Noralf Tronnes -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -+ */ -+ -+#include -+#include -+#include -+ -+#include "fbtft.h" -+ -+#define DRVNAME "fb_ili9486" -+#define WIDTH 320 -+#define HEIGHT 480 -+ -+ -+/* this init sequence matches PiScreen */ -+static int default_init_sequence[] = { -+ /* Interface Mode Control */ -+ -1, 0xb0, 0x0, -+ /* Sleep OUT */ -+ -1, 0x11, -+ -2, 250, -+ /* Interface Pixel Format */ -+ -1, 0x3A, 0x55, -+ /* Power Control 3 */ -+ -1, 0xC2, 0x44, -+ /* VCOM Control 1 */ -+ -1, 0xC5, 0x00, 0x00, 0x00, 0x00, -+ /* PGAMCTRL(Positive Gamma Control) */ -+ -1, 0xE0, 0x0F, 0x1F, 0x1C, 0x0C, 0x0F, 0x08, 0x48, 0x98, -+ 0x37, 0x0A, 0x13, 0x04, 0x11, 0x0D, 0x00, -+ /* NGAMCTRL(Negative Gamma Control) */ -+ -1, 0xE1, 0x0F, 0x32, 0x2E, 0x0B, 0x0D, 0x05, 0x47, 0x75, -+ 0x37, 0x06, 0x10, 0x03, 0x24, 0x20, 0x00, -+ /* Digital Gamma Control 1 */ -+ -1, 0xE2, 0x0F, 0x32, 0x2E, 0x0B, 0x0D, 0x05, 0x47, 0x75, -+ 0x37, 0x06, 0x10, 0x03, 0x24, 0x20, 0x00, -+ /* Sleep OUT */ -+ -1, 0x11, -+ /* Display ON */ -+ -1, 0x29, -+ /* end marker */ -+ -3 -+}; -+ -+static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye) -+{ -+ fbtft_par_dbg(DEBUG_SET_ADDR_WIN, par, -+ "%s(xs=%d, ys=%d, xe=%d, ye=%d)\n", __func__, xs, ys, xe, ye); -+ -+ /* Column address */ -+ write_reg(par, 0x2A, xs >> 8, xs & 0xFF, xe >> 8, xe & 0xFF); -+ -+ /* Row adress */ -+ write_reg(par, 0x2B, ys >> 8, ys & 0xFF, ye >> 8, ye & 0xFF); -+ -+ /* Memory write */ -+ write_reg(par, 0x2C); -+} -+ -+static int set_var(struct fbtft_par *par) -+{ -+ fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); -+ -+ switch (par->info->var.rotate) { -+ case 0: -+ write_reg(par, 0x36, 0x80 | (par->bgr << 3)); -+ break; -+ case 90: -+ write_reg(par, 0x36, 0x20 | (par->bgr << 3)); -+ break; -+ case 180: -+ write_reg(par, 0x36, 0x40 | (par->bgr << 3)); -+ break; -+ case 270: -+ write_reg(par, 0x36, 0xE0 | (par->bgr << 3)); -+ break; -+ default: -+ break; -+ } -+ -+ return 0; -+} -+ -+ -+static struct fbtft_display display = { -+ .regwidth = 8, -+ .width = WIDTH, -+ .height = HEIGHT, -+ .init_sequence = default_init_sequence, -+ .fbtftops = { -+ .set_addr_win = set_addr_win, -+ .set_var = set_var, -+ }, -+}; -+FBTFT_REGISTER_DRIVER(DRVNAME, "ilitek,ili9486", &display); -+ -+MODULE_ALIAS("spi:" DRVNAME); -+MODULE_ALIAS("platform:" DRVNAME); -+MODULE_ALIAS("spi:ili9486"); -+MODULE_ALIAS("platform:ili9486"); -+ -+MODULE_DESCRIPTION("FB driver for the ILI9486 LCD Controller"); -+MODULE_AUTHOR("Noralf Tronnes"); -+MODULE_LICENSE("GPL"); -diff --git a/drivers/video/fbtft/fb_pcd8544.c b/drivers/video/fbtft/fb_pcd8544.c -new file mode 100644 -index 0000000..678ab8e ---- /dev/null -+++ b/drivers/video/fbtft/fb_pcd8544.c -@@ -0,0 +1,177 @@ -+/* -+ * FB driver for the PCD8544 LCD Controller -+ * -+ * The display is monochrome and the video memory is RGB565. -+ * Any pixel value except 0 turns the pixel on. -+ * -+ * Copyright (C) 2013 Noralf Tronnes -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "fbtft.h" -+ -+#define DRVNAME "fb_pcd8544" -+#define WIDTH 84 -+#define HEIGHT 48 -+#define TXBUFLEN 84*6 -+#define DEFAULT_GAMMA "40" /* gamma is used to control contrast in this driver */ -+ -+static unsigned tc = 0; -+module_param(tc, uint, 0); -+MODULE_PARM_DESC(tc, "TC[1:0] Temperature coefficient: 0-3 (default: 0)"); -+ -+static unsigned bs = 4; -+module_param(bs, uint, 0); -+MODULE_PARM_DESC(bs, "BS[2:0] Bias voltage level: 0-7 (default: 4)"); -+ -+ -+static int init_display(struct fbtft_par *par) -+{ -+ fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); -+ -+ par->fbtftops.reset(par); -+ -+ /* Function set */ -+ write_reg(par, 0x21); /* 5:1 1 -+ 2:0 PD - Powerdown control: chip is active -+ 1:0 V - Entry mode: horizontal addressing -+ 0:1 H - Extended instruction set control: extended -+ */ -+ -+ /* H=1 Temperature control */ -+ write_reg(par, 0x04 | (tc & 0x3)); /* -+ 2:1 1 -+ 1:x TC1 - Temperature Coefficient: 0x10 -+ 0:x TC0 -+ */ -+ -+ /* H=1 Bias system */ -+ write_reg(par, 0x10 | (bs & 0x7)); /* -+ 4:1 1 -+ 3:0 0 -+ 2:x BS2 - Bias System -+ 1:x BS1 -+ 0:x BS0 -+ */ -+ -+ /* Function set */ -+ write_reg(par, 0x22); /* 5:1 1 -+ 2:0 PD - Powerdown control: chip is active -+ 1:1 V - Entry mode: vertical addressing -+ 0:0 H - Extended instruction set control: basic -+ */ -+ -+ /* H=0 Display control */ -+ write_reg(par, 0x08 | 4); /* -+ 3:1 1 -+ 2:1 D - DE: 10=normal mode -+ 1:0 0 -+ 0:0 E -+ */ -+ -+ return 0; -+} -+ -+static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye) -+{ -+ fbtft_par_dbg(DEBUG_SET_ADDR_WIN, par, "%s(xs=%d, ys=%d, xe=%d, ye=%d)\n", __func__, xs, ys, xe, ye); -+ -+ /* H=0 Set X address of RAM */ -+ write_reg(par, 0x80); /* 7:1 1 -+ 6-0: X[6:0] - 0x00 -+ */ -+ -+ /* H=0 Set Y address of RAM */ -+ write_reg(par, 0x40); /* 7:0 0 -+ 6:1 1 -+ 2-0: Y[2:0] - 0x0 -+ */ -+} -+ -+static int write_vmem(struct fbtft_par *par, size_t offset, size_t len) -+{ -+ u16 *vmem16 = (u16 *)par->info->screen_base; -+ u8 *buf = par->txbuf.buf; -+ int x, y, i; -+ int ret = 0; -+ -+ fbtft_par_dbg(DEBUG_WRITE_VMEM, par, "%s()\n", __func__); -+ -+ for (x=0;x<84;x++) { -+ for (y=0;y<6;y++) { -+ *buf = 0x00; -+ for (i=0;i<8;i++) { -+ *buf |= (vmem16[(y*8+i)*84+x] ? 1 : 0) << i; -+ } -+ buf++; -+ } -+ } -+ -+ /* Write data */ -+ gpio_set_value(par->gpio.dc, 1); -+ ret = par->fbtftops.write(par, par->txbuf.buf, 6*84); -+ if (ret < 0) -+ dev_err(par->info->device, "%s: write failed and returned: %d\n", __func__, ret); -+ -+ return ret; -+} -+ -+static int set_gamma(struct fbtft_par *par, unsigned long *curves) -+{ -+ fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); -+ -+ /* apply mask */ -+ curves[0] &= 0x7F; -+ -+ write_reg(par, 0x23); /* turn on extended instruction set */ -+ write_reg(par, 0x80 | curves[0]); -+ write_reg(par, 0x22); /* turn off extended instruction set */ -+ -+ return 0; -+} -+ -+ -+static struct fbtft_display display = { -+ .regwidth = 8, -+ .width = WIDTH, -+ .height = HEIGHT, -+ .txbuflen = TXBUFLEN, -+ .gamma_num = 1, -+ .gamma_len = 1, -+ .gamma = DEFAULT_GAMMA, -+ .fbtftops = { -+ .init_display = init_display, -+ .set_addr_win = set_addr_win, -+ .write_vmem = write_vmem, -+ .set_gamma = set_gamma, -+ }, -+ .backlight = 1, -+}; -+FBTFT_REGISTER_DRIVER(DRVNAME, "philips,pdc8544", &display); -+ -+MODULE_ALIAS("spi:" DRVNAME); -+MODULE_ALIAS("spi:pdc8544"); -+ -+MODULE_DESCRIPTION("FB driver for the PCD8544 LCD Controller"); -+MODULE_AUTHOR("Noralf Tronnes"); -+MODULE_LICENSE("GPL"); -diff --git a/drivers/video/fbtft/fb_ra8875.c b/drivers/video/fbtft/fb_ra8875.c -new file mode 100644 -index 0000000..c323c06 ---- /dev/null -+++ b/drivers/video/fbtft/fb_ra8875.c -@@ -0,0 +1,331 @@ -+/****************************************************************************** -+ -+ ProjectName: FBTFT driver ***** ***** -+ for the RA8875 LCD Controller * * ************ -+ * ** ** * * -+ Copyright © by Pf@nne & NOTRO * * * * * **** * -+ * * * * * * * -+ Last modification by: * * * * **** * -+ - Pf@nne (pf@nne-mail.de) * * ***** * -+ * * * ******* -+ ***** * * -+ Date : 10.06.2014 * * -+ Version : V1.13 ***** -+ Revison : 5 -+ -+******************************************************************************* -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -+ */ -+ -+#include -+#include -+#include -+#include -+ -+#include -+#include "fbtft.h" -+ -+#define DRVNAME "fb_ra8875" -+ -+static int write_spi(struct fbtft_par *par, void *buf, size_t len) -+{ -+ struct spi_transfer t = { -+ .tx_buf = buf, -+ .len = len, -+ .speed_hz = 1000000, -+ }; -+ struct spi_message m; -+ -+ fbtft_par_dbg_hex(DEBUG_WRITE, par, par->info->device, u8, buf, len, -+ "%s(len=%d): ", __func__, len); -+ -+ if (!par->spi) { -+ dev_err(par->info->device, -+ "%s: par->spi is unexpectedly NULL\n", __func__); -+ return -1; -+ } -+ -+ spi_message_init(&m); -+ if (par->txbuf.dma && buf == par->txbuf.buf) { -+ t.tx_dma = par->txbuf.dma; -+ m.is_dma_mapped = 1; -+ } -+ spi_message_add_tail(&t, &m); -+ return spi_sync(par->spi, &m); -+} -+ -+static int init_display(struct fbtft_par *par) -+{ -+ gpio_set_value(par->gpio.dc, 1); -+ -+ fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, -+ "%s()\n", __func__); -+ fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, -+ "display size %dx%d\n", par->info->var.xres, par->info->var.yres); -+ -+ par->fbtftops.reset(par); -+ -+ if ((par->info->var.xres == 320) && (par->info->var.yres == 240)) { -+ /* PLL clock frequency */ -+ write_reg(par, 0x88 , 0x0A); -+ write_reg(par, 0x89 , 0x02); -+ mdelay(10); -+ /* color deep / MCU Interface */ -+ write_reg(par, 0x10 , 0x0C); -+ /* pixel clock period */ -+ write_reg(par, 0x04 , 0x03); -+ mdelay(1); -+ /* horizontal settings */ -+ write_reg(par, 0x14 , 0x27); -+ write_reg(par, 0x15 , 0x00); -+ write_reg(par, 0x16 , 0x05); -+ write_reg(par, 0x17 , 0x04); -+ write_reg(par, 0x18 , 0x03); -+ /* vertical settings */ -+ write_reg(par, 0x19 , 0xEF); -+ write_reg(par, 0x1A , 0x00); -+ write_reg(par, 0x1B , 0x05); -+ write_reg(par, 0x1C , 0x00); -+ write_reg(par, 0x1D , 0x0E); -+ write_reg(par, 0x1E , 0x00); -+ write_reg(par, 0x1F , 0x02); -+ } else if ((par->info->var.xres == 480) && (par->info->var.yres == 272)) { -+ /* PLL clock frequency */ -+ write_reg(par, 0x88 , 0x0A); -+ write_reg(par, 0x89 , 0x02); -+ mdelay(10); -+ /* color deep / MCU Interface */ -+ write_reg(par, 0x10 , 0x0C); -+ /* pixel clock period */ -+ write_reg(par, 0x04 , 0x82); -+ mdelay(1); -+ /* horizontal settings */ -+ write_reg(par, 0x14 , 0x3B); -+ write_reg(par, 0x15 , 0x00); -+ write_reg(par, 0x16 , 0x01); -+ write_reg(par, 0x17 , 0x00); -+ write_reg(par, 0x18 , 0x05); -+ /* vertical settings */ -+ write_reg(par, 0x19 , 0x0F); -+ write_reg(par, 0x1A , 0x01); -+ write_reg(par, 0x1B , 0x02); -+ write_reg(par, 0x1C , 0x00); -+ write_reg(par, 0x1D , 0x07); -+ write_reg(par, 0x1E , 0x00); -+ write_reg(par, 0x1F , 0x09); -+ } else if ((par->info->var.xres == 640) && (par->info->var.yres == 480)) { -+ /* PLL clock frequency */ -+ write_reg(par, 0x88 , 0x0B); -+ write_reg(par, 0x89 , 0x02); -+ mdelay(10); -+ /* color deep / MCU Interface */ -+ write_reg(par, 0x10 , 0x0C); -+ /* pixel clock period */ -+ write_reg(par, 0x04 , 0x01); -+ mdelay(1); -+ /* horizontal settings */ -+ write_reg(par, 0x14 , 0x4F); -+ write_reg(par, 0x15 , 0x05); -+ write_reg(par, 0x16 , 0x0F); -+ write_reg(par, 0x17 , 0x01); -+ write_reg(par, 0x18 , 0x00); -+ /* vertical settings */ -+ write_reg(par, 0x19 , 0xDF); -+ write_reg(par, 0x1A , 0x01); -+ write_reg(par, 0x1B , 0x0A); -+ write_reg(par, 0x1C , 0x00); -+ write_reg(par, 0x1D , 0x0E); -+ write_reg(par, 0x1E , 0x00); -+ write_reg(par, 0x1F , 0x01); -+ } else if ((par->info->var.xres == 800) && (par->info->var.yres == 480)) { -+ /* PLL clock frequency */ -+ write_reg(par, 0x88 , 0x0B); -+ write_reg(par, 0x89 , 0x02); -+ mdelay(10); -+ /* color deep / MCU Interface */ -+ write_reg(par, 0x10 , 0x0C); -+ /* pixel clock period */ -+ write_reg(par, 0x04 , 0x81); -+ mdelay(1); -+ /* horizontal settings */ -+ write_reg(par, 0x14 , 0x63); -+ write_reg(par, 0x15 , 0x03); -+ write_reg(par, 0x16 , 0x03); -+ write_reg(par, 0x17 , 0x02); -+ write_reg(par, 0x18 , 0x00); -+ /* vertical settings */ -+ write_reg(par, 0x19 , 0xDF); -+ write_reg(par, 0x1A , 0x01); -+ write_reg(par, 0x1B , 0x14); -+ write_reg(par, 0x1C , 0x00); -+ write_reg(par, 0x1D , 0x06); -+ write_reg(par, 0x1E , 0x00); -+ write_reg(par, 0x1F , 0x01); -+ } else { -+ dev_err(par->info->device, "display size is not supported!!"); -+ return -1; -+ } -+ -+ /* PWM clock */ -+ write_reg(par, 0x8a , 0x81); -+ write_reg(par, 0x8b , 0xFF); -+ mdelay(10); -+ -+ /* Display ON */ -+ write_reg(par, 0x01 , 0x80); -+ mdelay(10); -+ -+ return 0; -+} -+ -+static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye) -+{ -+ fbtft_par_dbg(DEBUG_SET_ADDR_WIN, par, -+ "%s(xs=%d, ys=%d, xe=%d, ye=%d)\n", __func__, xs, ys, xe, ye); -+ -+ /* Set_Active_Window */ -+ write_reg(par, 0x30 , xs & 0x00FF); -+ write_reg(par, 0x31 , (xs & 0xFF00) >> 8); -+ write_reg(par, 0x32 , ys & 0x00FF); -+ write_reg(par, 0x33 , (ys & 0xFF00) >> 8); -+ write_reg(par, 0x34 , (xs+xe) & 0x00FF); -+ write_reg(par, 0x35 , ((xs+xe) & 0xFF00) >> 8); -+ write_reg(par, 0x36 , (ys+ye) & 0x00FF); -+ write_reg(par, 0x37 , ((ys+ye) & 0xFF00) >> 8); -+ -+ /* Set_Memory_Write_Cursor */ -+ write_reg(par, 0x46, xs & 0xff); -+ write_reg(par, 0x47, (xs >> 8) & 0x03); -+ write_reg(par, 0x48, ys & 0xff); -+ write_reg(par, 0x49, (ys >> 8) & 0x01); -+ -+ write_reg(par, 0x02); -+} -+ -+static void write_reg8_bus8(struct fbtft_par *par, int len, ...) -+{ -+ va_list args; -+ int i, ret; -+ u8 *buf = (u8 *)par->buf; -+ -+ /* slow down spi-speed for writing registers */ -+ par->fbtftops.write = write_spi; -+ -+ if (unlikely(par->debug & DEBUG_WRITE_REGISTER)) { -+ va_start(args, len); -+ for (i = 0; i < len; i++) -+ buf[i] = (u8)va_arg(args, unsigned int); -+ va_end(args); -+ fbtft_par_dbg_hex(DEBUG_WRITE_REGISTER, par, par->info->device, -+ u8, buf, len, "%s: ", __func__); -+ } -+ -+ va_start(args, len); -+ *buf++ = 0x80; -+ *buf = (u8)va_arg(args, unsigned int); -+ ret = par->fbtftops.write(par, par->buf, 2); -+ if (ret < 0) { -+ va_end(args); -+ dev_err(par->info->device, "%s: write() failed and returned %dn", -+ __func__, ret); -+ return; -+ } -+ len--; -+ -+ udelay(100); -+ -+ if (len) { -+ buf = (u8 *)par->buf; -+ *buf++ = 0x00; -+ i = len; -+ while (i--) -+ *buf++ = (u8)va_arg(args, unsigned int); -+ -+ ret = par->fbtftops.write(par, par->buf, len + 1); -+ if (ret < 0) { -+ va_end(args); -+ dev_err(par->info->device, "%s: write() failed and returned %dn", -+ __func__, ret); -+ return; -+ } -+ } -+ va_end(args); -+ -+ /* restore user spi-speed */ -+ par->fbtftops.write = fbtft_write_spi; -+ udelay(100); -+} -+ -+static int write_vmem16_bus8(struct fbtft_par *par, size_t offset, size_t len) -+{ -+ u16 *vmem16; -+ u16 *txbuf16 = (u16 *)par->txbuf.buf; -+ size_t remain; -+ size_t to_copy; -+ size_t tx_array_size; -+ int i; -+ int ret = 0; -+ size_t startbyte_size = 0; -+ -+ fbtft_par_dbg(DEBUG_WRITE_VMEM, par, "%s(offset=%zu, len=%zu)\n", -+ __func__, offset, len); -+ -+ remain = len / 2; -+ vmem16 = (u16 *)(par->info->screen_base + offset); -+ tx_array_size = par->txbuf.len / 2; -+ txbuf16 = (u16 *)(par->txbuf.buf + 1); -+ tx_array_size -= 2; -+ *(u8 *)(par->txbuf.buf) = 0x00; -+ startbyte_size = 1; -+ -+ while (remain) { -+ to_copy = remain > tx_array_size ? tx_array_size : remain; -+ dev_dbg(par->info->device, " to_copy=%zu, remain=%zu\n", -+ to_copy, remain - to_copy); -+ -+ for (i = 0; i < to_copy; i++) -+ txbuf16[i] = cpu_to_be16(vmem16[i]); -+ -+ vmem16 = vmem16 + to_copy; -+ ret = par->fbtftops.write(par, par->txbuf.buf, -+ startbyte_size + to_copy * 2); -+ if (ret < 0) -+ return ret; -+ remain -= to_copy; -+ } -+ -+ return ret; -+} -+ -+static struct fbtft_display display = { -+ .regwidth = 8, -+ .fbtftops = { -+ .init_display = init_display, -+ .set_addr_win = set_addr_win, -+ .write_register = write_reg8_bus8, -+ .write_vmem = write_vmem16_bus8, -+ .write = write_spi, -+ }, -+}; -+FBTFT_REGISTER_DRIVER(DRVNAME, "raio,ra8875", &display); -+ -+MODULE_ALIAS("spi:" DRVNAME); -+MODULE_ALIAS("platform:" DRVNAME); -+MODULE_ALIAS("spi:ra8875"); -+MODULE_ALIAS("platform:ra8875"); -+ -+MODULE_DESCRIPTION("FB driver for the RA8875 LCD Controller"); -+MODULE_AUTHOR("Pf@nne"); -+MODULE_LICENSE("GPL"); -diff --git a/drivers/video/fbtft/fb_s6d02a1.c b/drivers/video/fbtft/fb_s6d02a1.c -new file mode 100644 -index 0000000..e412a42 ---- /dev/null -+++ b/drivers/video/fbtft/fb_s6d02a1.c -@@ -0,0 +1,168 @@ -+/* -+ * FB driver for the S6D02A1 LCD Controller -+ * -+ * Based on fb_st7735r.c by Noralf Tronnes -+ * Init code from UTFT library by Henning Karlsen -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -+ */ -+ -+#include -+#include -+#include -+ -+#include "fbtft.h" -+ -+#define DRVNAME "fb_s6d02a1" -+ -+static int default_init_sequence[] = { -+ -+ -1, 0xf0, 0x5a, 0x5a, -+ -+ -1, 0xfc, 0x5a, 0x5a, -+ -+ -1, 0xfa, 0x02, 0x1f, 0x00, 0x10, 0x22, 0x30, 0x38, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3d, 0x02, 0x01, -+ -+ -1, 0xfb, 0x21, 0x00, 0x02, 0x04, 0x07, 0x0a, 0x0b, 0x0c, 0x0c, 0x16, 0x1e, 0x30, 0x3f, 0x01, 0x02, -+ -+ /* power setting sequence */ -+ -1, 0xfd, 0x00, 0x00, 0x00, 0x17, 0x10, 0x00, 0x01, 0x01, 0x00, 0x1f, 0x1f, -+ -+ -1, 0xf4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x3f, 0x07, 0x00, 0x3C, 0x36, 0x00, 0x3C, 0x36, 0x00, -+ -+ -1, 0xf5, 0x00, 0x70, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6d, 0x66, 0x06, -+ -+ -1, 0xf6, 0x02, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x02, 0x00, 0x06, 0x01, 0x00, -+ -+ -1, 0xf2, 0x00, 0x01, 0x03, 0x08, 0x08, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x04, 0x08, 0x08, -+ -+ -1, 0xf8, 0x11, -+ -+ -1, 0xf7, 0xc8, 0x20, 0x00, 0x00, -+ -+ -1, 0xf3, 0x00, 0x00, -+ -+ -1, 0x11, -+ -2, 50, -+ -+ -1, 0xf3, 0x00, 0x01, -+ -2, 50, -+ -1, 0xf3, 0x00, 0x03, -+ -2, 50, -+ -1, 0xf3, 0x00, 0x07, -+ -2, 50, -+ -1, 0xf3, 0x00, 0x0f, -+ -2, 50, -+ -+ -1, 0xf4, 0x00, 0x04, 0x00, 0x00, 0x00, 0x3f, 0x3f, 0x07, 0x00, 0x3C, 0x36, 0x00, 0x3C, 0x36, 0x00, -+ -2, 50, -+ -+ -1, 0xf3, 0x00, 0x1f, -+ -2, 50, -+ -1, 0xf3, 0x00, 0x7f, -+ -2, 50, -+ -+ -1, 0xf3, 0x00, 0xff, -+ -2, 50, -+ -+ -1, 0xfd, 0x00, 0x00, 0x00, 0x17, 0x10, 0x00, 0x00, 0x01, 0x00, 0x16, 0x16, -+ -+ -1, 0xf4, 0x00, 0x09, 0x00, 0x00, 0x00, 0x3f, 0x3f, 0x07, 0x00, 0x3C, 0x36, 0x00, 0x3C, 0x36, 0x00, -+ -+ /* initializing sequence */ -+ -+ -1, 0x36, 0x08, -+ -+ -1, 0x35, 0x00, -+ -+ -1, 0x3a, 0x05, -+ -+ /* gamma setting sequence */ -+ -1, 0x26, 0x01, /* preset gamma curves, possible values 0x01, 0x02, 0x04, 0x08 */ -+ -+ -2, 150, -+ -1, 0x29, -+ -1, 0x2c, -+ /* end marker */ -+ -3 -+ -+}; -+ -+static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye) -+{ -+ fbtft_par_dbg(DEBUG_SET_ADDR_WIN, par, -+ "%s(xs=%d, ys=%d, xe=%d, ye=%d)\n", __func__, xs, ys, xe, ye); -+ -+ /* Column address */ -+ write_reg(par, 0x2A, xs >> 8, xs & 0xFF, xe >> 8, xe & 0xFF); -+ -+ /* Row adress */ -+ write_reg(par, 0x2B, ys >> 8, ys & 0xFF, ye >> 8, ye & 0xFF); -+ -+ /* Memory write */ -+ write_reg(par, 0x2C); -+} -+ -+#define MY (1 << 7) -+#define MX (1 << 6) -+#define MV (1 << 5) -+static int set_var(struct fbtft_par *par) -+{ -+ fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); -+ -+ /* MADCTL - Memory data access control -+ RGB/BGR: -+ 1. Mode selection pin SRGB -+ RGB H/W pin for color filter setting: 0=RGB, 1=BGR -+ 2. MADCTL RGB bit -+ RGB-BGR ORDER color filter panel: 0=RGB, 1=BGR */ -+ switch (par->info->var.rotate) { -+ case 0: -+ write_reg(par, 0x36, MX | MY | (par->bgr << 3)); -+ break; -+ case 270: -+ write_reg(par, 0x36, MY | MV | (par->bgr << 3)); -+ break; -+ case 180: -+ write_reg(par, 0x36, (par->bgr << 3)); -+ break; -+ case 90: -+ write_reg(par, 0x36, MX | MV | (par->bgr << 3)); -+ break; -+ } -+ -+ return 0; -+} -+ -+static struct fbtft_display display = { -+ .regwidth = 8, -+ .width = 128, -+ .height = 160, -+ .init_sequence = default_init_sequence, -+ .fbtftops = { -+ .set_addr_win = set_addr_win, -+ .set_var = set_var, -+ }, -+}; -+FBTFT_REGISTER_DRIVER(DRVNAME, "samsung,s6d02a1", &display); -+ -+MODULE_ALIAS("spi:" DRVNAME); -+MODULE_ALIAS("platform:" DRVNAME); -+MODULE_ALIAS("spi:s6d02a1"); -+MODULE_ALIAS("platform:s6d02a1"); -+ -+MODULE_DESCRIPTION("FB driver for the S6D02A1 LCD Controller"); -+MODULE_AUTHOR("WOLFGANG BUENING"); -+MODULE_LICENSE("GPL"); -diff --git a/drivers/video/fbtft/fb_s6d1121.c b/drivers/video/fbtft/fb_s6d1121.c -new file mode 100644 -index 0000000..1ef8c1a ---- /dev/null -+++ b/drivers/video/fbtft/fb_s6d1121.c -@@ -0,0 +1,208 @@ -+/* -+ * FB driver for the S6D1121 LCD Controller -+ * -+ * Copyright (C) 2013 Roman Rolinsky -+ * -+ * Based on fb_ili9325.c by Noralf Tronnes -+ * Based on ili9325.c by Jeroen Domburg -+ * Init code from UTFT library by Henning Karlsen -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+ -+#include "fbtft.h" -+ -+#define DRVNAME "fb_s6d1121" -+#define WIDTH 240 -+#define HEIGHT 320 -+#define BPP 16 -+#define FPS 20 -+#define DEFAULT_GAMMA "26 09 24 2C 1F 23 24 25 22 26 25 23 0D 00\n" \ -+ "1C 1A 13 1D 0B 11 12 10 13 15 36 19 00 0D" -+ -+static int init_display(struct fbtft_par *par) -+{ -+ fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); -+ -+ par->fbtftops.reset(par); -+ -+ if (par->gpio.cs != -1) -+ gpio_set_value(par->gpio.cs, 0); /* Activate chip */ -+ -+ /* Initialization sequence from Lib_UTFT */ -+ -+ write_reg(par, 0x0011, 0x2004); -+ write_reg(par, 0x0013, 0xCC00); -+ write_reg(par, 0x0015, 0x2600); -+ write_reg(par, 0x0014, 0x252A); -+ write_reg(par, 0x0012, 0x0033); -+ write_reg(par, 0x0013, 0xCC04); -+ write_reg(par, 0x0013, 0xCC06); -+ write_reg(par, 0x0013, 0xCC4F); -+ write_reg(par, 0x0013, 0x674F); -+ write_reg(par, 0x0011, 0x2003); -+ write_reg(par, 0x0016, 0x0007); -+ write_reg(par, 0x0002, 0x0013); -+ write_reg(par, 0x0003, 0x0003); -+ write_reg(par, 0x0001, 0x0127); -+ write_reg(par, 0x0008, 0x0303); -+ write_reg(par, 0x000A, 0x000B); -+ write_reg(par, 0x000B, 0x0003); -+ write_reg(par, 0x000C, 0x0000); -+ write_reg(par, 0x0041, 0x0000); -+ write_reg(par, 0x0050, 0x0000); -+ write_reg(par, 0x0060, 0x0005); -+ write_reg(par, 0x0070, 0x000B); -+ write_reg(par, 0x0071, 0x0000); -+ write_reg(par, 0x0078, 0x0000); -+ write_reg(par, 0x007A, 0x0000); -+ write_reg(par, 0x0079, 0x0007); -+ write_reg(par, 0x0007, 0x0051); -+ write_reg(par, 0x0007, 0x0053); -+ write_reg(par, 0x0079, 0x0000); -+ -+ write_reg(par, 0x0022); /* Write Data to GRAM */ -+ -+ return 0; -+} -+ -+static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye) -+{ -+ fbtft_par_dbg(DEBUG_SET_ADDR_WIN, par, -+ "%s(xs=%d, ys=%d, xe=%d, ye=%d)\n", __func__, xs, ys, xe, ye); -+ switch (par->info->var.rotate) { -+ /* R20h = Horizontal GRAM Start Address */ -+ /* R21h = Vertical GRAM Start Address */ -+ case 0: -+ write_reg(par, 0x0020, xs); -+ write_reg(par, 0x0021, ys); -+ break; -+ case 180: -+ write_reg(par, 0x0020, WIDTH - 1 - xs); -+ write_reg(par, 0x0021, HEIGHT - 1 - ys); -+ break; -+ case 270: -+ write_reg(par, 0x0020, WIDTH - 1 - ys); -+ write_reg(par, 0x0021, xs); -+ break; -+ case 90: -+ write_reg(par, 0x0020, ys); -+ write_reg(par, 0x0021, HEIGHT - 1 - xs); -+ break; -+ } -+ write_reg(par, 0x0022); /* Write Data to GRAM */ -+} -+ -+static int set_var(struct fbtft_par *par) -+{ -+ fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); -+ -+ switch (par->info->var.rotate) { -+ /* AM: GRAM update direction */ -+ case 0: -+ write_reg(par, 0x03, 0x0003 | (par->bgr << 12)); -+ break; -+ case 180: -+ write_reg(par, 0x03, 0x0000 | (par->bgr << 12)); -+ break; -+ case 270: -+ write_reg(par, 0x03, 0x000A | (par->bgr << 12)); -+ break; -+ case 90: -+ write_reg(par, 0x03, 0x0009 | (par->bgr << 12)); -+ break; -+ } -+ -+ return 0; -+} -+ -+/* -+ Gamma string format: -+ PKP0 PKP1 PKP2 PKP3 PKP4 PKP5 PKP6 PKP7 PKP8 PKP9 PKP10 PKP11 VRP0 VRP1 -+ PKN0 PKN1 PKN2 PKN3 PKN4 PKN5 PKN6 PKN7 PRN8 PRN9 PRN10 PRN11 VRN0 VRN1 -+*/ -+#define CURVE(num, idx) curves[num*par->gamma.num_values + idx] -+static int set_gamma(struct fbtft_par *par, unsigned long *curves) -+{ -+ unsigned long mask[] = { -+ 0b111111, 0b111111, 0b111111, 0b111111, 0b111111, 0b111111, -+ 0b111111, 0b111111, 0b111111, 0b111111, 0b111111, 0b111111, -+ 0b11111, 0b11111, -+ 0b111111, 0b111111, 0b111111, 0b111111, 0b111111, 0b111111, -+ 0b111111, 0b111111, 0b111111, 0b111111, 0b111111, 0b111111, -+ 0b11111, 0b11111 }; -+ int i, j; -+ -+ fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); -+ -+ /* apply mask */ -+ for (i = 0; i < 2; i++) -+ for (j = 0; j < 14; j++) -+ CURVE(i, j) &= mask[i*par->gamma.num_values + j]; -+ -+ write_reg(par, 0x0030, CURVE(0, 1) << 8 | CURVE(0, 0)); -+ write_reg(par, 0x0031, CURVE(0, 3) << 8 | CURVE(0, 2)); -+ write_reg(par, 0x0032, CURVE(0, 5) << 8 | CURVE(0, 3)); -+ write_reg(par, 0x0033, CURVE(0, 7) << 8 | CURVE(0, 6)); -+ write_reg(par, 0x0034, CURVE(0, 9) << 8 | CURVE(0, 8)); -+ write_reg(par, 0x0035, CURVE(0, 11) << 8 | CURVE(0, 10)); -+ -+ write_reg(par, 0x0036, CURVE(1, 1) << 8 | CURVE(1, 0)); -+ write_reg(par, 0x0037, CURVE(1, 3) << 8 | CURVE(1, 2)); -+ write_reg(par, 0x0038, CURVE(1, 5) << 8 | CURVE(1, 4)); -+ write_reg(par, 0x0039, CURVE(1, 7) << 8 | CURVE(1, 6)); -+ write_reg(par, 0x003A, CURVE(1, 9) << 8 | CURVE(1, 8)); -+ write_reg(par, 0x003B, CURVE(1, 11) << 8 | CURVE(1, 10)); -+ -+ write_reg(par, 0x003C, CURVE(0, 13) << 8 | CURVE(0, 12)); -+ write_reg(par, 0x003D, CURVE(1, 13) << 8 | CURVE(1, 12)); -+ -+ return 0; -+} -+#undef CURVE -+ -+ -+static struct fbtft_display display = { -+ .regwidth = 16, -+ .width = WIDTH, -+ .height = HEIGHT, -+ .bpp = BPP, -+ .fps = FPS, -+ .gamma_num = 2, -+ .gamma_len = 14, -+ .gamma = DEFAULT_GAMMA, -+ .fbtftops = { -+ .init_display = init_display, -+ .set_addr_win = set_addr_win, -+ .set_var = set_var, -+ .set_gamma = set_gamma, -+ }, -+}; -+FBTFT_REGISTER_DRIVER(DRVNAME, "samsung,s6d1121", &display); -+ -+MODULE_ALIAS("spi:" DRVNAME); -+MODULE_ALIAS("platform:" DRVNAME); -+MODULE_ALIAS("spi:s6d1121"); -+MODULE_ALIAS("platform:s6d1121"); -+ -+MODULE_DESCRIPTION("FB driver for the S6D1121 LCD Controller"); -+MODULE_AUTHOR("Roman Rolinsky"); -+MODULE_LICENSE("GPL"); -diff --git a/drivers/video/fbtft/fb_ssd1289.c b/drivers/video/fbtft/fb_ssd1289.c -new file mode 100644 -index 0000000..ef46fbc ---- /dev/null -+++ b/drivers/video/fbtft/fb_ssd1289.c -@@ -0,0 +1,206 @@ -+/* -+ * FB driver for the SSD1289 LCD Controller -+ * -+ * Copyright (C) 2013 Noralf Tronnes -+ * -+ * Init sequence taken from ITDB02_Graph16.cpp - (C)2010-2011 Henning Karlsen -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -+ */ -+ -+#include -+#include -+#include -+#include -+ -+#include "fbtft.h" -+ -+#define DRVNAME "fb_ssd1289" -+#define WIDTH 240 -+#define HEIGHT 320 -+#define DEFAULT_GAMMA "02 03 2 5 7 7 4 2 4 2\n" \ -+ "02 03 2 5 7 5 4 2 4 2" -+ -+static unsigned reg11 = 0x6040; -+module_param(reg11, uint, 0); -+MODULE_PARM_DESC(reg11, "Register 11h value"); -+ -+ -+static int init_display(struct fbtft_par *par) -+{ -+ fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); -+ -+ par->fbtftops.reset(par); -+ -+ if (par->gpio.cs != -1) -+ gpio_set_value(par->gpio.cs, 0); /* Activate chip */ -+ -+ write_reg(par, 0x00, 0x0001); -+ write_reg(par, 0x03, 0xA8A4); -+ write_reg(par, 0x0C, 0x0000); -+ write_reg(par, 0x0D, 0x080C); -+ write_reg(par, 0x0E, 0x2B00); -+ write_reg(par, 0x1E, 0x00B7); -+ write_reg(par, 0x01, -+ (1 << 13) | (par->bgr << 11) | (1 << 9) | (HEIGHT - 1)); -+ write_reg(par, 0x02, 0x0600); -+ write_reg(par, 0x10, 0x0000); -+ write_reg(par, 0x05, 0x0000); -+ write_reg(par, 0x06, 0x0000); -+ write_reg(par, 0x16, 0xEF1C); -+ write_reg(par, 0x17, 0x0003); -+ write_reg(par, 0x07, 0x0233); -+ write_reg(par, 0x0B, 0x0000); -+ write_reg(par, 0x0F, 0x0000); -+ write_reg(par, 0x41, 0x0000); -+ write_reg(par, 0x42, 0x0000); -+ write_reg(par, 0x48, 0x0000); -+ write_reg(par, 0x49, 0x013F); -+ write_reg(par, 0x4A, 0x0000); -+ write_reg(par, 0x4B, 0x0000); -+ write_reg(par, 0x44, 0xEF00); -+ write_reg(par, 0x45, 0x0000); -+ write_reg(par, 0x46, 0x013F); -+ write_reg(par, 0x23, 0x0000); -+ write_reg(par, 0x24, 0x0000); -+ write_reg(par, 0x25, 0x8000); -+ write_reg(par, 0x4f, 0x0000); -+ write_reg(par, 0x4e, 0x0000); -+ write_reg(par, 0x22); -+ return 0; -+} -+ -+static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye) -+{ -+ fbtft_par_dbg(DEBUG_SET_ADDR_WIN, par, -+ "%s(xs=%d, ys=%d, xe=%d, ye=%d)\n", __func__, xs, ys, xe, ye); -+ -+ switch (par->info->var.rotate) { -+ /* R4Eh - Set GDDRAM X address counter */ -+ /* R4Fh - Set GDDRAM Y address counter */ -+ case 0: -+ write_reg(par, 0x4e, xs); -+ write_reg(par, 0x4f, ys); -+ break; -+ case 180: -+ write_reg(par, 0x4e, par->info->var.xres - 1 - xs); -+ write_reg(par, 0x4f, par->info->var.yres - 1 - ys); -+ break; -+ case 270: -+ write_reg(par, 0x4e, par->info->var.yres - 1 - ys); -+ write_reg(par, 0x4f, xs); -+ break; -+ case 90: -+ write_reg(par, 0x4e, ys); -+ write_reg(par, 0x4f, par->info->var.xres - 1 - xs); -+ break; -+ } -+ -+ /* R22h - RAM data write */ -+ write_reg(par, 0x22); -+} -+ -+static int set_var(struct fbtft_par *par) -+{ -+ fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); -+ -+ if (par->fbtftops.init_display != init_display) { -+ /* don't risk messing up register 11h */ -+ fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, -+ "%s: skipping since custom init_display() is used\n", -+ __func__); -+ return 0; -+ } -+ -+ switch (par->info->var.rotate) { -+ case 0: -+ write_reg(par, 0x11, reg11 | 0b110000); -+ break; -+ case 270: -+ write_reg(par, 0x11, reg11 | 0b101000); -+ break; -+ case 180: -+ write_reg(par, 0x11, reg11 | 0b000000); -+ break; -+ case 90: -+ write_reg(par, 0x11, reg11 | 0b011000); -+ break; -+ } -+ -+ return 0; -+} -+ -+/* -+ Gamma string format: -+ VRP0 VRP1 PRP0 PRP1 PKP0 PKP1 PKP2 PKP3 PKP4 PKP5 -+ VRN0 VRN1 PRN0 PRN1 PKN0 PKN1 PKN2 PKN3 PKN4 PKN5 -+*/ -+#define CURVE(num, idx) curves[num*par->gamma.num_values + idx] -+static int set_gamma(struct fbtft_par *par, unsigned long *curves) -+{ -+ unsigned long mask[] = { -+ 0b11111, 0b11111, 0b111, 0b111, 0b111, -+ 0b111, 0b111, 0b111, 0b111, 0b111, -+ 0b11111, 0b11111, 0b111, 0b111, 0b111, -+ 0b111, 0b111, 0b111, 0b111, 0b111 }; -+ int i, j; -+ -+ fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); -+ -+ /* apply mask */ -+ for (i = 0; i < 2; i++) -+ for (j = 0; j < 10; j++) -+ CURVE(i, j) &= mask[i*par->gamma.num_values + j]; -+ -+ write_reg(par, 0x0030, CURVE(0, 5) << 8 | CURVE(0, 4)); -+ write_reg(par, 0x0031, CURVE(0, 7) << 8 | CURVE(0, 6)); -+ write_reg(par, 0x0032, CURVE(0, 9) << 8 | CURVE(0, 8)); -+ write_reg(par, 0x0033, CURVE(0, 3) << 8 | CURVE(0, 2)); -+ write_reg(par, 0x0034, CURVE(1, 5) << 8 | CURVE(1, 4)); -+ write_reg(par, 0x0035, CURVE(1, 7) << 8 | CURVE(1, 6)); -+ write_reg(par, 0x0036, CURVE(1, 9) << 8 | CURVE(1, 8)); -+ write_reg(par, 0x0037, CURVE(1, 3) << 8 | CURVE(1, 2)); -+ write_reg(par, 0x003A, CURVE(0, 1) << 8 | CURVE(0, 0)); -+ write_reg(par, 0x003B, CURVE(1, 1) << 8 | CURVE(1, 0)); -+ -+ return 0; -+} -+#undef CURVE -+ -+ -+static struct fbtft_display display = { -+ .regwidth = 16, -+ .width = WIDTH, -+ .height = HEIGHT, -+ .gamma_num = 2, -+ .gamma_len = 10, -+ .gamma = DEFAULT_GAMMA, -+ .fbtftops = { -+ .init_display = init_display, -+ .set_addr_win = set_addr_win, -+ .set_var = set_var, -+ .set_gamma = set_gamma, -+ }, -+}; -+FBTFT_REGISTER_DRIVER(DRVNAME, "solomon,ssd1289", &display); -+ -+MODULE_ALIAS("spi:" DRVNAME); -+MODULE_ALIAS("platform:" DRVNAME); -+MODULE_ALIAS("spi:ssd1289"); -+MODULE_ALIAS("platform:ssd1289"); -+ -+MODULE_DESCRIPTION("FB driver for the SSD1289 LCD Controller"); -+MODULE_AUTHOR("Noralf Tronnes"); -+MODULE_LICENSE("GPL"); -diff --git a/drivers/video/fbtft/fb_ssd1306.c b/drivers/video/fbtft/fb_ssd1306.c -new file mode 100644 -index 0000000..5ea195b ---- /dev/null -+++ b/drivers/video/fbtft/fb_ssd1306.c -@@ -0,0 +1,229 @@ -+/* -+ * FB driver for the SSD1306 OLED Controller -+ * -+ * Copyright (C) 2013 Noralf Tronnes -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+ -+#include "fbtft.h" -+ -+#define DRVNAME "fb_ssd1306" -+#define WIDTH 128 -+#define HEIGHT 64 -+ -+ -+/* -+ write_reg() caveat: -+ -+ This doesn't work because D/C has to be LOW for both values: -+ write_reg(par, val1, val2); -+ -+ Do it like this: -+ write_reg(par, val1); -+ write_reg(par, val2); -+*/ -+ -+/* Init sequence taken from the Adafruit SSD1306 Arduino library */ -+static int init_display(struct fbtft_par *par) -+{ -+ fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); -+ -+ par->fbtftops.reset(par); -+ -+ if (par->gamma.curves[0] == 0) { -+ mutex_lock(&par->gamma.lock); -+ if (par->info->var.yres == 64) -+ par->gamma.curves[0] = 0xCF; -+ else -+ par->gamma.curves[0] = 0x8F; -+ mutex_unlock(&par->gamma.lock); -+ } -+ -+ /* Set Display OFF */ -+ write_reg(par, 0xAE); -+ -+ /* Set Display Clock Divide Ratio/ Oscillator Frequency */ -+ write_reg(par, 0xD5); -+ write_reg(par, 0x80); -+ -+ /* Set Multiplex Ratio */ -+ write_reg(par, 0xA8); -+ if (par->info->var.yres == 64) -+ write_reg(par, 0x3F); -+ else -+ write_reg(par, 0x1F); -+ -+ /* Set Display Offset */ -+ write_reg(par, 0xD3); -+ write_reg(par, 0x0); -+ -+ /* Set Display Start Line */ -+ write_reg(par, 0x40 | 0x0); -+ -+ /* Charge Pump Setting */ -+ write_reg(par, 0x8D); -+ /* A[2] = 1b, Enable charge pump during display on */ -+ write_reg(par, 0x14); -+ -+ /* Set Memory Addressing Mode */ -+ write_reg(par, 0x20); -+ /* Vertical addressing mode */ -+ write_reg(par, 0x01); -+ -+ /*Set Segment Re-map */ -+ /* column address 127 is mapped to SEG0 */ -+ write_reg(par, 0xA0 | 0x1); -+ -+ /* Set COM Output Scan Direction */ -+ /* remapped mode. Scan from COM[N-1] to COM0 */ -+ write_reg(par, 0xC8); -+ -+ /* Set COM Pins Hardware Configuration */ -+ write_reg(par, 0xDA); -+ if (par->info->var.yres == 64) -+ /* A[4]=1b, Alternative COM pin configuration */ -+ write_reg(par, 0x12); -+ else -+ /* A[4]=0b, Sequential COM pin configuration */ -+ write_reg(par, 0x02); -+ -+ /* Set Pre-charge Period */ -+ write_reg(par, 0xD9); -+ write_reg(par, 0xF1); -+ -+ /* Set VCOMH Deselect Level */ -+ write_reg(par, 0xDB); -+ /* according to the datasheet, this value is out of bounds */ -+ write_reg(par, 0x40); -+ -+ /* Entire Display ON */ -+ /* Resume to RAM content display. Output follows RAM content */ -+ write_reg(par, 0xA4); -+ -+ /* Set Normal Display -+ 0 in RAM: OFF in display panel -+ 1 in RAM: ON in display panel */ -+ write_reg(par, 0xA6); -+ -+ /* Set Display ON */ -+ write_reg(par, 0xAF); -+ -+ return 0; -+} -+ -+static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye) -+{ -+ fbtft_par_dbg(DEBUG_SET_ADDR_WIN, par, -+ "%s(xs=%d, ys=%d, xe=%d, ye=%d)\n", __func__, xs, ys, xe, ye); -+ -+ /* Set Lower Column Start Address for Page Addressing Mode */ -+ write_reg(par, 0x00 | 0x0); -+ /* Set Higher Column Start Address for Page Addressing Mode */ -+ write_reg(par, 0x10 | 0x0); -+ /* Set Display Start Line */ -+ write_reg(par, 0x40 | 0x0); -+} -+ -+static int blank(struct fbtft_par *par, bool on) -+{ -+ fbtft_par_dbg(DEBUG_BLANK, par, "%s(blank=%s)\n", -+ __func__, on ? "true" : "false"); -+ -+ if (on) -+ write_reg(par, 0xAE); -+ else -+ write_reg(par, 0xAF); -+ return 0; -+} -+ -+/* Gamma is used to control Contrast */ -+static int set_gamma(struct fbtft_par *par, unsigned long *curves) -+{ -+ fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); -+ -+ /* apply mask */ -+ curves[0] &= 0xFF; -+ -+ /* Set Contrast Control for BANK0 */ -+ write_reg(par, 0x81); -+ write_reg(par, curves[0]); -+ -+ return 0; -+} -+ -+static int write_vmem(struct fbtft_par *par, size_t offset, size_t len) -+{ -+ u16 *vmem16 = (u16 *)par->info->screen_base; -+ u8 *buf = par->txbuf.buf; -+ int x, y, i; -+ int ret = 0; -+ -+ fbtft_par_dbg(DEBUG_WRITE_VMEM, par, "%s()\n", __func__); -+ -+ for (x = 0; x < par->info->var.xres; x++) { -+ for (y = 0; y < par->info->var.yres/8; y++) { -+ *buf = 0x00; -+ for (i = 0; i < 8; i++) -+ *buf |= (vmem16[(y*8+i)*par->info->var.xres+x] ? 1 : 0) << i; -+ buf++; -+ } -+ } -+ -+ /* Write data */ -+ gpio_set_value(par->gpio.dc, 1); -+ ret = par->fbtftops.write(par, par->txbuf.buf, -+ par->info->var.xres*par->info->var.yres/8); -+ if (ret < 0) -+ dev_err(par->info->device, -+ "%s: write failed and returned: %d\n", __func__, ret); -+ -+ return ret; -+} -+ -+ -+static struct fbtft_display display = { -+ .regwidth = 8, -+ .width = WIDTH, -+ .height = HEIGHT, -+ .gamma_num = 1, -+ .gamma_len = 1, -+ .gamma = "00", -+ .fbtftops = { -+ .write_vmem = write_vmem, -+ .init_display = init_display, -+ .set_addr_win = set_addr_win, -+ .blank = blank, -+ .set_gamma = set_gamma, -+ }, -+}; -+ -+ -+FBTFT_REGISTER_DRIVER(DRVNAME, "solomon,ssd1306", &display); -+ -+MODULE_ALIAS("spi:" DRVNAME); -+MODULE_ALIAS("platform:" DRVNAME); -+MODULE_ALIAS("spi:ssd1306"); -+MODULE_ALIAS("platform:ssd1306"); -+ -+MODULE_DESCRIPTION("SSD1306 OLED Driver"); -+MODULE_AUTHOR("Noralf Tronnes"); -+MODULE_LICENSE("GPL"); -diff --git a/drivers/video/fbtft/fb_ssd1331.c b/drivers/video/fbtft/fb_ssd1331.c -new file mode 100644 -index 0000000..da7464f ---- /dev/null -+++ b/drivers/video/fbtft/fb_ssd1331.c -@@ -0,0 +1,205 @@ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "fbtft.h" -+ -+#define DRVNAME "fb_ssd1331" -+#define WIDTH 96 -+#define HEIGHT 64 -+#define GAMMA_NUM 1 -+#define GAMMA_LEN 63 -+#define DEFAULT_GAMMA "0 2 2 2 2 2 2 2 " \ -+ "2 2 2 2 2 2 2 2 " \ -+ "2 2 2 2 2 2 2 2 " \ -+ "2 2 2 2 2 2 2 2 " \ -+ "2 2 2 2 2 2 2 2 " \ -+ "2 2 2 2 2 2 2 2 " \ -+ "2 2 2 2 2 2 2 2 " \ -+ "2 2 2 2 2 2 2" \ -+ -+static int init_display(struct fbtft_par *par) -+{ -+ fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); -+ -+ par->fbtftops.reset(par); -+ -+ write_reg(par, 0xae); /* Display Off */ -+ write_reg(par, 0xa0, 0x70 | (par->bgr << 2)); /* Set Colour Depth */ -+ write_reg(par, 0x72); // RGB colour -+ write_reg(par, 0xa1, 0x00); /* Set Display Start Line */ -+ write_reg(par, 0xa2, 0x00); /* Set Display Offset */ -+ write_reg(par, 0xa4); /* NORMALDISPLAY */ -+ write_reg(par, 0xa8, 0x3f); // Set multiplex -+ write_reg(par, 0xad, 0x8e); // Set master -+ // write_reg(par, 0xb0, 0x0b); // Set power mode -+ write_reg(par, 0xb1, 0x31); // Precharge -+ write_reg(par, 0xb3, 0xf0); // Clock div -+ write_reg(par, 0x8a, 0x64); // Precharge A -+ write_reg(par, 0x8b, 0x78); // Precharge B -+ write_reg(par, 0x8c, 0x64); // Precharge C -+ write_reg(par, 0xbb, 0x3a); // Precharge level -+ write_reg(par, 0xbe, 0x3e); // vcomh -+ write_reg(par, 0x87, 0x06); // Master current -+ write_reg(par, 0x81, 0x91); // Contrast A -+ write_reg(par, 0x82, 0x50); // Contrast B -+ write_reg(par, 0x83, 0x7d); // Contrast C -+ write_reg(par, 0xaf); /* Set Sleep Mode Display On */ -+ -+ return 0; -+} -+ -+static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye) -+{ -+ fbtft_par_dbg(DEBUG_SET_ADDR_WIN, par, -+ "%s(xs=%d, ys=%d, xe=%d, ye=%d)\n", __func__, xs, ys, xe, ye); -+ -+ write_reg(par, 0x15, xs, xe); -+ write_reg(par, 0x75, ys, ye); -+} -+ -+static void write_reg8_bus8(struct fbtft_par *par, int len, ...) -+{ -+ va_list args; -+ int i, ret; -+ u8 *buf = (u8 *)par->buf; -+ -+ if (unlikely(par->debug & DEBUG_WRITE_REGISTER)) { -+ va_start(args, len); -+ for (i = 0; i < len; i++) { -+ buf[i] = (u8)va_arg(args, unsigned int); -+ } -+ va_end(args); -+ fbtft_par_dbg_hex(DEBUG_WRITE_REGISTER, par, par->info->device, u8, buf, len, "%s: ", __func__); -+ } -+ -+ va_start(args, len); -+ -+ *buf = (u8)va_arg(args, unsigned int); -+ if (par->gpio.dc != -1) -+ gpio_set_value(par->gpio.dc, 0); -+ ret = par->fbtftops.write(par, par->buf, sizeof(u8)); -+ if (ret < 0) { -+ va_end(args); -+ dev_err(par->info->device, "%s: write() failed and returned %d\n", __func__, ret); -+ return; -+ } -+ len--; -+ -+ if (len) { -+ i = len; -+ while (i--) { -+ *buf++ = (u8)va_arg(args, unsigned int); -+ } -+ ret = par->fbtftops.write(par, par->buf, len * (sizeof(u8))); -+ if (ret < 0) { -+ va_end(args); -+ dev_err(par->info->device, "%s: write() failed and returned %d\n", __func__, ret); -+ return; -+ } -+ } -+ if (par->gpio.dc != -1) -+ gpio_set_value(par->gpio.dc, 1); -+ va_end(args); -+} -+ -+/* -+ Grayscale Lookup Table -+ GS1 - GS63 -+ The driver Gamma curve contains the relative values between the entries -+ in the Lookup table. -+ -+ From datasheet: -+ 8.8 Gray Scale Decoder -+ -+ there are total 180 Gamma Settings (Setting 0 to Setting 180) -+ available for the Gray Scale table. -+ -+ The gray scale is defined in incremental way, with reference -+ to the length of previous table entry: -+ Setting of GS1 has to be >= 0 -+ Setting of GS2 has to be > Setting of GS1 +1 -+ Setting of GS3 has to be > Setting of GS2 +1 -+ : -+ Setting of GS63 has to be > Setting of GS62 +1 -+ -+ -+*/ -+static int set_gamma(struct fbtft_par *par, unsigned long *curves) -+{ -+ unsigned long tmp[GAMMA_NUM * GAMMA_LEN]; -+ int i, acc = 0; -+ -+ fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); -+ -+ for (i = 0; i < 63; i++) { -+ if (i > 0 && curves[i] < 2) { -+ dev_err(par->info->device, -+ "Illegal value in Grayscale Lookup Table at index %d. " \ -+ "Must be greater than 1\n", i); -+ return -EINVAL; -+ } -+ acc += curves[i]; -+ tmp[i] = acc; -+ if (acc > 180) { -+ dev_err(par->info->device, -+ "Illegal value(s) in Grayscale Lookup Table. " \ -+ "At index=%d, the accumulated value has exceeded 180\n", i); -+ return -EINVAL; -+ } -+ } -+ -+ write_reg(par, 0xB8, -+ tmp[0], tmp[1], tmp[2], tmp[3], tmp[4], tmp[5], tmp[6], tmp[7], -+ tmp[8], tmp[9], tmp[10], tmp[11], tmp[12], tmp[13], tmp[14], tmp[15], -+ tmp[16], tmp[17], tmp[18], tmp[19], tmp[20], tmp[21], tmp[22], tmp[23], -+ tmp[24], tmp[25], tmp[26], tmp[27], tmp[28], tmp[29], tmp[30], tmp[31], -+ tmp[32], tmp[33], tmp[34], tmp[35], tmp[36], tmp[37], tmp[38], tmp[39], -+ tmp[40], tmp[41], tmp[42], tmp[43], tmp[44], tmp[45], tmp[46], tmp[47], -+ tmp[48], tmp[49], tmp[50], tmp[51], tmp[52], tmp[53], tmp[54], tmp[55], -+ tmp[56], tmp[57], tmp[58], tmp[59], tmp[60], tmp[61], tmp[62]); -+ -+ return 0; -+} -+ -+static int blank(struct fbtft_par *par, bool on) -+{ -+ fbtft_par_dbg(DEBUG_BLANK, par, "%s(blank=%s)\n", -+ __func__, on ? "true" : "false"); -+ if (on) -+ write_reg(par, 0xAE); -+ else -+ write_reg(par, 0xAF); -+ return 0; -+} -+ -+ -+static struct fbtft_display display = { -+ .regwidth = 8, -+ .width = WIDTH, -+ .height = HEIGHT, -+ .gamma_num = GAMMA_NUM, -+ .gamma_len = GAMMA_LEN, -+ .gamma = DEFAULT_GAMMA, -+ .fbtftops = { -+ .write_register = write_reg8_bus8, -+ .init_display = init_display, -+ .set_addr_win = set_addr_win, -+ .set_gamma = set_gamma, -+ .blank = blank, -+ }, -+}; -+ -+FBTFT_REGISTER_DRIVER(DRVNAME, "solomon,ssd1331", &display); -+ -+MODULE_ALIAS("spi:" DRVNAME); -+MODULE_ALIAS("platform:" DRVNAME); -+MODULE_ALIAS("spi:ssd1331"); -+MODULE_ALIAS("platform:ssd1331"); -+ -+MODULE_DESCRIPTION("SSD1331 OLED Driver"); -+MODULE_AUTHOR("Alec Smecher (adapted from SSD1351 by James Davies)"); -+MODULE_LICENSE("GPL"); -diff --git a/drivers/video/fbtft/fb_ssd1351.c b/drivers/video/fbtft/fb_ssd1351.c -new file mode 100644 -index 0000000..062d986 ---- /dev/null -+++ b/drivers/video/fbtft/fb_ssd1351.c -@@ -0,0 +1,258 @@ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "fbtft.h" -+ -+#define DRVNAME "fb_ssd1351" -+#define WIDTH 128 -+#define HEIGHT 128 -+#define GAMMA_NUM 1 -+#define GAMMA_LEN 63 -+#define DEFAULT_GAMMA "0 2 2 2 2 2 2 2 " \ -+ "2 2 2 2 2 2 2 2 " \ -+ "2 2 2 2 2 2 2 2 " \ -+ "2 2 2 2 2 2 2 2 " \ -+ "2 2 2 2 2 2 2 2 " \ -+ "2 2 2 2 2 2 2 2 " \ -+ "2 2 2 2 2 2 2 2 " \ -+ "2 2 2 2 2 2 2" \ -+ -+static void register_onboard_backlight(struct fbtft_par *par); -+ -+static int init_display(struct fbtft_par *par) -+{ -+ fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); -+ -+ if (par->pdata -+ && par->pdata->display.backlight == FBTFT_ONBOARD_BACKLIGHT) { -+ /* module uses onboard GPIO for panel power */ -+ par->fbtftops.register_backlight = register_onboard_backlight; -+ } -+ -+ par->fbtftops.reset(par); -+ -+ write_reg(par, 0xfd, 0x12); /* Command Lock */ -+ write_reg(par, 0xfd, 0xb1); /* Command Lock */ -+ write_reg(par, 0xae); /* Display Off */ -+ write_reg(par, 0xb3, 0xf1); /* Front Clock Div */ -+ write_reg(par, 0xca, 0x7f); /* Set Mux Ratio */ -+ write_reg(par, 0x15, 0x00, 0x7f); /* Set Column Address */ -+ write_reg(par, 0x75, 0x00, 0x7f); /* Set Row Address */ -+ write_reg(par, 0xa1, 0x00); /* Set Display Start Line */ -+ write_reg(par, 0xa2, 0x00); /* Set Display Offset */ -+ write_reg(par, 0xb5, 0x00); /* Set GPIO */ -+ write_reg(par, 0xab, 0x01); /* Set Function Selection */ -+ write_reg(par, 0xb1, 0x32); /* Set Phase Length */ -+ write_reg(par, 0xb4, 0xa0, 0xb5, 0x55); /* Set Segment Low Voltage */ -+ write_reg(par, 0xbb, 0x17); /* Set Precharge Voltage */ -+ write_reg(par, 0xbe, 0x05); /* Set VComH Voltage */ -+ write_reg(par, 0xc1, 0xc8, 0x80, 0xc8); /* Set Contrast */ -+ write_reg(par, 0xc7, 0x0f); /* Set Master Contrast */ -+ write_reg(par, 0xb6, 0x01); /* Set Second Precharge Period */ -+ write_reg(par, 0xa6); /* Set Display Mode Reset */ -+ write_reg(par, 0xaf); /* Set Sleep Mode Display On */ -+ -+ return 0; -+} -+ -+static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye) -+{ -+ fbtft_par_dbg(DEBUG_SET_ADDR_WIN, par, -+ "%s(xs=%d, ys=%d, xe=%d, ye=%d)\n", __func__, xs, ys, xe, ye); -+ -+ write_reg(par, 0x15, xs, xe); -+ write_reg(par, 0x75, ys, ye); -+ write_reg(par, 0x5c); -+} -+ -+static int set_var(struct fbtft_par *par) -+{ -+ unsigned remap; -+ fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); -+ -+ if (par->fbtftops.init_display != init_display) { -+ /* don't risk messing up register A0h */ -+ fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, -+ "%s: skipping since custom init_display() is used\n", -+ __func__); -+ return 0; -+ } -+ -+ remap = 0x60 | (par->bgr << 2); /* Set Colour Depth */ -+ -+ switch (par->info->var.rotate) { -+ case 0: -+ write_reg(par, 0xA0, remap | 0b00 | 1<<4); -+ break; -+ case 270: -+ write_reg(par, 0xA0, remap | 0b11 | 1<<4); -+ break; -+ case 180: -+ write_reg(par, 0xA0, remap | 0b10); -+ break; -+ case 90: -+ write_reg(par, 0xA0, remap | 0b01); -+ break; -+ } -+ -+ return 0; -+} -+ -+/* -+ Grayscale Lookup Table -+ GS1 - GS63 -+ The driver Gamma curve contains the relative values between the entries -+ in the Lookup table. -+ -+ From datasheet: -+ 8.8 Gray Scale Decoder -+ -+ there are total 180 Gamma Settings (Setting 0 to Setting 180) -+ available for the Gray Scale table. -+ -+ The gray scale is defined in incremental way, with reference -+ to the length of previous table entry: -+ Setting of GS1 has to be >= 0 -+ Setting of GS2 has to be > Setting of GS1 +1 -+ Setting of GS3 has to be > Setting of GS2 +1 -+ : -+ Setting of GS63 has to be > Setting of GS62 +1 -+ -+ -+*/ -+static int set_gamma(struct fbtft_par *par, unsigned long *curves) -+{ -+ unsigned long tmp[GAMMA_NUM * GAMMA_LEN]; -+ int i, acc = 0; -+ -+ fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); -+ -+ for (i = 0; i < 63; i++) { -+ if (i > 0 && curves[i] < 2) { -+ dev_err(par->info->device, -+ "Illegal value in Grayscale Lookup Table at index %d. " \ -+ "Must be greater than 1\n", i); -+ return -EINVAL; -+ } -+ acc += curves[i]; -+ tmp[i] = acc; -+ if (acc > 180) { -+ dev_err(par->info->device, -+ "Illegal value(s) in Grayscale Lookup Table. " \ -+ "At index=%d, the accumulated value has exceeded 180\n", i); -+ return -EINVAL; -+ } -+ } -+ -+ write_reg(par, 0xB8, -+ tmp[0], tmp[1], tmp[2], tmp[3], tmp[4], tmp[5], tmp[6], tmp[7], -+ tmp[8], tmp[9], tmp[10], tmp[11], tmp[12], tmp[13], tmp[14], tmp[15], -+ tmp[16], tmp[17], tmp[18], tmp[19], tmp[20], tmp[21], tmp[22], tmp[23], -+ tmp[24], tmp[25], tmp[26], tmp[27], tmp[28], tmp[29], tmp[30], tmp[31], -+ tmp[32], tmp[33], tmp[34], tmp[35], tmp[36], tmp[37], tmp[38], tmp[39], -+ tmp[40], tmp[41], tmp[42], tmp[43], tmp[44], tmp[45], tmp[46], tmp[47], -+ tmp[48], tmp[49], tmp[50], tmp[51], tmp[52], tmp[53], tmp[54], tmp[55], -+ tmp[56], tmp[57], tmp[58], tmp[59], tmp[60], tmp[61], tmp[62]); -+ -+ return 0; -+} -+ -+static int blank(struct fbtft_par *par, bool on) -+{ -+ fbtft_par_dbg(DEBUG_BLANK, par, "%s(blank=%s)\n", -+ __func__, on ? "true" : "false"); -+ if (on) -+ write_reg(par, 0xAE); -+ else -+ write_reg(par, 0xAF); -+ return 0; -+} -+ -+ -+static struct fbtft_display display = { -+ .regwidth = 8, -+ .width = WIDTH, -+ .height = HEIGHT, -+ .gamma_num = GAMMA_NUM, -+ .gamma_len = GAMMA_LEN, -+ .gamma = DEFAULT_GAMMA, -+ .fbtftops = { -+ .init_display = init_display, -+ .set_addr_win = set_addr_win, -+ .set_var = set_var, -+ .set_gamma = set_gamma, -+ .blank = blank, -+ }, -+}; -+ -+#ifdef CONFIG_FB_BACKLIGHT -+static int update_onboard_backlight(struct backlight_device *bd) -+{ -+ struct fbtft_par *par = bl_get_data(bd); -+ bool on; -+ -+ fbtft_par_dbg(DEBUG_BACKLIGHT, par, -+ "%s: power=%d, fb_blank=%d\n", -+ __func__, bd->props.power, bd->props.fb_blank); -+ -+ on = (bd->props.power == FB_BLANK_UNBLANK) -+ && (bd->props.fb_blank == FB_BLANK_UNBLANK); -+ /* Onboard backlight connected to GPIO0 on SSD1351, GPIO1 unused */ -+ write_reg(par, 0xB5, on ? 0x03 : 0x02); -+ -+ return 0; -+} -+ -+static void register_onboard_backlight(struct fbtft_par *par) -+{ -+ struct backlight_device *bd; -+ struct backlight_properties bl_props = { 0, }; -+ struct backlight_ops *bl_ops; -+ -+ fbtft_par_dbg(DEBUG_BACKLIGHT, par, "%s()\n", __func__); -+ -+ bl_ops = devm_kzalloc(par->info->device, sizeof(struct backlight_ops), -+ GFP_KERNEL); -+ if (!bl_ops) { -+ dev_err(par->info->device, -+ "%s: could not allocate memory for backlight operations.\n", -+ __func__); -+ return; -+ } -+ -+ bl_ops->update_status = update_onboard_backlight; -+ bl_props.type = BACKLIGHT_RAW; -+ bl_props.power = FB_BLANK_POWERDOWN; -+ -+ bd = backlight_device_register(dev_driver_string(par->info->device), -+ par->info->device, par, bl_ops, &bl_props); -+ if (IS_ERR(bd)) { -+ dev_err(par->info->device, -+ "cannot register backlight device (%ld)\n", -+ PTR_ERR(bd)); -+ return; -+ } -+ par->info->bl_dev = bd; -+ -+ if (!par->fbtftops.unregister_backlight) -+ par->fbtftops.unregister_backlight = fbtft_unregister_backlight; -+} -+#else -+static void register_onboard_backlight(struct fbtft_par *par) { }; -+#endif -+ -+ -+FBTFT_REGISTER_DRIVER(DRVNAME, "solomon,ssd1351", &display); -+ -+MODULE_ALIAS("spi:" DRVNAME); -+MODULE_ALIAS("platform:" DRVNAME); -+MODULE_ALIAS("spi:ssd1351"); -+MODULE_ALIAS("platform:ssd1351"); -+ -+MODULE_DESCRIPTION("SSD1351 OLED Driver"); -+MODULE_AUTHOR("James Davies"); -+MODULE_LICENSE("GPL"); -diff --git a/drivers/video/fbtft/fb_st7735r.c b/drivers/video/fbtft/fb_st7735r.c -new file mode 100644 -index 0000000..b63aa38 ---- /dev/null -+++ b/drivers/video/fbtft/fb_st7735r.c -@@ -0,0 +1,195 @@ -+/* -+ * FB driver for the ST7735R LCD Controller -+ * -+ * Copyright (C) 2013 Noralf Tronnes -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -+ */ -+ -+#include -+#include -+#include -+ -+#include "fbtft.h" -+ -+#define DRVNAME "fb_st7735r" -+#define DEFAULT_GAMMA "0F 1A 0F 18 2F 28 20 22 1F 1B 23 37 00 07 02 10\n" \ -+ "0F 1B 0F 17 33 2C 29 2E 30 30 39 3F 00 07 03 10" -+ -+ -+static int default_init_sequence[] = { -+ /* SWRESET - Software reset */ -+ -1, 0x01, -+ -2, 150, /* delay */ -+ -+ /* SLPOUT - Sleep out & booster on */ -+ -1, 0x11, -+ -2, 500, /* delay */ -+ -+ /* FRMCTR1 - frame rate control: normal mode -+ frame rate = fosc / (1 x 2 + 40) * (LINE + 2C + 2D) */ -+ -1, 0xB1, 0x01, 0x2C, 0x2D, -+ -+ /* FRMCTR2 - frame rate control: idle mode -+ frame rate = fosc / (1 x 2 + 40) * (LINE + 2C + 2D) */ -+ -1, 0xB2, 0x01, 0x2C, 0x2D, -+ -+ /* FRMCTR3 - frame rate control - partial mode -+ dot inversion mode, line inversion mode */ -+ -1, 0xB3, 0x01, 0x2C, 0x2D, 0x01, 0x2C, 0x2D, -+ -+ /* INVCTR - display inversion control -+ no inversion */ -+ -1, 0xB4, 0x07, -+ -+ /* PWCTR1 - Power Control -+ -4.6V, AUTO mode */ -+ -1, 0xC0, 0xA2, 0x02, 0x84, -+ -+ /* PWCTR2 - Power Control -+ VGH25 = 2.4C VGSEL = -10 VGH = 3 * AVDD */ -+ -1, 0xC1, 0xC5, -+ -+ /* PWCTR3 - Power Control -+ Opamp current small, Boost frequency */ -+ -1, 0xC2, 0x0A, 0x00, -+ -+ /* PWCTR4 - Power Control -+ BCLK/2, Opamp current small & Medium low */ -+ -1, 0xC3,0x8A,0x2A, -+ -+ /* PWCTR5 - Power Control */ -+ -1, 0xC4, 0x8A, 0xEE, -+ -+ /* VMCTR1 - Power Control */ -+ -1, 0xC5, 0x0E, -+ -+ /* INVOFF - Display inversion off */ -+ -1, 0x20, -+ -+ /* COLMOD - Interface pixel format */ -+ -1, 0x3A, 0x05, -+ -+ /* DISPON - Display On */ -+ -1, 0x29, -+ -2, 100, /* delay */ -+ -+ /* NORON - Partial off (Normal) */ -+ -1, 0x13, -+ -2, 10, /* delay */ -+ -+ /* end marker */ -+ -3 -+}; -+ -+static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye) -+{ -+ fbtft_par_dbg(DEBUG_SET_ADDR_WIN, par, -+ "%s(xs=%d, ys=%d, xe=%d, ye=%d)\n", __func__, xs, ys, xe, ye); -+ -+ /* Column address */ -+ write_reg(par, 0x2A, xs >> 8, xs & 0xFF, xe >> 8, xe & 0xFF); -+ -+ /* Row adress */ -+ write_reg(par, 0x2B, ys >> 8, ys & 0xFF, ye >> 8, ye & 0xFF); -+ -+ /* Memory write */ -+ write_reg(par, 0x2C); -+} -+ -+#define MY (1 << 7) -+#define MX (1 << 6) -+#define MV (1 << 5) -+static int set_var(struct fbtft_par *par) -+{ -+ fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); -+ -+ /* MADCTL - Memory data access control -+ RGB/BGR: -+ 1. Mode selection pin SRGB -+ RGB H/W pin for color filter setting: 0=RGB, 1=BGR -+ 2. MADCTL RGB bit -+ RGB-BGR ORDER color filter panel: 0=RGB, 1=BGR */ -+ switch (par->info->var.rotate) { -+ case 0: -+ write_reg(par, 0x36, MX | MY | (par->bgr << 3)); -+ break; -+ case 270: -+ write_reg(par, 0x36, MY | MV | (par->bgr << 3)); -+ break; -+ case 180: -+ write_reg(par, 0x36, (par->bgr << 3)); -+ break; -+ case 90: -+ write_reg(par, 0x36, MX | MV | (par->bgr << 3)); -+ break; -+ } -+ -+ return 0; -+} -+ -+/* -+ Gamma string format: -+ VRF0P VOS0P PK0P PK1P PK2P PK3P PK4P PK5P PK6P PK7P PK8P PK9P SELV0P SELV1P SELV62P SELV63P -+ VRF0N VOS0N PK0N PK1N PK2N PK3N PK4N PK5N PK6N PK7N PK8N PK9N SELV0N SELV1N SELV62N SELV63N -+*/ -+#define CURVE(num, idx) curves[num*par->gamma.num_values + idx] -+static int set_gamma(struct fbtft_par *par, unsigned long *curves) -+{ -+ int i,j; -+ -+ fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); -+ -+ /* apply mask */ -+ for (i = 0; i < par->gamma.num_curves; i++) -+ for (j = 0; j < par->gamma.num_values; j++) -+ CURVE(i,j) &= 0b111111; -+ -+ for (i = 0; i < par->gamma.num_curves; i++) -+ write_reg(par, 0xE0 + i, -+ CURVE(i, 0), CURVE(i, 1), CURVE(i, 2), CURVE(i, 3), -+ CURVE(i, 4), CURVE(i, 5), CURVE(i, 6), CURVE(i, 7), -+ CURVE(i, 8), CURVE(i, 9), CURVE(i, 10), CURVE(i, 11), -+ CURVE(i, 12), CURVE(i, 13), CURVE(i, 14), CURVE(i,15)); -+ -+ return 0; -+} -+#undef CURVE -+ -+ -+static struct fbtft_display display = { -+ .regwidth = 8, -+ .width = 128, -+ .height = 160, -+ .init_sequence = default_init_sequence, -+ .gamma_num = 2, -+ .gamma_len = 16, -+ .gamma = DEFAULT_GAMMA, -+ .fbtftops = { -+ .set_addr_win = set_addr_win, -+ .set_var = set_var, -+ .set_gamma = set_gamma, -+ }, -+}; -+FBTFT_REGISTER_DRIVER(DRVNAME, "sitronix,st7735r", &display); -+ -+MODULE_ALIAS("spi:" DRVNAME); -+MODULE_ALIAS("platform:" DRVNAME); -+MODULE_ALIAS("spi:st7735r"); -+MODULE_ALIAS("platform:st7735r"); -+ -+MODULE_DESCRIPTION("FB driver for the ST7735R LCD Controller"); -+MODULE_AUTHOR("Noralf Tronnes"); -+MODULE_LICENSE("GPL"); -diff --git a/drivers/video/fbtft/fb_tinylcd.c b/drivers/video/fbtft/fb_tinylcd.c -new file mode 100644 -index 0000000..ca98bfb ---- /dev/null -+++ b/drivers/video/fbtft/fb_tinylcd.c -@@ -0,0 +1,124 @@ -+/* -+ * Custom FB driver for tinylcd.com display -+ * -+ * Copyright (C) 2013 Noralf Tronnes -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -+ */ -+ -+#include -+#include -+#include -+#include -+ -+#include "fbtft.h" -+ -+#define DRVNAME "fb_tinylcd" -+#define WIDTH 320 -+#define HEIGHT 480 -+ -+ -+static int init_display(struct fbtft_par *par) -+{ -+ fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); -+ -+ par->fbtftops.reset(par); -+ -+ write_reg(par, 0xB0, 0x80); -+ write_reg(par, 0xC0, 0x0A, 0x0A); -+ write_reg(par, 0xC1, 0x45, 0x07); -+ write_reg(par, 0xC2, 0x33); -+ write_reg(par, 0xC5, 0x00, 0x42, 0x80); -+ write_reg(par, 0xB1, 0xD0, 0x11); -+ write_reg(par, 0xB4, 0x02); -+ write_reg(par, 0xB6, 0x00, 0x22, 0x3B); -+ write_reg(par, 0xB7, 0x07); -+ write_reg(par, 0x36, 0x58); -+ write_reg(par, 0xF0, 0x36, 0xA5, 0xD3); -+ write_reg(par, 0xE5, 0x80); -+ write_reg(par, 0xE5, 0x01); -+ write_reg(par, 0xB3, 0x00); -+ write_reg(par, 0xE5, 0x00); -+ write_reg(par, 0xF0, 0x36, 0xA5, 0x53); -+ write_reg(par, 0xE0, 0x00, 0x35, 0x33, 0x00, 0x00, 0x00, -+ 0x00, 0x35, 0x33, 0x00, 0x00, 0x00); -+ write_reg(par, 0x3A, 0x55); -+ write_reg(par, 0x11); -+ udelay(250); -+ write_reg(par, 0x29); -+ -+ return 0; -+} -+ -+static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye) -+{ -+ fbtft_par_dbg(DEBUG_SET_ADDR_WIN, par, -+ "%s(xs=%d, ys=%d, xe=%d, ye=%d)\n", __func__, xs, ys, xe, ye); -+ -+ /* Column address */ -+ write_reg(par, 0x2A, xs >> 8, xs & 0xFF, xe >> 8, xe & 0xFF); -+ -+ /* Row adress */ -+ write_reg(par, 0x2B, ys >> 8, ys & 0xFF, ye >> 8, ye & 0xFF); -+ -+ /* Memory write */ -+ write_reg(par, 0x2C); -+} -+ -+static int set_var(struct fbtft_par *par) -+{ -+ fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); -+ -+ switch (par->info->var.rotate) { -+ case 270: -+ write_reg(par, 0xB6, 0x00, 0x02, 0x3B); -+ write_reg(par, 0x36, 0x28); -+ break; -+ case 180: -+ write_reg(par, 0xB6, 0x00, 0x22, 0x3B); -+ write_reg(par, 0x36, 0x58); -+ break; -+ case 90: -+ write_reg(par, 0xB6, 0x00, 0x22, 0x3B); -+ write_reg(par, 0x36, 0x38); -+ break; -+ default: -+ write_reg(par, 0xB6, 0x00, 0x22, 0x3B); -+ write_reg(par, 0x36, 0x08); -+ break; -+ } -+ -+ return 0; -+} -+ -+ -+static struct fbtft_display display = { -+ .regwidth = 8, -+ .width = WIDTH, -+ .height = HEIGHT, -+ .fbtftops = { -+ .init_display = init_display, -+ .set_addr_win = set_addr_win, -+ .set_var = set_var, -+ }, -+}; -+FBTFT_REGISTER_DRIVER(DRVNAME, "neosec,tinylcd", &display); -+ -+MODULE_ALIAS("spi:" DRVNAME); -+MODULE_ALIAS("spi:tinylcd"); -+ -+MODULE_DESCRIPTION("Custom FB driver for tinylcd.com display"); -+MODULE_AUTHOR("Noralf Tronnes"); -+MODULE_LICENSE("GPL"); -diff --git a/drivers/video/fbtft/fb_tls8204.c b/drivers/video/fbtft/fb_tls8204.c -new file mode 100644 -index 0000000..8738c7a ---- /dev/null -+++ b/drivers/video/fbtft/fb_tls8204.c -@@ -0,0 +1,176 @@ -+/* -+ * FB driver for the TLS8204 LCD Controller -+ * -+ * The display is monochrome and the video memory is RGB565. -+ * Any pixel value except 0 turns the pixel on. -+ * -+ * Copyright (C) 2013 Noralf Tronnes -+ * Copyright (C) 2014 Michael Hope (adapted for the TLS8204) -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "fbtft.h" -+ -+#define DRVNAME "fb_tls8204" -+#define WIDTH 84 -+#define HEIGHT 48 -+#define TXBUFLEN WIDTH -+#define DEFAULT_GAMMA "40" /* gamma is used to control contrast in this driver */ -+ -+static unsigned bs = 4; -+module_param(bs, uint, 0); -+MODULE_PARM_DESC(bs, "BS[2:0] Bias voltage level: 0-7 (default: 4)"); -+ -+static int init_display(struct fbtft_par *par) -+{ -+ fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); -+ -+ par->fbtftops.reset(par); -+ -+ /* Enter extended command mode */ -+ write_reg(par, 0x21); /* 5:1 1 -+ 2:0 PD - Powerdown control: chip is active -+ 1:0 V - Entry mode: horizontal addressing -+ 0:1 H - Extended instruction set control: extended -+ */ -+ -+ /* H=1 Bias system */ -+ write_reg(par, 0x10 | (bs & 0x7)); /* -+ 4:1 1 -+ 3:0 0 -+ 2:x BS2 - Bias System -+ 1:x BS1 -+ 0:x BS0 -+ */ -+ -+ /* Set the address of the first display line. */ -+ write_reg(par, 0x04 | (64 >> 6)); -+ write_reg(par, 0x40 | (64 & 0x3F)); -+ -+ /* Enter H=0 standard command mode */ -+ write_reg(par, 0x20); -+ -+ /* H=0 Display control */ -+ write_reg(par, 0x08 | 4); /* -+ 3:1 1 -+ 2:1 D - DE: 10=normal mode -+ 1:0 0 -+ 0:0 E -+ */ -+ -+ return 0; -+} -+ -+static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye) -+{ -+ fbtft_par_dbg(DEBUG_SET_ADDR_WIN, par, "%s(xs=%d, ys=%d, xe=%d, ye=%d)\n", __func__, xs, ys, xe, ye); -+ -+ /* H=0 Set X address of RAM */ -+ write_reg(par, 0x80); /* 7:1 1 -+ 6-0: X[6:0] - 0x00 -+ */ -+ -+ /* H=0 Set Y address of RAM */ -+ write_reg(par, 0x40); /* 7:0 0 -+ 6:1 1 -+ 2-0: Y[2:0] - 0x0 -+ */ -+} -+ -+static int write_vmem(struct fbtft_par *par, size_t offset, size_t len) -+{ -+ u16 *vmem16 = (u16 *)par->info->screen_base; -+ int x, y, i; -+ int ret = 0; -+ -+ fbtft_par_dbg(DEBUG_WRITE_VMEM, par, "%s()\n", __func__); -+ -+ for (y = 0; y < HEIGHT/8; y++) { -+ u8 *buf = par->txbuf.buf; -+ /* The display is 102x68 but the LCD is 84x48. Set -+ the write pointer at the start of each row. */ -+ gpio_set_value(par->gpio.dc, 0); -+ write_reg(par, 0x80 | 0); -+ write_reg(par, 0x40 | y); -+ -+ for (x = 0; x < WIDTH; x++) { -+ u8 ch = 0; -+ for (i = 0; i < 8*WIDTH; i += WIDTH) { -+ ch >>= 1; -+ if (vmem16[(y*8*WIDTH)+i+x]) -+ ch |= 0x80; -+ } -+ *buf++ = ch; -+ } -+ /* Write the row */ -+ gpio_set_value(par->gpio.dc, 1); -+ ret = par->fbtftops.write(par, par->txbuf.buf, WIDTH); -+ if (ret < 0) { -+ dev_err(par->info->device, -+ "%s: write failed and returned: %d\n", __func__, ret); -+ break; -+ } -+ } -+ -+ return ret; -+} -+ -+static int set_gamma(struct fbtft_par *par, unsigned long *curves) -+{ -+ fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); -+ -+ /* apply mask */ -+ curves[0] &= 0x7F; -+ -+ write_reg(par, 0x21); /* turn on extended instruction set */ -+ write_reg(par, 0x80 | curves[0]); -+ write_reg(par, 0x20); /* turn off extended instruction set */ -+ -+ return 0; -+} -+ -+ -+static struct fbtft_display display = { -+ .regwidth = 8, -+ .width = WIDTH, -+ .height = HEIGHT, -+ .txbuflen = TXBUFLEN, -+ .gamma_num = 1, -+ .gamma_len = 1, -+ .gamma = DEFAULT_GAMMA, -+ .fbtftops = { -+ .init_display = init_display, -+ .set_addr_win = set_addr_win, -+ .write_vmem = write_vmem, -+ .set_gamma = set_gamma, -+ }, -+ .backlight = 1, -+}; -+FBTFT_REGISTER_DRIVER(DRVNAME, "teralane,tls8204", &display); -+ -+MODULE_ALIAS("spi:" DRVNAME); -+MODULE_ALIAS("spi:tls8204"); -+ -+MODULE_DESCRIPTION("FB driver for the TLS8204 LCD Controller"); -+MODULE_AUTHOR("Michael Hope"); -+MODULE_LICENSE("GPL"); -diff --git a/drivers/video/fbtft/fb_uc1701.c b/drivers/video/fbtft/fb_uc1701.c -new file mode 100644 -index 0000000..d70ac52 ---- /dev/null -+++ b/drivers/video/fbtft/fb_uc1701.c -@@ -0,0 +1,210 @@ -+/* -+ * FB driver for the UC1701 LCD Controller -+ * -+ * The display is monochrome and the video memory is RGB565. -+ * Any pixel value except 0 turns the pixel on. -+ * -+ * Copyright (C) 2014 Juergen Holzmann -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "fbtft.h" -+ -+#define DRVNAME "fb_uc1701" -+#define WIDTH 102 -+#define HEIGHT 64 -+#define PAGES (HEIGHT/8) -+ -+/* 1: Display on/off */ -+#define LCD_DISPLAY_ENABLE 0xAE -+/* 2: display start line set */ -+#define LCD_START_LINE 0x40 -+/* 3: Page address set (lower 4 bits select one of the pages) */ -+#define LCD_PAGE_ADDRESS 0xB0 -+/* 4: column address */ -+#define LCD_COL_ADDRESS 0x10 -+/* 8: select orientation */ -+#define LCD_BOTTOMVIEW 0xA0 -+/* 9: inverted display */ -+#define LCD_DISPLAY_INVERT 0xA6 -+/* 10: show memory content or switch all pixels on */ -+#define LCD_ALL_PIXEL 0xA4 -+/* 11: lcd bias set */ -+#define LCD_BIAS 0xA2 -+/* 14: Reset Controller */ -+#define LCD_RESET_CMD 0xE2 -+/* 15: output mode select (turns display upside-down) */ -+#define LCD_SCAN_DIR 0xC0 -+/* 16: power control set */ -+#define LCD_POWER_CONTROL 0x28 -+/* 17: voltage regulator resistor ratio set */ -+#define LCD_VOLTAGE 0x20 -+/* 18: Volume mode set */ -+#define LCD_VOLUME_MODE 0x81 -+/* 22: NOP command */ -+#define LCD_NO_OP 0xE3 -+/* 25: advanced program control */ -+#define LCD_ADV_PROG_CTRL 0xFA -+/* 25: advanced program control2 */ -+#define LCD_ADV_PROG_CTRL2 0x10 -+#define LCD_TEMPCOMP_HIGH 0x80 -+/* column offset for normal orientation */ -+#define SHIFT_ADDR_NORMAL 0 -+/* column offset for bottom view orientation */ -+#define SHIFT_ADDR_TOPVIEW 30 -+ -+ -+static int init_display(struct fbtft_par *par) -+{ -+ fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); -+ -+ par->fbtftops.reset(par); -+ -+ /* softreset of LCD */ -+ write_reg(par, LCD_RESET_CMD); -+ mdelay(10); -+ -+ /* set startpoint */ -+ /* LCD_START_LINE | (pos & 0x3F) */ -+ write_reg(par, LCD_START_LINE); -+ -+ /* select orientation BOTTOMVIEW */ -+ write_reg(par, LCD_BOTTOMVIEW | 1); -+ /* output mode select (turns display upside-down) */ -+ write_reg(par, LCD_SCAN_DIR | 0x00); -+ -+ /* Normal Pixel mode */ -+ write_reg(par, LCD_ALL_PIXEL | 0); -+ -+ /* positive display */ -+ write_reg(par, LCD_DISPLAY_INVERT | 0); -+ -+ /* bias 1/9 */ -+ write_reg(par, LCD_BIAS | 0); -+ -+ /* power control mode: all features on */ -+ /* LCD_POWER_CONTROL | (val&0x07) */ -+ write_reg(par, LCD_POWER_CONTROL | 0x07); -+ -+ /* set voltage regulator R/R */ -+ /* LCD_VOLTAGE | (val&0x07) */ -+ write_reg(par, LCD_VOLTAGE | 0x07); -+ -+ /* volume mode set */ -+ /* LCD_VOLUME_MODE,val&0x3f,LCD_NO_OP */ -+ write_reg(par, LCD_VOLUME_MODE); -+ /* LCD_VOLUME_MODE,val&0x3f,LCD_NO_OP */ -+ write_reg(par, 0x09); -+ /* ???? */ -+ /* LCD_VOLUME_MODE,val&0x3f,LCD_NO_OP */ -+ write_reg(par, LCD_NO_OP); -+ -+ /* advanced program control */ -+ write_reg(par, LCD_ADV_PROG_CTRL); -+ write_reg(par, LCD_ADV_PROG_CTRL2|LCD_TEMPCOMP_HIGH); -+ -+ /* enable display */ -+ write_reg(par, LCD_DISPLAY_ENABLE | 1); -+ -+ return 0; -+} -+ -+static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye) -+{ -+ fbtft_par_dbg(DEBUG_SET_ADDR_WIN, par, "%s(xs=%d, ys=%d, xe=%d, ye=%d)\n", __func__, xs, ys, xe, ye); -+ -+ /* goto address */ -+ /* LCD_PAGE_ADDRESS | ((page) & 0x1F), -+ (((col)+SHIFT_ADDR_NORMAL) & 0x0F), -+ LCD_COL_ADDRESS | ((((col)+SHIFT_ADDR_NORMAL)>>4) & 0x0F) */ -+ write_reg(par, LCD_PAGE_ADDRESS); -+ /* LCD_PAGE_ADDRESS | ((page) & 0x1F), -+ (((col)+SHIFT_ADDR_NORMAL) & 0x0F), -+ LCD_COL_ADDRESS | ((((col)+SHIFT_ADDR_NORMAL)>>4) & 0x0F) */ -+ write_reg(par, 0x00); -+ /* LCD_PAGE_ADDRESS | ((page) & 0x1F), -+ (((col)+SHIFT_ADDR_NORMAL) & 0x0F), -+ LCD_COL_ADDRESS | ((((col)+SHIFT_ADDR_NORMAL)>>4) & 0x0F) */ -+ write_reg(par, LCD_COL_ADDRESS); -+} -+ -+static int write_vmem(struct fbtft_par *par, size_t offset, size_t len) -+{ -+ u16 *vmem16 = (u16 *)par->info->screen_base; -+ u8 *buf = par->txbuf.buf; -+ int x, y, i; -+ int ret = 0; -+ -+ fbtft_par_dbg(DEBUG_WRITE_VMEM, par, "%s()\n", __func__); -+ -+ for (y = 0; y < PAGES; y++) { -+ buf = par->txbuf.buf; -+ for (x = 0; x < WIDTH; x++) { -+ *buf = 0x00; -+ for (i = 0; i < 8; i++) -+ *buf |= (vmem16[((y*8*WIDTH)+(i*WIDTH))+x] ? 1 : 0) << i; -+ buf++; -+ } -+ /* LCD_PAGE_ADDRESS | ((page) & 0x1F), -+ (((col)+SHIFT_ADDR_NORMAL) & 0x0F), -+ LCD_COL_ADDRESS | ((((col)+SHIFT_ADDR_NORMAL)>>4) & 0x0F) */ -+ write_reg(par, LCD_PAGE_ADDRESS|(u8)y); -+ /* LCD_PAGE_ADDRESS | ((page) & 0x1F), -+ (((col)+SHIFT_ADDR_NORMAL) & 0x0F), -+ LCD_COL_ADDRESS | ((((col)+SHIFT_ADDR_NORMAL)>>4) & 0x0F) */ -+ write_reg(par, 0x00); -+ /* LCD_PAGE_ADDRESS | ((page) & 0x1F), -+ (((col)+SHIFT_ADDR_NORMAL) & 0x0F), -+ LCD_COL_ADDRESS | ((((col)+SHIFT_ADDR_NORMAL)>>4) & 0x0F) */ -+ write_reg(par, LCD_COL_ADDRESS); -+ gpio_set_value(par->gpio.dc, 1); -+ ret = par->fbtftops.write(par, par->txbuf.buf, WIDTH); -+ gpio_set_value(par->gpio.dc, 0); -+ } -+ -+ if (ret < 0) -+ dev_err(par->info->device, "%s: write failed and returned: %d\n", __func__, ret); -+ -+ return ret; -+} -+ -+ -+static struct fbtft_display display = { -+ .regwidth = 8, -+ .width = WIDTH, -+ .height = HEIGHT, -+ .fbtftops = { -+ .init_display = init_display, -+ .set_addr_win = set_addr_win, -+ .write_vmem = write_vmem, -+ }, -+ .backlight = 1, -+}; -+FBTFT_REGISTER_DRIVER(DRVNAME, "UltraChip,uc1701", &display); -+ -+MODULE_ALIAS("spi:" DRVNAME); -+MODULE_ALIAS("spi:uc1701"); -+ -+MODULE_DESCRIPTION("FB driver for the UC1701 LCD Controller"); -+MODULE_AUTHOR("Juergen Holzmann"); -+MODULE_LICENSE("GPL"); -diff --git a/drivers/video/fbtft/fb_upd161704.c b/drivers/video/fbtft/fb_upd161704.c -new file mode 100644 -index 0000000..fff57b3 ---- /dev/null -+++ b/drivers/video/fbtft/fb_upd161704.c -@@ -0,0 +1,206 @@ -+/* -+ * FB driver for the uPD161704 LCD Controller -+ * -+ * Copyright (C) 2014 Seong-Woo Kim -+ * -+ * Based on fb_ili9325.c by Noralf Tronnes -+ * Based on ili9325.c by Jeroen Domburg -+ * Init code from UTFT library by Henning Karlsen -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+ -+#include "fbtft.h" -+ -+#define DRVNAME "fb_upd161704" -+#define WIDTH 240 -+#define HEIGHT 320 -+#define BPP 16 -+ -+static int init_display(struct fbtft_par *par) -+{ -+ fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); -+ -+ par->fbtftops.reset(par); -+ -+ if (par->gpio.cs != -1) -+ gpio_set_value(par->gpio.cs, 0); /* Activate chip */ -+ -+ /* Initialization sequence from Lib_UTFT */ -+ -+ /* register reset */ -+ write_reg(par, 0x0003,0x0001); /* Soft reset */ -+ -+ /* oscillator start */ -+ write_reg(par, 0x003A,0x0001); /*Oscillator 0: stop, 1: operation */ -+ udelay(100); -+ -+ /* y-setting */ -+ write_reg(par, 0x0024,0x007B); /* amplitude setting */ -+ udelay(10); -+ write_reg(par, 0x0025,0x003B); /* amplitude setting */ -+ write_reg(par, 0x0026,0x0034); /* amplitude setting */ -+ udelay(10); -+ write_reg(par, 0x0027,0x0004); /* amplitude setting */ -+ write_reg(par, 0x0052,0x0025); /* circuit setting 1 */ -+ udelay(10); -+ write_reg(par, 0x0053,0x0033); /* circuit setting 2 */ -+ write_reg(par, 0x0061,0x001C); /* adjustment V10 positive polarity */ -+ udelay(10); -+ write_reg(par, 0x0062,0x002C); /* adjustment V9 negative polarity */ -+ write_reg(par, 0x0063,0x0022); /* adjustment V34 positive polarity */ -+ udelay(10); -+ write_reg(par, 0x0064,0x0027); /* adjustment V31 negative polarity */ -+ udelay(10); -+ write_reg(par, 0x0065,0x0014); /* adjustment V61 negative polarity */ -+ udelay(10); -+ write_reg(par, 0x0066,0x0010); /* adjustment V61 negative polarity */ -+ -+ /* Basical clock for 1 line (BASECOUNT[7:0]) number specified */ -+ write_reg(par, 0x002E,0x002D); -+ -+ /* Power supply setting */ -+ write_reg(par, 0x0019,0x0000); /* DC/DC output setting */ -+ udelay(200); -+ write_reg(par, 0x001A,0x1000); /* DC/DC frequency setting */ -+ write_reg(par, 0x001B,0x0023); /* DC/DC rising setting */ -+ write_reg(par, 0x001C,0x0C01); /* Regulator voltage setting */ -+ write_reg(par, 0x001D,0x0000); /* Regulator current setting */ -+ write_reg(par, 0x001E,0x0009); /* VCOM output setting */ -+ write_reg(par, 0x001F,0x0035); /* VCOM amplitude setting */ -+ write_reg(par, 0x0020,0x0015); /* VCOMM cencter setting */ -+ write_reg(par, 0x0018,0x1E7B); /* DC/DC operation setting */ -+ -+ /* windows setting */ -+ write_reg(par, 0x0008,0x0000); /* Minimum X address */ -+ write_reg(par, 0x0009,0x00EF); /* Maximum X address */ -+ write_reg(par, 0x000a,0x0000); /* Minimum Y address */ -+ write_reg(par, 0x000b,0x013F); /* Maximum Y address */ -+ -+ /* LCD display area setting */ -+ write_reg(par, 0x0029,0x0000); /* [LCDSIZE] X MIN. size set */ -+ write_reg(par, 0x002A,0x0000); /* [LCDSIZE] Y MIN. size set */ -+ write_reg(par, 0x002B,0x00EF); /* [LCDSIZE] X MAX. size set */ -+ write_reg(par, 0x002C,0x013F); /* [LCDSIZE] Y MAX. size set */ -+ -+ /* Gate scan setting */ -+ write_reg(par, 0x0032,0x0002); -+ -+ /* n line inversion line number */ -+ write_reg(par, 0x0033,0x0000); -+ -+ /* Line inversion/frame inversion/interlace setting */ -+ write_reg(par, 0x0037,0x0000); -+ -+ /* Gate scan operation setting register */ -+ write_reg(par, 0x003B,0x0001); -+ -+ /* Color mode */ -+ /*GS = 0: 260-k color (64 gray scale), GS = 1: 8 color (2 gray scale) */ -+ write_reg(par, 0x0004,0x0000); -+ -+ /* RAM control register */ -+ write_reg(par, 0x0005,0x0000); /*Window access 00:Normal, 10:Window */ -+ -+ /* Display setting register 2 */ -+ write_reg(par, 0x0001,0x0000); -+ -+ /* display setting */ -+ write_reg(par, 0x0000,0x0000); /* display on */ -+ -+ return 0; -+} -+ -+static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye) -+{ -+ fbtft_par_dbg(DEBUG_SET_ADDR_WIN, par, -+ "%s(xs=%d, ys=%d, xe=%d, ye=%d)\n", __func__, xs, ys, xe, ye); -+ switch (par->info->var.rotate) { -+ /* R20h = Horizontal GRAM Start Address */ -+ /* R21h = Vertical GRAM Start Address */ -+ case 0: -+ write_reg(par, 0x0006, xs); -+ write_reg(par, 0x0007, ys); -+ break; -+ case 180: -+ write_reg(par, 0x0006, WIDTH - 1 - xs); -+ write_reg(par, 0x0007, HEIGHT - 1 - ys); -+ break; -+ case 270: -+ write_reg(par, 0x0006, WIDTH - 1 - ys); -+ write_reg(par, 0x0007, xs); -+ break; -+ case 90: -+ write_reg(par, 0x0006, ys); -+ write_reg(par, 0x0007, HEIGHT - 1 - xs); -+ break; -+ } -+ -+ write_reg(par, 0x0e); /* Write Data to GRAM */ -+} -+ -+static int set_var(struct fbtft_par *par) -+{ -+ fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); -+ -+ switch (par->info->var.rotate) { -+ /* AM: GRAM update direction */ -+ case 0: -+ write_reg(par, 0x01, 0x0000); -+ write_reg(par, 0x05, 0x0000); -+ break; -+ case 180: -+ write_reg(par, 0x01, 0x00C0); -+ write_reg(par, 0x05, 0x0000); -+ break; -+ case 270: -+ write_reg(par, 0x01, 0x0080); -+ write_reg(par, 0x05, 0x0001); -+ break; -+ case 90: -+ write_reg(par, 0x01, 0x0040); -+ write_reg(par, 0x05, 0x0001); -+ break; -+ } -+ -+ return 0; -+} -+ -+static struct fbtft_display display = { -+ .regwidth = 16, -+ .width = WIDTH, -+ .height = HEIGHT, -+ .fbtftops = { -+ .init_display = init_display, -+ .set_addr_win = set_addr_win, -+ .set_var = set_var, -+ }, -+}; -+FBTFT_REGISTER_DRIVER(DRVNAME, "nec,upd161704", &display); -+ -+MODULE_ALIAS("spi:" DRVNAME); -+MODULE_ALIAS("platform:" DRVNAME); -+MODULE_ALIAS("spi:upd161704"); -+MODULE_ALIAS("platform:upd161704"); -+ -+MODULE_DESCRIPTION("FB driver for the uPD161704 LCD Controller"); -+MODULE_AUTHOR("Seong-Woo Kim"); -+MODULE_LICENSE("GPL"); -diff --git a/drivers/video/fbtft/fb_watterott.c b/drivers/video/fbtft/fb_watterott.c -new file mode 100644 -index 0000000..975b579 ---- /dev/null -+++ b/drivers/video/fbtft/fb_watterott.c -@@ -0,0 +1,324 @@ -+/* -+ * FB driver for the Watterott LCD Controller -+ * -+ * Copyright (C) 2013 Noralf Tronnes -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+ -+#include "fbtft.h" -+ -+#define DRVNAME "fb_watterott" -+#define WIDTH 320 -+#define HEIGHT 240 -+#define FPS 5 -+#define TXBUFLEN 1024 -+#define DEFAULT_BRIGHTNESS 50 -+ -+#define CMD_VERSION 0x01 -+#define CMD_LCD_LED 0x10 -+#define CMD_LCD_RESET 0x11 -+#define CMD_LCD_ORIENTATION 0x20 -+#define CMD_LCD_DRAWIMAGE 0x27 -+#define COLOR_RGB323 8 -+#define COLOR_RGB332 9 -+#define COLOR_RGB233 10 -+#define COLOR_RGB565 16 -+ -+ -+static short mode = 565; -+module_param(mode, short, 0); -+MODULE_PARM_DESC(mode, "RGB color transfer mode: 332, 565 (default)"); -+ -+static void write_reg8_bus8(struct fbtft_par *par, int len, ...) -+{ -+ va_list args; -+ int i, ret; -+ u8 *buf = par->buf; -+ -+ va_start(args, len); -+ for (i = 0; i < len; i++) -+ *buf++ = (u8)va_arg(args, unsigned int); -+ va_end(args); -+ -+ fbtft_par_dbg_hex(DEBUG_WRITE_REGISTER, par, -+ par->info->device, u8, par->buf, len, "%s: ", __func__); -+ -+ ret = par->fbtftops.write(par, par->buf, len); -+ if (ret < 0) { -+ dev_err(par->info->device, -+ "%s: write() failed and returned %d\n", __func__, ret); -+ return; -+ } -+} -+ -+static int write_vmem(struct fbtft_par *par, size_t offset, size_t len) -+{ -+ unsigned start_line, end_line; -+ u16 *vmem16 = (u16 *)(par->info->screen_base + offset); -+ u16 *pos = par->txbuf.buf + 1; -+ u16 *buf16 = par->txbuf.buf + 10; -+ int i, j; -+ int ret = 0; -+ -+ fbtft_par_dbg(DEBUG_WRITE_VMEM, par, "%s()\n", __func__); -+ -+ start_line = offset / par->info->fix.line_length; -+ end_line = start_line + (len / par->info->fix.line_length) - 1; -+ -+ /* Set command header. pos: x, y, w, h */ -+ ((u8 *)par->txbuf.buf)[0] = CMD_LCD_DRAWIMAGE; -+ pos[0] = 0; -+ pos[2] = cpu_to_be16(par->info->var.xres); -+ pos[3] = cpu_to_be16(1); -+ ((u8 *)par->txbuf.buf)[9] = COLOR_RGB565; -+ -+ for (i = start_line; i <= end_line; i++) { -+ pos[1] = cpu_to_be16(i); -+ for (j = 0; j < par->info->var.xres; j++) -+ buf16[j] = cpu_to_be16(*vmem16++); -+ ret = par->fbtftops.write(par, -+ par->txbuf.buf, 10 + par->info->fix.line_length); -+ if (ret < 0) -+ return ret; -+ udelay(300); -+ } -+ -+ return 0; -+} -+ -+#define RGB565toRGB323(c) (((c&0xE000)>>8) | ((c&0600)>>6) | ((c&0x001C)>>2)) -+#define RGB565toRGB332(c) (((c&0xE000)>>8) | ((c&0700)>>6) | ((c&0x0018)>>3)) -+#define RGB565toRGB233(c) (((c&0xC000)>>8) | ((c&0700)>>5) | ((c&0x001C)>>2)) -+ -+static int write_vmem_8bit(struct fbtft_par *par, size_t offset, size_t len) -+{ -+ unsigned start_line, end_line; -+ u16 *vmem16 = (u16 *)(par->info->screen_base + offset); -+ u16 *pos = par->txbuf.buf + 1; -+ u8 *buf8 = par->txbuf.buf + 10; -+ int i, j; -+ int ret = 0; -+ -+ fbtft_par_dbg(DEBUG_WRITE_VMEM, par, "%s()\n", __func__); -+ -+ start_line = offset / par->info->fix.line_length; -+ end_line = start_line + (len / par->info->fix.line_length) - 1; -+ -+ /* Set command header. pos: x, y, w, h */ -+ ((u8 *)par->txbuf.buf)[0] = CMD_LCD_DRAWIMAGE; -+ pos[0] = 0; -+ pos[2] = cpu_to_be16(par->info->var.xres); -+ pos[3] = cpu_to_be16(1); -+ ((u8 *)par->txbuf.buf)[9] = COLOR_RGB332; -+ -+ for (i = start_line; i <= end_line; i++) { -+ pos[1] = cpu_to_be16(i); -+ for (j = 0; j < par->info->var.xres; j++) { -+ buf8[j] = RGB565toRGB332(*vmem16); -+ vmem16++; -+ } -+ ret = par->fbtftops.write(par, -+ par->txbuf.buf, 10 + par->info->var.xres); -+ if (ret < 0) -+ return ret; -+ udelay(700); -+ } -+ -+ return 0; -+} -+ -+static unsigned firmware_version(struct fbtft_par *par) -+{ -+ u8 rxbuf[4] = {0, }; -+ -+ write_reg(par, CMD_VERSION); -+ par->fbtftops.read(par, rxbuf, 4); -+ if (rxbuf[1] != '.') -+ return 0; -+ -+ return (rxbuf[0] - '0') << 8 | (rxbuf[2] - '0') << 4 | (rxbuf[3] - '0'); -+} -+ -+static int init_display(struct fbtft_par *par) -+{ -+ int ret; -+ unsigned version; -+ u8 save_mode; -+ -+ fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); -+ -+ /* enable SPI interface by having CS and MOSI low during reset */ -+ save_mode = par->spi->mode; -+ par->spi->mode |= SPI_CS_HIGH; -+ ret = par->spi->master->setup(par->spi); /* set CS inactive low */ -+ if (ret) { -+ dev_err(par->info->device, "Could not set SPI_CS_HIGH\n"); -+ return ret; -+ } -+ write_reg(par, 0x00); /* make sure mode is set */ -+ -+ mdelay(50); -+ par->fbtftops.reset(par); -+ mdelay(1000); -+ par->spi->mode = save_mode; -+ ret = par->spi->master->setup(par->spi); -+ if (ret) { -+ dev_err(par->info->device, "Could not restore SPI mode\n"); -+ return ret; -+ } -+ write_reg(par, 0x00); -+ -+ version = firmware_version(par); -+ fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "Firmware version: %x.%02x\n", -+ version >> 8, version & 0xFF); -+ -+ if (mode == 332) -+ par->fbtftops.write_vmem = write_vmem_8bit; -+ return 0; -+} -+ -+static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye) -+{ -+ /* not used on this controller */ -+} -+ -+static int set_var(struct fbtft_par *par) -+{ -+ u8 rotate; -+ -+ fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); -+ -+ /* this controller rotates clock wise */ -+ switch (par->info->var.rotate) { -+ case 90: -+ rotate = 27; -+ break; -+ case 180: -+ rotate = 18; -+ break; -+ case 270: -+ rotate = 9; -+ break; -+ default: -+ rotate = 0; -+ } -+ write_reg(par, CMD_LCD_ORIENTATION, rotate); -+ -+ return 0; -+} -+ -+static int verify_gpios(struct fbtft_par *par) -+{ -+ if (par->gpio.reset < 0) { -+ dev_err(par->info->device, "Missing 'reset' gpio. Aborting.\n"); -+ return -EINVAL; -+ } -+ return 0; -+} -+ -+#ifdef CONFIG_FB_BACKLIGHT -+static int backlight_chip_update_status(struct backlight_device *bd) -+{ -+ struct fbtft_par *par = bl_get_data(bd); -+ int brightness = bd->props.brightness; -+ -+ fbtft_par_dbg(DEBUG_BACKLIGHT, par, -+ "%s: brightness=%d, power=%d, fb_blank=%d\n", -+ __func__, bd->props.brightness, bd->props.power, -+ bd->props.fb_blank); -+ -+ if (bd->props.power != FB_BLANK_UNBLANK) -+ brightness = 0; -+ -+ if (bd->props.fb_blank != FB_BLANK_UNBLANK) -+ brightness = 0; -+ -+ write_reg(par, CMD_LCD_LED, brightness); -+ -+ return 0; -+} -+ -+static void register_chip_backlight(struct fbtft_par *par) -+{ -+ struct backlight_device *bd; -+ struct backlight_properties bl_props = { 0, }; -+ struct backlight_ops *bl_ops; -+ -+ fbtft_par_dbg(DEBUG_BACKLIGHT, par, "%s()\n", __func__); -+ -+ bl_ops = devm_kzalloc(par->info->device, sizeof(struct backlight_ops), -+ GFP_KERNEL); -+ if (!bl_ops) { -+ dev_err(par->info->device, -+ "%s: could not allocate memory for backlight operations.\n", -+ __func__); -+ return; -+ } -+ -+ bl_ops->update_status = backlight_chip_update_status; -+ bl_props.type = BACKLIGHT_RAW; -+ bl_props.power = FB_BLANK_POWERDOWN; -+ bl_props.max_brightness = 100; -+ bl_props.brightness = DEFAULT_BRIGHTNESS; -+ -+ bd = backlight_device_register(dev_driver_string(par->info->device), -+ par->info->device, par, bl_ops, &bl_props); -+ if (IS_ERR(bd)) { -+ dev_err(par->info->device, -+ "cannot register backlight device (%ld)\n", -+ PTR_ERR(bd)); -+ return; -+ } -+ par->info->bl_dev = bd; -+ -+ if (!par->fbtftops.unregister_backlight) -+ par->fbtftops.unregister_backlight = fbtft_unregister_backlight; -+} -+#else -+#define register_chip_backlight NULL -+#endif -+ -+ -+static struct fbtft_display display = { -+ .regwidth = 8, -+ .buswidth = 8, -+ .width = WIDTH, -+ .height = HEIGHT, -+ .fps = FPS, -+ .txbuflen = TXBUFLEN, -+ .fbtftops = { -+ .write_register = write_reg8_bus8, -+ .write_vmem = write_vmem, -+ .init_display = init_display, -+ .set_addr_win = set_addr_win, -+ .set_var = set_var, -+ .verify_gpios = verify_gpios, -+ .register_backlight = register_chip_backlight, -+ }, -+}; -+FBTFT_REGISTER_DRIVER(DRVNAME, "watterott,openlcd", &display); -+ -+MODULE_ALIAS("spi:" DRVNAME); -+ -+MODULE_DESCRIPTION("FB driver for the Watterott LCD Controller"); -+MODULE_AUTHOR("Noralf Tronnes"); -+MODULE_LICENSE("GPL"); -diff --git a/drivers/video/fbtft/fbtft-bus.c b/drivers/video/fbtft/fbtft-bus.c -new file mode 100644 -index 0000000..b3cddb0 ---- /dev/null -+++ b/drivers/video/fbtft/fbtft-bus.c -@@ -0,0 +1,256 @@ -+#include -+#include -+#include -+#include -+#include "fbtft.h" -+ -+ -+ -+ -+/***************************************************************************** -+ * -+ * void (*write_reg)(struct fbtft_par *par, int len, ...); -+ * -+ *****************************************************************************/ -+ -+#define define_fbtft_write_reg(func, type, modifier) \ -+void func(struct fbtft_par *par, int len, ...) \ -+{ \ -+ va_list args; \ -+ int i, ret; \ -+ int offset = 0; \ -+ type *buf = (type *)par->buf; \ -+ \ -+ if (unlikely(par->debug & DEBUG_WRITE_REGISTER)) { \ -+ va_start(args, len); \ -+ for (i = 0; i < len; i++) { \ -+ buf[i] = (type)va_arg(args, unsigned int); \ -+ } \ -+ va_end(args); \ -+ fbtft_par_dbg_hex(DEBUG_WRITE_REGISTER, par, par->info->device, type, buf, len, "%s: ", __func__); \ -+ } \ -+ \ -+ va_start(args, len); \ -+ \ -+ if (par->startbyte) { \ -+ *(u8 *)par->buf = par->startbyte; \ -+ buf = (type *)(par->buf + 1); \ -+ offset = 1; \ -+ } \ -+ \ -+ *buf = modifier((type)va_arg(args, unsigned int)); \ -+ if (par->gpio.dc != -1) \ -+ gpio_set_value(par->gpio.dc, 0); \ -+ ret = par->fbtftops.write(par, par->buf, sizeof(type)+offset); \ -+ if (ret < 0) { \ -+ va_end(args); \ -+ dev_err(par->info->device, "%s: write() failed and returned %d\n", __func__, ret); \ -+ return; \ -+ } \ -+ len--; \ -+ \ -+ if (par->startbyte) \ -+ *(u8 *)par->buf = par->startbyte | 0x2; \ -+ \ -+ if (len) { \ -+ i = len; \ -+ while (i--) { \ -+ *buf++ = modifier((type)va_arg(args, unsigned int)); \ -+ } \ -+ if (par->gpio.dc != -1) \ -+ gpio_set_value(par->gpio.dc, 1); \ -+ ret = par->fbtftops.write(par, par->buf, len * (sizeof(type)+offset)); \ -+ if (ret < 0) { \ -+ va_end(args); \ -+ dev_err(par->info->device, "%s: write() failed and returned %d\n", __func__, ret); \ -+ return; \ -+ } \ -+ } \ -+ va_end(args); \ -+} \ -+EXPORT_SYMBOL(func); -+ -+define_fbtft_write_reg(fbtft_write_reg8_bus8, u8, ) -+define_fbtft_write_reg(fbtft_write_reg16_bus8, u16, cpu_to_be16) -+define_fbtft_write_reg(fbtft_write_reg16_bus16, u16, ) -+ -+void fbtft_write_reg8_bus9(struct fbtft_par *par, int len, ...) -+{ -+ va_list args; -+ int i, ret; -+ int pad = 0; -+ u16 *buf = (u16 *)par->buf; -+ -+ if (unlikely(par->debug & DEBUG_WRITE_REGISTER)) { -+ va_start(args, len); -+ for (i = 0; i < len; i++) -+ *(((u8 *)buf) + i) = (u8)va_arg(args, unsigned int); -+ va_end(args); -+ fbtft_par_dbg_hex(DEBUG_WRITE_REGISTER, par, -+ par->info->device, u8, buf, len, "%s: ", __func__); -+ } -+ if (len <= 0) -+ return; -+ -+ if (par->spi && (par->spi->bits_per_word == 8)) { -+ /* we're emulating 9-bit, pad start of buffer with no-ops -+ (assuming here that zero is a no-op) */ -+ pad = (len % 4) ? 4 - (len % 4) : 0; -+ for (i = 0; i < pad; i++) -+ *buf++ = 0x000; -+ } -+ -+ va_start(args, len); -+ *buf++ = (u8)va_arg(args, unsigned int); -+ i = len - 1; -+ while (i--) { -+ *buf = (u8)va_arg(args, unsigned int); -+ *buf++ |= 0x100; /* dc=1 */ -+ } -+ va_end(args); -+ ret = par->fbtftops.write(par, par->buf, (len + pad) * sizeof(u16)); -+ if (ret < 0) { -+ dev_err(par->info->device, -+ "%s: write() failed and returned %d\n", __func__, ret); -+ return; -+ } -+} -+EXPORT_SYMBOL(fbtft_write_reg8_bus9); -+ -+ -+ -+ -+/***************************************************************************** -+ * -+ * int (*write_vmem)(struct fbtft_par *par); -+ * -+ *****************************************************************************/ -+ -+/* 16 bit pixel over 8-bit databus */ -+int fbtft_write_vmem16_bus8(struct fbtft_par *par, size_t offset, size_t len) -+{ -+ u16 *vmem16; -+ u16 *txbuf16 = (u16 *)par->txbuf.buf; -+ size_t remain; -+ size_t to_copy; -+ size_t tx_array_size; -+ int i; -+ int ret = 0; -+ size_t startbyte_size = 0; -+ -+ fbtft_par_dbg(DEBUG_WRITE_VMEM, par, "%s(offset=%zu, len=%zu)\n", -+ __func__, offset, len); -+ -+ remain = len / 2; -+ vmem16 = (u16 *)(par->info->screen_base + offset); -+ -+ if (par->gpio.dc != -1) -+ gpio_set_value(par->gpio.dc, 1); -+ -+ /* non buffered write */ -+ if (!par->txbuf.buf) -+ return par->fbtftops.write(par, vmem16, len); -+ -+ /* buffered write */ -+ tx_array_size = par->txbuf.len / 2; -+ -+ if (par->startbyte) { -+ txbuf16 = (u16 *)(par->txbuf.buf + 1); -+ tx_array_size -= 2; -+ *(u8 *)(par->txbuf.buf) = par->startbyte | 0x2; -+ startbyte_size = 1; -+ } -+ -+ while (remain) { -+ to_copy = remain > tx_array_size ? tx_array_size : remain; -+ dev_dbg(par->info->device, " to_copy=%zu, remain=%zu\n", -+ to_copy, remain - to_copy); -+ -+ for (i = 0; i < to_copy; i++) -+ txbuf16[i] = cpu_to_be16(vmem16[i]); -+ -+ vmem16 = vmem16 + to_copy; -+ ret = par->fbtftops.write(par, par->txbuf.buf, -+ startbyte_size + to_copy * 2); -+ if (ret < 0) -+ return ret; -+ remain -= to_copy; -+ } -+ -+ return ret; -+} -+EXPORT_SYMBOL(fbtft_write_vmem16_bus8); -+ -+/* 16 bit pixel over 9-bit SPI bus: dc + high byte, dc + low byte */ -+int fbtft_write_vmem16_bus9(struct fbtft_par *par, size_t offset, size_t len) -+{ -+ u8 *vmem8; -+ u16 *txbuf16 = par->txbuf.buf; -+ size_t remain; -+ size_t to_copy; -+ size_t tx_array_size; -+ int i; -+ int ret = 0; -+ -+ fbtft_par_dbg(DEBUG_WRITE_VMEM, par, "%s(offset=%zu, len=%zu)\n", -+ __func__, offset, len); -+ -+ if (!par->txbuf.buf) { -+ dev_err(par->info->device, "%s: txbuf.buf is NULL\n", __func__); -+ return -1; -+ } -+ -+ remain = len; -+ vmem8 = par->info->screen_base + offset; -+ -+ tx_array_size = par->txbuf.len / 2; -+ -+ while (remain) { -+ to_copy = remain > tx_array_size ? tx_array_size : remain; -+ dev_dbg(par->info->device, " to_copy=%zu, remain=%zu\n", -+ to_copy, remain - to_copy); -+ -+#ifdef __LITTLE_ENDIAN -+ for (i = 0; i < to_copy; i += 2) { -+ txbuf16[i] = 0x0100 | vmem8[i+1]; -+ txbuf16[i+1] = 0x0100 | vmem8[i]; -+ } -+#else -+ for (i = 0; i < to_copy; i++) -+ txbuf16[i] = 0x0100 | vmem8[i]; -+#endif -+ vmem8 = vmem8 + to_copy; -+ ret = par->fbtftops.write(par, par->txbuf.buf, to_copy*2); -+ if (ret < 0) -+ return ret; -+ remain -= to_copy; -+ } -+ -+ return ret; -+} -+EXPORT_SYMBOL(fbtft_write_vmem16_bus9); -+ -+int fbtft_write_vmem8_bus8(struct fbtft_par *par, size_t offset, size_t len) -+{ -+ dev_err(par->info->device, "%s: function not implemented\n", __func__); -+ return -1; -+} -+EXPORT_SYMBOL(fbtft_write_vmem8_bus8); -+ -+/* 16 bit pixel over 16-bit databus */ -+int fbtft_write_vmem16_bus16(struct fbtft_par *par, size_t offset, size_t len) -+{ -+ u16 *vmem16; -+ -+ fbtft_par_dbg(DEBUG_WRITE_VMEM, par, "%s(offset=%zu, len=%zu)\n", -+ __func__, offset, len); -+ -+ vmem16 = (u16 *)(par->info->screen_base + offset); -+ -+ if (par->gpio.dc != -1) -+ gpio_set_value(par->gpio.dc, 1); -+ -+ /* no need for buffered write with 16-bit bus */ -+ return par->fbtftops.write(par, vmem16, len); -+} -+EXPORT_SYMBOL(fbtft_write_vmem16_bus16); -diff --git a/drivers/video/fbtft/fbtft-core.c b/drivers/video/fbtft/fbtft-core.c -new file mode 100644 -index 0000000..873e2c7 ---- /dev/null -+++ b/drivers/video/fbtft/fbtft-core.c -@@ -0,0 +1,1516 @@ -+/* -+ * Copyright (C) 2013 Noralf Tronnes -+ * -+ * This driver is inspired by: -+ * st7735fb.c, Copyright (C) 2011, Matt Porter -+ * broadsheetfb.c, Copyright (C) 2008, Jaya Kumar -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "fbtft.h" -+ -+extern void fbtft_sysfs_init(struct fbtft_par *par); -+extern void fbtft_sysfs_exit(struct fbtft_par *par); -+extern void fbtft_expand_debug_value(unsigned long *debug); -+extern int fbtft_gamma_parse_str(struct fbtft_par *par, unsigned long *curves, -+ const char *str, int size); -+ -+static unsigned long debug; -+module_param(debug, ulong , 0); -+MODULE_PARM_DESC(debug, "override device debug level"); -+ -+static bool dma = true; -+module_param(dma, bool, 0); -+MODULE_PARM_DESC(dma, "Use DMA buffer"); -+ -+ -+void fbtft_dbg_hex(const struct device *dev, int groupsize, -+ void *buf, size_t len, const char *fmt, ...) -+{ -+ va_list args; -+ static char textbuf[512]; -+ char *text = textbuf; -+ size_t text_len; -+ -+ va_start(args, fmt); -+ text_len = vscnprintf(text, sizeof(textbuf), fmt, args); -+ va_end(args); -+ -+ hex_dump_to_buffer(buf, len, 32, groupsize, text + text_len, -+ 512 - text_len, false); -+ -+ if (len > 32) -+ dev_info(dev, "%s ...\n", text); -+ else -+ dev_info(dev, "%s\n", text); -+} -+EXPORT_SYMBOL(fbtft_dbg_hex); -+ -+unsigned long fbtft_request_gpios_match(struct fbtft_par *par, -+ const struct fbtft_gpio *gpio) -+{ -+ int ret; -+ long val; -+ -+ fbtft_par_dbg(DEBUG_REQUEST_GPIOS_MATCH, par, "%s('%s')\n", -+ __func__, gpio->name); -+ -+ if (strcasecmp(gpio->name, "reset") == 0) { -+ par->gpio.reset = gpio->gpio; -+ return GPIOF_OUT_INIT_HIGH; -+ } else if (strcasecmp(gpio->name, "dc") == 0) { -+ par->gpio.dc = gpio->gpio; -+ return GPIOF_OUT_INIT_LOW; -+ } else if (strcasecmp(gpio->name, "cs") == 0) { -+ par->gpio.cs = gpio->gpio; -+ return GPIOF_OUT_INIT_HIGH; -+ } else if (strcasecmp(gpio->name, "wr") == 0) { -+ par->gpio.wr = gpio->gpio; -+ return GPIOF_OUT_INIT_HIGH; -+ } else if (strcasecmp(gpio->name, "rd") == 0) { -+ par->gpio.rd = gpio->gpio; -+ return GPIOF_OUT_INIT_HIGH; -+ } else if (strcasecmp(gpio->name, "latch") == 0) { -+ par->gpio.latch = gpio->gpio; -+ return GPIOF_OUT_INIT_LOW; -+ } else if (gpio->name[0] == 'd' && gpio->name[1] == 'b') { -+ ret = kstrtol(&gpio->name[2], 10, &val); -+ if (ret == 0 && val < 16) { -+ par->gpio.db[val] = gpio->gpio; -+ return GPIOF_OUT_INIT_LOW; -+ } -+ } else if (strcasecmp(gpio->name, "led") == 0) { -+ par->gpio.led[0] = gpio->gpio; -+ return GPIOF_OUT_INIT_LOW; -+ } else if (strcasecmp(gpio->name, "led_") == 0) { -+ par->gpio.led[0] = gpio->gpio; -+ return GPIOF_OUT_INIT_HIGH; -+ } -+ -+ return FBTFT_GPIO_NO_MATCH; -+} -+ -+int fbtft_request_gpios(struct fbtft_par *par) -+{ -+ struct fbtft_platform_data *pdata = par->pdata; -+ const struct fbtft_gpio *gpio; -+ unsigned long flags; -+ int ret; -+ -+ if (pdata && pdata->gpios) { -+ gpio = pdata->gpios; -+ while (gpio->name[0]) { -+ flags = FBTFT_GPIO_NO_MATCH; -+ /* if driver provides match function, try it first, -+ if no match use our own */ -+ if (par->fbtftops.request_gpios_match) -+ flags = par->fbtftops.request_gpios_match(par, gpio); -+ if (flags == FBTFT_GPIO_NO_MATCH) -+ flags = fbtft_request_gpios_match(par, gpio); -+ if (flags != FBTFT_GPIO_NO_MATCH) { -+ ret = devm_gpio_request_one(par->info->device, -+ gpio->gpio, flags, -+ par->info->device->driver->name); -+ if (ret < 0) { -+ dev_err(par->info->device, -+ "%s: gpio_request_one('%s'=%d) failed with %d\n", -+ __func__, gpio->name, -+ gpio->gpio, ret); -+ return ret; -+ } -+ fbtft_par_dbg(DEBUG_REQUEST_GPIOS, par, -+ "%s: '%s' = GPIO%d\n", -+ __func__, gpio->name, gpio->gpio); -+ } -+ gpio++; -+ } -+ } -+ -+ return 0; -+} -+ -+#ifdef CONFIG_OF -+static int fbtft_request_one_gpio(struct fbtft_par *par, -+ const char *name, int index, int *gpiop) -+{ -+ struct device *dev = par->info->device; -+ struct device_node *node = dev->of_node; -+ int gpio, flags, ret = 0; -+ enum of_gpio_flags of_flags; -+ -+ if (of_find_property(node, name, NULL)) { -+ gpio = of_get_named_gpio_flags(node, name, index, &of_flags); -+ if (gpio == -ENOENT) -+ return 0; -+ if (gpio == -EPROBE_DEFER) -+ return gpio; -+ if (gpio < 0) { -+ dev_err(dev, -+ "failed to get '%s' from DT\n", name); -+ return gpio; -+ } -+ -+ /* active low translates to initially low */ -+ flags = (of_flags & OF_GPIO_ACTIVE_LOW) ? GPIOF_OUT_INIT_LOW : -+ GPIOF_OUT_INIT_HIGH; -+ ret = devm_gpio_request_one(dev, gpio, flags, -+ dev->driver->name); -+ if (ret) { -+ dev_err(dev, -+ "gpio_request_one('%s'=%d) failed with %d\n", -+ name, gpio, ret); -+ return ret; -+ } -+ if (gpiop) -+ *gpiop = gpio; -+ fbtft_par_dbg(DEBUG_REQUEST_GPIOS, par, "%s: '%s' = GPIO%d\n", -+ __func__, name, gpio); -+ } -+ -+ return ret; -+} -+ -+static int fbtft_request_gpios_dt(struct fbtft_par *par) -+{ -+ int i; -+ int ret; -+ -+ if (!par->info->device->of_node) -+ return -EINVAL; -+ -+ ret = fbtft_request_one_gpio(par, "reset-gpios", 0, &par->gpio.reset); -+ if (ret) -+ return ret; -+ ret = fbtft_request_one_gpio(par, "dc-gpios", 0, &par->gpio.dc); -+ if (ret) -+ return ret; -+ ret = fbtft_request_one_gpio(par, "rd-gpios", 0, &par->gpio.rd); -+ if (ret) -+ return ret; -+ ret = fbtft_request_one_gpio(par, "wr-gpios", 0, &par->gpio.wr); -+ if (ret) -+ return ret; -+ ret = fbtft_request_one_gpio(par, "cs-gpios", 0, &par->gpio.cs); -+ if (ret) -+ return ret; -+ ret = fbtft_request_one_gpio(par, "latch-gpios", 0, &par->gpio.latch); -+ if (ret) -+ return ret; -+ for (i = 0; i < 16; i++) { -+ ret = fbtft_request_one_gpio(par, "db-gpios", i, -+ &par->gpio.db[i]); -+ if (ret) -+ return ret; -+ ret = fbtft_request_one_gpio(par, "led-gpios", i, -+ &par->gpio.led[i]); -+ if (ret) -+ return ret; -+ ret = fbtft_request_one_gpio(par, "aux-gpios", i, -+ &par->gpio.aux[i]); -+ if (ret) -+ return ret; -+ } -+ -+ return 0; -+} -+#endif -+ -+#ifdef CONFIG_FB_BACKLIGHT -+int fbtft_backlight_update_status(struct backlight_device *bd) -+{ -+ struct fbtft_par *par = bl_get_data(bd); -+ bool polarity = !!(bd->props.state & BL_CORE_DRIVER1); -+ -+ fbtft_par_dbg(DEBUG_BACKLIGHT, par, -+ "%s: polarity=%d, power=%d, fb_blank=%d\n", -+ __func__, polarity, bd->props.power, bd->props.fb_blank); -+ -+ if ((bd->props.power == FB_BLANK_UNBLANK) && (bd->props.fb_blank == FB_BLANK_UNBLANK)) -+ gpio_set_value(par->gpio.led[0], polarity); -+ else -+ gpio_set_value(par->gpio.led[0], !polarity); -+ -+ return 0; -+} -+ -+int fbtft_backlight_get_brightness(struct backlight_device *bd) -+{ -+ return bd->props.brightness; -+} -+ -+void fbtft_unregister_backlight(struct fbtft_par *par) -+{ -+ const struct backlight_ops *bl_ops; -+ -+ fbtft_par_dbg(DEBUG_BACKLIGHT, par, "%s()\n", __func__); -+ -+ if (par->info->bl_dev) { -+ par->info->bl_dev->props.power = FB_BLANK_POWERDOWN; -+ backlight_update_status(par->info->bl_dev); -+ bl_ops = par->info->bl_dev->ops; -+ backlight_device_unregister(par->info->bl_dev); -+ par->info->bl_dev = NULL; -+ } -+} -+ -+void fbtft_register_backlight(struct fbtft_par *par) -+{ -+ struct backlight_device *bd; -+ struct backlight_properties bl_props = { 0, }; -+ struct backlight_ops *bl_ops; -+ -+ fbtft_par_dbg(DEBUG_BACKLIGHT, par, "%s()\n", __func__); -+ -+ if (par->gpio.led[0] == -1) { -+ fbtft_par_dbg(DEBUG_BACKLIGHT, par, -+ "%s(): led pin not set, exiting.\n", __func__); -+ return; -+ } -+ -+ bl_ops = devm_kzalloc(par->info->device, sizeof(struct backlight_ops), -+ GFP_KERNEL); -+ if (!bl_ops) { -+ dev_err(par->info->device, -+ "%s: could not allocate memeory for backlight operations.\n", -+ __func__); -+ return; -+ } -+ -+ bl_ops->get_brightness = fbtft_backlight_get_brightness; -+ bl_ops->update_status = fbtft_backlight_update_status; -+ bl_props.type = BACKLIGHT_RAW; -+ /* Assume backlight is off, get polarity from current state of pin */ -+ bl_props.power = FB_BLANK_POWERDOWN; -+ if (!gpio_get_value(par->gpio.led[0])) -+ bl_props.state |= BL_CORE_DRIVER1; -+ -+ bd = backlight_device_register(dev_driver_string(par->info->device), -+ par->info->device, par, bl_ops, &bl_props); -+ if (IS_ERR(bd)) { -+ dev_err(par->info->device, -+ "cannot register backlight device (%ld)\n", -+ PTR_ERR(bd)); -+ return; -+ } -+ par->info->bl_dev = bd; -+ -+ if (!par->fbtftops.unregister_backlight) -+ par->fbtftops.unregister_backlight = fbtft_unregister_backlight; -+} -+#else -+void fbtft_register_backlight(struct fbtft_par *par) { }; -+void fbtft_unregister_backlight(struct fbtft_par *par) { }; -+#endif -+EXPORT_SYMBOL(fbtft_register_backlight); -+EXPORT_SYMBOL(fbtft_unregister_backlight); -+ -+void fbtft_set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye) -+{ -+ fbtft_par_dbg(DEBUG_SET_ADDR_WIN, par, -+ "%s(xs=%d, ys=%d, xe=%d, ye=%d)\n", __func__, xs, ys, xe, ye); -+ -+ /* Column address set */ -+ write_reg(par, 0x2A, -+ (xs >> 8) & 0xFF, xs & 0xFF, (xe >> 8) & 0xFF, xe & 0xFF); -+ -+ /* Row adress set */ -+ write_reg(par, 0x2B, -+ (ys >> 8) & 0xFF, ys & 0xFF, (ye >> 8) & 0xFF, ye & 0xFF); -+ -+ /* Memory write */ -+ write_reg(par, 0x2C); -+} -+ -+ -+void fbtft_reset(struct fbtft_par *par) -+{ -+ if (par->gpio.reset == -1) -+ return; -+ fbtft_par_dbg(DEBUG_RESET, par, "%s()\n", __func__); -+ gpio_set_value(par->gpio.reset, 0); -+ udelay(20); -+ gpio_set_value(par->gpio.reset, 1); -+ mdelay(120); -+} -+ -+ -+void fbtft_update_display(struct fbtft_par *par, unsigned start_line, unsigned end_line) -+{ -+ size_t offset, len; -+ struct timespec ts_start, ts_end, ts_fps, ts_duration; -+ long fps_ms, fps_us, duration_ms, duration_us; -+ long fps, throughput; -+ bool timeit = false; -+ int ret = 0; -+ -+ if (unlikely(par->debug & (DEBUG_TIME_FIRST_UPDATE | DEBUG_TIME_EACH_UPDATE))) { -+ if ((par->debug & DEBUG_TIME_EACH_UPDATE) || \ -+ ((par->debug & DEBUG_TIME_FIRST_UPDATE) && !par->first_update_done)) { -+ getnstimeofday(&ts_start); -+ timeit = true; -+ } -+ } -+ -+ /* Sanity checks */ -+ if (start_line > end_line) { -+ dev_warn(par->info->device, -+ "%s: start_line=%u is larger than end_line=%u. Shouldn't happen, will do full display update\n", -+ __func__, start_line, end_line); -+ start_line = 0; -+ end_line = par->info->var.yres - 1; -+ } -+ if (start_line > par->info->var.yres - 1 || end_line > par->info->var.yres - 1) { -+ dev_warn(par->info->device, -+ "%s: start_line=%u or end_line=%u is larger than max=%d. Shouldn't happen, will do full display update\n", -+ __func__, start_line, end_line, par->info->var.yres - 1); -+ start_line = 0; -+ end_line = par->info->var.yres - 1; -+ } -+ -+ fbtft_par_dbg(DEBUG_UPDATE_DISPLAY, par, "%s(start_line=%u, end_line=%u)\n", -+ __func__, start_line, end_line); -+ -+ if (par->fbtftops.set_addr_win) -+ par->fbtftops.set_addr_win(par, 0, start_line, -+ par->info->var.xres-1, end_line); -+ -+ offset = start_line * par->info->fix.line_length; -+ len = (end_line - start_line + 1) * par->info->fix.line_length; -+ ret = par->fbtftops.write_vmem(par, offset, len); -+ if (ret < 0) -+ dev_err(par->info->device, -+ "%s: write_vmem failed to update display buffer\n", -+ __func__); -+ -+ if (unlikely(timeit)) { -+ getnstimeofday(&ts_end); -+ if (par->update_time.tv_nsec == 0 && par->update_time.tv_sec == 0) { -+ par->update_time.tv_sec = ts_start.tv_sec; -+ par->update_time.tv_nsec = ts_start.tv_nsec; -+ } -+ ts_fps = timespec_sub(ts_start, par->update_time); -+ par->update_time.tv_sec = ts_start.tv_sec; -+ par->update_time.tv_nsec = ts_start.tv_nsec; -+ fps_ms = (ts_fps.tv_sec * 1000) + ((ts_fps.tv_nsec / 1000000) % 1000); -+ fps_us = (ts_fps.tv_nsec / 1000) % 1000; -+ fps = fps_ms * 1000 + fps_us; -+ fps = fps ? 1000000 / fps : 0; -+ -+ ts_duration = timespec_sub(ts_end, ts_start); -+ duration_ms = (ts_duration.tv_sec * 1000) + ((ts_duration.tv_nsec / 1000000) % 1000); -+ duration_us = (ts_duration.tv_nsec / 1000) % 1000; -+ throughput = duration_ms * 1000 + duration_us; -+ throughput = throughput ? (len * 1000) / throughput : 0; -+ throughput = throughput * 1000 / 1024; -+ -+ dev_info(par->info->device, -+ "Display update: %ld kB/s (%ld.%.3ld ms), fps=%ld (%ld.%.3ld ms)\n", -+ throughput, duration_ms, duration_us, -+ fps, fps_ms, fps_us); -+ par->first_update_done = true; -+ } -+} -+ -+ -+void fbtft_mkdirty(struct fb_info *info, int y, int height) -+{ -+ struct fbtft_par *par = info->par; -+ struct fb_deferred_io *fbdefio = info->fbdefio; -+ -+ /* special case, needed ? */ -+ if (y == -1) { -+ y = 0; -+ height = info->var.yres - 1; -+ } -+ -+ /* Mark display lines/area as dirty */ -+ spin_lock(&par->dirty_lock); -+ if (y < par->dirty_lines_start) -+ par->dirty_lines_start = y; -+ if (y + height - 1 > par->dirty_lines_end) -+ par->dirty_lines_end = y + height - 1; -+ spin_unlock(&par->dirty_lock); -+ -+ /* Schedule deferred_io to update display (no-op if already on queue)*/ -+ schedule_delayed_work(&info->deferred_work, fbdefio->delay); -+} -+ -+void fbtft_deferred_io(struct fb_info *info, struct list_head *pagelist) -+{ -+ struct fbtft_par *par = info->par; -+ unsigned dirty_lines_start, dirty_lines_end; -+ struct page *page; -+ unsigned long index; -+ unsigned y_low = 0, y_high = 0; -+ int count = 0; -+ -+ spin_lock(&par->dirty_lock); -+ dirty_lines_start = par->dirty_lines_start; -+ dirty_lines_end = par->dirty_lines_end; -+ /* set display line markers as clean */ -+ par->dirty_lines_start = par->info->var.yres - 1; -+ par->dirty_lines_end = 0; -+ spin_unlock(&par->dirty_lock); -+ -+ /* Mark display lines as dirty */ -+ list_for_each_entry(page, pagelist, lru) { -+ count++; -+ index = page->index << PAGE_SHIFT; -+ y_low = index / info->fix.line_length; -+ y_high = (index + PAGE_SIZE - 1) / info->fix.line_length; -+ fbtft_dev_dbg(DEBUG_DEFERRED_IO, par, info->device, -+ "page->index=%lu y_low=%d y_high=%d\n", -+ page->index, y_low, y_high); -+ if (y_high > info->var.yres - 1) -+ y_high = info->var.yres - 1; -+ if (y_low < dirty_lines_start) -+ dirty_lines_start = y_low; -+ if (y_high > dirty_lines_end) -+ dirty_lines_end = y_high; -+ } -+ -+ par->fbtftops.update_display(info->par, -+ dirty_lines_start, dirty_lines_end); -+} -+ -+ -+void fbtft_fb_fillrect(struct fb_info *info, const struct fb_fillrect *rect) -+{ -+ struct fbtft_par *par = info->par; -+ -+ fbtft_dev_dbg(DEBUG_FB_FILLRECT, par, info->dev, -+ "%s: dx=%d, dy=%d, width=%d, height=%d\n", -+ __func__, rect->dx, rect->dy, rect->width, rect->height); -+ sys_fillrect(info, rect); -+ -+ par->fbtftops.mkdirty(info, rect->dy, rect->height); -+} -+ -+void fbtft_fb_copyarea(struct fb_info *info, const struct fb_copyarea *area) -+{ -+ struct fbtft_par *par = info->par; -+ -+ fbtft_dev_dbg(DEBUG_FB_COPYAREA, par, info->dev, -+ "%s: dx=%d, dy=%d, width=%d, height=%d\n", -+ __func__, area->dx, area->dy, area->width, area->height); -+ sys_copyarea(info, area); -+ -+ par->fbtftops.mkdirty(info, area->dy, area->height); -+} -+ -+void fbtft_fb_imageblit(struct fb_info *info, const struct fb_image *image) -+{ -+ struct fbtft_par *par = info->par; -+ -+ fbtft_dev_dbg(DEBUG_FB_IMAGEBLIT, par, info->dev, -+ "%s: dx=%d, dy=%d, width=%d, height=%d\n", -+ __func__, image->dx, image->dy, image->width, image->height); -+ sys_imageblit(info, image); -+ -+ par->fbtftops.mkdirty(info, image->dy, image->height); -+} -+ -+ssize_t fbtft_fb_write(struct fb_info *info, -+ const char __user *buf, size_t count, loff_t *ppos) -+{ -+ struct fbtft_par *par = info->par; -+ ssize_t res; -+ -+ fbtft_dev_dbg(DEBUG_FB_WRITE, par, info->dev, -+ "%s: count=%zd, ppos=%llu\n", __func__, count, *ppos); -+ res = fb_sys_write(info, buf, count, ppos); -+ -+ /* TODO: only mark changed area -+ update all for now */ -+ par->fbtftops.mkdirty(info, -1, 0); -+ -+ return res; -+} -+ -+/* from pxafb.c */ -+unsigned int chan_to_field(unsigned chan, struct fb_bitfield *bf) -+{ -+ chan &= 0xffff; -+ chan >>= 16 - bf->length; -+ return chan << bf->offset; -+} -+ -+int fbtft_fb_setcolreg(unsigned regno, -+ unsigned red, unsigned green, unsigned blue, -+ unsigned transp, struct fb_info *info) -+{ -+ struct fbtft_par *par = info->par; -+ unsigned val; -+ int ret = 1; -+ -+ fbtft_dev_dbg(DEBUG_FB_SETCOLREG, par, info->dev, -+ "%s(regno=%u, red=0x%X, green=0x%X, blue=0x%X, trans=0x%X)\n", -+ __func__, regno, red, green, blue, transp); -+ -+ switch (info->fix.visual) { -+ case FB_VISUAL_TRUECOLOR: -+ if (regno < 16) { -+ u32 *pal = info->pseudo_palette; -+ -+ val = chan_to_field(red, &info->var.red); -+ val |= chan_to_field(green, &info->var.green); -+ val |= chan_to_field(blue, &info->var.blue); -+ -+ pal[regno] = val; -+ ret = 0; -+ } -+ break; -+ -+ } -+ return ret; -+} -+ -+int fbtft_fb_blank(int blank, struct fb_info *info) -+{ -+ struct fbtft_par *par = info->par; -+ int ret = -EINVAL; -+ -+ fbtft_dev_dbg(DEBUG_FB_BLANK, par, info->dev, "%s(blank=%d)\n", -+ __func__, blank); -+ -+ if (!par->fbtftops.blank) -+ return ret; -+ -+ switch (blank) { -+ case FB_BLANK_POWERDOWN: -+ case FB_BLANK_VSYNC_SUSPEND: -+ case FB_BLANK_HSYNC_SUSPEND: -+ case FB_BLANK_NORMAL: -+ ret = par->fbtftops.blank(par, true); -+ break; -+ case FB_BLANK_UNBLANK: -+ ret = par->fbtftops.blank(par, false); -+ break; -+ } -+ return ret; -+} -+ -+void fbtft_merge_fbtftops(struct fbtft_ops *dst, struct fbtft_ops *src) -+{ -+ if (src->write) -+ dst->write = src->write; -+ if (src->read) -+ dst->read = src->read; -+ if (src->write_vmem) -+ dst->write_vmem = src->write_vmem; -+ if (src->write_register) -+ dst->write_register = src->write_register; -+ if (src->set_addr_win) -+ dst->set_addr_win = src->set_addr_win; -+ if (src->reset) -+ dst->reset = src->reset; -+ if (src->mkdirty) -+ dst->mkdirty = src->mkdirty; -+ if (src->update_display) -+ dst->update_display = src->update_display; -+ if (src->init_display) -+ dst->init_display = src->init_display; -+ if (src->blank) -+ dst->blank = src->blank; -+ if (src->request_gpios_match) -+ dst->request_gpios_match = src->request_gpios_match; -+ if (src->request_gpios) -+ dst->request_gpios = src->request_gpios; -+ if (src->verify_gpios) -+ dst->verify_gpios = src->verify_gpios; -+ if (src->register_backlight) -+ dst->register_backlight = src->register_backlight; -+ if (src->unregister_backlight) -+ dst->unregister_backlight = src->unregister_backlight; -+ if (src->set_var) -+ dst->set_var = src->set_var; -+ if (src->set_gamma) -+ dst->set_gamma = src->set_gamma; -+} -+ -+/** -+ * fbtft_framebuffer_alloc - creates a new frame buffer info structure -+ * -+ * @display: pointer to structure describing the display -+ * @dev: pointer to the device for this fb, this can be NULL -+ * -+ * Creates a new frame buffer info structure. -+ * -+ * Also creates and populates the following structures: -+ * info->fbops -+ * info->fbdefio -+ * info->pseudo_palette -+ * par->fbtftops -+ * par->txbuf -+ * -+ * Returns the new structure, or NULL if an error occurred. -+ * -+ */ -+struct fb_info *fbtft_framebuffer_alloc(struct fbtft_display *display, -+ struct device *dev) -+{ -+ struct fb_info *info; -+ struct fbtft_par *par; -+ struct fb_ops *fbops = NULL; -+ struct fb_deferred_io *fbdefio = NULL; -+ struct fbtft_platform_data *pdata = dev->platform_data; -+ u8 *vmem = NULL; -+ void *txbuf = NULL; -+ void *buf = NULL; -+ unsigned width; -+ unsigned height; -+ int txbuflen = display->txbuflen; -+ unsigned bpp = display->bpp; -+ unsigned fps = display->fps; -+ int vmem_size, i; -+ int *init_sequence = display->init_sequence; -+ char *gamma = display->gamma; -+ unsigned long *gamma_curves = NULL; -+ -+ /* sanity check */ -+ if (display->gamma_num * display->gamma_len > FBTFT_GAMMA_MAX_VALUES_TOTAL) { -+ dev_err(dev, -+ "%s: FBTFT_GAMMA_MAX_VALUES_TOTAL=%d is exceeded\n", -+ __func__, FBTFT_GAMMA_MAX_VALUES_TOTAL); -+ return NULL; -+ } -+ -+ /* defaults */ -+ if (!fps) -+ fps = 20; -+ if (!bpp) -+ bpp = 16; -+ -+ if (!pdata) { -+ dev_err(dev, "platform data is missing\n"); -+ return NULL; -+ } -+ -+ /* override driver values? */ -+ if (pdata->fps) -+ fps = pdata->fps; -+ if (pdata->txbuflen) -+ txbuflen = pdata->txbuflen; -+ if (pdata->display.init_sequence) -+ init_sequence = pdata->display.init_sequence; -+ if (pdata->gamma) -+ gamma = pdata->gamma; -+ if (pdata->display.debug) -+ display->debug = pdata->display.debug; -+ if (pdata->display.backlight) -+ display->backlight = pdata->display.backlight; -+ if (pdata->display.width) -+ display->width = pdata->display.width; -+ if (pdata->display.height) -+ display->height = pdata->display.height; -+ if (pdata->display.buswidth) -+ display->buswidth = pdata->display.buswidth; -+ if (pdata->display.regwidth) -+ display->regwidth = pdata->display.regwidth; -+ -+ display->debug |= debug; -+ fbtft_expand_debug_value(&display->debug); -+ -+ switch (pdata->rotate) { -+ case 90: -+ case 270: -+ width = display->height; -+ height = display->width; -+ break; -+ default: -+ width = display->width; -+ height = display->height; -+ } -+ -+ vmem_size = display->width * display->height * bpp / 8; -+ vmem = vzalloc(vmem_size); -+ if (!vmem) -+ goto alloc_fail; -+ -+ fbops = devm_kzalloc(dev, sizeof(struct fb_ops), GFP_KERNEL); -+ if (!fbops) -+ goto alloc_fail; -+ -+ fbdefio = devm_kzalloc(dev, sizeof(struct fb_deferred_io), GFP_KERNEL); -+ if (!fbdefio) -+ goto alloc_fail; -+ -+ buf = devm_kzalloc(dev, 128, GFP_KERNEL); -+ if (!buf) -+ goto alloc_fail; -+ -+ if (display->gamma_num && display->gamma_len) { -+ gamma_curves = devm_kzalloc(dev, display->gamma_num * display->gamma_len * sizeof(gamma_curves[0]), -+ GFP_KERNEL); -+ if (!gamma_curves) -+ goto alloc_fail; -+ } -+ -+ info = framebuffer_alloc(sizeof(struct fbtft_par), dev); -+ if (!info) -+ goto alloc_fail; -+ -+ info->screen_base = (u8 __force __iomem *)vmem; -+ info->fbops = fbops; -+ info->fbdefio = fbdefio; -+ -+ fbops->owner = dev->driver->owner; -+ fbops->fb_read = fb_sys_read; -+ fbops->fb_write = fbtft_fb_write; -+ fbops->fb_fillrect = fbtft_fb_fillrect; -+ fbops->fb_copyarea = fbtft_fb_copyarea; -+ fbops->fb_imageblit = fbtft_fb_imageblit; -+ fbops->fb_setcolreg = fbtft_fb_setcolreg; -+ fbops->fb_blank = fbtft_fb_blank; -+ -+ fbdefio->delay = HZ/fps; -+ fbdefio->deferred_io = fbtft_deferred_io; -+ fb_deferred_io_init(info); -+ -+ strncpy(info->fix.id, dev->driver->name, 16); -+ info->fix.type = FB_TYPE_PACKED_PIXELS; -+ info->fix.visual = FB_VISUAL_TRUECOLOR; -+ info->fix.xpanstep = 0; -+ info->fix.ypanstep = 0; -+ info->fix.ywrapstep = 0; -+ info->fix.line_length = width*bpp/8; -+ info->fix.accel = FB_ACCEL_NONE; -+ info->fix.smem_len = vmem_size; -+ -+ info->var.rotate = pdata->rotate; -+ info->var.xres = width; -+ info->var.yres = height; -+ info->var.xres_virtual = info->var.xres; -+ info->var.yres_virtual = info->var.yres; -+ info->var.bits_per_pixel = bpp; -+ info->var.nonstd = 1; -+ -+ /* RGB565 */ -+ info->var.red.offset = 11; -+ info->var.red.length = 5; -+ info->var.green.offset = 5; -+ info->var.green.length = 6; -+ info->var.blue.offset = 0; -+ info->var.blue.length = 5; -+ info->var.transp.offset = 0; -+ info->var.transp.length = 0; -+ -+ info->flags = FBINFO_FLAG_DEFAULT | FBINFO_VIRTFB; -+ -+ par = info->par; -+ par->info = info; -+ par->pdata = dev->platform_data; -+ par->debug = display->debug; -+ par->buf = buf; -+ spin_lock_init(&par->dirty_lock); -+ par->bgr = pdata->bgr; -+ par->startbyte = pdata->startbyte; -+ par->init_sequence = init_sequence; -+ par->gamma.curves = gamma_curves; -+ par->gamma.num_curves = display->gamma_num; -+ par->gamma.num_values = display->gamma_len; -+ mutex_init(&par->gamma.lock); -+ info->pseudo_palette = par->pseudo_palette; -+ -+ if (par->gamma.curves && gamma) { -+ if (fbtft_gamma_parse_str(par, -+ par->gamma.curves, gamma, strlen(gamma))) -+ goto alloc_fail; -+ } -+ -+ /* Transmit buffer */ -+ if (txbuflen == -1) -+ txbuflen = vmem_size + 2; /* add in case startbyte is used */ -+ -+#ifdef __LITTLE_ENDIAN -+ if ((!txbuflen) && (bpp > 8)) -+ txbuflen = PAGE_SIZE; /* need buffer for byteswapping */ -+#endif -+ -+ if (txbuflen > 0) { -+ if (dma) { -+ dev->coherent_dma_mask = ~0; -+ txbuf = dmam_alloc_coherent(dev, txbuflen, &par->txbuf.dma, GFP_DMA); -+ } else { -+ txbuf = devm_kzalloc(par->info->device, txbuflen, GFP_KERNEL); -+ } -+ if (!txbuf) -+ goto alloc_fail; -+ par->txbuf.buf = txbuf; -+ par->txbuf.len = txbuflen; -+ } -+ -+ /* Initialize gpios to disabled */ -+ par->gpio.reset = -1; -+ par->gpio.dc = -1; -+ par->gpio.rd = -1; -+ par->gpio.wr = -1; -+ par->gpio.cs = -1; -+ par->gpio.latch = -1; -+ for (i = 0; i < 16; i++) { -+ par->gpio.db[i] = -1; -+ par->gpio.led[i] = -1; -+ par->gpio.aux[i] = -1; -+ } -+ -+ /* default fbtft operations */ -+ par->fbtftops.write = fbtft_write_spi; -+ par->fbtftops.read = fbtft_read_spi; -+ par->fbtftops.write_vmem = fbtft_write_vmem16_bus8; -+ par->fbtftops.write_register = fbtft_write_reg8_bus8; -+ par->fbtftops.set_addr_win = fbtft_set_addr_win; -+ par->fbtftops.reset = fbtft_reset; -+ par->fbtftops.mkdirty = fbtft_mkdirty; -+ par->fbtftops.update_display = fbtft_update_display; -+ par->fbtftops.request_gpios = fbtft_request_gpios; -+ if (display->backlight) -+ par->fbtftops.register_backlight = fbtft_register_backlight; -+ -+ /* use driver provided functions */ -+ fbtft_merge_fbtftops(&par->fbtftops, &display->fbtftops); -+ -+ return info; -+ -+alloc_fail: -+ vfree(vmem); -+ -+ return NULL; -+} -+EXPORT_SYMBOL(fbtft_framebuffer_alloc); -+ -+/** -+ * fbtft_framebuffer_release - frees up all memory used by the framebuffer -+ * -+ * @info: frame buffer info structure -+ * -+ */ -+void fbtft_framebuffer_release(struct fb_info *info) -+{ -+ fb_deferred_io_cleanup(info); -+ vfree(info->screen_base); -+ framebuffer_release(info); -+} -+EXPORT_SYMBOL(fbtft_framebuffer_release); -+ -+/** -+ * fbtft_register_framebuffer - registers a tft frame buffer device -+ * @fb_info: frame buffer info structure -+ * -+ * Sets SPI driverdata if needed -+ * Requests needed gpios. -+ * Initializes display -+ * Updates display. -+ * Registers a frame buffer device @fb_info. -+ * -+ * Returns negative errno on error, or zero for success. -+ * -+ */ -+int fbtft_register_framebuffer(struct fb_info *fb_info) -+{ -+ int ret; -+ char text1[50] = ""; -+ char text2[50] = ""; -+ struct fbtft_par *par = fb_info->par; -+ struct spi_device *spi = par->spi; -+ -+ /* sanity checks */ -+ if (!par->fbtftops.init_display) { -+ dev_err(fb_info->device, "missing fbtftops.init_display()\n"); -+ return -EINVAL; -+ } -+ -+ if (spi) -+ spi_set_drvdata(spi, fb_info); -+ if (par->pdev) -+ platform_set_drvdata(par->pdev, fb_info); -+ -+ ret = par->fbtftops.request_gpios(par); -+ if (ret < 0) -+ goto reg_fail; -+ -+ if (par->fbtftops.verify_gpios) { -+ ret = par->fbtftops.verify_gpios(par); -+ if (ret < 0) -+ goto reg_fail; -+ } -+ -+ ret = par->fbtftops.init_display(par); -+ if (ret < 0) -+ goto reg_fail; -+ if (par->fbtftops.set_var) { -+ ret = par->fbtftops.set_var(par); -+ if (ret < 0) -+ goto reg_fail; -+ } -+ -+ /* update the entire display */ -+ par->fbtftops.update_display(par, 0, par->info->var.yres - 1); -+ -+ if (par->fbtftops.set_gamma && par->gamma.curves) { -+ ret = par->fbtftops.set_gamma(par, par->gamma.curves); -+ if (ret) -+ goto reg_fail; -+ } -+ -+ if (par->fbtftops.register_backlight) -+ par->fbtftops.register_backlight(par); -+ -+ ret = register_framebuffer(fb_info); -+ if (ret < 0) -+ goto reg_fail; -+ -+ fbtft_sysfs_init(par); -+ -+ if (par->txbuf.buf) -+ sprintf(text1, ", %d KiB %sbuffer memory", -+ par->txbuf.len >> 10, par->txbuf.dma ? "DMA " : ""); -+ if (spi) -+ sprintf(text2, ", spi%d.%d at %d MHz", spi->master->bus_num, -+ spi->chip_select, spi->max_speed_hz/1000000); -+ dev_info(fb_info->dev, -+ "%s frame buffer, %dx%d, %d KiB video memory%s, fps=%lu%s\n", -+ fb_info->fix.id, fb_info->var.xres, fb_info->var.yres, -+ fb_info->fix.smem_len >> 10, text1, -+ HZ/fb_info->fbdefio->delay, text2); -+ -+#ifdef CONFIG_FB_BACKLIGHT -+ /* Turn on backlight if available */ -+ if (fb_info->bl_dev) { -+ fb_info->bl_dev->props.power = FB_BLANK_UNBLANK; -+ fb_info->bl_dev->ops->update_status(fb_info->bl_dev); -+ } -+#endif -+ -+ return 0; -+ -+reg_fail: -+ if (par->fbtftops.unregister_backlight) -+ par->fbtftops.unregister_backlight(par); -+ if (spi) -+ spi_set_drvdata(spi, NULL); -+ if (par->pdev) -+ platform_set_drvdata(par->pdev, NULL); -+ -+ return ret; -+} -+EXPORT_SYMBOL(fbtft_register_framebuffer); -+ -+/** -+ * fbtft_unregister_framebuffer - releases a tft frame buffer device -+ * @fb_info: frame buffer info structure -+ * -+ * Frees SPI driverdata if needed -+ * Frees gpios. -+ * Unregisters frame buffer device. -+ * -+ */ -+int fbtft_unregister_framebuffer(struct fb_info *fb_info) -+{ -+ struct fbtft_par *par = fb_info->par; -+ struct spi_device *spi = par->spi; -+ int ret; -+ -+ if (spi) -+ spi_set_drvdata(spi, NULL); -+ if (par->pdev) -+ platform_set_drvdata(par->pdev, NULL); -+ if (par->fbtftops.unregister_backlight) -+ par->fbtftops.unregister_backlight(par); -+ fbtft_sysfs_exit(par); -+ ret = unregister_framebuffer(fb_info); -+ return ret; -+} -+EXPORT_SYMBOL(fbtft_unregister_framebuffer); -+ -+#ifdef CONFIG_OF -+/** -+ * fbtft_init_display_dt() - Device Tree init_display() function -+ * @par: Driver data -+ * -+ * Return: 0 if successful, negative if error -+ */ -+static int fbtft_init_display_dt(struct fbtft_par *par) -+{ -+ struct device_node *node = par->info->device->of_node; -+ struct property *prop; -+ const __be32 *p; -+ u32 val; -+ int buf[64], i, j; -+ char msg[128]; -+ char str[16]; -+ -+ fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); -+ -+ if (!node) -+ return -EINVAL; -+ -+ prop = of_find_property(node, "init", NULL); -+ p = of_prop_next_u32(prop, NULL, &val); -+ if (!p) -+ return -EINVAL; -+ while (p) { -+ if (val & FBTFT_OF_INIT_CMD) { -+ val &= 0xFFFF; -+ i = 0; -+ while (p && !(val & 0xFFFF0000)) { -+ if (i > 63) { -+ dev_err(par->info->device, -+ "%s: Maximum register values exceeded\n", -+ __func__); -+ return -EINVAL; -+ } -+ buf[i++] = val; -+ p = of_prop_next_u32(prop, p, &val); -+ } -+ /* make debug message */ -+ msg[0] = '\0'; -+ for (j = 0; j < i; j++) { -+ snprintf(str, 128, " %02X", buf[j]); -+ strcat(msg, str); -+ } -+ fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, -+ "init: write_register:%s\n", msg); -+ -+ par->fbtftops.write_register(par, i, -+ buf[0], buf[1], buf[2], buf[3], -+ buf[4], buf[5], buf[6], buf[7], -+ buf[8], buf[9], buf[10], buf[11], -+ buf[12], buf[13], buf[14], buf[15], -+ buf[16], buf[17], buf[18], buf[19], -+ buf[20], buf[21], buf[22], buf[23], -+ buf[24], buf[25], buf[26], buf[27], -+ buf[28], buf[29], buf[30], buf[31], -+ buf[32], buf[33], buf[34], buf[35], -+ buf[36], buf[37], buf[38], buf[39], -+ buf[40], buf[41], buf[42], buf[43], -+ buf[44], buf[45], buf[46], buf[47], -+ buf[48], buf[49], buf[50], buf[51], -+ buf[52], buf[53], buf[54], buf[55], -+ buf[56], buf[57], buf[58], buf[59], -+ buf[60], buf[61], buf[62], buf[63]); -+ } else if (val & FBTFT_OF_INIT_DELAY) { -+ fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, -+ "init: msleep(%u)\n", val & 0xFFFF); -+ msleep(val & 0xFFFF); -+ p = of_prop_next_u32(prop, p, &val); -+ } else { -+ dev_err(par->info->device, "illegal init value 0x%X\n", -+ val); -+ return -EINVAL; -+ } -+ } -+ -+ return 0; -+} -+#endif -+ -+/** -+ * fbtft_init_display() - Generic init_display() function -+ * @par: Driver data -+ * -+ * Uses par->init_sequence to do the initialization -+ * -+ * Return: 0 if successful, negative if error -+ */ -+int fbtft_init_display(struct fbtft_par *par) -+{ -+ int buf[64]; -+ char msg[128]; -+ char str[16]; -+ int i = 0; -+ int j; -+ -+ fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__); -+ -+ /* sanity check */ -+ if (!par->init_sequence) { -+ dev_err(par->info->device, -+ "error: init_sequence is not set\n"); -+ return -EINVAL; -+ } -+ -+ /* make sure stop marker exists */ -+ for (i = 0; i < FBTFT_MAX_INIT_SEQUENCE; i++) -+ if (par->init_sequence[i] == -3) -+ break; -+ if (i == FBTFT_MAX_INIT_SEQUENCE) { -+ dev_err(par->info->device, -+ "missing stop marker at end of init sequence\n"); -+ return -EINVAL; -+ } -+ -+ par->fbtftops.reset(par); -+ if (par->gpio.cs != -1) -+ gpio_set_value(par->gpio.cs, 0); /* Activate chip */ -+ -+ i = 0; -+ while (i < FBTFT_MAX_INIT_SEQUENCE) { -+ if (par->init_sequence[i] == -3) { -+ /* done */ -+ return 0; -+ } -+ if (par->init_sequence[i] >= 0) { -+ dev_err(par->info->device, -+ "missing delimiter at position %d\n", i); -+ return -EINVAL; -+ } -+ if (par->init_sequence[i+1] < 0) { -+ dev_err(par->info->device, -+ "missing value after delimiter %d at position %d\n", -+ par->init_sequence[i], i); -+ return -EINVAL; -+ } -+ switch (par->init_sequence[i]) { -+ case -1: -+ i++; -+ /* make debug message */ -+ strcpy(msg, ""); -+ j = i + 1; -+ while (par->init_sequence[j] >= 0) { -+ sprintf(str, "0x%02X ", par->init_sequence[j]); -+ strcat(msg, str); -+ j++; -+ } -+ fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, -+ "init: write(0x%02X) %s\n", -+ par->init_sequence[i], msg); -+ -+ /* Write */ -+ j = 0; -+ while (par->init_sequence[i] >= 0) { -+ if (j > 63) { -+ dev_err(par->info->device, -+ "%s: Maximum register values exceeded\n", -+ __func__); -+ return -EINVAL; -+ } -+ buf[j++] = par->init_sequence[i++]; -+ } -+ par->fbtftops.write_register(par, j, -+ buf[0], buf[1], buf[2], buf[3], -+ buf[4], buf[5], buf[6], buf[7], -+ buf[8], buf[9], buf[10], buf[11], -+ buf[12], buf[13], buf[14], buf[15], -+ buf[16], buf[17], buf[18], buf[19], -+ buf[20], buf[21], buf[22], buf[23], -+ buf[24], buf[25], buf[26], buf[27], -+ buf[28], buf[29], buf[30], buf[31], -+ buf[32], buf[33], buf[34], buf[35], -+ buf[36], buf[37], buf[38], buf[39], -+ buf[40], buf[41], buf[42], buf[43], -+ buf[44], buf[45], buf[46], buf[47], -+ buf[48], buf[49], buf[50], buf[51], -+ buf[52], buf[53], buf[54], buf[55], -+ buf[56], buf[57], buf[58], buf[59], -+ buf[60], buf[61], buf[62], buf[63]); -+ break; -+ case -2: -+ i++; -+ fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, -+ "init: mdelay(%d)\n", par->init_sequence[i]); -+ mdelay(par->init_sequence[i++]); -+ break; -+ default: -+ dev_err(par->info->device, -+ "unknown delimiter %d at position %d\n", -+ par->init_sequence[i], i); -+ return -EINVAL; -+ } -+ } -+ -+ dev_err(par->info->device, -+ "%s: something is wrong. Shouldn't get here.\n", __func__); -+ return -EINVAL; -+} -+EXPORT_SYMBOL(fbtft_init_display); -+ -+/** -+ * fbtft_verify_gpios() - Generic verify_gpios() function -+ * @par: Driver data -+ * -+ * Uses @spi, @pdev and @buswidth to determine which GPIOs is needed -+ * -+ * Return: 0 if successful, negative if error -+ */ -+int fbtft_verify_gpios(struct fbtft_par *par) -+{ -+ struct fbtft_platform_data *pdata; -+ int i; -+ -+ fbtft_par_dbg(DEBUG_VERIFY_GPIOS, par, "%s()\n", __func__); -+ -+ pdata = par->info->device->platform_data; -+ if (pdata->display.buswidth != 9 && par->startbyte == 0 && \ -+ par->gpio.dc < 0) { -+ dev_err(par->info->device, -+ "Missing info about 'dc' gpio. Aborting.\n"); -+ return -EINVAL; -+ } -+ -+ if (!par->pdev) -+ return 0; -+ -+ if (par->gpio.wr < 0) { -+ dev_err(par->info->device, "Missing 'wr' gpio. Aborting.\n"); -+ return -EINVAL; -+ } -+ for (i = 0; i < pdata->display.buswidth; i++) { -+ if (par->gpio.db[i] < 0) { -+ dev_err(par->info->device, -+ "Missing 'db%02d' gpio. Aborting.\n", i); -+ return -EINVAL; -+ } -+ } -+ -+ return 0; -+} -+ -+#ifdef CONFIG_OF -+/* returns 0 if the property is not present */ -+static u32 fbtft_of_value(struct device_node *node, const char *propname) -+{ -+ int ret; -+ u32 val = 0; -+ -+ ret = of_property_read_u32(node, propname, &val); -+ if (ret == 0) -+ pr_info("%s: %s = %u\n", __func__, propname, val); -+ -+ return val; -+} -+ -+static struct fbtft_platform_data *fbtft_probe_dt(struct device *dev) -+{ -+ struct device_node *node = dev->of_node; -+ struct fbtft_platform_data *pdata; -+ -+ if (!node) { -+ dev_err(dev, "Missing platform data or DT\n"); -+ return ERR_PTR(-EINVAL); -+ } -+ -+ pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); -+ if (!pdata) -+ return ERR_PTR(-ENOMEM); -+ -+ pdata->display.width = fbtft_of_value(node, "width"); -+ pdata->display.height = fbtft_of_value(node, "height"); -+ pdata->display.regwidth = fbtft_of_value(node, "regwidth"); -+ pdata->display.buswidth = fbtft_of_value(node, "buswidth"); -+ pdata->display.backlight = fbtft_of_value(node, "backlight"); -+ pdata->display.bpp = fbtft_of_value(node, "bpp"); -+ pdata->display.debug = fbtft_of_value(node, "debug"); -+ pdata->rotate = fbtft_of_value(node, "rotate"); -+ pdata->bgr = of_property_read_bool(node, "bgr"); -+ pdata->fps = fbtft_of_value(node, "fps"); -+ pdata->txbuflen = fbtft_of_value(node, "txbuflen"); -+ pdata->startbyte = fbtft_of_value(node, "startbyte"); -+ of_property_read_string(node, "gamma", (const char **)&pdata->gamma); -+ -+ if (of_find_property(node, "led-gpios", NULL)) -+ pdata->display.backlight = 1; -+ if (of_find_property(node, "init", NULL)) -+ pdata->display.fbtftops.init_display = fbtft_init_display_dt; -+ pdata->display.fbtftops.request_gpios = fbtft_request_gpios_dt; -+ -+ return pdata; -+} -+#else -+static struct fbtft_platform_data *fbtft_probe_dt(struct device *dev) -+{ -+ dev_err(dev, "Missing platform data\n"); -+ return ERR_PTR(-EINVAL); -+} -+#endif -+ -+/** -+ * fbtft_probe_common() - Generic device probe() helper function -+ * @display: Display properties -+ * @sdev: SPI device -+ * @pdev: Platform device -+ * -+ * Allocates, initializes and registers a framebuffer -+ * -+ * Either @sdev or @pdev should be NULL -+ * -+ * Return: 0 if successful, negative if error -+ */ -+int fbtft_probe_common(struct fbtft_display *display, -+ struct spi_device *sdev, struct platform_device *pdev) -+{ -+ struct device *dev; -+ struct fb_info *info; -+ struct fbtft_par *par; -+ struct fbtft_platform_data *pdata; -+ int ret; -+ -+ if (sdev) -+ dev = &sdev->dev; -+ else -+ dev = &pdev->dev; -+ -+ if (unlikely(display->debug & DEBUG_DRIVER_INIT_FUNCTIONS)) -+ dev_info(dev, "%s()\n", __func__); -+ -+ pdata = dev->platform_data; -+ if (!pdata) { -+ pdata = fbtft_probe_dt(dev); -+ if (IS_ERR(pdata)) -+ return PTR_ERR(pdata); -+ dev->platform_data = pdata; -+ } -+ -+ info = fbtft_framebuffer_alloc(display, dev); -+ if (!info) -+ return -ENOMEM; -+ -+ par = info->par; -+ par->spi = sdev; -+ par->pdev = pdev; -+ -+ if (display->buswidth == 0) { -+ dev_err(dev, "buswidth is not set\n"); -+ return -EINVAL; -+ } -+ -+ /* write register functions */ -+ if (display->regwidth == 8 && display->buswidth == 8) { -+ par->fbtftops.write_register = fbtft_write_reg8_bus8; -+ } else -+ if (display->regwidth == 8 && display->buswidth == 9 && par->spi) { -+ par->fbtftops.write_register = fbtft_write_reg8_bus9; -+ } else if (display->regwidth == 16 && display->buswidth == 8) { -+ par->fbtftops.write_register = fbtft_write_reg16_bus8; -+ } else if (display->regwidth == 16 && display->buswidth == 16) { -+ par->fbtftops.write_register = fbtft_write_reg16_bus16; -+ } else { -+ dev_warn(dev, -+ "no default functions for regwidth=%d and buswidth=%d\n", -+ display->regwidth, display->buswidth); -+ } -+ -+ /* write_vmem() functions */ -+ if (display->buswidth == 8) -+ par->fbtftops.write_vmem = fbtft_write_vmem16_bus8; -+ else if (display->buswidth == 9) -+ par->fbtftops.write_vmem = fbtft_write_vmem16_bus9; -+ else if (display->buswidth == 16) -+ par->fbtftops.write_vmem = fbtft_write_vmem16_bus16; -+ -+ /* GPIO write() functions */ -+ if (par->pdev) { -+ if (display->buswidth == 8) -+ par->fbtftops.write = fbtft_write_gpio8_wr; -+ else if (display->buswidth == 16) -+ par->fbtftops.write = fbtft_write_gpio16_wr; -+ } -+ -+ /* 9-bit SPI setup */ -+ if (par->spi && display->buswidth == 9) { -+ par->spi->bits_per_word = 9; -+ ret = par->spi->master->setup(par->spi); -+ if (ret) { -+ dev_warn(&par->spi->dev, -+ "9-bit SPI not available, emulating using 8-bit.\n"); -+ par->spi->bits_per_word = 8; -+ ret = par->spi->master->setup(par->spi); -+ if (ret) -+ goto out_release; -+ /* allocate buffer with room for dc bits */ -+ par->extra = devm_kzalloc(par->info->device, -+ par->txbuf.len + (par->txbuf.len / 8) + 8, -+ GFP_KERNEL); -+ if (!par->extra) { -+ ret = -ENOMEM; -+ goto out_release; -+ } -+ par->fbtftops.write = fbtft_write_spi_emulate_9; -+ } -+ } -+ -+ if (!par->fbtftops.verify_gpios) -+ par->fbtftops.verify_gpios = fbtft_verify_gpios; -+ -+ /* make sure we still use the driver provided functions */ -+ fbtft_merge_fbtftops(&par->fbtftops, &display->fbtftops); -+ -+ /* use init_sequence if provided */ -+ if (par->init_sequence) -+ par->fbtftops.init_display = fbtft_init_display; -+ -+ /* use platform_data provided functions above all */ -+ fbtft_merge_fbtftops(&par->fbtftops, &pdata->display.fbtftops); -+ -+ ret = fbtft_register_framebuffer(info); -+ if (ret < 0) -+ goto out_release; -+ -+ return 0; -+ -+out_release: -+ fbtft_framebuffer_release(info); -+ -+ return ret; -+} -+EXPORT_SYMBOL(fbtft_probe_common); -+ -+/** -+ * fbtft_remove_common() - Generic device remove() helper function -+ * @dev: Device -+ * @info: Framebuffer -+ * -+ * Unregisters and releases the framebuffer -+ * -+ * Return: 0 if successful, negative if error -+ */ -+int fbtft_remove_common(struct device *dev, struct fb_info *info) -+{ -+ struct fbtft_par *par; -+ -+ if (!info) -+ return -EINVAL; -+ par = info->par; -+ if (par) -+ fbtft_par_dbg(DEBUG_DRIVER_INIT_FUNCTIONS, par, -+ "%s()\n", __func__); -+ fbtft_unregister_framebuffer(info); -+ fbtft_framebuffer_release(info); -+ -+ return 0; -+} -+EXPORT_SYMBOL(fbtft_remove_common); -+ -+MODULE_LICENSE("GPL"); -diff --git a/drivers/video/fbtft/fbtft-io.c b/drivers/video/fbtft/fbtft-io.c -new file mode 100644 -index 0000000..dfa2c46 ---- /dev/null -+++ b/drivers/video/fbtft/fbtft-io.c -@@ -0,0 +1,409 @@ -+#include -+#include -+#include -+#include -+#ifdef CONFIG_ARCH_BCM2708 -+#include -+#endif -+#include "fbtft.h" -+ -+int fbtft_write_spi(struct fbtft_par *par, void *buf, size_t len) -+{ -+ struct spi_transfer t = { -+ .tx_buf = buf, -+ .len = len, -+ }; -+ struct spi_message m; -+ -+ fbtft_par_dbg_hex(DEBUG_WRITE, par, par->info->device, u8, buf, len, -+ "%s(len=%d): ", __func__, len); -+ -+ if (!par->spi) { -+ dev_err(par->info->device, -+ "%s: par->spi is unexpectedly NULL\n", __func__); -+ return -1; -+ } -+ -+ spi_message_init(&m); -+ if (par->txbuf.dma && buf == par->txbuf.buf) { -+ t.tx_dma = par->txbuf.dma; -+ m.is_dma_mapped = 1; -+ } -+ spi_message_add_tail(&t, &m); -+ return spi_sync(par->spi, &m); -+} -+EXPORT_SYMBOL(fbtft_write_spi); -+ -+/** -+ * fbtft_write_spi_emulate_9() - write SPI emulating 9-bit -+ * @par: Driver data -+ * @buf: Buffer to write -+ * @len: Length of buffer (must be divisible by 8) -+ * -+ * When 9-bit SPI is not available, this function can be used to emulate that. -+ * par->extra must hold a transformation buffer used for transfer. -+ */ -+int fbtft_write_spi_emulate_9(struct fbtft_par *par, void *buf, size_t len) -+{ -+ u16 *src = buf; -+ u8 *dst = par->extra; -+ size_t size = len / 2; -+ size_t added = 0; -+ int bits, i, j; -+ u64 val, dc, tmp; -+ -+ fbtft_par_dbg_hex(DEBUG_WRITE, par, par->info->device, u8, buf, len, -+ "%s(len=%d): ", __func__, len); -+ -+ if (!par->extra) { -+ dev_err(par->info->device, "%s: error: par->extra is NULL\n", -+ __func__); -+ return -EINVAL; -+ } -+ if ((len % 8) != 0) { -+ dev_err(par->info->device, -+ "%s: error: len=%d must be divisible by 8\n", -+ __func__, len); -+ return -EINVAL; -+ } -+ -+ for (i = 0; i < size; i += 8) { -+ tmp = 0; -+ bits = 63; -+ for (j = 0; j < 7; j++) { -+ dc = (*src & 0x0100) ? 1 : 0; -+ val = *src & 0x00FF; -+ tmp |= dc << bits; -+ bits -= 8; -+ tmp |= val << bits--; -+ src++; -+ } -+ tmp |= ((*src & 0x0100) ? 1 : 0); -+ *(u64 *)dst = cpu_to_be64(tmp); -+ dst += 8; -+ *dst++ = (u8)(*src++ & 0x00FF); -+ added++; -+ } -+ -+ return spi_write(par->spi, par->extra, size + added); -+} -+EXPORT_SYMBOL(fbtft_write_spi_emulate_9); -+ -+int fbtft_read_spi(struct fbtft_par *par, void *buf, size_t len) -+{ -+ int ret; -+ u8 txbuf[32] = { 0, }; -+ struct spi_transfer t = { -+ .speed_hz = 2000000, -+ .rx_buf = buf, -+ .len = len, -+ }; -+ struct spi_message m; -+ -+ if (!par->spi) { -+ dev_err(par->info->device, -+ "%s: par->spi is unexpectedly NULL\n", __func__); -+ return -ENODEV; -+ } -+ -+ if (par->startbyte) { -+ if (len > 32) { -+ dev_err(par->info->device, -+ "%s: len=%d can't be larger than 32 when using 'startbyte'\n", -+ __func__, len); -+ return -EINVAL; -+ } -+ txbuf[0] = par->startbyte | 0x3; -+ t.tx_buf = txbuf; -+ fbtft_par_dbg_hex(DEBUG_READ, par, par->info->device, u8, -+ txbuf, len, "%s(len=%d) txbuf => ", __func__, len); -+ } -+ -+ spi_message_init(&m); -+ spi_message_add_tail(&t, &m); -+ ret = spi_sync(par->spi, &m); -+ fbtft_par_dbg_hex(DEBUG_READ, par, par->info->device, u8, buf, len, -+ "%s(len=%d) buf <= ", __func__, len); -+ -+ return ret; -+} -+EXPORT_SYMBOL(fbtft_read_spi); -+ -+ -+#ifdef CONFIG_ARCH_BCM2708 -+ -+/* -+ * Raspberry Pi -+ * - writing directly to the registers is 40-50% faster than -+ * optimized use of gpiolib -+ */ -+ -+#define GPIOSET(no, ishigh) \ -+do { \ -+ if (ishigh) \ -+ set |= (1 << (no)); \ -+ else \ -+ reset |= (1 << (no)); \ -+} while (0) -+ -+int fbtft_write_gpio8_wr(struct fbtft_par *par, void *buf, size_t len) -+{ -+ unsigned int set = 0; -+ unsigned int reset = 0; -+ u8 data; -+ -+ fbtft_par_dbg_hex(DEBUG_WRITE, par, par->info->device, u8, buf, len, -+ "%s(len=%d): ", __func__, len); -+ -+ while (len--) { -+ data = *(u8 *) buf; -+ buf++; -+ -+ /* Set data */ -+ GPIOSET(par->gpio.db[0], (data&0x01)); -+ GPIOSET(par->gpio.db[1], (data&0x02)); -+ GPIOSET(par->gpio.db[2], (data&0x04)); -+ GPIOSET(par->gpio.db[3], (data&0x08)); -+ GPIOSET(par->gpio.db[4], (data&0x10)); -+ GPIOSET(par->gpio.db[5], (data&0x20)); -+ GPIOSET(par->gpio.db[6], (data&0x40)); -+ GPIOSET(par->gpio.db[7], (data&0x80)); -+ writel(set, __io_address(GPIO_BASE+0x1C)); -+ writel(reset, __io_address(GPIO_BASE+0x28)); -+ -+ /* Pulse /WR low */ -+ writel((1<gpio.wr), __io_address(GPIO_BASE+0x28)); -+ writel(0, __io_address(GPIO_BASE+0x28)); /* used as a delay */ -+ writel((1<gpio.wr), __io_address(GPIO_BASE+0x1C)); -+ -+ set = 0; -+ reset = 0; -+ } -+ -+ return 0; -+} -+EXPORT_SYMBOL(fbtft_write_gpio8_wr); -+ -+int fbtft_write_gpio16_wr(struct fbtft_par *par, void *buf, size_t len) -+{ -+ unsigned int set = 0; -+ unsigned int reset = 0; -+ u16 data; -+ -+ fbtft_par_dbg_hex(DEBUG_WRITE, par, par->info->device, u8, buf, len, -+ "%s(len=%d): ", __func__, len); -+ -+ while (len) { -+ len -= 2; -+ data = *(u16 *) buf; -+ buf += 2; -+ -+ /* Start writing by pulling down /WR */ -+ gpio_set_value(par->gpio.wr, 0); -+ -+ /* Set data */ -+ GPIOSET(par->gpio.db[0], (data&0x0001)); -+ GPIOSET(par->gpio.db[1], (data&0x0002)); -+ GPIOSET(par->gpio.db[2], (data&0x0004)); -+ GPIOSET(par->gpio.db[3], (data&0x0008)); -+ GPIOSET(par->gpio.db[4], (data&0x0010)); -+ GPIOSET(par->gpio.db[5], (data&0x0020)); -+ GPIOSET(par->gpio.db[6], (data&0x0040)); -+ GPIOSET(par->gpio.db[7], (data&0x0080)); -+ -+ GPIOSET(par->gpio.db[8], (data&0x0100)); -+ GPIOSET(par->gpio.db[9], (data&0x0200)); -+ GPIOSET(par->gpio.db[10], (data&0x0400)); -+ GPIOSET(par->gpio.db[11], (data&0x0800)); -+ GPIOSET(par->gpio.db[12], (data&0x1000)); -+ GPIOSET(par->gpio.db[13], (data&0x2000)); -+ GPIOSET(par->gpio.db[14], (data&0x4000)); -+ GPIOSET(par->gpio.db[15], (data&0x8000)); -+ -+ writel(set, __io_address(GPIO_BASE+0x1C)); -+ writel(reset, __io_address(GPIO_BASE+0x28)); -+ -+ /* Pullup /WR */ -+ gpio_set_value(par->gpio.wr, 1); -+ -+ set = 0; -+ reset = 0; -+ } -+ -+ return 0; -+} -+EXPORT_SYMBOL(fbtft_write_gpio16_wr); -+ -+int fbtft_write_gpio16_wr_latched(struct fbtft_par *par, void *buf, size_t len) -+{ -+ unsigned int set = 0; -+ unsigned int reset = 0; -+ u16 data; -+ -+ fbtft_par_dbg_hex(DEBUG_WRITE, par, par->info->device, u8, buf, len, -+ "%s(len=%d): ", __func__, len); -+ -+ while (len) { -+ len -= 2; -+ data = *(u16 *) buf; -+ buf += 2; -+ -+ /* Start writing by pulling down /WR */ -+ gpio_set_value(par->gpio.wr, 0); -+ -+ /* Low byte */ -+ GPIOSET(par->gpio.db[0], (data&0x0001)); -+ GPIOSET(par->gpio.db[1], (data&0x0002)); -+ GPIOSET(par->gpio.db[2], (data&0x0004)); -+ GPIOSET(par->gpio.db[3], (data&0x0008)); -+ GPIOSET(par->gpio.db[4], (data&0x0010)); -+ GPIOSET(par->gpio.db[5], (data&0x0020)); -+ GPIOSET(par->gpio.db[6], (data&0x0040)); -+ GPIOSET(par->gpio.db[7], (data&0x0080)); -+ writel(set, __io_address(GPIO_BASE+0x1C)); -+ writel(reset, __io_address(GPIO_BASE+0x28)); -+ -+ /* Pulse 'latch' high */ -+ gpio_set_value(par->gpio.latch, 1); -+ gpio_set_value(par->gpio.latch, 0); -+ -+ /* High byte */ -+ GPIOSET(par->gpio.db[0], (data&0x0100)); -+ GPIOSET(par->gpio.db[1], (data&0x0200)); -+ GPIOSET(par->gpio.db[2], (data&0x0400)); -+ GPIOSET(par->gpio.db[3], (data&0x0800)); -+ GPIOSET(par->gpio.db[4], (data&0x1000)); -+ GPIOSET(par->gpio.db[5], (data&0x2000)); -+ GPIOSET(par->gpio.db[6], (data&0x4000)); -+ GPIOSET(par->gpio.db[7], (data&0x8000)); -+ writel(set, __io_address(GPIO_BASE+0x1C)); -+ writel(reset, __io_address(GPIO_BASE+0x28)); -+ -+ /* Pullup /WR */ -+ gpio_set_value(par->gpio.wr, 1); -+ -+ set = 0; -+ reset = 0; -+ } -+ -+ return 0; -+} -+EXPORT_SYMBOL(fbtft_write_gpio16_wr_latched); -+ -+#undef GPIOSET -+ -+#else -+ -+/* -+ * Optimized use of gpiolib is twice as fast as no optimization -+ * only one driver can use the optimized version at a time -+ */ -+int fbtft_write_gpio8_wr(struct fbtft_par *par, void *buf, size_t len) -+{ -+ u8 data; -+ int i; -+#ifndef DO_NOT_OPTIMIZE_FBTFT_WRITE_GPIO -+ static u8 prev_data; -+#endif -+ -+ fbtft_par_dbg_hex(DEBUG_WRITE, par, par->info->device, u8, buf, len, -+ "%s(len=%d): ", __func__, len); -+ -+ while (len--) { -+ data = *(u8 *) buf; -+ -+ /* Start writing by pulling down /WR */ -+ gpio_set_value(par->gpio.wr, 0); -+ -+ /* Set data */ -+#ifndef DO_NOT_OPTIMIZE_FBTFT_WRITE_GPIO -+ if (data == prev_data) { -+ gpio_set_value(par->gpio.wr, 0); /* used as delay */ -+ } else { -+ for (i = 0; i < 8; i++) { -+ if ((data & 1) != (prev_data & 1)) -+ gpio_set_value(par->gpio.db[i], -+ (data & 1)); -+ data >>= 1; -+ prev_data >>= 1; -+ } -+ } -+#else -+ for (i = 0; i < 8; i++) { -+ gpio_set_value(par->gpio.db[i], (data & 1)); -+ data >>= 1; -+ } -+#endif -+ -+ /* Pullup /WR */ -+ gpio_set_value(par->gpio.wr, 1); -+ -+#ifndef DO_NOT_OPTIMIZE_FBTFT_WRITE_GPIO -+ prev_data = *(u8 *) buf; -+#endif -+ buf++; -+ } -+ -+ return 0; -+} -+EXPORT_SYMBOL(fbtft_write_gpio8_wr); -+ -+int fbtft_write_gpio16_wr(struct fbtft_par *par, void *buf, size_t len) -+{ -+ u16 data; -+ int i; -+#ifndef DO_NOT_OPTIMIZE_FBTFT_WRITE_GPIO -+ static u16 prev_data; -+#endif -+ -+ fbtft_par_dbg_hex(DEBUG_WRITE, par, par->info->device, u8, buf, len, -+ "%s(len=%d): ", __func__, len); -+ -+ while (len) { -+ data = *(u16 *) buf; -+ -+ /* Start writing by pulling down /WR */ -+ gpio_set_value(par->gpio.wr, 0); -+ -+ /* Set data */ -+#ifndef DO_NOT_OPTIMIZE_FBTFT_WRITE_GPIO -+ if (data == prev_data) { -+ gpio_set_value(par->gpio.wr, 0); /* used as delay */ -+ } else { -+ for (i = 0; i < 16; i++) { -+ if ((data & 1) != (prev_data & 1)) -+ gpio_set_value(par->gpio.db[i], -+ (data & 1)); -+ data >>= 1; -+ prev_data >>= 1; -+ } -+ } -+#else -+ for (i = 0; i < 16; i++) { -+ gpio_set_value(par->gpio.db[i], (data & 1)); -+ data >>= 1; -+ } -+#endif -+ -+ /* Pullup /WR */ -+ gpio_set_value(par->gpio.wr, 1); -+ -+#ifndef DO_NOT_OPTIMIZE_FBTFT_WRITE_GPIO -+ prev_data = *(u16 *) buf; -+#endif -+ buf += 2; -+ len -= 2; -+ } -+ -+ return 0; -+} -+EXPORT_SYMBOL(fbtft_write_gpio16_wr); -+ -+int fbtft_write_gpio16_wr_latched(struct fbtft_par *par, void *buf, size_t len) -+{ -+ dev_err(par->info->device, "%s: function not implemented\n", __func__); -+ return -1; -+} -+EXPORT_SYMBOL(fbtft_write_gpio16_wr_latched); -+ -+#endif /* CONFIG_ARCH_BCM2708 */ -diff --git a/drivers/video/fbtft/fbtft-sysfs.c b/drivers/video/fbtft/fbtft-sysfs.c -new file mode 100644 -index 0000000..45f8de3 ---- /dev/null -+++ b/drivers/video/fbtft/fbtft-sysfs.c -@@ -0,0 +1,222 @@ -+#include "fbtft.h" -+ -+ -+static int get_next_ulong(char **str_p, unsigned long *val, char *sep, int base) -+{ -+ char *p_val; -+ int ret; -+ -+ if (!str_p || !(*str_p)) -+ return -EINVAL; -+ -+ p_val = strsep(str_p, sep); -+ -+ if (!p_val) -+ return -EINVAL; -+ -+ ret = kstrtoul(p_val, base, val); -+ if (ret) -+ return -EINVAL; -+ -+ return 0; -+} -+ -+int fbtft_gamma_parse_str(struct fbtft_par *par, unsigned long *curves, -+ const char *str, int size) -+{ -+ char *str_p, *curve_p = NULL; -+ char *tmp; -+ unsigned long val = 0; -+ int ret = 0; -+ int curve_counter, value_counter; -+ -+ fbtft_par_dbg(DEBUG_SYSFS, par, "%s() str=\n", __func__); -+ -+ if (!str || !curves) -+ return -EINVAL; -+ -+ fbtft_par_dbg(DEBUG_SYSFS, par, "%s\n", str); -+ -+ tmp = kmalloc(size+1, GFP_KERNEL); -+ if (!tmp) -+ return -ENOMEM; -+ memcpy(tmp, str, size+1); -+ -+ /* replace optional separators */ -+ str_p = tmp; -+ while (*str_p) { -+ if (*str_p == ',') -+ *str_p = ' '; -+ if (*str_p == ';') -+ *str_p = '\n'; -+ str_p++; -+ } -+ -+ str_p = strim(tmp); -+ -+ curve_counter = 0; -+ while (str_p) { -+ if (curve_counter == par->gamma.num_curves) { -+ dev_err(par->info->device, "Gamma: Too many curves\n"); -+ ret = -EINVAL; -+ goto out; -+ } -+ curve_p = strsep(&str_p, "\n"); -+ value_counter = 0; -+ while (curve_p) { -+ if (value_counter == par->gamma.num_values) { -+ dev_err(par->info->device, -+ "Gamma: Too many values\n"); -+ ret = -EINVAL; -+ goto out; -+ } -+ ret = get_next_ulong(&curve_p, &val, " ", 16); -+ if (ret) -+ goto out; -+ curves[curve_counter * par->gamma.num_values + value_counter] = val; -+ value_counter++; -+ } -+ if (value_counter != par->gamma.num_values) { -+ dev_err(par->info->device, "Gamma: Too few values\n"); -+ ret = -EINVAL; -+ goto out; -+ } -+ curve_counter++; -+ } -+ if (curve_counter != par->gamma.num_curves) { -+ dev_err(par->info->device, "Gamma: Too few curves\n"); -+ ret = -EINVAL; -+ goto out; -+ } -+ -+out: -+ kfree(tmp); -+ return ret; -+} -+ -+static ssize_t -+sprintf_gamma(struct fbtft_par *par, unsigned long *curves, char *buf) -+{ -+ ssize_t len = 0; -+ unsigned int i, j; -+ -+ mutex_lock(&par->gamma.lock); -+ for (i = 0; i < par->gamma.num_curves; i++) { -+ for (j = 0; j < par->gamma.num_values; j++) -+ len += scnprintf(&buf[len], PAGE_SIZE, -+ "%04lx ", curves[i*par->gamma.num_values + j]); -+ buf[len-1] = '\n'; -+ } -+ mutex_unlock(&par->gamma.lock); -+ -+ return len; -+} -+ -+static ssize_t store_gamma_curve(struct device *device, -+ struct device_attribute *attr, -+ const char *buf, size_t count) -+{ -+ struct fb_info *fb_info = dev_get_drvdata(device); -+ struct fbtft_par *par = fb_info->par; -+ unsigned long tmp_curves[FBTFT_GAMMA_MAX_VALUES_TOTAL]; -+ int ret; -+ -+ ret = fbtft_gamma_parse_str(par, tmp_curves, buf, count); -+ if (ret) -+ return ret; -+ -+ ret = par->fbtftops.set_gamma(par, tmp_curves); -+ if (ret) -+ return ret; -+ -+ mutex_lock(&par->gamma.lock); -+ memcpy(par->gamma.curves, tmp_curves, -+ par->gamma.num_curves * par->gamma.num_values * sizeof(tmp_curves[0])); -+ mutex_unlock(&par->gamma.lock); -+ -+ return count; -+} -+ -+static ssize_t show_gamma_curve(struct device *device, -+ struct device_attribute *attr, char *buf) -+{ -+ struct fb_info *fb_info = dev_get_drvdata(device); -+ struct fbtft_par *par = fb_info->par; -+ -+ return sprintf_gamma(par, par->gamma.curves, buf); -+} -+ -+static struct device_attribute gamma_device_attrs[] = { -+ __ATTR(gamma, 0660, show_gamma_curve, store_gamma_curve), -+}; -+ -+ -+void fbtft_expand_debug_value(unsigned long *debug) -+{ -+ switch (*debug & 0b111) { -+ case 1: -+ *debug |= DEBUG_LEVEL_1; -+ break; -+ case 2: -+ *debug |= DEBUG_LEVEL_2; -+ break; -+ case 3: -+ *debug |= DEBUG_LEVEL_3; -+ break; -+ case 4: -+ *debug |= DEBUG_LEVEL_4; -+ break; -+ case 5: -+ *debug |= DEBUG_LEVEL_5; -+ break; -+ case 6: -+ *debug |= DEBUG_LEVEL_6; -+ break; -+ case 7: -+ *debug = 0xFFFFFFFF; -+ break; -+ } -+} -+ -+static ssize_t store_debug(struct device *device, -+ struct device_attribute *attr, -+ const char *buf, size_t count) -+{ -+ struct fb_info *fb_info = dev_get_drvdata(device); -+ struct fbtft_par *par = fb_info->par; -+ int ret; -+ -+ ret = kstrtoul(buf, 10, &par->debug); -+ if (ret) -+ return ret; -+ fbtft_expand_debug_value(&par->debug); -+ -+ return count; -+} -+ -+static ssize_t show_debug(struct device *device, -+ struct device_attribute *attr, char *buf) -+{ -+ struct fb_info *fb_info = dev_get_drvdata(device); -+ struct fbtft_par *par = fb_info->par; -+ -+ return snprintf(buf, PAGE_SIZE, "%lu\n", par->debug); -+} -+ -+static struct device_attribute debug_device_attr = \ -+ __ATTR(debug, 0660, show_debug, store_debug); -+ -+ -+void fbtft_sysfs_init(struct fbtft_par *par) -+{ -+ device_create_file(par->info->dev, &debug_device_attr); -+ if (par->gamma.curves && par->fbtftops.set_gamma) -+ device_create_file(par->info->dev, &gamma_device_attrs[0]); -+} -+ -+void fbtft_sysfs_exit(struct fbtft_par *par) -+{ -+ device_remove_file(par->info->dev, &debug_device_attr); -+ if (par->gamma.curves && par->fbtftops.set_gamma) -+ device_remove_file(par->info->dev, &gamma_device_attrs[0]); -+} -diff --git a/drivers/video/fbtft/fbtft.h b/drivers/video/fbtft/fbtft.h -new file mode 100644 -index 0000000..0dbf3f9 ---- /dev/null -+++ b/drivers/video/fbtft/fbtft.h -@@ -0,0 +1,447 @@ -+/* -+ * Copyright (C) 2013 Noralf Tronnes -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -+ */ -+ -+#ifndef __LINUX_FBTFT_H -+#define __LINUX_FBTFT_H -+ -+#include -+#include -+#include -+#include -+ -+ -+#define FBTFT_NOP 0x00 -+#define FBTFT_SWRESET 0x01 -+#define FBTFT_RDDID 0x04 -+#define FBTFT_RDDST 0x09 -+#define FBTFT_CASET 0x2A -+#define FBTFT_RASET 0x2B -+#define FBTFT_RAMWR 0x2C -+ -+#define FBTFT_ONBOARD_BACKLIGHT 2 -+ -+#define FBTFT_GPIO_NO_MATCH 0xFFFF -+#define FBTFT_GPIO_NAME_SIZE 32 -+#define FBTFT_MAX_INIT_SEQUENCE 512 -+#define FBTFT_GAMMA_MAX_VALUES_TOTAL 128 -+ -+#define FBTFT_OF_INIT_CMD BIT(24) -+#define FBTFT_OF_INIT_DELAY BIT(25) -+ -+/** -+ * struct fbtft_gpio - Structure that holds one pinname to gpio mapping -+ * @name: pinname (reset, dc, etc.) -+ * @gpio: GPIO number -+ * -+ */ -+struct fbtft_gpio { -+ char name[FBTFT_GPIO_NAME_SIZE]; -+ unsigned gpio; -+}; -+ -+struct fbtft_par; -+ -+/** -+ * struct fbtft_ops - FBTFT operations structure -+ * @write: Writes to interface bus -+ * @read: Reads from interface bus -+ * @write_vmem: Writes video memory to display -+ * @write_reg: Writes to controller register -+ * @set_addr_win: Set the GRAM update window -+ * @reset: Reset the LCD controller -+ * @mkdirty: Marks display lines for update -+ * @update_display: Updates the display -+ * @init_display: Initializes the display -+ * @blank: Blank the display (optional) -+ * @request_gpios_match: Do pinname to gpio matching -+ * @request_gpios: Request gpios from the kernel -+ * @free_gpios: Free previously requested gpios -+ * @verify_gpios: Verify that necessary gpios is present (optional) -+ * @register_backlight: Used to register backlight device (optional) -+ * @unregister_backlight: Unregister backlight device (optional) -+ * @set_var: Configure LCD with values from variables like @rotate and @bgr -+ * (optional) -+ * @set_gamma: Set Gamma curve (optional) -+ * -+ * Most of these operations have default functions assigned to them in -+ * fbtft_framebuffer_alloc() -+ */ -+struct fbtft_ops { -+ int (*write)(struct fbtft_par *par, void *buf, size_t len); -+ int (*read)(struct fbtft_par *par, void *buf, size_t len); -+ int (*write_vmem)(struct fbtft_par *par, size_t offset, size_t len); -+ void (*write_register)(struct fbtft_par *par, int len, ...); -+ -+ void (*set_addr_win)(struct fbtft_par *par, -+ int xs, int ys, int xe, int ye); -+ void (*reset)(struct fbtft_par *par); -+ void (*mkdirty)(struct fb_info *info, int from, int to); -+ void (*update_display)(struct fbtft_par *par, -+ unsigned start_line, unsigned end_line); -+ int (*init_display)(struct fbtft_par *par); -+ int (*blank)(struct fbtft_par *par, bool on); -+ -+ unsigned long (*request_gpios_match)(struct fbtft_par *par, -+ const struct fbtft_gpio *gpio); -+ int (*request_gpios)(struct fbtft_par *par); -+ int (*verify_gpios)(struct fbtft_par *par); -+ -+ void (*register_backlight)(struct fbtft_par *par); -+ void (*unregister_backlight)(struct fbtft_par *par); -+ -+ int (*set_var)(struct fbtft_par *par); -+ int (*set_gamma)(struct fbtft_par *par, unsigned long *curves); -+}; -+ -+/** -+ * struct fbtft_display - Describes the display properties -+ * @width: Width of display in pixels -+ * @height: Height of display in pixels -+ * @regwidth: LCD Controller Register width in bits -+ * @buswidth: Display interface bus width in bits -+ * @backlight: Backlight type. -+ * @fbtftops: FBTFT operations provided by driver or device (platform_data) -+ * @bpp: Bits per pixel -+ * @fps: Frames per second -+ * @txbuflen: Size of transmit buffer -+ * @init_sequence: Pointer to LCD initialization array -+ * @gamma: String representation of Gamma curve(s) -+ * @gamma_num: Number of Gamma curves -+ * @gamma_len: Number of values per Gamma curve -+ * @debug: Initial debug value -+ * -+ * This structure is not stored by FBTFT except for init_sequence. -+ */ -+struct fbtft_display { -+ unsigned width; -+ unsigned height; -+ unsigned regwidth; -+ unsigned buswidth; -+ unsigned backlight; -+ struct fbtft_ops fbtftops; -+ unsigned bpp; -+ unsigned fps; -+ int txbuflen; -+ int *init_sequence; -+ char *gamma; -+ int gamma_num; -+ int gamma_len; -+ unsigned long debug; -+}; -+ -+/** -+ * struct fbtft_platform_data - Passes display specific data to the driver -+ * @display: Display properties -+ * @gpios: Pointer to an array of piname to gpio mappings -+ * @rotate: Display rotation angle -+ * @bgr: LCD Controller BGR bit -+ * @fps: Frames per second (this will go away, use @fps in @fbtft_display) -+ * @txbuflen: Size of transmit buffer -+ * @startbyte: When set, enables use of Startbyte in transfers -+ * @gamma: String representation of Gamma curve(s) -+ * @extra: A way to pass extra info -+ */ -+struct fbtft_platform_data { -+ struct fbtft_display display; -+ const struct fbtft_gpio *gpios; -+ unsigned rotate; -+ bool bgr; -+ unsigned fps; -+ int txbuflen; -+ u8 startbyte; -+ char *gamma; -+ void *extra; -+}; -+ -+/** -+ * struct fbtft_par - Main FBTFT data structure -+ * -+ * This structure holds all relevant data to operate the display -+ * -+ * See sourcefile for documentation since nested structs is not -+ * supported by kernel-doc. -+ * -+ */ -+/* @spi: Set if it is a SPI device -+ * @pdev: Set if it is a platform device -+ * @info: Pointer to framebuffer fb_info structure -+ * @pdata: Pointer to platform data -+ * @ssbuf: Not used -+ * @pseudo_palette: Used by fb_set_colreg() -+ * @txbuf.buf: Transmit buffer -+ * @txbuf.len: Transmit buffer length -+ * @buf: Small buffer used when writing init data over SPI -+ * @startbyte: Used by some controllers when in SPI mode. -+ * Format: 6 bit Device id + RS bit + RW bit -+ * @fbtftops: FBTFT operations provided by driver or device (platform_data) -+ * @dirty_lock: Protects dirty_lines_start and dirty_lines_end -+ * @dirty_lines_start: Where to begin updating display -+ * @dirty_lines_end: Where to end updating display -+ * @gpio.reset: GPIO used to reset display -+ * @gpio.dc: Data/Command signal, also known as RS -+ * @gpio.rd: Read latching signal -+ * @gpio.wr: Write latching signal -+ * @gpio.latch: Bus latch signal, eg. 16->8 bit bus latch -+ * @gpio.cs: LCD Chip Select with parallel interface bus -+ * @gpio.db[16]: Parallel databus -+ * @gpio.led[16]: Led control signals -+ * @gpio.aux[16]: Auxillary signals, not used by core -+ * @init_sequence: Pointer to LCD initialization array -+ * @gamma.lock: Mutex for Gamma curve locking -+ * @gamma.curves: Pointer to Gamma curve array -+ * @gamma.num_values: Number of values per Gamma curve -+ * @gamma.num_curves: Number of Gamma curves -+ * @debug: Pointer to debug value -+ * @current_debug: -+ * @first_update_done: Used to only time the first display update -+ * @update_time: Used to calculate 'fps' in debug output -+ * @bgr: BGR mode/\n -+ * @extra: Extra info needed by driver -+ */ -+struct fbtft_par { -+ struct spi_device *spi; -+ struct platform_device *pdev; -+ struct fb_info *info; -+ struct fbtft_platform_data *pdata; -+ u16 *ssbuf; -+ u32 pseudo_palette[16]; -+ struct { -+ void *buf; -+ dma_addr_t dma; -+ size_t len; -+ } txbuf; -+ u8 *buf; -+ u8 startbyte; -+ struct fbtft_ops fbtftops; -+ spinlock_t dirty_lock; -+ unsigned dirty_lines_start; -+ unsigned dirty_lines_end; -+ struct { -+ int reset; -+ int dc; -+ int rd; -+ int wr; -+ int latch; -+ int cs; -+ int db[16]; -+ int led[16]; -+ int aux[16]; -+ } gpio; -+ int *init_sequence; -+ struct { -+ struct mutex lock; -+ unsigned long *curves; -+ int num_values; -+ int num_curves; -+ } gamma; -+ unsigned long debug; -+ bool first_update_done; -+ struct timespec update_time; -+ bool bgr; -+ void *extra; -+}; -+ -+#define NUMARGS(...) (sizeof((int[]){__VA_ARGS__})/sizeof(int)) -+ -+#define write_reg(par, ...) \ -+do { \ -+ par->fbtftops.write_register(par, NUMARGS(__VA_ARGS__), __VA_ARGS__); \ -+} while (0) -+ -+/* fbtft-core.c */ -+extern void fbtft_dbg_hex(const struct device *dev, -+ int groupsize, void *buf, size_t len, const char *fmt, ...); -+extern struct fb_info *fbtft_framebuffer_alloc(struct fbtft_display *display, -+ struct device *dev); -+extern void fbtft_framebuffer_release(struct fb_info *info); -+extern int fbtft_register_framebuffer(struct fb_info *fb_info); -+extern int fbtft_unregister_framebuffer(struct fb_info *fb_info); -+extern void fbtft_register_backlight(struct fbtft_par *par); -+extern void fbtft_unregister_backlight(struct fbtft_par *par); -+extern int fbtft_init_display(struct fbtft_par *par); -+extern int fbtft_probe_common(struct fbtft_display *display, -+ struct spi_device *sdev, struct platform_device *pdev); -+extern int fbtft_remove_common(struct device *dev, struct fb_info *info); -+ -+/* fbtft-io.c */ -+extern int fbtft_write_spi(struct fbtft_par *par, void *buf, size_t len); -+extern int fbtft_write_spi_emulate_9(struct fbtft_par *par, -+ void *buf, size_t len); -+extern int fbtft_read_spi(struct fbtft_par *par, void *buf, size_t len); -+extern int fbtft_write_gpio8_wr(struct fbtft_par *par, void *buf, size_t len); -+extern int fbtft_write_gpio16_wr(struct fbtft_par *par, void *buf, size_t len); -+extern int fbtft_write_gpio16_wr_latched(struct fbtft_par *par, -+ void *buf, size_t len); -+ -+/* fbtft-bus.c */ -+extern int fbtft_write_vmem8_bus8(struct fbtft_par *par, size_t offset, size_t len); -+extern int fbtft_write_vmem16_bus16(struct fbtft_par *par, size_t offset, size_t len); -+extern int fbtft_write_vmem16_bus8(struct fbtft_par *par, size_t offset, size_t len); -+extern int fbtft_write_vmem16_bus9(struct fbtft_par *par, size_t offset, size_t len); -+extern void fbtft_write_reg8_bus8(struct fbtft_par *par, int len, ...); -+extern void fbtft_write_reg8_bus9(struct fbtft_par *par, int len, ...); -+extern void fbtft_write_reg16_bus8(struct fbtft_par *par, int len, ...); -+extern void fbtft_write_reg16_bus16(struct fbtft_par *par, int len, ...); -+ -+ -+#define FBTFT_REGISTER_DRIVER(_name, _compatible, _display) \ -+ \ -+static int fbtft_driver_probe_spi(struct spi_device *spi) \ -+{ \ -+ return fbtft_probe_common(_display, spi, NULL); \ -+} \ -+ \ -+static int fbtft_driver_remove_spi(struct spi_device *spi) \ -+{ \ -+ struct fb_info *info = spi_get_drvdata(spi); \ -+ \ -+ return fbtft_remove_common(&spi->dev, info); \ -+} \ -+ \ -+static int fbtft_driver_probe_pdev(struct platform_device *pdev) \ -+{ \ -+ return fbtft_probe_common(_display, NULL, pdev); \ -+} \ -+ \ -+static int fbtft_driver_remove_pdev(struct platform_device *pdev) \ -+{ \ -+ struct fb_info *info = platform_get_drvdata(pdev); \ -+ \ -+ return fbtft_remove_common(&pdev->dev, info); \ -+} \ -+ \ -+static const struct of_device_id dt_ids[] = { \ -+ { .compatible = _compatible }, \ -+ {}, \ -+}; \ -+ \ -+MODULE_DEVICE_TABLE(of, dt_ids); \ -+ \ -+ \ -+static struct spi_driver fbtft_driver_spi_driver = { \ -+ .driver = { \ -+ .name = _name, \ -+ .owner = THIS_MODULE, \ -+ .of_match_table = of_match_ptr(dt_ids), \ -+ }, \ -+ .probe = fbtft_driver_probe_spi, \ -+ .remove = fbtft_driver_remove_spi, \ -+}; \ -+ \ -+static struct platform_driver fbtft_driver_platform_driver = { \ -+ .driver = { \ -+ .name = _name, \ -+ .owner = THIS_MODULE, \ -+ .of_match_table = of_match_ptr(dt_ids), \ -+ }, \ -+ .probe = fbtft_driver_probe_pdev, \ -+ .remove = fbtft_driver_remove_pdev, \ -+}; \ -+ \ -+static int __init fbtft_driver_module_init(void) \ -+{ \ -+ int ret; \ -+ \ -+ ret = spi_register_driver(&fbtft_driver_spi_driver); \ -+ if (ret < 0) \ -+ return ret; \ -+ return platform_driver_register(&fbtft_driver_platform_driver); \ -+} \ -+ \ -+static void __exit fbtft_driver_module_exit(void) \ -+{ \ -+ spi_unregister_driver(&fbtft_driver_spi_driver); \ -+ platform_driver_unregister(&fbtft_driver_platform_driver); \ -+} \ -+ \ -+module_init(fbtft_driver_module_init); \ -+module_exit(fbtft_driver_module_exit); -+ -+ -+/* Debug macros */ -+ -+/* shorthand debug levels */ -+#define DEBUG_LEVEL_1 DEBUG_REQUEST_GPIOS -+#define DEBUG_LEVEL_2 (DEBUG_LEVEL_1 | DEBUG_DRIVER_INIT_FUNCTIONS | DEBUG_TIME_FIRST_UPDATE) -+#define DEBUG_LEVEL_3 (DEBUG_LEVEL_2 | DEBUG_RESET | DEBUG_INIT_DISPLAY | DEBUG_BLANK | DEBUG_REQUEST_GPIOS | DEBUG_FREE_GPIOS | DEBUG_VERIFY_GPIOS | DEBUG_BACKLIGHT | DEBUG_SYSFS) -+#define DEBUG_LEVEL_4 (DEBUG_LEVEL_2 | DEBUG_FB_READ | DEBUG_FB_WRITE | DEBUG_FB_FILLRECT | DEBUG_FB_COPYAREA | DEBUG_FB_IMAGEBLIT | DEBUG_FB_BLANK) -+#define DEBUG_LEVEL_5 (DEBUG_LEVEL_3 | DEBUG_UPDATE_DISPLAY) -+#define DEBUG_LEVEL_6 (DEBUG_LEVEL_4 | DEBUG_LEVEL_5) -+#define DEBUG_LEVEL_7 0xFFFFFFFF -+ -+#define DEBUG_DRIVER_INIT_FUNCTIONS (1<<3) -+#define DEBUG_TIME_FIRST_UPDATE (1<<4) -+#define DEBUG_TIME_EACH_UPDATE (1<<5) -+#define DEBUG_DEFERRED_IO (1<<6) -+#define DEBUG_FBTFT_INIT_FUNCTIONS (1<<7) -+ -+/* fbops */ -+#define DEBUG_FB_READ (1<<8) -+#define DEBUG_FB_WRITE (1<<9) -+#define DEBUG_FB_FILLRECT (1<<10) -+#define DEBUG_FB_COPYAREA (1<<11) -+#define DEBUG_FB_IMAGEBLIT (1<<12) -+#define DEBUG_FB_SETCOLREG (1<<13) -+#define DEBUG_FB_BLANK (1<<14) -+ -+#define DEBUG_SYSFS (1<<16) -+ -+/* fbtftops */ -+#define DEBUG_BACKLIGHT (1<<17) -+#define DEBUG_READ (1<<18) -+#define DEBUG_WRITE (1<<19) -+#define DEBUG_WRITE_VMEM (1<<20) -+#define DEBUG_WRITE_REGISTER (1<<21) -+#define DEBUG_SET_ADDR_WIN (1<<22) -+#define DEBUG_RESET (1<<23) -+#define DEBUG_MKDIRTY (1<<24) -+#define DEBUG_UPDATE_DISPLAY (1<<25) -+#define DEBUG_INIT_DISPLAY (1<<26) -+#define DEBUG_BLANK (1<<27) -+#define DEBUG_REQUEST_GPIOS (1<<28) -+#define DEBUG_FREE_GPIOS (1<<29) -+#define DEBUG_REQUEST_GPIOS_MATCH (1<<30) -+#define DEBUG_VERIFY_GPIOS (1<<31) -+ -+ -+#define fbtft_init_dbg(dev, format, arg...) \ -+do { \ -+ if (unlikely((dev)->platform_data && \ -+ (((struct fbtft_platform_data *)(dev)->platform_data)->display.debug & DEBUG_DRIVER_INIT_FUNCTIONS))) \ -+ dev_info(dev, format, ##arg); \ -+} while (0) -+ -+#define fbtft_par_dbg(level, par, format, arg...) \ -+do { \ -+ if (unlikely(par->debug & level)) \ -+ dev_info(par->info->device, format, ##arg); \ -+} while (0) -+ -+#define fbtft_dev_dbg(level, par, dev, format, arg...) \ -+do { \ -+ if (unlikely(par->debug & level)) \ -+ dev_info(dev, format, ##arg); \ -+} while (0) -+ -+#define fbtft_par_dbg_hex(level, par, dev, type, buf, num, format, arg...) \ -+do { \ -+ if (unlikely(par->debug & level)) \ -+ fbtft_dbg_hex(dev, sizeof(type), buf, num * sizeof(type), format, ##arg); \ -+} while (0) -+ -+#endif /* __LINUX_FBTFT_H */ -diff --git a/drivers/video/fbtft/fbtft_device.c b/drivers/video/fbtft/fbtft_device.c -new file mode 100644 -index 0000000..b9f4c30 ---- /dev/null -+++ b/drivers/video/fbtft/fbtft_device.c -@@ -0,0 +1,1444 @@ -+/* -+ * -+ * Copyright (C) 2013, Noralf Tronnes -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+ -+#include "fbtft.h" -+ -+#define DRVNAME "fbtft_device" -+ -+#define MAX_GPIOS 32 -+ -+struct spi_device *spi_device; -+struct platform_device *p_device; -+ -+static char *name; -+module_param(name, charp, 0); -+MODULE_PARM_DESC(name, "Devicename (required). " \ -+"name=list => list all supported devices."); -+ -+static unsigned rotate; -+module_param(rotate, uint, 0); -+MODULE_PARM_DESC(rotate, -+"Angle to rotate display counter clockwise: 0, 90, 180, 270"); -+ -+static unsigned busnum; -+module_param(busnum, uint, 0); -+MODULE_PARM_DESC(busnum, "SPI bus number (default=0)"); -+ -+static unsigned cs; -+module_param(cs, uint, 0); -+MODULE_PARM_DESC(cs, "SPI chip select (default=0)"); -+ -+static unsigned speed; -+module_param(speed, uint, 0); -+MODULE_PARM_DESC(speed, "SPI speed (override device default)"); -+ -+static int mode = -1; -+module_param(mode, int, 0); -+MODULE_PARM_DESC(mode, "SPI mode (override device default)"); -+ -+static char *gpios; -+module_param(gpios, charp, 0); -+MODULE_PARM_DESC(gpios, -+"List of gpios. Comma separated with the form: reset:23,dc:24 " \ -+"(when overriding the default, all gpios must be specified)"); -+ -+static unsigned fps; -+module_param(fps, uint, 0); -+MODULE_PARM_DESC(fps, "Frames per second (override driver default)"); -+ -+static char *gamma; -+module_param(gamma, charp, 0); -+MODULE_PARM_DESC(gamma, -+"String representation of Gamma Curve(s). Driver specific."); -+ -+static int txbuflen; -+module_param(txbuflen, int, 0); -+MODULE_PARM_DESC(txbuflen, "txbuflen (override driver default)"); -+ -+static int bgr = -1; -+module_param(bgr, int, 0); -+MODULE_PARM_DESC(bgr, -+"BGR bit (supported by some drivers)."); -+ -+static unsigned startbyte; -+module_param(startbyte, uint, 0); -+MODULE_PARM_DESC(startbyte, "Sets the Start byte used by some SPI displays."); -+ -+static bool custom; -+module_param(custom, bool, 0); -+MODULE_PARM_DESC(custom, "Add a custom display device. " \ -+"Use speed= argument to make it a SPI device, else platform_device"); -+ -+static unsigned width; -+module_param(width, uint, 0); -+MODULE_PARM_DESC(width, "Display width, used with the custom argument"); -+ -+static unsigned height; -+module_param(height, uint, 0); -+MODULE_PARM_DESC(height, "Display height, used with the custom argument"); -+ -+static unsigned buswidth = 8; -+module_param(buswidth, uint, 0); -+MODULE_PARM_DESC(buswidth, "Display bus width, used with the custom argument"); -+ -+static int init[FBTFT_MAX_INIT_SEQUENCE]; -+static int init_num; -+module_param_array(init, int, &init_num, 0); -+MODULE_PARM_DESC(init, "Init sequence, used with the custom argument"); -+ -+static unsigned long debug; -+module_param(debug, ulong , 0); -+MODULE_PARM_DESC(debug, -+"level: 0-7 (the remaining 29 bits is for advanced usage)"); -+ -+static unsigned verbose = 3; -+module_param(verbose, uint, 0); -+MODULE_PARM_DESC(verbose, -+"0 silent, >0 show gpios, >1 show devices, >2 show devices before (default=3)"); -+ -+ -+struct fbtft_device_display { -+ char *name; -+ struct spi_board_info *spi; -+ struct platform_device *pdev; -+}; -+ -+static void fbtft_device_pdev_release(struct device *dev); -+ -+static int write_gpio16_wr_slow(struct fbtft_par *par, void *buf, size_t len); -+static void adafruit18_green_tab_set_addr_win(struct fbtft_par *par, -+ int xs, int ys, int xe, int ye); -+ -+#define ADAFRUIT18_GAMMA \ -+ "02 1c 07 12 37 32 29 2d 29 25 2B 39 00 01 03 10\n" \ -+ "03 1d 07 06 2E 2C 29 2D 2E 2E 37 3F 00 00 02 10" -+ -+static int hy28b_init_sequence[] = { -+ -1,0x00e7,0x0010,-1,0x0000,0x0001,-1,0x0001,0x0100,-1,0x0002,0x0700, -+ -1,0x0003,0x1030,-1,0x0004,0x0000,-1,0x0008,0x0207,-1,0x0009,0x0000, -+ -1,0x000a,0x0000,-1,0x000c,0x0001,-1,0x000d,0x0000,-1,0x000f,0x0000, -+ -1,0x0010,0x0000,-1,0x0011,0x0007,-1,0x0012,0x0000,-1,0x0013,0x0000, -+ -2,50,-1,0x0010,0x1590,-1,0x0011,0x0227,-2,50,-1,0x0012,0x009c,-2,50, -+ -1,0x0013,0x1900,-1,0x0029,0x0023,-1,0x002b,0x000e,-2,50, -+ -1,0x0020,0x0000,-1,0x0021,0x0000,-2,50,-1,0x0050,0x0000, -+ -1,0x0051,0x00ef,-1,0x0052,0x0000,-1,0x0053,0x013f,-1,0x0060,0xa700, -+ -1,0x0061,0x0001,-1,0x006a,0x0000,-1,0x0080,0x0000,-1,0x0081,0x0000, -+ -1,0x0082,0x0000,-1,0x0083,0x0000,-1,0x0084,0x0000,-1,0x0085,0x0000, -+ -1,0x0090,0x0010,-1,0x0092,0x0000,-1,0x0093,0x0003,-1,0x0095,0x0110, -+ -1,0x0097,0x0000,-1,0x0098,0x0000,-1,0x0007,0x0133,-1,0x0020,0x0000, -+ -1,0x0021,0x0000,-2,100,-3 }; -+ -+#define HY28B_GAMMA \ -+ "04 1F 4 7 7 0 7 7 6 0\n" \ -+ "0F 00 1 7 4 0 0 0 6 7" -+ -+static int pitft_init_sequence[] = { -+ -1,0x01,-2,5,-1,0x28,-1,0xEF,0x03,0x80,0x02,-1,0xCF,0x00,0xC1,0x30, -+ -1,0xED,0x64,0x03,0x12,0x81,-1,0xE8,0x85,0x00,0x78, -+ -1,0xCB,0x39,0x2C,0x00,0x34,0x02,-1,0xF7,0x20,-1,0xEA,0x00,0x00, -+ -1,0xC0,0x23,-1,0xC1,0x10,-1,0xC5,0x3e,0x28,-1,0xC7,0x86,-1,0x3A,0x55, -+ -1,0xB1,0x00,0x18,-1,0xB6,0x08,0x82,0x27,-1,0xF2,0x00,-1,0x26,0x01, -+ -1,0xE0,0x0F,0x31,0x2B,0x0C,0x0E,0x08,0x4E,0xF1,0x37,0x07,0x10,0x03, -+ 0x0E,0x09,0x00,-1,0xE1,0x00,0x0E,0x14,0x03,0x11,0x07,0x31,0xC1,0x48, -+ 0x08,0x0F,0x0C,0x31,0x36,0x0F,-1,0x11,-2,100,-1,0x29,-2,20,-3 }; -+ -+static int waveshare32b_init_sequence[] = { -+ -1,0xCB,0x39,0x2C,0x00,0x34,0x02,-1,0xCF,0x00,0xC1,0x30, -+ -1,0xE8,0x85,0x00,0x78,-1,0xEA,0x00,0x00,-1,0xED,0x64,0x03,0x12,0x81, -+ -1,0xF7,0x20,-1,0xC0,0x23,-1,0xC1,0x10,-1,0xC5,0x3e,0x28,-1,0xC7,0x86, -+ -1,0x36,0x28,-1,0x3A,0x55,-1,0xB1,0x00,0x18,-1,0xB6,0x08,0x82,0x27, -+ -1,0xF2,0x00,-1,0x26,0x01, -+ -1,0xE0,0x0F,0x31,0x2B,0x0C,0x0E,0x08,0x4E,0xF1,0x37,0x07,0x10,0x03,0x0E,0x09,0x00, -+ -1,0xE1,0x00,0x0E,0x14,0x03,0x11,0x07,0x31,0xC1,0x48,0x08,0x0F,0x0C,0x31,0x36,0x0F, -+ -1,0x11,-2,120,-1,0x29,-1,0x2c,-3 }; -+ -+/* Supported displays in alphabetical order */ -+static struct fbtft_device_display displays[] = { -+ { -+ .name = "adafruit18", -+ .spi = &(struct spi_board_info) { -+ .modalias = "fb_st7735r", -+ .max_speed_hz = 32000000, -+ .mode = SPI_MODE_0, -+ .platform_data = &(struct fbtft_platform_data) { -+ .display = { -+ .buswidth = 8, -+ .backlight = 1, -+ }, -+ .gpios = (const struct fbtft_gpio []) { -+ { "reset", 25 }, -+ { "dc", 24 }, -+ { "led", 18 }, -+ {}, -+ }, -+ .gamma = ADAFRUIT18_GAMMA, -+ } -+ } -+ }, { -+ .name = "adafruit18_green", -+ .spi = &(struct spi_board_info) { -+ .modalias = "fb_st7735r", -+ .max_speed_hz = 4000000, -+ .mode = SPI_MODE_0, -+ .platform_data = &(struct fbtft_platform_data) { -+ .display = { -+ .buswidth = 8, -+ .backlight = 1, -+ .fbtftops.set_addr_win = \ -+ adafruit18_green_tab_set_addr_win, -+ }, -+ .bgr = true, -+ .gpios = (const struct fbtft_gpio []) { -+ { "reset", 25 }, -+ { "dc", 24 }, -+ { "led", 18 }, -+ {}, -+ }, -+ .gamma = ADAFRUIT18_GAMMA, -+ } -+ } -+ }, { -+ .name = "adafruit22", -+ .spi = &(struct spi_board_info) { -+ .modalias = "fb_hx8340bn", -+ .max_speed_hz = 32000000, -+ .mode = SPI_MODE_0, -+ .platform_data = &(struct fbtft_platform_data) { -+ .display = { -+ .buswidth = 9, -+ .backlight = 1, -+ }, -+ .bgr = true, -+ .gpios = (const struct fbtft_gpio []) { -+ { "reset", 25 }, -+ { "led", 23 }, -+ {}, -+ }, -+ } -+ } -+ }, { -+ .name = "adafruit22a", -+ .spi = &(struct spi_board_info) { -+ .modalias = "fb_ili9340", -+ .max_speed_hz = 32000000, -+ .mode = SPI_MODE_0, -+ .platform_data = &(struct fbtft_platform_data) { -+ .display = { -+ .buswidth = 8, -+ .backlight = 1, -+ }, -+ .bgr = true, -+ .gpios = (const struct fbtft_gpio []) { -+ { "reset", 25 }, -+ { "dc", 24 }, -+ { "led", 18 }, -+ {}, -+ }, -+ } -+ } -+ }, { -+ .name = "adafruit28", -+ .spi = &(struct spi_board_info) { -+ .modalias = "fb_ili9341", -+ .max_speed_hz = 32000000, -+ .mode = SPI_MODE_0, -+ .platform_data = &(struct fbtft_platform_data) { -+ .display = { -+ .buswidth = 8, -+ .backlight = 1, -+ }, -+ .bgr = true, -+ .gpios = (const struct fbtft_gpio []) { -+ { "reset", 25 }, -+ { "dc", 24 }, -+ { "led", 18 }, -+ {}, -+ }, -+ } -+ } -+ }, { -+ .name = "adafruit13m", -+ .spi = &(struct spi_board_info) { -+ .modalias = "fb_ssd1306", -+ .max_speed_hz = 16000000, -+ .mode = SPI_MODE_0, -+ .platform_data = &(struct fbtft_platform_data) { -+ .display = { -+ .buswidth = 8, -+ }, -+ .gpios = (const struct fbtft_gpio []) { -+ { "reset", 25 }, -+ { "dc", 24 }, -+ {}, -+ }, -+ } -+ } -+ }, { -+ .name = "agm1264k-fl", -+ .pdev = &(struct platform_device) { -+ .name = "fb_agm1264k-fl", -+ .id = 0, -+ .dev = { -+ .release = fbtft_device_pdev_release, -+ .platform_data = &(struct fbtft_platform_data) { -+ .display = { -+ .buswidth = 8, -+ .backlight = FBTFT_ONBOARD_BACKLIGHT, -+ }, -+ .gpios = (const struct fbtft_gpio []) { -+ {}, -+ }, -+ }, -+ } -+ } -+ }, { -+ .name = "dogs102", -+ .spi = &(struct spi_board_info) { -+ .modalias = "fb_uc1701", -+ .max_speed_hz = 8000000, -+ .mode = SPI_MODE_0, -+ .platform_data = &(struct fbtft_platform_data) { -+ .display = { -+ .buswidth = 8, -+ }, -+ .bgr = true, -+ .gpios = (const struct fbtft_gpio []) { -+ { "reset", 13 }, -+ { "dc", 6 }, -+ {}, -+ }, -+ } -+ } -+ }, { -+ .name = "er_tftm050_2", -+ .spi = &(struct spi_board_info) { -+ .modalias = "fb_ra8875", -+ .max_speed_hz = 5000000, -+ .mode = SPI_MODE_3, -+ .platform_data = &(struct fbtft_platform_data) { -+ .display = { -+ .buswidth = 8, -+ .backlight = 1, -+ .width = 480, -+ .height = 272, -+ }, -+ .bgr = true, -+ .gpios = (const struct fbtft_gpio []) { -+ { "reset", 25 }, -+ { "dc", 24 }, -+ {}, -+ }, -+ } -+ } -+ }, { -+ .name = "er_tftm070_5", -+ .spi = &(struct spi_board_info) { -+ .modalias = "fb_ra8875", -+ .max_speed_hz = 5000000, -+ .mode = SPI_MODE_3, -+ .platform_data = &(struct fbtft_platform_data) { -+ .display = { -+ .buswidth = 8, -+ .backlight = 1, -+ .width = 800, -+ .height = 480, -+ }, -+ .bgr = true, -+ .gpios = (const struct fbtft_gpio []) { -+ { "reset", 25 }, -+ { "dc", 24 }, -+ {}, -+ }, -+ } -+ } -+ }, { -+ .name = "flexfb", -+ .spi = &(struct spi_board_info) { -+ .modalias = "flexfb", -+ .max_speed_hz = 32000000, -+ .mode = SPI_MODE_0, -+ .platform_data = &(struct fbtft_platform_data) { -+ .gpios = (const struct fbtft_gpio []) { -+ { "reset", 25 }, -+ { "dc", 24 }, -+ {}, -+ }, -+ } -+ } -+ }, { -+ .name = "flexpfb", -+ .pdev = &(struct platform_device) { -+ .name = "flexpfb", -+ .id = 0, -+ .dev = { -+ .release = fbtft_device_pdev_release, -+ .platform_data = &(struct fbtft_platform_data) { -+ .gpios = (const struct fbtft_gpio []) { -+ { "reset", 17 }, -+ { "dc", 1 }, -+ { "wr", 0 }, -+ { "cs", 21 }, -+ { "db00", 9 }, -+ { "db01", 11 }, -+ { "db02", 18 }, -+ { "db03", 23 }, -+ { "db04", 24 }, -+ { "db05", 25 }, -+ { "db06", 8 }, -+ { "db07", 7 }, -+ { "led", 4 }, -+ {}, -+ }, -+ }, -+ } -+ } -+ }, { -+ .name = "freetronicsoled128", -+ .spi = &(struct spi_board_info) { -+ .modalias = "fb_ssd1351", -+ .max_speed_hz = 20000000, -+ .mode = SPI_MODE_0, -+ .platform_data = &(struct fbtft_platform_data) { -+ .display = { -+ .buswidth = 8, -+ .backlight = FBTFT_ONBOARD_BACKLIGHT, -+ }, -+ .bgr = true, -+ .gpios = (const struct fbtft_gpio []) { -+ { "reset", 24 }, -+ { "dc", 25 }, -+ {}, -+ }, -+ } -+ } -+ }, { -+ .name = "hx8353d", -+ .spi = &(struct spi_board_info) { -+ .modalias = "fb_hx8353d", -+ .max_speed_hz = 16000000, -+ .mode = SPI_MODE_0, -+ .platform_data = &(struct fbtft_platform_data) { -+ .display = { -+ .buswidth = 8, -+ .backlight = 1, -+ }, -+ .gpios = (const struct fbtft_gpio []) { -+ { "reset", 25 }, -+ { "dc", 24 }, -+ { "led", 23 }, -+ {}, -+ }, -+ } -+ } -+ }, { -+ .name = "hy28a", -+ .spi = &(struct spi_board_info) { -+ .modalias = "fb_ili9320", -+ .max_speed_hz = 32000000, -+ .mode = SPI_MODE_3, -+ .platform_data = &(struct fbtft_platform_data) { -+ .display = { -+ .buswidth = 8, -+ .backlight = 1, -+ }, -+ .startbyte = 0b01110000, -+ .bgr = true, -+ .gpios = (const struct fbtft_gpio []) { -+ { "reset", 25 }, -+ { "led", 18 }, -+ {}, -+ }, -+ } -+ } -+ }, { -+ .name = "hy28b", -+ .spi = &(struct spi_board_info) { -+ .modalias = "fb_ili9325", -+ .max_speed_hz = 48000000, -+ .mode = SPI_MODE_3, -+ .platform_data = &(struct fbtft_platform_data) { -+ .display = { -+ .buswidth = 8, -+ .backlight = 1, -+ .init_sequence = hy28b_init_sequence, -+ }, -+ .startbyte = 0b01110000, -+ .bgr = true, -+ .fps= 50, -+ .gpios = (const struct fbtft_gpio []) { -+ { "reset", 25 }, -+ { "led", 18 }, -+ {}, -+ }, -+ .gamma = HY28B_GAMMA, -+ } -+ } -+ }, { -+ .name = "ili9481", -+ .spi = &(struct spi_board_info) { -+ .modalias = "fb_ili9481", -+ .max_speed_hz = 32000000, -+ .mode = SPI_MODE_0, -+ .platform_data = &(struct fbtft_platform_data) { -+ .display = { -+ .regwidth = 16, -+ .buswidth = 8, -+ .backlight = 1, -+ }, -+ .bgr = true, -+ .gpios = (const struct fbtft_gpio []) { -+ { "reset", 25 }, -+ { "dc", 24 }, -+ { "led", 22 }, -+ {}, -+ }, -+ } -+ } -+ }, { -+ .name = "itdb24", -+ .pdev = &(struct platform_device) { -+ .name = "fb_s6d1121", -+ .id = 0, -+ .dev = { -+ .release = fbtft_device_pdev_release, -+ .platform_data = &(struct fbtft_platform_data) { -+ .display = { -+ .buswidth = 8, -+ .backlight = 1, -+ }, -+ .bgr = false, -+ .gpios = (const struct fbtft_gpio []) { -+ /* Wiring for LCD adapter kit */ -+ { "reset", 7 }, -+ { "dc", 0 }, /* rev 2: 2 */ -+ { "wr", 1 }, /* rev 2: 3 */ -+ { "cs", 8 }, -+ { "db00", 17 }, -+ { "db01", 18 }, -+ { "db02", 21 }, /* rev 2: 27 */ -+ { "db03", 22 }, -+ { "db04", 23 }, -+ { "db05", 24 }, -+ { "db06", 25 }, -+ { "db07", 4 }, -+ {} -+ }, -+ }, -+ } -+ } -+ }, { -+ .name = "itdb28", -+ .pdev = &(struct platform_device) { -+ .name = "fb_ili9325", -+ .id = 0, -+ .dev = { -+ .release = fbtft_device_pdev_release, -+ .platform_data = &(struct fbtft_platform_data) { -+ .display = { -+ .buswidth = 8, -+ .backlight = 1, -+ }, -+ .bgr = true, -+ .gpios = (const struct fbtft_gpio []) { -+ {}, -+ }, -+ }, -+ } -+ } -+ }, { -+ .name = "itdb28_spi", -+ .spi = &(struct spi_board_info) { -+ .modalias = "fb_ili9325", -+ .max_speed_hz = 32000000, -+ .mode = SPI_MODE_0, -+ .platform_data = &(struct fbtft_platform_data) { -+ .display = { -+ .buswidth = 8, -+ .backlight = 1, -+ }, -+ .bgr = true, -+ .gpios = (const struct fbtft_gpio []) { -+ { "reset", 25 }, -+ { "dc", 24 }, -+ {}, -+ }, -+ } -+ } -+ }, { -+ .name = "mi0283qt-2", -+ .spi = &(struct spi_board_info) { -+ .modalias = "fb_hx8347d", -+ .max_speed_hz = 32000000, -+ .mode = SPI_MODE_0, -+ .platform_data = &(struct fbtft_platform_data) { -+ .display = { -+ .buswidth = 8, -+ .backlight = 1, -+ }, -+ .startbyte = 0b01110000, -+ .bgr = true, -+ .gpios = (const struct fbtft_gpio []) { -+ { "reset", 25 }, -+ { "dc", 24 }, -+ { "led", 18 }, -+ {}, -+ }, -+ } -+ } -+ }, { -+ .name = "mi0283qt-9a", -+ .spi = &(struct spi_board_info) { -+ .modalias = "fb_ili9341", -+ .max_speed_hz = 32000000, -+ .mode = SPI_MODE_0, -+ .platform_data = &(struct fbtft_platform_data) { -+ .display = { -+ .buswidth = 9, -+ .backlight = 1, -+ }, -+ .bgr = true, -+ .gpios = (const struct fbtft_gpio []) { -+ { "reset", 25 }, -+ { "led", 18 }, -+ {}, -+ }, -+ } -+ } -+ }, { -+ .name = "mi0283qt-v2", -+ .spi = &(struct spi_board_info) { -+ .modalias = "fb_watterott", -+ .max_speed_hz = 4000000, -+ .mode = SPI_MODE_3, -+ .platform_data = &(struct fbtft_platform_data) { -+ .gpios = (const struct fbtft_gpio []) { -+ { "reset", 25 }, -+ {}, -+ }, -+ } -+ } -+ }, { -+ .name = "nokia3310", -+ .spi = &(struct spi_board_info) { -+ .modalias = "fb_pcd8544", -+ .max_speed_hz = 400000, -+ .mode = SPI_MODE_0, -+ .platform_data = &(struct fbtft_platform_data) { -+ .display = { -+ .buswidth = 8, -+ }, -+ .gpios = (const struct fbtft_gpio []) { -+ { "reset", 25 }, -+ { "dc", 24 }, -+ { "led", 23 }, -+ {}, -+ }, -+ } -+ } -+ }, { -+ .name = "nokia3310a", -+ .spi = &(struct spi_board_info) { -+ .modalias = "fb_tls8204", -+ .max_speed_hz = 1000000, -+ .mode = SPI_MODE_0, -+ .platform_data = &(struct fbtft_platform_data) { -+ .display = { -+ .buswidth = 8, -+ }, -+ .gpios = (const struct fbtft_gpio []) { -+ { "reset", 25 }, -+ { "dc", 24 }, -+ { "led", 23 }, -+ {}, -+ }, -+ } -+ } -+ }, { -+ .name = "piscreen", -+ .spi = &(struct spi_board_info) { -+ .modalias = "fb_ili9486", -+ .max_speed_hz = 32000000, -+ .mode = SPI_MODE_0, -+ .platform_data = &(struct fbtft_platform_data) { -+ .display = { -+ .regwidth = 16, -+ .buswidth = 8, -+ .backlight = 1, -+ }, -+ .bgr = true, -+ .gpios = (const struct fbtft_gpio []) { -+ { "reset", 25 }, -+ { "dc", 24 }, -+ { "led", 22 }, -+ {}, -+ }, -+ } -+ } -+ }, { -+ .name = "pitft", -+ .spi = &(struct spi_board_info) { -+ .modalias = "fb_ili9340", -+ .max_speed_hz = 32000000, -+ .mode = SPI_MODE_0, -+ .chip_select = 0, -+ .platform_data = &(struct fbtft_platform_data) { -+ .display = { -+ .buswidth = 8, -+ .backlight = 1, -+ .init_sequence = pitft_init_sequence, -+ }, -+ .bgr = true, -+ .gpios = (const struct fbtft_gpio []) { -+ { "dc", 25 }, -+ {}, -+ }, -+ } -+ } -+ }, { -+ .name = "pioled", -+ .spi = &(struct spi_board_info) { -+ .modalias = "fb_ssd1351", -+ .max_speed_hz = 20000000, -+ .mode = SPI_MODE_0, -+ .platform_data = &(struct fbtft_platform_data) { -+ .display = { -+ .buswidth = 8, -+ }, -+ .bgr = true, -+ .gpios = (const struct fbtft_gpio []) { -+ { "reset", 24 }, -+ { "dc", 25 }, -+ {}, -+ }, -+ .gamma = "0 2 2 2 2 2 2 2 " \ -+ "2 2 2 2 2 2 2 2 " \ -+ "2 2 2 2 2 2 2 2 " \ -+ "2 2 2 2 2 2 2 3 " \ -+ "3 3 3 3 3 3 3 3 " \ -+ "3 3 3 3 3 3 3 3 " \ -+ "3 3 3 4 4 4 4 4 " \ -+ "4 4 4 4 4 4 4" -+ } -+ } -+ }, { -+ .name = "rpi-display", -+ .spi = &(struct spi_board_info) { -+ .modalias = "fb_ili9341", -+ .max_speed_hz = 32000000, -+ .mode = SPI_MODE_0, -+ .platform_data = &(struct fbtft_platform_data) { -+ .display = { -+ .buswidth = 8, -+ .backlight = 1, -+ }, -+ .bgr = true, -+ .gpios = (const struct fbtft_gpio []) { -+ { "reset", 23 }, -+ { "dc", 24 }, -+ { "led", 18 }, -+ {}, -+ }, -+ } -+ } -+ }, { -+ .name = "s6d02a1", -+ .spi = &(struct spi_board_info) { -+ .modalias = "fb_s6d02a1", -+ .max_speed_hz = 32000000, -+ .mode = SPI_MODE_0, -+ .platform_data = &(struct fbtft_platform_data) { -+ .display = { -+ .buswidth = 8, -+ .backlight = 1, -+ }, -+ .bgr = true, -+ .gpios = (const struct fbtft_gpio []) { -+ { "reset", 25 }, -+ { "dc", 24 }, -+ { "led", 23 }, -+ {}, -+ }, -+ } -+ } -+ }, { -+ .name = "sainsmart18", -+ .spi = &(struct spi_board_info) { -+ .modalias = "fb_st7735r", -+ .max_speed_hz = 32000000, -+ .mode = SPI_MODE_0, -+ .platform_data = &(struct fbtft_platform_data) { -+ .display = { -+ .buswidth = 8, -+ }, -+ .gpios = (const struct fbtft_gpio []) { -+ { "reset", 25 }, -+ { "dc", 24 }, -+ {}, -+ }, -+ } -+ } -+ }, { -+ .name = "sainsmart32", -+ .pdev = &(struct platform_device) { -+ .name = "fb_ssd1289", -+ .id = 0, -+ .dev = { -+ .release = fbtft_device_pdev_release, -+ .platform_data = &(struct fbtft_platform_data) { -+ .display = { -+ .buswidth = 16, -+ .txbuflen = -2, /* disable buffer */ -+ .backlight = 1, -+ .fbtftops.write = write_gpio16_wr_slow, -+ }, -+ .bgr = true, -+ .gpios = (const struct fbtft_gpio []) { -+ {}, -+ }, -+ }, -+ }, -+ } -+ }, { -+ .name = "sainsmart32_fast", -+ .pdev = &(struct platform_device) { -+ .name = "fb_ssd1289", -+ .id = 0, -+ .dev = { -+ .release = fbtft_device_pdev_release, -+ .platform_data = &(struct fbtft_platform_data) { -+ .display = { -+ .buswidth = 16, -+ .txbuflen = -2, /* disable buffer */ -+ .backlight = 1, -+ }, -+ .bgr = true, -+ .gpios = (const struct fbtft_gpio []) { -+ {}, -+ }, -+ }, -+ }, -+ } -+ }, { -+ .name = "sainsmart32_latched", -+ .pdev = &(struct platform_device) { -+ .name = "fb_ssd1289", -+ .id = 0, -+ .dev = { -+ .release = fbtft_device_pdev_release, -+ .platform_data = &(struct fbtft_platform_data) { -+ .display = { -+ .buswidth = 16, -+ .txbuflen = -2, /* disable buffer */ -+ .backlight = 1, -+ .fbtftops.write = \ -+ fbtft_write_gpio16_wr_latched, -+ }, -+ .bgr = true, -+ .gpios = (const struct fbtft_gpio []) { -+ {}, -+ }, -+ }, -+ }, -+ } -+ }, { -+ .name = "sainsmart32_spi", -+ .spi = &(struct spi_board_info) { -+ .modalias = "fb_ssd1289", -+ .max_speed_hz = 16000000, -+ .mode = SPI_MODE_0, -+ .platform_data = &(struct fbtft_platform_data) { -+ .display = { -+ .buswidth = 8, -+ .backlight = 1, -+ }, -+ .bgr = true, -+ .gpios = (const struct fbtft_gpio []) { -+ { "reset", 25 }, -+ { "dc", 24 }, -+ {}, -+ }, -+ } -+ } -+ }, { -+ .name = "spidev", -+ .spi = &(struct spi_board_info) { -+ .modalias = "spidev", -+ .max_speed_hz = 500000, -+ .bus_num = 0, -+ .chip_select = 0, -+ .mode = SPI_MODE_0, -+ .platform_data = &(struct fbtft_platform_data) { -+ .gpios = (const struct fbtft_gpio []) { -+ {}, -+ }, -+ } -+ } -+ }, { -+ .name = "ssd1331", -+ .spi = &(struct spi_board_info) { -+ .modalias = "fb_ssd1331", -+ .max_speed_hz = 20000000, -+ .mode = SPI_MODE_3, -+ .platform_data = &(struct fbtft_platform_data) { -+ .display = { -+ .buswidth = 8, -+ }, -+ .gpios = (const struct fbtft_gpio []) { -+ { "reset", 24 }, -+ { "dc", 25 }, -+ {}, -+ }, -+ } -+ } -+ }, { -+ .name = "tinylcd35", -+ .spi = &(struct spi_board_info) { -+ .modalias = "fb_tinylcd", -+ .max_speed_hz = 32000000, -+ .mode = SPI_MODE_0, -+ .platform_data = &(struct fbtft_platform_data) { -+ .display = { -+ .buswidth = 8, -+ .backlight = 1, -+ }, -+ .bgr = true, -+ .gpios = (const struct fbtft_gpio []) { -+ { "reset", 25 }, -+ { "dc", 24 }, -+ { "led", 18 }, -+ {}, -+ }, -+ } -+ } -+ }, { -+ .name = "tm022hdh26", -+ .spi = &(struct spi_board_info) { -+ .modalias = "fb_ili9341", -+ .max_speed_hz = 32000000, -+ .mode = SPI_MODE_0, -+ .platform_data = &(struct fbtft_platform_data) { -+ .display = { -+ .buswidth = 8, -+ .backlight = 1, -+ }, -+ .bgr = true, -+ .gpios = (const struct fbtft_gpio []) { -+ { "reset", 25 }, -+ { "dc", 24 }, -+ { "led", 18 }, -+ {}, -+ }, -+ } -+ } -+ }, { -+ .name = "tontec35_9481", /* boards before 02 July 2014 */ -+ .spi = &(struct spi_board_info) { -+ .modalias = "fb_ili9481", -+ .max_speed_hz = 128000000, -+ .mode = SPI_MODE_3, -+ .platform_data = &(struct fbtft_platform_data) { -+ .display = { -+ .buswidth = 8, -+ .backlight = 1, -+ }, -+ .bgr = true, -+ .gpios = (const struct fbtft_gpio []) { -+ { "reset", 15 }, -+ { "dc", 25 }, -+ { "led_", 18 }, -+ {}, -+ }, -+ } -+ } -+ }, { -+ .name = "tontec35_9486", /* boards after 02 July 2014 */ -+ .spi = &(struct spi_board_info) { -+ .modalias = "fb_ili9486", -+ .max_speed_hz = 128000000, -+ .mode = SPI_MODE_3, -+ .platform_data = &(struct fbtft_platform_data) { -+ .display = { -+ .buswidth = 8, -+ .backlight = 1, -+ }, -+ .bgr = true, -+ .gpios = (const struct fbtft_gpio []) { -+ { "reset", 15 }, -+ { "dc", 25 }, -+ { "led_", 18 }, -+ {}, -+ }, -+ } -+ } -+ }, { -+ .name = "upd161704", -+ .spi = &(struct spi_board_info) { -+ .modalias = "fb_upd161704", -+ .max_speed_hz = 32000000, -+ .mode = SPI_MODE_0, -+ .platform_data = &(struct fbtft_platform_data) { -+ .display = { -+ .buswidth = 8, -+ }, -+ .gpios = (const struct fbtft_gpio []) { -+ { "reset", 24 }, -+ { "dc", 25 }, -+ {}, -+ }, -+ } -+ } -+ }, { -+ .name = "waveshare32b", -+ .spi = &(struct spi_board_info) { -+ .modalias = "fb_ili9340", -+ .max_speed_hz = 48000000, -+ .mode = SPI_MODE_0, -+ .platform_data = &(struct fbtft_platform_data) { -+ .display = { -+ .buswidth = 8, -+ .backlight = 1, -+ .init_sequence = waveshare32b_init_sequence, -+ }, -+ .bgr = true, -+ .gpios = (const struct fbtft_gpio []) { -+ { "reset", 27 }, -+ { "dc", 22 }, -+ {}, -+ }, -+ } -+ } -+ }, { -+ .name = "waveshare22", -+ .spi = &(struct spi_board_info) { -+ .modalias = "fb_bd663474", -+ .max_speed_hz = 32000000, -+ .mode = SPI_MODE_3, -+ .platform_data = &(struct fbtft_platform_data) { -+ .display = { -+ .buswidth = 8, -+ }, -+ .gpios = (const struct fbtft_gpio []) { -+ { "reset", 24 }, -+ { "dc", 25 }, -+ {}, -+ }, -+ } -+ } -+ }, { -+ /* This should be the last item. -+ Used with the custom argument */ -+ .name = "", -+ .spi = &(struct spi_board_info) { -+ .modalias = "", -+ .max_speed_hz = 0, -+ .mode = SPI_MODE_0, -+ .platform_data = &(struct fbtft_platform_data) { -+ .gpios = (const struct fbtft_gpio []) { -+ {}, -+ }, -+ } -+ }, -+ .pdev = &(struct platform_device) { -+ .name = "", -+ .id = 0, -+ .dev = { -+ .release = fbtft_device_pdev_release, -+ .platform_data = &(struct fbtft_platform_data) { -+ .gpios = (const struct fbtft_gpio []) { -+ {}, -+ }, -+ }, -+ }, -+ }, -+ } -+}; -+ -+static int write_gpio16_wr_slow(struct fbtft_par *par, void *buf, size_t len) -+{ -+ u16 data; -+ int i; -+#ifndef DO_NOT_OPTIMIZE_FBTFT_WRITE_GPIO -+ static u16 prev_data; -+#endif -+ -+ fbtft_par_dbg_hex(DEBUG_WRITE, par, par->info->device, u8, buf, len, -+ "%s(len=%d): ", __func__, len); -+ -+ while (len) { -+ data = *(u16 *) buf; -+ -+ /* Start writing by pulling down /WR */ -+ gpio_set_value(par->gpio.wr, 0); -+ -+ /* Set data */ -+#ifndef DO_NOT_OPTIMIZE_FBTFT_WRITE_GPIO -+ if (data == prev_data) { -+ gpio_set_value(par->gpio.wr, 0); /* used as delay */ -+ } else { -+ for (i = 0; i < 16; i++) { -+ if ((data & 1) != (prev_data & 1)) -+ gpio_set_value(par->gpio.db[i], -+ (data & 1)); -+ data >>= 1; -+ prev_data >>= 1; -+ } -+ } -+#else -+ for (i = 0; i < 16; i++) { -+ gpio_set_value(par->gpio.db[i], (data & 1)); -+ data >>= 1; -+ } -+#endif -+ -+ /* Pullup /WR */ -+ gpio_set_value(par->gpio.wr, 1); -+ -+#ifndef DO_NOT_OPTIMIZE_FBTFT_WRITE_GPIO -+ prev_data = *(u16 *) buf; -+#endif -+ buf += 2; -+ len -= 2; -+ } -+ -+ return 0; -+} -+ -+static void adafruit18_green_tab_set_addr_win(struct fbtft_par *par, -+ int xs, int ys, int xe, int ye) -+{ -+ fbtft_par_dbg(DEBUG_SET_ADDR_WIN, par, -+ "%s(xs=%d, ys=%d, xe=%d, ye=%d)\n", __func__, xs, ys, xe, ye); -+ write_reg(par, 0x2A, 0, xs + 2, 0, xe + 2); -+ write_reg(par, 0x2B, 0, ys + 1, 0, ye + 1); -+ write_reg(par, 0x2C); -+} -+ -+/* used if gpios parameter is present */ -+static struct fbtft_gpio fbtft_device_param_gpios[MAX_GPIOS+1] = { }; -+ -+static void fbtft_device_pdev_release(struct device *dev) -+{ -+/* Needed to silence this message: -+Device 'xxx' does not have a release() function, it is broken and must be fixed -+*/ -+} -+ -+static int spi_device_found(struct device *dev, void *data) -+{ -+ struct spi_device *spi = container_of(dev, struct spi_device, dev); -+ -+ pr_info(DRVNAME": %s %s %dkHz %d bits mode=0x%02X\n", -+ spi->modalias, dev_name(dev), spi->max_speed_hz/1000, -+ spi->bits_per_word, spi->mode); -+ -+ return 0; -+} -+ -+static void pr_spi_devices(void) -+{ -+ pr_info(DRVNAME": SPI devices registered:\n"); -+ bus_for_each_dev(&spi_bus_type, NULL, NULL, spi_device_found); -+} -+ -+static int p_device_found(struct device *dev, void *data) -+{ -+ struct platform_device -+ *pdev = container_of(dev, struct platform_device, dev); -+ -+ if (strstr(pdev->name, "fb")) -+ pr_info(DRVNAME": %s id=%d pdata? %s\n", -+ pdev->name, pdev->id, -+ pdev->dev.platform_data ? "yes" : "no"); -+ -+ return 0; -+} -+ -+static void pr_p_devices(void) -+{ -+ pr_info(DRVNAME": 'fb' Platform devices registered:\n"); -+ bus_for_each_dev(&platform_bus_type, NULL, NULL, p_device_found); -+} -+ -+#ifdef MODULE -+static void fbtft_device_spi_delete(struct spi_master *master, unsigned cs) -+{ -+ struct device *dev; -+ char str[32]; -+ -+ snprintf(str, sizeof(str), "%s.%u", dev_name(&master->dev), cs); -+ -+ dev = bus_find_device_by_name(&spi_bus_type, NULL, str); -+ if (dev) { -+ if (verbose) -+ pr_info(DRVNAME": Deleting %s\n", str); -+ device_del(dev); -+ } -+} -+ -+static int fbtft_device_spi_device_register(struct spi_board_info *spi) -+{ -+ struct spi_master *master; -+ -+ master = spi_busnum_to_master(spi->bus_num); -+ if (!master) { -+ pr_err(DRVNAME ": spi_busnum_to_master(%d) returned NULL\n", -+ spi->bus_num); -+ return -EINVAL; -+ } -+ /* make sure it's available */ -+ fbtft_device_spi_delete(master, spi->chip_select); -+ spi_device = spi_new_device(master, spi); -+ put_device(&master->dev); -+ if (!spi_device) { -+ pr_err(DRVNAME ": spi_new_device() returned NULL\n"); -+ return -EPERM; -+ } -+ return 0; -+} -+#else -+static int fbtft_device_spi_device_register(struct spi_board_info *spi) -+{ -+ return spi_register_board_info(spi, 1); -+} -+#endif -+ -+static int __init fbtft_device_init(void) -+{ -+ struct spi_board_info *spi = NULL; -+ struct fbtft_platform_data *pdata; -+ const struct fbtft_gpio *gpio = NULL; -+ char *p_gpio, *p_name, *p_num; -+ bool found = false; -+ int i = 0; -+ long val; -+ int ret = 0; -+ -+ pr_debug("\n\n"DRVNAME": init\n"); -+ -+ if (name == NULL) { -+#ifdef MODULE -+ pr_err(DRVNAME": missing module parameter: 'name'\n"); -+ return -EINVAL; -+#else -+ return 0; -+#endif -+ } -+ -+ if (init_num > FBTFT_MAX_INIT_SEQUENCE) { -+ pr_err(DRVNAME \ -+ ": init parameter: exceeded max array size: %d\n", -+ FBTFT_MAX_INIT_SEQUENCE); -+ return -EINVAL; -+ } -+ -+ /* parse module parameter: gpios */ -+ while ((p_gpio = strsep(&gpios, ","))) { -+ if (strchr(p_gpio, ':') == NULL) { -+ pr_err(DRVNAME \ -+ ": error: missing ':' in gpios parameter: %s\n", -+ p_gpio); -+ return -EINVAL; -+ } -+ p_num = p_gpio; -+ p_name = strsep(&p_num, ":"); -+ if (p_name == NULL || p_num == NULL) { -+ pr_err(DRVNAME \ -+ ": something bad happened parsing gpios parameter: %s\n", -+ p_gpio); -+ return -EINVAL; -+ } -+ ret = kstrtol(p_num, 10, &val); -+ if (ret) { -+ pr_err(DRVNAME \ -+ ": could not parse number in gpios parameter: %s:%s\n", -+ p_name, p_num); -+ return -EINVAL; -+ } -+ strcpy(fbtft_device_param_gpios[i].name, p_name); -+ fbtft_device_param_gpios[i++].gpio = (int) val; -+ if (i == MAX_GPIOS) { -+ pr_err(DRVNAME \ -+ ": gpios parameter: exceeded max array size: %d\n", -+ MAX_GPIOS); -+ return -EINVAL; -+ } -+ } -+ if (fbtft_device_param_gpios[0].name[0]) -+ gpio = fbtft_device_param_gpios; -+ -+ if (verbose > 2) -+ pr_spi_devices(); /* print list of registered SPI devices */ -+ -+ if (verbose > 2) -+ pr_p_devices(); /* print list of 'fb' platform devices */ -+ -+ pr_debug(DRVNAME": name='%s', busnum=%d, cs=%d\n", name, busnum, cs); -+ -+ if (rotate > 0 && rotate < 4) { -+ rotate = (4 - rotate) * 90; -+ pr_warn("argument 'rotate' should be an angle. Values 1-3 is deprecated. Setting it to %d.\n", -+ rotate); -+ } -+ if (rotate != 0 && rotate != 90 && rotate != 180 && rotate != 270) { -+ pr_warn("argument 'rotate' illegal value: %d. Setting it to 0.\n", -+ rotate); -+ rotate = 0; -+ } -+ -+ /* name=list lists all supported displays */ -+ if (strncmp(name, "list", 32) == 0) { -+ pr_info(DRVNAME": Supported displays:\n"); -+ -+ for (i = 0; i < ARRAY_SIZE(displays); i++) -+ pr_info(DRVNAME": %s\n", displays[i].name); -+ return -ECANCELED; -+ } -+ -+ if (custom) { -+ i = ARRAY_SIZE(displays) - 1; -+ displays[i].name = name; -+ if (speed == 0) { -+ displays[i].pdev->name = name; -+ displays[i].spi = NULL; -+ } else { -+ strncpy(displays[i].spi->modalias, name, SPI_NAME_SIZE); -+ displays[i].pdev = NULL; -+ } -+ } -+ -+ for (i = 0; i < ARRAY_SIZE(displays); i++) { -+ if (strncmp(name, displays[i].name, 32) == 0) { -+ if (displays[i].spi) { -+ spi = displays[i].spi; -+ spi->chip_select = cs; -+ spi->bus_num = busnum; -+ if (speed) -+ spi->max_speed_hz = speed; -+ if (mode != -1) -+ spi->mode = mode; -+ pdata = (void *)spi->platform_data; -+ } else if (displays[i].pdev) { -+ p_device = displays[i].pdev; -+ pdata = p_device->dev.platform_data; -+ } else { -+ pr_err(DRVNAME": broken displays array\n"); -+ return -EINVAL; -+ } -+ -+ pdata->rotate = rotate; -+ if (bgr == 0) -+ pdata->bgr = false; -+ else if (bgr == 1) -+ pdata->bgr = true; -+ if (startbyte) -+ pdata->startbyte = startbyte; -+ if (gamma) -+ pdata->gamma = gamma; -+ pdata->display.debug = debug; -+ if (fps) -+ pdata->fps = fps; -+ if (txbuflen) -+ pdata->txbuflen = txbuflen; -+ if (init_num) -+ pdata->display.init_sequence = init; -+ if (gpio) -+ pdata->gpios = gpio; -+ if (custom) { -+ pdata->display.width = width; -+ pdata->display.height = height; -+ pdata->display.buswidth = buswidth; -+ pdata->display.backlight = 1; -+ } -+ -+ if (displays[i].spi) { -+ ret = fbtft_device_spi_device_register(spi); -+ if (ret) { -+ pr_err(DRVNAME \ -+ ": failed to register SPI device\n"); -+ return ret; -+ } -+ found = true; -+ break; -+ } else { -+ ret = platform_device_register(p_device); -+ if (ret < 0) { -+ pr_err(DRVNAME \ -+ ": platform_device_register() returned %d\n", -+ ret); -+ return ret; -+ } -+ found = true; -+ break; -+ } -+ } -+ } -+ -+ if (!found) { -+ pr_err(DRVNAME": display not supported: '%s'\n", name); -+ return -EINVAL; -+ } -+ -+ if (verbose && pdata && pdata->gpios) { -+ gpio = pdata->gpios; -+ pr_info(DRVNAME": GPIOS used by '%s':\n", name); -+ found = false; -+ while (verbose && gpio->name[0]) { -+ pr_info(DRVNAME": '%s' = GPIO%d\n", -+ gpio->name, gpio->gpio); -+ gpio++; -+ found = true; -+ } -+ if (!found) -+ pr_info(DRVNAME": (none)\n"); -+ } -+ -+ if (spi_device && (verbose > 1)) -+ pr_spi_devices(); -+ if (p_device && (verbose > 1)) -+ pr_p_devices(); -+ -+ return 0; -+} -+ -+static void __exit fbtft_device_exit(void) -+{ -+ pr_debug(DRVNAME" - exit\n"); -+ -+ if (spi_device) { -+ device_del(&spi_device->dev); -+ kfree(spi_device); -+ } -+ -+ if (p_device) -+ platform_device_unregister(p_device); -+ -+} -+ -+arch_initcall(fbtft_device_init); -+module_exit(fbtft_device_exit); -+ -+MODULE_DESCRIPTION("Add a FBTFT device."); -+MODULE_AUTHOR("Noralf Tronnes"); -+MODULE_LICENSE("GPL"); -diff --git a/drivers/video/fbtft/flexfb.c b/drivers/video/fbtft/flexfb.c -new file mode 100644 -index 0000000..45574a0 ---- /dev/null -+++ b/drivers/video/fbtft/flexfb.c -@@ -0,0 +1,593 @@ -+/* -+ * Generic FB driver for TFT LCD displays -+ * -+ * Copyright (C) 2013 Noralf Tronnes -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "fbtft.h" -+ -+#define DRVNAME "flexfb" -+ -+ -+static char *chip = NULL; -+module_param(chip, charp, 0); -+MODULE_PARM_DESC(chip, "LCD controller"); -+ -+static unsigned int width = 0; -+module_param(width, uint, 0); -+MODULE_PARM_DESC(width, "Display width"); -+ -+static unsigned int height = 0; -+module_param(height, uint, 0); -+MODULE_PARM_DESC(height, "Display height"); -+ -+static int init[512]; -+static int init_num = 0; -+module_param_array(init, int, &init_num, 0); -+MODULE_PARM_DESC(init, "Init sequence"); -+ -+static unsigned int setaddrwin = 0; -+module_param(setaddrwin, uint, 0); -+MODULE_PARM_DESC(setaddrwin, "Which set_addr_win() implementation to use"); -+ -+static unsigned int buswidth = 8; -+module_param(buswidth, uint, 0); -+MODULE_PARM_DESC(buswidth, "Width of databus (default: 8)"); -+ -+static unsigned int regwidth = 8; -+module_param(regwidth, uint, 0); -+MODULE_PARM_DESC(regwidth, "Width of controller register (default: 8)"); -+ -+static bool nobacklight = false; -+module_param(nobacklight, bool, 0); -+MODULE_PARM_DESC(nobacklight, "Turn off backlight functionality."); -+ -+static bool latched = false; -+module_param(latched, bool, 0); -+MODULE_PARM_DESC(latched, "Use with latched 16-bit databus"); -+ -+ -+static int *initp = NULL; -+static int initp_num = 0; -+ -+/* default init sequences */ -+static int st7735r_init[] = { \ -+-1,0x01,-2,150,-1,0x11,-2,500,-1,0xB1,0x01,0x2C,0x2D,-1,0xB2,0x01,0x2C,0x2D,-1,0xB3,0x01,0x2C,0x2D,0x01,0x2C,0x2D, \ -+-1,0xB4,0x07,-1,0xC0,0xA2,0x02,0x84,-1,0xC1,0xC5,-1,0xC2,0x0A,0x00,-1,0xC3,0x8A,0x2A,-1,0xC4,0x8A,0xEE,-1,0xC5,0x0E, \ -+-1,0x20,-1,0x36,0xC0,-1,0x3A,0x05,-1,0xE0,0x0f,0x1a,0x0f,0x18,0x2f,0x28,0x20,0x22,0x1f,0x1b,0x23,0x37,0x00,0x07,0x02,0x10, \ -+-1,0xE1,0x0f,0x1b,0x0f,0x17,0x33,0x2c,0x29,0x2e,0x30,0x30,0x39,0x3f,0x00,0x07,0x03,0x10,-1,0x29,-2,100,-1,0x13,-2,10,-3 }; -+ -+static int ssd1289_init[] = { \ -+-1,0x00,0x0001,-1,0x03,0xA8A4,-1,0x0C,0x0000,-1,0x0D,0x080C,-1,0x0E,0x2B00,-1,0x1E,0x00B7,-1,0x01,0x2B3F,-1,0x02,0x0600, \ -+-1,0x10,0x0000,-1,0x11,0x6070,-1,0x05,0x0000,-1,0x06,0x0000,-1,0x16,0xEF1C,-1,0x17,0x0003,-1,0x07,0x0233,-1,0x0B,0x0000, \ -+-1,0x0F,0x0000,-1,0x41,0x0000,-1,0x42,0x0000,-1,0x48,0x0000,-1,0x49,0x013F,-1,0x4A,0x0000,-1,0x4B,0x0000,-1,0x44,0xEF00, \ -+-1,0x45,0x0000,-1,0x46,0x013F,-1,0x30,0x0707,-1,0x31,0x0204,-1,0x32,0x0204,-1,0x33,0x0502,-1,0x34,0x0507,-1,0x35,0x0204, \ -+-1,0x36,0x0204,-1,0x37,0x0502,-1,0x3A,0x0302,-1,0x3B,0x0302,-1,0x23,0x0000,-1,0x24,0x0000,-1,0x25,0x8000,-1,0x4f,0x0000, \ -+-1,0x4e,0x0000,-1,0x22,-3 }; -+ -+static int hx8340bn_init[] = { \ -+-1,0xC1,0xFF,0x83,0x40,-1,0x11,-2,150,-1,0xCA,0x70,0x00,0xD9,-1,0xB0,0x01,0x11, \ -+-1,0xC9,0x90,0x49,0x10,0x28,0x28,0x10,0x00,0x06,-2,20,-1,0xC2,0x60,0x71,0x01,0x0E,0x05,0x02,0x09,0x31,0x0A, \ -+-1,0xC3,0x67,0x30,0x61,0x17,0x48,0x07,0x05,0x33,-2,10,-1,0xB5,0x35,0x20,0x45,-1,0xB4,0x33,0x25,0x4C,-2,10, \ -+-1,0x3A,0x05,-1,0x29,-2,10,-3 }; -+ -+static int ili9225_init[] = { \ -+-1,0x0001,0x011C,-1,0x0002,0x0100,-1,0x0003,0x1030,-1,0x0008,0x0808,-1,0x000C,0x0000,-1,0x000F,0x0A01,-1,0x0020,0x0000, \ -+-1,0x0021,0x0000,-2,50,-1,0x0010,0x0A00,-1,0x0011,0x1038,-2,50,-1,0x0012,0x1121,-1,0x0013,0x004E,-1,0x0014,0x676F, \ -+-1,0x0030,0x0000,-1,0x0031,0x00DB,-1,0x0032,0x0000,-1,0x0033,0x0000,-1,0x0034,0x00DB,-1,0x0035,0x0000,-1,0x0036,0x00AF, \ -+-1,0x0037,0x0000,-1,0x0038,0x00DB,-1,0x0039,0x0000,-1,0x0050,0x0000,-1,0x0051,0x060A,-1,0x0052,0x0D0A,-1,0x0053,0x0303, \ -+-1,0x0054,0x0A0D,-1,0x0055,0x0A06,-1,0x0056,0x0000,-1,0x0057,0x0303,-1,0x0058,0x0000,-1,0x0059,0x0000,-2,50, \ -+-1,0x0007,0x1017,-2,50,-3 }; -+ -+static int ili9320_init[] = { \ -+-1,0x00E5,0x8000,-1,0x0000,0x0001,-1,0x0001,0x0100,-1,0x0002,0x0700,-1,0x0003,0x1030,-1,0x0004,0x0000,-1,0x0008,0x0202, \ -+-1,0x0009,0x0000,-1,0x000A,0x0000,-1,0x000C,0x0000,-1,0x000D,0x0000,-1,0x000F,0x0000,-1,0x0010,0x0000,-1,0x0011,0x0007, \ -+-1,0x0012,0x0000,-1,0x0013,0x0000,-2,200,-1,0x0010,0x17B0,-1,0x0011,0x0031,-2,50,-1,0x0012,0x0138,-2,50,-1,0x0013,0x1800, \ -+-1,0x0029,0x0008,-2,50,-1,0x0020,0x0000,-1,0x0021,0x0000,-1,0x0030,0x0000,-1,0x0031,0x0505,-1,0x0032,0x0004, \ -+-1,0x0035,0x0006,-1,0x0036,0x0707,-1,0x0037,0x0105,-1,0x0038,0x0002,-1,0x0039,0x0707,-1,0x003C,0x0704,-1,0x003D,0x0807, \ -+-1,0x0050,0x0000,-1,0x0051,0x00EF,-1,0x0052,0x0000,-1,0x0053,0x013F,-1,0x0060,0x2700,-1,0x0061,0x0001,-1,0x006A,0x0000, \ -+-1,0x0080,0x0000,-1,0x0081,0x0000,-1,0x0082,0x0000,-1,0x0083,0x0000,-1,0x0084,0x0000,-1,0x0085,0x0000,-1,0x0090,0x0010, \ -+-1,0x0092,0x0000,-1,0x0093,0x0003,-1,0x0095,0x0110,-1,0x0097,0x0000,-1,0x0098,0x0000,-1,0x0007,0x0173,-3 }; -+ -+static int ili9325_init[] = { \ -+-1,0x00E3,0x3008,-1,0x00E7,0x0012,-1,0x00EF,0x1231,-1,0x0001,0x0100,-1,0x0002,0x0700,-1,0x0003,0x1030,-1,0x0004,0x0000, \ -+-1,0x0008,0x0207,-1,0x0009,0x0000,-1,0x000A,0x0000,-1,0x000C,0x0000,-1,0x000D,0x0000,-1,0x000F,0x0000,-1,0x0010,0x0000, \ -+-1,0x0011,0x0007,-1,0x0012,0x0000,-1,0x0013,0x0000,-2,200,-1,0x0010,0x1690,-1,0x0011,0x0223,-2,50,-1,0x0012,0x000D,-2,50, \ -+-1,0x0013,0x1200,-1,0x0029,0x000A,-1,0x002B,0x000C,-2,50,-1,0x0020,0x0000,-1,0x0021,0x0000,-1,0x0030,0x0000, \ -+-1,0x0031,0x0506,-1,0x0032,0x0104,-1,0x0035,0x0207,-1,0x0036,0x000F,-1,0x0037,0x0306,-1,0x0038,0x0102,-1,0x0039,0x0707, \ -+-1,0x003C,0x0702,-1,0x003D,0x1604,-1,0x0050,0x0000,-1,0x0051,0x00EF,-1,0x0052,0x0000,-1,0x0053,0x013F,-1,0x0060,0xA700, \ -+-1,0x0061,0x0001,-1,0x006A,0x0000,-1,0x0080,0x0000,-1,0x0081,0x0000,-1,0x0082,0x0000,-1,0x0083,0x0000,-1,0x0084,0x0000, \ -+-1,0x0085,0x0000,-1,0x0090,0x0010,-1,0x0092,0x0600,-1,0x0007,0x0133,-3 }; -+ -+static int ili9341_init[] = { \ -+-1,0x28,-2,20,-1,0xCF,0x00,0x83,0x30,-1,0xED,0x64,0x03,0x12,0x81,-1,0xE8,0x85,0x01,0x79, \ -+-1,0xCB,0x39,0x2c,0x00,0x34,0x02,-1,0xF7,0x20,-1,0xEA,0x00,0x00,-1,0xC0,0x26,-1,0xC1,0x11, \ -+-1,0xC5,0x35,0x3E,-1,0xC7,0xBE,-1,0xB1,0x00,0x1B,-1,0xB6,0x0a,0x82,0x27,0x00,-1,0xB7,0x07, \ -+-1,0x3A,0x55,-1,0x36,0x48,-1,0x11,-2,120,-1,0x29,-2,20,-3 }; -+ -+static int ssd1351_init[] = { -1,0xfd,0x12,-1,0xfd,0xb1,-1,0xae,-1,0xb3,0xf1,-1,0xca,0x7f,-1,0xa0,0x74, \ -+ -1,0x15,0x00,0x7f,-1,0x75,0x00,0x7f,-1,0xa1,0x00,-1,0xa2,0x00,-1,0xb5,0x00, \ -+ -1,0xab,0x01,-1,0xb1,0x32,-1,0xb4,0xa0,0xb5,0x55,-1,0xbb,0x17,-1,0xbe,0x05, \ -+ -1,0xc1,0xc8,0x80,0xc8,-1,0xc7,0x0f,-1,0xb6,0x01,-1,0xa6,-1,0xaf,-3 }; -+ -+ -+/* ili9320, ili9325 */ -+static void flexfb_set_addr_win_1(struct fbtft_par *par, int xs, int ys, int xe, int ye) -+{ -+ fbtft_par_dbg(DEBUG_SET_ADDR_WIN, par, "%s(xs=%d, ys=%d, xe=%d, ye=%d)\n", __func__, xs, ys, xe, ye); -+ switch (par->info->var.rotate) { -+ /* R20h = Horizontal GRAM Start Address */ -+ /* R21h = Vertical GRAM Start Address */ -+ case 0: -+ write_reg(par, 0x0020, xs); -+ write_reg(par, 0x0021, ys); -+ break; -+ case 180: -+ write_reg(par, 0x0020, width - 1 - xs); -+ write_reg(par, 0x0021, height - 1 - ys); -+ break; -+ case 270: -+ write_reg(par, 0x0020, width - 1 - ys); -+ write_reg(par, 0x0021, xs); -+ break; -+ case 90: -+ write_reg(par, 0x0020, ys); -+ write_reg(par, 0x0021, height - 1 - xs); -+ break; -+ } -+ write_reg(par, 0x0022); /* Write Data to GRAM */ -+} -+ -+/* ssd1289 */ -+static void flexfb_set_addr_win_2(struct fbtft_par *par, int xs, int ys, int xe, int ye) -+{ -+ fbtft_par_dbg(DEBUG_SET_ADDR_WIN, par, "%s(xs=%d, ys=%d, xe=%d, ye=%d)\n", __func__, xs, ys, xe, ye); -+ -+ switch (par->info->var.rotate) { -+ /* R4Eh - Set GDDRAM X address counter */ -+ /* R4Fh - Set GDDRAM Y address counter */ -+ case 0: -+ write_reg(par, 0x4e, xs); -+ write_reg(par, 0x4f, ys); -+ break; -+ case 180: -+ write_reg(par, 0x4e, par->info->var.xres - 1 - xs); -+ write_reg(par, 0x4f, par->info->var.yres - 1 - ys); -+ break; -+ case 270: -+ write_reg(par, 0x4e, par->info->var.yres - 1 - ys); -+ write_reg(par, 0x4f, xs); -+ break; -+ case 90: -+ write_reg(par, 0x4e, ys); -+ write_reg(par, 0x4f, par->info->var.xres - 1 - xs); -+ break; -+ } -+ -+ /* R22h - RAM data write */ -+ write_reg(par, 0x22, 0); -+} -+ -+/* ssd1351 */ -+static void set_addr_win_3(struct fbtft_par *par, int xs, int ys, int xe, int ye) -+{ -+ fbtft_par_dbg(DEBUG_SET_ADDR_WIN, par, "%s(xs=%d, ys=%d, xe=%d, ye=%d)\n", __func__, xs, ys, xe, ye); -+ -+ write_reg(par, 0x15, xs, xe); -+ write_reg(par, 0x75, ys, ye); -+ write_reg(par, 0x5C); -+} -+ -+static int flexfb_verify_gpios_dc(struct fbtft_par *par) -+{ -+ fbtft_par_dbg(DEBUG_VERIFY_GPIOS, par, "%s()\n", __func__); -+ -+ if (par->gpio.dc < 0) { -+ dev_err(par->info->device, "Missing info about 'dc' gpio. Aborting.\n"); -+ return -EINVAL; -+ } -+ -+ return 0; -+} -+ -+static int flexfb_verify_gpios_db(struct fbtft_par *par) -+{ -+ int i; -+ int num_db = buswidth; -+ -+ fbtft_par_dbg(DEBUG_VERIFY_GPIOS, par, "%s()\n", __func__); -+ -+ if (par->gpio.dc < 0) { -+ dev_err(par->info->device, "Missing info about 'dc' gpio. Aborting.\n"); -+ return -EINVAL; -+ } -+ if (par->gpio.wr < 0) { -+ dev_err(par->info->device, "Missing info about 'wr' gpio. Aborting.\n"); -+ return -EINVAL; -+ } -+ if (latched && (par->gpio.latch < 0)) { -+ dev_err(par->info->device, "Missing info about 'latch' gpio. Aborting.\n"); -+ return -EINVAL; -+ } -+ if (latched) -+ num_db=buswidth/2; -+ for (i=0;i < num_db;i++) { -+ if (par->gpio.db[i] < 0) { -+ dev_err(par->info->device, "Missing info about 'db%02d' gpio. Aborting.\n", i); -+ return -EINVAL; -+ } -+ } -+ -+ return 0; -+} -+ -+static struct fbtft_display flex_display = { }; -+ -+static int flexfb_probe_common(struct spi_device *sdev, struct platform_device *pdev) -+{ -+ struct device *dev; -+ struct fb_info *info; -+ struct fbtft_par *par; -+ int ret; -+ -+ initp = init; -+ initp_num = init_num; -+ -+ if (sdev) -+ dev = &sdev->dev; -+ else -+ dev = &pdev->dev; -+ -+ fbtft_init_dbg(dev, "%s(%s)\n", __func__, sdev ? "'SPI device'" : "'Platform device'"); -+ -+ if (chip) { -+ -+ if (!strcmp(chip, "st7735r")) { -+ if (!width) -+ width = 128; -+ if (!height) -+ height = 160; -+ if (init_num == 0) { -+ initp = st7735r_init; -+ initp_num = ARRAY_SIZE(st7735r_init); -+ } -+ -+ -+ } else if (!strcmp(chip, "hx8340bn")) { -+ if (!width) -+ width = 176; -+ if (!height) -+ height = 220; -+ setaddrwin = 0; -+ if (init_num == 0) { -+ initp = hx8340bn_init; -+ initp_num = ARRAY_SIZE(hx8340bn_init); -+ } -+ -+ -+ } else if (!strcmp(chip, "ili9225")) { -+ if (!width) -+ width = 176; -+ if (!height) -+ height = 220; -+ setaddrwin = 0; -+ regwidth = 16; -+ if (init_num == 0) { -+ initp = ili9225_init; -+ initp_num = ARRAY_SIZE(ili9225_init); -+ } -+ -+ -+ -+ } else if (!strcmp(chip, "ili9320")) { -+ if (!width) -+ width = 240; -+ if (!height) -+ height = 320; -+ setaddrwin = 1; -+ regwidth = 16; -+ if (init_num == 0) { -+ initp = ili9320_init; -+ initp_num = ARRAY_SIZE(ili9320_init); -+ } -+ -+ -+ } else if (!strcmp(chip, "ili9325")) { -+ if (!width) -+ width = 240; -+ if (!height) -+ height = 320; -+ setaddrwin = 1; -+ regwidth = 16; -+ if (init_num == 0) { -+ initp = ili9325_init; -+ initp_num = ARRAY_SIZE(ili9325_init); -+ } -+ -+ } else if (!strcmp(chip, "ili9341")) { -+ if (!width) -+ width = 240; -+ if (!height) -+ height = 320; -+ setaddrwin = 0; -+ regwidth = 8; -+ if (init_num == 0) { -+ initp = ili9341_init; -+ initp_num = ARRAY_SIZE(ili9341_init); -+ } -+ -+ -+ } else if (!strcmp(chip, "ssd1289")) { -+ if (!width) -+ width = 240; -+ if (!height) -+ height = 320; -+ setaddrwin = 2; -+ regwidth = 16; -+ if (init_num == 0) { -+ initp = ssd1289_init; -+ initp_num = ARRAY_SIZE(ssd1289_init); -+ } -+ -+ -+ -+ } else if (!strcmp(chip, "ssd1351")) { -+ if (!width) -+ width = 128; -+ if (!height) -+ height = 128; -+ setaddrwin = 3; -+ if (init_num == 0) { -+ initp = ssd1351_init; -+ initp_num = ARRAY_SIZE(ssd1351_init); -+ } -+ } else { -+ dev_err(dev, "chip=%s is not supported\n", chip); -+ return -EINVAL; -+ } -+ } -+ -+ if (width == 0 || height == 0) { -+ dev_err(dev, "argument(s) missing: width and height has to be set.\n"); -+ return -EINVAL; -+ } -+ flex_display.width = width; -+ flex_display.height = height; -+ fbtft_init_dbg(dev, "Display resolution: %dx%d\n", width, height); -+ fbtft_init_dbg(dev, "chip = %s\n", chip ? chip : "not set"); -+ fbtft_init_dbg(dev, "setaddrwin = %d\n", setaddrwin); -+ fbtft_init_dbg(dev, "regwidth = %d\n", regwidth); -+ fbtft_init_dbg(dev, "buswidth = %d\n", buswidth); -+ -+ info = fbtft_framebuffer_alloc(&flex_display, dev); -+ if (!info) -+ return -ENOMEM; -+ -+ par = info->par; -+ if (sdev) -+ par->spi = sdev; -+ else -+ par->pdev = pdev; -+ if (!par->init_sequence) -+ par->init_sequence = initp; -+ par->fbtftops.init_display = fbtft_init_display; -+ -+ /* registerwrite functions */ -+ switch (regwidth) { -+ case 8: -+ par->fbtftops.write_register = fbtft_write_reg8_bus8; -+ break; -+ case 16: -+ par->fbtftops.write_register = fbtft_write_reg16_bus8; -+ break; -+ default: -+ dev_err(dev, "argument 'regwidth': %d is not supported.\n", regwidth); -+ return -EINVAL; -+ } -+ -+ /* bus functions */ -+ if (sdev) { -+ par->fbtftops.write = fbtft_write_spi; -+ switch (buswidth) { -+ case 8: -+ par->fbtftops.write_vmem = fbtft_write_vmem16_bus8; -+ if (!par->startbyte) -+ par->fbtftops.verify_gpios = flexfb_verify_gpios_dc; -+ break; -+ case 9: -+ if (regwidth == 16) { -+ dev_err(dev, "argument 'regwidth': %d is not supported with buswidth=%d and SPI.\n", regwidth, buswidth); -+ return -EINVAL; -+ } -+ par->fbtftops.write_register = fbtft_write_reg8_bus9; -+ par->fbtftops.write_vmem = fbtft_write_vmem16_bus9; -+ sdev->bits_per_word=9; -+ ret = sdev->master->setup(sdev); -+ if (ret) { -+ dev_warn(dev, -+ "9-bit SPI not available, emulating using 8-bit.\n"); -+ sdev->bits_per_word = 8; -+ ret = sdev->master->setup(sdev); -+ if (ret) -+ goto out_release; -+ /* allocate buffer with room for dc bits */ -+ par->extra = devm_kzalloc(par->info->device, -+ par->txbuf.len + (par->txbuf.len / 8) + 8, -+ GFP_KERNEL); -+ if (!par->extra) { -+ ret = -ENOMEM; -+ goto out_release; -+ } -+ par->fbtftops.write = fbtft_write_spi_emulate_9; -+ } -+ break; -+ default: -+ dev_err(dev, "argument 'buswidth': %d is not supported with SPI.\n", buswidth); -+ return -EINVAL; -+ } -+ } else { -+ par->fbtftops.verify_gpios = flexfb_verify_gpios_db; -+ switch (buswidth) { -+ case 8: -+ par->fbtftops.write = fbtft_write_gpio8_wr; -+ par->fbtftops.write_vmem = fbtft_write_vmem16_bus8; -+ break; -+ case 16: -+ par->fbtftops.write_register = fbtft_write_reg16_bus16; -+ if (latched) -+ par->fbtftops.write = fbtft_write_gpio16_wr_latched; -+ else -+ par->fbtftops.write = fbtft_write_gpio16_wr; -+ par->fbtftops.write_vmem = fbtft_write_vmem16_bus16; -+ break; -+ default: -+ dev_err(dev, "argument 'buswidth': %d is not supported with parallel.\n", buswidth); -+ return -EINVAL; -+ } -+ } -+ -+ /* set_addr_win function */ -+ switch (setaddrwin) { -+ case 0: -+ /* use default */ -+ break; -+ case 1: -+ par->fbtftops.set_addr_win = flexfb_set_addr_win_1; -+ break; -+ case 2: -+ par->fbtftops.set_addr_win = flexfb_set_addr_win_2; -+ break; -+ case 3: -+ par->fbtftops.set_addr_win = set_addr_win_3; -+ break; -+ default: -+ dev_err(dev, "argument 'setaddrwin': unknown value %d.\n", setaddrwin); -+ return -EINVAL; -+ } -+ -+ if (!nobacklight) -+ par->fbtftops.register_backlight = fbtft_register_backlight; -+ -+ ret = fbtft_register_framebuffer(info); -+ if (ret < 0) -+ goto out_release; -+ -+ return 0; -+ -+out_release: -+ fbtft_framebuffer_release(info); -+ -+ return ret; -+} -+ -+static int flexfb_remove_common(struct device *dev, struct fb_info *info) -+{ -+ struct fbtft_par *par; -+ -+ if (!info) -+ return -EINVAL; -+ par = info->par; -+ if (par) -+ fbtft_par_dbg(DEBUG_DRIVER_INIT_FUNCTIONS, par, -+ "%s()\n", __func__); -+ fbtft_unregister_framebuffer(info); -+ fbtft_framebuffer_release(info); -+ -+ return 0; -+} -+ -+static int flexfb_probe_spi(struct spi_device *spi) -+{ -+ return flexfb_probe_common(spi, NULL); -+} -+ -+static int flexfb_remove_spi(struct spi_device *spi) -+{ -+ struct fb_info *info = spi_get_drvdata(spi); -+ -+ return flexfb_remove_common(&spi->dev, info); -+} -+ -+static int flexfb_probe_pdev(struct platform_device *pdev) -+{ -+ return flexfb_probe_common(NULL, pdev); -+} -+ -+static int flexfb_remove_pdev(struct platform_device *pdev) -+{ -+ struct fb_info *info = platform_get_drvdata(pdev); -+ -+ return flexfb_remove_common(&pdev->dev, info); -+} -+ -+static struct spi_driver flexfb_spi_driver = { -+ .driver = { -+ .name = DRVNAME, -+ .owner = THIS_MODULE, -+ }, -+ .probe = flexfb_probe_spi, -+ .remove = flexfb_remove_spi, -+}; -+ -+static const struct platform_device_id flexfb_platform_ids[] = { -+ { "flexpfb", 0 }, -+ { }, -+}; -+ -+static struct platform_driver flexfb_platform_driver = { -+ .driver = { -+ .name = DRVNAME, -+ .owner = THIS_MODULE, -+ }, -+ .id_table = flexfb_platform_ids, -+ .probe = flexfb_probe_pdev, -+ .remove = flexfb_remove_pdev, -+}; -+ -+static int __init flexfb_init(void) -+{ -+ int ret, ret2; -+ -+ ret = spi_register_driver(&flexfb_spi_driver); -+ ret2 = platform_driver_register(&flexfb_platform_driver); -+ if (ret < 0) -+ return ret; -+ return ret2; -+} -+ -+static void __exit flexfb_exit(void) -+{ -+ spi_unregister_driver(&flexfb_spi_driver); -+ platform_driver_unregister(&flexfb_platform_driver); -+} -+ -+/* ------------------------------------------------------------------------- */ -+ -+module_init(flexfb_init); -+module_exit(flexfb_exit); -+ -+MODULE_DESCRIPTION("Generic FB driver for TFT LCD displays"); -+MODULE_AUTHOR("Noralf Tronnes"); -+MODULE_LICENSE("GPL"); diff --git a/patch/kernel/marvell-default/packaging-3.10-DEFAULT-with-postinstall-scripts.patch b/patch/kernel/marvell-default/packaging-3.10-DEFAULT-with-postinstall-scripts.patch deleted file mode 100644 index 8daa950474..0000000000 --- a/patch/kernel/marvell-default/packaging-3.10-DEFAULT-with-postinstall-scripts.patch +++ /dev/null @@ -1,375 +0,0 @@ -diff --git a/scripts/package/builddeb b/scripts/package/builddeb -old mode 100644 -new mode 100755 -index 3001ec5..dc76d3c ---- a/scripts/package/builddeb -+++ b/scripts/package/builddeb -@@ -35,15 +35,17 @@ create_package() { - sparc*) - debarch=sparc ;; - s390*) -- debarch=s390 ;; -+ debarch=s390$(grep -q CONFIG_64BIT=y $KCONFIG_CONFIG && echo x || true) ;; - ppc*) -- debarch=powerpc ;; -+ debarch=$(grep -q CPU_LITTLE_ENDIAN=y $KCONFIG_CONFIG && echo ppc64el || echo powerpc) ;; - parisc*) - debarch=hppa ;; - mips*) -- debarch=mips$(grep -q CPU_LITTLE_ENDIAN=y .config && echo el) ;; -+ debarch=mips$(grep -q CPU_LITTLE_ENDIAN=y $KCONFIG_CONFIG && echo el || true) ;; -+ arm64) -+ debarch=arm64 ;; - arm*) -- debarch=arm$(grep -q CONFIG_AEABI=y .config && echo el) ;; -+ debarch=arm$(grep -q CONFIG_AEABI=y $KCONFIG_CONFIG && echo el || true) ;; - *) - echo "" >&2 - echo "** ** ** WARNING ** ** **" >&2 -@@ -61,8 +63,30 @@ create_package() { - forcearch="-DArchitecture=$debarch" - fi - -+ # Create preinstall and post install script to remove dtb -+ if [[ "$1" == *dtb* ]]; then -+ echo "if [ -d /boot/dtb-$version ]; then mv /boot/dtb-$version /boot/dtb-$version.old; fi" >> $pdir/DEBIAN/preinst -+ echo "if [ -d /boot/dtb.old ]; then rm -rf /boot/dtb.old; fi" >> $pdir/DEBIAN/preinst -+ echo "if [ -d /dtb ]; then mv /dtb /dtb.old; fi" >> $pdir/DEBIAN/preinst -+ echo "if [ -d /boot/dtb ]; then mv /boot/dtb /boot/dtb.old; fi" >> $pdir/DEBIAN/preinst -+ echo "exit 0" >> $pdir/DEBIAN/preinst -+ chmod 775 $pdir/DEBIAN/preinst -+ # -+ echo "if [ -d /boot/dtb.old ]; then rm -rf /boot/dtb.old; fi" >> $pdir/DEBIAN/postinst -+ echo "ln -sf dtb-$version /boot/dtb > /dev/null 2>&1 || mv /boot/dtb-$version /boot/dtb" >> $pdir/DEBIAN/postinst -+ echo "exit 0" >> $pdir/DEBIAN/postinst -+ chmod 775 $pdir/DEBIAN/postinst -+ fi -+ -+ # Create postinstall script for headers -+ if [[ "$1" == *headers* ]]; then -+ echo "cd /usr/src/linux-headers-$version; echo \"Compiling headers - please wait ...\"; make -s scripts >/dev/null 2>&1" >> $pdir/DEBIAN/postinst -+ echo "exit 0" >> $pdir/DEBIAN/postinst -+ chmod 775 $pdir/DEBIAN/postinst -+ fi -+ - # Create the package -- dpkg-gencontrol -isp $forcearch -Vkernel:debarch="${debarch:-$(dpkg --print-architecture)}" -p$pname -P"$pdir" -+ dpkg-gencontrol $forcearch -Vkernel:debarch="${debarch:-$(dpkg --print-architecture)}" -p$pname -P"$pdir" - dpkg --build "$pdir" .. - } - -@@ -78,49 +102,76 @@ tmpdir="$objtree/debian/tmp" - fwdir="$objtree/debian/fwtmp" - kernel_headers_dir="$objtree/debian/hdrtmp" - libc_headers_dir="$objtree/debian/headertmp" --packagename=linux-image-$version --fwpackagename=linux-firmware-image --kernel_headers_packagename=linux-headers-$version --libc_headers_packagename=linux-libc-dev -+dtb_dir="$objtree/debian/dtbtmp" -+dbg_dir="$objtree/debian/dbgtmp" -+packagename=linux-image"$LOCALVERSION" -+fwpackagename=linux-firmware-image"$LOCALVERSION" -+kernel_headers_packagename=linux-headers"$LOCALVERSION" -+dtb_packagename=linux-dtb"$LOCALVERSION" -+libc_headers_packagename=linux-libc-dev"$LOCALVERSION" -+dbg_packagename=$packagename-dbg - - if [ "$ARCH" = "um" ] ; then - packagename=user-mode-linux-$version - fi - -+# Not all arches have the same installed path in debian -+# XXX: have each arch Makefile export a variable of the canonical image install -+# path instead -+case $ARCH in -+um) -+ installed_image_path="usr/bin/linux-$version" -+ ;; -+parisc|mips|powerpc) -+ installed_image_path="boot/vmlinux-$version" -+ ;; -+*) -+ installed_image_path="boot/vmlinuz-$version" -+esac -+ -+BUILD_DEBUG="$(grep -s '^CONFIG_DEBUG_INFO=y' $KCONFIG_CONFIG || true)" -+ - # Setup the directory structure --rm -rf "$tmpdir" "$fwdir" "$kernel_headers_dir" "$libc_headers_dir" -+rm -rf "$tmpdir" "$fwdir" "$kernel_headers_dir" "$libc_headers_dir" "$dbg_dir" "$dtb_dir" - mkdir -m 755 -p "$tmpdir/DEBIAN" - mkdir -p "$tmpdir/lib" "$tmpdir/boot" "$tmpdir/usr/share/doc/$packagename" - mkdir -m 755 -p "$fwdir/DEBIAN" - mkdir -p "$fwdir/lib/firmware/$version/" "$fwdir/usr/share/doc/$fwpackagename" - mkdir -m 755 -p "$libc_headers_dir/DEBIAN" - mkdir -p "$libc_headers_dir/usr/share/doc/$libc_headers_packagename" -+ -+mkdir -m 755 -p "$dtb_dir/DEBIAN" -+mkdir -p "$dtb_dir/boot/dtb-$version" "$dtb_dir/usr/share/doc/$dtb_packagename" -+ - mkdir -m 755 -p "$kernel_headers_dir/DEBIAN" - mkdir -p "$kernel_headers_dir/usr/share/doc/$kernel_headers_packagename" - mkdir -p "$kernel_headers_dir/lib/modules/$version/" - if [ "$ARCH" = "um" ] ; then - mkdir -p "$tmpdir/usr/lib/uml/modules/$version" "$tmpdir/usr/bin" - fi -+if [ -n "$BUILD_DEBUG" ] ; then -+ mkdir -p "$dbg_dir/usr/share/doc/$dbg_packagename" -+ mkdir -m 755 -p "$dbg_dir/DEBIAN" -+fi - - # Build and install the kernel - if [ "$ARCH" = "um" ] ; then - $MAKE linux - cp System.map "$tmpdir/usr/lib/uml/modules/$version/System.map" -- cp .config "$tmpdir/usr/share/doc/$packagename/config" -+ cp $KCONFIG_CONFIG "$tmpdir/usr/share/doc/$packagename/config" - gzip "$tmpdir/usr/share/doc/$packagename/config" -- cp $KBUILD_IMAGE "$tmpdir/usr/bin/linux-$version" --else -+else - cp System.map "$tmpdir/boot/System.map-$version" -- cp .config "$tmpdir/boot/config-$version" -- # Not all arches include the boot path in KBUILD_IMAGE -- if [ -e $KBUILD_IMAGE ]; then -- cp $KBUILD_IMAGE "$tmpdir/boot/vmlinuz-$version" -- else -- cp arch/$ARCH/boot/$KBUILD_IMAGE "$tmpdir/boot/vmlinuz-$version" -- fi -+ cp $KCONFIG_CONFIG "$tmpdir/boot/config-$version" -+fi -+# Not all arches include the boot path in KBUILD_IMAGE -+if [ -e $KBUILD_IMAGE ]; then -+ cp $KBUILD_IMAGE "$tmpdir/$installed_image_path" -+else -+ cp arch/$ARCH/boot/$KBUILD_IMAGE "$tmpdir/$installed_image_path" - fi - --if grep -q '^CONFIG_MODULES=y' .config ; then -+if grep -q '^CONFIG_MODULES=y' $KCONFIG_CONFIG ; then - INSTALL_MOD_PATH="$tmpdir" $MAKE KBUILD_SRC= modules_install - rm -f "$tmpdir/lib/modules/$version/build" - rm -f "$tmpdir/lib/modules/$version/source" -@@ -128,6 +179,24 @@ if grep -q '^CONFIG_MODULES=y' .config ; then - mv "$tmpdir/lib/modules/$version"/* "$tmpdir/usr/lib/uml/modules/$version/" - rmdir "$tmpdir/lib/modules/$version" - fi -+ if [ -n "$BUILD_DEBUG" ] ; then -+ for module in $(find $tmpdir/lib/modules/ -name *.ko -printf '%P\n'); do -+ module=lib/modules/$module -+ mkdir -p $(dirname $dbg_dir/usr/lib/debug/$module) -+ # only keep debug symbols in the debug file -+ $OBJCOPY --only-keep-debug $tmpdir/$module $dbg_dir/usr/lib/debug/$module -+ # strip original module from debug symbols -+ $OBJCOPY --strip-debug $tmpdir/$module -+ # then add a link to those -+ $OBJCOPY --add-gnu-debuglink=$dbg_dir/usr/lib/debug/$module $tmpdir/$module -+ done -+ fi -+fi -+ -+if grep -q '^CONFIG_OF=y' $KCONFIG_CONFIG ; then -+ mkdir -p "$tmpdir/boot/dtb-""$version" -+ cp $objtree/arch/arm/boot/dts/*.dtb $dtb_dir/boot/dtb-$version -+ #INSTALL_DTBS_PATH="$dtb_dir/boot/dtb" $MAKE KBUILD_SRC= dtbs_install - fi - - if [ "$ARCH" != "um" ]; then -@@ -137,8 +206,15 @@ fi - - # Install the maintainer scripts - # Note: hook scripts under /etc/kernel are also executed by official Debian --# kernel packages, as well as kernel packages built using make-kpkg -+# kernel packages, as well as kernel packages built using make-kpkg. -+# make-kpkg sets $INITRD to indicate whether an initramfs is wanted, and -+# so do we; recent versions of dracut and initramfs-tools will obey this. - debhookdir=${KDEB_HOOKDIR:-/etc/kernel} -+if grep -q '^CONFIG_BLK_DEV_INITRD=y' $KCONFIG_CONFIG; then -+ want_initrd=Yes -+else -+ want_initrd=No -+fi - for script in postinst postrm preinst prerm ; do - mkdir -p "$tmpdir$debhookdir/$script.d" - cat < "$tmpdir/DEBIAN/$script" -@@ -147,14 +223,61 @@ for script in postinst postrm preinst prerm ; do - set -e - - # Pass maintainer script parameters to hook scripts -+ - export DEB_MAINT_PARAMS="\$*" - --test -d $debhookdir/$script.d && run-parts --arg="$version" $debhookdir/$script.d -+# Tell initramfs builder whether it's wanted -+ -+export INITRD=$want_initrd -+ -+test -d $debhookdir/$script.d && run-parts --arg="$version" --arg="/$installed_image_path" $debhookdir/$script.d - exit 0 - EOF - chmod 755 "$tmpdir/DEBIAN/$script" - done - -+## -+## Create sym link to kernel image -+## -+kernel_tmp_version="${installed_image_path////\\/}" -+sed -e "s/set -e//g" -i $tmpdir/DEBIAN/postinst -+sed -e "s/exit 0//g" -i $tmpdir/DEBIAN/postinst -+cat >> $tmpdir/DEBIAN/postinst < /dev/null 2>&1 || mv /$kernel_tmp_version /boot/zImage -+ -+ -+exit 0 -+EOT -+## -+## FAT install workaround -+## -+sed -e "s/set -e//g" -i $tmpdir/DEBIAN/preinst -+sed -e "s/exit 0//g" -i $tmpdir/DEBIAN/preinst -+cat >> $tmpdir/DEBIAN/preinst <> $tmpdir/DEBIAN/preinst -+ -+ - # Try to determine maintainer and email values - if [ -n "$DEBEMAIL" ]; then - email=$DEBEMAIL -@@ -172,9 +299,19 @@ else - fi - maintainer="$name <$email>" - -+# Try to determine distribution -+if [ -n "$KDEB_CHANGELOG_DIST" ]; then -+ distribution=$KDEB_CHANGELOG_DIST -+elif distribution=$(lsb_release -cs 2>/dev/null) && [ -n "$distribution" ]; then -+ : # nothing to do in this case -+else -+ distribution="unstable" -+ echo >&2 "Using default distribution of 'unstable' in the changelog" -+ echo >&2 "Install lsb-release or set \$KDEB_CHANGELOG_DIST explicitly" -+fi - # Generate a simple changelog template - cat < debian/changelog --linux-upstream ($packageversion) unstable; urgency=low -+linux-upstream ($packageversion) $distribution; urgency=low - - * Custom built Linux kernel. - -@@ -242,21 +379,32 @@ EOF - - fi - --# Build header package --(cd $srctree; find . -name Makefile\* -o -name Kconfig\* -o -name \*.pl > "$objtree/debian/hdrsrcfiles") --(cd $srctree; find arch/$SRCARCH/include include scripts -type f >> "$objtree/debian/hdrsrcfiles") --(cd $objtree; find arch/$SRCARCH/include .config Module.symvers include scripts -type f >> "$objtree/debian/hdrobjfiles") -+# Build kernel header package -+(cd $srctree; find . -name Makefile\* -o -name Kconfig\* -o -name \*.pl) > "$objtree/debian/hdrsrcfiles" -+(cd $srctree; find arch/$SRCARCH/include include scripts -type f) >> "$objtree/debian/hdrsrcfiles" -+(cd $srctree; find arch/$SRCARCH -name module.lds -o -name Kbuild.platforms -o -name Platform) >> "$objtree/debian/hdrsrcfiles" -+(cd $srctree; find $(find arch/$SRCARCH -name include -o -name scripts -type d) -type f) >> "$objtree/debian/hdrsrcfiles" -+(cd $objtree; find arch/$SRCARCH/include Module.symvers include scripts -type f) >> "$objtree/debian/hdrobjfiles" - destdir=$kernel_headers_dir/usr/src/linux-headers-$version - mkdir -p "$destdir" --(cd $srctree; tar -c -f - -T "$objtree/debian/hdrsrcfiles") | (cd $destdir; tar -xf -) --(cd $objtree; tar -c -f - -T "$objtree/debian/hdrobjfiles") | (cd $destdir; tar -xf -) -+######################## headers patch -+ZACNI=$(pwd) -+cd $destdir -+patch -p1 < /tmp/headers-debian-byteshift.patch -+cd $ZACNI -+######################## headers patch -+(cd $srctree; tar -c -f - -T -) < "$objtree/debian/hdrsrcfiles" | (cd $destdir; tar -xf -) -+(cd $objtree; tar -c -f - -T -) < "$objtree/debian/hdrobjfiles" | (cd $destdir; tar -xf -) -+(cd $objtree; cp $KCONFIG_CONFIG $destdir/.config) # copy .config manually to be where it's expected to be - ln -sf "/usr/src/linux-headers-$version" "$kernel_headers_dir/lib/modules/$version/build" - rm -f "$objtree/debian/hdrsrcfiles" "$objtree/debian/hdrobjfiles" - -+(cd "$destdir"; make M=scripts clean) -+ - cat <> debian/control - - Package: $kernel_headers_packagename --Provides: linux-headers, linux-headers-2.6 -+Provides: linux-headers - Architecture: any - Description: Linux kernel headers for $KERNELRELEASE on \${kernel:debarch} - This package provides kernel header files for $KERNELRELEASE on \${kernel:debarch} -@@ -282,6 +430,16 @@ fi - - cat <> debian/control - -+Package: $dtb_packagename -+Architecture: any -+Description: Linux DTB, version $version -+ This package contains device blobs from the Linux kernel, version $version. -+EOF -+ -+create_package "$dtb_packagename" "$dtb_dir" -+ -+cat <> debian/control -+ - Package: $libc_headers_packagename - Section: devel - Provides: linux-kernel-headers -@@ -293,9 +451,35 @@ EOF - - if [ "$ARCH" != "um" ]; then - create_package "$kernel_headers_packagename" "$kernel_headers_dir" -- create_package "$libc_headers_packagename" "$libc_headers_dir" -+# create_package "$libc_headers_packagename" "$libc_headers_dir" - fi - - create_package "$packagename" "$tmpdir" - --exit 0 -+if [ -n "$BUILD_DEBUG" ] ; then -+ # Build debug package -+ # Different tools want the image in different locations -+ # perf -+ mkdir -p $dbg_dir/usr/lib/debug/lib/modules/$version/ -+ cp vmlinux $dbg_dir/usr/lib/debug/lib/modules/$version/ -+ # systemtap -+ mkdir -p $dbg_dir/usr/lib/debug/boot/ -+ ln -s ../lib/modules/$version/vmlinux $dbg_dir/usr/lib/debug/boot/vmlinux-$version -+ # kdump-tools -+ ln -s lib/modules/$version/vmlinux $dbg_dir/usr/lib/debug/vmlinux-$version -+ -+ cat <> debian/control -+ -+Package: $dbg_packagename -+Section: debug -+Provides: linux-debug, linux-debug-$version -+Architecture: any -+Description: Linux kernel debugging symbols for $version -+ This package will come in handy if you need to debug the kernel. It provides -+ all the necessary debug symbols for the kernel and its modules. -+EOF -+ -+ create_package "$dbg_packagename" "$dbg_dir" -+fi -+ -+exit 0 -\ No newline at end of file diff --git a/patch/kernel/marvell-next/bash_to_afterinstall.patch b/patch/kernel/marvell-next/bash_to_afterinstall.patch deleted file mode 100644 index ce95ec007b..0000000000 --- a/patch/kernel/marvell-next/bash_to_afterinstall.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/scripts/package/builddeb -+++ b/scripts/package/builddeb -@@ -218,7 +218,7 @@ - for script in postinst postrm preinst prerm ; do - mkdir -p "$tmpdir$debhookdir/$script.d" - cat < "$tmpdir/DEBIAN/$script" --#!/bin/sh -+#!/bin/bash - - set -e - diff --git a/patch/kernel/marvell-next/unlock_atheros_regulatory_restrictions.patch b/patch/kernel/marvell-next/unlock_atheros_regulatory_restrictions.patch deleted file mode 100644 index 65324ca249..0000000000 --- a/patch/kernel/marvell-next/unlock_atheros_regulatory_restrictions.patch +++ /dev/null @@ -1,70 +0,0 @@ -diff --git a/drivers/net/wireless/ath/regd.c b/drivers/net/wireless/ath/regd.c -index ccc4c71..71a4d00 100644 ---- a/drivers/net/wireless/ath/regd.c -+++ b/drivers/net/wireless/ath/regd.c -@@ -49,12 +49,9 @@ static int __ath_regd_init(struct ath_regulatory *reg); - #define ATH9K_5GHZ_5725_5850 REG_RULE(5725-10, 5850+10, 40, 0, 30,\ - NL80211_RRF_PASSIVE_SCAN | NL80211_RRF_NO_IBSS) - --#define ATH9K_2GHZ_ALL ATH9K_2GHZ_CH01_11, \ -- ATH9K_2GHZ_CH12_13, \ -- ATH9K_2GHZ_CH14 -+#define ATH9K_2GHZ_ALL REG_RULE(2400, 2483, 40, 0, 30, 0) - --#define ATH9K_5GHZ_ALL ATH9K_5GHZ_5150_5350, \ -- ATH9K_5GHZ_5470_5850 -+#define ATH9K_5GHZ_ALL REG_RULE(5140, 5860, 40, 0, 30, 0) - - /* This one skips what we call "mid band" */ - #define ATH9K_5GHZ_NO_MIDBAND ATH9K_5GHZ_5150_5350, \ -@@ -76,9 +73,8 @@ static const struct ieee80211_regdomain ath_world_regdom_63_65 = { - .n_reg_rules = 4, - .alpha2 = "99", - .reg_rules = { -- ATH9K_2GHZ_CH01_11, -- ATH9K_2GHZ_CH12_13, -- ATH9K_5GHZ_NO_MIDBAND, -+ ATH9K_2GHZ_ALL, -+ ATH9K_5GHZ_ALL, - } - }; - -@@ -87,8 +83,8 @@ static const struct ieee80211_regdomain ath_world_regdom_64 = { - .n_reg_rules = 3, - .alpha2 = "99", - .reg_rules = { -- ATH9K_2GHZ_CH01_11, -- ATH9K_5GHZ_NO_MIDBAND, -+ ATH9K_2GHZ_ALL, -+ ATH9K_5GHZ_ALL, - } - }; - -@@ -97,7 +93,7 @@ static const struct ieee80211_regdomain ath_world_regdom_66_69 = { - .n_reg_rules = 3, - .alpha2 = "99", - .reg_rules = { -- ATH9K_2GHZ_CH01_11, -+ ATH9K_2GHZ_ALL, - ATH9K_5GHZ_ALL, - } - }; -@@ -107,8 +103,7 @@ static const struct ieee80211_regdomain ath_world_regdom_67_68_6A_6C = { - .n_reg_rules = 4, - .alpha2 = "99", - .reg_rules = { -- ATH9K_2GHZ_CH01_11, -- ATH9K_2GHZ_CH12_13, -+ ATH9K_2GHZ_ALL, - ATH9K_5GHZ_ALL, - } - }; -@@ -174,7 +169,7 @@ EXPORT_SYMBOL(ath_is_49ghz_allowed); - /* Frequency is one where radar detection is required */ - static bool ath_is_radar_freq(u16 center_freq) - { -- return (center_freq >= 5260 && center_freq <= 5700); -+ return false; - } - - /* diff --git a/patch/kernel/marvell-dev/0001-block-cgroups-kconfig-build-bits-for-BFQ-v7r11-4.4.0.patch b/patch/kernel/mvebu-default/0001-block-cgroups-kconfig-build-bits-for-BFQ-v7r11-4.4.0.patch similarity index 100% rename from patch/kernel/marvell-dev/0001-block-cgroups-kconfig-build-bits-for-BFQ-v7r11-4.4.0.patch rename to patch/kernel/mvebu-default/0001-block-cgroups-kconfig-build-bits-for-BFQ-v7r11-4.4.0.patch diff --git a/patch/kernel/marvell-dev/0002-block-introduce-the-BFQ-v7r11-I-O-sched-for-4.4.0.patch b/patch/kernel/mvebu-default/0002-block-introduce-the-BFQ-v7r11-I-O-sched-for-4.4.0.patch similarity index 100% rename from patch/kernel/marvell-dev/0002-block-introduce-the-BFQ-v7r11-I-O-sched-for-4.4.0.patch rename to patch/kernel/mvebu-default/0002-block-introduce-the-BFQ-v7r11-I-O-sched-for-4.4.0.patch diff --git a/patch/kernel/marvell-dev/0003-block-bfq-add-Early-Queue-Merge-EQM-to-BFQ-v7r11-for.patch b/patch/kernel/mvebu-default/0003-block-bfq-add-Early-Queue-Merge-EQM-to-BFQ-v7r11-for.patch similarity index 100% rename from patch/kernel/marvell-dev/0003-block-bfq-add-Early-Queue-Merge-EQM-to-BFQ-v7r11-for.patch rename to patch/kernel/mvebu-default/0003-block-bfq-add-Early-Queue-Merge-EQM-to-BFQ-v7r11-for.patch diff --git a/patch/kernel/marvell-dev/add-dtb-file-for-backwards-compatibility.patch b/patch/kernel/mvebu-default/add-dtb-file-for-backwards-compatibility.patch similarity index 100% rename from patch/kernel/marvell-dev/add-dtb-file-for-backwards-compatibility.patch rename to patch/kernel/mvebu-default/add-dtb-file-for-backwards-compatibility.patch diff --git a/patch/kernel/marvell-dev/add-spi-flash.patch b/patch/kernel/mvebu-default/add-spi-flash.patch similarity index 100% rename from patch/kernel/marvell-dev/add-spi-flash.patch rename to patch/kernel/mvebu-default/add-spi-flash.patch diff --git a/patch/kernel/marvell-default/bash_to_afterinstall.patch b/patch/kernel/mvebu-default/bash_to_afterinstall.patch similarity index 100% rename from patch/kernel/marvell-default/bash_to_afterinstall.patch rename to patch/kernel/mvebu-default/bash_to_afterinstall.patch diff --git a/patch/kernel/marvell-dev/packaging-4.x-DEV-with-postinstall-scripts.patch b/patch/kernel/mvebu-default/packaging-4.x-DEV-with-postinstall-scripts.patch similarity index 100% rename from patch/kernel/marvell-dev/packaging-4.x-DEV-with-postinstall-scripts.patch rename to patch/kernel/mvebu-default/packaging-4.x-DEV-with-postinstall-scripts.patch diff --git a/patch/kernel/marvell-dev/patch-4.4.30-31.patch b/patch/kernel/mvebu-default/patch-4.4.30-31.patch similarity index 100% rename from patch/kernel/marvell-dev/patch-4.4.30-31.patch rename to patch/kernel/mvebu-default/patch-4.4.30-31.patch diff --git a/patch/kernel/marvell-dev/patch-4.4.31-32.patch b/patch/kernel/mvebu-default/patch-4.4.31-32.patch similarity index 100% rename from patch/kernel/marvell-dev/patch-4.4.31-32.patch rename to patch/kernel/mvebu-default/patch-4.4.31-32.patch diff --git a/patch/kernel/marvell-dev/patch-4.4.32-33.patch b/patch/kernel/mvebu-default/patch-4.4.32-33.patch similarity index 100% rename from patch/kernel/marvell-dev/patch-4.4.32-33.patch rename to patch/kernel/mvebu-default/patch-4.4.32-33.patch diff --git a/patch/kernel/marvell-dev/patch-4.4.33-34.patch b/patch/kernel/mvebu-default/patch-4.4.33-34.patch similarity index 100% rename from patch/kernel/marvell-dev/patch-4.4.33-34.patch rename to patch/kernel/mvebu-default/patch-4.4.33-34.patch diff --git a/patch/kernel/marvell-dev/patch-4.4.34-35.patch b/patch/kernel/mvebu-default/patch-4.4.34-35.patch similarity index 100% rename from patch/kernel/marvell-dev/patch-4.4.34-35.patch rename to patch/kernel/mvebu-default/patch-4.4.34-35.patch diff --git a/patch/kernel/marvell-dev/patch-4.4.35-36.patch b/patch/kernel/mvebu-default/patch-4.4.35-36.patch similarity index 100% rename from patch/kernel/marvell-dev/patch-4.4.35-36.patch rename to patch/kernel/mvebu-default/patch-4.4.35-36.patch diff --git a/patch/kernel/marvell-dev/patch-4.4.36-37.patch b/patch/kernel/mvebu-default/patch-4.4.36-37.patch similarity index 100% rename from patch/kernel/marvell-dev/patch-4.4.36-37.patch rename to patch/kernel/mvebu-default/patch-4.4.36-37.patch diff --git a/patch/kernel/marvell-default/unlock_atheros_regulatory_restrictions.patch b/patch/kernel/mvebu-default/unlock_atheros_regulatory_restrictions.patch similarity index 100% rename from patch/kernel/marvell-default/unlock_atheros_regulatory_restrictions.patch rename to patch/kernel/mvebu-default/unlock_atheros_regulatory_restrictions.patch diff --git a/patch/kernel/marvell-next/0001-cpuidle-mvebu-indicate-failure-to-enter-deeper-sleep.patch b/patch/kernel/mvebu-next/0001-cpuidle-mvebu-indicate-failure-to-enter-deeper-sleep.patch similarity index 100% rename from patch/kernel/marvell-next/0001-cpuidle-mvebu-indicate-failure-to-enter-deeper-sleep.patch rename to patch/kernel/mvebu-next/0001-cpuidle-mvebu-indicate-failure-to-enter-deeper-sleep.patch diff --git a/patch/kernel/marvell-next/0007-phy-provide-a-hook-for-link-up-link-down-events.patch b/patch/kernel/mvebu-next/0007-phy-provide-a-hook-for-link-up-link-down-events.patch similarity index 100% rename from patch/kernel/marvell-next/0007-phy-provide-a-hook-for-link-up-link-down-events.patch rename to patch/kernel/mvebu-next/0007-phy-provide-a-hook-for-link-up-link-down-events.patch diff --git a/patch/kernel/marvell-next/0008-phy-marvell-88E1512-add-flow-control-support.patch b/patch/kernel/mvebu-next/0008-phy-marvell-88E1512-add-flow-control-support.patch similarity index 100% rename from patch/kernel/marvell-next/0008-phy-marvell-88E1512-add-flow-control-support.patch rename to patch/kernel/mvebu-next/0008-phy-marvell-88E1512-add-flow-control-support.patch diff --git a/patch/kernel/marvell-next/0009-phy-export-phy_start_machine-for-phylink.patch b/patch/kernel/mvebu-next/0009-phy-export-phy_start_machine-for-phylink.patch similarity index 100% rename from patch/kernel/marvell-next/0009-phy-export-phy_start_machine-for-phylink.patch rename to patch/kernel/mvebu-next/0009-phy-export-phy_start_machine-for-phylink.patch diff --git a/patch/kernel/marvell-next/0010-phy-export-phy_speed_to_str-for-phylink.patch b/patch/kernel/mvebu-next/0010-phy-export-phy_speed_to_str-for-phylink.patch similarity index 100% rename from patch/kernel/marvell-next/0010-phy-export-phy_speed_to_str-for-phylink.patch rename to patch/kernel/mvebu-next/0010-phy-export-phy_speed_to_str-for-phylink.patch diff --git a/patch/kernel/marvell-next/0011-phy-add-I2C-mdio-bus.patch b/patch/kernel/mvebu-next/0011-phy-add-I2C-mdio-bus.patch similarity index 100% rename from patch/kernel/marvell-next/0011-phy-add-I2C-mdio-bus.patch rename to patch/kernel/mvebu-next/0011-phy-add-I2C-mdio-bus.patch diff --git a/patch/kernel/marvell-next/0012-phylink-add-phylink-infrastructure.patch b/patch/kernel/mvebu-next/0012-phylink-add-phylink-infrastructure.patch similarity index 100% rename from patch/kernel/marvell-next/0012-phylink-add-phylink-infrastructure.patch rename to patch/kernel/mvebu-next/0012-phylink-add-phylink-infrastructure.patch diff --git a/patch/kernel/marvell-next/0013-phylink-add-hooks-for-SFP-support.patch b/patch/kernel/mvebu-next/0013-phylink-add-hooks-for-SFP-support.patch similarity index 100% rename from patch/kernel/marvell-next/0013-phylink-add-hooks-for-SFP-support.patch rename to patch/kernel/mvebu-next/0013-phylink-add-hooks-for-SFP-support.patch diff --git a/patch/kernel/marvell-next/0014-sfp-add-phylink-based-SFP-module-support.patch b/patch/kernel/mvebu-next/0014-sfp-add-phylink-based-SFP-module-support.patch similarity index 100% rename from patch/kernel/marvell-next/0014-sfp-add-phylink-based-SFP-module-support.patch rename to patch/kernel/mvebu-next/0014-sfp-add-phylink-based-SFP-module-support.patch diff --git a/patch/kernel/marvell-next/0015-sfp-display-SFP-module-information.patch b/patch/kernel/mvebu-next/0015-sfp-display-SFP-module-information.patch similarity index 100% rename from patch/kernel/marvell-next/0015-sfp-display-SFP-module-information.patch rename to patch/kernel/mvebu-next/0015-sfp-display-SFP-module-information.patch diff --git a/patch/kernel/marvell-next/0018-phylink-add-ethtool-nway_reset-support.patch b/patch/kernel/mvebu-next/0018-phylink-add-ethtool-nway_reset-support.patch similarity index 100% rename from patch/kernel/marvell-next/0018-phylink-add-ethtool-nway_reset-support.patch rename to patch/kernel/mvebu-next/0018-phylink-add-ethtool-nway_reset-support.patch diff --git a/patch/kernel/marvell-next/0020-phylink-add-flow-control-support.patch b/patch/kernel/mvebu-next/0020-phylink-add-flow-control-support.patch similarity index 100% rename from patch/kernel/marvell-next/0020-phylink-add-flow-control-support.patch rename to patch/kernel/mvebu-next/0020-phylink-add-flow-control-support.patch diff --git a/patch/kernel/marvell-next/0023-phylink-add-EEE-support.patch b/patch/kernel/mvebu-next/0023-phylink-add-EEE-support.patch similarity index 100% rename from patch/kernel/marvell-next/0023-phylink-add-EEE-support.patch rename to patch/kernel/mvebu-next/0023-phylink-add-EEE-support.patch diff --git a/patch/kernel/marvell-next/0025-phylink-add-module-EEPROM-support.patch b/patch/kernel/mvebu-next/0025-phylink-add-module-EEPROM-support.patch similarity index 100% rename from patch/kernel/marvell-next/0025-phylink-add-module-EEPROM-support.patch rename to patch/kernel/mvebu-next/0025-phylink-add-module-EEPROM-support.patch diff --git a/patch/kernel/marvell-next/0027-sfp-phylink-hook-up-eeprom-functions.patch b/patch/kernel/mvebu-next/0027-sfp-phylink-hook-up-eeprom-functions.patch similarity index 100% rename from patch/kernel/marvell-next/0027-sfp-phylink-hook-up-eeprom-functions.patch rename to patch/kernel/mvebu-next/0027-sfp-phylink-hook-up-eeprom-functions.patch diff --git a/patch/kernel/marvell-next/0029-ARM-dts-add-SFP-module-support-for-Clearfog.patch b/patch/kernel/mvebu-next/0029-ARM-dts-add-SFP-module-support-for-Clearfog.patch similarity index 100% rename from patch/kernel/marvell-next/0029-ARM-dts-add-SFP-module-support-for-Clearfog.patch rename to patch/kernel/mvebu-next/0029-ARM-dts-add-SFP-module-support-for-Clearfog.patch diff --git a/patch/kernel/marvell-next/0030-ARM-dts-Add-Clearfog-A1-rev-2.0-DT-file.patch b/patch/kernel/mvebu-next/0030-ARM-dts-Add-Clearfog-A1-rev-2.0-DT-file.patch similarity index 100% rename from patch/kernel/marvell-next/0030-ARM-dts-Add-Clearfog-A1-rev-2.0-DT-file.patch rename to patch/kernel/mvebu-next/0030-ARM-dts-Add-Clearfog-A1-rev-2.0-DT-file.patch diff --git a/patch/kernel/marvell-next/0040-updates.patch b/patch/kernel/mvebu-next/0040-updates.patch similarity index 100% rename from patch/kernel/marvell-next/0040-updates.patch rename to patch/kernel/mvebu-next/0040-updates.patch diff --git a/patch/kernel/marvell-next/0041-implement-slot-capabilities-SSPL.patch b/patch/kernel/mvebu-next/0041-implement-slot-capabilities-SSPL.patch similarity index 100% rename from patch/kernel/marvell-next/0041-implement-slot-capabilities-SSPL.patch rename to patch/kernel/mvebu-next/0041-implement-slot-capabilities-SSPL.patch diff --git a/patch/kernel/marvell-next/0043-sfp-removal-of-defs.patch b/patch/kernel/mvebu-next/0043-sfp-removal-of-defs.patch similarity index 100% rename from patch/kernel/marvell-next/0043-sfp-removal-of-defs.patch rename to patch/kernel/mvebu-next/0043-sfp-removal-of-defs.patch diff --git a/patch/kernel/marvell-next/0044-gpio-report-all-gpios-in-debugfs.patch b/patch/kernel/mvebu-next/0044-gpio-report-all-gpios-in-debugfs.patch similarity index 100% rename from patch/kernel/marvell-next/0044-gpio-report-all-gpios-in-debugfs.patch rename to patch/kernel/mvebu-next/0044-gpio-report-all-gpios-in-debugfs.patch diff --git a/patch/kernel/marvell-next/0053-ARM-8060-mm-allow-sub-architectures-to-override.patch b/patch/kernel/mvebu-next/0053-ARM-8060-mm-allow-sub-architectures-to-override.patch similarity index 100% rename from patch/kernel/marvell-next/0053-ARM-8060-mm-allow-sub-architectures-to-override.patch rename to patch/kernel/mvebu-next/0053-ARM-8060-mm-allow-sub-architectures-to-override.patch diff --git a/patch/kernel/marvell-next/0088-add-clearfogbase.patch b/patch/kernel/mvebu-next/0088-add-clearfogbase.patch similarity index 100% rename from patch/kernel/marvell-next/0088-add-clearfogbase.patch rename to patch/kernel/mvebu-next/0088-add-clearfogbase.patch diff --git a/patch/kernel/marvell-dev/bash_to_afterinstall.patch b/patch/kernel/mvebu-next/bash_to_afterinstall.patch similarity index 100% rename from patch/kernel/marvell-dev/bash_to_afterinstall.patch rename to patch/kernel/mvebu-next/bash_to_afterinstall.patch diff --git a/patch/kernel/marvell-next/deprecated/0002-phy-move-fixed_phy-MII-register-generation-to-a-libr.patch b/patch/kernel/mvebu-next/deprecated/0002-phy-move-fixed_phy-MII-register-generation-to-a-libr.patch similarity index 100% rename from patch/kernel/marvell-next/deprecated/0002-phy-move-fixed_phy-MII-register-generation-to-a-libr.patch rename to patch/kernel/mvebu-next/deprecated/0002-phy-move-fixed_phy-MII-register-generation-to-a-libr.patch diff --git a/patch/kernel/marvell-next/deprecated/0003-phy-convert-swphy-register-generation-to-tabular-for.patch b/patch/kernel/mvebu-next/deprecated/0003-phy-convert-swphy-register-generation-to-tabular-for.patch similarity index 100% rename from patch/kernel/marvell-next/deprecated/0003-phy-convert-swphy-register-generation-to-tabular-for.patch rename to patch/kernel/mvebu-next/deprecated/0003-phy-convert-swphy-register-generation-to-tabular-for.patch diff --git a/patch/kernel/marvell-next/deprecated/0004-phy-separate-swphy-state-validation-from-register-ge.patch b/patch/kernel/mvebu-next/deprecated/0004-phy-separate-swphy-state-validation-from-register-ge.patch similarity index 100% rename from patch/kernel/marvell-next/deprecated/0004-phy-separate-swphy-state-validation-from-register-ge.patch rename to patch/kernel/mvebu-next/deprecated/0004-phy-separate-swphy-state-validation-from-register-ge.patch diff --git a/patch/kernel/marvell-next/deprecated/0005-phy-generate-swphy-registers-on-the-fly.patch b/patch/kernel/mvebu-next/deprecated/0005-phy-generate-swphy-registers-on-the-fly.patch similarity index 100% rename from patch/kernel/marvell-next/deprecated/0005-phy-generate-swphy-registers-on-the-fly.patch rename to patch/kernel/mvebu-next/deprecated/0005-phy-generate-swphy-registers-on-the-fly.patch diff --git a/patch/kernel/marvell-next/deprecated/0006-phy-improve-safety-of-fixed-phy-MII-register-reading.patch b/patch/kernel/mvebu-next/deprecated/0006-phy-improve-safety-of-fixed-phy-MII-register-reading.patch similarity index 100% rename from patch/kernel/marvell-next/deprecated/0006-phy-improve-safety-of-fixed-phy-MII-register-reading.patch rename to patch/kernel/mvebu-next/deprecated/0006-phy-improve-safety-of-fixed-phy-MII-register-reading.patch diff --git a/patch/kernel/marvell-next/deprecated/0016-net-mvneta-convert-to-phylink.patch b/patch/kernel/mvebu-next/deprecated/0016-net-mvneta-convert-to-phylink.patch similarity index 100% rename from patch/kernel/marvell-next/deprecated/0016-net-mvneta-convert-to-phylink.patch rename to patch/kernel/mvebu-next/deprecated/0016-net-mvneta-convert-to-phylink.patch diff --git a/patch/kernel/marvell-next/deprecated/0017-phy-fixed-phy-remove-fixed_phy_update_state.patch b/patch/kernel/mvebu-next/deprecated/0017-phy-fixed-phy-remove-fixed_phy_update_state.patch similarity index 100% rename from patch/kernel/marvell-next/deprecated/0017-phy-fixed-phy-remove-fixed_phy_update_state.patch rename to patch/kernel/mvebu-next/deprecated/0017-phy-fixed-phy-remove-fixed_phy_update_state.patch diff --git a/patch/kernel/marvell-next/deprecated/0019-net-mvneta-add-nway_reset-support.patch b/patch/kernel/mvebu-next/deprecated/0019-net-mvneta-add-nway_reset-support.patch similarity index 100% rename from patch/kernel/marvell-next/deprecated/0019-net-mvneta-add-nway_reset-support.patch rename to patch/kernel/mvebu-next/deprecated/0019-net-mvneta-add-nway_reset-support.patch diff --git a/patch/kernel/marvell-next/deprecated/0021-net-mvneta-add-flow-control-support-via-phylink.patch b/patch/kernel/mvebu-next/deprecated/0021-net-mvneta-add-flow-control-support-via-phylink.patch similarity index 100% rename from patch/kernel/marvell-next/deprecated/0021-net-mvneta-add-flow-control-support-via-phylink.patch rename to patch/kernel/mvebu-next/deprecated/0021-net-mvneta-add-flow-control-support-via-phylink.patch diff --git a/patch/kernel/marvell-next/deprecated/0022-net-mvneta-enable-flow-control-for-PHY-connections.patch b/patch/kernel/mvebu-next/deprecated/0022-net-mvneta-enable-flow-control-for-PHY-connections.patch similarity index 100% rename from patch/kernel/marvell-next/deprecated/0022-net-mvneta-enable-flow-control-for-PHY-connections.patch rename to patch/kernel/mvebu-next/deprecated/0022-net-mvneta-enable-flow-control-for-PHY-connections.patch diff --git a/patch/kernel/marvell-next/deprecated/0024-net-mvneta-add-EEE-support.patch b/patch/kernel/mvebu-next/deprecated/0024-net-mvneta-add-EEE-support.patch similarity index 100% rename from patch/kernel/marvell-next/deprecated/0024-net-mvneta-add-EEE-support.patch rename to patch/kernel/mvebu-next/deprecated/0024-net-mvneta-add-EEE-support.patch diff --git a/patch/kernel/marvell-next/deprecated/0026-net-mvneta-add-module-EEPROM-reading-support.patch b/patch/kernel/mvebu-next/deprecated/0026-net-mvneta-add-module-EEPROM-reading-support.patch similarity index 100% rename from patch/kernel/marvell-next/deprecated/0026-net-mvneta-add-module-EEPROM-reading-support.patch rename to patch/kernel/mvebu-next/deprecated/0026-net-mvneta-add-module-EEPROM-reading-support.patch diff --git a/patch/kernel/marvell-next/deprecated/0028-ARM-dts-Add-SolidRun-Armada-388-Clearfog-A1-DT-file.patch b/patch/kernel/mvebu-next/deprecated/0028-ARM-dts-Add-SolidRun-Armada-388-Clearfog-A1-DT-file.patch similarity index 100% rename from patch/kernel/marvell-next/deprecated/0028-ARM-dts-Add-SolidRun-Armada-388-Clearfog-A1-DT-file.patch rename to patch/kernel/mvebu-next/deprecated/0028-ARM-dts-Add-SolidRun-Armada-388-Clearfog-A1-DT-file.patch diff --git a/patch/kernel/marvell-next/packaging-4.x-NEXT-with-postinstall-scripts.patch b/patch/kernel/mvebu-next/packaging-4.x-NEXT-with-postinstall-scripts.patch similarity index 100% rename from patch/kernel/marvell-next/packaging-4.x-NEXT-with-postinstall-scripts.patch rename to patch/kernel/mvebu-next/packaging-4.x-NEXT-with-postinstall-scripts.patch diff --git a/patch/kernel/marvell-dev/unlock_atheros_regulatory_restrictions.patch b/patch/kernel/mvebu-next/unlock_atheros_regulatory_restrictions.patch similarity index 100% rename from patch/kernel/marvell-dev/unlock_atheros_regulatory_restrictions.patch rename to patch/kernel/mvebu-next/unlock_atheros_regulatory_restrictions.patch