Merge branch 'for-linus' of git://git.kernel.dk/linux-block
authorLinus Torvalds <torvalds@linux-foundation.org>
Sat, 19 May 2012 17:12:17 +0000 (10:12 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 19 May 2012 17:12:17 +0000 (10:12 -0700)
Pull block layer fixes from Jens Axboe:
 "A few small, but important fixes.  Most of them are marked for stable
  as well

   - Fix failure to release a semaphore on error path in mtip32xx.
   - Fix crashable condition in bio_get_nr_vecs().
   - Don't mark end-of-disk buffers as mapped, limit it to i_size.
   - Fix for build problem with CONFIG_BLOCK=n on arm at least.
   - Fix for a buffer overlow on UUID partition printing.
   - Trivial removal of unused variables in dac960."

* 'for-linus' of git://git.kernel.dk/linux-block:
  block: fix buffer overflow when printing partition UUIDs
  Fix blkdev.h build errors when BLOCK=n
  bio allocation failure due to bio_get_nr_vecs()
  block: don't mark buffers beyond end of disk as mapped
  mtip32xx: release the semaphore on an error path
  dac960: Remove unused variables from DAC960_CreateProcEntries()

175 files changed:
Documentation/feature-removal-schedule.txt
MAINTAINERS
Makefile
arch/arm/mach-exynos/Kconfig
arch/arm/mach-exynos/clock-exynos5.c
arch/arm/mach-exynos/mach-universal_c210.c
arch/arm/mach-prima2/irq.c
arch/arm/mach-shmobile/board-ag5evm.c
arch/arm/mach-shmobile/board-mackerel.c
arch/arm/mach-shmobile/headsmp.S
arch/arm/mach-shmobile/include/mach/common.h
arch/arm/mach-shmobile/setup-r8a7779.c
arch/arm/mach-shmobile/setup-sh73a0.c
arch/arm/mach-shmobile/smp-r8a7779.c
arch/arm/mach-shmobile/smp-sh73a0.c
arch/arm/mach-shmobile/timer.c
arch/arm/mach-tegra/flowctrl.c
arch/arm/mm/fault.c
arch/arm/mm/mmu.c
arch/arm/vfp/vfpmodule.c
arch/frv/include/asm/processor.h
arch/m68k/platform/520x/config.c
arch/m68k/platform/523x/config.c
arch/m68k/platform/5249/config.c
arch/m68k/platform/527x/config.c
arch/m68k/platform/528x/config.c
arch/m68k/platform/532x/config.c
arch/m68k/platform/coldfire/device.c
arch/mn10300/kernel/smp.c
arch/parisc/kernel/smp.c
arch/powerpc/include/asm/kvm_book3s.h
arch/powerpc/kernel/entry_64.S
arch/powerpc/kernel/irq.c
arch/powerpc/kvm/book3s_64_mmu_host.c
arch/powerpc/kvm/book3s_hv_rm_mmu.c
arch/powerpc/kvm/book3s_segment.S
arch/tile/Kconfig
arch/tile/include/asm/thread_info.h
arch/tile/kernel/compat_signal.c
arch/tile/kernel/intvec_32.S
arch/tile/kernel/intvec_64.S
arch/tile/kernel/process.c
arch/x86/include/asm/kvm_para.h
arch/x86/kernel/acpi/boot.c
arch/x86/kernel/cpu/mcheck/mce.c
arch/x86/kernel/microcode_intel.c
drivers/acpi/bus.c
drivers/acpi/power.c
drivers/acpi/scan.c
drivers/block/drbd/drbd_nl.c
drivers/char/virtio_console.c
drivers/crypto/Kconfig
drivers/dma/at_hdmac.c
drivers/dma/ep93xx_dma.c
drivers/dma/pl330.c
drivers/gpio/gpio-omap.c
drivers/gpio/gpio-pch.c
drivers/gpio/gpio-samsung.c
drivers/md/dm-log-userspace-transfer.c
drivers/md/dm-mpath.c
drivers/md/dm-thin.c
drivers/md/md.c
drivers/md/raid10.c
drivers/media/dvb/dvb-core/dvb_frontend.c
drivers/media/rc/ene_ir.c
drivers/media/rc/fintek-cir.c
drivers/media/rc/ite-cir.c
drivers/media/rc/nuvoton-cir.c
drivers/media/rc/winbond-cir.c
drivers/media/video/gspca/sonixj.c
drivers/media/video/marvell-ccic/mmp-driver.c
drivers/media/video/s5p-fimc/fimc-capture.c
drivers/media/video/s5p-fimc/fimc-core.c
drivers/media/video/s5p-fimc/fimc-core.h
drivers/media/video/soc_camera.c
drivers/media/video/videobuf2-dma-contig.c
drivers/media/video/videobuf2-memops.c
drivers/mtd/mtdchar.c
drivers/mtd/nand/ams-delta.c
drivers/net/bonding/bond_3ad.c
drivers/net/bonding/bond_3ad.h
drivers/net/bonding/bond_alb.c
drivers/net/bonding/bond_main.c
drivers/net/bonding/bonding.h
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
drivers/net/ethernet/ibm/ehea/ehea_main.c
drivers/net/ethernet/intel/e1000/e1000_main.c
drivers/net/ethernet/intel/igb/igb_main.c
drivers/net/ethernet/intel/ixgbe/ixgbe.h
drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
drivers/net/ethernet/micrel/ks8851.c
drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe.h
drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
drivers/net/ethernet/realtek/r8169.c
drivers/net/ethernet/sfc/efx.c
drivers/net/macvlan.c
drivers/net/macvtap.c
drivers/net/usb/cdc_ether.c
drivers/net/usb/usbnet.c
drivers/net/virtio_net.c
drivers/net/wireless/ath/ath9k/ar9003_phy.c
drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c
drivers/net/wireless/iwlwifi/iwl-agn-rx.c
drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
drivers/net/wireless/iwlwifi/iwl-trans.h
drivers/net/wireless/rtlwifi/pci.c
drivers/net/wireless/rtlwifi/usb.c
drivers/pci/pci-acpi.c
drivers/ptp/ptp_pch.c
drivers/remoteproc/remoteproc_core.c
drivers/rtc/rtc-pl031.c
drivers/scsi/hosts.c
drivers/scsi/qla2xxx/qla_bsg.c
drivers/scsi/qla2xxx/qla_dbg.c
drivers/scsi/qla2xxx/qla_isr.c
drivers/scsi/qla2xxx/qla_nx.c
drivers/scsi/qla2xxx/qla_os.c
drivers/scsi/qla2xxx/qla_sup.c
drivers/scsi/qla2xxx/qla_version.h
drivers/scsi/virtio_scsi.c
drivers/target/target_core_file.c
drivers/target/target_core_pr.c
drivers/target/target_core_tpg.c
drivers/tty/vt/keyboard.c
drivers/vhost/net.c
drivers/video/uvesafb.c
drivers/virtio/virtio_balloon.c
fs/cifs/connect.c
fs/jffs2/gc.c
fs/proc/base.c
include/linux/etherdevice.h
include/linux/ftrace_event.h
include/linux/netdevice.h
include/linux/netfilter/ipset/ip_set_ahash.h
include/linux/usb/usbnet.h
include/media/soc_camera.h
include/net/bluetooth/bluetooth.h
include/net/sctp/sctp.h
kernel/irq/chip.c
kernel/irq/irqdesc.c
kernel/sched/core.c
kernel/trace/trace_events.c
kernel/trace/trace_export.c
mm/memcontrol.c
mm/page_alloc.c
mm/slub.c
net/8021q/vlan_dev.c
net/bluetooth/af_bluetooth.c
net/bluetooth/hci_core.c
net/bluetooth/hci_event.c
net/bluetooth/l2cap_core.c
net/bluetooth/l2cap_sock.c
net/core/dev.c
net/core/pktgen.c
net/ipv4/fib_trie.c
net/ipv4/tcp.c
net/netfilter/ipset/ip_set_hash_ip.c
net/netfilter/ipset/ip_set_hash_ipport.c
net/netfilter/ipset/ip_set_hash_ipportip.c
net/netfilter/ipset/ip_set_hash_ipportnet.c
net/netfilter/ipset/ip_set_hash_net.c
net/netfilter/ipset/ip_set_hash_netiface.c
net/netfilter/ipset/ip_set_hash_netport.c
net/openvswitch/datapath.c
net/openvswitch/flow.c
net/sctp/output.c
net/sctp/transport.c
sound/pci/hda/patch_sigmatel.c
sound/soc/codecs/cs42l73.c
sound/soc/codecs/wm8994.c
tools/perf/Makefile
tools/perf/builtin-stat.c
tools/perf/util/header.c

index 03ca210..e4b5775 100644 (file)
@@ -539,3 +539,13 @@ When:      3.6
 Why:   setitimer is not returning -EFAULT if user pointer is NULL. This
        violates the spec.
 Who:   Sasikantha Babu <sasikanth.v19@gmail.com>
+
+----------------------------
+
+What:  V4L2_CID_HCENTER, V4L2_CID_VCENTER V4L2 controls
+When:  3.7
+Why:   The V4L2_CID_VCENTER, V4L2_CID_HCENTER controls have been deprecated
+       for about 4 years and they are not used by any mainline driver.
+       There are newer controls (V4L2_CID_PAN*, V4L2_CID_TILT*) that provide
+       similar functionality.
+Who:   Sylwester Nawrocki <sylvester.nawrocki@gmail.com>
index de4e280..b362709 100644 (file)
@@ -1968,7 +1968,9 @@ S:        Maintained
 F:     drivers/net/ethernet/ti/cpmac.c
 
 CPU FREQUENCY DRIVERS
+M:     Rafael J. Wysocki <rjw@sisk.pl>
 L:     cpufreq@vger.kernel.org
+L:     linux-pm@vger.kernel.org
 S:     Maintained
 F:     drivers/cpufreq/
 F:     include/linux/cpufreq.h
index 9e384ae..48bd1f5 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 VERSION = 3
 PATCHLEVEL = 4
 SUBLEVEL = 0
-EXTRAVERSION = -rc6
+EXTRAVERSION = -rc7
 NAME = Saber-toothed Squirrel
 
 # *DOCUMENTATION*
index e81c35f..b8df521 100644 (file)
@@ -232,6 +232,9 @@ config MACH_ARMLEX4210
 config MACH_UNIVERSAL_C210
        bool "Mobile UNIVERSAL_C210 Board"
        select CPU_EXYNOS4210
+       select S5P_HRT
+       select CLKSRC_MMIO
+       select HAVE_SCHED_CLOCK
        select S5P_GPIO_INT
        select S5P_DEV_FIMC0
        select S5P_DEV_FIMC1
index 5cd7a8b..7ac6ff4 100644 (file)
@@ -678,7 +678,7 @@ static struct clk exynos5_clk_pdma1 = {
        .name           = "dma",
        .devname        = "dma-pl330.1",
        .enable         = exynos5_clk_ip_fsys_ctrl,
-       .ctrlbit        = (1 << 1),
+       .ctrlbit        = (1 << 2),
 };
 
 static struct clk exynos5_clk_mdma1 = {
index cb2b027..a34036e 100644 (file)
@@ -40,6 +40,7 @@
 #include <plat/pd.h>
 #include <plat/regs-fb-v4.h>
 #include <plat/fimc-core.h>
+#include <plat/s5p-time.h>
 #include <plat/camport.h>
 #include <plat/mipi_csis.h>
 
@@ -1063,6 +1064,7 @@ static void __init universal_map_io(void)
        exynos_init_io(NULL, 0);
        s3c24xx_init_clocks(24000000);
        s3c24xx_init_uarts(universal_uartcfgs, ARRAY_SIZE(universal_uartcfgs));
+       s5p_set_timer_source(S5P_PWM2, S5P_PWM4);
 }
 
 static void s5p_tv_setup(void)
@@ -1113,7 +1115,7 @@ MACHINE_START(UNIVERSAL_C210, "UNIVERSAL_C210")
        .map_io         = universal_map_io,
        .handle_irq     = gic_handle_irq,
        .init_machine   = universal_machine_init,
-       .timer          = &exynos4_timer,
+       .timer          = &s5p_timer,
        .reserve        = &universal_reserve,
        .restart        = exynos4_restart,
 MACHINE_END
index 37c2de9..a7b9415 100644 (file)
@@ -42,7 +42,8 @@ sirfsoc_alloc_gc(void __iomem *base, unsigned int irq_start, unsigned int num)
 static __init void sirfsoc_irq_init(void)
 {
        sirfsoc_alloc_gc(sirfsoc_intc_base, 0, 32);
-       sirfsoc_alloc_gc(sirfsoc_intc_base + 4, 32, SIRFSOC_INTENAL_IRQ_END - 32);
+       sirfsoc_alloc_gc(sirfsoc_intc_base + 4, 32,
+                       SIRFSOC_INTENAL_IRQ_END + 1 - 32);
 
        writel_relaxed(0, sirfsoc_intc_base + SIRFSOC_INT_RISC_LEVEL0);
        writel_relaxed(0, sirfsoc_intc_base + SIRFSOC_INT_RISC_LEVEL1);
@@ -68,7 +69,8 @@ void __init sirfsoc_of_irq_init(void)
        if (!sirfsoc_intc_base)
                panic("unable to map intc cpu registers\n");
 
-       irq_domain_add_legacy(np, 32, 0, 0, &irq_domain_simple_ops, NULL);
+       irq_domain_add_legacy(np, SIRFSOC_INTENAL_IRQ_END + 1, 0, 0,
+               &irq_domain_simple_ops, NULL);
 
        of_node_put(np);
 
index cb224a3..0891ec6 100644 (file)
@@ -365,23 +365,13 @@ static struct platform_device mipidsi0_device = {
 };
 
 /* SDHI0 */
-static irqreturn_t ag5evm_sdhi0_gpio_cd(int irq, void *arg)
-{
-       struct device *dev = arg;
-       struct sh_mobile_sdhi_info *info = dev->platform_data;
-       struct tmio_mmc_data *pdata = info->pdata;
-
-       tmio_mmc_cd_wakeup(pdata);
-
-       return IRQ_HANDLED;
-}
-
 static struct sh_mobile_sdhi_info sdhi0_info = {
        .dma_slave_tx   = SHDMA_SLAVE_SDHI0_TX,
        .dma_slave_rx   = SHDMA_SLAVE_SDHI0_RX,
-       .tmio_flags     = TMIO_MMC_HAS_IDLE_WAIT,
+       .tmio_flags     = TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_USE_GPIO_CD,
        .tmio_caps      = MMC_CAP_SD_HIGHSPEED,
        .tmio_ocr_mask  = MMC_VDD_27_28 | MMC_VDD_28_29,
+       .cd_gpio        = GPIO_PORT251,
 };
 
 static struct resource sdhi0_resources[] = {
@@ -557,7 +547,6 @@ static void __init ag5evm_init(void)
        lcd_backlight_reset();
 
        /* enable SDHI0 on CN15 [SD I/F] */
-       gpio_request(GPIO_FN_SDHICD0, NULL);
        gpio_request(GPIO_FN_SDHIWP0, NULL);
        gpio_request(GPIO_FN_SDHICMD0, NULL);
        gpio_request(GPIO_FN_SDHICLK0, NULL);
@@ -566,13 +555,6 @@ static void __init ag5evm_init(void)
        gpio_request(GPIO_FN_SDHID0_1, NULL);
        gpio_request(GPIO_FN_SDHID0_0, NULL);
 
-       if (!request_irq(intcs_evt2irq(0x3c0), ag5evm_sdhi0_gpio_cd,
-                        IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
-                        "sdhi0 cd", &sdhi0_device.dev))
-               sdhi0_info.tmio_flags |= TMIO_MMC_HAS_COLD_CD;
-       else
-               pr_warn("Unable to setup SDHI0 GPIO IRQ\n");
-
        /* enable SDHI1 on CN4 [WLAN I/F] */
        gpio_request(GPIO_FN_SDHICLK1, NULL);
        gpio_request(GPIO_FN_SDHICMD1_PU, NULL);
index f49e28a..8c6202b 100644 (file)
@@ -1011,21 +1011,12 @@ static int slot_cn7_get_cd(struct platform_device *pdev)
 }
 
 /* SDHI0 */
-static irqreturn_t mackerel_sdhi0_gpio_cd(int irq, void *arg)
-{
-       struct device *dev = arg;
-       struct sh_mobile_sdhi_info *info = dev->platform_data;
-       struct tmio_mmc_data *pdata = info->pdata;
-
-       tmio_mmc_cd_wakeup(pdata);
-
-       return IRQ_HANDLED;
-}
-
 static struct sh_mobile_sdhi_info sdhi0_info = {
        .dma_slave_tx   = SHDMA_SLAVE_SDHI0_TX,
        .dma_slave_rx   = SHDMA_SLAVE_SDHI0_RX,
+       .tmio_flags     = TMIO_MMC_USE_GPIO_CD,
        .tmio_caps      = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ,
+       .cd_gpio        = GPIO_PORT172,
 };
 
 static struct resource sdhi0_resources[] = {
@@ -1384,7 +1375,6 @@ static void __init mackerel_init(void)
 {
        u32 srcr4;
        struct clk *clk;
-       int ret;
 
        /* External clock source */
        clk_set_rate(&sh7372_dv_clki_clk, 27000000);
@@ -1481,7 +1471,6 @@ static void __init mackerel_init(void)
        irq_set_irq_type(IRQ21, IRQ_TYPE_LEVEL_HIGH);
 
        /* enable SDHI0 */
-       gpio_request(GPIO_FN_SDHICD0, NULL);
        gpio_request(GPIO_FN_SDHIWP0, NULL);
        gpio_request(GPIO_FN_SDHICMD0, NULL);
        gpio_request(GPIO_FN_SDHICLK0, NULL);
@@ -1490,13 +1479,6 @@ static void __init mackerel_init(void)
        gpio_request(GPIO_FN_SDHID0_1, NULL);
        gpio_request(GPIO_FN_SDHID0_0, NULL);
 
-       ret = request_irq(evt2irq(0x3340), mackerel_sdhi0_gpio_cd,
-                         IRQF_TRIGGER_FALLING, "sdhi0 cd", &sdhi0_device.dev);
-       if (!ret)
-               sdhi0_info.tmio_flags |= TMIO_MMC_HAS_COLD_CD;
-       else
-               pr_err("Cannot get IRQ #%d: %d\n", evt2irq(0x3340), ret);
-
 #if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE)
        /* enable SDHI1 */
        gpio_request(GPIO_FN_SDHICMD1, NULL);
index 6ac015c..b202c12 100644 (file)
 
        __CPUINIT
 
+/* Cache invalidation nicked from arch/arm/mach-imx/head-v7.S, thanks!
+ *
+ * The secondary kernel init calls v7_flush_dcache_all before it enables
+ * the L1; however, the L1 comes out of reset in an undefined state, so
+ * the clean + invalidate performed by v7_flush_dcache_all causes a bunch
+ * of cache lines with uninitialized data and uninitialized tags to get
+ * written out to memory, which does really unpleasant things to the main
+ * processor.  We fix this by performing an invalidate, rather than a
+ * clean + invalidate, before jumping into the kernel.
+ *
+ * This funciton is cloned from arch/arm/mach-tegra/headsmp.S, and needs
+ * to be called for both secondary cores startup and primary core resume
+ * procedures.  Ideally, it should be moved into arch/arm/mm/cache-v7.S.
+ */
+ENTRY(v7_invalidate_l1)
+       mov     r0, #0
+       mcr     p15, 0, r0, c7, c5, 0   @ invalidate I cache
+       mcr     p15, 2, r0, c0, c0, 0
+       mrc     p15, 1, r0, c0, c0, 0
+
+       ldr     r1, =0x7fff
+       and     r2, r1, r0, lsr #13
+
+       ldr     r1, =0x3ff
+
+       and     r3, r1, r0, lsr #3      @ NumWays - 1
+       add     r2, r2, #1              @ NumSets
+
+       and     r0, r0, #0x7
+       add     r0, r0, #4      @ SetShift
+
+       clz     r1, r3          @ WayShift
+       add     r4, r3, #1      @ NumWays
+1:     sub     r2, r2, #1      @ NumSets--
+       mov     r3, r4          @ Temp = NumWays
+2:     subs    r3, r3, #1      @ Temp--
+       mov     r5, r3, lsl r1
+       mov     r6, r2, lsl r0
+       orr     r5, r5, r6      @ Reg = (Temp<<WayShift)|(NumSets<<SetShift)
+       mcr     p15, 0, r5, c7, c6, 2
+       bgt     2b
+       cmp     r2, #0
+       bgt     1b
+       dsb
+       isb
+       mov     pc, lr
+ENDPROC(v7_invalidate_l1)
+
+ENTRY(shmobile_invalidate_start)
+       bl      v7_invalidate_l1
+       b       secondary_startup
+ENDPROC(shmobile_invalidate_start)
+
 /*
  * Reset vector for secondary CPUs.
  * This will be mapped at address 0 by SBAR register.
@@ -24,4 +77,5 @@
        .align  12
 ENTRY(shmobile_secondary_vector)
        ldr     pc, 1f
-1:     .long   secondary_startup - PAGE_OFFSET + PLAT_PHYS_OFFSET
+1:     .long   shmobile_invalidate_start - PAGE_OFFSET + PLAT_PHYS_OFFSET
+ENDPROC(shmobile_secondary_vector)
index 83ad3fe..c85e6ec 100644 (file)
@@ -4,7 +4,6 @@
 extern void shmobile_earlytimer_init(void);
 extern struct sys_timer shmobile_timer;
 struct twd_local_timer;
-void shmobile_twd_init(struct twd_local_timer *twd_local_timer);
 extern void shmobile_setup_console(void);
 extern void shmobile_secondary_vector(void);
 extern int shmobile_platform_cpu_kill(unsigned int cpu);
@@ -82,5 +81,6 @@ extern int r8a7779_platform_cpu_kill(unsigned int cpu);
 extern void r8a7779_secondary_init(unsigned int cpu);
 extern int r8a7779_boot_secondary(unsigned int cpu);
 extern void r8a7779_smp_prepare_cpus(void);
+extern void r8a7779_register_twd(void);
 
 #endif /* __ARCH_MACH_COMMON_H */
index 12c6f52..e98e46f 100644 (file)
@@ -262,10 +262,14 @@ void __init r8a7779_add_standard_devices(void)
                            ARRAY_SIZE(r8a7779_late_devices));
 }
 
+/* do nothing for !CONFIG_SMP or !CONFIG_HAVE_TWD */
+void __init __weak r8a7779_register_twd(void) { }
+
 static void __init r8a7779_earlytimer_init(void)
 {
        r8a7779_clock_init();
        shmobile_earlytimer_init();
+       r8a7779_register_twd();
 }
 
 void __init r8a7779_add_early_devices(void)
index 5bebffc..04a0dfe 100644 (file)
@@ -688,10 +688,14 @@ void __init sh73a0_add_standard_devices(void)
                            ARRAY_SIZE(sh73a0_late_devices));
 }
 
+/* do nothing for !CONFIG_SMP or !CONFIG_HAVE_TWD */
+void __init __weak sh73a0_register_twd(void) { }
+
 static void __init sh73a0_earlytimer_init(void)
 {
        sh73a0_clock_init();
        shmobile_earlytimer_init();
+       sh73a0_register_twd();
 }
 
 void __init sh73a0_add_early_devices(void)
index b62e19d..6d1d023 100644 (file)
@@ -64,8 +64,15 @@ static void __iomem *scu_base_addr(void)
 static DEFINE_SPINLOCK(scu_lock);
 static unsigned long tmp;
 
+#ifdef CONFIG_HAVE_ARM_TWD
 static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, 0xf0000600, 29);
 
+void __init r8a7779_register_twd(void)
+{
+       twd_local_timer_register(&twd_local_timer);
+}
+#endif
+
 static void modify_scu_cpu_psr(unsigned long set, unsigned long clr)
 {
        void __iomem *scu_base = scu_base_addr();
@@ -84,7 +91,6 @@ unsigned int __init r8a7779_get_core_count(void)
 {
        void __iomem *scu_base = scu_base_addr();
 
-       shmobile_twd_init(&twd_local_timer);
        return scu_get_core_count(scu_base);
 }
 
index 14ad8b0..e36c41c 100644 (file)
@@ -42,7 +42,13 @@ static void __iomem *scu_base_addr(void)
 static DEFINE_SPINLOCK(scu_lock);
 static unsigned long tmp;
 
+#ifdef CONFIG_HAVE_ARM_TWD
 static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, 0xf0000600, 29);
+void __init sh73a0_register_twd(void)
+{
+       twd_local_timer_register(&twd_local_timer);
+}
+#endif
 
 static void modify_scu_cpu_psr(unsigned long set, unsigned long clr)
 {
@@ -62,7 +68,6 @@ unsigned int __init sh73a0_get_core_count(void)
 {
        void __iomem *scu_base = scu_base_addr();
 
-       shmobile_twd_init(&twd_local_timer);
        return scu_get_core_count(scu_base);
 }
 
index 2fba5f3..8b79e79 100644 (file)
@@ -46,15 +46,6 @@ static void __init shmobile_timer_init(void)
 {
 }
 
-void __init shmobile_twd_init(struct twd_local_timer *twd_local_timer)
-{
-#ifdef CONFIG_HAVE_ARM_TWD
-       int err = twd_local_timer_register(twd_local_timer);
-       if (err)
-               pr_err("twd_local_timer_register failed %d\n", err);
-#endif
-}
-
 struct sys_timer shmobile_timer = {
        .init           = shmobile_timer_init,
 };
index fef66a7..f07488e 100644 (file)
@@ -53,10 +53,10 @@ static void flowctrl_update(u8 offset, u32 value)
 
 void flowctrl_write_cpu_csr(unsigned int cpuid, u32 value)
 {
-       return flowctrl_update(flowctrl_offset_halt_cpu[cpuid], value);
+       return flowctrl_update(flowctrl_offset_cpu_csr[cpuid], value);
 }
 
 void flowctrl_write_cpu_halt(unsigned int cpuid, u32 value)
 {
-       return flowctrl_update(flowctrl_offset_cpu_csr[cpuid], value);
+       return flowctrl_update(flowctrl_offset_halt_cpu[cpuid], value);
 }
index f074675..5bb4835 100644 (file)
@@ -247,7 +247,9 @@ good_area:
        return handle_mm_fault(mm, vma, addr & PAGE_MASK, flags);
 
 check_stack:
-       if (vma->vm_flags & VM_GROWSDOWN && !expand_stack(vma, addr))
+       /* Don't allow expansion below FIRST_USER_ADDRESS */
+       if (vma->vm_flags & VM_GROWSDOWN &&
+           addr >= FIRST_USER_ADDRESS && !expand_stack(vma, addr))
                goto good_area;
 out:
        return fault;
index 2c7cf2f..aa78de8 100644 (file)
@@ -489,7 +489,8 @@ static void __init build_mem_type_table(void)
         */
        for (i = 0; i < ARRAY_SIZE(mem_types); i++) {
                mem_types[i].prot_pte |= PTE_EXT_AF;
-               mem_types[i].prot_sect |= PMD_SECT_AF;
+               if (mem_types[i].prot_sect)
+                       mem_types[i].prot_sect |= PMD_SECT_AF;
        }
        kern_pgprot |= PTE_EXT_AF;
        vecs_pgprot |= PTE_EXT_AF;
index bc683b8..b0197b2 100644 (file)
@@ -11,6 +11,7 @@
 #include <linux/types.h>
 #include <linux/cpu.h>
 #include <linux/cpu_pm.h>
+#include <linux/hardirq.h>
 #include <linux/kernel.h>
 #include <linux/notifier.h>
 #include <linux/signal.h>
@@ -432,7 +433,10 @@ void VFP_bounce(u32 trigger, u32 fpexc, struct pt_regs *regs)
 
 static void vfp_enable(void *unused)
 {
-       u32 access = get_copro_access();
+       u32 access;
+
+       BUG_ON(preemptible());
+       access = get_copro_access();
 
        /*
         * Enable full access to VFP (cp10 and cp11)
@@ -573,12 +577,6 @@ int vfp_preserve_user_clear_hwstate(struct user_vfp __user *ufp,
         * entry.
         */
        hwstate->fpscr &= ~(FPSCR_LENGTH_MASK | FPSCR_STRIDE_MASK);
-
-       /*
-        * Disable VFP in the hwstate so that we can detect if it gets
-        * used.
-        */
-       hwstate->fpexc &= ~FPEXC_EN;
        return 0;
 }
 
@@ -591,12 +589,8 @@ int vfp_restore_user_hwstate(struct user_vfp __user *ufp,
        unsigned long fpexc;
        int err = 0;
 
-       /*
-        * If VFP has been used, then disable it to avoid corrupting
-        * the new thread state.
-        */
-       if (hwstate->fpexc & FPEXC_EN)
-               vfp_flush_hwstate(thread);
+       /* Disable VFP to avoid corrupting the new thread state. */
+       vfp_flush_hwstate(thread);
 
        /*
         * Copy the floating point registers. There can be unused
@@ -657,7 +651,7 @@ static int __init vfp_init(void)
        unsigned int cpu_arch = cpu_architecture();
 
        if (cpu_arch >= CPU_ARCH_ARMv6)
-               vfp_enable(NULL);
+               on_each_cpu(vfp_enable, NULL, 1);
 
        /*
         * First check that there is a VFP that we can use.
@@ -678,8 +672,6 @@ static int __init vfp_init(void)
        } else {
                hotcpu_notifier(vfp_hotplug, 0);
 
-               smp_call_function(vfp_enable, NULL, 1);
-
                VFP_arch = (vfpsid & FPSID_ARCH_MASK) >> FPSID_ARCH_BIT;  /* Extract the architecture version */
                printk("implementor %02x architecture %d part %02x variant %x rev %x\n",
                        (vfpsid & FPSID_IMPLEMENTER_MASK) >> FPSID_IMPLEMENTER_BIT,
index 81c2e27..9b1a92b 100644 (file)
@@ -135,10 +135,6 @@ unsigned long get_wchan(struct task_struct *p);
 #define        KSTK_EIP(tsk)   ((tsk)->thread.frame0->pc)
 #define        KSTK_ESP(tsk)   ((tsk)->thread.frame0->sp)
 
-/* Allocation and freeing of basic task resources. */
-extern struct task_struct *alloc_task_struct_node(int node);
-extern void free_task_struct(struct task_struct *p);
-
 #define cpu_relax()    barrier()
 
 /* data cache prefetch */
index 2359478..09df4b8 100644 (file)
@@ -22,7 +22,7 @@
 
 /***************************************************************************/
 
-#ifdef CONFIG_SPI_COLDFIRE_QSPI
+#if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI)
 
 static void __init m520x_qspi_init(void)
 {
@@ -35,7 +35,7 @@ static void __init m520x_qspi_init(void)
        writew(par, MCF_GPIO_PAR_UART);
 }
 
-#endif /* CONFIG_SPI_COLDFIRE_QSPI */
+#endif /* IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) */
 
 /***************************************************************************/
 
@@ -79,7 +79,7 @@ void __init config_BSP(char *commandp, int size)
        mach_sched_init = hw_timer_init;
        m520x_uarts_init();
        m520x_fec_init();
-#ifdef CONFIG_SPI_COLDFIRE_QSPI
+#if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI)
        m520x_qspi_init();
 #endif
 }
index c8b405d..d47dfd8 100644 (file)
@@ -22,7 +22,7 @@
 
 /***************************************************************************/
 
-#ifdef CONFIG_SPI_COLDFIRE_QSPI
+#if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI)
 
 static void __init m523x_qspi_init(void)
 {
@@ -36,7 +36,7 @@ static void __init m523x_qspi_init(void)
        writew(par, MCFGPIO_PAR_TIMER);
 }
 
-#endif /* CONFIG_SPI_COLDFIRE_QSPI */
+#endif /* IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) */
 
 /***************************************************************************/
 
@@ -58,7 +58,7 @@ void __init config_BSP(char *commandp, int size)
 {
        mach_sched_init = hw_timer_init;
        m523x_fec_init();
-#ifdef CONFIG_SPI_COLDFIRE_QSPI
+#if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI)
        m523x_qspi_init();
 #endif
 }
index bbf0513..300e729 100644 (file)
@@ -51,7 +51,7 @@ static struct platform_device *m5249_devices[] __initdata = {
 
 /***************************************************************************/
 
-#ifdef CONFIG_SPI_COLDFIRE_QSPI
+#if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI)
 
 static void __init m5249_qspi_init(void)
 {
@@ -61,7 +61,7 @@ static void __init m5249_qspi_init(void)
        mcf_mapirq2imr(MCF_IRQ_QSPI, MCFINTC_QSPI);
 }
 
-#endif /* CONFIG_SPI_COLDFIRE_QSPI */
+#endif /* IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) */
 
 /***************************************************************************/
 
@@ -90,7 +90,7 @@ void __init config_BSP(char *commandp, int size)
 #ifdef CONFIG_M5249C3
        m5249_smc91x_init();
 #endif
-#ifdef CONFIG_SPI_COLDFIRE_QSPI
+#if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI)
        m5249_qspi_init();
 #endif
 }
index f91a532..b3cb378 100644 (file)
@@ -23,7 +23,7 @@
 
 /***************************************************************************/
 
-#ifdef CONFIG_SPI_COLDFIRE_QSPI
+#if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI)
 
 static void __init m527x_qspi_init(void)
 {
@@ -42,7 +42,7 @@ static void __init m527x_qspi_init(void)
 #endif
 }
 
-#endif /* CONFIG_SPI_COLDFIRE_QSPI */
+#endif /* IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) */
 
 /***************************************************************************/
 
@@ -90,7 +90,7 @@ void __init config_BSP(char *commandp, int size)
        mach_sched_init = hw_timer_init;
        m527x_uarts_init();
        m527x_fec_init();
-#ifdef CONFIG_SPI_COLDFIRE_QSPI
+#if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI)
        m527x_qspi_init();
 #endif
 }
index d449292..c5f11ba 100644 (file)
@@ -24,7 +24,7 @@
 
 /***************************************************************************/
 
-#ifdef CONFIG_SPI_COLDFIRE_QSPI
+#if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI)
 
 static void __init m528x_qspi_init(void)
 {
@@ -32,7 +32,7 @@ static void __init m528x_qspi_init(void)
        __raw_writeb(0x07, MCFGPIO_PQSPAR);
 }
 
-#endif /* CONFIG_SPI_COLDFIRE_QSPI */
+#endif /* IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) */
 
 /***************************************************************************/
 
@@ -98,7 +98,7 @@ void __init config_BSP(char *commandp, int size)
        mach_sched_init = hw_timer_init;
        m528x_uarts_init();
        m528x_fec_init();
-#ifdef CONFIG_SPI_COLDFIRE_QSPI
+#if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI)
        m528x_qspi_init();
 #endif
 }
index 2bec347..37082d0 100644 (file)
@@ -30,7 +30,7 @@
 
 /***************************************************************************/
 
-#ifdef CONFIG_SPI_COLDFIRE_QSPI
+#if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI)
 
 static void __init m532x_qspi_init(void)
 {
@@ -38,7 +38,7 @@ static void __init m532x_qspi_init(void)
        writew(0x01f0, MCF_GPIO_PAR_QSPI);
 }
 
-#endif /* CONFIG_SPI_COLDFIRE_QSPI */
+#endif /* IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) */
 
 /***************************************************************************/
 
@@ -77,7 +77,7 @@ void __init config_BSP(char *commandp, int size)
        mach_sched_init = hw_timer_init;
        m532x_uarts_init();
        m532x_fec_init();
-#ifdef CONFIG_SPI_COLDFIRE_QSPI
+#if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI)
        m532x_qspi_init();
 #endif
 
index 7af9736..3aa77dd 100644 (file)
@@ -121,7 +121,7 @@ static struct platform_device mcf_fec1 = {
 #endif /* MCFFEC_BASE1 */
 #endif /* CONFIG_FEC */
 
-#ifdef CONFIG_SPI_COLDFIRE_QSPI
+#if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI)
 /*
  *     The ColdFire QSPI module is an SPI protocol hardware block used
  *     on a number of different ColdFire CPUs.
@@ -274,7 +274,7 @@ static struct platform_device mcf_qspi = {
        .resource               = mcf_qspi_resources,
        .dev.platform_data      = &mcf_qspi_data,
 };
-#endif /* CONFIG_SPI_COLDFIRE_QSPI */
+#endif /* IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) */
 
 static struct platform_device *mcf_devices[] __initdata = {
        &mcf_uart,
@@ -284,7 +284,7 @@ static struct platform_device *mcf_devices[] __initdata = {
        &mcf_fec1,
 #endif
 #endif
-#ifdef CONFIG_SPI_COLDFIRE_QSPI
+#if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI)
        &mcf_qspi,
 #endif
 };
index 910dddf..9cd69ad 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/sched.h>
 #include <linux/profile.h>
 #include <linux/smp.h>
+#include <linux/cpu.h>
 #include <asm/tlbflush.h>
 #include <asm/bitops.h>
 #include <asm/processor.h>
@@ -38,7 +39,6 @@
 #include "internal.h"
 
 #ifdef CONFIG_HOTPLUG_CPU
-#include <linux/cpu.h>
 #include <asm/cacheflush.h>
 
 static unsigned long sleep_mode[NR_CPUS];
@@ -874,10 +874,13 @@ static void __init smp_online(void)
 
        cpu = smp_processor_id();
 
-       local_irq_enable();
+       notify_cpu_starting(cpu);
 
+       ipi_call_lock();
        set_cpu_online(cpu, true);
-       smp_wmb();
+       ipi_call_unlock();
+
+       local_irq_enable();
 }
 
 /**
index 0bb1d63..4dc7b79 100644 (file)
@@ -31,6 +31,7 @@
 #include <linux/delay.h>
 #include <linux/bitops.h>
 #include <linux/ftrace.h>
+#include <linux/cpu.h>
 
 #include <linux/atomic.h>
 #include <asm/current.h>
@@ -295,8 +296,13 @@ smp_cpu_init(int cpunum)
 
                printk(KERN_CRIT "CPU#%d already initialized!\n", cpunum);
                machine_halt();
-       }  
+       }
+
+       notify_cpu_starting(cpunum);
+
+       ipi_call_lock();
        set_cpu_online(cpunum, true);
+       ipi_call_unlock();
 
        /* Initialise the idle task for this CPU */
        atomic_inc(&init_mm.mm_count);
index aa795cc..fd07f43 100644 (file)
@@ -81,12 +81,13 @@ struct kvmppc_vcpu_book3s {
        u64 sdr1;
        u64 hior;
        u64 msr_mask;
-       u64 vsid_next;
 #ifdef CONFIG_PPC_BOOK3S_32
        u32 vsid_pool[VSID_POOL_SIZE];
+       u32 vsid_next;
 #else
-       u64 vsid_first;
-       u64 vsid_max;
+       u64 proto_vsid_first;
+       u64 proto_vsid_max;
+       u64 proto_vsid_next;
 #endif
        int context_id[SID_CONTEXTS];
 
index fc60150..ef2074c 100644 (file)
@@ -588,23 +588,19 @@ _GLOBAL(ret_from_except_lite)
 fast_exc_return_irq:
 restore:
        /*
-        * This is the main kernel exit path, we first check if we
-        * have to change our interrupt state.
+        * This is the main kernel exit path. First we check if we
+        * are about to re-enable interrupts
         */
        ld      r5,SOFTE(r1)
        lbz     r6,PACASOFTIRQEN(r13)
-       cmpwi   cr1,r5,0
-       cmpw    cr0,r5,r6
-       beq     cr0,4f
+       cmpwi   cr0,r5,0
+       beq     restore_irq_off
 
-       /* We do, handle disable first, which is easy */
-       bne     cr1,3f;
-       li      r0,0
-       stb     r0,PACASOFTIRQEN(r13);
-       TRACE_DISABLE_INTS
-       b       4f
+       /* We are enabling, were we already enabled ? Yes, just return */
+       cmpwi   cr0,r6,1
+       beq     cr0,do_restore
 
-3:     /*
+       /*
         * We are about to soft-enable interrupts (we are hard disabled
         * at this point). We check if there's anything that needs to
         * be replayed first.
@@ -626,7 +622,7 @@ restore_no_replay:
        /*
         * Final return path. BookE is handled in a different file
         */
-4:
+do_restore:
 #ifdef CONFIG_PPC_BOOK3E
        b       .exception_return_book3e
 #else
@@ -700,6 +696,25 @@ fast_exception_return:
 #endif /* CONFIG_PPC_BOOK3E */
 
        /*
+        * We are returning to a context with interrupts soft disabled.
+        *
+        * However, we may also about to hard enable, so we need to
+        * make sure that in this case, we also clear PACA_IRQ_HARD_DIS
+        * or that bit can get out of sync and bad things will happen
+        */
+restore_irq_off:
+       ld      r3,_MSR(r1)
+       lbz     r7,PACAIRQHAPPENED(r13)
+       andi.   r0,r3,MSR_EE
+       beq     1f
+       rlwinm  r7,r7,0,~PACA_IRQ_HARD_DIS
+       stb     r7,PACAIRQHAPPENED(r13)
+1:     li      r0,0
+       stb     r0,PACASOFTIRQEN(r13);
+       TRACE_DISABLE_INTS
+       b       do_restore
+
+       /*
         * Something did happen, check if a re-emit is needed
         * (this also clears paca->irq_happened)
         */
@@ -748,6 +763,9 @@ restore_check_irq_replay:
 #endif /* CONFIG_PPC_BOOK3E */
 1:     b       .ret_from_except /* What else to do here ? */
  
+
+
+3:
 do_work:
 #ifdef CONFIG_PREEMPT
        andi.   r0,r3,MSR_PR    /* Returning to user mode? */
index c6c6f3b..641da9e 100644 (file)
@@ -229,6 +229,19 @@ notrace void arch_local_irq_restore(unsigned long en)
         */
        if (unlikely(irq_happened != PACA_IRQ_HARD_DIS))
                __hard_irq_disable();
+#ifdef CONFIG_TRACE_IRQFLAG
+       else {
+               /*
+                * We should already be hard disabled here. We had bugs
+                * where that wasn't the case so let's dbl check it and
+                * warn if we are wrong. Only do that when IRQ tracing
+                * is enabled as mfmsr() can be costly.
+                */
+               if (WARN_ON(mfmsr() & MSR_EE))
+                       __hard_irq_disable();
+       }
+#endif /* CONFIG_TRACE_IRQFLAG */
+
        set_soft_enabled(0);
 
        /*
index 6f87f39..10fc8ec 100644 (file)
@@ -194,14 +194,14 @@ static struct kvmppc_sid_map *create_sid_map(struct kvm_vcpu *vcpu, u64 gvsid)
        backwards_map = !backwards_map;
 
        /* Uh-oh ... out of mappings. Let's flush! */
-       if (vcpu_book3s->vsid_next == vcpu_book3s->vsid_max) {
-               vcpu_book3s->vsid_next = vcpu_book3s->vsid_first;
+       if (vcpu_book3s->proto_vsid_next == vcpu_book3s->proto_vsid_max) {
+               vcpu_book3s->proto_vsid_next = vcpu_book3s->proto_vsid_first;
                memset(vcpu_book3s->sid_map, 0,
                       sizeof(struct kvmppc_sid_map) * SID_MAP_NUM);
                kvmppc_mmu_pte_flush(vcpu, 0, 0);
                kvmppc_mmu_flush_segments(vcpu);
        }
-       map->host_vsid = vcpu_book3s->vsid_next++;
+       map->host_vsid = vsid_scramble(vcpu_book3s->proto_vsid_next++, 256M);
 
        map->guest_vsid = gvsid;
        map->valid = true;
@@ -319,9 +319,10 @@ int kvmppc_mmu_init(struct kvm_vcpu *vcpu)
                return -1;
        vcpu3s->context_id[0] = err;
 
-       vcpu3s->vsid_max = ((vcpu3s->context_id[0] + 1) << USER_ESID_BITS) - 1;
-       vcpu3s->vsid_first = vcpu3s->context_id[0] << USER_ESID_BITS;
-       vcpu3s->vsid_next = vcpu3s->vsid_first;
+       vcpu3s->proto_vsid_max = ((vcpu3s->context_id[0] + 1)
+                                 << USER_ESID_BITS) - 1;
+       vcpu3s->proto_vsid_first = vcpu3s->context_id[0] << USER_ESID_BITS;
+       vcpu3s->proto_vsid_next = vcpu3s->proto_vsid_first;
 
        kvmppc_mmu_hpte_init(vcpu);
 
index def880a..cec4dad 100644 (file)
@@ -463,6 +463,7 @@ long kvmppc_h_bulk_remove(struct kvm_vcpu *vcpu)
                                /* insert R and C bits from PTE */
                                rcbits = rev->guest_rpte & (HPTE_R_R|HPTE_R_C);
                                args[j] |= rcbits << (56 - 5);
+                               hp[0] = 0;
                                continue;
                        }
 
index 0676ae2..6e6e9ce 100644 (file)
@@ -197,7 +197,8 @@ kvmppc_interrupt:
        /* Save guest PC and MSR */
 #ifdef CONFIG_PPC64
 BEGIN_FTR_SECTION
-       andi.   r0,r12,0x2
+       andi.   r0, r12, 0x2
+       cmpwi   cr1, r0, 0
        beq     1f
        mfspr   r3,SPRN_HSRR0
        mfspr   r4,SPRN_HSRR1
@@ -250,6 +251,12 @@ END_FTR_SECTION_IFSET(CPU_FTR_HVMODE)
        beq     ld_last_prev_inst
        cmpwi   r12, BOOK3S_INTERRUPT_ALIGNMENT
        beq-    ld_last_inst
+#ifdef CONFIG_PPC64
+BEGIN_FTR_SECTION
+       cmpwi   r12, BOOK3S_INTERRUPT_H_EMUL_ASSIST
+       beq-    ld_last_inst
+END_FTR_SECTION_IFSET(CPU_FTR_HVMODE)
+#endif
 
        b       no_ld_last_inst
 
@@ -316,23 +323,17 @@ no_dcbz32_off:
         * Having set up SRR0/1 with the address where we want
         * to continue with relocation on (potentially in module
         * space), we either just go straight there with rfi[d],
-        * or we jump to an interrupt handler with bctr if there
-        * is an interrupt to be handled first.  In the latter
-        * case, the rfi[d] at the end of the interrupt handler
-        * will get us back to where we want to continue.
+        * or we jump to an interrupt handler if there is an
+        * interrupt to be handled first.  In the latter case,
+        * the rfi[d] at the end of the interrupt handler will
+        * get us back to where we want to continue.
         */
 
-       cmpwi   r12, BOOK3S_INTERRUPT_EXTERNAL
-       beq     1f
-       cmpwi   r12, BOOK3S_INTERRUPT_DECREMENTER
-       beq     1f
-       cmpwi   r12, BOOK3S_INTERRUPT_PERFMON
-1:     mtctr   r12
-
        /* Register usage at this point:
         *
         * R1       = host R1
         * R2       = host R2
+        * R10      = raw exit handler id
         * R12      = exit handler id
         * R13      = shadow vcpu (32-bit) or PACA (64-bit)
         * SVCPU.*  = guest *
@@ -342,12 +343,25 @@ no_dcbz32_off:
        PPC_LL  r6, HSTATE_HOST_MSR(r13)
        PPC_LL  r8, HSTATE_VMHANDLER(r13)
 
-       /* Restore host msr -> SRR1 */
+#ifdef CONFIG_PPC64
+BEGIN_FTR_SECTION
+       beq     cr1, 1f
+       mtspr   SPRN_HSRR1, r6
+       mtspr   SPRN_HSRR0, r8
+END_FTR_SECTION_IFSET(CPU_FTR_HVMODE)
+#endif
+1:     /* Restore host msr -> SRR1 */
        mtsrr1  r6
        /* Load highmem handler address */
        mtsrr0  r8
 
        /* RFI into the highmem handler, or jump to interrupt handler */
-       beqctr
+       cmpwi   r12, BOOK3S_INTERRUPT_EXTERNAL
+       beqa    BOOK3S_INTERRUPT_EXTERNAL
+       cmpwi   r12, BOOK3S_INTERRUPT_DECREMENTER
+       beqa    BOOK3S_INTERRUPT_DECREMENTER
+       cmpwi   r12, BOOK3S_INTERRUPT_PERFMON
+       beqa    BOOK3S_INTERRUPT_PERFMON
+
        RFI
 kvmppc_handler_trampoline_exit_end:
index 96033e2..74239dd 100644 (file)
@@ -11,6 +11,7 @@ config TILE
        select GENERIC_IRQ_PROBE
        select GENERIC_PENDING_IRQ if SMP
        select GENERIC_IRQ_SHOW
+       select HAVE_SYSCALL_WRAPPERS if TILEGX
        select SYS_HYPERVISOR
        select ARCH_HAVE_NMI_SAFE_CMPXCHG
 
index bc4f562..7594764 100644 (file)
@@ -100,9 +100,14 @@ extern void cpu_idle_on_new_stack(struct thread_info *old_ti,
 
 #else /* __ASSEMBLY__ */
 
-/* how to get the thread information struct from ASM */
+/*
+ * How to get the thread information struct from assembly.
+ * Note that we use different macros since different architectures
+ * have different semantics in their "mm" instruction and we would
+ * like to guarantee that the macro expands to exactly one instruction.
+ */
 #ifdef __tilegx__
-#define GET_THREAD_INFO(reg) move reg, sp; mm reg, zero, LOG2_THREAD_SIZE, 63
+#define EXTRACT_THREAD_INFO(reg) mm reg, zero, LOG2_THREAD_SIZE, 63
 #else
 #define GET_THREAD_INFO(reg) mm reg, sp, zero, LOG2_THREAD_SIZE, 31
 #endif
index 77763cc..cdef6e5 100644 (file)
@@ -403,19 +403,17 @@ int compat_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
         * Set up registers for signal handler.
         * Registers that we don't modify keep the value they had from
         * user-space at the time we took the signal.
+        * We always pass siginfo and mcontext, regardless of SA_SIGINFO,
+        * since some things rely on this (e.g. glibc's debug/segfault.c).
         */
        regs->pc = ptr_to_compat_reg(ka->sa.sa_handler);
        regs->ex1 = PL_ICS_EX1(USER_PL, 1); /* set crit sec in handler */
        regs->sp = ptr_to_compat_reg(frame);
        regs->lr = restorer;
        regs->regs[0] = (unsigned long) usig;
-
-       if (ka->sa.sa_flags & SA_SIGINFO) {
-               /* Need extra arguments, so mark to restore caller-saves. */
-               regs->regs[1] = ptr_to_compat_reg(&frame->info);
-               regs->regs[2] = ptr_to_compat_reg(&frame->uc);
-               regs->flags |= PT_FLAGS_CALLER_SAVES;
-       }
+       regs->regs[1] = ptr_to_compat_reg(&frame->info);
+       regs->regs[2] = ptr_to_compat_reg(&frame->uc);
+       regs->flags |= PT_FLAGS_CALLER_SAVES;
 
        /*
         * Notify any tracer that was single-stepping it.
index 5d56a1e..6943515 100644 (file)
@@ -839,6 +839,18 @@ STD_ENTRY(interrupt_return)
        FEEDBACK_REENTER(interrupt_return)
 
        /*
+        * Use r33 to hold whether we have already loaded the callee-saves
+        * into ptregs.  We don't want to do it twice in this loop, since
+        * then we'd clobber whatever changes are made by ptrace, etc.
+        * Get base of stack in r32.
+        */
+       {
+        GET_THREAD_INFO(r32)
+        movei  r33, 0
+       }
+
+.Lretry_work_pending:
+       /*
         * Disable interrupts so as to make sure we don't
         * miss an interrupt that sets any of the thread flags (like
         * need_resched or sigpending) between sampling and the iret.
@@ -848,9 +860,6 @@ STD_ENTRY(interrupt_return)
        IRQ_DISABLE(r20, r21)
        TRACE_IRQS_OFF  /* Note: clobbers registers r0-r29 */
 
-       /* Get base of stack in r32; note r30/31 are used as arguments here. */
-       GET_THREAD_INFO(r32)
-
 
        /* Check to see if there is any work to do before returning to user. */
        {
@@ -866,16 +875,18 @@ STD_ENTRY(interrupt_return)
 
        /*
         * Make sure we have all the registers saved for signal
-        * handling or single-step.  Call out to C code to figure out
-        * exactly what we need to do for each flag bit, then if
-        * necessary, reload the flags and recheck.
+        * handling, notify-resume, or single-step.  Call out to C
+        * code to figure out exactly what we need to do for each flag bit,
+        * then if necessary, reload the flags and recheck.
         */
-       push_extra_callee_saves r0
        {
         PTREGS_PTR(r0, PTREGS_OFFSET_BASE)
-        jal    do_work_pending
+        bnz    r33, 1f
        }
-       bnz     r0, .Lresume_userspace
+       push_extra_callee_saves r0
+       movei   r33, 1
+1:     jal     do_work_pending
+       bnz     r0, .Lretry_work_pending
 
        /*
         * In the NMI case we
@@ -1180,10 +1191,12 @@ handle_syscall:
        add     r20, r20, tp
        lw      r21, r20
        addi    r21, r21, 1
-       sw      r20, r21
+       {
+        sw     r20, r21
+        GET_THREAD_INFO(r31)
+       }
 
        /* Trace syscalls, if requested. */
-       GET_THREAD_INFO(r31)
        addi    r31, r31, THREAD_INFO_FLAGS_OFFSET
        lw      r30, r31
        andi    r30, r30, _TIF_SYSCALL_TRACE
@@ -1362,7 +1375,10 @@ handle_ill:
 3:
        /* set PC and continue */
        lw      r26, r24
-       sw      r28, r26
+       {
+        sw     r28, r26
+        GET_THREAD_INFO(r0)
+       }
 
        /*
         * Clear TIF_SINGLESTEP to prevent recursion if we execute an ill.
@@ -1370,7 +1386,6 @@ handle_ill:
         * need to clear it here and can't really impose on all other arches.
         * So what's another write between friends?
         */
-       GET_THREAD_INFO(r0)
 
        addi    r1, r0, THREAD_INFO_FLAGS_OFFSET
        {
index 49d9d66..30ae76e 100644 (file)
@@ -647,6 +647,20 @@ STD_ENTRY(interrupt_return)
        FEEDBACK_REENTER(interrupt_return)
 
        /*
+        * Use r33 to hold whether we have already loaded the callee-saves
+        * into ptregs.  We don't want to do it twice in this loop, since
+        * then we'd clobber whatever changes are made by ptrace, etc.
+        */
+       {
+        movei  r33, 0
+        move   r32, sp
+       }
+
+       /* Get base of stack in r32. */
+       EXTRACT_THREAD_INFO(r32)
+
+.Lretry_work_pending:
+       /*
         * Disable interrupts so as to make sure we don't
         * miss an interrupt that sets any of the thread flags (like
         * need_resched or sigpending) between sampling and the iret.
@@ -656,9 +670,6 @@ STD_ENTRY(interrupt_return)
        IRQ_DISABLE(r20, r21)
        TRACE_IRQS_OFF  /* Note: clobbers registers r0-r29 */
 
-       /* Get base of stack in r32; note r30/31 are used as arguments here. */
-       GET_THREAD_INFO(r32)
-
 
        /* Check to see if there is any work to do before returning to user. */
        {
@@ -674,16 +685,18 @@ STD_ENTRY(interrupt_return)
 
        /*
         * Make sure we have all the registers saved for signal
-        * handling or single-step.  Call out to C code to figure out
+        * handling or notify-resume.  Call out to C code to figure out
         * exactly what we need to do for each flag bit, then if
         * necessary, reload the flags and recheck.
         */
-       push_extra_callee_saves r0
        {
         PTREGS_PTR(r0, PTREGS_OFFSET_BASE)
-        jal    do_work_pending
+        bnez   r33, 1f
        }
-       bnez    r0, .Lresume_userspace
+       push_extra_callee_saves r0
+       movei   r33, 1
+1:     jal     do_work_pending
+       bnez    r0, .Lretry_work_pending
 
        /*
         * In the NMI case we
@@ -968,11 +981,16 @@ handle_syscall:
        shl16insli r20, r20, hw0(irq_stat + IRQ_CPUSTAT_SYSCALL_COUNT_OFFSET)
        add     r20, r20, tp
        ld4s    r21, r20
-       addi    r21, r21, 1
-       st4     r20, r21
+       {
+        addi   r21, r21, 1
+        move   r31, sp
+       }
+       {
+        st4    r20, r21
+        EXTRACT_THREAD_INFO(r31)
+       }
 
        /* Trace syscalls, if requested. */
-       GET_THREAD_INFO(r31)
        addi    r31, r31, THREAD_INFO_FLAGS_OFFSET
        ld      r30, r31
        andi    r30, r30, _TIF_SYSCALL_TRACE
index 2d5ef61..54e6c64 100644 (file)
@@ -567,6 +567,10 @@ struct task_struct *__sched _switch_to(struct task_struct *prev,
  */
 int do_work_pending(struct pt_regs *regs, u32 thread_info_flags)
 {
+       /* If we enter in kernel mode, do nothing and exit the caller loop. */
+       if (!user_mode(regs))
+               return 0;
+
        if (thread_info_flags & _TIF_NEED_RESCHED) {
                schedule();
                return 1;
@@ -589,8 +593,7 @@ int do_work_pending(struct pt_regs *regs, u32 thread_info_flags)
                return 1;
        }
        if (thread_info_flags & _TIF_SINGLESTEP) {
-               if ((regs->ex1 & SPR_EX_CONTEXT_1_1__PL_MASK) == 0)
-                       single_step_once(regs);
+               single_step_once(regs);
                return 0;
        }
        panic("work_pending: bad flags %#x\n", thread_info_flags);
index 734c376..183922e 100644 (file)
@@ -170,6 +170,9 @@ static inline int kvm_para_available(void)
        unsigned int eax, ebx, ecx, edx;
        char signature[13];
 
+       if (boot_cpu_data.cpuid_level < 0)
+               return 0;       /* So we don't blow up on old processors */
+
        cpuid(KVM_CPUID_SIGNATURE, &eax, &ebx, &ecx, &edx);
        memcpy(signature + 0, &ebx, 4);
        memcpy(signature + 4, &ecx, 4);
index a415b1f..7c439fe 100644 (file)
@@ -593,7 +593,7 @@ void __init acpi_set_irq_model_ioapic(void)
 #ifdef CONFIG_ACPI_HOTPLUG_CPU
 #include <acpi/processor.h>
 
-static void __cpuinitdata acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
+static void __cpuinit acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
 {
 #ifdef CONFIG_ACPI_NUMA
        int nid;
index d086a09..11c9166 100644 (file)
@@ -945,9 +945,10 @@ struct mce_info {
        atomic_t                inuse;
        struct task_struct      *t;
        __u64                   paddr;
+       int                     restartable;
 } mce_info[MCE_INFO_MAX];
 
-static void mce_save_info(__u64 addr)
+static void mce_save_info(__u64 addr, int c)
 {
        struct mce_info *mi;
 
@@ -955,6 +956,7 @@ static void mce_save_info(__u64 addr)
                if (atomic_cmpxchg(&mi->inuse, 0, 1) == 0) {
                        mi->t = current;
                        mi->paddr = addr;
+                       mi->restartable = c;
                        return;
                }
        }
@@ -1130,7 +1132,7 @@ void do_machine_check(struct pt_regs *regs, long error_code)
                        mce_panic("Fatal machine check on current CPU", &m, msg);
                if (worst == MCE_AR_SEVERITY) {
                        /* schedule action before return to userland */
-                       mce_save_info(m.addr);
+                       mce_save_info(m.addr, m.mcgstatus & MCG_STATUS_RIPV);
                        set_thread_flag(TIF_MCE_NOTIFY);
                } else if (kill_it) {
                        force_sig(SIGBUS, current);
@@ -1179,7 +1181,13 @@ void mce_notify_process(void)
 
        pr_err("Uncorrected hardware memory error in user-access at %llx",
                 mi->paddr);
-       if (memory_failure(pfn, MCE_VECTOR, MF_ACTION_REQUIRED) < 0) {
+       /*
+        * We must call memory_failure() here even if the current process is
+        * doomed. We still need to mark the page as poisoned and alert any
+        * other users of the page.
+        */
+       if (memory_failure(pfn, MCE_VECTOR, MF_ACTION_REQUIRED) < 0 ||
+                          mi->restartable == 0) {
                pr_err("Memory error not recovered");
                force_sig(SIGBUS, current);
        }
index 3ca42d0..0327e2b 100644 (file)
@@ -147,12 +147,6 @@ static int collect_cpu_info(int cpu_num, struct cpu_signature *csig)
 
        memset(csig, 0, sizeof(*csig));
 
-       if (c->x86_vendor != X86_VENDOR_INTEL || c->x86 < 6 ||
-           cpu_has(c, X86_FEATURE_IA64)) {
-               pr_err("CPU%d not a capable Intel processor\n", cpu_num);
-               return -1;
-       }
-
        csig->sig = cpuid_eax(0x00000001);
 
        if ((c->x86_model >= 5) || (c->x86 > 6)) {
@@ -463,6 +457,14 @@ static struct microcode_ops microcode_intel_ops = {
 
 struct microcode_ops * __init init_intel_microcode(void)
 {
+       struct cpuinfo_x86 *c = &cpu_data(0);
+
+       if (c->x86_vendor != X86_VENDOR_INTEL || c->x86 < 6 ||
+           cpu_has(c, X86_FEATURE_IA64)) {
+               pr_err("Intel CPU family 0x%x not supported\n", c->x86);
+               return NULL;
+       }
+
        return &microcode_intel_ops;
 }
 
index 3263b68..3188da3 100644 (file)
@@ -250,6 +250,10 @@ static int __acpi_bus_set_power(struct acpi_device *device, int state)
                return -ENODEV;
        }
 
+       /* For D3cold we should execute _PS3, not _PS4. */
+       if (state == ACPI_STATE_D3_COLD)
+               object_name[3] = '3';
+
        /*
         * Transition Power
         * ----------------
index 330bb4d..0500f71 100644 (file)
@@ -660,7 +660,7 @@ int acpi_power_on_resources(struct acpi_device *device, int state)
 
 int acpi_power_transition(struct acpi_device *device, int state)
 {
-       int result;
+       int result = 0;
 
        if (!device || (state < ACPI_STATE_D0) || (state > ACPI_STATE_D3_COLD))
                return -EINVAL;
@@ -679,8 +679,11 @@ int acpi_power_transition(struct acpi_device *device, int state)
         * (e.g. so the device doesn't lose power while transitioning).  Then,
         * we dereference all power resources used in the current list.
         */
-       result = acpi_power_on_list(&device->power.states[state].resources);
-       if (!result)
+       if (state < ACPI_STATE_D3_COLD)
+               result = acpi_power_on_list(
+                       &device->power.states[state].resources);
+
+       if (!result && device->power.state < ACPI_STATE_D3_COLD)
                acpi_power_off_list(
                        &device->power.states[device->power.state].resources);
 
index 7417267..85cbfdc 100644 (file)
@@ -908,6 +908,10 @@ static int acpi_bus_get_power_flags(struct acpi_device *device)
        device->power.states[ACPI_STATE_D3].flags.valid = 1;
        device->power.states[ACPI_STATE_D3].power = 0;
 
+       /* Set D3cold's explicit_set flag if _PS3 exists. */
+       if (device->power.states[ACPI_STATE_D3_HOT].flags.explicit_set)
+               device->power.states[ACPI_STATE_D3_COLD].flags.explicit_set = 1;
+
        acpi_bus_init_power(device);
 
        return 0;
index abfaaca..946166e 100644 (file)
@@ -2297,7 +2297,7 @@ static void drbd_connector_callback(struct cn_msg *req, struct netlink_skb_parms
                return;
        }
 
-       if (!cap_raised(current_cap(), CAP_SYS_ADMIN)) {
+       if (!capable(CAP_SYS_ADMIN)) {
                retcode = ERR_PERM;
                goto fail;
        }
index ddf86b6..cdf2f54 100644 (file)
@@ -1895,6 +1895,13 @@ static int virtcons_restore(struct virtio_device *vdev)
 
                /* Get port open/close status on the host */
                send_control_msg(port, VIRTIO_CONSOLE_PORT_READY, 1);
+
+               /*
+                * If a port was open at the time of suspending, we
+                * have to let the host know that it's still open.
+                */
+               if (port->guest_connected)
+                       send_control_msg(port, VIRTIO_CONSOLE_PORT_OPEN, 1);
        }
        return 0;
 }
index ab9abb4..dd414d9 100644 (file)
@@ -164,6 +164,7 @@ config CRYPTO_DEV_MV_CESA
        select CRYPTO_ALGAPI
        select CRYPTO_AES
        select CRYPTO_BLKCIPHER2
+       select CRYPTO_HASH
        help
          This driver allows you to utilize the Cryptographic Engines and
          Security Accelerator (CESA) which can be found on the Marvell Orion
index 445fdf8..bf0d7e4 100644 (file)
@@ -245,7 +245,9 @@ atc_chain_complete(struct at_dma_chan *atchan, struct at_desc *desc)
        dev_vdbg(chan2dev(&atchan->chan_common),
                "descriptor %u complete\n", txd->cookie);
 
-       dma_cookie_complete(txd);
+       /* mark the descriptor as complete for non cyclic cases only */
+       if (!atc_chan_is_cyclic(atchan))
+               dma_cookie_complete(txd);
 
        /* move children to free_list */
        list_splice_init(&desc->tx_list, &atchan->free_list);
index e6f133b..f6e9b57 100644 (file)
@@ -703,7 +703,9 @@ static void ep93xx_dma_tasklet(unsigned long data)
        desc = ep93xx_dma_get_active(edmac);
        if (desc) {
                if (desc->complete) {
-                       dma_cookie_complete(&desc->txd);
+                       /* mark descriptor complete for non cyclic case only */
+                       if (!test_bit(EP93XX_DMA_IS_CYCLIC, &edmac->flags))
+                               dma_cookie_complete(&desc->txd);
                        list_splice_init(&edmac->active, &list);
                }
                callback = desc->txd.callback;
index 2ee6e23..fa3fb21 100644 (file)
@@ -2322,7 +2322,8 @@ static void pl330_tasklet(unsigned long data)
        /* Pick up ripe tomatoes */
        list_for_each_entry_safe(desc, _dt, &pch->work_list, node)
                if (desc->status == DONE) {
-                       dma_cookie_complete(&desc->txd);
+                       if (pch->cyclic)
+                               dma_cookie_complete(&desc->txd);
                        list_move_tail(&desc->node, &list);
                }
 
index 1adc2ec..4461540 100644 (file)
@@ -965,18 +965,15 @@ static void omap_gpio_mod_init(struct gpio_bank *bank)
        }
 
        _gpio_rmw(base, bank->regs->irqenable, l, bank->regs->irqenable_inv);
-       _gpio_rmw(base, bank->regs->irqstatus, l,
-                                       bank->regs->irqenable_inv == false);
-       _gpio_rmw(base, bank->regs->irqenable, l, bank->regs->debounce_en != 0);
-       _gpio_rmw(base, bank->regs->irqenable, l, bank->regs->ctrl != 0);
+       _gpio_rmw(base, bank->regs->irqstatus, l, !bank->regs->irqenable_inv);
        if (bank->regs->debounce_en)
-               _gpio_rmw(base, bank->regs->debounce_en, 0, 1);
+               __raw_writel(0, base + bank->regs->debounce_en);
 
        /* Save OE default value (0xffffffff) in the context */
        bank->context.oe = __raw_readl(bank->base + bank->regs->direction);
         /* Initialize interface clk ungated, module enabled */
        if (bank->regs->ctrl)
-               _gpio_rmw(base, bank->regs->ctrl, 0, 1);
+               __raw_writel(0, base + bank->regs->ctrl);
 }
 
 static __devinit void
index e8729cc..2cd958e 100644 (file)
@@ -230,16 +230,12 @@ static void pch_gpio_setup(struct pch_gpio *chip)
 
 static int pch_irq_type(struct irq_data *d, unsigned int type)
 {
-       u32 im;
-       u32 __iomem *im_reg;
-       u32 ien;
-       u32 im_pos;
-       int ch;
-       unsigned long flags;
-       u32 val;
-       int irq = d->irq;
        struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
        struct pch_gpio *chip = gc->private;
+       u32 im, im_pos, val;
+       u32 __iomem *im_reg;
+       unsigned long flags;
+       int ch, irq = d->irq;
 
        ch = irq - chip->irq_base;
        if (irq <= chip->irq_base + 7) {
@@ -270,30 +266,22 @@ static int pch_irq_type(struct irq_data *d, unsigned int type)
        case IRQ_TYPE_LEVEL_LOW:
                val = PCH_LEVEL_L;
                break;
-       case IRQ_TYPE_PROBE:
-               goto end;
        default:
-               dev_warn(chip->dev, "%s: unknown type(%dd)",
-                       __func__, type);
-               goto end;
+               goto unlock;
        }
 
        /* Set interrupt mode */
        im = ioread32(im_reg) & ~(PCH_IM_MASK << (im_pos * 4));
        iowrite32(im | (val << (im_pos * 4)), im_reg);
 
-       /* iclr */
-       iowrite32(BIT(ch), &chip->reg->iclr);
+       /* And the handler */
+       if (type & (IRQ_TYPE_LEVEL_LOW | IRQ_TYPE_LEVEL_HIGH))
+               __irq_set_handler_locked(d->irq, handle_level_irq);
+       else if (type & (IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING))
+               __irq_set_handler_locked(d->irq, handle_edge_irq);
 
-       /* IMASKCLR */
-       iowrite32(BIT(ch), &chip->reg->imaskclr);
-
-       /* Enable interrupt */
-       ien = ioread32(&chip->reg->ien);
-       iowrite32(ien | BIT(ch), &chip->reg->ien);
-end:
+unlock:
        spin_unlock_irqrestore(&chip->spinlock, flags);
-
        return 0;
 }
 
@@ -313,18 +301,24 @@ static void pch_irq_mask(struct irq_data *d)
        iowrite32(1 << (d->irq - chip->irq_base), &chip->reg->imask);
 }
 
+static void pch_irq_ack(struct irq_data *d)
+{
+       struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
+       struct pch_gpio *chip = gc->private;
+
+       iowrite32(1 << (d->irq - chip->irq_base), &chip->reg->iclr);
+}
+
 static irqreturn_t pch_gpio_handler(int irq, void *dev_id)
 {
        struct pch_gpio *chip = dev_id;
        u32 reg_val = ioread32(&chip->reg->istatus);
-       int i;
-       int ret = IRQ_NONE;
+       int i, ret = IRQ_NONE;
 
        for (i = 0; i < gpio_pins[chip->ioh]; i++) {
                if (reg_val & BIT(i)) {
                        dev_dbg(chip->dev, "%s:[%d]:irq=%d  status=0x%x\n",
                                __func__, i, irq, reg_val);
-                       iowrite32(BIT(i), &chip->reg->iclr);
                        generic_handle_irq(chip->irq_base + i);
                        ret = IRQ_HANDLED;
                }
@@ -343,6 +337,7 @@ static __devinit void pch_gpio_alloc_generic_chip(struct pch_gpio *chip,
        gc->private = chip;
        ct = gc->chip_types;
 
+       ct->chip.irq_ack = pch_irq_ack;
        ct->chip.irq_mask = pch_irq_mask;
        ct->chip.irq_unmask = pch_irq_unmask;
        ct->chip.irq_set_type = pch_irq_type;
@@ -357,6 +352,7 @@ static int __devinit pch_gpio_probe(struct pci_dev *pdev,
        s32 ret;
        struct pch_gpio *chip;
        int irq_base;
+       u32 msk;
 
        chip = kzalloc(sizeof(*chip), GFP_KERNEL);
        if (chip == NULL)
@@ -408,8 +404,13 @@ static int __devinit pch_gpio_probe(struct pci_dev *pdev,
        }
        chip->irq_base = irq_base;
 
+       /* Mask all interrupts, but enable them */
+       msk = (1 << gpio_pins[chip->ioh]) - 1;
+       iowrite32(msk, &chip->reg->imask);
+       iowrite32(msk, &chip->reg->ien);
+
        ret = request_irq(pdev->irq, pch_gpio_handler,
-                            IRQF_SHARED, KBUILD_MODNAME, chip);
+                         IRQF_SHARED, KBUILD_MODNAME, chip);
        if (ret != 0) {
                dev_err(&pdev->dev,
                        "%s request_irq failed\n", __func__);
@@ -418,8 +419,6 @@ static int __devinit pch_gpio_probe(struct pci_dev *pdev,
 
        pch_gpio_alloc_generic_chip(chip, irq_base, gpio_pins[chip->ioh]);
 
-       /* Initialize interrupt ien register */
-       iowrite32(0, &chip->reg->ien);
 end:
        return 0;
 
index 19d6fc0..e991d91 100644 (file)
@@ -452,12 +452,14 @@ static struct samsung_gpio_cfg s3c24xx_gpiocfg_banka = {
 };
 #endif
 
+#if defined(CONFIG_ARCH_EXYNOS4) || defined(CONFIG_ARCH_EXYNOS5)
 static struct samsung_gpio_cfg exynos_gpio_cfg = {
        .set_pull       = exynos_gpio_setpull,
        .get_pull       = exynos_gpio_getpull,
        .set_config     = samsung_gpio_setcfg_4bit,
        .get_config     = samsung_gpio_getcfg_4bit,
 };
+#endif
 
 #if defined(CONFIG_CPU_S5P6440) || defined(CONFIG_CPU_S5P6450)
 static struct samsung_gpio_cfg s5p64x0_gpio_cfg_rbank = {
@@ -2123,8 +2125,8 @@ static struct samsung_gpio_chip s5pv210_gpios_4bit[] = {
  * uses the above macro and depends on the banks being listed in order here.
  */
 
-static struct samsung_gpio_chip exynos4_gpios_1[] = {
 #ifdef CONFIG_ARCH_EXYNOS4
+static struct samsung_gpio_chip exynos4_gpios_1[] = {
        {
                .chip   = {
                        .base   = EXYNOS4_GPA0(0),
@@ -2222,11 +2224,11 @@ static struct samsung_gpio_chip exynos4_gpios_1[] = {
                        .label  = "GPF3",
                },
        },
-#endif
 };
+#endif
 
-static struct samsung_gpio_chip exynos4_gpios_2[] = {
 #ifdef CONFIG_ARCH_EXYNOS4
+static struct samsung_gpio_chip exynos4_gpios_2[] = {
        {
                .chip   = {
                        .base   = EXYNOS4_GPJ0(0),
@@ -2367,11 +2369,11 @@ static struct samsung_gpio_chip exynos4_gpios_2[] = {
                        .to_irq = samsung_gpiolib_to_irq,
                },
        },
-#endif
 };
+#endif
 
-static struct samsung_gpio_chip exynos4_gpios_3[] = {
 #ifdef CONFIG_ARCH_EXYNOS4
+static struct samsung_gpio_chip exynos4_gpios_3[] = {
        {
                .chip   = {
                        .base   = EXYNOS4_GPZ(0),
@@ -2379,8 +2381,8 @@ static struct samsung_gpio_chip exynos4_gpios_3[] = {
                        .label  = "GPZ",
                },
        },
-#endif
 };
+#endif
 
 #ifdef CONFIG_ARCH_EXYNOS5
 static struct samsung_gpio_chip exynos5_gpios_1[] = {
@@ -2719,7 +2721,9 @@ static __init int samsung_gpiolib_init(void)
 {
        struct samsung_gpio_chip *chip;
        int i, nr_chips;
+#if defined(CONFIG_CPU_EXYNOS4210) || defined(CONFIG_SOC_EXYNOS5250)
        void __iomem *gpio_base1, *gpio_base2, *gpio_base3, *gpio_base4;
+#endif
        int group = 0;
 
        samsung_gpiolib_set_cfg(samsung_gpio_cfgs, ARRAY_SIZE(samsung_gpio_cfgs));
@@ -2971,6 +2975,7 @@ static __init int samsung_gpiolib_init(void)
 
        return 0;
 
+#if defined(CONFIG_CPU_EXYNOS4210) || defined(CONFIG_SOC_EXYNOS5250)
 err_ioremap4:
        iounmap(gpio_base3);
 err_ioremap3:
@@ -2979,6 +2984,7 @@ err_ioremap2:
        iounmap(gpio_base1);
 err_ioremap1:
        return -ENOMEM;
+#endif
 }
 core_initcall(samsung_gpiolib_init);
 
index 1f23e04..08d9a20 100644 (file)
@@ -134,7 +134,7 @@ static void cn_ulog_callback(struct cn_msg *msg, struct netlink_skb_parms *nsp)
 {
        struct dm_ulog_request *tfr = (struct dm_ulog_request *)(msg + 1);
 
-       if (!cap_raised(current_cap(), CAP_SYS_ADMIN))
+       if (!capable(CAP_SYS_ADMIN))
                return;
 
        spin_lock(&receiving_list_lock);
index 922a338..754f38f 100644 (file)
@@ -718,8 +718,8 @@ static int parse_hw_handler(struct dm_arg_set *as, struct multipath *m)
                return 0;
 
        m->hw_handler_name = kstrdup(dm_shift_arg(as), GFP_KERNEL);
-       request_module("scsi_dh_%s", m->hw_handler_name);
-       if (scsi_dh_handler_exist(m->hw_handler_name) == 0) {
+       if (!try_then_request_module(scsi_dh_handler_exist(m->hw_handler_name),
+                                    "scsi_dh_%s", m->hw_handler_name)) {
                ti->error = "unknown hardware handler type";
                ret = -EINVAL;
                goto fail;
index 213ae32..eb3d138 100644 (file)
@@ -279,8 +279,10 @@ static void __cell_release(struct cell *cell, struct bio_list *inmates)
 
        hlist_del(&cell->list);
 
-       bio_list_add(inmates, cell->holder);
-       bio_list_merge(inmates, &cell->bios);
+       if (inmates) {
+               bio_list_add(inmates, cell->holder);
+               bio_list_merge(inmates, &cell->bios);
+       }
 
        mempool_free(cell, prison->cell_pool);
 }
@@ -303,9 +305,10 @@ static void cell_release(struct cell *cell, struct bio_list *bios)
  */
 static void __cell_release_singleton(struct cell *cell, struct bio *bio)
 {
-       hlist_del(&cell->list);
        BUG_ON(cell->holder != bio);
        BUG_ON(!bio_list_empty(&cell->bios));
+
+       __cell_release(cell, NULL);
 }
 
 static void cell_release_singleton(struct cell *cell, struct bio *bio)
@@ -1177,6 +1180,7 @@ static void no_space(struct cell *cell)
 static void process_discard(struct thin_c *tc, struct bio *bio)
 {
        int r;
+       unsigned long flags;
        struct pool *pool = tc->pool;
        struct cell *cell, *cell2;
        struct cell_key key, key2;
@@ -1218,7 +1222,9 @@ static void process_discard(struct thin_c *tc, struct bio *bio)
                        m->bio = bio;
 
                        if (!ds_add_work(&pool->all_io_ds, &m->list)) {
+                               spin_lock_irqsave(&pool->lock, flags);
                                list_add(&m->list, &pool->prepared_discards);
+                               spin_unlock_irqrestore(&pool->lock, flags);
                                wake_worker(pool);
                        }
                } else {
@@ -1626,6 +1632,21 @@ static int bind_control_target(struct pool *pool, struct dm_target *ti)
        pool->low_water_blocks = pt->low_water_blocks;
        pool->pf = pt->pf;
 
+       /*
+        * If discard_passdown was enabled verify that the data device
+        * supports discards.  Disable discard_passdown if not; otherwise
+        * -EOPNOTSUPP will be returned.
+        */
+       if (pt->pf.discard_passdown) {
+               struct request_queue *q = bdev_get_queue(pt->data_dev->bdev);
+               if (!q || !blk_queue_discard(q)) {
+                       char buf[BDEVNAME_SIZE];
+                       DMWARN("Discard unsupported by data device (%s): Disabling discard passdown.",
+                              bdevname(pt->data_dev->bdev, buf));
+                       pool->pf.discard_passdown = 0;
+               }
+       }
+
        return 0;
 }
 
@@ -1982,19 +2003,6 @@ static int pool_ctr(struct dm_target *ti, unsigned argc, char **argv)
                goto out_flags_changed;
        }
 
-       /*
-        * If discard_passdown was enabled verify that the data device
-        * supports discards.  Disable discard_passdown if not; otherwise
-        * -EOPNOTSUPP will be returned.
-        */
-       if (pf.discard_passdown) {
-               struct request_queue *q = bdev_get_queue(data_dev->bdev);
-               if (!q || !blk_queue_discard(q)) {
-                       DMWARN("Discard unsupported by data device: Disabling discard passdown.");
-                       pf.discard_passdown = 0;
-               }
-       }
-
        pt->pool = pool;
        pt->ti = ti;
        pt->metadata_dev = metadata_dev;
@@ -2379,7 +2387,7 @@ static int pool_status(struct dm_target *ti, status_type_t type,
                       (unsigned long long)pt->low_water_blocks);
 
                count = !pool->pf.zero_new_blocks + !pool->pf.discard_enabled +
-                       !pool->pf.discard_passdown;
+                       !pt->pf.discard_passdown;
                DMEMIT("%u ", count);
 
                if (!pool->pf.zero_new_blocks)
@@ -2388,7 +2396,7 @@ static int pool_status(struct dm_target *ti, status_type_t type,
                if (!pool->pf.discard_enabled)
                        DMEMIT("ignore_discard ");
 
-               if (!pool->pf.discard_passdown)
+               if (!pt->pf.discard_passdown)
                        DMEMIT("no_discard_passdown ");
 
                break;
@@ -2626,8 +2634,10 @@ static int thin_endio(struct dm_target *ti,
        if (h->all_io_entry) {
                INIT_LIST_HEAD(&work);
                ds_dec(h->all_io_entry, &work);
+               spin_lock_irqsave(&pool->lock, flags);
                list_for_each_entry_safe(m, tmp, &work, list)
                        list_add(&m->list, &pool->prepared_discards);
+               spin_unlock_irqrestore(&pool->lock, flags);
        }
 
        mempool_free(h, pool->endio_hook_pool);
@@ -2759,6 +2769,6 @@ static void dm_thin_exit(void)
 module_init(dm_thin_init);
 module_exit(dm_thin_exit);
 
-MODULE_DESCRIPTION(DM_NAME "device-mapper thin provisioning target");
+MODULE_DESCRIPTION(DM_NAME " thin provisioning target");
 MODULE_AUTHOR("Joe Thornber <dm-devel@redhat.com>");
 MODULE_LICENSE("GPL");
index 477eb2e..01233d8 100644 (file)
@@ -391,6 +391,8 @@ void mddev_suspend(struct mddev *mddev)
        synchronize_rcu();
        wait_event(mddev->sb_wait, atomic_read(&mddev->active_io) == 0);
        mddev->pers->quiesce(mddev, 1);
+
+       del_timer_sync(&mddev->safemode_timer);
 }
 EXPORT_SYMBOL_GPL(mddev_suspend);
 
index c8dbb84..3f91c2e 100644 (file)
@@ -3164,12 +3164,40 @@ raid10_size(struct mddev *mddev, sector_t sectors, int raid_disks)
        return size << conf->chunk_shift;
 }
 
+static void calc_sectors(struct r10conf *conf, sector_t size)
+{
+       /* Calculate the number of sectors-per-device that will
+        * actually be used, and set conf->dev_sectors and
+        * conf->stride
+        */
+
+       size = size >> conf->chunk_shift;
+       sector_div(size, conf->far_copies);
+       size = size * conf->raid_disks;
+       sector_div(size, conf->near_copies);
+       /* 'size' is now the number of chunks in the array */
+       /* calculate "used chunks per device" */
+       size = size * conf->copies;
+
+       /* We need to round up when dividing by raid_disks to
+        * get the stride size.
+        */
+       size = DIV_ROUND_UP_SECTOR_T(size, conf->raid_disks);
+
+       conf->dev_sectors = size << conf->chunk_shift;
+
+       if (conf->far_offset)
+               conf->stride = 1 << conf->chunk_shift;
+       else {
+               sector_div(size, conf->far_copies);
+               conf->stride = size << conf->chunk_shift;
+       }
+}
 
 static struct r10conf *setup_conf(struct mddev *mddev)
 {
        struct r10conf *conf = NULL;
        int nc, fc, fo;
-       sector_t stride, size;
        int err = -EINVAL;
 
        if (mddev->new_chunk_sectors < (PAGE_SIZE >> 9) ||
@@ -3219,28 +3247,7 @@ static struct r10conf *setup_conf(struct mddev *mddev)
        if (!conf->r10bio_pool)
                goto out;
 
-       size = mddev->dev_sectors >> conf->chunk_shift;
-       sector_div(size, fc);
-       size = size * conf->raid_disks;
-       sector_div(size, nc);
-       /* 'size' is now the number of chunks in the array */
-       /* calculate "used chunks per device" in 'stride' */
-       stride = size * conf->copies;
-
-       /* We need to round up when dividing by raid_disks to
-        * get the stride size.
-        */
-       stride += conf->raid_disks - 1;
-       sector_div(stride, conf->raid_disks);
-
-       conf->dev_sectors = stride << conf->chunk_shift;
-
-       if (fo)
-               stride = 1;
-       else
-               sector_div(stride, fc);
-       conf->stride = stride << conf->chunk_shift;
-
+       calc_sectors(conf, mddev->dev_sectors);
 
        spin_lock_init(&conf->device_lock);
        INIT_LIST_HEAD(&conf->retry_list);
@@ -3468,7 +3475,8 @@ static int raid10_resize(struct mddev *mddev, sector_t sectors)
                mddev->recovery_cp = oldsize;
                set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
        }
-       mddev->dev_sectors = sectors;
+       calc_sectors(conf, sectors);
+       mddev->dev_sectors = conf->dev_sectors;
        mddev->resync_max_sectors = size;
        return 0;
 }
index 0f64d71..cb888d8 100644 (file)
@@ -1921,6 +1921,10 @@ static int dtv_set_frontend(struct dvb_frontend *fe)
        } else {
                /* default values */
                switch (c->delivery_system) {
+               case SYS_DVBS:
+               case SYS_DVBS2:
+               case SYS_ISDBS:
+               case SYS_TURBO:
                case SYS_DVBC_ANNEX_A:
                case SYS_DVBC_ANNEX_C:
                        fepriv->min_delay = HZ / 20;
index 860c112..bef5296 100644 (file)
@@ -1018,22 +1018,6 @@ static int ene_probe(struct pnp_dev *pnp_dev, const struct pnp_device_id *id)
 
        spin_lock_init(&dev->hw_lock);
 
-       /* claim the resources */
-       error = -EBUSY;
-       dev->hw_io = pnp_port_start(pnp_dev, 0);
-       if (!request_region(dev->hw_io, ENE_IO_SIZE, ENE_DRIVER_NAME)) {
-               dev->hw_io = -1;
-               dev->irq = -1;
-               goto error;
-       }
-
-       dev->irq = pnp_irq(pnp_dev, 0);
-       if (request_irq(dev->irq, ene_isr,
-                       IRQF_SHARED, ENE_DRIVER_NAME, (void *)dev)) {
-               dev->irq = -1;
-               goto error;
-       }
-
        pnp_set_drvdata(pnp_dev, dev);
        dev->pnp_dev = pnp_dev;
 
@@ -1086,6 +1070,22 @@ static int ene_probe(struct pnp_dev *pnp_dev, const struct pnp_device_id *id)
        device_set_wakeup_capable(&pnp_dev->dev, true);
        device_set_wakeup_enable(&pnp_dev->dev, true);
 
+       /* claim the resources */
+       error = -EBUSY;
+       dev->hw_io = pnp_port_start(pnp_dev, 0);
+       if (!request_region(dev->hw_io, ENE_IO_SIZE, ENE_DRIVER_NAME)) {
+               dev->hw_io = -1;
+               dev->irq = -1;
+               goto error;
+       }
+
+       dev->irq = pnp_irq(pnp_dev, 0);
+       if (request_irq(dev->irq, ene_isr,
+                       IRQF_SHARED, ENE_DRIVER_NAME, (void *)dev)) {
+               dev->irq = -1;
+               goto error;
+       }
+
        error = rc_register_device(rdev);
        if (error < 0)
                goto error;
index 392d4be..4a3a238 100644 (file)
@@ -197,7 +197,7 @@ static int fintek_hw_detect(struct fintek_dev *fintek)
        /*
         * Newer reviews of this chipset uses port 8 instead of 5
         */
-       if ((chip != 0x0408) || (chip != 0x0804))
+       if ((chip != 0x0408) && (chip != 0x0804))
                fintek->logical_dev_cir = LOGICAL_DEV_CIR_REV2;
        else
                fintek->logical_dev_cir = LOGICAL_DEV_CIR_REV1;
@@ -514,16 +514,6 @@ static int fintek_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id
 
        spin_lock_init(&fintek->fintek_lock);
 
-       ret = -EBUSY;
-       /* now claim resources */
-       if (!request_region(fintek->cir_addr,
-                           fintek->cir_port_len, FINTEK_DRIVER_NAME))
-               goto failure;
-
-       if (request_irq(fintek->cir_irq, fintek_cir_isr, IRQF_SHARED,
-                       FINTEK_DRIVER_NAME, (void *)fintek))
-               goto failure;
-
        pnp_set_drvdata(pdev, fintek);
        fintek->pdev = pdev;
 
@@ -558,6 +548,16 @@ static int fintek_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id
        /* rx resolution is hardwired to 50us atm, 1, 25, 100 also possible */
        rdev->rx_resolution = US_TO_NS(CIR_SAMPLE_PERIOD);
 
+       ret = -EBUSY;
+       /* now claim resources */
+       if (!request_region(fintek->cir_addr,
+                           fintek->cir_port_len, FINTEK_DRIVER_NAME))
+               goto failure;
+
+       if (request_irq(fintek->cir_irq, fintek_cir_isr, IRQF_SHARED,
+                       FINTEK_DRIVER_NAME, (void *)fintek))
+               goto failure;
+
        ret = rc_register_device(rdev);
        if (ret)
                goto failure;
index 682009d..0e49c99 100644 (file)
@@ -1515,16 +1515,6 @@ static int ite_probe(struct pnp_dev *pdev, const struct pnp_device_id
        /* initialize raw event */
        init_ir_raw_event(&itdev->rawir);
 
-       ret = -EBUSY;
-       /* now claim resources */
-       if (!request_region(itdev->cir_addr,
-                               dev_desc->io_region_size, ITE_DRIVER_NAME))
-               goto failure;
-
-       if (request_irq(itdev->cir_irq, ite_cir_isr, IRQF_SHARED,
-                       ITE_DRIVER_NAME, (void *)itdev))
-               goto failure;
-
        /* set driver data into the pnp device */
        pnp_set_drvdata(pdev, itdev);
        itdev->pdev = pdev;
@@ -1600,6 +1590,16 @@ static int ite_probe(struct pnp_dev *pdev, const struct pnp_device_id
        rdev->driver_name = ITE_DRIVER_NAME;
        rdev->map_name = RC_MAP_RC6_MCE;
 
+       ret = -EBUSY;
+       /* now claim resources */
+       if (!request_region(itdev->cir_addr,
+                               dev_desc->io_region_size, ITE_DRIVER_NAME))
+               goto failure;
+
+       if (request_irq(itdev->cir_irq, ite_cir_isr, IRQF_SHARED,
+                       ITE_DRIVER_NAME, (void *)itdev))
+               goto failure;
+
        ret = rc_register_device(rdev);
        if (ret)
                goto failure;
index 144f3f5..8b2c071 100644 (file)
@@ -1021,24 +1021,6 @@ static int nvt_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id)
        spin_lock_init(&nvt->nvt_lock);
        spin_lock_init(&nvt->tx.lock);
 
-       ret = -EBUSY;
-       /* now claim resources */
-       if (!request_region(nvt->cir_addr,
-                           CIR_IOREG_LENGTH, NVT_DRIVER_NAME))
-               goto failure;
-
-       if (request_irq(nvt->cir_irq, nvt_cir_isr, IRQF_SHARED,
-                       NVT_DRIVER_NAME, (void *)nvt))
-               goto failure;
-
-       if (!request_region(nvt->cir_wake_addr,
-                           CIR_IOREG_LENGTH, NVT_DRIVER_NAME))
-               goto failure;
-
-       if (request_irq(nvt->cir_wake_irq, nvt_cir_wake_isr, IRQF_SHARED,
-                       NVT_DRIVER_NAME, (void *)nvt))
-               goto failure;
-
        pnp_set_drvdata(pdev, nvt);
        nvt->pdev = pdev;
 
@@ -1085,6 +1067,24 @@ static int nvt_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id)
        rdev->tx_resolution = XYZ;
 #endif
 
+       ret = -EBUSY;
+       /* now claim resources */
+       if (!request_region(nvt->cir_addr,
+                           CIR_IOREG_LENGTH, NVT_DRIVER_NAME))
+               goto failure;
+
+       if (request_irq(nvt->cir_irq, nvt_cir_isr, IRQF_SHARED,
+                       NVT_DRIVER_NAME, (void *)nvt))
+               goto failure;
+
+       if (!request_region(nvt->cir_wake_addr,
+                           CIR_IOREG_LENGTH, NVT_DRIVER_NAME))
+               goto failure;
+
+       if (request_irq(nvt->cir_wake_irq, nvt_cir_wake_isr, IRQF_SHARED,
+                       NVT_DRIVER_NAME, (void *)nvt))
+               goto failure;
+
        ret = rc_register_device(rdev);
        if (ret)
                goto failure;
index af52658..342c2c8 100644 (file)
@@ -991,39 +991,10 @@ wbcir_probe(struct pnp_dev *device, const struct pnp_device_id *dev_id)
                "(w: 0x%lX, e: 0x%lX, s: 0x%lX, i: %u)\n",
                data->wbase, data->ebase, data->sbase, data->irq);
 
-       if (!request_region(data->wbase, WAKEUP_IOMEM_LEN, DRVNAME)) {
-               dev_err(dev, "Region 0x%lx-0x%lx already in use!\n",
-                       data->wbase, data->wbase + WAKEUP_IOMEM_LEN - 1);
-               err = -EBUSY;
-               goto exit_free_data;
-       }
-
-       if (!request_region(data->ebase, EHFUNC_IOMEM_LEN, DRVNAME)) {
-               dev_err(dev, "Region 0x%lx-0x%lx already in use!\n",
-                       data->ebase, data->ebase + EHFUNC_IOMEM_LEN - 1);
-               err = -EBUSY;
-               goto exit_release_wbase;
-       }
-
-       if (!request_region(data->sbase, SP_IOMEM_LEN, DRVNAME)) {
-               dev_err(dev, "Region 0x%lx-0x%lx already in use!\n",
-                       data->sbase, data->sbase + SP_IOMEM_LEN - 1);
-               err = -EBUSY;
-               goto exit_release_ebase;
-       }
-
-       err = request_irq(data->irq, wbcir_irq_handler,
-                         IRQF_DISABLED, DRVNAME, device);
-       if (err) {
-               dev_err(dev, "Failed to claim IRQ %u\n", data->irq);
-               err = -EBUSY;
-               goto exit_release_sbase;
-       }
-
        led_trigger_register_simple("cir-tx", &data->txtrigger);
        if (!data->txtrigger) {
                err = -ENOMEM;
-               goto exit_free_irq;
+               goto exit_free_data;
        }
 
        led_trigger_register_simple("cir-rx", &data->rxtrigger);
@@ -1062,9 +1033,38 @@ wbcir_probe(struct pnp_dev *device, const struct pnp_device_id *dev_id)
        data->dev->priv = data;
        data->dev->dev.parent = &device->dev;
 
+       if (!request_region(data->wbase, WAKEUP_IOMEM_LEN, DRVNAME)) {
+               dev_err(dev, "Region 0x%lx-0x%lx already in use!\n",
+                       data->wbase, data->wbase + WAKEUP_IOMEM_LEN - 1);
+               err = -EBUSY;
+               goto exit_free_rc;
+       }
+
+       if (!request_region(data->ebase, EHFUNC_IOMEM_LEN, DRVNAME)) {
+               dev_err(dev, "Region 0x%lx-0x%lx already in use!\n",
+                       data->ebase, data->ebase + EHFUNC_IOMEM_LEN - 1);
+               err = -EBUSY;
+               goto exit_release_wbase;
+       }
+
+       if (!request_region(data->sbase, SP_IOMEM_LEN, DRVNAME)) {
+               dev_err(dev, "Region 0x%lx-0x%lx already in use!\n",
+                       data->sbase, data->sbase + SP_IOMEM_LEN - 1);
+               err = -EBUSY;
+               goto exit_release_ebase;
+       }
+
+       err = request_irq(data->irq, wbcir_irq_handler,
+                         IRQF_DISABLED, DRVNAME, device);
+       if (err) {
+               dev_err(dev, "Failed to claim IRQ %u\n", data->irq);
+               err = -EBUSY;
+               goto exit_release_sbase;
+       }
+
        err = rc_register_device(data->dev);
        if (err)
-               goto exit_free_rc;
+               goto exit_free_irq;
 
        device_init_wakeup(&device->dev, 1);
 
@@ -1072,14 +1072,6 @@ wbcir_probe(struct pnp_dev *device, const struct pnp_device_id *dev_id)
 
        return 0;
 
-exit_free_rc:
-       rc_free_device(data->dev);
-exit_unregister_led:
-       led_classdev_unregister(&data->led);
-exit_unregister_rxtrigger:
-       led_trigger_unregister_simple(data->rxtrigger);
-exit_unregister_txtrigger:
-       led_trigger_unregister_simple(data->txtrigger);
 exit_free_irq:
        free_irq(data->irq, device);
 exit_release_sbase:
@@ -1088,6 +1080,14 @@ exit_release_ebase:
        release_region(data->ebase, EHFUNC_IOMEM_LEN);
 exit_release_wbase:
        release_region(data->wbase, WAKEUP_IOMEM_LEN);
+exit_free_rc:
+       rc_free_device(data->dev);
+exit_unregister_led:
+       led_classdev_unregister(&data->led);
+exit_unregister_rxtrigger:
+       led_trigger_unregister_simple(data->rxtrigger);
+exit_unregister_txtrigger:
+       led_trigger_unregister_simple(data->txtrigger);
 exit_free_data:
        kfree(data);
        pnp_set_drvdata(device, NULL);
index db8e508..863c755 100644 (file)
@@ -2923,6 +2923,10 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
         * not the JPEG end of frame ('ff d9').
         */
 
+       /* count the packets and their size */
+       sd->npkt++;
+       sd->pktsz += len;
+
 /*fixme: assumption about the following code:
  *     - there can be only one marker in a packet
  */
@@ -2945,10 +2949,6 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
                data += i;
        }
 
-       /* count the packets and their size */
-       sd->npkt++;
-       sd->pktsz += len;
-
        /* search backwards if there is a marker in the packet */
        for (i = len - 1; --i >= 0; ) {
                if (data[i] != 0xff) {
index d235523..c4c17fe 100644 (file)
@@ -181,7 +181,6 @@ static int mmpcam_probe(struct platform_device *pdev)
        INIT_LIST_HEAD(&cam->devlist);
 
        mcam = &cam->mcam;
-       mcam->platform = MHP_Armada610;
        mcam->plat_power_up = mmpcam_power_up;
        mcam->plat_power_down = mmpcam_power_down;
        mcam->dev = &pdev->dev;
index b06efd2..7e9b2c6 100644 (file)
@@ -246,28 +246,37 @@ int fimc_capture_resume(struct fimc_dev *fimc)
 
 }
 
-static unsigned int get_plane_size(struct fimc_frame *fr, unsigned int plane)
-{
-       if (!fr || plane >= fr->fmt->memplanes)
-               return 0;
-       return fr->f_width * fr->f_height * fr->fmt->depth[plane] / 8;
-}
-
-static int queue_setup(struct vb2_queue *vq,  const struct v4l2_format *pfmt,
+static int queue_setup(struct vb2_queue *vq, const struct v4l2_format *pfmt,
                       unsigned int *num_buffers, unsigned int *num_planes,
                       unsigned int sizes[], void *allocators[])
 {
+       const struct v4l2_pix_format_mplane *pixm = NULL;
        struct fimc_ctx *ctx = vq->drv_priv;
-       struct fimc_fmt *fmt = ctx->d_frame.fmt;
+       struct fimc_frame *frame = &ctx->d_frame;
+       struct fimc_fmt *fmt = frame->fmt;
+       unsigned long wh;
        int i;
 
-       if (!fmt)
+       if (pfmt) {
+               pixm = &pfmt->fmt.pix_mp;
+               fmt = fimc_find_format(&pixm->pixelformat, NULL,
+                                      FMT_FLAGS_CAM | FMT_FLAGS_M2M, -1);
+               wh = pixm->width * pixm->height;
+       } else {
+               wh = frame->f_width * frame->f_height;
+       }
+
+       if (fmt == NULL)
                return -EINVAL;
 
        *num_planes = fmt->memplanes;
 
        for (i = 0; i < fmt->memplanes; i++) {
-               sizes[i] = get_plane_size(&ctx->d_frame, i);
+               unsigned int size = (wh * fmt->depth[i]) / 8;
+               if (pixm)
+                       sizes[i] = max(size, pixm->plane_fmt[i].sizeimage);
+               else
+                       sizes[i] = size;
                allocators[i] = ctx->fimc_dev->alloc_ctx;
        }
 
@@ -1383,7 +1392,7 @@ static int fimc_subdev_set_crop(struct v4l2_subdev *sd,
        fimc_capture_try_crop(ctx, r, crop->pad);
 
        if (crop->which == V4L2_SUBDEV_FORMAT_TRY) {
-               mutex_lock(&fimc->lock);
+               mutex_unlock(&fimc->lock);
                *v4l2_subdev_get_try_crop(fh, crop->pad) = *r;
                return 0;
        }
index e184e65..e09ba7b 100644 (file)
@@ -1048,14 +1048,14 @@ static int fimc_m2m_g_fmt_mplane(struct file *file, void *fh,
  * @mask: the color flags to match
  * @index: offset in the fimc_formats array, ignored if negative
  */
-struct fimc_fmt *fimc_find_format(u32 *pixelformat, u32 *mbus_code,
+struct fimc_fmt *fimc_find_format(const u32 *pixelformat, const u32 *mbus_code,
                                  unsigned int mask, int index)
 {
        struct fimc_fmt *fmt, *def_fmt = NULL;
        unsigned int i;
        int id = 0;
 
-       if (index >= ARRAY_SIZE(fimc_formats))
+       if (index >= (int)ARRAY_SIZE(fimc_formats))
                return NULL;
 
        for (i = 0; i < ARRAY_SIZE(fimc_formats); ++i) {
index a18291e..84fd835 100644 (file)
@@ -718,7 +718,7 @@ void fimc_alpha_ctrl_update(struct fimc_ctx *ctx);
 int fimc_fill_format(struct fimc_frame *frame, struct v4l2_format *f);
 void fimc_adjust_mplane_format(struct fimc_fmt *fmt, u32 width, u32 height,
                               struct v4l2_pix_format_mplane *pix);
-struct fimc_fmt *fimc_find_format(u32 *pixelformat, u32 *mbus_code,
+struct fimc_fmt *fimc_find_format(const u32 *pixelformat, const u32 *mbus_code,
                                  unsigned int mask, int index);
 
 int fimc_check_scaler_ratio(struct fimc_ctx *ctx, int sw, int sh,
index eb25756..aedb970 100644 (file)
@@ -530,7 +530,10 @@ static int soc_camera_open(struct file *file)
                if (icl->reset)
                        icl->reset(icd->pdev);
 
+               /* Don't mess with the host during probe */
+               mutex_lock(&ici->host_lock);
                ret = ici->ops->add(icd);
+               mutex_unlock(&ici->host_lock);
                if (ret < 0) {
                        dev_err(icd->pdev, "Couldn't activate the camera: %d\n", ret);
                        goto eiciadd;
@@ -956,7 +959,7 @@ static void scan_add_host(struct soc_camera_host *ici)
 {
        struct soc_camera_device *icd;
 
-       mutex_lock(&list_lock);
+       mutex_lock(&ici->host_lock);
 
        list_for_each_entry(icd, &devices, list) {
                if (icd->iface == ici->nr) {
@@ -967,7 +970,7 @@ static void scan_add_host(struct soc_camera_host *ici)
                }
        }
 
-       mutex_unlock(&list_lock);
+       mutex_unlock(&ici->host_lock);
 }
 
 #ifdef CONFIG_I2C_BOARDINFO
@@ -1313,6 +1316,7 @@ int soc_camera_host_register(struct soc_camera_host *ici)
        list_add_tail(&ici->list, &hosts);
        mutex_unlock(&list_lock);
 
+       mutex_init(&ici->host_lock);
        scan_add_host(ici);
 
        return 0;
index f17ad98..4b71326 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/dma-mapping.h>
 
 #include <media/videobuf2-core.h>
+#include <media/videobuf2-dma-contig.h>
 #include <media/videobuf2-memops.h>
 
 struct vb2_dc_conf {
@@ -85,7 +86,7 @@ static void *vb2_dma_contig_vaddr(void *buf_priv)
 {
        struct vb2_dc_buf *buf = buf_priv;
        if (!buf)
-               return 0;
+               return NULL;
 
        return buf->vaddr;
 }
index c41cb60..504cd4c 100644 (file)
@@ -55,6 +55,7 @@ struct vm_area_struct *vb2_get_vma(struct vm_area_struct *vma)
 
        return vma_copy;
 }
+EXPORT_SYMBOL_GPL(vb2_get_vma);
 
 /**
  * vb2_put_userptr() - release a userspace virtual memory area
index 58fc65f..f2f482b 100644 (file)
@@ -376,7 +376,7 @@ static int otp_select_filemode(struct mtd_file_info *mfi, int mode)
         * Make a fake call to mtd_read_fact_prot_reg() to check if OTP
         * operations are supported.
         */
-       if (mtd_read_fact_prot_reg(mtd, -1, -1, &retlen, NULL) == -EOPNOTSUPP)
+       if (mtd_read_fact_prot_reg(mtd, -1, 0, &retlen, NULL) == -EOPNOTSUPP)
                return -EOPNOTSUPP;
 
        switch (mode) {
index 7341695..861ca8f 100644 (file)
@@ -212,18 +212,17 @@ static int __devinit ams_delta_init(struct platform_device *pdev)
        /* Link the private data with the MTD structure */
        ams_delta_mtd->priv = this;
 
-       if (!request_mem_region(res->start, resource_size(res),
-                       dev_name(&pdev->dev))) {
-               dev_err(&pdev->dev, "request_mem_region failed\n");
-               err = -EBUSY;
-               goto out_free;
-       }
+       /*
+        * Don't try to request the memory region from here,
+        * it should have been already requested from the
+        * gpio-omap driver and requesting it again would fail.
+        */
 
        io_base = ioremap(res->start, resource_size(res));
        if (io_base == NULL) {
                dev_err(&pdev->dev, "ioremap failed\n");
                err = -EIO;
-               goto out_release_io;
+               goto out_free;
        }
 
        this->priv = io_base;
@@ -271,8 +270,6 @@ out_gpio:
        platform_set_drvdata(pdev, NULL);
        gpio_free(AMS_DELTA_GPIO_PIN_NAND_RB);
        iounmap(io_base);
-out_release_io:
-       release_mem_region(res->start, resource_size(res));
 out_free:
        kfree(ams_delta_mtd);
  out:
@@ -285,7 +282,6 @@ out_free:
 static int __devexit ams_delta_cleanup(struct platform_device *pdev)
 {
        void __iomem *io_base = platform_get_drvdata(pdev);
-       struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 
        /* Release resources, unregister device */
        nand_release(ams_delta_mtd);
@@ -293,7 +289,6 @@ static int __devexit ams_delta_cleanup(struct platform_device *pdev)
        gpio_free_array(_mandatory_gpio, ARRAY_SIZE(_mandatory_gpio));
        gpio_free(AMS_DELTA_GPIO_PIN_NAND_RB);
        iounmap(io_base);
-       release_mem_region(res->start, resource_size(res));
 
        /* Free the MTD device structure */
        kfree(ams_delta_mtd);
index 793b001..3463b46 100644 (file)
@@ -2173,9 +2173,10 @@ re_arm:
  * received frames (loopback). Since only the payload is given to this
  * function, it check for loopback.
  */
-static void bond_3ad_rx_indication(struct lacpdu *lacpdu, struct slave *slave, u16 length)
+static int bond_3ad_rx_indication(struct lacpdu *lacpdu, struct slave *slave, u16 length)
 {
        struct port *port;
+       int ret = RX_HANDLER_ANOTHER;
 
        if (length >= sizeof(struct lacpdu)) {
 
@@ -2184,11 +2185,12 @@ static void bond_3ad_rx_indication(struct lacpdu *lacpdu, struct slave *slave, u
                if (!port->slave) {
                        pr_warning("%s: Warning: port of slave %s is uninitialized\n",
                                   slave->dev->name, slave->dev->master->name);
-                       return;
+                       return ret;
                }
 
                switch (lacpdu->subtype) {
                case AD_TYPE_LACPDU:
+                       ret = RX_HANDLER_CONSUMED;
                        pr_debug("Received LACPDU on port %d\n",
                                 port->actor_port_number);
                        /* Protect against concurrent state machines */
@@ -2198,6 +2200,7 @@ static void bond_3ad_rx_indication(struct lacpdu *lacpdu, struct slave *slave, u
                        break;
 
                case AD_TYPE_MARKER:
+                       ret = RX_HANDLER_CONSUMED;
                        // No need to convert fields to Little Endian since we don't use the marker's fields.
 
                        switch (((struct bond_marker *)lacpdu)->tlv_type) {
@@ -2219,6 +2222,7 @@ static void bond_3ad_rx_indication(struct lacpdu *lacpdu, struct slave *slave, u
                        }
                }
        }
+       return ret;
 }
 
 /**
@@ -2456,18 +2460,20 @@ out:
        return NETDEV_TX_OK;
 }
 
-void bond_3ad_lacpdu_recv(struct sk_buff *skb, struct bonding *bond,
+int bond_3ad_lacpdu_recv(struct sk_buff *skb, struct bonding *bond,
                          struct slave *slave)
 {
+       int ret = RX_HANDLER_ANOTHER;
        if (skb->protocol != PKT_TYPE_LACPDU)
-               return;
+               return ret;
 
        if (!pskb_may_pull(skb, sizeof(struct lacpdu)))
-               return;
+               return ret;
 
        read_lock(&bond->lock);
-       bond_3ad_rx_indication((struct lacpdu *) skb->data, slave, skb->len);
+       ret = bond_3ad_rx_indication((struct lacpdu *) skb->data, slave, skb->len);
        read_unlock(&bond->lock);
+       return ret;
 }
 
 /*
index 235b2cc..5ee7e3c 100644 (file)
@@ -274,7 +274,7 @@ void bond_3ad_adapter_duplex_changed(struct slave *slave);
 void bond_3ad_handle_link_change(struct slave *slave, char link);
 int  bond_3ad_get_active_agg_info(struct bonding *bond, struct ad_info *ad_info);
 int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev);
-void bond_3ad_lacpdu_recv(struct sk_buff *skb, struct bonding *bond,
+int bond_3ad_lacpdu_recv(struct sk_buff *skb, struct bonding *bond,
                          struct slave *slave);
 int bond_3ad_set_carrier(struct bonding *bond);
 void bond_3ad_update_lacp_rate(struct bonding *bond);
index 9abfde4..2e1f806 100644 (file)
@@ -342,26 +342,26 @@ static void rlb_update_entry_from_arp(struct bonding *bond, struct arp_pkt *arp)
        _unlock_rx_hashtbl_bh(bond);
 }
 
-static void rlb_arp_recv(struct sk_buff *skb, struct bonding *bond,
+static int rlb_arp_recv(struct sk_buff *skb, struct bonding *bond,
                         struct slave *slave)
 {
        struct arp_pkt *arp;
 
        if (skb->protocol != cpu_to_be16(ETH_P_ARP))
-               return;
+               goto out;
 
        arp = (struct arp_pkt *) skb->data;
        if (!arp) {
                pr_debug("Packet has no ARP data\n");
-               return;
+               goto out;
        }
 
        if (!pskb_may_pull(skb, arp_hdr_len(bond->dev)))
-               return;
+               goto out;
 
        if (skb->len < sizeof(struct arp_pkt)) {
                pr_debug("Packet is too small to be an ARP\n");
-               return;
+               goto out;
        }
 
        if (arp->op_code == htons(ARPOP_REPLY)) {
@@ -369,6 +369,8 @@ static void rlb_arp_recv(struct sk_buff *skb, struct bonding *bond,
                rlb_update_entry_from_arp(bond, arp);
                pr_debug("Server received an ARP Reply from client\n");
        }
+out:
+       return RX_HANDLER_ANOTHER;
 }
 
 /* Caller must hold bond lock for read */
index 62d2409..bc13b3d 100644 (file)
@@ -1444,8 +1444,9 @@ static rx_handler_result_t bond_handle_frame(struct sk_buff **pskb)
        struct sk_buff *skb = *pskb;
        struct slave *slave;
        struct bonding *bond;
-       void (*recv_probe)(struct sk_buff *, struct bonding *,
+       int (*recv_probe)(struct sk_buff *, struct bonding *,
                                struct slave *);
+       int ret = RX_HANDLER_ANOTHER;
 
        skb = skb_share_check(skb, GFP_ATOMIC);
        if (unlikely(!skb))
@@ -1464,8 +1465,12 @@ static rx_handler_result_t bond_handle_frame(struct sk_buff **pskb)
                struct sk_buff *nskb = skb_clone(skb, GFP_ATOMIC);
 
                if (likely(nskb)) {
-                       recv_probe(nskb, bond, slave);
+                       ret = recv_probe(nskb, bond, slave);
                        dev_kfree_skb(nskb);
+                       if (ret == RX_HANDLER_CONSUMED) {
+                               consume_skb(skb);
+                               return ret;
+                       }
                }
        }
 
@@ -1487,7 +1492,7 @@ static rx_handler_result_t bond_handle_frame(struct sk_buff **pskb)
                memcpy(eth_hdr(skb)->h_dest, bond->dev->dev_addr, ETH_ALEN);
        }
 
-       return RX_HANDLER_ANOTHER;
+       return ret;
 }
 
 /* enslave device <slave> to bond device <master> */
@@ -2723,7 +2728,7 @@ static void bond_validate_arp(struct bonding *bond, struct slave *slave, __be32
        }
 }
 
-static void bond_arp_rcv(struct sk_buff *skb, struct bonding *bond,
+static int bond_arp_rcv(struct sk_buff *skb, struct bonding *bond,
                         struct slave *slave)
 {
        struct arphdr *arp;
@@ -2731,7 +2736,7 @@ static void bond_arp_rcv(struct sk_buff *skb, struct bonding *bond,
        __be32 sip, tip;
 
        if (skb->protocol != __cpu_to_be16(ETH_P_ARP))
-               return;
+               return RX_HANDLER_ANOTHER;
 
        read_lock(&bond->lock);
 
@@ -2776,6 +2781,7 @@ static void bond_arp_rcv(struct sk_buff *skb, struct bonding *bond,
 
 out_unlock:
        read_unlock(&bond->lock);
+       return RX_HANDLER_ANOTHER;
 }
 
 /*
index 9f2bae6..4581aa5 100644 (file)
@@ -218,7 +218,7 @@ struct bonding {
        struct   slave *primary_slave;
        bool     force_primary;
        s32      slave_cnt; /* never change this value outside the attach/detach wrappers */
-       void     (*recv_probe)(struct sk_buff *, struct bonding *,
+       int     (*recv_probe)(struct sk_buff *, struct bonding *,
                               struct slave *);
        rwlock_t lock;
        rwlock_t curr_slave_lock;
index e077d25..6af3101 100644 (file)
@@ -9122,13 +9122,34 @@ static int __devinit bnx2x_prev_unload_common(struct bnx2x *bp)
        return bnx2x_prev_mcp_done(bp);
 }
 
+/* previous driver DMAE transaction may have occurred when pre-boot stage ended
+ * and boot began, or when kdump kernel was loaded. Either case would invalidate
+ * the addresses of the transaction, resulting in was-error bit set in the pci
+ * causing all hw-to-host pcie transactions to timeout. If this happened we want
+ * to clear the interrupt which detected this from the pglueb and the was done
+ * bit
+ */
+static void __devinit bnx2x_prev_interrupted_dmae(struct bnx2x *bp)
+{
+       u32 val = REG_RD(bp, PGLUE_B_REG_PGLUE_B_INT_STS);
+       if (val & PGLUE_B_PGLUE_B_INT_STS_REG_WAS_ERROR_ATTN) {
+               BNX2X_ERR("was error bit was found to be set in pglueb upon startup. Clearing");
+               REG_WR(bp, PGLUE_B_REG_WAS_ERROR_PF_7_0_CLR, 1 << BP_FUNC(bp));
+       }
+}
+
 static int __devinit bnx2x_prev_unload(struct bnx2x *bp)
 {
        int time_counter = 10;
        u32 rc, fw, hw_lock_reg, hw_lock_val;
        BNX2X_DEV_INFO("Entering Previous Unload Flow\n");
 
-       /* Release previously held locks */
+       /* clear hw from errors which may have resulted from an interrupted
+        * dmae transaction.
+        */
+       bnx2x_prev_interrupted_dmae(bp);
+
+       /* Release previously held locks */
        hw_lock_reg = (BP_FUNC(bp) <= 5) ?
                      (MISC_REG_DRIVER_CONTROL_1 + BP_FUNC(bp) * 8) :
                      (MISC_REG_DRIVER_CONTROL_7 + (BP_FUNC(bp) - 6) * 8);
index c9069a2..f4d2da0 100644 (file)
@@ -3335,6 +3335,8 @@ static int __devinit ehea_probe_adapter(struct platform_device *dev,
                goto out_shutdown_ports;
        }
 
+       /* Handle any events that might be pending. */
+       tasklet_hi_schedule(&adapter->neq_tasklet);
 
        ret = 0;
        goto out;
index 4348b6f..8d8908d 100644 (file)
@@ -493,7 +493,11 @@ out:
 static void e1000_down_and_stop(struct e1000_adapter *adapter)
 {
        set_bit(__E1000_DOWN, &adapter->flags);
-       cancel_work_sync(&adapter->reset_task);
+
+       /* Only kill reset task if adapter is not resetting */
+       if (!test_bit(__E1000_RESETTING, &adapter->flags))
+               cancel_work_sync(&adapter->reset_task);
+
        cancel_delayed_work_sync(&adapter->watchdog_task);
        cancel_delayed_work_sync(&adapter->phy_info_task);
        cancel_delayed_work_sync(&adapter->fifo_stall_task);
@@ -3380,7 +3384,7 @@ static void e1000_dump(struct e1000_adapter *adapter)
        for (i = 0; tx_ring->desc && (i < tx_ring->count); i++) {
                struct e1000_tx_desc *tx_desc = E1000_TX_DESC(*tx_ring, i);
                struct e1000_buffer *buffer_info = &tx_ring->buffer_info[i];
-               struct my_u { u64 a; u64 b; };
+               struct my_u { __le64 a; __le64 b; };
                struct my_u *u = (struct my_u *)tx_desc;
                const char *type;
 
@@ -3424,7 +3428,7 @@ rx_ring_summary:
        for (i = 0; rx_ring->desc && (i < rx_ring->count); i++) {
                struct e1000_rx_desc *rx_desc = E1000_RX_DESC(*rx_ring, i);
                struct e1000_buffer *buffer_info = &rx_ring->buffer_info[i];
-               struct my_u { u64 a; u64 b; };
+               struct my_u { __le64 a; __le64 b; };
                struct my_u *u = (struct my_u *)rx_desc;
                const char *type;
 
index 5ec3159..8683ca4 100644 (file)
@@ -1111,9 +1111,12 @@ msi_only:
                adapter->flags |= IGB_FLAG_HAS_MSI;
 out:
        /* Notify the stack of the (possibly) reduced queue counts. */
+       rtnl_lock();
        netif_set_real_num_tx_queues(adapter->netdev, adapter->num_tx_queues);
-       return netif_set_real_num_rx_queues(adapter->netdev,
-                                           adapter->num_rx_queues);
+       err = netif_set_real_num_rx_queues(adapter->netdev,
+               adapter->num_rx_queues);
+       rtnl_unlock();
+       return err;
 }
 
 /**
@@ -2771,8 +2774,6 @@ void igb_configure_tx_ring(struct igb_adapter *adapter,
 
        txdctl |= E1000_TXDCTL_QUEUE_ENABLE;
        wr32(E1000_TXDCTL(reg_idx), txdctl);
-
-       netdev_tx_reset_queue(txring_txq(ring));
 }
 
 /**
@@ -3282,6 +3283,8 @@ static void igb_clean_tx_ring(struct igb_ring *tx_ring)
                igb_unmap_and_free_tx_resource(tx_ring, buffer_info);
        }
 
+       netdev_tx_reset_queue(txring_txq(tx_ring));
+
        size = sizeof(struct igb_tx_buffer) * tx_ring->count;
        memset(tx_ring->tx_buffer_info, 0, size);
 
@@ -6796,18 +6799,7 @@ static int igb_resume(struct device *dev)
        pci_enable_wake(pdev, PCI_D3hot, 0);
        pci_enable_wake(pdev, PCI_D3cold, 0);
 
-       if (!rtnl_is_locked()) {
-               /*
-                * shut up ASSERT_RTNL() warning in
-                * netif_set_real_num_tx/rx_queues.
-                */
-               rtnl_lock();
-               err = igb_init_interrupt_scheme(adapter);
-               rtnl_unlock();
-       } else {
-               err = igb_init_interrupt_scheme(adapter);
-       }
-       if (err) {
+       if (igb_init_interrupt_scheme(adapter)) {
                dev_err(&pdev->dev, "Unable to allocate memory for queues\n");
                return -ENOMEM;
        }
index 74e1921..81b1555 100644 (file)
@@ -574,9 +574,6 @@ extern struct ixgbe_info ixgbe_82599_info;
 extern struct ixgbe_info ixgbe_X540_info;
 #ifdef CONFIG_IXGBE_DCB
 extern const struct dcbnl_rtnl_ops dcbnl_ops;
-extern int ixgbe_copy_dcb_cfg(struct ixgbe_dcb_config *src_dcb_cfg,
-                              struct ixgbe_dcb_config *dst_dcb_cfg,
-                              int tc_max);
 #endif
 
 extern char ixgbe_driver_name[];
index 652e4b0..32e5c02 100644 (file)
 #define DCB_NO_HW_CHG   1  /* DCB configuration did not change */
 #define DCB_HW_CHG      2  /* DCB configuration changed, no reset */
 
-int ixgbe_copy_dcb_cfg(struct ixgbe_dcb_config *scfg,
-                      struct ixgbe_dcb_config *dcfg, int tc_max)
+static int ixgbe_copy_dcb_cfg(struct ixgbe_adapter *adapter, int tc_max)
 {
+       struct ixgbe_dcb_config *scfg = &adapter->temp_dcb_cfg;
+       struct ixgbe_dcb_config *dcfg = &adapter->dcb_cfg;
        struct tc_configuration *src = NULL;
        struct tc_configuration *dst = NULL;
        int i, j;
        int tx = DCB_TX_CONFIG;
        int rx = DCB_RX_CONFIG;
        int changes = 0;
+#ifdef IXGBE_FCOE
+       struct dcb_app app = {
+                             .selector = DCB_APP_IDTYPE_ETHTYPE,
+                             .protocol = ETH_P_FCOE,
+                            };
+       u8 up = dcb_getapp(adapter->netdev, &app);
 
-       if (!scfg || !dcfg)
-               return changes;
+       if (up && !(up & (1 << adapter->fcoe.up)))
+               changes |= BIT_APP_UPCHG;
+#endif
 
        for (i = DCB_PG_ATTR_TC_0; i < tc_max + DCB_PG_ATTR_TC_0; i++) {
                src = &scfg->tc_config[i - DCB_PG_ATTR_TC_0];
@@ -332,28 +340,12 @@ static u8 ixgbe_dcbnl_set_all(struct net_device *netdev)
        struct ixgbe_adapter *adapter = netdev_priv(netdev);
        int ret = DCB_NO_HW_CHG;
        int i;
-#ifdef IXGBE_FCOE
-       struct dcb_app app = {
-                             .selector = DCB_APP_IDTYPE_ETHTYPE,
-                             .protocol = ETH_P_FCOE,
-                            };
-       u8 up;
-
-       /* In IEEE mode, use the IEEE Ethertype selector value */
-       if (adapter->dcbx_cap & DCB_CAP_DCBX_VER_IEEE) {
-               app.selector = IEEE_8021QAZ_APP_SEL_ETHERTYPE;
-               up = dcb_ieee_getapp_mask(netdev, &app);
-       } else {
-               up = dcb_getapp(netdev, &app);
-       }
-#endif
 
        /* Fail command if not in CEE mode */
        if (!(adapter->dcbx_cap & DCB_CAP_DCBX_VER_CEE))
                return ret;
 
-       adapter->dcb_set_bitmap |= ixgbe_copy_dcb_cfg(&adapter->temp_dcb_cfg,
-                                                     &adapter->dcb_cfg,
+       adapter->dcb_set_bitmap |= ixgbe_copy_dcb_cfg(adapter,
                                                      MAX_TRAFFIC_CLASS);
        if (!adapter->dcb_set_bitmap)
                return ret;
@@ -440,8 +432,13 @@ static u8 ixgbe_dcbnl_set_all(struct net_device *netdev)
         * FCoE is using changes. This happens if the APP info
         * changes or the up2tc mapping is updated.
         */
-       if ((up && !(up & (1 << adapter->fcoe.up))) ||
-           (adapter->dcb_set_bitmap & BIT_APP_UPCHG)) {
+       if (adapter->dcb_set_bitmap & BIT_APP_UPCHG) {
+               struct dcb_app app = {
+                                     .selector = DCB_APP_IDTYPE_ETHTYPE,
+                                     .protocol = ETH_P_FCOE,
+                                    };
+               u8 up = dcb_getapp(netdev, &app);
+
                adapter->fcoe.up = ffs(up) - 1;
                ixgbe_dcbnl_devreset(netdev);
                ret = DCB_HW_CHG_RST;
index 31a2bf7..cfe7d26 100644 (file)
@@ -1780,6 +1780,8 @@ static u16 ixgbe_clean_test_rings(struct ixgbe_ring *rx_ring,
                rx_desc = IXGBE_RX_DESC(rx_ring, rx_ntc);
        }
 
+       netdev_tx_reset_queue(txring_txq(tx_ring));
+
        /* re-map buffers to ring, store next to clean values */
        ixgbe_alloc_rx_buffers(rx_ring, count);
        rx_ring->next_to_clean = rx_ntc;
index 88f6b2e..467948e 100644 (file)
@@ -2671,8 +2671,6 @@ void ixgbe_configure_tx_ring(struct ixgbe_adapter *adapter,
        /* enable queue */
        IXGBE_WRITE_REG(hw, IXGBE_TXDCTL(reg_idx), txdctl);
 
-       netdev_tx_reset_queue(txring_txq(ring));
-
        /* TXDCTL.EN will return 0 on 82598 if link is down, so skip it */
        if (hw->mac.type == ixgbe_mac_82598EB &&
            !(IXGBE_READ_REG(hw, IXGBE_LINKS) & IXGBE_LINKS_UP))
@@ -4167,6 +4165,8 @@ static void ixgbe_clean_tx_ring(struct ixgbe_ring *tx_ring)
                ixgbe_unmap_and_free_tx_resource(tx_ring, tx_buffer_info);
        }
 
+       netdev_tx_reset_queue(txring_txq(tx_ring));
+
        size = sizeof(struct ixgbe_tx_buffer) * tx_ring->count;
        memset(tx_ring->tx_buffer_info, 0, size);
 
@@ -4418,8 +4418,8 @@ static int __devinit ixgbe_sw_init(struct ixgbe_adapter *adapter)
        adapter->dcb_cfg.pfc_mode_enable = false;
        adapter->dcb_set_bitmap = 0x00;
        adapter->dcbx_cap = DCB_CAP_DCBX_HOST | DCB_CAP_DCBX_VER_CEE;
-       ixgbe_copy_dcb_cfg(&adapter->dcb_cfg, &adapter->temp_dcb_cfg,
-                          MAX_TRAFFIC_CLASS);
+       memcpy(&adapter->temp_dcb_cfg, &adapter->dcb_cfg,
+              sizeof(adapter->temp_dcb_cfg));
 
 #endif
 
@@ -4866,10 +4866,12 @@ static int __ixgbe_shutdown(struct pci_dev *pdev, bool *enable_wake)
        netif_device_detach(netdev);
 
        if (netif_running(netdev)) {
+               rtnl_lock();
                ixgbe_down(adapter);
                ixgbe_free_irq(adapter);
                ixgbe_free_all_tx_resources(adapter);
                ixgbe_free_all_rx_resources(adapter);
+               rtnl_unlock();
        }
 
        ixgbe_clear_interrupt_scheme(adapter);
index f8dda00..5e313e9 100644 (file)
@@ -618,10 +618,8 @@ static void ks8851_irq_work(struct work_struct *work)
        netif_dbg(ks, intr, ks->netdev,
                  "%s: status 0x%04x\n", __func__, status);
 
-       if (status & IRQ_LCI) {
-               /* should do something about checking link status */
+       if (status & IRQ_LCI)
                handled |= IRQ_LCI;
-       }
 
        if (status & IRQ_LDI) {
                u16 pmecr = ks8851_rdreg16(ks, KS_PMECR);
@@ -684,6 +682,9 @@ static void ks8851_irq_work(struct work_struct *work)
 
        mutex_unlock(&ks->lock);
 
+       if (status & IRQ_LCI)
+               mii_check_link(&ks->mii);
+
        if (status & IRQ_TXI)
                netif_wake_queue(ks->netdev);
 
index dd14915..ba78174 100644 (file)
@@ -584,7 +584,6 @@ struct pch_gbe_hw_stats {
 /**
  * struct pch_gbe_adapter - board specific private data structure
  * @stats_lock:        Spinlock structure for status
- * @tx_queue_lock:     Spinlock structure for transmit
  * @ethtool_lock:      Spinlock structure for ethtool
  * @irq_sem:           Semaphore for interrupt
  * @netdev:            Pointer of network device structure
@@ -609,7 +608,6 @@ struct pch_gbe_hw_stats {
 
 struct pch_gbe_adapter {
        spinlock_t stats_lock;
-       spinlock_t tx_queue_lock;
        spinlock_t ethtool_lock;
        atomic_t irq_sem;
        struct net_device *netdev;
index 8035e5f..1e38d50 100644 (file)
@@ -640,14 +640,11 @@ static void pch_gbe_mac_set_pause_packet(struct pch_gbe_hw *hw)
  */
 static int pch_gbe_alloc_queues(struct pch_gbe_adapter *adapter)
 {
-       int size;
-
-       size = (int)sizeof(struct pch_gbe_tx_ring);
-       adapter->tx_ring = kzalloc(size, GFP_KERNEL);
+       adapter->tx_ring = kzalloc(sizeof(*adapter->tx_ring), GFP_KERNEL);
        if (!adapter->tx_ring)
                return -ENOMEM;
-       size = (int)sizeof(struct pch_gbe_rx_ring);
-       adapter->rx_ring = kzalloc(size, GFP_KERNEL);
+
+       adapter->rx_ring = kzalloc(sizeof(*adapter->rx_ring), GFP_KERNEL);
        if (!adapter->rx_ring) {
                kfree(adapter->tx_ring);
                return -ENOMEM;
@@ -1162,7 +1159,6 @@ static void pch_gbe_tx_queue(struct pch_gbe_adapter *adapter,
        struct sk_buff *tmp_skb;
        unsigned int frame_ctrl;
        unsigned int ring_num;
-       unsigned long flags;
 
        /*-- Set frame control --*/
        frame_ctrl = 0;
@@ -1211,14 +1207,14 @@ static void pch_gbe_tx_queue(struct pch_gbe_adapter *adapter,
                        }
                }
        }
-       spin_lock_irqsave(&tx_ring->tx_lock, flags);
+
        ring_num = tx_ring->next_to_use;
        if (unlikely((ring_num + 1) == tx_ring->count))
                tx_ring->next_to_use = 0;
        else
                tx_ring->next_to_use = ring_num + 1;
 
-       spin_unlock_irqrestore(&tx_ring->tx_lock, flags);
+
        buffer_info = &tx_ring->buffer_info[ring_num];
        tmp_skb = buffer_info->skb;
 
@@ -1518,7 +1514,7 @@ pch_gbe_alloc_rx_buffers_pool(struct pch_gbe_adapter *adapter,
                                                &rx_ring->rx_buff_pool_logic,
                                                GFP_KERNEL);
        if (!rx_ring->rx_buff_pool) {
-               pr_err("Unable to allocate memory for the receive poll buffer\n");
+               pr_err("Unable to allocate memory for the receive pool buffer\n");
                return -ENOMEM;
        }
        memset(rx_ring->rx_buff_pool, 0, size);
@@ -1637,15 +1633,17 @@ pch_gbe_clean_tx(struct pch_gbe_adapter *adapter,
        pr_debug("called pch_gbe_unmap_and_free_tx_resource() %d count\n",
                 cleaned_count);
        /* Recover from running out of Tx resources in xmit_frame */
+       spin_lock(&tx_ring->tx_lock);
        if (unlikely(cleaned && (netif_queue_stopped(adapter->netdev)))) {
                netif_wake_queue(adapter->netdev);
                adapter->stats.tx_restart_count++;
                pr_debug("Tx wake queue\n");
        }
-       spin_lock(&adapter->tx_queue_lock);
+
        tx_ring->next_to_clean = i;
-       spin_unlock(&adapter->tx_queue_lock);
+
        pr_debug("next_to_clean : %d\n", tx_ring->next_to_clean);
+       spin_unlock(&tx_ring->tx_lock);
        return cleaned;
 }
 
@@ -2037,7 +2035,6 @@ static int pch_gbe_sw_init(struct pch_gbe_adapter *adapter)
                return -ENOMEM;
        }
        spin_lock_init(&adapter->hw.miim_lock);
-       spin_lock_init(&adapter->tx_queue_lock);
        spin_lock_init(&adapter->stats_lock);
        spin_lock_init(&adapter->ethtool_lock);
        atomic_set(&adapter->irq_sem, 0);
@@ -2142,10 +2139,10 @@ static int pch_gbe_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
                         tx_ring->next_to_use, tx_ring->next_to_clean);
                return NETDEV_TX_BUSY;
        }
-       spin_unlock_irqrestore(&tx_ring->tx_lock, flags);
 
        /* CRC,ITAG no support */
        pch_gbe_tx_queue(adapter, tx_ring, skb);
+       spin_unlock_irqrestore(&tx_ring->tx_lock, flags);
        return NETDEV_TX_OK;
 }
 
index f545093..ce6b44d 100644 (file)
 #define R8169_MSG_DEFAULT \
        (NETIF_MSG_DRV | NETIF_MSG_PROBE | NETIF_MSG_IFUP | NETIF_MSG_IFDOWN)
 
-#define TX_BUFFS_AVAIL(tp) \
-       (tp->dirty_tx + NUM_TX_DESC - tp->cur_tx - 1)
+#define TX_SLOTS_AVAIL(tp) \
+       (tp->dirty_tx + NUM_TX_DESC - tp->cur_tx)
+
+/* A skbuff with nr_frags needs nr_frags+1 entries in the tx queue */
+#define TX_FRAGS_READY_FOR(tp,nr_frags) \
+       (TX_SLOTS_AVAIL(tp) >= (nr_frags + 1))
 
 /* Maximum number of multicast addresses to filter (vs. Rx-all-multicast).
    The RTL chips use a 64 element hash table based on the Ethernet CRC. */
@@ -5115,7 +5119,7 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb,
        u32 opts[2];
        int frags;
 
-       if (unlikely(TX_BUFFS_AVAIL(tp) < skb_shinfo(skb)->nr_frags)) {
+       if (unlikely(!TX_FRAGS_READY_FOR(tp, skb_shinfo(skb)->nr_frags))) {
                netif_err(tp, drv, dev, "BUG! Tx Ring full when queue awake!\n");
                goto err_stop_0;
        }
@@ -5169,7 +5173,7 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb,
 
        mmiowb();
 
-       if (TX_BUFFS_AVAIL(tp) < MAX_SKB_FRAGS) {
+       if (!TX_FRAGS_READY_FOR(tp, MAX_SKB_FRAGS)) {
                /* Avoid wrongly optimistic queue wake-up: rtl_tx thread must
                 * not miss a ring update when it notices a stopped queue.
                 */
@@ -5183,7 +5187,7 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb,
                 * can't.
                 */
                smp_mb();
-               if (TX_BUFFS_AVAIL(tp) >= MAX_SKB_FRAGS)
+               if (TX_FRAGS_READY_FOR(tp, MAX_SKB_FRAGS))
                        netif_wake_queue(dev);
        }
 
@@ -5306,7 +5310,7 @@ static void rtl_tx(struct net_device *dev, struct rtl8169_private *tp)
                 */
                smp_mb();
                if (netif_queue_stopped(dev) &&
-                   (TX_BUFFS_AVAIL(tp) >= MAX_SKB_FRAGS)) {
+                   TX_FRAGS_READY_FOR(tp, MAX_SKB_FRAGS)) {
                        netif_wake_queue(dev);
                }
                /*
index 3cbfbff..4a00053 100644 (file)
@@ -1349,7 +1349,7 @@ static int efx_probe_interrupts(struct efx_nic *efx)
        }
 
        /* RSS might be usable on VFs even if it is disabled on the PF */
-       efx->rss_spread = (efx->n_rx_channels > 1 ?
+       efx->rss_spread = ((efx->n_rx_channels > 1 || !efx_sriov_wanted(efx)) ?
                           efx->n_rx_channels : efx_vf_size(efx));
 
        return 0;
index f975afd..025367a 100644 (file)
@@ -259,7 +259,7 @@ static int macvlan_queue_xmit(struct sk_buff *skb, struct net_device *dev)
 
 xmit_world:
        skb->ip_summed = ip_summed;
-       skb_set_dev(skb, vlan->lowerdev);
+       skb->dev = vlan->lowerdev;
        return dev_queue_xmit(skb);
 }
 
index 0427c65..cb8fd50 100644 (file)
@@ -1,5 +1,6 @@
 #include <linux/etherdevice.h>
 #include <linux/if_macvlan.h>
+#include <linux/if_vlan.h>
 #include <linux/interrupt.h>
 #include <linux/nsproxy.h>
 #include <linux/compat.h>
@@ -759,6 +760,8 @@ static ssize_t macvtap_put_user(struct macvtap_queue *q,
        struct macvlan_dev *vlan;
        int ret;
        int vnet_hdr_len = 0;
+       int vlan_offset = 0;
+       int copied;
 
        if (q->flags & IFF_VNET_HDR) {
                struct virtio_net_hdr vnet_hdr;
@@ -773,18 +776,48 @@ static ssize_t macvtap_put_user(struct macvtap_queue *q,
                if (memcpy_toiovecend(iv, (void *)&vnet_hdr, 0, sizeof(vnet_hdr)))
                        return -EFAULT;
        }
+       copied = vnet_hdr_len;
+
+       if (!vlan_tx_tag_present(skb))
+               len = min_t(int, skb->len, len);
+       else {
+               int copy;
+               struct {
+                       __be16 h_vlan_proto;
+                       __be16 h_vlan_TCI;
+               } veth;
+               veth.h_vlan_proto = htons(ETH_P_8021Q);
+               veth.h_vlan_TCI = htons(vlan_tx_tag_get(skb));
+
+               vlan_offset = offsetof(struct vlan_ethhdr, h_vlan_proto);
+               len = min_t(int, skb->len + VLAN_HLEN, len);
+
+               copy = min_t(int, vlan_offset, len);
+               ret = skb_copy_datagram_const_iovec(skb, 0, iv, copied, copy);
+               len -= copy;
+               copied += copy;
+               if (ret || !len)
+                       goto done;
+
+               copy = min_t(int, sizeof(veth), len);
+               ret = memcpy_toiovecend(iv, (void *)&veth, copied, copy);
+               len -= copy;
+               copied += copy;
+               if (ret || !len)
+                       goto done;
+       }
 
-       len = min_t(int, skb->len, len);
-
-       ret = skb_copy_datagram_const_iovec(skb, 0, iv, vnet_hdr_len, len);
+       ret = skb_copy_datagram_const_iovec(skb, vlan_offset, iv, copied, len);
+       copied += len;
 
+done:
        rcu_read_lock_bh();
        vlan = rcu_dereference_bh(q->vlan);
        if (vlan)
-               macvlan_count_rx(vlan, len, ret == 0, 0);
+               macvlan_count_rx(vlan, copied - vnet_hdr_len, ret == 0, 0);
        rcu_read_unlock_bh();
 
-       return ret ? ret : (len + vnet_hdr_len);
+       return ret ? ret : copied;
 }
 
 static ssize_t macvtap_do_read(struct macvtap_queue *q, struct kiocb *iocb,
index 90a3002..425e201 100644 (file)
@@ -83,6 +83,7 @@ int usbnet_generic_cdc_bind(struct usbnet *dev, struct usb_interface *intf)
        struct cdc_state                *info = (void *) &dev->data;
        int                             status;
        int                             rndis;
+       bool                            android_rndis_quirk = false;
        struct usb_driver               *driver = driver_of(intf);
        struct usb_cdc_mdlm_desc        *desc = NULL;
        struct usb_cdc_mdlm_detail_desc *detail = NULL;
@@ -195,6 +196,11 @@ int usbnet_generic_cdc_bind(struct usbnet *dev, struct usb_interface *intf)
                                        info->control,
                                        info->u->bSlaveInterface0,
                                        info->data);
+                               /* fall back to hard-wiring for RNDIS */
+                               if (rndis) {
+                                       android_rndis_quirk = true;
+                                       goto next_desc;
+                               }
                                goto bad_desc;
                        }
                        if (info->control != intf) {
@@ -271,11 +277,15 @@ next_desc:
        /* Microsoft ActiveSync based and some regular RNDIS devices lack the
         * CDC descriptors, so we'll hard-wire the interfaces and not check
         * for descriptors.
+        *
+        * Some Android RNDIS devices have a CDC Union descriptor pointing
+        * to non-existing interfaces.  Ignore that and attempt the same
+        * hard-wired 0 and 1 interfaces.
         */
-       if (rndis && !info->u) {
+       if (rndis && (!info->u || android_rndis_quirk)) {
                info->control = usb_ifnum_to_if(dev->udev, 0);
                info->data = usb_ifnum_to_if(dev->udev, 1);
-               if (!info->control || !info->data) {
+               if (!info->control || !info->data || info->control != intf) {
                        dev_dbg(&intf->dev,
                                "rndis: master #0/%p slave #1/%p\n",
                                info->control,
@@ -475,6 +485,7 @@ static const struct driver_info wwan_info = {
 /*-------------------------------------------------------------------------*/
 
 #define HUAWEI_VENDOR_ID       0x12D1
+#define NOVATEL_VENDOR_ID      0x1410
 
 static const struct usb_device_id      products [] = {
 /*
@@ -592,6 +603,21 @@ static const struct usb_device_id  products [] = {
  * because of bugs/quirks in a given product (like Zaurus, above).
  */
 {
+       /* Novatel USB551L */
+       /* This match must come *before* the generic CDC-ETHER match so that
+        * we get FLAG_WWAN set on the device, since it's descriptors are
+        * generic CDC-ETHER.
+        */
+       .match_flags    =   USB_DEVICE_ID_MATCH_VENDOR
+                | USB_DEVICE_ID_MATCH_PRODUCT
+                | USB_DEVICE_ID_MATCH_INT_INFO,
+       .idVendor               = NOVATEL_VENDOR_ID,
+       .idProduct              = 0xB001,
+       .bInterfaceClass        = USB_CLASS_COMM,
+       .bInterfaceSubClass     = USB_CDC_SUBCLASS_ETHERNET,
+       .bInterfaceProtocol     = USB_CDC_PROTO_NONE,
+       .driver_info = (unsigned long)&wwan_info,
+}, {
        USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ETHERNET,
                        USB_CDC_PROTO_NONE),
        .driver_info = (unsigned long) &cdc_info,
index 2d927fb..b38db48 100644 (file)
@@ -282,17 +282,32 @@ int usbnet_change_mtu (struct net_device *net, int new_mtu)
 }
 EXPORT_SYMBOL_GPL(usbnet_change_mtu);
 
+/* The caller must hold list->lock */
+static void __usbnet_queue_skb(struct sk_buff_head *list,
+                       struct sk_buff *newsk, enum skb_state state)
+{
+       struct skb_data *entry = (struct skb_data *) newsk->cb;
+
+       __skb_queue_tail(list, newsk);
+       entry->state = state;
+}
+
 /*-------------------------------------------------------------------------*/
 
 /* some LK 2.4 HCDs oopsed if we freed or resubmitted urbs from
  * completion callbacks.  2.5 should have fixed those bugs...
  */
 
-static void defer_bh(struct usbnet *dev, struct sk_buff *skb, struct sk_buff_head *list)
+static enum skb_state defer_bh(struct usbnet *dev, struct sk_buff *skb,
+               struct sk_buff_head *list, enum skb_state state)
 {
        unsigned long           flags;
+       enum skb_state          old_state;
+       struct skb_data *entry = (struct skb_data *) skb->cb;
 
        spin_lock_irqsave(&list->lock, flags);
+       old_state = entry->state;
+       entry->state = state;
        __skb_unlink(skb, list);
        spin_unlock(&list->lock);
        spin_lock(&dev->done.lock);
@@ -300,6 +315,7 @@ static void defer_bh(struct usbnet *dev, struct sk_buff *skb, struct sk_buff_hea
        if (dev->done.qlen == 1)
                tasklet_schedule(&dev->bh);
        spin_unlock_irqrestore(&dev->done.lock, flags);
+       return old_state;
 }
 
 /* some work can't be done in tasklets, so we use keventd
@@ -340,7 +356,6 @@ static int rx_submit (struct usbnet *dev, struct urb *urb, gfp_t flags)
        entry = (struct skb_data *) skb->cb;
        entry->urb = urb;
        entry->dev = dev;
-       entry->state = rx_start;
        entry->length = 0;
 
        usb_fill_bulk_urb (urb, dev->udev, dev->in,
@@ -372,7 +387,7 @@ static int rx_submit (struct usbnet *dev, struct urb *urb, gfp_t flags)
                        tasklet_schedule (&dev->bh);
                        break;
                case 0:
-                       __skb_queue_tail (&dev->rxq, skb);
+                       __usbnet_queue_skb(&dev->rxq, skb, rx_start);
                }
        } else {
                netif_dbg(dev, ifdown, dev->net, "rx: stopped\n");
@@ -423,16 +438,17 @@ static void rx_complete (struct urb *urb)
        struct skb_data         *entry = (struct skb_data *) skb->cb;
        struct usbnet           *dev = entry->dev;
        int                     urb_status = urb->status;
+       enum skb_state          state;
 
        skb_put (skb, urb->actual_length);
-       entry->state = rx_done;
+       state = rx_done;
        entry->urb = NULL;
 
        switch (urb_status) {
        /* success */
        case 0:
                if (skb->len < dev->net->hard_header_len) {
-                       entry->state = rx_cleanup;
+                       state = rx_cleanup;
                        dev->net->stats.rx_errors++;
                        dev->net->stats.rx_length_errors++;
                        netif_dbg(dev, rx_err, dev->net,
@@ -471,7 +487,7 @@ static void rx_complete (struct urb *urb)
                                  "rx throttle %d\n", urb_status);
                }
 block:
-               entry->state = rx_cleanup;
+               state = rx_cleanup;
                entry->urb = urb;
                urb = NULL;
                break;
@@ -482,17 +498,18 @@ block:
                // FALLTHROUGH
 
        default:
-               entry->state = rx_cleanup;
+               state = rx_cleanup;
                dev->net->stats.rx_errors++;
                netif_dbg(dev, rx_err, dev->net, "rx status %d\n", urb_status);
                break;
        }
 
-       defer_bh(dev, skb, &dev->rxq);
+       state = defer_bh(dev, skb, &dev->rxq, state);
 
        if (urb) {
                if (netif_running (dev->net) &&
-                   !test_bit (EVENT_RX_HALT, &dev->flags)) {
+                   !test_bit (EVENT_RX_HALT, &dev->flags) &&
+                   state != unlink_start) {
                        rx_submit (dev, urb, GFP_ATOMIC);
                        usb_mark_last_busy(dev->udev);
                        return;
@@ -579,16 +596,23 @@ EXPORT_SYMBOL_GPL(usbnet_purge_paused_rxq);
 static int unlink_urbs (struct usbnet *dev, struct sk_buff_head *q)
 {
        unsigned long           flags;
-       struct sk_buff          *skb, *skbnext;
+       struct sk_buff          *skb;
        int                     count = 0;
 
        spin_lock_irqsave (&q->lock, flags);
-       skb_queue_walk_safe(q, skb, skbnext) {
+       while (!skb_queue_empty(q)) {
                struct skb_data         *entry;
                struct urb              *urb;
                int                     retval;
 
-               entry = (struct skb_data *) skb->cb;
+               skb_queue_walk(q, skb) {
+                       entry = (struct skb_data *) skb->cb;
+                       if (entry->state != unlink_start)
+                               goto found;
+               }
+               break;
+found:
+               entry->state = unlink_start;
                urb = entry->urb;
 
                /*
@@ -1039,8 +1063,7 @@ static void tx_complete (struct urb *urb)
        }
 
        usb_autopm_put_interface_async(dev->intf);
-       entry->state = tx_done;
-       defer_bh(dev, skb, &dev->txq);
+       (void) defer_bh(dev, skb, &dev->txq, tx_done);
 }
 
 /*-------------------------------------------------------------------------*/
@@ -1096,7 +1119,6 @@ netdev_tx_t usbnet_start_xmit (struct sk_buff *skb,
        entry = (struct skb_data *) skb->cb;
        entry->urb = urb;
        entry->dev = dev;
-       entry->state = tx_start;
        entry->length = length;
 
        usb_fill_bulk_urb (urb, dev->udev, dev->out,
@@ -1155,7 +1177,7 @@ netdev_tx_t usbnet_start_xmit (struct sk_buff *skb,
                break;
        case 0:
                net->trans_start = jiffies;
-               __skb_queue_tail (&dev->txq, skb);
+               __usbnet_queue_skb(&dev->txq, skb, tx_start);
                if (dev->txq.qlen >= TX_QLEN (dev))
                        netif_stop_queue (net);
        }
index af8acc8..cbefe67 100644 (file)
@@ -492,7 +492,9 @@ static void virtnet_napi_enable(struct virtnet_info *vi)
         * We synchronize against interrupts via NAPI_STATE_SCHED */
        if (napi_schedule_prep(&vi->napi)) {
                virtqueue_disable_cb(vi->rvq);
+               local_bh_disable();
                __napi_schedule(&vi->napi);
+               local_bh_enable();
        }
 }
 
index deb6cfb..600aca9 100644 (file)
@@ -373,7 +373,7 @@ static void ar9003_hw_spur_ofdm_work(struct ath_hw *ah,
                        else
                                spur_subchannel_sd = 0;
 
-                       spur_freq_sd = (freq_offset << 9) / 11;
+                       spur_freq_sd = ((freq_offset + 10) << 9) / 11;
 
                } else {
                        if (REG_READ_FIELD(ah, AR_PHY_GEN_CTRL,
@@ -382,7 +382,7 @@ static void ar9003_hw_spur_ofdm_work(struct ath_hw *ah,
                        else
                                spur_subchannel_sd = 1;
 
-                       spur_freq_sd = (freq_offset << 9) / 11;
+                       spur_freq_sd = ((freq_offset - 10) << 9) / 11;
 
                }
 
index eb3829b..e2b34e1 100644 (file)
@@ -2637,6 +2637,7 @@ static int brcmf_sdbrcm_dpc_thread(void *data)
                                /* after stopping the bus, exit thread */
                                brcmf_sdbrcm_bus_stop(bus->sdiodev->dev);
                                bus->dpc_tsk = NULL;
+                               spin_lock_irqsave(&bus->dpc_tl_lock, flags);
                                break;
                        }
 
index f4b84d1..2247460 100644 (file)
@@ -773,8 +773,7 @@ static void iwlagn_pass_packet_to_mac80211(struct iwl_priv *priv,
        struct sk_buff *skb;
        __le16 fc = hdr->frame_control;
        struct iwl_rxon_context *ctx;
-       struct page *p;
-       int offset;
+       unsigned int hdrlen, fraglen;
 
        /* We only process data packets if the interface is open */
        if (unlikely(!priv->is_open)) {
@@ -788,16 +787,24 @@ static void iwlagn_pass_packet_to_mac80211(struct iwl_priv *priv,
            iwlagn_set_decrypted_flag(priv, hdr, ampdu_status, stats))
                return;
 
-       skb = dev_alloc_skb(128);
+       /* Dont use dev_alloc_skb(), we'll have enough headroom once
+        * ieee80211_hdr pulled.
+        */
+       skb = alloc_skb(128, GFP_ATOMIC);
        if (!skb) {
-               IWL_ERR(priv, "dev_alloc_skb failed\n");
+               IWL_ERR(priv, "alloc_skb failed\n");
                return;
        }
+       hdrlen = min_t(unsigned int, len, skb_tailroom(skb));
+       memcpy(skb_put(skb, hdrlen), hdr, hdrlen);
+       fraglen = len - hdrlen;
 
-       offset = (void *)hdr - rxb_addr(rxb);
-       p = rxb_steal_page(rxb);
-       skb_add_rx_frag(skb, 0, p, offset, len, len);
+       if (fraglen) {
+               int offset = (void *)hdr + hdrlen - rxb_addr(rxb);
 
+               skb_add_rx_frag(skb, 0, rxb_steal_page(rxb), offset,
+                               fraglen, rxb->truesize);
+       }
        iwl_update_stats(priv, false, fc, len);
 
        /*
index 8b1a798..aa7aea1 100644 (file)
@@ -374,8 +374,9 @@ static void iwl_rx_handle_rxbuf(struct iwl_trans *trans,
        if (WARN_ON(!rxb))
                return;
 
+       rxcb.truesize = PAGE_SIZE << hw_params(trans).rx_page_order;
        dma_unmap_page(trans->dev, rxb->page_dma,
-                      PAGE_SIZE << hw_params(trans).rx_page_order,
+                      rxcb.truesize,
                       DMA_FROM_DEVICE);
 
        rxcb._page = rxb->page;
index 0c81cba..fdf9788 100644 (file)
@@ -260,6 +260,7 @@ static inline void iwl_free_resp(struct iwl_host_cmd *cmd)
 
 struct iwl_rx_cmd_buffer {
        struct page *_page;
+       unsigned int truesize;
 };
 
 static inline void *rxb_addr(struct iwl_rx_cmd_buffer *r)
index cc15fdb..67f9430 100644 (file)
@@ -1851,14 +1851,6 @@ int __devinit rtl_pci_probe(struct pci_dev *pdev,
        /*like read eeprom and so on */
        rtlpriv->cfg->ops->read_eeprom_info(hw);
 
-       if (rtlpriv->cfg->ops->init_sw_vars(hw)) {
-               RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Can't init_sw_vars\n");
-               err = -ENODEV;
-               goto fail3;
-       }
-
-       rtlpriv->cfg->ops->init_sw_leds(hw);
-
        /*aspm */
        rtl_pci_init_aspm(hw);
 
@@ -1877,6 +1869,14 @@ int __devinit rtl_pci_probe(struct pci_dev *pdev,
                goto fail3;
        }
 
+       if (rtlpriv->cfg->ops->init_sw_vars(hw)) {
+               RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Can't init_sw_vars\n");
+               err = -ENODEV;
+               goto fail3;
+       }
+
+       rtlpriv->cfg->ops->init_sw_leds(hw);
+
        err = sysfs_create_group(&pdev->dev.kobj, &rtl_attribute_group);
        if (err) {
                RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
index d04dbda..a6049d7 100644 (file)
@@ -971,11 +971,6 @@ int __devinit rtl_usb_probe(struct usb_interface *intf,
        rtlpriv->cfg->ops->read_chip_version(hw);
        /*like read eeprom and so on */
        rtlpriv->cfg->ops->read_eeprom_info(hw);
-       if (rtlpriv->cfg->ops->init_sw_vars(hw)) {
-               RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Can't init_sw_vars\n");
-               goto error_out;
-       }
-       rtlpriv->cfg->ops->init_sw_leds(hw);
        err = _rtl_usb_init(hw);
        if (err)
                goto error_out;
@@ -987,6 +982,11 @@ int __devinit rtl_usb_probe(struct usb_interface *intf,
                         "Can't allocate sw for mac80211\n");
                goto error_out;
        }
+       if (rtlpriv->cfg->ops->init_sw_vars(hw)) {
+               RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, "Can't init_sw_vars\n");
+               goto error_out;
+       }
+       rtlpriv->cfg->ops->init_sw_leds(hw);
 
        return 0;
 error_out:
index 1929c0c..61e2fef 100644 (file)
@@ -223,7 +223,7 @@ static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state)
                [PCI_D0] = ACPI_STATE_D0,
                [PCI_D1] = ACPI_STATE_D1,
                [PCI_D2] = ACPI_STATE_D2,
-               [PCI_D3hot] = ACPI_STATE_D3_HOT,
+               [PCI_D3hot] = ACPI_STATE_D3,
                [PCI_D3cold] = ACPI_STATE_D3
        };
        int error = -EINVAL;
index 375eb04..6fff680 100644 (file)
@@ -30,6 +30,7 @@
 #include <linux/module.h>
 #include <linux/pci.h>
 #include <linux/ptp_clock_kernel.h>
+#include <linux/slab.h>
 
 #define STATION_ADDR_LEN       20
 #define PCI_DEVICE_ID_PCH_1588 0x8819
index ee15c68..e756a0d 100644 (file)
@@ -354,7 +354,7 @@ static void __rproc_free_vrings(struct rproc_vdev *rvdev, int i)
 {
        struct rproc *rproc = rvdev->rproc;
 
-       for (i--; i > 0; i--) {
+       for (i--; i >= 0; i--) {
                struct rproc_vring *rvring = &rvdev->vring[i];
                int size = PAGE_ALIGN(vring_size(rvring->len, rvring->align));
 
index 684ef4b..f027c06 100644 (file)
@@ -312,6 +312,7 @@ static int pl031_probe(struct amba_device *adev, const struct amba_id *id)
        int ret;
        struct pl031_local *ldata;
        struct rtc_class_ops *ops = id->data;
+       unsigned long time;
 
        ret = amba_request_regions(adev, NULL);
        if (ret)
@@ -343,6 +344,23 @@ static int pl031_probe(struct amba_device *adev, const struct amba_id *id)
                writel(readl(ldata->base + RTC_CR) | RTC_CR_CWEN,
                       ldata->base + RTC_CR);
 
+       /*
+        * On ST PL031 variants, the RTC reset value does not provide correct
+        * weekday for 2000-01-01. Correct the erroneous sunday to saturday.
+        */
+       if (ldata->hw_designer == AMBA_VENDOR_ST) {
+               if (readl(ldata->base + RTC_YDR) == 0x2000) {
+                       time = readl(ldata->base + RTC_DR);
+                       if ((time &
+                            (RTC_MON_MASK | RTC_MDAY_MASK | RTC_WDAY_MASK))
+                           == 0x02120000) {
+                               time = time | (0x7 << RTC_WDAY_SHIFT);
+                               writel(0x2000, ldata->base + RTC_YLR);
+                               writel(time, ldata->base + RTC_LR);
+                       }
+               }
+       }
+
        ldata->rtc = rtc_device_register("pl031", &adev->dev, ops,
                                        THIS_MODULE);
        if (IS_ERR(ldata->rtc)) {
index 351dc0b..a3a056a 100644 (file)
@@ -218,6 +218,9 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev,
 
        if (!shost->shost_gendev.parent)
                shost->shost_gendev.parent = dev ? dev : &platform_bus;
+       if (!dma_dev)
+               dma_dev = shost->shost_gendev.parent;
+
        shost->dma_dev = dma_dev;
 
        error = device_add(&shost->shost_gendev);
index f74cc06..bc3cc6d 100644 (file)
@@ -1367,6 +1367,9 @@ qla2x00_read_optrom(struct fc_bsg_job *bsg_job)
        struct qla_hw_data *ha = vha->hw;
        int rval = 0;
 
+       if (ha->flags.isp82xx_reset_hdlr_active)
+               return -EBUSY;
+
        rval = qla2x00_optrom_setup(bsg_job, vha, 0);
        if (rval)
                return rval;
index 897731b..62324a1 100644 (file)
@@ -15,7 +15,7 @@
  * | Mailbox commands             |       0x113e       | 0x112c-0x112e  |
  * |                              |                    | 0x113a         |
  * | Device Discovery             |       0x2086       | 0x2020-0x2022  |
- * | Queue Command and IO tracing |       0x302f       | 0x3006,0x3008  |
+ * | Queue Command and IO tracing |       0x3030       | 0x3006,0x3008  |
  * |                              |                    | 0x302d-0x302e  |
  * | DPC Thread                   |       0x401c       |               |
  * | Async Events                 |       0x505d       | 0x502b-0x502f  |
index f79844c..ce42288 100644 (file)
@@ -1715,13 +1715,24 @@ qla2x00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt)
                                res = DID_ERROR << 16;
                                break;
                        }
-               } else {
+               } else if (lscsi_status != SAM_STAT_TASK_SET_FULL &&
+                           lscsi_status != SAM_STAT_BUSY) {
+                       /*
+                        * scsi status of task set and busy are considered to be
+                        * task not completed.
+                        */
+
                        ql_dbg(ql_dbg_io, fcport->vha, 0x301f,
                            "Dropped frame(s) detected (0x%x "
-                           "of 0x%x bytes).\n", resid, scsi_bufflen(cp));
+                           "of 0x%x bytes).\n", resid,
+                           scsi_bufflen(cp));
 
                        res = DID_ERROR << 16 | lscsi_status;
                        goto check_scsi_status;
+               } else {
+                       ql_dbg(ql_dbg_io, fcport->vha, 0x3030,
+                           "scsi_status: 0x%x, lscsi_status: 0x%x\n",
+                           scsi_status, lscsi_status);
                }
 
                res = DID_OK << 16 | lscsi_status;
index f052853..de722a9 100644 (file)
@@ -3125,6 +3125,7 @@ qla82xx_need_reset_handler(scsi_qla_host_t *vha)
                ql_log(ql_log_info, vha, 0x00b7,
                    "HW State: COLD/RE-INIT.\n");
                qla82xx_wr_32(ha, QLA82XX_CRB_DEV_STATE, QLA82XX_DEV_COLD);
+               qla82xx_set_rst_ready(ha);
                if (ql2xmdenable) {
                        if (qla82xx_md_collect(vha))
                                ql_log(ql_log_warn, vha, 0xb02c,
index a2f9992..7db8033 100644 (file)
@@ -3577,9 +3577,25 @@ void qla2x00_relogin(struct scsi_qla_host *vha)
                                                continue;
                                        /* Attempt a retry. */
                                        status = 1;
-                               } else
+                               } else {
                                        status = qla2x00_fabric_login(vha,
                                            fcport, &next_loopid);
+                                       if (status ==  QLA_SUCCESS) {
+                                               int status2;
+                                               uint8_t opts;
+
+                                               opts = 0;
+                                               if (fcport->flags &
+                                                   FCF_FCP2_DEVICE)
+                                                       opts |= BIT_1;
+                                                       status2 =
+                                                           qla2x00_get_port_database(
+                                                               vha, fcport,
+                                                               opts);
+                                               if (status2 != QLA_SUCCESS)
+                                                       status = 1;
+                                       }
+                               }
                        } else
                                status = qla2x00_local_device_login(vha,
                                                                fcport);
index 3c13c0a..a683e76 100644 (file)
@@ -1017,6 +1017,9 @@ qla2xxx_flash_npiv_conf(scsi_qla_host_t *vha)
            !IS_CNA_CAPABLE(ha) && !IS_QLA2031(ha))
                return;
 
+       if (ha->flags.isp82xx_reset_hdlr_active)
+               return;
+
        ha->isp_ops->read_optrom(vha, (uint8_t *)&hdr,
            ha->flt_region_npiv_conf << 2, sizeof(struct qla_npiv_header));
        if (hdr.version == __constant_cpu_to_le16(0xffff))
index 29d780c..f5fdb16 100644 (file)
@@ -7,9 +7,9 @@
 /*
  * Driver version
  */
-#define QLA2XXX_VERSION      "8.03.07.13-k"
+#define QLA2XXX_VERSION      "8.04.00.03-k"
 
 #define QLA_DRIVER_MAJOR_VER   8
-#define QLA_DRIVER_MINOR_VER   3
-#define QLA_DRIVER_PATCH_VER   7
+#define QLA_DRIVER_MINOR_VER   4
+#define QLA_DRIVER_PATCH_VER   0
 #define QLA_DRIVER_BETA_VER    3
index efccd72..1b38431 100644 (file)
@@ -175,7 +175,8 @@ static void virtscsi_complete_free(void *buf)
 
        if (cmd->comp)
                complete_all(cmd->comp);
-       mempool_free(cmd, virtscsi_cmd_pool);
+       else
+               mempool_free(cmd, virtscsi_cmd_pool);
 }
 
 static void virtscsi_ctrl_done(struct virtqueue *vq)
@@ -311,21 +312,22 @@ out:
 static int virtscsi_tmf(struct virtio_scsi *vscsi, struct virtio_scsi_cmd *cmd)
 {
        DECLARE_COMPLETION_ONSTACK(comp);
-       int ret;
+       int ret = FAILED;
 
        cmd->comp = &comp;
-       ret = virtscsi_kick_cmd(vscsi, vscsi->ctrl_vq, cmd,
-                              sizeof cmd->req.tmf, sizeof cmd->resp.tmf,
-                              GFP_NOIO);
-       if (ret < 0)
-               return FAILED;
+       if (virtscsi_kick_cmd(vscsi, vscsi->ctrl_vq, cmd,
+                             sizeof cmd->req.tmf, sizeof cmd->resp.tmf,
+                             GFP_NOIO) < 0)
+               goto out;
 
        wait_for_completion(&comp);
-       if (cmd->resp.tmf.response != VIRTIO_SCSI_S_OK &&
-           cmd->resp.tmf.response != VIRTIO_SCSI_S_FUNCTION_SUCCEEDED)
-               return FAILED;
+       if (cmd->resp.tmf.response == VIRTIO_SCSI_S_OK ||
+           cmd->resp.tmf.response == VIRTIO_SCSI_S_FUNCTION_SUCCEEDED)
+               ret = SUCCESS;
 
-       return SUCCESS;
+out:
+       mempool_free(cmd, virtscsi_cmd_pool);
+       return ret;
 }
 
 static int virtscsi_device_reset(struct scsi_cmnd *sc)
index 7ed58e2..f286955 100644 (file)
@@ -169,6 +169,7 @@ static struct se_device *fd_create_virtdevice(
        inode = file->f_mapping->host;
        if (S_ISBLK(inode->i_mode)) {
                struct request_queue *q;
+               unsigned long long dev_size;
                /*
                 * Setup the local scope queue_limits from struct request_queue->limits
                 * to pass into transport_add_device_to_core_hba() as struct se_dev_limits.
@@ -183,13 +184,12 @@ static struct se_device *fd_create_virtdevice(
                 * one (1) logical sector from underlying struct block_device
                 */
                fd_dev->fd_block_size = bdev_logical_block_size(inode->i_bdev);
-               fd_dev->fd_dev_size = (i_size_read(file->f_mapping->host) -
+               dev_size = (i_size_read(file->f_mapping->host) -
                                       fd_dev->fd_block_size);
 
                pr_debug("FILEIO: Using size: %llu bytes from struct"
                        " block_device blocks: %llu logical_block_size: %d\n",
-                       fd_dev->fd_dev_size,
-                       div_u64(fd_dev->fd_dev_size, fd_dev->fd_block_size),
+                       dev_size, div_u64(dev_size, fd_dev->fd_block_size),
                        fd_dev->fd_block_size);
        } else {
                if (!(fd_dev->fbd_flags & FBDF_HAS_SIZE)) {
@@ -605,10 +605,20 @@ static u32 fd_get_device_type(struct se_device *dev)
 static sector_t fd_get_blocks(struct se_device *dev)
 {
        struct fd_dev *fd_dev = dev->dev_ptr;
-       unsigned long long blocks_long = div_u64(fd_dev->fd_dev_size,
-                       dev->se_sub_dev->se_dev_attrib.block_size);
+       struct file *f = fd_dev->fd_file;
+       struct inode *i = f->f_mapping->host;
+       unsigned long long dev_size;
+       /*
+        * When using a file that references an underlying struct block_device,
+        * ensure dev_size is always based on the current inode size in order
+        * to handle underlying block_device resize operations.
+        */
+       if (S_ISBLK(i->i_mode))
+               dev_size = (i_size_read(i) - fd_dev->fd_block_size);
+       else
+               dev_size = fd_dev->fd_dev_size;
 
-       return blocks_long;
+       return div_u64(dev_size, dev->se_sub_dev->se_dev_attrib.block_size);
 }
 
 static struct se_subsystem_api fileio_template = {
index 86f0c3b..c3148b1 100644 (file)
@@ -220,6 +220,9 @@ int target_scsi2_reservation_release(struct se_task *task)
        if (dev->dev_reserved_node_acl != sess->se_node_acl)
                goto out_unlock;
 
+       if (dev->dev_res_bin_isid != sess->sess_bin_isid)
+               goto out_unlock;
+
        dev->dev_reserved_node_acl = NULL;
        dev->dev_flags &= ~DF_SPC2_RESERVATIONS;
        if (dev->dev_flags & DF_SPC2_RESERVATIONS_WITH_ISID) {
index 70c3ffb..e320ec2 100644 (file)
@@ -60,7 +60,6 @@ static void core_clear_initiator_node_from_tpg(
        int i;
        struct se_dev_entry *deve;
        struct se_lun *lun;
-       struct se_lun_acl *acl, *acl_tmp;
 
        spin_lock_irq(&nacl->device_list_lock);
        for (i = 0; i < TRANSPORT_MAX_LUNS_PER_TPG; i++) {
@@ -81,28 +80,7 @@ static void core_clear_initiator_node_from_tpg(
                core_update_device_list_for_node(lun, NULL, deve->mapped_lun,
                        TRANSPORT_LUNFLAGS_NO_ACCESS, nacl, tpg, 0);
 
-               spin_lock(&lun->lun_acl_lock);
-               list_for_each_entry_safe(acl, acl_tmp,
-                                       &lun->lun_acl_list, lacl_list) {
-                       if (!strcmp(acl->initiatorname, nacl->initiatorname) &&
-                           (acl->mapped_lun == deve->mapped_lun))
-                               break;
-               }
-
-               if (!acl) {
-                       pr_err("Unable to locate struct se_lun_acl for %s,"
-                               " mapped_lun: %u\n", nacl->initiatorname,
-                               deve->mapped_lun);
-                       spin_unlock(&lun->lun_acl_lock);
-                       spin_lock_irq(&nacl->device_list_lock);
-                       continue;
-               }
-
-               list_del(&acl->lacl_list);
-               spin_unlock(&lun->lun_acl_lock);
-
                spin_lock_irq(&nacl->device_list_lock);
-               kfree(acl);
        }
        spin_unlock_irq(&nacl->device_list_lock);
 }
index 29ca20d..3b0c4e3 100644 (file)
@@ -2044,7 +2044,7 @@ int vt_do_kdskled(int console, int cmd, unsigned long arg, int perm)
                kbd->default_ledflagstate = ((arg >> 4) & 7);
                set_leds();
                 spin_unlock_irqrestore(&kbd_event_lock, flags);
-               break;
+               return 0;
 
        /* the ioctls below only set the lights, not the functions */
        /* for those, see KDGKBLED and KDSKBLED above */
index 1f21d2a..5c17010 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/if_arp.h>
 #include <linux/if_tun.h>
 #include <linux/if_macvlan.h>
+#include <linux/if_vlan.h>
 
 #include <net/sock.h>
 
@@ -283,8 +284,12 @@ static int peek_head_len(struct sock *sk)
 
        spin_lock_irqsave(&sk->sk_receive_queue.lock, flags);
        head = skb_peek(&sk->sk_receive_queue);
-       if (likely(head))
+       if (likely(head)) {
                len = head->len;
+               if (vlan_tx_tag_present(head))
+                       len += VLAN_HLEN;
+       }
+
        spin_unlock_irqrestore(&sk->sk_receive_queue.lock, flags);
        return len;
 }
index 26e83d7..b0e2a42 100644 (file)
@@ -73,7 +73,7 @@ static void uvesafb_cn_callback(struct cn_msg *msg, struct netlink_skb_parms *ns
        struct uvesafb_task *utask;
        struct uvesafb_ktask *task;
 
-       if (!cap_raised(current_cap(), CAP_SYS_ADMIN))
+       if (!capable(CAP_SYS_ADMIN))
                return;
 
        if (msg->seq >= UVESAFB_TASKS_MAX)
index c2d05a8..8807fe5 100644 (file)
@@ -390,6 +390,7 @@ static void __devexit virtballoon_remove(struct virtio_device *vdev)
        /* There might be pages left in the balloon: free them. */
        while (vb->num_pages)
                leak_balloon(vb, vb->num_pages);
+       update_balloon_size(vb);
 
        /* Now we reset the device so we can clean up the queues. */
        vdev->config->reset(vdev);
index 5dcc551..e0b56d7 100644 (file)
@@ -164,7 +164,8 @@ static const match_table_t cifs_mount_option_tokens = {
        { Opt_sign, "sign" },
        { Opt_seal, "seal" },
        { Opt_direct, "direct" },
-       { Opt_direct, "forceddirectio" },
+       { Opt_direct, "directio" },
+       { Opt_direct, "forcedirectio" },
        { Opt_strictcache, "strictcache" },
        { Opt_noac, "noac" },
        { Opt_fsc, "fsc" },
index ad271c7..5a2dec2 100644 (file)
@@ -234,8 +234,8 @@ int jffs2_garbage_collect_pass(struct jffs2_sb_info *c)
                        return 0;
 
                jffs2_dbg(1, "No progress from erasing block; doing GC anyway\n");
-               spin_lock(&c->erase_completion_lock);
                mutex_lock(&c->alloc_sem);
+               spin_lock(&c->erase_completion_lock);
        }
 
        /* First, work out which block we're garbage-collecting */
index 1c8b280..57b8159 100644 (file)
@@ -1799,10 +1799,15 @@ static int tid_fd_revalidate(struct dentry *dentry, struct nameidata *nd)
        if (task) {
                files = get_files_struct(task);
                if (files) {
+                       struct file *file;
                        rcu_read_lock();
-                       if (fcheck_files(files, fd)) {
+                       file = fcheck_files(files, fd);
+                       if (file) {
+                               unsigned i_mode, f_mode = file->f_mode;
+
                                rcu_read_unlock();
                                put_files_struct(files);
+
                                if (task_dumpable(task)) {
                                        rcu_read_lock();
                                        cred = __task_cred(task);
@@ -1813,7 +1818,14 @@ static int tid_fd_revalidate(struct dentry *dentry, struct nameidata *nd)
                                        inode->i_uid = 0;
                                        inode->i_gid = 0;
                                }
-                               inode->i_mode &= ~(S_ISUID | S_ISGID);
+
+                               i_mode = S_IFLNK;
+                               if (f_mode & FMODE_READ)
+                                       i_mode |= S_IRUSR | S_IXUSR;
+                               if (f_mode & FMODE_WRITE)
+                                       i_mode |= S_IWUSR | S_IXUSR;
+                               inode->i_mode = i_mode;
+
                                security_task_to_inode(task, inode);
                                put_task_struct(task);
                                return 1;
@@ -1837,8 +1849,6 @@ static struct dentry *proc_fd_instantiate(struct inode *dir,
        struct dentry *dentry, struct task_struct *task, const void *ptr)
 {
        unsigned fd = *(const unsigned *)ptr;
-       struct file *file;
-       struct files_struct *files;
        struct inode *inode;
        struct proc_inode *ei;
        struct dentry *error = ERR_PTR(-ENOENT);
@@ -1848,25 +1858,6 @@ static struct dentry *proc_fd_instantiate(struct inode *dir,
                goto out;
        ei = PROC_I(inode);
        ei->fd = fd;
-       files = get_files_struct(task);
-       if (!files)
-               goto out_iput;
-       inode->i_mode = S_IFLNK;
-
-       /*
-        * We are not taking a ref to the file structure, so we must
-        * hold ->file_lock.
-        */
-       spin_lock(&files->file_lock);
-       file = fcheck_files(files, fd);
-       if (!file)
-               goto out_unlock;
-       if (file->f_mode & FMODE_READ)
-               inode->i_mode |= S_IRUSR | S_IXUSR;
-       if (file->f_mode & FMODE_WRITE)
-               inode->i_mode |= S_IWUSR | S_IXUSR;
-       spin_unlock(&files->file_lock);
-       put_files_struct(files);
 
        inode->i_op = &proc_pid_link_inode_operations;
        inode->i_size = 64;
@@ -1879,12 +1870,6 @@ static struct dentry *proc_fd_instantiate(struct inode *dir,
 
  out:
        return error;
-out_unlock:
-       spin_unlock(&files->file_lock);
-       put_files_struct(files);
-out_iput:
-       iput(inode);
-       goto out;
 }
 
 static struct dentry *proc_lookupfd_common(struct inode *dir,
@@ -2177,16 +2162,16 @@ static struct dentry *proc_map_files_lookup(struct inode *dir,
                goto out;
 
        result = ERR_PTR(-EACCES);
-       if (lock_trace(task))
+       if (!ptrace_may_access(task, PTRACE_MODE_READ))
                goto out_put_task;
 
        result = ERR_PTR(-ENOENT);
        if (dname_to_vma_addr(dentry, &vm_start, &vm_end))
-               goto out_unlock;
+               goto out_put_task;
 
        mm = get_task_mm(task);
        if (!mm)
-               goto out_unlock;
+               goto out_put_task;
 
        down_read(&mm->mmap_sem);
        vma = find_exact_vma(mm, vm_start, vm_end);
@@ -2198,8 +2183,6 @@ static struct dentry *proc_map_files_lookup(struct inode *dir,
 out_no_vma:
        up_read(&mm->mmap_sem);
        mmput(mm);
-out_unlock:
-       unlock_trace(task);
 out_put_task:
        put_task_struct(task);
 out:
@@ -2233,7 +2216,7 @@ proc_map_files_readdir(struct file *filp, void *dirent, filldir_t filldir)
                goto out;
 
        ret = -EACCES;
-       if (lock_trace(task))
+       if (!ptrace_may_access(task, PTRACE_MODE_READ))
                goto out_put_task;
 
        ret = 0;
@@ -2241,12 +2224,12 @@ proc_map_files_readdir(struct file *filp, void *dirent, filldir_t filldir)
        case 0:
                ino = inode->i_ino;
                if (filldir(dirent, ".", 1, 0, ino, DT_DIR) < 0)
-                       goto out_unlock;
+                       goto out_put_task;
                filp->f_pos++;
        case 1:
                ino = parent_ino(dentry);
                if (filldir(dirent, "..", 2, 1, ino, DT_DIR) < 0)
-                       goto out_unlock;
+                       goto out_put_task;
                filp->f_pos++;
        default:
        {
@@ -2257,7 +2240,7 @@ proc_map_files_readdir(struct file *filp, void *dirent, filldir_t filldir)
 
                mm = get_task_mm(task);
                if (!mm)
-                       goto out_unlock;
+                       goto out_put_task;
                down_read(&mm->mmap_sem);
 
                nr_files = 0;
@@ -2287,7 +2270,7 @@ proc_map_files_readdir(struct file *filp, void *dirent, filldir_t filldir)
                                        flex_array_free(fa);
                                up_read(&mm->mmap_sem);
                                mmput(mm);
-                               goto out_unlock;
+                               goto out_put_task;
                        }
                        for (i = 0, vma = mm->mmap, pos = 2; vma;
                                        vma = vma->vm_next) {
@@ -2332,8 +2315,6 @@ proc_map_files_readdir(struct file *filp, void *dirent, filldir_t filldir)
        }
        }
 
-out_unlock:
-       unlock_trace(task);
 out_put_task:
        put_task_struct(task);
 out:
index 8a18358..fe5136d 100644 (file)
@@ -159,7 +159,8 @@ static inline void eth_hw_addr_random(struct net_device *dev)
  * @addr1: Pointer to a six-byte array containing the Ethernet address
  * @addr2: Pointer other six-byte array containing the Ethernet address
  *
- * Compare two ethernet addresses, returns 0 if equal
+ * Compare two ethernet addresses, returns 0 if equal, non-zero otherwise.
+ * Unlike memcmp(), it doesn't return a value suitable for sorting.
  */
 static inline unsigned compare_ether_addr(const u8 *addr1, const u8 *addr2)
 {
@@ -184,10 +185,10 @@ static inline unsigned long zap_last_2bytes(unsigned long value)
  * @addr1: Pointer to an array of 8 bytes
  * @addr2: Pointer to an other array of 8 bytes
  *
- * Compare two ethernet addresses, returns 0 if equal.
- * Same result than "memcmp(addr1, addr2, ETH_ALEN)" but without conditional
- * branches, and possibly long word memory accesses on CPU allowing cheap
- * unaligned memory reads.
+ * Compare two ethernet addresses, returns 0 if equal, non-zero otherwise.
+ * Unlike memcmp(), it doesn't return a value suitable for sorting.
+ * The function doesn't need any conditional branches and possibly uses
+ * word memory accesses on CPU allowing cheap unaligned memory reads.
  * arrays = { byte1, byte2, byte3, byte4, byte6, byte7, pad1, pad2}
  *
  * Please note that alignment of addr1 & addr2 is only guaranted to be 16 bits.
index 5f3f3be..176a939 100644 (file)
@@ -179,6 +179,7 @@ enum {
        TRACE_EVENT_FL_RECORDED_CMD_BIT,
        TRACE_EVENT_FL_CAP_ANY_BIT,
        TRACE_EVENT_FL_NO_SET_FILTER_BIT,
+       TRACE_EVENT_FL_IGNORE_ENABLE_BIT,
 };
 
 enum {
@@ -187,6 +188,7 @@ enum {
        TRACE_EVENT_FL_RECORDED_CMD     = (1 << TRACE_EVENT_FL_RECORDED_CMD_BIT),
        TRACE_EVENT_FL_CAP_ANY          = (1 << TRACE_EVENT_FL_CAP_ANY_BIT),
        TRACE_EVENT_FL_NO_SET_FILTER    = (1 << TRACE_EVENT_FL_NO_SET_FILTER_BIT),
+       TRACE_EVENT_FL_IGNORE_ENABLE    = (1 << TRACE_EVENT_FL_IGNORE_ENABLE_BIT),
 };
 
 struct ftrace_event_call {
index 5cbaa20..33900a5 100644 (file)
@@ -1403,15 +1403,6 @@ static inline bool netdev_uses_dsa_tags(struct net_device *dev)
        return 0;
 }
 
-#ifndef CONFIG_NET_NS
-static inline void skb_set_dev(struct sk_buff *skb, struct net_device *dev)
-{
-       skb->dev = dev;
-}
-#else /* CONFIG_NET_NS */
-void skb_set_dev(struct sk_buff *skb, struct net_device *dev);
-#endif
-
 static inline bool netdev_uses_trailer_tags(struct net_device *dev)
 {
 #ifdef CONFIG_NET_DSA_TAG_TRAILER
index 05a5d72..230a290 100644 (file)
@@ -99,6 +99,22 @@ struct ip_set_hash {
 #endif
 };
 
+static size_t
+htable_size(u8 hbits)
+{
+       size_t hsize;
+
+       /* We must fit both into u32 in jhash and size_t */
+       if (hbits > 31)
+               return 0;
+       hsize = jhash_size(hbits);
+       if ((((size_t)-1) - sizeof(struct htable))/sizeof(struct hbucket)
+           < hsize)
+               return 0;
+
+       return hsize * sizeof(struct hbucket) + sizeof(struct htable);
+}
+
 /* Compute htable_bits from the user input parameter hashsize */
 static u8
 htable_bits(u32 hashsize)
index 605b0aa..76f4396 100644 (file)
@@ -191,7 +191,8 @@ extern void usbnet_cdc_status(struct usbnet *, struct urb *);
 enum skb_state {
        illegal = 0,
        tx_start, tx_done,
-       rx_start, rx_done, rx_cleanup
+       rx_start, rx_done, rx_cleanup,
+       unlink_start
 };
 
 struct skb_data {      /* skb->cb is one of these */
index b5c2b6c..cad374b 100644 (file)
@@ -59,7 +59,8 @@ struct soc_camera_device {
 struct soc_camera_host {
        struct v4l2_device v4l2_dev;
        struct list_head list;
-       unsigned char nr;                               /* Host number */
+       struct mutex host_lock;         /* Protect during probing */
+       unsigned char nr;               /* Host number */
        void *priv;
        const char *drv_name;
        struct soc_camera_host_ops *ops;
index 262ebd1..a65910b 100644 (file)
@@ -191,6 +191,7 @@ struct bt_sock {
        struct list_head accept_q;
        struct sock *parent;
        u32 defer_setup;
+       bool suspended;
 };
 
 struct bt_sock_list {
index 6ee44b2..a2ef814 100644 (file)
@@ -704,4 +704,17 @@ static inline void sctp_v4_map_v6(union sctp_addr *addr)
        addr->v6.sin6_addr.s6_addr32[2] = htonl(0x0000ffff);
 }
 
+/* The cookie is always 0 since this is how it's used in the
+ * pmtu code.
+ */
+static inline struct dst_entry *sctp_transport_dst_check(struct sctp_transport *t)
+{
+       if (t->dst && !dst_check(t->dst, 0)) {
+               dst_release(t->dst);
+               t->dst = NULL;
+       }
+
+       return t->dst;
+}
+
 #endif /* __net_sctp_h__ */
index 6080f6b..3914c1e 100644 (file)
@@ -518,6 +518,7 @@ handle_edge_irq(unsigned int irq, struct irq_desc *desc)
 out_unlock:
        raw_spin_unlock(&desc->lock);
 }
+EXPORT_SYMBOL(handle_edge_irq);
 
 #ifdef CONFIG_IRQ_EDGE_EOI_HANDLER
 /**
index d86e254..192a302 100644 (file)
@@ -112,6 +112,7 @@ struct irq_desc *irq_to_desc(unsigned int irq)
 {
        return radix_tree_lookup(&irq_desc_tree, irq);
 }
+EXPORT_SYMBOL(irq_to_desc);
 
 static void delete_irq_desc(unsigned int irq)
 {
index 0533a68..e5212ae 100644 (file)
@@ -6382,6 +6382,8 @@ static int __sdt_alloc(const struct cpumask *cpu_map)
                        if (!sg)
                                return -ENOMEM;
 
+                       sg->next = sg;
+
                        *per_cpu_ptr(sdd->sg, j) = sg;
 
                        sgp = kzalloc_node(sizeof(struct sched_group_power),
index 079a93a..29111da 100644 (file)
@@ -294,6 +294,9 @@ static int __ftrace_set_clr_event(const char *match, const char *sub,
                if (!call->name || !call->class || !call->class->reg)
                        continue;
 
+               if (call->flags & TRACE_EVENT_FL_IGNORE_ENABLE)
+                       continue;
+
                if (match &&
                    strcmp(match, call->name) != 0 &&
                    strcmp(match, call->class->system) != 0)
@@ -1164,7 +1167,7 @@ event_create_dir(struct ftrace_event_call *call, struct dentry *d_events,
                return -1;
        }
 
-       if (call->class->reg)
+       if (call->class->reg && !(call->flags & TRACE_EVENT_FL_IGNORE_ENABLE))
                trace_create_file("enable", 0644, call->dir, call,
                                  enable);
 
index 3dd15e8..e039906 100644 (file)
@@ -180,6 +180,7 @@ struct ftrace_event_call __used event_##call = {                    \
        .event.type             = etype,                                \
        .class                  = &event_class_ftrace_##call,           \
        .print_fmt              = print,                                \
+       .flags                  = TRACE_EVENT_FL_IGNORE_ENABLE,         \
 };                                                                     \
 struct ftrace_event_call __used                                                \
 __attribute__((section("_ftrace_events"))) *__event_##call = &event_##call;
index b659260..7685d4a 100644 (file)
@@ -5481,7 +5481,7 @@ static int mem_cgroup_move_charge_pte_range(pmd_t *pmd,
         *    part of thp split is not executed yet.
         */
        if (pmd_trans_huge_lock(pmd, vma) == 1) {
-               if (!mc.precharge) {
+               if (mc.precharge < HPAGE_PMD_NR) {
                        spin_unlock(&vma->vm_mm->page_table_lock);
                        return 0;
                }
index b21b3db..918330f 100644 (file)
@@ -105,7 +105,7 @@ unsigned long totalreserve_pages __read_mostly;
  */
 unsigned long dirty_balance_reserve __read_mostly;
 
-int percpu_pagelist_fraction = 8;
+int percpu_pagelist_fraction;
 gfp_t gfp_allowed_mask __read_mostly = GFP_BOOT_MASK;
 
 #ifdef CONFIG_PM_SLEEP
index ffe13fd..80848cd 100644 (file)
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -2040,7 +2040,7 @@ static bool has_cpu_slab(int cpu, void *info)
        struct kmem_cache *s = info;
        struct kmem_cache_cpu *c = per_cpu_ptr(s->cpu_slab, cpu);
 
-       return !!(c->page);
+       return c->page || c->partial;
 }
 
 static void flush_all(struct kmem_cache *s)
index 9988d4a..9757c19 100644 (file)
@@ -157,7 +157,7 @@ static netdev_tx_t vlan_dev_hard_start_xmit(struct sk_buff *skb,
                skb = __vlan_hwaccel_put_tag(skb, vlan_tci);
        }
 
-       skb_set_dev(skb, vlan_dev_priv(dev)->real_dev);
+       skb->dev = vlan_dev_priv(dev)->real_dev;
        len = skb->len;
        if (netpoll_tx_running(dev))
                return skb->dev->netdev_ops->ndo_start_xmit(skb, skb->dev);
index 72eb187..6fb68a9 100644 (file)
@@ -450,7 +450,7 @@ unsigned int bt_sock_poll(struct file *file, struct socket *sock, poll_table *wa
                        sk->sk_state == BT_CONFIG)
                return mask;
 
-       if (sock_writeable(sk))
+       if (!bt_sk(sk)->suspended && sock_writeable(sk))
                mask |= POLLOUT | POLLWRNORM | POLLWRBAND;
        else
                set_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags);
index edfd61a..d6dc44c 100644 (file)
@@ -2784,6 +2784,14 @@ static inline void hci_acldata_packet(struct hci_dev *hdev, struct sk_buff *skb)
        if (conn) {
                hci_conn_enter_active_mode(conn, BT_POWER_FORCE_ACTIVE_OFF);
 
+               hci_dev_lock(hdev);
+               if (test_bit(HCI_MGMT, &hdev->dev_flags) &&
+                   !test_and_set_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags))
+                       mgmt_device_connected(hdev, &conn->dst, conn->type,
+                                             conn->dst_type, 0, NULL, 0,
+                                             conn->dev_class);
+               hci_dev_unlock(hdev);
+
                /* Send to upper protocol */
                l2cap_recv_acldata(conn, skb, flags);
                return;
index 6c06525..1266f78 100644 (file)
@@ -2039,6 +2039,12 @@ static inline void hci_encrypt_change_evt(struct hci_dev *hdev, struct sk_buff *
 
                clear_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags);
 
+               if (ev->status && conn->state == BT_CONNECTED) {
+                       hci_acl_disconn(conn, 0x13);
+                       hci_conn_put(conn);
+                       goto unlock;
+               }
+
                if (conn->state == BT_CONFIG) {
                        if (!ev->status)
                                conn->state = BT_CONNECTED;
@@ -2049,6 +2055,7 @@ static inline void hci_encrypt_change_evt(struct hci_dev *hdev, struct sk_buff *
                        hci_encrypt_cfm(conn, ev->status, ev->encrypt);
        }
 
+unlock:
        hci_dev_unlock(hdev);
 }
 
@@ -2102,7 +2109,7 @@ static inline void hci_remote_features_evt(struct hci_dev *hdev, struct sk_buff
                goto unlock;
        }
 
-       if (!ev->status) {
+       if (!ev->status && !test_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags)) {
                struct hci_cp_remote_name_req cp;
                memset(&cp, 0, sizeof(cp));
                bacpy(&cp.bdaddr, &conn->dst);
@@ -2871,7 +2878,7 @@ static inline void hci_remote_ext_features_evt(struct hci_dev *hdev, struct sk_b
        if (conn->state != BT_CONFIG)
                goto unlock;
 
-       if (!ev->status) {
+       if (!ev->status && !test_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags)) {
                struct hci_cp_remote_name_req cp;
                memset(&cp, 0, sizeof(cp));
                bacpy(&cp.bdaddr, &conn->dst);
index 94552b3..6f9c25b 100644 (file)
@@ -4589,6 +4589,11 @@ int l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt)
 
                if (!status && (chan->state == BT_CONNECTED ||
                                                chan->state == BT_CONFIG)) {
+                       struct sock *sk = chan->sk;
+
+                       bt_sk(sk)->suspended = false;
+                       sk->sk_state_change(sk);
+
                        l2cap_check_encryption(chan, encrypt);
                        l2cap_chan_unlock(chan);
                        continue;
index 29122ed..04e7c17 100644 (file)
@@ -592,10 +592,14 @@ static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname, ch
                        sk->sk_state = BT_CONFIG;
                        chan->state = BT_CONFIG;
 
-               /* or for ACL link, under defer_setup time */
-               } else if (sk->sk_state == BT_CONNECT2 &&
-                                       bt_sk(sk)->defer_setup) {
-                       err = l2cap_chan_check_security(chan);
+               /* or for ACL link */
+               } else if ((sk->sk_state == BT_CONNECT2 &&
+                          bt_sk(sk)->defer_setup) ||
+                          sk->sk_state == BT_CONNECTED) {
+                       if (!l2cap_chan_check_security(chan))
+                               bt_sk(sk)->suspended = true;
+                       else
+                               sk->sk_state_change(sk);
                } else {
                        err = -EINVAL;
                }
index 9bb8f87..99e1d75 100644 (file)
@@ -1617,10 +1617,14 @@ int dev_forward_skb(struct net_device *dev, struct sk_buff *skb)
                return NET_RX_DROP;
        }
        skb->skb_iif = 0;
-       skb_set_dev(skb, dev);
+       skb->dev = dev;
+       skb_dst_drop(skb);
        skb->tstamp.tv64 = 0;
        skb->pkt_type = PACKET_HOST;
        skb->protocol = eth_type_trans(skb, dev);
+       skb->mark = 0;
+       secpath_reset(skb);
+       nf_reset(skb);
        return netif_rx(skb);
 }
 EXPORT_SYMBOL_GPL(dev_forward_skb);
@@ -1869,36 +1873,6 @@ void netif_device_attach(struct net_device *dev)
 }
 EXPORT_SYMBOL(netif_device_attach);
 
-/**
- * skb_dev_set -- assign a new device to a buffer
- * @skb: buffer for the new device
- * @dev: network device
- *
- * If an skb is owned by a device already, we have to reset
- * all data private to the namespace a device belongs to
- * before assigning it a new device.
- */
-#ifdef CONFIG_NET_NS
-void skb_set_dev(struct sk_buff *skb, struct net_device *dev)
-{
-       skb_dst_drop(skb);
-       if (skb->dev && !net_eq(dev_net(skb->dev), dev_net(dev))) {
-               secpath_reset(skb);
-               nf_reset(skb);
-               skb_init_secmark(skb);
-               skb->mark = 0;
-               skb->priority = 0;
-               skb->nf_trace = 0;
-               skb->ipvs_property = 0;
-#ifdef CONFIG_NET_SCHED
-               skb->tc_index = 0;
-#endif
-       }
-       skb->dev = dev;
-}
-EXPORT_SYMBOL(skb_set_dev);
-#endif /* CONFIG_NET_NS */
-
 static void skb_warn_bad_offload(const struct sk_buff *skb)
 {
        static const netdev_features_t null_features = 0;
index 4d8ce93..b81369b 100644 (file)
@@ -1931,7 +1931,7 @@ static int pktgen_device_event(struct notifier_block *unused,
 {
        struct net_device *dev = ptr;
 
-       if (!net_eq(dev_net(dev), &init_net))
+       if (!net_eq(dev_net(dev), &init_net) || pktgen_exiting)
                return NOTIFY_DONE;
 
        /* It is OK that we do not hold the group lock right now,
@@ -3755,12 +3755,18 @@ static void __exit pg_cleanup(void)
 {
        struct pktgen_thread *t;
        struct list_head *q, *n;
+       LIST_HEAD(list);
 
        /* Stop all interfaces & threads */
        pktgen_exiting = true;
 
-       list_for_each_safe(q, n, &pktgen_threads) {
+       mutex_lock(&pktgen_thread_lock);
+       list_splice_init(&pktgen_threads, &list);
+       mutex_unlock(&pktgen_thread_lock);
+
+       list_for_each_safe(q, n, &list) {
                t = list_entry(q, struct pktgen_thread, th_list);
+               list_del(&t->th_list);
                kthread_stop(t->tsk);
                kfree(t);
        }
index bce36f1..30b88d7 100644 (file)
@@ -1370,6 +1370,8 @@ static int check_leaf(struct fib_table *tb, struct trie *t, struct leaf *l,
 
                        if (fa->fa_tos && fa->fa_tos != flp->flowi4_tos)
                                continue;
+                       if (fi->fib_dead)
+                               continue;
                        if (fa->fa_info->fib_scope < flp->flowi4_scope)
                                continue;
                        fib_alias_accessed(fa);
index 1272a88..6589e11 100644 (file)
@@ -851,8 +851,7 @@ new_segment:
 wait_for_sndbuf:
                set_bit(SOCK_NOSPACE, &sk->sk_socket->flags);
 wait_for_memory:
-               if (copied)
-                       tcp_push(sk, flags & ~MSG_MORE, mss_now, TCP_NAGLE_PUSH);
+               tcp_push(sk, flags & ~MSG_MORE, mss_now, TCP_NAGLE_PUSH);
 
                if ((err = sk_stream_wait_memory(sk, &timeo)) != 0)
                        goto do_error;
index 5139dea..828ce46 100644 (file)
@@ -364,6 +364,7 @@ hash_ip_create(struct ip_set *set, struct nlattr *tb[], u32 flags)
 {
        u32 hashsize = IPSET_DEFAULT_HASHSIZE, maxelem = IPSET_DEFAULT_MAXELEM;
        u8 netmask, hbits;
+       size_t hsize;
        struct ip_set_hash *h;
 
        if (!(set->family == NFPROTO_IPV4 || set->family == NFPROTO_IPV6))
@@ -405,9 +406,12 @@ hash_ip_create(struct ip_set *set, struct nlattr *tb[], u32 flags)
        h->timeout = IPSET_NO_TIMEOUT;
 
        hbits = htable_bits(hashsize);
-       h->table = ip_set_alloc(
-                       sizeof(struct htable)
-                       + jhash_size(hbits) * sizeof(struct hbucket));
+       hsize = htable_size(hbits);
+       if (hsize == 0) {
+               kfree(h);
+               return -ENOMEM;
+       }
+       h->table = ip_set_alloc(hsize);
        if (!h->table) {
                kfree(h);
                return -ENOMEM;
index 9c27e24..e8dbb49 100644 (file)
@@ -449,6 +449,7 @@ hash_ipport_create(struct ip_set *set, struct nlattr *tb[], u32 flags)
        struct ip_set_hash *h;
        u32 hashsize = IPSET_DEFAULT_HASHSIZE, maxelem = IPSET_DEFAULT_MAXELEM;
        u8 hbits;
+       size_t hsize;
 
        if (!(set->family == NFPROTO_IPV4 || set->family == NFPROTO_IPV6))
                return -IPSET_ERR_INVALID_FAMILY;
@@ -476,9 +477,12 @@ hash_ipport_create(struct ip_set *set, struct nlattr *tb[], u32 flags)
        h->timeout = IPSET_NO_TIMEOUT;
 
        hbits = htable_bits(hashsize);
-       h->table = ip_set_alloc(
-                       sizeof(struct htable)
-                       + jhash_size(hbits) * sizeof(struct hbucket));
+       hsize = htable_size(hbits);
+       if (hsize == 0) {
+               kfree(h);
+               return -ENOMEM;
+       }
+       h->table = ip_set_alloc(hsize);
        if (!h->table) {
                kfree(h);
                return -ENOMEM;
index 9134057..52f79d8 100644 (file)
@@ -467,6 +467,7 @@ hash_ipportip_create(struct ip_set *set, struct nlattr *tb[], u32 flags)
        struct ip_set_hash *h;
        u32 hashsize = IPSET_DEFAULT_HASHSIZE, maxelem = IPSET_DEFAULT_MAXELEM;
        u8 hbits;
+       size_t hsize;
 
        if (!(set->family == NFPROTO_IPV4 || set->family == NFPROTO_IPV6))
                return -IPSET_ERR_INVALID_FAMILY;
@@ -494,9 +495,12 @@ hash_ipportip_create(struct ip_set *set, struct nlattr *tb[], u32 flags)
        h->timeout = IPSET_NO_TIMEOUT;
 
        hbits = htable_bits(hashsize);
-       h->table = ip_set_alloc(
-                       sizeof(struct htable)
-                       + jhash_size(hbits) * sizeof(struct hbucket));
+       hsize = htable_size(hbits);
+       if (hsize == 0) {
+               kfree(h);
+               return -ENOMEM;
+       }
+       h->table = ip_set_alloc(hsize);
        if (!h->table) {
                kfree(h);
                return -ENOMEM;
index 5d05e69..97583f5 100644 (file)
@@ -616,6 +616,7 @@ hash_ipportnet_create(struct ip_set *set, struct nlattr *tb[], u32 flags)
        struct ip_set_hash *h;
        u32 hashsize = IPSET_DEFAULT_HASHSIZE, maxelem = IPSET_DEFAULT_MAXELEM;
        u8 hbits;
+       size_t hsize;
 
        if (!(set->family == NFPROTO_IPV4 || set->family == NFPROTO_IPV6))
                return -IPSET_ERR_INVALID_FAMILY;
@@ -645,9 +646,12 @@ hash_ipportnet_create(struct ip_set *set, struct nlattr *tb[], u32 flags)
        h->timeout = IPSET_NO_TIMEOUT;
 
        hbits = htable_bits(hashsize);
-       h->table = ip_set_alloc(
-                       sizeof(struct htable)
-                       + jhash_size(hbits) * sizeof(struct hbucket));
+       hsize = htable_size(hbits);
+       if (hsize == 0) {
+               kfree(h);
+               return -ENOMEM;
+       }
+       h->table = ip_set_alloc(hsize);
        if (!h->table) {
                kfree(h);
                return -ENOMEM;
index 7c3d945..1721cde 100644 (file)
@@ -460,6 +460,7 @@ hash_net_create(struct ip_set *set, struct nlattr *tb[], u32 flags)
        u32 hashsize = IPSET_DEFAULT_HASHSIZE, maxelem = IPSET_DEFAULT_MAXELEM;
        struct ip_set_hash *h;
        u8 hbits;
+       size_t hsize;
 
        if (!(set->family == NFPROTO_IPV4 || set->family == NFPROTO_IPV6))
                return -IPSET_ERR_INVALID_FAMILY;
@@ -489,9 +490,12 @@ hash_net_create(struct ip_set *set, struct nlattr *tb[], u32 flags)
        h->timeout = IPSET_NO_TIMEOUT;
 
        hbits = htable_bits(hashsize);
-       h->table = ip_set_alloc(
-                       sizeof(struct htable)
-                       + jhash_size(hbits) * sizeof(struct hbucket));
+       hsize = htable_size(hbits);
+       if (hsize == 0) {
+               kfree(h);
+               return -ENOMEM;
+       }
+       h->table = ip_set_alloc(hsize);
        if (!h->table) {
                kfree(h);
                return -ENOMEM;
index f24037f..33bafc9 100644 (file)
@@ -722,6 +722,7 @@ hash_netiface_create(struct ip_set *set, struct nlattr *tb[], u32 flags)
        struct ip_set_hash *h;
        u32 hashsize = IPSET_DEFAULT_HASHSIZE, maxelem = IPSET_DEFAULT_MAXELEM;
        u8 hbits;
+       size_t hsize;
 
        if (!(set->family == NFPROTO_IPV4 || set->family == NFPROTO_IPV6))
                return -IPSET_ERR_INVALID_FAMILY;
@@ -752,9 +753,12 @@ hash_netiface_create(struct ip_set *set, struct nlattr *tb[], u32 flags)
        h->ahash_max = AHASH_MAX_SIZE;
 
        hbits = htable_bits(hashsize);
-       h->table = ip_set_alloc(
-                       sizeof(struct htable)
-                       + jhash_size(hbits) * sizeof(struct hbucket));
+       hsize = htable_size(hbits);
+       if (hsize == 0) {
+               kfree(h);
+               return -ENOMEM;
+       }
+       h->table = ip_set_alloc(hsize);
        if (!h->table) {
                kfree(h);
                return -ENOMEM;
index ce2e771..3a5e198 100644 (file)
@@ -572,6 +572,7 @@ hash_netport_create(struct ip_set *set, struct nlattr *tb[], u32 flags)
        struct ip_set_hash *h;
        u32 hashsize = IPSET_DEFAULT_HASHSIZE, maxelem = IPSET_DEFAULT_MAXELEM;
        u8 hbits;
+       size_t hsize;
 
        if (!(set->family == NFPROTO_IPV4 || set->family == NFPROTO_IPV6))
                return -IPSET_ERR_INVALID_FAMILY;
@@ -601,9 +602,12 @@ hash_netport_create(struct ip_set *set, struct nlattr *tb[], u32 flags)
        h->timeout = IPSET_NO_TIMEOUT;
 
        hbits = htable_bits(hashsize);
-       h->table = ip_set_alloc(
-                       sizeof(struct htable)
-                       + jhash_size(hbits) * sizeof(struct hbucket));
+       hsize = htable_size(hbits);
+       if (hsize == 0) {
+               kfree(h);
+               return -ENOMEM;
+       }
+       h->table = ip_set_alloc(hsize);
        if (!h->table) {
                kfree(h);
                return -ENOMEM;
index e44e631..e66341e 100644 (file)
@@ -321,7 +321,7 @@ static int queue_userspace_packet(int dp_ifindex, struct sk_buff *skb,
                        return -ENOMEM;
 
                nskb = __vlan_put_tag(nskb, vlan_tx_tag_get(nskb));
-               if (!skb)
+               if (!nskb)
                        return -ENOMEM;
 
                nskb->vlan_tci = 0;
@@ -421,6 +421,19 @@ static int validate_sample(const struct nlattr *attr,
        return validate_actions(actions, key, depth + 1);
 }
 
+static int validate_tp_port(const struct sw_flow_key *flow_key)
+{
+       if (flow_key->eth.type == htons(ETH_P_IP)) {
+               if (flow_key->ipv4.tp.src && flow_key->ipv4.tp.dst)
+                       return 0;
+       } else if (flow_key->eth.type == htons(ETH_P_IPV6)) {
+               if (flow_key->ipv6.tp.src && flow_key->ipv6.tp.dst)
+                       return 0;
+       }
+
+       return -EINVAL;
+}
+
 static int validate_set(const struct nlattr *a,
                        const struct sw_flow_key *flow_key)
 {
@@ -462,18 +475,13 @@ static int validate_set(const struct nlattr *a,
                if (flow_key->ip.proto != IPPROTO_TCP)
                        return -EINVAL;
 
-               if (!flow_key->ipv4.tp.src || !flow_key->ipv4.tp.dst)
-                       return -EINVAL;
-
-               break;
+               return validate_tp_port(flow_key);
 
        case OVS_KEY_ATTR_UDP:
                if (flow_key->ip.proto != IPPROTO_UDP)
                        return -EINVAL;
 
-               if (!flow_key->ipv4.tp.src || !flow_key->ipv4.tp.dst)
-                       return -EINVAL;
-               break;
+               return validate_tp_port(flow_key);
 
        default:
                return -EINVAL;
@@ -1641,10 +1649,9 @@ static int ovs_vport_cmd_set(struct sk_buff *skb, struct genl_info *info)
        reply = ovs_vport_cmd_build_info(vport, info->snd_pid, info->snd_seq,
                                         OVS_VPORT_CMD_NEW);
        if (IS_ERR(reply)) {
-               err = PTR_ERR(reply);
                netlink_set_err(init_net.genl_sock, 0,
-                               ovs_dp_vport_multicast_group.id, err);
-               return 0;
+                               ovs_dp_vport_multicast_group.id, PTR_ERR(reply));
+               goto exit_unlock;
        }
 
        genl_notify(reply, genl_info_net(info), info->snd_pid,
index 1252c30..2a11ec2 100644 (file)
@@ -183,7 +183,8 @@ void ovs_flow_used(struct sw_flow *flow, struct sk_buff *skb)
        u8 tcp_flags = 0;
 
        if (flow->key.eth.type == htons(ETH_P_IP) &&
-           flow->key.ip.proto == IPPROTO_TCP) {
+           flow->key.ip.proto == IPPROTO_TCP &&
+           likely(skb->len >= skb_transport_offset(skb) + sizeof(struct tcphdr))) {
                u8 *tcp = (u8 *)tcp_hdr(skb);
                tcp_flags = *(tcp + TCP_FLAGS_OFFSET) & TCP_FLAG_MASK;
        }
index 817174e..8fc4dcd 100644 (file)
@@ -377,9 +377,7 @@ int sctp_packet_transmit(struct sctp_packet *packet)
         */
        skb_set_owner_w(nskb, sk);
 
-       /* The 'obsolete' field of dst is set to 2 when a dst is freed. */
-       if (!dst || (dst->obsolete > 1)) {
-               dst_release(dst);
+       if (!sctp_transport_dst_check(tp)) {
                sctp_transport_route(tp, NULL, sctp_sk(sk));
                if (asoc && (asoc->param_flags & SPP_PMTUD_ENABLE)) {
                        sctp_assoc_sync_pmtu(asoc);
index 3889330..b026ba0 100644 (file)
@@ -226,23 +226,6 @@ void sctp_transport_pmtu(struct sctp_transport *transport, struct sock *sk)
                transport->pathmtu = SCTP_DEFAULT_MAXSEGMENT;
 }
 
-/* this is a complete rip-off from __sk_dst_check
- * the cookie is always 0 since this is how it's used in the
- * pmtu code
- */
-static struct dst_entry *sctp_transport_dst_check(struct sctp_transport *t)
-{
-       struct dst_entry *dst = t->dst;
-
-       if (dst && dst->obsolete && dst->ops->check(dst, 0) == NULL) {
-               dst_release(t->dst);
-               t->dst = NULL;
-               return NULL;
-       }
-
-       return dst;
-}
-
 void sctp_transport_update_pmtu(struct sctp_transport *t, u32 pmtu)
 {
        struct dst_entry *dst;
index 4742cac..2cb1e08 100644 (file)
@@ -4415,9 +4415,9 @@ static int stac92xx_init(struct hda_codec *codec)
                def_conf = get_defcfg_connect(def_conf);
                /* skip any ports that don't have jacks since presence
                 * detection is useless */
-               if (def_conf != AC_JACK_PORT_COMPLEX) {
-                       if (def_conf != AC_JACK_PORT_NONE)
-                               stac_toggle_power_map(codec, nid, 1);
+               if (def_conf != AC_JACK_PORT_NONE &&
+                   !is_jack_detectable(codec, nid)) {
+                       stac_toggle_power_map(codec, nid, 1);
                        continue;
                }
                if (enable_pin_detect(codec, nid, STAC_PWR_EVENT)) {
index 07c44b7..3686417 100644 (file)
@@ -568,22 +568,22 @@ static const struct snd_kcontrol_new cs42l73_snd_controls[] = {
                        attn_tlv),
 
        SOC_SINGLE_TLV("SPK-IP Mono Volume",
-                       CS42L73_SPKMIPMA, 0, 0x3E, 1, attn_tlv),
+                       CS42L73_SPKMIPMA, 0, 0x3F, 1, attn_tlv),
        SOC_SINGLE_TLV("SPK-XSP Mono Volume",
-                       CS42L73_SPKMXSPA, 0, 0x3E, 1, attn_tlv),
+                       CS42L73_SPKMXSPA, 0, 0x3F, 1, attn_tlv),
        SOC_SINGLE_TLV("SPK-ASP Mono Volume",
-                       CS42L73_SPKMASPA, 0, 0x3E, 1, attn_tlv),
+                       CS42L73_SPKMASPA, 0, 0x3F, 1, attn_tlv),
        SOC_SINGLE_TLV("SPK-VSP Mono Volume",
-                       CS42L73_SPKMVSPMA, 0, 0x3E, 1, attn_tlv),
+                       CS42L73_SPKMVSPMA, 0, 0x3F, 1, attn_tlv),
 
        SOC_SINGLE_TLV("ESL-IP Mono Volume",
-                       CS42L73_ESLMIPMA, 0, 0x3E, 1, attn_tlv),
+                       CS42L73_ESLMIPMA, 0, 0x3F, 1, attn_tlv),
        SOC_SINGLE_TLV("ESL-XSP Mono Volume",
-                       CS42L73_ESLMXSPA, 0, 0x3E, 1, attn_tlv),
+                       CS42L73_ESLMXSPA, 0, 0x3F, 1, attn_tlv),
        SOC_SINGLE_TLV("ESL-ASP Mono Volume",
-                       CS42L73_ESLMASPA, 0, 0x3E, 1, attn_tlv),
+                       CS42L73_ESLMASPA, 0, 0x3F, 1, attn_tlv),
        SOC_SINGLE_TLV("ESL-VSP Mono Volume",
-                       CS42L73_ESLMVSPMA, 0, 0x3E, 1, attn_tlv),
+                       CS42L73_ESLMVSPMA, 0, 0x3F, 1, attn_tlv),
 
        SOC_ENUM("IP Digital Swap/Mono Select", ip_swap_enum),
 
index 6c1fe3a..2de12eb 100644 (file)
@@ -1144,7 +1144,7 @@ static int aif2clk_ev(struct snd_soc_dapm_widget *w,
                snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5,
                                    WM8994_AIF2DACL_ENA |
                                    WM8994_AIF2DACR_ENA, 0);
-               snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5,
+               snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_4,
                                    WM8994_AIF2ADCL_ENA |
                                    WM8994_AIF2ADCR_ENA, 0);
 
index 9bf3fc7..92271d3 100644 (file)
@@ -774,10 +774,10 @@ $(OUTPUT)perf.o perf.spec \
 # over the general rule for .o
 
 $(OUTPUT)util/%-flex.o: $(OUTPUT)util/%-flex.c $(OUTPUT)PERF-CFLAGS
-       $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -Iutil/ -Wno-redundant-decls -Wno-switch-default -Wno-unused-function $<
+       $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -Iutil/ -w $<
 
 $(OUTPUT)util/%-bison.o: $(OUTPUT)util/%-bison.c $(OUTPUT)PERF-CFLAGS
-       $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DYYENABLE_NLS=0 -DYYLTYPE_IS_TRIVIAL=0 -Iutil/ -Wno-redundant-decls -Wno-switch-default -Wno-unused-function $<
+       $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DYYENABLE_NLS=0 -DYYLTYPE_IS_TRIVIAL=0 -Iutil/ -w $<
 
 $(OUTPUT)%.o: %.c $(OUTPUT)PERF-CFLAGS
        $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $<
index c941bb6..1e5e9b2 100644 (file)
@@ -283,6 +283,8 @@ static int create_perf_stat_counter(struct perf_evsel *evsel,
 {
        struct perf_event_attr *attr = &evsel->attr;
        struct xyarray *group_fd = NULL;
+       bool exclude_guest_missing = false;
+       int ret;
 
        if (group && evsel != first)
                group_fd = first->fd;
@@ -293,16 +295,39 @@ static int create_perf_stat_counter(struct perf_evsel *evsel,
 
        attr->inherit = !no_inherit;
 
-       if (system_wide)
-               return perf_evsel__open_per_cpu(evsel, evsel_list->cpus,
+retry:
+       if (exclude_guest_missing)
+               evsel->attr.exclude_guest = evsel->attr.exclude_host = 0;
+
+       if (system_wide) {
+               ret = perf_evsel__open_per_cpu(evsel, evsel_list->cpus,
                                                group, group_fd);
+               if (ret)
+                       goto check_ret;
+               return 0;
+       }
+
        if (!target_pid && !target_tid && (!group || evsel == first)) {
                attr->disabled = 1;
                attr->enable_on_exec = 1;
        }
 
-       return perf_evsel__open_per_thread(evsel, evsel_list->threads,
-                                          group, group_fd);
+       ret = perf_evsel__open_per_thread(evsel, evsel_list->threads,
+                                         group, group_fd);
+       if (!ret)
+               return 0;
+       /* fall through */
+check_ret:
+       if (ret && errno == EINVAL) {
+               if (!exclude_guest_missing &&
+                   (evsel->attr.exclude_guest || evsel->attr.exclude_host)) {
+                       pr_debug("Old kernel, cannot exclude "
+                                "guest or host samples.\n");
+                       exclude_guest_missing = true;
+                       goto retry;
+               }
+       }
+       return ret;
 }
 
 /*
@@ -463,8 +488,13 @@ static int run_perf_stat(int argc __used, const char **argv)
 
        list_for_each_entry(counter, &evsel_list->entries, node) {
                if (create_perf_stat_counter(counter, first) < 0) {
+                       /*
+                        * PPC returns ENXIO for HW counters until 2.6.37
+                        * (behavior changed with commit b0a873e).
+                        */
                        if (errno == EINVAL || errno == ENOSYS ||
-                           errno == ENOENT || errno == EOPNOTSUPP) {
+                           errno == ENOENT || errno == EOPNOTSUPP ||
+                           errno == ENXIO) {
                                if (verbose)
                                        ui__warning("%s event is not supported by the kernel.\n",
                                                    event_name(counter));
index 4c7c2d7..c0b70c6 100644 (file)
@@ -296,7 +296,7 @@ int build_id_cache__add_s(const char *sbuild_id, const char *debugdir,
        if (mkdir_p(filename, 0755))
                goto out_free;
 
-       snprintf(filename + len, sizeof(filename) - len, "/%s", sbuild_id);
+       snprintf(filename + len, size - len, "/%s", sbuild_id);
 
        if (access(filename, F_OK)) {
                if (is_kallsyms) {