From 1312a6c2c33af1de1a73ca13261ae260b51bac2d Mon Sep 17 00:00:00 2001 From: Stephan Raue Date: Thu, 16 Dec 2010 11:23:05 +0100 Subject: [PATCH] linux: update to linux-2.6.37-rc6 Signed-off-by: Stephan Raue --- packages/linux/meta | 4 +- .../patches/linux-2.6.37-rc5-999-git5.patch | 11399 ---------------- ...> linux-2.6.37-rc6-000_crosscompile.patch} | 0 ...ux-2.6.37-rc6-002_bash_only_feature.patch} | 0 ...linux-2.6.37-rc6-003-no_dev_console.patch} | 0 ...c6-004_lower_undefined_mode_timeout.patch} | 0 ...2.6.37-rc6-005_kconfig_no_timestamp.patch} | 0 ...=> linux-2.6.37-rc6-006_enable_utf8.patch} | 0 ...linux-2.6.37-rc6-007_die_floppy_die.patch} | 0 ...08-hda_intel_prealloc_4mb_dmabuffer.patch} | 0 ...09_disable_i8042_check_on_apple_mac.patch} | 0 ...6.37-rc6-050_add_appleir_usb_driver.patch} | 0 ....37-rc6-052-aureal_remote_quirk-0.1.patch} | 0 ...6-110-drm_nouveau_upstream-20101205.patch} | 0 14 files changed, 2 insertions(+), 11401 deletions(-) delete mode 100644 packages/linux/patches/linux-2.6.37-rc5-999-git5.patch rename packages/linux/patches/{linux-2.6.37-rc5-000_crosscompile.patch => linux-2.6.37-rc6-000_crosscompile.patch} (100%) rename packages/linux/patches/{linux-2.6.37-rc5-002_bash_only_feature.patch => linux-2.6.37-rc6-002_bash_only_feature.patch} (100%) rename packages/linux/patches/{linux-2.6.37-rc5-003-no_dev_console.patch => linux-2.6.37-rc6-003-no_dev_console.patch} (100%) rename packages/linux/patches/{linux-2.6.37-rc5-004_lower_undefined_mode_timeout.patch => linux-2.6.37-rc6-004_lower_undefined_mode_timeout.patch} (100%) rename packages/linux/patches/{linux-2.6.37-rc5-005_kconfig_no_timestamp.patch => linux-2.6.37-rc6-005_kconfig_no_timestamp.patch} (100%) rename packages/linux/patches/{linux-2.6.37-rc5-006_enable_utf8.patch => linux-2.6.37-rc6-006_enable_utf8.patch} (100%) rename packages/linux/patches/{linux-2.6.37-rc5-007_die_floppy_die.patch => linux-2.6.37-rc6-007_die_floppy_die.patch} (100%) rename packages/linux/patches/{linux-2.6.37-rc5-008-hda_intel_prealloc_4mb_dmabuffer.patch => linux-2.6.37-rc6-008-hda_intel_prealloc_4mb_dmabuffer.patch} (100%) rename packages/linux/patches/{linux-2.6.37-rc5-009_disable_i8042_check_on_apple_mac.patch => linux-2.6.37-rc6-009_disable_i8042_check_on_apple_mac.patch} (100%) rename packages/linux/patches/{linux-2.6.37-rc5-050_add_appleir_usb_driver.patch => linux-2.6.37-rc6-050_add_appleir_usb_driver.patch} (100%) rename packages/linux/patches/{linux-2.6.37-rc5-052-aureal_remote_quirk-0.1.patch => linux-2.6.37-rc6-052-aureal_remote_quirk-0.1.patch} (100%) rename packages/linux/patches/{linux-2.6.37-rc5-110-drm_nouveau_upstream-20101205.patch => linux-2.6.37-rc6-110-drm_nouveau_upstream-20101205.patch} (100%) diff --git a/packages/linux/meta b/packages/linux/meta index 3610c37740..eeadee0469 100644 --- a/packages/linux/meta +++ b/packages/linux/meta @@ -1,5 +1,5 @@ PKG_NAME="linux" -PKG_VERSION="2.6.37-rc5" +PKG_VERSION="2.6.37-rc6" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="GPL" @@ -17,6 +17,6 @@ PKG_IS_ADDON="no" PKG_AUTORECONF="no" if [ "$LINUX_NEXT" = "yes" ]; then - PKG_VERSION="2.6.37-rc5" + PKG_VERSION="2.6.37-rc6" PKG_URL="http://www.kernel.org/pub/linux/kernel/v2.6/testing/$PKG_NAME-$PKG_VERSION.tar.bz2" fi diff --git a/packages/linux/patches/linux-2.6.37-rc5-999-git5.patch b/packages/linux/patches/linux-2.6.37-rc5-999-git5.patch deleted file mode 100644 index dce8f5e080..0000000000 --- a/packages/linux/patches/linux-2.6.37-rc5-999-git5.patch +++ /dev/null @@ -1,11399 +0,0 @@ -diff --git a/Documentation/ABI/testing/sysfs-platform-asus-laptop b/Documentation/ABI/testing/sysfs-platform-asus-laptop -index 1d77539..41ff8ae 100644 ---- a/Documentation/ABI/testing/sysfs-platform-asus-laptop -+++ b/Documentation/ABI/testing/sysfs-platform-asus-laptop -@@ -47,6 +47,20 @@ Date: January 2007 - KernelVersion: 2.6.20 - Contact: "Corentin Chary" - Description: -- Control the bluetooth device. 1 means on, 0 means off. -+ Control the wlan device. 1 means on, 0 means off. - This may control the led, the device or both. - Users: Lapsus -+ -+What: /sys/devices/platform/asus_laptop/wimax -+Date: October 2010 -+KernelVersion: 2.6.37 -+Contact: "Corentin Chary" -+Description: -+ Control the wimax device. 1 means on, 0 means off. -+ -+What: /sys/devices/platform/asus_laptop/wwan -+Date: October 2010 -+KernelVersion: 2.6.37 -+Contact: "Corentin Chary" -+Description: -+ Control the wwan (3G) device. 1 means on, 0 means off. -diff --git a/Documentation/ABI/testing/sysfs-platform-eeepc-wmi b/Documentation/ABI/testing/sysfs-platform-eeepc-wmi -new file mode 100644 -index 0000000..e4b5fef ---- /dev/null -+++ b/Documentation/ABI/testing/sysfs-platform-eeepc-wmi -@@ -0,0 +1,10 @@ -+What: /sys/devices/platform/eeepc-wmi/cpufv -+Date: Oct 2010 -+KernelVersion: 2.6.37 -+Contact: "Corentin Chary" -+Description: -+ Change CPU clock configuration (write-only). -+ There are three available clock configuration: -+ * 0 -> Super Performance Mode -+ * 1 -> High Performance Mode -+ * 2 -> Power Saving Mode -diff --git a/Documentation/filesystems/Locking b/Documentation/filesystems/Locking -index a91f308..b6426f1 100644 ---- a/Documentation/filesystems/Locking -+++ b/Documentation/filesystems/Locking -@@ -173,12 +173,13 @@ prototypes: - sector_t (*bmap)(struct address_space *, sector_t); - int (*invalidatepage) (struct page *, unsigned long); - int (*releasepage) (struct page *, int); -+ void (*freepage)(struct page *); - int (*direct_IO)(int, struct kiocb *, const struct iovec *iov, - loff_t offset, unsigned long nr_segs); - int (*launder_page) (struct page *); - - locking rules: -- All except set_page_dirty may block -+ All except set_page_dirty and freepage may block - - BKL PageLocked(page) i_mutex - writepage: no yes, unlocks (see below) -@@ -193,6 +194,7 @@ perform_write: no n/a yes - bmap: no - invalidatepage: no yes - releasepage: no yes -+freepage: no yes - direct_IO: no - launder_page: no yes - -@@ -288,6 +290,9 @@ buffers from the page in preparation for freeing it. It returns zero to - indicate that the buffers are (or may be) freeable. If ->releasepage is zero, - the kernel assumes that the fs has no private interest in the buffers. - -+ ->freepage() is called when the kernel is done dropping the page -+from the page cache. -+ - ->launder_page() may be called prior to releasing a page if - it is still found to be dirty. It returns zero if the page was successfully - cleaned, or an error value if not. Note that in order to prevent the page -diff --git a/Documentation/filesystems/vfs.txt b/Documentation/filesystems/vfs.txt -index 55c28b7..20899e0 100644 ---- a/Documentation/filesystems/vfs.txt -+++ b/Documentation/filesystems/vfs.txt -@@ -534,6 +534,7 @@ struct address_space_operations { - sector_t (*bmap)(struct address_space *, sector_t); - int (*invalidatepage) (struct page *, unsigned long); - int (*releasepage) (struct page *, int); -+ void (*freepage)(struct page *); - ssize_t (*direct_IO)(int, struct kiocb *, const struct iovec *iov, - loff_t offset, unsigned long nr_segs); - struct page* (*get_xip_page)(struct address_space *, sector_t, -@@ -678,6 +679,12 @@ struct address_space_operations { - need to ensure this. Possibly it can clear the PageUptodate - bit if it cannot free private data yet. - -+ freepage: freepage is called once the page is no longer visible in -+ the page cache in order to allow the cleanup of any private -+ data. Since it may be called by the memory reclaimer, it -+ should not assume that the original address_space mapping still -+ exists, and it should not block. -+ - direct_IO: called by the generic read/write routines to perform - direct_IO - that is IO requests which bypass the page cache - and transfer data directly between the storage and the -diff --git a/MAINTAINERS b/MAINTAINERS -index 1a1c27b..0b0d2ba 100644 ---- a/MAINTAINERS -+++ b/MAINTAINERS -@@ -559,14 +559,14 @@ W: http://maxim.org.za/at91_26.html - S: Maintained - - ARM/BCMRING ARM ARCHITECTURE --M: Leo Chen -+M: Jiandong Zheng - M: Scott Branden - L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) - S: Maintained - F: arch/arm/mach-bcmring - - ARM/BCMRING MTD NAND DRIVER --M: Leo Chen -+M: Jiandong Zheng - M: Scott Branden - L: linux-mtd@lists.infradead.org - S: Maintained -@@ -5932,7 +5932,6 @@ F: include/linux/tty.h - - TULIP NETWORK DRIVERS - M: Grant Grundler --M: Kyle McMartin - L: netdev@vger.kernel.org - S: Maintained - F: drivers/net/tulip/ -@@ -6584,6 +6583,15 @@ F: include/linux/mfd/wm8400* - F: include/sound/wm????.h - F: sound/soc/codecs/wm* - -+WORKQUEUE -+M: Tejun Heo -+L: linux-kernel@vger.kernel.org -+T: git git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq.git -+S: Maintained -+F: include/linux/workqueue.h -+F: kernel/workqueue.c -+F: Documentation/workqueue.txt -+ - X.25 NETWORK LAYER - M: Andrew Hendry - L: linux-x25@vger.kernel.org -diff --git a/Makefile b/Makefile -index 3d94974..e236615 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,7 +1,7 @@ - VERSION = 2 - PATCHLEVEL = 6 - SUBLEVEL = 37 --EXTRAVERSION = -rc5 -+EXTRAVERSION = -rc5-git5 - NAME = Flesh-Eating Bats with Fangs - - # *DOCUMENTATION* -diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig -index f1d9297..d56d21c 100644 ---- a/arch/arm/Kconfig -+++ b/arch/arm/Kconfig -@@ -1311,7 +1311,7 @@ config HZ - - config THUMB2_KERNEL - bool "Compile the kernel in Thumb-2 mode" -- depends on CPU_V7 && EXPERIMENTAL -+ depends on CPU_V7 && !CPU_V6 && EXPERIMENTAL - select AEABI - select ARM_ASM_UNIFIED - help -@@ -1759,7 +1759,7 @@ comment "At least one emulation must be selected" - - config FPE_NWFPE - bool "NWFPE math emulation" -- depends on !AEABI || OABI_COMPAT -+ depends on (!AEABI || OABI_COMPAT) && !THUMB2_KERNEL - ---help--- - Say Y to include the NWFPE floating point emulator in the kernel. - This is necessary to run most binaries. Linux does not currently -diff --git a/arch/arm/mach-mmp/mmp2.c b/arch/arm/mach-mmp/mmp2.c -index daf3993..2e3dd08 100644 ---- a/arch/arm/mach-mmp/mmp2.c -+++ b/arch/arm/mach-mmp/mmp2.c -@@ -126,7 +126,6 @@ static APBC_CLK(twsi3, MMP2_TWSI3, 0, 26000000); - static APBC_CLK(twsi4, MMP2_TWSI4, 0, 26000000); - static APBC_CLK(twsi5, MMP2_TWSI5, 0, 26000000); - static APBC_CLK(twsi6, MMP2_TWSI6, 0, 26000000); --static APBC_CLK(rtc, MMP2_RTC, 0, 32768); - - static APMU_CLK(nand, NAND, 0xbf, 100000000); - -diff --git a/arch/arm/mach-omap2/board-zoom-peripherals.c b/arch/arm/mach-omap2/board-zoom-peripherals.c -index 86c9b21..9db9203 100644 ---- a/arch/arm/mach-omap2/board-zoom-peripherals.c -+++ b/arch/arm/mach-omap2/board-zoom-peripherals.c -@@ -216,7 +216,7 @@ static struct omap2_hsmmc_info mmc[] __initdata = { - { - .name = "wl1271", - .mmc = 3, -- .caps = MMC_CAP_4_BIT_DATA, -+ .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_POWER_OFF_CARD, - .gpio_wp = -EINVAL, - .gpio_cd = -EINVAL, - .nonremovable = true, -diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c -index 40562dd..a1939b1 100644 ---- a/arch/arm/mach-omap2/io.c -+++ b/arch/arm/mach-omap2/io.c -@@ -297,7 +297,7 @@ static int __init _omap2_init_reprogram_sdrc(void) - return 0; - - dpll3_m2_ck = clk_get(NULL, "dpll3_m2_ck"); -- if (!dpll3_m2_ck) -+ if (IS_ERR(dpll3_m2_ck)) - return -EINVAL; - - rate = clk_get_rate(dpll3_m2_ck); -diff --git a/arch/arm/mach-omap2/pm-debug.c b/arch/arm/mach-omap2/pm-debug.c -index 5e81517..a8afb61 100644 ---- a/arch/arm/mach-omap2/pm-debug.c -+++ b/arch/arm/mach-omap2/pm-debug.c -@@ -161,6 +161,23 @@ void omap2_pm_dump(int mode, int resume, unsigned int us) - printk(KERN_INFO "%-20s: 0x%08x\n", regs[i].name, regs[i].val); - } - -+void omap2_pm_wakeup_on_timer(u32 seconds, u32 milliseconds) -+{ -+ u32 tick_rate, cycles; -+ -+ if (!seconds && !milliseconds) -+ return; -+ -+ tick_rate = clk_get_rate(omap_dm_timer_get_fclk(gptimer_wakeup)); -+ cycles = tick_rate * seconds + tick_rate * milliseconds / 1000; -+ omap_dm_timer_stop(gptimer_wakeup); -+ omap_dm_timer_set_load_start(gptimer_wakeup, 0, 0xffffffff - cycles); -+ -+ pr_info("PM: Resume timer in %u.%03u secs" -+ " (%d ticks at %d ticks/sec.)\n", -+ seconds, milliseconds, cycles, tick_rate); -+} -+ - #ifdef CONFIG_DEBUG_FS - #include - #include -@@ -354,23 +371,6 @@ void pm_dbg_update_time(struct powerdomain *pwrdm, int prev) - pwrdm->timer = t; - } - --void omap2_pm_wakeup_on_timer(u32 seconds, u32 milliseconds) --{ -- u32 tick_rate, cycles; -- -- if (!seconds && !milliseconds) -- return; -- -- tick_rate = clk_get_rate(omap_dm_timer_get_fclk(gptimer_wakeup)); -- cycles = tick_rate * seconds + tick_rate * milliseconds / 1000; -- omap_dm_timer_stop(gptimer_wakeup); -- omap_dm_timer_set_load_start(gptimer_wakeup, 0, 0xffffffff - cycles); -- -- pr_info("PM: Resume timer in %u.%03u secs" -- " (%d ticks at %d ticks/sec.)\n", -- seconds, milliseconds, cycles, tick_rate); --} -- - static int clkdm_dbg_show_counter(struct clockdomain *clkdm, void *user) - { - struct seq_file *s = (struct seq_file *)user; -diff --git a/arch/arm/mach-omap2/pm24xx.c b/arch/arm/mach-omap2/pm24xx.c -index c85923e..aaeea49 100644 ---- a/arch/arm/mach-omap2/pm24xx.c -+++ b/arch/arm/mach-omap2/pm24xx.c -@@ -53,6 +53,19 @@ - #include - #include - -+#ifdef CONFIG_SUSPEND -+static suspend_state_t suspend_state = PM_SUSPEND_ON; -+static inline bool is_suspending(void) -+{ -+ return (suspend_state != PM_SUSPEND_ON); -+} -+#else -+static inline bool is_suspending(void) -+{ -+ return false; -+} -+#endif -+ - static void (*omap2_sram_idle)(void); - static void (*omap2_sram_suspend)(u32 dllctrl, void __iomem *sdrc_dlla_ctrl, - void __iomem *sdrc_power); -@@ -120,8 +133,9 @@ static void omap2_enter_full_retention(void) - goto no_sleep; - - /* Block console output in case it is on one of the OMAP UARTs */ -- if (try_acquire_console_sem()) -- goto no_sleep; -+ if (!is_suspending()) -+ if (try_acquire_console_sem()) -+ goto no_sleep; - - omap_uart_prepare_idle(0); - omap_uart_prepare_idle(1); -@@ -136,7 +150,8 @@ static void omap2_enter_full_retention(void) - omap_uart_resume_idle(1); - omap_uart_resume_idle(0); - -- release_console_sem(); -+ if (!is_suspending()) -+ release_console_sem(); - - no_sleep: - if (omap2_pm_debug) { -@@ -284,6 +299,12 @@ out: - local_irq_enable(); - } - -+static int omap2_pm_begin(suspend_state_t state) -+{ -+ suspend_state = state; -+ return 0; -+} -+ - static int omap2_pm_prepare(void) - { - /* We cannot sleep in idle until we have resumed */ -@@ -333,10 +354,17 @@ static void omap2_pm_finish(void) - enable_hlt(); - } - -+static void omap2_pm_end(void) -+{ -+ suspend_state = PM_SUSPEND_ON; -+} -+ - static struct platform_suspend_ops omap_pm_ops = { -+ .begin = omap2_pm_begin, - .prepare = omap2_pm_prepare, - .enter = omap2_pm_enter, - .finish = omap2_pm_finish, -+ .end = omap2_pm_end, - .valid = suspend_valid_only_mem, - }; - -diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c -index 0ec8a04..648b8c5 100644 ---- a/arch/arm/mach-omap2/pm34xx.c -+++ b/arch/arm/mach-omap2/pm34xx.c -@@ -50,6 +50,19 @@ - #include "sdrc.h" - #include "control.h" - -+#ifdef CONFIG_SUSPEND -+static suspend_state_t suspend_state = PM_SUSPEND_ON; -+static inline bool is_suspending(void) -+{ -+ return (suspend_state != PM_SUSPEND_ON); -+} -+#else -+static inline bool is_suspending(void) -+{ -+ return false; -+} -+#endif -+ - /* Scratchpad offsets */ - #define OMAP343X_TABLE_ADDRESS_OFFSET 0xc4 - #define OMAP343X_TABLE_VALUE_OFFSET 0xc0 -@@ -387,10 +400,11 @@ void omap_sram_idle(void) - } - - /* Block console output in case it is on one of the OMAP UARTs */ -- if (per_next_state < PWRDM_POWER_ON || -- core_next_state < PWRDM_POWER_ON) -- if (try_acquire_console_sem()) -- goto console_still_active; -+ if (!is_suspending()) -+ if (per_next_state < PWRDM_POWER_ON || -+ core_next_state < PWRDM_POWER_ON) -+ if (try_acquire_console_sem()) -+ goto console_still_active; - - /* PER */ - if (per_next_state < PWRDM_POWER_ON) { -@@ -470,7 +484,8 @@ void omap_sram_idle(void) - omap_uart_resume_idle(3); - } - -- release_console_sem(); -+ if (!is_suspending()) -+ release_console_sem(); - - console_still_active: - /* Disable IO-PAD and IO-CHAIN wakeup */ -@@ -514,8 +529,6 @@ out: - } - - #ifdef CONFIG_SUSPEND --static suspend_state_t suspend_state; -- - static int omap3_pm_prepare(void) - { - disable_hlt(); -diff --git a/arch/arm/mach-omap2/prcm-common.h b/arch/arm/mach-omap2/prcm-common.h -index 298a22a..f81acee 100644 ---- a/arch/arm/mach-omap2/prcm-common.h -+++ b/arch/arm/mach-omap2/prcm-common.h -@@ -243,13 +243,14 @@ - #define OMAP24XX_EN_GPT1_MASK (1 << 0) - - /* PM_WKST_WKUP, CM_IDLEST_WKUP shared bits */ --#define OMAP24XX_ST_GPIOS_SHIFT (1 << 2) --#define OMAP24XX_ST_GPIOS_MASK 2 --#define OMAP24XX_ST_GPT1_SHIFT (1 << 0) --#define OMAP24XX_ST_GPT1_MASK 0 -+#define OMAP24XX_ST_GPIOS_SHIFT 2 -+#define OMAP24XX_ST_GPIOS_MASK (1 << 2) -+#define OMAP24XX_ST_GPT1_SHIFT 0 -+#define OMAP24XX_ST_GPT1_MASK (1 << 0) - - /* CM_IDLEST_MDM and PM_WKST_MDM shared bits */ --#define OMAP2430_ST_MDM_SHIFT (1 << 0) -+#define OMAP2430_ST_MDM_SHIFT 0 -+#define OMAP2430_ST_MDM_MASK (1 << 0) - - - /* 3430 register bits shared between CM & PRM registers */ -diff --git a/arch/arm/mach-pxa/palmtx.c b/arch/arm/mach-pxa/palmtx.c -index d2060a1..e5c9932 100644 ---- a/arch/arm/mach-pxa/palmtx.c -+++ b/arch/arm/mach-pxa/palmtx.c -@@ -241,7 +241,8 @@ static inline void palmtx_keys_init(void) {} - /****************************************************************************** - * NAND Flash - ******************************************************************************/ --#if defined(CONFIG_MTD_NAND_GPIO) || defined(CONFIG_MTD_NAND_GPIO_MODULE) -+#if defined(CONFIG_MTD_NAND_PLATFORM) || \ -+ defined(CONFIG_MTD_NAND_PLATFORM_MODULE) - static void palmtx_nand_cmd_ctl(struct mtd_info *mtd, int cmd, - unsigned int ctrl) - { -diff --git a/arch/arm/mach-s3c2412/Kconfig b/arch/arm/mach-s3c2412/Kconfig -index cef6a65..fa2e5bf 100644 ---- a/arch/arm/mach-s3c2412/Kconfig -+++ b/arch/arm/mach-s3c2412/Kconfig -@@ -16,7 +16,7 @@ config CPU_S3C2412 - config CPU_S3C2412_ONLY - bool - depends on ARCH_S3C2410 && !CPU_S3C2400 && !CPU_S3C2410 && \ -- !CPU_2416 && !CPU_S3C2440 && !CPU_S3C2442 && \ -+ !CPU_S3C2416 && !CPU_S3C2440 && !CPU_S3C2442 && \ - !CPU_S3C2443 && CPU_S3C2412 - default y if CPU_S3C2412 - -diff --git a/arch/arm/mach-s3c2416/Kconfig b/arch/arm/mach-s3c2416/Kconfig -index 87b9c9f..27b3e7c 100644 ---- a/arch/arm/mach-s3c2416/Kconfig -+++ b/arch/arm/mach-s3c2416/Kconfig -@@ -35,9 +35,12 @@ menu "S3C2416 Machines" - config MACH_SMDK2416 - bool "SMDK2416" - select CPU_S3C2416 -+ select MACH_SMDK - select S3C_DEV_FB - select S3C_DEV_HSMMC - select S3C_DEV_HSMMC1 -+ select S3C_DEV_NAND -+ select S3C_DEV_USB_HOST - select S3C2416_PM if PM - help - Say Y here if you are using an SMDK2416 -diff --git a/arch/arm/mach-s3c2440/Kconfig b/arch/arm/mach-s3c2440/Kconfig -index ff024a6..a0cb258 100644 ---- a/arch/arm/mach-s3c2440/Kconfig -+++ b/arch/arm/mach-s3c2440/Kconfig -@@ -18,6 +18,7 @@ config CPU_S3C2440 - config CPU_S3C2442 - bool - select CPU_ARM920T -+ select S3C_GPIO_PULL_DOWN - select S3C2410_CLOCK - select S3C2410_GPIO - select S3C2410_PM if PM -@@ -178,6 +179,9 @@ config MACH_MINI2440 - bool "MINI2440 development board" - select CPU_S3C2440 - select EEPROM_AT24 -+ select NEW_LEDS -+ select LEDS_CLASS -+ select LEDS_TRIGGER - select LEDS_TRIGGER_BACKLIGHT - select S3C_DEV_NAND - select S3C_DEV_USB_HOST -diff --git a/arch/arm/mach-s3c2440/s3c2440.c b/arch/arm/mach-s3c2440/s3c2440.c -index d50f3ae..f7663f7 100644 ---- a/arch/arm/mach-s3c2440/s3c2440.c -+++ b/arch/arm/mach-s3c2440/s3c2440.c -@@ -46,9 +46,6 @@ int __init s3c2440_init(void) - { - printk("S3C2440: Initialising architecture\n"); - -- s3c24xx_gpiocfg_default.set_pull = s3c_gpio_setpull_1up; -- s3c24xx_gpiocfg_default.get_pull = s3c_gpio_getpull_1up; -- - /* change irq for watchdog */ - - s3c_device_wdt.resource[1].start = IRQ_S3C2440_WDT; -@@ -58,3 +55,11 @@ int __init s3c2440_init(void) - - return sysdev_register(&s3c2440_sysdev); - } -+ -+void __init s3c2440_map_io(void) -+{ -+ s3c244x_map_io(); -+ -+ s3c24xx_gpiocfg_default.set_pull = s3c_gpio_setpull_1up; -+ s3c24xx_gpiocfg_default.get_pull = s3c_gpio_getpull_1up; -+} -diff --git a/arch/arm/mach-s3c2440/s3c2442.c b/arch/arm/mach-s3c2440/s3c2442.c -index 188ad1e..ecf8135 100644 ---- a/arch/arm/mach-s3c2440/s3c2442.c -+++ b/arch/arm/mach-s3c2440/s3c2442.c -@@ -32,6 +32,7 @@ - #include - #include - #include -+#include - #include - #include - -@@ -43,6 +44,11 @@ - - #include - #include -+#include -+ -+#include -+#include -+#include - - /* S3C2442 extended clock support */ - -@@ -163,3 +169,11 @@ int __init s3c2442_init(void) - - return sysdev_register(&s3c2442_sysdev); - } -+ -+void __init s3c2442_map_io(void) -+{ -+ s3c244x_map_io(); -+ -+ s3c24xx_gpiocfg_default.set_pull = s3c_gpio_setpull_1down; -+ s3c24xx_gpiocfg_default.get_pull = s3c_gpio_getpull_1down; -+} -diff --git a/arch/arm/mach-s3c2443/Kconfig b/arch/arm/mach-s3c2443/Kconfig -index 4fef723..31babec 100644 ---- a/arch/arm/mach-s3c2443/Kconfig -+++ b/arch/arm/mach-s3c2443/Kconfig -@@ -5,6 +5,7 @@ - config CPU_S3C2443 - bool - depends on ARCH_S3C2410 -+ select CPU_ARM920T - select S3C2443_DMA if S3C2410_DMA - select CPU_LLSERIAL_S3C2440 - select SAMSUNG_CLKSRC -diff --git a/arch/arm/mm/cache-v6.S b/arch/arm/mm/cache-v6.S -index 99fa688..c96fa1b 100644 ---- a/arch/arm/mm/cache-v6.S -+++ b/arch/arm/mm/cache-v6.S -@@ -203,6 +203,10 @@ ENTRY(v6_flush_kern_dcache_area) - * - end - virtual end address of region - */ - v6_dma_inv_range: -+#ifdef CONFIG_DMA_CACHE_RWFO -+ ldrb r2, [r0] @ read for ownership -+ strb r2, [r0] @ write for ownership -+#endif - tst r0, #D_CACHE_LINE_SIZE - 1 - bic r0, r0, #D_CACHE_LINE_SIZE - 1 - #ifdef HARVARD_CACHE -@@ -211,6 +215,10 @@ v6_dma_inv_range: - mcrne p15, 0, r0, c7, c11, 1 @ clean unified line - #endif - tst r1, #D_CACHE_LINE_SIZE - 1 -+#ifdef CONFIG_DMA_CACHE_RWFO -+ ldrneb r2, [r1, #-1] @ read for ownership -+ strneb r2, [r1, #-1] @ write for ownership -+#endif - bic r1, r1, #D_CACHE_LINE_SIZE - 1 - #ifdef HARVARD_CACHE - mcrne p15, 0, r1, c7, c14, 1 @ clean & invalidate D line -@@ -218,10 +226,6 @@ v6_dma_inv_range: - mcrne p15, 0, r1, c7, c15, 1 @ clean & invalidate unified line - #endif - 1: --#ifdef CONFIG_DMA_CACHE_RWFO -- ldr r2, [r0] @ read for ownership -- str r2, [r0] @ write for ownership --#endif - #ifdef HARVARD_CACHE - mcr p15, 0, r0, c7, c6, 1 @ invalidate D line - #else -@@ -229,6 +233,10 @@ v6_dma_inv_range: - #endif - add r0, r0, #D_CACHE_LINE_SIZE - cmp r0, r1 -+#ifdef CONFIG_DMA_CACHE_RWFO -+ ldrlo r2, [r0] @ read for ownership -+ strlo r2, [r0] @ write for ownership -+#endif - blo 1b - mov r0, #0 - mcr p15, 0, r0, c7, c10, 4 @ drain write buffer -@@ -263,12 +271,12 @@ v6_dma_clean_range: - * - end - virtual end address of region - */ - ENTRY(v6_dma_flush_range) -- bic r0, r0, #D_CACHE_LINE_SIZE - 1 --1: - #ifdef CONFIG_DMA_CACHE_RWFO -- ldr r2, [r0] @ read for ownership -- str r2, [r0] @ write for ownership -+ ldrb r2, [r0] @ read for ownership -+ strb r2, [r0] @ write for ownership - #endif -+ bic r0, r0, #D_CACHE_LINE_SIZE - 1 -+1: - #ifdef HARVARD_CACHE - mcr p15, 0, r0, c7, c14, 1 @ clean & invalidate D line - #else -@@ -276,6 +284,10 @@ ENTRY(v6_dma_flush_range) - #endif - add r0, r0, #D_CACHE_LINE_SIZE - cmp r0, r1 -+#ifdef CONFIG_DMA_CACHE_RWFO -+ ldrlob r2, [r0] @ read for ownership -+ strlob r2, [r0] @ write for ownership -+#endif - blo 1b - mov r0, #0 - mcr p15, 0, r0, c7, c10, 4 @ drain write buffer -diff --git a/arch/arm/mm/cache-v7.S b/arch/arm/mm/cache-v7.S -index a3ebf7a..6136e68 100644 ---- a/arch/arm/mm/cache-v7.S -+++ b/arch/arm/mm/cache-v7.S -@@ -173,15 +173,22 @@ ENTRY(v7_coherent_user_range) - UNWIND(.fnstart ) - dcache_line_size r2, r3 - sub r3, r2, #1 -- bic r0, r0, r3 -+ bic r12, r0, r3 - 1: -- USER( mcr p15, 0, r0, c7, c11, 1 ) @ clean D line to the point of unification -+ USER( mcr p15, 0, r12, c7, c11, 1 ) @ clean D line to the point of unification -+ add r12, r12, r2 -+ cmp r12, r1 -+ blo 1b - dsb -- USER( mcr p15, 0, r0, c7, c5, 1 ) @ invalidate I line -- add r0, r0, r2 -+ icache_line_size r2, r3 -+ sub r3, r2, #1 -+ bic r12, r0, r3 - 2: -- cmp r0, r1 -- blo 1b -+ USER( mcr p15, 0, r12, c7, c5, 1 ) @ invalidate I line -+ add r12, r12, r2 -+ cmp r12, r1 -+ blo 2b -+3: - mov r0, #0 - ALT_SMP(mcr p15, 0, r0, c7, c1, 6) @ invalidate BTB Inner Shareable - ALT_UP(mcr p15, 0, r0, c7, c5, 6) @ invalidate BTB -@@ -194,10 +201,10 @@ ENTRY(v7_coherent_user_range) - * isn't mapped, just try the next page. - */ - 9001: -- mov r0, r0, lsr #12 -- mov r0, r0, lsl #12 -- add r0, r0, #4096 -- b 2b -+ mov r12, r12, lsr #12 -+ mov r12, r12, lsl #12 -+ add r12, r12, #4096 -+ b 3b - UNWIND(.fnend ) - ENDPROC(v7_coherent_kern_range) - ENDPROC(v7_coherent_user_range) -diff --git a/arch/arm/mm/proc-macros.S b/arch/arm/mm/proc-macros.S -index 7d63bea..b795afd 100644 ---- a/arch/arm/mm/proc-macros.S -+++ b/arch/arm/mm/proc-macros.S -@@ -61,17 +61,27 @@ - .endm - - /* -- * cache_line_size - get the cache line size from the CSIDR register -- * (available on ARMv7+). It assumes that the CSSR register was configured -- * to access the L1 data cache CSIDR. -+ * dcache_line_size - get the minimum D-cache line size from the CTR register -+ * on ARMv7. - */ - .macro dcache_line_size, reg, tmp -- mrc p15, 1, \tmp, c0, c0, 0 @ read CSIDR -- and \tmp, \tmp, #7 @ cache line size encoding -- mov \reg, #16 @ size offset -+ mrc p15, 0, \tmp, c0, c0, 1 @ read ctr -+ lsr \tmp, \tmp, #16 -+ and \tmp, \tmp, #0xf @ cache line size encoding -+ mov \reg, #4 @ bytes per word - mov \reg, \reg, lsl \tmp @ actual cache line size - .endm - -+/* -+ * icache_line_size - get the minimum I-cache line size from the CTR register -+ * on ARMv7. -+ */ -+ .macro icache_line_size, reg, tmp -+ mrc p15, 0, \tmp, c0, c0, 1 @ read ctr -+ and \tmp, \tmp, #0xf @ cache line size encoding -+ mov \reg, #4 @ bytes per word -+ mov \reg, \reg, lsl \tmp @ actual cache line size -+ .endm - - /* - * Sanity check the PTE configuration for the code below - which makes -diff --git a/arch/arm/plat-omap/counter_32k.c b/arch/arm/plat-omap/counter_32k.c -index 155fe43..8722a13 100644 ---- a/arch/arm/plat-omap/counter_32k.c -+++ b/arch/arm/plat-omap/counter_32k.c -@@ -16,6 +16,7 @@ - #include - #include - #include -+#include - - #include - #include -@@ -164,7 +165,7 @@ static int __init omap_init_clocksource_32k(void) - return -ENODEV; - - sync_32k_ick = clk_get(NULL, "omap_32ksync_ick"); -- if (sync_32k_ick) -+ if (!IS_ERR(sync_32k_ick)) - clk_enable(sync_32k_ick); - - clocksource_32k.mult = clocksource_hz2mult(32768, -diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c -index e2c8eeb..74dac41 100644 ---- a/arch/arm/plat-omap/sram.c -+++ b/arch/arm/plat-omap/sram.c -@@ -166,7 +166,7 @@ static void __init omap_detect_sram(void) - cpu_is_omap1710()) - omap_sram_size = 0x4000; /* 16K */ - else if (cpu_is_omap1611()) -- omap_sram_size = 0x3e800; /* 250K */ -+ omap_sram_size = SZ_256K; - else { - printk(KERN_ERR "Could not detect SRAM size\n"); - omap_sram_size = 0x4000; -diff --git a/arch/arm/plat-s3c24xx/cpu.c b/arch/arm/plat-s3c24xx/cpu.c -index 76d0858..4a10c0f 100644 ---- a/arch/arm/plat-s3c24xx/cpu.c -+++ b/arch/arm/plat-s3c24xx/cpu.c -@@ -88,7 +88,7 @@ static struct cpu_table cpu_ids[] __initdata = { - { - .idcode = 0x32440000, - .idmask = 0xffffffff, -- .map_io = s3c244x_map_io, -+ .map_io = s3c2440_map_io, - .init_clocks = s3c244x_init_clocks, - .init_uarts = s3c244x_init_uarts, - .init = s3c2440_init, -@@ -97,7 +97,7 @@ static struct cpu_table cpu_ids[] __initdata = { - { - .idcode = 0x32440001, - .idmask = 0xffffffff, -- .map_io = s3c244x_map_io, -+ .map_io = s3c2440_map_io, - .init_clocks = s3c244x_init_clocks, - .init_uarts = s3c244x_init_uarts, - .init = s3c2440_init, -@@ -106,7 +106,7 @@ static struct cpu_table cpu_ids[] __initdata = { - { - .idcode = 0x32440aaa, - .idmask = 0xffffffff, -- .map_io = s3c244x_map_io, -+ .map_io = s3c2442_map_io, - .init_clocks = s3c244x_init_clocks, - .init_uarts = s3c244x_init_uarts, - .init = s3c2442_init, -@@ -115,7 +115,7 @@ static struct cpu_table cpu_ids[] __initdata = { - { - .idcode = 0x32440aab, - .idmask = 0xffffffff, -- .map_io = s3c244x_map_io, -+ .map_io = s3c2442_map_io, - .init_clocks = s3c244x_init_clocks, - .init_uarts = s3c244x_init_uarts, - .init = s3c2442_init, -diff --git a/arch/arm/plat-s3c24xx/gpiolib.c b/arch/arm/plat-s3c24xx/gpiolib.c -index 24c6f5a..243b641 100644 ---- a/arch/arm/plat-s3c24xx/gpiolib.c -+++ b/arch/arm/plat-s3c24xx/gpiolib.c -@@ -82,8 +82,6 @@ static struct s3c_gpio_cfg s3c24xx_gpiocfg_banka = { - struct s3c_gpio_cfg s3c24xx_gpiocfg_default = { - .set_config = s3c_gpio_setcfg_s3c24xx, - .get_config = s3c_gpio_getcfg_s3c24xx, -- .set_pull = s3c_gpio_setpull_1up, -- .get_pull = s3c_gpio_getpull_1up, - }; - - struct s3c_gpio_chip s3c24xx_gpios[] = { -diff --git a/arch/arm/plat-s3c24xx/include/plat/s3c244x.h b/arch/arm/plat-s3c24xx/include/plat/s3c244x.h -index 307248d..89e8d0a 100644 ---- a/arch/arm/plat-s3c24xx/include/plat/s3c244x.h -+++ b/arch/arm/plat-s3c24xx/include/plat/s3c244x.h -@@ -21,17 +21,22 @@ extern void s3c244x_init_clocks(int xtal); - #else - #define s3c244x_init_clocks NULL - #define s3c244x_init_uarts NULL --#define s3c244x_map_io NULL - #endif - - #ifdef CONFIG_CPU_S3C2440 - extern int s3c2440_init(void); -+ -+extern void s3c2440_map_io(void); - #else - #define s3c2440_init NULL -+#define s3c2440_map_io NULL - #endif - - #ifdef CONFIG_CPU_S3C2442 - extern int s3c2442_init(void); -+ -+extern void s3c2442_map_io(void); - #else - #define s3c2442_init NULL -+#define s3c2442_map_io NULL - #endif -diff --git a/arch/arm/plat-samsung/gpio-config.c b/arch/arm/plat-samsung/gpio-config.c -index b732b77..0aa32f2 100644 ---- a/arch/arm/plat-samsung/gpio-config.c -+++ b/arch/arm/plat-samsung/gpio-config.c -@@ -280,18 +280,17 @@ s3c_gpio_pull_t s3c_gpio_getpull_updown(struct s3c_gpio_chip *chip, - } - #endif - --#ifdef CONFIG_S3C_GPIO_PULL_UP --int s3c_gpio_setpull_1up(struct s3c_gpio_chip *chip, -- unsigned int off, s3c_gpio_pull_t pull) -+#if defined(CONFIG_S3C_GPIO_PULL_UP) || defined(CONFIG_S3C_GPIO_PULL_DOWN) -+static int s3c_gpio_setpull_1(struct s3c_gpio_chip *chip, -+ unsigned int off, s3c_gpio_pull_t pull, -+ s3c_gpio_pull_t updown) - { - void __iomem *reg = chip->base + 0x08; - u32 pup = __raw_readl(reg); - -- pup = __raw_readl(reg); -- -- if (pup == S3C_GPIO_PULL_UP) -+ if (pull == updown) - pup &= ~(1 << off); -- else if (pup == S3C_GPIO_PULL_NONE) -+ else if (pull == S3C_GPIO_PULL_NONE) - pup |= (1 << off); - else - return -EINVAL; -@@ -300,17 +299,45 @@ int s3c_gpio_setpull_1up(struct s3c_gpio_chip *chip, - return 0; - } - --s3c_gpio_pull_t s3c_gpio_getpull_1up(struct s3c_gpio_chip *chip, -- unsigned int off) -+static s3c_gpio_pull_t s3c_gpio_getpull_1(struct s3c_gpio_chip *chip, -+ unsigned int off, s3c_gpio_pull_t updown) - { - void __iomem *reg = chip->base + 0x08; - u32 pup = __raw_readl(reg); - - pup &= (1 << off); -- return pup ? S3C_GPIO_PULL_NONE : S3C_GPIO_PULL_UP; -+ return pup ? S3C_GPIO_PULL_NONE : updown; -+} -+#endif /* CONFIG_S3C_GPIO_PULL_UP || CONFIG_S3C_GPIO_PULL_DOWN */ -+ -+#ifdef CONFIG_S3C_GPIO_PULL_UP -+s3c_gpio_pull_t s3c_gpio_getpull_1up(struct s3c_gpio_chip *chip, -+ unsigned int off) -+{ -+ return s3c_gpio_getpull_1(chip, off, S3C_GPIO_PULL_UP); -+} -+ -+int s3c_gpio_setpull_1up(struct s3c_gpio_chip *chip, -+ unsigned int off, s3c_gpio_pull_t pull) -+{ -+ return s3c_gpio_setpull_1(chip, off, pull, S3C_GPIO_PULL_UP); - } - #endif /* CONFIG_S3C_GPIO_PULL_UP */ - -+#ifdef CONFIG_S3C_GPIO_PULL_DOWN -+s3c_gpio_pull_t s3c_gpio_getpull_1down(struct s3c_gpio_chip *chip, -+ unsigned int off) -+{ -+ return s3c_gpio_getpull_1(chip, off, S3C_GPIO_PULL_DOWN); -+} -+ -+int s3c_gpio_setpull_1down(struct s3c_gpio_chip *chip, -+ unsigned int off, s3c_gpio_pull_t pull) -+{ -+ return s3c_gpio_setpull_1(chip, off, pull, S3C_GPIO_PULL_DOWN); -+} -+#endif /* CONFIG_S3C_GPIO_PULL_DOWN */ -+ - #ifdef CONFIG_S5P_GPIO_DRVSTR - s5p_gpio_drvstr_t s5p_gpio_get_drvstr(unsigned int pin) - { -diff --git a/arch/arm/plat-samsung/include/plat/gpio-cfg-helpers.h b/arch/arm/plat-samsung/include/plat/gpio-cfg-helpers.h -index 8fd65d8..0d2c570 100644 ---- a/arch/arm/plat-samsung/include/plat/gpio-cfg-helpers.h -+++ b/arch/arm/plat-samsung/include/plat/gpio-cfg-helpers.h -@@ -210,6 +210,17 @@ extern s3c_gpio_pull_t s3c_gpio_getpull_1up(struct s3c_gpio_chip *chip, - unsigned int off); - - /** -+ * s3c_gpio_getpull_1down() - Get configuration for choice of down or none -+ * @chip: The gpio chip that the GPIO pin belongs to -+ * @off: The offset to the pin to get the configuration of. -+ * -+ * This helper function reads the state of the pull-down resistor for the -+ * given GPIO in the same case as s3c_gpio_setpull_1down. -+*/ -+extern s3c_gpio_pull_t s3c_gpio_getpull_1down(struct s3c_gpio_chip *chip, -+ unsigned int off); -+ -+/** - * s3c_gpio_setpull_s3c2443() - Pull configuration for s3c2443. - * @chip: The gpio chip that is being configured. - * @off: The offset for the GPIO being configured. -diff --git a/arch/arm/tools/mach-types b/arch/arm/tools/mach-types -index 55590a4..2fea897 100644 ---- a/arch/arm/tools/mach-types -+++ b/arch/arm/tools/mach-types -@@ -12,7 +12,7 @@ - # - # http://www.arm.linux.org.uk/developer/machines/?action=new - # --# Last update: Thu Sep 9 22:43:01 2010 -+# Last update: Sun Dec 12 23:24:27 2010 - # - # machine_is_xxx CONFIG_xxxx MACH_TYPE_xxx number - # -@@ -2321,7 +2321,7 @@ mx31txtr MACH_MX31TXTR MX31TXTR 2332 - u380 MACH_U380 U380 2333 - oamp3_hualu MACH_HUALU_BOARD HUALU_BOARD 2334 - npcmx50 MACH_NPCMX50 NPCMX50 2335 --mx51_lange51 MACH_MX51_LANGE51 MX51_LANGE51 2336 -+mx51_efikamx MACH_MX51_EFIKAMX MX51_EFIKAMX 2336 - mx51_lange52 MACH_MX51_LANGE52 MX51_LANGE52 2337 - riom MACH_RIOM RIOM 2338 - comcas MACH_COMCAS COMCAS 2339 -@@ -2355,7 +2355,7 @@ at91sam9263cs MACH_AT91SAM9263CS AT91SAM9263CS 2366 - csb732 MACH_CSB732 CSB732 2367 - u8500 MACH_U8500 U8500 2368 - huqiu MACH_HUQIU HUQIU 2369 --mx51_kunlun MACH_MX51_KUNLUN MX51_KUNLUN 2370 -+mx51_efikasb MACH_MX51_EFIKASB MX51_EFIKASB 2370 - pmt1g MACH_PMT1G PMT1G 2371 - htcelf MACH_HTCELF HTCELF 2372 - armadillo420 MACH_ARMADILLO420 ARMADILLO420 2373 -@@ -2971,7 +2971,7 @@ premierwave_en MACH_PREMIERWAVE_EN PREMIERWAVE_EN 2985 - wasabi MACH_WASABI WASABI 2986 - vivow MACH_VIVOW VIVOW 2987 - mx50_rdp MACH_MX50_RDP MX50_RDP 2988 --universal MACH_UNIVERSAL UNIVERSAL 2989 -+universal_c210 MACH_UNIVERSAL_C210 UNIVERSAL_C210 2989 - real6410 MACH_REAL6410 REAL6410 2990 - spx_sakura MACH_SPX_SAKURA SPX_SAKURA 2991 - ij3k_2440 MACH_IJ3K_2440 IJ3K_2440 2992 -@@ -3044,3 +3044,178 @@ harvest_desoto MACH_HARVEST_DESOTO HARVEST_DESOTO 3059 - msm8x60_qrdc MACH_MSM8X60_QRDC MSM8X60_QRDC 3060 - spear900 MACH_SPEAR900 SPEAR900 3061 - pcontrol_g20 MACH_PCONTROL_G20 PCONTROL_G20 3062 -+rdstor MACH_RDSTOR RDSTOR 3063 -+usdloader MACH_USDLOADER USDLOADER 3064 -+tsoploader MACH_TSOPLOADER TSOPLOADER 3065 -+kronos MACH_KRONOS KRONOS 3066 -+ffcore MACH_FFCORE FFCORE 3067 -+mone MACH_MONE MONE 3068 -+unit2s MACH_UNIT2S UNIT2S 3069 -+acer_a5 MACH_ACER_A5 ACER_A5 3070 -+etherpro_isp MACH_ETHERPRO_ISP ETHERPRO_ISP 3071 -+stretchs7000 MACH_STRETCHS7000 STRETCHS7000 3072 -+p87_smartsim MACH_P87_SMARTSIM P87_SMARTSIM 3073 -+tulip MACH_TULIP TULIP 3074 -+sunflower MACH_SUNFLOWER SUNFLOWER 3075 -+rib MACH_RIB RIB 3076 -+clod MACH_CLOD CLOD 3077 -+rump MACH_RUMP RUMP 3078 -+tenderloin MACH_TENDERLOIN TENDERLOIN 3079 -+shortloin MACH_SHORTLOIN SHORTLOIN 3080 -+crespo MACH_CRESPO CRESPO 3081 -+antares MACH_ANTARES ANTARES 3082 -+wb40n MACH_WB40N WB40N 3083 -+herring MACH_HERRING HERRING 3084 -+naxy400 MACH_NAXY400 NAXY400 3085 -+naxy1200 MACH_NAXY1200 NAXY1200 3086 -+vpr200 MACH_VPR200 VPR200 3087 -+bug20 MACH_BUG20 BUG20 3088 -+goflexnet MACH_GOFLEXNET GOFLEXNET 3089 -+torbreck MACH_TORBRECK TORBRECK 3090 -+saarb_mg1 MACH_SAARB_MG1 SAARB_MG1 3091 -+callisto MACH_CALLISTO CALLISTO 3092 -+multhsu MACH_MULTHSU MULTHSU 3093 -+saluda MACH_SALUDA SALUDA 3094 -+pemp_omap3_apollo MACH_PEMP_OMAP3_APOLLO PEMP_OMAP3_APOLLO 3095 -+vc0718 MACH_VC0718 VC0718 3096 -+mvblx MACH_MVBLX MVBLX 3097 -+inhand_apeiron MACH_INHAND_APEIRON INHAND_APEIRON 3098 -+inhand_fury MACH_INHAND_FURY INHAND_FURY 3099 -+inhand_siren MACH_INHAND_SIREN INHAND_SIREN 3100 -+hdnvp MACH_HDNVP HDNVP 3101 -+softwinner MACH_SOFTWINNER SOFTWINNER 3102 -+prima2_evb MACH_PRIMA2_EVB PRIMA2_EVB 3103 -+nas6210 MACH_NAS6210 NAS6210 3104 -+unisdev MACH_UNISDEV UNISDEV 3105 -+sbca11 MACH_SBCA11 SBCA11 3106 -+saga MACH_SAGA SAGA 3107 -+ns_k330 MACH_NS_K330 NS_K330 3108 -+tanna MACH_TANNA TANNA 3109 -+imate8502 MACH_IMATE8502 IMATE8502 3110 -+aspen MACH_ASPEN ASPEN 3111 -+daintree_cwac MACH_DAINTREE_CWAC DAINTREE_CWAC 3112 -+zmx25 MACH_ZMX25 ZMX25 3113 -+maple1 MACH_MAPLE1 MAPLE1 3114 -+qsd8x72_surf MACH_QSD8X72_SURF QSD8X72_SURF 3115 -+qsd8x72_ffa MACH_QSD8X72_FFA QSD8X72_FFA 3116 -+abilene MACH_ABILENE ABILENE 3117 -+eigen_ttr MACH_EIGEN_TTR EIGEN_TTR 3118 -+iomega_ix2_200 MACH_IOMEGA_IX2_200 IOMEGA_IX2_200 3119 -+coretec_vcx7400 MACH_CORETEC_VCX7400 CORETEC_VCX7400 3120 -+santiago MACH_SANTIAGO SANTIAGO 3121 -+mx257sol MACH_MX257SOL MX257SOL 3122 -+strasbourg MACH_STRASBOURG STRASBOURG 3123 -+msm8x60_fluid MACH_MSM8X60_FLUID MSM8X60_FLUID 3124 -+smartqv5 MACH_SMARTQV5 SMARTQV5 3125 -+smartqv3 MACH_SMARTQV3 SMARTQV3 3126 -+smartqv7 MACH_SMARTQV7 SMARTQV7 3127 -+paz00 MACH_PAZ00 PAZ00 3128 -+acmenetusfoxg20 MACH_ACMENETUSFOXG20 ACMENETUSFOXG20 3129 -+htcwillow MACH_HTCWILLOW HTCWILLOW 3130 -+fwbd_0404 MACH_FWBD_0404 FWBD_0404 3131 -+hdgu MACH_HDGU HDGU 3132 -+pyramid MACH_PYRAMID PYRAMID 3133 -+epiphan MACH_EPIPHAN EPIPHAN 3134 -+omap_bender MACH_OMAP_BENDER OMAP_BENDER 3135 -+gurnard MACH_GURNARD GURNARD 3136 -+gtl_it5100 MACH_GTL_IT5100 GTL_IT5100 3137 -+bcm2708 MACH_BCM2708 BCM2708 3138 -+mx51_ggc MACH_MX51_GGC MX51_GGC 3139 -+sharespace MACH_SHARESPACE SHARESPACE 3140 -+haba_knx_explorer MACH_HABA_KNX_EXPLORER HABA_KNX_EXPLORER 3141 -+simtec_kirkmod MACH_SIMTEC_KIRKMOD SIMTEC_KIRKMOD 3142 -+crux MACH_CRUX CRUX 3143 -+mx51_bravo MACH_MX51_BRAVO MX51_BRAVO 3144 -+charon MACH_CHARON CHARON 3145 -+picocom3 MACH_PICOCOM3 PICOCOM3 3146 -+picocom4 MACH_PICOCOM4 PICOCOM4 3147 -+serrano MACH_SERRANO SERRANO 3148 -+doubleshot MACH_DOUBLESHOT DOUBLESHOT 3149 -+evsy MACH_EVSY EVSY 3150 -+huashan MACH_HUASHAN HUASHAN 3151 -+lausanne MACH_LAUSANNE LAUSANNE 3152 -+emerald MACH_EMERALD EMERALD 3153 -+tqma35 MACH_TQMA35 TQMA35 3154 -+marvel MACH_MARVEL MARVEL 3155 -+manuae MACH_MANUAE MANUAE 3156 -+chacha MACH_CHACHA CHACHA 3157 -+lemon MACH_LEMON LEMON 3158 -+csc MACH_CSC CSC 3159 -+gira_knxip_router MACH_GIRA_KNXIP_ROUTER GIRA_KNXIP_ROUTER 3160 -+t20 MACH_T20 T20 3161 -+hdmini MACH_HDMINI HDMINI 3162 -+sciphone_g2 MACH_SCIPHONE_G2 SCIPHONE_G2 3163 -+express MACH_EXPRESS EXPRESS 3164 -+express_kt MACH_EXPRESS_KT EXPRESS_KT 3165 -+maximasp MACH_MAXIMASP MAXIMASP 3166 -+nitrogen_imx51 MACH_NITROGEN_IMX51 NITROGEN_IMX51 3167 -+nitrogen_imx53 MACH_NITROGEN_IMX53 NITROGEN_IMX53 3168 -+sunfire MACH_SUNFIRE SUNFIRE 3169 -+arowana MACH_AROWANA AROWANA 3170 -+tegra_daytona MACH_TEGRA_DAYTONA TEGRA_DAYTONA 3171 -+tegra_swordfish MACH_TEGRA_SWORDFISH TEGRA_SWORDFISH 3172 -+edison MACH_EDISON EDISON 3173 -+svp8500v1 MACH_SVP8500V1 SVP8500V1 3174 -+svp8500v2 MACH_SVP8500V2 SVP8500V2 3175 -+svp5500 MACH_SVP5500 SVP5500 3176 -+b5500 MACH_B5500 B5500 3177 -+s5500 MACH_S5500 S5500 3178 -+icon MACH_ICON ICON 3179 -+elephant MACH_ELEPHANT ELEPHANT 3180 -+msm8x60_fusion MACH_MSM8X60_FUSION MSM8X60_FUSION 3181 -+shooter MACH_SHOOTER SHOOTER 3182 -+spade_lte MACH_SPADE_LTE SPADE_LTE 3183 -+philhwani MACH_PHILHWANI PHILHWANI 3184 -+gsncomm MACH_GSNCOMM GSNCOMM 3185 -+strasbourg_a2 MACH_STRASBOURG_A2 STRASBOURG_A2 3186 -+mmm MACH_MMM MMM 3187 -+davinci_dm365_bv MACH_DAVINCI_DM365_BV DAVINCI_DM365_BV 3188 -+ag5evm MACH_AG5EVM AG5EVM 3189 -+sc575plc MACH_SC575PLC SC575PLC 3190 -+sc575hmi MACH_SC575IPC SC575IPC 3191 -+omap3_tdm3730 MACH_OMAP3_TDM3730 OMAP3_TDM3730 3192 -+g7 MACH_G7 G7 3193 -+top9000_eval MACH_TOP9000_EVAL TOP9000_EVAL 3194 -+top9000_su MACH_TOP9000_SU TOP9000_SU 3195 -+utm300 MACH_UTM300 UTM300 3196 -+tsunagi MACH_TSUNAGI TSUNAGI 3197 -+ts75xx MACH_TS75XX TS75XX 3198 -+msm8x60_fusn_ffa MACH_MSM8X60_FUSN_FFA MSM8X60_FUSN_FFA 3199 -+ts47xx MACH_TS47XX TS47XX 3200 -+da850_k5 MACH_DA850_K5 DA850_K5 3201 -+ax502 MACH_AX502 AX502 3202 -+igep0032 MACH_IGEP0032 IGEP0032 3203 -+antero MACH_ANTERO ANTERO 3204 -+synergy MACH_SYNERGY SYNERGY 3205 -+ics_if_voip MACH_ICS_IF_VOIP ICS_IF_VOIP 3206 -+wlf_cragg_6410 MACH_WLF_CRAGG_6410 WLF_CRAGG_6410 3207 -+punica MACH_PUNICA PUNICA 3208 -+sbc_nt250 MACH_SBC_NT250 SBC_NT250 3209 -+mx27_wmultra MACH_MX27_WMULTRA MX27_WMULTRA 3210 -+mackerel MACH_MACKEREL MACKEREL 3211 -+fa9x27 MACH_FA9X27 FA9X27 3213 -+ns2816tb MACH_NS2816TB NS2816TB 3214 -+ns2816_ntpad MACH_NS2816_NTPAD NS2816_NTPAD 3215 -+ns2816_ntnb MACH_NS2816_NTNB NS2816_NTNB 3216 -+kaen MACH_KAEN KAEN 3217 -+nv1000 MACH_NV1000 NV1000 3218 -+nuc950ts MACH_NUC950TS NUC950TS 3219 -+nokia_rm680 MACH_NOKIA_RM680 NOKIA_RM680 3220 -+ast2200 MACH_AST2200 AST2200 3221 -+lead MACH_LEAD LEAD 3222 -+unino1 MACH_UNINO1 UNINO1 3223 -+greeco MACH_GREECO GREECO 3224 -+verdi MACH_VERDI VERDI 3225 -+dm6446_adbox MACH_DM6446_ADBOX DM6446_ADBOX 3226 -+quad_salsa MACH_QUAD_SALSA QUAD_SALSA 3227 -+abb_gma_1_1 MACH_ABB_GMA_1_1 ABB_GMA_1_1 3228 -+svcid MACH_SVCID SVCID 3229 -+msm8960_sim MACH_MSM8960_SIM MSM8960_SIM 3230 -+msm8960_rumi3 MACH_MSM8960_RUMI3 MSM8960_RUMI3 3231 -+icon_g MACH_ICON_G ICON_G 3232 -+mb3 MACH_MB3 MB3 3233 -+gsia18s MACH_GSIA18S GSIA18S 3234 -+pivicc MACH_PIVICC PIVICC 3235 -+pcm048 MACH_PCM048 PCM048 3236 -+dds MACH_DDS DDS 3237 -+chalten_xa1 MACH_CHALTEN_XA1 CHALTEN_XA1 3238 -diff --git a/arch/mn10300/kernel/gdb-io-serial.c b/arch/mn10300/kernel/gdb-io-serial.c -index 0d5d63c..f28dc99 100644 ---- a/arch/mn10300/kernel/gdb-io-serial.c -+++ b/arch/mn10300/kernel/gdb-io-serial.c -@@ -73,7 +73,8 @@ void gdbstub_io_init(void) - GDBPORT_SERIAL_IER = UART_IER_RDI | UART_IER_RLSI; - - /* permit level 0 IRQs to take place */ -- local_change_intr_mask_level(NUM2EPSW_IM(CONFIG_GDBSTUB_IRQ_LEVEL + 1)); -+ arch_local_change_intr_mask_level( -+ NUM2EPSW_IM(CONFIG_GDBSTUB_IRQ_LEVEL + 1)); - } - - /* -diff --git a/arch/mn10300/kernel/gdb-io-ttysm.c b/arch/mn10300/kernel/gdb-io-ttysm.c -index 97dfda2..abdeea1 100644 ---- a/arch/mn10300/kernel/gdb-io-ttysm.c -+++ b/arch/mn10300/kernel/gdb-io-ttysm.c -@@ -87,7 +87,8 @@ void __init gdbstub_io_init(void) - tmp = *gdbstub_port->_control; - - /* permit level 0 IRQs only */ -- local_change_intr_mask_level(NUM2EPSW_IM(CONFIG_GDBSTUB_IRQ_LEVEL + 1)); -+ arch_local_change_intr_mask_level( -+ NUM2EPSW_IM(CONFIG_GDBSTUB_IRQ_LEVEL + 1)); - } - - /* -diff --git a/arch/mn10300/kernel/gdb-stub.c b/arch/mn10300/kernel/gdb-stub.c -index a5fc3f0..b169d99 100644 ---- a/arch/mn10300/kernel/gdb-stub.c -+++ b/arch/mn10300/kernel/gdb-stub.c -@@ -1194,7 +1194,8 @@ static int gdbstub(struct pt_regs *regs, enum exception_code excep) - - asm volatile("mov mdr,%0" : "=d"(mdr)); - local_save_flags(epsw); -- local_change_intr_mask_level(NUM2EPSW_IM(CONFIG_GDBSTUB_IRQ_LEVEL + 1)); -+ arch_local_change_intr_mask_level( -+ NUM2EPSW_IM(CONFIG_GDBSTUB_IRQ_LEVEL + 1)); - - gdbstub_store_fpu(); - -diff --git a/arch/s390/kernel/vtime.c b/arch/s390/kernel/vtime.c -index 56c8687..7eff9b7 100644 ---- a/arch/s390/kernel/vtime.c -+++ b/arch/s390/kernel/vtime.c -@@ -19,6 +19,7 @@ - #include - #include - #include -+#include - - #include - #include -@@ -566,6 +567,23 @@ void init_cpu_vtimer(void) - __ctl_set_bit(0,10); - } - -+static int __cpuinit s390_nohz_notify(struct notifier_block *self, -+ unsigned long action, void *hcpu) -+{ -+ struct s390_idle_data *idle; -+ long cpu = (long) hcpu; -+ -+ idle = &per_cpu(s390_idle, cpu); -+ switch (action) { -+ case CPU_DYING: -+ case CPU_DYING_FROZEN: -+ idle->nohz_delay = 0; -+ default: -+ break; -+ } -+ return NOTIFY_OK; -+} -+ - void __init vtime_init(void) - { - /* request the cpu timer external interrupt */ -@@ -574,5 +592,6 @@ void __init vtime_init(void) - - /* Enable cpu timer interrupts on the boot cpu. */ - init_cpu_vtimer(); -+ cpu_notifier(s390_nohz_notify, 0); - } - -diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig -index 7f217b3..2e9d78d 100644 ---- a/arch/sh/Kconfig -+++ b/arch/sh/Kconfig -@@ -22,7 +22,8 @@ config SUPERH - select HAVE_SPARSE_IRQ - select RTC_LIB - select GENERIC_ATOMIC64 -- select GENERIC_HARDIRQS_NO_DEPRECATED -+ # Support the deprecated APIs until MFD and GPIOLIB catch up. -+ select GENERIC_HARDIRQS_NO_DEPRECATED if !MFD_SUPPORT && !GPIOLIB - help - The SuperH is a RISC processor targeted for use in embedded systems - and consumer electronics; it was also used in the Sega Dreamcast -diff --git a/arch/sh/include/asm/unistd_32.h b/arch/sh/include/asm/unistd_32.h -index 903cd61..d6741fc 100644 ---- a/arch/sh/include/asm/unistd_32.h -+++ b/arch/sh/include/asm/unistd_32.h -@@ -368,8 +368,9 @@ - #define __NR_sendmsg 355 - #define __NR_recvmsg 356 - #define __NR_recvmmsg 357 -+#define __NR_accept4 358 - --#define NR_syscalls 358 -+#define NR_syscalls 359 - - #ifdef __KERNEL__ - -diff --git a/arch/sh/kernel/syscalls_32.S b/arch/sh/kernel/syscalls_32.S -index e872e81..6fc347e 100644 ---- a/arch/sh/kernel/syscalls_32.S -+++ b/arch/sh/kernel/syscalls_32.S -@@ -375,3 +375,4 @@ ENTRY(sys_call_table) - .long sys_sendmsg /* 355 */ - .long sys_recvmsg - .long sys_recvmmsg -+ .long sys_accept4 -diff --git a/arch/sparc/include/asm/openprom.h b/arch/sparc/include/asm/openprom.h -index 81cd434..47eaafa 100644 ---- a/arch/sparc/include/asm/openprom.h -+++ b/arch/sparc/include/asm/openprom.h -@@ -39,7 +39,7 @@ struct linux_dev_v2_funcs { - int (*v2_dev_open)(char *devpath); - void (*v2_dev_close)(int d); - int (*v2_dev_read)(int d, char *buf, int nbytes); -- int (*v2_dev_write)(int d, char *buf, int nbytes); -+ int (*v2_dev_write)(int d, const char *buf, int nbytes); - int (*v2_dev_seek)(int d, int hi, int lo); - - /* Never issued (multistage load support) */ -diff --git a/arch/sparc/include/asm/oplib_32.h b/arch/sparc/include/asm/oplib_32.h -index 51296a6..9e5c640 100644 ---- a/arch/sparc/include/asm/oplib_32.h -+++ b/arch/sparc/include/asm/oplib_32.h -@@ -60,25 +60,6 @@ extern char *prom_getbootargs(void); - extern char *prom_mapio(char *virt_hint, int io_space, unsigned int phys_addr, unsigned int num_bytes); - extern void prom_unmapio(char *virt_addr, unsigned int num_bytes); - --/* Device operations. */ -- --/* Open the device described by the passed string. Note, that the format -- * of the string is different on V0 vs. V2->higher proms. The caller must -- * know what he/she is doing! Returns the device descriptor, an int. -- */ --extern int prom_devopen(char *device_string); -- --/* Close a previously opened device described by the passed integer -- * descriptor. -- */ --extern int prom_devclose(int device_handle); -- --/* Do a seek operation on the device described by the passed integer -- * descriptor. -- */ --extern void prom_seek(int device_handle, unsigned int seek_hival, -- unsigned int seek_lowval); -- - /* Miscellaneous routines, don't really fit in any category per se. */ - - /* Reboot the machine with the command line passed. */ -@@ -121,19 +102,8 @@ extern int prom_getrev(void); - /* Get the prom firmware revision. */ - extern int prom_getprev(void); - --/* Character operations to/from the console.... */ -- --/* Non-blocking get character from console. */ --extern int prom_nbgetchar(void); -- --/* Non-blocking put character to console. */ --extern int prom_nbputchar(char character); -- --/* Blocking get character from console. */ --extern char prom_getchar(void); -- --/* Blocking put character to console. */ --extern void prom_putchar(char character); -+/* Write a buffer of characters to the console. */ -+extern void prom_console_write_buf(const char *buf, int len); - - /* Prom's internal routines, don't use in kernel/boot code. */ - extern void prom_printf(const char *fmt, ...); -@@ -238,7 +208,6 @@ extern int prom_node_has_property(phandle node, char *property); - extern int prom_setprop(phandle node, const char *prop_name, char *prop_value, - int value_size); - --extern phandle prom_pathtoinode(char *path); - extern phandle prom_inst2pkg(int); - - /* Dorking with Bus ranges... */ -diff --git a/arch/sparc/include/asm/oplib_64.h b/arch/sparc/include/asm/oplib_64.h -index c9cc078..8cd0df3 100644 ---- a/arch/sparc/include/asm/oplib_64.h -+++ b/arch/sparc/include/asm/oplib_64.h -@@ -67,27 +67,6 @@ extern void prom_init(void *cif_handler, void *cif_stack); - /* Boot argument acquisition, returns the boot command line string. */ - extern char *prom_getbootargs(void); - --/* Device utilities. */ -- --/* Device operations. */ -- --/* Open the device described by the passed string. Note, that the format -- * of the string is different on V0 vs. V2->higher proms. The caller must -- * know what he/she is doing! Returns the device descriptor, an int. -- */ --extern int prom_devopen(const char *device_string); -- --/* Close a previously opened device described by the passed integer -- * descriptor. -- */ --extern int prom_devclose(int device_handle); -- --/* Do a seek operation on the device described by the passed integer -- * descriptor. -- */ --extern void prom_seek(int device_handle, unsigned int seek_hival, -- unsigned int seek_lowval); -- - /* Miscellaneous routines, don't really fit in any category per se. */ - - /* Reboot the machine with the command line passed. */ -@@ -109,33 +88,14 @@ extern void prom_halt(void) __attribute__ ((noreturn)); - /* Halt and power-off the machine. */ - extern void prom_halt_power_off(void) __attribute__ ((noreturn)); - --/* Set the PROM 'sync' callback function to the passed function pointer. -- * When the user gives the 'sync' command at the prom prompt while the -- * kernel is still active, the prom will call this routine. -- * -- */ --typedef int (*callback_func_t)(long *cmd); --extern void prom_setcallback(callback_func_t func_ptr); -- - /* Acquire the IDPROM of the root node in the prom device tree. This - * gets passed a buffer where you would like it stuffed. The return value - * is the format type of this idprom or 0xff on error. - */ - extern unsigned char prom_get_idprom(char *idp_buffer, int idpbuf_size); - --/* Character operations to/from the console.... */ -- --/* Non-blocking get character from console. */ --extern int prom_nbgetchar(void); -- --/* Non-blocking put character to console. */ --extern int prom_nbputchar(char character); -- --/* Blocking get character from console. */ --extern char prom_getchar(void); -- --/* Blocking put character to console. */ --extern void prom_putchar(char character); -+/* Write a buffer of characters to the console. */ -+extern void prom_console_write_buf(const char *buf, int len); - - /* Prom's internal routines, don't use in kernel/boot code. */ - extern void prom_printf(const char *fmt, ...); -@@ -279,9 +239,7 @@ extern phandle prom_finddevice(const char *name); - extern int prom_setprop(phandle node, const char *prop_name, char *prop_value, - int value_size); - --extern phandle prom_pathtoinode(const char *path); - extern phandle prom_inst2pkg(int); --extern int prom_service_exists(const char *service_name); - extern void prom_sun4v_guest_soft_state(void); - - extern int prom_ihandle2path(int handle, char *buffer, int bufsize); -diff --git a/arch/sparc/kernel/leon_kernel.c b/arch/sparc/kernel/leon_kernel.c -index 2d51527..f01c426 100644 ---- a/arch/sparc/kernel/leon_kernel.c -+++ b/arch/sparc/kernel/leon_kernel.c -@@ -114,7 +114,7 @@ void __init leon_init_timers(irq_handler_t counter_fn) - if (leon3_gptimer_regs && leon3_irqctrl_regs) { - LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[0].val, 0); - LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[0].rld, -- (((1000000 / 100) - 1))); -+ (((1000000 / HZ) - 1))); - LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[0].ctrl, 0); - - #ifdef CONFIG_SMP -@@ -128,7 +128,7 @@ void __init leon_init_timers(irq_handler_t counter_fn) - } - - LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[1].val, 0); -- LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[1].rld, (((1000000/100) - 1))); -+ LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[1].rld, (((1000000/HZ) - 1))); - LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[1].ctrl, 0); - # endif - -diff --git a/arch/sparc/prom/Makefile b/arch/sparc/prom/Makefile -index 1b8c073..816c0fa 100644 ---- a/arch/sparc/prom/Makefile -+++ b/arch/sparc/prom/Makefile -@@ -6,7 +6,6 @@ ccflags := -Werror - - lib-y := bootstr_$(BITS).o - lib-$(CONFIG_SPARC32) += devmap.o --lib-y += devops_$(BITS).o - lib-y += init_$(BITS).o - lib-$(CONFIG_SPARC32) += memory.o - lib-y += misc_$(BITS).o -diff --git a/arch/sparc/prom/console_32.c b/arch/sparc/prom/console_32.c -index 5340264..4886310 100644 ---- a/arch/sparc/prom/console_32.c -+++ b/arch/sparc/prom/console_32.c -@@ -16,63 +16,26 @@ - - extern void restore_current(void); - --/* Non blocking get character from console input device, returns -1 -- * if no input was taken. This can be used for polling. -- */ --int --prom_nbgetchar(void) --{ -- static char inc; -- int i = -1; -- unsigned long flags; -- -- spin_lock_irqsave(&prom_lock, flags); -- switch(prom_vers) { -- case PROM_V0: -- i = (*(romvec->pv_nbgetchar))(); -- break; -- case PROM_V2: -- case PROM_V3: -- if( (*(romvec->pv_v2devops).v2_dev_read)(*romvec->pv_v2bootargs.fd_stdin , &inc, 0x1) == 1) { -- i = inc; -- } else { -- i = -1; -- } -- break; -- default: -- i = -1; -- break; -- }; -- restore_current(); -- spin_unlock_irqrestore(&prom_lock, flags); -- return i; /* Ugh, we could spin forever on unsupported proms ;( */ --} -- - /* Non blocking put character to console device, returns -1 if - * unsuccessful. - */ --int --prom_nbputchar(char c) -+static int prom_nbputchar(const char *buf) - { -- static char outc; - unsigned long flags; - int i = -1; - - spin_lock_irqsave(&prom_lock, flags); - switch(prom_vers) { - case PROM_V0: -- i = (*(romvec->pv_nbputchar))(c); -+ i = (*(romvec->pv_nbputchar))(*buf); - break; - case PROM_V2: - case PROM_V3: -- outc = c; -- if( (*(romvec->pv_v2devops).v2_dev_write)(*romvec->pv_v2bootargs.fd_stdout, &outc, 0x1) == 1) -+ if ((*(romvec->pv_v2devops).v2_dev_write)(*romvec->pv_v2bootargs.fd_stdout, -+ buf, 0x1) == 1) - i = 0; -- else -- i = -1; - break; - default: -- i = -1; - break; - }; - restore_current(); -@@ -80,18 +43,14 @@ prom_nbputchar(char c) - return i; /* Ugh, we could spin forever on unsupported proms ;( */ - } - --/* Blocking version of get character routine above. */ --char --prom_getchar(void) -+void prom_console_write_buf(const char *buf, int len) - { -- int character; -- while((character = prom_nbgetchar()) == -1) ; -- return (char) character; -+ while (len) { -+ int n = prom_nbputchar(buf); -+ if (n) -+ continue; -+ len--; -+ buf++; -+ } - } - --/* Blocking version of put character routine above. */ --void --prom_putchar(char c) --{ -- while(prom_nbputchar(c) == -1) ; --} -diff --git a/arch/sparc/prom/console_64.c b/arch/sparc/prom/console_64.c -index 10322dc..ed39e75 100644 ---- a/arch/sparc/prom/console_64.c -+++ b/arch/sparc/prom/console_64.c -@@ -15,85 +15,34 @@ - - extern int prom_stdin, prom_stdout; - --/* Non blocking get character from console input device, returns -1 -- * if no input was taken. This can be used for polling. -- */ --inline int --prom_nbgetchar(void) --{ -- unsigned long args[7]; -- char inc; -- -- args[0] = (unsigned long) "read"; -- args[1] = 3; -- args[2] = 1; -- args[3] = (unsigned int) prom_stdin; -- args[4] = (unsigned long) &inc; -- args[5] = 1; -- args[6] = (unsigned long) -1; -- -- p1275_cmd_direct(args); -- -- if (args[6] == 1) -- return inc; -- return -1; --} -- --/* Non blocking put character to console device, returns -1 if -- * unsuccessful. -- */ --inline int --prom_nbputchar(char c) -+static int __prom_console_write_buf(const char *buf, int len) - { - unsigned long args[7]; -- char outc; -- -- outc = c; -+ int ret; - - args[0] = (unsigned long) "write"; - args[1] = 3; - args[2] = 1; - args[3] = (unsigned int) prom_stdout; -- args[4] = (unsigned long) &outc; -- args[5] = 1; -+ args[4] = (unsigned long) buf; -+ args[5] = (unsigned int) len; - args[6] = (unsigned long) -1; - - p1275_cmd_direct(args); - -- if (args[6] == 1) -- return 0; -- else -+ ret = (int) args[6]; -+ if (ret < 0) - return -1; -+ return ret; - } - --/* Blocking version of get character routine above. */ --char --prom_getchar(void) --{ -- int character; -- while((character = prom_nbgetchar()) == -1) ; -- return (char) character; --} -- --/* Blocking version of put character routine above. */ --void --prom_putchar(char c) -+void prom_console_write_buf(const char *buf, int len) - { -- prom_nbputchar(c); --} -- --void --prom_puts(const char *s, int len) --{ -- unsigned long args[7]; -- -- args[0] = (unsigned long) "write"; -- args[1] = 3; -- args[2] = 1; -- args[3] = (unsigned int) prom_stdout; -- args[4] = (unsigned long) s; -- args[5] = len; -- args[6] = (unsigned long) -1; -- -- p1275_cmd_direct(args); -+ while (len) { -+ int n = __prom_console_write_buf(buf, len); -+ if (n < 0) -+ continue; -+ len -= n; -+ buf += len; -+ } - } -diff --git a/arch/sparc/prom/devops_32.c b/arch/sparc/prom/devops_32.c -deleted file mode 100644 -index 9c5d468..0000000 ---- a/arch/sparc/prom/devops_32.c -+++ /dev/null -@@ -1,87 +0,0 @@ --/* -- * devops.c: Device operations using the PROM. -- * -- * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) -- */ --#include --#include --#include -- --#include --#include -- --extern void restore_current(void); -- --/* Open the device described by the string 'dstr'. Returns the handle -- * to that device used for subsequent operations on that device. -- * Returns -1 on failure. -- */ --int --prom_devopen(char *dstr) --{ -- int handle; -- unsigned long flags; -- spin_lock_irqsave(&prom_lock, flags); -- switch(prom_vers) { -- case PROM_V0: -- handle = (*(romvec->pv_v0devops.v0_devopen))(dstr); -- if(handle == 0) handle = -1; -- break; -- case PROM_V2: -- case PROM_V3: -- handle = (*(romvec->pv_v2devops.v2_dev_open))(dstr); -- break; -- default: -- handle = -1; -- break; -- }; -- restore_current(); -- spin_unlock_irqrestore(&prom_lock, flags); -- -- return handle; --} -- --/* Close the device described by device handle 'dhandle'. */ --int --prom_devclose(int dhandle) --{ -- unsigned long flags; -- spin_lock_irqsave(&prom_lock, flags); -- switch(prom_vers) { -- case PROM_V0: -- (*(romvec->pv_v0devops.v0_devclose))(dhandle); -- break; -- case PROM_V2: -- case PROM_V3: -- (*(romvec->pv_v2devops.v2_dev_close))(dhandle); -- break; -- default: -- break; -- }; -- restore_current(); -- spin_unlock_irqrestore(&prom_lock, flags); -- return 0; --} -- --/* Seek to specified location described by 'seekhi' and 'seeklo' -- * for device 'dhandle'. -- */ --void --prom_seek(int dhandle, unsigned int seekhi, unsigned int seeklo) --{ -- unsigned long flags; -- spin_lock_irqsave(&prom_lock, flags); -- switch(prom_vers) { -- case PROM_V0: -- (*(romvec->pv_v0devops.v0_seekdev))(dhandle, seekhi, seeklo); -- break; -- case PROM_V2: -- case PROM_V3: -- (*(romvec->pv_v2devops.v2_dev_seek))(dhandle, seekhi, seeklo); -- break; -- default: -- break; -- }; -- restore_current(); -- spin_unlock_irqrestore(&prom_lock, flags); --} -diff --git a/arch/sparc/prom/devops_64.c b/arch/sparc/prom/devops_64.c -deleted file mode 100644 -index a017119..0000000 ---- a/arch/sparc/prom/devops_64.c -+++ /dev/null -@@ -1,67 +0,0 @@ --/* -- * devops.c: Device operations using the PROM. -- * -- * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) -- * Copyright (C) 1996,1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz) -- */ --#include --#include --#include -- --#include --#include -- --/* Open the device described by the string 'dstr'. Returns the handle -- * to that device used for subsequent operations on that device. -- * Returns 0 on failure. -- */ --int --prom_devopen(const char *dstr) --{ -- unsigned long args[5]; -- -- args[0] = (unsigned long) "open"; -- args[1] = 1; -- args[2] = 1; -- args[3] = (unsigned long) dstr; -- args[4] = (unsigned long) -1; -- -- p1275_cmd_direct(args); -- -- return (int) args[4]; --} -- --/* Close the device described by device handle 'dhandle'. */ --int --prom_devclose(int dhandle) --{ -- unsigned long args[4]; -- -- args[0] = (unsigned long) "close"; -- args[1] = 1; -- args[2] = 0; -- args[3] = (unsigned int) dhandle; -- -- p1275_cmd_direct(args); -- -- return 0; --} -- --/* Seek to specified location described by 'seekhi' and 'seeklo' -- * for device 'dhandle'. -- */ --void --prom_seek(int dhandle, unsigned int seekhi, unsigned int seeklo) --{ -- unsigned long args[7]; -- -- args[0] = (unsigned long) "seek"; -- args[1] = 3; -- args[2] = 1; -- args[3] = (unsigned int) dhandle; -- args[4] = seekhi; -- args[5] = seeklo; -- args[6] = (unsigned long) -1; -- -- p1275_cmd_direct(args); --} -diff --git a/arch/sparc/prom/misc_64.c b/arch/sparc/prom/misc_64.c -index d24bc44..e4f31d4 100644 ---- a/arch/sparc/prom/misc_64.c -+++ b/arch/sparc/prom/misc_64.c -@@ -18,7 +18,7 @@ - #include - #include - --int prom_service_exists(const char *service_name) -+static int prom_service_exists(const char *service_name) - { - unsigned long args[5]; - -@@ -150,20 +150,6 @@ void prom_halt_power_off(void) - prom_halt(); - } - --/* Set prom sync handler to call function 'funcp'. */ --void prom_setcallback(callback_func_t funcp) --{ -- unsigned long args[5]; -- if (!funcp) -- return; -- args[0] = (unsigned long) "set-callback"; -- args[1] = 1; -- args[2] = 1; -- args[3] = (unsigned long) funcp; -- args[4] = (unsigned long) -1; -- p1275_cmd_direct(args); --} -- - /* Get the idprom and stuff it into buffer 'idbuf'. Returns the - * format type. 'num_bytes' is the number of bytes that your idbuf - * has space for. Returns 0xff on error. -diff --git a/arch/sparc/prom/printf.c b/arch/sparc/prom/printf.c -index ca86926..d9682f0 100644 ---- a/arch/sparc/prom/printf.c -+++ b/arch/sparc/prom/printf.c -@@ -15,22 +15,45 @@ - - #include - #include -+#include - - #include - #include - -+#define CONSOLE_WRITE_BUF_SIZE 1024 -+ - static char ppbuf[1024]; -+static char console_write_buf[CONSOLE_WRITE_BUF_SIZE]; -+static DEFINE_RAW_SPINLOCK(console_write_lock); - - void notrace prom_write(const char *buf, unsigned int n) - { -- char ch; -+ unsigned int dest_len; -+ unsigned long flags; -+ char *dest; -+ -+ dest = console_write_buf; -+ raw_spin_lock_irqsave(&console_write_lock, flags); - -- while (n != 0) { -- --n; -- if ((ch = *buf++) == '\n') -- prom_putchar('\r'); -- prom_putchar(ch); -+ dest_len = 0; -+ while (n-- != 0) { -+ char ch = *buf++; -+ if (ch == '\n') { -+ *dest++ = '\r'; -+ dest_len++; -+ } -+ *dest++ = ch; -+ dest_len++; -+ if (dest_len >= CONSOLE_WRITE_BUF_SIZE - 1) { -+ prom_console_write_buf(console_write_buf, dest_len); -+ dest = console_write_buf; -+ dest_len = 0; -+ } - } -+ if (dest_len) -+ prom_console_write_buf(console_write_buf, dest_len); -+ -+ raw_spin_unlock_irqrestore(&console_write_lock, flags); - } - - void notrace prom_printf(const char *fmt, ...) -diff --git a/arch/sparc/prom/tree_32.c b/arch/sparc/prom/tree_32.c -index 63e08e1..535e2e6 100644 ---- a/arch/sparc/prom/tree_32.c -+++ b/arch/sparc/prom/tree_32.c -@@ -342,19 +342,3 @@ phandle prom_inst2pkg(int inst) - if (node == -1) return 0; - return node; - } -- --/* Return 'node' assigned to a particular prom 'path' -- * FIXME: Should work for v0 as well -- */ --phandle prom_pathtoinode(char *path) --{ -- phandle node; -- int inst; -- -- inst = prom_devopen (path); -- if (inst == -1) return 0; -- node = prom_inst2pkg (inst); -- prom_devclose (inst); -- if (node == -1) return 0; -- return node; --} -diff --git a/arch/sparc/prom/tree_64.c b/arch/sparc/prom/tree_64.c -index 691be68..d936600 100644 ---- a/arch/sparc/prom/tree_64.c -+++ b/arch/sparc/prom/tree_64.c -@@ -374,24 +374,6 @@ inline phandle prom_inst2pkg(int inst) - return node; - } - --/* Return 'node' assigned to a particular prom 'path' -- * FIXME: Should work for v0 as well -- */ --phandle prom_pathtoinode(const char *path) --{ -- phandle node; -- int inst; -- -- inst = prom_devopen (path); -- if (inst == 0) -- return 0; -- node = prom_inst2pkg(inst); -- prom_devclose(inst); -- if (node == -1) -- return 0; -- return node; --} -- - int prom_ihandle2path(int handle, char *buffer, int bufsize) - { - unsigned long args[7]; -diff --git a/arch/x86/include/asm/pvclock.h b/arch/x86/include/asm/pvclock.h -index 7f7e577..31d84ac 100644 ---- a/arch/x86/include/asm/pvclock.h -+++ b/arch/x86/include/asm/pvclock.h -@@ -11,6 +11,7 @@ unsigned long pvclock_tsc_khz(struct pvclock_vcpu_time_info *src); - void pvclock_read_wallclock(struct pvclock_wall_clock *wall, - struct pvclock_vcpu_time_info *vcpu, - struct timespec *ts); -+void pvclock_resume(void); - - /* - * Scale a 64-bit delta by scaling and multiplying by a 32-bit fraction, -diff --git a/arch/x86/kernel/pvclock.c b/arch/x86/kernel/pvclock.c -index 008b91e..42eb330 100644 ---- a/arch/x86/kernel/pvclock.c -+++ b/arch/x86/kernel/pvclock.c -@@ -83,6 +83,11 @@ unsigned long pvclock_tsc_khz(struct pvclock_vcpu_time_info *src) - - static atomic64_t last_value = ATOMIC64_INIT(0); - -+void pvclock_resume(void) -+{ -+ atomic64_set(&last_value, 0); -+} -+ - cycle_t pvclock_clocksource_read(struct pvclock_vcpu_time_info *src) - { - struct pvclock_shadow_time shadow; -diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c -index b2bb5aa..5da5e53 100644 ---- a/arch/x86/xen/time.c -+++ b/arch/x86/xen/time.c -@@ -426,6 +426,8 @@ void xen_timer_resume(void) - { - int cpu; - -+ pvclock_resume(); -+ - if (xen_clockevent != &xen_vcpuop_clockevent) - return; - -diff --git a/block/bsg.c b/block/bsg.c -index f20d6a7..0c8b64a 100644 ---- a/block/bsg.c -+++ b/block/bsg.c -@@ -250,6 +250,14 @@ bsg_map_hdr(struct bsg_device *bd, struct sg_io_v4 *hdr, fmode_t has_write_perm, - int ret, rw; - unsigned int dxfer_len; - void *dxferp = NULL; -+ struct bsg_class_device *bcd = &q->bsg_dev; -+ -+ /* if the LLD has been removed then the bsg_unregister_queue will -+ * eventually be called and the class_dev was freed, so we can no -+ * longer use this request_queue. Return no such address. -+ */ -+ if (!bcd->class_dev) -+ return ERR_PTR(-ENXIO); - - dprintk("map hdr %llx/%u %llx/%u\n", (unsigned long long) hdr->dout_xferp, - hdr->dout_xfer_len, (unsigned long long) hdr->din_xferp, -diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c -index ba9afea..25d3aae 100644 ---- a/drivers/acpi/ac.c -+++ b/drivers/acpi/ac.c -@@ -100,24 +100,7 @@ static const struct file_operations acpi_ac_fops = { - .release = single_release, - }; - #endif --static int get_ac_property(struct power_supply *psy, -- enum power_supply_property psp, -- union power_supply_propval *val) --{ -- struct acpi_ac *ac = to_acpi_ac(psy); -- switch (psp) { -- case POWER_SUPPLY_PROP_ONLINE: -- val->intval = ac->state; -- break; -- default: -- return -EINVAL; -- } -- return 0; --} - --static enum power_supply_property ac_props[] = { -- POWER_SUPPLY_PROP_ONLINE, --}; - /* -------------------------------------------------------------------------- - AC Adapter Management - -------------------------------------------------------------------------- */ -@@ -140,6 +123,35 @@ static int acpi_ac_get_state(struct acpi_ac *ac) - return 0; - } - -+/* -------------------------------------------------------------------------- -+ sysfs I/F -+ -------------------------------------------------------------------------- */ -+static int get_ac_property(struct power_supply *psy, -+ enum power_supply_property psp, -+ union power_supply_propval *val) -+{ -+ struct acpi_ac *ac = to_acpi_ac(psy); -+ -+ if (!ac) -+ return -ENODEV; -+ -+ if (acpi_ac_get_state(ac)) -+ return -ENODEV; -+ -+ switch (psp) { -+ case POWER_SUPPLY_PROP_ONLINE: -+ val->intval = ac->state; -+ break; -+ default: -+ return -EINVAL; -+ } -+ return 0; -+} -+ -+static enum power_supply_property ac_props[] = { -+ POWER_SUPPLY_PROP_ONLINE, -+}; -+ - #ifdef CONFIG_ACPI_PROCFS_POWER - /* -------------------------------------------------------------------------- - FS Interface (/proc) -diff --git a/drivers/acpi/apei/erst.c b/drivers/acpi/apei/erst.c -index 1211c03..5850d32 100644 ---- a/drivers/acpi/apei/erst.c -+++ b/drivers/acpi/apei/erst.c -@@ -86,7 +86,7 @@ static struct erst_erange { - * It is used to provide exclusive accessing for ERST Error Log - * Address Range too. - */ --static DEFINE_SPINLOCK(erst_lock); -+static DEFINE_RAW_SPINLOCK(erst_lock); - - static inline int erst_errno(int command_status) - { -@@ -421,9 +421,9 @@ ssize_t erst_get_record_count(void) - if (erst_disable) - return -ENODEV; - -- spin_lock_irqsave(&erst_lock, flags); -+ raw_spin_lock_irqsave(&erst_lock, flags); - count = __erst_get_record_count(); -- spin_unlock_irqrestore(&erst_lock, flags); -+ raw_spin_unlock_irqrestore(&erst_lock, flags); - - return count; - } -@@ -456,9 +456,9 @@ int erst_get_next_record_id(u64 *record_id) - if (erst_disable) - return -ENODEV; - -- spin_lock_irqsave(&erst_lock, flags); -+ raw_spin_lock_irqsave(&erst_lock, flags); - rc = __erst_get_next_record_id(record_id); -- spin_unlock_irqrestore(&erst_lock, flags); -+ raw_spin_unlock_irqrestore(&erst_lock, flags); - - return rc; - } -@@ -624,17 +624,17 @@ int erst_write(const struct cper_record_header *record) - return -EINVAL; - - if (erst_erange.attr & ERST_RANGE_NVRAM) { -- if (!spin_trylock_irqsave(&erst_lock, flags)) -+ if (!raw_spin_trylock_irqsave(&erst_lock, flags)) - return -EBUSY; - rc = __erst_write_to_nvram(record); -- spin_unlock_irqrestore(&erst_lock, flags); -+ raw_spin_unlock_irqrestore(&erst_lock, flags); - return rc; - } - - if (record->record_length > erst_erange.size) - return -EINVAL; - -- if (!spin_trylock_irqsave(&erst_lock, flags)) -+ if (!raw_spin_trylock_irqsave(&erst_lock, flags)) - return -EBUSY; - memcpy(erst_erange.vaddr, record, record->record_length); - rcd_erange = erst_erange.vaddr; -@@ -642,7 +642,7 @@ int erst_write(const struct cper_record_header *record) - memcpy(&rcd_erange->persistence_information, "ER", 2); - - rc = __erst_write_to_storage(0); -- spin_unlock_irqrestore(&erst_lock, flags); -+ raw_spin_unlock_irqrestore(&erst_lock, flags); - - return rc; - } -@@ -696,9 +696,9 @@ ssize_t erst_read(u64 record_id, struct cper_record_header *record, - if (erst_disable) - return -ENODEV; - -- spin_lock_irqsave(&erst_lock, flags); -+ raw_spin_lock_irqsave(&erst_lock, flags); - len = __erst_read(record_id, record, buflen); -- spin_unlock_irqrestore(&erst_lock, flags); -+ raw_spin_unlock_irqrestore(&erst_lock, flags); - return len; - } - EXPORT_SYMBOL_GPL(erst_read); -@@ -719,20 +719,20 @@ ssize_t erst_read_next(struct cper_record_header *record, size_t buflen) - if (erst_disable) - return -ENODEV; - -- spin_lock_irqsave(&erst_lock, flags); -+ raw_spin_lock_irqsave(&erst_lock, flags); - rc = __erst_get_next_record_id(&record_id); - if (rc) { -- spin_unlock_irqrestore(&erst_lock, flags); -+ raw_spin_unlock_irqrestore(&erst_lock, flags); - return rc; - } - /* no more record */ - if (record_id == APEI_ERST_INVALID_RECORD_ID) { -- spin_unlock_irqrestore(&erst_lock, flags); -+ raw_spin_unlock_irqrestore(&erst_lock, flags); - return 0; - } - - len = __erst_read(record_id, record, buflen); -- spin_unlock_irqrestore(&erst_lock, flags); -+ raw_spin_unlock_irqrestore(&erst_lock, flags); - - return len; - } -@@ -746,12 +746,12 @@ int erst_clear(u64 record_id) - if (erst_disable) - return -ENODEV; - -- spin_lock_irqsave(&erst_lock, flags); -+ raw_spin_lock_irqsave(&erst_lock, flags); - if (erst_erange.attr & ERST_RANGE_NVRAM) - rc = __erst_clear_from_nvram(record_id); - else - rc = __erst_clear_from_storage(record_id); -- spin_unlock_irqrestore(&erst_lock, flags); -+ raw_spin_unlock_irqrestore(&erst_lock, flags); - - return rc; - } -diff --git a/drivers/acpi/apei/hest.c b/drivers/acpi/apei/hest.c -index 1a3508a..daa7bc6 100644 ---- a/drivers/acpi/apei/hest.c -+++ b/drivers/acpi/apei/hest.c -@@ -46,9 +46,9 @@ EXPORT_SYMBOL_GPL(hest_disable); - - /* HEST table parsing */ - --static struct acpi_table_hest *hest_tab; -+static struct acpi_table_hest *__read_mostly hest_tab; - --static int hest_esrc_len_tab[ACPI_HEST_TYPE_RESERVED] = { -+static const int hest_esrc_len_tab[ACPI_HEST_TYPE_RESERVED] = { - [ACPI_HEST_TYPE_IA32_CHECK] = -1, /* need further calculation */ - [ACPI_HEST_TYPE_IA32_CORRECTED_CHECK] = -1, - [ACPI_HEST_TYPE_IA32_NMI] = sizeof(struct acpi_hest_ia_nmi), -@@ -126,7 +126,7 @@ struct ghes_arr { - unsigned int count; - }; - --static int hest_parse_ghes_count(struct acpi_hest_header *hest_hdr, void *data) -+static int __init hest_parse_ghes_count(struct acpi_hest_header *hest_hdr, void *data) - { - int *count = data; - -@@ -135,7 +135,7 @@ static int hest_parse_ghes_count(struct acpi_hest_header *hest_hdr, void *data) - return 0; - } - --static int hest_parse_ghes(struct acpi_hest_header *hest_hdr, void *data) -+static int __init hest_parse_ghes(struct acpi_hest_header *hest_hdr, void *data) - { - struct platform_device *ghes_dev; - struct ghes_arr *ghes_arr = data; -@@ -165,7 +165,7 @@ err: - return rc; - } - --static int hest_ghes_dev_register(unsigned int ghes_count) -+static int __init hest_ghes_dev_register(unsigned int ghes_count) - { - int rc, i; - struct ghes_arr ghes_arr; -diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c -index 95649d3..9fb9d5a 100644 ---- a/drivers/acpi/battery.c -+++ b/drivers/acpi/battery.c -@@ -130,6 +130,8 @@ struct acpi_battery { - unsigned long flags; - }; - -+static int acpi_battery_update(struct acpi_battery *battery); -+ - #define to_acpi_battery(x) container_of(x, struct acpi_battery, bat); - - inline int acpi_battery_present(struct acpi_battery *battery) -@@ -184,6 +186,9 @@ static int acpi_battery_get_property(struct power_supply *psy, - int ret = 0; - struct acpi_battery *battery = to_acpi_battery(psy); - -+ if (acpi_battery_update(battery)) -+ return -ENODEV; -+ - if (acpi_battery_present(battery)) { - /* run battery update only if it is present */ - acpi_battery_get_state(battery); -diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c -index 372ff80..302b31e 100644 ---- a/drivers/acpi/ec.c -+++ b/drivers/acpi/ec.c -@@ -934,6 +934,9 @@ static struct dmi_system_id __initdata ec_dmi_table[] = { - ec_flag_msi, "MSI hardware", { - DMI_MATCH(DMI_CHASSIS_VENDOR, "MICRO-Star")}, NULL}, - { -+ ec_flag_msi, "MSI hardware", { -+ DMI_MATCH(DMI_CHASSIS_VENDOR, "MICRO-STAR")}, NULL}, -+ { - ec_validate_ecdt, "ASUS hardware", { - DMI_MATCH(DMI_BIOS_VENDOR, "ASUS") }, NULL}, - {}, -diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c -index 966fedd..055d7b7 100644 ---- a/drivers/acpi/osl.c -+++ b/drivers/acpi/osl.c -@@ -110,9 +110,6 @@ struct acpi_ioremap { - static LIST_HEAD(acpi_ioremaps); - static DEFINE_SPINLOCK(acpi_ioremap_lock); - --#define OSI_STRING_LENGTH_MAX 64 /* arbitrary */ --static char osi_setup_string[OSI_STRING_LENGTH_MAX]; -- - static void __init acpi_osi_setup_late(void); - - /* -@@ -152,8 +149,7 @@ static struct osi_linux { - unsigned int enable:1; - unsigned int dmi:1; - unsigned int cmdline:1; -- unsigned int known:1; --} osi_linux = { 0, 0, 0, 0}; -+} osi_linux = {0, 0, 0}; - - static u32 acpi_osi_handler(acpi_string interface, u32 supported) - { -@@ -1055,13 +1051,53 @@ static int __init acpi_os_name_setup(char *str) - - __setup("acpi_os_name=", acpi_os_name_setup); - -+#define OSI_STRING_LENGTH_MAX 64 /* arbitrary */ -+#define OSI_STRING_ENTRIES_MAX 16 /* arbitrary */ -+ -+struct osi_setup_entry { -+ char string[OSI_STRING_LENGTH_MAX]; -+ bool enable; -+}; -+ -+static struct osi_setup_entry __initdata osi_setup_entries[OSI_STRING_ENTRIES_MAX]; -+ -+void __init acpi_osi_setup(char *str) -+{ -+ struct osi_setup_entry *osi; -+ bool enable = true; -+ int i; -+ -+ if (!acpi_gbl_create_osi_method) -+ return; -+ -+ if (str == NULL || *str == '\0') { -+ printk(KERN_INFO PREFIX "_OSI method disabled\n"); -+ acpi_gbl_create_osi_method = FALSE; -+ return; -+ } -+ -+ if (*str == '!') { -+ str++; -+ enable = false; -+ } -+ -+ for (i = 0; i < OSI_STRING_ENTRIES_MAX; i++) { -+ osi = &osi_setup_entries[i]; -+ if (!strcmp(osi->string, str)) { -+ osi->enable = enable; -+ break; -+ } else if (osi->string[0] == '\0') { -+ osi->enable = enable; -+ strncpy(osi->string, str, OSI_STRING_LENGTH_MAX); -+ break; -+ } -+ } -+} -+ - static void __init set_osi_linux(unsigned int enable) - { -- if (osi_linux.enable != enable) { -+ if (osi_linux.enable != enable) - osi_linux.enable = enable; -- printk(KERN_NOTICE PREFIX "%sed _OSI(Linux)\n", -- enable ? "Add": "Delet"); -- } - - if (osi_linux.enable) - acpi_osi_setup("Linux"); -@@ -1073,7 +1109,8 @@ static void __init set_osi_linux(unsigned int enable) - - static void __init acpi_cmdline_osi_linux(unsigned int enable) - { -- osi_linux.cmdline = 1; /* cmdline set the default */ -+ osi_linux.cmdline = 1; /* cmdline set the default and override DMI */ -+ osi_linux.dmi = 0; - set_osi_linux(enable); - - return; -@@ -1081,15 +1118,12 @@ static void __init acpi_cmdline_osi_linux(unsigned int enable) - - void __init acpi_dmi_osi_linux(int enable, const struct dmi_system_id *d) - { -- osi_linux.dmi = 1; /* DMI knows that this box asks OSI(Linux) */ -- - printk(KERN_NOTICE PREFIX "DMI detected: %s\n", d->ident); - - if (enable == -1) - return; - -- osi_linux.known = 1; /* DMI knows which OSI(Linux) default needed */ -- -+ osi_linux.dmi = 1; /* DMI knows that this box asks OSI(Linux) */ - set_osi_linux(enable); - - return; -@@ -1104,37 +1138,44 @@ void __init acpi_dmi_osi_linux(int enable, const struct dmi_system_id *d) - */ - static void __init acpi_osi_setup_late(void) - { -- char *str = osi_setup_string; -+ struct osi_setup_entry *osi; -+ char *str; -+ int i; -+ acpi_status status; - -- if (*str == '\0') -- return; -+ for (i = 0; i < OSI_STRING_ENTRIES_MAX; i++) { -+ osi = &osi_setup_entries[i]; -+ str = osi->string; - -- if (!strcmp("!Linux", str)) { -- acpi_cmdline_osi_linux(0); /* !enable */ -- } else if (*str == '!') { -- if (acpi_remove_interface(++str) == AE_OK) -- printk(KERN_INFO PREFIX "Deleted _OSI(%s)\n", str); -- } else if (!strcmp("Linux", str)) { -- acpi_cmdline_osi_linux(1); /* enable */ -- } else { -- if (acpi_install_interface(str) == AE_OK) -- printk(KERN_INFO PREFIX "Added _OSI(%s)\n", str); -+ if (*str == '\0') -+ break; -+ if (osi->enable) { -+ status = acpi_install_interface(str); -+ -+ if (ACPI_SUCCESS(status)) -+ printk(KERN_INFO PREFIX "Added _OSI(%s)\n", str); -+ } else { -+ status = acpi_remove_interface(str); -+ -+ if (ACPI_SUCCESS(status)) -+ printk(KERN_INFO PREFIX "Deleted _OSI(%s)\n", str); -+ } - } - } - --int __init acpi_osi_setup(char *str) -+static int __init osi_setup(char *str) - { -- if (str == NULL || *str == '\0') { -- printk(KERN_INFO PREFIX "_OSI method disabled\n"); -- acpi_gbl_create_osi_method = FALSE; -- } else { -- strncpy(osi_setup_string, str, OSI_STRING_LENGTH_MAX); -- } -+ if (str && !strcmp("Linux", str)) -+ acpi_cmdline_osi_linux(1); -+ else if (str && !strcmp("!Linux", str)) -+ acpi_cmdline_osi_linux(0); -+ else -+ acpi_osi_setup(str); - - return 1; - } - --__setup("acpi_osi=", acpi_osi_setup); -+__setup("acpi_osi=", osi_setup); - - /* enable serialization to combat AE_ALREADY_EXISTS errors */ - static int __init acpi_serialize_setup(char *str) -@@ -1530,7 +1571,7 @@ acpi_status __init acpi_os_initialize(void) - return AE_OK; - } - --acpi_status acpi_os_initialize1(void) -+acpi_status __init acpi_os_initialize1(void) - { - kacpid_wq = create_workqueue("kacpid"); - kacpi_notify_wq = create_workqueue("kacpi_notify"); -diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c -index 67dedee..4c9c2fb 100644 ---- a/drivers/acpi/power.c -+++ b/drivers/acpi/power.c -@@ -213,11 +213,13 @@ static int acpi_power_on(acpi_handle handle) - resource->name)); - } else { - result = __acpi_power_on(resource); -+ if (result) -+ resource->ref_count--; - } - - mutex_unlock(&resource->resource_lock); - -- return 0; -+ return result; - } - - static int acpi_power_off_device(acpi_handle handle) -@@ -465,10 +467,12 @@ int acpi_power_transition(struct acpi_device *device, int state) - struct acpi_handle_list *tl = NULL; /* Target Resources */ - int i = 0; - -- - if (!device || (state < ACPI_STATE_D0) || (state > ACPI_STATE_D3)) - return -EINVAL; - -+ if (device->power.state == state) -+ return 0; -+ - if ((device->power.state < ACPI_STATE_D0) - || (device->power.state > ACPI_STATE_D3)) - return -ENODEV; -@@ -488,10 +492,6 @@ int acpi_power_transition(struct acpi_device *device, int state) - goto end; - } - -- if (device->power.state == state) { -- goto end; -- } -- - /* - * Then we dereference all power resources used in the current list. - */ -diff --git a/drivers/acpi/processor_thermal.c b/drivers/acpi/processor_thermal.c -index fde49b9..79cb653 100644 ---- a/drivers/acpi/processor_thermal.c -+++ b/drivers/acpi/processor_thermal.c -@@ -156,15 +156,6 @@ static int cpufreq_set_cur_state(unsigned int cpu, int state) - return 0; - } - --static int acpi_thermal_cpufreq_increase(unsigned int cpu) --{ -- return -ENODEV; --} --static int acpi_thermal_cpufreq_decrease(unsigned int cpu) --{ -- return -ENODEV; --} -- - #endif - - int acpi_processor_get_limit_info(struct acpi_processor *pr) -diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c -index 721d93b..febb153 100644 ---- a/drivers/acpi/sleep.c -+++ b/drivers/acpi/sleep.c -@@ -27,8 +27,6 @@ - - static u8 sleep_states[ACPI_S_STATE_COUNT]; - --static u32 acpi_target_sleep_state = ACPI_STATE_S0; -- - static void acpi_sleep_tts_switch(u32 acpi_state) - { - union acpi_object in_arg = { ACPI_TYPE_INTEGER }; -@@ -81,6 +79,8 @@ static int acpi_sleep_prepare(u32 acpi_state) - } - - #ifdef CONFIG_ACPI_SLEEP -+static u32 acpi_target_sleep_state = ACPI_STATE_S0; -+ - /* - * The ACPI specification wants us to save NVS memory regions during hibernation - * and to restore them during the subsequent resume. Windows does that also for -@@ -427,6 +427,14 @@ static struct dmi_system_id __initdata acpisleep_dmi_table[] = { - DMI_MATCH(DMI_PRODUCT_NAME, "VPCEB1Z1E"), - }, - }, -+ { -+ .callback = init_nvs_nosave, -+ .ident = "Sony Vaio VGN-NW130D", -+ .matches = { -+ DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), -+ DMI_MATCH(DMI_PRODUCT_NAME, "VGN-NW130D"), -+ }, -+ }, - {}, - }; - #endif /* CONFIG_SUSPEND */ -diff --git a/drivers/atm/adummy.c b/drivers/atm/adummy.c -index 46b9476..f9b983a 100644 ---- a/drivers/atm/adummy.c -+++ b/drivers/atm/adummy.c -@@ -154,7 +154,7 @@ static int __init adummy_init(void) - err = -ENOMEM; - goto out; - } -- atm_dev = atm_dev_register(DEV_LABEL, &adummy_ops, -1, NULL); -+ atm_dev = atm_dev_register(DEV_LABEL, NULL, &adummy_ops, -1, NULL); - if (!atm_dev) { - printk(KERN_ERR DEV_LABEL ": atm_dev_register() failed\n"); - err = -ENODEV; -diff --git a/drivers/atm/ambassador.c b/drivers/atm/ambassador.c -index a33896a..ffe9b65 100644 ---- a/drivers/atm/ambassador.c -+++ b/drivers/atm/ambassador.c -@@ -2244,7 +2244,8 @@ static int __devinit amb_probe(struct pci_dev *pci_dev, const struct pci_device_ - goto out_reset; - } - -- dev->atm_dev = atm_dev_register (DEV_LABEL, &amb_ops, -1, NULL); -+ dev->atm_dev = atm_dev_register (DEV_LABEL, &pci_dev->dev, &amb_ops, -1, -+ NULL); - if (!dev->atm_dev) { - PRINTD (DBG_ERR, "failed to register Madge ATM adapter"); - err = -EINVAL; -diff --git a/drivers/atm/atmtcp.c b/drivers/atm/atmtcp.c -index b910181..2b464b6 100644 ---- a/drivers/atm/atmtcp.c -+++ b/drivers/atm/atmtcp.c -@@ -366,7 +366,7 @@ static int atmtcp_create(int itf,int persist,struct atm_dev **result) - if (!dev_data) - return -ENOMEM; - -- dev = atm_dev_register(DEV_LABEL,&atmtcp_v_dev_ops,itf,NULL); -+ dev = atm_dev_register(DEV_LABEL,NULL,&atmtcp_v_dev_ops,itf,NULL); - if (!dev) { - kfree(dev_data); - return itf == -1 ? -ENOMEM : -EBUSY; -diff --git a/drivers/atm/eni.c b/drivers/atm/eni.c -index 97c5898..c495fae 100644 ---- a/drivers/atm/eni.c -+++ b/drivers/atm/eni.c -@@ -2244,7 +2244,7 @@ static int __devinit eni_init_one(struct pci_dev *pci_dev, - &zeroes); - if (!cpu_zeroes) goto out1; - } -- dev = atm_dev_register(DEV_LABEL,&ops,-1,NULL); -+ dev = atm_dev_register(DEV_LABEL, &pci_dev->dev, &ops, -1, NULL); - if (!dev) goto out2; - pci_set_drvdata(pci_dev, dev); - eni_dev->pci_dev = pci_dev; -diff --git a/drivers/atm/firestream.c b/drivers/atm/firestream.c -index 5d86bb8..7d912ba 100644 ---- a/drivers/atm/firestream.c -+++ b/drivers/atm/firestream.c -@@ -1911,7 +1911,7 @@ static int __devinit firestream_init_one (struct pci_dev *pci_dev, - fs_dev, sizeof (struct fs_dev)); - if (!fs_dev) - goto err_out; -- atm_dev = atm_dev_register("fs", &ops, -1, NULL); -+ atm_dev = atm_dev_register("fs", &pci_dev->dev, &ops, -1, NULL); - if (!atm_dev) - goto err_out_free_fs_dev; - -diff --git a/drivers/atm/fore200e.c b/drivers/atm/fore200e.c -index c8fc69c..962c309 100644 ---- a/drivers/atm/fore200e.c -+++ b/drivers/atm/fore200e.c -@@ -2567,14 +2567,14 @@ release: - - - static int __devinit --fore200e_register(struct fore200e* fore200e) -+fore200e_register(struct fore200e* fore200e, struct device *parent) - { - struct atm_dev* atm_dev; - - DPRINTK(2, "device %s being registered\n", fore200e->name); - -- atm_dev = atm_dev_register(fore200e->bus->proc_name, &fore200e_ops, -1, -- NULL); -+ atm_dev = atm_dev_register(fore200e->bus->proc_name, parent, &fore200e_ops, -+ -1, NULL); - if (atm_dev == NULL) { - printk(FORE200E "unable to register device %s\n", fore200e->name); - return -ENODEV; -@@ -2594,9 +2594,9 @@ fore200e_register(struct fore200e* fore200e) - - - static int __devinit --fore200e_init(struct fore200e* fore200e) -+fore200e_init(struct fore200e* fore200e, struct device *parent) - { -- if (fore200e_register(fore200e) < 0) -+ if (fore200e_register(fore200e, parent) < 0) - return -ENODEV; - - if (fore200e->bus->configure(fore200e) < 0) -@@ -2662,7 +2662,7 @@ static int __devinit fore200e_sba_probe(struct platform_device *op, - - sprintf(fore200e->name, "%s-%d", bus->model_name, index); - -- err = fore200e_init(fore200e); -+ err = fore200e_init(fore200e, &op->dev); - if (err < 0) { - fore200e_shutdown(fore200e); - kfree(fore200e); -@@ -2740,7 +2740,7 @@ fore200e_pca_detect(struct pci_dev *pci_dev, const struct pci_device_id *pci_ent - - sprintf(fore200e->name, "%s-%d", bus->model_name, index); - -- err = fore200e_init(fore200e); -+ err = fore200e_init(fore200e, &pci_dev->dev); - if (err < 0) { - fore200e_shutdown(fore200e); - goto out_free; -diff --git a/drivers/atm/he.c b/drivers/atm/he.c -index 801e8b6..6cf59bf 100644 ---- a/drivers/atm/he.c -+++ b/drivers/atm/he.c -@@ -366,7 +366,7 @@ he_init_one(struct pci_dev *pci_dev, const struct pci_device_id *pci_ent) - goto init_one_failure; - } - -- atm_dev = atm_dev_register(DEV_LABEL, &he_ops, -1, NULL); -+ atm_dev = atm_dev_register(DEV_LABEL, &pci_dev->dev, &he_ops, -1, NULL); - if (!atm_dev) { - err = -ENODEV; - goto init_one_failure; -diff --git a/drivers/atm/horizon.c b/drivers/atm/horizon.c -index a957904..24761e1 100644 ---- a/drivers/atm/horizon.c -+++ b/drivers/atm/horizon.c -@@ -2733,7 +2733,8 @@ static int __devinit hrz_probe(struct pci_dev *pci_dev, const struct pci_device_ - PRINTD(DBG_INFO, "found Madge ATM adapter (hrz) at: IO %x, IRQ %u, MEM %p", - iobase, irq, membase); - -- dev->atm_dev = atm_dev_register(DEV_LABEL, &hrz_ops, -1, NULL); -+ dev->atm_dev = atm_dev_register(DEV_LABEL, &pci_dev->dev, &hrz_ops, -1, -+ NULL); - if (!(dev->atm_dev)) { - PRINTD(DBG_ERR, "failed to register Madge ATM adapter"); - err = -EINVAL; -diff --git a/drivers/atm/idt77252.c b/drivers/atm/idt77252.c -index bce5732..bfb7fee 100644 ---- a/drivers/atm/idt77252.c -+++ b/drivers/atm/idt77252.c -@@ -3698,7 +3698,8 @@ idt77252_init_one(struct pci_dev *pcidev, const struct pci_device_id *id) - goto err_out_iounmap; - } - -- dev = atm_dev_register("idt77252", &idt77252_ops, -1, NULL); -+ dev = atm_dev_register("idt77252", &pcidev->dev, &idt77252_ops, -1, -+ NULL); - if (!dev) { - printk("%s: can't register atm device\n", card->name); - err = -EIO; -diff --git a/drivers/atm/iphase.c b/drivers/atm/iphase.c -index 9309d47..7292540 100644 ---- a/drivers/atm/iphase.c -+++ b/drivers/atm/iphase.c -@@ -3172,7 +3172,7 @@ static int __devinit ia_init_one(struct pci_dev *pdev, - ret = -ENODEV; - goto err_out_free_iadev; - } -- dev = atm_dev_register(DEV_LABEL, &ops, -1, NULL); -+ dev = atm_dev_register(DEV_LABEL, &pdev->dev, &ops, -1, NULL); - if (!dev) { - ret = -ENOMEM; - goto err_out_disable_dev; -diff --git a/drivers/atm/lanai.c b/drivers/atm/lanai.c -index cbe15a8..a395c9a 100644 ---- a/drivers/atm/lanai.c -+++ b/drivers/atm/lanai.c -@@ -2591,7 +2591,7 @@ static int __devinit lanai_init_one(struct pci_dev *pci, - return -ENOMEM; - } - -- atmdev = atm_dev_register(DEV_LABEL, &ops, -1, NULL); -+ atmdev = atm_dev_register(DEV_LABEL, &pci->dev, &ops, -1, NULL); - if (atmdev == NULL) { - printk(KERN_ERR DEV_LABEL - ": couldn't register atm device!\n"); -diff --git a/drivers/atm/nicstar.c b/drivers/atm/nicstar.c -index 2f3516b..6b313ee 100644 ---- a/drivers/atm/nicstar.c -+++ b/drivers/atm/nicstar.c -@@ -771,7 +771,8 @@ static int __devinit ns_init_card(int i, struct pci_dev *pcidev) - } - - /* Register device */ -- card->atmdev = atm_dev_register("nicstar", &atm_ops, -1, NULL); -+ card->atmdev = atm_dev_register("nicstar", &card->pcidev->dev, &atm_ops, -+ -1, NULL); - if (card->atmdev == NULL) { - printk("nicstar%d: can't register device.\n", i); - error = 17; -diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c -index 2e08c99..73fb1c4 100644 ---- a/drivers/atm/solos-pci.c -+++ b/drivers/atm/solos-pci.c -@@ -166,7 +166,7 @@ static irqreturn_t solos_irq(int irq, void *dev_id); - static struct atm_vcc* find_vcc(struct atm_dev *dev, short vpi, int vci); - static int list_vccs(int vci); - static void release_vccs(struct atm_dev *dev); --static int atm_init(struct solos_card *); -+static int atm_init(struct solos_card *, struct device *); - static void atm_remove(struct solos_card *); - static int send_command(struct solos_card *card, int dev, const char *buf, size_t size); - static void solos_bh(unsigned long); -@@ -1210,7 +1210,7 @@ static int fpga_probe(struct pci_dev *dev, const struct pci_device_id *id) - if (db_firmware_upgrade) - flash_upgrade(card, 3); - -- err = atm_init(card); -+ err = atm_init(card, &dev->dev); - if (err) - goto out_free_irq; - -@@ -1233,7 +1233,7 @@ static int fpga_probe(struct pci_dev *dev, const struct pci_device_id *id) - return err; - } - --static int atm_init(struct solos_card *card) -+static int atm_init(struct solos_card *card, struct device *parent) - { - int i; - -@@ -1244,7 +1244,7 @@ static int atm_init(struct solos_card *card) - skb_queue_head_init(&card->tx_queue[i]); - skb_queue_head_init(&card->cli_queue[i]); - -- card->atmdev[i] = atm_dev_register("solos-pci", &fpga_ops, -1, NULL); -+ card->atmdev[i] = atm_dev_register("solos-pci", parent, &fpga_ops, -1, NULL); - if (!card->atmdev[i]) { - dev_err(&card->dev->dev, "Could not register ATM device %d\n", i); - atm_remove(card); -diff --git a/drivers/atm/zatm.c b/drivers/atm/zatm.c -index 4e885d2..6249179 100644 ---- a/drivers/atm/zatm.c -+++ b/drivers/atm/zatm.c -@@ -1597,7 +1597,7 @@ static int __devinit zatm_init_one(struct pci_dev *pci_dev, - goto out; - } - -- dev = atm_dev_register(DEV_LABEL, &ops, -1, NULL); -+ dev = atm_dev_register(DEV_LABEL, &pci_dev->dev, &ops, -1, NULL); - if (!dev) - goto out_free; - -diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c -index 128cae4..949ed09 100644 ---- a/drivers/bluetooth/ath3k.c -+++ b/drivers/bluetooth/ath3k.c -@@ -35,6 +35,10 @@ - static struct usb_device_id ath3k_table[] = { - /* Atheros AR3011 */ - { USB_DEVICE(0x0CF3, 0x3000) }, -+ -+ /* Atheros AR3011 with sflash firmware*/ -+ { USB_DEVICE(0x0CF3, 0x3002) }, -+ - { } /* Terminating entry */ - }; - -diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c -index ab3894f..1da773f 100644 ---- a/drivers/bluetooth/btusb.c -+++ b/drivers/bluetooth/btusb.c -@@ -99,6 +99,9 @@ static struct usb_device_id blacklist_table[] = { - /* Broadcom BCM2033 without firmware */ - { USB_DEVICE(0x0a5c, 0x2033), .driver_info = BTUSB_IGNORE }, - -+ /* Atheros 3011 with sflash firmware */ -+ { USB_DEVICE(0x0cf3, 0x3002), .driver_info = BTUSB_IGNORE }, -+ - /* Broadcom BCM2035 */ - { USB_DEVICE(0x0a5c, 0x2035), .driver_info = BTUSB_WRONG_SCO_MTU }, - { USB_DEVICE(0x0a5c, 0x200a), .driver_info = BTUSB_WRONG_SCO_MTU }, -@@ -239,7 +242,8 @@ static void btusb_intr_complete(struct urb *urb) - - err = usb_submit_urb(urb, GFP_ATOMIC); - if (err < 0) { -- BT_ERR("%s urb %p failed to resubmit (%d)", -+ if (err != -EPERM) -+ BT_ERR("%s urb %p failed to resubmit (%d)", - hdev->name, urb, -err); - usb_unanchor_urb(urb); - } -@@ -323,7 +327,8 @@ static void btusb_bulk_complete(struct urb *urb) - - err = usb_submit_urb(urb, GFP_ATOMIC); - if (err < 0) { -- BT_ERR("%s urb %p failed to resubmit (%d)", -+ if (err != -EPERM) -+ BT_ERR("%s urb %p failed to resubmit (%d)", - hdev->name, urb, -err); - usb_unanchor_urb(urb); - } -@@ -412,7 +417,8 @@ static void btusb_isoc_complete(struct urb *urb) - - err = usb_submit_urb(urb, GFP_ATOMIC); - if (err < 0) { -- BT_ERR("%s urb %p failed to resubmit (%d)", -+ if (err != -EPERM) -+ BT_ERR("%s urb %p failed to resubmit (%d)", - hdev->name, urb, -err); - usb_unanchor_urb(urb); - } -diff --git a/drivers/char/agp/intel-gtt.c b/drivers/char/agp/intel-gtt.c -index 9272c38..16a2847 100644 ---- a/drivers/char/agp/intel-gtt.c -+++ b/drivers/char/agp/intel-gtt.c -@@ -812,8 +812,10 @@ static int intel_fake_agp_fetch_size(void) - - static void i830_cleanup(void) - { -- kunmap(intel_private.i8xx_page); -- intel_private.i8xx_flush_page = NULL; -+ if (intel_private.i8xx_flush_page) { -+ kunmap(intel_private.i8xx_flush_page); -+ intel_private.i8xx_flush_page = NULL; -+ } - - __free_page(intel_private.i8xx_page); - intel_private.i8xx_page = NULL; -diff --git a/drivers/connector/connector.c b/drivers/connector/connector.c -index e16c3fa..05117f1 100644 ---- a/drivers/connector/connector.c -+++ b/drivers/connector/connector.c -@@ -36,6 +36,7 @@ - MODULE_LICENSE("GPL"); - MODULE_AUTHOR("Evgeniy Polyakov "); - MODULE_DESCRIPTION("Generic userspace <-> kernelspace connector."); -+MODULE_ALIAS_NET_PF_PROTO(PF_NETLINK, NETLINK_CONNECTOR); - - static struct cn_dev cdev; - -diff --git a/drivers/dma/Makefile b/drivers/dma/Makefile -index a8a84f4..64b21f5 100644 ---- a/drivers/dma/Makefile -+++ b/drivers/dma/Makefile -@@ -1,8 +1,8 @@ - ifeq ($(CONFIG_DMADEVICES_DEBUG),y) -- EXTRA_CFLAGS += -DDEBUG -+ ccflags-y += -DDEBUG - endif - ifeq ($(CONFIG_DMADEVICES_VDEBUG),y) -- EXTRA_CFLAGS += -DVERBOSE_DEBUG -+ ccflags-y += -DVERBOSE_DEBUG - endif - - obj-$(CONFIG_DMA_ENGINE) += dmaengine.o -diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c -index a0f3e6a..ea0ee81 100644 ---- a/drivers/dma/at_hdmac.c -+++ b/drivers/dma/at_hdmac.c -@@ -722,7 +722,7 @@ atc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl, - desc->lli.daddr = mem; - desc->lli.ctrla = ctrla - | ATC_DST_WIDTH(mem_width) -- | len >> mem_width; -+ | len >> reg_width; - desc->lli.ctrlb = ctrlb; - - if (!first) { -diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c -index 286c3ac..e5e172d2 100644 ---- a/drivers/dma/fsldma.c -+++ b/drivers/dma/fsldma.c -@@ -50,9 +50,11 @@ static void dma_init(struct fsldma_chan *chan) - * EIE - Error interrupt enable - * EOSIE - End of segments interrupt enable (basic mode) - * EOLNIE - End of links interrupt enable -+ * BWC - Bandwidth sharing among channels - */ -- DMA_OUT(chan, &chan->regs->mr, FSL_DMA_MR_EIE -- | FSL_DMA_MR_EOLNIE | FSL_DMA_MR_EOSIE, 32); -+ DMA_OUT(chan, &chan->regs->mr, FSL_DMA_MR_BWC -+ | FSL_DMA_MR_EIE | FSL_DMA_MR_EOLNIE -+ | FSL_DMA_MR_EOSIE, 32); - break; - case FSL_DMA_IP_83XX: - /* Set the channel to below modes: -diff --git a/drivers/dma/fsldma.h b/drivers/dma/fsldma.h -index cb4d6ff..ba9f403 100644 ---- a/drivers/dma/fsldma.h -+++ b/drivers/dma/fsldma.h -@@ -1,5 +1,5 @@ - /* -- * Copyright (C) 2007 Freescale Semiconductor, Inc. All rights reserved. -+ * Copyright (C) 2007-2010 Freescale Semiconductor, Inc. All rights reserved. - * - * Author: - * Zhang Wei , Jul 2007 -@@ -36,6 +36,13 @@ - #define FSL_DMA_MR_DAHE 0x00002000 - #define FSL_DMA_MR_SAHE 0x00001000 - -+/* -+ * Bandwidth/pause control determines how many bytes a given -+ * channel is allowed to transfer before the DMA engine pauses -+ * the current channel and switches to the next channel -+ */ -+#define FSL_DMA_MR_BWC 0x08000000 -+ - /* Special MR definition for MPC8349 */ - #define FSL_DMA_MR_EOTIE 0x00000080 - #define FSL_DMA_MR_PRC_RM 0x00000800 -diff --git a/drivers/dma/imx-dma.c b/drivers/dma/imx-dma.c -index f629e49..e53d438 100644 ---- a/drivers/dma/imx-dma.c -+++ b/drivers/dma/imx-dma.c -@@ -379,7 +379,7 @@ static int __init imxdma_probe(struct platform_device *pdev) - return 0; - - err_init: -- while (i-- >= 0) { -+ while (--i >= 0) { - struct imxdma_channel *imxdmac = &imxdma->channel[i]; - imx_dma_free(imxdmac->imxdma_channel); - } -diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c -index 0834323..d0602dd 100644 ---- a/drivers/dma/imx-sdma.c -+++ b/drivers/dma/imx-sdma.c -@@ -951,7 +951,7 @@ static struct dma_async_tx_descriptor *sdma_prep_slave_sg( - struct sdma_buffer_descriptor *bd = &sdmac->bd[i]; - int param; - -- bd->buffer_addr = sgl->dma_address; -+ bd->buffer_addr = sg->dma_address; - - count = sg->length; - -@@ -1385,7 +1385,7 @@ static int __init sdma_module_init(void) - { - return platform_driver_probe(&sdma_driver, sdma_probe); - } --subsys_initcall(sdma_module_init); -+module_init(sdma_module_init); - - MODULE_AUTHOR("Sascha Hauer, Pengutronix "); - MODULE_DESCRIPTION("i.MX SDMA driver"); -diff --git a/drivers/dma/intel_mid_dma.c b/drivers/dma/intel_mid_dma.c -index 338bc4e..3109bd9 100644 ---- a/drivers/dma/intel_mid_dma.c -+++ b/drivers/dma/intel_mid_dma.c -@@ -1075,7 +1075,6 @@ static int mid_setup_dma(struct pci_dev *pdev) - if (NULL == dma->dma_pool) { - pr_err("ERR_MDMA:pci_pool_create failed\n"); - err = -ENOMEM; -- kfree(dma); - goto err_dma_pool; - } - -@@ -1186,7 +1185,6 @@ err_engine: - free_irq(pdev->irq, dma); - err_irq: - pci_pool_destroy(dma->dma_pool); -- kfree(dma); - err_dma_pool: - pr_err("ERR_MDMA:setup_dma failed: %d\n", err); - return err; -@@ -1413,7 +1411,7 @@ static const struct dev_pm_ops intel_mid_dma_pm = { - .runtime_idle = dma_runtime_idle, - }; - --static struct pci_driver intel_mid_dma_pci = { -+static struct pci_driver intel_mid_dma_pci_driver = { - .name = "Intel MID DMA", - .id_table = intel_mid_dma_ids, - .probe = intel_mid_dma_probe, -@@ -1431,13 +1429,13 @@ static int __init intel_mid_dma_init(void) - { - pr_debug("INFO_MDMA: LNW DMA Driver Version %s\n", - INTEL_MID_DMA_DRIVER_VERSION); -- return pci_register_driver(&intel_mid_dma_pci); -+ return pci_register_driver(&intel_mid_dma_pci_driver); - } - fs_initcall(intel_mid_dma_init); - - static void __exit intel_mid_dma_exit(void) - { -- pci_unregister_driver(&intel_mid_dma_pci); -+ pci_unregister_driver(&intel_mid_dma_pci_driver); - } - module_exit(intel_mid_dma_exit); - -diff --git a/drivers/dma/ioat/Makefile b/drivers/dma/ioat/Makefile -index 8997d3f..0ff7270 100644 ---- a/drivers/dma/ioat/Makefile -+++ b/drivers/dma/ioat/Makefile -@@ -1,2 +1,2 @@ - obj-$(CONFIG_INTEL_IOATDMA) += ioatdma.o --ioatdma-objs := pci.o dma.o dma_v2.o dma_v3.o dca.o -+ioatdma-y := pci.o dma.o dma_v2.o dma_v3.o dca.o -diff --git a/drivers/dma/pch_dma.c b/drivers/dma/pch_dma.c -index 92b6790..c064c89 100644 ---- a/drivers/dma/pch_dma.c -+++ b/drivers/dma/pch_dma.c -@@ -259,11 +259,6 @@ static void pdc_dostart(struct pch_dma_chan *pd_chan, struct pch_dma_desc* desc) - return; - } - -- channel_writel(pd_chan, DEV_ADDR, desc->regs.dev_addr); -- channel_writel(pd_chan, MEM_ADDR, desc->regs.mem_addr); -- channel_writel(pd_chan, SIZE, desc->regs.size); -- channel_writel(pd_chan, NEXT, desc->regs.next); -- - dev_dbg(chan2dev(&pd_chan->chan), "chan %d -> dev_addr: %x\n", - pd_chan->chan.chan_id, desc->regs.dev_addr); - dev_dbg(chan2dev(&pd_chan->chan), "chan %d -> mem_addr: %x\n", -@@ -273,10 +268,16 @@ static void pdc_dostart(struct pch_dma_chan *pd_chan, struct pch_dma_desc* desc) - dev_dbg(chan2dev(&pd_chan->chan), "chan %d -> next: %x\n", - pd_chan->chan.chan_id, desc->regs.next); - -- if (list_empty(&desc->tx_list)) -+ if (list_empty(&desc->tx_list)) { -+ channel_writel(pd_chan, DEV_ADDR, desc->regs.dev_addr); -+ channel_writel(pd_chan, MEM_ADDR, desc->regs.mem_addr); -+ channel_writel(pd_chan, SIZE, desc->regs.size); -+ channel_writel(pd_chan, NEXT, desc->regs.next); - pdc_set_mode(&pd_chan->chan, DMA_CTL0_ONESHOT); -- else -+ } else { -+ channel_writel(pd_chan, NEXT, desc->txd.phys); - pdc_set_mode(&pd_chan->chan, DMA_CTL0_SG); -+ } - - val = dma_readl(pd, CTL2); - val |= 1 << (DMA_CTL2_START_SHIFT_BITS + pd_chan->chan.chan_id); -diff --git a/drivers/dma/ppc4xx/adma.c b/drivers/dma/ppc4xx/adma.c -index 0d58a4a..cef5845 100644 ---- a/drivers/dma/ppc4xx/adma.c -+++ b/drivers/dma/ppc4xx/adma.c -@@ -4449,9 +4449,8 @@ static int __devinit ppc440spe_adma_probe(struct platform_device *ofdev, - - if (!request_mem_region(res.start, resource_size(&res), - dev_driver_string(&ofdev->dev))) { -- dev_err(&ofdev->dev, "failed to request memory region " -- "(0x%016llx-0x%016llx)\n", -- (u64)res.start, (u64)res.end); -+ dev_err(&ofdev->dev, "failed to request memory region %pR\n", -+ &res); - initcode = PPC_ADMA_INIT_MEMREG; - ret = -EBUSY; - goto out; -diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c -index 8521401..eca9ba1 100644 ---- a/drivers/edac/amd64_edac.c -+++ b/drivers/edac/amd64_edac.c -@@ -1572,7 +1572,7 @@ static int f10_match_to_this_node(struct amd64_pvt *pvt, int dram_range, - debugf1(" HoleOffset=0x%x HoleValid=0x%x IntlvSel=0x%x\n", - hole_off, hole_valid, intlv_sel); - -- if (intlv_en || -+ if (intlv_en && - (intlv_sel != ((sys_addr >> 12) & intlv_en))) - return -EINVAL; - -diff --git a/drivers/edac/edac_core.h b/drivers/edac/edac_core.h -index d7ca43a..251440c 100644 ---- a/drivers/edac/edac_core.h -+++ b/drivers/edac/edac_core.h -@@ -41,10 +41,10 @@ - #define MC_PROC_NAME_MAX_LEN 7 - - #if PAGE_SHIFT < 20 --#define PAGES_TO_MiB( pages ) ( ( pages ) >> ( 20 - PAGE_SHIFT ) ) --#define MiB_TO_PAGES(mb) ((mb) >> (20 - PAGE_SHIFT)) -+#define PAGES_TO_MiB(pages) ((pages) >> (20 - PAGE_SHIFT)) -+#define MiB_TO_PAGES(mb) ((mb) << (20 - PAGE_SHIFT)) - #else /* PAGE_SHIFT > 20 */ --#define PAGES_TO_MiB( pages ) ( ( pages ) << ( PAGE_SHIFT - 20 ) ) -+#define PAGES_TO_MiB(pages) ((pages) << (PAGE_SHIFT - 20)) - #define MiB_TO_PAGES(mb) ((mb) >> (PAGE_SHIFT - 20)) - #endif - -diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c -index ba6586a..795ea69 100644 ---- a/drivers/edac/edac_mc.c -+++ b/drivers/edac/edac_mc.c -@@ -586,14 +586,16 @@ struct mem_ctl_info *edac_mc_del_mc(struct device *dev) - return NULL; - } - -- /* marking MCI offline */ -- mci->op_state = OP_OFFLINE; -- - del_mc_from_global_list(mci); - mutex_unlock(&mem_ctls_mutex); - -- /* flush workq processes and remove sysfs */ -+ /* flush workq processes */ - edac_mc_workq_teardown(mci); -+ -+ /* marking MCI offline */ -+ mci->op_state = OP_OFFLINE; -+ -+ /* remove from sysfs */ - edac_remove_sysfs_mci_device(mci); - - edac_printk(KERN_INFO, EDAC_MC, -diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c -index 84eb607..e3c8b60 100644 ---- a/drivers/firewire/ohci.c -+++ b/drivers/firewire/ohci.c -@@ -242,6 +242,7 @@ static inline struct fw_ohci *fw_ohci(struct fw_card *card) - - static char ohci_driver_name[] = KBUILD_MODNAME; - -+#define PCI_DEVICE_ID_AGERE_FW643 0x5901 - #define PCI_DEVICE_ID_JMICRON_JMB38X_FW 0x2380 - #define PCI_DEVICE_ID_TI_TSB12LV22 0x8009 - -@@ -253,18 +254,34 @@ static char ohci_driver_name[] = KBUILD_MODNAME; - - /* In case of multiple matches in ohci_quirks[], only the first one is used. */ - static const struct { -- unsigned short vendor, device, flags; -+ unsigned short vendor, device, revision, flags; - } ohci_quirks[] = { -- {PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_TSB12LV22, QUIRK_CYCLE_TIMER | -- QUIRK_RESET_PACKET | -- QUIRK_NO_1394A}, -- {PCI_VENDOR_ID_TI, PCI_ANY_ID, QUIRK_RESET_PACKET}, -- {PCI_VENDOR_ID_AL, PCI_ANY_ID, QUIRK_CYCLE_TIMER}, -- {PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB38X_FW, QUIRK_NO_MSI}, -- {PCI_VENDOR_ID_NEC, PCI_ANY_ID, QUIRK_CYCLE_TIMER}, -- {PCI_VENDOR_ID_VIA, PCI_ANY_ID, QUIRK_CYCLE_TIMER}, -- {PCI_VENDOR_ID_RICOH, PCI_ANY_ID, QUIRK_CYCLE_TIMER}, -- {PCI_VENDOR_ID_APPLE, PCI_DEVICE_ID_APPLE_UNI_N_FW, QUIRK_BE_HEADERS}, -+ {PCI_VENDOR_ID_AL, PCI_ANY_ID, PCI_ANY_ID, -+ QUIRK_CYCLE_TIMER}, -+ -+ {PCI_VENDOR_ID_APPLE, PCI_DEVICE_ID_APPLE_UNI_N_FW, PCI_ANY_ID, -+ QUIRK_BE_HEADERS}, -+ -+ {PCI_VENDOR_ID_ATT, PCI_DEVICE_ID_AGERE_FW643, 6, -+ QUIRK_NO_MSI}, -+ -+ {PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB38X_FW, PCI_ANY_ID, -+ QUIRK_NO_MSI}, -+ -+ {PCI_VENDOR_ID_NEC, PCI_ANY_ID, PCI_ANY_ID, -+ QUIRK_CYCLE_TIMER}, -+ -+ {PCI_VENDOR_ID_RICOH, PCI_ANY_ID, PCI_ANY_ID, -+ QUIRK_CYCLE_TIMER}, -+ -+ {PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_TSB12LV22, PCI_ANY_ID, -+ QUIRK_CYCLE_TIMER | QUIRK_RESET_PACKET | QUIRK_NO_1394A}, -+ -+ {PCI_VENDOR_ID_TI, PCI_ANY_ID, PCI_ANY_ID, -+ QUIRK_RESET_PACKET}, -+ -+ {PCI_VENDOR_ID_VIA, PCI_ANY_ID, PCI_ANY_ID, -+ QUIRK_CYCLE_TIMER | QUIRK_NO_MSI}, - }; - - /* This overrides anything that was found in ohci_quirks[]. */ -@@ -2927,9 +2944,11 @@ static int __devinit pci_probe(struct pci_dev *dev, - } - - for (i = 0; i < ARRAY_SIZE(ohci_quirks); i++) -- if (ohci_quirks[i].vendor == dev->vendor && -- (ohci_quirks[i].device == dev->device || -- ohci_quirks[i].device == (unsigned short)PCI_ANY_ID)) { -+ if ((ohci_quirks[i].vendor == dev->vendor) && -+ (ohci_quirks[i].device == (unsigned short)PCI_ANY_ID || -+ ohci_quirks[i].device == dev->device) && -+ (ohci_quirks[i].revision == (unsigned short)PCI_ANY_ID || -+ ohci_quirks[i].revision >= dev->revision)) { - ohci->quirks = ohci_quirks[i].flags; - break; - } -diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c -index 6985cb1..2baa670 100644 ---- a/drivers/gpu/drm/drm_crtc.c -+++ b/drivers/gpu/drm/drm_crtc.c -@@ -156,12 +156,12 @@ static struct drm_conn_prop_enum_list drm_connector_enum_list[] = - { DRM_MODE_CONNECTOR_SVIDEO, "SVIDEO", 0 }, - { DRM_MODE_CONNECTOR_LVDS, "LVDS", 0 }, - { DRM_MODE_CONNECTOR_Component, "Component", 0 }, -- { DRM_MODE_CONNECTOR_9PinDIN, "9-pin DIN", 0 }, -- { DRM_MODE_CONNECTOR_DisplayPort, "DisplayPort", 0 }, -- { DRM_MODE_CONNECTOR_HDMIA, "HDMI Type A", 0 }, -- { DRM_MODE_CONNECTOR_HDMIB, "HDMI Type B", 0 }, -+ { DRM_MODE_CONNECTOR_9PinDIN, "DIN", 0 }, -+ { DRM_MODE_CONNECTOR_DisplayPort, "DP", 0 }, -+ { DRM_MODE_CONNECTOR_HDMIA, "HDMI-A", 0 }, -+ { DRM_MODE_CONNECTOR_HDMIB, "HDMI-B", 0 }, - { DRM_MODE_CONNECTOR_TV, "TV", 0 }, -- { DRM_MODE_CONNECTOR_eDP, "Embedded DisplayPort", 0 }, -+ { DRM_MODE_CONNECTOR_eDP, "eDP", 0 }, - }; - - static struct drm_prop_enum_list drm_encoder_enum_list[] = -diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c -index 7ca5935..bede10a 100644 ---- a/drivers/gpu/drm/drm_crtc_helper.c -+++ b/drivers/gpu/drm/drm_crtc_helper.c -@@ -241,7 +241,7 @@ void drm_helper_disable_unused_functions(struct drm_device *dev) - } - - list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) { -- if (!drm_helper_encoder_in_use(encoder)) { -+ if (encoder->crtc && !drm_helper_encoder_in_use(encoder)) { - drm_encoder_disable(encoder); - /* disconnector encoder from any connector */ - encoder->crtc = NULL; -diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c -index 9d3a503..16d5155 100644 ---- a/drivers/gpu/drm/drm_irq.c -+++ b/drivers/gpu/drm/drm_irq.c -@@ -585,10 +585,13 @@ static int drm_queue_vblank_event(struct drm_device *dev, int pipe, - struct timeval now; - unsigned long flags; - unsigned int seq; -+ int ret; - - e = kzalloc(sizeof *e, GFP_KERNEL); -- if (e == NULL) -- return -ENOMEM; -+ if (e == NULL) { -+ ret = -ENOMEM; -+ goto err_put; -+ } - - e->pipe = pipe; - e->base.pid = current->pid; -@@ -603,9 +606,8 @@ static int drm_queue_vblank_event(struct drm_device *dev, int pipe, - spin_lock_irqsave(&dev->event_lock, flags); - - if (file_priv->event_space < sizeof e->event) { -- spin_unlock_irqrestore(&dev->event_lock, flags); -- kfree(e); -- return -ENOMEM; -+ ret = -EBUSY; -+ goto err_unlock; - } - - file_priv->event_space -= sizeof e->event; -@@ -626,7 +628,7 @@ static int drm_queue_vblank_event(struct drm_device *dev, int pipe, - if ((seq - vblwait->request.sequence) <= (1 << 23)) { - e->event.tv_sec = now.tv_sec; - e->event.tv_usec = now.tv_usec; -- drm_vblank_put(dev, e->pipe); -+ drm_vblank_put(dev, pipe); - list_add_tail(&e->base.link, &e->base.file_priv->event_list); - wake_up_interruptible(&e->base.file_priv->event_wait); - trace_drm_vblank_event_delivered(current->pid, pipe, -@@ -638,6 +640,13 @@ static int drm_queue_vblank_event(struct drm_device *dev, int pipe, - spin_unlock_irqrestore(&dev->event_lock, flags); - - return 0; -+ -+err_unlock: -+ spin_unlock_irqrestore(&dev->event_lock, flags); -+ kfree(e); -+err_put: -+ drm_vblank_put(dev, pipe); -+ return ret; - } - - /** -diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c -index 7a26f4dd..e680081 100644 ---- a/drivers/gpu/drm/i915/i915_dma.c -+++ b/drivers/gpu/drm/i915/i915_dma.c -@@ -767,6 +767,9 @@ static int i915_getparam(struct drm_device *dev, void *data, - case I915_PARAM_HAS_BLT: - value = HAS_BLT(dev); - break; -+ case I915_PARAM_HAS_COHERENT_RINGS: -+ value = 1; -+ break; - default: - DRM_DEBUG_DRIVER("Unknown parameter %d\n", - param->param); -diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c -index 5e54821..275ec6e 100644 ---- a/drivers/gpu/drm/i915/i915_gem.c -+++ b/drivers/gpu/drm/i915/i915_gem.c -@@ -4374,10 +4374,20 @@ i915_gem_busy_ioctl(struct drm_device *dev, void *data, - * use this buffer rather sooner than later, so issuing the required - * flush earlier is beneficial. - */ -- if (obj->write_domain & I915_GEM_GPU_DOMAINS) -+ if (obj->write_domain & I915_GEM_GPU_DOMAINS) { - i915_gem_flush_ring(dev, file_priv, - obj_priv->ring, - 0, obj->write_domain); -+ } else if (obj_priv->ring->outstanding_lazy_request) { -+ /* This ring is not being cleared by active usage, -+ * so emit a request to do so. -+ */ -+ u32 seqno = i915_add_request(dev, -+ NULL, NULL, -+ obj_priv->ring); -+ if (seqno == 0) -+ ret = -ENOMEM; -+ } - - /* Update the active list for the hardware's current position. - * Otherwise this only updates on a delayed timer or when irqs -diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h -index 25ed911..878fc76 100644 ---- a/drivers/gpu/drm/i915/i915_reg.h -+++ b/drivers/gpu/drm/i915/i915_reg.h -@@ -3033,6 +3033,7 @@ - #define TRANS_DP_10BPC (1<<9) - #define TRANS_DP_6BPC (2<<9) - #define TRANS_DP_12BPC (3<<9) -+#define TRANS_DP_BPC_MASK (3<<9) - #define TRANS_DP_VSYNC_ACTIVE_HIGH (1<<4) - #define TRANS_DP_VSYNC_ACTIVE_LOW 0 - #define TRANS_DP_HSYNC_ACTIVE_HIGH (1<<3) -diff --git a/drivers/gpu/drm/i915/intel_acpi.c b/drivers/gpu/drm/i915/intel_acpi.c -index 65c88f9..2cb8e0b 100644 ---- a/drivers/gpu/drm/i915/intel_acpi.c -+++ b/drivers/gpu/drm/i915/intel_acpi.c -@@ -190,37 +190,6 @@ out: - kfree(output.pointer); - } - --static int intel_dsm_switchto(enum vga_switcheroo_client_id id) --{ -- return 0; --} -- --static int intel_dsm_power_state(enum vga_switcheroo_client_id id, -- enum vga_switcheroo_state state) --{ -- return 0; --} -- --static int intel_dsm_init(void) --{ -- return 0; --} -- --static int intel_dsm_get_client_id(struct pci_dev *pdev) --{ -- if (intel_dsm_priv.dhandle == DEVICE_ACPI_HANDLE(&pdev->dev)) -- return VGA_SWITCHEROO_IGD; -- else -- return VGA_SWITCHEROO_DIS; --} -- --static struct vga_switcheroo_handler intel_dsm_handler = { -- .switchto = intel_dsm_switchto, -- .power_state = intel_dsm_power_state, -- .init = intel_dsm_init, -- .get_client_id = intel_dsm_get_client_id, --}; -- - static bool intel_dsm_pci_probe(struct pci_dev *pdev) - { - acpi_handle dhandle, intel_handle; -@@ -276,11 +245,8 @@ void intel_register_dsm_handler(void) - { - if (!intel_dsm_detect()) - return; -- -- vga_switcheroo_register_handler(&intel_dsm_handler); - } - - void intel_unregister_dsm_handler(void) - { -- vga_switcheroo_unregister_handler(); - } -diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c -index 255b52e..d9b7092 100644 ---- a/drivers/gpu/drm/i915/intel_display.c -+++ b/drivers/gpu/drm/i915/intel_display.c -@@ -2120,9 +2120,11 @@ static void ironlake_crtc_enable(struct drm_crtc *crtc) - reg = TRANS_DP_CTL(pipe); - temp = I915_READ(reg); - temp &= ~(TRANS_DP_PORT_SEL_MASK | -- TRANS_DP_SYNC_MASK); -+ TRANS_DP_SYNC_MASK | -+ TRANS_DP_BPC_MASK); - temp |= (TRANS_DP_OUTPUT_ENABLE | - TRANS_DP_ENH_FRAMING); -+ temp |= TRANS_DP_8BPC; - - if (crtc->mode.flags & DRM_MODE_FLAG_PHSYNC) - temp |= TRANS_DP_HSYNC_ACTIVE_HIGH; -@@ -2712,27 +2714,19 @@ fdi_reduce_ratio(u32 *num, u32 *den) - } - } - --#define DATA_N 0x800000 --#define LINK_N 0x80000 -- - static void - ironlake_compute_m_n(int bits_per_pixel, int nlanes, int pixel_clock, - int link_clock, struct fdi_m_n *m_n) - { -- u64 temp; -- - m_n->tu = 64; /* default size */ - -- temp = (u64) DATA_N * pixel_clock; -- temp = div_u64(temp, link_clock); -- m_n->gmch_m = div_u64(temp * bits_per_pixel, nlanes); -- m_n->gmch_m >>= 3; /* convert to bytes_per_pixel */ -- m_n->gmch_n = DATA_N; -+ /* BUG_ON(pixel_clock > INT_MAX / 36); */ -+ m_n->gmch_m = bits_per_pixel * pixel_clock; -+ m_n->gmch_n = link_clock * nlanes * 8; - fdi_reduce_ratio(&m_n->gmch_m, &m_n->gmch_n); - -- temp = (u64) LINK_N * pixel_clock; -- m_n->link_m = div_u64(temp, link_clock); -- m_n->link_n = LINK_N; -+ m_n->link_m = pixel_clock; -+ m_n->link_n = link_clock; - fdi_reduce_ratio(&m_n->link_m, &m_n->link_n); - } - -@@ -3716,6 +3710,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc, - - /* FDI link */ - if (HAS_PCH_SPLIT(dev)) { -+ int pixel_multiplier = intel_mode_get_pixel_multiplier(adjusted_mode); - int lane = 0, link_bw, bpp; - /* CPU eDP doesn't require FDI link, so just set DP M/N - according to current link config */ -@@ -3799,6 +3794,8 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc, - - intel_crtc->fdi_lanes = lane; - -+ if (pixel_multiplier > 1) -+ link_bw *= pixel_multiplier; - ironlake_compute_m_n(bpp, lane, target_clock, link_bw, &m_n); - } - -@@ -5236,6 +5233,55 @@ static const struct drm_crtc_funcs intel_crtc_funcs = { - .page_flip = intel_crtc_page_flip, - }; - -+static void intel_sanitize_modesetting(struct drm_device *dev, -+ int pipe, int plane) -+{ -+ struct drm_i915_private *dev_priv = dev->dev_private; -+ u32 reg, val; -+ -+ if (HAS_PCH_SPLIT(dev)) -+ return; -+ -+ /* Who knows what state these registers were left in by the BIOS or -+ * grub? -+ * -+ * If we leave the registers in a conflicting state (e.g. with the -+ * display plane reading from the other pipe than the one we intend -+ * to use) then when we attempt to teardown the active mode, we will -+ * not disable the pipes and planes in the correct order -- leaving -+ * a plane reading from a disabled pipe and possibly leading to -+ * undefined behaviour. -+ */ -+ -+ reg = DSPCNTR(plane); -+ val = I915_READ(reg); -+ -+ if ((val & DISPLAY_PLANE_ENABLE) == 0) -+ return; -+ if (!!(val & DISPPLANE_SEL_PIPE_MASK) == pipe) -+ return; -+ -+ /* This display plane is active and attached to the other CPU pipe. */ -+ pipe = !pipe; -+ -+ /* Disable the plane and wait for it to stop reading from the pipe. */ -+ I915_WRITE(reg, val & ~DISPLAY_PLANE_ENABLE); -+ intel_flush_display_plane(dev, plane); -+ -+ if (IS_GEN2(dev)) -+ intel_wait_for_vblank(dev, pipe); -+ -+ if (pipe == 0 && (dev_priv->quirks & QUIRK_PIPEA_FORCE)) -+ return; -+ -+ /* Switch off the pipe. */ -+ reg = PIPECONF(pipe); -+ val = I915_READ(reg); -+ if (val & PIPECONF_ENABLE) { -+ I915_WRITE(reg, val & ~PIPECONF_ENABLE); -+ intel_wait_for_pipe_off(dev, pipe); -+ } -+} - - static void intel_crtc_init(struct drm_device *dev, int pipe) - { -@@ -5287,6 +5333,8 @@ static void intel_crtc_init(struct drm_device *dev, int pipe) - - setup_timer(&intel_crtc->idle_timer, intel_crtc_idle_timer, - (unsigned long)intel_crtc); -+ -+ intel_sanitize_modesetting(dev, intel_crtc->pipe, intel_crtc->plane); - } - - int intel_get_pipe_from_crtc_id(struct drm_device *dev, void *data, -diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c -index 300f64b..df648cb 100644 ---- a/drivers/gpu/drm/i915/intel_dp.c -+++ b/drivers/gpu/drm/i915/intel_dp.c -@@ -1376,6 +1376,9 @@ intel_dp_link_down(struct intel_dp *intel_dp) - struct drm_i915_private *dev_priv = dev->dev_private; - uint32_t DP = intel_dp->DP; - -+ if ((I915_READ(intel_dp->output_reg) & DP_PORT_EN) == 0) -+ return; -+ - DRM_DEBUG_KMS("\n"); - - if (is_edp(intel_dp)) { -@@ -1398,6 +1401,28 @@ intel_dp_link_down(struct intel_dp *intel_dp) - - if (is_edp(intel_dp)) - DP |= DP_LINK_TRAIN_OFF; -+ -+ if (!HAS_PCH_CPT(dev) && -+ I915_READ(intel_dp->output_reg) & DP_PIPEB_SELECT) { -+ struct intel_crtc *intel_crtc = to_intel_crtc(intel_dp->base.base.crtc); -+ /* Hardware workaround: leaving our transcoder select -+ * set to transcoder B while it's off will prevent the -+ * corresponding HDMI output on transcoder A. -+ * -+ * Combine this with another hardware workaround: -+ * transcoder select bit can only be cleared while the -+ * port is enabled. -+ */ -+ DP &= ~DP_PIPEB_SELECT; -+ I915_WRITE(intel_dp->output_reg, DP); -+ -+ /* Changes to enable or select take place the vblank -+ * after being written. -+ */ -+ intel_wait_for_vblank(intel_dp->base.base.dev, -+ intel_crtc->pipe); -+ } -+ - I915_WRITE(intel_dp->output_reg, DP & ~DP_PORT_EN); - POSTING_READ(intel_dp->output_reg); - } -diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c -index f79327f..25bcedf 100644 ---- a/drivers/gpu/drm/i915/intel_lvds.c -+++ b/drivers/gpu/drm/i915/intel_lvds.c -@@ -68,7 +68,7 @@ static struct intel_lvds *intel_attached_lvds(struct drm_connector *connector) - /** - * Sets the power state for the panel. - */ --static void intel_lvds_set_power(struct intel_lvds *intel_lvds, bool on) -+static void intel_lvds_enable(struct intel_lvds *intel_lvds) - { - struct drm_device *dev = intel_lvds->base.base.dev; - struct drm_i915_private *dev_priv = dev->dev_private; -@@ -82,26 +82,61 @@ static void intel_lvds_set_power(struct intel_lvds *intel_lvds, bool on) - lvds_reg = LVDS; - } - -- if (on) { -- I915_WRITE(lvds_reg, I915_READ(lvds_reg) | LVDS_PORT_EN); -- I915_WRITE(ctl_reg, I915_READ(ctl_reg) | POWER_TARGET_ON); -- intel_panel_set_backlight(dev, dev_priv->backlight_level); -- } else { -- dev_priv->backlight_level = intel_panel_get_backlight(dev); -- -- intel_panel_set_backlight(dev, 0); -- I915_WRITE(ctl_reg, I915_READ(ctl_reg) & ~POWER_TARGET_ON); -+ I915_WRITE(lvds_reg, I915_READ(lvds_reg) | LVDS_PORT_EN); - -- if (intel_lvds->pfit_control) { -- if (wait_for((I915_READ(PP_STATUS) & PP_ON) == 0, 1000)) -- DRM_ERROR("timed out waiting for panel to power off\n"); -- I915_WRITE(PFIT_CONTROL, 0); -- intel_lvds->pfit_control = 0; -+ if (intel_lvds->pfit_dirty) { -+ /* -+ * Enable automatic panel scaling so that non-native modes -+ * fill the screen. The panel fitter should only be -+ * adjusted whilst the pipe is disabled, according to -+ * register description and PRM. -+ */ -+ DRM_DEBUG_KMS("applying panel-fitter: %x, %x\n", -+ intel_lvds->pfit_control, -+ intel_lvds->pfit_pgm_ratios); -+ if (wait_for((I915_READ(PP_STATUS) & PP_ON) == 0, 1000)) { -+ DRM_ERROR("timed out waiting for panel to power off\n"); -+ } else { -+ I915_WRITE(PFIT_PGM_RATIOS, intel_lvds->pfit_pgm_ratios); -+ I915_WRITE(PFIT_CONTROL, intel_lvds->pfit_control); - intel_lvds->pfit_dirty = false; - } -+ } -+ -+ I915_WRITE(ctl_reg, I915_READ(ctl_reg) | POWER_TARGET_ON); -+ POSTING_READ(lvds_reg); -+ -+ intel_panel_set_backlight(dev, dev_priv->backlight_level); -+} - -- I915_WRITE(lvds_reg, I915_READ(lvds_reg) & ~LVDS_PORT_EN); -+static void intel_lvds_disable(struct intel_lvds *intel_lvds) -+{ -+ struct drm_device *dev = intel_lvds->base.base.dev; -+ struct drm_i915_private *dev_priv = dev->dev_private; -+ u32 ctl_reg, lvds_reg; -+ -+ if (HAS_PCH_SPLIT(dev)) { -+ ctl_reg = PCH_PP_CONTROL; -+ lvds_reg = PCH_LVDS; -+ } else { -+ ctl_reg = PP_CONTROL; -+ lvds_reg = LVDS; -+ } -+ -+ dev_priv->backlight_level = intel_panel_get_backlight(dev); -+ intel_panel_set_backlight(dev, 0); -+ -+ I915_WRITE(ctl_reg, I915_READ(ctl_reg) & ~POWER_TARGET_ON); -+ -+ if (intel_lvds->pfit_control) { -+ if (wait_for((I915_READ(PP_STATUS) & PP_ON) == 0, 1000)) -+ DRM_ERROR("timed out waiting for panel to power off\n"); -+ -+ I915_WRITE(PFIT_CONTROL, 0); -+ intel_lvds->pfit_dirty = true; - } -+ -+ I915_WRITE(lvds_reg, I915_READ(lvds_reg) & ~LVDS_PORT_EN); - POSTING_READ(lvds_reg); - } - -@@ -110,9 +145,9 @@ static void intel_lvds_dpms(struct drm_encoder *encoder, int mode) - struct intel_lvds *intel_lvds = to_intel_lvds(encoder); - - if (mode == DRM_MODE_DPMS_ON) -- intel_lvds_set_power(intel_lvds, true); -+ intel_lvds_enable(intel_lvds); - else -- intel_lvds_set_power(intel_lvds, false); -+ intel_lvds_disable(intel_lvds); - - /* XXX: We never power down the LVDS pairs. */ - } -@@ -411,43 +446,18 @@ static void intel_lvds_commit(struct drm_encoder *encoder) - /* Always do a full power on as we do not know what state - * we were left in. - */ -- intel_lvds_set_power(intel_lvds, true); -+ intel_lvds_enable(intel_lvds); - } - - static void intel_lvds_mode_set(struct drm_encoder *encoder, - struct drm_display_mode *mode, - struct drm_display_mode *adjusted_mode) - { -- struct drm_device *dev = encoder->dev; -- struct drm_i915_private *dev_priv = dev->dev_private; -- struct intel_lvds *intel_lvds = to_intel_lvds(encoder); -- - /* - * The LVDS pin pair will already have been turned on in the - * intel_crtc_mode_set since it has a large impact on the DPLL - * settings. - */ -- -- if (HAS_PCH_SPLIT(dev)) -- return; -- -- if (!intel_lvds->pfit_dirty) -- return; -- -- /* -- * Enable automatic panel scaling so that non-native modes fill the -- * screen. Should be enabled before the pipe is enabled, according to -- * register description and PRM. -- */ -- DRM_DEBUG_KMS("applying panel-fitter: %x, %x\n", -- intel_lvds->pfit_control, -- intel_lvds->pfit_pgm_ratios); -- if (wait_for((I915_READ(PP_STATUS) & PP_ON) == 0, 1000)) -- DRM_ERROR("timed out waiting for panel to power off\n"); -- -- I915_WRITE(PFIT_PGM_RATIOS, intel_lvds->pfit_pgm_ratios); -- I915_WRITE(PFIT_CONTROL, intel_lvds->pfit_control); -- intel_lvds->pfit_dirty = false; - } - - /** -diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c -index b83306f..89a65be 100644 ---- a/drivers/gpu/drm/i915/intel_ringbuffer.c -+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c -@@ -156,23 +156,25 @@ static int init_ring_common(struct drm_device *dev, - - /* G45 ring initialization fails to reset head to zero */ - if (head != 0) { -- DRM_ERROR("%s head not reset to zero " -- "ctl %08x head %08x tail %08x start %08x\n", -- ring->name, -- I915_READ_CTL(ring), -- I915_READ_HEAD(ring), -- I915_READ_TAIL(ring), -- I915_READ_START(ring)); -+ DRM_DEBUG_KMS("%s head not reset to zero " -+ "ctl %08x head %08x tail %08x start %08x\n", -+ ring->name, -+ I915_READ_CTL(ring), -+ I915_READ_HEAD(ring), -+ I915_READ_TAIL(ring), -+ I915_READ_START(ring)); - - I915_WRITE_HEAD(ring, 0); - -- DRM_ERROR("%s head forced to zero " -- "ctl %08x head %08x tail %08x start %08x\n", -- ring->name, -- I915_READ_CTL(ring), -- I915_READ_HEAD(ring), -- I915_READ_TAIL(ring), -- I915_READ_START(ring)); -+ if (I915_READ_HEAD(ring) & HEAD_ADDR) { -+ DRM_ERROR("failed to set %s head to zero " -+ "ctl %08x head %08x tail %08x start %08x\n", -+ ring->name, -+ I915_READ_CTL(ring), -+ I915_READ_HEAD(ring), -+ I915_READ_TAIL(ring), -+ I915_READ_START(ring)); -+ } - } - - I915_WRITE_CTL(ring, -diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c -index a355259..4d7a2e1 100644 ---- a/drivers/gpu/drm/radeon/r600.c -+++ b/drivers/gpu/drm/radeon/r600.c -@@ -878,12 +878,15 @@ void r600_pcie_gart_tlb_flush(struct radeon_device *rdev) - u32 tmp; - - /* flush hdp cache so updates hit vram */ -- if ((rdev->family >= CHIP_RV770) && (rdev->family <= CHIP_RV740)) { -+ if ((rdev->family >= CHIP_RV770) && (rdev->family <= CHIP_RV740) && -+ !(rdev->flags & RADEON_IS_AGP)) { - void __iomem *ptr = (void *)rdev->gart.table.vram.ptr; - u32 tmp; - - /* r7xx hw bug. write to HDP_DEBUG1 followed by fb read - * rather than write to HDP_REG_COHERENCY_FLUSH_CNTL -+ * This seems to cause problems on some AGP cards. Just use the old -+ * method for them. - */ - WREG32(HDP_DEBUG1, 0); - tmp = readl((void __iomem *)ptr); -@@ -1195,8 +1198,10 @@ void r600_vram_gtt_location(struct radeon_device *rdev, struct radeon_mc *mc) - mc->vram_end, mc->real_vram_size >> 20); - } else { - u64 base = 0; -- if (rdev->flags & RADEON_IS_IGP) -- base = (RREG32(MC_VM_FB_LOCATION) & 0xFFFF) << 24; -+ if (rdev->flags & RADEON_IS_IGP) { -+ base = RREG32(MC_VM_FB_LOCATION) & 0xFFFF; -+ base <<= 24; -+ } - radeon_vram_location(rdev, &rdev->mc, base); - rdev->mc.gtt_base_align = 0; - radeon_gtt_location(rdev, mc); -@@ -3483,10 +3488,12 @@ int r600_debugfs_mc_info_init(struct radeon_device *rdev) - void r600_ioctl_wait_idle(struct radeon_device *rdev, struct radeon_bo *bo) - { - /* r7xx hw bug. write to HDP_DEBUG1 followed by fb read -- * rather than write to HDP_REG_COHERENCY_FLUSH_CNTL -+ * rather than write to HDP_REG_COHERENCY_FLUSH_CNTL. -+ * This seems to cause problems on some AGP cards. Just use the old -+ * method for them. - */ - if ((rdev->family >= CHIP_RV770) && (rdev->family <= CHIP_RV740) && -- rdev->vram_scratch.ptr) { -+ rdev->vram_scratch.ptr && !(rdev->flags & RADEON_IS_AGP)) { - void __iomem *ptr = (void *)rdev->vram_scratch.ptr; - u32 tmp; - -diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c -index d8ac184..e12e793 100644 ---- a/drivers/gpu/drm/radeon/radeon_device.c -+++ b/drivers/gpu/drm/radeon/radeon_device.c -@@ -286,7 +286,7 @@ void radeon_vram_location(struct radeon_device *rdev, struct radeon_mc *mc, u64 - mc->mc_vram_size = mc->aper_size; - } - mc->vram_end = mc->vram_start + mc->mc_vram_size - 1; -- dev_info(rdev->dev, "VRAM: %lluM 0x%08llX - 0x%08llX (%lluM used)\n", -+ dev_info(rdev->dev, "VRAM: %lluM 0x%016llX - 0x%016llX (%lluM used)\n", - mc->mc_vram_size >> 20, mc->vram_start, - mc->vram_end, mc->real_vram_size >> 20); - } -@@ -323,7 +323,7 @@ void radeon_gtt_location(struct radeon_device *rdev, struct radeon_mc *mc) - mc->gtt_start = (mc->vram_end + 1 + mc->gtt_base_align) & ~mc->gtt_base_align; - } - mc->gtt_end = mc->gtt_start + mc->gtt_size - 1; -- dev_info(rdev->dev, "GTT: %lluM 0x%08llX - 0x%08llX\n", -+ dev_info(rdev->dev, "GTT: %lluM 0x%016llX - 0x%016llX\n", - mc->gtt_size >> 20, mc->gtt_start, mc->gtt_end); - } - -diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c -index 1d06774..a598d00 100644 ---- a/drivers/gpu/drm/radeon/radeon_object.c -+++ b/drivers/gpu/drm/radeon/radeon_object.c -@@ -69,7 +69,7 @@ void radeon_ttm_placement_from_domain(struct radeon_bo *rbo, u32 domain) - u32 c = 0; - - rbo->placement.fpfn = 0; -- rbo->placement.lpfn = rbo->rdev->mc.active_vram_size >> PAGE_SHIFT; -+ rbo->placement.lpfn = 0; - rbo->placement.placement = rbo->placements; - rbo->placement.busy_placement = rbo->placements; - if (domain & RADEON_GEM_DOMAIN_VRAM) -@@ -91,7 +91,8 @@ int radeon_bo_create(struct radeon_device *rdev, struct drm_gem_object *gobj, - { - struct radeon_bo *bo; - enum ttm_bo_type type; -- int page_align = roundup(byte_align, PAGE_SIZE) >> PAGE_SHIFT; -+ unsigned long page_align = roundup(byte_align, PAGE_SIZE) >> PAGE_SHIFT; -+ unsigned long max_size = 0; - int r; - - if (unlikely(rdev->mman.bdev.dev_mapping == NULL)) { -@@ -104,6 +105,14 @@ int radeon_bo_create(struct radeon_device *rdev, struct drm_gem_object *gobj, - } - *bo_ptr = NULL; - -+ /* maximun bo size is the minimun btw visible vram and gtt size */ -+ max_size = min(rdev->mc.visible_vram_size, rdev->mc.gtt_size); -+ if ((page_align << PAGE_SHIFT) >= max_size) { -+ printk(KERN_WARNING "%s:%d alloc size %ldM bigger than %ldMb limit\n", -+ __func__, __LINE__, page_align >> (20 - PAGE_SHIFT), max_size >> 20); -+ return -ENOMEM; -+ } -+ - retry: - bo = kzalloc(sizeof(struct radeon_bo), GFP_KERNEL); - if (bo == NULL) -diff --git a/drivers/hwmon/adm1026.c b/drivers/hwmon/adm1026.c -index 4bf969c..be0fdd5 100644 ---- a/drivers/hwmon/adm1026.c -+++ b/drivers/hwmon/adm1026.c -@@ -916,27 +916,27 @@ static ssize_t set_fan_div(struct device *dev, struct device_attribute *attr, - int nr = sensor_attr->index; - struct i2c_client *client = to_i2c_client(dev); - struct adm1026_data *data = i2c_get_clientdata(client); -- int val, orig_div, new_div, shift; -+ int val, orig_div, new_div; - - val = simple_strtol(buf, NULL, 10); - new_div = DIV_TO_REG(val); -- if (new_div == 0) { -- return -EINVAL; -- } -+ - mutex_lock(&data->update_lock); - orig_div = data->fan_div[nr]; - data->fan_div[nr] = DIV_FROM_REG(new_div); - - if (nr < 4) { /* 0 <= nr < 4 */ -- shift = 2 * nr; - adm1026_write_value(client, ADM1026_REG_FAN_DIV_0_3, -- ((DIV_TO_REG(orig_div) & (~(0x03 << shift))) | -- (new_div << shift))); -+ (DIV_TO_REG(data->fan_div[0]) << 0) | -+ (DIV_TO_REG(data->fan_div[1]) << 2) | -+ (DIV_TO_REG(data->fan_div[2]) << 4) | -+ (DIV_TO_REG(data->fan_div[3]) << 6)); - } else { /* 3 < nr < 8 */ -- shift = 2 * (nr - 4); - adm1026_write_value(client, ADM1026_REG_FAN_DIV_4_7, -- ((DIV_TO_REG(orig_div) & (~(0x03 << (2 * shift)))) | -- (new_div << shift))); -+ (DIV_TO_REG(data->fan_div[4]) << 0) | -+ (DIV_TO_REG(data->fan_div[5]) << 2) | -+ (DIV_TO_REG(data->fan_div[6]) << 4) | -+ (DIV_TO_REG(data->fan_div[7]) << 6)); - } - - if (data->fan_div[nr] != orig_div) { -diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c -index 14a5d98..a428a92 100644 ---- a/drivers/hwmon/it87.c -+++ b/drivers/hwmon/it87.c -@@ -187,6 +187,7 @@ static const u8 IT87_REG_FANX_MIN[] = { 0x1b, 0x1c, 0x1d, 0x85, 0x87 }; - #define IT87_REG_FAN_MAIN_CTRL 0x13 - #define IT87_REG_FAN_CTL 0x14 - #define IT87_REG_PWM(nr) (0x15 + (nr)) -+#define IT87_REG_PWM_DUTY(nr) (0x63 + (nr) * 8) - - #define IT87_REG_VIN(nr) (0x20 + (nr)) - #define IT87_REG_TEMP(nr) (0x29 + (nr)) -@@ -251,12 +252,16 @@ struct it87_data { - u8 fan_main_ctrl; /* Register value */ - u8 fan_ctl; /* Register value */ - -- /* The following 3 arrays correspond to the same registers. The -- * meaning of bits 6-0 depends on the value of bit 7, and we want -- * to preserve settings on mode changes, so we have to track all -- * values separately. */ -+ /* The following 3 arrays correspond to the same registers up to -+ * the IT8720F. The meaning of bits 6-0 depends on the value of bit -+ * 7, and we want to preserve settings on mode changes, so we have -+ * to track all values separately. -+ * Starting with the IT8721F, the manual PWM duty cycles are stored -+ * in separate registers (8-bit values), so the separate tracking -+ * is no longer needed, but it is still done to keep the driver -+ * simple. */ - u8 pwm_ctrl[3]; /* Register value */ -- u8 pwm_duty[3]; /* Manual PWM value set by user (bit 6-0) */ -+ u8 pwm_duty[3]; /* Manual PWM value set by user */ - u8 pwm_temp_map[3]; /* PWM to temp. chan. mapping (bits 1-0) */ - - /* Automatic fan speed control registers */ -@@ -832,7 +837,9 @@ static ssize_t set_pwm_enable(struct device *dev, - data->fan_main_ctrl); - } else { - if (val == 1) /* Manual mode */ -- data->pwm_ctrl[nr] = data->pwm_duty[nr]; -+ data->pwm_ctrl[nr] = data->type == it8721 ? -+ data->pwm_temp_map[nr] : -+ data->pwm_duty[nr]; - else /* Automatic mode */ - data->pwm_ctrl[nr] = 0x80 | data->pwm_temp_map[nr]; - it87_write_value(data, IT87_REG_PWM(nr), data->pwm_ctrl[nr]); -@@ -858,12 +865,25 @@ static ssize_t set_pwm(struct device *dev, struct device_attribute *attr, - return -EINVAL; - - mutex_lock(&data->update_lock); -- data->pwm_duty[nr] = pwm_to_reg(data, val); -- /* If we are in manual mode, write the duty cycle immediately; -- * otherwise, just store it for later use. */ -- if (!(data->pwm_ctrl[nr] & 0x80)) { -- data->pwm_ctrl[nr] = data->pwm_duty[nr]; -- it87_write_value(data, IT87_REG_PWM(nr), data->pwm_ctrl[nr]); -+ if (data->type == it8721) { -+ /* If we are in automatic mode, the PWM duty cycle register -+ * is read-only so we can't write the value */ -+ if (data->pwm_ctrl[nr] & 0x80) { -+ mutex_unlock(&data->update_lock); -+ return -EBUSY; -+ } -+ data->pwm_duty[nr] = pwm_to_reg(data, val); -+ it87_write_value(data, IT87_REG_PWM_DUTY(nr), -+ data->pwm_duty[nr]); -+ } else { -+ data->pwm_duty[nr] = pwm_to_reg(data, val); -+ /* If we are in manual mode, write the duty cycle immediately; -+ * otherwise, just store it for later use. */ -+ if (!(data->pwm_ctrl[nr] & 0x80)) { -+ data->pwm_ctrl[nr] = data->pwm_duty[nr]; -+ it87_write_value(data, IT87_REG_PWM(nr), -+ data->pwm_ctrl[nr]); -+ } - } - mutex_unlock(&data->update_lock); - return count; -@@ -1958,7 +1978,10 @@ static void __devinit it87_init_device(struct platform_device *pdev) - * channels to use when later setting to automatic mode later. - * Use a 1:1 mapping by default (we are clueless.) - * In both cases, the value can (and should) be changed by the user -- * prior to switching to a different mode. */ -+ * prior to switching to a different mode. -+ * Note that this is no longer needed for the IT8721F and later, as -+ * these have separate registers for the temperature mapping and the -+ * manual duty cycle. */ - for (i = 0; i < 3; i++) { - data->pwm_temp_map[i] = i; - data->pwm_duty[i] = 0x7f; /* Full speed */ -@@ -2034,10 +2057,16 @@ static void __devinit it87_init_device(struct platform_device *pdev) - static void it87_update_pwm_ctrl(struct it87_data *data, int nr) - { - data->pwm_ctrl[nr] = it87_read_value(data, IT87_REG_PWM(nr)); -- if (data->pwm_ctrl[nr] & 0x80) /* Automatic mode */ -+ if (data->type == it8721) { - data->pwm_temp_map[nr] = data->pwm_ctrl[nr] & 0x03; -- else /* Manual mode */ -- data->pwm_duty[nr] = data->pwm_ctrl[nr] & 0x7f; -+ data->pwm_duty[nr] = it87_read_value(data, -+ IT87_REG_PWM_DUTY(nr)); -+ } else { -+ if (data->pwm_ctrl[nr] & 0x80) /* Automatic mode */ -+ data->pwm_temp_map[nr] = data->pwm_ctrl[nr] & 0x03; -+ else /* Manual mode */ -+ data->pwm_duty[nr] = data->pwm_ctrl[nr] & 0x7f; -+ } - - if (has_old_autopwm(data)) { - int i; -diff --git a/drivers/hwmon/ltc4215.c b/drivers/hwmon/ltc4215.c -index 00d975e..c7e6d8e 100644 ---- a/drivers/hwmon/ltc4215.c -+++ b/drivers/hwmon/ltc4215.c -@@ -205,7 +205,6 @@ LTC4215_ALARM(curr1_max_alarm, (1 << 2), LTC4215_STATUS); - - /* Power (virtual) */ - LTC4215_POWER(power1_input); --LTC4215_ALARM(power1_alarm, (1 << 3), LTC4215_STATUS); - - /* Input Voltage */ - LTC4215_VOLTAGE(in1_input, LTC4215_ADIN); -@@ -214,6 +213,7 @@ LTC4215_ALARM(in1_min_alarm, (1 << 1), LTC4215_STATUS); - - /* Output Voltage */ - LTC4215_VOLTAGE(in2_input, LTC4215_SOURCE); -+LTC4215_ALARM(in2_min_alarm, (1 << 3), LTC4215_STATUS); - - /* Finally, construct an array of pointers to members of the above objects, - * as required for sysfs_create_group() -@@ -223,13 +223,13 @@ static struct attribute *ltc4215_attributes[] = { - &sensor_dev_attr_curr1_max_alarm.dev_attr.attr, - - &sensor_dev_attr_power1_input.dev_attr.attr, -- &sensor_dev_attr_power1_alarm.dev_attr.attr, - - &sensor_dev_attr_in1_input.dev_attr.attr, - &sensor_dev_attr_in1_max_alarm.dev_attr.attr, - &sensor_dev_attr_in1_min_alarm.dev_attr.attr, - - &sensor_dev_attr_in2_input.dev_attr.attr, -+ &sensor_dev_attr_in2_min_alarm.dev_attr.attr, - - NULL, - }; -diff --git a/drivers/i2c/busses/i2c-intel-mid.c b/drivers/i2c/busses/i2c-intel-mid.c -index 80f70d3..c714927 100644 ---- a/drivers/i2c/busses/i2c-intel-mid.c -+++ b/drivers/i2c/busses/i2c-intel-mid.c -@@ -999,7 +999,7 @@ static int __devinit intel_mid_i2c_probe(struct pci_dev *dev, - - /* Initialize struct members */ - snprintf(mrst->adap.name, sizeof(mrst->adap.name), -- "MRST/Medfield I2C at %lx", start); -+ "Intel MID I2C at %lx", start); - mrst->adap.owner = THIS_MODULE; - mrst->adap.algo = &intel_mid_i2c_algorithm; - mrst->adap.dev.parent = &dev->dev; -diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c -index 41665d2..c131d58 100644 ---- a/drivers/idle/intel_idle.c -+++ b/drivers/idle/intel_idle.c -@@ -273,8 +273,6 @@ static int intel_idle_probe(void) - - pr_debug(PREFIX "MWAIT substates: 0x%x\n", mwait_substates); - -- if (boot_cpu_has(X86_FEATURE_ARAT)) /* Always Reliable APIC Timer */ -- lapic_timer_reliable_states = 0xFFFFFFFF; - - if (boot_cpu_data.x86 != 6) /* family 6 */ - return -ENODEV; -@@ -286,8 +284,6 @@ static int intel_idle_probe(void) - case 0x1F: /* Core i7 and i5 Processor - Nehalem */ - case 0x2E: /* Nehalem-EX Xeon */ - case 0x2F: /* Westmere-EX Xeon */ -- lapic_timer_reliable_states = (1 << 1); /* C1 */ -- - case 0x25: /* Westmere */ - case 0x2C: /* Westmere */ - cpuidle_state_table = nehalem_cstates; -@@ -295,7 +291,6 @@ static int intel_idle_probe(void) - - case 0x1C: /* 28 - Atom Processor */ - case 0x26: /* 38 - Lincroft Atom Processor */ -- lapic_timer_reliable_states = (1 << 1); /* C1 */ - cpuidle_state_table = atom_cstates; - break; - -@@ -303,10 +298,6 @@ static int intel_idle_probe(void) - case 0x2D: /* SNB Xeon */ - cpuidle_state_table = snb_cstates; - break; --#ifdef FUTURE_USE -- case 0x17: /* 23 - Core 2 Duo */ -- lapic_timer_reliable_states = (1 << 2) | (1 << 1); /* C2, C1 */ --#endif - - default: - pr_debug(PREFIX "does not run on family %d model %d\n", -@@ -314,6 +305,9 @@ static int intel_idle_probe(void) - return -ENODEV; - } - -+ if (boot_cpu_has(X86_FEATURE_ARAT)) /* Always Reliable APIC Timer */ -+ lapic_timer_reliable_states = 0xFFFFFFFF; -+ - pr_debug(PREFIX "v" INTEL_IDLE_VERSION - " model 0x%X\n", boot_cpu_data.x86_model); - -diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c -index b342248..c426992 100644 ---- a/drivers/infiniband/core/uverbs_cmd.c -+++ b/drivers/infiniband/core/uverbs_cmd.c -@@ -893,68 +893,81 @@ out: - return ret ? ret : in_len; - } - -+static int copy_wc_to_user(void __user *dest, struct ib_wc *wc) -+{ -+ struct ib_uverbs_wc tmp; -+ -+ tmp.wr_id = wc->wr_id; -+ tmp.status = wc->status; -+ tmp.opcode = wc->opcode; -+ tmp.vendor_err = wc->vendor_err; -+ tmp.byte_len = wc->byte_len; -+ tmp.ex.imm_data = (__u32 __force) wc->ex.imm_data; -+ tmp.qp_num = wc->qp->qp_num; -+ tmp.src_qp = wc->src_qp; -+ tmp.wc_flags = wc->wc_flags; -+ tmp.pkey_index = wc->pkey_index; -+ tmp.slid = wc->slid; -+ tmp.sl = wc->sl; -+ tmp.dlid_path_bits = wc->dlid_path_bits; -+ tmp.port_num = wc->port_num; -+ tmp.reserved = 0; -+ -+ if (copy_to_user(dest, &tmp, sizeof tmp)) -+ return -EFAULT; -+ -+ return 0; -+} -+ - ssize_t ib_uverbs_poll_cq(struct ib_uverbs_file *file, - const char __user *buf, int in_len, - int out_len) - { - struct ib_uverbs_poll_cq cmd; -- struct ib_uverbs_poll_cq_resp *resp; -+ struct ib_uverbs_poll_cq_resp resp; -+ u8 __user *header_ptr; -+ u8 __user *data_ptr; - struct ib_cq *cq; -- struct ib_wc *wc; -- int ret = 0; -- int i; -- int rsize; -+ struct ib_wc wc; -+ int ret; - - if (copy_from_user(&cmd, buf, sizeof cmd)) - return -EFAULT; - -- wc = kmalloc(cmd.ne * sizeof *wc, GFP_KERNEL); -- if (!wc) -- return -ENOMEM; -- -- rsize = sizeof *resp + cmd.ne * sizeof(struct ib_uverbs_wc); -- resp = kmalloc(rsize, GFP_KERNEL); -- if (!resp) { -- ret = -ENOMEM; -- goto out_wc; -- } -- - cq = idr_read_cq(cmd.cq_handle, file->ucontext, 0); -- if (!cq) { -- ret = -EINVAL; -- goto out; -- } -+ if (!cq) -+ return -EINVAL; - -- resp->count = ib_poll_cq(cq, cmd.ne, wc); -+ /* we copy a struct ib_uverbs_poll_cq_resp to user space */ -+ header_ptr = (void __user *)(unsigned long) cmd.response; -+ data_ptr = header_ptr + sizeof resp; - -- put_cq_read(cq); -+ memset(&resp, 0, sizeof resp); -+ while (resp.count < cmd.ne) { -+ ret = ib_poll_cq(cq, 1, &wc); -+ if (ret < 0) -+ goto out_put; -+ if (!ret) -+ break; -+ -+ ret = copy_wc_to_user(data_ptr, &wc); -+ if (ret) -+ goto out_put; - -- for (i = 0; i < resp->count; i++) { -- resp->wc[i].wr_id = wc[i].wr_id; -- resp->wc[i].status = wc[i].status; -- resp->wc[i].opcode = wc[i].opcode; -- resp->wc[i].vendor_err = wc[i].vendor_err; -- resp->wc[i].byte_len = wc[i].byte_len; -- resp->wc[i].ex.imm_data = (__u32 __force) wc[i].ex.imm_data; -- resp->wc[i].qp_num = wc[i].qp->qp_num; -- resp->wc[i].src_qp = wc[i].src_qp; -- resp->wc[i].wc_flags = wc[i].wc_flags; -- resp->wc[i].pkey_index = wc[i].pkey_index; -- resp->wc[i].slid = wc[i].slid; -- resp->wc[i].sl = wc[i].sl; -- resp->wc[i].dlid_path_bits = wc[i].dlid_path_bits; -- resp->wc[i].port_num = wc[i].port_num; -+ data_ptr += sizeof(struct ib_uverbs_wc); -+ ++resp.count; - } - -- if (copy_to_user((void __user *) (unsigned long) cmd.response, resp, rsize)) -+ if (copy_to_user(header_ptr, &resp, sizeof resp)) { - ret = -EFAULT; -+ goto out_put; -+ } - --out: -- kfree(resp); -+ ret = in_len; - --out_wc: -- kfree(wc); -- return ret ? ret : in_len; -+out_put: -+ put_cq_read(cq); -+ return ret; - } - - ssize_t ib_uverbs_req_notify_cq(struct ib_uverbs_file *file, -diff --git a/drivers/input/joystick/turbografx.c b/drivers/input/joystick/turbografx.c -index d53b9e9..27b6a3c 100644 ---- a/drivers/input/joystick/turbografx.c -+++ b/drivers/input/joystick/turbografx.c -@@ -245,6 +245,7 @@ static struct tgfx __init *tgfx_probe(int parport, int *n_buttons, int n_devs) - goto err_free_tgfx; - } - -+ parport_put_port(pp); - return tgfx; - - err_free_dev: -diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig -index b8c51b9..3a87f3b 100644 ---- a/drivers/input/keyboard/Kconfig -+++ b/drivers/input/keyboard/Kconfig -@@ -179,6 +179,22 @@ config KEYBOARD_GPIO - To compile this driver as a module, choose M here: the - module will be called gpio_keys. - -+config KEYBOARD_GPIO_POLLED -+ tristate "Polled GPIO buttons" -+ depends on GENERIC_GPIO -+ select INPUT_POLLDEV -+ help -+ This driver implements support for buttons connected -+ to GPIO pins that are not capable of generating interrupts. -+ -+ Say Y here if your device has buttons connected -+ directly to such GPIO pins. Your board-specific -+ setup logic must also provide a platform device, -+ with configuration data saying which GPIOs are used. -+ -+ To compile this driver as a module, choose M here: the -+ module will be called gpio_keys_polled. -+ - config KEYBOARD_TCA6416 - tristate "TCA6416 Keypad Support" - depends on I2C -diff --git a/drivers/input/keyboard/Makefile b/drivers/input/keyboard/Makefile -index a34452e..622de73 100644 ---- a/drivers/input/keyboard/Makefile -+++ b/drivers/input/keyboard/Makefile -@@ -14,6 +14,7 @@ obj-$(CONFIG_KEYBOARD_BFIN) += bf54x-keys.o - obj-$(CONFIG_KEYBOARD_DAVINCI) += davinci_keyscan.o - obj-$(CONFIG_KEYBOARD_EP93XX) += ep93xx_keypad.o - obj-$(CONFIG_KEYBOARD_GPIO) += gpio_keys.o -+obj-$(CONFIG_KEYBOARD_GPIO_POLLED) += gpio_keys_polled.o - obj-$(CONFIG_KEYBOARD_TCA6416) += tca6416-keypad.o - obj-$(CONFIG_KEYBOARD_HIL) += hil_kbd.o - obj-$(CONFIG_KEYBOARD_HIL_OLD) += hilkbd.o -diff --git a/drivers/input/keyboard/gpio_keys_polled.c b/drivers/input/keyboard/gpio_keys_polled.c -new file mode 100644 -index 0000000..4c17aff ---- /dev/null -+++ b/drivers/input/keyboard/gpio_keys_polled.c -@@ -0,0 +1,261 @@ -+/* -+ * Driver for buttons on GPIO lines not capable of generating interrupts -+ * -+ * Copyright (C) 2007-2010 Gabor Juhos -+ * Copyright (C) 2010 Nuno Goncalves -+ * -+ * This file was based on: /drivers/input/misc/cobalt_btns.c -+ * Copyright (C) 2007 Yoichi Yuasa -+ * -+ * also was based on: /drivers/input/keyboard/gpio_keys.c -+ * Copyright 2005 Phil Blundell -+ * -+ * 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 -+ -+#define DRV_NAME "gpio-keys-polled" -+ -+struct gpio_keys_button_data { -+ int last_state; -+ int count; -+ int threshold; -+ int can_sleep; -+}; -+ -+struct gpio_keys_polled_dev { -+ struct input_polled_dev *poll_dev; -+ struct device *dev; -+ struct gpio_keys_platform_data *pdata; -+ struct gpio_keys_button_data data[0]; -+}; -+ -+static void gpio_keys_polled_check_state(struct input_dev *input, -+ struct gpio_keys_button *button, -+ struct gpio_keys_button_data *bdata) -+{ -+ int state; -+ -+ if (bdata->can_sleep) -+ state = !!gpio_get_value_cansleep(button->gpio); -+ else -+ state = !!gpio_get_value(button->gpio); -+ -+ if (state != bdata->last_state) { -+ unsigned int type = button->type ?: EV_KEY; -+ -+ input_event(input, type, button->code, -+ !!(state ^ button->active_low)); -+ input_sync(input); -+ bdata->count = 0; -+ bdata->last_state = state; -+ } -+} -+ -+static void gpio_keys_polled_poll(struct input_polled_dev *dev) -+{ -+ struct gpio_keys_polled_dev *bdev = dev->private; -+ struct gpio_keys_platform_data *pdata = bdev->pdata; -+ struct input_dev *input = dev->input; -+ int i; -+ -+ for (i = 0; i < bdev->pdata->nbuttons; i++) { -+ struct gpio_keys_button_data *bdata = &bdev->data[i]; -+ -+ if (bdata->count < bdata->threshold) -+ bdata->count++; -+ else -+ gpio_keys_polled_check_state(input, &pdata->buttons[i], -+ bdata); -+ } -+} -+ -+static void gpio_keys_polled_open(struct input_polled_dev *dev) -+{ -+ struct gpio_keys_polled_dev *bdev = dev->private; -+ struct gpio_keys_platform_data *pdata = bdev->pdata; -+ -+ if (pdata->enable) -+ pdata->enable(bdev->dev); -+} -+ -+static void gpio_keys_polled_close(struct input_polled_dev *dev) -+{ -+ struct gpio_keys_polled_dev *bdev = dev->private; -+ struct gpio_keys_platform_data *pdata = bdev->pdata; -+ -+ if (pdata->disable) -+ pdata->disable(bdev->dev); -+} -+ -+static int __devinit gpio_keys_polled_probe(struct platform_device *pdev) -+{ -+ struct gpio_keys_platform_data *pdata = pdev->dev.platform_data; -+ struct device *dev = &pdev->dev; -+ struct gpio_keys_polled_dev *bdev; -+ struct input_polled_dev *poll_dev; -+ struct input_dev *input; -+ int error; -+ int i; -+ -+ if (!pdata || !pdata->poll_interval) -+ return -EINVAL; -+ -+ bdev = kzalloc(sizeof(struct gpio_keys_polled_dev) + -+ pdata->nbuttons * sizeof(struct gpio_keys_button_data), -+ GFP_KERNEL); -+ if (!bdev) { -+ dev_err(dev, "no memory for private data\n"); -+ return -ENOMEM; -+ } -+ -+ poll_dev = input_allocate_polled_device(); -+ if (!poll_dev) { -+ dev_err(dev, "no memory for polled device\n"); -+ error = -ENOMEM; -+ goto err_free_bdev; -+ } -+ -+ poll_dev->private = bdev; -+ poll_dev->poll = gpio_keys_polled_poll; -+ poll_dev->poll_interval = pdata->poll_interval; -+ poll_dev->open = gpio_keys_polled_open; -+ poll_dev->close = gpio_keys_polled_close; -+ -+ input = poll_dev->input; -+ -+ input->evbit[0] = BIT(EV_KEY); -+ input->name = pdev->name; -+ input->phys = DRV_NAME"/input0"; -+ input->dev.parent = &pdev->dev; -+ -+ input->id.bustype = BUS_HOST; -+ input->id.vendor = 0x0001; -+ input->id.product = 0x0001; -+ input->id.version = 0x0100; -+ -+ for (i = 0; i < pdata->nbuttons; i++) { -+ struct gpio_keys_button *button = &pdata->buttons[i]; -+ struct gpio_keys_button_data *bdata = &bdev->data[i]; -+ unsigned int gpio = button->gpio; -+ unsigned int type = button->type ?: EV_KEY; -+ -+ if (button->wakeup) { -+ dev_err(dev, DRV_NAME " does not support wakeup\n"); -+ error = -EINVAL; -+ goto err_free_gpio; -+ } -+ -+ error = gpio_request(gpio, -+ button->desc ? button->desc : DRV_NAME); -+ if (error) { -+ dev_err(dev, "unable to claim gpio %u, err=%d\n", -+ gpio, error); -+ goto err_free_gpio; -+ } -+ -+ error = gpio_direction_input(gpio); -+ if (error) { -+ dev_err(dev, -+ "unable to set direction on gpio %u, err=%d\n", -+ gpio, error); -+ goto err_free_gpio; -+ } -+ -+ bdata->can_sleep = gpio_cansleep(gpio); -+ bdata->last_state = -1; -+ bdata->threshold = DIV_ROUND_UP(button->debounce_interval, -+ pdata->poll_interval); -+ -+ input_set_capability(input, type, button->code); -+ } -+ -+ bdev->poll_dev = poll_dev; -+ bdev->dev = dev; -+ bdev->pdata = pdata; -+ platform_set_drvdata(pdev, bdev); -+ -+ error = input_register_polled_device(poll_dev); -+ if (error) { -+ dev_err(dev, "unable to register polled device, err=%d\n", -+ error); -+ goto err_free_gpio; -+ } -+ -+ /* report initial state of the buttons */ -+ for (i = 0; i < pdata->nbuttons; i++) -+ gpio_keys_polled_check_state(input, &pdata->buttons[i], -+ &bdev->data[i]); -+ -+ return 0; -+ -+err_free_gpio: -+ while (--i >= 0) -+ gpio_free(pdata->buttons[i].gpio); -+ -+ input_free_polled_device(poll_dev); -+ -+err_free_bdev: -+ kfree(bdev); -+ -+ platform_set_drvdata(pdev, NULL); -+ return error; -+} -+ -+static int __devexit gpio_keys_polled_remove(struct platform_device *pdev) -+{ -+ struct gpio_keys_polled_dev *bdev = platform_get_drvdata(pdev); -+ struct gpio_keys_platform_data *pdata = bdev->pdata; -+ int i; -+ -+ input_unregister_polled_device(bdev->poll_dev); -+ -+ for (i = 0; i < pdata->nbuttons; i++) -+ gpio_free(pdata->buttons[i].gpio); -+ -+ input_free_polled_device(bdev->poll_dev); -+ -+ kfree(bdev); -+ platform_set_drvdata(pdev, NULL); -+ -+ return 0; -+} -+ -+static struct platform_driver gpio_keys_polled_driver = { -+ .probe = gpio_keys_polled_probe, -+ .remove = __devexit_p(gpio_keys_polled_remove), -+ .driver = { -+ .name = DRV_NAME, -+ .owner = THIS_MODULE, -+ }, -+}; -+ -+static int __init gpio_keys_polled_init(void) -+{ -+ return platform_driver_register(&gpio_keys_polled_driver); -+} -+ -+static void __exit gpio_keys_polled_exit(void) -+{ -+ platform_driver_unregister(&gpio_keys_polled_driver); -+} -+ -+module_init(gpio_keys_polled_init); -+module_exit(gpio_keys_polled_exit); -+ -+MODULE_LICENSE("GPL v2"); -+MODULE_AUTHOR("Gabor Juhos "); -+MODULE_DESCRIPTION("Polled GPIO Buttons driver"); -+MODULE_ALIAS("platform:" DRV_NAME); -diff --git a/drivers/input/mouse/synaptics.h b/drivers/input/mouse/synaptics.h -index 613a365..0aefaa8 100644 ---- a/drivers/input/mouse/synaptics.h -+++ b/drivers/input/mouse/synaptics.h -@@ -51,7 +51,8 @@ - #define SYN_EXT_CAP_REQUESTS(c) (((c) & 0x700000) >> 20) - #define SYN_CAP_MULTI_BUTTON_NO(ec) (((ec) & 0x00f000) >> 12) - #define SYN_CAP_PRODUCT_ID(ec) (((ec) & 0xff0000) >> 16) --#define SYN_CAP_CLICKPAD(ex0c) ((ex0c) & 0x100100) -+#define SYN_CAP_CLICKPAD(ex0c) ((ex0c) & 0x100000) /* 1-button ClickPad */ -+#define SYN_CAP_CLICKPAD2BTN(ex0c) ((ex0c) & 0x000100) /* 2-button ClickPad */ - #define SYN_CAP_MAX_DIMENSIONS(ex0c) ((ex0c) & 0x020000) - - /* synaptics modes query bits */ -diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c -index b3252ef..4852b44 100644 ---- a/drivers/input/tablet/wacom_wac.c -+++ b/drivers/input/tablet/wacom_wac.c -@@ -1436,6 +1436,12 @@ static struct wacom_features wacom_features_0xD2 = - { "Wacom Bamboo Craft", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 63, BAMBOO_PT }; - static struct wacom_features wacom_features_0xD3 = - { "Wacom Bamboo 2FG 6x8", WACOM_PKGLEN_BBFUN, 21648, 13530, 1023, 63, BAMBOO_PT }; -+static struct wacom_features wacom_features_0xD8 = -+ { "Wacom Bamboo Comic 2FG", WACOM_PKGLEN_BBFUN, 21648, 13530, 1023, 63, BAMBOO_PT }; -+static struct wacom_features wacom_features_0xDA = -+ { "Wacom Bamboo 2FG 4x5 SE", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, 63, BAMBOO_PT }; -+static struct wacom_features wacom_features_0xDB = -+ { "Wacom Bamboo 2FG 6x8 SE", WACOM_PKGLEN_BBFUN, 21648, 13530, 1023, 63, BAMBOO_PT }; - - #define USB_DEVICE_WACOM(prod) \ - USB_DEVICE(USB_VENDOR_ID_WACOM, prod), \ -@@ -1504,6 +1510,9 @@ const struct usb_device_id wacom_ids[] = { - { USB_DEVICE_WACOM(0xD1) }, - { USB_DEVICE_WACOM(0xD2) }, - { USB_DEVICE_WACOM(0xD3) }, -+ { USB_DEVICE_WACOM(0xD8) }, -+ { USB_DEVICE_WACOM(0xDA) }, -+ { USB_DEVICE_WACOM(0xDB) }, - { USB_DEVICE_WACOM(0xF0) }, - { USB_DEVICE_WACOM(0xCC) }, - { USB_DEVICE_WACOM(0x90) }, -diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c -index f45f80f..73fd664 100644 ---- a/drivers/input/touchscreen/usbtouchscreen.c -+++ b/drivers/input/touchscreen/usbtouchscreen.c -@@ -178,6 +178,7 @@ static const struct usb_device_id usbtouch_devices[] = { - - #ifdef CONFIG_TOUCHSCREEN_USB_ITM - {USB_DEVICE(0x0403, 0xf9e9), .driver_info = DEVTYPE_ITM}, -+ {USB_DEVICE(0x16e3, 0xf9e9), .driver_info = DEVTYPE_ITM}, - #endif - - #ifdef CONFIG_TOUCHSCREEN_USB_ETURBO -diff --git a/drivers/md/md.c b/drivers/md/md.c -index 84c46a1..e71c5fa 100644 ---- a/drivers/md/md.c -+++ b/drivers/md/md.c -@@ -371,10 +371,15 @@ static void md_end_flush(struct bio *bio, int err) - bio_put(bio); - } - --static void submit_flushes(mddev_t *mddev) -+static void md_submit_flush_data(struct work_struct *ws); -+ -+static void submit_flushes(struct work_struct *ws) - { -+ mddev_t *mddev = container_of(ws, mddev_t, flush_work); - mdk_rdev_t *rdev; - -+ INIT_WORK(&mddev->flush_work, md_submit_flush_data); -+ atomic_set(&mddev->flush_pending, 1); - rcu_read_lock(); - list_for_each_entry_rcu(rdev, &mddev->disks, same_set) - if (rdev->raid_disk >= 0 && -@@ -397,6 +402,8 @@ static void submit_flushes(mddev_t *mddev) - rdev_dec_pending(rdev, mddev); - } - rcu_read_unlock(); -+ if (atomic_dec_and_test(&mddev->flush_pending)) -+ queue_work(md_wq, &mddev->flush_work); - } - - static void md_submit_flush_data(struct work_struct *ws) -@@ -404,8 +411,6 @@ static void md_submit_flush_data(struct work_struct *ws) - mddev_t *mddev = container_of(ws, mddev_t, flush_work); - struct bio *bio = mddev->flush_bio; - -- atomic_set(&mddev->flush_pending, 1); -- - if (bio->bi_size == 0) - /* an empty barrier - all done */ - bio_endio(bio, 0); -@@ -414,10 +419,9 @@ static void md_submit_flush_data(struct work_struct *ws) - if (mddev->pers->make_request(mddev, bio)) - generic_make_request(bio); - } -- if (atomic_dec_and_test(&mddev->flush_pending)) { -- mddev->flush_bio = NULL; -- wake_up(&mddev->sb_wait); -- } -+ -+ mddev->flush_bio = NULL; -+ wake_up(&mddev->sb_wait); - } - - void md_flush_request(mddev_t *mddev, struct bio *bio) -@@ -429,13 +433,8 @@ void md_flush_request(mddev_t *mddev, struct bio *bio) - mddev->flush_bio = bio; - spin_unlock_irq(&mddev->write_lock); - -- atomic_set(&mddev->flush_pending, 1); -- INIT_WORK(&mddev->flush_work, md_submit_flush_data); -- -- submit_flushes(mddev); -- -- if (atomic_dec_and_test(&mddev->flush_pending)) -- queue_work(md_wq, &mddev->flush_work); -+ INIT_WORK(&mddev->flush_work, submit_flushes); -+ queue_work(md_wq, &mddev->flush_work); - } - EXPORT_SYMBOL(md_flush_request); - -@@ -5160,7 +5159,7 @@ static int add_new_disk(mddev_t * mddev, mdu_disk_info_t *info) - PTR_ERR(rdev)); - return PTR_ERR(rdev); - } -- /* set save_raid_disk if appropriate */ -+ /* set saved_raid_disk if appropriate */ - if (!mddev->persistent) { - if (info->state & (1<raid_disk < mddev->raid_disks) -@@ -5170,7 +5169,10 @@ static int add_new_disk(mddev_t * mddev, mdu_disk_info_t *info) - } else - super_types[mddev->major_version]. - validate_super(mddev, rdev); -- rdev->saved_raid_disk = rdev->raid_disk; -+ if (test_bit(In_sync, &rdev->flags)) -+ rdev->saved_raid_disk = rdev->raid_disk; -+ else -+ rdev->saved_raid_disk = -1; - - clear_bit(In_sync, &rdev->flags); /* just to be sure */ - if (info->state & (1<timeout); - -- clear_bit(THREAD_WAKEUP, &thread->flags); -- -- thread->run(thread->mddev); -+ if (test_and_clear_bit(THREAD_WAKEUP, &thread->flags)) -+ thread->run(thread->mddev); - } - - return 0; -diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c -index c67aa54..0641674 100644 ---- a/drivers/md/raid10.c -+++ b/drivers/md/raid10.c -@@ -2397,13 +2397,13 @@ static int run(mddev_t *mddev) - return 0; - - out_free_conf: -+ md_unregister_thread(mddev->thread); - if (conf->r10bio_pool) - mempool_destroy(conf->r10bio_pool); - safe_put_page(conf->tmppage); - kfree(conf->mirrors); - kfree(conf); - mddev->private = NULL; -- md_unregister_thread(mddev->thread); - out: - return -EIO; - } -diff --git a/drivers/mtd/maps/pxa2xx-flash.c b/drivers/mtd/maps/pxa2xx-flash.c -index dd90880..d8ae634 100644 ---- a/drivers/mtd/maps/pxa2xx-flash.c -+++ b/drivers/mtd/maps/pxa2xx-flash.c -@@ -51,7 +51,7 @@ struct pxa2xx_flash_info { - static const char *probes[] = { "RedBoot", "cmdlinepart", NULL }; - - --static int __init pxa2xx_flash_probe(struct platform_device *pdev) -+static int __devinit pxa2xx_flash_probe(struct platform_device *pdev) - { - struct flash_platform_data *flash = pdev->dev.platform_data; - struct pxa2xx_flash_info *info; -diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c -index cd41c58..15682ec 100644 ---- a/drivers/mtd/nand/omap2.c -+++ b/drivers/mtd/nand/omap2.c -@@ -7,7 +7,6 @@ - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ --#define CONFIG_MTD_NAND_OMAP_HWECC - - #include - #include -diff --git a/drivers/net/b44.c b/drivers/net/b44.c -index c6e8631..2e2b762 100644 ---- a/drivers/net/b44.c -+++ b/drivers/net/b44.c -@@ -381,11 +381,11 @@ static void b44_set_flow_ctrl(struct b44 *bp, u32 local, u32 remote) - __b44_set_flow_ctrl(bp, pause_enab); - } - --#ifdef SSB_DRIVER_MIPS --extern char *nvram_get(char *name); -+#ifdef CONFIG_BCM47XX -+#include - static void b44_wap54g10_workaround(struct b44 *bp) - { -- const char *str; -+ char buf[20]; - u32 val; - int err; - -@@ -394,10 +394,9 @@ static void b44_wap54g10_workaround(struct b44 *bp) - * see https://dev.openwrt.org/ticket/146 - * check and reset bit "isolate" - */ -- str = nvram_get("boardnum"); -- if (!str) -+ if (nvram_getenv("boardnum", buf, sizeof(buf)) < 0) - return; -- if (simple_strtoul(str, NULL, 0) == 2) { -+ if (simple_strtoul(buf, NULL, 0) == 2) { - err = __b44_readphy(bp, 0, MII_BMCR, &val); - if (err) - goto error; -diff --git a/drivers/net/benet/be_cmds.c b/drivers/net/benet/be_cmds.c -index 36eca1c..e4465d2 100644 ---- a/drivers/net/benet/be_cmds.c -+++ b/drivers/net/benet/be_cmds.c -@@ -1235,7 +1235,7 @@ int be_cmd_multicast_set(struct be_adapter *adapter, u32 if_id, - - i = 0; - netdev_for_each_mc_addr(ha, netdev) -- memcpy(req->mac[i].byte, ha->addr, ETH_ALEN); -+ memcpy(req->mac[i++].byte, ha->addr, ETH_ALEN); - } else { - req->promiscuous = 1; - } -diff --git a/drivers/net/bnx2x/bnx2x.h b/drivers/net/bnx2x/bnx2x.h -index 863e73a..d255428 100644 ---- a/drivers/net/bnx2x/bnx2x.h -+++ b/drivers/net/bnx2x/bnx2x.h -@@ -20,8 +20,8 @@ - * (you will need to reboot afterwards) */ - /* #define BNX2X_STOP_ON_ERROR */ - --#define DRV_MODULE_VERSION "1.60.00-4" --#define DRV_MODULE_RELDATE "2010/11/01" -+#define DRV_MODULE_VERSION "1.60.01-0" -+#define DRV_MODULE_RELDATE "2010/11/12" - #define BNX2X_BC_VER 0x040200 - - #define BNX2X_MULTI_QUEUE -diff --git a/drivers/net/bnx2x/bnx2x_cmn.c b/drivers/net/bnx2x/bnx2x_cmn.c -index 94d5f59..0af361e 100644 ---- a/drivers/net/bnx2x/bnx2x_cmn.c -+++ b/drivers/net/bnx2x/bnx2x_cmn.c -@@ -1782,15 +1782,15 @@ exit_lbl: - } - #endif - --static inline void bnx2x_set_pbd_gso_e2(struct sk_buff *skb, -- struct eth_tx_parse_bd_e2 *pbd, -- u32 xmit_type) -+static inline void bnx2x_set_pbd_gso_e2(struct sk_buff *skb, u32 *parsing_data, -+ u32 xmit_type) - { -- pbd->parsing_data |= cpu_to_le16(skb_shinfo(skb)->gso_size) << -- ETH_TX_PARSE_BD_E2_LSO_MSS_SHIFT; -+ *parsing_data |= (skb_shinfo(skb)->gso_size << -+ ETH_TX_PARSE_BD_E2_LSO_MSS_SHIFT) & -+ ETH_TX_PARSE_BD_E2_LSO_MSS; - if ((xmit_type & XMIT_GSO_V6) && - (ipv6_hdr(skb)->nexthdr == NEXTHDR_IPV6)) -- pbd->parsing_data |= ETH_TX_PARSE_BD_E2_IPV6_WITH_EXT_HDR; -+ *parsing_data |= ETH_TX_PARSE_BD_E2_IPV6_WITH_EXT_HDR; - } - - /** -@@ -1835,15 +1835,15 @@ static inline void bnx2x_set_pbd_gso(struct sk_buff *skb, - * @return header len - */ - static inline u8 bnx2x_set_pbd_csum_e2(struct bnx2x *bp, struct sk_buff *skb, -- struct eth_tx_parse_bd_e2 *pbd, -- u32 xmit_type) -+ u32 *parsing_data, u32 xmit_type) - { -- pbd->parsing_data |= cpu_to_le16(tcp_hdrlen(skb)/4) << -- ETH_TX_PARSE_BD_E2_TCP_HDR_LENGTH_DW_SHIFT; -+ *parsing_data |= ((tcp_hdrlen(skb)/4) << -+ ETH_TX_PARSE_BD_E2_TCP_HDR_LENGTH_DW_SHIFT) & -+ ETH_TX_PARSE_BD_E2_TCP_HDR_LENGTH_DW; - -- pbd->parsing_data |= cpu_to_le16(((unsigned char *)tcp_hdr(skb) - -- skb->data) / 2) << -- ETH_TX_PARSE_BD_E2_TCP_HDR_START_OFFSET_W_SHIFT; -+ *parsing_data |= ((((u8 *)tcp_hdr(skb) - skb->data) / 2) << -+ ETH_TX_PARSE_BD_E2_TCP_HDR_START_OFFSET_W_SHIFT) & -+ ETH_TX_PARSE_BD_E2_TCP_HDR_START_OFFSET_W; - - return skb_transport_header(skb) + tcp_hdrlen(skb) - skb->data; - } -@@ -1912,6 +1912,7 @@ netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev) - struct eth_tx_bd *tx_data_bd, *total_pkt_bd = NULL; - struct eth_tx_parse_bd_e1x *pbd_e1x = NULL; - struct eth_tx_parse_bd_e2 *pbd_e2 = NULL; -+ u32 pbd_e2_parsing_data = 0; - u16 pkt_prod, bd_prod; - int nbd, fp_index; - dma_addr_t mapping; -@@ -2033,8 +2034,9 @@ netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev) - memset(pbd_e2, 0, sizeof(struct eth_tx_parse_bd_e2)); - /* Set PBD in checksum offload case */ - if (xmit_type & XMIT_CSUM) -- hlen = bnx2x_set_pbd_csum_e2(bp, -- skb, pbd_e2, xmit_type); -+ hlen = bnx2x_set_pbd_csum_e2(bp, skb, -+ &pbd_e2_parsing_data, -+ xmit_type); - } else { - pbd_e1x = &fp->tx_desc_ring[bd_prod].parse_bd_e1x; - memset(pbd_e1x, 0, sizeof(struct eth_tx_parse_bd_e1x)); -@@ -2076,10 +2078,18 @@ netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev) - bd_prod = bnx2x_tx_split(bp, fp, tx_buf, &tx_start_bd, - hlen, bd_prod, ++nbd); - if (CHIP_IS_E2(bp)) -- bnx2x_set_pbd_gso_e2(skb, pbd_e2, xmit_type); -+ bnx2x_set_pbd_gso_e2(skb, &pbd_e2_parsing_data, -+ xmit_type); - else - bnx2x_set_pbd_gso(skb, pbd_e1x, xmit_type); - } -+ -+ /* Set the PBD's parsing_data field if not zero -+ * (for the chips newer than 57711). -+ */ -+ if (pbd_e2_parsing_data) -+ pbd_e2->parsing_data = cpu_to_le32(pbd_e2_parsing_data); -+ - tx_data_bd = (struct eth_tx_bd *)tx_start_bd; - - /* Handle fragmented skb */ -diff --git a/drivers/net/bnx2x/bnx2x_init_ops.h b/drivers/net/bnx2x/bnx2x_init_ops.h -index a306b0e..66df29f 100644 ---- a/drivers/net/bnx2x/bnx2x_init_ops.h -+++ b/drivers/net/bnx2x/bnx2x_init_ops.h -@@ -838,7 +838,7 @@ static void bnx2x_qm_init_ptr_table(struct bnx2x *bp, int qm_cid_count, - /**************************************************************************** - * SRC initializations - ****************************************************************************/ -- -+#ifdef BCM_CNIC - /* called during init func stage */ - static void bnx2x_src_init_t2(struct bnx2x *bp, struct src_ent *t2, - dma_addr_t t2_mapping, int src_cid_count) -@@ -862,5 +862,5 @@ static void bnx2x_src_init_t2(struct bnx2x *bp, struct src_ent *t2, - U64_HI((u64)t2_mapping + - (src_cid_count-1) * sizeof(struct src_ent))); - } -- -+#endif - #endif /* BNX2X_INIT_OPS_H */ -diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c -index 71a1697..d0ea760 100644 ---- a/drivers/net/bonding/bond_main.c -+++ b/drivers/net/bonding/bond_main.c -@@ -171,7 +171,7 @@ MODULE_PARM_DESC(resend_igmp, "Number of IGMP membership reports to send on link - /*----------------------------- Global variables ----------------------------*/ - - #ifdef CONFIG_NET_POLL_CONTROLLER --cpumask_var_t netpoll_block_tx; -+atomic_t netpoll_block_tx = ATOMIC_INIT(0); - #endif - - static const char * const version = -@@ -1576,7 +1576,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) - - /* If this is the first slave, then we need to set the master's hardware - * address to be the same as the slave's. */ -- if (bond->slave_cnt == 0) -+ if (is_zero_ether_addr(bond->dev->dev_addr)) - memcpy(bond->dev->dev_addr, slave_dev->dev_addr, - slave_dev->addr_len); - -@@ -5299,13 +5299,6 @@ static int __init bonding_init(void) - if (res) - goto out; - --#ifdef CONFIG_NET_POLL_CONTROLLER -- if (!alloc_cpumask_var(&netpoll_block_tx, GFP_KERNEL)) { -- res = -ENOMEM; -- goto out; -- } --#endif -- - res = register_pernet_subsys(&bond_net_ops); - if (res) - goto out; -@@ -5334,9 +5327,6 @@ err: - rtnl_link_unregister(&bond_link_ops); - err_link: - unregister_pernet_subsys(&bond_net_ops); --#ifdef CONFIG_NET_POLL_CONTROLLER -- free_cpumask_var(netpoll_block_tx); --#endif - goto out; - - } -@@ -5353,7 +5343,10 @@ static void __exit bonding_exit(void) - unregister_pernet_subsys(&bond_net_ops); - - #ifdef CONFIG_NET_POLL_CONTROLLER -- free_cpumask_var(netpoll_block_tx); -+ /* -+ * Make sure we don't have an imbalance on our netpoll blocking -+ */ -+ WARN_ON(atomic_read(&netpoll_block_tx)); - #endif - } - -diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h -index 4eedb12..c2f0813 100644 ---- a/drivers/net/bonding/bonding.h -+++ b/drivers/net/bonding/bonding.h -@@ -119,26 +119,22 @@ - - - #ifdef CONFIG_NET_POLL_CONTROLLER --extern cpumask_var_t netpoll_block_tx; -+extern atomic_t netpoll_block_tx; - - static inline void block_netpoll_tx(void) - { -- preempt_disable(); -- BUG_ON(cpumask_test_and_set_cpu(smp_processor_id(), -- netpoll_block_tx)); -+ atomic_inc(&netpoll_block_tx); - } - - static inline void unblock_netpoll_tx(void) - { -- BUG_ON(!cpumask_test_and_clear_cpu(smp_processor_id(), -- netpoll_block_tx)); -- preempt_enable(); -+ atomic_dec(&netpoll_block_tx); - } - - static inline int is_netpoll_tx_blocked(struct net_device *dev) - { - if (unlikely(dev->priv_flags & IFF_IN_NETPOLL)) -- return cpumask_test_cpu(smp_processor_id(), netpoll_block_tx); -+ return atomic_read(&netpoll_block_tx); - return 0; - } - #else -diff --git a/drivers/net/caif/caif_shm_u5500.c b/drivers/net/caif/caif_shm_u5500.c -index 1cd90da..32b1c6f 100644 ---- a/drivers/net/caif/caif_shm_u5500.c -+++ b/drivers/net/caif/caif_shm_u5500.c -@@ -5,7 +5,7 @@ - * License terms: GNU General Public License (GPL) version 2 - */ - --#define pr_fmt(fmt) KBUILD_MODNAME ":" __func__ "():" fmt -+#define pr_fmt(fmt) KBUILD_MODNAME ":" fmt - - #include - #include -diff --git a/drivers/net/caif/caif_shmcore.c b/drivers/net/caif/caif_shmcore.c -index 19f9c06..8051116 100644 ---- a/drivers/net/caif/caif_shmcore.c -+++ b/drivers/net/caif/caif_shmcore.c -@@ -6,7 +6,7 @@ - * License terms: GNU General Public License (GPL) version 2 - */ - --#define pr_fmt(fmt) KBUILD_MODNAME ":" __func__ "():" fmt -+#define pr_fmt(fmt) KBUILD_MODNAME ":" fmt - - #include - #include -diff --git a/drivers/net/cxgb4/t4_hw.c b/drivers/net/cxgb4/t4_hw.c -index bb813d9..e97521c 100644 ---- a/drivers/net/cxgb4/t4_hw.c -+++ b/drivers/net/cxgb4/t4_hw.c -@@ -2408,7 +2408,7 @@ int t4_alloc_mac_filt(struct adapter *adap, unsigned int mbox, - if (index < NEXACT_MAC) - ret++; - else if (hash) -- *hash |= (1 << hash_mac_addr(addr[i])); -+ *hash |= (1ULL << hash_mac_addr(addr[i])); - } - return ret; - } -diff --git a/drivers/net/cxgb4vf/cxgb4vf_main.c b/drivers/net/cxgb4vf/cxgb4vf_main.c -index d887a76..6bf464a 100644 ---- a/drivers/net/cxgb4vf/cxgb4vf_main.c -+++ b/drivers/net/cxgb4vf/cxgb4vf_main.c -@@ -2269,6 +2269,7 @@ static void __devinit cfg_queues(struct adapter *adapter) - { - struct sge *s = &adapter->sge; - int q10g, n10g, qidx, pidx, qs; -+ size_t iqe_size; - - /* - * We should not be called till we know how many Queue Sets we can -@@ -2313,6 +2314,13 @@ static void __devinit cfg_queues(struct adapter *adapter) - s->ethqsets = qidx; - - /* -+ * The Ingress Queue Entry Size for our various Response Queues needs -+ * to be big enough to accommodate the largest message we can receive -+ * from the chip/firmware; which is 64 bytes ... -+ */ -+ iqe_size = 64; -+ -+ /* - * Set up default Queue Set parameters ... Start off with the - * shortest interrupt holdoff timer. - */ -@@ -2320,7 +2328,7 @@ static void __devinit cfg_queues(struct adapter *adapter) - struct sge_eth_rxq *rxq = &s->ethrxq[qs]; - struct sge_eth_txq *txq = &s->ethtxq[qs]; - -- init_rspq(&rxq->rspq, 0, 0, 1024, L1_CACHE_BYTES); -+ init_rspq(&rxq->rspq, 0, 0, 1024, iqe_size); - rxq->fl.size = 72; - txq->q.size = 1024; - } -@@ -2329,8 +2337,7 @@ static void __devinit cfg_queues(struct adapter *adapter) - * The firmware event queue is used for link state changes and - * notifications of TX DMA completions. - */ -- init_rspq(&s->fw_evtq, SGE_TIMER_RSTRT_CNTR, 0, 512, -- L1_CACHE_BYTES); -+ init_rspq(&s->fw_evtq, SGE_TIMER_RSTRT_CNTR, 0, 512, iqe_size); - - /* - * The forwarded interrupt queue is used when we're in MSI interrupt -@@ -2346,7 +2353,7 @@ static void __devinit cfg_queues(struct adapter *adapter) - * any time ... - */ - init_rspq(&s->intrq, SGE_TIMER_RSTRT_CNTR, 0, MSIX_ENTRIES + 1, -- L1_CACHE_BYTES); -+ iqe_size); - } - - /* -diff --git a/drivers/net/ehea/ehea_ethtool.c b/drivers/net/ehea/ehea_ethtool.c -index 75b099c..1f37ee6 100644 ---- a/drivers/net/ehea/ehea_ethtool.c -+++ b/drivers/net/ehea/ehea_ethtool.c -@@ -261,6 +261,13 @@ static void ehea_get_ethtool_stats(struct net_device *dev, - - } - -+static int ehea_set_flags(struct net_device *dev, u32 data) -+{ -+ return ethtool_op_set_flags(dev, data, ETH_FLAG_LRO -+ | ETH_FLAG_TXVLAN -+ | ETH_FLAG_RXVLAN); -+} -+ - const struct ethtool_ops ehea_ethtool_ops = { - .get_settings = ehea_get_settings, - .get_drvinfo = ehea_get_drvinfo, -@@ -273,6 +280,8 @@ const struct ethtool_ops ehea_ethtool_ops = { - .get_ethtool_stats = ehea_get_ethtool_stats, - .get_rx_csum = ehea_get_rx_csum, - .set_settings = ehea_set_settings, -+ .get_flags = ethtool_op_get_flags, -+ .set_flags = ehea_set_flags, - .nway_reset = ehea_nway_reset, /* Restart autonegotiation */ - }; - -diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c -index 3d0af08..b95f087 100644 ---- a/drivers/net/ehea/ehea_main.c -+++ b/drivers/net/ehea/ehea_main.c -@@ -683,7 +683,7 @@ static void ehea_proc_skb(struct ehea_port_res *pr, struct ehea_cqe *cqe, - int vlan_extracted = ((cqe->status & EHEA_CQE_VLAN_TAG_XTRACT) && - pr->port->vgrp); - -- if (use_lro) { -+ if (skb->dev->features & NETIF_F_LRO) { - if (vlan_extracted) - lro_vlan_hwaccel_receive_skb(&pr->lro_mgr, skb, - pr->port->vgrp, -@@ -787,7 +787,7 @@ static int ehea_proc_rwqes(struct net_device *dev, - } - cqe = ehea_poll_rq1(qp, &wqe_index); - } -- if (use_lro) -+ if (dev->features & NETIF_F_LRO) - lro_flush_all(&pr->lro_mgr); - - pr->rx_packets += processed; -@@ -3278,6 +3278,9 @@ struct ehea_port *ehea_setup_single_port(struct ehea_adapter *adapter, - | NETIF_F_LLTX; - dev->watchdog_timeo = EHEA_WATCH_DOG_TIMEOUT; - -+ if (use_lro) -+ dev->features |= NETIF_F_LRO; -+ - INIT_WORK(&port->reset_task, ehea_reset_port); - - ret = register_netdev(dev); -diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c -index a466ef9..aa28b27 100644 ---- a/drivers/net/enic/enic_main.c -+++ b/drivers/net/enic/enic_main.c -@@ -1962,7 +1962,8 @@ static void enic_poll_controller(struct net_device *netdev) - case VNIC_DEV_INTR_MODE_MSIX: - for (i = 0; i < enic->rq_count; i++) { - intr = enic_msix_rq_intr(enic, i); -- enic_isr_msix_rq(enic->msix_entry[intr].vector, enic); -+ enic_isr_msix_rq(enic->msix_entry[intr].vector, -+ &enic->napi[i]); - } - intr = enic_msix_wq_intr(enic, i); - enic_isr_msix_wq(enic->msix_entry[intr].vector, enic); -diff --git a/drivers/net/ifb.c b/drivers/net/ifb.c -index ab9f675..fe337bd 100644 ---- a/drivers/net/ifb.c -+++ b/drivers/net/ifb.c -@@ -104,6 +104,8 @@ static void ri_tasklet(unsigned long dev) - rcu_read_unlock(); - dev_kfree_skb(skb); - stats->tx_dropped++; -+ if (skb_queue_len(&dp->tq) != 0) -+ goto resched; - break; - } - rcu_read_unlock(); -diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c -index fbad4d8..eee0b29 100644 ---- a/drivers/net/ixgbe/ixgbe_main.c -+++ b/drivers/net/ixgbe/ixgbe_main.c -@@ -4771,6 +4771,9 @@ void ixgbe_clear_interrupt_scheme(struct ixgbe_adapter *adapter) - adapter->rx_ring[i] = NULL; - } - -+ adapter->num_tx_queues = 0; -+ adapter->num_rx_queues = 0; -+ - ixgbe_free_q_vectors(adapter); - ixgbe_reset_interrupt_capability(adapter); - } -diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig -index cb3d13e..35fda5a 100644 ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -64,7 +64,7 @@ config BCM63XX_PHY - config ICPLUS_PHY - tristate "Drivers for ICPlus PHYs" - ---help--- -- Currently supports the IP175C PHY. -+ Currently supports the IP175C and IP1001 PHYs. - - config REALTEK_PHY - tristate "Drivers for Realtek PHYs" -diff --git a/drivers/net/phy/icplus.c b/drivers/net/phy/icplus.c -index c1d2d25..9a09e24 100644 ---- a/drivers/net/phy/icplus.c -+++ b/drivers/net/phy/icplus.c -@@ -30,7 +30,7 @@ - #include - #include - --MODULE_DESCRIPTION("ICPlus IP175C PHY driver"); -+MODULE_DESCRIPTION("ICPlus IP175C/IC1001 PHY drivers"); - MODULE_AUTHOR("Michael Barkowski"); - MODULE_LICENSE("GPL"); - -@@ -89,6 +89,33 @@ static int ip175c_config_init(struct phy_device *phydev) - return 0; - } - -+static int ip1001_config_init(struct phy_device *phydev) -+{ -+ int err, value; -+ -+ /* Software Reset PHY */ -+ value = phy_read(phydev, MII_BMCR); -+ value |= BMCR_RESET; -+ err = phy_write(phydev, MII_BMCR, value); -+ if (err < 0) -+ return err; -+ -+ do { -+ value = phy_read(phydev, MII_BMCR); -+ } while (value & BMCR_RESET); -+ -+ /* Additional delay (2ns) used to adjust RX clock phase -+ * at GMII/ RGMII interface */ -+ value = phy_read(phydev, 16); -+ value |= 0x3; -+ -+ err = phy_write(phydev, 16, value); -+ if (err < 0) -+ return err; -+ -+ return err; -+} -+ - static int ip175c_read_status(struct phy_device *phydev) - { - if (phydev->addr == 4) /* WAN port */ -@@ -121,21 +148,43 @@ static struct phy_driver ip175c_driver = { - .driver = { .owner = THIS_MODULE,}, - }; - --static int __init ip175c_init(void) -+static struct phy_driver ip1001_driver = { -+ .phy_id = 0x02430d90, -+ .name = "ICPlus IP1001", -+ .phy_id_mask = 0x0ffffff0, -+ .features = PHY_GBIT_FEATURES | SUPPORTED_Pause | -+ SUPPORTED_Asym_Pause, -+ .config_init = &ip1001_config_init, -+ .config_aneg = &genphy_config_aneg, -+ .read_status = &genphy_read_status, -+ .suspend = genphy_suspend, -+ .resume = genphy_resume, -+ .driver = { .owner = THIS_MODULE,}, -+}; -+ -+static int __init icplus_init(void) - { -+ int ret = 0; -+ -+ ret = phy_driver_register(&ip1001_driver); -+ if (ret < 0) -+ return -ENODEV; -+ - return phy_driver_register(&ip175c_driver); - } - --static void __exit ip175c_exit(void) -+static void __exit icplus_exit(void) - { -+ phy_driver_unregister(&ip1001_driver); - phy_driver_unregister(&ip175c_driver); - } - --module_init(ip175c_init); --module_exit(ip175c_exit); -+module_init(icplus_init); -+module_exit(icplus_exit); - - static struct mdio_device_id __maybe_unused icplus_tbl[] = { - { 0x02430d80, 0x0ffffff0 }, -+ { 0x02430d90, 0x0ffffff0 }, - { } - }; - -diff --git a/drivers/net/pppoe.c b/drivers/net/pppoe.c -index d72fb05..78c0e3c 100644 ---- a/drivers/net/pppoe.c -+++ b/drivers/net/pppoe.c -@@ -948,7 +948,7 @@ static int __pppoe_xmit(struct sock *sk, struct sk_buff *skb) - - abort: - kfree_skb(skb); -- return 0; -+ return 1; - } - - /************************************************************************ -diff --git a/drivers/net/qlge/qlge.h b/drivers/net/qlge/qlge.h -index 2282139..9787dff 100644 ---- a/drivers/net/qlge/qlge.h -+++ b/drivers/net/qlge/qlge.h -@@ -2083,6 +2083,7 @@ struct ql_adapter { - u32 mailbox_in; - u32 mailbox_out; - struct mbox_params idc_mbc; -+ struct mutex mpi_mutex; - - int tx_ring_size; - int rx_ring_size; -diff --git a/drivers/net/qlge/qlge_main.c b/drivers/net/qlge/qlge_main.c -index 528eaef..2555b1d 100644 ---- a/drivers/net/qlge/qlge_main.c -+++ b/drivers/net/qlge/qlge_main.c -@@ -4629,6 +4629,7 @@ static int __devinit ql_init_device(struct pci_dev *pdev, - INIT_DELAYED_WORK(&qdev->mpi_idc_work, ql_mpi_idc_work); - INIT_DELAYED_WORK(&qdev->mpi_core_to_log, ql_mpi_core_to_log); - init_completion(&qdev->ide_completion); -+ mutex_init(&qdev->mpi_mutex); - - if (!cards_found) { - dev_info(&pdev->dev, "%s\n", DRV_STRING); -diff --git a/drivers/net/qlge/qlge_mpi.c b/drivers/net/qlge/qlge_mpi.c -index 0e7c7c7..a2e919b 100644 ---- a/drivers/net/qlge/qlge_mpi.c -+++ b/drivers/net/qlge/qlge_mpi.c -@@ -534,6 +534,7 @@ static int ql_mailbox_command(struct ql_adapter *qdev, struct mbox_params *mbcp) - int status; - unsigned long count; - -+ mutex_lock(&qdev->mpi_mutex); - - /* Begin polled mode for MPI */ - ql_write32(qdev, INTR_MASK, (INTR_MASK_PI << 16)); -@@ -603,6 +604,7 @@ done: - end: - /* End polled mode for MPI */ - ql_write32(qdev, INTR_MASK, (INTR_MASK_PI << 16) | INTR_MASK_PI); -+ mutex_unlock(&qdev->mpi_mutex); - return status; - } - -@@ -1099,9 +1101,7 @@ int ql_wait_fifo_empty(struct ql_adapter *qdev) - static int ql_set_port_cfg(struct ql_adapter *qdev) - { - int status; -- rtnl_lock(); - status = ql_mb_set_port_cfg(qdev); -- rtnl_unlock(); - if (status) - return status; - status = ql_idc_wait(qdev); -@@ -1122,9 +1122,7 @@ void ql_mpi_port_cfg_work(struct work_struct *work) - container_of(work, struct ql_adapter, mpi_port_cfg_work.work); - int status; - -- rtnl_lock(); - status = ql_mb_get_port_cfg(qdev); -- rtnl_unlock(); - if (status) { - netif_err(qdev, drv, qdev->ndev, - "Bug: Failed to get port config data.\n"); -@@ -1167,7 +1165,6 @@ void ql_mpi_idc_work(struct work_struct *work) - u32 aen; - int timeout; - -- rtnl_lock(); - aen = mbcp->mbox_out[1] >> 16; - timeout = (mbcp->mbox_out[1] >> 8) & 0xf; - -@@ -1231,7 +1228,6 @@ void ql_mpi_idc_work(struct work_struct *work) - } - break; - } -- rtnl_unlock(); - } - - void ql_mpi_work(struct work_struct *work) -@@ -1242,7 +1238,7 @@ void ql_mpi_work(struct work_struct *work) - struct mbox_params *mbcp = &mbc; - int err = 0; - -- rtnl_lock(); -+ mutex_lock(&qdev->mpi_mutex); - /* Begin polled mode for MPI */ - ql_write32(qdev, INTR_MASK, (INTR_MASK_PI << 16)); - -@@ -1259,7 +1255,7 @@ void ql_mpi_work(struct work_struct *work) - - /* End polled mode for MPI */ - ql_write32(qdev, INTR_MASK, (INTR_MASK_PI << 16) | INTR_MASK_PI); -- rtnl_unlock(); -+ mutex_unlock(&qdev->mpi_mutex); - ql_enable_completion_interrupt(qdev, 0); - } - -diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c -index 7d33ef4..53b13de 100644 ---- a/drivers/net/r8169.c -+++ b/drivers/net/r8169.c -@@ -744,26 +744,36 @@ static void rtl8169_xmii_reset_enable(void __iomem *ioaddr) - mdio_write(ioaddr, MII_BMCR, val & 0xffff); - } - --static void rtl8169_check_link_status(struct net_device *dev, -+static void __rtl8169_check_link_status(struct net_device *dev, - struct rtl8169_private *tp, -- void __iomem *ioaddr) -+ void __iomem *ioaddr, -+ bool pm) - { - unsigned long flags; - - spin_lock_irqsave(&tp->lock, flags); - if (tp->link_ok(ioaddr)) { - /* This is to cancel a scheduled suspend if there's one. */ -- pm_request_resume(&tp->pci_dev->dev); -+ if (pm) -+ pm_request_resume(&tp->pci_dev->dev); - netif_carrier_on(dev); - netif_info(tp, ifup, dev, "link up\n"); - } else { - netif_carrier_off(dev); - netif_info(tp, ifdown, dev, "link down\n"); -- pm_schedule_suspend(&tp->pci_dev->dev, 100); -+ if (pm) -+ pm_schedule_suspend(&tp->pci_dev->dev, 100); - } - spin_unlock_irqrestore(&tp->lock, flags); - } - -+static void rtl8169_check_link_status(struct net_device *dev, -+ struct rtl8169_private *tp, -+ void __iomem *ioaddr) -+{ -+ __rtl8169_check_link_status(dev, tp, ioaddr, false); -+} -+ - #define WAKE_ANY (WAKE_PHY | WAKE_MAGIC | WAKE_UCAST | WAKE_BCAST | WAKE_MCAST) - - static u32 __rtl8169_get_wol(struct rtl8169_private *tp) -@@ -4600,7 +4610,7 @@ static irqreturn_t rtl8169_interrupt(int irq, void *dev_instance) - } - - if (status & LinkChg) -- rtl8169_check_link_status(dev, tp, ioaddr); -+ __rtl8169_check_link_status(dev, tp, ioaddr, true); - - /* We need to see the lastest version of tp->intr_mask to - * avoid ignoring an MSI interrupt and having to wait for -@@ -4890,11 +4900,7 @@ static int rtl8169_runtime_idle(struct device *device) - struct net_device *dev = pci_get_drvdata(pdev); - struct rtl8169_private *tp = netdev_priv(dev); - -- if (!tp->TxDescArray) -- return 0; -- -- rtl8169_check_link_status(dev, tp, tp->mmio_addr); -- return -EBUSY; -+ return tp->TxDescArray ? -EBUSY : 0; - } - - static const struct dev_pm_ops rtl8169_pm_ops = { -diff --git a/drivers/net/sfc/efx.c b/drivers/net/sfc/efx.c -index 05df20e..fb83cdd 100644 ---- a/drivers/net/sfc/efx.c -+++ b/drivers/net/sfc/efx.c -@@ -197,7 +197,9 @@ MODULE_PARM_DESC(debug, "Bitmapped debugging message enable value"); - - static void efx_remove_channels(struct efx_nic *efx); - static void efx_remove_port(struct efx_nic *efx); -+static void efx_init_napi(struct efx_nic *efx); - static void efx_fini_napi(struct efx_nic *efx); -+static void efx_fini_napi_channel(struct efx_channel *channel); - static void efx_fini_struct(struct efx_nic *efx); - static void efx_start_all(struct efx_nic *efx); - static void efx_stop_all(struct efx_nic *efx); -@@ -335,8 +337,10 @@ void efx_process_channel_now(struct efx_channel *channel) - - /* Disable interrupts and wait for ISRs to complete */ - efx_nic_disable_interrupts(efx); -- if (efx->legacy_irq) -+ if (efx->legacy_irq) { - synchronize_irq(efx->legacy_irq); -+ efx->legacy_irq_enabled = false; -+ } - if (channel->irq) - synchronize_irq(channel->irq); - -@@ -351,6 +355,8 @@ void efx_process_channel_now(struct efx_channel *channel) - efx_channel_processed(channel); - - napi_enable(&channel->napi_str); -+ if (efx->legacy_irq) -+ efx->legacy_irq_enabled = true; - efx_nic_enable_interrupts(efx); - } - -@@ -426,6 +432,7 @@ efx_alloc_channel(struct efx_nic *efx, int i, struct efx_channel *old_channel) - - *channel = *old_channel; - -+ channel->napi_dev = NULL; - memset(&channel->eventq, 0, sizeof(channel->eventq)); - - rx_queue = &channel->rx_queue; -@@ -736,9 +743,13 @@ efx_realloc_channels(struct efx_nic *efx, u32 rxq_entries, u32 txq_entries) - if (rc) - goto rollback; - -+ efx_init_napi(efx); -+ - /* Destroy old channels */ -- for (i = 0; i < efx->n_channels; i++) -+ for (i = 0; i < efx->n_channels; i++) { -+ efx_fini_napi_channel(other_channel[i]); - efx_remove_channel(other_channel[i]); -+ } - out: - /* Free unused channel structures */ - for (i = 0; i < efx->n_channels; i++) -@@ -1400,6 +1411,8 @@ static void efx_start_all(struct efx_nic *efx) - efx_start_channel(channel); - } - -+ if (efx->legacy_irq) -+ efx->legacy_irq_enabled = true; - efx_nic_enable_interrupts(efx); - - /* Switch to event based MCDI completions after enabling interrupts. -@@ -1460,8 +1473,10 @@ static void efx_stop_all(struct efx_nic *efx) - - /* Disable interrupts and wait for ISR to complete */ - efx_nic_disable_interrupts(efx); -- if (efx->legacy_irq) -+ if (efx->legacy_irq) { - synchronize_irq(efx->legacy_irq); -+ efx->legacy_irq_enabled = false; -+ } - efx_for_each_channel(channel, efx) { - if (channel->irq) - synchronize_irq(channel->irq); -@@ -1593,7 +1608,7 @@ static int efx_ioctl(struct net_device *net_dev, struct ifreq *ifr, int cmd) - * - **************************************************************************/ - --static int efx_init_napi(struct efx_nic *efx) -+static void efx_init_napi(struct efx_nic *efx) - { - struct efx_channel *channel; - -@@ -1602,18 +1617,21 @@ static int efx_init_napi(struct efx_nic *efx) - netif_napi_add(channel->napi_dev, &channel->napi_str, - efx_poll, napi_weight); - } -- return 0; -+} -+ -+static void efx_fini_napi_channel(struct efx_channel *channel) -+{ -+ if (channel->napi_dev) -+ netif_napi_del(&channel->napi_str); -+ channel->napi_dev = NULL; - } - - static void efx_fini_napi(struct efx_nic *efx) - { - struct efx_channel *channel; - -- efx_for_each_channel(channel, efx) { -- if (channel->napi_dev) -- netif_napi_del(&channel->napi_str); -- channel->napi_dev = NULL; -- } -+ efx_for_each_channel(channel, efx) -+ efx_fini_napi_channel(channel); - } - - /************************************************************************** -@@ -2335,9 +2353,7 @@ static int efx_pci_probe_main(struct efx_nic *efx) - if (rc) - goto fail1; - -- rc = efx_init_napi(efx); -- if (rc) -- goto fail2; -+ efx_init_napi(efx); - - rc = efx->type->init(efx); - if (rc) { -@@ -2368,7 +2384,6 @@ static int efx_pci_probe_main(struct efx_nic *efx) - efx->type->fini(efx); - fail3: - efx_fini_napi(efx); -- fail2: - efx_remove_all(efx); - fail1: - return rc; -diff --git a/drivers/net/sfc/net_driver.h b/drivers/net/sfc/net_driver.h -index 0a7e26d..b137c88 100644 ---- a/drivers/net/sfc/net_driver.h -+++ b/drivers/net/sfc/net_driver.h -@@ -621,6 +621,7 @@ struct efx_filter_state; - * @pci_dev: The PCI device - * @type: Controller type attributes - * @legacy_irq: IRQ number -+ * @legacy_irq_enabled: Are IRQs enabled on NIC (INT_EN_KER register)? - * @workqueue: Workqueue for port reconfigures and the HW monitor. - * Work items do not hold and must not acquire RTNL. - * @workqueue_name: Name of workqueue -@@ -709,6 +710,7 @@ struct efx_nic { - struct pci_dev *pci_dev; - const struct efx_nic_type *type; - int legacy_irq; -+ bool legacy_irq_enabled; - struct workqueue_struct *workqueue; - char workqueue_name[16]; - struct work_struct reset_work; -diff --git a/drivers/net/sfc/nic.c b/drivers/net/sfc/nic.c -index 41c36b9..67cb0c9 100644 ---- a/drivers/net/sfc/nic.c -+++ b/drivers/net/sfc/nic.c -@@ -1418,6 +1418,12 @@ static irqreturn_t efx_legacy_interrupt(int irq, void *dev_id) - u32 queues; - int syserr; - -+ /* Could this be ours? If interrupts are disabled then the -+ * channel state may not be valid. -+ */ -+ if (!efx->legacy_irq_enabled) -+ return result; -+ - /* Read the ISR which also ACKs the interrupts */ - efx_readd(efx, ®, FR_BZ_INT_ISR0); - queues = EFX_EXTRACT_DWORD(reg, 0, 31); -diff --git a/drivers/net/stmmac/stmmac_main.c b/drivers/net/stmmac/stmmac_main.c -index 06bc603..2114837 100644 ---- a/drivers/net/stmmac/stmmac_main.c -+++ b/drivers/net/stmmac/stmmac_main.c -@@ -1509,6 +1509,8 @@ static int stmmac_probe(struct net_device *dev) - pr_warning("\tno valid MAC address;" - "please, use ifconfig or nwhwconfig!\n"); - -+ spin_lock_init(&priv->lock); -+ - ret = register_netdev(dev); - if (ret) { - pr_err("%s: ERROR %i registering the device\n", -@@ -1520,8 +1522,6 @@ static int stmmac_probe(struct net_device *dev) - dev->name, (dev->features & NETIF_F_SG) ? "on" : "off", - (dev->features & NETIF_F_HW_CSUM) ? "on" : "off"); - -- spin_lock_init(&priv->lock); -- - return ret; - } - -diff --git a/drivers/net/tulip/dmfe.c b/drivers/net/tulip/dmfe.c -index a9f7d5d..7064e03 100644 ---- a/drivers/net/tulip/dmfe.c -+++ b/drivers/net/tulip/dmfe.c -@@ -688,9 +688,6 @@ static netdev_tx_t dmfe_start_xmit(struct sk_buff *skb, - - DMFE_DBUG(0, "dmfe_start_xmit", 0); - -- /* Resource flag check */ -- netif_stop_queue(dev); -- - /* Too large packet check */ - if (skb->len > MAX_PACKET_SIZE) { - pr_err("big packet = %d\n", (u16)skb->len); -@@ -698,6 +695,9 @@ static netdev_tx_t dmfe_start_xmit(struct sk_buff *skb, - return NETDEV_TX_OK; - } - -+ /* Resource flag check */ -+ netif_stop_queue(dev); -+ - spin_lock_irqsave(&db->lock, flags); - - /* No Tx resource check, it never happen nromally */ -diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c -index 62e9e8d..812edf8 100644 ---- a/drivers/net/usb/hso.c -+++ b/drivers/net/usb/hso.c -@@ -958,10 +958,6 @@ static void packetizeRx(struct hso_net *odev, unsigned char *ip_pkt, - /* Packet is complete. Inject into stack. */ - /* We have IP packet here */ - odev->skb_rx_buf->protocol = cpu_to_be16(ETH_P_IP); -- /* don't check it */ -- odev->skb_rx_buf->ip_summed = -- CHECKSUM_UNNECESSARY; -- - skb_reset_mac_header(odev->skb_rx_buf); - - /* Ship it off to the kernel */ -diff --git a/drivers/net/wan/hd64572.c b/drivers/net/wan/hd64572.c -index ea476cb..e305274 100644 ---- a/drivers/net/wan/hd64572.c -+++ b/drivers/net/wan/hd64572.c -@@ -293,6 +293,7 @@ static inline void sca_tx_done(port_t *port) - struct net_device *dev = port->netdev; - card_t* card = port->card; - u8 stat; -+ unsigned count = 0; - - spin_lock(&port->lock); - -@@ -316,10 +317,12 @@ static inline void sca_tx_done(port_t *port) - dev->stats.tx_bytes += readw(&desc->len); - } - writeb(0, &desc->stat); /* Free descriptor */ -+ count++; - port->txlast = (port->txlast + 1) % card->tx_ring_buffers; - } - -- netif_wake_queue(dev); -+ if (count) -+ netif_wake_queue(dev); - spin_unlock(&port->lock); - } - -diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c -index 8251946..42ed923 100644 ---- a/drivers/net/wireless/ath/ath5k/base.c -+++ b/drivers/net/wireless/ath/ath5k/base.c -@@ -1917,7 +1917,8 @@ ath5k_beacon_send(struct ath5k_softc *sc) - sc->bmisscount = 0; - } - -- if (sc->opmode == NL80211_IFTYPE_AP && sc->num_ap_vifs > 1) { -+ if ((sc->opmode == NL80211_IFTYPE_AP && sc->num_ap_vifs > 1) || -+ sc->opmode == NL80211_IFTYPE_MESH_POINT) { - u64 tsf = ath5k_hw_get_tsf64(ah); - u32 tsftu = TSF_TO_TU(tsf); - int slot = ((tsftu % sc->bintval) * ATH_BCBUF) / sc->bintval; -@@ -1949,8 +1950,9 @@ ath5k_beacon_send(struct ath5k_softc *sc) - /* NB: hw still stops DMA, so proceed */ - } - -- /* refresh the beacon for AP mode */ -- if (sc->opmode == NL80211_IFTYPE_AP) -+ /* refresh the beacon for AP or MESH mode */ -+ if (sc->opmode == NL80211_IFTYPE_AP || -+ sc->opmode == NL80211_IFTYPE_MESH_POINT) - ath5k_beacon_update(sc->hw, vif); - - ath5k_hw_set_txdp(ah, sc->bhalq, bf->daddr); -@@ -2851,7 +2853,8 @@ static int ath5k_add_interface(struct ieee80211_hw *hw, - - /* Assign the vap/adhoc to a beacon xmit slot. */ - if ((avf->opmode == NL80211_IFTYPE_AP) || -- (avf->opmode == NL80211_IFTYPE_ADHOC)) { -+ (avf->opmode == NL80211_IFTYPE_ADHOC) || -+ (avf->opmode == NL80211_IFTYPE_MESH_POINT)) { - int slot; - - WARN_ON(list_empty(&sc->bcbuf)); -@@ -2870,7 +2873,7 @@ static int ath5k_add_interface(struct ieee80211_hw *hw, - sc->bslot[avf->bslot] = vif; - if (avf->opmode == NL80211_IFTYPE_AP) - sc->num_ap_vifs++; -- else -+ else if (avf->opmode == NL80211_IFTYPE_ADHOC) - sc->num_adhoc_vifs++; - } - -diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c -index c418235..a7b82f0 100644 ---- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c -+++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c -@@ -55,6 +55,8 @@ - #define SUB_NUM_CTL_MODES_AT_5G_40 2 /* excluding HT40, EXT-OFDM */ - #define SUB_NUM_CTL_MODES_AT_2G_40 3 /* excluding HT40, EXT-OFDM, EXT-CCK */ - -+#define CTL(_tpower, _flag) ((_tpower) | ((_flag) << 6)) -+ - static const struct ar9300_eeprom ar9300_default = { - .eepromVersion = 2, - .templateVersion = 2, -@@ -290,20 +292,21 @@ static const struct ar9300_eeprom ar9300_default = { - } - }, - .ctlPowerData_2G = { -- { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, -- { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, -- { { {60, 1}, {60, 0}, {60, 0}, {60, 1} } }, -+ { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, -+ { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, -+ { { CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 1) } }, - -- { { {60, 1}, {60, 0}, {0, 0}, {0, 0} } }, -- { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, -- { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, -+ { { CTL(60, 1), CTL(60, 0), CTL(0, 0), CTL(0, 0) } }, -+ { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, -+ { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, - -- { { {60, 0}, {60, 1}, {60, 1}, {60, 0} } }, -- { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, -- { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, -+ { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0) } }, -+ { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, -+ { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, - -- { { {60, 0}, {60, 1}, {60, 0}, {60, 0} } }, -- { { {60, 0}, {60, 1}, {60, 1}, {60, 1} } }, -+ { { CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 0) } }, -+ { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } }, -+ { { CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 1) } }, - }, - .modalHeader5G = { - /* 4 idle,t1,t2,b (4 bits per setting) */ -@@ -568,56 +571,56 @@ static const struct ar9300_eeprom ar9300_default = { - .ctlPowerData_5G = { - { - { -- {60, 1}, {60, 1}, {60, 1}, {60, 1}, -- {60, 1}, {60, 1}, {60, 1}, {60, 0}, -+ CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), -+ CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0), - } - }, - { - { -- {60, 1}, {60, 1}, {60, 1}, {60, 1}, -- {60, 1}, {60, 1}, {60, 1}, {60, 0}, -+ CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), -+ CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0), - } - }, - { - { -- {60, 0}, {60, 1}, {60, 0}, {60, 1}, -- {60, 1}, {60, 1}, {60, 1}, {60, 1}, -+ CTL(60, 0), CTL(60, 1), CTL(60, 0), CTL(60, 1), -+ CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), - } - }, - { - { -- {60, 0}, {60, 1}, {60, 1}, {60, 0}, -- {60, 1}, {60, 0}, {60, 0}, {60, 0}, -+ CTL(60, 0), CTL(60, 1), CTL(60, 1), CTL(60, 0), -+ CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0), - } - }, - { - { -- {60, 1}, {60, 1}, {60, 1}, {60, 0}, -- {60, 0}, {60, 0}, {60, 0}, {60, 0}, -+ CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0), -+ CTL(60, 0), CTL(60, 0), CTL(60, 0), CTL(60, 0), - } - }, - { - { -- {60, 1}, {60, 1}, {60, 1}, {60, 1}, -- {60, 1}, {60, 0}, {60, 0}, {60, 0}, -+ CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), -+ CTL(60, 1), CTL(60, 0), CTL(60, 0), CTL(60, 0), - } - }, - { - { -- {60, 1}, {60, 1}, {60, 1}, {60, 1}, -- {60, 1}, {60, 1}, {60, 1}, {60, 1}, -+ CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), -+ CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 1), - } - }, - { - { -- {60, 1}, {60, 1}, {60, 0}, {60, 1}, -- {60, 1}, {60, 1}, {60, 1}, {60, 0}, -+ CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1), -+ CTL(60, 1), CTL(60, 1), CTL(60, 1), CTL(60, 0), - } - }, - { - { -- {60, 1}, {60, 0}, {60, 1}, {60, 1}, -- {60, 1}, {60, 1}, {60, 0}, {60, 1}, -+ CTL(60, 1), CTL(60, 0), CTL(60, 1), CTL(60, 1), -+ CTL(60, 1), CTL(60, 1), CTL(60, 0), CTL(60, 1), - } - }, - } -@@ -1827,9 +1830,9 @@ static u16 ar9003_hw_get_direct_edge_power(struct ar9300_eeprom *eep, - struct cal_ctl_data_5g *ctl_5g = eep->ctlPowerData_5G; - - if (is2GHz) -- return ctl_2g[idx].ctlEdges[edge].tPower; -+ return CTL_EDGE_TPOWER(ctl_2g[idx].ctlEdges[edge]); - else -- return ctl_5g[idx].ctlEdges[edge].tPower; -+ return CTL_EDGE_TPOWER(ctl_5g[idx].ctlEdges[edge]); - } - - static u16 ar9003_hw_get_indirect_edge_power(struct ar9300_eeprom *eep, -@@ -1847,12 +1850,12 @@ static u16 ar9003_hw_get_indirect_edge_power(struct ar9300_eeprom *eep, - - if (is2GHz) { - if (ath9k_hw_fbin2freq(ctl_freqbin[edge - 1], 1) < freq && -- ctl_2g[idx].ctlEdges[edge - 1].flag) -- return ctl_2g[idx].ctlEdges[edge - 1].tPower; -+ CTL_EDGE_FLAGS(ctl_2g[idx].ctlEdges[edge - 1])) -+ return CTL_EDGE_TPOWER(ctl_2g[idx].ctlEdges[edge - 1]); - } else { - if (ath9k_hw_fbin2freq(ctl_freqbin[edge - 1], 0) < freq && -- ctl_5g[idx].ctlEdges[edge - 1].flag) -- return ctl_5g[idx].ctlEdges[edge - 1].tPower; -+ CTL_EDGE_FLAGS(ctl_5g[idx].ctlEdges[edge - 1])) -+ return CTL_EDGE_TPOWER(ctl_5g[idx].ctlEdges[edge - 1]); - } - - return AR9300_MAX_RATE_POWER; -diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h -index 3c533bb..655b303 100644 ---- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h -+++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h -@@ -261,17 +261,12 @@ struct cal_tgt_pow_ht { - u8 tPow2x[14]; - } __packed; - --struct cal_ctl_edge_pwr { -- u8 tPower:6, -- flag:2; --} __packed; -- - struct cal_ctl_data_2g { -- struct cal_ctl_edge_pwr ctlEdges[AR9300_NUM_BAND_EDGES_2G]; -+ u8 ctlEdges[AR9300_NUM_BAND_EDGES_2G]; - } __packed; - - struct cal_ctl_data_5g { -- struct cal_ctl_edge_pwr ctlEdges[AR9300_NUM_BAND_EDGES_5G]; -+ u8 ctlEdges[AR9300_NUM_BAND_EDGES_5G]; - } __packed; - - struct ar9300_eeprom { -diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h -index 170d44a..0963071 100644 ---- a/drivers/net/wireless/ath/ath9k/ath9k.h -+++ b/drivers/net/wireless/ath/ath9k/ath9k.h -@@ -21,6 +21,7 @@ - #include - #include - #include -+#include - - #include "debug.h" - #include "common.h" -@@ -328,7 +329,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp); - struct ath_txq *ath_txq_setup(struct ath_softc *sc, int qtype, int subtype); - void ath_tx_cleanupq(struct ath_softc *sc, struct ath_txq *txq); - int ath_tx_setup(struct ath_softc *sc, int haltype); --void ath_drain_all_txq(struct ath_softc *sc, bool retry_tx); -+bool ath_drain_all_txq(struct ath_softc *sc, bool retry_tx); - void ath_draintxq(struct ath_softc *sc, - struct ath_txq *txq, bool retry_tx); - void ath_tx_node_init(struct ath_softc *sc, struct ath_node *an); -@@ -646,6 +647,8 @@ struct ath_softc { - struct ath_descdma txsdma; - - struct ath_ant_comb ant_comb; -+ -+ struct pm_qos_request_list pm_qos_req; - }; - - struct ath_wiphy { -@@ -675,7 +678,6 @@ static inline void ath_read_cachesize(struct ath_common *common, int *csz) - } - - extern struct ieee80211_ops ath9k_ops; --extern struct pm_qos_request_list ath9k_pm_qos_req; - extern int modparam_nohwcrypt; - extern int led_blink; - -diff --git a/drivers/net/wireless/ath/ath9k/eeprom.c b/drivers/net/wireless/ath/ath9k/eeprom.c -index 1266333..2bbf94d 100644 ---- a/drivers/net/wireless/ath/ath9k/eeprom.c -+++ b/drivers/net/wireless/ath/ath9k/eeprom.c -@@ -240,16 +240,16 @@ u16 ath9k_hw_get_max_edge_power(u16 freq, struct cal_ctl_edges *pRdEdgesPower, - for (i = 0; (i < num_band_edges) && - (pRdEdgesPower[i].bChannel != AR5416_BCHAN_UNUSED); i++) { - if (freq == ath9k_hw_fbin2freq(pRdEdgesPower[i].bChannel, is2GHz)) { -- twiceMaxEdgePower = pRdEdgesPower[i].tPower; -+ twiceMaxEdgePower = CTL_EDGE_TPOWER(pRdEdgesPower[i].ctl); - break; - } else if ((i > 0) && - (freq < ath9k_hw_fbin2freq(pRdEdgesPower[i].bChannel, - is2GHz))) { - if (ath9k_hw_fbin2freq(pRdEdgesPower[i - 1].bChannel, - is2GHz) < freq && -- pRdEdgesPower[i - 1].flag) { -+ CTL_EDGE_FLAGS(pRdEdgesPower[i - 1].ctl)) { - twiceMaxEdgePower = -- pRdEdgesPower[i - 1].tPower; -+ CTL_EDGE_TPOWER(pRdEdgesPower[i - 1].ctl); - } - break; - } -diff --git a/drivers/net/wireless/ath/ath9k/eeprom.h b/drivers/net/wireless/ath/ath9k/eeprom.h -index dacb45e..dd59f09 100644 ---- a/drivers/net/wireless/ath/ath9k/eeprom.h -+++ b/drivers/net/wireless/ath/ath9k/eeprom.h -@@ -233,6 +233,18 @@ - - #define AR9287_CHECKSUM_LOCATION (AR9287_EEP_START_LOC + 1) - -+#define CTL_EDGE_TPOWER(_ctl) ((_ctl) & 0x3f) -+#define CTL_EDGE_FLAGS(_ctl) (((_ctl) >> 6) & 0x03) -+ -+#define LNA_CTL_BUF_MODE BIT(0) -+#define LNA_CTL_ISEL_LO BIT(1) -+#define LNA_CTL_ISEL_HI BIT(2) -+#define LNA_CTL_BUF_IN BIT(3) -+#define LNA_CTL_FEM_BAND BIT(4) -+#define LNA_CTL_LOCAL_BIAS BIT(5) -+#define LNA_CTL_FORCE_XPA BIT(6) -+#define LNA_CTL_USE_ANT1 BIT(7) -+ - enum eeprom_param { - EEP_NFTHRESH_5, - EEP_NFTHRESH_2, -@@ -378,10 +390,7 @@ struct modal_eep_header { - u8 xatten2Margin[AR5416_MAX_CHAINS]; - u8 ob_ch1; - u8 db_ch1; -- u8 useAnt1:1, -- force_xpaon:1, -- local_bias:1, -- femBandSelectUsed:1, xlnabufin:1, xlnaisel:2, xlnabufmode:1; -+ u8 lna_ctl; - u8 miscBits; - u16 xpaBiasLvlFreq[3]; - u8 futureModal[6]; -@@ -535,18 +544,10 @@ struct cal_target_power_ht { - u8 tPow2x[8]; - } __packed; - -- --#ifdef __BIG_ENDIAN_BITFIELD --struct cal_ctl_edges { -- u8 bChannel; -- u8 flag:2, tPower:6; --} __packed; --#else - struct cal_ctl_edges { - u8 bChannel; -- u8 tPower:6, flag:2; -+ u8 ctl; - } __packed; --#endif - - struct cal_data_op_loop_ar9287 { - u8 pwrPdg[2][5]; -diff --git a/drivers/net/wireless/ath/ath9k/eeprom_def.c b/drivers/net/wireless/ath/ath9k/eeprom_def.c -index 76b4d65..a3ccb1b 100644 ---- a/drivers/net/wireless/ath/ath9k/eeprom_def.c -+++ b/drivers/net/wireless/ath/ath9k/eeprom_def.c -@@ -451,9 +451,10 @@ static void ath9k_hw_def_set_board_values(struct ath_hw *ah, - ath9k_hw_analog_shift_rmw(ah, AR_AN_TOP2, - AR_AN_TOP2_LOCALBIAS, - AR_AN_TOP2_LOCALBIAS_S, -- pModal->local_bias); -+ !!(pModal->lna_ctl & -+ LNA_CTL_LOCAL_BIAS)); - REG_RMW_FIELD(ah, AR_PHY_XPA_CFG, AR_PHY_FORCE_XPA_CFG, -- pModal->force_xpaon); -+ !!(pModal->lna_ctl & LNA_CTL_FORCE_XPA)); - } - - REG_RMW_FIELD(ah, AR_PHY_SETTLING, AR_PHY_SETTLING_SWITCH, -@@ -1062,15 +1063,19 @@ static void ath9k_hw_set_def_power_per_rate_table(struct ath_hw *ah, - case 1: - break; - case 2: -- scaledPower -= REDUCE_SCALED_POWER_BY_TWO_CHAIN; -+ if (scaledPower > REDUCE_SCALED_POWER_BY_TWO_CHAIN) -+ scaledPower -= REDUCE_SCALED_POWER_BY_TWO_CHAIN; -+ else -+ scaledPower = 0; - break; - case 3: -- scaledPower -= REDUCE_SCALED_POWER_BY_THREE_CHAIN; -+ if (scaledPower > REDUCE_SCALED_POWER_BY_THREE_CHAIN) -+ scaledPower -= REDUCE_SCALED_POWER_BY_THREE_CHAIN; -+ else -+ scaledPower = 0; - break; - } - -- scaledPower = max((u16)0, scaledPower); -- - if (IS_CHAN_2GHZ(chan)) { - numCtlModes = ARRAY_SIZE(ctlModesFor11g) - - SUB_NUM_CTL_MODES_AT_2G_40; -@@ -1428,9 +1433,9 @@ static u8 ath9k_hw_def_get_num_ant_config(struct ath_hw *ah, - - num_ant_config = 1; - -- if (pBase->version >= 0x0E0D) -- if (pModal->useAnt1) -- num_ant_config += 1; -+ if (pBase->version >= 0x0E0D && -+ (pModal->lna_ctl & LNA_CTL_USE_ANT1)) -+ num_ant_config += 1; - - return num_ant_config; - } -diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c -index dfb6560..0de3c3d 100644 ---- a/drivers/net/wireless/ath/ath9k/hif_usb.c -+++ b/drivers/net/wireless/ath/ath9k/hif_usb.c -@@ -1024,6 +1024,13 @@ static int ath9k_hif_usb_suspend(struct usb_interface *interface, - struct hif_device_usb *hif_dev = - (struct hif_device_usb *) usb_get_intfdata(interface); - -+ /* -+ * The device has to be set to FULLSLEEP mode in case no -+ * interface is up. -+ */ -+ if (!(hif_dev->flags & HIF_USB_START)) -+ ath9k_htc_suspend(hif_dev->htc_handle); -+ - ath9k_hif_usb_dealloc_urbs(hif_dev); - - return 0; -diff --git a/drivers/net/wireless/ath/ath9k/htc.h b/drivers/net/wireless/ath/ath9k/htc.h -index 75ecf6a..c3b561d 100644 ---- a/drivers/net/wireless/ath/ath9k/htc.h -+++ b/drivers/net/wireless/ath/ath9k/htc.h -@@ -455,6 +455,8 @@ u32 ath9k_htc_calcrxfilter(struct ath9k_htc_priv *priv); - void ath9k_htc_ps_wakeup(struct ath9k_htc_priv *priv); - void ath9k_htc_ps_restore(struct ath9k_htc_priv *priv); - void ath9k_ps_work(struct work_struct *work); -+bool ath9k_htc_setpower(struct ath9k_htc_priv *priv, -+ enum ath9k_power_mode mode); - - void ath9k_start_rfkill_poll(struct ath9k_htc_priv *priv); - void ath9k_init_leds(struct ath9k_htc_priv *priv); -@@ -464,6 +466,7 @@ int ath9k_htc_probe_device(struct htc_target *htc_handle, struct device *dev, - u16 devid, char *product); - void ath9k_htc_disconnect_device(struct htc_target *htc_handle, bool hotunplug); - #ifdef CONFIG_PM -+void ath9k_htc_suspend(struct htc_target *htc_handle); - int ath9k_htc_resume(struct htc_target *htc_handle); - #endif - #ifdef CONFIG_ATH9K_HTC_DEBUGFS -diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c b/drivers/net/wireless/ath/ath9k/htc_drv_init.c -index 7c8a38d..8776f49 100644 ---- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c -+++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c -@@ -891,6 +891,12 @@ void ath9k_htc_disconnect_device(struct htc_target *htc_handle, bool hotunplug) - } - - #ifdef CONFIG_PM -+ -+void ath9k_htc_suspend(struct htc_target *htc_handle) -+{ -+ ath9k_htc_setpower(htc_handle->drv_priv, ATH9K_PM_FULL_SLEEP); -+} -+ - int ath9k_htc_resume(struct htc_target *htc_handle) - { - int ret; -diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c -index 9a3be8d..51977ca 100644 ---- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c -+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c -@@ -63,8 +63,8 @@ static enum htc_phymode ath9k_htc_get_curmode(struct ath9k_htc_priv *priv, - return mode; - } - --static bool ath9k_htc_setpower(struct ath9k_htc_priv *priv, -- enum ath9k_power_mode mode) -+bool ath9k_htc_setpower(struct ath9k_htc_priv *priv, -+ enum ath9k_power_mode mode) - { - bool ret; - -diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c -index 6ebc68b..c7fbe25 100644 ---- a/drivers/net/wireless/ath/ath9k/hw.c -+++ b/drivers/net/wireless/ath/ath9k/hw.c -@@ -2044,7 +2044,8 @@ u32 ath9k_hw_gpio_get(struct ath_hw *ah, u32 gpio) - val = REG_READ(ah, AR7010_GPIO_IN); - return (MS(val, AR7010_GPIO_IN_VAL) & AR_GPIO_BIT(gpio)) == 0; - } else if (AR_SREV_9300_20_OR_LATER(ah)) -- return MS_REG_READ(AR9300, gpio) != 0; -+ return (MS(REG_READ(ah, AR_GPIO_IN), AR9300_GPIO_IN_VAL) & -+ AR_GPIO_BIT(gpio)) != 0; - else if (AR_SREV_9271(ah)) - return MS_REG_READ(AR9271, gpio) != 0; - else if (AR_SREV_9287_11_OR_LATER(ah)) -diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c -index 92bc5c5..14b8ab3 100644 ---- a/drivers/net/wireless/ath/ath9k/init.c -+++ b/drivers/net/wireless/ath/ath9k/init.c -@@ -15,7 +15,6 @@ - */ - - #include --#include - - #include "ath9k.h" - -@@ -180,8 +179,6 @@ static const struct ath_ops ath9k_common_ops = { - .write = ath9k_iowrite32, - }; - --struct pm_qos_request_list ath9k_pm_qos_req; -- - /**************************/ - /* Initialization */ - /**************************/ -@@ -664,6 +661,8 @@ void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw) - hw->flags |= IEEE80211_HW_MFP_CAPABLE; - - hw->wiphy->interface_modes = -+ BIT(NL80211_IFTYPE_P2P_GO) | -+ BIT(NL80211_IFTYPE_P2P_CLIENT) | - BIT(NL80211_IFTYPE_AP) | - BIT(NL80211_IFTYPE_WDS) | - BIT(NL80211_IFTYPE_STATION) | -@@ -759,7 +758,7 @@ int ath9k_init_device(u16 devid, struct ath_softc *sc, u16 subsysid, - ath_init_leds(sc); - ath_start_rfkill_poll(sc); - -- pm_qos_add_request(&ath9k_pm_qos_req, PM_QOS_CPU_DMA_LATENCY, -+ pm_qos_add_request(&sc->pm_qos_req, PM_QOS_CPU_DMA_LATENCY, - PM_QOS_DEFAULT_VALUE); - - return 0; -@@ -830,7 +829,7 @@ void ath9k_deinit_device(struct ath_softc *sc) - } - - ieee80211_unregister_hw(hw); -- pm_qos_remove_request(&ath9k_pm_qos_req); -+ pm_qos_remove_request(&sc->pm_qos_req); - ath_rx_cleanup(sc); - ath_tx_cleanup(sc); - ath9k_deinit_softc(sc); -diff --git a/drivers/net/wireless/ath/ath9k/mac.c b/drivers/net/wireless/ath/ath9k/mac.c -index 8c13479..c996963 100644 ---- a/drivers/net/wireless/ath/ath9k/mac.c -+++ b/drivers/net/wireless/ath/ath9k/mac.c -@@ -703,8 +703,7 @@ int ath9k_hw_rxprocdesc(struct ath_hw *ah, struct ath_desc *ds, - rs->rs_phyerr = phyerr; - } else if (ads.ds_rxstatus8 & AR_DecryptCRCErr) - rs->rs_status |= ATH9K_RXERR_DECRYPT; -- else if ((ads.ds_rxstatus8 & AR_MichaelErr) && -- rs->rs_keyix != ATH9K_RXKEYIX_INVALID) -+ else if (ads.ds_rxstatus8 & AR_MichaelErr) - rs->rs_status |= ATH9K_RXERR_MIC; - else if (ads.ds_rxstatus8 & AR_KeyMiss) - rs->rs_status |= ATH9K_RXERR_DECRYPT; -diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c -index 25d3ef4..c0c3464 100644 ---- a/drivers/net/wireless/ath/ath9k/main.c -+++ b/drivers/net/wireless/ath/ath9k/main.c -@@ -15,7 +15,6 @@ - */ - - #include --#include - #include "ath9k.h" - #include "btcoex.h" - -@@ -245,11 +244,12 @@ int ath_set_channel(struct ath_softc *sc, struct ieee80211_hw *hw, - * the relevant bits of the h/w. - */ - ath9k_hw_set_interrupts(ah, 0); -- ath_drain_all_txq(sc, false); -+ stopped = ath_drain_all_txq(sc, false); - - spin_lock_bh(&sc->rx.pcu_lock); - -- stopped = ath_stoprecv(sc); -+ if (!ath_stoprecv(sc)) -+ stopped = false; - - /* XXX: do not flush receive queue here. We don't want - * to flush data frames already in queue because of -@@ -1244,7 +1244,7 @@ static int ath9k_start(struct ieee80211_hw *hw) - ath9k_btcoex_timer_resume(sc); - } - -- pm_qos_update_request(&ath9k_pm_qos_req, 55); -+ pm_qos_update_request(&sc->pm_qos_req, 55); - - mutex_unlock: - mutex_unlock(&sc->mutex); -@@ -1423,7 +1423,7 @@ static void ath9k_stop(struct ieee80211_hw *hw) - - sc->sc_flags |= SC_OP_INVALID; - -- pm_qos_update_request(&ath9k_pm_qos_req, PM_QOS_DEFAULT_VALUE); -+ pm_qos_update_request(&sc->pm_qos_req, PM_QOS_DEFAULT_VALUE); - - mutex_unlock(&sc->mutex); - -@@ -1520,7 +1520,6 @@ static void ath9k_remove_interface(struct ieee80211_hw *hw, - struct ath_softc *sc = aphy->sc; - struct ath_common *common = ath9k_hw_common(sc->sc_ah); - struct ath_vif *avp = (void *)vif->drv_priv; -- int i; - - ath_print(common, ATH_DBG_CONFIG, "Detach Interface\n"); - -@@ -1534,21 +1533,24 @@ static void ath9k_remove_interface(struct ieee80211_hw *hw, - if ((sc->sc_ah->opmode == NL80211_IFTYPE_AP) || - (sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC) || - (sc->sc_ah->opmode == NL80211_IFTYPE_MESH_POINT)) { -+ /* Disable SWBA interrupt */ -+ sc->sc_ah->imask &= ~ATH9K_INT_SWBA; - ath9k_ps_wakeup(sc); -+ ath9k_hw_set_interrupts(sc->sc_ah, sc->sc_ah->imask); - ath9k_hw_stoptxdma(sc->sc_ah, sc->beacon.beaconq); - ath9k_ps_restore(sc); -+ tasklet_kill(&sc->bcon_tasklet); - } - - ath_beacon_return(sc, avp); - sc->sc_flags &= ~SC_OP_BEACONS; - -- for (i = 0; i < ARRAY_SIZE(sc->beacon.bslot); i++) { -- if (sc->beacon.bslot[i] == vif) { -- printk(KERN_DEBUG "%s: vif had allocated beacon " -- "slot\n", __func__); -- sc->beacon.bslot[i] = NULL; -- sc->beacon.bslot_aphy[i] = NULL; -- } -+ if (sc->nbcnvifs) { -+ /* Re-enable SWBA interrupt */ -+ sc->sc_ah->imask |= ATH9K_INT_SWBA; -+ ath9k_ps_wakeup(sc); -+ ath9k_hw_set_interrupts(sc->sc_ah, sc->sc_ah->imask); -+ ath9k_ps_restore(sc); - } - - sc->nvifs--; -diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c -index 1a62e35..fdc2ec5 100644 ---- a/drivers/net/wireless/ath/ath9k/recv.c -+++ b/drivers/net/wireless/ath/ath9k/recv.c -@@ -838,6 +838,10 @@ static bool ath9k_rx_accept(struct ath_common *common, - struct ath_rx_status *rx_stats, - bool *decrypt_error) - { -+#define is_mc_or_valid_tkip_keyix ((is_mc || \ -+ (rx_stats->rs_keyix != ATH9K_RXKEYIX_INVALID && \ -+ test_bit(rx_stats->rs_keyix, common->tkip_keymap)))) -+ - struct ath_hw *ah = common->ah; - __le16 fc; - u8 rx_status_len = ah->caps.rx_status_len; -@@ -879,15 +883,18 @@ static bool ath9k_rx_accept(struct ath_common *common, - if (rx_stats->rs_status & ATH9K_RXERR_DECRYPT) { - *decrypt_error = true; - } else if (rx_stats->rs_status & ATH9K_RXERR_MIC) { -+ bool is_mc; - /* - * The MIC error bit is only valid if the frame - * is not a control frame or fragment, and it was - * decrypted using a valid TKIP key. - */ -+ is_mc = !!is_multicast_ether_addr(hdr->addr1); -+ - if (!ieee80211_is_ctl(fc) && - !ieee80211_has_morefrags(fc) && - !(le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_FRAG) && -- test_bit(rx_stats->rs_keyix, common->tkip_keymap)) -+ is_mc_or_valid_tkip_keyix) - rxs->flag |= RX_FLAG_MMIC_ERROR; - else - rx_stats->rs_status &= ~ATH9K_RXERR_MIC; -diff --git a/drivers/net/wireless/ath/ath9k/reg.h b/drivers/net/wireless/ath/ath9k/reg.h -index dddf579..2c6a22f 100644 ---- a/drivers/net/wireless/ath/ath9k/reg.h -+++ b/drivers/net/wireless/ath/ath9k/reg.h -@@ -984,11 +984,13 @@ enum { - #define AR9287_GPIO_IN_VAL_S 11 - #define AR9271_GPIO_IN_VAL 0xFFFF0000 - #define AR9271_GPIO_IN_VAL_S 16 --#define AR9300_GPIO_IN_VAL 0x0001FFFF --#define AR9300_GPIO_IN_VAL_S 0 - #define AR7010_GPIO_IN_VAL 0x0000FFFF - #define AR7010_GPIO_IN_VAL_S 0 - -+#define AR_GPIO_IN 0x404c -+#define AR9300_GPIO_IN_VAL 0x0001FFFF -+#define AR9300_GPIO_IN_VAL_S 0 -+ - #define AR_GPIO_OE_OUT (AR_SREV_9300_20_OR_LATER(ah) ? 0x4050 : 0x404c) - #define AR_GPIO_OE_OUT_DRV 0x3 - #define AR_GPIO_OE_OUT_DRV_NO 0x0 -diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c -index f2ade24..aff0478 100644 ---- a/drivers/net/wireless/ath/ath9k/xmit.c -+++ b/drivers/net/wireless/ath/ath9k/xmit.c -@@ -1120,7 +1120,7 @@ void ath_draintxq(struct ath_softc *sc, struct ath_txq *txq, bool retry_tx) - } - } - --void ath_drain_all_txq(struct ath_softc *sc, bool retry_tx) -+bool ath_drain_all_txq(struct ath_softc *sc, bool retry_tx) - { - struct ath_hw *ah = sc->sc_ah; - struct ath_common *common = ath9k_hw_common(sc->sc_ah); -@@ -1128,7 +1128,7 @@ void ath_drain_all_txq(struct ath_softc *sc, bool retry_tx) - int i, npend = 0; - - if (sc->sc_flags & SC_OP_INVALID) -- return; -+ return true; - - /* Stop beacon queue */ - ath9k_hw_stoptxdma(sc->sc_ah, sc->beacon.beaconq); -@@ -1142,25 +1142,15 @@ void ath_drain_all_txq(struct ath_softc *sc, bool retry_tx) - } - } - -- if (npend) { -- int r; -- -- ath_print(common, ATH_DBG_FATAL, -- "Failed to stop TX DMA. Resetting hardware!\n"); -- -- spin_lock_bh(&sc->sc_resetlock); -- r = ath9k_hw_reset(ah, sc->sc_ah->curchan, ah->caldata, false); -- if (r) -- ath_print(common, ATH_DBG_FATAL, -- "Unable to reset hardware; reset status %d\n", -- r); -- spin_unlock_bh(&sc->sc_resetlock); -- } -+ if (npend) -+ ath_print(common, ATH_DBG_FATAL, "Failed to stop TX DMA!\n"); - - for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) { - if (ATH_TXQ_SETUP(sc, i)) - ath_draintxq(sc, &sc->tx.txq[i], retry_tx); - } -+ -+ return !npend; - } - - void ath_tx_cleanupq(struct ath_softc *sc, struct ath_txq *txq) -diff --git a/drivers/net/wireless/ath/carl9170/fw.c b/drivers/net/wireless/ath/carl9170/fw.c -index ae6c006..546b4e4 100644 ---- a/drivers/net/wireless/ath/carl9170/fw.c -+++ b/drivers/net/wireless/ath/carl9170/fw.c -@@ -291,7 +291,8 @@ static int carl9170_fw(struct ar9170 *ar, const __u8 *data, size_t len) - - if (SUPP(CARL9170FW_WLANTX_CAB)) { - ar->hw->wiphy->interface_modes |= -- BIT(NL80211_IFTYPE_AP); -+ BIT(NL80211_IFTYPE_AP) | -+ BIT(NL80211_IFTYPE_P2P_GO); - } - } - -diff --git a/drivers/net/wireless/ath/carl9170/main.c b/drivers/net/wireless/ath/carl9170/main.c -index a314c2c..dc7b30b 100644 ---- a/drivers/net/wireless/ath/carl9170/main.c -+++ b/drivers/net/wireless/ath/carl9170/main.c -@@ -1631,7 +1631,8 @@ void *carl9170_alloc(size_t priv_size) - * supports these modes. The code which will add the - * additional interface_modes is in fw.c. - */ -- hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION); -+ hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | -+ BIT(NL80211_IFTYPE_P2P_CLIENT); - - hw->flags |= IEEE80211_HW_RX_INCLUDES_FCS | - IEEE80211_HW_REPORTS_TX_ACK_STATUS | -diff --git a/drivers/net/wireless/ath/carl9170/tx.c b/drivers/net/wireless/ath/carl9170/tx.c -index b575c86..7e6506a 100644 ---- a/drivers/net/wireless/ath/carl9170/tx.c -+++ b/drivers/net/wireless/ath/carl9170/tx.c -@@ -810,7 +810,7 @@ static int carl9170_tx_prepare(struct ar9170 *ar, struct sk_buff *skb) - - mac_tmp = cpu_to_le16(AR9170_TX_MAC_HW_DURATION | - AR9170_TX_MAC_BACKOFF); -- mac_tmp |= cpu_to_le16((hw_queue << AR9170_TX_MAC_QOS_S) && -+ mac_tmp |= cpu_to_le16((hw_queue << AR9170_TX_MAC_QOS_S) & - AR9170_TX_MAC_QOS); - - no_ack = !!(info->flags & IEEE80211_TX_CTL_NO_ACK); -diff --git a/drivers/net/wireless/libertas/if_sdio.c b/drivers/net/wireless/libertas/if_sdio.c -index e5685dc..b4de0ca 100644 ---- a/drivers/net/wireless/libertas/if_sdio.c -+++ b/drivers/net/wireless/libertas/if_sdio.c -@@ -1170,7 +1170,6 @@ static void if_sdio_remove(struct sdio_func *func) - lbs_deb_sdio("call remove card\n"); - lbs_stop_card(card->priv); - lbs_remove_card(card->priv); -- card->priv->surpriseremoved = 1; - - flush_workqueue(card->workqueue); - destroy_workqueue(card->workqueue); -diff --git a/drivers/net/wireless/libertas/if_spi.c b/drivers/net/wireless/libertas/if_spi.c -index 79bcb4e..ecd4d04 100644 ---- a/drivers/net/wireless/libertas/if_spi.c -+++ b/drivers/net/wireless/libertas/if_spi.c -@@ -1055,7 +1055,6 @@ static int __devexit libertas_spi_remove(struct spi_device *spi) - lbs_stop_card(priv); - lbs_remove_card(priv); /* will call free_netdev */ - -- priv->surpriseremoved = 1; - free_irq(spi->irq, card); - if_spi_terminate_spi_thread(card); - if (card->pdata->teardown) -diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c -index 46b88b1..fcd1bbf 100644 ---- a/drivers/net/wireless/libertas/main.c -+++ b/drivers/net/wireless/libertas/main.c -@@ -915,8 +915,6 @@ void lbs_remove_card(struct lbs_private *priv) - - lbs_free_adapter(priv); - lbs_cfg_free(priv); -- -- priv->dev = NULL; - free_netdev(dev); - - lbs_deb_leave(LBS_DEB_MAIN); -diff --git a/drivers/net/wireless/orinoco/main.c b/drivers/net/wireless/orinoco/main.c -index e8e2d0f..f3d396e 100644 ---- a/drivers/net/wireless/orinoco/main.c -+++ b/drivers/net/wireless/orinoco/main.c -@@ -1392,10 +1392,9 @@ static void orinoco_process_scan_results(struct work_struct *work) - orinoco_add_hostscan_results(priv, buf, len); - - kfree(buf); -- } else if (priv->scan_request) { -+ } else { - /* Either abort or complete the scan */ -- cfg80211_scan_done(priv->scan_request, (len < 0)); -- priv->scan_request = NULL; -+ orinoco_scan_done(priv, (len < 0)); - } - - spin_lock_irqsave(&priv->scan_lock, flags); -@@ -1684,6 +1683,8 @@ static int __orinoco_down(struct orinoco_private *priv) - hermes_write_regn(hw, EVACK, 0xffff); - } - -+ orinoco_scan_done(priv, true); -+ - /* firmware will have to reassociate */ - netif_carrier_off(dev); - priv->last_linkstatus = 0xffff; -@@ -1762,10 +1763,7 @@ void orinoco_reset(struct work_struct *work) - orinoco_unlock(priv, &flags); - - /* Scanning support: Notify scan cancellation */ -- if (priv->scan_request) { -- cfg80211_scan_done(priv->scan_request, 1); -- priv->scan_request = NULL; -- } -+ orinoco_scan_done(priv, true); - - if (priv->hard_reset) { - err = (*priv->hard_reset)(priv); -@@ -1813,6 +1811,12 @@ static int __orinoco_commit(struct orinoco_private *priv) - struct net_device *dev = priv->ndev; - int err = 0; - -+ /* If we've called commit, we are reconfiguring or bringing the -+ * interface up. Maintaining countermeasures across this would -+ * be confusing, so note that we've disabled them. The port will -+ * be enabled later in orinoco_commit or __orinoco_up. */ -+ priv->tkip_cm_active = 0; -+ - err = orinoco_hw_program_rids(priv); - - /* FIXME: what about netif_tx_lock */ -diff --git a/drivers/net/wireless/orinoco/orinoco_cs.c b/drivers/net/wireless/orinoco/orinoco_cs.c -index 71b3d68..32954c4 100644 ---- a/drivers/net/wireless/orinoco/orinoco_cs.c -+++ b/drivers/net/wireless/orinoco/orinoco_cs.c -@@ -151,20 +151,20 @@ orinoco_cs_config(struct pcmcia_device *link) - goto failed; - } - -- ret = pcmcia_request_irq(link, orinoco_interrupt); -- if (ret) -- goto failed; -- -- /* We initialize the hermes structure before completing PCMCIA -- * configuration just in case the interrupt handler gets -- * called. */ - mem = ioport_map(link->resource[0]->start, - resource_size(link->resource[0])); - if (!mem) - goto failed; - -+ /* We initialize the hermes structure before completing PCMCIA -+ * configuration just in case the interrupt handler gets -+ * called. */ - hermes_struct_init(hw, mem, HERMES_16BIT_REGSPACING); - -+ ret = pcmcia_request_irq(link, orinoco_interrupt); -+ if (ret) -+ goto failed; -+ - ret = pcmcia_enable_device(link); - if (ret) - goto failed; -diff --git a/drivers/net/wireless/orinoco/scan.c b/drivers/net/wireless/orinoco/scan.c -index 4300d9d..86cb54c 100644 ---- a/drivers/net/wireless/orinoco/scan.c -+++ b/drivers/net/wireless/orinoco/scan.c -@@ -229,3 +229,11 @@ void orinoco_add_hostscan_results(struct orinoco_private *priv, - priv->scan_request = NULL; - } - } -+ -+void orinoco_scan_done(struct orinoco_private *priv, bool abort) -+{ -+ if (priv->scan_request) { -+ cfg80211_scan_done(priv->scan_request, abort); -+ priv->scan_request = NULL; -+ } -+} -diff --git a/drivers/net/wireless/orinoco/scan.h b/drivers/net/wireless/orinoco/scan.h -index 2dc4e04..27281fb 100644 ---- a/drivers/net/wireless/orinoco/scan.h -+++ b/drivers/net/wireless/orinoco/scan.h -@@ -16,5 +16,6 @@ void orinoco_add_extscan_result(struct orinoco_private *priv, - void orinoco_add_hostscan_results(struct orinoco_private *dev, - unsigned char *buf, - size_t len); -+void orinoco_scan_done(struct orinoco_private *priv, bool abort); - - #endif /* _ORINOCO_SCAN_H_ */ -diff --git a/drivers/net/wireless/orinoco/spectrum_cs.c b/drivers/net/wireless/orinoco/spectrum_cs.c -index fb859a5..db34c28 100644 ---- a/drivers/net/wireless/orinoco/spectrum_cs.c -+++ b/drivers/net/wireless/orinoco/spectrum_cs.c -@@ -214,21 +214,21 @@ spectrum_cs_config(struct pcmcia_device *link) - goto failed; - } - -- ret = pcmcia_request_irq(link, orinoco_interrupt); -- if (ret) -- goto failed; -- -- /* We initialize the hermes structure before completing PCMCIA -- * configuration just in case the interrupt handler gets -- * called. */ - mem = ioport_map(link->resource[0]->start, - resource_size(link->resource[0])); - if (!mem) - goto failed; - -+ /* We initialize the hermes structure before completing PCMCIA -+ * configuration just in case the interrupt handler gets -+ * called. */ - hermes_struct_init(hw, mem, HERMES_16BIT_REGSPACING); - hw->eeprom_pda = true; - -+ ret = pcmcia_request_irq(link, orinoco_interrupt); -+ if (ret) -+ goto failed; -+ - ret = pcmcia_enable_device(link); - if (ret) - goto failed; -diff --git a/drivers/net/wireless/orinoco/wext.c b/drivers/net/wireless/orinoco/wext.c -index 93505f9..e5afabe 100644 ---- a/drivers/net/wireless/orinoco/wext.c -+++ b/drivers/net/wireless/orinoco/wext.c -@@ -911,10 +911,10 @@ static int orinoco_ioctl_set_auth(struct net_device *dev, - */ - if (param->value) { - priv->tkip_cm_active = 1; -- ret = hermes_enable_port(hw, 0); -+ ret = hermes_disable_port(hw, 0); - } else { - priv->tkip_cm_active = 0; -- ret = hermes_disable_port(hw, 0); -+ ret = hermes_enable_port(hw, 0); - } - break; - -diff --git a/drivers/platform/x86/asus-laptop.c b/drivers/platform/x86/asus-laptop.c -index 60a5a5c..d235f44 100644 ---- a/drivers/platform/x86/asus-laptop.c -+++ b/drivers/platform/x86/asus-laptop.c -@@ -81,6 +81,8 @@ MODULE_PARM_DESC(wapf, "WAPF value"); - - static int wlan_status = 1; - static int bluetooth_status = 1; -+static int wimax_status = -1; -+static int wwan_status = -1; - - module_param(wlan_status, int, 0444); - MODULE_PARM_DESC(wlan_status, "Set the wireless status on boot " -@@ -92,6 +94,16 @@ MODULE_PARM_DESC(bluetooth_status, "Set the wireless status on boot " - "(0 = disabled, 1 = enabled, -1 = don't do anything). " - "default is 1"); - -+module_param(wimax_status, int, 0444); -+MODULE_PARM_DESC(wimax_status, "Set the wireless status on boot " -+ "(0 = disabled, 1 = enabled, -1 = don't do anything). " -+ "default is 1"); -+ -+module_param(wwan_status, int, 0444); -+MODULE_PARM_DESC(wwan_status, "Set the wireless status on boot " -+ "(0 = disabled, 1 = enabled, -1 = don't do anything). " -+ "default is 1"); -+ - /* - * Some events we use, same for all Asus - */ -@@ -114,6 +126,8 @@ MODULE_PARM_DESC(bluetooth_status, "Set the wireless status on boot " - */ - #define WL_RSTS 0x01 /* internal Wifi */ - #define BT_RSTS 0x02 /* internal Bluetooth */ -+#define WM_RSTS 0x08 /* internal wimax */ -+#define WW_RSTS 0x20 /* internal wwan */ - - /* LED */ - #define METHOD_MLED "MLED" -@@ -132,6 +146,11 @@ MODULE_PARM_DESC(bluetooth_status, "Set the wireless status on boot " - */ - #define METHOD_WLAN "WLED" - #define METHOD_BLUETOOTH "BLED" -+ -+/* WWAN and WIMAX */ -+#define METHOD_WWAN "GSMC" -+#define METHOD_WIMAX "WMXC" -+ - #define METHOD_WL_STATUS "RSTS" - - /* Brightness */ -@@ -883,6 +902,64 @@ static ssize_t store_bluetooth(struct device *dev, - } - - /* -+ * Wimax -+ */ -+static int asus_wimax_set(struct asus_laptop *asus, int status) -+{ -+ if (write_acpi_int(asus->handle, METHOD_WIMAX, !!status)) { -+ pr_warning("Error setting wimax status to %d", status); -+ return -EIO; -+ } -+ return 0; -+} -+ -+static ssize_t show_wimax(struct device *dev, -+ struct device_attribute *attr, char *buf) -+{ -+ struct asus_laptop *asus = dev_get_drvdata(dev); -+ -+ return sprintf(buf, "%d\n", asus_wireless_status(asus, WM_RSTS)); -+} -+ -+static ssize_t store_wimax(struct device *dev, -+ struct device_attribute *attr, const char *buf, -+ size_t count) -+{ -+ struct asus_laptop *asus = dev_get_drvdata(dev); -+ -+ return sysfs_acpi_set(asus, buf, count, METHOD_WIMAX); -+} -+ -+/* -+ * Wwan -+ */ -+static int asus_wwan_set(struct asus_laptop *asus, int status) -+{ -+ if (write_acpi_int(asus->handle, METHOD_WWAN, !!status)) { -+ pr_warning("Error setting wwan status to %d", status); -+ return -EIO; -+ } -+ return 0; -+} -+ -+static ssize_t show_wwan(struct device *dev, -+ struct device_attribute *attr, char *buf) -+{ -+ struct asus_laptop *asus = dev_get_drvdata(dev); -+ -+ return sprintf(buf, "%d\n", asus_wireless_status(asus, WW_RSTS)); -+} -+ -+static ssize_t store_wwan(struct device *dev, -+ struct device_attribute *attr, const char *buf, -+ size_t count) -+{ -+ struct asus_laptop *asus = dev_get_drvdata(dev); -+ -+ return sysfs_acpi_set(asus, buf, count, METHOD_WWAN); -+} -+ -+/* - * Display - */ - static void asus_set_display(struct asus_laptop *asus, int value) -@@ -1202,6 +1279,8 @@ static DEVICE_ATTR(infos, S_IRUGO, show_infos, NULL); - static DEVICE_ATTR(wlan, S_IRUGO | S_IWUSR, show_wlan, store_wlan); - static DEVICE_ATTR(bluetooth, S_IRUGO | S_IWUSR, - show_bluetooth, store_bluetooth); -+static DEVICE_ATTR(wimax, S_IRUGO | S_IWUSR, show_wimax, store_wimax); -+static DEVICE_ATTR(wwan, S_IRUGO | S_IWUSR, show_wwan, store_wwan); - static DEVICE_ATTR(display, S_IRUGO | S_IWUSR, show_disp, store_disp); - static DEVICE_ATTR(ledd, S_IRUGO | S_IWUSR, show_ledd, store_ledd); - static DEVICE_ATTR(ls_level, S_IRUGO | S_IWUSR, show_lslvl, store_lslvl); -@@ -1212,6 +1291,8 @@ static struct attribute *asus_attributes[] = { - &dev_attr_infos.attr, - &dev_attr_wlan.attr, - &dev_attr_bluetooth.attr, -+ &dev_attr_wimax.attr, -+ &dev_attr_wwan.attr, - &dev_attr_display.attr, - &dev_attr_ledd.attr, - &dev_attr_ls_level.attr, -@@ -1239,6 +1320,13 @@ static mode_t asus_sysfs_is_visible(struct kobject *kobj, - } else if (attr == &dev_attr_display.attr) { - supported = !acpi_check_handle(handle, METHOD_SWITCH_DISPLAY, NULL); - -+ } else if (attr == &dev_attr_wimax.attr) { -+ supported = -+ !acpi_check_handle(asus->handle, METHOD_WIMAX, NULL); -+ -+ } else if (attr == &dev_attr_wwan.attr) { -+ supported = !acpi_check_handle(asus->handle, METHOD_WWAN, NULL); -+ - } else if (attr == &dev_attr_ledd.attr) { - supported = !acpi_check_handle(handle, METHOD_LEDD, NULL); - -@@ -1397,7 +1485,8 @@ static int asus_laptop_get_info(struct asus_laptop *asus) - - /* - * The HWRS method return informations about the hardware. -- * 0x80 bit is for WLAN, 0x100 for Bluetooth. -+ * 0x80 bit is for WLAN, 0x100 for Bluetooth, -+ * 0x40 for WWAN, 0x10 for WIMAX. - * The significance of others is yet to be found. - */ - status = -@@ -1440,6 +1529,12 @@ static int __devinit asus_acpi_init(struct asus_laptop *asus) - if (wlan_status >= 0) - asus_wlan_set(asus, !!wlan_status); - -+ if (wimax_status >= 0) -+ asus_wimax_set(asus, !!wimax_status); -+ -+ if (wwan_status >= 0) -+ asus_wwan_set(asus, !!wwan_status); -+ - /* Keyboard Backlight is on by default */ - if (!acpi_check_handle(asus->handle, METHOD_KBD_LIGHT_SET, NULL)) - asus_kled_set(asus, 1); -diff --git a/drivers/platform/x86/eeepc-wmi.c b/drivers/platform/x86/eeepc-wmi.c -index 462ceab..0d50fbb 100644 ---- a/drivers/platform/x86/eeepc-wmi.c -+++ b/drivers/platform/x86/eeepc-wmi.c -@@ -298,8 +298,8 @@ static void eeepc_wmi_notify(u32 value, void *context) - kfree(obj); - } - --static int store_cpufv(struct device *dev, struct device_attribute *attr, -- const char *buf, size_t count) -+static ssize_t store_cpufv(struct device *dev, struct device_attribute *attr, -+ const char *buf, size_t count) - { - int value; - struct acpi_buffer input = { (acpi_size)sizeof(value), &value }; -diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c -index 1dac659..9e05af9 100644 ---- a/drivers/platform/x86/hp-wmi.c -+++ b/drivers/platform/x86/hp-wmi.c -@@ -172,6 +172,8 @@ static int hp_wmi_perform_query(int query, int write, u32 *buffer, - bios_return = *((struct bios_return *)obj->buffer.pointer); - - memcpy(buffer, &bios_return.value, sizeof(bios_return.value)); -+ -+ kfree(obj); - return 0; - } - -diff --git a/drivers/platform/x86/ibm_rtl.c b/drivers/platform/x86/ibm_rtl.c -index 3c2c6b9..94a114a 100644 ---- a/drivers/platform/x86/ibm_rtl.c -+++ b/drivers/platform/x86/ibm_rtl.c -@@ -28,6 +28,7 @@ - #include - #include - #include -+#include - #include - #include - -@@ -220,32 +221,13 @@ static void rtl_teardown_sysfs(void) { - sysdev_class_unregister(&class_rtl); - } - --static int dmi_check_cb(const struct dmi_system_id *id) --{ -- RTL_DEBUG("found IBM server '%s'\n", id->ident); -- return 0; --} -- --#define ibm_dmi_entry(NAME, TYPE) \ --{ \ -- .ident = NAME, \ -- .matches = { \ -- DMI_MATCH(DMI_SYS_VENDOR, "IBM"), \ -- DMI_MATCH(DMI_PRODUCT_NAME, TYPE), \ -- }, \ -- .callback = dmi_check_cb \ --} - - static struct dmi_system_id __initdata ibm_rtl_dmi_table[] = { -- ibm_dmi_entry("BladeCenter LS21", "7971"), -- ibm_dmi_entry("BladeCenter LS22", "7901"), -- ibm_dmi_entry("BladeCenter HS21 XM", "7995"), -- ibm_dmi_entry("BladeCenter HS22", "7870"), -- ibm_dmi_entry("BladeCenter HS22V", "7871"), -- ibm_dmi_entry("System x3550 M2", "7946"), -- ibm_dmi_entry("System x3650 M2", "7947"), -- ibm_dmi_entry("System x3550 M3", "7944"), -- ibm_dmi_entry("System x3650 M3", "7945"), -+ { \ -+ .matches = { \ -+ DMI_MATCH(DMI_SYS_VENDOR, "IBM"), \ -+ }, \ -+ }, - { } - }; - -@@ -257,7 +239,7 @@ static int __init ibm_rtl_init(void) { - if (force) - pr_warning("ibm-rtl: module loaded by force\n"); - /* first ensure that we are running on IBM HW */ -- else if (!dmi_check_system(ibm_rtl_dmi_table)) -+ else if (efi_enabled || !dmi_check_system(ibm_rtl_dmi_table)) - return -ENODEV; - - /* Get the address for the Extended BIOS Data Area */ -@@ -302,7 +284,7 @@ static int __init ibm_rtl_init(void) { - RTL_DEBUG("rtl_cmd_width = %u, rtl_cmd_type = %u\n", - rtl_cmd_width, rtl_cmd_type); - addr = ioread32(&rtl_table->cmd_port_address); -- RTL_DEBUG("addr = %#llx\n", addr); -+ RTL_DEBUG("addr = %#llx\n", (unsigned long long)addr); - plen = rtl_cmd_width/sizeof(char); - rtl_cmd_addr = rtl_port_map(addr, plen); - RTL_DEBUG("rtl_cmd_addr = %#llx\n", (u64)rtl_cmd_addr); -diff --git a/drivers/platform/x86/msi-wmi.c b/drivers/platform/x86/msi-wmi.c -index 42a5469..35278ad 100644 ---- a/drivers/platform/x86/msi-wmi.c -+++ b/drivers/platform/x86/msi-wmi.c -@@ -43,16 +43,18 @@ MODULE_ALIAS("wmi:B6F3EEF2-3D2F-49DC-9DE3-85BCE18C62F2"); - - #define dprintk(msg...) pr_debug(DRV_PFX msg) - --#define KEYCODE_BASE 0xD0 --#define MSI_WMI_BRIGHTNESSUP KEYCODE_BASE --#define MSI_WMI_BRIGHTNESSDOWN (KEYCODE_BASE + 1) --#define MSI_WMI_VOLUMEUP (KEYCODE_BASE + 2) --#define MSI_WMI_VOLUMEDOWN (KEYCODE_BASE + 3) -+#define SCANCODE_BASE 0xD0 -+#define MSI_WMI_BRIGHTNESSUP SCANCODE_BASE -+#define MSI_WMI_BRIGHTNESSDOWN (SCANCODE_BASE + 1) -+#define MSI_WMI_VOLUMEUP (SCANCODE_BASE + 2) -+#define MSI_WMI_VOLUMEDOWN (SCANCODE_BASE + 3) -+#define MSI_WMI_MUTE (SCANCODE_BASE + 4) - static struct key_entry msi_wmi_keymap[] = { - { KE_KEY, MSI_WMI_BRIGHTNESSUP, {KEY_BRIGHTNESSUP} }, - { KE_KEY, MSI_WMI_BRIGHTNESSDOWN, {KEY_BRIGHTNESSDOWN} }, - { KE_KEY, MSI_WMI_VOLUMEUP, {KEY_VOLUMEUP} }, - { KE_KEY, MSI_WMI_VOLUMEDOWN, {KEY_VOLUMEDOWN} }, -+ { KE_KEY, MSI_WMI_MUTE, {KEY_MUTE} }, - { KE_END, 0} - }; - static ktime_t last_pressed[ARRAY_SIZE(msi_wmi_keymap) - 1]; -@@ -169,7 +171,7 @@ static void msi_wmi_notify(u32 value, void *context) - ktime_t diff; - cur = ktime_get_real(); - diff = ktime_sub(cur, last_pressed[key->code - -- KEYCODE_BASE]); -+ SCANCODE_BASE]); - /* Ignore event if the same event happened in a 50 ms - timeframe -> Key press may result in 10-20 GPEs */ - if (ktime_to_us(diff) < 1000 * 50) { -@@ -178,7 +180,7 @@ static void msi_wmi_notify(u32 value, void *context) - key->code, ktime_to_us(diff)); - return; - } -- last_pressed[key->code - KEYCODE_BASE] = cur; -+ last_pressed[key->code - SCANCODE_BASE] = cur; - - if (key->type == KE_KEY && - /* Brightness is served via acpi video driver */ -diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c -index 2d61186..e8c2199 100644 ---- a/drivers/platform/x86/thinkpad_acpi.c -+++ b/drivers/platform/x86/thinkpad_acpi.c -@@ -8497,7 +8497,6 @@ static void ibm_exit(struct ibm_struct *ibm) - ibm->acpi->type, - dispatch_acpi_notify); - ibm->flags.acpi_notify_installed = 0; -- ibm->flags.acpi_notify_installed = 0; - } - - if (ibm->flags.proc_created) { -diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c -index 06f304f..4276da7 100644 ---- a/drivers/platform/x86/toshiba_acpi.c -+++ b/drivers/platform/x86/toshiba_acpi.c -@@ -135,6 +135,7 @@ static const struct key_entry toshiba_acpi_keymap[] __initconst = { - { KE_KEY, 0x141, { KEY_BRIGHTNESSUP } }, - { KE_KEY, 0x142, { KEY_WLAN } }, - { KE_KEY, 0x143, { KEY_PROG1 } }, -+ { KE_KEY, 0x17f, { KEY_FN } }, - { KE_KEY, 0xb05, { KEY_PROG2 } }, - { KE_KEY, 0xb06, { KEY_WWW } }, - { KE_KEY, 0xb07, { KEY_MAIL } }, -diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c -index 104b77c..aecd9a9 100644 ---- a/drivers/platform/x86/wmi.c -+++ b/drivers/platform/x86/wmi.c -@@ -755,7 +755,7 @@ static bool guid_already_parsed(const char *guid_string) - struct wmi_block *wblock; - - list_for_each_entry(wblock, &wmi_block_list, list) -- if (strncmp(wblock->gblock.guid, guid_string, 16) == 0) -+ if (memcmp(wblock->gblock.guid, guid_string, 16) == 0) - return true; - - return false; -diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c -index 2d73dfc..57313f4 100644 ---- a/drivers/pnp/pnpacpi/core.c -+++ b/drivers/pnp/pnpacpi/core.c -@@ -180,7 +180,7 @@ struct pnp_protocol pnpacpi_protocol = { - }; - EXPORT_SYMBOL(pnpacpi_protocol); - --static char *pnpacpi_get_id(struct acpi_device *device) -+static char *__init pnpacpi_get_id(struct acpi_device *device) - { - struct acpi_hardware_id *id; - -diff --git a/drivers/regulator/tps6586x-regulator.c b/drivers/regulator/tps6586x-regulator.c -index 51237fb..6d20b04 100644 ---- a/drivers/regulator/tps6586x-regulator.c -+++ b/drivers/regulator/tps6586x-regulator.c -@@ -231,8 +231,7 @@ static int tps6586x_dvm_voltages[] = { - }; - - #define TPS6586X_REGULATOR(_id, vdata, _ops, vreg, shift, nbits, \ -- ereg0, ebit0, ereg1, ebit1, goreg, gobit) \ --{ \ -+ ereg0, ebit0, ereg1, ebit1) \ - .desc = { \ - .name = "REG-" #_id, \ - .ops = &tps6586x_regulator_##_ops, \ -@@ -248,18 +247,26 @@ static int tps6586x_dvm_voltages[] = { - .enable_bit[0] = (ebit0), \ - .enable_reg[1] = TPS6586X_SUPPLY##ereg1, \ - .enable_bit[1] = (ebit1), \ -- .voltages = tps6586x_##vdata##_voltages, \ --} -+ .voltages = tps6586x_##vdata##_voltages, -+ -+#define TPS6586X_REGULATOR_DVM_GOREG(goreg, gobit) \ -+ .go_reg = TPS6586X_##goreg, \ -+ .go_bit = (gobit), - - #define TPS6586X_LDO(_id, vdata, vreg, shift, nbits, \ - ereg0, ebit0, ereg1, ebit1) \ -+{ \ - TPS6586X_REGULATOR(_id, vdata, ldo_ops, vreg, shift, nbits, \ -- ereg0, ebit0, ereg1, ebit1, 0, 0) -+ ereg0, ebit0, ereg1, ebit1) \ -+} - - #define TPS6586X_DVM(_id, vdata, vreg, shift, nbits, \ - ereg0, ebit0, ereg1, ebit1, goreg, gobit) \ -+{ \ - TPS6586X_REGULATOR(_id, vdata, dvm_ops, vreg, shift, nbits, \ -- ereg0, ebit0, ereg1, ebit1, goreg, gobit) -+ ereg0, ebit0, ereg1, ebit1) \ -+ TPS6586X_REGULATOR_DVM_GOREG(goreg, gobit) \ -+} - - static struct tps6586x_regulator tps6586x_regulator[] = { - TPS6586X_LDO(LDO_0, ldo, SUPPLYV1, 5, 3, ENC, 0, END, 0), -@@ -267,11 +274,11 @@ static struct tps6586x_regulator tps6586x_regulator[] = { - TPS6586X_LDO(LDO_5, ldo, SUPPLYV6, 0, 3, ENE, 6, ENE, 6), - TPS6586X_LDO(LDO_6, ldo, SUPPLYV3, 0, 3, ENC, 4, END, 4), - TPS6586X_LDO(LDO_7, ldo, SUPPLYV3, 3, 3, ENC, 5, END, 5), -- TPS6586X_LDO(LDO_8, ldo, SUPPLYV1, 5, 3, ENC, 6, END, 6), -+ TPS6586X_LDO(LDO_8, ldo, SUPPLYV2, 5, 3, ENC, 6, END, 6), - TPS6586X_LDO(LDO_9, ldo, SUPPLYV6, 3, 3, ENE, 7, ENE, 7), -- TPS6586X_LDO(LDO_RTC, ldo, SUPPLYV4, 3, 3, ENE, 7, ENE, 7), -+ TPS6586X_LDO(LDO_RTC, ldo, SUPPLYV4, 3, 3, V4, 7, V4, 7), - TPS6586X_LDO(LDO_1, dvm, SUPPLYV1, 0, 5, ENC, 1, END, 1), -- TPS6586X_LDO(SM_2, sm2, SUPPLYV2, 0, 5, ENC, 1, END, 1), -+ TPS6586X_LDO(SM_2, sm2, SUPPLYV2, 0, 5, ENC, 7, END, 7), - - TPS6586X_DVM(LDO_2, dvm, LDO2BV1, 0, 5, ENA, 3, ENB, 3, VCC2, 6), - TPS6586X_DVM(LDO_4, ldo4, LDO4V1, 0, 5, ENC, 3, END, 3, VCC1, 6), -@@ -290,6 +297,10 @@ static inline int tps6586x_regulator_preinit(struct device *parent, - uint8_t val1, val2; - int ret; - -+ if (ri->enable_reg[0] == ri->enable_reg[1] && -+ ri->enable_bit[0] == ri->enable_bit[1]) -+ return 0; -+ - ret = tps6586x_read(parent, ri->enable_reg[0], &val1); - if (ret) - return ret; -@@ -298,14 +309,14 @@ static inline int tps6586x_regulator_preinit(struct device *parent, - if (ret) - return ret; - -- if (!(val2 & ri->enable_bit[1])) -+ if (!(val2 & (1 << ri->enable_bit[1]))) - return 0; - - /* - * The regulator is on, but it's enabled with the bit we don't - * want to use, so we switch the enable bits - */ -- if (!(val1 & ri->enable_bit[0])) { -+ if (!(val1 & (1 << ri->enable_bit[0]))) { - ret = tps6586x_set_bits(parent, ri->enable_reg[0], - 1 << ri->enable_bit[0]); - if (ret) -diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c -index a5050e2..825951b 100644 ---- a/drivers/s390/cio/css.c -+++ b/drivers/s390/cio/css.c -@@ -635,7 +635,7 @@ static void css_process_crw(struct crw *crw0, struct crw *crw1, int overflow) - init_subchannel_id(&mchk_schid); - mchk_schid.sch_no = crw0->rsid; - if (crw1) -- mchk_schid.ssid = (crw1->rsid >> 8) & 3; -+ mchk_schid.ssid = (crw1->rsid >> 4) & 3; - - /* - * Since we are always presented with IPI in the CRW, we have to -diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c -index d37c733..0bcd580 100644 ---- a/drivers/s390/scsi/zfcp_erp.c -+++ b/drivers/s390/scsi/zfcp_erp.c -@@ -156,6 +156,8 @@ static int zfcp_erp_required_act(int want, struct zfcp_adapter *adapter, - if (!(a_status & ZFCP_STATUS_COMMON_RUNNING) || - a_status & ZFCP_STATUS_COMMON_ERP_FAILED) - return 0; -+ if (p_status & ZFCP_STATUS_COMMON_NOESC) -+ return need; - if (!(a_status & ZFCP_STATUS_COMMON_UNBLOCKED)) - need = ZFCP_ERP_ACTION_REOPEN_ADAPTER; - /* fall through */ -@@ -188,6 +190,9 @@ static struct zfcp_erp_action *zfcp_erp_setup_act(int need, u32 act_status, - atomic_set_mask(ZFCP_STATUS_COMMON_ERP_INUSE, - &zfcp_sdev->status); - erp_action = &zfcp_sdev->erp_action; -+ memset(erp_action, 0, sizeof(struct zfcp_erp_action)); -+ erp_action->port = port; -+ erp_action->sdev = sdev; - if (!(atomic_read(&zfcp_sdev->status) & - ZFCP_STATUS_COMMON_RUNNING)) - act_status |= ZFCP_STATUS_ERP_CLOSE_ONLY; -@@ -200,6 +205,8 @@ static struct zfcp_erp_action *zfcp_erp_setup_act(int need, u32 act_status, - zfcp_erp_action_dismiss_port(port); - atomic_set_mask(ZFCP_STATUS_COMMON_ERP_INUSE, &port->status); - erp_action = &port->erp_action; -+ memset(erp_action, 0, sizeof(struct zfcp_erp_action)); -+ erp_action->port = port; - if (!(atomic_read(&port->status) & ZFCP_STATUS_COMMON_RUNNING)) - act_status |= ZFCP_STATUS_ERP_CLOSE_ONLY; - break; -@@ -209,6 +216,7 @@ static struct zfcp_erp_action *zfcp_erp_setup_act(int need, u32 act_status, - zfcp_erp_action_dismiss_adapter(adapter); - atomic_set_mask(ZFCP_STATUS_COMMON_ERP_INUSE, &adapter->status); - erp_action = &adapter->erp_action; -+ memset(erp_action, 0, sizeof(struct zfcp_erp_action)); - if (!(atomic_read(&adapter->status) & - ZFCP_STATUS_COMMON_RUNNING)) - act_status |= ZFCP_STATUS_ERP_CLOSE_ONLY; -@@ -218,10 +226,7 @@ static struct zfcp_erp_action *zfcp_erp_setup_act(int need, u32 act_status, - return NULL; - } - -- memset(erp_action, 0, sizeof(struct zfcp_erp_action)); - erp_action->adapter = adapter; -- erp_action->port = port; -- erp_action->sdev = sdev; - erp_action->action = need; - erp_action->status = act_status; - -diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c -index be03174..2eb7dd5 100644 ---- a/drivers/s390/scsi/zfcp_fsf.c -+++ b/drivers/s390/scsi/zfcp_fsf.c -@@ -851,7 +851,7 @@ struct zfcp_fsf_req *zfcp_fsf_abort_fcp_cmnd(struct scsi_cmnd *scmnd) - - zfcp_qdio_set_sbale_last(qdio, &req->qdio_req); - -- req->data = zfcp_sdev; -+ req->data = sdev; - req->handler = zfcp_fsf_abort_fcp_command_handler; - req->qtcb->header.lun_handle = zfcp_sdev->lun_handle; - req->qtcb->header.port_handle = zfcp_sdev->port->handle; -@@ -2069,8 +2069,6 @@ static void zfcp_fsf_fcp_cmnd_handler(struct zfcp_fsf_req *req) - struct fcp_resp_with_ext *fcp_rsp; - unsigned long flags; - -- zfcp_fsf_fcp_handler_common(req); -- - read_lock_irqsave(&req->adapter->abort_lock, flags); - - scpnt = req->data; -@@ -2079,6 +2077,8 @@ static void zfcp_fsf_fcp_cmnd_handler(struct zfcp_fsf_req *req) - return; - } - -+ zfcp_fsf_fcp_handler_common(req); -+ - if (unlikely(req->status & ZFCP_STATUS_FSFREQ_ERROR)) { - set_host_byte(scpnt, DID_TRANSPORT_DISRUPTED); - goto skip_fsfstatus; -@@ -2170,12 +2170,13 @@ int zfcp_fsf_fcp_cmnd(struct scsi_cmnd *scsi_cmnd) - struct zfcp_adapter *adapter = zfcp_sdev->port->adapter; - struct zfcp_qdio *qdio = adapter->qdio; - struct fsf_qtcb_bottom_io *io; -+ unsigned long flags; - - if (unlikely(!(atomic_read(&zfcp_sdev->status) & - ZFCP_STATUS_COMMON_UNBLOCKED))) - return -EBUSY; - -- spin_lock(&qdio->req_q_lock); -+ spin_lock_irqsave(&qdio->req_q_lock, flags); - if (atomic_read(&qdio->req_q_free) <= 0) { - atomic_inc(&qdio->req_q_full); - goto out; -@@ -2239,7 +2240,7 @@ failed_scsi_cmnd: - zfcp_fsf_req_free(req); - scsi_cmnd->host_scribble = NULL; - out: -- spin_unlock(&qdio->req_q_lock); -+ spin_unlock_irqrestore(&qdio->req_q_lock, flags); - return retval; - } - -diff --git a/drivers/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c -index 6bd2dbc..63529ed 100644 ---- a/drivers/s390/scsi/zfcp_scsi.c -+++ b/drivers/s390/scsi/zfcp_scsi.c -@@ -76,8 +76,8 @@ static void zfcp_scsi_command_fail(struct scsi_cmnd *scpnt, int result) - scpnt->scsi_done(scpnt); - } - --static int zfcp_scsi_queuecommand_lck(struct scsi_cmnd *scpnt, -- void (*done) (struct scsi_cmnd *)) -+static -+int zfcp_scsi_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scpnt) - { - struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(scpnt->device); - struct zfcp_adapter *adapter = zfcp_sdev->port->adapter; -@@ -87,7 +87,6 @@ static int zfcp_scsi_queuecommand_lck(struct scsi_cmnd *scpnt, - /* reset the status for this request */ - scpnt->result = 0; - scpnt->host_scribble = NULL; -- scpnt->scsi_done = done; - - scsi_result = fc_remote_port_chkready(rport); - if (unlikely(scsi_result)) { -@@ -127,8 +126,6 @@ static int zfcp_scsi_queuecommand_lck(struct scsi_cmnd *scpnt, - return ret; - } - --static DEF_SCSI_QCMD(zfcp_scsi_queuecommand) -- - static int zfcp_scsi_slave_alloc(struct scsi_device *sdev) - { - struct fc_rport *rport = starget_to_rport(scsi_target(sdev)); -diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c -index b2fb2b2..a6dea08 100644 ---- a/drivers/scsi/hpsa.c -+++ b/drivers/scsi/hpsa.c -@@ -90,11 +90,7 @@ static const struct pci_device_id hpsa_pci_device_id[] = { - {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x3252}, - {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x3253}, - {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSE, 0x103C, 0x3254}, --#define PCI_DEVICE_ID_HP_CISSF 0x333f -- {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSF, 0x103C, 0x333F}, -- {PCI_VENDOR_ID_HP, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, -- PCI_CLASS_STORAGE_RAID << 8, 0xffff << 8, 0}, -- {PCI_VENDOR_ID_COMPAQ, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, -+ {PCI_VENDOR_ID_HP, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, - PCI_CLASS_STORAGE_RAID << 8, 0xffff << 8, 0}, - {0,} - }; -@@ -113,8 +109,6 @@ static struct board_type products[] = { - {0x3249103C, "Smart Array P812", &SA5_access}, - {0x324a103C, "Smart Array P712m", &SA5_access}, - {0x324b103C, "Smart Array P711m", &SA5_access}, -- {0x3233103C, "StorageWorks P1210m", &SA5_access}, -- {0x333F103C, "StorageWorks P1210m", &SA5_access}, - {0x3250103C, "Smart Array", &SA5_access}, - {0x3250113C, "Smart Array", &SA5_access}, - {0x3250123C, "Smart Array", &SA5_access}, -diff --git a/drivers/scsi/osd/osd_initiator.c b/drivers/scsi/osd/osd_initiator.c -index 0433ea6..b37c8a3 100644 ---- a/drivers/scsi/osd/osd_initiator.c -+++ b/drivers/scsi/osd/osd_initiator.c -@@ -951,8 +951,8 @@ static int _osd_req_finalize_cdb_cont(struct osd_request *or, const u8 *cap_key) - /* create a bio for continuation segment */ - bio = bio_map_kern(req_q, or->cdb_cont.buff, or->cdb_cont.total_bytes, - GFP_KERNEL); -- if (unlikely(!bio)) -- return -ENOMEM; -+ if (IS_ERR(bio)) -+ return PTR_ERR(bio); - - bio->bi_rw |= REQ_WRITE; - -diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c -index 5e76a62..300d59f 100644 ---- a/drivers/scsi/pmcraid.c -+++ b/drivers/scsi/pmcraid.c -@@ -62,6 +62,7 @@ - static unsigned int pmcraid_debug_log; - static unsigned int pmcraid_disable_aen; - static unsigned int pmcraid_log_level = IOASC_LOG_LEVEL_MUST; -+static unsigned int pmcraid_enable_msix; - - /* - * Data structures to support multiple adapters by the LLD. -@@ -4691,7 +4692,8 @@ pmcraid_register_interrupt_handler(struct pmcraid_instance *pinstance) - int rc; - struct pci_dev *pdev = pinstance->pdev; - -- if (pci_find_capability(pdev, PCI_CAP_ID_MSIX)) { -+ if ((pmcraid_enable_msix) && -+ (pci_find_capability(pdev, PCI_CAP_ID_MSIX))) { - int num_hrrq = PMCRAID_NUM_MSIX_VECTORS; - struct msix_entry entries[PMCRAID_NUM_MSIX_VECTORS]; - int i; -diff --git a/drivers/scsi/pmcraid.h b/drivers/scsi/pmcraid.h -index 1134279..4db210d 100644 ---- a/drivers/scsi/pmcraid.h -+++ b/drivers/scsi/pmcraid.h -@@ -42,7 +42,7 @@ - */ - #define PMCRAID_DRIVER_NAME "PMC MaxRAID" - #define PMCRAID_DEVFILE "pmcsas" --#define PMCRAID_DRIVER_VERSION "2.0.3" -+#define PMCRAID_DRIVER_VERSION "1.0.3" - #define PMCRAID_DRIVER_DATE __DATE__ - - #define PMCRAID_FW_VERSION_1 0x002 -@@ -333,11 +333,9 @@ struct pmcraid_config_table_entry { - __u8 lun[PMCRAID_LUN_LEN]; - } __attribute__((packed, aligned(4))); - --/* extended configuration table sizes are of 64 bytes in size */ --#define PMCRAID_CFGTE_EXT_SIZE 32 -+/* extended configuration table sizes are also of 32 bytes in size */ - struct pmcraid_config_table_entry_ext { - struct pmcraid_config_table_entry cfgte; -- __u8 cfgte_ext[PMCRAID_CFGTE_EXT_SIZE]; - }; - - /* resource types (config_table_entry.resource_type values) */ -diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h -index 3a22eff..9ce539d 100644 ---- a/drivers/scsi/qla2xxx/qla_def.h -+++ b/drivers/scsi/qla2xxx/qla_def.h -@@ -2409,7 +2409,6 @@ struct qla_hw_data { - uint32_t enable_target_reset :1; - uint32_t enable_lip_full_login :1; - uint32_t enable_led_scheme :1; -- uint32_t inta_enabled :1; - uint32_t msi_enabled :1; - uint32_t msix_enabled :1; - uint32_t disable_serdes :1; -diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c -index 5f94430..4c1ba62 100644 ---- a/drivers/scsi/qla2xxx/qla_iocb.c -+++ b/drivers/scsi/qla2xxx/qla_iocb.c -@@ -1061,6 +1061,7 @@ qla24xx_build_scsi_crc_2_iocbs(srb_t *sp, struct cmd_type_crc_2 *cmd_pkt, - fcp_cmnd->additional_cdb_len |= 2; - - int_to_scsilun(sp->cmd->device->lun, &fcp_cmnd->lun); -+ host_to_fcp_swap((uint8_t *)&fcp_cmnd->lun, sizeof(fcp_cmnd->lun)); - memcpy(fcp_cmnd->cdb, cmd->cmnd, cmd->cmd_len); - cmd_pkt->fcp_cmnd_dseg_len = cpu_to_le16(fcp_cmnd_len); - cmd_pkt->fcp_cmnd_dseg_address[0] = cpu_to_le32( -diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c -index 1f06ddd..7f77898 100644 ---- a/drivers/scsi/qla2xxx/qla_isr.c -+++ b/drivers/scsi/qla2xxx/qla_isr.c -@@ -2491,14 +2491,15 @@ skip_msix: - skip_msi: - - ret = request_irq(ha->pdev->irq, ha->isp_ops->intr_handler, -- IRQF_SHARED, QLA2XXX_DRIVER_NAME, rsp); -+ ha->flags.msi_enabled ? 0 : IRQF_SHARED, -+ QLA2XXX_DRIVER_NAME, rsp); - if (ret) { - qla_printk(KERN_WARNING, ha, - "Failed to reserve interrupt %d already in use.\n", - ha->pdev->irq); - goto fail; - } -- ha->flags.inta_enabled = 1; -+ - clear_risc_ints: - - /* -diff --git a/drivers/scsi/qla2xxx/qla_nx.c b/drivers/scsi/qla2xxx/qla_nx.c -index 8d9edfb..ae2acac 100644 ---- a/drivers/scsi/qla2xxx/qla_nx.c -+++ b/drivers/scsi/qla2xxx/qla_nx.c -@@ -2749,6 +2749,7 @@ sufficient_dsds: - goto queuing_error_fcp_cmnd; - - int_to_scsilun(sp->cmd->device->lun, &cmd_pkt->lun); -+ host_to_fcp_swap((uint8_t *)&cmd_pkt->lun, sizeof(cmd_pkt->lun)); - - /* build FCP_CMND IU */ - memset(ctx->fcp_cmnd, 0, sizeof(struct fcp_cmnd)); -diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c -index 1644eab..2c0876c 100644 ---- a/drivers/scsi/qla2xxx/qla_os.c -+++ b/drivers/scsi/qla2xxx/qla_os.c -@@ -829,7 +829,7 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd) - { - scsi_qla_host_t *vha = shost_priv(cmd->device->host); - srb_t *sp; -- int ret; -+ int ret = SUCCESS; - unsigned int id, lun; - unsigned long flags; - int wait = 0; -@@ -2064,6 +2064,7 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) - ha->init_cb_size = sizeof(struct mid_init_cb_81xx); - ha->gid_list_info_size = 8; - ha->optrom_size = OPTROM_SIZE_82XX; -+ ha->nvram_npiv_size = QLA_MAX_VPORTS_QLA25XX; - ha->isp_ops = &qla82xx_isp_ops; - ha->flash_conf_off = FARX_ACCESS_FLASH_CONF; - ha->flash_data_off = FARX_ACCESS_FLASH_DATA; -diff --git a/drivers/scsi/qla2xxx/qla_version.h b/drivers/scsi/qla2xxx/qla_version.h -index 8edbccb..cf0075a 100644 ---- a/drivers/scsi/qla2xxx/qla_version.h -+++ b/drivers/scsi/qla2xxx/qla_version.h -@@ -7,9 +7,9 @@ - /* - * Driver version - */ --#define QLA2XXX_VERSION "8.03.04-k0" -+#define QLA2XXX_VERSION "8.03.05-k0" - - #define QLA_DRIVER_MAJOR_VER 8 - #define QLA_DRIVER_MINOR_VER 3 --#define QLA_DRIVER_PATCH_VER 4 -+#define QLA_DRIVER_PATCH_VER 5 - #define QLA_DRIVER_BETA_VER 0 -diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c -index 824b8fc..30ac116 100644 ---- a/drivers/scsi/scsi_error.c -+++ b/drivers/scsi/scsi_error.c -@@ -615,7 +615,7 @@ static int scsi_try_bus_device_reset(struct scsi_cmnd *scmd) - return rtn; - } - --static int __scsi_try_to_abort_cmd(struct scsi_cmnd *scmd) -+static int scsi_try_to_abort_cmd(struct scsi_cmnd *scmd) - { - if (!scmd->device->host->hostt->eh_abort_handler) - return FAILED; -@@ -623,31 +623,9 @@ static int __scsi_try_to_abort_cmd(struct scsi_cmnd *scmd) - return scmd->device->host->hostt->eh_abort_handler(scmd); - } - --/** -- * scsi_try_to_abort_cmd - Ask host to abort a running command. -- * @scmd: SCSI cmd to abort from Lower Level. -- * -- * Notes: -- * This function will not return until the user's completion function -- * has been called. there is no timeout on this operation. if the -- * author of the low-level driver wishes this operation to be timed, -- * they can provide this facility themselves. helper functions in -- * scsi_error.c can be supplied to make this easier to do. -- */ --static int scsi_try_to_abort_cmd(struct scsi_cmnd *scmd) --{ -- /* -- * scsi_done was called just after the command timed out and before -- * we had a chance to process it. (db) -- */ -- if (scmd->serial_number == 0) -- return SUCCESS; -- return __scsi_try_to_abort_cmd(scmd); --} -- - static void scsi_abort_eh_cmnd(struct scsi_cmnd *scmd) - { -- if (__scsi_try_to_abort_cmd(scmd) != SUCCESS) -+ if (scsi_try_to_abort_cmd(scmd) != SUCCESS) - if (scsi_try_bus_device_reset(scmd) != SUCCESS) - if (scsi_try_target_reset(scmd) != SUCCESS) - if (scsi_try_bus_reset(scmd) != SUCCESS) -diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c -index eafeeda..5b6bbae 100644 ---- a/drivers/scsi/scsi_lib.c -+++ b/drivers/scsi/scsi_lib.c -@@ -1403,11 +1403,6 @@ static void scsi_softirq_done(struct request *rq) - - INIT_LIST_HEAD(&cmd->eh_entry); - -- /* -- * Set the serial numbers back to zero -- */ -- cmd->serial_number = 0; -- - atomic_inc(&cmd->device->iodone_cnt); - if (cmd->result) - atomic_inc(&cmd->device->ioerr_cnt); -diff --git a/drivers/serial/kgdboc.c b/drivers/serial/kgdboc.c -index 3374618..25a8bc5 100644 ---- a/drivers/serial/kgdboc.c -+++ b/drivers/serial/kgdboc.c -@@ -90,7 +90,8 @@ static DECLARE_WORK(kgdboc_restore_input_work, kgdboc_restore_input_helper); - - static void kgdboc_restore_input(void) - { -- schedule_work(&kgdboc_restore_input_work); -+ if (likely(system_state == SYSTEM_RUNNING)) -+ schedule_work(&kgdboc_restore_input_work); - } - - static int kgdboc_register_kbd(char **cptr) -diff --git a/drivers/spi/dw_spi.c b/drivers/spi/dw_spi.c -index 9043931..0838c79 100644 ---- a/drivers/spi/dw_spi.c -+++ b/drivers/spi/dw_spi.c -@@ -413,6 +413,11 @@ static void poll_transfer(struct dw_spi *dws) - { - while (dws->write(dws)) - dws->read(dws); -+ /* -+ * There is a possibility that the last word of a transaction -+ * will be lost if data is not ready. Re-read to solve this issue. -+ */ -+ dws->read(dws); - - transfer_complete(dws); - } -diff --git a/drivers/usb/atm/usbatm.c b/drivers/usb/atm/usbatm.c -index 05bf5a2..989e16e 100644 ---- a/drivers/usb/atm/usbatm.c -+++ b/drivers/usb/atm/usbatm.c -@@ -951,7 +951,9 @@ static int usbatm_atm_init(struct usbatm_data *instance) - * condition: callbacks we register can be executed at once, before we have - * initialized the struct atm_dev. To protect against this, all callbacks - * abort if atm_dev->dev_data is NULL. */ -- atm_dev = atm_dev_register(instance->driver_name, &usbatm_atm_devops, -1, NULL); -+ atm_dev = atm_dev_register(instance->driver_name, -+ &instance->usb_intf->dev, &usbatm_atm_devops, -+ -1, NULL); - if (!atm_dev) { - usb_err(instance, "%s: failed to register ATM device!\n", __func__); - return -1; -@@ -966,14 +968,6 @@ static int usbatm_atm_init(struct usbatm_data *instance) - /* temp init ATM device, set to 128kbit */ - atm_dev->link_rate = 128 * 1000 / 424; - -- ret = sysfs_create_link(&atm_dev->class_dev.kobj, -- &instance->usb_intf->dev.kobj, "device"); -- if (ret) { -- atm_err(instance, "%s: sysfs_create_link failed: %d\n", -- __func__, ret); -- goto fail_sysfs; -- } -- - if (instance->driver->atm_start && ((ret = instance->driver->atm_start(instance, atm_dev)) < 0)) { - atm_err(instance, "%s: atm_start failed: %d!\n", __func__, ret); - goto fail; -@@ -992,8 +986,6 @@ static int usbatm_atm_init(struct usbatm_data *instance) - return 0; - - fail: -- sysfs_remove_link(&atm_dev->class_dev.kobj, "device"); -- fail_sysfs: - instance->atm_dev = NULL; - atm_dev_deregister(atm_dev); /* usbatm_atm_dev_close will eventually be called */ - return ret; -@@ -1329,7 +1321,6 @@ void usbatm_usb_disconnect(struct usb_interface *intf) - - /* ATM finalize */ - if (instance->atm_dev) { -- sysfs_remove_link(&instance->atm_dev->class_dev.kobj, "device"); - atm_dev_deregister(instance->atm_dev); - instance->atm_dev = NULL; - } -diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c -index 94701ff..159c77a 100644 ---- a/drivers/vhost/vhost.c -+++ b/drivers/vhost/vhost.c -@@ -884,6 +884,7 @@ static int log_write(void __user *log_base, - int r; - if (!write_length) - return 0; -+ write_length += write_address % VHOST_PAGE_SIZE; - write_address /= VHOST_PAGE_SIZE; - for (;;) { - u64 base = (u64)(unsigned long)log_base; -@@ -897,7 +898,7 @@ static int log_write(void __user *log_base, - if (write_length <= VHOST_PAGE_SIZE) - break; - write_length -= VHOST_PAGE_SIZE; -- write_address += VHOST_PAGE_SIZE; -+ write_address += 1; - } - return r; - } -diff --git a/drivers/video/modedb.c b/drivers/video/modedb.c -index 0a4dbdc..de450c1 100644 ---- a/drivers/video/modedb.c -+++ b/drivers/video/modedb.c -@@ -855,6 +855,7 @@ const struct fb_videomode *fb_find_nearest_mode(const struct fb_videomode *mode, - abs(cmode->yres - mode->yres); - if (diff > d) { - diff = d; -+ diff_refresh = abs(cmode->refresh - mode->refresh); - best = cmode; - } else if (diff == d) { - d = abs(cmode->refresh - mode->refresh); -diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c -index d5c1401..d34896c 100644 ---- a/fs/autofs4/root.c -+++ b/fs/autofs4/root.c -@@ -980,19 +980,11 @@ static int autofs4_root_ioctl_unlocked(struct inode *inode, struct file *filp, - } - } - --static DEFINE_MUTEX(autofs4_ioctl_mutex); -- - static long autofs4_root_ioctl(struct file *filp, - unsigned int cmd, unsigned long arg) - { -- long ret; - struct inode *inode = filp->f_dentry->d_inode; -- -- mutex_lock(&autofs4_ioctl_mutex); -- ret = autofs4_root_ioctl_unlocked(inode, filp, cmd, arg); -- mutex_unlock(&autofs4_ioctl_mutex); -- -- return ret; -+ return autofs4_root_ioctl_unlocked(inode, filp, cmd, arg); - } - - #ifdef CONFIG_COMPAT -@@ -1002,13 +994,11 @@ static long autofs4_root_compat_ioctl(struct file *filp, - struct inode *inode = filp->f_path.dentry->d_inode; - int ret; - -- mutex_lock(&autofs4_ioctl_mutex); - if (cmd == AUTOFS_IOC_READY || cmd == AUTOFS_IOC_FAIL) - ret = autofs4_root_ioctl_unlocked(inode, filp, cmd, arg); - else - ret = autofs4_root_ioctl_unlocked(inode, filp, cmd, - (unsigned long)compat_ptr(arg)); -- mutex_unlock(&autofs4_ioctl_mutex); - - return ret; - } -diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c -index c547cca..51d2e4d 100644 ---- a/fs/btrfs/disk-io.c -+++ b/fs/btrfs/disk-io.c -@@ -696,6 +696,7 @@ static int btree_submit_bio_hook(struct inode *inode, int rw, struct bio *bio, - __btree_submit_bio_done); - } - -+#ifdef CONFIG_MIGRATION - static int btree_migratepage(struct address_space *mapping, - struct page *newpage, struct page *page) - { -@@ -712,12 +713,9 @@ static int btree_migratepage(struct address_space *mapping, - if (page_has_private(page) && - !try_to_release_page(page, GFP_KERNEL)) - return -EAGAIN; --#ifdef CONFIG_MIGRATION - return migrate_page(mapping, newpage, page); --#else -- return -ENOSYS; --#endif - } -+#endif - - static int btree_writepage(struct page *page, struct writeback_control *wbc) - { -@@ -1009,7 +1007,10 @@ static int find_and_setup_root(struct btrfs_root *tree_root, - blocksize = btrfs_level_size(root, btrfs_root_level(&root->root_item)); - root->node = read_tree_block(root, btrfs_root_bytenr(&root->root_item), - blocksize, generation); -- BUG_ON(!root->node); -+ if (!root->node || !btrfs_buffer_uptodate(root->node, generation)) { -+ free_extent_buffer(root->node); -+ return -EIO; -+ } - root->commit_root = btrfs_root_node(root); - return 0; - } -diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c -index bcd59c7..227e581 100644 ---- a/fs/btrfs/extent-tree.c -+++ b/fs/btrfs/extent-tree.c -@@ -429,6 +429,7 @@ err: - - static int cache_block_group(struct btrfs_block_group_cache *cache, - struct btrfs_trans_handle *trans, -+ struct btrfs_root *root, - int load_cache_only) - { - struct btrfs_fs_info *fs_info = cache->fs_info; -@@ -442,9 +443,12 @@ static int cache_block_group(struct btrfs_block_group_cache *cache, - - /* - * We can't do the read from on-disk cache during a commit since we need -- * to have the normal tree locking. -+ * to have the normal tree locking. Also if we are currently trying to -+ * allocate blocks for the tree root we can't do the fast caching since -+ * we likely hold important locks. - */ -- if (!trans->transaction->in_commit) { -+ if (!trans->transaction->in_commit && -+ (root && root != root->fs_info->tree_root)) { - spin_lock(&cache->lock); - if (cache->cached != BTRFS_CACHE_NO) { - spin_unlock(&cache->lock); -@@ -2741,6 +2745,7 @@ static int cache_save_setup(struct btrfs_block_group_cache *block_group, - struct btrfs_root *root = block_group->fs_info->tree_root; - struct inode *inode = NULL; - u64 alloc_hint = 0; -+ int dcs = BTRFS_DC_ERROR; - int num_pages = 0; - int retries = 0; - int ret = 0; -@@ -2795,6 +2800,8 @@ again: - - spin_lock(&block_group->lock); - if (block_group->cached != BTRFS_CACHE_FINISHED) { -+ /* We're not cached, don't bother trying to write stuff out */ -+ dcs = BTRFS_DC_WRITTEN; - spin_unlock(&block_group->lock); - goto out_put; - } -@@ -2821,6 +2828,8 @@ again: - ret = btrfs_prealloc_file_range_trans(inode, trans, 0, 0, num_pages, - num_pages, num_pages, - &alloc_hint); -+ if (!ret) -+ dcs = BTRFS_DC_SETUP; - btrfs_free_reserved_data_space(inode, num_pages); - out_put: - iput(inode); -@@ -2828,10 +2837,7 @@ out_free: - btrfs_release_path(root, path); - out: - spin_lock(&block_group->lock); -- if (ret) -- block_group->disk_cache_state = BTRFS_DC_ERROR; -- else -- block_group->disk_cache_state = BTRFS_DC_SETUP; -+ block_group->disk_cache_state = dcs; - spin_unlock(&block_group->lock); - - return ret; -@@ -3037,7 +3043,13 @@ static void set_avail_alloc_bits(struct btrfs_fs_info *fs_info, u64 flags) - - u64 btrfs_reduce_alloc_profile(struct btrfs_root *root, u64 flags) - { -- u64 num_devices = root->fs_info->fs_devices->rw_devices; -+ /* -+ * we add in the count of missing devices because we want -+ * to make sure that any RAID levels on a degraded FS -+ * continue to be honored. -+ */ -+ u64 num_devices = root->fs_info->fs_devices->rw_devices + -+ root->fs_info->fs_devices->missing_devices; - - if (num_devices == 1) - flags &= ~(BTRFS_BLOCK_GROUP_RAID1 | BTRFS_BLOCK_GROUP_RAID0); -@@ -4080,7 +4092,7 @@ static int update_block_group(struct btrfs_trans_handle *trans, - * space back to the block group, otherwise we will leak space. - */ - if (!alloc && cache->cached == BTRFS_CACHE_NO) -- cache_block_group(cache, trans, 1); -+ cache_block_group(cache, trans, NULL, 1); - - byte_in_group = bytenr - cache->key.objectid; - WARN_ON(byte_in_group > cache->key.offset); -@@ -4930,11 +4942,31 @@ search: - btrfs_get_block_group(block_group); - search_start = block_group->key.objectid; - -+ /* -+ * this can happen if we end up cycling through all the -+ * raid types, but we want to make sure we only allocate -+ * for the proper type. -+ */ -+ if (!block_group_bits(block_group, data)) { -+ u64 extra = BTRFS_BLOCK_GROUP_DUP | -+ BTRFS_BLOCK_GROUP_RAID1 | -+ BTRFS_BLOCK_GROUP_RAID10; -+ -+ /* -+ * if they asked for extra copies and this block group -+ * doesn't provide them, bail. This does allow us to -+ * fill raid0 from raid1. -+ */ -+ if ((data & extra) && !(block_group->flags & extra)) -+ goto loop; -+ } -+ - have_block_group: - if (unlikely(block_group->cached == BTRFS_CACHE_NO)) { - u64 free_percent; - -- ret = cache_block_group(block_group, trans, 1); -+ ret = cache_block_group(block_group, trans, -+ orig_root, 1); - if (block_group->cached == BTRFS_CACHE_FINISHED) - goto have_block_group; - -@@ -4958,7 +4990,8 @@ have_block_group: - if (loop > LOOP_CACHING_NOWAIT || - (loop > LOOP_FIND_IDEAL && - atomic_read(&space_info->caching_threads) < 2)) { -- ret = cache_block_group(block_group, trans, 0); -+ ret = cache_block_group(block_group, trans, -+ orig_root, 0); - BUG_ON(ret); - } - found_uncached_bg = true; -@@ -5515,7 +5548,7 @@ int btrfs_alloc_logged_file_extent(struct btrfs_trans_handle *trans, - u64 num_bytes = ins->offset; - - block_group = btrfs_lookup_block_group(root->fs_info, ins->objectid); -- cache_block_group(block_group, trans, 0); -+ cache_block_group(block_group, trans, NULL, 0); - caching_ctl = get_caching_control(block_group); - - if (!caching_ctl) { -@@ -6300,9 +6333,13 @@ int btrfs_drop_snapshot(struct btrfs_root *root, - NULL, NULL); - BUG_ON(ret < 0); - if (ret > 0) { -- ret = btrfs_del_orphan_item(trans, tree_root, -- root->root_key.objectid); -- BUG_ON(ret); -+ /* if we fail to delete the orphan item this time -+ * around, it'll get picked up the next time. -+ * -+ * The most common failure here is just -ENOENT. -+ */ -+ btrfs_del_orphan_item(trans, tree_root, -+ root->root_key.objectid); - } - } - -@@ -7878,7 +7915,14 @@ static u64 update_block_group_flags(struct btrfs_root *root, u64 flags) - u64 stripped = BTRFS_BLOCK_GROUP_RAID0 | - BTRFS_BLOCK_GROUP_RAID1 | BTRFS_BLOCK_GROUP_RAID10; - -- num_devices = root->fs_info->fs_devices->rw_devices; -+ /* -+ * we add in the count of missing devices because we want -+ * to make sure that any RAID levels on a degraded FS -+ * continue to be honored. -+ */ -+ num_devices = root->fs_info->fs_devices->rw_devices + -+ root->fs_info->fs_devices->missing_devices; -+ - if (num_devices == 1) { - stripped |= BTRFS_BLOCK_GROUP_DUP; - stripped = flags & ~stripped; -@@ -8247,7 +8291,6 @@ int btrfs_read_block_groups(struct btrfs_root *root) - break; - if (ret != 0) - goto error; -- - leaf = path->nodes[0]; - btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]); - cache = kzalloc(sizeof(*cache), GFP_NOFS); -diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c -index c1faded..66836d8 100644 ---- a/fs/btrfs/file.c -+++ b/fs/btrfs/file.c -@@ -48,30 +48,34 @@ static noinline int btrfs_copy_from_user(loff_t pos, int num_pages, - struct page **prepared_pages, - struct iov_iter *i) - { -- size_t copied; -+ size_t copied = 0; - int pg = 0; - int offset = pos & (PAGE_CACHE_SIZE - 1); -+ int total_copied = 0; - - while (write_bytes > 0) { - size_t count = min_t(size_t, - PAGE_CACHE_SIZE - offset, write_bytes); - struct page *page = prepared_pages[pg]; --again: -- if (unlikely(iov_iter_fault_in_readable(i, count))) -- return -EFAULT; -- -- /* Copy data from userspace to the current page */ -- copied = iov_iter_copy_from_user(page, i, offset, count); -+ /* -+ * Copy data from userspace to the current page -+ * -+ * Disable pagefault to avoid recursive lock since -+ * the pages are already locked -+ */ -+ pagefault_disable(); -+ copied = iov_iter_copy_from_user_atomic(page, i, offset, count); -+ pagefault_enable(); - - /* Flush processor's dcache for this page */ - flush_dcache_page(page); - iov_iter_advance(i, copied); - write_bytes -= copied; -+ total_copied += copied; - -+ /* Return to btrfs_file_aio_write to fault page */ - if (unlikely(copied == 0)) { -- count = min_t(size_t, PAGE_CACHE_SIZE - offset, -- iov_iter_single_seg_count(i)); -- goto again; -+ break; - } - - if (unlikely(copied < PAGE_CACHE_SIZE - offset)) { -@@ -81,7 +85,7 @@ again: - offset = 0; - } - } -- return 0; -+ return total_copied; - } - - /* -@@ -854,6 +858,8 @@ static ssize_t btrfs_file_aio_write(struct kiocb *iocb, - unsigned long last_index; - int will_write; - int buffered = 0; -+ int copied = 0; -+ int dirty_pages = 0; - - will_write = ((file->f_flags & O_DSYNC) || IS_SYNC(inode) || - (file->f_flags & O_DIRECT)); -@@ -970,7 +976,17 @@ static ssize_t btrfs_file_aio_write(struct kiocb *iocb, - WARN_ON(num_pages > nrptrs); - memset(pages, 0, sizeof(struct page *) * nrptrs); - -- ret = btrfs_delalloc_reserve_space(inode, write_bytes); -+ /* -+ * Fault pages before locking them in prepare_pages -+ * to avoid recursive lock -+ */ -+ if (unlikely(iov_iter_fault_in_readable(&i, write_bytes))) { -+ ret = -EFAULT; -+ goto out; -+ } -+ -+ ret = btrfs_delalloc_reserve_space(inode, -+ num_pages << PAGE_CACHE_SHIFT); - if (ret) - goto out; - -@@ -978,37 +994,49 @@ static ssize_t btrfs_file_aio_write(struct kiocb *iocb, - pos, first_index, last_index, - write_bytes); - if (ret) { -- btrfs_delalloc_release_space(inode, write_bytes); -+ btrfs_delalloc_release_space(inode, -+ num_pages << PAGE_CACHE_SHIFT); - goto out; - } - -- ret = btrfs_copy_from_user(pos, num_pages, -+ copied = btrfs_copy_from_user(pos, num_pages, - write_bytes, pages, &i); -- if (ret == 0) { -+ dirty_pages = (copied + PAGE_CACHE_SIZE - 1) >> -+ PAGE_CACHE_SHIFT; -+ -+ if (num_pages > dirty_pages) { -+ if (copied > 0) -+ atomic_inc( -+ &BTRFS_I(inode)->outstanding_extents); -+ btrfs_delalloc_release_space(inode, -+ (num_pages - dirty_pages) << -+ PAGE_CACHE_SHIFT); -+ } -+ -+ if (copied > 0) { - dirty_and_release_pages(NULL, root, file, pages, -- num_pages, pos, write_bytes); -+ dirty_pages, pos, copied); - } - - btrfs_drop_pages(pages, num_pages); -- if (ret) { -- btrfs_delalloc_release_space(inode, write_bytes); -- goto out; -- } - -- if (will_write) { -- filemap_fdatawrite_range(inode->i_mapping, pos, -- pos + write_bytes - 1); -- } else { -- balance_dirty_pages_ratelimited_nr(inode->i_mapping, -- num_pages); -- if (num_pages < -- (root->leafsize >> PAGE_CACHE_SHIFT) + 1) -- btrfs_btree_balance_dirty(root, 1); -- btrfs_throttle(root); -+ if (copied > 0) { -+ if (will_write) { -+ filemap_fdatawrite_range(inode->i_mapping, pos, -+ pos + copied - 1); -+ } else { -+ balance_dirty_pages_ratelimited_nr( -+ inode->i_mapping, -+ dirty_pages); -+ if (dirty_pages < -+ (root->leafsize >> PAGE_CACHE_SHIFT) + 1) -+ btrfs_btree_balance_dirty(root, 1); -+ btrfs_throttle(root); -+ } - } - -- pos += write_bytes; -- num_written += write_bytes; -+ pos += copied; -+ num_written += copied; - - cond_resched(); - } -diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c -index 22ee0dc..60d6842 100644 ---- a/fs/btrfs/free-space-cache.c -+++ b/fs/btrfs/free-space-cache.c -@@ -290,7 +290,7 @@ int load_free_space_cache(struct btrfs_fs_info *fs_info, - (unsigned long long)BTRFS_I(inode)->generation, - (unsigned long long)generation, - (unsigned long long)block_group->key.objectid); -- goto out; -+ goto free_cache; - } - - if (!num_entries) -@@ -524,6 +524,12 @@ int btrfs_write_out_cache(struct btrfs_root *root, - return 0; - } - -+ node = rb_first(&block_group->free_space_offset); -+ if (!node) { -+ iput(inode); -+ return 0; -+ } -+ - last_index = (i_size_read(inode) - 1) >> PAGE_CACHE_SHIFT; - filemap_write_and_wait(inode->i_mapping); - btrfs_wait_ordered_range(inode, inode->i_size & -@@ -543,10 +549,6 @@ int btrfs_write_out_cache(struct btrfs_root *root, - */ - first_page_offset = (sizeof(u32) * num_checksums) + sizeof(u64); - -- node = rb_first(&block_group->free_space_offset); -- if (!node) -- goto out_free; -- - /* - * Lock all pages first so we can lock the extent safely. - * -diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c -index 8039390..72f31ec 100644 ---- a/fs/btrfs/inode.c -+++ b/fs/btrfs/inode.c -@@ -495,7 +495,7 @@ again: - add_async_extent(async_cow, start, num_bytes, - total_compressed, pages, nr_pages_ret); - -- if (start + num_bytes < end && start + num_bytes < actual_end) { -+ if (start + num_bytes < end) { - start += num_bytes; - pages = NULL; - cond_resched(); -@@ -5712,9 +5712,9 @@ static void btrfs_end_dio_bio(struct bio *bio, int err) - - if (err) { - printk(KERN_ERR "btrfs direct IO failed ino %lu rw %lu " -- "disk_bytenr %lu len %u err no %d\n", -- dip->inode->i_ino, bio->bi_rw, bio->bi_sector, -- bio->bi_size, err); -+ "sector %#Lx len %u err no %d\n", -+ dip->inode->i_ino, bio->bi_rw, -+ (unsigned long long)bio->bi_sector, bio->bi_size, err); - dip->errors = 1; - - /* -@@ -5934,8 +5934,7 @@ free_ordered: - */ - if (write) { - struct btrfs_ordered_extent *ordered; -- ordered = btrfs_lookup_ordered_extent(inode, -- dip->logical_offset); -+ ordered = btrfs_lookup_ordered_extent(inode, file_offset); - if (!test_bit(BTRFS_ORDERED_PREALLOC, &ordered->flags) && - !test_bit(BTRFS_ORDERED_NOCOW, &ordered->flags)) - btrfs_free_reserved_extent(root, ordered->start, -diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c -index f1c9bb4..f87552a 100644 ---- a/fs/btrfs/ioctl.c -+++ b/fs/btrfs/ioctl.c -@@ -947,23 +947,42 @@ out: - - static noinline int btrfs_ioctl_snap_create(struct file *file, - void __user *arg, int subvol, -- int async) -+ int v2) - { - struct btrfs_ioctl_vol_args *vol_args = NULL; -- struct btrfs_ioctl_async_vol_args *async_vol_args = NULL; -+ struct btrfs_ioctl_vol_args_v2 *vol_args_v2 = NULL; - char *name; - u64 fd; -- u64 transid = 0; - int ret; - -- if (async) { -- async_vol_args = memdup_user(arg, sizeof(*async_vol_args)); -- if (IS_ERR(async_vol_args)) -- return PTR_ERR(async_vol_args); -+ if (v2) { -+ u64 transid = 0; -+ u64 *ptr = NULL; - -- name = async_vol_args->name; -- fd = async_vol_args->fd; -- async_vol_args->name[BTRFS_SNAPSHOT_NAME_MAX] = '\0'; -+ vol_args_v2 = memdup_user(arg, sizeof(*vol_args_v2)); -+ if (IS_ERR(vol_args_v2)) -+ return PTR_ERR(vol_args_v2); -+ -+ if (vol_args_v2->flags & ~BTRFS_SUBVOL_CREATE_ASYNC) { -+ ret = -EINVAL; -+ goto out; -+ } -+ -+ name = vol_args_v2->name; -+ fd = vol_args_v2->fd; -+ vol_args_v2->name[BTRFS_SUBVOL_NAME_MAX] = '\0'; -+ -+ if (vol_args_v2->flags & BTRFS_SUBVOL_CREATE_ASYNC) -+ ptr = &transid; -+ -+ ret = btrfs_ioctl_snap_create_transid(file, name, fd, -+ subvol, ptr); -+ -+ if (ret == 0 && ptr && -+ copy_to_user(arg + -+ offsetof(struct btrfs_ioctl_vol_args_v2, -+ transid), ptr, sizeof(*ptr))) -+ ret = -EFAULT; - } else { - vol_args = memdup_user(arg, sizeof(*vol_args)); - if (IS_ERR(vol_args)) -@@ -971,20 +990,13 @@ static noinline int btrfs_ioctl_snap_create(struct file *file, - name = vol_args->name; - fd = vol_args->fd; - vol_args->name[BTRFS_PATH_NAME_MAX] = '\0'; -- } -- -- ret = btrfs_ioctl_snap_create_transid(file, name, fd, -- subvol, &transid); - -- if (!ret && async) { -- if (copy_to_user(arg + -- offsetof(struct btrfs_ioctl_async_vol_args, -- transid), &transid, sizeof(transid))) -- return -EFAULT; -+ ret = btrfs_ioctl_snap_create_transid(file, name, fd, -+ subvol, NULL); - } -- -+out: - kfree(vol_args); -- kfree(async_vol_args); -+ kfree(vol_args_v2); - - return ret; - } -@@ -2246,7 +2258,7 @@ long btrfs_ioctl(struct file *file, unsigned int - return btrfs_ioctl_getversion(file, argp); - case BTRFS_IOC_SNAP_CREATE: - return btrfs_ioctl_snap_create(file, argp, 0, 0); -- case BTRFS_IOC_SNAP_CREATE_ASYNC: -+ case BTRFS_IOC_SNAP_CREATE_V2: - return btrfs_ioctl_snap_create(file, argp, 0, 1); - case BTRFS_IOC_SUBVOL_CREATE: - return btrfs_ioctl_snap_create(file, argp, 1, 0); -diff --git a/fs/btrfs/ioctl.h b/fs/btrfs/ioctl.h -index 17c99eb..c344d12 100644 ---- a/fs/btrfs/ioctl.h -+++ b/fs/btrfs/ioctl.h -@@ -30,11 +30,15 @@ struct btrfs_ioctl_vol_args { - char name[BTRFS_PATH_NAME_MAX + 1]; - }; - --#define BTRFS_SNAPSHOT_NAME_MAX 4079 --struct btrfs_ioctl_async_vol_args { -+#define BTRFS_SUBVOL_CREATE_ASYNC (1ULL << 0) -+ -+#define BTRFS_SUBVOL_NAME_MAX 4039 -+struct btrfs_ioctl_vol_args_v2 { - __s64 fd; - __u64 transid; -- char name[BTRFS_SNAPSHOT_NAME_MAX + 1]; -+ __u64 flags; -+ __u64 unused[4]; -+ char name[BTRFS_SUBVOL_NAME_MAX + 1]; - }; - - #define BTRFS_INO_LOOKUP_PATH_MAX 4080 -@@ -187,6 +191,6 @@ struct btrfs_ioctl_space_args { - struct btrfs_ioctl_space_args) - #define BTRFS_IOC_START_SYNC _IOR(BTRFS_IOCTL_MAGIC, 24, __u64) - #define BTRFS_IOC_WAIT_SYNC _IOW(BTRFS_IOCTL_MAGIC, 22, __u64) --#define BTRFS_IOC_SNAP_CREATE_ASYNC _IOW(BTRFS_IOCTL_MAGIC, 23, \ -- struct btrfs_ioctl_async_vol_args) -+#define BTRFS_IOC_SNAP_CREATE_V2 _IOW(BTRFS_IOCTL_MAGIC, 23, \ -+ struct btrfs_ioctl_vol_args_v2) - #endif -diff --git a/fs/btrfs/orphan.c b/fs/btrfs/orphan.c -index 79cba5f..f8be250 100644 ---- a/fs/btrfs/orphan.c -+++ b/fs/btrfs/orphan.c -@@ -56,8 +56,12 @@ int btrfs_del_orphan_item(struct btrfs_trans_handle *trans, - return -ENOMEM; - - ret = btrfs_search_slot(trans, root, &key, path, -1, 1); -- if (ret) -+ if (ret < 0) - goto out; -+ if (ret) { -+ ret = -ENOENT; -+ goto out; -+ } - - ret = btrfs_del_item(trans, root, path); - -diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c -index dbb51ea..883c6fa 100644 ---- a/fs/btrfs/super.c -+++ b/fs/btrfs/super.c -@@ -685,9 +685,9 @@ static struct dentry *btrfs_mount(struct file_system_type *fs_type, int flags, - mutex_unlock(&root->d_inode->i_mutex); - - if (IS_ERR(new_root)) { -+ dput(root); - deactivate_locked_super(s); - error = PTR_ERR(new_root); -- dput(root); - goto error_free_subvol_name; - } - if (!new_root->d_inode) { -diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c -index cc04dc1..6b98845 100644 ---- a/fs/btrfs/volumes.c -+++ b/fs/btrfs/volumes.c -@@ -412,12 +412,16 @@ static noinline int device_list_add(const char *path, - - device->fs_devices = fs_devices; - fs_devices->num_devices++; -- } else if (strcmp(device->name, path)) { -+ } else if (!device->name || strcmp(device->name, path)) { - name = kstrdup(path, GFP_NOFS); - if (!name) - return -ENOMEM; - kfree(device->name); - device->name = name; -+ if (device->missing) { -+ fs_devices->missing_devices--; -+ device->missing = 0; -+ } - } - - if (found_transid > fs_devices->latest_trans) { -@@ -1236,6 +1240,9 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path) - - device->fs_devices->num_devices--; - -+ if (device->missing) -+ root->fs_info->fs_devices->missing_devices--; -+ - next_device = list_entry(root->fs_info->fs_devices->devices.next, - struct btrfs_device, dev_list); - if (device->bdev == root->fs_info->sb->s_bdev) -@@ -3080,7 +3087,9 @@ static struct btrfs_device *add_missing_dev(struct btrfs_root *root, - device->devid = devid; - device->work.func = pending_bios_fn; - device->fs_devices = fs_devices; -+ device->missing = 1; - fs_devices->num_devices++; -+ fs_devices->missing_devices++; - spin_lock_init(&device->io_lock); - INIT_LIST_HEAD(&device->dev_alloc_list); - memcpy(device->uuid, dev_uuid, BTRFS_UUID_SIZE); -@@ -3278,6 +3287,15 @@ static int read_one_dev(struct btrfs_root *root, - device = add_missing_dev(root, devid, dev_uuid); - if (!device) - return -ENOMEM; -+ } else if (!device->missing) { -+ /* -+ * this happens when a device that was properly setup -+ * in the device info lists suddenly goes bad. -+ * device->bdev is NULL, and so we have to set -+ * device->missing to one here -+ */ -+ root->fs_info->fs_devices->missing_devices++; -+ device->missing = 1; - } - } - -diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h -index 2b638b6..2740db4 100644 ---- a/fs/btrfs/volumes.h -+++ b/fs/btrfs/volumes.h -@@ -44,6 +44,7 @@ struct btrfs_device { - - int writeable; - int in_fs_metadata; -+ int missing; - - spinlock_t io_lock; - -@@ -93,6 +94,7 @@ struct btrfs_fs_devices { - u64 num_devices; - u64 open_devices; - u64 rw_devices; -+ u64 missing_devices; - u64 total_rw_bytes; - struct block_device *latest_bdev; - -diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c -index 7d447af..158c700 100644 ---- a/fs/ceph/dir.c -+++ b/fs/ceph/dir.c -@@ -114,8 +114,8 @@ static int __dcache_readdir(struct file *filp, - spin_lock(&dcache_lock); - - /* start at beginning? */ -- if (filp->f_pos == 2 || (last && -- filp->f_pos < ceph_dentry(last)->offset)) { -+ if (filp->f_pos == 2 || last == NULL || -+ filp->f_pos < ceph_dentry(last)->offset) { - if (list_empty(&parent->d_subdirs)) - goto out_unlock; - p = parent->d_subdirs.prev; -diff --git a/fs/ceph/ioctl.h b/fs/ceph/ioctl.h -index a6ce54e..52e8fd7 100644 ---- a/fs/ceph/ioctl.h -+++ b/fs/ceph/ioctl.h -@@ -4,7 +4,7 @@ - #include - #include - --#define CEPH_IOCTL_MAGIC 0x98 -+#define CEPH_IOCTL_MAGIC 0x97 - - /* just use u64 to align sanely on all archs */ - struct ceph_ioctl_layout { -diff --git a/fs/ceph/locks.c b/fs/ceph/locks.c -index 40abde9..476b329 100644 ---- a/fs/ceph/locks.c -+++ b/fs/ceph/locks.c -@@ -11,40 +11,68 @@ - * Implement fcntl and flock locking functions. - */ - static int ceph_lock_message(u8 lock_type, u16 operation, struct file *file, -- u64 pid, u64 pid_ns, -- int cmd, u64 start, u64 length, u8 wait) -+ int cmd, u8 wait, struct file_lock *fl) - { - struct inode *inode = file->f_dentry->d_inode; - struct ceph_mds_client *mdsc = - ceph_sb_to_client(inode->i_sb)->mdsc; - struct ceph_mds_request *req; - int err; -+ u64 length = 0; - - req = ceph_mdsc_create_request(mdsc, operation, USE_AUTH_MDS); - if (IS_ERR(req)) - return PTR_ERR(req); - req->r_inode = igrab(inode); - -+ /* mds requires start and length rather than start and end */ -+ if (LLONG_MAX == fl->fl_end) -+ length = 0; -+ else -+ length = fl->fl_end - fl->fl_start + 1; -+ - dout("ceph_lock_message: rule: %d, op: %d, pid: %llu, start: %llu, " - "length: %llu, wait: %d, type`: %d", (int)lock_type, -- (int)operation, pid, start, length, wait, cmd); -+ (int)operation, (u64)fl->fl_pid, fl->fl_start, -+ length, wait, fl->fl_type); -+ - - req->r_args.filelock_change.rule = lock_type; - req->r_args.filelock_change.type = cmd; -- req->r_args.filelock_change.pid = cpu_to_le64(pid); -+ req->r_args.filelock_change.pid = cpu_to_le64((u64)fl->fl_pid); - /* This should be adjusted, but I'm not sure if - namespaces actually get id numbers*/ - req->r_args.filelock_change.pid_namespace = -- cpu_to_le64((u64)pid_ns); -- req->r_args.filelock_change.start = cpu_to_le64(start); -+ cpu_to_le64((u64)(unsigned long)fl->fl_nspid); -+ req->r_args.filelock_change.start = cpu_to_le64(fl->fl_start); - req->r_args.filelock_change.length = cpu_to_le64(length); - req->r_args.filelock_change.wait = wait; - - err = ceph_mdsc_do_request(mdsc, inode, req); -+ -+ if ( operation == CEPH_MDS_OP_GETFILELOCK){ -+ fl->fl_pid = le64_to_cpu(req->r_reply_info.filelock_reply->pid); -+ if (CEPH_LOCK_SHARED == req->r_reply_info.filelock_reply->type) -+ fl->fl_type = F_RDLCK; -+ else if (CEPH_LOCK_EXCL == req->r_reply_info.filelock_reply->type) -+ fl->fl_type = F_WRLCK; -+ else -+ fl->fl_type = F_UNLCK; -+ -+ fl->fl_start = le64_to_cpu(req->r_reply_info.filelock_reply->start); -+ length = le64_to_cpu(req->r_reply_info.filelock_reply->start) + -+ le64_to_cpu(req->r_reply_info.filelock_reply->length); -+ if (length >= 1) -+ fl->fl_end = length -1; -+ else -+ fl->fl_end = 0; -+ -+ } - ceph_mdsc_put_request(req); - dout("ceph_lock_message: rule: %d, op: %d, pid: %llu, start: %llu, " -- "length: %llu, wait: %d, type`: %d err code %d", (int)lock_type, -- (int)operation, pid, start, length, wait, cmd, err); -+ "length: %llu, wait: %d, type`: %d, err code %d", (int)lock_type, -+ (int)operation, (u64)fl->fl_pid, fl->fl_start, -+ length, wait, fl->fl_type, err); - return err; - } - -@@ -54,7 +82,6 @@ static int ceph_lock_message(u8 lock_type, u16 operation, struct file *file, - */ - int ceph_lock(struct file *file, int cmd, struct file_lock *fl) - { -- u64 length; - u8 lock_cmd; - int err; - u8 wait = 0; -@@ -76,29 +103,20 @@ int ceph_lock(struct file *file, int cmd, struct file_lock *fl) - else - lock_cmd = CEPH_LOCK_UNLOCK; - -- if (LLONG_MAX == fl->fl_end) -- length = 0; -- else -- length = fl->fl_end - fl->fl_start + 1; -- -- err = ceph_lock_message(CEPH_LOCK_FCNTL, op, file, -- (u64)fl->fl_pid, -- (u64)(unsigned long)fl->fl_nspid, -- lock_cmd, fl->fl_start, -- length, wait); -+ err = ceph_lock_message(CEPH_LOCK_FCNTL, op, file, lock_cmd, wait, fl); - if (!err) { -- dout("mds locked, locking locally"); -- err = posix_lock_file(file, fl, NULL); -- if (err && (CEPH_MDS_OP_SETFILELOCK == op)) { -- /* undo! This should only happen if the kernel detects -- * local deadlock. */ -- ceph_lock_message(CEPH_LOCK_FCNTL, op, file, -- (u64)fl->fl_pid, -- (u64)(unsigned long)fl->fl_nspid, -- CEPH_LOCK_UNLOCK, fl->fl_start, -- length, 0); -- dout("got %d on posix_lock_file, undid lock", err); -+ if ( op != CEPH_MDS_OP_GETFILELOCK ){ -+ dout("mds locked, locking locally"); -+ err = posix_lock_file(file, fl, NULL); -+ if (err && (CEPH_MDS_OP_SETFILELOCK == op)) { -+ /* undo! This should only happen if the kernel detects -+ * local deadlock. */ -+ ceph_lock_message(CEPH_LOCK_FCNTL, op, file, -+ CEPH_LOCK_UNLOCK, 0, fl); -+ dout("got %d on posix_lock_file, undid lock", err); -+ } - } -+ - } else { - dout("mds returned error code %d", err); - } -@@ -107,7 +125,6 @@ int ceph_lock(struct file *file, int cmd, struct file_lock *fl) - - int ceph_flock(struct file *file, int cmd, struct file_lock *fl) - { -- u64 length; - u8 lock_cmd; - int err; - u8 wait = 1; -@@ -127,26 +144,15 @@ int ceph_flock(struct file *file, int cmd, struct file_lock *fl) - lock_cmd = CEPH_LOCK_EXCL; - else - lock_cmd = CEPH_LOCK_UNLOCK; -- /* mds requires start and length rather than start and end */ -- if (LLONG_MAX == fl->fl_end) -- length = 0; -- else -- length = fl->fl_end - fl->fl_start + 1; - - err = ceph_lock_message(CEPH_LOCK_FLOCK, CEPH_MDS_OP_SETFILELOCK, -- file, (u64)fl->fl_pid, -- (u64)(unsigned long)fl->fl_nspid, -- lock_cmd, fl->fl_start, -- length, wait); -+ file, lock_cmd, wait, fl); - if (!err) { - err = flock_lock_file_wait(file, fl); - if (err) { - ceph_lock_message(CEPH_LOCK_FLOCK, - CEPH_MDS_OP_SETFILELOCK, -- file, (u64)fl->fl_pid, -- (u64)(unsigned long)fl->fl_nspid, -- CEPH_LOCK_UNLOCK, fl->fl_start, -- length, 0); -+ file, CEPH_LOCK_UNLOCK, 0, fl); - dout("got %d on flock_lock_file_wait, undid lock", err); - } - } else { -diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c -index 098b185..38800ea 100644 ---- a/fs/ceph/mds_client.c -+++ b/fs/ceph/mds_client.c -@@ -202,6 +202,38 @@ out_bad: - } - - /* -+ * parse fcntl F_GETLK results -+ */ -+static int parse_reply_info_filelock(void **p, void *end, -+ struct ceph_mds_reply_info_parsed *info) -+{ -+ if (*p + sizeof(*info->filelock_reply) > end) -+ goto bad; -+ -+ info->filelock_reply = *p; -+ *p += sizeof(*info->filelock_reply); -+ -+ if (unlikely(*p != end)) -+ goto bad; -+ return 0; -+ -+bad: -+ return -EIO; -+} -+ -+/* -+ * parse extra results -+ */ -+static int parse_reply_info_extra(void **p, void *end, -+ struct ceph_mds_reply_info_parsed *info) -+{ -+ if (info->head->op == CEPH_MDS_OP_GETFILELOCK) -+ return parse_reply_info_filelock(p, end, info); -+ else -+ return parse_reply_info_dir(p, end, info); -+} -+ -+/* - * parse entire mds reply - */ - static int parse_reply_info(struct ceph_msg *msg, -@@ -223,10 +255,10 @@ static int parse_reply_info(struct ceph_msg *msg, - goto out_bad; - } - -- /* dir content */ -+ /* extra */ - ceph_decode_32_safe(&p, end, len, bad); - if (len > 0) { -- err = parse_reply_info_dir(&p, p+len, info); -+ err = parse_reply_info_extra(&p, p+len, info); - if (err < 0) - goto out_bad; - } -@@ -2074,7 +2106,7 @@ static void handle_reply(struct ceph_mds_session *session, struct ceph_msg *msg) - - mutex_lock(&session->s_mutex); - if (err < 0) { -- pr_err("mdsc_handle_reply got corrupt reply mds%d\n", mds); -+ pr_err("mdsc_handle_reply got corrupt reply mds%d(tid:%lld)\n", mds, tid); - ceph_msg_dump(msg); - goto out_err; - } -@@ -2094,7 +2126,8 @@ static void handle_reply(struct ceph_mds_session *session, struct ceph_msg *msg) - mutex_lock(&req->r_fill_mutex); - err = ceph_fill_trace(mdsc->fsc->sb, req, req->r_session); - if (err == 0) { -- if (result == 0 && rinfo->dir_nr) -+ if (result == 0 && req->r_op != CEPH_MDS_OP_GETFILELOCK && -+ rinfo->dir_nr) - ceph_readdir_prepopulate(req, req->r_session); - ceph_unreserve_caps(mdsc, &req->r_caps_reservation); - } -diff --git a/fs/ceph/mds_client.h b/fs/ceph/mds_client.h -index 9341fd4..aabe563 100644 ---- a/fs/ceph/mds_client.h -+++ b/fs/ceph/mds_client.h -@@ -42,26 +42,37 @@ struct ceph_mds_reply_info_in { - }; - - /* -- * parsed info about an mds reply, including information about the -- * target inode and/or its parent directory and dentry, and directory -- * contents (for readdir results). -+ * parsed info about an mds reply, including information about -+ * either: 1) the target inode and/or its parent directory and dentry, -+ * and directory contents (for readdir results), or -+ * 2) the file range lock info (for fcntl F_GETLK results). - */ - struct ceph_mds_reply_info_parsed { - struct ceph_mds_reply_head *head; - -+ /* trace */ - struct ceph_mds_reply_info_in diri, targeti; - struct ceph_mds_reply_dirfrag *dirfrag; - char *dname; - u32 dname_len; - struct ceph_mds_reply_lease *dlease; - -- struct ceph_mds_reply_dirfrag *dir_dir; -- int dir_nr; -- char **dir_dname; -- u32 *dir_dname_len; -- struct ceph_mds_reply_lease **dir_dlease; -- struct ceph_mds_reply_info_in *dir_in; -- u8 dir_complete, dir_end; -+ /* extra */ -+ union { -+ /* for fcntl F_GETLK results */ -+ struct ceph_filelock *filelock_reply; -+ -+ /* for readdir results */ -+ struct { -+ struct ceph_mds_reply_dirfrag *dir_dir; -+ int dir_nr; -+ char **dir_dname; -+ u32 *dir_dname_len; -+ struct ceph_mds_reply_lease **dir_dlease; -+ struct ceph_mds_reply_info_in *dir_in; -+ u8 dir_complete, dir_end; -+ }; -+ }; - - /* encoded blob describing snapshot contexts for certain - operations (e.g., open) */ -diff --git a/fs/cifs/Makefile b/fs/cifs/Makefile -index adefa60..43b19dd 100644 ---- a/fs/cifs/Makefile -+++ b/fs/cifs/Makefile -@@ -6,7 +6,9 @@ obj-$(CONFIG_CIFS) += cifs.o - cifs-y := cifsfs.o cifssmb.o cifs_debug.o connect.o dir.o file.o inode.o \ - link.o misc.o netmisc.o smbdes.o smbencrypt.o transport.o asn1.o \ - md4.o md5.o cifs_unicode.o nterr.o xattr.o cifsencrypt.o \ -- readdir.o ioctl.o sess.o export.o cifsacl.o -+ readdir.o ioctl.o sess.o export.o -+ -+cifs-$(CONFIG_CIFS_ACL) += cifsacl.o - - cifs-$(CONFIG_CIFS_UPCALL) += cifs_spnego.o - -diff --git a/fs/cifs/README b/fs/cifs/README -index ee68d10..46af99a 100644 ---- a/fs/cifs/README -+++ b/fs/cifs/README -@@ -337,6 +337,15 @@ A partial list of the supported mount options follows: - wsize default write size (default 57344) - maximum wsize currently allowed by CIFS is 57344 (fourteen - 4096 byte pages) -+ actimeo=n attribute cache timeout in seconds (default 1 second). -+ After this timeout, the cifs client requests fresh attribute -+ information from the server. This option allows to tune the -+ attribute cache timeout to suit the workload needs. Shorter -+ timeouts mean better the cache coherency, but increased number -+ of calls to the server. Longer timeouts mean reduced number -+ of calls to the server at the expense of less stricter cache -+ coherency checks (i.e. incorrect attribute cache for a short -+ period of time). - rw mount the network share read-write (note that the - server may still consider the share read-only) - ro mount network share read-only -diff --git a/fs/cifs/cifs_fs_sb.h b/fs/cifs/cifs_fs_sb.h -index e9a393c..7852cd6 100644 ---- a/fs/cifs/cifs_fs_sb.h -+++ b/fs/cifs/cifs_fs_sb.h -@@ -48,6 +48,7 @@ struct cifs_sb_info { - struct nls_table *local_nls; - unsigned int rsize; - unsigned int wsize; -+ unsigned long actimeo; /* attribute cache timeout (jiffies) */ - atomic_t active; - uid_t mnt_uid; - gid_t mnt_gid; -diff --git a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c -index c6ebea0..a437ec3 100644 ---- a/fs/cifs/cifsacl.c -+++ b/fs/cifs/cifsacl.c -@@ -30,8 +30,6 @@ - #include "cifs_debug.h" - - --#ifdef CONFIG_CIFS_EXPERIMENTAL -- - static struct cifs_wksid wksidarr[NUM_WK_SIDS] = { - {{1, 0, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0} }, "null user"}, - {{1, 1, {0, 0, 0, 0, 0, 1}, {0, 0, 0, 0, 0} }, "nobody"}, -@@ -774,4 +772,3 @@ int mode_to_cifs_acl(struct inode *inode, const char *path, __u64 nmode) - - return rc; - } --#endif /* CONFIG_CIFS_EXPERIMENTAL */ -diff --git a/fs/cifs/cifsacl.h b/fs/cifs/cifsacl.h -index 6c8096c..c4ae7d0 100644 ---- a/fs/cifs/cifsacl.h -+++ b/fs/cifs/cifsacl.h -@@ -74,11 +74,7 @@ struct cifs_wksid { - char sidname[SIDNAMELENGTH]; - } __attribute__((packed)); - --#ifdef CONFIG_CIFS_EXPERIMENTAL -- - extern int match_sid(struct cifs_sid *); - extern int compare_sids(const struct cifs_sid *, const struct cifs_sid *); - --#endif /* CONFIG_CIFS_EXPERIMENTAL */ -- - #endif /* _CIFSACL_H */ -diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c -index 76c8a90..3936aa7 100644 ---- a/fs/cifs/cifsfs.c -+++ b/fs/cifs/cifsfs.c -@@ -463,6 +463,8 @@ cifs_show_options(struct seq_file *s, struct vfsmount *m) - - seq_printf(s, ",rsize=%d", cifs_sb->rsize); - seq_printf(s, ",wsize=%d", cifs_sb->wsize); -+ /* convert actimeo and display it in seconds */ -+ seq_printf(s, ",actimeo=%lu", cifs_sb->actimeo / HZ); - - return 0; - } -@@ -935,7 +937,6 @@ init_cifs(void) - GlobalCurrentXid = 0; - GlobalTotalActiveXid = 0; - GlobalMaxActiveXid = 0; -- memset(Local_System_Name, 0, 15); - spin_lock_init(&cifs_tcp_ses_lock); - spin_lock_init(&cifs_file_list_lock); - spin_lock_init(&GlobalMid_Lock); -diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h -index b577bf0..7136c0c 100644 ---- a/fs/cifs/cifsglob.h -+++ b/fs/cifs/cifsglob.h -@@ -45,6 +45,16 @@ - #define CIFS_MIN_RCV_POOL 4 - - /* -+ * default attribute cache timeout (jiffies) -+ */ -+#define CIFS_DEF_ACTIMEO (1 * HZ) -+ -+/* -+ * max attribute cache timeout (jiffies) - 2^30 -+ */ -+#define CIFS_MAX_ACTIMEO (1 << 30) -+ -+/* - * MAX_REQ is the maximum number of requests that WE will send - * on one socket concurrently. It also matches the most common - * value of max multiplex returned by servers. We may -@@ -746,8 +756,6 @@ GLOBAL_EXTERN unsigned int GlobalTotalActiveXid; /* prot by GlobalMid_Sem */ - GLOBAL_EXTERN unsigned int GlobalMaxActiveXid; /* prot by GlobalMid_Sem */ - GLOBAL_EXTERN spinlock_t GlobalMid_Lock; /* protects above & list operations */ - /* on midQ entries */ --GLOBAL_EXTERN char Local_System_Name[15]; -- - /* - * Global counters, updated atomically - */ -diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h -index db961dc..e6d1481 100644 ---- a/fs/cifs/cifsproto.h -+++ b/fs/cifs/cifsproto.h -@@ -54,7 +54,8 @@ do { \ - __func__, curr_xid, (int)rc); \ - } while (0) - extern char *build_path_from_dentry(struct dentry *); --extern char *cifs_build_path_to_root(struct cifs_sb_info *cifs_sb); -+extern char *cifs_build_path_to_root(struct cifs_sb_info *cifs_sb, -+ struct cifsTconInfo *tcon); - extern char *build_wildcard_path_from_dentry(struct dentry *direntry); - extern char *cifs_compose_mount_options(const char *sb_mountdata, - const char *fullpath, const struct dfs_info3_param *ref, -@@ -79,9 +80,7 @@ extern bool is_valid_oplock_break(struct smb_hdr *smb, - struct TCP_Server_Info *); - extern bool is_size_safe_to_change(struct cifsInodeInfo *, __u64 eof); - extern struct cifsFileInfo *find_writable_file(struct cifsInodeInfo *, bool); --#ifdef CONFIG_CIFS_EXPERIMENTAL - extern struct cifsFileInfo *find_readable_file(struct cifsInodeInfo *, bool); --#endif - extern unsigned int smbCalcSize(struct smb_hdr *ptr); - extern unsigned int smbCalcSize_LE(struct smb_hdr *ptr); - extern int decode_negTokenInit(unsigned char *security_blob, int length, -diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c -index 2f2632b..67acfb3 100644 ---- a/fs/cifs/cifssmb.c -+++ b/fs/cifs/cifssmb.c -@@ -2478,95 +2478,6 @@ querySymLinkRetry: - } - - #ifdef CONFIG_CIFS_EXPERIMENTAL --/* Initialize NT TRANSACT SMB into small smb request buffer. -- This assumes that all NT TRANSACTS that we init here have -- total parm and data under about 400 bytes (to fit in small cifs -- buffer size), which is the case so far, it easily fits. NB: -- Setup words themselves and ByteCount -- MaxSetupCount (size of returned setup area) and -- MaxParameterCount (returned parms size) must be set by caller */ --static int --smb_init_nttransact(const __u16 sub_command, const int setup_count, -- const int parm_len, struct cifsTconInfo *tcon, -- void **ret_buf) --{ -- int rc; -- __u32 temp_offset; -- struct smb_com_ntransact_req *pSMB; -- -- rc = small_smb_init(SMB_COM_NT_TRANSACT, 19 + setup_count, tcon, -- (void **)&pSMB); -- if (rc) -- return rc; -- *ret_buf = (void *)pSMB; -- pSMB->Reserved = 0; -- pSMB->TotalParameterCount = cpu_to_le32(parm_len); -- pSMB->TotalDataCount = 0; -- pSMB->MaxDataCount = cpu_to_le32((tcon->ses->server->maxBuf - -- MAX_CIFS_HDR_SIZE) & 0xFFFFFF00); -- pSMB->ParameterCount = pSMB->TotalParameterCount; -- pSMB->DataCount = pSMB->TotalDataCount; -- temp_offset = offsetof(struct smb_com_ntransact_req, Parms) + -- (setup_count * 2) - 4 /* for rfc1001 length itself */; -- pSMB->ParameterOffset = cpu_to_le32(temp_offset); -- pSMB->DataOffset = cpu_to_le32(temp_offset + parm_len); -- pSMB->SetupCount = setup_count; /* no need to le convert byte fields */ -- pSMB->SubCommand = cpu_to_le16(sub_command); -- return 0; --} -- --static int --validate_ntransact(char *buf, char **ppparm, char **ppdata, -- __u32 *pparmlen, __u32 *pdatalen) --{ -- char *end_of_smb; -- __u32 data_count, data_offset, parm_count, parm_offset; -- struct smb_com_ntransact_rsp *pSMBr; -- -- *pdatalen = 0; -- *pparmlen = 0; -- -- if (buf == NULL) -- return -EINVAL; -- -- pSMBr = (struct smb_com_ntransact_rsp *)buf; -- -- /* ByteCount was converted from little endian in SendReceive */ -- end_of_smb = 2 /* sizeof byte count */ + pSMBr->ByteCount + -- (char *)&pSMBr->ByteCount; -- -- data_offset = le32_to_cpu(pSMBr->DataOffset); -- data_count = le32_to_cpu(pSMBr->DataCount); -- parm_offset = le32_to_cpu(pSMBr->ParameterOffset); -- parm_count = le32_to_cpu(pSMBr->ParameterCount); -- -- *ppparm = (char *)&pSMBr->hdr.Protocol + parm_offset; -- *ppdata = (char *)&pSMBr->hdr.Protocol + data_offset; -- -- /* should we also check that parm and data areas do not overlap? */ -- if (*ppparm > end_of_smb) { -- cFYI(1, "parms start after end of smb"); -- return -EINVAL; -- } else if (parm_count + *ppparm > end_of_smb) { -- cFYI(1, "parm end after end of smb"); -- return -EINVAL; -- } else if (*ppdata > end_of_smb) { -- cFYI(1, "data starts after end of smb"); -- return -EINVAL; -- } else if (data_count + *ppdata > end_of_smb) { -- cFYI(1, "data %p + count %d (%p) past smb end %p start %p", -- *ppdata, data_count, (data_count + *ppdata), -- end_of_smb, pSMBr); -- return -EINVAL; -- } else if (parm_count + data_count > pSMBr->ByteCount) { -- cFYI(1, "parm count and data count larger than SMB"); -- return -EINVAL; -- } -- *pdatalen = data_count; -- *pparmlen = parm_count; -- return 0; --} -- - int - CIFSSMBQueryReparseLinkInfo(const int xid, struct cifsTconInfo *tcon, - const unsigned char *searchName, -@@ -3056,7 +2967,97 @@ GetExtAttrOut: - - #endif /* CONFIG_POSIX */ - --#ifdef CONFIG_CIFS_EXPERIMENTAL -+#ifdef CONFIG_CIFS_ACL -+/* -+ * Initialize NT TRANSACT SMB into small smb request buffer. This assumes that -+ * all NT TRANSACTS that we init here have total parm and data under about 400 -+ * bytes (to fit in small cifs buffer size), which is the case so far, it -+ * easily fits. NB: Setup words themselves and ByteCount MaxSetupCount (size of -+ * returned setup area) and MaxParameterCount (returned parms size) must be set -+ * by caller -+ */ -+static int -+smb_init_nttransact(const __u16 sub_command, const int setup_count, -+ const int parm_len, struct cifsTconInfo *tcon, -+ void **ret_buf) -+{ -+ int rc; -+ __u32 temp_offset; -+ struct smb_com_ntransact_req *pSMB; -+ -+ rc = small_smb_init(SMB_COM_NT_TRANSACT, 19 + setup_count, tcon, -+ (void **)&pSMB); -+ if (rc) -+ return rc; -+ *ret_buf = (void *)pSMB; -+ pSMB->Reserved = 0; -+ pSMB->TotalParameterCount = cpu_to_le32(parm_len); -+ pSMB->TotalDataCount = 0; -+ pSMB->MaxDataCount = cpu_to_le32((tcon->ses->server->maxBuf - -+ MAX_CIFS_HDR_SIZE) & 0xFFFFFF00); -+ pSMB->ParameterCount = pSMB->TotalParameterCount; -+ pSMB->DataCount = pSMB->TotalDataCount; -+ temp_offset = offsetof(struct smb_com_ntransact_req, Parms) + -+ (setup_count * 2) - 4 /* for rfc1001 length itself */; -+ pSMB->ParameterOffset = cpu_to_le32(temp_offset); -+ pSMB->DataOffset = cpu_to_le32(temp_offset + parm_len); -+ pSMB->SetupCount = setup_count; /* no need to le convert byte fields */ -+ pSMB->SubCommand = cpu_to_le16(sub_command); -+ return 0; -+} -+ -+static int -+validate_ntransact(char *buf, char **ppparm, char **ppdata, -+ __u32 *pparmlen, __u32 *pdatalen) -+{ -+ char *end_of_smb; -+ __u32 data_count, data_offset, parm_count, parm_offset; -+ struct smb_com_ntransact_rsp *pSMBr; -+ -+ *pdatalen = 0; -+ *pparmlen = 0; -+ -+ if (buf == NULL) -+ return -EINVAL; -+ -+ pSMBr = (struct smb_com_ntransact_rsp *)buf; -+ -+ /* ByteCount was converted from little endian in SendReceive */ -+ end_of_smb = 2 /* sizeof byte count */ + pSMBr->ByteCount + -+ (char *)&pSMBr->ByteCount; -+ -+ data_offset = le32_to_cpu(pSMBr->DataOffset); -+ data_count = le32_to_cpu(pSMBr->DataCount); -+ parm_offset = le32_to_cpu(pSMBr->ParameterOffset); -+ parm_count = le32_to_cpu(pSMBr->ParameterCount); -+ -+ *ppparm = (char *)&pSMBr->hdr.Protocol + parm_offset; -+ *ppdata = (char *)&pSMBr->hdr.Protocol + data_offset; -+ -+ /* should we also check that parm and data areas do not overlap? */ -+ if (*ppparm > end_of_smb) { -+ cFYI(1, "parms start after end of smb"); -+ return -EINVAL; -+ } else if (parm_count + *ppparm > end_of_smb) { -+ cFYI(1, "parm end after end of smb"); -+ return -EINVAL; -+ } else if (*ppdata > end_of_smb) { -+ cFYI(1, "data starts after end of smb"); -+ return -EINVAL; -+ } else if (data_count + *ppdata > end_of_smb) { -+ cFYI(1, "data %p + count %d (%p) past smb end %p start %p", -+ *ppdata, data_count, (data_count + *ppdata), -+ end_of_smb, pSMBr); -+ return -EINVAL; -+ } else if (parm_count + data_count > pSMBr->ByteCount) { -+ cFYI(1, "parm count and data count larger than SMB"); -+ return -EINVAL; -+ } -+ *pdatalen = data_count; -+ *pparmlen = parm_count; -+ return 0; -+} -+ - /* Get Security Descriptor (by handle) from remote server for a file or dir */ - int - CIFSSMBGetCIFSACL(const int xid, struct cifsTconInfo *tcon, __u16 fid, -@@ -3214,7 +3215,7 @@ setCifsAclRetry: - return (rc); - } - --#endif /* CONFIG_CIFS_EXPERIMENTAL */ -+#endif /* CONFIG_CIFS_ACL */ - - /* Legacy Query Path Information call for lookup to old servers such - as Win9x/WinME */ -diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c -index 32fa4d9..cc1a860 100644 ---- a/fs/cifs/connect.c -+++ b/fs/cifs/connect.c -@@ -105,6 +105,7 @@ struct smb_vol { - unsigned int wsize; - bool sockopt_tcp_nodelay:1; - unsigned short int port; -+ unsigned long actimeo; /* attribute cache timeout (jiffies) */ - char *prepath; - struct sockaddr_storage srcaddr; /* allow binding to a local IP */ - struct nls_table *local_nls; -@@ -806,23 +807,20 @@ cifs_parse_mount_options(char *options, const char *devname, - short int override_gid = -1; - bool uid_specified = false; - bool gid_specified = false; -+ char *nodename = utsname()->nodename; - - separator[0] = ','; - separator[1] = 0; - -- if (Local_System_Name[0] != 0) -- memcpy(vol->source_rfc1001_name, Local_System_Name, 15); -- else { -- char *nodename = utsname()->nodename; -- int n = strnlen(nodename, 15); -- memset(vol->source_rfc1001_name, 0x20, 15); -- for (i = 0; i < n; i++) { -- /* does not have to be perfect mapping since field is -- informational, only used for servers that do not support -- port 445 and it can be overridden at mount time */ -- vol->source_rfc1001_name[i] = toupper(nodename[i]); -- } -- } -+ /* -+ * does not have to be perfect mapping since field is -+ * informational, only used for servers that do not support -+ * port 445 and it can be overridden at mount time -+ */ -+ memset(vol->source_rfc1001_name, 0x20, 15); -+ for (i = 0; i < strnlen(nodename, 15); i++) -+ vol->source_rfc1001_name[i] = toupper(nodename[i]); -+ - vol->source_rfc1001_name[15] = 0; - /* null target name indicates to use *SMBSERVR default called name - if we end up sending RFC1001 session initialize */ -@@ -840,6 +838,8 @@ cifs_parse_mount_options(char *options, const char *devname, - /* default to using server inode numbers where available */ - vol->server_ino = 1; - -+ vol->actimeo = CIFS_DEF_ACTIMEO; -+ - if (!options) - return 1; - -@@ -1214,6 +1214,16 @@ cifs_parse_mount_options(char *options, const char *devname, - printk(KERN_WARNING "CIFS: server net" - "biosname longer than 15 truncated.\n"); - } -+ } else if (strnicmp(data, "actimeo", 7) == 0) { -+ if (value && *value) { -+ vol->actimeo = HZ * simple_strtoul(value, -+ &value, 0); -+ if (vol->actimeo > CIFS_MAX_ACTIMEO) { -+ cERROR(1, "CIFS: attribute cache" -+ "timeout too large"); -+ return 1; -+ } -+ } - } else if (strnicmp(data, "credentials", 4) == 0) { - /* ignore */ - } else if (strnicmp(data, "version", 3) == 0) { -@@ -2571,6 +2581,8 @@ static void setup_cifs_sb(struct smb_vol *pvolume_info, - cFYI(1, "file mode: 0x%x dir mode: 0x%x", - cifs_sb->mnt_file_mode, cifs_sb->mnt_dir_mode); - -+ cifs_sb->actimeo = pvolume_info->actimeo; -+ - if (pvolume_info->noperm) - cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_NO_PERM; - if (pvolume_info->setuids) -@@ -2821,13 +2833,13 @@ remote_path_check: - /* check if a whole path (including prepath) is not remote */ - if (!rc && cifs_sb->prepathlen && tcon) { - /* build_path_to_root works only when we have a valid tcon */ -- full_path = cifs_build_path_to_root(cifs_sb); -+ full_path = cifs_build_path_to_root(cifs_sb, tcon); - if (full_path == NULL) { - rc = -ENOMEM; - goto mount_fail_check; - } - rc = is_path_accessible(xid, tcon, cifs_sb, full_path); -- if (rc != -EREMOTE) { -+ if (rc != 0 && rc != -EREMOTE) { - kfree(full_path); - goto mount_fail_check; - } -diff --git a/fs/cifs/file.c b/fs/cifs/file.c -index b857ce5..5a28660 100644 ---- a/fs/cifs/file.c -+++ b/fs/cifs/file.c -@@ -1108,7 +1108,6 @@ static ssize_t cifs_write(struct cifsFileInfo *open_file, - return total_written; - } - --#ifdef CONFIG_CIFS_EXPERIMENTAL - struct cifsFileInfo *find_readable_file(struct cifsInodeInfo *cifs_inode, - bool fsuid_only) - { -@@ -1142,7 +1141,6 @@ struct cifsFileInfo *find_readable_file(struct cifsInodeInfo *cifs_inode, - spin_unlock(&cifs_file_list_lock); - return NULL; - } --#endif - - struct cifsFileInfo *find_writable_file(struct cifsInodeInfo *cifs_inode, - bool fsuid_only) -diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c -index 28cb6e7..589f3e3 100644 ---- a/fs/cifs/inode.c -+++ b/fs/cifs/inode.c -@@ -686,7 +686,7 @@ int cifs_get_inode_info(struct inode **pinode, - cFYI(1, "cifs_sfu_type failed: %d", tmprc); - } - --#ifdef CONFIG_CIFS_EXPERIMENTAL -+#ifdef CONFIG_CIFS_ACL - /* fill in 0777 bits from ACL */ - if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) { - rc = cifs_acl_to_fattr(cifs_sb, &fattr, *pinode, full_path, -@@ -697,7 +697,7 @@ int cifs_get_inode_info(struct inode **pinode, - goto cgii_exit; - } - } --#endif -+#endif /* CONFIG_CIFS_ACL */ - - /* fill in remaining high mode bits e.g. SUID, VTX */ - if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) -@@ -728,12 +728,12 @@ static const struct inode_operations cifs_ipc_inode_ops = { - .lookup = cifs_lookup, - }; - --char *cifs_build_path_to_root(struct cifs_sb_info *cifs_sb) -+char *cifs_build_path_to_root(struct cifs_sb_info *cifs_sb, -+ struct cifsTconInfo *tcon) - { - int pplen = cifs_sb->prepathlen; - int dfsplen; - char *full_path = NULL; -- struct cifsTconInfo *tcon = cifs_sb_master_tcon(cifs_sb); - - /* if no prefix path, simply set path to the root of share to "" */ - if (pplen == 0) { -@@ -875,7 +875,7 @@ struct inode *cifs_root_iget(struct super_block *sb, unsigned long ino) - char *full_path; - struct cifsTconInfo *tcon = cifs_sb_master_tcon(cifs_sb); - -- full_path = cifs_build_path_to_root(cifs_sb); -+ full_path = cifs_build_path_to_root(cifs_sb, tcon); - if (full_path == NULL) - return ERR_PTR(-ENOMEM); - -@@ -1653,6 +1653,7 @@ static bool - cifs_inode_needs_reval(struct inode *inode) - { - struct cifsInodeInfo *cifs_i = CIFS_I(inode); -+ struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); - - if (cifs_i->clientCanCacheRead) - return false; -@@ -1663,12 +1664,12 @@ cifs_inode_needs_reval(struct inode *inode) - if (cifs_i->time == 0) - return true; - -- /* FIXME: the actimeo should be tunable */ -- if (time_after_eq(jiffies, cifs_i->time + HZ)) -+ if (!time_in_range(jiffies, cifs_i->time, -+ cifs_i->time + cifs_sb->actimeo)) - return true; - - /* hardlinked files w/ noserverino get "special" treatment */ -- if (!(CIFS_SB(inode->i_sb)->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) && -+ if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) && - S_ISREG(inode->i_mode) && inode->i_nlink != 1) - return true; - -@@ -2121,7 +2122,7 @@ cifs_setattr_nounix(struct dentry *direntry, struct iattr *attrs) - - if (attrs->ia_valid & ATTR_MODE) { - rc = 0; --#ifdef CONFIG_CIFS_EXPERIMENTAL -+#ifdef CONFIG_CIFS_ACL - if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) { - rc = mode_to_cifs_acl(inode, full_path, mode); - if (rc) { -@@ -2130,7 +2131,7 @@ cifs_setattr_nounix(struct dentry *direntry, struct iattr *attrs) - goto cifs_setattr_exit; - } - } else --#endif -+#endif /* CONFIG_CIFS_ACL */ - if (((mode & S_IWUGO) == 0) && - (cifsInode->cifsAttrs & ATTR_READONLY) == 0) { - -diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c -index 32d300e..a73eb9f 100644 ---- a/fs/cifs/readdir.c -+++ b/fs/cifs/readdir.c -@@ -759,18 +759,6 @@ static int cifs_filldir(char *pfindEntry, struct file *file, filldir_t filldir, - rc = filldir(direntry, qstring.name, qstring.len, file->f_pos, - ino, fattr.cf_dtype); - -- /* -- * we can not return filldir errors to the caller since they are -- * "normal" when the stat blocksize is too small - we return remapped -- * error instead -- * -- * FIXME: This looks bogus. filldir returns -EOVERFLOW in the above -- * case already. Why should we be clobbering other errors from it? -- */ -- if (rc) { -- cFYI(1, "filldir rc = %d", rc); -- rc = -EOVERFLOW; -- } - dput(tmp_dentry); - return rc; - } -diff --git a/fs/fuse/file.c b/fs/fuse/file.c -index 9242d29..8b984a2 100644 ---- a/fs/fuse/file.c -+++ b/fs/fuse/file.c -@@ -13,6 +13,7 @@ - #include - #include - #include -+#include - - static const struct file_operations fuse_direct_io_file_operations; - -@@ -1628,6 +1629,58 @@ static int fuse_ioctl_copy_user(struct page **pages, struct iovec *iov, - } - - /* -+ * CUSE servers compiled on 32bit broke on 64bit kernels because the -+ * ABI was defined to be 'struct iovec' which is different on 32bit -+ * and 64bit. Fortunately we can determine which structure the server -+ * used from the size of the reply. -+ */ -+static int fuse_copy_ioctl_iovec(struct iovec *dst, void *src, -+ size_t transferred, unsigned count, -+ bool is_compat) -+{ -+#ifdef CONFIG_COMPAT -+ if (count * sizeof(struct compat_iovec) == transferred) { -+ struct compat_iovec *ciov = src; -+ unsigned i; -+ -+ /* -+ * With this interface a 32bit server cannot support -+ * non-compat (i.e. ones coming from 64bit apps) ioctl -+ * requests -+ */ -+ if (!is_compat) -+ return -EINVAL; -+ -+ for (i = 0; i < count; i++) { -+ dst[i].iov_base = compat_ptr(ciov[i].iov_base); -+ dst[i].iov_len = ciov[i].iov_len; -+ } -+ return 0; -+ } -+#endif -+ -+ if (count * sizeof(struct iovec) != transferred) -+ return -EIO; -+ -+ memcpy(dst, src, transferred); -+ return 0; -+} -+ -+/* Make sure iov_length() won't overflow */ -+static int fuse_verify_ioctl_iov(struct iovec *iov, size_t count) -+{ -+ size_t n; -+ u32 max = FUSE_MAX_PAGES_PER_REQ << PAGE_SHIFT; -+ -+ for (n = 0; n < count; n++) { -+ if (iov->iov_len > (size_t) max) -+ return -ENOMEM; -+ max -= iov->iov_len; -+ } -+ return 0; -+} -+ -+/* - * For ioctls, there is no generic way to determine how much memory - * needs to be read and/or written. Furthermore, ioctls are allowed - * to dereference the passed pointer, so the parameter requires deep -@@ -1808,18 +1861,25 @@ long fuse_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg, - in_iovs + out_iovs > FUSE_IOCTL_MAX_IOV) - goto out; - -- err = -EIO; -- if ((in_iovs + out_iovs) * sizeof(struct iovec) != transferred) -- goto out; -- -- /* okay, copy in iovs and retry */ - vaddr = kmap_atomic(pages[0], KM_USER0); -- memcpy(page_address(iov_page), vaddr, transferred); -+ err = fuse_copy_ioctl_iovec(page_address(iov_page), vaddr, -+ transferred, in_iovs + out_iovs, -+ (flags & FUSE_IOCTL_COMPAT) != 0); - kunmap_atomic(vaddr, KM_USER0); -+ if (err) -+ goto out; - - in_iov = page_address(iov_page); - out_iov = in_iov + in_iovs; - -+ err = fuse_verify_ioctl_iov(in_iov, in_iovs); -+ if (err) -+ goto out; -+ -+ err = fuse_verify_ioctl_iov(out_iov, out_iovs); -+ if (err) -+ goto out; -+ - goto retry; - } - -diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c -index f0a384e..996dd89 100644 ---- a/fs/nfs/dir.c -+++ b/fs/nfs/dir.c -@@ -57,7 +57,7 @@ static int nfs_rename(struct inode *, struct dentry *, - struct inode *, struct dentry *); - static int nfs_fsync_dir(struct file *, int); - static loff_t nfs_llseek_dir(struct file *, loff_t, int); --static int nfs_readdir_clear_array(struct page*, gfp_t); -+static void nfs_readdir_clear_array(struct page*); - - const struct file_operations nfs_dir_operations = { - .llseek = nfs_llseek_dir, -@@ -83,8 +83,8 @@ const struct inode_operations nfs_dir_inode_operations = { - .setattr = nfs_setattr, - }; - --const struct address_space_operations nfs_dir_addr_space_ops = { -- .releasepage = nfs_readdir_clear_array, -+const struct address_space_operations nfs_dir_aops = { -+ .freepage = nfs_readdir_clear_array, - }; - - #ifdef CONFIG_NFS_V3 -@@ -178,6 +178,7 @@ typedef struct { - struct page *page; - unsigned long page_index; - u64 *dir_cookie; -+ u64 last_cookie; - loff_t current_index; - decode_dirent_t decode; - -@@ -213,17 +214,15 @@ void nfs_readdir_release_array(struct page *page) - * we are freeing strings created by nfs_add_to_readdir_array() - */ - static --int nfs_readdir_clear_array(struct page *page, gfp_t mask) -+void nfs_readdir_clear_array(struct page *page) - { -- struct nfs_cache_array *array = nfs_readdir_get_array(page); -+ struct nfs_cache_array *array; - int i; - -- if (IS_ERR(array)) -- return PTR_ERR(array); -+ array = kmap_atomic(page, KM_USER0); - for (i = 0; i < array->size; i++) - kfree(array->array[i].string.name); -- nfs_readdir_release_array(page); -- return 0; -+ kunmap_atomic(array, KM_USER0); - } - - /* -@@ -272,7 +271,7 @@ int nfs_readdir_add_to_array(struct nfs_entry *entry, struct page *page) - goto out; - array->last_cookie = entry->cookie; - array->size++; -- if (entry->eof == 1) -+ if (entry->eof != 0) - array->eof_index = array->size; - out: - nfs_readdir_release_array(page); -@@ -312,15 +311,14 @@ int nfs_readdir_search_for_cookie(struct nfs_cache_array *array, nfs_readdir_des - for (i = 0; i < array->size; i++) { - if (array->array[i].cookie == *desc->dir_cookie) { - desc->cache_entry_index = i; -- status = 0; -- goto out; -+ return 0; - } - } -- if (i == array->eof_index) { -- desc->eof = 1; -+ if (array->eof_index >= 0) { - status = -EBADCOOKIE; -+ if (*desc->dir_cookie == array->last_cookie) -+ desc->eof = 1; - } --out: - return status; - } - -@@ -328,10 +326,7 @@ static - int nfs_readdir_search_array(nfs_readdir_descriptor_t *desc) - { - struct nfs_cache_array *array; -- int status = -EBADCOOKIE; -- -- if (desc->dir_cookie == NULL) -- goto out; -+ int status; - - array = nfs_readdir_get_array(desc->page); - if (IS_ERR(array)) { -@@ -344,6 +339,10 @@ int nfs_readdir_search_array(nfs_readdir_descriptor_t *desc) - else - status = nfs_readdir_search_for_cookie(array, desc); - -+ if (status == -EAGAIN) { -+ desc->last_cookie = array->last_cookie; -+ desc->page_index++; -+ } - nfs_readdir_release_array(desc->page); - out: - return status; -@@ -490,7 +489,7 @@ int nfs_readdir_page_filler(nfs_readdir_descriptor_t *desc, struct nfs_entry *en - - count++; - -- if (desc->plus == 1) -+ if (desc->plus != 0) - nfs_prime_dcache(desc->file->f_path.dentry, entry); - - status = nfs_readdir_add_to_array(entry, page); -@@ -498,7 +497,7 @@ int nfs_readdir_page_filler(nfs_readdir_descriptor_t *desc, struct nfs_entry *en - break; - } while (!entry->eof); - -- if (count == 0 || (status == -EBADCOOKIE && entry->eof == 1)) { -+ if (count == 0 || (status == -EBADCOOKIE && entry->eof != 0)) { - array = nfs_readdir_get_array(page); - if (!IS_ERR(array)) { - array->eof_index = array->size; -@@ -563,7 +562,7 @@ int nfs_readdir_xdr_to_array(nfs_readdir_descriptor_t *desc, struct page *page, - unsigned int array_size = ARRAY_SIZE(pages); - - entry.prev_cookie = 0; -- entry.cookie = *desc->dir_cookie; -+ entry.cookie = desc->last_cookie; - entry.eof = 0; - entry.fh = nfs_alloc_fhandle(); - entry.fattr = nfs_alloc_fattr(); -@@ -636,6 +635,8 @@ int nfs_readdir_filler(nfs_readdir_descriptor_t *desc, struct page* page) - static - void cache_page_release(nfs_readdir_descriptor_t *desc) - { -+ if (!desc->page->mapping) -+ nfs_readdir_clear_array(desc->page); - page_cache_release(desc->page); - desc->page = NULL; - } -@@ -660,9 +661,8 @@ int find_cache_page(nfs_readdir_descriptor_t *desc) - return PTR_ERR(desc->page); - - res = nfs_readdir_search_array(desc); -- if (res == 0) -- return 0; -- cache_page_release(desc); -+ if (res != 0) -+ cache_page_release(desc); - return res; - } - -@@ -672,22 +672,16 @@ int readdir_search_pagecache(nfs_readdir_descriptor_t *desc) - { - int res; - -- if (desc->page_index == 0) -+ if (desc->page_index == 0) { - desc->current_index = 0; -- while (1) { -- res = find_cache_page(desc); -- if (res != -EAGAIN) -- break; -- desc->page_index++; -+ desc->last_cookie = 0; - } -+ do { -+ res = find_cache_page(desc); -+ } while (res == -EAGAIN); - return res; - } - --static inline unsigned int dt_type(struct inode *inode) --{ -- return (inode->i_mode >> 12) & 15; --} -- - /* - * Once we've found the start of the dirent within a page: fill 'er up... - */ -@@ -717,13 +711,12 @@ int nfs_do_filldir(nfs_readdir_descriptor_t *desc, void *dirent, - break; - } - file->f_pos++; -- desc->cache_entry_index = i; - if (i < (array->size-1)) - *desc->dir_cookie = array->array[i+1].cookie; - else - *desc->dir_cookie = array->last_cookie; - } -- if (i == array->eof_index) -+ if (array->eof_index >= 0) - desc->eof = 1; - - nfs_readdir_release_array(desc->page); -@@ -764,6 +757,7 @@ int uncached_readdir(nfs_readdir_descriptor_t *desc, void *dirent, - } - - desc->page_index = 0; -+ desc->last_cookie = *desc->dir_cookie; - desc->page = page; - - status = nfs_readdir_xdr_to_array(desc, page, inode); -@@ -791,7 +785,7 @@ static int nfs_readdir(struct file *filp, void *dirent, filldir_t filldir) - struct inode *inode = dentry->d_inode; - nfs_readdir_descriptor_t my_desc, - *desc = &my_desc; -- int res = -ENOMEM; -+ int res; - - dfprintk(FILE, "NFS: readdir(%s/%s) starting at cookie %llu\n", - dentry->d_parent->d_name.name, dentry->d_name.name, -@@ -816,7 +810,7 @@ static int nfs_readdir(struct file *filp, void *dirent, filldir_t filldir) - if (res < 0) - goto out; - -- while (desc->eof != 1) { -+ do { - res = readdir_search_pagecache(desc); - - if (res == -EBADCOOKIE) { -@@ -844,7 +838,7 @@ static int nfs_readdir(struct file *filp, void *dirent, filldir_t filldir) - res = nfs_do_filldir(desc, dirent, filldir); - if (res < 0) - break; -- } -+ } while (!desc->eof); - out: - nfs_unblock_sillyrename(dentry); - if (res > 0) -diff --git a/fs/nfs/file.c b/fs/nfs/file.c -index 60677f9..7bf029e 100644 ---- a/fs/nfs/file.c -+++ b/fs/nfs/file.c -@@ -693,6 +693,7 @@ do_getlk(struct file *filp, int cmd, struct file_lock *fl, int is_local) - { - struct inode *inode = filp->f_mapping->host; - int status = 0; -+ unsigned int saved_type = fl->fl_type; - - /* Try local locking first */ - posix_test_lock(filp, fl); -@@ -700,6 +701,7 @@ do_getlk(struct file *filp, int cmd, struct file_lock *fl, int is_local) - /* found a conflict */ - goto out; - } -+ fl->fl_type = saved_type; - - if (nfs_have_delegation(inode, FMODE_READ)) - goto out_noconflict; -diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c -index 314f571..e67e31c 100644 ---- a/fs/nfs/inode.c -+++ b/fs/nfs/inode.c -@@ -289,6 +289,7 @@ nfs_fhget(struct super_block *sb, struct nfs_fh *fh, struct nfs_fattr *fattr) - } else if (S_ISDIR(inode->i_mode)) { - inode->i_op = NFS_SB(sb)->nfs_client->rpc_ops->dir_inode_ops; - inode->i_fop = &nfs_dir_operations; -+ inode->i_data.a_ops = &nfs_dir_aops; - if (nfs_server_capable(inode, NFS_CAP_READDIRPLUS)) - set_bit(NFS_INO_ADVISE_RDPLUS, &NFS_I(inode)->flags); - /* Deal with crossing mountpoints */ -diff --git a/fs/nfs/mount_clnt.c b/fs/nfs/mount_clnt.c -index eceafe7..4f981f1 100644 ---- a/fs/nfs/mount_clnt.c -+++ b/fs/nfs/mount_clnt.c -@@ -505,13 +505,13 @@ static struct rpc_procinfo mnt3_procedures[] = { - - static struct rpc_version mnt_version1 = { - .number = 1, -- .nrprocs = 2, -+ .nrprocs = ARRAY_SIZE(mnt_procedures), - .procs = mnt_procedures, - }; - - static struct rpc_version mnt_version3 = { - .number = 3, -- .nrprocs = 2, -+ .nrprocs = ARRAY_SIZE(mnt3_procedures), - .procs = mnt3_procedures, - }; - -diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c -index 6a653ff..4435e5e 100644 ---- a/fs/nfs/nfs4proc.c -+++ b/fs/nfs/nfs4proc.c -@@ -3361,6 +3361,8 @@ static ssize_t nfs4_proc_get_acl(struct inode *inode, void *buf, size_t buflen) - ret = nfs_revalidate_inode(server, inode); - if (ret < 0) - return ret; -+ if (NFS_I(inode)->cache_validity & NFS_INO_INVALID_ACL) -+ nfs_zap_acl_cache(inode); - ret = nfs4_read_cached_acl(inode, buf, buflen); - if (ret != -ENOENT) - return ret; -@@ -3389,6 +3391,13 @@ static int __nfs4_proc_set_acl(struct inode *inode, const void *buf, size_t bufl - nfs_inode_return_delegation(inode); - buf_to_pages(buf, buflen, arg.acl_pages, &arg.acl_pgbase); - ret = nfs4_call_sync(server, &msg, &arg, &res, 1); -+ /* -+ * Acl update can result in inode attribute update. -+ * so mark the attribute cache invalid. -+ */ -+ spin_lock(&inode->i_lock); -+ NFS_I(inode)->cache_validity |= NFS_INO_INVALID_ATTR; -+ spin_unlock(&inode->i_lock); - nfs_access_zap_cache(inode); - nfs_zap_acl_cache(inode); - return ret; -diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c -index 137b549..b68536c 100644 ---- a/fs/nfs/pagelist.c -+++ b/fs/nfs/pagelist.c -@@ -115,7 +115,7 @@ int nfs_set_page_tag_locked(struct nfs_page *req) - { - if (!nfs_lock_request_dontget(req)) - return 0; -- if (req->wb_page != NULL) -+ if (test_bit(PG_MAPPED, &req->wb_flags)) - radix_tree_tag_set(&NFS_I(req->wb_context->path.dentry->d_inode)->nfs_page_tree, req->wb_index, NFS_PAGE_TAG_LOCKED); - return 1; - } -@@ -125,7 +125,7 @@ int nfs_set_page_tag_locked(struct nfs_page *req) - */ - void nfs_clear_page_tag_locked(struct nfs_page *req) - { -- if (req->wb_page != NULL) { -+ if (test_bit(PG_MAPPED, &req->wb_flags)) { - struct inode *inode = req->wb_context->path.dentry->d_inode; - struct nfs_inode *nfsi = NFS_I(inode); - -diff --git a/fs/nfs/read.c b/fs/nfs/read.c -index e4b62c6..aedcaa7 100644 ---- a/fs/nfs/read.c -+++ b/fs/nfs/read.c -@@ -152,7 +152,6 @@ static void nfs_readpage_release(struct nfs_page *req) - (long long)NFS_FILEID(req->wb_context->path.dentry->d_inode), - req->wb_bytes, - (long long)req_offset(req)); -- nfs_clear_request(req); - nfs_release_request(req); - } - -diff --git a/fs/nfs/super.c b/fs/nfs/super.c -index 3c04504..4100630 100644 ---- a/fs/nfs/super.c -+++ b/fs/nfs/super.c -@@ -1069,12 +1069,10 @@ static int nfs_parse_mount_options(char *raw, - mnt->flags |= NFS_MOUNT_VER3; - mnt->version = 3; - break; --#ifdef CONFIG_NFS_V4 - case Opt_v4: - mnt->flags &= ~NFS_MOUNT_VER3; - mnt->version = 4; - break; --#endif - case Opt_udp: - mnt->flags &= ~NFS_MOUNT_TCP; - mnt->nfs_server.protocol = XPRT_TRANSPORT_UDP; -@@ -1286,12 +1284,10 @@ static int nfs_parse_mount_options(char *raw, - mnt->flags |= NFS_MOUNT_VER3; - mnt->version = 3; - break; --#ifdef CONFIG_NFS_V4 - case NFS4_VERSION: - mnt->flags &= ~NFS_MOUNT_VER3; - mnt->version = 4; - break; --#endif - default: - goto out_invalid_value; - } -diff --git a/fs/nfs/write.c b/fs/nfs/write.c -index 4c14c17..10d648e 100644 ---- a/fs/nfs/write.c -+++ b/fs/nfs/write.c -@@ -390,6 +390,7 @@ static int nfs_inode_add_request(struct inode *inode, struct nfs_page *req) - if (nfs_have_delegation(inode, FMODE_WRITE)) - nfsi->change_attr++; - } -+ set_bit(PG_MAPPED, &req->wb_flags); - SetPagePrivate(req->wb_page); - set_page_private(req->wb_page, (unsigned long)req); - nfsi->npages++; -@@ -415,6 +416,7 @@ static void nfs_inode_remove_request(struct nfs_page *req) - spin_lock(&inode->i_lock); - set_page_private(req->wb_page, 0); - ClearPagePrivate(req->wb_page); -+ clear_bit(PG_MAPPED, &req->wb_flags); - radix_tree_delete(&nfsi->nfs_page_tree, req->wb_index); - nfsi->npages--; - if (!nfsi->npages) { -@@ -422,7 +424,6 @@ static void nfs_inode_remove_request(struct nfs_page *req) - iput(inode); - } else - spin_unlock(&inode->i_lock); -- nfs_clear_request(req); - nfs_release_request(req); - } - -diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c -index 2a533a0..7e84a85 100644 ---- a/fs/nfsd/nfs3xdr.c -+++ b/fs/nfsd/nfs3xdr.c -@@ -260,9 +260,11 @@ void fill_post_wcc(struct svc_fh *fhp) - err = vfs_getattr(fhp->fh_export->ex_path.mnt, fhp->fh_dentry, - &fhp->fh_post_attr); - fhp->fh_post_change = fhp->fh_dentry->d_inode->i_version; -- if (err) -+ if (err) { - fhp->fh_post_saved = 0; -- else -+ /* Grab the ctime anyway - set_change_info might use it */ -+ fhp->fh_post_attr.ctime = fhp->fh_dentry->d_inode->i_ctime; -+ } else - fhp->fh_post_saved = 1; - } - -diff --git a/fs/nfsd/xdr4.h b/fs/nfsd/xdr4.h -index 4d476ff..60fce3d 100644 ---- a/fs/nfsd/xdr4.h -+++ b/fs/nfsd/xdr4.h -@@ -484,18 +484,17 @@ static inline bool nfsd4_not_cached(struct nfsd4_compoundres *resp) - static inline void - set_change_info(struct nfsd4_change_info *cinfo, struct svc_fh *fhp) - { -- BUG_ON(!fhp->fh_pre_saved || !fhp->fh_post_saved); -- cinfo->atomic = 1; -+ BUG_ON(!fhp->fh_pre_saved); -+ cinfo->atomic = fhp->fh_post_saved; - cinfo->change_supported = IS_I_VERSION(fhp->fh_dentry->d_inode); -- if (cinfo->change_supported) { -- cinfo->before_change = fhp->fh_pre_change; -- cinfo->after_change = fhp->fh_post_change; -- } else { -- cinfo->before_ctime_sec = fhp->fh_pre_ctime.tv_sec; -- cinfo->before_ctime_nsec = fhp->fh_pre_ctime.tv_nsec; -- cinfo->after_ctime_sec = fhp->fh_post_attr.ctime.tv_sec; -- cinfo->after_ctime_nsec = fhp->fh_post_attr.ctime.tv_nsec; -- } -+ -+ cinfo->before_change = fhp->fh_pre_change; -+ cinfo->after_change = fhp->fh_post_change; -+ cinfo->before_ctime_sec = fhp->fh_pre_ctime.tv_sec; -+ cinfo->before_ctime_nsec = fhp->fh_pre_ctime.tv_nsec; -+ cinfo->after_ctime_sec = fhp->fh_post_attr.ctime.tv_sec; -+ cinfo->after_ctime_nsec = fhp->fh_post_attr.ctime.tv_nsec; -+ - } - - int nfs4svc_encode_voidres(struct svc_rqst *, __be32 *, void *); -diff --git a/fs/xfs/xfs_rename.c b/fs/xfs/xfs_rename.c -index d2af0a8..77a5989 100644 ---- a/fs/xfs/xfs_rename.c -+++ b/fs/xfs/xfs_rename.c -@@ -297,6 +297,7 @@ xfs_rename( - * it and some incremental backup programs won't work without it. - */ - xfs_trans_ichgtime(tp, src_ip, XFS_ICHGTIME_CHG); -+ xfs_trans_log_inode(tp, src_ip, XFS_ILOG_CORE); - - /* - * Adjust the link count on src_dp. This is necessary when -diff --git a/include/acpi/video.h b/include/acpi/video.h -index 551793c..0e98e67 100644 ---- a/include/acpi/video.h -+++ b/include/acpi/video.h -@@ -1,6 +1,10 @@ - #ifndef __ACPI_VIDEO_H - #define __ACPI_VIDEO_H - -+#include /* for ENODEV */ -+ -+struct acpi_device; -+ - #define ACPI_VIDEO_DISPLAY_CRT 1 - #define ACPI_VIDEO_DISPLAY_TV 2 - #define ACPI_VIDEO_DISPLAY_DVI 3 -@@ -26,4 +30,3 @@ static inline int acpi_video_get_edid(struct acpi_device *device, int type, - #endif - - #endif -- -diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h -index 8c641be..a2776e2 100644 ---- a/include/drm/i915_drm.h -+++ b/include/drm/i915_drm.h -@@ -287,6 +287,8 @@ typedef struct drm_i915_irq_wait { - #define I915_PARAM_HAS_EXECBUF2 9 - #define I915_PARAM_HAS_BSD 10 - #define I915_PARAM_HAS_BLT 11 -+#define I915_PARAM_HAS_RELAXED_FENCING 12 -+#define I915_PARAM_HAS_COHERENT_RINGS 13 - - typedef struct drm_i915_getparam { - int param; -diff --git a/include/linux/acpi.h b/include/linux/acpi.h -index 050a7bc..67c91b4 100644 ---- a/include/linux/acpi.h -+++ b/include/linux/acpi.h -@@ -219,7 +219,7 @@ static inline int acpi_video_display_switch_support(void) - - extern int acpi_blacklisted(void); - extern void acpi_dmi_osi_linux(int enable, const struct dmi_system_id *d); --extern int acpi_osi_setup(char *str); -+extern void acpi_osi_setup(char *str); - - #ifdef CONFIG_ACPI_NUMA - int acpi_get_pxm(acpi_handle handle); -diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h -index a8e4e83..475f8c4 100644 ---- a/include/linux/atmdev.h -+++ b/include/linux/atmdev.h -@@ -427,8 +427,10 @@ extern rwlock_t vcc_sklist_lock; - - #define ATM_SKB(skb) (((struct atm_skb_data *) (skb)->cb)) - --struct atm_dev *atm_dev_register(const char *type,const struct atmdev_ops *ops, -- int number,unsigned long *flags); /* number == -1: pick first available */ -+struct atm_dev *atm_dev_register(const char *type, struct device *parent, -+ const struct atmdev_ops *ops, -+ int number, /* -1 == pick first available */ -+ unsigned long *flags); - struct atm_dev *atm_dev_lookup(int number); - void atm_dev_deregister(struct atm_dev *dev); - -diff --git a/include/linux/fs.h b/include/linux/fs.h -index c9e06cc..090f0ea 100644 ---- a/include/linux/fs.h -+++ b/include/linux/fs.h -@@ -602,6 +602,7 @@ struct address_space_operations { - sector_t (*bmap)(struct address_space *, sector_t); - void (*invalidatepage) (struct page *, unsigned long); - int (*releasepage) (struct page *, gfp_t); -+ void (*freepage)(struct page *); - ssize_t (*direct_IO)(int, struct kiocb *, const struct iovec *iov, - loff_t offset, unsigned long nr_segs); - int (*get_xip_mem)(struct address_space *, pgoff_t, int, -diff --git a/include/linux/gpio_keys.h b/include/linux/gpio_keys.h -index ce73a30..dd1a56f 100644 ---- a/include/linux/gpio_keys.h -+++ b/include/linux/gpio_keys.h -@@ -16,6 +16,8 @@ struct gpio_keys_button { - struct gpio_keys_platform_data { - struct gpio_keys_button *buttons; - int nbuttons; -+ unsigned int poll_interval; /* polling interval in msecs - -+ for polling driver only */ - unsigned int rep:1; /* enable input subsystem auto repeat */ - int (*enable)(struct device *dev); - void (*disable)(struct device *dev); -diff --git a/include/linux/input.h b/include/linux/input.h -index 6ef4446..a8af21d 100644 ---- a/include/linux/input.h -+++ b/include/linux/input.h -@@ -47,6 +47,25 @@ struct input_id { - __u16 version; - }; - -+/** -+ * struct input_absinfo - used by EVIOCGABS/EVIOCSABS ioctls -+ * @value: latest reported value for the axis. -+ * @minimum: specifies minimum value for the axis. -+ * @maximum: specifies maximum value for the axis. -+ * @fuzz: specifies fuzz value that is used to filter noise from -+ * the event stream. -+ * @flat: values that are within this value will be discarded by -+ * joydev interface and reported as 0 instead. -+ * @resolution: specifies resolution for the values reported for -+ * the axis. -+ * -+ * Note that input core does not clamp reported values to the -+ * [minimum, maximum] limits, such task is left to userspace. -+ * -+ * Resolution for main axes (ABS_X, ABS_Y, ABS_Z) is reported in -+ * units per millimeter (units/mm), resolution for rotational axes -+ * (ABS_RX, ABS_RY, ABS_RZ) is reported in units per radian. -+ */ - struct input_absinfo { - __s32 value; - __s32 minimum; -@@ -624,6 +643,10 @@ struct input_keymap_entry { - #define KEY_CAMERA_FOCUS 0x210 - #define KEY_WPS_BUTTON 0x211 /* WiFi Protected Setup key */ - -+#define KEY_TOUCHPAD_TOGGLE 0x212 /* Request switch touchpad on or off */ -+#define KEY_TOUCHPAD_ON 0x213 -+#define KEY_TOUCHPAD_OFF 0x214 -+ - #define BTN_TRIGGER_HAPPY 0x2c0 - #define BTN_TRIGGER_HAPPY1 0x2c0 - #define BTN_TRIGGER_HAPPY2 0x2c1 -@@ -1130,7 +1153,7 @@ struct input_mt_slot { - * of tracked contacts - * @mtsize: number of MT slots the device uses - * @slot: MT slot currently being transmitted -- * @absinfo: array of &struct absinfo elements holding information -+ * @absinfo: array of &struct input_absinfo elements holding information - * about absolute axes (current value, min, max, flat, fuzz, - * resolution) - * @key: reflects current state of device's keys/buttons -diff --git a/include/linux/mfd/wm8994/pdata.h b/include/linux/mfd/wm8994/pdata.h -index 5c51f36..add8a1b 100644 ---- a/include/linux/mfd/wm8994/pdata.h -+++ b/include/linux/mfd/wm8994/pdata.h -@@ -29,7 +29,7 @@ struct wm8994_ldo_pdata { - #define WM8994_CONFIGURE_GPIO 0x8000 - - #define WM8994_DRC_REGS 5 --#define WM8994_EQ_REGS 19 -+#define WM8994_EQ_REGS 20 - - /** - * DRC configurations are specified with a label and a set of register -diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h -index c66fdb7..29d504d 100644 ---- a/include/linux/nfs_fs.h -+++ b/include/linux/nfs_fs.h -@@ -401,6 +401,7 @@ extern const struct inode_operations nfs3_file_inode_operations; - #endif /* CONFIG_NFS_V3 */ - extern const struct file_operations nfs_file_operations; - extern const struct address_space_operations nfs_file_aops; -+extern const struct address_space_operations nfs_dir_aops; - - static inline struct nfs_open_context *nfs_file_open_context(struct file *filp) - { -diff --git a/include/linux/nfs_page.h b/include/linux/nfs_page.h -index f8b60e7..d55cee7 100644 ---- a/include/linux/nfs_page.h -+++ b/include/linux/nfs_page.h -@@ -29,6 +29,7 @@ - */ - enum { - PG_BUSY = 0, -+ PG_MAPPED, - PG_CLEAN, - PG_NEED_COMMIT, - PG_NEED_RESCHED, -diff --git a/include/linux/snmp.h b/include/linux/snmp.h -index ebb0c80..12b2b18 100644 ---- a/include/linux/snmp.h -+++ b/include/linux/snmp.h -@@ -230,6 +230,7 @@ enum - LINUX_MIB_TCPMINTTLDROP, /* RFC 5082 */ - LINUX_MIB_TCPDEFERACCEPTDROP, - LINUX_MIB_IPRPFILTER, /* IP Reverse Path Filter (rp_filter) */ -+ LINUX_MIB_TCPTIMEWAITOVERFLOW, /* TCPTimeWaitOverflow */ - __LINUX_MIB_MAX - }; - -diff --git a/include/linux/video_output.h b/include/linux/video_output.h -index 2fb46bc..ed5cdeb 100644 ---- a/include/linux/video_output.h -+++ b/include/linux/video_output.h -@@ -23,6 +23,7 @@ - #ifndef _LINUX_VIDEO_OUTPUT_H - #define _LINUX_VIDEO_OUTPUT_H - #include -+#include - struct output_device; - struct output_properties { - int (*set_state)(struct output_device *); -@@ -34,9 +35,23 @@ struct output_device { - struct device dev; - }; - #define to_output_device(obj) container_of(obj, struct output_device, dev) -+#if defined(CONFIG_VIDEO_OUTPUT_CONTROL) || defined(CONFIG_VIDEO_OUTPUT_CONTROL_MODULE) - struct output_device *video_output_register(const char *name, - struct device *dev, - void *devdata, - struct output_properties *op); - void video_output_unregister(struct output_device *dev); -+#else -+static struct output_device *video_output_register(const char *name, -+ struct device *dev, -+ void *devdata, -+ struct output_properties *op) -+{ -+ return ERR_PTR(-ENODEV); -+} -+static void video_output_unregister(struct output_device *dev) -+{ -+ return; -+} -+#endif - #endif -diff --git a/include/net/sock.h b/include/net/sock.h -index a6338d0..659d968 100644 ---- a/include/net/sock.h -+++ b/include/net/sock.h -@@ -1155,6 +1155,8 @@ extern void sk_common_release(struct sock *sk); - /* Initialise core socket variables */ - extern void sock_init_data(struct socket *sock, struct sock *sk); - -+extern void sk_filter_release_rcu(struct rcu_head *rcu); -+ - /** - * sk_filter_release - release a socket filter - * @fp: filter to remove -@@ -1165,7 +1167,7 @@ extern void sock_init_data(struct socket *sock, struct sock *sk); - static inline void sk_filter_release(struct sk_filter *fp) - { - if (atomic_dec_and_test(&fp->refcnt)) -- kfree(fp); -+ call_rcu_bh(&fp->rcu, sk_filter_release_rcu); - } - - static inline void sk_filter_uncharge(struct sock *sk, struct sk_filter *fp) -diff --git a/kernel/irq/proc.c b/kernel/irq/proc.c -index 01b1d3a..6c8a2a9 100644 ---- a/kernel/irq/proc.c -+++ b/kernel/irq/proc.c -@@ -214,7 +214,7 @@ static int irq_spurious_proc_show(struct seq_file *m, void *v) - - static int irq_spurious_proc_open(struct inode *inode, struct file *file) - { -- return single_open(file, irq_spurious_proc_show, NULL); -+ return single_open(file, irq_spurious_proc_show, PDE(inode)->data); - } - - static const struct file_operations irq_spurious_proc_fops = { -diff --git a/kernel/printk.c b/kernel/printk.c -index 9a2264f..a23315d 100644 ---- a/kernel/printk.c -+++ b/kernel/printk.c -@@ -1082,13 +1082,15 @@ void printk_tick(void) - - int printk_needs_cpu(int cpu) - { -+ if (unlikely(cpu_is_offline(cpu))) -+ printk_tick(); - return per_cpu(printk_pending, cpu); - } - - void wake_up_klogd(void) - { - if (waitqueue_active(&log_wait)) -- __raw_get_cpu_var(printk_pending) = 1; -+ this_cpu_write(printk_pending, 1); - } - - /** -diff --git a/kernel/workqueue.c b/kernel/workqueue.c -index 90db1bd..e785b0f 100644 ---- a/kernel/workqueue.c -+++ b/kernel/workqueue.c -@@ -661,7 +661,7 @@ void wq_worker_waking_up(struct task_struct *task, unsigned int cpu) - { - struct worker *worker = kthread_data(task); - -- if (likely(!(worker->flags & WORKER_NOT_RUNNING))) -+ if (!(worker->flags & WORKER_NOT_RUNNING)) - atomic_inc(get_gcwq_nr_running(cpu)); - } - -@@ -687,7 +687,7 @@ struct task_struct *wq_worker_sleeping(struct task_struct *task, - struct global_cwq *gcwq = get_gcwq(cpu); - atomic_t *nr_running = get_gcwq_nr_running(cpu); - -- if (unlikely(worker->flags & WORKER_NOT_RUNNING)) -+ if (worker->flags & WORKER_NOT_RUNNING) - return NULL; - - /* this can only happen on the local cpu */ -@@ -3692,7 +3692,8 @@ static int __init init_workqueues(void) - system_nrt_wq = alloc_workqueue("events_nrt", WQ_NON_REENTRANT, 0); - system_unbound_wq = alloc_workqueue("events_unbound", WQ_UNBOUND, - WQ_UNBOUND_MAX_ACTIVE); -- BUG_ON(!system_wq || !system_long_wq || !system_nrt_wq); -+ BUG_ON(!system_wq || !system_long_wq || !system_nrt_wq || -+ !system_unbound_wq); - return 0; - } - early_initcall(init_workqueues); -diff --git a/mm/filemap.c b/mm/filemap.c -index ea89840..6b9aee2 100644 ---- a/mm/filemap.c -+++ b/mm/filemap.c -@@ -143,13 +143,18 @@ void __remove_from_page_cache(struct page *page) - void remove_from_page_cache(struct page *page) - { - struct address_space *mapping = page->mapping; -+ void (*freepage)(struct page *); - - BUG_ON(!PageLocked(page)); - -+ freepage = mapping->a_ops->freepage; - spin_lock_irq(&mapping->tree_lock); - __remove_from_page_cache(page); - spin_unlock_irq(&mapping->tree_lock); - mem_cgroup_uncharge_cache_page(page); -+ -+ if (freepage) -+ freepage(page); - } - EXPORT_SYMBOL(remove_from_page_cache); - -diff --git a/mm/truncate.c b/mm/truncate.c -index ba887bf..3c2d5dd 100644 ---- a/mm/truncate.c -+++ b/mm/truncate.c -@@ -390,6 +390,10 @@ invalidate_complete_page2(struct address_space *mapping, struct page *page) - __remove_from_page_cache(page); - spin_unlock_irq(&mapping->tree_lock); - mem_cgroup_uncharge_cache_page(page); -+ -+ if (mapping->a_ops->freepage) -+ mapping->a_ops->freepage(page); -+ - page_cache_release(page); /* pagecache ref */ - return 1; - failed: -diff --git a/mm/vmscan.c b/mm/vmscan.c -index d31d7ce..9ca587c 100644 ---- a/mm/vmscan.c -+++ b/mm/vmscan.c -@@ -494,9 +494,16 @@ static int __remove_mapping(struct address_space *mapping, struct page *page) - spin_unlock_irq(&mapping->tree_lock); - swapcache_free(swap, page); - } else { -+ void (*freepage)(struct page *); -+ -+ freepage = mapping->a_ops->freepage; -+ - __remove_from_page_cache(page); - spin_unlock_irq(&mapping->tree_lock); - mem_cgroup_uncharge_cache_page(page); -+ -+ if (freepage != NULL) -+ freepage(page); - } - - return 1; -diff --git a/net/atm/atm_sysfs.c b/net/atm/atm_sysfs.c -index 799c631..f7fa67c 100644 ---- a/net/atm/atm_sysfs.c -+++ b/net/atm/atm_sysfs.c -@@ -143,12 +143,13 @@ static struct class atm_class = { - .dev_uevent = atm_uevent, - }; - --int atm_register_sysfs(struct atm_dev *adev) -+int atm_register_sysfs(struct atm_dev *adev, struct device *parent) - { - struct device *cdev = &adev->class_dev; - int i, j, err; - - cdev->class = &atm_class; -+ cdev->parent = parent; - dev_set_drvdata(cdev, adev); - - dev_set_name(cdev, "%s%d", adev->type, adev->number); -diff --git a/net/atm/resources.c b/net/atm/resources.c -index d29e582..23f45ce 100644 ---- a/net/atm/resources.c -+++ b/net/atm/resources.c -@@ -74,8 +74,9 @@ struct atm_dev *atm_dev_lookup(int number) - } - EXPORT_SYMBOL(atm_dev_lookup); - --struct atm_dev *atm_dev_register(const char *type, const struct atmdev_ops *ops, -- int number, unsigned long *flags) -+struct atm_dev *atm_dev_register(const char *type, struct device *parent, -+ const struct atmdev_ops *ops, int number, -+ unsigned long *flags) - { - struct atm_dev *dev, *inuse; - -@@ -115,7 +116,7 @@ struct atm_dev *atm_dev_register(const char *type, const struct atmdev_ops *ops, - goto out_fail; - } - -- if (atm_register_sysfs(dev) < 0) { -+ if (atm_register_sysfs(dev, parent) < 0) { - pr_err("atm_register_sysfs failed for dev %s\n", type); - atm_proc_dev_deregister(dev); - goto out_fail; -diff --git a/net/atm/resources.h b/net/atm/resources.h -index 126fb18..521431e 100644 ---- a/net/atm/resources.h -+++ b/net/atm/resources.h -@@ -42,6 +42,6 @@ static inline void atm_proc_dev_deregister(struct atm_dev *dev) - - #endif /* CONFIG_PROC_FS */ - --int atm_register_sysfs(struct atm_dev *adev); -+int atm_register_sysfs(struct atm_dev *adev, struct device *parent); - void atm_unregister_sysfs(struct atm_dev *adev); - #endif -diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c -index d0927d1..66b9e5c 100644 ---- a/net/bluetooth/sco.c -+++ b/net/bluetooth/sco.c -@@ -882,7 +882,7 @@ static int sco_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 type) - int lm = 0; - - if (type != SCO_LINK && type != ESCO_LINK) -- return 0; -+ return -EINVAL; - - BT_DBG("hdev %s, bdaddr %s", hdev->name, batostr(bdaddr)); - -@@ -908,7 +908,7 @@ static int sco_connect_cfm(struct hci_conn *hcon, __u8 status) - BT_DBG("hcon %p bdaddr %s status %d", hcon, batostr(&hcon->dst), status); - - if (hcon->type != SCO_LINK && hcon->type != ESCO_LINK) -- return 0; -+ return -EINVAL; - - if (!status) { - struct sco_conn *conn; -@@ -927,7 +927,7 @@ static int sco_disconn_cfm(struct hci_conn *hcon, __u8 reason) - BT_DBG("hcon %p reason %d", hcon, reason); - - if (hcon->type != SCO_LINK && hcon->type != ESCO_LINK) -- return 0; -+ return -EINVAL; - - sco_conn_del(hcon, bt_err(reason)); - -diff --git a/net/core/filter.c b/net/core/filter.c -index c1ee800..ae21a0d 100644 ---- a/net/core/filter.c -+++ b/net/core/filter.c -@@ -589,23 +589,16 @@ int sk_chk_filter(struct sock_filter *filter, int flen) - EXPORT_SYMBOL(sk_chk_filter); - - /** -- * sk_filter_rcu_release - Release a socket filter by rcu_head -+ * sk_filter_release_rcu - Release a socket filter by rcu_head - * @rcu: rcu_head that contains the sk_filter to free - */ --static void sk_filter_rcu_release(struct rcu_head *rcu) -+void sk_filter_release_rcu(struct rcu_head *rcu) - { - struct sk_filter *fp = container_of(rcu, struct sk_filter, rcu); - -- sk_filter_release(fp); --} -- --static void sk_filter_delayed_uncharge(struct sock *sk, struct sk_filter *fp) --{ -- unsigned int size = sk_filter_len(fp); -- -- atomic_sub(size, &sk->sk_omem_alloc); -- call_rcu_bh(&fp->rcu, sk_filter_rcu_release); -+ kfree(fp); - } -+EXPORT_SYMBOL(sk_filter_release_rcu); - - /** - * sk_attach_filter - attach a socket filter -@@ -649,7 +642,7 @@ int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk) - rcu_assign_pointer(sk->sk_filter, fp); - - if (old_fp) -- sk_filter_delayed_uncharge(sk, old_fp); -+ sk_filter_uncharge(sk, old_fp); - return 0; - } - EXPORT_SYMBOL_GPL(sk_attach_filter); -@@ -663,7 +656,7 @@ int sk_detach_filter(struct sock *sk) - sock_owned_by_user(sk)); - if (filter) { - rcu_assign_pointer(sk->sk_filter, NULL); -- sk_filter_delayed_uncharge(sk, filter); -+ sk_filter_uncharge(sk, filter); - ret = 0; - } - return ret; -diff --git a/net/core/timestamping.c b/net/core/timestamping.c -index 0ae6c22..c19bb4e 100644 ---- a/net/core/timestamping.c -+++ b/net/core/timestamping.c -@@ -96,11 +96,13 @@ bool skb_defer_rx_timestamp(struct sk_buff *skb) - struct phy_device *phydev; - unsigned int type; - -- skb_push(skb, ETH_HLEN); -+ if (skb_headroom(skb) < ETH_HLEN) -+ return false; -+ __skb_push(skb, ETH_HLEN); - - type = classify(skb); - -- skb_pull(skb, ETH_HLEN); -+ __skb_pull(skb, ETH_HLEN); - - switch (type) { - case PTP_CLASS_V1_IPV4: -diff --git a/net/econet/af_econet.c b/net/econet/af_econet.c -index 13992e1..15dcc1a 100644 ---- a/net/econet/af_econet.c -+++ b/net/econet/af_econet.c -@@ -661,8 +661,10 @@ static int ec_dev_ioctl(struct socket *sock, unsigned int cmd, void __user *arg) - err = 0; - switch (cmd) { - case SIOCSIFADDR: -- if (!capable(CAP_NET_ADMIN)) -- return -EPERM; -+ if (!capable(CAP_NET_ADMIN)) { -+ err = -EPERM; -+ break; -+ } - - edev = dev->ec_ptr; - if (edev == NULL) { -@@ -849,9 +851,13 @@ static void aun_incoming(struct sk_buff *skb, struct aunhdr *ah, size_t len) - { - struct iphdr *ip = ip_hdr(skb); - unsigned char stn = ntohl(ip->saddr) & 0xff; -+ struct dst_entry *dst = skb_dst(skb); -+ struct ec_device *edev = NULL; - struct sock *sk = NULL; - struct sk_buff *newskb; -- struct ec_device *edev = skb->dev->ec_ptr; -+ -+ if (dst) -+ edev = dst->dev->ec_ptr; - - if (! edev) - goto bad; -diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c -index 1b48eb1..b14ec7d 100644 ---- a/net/ipv4/proc.c -+++ b/net/ipv4/proc.c -@@ -253,6 +253,7 @@ static const struct snmp_mib snmp4_net_list[] = { - SNMP_MIB_ITEM("TCPMinTTLDrop", LINUX_MIB_TCPMINTTLDROP), - SNMP_MIB_ITEM("TCPDeferAcceptDrop", LINUX_MIB_TCPDEFERACCEPTDROP), - SNMP_MIB_ITEM("IPReversePathFilter", LINUX_MIB_IPRPFILTER), -+ SNMP_MIB_ITEM("TCPTimeWaitOverflow", LINUX_MIB_TCPTIMEWAITOVERFLOW), - SNMP_MIB_SENTINEL - }; - -diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c -index 43cf901..a66735f 100644 ---- a/net/ipv4/tcp_minisocks.c -+++ b/net/ipv4/tcp_minisocks.c -@@ -347,7 +347,7 @@ void tcp_time_wait(struct sock *sk, int state, int timeo) - * socket up. We've got bigger problems than - * non-graceful socket closings. - */ -- LIMIT_NETDEBUG(KERN_INFO "TCP: time wait bucket table overflow\n"); -+ NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPTIMEWAITOVERFLOW); - } - - tcp_update_metrics(sk); -diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c -index 05b1ecf..61c2463 100644 ---- a/net/ipv4/tcp_output.c -+++ b/net/ipv4/tcp_output.c -@@ -231,11 +231,10 @@ void tcp_select_initial_window(int __space, __u32 mss, - /* when initializing use the value from init_rcv_wnd - * rather than the default from above - */ -- if (init_rcv_wnd && -- (*rcv_wnd > init_rcv_wnd * mss)) -- *rcv_wnd = init_rcv_wnd * mss; -- else if (*rcv_wnd > init_cwnd * mss) -- *rcv_wnd = init_cwnd * mss; -+ if (init_rcv_wnd) -+ *rcv_wnd = min(*rcv_wnd, init_rcv_wnd * mss); -+ else -+ *rcv_wnd = min(*rcv_wnd, init_cwnd * mss); - } - - /* Set the clamp no higher than max representable value */ -@@ -386,27 +385,30 @@ struct tcp_out_options { - */ - static u8 tcp_cookie_size_check(u8 desired) - { -- if (desired > 0) { -+ int cookie_size; -+ -+ if (desired > 0) - /* previously specified */ - return desired; -- } -- if (sysctl_tcp_cookie_size <= 0) { -+ -+ cookie_size = ACCESS_ONCE(sysctl_tcp_cookie_size); -+ if (cookie_size <= 0) - /* no default specified */ - return 0; -- } -- if (sysctl_tcp_cookie_size <= TCP_COOKIE_MIN) { -+ -+ if (cookie_size <= TCP_COOKIE_MIN) - /* value too small, specify minimum */ - return TCP_COOKIE_MIN; -- } -- if (sysctl_tcp_cookie_size >= TCP_COOKIE_MAX) { -+ -+ if (cookie_size >= TCP_COOKIE_MAX) - /* value too large, specify maximum */ - return TCP_COOKIE_MAX; -- } -- if (0x1 & sysctl_tcp_cookie_size) { -+ -+ if (cookie_size & 1) - /* 8-bit multiple, illegal, fix it */ -- return (u8)(sysctl_tcp_cookie_size + 0x1); -- } -- return (u8)sysctl_tcp_cookie_size; -+ cookie_size++; -+ -+ return (u8)cookie_size; - } - - /* Write previously computed TCP options to the packet. -@@ -1513,6 +1515,7 @@ static int tcp_tso_should_defer(struct sock *sk, struct sk_buff *skb) - struct tcp_sock *tp = tcp_sk(sk); - const struct inet_connection_sock *icsk = inet_csk(sk); - u32 send_win, cong_win, limit, in_flight; -+ int win_divisor; - - if (TCP_SKB_CB(skb)->flags & TCPHDR_FIN) - goto send_now; -@@ -1544,13 +1547,14 @@ static int tcp_tso_should_defer(struct sock *sk, struct sk_buff *skb) - if ((skb != tcp_write_queue_tail(sk)) && (limit >= skb->len)) - goto send_now; - -- if (sysctl_tcp_tso_win_divisor) { -+ win_divisor = ACCESS_ONCE(sysctl_tcp_tso_win_divisor); -+ if (win_divisor) { - u32 chunk = min(tp->snd_wnd, tp->snd_cwnd * tp->mss_cache); - - /* If at least some fraction of a window is available, - * just use it. - */ -- chunk /= sysctl_tcp_tso_win_divisor; -+ chunk /= win_divisor; - if (limit >= chunk) - goto send_now; - } else { -diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c -index 23cc8e1..93b7a93 100644 ---- a/net/ipv6/addrconf.c -+++ b/net/ipv6/addrconf.c -@@ -4021,11 +4021,11 @@ void inet6_ifinfo_notify(int event, struct inet6_dev *idev) - kfree_skb(skb); - goto errout; - } -- rtnl_notify(skb, net, 0, RTNLGRP_IPV6_IFADDR, NULL, GFP_ATOMIC); -+ rtnl_notify(skb, net, 0, RTNLGRP_IPV6_IFINFO, NULL, GFP_ATOMIC); - return; - errout: - if (err < 0) -- rtnl_set_sk_err(net, RTNLGRP_IPV6_IFADDR, err); -+ rtnl_set_sk_err(net, RTNLGRP_IPV6_IFINFO, err); - } - - static inline size_t inet6_prefix_nlmsg_size(void) -diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c -index 2a59610..70e891a 100644 ---- a/net/ipv6/ip6_tunnel.c -+++ b/net/ipv6/ip6_tunnel.c -@@ -1175,6 +1175,8 @@ static void ip6_tnl_link_config(struct ip6_tnl *t) - sizeof (struct ipv6hdr); - - dev->mtu = rt->rt6i_dev->mtu - sizeof (struct ipv6hdr); -+ if (!(t->parms.flags & IP6_TNL_F_IGN_ENCAP_LIMIT)) -+ dev->mtu-=8; - - if (dev->mtu < IPV6_MIN_MTU) - dev->mtu = IPV6_MIN_MTU; -@@ -1363,12 +1365,17 @@ static const struct net_device_ops ip6_tnl_netdev_ops = { - - static void ip6_tnl_dev_setup(struct net_device *dev) - { -+ struct ip6_tnl *t; -+ - dev->netdev_ops = &ip6_tnl_netdev_ops; - dev->destructor = ip6_dev_free; - - dev->type = ARPHRD_TUNNEL6; - dev->hard_header_len = LL_MAX_HEADER + sizeof (struct ipv6hdr); - dev->mtu = ETH_DATA_LEN - sizeof (struct ipv6hdr); -+ t = netdev_priv(dev); -+ if (!(t->parms.flags & IP6_TNL_F_IGN_ENCAP_LIMIT)) -+ dev->mtu-=8; - dev->flags |= IFF_NOARP; - dev->addr_len = sizeof(struct in6_addr); - dev->features |= NETIF_F_NETNS_LOCAL; -diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c -index d6bfaec..8c4d00c 100644 ---- a/net/ipv6/sit.c -+++ b/net/ipv6/sit.c -@@ -606,8 +606,9 @@ static int ipip6_rcv(struct sk_buff *skb) - return 0; - } - -- icmp_send(skb, ICMP_DEST_UNREACH, ICMP_PORT_UNREACH, 0); -+ /* no tunnel matched, let upstream know, ipsec may handle it */ - rcu_read_unlock(); -+ return 1; - out: - kfree_skb(skb); - return 0; -diff --git a/net/l2tp/l2tp_ip.c b/net/l2tp/l2tp_ip.c -index 0bf6a59..522e219 100644 ---- a/net/l2tp/l2tp_ip.c -+++ b/net/l2tp/l2tp_ip.c -@@ -674,4 +674,8 @@ MODULE_LICENSE("GPL"); - MODULE_AUTHOR("James Chapman "); - MODULE_DESCRIPTION("L2TP over IP"); - MODULE_VERSION("1.0"); --MODULE_ALIAS_NET_PF_PROTO_TYPE(PF_INET, SOCK_DGRAM, IPPROTO_L2TP); -+ -+/* Use the value of SOCK_DGRAM (2) directory, because __stringify does't like -+ * enums -+ */ -+MODULE_ALIAS_NET_PF_PROTO_TYPE(PF_INET, 2, IPPROTO_L2TP); -diff --git a/net/llc/af_llc.c b/net/llc/af_llc.c -index 5826129..e35dbe5 100644 ---- a/net/llc/af_llc.c -+++ b/net/llc/af_llc.c -@@ -317,8 +317,9 @@ static int llc_ui_bind(struct socket *sock, struct sockaddr *uaddr, int addrlen) - goto out; - rc = -ENODEV; - rtnl_lock(); -+ rcu_read_lock(); - if (sk->sk_bound_dev_if) { -- llc->dev = dev_get_by_index(&init_net, sk->sk_bound_dev_if); -+ llc->dev = dev_get_by_index_rcu(&init_net, sk->sk_bound_dev_if); - if (llc->dev) { - if (!addr->sllc_arphrd) - addr->sllc_arphrd = llc->dev->type; -@@ -329,13 +330,13 @@ static int llc_ui_bind(struct socket *sock, struct sockaddr *uaddr, int addrlen) - !llc_mac_match(addr->sllc_mac, - llc->dev->dev_addr)) { - rc = -EINVAL; -- dev_put(llc->dev); - llc->dev = NULL; - } - } - } else - llc->dev = dev_getbyhwaddr(&init_net, addr->sllc_arphrd, - addr->sllc_mac); -+ rcu_read_unlock(); - rtnl_unlock(); - if (!llc->dev) - goto out; -diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c -index 902b03e..54fb4a0e 100644 ---- a/net/mac80211/rx.c -+++ b/net/mac80211/rx.c -@@ -2247,6 +2247,10 @@ ieee80211_rx_h_mgmt(struct ieee80211_rx_data *rx) - break; - case cpu_to_le16(IEEE80211_STYPE_DEAUTH): - case cpu_to_le16(IEEE80211_STYPE_DISASSOC): -+ if (is_multicast_ether_addr(mgmt->da) && -+ !is_broadcast_ether_addr(mgmt->da)) -+ return RX_DROP_MONITOR; -+ - /* process only for station */ - if (sdata->vif.type != NL80211_IFTYPE_STATION) - return RX_DROP_MONITOR; -@@ -2741,6 +2745,7 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw, - - if (ieee80211_prepare_and_rx_handle(&rx, skb, true)) - return; -+ goto out; - } - } - -@@ -2780,6 +2785,7 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw, - return; - } - -+ out: - dev_kfree_skb(skb); - } - -diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c -index 96c5943..7a637b8 100644 ---- a/net/mac80211/tx.c -+++ b/net/mac80211/tx.c -@@ -1587,7 +1587,12 @@ static void ieee80211_xmit(struct ieee80211_sub_if_data *sdata, - list) { - if (!ieee80211_sdata_running(tmp_sdata)) - continue; -- if (tmp_sdata->vif.type != NL80211_IFTYPE_AP) -+ if (tmp_sdata->vif.type == -+ NL80211_IFTYPE_MONITOR || -+ tmp_sdata->vif.type == -+ NL80211_IFTYPE_AP_VLAN || -+ tmp_sdata->vif.type == -+ NL80211_IFTYPE_WDS) - continue; - if (compare_ether_addr(tmp_sdata->vif.addr, - hdr->addr2) == 0) { -@@ -1732,15 +1737,13 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, - int nh_pos, h_pos; - struct sta_info *sta = NULL; - u32 sta_flags = 0; -+ struct sk_buff *tmp_skb; - - if (unlikely(skb->len < ETH_HLEN)) { - ret = NETDEV_TX_OK; - goto fail; - } - -- nh_pos = skb_network_header(skb) - skb->data; -- h_pos = skb_transport_header(skb) - skb->data; -- - /* convert Ethernet header to proper 802.11 header (based on - * operation mode) */ - ethertype = (skb->data[12] << 8) | skb->data[13]; -@@ -1913,6 +1916,20 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, - goto fail; - } - -+ /* -+ * If the skb is shared we need to obtain our own copy. -+ */ -+ if (skb_shared(skb)) { -+ tmp_skb = skb; -+ skb = skb_copy(skb, GFP_ATOMIC); -+ kfree_skb(tmp_skb); -+ -+ if (!skb) { -+ ret = NETDEV_TX_OK; -+ goto fail; -+ } -+ } -+ - hdr.frame_control = fc; - hdr.duration_id = 0; - hdr.seq_ctrl = 0; -@@ -1931,6 +1948,9 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, - encaps_len = 0; - } - -+ nh_pos = skb_network_header(skb) - skb->data; -+ h_pos = skb_transport_header(skb) - skb->data; -+ - skb_pull(skb, skip_header_bytes); - nh_pos -= skip_header_bytes; - h_pos -= skip_header_bytes; -diff --git a/net/sctp/socket.c b/net/sctp/socket.c -index 6bd5543..0b9ee34 100644 ---- a/net/sctp/socket.c -+++ b/net/sctp/socket.c -@@ -2932,6 +2932,7 @@ static int sctp_setsockopt_peer_primary_addr(struct sock *sk, char __user *optva - struct sctp_association *asoc = NULL; - struct sctp_setpeerprim prim; - struct sctp_chunk *chunk; -+ struct sctp_af *af; - int err; - - sp = sctp_sk(sk); -@@ -2959,6 +2960,13 @@ static int sctp_setsockopt_peer_primary_addr(struct sock *sk, char __user *optva - if (!sctp_state(asoc, ESTABLISHED)) - return -ENOTCONN; - -+ af = sctp_get_af_specific(prim.sspp_addr.ss_family); -+ if (!af) -+ return -EINVAL; -+ -+ if (!af->addr_valid((union sctp_addr *)&prim.sspp_addr, sp, NULL)) -+ return -EADDRNOTAVAIL; -+ - if (!sctp_assoc_lookup_laddr(asoc, (union sctp_addr *)&prim.sspp_addr)) - return -EADDRNOTAVAIL; - -diff --git a/net/socket.c b/net/socket.c -index 3ca2fd9..088fb3f 100644 ---- a/net/socket.c -+++ b/net/socket.c -@@ -732,6 +732,21 @@ static int sock_recvmsg_nosec(struct socket *sock, struct msghdr *msg, - return ret; - } - -+/** -+ * kernel_recvmsg - Receive a message from a socket (kernel space) -+ * @sock: The socket to receive the message from -+ * @msg: Received message -+ * @vec: Input s/g array for message data -+ * @num: Size of input s/g array -+ * @size: Number of bytes to read -+ * @flags: Message flags (MSG_DONTWAIT, etc...) -+ * -+ * On return the msg structure contains the scatter/gather array passed in the -+ * vec argument. The array is modified so that it consists of the unfilled -+ * portion of the original array. -+ * -+ * The returned value is the total number of bytes received, or an error. -+ */ - int kernel_recvmsg(struct socket *sock, struct msghdr *msg, - struct kvec *vec, size_t num, size_t size, int flags) - { -diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c -index ea2ff78..3f2c555 100644 ---- a/net/sunrpc/svc_xprt.c -+++ b/net/sunrpc/svc_xprt.c -@@ -212,6 +212,7 @@ int svc_create_xprt(struct svc_serv *serv, const char *xprt_name, - spin_lock(&svc_xprt_class_lock); - list_for_each_entry(xcl, &svc_xprt_class_list, xcl_list) { - struct svc_xprt *newxprt; -+ unsigned short newport; - - if (strcmp(xprt_name, xcl->xcl_name)) - continue; -@@ -230,8 +231,9 @@ int svc_create_xprt(struct svc_serv *serv, const char *xprt_name, - spin_lock_bh(&serv->sv_lock); - list_add(&newxprt->xpt_list, &serv->sv_permsocks); - spin_unlock_bh(&serv->sv_lock); -+ newport = svc_xprt_local_port(newxprt); - clear_bit(XPT_BUSY, &newxprt->xpt_flags); -- return svc_xprt_local_port(newxprt); -+ return newport; - } - err: - spin_unlock(&svc_xprt_class_lock); -@@ -425,8 +427,13 @@ void svc_xprt_received(struct svc_xprt *xprt) - { - BUG_ON(!test_bit(XPT_BUSY, &xprt->xpt_flags)); - xprt->xpt_pool = NULL; -+ /* As soon as we clear busy, the xprt could be closed and -+ * 'put', so we need a reference to call svc_xprt_enqueue with: -+ */ -+ svc_xprt_get(xprt); - clear_bit(XPT_BUSY, &xprt->xpt_flags); - svc_xprt_enqueue(xprt); -+ svc_xprt_put(xprt); - } - EXPORT_SYMBOL_GPL(svc_xprt_received); - -diff --git a/net/x25/x25_link.c b/net/x25/x25_link.c -index 73e7b95..b25c646 100644 ---- a/net/x25/x25_link.c -+++ b/net/x25/x25_link.c -@@ -394,6 +394,7 @@ void __exit x25_link_free(void) - list_for_each_safe(entry, tmp, &x25_neigh_list) { - nb = list_entry(entry, struct x25_neigh, node); - __x25_remove_neigh(nb); -+ dev_put(nb->dev); - } - write_unlock_bh(&x25_neigh_list_lock); - } -diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c -index eb96ce5..220ebc0 100644 ---- a/net/xfrm/xfrm_state.c -+++ b/net/xfrm/xfrm_state.c -@@ -1268,7 +1268,7 @@ struct xfrm_state * xfrm_state_migrate(struct xfrm_state *x, - - return xc; - error: -- kfree(xc); -+ xfrm_state_put(xc); - return NULL; - } - EXPORT_SYMBOL(xfrm_state_migrate); -diff --git a/sound/pci/hda/hda_eld.c b/sound/pci/hda/hda_eld.c -index cb0c23a..4a66347 100644 ---- a/sound/pci/hda/hda_eld.c -+++ b/sound/pci/hda/hda_eld.c -@@ -189,6 +189,9 @@ static void hdmi_update_short_audio_desc(struct cea_sad *a, - a->channels = GRAB_BITS(buf, 0, 0, 3); - a->channels++; - -+ a->sample_bits = 0; -+ a->max_bitrate = 0; -+ - a->format = GRAB_BITS(buf, 0, 3, 4); - switch (a->format) { - case AUDIO_CODING_TYPE_REF_STREAM_HEADER: -@@ -198,7 +201,6 @@ static void hdmi_update_short_audio_desc(struct cea_sad *a, - - case AUDIO_CODING_TYPE_LPCM: - val = GRAB_BITS(buf, 2, 0, 3); -- a->sample_bits = 0; - for (i = 0; i < 3; i++) - if (val & (1 << i)) - a->sample_bits |= cea_sample_sizes[i + 1]; -@@ -598,24 +600,19 @@ void hdmi_eld_update_pcm_info(struct hdmi_eld *eld, struct hda_pcm_stream *pcm, - { - int i; - -- pcm->rates = 0; -- pcm->formats = 0; -- pcm->maxbps = 0; -- pcm->channels_min = -1; -- pcm->channels_max = 0; -+ /* assume basic audio support (the basic audio flag is not in ELD; -+ * however, all audio capable sinks are required to support basic -+ * audio) */ -+ pcm->rates = SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000; -+ pcm->formats = SNDRV_PCM_FMTBIT_S16_LE; -+ pcm->maxbps = 16; -+ pcm->channels_max = 2; - for (i = 0; i < eld->sad_count; i++) { - struct cea_sad *a = &eld->sad[i]; - pcm->rates |= a->rates; -- if (a->channels < pcm->channels_min) -- pcm->channels_min = a->channels; - if (a->channels > pcm->channels_max) - pcm->channels_max = a->channels; - if (a->format == AUDIO_CODING_TYPE_LPCM) { -- if (a->sample_bits & AC_SUPPCM_BITS_16) { -- pcm->formats |= SNDRV_PCM_FMTBIT_S16_LE; -- if (pcm->maxbps < 16) -- pcm->maxbps = 16; -- } - if (a->sample_bits & AC_SUPPCM_BITS_20) { - pcm->formats |= SNDRV_PCM_FMTBIT_S32_LE; - if (pcm->maxbps < 20) -@@ -635,7 +632,6 @@ void hdmi_eld_update_pcm_info(struct hdmi_eld *eld, struct hda_pcm_stream *pcm, - /* restrict the parameters by the values the codec provides */ - pcm->rates &= codec_pars->rates; - pcm->formats &= codec_pars->formats; -- pcm->channels_min = max(pcm->channels_min, codec_pars->channels_min); - pcm->channels_max = min(pcm->channels_max, codec_pars->channels_max); - pcm->maxbps = min(pcm->maxbps, codec_pars->maxbps); - } -diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c -index 21aa9b0..b030c8e 100644 ---- a/sound/pci/hda/hda_intel.c -+++ b/sound/pci/hda/hda_intel.c -@@ -2296,6 +2296,7 @@ static int azx_dev_free(struct snd_device *device) - */ - static struct snd_pci_quirk position_fix_list[] __devinitdata = { - SND_PCI_QUIRK(0x1025, 0x009f, "Acer Aspire 5110", POS_FIX_LPIB), -+ SND_PCI_QUIRK(0x1025, 0x026f, "Acer Aspire 5538", POS_FIX_LPIB), - SND_PCI_QUIRK(0x1028, 0x01cc, "Dell D820", POS_FIX_LPIB), - SND_PCI_QUIRK(0x1028, 0x01de, "Dell Precision 390", POS_FIX_LPIB), - SND_PCI_QUIRK(0x1028, 0x01f6, "Dell Latitude 131L", POS_FIX_LPIB), -diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c -index 846d1ea..76bd58a 100644 ---- a/sound/pci/hda/patch_conexant.c -+++ b/sound/pci/hda/patch_conexant.c -@@ -2116,8 +2116,8 @@ static void cxt5066_update_speaker(struct hda_codec *codec) - struct conexant_spec *spec = codec->spec; - unsigned int pinctl; - -- snd_printdd("CXT5066: update speaker, hp_present=%d\n", -- spec->hp_present); -+ snd_printdd("CXT5066: update speaker, hp_present=%d, cur_eapd=%d\n", -+ spec->hp_present, spec->cur_eapd); - - /* Port A (HP) */ - pinctl = ((spec->hp_present & 1) && spec->cur_eapd) ? PIN_HP : 0; -@@ -2125,11 +2125,20 @@ static void cxt5066_update_speaker(struct hda_codec *codec) - pinctl); - - /* Port D (HP/LO) */ -- pinctl = ((spec->hp_present & 2) && spec->cur_eapd) -- ? spec->port_d_mode : 0; -- /* Mute if Port A is connected on Thinkpad */ -- if (spec->thinkpad && (spec->hp_present & 1)) -- pinctl = 0; -+ if (spec->dell_automute) { -+ /* DELL AIO Port Rule: PortA> PortD> IntSpk */ -+ pinctl = (!(spec->hp_present & 1) && spec->cur_eapd) -+ ? PIN_OUT : 0; -+ } else if (spec->thinkpad) { -+ if (spec->cur_eapd) -+ pinctl = spec->port_d_mode; -+ /* Mute dock line-out if Port A (laptop HP) is present */ -+ if (spec->hp_present& 1) -+ pinctl = 0; -+ } else { -+ pinctl = ((spec->hp_present & 2) && spec->cur_eapd) -+ ? spec->port_d_mode : 0; -+ } - snd_hda_codec_write(codec, 0x1c, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, - pinctl); - -@@ -2137,14 +2146,6 @@ static void cxt5066_update_speaker(struct hda_codec *codec) - pinctl = (!spec->hp_present && spec->cur_eapd) ? PIN_OUT : 0; - snd_hda_codec_write(codec, 0x1f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, - pinctl); -- -- if (spec->dell_automute) { -- /* DELL AIO Port Rule: PortA > PortD > IntSpk */ -- pinctl = (!(spec->hp_present & 1) && spec->cur_eapd) -- ? PIN_OUT : 0; -- snd_hda_codec_write(codec, 0x1c, 0, -- AC_VERB_SET_PIN_WIDGET_CONTROL, pinctl); -- } - } - - /* turn on/off EAPD (+ mute HP) as a master switch */ -@@ -3095,8 +3096,7 @@ static const char *cxt5066_models[CXT5066_MODELS] = { - static struct snd_pci_quirk cxt5066_cfg_tbl[] = { - SND_PCI_QUIRK_MASK(0x1025, 0xff00, 0x0400, "Acer", CXT5066_IDEAPAD), - SND_PCI_QUIRK(0x1028, 0x02d8, "Dell Vostro", CXT5066_DELL_VOSTRO), -- SND_PCI_QUIRK(0x1028, 0x02f5, "Dell", -- CXT5066_DELL_LAPTOP), -+ SND_PCI_QUIRK(0x1028, 0x02f5, "Dell Vostro 320", CXT5066_IDEAPAD), - SND_PCI_QUIRK(0x1028, 0x0402, "Dell Vostro", CXT5066_DELL_VOSTRO), - SND_PCI_QUIRK(0x1028, 0x0408, "Dell Inspiron One 19T", CXT5066_IDEAPAD), - SND_PCI_QUIRK(0x103c, 0x360b, "HP G60", CXT5066_HP_LAPTOP), -@@ -3109,6 +3109,7 @@ static struct snd_pci_quirk cxt5066_cfg_tbl[] = { - SND_PCI_QUIRK(0x152d, 0x0833, "OLPC XO-1.5", CXT5066_OLPC_XO_1_5), - SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo T400s", CXT5066_THINKPAD), - SND_PCI_QUIRK(0x17aa, 0x21b2, "Thinkpad X100e", CXT5066_IDEAPAD), -+ SND_PCI_QUIRK(0x17aa, 0x21c5, "Thinkpad Edge 13", CXT5066_THINKPAD), - SND_PCI_QUIRK(0x17aa, 0x21b3, "Thinkpad Edge 13 (197)", CXT5066_IDEAPAD), - SND_PCI_QUIRK(0x17aa, 0x21b4, "Thinkpad Edge", CXT5066_IDEAPAD), - SND_PCI_QUIRK(0x17aa, 0x21c8, "Thinkpad Edge 11", CXT5066_IDEAPAD), -diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c -index d3e49aa..31df774 100644 ---- a/sound/pci/hda/patch_hdmi.c -+++ b/sound/pci/hda/patch_hdmi.c -@@ -834,7 +834,6 @@ static int hdmi_pcm_open(struct hda_pcm_stream *hinfo, - return -ENODEV; - } else { - /* fallback to the codec default */ -- hinfo->channels_min = codec_pars->channels_min; - hinfo->channels_max = codec_pars->channels_max; - hinfo->rates = codec_pars->rates; - hinfo->formats = codec_pars->formats; -diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c -index 8fddc9d..2d7d7de 100644 ---- a/sound/pci/hda/patch_realtek.c -+++ b/sound/pci/hda/patch_realtek.c -@@ -4595,6 +4595,7 @@ static struct snd_pci_quirk alc880_cfg_tbl[] = { - SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), - SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), - SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), -+ SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_LG), - SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), - SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), - SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), -diff --git a/sound/soc/codecs/wm8580.c b/sound/soc/codecs/wm8580.c -index a2e0ed5..879dff2 100644 ---- a/sound/soc/codecs/wm8580.c -+++ b/sound/soc/codecs/wm8580.c -@@ -491,16 +491,16 @@ static int wm8580_paif_hw_params(struct snd_pcm_substream *substream, - paifa |= 0x8; - break; - case SNDRV_PCM_FORMAT_S20_3LE: -- paifa |= 0x10; -+ paifa |= 0x0; - paifb |= WM8580_AIF_LENGTH_20; - break; - case SNDRV_PCM_FORMAT_S24_LE: -- paifa |= 0x10; -+ paifa |= 0x0; - paifb |= WM8580_AIF_LENGTH_24; - break; - case SNDRV_PCM_FORMAT_S32_LE: -- paifa |= 0x10; -- paifb |= WM8580_AIF_LENGTH_24; -+ paifa |= 0x0; -+ paifb |= WM8580_AIF_LENGTH_32; - break; - default: - return -EINVAL; -diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c -index e809274..1304ca9 100644 ---- a/sound/soc/codecs/wm8962.c -+++ b/sound/soc/codecs/wm8962.c -@@ -3339,7 +3339,7 @@ static irqreturn_t wm8962_irq(int irq, void *data) - int mask; - int active; - -- mask = snd_soc_read(codec, WM8962_INTERRUPT_STATUS_2); -+ mask = snd_soc_read(codec, WM8962_INTERRUPT_STATUS_2_MASK); - - active = snd_soc_read(codec, WM8962_INTERRUPT_STATUS_2); - active &= ~mask; -diff --git a/sound/soc/codecs/wm_hubs.c b/sound/soc/codecs/wm_hubs.c -index 19ca782..0e24092 100644 ---- a/sound/soc/codecs/wm_hubs.c -+++ b/sound/soc/codecs/wm_hubs.c -@@ -293,7 +293,7 @@ SOC_DOUBLE_R("Speaker Switch", - SOC_DOUBLE_R("Speaker ZC Switch", - WM8993_SPEAKER_VOLUME_LEFT, WM8993_SPEAKER_VOLUME_RIGHT, - 7, 1, 0), --SOC_DOUBLE_TLV("Speaker Boost Volume", WM8993_SPKOUT_BOOST, 0, 3, 7, 0, -+SOC_DOUBLE_TLV("Speaker Boost Volume", WM8993_SPKOUT_BOOST, 3, 0, 7, 0, - spkboost_tlv), - SOC_ENUM("Speaker Reference", speaker_ref), - SOC_ENUM("Speaker Mode", speaker_mode), -diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c -index 441285a..85b7d54 100644 ---- a/sound/soc/soc-core.c -+++ b/sound/soc/soc-core.c -@@ -1619,12 +1619,14 @@ static void snd_soc_instantiate_card(struct snd_soc_card *card) - #ifdef CONFIG_SND_SOC_AC97_BUS - /* register any AC97 codecs */ - for (i = 0; i < card->num_rtd; i++) { -- ret = soc_register_ac97_dai_link(&card->rtd[i]); -- if (ret < 0) { -- printk(KERN_ERR "asoc: failed to register AC97 %s\n", card->name); -- goto probe_dai_err; -- } -+ ret = soc_register_ac97_dai_link(&card->rtd[i]); -+ if (ret < 0) { -+ printk(KERN_ERR "asoc: failed to register AC97 %s\n", card->name); -+ while (--i >= 0) -+ soc_unregister_ac97_dai_link(&card->rtd[i]); -+ goto probe_dai_err; - } -+ } - #endif - - card->instantiated = 1; -@@ -3072,7 +3074,9 @@ int snd_soc_register_dais(struct device *dev, - pr_debug("Registered DAI '%s'\n", dai->name); - } - -+ mutex_lock(&client_mutex); - snd_soc_instantiate_cards(); -+ mutex_unlock(&client_mutex); - return 0; - - err: -diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c -index e2c2de2..564491f 100644 ---- a/tools/perf/builtin-record.c -+++ b/tools/perf/builtin-record.c -@@ -197,7 +197,7 @@ static void sig_atexit(void) - if (child_pid > 0) - kill(child_pid, SIGTERM); - -- if (signr == -1) -+ if (signr == -1 || signr == SIGUSR1) - return; - - signal(signr, SIG_DFL); -@@ -515,6 +515,7 @@ static int __cmd_record(int argc, const char **argv) - atexit(sig_atexit); - signal(SIGCHLD, sig_handler); - signal(SIGINT, sig_handler); -+ signal(SIGUSR1, sig_handler); - - if (forks && (pipe(child_ready_pipe) < 0 || pipe(go_pipe) < 0)) { - perror("failed to create pipes"); -@@ -606,6 +607,7 @@ static int __cmd_record(int argc, const char **argv) - execvp(argv[0], (char **)argv); - - perror(argv[0]); -+ kill(getppid(), SIGUSR1); - exit(-1); - } - -@@ -762,7 +764,7 @@ static int __cmd_record(int argc, const char **argv) - } - } - -- if (quiet) -+ if (quiet || signr == SIGUSR1) - return 0; - - fprintf(stderr, "[ perf record: Woken up %ld times to write data ]\n", waking); -diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c -index d7e67b1..64a85ba 100644 ---- a/tools/perf/util/header.c -+++ b/tools/perf/util/header.c -@@ -946,11 +946,16 @@ perf_header__find_attr(u64 id, struct perf_header *header) - - /* - * We set id to -1 if the data file doesn't contain sample -- * ids. Check for this and avoid walking through the entire -- * list of ids which may be large. -+ * ids. This can happen when the data file contains one type -+ * of event and in that case, the header can still store the -+ * event attribute information. Check for this and avoid -+ * walking through the entire list of ids which may be large. - */ -- if (id == -1ULL) -+ if (id == -1ULL) { -+ if (header->attrs > 0) -+ return &header->attr[0]->attr; - return NULL; -+ } - - for (i = 0; i < header->attrs; i++) { - struct perf_header_attr *attr = header->attr[i]; -diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c -index 0500895..d628c8d 100644 ---- a/tools/perf/util/symbol.c -+++ b/tools/perf/util/symbol.c -@@ -532,7 +532,7 @@ static int dso__split_kallsyms(struct dso *self, struct map *map, - struct machine *machine = kmaps->machine; - struct map *curr_map = map; - struct symbol *pos; -- int count = 0; -+ int count = 0, moved = 0; - struct rb_root *root = &self->symbols[map->type]; - struct rb_node *next = rb_first(root); - int kernel_range = 0; -@@ -590,6 +590,11 @@ static int dso__split_kallsyms(struct dso *self, struct map *map, - char dso_name[PATH_MAX]; - struct dso *dso; - -+ if (count == 0) { -+ curr_map = map; -+ goto filter_symbol; -+ } -+ - if (self->kernel == DSO_TYPE_GUEST_KERNEL) - snprintf(dso_name, sizeof(dso_name), - "[guest.kernel].%d", -@@ -615,7 +620,7 @@ static int dso__split_kallsyms(struct dso *self, struct map *map, - map_groups__insert(kmaps, curr_map); - ++kernel_range; - } -- -+filter_symbol: - if (filter && filter(curr_map, pos)) { - discard_symbol: rb_erase(&pos->rb_node, root); - symbol__delete(pos); -@@ -623,8 +628,9 @@ discard_symbol: rb_erase(&pos->rb_node, root); - if (curr_map != map) { - rb_erase(&pos->rb_node, root); - symbols__insert(&curr_map->dso->symbols[curr_map->type], pos); -- } -- count++; -+ ++moved; -+ } else -+ ++count; - } - } - -@@ -634,7 +640,7 @@ discard_symbol: rb_erase(&pos->rb_node, root); - dso__set_loaded(curr_map->dso, curr_map->type); - } - -- return count; -+ return count + moved; - } - - int dso__load_kallsyms(struct dso *self, const char *filename, -@@ -2125,14 +2131,55 @@ static struct dso *machine__create_kernel(struct machine *self) - return kernel; - } - -+struct process_args { -+ u64 start; -+}; -+ -+static int symbol__in_kernel(void *arg, const char *name, -+ char type __used, u64 start) -+{ -+ struct process_args *args = arg; -+ -+ if (strchr(name, '[')) -+ return 0; -+ -+ args->start = start; -+ return 1; -+} -+ -+/* Figure out the start address of kernel map from /proc/kallsyms */ -+static u64 machine__get_kernel_start_addr(struct machine *machine) -+{ -+ const char *filename; -+ char path[PATH_MAX]; -+ struct process_args args; -+ -+ if (machine__is_host(machine)) { -+ filename = "/proc/kallsyms"; -+ } else { -+ if (machine__is_default_guest(machine)) -+ filename = (char *)symbol_conf.default_guest_kallsyms; -+ else { -+ sprintf(path, "%s/proc/kallsyms", machine->root_dir); -+ filename = path; -+ } -+ } -+ -+ if (kallsyms__parse(filename, &args, symbol__in_kernel) <= 0) -+ return 0; -+ -+ return args.start; -+} -+ - int __machine__create_kernel_maps(struct machine *self, struct dso *kernel) - { - enum map_type type; -+ u64 start = machine__get_kernel_start_addr(self); - - for (type = 0; type < MAP__NR_TYPES; ++type) { - struct kmap *kmap; - -- self->vmlinux_maps[type] = map__new2(0, kernel, type); -+ self->vmlinux_maps[type] = map__new2(start, kernel, type); - if (self->vmlinux_maps[type] == NULL) - return -1; - diff --git a/packages/linux/patches/linux-2.6.37-rc5-000_crosscompile.patch b/packages/linux/patches/linux-2.6.37-rc6-000_crosscompile.patch similarity index 100% rename from packages/linux/patches/linux-2.6.37-rc5-000_crosscompile.patch rename to packages/linux/patches/linux-2.6.37-rc6-000_crosscompile.patch diff --git a/packages/linux/patches/linux-2.6.37-rc5-002_bash_only_feature.patch b/packages/linux/patches/linux-2.6.37-rc6-002_bash_only_feature.patch similarity index 100% rename from packages/linux/patches/linux-2.6.37-rc5-002_bash_only_feature.patch rename to packages/linux/patches/linux-2.6.37-rc6-002_bash_only_feature.patch diff --git a/packages/linux/patches/linux-2.6.37-rc5-003-no_dev_console.patch b/packages/linux/patches/linux-2.6.37-rc6-003-no_dev_console.patch similarity index 100% rename from packages/linux/patches/linux-2.6.37-rc5-003-no_dev_console.patch rename to packages/linux/patches/linux-2.6.37-rc6-003-no_dev_console.patch diff --git a/packages/linux/patches/linux-2.6.37-rc5-004_lower_undefined_mode_timeout.patch b/packages/linux/patches/linux-2.6.37-rc6-004_lower_undefined_mode_timeout.patch similarity index 100% rename from packages/linux/patches/linux-2.6.37-rc5-004_lower_undefined_mode_timeout.patch rename to packages/linux/patches/linux-2.6.37-rc6-004_lower_undefined_mode_timeout.patch diff --git a/packages/linux/patches/linux-2.6.37-rc5-005_kconfig_no_timestamp.patch b/packages/linux/patches/linux-2.6.37-rc6-005_kconfig_no_timestamp.patch similarity index 100% rename from packages/linux/patches/linux-2.6.37-rc5-005_kconfig_no_timestamp.patch rename to packages/linux/patches/linux-2.6.37-rc6-005_kconfig_no_timestamp.patch diff --git a/packages/linux/patches/linux-2.6.37-rc5-006_enable_utf8.patch b/packages/linux/patches/linux-2.6.37-rc6-006_enable_utf8.patch similarity index 100% rename from packages/linux/patches/linux-2.6.37-rc5-006_enable_utf8.patch rename to packages/linux/patches/linux-2.6.37-rc6-006_enable_utf8.patch diff --git a/packages/linux/patches/linux-2.6.37-rc5-007_die_floppy_die.patch b/packages/linux/patches/linux-2.6.37-rc6-007_die_floppy_die.patch similarity index 100% rename from packages/linux/patches/linux-2.6.37-rc5-007_die_floppy_die.patch rename to packages/linux/patches/linux-2.6.37-rc6-007_die_floppy_die.patch diff --git a/packages/linux/patches/linux-2.6.37-rc5-008-hda_intel_prealloc_4mb_dmabuffer.patch b/packages/linux/patches/linux-2.6.37-rc6-008-hda_intel_prealloc_4mb_dmabuffer.patch similarity index 100% rename from packages/linux/patches/linux-2.6.37-rc5-008-hda_intel_prealloc_4mb_dmabuffer.patch rename to packages/linux/patches/linux-2.6.37-rc6-008-hda_intel_prealloc_4mb_dmabuffer.patch diff --git a/packages/linux/patches/linux-2.6.37-rc5-009_disable_i8042_check_on_apple_mac.patch b/packages/linux/patches/linux-2.6.37-rc6-009_disable_i8042_check_on_apple_mac.patch similarity index 100% rename from packages/linux/patches/linux-2.6.37-rc5-009_disable_i8042_check_on_apple_mac.patch rename to packages/linux/patches/linux-2.6.37-rc6-009_disable_i8042_check_on_apple_mac.patch diff --git a/packages/linux/patches/linux-2.6.37-rc5-050_add_appleir_usb_driver.patch b/packages/linux/patches/linux-2.6.37-rc6-050_add_appleir_usb_driver.patch similarity index 100% rename from packages/linux/patches/linux-2.6.37-rc5-050_add_appleir_usb_driver.patch rename to packages/linux/patches/linux-2.6.37-rc6-050_add_appleir_usb_driver.patch diff --git a/packages/linux/patches/linux-2.6.37-rc5-052-aureal_remote_quirk-0.1.patch b/packages/linux/patches/linux-2.6.37-rc6-052-aureal_remote_quirk-0.1.patch similarity index 100% rename from packages/linux/patches/linux-2.6.37-rc5-052-aureal_remote_quirk-0.1.patch rename to packages/linux/patches/linux-2.6.37-rc6-052-aureal_remote_quirk-0.1.patch diff --git a/packages/linux/patches/linux-2.6.37-rc5-110-drm_nouveau_upstream-20101205.patch b/packages/linux/patches/linux-2.6.37-rc6-110-drm_nouveau_upstream-20101205.patch similarity index 100% rename from packages/linux/patches/linux-2.6.37-rc5-110-drm_nouveau_upstream-20101205.patch rename to packages/linux/patches/linux-2.6.37-rc6-110-drm_nouveau_upstream-20101205.patch